/* GameNight — retro marquee game-show system
   stage: deep night blue · ink: warm cream · accent: marquee gold
   answers: crimson ▲ · cobalt ◆ · amber ● · green ■ */

:root {
  --stage: #0e0f1e;
  --panel: #1a1c33;
  --panel-2: #23264a;
  --line: #33365e;
  --ink: #f5efe0;
  --ink-dim: #a9a58f;
  --gold: #f5b52e;
  --a0: #e5484d;
  --a1: #3b62e0;
  --a2: #f0a81c;
  --a3: #30a46c;
  --radius: 14px;
  --display: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", system-ui, sans-serif;
}

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

body {
  background: var(--stage);
  color: var(--ink);
  font-family: var(--display);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 24px; }

/* top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 4px 0 20px; }
.brand { font-weight: 900; font-size: 1.25rem; letter-spacing: .02em; color: var(--ink); text-decoration: none; }
.brand .dot { color: var(--gold); }
.topbar nav { display: flex; gap: 10px; align-items: center; }
.topbar .who { color: var(--ink-dim); font-size: .85rem; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 800 1rem var(--display); letter-spacing: .01em;
  color: var(--stage); background: var(--gold);
  border: none; border-radius: var(--radius);
  padding: 13px 24px; cursor: pointer; text-decoration: none;
  transition: transform .08s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.97); }
.btn.ghost { background: transparent; color: var(--ink); border: 2px solid var(--line); }
.btn.ghost:hover { border-color: var(--gold); color: var(--gold); filter: none; }
.btn.big { font-size: 1.3rem; padding: 18px 36px; border-radius: 18px; }
.btn.danger { background: transparent; border: 2px solid var(--line); color: var(--ink-dim); }
.btn:disabled { opacity: .4; cursor: default; }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid var(--gold); outline-offset: 2px;
}

/* inputs */
input[type=text], input[type=number], textarea, select {
  font: 600 1rem var(--display);
  color: var(--ink); background: var(--panel);
  border: 2px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; width: 100%;
}
input::placeholder { color: var(--ink-dim); }

/* panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 24px; }

.eyebrow {
  font-size: .78rem; font-weight: 800; letter-spacing: .22em;
  text-transform: uppercase; color: var(--gold);
}

/* ---------- marquee (the signature) ---------- */
.marquee {
  position: relative;
  background: var(--panel);
  border-radius: 24px;
  padding: 28px 40px;
  text-align: center;
  border: 3px solid var(--gold);
  box-shadow: 0 0 0 6px var(--panel), 0 0 44px rgba(245, 181, 46, .22);
}
.marquee::before, .marquee::after {
  content: ""; position: absolute; left: 18px; right: 18px; height: 6px;
  background-image: radial-gradient(circle, var(--gold) 2.4px, transparent 2.6px);
  background-size: 18px 6px; background-repeat: repeat-x;
  animation: twinkle 1.6s steps(2) infinite;
}
.marquee::before { top: 10px; }
.marquee::after { bottom: 10px; }
@keyframes twinkle { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) {
  .marquee::before, .marquee::after { animation: none; }
  * { transition: none !important; animation-duration: .01s !important; }
}
.marquee .pin {
  font-size: clamp(3.2rem, 11vw, 6.5rem);
  font-weight: 900; letter-spacing: .14em;
  color: var(--gold); line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.marquee .label { color: var(--ink-dim); font-weight: 700; margin-top: 2px; }
.marquee .url { color: var(--ink); font-weight: 700; font-size: 1.15rem; margin-bottom: 6px; }
.marquee .url strong { color: var(--gold); }

/* ---------- answers ---------- */
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .answers { grid-template-columns: 1fr; } }
.answer {
  display: flex; align-items: center; gap: 14px;
  border: none; border-radius: var(--radius);
  padding: 20px 18px; min-height: 76px;
  font: 800 1.15rem var(--display); color: #fff; text-align: left;
  cursor: pointer; transition: transform .08s ease, opacity .2s ease, filter .2s ease;
}
.answer:active { transform: scale(.97); }
.answer .shape { font-size: 1.3rem; flex: none; }
.answer[data-i="0"] { background: var(--a0); }
.answer[data-i="1"] { background: var(--a1); }
.answer[data-i="2"] { background: var(--a2); color: #241a02; }
.answer[data-i="3"] { background: var(--a3); }
.answer.dim { opacity: .22; filter: saturate(.4); }
.answer.win { box-shadow: 0 0 0 4px var(--ink); }

/* ---------- timer ring ---------- */
.timer { position: relative; width: 92px; height: 92px; flex: none; }
.timer svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.timer circle { fill: none; stroke-width: 8; }
.timer .track { stroke: var(--line); }
.timer .sweep { stroke: var(--gold); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.timer .num {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 1.9rem; font-weight: 900; font-variant-numeric: tabular-nums;
}

/* ---------- leaderboard ---------- */
.board { display: flex; flex-direction: column; gap: 10px; }
.board .row {
  display: flex; align-items: center; gap: 14px;
  background: var(--panel-2); border-radius: var(--radius); padding: 14px 18px;
  font-weight: 800; font-size: 1.15rem;
}
.board .row .rank { color: var(--gold); width: 2ch; font-variant-numeric: tabular-nums; }
.board .row .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .row .score { font-variant-numeric: tabular-nums; color: var(--ink-dim); }
.board .row:first-child .score { color: var(--gold); }

/* ---------- distribution bars ---------- */
.dist { display: flex; align-items: flex-end; gap: 18px; height: 180px; margin: 18px 0; }
.dist .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 8px; height: 100%; }
.dist .fill { width: 100%; border-radius: 10px 10px 4px 4px; min-height: 6px; transition: height .6s ease; }
.dist .bar[data-i="0"] .fill { background: var(--a0); }
.dist .bar[data-i="1"] .fill { background: var(--a1); }
.dist .bar[data-i="2"] .fill { background: var(--a2); }
.dist .bar[data-i="3"] .fill { background: var(--a3); }
.dist .bar.lose .fill { opacity: .25; }
.dist .n { font-weight: 900; font-size: 1.2rem; }
.dist .shape { font-size: 1.1rem; }

/* ---------- big center states (player phone) ---------- */
.center-stage {
  min-height: 100dvh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  padding: 24px; gap: 14px;
}
.center-stage h1 { font-size: clamp(1.6rem, 6vw, 2.6rem); font-weight: 900; }
.center-stage .sub { color: var(--ink-dim); font-weight: 600; font-size: 1.05rem; }
.result-good { color: var(--a3); }
.result-bad { color: var(--a0); }
.bigpoints { font-size: clamp(2.4rem, 10vw, 4rem); font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; }

/* ---------- podium ---------- */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 14px; margin-top: 28px; }
.podium .place { display: flex; flex-direction: column; align-items: center; gap: 10px; width: min(200px, 28vw); }
.podium .plinth {
  width: 100%; border-radius: 12px 12px 0 0; background: var(--panel-2);
  border: 1px solid var(--line); display: grid; place-items: center;
  font-size: 2rem; font-weight: 900; color: var(--gold);
}
.podium .p1 .plinth { height: 150px; background: linear-gradient(180deg, #3a2f0d, var(--panel-2)); border-color: var(--gold); }
.podium .p2 .plinth { height: 105px; }
.podium .p3 .plinth { height: 70px; }
.podium .who-name { font-weight: 900; font-size: 1.1rem; text-align: center; }
.podium .who-score { color: var(--ink-dim); font-variant-numeric: tabular-nums; }

/* ---------- builder ---------- */
.qcard { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 20px; margin-bottom: 16px; }
.qcard .qhead { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.qcard .qnum { font-weight: 900; color: var(--gold); }
.qcard .opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
@media (max-width: 640px) { .qcard .opts { grid-template-columns: 1fr; } }
.opt { display: flex; align-items: center; gap: 10px; background: var(--panel-2); border-radius: var(--radius); padding: 8px 10px; border: 2px solid transparent; }
.opt.correct { border-color: var(--a3); }
.opt .shape { flex: none; width: 30px; text-align: center; font-size: 1.1rem; }
.opt input[type=text] { background: transparent; border: none; padding: 8px 4px; }
.opt input[type=radio] { width: 20px; height: 20px; accent-color: var(--a3); flex: none; }
.opt[data-i="0"] .shape { color: var(--a0); }
.opt[data-i="1"] .shape { color: var(--a1); }
.opt[data-i="2"] .shape { color: var(--a2); }
.opt[data-i="3"] .shape { color: var(--a3); }
.qcard .meta { display: flex; align-items: center; gap: 10px; margin-top: 12px; color: var(--ink-dim); font-size: .9rem; font-weight: 700; }
.qcard .meta input { width: 84px; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }

/* ---------- sample question banks ---------- */
.sample-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px; width: 100%; max-width: 720px; text-align: left;
}
.sample-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 6px;
}
.sample-head { display: flex; align-items: center; gap: 10px; }
.sample-emoji { font-size: 1.6rem; }
.sample-title { font-weight: 800; font-size: 1.05rem; }
.sample-card select { flex: 1; min-width: 0; }
.sample-card .btn { flex: none; }

.muted { color: var(--ink-dim); }
.mt { margin-top: 20px; }
.hidden { display: none !important; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--gold); color: var(--stage); font-weight: 800;
  padding: 12px 22px; border-radius: 999px; opacity: 0;
  transition: opacity .25s ease; pointer-events: none; z-index: 50;
}
.toast.show { opacity: 1; }
