@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); }

/* ---------------- It's Times to Learn ---------------- */
.tt-stage { background: var(--bg); }
.tt-level { font-size: 1.5rem; font-weight: 700; line-height: 1; }
.tt-main { position: absolute; inset: 64px 0 0 0; overflow-y: auto; display: flex; flex-direction: column; align-items: center; padding: 8px 16px 24px; gap: 0; }
.tt-q { font-size: clamp(2.8rem, 11vw, 5.4rem); font-weight: 800; line-height: 1.05; letter-spacing: -.01em; text-align: center; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tt-q.len2 { font-size: clamp(2.2rem, 8.5vw, 4rem); }
.tt-q.len3 { font-size: clamp(1.7rem, 6.5vw, 3rem); }
.tt-bar { width: min(420px, 90%); height: 10px; border: 1.5px solid var(--ink); border-radius: 999px; margin: 14px 0 4px; overflow: hidden; background: transparent; }
.tt-bar__fill { height: 100%; width: 100%; background: var(--ink); transition: width .1s linear; }
.tt-bar__fill.low { background: #c0392b; animation: blink .6s steps(1) infinite alternate; }
.tt-secs { font-size: .85rem; color: var(--soft); font-variant-numeric: tabular-nums; min-height: 1.2em; }
.tt-answer { min-width: min(300px, 80%); max-width: 100%; text-align: center; font-size: clamp(2rem, 8vw, 3.2rem); font-weight: 700; padding: 6px 22px; margin: 6px 0 4px; border: 2px solid var(--ink); border-radius: 14px; background: #fff; font-variant-numeric: tabular-nums; word-break: break-all; transition: background .2s, border-color .2s; }
.tt-answer.empty { color: var(--soft); }
.tt-answer.right { background: var(--yellow); }
.tt-answer.wrong { border-style: dashed; opacity: .75; }
.tt-feedback { min-height: 4.6em; max-width: min(560px, 100%); text-align: center; font-size: 1.1rem; line-height: 1.35; display: grid; gap: 6px; align-content: start; padding-top: 6px; }
.tt-feedback.right { font-weight: 700; }
.tt-reveal b { font-weight: 800; }
.tt-hint { color: var(--soft); font-size: 1rem; }
.tt-lower { width: min(420px, 100%); margin-top: 8px; }
.tt-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; margin: 0 auto; }
.tt-key { height: 64px; font-size: 1.7rem; font-weight: 600; background: var(--bg); border: 1.5px solid var(--ink); border-radius: 12px; cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.tt-key:hover { background: rgba(253, 227, 88, .55); }
.tt-key:active { background: var(--yellow); }
.tt-key.go { background: var(--ink); color: var(--bg); }
.tt-key.go:hover { background: var(--ink); filter: brightness(1.2); }
.tt-key.back { font-size: 1.4rem; }
@media (max-width: 520px) { .tt-key { height: 52px; } .tt-main { padding-inline: 12px; } .tt-feedback { min-height: 5.2em; } }
.tt-trick-title { font-size: clamp(1.7rem, 6vw, 2.4rem) !important; }
.tt-trick-text { font-size: 1.15rem !important; line-height: 1.45; }
.tt-example { margin: 18px 0 0; text-align: left; border: 1.5px solid var(--ink); border-radius: 14px; background: rgba(253, 227, 88, .4); padding: 12px 16px; display: grid; gap: 4px; font-size: 1.05rem; line-height: 1.45; }
.tt-example__lbl { font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--soft); font-weight: 700; }

/* ladder */
.ladder-wrap { position: absolute; inset: 0; overflow-y: auto; padding: 150px 16px 60px; }
.ladder { list-style: none; margin: 0 auto; padding: 0; display: flex; flex-direction: column-reverse; align-items: center; max-width: 520px; gap: 0; background: repeating-linear-gradient(to bottom, rgba(30, 74, 95, .35) 0 5px, transparent 5px 14px) center / 2px 100% no-repeat; }
.ld-item { padding: 22px 0; transform: translateX(var(--sway, 0px)); }
.ld-node { display: grid; justify-items: center; gap: 6px; background: none; border: 0; cursor: pointer; width: 190px; font: inherit; color: var(--ink); }
.ld-ring { width: 68px; height: 68px; border-radius: 50%; border: 2.5px solid var(--ink); display: grid; place-items: center; font-size: 1.6rem; font-weight: 800; background: var(--bg); transition: transform .15s; }
.ld-node:hover:not([aria-disabled="true"]) .ld-ring { transform: scale(1.08); }
.ld-node.current .ld-ring { background: var(--yellow); animation: node-pulse 1.1s ease-in-out infinite alternate; }
.ld-node.done .ld-ring { background: var(--ink); color: var(--bg); }
.ld-node.locked { cursor: not-allowed; }
.ld-node.locked .ld-ring { border-style: dashed; opacity: .5; }
.ld-node.locked .ld-label { opacity: .5; }
.ld-node.boss .ld-ring { width: 84px; height: 84px; box-shadow: 0 0 0 5px var(--bg), 0 0 0 7px var(--ink); font-size: 2rem; }
.ld-label { font-weight: 700; font-size: 1rem; line-height: 1.15; text-align: center; background: var(--bg); padding: 0 6px; }
.ld-stars { display: flex; gap: 2px; background: var(--bg); padding: 0 4px; }
.ld-stars .star { stroke-width: 1.4; }
@keyframes node-pulse { from { box-shadow: 0 0 0 0 rgba(253, 227, 88, .0); } to { box-shadow: 0 0 0 10px rgba(253, 227, 88, .55); } }
.ld-resume { display: grid; gap: 2px; margin: 0 auto 24px; padding: 14px 24px; background: var(--yellow); border: 2px solid var(--ink); border-radius: 14px; cursor: pointer; text-align: center; font: inherit; color: var(--ink); max-width: 420px; width: 100%; }
.ld-resume b { font-size: 1.2rem; }
.hud.ls { z-index: 6; background: linear-gradient(var(--bg) 70%, transparent); }

/* modal extras (grid, tricks) */
.modal-back .modal-card.wide { width: min(760px, 100%); }
.g-scroll { overflow: auto; max-height: 60vh; border: 1.5px solid var(--ink); border-radius: 10px; }
.g-table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; text-align: center; font-size: .95rem; }
.g-table th, .g-table td { padding: 6px 4px; min-width: 36px; border: 1px solid rgba(30, 74, 95, .18); }
.g-table th { position: sticky; top: 0; background: var(--bg); z-index: 1; font-weight: 800; }
.g-table tbody th { position: sticky; left: 0; top: auto; z-index: 1; }
.g-table .g-corner { left: 0; z-index: 2; }
.g-table .hl { background: rgba(253, 227, 88, .5); }
.g-table th.hl { background: var(--yellow); }
.tr-list { display: grid; gap: 14px; margin-top: 10px; max-height: 60vh; overflow-y: auto; padding-right: 4px; }
.tr-item { border: 1.5px solid var(--ink); border-radius: 12px; padding: 12px 16px; }
.tr-item h3 { margin: 0 0 4px; font-size: 1.15rem; }
.tr-item p { margin: 4px 0 !important; font-size: 1rem; line-height: 1.4; }
.tr-ex { background: rgba(253, 227, 88, .4); border-radius: 8px; padding: 6px 10px; }
.tr-more { text-align: center; }
@media (max-height: 720px) { .tt-key { height: 52px; } .tt-q { font-size: clamp(2.2rem, 9vw, 4.2rem); } .tt-feedback { min-height: 3.6em; } }

/* ===================== US Government (set) ===================== */
html.dnd-active, html.dnd-active * { cursor: grabbing !important; user-select: none !important; -webkit-user-select: none !important; }
.dnd-ghost { box-shadow: 0 14px 28px -10px rgba(30, 74, 95, .55); opacity: .96; }
.dnd-dragging { opacity: .3; }
.dnd-over { outline: 3px solid var(--yellow); outline-offset: 2px; background: rgba(253, 227, 88, .5) !important; }
.ld-intro { text-align: center; margin: 0 auto 28px; max-width: 30rem; color: var(--soft); }
.ld-sub { font-size: .8rem; color: var(--soft); background: var(--bg); padding: 0 6px; text-align: center; line-height: 1.2; }
.ladder-wrap .ld-node.locked .ld-sub { opacity: .5; }
.ld-node { width: 220px; }

/* ---- Build the Government ---- */
.gv-stage { display: flex; flex-direction: column; }
.gv-wrap { position: absolute; inset: 64px 0 0 0; display: flex; flex-direction: column; }
.gv-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px 16px 60px; }
.gv-tree { position: relative; max-width: 760px; margin: 0 auto; }
.gv-const { text-align: center; border: 2px solid var(--ink); border-radius: 14px; padding: 14px 18px; background: var(--ink); color: var(--bg); display: grid; gap: 4px; }
.gv-const b { font-size: 1.5rem; }
.gv-const span { font-size: .95rem; opacity: .9; font-style: italic; }
.gv-kids { list-style: none; margin: 0; padding: 0 0 0 18px; position: relative; }
.gv-kids:empty { display: none; }
.gv-top { padding-left: 14px; margin-top: 10px; }
.gv-node { position: relative; padding: 10px 0 0 18px; }
.gv-node::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; border-left: 2px solid rgba(30, 74, 95, .45); }
.gv-node:last-child::before { bottom: auto; height: 34px; }
.gv-node::after { content: ""; position: absolute; left: 0; top: 34px; width: 16px; border-top: 2px solid rgba(30, 74, 95, .45); }
.gv-office, .gv-slot { display: grid; gap: 2px; width: 100%; text-align: left; border-radius: 12px; padding: 10px 14px; font: inherit; color: var(--ink); }
.gv-office { border: 2px solid var(--ink); background: var(--yellow); cursor: default; }
button.gv-office { cursor: pointer; }
button.gv-office:hover { filter: brightness(1.06); box-shadow: 0 0 0 2px var(--ink); }
.gv-name { font-size: 1.05rem; line-height: 1.2; }
.gv-say { font-size: .88rem; line-height: 1.35; color: var(--ink); opacity: .8; }
.gv-office.snap { animation: gv-snap .55s ease-out; }
@keyframes gv-snap { 0% { transform: scale(.92); background: var(--yellow); } 60% { transform: scale(1.03); } 100% { transform: none; } }
.gv-slot { border: 2px dashed var(--ink); background: transparent; min-height: 54px; align-content: center; cursor: pointer; }
.gv-clue { font-size: .95rem; line-height: 1.3; }
.gv-clue::before { content: "?  "; font-weight: 800; }
.gv-scroll.choosing .gv-slot { background: rgba(253, 227, 88, .3); }
.gv-slot.hint { animation: gv-pulse .55s steps(1) infinite alternate; border-style: solid; }
@keyframes gv-pulse { from { background: var(--yellow); } to { background: transparent; } }
.gv-slot.nope { animation: shake .4s; }
.gv-help { margin: 0 0 8px; font-size: .8rem; line-height: 1.35; color: var(--soft); }
.usg-panel { box-shadow: 0 14px 34px -12px rgba(30, 74, 95, .55); z-index: 30; }
.usg-panel.folded { height: auto !important; }
.usg-panel.folded .usg-panel-body, .usg-panel.folded .w-grip { display: none; }
.usg-head-r { display: inline-flex; align-items: center; gap: 8px; }
.usg-fold { border: 1.5px solid var(--ink); background: var(--bg); width: 26px; height: 26px; border-radius: 6px; font: inherit; font-weight: 800; line-height: 1; cursor: pointer; color: var(--ink); }
.usg-panel-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 8px 16px 26px; overscroll-behavior: contain; }
.gv-cards { display: grid; gap: 8px; }
.gv-card { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 14px; border: 2px solid var(--ink); border-radius: 12px; background: var(--bg); font: inherit; font-weight: 700; line-height: 1.2; cursor: grab; touch-action: none; text-align: left; user-select: none; -webkit-user-select: none; color: var(--ink); }
.gv-card:hover { background: rgba(253, 227, 88, .5); }
.gv-card.sel { background: var(--yellow); box-shadow: 0 0 0 3px var(--ink); }
.gv-card-name { flex: 1 1 auto; }
.gv-said { flex: 0 0 auto; padding: 8px 16px; font-size: .95rem; line-height: 1.35; text-align: center; background: rgba(253, 227, 88, .35); border-top: 1px solid rgba(30, 74, 95, .25); min-height: 3.1em; opacity: 0; transition: opacity .3s; }
.gv-said.show { opacity: 1; }
.gv-said:empty { display: none; }
/* finale */
.gv-scroll.finale .gv-tree { padding-right: 78px; }
.gv-legend { display: grid; gap: 6px; margin: 12px 0 4px; padding: 12px 14px; border: 2px solid var(--ink); border-radius: 12px; background: rgba(253, 227, 88, .3); }
.gv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.gv-chip { display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--ink); background: var(--bg); border-radius: 999px; padding: 3px 10px 3px 4px; font: inherit; font-size: .85rem; cursor: pointer; }
.gv-chip i { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); color: var(--bg); font-style: normal; font-size: .75rem; font-weight: 700; }
.gv-chip:hover { background: var(--yellow); }
.gv-checks { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.gv-line { fill: none; stroke: var(--ink); stroke-width: 2; stroke-opacity: .7; }
.gv-badge { pointer-events: all; cursor: pointer; }
.gv-badge circle { fill: var(--yellow); stroke: var(--ink); stroke-width: 2; }
.gv-badge text { text-anchor: middle; font-size: 12px; font-weight: 800; fill: var(--ink); pointer-events: none; }
.gv-badge:hover circle { fill: var(--ink); }
.gv-badge:hover text { fill: var(--bg); }

/* ---- From Idea to Law ---- */
.lw-board { position: absolute; inset: 64px 0 0 0; overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 8px 16px 24px; }
.lw-recap { margin: 0; min-height: 0; max-width: 640px; text-align: center; font-size: .9rem; color: var(--soft); opacity: 0; transition: opacity .4s; }
.lw-recap.on { opacity: 1; min-height: 1.4em; }
.lw-row { display: flex; align-items: center; justify-content: center; gap: 14px; width: min(640px, 100%); }
.lw-trail { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: 640px; }
.lw-chip { font-size: .8rem; padding: 3px 10px; border-radius: 999px; border: 1.5px solid var(--ink); background: var(--bg); }
.lw-chip.past { background: var(--ink); color: var(--bg); }
.lw-chip.now { background: var(--yellow); }
.lw-bubble { position: relative; flex: 1 1 auto; max-width: 560px; border: 2px solid var(--ink); border-radius: 16px; padding: 12px 16px; background: #fff; text-align: center; line-height: 1.4; margin-top: 4px; }
.lw-bubble::after { content: ""; position: absolute; left: 50%; bottom: -11px; width: 18px; height: 18px; background: #fff; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: translateX(-50%) rotate(45deg); }
.lw-bubble p { margin: 4px 0; }
.lw-say { color: var(--soft); font-size: .95rem; }
.lw-ask { font-weight: 700; font-size: 1.1rem; }
.lw-bubble.good { background: rgba(253, 227, 88, .55); }
.lw-bubble.good::after { background: #f9ec9a; }
.lw-bubble.oops { background: #fff4f0; }
.lw-hint::before { content: "Hint: "; font-weight: 800; }
.lw-markbox { min-height: 132px; display: grid; place-items: center; margin-top: 8px; }
.lw-mark { background: none; border: 0; padding: 0; position: relative; z-index: 3; }
.lw-mark.shake { animation: shake .4s; }
.mark svg { display: block; overflow: visible; }
.lw-next { margin-top: 4px; }
.lw-doors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: min(640px, 100%); margin-top: 6px; align-self: end; }
@media (max-width: 520px) { .lw-doors { grid-template-columns: 1fr; } .lw-markbox { min-height: 120px; } }
.lw-door { display: flex; align-items: center; gap: 10px; text-align: left; border: 2px solid var(--ink); border-radius: 14px; background: var(--bg); padding: 12px 14px; font: inherit; font-weight: 600; line-height: 1.25; cursor: pointer; min-height: 62px; color: var(--ink); }
.lw-door-ic { flex: 0 0 auto; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--ink); font-size: .9rem; }
.lw-door:hover:not(:disabled) { background: rgba(253, 227, 88, .5); }
.lw-door:disabled { opacity: .45; cursor: default; }
.lw-door.right { opacity: 1; background: var(--yellow); }
.lw-door.hint { animation: gv-pulse .55s steps(1) infinite alternate; border-style: dashed; }
.lw-end { display: grid; justify-items: center; gap: 4px; margin-top: 8px; }
.ld-intro .mark { display: block; margin: 0 auto 6px; }

/* ---- Who's in Charge? ---- */
.wc-board { position: absolute; inset: 64px 0 0 0; overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 6px 16px 24px; }
.wc-help { margin: 0; font-size: .85rem; color: var(--soft); text-align: center; }
.wc-cardbox { width: min(560px, 100%); min-height: 120px; display: grid; place-items: center; margin-top: 4px; }
.wc-card { width: 100%; display: grid; gap: 6px; padding: 16px 20px; border: 2.5px solid var(--ink); border-radius: 16px; background: #fff; box-shadow: 0 8px 18px -12px rgba(30, 74, 95, .6); font: inherit; color: var(--ink); cursor: grab; touch-action: none; text-align: left; user-select: none; -webkit-user-select: none; }
.wc-card-n { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--soft); font-weight: 700; }
.wc-card-text { font-size: clamp(1.15rem, 3.4vw, 1.5rem); line-height: 1.35; font-weight: 600; }
.wc-card.held { box-shadow: 0 0 0 4px var(--yellow); }
.wc-card.shake { animation: shake .4s; }
.wc-card.done { opacity: .55; cursor: default; }
.wc-why { width: min(560px, 100%); min-height: 3.2em; text-align: center; line-height: 1.4; font-size: 1rem; opacity: 0; transition: opacity .25s; }
.wc-why.show { opacity: 1; }
.wc-why.oops { color: var(--soft); }
.wc-tier-note { color: var(--soft); }
.wc-zones { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; width: min(900px, 100%); margin-top: 4px; }
@media (max-width: 760px) { .wc-zones { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.wc-zone { display: grid; gap: 4px; align-content: center; justify-items: start; text-align: left; min-height: 72px; padding: 10px 12px; border: 2px solid var(--ink); border-radius: 14px; background: var(--bg); font: inherit; color: var(--ink); cursor: pointer; }
.wc-zone:hover:not(:disabled) { background: rgba(253, 227, 88, .5); }
.wc-zone:disabled { opacity: .4; cursor: default; }
.wc-zone.right { opacity: 1; background: var(--yellow); }
.wc-zone.hint { animation: gv-pulse .55s steps(1) infinite alternate; border-style: dashed; }
.wc-tier { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 800; padding: 1px 8px; border-radius: 999px; border: 1.5px solid var(--ink); }
.t-federal .wc-tier { background: var(--ink); color: var(--bg); }
.t-state .wc-tier { background: var(--yellow); }
.t-local .wc-tier { background: var(--bg); }
.wc-office { font-weight: 700; line-height: 1.2; font-size: .98rem; }

/* ---- the set page ---- */
body:has(.usg-page) { overflow: auto; }
.usg-page { position: absolute; inset: 0; overflow-y: auto; padding: 24px 16px 60px; }
.usg-head { text-align: center; max-width: 36rem; margin: 0 auto 24px; }
.usg-head h1 { margin: 6px 0 10px; font-size: clamp(2.4rem, 8vw, 3.6rem); font-weight: 400; line-height: 1.05; }
.usg-head h1 b { font-weight: 800; }
.usg-lede { color: var(--soft); line-height: 1.45; margin: 0 0 1.1em; }
.usg-lede.usg-strong { color: var(--ink); font-weight: 700; margin: 0; }
.su-link { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }
.usg-signin { color: var(--soft); }
.usg-cards { list-style: none; margin: 0 auto; padding: 0; display: grid; gap: 14px; max-width: 46rem; }
.usg-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; padding: 16px 18px; border: 2px solid var(--ink); border-radius: 18px; background: #fff; }
.usg-n { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; border: 2.5px solid var(--ink); font-size: 1.4rem; font-weight: 800; background: var(--yellow); }
.usg-card.complete .usg-n { background: var(--ink); color: var(--bg); }
.usg-body h2 { margin: 0 0 4px; font-size: 1.5rem; font-weight: 500; line-height: 1.1; }
.usg-body h2 b { font-weight: 800; }
.usg-body p { margin: 0 0 8px; color: var(--soft); line-height: 1.4; font-size: .95rem; }
.usg-meta { display: flex; gap: 14px; font-size: .85rem; font-weight: 600; }
.usg-bar { height: 8px; border: 1.5px solid var(--ink); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.usg-bar i { display: block; height: 100%; background: var(--ink); }
@media (max-width: 600px) { .usg-card { grid-template-columns: auto 1fr; } .usg-card .text-btn { grid-column: 1 / -1; text-align: center; } }
.usg-badge-box { display: flex; align-items: center; gap: 20px; max-width: 46rem; margin: 22px auto 0; padding: 18px 22px; border: 2px dashed var(--ink); border-radius: 18px; }
.usg-badge-box.earned { border-style: solid; background: rgba(253, 227, 88, .4); }
.usg-badge-box h2 { margin: 0 0 4px; font-size: 1.4rem; }
.usg-badge-box p { margin: 4px 0; line-height: 1.4; }
@keyframes usg-pop { 0% { transform: scale(.85) rotate(-4deg); } 60% { transform: scale(1.06); } 100% { transform: none; } }
.usg-badge.earned svg { animation: usg-pop .7s ease-out; }
@media (max-width: 520px) { .usg-badge-box { flex-direction: column; text-align: center; } }
a.text-btn { display: inline-block; text-decoration: none; color: var(--ink); text-align: center; }
a.text-btn:hover { color: var(--bg); }
@media (max-width: 520px) { .lw-board { inset: 92px 0 0 0; } .wc-board { inset: 78px 0 0 0; } .tt-level { font-size: 1.2rem; } }

.lw-door.nope, .wc-zone.nope { animation: shake .4s; }
.lw-door span:last-child { flex: 1 1 auto; text-wrap: balance; }
.usg-done { margin-top: 18px; padding: 14px 16px; border: 2px solid var(--ink); border-radius: 14px; background: rgba(253, 227, 88, .4); display: grid; gap: 8px; justify-items: center; }
.usg-done h3 { margin: 0; font-size: 1.25rem; }
.usg-done p { margin: 0 !important; font-size: 1rem !important; line-height: 1.4; }
.lw-end-text { display: grid; gap: 1.1em; margin: 6px 0 4px; }
.lw-end-text p { margin: 0 !important; }
.sfx-btn { min-width: 6.2rem; }
/* tidy line breaks everywhere in this set: no long first line with a short last line */
.usg-set, .usg-page p, .usg-page h1, .usg-page h2, .overlay h2, .overlay p, .overlay .card p, .gv-say, .gv-clue, .gv-said, .gv-help, .gv-const span,
.lw-say, .lw-ask, .lw-good, .lw-hint, .lw-bubble p, .lw-end-text p, .wc-card-text, .wc-why, .wc-why div, .wc-help, .wc-office, .learned-box p, .usg-done p, .ld-intro, .ld-label, .ld-sub,
.usg-lede, .usg-body p, .usg-badge-box p, .gv-name { text-wrap: balance; }

/* the sound button: "Sound on" on wide screens, just a note on phones */
.sfx-ic { display: none; font-size: 1.1rem; line-height: 1; }
.sfx-btn.is-off .sfx-ic { text-decoration: line-through; opacity: .5; }
@media (max-width: 560px) {
  .sfx-tx { display: none; }
  .sfx-ic { display: inline; }
  .sfx-btn { padding: 5px 10px; min-width: 0; }
  .hud-right { gap: 6px; flex-wrap: nowrap; }
  .hud-right .text-btn { padding: 5px 10px; }
}

/* phones: the explanation bar sits at the top so the folded Cards bar can rest along the bottom */
@media (max-width: 640px) { .gv-said { order: -1; border-top: 0; border-bottom: 1px solid rgba(30, 74, 95, .25); } .usg-panel { box-shadow: 0 8px 22px -10px rgba(30, 74, 95, .6); } .usg-panel .gv-help { display: none; } }

/* four arrangements, one per stop, so it never feels the same twice */
.lw-board.lay-a .lw-row { flex-direction: column; }
.lw-board.lay-a .lw-markbox { order: 2; }
.lw-board.lay-b .lw-row { flex-direction: row; }
.lw-board.lay-b .lw-bubble::after { left: -11px; bottom: auto; top: 28px; transform: rotate(135deg); }
.lw-board.lay-b .lw-doors { grid-template-columns: 1fr; }
.lw-board.lay-c .lw-row { flex-direction: column-reverse; }
.lw-board.lay-c .lw-bubble::after { bottom: auto; top: -11px; transform: translateX(-50%) rotate(-135deg); }
.lw-board.lay-d .lw-row { flex-direction: row-reverse; }
.lw-board.lay-d .lw-bubble::after { left: auto; right: -11px; bottom: auto; top: 28px; transform: rotate(-45deg); }
.lw-board.lay-d .lw-doors { grid-template-columns: 1fr; }
.lw-board.lay-d .lw-door { flex-direction: row-reverse; text-align: right; }
.lw-board.lay-b .lw-markbox, .lw-board.lay-d .lw-markbox { min-height: 0; flex: 0 0 auto; margin-top: 0; }
@media (max-width: 520px) {
  .lw-board.lay-b .lw-row, .lw-board.lay-d .lw-row { gap: 8px; }
  .lw-board.lay-b .lw-markbox svg, .lw-board.lay-d .lw-markbox svg { width: 64px; height: 80px; }
}
