/* 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; }

.quickbar { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 22px; margin: 0 0 16px; }
.quickbar .control-name { text-align: center; }
.controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px 18px; margin: 22px 0 10px; }
.control.wide { grid-column: 1 / -1; }
.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); }
.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; }
.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.low i { background: linear-gradient(90deg, var(--wrong), 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.got { 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; }
.pop { position: absolute; z-index: 5; pointer-events: none; font: 700 1.4rem var(--display); color: var(--gold); text-shadow: 0 2px 0 rgb(0 0 0 / .4); animation: pop .8s ease-out forwards; }
@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 { 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; }
  .prompt .pass { order: 2; align-self: center; }
  .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; }
  .quickbar { flex-wrap: nowrap; gap: 10px; }
  .quickbar .seg button { padding: 7px 10px; min-width: 38px; font-size: .95rem; }
  .control-name { font-size: .72rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
