/* ===== Переменные ===== */
:root {
  --bg-0: #0b1020;
  --bg-1: #131a33;
  --gold: #f9c74f;
  --gold-soft: #fde68a;
  --red: #e63946;
  --green: #52b788;
  --ice: #90e0ef;
  --text: #eef2ff;
  --muted: #a6b0d0;
  --card: rgba(23, 32, 66, 0.72);
  --card-border: rgba(249, 199, 79, 0.35);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 70% -10%, #24346b 0%, transparent 60%),
    radial-gradient(900px 700px at -10% 110%, #3a1d4d 0%, transparent 55%),
    linear-gradient(160deg, var(--bg-0), var(--bg-1));
  background-attachment: fixed;
  overflow-x: hidden;
}

/* ===== Снег ===== */
#snow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  overflow: hidden;
}
.flake {
  position: absolute;
  top: -10px;
  color: #ffffff;
  user-select: none;
  will-change: transform;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.5);
}

/* ===== Центрированный контейнер под любые экраны ===== */
.wrap {
  position: relative;
  z-index: 6;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* Ограничиваем ширину, чтобы на ultra-wide оставался читаемый центр */
.card {
  width: min(760px, 92vw);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  padding: 36px 40px;
  text-align: center;
}

@media (min-width: 1400px) {
  .card { padding: 52px 64px; }
}

h1 {
  font-size: clamp(1.9rem, 5vw, 3.2rem);
  margin: 0 0 12px;
  color: var(--gold);
  letter-spacing: 0.5px;
  text-shadow: 0 2px 12px rgba(249, 199, 79, 0.35);
}

h2 {
  font-size: clamp(1.3rem, 3.5vw, 2rem);
  margin: 0 0 20px;
  color: var(--gold-soft);
}

p.lead {
  color: var(--muted);
  font-size: clamp(1rem, 2.4vw, 1.2rem);
  margin: 0 auto 28px;
  max-width: 60ch;
  line-height: 1.5;
}

/* ===== Поля и кнопки ===== */
input[type="text"] {
  width: 100%;
  max-width: 420px;
  padding: 15px 18px;
  font-size: 1.1rem;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  outline: none;
  margin-bottom: 20px;
}
input[type="text"]:focus {
  border-color: var(--gold);
  background: rgba(255, 255, 255, 0.1);
}

.btn {
  display: inline-block;
  cursor: pointer;
  border: none;
  border-radius: 12px;
  padding: 14px 26px;
  font-size: 1.05rem;
  font-weight: 600;
  color: #1a1a2e;
  background: linear-gradient(180deg, var(--gold), #f0a532);
  box-shadow: 0 8px 22px rgba(249, 199, 79, 0.35);
  transition: transform 0.08s ease, filter 0.15s ease;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(2px); }
.btn.block { display: block; width: 100%; max-width: 460px; margin: 8px auto; }

/* ===== Варианты ответов ===== */
.options {
  display: grid;
  gap: 14px;
  margin: 8px auto 0;
  max-width: 560px;
}
.option {
  text-align: left;
  width: 100%;
  padding: 16px 20px;
  font-size: 1.05rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s;
}
.option:hover {
  background: rgba(249, 199, 79, 0.14);
  border-color: var(--gold);
  transform: translateX(3px);
}
.option.selected {
  background: linear-gradient(180deg, var(--green), #3a9c6f);
  color: #06231a;
  border-color: var(--green);
}

/* ===== Прогресс и вопрос ===== */
.progress-track {
  width: 100%;
  max-width: 560px;
  height: 10px;
  margin: 6px auto 22px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--red));
  transition: width 0.4s ease;
}
.qnum { color: var(--ice); font-weight: 600; letter-spacing: 1px; }
.qtext {
  font-size: clamp(1.2rem, 3.4vw, 1.9rem);
  margin: 6px 0 8px;
  line-height: 1.35;
}
.qhint { color: var(--muted); font-size: 0.95rem; margin: 0 0 6px; }

/* Фон-картинка вопроса */
.qbg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  filter: brightness(0.42) saturate(1.1);
  transition: background-image 0.4s ease, filter 0.4s ease;
  pointer-events: none;
}

/* ===== Оболочка (iframe викторины) ===== */
/* Контент викторины грузится здесь. Музыка и снег — в родительской оболочке,
   поэтому они не прерываются при переходе между страницами. */
#app {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  z-index: 1;
  background: transparent;
}

/* ===== Верхняя панель: музыка ===== */
.topbar {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 20;
  display: flex;
  gap: 8px;
}
.icon-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background: rgba(15, 22, 48, 0.7);
  color: var(--gold);
  font-size: 1.3rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  backdrop-filter: blur(6px);
}
.icon-btn:hover { background: rgba(249, 199, 79, 0.18); }

/* ===== Карточка результата ===== */
.result-key {
  font-family: "Consolas", "SF Mono", monospace;
  font-size: clamp(1.3rem, 4vw, 2.1rem);
  letter-spacing: 2px;
  color: var(--gold);
  background: rgba(0, 0, 0, 0.35);
  border: 1px dashed var(--gold);
  border-radius: 12px;
  padding: 14px 18px;
  margin: 10px auto 20px;
  max-width: 480px;
  word-break: break-all;
}
.card-preview {
  margin: 0 auto 20px;
  max-width: 520px;
  border-radius: 16px;
  padding: 24px;
  background: linear-gradient(150deg, #1c2547, #2a1740);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  text-align: left;
}
.card-preview .cp-title { color: var(--gold); font-size: 1.3rem; font-weight: 700; margin-bottom: 8px; }
.card-preview .cp-name { color: var(--gold-soft); font-size: 1.15rem; margin-bottom: 12px; }
.card-preview .cp-desc { color: var(--text); line-height: 1.5; white-space: pre-line; }

.copy-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
.btn.ghost {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  box-shadow: none;
  border: 1px solid var(--card-border);
}
.btn.ghost:hover { background: rgba(255, 255, 255, 0.16); }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--green);
  color: #06231a;
  padding: 12px 22px;
  border-radius: 12px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.center { text-align: center; }
