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

/* 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; }

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

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

.hud.ls { z-index: 6; background: linear-gradient(var(--bg) 70%, transparent); }
/* 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; }
}

.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; }

/* ====================== Body of Knowledge ====================== */
.bd-stage { background: var(--bg); user-select: none; -webkit-user-select: none; }
.bd-main { position: absolute; inset: 74px 0 0 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 400px); gap: 8px; padding: 0 20px 16px; }
.bd-left { position: relative; min-height: 0; display: flex; flex-direction: column; align-items: center; }
.bd-fig { position: relative; flex: 1 1 auto; min-height: 0; width: 100%; }
.bd-view { position: absolute; inset: 0; padding: 6px 0; }
.bd-view[hidden] { display: none; }
.bd-svg.preview { opacity: .55; }
.bd-tabs { display: flex; gap: 8px; margin: 2px 0 6px; }
.bd-tabs[hidden] { display: none; }
.bd-tab { background: transparent; border: 1.5px solid var(--ink); border-radius: 999px; padding: 4px 14px; cursor: pointer; font-weight: 700; }
.bd-tab[aria-selected="true"] { background: var(--yellow); }
.bd-tab.fin { opacity: .6; }
.bd-side { display: flex; flex-direction: column; gap: 10px; min-height: 0; padding-top: 6px; }
.bd-said { min-height: 4.6em; border: 1.5px solid var(--ink); border-radius: 12px; padding: 10px 14px; font-size: 1rem; line-height: 1.35; text-wrap: balance; display: flex; flex-wrap: wrap; align-content: center; gap: 0 .3em; }
.bd-said.pop { animation: bd-pop .35s ease-out; background: rgba(253, 227, 88, .35); }
.bd-said-wrong { color: var(--ink); }
.bd-said-link { color: var(--ink); text-decoration: underline; }
@keyframes bd-pop { from { transform: scale(.97); } to { transform: scale(1); } }
.bd-cards { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 8px; padding: 2px 2px 8px; overscroll-behavior: contain; }
.bd-card { flex: 0 0 auto; border: 2px solid var(--ink); border-radius: 12px; background: var(--bg); padding: 9px 14px; font: inherit; font-weight: 700; line-height: 1.15; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; color: var(--ink); }
.bd-card:hover { background: rgba(253, 227, 88, .5); }
.bd-card.sel { background: var(--yellow); box-shadow: 0 0 0 3px var(--ink); }
.bd-card:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.bd-card.done { opacity: .45; background: var(--yellow); cursor: default; text-decoration: line-through; text-decoration-thickness: 1.5px; }
.bd-card[hidden] { display: none; }
.bd-disclaimer { text-align: center; margin: 18px 0 0 !important; }
.dnd-ghost { box-shadow: 0 8px 20px rgba(30, 74, 95, .3); }
.dnd-dragging { opacity: .3; }
html.dnd-active, html.dnd-active * { cursor: grabbing !important; user-select: none !important; -webkit-user-select: none !important; }

/* the level map: one row per section */
.bd-map { position: absolute; inset: 0; overflow-y: auto; padding: 150px 16px 110px; }
.bd-map-in { max-width: 640px; margin: 0 auto; }
.bd-intro { text-align: center; color: var(--soft); margin: 0 0 18px; text-wrap: balance; }
.bd-row { margin: 0 0 34px; }
.bd-row h2 { margin: 0; font-size: 1.5rem; }
.bd-row > p { margin: 2px 0 14px; }
.bd-nodes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; position: relative; }
.bd-nodes::before { content: ""; position: absolute; left: 10%; right: 10%; top: 34px; border-top: 2px dotted rgba(30, 74, 95, .5); }
.bd-nodes li { position: relative; display: grid; justify-items: center; }
.bd-nodes .ld-node { width: 100%; max-width: 110px; gap: 4px; }
.bd-nodes .ld-ring { width: 62px; height: 62px; font-size: 1.4rem; }
.bd-nodes .ld-node.boss .ld-ring { width: 62px; height: 62px; }
.bd-nodes .ld-label { font-size: .82rem; background: transparent; padding: 0; text-wrap: balance; }
.bd-nodes .ld-stars { background: transparent; padding: 0; }
.bd-done { margin: 12px auto 28px; padding: 16px 18px; border: 2px solid var(--ink); border-radius: 14px; text-align: center; background: rgba(253, 227, 88, .35); }
.bd-done h3 { margin: 0 0 8px; font-size: 1.3rem; }
.bd-done p { margin: 6px 0; text-wrap: balance; }
.bd-done .text-btn { display: inline-block; margin-top: 8px; text-decoration: none; }
.lb-panel { z-index: 6; }

@media (max-width: 760px) {
  .bd-main { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; inset: 74px 0 0 0; padding: 0 10px 10px; gap: 4px; }
  .bd-side { max-height: 44vh; padding-top: 0; }
  .bd-said { min-height: 3.6em; font-size: .92rem; padding: 7px 10px; }
  .bd-cards { gap: 6px; }
  .bd-card { padding: 8px 11px; font-size: .92rem; }
  .bd-map { padding-top: 130px; }
  .bd-nodes .ld-ring { width: 52px; height: 52px; font-size: 1.2rem; }
  .bd-nodes::before { top: 28px; }
  .bd-nodes .ld-label { font-size: .74rem; }
}
@media (prefers-reduced-motion: reduce) { .bd-said.pop { animation: none; } }
@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); } }
