/* ============================================================
   Угадай трек — музыкальная викторина «Своя игра»
   Тёмная тема телешоу. Чистый CSS, без зависимостей.
   ============================================================ */

:root {
  --bg-0: #080714;
  --bg-1: #100e26;
  --bg-2: #191338;
  --surface: #201a4a;
  --surface-hi: #2c2464;
  --line: #3d347e;

  --gold: #ffd85e;
  --gold-deep: #f7a41e;
  --accent: #7b5cff;
  --accent-hi: #a68bff;
  --cyan: #2fe0e6;
  --magenta: #ff4fa3;
  --green: #2ee68a;
  --red: #ff5c72;

  --text: #f5f4ff;
  --text-dim: #b0abd8;

  --radius: 18px;
  --radius-lg: 26px;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 44px rgba(123, 92, 255, 0.4);

  --font: "Montserrat", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 82% -12%, rgba(123, 92, 255, 0.28), transparent 60%),
    radial-gradient(900px 620px at 12% -8%, rgba(255, 79, 163, 0.16), transparent 55%),
    radial-gradient(1000px 700px at 0% 112%, rgba(47, 224, 230, 0.18), transparent 55%),
    linear-gradient(160deg, var(--bg-0), var(--bg-1) 60%, var(--bg-2));
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; border: none; }
input { font-family: inherit; }

/* -------------------- Экраны (роутинг) -------------------- */
.screen { display: none; min-height: 100vh; padding: 32px; animation: fadeIn 0.45s ease; }
.screen.active { display: block; }

/* «Короткие» экраны центрируем по вертикали, чтобы контент не прижимался вверху.
   Игровое поле и вопрос НЕ центрируем — там контента много, он должен идти сверху. */
#screen-teams.active,
#screen-rounds.active,
#screen-results.active {
  display: flex; flex-direction: column; justify-content: center;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.wrap { max-width: 1400px; margin: 0 auto; }

/* Боке-фон на экране вопроса: разгорается под музыку, затихает на паузе */
#screen-question { position: relative; }
#q-bokeh {
  position: absolute; inset: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none; opacity: 0; transition: opacity .5s ease;
}
#screen-question.active #q-bokeh { opacity: 1; }
#screen-question .wrap { position: relative; z-index: 1; }
@media (prefers-reduced-motion: reduce) { #q-bokeh { display: none; } }

/* Кнопка «во весь экран» — фиксирована в углу поверх всего */
.fs-btn {
  position: fixed; top: 16px; right: 16px; z-index: 50;
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; line-height: 1;
  background: rgba(255,255,255,.06); color: var(--text);
  border: 1px solid var(--line); cursor: pointer;
  backdrop-filter: blur(6px); transition: background .2s, transform .1s;
}
.fs-btn:hover { background: rgba(255,255,255,.12); }
.fs-btn:active { transform: scale(.94); }

/* -------------------- Кнопки -------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 34px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  border-radius: 999px;
  color: #16162e;
  background: linear-gradient(135deg, var(--gold), var(--gold-deep));
  box-shadow: 0 10px 26px rgba(245, 166, 35, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(245, 166, 35, 0.5); }
.btn:active { transform: translateY(0); }

.btn-lg { padding: 22px 56px; font-size: 1.4rem; }

.btn-ghost {
  background: var(--surface);
  color: var(--text);
  box-shadow: none;
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--surface-hi); box-shadow: none; }

.btn-accent {
  background: linear-gradient(135deg, var(--accent-hi), var(--accent));
  color: #fff;
  box-shadow: 0 10px 26px rgba(108, 92, 231, 0.45);
}
.btn-accent:hover { box-shadow: 0 14px 32px rgba(108, 92, 231, 0.6); }

.btn-green { background: linear-gradient(135deg, #3ee686, var(--green)); color: #05230f; box-shadow: none; }
.btn-red   { background: linear-gradient(135deg, #ff7d8e, var(--red));  color: #2c060d; box-shadow: none; }

.btn-sm { padding: 10px 18px; font-size: 0.9rem; }

/* -------------------- Логотип / заголовки -------------------- */
.brand {
  font-weight: 900;
  letter-spacing: 1px;
  line-height: 1;
  background: linear-gradient(120deg, var(--gold), var(--magenta) 42%, var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* -------------------- Главный экран -------------------- */
#screen-home .wrap {
  min-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 40px;
}
.home-logo { font-size: clamp(3rem, 11vw, 8rem); }
.home-eq {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  height: 70px;
}
.home-eq span {
  width: 12px;
  border-radius: 6px;
  background: linear-gradient(var(--cyan), var(--magenta));
  animation: eq 1.1s ease-in-out infinite;
}
.home-eq span:nth-child(2){animation-delay:.15s}
.home-eq span:nth-child(3){animation-delay:.3s}
.home-eq span:nth-child(4){animation-delay:.45s}
.home-eq span:nth-child(5){animation-delay:.6s}
@keyframes eq {
  0%,100%{ height: 18px; opacity:.6 }
  50%    { height: 70px; opacity:1 }
}
.home-sub { color: var(--text-dim); font-size: 1.3rem; font-weight: 500; letter-spacing: 3px; text-transform: uppercase; }

/* -------------------- Заголовок раздела -------------------- */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}
.section-title { font-size: clamp(1.6rem, 3vw, 2.6rem); font-weight: 800; }
.section-title small { display:block; color: var(--text-dim); font-size: .5em; font-weight: 500; letter-spacing: 2px; text-transform: uppercase; margin-top: 4px; }

/* -------------------- Создание команд -------------------- */
.card-center {
  max-width: 720px;
  margin: 6vh auto 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow);
}
.field { margin-bottom: 24px; }
.field label { display: block; margin-bottom: 10px; color: var(--text-dim); font-weight: 600; letter-spacing: .5px; }
.control {
  width: 100%;
  padding: 15px 18px;
  font-size: 1.05rem;
  color: var(--text);
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.control:focus { outline: none; border-color: var(--accent-hi); box-shadow: 0 0 0 3px rgba(108,92,231,.3); }

.team-inputs { display: flex; flex-direction: column; gap: 14px; margin-bottom: 8px; }
.team-input-row { display: flex; align-items: center; gap: 14px; }
.team-dot { width: 16px; height: 16px; border-radius: 50%; flex: none; }

.stepper { display: flex; align-items: center; gap: 16px; }
.stepper button {
  width: 52px; height: 52px; border-radius: 14px;
  font-size: 1.6rem; font-weight: 800;
  background: var(--bg-1); color: var(--text); border: 1px solid var(--line);
}
.stepper button:hover { background: var(--surface-hi); }
.stepper .count { font-size: 2rem; font-weight: 800; min-width: 40px; text-align: center; }

/* -------------------- Выбор раунда -------------------- */
.round-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 30px; margin-top: 4vh; }
.round-card {
  position: relative;
  padding: 60px 40px;
  min-height: 320px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(150deg, var(--surface-hi), var(--surface));
  display: flex; flex-direction: column; justify-content: space-between;
  overflow: hidden;
  transition: transform .25s ease, box-shadow .25s ease;
}
.round-card::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(600px 300px at 100% 0%, rgba(108,92,231,.35), transparent 60%);
  opacity: .7; pointer-events: none;
}
.round-card:hover { transform: translateY(-8px) scale(1.01); box-shadow: var(--shadow), var(--shadow-glow); }
.round-card .rc-num { font-size: 6rem; font-weight: 900; line-height: 1; opacity: .25; }
.round-card .rc-title { font-size: 2.4rem; font-weight: 800; position: relative; z-index: 1; }
.round-card .rc-meta { color: var(--text-dim); position: relative; z-index: 1; margin-top: 6px; }
.round-card.done { opacity: .55; }
.round-card .rc-badge {
  position: absolute; top: 22px; right: 22px; z-index: 2;
  padding: 6px 14px; border-radius: 999px; font-size: .8rem; font-weight: 700;
  background: rgba(46, 204, 113, .18); color: #6ff0a5; border: 1px solid rgba(46,204,113,.4);
}

/* -------------------- Игровое поле -------------------- */
.board {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(var(--cols, 5), 1fr);
}
.board-col { display: flex; flex-direction: column; gap: 14px; }
.cat-head {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 90px; padding: 12px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent), var(--accent-hi));
  font-weight: 800; font-size: 1.05rem; letter-spacing: .3px;
  box-shadow: var(--shadow);
}
.cell {
  position: relative;
  min-height: 92px;
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--surface-hi), var(--surface));
  border: 1px solid var(--line);
  color: var(--gold);
  font-size: 2rem; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s ease, box-shadow .15s ease, background .2s;
  overflow: hidden;
}
.cell:not(.played):hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow), var(--shadow-glow);
  background: linear-gradient(160deg, #34346f, var(--surface-hi));
}
.cell:not(.played)::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.12), transparent 70%);
  transform: translateX(-120%);
  transition: transform .5s;
}
.cell:not(.played):hover::before { transform: translateX(120%); }
.cell.played { color: var(--text-dim); opacity: .35; cursor: default; font-size: 1rem; }
.cell.played::after { content: "✓"; font-size: 1.4rem; }
.cell.played span { display: none; }

/* -------------------- Экран вопроса -------------------- */
.q-stage {
  max-width: 1000px; margin: 2vh auto 0;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 28px;
}
.q-tag {
  display: inline-flex; gap: 14px; align-items: center;
  padding: 10px 24px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font-weight: 700; letter-spacing: .5px;
}
.q-tag .q-value { color: var(--gold); font-size: 1.3rem; }

.q-card {
  width: 100%;
  background: linear-gradient(150deg, var(--surface-hi), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 50px 40px;
  box-shadow: var(--shadow);
  animation: popIn .5s cubic-bezier(.2,.9,.3,1.4);
}
@keyframes popIn {
  from { opacity: 0; transform: scale(.85) rotateX(12deg); }
  to   { opacity: 1; transform: scale(1) rotateX(0); }
}

.q-prompt { font-size: 1.8rem; font-weight: 700; line-height: 1.4; }
.continue-title {
  font-size: 2rem; font-weight: 800; line-height: 1.3;
  margin-bottom: 30px;
  background: linear-gradient(120deg, var(--gold), #fff 60%, var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.q-photo { max-width: 100%; max-height: 52vh; border-radius: var(--radius); box-shadow: var(--shadow); }
.q-lyric { font-size: 1.5rem; color: var(--cyan); font-style: italic; line-height: 1.5; }

/* фото исполнителя: «тогда» + «сейчас» рядом в одной карточке */
.photo-compare {
  display: flex; gap: 20px; justify-content: center; align-items: center;
  flex-wrap: wrap;
}
.photo-compare figure { margin: 0; display: flex; }
.photo-compare .q-photo {
  max-height: 46vh; object-fit: cover;
}
/* нынешнее фото мягко «выплывает» при показе ответа */
.photo-compare .photo-now {
  animation: photoIn .5s cubic-bezier(.2,.9,.3,1.4);
}
@keyframes photoIn {
  from { opacity: 0; transform: translateX(-16px) scale(.92); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@media (max-width: 560px) { .photo-compare .q-photo { max-height: 30vh; } }

/* «угадай по эмодзи»: крупная строка эмодзи */
.q-emoji {
  font-size: clamp(3.4rem, 12vw, 7rem);
  line-height: 1.15;
  letter-spacing: 8px;
  margin-bottom: 22px;
  filter: drop-shadow(0 8px 22px rgba(0, 0, 0, .5));
  animation: popIn .5s cubic-bezier(.2,.9,.3,1.4);
}

/* аудио-визуал */
.player {
  display: flex; flex-direction: column; align-items: center; gap: 26px; width: 100%;
}
.player-label {
  font-weight: 700; letter-spacing: .5px; color: var(--cyan);
  text-transform: uppercase; font-size: .95rem;
}
.answer-reveal .player { margin-top: 22px; gap: 18px; }
.answer-reveal .viz { height: 70px; }
.viz { display: flex; gap: 7px; align-items: flex-end; height: 120px; }
.viz span {
  width: 10px; border-radius: 6px;
  background: linear-gradient(var(--cyan), var(--magenta));
  height: 20px;
  transition: height .1s;
}
.viz.paused span { height: 20px !important; opacity: .4; }
.viz.playing span { animation: viz 0.8s ease-in-out infinite; }
@keyframes viz { 0%,100%{height:18px} 50%{height:110px} }

/* обратный отсчёт до обрыва (категория «продолжи песню») */
.countdown {
  font-size: 6rem; font-weight: 900; line-height: 1;
  color: var(--gold); min-height: 0; opacity: 0;
  transform: scale(.4); transition: opacity .15s;
  text-shadow: 0 0 30px rgba(255, 212, 77, .6);
}
.countdown.show { opacity: 1; animation: cdPulse .9s ease infinite; }
.countdown.stop {
  color: var(--red); font-size: clamp(2.6rem, 9vw, 4.4rem); letter-spacing: 2px;
  text-shadow: 0 0 34px rgba(255, 92, 114, .7);
  white-space: nowrap;
  animation: cdStop .5s ease;
}
@keyframes cdPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.25); }
}
@keyframes cdStop {
  0%   { transform: scale(.5); opacity: 0; }
  60%  { transform: scale(1.25); }
  100% { transform: scale(1); opacity: 1; }
}

.player-controls { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.timebar { width: 100%; max-width: 520px; height: 8px; border-radius: 999px; background: var(--bg-1); overflow: hidden; }
.timebar > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--accent)); transition: width .2s linear; }

.answer-reveal {
  margin-top: 6px;
  padding: 28px 30px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255,212,77,.15), rgba(245,166,35,.08));
  border: 1px solid rgba(255,212,77,.4);
  animation: fadeIn .4s ease;
}
.answer-reveal .ar-label { color: var(--gold); text-transform: uppercase; letter-spacing: 2px; font-size: .85rem; font-weight: 700; margin-bottom: 8px; }
.answer-reveal .ar-text { font-size: 1.9rem; font-weight: 800; }

.q-bottom { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }

/* начисление баллов */
.award {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  animation: fadeIn .4s ease;
}
.award-title { color: var(--text-dim); font-weight: 600; margin-bottom: 16px; letter-spacing: .5px; }
.award-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px,1fr)); gap: 14px; }
.award-team .at-name { white-space: nowrap; }
.award-team {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: 14px; background: var(--bg-1); border: 1px solid var(--line);
}
.award-team .at-name {
  display: flex; align-items: center; gap: 10px; font-weight: 700;
  text-align: center; justify-content: center;
}
.award-team .at-btns { display: flex; gap: 8px; align-items: center; justify-content: center; }
.award-team .at-btns button {
  width: 42px; height: 42px; border-radius: 12px; font-size: 1.3rem; font-weight: 800;
  border: 1px solid var(--line);
}
.award-team .plus  { background: rgba(46,204,113,.2); color:#7ef0ad; }
.award-team .minus { background: rgba(255,92,114,.2); color:#ff97a6; }
.award-team .at-input {
  width: 64px; height: 42px; border-radius: 12px; text-align: center;
  font-size: 1.1rem; font-weight: 800;
  background: var(--bg-1); color: var(--text); border: 1px solid var(--line);
}
.award-team .at-input:focus { outline: none; border-color: var(--accent, #7ef0ad); }
/* убираем стрелки у number-инпута — они мешают тапу */
.award-team .at-input::-webkit-outer-spin-button,
.award-team .at-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.award-team .at-input { -moz-appearance: textfield; }

/* -------------------- Табло со счётом (общее) -------------------- */
.scoreboard {
  display: flex; flex-wrap: wrap; gap: 14px;
  margin-top: 34px;
}
.score-card {
  flex: 1 1 160px;
  min-width: 150px;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--team-color, var(--accent));
  box-shadow: var(--shadow);
}
.score-card .sc-name { font-weight: 700; color: var(--text-dim); display:flex; align-items:center; gap:8px; margin-bottom: 6px; }
.score-card .sc-val { font-size: 2.4rem; font-weight: 900; color: var(--gold); line-height: 1; }
.score-card.leader { box-shadow: var(--shadow), 0 0 0 2px var(--gold) inset; }
.score-card.leader .sc-name::after { content: "👑"; }

/* -------------------- Экран итогов -------------------- */
.results-head { text-align: center; margin-bottom: 40px; }
.results-eyebrow {
  color: var(--text-dim); text-transform: uppercase; letter-spacing: 3px;
  font-weight: 600; font-size: .95rem; margin-bottom: 10px;
}
.results-title { font-size: clamp(2.6rem, 7vw, 5rem); font-weight: 900; }

/* пьедестал: три тумбы, победитель в центре и выше */
.podium {
  display: flex; align-items: flex-end; justify-content: center;
  gap: 22px; flex-wrap: wrap; margin-bottom: 40px;
}
.podium-col {
  display: flex; flex-direction: column; align-items: center;
  width: 220px; max-width: 40vw;
  animation: podiumRise .6s cubic-bezier(.2,.8,.3,1.2) both;
}
.podium-col.p1 { animation-delay: .15s; }
.podium-col.p2 { animation-delay: .05s; }
.podium-col.p3 { animation-delay: .25s; }
@keyframes podiumRise {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0); }
}
.podium-medal { font-size: 3.4rem; line-height: 1; margin-bottom: 6px; }
.podium-name {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  font-weight: 800; font-size: 1.15rem; text-align: center; margin-bottom: 4px;
}
.podium-score { font-size: 2.4rem; font-weight: 900; color: var(--gold); line-height: 1; margin-bottom: 12px; }
.podium-stand {
  width: 100%; border-radius: 16px 16px 0 0;
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 14px;
  background: linear-gradient(180deg, var(--surface-hi), var(--surface));
  border: 1px solid var(--line); border-bottom: none;
  box-shadow: var(--shadow);
}
.podium-place { font-size: 2.6rem; font-weight: 900; opacity: .5; }
.podium-col.p1 .podium-stand { height: 190px; background: linear-gradient(180deg, rgba(255,212,77,.35), var(--surface-hi)); box-shadow: var(--shadow), 0 0 40px rgba(255,212,77,.3); }
.podium-col.p2 .podium-stand { height: 140px; }
.podium-col.p3 .podium-stand { height: 105px; }
.podium-col.gold .podium-name { color: var(--gold); }

/* полная таблица мест */
.standings { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.standing-row {
  display: flex; align-items: center; gap: 18px;
  padding: 16px 22px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
}
.standing-row.winner { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset, var(--shadow); }
.standing-place { font-size: 1.6rem; min-width: 44px; text-align: center; font-weight: 800; }
.standing-name { flex: 1; display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.2rem; }
.standing-score { font-size: 1.7rem; font-weight: 900; color: var(--gold); }
.standing-unit { font-size: .9rem; color: var(--text-dim); font-weight: 600; }

.results-actions {
  display: flex; gap: 16px; justify-content: center; flex-wrap: wrap;
  margin-top: 44px;
}

/* -------------------- Верхняя панель -------------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 8px;
}
.topbar .brand { font-size: 1.6rem; }
.topbar-actions { display: flex; gap: 10px; }

/* -------------------- Утилиты -------------------- */
.hidden { display: none !important; }
.spacer { flex: 1; }
.text-dim { color: var(--text-dim); }

/* Узкий экран: колонки категорий сохраняем, но компактнее.
   Структура всегда «заголовок сверху, клетки под ним» — не ломаем. */
@media (max-width: 900px) {
  .board { gap: 10px; }
  .board-col { gap: 10px; }
  .cat-head { min-height: 64px; font-size: .9rem; padding: 8px; }
  .cell { min-height: 68px; font-size: 1.5rem; }
  .screen { padding: 18px; }
}
@media (max-width: 600px) {
  .cat-head { font-size: .78rem; }
  .cell { min-height: 56px; font-size: 1.2rem; }
}
