@font-face { font-family: "Manrope"; src: url("fonts/manrope-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("fonts/manrope-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("fonts/manrope-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("fonts/manrope-latin-800-normal.woff2") format("woff2"); font-weight: 800; font-display: swap; }

/* Geography Gym, "Clean": one centered column, the flag is the only loud thing on screen. */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #15171c;
  --muted: #5b6270;
  --line: #dfe3e8;
  --track: #e3e6eb;
  --accent: #2f6bff;
  --good: #15803d;
  --good-bg: #e7f6ec;
  --bad: #c62828;
  --bad-bg: #fdecec;
  --flag-shadow: 0 1px 2px rgba(20, 23, 28, .08), 0 16px 40px -12px rgba(20, 23, 28, .25);
  --pop-shadow: 0 12px 40px -8px rgba(20, 23, 28, .22);
  --map-sea: #e8edf3;
  --map-land: #d3d9e1;
  --map-border: #f6f7f9;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f1115;
  --surface: #181b21;
  --ink: #eef0f3;
  --muted: #9aa1ad;
  --line: #2a2f38;
  --track: #262a31;
  --accent: #7aa2ff;
  --good: #4ade80;
  --good-bg: #13291c;
  --bad: #f87171;
  --bad-bg: #2d1717;
  --flag-shadow: 0 0 0 1px rgba(255, 255, 255, .06), 0 24px 60px -16px rgba(0, 0, 0, .8);
  --pop-shadow: 0 12px 40px -8px rgba(0, 0, 0, .7);
  --map-sea: #151a22;
  --map-land: #2b313b;
  --map-border: #0f1115;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--ink); font: 500 16px/1.5 var(--font); display: flex; flex-direction: column; min-height: 100vh; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { flex: none; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 48px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; }
.logo svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.logo-mark { width: 30px; height: 30px; border-radius: 8px; flex: none; }
.top-right { display: flex; align-items: center; gap: 12px; }
.progress-mini { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); font-weight: 600; margin-right: 8px; }
.progress-mini b { color: var(--ink); font-weight: 700; }
.bar { width: 120px; height: 6px; border-radius: 99px; background: var(--track); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .4s; }
.icon-btn, .menu-btn { height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; }
.icon-btn { width: 44px; }
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:root[data-theme="dark"] .i-moon, :root:not([data-theme="dark"]) .i-sun { display: none; }
.menu-btn { gap: 8px; padding: 0 14px 0 16px; font-size: 15px; font-weight: 700; }
.menu-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.menu-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.icon-btn:hover, .menu-btn:hover { border-color: var(--muted); }

/* Popovers: topic menu and settings panel */
.pop-wrap { position: relative; }
.pop { position: absolute; right: 0; top: calc(100% + 8px); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--pop-shadow); z-index: 20; overflow: auto; max-height: calc(100vh - 100px); }
.menu { width: 340px; padding: 8px; }
.menu-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 2px 2px 8px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.menu-tabs button { height: 30px; padding: 0 11px; border-radius: 999px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.menu-tabs button:hover { color: var(--ink); background: var(--bg); }
.menu-tabs button[aria-selected="true"] { background: var(--ink); color: var(--surface); }
.menu-list a[hidden] { display: none; }
.menu-group { font-size: 12px; font-weight: 700; color: var(--muted); padding: 10px 12px 4px; }
.menu-group:first-child { padding-top: 4px; }
.menu-list { display: grid; gap: 2px; }
.menu-list a { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 36px; padding: 0 12px; border-radius: 9px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: 15px; }
.menu-list a:hover { background: var(--bg); }
.menu-list .chk { width: 16px; height: 16px; fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; visibility: hidden; }
.menu-list a[aria-current] { font-weight: 800; }
.menu-list a[aria-current] .chk { visibility: visible; }

.panel { width: 300px; padding: 20px; display: grid; gap: 18px; }
.panel-title { font-size: 15px; font-weight: 800; }
.panel-title span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-top: 2px; }
.field { display: grid; gap: 8px; font-weight: 600; font-size: 14px; color: var(--muted); }
.field select { height: 40px; width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); padding: 0 10px; font-weight: 600; font-size: 15px; color: var(--ink); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; font-size: 15px; cursor: pointer; }
.switch { appearance: none; -webkit-appearance: none; flex: none; width: 36px; height: 20px; margin: 0; border-radius: 99px; background: var(--track); position: relative; cursor: pointer; transition: background .15s; }
.switch::before { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch:checked { background: var(--accent); }
.switch:checked::before { transform: translateX(16px); }
.link-btn { justify-self: start; border: 0; background: none; padding: 0; color: var(--muted); font-weight: 600; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
.link-btn:hover { color: var(--bad); text-decoration-color: currentColor; }
.icon-btn[aria-expanded="true"] { border-color: var(--muted); background: var(--bg); }

/* Mode row */
.modes { display: flex; justify-content: center; gap: 6px; padding: 0 20px; margin: -6px 0 6px; overflow-x: auto; scrollbar-width: none; }
.modes a { flex: none; padding: 8px 12px; color: var(--muted); text-decoration: none; font-weight: 700; font-size: 15px; border-bottom: 2px solid transparent; }
.modes a:hover { color: var(--ink); }
.modes a[aria-current] { color: var(--ink); border-bottom-color: var(--accent); }

/* Segmented control */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 8px 12px; font-weight: 700; font-size: 14px; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.seg.soft { border: 0; background: var(--bg); padding: 3px; gap: 3px; border-radius: 10px; }
.seg.soft button { border-radius: 7px; padding: 6px 8px; }
.seg.soft button + button { border-left: 0; }
.seg.soft button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 0 0 1px var(--line); }

/* Main column */
main { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 8px 32px 16px; }
.view { width: 100%; max-width: 600px; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.view.wide { max-width: 1100px; justify-content: flex-start; }
.view[hidden] { display: none; }
.loading { margin: auto; color: var(--muted); font-weight: 600; }

.flag { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; box-shadow: var(--flag-shadow); }
.qflag { width: min(440px, 100%); }
.qflag .flag { border-radius: 10px; }
.qflag.small { width: min(220px, 60%); margin-bottom: 14px; }
.qflag.small .flag { border-radius: 8px; }
.prompt { margin: 28px 0 0; color: var(--muted); font-weight: 600; font-size: 15px; text-align: center; }
.qname { font-size: clamp(28px, 6vw, 40px); font-weight: 800; letter-spacing: -0.02em; text-align: center; margin: 4px 0 4px; }
.answers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; width: 100%; margin-top: 16px; }
.answer { min-height: 58px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 17px; font-weight: 700; padding: 10px 14px; transition: border-color .12s, background .12s, transform .08s; }
.answer:hover:not(:disabled) { border-color: var(--muted); }
.answer:active:not(:disabled) { transform: scale(.985); }
.answer:disabled { cursor: default; }
.answer.right { border-color: var(--good); background: var(--good-bg); color: var(--good); }
.answer.wrong { border-color: var(--bad); background: var(--bad-bg); color: var(--bad); }
.answer.dim { opacity: .45; }
.flag-answers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; width: 100%; margin-top: 20px; }
.flag-answer { border: 2px solid transparent; background: none; padding: 6px; border-radius: 14px; display: grid; gap: 6px; }
.flag-answer:hover:not(:disabled) { border-color: var(--line); }
.flag-answer:disabled { cursor: default; }
.flag-answer.right { border-color: var(--good); background: var(--good-bg); }
.flag-answer.wrong { border-color: var(--bad); background: var(--bad-bg); }
.flag-answer .cap { font-size: 14px; font-weight: 700; min-height: 1.5em; }
.type-row { display: flex; gap: 10px; width: 100%; margin-top: 16px; }
.type-row input { flex: 1; min-width: 0; height: 56px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); padding: 0 16px; font-size: 18px; font-weight: 600; }
.type-row input:focus { outline: none; border-color: var(--accent); }
.type-row input.right { border-color: var(--good); background: var(--good-bg); }
.type-row input.wrong { border-color: var(--bad); background: var(--bad-bg); }
.btn { height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; font-size: 15px; }
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: var(--ink); }
a.btn.primary { color: var(--bg); }
.btn:hover:not(:disabled) { border-color: var(--muted); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover:not(:disabled) { opacity: .9; }
.btn:disabled { opacity: .5; cursor: default; }
.type-row .btn { height: 56px; }

.below { margin-top: 18px; min-height: 24px; color: var(--muted); font-size: 14px; font-weight: 600; text-align: center; }
.result { margin-top: 22px; width: 100%; display: grid; gap: 14px; justify-items: center; text-align: center; }
.result-line { font-size: 17px; font-weight: 700; }
.result-line.good { color: var(--good); }
.result-line.bad { color: var(--bad); }
.result-sub { color: var(--muted); font-size: 14px; font-weight: 600; margin-top: -8px; }
.tip { width: 100%; text-align: left; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--surface); font-size: 14px; color: var(--muted); }
.tip b { color: var(--ink); }
.minis { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.minis figure { margin: 0; width: 70px; font-size: 12px; font-weight: 700; color: var(--ink); line-height: 1.25; }
.minis figcaption { margin-top: 4px; overflow-wrap: break-word; hyphens: auto; }
.minis .flag { border-radius: 4px; }
.map { position: relative; width: 100%; aspect-ratio: 16 / 10; margin: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--map-sea); }
.map-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.map-svg path { fill: var(--map-land); stroke: var(--map-border); stroke-width: .6px; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.map-svg path.hit { fill: var(--accent); }
.map-svg path.miss { fill: var(--bad); opacity: .55; }
.map-svg .ring { fill: none; stroke-width: 2px; vector-effect: non-scaling-stroke; }
.map-svg .ring.hit { stroke: var(--accent); }
.map-svg .ring.miss { stroke: var(--bad); }
.map-key { position: absolute; left: 10px; bottom: 8px; z-index: 1; display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; font-weight: 700; color: var(--ink); }
.map-key span { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border-radius: 99px; padding: 3px 9px 3px 7px; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.k { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.k.hit { background: var(--accent); }
.k.miss { background: var(--bad); opacity: .7; }
/* Question: one stacked column. Before answering, a big flag and the answers. After answering, the flag shrinks
   and the result, the map and any tip fill the rest of the screen (no scrolling on desktop). */
.q-stack { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.q-head { display: flex; flex-direction: column; align-items: center; }
.q-head .prompt { margin: 16px 0 0; }
.q-head .qname + .prompt { margin-top: 0; }
.q-stack .answers, .q-stack .type-row, .q-stack .flag-answers { margin-top: 0; }
.below:empty { display: none; }
.below { margin-top: 0; }
.fb { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.fb:empty { display: none; }
.fb .result { margin: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; text-align: left; }
.result-text { display: grid; gap: 2px; min-width: 0; }
.result-text .result-sub { margin: 0; }
.fb .next-row { flex: none; }
.fb .tip { display: flex; align-items: center; gap: 14px; padding: 10px 14px; font-size: 13px; }
.fb .tip .minis { flex: none; margin: 0; gap: 8px; }
.fb .tip .minis figure { width: 68px; font-size: 11px; }
/* Text prompts (capital, abbreviation), outlines, comparisons */
.qtext { font-size: clamp(36px, 7vh, 64px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; text-align: center; padding: 28px 40px; min-width: min(360px, 100%); max-width: 100%; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--flag-shadow); overflow-wrap: anywhere; transition: font-size .3s, padding .3s; }
.tile-text, .card-text { display: grid; place-items: center; aspect-ratio: 4 / 3; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-weight: 800; font-size: 22px; padding: 6px; text-align: center; overflow-wrap: anywhere; line-height: 1.15; }
.card-text { font-size: 18px; }
.shape, .tile-shape, .card-shape, .mini-shape { display: block; width: 100%; aspect-ratio: 4 / 3; }
.shape path, .tile-shape path, .card-shape path, .mini-shape path { fill: var(--accent); stroke: none; }
.qshape { aspect-ratio: 4 / 3; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 12px; box-shadow: var(--flag-shadow); }
.tile-shape, .card-shape { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 6px; }
.mini-shape { border: 1px solid var(--line); border-radius: 4px; background: var(--surface); padding: 2px; }
.flag.noflag { background: var(--track); }
.pair { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.pair-card { position: relative; display: grid; gap: 8px; justify-items: center; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); font-size: 18px; transition: border-color .12s, background .12s; }
.pair-card:hover:not(:disabled) { border-color: var(--muted); }
.pair-card:disabled { cursor: default; }
.pair-card .flag { width: min(100%, 300px); max-height: 30vh; object-fit: contain; box-shadow: none; border: 1px solid var(--line); }
.pair-card .kbd { position: absolute; top: 10px; left: 10px; }
.pair-card .val { font-size: 15px; font-weight: 700; color: var(--muted); min-height: 1.4em; }
.pair-card.right { border-color: var(--good); background: var(--good-bg); }
.pair-card.wrong { border-color: var(--bad); background: var(--bad-bg); }
.pair-card.right .val { color: var(--good); }
/* Find-it map: the map is the answer area */
.locate .map.main { aspect-ratio: 16 / 10; }
.map-svg .dots { display: none; }
.map-svg.show-dots .dots { display: block; }
.map-svg .dot { fill: var(--map-land); stroke: var(--muted); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.map-svg .dot.hit { fill: var(--accent); stroke: var(--accent); }
.map-svg .dot.miss { fill: var(--bad); stroke: var(--bad); }
.map-svg path.hit2 { fill: color-mix(in srgb, var(--accent) 38%, var(--map-land)); }
.k.hit2 { background: color-mix(in srgb, var(--accent) 45%, var(--map-land)); }
.locate:not(.answered) .map-svg path[data-c]:hover, .locate:not(.answered) .map-svg .dot:hover { fill: color-mix(in srgb, var(--accent) 30%, var(--map-land)); cursor: pointer; }
/* Lakes, rivers and mountain ranges drawn over the map */
.map-svg .feat { vector-effect: non-scaling-stroke; pointer-events: none; }
.map-svg .feat.lake { fill: var(--accent); stroke: var(--accent); stroke-width: 1px; }
.map-svg .feat.river { fill: none; stroke: var(--accent); stroke-width: 3px; stroke-linecap: round; stroke-linejoin: round; }
.map-svg .feat.range { fill: var(--accent); fill-opacity: .55; stroke: var(--accent); stroke-width: 1.5px; }
.map-svg .feat.peak { fill: var(--accent); stroke: var(--surface); stroke-width: 1.5px; }
.map-svg .feat.sea { fill: var(--accent); fill-opacity: .6; stroke: var(--accent); stroke-width: 1px; }
.map-svg .feat.miss { fill: var(--bad); stroke: var(--bad); }
.map-svg .feat.peak.miss { stroke: var(--surface); }
.map-svg .feat.river.miss { fill: none; }
.kind-feature .card .nm { font-size: 17px; }
.map { cursor: grab; touch-action: none; user-select: none; }
.map.dragging { cursor: grabbing; }
.map-ctrl { position: absolute; top: 10px; right: 10px; z-index: 2; display: grid; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.map-ctrl button { width: 34px; height: 34px; border: 0; background: none; display: grid; place-items: center; cursor: pointer; }
.map-ctrl button + button { border-top: 1px solid var(--line); }
.map-ctrl button:hover { background: var(--bg); }
.map-ctrl svg { width: 16px; height: 16px; fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.map-tip { position: absolute; z-index: 3; pointer-events: none; background: var(--ink); color: var(--bg); font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
.map-svg path[data-c]:hover { filter: brightness(1.08); }
@media (max-width: 899px) {
  .fb .result { flex-direction: column; text-align: center; }
  .fb .tip { flex-direction: column; align-items: flex-start; }
}
@media (min-width: 900px) {
  #view-practice, #view-quiz { max-width: 820px; }
  .answers, .flag-answers { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .q-stack { height: calc(100vh - 150px); min-height: 460px; justify-content: center; }
  #view-quiz .q-stack { height: calc(100vh - 200px); }
  .qflag { width: min(440px, calc((100vh - 360px) * 4 / 3)); transition: width .35s ease; }
  .qflag.small { width: min(220px, calc((100vh - 520px) * 4 / 3)); }
  .q-stack.answered { justify-content: flex-start; gap: 12px; }
  .q-stack.answered .qflag { width: min(150px, calc(12vh * 4 / 3)); }
  .q-stack.answered .qflag.small { width: min(110px, calc(9vh * 4 / 3)); margin-bottom: 4px; }
  .q-stack.answered .qname { font-size: 26px; margin: 0; }
  .q-stack.answered .q-head .prompt { display: none; }
  .q-stack.answered .fb { flex: 1 1 0; min-height: 0; }
  .q-stack.answered .map { aspect-ratio: auto; flex: 1 1 0; min-height: 160px; }
  .q-stack.answered .flag-answers .flag { max-height: calc(14vh); object-fit: contain; }
  .qtext { padding: 32px 56px; }
  .q-stack.answered .qtext { font-size: 28px; padding: 10px 24px; }
  .qshape { width: min(440px, calc((100vh - 360px) * 4 / 3)); }
  .q-stack.answered .qshape { width: min(150px, calc(12vh * 4 / 3)); padding: 4px; }
  .q-stack.locate .map.main { aspect-ratio: auto; flex: 1 1 0; min-height: 240px; }
  .q-stack.locate.answered { gap: 10px; }
  .q-stack.locate.answered .fb { flex: none; }
  .q-stack.kind-feature .map.main { aspect-ratio: auto; flex: 1 1 0; min-height: 220px; }
  .q-stack.kind-feature.answered .fb { flex: none; }
  .pair { max-width: 760px; }
  .q-stack.answered .pair-card { padding: 10px; gap: 4px; }
  .q-stack.answered .pair-card .flag { max-height: 10vh; }
}
@media (min-width: 900px) and (max-height: 700px) {
  .top { padding-top: 14px; padding-bottom: 14px; }
  .q-stack { height: calc(100vh - 142px); }
  #view-quiz .q-stack { height: calc(100vh - 186px); }
  .qtop { margin-bottom: 10px; }
  .q-stack.answered { gap: 8px; }
  .q-stack.answered .qflag { width: min(120px, calc(10vh * 4 / 3)); }
  .q-stack.answered .flag-answers .flag { max-height: 11vh; }
  .q-stack.answered .answer { min-height: 46px; padding: 6px 10px; }
  .fb { gap: 8px; }
  .fb .tip { padding: 8px 12px; font-size: 12px; }
  .fb .tip .minis figure { width: 60px; }
  .q-stack.answered .map { min-height: 140px; }
}
.next-row { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.kbd-hint { font-size: 13px; color: var(--muted); }
.kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; font-size: 12px; font-weight: 700; }

/* Quiz */
.qtop { width: 100%; display: flex; justify-content: space-between; align-items: center; font-size: 14px; font-weight: 700; color: var(--muted); margin-bottom: 18px; gap: 12px; }
.qtrack { flex: 1; height: 6px; border-radius: 99px; background: var(--track); overflow: hidden; }
.qtrack span { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.setup { display: grid; gap: 22px; justify-items: center; text-align: center; width: 100%; max-width: 420px; }
.setup h1 { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; }
.setup p { margin: 6px 0 0; color: var(--muted); }
.setup .field { display: grid; gap: 8px; width: 100%; }
.setup .field > span { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.setup .btn.primary { width: 100%; height: 52px; font-size: 16px; }
.score { font-size: 64px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.score small { font-size: 28px; color: var(--muted); }
.misses { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 14px; width: 100%; margin-top: 8px; text-align: left; }
.misses figure { margin: 0; font-size: 13px; font-weight: 700; }
.misses figcaption { margin-top: 6px; }
.misses .of { color: var(--muted); font-weight: 600; }
.misses small { display: block; color: var(--bad); font-weight: 600; }

/* Name them (the #name-all mode) */
.na-bar { position: sticky; top: 0; z-index: 5; background: var(--bg); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; width: 100%; padding: 8px 0 16px; }
.na-bar input { flex: 1 1 260px; min-width: 0; height: 52px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); padding: 0 16px; font-size: 18px; font-weight: 600; }
.na-bar input:focus { outline: none; border-color: var(--accent); }
.na-bar input.flash { border-color: var(--good); background: var(--good-bg); }
.na-stat { font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; min-width: 64px; text-align: center; }
#naBanner { width: 100%; }
.banner { width: 100%; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; margin-bottom: 8px; }
.banner.good { border-color: var(--good); background: var(--good-bg); color: var(--good); }
.na-hint { color: var(--muted); font-size: 14px; margin: 0 0 8px; width: 100%; }
#naBoard { width: 100%; }
.region-h { display: flex; align-items: baseline; gap: 10px; margin: 26px 0 12px; }
.region-h h2 { font-size: 18px; font-weight: 800; }
.region-h span { color: var(--muted); font-size: 14px; font-weight: 700; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 18px 14px; }
.tile .flag { border-radius: 6px; }
.tile-of { margin-top: 6px; font-size: 12px; font-weight: 600; color: var(--muted); line-height: 1.2; }
.tile-of + .lab { margin-top: 2px; }
.tile .lab { margin-top: 6px; font-size: 13px; font-weight: 700; line-height: 1.25; min-height: 2.5em; color: var(--muted); }
.tile.found .lab { color: var(--good); }
.tile.missed .lab { color: var(--bad); }
.tile.found .flag { animation: settle .3s ease-out; }
@keyframes settle { from { transform: scale(1.06); } }

/* Browse */
.browse-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; width: 100%; margin-bottom: 20px; }
.browse-bar input[type="search"] { flex: 1 1 200px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); padding: 0 12px; font-weight: 600; }
#browseBody { width: 100%; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 22px 16px; }
.card { border: 0; background: none; padding: 0; text-align: left; display: grid; gap: 8px; }
.card .nm { font-weight: 700; display: flex; align-items: center; gap: 7px; line-height: 1.25; }
.card .sub { font-size: 13px; color: var(--muted); margin-top: -6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--track); flex: none; }
.dot.mastered { background: var(--good); }
.dot.learning { background: var(--accent); }
.card.hidden .nm span:not(.dot), .card.hidden .sub { filter: blur(6px); user-select: none; }
.groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.group { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 16px; display: grid; gap: 6px; align-content: start; }
.group h3 { font-size: 16px; font-weight: 800; }
.group p { margin: 0; font-size: 14px; color: var(--muted); }
.empty { padding: 40px 0; text-align: center; color: var(--muted); font-weight: 600; }

@media (max-width: 640px) {
  .top { padding: 16px 18px; }
  .top { gap: 10px; }
  .top-right { display: contents; }
  .logo { margin-right: auto; }
  .topic-wrap { order: 3; width: 100%; }
  .menu-btn { width: 100%; justify-content: space-between; }
  .menu { left: 0; right: 0; width: auto; }
  .panel { position: fixed; left: 12px; right: 12px; top: 70px; width: auto; }
  .modes { justify-content: flex-start; margin-top: 0; }
  .modes a { padding: 8px 10px; font-size: 14px; }
  .progress-mini { order: 4; width: 100%; margin: 0; }
  .bar { flex: 1; }
  .answers { gap: 10px; }
  .answer { font-size: 16px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
  .cards { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* Daily challenge, review and stats */
body.special #modeNav, body.special .gear-wrap { display: none; }
#view-special .q-stack { height: auto; }
@media (min-width: 900px) {
  #view-special { max-width: 820px; }
  #view-special.wide { max-width: 760px; }
  #view-special .q-stack { height: calc(100vh - 160px); }
}
@media (min-width: 900px) and (max-height: 700px) { #view-special .q-stack { height: calc(100vh - 146px); } }
.marks { display: flex; gap: 6px; justify-content: center; }
.marks span { width: 22px; height: 22px; border-radius: 6px; background: var(--good); }
.marks span.bad { background: var(--bad); }
.mix-list, .weak-list { list-style: none; margin: 0; padding: 0; width: 100%; max-width: 520px; display: grid; gap: 2px; text-align: left; }
.mix-list { margin-top: 24px; counter-reset: q; }
.mix-list li, .weak-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 9px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; }
.mix-list li span, .weak-list li span { color: var(--muted); font-weight: 600; white-space: nowrap; }
.mix-list li b { text-align: right; }
.mix-list li.ok b { color: var(--good); }
.mix-list li.bad b { color: var(--bad); }
.stats { width: 100%; display: grid; gap: 14px; align-content: start; padding-top: 8px; }
.stats h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.stats h2 { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 10px 0 0; }
.stats .muted { color: var(--muted); margin: 0; font-size: 14px; }
.tiles-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tile-stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: grid; gap: 2px; }
.tile-stat b { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.tile-stat span { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat-rows { display: grid; gap: 2px; }
.stat-row { display: grid; grid-template-columns: 1fr 120px 130px 70px; align-items: center; gap: 14px; padding: 9px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 600; }
.stat-row:hover { background: var(--surface); }
.stat-row .sbar { height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.stat-row .sbar span { display: block; height: 100%; background: var(--accent); }
.stat-row .num, .stat-row .acc { color: var(--muted); text-align: right; font-size: 13px; }
@media (max-width: 640px) {
  .tiles-row { grid-template-columns: repeat(2, 1fr); }
  .stat-row { grid-template-columns: 1fr auto; }
  .stat-row .sbar, .stat-row .acc { display: none; }
}

/* Quiz: fast answers and best times */
.flash { font-size: 17px; font-weight: 700; text-align: center; }
.flash.bad { color: var(--bad); }
#qTime { color: var(--ink); font-variant-numeric: tabular-nums; min-width: 4.5em; text-align: right; }
.best-line { color: var(--muted); font-weight: 600; margin: 0; }
.best-line.new { color: var(--good); }
.quiz-time b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* Capital photos next to the answer map (Practice) */
.media { display: grid; gap: 12px; }
.cap-photo { position: relative; margin: 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--track); aspect-ratio: 16 / 10; }
.cap-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cap-photo.loading img { opacity: 0; }
.cap-photo.loading::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .25), transparent); animation: shimmer 1.2s infinite; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.cap-photo figcaption { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; padding: 22px 10px 8px; background: linear-gradient(transparent, rgba(0, 0, 0, .6)); color: #fff; font-size: 13px; }
.cap-photo figcaption b { font-size: 15px; }
.cap-photo figcaption a { color: rgba(255, 255, 255, .85); font-size: 11px; font-weight: 600; text-decoration: none; }
.cap-photo figcaption a:hover { text-decoration: underline; }
.cap-photo.loading figcaption { opacity: 0; }
@media (min-width: 900px) {
  .media { display: flex; flex: 1 1 0; min-height: 160px; }
  .media .map { flex: 1 1 0; min-width: 0; }
  .media .cap-photo { flex: 0 0 38%; aspect-ratio: auto; }
}

/* Odd one out (landlocked) */
.qname.odd-q { font-size: clamp(22px, 3.2vw, 30px); text-align: center; max-width: 640px; margin: 8px auto; }

.menu-all { display: block; margin-top: 6px; padding: 10px 12px 4px; border-top: 1px solid var(--line); font-size: 13px; font-weight: 700; color: var(--muted); text-decoration: none; }
.menu-all:hover { color: var(--ink); }
.share-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
