:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #566074;
  --line: #e2e6ee;
  --accent: #f0502c;
  --ok: #17803d;
  --ok-bg: #e9f7ee;
  --bad: #c62828;
  --bad-bg: #fdecec;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

.stage { position: relative; height: 100dvh; overflow: hidden; }
#globe { position: absolute; inset: 0; display: block; cursor: grab; touch-action: none; }
#globe:active { cursor: grabbing; }
.fade {
  position: absolute; left: 0; right: 0; bottom: 0; height: 58%; pointer-events: none;
  background: linear-gradient(to top, var(--bg) 34%, rgba(246, 247, 249, 0.85) 52%, rgba(246, 247, 249, 0) 100%);
}

/* ---------- top bar ---------- */
.top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: 22px 28px; pointer-events: none; }
.wordmark { white-space: nowrap; text-shadow: 0 0 10px var(--bg), 0 0 4px var(--bg); display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; letter-spacing: -0.02em; }
.wordmark i { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px rgba(240, 80, 44, 0.18); }
.right { display: flex; align-items: center; gap: 10px; pointer-events: auto; }
.pill { white-space: nowrap; padding: 8px 14px; background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 999px; font-size: 12.5px; font-weight: 700; letter-spacing: 0.02em; transition: border-color 0.2s; }
.pill:hover { border-color: var(--ink); }
.pill i { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: #16a34a; }
.lang { display: inline-flex; padding: 3px; background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 999px; }
.lang button { border: 0; background: none; padding: 6px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; color: var(--muted); transition: background 0.2s, color 0.2s; }
.lang button:hover { color: var(--ink); }
.lang button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.status { display: flex; align-items: center; gap: 12px; background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px; font-weight: 600; font-size: 14px; }
.status[hidden] { display: none; }
.found { color: var(--muted); font-variant-numeric: tabular-nums; }
.found span { color: var(--ink); font-weight: 800; }

/* ---------- bottom: question card + footer ---------- */
.bottom {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: center;
  background: linear-gradient(to bottom, rgba(246, 247, 249, 0), rgba(246, 247, 249, 0.94) 60px, var(--bg) 100px);
}
/* Only buttons and the footer bar catch the mouse; text and empty areas let it through to the globe underneath. */
.bottom, .dock, .dock * { pointer-events: none; }
.dock button, .foot { pointer-events: auto; }
.dock { width: min(760px, 100%); padding: 64px 24px 22px; text-align: center; }
.foot {
  width: 100%; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px 24px;
  padding: 12px 28px max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--bg);
  font-size: 12px; color: var(--muted);
}
.credits { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.foot a { color: inherit; text-decoration: none; }
.foot a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.dock > * { animation: up 0.5s var(--ease) both; }
.dock > *:nth-child(2) { animation-delay: 0.05s; }
.dock > *:nth-child(3) { animation-delay: 0.1s; }
.dock > *:nth-child(4) { animation-delay: 0.15s; }
@keyframes up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
h1 { margin: 0 0 14px; font-size: clamp(32px, 5.4vw, 56px); line-height: 1.02; font-weight: 800; letter-spacing: -0.035em; text-wrap: balance; }
.lead { margin: 0 auto 24px; max-width: 520px; color: var(--muted); font-size: 17px; line-height: 1.5; text-wrap: balance; }

.steps { display: flex; align-items: center; justify-content: center; gap: 6px; margin-bottom: 16px; }
.steps i { width: 34px; height: 4px; border-radius: 4px; background: var(--line); transition: background 0.4s; }
.steps i.done { background: var(--ink); }
.steps i.now { background: var(--accent); }
.steps span { margin-left: 10px; font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }

.clues { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 16px; }
.fact { margin: 0; max-width: 620px; font-size: clamp(17px, 2.2vw, 21px); line-height: 1.4; font-weight: 500; letter-spacing: -0.01em; text-wrap: balance; }
.fact.new { animation: up 0.5s var(--ease) both; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chips li { display: inline-flex; align-items: baseline; gap: 8px; padding: 7px 13px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: 14px; font-weight: 600; }
.chips li span { font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.chips li:not(.new) { opacity: 0.72; }
.chips li.new { border-color: var(--accent); animation: up 0.5s var(--ease) both; }
h2.q { margin: 0; font-size: clamp(26px, 4vw, 40px); line-height: 1.05; font-weight: 800; letter-spacing: -0.03em; text-wrap: balance; }
.link { margin-top: 14px; background: none; border: 0; padding: 6px 10px; font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--ink); }
.fact + .tally { margin-top: 14px; }
.tally { margin: 0 0 20px; font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.opt {
  position: relative; display: flex; align-items: center; gap: 12px; text-align: left; min-height: 56px; padding: 12px 16px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 16px; font-size: 17px; font-weight: 600;
  transition: border-color 0.2s, background 0.2s, transform 0.2s var(--ease), box-shadow 0.2s;
}
.opt:hover:not(:disabled) { border-color: var(--ink); transform: translateY(-2px); box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08); }
.opt .k { flex: none; width: 24px; height: 24px; border-radius: 8px; background: var(--bg); color: var(--muted); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.opt .t { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.opt svg { flex: none; width: 20px; height: 20px; }
.opt:disabled { cursor: default; }
.opt.ok { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); }
.opt.bad { border-color: var(--bad); background: var(--bad-bg); color: var(--bad); animation: nope 0.4s; }
.opt.dim { opacity: 0.45; }
@keyframes nope { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.btn {
  display: inline-flex; align-items: center; gap: 10px; background: var(--ink); color: #fff; border: 0; border-radius: 999px;
  padding: 16px 30px; font-size: 17px; font-weight: 700; transition: transform 0.2s var(--ease), box-shadow 0.2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(15, 23, 42, 0.25); }
.btn svg { width: 18px; height: 18px; }
.sub { margin: 0 0 22px; color: var(--muted); font-size: 17px; }
.stats { display: flex; justify-content: center; gap: 36px; margin: 0 0 24px; }
.stats div { display: flex; flex-direction: column; gap: 2px; }
.stats b { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stats span { font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.hintline { margin: 18px 0 0; font-size: 13px; color: var(--muted); }

@media (max-width: 620px) {
  .top { padding: 14px 16px; }
  .status { padding: 6px 12px; gap: 12px; font-size: 13px; }
  .dock { padding: 44px 14px 6px; }
  .foot { padding: 8px 12px max(8px, env(safe-area-inset-bottom)); gap: 2px 12px; justify-content: center; text-align: center; font-size: 10.5px; }
  .credits { justify-content: center; gap: 2px 10px; }
  .fact { font-size: 15px; }
  .clues { gap: 6px; margin-bottom: 10px; }
  .chips { gap: 5px; }
  .chips li { padding: 4px 9px; font-size: 12px; gap: 6px; }
  .chips li span { font-size: 9px; }
  h2.q { font-size: 22px; }
  .steps { margin-bottom: 10px; }
  .link { margin-top: 6px; }
  .lang button { padding: 5px 9px; }
  .right { gap: 6px; }
  .lead { font-size: 15px; margin-bottom: 18px; }
  .opts { gap: 8px; margin-top: 12px; }
  .opt { min-height: 46px; padding: 8px 12px; font-size: 14.5px; }
  .opt .k { display: none; }
  .steps i { width: 26px; }
  .hintline { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- difficulty selector ---------- */
.levels { display: inline-flex; padding: 3px; margin: 0 0 10px; background: #fff; border: 1px solid var(--line); border-radius: 999px; }
.lvl { border: 0; background: none; padding: 8px 18px; border-radius: 999px; font-size: 14px; font-weight: 700; color: var(--muted); transition: background 0.2s, color 0.2s; }
.lvl:hover { color: var(--ink); }
.lvl[aria-checked="true"] { background: var(--ink); color: #fff; }
.lvl-desc { margin: 0 0 18px; font-size: 13.5px; color: var(--muted); }
.tally + .levels { margin: 0 0 14px; }
@media (max-width: 620px) { .lvl { padding: 7px 14px; font-size: 13px; } .lvl-desc { margin-bottom: 14px; } }

/* ---------- city name label (press and hold a dot) ---------- */
.tip { position: absolute; left: 0; top: 0; z-index: 15; padding: 7px 13px; border-radius: 999px; background: #fff; color: var(--ink); font-size: 14px; font-weight: 700; white-space: nowrap; box-shadow: 0 8px 24px rgba(20, 40, 80, 0.22); opacity: 0; pointer-events: none; transition: opacity 0.22s; }
.tip.on { opacity: 1; }

/* ---------- track record dialog ---------- */
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: rgba(246, 247, 249, 0.72); backdrop-filter: blur(8px); }
.modal[hidden] { display: none; }
.sheet { width: min(560px, 100%); max-height: min(82dvh, 700px); display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 30px 80px rgba(15, 23, 42, 0.18); padding: 22px 22px 12px; animation: up 0.4s var(--ease) both; }
.sheet header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sheet h2 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.x { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: #fff; }
.x:hover { border-color: var(--ink); }
.x svg { width: 16px; height: 16px; }
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0 12px; }
.stats3 div { background: var(--bg); border-radius: 14px; padding: 10px 12px; }
.stats3 b { display: block; font-size: 26px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stats3 span { font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.rec-hint { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 8px; font-size: 13px; line-height: 1.45; color: var(--muted); }
.rec-hint i { flex: none; width: 10px; height: 10px; margin-top: 4px; border-radius: 50%; background: #16a34a; box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.18); }
.rec-list { list-style: none; margin: 0; padding: 0; flex: 1; min-height: 60px; overflow-y: auto; }
.rec-row { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: left; padding: 10px 8px; border: 0; border-bottom: 1px solid var(--line); background: none; border-radius: 10px; }
.rec-row:hover { background: var(--bg); }
.rec-name { display: block; font-weight: 700; }
.rec-sub { display: block; font-size: 12.5px; color: var(--muted); }
.rec-meta { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.badge { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; color: var(--ok); background: var(--ok-bg); }
.badge.miss { color: var(--muted); background: var(--bg); }
.rec-date { font-size: 12px; color: var(--muted); }
.rec-empty { padding: 28px 12px; text-align: center; line-height: 1.5; color: var(--muted); }
.sheet footer { display: flex; justify-content: flex-end; padding-top: 6px; }
.recordline { margin: -10px 0 18px; font-size: 13px; font-weight: 700; color: #15803d; }
@media (max-width: 620px) { .wordmark { font-size: 16px; gap: 7px; } .wordmark i { width: 11px; height: 11px; box-shadow: 0 0 0 4px rgba(240, 80, 44, 0.18); } .pill { padding: 6px 10px; font-size: 12px; } .pill i { margin-right: 5px; } .sheet { padding: 18px 16px 10px; } .stats3 b { font-size: 22px; } }

/* ---------- accounts ---------- */
.pill { display: inline-flex; align-items: center; gap: 7px; }
.pill svg { width: 15px; height: 15px; flex: none; }
.pill i { margin-right: 0 !important; }
.pill .cnt::before { content: "·"; margin-right: 7px; }
#rankBtn[hidden], .acct[hidden] { display: none; }
.acct { position: relative; display: flex; align-items: center; }
.avbtn { border: 0; padding: 0; background: none; border-radius: 50%; cursor: pointer; box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--line); }
.av { --s: 34px; width: var(--s); height: var(--s); flex: none; display: inline-grid; place-items: center; overflow: hidden; border-radius: 50%; background: #dbe4f5; color: var(--ink); font-weight: 800; font-size: calc(var(--s) * 0.42); }
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 30; min-width: 230px; padding: 8px; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 50px rgba(20, 40, 80, 0.18); }
.menu-who { margin: 6px 10px 8px; font-size: 13px; color: var(--muted); word-break: break-word; }
.menu-item { width: 100%; text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 9px; font-size: 14px; font-weight: 600; }
.menu-item:hover { background: var(--bg); }

.gbtn { display: inline-flex; align-items: center; justify-content: center; gap: 12px; background: #fff; border: 1.5px solid #dadce0; border-radius: 999px; font-weight: 600; color: #1f1f1f; transition: box-shadow 0.2s, background 0.2s; }
.gbtn:hover:not(:disabled) { box-shadow: 0 4px 14px rgba(15, 23, 42, 0.14); background: #f8fafd; }
.gbtn:disabled { opacity: 0.6; cursor: default; }
.gbtn svg { width: 20px; height: 20px; flex: none; }
.gbtn.big { width: 100%; padding: 14px 20px; font-size: 16px; margin: 4px 0 12px; }
.gbtn.small { padding: 9px 16px; font-size: 14px; }

.gate .gate-text { margin: 14px 0 16px; color: #3b475c; line-height: 1.55; }
.check { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 8px; text-align: left; font-size: 14px; color: #243047; cursor: pointer; }
.check input { flex: none; width: 17px; height: 17px; margin-top: 3px; accent-color: var(--ink); }
.gate-err { min-height: 1px; margin: 0 0 6px; color: var(--bad); font-size: 13px; }
.gate-legal { margin: 2px 0 8px; font-size: 12.5px; color: var(--muted); }
.gate-legal a { color: inherit; }
.gate .link { display: block; margin: 6px auto 0; }

.lb-sub { margin: 6px 0 10px; color: var(--muted); font-size: 14px; }
.lb-list { flex: 1; min-height: 80px; margin: 0; padding: 0; list-style: none; overflow-y: auto; }
.lb-row { display: flex; align-items: center; gap: 12px; padding: 9px 8px; border-bottom: 1px solid var(--line); border-radius: 10px; }
.lb-row.me { background: #fff3ee; border-color: transparent; }
.lb-rank { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--bg); color: var(--muted); font-size: 13px; font-weight: 800; }
.lb-rank.r1 { background: #ffe7a3; color: #6b4a00; }
.lb-rank.r2 { background: #e6e9ef; color: #3b475c; }
.lb-rank.r3 { background: #f6d2b8; color: #6b3a14; }
.lb-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.lb-meta { font-size: 12.5px; color: var(--muted); }
.lb-score { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.lb-score b { font-size: 20px; font-variant-numeric: tabular-nums; }
.lb-score span { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.lb-msg { padding: 28px 12px; text-align: center; color: var(--muted); line-height: 1.5; }
.lb-foot { padding-top: 10px; text-align: center; }
.lb-join, .lb-me { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.lb-me { color: var(--ink); font-weight: 700; }

.acct-sec { margin: 10px 0 4px; padding: 12px 14px; text-align: left; background: var(--bg); border-radius: 14px; }
.acct-who { margin: 0 0 8px; font-size: 13.5px; color: #3b475c; }
.acct-row { display: flex; flex-wrap: wrap; gap: 16px; }
.link.danger { color: var(--bad); }
.guestnote { margin: 0 0 16px; font-size: 13px; font-weight: 600; color: var(--muted); }

@media (max-width: 620px) {
  .pill .lbl { display: none; }
  .pill { padding: 7px 10px; }
  .pill .cnt::before { content: ""; margin: 0; }
  .pill i + .cnt { margin-left: 6px; }
  .av { --s: 30px !important; }
  .right { gap: 5px; }
}
