/* Babel: one stylesheet, design tokens first. */
:root {
  --bg: #f1f6f6;
  --surface: #ffffff;
  --surface-2: #f7fafa;
  --ink: #12181c;
  --ink-2: #48535a;
  --ink-3: #677278;
  --line: #e1e8e9;
  --line-2: #cfd8da;
  --blue: #2d6cf3;
  --blue-hover: #1f58d6;
  --blue-soft: #e8effe;
  --ok: #1b7a50;
  --ok-soft: #e4f3ec;
  --warn: #9a6200;
  --warn-soft: #fbf1dc;
  --bad: #b3261e;
  --bad-soft: #fbe9e7;
  --accent: #2d6cf3;          /* filled buttons (the dark theme's are near-white with black text) */
  --accent-hover: #1f58d6;
  --on-accent: #ffffff;
  --on-ink: #ffffff;          /* text on an var(--ink) background */
  --glass: rgba(255, 255, 255, .86);  /* translucent surface over art or the map */
  --backdrop: rgba(18, 24, 28, .35);
  --radius: 16px;
  --radius-s: 10px;
  --shadow: 0 1px 2px rgba(18, 24, 28, .06), 0 8px 24px rgba(18, 24, 28, .07);
  --shadow-lift: 0 2px 4px rgba(18, 24, 28, .06), 0 18px 40px rgba(18, 24, 28, .12);
  --font-display: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --page: min(1360px, 100% - 32px);
  --blue-ink: #1d4fbf;        /* blue text on --blue-soft */
  --ok-line: #c6e5d6;         /* borders around the *-soft tints */
  --warn-line: #f0dcb2;
  --bad-line: #f2c6c1;
  --blue-line: #cddcfb;
  --ok-solid: #1b7a50;        /* status fills under a white glyph (step icons) */
  --blue-solid: #2d6cf3;
  --bad-solid: #b3261e;
  --warn-solid: #d89a16;
  --on-warn-solid: #12181c;   /* white on the amber is 2.5:1, so a dark glyph in both themes */
  --placeholder: #98a2a8;
  --img-bg: #dde5e7;          /* behind images while they load */
  color-scheme: light;
}
/* Dark theme (static/theme.js sets data-theme). Screen only: printing always uses the light colours.
   Monochrome: black, true greys (R = G = B) and white; only red, amber, green and orange keep a hue. The --blue-*
   tokens keep their names (the rules are shared) but are white and greys here. Text on --surface-2: --ink 14.9:1,
   --ink-2 8.4:1, --ink-3 5.4:1 (4.7:1 on the lightest dark fill, #262626). */
@media screen {
  :root[data-theme="dark"] {
    --bg: #0a0a0a;
    --surface: #121212;
    --surface-2: #1a1a1a;
    --ink: #ededed;
    --ink-2: #b4b4b4;
    --ink-3: #8f8f8f;
    --line: #262626;
    --line-2: #383838;
    --blue: #f5f5f5;            /* links (underlined in this theme), focus rings, Babel's own marks */
    --blue-hover: #ffffff;
    --blue-soft: #242424;
    --ok: #52c792;
    --ok-soft: #10291e;
    --warn: #e6ad45;
    --warn-soft: #2c2412;
    --bad: #ff8f84;
    --bad-soft: #351a19;
    --accent: #ededed;          /* filled buttons: near-white, black text (16.9:1) */
    --accent-hover: #ffffff;
    --on-accent: #0a0a0a;
    --on-ink: #0a0a0a;
    --glass: rgba(18, 18, 18, .82);
    --backdrop: rgba(0, 0, 0, .6);
    --shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 8px 24px rgba(0, 0, 0, .35);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, .45), 0 18px 40px rgba(0, 0, 0, .55);
    --blue-ink: #e0e0e0;
    --ok-line: #1f4a37;
    --warn-line: #574519;
    --bad-line: #5e2b28;
    --blue-line: #4a4a4a;
    --ok-solid: #1f8a5b;
    --blue-solid: #5e5e5e;      /* under the white "?" step glyph: 6.5:1 */
    --bad-solid: #d23b31;
    --on-warn-solid: #0a0a0a;
    --placeholder: #7d7d7d;     /* 4.5:1 on --surface */
    --img-bg: #1f1f1f;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.55 var(--font-body); -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
[tabindex="-1"]:focus { outline: none; }  /* headings that only receive focus from code, to move screen readers */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: 16px; top: -48px; z-index: 50; background: var(--ink); color: var(--on-ink);
  padding: 10px 14px; border-radius: 8px; text-decoration: none; }
.skip-link:focus { top: 12px; }

/* ---------------------------------------------------------------- type */
.display { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.035em; line-height: 1.02;
  margin: 0; color: var(--ink); font-optical-sizing: auto; }
.hero .display { font-size: clamp(2.5rem, 5.4vw, 4.6rem); }
.display-page { font-size: clamp(2.2rem, 4.4vw, 3.6rem); }
.display-section { font-size: clamp(1.9rem, 3.4vw, 2.8rem); }
.eyebrow { margin: 0 0 14px; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.lede { margin: 18px auto 0; max-width: 37rem; font-size: 17px; color: var(--ink-2); }
.lede-small { font-size: 16px; color: var(--ink-3); }
.help { margin: 8px 0 0; font-size: 13.5px; color: var(--ink-3); }
.muted { color: var(--ink-3); }
.field-error { margin: 8px 0 0; font-size: 14px; color: var(--bad); font-weight: 500; }
code { font: 13.5px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }

/* ---------------------------------------------------------------- buttons, links */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px;
  padding: 0 16px; border-radius: var(--radius-s); border: 1px solid transparent; font-weight: 500; font-size: 15px;
  text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .15s, box-shadow .15s; }
.button-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 1px 2px rgba(45, 108, 243, .35), inset 0 1px 0 rgba(255, 255, 255, .16); }
.button-primary:hover { background: var(--accent-hover); }
.button-secondary { background: var(--surface); border-color: var(--line-2); color: var(--ink); }
.button-secondary:hover { background: var(--surface-2); }
.button-large { min-height: 50px; padding: 0 26px; font-size: 16px; }
.button[disabled], .button[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.button[aria-busy="true"]::before, .spinner { content: ""; width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
.link { color: var(--blue); text-decoration: none; font-weight: 500; }
.link:hover { text-decoration: underline; }
.link-button { background: none; border: 0; padding: 0; color: var(--blue); font-weight: 500; cursor: pointer; }
.link-button:hover { text-decoration: underline; }
.icon-button { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  font-size: 22px; line-height: 1; cursor: pointer; color: var(--ink-2); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- frame + nav */
.frame-top, .frame-bottom { width: var(--page); margin-inline: auto; background: var(--surface);
  border: 1px solid var(--line); }
.frame-top { margin-top: 16px; border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; }
.frame-bottom { border-top: 0; border-radius: 0 0 var(--radius) var(--radius); padding: 0 12px; overflow: hidden; }
body[data-view="working"] .frame-top { background: transparent; border-color: transparent; }
/* The nav: the logo; How it works, Take the tour and Ask AI agent in a pill group; GitHub, the theme switch and the
   main button. --nav-pill is the group's fill, --nav-hover a link's fill under the pointer. */
.nav { --nav-pill: var(--surface-2); --nav-hover: var(--surface);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; padding: 14px 32px; min-height: 72px; }
@media screen { :root[data-theme="dark"] .nav { --nav-pill: #161616; --nav-hover: #262626; } }
.logo { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; font-weight: 650; font-size: 21px;
  letter-spacing: -0.02em; justify-self: start; border-radius: 10px; }
.logo-mark { flex: none; width: 34px; height: 34px; object-fit: contain; transition: transform .25s ease; }
.logo:hover .logo-mark { transform: translateY(-1px) rotate(-4deg); }
.nav-links { display: flex; align-items: center; gap: 2px; padding: 4px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--nav-pill); }
.nav .nav-link { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 15px; border: 0;
  border-radius: 999px; background: none; font: 500 14.5px/1 var(--font-body); color: var(--ink-2); text-decoration: none;
  white-space: nowrap; cursor: pointer; transition: background .15s, color .15s, box-shadow .15s; }
.nav .nav-link:hover { color: var(--ink); background: var(--nav-hover); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.nav .nav-link:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.nav-icon { width: 16px; height: 16px; flex: none; fill: currentColor; }
.nav-ask .nav-spark { color: var(--blue); transition: transform .3s ease; }
.nav-ask:hover .nav-spark { transform: rotate(18deg) scale(1.1); }
.nav-actions { display: flex; align-items: center; gap: 10px; justify-self: end; }
.nav-actions .nav-github { padding: 0 12px; }
.nav-divider { width: 1px; height: 22px; margin: 0 2px; background: var(--line-2); }
.nav-actions .button-primary { min-height: 38px; padding: 0 18px; border-radius: 999px; font-size: 14.5px; }
/* "Ask AI agent" points at the assistant's launcher in the corner while it is hovered or focused. */
body:has(.nav-ask:hover, .nav-ask:focus-visible) .asst-launcher { outline: 3px solid var(--blue); outline-offset: 5px;
  transition: outline-offset .2s; }
.theme-toggle { display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 1px solid var(--line);
  border-radius: 50%; background: var(--surface); color: var(--ink-2); cursor: pointer; transition: color .15s, background .15s; }
.theme-toggle:hover { color: var(--ink); background: var(--surface-2); }
.theme-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle[aria-pressed="true"] .theme-icon-moon, .theme-toggle[aria-pressed="false"] .theme-icon-sun { display: none; }
/* Switching theme: theme.js grows the new page over the old one in a circle, so no default cross-fade. */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
.banner { position: sticky; top: 0; z-index: 40; display: flex; justify-content: center; align-items: center; gap: 10px;
  padding: 10px 16px; font-size: 14px; background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid var(--warn-line); }
.banner.is-bad { background: var(--bad-soft); color: var(--bad); border-color: var(--bad-line); }

/* ---------------------------------------------------------------- hero */
.hero { text-align: center; padding: 64px 24px 34px; }
/* The band: a dot-matrix world map (static/hero.js draws it on the canvas and places the language pins). */
.band { position: relative; border-radius: 14px; overflow: hidden; min-height: clamp(500px, 43vw, 620px); isolation: isolate;
  --hero-sea-top: #f6f9fa; --hero-sea-bottom: #dce8ed; --hero-dot: #a6b8c0; --hero-lit: #2d6cf3;
  --hero-glow: rgba(45, 108, 243, .22); --hero-grid: rgba(18, 24, 28, .06); --hero-leader: rgba(18, 24, 28, .4);
  --hero-ring: #ffffff;
  background: radial-gradient(90% 60% at 50% 22%, var(--hero-sea-top), transparent 70%),
    linear-gradient(var(--hero-sea-top), var(--hero-sea-bottom)); }
@media screen {
  :root[data-theme="dark"] .band { --hero-sea-top: #171717; --hero-sea-bottom: #050505; --hero-dot: #3b3b3b;
    --hero-lit: #f2f2f2; --hero-glow: rgba(255, 255, 255, .13); --hero-grid: rgba(255, 255, 255, .05);
    --hero-leader: rgba(255, 255, 255, .42); --hero-ring: #050505; }
  :root[data-theme="dark"] .evidence-dot { background: radial-gradient(circle at 35% 35%, #ffffff, #7a7a7a); }
  :root[data-theme="dark"] .strip-tab:not(:hover, [aria-pressed="true"]) { color: #8c8c8c; }
  :root[data-theme="dark"] .pin { box-shadow: 0 1px 3px rgba(0, 0, 0, .5); }
  :root[data-theme="dark"] .streets-note { box-shadow: 0 0 0 1px var(--map-ring), 0 1px 3px rgba(0, 0, 0, .5); }
}
.band::before { content: ""; position: absolute; inset: 0 0 auto; height: 70px; z-index: -1;
  background: linear-gradient(var(--surface), transparent); }
.hero-map, .hero-leaders { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.hero-leaders line { stroke: var(--hero-leader); stroke-width: 1; }
.hero-marker { fill: var(--hero-lit); stroke: var(--hero-ring); stroke-width: 1.6; }
.hero-pulse { fill: none; stroke: var(--hero-lit); stroke-width: 1.2; transform-box: fill-box; transform-origin: center;
  animation: hero-pulse 3.4s ease-out infinite; }
.hero-pin:nth-child(3n + 1) .hero-pulse { animation-delay: -1.1s; }
.hero-pin:nth-child(3n + 2) .hero-pulse { animation-delay: -2.3s; }
@keyframes hero-pulse { from { transform: scale(1); opacity: .75; } to { transform: scale(3.8); opacity: 0; } }
.pins { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.pin { position: absolute; left: 0; top: 0; padding: 3px 11px; font-size: 13px; font-weight: 500; line-height: 1.4;
  white-space: nowrap; color: var(--ink); background: var(--glass); border: 1px solid var(--line); border-radius: 999px;
  box-shadow: 0 1px 3px rgba(18, 24, 28, .1); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.pin.is-new { animation: pin-in .55s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--i, 0) * 60ms + 120ms); }
@keyframes pin-in { from { opacity: 0; transform: translateY(6px) scale(.96); } }

.game-card { position: relative; z-index: 2; width: min(620px, calc(100% - 32px)); margin: 18px auto 0; padding: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lift); }
.segmented { display: inline-flex; gap: 2px; padding: 3px; margin-bottom: 10px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 10px; }
.segmented [role="tab"] { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; font-size: 14px;
  white-space: nowrap;
  font-weight: 500; color: var(--ink-3); cursor: pointer; }
.segmented [role="tab"][aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(18, 24, 28, .12); }
.game-input { display: flex; gap: 8px; align-items: stretch; }
.game-input input, .game-input textarea { flex: 1; min-width: 0; border: 1px solid var(--line-2); border-radius: var(--radius-s);
  padding: 10px 14px; background: var(--surface); font-size: 15.5px; }
.game-input textarea { resize: vertical; min-height: 88px; line-height: 1.45; }
.game-input input::placeholder, .game-input textarea::placeholder { color: var(--placeholder, #98a2a8); }
.game-input input[aria-invalid="true"], .game-input textarea[aria-invalid="true"] { border-color: var(--bad); }
.game-input .button { min-height: 44px; align-self: flex-start; }
.game-card .help, .game-card .field-error { margin-left: 4px; }

.evidence-card { position: absolute; left: 28px; bottom: 28px; z-index: 2; width: min(360px, 30%);
  padding: 20px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.quote { margin: 0; font: 400 17.5px/1.38 var(--font-display); letter-spacing: -0.01em; }
.evidence-source { display: flex; align-items: center; gap: 8px; margin: 14px 0 10px; font-size: 13px; color: var(--ink-3); }
.evidence-dot { width: 22px; height: 22px; flex: none; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #7aa2ff, var(--blue)); }

.strip { display: grid; grid-template-columns: 180px 1fr; align-items: stretch; min-height: 60px; }
.strip-label { align-self: center; padding-left: 14px; font-size: 13.5px; color: var(--ink-2); }
.strip-tabs { display: grid; grid-template-columns: repeat(4, 1fr); }
.strip-tab { position: relative; border: 0; border-left: 1px solid var(--line); background: none; cursor: pointer;
  padding: 18px 12px; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; color: #8a959b; transition: color .15s; }
.strip-tab:hover, .strip-tab[aria-pressed="true"] { color: var(--ink); }
.strip-tab[aria-pressed="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--ink); }

/* ---------------------------------------------------------------- sections */
.section { width: min(1120px, 100% - 32px); margin: 0 auto; padding: 96px 0 0; }
.section-head { text-align: center; margin-bottom: 40px; }
.page-head { text-align: center; padding: 40px 24px 34px; }

.game-summary { display: flex; gap: 20px; align-items: center; padding: 18px; margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.game-summary img, .thumb-fallback { width: 184px; aspect-ratio: 460 / 215; object-fit: cover; border-radius: 10px; flex: none; }
.game-summary h3 { margin: 0; font-size: 20px; letter-spacing: -0.015em; }
.game-summary p { margin: 4px 0 0; color: var(--ink-3); font-size: 14.5px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag { padding: 3px 9px; font-size: 12.5px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.thumb-fallback { display: grid; place-items: center; font: 500 26px var(--font-display);
  color: #fff; background: linear-gradient(135deg, #7f9fb0, #3f7499); }

.notes { display: grid; gap: 8px; margin-bottom: 14px; }
.note { margin: 0; padding: 10px 14px; border-radius: var(--radius-s); font-size: 14px; background: var(--warn-soft); color: var(--warn); }
.note.is-info { background: var(--blue-soft); color: var(--blue-ink); }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; transition: box-shadow .2s, transform .2s; }
.card:hover { box-shadow: var(--shadow); }
.card img, .card .thumb-fallback { width: 100%; border-radius: 0; }
.card img, .swap-option img, .game-summary img { aspect-ratio: 460 / 215; object-fit: cover; background: var(--img-bg); }
.card-body { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px 18px; flex: 1; }
.card-title { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.3; }
.card-why { margin: 0; font-size: 14px; color: var(--ink-3); }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 8px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 500; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-swapped { background: var(--blue-soft); color: var(--blue-ink); }
.meter { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); }
.meter-bar { position: relative; width: 70px; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.meter-fill { position: absolute; inset: 0 auto 0 0; background: var(--ink-2); border-radius: 3px; }
.cards-empty { grid-column: 1 / -1; padding: 28px; text-align: center; color: var(--ink-3); background: var(--surface);
  border: 1px dashed var(--line-2); border-radius: var(--radius); }
.cards-foot { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 12px 2px 0; font-size: 13.5px; }

.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 28px 36px; margin-top: 30px; padding: 30px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.controls-title { grid-column: 1 / -1; margin: 0; font: 400 26px/1.1 var(--font-display); letter-spacing: -0.02em; }
.control > label, .control legend { display: block; margin-bottom: 8px; font-weight: 600; font-size: 15px; padding: 0; }
.input-with-unit { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: var(--radius-s);
  background: var(--surface); padding: 0 14px; }
.input-with-unit:focus-within { outline: 3px solid var(--blue); outline-offset: 1px; }
.input-with-unit input { flex: 1; min-width: 0; border: 0; outline: 0; padding: 11px 8px 11px 0; font-size: 17px;
  font-variant-numeric: tabular-nums; background: transparent; }
.unit-before input { padding: 11px 0 11px 6px; }
.input-with-unit span { color: var(--ink-3); font-size: 15px; }
.input-with-unit:has(input[aria-invalid="true"]) { border-color: var(--bad); }
.chips { display: flex; gap: 6px; margin-top: 10px; }
.chip { border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 4px 12px; font-size: 13.5px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
input[type="range"] { width: 100%; margin-top: 14px; accent-color: var(--blue); }
.options { border: 0; margin: 0; padding: 0; grid-column: 1 / -1; }
.check { display: flex; gap: 10px; align-items: center; margin-top: 8px; font-size: 15px; color: var(--ink-2); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--blue); }
.controls-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  padding-top: 6px; border-top: 1px solid var(--line); }
.controls-actions .help { margin: 0; }
.controls-actions .field-error { flex-basis: 100%; margin: 0; }

.how-grid { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; padding: 0; margin: 0; }
.how-grid li { padding: 26px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.how-grid h3 { margin: 14px 0 6px; font-size: 18px; letter-spacing: -0.015em; }
.how-grid p { margin: 0; color: var(--ink-3); font-size: 15px; }
.how-num { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font-weight: 600;
  font-size: 14px; background: var(--blue-soft); color: var(--blue); }
.agents-note { margin: 22px 0 0; text-align: center; color: var(--ink-3); font-size: 14.5px; }
.agents-note p { margin: 0; }
.agents-details { margin-top: 6px; font-size: 13.5px; }
.agents-details summary { cursor: pointer; }
.agents-details p { margin-top: 6px; }
.footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; width: min(1120px, 100% - 32px);
  margin: 96px auto 0; padding: 26px 0 40px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--ink-3); }

/* ---------------------------------------------------------------- working */
.run { width: min(760px, 100% - 32px); margin: 0 auto; padding-bottom: 24px; }
.run-card, .outcome { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.run-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.run-title { margin: 0; font-size: 16px; font-weight: 600; }
.checklist { list-style: none; margin: 0; padding: 8px 0; }
.step { display: grid; grid-template-columns: 28px 1fr auto; gap: 4px 12px; padding: 12px 22px; }
.step + .step { border-top: 1px solid var(--line); }
.step-icon { width: 22px; height: 22px; margin-top: 1px; border-radius: 50%; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: #fff; }
.step-name { font-weight: 600; font-size: 15.5px; }
.step-state { font-size: 13px; color: var(--ink-3); }
.step-messages { grid-column: 2 / -1; list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; }
.step-messages li { font-size: 14px; color: var(--ink-2); line-height: 1.45; }
.step-messages li.is-warning { color: var(--warn); }
.step-messages li.is-error { color: var(--bad); font-weight: 500; }
.step-messages li.is-input { color: var(--blue-ink); }
.step-messages li.is-explain { font-family: var(--font-display); font-size: 16px; color: var(--ink); }
.step[data-state="pending"] .step-icon { border: 2px solid var(--line-2); }
.step[data-state="pending"] .step-name { color: var(--ink-3); }
.step[data-state="running"] .step-icon { color: var(--blue); }
.step[data-state="running"] .step-icon::before { content: ""; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
.step[data-state="done"] .step-icon { background: var(--ok-solid); }
.step[data-state="done"] .step-icon::before { content: "✓"; }
.step[data-state="warning"] .step-icon { background: var(--warn-solid); color: var(--on-warn-solid); }
.step[data-state="warning"] .step-icon::before { content: "!"; }
.step[data-state="input"] .step-icon { background: var(--blue-solid); }
.step[data-state="input"] .step-icon::before { content: "?"; }
.step[data-state="failed"] .step-icon { background: var(--bad-solid); }
.step[data-state="failed"] .step-icon::before { content: "×"; font-size: 16px; }
.step[data-state="skipped"] .step-icon { border: 2px dashed var(--line-2); }

.outcome { margin-top: 18px; padding: 24px 26px; }
.outcome h2 { margin: 0 0 6px; font: 400 30px/1.1 var(--font-display); letter-spacing: -0.02em; }
.outcome p { margin: 6px 0 0; color: var(--ink-2); }
.outcome.is-bad { border-color: var(--bad-line); }
.outcome.is-bad h2 { color: var(--bad); }
.outcome.is-warn { border-color: var(--warn-line); }
.groups { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 18px 0; }
.group { padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.group h3 { margin: 0 0 8px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.group ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.group li { padding: 3px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; }
.group-full { background: var(--ok-soft); border-color: var(--ok-line); }
.explanation { margin: 16px 0 0; padding: 16px 18px; border-left: 3px solid var(--blue); background: var(--surface-2);
  border-radius: 0 10px 10px 0; font: 400 17px/1.45 var(--font-display); }
.explanation-label { display: block; margin-bottom: 6px; font: 500 12.5px var(--font-body); color: var(--ink-3); }
.outcome-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

/* ---------------------------------------------------------------- plan screen */
/* Plan-screen tokens. Map colours match static/mapdata.js palette(), validated there for each theme. */
:root {
  --map-surface: #fbfcfc;           /* behind the countries */
  --map-stroke: #ffffff;            /* between countries */
  --map-shimmer: #f3f6f6;
  --map-hatch-bg: #f4f6f6;          /* "no score": the map's hatch pattern */
  --map-hatch-ink: #aab4b8;
  --map-control: rgba(255, 255, 255, .94);
  --map-overlay: rgba(255, 255, 255, .97);
  --map-ring: transparent;          /* a hairline around floating map parts, where shadows do not show */
  --control-shadow: 0 1px 3px rgba(18, 24, 28, .1);
  --tip-bg: var(--ink);
  --tip-ink: #ffffff;
  --tip-muted: #c7d0d4;
  --tip-hint: #98a9b1;
  --swatch-ring: rgba(18, 24, 28, .14);
  --plan-translate: #2a78d6;        /* the plan's group dots: mapdata.js PLAN */
  --plan-store: #eb6834;
  --plan-skip: #b5bcb9;             /* a step darker than the map's grey, so the dot shows */
  --plan-supported: #1baf7a;
  --plan-translate-bg: #f3f7fe;
  --plan-translate-line: #d9e6fb;
  --plan-store-bg: #fef7f2;
  --plan-store-line: #f7dfcf;
  --skew-pos: #2a78d6;
  --skew-neg: #ec9890;
  --src-qloo-bg: #eaf1fe;
  --src-qloo-ink: #1d4fbf;
  --src-qloo-line: #d3e1fc;
  --src-estimate-ink: #7d5200;
  --src-llm-bg: #f3edfd;
  --src-llm-ink: #5636a3;
  --src-llm-line: #e1d3f7;
  --src-ref-bg: #eef2f1;
  --llm-bg: #faf7ff;
  --llm-line: #8b6ad8;
}
@media screen {
  :root[data-theme="dark"] {  /* monochrome, like the base tokens: the plan's store page and supported keep their hue */
    --map-surface: #0e0e0e;
    --map-stroke: #0e0e0e;
    --map-shimmer: #171717;
    --map-hatch-bg: #141414;
    --map-hatch-ink: #404040;
    --map-control: rgba(28, 28, 28, .94);
    --map-overlay: rgba(28, 28, 28, .97);
    --map-ring: var(--line-2);
    --control-shadow: 0 1px 3px rgba(0, 0, 0, .5);
    --tip-bg: #262626;
    --tip-ink: #f5f5f5;
    --tip-muted: #c4c4c4;
    --tip-hint: #a6a6a6;
    --swatch-ring: rgba(255, 255, 255, .16);
    --plan-translate: #e8e8e8;
    --plan-store: #d95926;
    --plan-skip: #606060;
    --plan-supported: #199e70;
    --plan-translate-bg: #1f1f1f;
    --plan-translate-line: #474747;
    --plan-store-bg: #241d1a;
    --plan-store-line: #4a2f22;
    --skew-pos: #cfcfcf;
    --skew-neg: #e34948;
    /* source chips told apart without hue: Qloo brighter with a firm edge, Claude (AI) dashed (rule below) */
    --src-qloo-bg: #262626;
    --src-qloo-ink: #f5f5f5;
    --src-qloo-line: #5c5c5c;
    --src-estimate-ink: #e6ad45;
    --src-llm-bg: #141414;
    --src-llm-ink: #d0d0d0;
    --src-llm-line: #707070;
    --src-ref-bg: var(--surface-2);
    --llm-bg: #171717;
    --llm-line: #a6a6a6;
  }
}
body[data-view="plan"] .frame-top { background: transparent; border-color: transparent; }
.plan-page { width: min(1240px, 100% - 32px); margin: 0 auto; padding: 22px 0 8px; display: grid;
  grid-template-columns: minmax(0, 1fr); gap: 22px; }
.plan-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px 32px; flex-wrap: wrap; padding: 18px 4px 0; }
.plan-head-text { max-width: 780px; }
.plan-head .eyebrow { margin-bottom: 10px; }
.plan-head .display-page { font-size: clamp(2.1rem, 4.2vw, 3.4rem); }
.plan-sub { margin: 14px 0 0; font-size: 17px; color: var(--ink-2); max-width: 44rem; }
.plan-chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; padding: 0; }
.chip-info { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--line); font-size: 13.5px; color: var(--ink-2); }
.chip-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.level-low .chip-dot { background: var(--warn-solid); }
.level-none .chip-dot { background: var(--bad); }
.chip-changed { background: var(--blue-soft); color: var(--blue-ink); border-color: var(--blue-line); }
.plan-actions { display: flex; flex-wrap: wrap; gap: 10px; }
#plan-alerts:empty { display: none; }

.panel-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 26px 28px 24px; box-shadow: var(--shadow); }
.section-title { margin: 0; font: 400 clamp(1.65rem, 2.6vw, 2.15rem)/1.1 var(--font-display); letter-spacing: -0.025em; }
.panel-card .eyebrow, .evidence > .eyebrow { margin-bottom: 6px; }
.src { display: inline-flex; align-items: center; padding: 0 8px; border-radius: 999px; font: 600 11px/1.75 var(--font-body);
  letter-spacing: .02em; vertical-align: middle; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.src-qloo { background: var(--src-qloo-bg); color: var(--src-qloo-ink); border-color: var(--src-qloo-line); }
.src-estimate { background: var(--warn-soft); color: var(--src-estimate-ink); border-color: var(--warn-line); }
.src-llm { background: var(--src-llm-bg); color: var(--src-llm-ink); border-color: var(--src-llm-line); }
.src-ref { background: var(--src-ref-bg); color: var(--ink-2); }

/* the map */
.explore-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 28px; flex-wrap: wrap; }
.explore-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 20px; margin: 22px 0 14px; }
.metric-switch { display: inline-flex; flex-wrap: wrap; gap: 3px; margin: 0; padding: 4px; min-width: 0; border: 1px solid var(--line);
  border-radius: 12px; background: var(--surface-2); }
.metric-option { display: grid; padding: 6px 14px; border-radius: 9px; cursor: pointer; line-height: 1.25; }
.metric-name { font-weight: 600; font-size: 14.5px; color: var(--ink-2); }
.metric-src { font-size: 11.5px; color: var(--ink-3); }
.metric-option:hover .metric-name { color: var(--ink); }
.metric-option:has(input:checked) { background: var(--surface); box-shadow: 0 1px 2px rgba(18, 24, 28, .12), 0 0 0 1px var(--line); }
.metric-option:has(input:checked) .metric-name { color: var(--ink); }
.metric-option:has(input:focus-visible) { outline: 3px solid var(--blue); outline-offset: 1px; }
.lookalike-pick { display: flex; align-items: center; gap: 10px; font-size: 14.5px; font-weight: 600; transition: opacity .15s; }
.lookalike-pick select { min-width: 0; max-width: 320px; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-s);
  background: var(--surface); font-weight: 400; font-size: 14.5px; }
.lookalike-pick.is-off { opacity: .5; }
.explore-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.map-canvas { position: relative; overflow: hidden; border-radius: 14px; border: 1px solid var(--line); background: var(--map-surface); }
.map-canvas:focus-visible { outline-offset: 2px; }
.map-svg-host { min-height: 120px; }
.map-canvas[data-state="loading"] .map-svg-host { min-height: 380px; animation: shimmer 1.4s linear infinite;
  background: linear-gradient(100deg, var(--map-shimmer) 30%, var(--map-surface) 50%, var(--map-shimmer) 70%) 0 0 / 300% 100%; }
.map-canvas[data-state="failed"] .map-svg-host { min-height: 300px; }
@keyframes shimmer { to { background-position: -150% 0; } }
.map-svg { display: block; width: 100%; height: auto; touch-action: none; cursor: grab; forced-color-adjust: none; }
.map-svg:active { cursor: grabbing; }
.country { stroke: var(--map-stroke); stroke-width: .7; vector-effect: non-scaling-stroke; cursor: pointer; transition: opacity .2s, fill .25s; }
.country.is-unknown { cursor: default; }
.country.is-dim { opacity: .22; }
.country:not(.is-unknown):hover { stroke: var(--ink); stroke-width: 1.2; }
.map-outlines path { fill: none; vector-effect: non-scaling-stroke; pointer-events: none; }
.outline-selected { stroke: var(--ink); stroke-width: 2.6; }
.outline-highlight { stroke: var(--ink); stroke-width: 1.3; }
.outline-alt { stroke: var(--ink-2); stroke-width: 1.2; stroke-dasharray: 4 3; }
.map-controls { position: absolute; top: 12px; right: 12px; display: grid; gap: 6px; }
.map-button { min-width: 36px; height: 36px; padding: 0; border: 1px solid var(--line-2); border-radius: 10px; background: var(--map-control);
  font-size: 19px; line-height: 1; color: var(--ink); cursor: pointer; box-shadow: var(--control-shadow); }
.map-button:hover { background: var(--surface-2); }
.map-button-text { padding: 0 10px; font-size: 13px; font-weight: 600; }
.map-overlay { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(440px, calc(100% - 32px)); padding: 16px 18px;
  border-radius: 14px; background: var(--map-overlay); box-shadow: 0 0 0 1px var(--map-ring), var(--shadow-lift); text-align: center; font-size: 14.5px; }
.map-overlay p { margin: 0; color: var(--ink-2); }
.map-overlay .button { margin-top: 12px; }
.map-tooltip { position: absolute; z-index: 3; display: grid; gap: 2px; max-width: 270px; padding: 9px 12px; border-radius: 10px; pointer-events: none;
  background: var(--tip-bg); color: var(--tip-ink); font-size: 13px; line-height: 1.4; box-shadow: 0 0 0 1px var(--map-ring), var(--shadow-lift); }
.map-tooltip .muted { color: var(--tip-muted); }
/* the street map of one country (static/streets.js): OpenStreetMap tiles, the country's outline, the rest dimmed */
.map-svg-host { position: relative; }
.map-streets { position: absolute; inset: 0; overflow: hidden; background: var(--map-surface); cursor: grab; touch-action: none;
  animation: streets-in .4s .2s both; }
.map-streets[hidden] { display: none; }
.map-streets:active { cursor: grabbing; }
@keyframes streets-in { from { opacity: 0; } }
.streets-tiles img { position: absolute; max-width: none; user-select: none; pointer-events: none; }
.streets-tiles img.is-failed { visibility: hidden; }  /* no broken-image icons: the outline and the note stay */
.map-streets[data-theme="dark"] .streets-tiles img { filter: grayscale(1) invert(1) brightness(.82) contrast(.9); }
.streets-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; transition: opacity .3s; }
.map-streets.is-close .streets-svg { opacity: 0; }  /* close in, the coarse outline would miss the coast: the tiles' borders take over */
.streets-mask { fill: var(--map-surface); fill-opacity: .6; fill-rule: evenodd; }
.streets-halo { fill: none; stroke: var(--ink); stroke-width: 5; stroke-linejoin: round; stroke-opacity: .6; }
.streets-outline { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; }
.streets-note { position: absolute; top: 12px; left: 12px; max-width: min(360px, calc(100% - 96px)); margin: 0; padding: 6px 10px;
  border-radius: 10px; background: var(--map-control); box-shadow: 0 0 0 1px var(--map-ring), 0 1px 3px rgba(18, 24, 28, .14);
  font-size: 12.5px; line-height: 1.35; color: var(--ink-2); }
.streets-credit { position: absolute; right: 0; bottom: 0; margin: 0; padding: 2px 8px; border-top-left-radius: 8px;
  background: var(--map-control); font-size: 11px; color: var(--ink-2); }
.streets-credit a { color: inherit; }
@media print { .map-streets { display: none; } }
.tip-hint { color: var(--tip-hint); font-size: 12px; }
.legend-wrap { margin-top: 12px; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.legend-title { flex-basis: 100%; margin: 0 0 4px; font-size: 13.5px; color: var(--ink-2); }
.legend-item { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px 4px 6px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); font-size: 13px; color: var(--ink-2); cursor: pointer; }
.legend-item:hover { border-color: var(--line-2); color: var(--ink); }
.legend-item[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.swatch { width: 14px; height: 14px; flex: none; border-radius: 4px; box-shadow: inset 0 0 0 1px var(--swatch-ring); }
.swatch-hatch { background: repeating-linear-gradient(45deg, var(--map-hatch-bg) 0 3px, var(--map-hatch-ink) 3px 4.4px); }
.legend-wrap .help { max-width: 52rem; }

/* the side panel */
.map-panel { max-height: 660px; overflow: auto; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.panel-title { margin: 2px 0 6px; font: 400 26px/1.15 var(--font-display); letter-spacing: -0.02em; }
.panel-help { margin: 0 0 12px; font-size: 14px; color: var(--ink-3); }
.panel-back { margin-bottom: 6px; font-size: 14px; }
.panel-block { padding: 14px 0 4px; margin-top: 10px; border-top: 1px solid var(--line); font-size: 14.5px; }
.panel-block:first-of-type { margin-top: 4px; }
.panel-block h4 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 14.5px; }
.panel-block p { margin: 6px 0; }
.panel-label { display: block; margin-top: 14px; font-weight: 600; font-size: 14px; }
#country-search { width: 100%; margin-top: 6px; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-s); background: var(--surface); }
.country-list { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 1px; }
.country-row { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 10px; align-items: center; width: 100%; padding: 7px 8px;
  border: 0; border-radius: 8px; background: none; text-align: left; font-size: 14px; cursor: pointer; }
.country-row:hover { background: var(--surface-2); }
.country-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.country-value { font-variant-numeric: tabular-nums; font-size: 13.5px; color: var(--ink-2); }
.country-more { margin-top: 8px; }
.lang-chip-group { display: grid; gap: 6px; margin-bottom: 10px; }
.lang-chip-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.lang-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.lang-chip, .group-tag { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; }
.lang-chip { padding: 4px 11px; border: 1px solid var(--line-2); background: var(--surface); font-size: 13.5px; cursor: pointer; }
.lang-chip:hover { background: var(--surface-2); }
.lang-chip::before, .group-tag::before, .plan-group-head h3::before { content: ""; width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--c, var(--plan-skip)); }
.group-translate_game { --c: var(--plan-translate); }
.group-store_page_only { --c: var(--plan-store); }
.group-skip { --c: var(--plan-skip); }
.group-already_supported { --c: var(--plan-supported); }
.group-tag { padding: 2px 10px; font-size: 12.5px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap; }
.panel-stat { font-size: 14.5px; }
.panel-stat strong { margin-right: 4px; font-size: 21px; font-weight: 600; letter-spacing: -0.01em; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini-table th, .mini-table td { padding: 6px; border-bottom: 1px solid var(--line); text-align: left; }
.mini-table thead th { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.mini-table td { font-variant-numeric: tabular-nums; }
.mini-table .num { text-align: right; }
.mini-table .strong { font-weight: 600; }
.lang-card { margin-top: 8px; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 14px; }
.lang-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 10px; }
.button-small { min-height: 32px; padding: 0 12px; font-size: 13.5px; }
.pill-list { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; padding: 0; }
.pill { padding: 4px 10px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); font-size: 13px; text-align: left; cursor: pointer; }
.pill:hover { background: var(--surface-2); }
.loves { margin-top: 8px; }
.loves ul { margin: 4px 0 0; padding-left: 18px; }
.loves-label { margin-right: 6px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.llm-note { margin: 10px 0 0; padding: 10px 12px; border-left: 3px solid var(--llm-line); border-radius: 0 8px 8px 0; background: var(--llm-bg); font-size: 14px; }
.method { margin-top: 16px; font-size: 14px; color: var(--ink-2); }
.method summary { cursor: pointer; font-weight: 600; }
.method-list { display: grid; gap: 6px; margin: 10px 0 0; padding-left: 20px; }
/* plain words first; the exact figures one click away */
.exact { margin-top: 8px; font-size: 13.5px; color: var(--ink-2); }
.exact > summary { width: fit-content; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-3); }
.exact > summary:hover { color: var(--ink); }
.exact[open] > summary { margin-bottom: 6px; }
.exact .method-list { margin-top: 6px; }
.plus { margin-top: 8px; }
.plus > summary { display: inline-grid; place-items: center; width: 26px; height: 26px; list-style: none; cursor: pointer;
  border: 1px solid var(--line-2); border-radius: 50%; background: var(--surface-2); color: var(--ink-2); }
.plus > summary::-webkit-details-marker { display: none; }
.plus > summary:hover { border-color: var(--ink-3); color: var(--ink); }
.plus-icon::before { content: "+"; font: 600 16px/1 var(--font-body); }
.plus[open] .plus-icon::before { content: "−"; }
.plus-body { margin-top: 8px; }

/* the plan */
.localize-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 32px; flex-wrap: wrap; }
.budget-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 28px; }
.budget-inputs { display: grid; grid-template-columns: auto 150px minmax(160px, 240px); align-items: center; gap: 12px; }
.budget-inputs label { font-weight: 600; }
.budget-inputs .input-with-unit input { padding: 8px 0 8px 6px; font-size: 16px; }
.budget-inputs input[type="range"] { margin: 0; }
.budget-stats { display: flex; gap: 26px; margin: 0; }
.budget-stats dt { font-size: 12.5px; color: var(--ink-3); }
.budget-stats dd { margin: 2px 0 0; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.budget-stats .is-estimate { font-size: 15px; font-weight: 500; line-height: 1.75; }
.localize > .help { margin-top: 12px; }
.budget-status { min-height: 1.3em; margin: 6px 0 0; font-size: 14px; color: var(--ink-2); }
.plan-groups { display: grid; gap: 14px; margin-top: 10px; transition: opacity .15s; }
.plan-groups[aria-busy="true"] { opacity: .6; }
.plan-group { padding: 16px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); }
.plan-group-translate_game { --c: var(--plan-translate); background: var(--plan-translate-bg); border-color: var(--plan-translate-line); }
.plan-group-store_page_only { --c: var(--plan-store); background: var(--plan-store-bg); border-color: var(--plan-store-line); }
.plan-group-skip { --c: var(--plan-skip); }
.plan-group-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.plan-group-head h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 16.5px; }
.plan-group-head .help { margin: 0; }
.plan-group-count { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.plan-empty { margin: 14px 0 0; }
.lang-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 10px; margin: 12px 0 0; padding: 0; }
.lang-row { display: flex; flex-direction: column; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.lang-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.lang-name { font-weight: 600; font-size: 16px; }
.lang-share { font: 500 21px/1 var(--font-display); letter-spacing: -0.01em; }
.lang-meta, .lang-cost, .lang-conf, .lang-reason { margin: 4px 0 0; font-size: 13px; line-height: 1.45; color: var(--ink-3); }
.lang-cost { color: var(--ink-2); }
.lang-cost strong, .lang-meta strong { color: var(--ink); font-weight: 600; }
.lang-conf { display: flex; align-items: center; gap: 6px; }
.lang-conf::before { content: ""; width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--ok); }
.conf-partial::before, .conf-mixed::before { background: var(--warn-solid); }
.conf-none::before { background: var(--ink-3); }
.lang-reason { color: var(--ink-2); }
.lang-row .lang-actions { margin-top: auto; padding-top: 8px; }

/* Babel vs the generic list */
.versus-about { max-width: 54rem; margin: 10px 0 14px; color: var(--ink-2); }
.table-wrap { overflow-x: auto; }
.versus-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.versus-table th, .versus-table td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.versus-table thead th { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-3); white-space: nowrap; }
.versus-table tbody th { font-weight: 600; white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.versus-table thead th:nth-child(1), .versus-table thead th:nth-child(3), .versus-table thead th:nth-child(5),
.versus-table thead th:nth-child(6) { text-align: right; }
.why-cell { min-width: 300px; font-size: 13.5px; color: var(--ink-2); }
.delta { font-weight: 600; white-space: nowrap; }
.delta-up { color: var(--ok); }
.delta-down { color: var(--bad); }
.delta-same { color: var(--ink-3); }

/* evidence */
.evidence { padding: 8px 4px 0; }
.evidence-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.evidence-card-item { padding: 20px 22px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); font-size: 14.5px; }
.evidence-card-item h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 17px; letter-spacing: -0.01em; }
.look-list { list-style: none; display: grid; gap: 10px; margin: 10px 0 0; padding: 0; }
.look-list li { display: grid; gap: 3px; }
.look-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; }
.explain-summary { margin: 8px 0; font: 400 18px/1.45 var(--font-display); }
.explain-points { margin: 0; padding-left: 18px; display: grid; gap: 8px; }
.skew-list { list-style: none; display: grid; gap: 6px; margin: 10px 0 0; padding: 0; }
.skew-row { display: grid; grid-template-columns: 112px minmax(0, 1fr) 48px; gap: 10px; align-items: center; font-size: 13.5px; }
.skew-bar { position: relative; height: 8px; border-radius: 4px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.skew-bar::before { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--ink-3); }
.skew-fill { position: absolute; left: 50%; top: 0; bottom: 0; border-radius: 0 4px 4px 0; background: var(--skew-pos); }
.skew-fill.is-neg { left: auto; right: 50%; border-radius: 4px 0 0 4px; background: var(--skew-neg); }
.skew-value { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.market { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.market h4 { margin: 0; font-size: 15px; }
.loves-line { margin: 6px 0 0; }

/* Why this recommendation? */
.dialog.dialog-wide { width: min(780px, calc(100% - 24px)); }  /* two classes: wins over .dialog, declared below */
.why-body { margin-top: 6px; }
.why-steps { list-style: none; display: grid; gap: 16px; margin: 14px 0 0; padding: 0; }
.why-step { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; }
.why-num { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--blue-soft); color: var(--blue);
  font-weight: 600; font-size: 14px; }
.why-step h3 { display: inline; margin: 0 8px 0 0; font-size: 16px; line-height: 28px; }
.why-step p { margin: 6px 0 0; font-size: 14.5px; }
.why-step .table-wrap { margin-top: 8px; }
.calc { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2);
  font: 13px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--ink); }
.why-cites { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 14px; }
.why-cites h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 15px; }
.why-cites blockquote { margin: 6px 0; padding: 8px 12px; border-left: 3px solid var(--llm-line); background: var(--llm-bg); border-radius: 0 8px 8px 0; }

/* ---------------------------------------------------------------- dialog */
.dialog { width: min(560px, calc(100% - 24px)); max-height: min(720px, calc(100% - 40px)); padding: 0; border: 0;
  border-radius: var(--radius); box-shadow: var(--shadow-lift); background: var(--surface); color: var(--ink); }
.dialog::backdrop { background: var(--backdrop, rgba(18, 24, 28, .35)); }
.dialog-inner { padding: 22px 24px 24px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog-title { margin: 0; font: 400 26px/1.15 var(--font-display); letter-spacing: -0.02em; }
.dialog-sub { display: block; margin: 18px 0 8px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.dialog input[type="search"] { width: 100%; padding: 10px 14px; border: 1px solid var(--line-2); border-radius: var(--radius-s);
  background: var(--surface); }
.swap-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.swap-option { display: grid; grid-template-columns: 74px 1fr auto; gap: 12px; align-items: center; width: 100%; padding: 8px;
  text-align: left; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; }
.swap-option:hover { border-color: var(--line-2); background: var(--surface-2); }
.swap-option img, .swap-option .thumb-fallback { width: 74px; border-radius: 6px; font-size: 16px; }
.swap-name { display: block; font-weight: 600; font-size: 14.5px; }
.swap-why { display: block; font-size: 12.5px; color: var(--ink-3); }
.swap-empty { font-size: 14px; color: var(--ink-3); }
@media screen {
  :root[data-theme="dark"] .dialog { box-shadow: 0 0 0 1px var(--line-2), var(--shadow-lift); }  /* shadows vanish on dark */
}

/* ---------------------------------------------------------------- dark theme: no hue, other cues */
/* The few colours written into rules, and what stands in for hue in the monochrome dark theme: underlined links, a
   dashed edge on Claude's chips, a dark halo that keeps map outlines visible on the near-white fills. Screen only. */
@media screen {
  :root[data-theme="dark"] .button-primary { box-shadow: 0 1px 2px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .5); }
  :root[data-theme="dark"] :is(.link, .link-button) { text-decoration: underline 1px rgba(245, 245, 245, .38);
    text-underline-offset: 3px; }
  :root[data-theme="dark"] :is(.link, .link-button):hover { text-decoration-color: currentColor; }
  :root[data-theme="dark"] ::selection { background: #ededed; color: #0a0a0a; }
  :root[data-theme="dark"] .thumb-fallback { background: linear-gradient(135deg, #5c5c5c, #242424); }
  :root[data-theme="dark"] .metric-option:has(input:checked) { box-shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 0 0 1px var(--line-2); }
  :root[data-theme="dark"] .src-llm:not(.report-sheet *) { border-style: dashed; }  /* the paper stays as printed */
  :root[data-theme="dark"] .map-canvas .map-outlines path { filter: drop-shadow(0 0 1px #000) drop-shadow(0 0 1px #000); }
  /* the Start card's tabs (their rules sit in the hero section above) */
  :root[data-theme="dark"] .segmented [role="tab"][aria-selected="true"] { box-shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 0 0 1px var(--line-2); }
}

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1020px) {
  .explore-body, .evidence-grid { grid-template-columns: minmax(0, 1fr); }
  .map-panel { max-height: none; }
  .nav { grid-template-columns: auto 1fr auto; gap: 12px; padding: 12px 20px; }
  .nav-github span { display: none; }  /* the GitHub mark alone; the link keeps its name */
  .nav-actions .nav-github { padding: 0 9px; }
  .evidence-card { position: relative; left: auto; bottom: auto; width: auto; margin: 300px 16px 16px; }
  .band { min-height: 0; padding-bottom: 1px; }
  .cards, .how-grid { grid-template-columns: 1fr 1fr; }
  .strip { grid-template-columns: 1fr; }
  .strip-label { padding: 14px 14px 0; }
}
@media (max-width: 880px) {
  .nav .nav-how { display: none; }
}
@media (max-width: 680px) {  /* phones: the logo, Take the tour, the theme switch and Plan a game (the assistant's
                                launcher is always in the corner) */
  .frame-top { margin-top: 8px; }
  .nav-links { padding: 0; border: 0; background: none; }
  .nav .nav-ask, .nav .nav-github, .nav-divider { display: none; }
  .nav .nav-link { padding: 0 10px; }
  .hero { padding: 44px 8px 28px; }
  .frame-bottom { padding: 0 6px; }
  .segmented { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
  .segmented [role="tab"] { padding: 6px 4px; font-size: 13.5px; }
  .game-input { flex-direction: column; }
  .game-input .button { align-self: stretch; }
  .evidence-card { margin-top: 230px; }
  .pin { padding: 2px 9px; font-size: 12px; }
  .strip-tabs { grid-template-columns: 1fr 1fr; }
  .strip-tab { border-left: 0; border-top: 1px solid var(--line); }
  .cards, .how-grid, .controls, .groups { grid-template-columns: 1fr; }
  .controls { padding: 22px 18px; }
  .game-summary { flex-direction: column; align-items: flex-start; }
  .game-summary img, .game-summary .thumb-fallback { width: 100%; }
  .section { padding-top: 64px; }
  .step { padding: 12px 16px; }
  .plan-page { width: calc(100% - 16px); gap: 16px; }
  .plan-head { padding: 8px 4px 0; }
  .plan-actions { width: 100%; }
  .plan-actions .button { flex: 1 1 auto; }
  .panel-card { padding: 18px 14px; border-radius: 16px; }
  .metric-switch { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .metric-option { padding: 6px 10px; }
  .lookalike-pick { width: 100%; }
  .lookalike-pick select { flex: 1; max-width: none; }
  .map-controls { position: static; display: flex; justify-content: flex-end; gap: 6px; padding: 8px; border-top: 1px solid var(--line); }
  .map-overlay { top: 40%; }
  .map-panel { padding: 14px; }
  .budget-bar, .budget-inputs { width: 100%; }
  .budget-inputs { grid-template-columns: auto minmax(0, 1fr); }
  .budget-inputs input[type="range"] { grid-column: 1 / -1; }
  .budget-stats { flex-wrap: wrap; gap: 10px 20px; }
  .versus-table, .versus-table tbody { display: block; }
  .versus-table thead { display: none; }
  .versus-table tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .versus-table td, .versus-table tbody th { padding: 0; border: 0; text-align: left; }
  .versus-table td[data-label="Babel"] { font-weight: 600; }
  .versus-table td[data-label="Usual list"]::before, .versus-table td[data-label="Share (estimate)"]::before,
  .versus-table td[data-label="Qloo adjustment"]::before { content: attr(data-label) " "; color: var(--ink-3); font-size: 12.5px; }
  .why-cell { flex-basis: 100%; min-width: 0; }
  .evidence-card-item { padding: 16px; }
  .skew-row { grid-template-columns: 96px minmax(0, 1fr) 44px; }
}
@media (max-width: 440px) {  /* small phones: logo, tour, theme switch and "Plan a game" share one row */
  .frame-top .nav { gap: 8px; padding-inline: 12px; }
  .frame-top .nav-actions { gap: 8px; }
  .nav .nav-tour { padding: 0 6px; font-size: 14px; }
  .theme-toggle { width: 34px; height: 34px; }
  .nav-actions .button-primary { min-height: 36px; padding: 0 12px; font-size: 14px; }
}
@media (max-width: 360px) {
  .logo span { display: none; }  /* the mark alone; the link keeps its name, "Babel home" */
  .logo-mark { width: 28px; height: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .step-icon, .badge::before, .pin::before { forced-color-adjust: none; }
}
