/* Stage concept: an old atlas at night. Deep ocean set, marquee lettering,
   four loud answer pads, parchment cards. Deliberately single (dark) theme. */
:root {
  --stage: #0c2233;
  --stage-2: #123049;
  --panel: #f4ecdc;
  --ink: #102022;
  --text: #f4ecdc;
  --muted: #9fbcbc;
  --red: #e5484d;
  --blue: #2f6fe0;
  --yellow: #e8a317;
  --green: #2e9e5b;
  --hot: #ff6a3d;
  --display: "Bungee", "Arial Black", system-ui, sans-serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(ellipse at 50% -20%, #1c4a66 0%, transparent 60%),
    repeating-linear-gradient(90deg, transparent 0 46px, rgba(255,255,255,.025) 46px 48px),
    var(--stage);
  color: var(--text);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.45;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 1100px; margin: 0 auto; padding-block: 24px 40px; min-height: 100%; display: flex; flex-direction: column; gap: 24px; }
.narrow { max-width: 460px; }
h1, h2, h3, .display { font-family: var(--display); font-weight: 400; letter-spacing: .01em; text-wrap: balance; margin: 0; }
.logo { font-family: var(--display); font-size: 22px; display: flex; align-items: center; gap: 10px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.label { text-transform: uppercase; letter-spacing: .12em; font-size: 12px; color: var(--muted); font-weight: 700; }
.muted { color: var(--muted); }
.card { background: var(--panel); color: var(--ink); border-radius: 14px; padding: 24px; box-shadow: 0 10px 0 rgba(0,0,0,.25); }
.card .label { color: #5b6e6f; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

input[type=text], input[inputmode] {
  width: 100%; font: inherit; font-size: 22px; font-weight: 700; padding: 14px 16px; text-align: center;
  border: 3px solid #cfc3ad; border-radius: 10px; background: #fff; color: var(--ink);
}
input:focus-visible { outline: none; border-color: var(--hot); }
button { font: inherit; cursor: pointer; border: 0; }
.btn {
  font-family: var(--display); font-size: 20px; padding: 14px 26px; border-radius: 10px;
  background: var(--hot); color: #1a0f0a; box-shadow: 0 5px 0 #b8421f; transition: transform .08s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #b8421f; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 2px var(--muted); font-family: var(--body); font-weight: 700; font-size: 15px; padding: 10px 16px; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
.error { color: #b3261e; font-weight: 700; min-height: 1.4em; text-align: center; }

/* category chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 8px 14px; border-radius: 999px; background: #e6dbc6; color: var(--ink); font-weight: 700; font-size: 15px; display: inline-flex; gap: 6px; align-items: baseline; }
.chip small { font-weight: 600; opacity: .6; font-variant-numeric: tabular-nums; }
.chip[aria-pressed=true] { background: var(--ink); color: var(--panel); }

/* PIN marquee */
.pin { font-family: var(--display); font-size: clamp(56px, 11vw, 120px); line-height: 1; letter-spacing: .06em; color: var(--yellow); text-shadow: 0 6px 0 #6b4a05; font-variant-numeric: tabular-nums; }
.joinbox { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; background: var(--stage-2); border-radius: 16px; padding: 24px 28px; border: 2px solid #22506e; }
@media (max-width: 700px) { .joinbox { grid-template-columns: 1fr; } }
.url { font-weight: 800; font-size: 22px; word-break: break-all; }

.players { display: flex; flex-wrap: wrap; gap: 10px; }
.player-chip { background: var(--panel); color: var(--ink); padding: 8px 14px; border-radius: 8px; font-weight: 800; animation: pop .3s ease-out; display: inline-flex; gap: 8px; align-items: center; }
.player-chip button { background: none; color: #8a7d68; font-size: 16px; padding: 0 2px; line-height: 1; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }

/* question */
.qhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.decade-tag { font-family: var(--display); font-size: 14px; padding: 4px 10px; border-radius: 6px; background: var(--hot); color: #1a0f0a; }
.qtext { font-family: var(--display); font-size: clamp(24px, 4.2vw, 46px); line-height: 1.15; text-align: center; padding: 28px 20px; background: var(--panel); color: var(--ink); border-radius: 14px; text-wrap: balance; }
.timer { --p: 1; width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-size: 30px;
  background: conic-gradient(var(--hot) calc(var(--p) * 360deg), #22506e 0); position: relative; font-variant-numeric: tabular-nums; flex: none; }
.timer::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--stage); }
.timer span { position: relative; }
.timer.small { width: 58px; height: 58px; font-size: 20px; }
.timer.small::before { inset: 6px; }
.answered-count { text-align: center; }
.answered-count b { font-family: var(--display); font-size: 34px; display: block; line-height: 1; }

.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .answers.host { grid-template-columns: 1fr; } }
.ans { display: flex; align-items: center; gap: 14px; padding: 18px 18px; border-radius: 12px; color: #fff; font-weight: 800; font-size: clamp(17px, 2.2vw, 26px); text-align: left; min-height: 88px; position: relative; box-shadow: 0 6px 0 rgba(0,0,0,.3); transition: opacity .25s, transform .1s; }
.ans svg { width: 34px; height: 34px; flex: none; fill: #fff; }
.ans .txt { min-width: 0; overflow-wrap: break-word; hyphens: auto; }
@media (max-width: 420px) { .ans { font-size: 15px; gap: 10px; padding: 14px 12px; } .ans svg { width: 26px; height: 26px; } }
.ans.c0 { background: var(--red); } .ans.c1 { background: var(--blue); } .ans.c2 { background: var(--yellow); } .ans.c3 { background: var(--green); }
button.ans:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,.3); }
.ans.dim { opacity: .28; }
.ans .count { margin-left: auto; font-family: var(--display); font-size: 26px; }

/* scoreboard */
.board { display: flex; flex-direction: column; gap: 8px; }
.board-row { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; background: var(--stage-2); border: 2px solid #22506e; border-radius: 10px; padding: 10px 16px; font-weight: 800; font-size: 20px; }
.board-row .rank { font-family: var(--display); color: var(--yellow); }
.board-row .pts { font-variant-numeric: tabular-nums; font-family: var(--display); }
.board-row .gain { color: var(--hot); font-size: 15px; margin-right: 10px; font-family: var(--body); }
.board-row .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* podium */
.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-items: end; max-width: 720px; margin: 0 auto; width: 100%; }
.step { text-align: center; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.step .who { font-weight: 800; font-size: clamp(16px, 2.4vw, 24px); overflow-wrap: anywhere; }
.step .block { border-radius: 10px 10px 0 0; display: grid; place-items: center; font-family: var(--display); font-size: 44px; color: var(--ink); }
.step.p1 .block { height: 200px; background: var(--yellow); } .step.p2 .block { height: 150px; background: #c9d3d4; } .step.p3 .block { height: 110px; background: #d38b5a; }
.step .sc { font-family: var(--display); font-size: 18px; }

/* player feedback */
.feedback { text-align: center; padding: 34px 20px; border-radius: 16px; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.feedback.good { background: var(--green); }
.feedback.bad { background: var(--red); }
.feedback.wait { background: var(--stage-2); border: 2px solid #22506e; }
.feedback .big { font-family: var(--display); font-size: 40px; line-height: 1.1; }
.feedback .pts { font-family: var(--display); font-size: 28px; background: rgba(0,0,0,.2); padding: 6px 16px; border-radius: 8px; }
.center { text-align: center; }
.foot { font-size: 13px; color: var(--muted); text-align: center; }
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }

/* globe logo + country outline */
.logo .globe { width: 26px; height: 26px; fill: none; stroke: var(--hot); stroke-width: 1.8; animation: spin 12s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.qtext.has-img { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.qtext .outline { width: min(30vh, 300px); height: auto; max-width: 100%; fill: var(--ink); stroke: none; }
.qtext.has-img > span { font-size: .8em; }
