:root {
  --bg: #F4F6F8;
  --surface: #FFFFFF;
  --surface-2: #F4F6F8;
  --ink: #0F1B2D;
  --muted: #556070;
  --line: #E2E7ED;
  --line-strong: #C9D1DB;
  --brand: #1B5E43;
  --brand-ink: #FFFFFF;
  --brand-tint: #E3F1EA;
  --brand-text: #144833;
  --major: #A61B1B;
  --major-tint: #FBE6E4;
  --plan: #8A3D06;
  --plan-tint: #FDEFD9;
  --info: #1D5BD8;
  --info-tint: #E6EEFC;
  --verdict-bg: #0F1B2D;
  --verdict-ink: #FFFFFF;
  --verdict-muted: #D5DCE6;
  --verdict-accent: #F6C177;
  --shadow: 0 2px 10px rgba(15, 27, 45, 0.14);
  --tabs-h: 68px;
  --panel-w: 400px;
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
}

:root[data-theme='dark'] {
  --bg: #0B1420;
  --surface: #111C2A;
  --surface-2: #1A2737;
  --ink: #F2F5F9;
  --muted: #A9B6C6;
  --line: #25364A;
  --line-strong: #3A4C62;
  --brand: #6FDBA6;
  --brand-ink: #0B1420;
  --brand-tint: #17352B;
  --brand-text: #9BE8C2;
  --major: #FF8A80;
  --major-tint: #3A1A1C;
  --plan: #FFC266;
  --plan-tint: #3A2A12;
  --info: #8AB4FF;
  --info-tint: #14294A;
  --verdict-bg: #1A2737;
  --verdict-ink: #F2F5F9;
  --verdict-muted: #A9B6C6;
  --verdict-accent: #FFC266;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); overflow: hidden; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand-text); }
h1, h2, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--info); outline-offset: 2px; }

/* ---------- Map ---------- */
#map { position: fixed; inset: 0 0 var(--tabs-h) 0; background: var(--bg); }

.me-dot { width: 20px; height: 20px; border-radius: 50%; background: #1D5BD8; border: 3px solid #FFFFFF; box-shadow: 0 0 0 10px rgba(29, 91, 216, 0.2); }
.pin { width: 32px; height: 32px; border-radius: 50%; border: 2.5px solid #FFFFFF; display: grid; place-items: center; color: #FFFFFF; box-shadow: var(--shadow); padding: 0; }
.pin svg { width: 18px; height: 18px; }
.pin.sev-major { background: #A61B1B; }
.pin.sev-plan { background: #B45309; }
.pin.sev-headsup { background: #1D5BD8; }

/* ---------- Top bar ---------- */
.top { position: fixed; top: 12px; left: 12px; right: 12px; z-index: 5; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.top > * { pointer-events: auto; }
.brand { align-self: flex-start; display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px 0 8px; border-radius: 15px; background: var(--brand); color: var(--brand-ink); font-family: 'Space Grotesk', Inter, sans-serif; font-weight: 700; font-size: 15px; letter-spacing: -0.2px; }
.search-row { display: flex; gap: 8px; }
.search { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px; border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); color: var(--muted); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font-size: 15px; font-weight: 500; color: var(--ink); }
.search input::placeholder { color: var(--muted); }
.round-btn { width: 48px; height: 48px; flex-shrink: 0; border: 0; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow); display: grid; place-items: center; }
.round-btn.active { color: var(--info); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 12px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); font-size: 13px; font-weight: 500; }
.chip svg { color: var(--info); }

.results { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.results.inline { box-shadow: none; border: 1px solid var(--line-strong); margin-top: 6px; }
.results button { display: flex; flex-direction: column; gap: 2px; width: 100%; min-height: 48px; padding: 8px 14px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.results li:last-child button { border-bottom: 0; }
.results button:hover { background: var(--surface-2); }
.results .r-name { font-size: 15px; font-weight: 600; }
.results .r-region { font-size: 12px; color: var(--muted); }
.results .r-empty { padding: 12px 14px; font-size: 14px; color: var(--muted); }

/* ---------- Sheet ---------- */
.sheet { position: fixed; left: 0; right: 0; bottom: var(--tabs-h); z-index: 4; height: 46vh; min-height: 300px; background: var(--surface); border-radius: 24px 24px 0 0; box-shadow: 0 -4px 18px rgba(15, 27, 45, 0.14); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet[data-tab='go'], .sheet[data-tab='on'] { top: 0; height: auto; border-radius: 0; z-index: 6; background: var(--bg); }
.panel { display: flex; flex-direction: column; gap: 12px; padding: 18px 16px 20px; }
.panel[hidden] { display: none; }
.panel-head { display: flex; flex-direction: column; gap: 2px; }
h1 { font-family: 'Space Grotesk', Inter, sans-serif; font-size: 22px; font-weight: 700; letter-spacing: -0.3px; line-height: 1.2; }
.sheet[data-tab='go'] h1, .sheet[data-tab='on'] h1 { font-size: 26px; }
h2 { font-size: 12px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; color: var(--muted); }
.sub { font-size: 13px; color: var(--muted); line-height: 1.4; }
.notice { padding: 10px 12px; border-radius: 12px; background: var(--info-tint); font-size: 13px; line-height: 1.4; }
.sources { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* ---------- Feed cards ---------- */
.feed, .list { display: flex; flex-direction: column; gap: 8px; }
.card { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); text-align: left; text-decoration: none; color: var(--ink); }
.card:hover { border-color: var(--line-strong); }
.card .tile { width: 44px; height: 44px; flex-shrink: 0; border-radius: 12px; display: grid; place-items: center; }
.card .tile svg { width: 22px; height: 22px; }
.card .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.card .label { font-size: 11px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; }
.card .title { font-size: 15px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.card .detail { font-size: 13px; color: var(--muted); line-height: 1.35; overflow-wrap: anywhere; }
.sev-major .tile { background: var(--major-tint); color: var(--major); }
.sev-major .label { color: var(--major); }
.sev-plan .tile { background: var(--plan-tint); color: var(--plan); }
.sev-plan .label { color: var(--plan); }
.sev-headsup .tile { background: var(--info-tint); color: var(--info); }
.sev-headsup .label { color: var(--info); }
.all-clear { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 16px; background: var(--brand-tint); color: var(--brand-text); font-size: 15px; font-weight: 600; line-height: 1.35; }
.skeleton { height: 70px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); }

.badge { flex-shrink: 0; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge.official { background: var(--brand-tint); color: var(--brand-text); }
.badge.outlet { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line-strong); }

/* ---------- Should I go? ---------- */
.field { display: flex; flex-direction: column; gap: 4px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); }
.field input { height: 46px; width: 100%; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); font-size: 15px; font-weight: 500; }
.verdict { display: flex; flex-direction: column; gap: 8px; padding: 18px 16px; border-radius: 20px; background: var(--verdict-bg); color: var(--verdict-ink); }
.verdict .kicker { font-size: 12px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; color: var(--verdict-accent); }
.verdict .headline { font-family: 'Space Grotesk', Inter, sans-serif; font-size: 26px; font-weight: 700; letter-spacing: -0.4px; line-height: 1.12; }
.verdict p { font-size: 14px; line-height: 1.45; color: var(--verdict-muted); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.stat .k { font-size: 12px; font-weight: 600; color: var(--muted); }
.stat .v { font-family: 'Space Grotesk', Inter, sans-serif; font-size: 20px; font-weight: 700; }
.stat .n { font-size: 12px; color: var(--muted); line-height: 1.3; }
.slot { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); }
.slot.best { border: 2px solid var(--brand); background: var(--brand-tint); }
.slot .when { width: 68px; flex-shrink: 0; font-size: 15px; font-weight: 600; }
.slot .what { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: 14px; font-weight: 600; }
.slot .what small { font-size: 12px; font-weight: 500; color: var(--muted); }
.slot.best .what small { color: var(--brand-text); font-weight: 600; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* ---------- What's on ---------- */
.event .time { width: 60px; height: 56px; flex-shrink: 0; border-radius: 12px; background: var(--verdict-bg); color: var(--verdict-ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.event .time b { font-family: 'Space Grotesk', Inter, sans-serif; font-size: 16px; line-height: 1; }
.event .time span { font-size: 11px; font-weight: 500; }
.news { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); overflow: hidden; }
.news a { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.news li:last-child a { border-bottom: 0; }
.news a:hover { background: var(--surface-2); }
.news .meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
.news .headline { font-size: 14px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.news .impact { font-size: 13px; line-height: 1.35; color: var(--brand-text); font-weight: 500; }
.news .src { font-size: 12px; color: var(--muted); }
.empty { padding: 14px; border: 1px dashed var(--line-strong); border-radius: 16px; font-size: 14px; line-height: 1.45; color: var(--muted); }

/* ---------- Tabs ---------- */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 7; height: var(--tabs-h); display: flex; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 0; border-top: 3px solid transparent; background: transparent; color: var(--muted); font-size: 12px; font-weight: 500; }
.tabs button[aria-current='page'] { color: var(--brand-text); border-top-color: var(--brand); font-weight: 600; }

/* ---------- Wide screens: panel on the left, map on the right ---------- */
@media (min-width: 900px) {
  #map { inset: 0 0 0 var(--panel-w); }
  .top { left: calc(var(--panel-w) + 16px); right: auto; width: 380px; top: 16px; }
  .sheet, .sheet[data-tab='go'], .sheet[data-tab='on'] { top: 0; left: 0; right: auto; bottom: var(--tabs-h); width: var(--panel-w); height: auto; border-radius: 0; z-index: 4; background: var(--surface); border-right: 1px solid var(--line); box-shadow: none; }
  .tabs { right: auto; width: var(--panel-w); border-right: 1px solid var(--line); }
}
