/* Geo Bullet: one bold dark game palette (a game owns its look; it does not follow the OS theme). */
@font-face { font-family: Fredoka; src: url(fonts/fredoka-latin-500-normal.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: Fredoka; src: url(fonts/fredoka-latin-600-normal.woff2) format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: Fredoka; src: url(fonts/fredoka-latin-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --bg: #0f1630; --bg2: #18214a; --surface: #1e2a5a; --surface2: #263470; --ink: #f3f5ff; --muted: #a7b0d8;
  --line: #34438a; --accent: #5b8cff; --accent-ink: #ffffff; --gold: #ffc83d; --pink: #ff5a8a;
  --right: #3ddc84; --right-bg: #154d33; --wrong: #ff5a5f; --wrong-bg: #5a1d2b; --kbd: #2c3a7c;
  --sea: #142355; --land: #2b3a73; --pick: #6d8cf5;
  --display: Fredoka, ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  --radius: 16px; --gap: 10px;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 700px at 50% -10%, var(--bg2), var(--bg)) fixed, var(--bg);
  color: var(--ink); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
}
button { font: inherit; color: inherit; touch-action: manipulation; }
[hidden] { display: none !important; }
kbd {
  display: inline-block; min-width: 1.5em; padding: 0 .3em; margin: 0 .08em; border: 1px solid var(--line);
  border-bottom-width: 2px; border-radius: 5px; background: var(--kbd); color: var(--ink);
  font: 600 .75em/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; text-align: center;
}
/* Key hints only where there is a keyboard and a fine pointer: phones never see them. */
@media (hover: none), (pointer: coarse) { .kbd-only, kbd.kbd-only, .opt kbd, .pass kbd { display: none !important; } }

.screen { min-height: 100%; }

/* ---------- home ---------- */
#home { max-width: 760px; margin: 0 auto; padding: calc(18px + var(--safe-t)) calc(16px + var(--safe-r)) calc(16px + var(--safe-b)) calc(16px + var(--safe-l)); }
.brand { text-align: center; margin: 8px 0 18px; }
.brand h1 { font: 700 clamp(2.2rem, 9vw, 3.4rem)/1 var(--display); margin: 0; letter-spacing: .01em;
  background: linear-gradient(90deg, #fff, #c9d6ff 40%, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand .globe { display: inline-block; width: .9em; height: .9em; vertical-align: -.08em; color: #8fb0ff; animation: spin 12s linear infinite; }
.brand .globe .ico { width: 100%; height: 100%; }
.ico { display: block; width: 1em; height: 1em; }
@keyframes spin { to { transform: rotate(360deg); } }
.tagline { margin: 8px 0 0; color: var(--muted); font: 500 1.05rem var(--display); }

.modes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.mode {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  padding: 14px 14px 12px; min-height: 112px; border: 0; border-radius: var(--radius); cursor: pointer;
  background: linear-gradient(145deg, var(--c1), var(--c2)); box-shadow: 0 6px 0 rgb(0 0 0 / .25), 0 10px 24px rgb(0 0 0 / .25);
  transition: transform .08s ease, box-shadow .08s ease;
}
.mode:hover { transform: translateY(-2px); }
.mode:active { transform: translateY(4px); box-shadow: 0 2px 0 rgb(0 0 0 / .25); }
.mode:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.mode:disabled { filter: grayscale(.8) brightness(.6); cursor: not-allowed; transform: none; }
.mode .icon { width: 2rem; height: 2rem; }
.mode .icon .ico { width: 100%; height: 100%; }
.mode .name { font: 700 1.25rem/1.1 var(--display); }
.mode .what { font-size: .82rem; opacity: .9; }
.mode .best { margin-top: auto; font: 600 .8rem var(--display); background: rgb(0 0 0 / .22); padding: 2px 8px; border-radius: 99px; }
.mode kbd { position: absolute; top: 8px; right: 8px; background: rgb(0 0 0 / .25); border-color: transparent; }

.control-name { display: block; font: 600 .85rem var(--display); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.note { text-transform: none; letter-spacing: 0; font-weight: 500; opacity: .85; margin-left: 4px; }
.seg { display: inline-flex; background: var(--surface); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button {
  border: 0; background: transparent; padding: 8px 14px; border-radius: 9px; cursor: pointer; font: 600 1rem var(--display); color: var(--muted); min-width: 48px;
}
.seg button[aria-checked="true"] { background: var(--accent); color: #fff; box-shadow: 0 2px 0 rgb(0 0 0 / .3); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label, .kinds label {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 99px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); user-select: none; font-size: .95rem;
}
.chips input, .kinds input { accent-color: var(--accent); }
.chips label:has(input:checked), .kinds label:has(input:checked) { background: var(--accent); border-color: var(--accent); color: #fff; }
.kinds label:has(input:disabled) { opacity: .4; cursor: not-allowed; }
.hint { color: var(--muted); font-size: .85rem; margin: 18px 0 0; }
.credits { margin-top: 24px; color: var(--muted); font-size: .72rem; opacity: .75; text-align: center; }

/* ---------- play ---------- */
#play { height: 100dvh; display: flex; flex-direction: column; padding: var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l); }
.hud {
  display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 6px 12px;
  width: 100%; max-width: 1000px; margin: 0 auto; padding: 10px 14px 0;
}
.icon-btn { border: 0; background: var(--surface); width: 40px; height: 40px; border-radius: 12px; cursor: pointer; display: grid; place-items: center; }
.icon-btn .ico { width: 22px; height: 22px; }
.icon-btn:active { transform: scale(.94); }
#quit.armed { width: auto; padding: 0 12px; background: var(--wrong); color: #fff; font: 700 1rem var(--display); animation: bump .3s ease; }
.hud-score b, .clock b { font: 700 1.7rem/1 var(--display); font-variant-numeric: tabular-nums; }
.hud-score b.bump { animation: bump .25s ease; }
.unit { color: var(--muted); font: 600 .8rem var(--display); margin-left: 3px; }
.hud-right { display: flex; align-items: center; gap: 12px; justify-self: end; }
.combo { display: inline-flex; align-items: center; gap: 4px; justify-self: start; font: 700 1.05rem var(--display); color: var(--gold); padding: 3px 10px; border-radius: 99px; background: rgb(255 200 61 / .14); opacity: 0; transition: opacity .2s; white-space: nowrap; }
.combo.on { opacity: 1; }
.combo .ico { width: 18px; height: 18px; color: #ff8a3d; }
.combo .mult { margin-left: 4px; padding: 0 6px; border-radius: 99px; background: var(--gold); color: #2a1d00; }
.combo.up { animation: bump .35s ease; }
.combo .next { margin-left: 4px; color: var(--muted); font: 600 .8rem var(--display); }
@media (max-width: 380px) { .combo .next { display: none; } }
.timebar { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: var(--surface); overflow: hidden; }
.timebar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--accent), #8fb0ff); transform-origin: left; }
.timebar.warn i { background: linear-gradient(90deg, #ff9f1c, var(--gold)); }
.timebar.low i { background: var(--wrong); }
.clock.warn b { color: var(--gold); }
.clock.low b { color: var(--wrong); animation: bump .5s ease infinite; }
@keyframes bump { 50% { transform: scale(1.18); } }

.board {
  flex: 1; min-height: 0; width: 100%; max-width: 1000px; margin: 0 auto; padding: 10px 14px 14px;
  display: grid; grid-template-rows: repeat(var(--rows, 3), minmax(0, 1fr)); gap: var(--gap);
}
.card {
  position: relative; min-height: 0; display: grid; grid-template-columns: minmax(150px, 230px) 1fr; gap: var(--gap);
  background: var(--surface); border-radius: var(--radius); padding: 12px; box-shadow: 0 4px 0 rgb(0 0 0 / .25);
  animation: enter .28s cubic-bezier(.2, .9, .3, 1.3);
}
@keyframes enter { from { opacity: 0; transform: translateY(14px) scale(.96); } }
.card.flash { animation: enter .28s cubic-bezier(.2, .9, .3, 1.3), flash .5s ease-out; }
@keyframes flash { from { box-shadow: 0 0 0 4px var(--right), 0 0 28px rgb(61 220 132 / .55); background: var(--right-bg); } }
.card.miss { background: var(--wrong-bg); animation: shake .35s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
.prompt { display: flex; flex-direction: column; justify-content: center; gap: 8px; min-width: 0; min-height: 0; }
.prompt .q { font: 600 clamp(1rem, 2.4vh, 1.3rem)/1.2 var(--display); }
.prompt img, .prompt svg.shape { height: min(100px, 11vh); width: auto; max-width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; }
.prompt img { box-shadow: 0 0 0 2px rgb(255 255 255 / .15); }
.prompt svg.shape { fill: var(--ink); aspect-ratio: auto; width: min(140px, 100%); }
.native { font: 600 clamp(1.2rem, 3vh, 1.7rem)/1.2 var(--display); overflow-wrap: anywhere; color: var(--gold); }
.letter { font: 600 clamp(2rem, 6vh, 3.2rem)/1 Georgia, "Times New Roman", serif; color: var(--gold); }
.plate { align-self: flex-start; padding: 4px 18px; border: 3px solid #111; border-radius: 50%; background: #fff; color: #111; font: 800 clamp(1.1rem, 2.6vh, 1.5rem)/1 system-ui, sans-serif; letter-spacing: .04em; }
.pass {
  align-self: flex-start; padding: 4px 10px; border: 1px solid var(--line); border-radius: 99px;
  background: transparent; color: var(--muted); font: 600 .85rem var(--display); cursor: pointer;
}
.pass:hover:not(:disabled) { color: var(--ink); border-color: var(--accent); }
.pass:disabled { opacity: .35; }

.opts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; min-height: 0; }
.opt {
  position: relative; display: flex; align-items: center; justify-content: center; text-align: center; min-height: 0;
  padding: 16px 8px 10px; border: 0; border-radius: 12px; background: var(--surface2); cursor: pointer;
  font: 600 clamp(.95rem, 2.2vh, 1.15rem)/1.15 var(--display); overflow-wrap: anywhere; user-select: none;
  box-shadow: 0 3px 0 rgb(0 0 0 / .3); transition: transform .06s ease, background-color .12s;
}
.opt:hover:not(:disabled) { background: #31429a; }
.opt:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 rgb(0 0 0 / .3); }
.opt:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.opt kbd { position: absolute; top: 5px; left: 5px; font-size: .68em; }
.opt img { max-width: 100%; max-height: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 4px; }
.opt:disabled { cursor: default; }
.opt.right { background: var(--right); color: #06210f; }
.opt.right::after, .opt.wrong::after { position: absolute; top: 4px; right: 8px; font-size: 1rem; }
.opt.right::after { content: "✓"; }
.opt.wrong { background: var(--wrong); color: #2b0508; }
.opt.wrong::after { content: "✗"; }
.reveal { position: absolute; left: 12px; right: 12px; bottom: 6px; margin: 0; padding: 4px 8px; border-radius: 8px; background: rgb(0 0 0 / .55); color: #fff; font-size: .85rem; pointer-events: none; }
.board { position: relative; }
.pop { position: absolute; z-index: 5; pointer-events: none; white-space: nowrap; font: 700 1.5rem var(--display); color: var(--right); text-shadow: 0 2px 0 rgb(0 0 0 / .5), 0 0 12px rgb(0 0 0 / .4); animation: pop .9s ease-out forwards; }
.pop small { margin-left: 4px; padding: 0 6px; border-radius: 99px; background: var(--gold); color: #2a1d00; font-size: .7em; text-shadow: none; vertical-align: .15em; }
.pop.collected { color: var(--gold); font-size: 1.15rem; margin-top: -30px; }
@keyframes pop { from { opacity: 1; transform: translate(-50%, 0) scale(.8); } 30% { transform: translate(-50%, -14px) scale(1.15); } to { opacity: 0; transform: translate(-50%, -46px) scale(1); } }

.mapbox { display: block; min-height: 0; }
svg.map { display: block; width: 100%; height: 100%; border-radius: 12px; background: var(--sea); }
svg.map .context { fill: var(--land); stroke: var(--sea); stroke-width: 0.6px; vector-effect: non-scaling-stroke; }
.mapopt { cursor: pointer; }
.mapopt .land { fill: var(--pick); stroke: var(--surface); stroke-width: 0.8px; vector-effect: non-scaling-stroke; }
.mapopt circle { fill: var(--accent); stroke: #fff; stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
.mapopt line { stroke: #fff; stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
.mapopt circle.dot { stroke: none; fill: #fff; }
.mapopt text { pointer-events: none; }
.mapopt text:not(.name) { fill: #fff; font-weight: 700; text-anchor: middle; font-family: var(--display); }
.mapopt text.name { fill: #fff; font-family: var(--display); font-weight: 600; paint-order: stroke; stroke: var(--bg); stroke-width: 3px; vector-effect: non-scaling-stroke; }
.mapopt:hover .land { fill: var(--accent); }
.mapopt.right .land, .mapopt.right circle { fill: var(--right); }
.mapopt.wrong .land, .mapopt.wrong circle { fill: var(--wrong); }

/* ---------- sheets, countdown, result ---------- */
.sheet { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: calc(12px + var(--safe-t)) 12px calc(12px + var(--safe-b)); background: rgb(8 12 30 / .72); backdrop-filter: blur(4px); overflow-y: auto; }
.sheet-card { width: min(620px, 100%); background: var(--bg2); border: 1px solid var(--line); border-radius: 20px; padding: 20px; box-shadow: 0 20px 60px rgb(0 0 0 / .5); animation: enter .3s cubic-bezier(.2, .9, .3, 1.2); }
.sheet h2 { font: 700 1.5rem var(--display); margin: 0 0 12px; }
fieldset { border: 0; padding: 0; margin: 0 0 14px; }
legend { font: 600 .85rem var(--display); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; padding: 0; }
.kind-group { margin-bottom: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.group-name { flex-basis: 100%; font: 600 .75rem var(--display); color: var(--muted); margin: 6px 0 0; }
.best { color: var(--muted); min-height: 1.3em; }
.row-buttons { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.go, .ghost { padding: 12px 20px; border-radius: 14px; border: 0; cursor: pointer; font: 700 1.1rem var(--display); box-shadow: 0 4px 0 rgb(0 0 0 / .3); }
.go { background: linear-gradient(145deg, #6f9bff, #3f6ef0); color: #fff; flex: 1 1 100%; }
.ghost { background: var(--surface); flex: 1 1 0; }
.go:active, .ghost:active { transform: translateY(3px); box-shadow: 0 1px 0 rgb(0 0 0 / .3); }
.go:disabled { opacity: .5; }
.go kbd, .ghost kbd { background: rgb(0 0 0 / .2); border-color: transparent; }

.countdown { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgb(8 12 30 / .55); font: 700 min(38vw, 220px)/1 var(--display); color: #fff; text-shadow: 0 8px 0 rgb(0 0 0 / .3); pointer-events: none; }
.countdown span { animation: count .5s ease-out; }
@keyframes count { from { transform: scale(1.8); opacity: 0; } }

.result-card { text-align: center; }
.stars { display: flex; justify-content: center; gap: 8px; min-height: 52px; color: var(--gold); }
.stars .ico { width: 48px; height: 48px; filter: drop-shadow(0 3px 0 rgb(0 0 0 / .3)); }
.stars .off { color: var(--surface2); }
.stars span { display: inline-block; animation: starin .4s cubic-bezier(.2, .9, .3, 1.6) backwards; }
.stars span:nth-child(2) { animation-delay: .15s; } .stars span:nth-child(3) { animation-delay: .3s; }
@keyframes starin { from { transform: scale(0) rotate(-40deg); } }
.newbest { display: inline-block; margin: 4px 0; padding: 4px 14px; border-radius: 99px; background: var(--gold); color: #2a1d00; font: 700 1rem var(--display); animation: bump .6s ease 2; }
.big-points { font: 600 1.2rem var(--display); color: var(--muted); }
.big-points b { font: 700 clamp(3rem, 14vw, 4.6rem)/1 var(--display); color: var(--ink); }
.result-card h2 { font-size: 1.15rem; margin: 6px 0 2px; }
.result-line { color: var(--muted); margin: 0 0 12px; }
.misses-title { font: 600 .85rem var(--display); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 10px 0 4px; text-align: left; }
.misses-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 0 4px; }
.misses-head .misses-title { margin: 0; }
.next-star { margin: 2px 0 6px; color: var(--muted); font: 600 .95rem var(--display); }
.next-star:empty { display: none; }
.misses { list-style: none; margin: 0 0 14px; padding: 0; max-height: 34vh; overflow-y: auto; text-align: left; }
.misses li { display: flex; gap: 10px; align-items: flex-start; padding: 7px 8px; border-radius: 10px; background: var(--surface); margin-bottom: 6px; font-size: .92rem; }
.misses img { width: 32px; flex: none; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 3px; margin-top: 2px; }
.misses .said { color: #ff9a9d; } .misses .passed { color: var(--muted); }
.misses small { color: var(--muted); }
.share-note { color: var(--muted); min-height: 1.2em; margin: 8px 0 0; font-size: .9rem; }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 30; pointer-events: none; }

/* ---------- phones ---------- */
@media (max-width: 720px) {
  .hud { padding: 8px 10px 0; gap: 4px 10px; }
  .hud-score b, .clock b { font-size: 1.45rem; }
  .board { padding: 8px 10px 10px; --gap: 8px; }
  .card { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); padding: 10px; }
  .prompt { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
  .prompt img, .prompt svg.shape { height: clamp(34px, calc(14vh / var(--rows, 3) * 1.6), 110px); }
  .prompt .q { flex: 1 1 0; }
  /* Pass: a full finger-sized target (44 px), beside the question so the row grows no taller. */
  .prompt .pass { order: 2; align-self: center; min-height: 44px; min-width: 64px; padding: 0 14px; font-size: .95rem; }
  /* An outline is the whole clue: it gets more of the row than a flag. */
  .prompt svg.shape { height: clamp(48px, calc(14vh / var(--rows, 3) * 2.3), 150px); width: auto; max-width: 45%; }
  .prompt .native, .prompt .letter, .prompt .plate { order: 3; }
  .prompt .native { flex-basis: 100%; }
  .opts { grid-template-columns: repeat(2, 1fr); grid-auto-rows: minmax(0, 1fr); }
  .opt { padding: 8px 6px; }
  .modes { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .mode { min-height: 92px; padding: 12px; }
  .mode .what { font-size: .78rem; }
  .brand { margin: 2px 0 14px; }
  .control-name { font-size: .72rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- progress: profile strip, banners ---------- */
.profile { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.level { display: inline-flex; align-items: center; gap: 8px; border: 0; cursor: pointer; padding: 6px 12px; border-radius: 99px; background: var(--surface); }
.level .lv { font: 700 1rem var(--display); color: var(--gold); }
.xpbar { width: 84px; height: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), #ff8a3d); transform-origin: left; }
.xptext { font: 500 .78rem var(--display); color: var(--muted); }
.daystreak { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: 99px; background: rgb(255 138 61 / .15); font: 600 .9rem var(--display); }
.daystreak .ico { width: 16px; height: 16px; color: #ff8a3d; }
.daystreak b { color: var(--gold); }
.chip-btn { border: 0; cursor: pointer; padding: 7px 14px; border-radius: 99px; background: var(--surface); font: 600 .9rem var(--display); }
.chip-btn:active { transform: scale(.96); }

.banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius); margin: 0 0 14px; box-shadow: 0 4px 0 rgb(0 0 0 / .25); }
/* Challenges and study: calm navy cards with a coloured icon, so the topic tiles keep the colour. */
.banner.daily, .banner.challenge { grid-column: 1 / -1; margin: 0; background: var(--surface); box-shadow: 0 4px 0 rgb(0 0 0 / .25); }
.banner.daily .banner-icon { background: rgb(255 178 61 / .18); color: var(--gold); }
.banner.challenge { box-shadow: inset 0 0 0 2px var(--accent), 0 4px 0 rgb(0 0 0 / .25); }
.banner.challenge .banner-icon { background: rgb(91 140 255 / .2); color: #8fb0ff; }
.banner-text span { color: var(--muted); }
.banner .ghost.small { background: var(--surface2); }
.banner-icon { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 12px; background: rgb(0 0 0 / .2); }
.banner-icon .ico { width: 24px; height: 24px; }
.banner-icon.done { background: rgb(255 255 255 / .25); }
.banner-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.banner-text b { font: 700 1.1rem var(--display); }
.banner-text span { font-size: .85rem; opacity: .92; }
.go.small, .ghost.small { flex: none; padding: 8px 14px; font-size: 1rem; }
.banner .ghost.small { background: rgb(0 0 0 / .22); }

/* ---------- play extras ---------- */
.hud-mid { display: flex; align-items: center; gap: 8px; justify-self: start; }
.lives { display: flex; gap: 2px; }
.lives .ico { width: 22px; height: 22px; color: var(--wrong); }
.lives .lost .ico { color: var(--surface2); }
.done-card { display: grid; place-items: center; animation: none; opacity: .6; }
.done-card p { display: flex; align-items: center; gap: 8px; font: 600 1.2rem var(--display); color: var(--muted); margin: 0; }
.done-card .ico { width: 22px; height: 22px; color: var(--gold); }

/* ---------- result extras ---------- */
.versus { margin: 4px 0 8px; padding: 8px 12px; border-radius: 12px; font: 700 1.1rem var(--display); }
.versus.won { background: var(--right-bg); color: var(--right); }
.versus.lost { background: var(--wrong-bg); color: #ff9a9d; }
.dailygrid { display: grid; grid-template-columns: repeat(10, 18px); gap: 4px; justify-content: center; margin: 6px 0 10px; }
.dailygrid i { display: block; width: 18px; height: 18px; border-radius: 4px; background: var(--surface2); }
.dailygrid .gR { background: var(--right); } .dailygrid .gW { background: var(--wrong); }
.rewards { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 4px 0 8px; }
.rewards span { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 99px; font: 600 .9rem var(--display); background: var(--surface); }
.rewards .xp-gain { color: var(--gold); }
.rewards .levelup { background: var(--gold); color: #2a1d00; animation: bump .6s ease 2; }
.rewards .badge-new { background: linear-gradient(120deg, #b36bff, #ff5a8a); }
.rewards .ico { width: 16px; height: 16px; }
.hs { text-align: left; }
.hs-form { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 8px; padding: 10px; border-radius: 12px; background: rgb(255 200 61 / .12); }
.hs-form label { font: 600 .95rem var(--display); color: var(--gold); }
.hs-entry { display: flex; gap: 8px; }
.hs-entry input { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 2px solid var(--gold); background: var(--bg); color: var(--ink); font: 600 1.1rem var(--display); }
.account-form input { padding: 10px 12px; border-radius: 10px; border: 2px solid var(--gold); background: var(--bg); color: var(--ink); font: 600 1.1rem var(--display); }
.account-form .row-buttons { margin-top: 6px; }
.small-print { font-size: .85rem; color: var(--muted); }
.hs-list { list-style: none; margin: 0 0 12px; padding: 0; }
.hs-list li { display: grid; grid-template-columns: 2em 1fr auto auto; gap: 10px; align-items: baseline; padding: 6px 10px; border-radius: 10px; }
.hs-list li:nth-child(odd) { background: var(--surface); }
.hs-list li.mine { background: var(--gold); color: #2a1d00; }
.hs-list .place { font: 700 1rem var(--display); color: var(--muted); }
.hs-list li.mine .place, .hs-list li.mine .r { color: #2a1d00; }
.hs-list .who { font: 600 1rem var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hs-list .pts { font: 700 1.05rem var(--display); }
.hs-list .r { font-size: .8rem; color: var(--muted); }
.hs-list .empty { display: block; color: var(--muted); }

/* ---------- sheets: world, badges, scores ---------- */
.wide-card { width: min(980px, 100%); }
.world-map { border-radius: 14px; overflow: hidden; background: var(--sea); }
svg.world { display: block; width: 100%; height: auto; }
svg.world path { stroke: var(--sea); stroke-width: .25px; cursor: pointer; }
svg.world path:hover { filter: brightness(1.25); }
.m-mastered, .k.mastered { fill: var(--right); background: var(--right); }
.m-learning, .k.learning { fill: var(--gold); background: var(--gold); }
.m-missed, .k.missed { fill: var(--wrong); background: var(--wrong); }
/* Countries not asked yet: a light grey, so the continents stand out from the sea. */
.m-new, .k.new { fill: #5b6894; background: #5b6894; }
.world-pick { font: 600 1rem var(--display); margin: 10px 0 4px; min-height: 1.4em; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; color: var(--muted); font-size: .85rem; margin-bottom: 8px; }
.legend .k { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: -6px; }
.badge-list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.badge-list li { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 12px; background: var(--surface); opacity: .5; }
.badge-list li.got { opacity: 1; background: linear-gradient(120deg, rgb(179 107 255 / .35), rgb(255 90 138 / .3)); }
.badge-list li.summary { grid-column: 1 / -1; opacity: 1; background: none; color: var(--muted); padding: 0; }
.badge-list .medal { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--bg); color: var(--muted); }
.badge-list li.got .medal { background: var(--gold); color: #2a1d00; }
.badge-list .medal .ico { width: 20px; height: 20px; }
.badge-list b { display: block; font: 700 1rem var(--display); }
.badge-list small { color: var(--muted); }
.tabs { margin-bottom: 10px; }
.tabs button { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 6px 12px; cursor: pointer; font: 600 .9rem var(--display); }
.tabs button[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.toast { position: fixed; z-index: 40; left: 50%; bottom: calc(18px + var(--safe-b)); transform: translateX(-50%); padding: 10px 16px; border-radius: 12px; background: var(--gold); color: #2a1d00; font: 700 1rem var(--display); box-shadow: 0 8px 24px rgb(0 0 0 / .4); animation: enter .3s ease; max-width: calc(100% - 32px); text-align: center; }
@media (max-width: 720px) {
  .xptext { display: none; }
  .profile { gap: 6px; flex-wrap: nowrap; }
  .xpbar { width: 52px; }
  .level, .daystreak, .chip-btn { padding: 6px 10px; font-size: .85rem; }
  .banner { padding: 10px 12px; }
  .banner-text b { font-size: 1rem; }
}

/* ---- online: sign-in, world and group boards, friends ---- */
.chip-btn.sign-in { background: var(--gold); color: #2a1d00; text-decoration: none; }
.world-rank { margin: 4px 0 8px; padding: 8px 12px; border-radius: 12px; background: var(--surface); font: 700 1.05rem var(--display); }
.world-rank b { color: var(--gold); }
.tabs.scope button[aria-selected="true"] { background: var(--gold); color: #2a1d00; }
.group-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.group-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--surface); }
.group-list li .gname { flex: 1; font: 700 1rem var(--display); }
.group-list li code { font: 700 .95rem ui-monospace, monospace; letter-spacing: .12em; color: var(--gold); }
.group-list li.empty { color: var(--muted); }
.group-view { margin: 0 0 12px; padding: 10px; border-radius: 12px; background: var(--surface); }
.group-view h3 { margin: 0 0 6px; font: 700 1.05rem var(--display); }
.group-view p { margin: 0 0 8px; color: var(--muted); }
#sign-out { text-decoration: none; display: inline-flex; align-items: center; }

/* ---- learn: topics, the reference list, stars ---- */
.learn-head { display: flex; align-items: center; gap: 10px; }
.learn-head h2 { margin: 0; }
.learn-head .back { font: 700 1.6rem/1 var(--display); }
#learn-sheet:has(#learn-album[hidden]) .back { display: none; }
.albums { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 10px; }
.album { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px; min-height: 104px; border: 0; border-radius: var(--radius); cursor: pointer; text-align: left;
  background: linear-gradient(90deg, rgb(255 200 61 / .26) var(--p, 0%), var(--surface) var(--p, 0%)); box-shadow: 0 5px 0 rgb(0 0 0 / .25); }
/* A topic's colour is its progress: navy with nothing collected, filling with gold, all gold when complete. */
.album.complete { background: linear-gradient(145deg, var(--gold), #f08c00); color: #2a1d00; }
.album.complete .count { color: #2a1d00; }
.album .icon { color: var(--c1); }
.album.complete .icon { color: #2a1d00; }
.album.missed-all { grid-column: 1 / -1; min-height: 0; flex-direction: row; align-items: center; gap: 12px; background: var(--wrong-bg); box-shadow: inset 0 0 0 2px var(--wrong), 0 5px 0 rgb(0 0 0 / .25); }
.album.missed-all .icon { color: #ff9a9d; }
.album.missed-all .count { margin-left: auto; }
.learn-help { flex: 2 1 0; margin: 0; align-self: center; color: var(--muted); font-size: .9rem; }
.album:active { transform: translateY(3px); box-shadow: 0 2px 0 rgb(0 0 0 / .25); }
.album .icon { width: 1.7rem; height: 1.7rem; } .album .icon .ico { width: 100%; height: 100%; }
.album .name { font: 700 1.1rem/1.1 var(--display); }
.album .abar { width: 100%; height: 8px; margin-top: auto; border-radius: 4px; background: rgb(0 0 0 / .25); overflow: hidden; }
.album .abar i { display: block; height: 100%; background: var(--gold); transform-origin: left; }
.album .count { font: 600 .82rem var(--display); color: var(--muted); }
.album .done { position: absolute; top: 8px; right: 8px; padding: 1px 8px; border-radius: 99px; background: var(--gold); color: #2a1d00; font: 700 .75rem var(--display); }
.learn-search { width: 100%; margin: 0 0 10px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: 600 1rem var(--display); }
.learn-search:focus { outline: 2px solid var(--accent); }
.learn-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.learn-tools .tabs { margin-bottom: 0; }
/* The reference list: one row per fact, the clue on the left, its answer beside it. */
.lcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 6px; margin: 12px 0; max-height: 58vh; overflow-y: auto; padding: 2px; align-content: start; }
.lcards .empty { color: var(--muted); grid-column: 1 / -1; }
.lrow { position: relative; display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 8px 10px; min-height: 58px;
  border-radius: 12px; background: var(--surface); cursor: pointer; user-select: none; border-left: 4px solid transparent; }
.lrow.textclue { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
.lrow:hover { background: var(--surface2); }
.lrow:focus-visible { outline: 2px solid var(--gold); }
.lrow[aria-pressed="true"] { border-left-color: var(--gold); }
.lrow .clue { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center; min-width: 0; }
.lrow.textclue .clue { align-items: flex-start; text-align: left; }
.lrow .clue img { width: 64px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 4px; box-shadow: 0 0 0 1px rgb(255 255 255 / .15); }
.lrow .clue svg.shape { width: 70px; height: 46px; fill: var(--ink); }
.lrow .clue .plate { padding: 2px 10px; border: 3px solid #111; border-radius: 50%; background: #fff; color: #111; font: 800 .95rem system-ui, sans-serif; }
.lrow .clue b { font: 700 1rem/1.15 var(--display); overflow-wrap: anywhere; }
.lrow .clue span { font-size: .78rem; line-height: 1.2; color: var(--muted); }
.lrow.visual .clue b { font-size: 1.1rem; }
.lrow .ans { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lrow .ans b { font: 700 1rem/1.2 var(--display); color: #fff; overflow-wrap: anywhere; }
.lrow .ans small { font-size: .78rem; line-height: 1.25; color: var(--muted); }
.lrow .side { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.lstar { display: grid; place-items: center; width: 26px; height: 26px; color: rgb(255 255 255 / .3); }
.lstar .ico { width: 20px; height: 20px; }
.lstar.on { color: var(--gold); }
.lstar.pop-star { animation: starpop .45s cubic-bezier(.2, .9, .3, 1.8); }
@keyframes starpop { 40% { transform: scale(1.6) rotate(20deg); } }
.pips { display: flex; gap: 3px; }
.pips i { width: 6px; height: 6px; border-radius: 50%; background: rgb(255 255 255 / .2); }
.pips i.on { background: var(--gold); }
/* A collected fact: gold, with a shine sweeping across it now and then. */
.lrow.learned { background: linear-gradient(120deg, rgb(255 200 61 / .22), var(--surface) 60%); box-shadow: inset 0 0 0 1px rgb(255 200 61 / .6); overflow: hidden; }
.lrow.learned::after { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 35%, rgb(255 255 255 / .18) 50%, transparent 65%); transform: translateX(-100%); animation: shine 5s ease-in-out infinite; pointer-events: none; }
@keyframes shine { 0%, 75% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.learn-buttons .go { flex: 2 1 0; }
.rewards .cards-new { background: linear-gradient(120deg, var(--gold), #ff8a3d); color: #2a1d00; }
.new-cards { display: grid; gap: 6px; margin: 0 0 10px; text-align: left; }
.new-cards .lrow { cursor: default; animation: starin .5s cubic-bezier(.2, .9, .3, 1.6) backwards; }
/* A sheet's card never grows past the screen for a row that scrolls inside it (the region strip). */
.sheet { grid-template-columns: minmax(0, 1fr); }
.sheet-card { min-width: 0; justify-self: center; }
@media (max-width: 720px) {
  .albums { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .album { min-height: 92px; padding: 10px; }
  .lcards { grid-template-columns: 1fr; max-height: 54vh; }
  .lrow { grid-template-columns: 64px minmax(0, 1fr) auto; gap: 10px; }
  .lrow .clue img { width: 56px; }
  .learn-card .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .learn-card .tabs::-webkit-scrollbar { display: none; }
  .learn-card .tabs button { flex: none; }
  .learn-tools { flex-direction: column; align-items: stretch; }
}
.album .missed { position: absolute; top: 8px; right: 8px; padding: 1px 8px; border-radius: 99px; background: var(--wrong); color: #fff; font: 700 .72rem var(--display); }
#learn-show [data-show="missed"] { border-color: var(--wrong); }
#learn-show [data-show="missed"][aria-selected="true"] { background: var(--wrong); }

/* ---- home: one settings bar above the tiles, then three groups ---- */
.setbar { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 10px 16px; margin: 0 0 6px; }
.setbar .control-name { text-align: left; margin-bottom: 4px; font-size: .72rem; }
.setbar .seg button { padding: 7px 11px; min-width: 40px; font-size: .95rem; }
.dropdown { position: relative; }
.dropdown summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 12px;
  background: var(--surface); font: 600 .95rem var(--display); max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dropdown summary::-webkit-details-marker { display: none; }
.dropdown summary::after { content: "▾"; margin-left: auto; color: var(--muted); }
.dropdown[open] summary { box-shadow: inset 0 0 0 2px var(--accent); }
.dropdown .menu { position: absolute; z-index: 20; top: calc(100% + 6px); right: 0; width: min(330px, calc(100vw - 32px)); padding: 12px; border-radius: 14px;
  background: var(--bg2); box-shadow: 0 0 0 1px var(--line), 0 14px 34px rgb(0 0 0 / .5); }
.dropdown .menu .note { margin: 8px 0 0; color: var(--muted); font-size: .82rem; }
.group-title { font: 600 .8rem var(--display); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin: 22px 2px 8px; }
/* Survival and Custom: slim calm bars under the topics, side by side where there is room. */
.modes .mode-bar { grid-column: span 2; min-height: 0; flex-direction: row; align-items: center; gap: 10px; padding: 10px 14px; }
.modes .mode-bar .icon { width: 1.4rem; height: 1.4rem; flex: none; }
.modes .mode-bar .name { font-size: 1.05rem; white-space: nowrap; }
.modes .mode-bar .best { margin: 0 0 0 auto; }
@media (max-width: 720px) { .modes .mode-bar { grid-column: 1 / -1; } }
/* The daily challenge leads the page. */
.today { display: grid; gap: 10px; margin: 0 0 16px; }
.today .banner { margin: 0; }
.today .banner.daily { box-shadow: inset 0 0 0 2px rgb(255 200 61 / .55), 0 4px 0 rgb(0 0 0 / .25); }
.banner-icon.done { background: rgb(255 200 61 / .3); }
/* Who's playing the daily: names already used on this device, one tap each. */
.who-label { display: block; font: 600 1rem var(--display); margin: 6px 0 8px; }
.names { margin-bottom: 10px; }
.names button { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 8px 14px; min-height: 40px; cursor: pointer; font: 600 .95rem var(--display); }
.names button.played { opacity: .5; }
#daily-form .hs-entry input { flex: 1; }
.mode.calm { background: var(--surface); }
.mode.calm .icon { color: var(--c1); }
.mode.calm .what { color: var(--muted); opacity: 1; }
.mode.calm:disabled { filter: none; opacity: .55; }
.mode-world { grid-column: span 2; }
.mode-world .thumb { position: absolute; right: 10px; bottom: 10px; width: 52%; height: auto; max-height: calc(100% - 20px); }
.mode-world .thumb .m-new { fill: #4a5785; }
@media (max-width: 720px) {
  .setbar { justify-content: flex-start; gap: 8px 10px; }
  .setbar .seg button { padding: 7px 9px; min-width: 36px; font-size: .9rem; }
  .group-title { margin-top: 18px; }
  /* The region menu spans the settings bar, not the narrow button it drops from. */
  .setbar { position: relative; }
  .dropdown { position: static; }
  .dropdown .menu { left: 0; right: 0; width: auto; }
  .mode-world .thumb { width: 48%; }
}

/* ---- footer and the Help / Privacy pages ---- */
.site-footer { margin-top: 28px; text-align: center; }
.site-footer p { margin: 6px 0; }
.site-footer .links { font: 600 .95rem var(--display); }
.site-footer a, .info-page a { color: #8fb0ff; }
.site-footer .credits { margin-top: 10px; }
.copyright { color: var(--muted); font-size: .78rem; }
.info-page { max-width: 720px; margin: 0 auto; padding: calc(20px + var(--safe-t)) calc(18px + var(--safe-r)) calc(48px + var(--safe-b)) calc(18px + var(--safe-l)); line-height: 1.6; }
.info-page .back-link { font: 600 1rem var(--display); text-decoration: none; }
.info-page h1 { font: 700 clamp(1.8rem, 6vw, 2.4rem)/1.15 var(--display); margin: 22px 0 10px; }
.info-page h2 { font: 700 1.25rem var(--display); margin: 28px 0 6px; color: var(--gold); }
.info-page p { margin: 0 0 12px; color: #dfe4ff; }
.info-page .updated { color: var(--muted); }
.info-page .copyright { margin-top: 36px; }
