/* ---------- Design tokens ---------- */
:root {
  --bg: #eef1f5;
  --ocean: #e4e9f0;
  --graticule: rgba(40, 60, 90, 0.07);
  --land-none: #cdd3dc;
  --land-muted: #dde1e7;
  --border: #ffffff;
  --panel: #ffffff;
  --panel-2: #f5f7fa;
  --text: #151a22;
  --text-2: #5d6675;
  --text-3: #8a93a1;
  --line: #e4e8ee;
  --accent: #2f6fed;
  --hover-stroke: #151a22;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .08);

  --l1: #3aa776;
  --l2: #e4b23a;
  --l3: #ee8433;
  --l4: #de3f46;
  --risk-normal: #a9c4b6;   /* Normal in the risk modes: calm, so Elevated and above stand out */
  /* A war's two sides (Okabe–Ito blue and reddish purple: told apart with any colour vision, and
     unlike the level colours), and the month's deadly events as dots. */
  --side-a: #0072b2;
  --side-b: #c45a95;
  --fought: #9ba4b2;
  --event-dot: rgba(21, 26, 34, .62);

  --radius: 12px;
  --panel-w: 364px;   /* 348px of content width + 16px for a classic scrollbar */
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0d12;
    --ocean: #0d1218;
    --graticule: rgba(160, 180, 210, 0.06);
    --land-none: #2a313c;
    --land-muted: #1f252e;
    --border: #0a0d12;
    --panel: #121820;
    --panel-2: #19202a;
    --text: #e7ebf1;
    --text-2: #97a1b0;
    --text-3: #6b7482;
    --line: #232b36;
    --accent: #5b8ff9;
    --hover-stroke: #ffffff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    --l1: #33a06f;
    --l2: #d6a531;
    --l3: #e57a2b;
    --l4: #e5484f;
    --risk-normal: #3b5a4c;
    --side-a: #3d9be0;
    --side-b: #d983b4;
    --fought: #5a6473;
    --event-dot: rgba(231, 235, 241, .7);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0a0d12;
  --ocean: #0d1218;
  --graticule: rgba(160, 180, 210, 0.06);
  --land-none: #2a313c;
  --land-muted: #1f252e;
  --border: #0a0d12;
  --panel: #121820;
  --panel-2: #19202a;
  --text: #e7ebf1;
  --text-2: #97a1b0;
  --text-3: #6b7482;
  --line: #232b36;
  --accent: #5b8ff9;
  --hover-stroke: #ffffff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  --l1: #33a06f;
  --l2: #d6a531;
  --l3: #e57a2b;
  --l4: #e5484f;
  --risk-normal: #3b5a4c;
  --side-a: #3d9be0;
  --side-b: #d983b4;
  --fought: #5a6473;
  --event-dot: rgba(231, 235, 241, .7);
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2 { margin: 0; }
.subtle { color: var(--text-2); font-size: 12.5px; margin: 0; }

.app {
  display: grid;
  grid-template-columns: 1fr var(--panel-w);
  height: 100vh;
  height: 100dvh;
}
.app.panel-collapsed { grid-template-columns: 1fr 0; }
.app.panel-collapsed .panel { visibility: hidden; }

/* ---------- Map ---------- */
.map-area {
  position: relative;
  overflow: hidden;
  background: var(--bg);
}
.sphere { fill: var(--ocean); }
#map { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
#map:active { cursor: grabbing; }

.graticule { fill: none; stroke: var(--graticule); stroke-width: 1; vector-effect: non-scaling-stroke; }

/* The borders between states and provinces (the U.S., Canada): thinner than a country's, and
   never in the pointer's way: a click still finds the country. */
.subdivisions {
  fill: none; stroke: var(--border); stroke-width: .5; opacity: .6;
  vector-effect: non-scaling-stroke; stroke-linejoin: round; pointer-events: none;
}
.country {
  fill: var(--land-none);
  stroke: var(--border);
  stroke-width: .6;
  vector-effect: non-scaling-stroke;
  stroke-linejoin: round;
  transition: fill .25s, opacity .25s;
  cursor: pointer;
}
.l1 { fill: var(--l1); }
.l2 { fill: var(--l2); }
.l3 { fill: var(--l3); }
.l4 { fill: var(--l4); }
.r1 { fill: var(--risk-normal); }
/* Wars: a war's sides while it is shown; the countries Wikipedia puts with a side are lighter. */
.side-a { fill: var(--side-a); }
.side-b { fill: var(--side-b); }
.fought { fill: var(--fought); }
.country.ally, .dot.ally { opacity: .55; }
/* Country names, zoomed in: a halo keeps them readable on any fill; clicks go to the map. */
.map-label {
  font-size: 11.5px; font-weight: 600; fill: var(--text);
  stroke: var(--panel); stroke-width: 3px; stroke-linejoin: round; paint-order: stroke;
  text-anchor: middle; dominant-baseline: central;
  pointer-events: none; user-select: none;
}
.country.is-muted, .dot.is-muted { fill: var(--land-muted); }
.country.is-dim, .dot.is-dim { opacity: .28; }
.country.is-polar { opacity: .45; }
.country.is-polar.is-dim { opacity: .2; }

.hover-outline, .select-outline {
  pointer-events: none;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.hover-outline { stroke: var(--hover-stroke); stroke-width: 2; filter: url(#lift); }
.hover-outline.none { fill: var(--land-none); }
.hover-outline.muted { fill: var(--land-muted); }
.select-outline { fill: none; stroke: var(--accent); stroke-width: 2.5; }

/* Overlay (screen-space) layer: small-territory dots and recent-update pulses */
.dot {
  stroke: var(--border);
  stroke-width: 1.2;
  cursor: pointer;
  transition: opacity .25s;
}
.dot.none { fill: var(--land-none); }
.dot.is-hover { stroke: var(--hover-stroke); stroke-width: 2; }
.dot.is-selected { stroke: var(--accent); stroke-width: 2.5; }

/* Event markers (earthquake, cyclone, …) and their clusters */
.marker { cursor: pointer; }
.marker .disc { stroke: var(--panel); stroke-width: 1.5; transition: stroke .15s; }
/* Minor (Green) alerts: smaller, ringed in dark, so Orange and Red ones dominate. */
.marker.ml1 .disc { fill: var(--l1); stroke: rgba(10, 13, 18, .7); }
.marker.ml2 .disc { fill: var(--l2); }
.marker.ml3 .disc { fill: var(--l3); }
.marker.ml4 .disc { fill: var(--l4); }
.marker .icon { fill: none; stroke: #fff; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.marker .count { fill: #fff; font-size: 10px; font-weight: 700; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.marker:hover .disc { stroke: var(--hover-stroke); stroke-width: 2; }
.marker.is-selected .disc { stroke: var(--accent); stroke-width: 2.5; }
/* The month's deadly events (Wars): small dots sized by deaths; another war's fade while one is shown. */
.point { fill: var(--event-dot); stroke: var(--panel); stroke-width: .6; stroke-opacity: .7; cursor: pointer; transition: opacity .2s; }
.point:hover { stroke: var(--hover-stroke); stroke-width: 1.5; stroke-opacity: 1; }
.point.is-dim { opacity: .12; }
.legend-marker { width: 12px; height: 12px; border-radius: 50%; background: var(--l3); border: 1.5px solid var(--panel); box-shadow: 0 0 0 1px var(--line); }

.pulse { pointer-events: none; }
.pulse .core { fill: var(--text); stroke: var(--panel); stroke-width: 1.5; }
.pulse .ring {
  fill: none;
  stroke: var(--text);
  stroke-width: 2;
  transform-box: fill-box;
  transform-origin: center;
  animation: pulse 2.4s ease-out infinite;
}
/* Loading: until main.js clears aria-busy, a pulsing outline of the world and of the card. */
.app[aria-busy="true"] .map-area::before {
  content: ""; position: absolute; inset: 22% 7% 24%; border-radius: 50% / 46%;
  background: var(--ocean); animation: loading 1.4s ease-in-out infinite;
}
.app[aria-busy="true"] .details:empty::before,
.app[aria-busy="true"] .details:empty::after {
  content: ""; display: block; border-radius: 6px; background: var(--line); animation: loading 1.4s ease-in-out infinite;
}
.app[aria-busy="true"] .details:empty::before { width: 60%; height: 22px; margin-top: 18px; }
.app[aria-busy="true"] .details:empty::after { width: 100%; height: 120px; margin-top: 18px; }
.app[aria-busy="true"] .legend, .app[aria-busy="true"] .recent { visibility: hidden; }   /* empty until then */
@keyframes loading { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .app[aria-busy="true"] .map-area::before, .app[aria-busy="true"] .details:empty::before, .app[aria-busy="true"] .details:empty::after { animation: none; } }

@keyframes pulse {
  0% { transform: scale(.6); opacity: .9; }
  100% { transform: scale(2.6); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .pulse .ring { animation: none; opacity: .5; transform: scale(1.6); }
}

/* The capybara in Canada (map/mascot.js). Its head turns by layers moving by different amounts,
   from the gaze in --gx and --gy (-1..1). A click on it plays an act (data-antic, map/antics.js:
   the durations there match these animations). */
.pins { pointer-events: none; }
.mascot { --gx: 1; --gy: 0; pointer-events: auto; cursor: grab; touch-action: none; }
.mascot-bob { animation: mascot-bob 3.6s ease-in-out infinite; }
.mascot-head, .mascot-ears, .mascot-muzzle, .mascot-face, .mascot-pupil {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transition: transform .7s cubic-bezier(.4, 0, .2, 1), rotate .7s cubic-bezier(.4, 0, .2, 1);
}
.mascot-head { transform: translate(calc(var(--gx) * 2.4px), calc(var(--gy) * 2px)); }
.mascot[data-look="user"] .mascot-head { rotate: -7deg; }
.mascot-ears { transform: translate(calc(var(--gx) * -1.6px), calc(var(--gy) * -.8px)); }
.mascot-muzzle { transform: translate(calc(var(--gx) * 3.8px), calc(var(--gy) * 2.4px)); }
.mascot-face { transform: translate(calc(var(--gx) * 2.4px), calc(var(--gy) * 1.6px)); }
.mascot-pupil { transform: translate(calc(var(--gx) * 1.05px), calc(var(--gy) * 1px)); }
.mascot-eye { transform-box: fill-box; transform-origin: 50% 50%; transition: transform .07s; }
.mascot.is-blink .mascot-eye { transform: scaleY(.12); }
@keyframes mascot-bob { 50% { transform: translateY(-.8px); } }
/* The acts (map/antics.js): any character with these groups can play them. An act lasts --ms
   (set by mascot.js from antics.js, so the two can't drift apart). The mascot is small, so for
   an act it steps closer (mascot-near: almost twice its size, from its feet), and every act
   moves the whole body, not only the face: a wave leans, a sniff stretches the neck. */
.mascot { --ms: 2400; }
.mascot-arm, .mascot-nose, .mascot-glasses { transform-box: fill-box; transform-origin: 50% 50%; }
.mascot-arm { transform-origin: 50% 10%; }
.mascot-grin { opacity: 0; }
.mascot[data-antic] .mascot-walk, .mascot[data-antic] .mascot-bob, .mascot[data-antic] .mascot-head, .mascot[data-antic] .mascot-arm,
.mascot[data-antic] .mascot-nose, .mascot[data-antic] .mascot-glasses, .mascot[data-antic] .mascot-eye,
.mascot[data-antic] .mascot-mouth, .mascot[data-antic] .mascot-grin {
  animation-duration: calc(var(--ms) * 1ms); animation-timing-function: ease-in-out; animation-fill-mode: both;
}
.mascot[data-antic]:not([data-antic="walk"]) .mascot-walk { animation-name: mascot-near; }
@keyframes mascot-near {
  0%, 100% { transform: scale(1); }
  9% { transform: scale(1.98); }
  13%, 88% { transform: scale(1.9); }
}

/* A wave: the paw goes up beside the head and waves three times, the body leans into it. */
.mascot[data-antic="paw"] .mascot-arm { animation-name: mascot-wave; }
.mascot[data-antic="paw"] .mascot-head { animation-name: mascot-tilt; }
.mascot[data-antic="paw"] .mascot-bob { animation-name: mascot-lean; }
@keyframes mascot-wave {
  0%, 12%, 90%, 100% { transform: rotate(0); }
  24%, 46%, 68% { transform: rotate(138deg); }
  35%, 57% { transform: rotate(104deg); }
  78% { transform: rotate(118deg); }
}
@keyframes mascot-tilt { 0%, 12%, 88%, 100% { rotate: 0deg; } 24%, 76% { rotate: 7deg; } }
@keyframes mascot-lean { 0%, 12%, 88%, 100% { transform: rotate(0); } 24%, 76% { transform: rotate(2.5deg); } }

/* A sniff: the neck stretches, the head turns one way, then the other, the nose working. */
.mascot[data-antic="nose"] .mascot-head { animation-name: mascot-sniff-head; }
.mascot[data-antic="nose"] .mascot-nose { animation-name: mascot-sniff; }
@keyframes mascot-sniff-head {
  0%, 12%, 90%, 100% { translate: 0 0; rotate: 0deg; }
  22%, 30%, 38% { translate: -1.5px -3px; rotate: -7deg; }
  26%, 34% { translate: -1.5px -1.8px; rotate: -7deg; }
  50% { translate: 0 -1px; rotate: 0deg; }
  60%, 68%, 76% { translate: 1.5px -3px; rotate: 7deg; }
  64%, 72% { translate: 1.5px -1.8px; rotate: 7deg; }
}
@keyframes mascot-sniff {
  0%, 12%, 44%, 54%, 84%, 100% { transform: scale(1); }
  22%, 30%, 38%, 60%, 68%, 76% { transform: scale(1.28, .8); }
  26%, 34%, 64%, 72% { transform: scale(.9, 1.15); }
}

/* The glasses slip as it looks down; a blink, a quick nod, and they are back. */
.mascot[data-antic="glasses"] .mascot-glasses { animation-name: mascot-slip; }
.mascot[data-antic="glasses"] .mascot-head { animation-name: mascot-nod; }
.mascot[data-antic="glasses"] .mascot-eye { animation-name: mascot-peer; }
@keyframes mascot-slip {
  0%, 12%, 80%, 100% { transform: translateY(0) rotate(0); }
  26% { transform: translateY(6.4px) rotate(9deg); }
  31%, 56% { transform: translateY(5.6px) rotate(7deg); }
  64% { transform: translateY(-1.6px) rotate(-2deg); }
  72% { transform: translateY(.5px) rotate(0); }
}
@keyframes mascot-nod {
  0%, 12%, 80%, 100% { translate: 0 0; rotate: 0deg; }
  26%, 56% { translate: 0 2px; rotate: 4deg; }
  63% { translate: 0 -3px; rotate: -3deg; }
  71% { translate: 0 .6px; rotate: 0deg; }
}
@keyframes mascot-peer {
  0%, 36%, 44%, 74%, 82%, 100% { transform: scaleY(1); }
  40%, 78% { transform: scaleY(.12); }
}

/* A smile: a wide grin, happy eyes, and the head swaying from side to side. */
.mascot[data-antic="smile"] .mascot-mouth { animation-name: mascot-hide; }
.mascot[data-antic="smile"] .mascot-grin { animation-name: mascot-show; }
.mascot[data-antic="smile"] .mascot-eye { animation-name: mascot-squint; }
.mascot[data-antic="smile"] .mascot-head { animation-name: mascot-sway; }
.mascot[data-antic="smile"] .mascot-bob { animation-name: mascot-bounce; }
@keyframes mascot-hide { 0%, 12%, 88%, 100% { opacity: 1; } 18%, 82% { opacity: 0; } }
@keyframes mascot-show { 0%, 12%, 88%, 100% { opacity: 0; } 18%, 82% { opacity: 1; } }
@keyframes mascot-squint { 0%, 12%, 88%, 100% { transform: scaleY(1); } 20%, 80% { transform: scaleY(.38); } }
@keyframes mascot-sway {
  0%, 12%, 88%, 100% { rotate: 0deg; }
  26%, 62% { rotate: 9deg; }
  44%, 78% { rotate: -8deg; }
}
@keyframes mascot-bounce {
  0%, 12%, 35%, 53%, 71%, 88%, 100% { transform: translateY(0); }
  26%, 44%, 62%, 78% { transform: translateY(-2.4px); }
}

/* Two hops: it crouches, jumps with its paw up, lands with a squash. */
.mascot[data-antic="hop"] .mascot-bob { animation-name: mascot-hop; }
.mascot[data-antic="hop"] .mascot-arm { animation-name: mascot-flap; }
@keyframes mascot-hop {
  0%, 12%, 88%, 100% { transform: translateY(0) scale(1); }
  20%, 54% { transform: translateY(2px) scale(1.07, .92); }
  33% { transform: translateY(-15px) scale(.96, 1.05); }
  44%, 78% { transform: translateY(1.5px) scale(1.08, .92); }
  66% { transform: translateY(-11px) scale(.97, 1.04); }
}
@keyframes mascot-flap {
  0%, 20%, 46%, 54%, 80%, 100% { transform: rotate(0); }
  33% { transform: rotate(82deg); }
  66% { transform: rotate(64deg); }
}

/* The walk: to the U.S. (--wx, --wy from mascot.js, in the drawing's units), a look around, and
   back, waddling, its paw swinging. */
.mascot[data-antic="walk"] .mascot-walk { animation-name: mascot-walk; }
.mascot[data-antic="walk"] .mascot-bob { animation: mascot-waddle .44s ease-in-out infinite; }
.mascot[data-antic="walk"] .mascot-arm { animation: mascot-swing .88s ease-in-out infinite; }
@keyframes mascot-walk {
  0%, 100% { transform: translate(0, 0); }
  42%, 58% { transform: translate(calc(var(--wx, 0) * 1px), calc(var(--wy, 0) * 1px)); }
}
@keyframes mascot-waddle {
  0%, 100% { transform: rotate(-4deg) translateY(0); }
  25%, 75% { transform: rotate(0) translateY(-1.6px); }
  50% { transform: rotate(4deg) translateY(0); }
}
@keyframes mascot-swing { 0%, 100% { transform: rotate(-14deg); } 50% { transform: rotate(22deg); } }
/* Picked up and put down (data-state, map/mascot.js): held in the air, the splash when it is
   dropped in the sea, swimming home in the water that hides its legs, walking where the way
   crosses land. */
.mascot[data-state="held"] { cursor: grabbing; }
.mascot-walk { transition: transform .18s ease-out; }
.mascot[data-antic] .mascot-walk { transition: none; }
.mascot[data-state="held"] .mascot-walk { transform: translateY(-9px) scale(1.25); }
.mascot[data-state="held"] .mascot-bob { transform-origin: 0 -104px; animation: mascot-dangle .7s ease-in-out infinite; }
.mascot[data-state="held"] .mascot-arm { animation: mascot-swing .7s ease-in-out infinite; }
/* Its legs: dangling while it is held, stepping while it walks. */
.mascot-leg { transform-box: fill-box; transform-origin: 50% 0; }
.mascot[data-state="held"] .mascot-leg { animation: mascot-kick .42s ease-in-out infinite; }
.mascot[data-state="walk"] .mascot-leg, .mascot[data-antic="walk"] .mascot-leg { animation: mascot-step .44s ease-in-out infinite; }
.mascot .mascot-leg + .mascot-leg { animation-delay: -.21s; }
.mascot[data-state="walk"] .mascot-leg + .mascot-leg, .mascot[data-antic="walk"] .mascot-leg + .mascot-leg { animation-delay: -.22s; }
@keyframes mascot-kick { 0%, 100% { transform: rotate(-26deg); } 50% { transform: rotate(26deg); } }
@keyframes mascot-step { 0%, 100% { transform: rotate(-13deg); } 50% { transform: rotate(13deg); } }
/* The boat it crosses the sea in (data-state="boat"): it comes and goes softly, and rocks with
   its passenger. */
.mascot-boat { opacity: 0; transform: translateY(7px) scale(.7); transition: opacity .4s ease, transform .4s ease; pointer-events: none; }
.mascot[data-state="boat"] .mascot-boat { opacity: 1; transform: none; }
.mascot[data-state="boat"] .mascot-bob, .mascot[data-state="boat"] .mascot-hull { animation: mascot-rock 1.3s ease-in-out infinite; }
@keyframes mascot-rock { 0%, 100% { transform: rotate(-3.5deg) translateY(0); } 50% { transform: rotate(3.5deg) translateY(-1.5px); } }
.mascot-water { opacity: 0; pointer-events: none; }
.mascot-ring { transform-box: fill-box; transform-origin: 50% 50%; }
.mascot[data-state="splash"] .mascot-water, .mascot[data-state="swim"] .mascot-water { opacity: 1; }
.mascot[data-state="splash"] .mascot-body, .mascot[data-state="swim"] .mascot-body { clip-path: url(#mascot-dry); }
.mascot[data-state="splash"] .mascot-bob { animation: mascot-plunge .7s ease-in both; }
.mascot[data-state="splash"] .mascot-ring { animation: mascot-ripple .7s ease-out both; }
.mascot[data-state="swim"] .mascot-bob { animation: mascot-swim 1.1s ease-in-out infinite; }
.mascot[data-state="swim"] .mascot-arm { animation: mascot-swing .55s ease-in-out infinite; }
.mascot[data-state="swim"] .mascot-ring { animation: mascot-ripple 1.1s ease-out infinite; }
.mascot[data-state="walk"] .mascot-bob { animation: mascot-waddle .44s ease-in-out infinite; }
.mascot[data-state="walk"] .mascot-arm { animation: mascot-swing .88s ease-in-out infinite; }
@keyframes mascot-dangle { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }
@keyframes mascot-plunge {
  0% { transform: translateY(-12px); }
  55% { transform: translateY(30px); }
  100% { transform: translateY(15px); }
}
@keyframes mascot-swim {
  0%, 100% { transform: translateY(15px) rotate(-5deg); }
  50% { transform: translateY(12px) rotate(4deg); }
}
@keyframes mascot-ripple {
  0% { transform: scale(.35); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .mascot[data-state] .mascot-bob, .mascot[data-state] .mascot-arm, .mascot[data-state] .mascot-ring,
  .mascot[data-state] .mascot-leg, .mascot[data-antic] .mascot-leg, .mascot[data-state] .mascot-hull { animation: none; }
  .mascot-boat { transition: none; }
  .mascot[data-state="splash"] .mascot-bob, .mascot[data-state="swim"] .mascot-bob { transform: translateY(15px); }
  .mascot-bob, .mascot[data-antic] .mascot-walk, .mascot[data-antic] .mascot-bob, .mascot[data-antic] .mascot-head,
  .mascot[data-antic] .mascot-arm, .mascot[data-antic] .mascot-nose, .mascot[data-antic] .mascot-glasses { animation: none; }
  .mascot-head, .mascot-ears, .mascot-muzzle, .mascot-face, .mascot-pupil { transition: none; }
}

/* Tooltip */
.tooltip {
  position: absolute;
  left: 0; top: 0;
  z-index: 5;
  pointer-events: none;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 8px 10px;
  font-size: 12.5px;
  max-width: 300px;
  /* Long lines wrap inside the box (a change line with its age is wider than a name). */
  white-space: normal;
  overflow-wrap: anywhere;
}
.tooltip strong, .sheet strong { display: block; font-size: 13px; font-weight: 600; }
.tooltip .tt-row > .swatch, .tooltip .tt-row > .arrow { flex: none; }
.tooltip .tt-row, .sheet .tt-row { display: flex; align-items: center; gap: 6px; color: var(--text-2); }

/* The phone sheet (shown only on small screens, see the media query) */
.sheet { display: none; }
.sheet-body { flex: 1; min-width: 0; font-size: 13px; line-height: 1.45; }
.sheet-body strong { font-size: 14.5px; margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-body .tt-row { min-width: 0; }
.sheet-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.sheet-details {
  padding: 8px 14px; border: 0; border-radius: 999px;
  background: var(--text); color: var(--panel); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}

/* Map controls & legend */
.map-controls {
  position: absolute; top: 16px; left: 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.icon-btn {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  cursor: pointer;
  font-size: 18px; line-height: 1;
  transition: background .15s, border-color .15s;
}
.icon-btn:hover { border-color: var(--text-3); }
/* Who stands on the map (map/characters.js): one small button each, under the zoom buttons. */
.mascot-switch { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.mascot-switch .icon-btn { padding: 0; opacity: .6; }
.mascot-switch .icon-btn:hover { opacity: 1; }
.mascot-switch .icon-btn[aria-pressed="true"] { opacity: 1; border-color: var(--text-2); }
.icon-btn:focus-visible, .chip:focus-visible, .segmented button:focus-visible,
.recent-list button:focus-visible, .search input:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.icon-btn.ghost { background: transparent; box-shadow: none; border-color: transparent; }
.icon-btn.ghost:hover { background: var(--panel-2); }
/* The panel's one show/hide button: "<" opens a hidden panel, ">" (the same arrow, turned) hides it. */
.panel-toggle { position: absolute; top: 16px; right: 16px; }
.panel-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }

/* Top of the map: the mode switch, then the provider switch. The column lets the map be dragged
   around them; only the pills take clicks. */
.map-top {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 4;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  max-width: calc(100% - 128px);   /* clear of the zoom controls and the panel button */
  pointer-events: none;
}
.map-top > * { pointer-events: auto; }
.mode-switch {
  display: flex; gap: 2px; max-width: 100%;
  padding: 4px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
  overflow-x: auto; scrollbar-width: none;
}
.mode-switch::-webkit-scrollbar { display: none; }
.mode-switch[hidden] { display: none; }
.mode-switch button {
  flex: none;
  padding: 7px 14px;
  border: 0; border-radius: 999px; background: transparent;
  font-size: 13px; font-weight: 600; color: var(--text-2); white-space: nowrap;
  cursor: pointer; transition: background .15s, color .15s;
}
.mode-switch button:hover { color: var(--text); background: var(--panel-2); }
.mode-switch button[aria-checked="true"] { background: var(--text); color: var(--panel); }
.mode-switch button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Source switch: segmented pill with a sliding thumb */
.source-toggle {
  --n: 2; --i: 0;
  position: relative;
  display: grid; grid-template-columns: repeat(var(--n), 1fr);
  padding: 4px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.source-toggle[hidden] { display: none; }
.source-toggle .thumb {
  position: absolute; top: 4px; bottom: 4px; left: 4px;
  width: calc((100% - 8px) / var(--n));
  transform: translateX(calc(var(--i) * 100%));
  border-radius: 999px;
  background: var(--panel-2);
  box-shadow: inset 0 0 0 1px var(--line), 0 1px 3px rgba(0, 0, 0, .12);
  transition: transform .28s cubic-bezier(.3, .7, .2, 1);
}
.source-toggle button {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 104px;
  padding: 7px 14px;
  border: 0; border-radius: 999px; background: transparent;
  font-size: 13px; font-weight: 600; color: var(--text-2);
  cursor: pointer;
  transition: color .2s;
}
.source-toggle button[aria-checked="true"] { color: var(--text); }
.source-toggle button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.flag {
  width: 21px; height: 14px; flex: none;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .12);
  filter: saturate(.85);
  transition: filter .2s, opacity .2s;
}
.source-toggle button[aria-checked="false"] .flag { filter: grayscale(.6); opacity: .7; }
@media (prefers-reduced-motion: reduce) { .source-toggle .thumb { transition: none; } }

.legend {
  position: absolute; left: 16px; bottom: 16px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px;
  max-width: calc(100% - 32px);
  padding: 8px 12px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  font-size: 12px; color: var(--text-2);
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
/* A level in the legend shows or hides its places (and their markers and changes). */
.legend-toggle { padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; border-radius: 4px; }
.legend-toggle:hover { text-decoration: underline; }
.legend-toggle[aria-pressed="false"] { opacity: .45; text-decoration: line-through; }
.legend-toggle[aria-pressed="false"] .swatch { background: var(--land-none) !important; }
.legend-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.legend-help {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 24px; height: 24px; margin: -4px -6px -4px auto;
  border: 0; border-radius: 50%; background: transparent; color: var(--accent); cursor: pointer;
}
.legend-help svg { width: 17px; height: 17px; }
.legend-help:hover, .legend-help:focus-visible { background: var(--panel-2); color: var(--text); }

/* "How levels work" */
.help {
  width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  padding: 0; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); color: var(--text); box-shadow: var(--shadow);
}
.help::backdrop { background: rgba(10, 13, 18, .45); }
.help-body { padding: 18px 20px 20px; font-size: 13.5px; line-height: 1.5; }
.help-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.help-head h2 { font-size: 16px; font-weight: 700; }
.help-head form { margin: -6px -8px 0 0; }
.help p { margin: 10px 0 0; color: var(--text-2); }
.help .subtle { font-size: 12.5px; }
.help-levels { margin: 12px 0 0; display: grid; gap: 8px; }
.help-levels div { display: grid; grid-template-columns: 92px 1fr; gap: 10px; }
.help-levels dt { display: flex; align-items: center; gap: 7px; font-weight: 600; height: 1.5em; }
.help-levels dd { margin: 0; color: var(--text-2); }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.swatch.none { background: var(--land-none); }
.legend-pulse { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--text); position: relative; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--event-dot); }
.legend-pulse::after { content: ""; position: absolute; inset: 2px; border-radius: 50%; background: var(--text); }

/* ---------- Panel ---------- */
.panel {
  display: flex; flex-direction: column; gap: 18px;
  overflow-y: auto;
  /* Always reserve room for a classic scrollbar (Windows/Linux, ~15px), so the content width
     doesn't change when the panel starts scrolling. --panel-w includes that room. */
  scrollbar-gutter: stable;
  padding: 20px 18px 16px;
  background: var(--panel);
  border-left: 1px solid var(--line);
  min-width: 0;
}
.panel > * { flex-shrink: 0; }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.panel-header h1 { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
/* One line, whatever it says (a delayed source adds to it): the panel below never moves. */
.panel-header > div:first-child { min-width: 0; }
#asOf { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Data older than it should be (dropped scheduled updates): the header says so. */
#asOf.is-stale { color: var(--l3); font-weight: 500; }
#asOf.is-stale::before { content: "⚠ "; }
.header-actions { display: flex; gap: 2px; margin: -4px -6px 0 0; }

.search { position: relative; }
.search > svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
}
.search input::placeholder { color: var(--text-3); }
.search-results {
  position: absolute; z-index: 10; left: 0; right: 0; top: calc(100% + 4px);
  margin: 0; padding: 4px; list-style: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.search-results li {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: 7px; cursor: pointer;
}
.search-results li[aria-selected="true"], .search-results li:hover { background: var(--panel-2); }
.search-results .lvl { margin-left: auto; color: var(--text-3); font-size: 12px; }

.card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}
/* The panel body: a column of short blocks, each a small card. Hovering never changes them; a
   selection replaces the overview's blocks with its own. */
.details { display: flex; flex-direction: column; gap: 12px; }
.block { position: relative; display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.block > .eyebrow:first-child { margin-bottom: 4px; }
/* Share (a country) and × (Escape and the ocean too) in the selected block's corner. */
.block .card-tools { position: absolute; top: 8px; right: 8px; display: flex; gap: 2px; z-index: 1; }
.block .card-tools .icon-btn { width: 28px; height: 28px; }
.block .card-close { font-size: 20px; line-height: 1; }
/* A selected place's other blocks: the country view's sections, each a card. */
.block.cv-section { border-top: 0; padding: 14px; width: 100%; }
.block.cv-section > * { width: 100%; }
.block .cv-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin: 0 0 6px; }
/* Minimal: the data notes are in the help (How it works). */
.block .cv-note { display: none; }
.details .history { width: 100%; margin-top: 10px; }
.history-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3);
}
/* Four one-line rows at most: up to three level changes, then "tracked since". */
.history-list {
  list-style: none; margin: 4px 0 0; padding: 0;
  height: calc(4 * 1.45em);
  font-size: 12.5px; line-height: 1.45; color: var(--text);
  overflow: hidden;
}
.history-list li { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.history-list .what { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.history-list .date { margin-left: auto; color: var(--text-2); font-variant-numeric: tabular-nums; }
.history-list .since { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; display: block; }
.history-list .since.none { font-style: italic; white-space: normal; }
/* Raised = towards "do not travel", lowered = towards "normal precautions". */
.arrow { flex: none; font-size: .8em; cursor: help; }
.arrow.up { color: var(--l4); }
.arrow.down { color: var(--l1); }
.block > * { flex-shrink: 0; max-width: 100%; }
.details h3 {
  margin: 0 0 8px; height: 26px; line-height: 26px;
  font-size: 18px; font-weight: 650; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.details h3.long { font-size: 15.5px; }
.details h3.xlong { font-size: 13.5px; }
.details .desc {
  height: calc(3 * 1.45em);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.details .badge { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.details .badge .swatch { flex: none; }
.details .meta, .details .scale, .details .stack, .details .overview-grid { width: 100%; }
.details .status {
  display: flex; align-items: center; gap: 8px;
  height: 24px; margin-top: 10px; width: 100%;
  overflow: hidden;
}
.tag {
  flex: none;
  padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 500;
  color: var(--text-2);
  border: 1px solid var(--line);
  background: var(--panel);
}
.details .status .note {
  min-width: 0; font-size: 12px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.details .link { margin-top: auto; }
.details .eyebrow {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.details p { margin: 8px 0 0; color: var(--text-2); font-size: 13px; }

.badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  font-size: 12.5px; font-weight: 600;
  background: color-mix(in srgb, var(--c) 16%, transparent);
  color: var(--text);
}
.badge .swatch { background: var(--c); border-radius: 50%; }

.scale { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; margin-top: 12px; }
.scale span { height: 5px; border-radius: 3px; background: var(--line); }
.scale span.on { background: var(--c); }

.meta { margin: 12px 0 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.meta div { display: flex; justify-content: space-between; gap: 12px; }
.meta dt { color: var(--text-2); flex: none; white-space: nowrap; }
/* One line always (the details card has fixed-height slots): a longer translation is
   shortened with "…", and the full text is in the title attribute. */
.meta dd { margin: 0; font-weight: 500; text-align: right; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* One line (fixed-height card): a long domain is shortened with "…"; the full URL is in the title. */
.details .link { display: inline-block; margin-top: 12px; font-size: 13px; font-weight: 500; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Overview (nothing hovered) */
.stack { display: flex; height: 10px; border-radius: 5px; overflow: hidden; margin: 10px 0 12px; gap: 2px; }
.stack span { background: var(--c); }
.overview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; font-size: 12.5px; }
.overview-grid div { display: flex; align-items: center; gap: 7px; color: var(--text-2); }
.overview-grid b { color: var(--text); font-weight: 600; margin-left: auto; }
.hint { display: flex; align-items: center; gap: 6px; margin-top: 12px !important; font-size: 12.5px !important; }

/* Risk summary card: one row per category (fixed slots, like the travel card) */
.details .trend {
  display: flex; align-items: baseline; gap: 6px;
  height: 20px; margin-top: 6px; width: 100%;
  font-size: 12.5px; color: var(--text-2);
  white-space: nowrap; overflow: hidden;
}
.risk-rows { list-style: none; margin: 6px 0 0; padding: 0; width: 100%; }
.risk-rows li {
  display: flex; align-items: center; gap: 8px;
  height: 23px; font-size: 13px;
  border-bottom: 1px solid var(--line);
}
.risk-rows li:last-child { border-bottom: 0; }
.risk-rows .swatch { border-radius: 50%; }
.risk-rows .cat { flex: none; width: 70px; color: var(--text-2); }
.risk-rows .lvl { flex: none; font-weight: 600; }
.risk-rows li.is-focus .cat { color: var(--text); font-weight: 600; }
.risk-rows .basis {
  min-width: 0; margin-left: auto; font-size: 12px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* A government stricter than the travel level, by its flag. */
.flag.mini { width: 15px; height: 10px; border-radius: 2px; vertical-align: -1px; }
.details .later.news { color: var(--text-2); }
.details .later { margin: 4px 0 0; height: 18px; font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; }
/* The risk card lists at most three changes: three lines, to leave room for a row per category. */
.details .history-list.short { height: calc(3 * 1.45em); }
.details .event-note {
  margin: 10px 0 0 !important; font-size: 12px !important; color: var(--text-3) !important;
  height: calc(2 * 1.45em); overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.details .moves { display: flex; align-items: baseline; gap: 5px; white-space: nowrap; overflow: hidden; }
/* The overview's latest changes: three one-line rows (or an empty line). */
.details .latest { width: 100%; margin-top: 12px; }
.latest-list { list-style: none; margin: 4px -6px 0; padding: 0; }
.latest-list button {
  display: flex; align-items: baseline; gap: 6px; width: 100%;
  padding: 3px 6px; border: 0; border-radius: 6px; background: transparent;
  text-align: left; font-size: 12.5px; line-height: 1.45; cursor: pointer; white-space: nowrap;
}
.latest-list button:hover, .latest-list button:focus-visible { background: var(--panel); }
.latest-list .swatch { width: 8px; height: 8px; border-radius: 50%; align-self: center; }
.latest-list .name { flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.latest-list .what { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.latest-list .when { margin-left: auto; padding-left: 6px; color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.details p.latest-empty { margin: 4px 0 0; font-size: 12.5px; color: var(--text-3); }
.latest-empty .link-btn, .recent-empty .link-btn { font-size: inherit; font-weight: 500; }

/* Wars: the overview's war count and its sparkline, the month's deaths, escalating and calming;
   the place card's monthly bars and conflicts. Fixed slots, like the other cards. */
.details .dim { color: var(--text-3); }
.wars-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; width: 100%; height: 52px; margin-top: 2px; }
.wars-count { display: flex; align-items: baseline; gap: 8px; }
.wars-count b { font-size: 44px; line-height: 1; font-weight: 700; letter-spacing: -.03em; color: var(--l4); font-variant-numeric: tabular-nums; }
.wars-count span { font-size: 18px; font-weight: 650; }
.wars-spark { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.wars-spark svg { display: block; overflow: visible; }
.wars-spark-label { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.details p.wars-sub { margin-top: 8px; height: calc(2 * 1.45em); font-size: 12px; line-height: 1.45; color: var(--text-3); overflow: hidden; }
.details p.wars-deaths { margin-top: 8px; height: 20px; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; }
.wars-trend { width: 100%; margin-top: 5px; }
/* Chips wrap: the overview's blocks don't change on hover, so a second row can't make them jump. */
.wars-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-height: 24px; margin-top: 2px; white-space: nowrap; font-size: 12.5px; }
.wars-trend button {
  display: inline-flex; align-items: baseline; gap: 4px; flex: none;
  padding: 2px 7px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel);
  font: inherit; font-size: 12px; font-weight: 600; color: var(--text); cursor: pointer;
}
.wars-trend button:hover, .wars-trend button:focus-visible { border-color: var(--text-3); }
.wars-tensions { width: 100%; margin-top: 8px; }
.wars-tensions .latest-list { margin-top: 2px; }
.wars-tensions .latest-list button { padding: 1px 6px; }
.wars-tensions .name { max-width: 66%; }
.wars-bars { width: 100%; margin-top: 8px; }
.wars-bars .history-label .dim { text-transform: none; letter-spacing: 0; font-weight: 500; }
.wars-bars svg { display: block; width: 100%; height: 46px; margin-top: 6px; }
.wars-bars rect { fill: var(--l4); opacity: .85; }
.wars-axis { display: flex; justify-content: space-between; margin-top: 3px; font-size: 11px; color: var(--text-3); }
.wars-conflicts { width: 100%; margin-top: 10px; }
.wars-conflicts ul { list-style: none; margin: 4px 0 0; padding: 0; height: calc(3 * 1.5em); font-size: 12.5px; line-height: 1.5; overflow: hidden; }
.wars-conflicts li { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.wars-conflicts .swatch { border-radius: 50%; width: 8px; height: 8px; }
.wars-conflicts .what { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.details p.wars-other { margin: 2px 0 0; height: calc(2 * 1.45em); font-size: 12px; line-height: 1.45; color: var(--text-3); overflow: hidden; }
.details p.wars-quiet { margin-top: 12px; font-size: 13px; }
/* A conflict row is a button to its war card. */
.wars-conflicts button { display: flex; align-items: center; gap: 7px; width: 100%; min-width: 0; padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.wars-conflicts button:hover .what, .wars-conflicts button:focus-visible .what { text-decoration: underline; }
/* The war card: who fights whom, side A over side B, each in its map colour: its fighters (a
   line) and the countries Wikipedia puts with it and its backers (a line); then the deaths, the
   months, and Wikipedia's summary (two lines) with its credit. Fixed slots, like every card. */
.war-sides { display: flex; flex-direction: column; gap: 3px; width: 100%; margin: 0 0 10px; }
.war-side { min-width: 0; padding: 1px 0 1px 9px; border-left: 4px solid var(--side-a); border-radius: 2px; }
.war-side.b { border-left-color: var(--side-b); }
.war-names { height: 1.4em; font-size: 13.5px; line-height: 1.4; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.war-names button { padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; }
.war-names button:hover, .war-names button:focus-visible { text-decoration: underline; }
.war-extra { height: 1.45em; font-size: 12px; line-height: 1.45; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.war-vs { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.details p.war-extract {
  margin: 10px 0 0; height: calc(2 * 1.45em); font-size: 12.5px; line-height: 1.45; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.details p.war-extract.dim { color: var(--text-3); }
.details p.war-credit { margin: 2px 0 0; height: 16px; font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-figure { margin: 6px 0 0; font-size: 13px; font-weight: 600; }
.cv-section .wars-bars svg { height: 56px; }

.card-actions { display: flex; align-items: baseline; gap: 14px; width: 100%; margin-top: auto; }
.card-actions .link { margin-top: 12px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; flex: none; }
.link-btn:hover { text-decoration: underline; }
.details .status .cv-open { margin-left: auto; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.link-btn:focus-visible, .back:focus-visible, .cv-list button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Country view: replaces the card, settings and feed while open */
.panel.is-country .details, .panel.is-country .section { display: none; }
.country-view[hidden] { display: none; }
.cv-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; }
.cv-actions .share { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; }
/* A short confirmation ("Link copied"), fixed to the viewport. */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 20;
  padding: 9px 16px; border-radius: 999px;
  background: var(--text); color: var(--panel); font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow); pointer-events: none;
}
.toast[hidden] { display: none; }
/* The countries list */
.list-view { gap: 12px; }
.list-view .cv-name .count { font-size: 12px; font-weight: 500; vertical-align: middle; color: var(--text-2); background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; }
.list-filter {
  width: 100%; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel-2); color: var(--text); font: inherit; font-size: 13.5px;
}
.list-filter:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.country-list li { min-height: 34px; }
.country-list button { padding: 6px 4px; border-radius: 6px; }
.country-list button:hover { background: var(--panel-2); }
.country-list button:hover .what { text-decoration: none; }
.country-list .what { font-weight: 500; }
.country-list .lvl { flex: none; max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); font-size: 12.5px; }
.country-list .date { min-width: 52px; text-align: right; white-space: nowrap; }
.country-view { display: flex; flex-direction: column; gap: 16px; }
.cv-head { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.cv-head .eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.cv-list.advisories .what { white-space: normal; line-height: 1.35; padding: 5px 0; }
.cv-head .trend { display: flex; align-items: baseline; gap: 6px; min-height: 18px; font-size: 12.5px; color: var(--text-2); }
.back { border: 0; background: none; padding: 2px 0; margin-bottom: 6px; color: var(--accent); font-size: 13px; font-weight: 500; cursor: pointer; }
.cv-name { font-size: 20px; font-weight: 650; letter-spacing: -.01em; margin: 0 0 4px; overflow-wrap: anywhere; }
.cv-section { border-top: 1px solid var(--line); padding-top: 12px; }
.cv-title {
  display: flex; align-items: center; gap: 8px; margin: 0 0 8px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3);
}
.cv-title .count { font-size: 11px; letter-spacing: 0; color: var(--text-2); background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; }
.cv-section .later { height: auto; white-space: normal; margin: 6px 0 0; font-size: 12px; color: var(--text-3); }
.cv-empty { margin: 0; font-size: 13px; color: var(--text-3); }
.cv-list { list-style: none; margin: 0; padding: 0; }
.cv-list li { display: flex; align-items: center; gap: 8px; min-height: 30px; font-size: 13px; border-bottom: 1px solid var(--line); }
.cv-list li:last-child { border-bottom: 0; }
.cv-list .swatch { border-radius: 50%; }
.cv-list .who { flex: none; width: 82px; color: var(--text-2); }
.cv-list .what { min-width: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-list .date { flex: none; margin-left: auto; color: var(--text-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.cv-list a { flex: none; margin-left: auto; font-weight: 600; }
.cv-list button {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 5px 0;
  border: 0; background: none; text-align: left; cursor: pointer; font-size: 13px;
}
.cv-list button:hover .what { text-decoration: underline; }
.cv-section .segmented { margin-bottom: 8px; }
.cv-history { height: auto !important; }
.cv-note { margin: 0; font-size: 12px; color: var(--text-3); }
.cv-section .cv-note { margin-top: 6px; }
.cv-list li.activity .what { white-space: normal; line-height: 1.35; padding: 5px 0; }
.cv-list li.activity .date { font-weight: 600; color: var(--text); }
.cv-list li.activity.normal .date { font-weight: 400; color: var(--text-2); }


/* Settings */
.section h2 {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-3);
  margin-bottom: 10px;
}
/* Filters: collapsed by default, remembered. */
.filters summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; border-radius: 6px; }
.filters summary::-webkit-details-marker { display: none; }
.filters summary h2 { margin: 0; }
.filters summary::after {
  content: ""; width: 7px; height: 7px; margin-right: 4px;
  border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3);
  transform: rotate(45deg) translateY(-2px); transition: transform .15s;
}
.filters[open] summary::after { transform: rotate(-135deg) translateY(-1px); }
.filters[open] summary { margin-bottom: 10px; }
.filters summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.section h2 .count {
  font-size: 11px; letter-spacing: 0; color: var(--text-2);
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 0 7px;
}
.setting { display: block; margin-bottom: 14px; }
.setting.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.setting-label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 7px; }
.setting.row .setting-label { margin: 0; }
.setting.is-disabled { opacity: .45; pointer-events: none; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px 5px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 12.5px; font-weight: 500;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}
.chip .swatch { background: var(--c); border-radius: 50%; }
.chip[aria-pressed="true"] { background: color-mix(in srgb, var(--c) 14%, var(--panel)); border-color: color-mix(in srgb, var(--c) 45%, var(--line)); }
.chip[aria-pressed="false"] { opacity: .5; }
.chip[aria-pressed="false"] .swatch { background: var(--land-none); }

.segmented {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 3px; gap: 3px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.segmented button {
  border: 0; background: transparent; padding: 6px 0;
  border-radius: 7px; font-size: 12.5px; font-weight: 500; color: var(--text-2);
  cursor: pointer;
}
.segmented button[aria-checked="true"] { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.switch { position: relative; flex: none; width: 36px; height: 20px; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .2s; pointer-events: none; }
.switch span::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25);
  transition: transform .2s;
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Recent list */
.recent { display: flex; flex-direction: column; min-height: 0; }
.recent .recent-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 8px; width: 100%; margin-bottom: 6px; }
.recent .recent-head h2 { margin: 0; white-space: nowrap; }
.recent-tools .segmented { padding: 2px; }
.recent-tools .segmented button { padding: 2px 8px; font-size: 11.5px; }
.recent-list { width: calc(100% + 12px); }
.recent[hidden] { display: none; }
.recent-list { list-style: none; margin: 0 -6px; padding: 0; }
.recent-list button {
  display: flex; flex-direction: column; align-items: stretch; gap: 2px; width: 100%;
  padding: 7px 6px; border: 0; border-radius: 8px; background: transparent;
  text-align: left; cursor: pointer; font-size: 13px;
}
.recent-list .row { display: flex; align-items: center; gap: 9px; }
.recent-list .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-list .what {
  display: flex; align-items: baseline; gap: 5px;
  padding-left: 19px;
  font-size: 12px; line-height: 1.4; color: var(--text-2);
  white-space: nowrap; overflow: hidden;
}
.recent-list button:hover, .recent-list button.is-active { background: var(--panel-2); }
.recent-list .swatch { border-radius: 50%; background: var(--c); }
.recent-list .when { margin-left: auto; color: var(--text-3); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.recent-empty { color: var(--text-3); font-size: 13px; padding: 4px 6px; }
.recent-list .recent-empty .link-btn, .recent-list .recent-more .link-btn { display: inline; width: auto; padding: 0; font-size: 13px; color: var(--accent); }
.recent-list .recent-more { padding: 6px 6px 0; }
.recent-list .recent-sub { padding: 12px 6px 2px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.filters[hidden] { display: none; }
.recent-list .recent-more .link-btn:hover { background: none; }

.panel-footer { margin-top: auto; padding-top: 6px; border-top: 1px solid var(--line); padding-top: 12px; line-height: 1.5; }

/* ---------- Small screens: map on top, panel below ---------- */
@media (max-width: 760px) {
  body { overflow: auto; }
  .app, .app.panel-collapsed { display: flex; flex-direction: column; height: auto; }
  .map-area { height: calc(52vw + 154px); max-height: 68vh; flex: none; }   /* +44px: the mode row */
  .app.panel-collapsed .panel { visibility: visible; }
  .panel { border-left: 0; border-top: 1px solid var(--line); overflow: visible; padding: 16px; }
  .panel-toggle { display: none !important; }
  .legend { left: 16px; right: 16px; bottom: 12px; gap: 4px 10px; font-size: 11px; }
  /* The mode switch is a full-width row at the top (it scrolls if it must); the zoom controls and
     the provider switch sit below it. */
  .map-top { top: 10px; left: 10px; right: 10px; transform: none; max-width: none; align-items: stretch; }
  .mode-switch { justify-content: space-between; }
  .mode-switch button { padding: 7px 10px; font-size: 12.5px; }
  .map-top .source-toggle { align-self: flex-end; }
  .map-controls { top: 62px; left: 12px; }
  /* The mascot switch: a second column beside the zoom buttons, so the short map keeps its legend clear. */
  .mascot-switch { position: absolute; top: 0; left: 40px; margin-top: 0; }
  .source-toggle button { min-width: 0; padding: 7px 12px; font-size: 12.5px; }
  /* Flags only, so several providers fit beside the zoom controls; names stay in title/aria-label. */
  .source-toggle button span { display: none; }
  .tooltip { display: none; }
  .sheet:not([hidden]) {
    position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 6;
    display: flex; align-items: center; gap: 10px;
    padding: 12px 10px 12px 14px;
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow);
  }
}
.cv-list.conflicts .what { white-space: normal; }
.recent-list .earlier { color: var(--text-3); }
.cv-sub { margin: 12px 0 2px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.cv-list.tensions .who { flex: none; max-width: 45%; }
