:root {
  --bg: #050505;
  --panel: rgba(19, 19, 19, .92);
  --line: rgba(255,255,255,.16);
  --text: #f7f7f1;
  --muted: #a7a7a0;
  --accent: #dfff5f;
  --green: #55d879;
  --orange: #ffbc45;
  --red: #ff5c7a;
  --dark: #101010;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% 12%, rgba(223,255,95,.18), transparent 28rem),
    radial-gradient(circle at 85% 52%, rgba(223,255,95,.09), transparent 29rem),
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px),
    var(--bg);
  background-size: auto, auto, 72px 72px, 72px 72px, auto;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }

.app {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

.hero {
  display: grid;
  min-height: 310px;
  place-items: center;
  gap: 18px;
  text-align: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 950;
}

.brand-mark {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: radial-gradient(circle at 65% 50%, var(--bg) 0 35%, transparent 36%), var(--accent);
  box-shadow: 0 0 20px rgba(223,255,95,.55);
}

h1 {
  font-size: clamp(68px, 14vw, 150px);
  line-height: .78;
  letter-spacing: 0;
}

h2 {
  font-size: clamp(36px, 6vw, 68px);
  line-height: .9;
}

h3 { font-size: 22px; }

.lede {
  max-width: 760px;
  color: var(--muted);
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 750;
}

.panel, .mini-panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(255,255,255,.075), rgba(255,255,255,.02));
  box-shadow: 0 30px 80px rgba(0,0,0,.35);
}

.panel { padding: clamp(20px, 4vw, 34px); }
.mini-panel { display: grid; gap: 14px; padding: 18px; }

.kicker, label span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.gate, .game, .lobby-view, .play-view, .arena {
  display: grid;
  gap: 18px;
}

.gate-grid, .lobby-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

label { display: grid; gap: 8px; }

input, select {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 18px;
  outline: none;
  background: rgba(255,255,255,.07);
  color: var(--text);
  padding: 0 16px;
  font-weight: 850;
}

select option {
  background: #111;
  color: var(--text);
}

input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(223,255,95,.12);
}

.button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 20px;
  font-weight: 950;
}

.button-light {
  border-color: transparent;
  background: var(--accent);
  color: #090909;
  box-shadow: 0 18px 42px rgba(223,255,95,.22);
}

.button-dark {
  background: rgba(255,255,255,.075);
  color: var(--text);
}

.button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.status {
  color: var(--accent);
  font-weight: 850;
}

.lobby-panel, .section-title, .player-row, .player-meta, .top-bar, .arena-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.lobby-actions, .host-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

#code-label, #play-code-label {
  color: var(--accent);
  letter-spacing: .1em;
}

.players {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.player-row {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.055);
  padding: 10px 12px;
}

.self-name { color: var(--accent); }

.score-pill, .pill, .turn-pill {
  border: 1px solid color-mix(in srgb, var(--accent), transparent 45%);
  border-radius: 999px;
  color: var(--accent);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.setup-panel {
  display: grid;
  gap: 18px;
  align-content: start;
}

.top-bar {
  position: sticky;
  top: 14px;
  z-index: 3;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(10,10,10,.86);
  backdrop-filter: blur(18px);
  padding: 12px 14px 12px 20px;
  box-shadow: 0 24px 60px rgba(0,0,0,.34);
}

.top-bar strong {
  color: var(--accent);
  font-size: 28px;
}

.arena {
  min-height: 64vh;
}

.arena-head {
  align-items: flex-start;
}

.arena-head > div, .arena-head {
  min-width: 0;
}

#arena-copy {
  max-width: 760px;
  color: var(--muted);
  font-size: 18px;
  font-weight: 720;
  line-height: 1.4;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.score-card {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.055);
  padding: 14px;
}

.score-card strong {
  font-size: clamp(26px, 4vw, 42px);
  line-height: .92;
}

.score-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.define-form {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
}

.rating-orb {
  display: grid;
  place-items: center;
  min-height: 180px;
  border: 1px solid color-mix(in srgb, var(--accent), transparent 35%);
  border-radius: 28px;
  background: radial-gradient(circle at 50% 20%, rgba(223,255,95,.28), transparent 13rem), rgba(223,255,95,.06);
  text-align: center;
}

.rating-orb span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.rating-orb strong {
  font-size: clamp(54px, 8vw, 86px);
  line-height: .9;
}

.clue-card {
  display: grid;
  gap: 12px;
  border: 1px solid color-mix(in srgb, var(--accent), transparent 55%);
  border-radius: 26px;
  background: rgba(255,255,255,.055);
  padding: clamp(20px, 4vw, 34px);
}

.clue-card h2 {
  overflow-wrap: anywhere;
}

.guess-form {
  display: grid;
  gap: 18px;
}

.rating-buttons {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 8px;
}

.rating-button {
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.06);
  color: var(--text);
  font-size: 28px;
  font-weight: 950;
}

.rating-button.is-selected {
  border-color: var(--accent);
  background: var(--accent);
  color: #090909;
  box-shadow: 0 0 38px rgba(223,255,95,.22);
}

.live-results {
  display: grid;
  gap: 8px;
}

.live-result-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.045);
  padding: 12px 14px;
  font-weight: 850;
}

.live-result-row strong { color: var(--accent); }

.turn-result {
  display: grid;
  gap: 18px;
  border: 1px solid color-mix(in srgb, var(--accent), transparent 40%);
  border-radius: 26px;
  background: radial-gradient(circle at 50% 0%, rgba(223,255,95,.18), transparent 22rem), rgba(255,255,255,.05);
  padding: clamp(22px, 4vw, 34px);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.result-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(0,0,0,.22);
  padding: 14px;
}

.result-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.result-card strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.podium {
  display: grid;
  gap: 18px;
}

.podium-stage {
  display: grid;
  min-height: 320px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent), transparent 35%);
  border-radius: 28px;
  background: radial-gradient(circle at 50% 20%, rgba(223,255,95,.2), transparent 22rem), rgba(255,255,255,.04);
  padding: 30px;
  text-align: center;
}

.podium-stage h2 {
  font-size: clamp(52px, 10vw, 118px);
  overflow-wrap: anywhere;
}

.podium-stage strong {
  color: var(--accent);
  font-size: clamp(36px, 6vw, 72px);
}

.podium-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.podium-card {
  min-height: 180px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255,255,255,.05);
  padding: 18px;
}

.podium-card h3 {
  margin-top: 12px;
  font-size: clamp(30px, 4vw, 48px);
  line-height: .92;
  overflow-wrap: anywhere;
}

.podium-card strong {
  display: block;
  margin-top: 18px;
  color: var(--accent);
  font-size: 28px;
}

@keyframes pulseWin {
  0%, 100% { box-shadow: 0 0 0 rgba(223,255,95,0); }
  50% { box-shadow: 0 0 70px rgba(223,255,95,.24); }
}

.podium-stage.is-revealing {
  animation: pulseWin 1.4s ease-in-out infinite;
}

@media (max-width: 900px) {
  .scoreboard, .podium-list, .result-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .define-form {
    grid-template-columns: 1fr;
  }

  .rating-buttons {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .gate-grid, .lobby-grid, .scoreboard, .podium-list, .result-grid {
    grid-template-columns: 1fr;
  }

  .lobby-panel, .section-title, .player-row, .top-bar, .arena-head {
    align-items: stretch;
    flex-direction: column;
  }

  .lobby-actions, .host-controls, .result-actions {
    justify-content: stretch;
  }

  .lobby-actions .button, .host-controls .button, .result-actions .button {
    width: 100%;
  }
}
