@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/games/countries/vendor/fonts/fraunces-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/games/countries/vendor/fonts/fraunces-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

:root { --bg: #F8F9F0; --ink: #1E4A5F; --yellow: #FDE358; --soft: rgba(30, 74, 95, .65); --font: "Fraunces", Georgia, "Times New Roman", serif; }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-weight: 500; overflow: hidden; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
#app { position: fixed; inset: var(--bar-h, 0px) 0 0 0; }
button, input { font: inherit; color: inherit; }
.loading { height: 100%; display: grid; place-items: center; padding: 24px; text-align: center; }
.soft { color: var(--soft); }
.small { font-size: .85rem; }

.text-btn { background: transparent; border: 1.5px solid var(--ink); border-radius: 6px; padding: 6px 14px; cursor: pointer; }
.text-btn:hover:not(:disabled) { background: var(--ink); color: var(--bg); }
.text-btn:disabled { opacity: .5; }
.text-btn.big { padding: 10px 22px; font-size: 1.05rem; }
.link { background: none; border: 0; padding: 4px; color: var(--ink); text-decoration: underline; cursor: pointer; }

/* ---- stage + HUD ---- */
.stage { position: absolute; inset: 0; overflow: hidden; }
.hud { position: absolute; left: 0; right: 0; top: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 12px 16px; pointer-events: none; z-index: 5; }
.hud > * { pointer-events: auto; }
.timer { font-size: 2.2rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1; }
.timer.low { animation: blink .8s steps(1) infinite alternate; }
@keyframes blink { from { opacity: 1; } to { opacity: .35; } }
.level-tag { font-size: .8rem; color: var(--soft); margin-top: 4px; letter-spacing: .03em; }
.hud-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.count { font-variant-numeric: tabular-nums; margin-right: 4px; }

/* ---- the diagram ---- */
.dia-slot { position: absolute; inset: 64px var(--rail, 0px) 0 0; z-index: 1; }
@media (min-width: 640px) { .dia-slot { --rail: 290px; } }
@media (max-width: 639px) { .dia-slot { inset: 56px 0 var(--dock, 40%) 0; } }
.dia-wrap { position: absolute; inset: 0; touch-action: none; }
svg.dia { width: 100%; height: 100%; display: block; cursor: grab; user-select: none; -webkit-user-select: none; overflow: hidden; }
svg.dia:active { cursor: grabbing; }
.shape { transform-box: fill-box; transform-origin: center; }
.shape.off { display: none; }
.shape:not(.active), .shape:not(.active) * { pointer-events: none; }
.shape .hit { fill: transparent; stroke: transparent; }
.shape.active .hit { pointer-events: all; }
.shape .fill { fill: var(--bg); stroke: var(--ink); stroke-width: 1.7; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.shape.context .fill { stroke-opacity: .3; }
.shape.active { cursor: pointer; }
.shape.active:hover .fill, .shape.active:hover .inner { fill: var(--yellow); stroke: var(--yellow); }
.shape.active:hover .fill { stroke: var(--ink); }
.shape.gap .fill { fill: transparent; stroke-dasharray: 4 5; stroke-opacity: .45; }
.shape.gap.active:hover .fill { fill: rgba(253, 227, 88, .65); stroke-opacity: 1; }
.shape.found .fill { fill: var(--ink); stroke-opacity: 1; }
.shape.gap.found .fill { fill: rgba(30, 74, 95, .85); stroke-dasharray: none; }
.shape.tube .outer { fill: none; stroke: var(--ink); stroke-linecap: round; stroke-linejoin: round; }
.shape.tube .inner { fill: none; stroke: var(--bg); stroke-linecap: round; stroke-linejoin: round; }
.shape.tube.found .inner { stroke: var(--ink); }
.shape.tube.context .outer { stroke-opacity: .3; }
.shape.tube.active:hover .inner { stroke: var(--yellow); fill: none; }
.shape.tube .hit { fill: none; }
.shape.active.tube .hit { pointer-events: stroke; } /* a tube is a line: never claim the area it curves around */
.shape.decor .filled { fill: var(--bg); stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.shape.decor .wiggle { fill: none; stroke: var(--ink); stroke-opacity: .17; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.shape.decor .line { fill: none; stroke: var(--ink); stroke-opacity: .55; stroke-linecap: round; stroke-dasharray: 1 6; }
.shape.decor .dot { fill: var(--ink); opacity: .5; }
.shape.wrong { animation: shrink .85s ease-in forwards; }
.shape.wrong .fill, .shape.wrong .inner { fill: var(--yellow); stroke: var(--yellow); }
@keyframes shrink { 0%, 30% { transform: scale(1); opacity: 1; } 100% { transform: scale(.5); opacity: 0; } }
.shape.reveal .fill { animation: pulse .5s steps(1) infinite alternate; stroke-width: 3; }
.shape.reveal .inner { animation: pulse-stroke .5s steps(1) infinite alternate; }
@keyframes pulse { from { fill: var(--yellow); } to { fill: var(--bg); } }
@keyframes pulse-stroke { from { stroke: var(--yellow); } to { stroke: var(--bg); } }
.shape.pop { animation: pop .55s ease-out; }
@keyframes pop { 35% { transform: scale(1.06); } }
.shape.flash .fill { fill: var(--yellow); }
.spark { fill: none; stroke: var(--yellow); stroke-width: 3; transform-box: fill-box; transform-origin: center; animation: ring .8s ease-out forwards; pointer-events: none; }
@keyframes ring { from { transform: scale(1); opacity: 1; } to { transform: scale(8); opacity: 0; } }
.spark-dot { fill: var(--yellow); stroke: var(--ink); stroke-width: 1.5; filter: drop-shadow(0 0 7px var(--yellow)); animation: glow .8s ease-out forwards; pointer-events: none; }
@keyframes glow { to { opacity: 0; transform: scale(2.4); } }
.signal-route { fill: none; stroke: var(--yellow); stroke-width: 6; stroke-linecap: round; opacity: .9; pointer-events: none; }
.signal-dot { fill: #fff; stroke: var(--yellow); stroke-width: 3; filter: drop-shadow(0 0 9px var(--yellow)); pointer-events: none; }
.nt-flash { fill: var(--yellow); stroke: var(--ink); stroke-width: 1.2; filter: drop-shadow(0 0 5px var(--yellow)); transition: transform .75s cubic-bezier(.5, 0, .8, 1); pointer-events: none; }
.dia-controls { position: absolute; left: 14px; bottom: 14px; display: flex; gap: 8px; z-index: 3; }
.ctl { background: var(--bg); border: 1.5px solid var(--ink); border-radius: 6px; height: 36px; min-width: 36px; padding: 0 10px; font-size: 1.1rem; cursor: pointer; }

.backdrop { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.bg-link { stroke: var(--ink); stroke-opacity: .06; stroke-width: 1; }
.bg-node { fill: var(--ink); opacity: .08; transform-box: fill-box; transform-origin: center; animation: bg-pulse 5.5s ease-in-out infinite; }
@keyframes bg-pulse { 50% { opacity: .26; transform: scale(1.7); } }

/* view switcher (full run) */
.tabs { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); display: flex; gap: 6px; z-index: 6; background: var(--bg); padding: 4px; border-radius: 999px; border: 1.5px solid var(--ink); }
.tab { background: transparent; border: 0; border-radius: 999px; padding: 5px 14px; cursor: pointer; font-weight: 600; font-size: .9rem; }
.tab.on { background: var(--ink); color: var(--bg); }
.hud-spacer { flex: 1; }

/* the fact for the part you just found: plain text, bottom left, stays until the next one is found */
.caption { position: absolute; left: 24px; bottom: 84px; width: min(330px, calc(100% - 340px)); color: var(--ink); z-index: 8; opacity: 0; pointer-events: none; transition: opacity .35s; text-shadow: 0 0 8px var(--bg), 0 0 8px var(--bg); }
@media (max-width: 639px) { .caption { left: 16px; bottom: auto; top: 112px; width: calc(100% - 32px); } }
.caption.show { opacity: 1; }
.caption b { font-size: 1.15rem; }
.caption p { margin: 4px 0 0; font-size: 1rem; line-height: 1.4; }
.shape.group .fill { fill: rgba(30, 74, 95, .22); }

/* big level banner */
.banner { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; opacity: 0; z-index: 7; }
.banner div { font-size: clamp(2.6rem, 12vw, 8rem); font-weight: 800; letter-spacing: .03em; line-height: 1; }
.banner small { font-size: clamp(1rem, 3vw, 1.6rem); color: var(--soft); margin-top: 8px; }
.banner.show { animation: banner 1.9s ease-out; }
@keyframes banner { 0% { opacity: 0; transform: scale(.85); } 15% { opacity: 1; transform: scale(1); } 70% { opacity: 1; } 100% { opacity: 0; transform: scale(1.08); } }

/* overlay (picker / time up / win) */
.overlay { position: absolute; inset: 0; display: grid; place-items: start center; background: rgba(248, 249, 240, .93); z-index: 20; padding: 20px; overflow-y: auto; }
.overlay[hidden] { display: none; }
.overlay .card { margin: auto; text-align: center; max-width: 480px; width: 100%; padding: 24px 4px 28px; }
.overlay h2 { font-size: clamp(2rem, 8vw, 3rem); margin: 0 0 12px; font-weight: 700; line-height: 1.05; }
.overlay p { margin: 6px 0; font-size: 1.1rem; }
.eyebrow { margin: 0; letter-spacing: .12em; font-size: .85rem; color: var(--soft); text-transform: uppercase; }
.mode-opts { display: grid; gap: 12px; margin-top: 22px; }
.mode-opt { text-align: left; background: transparent; border: 1.5px solid var(--ink); border-radius: 10px; padding: 14px 18px; cursor: pointer; display: grid; gap: 4px; }
.mode-opt strong { font-size: 1.3rem; }
.mode-opt span { color: var(--soft); font-size: .95rem; }
.mode-opt:hover { background: rgba(253, 227, 88, .55); }
.mode-opt.last { box-shadow: inset 0 0 0 2px var(--yellow); }

.card-actions { margin-top: 22px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.stars-svg { display: inline-block; vertical-align: middle; overflow: visible; }
.star { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linejoin: round; }
.star.on { fill: var(--yellow); }
.res-stars { margin: 18px 0 8px; }
.res-lines { margin: 22px 0 6px; display: grid; gap: 16px; }
.res-line { margin: 0 !important; font-size: 1.2rem !important; }
.res-line b { font-weight: 700; }
.learned { margin-top: 24px; text-align: left; }
.learned h3 { margin: 0 0 10px; font-size: 1.15rem; }
.learned-box { border: 1.5px solid var(--ink); border-radius: 14px; padding: 8px 14px; max-height: 260px; overflow-y: auto; display: grid; gap: 10px; }
.learned-box p { margin: 0 !important; font-size: .95rem !important; line-height: 1.35; }

/* floating list */
.widget { position: absolute; z-index: 10; display: flex; flex-direction: column; background: var(--bg); border: 1.5px solid var(--ink); border-radius: 8px; box-shadow: 0 4px 14px rgba(30, 74, 95, .18); overflow: hidden; }
.w-head { display: flex; justify-content: space-between; gap: 8px; padding: 9px 12px; border-bottom: 1.5px solid var(--ink); cursor: move; font-weight: 600; user-select: none; touch-action: none; }
.w-count { font-variant-numeric: tabular-nums; font-weight: 500; }
.w-searchbar { padding: 8px 10px; border-bottom: 1px solid rgba(30, 74, 95, .25); }
.w-search { width: 100%; border: 1.5px solid var(--ink); border-radius: 6px; background: #fff; padding: 6px 10px; }
.w-list { list-style: none; margin: 0; padding: 4px 0 24px; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.w-list li[hidden] { display: none; }
.w-empty { padding: 10px 14px; color: var(--soft); }
.w-item { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 7px 14px; cursor: pointer; }
.w-item:hover { background: rgba(253, 227, 88, .5); }
.w-list li.selected .w-item { background: var(--yellow); font-weight: 600; }
.w-list li.found .w-item { text-decoration: line-through; opacity: .4; cursor: default; }
.w-grip { position: absolute; right: 0; bottom: 0; width: 22px; height: 22px; cursor: nwse-resize; touch-action: none;
  background: linear-gradient(135deg, transparent 50%, var(--ink) 50%, var(--ink) 58%, transparent 58%, transparent 70%, var(--ink) 70%, var(--ink) 78%, transparent 78%); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px); background: var(--ink); color: var(--bg); padding: 8px 16px; border-radius: 6px; opacity: 0; pointer-events: none; transition: .2s; z-index: 30; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* level map */
.mapwrap { position: absolute; inset: 0; }
svg.levelmap { width: 100%; height: 100%; display: block; cursor: default; }
.hud.ls { padding: 38px 34px 12px; }
.ls-name { font-size: clamp(1.8rem, 5vw, 2.6rem); line-height: 1.05; font-weight: 400; letter-spacing: -.01em; }
.ls-name b { font-weight: 800; }
.ls-next { margin-top: 16px; font-size: clamp(1.05rem, 2.6vw, 1.3rem); }
.ls-next b { font-weight: 700; }
.lm .shape .fill { transition: fill .8s; stroke-width: 1.2; }
.lm .shape.done .fill { fill: rgba(30, 74, 95, .17); } /* a soft tint, so the folds and details stay visible */
.lm .shape.current .fill { fill: var(--yellow); animation: region-pulse 1.6s ease-in-out infinite alternate; }
.lm .shape.tube.done .inner { stroke: color-mix(in srgb, var(--ink) 20%, var(--bg)); }
.lm .shape.tube.current .inner { stroke: var(--yellow); }
.lm .shape.locked .fill { stroke-opacity: .35; }
.lm .shape * { pointer-events: none; }
@keyframes region-pulse { from { fill-opacity: .55; } to { fill-opacity: 1; } }
.lm-caption { font-size: 15px; font-weight: 700; fill: var(--ink); text-anchor: middle; paint-order: stroke; stroke: var(--bg); stroke-width: 6px; stroke-linejoin: round; pointer-events: none; }
.ls-trail { fill: none; stroke: var(--ink); stroke-width: 2; stroke-dasharray: 2 8; stroke-linecap: round; opacity: .7; }
.ls-node { cursor: pointer; }
.ls-node.locked { cursor: not-allowed; }
.ls-ring { fill: var(--bg); stroke: var(--ink); stroke-width: 2; transition: fill .6s; }
.ls-node.current .ls-ring { fill: var(--yellow); animation: node-pulse 1.1s ease-in-out infinite alternate; }
.ls-node.done .ls-ring { fill: var(--ink); }
.ls-node.locked .ls-ring { stroke-opacity: .45; stroke-dasharray: 4 3; }
@keyframes node-pulse { from { stroke-width: 2; } to { stroke-width: 6; } }
.ls-num { text-anchor: middle; font-weight: 700; font-size: 18px; fill: var(--ink); pointer-events: none; }
.ls-node.done .ls-num { fill: var(--bg); }
.ls-node.locked .ls-num { opacity: .4; }
.ls-label { text-anchor: middle; font-size: 17px; font-weight: 700; fill: var(--ink); paint-order: stroke; stroke: var(--bg); stroke-width: 9px; stroke-linejoin: round; pointer-events: none; }
.ls-node.locked .ls-label { opacity: .55; }
.ls-stars .star { stroke-width: 1.4; }

@media (max-width: 520px) { .timer { font-size: 1.8rem; } .count { display: none; } .hud { padding: 10px; } .hud.ls { padding: 22px 20px 6px; } }
@media (prefers-reduced-motion: reduce) { .banner.show { animation-duration: 1.9s; } .bg-node, .spark, .spark-dot { animation: none; } }

/* Arriving from the Games page: the navy circle shrinks away to reveal the game. */
html.portal-in::after { content: ""; position: fixed; inset: 0; z-index: 500; pointer-events: none; background: #1E4A5F; clip-path: circle(150vmax at var(--px) var(--py)); animation: portal-out .9s cubic-bezier(.7, 0, .3, 1) .12s forwards; }
@keyframes portal-out { to { clip-path: circle(0 at var(--px) var(--py)); } }
@media (prefers-reduced-motion: reduce) { html.portal-in::after { display: none; } }

/* practice prompt */
.prompt { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); z-index: 6; text-align: center; background: var(--bg); border: 1.5px solid var(--ink); border-radius: 12px; padding: 8px 22px; }
.prompt-label { display: block; font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--soft); }
.prompt-name { font-size: clamp(1.4rem, 5vw, 2.1rem); font-weight: 800; line-height: 1.1; }

/* the two rounds of a level */
.round-opts { display: flex; gap: 10px; justify-content: center; margin: 22px 0 18px; flex-wrap: wrap; }
.round-opt { display: inline-flex; align-items: center; gap: 8px; background: transparent; border: 1.5px solid var(--ink); border-radius: 999px; padding: 6px 16px 6px 8px; font: inherit; font-weight: 600; color: var(--ink); cursor: pointer; }
.round-opt .round-n { display: inline-grid; place-items: center; min-width: 30px; height: 24px; padding: 0 6px; border-radius: 999px; border: 1.5px solid var(--ink); font-size: .85rem; }
.round-opt.on { background: var(--ink); color: var(--bg); }
.round-opt.on .round-n { border-color: var(--bg); }
.round-opt:not(.on):hover { background: rgba(253, 227, 88, .55); }
.ls-dot { fill: var(--bg); stroke: var(--ink); stroke-width: 1.5; }
.ls-dot.on { fill: var(--ink); }
.ls-node.locked .ls-dots { display: none; }
/* the brainstem is the sleeve around midbrain, pons and medulla: shade it lighter so its pieces still read */
.shape[data-shape="brainstem"].found .fill { fill: rgba(30, 74, 95, .3); }
