/* ============================================================
   EN UNA NOTA — Pantalla host
   ============================================================ */

.host-body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 640px at 76% -12%, rgba(16, 255, 160, 0.12), transparent 62%),
    radial-gradient(1000px 700px at 4% 112%, rgba(123, 97, 255, 0.14), transparent 58%),
    var(--bg);
}

.host-wrap {
  width: min(1520px, 100%);
}

.host-topbar {
  height: 74px;
  border-bottom: 1px solid var(--line);
  margin-bottom: clamp(16px, 2.4vw, 30px);
}

.host-top-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chip-room {
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

.chip-room b {
  color: var(--accent);
  letter-spacing: 0.14em;
}

.chip-room:hover {
  border-color: rgba(16, 255, 160, 0.4);
  color: var(--text);
}

#conn-chip .dot.on {
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

.host-main {
  padding-bottom: 40px;
}

.host-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 120px 20px;
}

.host-error .error-card {
  max-width: 560px;
  margin: 60px auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.host-error .error-card > .material-symbols-outlined {
  font-size: 46px;
  color: var(--coral);
}

.host-error h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* ---------- lobby ---------- */
.lobby-card {
  padding: clamp(24px, 4vw, 52px);
  background:
    radial-gradient(700px 400px at 90% 0%, rgba(16, 255, 160, 0.08), transparent 60%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.024), transparent 40%),
    var(--surface);
}

.lobby-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: clamp(26px, 4vw, 56px);
  align-items: center;
}

.lobby-title {
  font-family: var(--font-display);
  font-size: clamp(44px, 6.4vw, 86px);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.045em;
  margin: 16px 0 18px;
}

.lobby-lead {
  max-width: 520px;
  color: var(--muted);
  font-size: clamp(14px, 1.4vw, 16px);
}

.lobby-pin-row {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  flex-wrap: wrap;
  margin: 26px 0 20px;
  padding: 18px 20px;
  border-radius: var(--r-lg);
  background: var(--bg-deep);
  border: 1px solid var(--line);
  width: fit-content;
  max-width: 100%;
}

.lobby-pin {
  font-size: clamp(30px, 4vw, 46px);
  margin-top: 2px;
}

.lobby-teams {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.lobby-teams .chip {
  padding: 7px 12px;
}

.lobby-teams .team-0 {
  border-color: rgba(16, 255, 160, 0.35);
  color: var(--accent);
}

.lobby-teams .team-1 {
  border-color: rgba(123, 97, 255, 0.35);
  color: #b9aaff;
}

.lobby-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.lobby-start {
  min-height: 56px;
  padding: 0 30px;
  font-size: 15px;
}

#lobby-host-note {
  margin: 14px 0 0;
  max-width: 460px;
  display: none;
}

body:not(.is-host) #lobby-host-note {
  display: block;
}

body:not(.is-host) .lobby-start {
  display: none;
}

.lobby-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lobby-qr-card {
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 22px;
  background: var(--bg-deep);
}

.lobby-qr {
  width: min(230px, 100%);
  height: auto;
  aspect-ratio: 1;
  padding: 10px;
  margin-bottom: 14px;
}

.lobby-qr-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.lobby-qr-meta strong {
  font-family: var(--font-display);
  font-size: 15px;
}

.lobby-qr-meta .break {
  max-width: 100%;
}

.lobby-tips {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.tip .material-symbols-outlined {
  font-size: 16px;
  color: var(--accent);
  flex: none;
  width: 20px;
}

/* ---------- cabecera del juego ---------- */
.game-head {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.round-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.round-pill .tiny {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 9px;
}

.round-pill strong {
  font-family: var(--font-display);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.round-pill strong i {
  font-style: normal;
  color: var(--faint);
  margin: 0 2px;
  font-weight: 500;
}

.turn-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 15px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 12.5px;
  white-space: nowrap;
}

.turn-chip b {
  font-family: var(--font-display);
  font-weight: 700;
}

.turn-chip .dot {
  width: 7px;
  height: 7px;
}

.turn-chip.turn-0 {
  border-color: rgba(16, 255, 160, 0.35);
  background: rgba(16, 255, 160, 0.07);
}

.turn-chip.turn-0 b { color: var(--accent); }
.turn-chip.turn-0 .dot { background: var(--accent); box-shadow: 0 0 10px var(--accent); }

.turn-chip.turn-1 {
  border-color: rgba(123, 97, 255, 0.4);
  background: rgba(123, 97, 255, 0.08);
}

.turn-chip.turn-1 b { color: #b9aaff; }
.turn-chip.turn-1 .dot { background: var(--violet); box-shadow: 0 0 10px var(--violet); }

.scoreboard {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 16px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.score {
  display: flex;
  align-items: baseline;
  gap: 8px;
  opacity: 0.55;
  transition: opacity 0.2s;
}

.score.active {
  opacity: 1;
}

.score-name {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score strong {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.score[data-team="0"].active strong { color: var(--accent); }
.score[data-team="1"].active strong { color: #b9aaff; }

.score-vs {
  color: var(--faint);
  font-family: var(--font-display);
  font-size: 18px;
}

.timer-ring {
  --p: 100;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), rgba(255, 255, 255, 0.07) 0);
  transition: background 0.3s linear;
  flex: none;
}

.timer-ring::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--bg-deep);
  border: 1px solid var(--line);
}

.timer-ring span,
.timer-ring small {
  position: relative;
  z-index: 1;
  line-height: 1;
}

.timer-ring span {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.timer-ring small {
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--faint);
  margin-top: 2px;
}

.timer-ring.low {
  background: conic-gradient(var(--coral) calc(var(--p) * 1%), rgba(255, 255, 255, 0.07) 0);
}

.timer-ring.low span {
  color: var(--coral);
}

.timer-ring.done {
  animation: timer-pulse 1s ease-in-out infinite;
}

@keyframes timer-pulse {
  50% { box-shadow: 0 0 0 6px rgba(255, 51, 102, 0.12); }
}

.timer-ring.no-limit::before {
  background: var(--surface);
}

.timer-ring.no-limit span {
  font-size: 18px;
}

/* ---------- juego ---------- */
.game-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 14px;
  align-items: start;
}

.game-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: clamp(18px, 2.4vw, 30px);
  border-radius: var(--r-xl);
  background:
    radial-gradient(520px 300px at 50% 0%, rgba(16, 255, 160, 0.09), transparent 65%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 42%),
    var(--surface);
  border: 1px solid var(--line);
  min-height: 100%;
}

.game-vinyl {
  --disc-size: clamp(190px, 21vw, 280px);
  width: fit-content;
  margin-top: 10px;
}

.game-vinyl .tonearm {
  width: clamp(58px, 6vw, 82px);
}

.game-stage.revealed .vinyl-scene::before {
  background: radial-gradient(circle, rgba(16, 255, 160, 0.22), transparent 62%);
}

.stage-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  max-width: 560px;
}

.game-prompt {
  font-family: var(--font-display);
  font-size: clamp(22px, 2.6vw, 32px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.game-lyric {
  font-size: clamp(14px, 1.6vw, 17px);
  font-style: italic;
  color: var(--accent);
  background: rgba(16, 255, 160, 0.07);
  border: 1px dashed rgba(16, 255, 160, 0.28);
  border-radius: var(--r-md);
  padding: 10px 14px;
  max-width: 100%;
}

.audio-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--bg-deep);
  border: 1px solid var(--line);
}

.audio-row .eq {
  height: 20px;
  gap: 3px;
}

.audio-row .eq span {
  width: 3px;
}

.eq.off span {
  animation-play-state: paused;
  height: 10% !important;
  opacity: 0.25;
}

.audience-live {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
  margin-top: auto;
  padding-top: 6px;
}

.audience-live strong {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.audience-live .sep {
  color: var(--faint);
  margin: 0 2px;
}

.game-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.game-options {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.game-options .option {
  padding: 14px 16px;
  min-height: 78px;
  background: var(--surface);
  border-radius: var(--r-lg);
  cursor: default;
}

.game-options.can-pick .option {
  cursor: pointer;
}

.game-options.can-pick .option:hover {
  transform: translateY(-1px);
  border-color: rgba(16, 255, 160, 0.38);
}

.game-options .option-cover {
  width: 54px;
}

.option-cover .initial {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: rgba(0, 0, 0, 0.55);
}

.game-options .option-title {
  font-size: clamp(15px, 1.5vw, 19px);
}

.game-options .option-meta {
  font-size: 12px;
}

.game-options .option-votes {
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.game-options .option-votes small {
  font-size: 9px;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.game-options .option-pct {
  font-size: 22px;
  min-width: 56px;
}

.game-options .option .option-bar {
  transition: width 0.9s var(--ease);
}

.game-hint {
  padding: 11px 14px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}

.game-hint.ok {
  color: var(--accent);
  border-color: rgba(16, 255, 160, 0.35);
  background: rgba(16, 255, 160, 0.06);
}

.game-hint.bad {
  color: var(--coral);
  border-color: rgba(255, 51, 102, 0.35);
  background: rgba(255, 51, 102, 0.06);
}

.host-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.host-controls .btn {
  flex: 1;
  min-width: 140px;
  justify-content: center;
}

.host-controls .end-btn {
  flex: 0 0 auto;
  min-width: 0;
}

.spectator-note {
  display: none;
  text-align: center;
  padding: 10px;
}

body:not(.is-host) .host-controls {
  display: none;
}

body:not(.is-host) .spectator-note {
  display: block;
}

/* ---------- final ---------- */
.final-card {
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(26px, 4vw, 48px);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.final-title {
  font-family: var(--font-display);
  font-size: clamp(36px, 5.4vw, 68px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-top: 10px;
}

.final-sub {
  margin-bottom: 8px;
}

.final-scores {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 3vw, 44px);
  width: 100%;
  margin: 14px 0 10px;
  flex-wrap: wrap;
}

.final-team {
  flex: 1;
  min-width: 180px;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 20px;
  border-radius: var(--r-lg);
  background: var(--bg-deep);
  border: 1px solid var(--line);
}

.final-team.winner {
  border-color: rgba(16, 255, 160, 0.5);
  background: radial-gradient(300px 160px at 50% 0%, rgba(16, 255, 160, 0.14), transparent 70%), var(--bg-deep);
  box-shadow: var(--glow);
}

.final-team-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.final-team strong {
  font-family: var(--font-display);
  font-size: clamp(42px, 6vw, 70px);
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.final-team[data-team="0"] strong { color: var(--accent); }
.final-team[data-team="1"] strong { color: #b9aaff; }

.final-team.winner strong {
  text-shadow: 0 0 32px rgba(16, 255, 160, 0.4);
}

.final-vs {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.12em;
  color: var(--faint);
}

.final-history-wrap {
  width: 100%;
  margin-top: 16px;
  text-align: left;
}

.final-history {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 280px;
  overflow-y: auto;
}

.hist-row {
  display: grid;
  grid-template-columns: 26px 1fr 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  border-radius: var(--r-md);
  background: var(--bg-deep);
  border: 1px solid var(--line);
  font-size: 12px;
}

.hist-row .hist-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
}

.hist-row .hist-icon.ok {
  background: rgba(16, 255, 160, 0.15);
  color: var(--accent);
}

.hist-row .hist-icon.bad {
  background: rgba(255, 51, 102, 0.13);
  color: var(--coral);
}

.hist-row .hist-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.hist-row .hist-main strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hist-row .hist-main span {
  color: var(--faint);
  font-size: 10.5px;
}

.hist-row .hist-team {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hist-row .hist-pts {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 13px;
  color: var(--faint);
  white-space: nowrap;
}

.hist-row .hist-pts.pos {
  color: var(--accent);
}

.final-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 22px;
}

/* ---------- QR modal (compartido) ---------- */
.room-modal-qr {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 16px;
  border-radius: var(--r-lg);
  background: var(--bg-deep);
  border: 1px solid var(--line);
  flex-wrap: wrap;
}

.room-modal-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.break {
  word-break: break-all;
}

/* ---------- reproductor oculto ---------- */
.yt-offscreen {
  position: fixed;
  left: -10000px;
  top: 0;
  width: 360px;
  height: 202px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
}

.yt-offscreen iframe {
  width: 360px;
  height: 202px;
  border: 0;
}

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .lobby-grid {
    grid-template-columns: 1fr;
  }
  .lobby-side {
    flex-direction: row;
    align-items: stretch;
    flex-wrap: wrap;
  }
  .lobby-qr-card {
    flex: 0 0 auto;
  }
  .lobby-tips {
    flex: 1;
    min-width: 240px;
    justify-content: center;
  }
}

@media (max-width: 980px) {
  .game-grid {
    grid-template-columns: 1fr;
  }
  .game-head {
    grid-template-columns: auto 1fr auto;
  }
  .scoreboard {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: stretch;
    justify-content: center;
  }
  .timer-ring {
    grid-column: 3;
    grid-row: 1;
  }
}

@media (max-width: 760px) {
  .host-topbar {
    height: auto;
    padding: 12px 0;
    gap: 10px;
    flex-wrap: wrap;
  }
  .host-top-meta {
    width: 100%;
    justify-content: flex-end;
  }
  .game-head {
    display: flex;
    flex-wrap: wrap;
  }
  .scoreboard {
    order: 4;
    width: 100%;
  }
  .score-name {
    max-width: 90px;
  }
  .lobby-side {
    flex-direction: column;
  }
  .lobby-qr {
    width: 190px;
  }
  .hist-row {
    grid-template-columns: 24px 1fr auto;
  }
  .hist-row .hist-team {
    display: none;
  }
}

@media (max-width: 480px) {
  .game-options .option {
    padding: 11px 12px;
    min-height: 66px;
    gap: 10px;
  }
  .game-options .option-cover {
    width: 44px;
  }
  .game-options .option-pct {
    font-size: 18px;
    min-width: 44px;
  }
  .final-scores {
    flex-direction: column;
  }
  .final-vs {
    display: none;
  }
  .final-team {
    width: 100%;
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .disc,
  .eq span,
  .timer-ring.done {
    animation: none !important;
  }
}
