/* ═══════════════════════════════════════════════════════════════════════════
   GPTPG stage theme — single committed world: a game show at night.
   Token-first: components below consume ONLY the custom properties here.
   Phones and TV are both "on the stage" — dark surfaces, gold light.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* ── stage palette ──────────────────────────────────────────────────── */
  --stage:        #171433;   /* deep violet-navy stage floor */
  --stage-deep:   #100e24;   /* backstage / page depth */
  --stage-line:   #2c2854;   /* panel strokes, dividers, footlight rails */
  --gold:         #F5B63F;   /* points, marquee, primary action */
  --gold-hot:     #ffd478;   /* gold highlight edge */
  --buzz:         #E8434A;   /* buzzer red */
  --buzz-deep:    #a92730;   /* buzzer shadow rim */
  --host:         #62D6E8;   /* host cyan — everything the host "says" */
  --coral:        #ff7a6e;   /* team A / warm accent */
  --teal:         #3ecfb2;   /* team B / cool accent */

  /* ── ink ────────────────────────────────────────────────────────────── */
  --ink:          #f4f1ff;
  --ink-dim:      #a89fd0;
  --ink-faint:    #6b638f;
  --ink-on-gold:  #241a05;
  --ink-on-buzz:  #fff4f4;

  /* ── surfaces ───────────────────────────────────────────────────────── */
  --panel:        #1d1940;
  --panel-raised: #241f4e;
  --panel-inset:  #131029;

  /* ── type ───────────────────────────────────────────────────────────── */
  --font-display: "Avenir Next Condensed", "Futura", "Arial Narrow", "Helvetica Neue", sans-serif;
  --font-body:    system-ui, -apple-system, "Segoe UI", sans-serif;

  /* ── shape & depth ──────────────────────────────────────────────────── */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-pill: 999px;
  --shadow-card: 0 10px 30px rgba(6, 4, 20, 0.55);
  --shadow-pop:  0 16px 44px rgba(6, 4, 20, 0.7);
  --glow-gold:   0 0 22px rgba(245, 182, 63, 0.35);
  --glow-host:   0 0 18px rgba(98, 214, 232, 0.3);
  --glow-buzz:   0 0 34px rgba(232, 67, 74, 0.45);

  /* ── motion ─────────────────────────────────────────────────────────── */
  --ease-pop:  cubic-bezier(.34, 1.56, .64, 1);
  --t-fast: 120ms;
  --t-med:  240ms;
}

/* ── base ─────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(ellipse 120% 65% at 50% -12%, rgba(245, 182, 63, 0.10), transparent 55%),
    radial-gradient(ellipse 90% 55% at 50% 108%, rgba(98, 214, 232, 0.06), transparent 60%),
    linear-gradient(180deg, var(--stage) 0%, var(--stage-deep) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin: 0;
}

a { color: var(--host); }

/* ── marquee wordmark ─────────────────────────────────────────────────── */
.marquee {
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  text-shadow: 0 0 26px rgba(245, 182, 63, 0.45), 0 2px 0 rgba(0, 0, 0, 0.4);
}

/* ── buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 18px;
  padding: 12px 26px;
  border-radius: var(--r-md);
  border: 1px solid var(--stage-line);
  background: var(--panel-raised);
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  transition: transform var(--t-fast) var(--ease-pop), box-shadow var(--t-fast), background var(--t-fast);
}
.btn:hover { background: var(--stage-line); }
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }

.btn-gold {
  background: linear-gradient(180deg, var(--gold-hot), var(--gold));
  border-color: var(--gold);
  color: var(--ink-on-gold);
  box-shadow: var(--glow-gold);
}
.btn-gold:hover { background: linear-gradient(180deg, #ffe09a, var(--gold)); }

.btn-ghost {
  background: transparent;
  border-color: var(--stage-line);
  color: var(--ink-dim);
}
.btn-ghost:hover { color: var(--ink); background: rgba(44, 40, 84, 0.4); }

/* ── cards & panels ───────────────────────────────────────────────────── */
.card {
  background: linear-gradient(180deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--stage-line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  padding: 20px;
}
.card-inset {
  background: var(--panel-inset);
  border: 1px solid var(--stage-line);
  border-radius: var(--r-md);
  padding: 14px;
}

/* ── pills ────────────────────────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  background: var(--panel-inset);
  border: 1px solid var(--stage-line);
  color: var(--ink-dim);
  white-space: nowrap;
}
.pill-gold  { color: var(--ink-on-gold); background: var(--gold); border-color: var(--gold); }
.pill-host  { color: var(--host); border-color: rgba(98, 214, 232, 0.4); }
.pill-coral { color: var(--coral); border-color: rgba(255, 122, 110, 0.4); }
.pill-teal  { color: var(--teal); border-color: rgba(62, 207, 178, 0.4); }

/* ── inputs ───────────────────────────────────────────────────────────── */
.field {
  font-family: var(--font-body);
  font-size: 18px;
  color: var(--ink);
  background: var(--panel-inset);
  border: 1px solid var(--stage-line);
  border-radius: var(--r-md);
  padding: 12px 14px;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.field::placeholder { color: var(--ink-faint); }
.field:focus { border-color: var(--gold); box-shadow: var(--glow-gold); }

/* Keyboard focus everywhere on the stage */
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ── join code marquee ────────────────────────────────────────────────── */
.join-code {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.28em;
  text-indent: 0.28em; /* re-center around tracked glyphs */
  color: var(--gold);
  text-shadow: 0 0 28px rgba(245, 182, 63, 0.5);
}

/* ── host line — everything spoken from the booth is cyan ─────────────── */
.host-line {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--host);
  text-shadow: 0 0 14px rgba(98, 214, 232, 0.25);
}

/* ── timer bar ────────────────────────────────────────────────────────── */
.timer-bar {
  position: relative;
  height: 10px;
  border-radius: var(--r-pill);
  background: var(--panel-inset);
  border: 1px solid var(--stage-line);
  overflow: hidden;
}
.timer-bar .timer-fill {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--gold), var(--gold-hot));
  border-radius: inherit;
}
.timer-bar.timer-live .timer-fill {
  transform: scaleX(1);
  background: linear-gradient(90deg, var(--buzz), var(--coral));
  animation: timer-live-pulse 1.1s ease-in-out infinite;
}
@keyframes timer-live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* ── score bars (TV) ──────────────────────────────────────────────────── */
.score-row {
  display: grid;
  grid-template-columns: minmax(90px, 160px) 1fr auto;
  align-items: center;
  gap: 12px;
}
.score-name {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.score-name.away { color: var(--ink-faint); }
.score-track {
  height: 16px;
  border-radius: var(--r-pill);
  background: var(--panel-inset);
  border: 1px solid var(--stage-line);
  overflow: hidden;
}
.score-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--gold-hot));
  box-shadow: var(--glow-gold);
  transition: width 600ms var(--ease-pop);
}
.score-row:nth-child(odd)  .score-fill { background: linear-gradient(90deg, #d99b2a, var(--gold)); }
.score-points {
  font-family: var(--font-display);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
  min-width: 2.5em;
  text-align: right;
}

/* ── phone score strip ────────────────────────────────────────────────── */
.score-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0;
  scrollbar-width: none;
}
.score-strip::-webkit-scrollbar { display: none; }
.score-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: var(--panel-inset);
  border: 1px solid var(--stage-line);
  font-size: 13px;
  color: var(--ink-dim);
}
.score-chip b {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.score-chip.me { border-color: var(--gold); color: var(--ink); }
.score-chip.away { opacity: 0.5; }

/* ── footlights — the thin glowing rail at panel bottoms ──────────────── */
.footlights {
  height: 3px;
  border-radius: var(--r-pill);
  background: repeating-linear-gradient(90deg,
    var(--gold) 0 10px, transparent 10px 26px);
  opacity: 0.5;
  filter: blur(0.4px);
}

/* ── toggle switch ────────────────────────────────────────────────────── */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  width: 46px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: var(--r-pill);
  background: var(--panel-inset);
  border: 1px solid var(--stage-line);
  position: relative;
  transition: background var(--t-med), border-color var(--t-med);
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--ink-dim);
  transition: transform var(--t-med) var(--ease-pop), background var(--t-med);
}
.switch input:checked + .track { background: var(--gold); border-color: var(--gold); }
.switch input:checked + .track::after { transform: translateX(20px); background: var(--ink-on-gold); }
.switch input:focus-visible + .track { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ── segmented control ────────────────────────────────────────────────── */
.segmented {
  display: inline-flex;
  background: var(--panel-inset);
  border: 1px solid var(--stage-line);
  border-radius: var(--r-pill);
  padding: 3px;
  gap: 2px;
}
.segmented button {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 14px;
  border: none;
  background: transparent;
  color: var(--ink-dim);
  padding: 7px 16px;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.segmented button[aria-pressed="true"] {
  background: var(--gold);
  color: var(--ink-on-gold);
}

/* ── stepper ──────────────────────────────────────────────────────────── */
.stepper {
  display: inline-flex;
  align-items: center;
  gap: 0;
  background: var(--panel-inset);
  border: 1px solid var(--stage-line);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.stepper button {
  font-size: 20px;
  font-weight: 700;
  width: 42px; height: 40px;
  border: none;
  background: transparent;
  color: var(--gold);
  cursor: pointer;
}
.stepper button:active { background: var(--stage-line); }
.stepper .stepper-value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  min-width: 2.2em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ── utility ──────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.dim { color: var(--ink-dim); }
.faint { color: var(--ink-faint); }

/* ── reduced motion: the show still goes on, it just stands still ─────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
