:root {
  /* Soft pastel palette */
  --bg: #f8f4f0;
  --blob-1: #ffe1d6; --blob-2: #e4e3ff; --blob-3: #d9f3ea;
  --surface: #fffdfb;
  --surface-2: #f3eef4;
  --ink: #3a3850;
  --ink-2: #6f6b85;
  --line: #ece6ef;
  --accent: #5b6ad8;
  --accent-soft: #e8eaff;
  --accent-ink: #ffffff;
  --good: #2f9a70;
  --good-bg: #e2f5ec;
  --bad: #d4645f;
  --bad-bg: #fde9e7;
  --warn: #f0a94f;
  --shadow: 0 2px 6px rgb(90 80 140 / .05), 0 12px 32px rgb(90 80 140 / .08);
  --shadow-lift: 0 4px 10px rgb(90 80 140 / .07), 0 18px 40px rgb(90 80 140 / .12);
  --radius: 24px;
  --gap: 14px;
  --t1: #ffe4d9; --t2: #e6e4ff; --t3: #dcf3e9; --t4: #fff1c9; --t5: #e0efff; --t6: #fde1ee; --t7: #e9f6d6; --t8: #efe2ff; --t9: #d9f1f6; --t10: #ffe6dc; --t11: #e4f2ff;
  --display: "Fredoka", "Nunito", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1a29; --blob-1: #3a2a3a; --blob-2: #2a2a4a; --blob-3: #1f3634;
    --surface: #26243a; --surface-2: #302e47; --ink: #eeedf7; --ink-2: #aeaac6; --line: #36344f;
    --accent: #8fa6ff; --accent-soft: #2e3558; --accent-ink: #171926; --good: #7fd8b0; --good-bg: #20393a; --bad: #f4a3a0; --bad-bg: #42283a; --warn: #f6c27d;
    --shadow: 0 2px 6px rgb(0 0 0 / .2), 0 12px 32px rgb(0 0 0 / .25); --shadow-lift: 0 4px 10px rgb(0 0 0 / .25), 0 18px 40px rgb(0 0 0 / .3);
    --t1: #3d2c36; --t2: #2f2d52; --t3: #24393a; --t4: #3c3527; --t5: #263449; --t6: #3c2a3e; --t7: #2c3a2a; --t8: #34294a; --t9: #213a40; --t10: #3d2e32; --t11: #25364a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1c1a29; --blob-1: #3a2a3a; --blob-2: #2a2a4a; --blob-3: #1f3634;
  --surface: #26243a; --surface-2: #302e47; --ink: #eeedf7; --ink-2: #aeaac6; --line: #36344f;
  --accent: #8fa6ff; --accent-soft: #2e3558; --accent-ink: #171926; --good: #7fd8b0; --good-bg: #20393a; --bad: #f4a3a0; --bad-bg: #42283a; --warn: #f6c27d;
  --shadow: 0 2px 6px rgb(0 0 0 / .2), 0 12px 32px rgb(0 0 0 / .25); --shadow-lift: 0 4px 10px rgb(0 0 0 / .25), 0 18px 40px rgb(0 0 0 / .3);
  --t1: #3d2c36; --t2: #2f2d52; --t3: #24393a; --t4: #3c3527; --t5: #263449; --t6: #3c2a3e; --t7: #2c3a2a; --t8: #34294a; --t9: #213a40; --t10: #3d2e32; --t11: #25364a;
  color-scheme: dark;
}

/* ── Fit-to-screen shell: the page never scrolls; content flexes to the viewport ── */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 16px/1.45 Nunito, system-ui, sans-serif; -webkit-font-smoothing: antialiased;
  height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { font-family: var(--display); line-height: 1.1; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
img.flag { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; box-shadow: 0 0 0 1px rgb(0 0 0 / .08); background: var(--surface-2); }

.topbar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px max(16px, calc((100vw - 1120px) / 2)); border-bottom: 1px solid var(--line); }
.brand { font-family: var(--display); font-weight: 800; font-size: 20px; text-decoration: none; display: flex; align-items: center; gap: 6px; }
.brand-sub { font-weight: 600; font-size: 13px; padding: 2px 8px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); }
.topnav { display: flex; align-items: center; gap: 4px; }
.topnav a { text-decoration: none; padding: 6px 12px; border-radius: 99px; font-weight: 600; color: var(--ink-2); }
.topnav a.active, .topnav a:hover { color: var(--ink); background: var(--surface-2); }
.icon-btn { border: 0; background: transparent; width: 36px; height: 36px; border-radius: 99px; font-size: 18px; flex: none; }
.icon-btn:hover { background: var(--surface-2); }

main { flex: 1; min-height: 0; width: 100%; max-width: 1120px; margin: 0 auto; padding: var(--gap) 16px; outline: none; display: flex; flex-direction: column; }
main > * { flex: 1; min-height: 0; }

/* ── Home ── */
.home { display: flex; flex-direction: column; gap: var(--gap); }
.hero { flex: none; display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; }
.hero h1 { font-size: clamp(28px, 4.6vh, 48px); font-weight: 800; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { color: var(--ink-2); font-size: 16px; margin-top: 6px; }
.ribbon { display: flex; gap: 5px; margin-top: 12px; }
.ribbon img.flag { width: 34px; flex: none; border-radius: 3px; }
.statbar { display: flex; gap: 8px; flex: none; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; min-width: 92px; }
.stat b { display: block; font-family: var(--display); font-size: 22px; line-height: 1.1; }
.stat b small { font-size: 13px; }
.stat span { color: var(--ink-2); font-size: 12px; }

.pool { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; }
.pool-label { font-weight: 700; margin-right: 4px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 4px 12px; font-size: 14px; font-weight: 600; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.pool-count { margin-left: auto; color: var(--ink-2); font-size: 14px; }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; }

.modes { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; gap: 12px; }
.mode { position: relative; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
  transition: transform .15s ease, border-color .15s ease; display: flex; flex-direction: column; gap: 4px; min-height: 0; overflow: hidden; }
.mode:hover { transform: translateY(-2px); border-color: var(--accent); }
.mode .ico { font-size: 26px; line-height: 1; }
.mode h3 { font-size: 19px; margin-top: 4px; }
.mode p { color: var(--ink-2); font-size: 14px; flex: 1; min-height: 0; overflow: hidden; }
.mode .meta { font-size: 11px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; }
.mode .badge { position: absolute; top: 12px; right: 12px; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); }
.mode.featured { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); background: linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--accent) 10%, var(--surface))); }

/* ── Game shell ── */
.game { width: 100%; max-width: 680px; margin: 0 auto; display: flex; flex-direction: column; }
.game-head { flex: none; display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.game-head .back { text-decoration: none; font-weight: 700; color: var(--ink-2); padding: 6px 8px; border-radius: 10px; white-space: nowrap; }
.game-head .back:hover { background: var(--surface-2); }
.game-head h2 { font-size: 21px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-head .row { flex-wrap: nowrap; gap: 6px; }
#stage { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pill { font-weight: 700; font-size: 14px; background: var(--surface); border: 1px solid var(--line); padding: 3px 10px; border-radius: 99px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pill.hot { background: var(--warn); color: #fff; border-color: var(--warn); }
.progress { flex: none; height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-bottom: 10px; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s ease; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
#stage > .card { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
#stage > .card > * { flex: none; }
.prompt { text-align: center; color: var(--ink-2); font-weight: 600; font-size: 15px; }
.prompt b { color: var(--ink); font-family: var(--display); font-size: clamp(22px, 3.6vh, 30px); display: block; margin-top: 2px; }

/* The big flag takes whatever height is left and keeps 4:3 */
#stage .big-flag { flex: 1 1 0; min-height: 70px; container-type: size; display: flex; align-items: center; justify-content: center; }
.fbox { position: relative; width: min(100cqw, 133.33cqh); aspect-ratio: 4 / 3; }
.fbox img.flag { width: 100%; height: 100%; border-radius: 10px; }
.zoom .fbox { overflow: hidden; border-radius: 10px; box-shadow: 0 0 0 1px rgb(0 0 0 / .08); }
.zoom img.flag { border-radius: 0; box-shadow: none; transition-property: transform; transition-timing-function: cubic-bezier(.3, 0, .2, 1); }
.timer-bar { height: 4px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.timer-bar > i { display: block; height: 100%; background: var(--warn); width: 100%; }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opt { position: relative; border: 2px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px 10px 10px 36px; font-weight: 600; text-align: left; min-height: 48px; line-height: 1.2; transition: background .12s, border-color .12s, transform .08s; }
.opt:hover:not(:disabled) { border-color: var(--accent); }
.opt:active:not(:disabled) { transform: scale(.98); }
.opt .k { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); font-size: 12px; display: grid; place-items: center; }
/* Country → flag: the option grid itself fills the card */
#stage > .card > .options.flags { flex: 1 1 0; min-height: 0; grid-auto-rows: 1fr; }
.opt.flag-opt { padding: 6px; container-type: size; display: flex; align-items: center; justify-content: center; min-height: 0; }
.opt.flag-opt img.flag { width: min(100cqw, 133.33cqh); }
.opt.flag-opt .k { left: 10px; top: 10px; transform: none; z-index: 1; background: var(--surface); }
.opt.right { border-color: var(--good); background: var(--good-bg); }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); animation: shake .3s; }
.opt:disabled { cursor: default; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.feedback { min-height: 52px; display: flex; align-items: center; gap: 10px; padding: 6px 12px; border-radius: 12px; font-size: 15px; line-height: 1.25; }
.feedback:empty { padding: 0; }
.feedback.good { background: var(--good-bg); }
.feedback.bad { background: var(--bad-bg); }
.feedback .mini { width: 48px; flex: none; }
.feedback .grow { flex: 1; min-width: 0; }
.feedback small { color: var(--ink-2); display: block; }
.btn { border: 0; border-radius: 12px; padding: 11px 18px; font-weight: 700; background: var(--accent); color: var(--accent-ink); text-decoration: none; white-space: nowrap; }
.btn.ghost { background: var(--surface-2); color: var(--ink); }
.btn.sm { padding: 8px 12px; font-size: 14px; }
.btn:hover { filter: brightness(1.05); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spread { justify-content: space-between; }
.muted { color: var(--ink-2); }
kbd { font: 700 12px Nunito, sans-serif; background: color-mix(in srgb, var(--surface) 25%, transparent); border: 1px solid color-mix(in srgb, currentColor 30%, transparent); padding: 0 5px; border-radius: 5px; }

/* Setup card (Classic) */
.setup { display: flex; flex-direction: column; gap: 10px; }
.setup h3 { font-size: 22px; }

/* Typing / autocomplete */
.ac { position: relative; }
.ac input, .text-input { width: 100%; font: 700 17px Nunito, sans-serif; padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); outline: none; }
.ac input:focus, .text-input:focus { border-color: var(--accent); }
/* Suggestions open upward so they never push the page taller */
.ac ul { position: absolute; left: 0; right: 0; bottom: calc(100% + 4px); z-index: 5; list-style: none; margin: 0; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); max-height: min(28vh, 220px); overflow: auto; }
.ac ul:empty { display: none; }
.ac li { padding: 8px 10px; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.ac li[aria-selected="true"], .ac li:hover { background: var(--surface-2); }
.ac li small { color: var(--ink-2); }
.text-input.ok { border-color: var(--good); background: var(--good-bg); }

/* Reveal tiles */
.tiles { position: absolute; inset: 0; display: grid; border-radius: 10px; overflow: hidden; }
.tiles i { background: var(--surface-2); border: 1px solid var(--surface); transition: opacity .35s ease, transform .35s ease; }
.tiles i:nth-child(odd) { background: color-mix(in srgb, var(--surface-2) 85%, var(--ink)); }
.tiles i.off { opacity: 0; transform: scale(.6); }

/* Twins */
.twins-compare { display: flex; justify-content: center; gap: 10px; }
.twins-compare figure { margin: 0; text-align: center; font-size: 12px; font-weight: 600; }
.twins-compare img.flag { width: auto; height: clamp(36px, 7vh, 64px); margin: 0 auto; }
.twins-compare figure.is-answer { color: var(--good); }
.twins-compare figcaption { margin-top: 2px; }
.tip { padding: 8px 12px; background: var(--surface-2); border-radius: 12px; font-size: 14px; line-height: 1.35; }
.tip::before { content: "💡 "; }

/* Daily */
.guesses { display: grid; gap: 4px; }
.guess { display: grid; grid-template-columns: 34px 1fr auto auto auto; gap: 10px; align-items: center; background: var(--surface-2); border-radius: 9px; padding: 0 10px; height: clamp(28px, 4.4vh, 38px); font-weight: 600; font-size: 14px; }
.guess img.flag { width: 30px; border-radius: 3px; }
.guess .arrow { font-size: 17px; width: 24px; text-align: center; }
.guess .pct { font-variant-numeric: tabular-nums; min-width: 42px; text-align: right; }
.guess.win { background: var(--good-bg); }
.guess.empty { background: transparent; border: 2px dashed var(--line); }
.guess .km { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.daily-note { text-align: center; font-size: 14px; }

/* Learn */
.boxes { flex: none; display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 10px; }
.boxes div { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--lvl); border-radius: 10px; padding: 3px; text-align: center; font-size: 11px; color: var(--ink-2); line-height: 1.2; }
.boxes b { display: block; font-size: 16px; color: var(--ink); font-family: var(--display); }
.lvl0 { --lvl: #9aa1b2; } .lvl1 { --lvl: #e35d5d; } .lvl2 { --lvl: #ec8f2f; } .lvl3 { --lvl: #e3c02a; } .lvl4 { --lvl: #7cc35a; } .lvl5 { --lvl: #1f9d55; }
.new-card { text-align: center; }
.new-card .tag { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.new-card h2 { font-size: clamp(22px, 4vh, 32px); }
.new-card .row { justify-content: center; }
.similar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; font-size: 12px; font-weight: 600; text-align: center; line-height: 1.2; }
.similar button { background: none; border: 0; padding: 0; }
.similar span { display: block; margin-top: 3px; }
.new-card .similar { grid-template-columns: repeat(3, minmax(0, 90px)); justify-content: center; }

/* End screen */
.end { text-align: center; }
.end .score { font-family: var(--display); font-size: clamp(40px, 8vh, 64px); font-weight: 800; line-height: 1; }
.end .best { color: var(--ink-2); }
.end .row { justify-content: center; }
#stage > .card > .missed { flex: 1 1 0; min-height: 0; overflow: auto; align-content: start; }
.missed { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 10px; text-align: center; font-size: 12px; font-weight: 600; }
.missed button { background: none; border: 0; padding: 0; }
.missed span { display: block; margin-top: 3px; line-height: 1.2; }

/* ── Atlas: header fixed, grid scrolls inside its own panel ── */
.atlas { display: flex; flex-direction: column; gap: 10px; }
.atlas > * { flex: none; }
.section-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.section-title h2 { font-size: 24px; }
.section-title p { color: var(--ink-2); font-size: 14px; }
.atlas-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.atlas-tools .text-input { flex: 1; min-width: 180px; padding: 8px 12px; font-size: 15px; }
.atlas-scroll { flex: 1 1 0; min-height: 0; overflow: auto; border-radius: 12px; }
.atlas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.atlas-item { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 7px; text-align: left; position: relative; }
.atlas-item:hover { border-color: var(--accent); }
.atlas-item span { display: block; font-size: 13px; font-weight: 600; margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.atlas-item .dot { position: absolute; top: 11px; right: 11px; width: 12px; height: 12px; border-radius: 99px; background: var(--lvl); box-shadow: 0 0 0 2px var(--surface); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--ink-2); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 99px; background: var(--lvl); margin-right: 5px; }
.conf-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.conf { display: grid; grid-template-columns: 40px auto 40px 1fr; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px 10px; font-size: 12px; font-weight: 600; text-align: left; line-height: 1.25; }
.conf em { font-style: normal; color: var(--ink-2); }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgb(10 12 20 / .5); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 20px; max-width: 520px; width: 100%; max-height: calc(100dvh - 32px); overflow: auto; padding: 44px 20px 20px; box-shadow: 0 20px 60px rgb(0 0 0 / .3); position: relative; }
.modal > img.flag { width: auto; height: min(26vh, 220px); margin: 0 auto; }
.modal .close { position: absolute; top: 8px; right: 8px; }
.modal h2 { font-size: 28px; margin: 10px 0 2px; }
.modal p { margin: 10px 0 6px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; margin: 8px 0; font-size: 14px; }
.facts dt { color: var(--ink-2); }
.facts dd { margin: 0; font-weight: 600; }
.colors { display: flex; height: 12px; border-radius: 99px; overflow: hidden; margin: 4px 0 10px; box-shadow: 0 0 0 1px var(--line); }
@keyframes fade { from { opacity: 0; } }

#toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 99px; font-weight: 600; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.pop { animation: pop .35s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }

/* ── Soft theme: pastel tints, round shapes, airy shadows instead of hard borders ── */
body {
  background:
    radial-gradient(40vmax 40vmax at 8% 0%, var(--blob-1), transparent 70%),
    radial-gradient(38vmax 38vmax at 100% 20%, var(--blob-2), transparent 70%),
    radial-gradient(42vmax 42vmax at 40% 110%, var(--blob-3), transparent 70%),
    var(--bg);
}
h1, h2, h3 { font-weight: 600; letter-spacing: 0; }
.hero h1, .end .score { font-weight: 700; }
img.flag { border-radius: 8px; box-shadow: 0 0 0 1px rgb(60 50 90 / .06), 0 3px 10px rgb(60 50 90 / .10); }
.fbox img.flag { border-radius: 16px; }
.zoom .fbox, .tiles { border-radius: 16px; }

.topbar { border-bottom: 0; }
.brand { font-weight: 600; }
.brand-sub { background: var(--accent-soft); color: var(--accent); font-family: Nunito, sans-serif; font-weight: 800; }
.topnav a { font-weight: 700; }
.topnav a.active { background: var(--surface); box-shadow: var(--shadow); }

.card, .mode, .pool, .stat, .atlas-item, .conf { border-color: transparent; }
.card { border-radius: 28px; }
.stat { border-radius: 18px; box-shadow: var(--shadow); }
.stat b { font-weight: 600; }
.pool { border-radius: 99px; box-shadow: var(--shadow); padding-inline: 16px; }
.chip { border-color: transparent; background: transparent; font-weight: 700; color: var(--ink-2); }
.chip:hover { background: var(--surface-2); }
.chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.toggle input, .atlas-tools input[type="checkbox"] { accent-color: var(--accent); }

/* Each mode gets its own pastel bubble */
.mode { border-radius: 26px; }
.mode:hover { transform: translateY(-3px); border-color: transparent; box-shadow: var(--shadow-lift); }
.mode:nth-child(1) { --tint: var(--t1); } .mode:nth-child(2) { --tint: var(--t2); } .mode:nth-child(3) { --tint: var(--t3); } .mode:nth-child(4) { --tint: var(--t4); }
.mode:nth-child(5) { --tint: var(--t5); } .mode:nth-child(6) { --tint: var(--t6); } .mode:nth-child(7) { --tint: var(--t7); } .mode:nth-child(8) { --tint: var(--t8); }
.mode .ico { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; background: var(--tint); font-size: 24px; flex: none; }
.mode h3 { font-weight: 600; }
.mode .meta { color: var(--ink-2); letter-spacing: .04em; }
.mode .badge { background: var(--accent-soft); color: var(--accent); font-weight: 800; }
.mode.featured { border-color: transparent; background: linear-gradient(150deg, var(--surface) 30%, var(--tint)); }

.game-head .back { border-radius: 99px; }
.pill { border-color: transparent; box-shadow: var(--shadow); font-weight: 800; }
.progress { height: 8px; background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.progress > i { background: linear-gradient(90deg, #a5b0ff, var(--accent)); }

.opt { border: 0; background: var(--surface-2); border-radius: 18px; font-weight: 700; box-shadow: inset 0 0 0 2px transparent; }
.opt:hover:not(:disabled) { background: var(--accent-soft); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
.opt .k { background: var(--surface); border-radius: 8px; }
.opt.right { background: var(--good-bg); box-shadow: inset 0 0 0 2px var(--good); }
.opt.wrong { background: var(--bad-bg); box-shadow: inset 0 0 0 2px var(--bad); }
.opt.flag-opt img.flag { border-radius: 10px; }

.feedback { border-radius: 18px; }
.btn { border-radius: 99px; font-weight: 800; box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 30%, transparent); }
.btn.ghost { box-shadow: none; }
.ac input, .text-input { border: 0; background: var(--surface-2); border-radius: 18px; box-shadow: inset 0 0 0 2px transparent; transition: box-shadow .15s, background .15s; }
.ac input:focus, .text-input:focus { background: var(--surface); box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 6px var(--accent-soft); }
.text-input.ok { background: var(--good-bg); box-shadow: inset 0 0 0 2px var(--good); }
.ac ul { border: 0; border-radius: 18px; box-shadow: var(--shadow-lift); }
.ac li { border-radius: 12px; }
.tiles i { background: var(--surface-2); border-color: var(--surface); }
.tiles i:nth-child(odd) { background: color-mix(in srgb, var(--surface-2) 70%, var(--accent-soft)); }
.timer-bar > i { background: linear-gradient(90deg, #ffc98a, var(--warn)); }
.tip { border-radius: 18px; background: color-mix(in srgb, var(--t4) 70%, var(--surface)); }
.guess { border-radius: 14px; }
.guess.empty { border: 2px dashed var(--line); }
.boxes div { border: 0; border-top: 0; box-shadow: var(--shadow); border-radius: 14px; position: relative; overflow: hidden; }
.boxes div::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--lvl); opacity: .8; }
.lvl0 { --lvl: #c3c0d4; } .lvl1 { --lvl: #f2a3a0; } .lvl2 { --lvl: #f7c08a; } .lvl3 { --lvl: #f2dc8a; } .lvl4 { --lvl: #a9dc95; } .lvl5 { --lvl: #6cc9a0; }
.new-card .tag { background: var(--accent-soft); padding: 3px 10px; border-radius: 99px; align-self: center; }
.atlas-item { border-radius: 18px; box-shadow: var(--shadow); }
.atlas-item:hover { box-shadow: var(--shadow-lift); }
.conf { border-radius: 18px; box-shadow: var(--shadow); }
.modal { border-radius: 30px; }
.modal-back { background: rgb(40 34 70 / .35); backdrop-filter: blur(4px); }
#toast { border-radius: 99px; box-shadow: var(--shadow-lift); }

.mode:nth-child(9) { --tint: var(--t9); }

/* ── Letter Roll: dice stage on top, card board fills the rest ── */
.roll-game { width: 100%; display: flex; flex-direction: column; gap: clamp(6px, 1.2vh, 12px); }
.roll-game > * { flex: none; }
.roll-game .game-head { margin-bottom: 0; }
.roll-ctrls select { font: 700 14px Nunito, sans-serif; color: var(--ink); background: var(--surface); border: 0; border-radius: 99px; padding: 8px 12px; box-shadow: var(--shadow); cursor: pointer; }
.roll-stage { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: clamp(10px, 2vw, 28px); padding-top: calc(var(--d) * .22); --d: clamp(60px, 13vh, 132px); }
.roll-stage .side { display: flex; align-items: center; gap: clamp(10px, 1.5vw, 18px); }
.roll-stage .side.l { justify-content: flex-end; } .roll-stage .side.r { justify-content: flex-start; }
.cap { max-width: 230px; font-weight: 700; font-size: clamp(13px, 1.3vw, 16px); line-height: 1.25; color: var(--ink-2); }
.cap b { display: block; font: 600 clamp(16px, 1.8vw, 22px)/1.1 var(--display); color: var(--ink); }
.side.l .cap { text-align: right; }
.die { position: relative; width: var(--d); height: var(--d); border: 0; padding: 0; border-radius: 28%; display: grid; place-items: center; color: #fff; cursor: pointer;
  font: 600 calc(var(--d) * .58)/1 var(--display); text-shadow: 0 2px 0 rgb(0 0 0 / .12); transition: transform .15s; }
.die:hover { transform: translateY(-2px) rotate(-2deg); }
.die.ok { background: linear-gradient(160deg, #9be8c3, #45bf8b); box-shadow: 0 calc(var(--d) * .05) 0 #33a072, 0 14px 30px rgb(69 191 139 / .3); }
.die.bad { background: linear-gradient(160deg, #ffb8b0, #ec7a72); box-shadow: 0 calc(var(--d) * .05) 0 #cf5f58, 0 14px 30px rgb(236 122 114 / .3); }
.die .ic { position: absolute; top: calc(var(--d) * -.2); left: 50%; transform: translateX(-50%); width: calc(var(--d) * .4); height: calc(var(--d) * .4); border-radius: 50%;
  display: grid; place-items: center; background: var(--surface); box-shadow: var(--shadow); }
.die.ok .ic { color: #33a072; } .die.bad .ic { color: #d4645f; }
.die .ic svg { width: 58%; height: 58%; }
.die.spin { animation: dieShake .14s infinite; }
.die.hit { animation: shake .3s; }
@keyframes dieShake { 50% { transform: translateY(-4px) rotate(-4deg); } }
.rule { display: flex; flex-direction: column; align-items: center; gap: 2px; width: clamp(130px, 19vw, 240px); padding: clamp(8px, 1.4vh, 14px) 10px; border: 0; border-radius: 22px; text-align: center; cursor: pointer;
  background: color-mix(in srgb, var(--t4) 75%, var(--surface)); box-shadow: var(--shadow); transition: transform .15s; }
.rule:hover { transform: translateY(-2px); }
.rule .rl { font: 800 12px Nunito, sans-serif; color: #b07a1c; letter-spacing: .04em; text-transform: uppercase; }
.rule .rt { font: 600 clamp(15px, 1.9vw, 24px)/1.1 var(--display); color: var(--ink); text-wrap: balance; }
.rule .rt i { font-style: normal; color: var(--accent); }
.rule small { font: 700 clamp(11px, 1vw, 13px) Nunito, sans-serif; color: var(--ink-2); }
.rule.spin .rt { opacity: .35; }
.roll-bar { display: flex; align-items: center; justify-content: center; gap: 10px; }
.roll-ac { width: min(100%, 420px); }
.roll-ac input { padding: 9px 14px; font-size: 16px; }
.roll-ac ul { bottom: auto; top: calc(100% + 4px); z-index: 20; }
.board { flex: 1 1 0 !important; min-height: 0; position: relative; }
.cards { position: absolute; inset: 0; display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: var(--g, 10px); }
.rcard { width: var(--w); perspective: 900px; border: 0; background: none; padding: 0; cursor: pointer; border-radius: 16px; animation: pop .35s cubic-bezier(.3, 1.6, .5, 1) both; }
.rcard .inner { display: block; position: relative; width: 100%; aspect-ratio: 4 / 3.95; transition: transform .5s cubic-bezier(.3, 1.4, .5, 1); transform-style: preserve-3d; }
.rcard.open .inner { transform: rotateY(180deg); }
.rcard .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.rcard .front { align-items: center; justify-content: center; gap: 4%;
  background: repeating-linear-gradient(135deg, var(--surface) 0 10px, color-mix(in srgb, var(--surface) 55%, var(--accent-soft)) 10px 20px); }
.rcard .front .q { font: 600 calc(var(--w) * .34)/1 var(--display); color: var(--accent); }
.rcard .front .n { font: 800 max(10px, calc(var(--w) * .09)) Nunito, sans-serif; color: var(--ink-2); }
.rcard .back { transform: rotateY(180deg); background: var(--surface); }
.rcard .back img.flag { border-radius: 0; box-shadow: none; }
.rcard .back span { flex: 1; display: grid; place-items: center; padding: 1px 4px; font: 800 clamp(10px, calc(var(--w) * .1), 15px)/1.05 Nunito, sans-serif; text-align: center; text-wrap: balance; overflow: hidden; }
.rcard.found .back { box-shadow: inset 0 0 0 3px var(--good), var(--shadow); }
.rcard.found .back span { color: var(--good); }
.rcard.given .back span { color: var(--ink-2); }
.rcard:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.board .empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--ink-2); font-weight: 700; font-size: 15px; line-height: 1.6; }
.board .empty b { display: block; font: 600 clamp(26px, 4vw, 42px) var(--display); color: var(--ink); margin-bottom: 6px; }
.letter-picker .ls { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.letter-picker .ls button { border: 0; border-radius: 14px; background: var(--surface-2); font: 600 22px var(--display); padding: 8px 0; }
.letter-picker .ls button:hover { background: var(--accent-soft); }
.letter-picker .ls button.cur { background: var(--accent); color: var(--accent-ink); }
.letter-picker h2 { margin-top: 0; }

/* ── Responsive: tighten as space runs out ── */
@media (max-width: 900px) {
  .modes { grid-template-columns: repeat(3, 1fr); }
  .hero { flex-direction: column; align-items: stretch; gap: 10px; }
  .statbar .stat { flex: 1; min-width: 0; }
}
@media (max-width: 600px) {
  :root { --gap: 10px; }
  .topbar { padding: 8px 12px; }
  .brand { font-size: 18px; }
  .brand-sub, .ribbon, .hero p { display: none; }
  main { padding: var(--gap) 12px; }
  .stat { padding: 5px 8px; }
  .stat b { font-size: 18px; }
  .pool { padding: 6px 8px; gap: 4px; }
  .pool-label { display: none; }
  .chip { padding: 3px 9px; font-size: 13px; }
  .toggle, .pool-count { font-size: 13px; }
  .mode { padding: 12px; }
  .modes .mode p { display: none; }
  .mode h3 { font-size: 17px; }
  .card { padding: 12px; }
  #stage > .card { gap: 8px; }
  .opt { padding: 8px 8px 8px 10px; font-size: 15px; min-height: 44px; }
  .opt .k { display: none; }
  .opt.flag-opt .k { display: none; }
  .game-head h2 { font-size: 18px; }
  .game-head .back { padding: 6px 2px; }
  .guess { grid-template-columns: 30px 1fr auto auto; gap: 8px; font-size: 13px; }
  .guess .km { display: none; }
  .boxes { gap: 4px; }
  .boxes div { font-size: 10px; }
  .feedback { font-size: 14px; min-height: 48px; }
  .similar { grid-template-columns: repeat(2, 1fr); }
  .conf-list { display: none; }
  kbd { display: none; }
}
@media (max-height: 760px) {
  .ribbon { display: none; }
  .mode p { -webkit-line-clamp: 2; display: -webkit-box; -webkit-box-orient: vertical; }
  .hero h1 { font-size: 30px; }
}
@media (max-height: 620px) {
  .hero p, .mode p, .statbar { display: none; }
  .mode { flex-direction: row; align-items: center; gap: 10px; padding: 10px; }
  .mode h3 { margin: 0; flex: 1; }
  .mode .meta { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Phone: 3×3 icon tiles on home; compact Letter Roll header and stage */
@media (max-width: 700px) {
  .cap { display: none; }
  .roll-stage .side { justify-content: center !important; }
}
@media (max-width: 600px) {
  .modes { gap: 8px; }
  .mode { align-items: center; justify-content: center; text-align: center; padding: 8px; gap: 6px; }
  .mode .meta { display: none; }
  .mode h3 { font-size: 15px; margin: 0; }
  .mode .badge { top: 6px; right: 6px; font-size: 10px; padding: 2px 6px; }
  .roll-game .game-head h2 { display: none; }
  .roll-game .game-head { justify-content: space-between; }
  .roll-ctrls select { padding: 7px 8px; font-size: 13px; }
  .roll-ctrls .btn.sm { padding: 7px 10px; }
  .roll-stage { --d: clamp(54px, 10vh, 90px); }
  .rule { width: auto; min-width: 120px; }
  .roll-bar { gap: 6px; }
  .roll-bar .pill { padding: 3px 7px; font-size: 13px; }
}

/* Wider screens: mode cards lay out icon-left so the 3×3 grid stays readable */
@media (min-width: 601px) {
  .mode { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto auto; align-content: center; column-gap: 14px; row-gap: 2px; }
  .mode .ico { grid-row: 1 / 4; align-self: center; width: clamp(44px, 7vh, 60px); height: clamp(44px, 7vh, 60px); font-size: clamp(22px, 3.4vh, 30px); }
  .mode h3 { margin: 0; padding-right: 44px; }
  .mode p { flex: none; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
  .mode .meta { margin-top: 2px; }
}
@media (min-width: 601px) and (max-height: 700px) { .mode p { -webkit-line-clamp: 1; } }
@media (min-width: 601px) and (max-height: 620px) { .mode p, .mode .meta { display: none; } }

/* ── Shapes: soft land silhouettes with a gold star on the capital ── */
:root { --land: #8f9cf4; --land-2: #aeb8fb; --star: #ffbf3c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --land: #9aa5ff; --land-2: #7c88e8; --star: #ffcf5c; } }
:root[data-theme="dark"] { --land: #9aa5ff; --land-2: #7c88e8; --star: #ffcf5c; }
svg.shape { display: block; width: 100%; aspect-ratio: 4 / 3; overflow: visible; }
svg.shape path { fill: var(--land); fill-rule: evenodd; stroke: color-mix(in srgb, var(--land) 70%, #3a3850); stroke-width: 1; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
svg.shape .cap-star { fill: var(--star); stroke: #fff; stroke-width: 3; paint-order: stroke; stroke-linejoin: round; filter: drop-shadow(0 1px 2px rgb(60 40 0 / .35)); }
.fbox svg.shape { width: 100%; height: 100%; }
.opt.flag-opt svg.shape { width: min(100cqw, 133.33cqh); }
.ribbon.shapes svg.shape { width: 46px; flex: none; }
.ribbon.shapes svg.shape .cap-star { stroke-width: 6; }
.inline-flag { display: inline-block !important; width: 1.4em !important; vertical-align: -0.12em; margin-right: 8px; border-radius: 4px !important; }
.hunt svg.shape { cursor: crosshair; }
.hunt svg.shape:hover path { fill: var(--land-2); }
.hunt-guess { fill: var(--bad); stroke: #fff; stroke-width: 3; paint-order: stroke; }
.hunt-line { stroke: var(--ink-2); stroke-width: 2.5; stroke-dasharray: 6 5; stroke-linecap: round; }
.pop-star { transform-box: fill-box; transform-origin: center; animation: pop .45s cubic-bezier(.3, 1.6, .5, 1); }
.prompt .muted { display: block; font-size: 14px; font-weight: 600; }
.modal-visuals { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: center; }
.modal > .modal-visuals img.flag { width: 100%; height: auto; margin: 0; }
.modal-shape { margin: 0; text-align: center; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.modal-shape figcaption { margin-top: 2px; }
.seg { display: inline-flex; gap: 2px; background: var(--surface); border-radius: 99px; padding: 3px; box-shadow: var(--shadow); }
.seg .chip { text-decoration: none; }
.modes.modes-6 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 600px) { .modes.modes-6 { grid-template-columns: repeat(2, 1fr); } }

/* ── Emoji: four clues on a soft pastel card, scaling with whatever box holds it ── */
.emoji-card { width: 100%; aspect-ratio: 4 / 3; container-type: size; display: grid; grid-template-columns: repeat(2, auto); place-content: center; gap: 0;
  border-radius: 16px; background: linear-gradient(150deg, color-mix(in srgb, var(--t2) 75%, var(--surface)), color-mix(in srgb, var(--t1) 65%, var(--surface))); }
.emoji-card span { font-size: min(32cqh, 23cqw); padding: 2.5cqh 5cqw; line-height: 1.05; text-align: center; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.fbox .emoji-card { height: 100%; aspect-ratio: auto; }
.mini .emoji-card, .atlas-item .emoji-card, .conf .emoji-card, .similar .emoji-card { border-radius: 8px; }
.ribbon.emojis { gap: 8px; }
.rib-emoji { font-size: 26px; line-height: 1; }
.modal-emoji { font-size: 34px; text-align: center; letter-spacing: 6px; margin: 4px 0 8px; }

/* emoji spans must not inherit the label styles of the boxes they sit in (atlas, missed, similar…) */
.emoji-card > span { display: block; margin: 0; overflow: visible; white-space: normal; text-overflow: clip; font-weight: 400; color: inherit; }

/* Phones: four section tabs must fit — logo only, compact tabs */
@media (max-width: 600px) {
  .topbar { gap: 6px; }
  .brand-name { display: none; }
  .topnav { gap: 0; }
  .topnav a { padding: 6px 9px; font-size: 14px; }
  .icon-btn { width: 32px; height: 32px; font-size: 16px; }
}
@media (max-width: 340px) { .topnav a { padding: 5px 6px; font-size: 13px; } }
@media (max-width: 600px) {
  .roll-game .game-head { gap: 4px; }
  .roll-ctrls { gap: 4px; }
  .roll-ctrls select { max-width: 112px; padding: 6px 6px; }
  .roll-ctrls .btn.sm { padding: 6px 9px; font-size: 13px; }
  .roll-game .game-head .back { padding: 6px 0; }
}
@media (max-width: 359px) { .roll-ctrls .fs-btn { display: none; } }

/* ── Last Flag Standing: clue on top, board of flags fills the card ── */
.lfs-clue { text-align: center; display: flex; flex-direction: column; gap: 2px; min-height: 64px; justify-content: center; }
.lfs-clue b { font: 600 clamp(19px, 3.2vh, 28px)/1.15 var(--display); color: var(--ink); }
.lfs-clue .muted { font-size: 13px; font-weight: 700; }
#stage > .card > .lfs-board { flex: 1 1 0; min-height: 0; display: grid; grid-auto-rows: 1fr; gap: clamp(4px, 1vh, 10px); }
.lfs-flag { container-type: size; display: flex; align-items: center; justify-content: center; border: 0; background: none; padding: 2px; min-height: 0; cursor: pointer; position: relative; border-radius: 10px; }
.lfs-flag img.flag { width: min(100cqw, 133.33cqh); transition: opacity .45s, filter .45s, transform .45s; }
.lfs-flag:hover:not(.out) img.flag { transform: translateY(-2px); box-shadow: 0 0 0 3px var(--accent-soft), 0 6px 16px rgb(60 50 90 / .18); }
.lfs-flag.out { cursor: default; }
.lfs-flag.out img.flag { opacity: .14; filter: grayscale(1); transform: scale(.88); }
.lfs-flag.out::after { content: "✕"; position: absolute; inset: 0; display: grid; place-items: center; font-size: min(46cqh, 30cqw); color: var(--ink-2); opacity: .45; }
.lfs-flag.wrong::after { color: var(--bad); opacity: .9; }
.lfs-flag.last img.flag { animation: pulse 1.1s ease-in-out infinite; }
.lfs-flag.win img.flag { opacity: 1; filter: none; transform: scale(1.04); box-shadow: 0 0 0 4px var(--good), 0 8px 22px rgb(47 154 112 / .35); animation: none; }
.lfs-flag.win::after { content: none; }
@keyframes pulse { 50% { transform: scale(1.06); box-shadow: 0 0 0 4px var(--accent-soft); } }
.lfs-ctrl { justify-content: center; }
/* Flags home has 10 modes: 5×2 on wide screens, 2 columns below */
.modes.modes-10 { grid-template-columns: repeat(5, 1fr); }
.modes.modes-10 .mode { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.modes.modes-10 .mode h3 { padding-right: 0; }
@media (max-width: 1000px) { .modes.modes-10 { grid-template-columns: repeat(2, 1fr); } .modes.modes-10 .mode { flex-direction: row; align-items: center; } .modes.modes-10 .mode p { display: none; } }
@media (max-width: 600px) { .modes.modes-10 .mode { flex-direction: column; justify-content: center; align-items: center; } .modes.modes-10 .mode .meta { display: none; } }
@media (max-width: 600px) {
  .modes.modes-10 { gap: 6px; }
  .modes.modes-10 .mode { flex-direction: row; justify-content: flex-start; align-items: center; text-align: left; gap: 8px; padding: 6px 10px; }
  .modes.modes-10 .mode .ico { width: 34px; height: 34px; font-size: 18px; border-radius: 11px; flex: none; }
  .modes.modes-10 .mode h3 { font-size: 14px; line-height: 1.15; }
  .modes.modes-10 .mode .badge { top: 4px; right: 4px; }
}

/* ── Regions: country picker + interactive region map ── */
.rg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.rg-card { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 10px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); text-decoration: none; }
.rg-card:hover { box-shadow: var(--shadow-lift); }
.rg-card img.flag { width: 54px; }
.rg-card .rg-name { font-weight: 800; line-height: 1.15; }
.rg-card .muted { font-size: 12px; }
.rg-card .badge { position: absolute; top: 10px; right: 10px; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.rg-continue { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); text-decoration: none; max-width: 360px; }
.rg-continue img.flag { width: 46px; }
.rg-continue small { display: block; color: var(--ink-2); font-size: 12px; }
.rg-continue span:nth-child(2) { flex: 1; }
.game.rg-game { max-width: 980px; }
.rg-modes { flex: none; display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.rg-modes .chip { text-decoration: none; background: var(--surface); box-shadow: var(--shadow); }
.rg-credit { flex: none; font-size: 10px; color: var(--ink-2); text-align: right; margin-top: 4px; opacity: .8; }
.rg-map { display: block; width: 100%; height: 100%; }
.rg-map .rg { stroke: var(--surface); stroke-width: 1.4; stroke-linejoin: round; vector-effect: non-scaling-stroke; cursor: pointer; transition: fill .2s; }
.rg-map .c0 { fill: var(--t1); } .rg-map .c1 { fill: var(--t2); } .rg-map .c2 { fill: var(--t3); } .rg-map .c3 { fill: var(--t4); }
.rg-map .c4 { fill: var(--t5); } .rg-map .c5 { fill: var(--t6); } .rg-map .c6 { fill: var(--t7); } .rg-map .c7 { fill: var(--t8); }
.rg-map .rg { filter: saturate(1.6) brightness(.97); }
.rg-map .rg.plain { fill: color-mix(in srgb, var(--land) 32%, var(--surface)); filter: none; stroke: var(--surface); }
.rg-map .rg:hover { fill: color-mix(in srgb, var(--land) 60%, var(--surface)); }
.rg-map .rg.sel, .rg-map .rg.target { fill: var(--accent); }
.rg-map .rg.target { animation: rgpulse 1.2s ease-in-out infinite; }
.rg-map .rg.ok { fill: #7fd3a9; } .rg-map .rg.late { fill: #f6cf7f; } .rg-map .rg.bad { fill: #f19d98; }
.rg-map .rg.hint { fill: #f6cf7f; animation: rgpulse .9s ease-in-out infinite; }
.rg-map .rg-dot { stroke: var(--ink-2); stroke-width: 1.5; }
.rg-map .rg-inset { fill: color-mix(in srgb, var(--surface) 70%, transparent); stroke: var(--line); stroke-width: 2; stroke-dasharray: 8 6; }
.rg-map .cap-star { pointer-events: none; fill: var(--star); stroke: #fff; stroke-width: 3; paint-order: stroke; }
.rg-map .rg-lab, .rg-map .rg-tip { font: 700 15px Nunito, sans-serif; text-anchor: middle; dominant-baseline: middle; fill: var(--ink); stroke: var(--surface); stroke-width: 4px; paint-order: stroke; pointer-events: none; }
.rg-map .rg-lab.bad { fill: var(--bad); }
.rg-map .rg-tip { font-size: 18px; }
@keyframes rgpulse { 50% { opacity: .55; } }
.rg-info { min-height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.rg-info b { font: 600 clamp(18px, 3vh, 26px) var(--display); }
.rg-typerow { flex-wrap: nowrap; }
.rg-typerow .text-input { flex: 1; }
@media (max-width: 600px) {
  .rg-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .rg-modes .chip { padding: 4px 9px; font-size: 13px; }
  .topnav a { padding: 6px 7px; font-size: 13px; }
}
@media (max-width: 360px) { .topnav a { padding: 5px 5px; font-size: 12.5px; } .icon-btn { width: 28px; } }
@media (max-width: 600px) { .rg-game .options { grid-template-columns: 1fr 1fr; } .rg-game .opt { font-size: 13.5px; } }

/* ── Hub Upgrade: scalable topbar, Hub dashboard, Capitals, Daily Suite, Settings ── */
.mode:nth-child(10) { --tint: var(--t10); }
.mode:nth-child(11) { --tint: var(--t11); }
a.mode { text-decoration: none; }

.top-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.topbar .topnav { flex: 1; justify-content: center; }

@media (max-width: 820px) {
  .topbar { flex-wrap: wrap; row-gap: 6px; padding: 8px 12px; }
  .topbar .brand { order: 1; }
  .topbar .top-actions { order: 2; }
  .topbar .topnav {
    order: 3; flex: 1 0 100%; justify-content: flex-start;
    overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    padding-bottom: 2px; gap: 4px;
  }
  .topbar .topnav::-webkit-scrollbar { display: none; }
  .topbar .topnav a { white-space: nowrap; flex: none; padding: 5px 11px; font-size: 13.5px; }
  .brand-name { display: inline !important; }
  .brand-sub { display: inline-block !important; }
}

/* Hub Command Center */
.stat-link { text-decoration: none; transition: transform .15s ease, box-shadow .15s ease; }
.stat-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.stat-link span { color: var(--accent); font-weight: 700; }

.daily-strip {
  flex: none; background: var(--surface); border-radius: 24px; padding: 12px 14px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px;
}
.daily-strip-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; }
.daily-strip-head b { font-family: var(--display); font-size: 16px; }
.daily-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.daily-card {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 16px;
  background: var(--surface-2); text-decoration: none; transition: transform .14s ease, background .14s ease;
}
.daily-card:hover { transform: translateY(-2px); background: var(--accent-soft); }
.daily-card.won { background: var(--good-bg); }
.daily-card.lost { background: var(--bad-bg); }
.dc-ico { font-size: 22px; line-height: 1; flex: none; }
.dc-body { min-width: 0; }
.dc-body b { display: block; font-size: 14px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dc-body small { display: block; font-size: 12px; color: var(--ink-2); font-weight: 700; }
.daily-card.won .dc-body small { color: var(--good); }
.daily-card.lost .dc-body small { color: var(--bad); }

.modes.hub-grid { grid-template-columns: repeat(3, 1fr); }
.hub-card .hub-foot { margin-top: auto; display: flex; flex-direction: column; gap: 5px; }
.mini-bar { height: 5px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.mini-bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #a5b0ff, var(--accent)); transition: width .35s ease; }

/* Balanced section grids (4×3 for Flags 11 modes with Daily span-2; 4×2 for Capitals/Shapes/Emoji) */
.modes.modes-11, .modes.modes-8 { grid-template-columns: repeat(4, 1fr); }
.modes.modes-11 .mode.span-2, .modes.modes-8 .mode.span-2 { grid-column: span 2; }
@media (max-width: 1020px) {
  .modes.modes-11, .modes.modes-8 { grid-template-columns: repeat(2, 1fr); }
  .modes.modes-11 .mode.span-2, .modes.modes-8 .mode.span-2 { grid-column: span 2; }
}
@media (max-width: 720px) {
  .daily-cards { grid-template-columns: repeat(2, 1fr); }
  .modes.hub-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .hub-card { display: flex !important; flex-direction: column; align-items: flex-start; justify-content: space-between; text-align: left; padding: 12px; }
  .hub-card .ico { width: 38px; height: 38px; font-size: 20px; border-radius: 12px; }
  .hub-card h3 { font-size: 16px; margin-top: 4px; padding-right: 0; }
  .hub-card p { display: none !important; }
  .hub-card .hub-foot { width: 100%; }
  .hub-card .meta { display: block !important; font-size: 11px; }
  .daily-strip { padding: 10px 12px; }
  .daily-card { padding: 7px 10px; }
}
@media (max-width: 600px) {
  .modes.modes-11, .modes.modes-8 { gap: 6px; }
  .modes.modes-11 .mode, .modes.modes-8 .mode {
    display: flex; flex-direction: row; justify-content: flex-start; align-items: center;
    text-align: left; gap: 8px; padding: 8px 10px;
  }
  .modes.modes-11 .mode .ico, .modes.modes-8 .mode .ico { width: 34px; height: 34px; font-size: 18px; border-radius: 11px; flex: none; }
  .modes.modes-11 .mode h3, .modes.modes-8 .mode h3 { font-size: 14px; line-height: 1.15; padding-right: 0; }
  .modes.modes-11 .mode .badge, .modes.modes-8 .mode .badge { top: 4px; right: 6px; }
}
@media (max-height: 700px) {
  .hub .daily-strip { padding: 8px 12px; gap: 6px; }
  .hub .daily-card { padding: 6px 10px; }
}

/* Study deck preset selector inside .pool */
.pool-preset {
  font: 700 13.5px Nunito, sans-serif; color: var(--ink); background: var(--surface-2);
  border: 0; border-radius: 99px; padding: 4px 12px; cursor: pointer;
}
.pool-preset:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Capitals visual cards, Daily Capital mask, Ribbon, Atlas subtitle */
.cap-card {
  width: 100%; height: 100%; border-radius: 16px; container-type: size;
  background: linear-gradient(150deg, color-mix(in srgb, var(--t4) 70%, var(--surface)), color-mix(in srgb, var(--t5) 70%, var(--surface)));
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 16px; text-align: center; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 6%, transparent);
}
.cap-card .cap-pill {
  font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 12px; border-radius: 99px; background: var(--surface); color: var(--accent); box-shadow: var(--shadow);
}
.cap-card .cap-name { font-family: var(--display); font-weight: 700; color: var(--ink); line-height: 1.1; text-wrap: balance; }
.cap-card .cap-name.lg { font-size: clamp(24px, 16cqh, 46px); }
.cap-card .cap-name.md { font-size: clamp(20px, 13cqh, 36px); }
.cap-card .cap-name.sm { font-size: clamp(16px, 10cqh, 28px); }
.cap-card.is-country { padding: 12px; gap: 6px; background: var(--surface-2); }
.cap-card.is-country img.flag { width: auto; height: 70%; max-width: 85%; border-radius: 12px; }
.cap-card.is-country .cap-country { font-family: var(--display); font-weight: 600; font-size: clamp(15px, 9cqh, 22px); color: var(--ink); }
.cap-mask { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; max-width: 92%; }
.cap-ch {
  min-width: 24px; height: 34px; padding: 0 5px; border-radius: 9px;
  display: grid; place-items: center; font: 700 20px var(--display);
  background: var(--surface); color: var(--ink-2); box-shadow: var(--shadow);
}
.cap-ch.open { background: var(--accent); color: var(--accent-ink); }
.cap-ch.punct { background: transparent; box-shadow: none; min-width: 10px; color: var(--ink); }
.cap-sp { width: 14px; }
.ribbon.capitals { flex-wrap: nowrap; overflow: hidden; gap: 6px; }
.rib-cap {
  flex: none; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px;
  background: var(--surface); color: var(--ink-2); box-shadow: var(--shadow); white-space: nowrap;
}
.atlas-sub { display: block; font-size: 11px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.missed span small { display: block; font-size: 11px; color: var(--ink-2); font-weight: 600; }

/* Daily Switcher Tabs */
.daily-tabs { flex: none; display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.daily-tabs .chip { text-decoration: none; background: var(--surface); box-shadow: var(--shadow); }
.daily-tabs .chip.won:not([aria-pressed="true"]) { background: var(--good-bg); color: var(--good); }
.daily-tabs .chip.lost:not([aria-pressed="true"]) { background: var(--bad-bg); color: var(--bad); }

/* Unified Country Modal Mastery & Regions CTA */
.modal-mastery { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 6px; }
.mpill {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2);
}
.mpill i { width: 8px; height: 8px; border-radius: 99px; background: var(--lvl); }
.mpill b { color: var(--ink); }
.modal-rg-link {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; margin: 10px 0; border-radius: 16px; text-decoration: none;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 14px;
  transition: transform .12s ease;
}
.modal-rg-link:hover { transform: translateY(-1px); }

/* Settings & Backup Modal */
.settings-modal { display: flex; flex-direction: column; gap: 14px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; background: var(--surface-2); border-radius: 16px; }
.set-row small { display: block; font-size: 12.5px; }
.set-block { padding: 12px 14px; background: var(--surface-2); border-radius: 16px; }
.set-block.danger { background: color-mix(in srgb, var(--bad-bg) 55%, var(--surface-2)); }
.set-stats { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 6px; font-size: 13.5px; color: var(--ink-2); }
.set-stats b { color: var(--ink); }
.reset-btn.armed { background: var(--bad); color: #fff; }

/* ── Daily 6 responsive grid ── */
.daily-cards.daily-cards-6 { grid-template-columns: repeat(6, 1fr); }
@media (max-width: 960px) { .daily-cards.daily-cards-6 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) {
  .daily-cards.daily-cards-6 { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .daily-cards.daily-cards-6 .daily-card { padding: 6px 8px; gap: 7px; }
  .daily-cards.daily-cards-6 .dc-ico { font-size: 18px; }
}

/* ── Interactive World Map & Borders ── */
:root { --ocean: #e4f1fb; --map-land: #e6e3f0; --map-bg: #d9d6e4; --map-stroke: #ffffff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --ocean: #172236; --map-land: #353652; --map-bg: #292a42; --map-stroke: #1e2034; }
}
:root[data-theme="dark"] { --ocean: #172236; --map-land: #353652; --map-bg: #292a42; --map-stroke: #1e2034; }

.game.wm-game { max-width: 1020px; }
.wm-card { gap: 8px !important; }
.wm-regbar { flex: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-bottom: 6px; }
.wm-regbar .chip { background: var(--surface); box-shadow: var(--shadow); }
.wm-stage { flex: 1 1 0 !important; min-height: 160px; position: relative; display: flex; }
.wm-box {
  position: relative; width: 100%; height: 100%; border-radius: 18px; overflow: hidden;
  background: var(--ocean); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 8%, transparent);
  touch-action: none; user-select: none;
}
.wm-svg { display: block; width: 100%; height: 100%; cursor: grab; }
.wm-svg:active { cursor: grabbing; }
.wm-ocean { fill: var(--ocean); }
.wm-bg { fill: var(--map-bg); stroke: var(--map-stroke); stroke-width: var(--wm-sw, 0.6); stroke-linejoin: round; opacity: .7; pointer-events: none; }
.wm-c {
  fill: var(--map-land); stroke: var(--map-stroke); stroke-width: var(--wm-sw, 0.6);
  stroke-linejoin: round; cursor: pointer; transition: fill .16s ease, opacity .16s ease;
}
.wm-c:hover { filter: brightness(.92); }
.wm-c.dim { fill: var(--map-bg); opacity: .45; cursor: default; pointer-events: none; }
.wm-dot { stroke: var(--map-stroke); stroke-width: var(--wm-sw, 0.7); }

/* Map quiz & Travle states */
.wm-c.wm-target { fill: var(--accent); animation: rgpulse 1.1s ease-in-out infinite; }
.wm-c.wm-ok { fill: #44b885; }
.wm-c.wm-late { fill: #f3c669; }
.wm-c.wm-bad { fill: #e6736e; }
.wm-c.wm-hint { fill: #f3c669; animation: rgpulse .85s ease-in-out infinite; }
.wm-c.tr-start { fill: var(--accent); }
.wm-c.tr-end { fill: #f0a94f; }
.wm-c.tr-good { fill: #44b885; }
.wm-c.tr-ok { fill: #f3c669; }
.wm-c.tr-far { fill: #e68d85; }
.wm-c.tr-win { fill: #2f9a70; }

.wm-lab {
  font: 800 var(--wm-fs, 10px) Nunito, sans-serif; text-anchor: middle; dominant-baseline: middle;
  fill: var(--ink); stroke: var(--surface); stroke-width: 2.2px; paint-order: stroke;
  pointer-events: none;
}
.wm-lab.bad { fill: var(--bad); }
.wm-lab.win, .wm-lab.tr-lab { font-weight: 800; }

.wm-tip {
  position: absolute; pointer-events: none; transform: translate(-50%, -100%);
  background: var(--ink); color: var(--bg); font-size: 12.5px; font-weight: 700;
  padding: 3px 10px; border-radius: 99px; white-space: nowrap; opacity: 0;
  transition: opacity .1s ease; box-shadow: var(--shadow); z-index: 4;
}
.wm-tip.show { opacity: 1; }

.wm-ctrls {
  position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 4px; z-index: 3;
}
.wm-zbtn {
  width: 30px; height: 30px; border: 0; border-radius: 10px; background: var(--surface);
  color: var(--ink); font: 800 16px/1 Nunito, sans-serif; box-shadow: var(--shadow);
  display: grid; place-items: center;
}
.wm-zbtn:hover { background: var(--accent-soft); color: var(--accent); }

.wm-status { min-height: 24px; }
.wm-closest { text-align: center; font-size: 14.5px; font-weight: 700; }
.wm-closest span { color: var(--accent); }
.wm-legend {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  font-size: 11.5px; font-weight: 700; color: var(--ink-2);
}
.wm-legend i { width: 18px; height: 8px; border-radius: 99px; display: inline-block; box-shadow: 0 0 0 1px rgb(0 0 0 / .08); }
.wm-input-row { flex-wrap: nowrap; align-items: center; }
.wm-chips { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; max-height: 62px; overflow: auto; }
.wm-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px;
  background: var(--surface-2); font-size: 12.5px; font-weight: 700;
}
.wm-chip i { width: 9px; height: 9px; border-radius: 99px; background: var(--h, var(--accent)); flex: none; }
.wm-chip small { color: var(--ink-2); font-weight: 700; }

/* Border Hop (Travle) route banner */
.travle-route {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 14px;
  padding: 6px 12px; background: var(--surface-2); border-radius: 16px; font-size: 15px;
}
.tr-end { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; background: var(--surface); box-shadow: var(--shadow); }
.tr-end.is-start { box-shadow: inset 0 0 0 2px var(--accent), var(--shadow); }
.tr-end.is-goal { box-shadow: inset 0 0 0 2px #f0a94f, var(--shadow); }
.tr-arrow { color: var(--ink-2); font-weight: 700; font-size: 13.5px; }

/* Explore bar */
.wm-explore-bar {
  min-height: 54px; display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px; padding: 8px 12px; border-radius: 16px; background: var(--surface-2);
}
.wm-ex-left { display: flex; align-items: center; gap: 10px; }
.wm-ex-left img.flag { width: 46px; flex: none; }
.wm-ex-left b { display: block; font: 600 18px/1.1 var(--display); }

@media (max-width: 600px) {
  .wm-zbtn { width: 28px; height: 28px; font-size: 14px; }
  .wm-chips { max-height: 48px; }
  .travle-route { font-size: 13.5px; gap: 6px; padding: 5px 8px; }
}

/* ── Phase 3: 8-pillar Hub, Higher/Lower, Mystery Country, Deck Builder & Trophy Case ── */
.stat-btn { border: 0; text-align: left; }
.modes.hub-grid.hub-grid-8 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 980px) { .modes.hub-grid.hub-grid-8 { grid-template-columns: repeat(2, 1fr); } }
.modes.stats-grid { grid-template-columns: repeat(3, 1fr); }
.modes.stats-grid .mode.span-2 { grid-column: span 2; }
@media (max-width: 820px) {
  .modes.stats-grid { grid-template-columns: repeat(2, 1fr); }
  .modes.stats-grid .mode.span-2 { grid-column: span 2; }
}
.deck-btn { background: var(--accent-soft); color: var(--accent); }

/* Higher or Lower Arena */
.game.st-game { max-width: 860px; }
.hl-arena {
  flex: 1 1 0; min-height: 0; display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: stretch; gap: 14px;
}
.hl-card {
  background: var(--surface); border-radius: 28px; padding: 22px 18px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  text-align: center; transition: box-shadow .2s, background .2s;
}
.hl-card img.flag { width: min(240px, 78%); border-radius: 14px; }
.hl-card h3 { font-size: clamp(22px, 3.2vh, 30px); }
.hl-val {
  font: 700 clamp(30px, 5.4vh, 48px)/1 var(--display); color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.hl-val.hidden { display: none; }
.hl-card.good { background: var(--good-bg); box-shadow: inset 0 0 0 3px var(--good), var(--shadow); }
.hl-card.good .hl-val { color: var(--good); }
.hl-card.bad { background: var(--bad-bg); box-shadow: inset 0 0 0 3px var(--bad), var(--shadow); }
.hl-card.bad .hl-val { color: var(--bad); }
.hl-vs {
  align-self: center; width: 52px; height: 52px; border-radius: 50%;
  background: var(--surface); box-shadow: var(--shadow-lift);
  display: grid; place-items: center; font: 700 18px var(--display); color: var(--ink-2);
}
.hl-vs.good { background: var(--good); color: #fff; }
.hl-vs.bad { background: var(--bad); color: #fff; }
.hl-actions { display: flex; flex-direction: column; gap: 8px; width: min(220px, 100%); }
.hl-btn.hi { background: var(--good); color: #fff; box-shadow: 0 6px 16px rgb(47 154 112 / .28); }
.hl-btn.lo { background: var(--bad); color: #fff; box-shadow: 0 6px 16px rgb(212 100 95 / .28); }
@media (max-width: 680px) {
  .hl-arena { grid-template-columns: 1fr; grid-template-rows: 1fr auto 1fr; gap: 8px; }
  .hl-card { padding: 12px; gap: 6px; border-radius: 20px; }
  .hl-card img.flag { width: 110px; }
  .hl-vs { width: 38px; height: 38px; font-size: 14px; justify-self: center; margin: -18px 0; z-index: 2; }
  .hl-actions { flex-direction: row; justify-content: center; width: 100%; }
  .hl-actions .btn { flex: 1; padding: 9px 10px; }
}

/* Mystery Country Clues */
#stage > .card > .clue-list {
  flex: 1 1 0; min-height: 0; display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 10px; align-content: center;
}
.clue-item {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  background: var(--surface-2); border-radius: 16px;
}
.clue-item.locked { opacity: .48; }
.cl-ico { font-size: 22px; flex: none; }
.clue-item small { display: block; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); }
.clue-item b { display: block; font-size: 14.5px; line-height: 1.25; }
@media (max-width: 600px) { #stage > .card > .clue-list { grid-template-columns: 1fr; overflow: auto; } }

/* Geo Facts Trivia */
#stage > .card > .trivia-opts { flex: 1 1 0; align-content: center; }
.trivia-opt { display: flex; align-items: center; gap: 8px; padding: 14px 12px 14px 38px; font-size: 16px; }

/* Custom Deck Builder Modal */
.deck-modal { max-width: 620px; display: flex; flex-direction: column; gap: 10px; }
.dk-picked { display: flex; flex-wrap: wrap; gap: 6px; max-height: 86px; overflow: auto; padding: 6px 8px; background: var(--surface-2); border-radius: 14px; }
.dk-pill {
  border: 0; border-radius: 99px; background: var(--surface); padding: 3px 9px;
  font-size: 12.5px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; box-shadow: var(--shadow);
}
.dk-pill:hover { background: var(--bad-bg); color: var(--bad); }
.dk-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 6px; max-height: 220px; overflow: auto; padding: 2px; }
.dk-item {
  border: 2px solid transparent; border-radius: 12px; background: var(--surface-2);
  padding: 6px; text-align: left; display: flex; flex-direction: column; gap: 4px;
}
.dk-item.on { background: var(--accent-soft); border-color: var(--accent); }
.dk-item span { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Trophy Case Modal */
.trophy-modal { max-width: 660px; display: flex; flex-direction: column; gap: 10px; }
.tr-cat h4 { margin: 4px 0 6px; font: 700 13px Nunito, sans-serif; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.tr-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.tr-badge {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 16px; background: var(--surface-2);
}
.tr-badge.unlocked { background: linear-gradient(145deg, var(--good-bg), var(--surface-2)); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--good) 45%, transparent); }
.tr-badge.locked { opacity: .62; }
.tr-ico { font-size: 26px; flex: none; }
.tr-badge.locked .tr-ico { filter: grayscale(1); }
.tr-badge b { display: block; font-size: 14px; line-height: 1.15; }
.tr-badge small { display: block; font-size: 12px; color: var(--ink-2); line-height: 1.25; }
.tr-prog { display: inline-block; margin-top: 3px; font-size: 11px; font-weight: 800; color: var(--accent); }
.tr-badge.unlocked .tr-prog { color: var(--good); }
@media (max-width: 600px) { .tr-grid { grid-template-columns: 1fr; } }



