:root {
  --bg: #0b0f14;
  --panel: #121820;
  --panel-2: #18202b;
  --line: #243041;
  --text: #e6edf3;
  --muted: #8b98a8;
  --accent: #ff4d4f;
  --link: #6cb6ff;
  --sev1: #8b98a8;
  --sev2: #4da3ff;
  --sev3: #ffb020;
  --sev4: #ff7a45;
  --sev5: #ff3b30;
  --ok: #3fb950;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 760px; }
.hidden, [hidden] { display: none !important; }

/* ---------- header */
.topbar { position: sticky; top: 0; z-index: 1000; background: rgba(11, 15, 20, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 20px; height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; letter-spacing: .12em; font-size: .95rem; }
.brand:hover { text-decoration: none; }
.brand-a { color: var(--text); }
.brand-b { color: var(--accent); }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 rgba(255, 77, 79, .7); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 77, 79, .6); } 70% { box-shadow: 0 0 0 10px rgba(255, 77, 79, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 77, 79, 0); } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { color: var(--muted); padding: 6px 12px; border-radius: 6px; font-weight: 500; }
.nav a:hover, .nav a.active { color: var(--text); background: var(--panel-2); text-decoration: none; }
.nav a.cta { color: #fff; background: var(--accent); }

/* ---------- footer */
.footer { border-top: 1px solid var(--line); margin-top: 48px; padding: 24px 0 40px; color: var(--muted); font-size: .85rem; }
.footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }

/* ---------- controls */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  padding: 8px 14px; border-radius: 8px; font: inherit; font-weight: 500; cursor: pointer; }
.btn:hover { border-color: #3a4a60; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.icon { padding: 8px 11px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--panel); border: 1px solid var(--line); color: var(--muted); padding: 5px 11px; border-radius: 999px; font-size: .85rem; cursor: pointer; }
.chip.on { color: var(--text); border-color: #4a5d78; background: var(--panel-2); }
.date-label { font-family: var(--mono); font-size: .95rem; min-width: 112px; text-align: center; }
.spacer { flex: 1; }
input[type=email], input[type=tel], input[type=text], select { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; font: inherit; width: 100%; }
input:focus, select:focus, .btn:focus-visible, .chip:focus-visible { outline: 2px solid var(--link); outline-offset: 1px; }
label.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
label.check input { margin-top: 4px; accent-color: var(--accent); }

/* ---------- home layout */
.board { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; }
.map { height: min(calc(100vh - 150px), 780px); min-height: 460px; border-radius: var(--radius); border: 1px solid var(--line); background: #0e141b; }
.map.small { height: 320px; min-height: 0; }
.feed { height: min(calc(100vh - 150px), 780px); min-height: 460px; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.feed-head { position: sticky; top: 0; background: var(--panel); padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: baseline; z-index: 1; }
@media (max-width: 900px) {
  .board { grid-template-columns: 1fr; }
  .map { height: 55vh; min-height: 320px; }
  .feed { height: auto; max-height: none; }
  .nav a:not(.cta) { padding: 6px 8px; }
  .topbar .wrap { gap: 10px; }
}
@media (max-width: 560px) { .nav a.hide-sm { display: none; } }

/* ---------- event rows */
.ev { display: grid; grid-template-columns: 4px 1fr; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--text); }
.ev:hover { background: var(--panel-2); text-decoration: none; }
.ev .bar { border-radius: 2px; }
.ev-title { font-weight: 600; line-height: 1.35; }
.ev-meta { color: var(--muted); font-size: .8rem; margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.ev-sum { color: #c4cdd8; font-size: .9rem; margin-top: 6px; }
.badge { display: inline-block; font-size: .7rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 1px 7px; border-radius: 4px; border: 1px solid currentColor; }
.badge.unconfirmed { color: var(--sev3); }
.badge.reported { color: var(--sev2); }
.badge.corroborated { color: var(--ok); }
.sev1 { background: var(--sev1); } .sev2 { background: var(--sev2); } .sev3 { background: var(--sev3); } .sev4 { background: var(--sev4); } .sev5 { background: var(--sev5); }
.empty { padding: 28px 16px; color: var(--muted); text-align: center; }

/* ---------- region cards */
.section-title { margin: 28px 0 12px; display: flex; align-items: baseline; justify-content: space-between; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--text); display: block; }
a.card:hover { border-color: #3a4a60; text-decoration: none; }
.card h3 { font-size: 1rem; margin-bottom: 4px; }
.card .count { font-family: var(--mono); color: var(--muted); font-size: .8rem; }

/* ---------- detail pages */
.page { padding-top: 24px; padding-bottom: 24px; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 10px; }
.brief { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 16px 18px; margin: 16px 0; }
.brief ul { margin: 8px 0 0; padding-left: 20px; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 20px; align-items: start; }
@media (max-width: 900px) { .two { grid-template-columns: 1fr; } }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel > h2 { padding: 12px 16px; margin: 0; border-bottom: 1px solid var(--line); font-size: 1rem; }
.panel .body { padding: 14px 16px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 16px 0; }
.fact { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.fact .k { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; }
.fact .v { font-weight: 600; margin-top: 2px; }
.src { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.src:last-child { border-bottom: 0; }
.src blockquote { margin: 6px 0 0; padding-left: 10px; border-left: 2px solid var(--line); color: #c4cdd8; font-size: .9rem; }
.kind { font-family: var(--mono); font-size: .7rem; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; margin-right: 6px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.gallery a { display: block; aspect-ratio: 16/9; background: var(--panel-2); border-radius: 6px; overflow: hidden; }
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; }
.claims { margin: 0; padding-left: 18px; }
.claims li { margin-bottom: 6px; }
.note { background: rgba(255, 176, 32, .08); border: 1px solid rgba(255, 176, 32, .35); border-radius: 8px; padding: 10px 14px; font-size: .9rem; color: #f0d8a8; }

/* ---------- alerts form */
.steps { display: grid; gap: 16px; }
.step { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.step h2 { display: flex; gap: 10px; align-items: center; }
.step h2 .n { width: 24px; height: 24px; border-radius: 50%; background: var(--panel-2); border: 1px solid var(--line); font-size: .8rem; display: inline-flex; align-items: center; justify-content: center; }
.region-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.region-grid label { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.row { display: flex; gap: 8px; }
.row > input { flex: 1; }
@media (max-width: 560px) { .row { flex-direction: column; } }
.msg { margin-top: 12px; padding: 10px 14px; border-radius: 8px; font-size: .9rem; }
.msg.ok { background: rgba(63, 185, 80, .1); border: 1px solid rgba(63, 185, 80, .4); }
.msg.err { background: rgba(255, 77, 79, .1); border: 1px solid rgba(255, 77, 79, .4); }

/* ---------- prose */
.prose h2 { margin-top: 1.6em; }
.prose li { margin-bottom: .4em; }
.scale { display: grid; gap: 6px; margin: 10px 0 18px; }
.scale div { display: grid; grid-template-columns: 14px 110px 1fr; gap: 10px; align-items: center; }
.dot { width: 12px; height: 12px; border-radius: 50%; }

/* ---------- leaflet */
.map.leaflet-container { background: #0e141b; font: inherit; }  /* .map beats leaflet.css, which loads later */
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.leaflet-popup-content { margin: 12px 14px; }
.leaflet-popup-content a { font-weight: 600; }
.leaflet-control-attribution { background: rgba(11, 15, 20, .75) !important; color: var(--muted); font-size: 11px; }
.leaflet-control-attribution a { color: var(--muted); }
.legend { background: rgba(18, 24, 32, .9); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: .75rem; color: var(--muted); line-height: 1.8; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }

/* ---------- stories and articles */
.stories { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.stories.one { grid-template-columns: 1fr; }
.story { display: grid; grid-template-columns: 112px 1fr; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; color: var(--text); }
.story:hover { border-color: #3a4a60; text-decoration: none; }
.story img, .story-ph { width: 112px; height: 76px; border-radius: 6px; object-fit: cover; display: block; background: var(--panel-2); }
.story-ph { opacity: .35; }
.story-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.story-h { font-weight: 600; line-height: 1.3; }
.article { max-width: 720px; margin: 0 auto; }
.article h1 { font-size: 2rem; margin-top: 4px; }
.article .dek { font-size: 1.15rem; color: #c4cdd8; margin-bottom: 8px; }
.article .byline { margin-bottom: 20px; }
.article-body p { font-size: 1.06rem; line-height: 1.7; }
.article h2 { font-size: 1.05rem; margin-top: 24px; }
.facts-box { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 12px 18px; margin: 0 0 22px; }
.facts-box h2 { margin: 4px 0 6px; }
.facts-box ul, .unknowns ul { margin: 0; padding-left: 20px; }
.cite a { font-size: .72rem; padding: 0 2px; }
.article-sources ol { padding-left: 22px; font-size: .9rem; }
.article-sources li { margin-bottom: 6px; word-break: break-word; }
