/* Geowhizzz styles, layered on top of Bootstrap (vendored in static/vendor).
   Colour comes from variables: --lv is the current level's colour (set by .lv-0/1/2 on a level's
   container), --c a home card's. The whole site is dark: <html data-bs-theme="dark"> gives Bootstrap's dark
   surfaces and the body below paints the homepage's night sky on every page.
   Sections: level colours, header, level cards, leaderboard, timer, flag and shape panel, answer
   options, instructions dialog, country-mode maps, then the home screen (all .home-*). */
/* The night sky behind every page. */
:root { --dot: #e5342b; --win: #4ade80; --miss: #ff6b81; --surface: rgb(255 255 255 / .06); --edge: rgb(255 255 255 / .14); }
body { color: #fff; min-height: 100vh; min-height: 100dvh; background-color: #0a0f26; background-attachment: fixed;
  font-family: "Avenir Next", "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  background-image: radial-gradient(900px 560px at 80% 6%, rgba(99, 102, 241, .38), transparent 65%),
    radial-gradient(800px 520px at 6% 38%, rgba(15, 157, 138, .20), transparent 62%),
    radial-gradient(900px 600px at 70% 92%, rgba(214, 51, 108, .16), transparent 60%),
    linear-gradient(165deg, #080c1c, #12183a 55%, #1a1f4a); }
body { --bs-secondary-color: rgb(255 255 255 / .7); --bs-border-color: var(--edge); }
/* Bootstrap's grey (#6c757d) is too dim on the night sky (3.3:1); these follow the lighter secondary colour instead. */
.text-secondary { color: var(--bs-secondary-color) !important; }
.btn-outline-secondary { --bs-btn-color: var(--bs-secondary-color); --bs-btn-border-color: var(--bs-secondary-color); }
#feedback:empty { display: none; }   /* the live region stays in the page, empty, so screen readers announce what is put in it */
#menu-title:focus, .home-title:focus { outline: none; }   /* focus lands here after a screen change; it is not a control */
/* Cards are frosted glass on the night sky. */
.card, .level-card { --bs-card-bg: var(--surface); background: var(--surface); border-color: var(--edge); backdrop-filter: blur(6px); }
.modal-content { background: #12183a; border: 1px solid var(--edge); }
a { color: #8ab4ff; } a:hover { color: #b6d0ff; }
#back { --bs-btn-color: #8ab4ff; --bs-btn-hover-color: #b6d0ff; }
.wrap { max-width: 760px; }

/* Success colour: Bootstrap's own green is replaced everywhere (progress bars, "+bonus", right answers, confirmations). */
[data-bs-theme="dark"] { --bs-success: rgb(7 201 243); --bs-success-rgb: 7, 201, 243; --bs-success-text-emphasis: rgb(7 201 243);
  --bs-success-bg-subtle: rgb(7 201 243 / .12); --bs-success-border-subtle: rgb(7 201 243 / .4); }
.btn-success { --bs-btn-color: #04202b; --bs-btn-bg: rgb(7 201 243); --bs-btn-border-color: rgb(7 201 243); --bs-btn-hover-color: #04202b;
  --bs-btn-hover-bg: rgb(63 217 248); --bs-btn-hover-border-color: rgb(63 217 248); --bs-btn-disabled-color: #04202b; --bs-btn-disabled-bg: rgb(7 201 243);
  --bs-btn-disabled-border-color: rgb(7 201 243); --bs-btn-active-color: #04202b; --bs-btn-active-bg: rgb(7 201 243); --bs-btn-active-border-color: rgb(7 201 243); }

/* One colour per level, by position. Everything that says "--lv" follows the level in scope. */
.lv-0 { --lv: #14b8a6; }   /* teal, blue, magenta */
.lv-1 { --lv: #3b82f6; }
.lv-2 { --lv: #e879f9; }
.lv-0, .lv-1, .lv-2 { --lv-ink: #1b1030; }   /* text on a level colour; the colours are light, so it is dark */
.btn-lv { background: var(--lv, #3b82f6); border-color: var(--lv, #3b82f6); color: var(--lv-ink, #1b1030); font-weight: 600; }
.btn-lv:hover, .btn-lv:focus-visible { background: var(--lv); border-color: var(--lv); color: var(--lv-ink); filter: brightness(1.08); }
.btn-lv:disabled { background: var(--lv); border-color: var(--lv); color: var(--lv-ink); opacity: .6; }
.badge-lv { background: var(--lv); color: var(--lv-ink); }
.btn-outline-lv { --bs-btn-color: var(--lv); --bs-btn-border-color: var(--lv); --bs-btn-hover-color: var(--lv-ink); --bs-btn-hover-bg: var(--lv);
  --bs-btn-hover-border-color: var(--lv); --bs-btn-active-color: var(--lv-ink); --bs-btn-active-bg: var(--lv); --bs-btn-active-border-color: var(--lv); font-weight: 600; }
.saved-lv { color: var(--lv); }
.progress-lv { height: .5rem; }
.progress-lv .progress-bar { background: var(--lv); }
.score-lv { color: var(--lv); }

/* Header */
.topbar { position: relative; z-index: 1030; border-bottom: 1px solid var(--bs-border-color); background: rgb(10 15 38 / .72); backdrop-filter: blur(6px); }   /* the night sky's own colour, not Bootstrap's grey */
.brand { font-weight: 800; letter-spacing: -.02em; display: inline-flex; align-items: center; gap: .5rem; }
.brand em { font-style: normal; }

/* Level cards */
.level-card { display: flex; flex-direction: column; height: 100%; border: 2px solid var(--bs-border-color);
  border-radius: 16px; overflow: hidden; cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s; }
.level-card:hover, .level-card:focus-visible, .level-card.shown { border-color: var(--lv); }
.level-card:hover, .level-card:focus-visible { transform: translateY(-3px); box-shadow: 0 .6rem 1.2rem color-mix(in srgb, var(--lv) 25%, transparent); }
.level-card:focus-visible { outline: 3px solid #8ab4ff; outline-offset: 3px; }
.level-card.shown { box-shadow: 0 0 0 3px color-mix(in srgb, var(--lv) 25%, transparent); }
.level-top { background: var(--lv); color: var(--lv-ink); padding: .85rem 1rem; display: flex; justify-content: space-between; align-items: center; }
.level-body { flex: 1; display: flex; flex-direction: column; padding: 1rem; color: var(--bs-body-color); }
.dots { display: inline-flex; gap: 4px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: color-mix(in srgb, var(--lv-ink) 30%, transparent); }
.dot.on { background: var(--lv-ink); }
.tag { display: inline-block; font-size: .72rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px;
  color: var(--lv); background: color-mix(in srgb, var(--lv) 14%, transparent); }
.play-link { margin-top: auto; /* the call to action sits at the bottom of equal-height cards */ color: var(--lv); font-weight: 700; }

/* Leaderboard */
.lb-card { border-top: 4px solid var(--lv, var(--bs-border-color)); border-radius: 12px; overflow: hidden; }
.lb-card .table { --bs-table-bg: transparent; --bs-table-hover-bg: rgb(255 255 255 / .06); }
.lb-card .nav-link { color: var(--bs-secondary-color); font-weight: 600; }
/* The active tab is cut from the same glass as the table rows, so it flows into them. */
.lb-card .nav-link.active { color: var(--lv); background: transparent; border-color: var(--edge) var(--edge) transparent; }

/* Timer: monospaced, fixed-width cells so digits don't shift the layout */
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; white-space: pre; }
.timer-row { display: grid; grid-template-columns: 1fr 1fr 1fr; font-size: .9rem; align-items: baseline; }
.timer-row > :nth-child(2) { text-align: center; }
.timer-row > :nth-child(3) { text-align: right; }
.timer-strip { border: 1px solid var(--bs-border-color); border-radius: var(--bs-border-radius); padding: .5rem .75rem; background: var(--bs-body-bg); }

/* Visual panel: flag and/or zoomable shape */
.visual { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1rem; min-height: 200px; }
.visual img.flag { height: 160px; max-width: 100%; border: 1px solid var(--bs-border-color); border-radius: 4px; }
.visual img.flag[title] { cursor: zoom-in; }
.visual[data-items="flag+shape"] img.flag { height: 72px; }
.visual[data-items="flag+shape"] img.flag.half { height: 96px; }
.shape-wrap { position: relative; width: 100%; }
.shape-svg { display: block; width: 100%; height: 340px; touch-action: none; cursor: grab;
  background: var(--bs-tertiary-bg); border-radius: var(--bs-border-radius);
  --land: color-mix(in srgb, var(--lv, #3b82f6) 22%, var(--bs-body-bg)); fill: var(--land); stroke: var(--lv, #3b82f6); }
.shape-svg:active { cursor: grabbing; }
.visual[data-items="shape"] .shape-svg { height: 400px; }
.shape-svg path { fill-rule: evenodd; /* inner rings are holes: Lesotho in South Africa */ stroke-width: 1.2px; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
/* Islands too small to see (specks) keep the land's light fill, so they read as islands and not as solid blobs.
   Their outline is what keeps them visible, so it is heavier when zoomed out and thins as the view zooms in. makeShape() sets data-zoom to far, mid or deep from the on-screen size of a drawing unit. */
.shape-svg path.specks { fill: var(--land); stroke-width: 1.8px; stroke: var(--lv, #3b82f6); }
.shape-svg[data-zoom="mid"] path.specks { stroke-width: 1.5px; }
.shape-svg[data-zoom="deep"] path.specks { stroke-width: 1.2px; }
.shape-svg circle.capital { fill: var(--dot); stroke: #fff; stroke-width: 2px; vector-effect: non-scaling-stroke; }
.zoom-controls { position: absolute; top: .5rem; right: .5rem; }
.zoom-hint { position: absolute; left: .75rem; bottom: .5rem; max-width: calc(100% - 9.5rem); font-size: .75rem; opacity: .65; pointer-events: none; }
#prompt:focus { outline: none; }

/* Answer options */
.choices .btn { padding: .75rem 1rem; text-align: left; display: flex; align-items: center; border-width: 2px; }
.choices .btn-outline-secondary { --bs-btn-color: var(--bs-secondary-color); --bs-btn-border-color: var(--bs-secondary-color); }
.choices .btn-outline-secondary:hover:not(:disabled), .choices .btn-outline-secondary:focus-visible { border-color: var(--lv); background: color-mix(in srgb, var(--lv) 10%, transparent); color: #fff; }
.next { border: 2px solid var(--edge); } /* the dark button needs an edge on dark pages */
.choices .btn.btn-success:disabled, .choices .btn.btn-danger:disabled { opacity: 1; }
.choices kbd { background: var(--bs-secondary-bg); color: var(--bs-secondary-color); font-size: .72rem; margin-right: .7rem; min-width: 1.5rem; text-align: center; }
.opt-flag { height: 2.25rem; margin-right: .7rem; border: 1px solid var(--bs-border-color); border-radius: 3px; }
.preview .opt-flag { height: 1.5rem; margin-right: .5rem; }
/* Tiles: a big flag with the name under it, two side by side at every width. */
.choices.tiles { grid-template-columns: 1fr 1fr; }
.choices.tiles .btn { position: relative; flex-direction: column; justify-content: center; gap: .75rem; padding: 1.5rem 1rem 1.25rem; text-align: center; }
.choices.tiles kbd { position: absolute; top: .6rem; left: .6rem; margin: 0; }
.choices.tiles .opt-flag-slot { display: flex; align-items: center; justify-content: center; width: 100%; height: 7.5rem; }
.choices.tiles .opt-flag { display: block; height: auto; width: auto; max-width: 100%; max-height: 100%; margin: 0; }
.choices.tiles .opt-name { font-size: 1.2rem; font-weight: 600; line-height: 1.2; }
.preview .choices.tiles .btn { padding: 1rem .5rem .75rem; gap: .4rem; }
.preview .choices.tiles .opt-flag-slot { height: 3.5rem; }
.preview .choices.tiles .opt-name { font-size: 1rem; }
.choices .btn-danger kbd { background: rgb(255 255 255 / .25); color: #fff; }
.choices .btn-success kbd { background: rgb(0 0 0 / .15); color: #04202b; }
@media (min-width: 576px) { .choices { grid-template-columns: 1fr 1fr; } }

/* Instructions modal */
.intro-head { background: var(--lv); color: var(--lv-ink); border-bottom: 0; }
.rules { padding-left: 1.1rem; }
.rules li { margin-bottom: .35rem; }
.rules li::marker { color: var(--lv); }
.preview { border: 1px dashed var(--bs-border-color); border-radius: var(--bs-border-radius); padding: .75rem; background: var(--bs-tertiary-bg); }
.preview .timer-strip { font-size: .85rem; }
.preview .visual { min-height: 0; gap: .5rem; }
.preview .visual img.flag { height: 48px; }
.preview .visual[data-items="flag"] img.flag { height: 96px; }
.preview .visual[data-items="flag+shape"] img.flag.half { height: 64px; }
.preview .visual[data-items] .shape-svg { height: 190px; }
.preview .zoom-controls, .preview .zoom-hint { display: none; }
.preview .choices { grid-template-columns: 1fr 1fr; }
.preview kbd { display: inline-block; }

/* Coming soon: a diagonal ribbon across a greyed-out card */
.ribbon { position: absolute; top: 28px; right: -54px; width: 210px; transform: rotate(45deg); text-align: center; z-index: 2;
  background: #343a40; color: #fff; font-weight: 700; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase;
  padding: .35rem 0; box-shadow: 0 2px 6px rgb(0 0 0 / .3); }

/* Country mode: the target highlighted among grey neighbours */
.shape-svg path.neighbors { fill: var(--bs-secondary-bg); stroke: var(--bs-secondary-color); stroke-width: .8px; stroke-opacity: .55; }
.shape-svg.ctx { --land: color-mix(in srgb, var(--lv, #3b82f6) 70%, var(--bs-body-bg)); }
.shape-svg.ctx path.target { fill: var(--land); stroke: var(--lv, #3b82f6); stroke-width: 1.6px; }
.shape-svg.ctx[data-zoom="far"] path.target { stroke-width: 1.1px; } /* a heavy outline swamps small islands when zoomed out */
.shape-wrap.ctx { width: fit-content; max-width: 100%; margin: 0 auto; }
.visual .shape-svg.ctx, .visual[data-items] .shape-svg.ctx { height: 340px; width: auto; max-width: 100%; aspect-ratio: 4 / 3; }
.preview .visual[data-items] .shape-svg.ctx { height: 190px; }

/* Map scale: a bracket whose width and label are set by makeShape() as the view zooms. */
.map-scale { position: absolute; right: .75rem; bottom: .5rem; display: flex; flex-direction: column; align-items: flex-end;
  font-size: .75rem; line-height: 1.2; color: var(--bs-body-color); pointer-events: none; }
.map-scale-label { font-weight: 600; margin-bottom: 1px; }
.map-scale-bar { display: block; height: 6px; border: 2px solid currentColor; border-top: 0; }

/* Hover effects on the small controls: footer link and "All games".
   Movement only for people who have not asked for less of it; the colour and underline changes always apply. */
.link-secondary { text-underline-offset: .2em; transition: text-decoration-thickness .12s; }
.link-secondary:hover, .link-secondary:focus-visible { color: #fff !important; text-decoration-thickness: 2px; }
#back { transition: transform .12s; }
#back:hover, #back:focus-visible { text-decoration: underline !important; text-underline-offset: .2em; }
@media (prefers-reduced-motion: no-preference) {
  #back:hover, #back:focus-visible { transform: translateX(-3px); }
  }

/* ===== Home screen: a dark page, a hero you can play, and three game cards ===== */
body.home main { display: none; }
body.home .topbar .wrap { max-width: 1040px; }   /* line the logo up with the wider home content */
body.home footer { padding-top: 2.5rem; }
body.home .topbar { background: transparent; border-bottom-color: transparent; backdrop-filter: none; margin-bottom: 0 !important; }
.brand, .brand:hover { color: #fff; } .brand em { color: #8ab4ff; }
body.home footer, body.home footer .link-secondary { color: rgb(255 255 255 / .6) !important; }
body.home footer .link-secondary:hover { color: #fff !important; }
.home-wrap { max-width: 1040px; margin: 0 auto; padding: 0 1rem; }


/* ---- hero ---- */
.home-hero { position: relative; overflow: hidden; color: #fff; padding-bottom: 3.5rem; }
.home-hero::before { content: ""; position: absolute; inset: 0; opacity: .5;
  background-image: radial-gradient(rgba(255, 255, 255, .16) 1px, transparent 1.2px); background-size: 30px 30px;
  -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent); mask-image: linear-gradient(to bottom, #000 30%, transparent); }
.home-grid { position: relative; display: grid; grid-template-columns: 1.05fr 1fr; gap: 2rem; align-items: center; min-height: 420px; }
.home-eyebrow { text-transform: uppercase; letter-spacing: .18em; font-size: .75rem; font-weight: 700; color: #8ab4ff; margin-bottom: .8rem; }
h1.home-title { font-size: clamp(2.3rem, 5.4vw, 4rem); line-height: 1.04; font-weight: 800; letter-spacing: -.035em; margin: 0 0 1rem; }
/* the gradient text is clipped to its box, so give the last glyph (the ?) room to overhang */
.home-grad { background: linear-gradient(100deg, #ffb74d, #f06292 55%, #8ab4ff); -webkit-background-clip: text; background-clip: text; color: transparent;
  padding: 0 .14em .1em 0; margin-right: -.14em; }
.home-lead { color: rgb(255 255 255 / .72); font-size: 1.1rem; margin-bottom: 1.6rem; }
@media (min-width: 960px) { .home-lead { white-space: nowrap; } }   /* one line beside the map; wider than the two-column layout needs, so it never runs into it */

.home-form { display: flex; max-width: 440px; background: rgb(255 255 255 / .09); border: 1px solid rgb(255 255 255 / .2); border-radius: 999px; padding: .3rem; backdrop-filter: blur(6px); transition: border-color .2s, box-shadow .2s; }
.home-form:focus-within { border-color: rgb(138 180 255 / .75); box-shadow: 0 0 0 4px rgb(138 180 255 / .16); }
.home-form input { flex: 1; min-width: 0; background: transparent; border: 0; color: #fff; padding: .55rem 1rem; outline: none; }
.home-form input::placeholder { color: rgb(255 255 255 / .5); }
.home-btn { background: linear-gradient(100deg, #f59e0b, #ec4899); color: #fff; font-weight: 700; border: 0; border-radius: 999px; padding: .55rem 1.4rem; text-decoration: none; white-space: nowrap; cursor: pointer; }
.home-btn:hover { filter: brightness(1.08); color: #fff; }
.home-btn:disabled { filter: grayscale(.6) brightness(.8); cursor: default; }
.home-form.shake { animation: home-shake .42s; border-color: var(--miss); }
.home-form.done { opacity: .55; pointer-events: none; }
.home-msg { min-height: 1.5rem; margin-top: .6rem; font-size: .92rem; color: rgb(255 255 255 / .75); }
.home-msg.bad { color: #ffb3bf; } .home-msg.good { color: var(--win); }
.home-links { display: flex; gap: 1.2rem; align-items: center; margin-top: .2rem; font-size: .88rem; }
.home-links button, .home-links a { background: none; border: 0; padding: .3rem 0; color: rgb(255 255 255 / .65); text-decoration: none; cursor: pointer; }
.home-links button:hover, .home-links a:hover { color: #fff; text-decoration: underline; text-underline-offset: .2em; }

/* the map: a box sized to the outline's own proportions, so everything pinned to it (the beacon, the answer card) stays exact */
.home-art { position: relative; height: 430px; }
.home-fit { position: absolute; inset: 24px 0 0 0; display: flex; align-items: center; justify-content: center; }
.home-art.answered .home-fit { inset: 150px 0 0 0; }   /* the answer card needs room above the outline */
.home-stage { position: relative; }
#home-shape { width: 100%; height: 100%; overflow: visible; display: block; filter: drop-shadow(0 0 22px rgba(138, 180, 255, .35)); transition: filter .5s; }
#home-shape .out { fill: rgb(138 180 255 / .08); stroke: url(#hg); stroke-width: 2.2px; vector-effect: non-scaling-stroke; stroke-linejoin: round; transition: fill .5s; }
#home-shape .cap { fill: #ff6b81; stroke: #fff; stroke-width: 2px; vector-effect: non-scaling-stroke; }
#home-shape .beacon { fill: none; stroke: var(--miss); stroke-width: 2px; vector-effect: non-scaling-stroke; transform-box: fill-box; transform-origin: center; opacity: 0; }
.home-stage.win #home-shape { filter: drop-shadow(0 0 26px rgba(74, 222, 128, .5)); }
.home-stage.win #home-shape .out { stroke: url(#hg-win); fill: rgb(74 222 128 / .16); }
.home-stage.win .beacon { stroke: var(--win); } .home-stage.win .cap { fill: var(--win); stroke: #fff; }
.home-stage.lose #home-shape .out { stroke: url(#hg-lose); fill: rgb(255 107 129 / .1); }
.home-stage.flash #home-shape { animation: home-flash .5s; }
.home-scale { position: absolute; right: 0; bottom: 0; color: rgb(255 255 255 / .8); font-size: .75rem; text-align: right; }
.home-scale i { display: block; height: 6px; border: 2px solid currentColor; border-top: 0; margin-top: 2px; margin-left: auto; }

/* the question lives inside the guess field: it is the field's label, and shrinks to "Guess the country" once you start */
.home-field { position: relative; flex: 1; min-width: 0; }
.home-field input { width: 100%; background: transparent; border: 0; color: #fff; padding: 1.3rem 1rem .4rem 1.05rem; outline: none; font-size: 1.05rem; }
.home-field label { position: absolute; left: 0; top: 0; bottom: 0; right: 0; margin: 0; pointer-events: none; padding: 0 1rem 0 1.05rem; }
.home-field label span { position: absolute; left: 1.05rem; top: 50%; display: flex; align-items: center; gap: .6rem; white-space: nowrap; transform-origin: left center;
  transition: transform .28s cubic-bezier(.3, .8, .3, 1), opacity .22s, top .28s; }
.home-field .home-q1 { transform: translateY(-50%); color: rgb(255 255 255 / .78); font-size: 1.05rem; font-weight: 600; }
.home-field .home-q2 { top: .78rem; transform: translateY(-50%) scale(.72); opacity: 0; color: #8ab4ff; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; font-size: .78rem; }
.home-qmark { display: grid; place-items: center; width: 1.45rem; height: 1.45rem; border-radius: 50%; background: linear-gradient(135deg, #ffb74d, #f06292); color: #1b1030; font-weight: 800; font-size: .85rem; }
/* focused or typing: the question slides up and fades, the small label takes its place */
.home-field input:focus ~ label .home-q1, .home-field input:not(:placeholder-shown) ~ label .home-q1 { top: .78rem; transform: translateY(-50%) translateX(.4rem) scale(.6); opacity: 0; }
.home-field input:focus ~ label .home-q2, .home-field input:not(:placeholder-shown) ~ label .home-q2 { opacity: 1; transform: translateY(-50%) scale(1); }
.home-streak { position: absolute; right: 0; top: 4px; z-index: 3; font-size: .8rem; font-weight: 700; padding: .25rem .8rem; border-radius: 999px; background: rgb(74 222 128 / .16); border: 1px solid rgb(74 222 128 / .5); color: var(--win); }
.home-tips { margin-top: .6rem; display: grid; gap: .35rem; max-width: 440px; }
.home-tip { display: flex; gap: .6rem; align-items: baseline; font-size: .92rem; color: #fff; background: rgb(138 180 255 / .14); border: 1px solid rgb(138 180 255 / .35); border-radius: 12px; padding: .4rem .75rem; animation: home-pop .4s; }
.home-tip b { font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: #8ab4ff; white-space: nowrap; }

.home-result { position: absolute; left: 0; bottom: 100%; margin-bottom: 10px; z-index: 4; display: flex; gap: .9rem; align-items: center; background: rgb(255 255 255 / .96); color: #1b2033;
  border-radius: 18px; padding: .75rem 1rem; box-shadow: 0 14px 40px rgb(0 0 0 / .4); animation: home-rise .45s; width: max-content; max-width: min(100vw - 2rem, 430px); }
.home-result img { height: 46px; border-radius: 4px; border: 1px solid rgb(0 0 0 / .12); }
.home-result .t { font-weight: 800; font-size: 1.1rem; line-height: 1.15; } .home-result .s { font-size: .82rem; color: #5b6280; }
.home-result .t small { display: block; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; }
.home-result .win { color: #15803d; } .home-result .lose { color: #be123c; }
.home-result .home-acts { display: flex; gap: .5rem; margin-top: .5rem; white-space: nowrap; }
.home-result a, .home-result button { font-size: .78rem; font-weight: 700; border-radius: 999px; padding: .3rem .8rem; text-decoration: none; border: 0; cursor: pointer; }
.home-result a { background: linear-gradient(100deg, #f59e0b, #ec4899); color: #fff; } .home-result button { background: #eef0f8; color: #1b2033; }
.home-result[hidden], .home-streak[hidden] { display: none; }
.home-art.answered .home-streak { display: none; }   /* once answered, the streak shows inside the answer card instead */
.home-result .home-streak-in { display: inline-block; margin-left: .4rem; padding: .05rem .5rem; border-radius: 999px; background: #dcfce7; color: #15803d; font-weight: 700; font-size: .7rem; }

@media (prefers-reduced-motion: no-preference) {
  #home-shape .out { stroke-dasharray: 1; stroke-dashoffset: 1; animation: home-draw 2.6s ease-out forwards; }
  /* "late", not "fade": Bootstrap's .fade sets opacity 0 and would hide these for good when this block is skipped */
  #home-shape .late { opacity: 0; animation: home-fade 1s 2s forwards; }
  #home-shape .beacon { animation: home-beacon 2.4s 2.2s infinite ease-out; } #home-shape .beacon.b2 { animation-delay: 3.4s; }
  .home-stage.win .beacon { animation-duration: 1.4s; }
}
@keyframes home-draw { to { stroke-dashoffset: 0; } }
@keyframes home-fade { to { opacity: 1; } }
@keyframes home-beacon { 0% { transform: scale(.5); opacity: .95; } 100% { transform: scale(4.2); opacity: 0; } }
@keyframes home-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
@keyframes home-flash { 30% { filter: drop-shadow(0 0 28px rgba(255, 107, 129, .75)); } }
@keyframes home-pop { 0% { transform: scale(.85); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes home-rise { from { opacity: 0; transform: translateY(8px); } }

/* ---- cards ---- */
.home-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; margin-top: -1.2rem; position: relative; }
.home-card { display: flex; flex-direction: column; background: #fff; border-radius: 22px; overflow: hidden; text-decoration: none; color: #1b2033;
  box-shadow: 0 1px 2px rgb(16 24 64 / .06), 0 14px 34px rgb(16 24 64 / .10); transition: transform .18s, box-shadow .18s; }
.home-card:hover { transform: translateY(-5px); box-shadow: 0 2px 4px rgb(16 24 64 / .06), 0 22px 44px rgb(16 24 64 / .16); color: #1b2033; }
/* Card art: each card in its own hue (--c, set per game: orange, teal, pink). The sea is lightest, the land a shade
   darker, the country itself darker still. The capital dot is red. */
.home-card { --g: var(--c); }
.home-card-art { position: relative; height: 170px; overflow: hidden;
  background: linear-gradient(160deg, color-mix(in srgb, var(--g) 5%, #fff), color-mix(in srgb, var(--g) 12%, #fff)); }
/* a soft wash of the hero's colours over the map, fading to white where the art meets the text */
.home-card-art::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, rgb(99 102 241 / .10), transparent 50%, rgb(255 255 255 / .12)), linear-gradient(to bottom, transparent 62%, rgb(255 255 255 / .55)); }
.home-card-art svg { position: relative; z-index: 1; display: block; width: 100%; height: 100%; }
.home-card-art .nb { fill: color-mix(in srgb, var(--g) 30%, #fff); stroke: color-mix(in srgb, var(--g) 50%, #fff); stroke-width: .7px; vector-effect: non-scaling-stroke; }
.home-card-art .tg { fill: color-mix(in srgb, var(--g) 72%, #fff); stroke: none; }
.home-card-art.accent .tg { fill: var(--c); }   /* on the country card the country itself is the full orange */
.home-card-art .pin { fill: #e5342b; stroke: #fff; stroke-width: 2px; vector-effect: non-scaling-stroke; }
/* the density card: the sea is the lightest thing on it, the land a shade darker, the cities glowing pink on top */
.home-card-art.density { background: linear-gradient(160deg, #fdf9fc, #f9f1f7); }
.home-card-art.density::after { background: linear-gradient(to bottom, transparent 70%, rgb(255 255 255 / .5)); }
.home-card-art .land { fill: #f1d6e3; stroke: #fff; stroke-width: .6px; vector-effect: non-scaling-stroke; }
.home-card-art .halo circle { fill: #e0457f; opacity: .11; }
.home-card-art .core circle { fill: #c2185b; opacity: .55; }
.home-card-body { flex: 1; display: flex; flex-direction: column; padding: 1.1rem 1.3rem 1.3rem; }
.home-card-body h2 { font-size: 1.25rem; font-weight: 800; letter-spacing: -.02em; margin: 0 0 .35rem; }
.home-card-body h2 .home-w { color: var(--ct, var(--c)); }   /* the key word in each card's own colour */
.home-card-body p { color: #5b6280; margin: 0 0 1rem; max-width: 31ch; }
.home-cta { margin-top: auto; font-weight: 700; color: var(--ct, var(--c)); display: flex; justify-content: space-between; align-items: center; }
.home-cta span:last-child { transition: transform .15s; }
.home-card:hover .home-cta span:last-child { transform: translateX(4px); }
@media (max-width: 480px) { .home-result { padding: .65rem .8rem; gap: .7rem; } .home-result img { height: 38px; } .home-result .home-acts { flex-wrap: wrap; } }
@media (max-width: 820px) {
  .home-grid { grid-template-columns: 1fr; gap: 0; }
  .home-copy { display: contents; }   /* its parts become grid items, so the outline can sit between the tagline and the guess field */
  .home-eyebrow { order: 1; } .home-title { order: 2; } .home-lead { order: 3; white-space: normal; margin-bottom: 1rem; }
  .home-art { order: 4; height: 340px; margin-bottom: 1rem; }
  .home-form { order: 5; } .home-msg { order: 6; } .home-tips { order: 7; } .home-links { order: 8; }
  .home-fit { inset: 24px 0 0 0; } .home-art.answered .home-fit { inset: 168px 0 0 0; }
  .home-cards { grid-template-columns: 1fr; }
}
  
/* a game that is announced but not playable yet */
.home-card { position: relative; }
.home-card.soon { filter: grayscale(1); opacity: .6; cursor: not-allowed; }
.home-card.soon:hover { transform: none; box-shadow: 0 1px 2px rgb(16 24 64 / .06), 0 14px 34px rgb(16 24 64 / .10); }
.home-card:focus-visible { outline: 3px solid #8ab4ff; outline-offset: 3px; }

/* ===== The 404 page: a headline, one line, a way home ===== */
.lost { max-width: 36rem; margin: 0 auto; padding: clamp(2.5rem, 14vh, 8rem) 0 3rem; text-align: center; }
.lost .home-eyebrow { margin-bottom: 1.25rem; }
.lost-title { font-size: clamp(3rem, 13vw, 6rem); line-height: .98; font-weight: 800; letter-spacing: -.045em; margin: 0 0 1.5rem; }
.lost-title span { display: block; }
.lost-lead { color: var(--bs-secondary-color); font-size: 1.2rem; line-height: 1.5; max-width: 24em; margin: 0 auto 2.5rem; text-wrap: balance; }
.lost .home-btn { display: inline-block; padding: .8rem 2rem; }

/* ===== Analytics choice: a quiet bar at the bottom, never over the game ===== */
#analytics-banner { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: .75rem 1.5rem; padding: .9rem 1rem calc(.9rem + env(safe-area-inset-bottom)); background: #12183a; border-top: 1px solid var(--edge); font-size: .92rem; }
#analytics-banner p { margin: 0; max-width: 46rem; }
#analytics-banner a { color: #8ab4ff; }
.analytics-actions { display: flex; gap: .5rem; flex-shrink: 0; }

/* Reduced motion: no animation, no slides, no hover movement. State changes still happen, instantly, and every cue
   that was only motion (the shake, the flash) also has its words ("Not quite", the tip). The timer is a readout, not motion. */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .level-card:hover, .level-card:focus-visible, .home-card:hover, .home-card:hover .home-cta span:last-child { transform: none; }
}

/* ===== Phones and tablets ===== */
/* The number keys do nothing without a keyboard, so the hints would only be clutter. */
@media (hover: none) { .choices kbd { display: none; } }
/* Fingers: bigger targets for the small controls. */
@media (pointer: coarse) {
  .zoom-controls .btn { padding: .55rem .9rem; font-size: 1.1rem; }
  .home-links button, .home-links a { padding: .7rem 0; }
  .home-result a, .home-result button { padding: .6rem 1rem; }
}
/* A phone on its side is about 360px tall: the map must leave room for the question and the answers. */
@media (orientation: landscape) and (max-height: 500px) {
  .shape-svg, .visual[data-items="shape"] .shape-svg, .visual .shape-svg.ctx, .visual[data-items] .shape-svg.ctx { height: max(180px, 55vh); }
}
