/* World Conflicts: dark dashboard theme. Accents follow the Okabe-Ito colourblind-safe palette. */
:root,
:root[data-theme="dark"] {
    --bg: #0d1117;
    --bg-elev: #151b24;
    --bg-card: #18202b;
    --bg-hover: #1f2935;
    --border: #2a3542;
    --text: #e6edf3;
    --text-muted: #93a1b0;
    --link: #79c0ff;
    --blue: #56b4e9;
    --orange: #e69f00;
    --teal: #3fb8a0;
    --purple: #cc79a7;
    --vermillion: #f07c4a;
    --yellow: #f0e442;
    --grey: #8b98a5;
    --sample: #e69f00;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 4px 16px rgb(0 0 0 / .25);
    color-scheme: dark;
}

:root[data-theme="light"] {
    --bg: #f4f6f9;
    --bg-elev: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #eef2f6;
    --border: #d6dde5;
    --text: #17202a;
    --text-muted: #56636f;
    --link: #0b62b0;
    --blue: #0072b2;
    --orange: #b36b00;
    --teal: #007a63;
    --purple: #a3487b;
    --vermillion: #c2410c;
    --yellow: #8a7d00;
    --grey: #5f6b77;
    --sample: #a15c00;
    --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 4px 16px rgb(0 0 0 / .05);
    color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; }

body {
    background: var(--bg);
    color: var(--text);
    font: 15px/1.55 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, label:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
h1:focus { outline: none; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; font-weight: 600; }
h3 { font-size: .98rem; font-weight: 600; }
.muted { color: var(--text-muted); }
.small { font-size: .82rem; }

/* ---------- Shell ---------- */
.shell {
    display: grid;
    grid-template-columns: 220px 1fr;
    grid-template-rows: auto 1fr auto;
    grid-template-areas: "top top" "nav main" "nav foot";
    min-height: 100vh;
}

.topbar {
    grid-area: top;
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: .75rem;
    padding: .6rem 1.25rem;
    background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: .55rem; color: var(--text); font-weight: 700; font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .6rem; }

.icon-btn {
    display: inline-grid; place-items: center;
    width: 36px; height: 36px; border-radius: 8px;
    background: transparent; border: 1px solid var(--border); color: var(--text); cursor: pointer;
}
.icon-btn:hover { background: var(--bg-hover); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:root[data-theme="dark"] .i-moon, :root:not([data-theme]) .i-moon { display: none; }
:root[data-theme="light"] .i-sun { display: none; }

.menu-btn { display: none; }
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }

.nav {
    grid-area: nav;
    position: sticky; top: 57px; align-self: start;
    display: flex; flex-direction: column; gap: 2px;
    padding: 1rem .75rem;
    height: calc(100vh - 57px);
    border-right: 1px solid var(--border);
    background: var(--bg-elev);
}
.nav a {
    display: flex; align-items: center; gap: .65rem;
    padding: .55rem .75rem; border-radius: 8px;
    color: var(--text-muted); font-weight: 500;
}
.nav a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.nav a.active { background: color-mix(in srgb, var(--blue) 16%, transparent); color: var(--text); }
.nav a.active .nav-icon { stroke: var(--blue); }
.nav-icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-sep { height: 1px; background: var(--border); margin: .6rem .4rem; }
.nav-home { font-size: .88rem; }

.content { grid-area: main; padding: 1.5rem 1.75rem 2rem; min-width: 0; max-width: 1400px; }

.footer {
    grid-area: foot;
    display: flex; flex-direction: column; gap: .35rem;
    padding: 1rem 1.75rem 1.5rem;
    border-top: 1px solid var(--border);
    font-size: .82rem;
}
.footer-stamps { display: flex; flex-wrap: wrap; gap: .4rem; }
.stamp { padding: .1rem .5rem; border: 1px solid var(--border); border-radius: 999px; color: var(--text-muted); }

/* ---------- Building blocks ---------- */
.page-head { margin-bottom: 1.25rem; }
.lede { color: var(--text-muted); max-width: 75ch; margin: .25rem 0 0; }
.crumbs { font-size: .85rem; color: var(--text-muted); margin-bottom: .35rem; }

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.1rem 1.2rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.25rem;
    min-width: 0;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .5rem; }
.card-foot { margin: .75rem 0 0; font-size: .82rem; }
.more { font-size: .85rem; }
.placeholder-card { border-style: dashed; box-shadow: none; background: transparent; }
.notice { border-color: color-mix(in srgb, var(--sample) 55%, var(--border)); background: color-mix(in srgb, var(--sample) 7%, var(--bg-card)); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + * { margin-top: 1.25rem; }

.pill {
    display: inline-block; padding: .2rem .6rem; border-radius: 999px;
    font-size: .72rem; font-weight: 700; letter-spacing: .06em;
}
.pill:hover { text-decoration: none; }
.pill-sample { color: var(--sample); border: 1px solid currentColor; background: color-mix(in srgb, var(--sample) 12%, transparent); }
.pill.small { font-size: .65rem; padding: .05rem .4rem; margin-left: .3rem; }

.badge {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .15rem .55rem; border-radius: 6px;
    font-size: .75rem; font-weight: 600; white-space: nowrap;
    border: 1px solid var(--border); color: var(--text-muted);
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: none; }
.intensity-high, .intensity-medium, .intensity-low,
.status-stalled, .status-activetalks, .status-ceasefire, .status-agreement { border-color: transparent; }
.intensity-high::before, .intensity-medium::before, .intensity-low::before,
.status-stalled::before, .status-activetalks::before, .status-ceasefire::before, .status-agreement::before { display: inline-block; }
.intensity-high { color: var(--vermillion); background: color-mix(in srgb, var(--vermillion) 14%, transparent); }
.intensity-medium { color: var(--orange); background: color-mix(in srgb, var(--orange) 14%, transparent); }
.intensity-low { color: var(--yellow); background: color-mix(in srgb, var(--yellow) 12%, transparent); }
.status-stalled { color: var(--grey); background: color-mix(in srgb, var(--grey) 16%, transparent); }
.status-activetalks { color: var(--blue); background: color-mix(in srgb, var(--blue) 15%, transparent); }
.status-ceasefire { color: var(--orange); background: color-mix(in srgb, var(--orange) 14%, transparent); }
.status-agreement { color: var(--teal); background: color-mix(in srgb, var(--teal) 15%, transparent); }
.tag-row { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0 .6rem; }

/* Source line */
.src { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .45rem; font-size: .78rem; color: var(--text-muted); }
.src a { color: var(--link); }
.src a.src-sample { color: var(--sample); }
.src-status { text-transform: uppercase; font-size: .66rem; font-weight: 700; letter-spacing: .05em; }
.src-confirmed { color: var(--teal); }
.src-estimated { color: var(--purple); }
.src-reported { color: var(--blue); }
.src-date { white-space: nowrap; }

/* KPI cards */
.kpi-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem; margin-bottom: 1.25rem; }
.kpi { margin: 0; position: relative; overflow: hidden; display: flex; flex-direction: column; }
.kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--accent); }
.kpi-blue { --accent: var(--blue); }
.kpi-orange { --accent: var(--orange); }
.kpi-teal { --accent: var(--teal); }
.kpi-purple { --accent: var(--purple); }
.kpi-label { color: var(--text-muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.kpi-value { font-size: 2.1rem; font-weight: 700; line-height: 1.15; margin: .3rem 0 .15rem; font-variant-numeric: tabular-nums; }
.kpi-detail { font-size: .85rem; color: var(--text-muted); }
.kpi-source { margin-top: auto; padding-top: .6rem; display: flex; flex-direction: column; gap: .15rem; font-size: .78rem; color: var(--text-muted); }

/* Theater list */
.theater-list { display: flex; flex-direction: column; }
.theater {
    display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; align-items: center; gap: .75rem;
    padding: .7rem .5rem; border-bottom: 1px solid var(--border); color: var(--text); border-radius: 6px;
}
.theater:last-child { border-bottom: 0; }
.theater:hover { background: var(--bg-hover); text-decoration: none; }
.theater-main { display: flex; flex-direction: column; min-width: 0; }
.theater-name { font-weight: 600; }
.theater-meta { font-size: .8rem; color: var(--text-muted); }
.theater-figs { display: flex; flex-direction: column; font-size: .82rem; color: var(--text-muted); }
.theater-figs b { color: var(--text); font-variant-numeric: tabular-nums; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { display: grid; grid-template-columns: 6.5rem 1fr; gap: .9rem; padding: .55rem 0 .55rem; position: relative; }
.timeline li + li { border-top: 1px solid var(--border); }
.timeline time { font-size: .8rem; color: var(--text-muted); font-variant-numeric: tabular-nums; padding-top: .1rem; }
.tl-conflict { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.tl-headline { margin: .1rem 0 .15rem; }

/* Figure ranges */
.figure-range { padding: .6rem 0 .8rem; border-bottom: 1px solid var(--border); }
.figure-range:last-child { border-bottom: 0; }
.fr-label { font-size: .8rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.fr-value { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.fr-hint { font-size: .78rem; font-weight: 500; color: var(--text-muted); }
.fr-sources { list-style: none; margin: .3rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.fr-sources li { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .6rem; }
.fr-num { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: .85rem; min-width: 6.5rem; }
.fr-note { font-size: .75rem; color: var(--text-muted); font-style: italic; }

/* Parties, talks, facts */
.parties { list-style: none; margin: 0; padding: 0; }
.parties li { padding: .5rem 0; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; }
.parties li:last-child { border-bottom: 0; }
.party-name { font-weight: 600; }
.party-role { font-size: .85rem; color: var(--text-muted); }
.talk { padding: .75rem 0; border-bottom: 1px solid var(--border); }
.talk:last-child { border-bottom: 0; }
.talk p { margin: .4rem 0; }
.talk-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .15rem .9rem; margin: .5rem 0; font-size: .87rem; }
.facts dt { color: var(--text-muted); }
.facts dd { margin: 0; }
.source-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
.rules { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: .35rem; }

/* Tables */
.table-wrap { overflow-x: auto; }
.table-wrap.card { padding: 0; }
.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.data-table th, .data-table td { padding: .65rem .9rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table tbody th { font-weight: 600; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table td .badge + .badge { margin-left: .25rem; }
.data-table.compact th, .data-table.compact td { padding: .45rem .5rem; }
.cell-src { display: block; font-size: .72rem; color: var(--text-muted); }

/* Negotiations board */
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.board-col { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px; padding: .75rem; }
.board-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 .75rem; font-size: .95rem; }
.board-head .count { color: var(--text-muted); font-size: .85rem; }
.board-card { margin-bottom: .75rem; padding: .85rem .9rem; }
.board-card:last-child { margin-bottom: 0; }
.board-card h3 { margin-bottom: .2rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
    .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; grid-template-areas: "top" "main" "foot"; }
    .menu-btn { display: inline-grid; }
    .nav {
        position: fixed; top: 57px; left: 0; z-index: 30; width: 240px; height: calc(100vh - 57px);
        transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow);
    }
    .nav-toggle:checked ~ .nav { transform: none; }
    .grid-2 { grid-template-columns: 1fr; }
    .content { padding: 1.1rem 1rem 1.5rem; }
    .footer { padding: 1rem; }
}

@media (max-width: 560px) {
    .kpi-row, .board { grid-template-columns: 1fr; }
    .theater { grid-template-columns: 1fr auto; }
    .theater-figs { grid-column: 1 / -1; flex-direction: row; gap: 1rem; }
    .timeline li { grid-template-columns: 1fr; gap: .1rem; }
    h1 { font-size: 1.45rem; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}

/* ---------- Blazor plumbing ---------- */
#blazor-error-ui {
    background: #b32121; color: #fff;
    bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none; left: 0; padding: .6rem 1.25rem .7rem; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui a { color: #fff; text-decoration: underline; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

.blazor-error-boundary { background: #b32121; padding: 1rem; color: white; border-radius: 8px; }
.blazor-error-boundary::after { content: "An error has occurred."; }

.src-list { display: inline; line-height: 1.5; }
.src-sample-lead { color: var(--sample); font-weight: 600; }
.board-card .facts { grid-template-columns: 1fr; gap: 0; }
.board-card .facts dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; margin-top: .35rem; }
.brand span, .pill { white-space: nowrap; }
@media (max-width: 420px) {
    .topbar { padding: .6rem .75rem; gap: .5rem; }
    .brand { font-size: .95rem; }
    .pill { font-size: .62rem; padding: .15rem .45rem; }
    .data-table tbody th { min-width: 9rem; }
}

/* ---------- Map ---------- */
:root, :root[data-theme="dark"] {
    --map-sea: #0b1220;
    --map-land: #2a3442;
    --map-border: #455364;
    --map-involved: #3a3438;
    --zone-occupied: #d1495b;
    --zone-contested: #c77dff;
    --zone-fighting: #f0c24a;
    --frontline: #ff5a4e;
}
:root[data-theme="light"] {
    --map-sea: #dbe7f1;
    --map-land: #f7f7f5;
    --map-border: #a9b4bf;
    --map-involved: #efe3df;
    --zone-occupied: #b5172e;
    --zone-contested: #7b2cbf;
    --zone-fighting: #c48a00;
    --frontline: #d0021b;
}
.map-card { padding-bottom: .8rem; }
.world-map { width: 100%; border-radius: 10px; border: 1px solid var(--border); background: var(--map-sea); overflow: hidden; z-index: 0; }
.world-map-global { height: clamp(320px, 52vw, 560px); }
.world-map-focus { height: clamp(320px, 45vw, 480px); }
.map-caption { font-size: .75rem; color: var(--text-muted); margin: .55rem 0 0; }
.map-error { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-muted); z-index: 1000; }
.leaflet-container { font: inherit; background: var(--map-sea); }
.leaflet-container a { color: var(--link); }
.leaflet-bar a, .leaflet-control-layers { background: var(--bg-card); color: var(--text); border-color: var(--border); }
.leaflet-bar a:hover { background: var(--bg-hover); }
.leaflet-control-layers-toggle { filter: invert(var(--icon-invert, 0)); }
:root[data-theme="dark"] .leaflet-control-layers-toggle, :root:not([data-theme]) .leaflet-control-layers-toggle { --icon-invert: 1; }
.leaflet-control-layers-expanded { padding: .5rem .7rem; font-size: .82rem; }
.leaflet-control-attribution { background: color-mix(in srgb, var(--bg-card) 80%, transparent) !important; color: var(--text-muted); font-size: .68rem; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--bg-card); color: var(--text); box-shadow: var(--shadow); border: 1px solid var(--border); }
.leaflet-popup-content { margin: .8rem .9rem; font-size: .85rem; line-height: 1.45; }
.leaflet-container a.leaflet-popup-close-button { color: var(--text-muted); }
.map-tip { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow); font-size: .8rem; }
.map-tip::before { display: none; }
.mp-kicker { display: block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
a.mp-kicker { color: var(--link); }
.mp-title { font-weight: 700; font-size: .95rem; margin: .1rem 0 .3rem; }
.mp-note { margin-bottom: .4rem; }
.mp-warn { font-size: .74rem; color: var(--sample); margin: .3rem 0; }
.mp-src { font-size: .74rem; color: var(--text-muted); }
.mp-facts { display: grid; grid-template-columns: max-content 1fr; gap: .1rem .7rem; margin: .3rem 0 .5rem; }
.mp-facts dt { color: var(--text-muted); }
.mp-facts dd { margin: 0; font-variant-numeric: tabular-nums; }
.map-legend {
    background: color-mix(in srgb, var(--bg-card) 92%, transparent); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px; padding: .5rem .7rem; font-size: .72rem; line-height: 1.6;
    box-shadow: var(--shadow);
}
.map-legend summary { cursor: pointer; font-weight: 700; font-size: .72rem; list-style-position: inside; }
.map-legend[open] summary { margin-bottom: .2rem; }
.map-legend .lg-title { font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-size: .65rem; margin-top: .25rem; }
.map-legend .lg-title:first-child { margin-top: 0; }
.map-legend i { display: inline-block; vertical-align: middle; margin-right: .45rem; }
.sw { width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--map-border); }
.sw-High { background: color-mix(in srgb, var(--vermillion) 60%, var(--map-land)); }
.sw-Medium { background: color-mix(in srgb, var(--orange) 60%, var(--map-land)); }
.sw-land { background: var(--map-land); }
.sw-involved { background: var(--map-involved); border: 1.5px solid var(--vermillion); }
.sw-occupied { background: color-mix(in srgb, var(--zone-occupied) 70%, transparent); border-color: var(--zone-occupied); }
.sw-contested { background: color-mix(in srgb, var(--zone-contested) 70%, transparent); border-color: var(--zone-contested); }
.sw-fighting { background: color-mix(in srgb, var(--zone-fighting) 60%, transparent); border: 1px dashed var(--zone-fighting); }
.sw-line { width: 18px; height: 0; border-top: 3px dashed var(--frontline); }
.sw-dot { width: 12px; height: 12px; border-radius: 50%; background: color-mix(in srgb, var(--blue) 60%, transparent); border: 1.5px solid var(--text); }
@media (max-width: 560px) {
    .map-legend { font-size: .64rem; padding: .35rem .5rem; line-height: 1.45; }
}

/* ---------- Home link, educational notice ---------- */
.home-btn {
    display: inline-flex; align-items: center; gap: .3rem; padding: .35rem .7rem .35rem .45rem;
    border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: .82rem; font-weight: 600; white-space: nowrap;
}
.home-btn:hover { background: var(--bg-hover); text-decoration: none; }
.home-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.edu-banner {
    border: 1px solid color-mix(in srgb, var(--blue) 45%, var(--border));
    background: color-mix(in srgb, var(--blue) 8%, var(--bg-card));
    border-radius: 10px; padding: .7rem 1rem; margin-bottom: 1.25rem; font-size: .88rem;
}
.edu-line { color: var(--text); }
@media (max-width: 560px) { .home-btn span { display: none; } .home-btn { padding: .35rem; } }

/* ---------- WarGames-style command board ---------- */
.wg-frame {
    position: relative; border-radius: 10px; overflow: hidden;
    border: 1px solid #1d7a52; background: #020a07;
    box-shadow: 0 0 0 1px #04140e, 0 0 24px rgb(57 255 136 / .12) inset;
    font-family: "Share Tech Mono", "JetBrains Mono", ui-monospace, monospace;
}
.wg-frame .world-map { border: 0; border-radius: 0; background: #020a07; }
.wg-hud {
    display: flex; flex-wrap: wrap; gap: .35rem 1.4rem; align-items: center;
    padding: .45rem .9rem; border-bottom: 1px solid #1d7a52;
    color: #39ff88; font-size: .8rem; letter-spacing: .08em; text-shadow: 0 0 6px rgb(57 255 136 / .55);
    background: linear-gradient(#03130d, #020a07);
}
.wg-hud b { font-weight: 400; font-size: .95rem; }
.wg-title { color: #b6ffd6; }
.wg-hud-right { margin-left: auto; color: #7fdcae; opacity: .85; }
.wg-red { color: #ff5a4e; text-shadow: 0 0 6px rgb(255 90 78 / .7); }
.wg-amber { color: #ffb000; text-shadow: 0 0 6px rgb(255 176 0 / .6); }
.wg-cyan { color: #00e5ff; text-shadow: 0 0 6px rgb(0 229 255 / .6); }
.wg-cursor { animation: wg-blink 1s steps(1) infinite; }
@keyframes wg-blink { 50% { opacity: 0; } }
.wg-scan {
    position: absolute; inset: 0; pointer-events: none; z-index: 900;
    background: repeating-linear-gradient(to bottom, rgb(0 0 0 / 0) 0 2px, rgb(0 0 0 / .18) 2px 3px);
    mix-blend-mode: multiply;
}
.wg-map .leaflet-overlay-pane svg, .wg-map .leaflet-pane svg { filter: drop-shadow(0 0 1.5px rgb(57 255 136 / .35)); }
.wg-map .leaflet-arcs-pane svg { filter: drop-shadow(0 0 3px #00e5ff); }
.wg-map .leaflet-lines-pane svg { filter: drop-shadow(0 0 3px rgb(255 90 78 / .8)); }
.wg-arc { stroke-dasharray: 10 6; animation: wg-flow 1.2s linear infinite; }
.wg-arc-faded { animation: none; stroke-dasharray: 3 5; }
@keyframes wg-flow { to { stroke-dashoffset: -32; } }
.wg-pulse { animation: wg-pulse 1.8s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes wg-pulse { 0% { stroke-width: 1.5; stroke-opacity: 1; } 100% { stroke-width: 10; stroke-opacity: 0; } }
.wg-label { overflow: visible; }
.wg-ring {
    position: absolute; left: 0; top: 0; width: 12px; height: 12px; border-radius: 50%;
    border: 1.5px solid currentColor; box-shadow: 0 0 6px currentColor;
}
.wg-ring::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: currentColor; }
.wg-high { color: #ff5a4e; }
.wg-medium { color: #ffb000; }
.wg-low { color: #ffe14d; }
.wg-cease .wg-ring { border-style: dashed; }
.wg-text {
    position: absolute; left: 16px; top: -3px; white-space: nowrap;
    font: 11px/1.2 "Share Tech Mono", ui-monospace, monospace; letter-spacing: .08em;
    color: #b6ffd6; text-shadow: 0 0 4px #000, 0 0 6px rgb(57 255 136 / .7);
}
.wg-zoomed-out .wg-text { display: none; }
.wg-map .leaflet-bar a, .wg-map .leaflet-control-layers {
    background: #03130d; color: #39ff88; border-color: #1d7a52; font-family: "Share Tech Mono", ui-monospace, monospace;
}
.wg-map .leaflet-bar a:hover { background: #062418; }
.wg-map .leaflet-control-layers-toggle { --icon-invert: 1; filter: invert(1) sepia(1) saturate(5) hue-rotate(90deg); }
.wg-map .leaflet-control-attribution { background: rgb(2 10 7 / .8) !important; color: #4fbf8a; }
.wg-map .leaflet-control-attribution a { color: #7fdcae; }
.wg-map .map-legend {
    background: rgb(2 14 9 / .92); color: #b6ffd6; border-color: #1d7a52;
    font-family: "Share Tech Mono", ui-monospace, monospace; letter-spacing: .03em;
}
.wg-map .map-legend .lg-title { color: #39ff88; }
.wg-map .map-tip { background: #03130d; color: #b6ffd6; border-color: #1d7a52; font-family: "Share Tech Mono", ui-monospace, monospace; }
.wg-map .map-error { color: #ff5a4e; font-family: "Share Tech Mono", ui-monospace, monospace; letter-spacing: .1em; }
.sw-cease { background: transparent; border: 1.5px dashed #ffb000 !important; }
.sw-arc { width: 18px; height: 0; border-top: 2px dashed #00e5ff; box-shadow: 0 0 4px #00e5ff; }
.map-legend .sw { border: 1px solid #1d7a52; }
@media (prefers-reduced-motion: reduce) {
    .wg-arc, .wg-pulse, .wg-cursor { animation: none; }
}
@media (max-width: 560px) {
    .wg-hud { font-size: .68rem; gap: .2rem .8rem; }
    .wg-hud-right { display: none; }
}

/* ---------- Fact-check ---------- */
.fc-controls { display: flex; flex-wrap: wrap; gap: .75rem 1.25rem; align-items: end; margin-bottom: 1rem; }
.fc-controls label { display: flex; flex-direction: column; gap: .25rem; font-size: .78rem; color: var(--text-muted); font-weight: 600; }
.fc-controls select, .fc-controls input[type=search] {
    background: var(--bg-card); color: var(--text); border: 1px solid var(--border); border-radius: 8px;
    padding: .45rem .6rem; font: inherit; font-size: .88rem; min-width: 16rem;
}
.fc-controls .fc-check { flex-direction: row; align-items: center; gap: .4rem; }
.fc-table td { font-size: .84rem; }
.fc-url { word-break: break-all; max-width: 28rem; }
.fc-sample td { background: color-mix(in srgb, var(--sample) 6%, transparent); }

/* ---------- Categories, statuses, key facts ---------- */
.cat-op { color: #00b7ff; border-color: transparent; background: color-mix(in srgb, #00b7ff 15%, transparent); }
.cstatus-active { color: var(--vermillion); border-color: transparent; background: color-mix(in srgb, var(--vermillion) 12%, transparent); }
.cstatus-ceasefire { color: var(--orange); border-color: transparent; background: color-mix(in srgb, var(--orange) 12%, transparent); }
.cstatus-concluded { color: var(--grey); border-color: transparent; background: color-mix(in srgb, var(--grey) 14%, transparent); }
.facts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .9rem; }
.fact { border: 1px solid var(--border); border-radius: 10px; padding: .7rem .8rem; display: flex; flex-direction: column; gap: .2rem; }
.fact-label { font-size: .74rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.fact-value { font-size: 1.05rem; font-weight: 700; }
.section-title { margin: 1.5rem 0 .75rem; font-size: 1.15rem; }
.fr-scope { font-size: .8rem; font-weight: 600; margin-top: .5rem; color: var(--text); }

/* Map popups: stack each fact (label above value) so long labels never push values out of the panel. */
.leaflet-popup-content { overflow-wrap: anywhere; }
.mp { line-height: 1.35; }
.mp-facts { display: block; margin: .35rem 0 .5rem; }
.mp-facts dt { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-top: .35rem; }
.mp-facts dt:first-child { margin-top: 0; }
.mp-facts dd { margin: .05rem 0 0; font-weight: 600; }
.wg-map .leaflet-popup-content-wrapper { font-family: "Share Tech Mono", ui-monospace, monospace; }
.wg-scan { opacity: .6; }

/* ---------- Charts (plain SVG) ---------- */
.chart { margin: 0; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--text-muted); font-size: 11px; font-family: inherit; }
.chart .axis-fat { fill: var(--vermillion); }
.chart .bar { fill: color-mix(in srgb, var(--blue) 65%, transparent); }
.chart .bar:hover { fill: var(--blue); }
.chart .line { fill: none; stroke: var(--vermillion); stroke-width: 2; stroke-linejoin: round; }
.chart-legend { display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-size: .78rem; color: var(--text-muted); margin-bottom: .3rem; }
.chart-legend i { display: inline-block; vertical-align: middle; margin-right: .35rem; }
.lg-bar { width: 10px; height: 10px; background: color-mix(in srgb, var(--blue) 65%, transparent); border-radius: 2px; }
.lg-line { width: 16px; height: 0; border-top: 2px solid var(--vermillion); }
.lg-sw { width: 10px; height: 10px; border-radius: 2px; }
.et-battles { fill: color-mix(in srgb, var(--vermillion) 75%, transparent); background: color-mix(in srgb, var(--vermillion) 75%, transparent); }
.et-explosions { fill: color-mix(in srgb, var(--orange) 75%, transparent); background: color-mix(in srgb, var(--orange) 75%, transparent); }
.et-vac { fill: color-mix(in srgb, var(--purple) 75%, transparent); background: color-mix(in srgb, var(--purple) 75%, transparent); }
.chart figcaption { display: flex; flex-wrap: wrap; gap: .2rem .8rem; align-items: baseline; margin-top: .35rem; }
.chart-table { margin-top: .4rem; font-size: .82rem; }
.chart-table summary { cursor: pointer; color: var(--link); }
.chart-table table { margin-top: .4rem; max-width: 26rem; }
.rbars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.rbars li { display: grid; grid-template-columns: minmax(0, 11rem) 1fr; grid-template-rows: auto auto; gap: .1rem .7rem; align-items: center; }
.rb-name { font-size: .85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rb-track { height: 10px; background: var(--bg-hover); border-radius: 5px; overflow: hidden; }
.rb-fill { display: block; height: 100%; background: color-mix(in srgb, var(--vermillion) 70%, transparent); border-radius: 5px; }
.rb-num { grid-column: 2; font-size: .74rem; color: var(--text-muted); }

/* Map + details panel side by side; the panel drops below the map on narrow screens. */
.wg-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; }
.wg-mapwrap { position: relative; min-width: 0; }
.wg-panel {
    border-left: 1px solid #1d7a52; background: #03110b; color: #b6ffd6; padding: .9rem 1rem;
    font-family: "Share Tech Mono", ui-monospace, monospace; font-size: .85rem; line-height: 1.4;
    overflow-y: auto; position: relative; max-height: clamp(320px, 52vw, 560px);
}
.world-map-focus + .wg-scan, .wg-frame:has(.world-map-focus) .wg-panel { max-height: clamp(320px, 45vw, 480px); }
.wg-panel a { color: #7fdcff; }
.wg-panel .mp-kicker { color: #7fdcae; }
.wg-panel .mp-title { color: #e9fff2; font-size: 1rem; }
.wg-panel .mp-facts dt { color: #4fbf8a; }
.wg-panel .mp-src, .wg-panel .mp-src span { color: #7fdcae; }
.wg-panel-title { color: #39ff88; letter-spacing: .1em; margin-bottom: .5rem; text-shadow: 0 0 6px rgb(57 255 136 / .5); }
.wg-panel-hint p { color: #7fdcae; margin: 0; }
.wg-panel-close {
    position: absolute; top: .4rem; right: .5rem; background: transparent; border: 1px solid #1d7a52; color: #39ff88;
    border-radius: 6px; width: 26px; height: 26px; cursor: pointer; font: inherit; line-height: 1;
}
.wg-panel-close:hover { background: #062418; }
@media (max-width: 900px) {
    .wg-body { grid-template-columns: 1fr; }
    .wg-panel { border-left: 0; border-top: 1px solid #1d7a52; max-height: none; }
}
.mp-list { list-style: none; margin: .5rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .7rem; }
.mp-list .mp-title { display: block; font-size: .92rem; margin: 0; }
/* Clicked map shapes take focus; Chrome would otherwise draw a box around a country's whole bounding area. */
.leaflet-interactive:focus { outline: none; }
