:root {
  --bg: #0d1117; --panel: rgba(18, 22, 30, 0.96); --card: #1a1f29; --border: #2b3340;
  --fg: #e8ebf1; --muted: #8e98a8; --accent: #f97316;
  --warn-bg: #3a2810; --warn-fg: #fcd9a8;
  --peek: 200px; --side: 360px;
  --sab: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); overflow: hidden;
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#map { position: fixed; inset: 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }
.small { font-size: 12px; }
a { color: #93c5fd; }

/* ---------- panel: bottom sheet (mobile first) ---------- */
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000; background: var(--panel);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--border); border-radius: 16px 16px 0 0;
  max-height: 82dvh; display: flex; flex-direction: column;
  transform: translateY(calc(100% - var(--peek) - var(--sab)));
  transition: transform .28s cubic-bezier(.2,.8,.2,1); box-shadow: 0 -8px 30px rgba(0,0,0,.35); }
.sheet.open { transform: translateY(0); }
.handle { display: block; width: 100%; height: 22px; border: 0; background: transparent; cursor: pointer; padding: 8px 0 0; flex: none; }
.handle span { display: block; margin: 0 auto; width: 42px; height: 5px; border-radius: 3px; background: #4b5563; }
.head { padding: 2px 14px 10px; flex: none; }
.body { padding: 0 14px calc(14px + var(--sab)); overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.title-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.title { font-size: 16px; font-weight: 650; }
.sub { color: var(--muted); font-size: 12px; }
.status { margin-top: 8px; padding: 6px 10px; border-radius: 8px; background: var(--card); border: 1px solid var(--border);
  font-weight: 600; font-variant-numeric: tabular-nums; font-size: 13px; }
.status.pre { border-color: #a16207; color: #fde68a; }
.status.post { border-color: #b91c1c; color: #fecaca; }

.icon-btn { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border-radius: 50%; border: 1px solid var(--border); background: var(--card); color: var(--fg); cursor: pointer; }
.icon-btn:active { transform: scale(.95); }
.icon-btn.spin svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.play { width: 44px; height: 44px; background: var(--accent); border-color: var(--accent); color: #111; }

.timeline { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
input[type=range] { flex: 1; height: 32px; accent-color: var(--accent); }
.tl-read { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; }

.warn { background: var(--warn-bg); color: var(--warn-fg); border: 1px solid #7c4a12; border-radius: 8px; padding: 8px 10px; font-size: 12px; }
section { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.grid2 > div { display: flex; flex-direction: column; }
.k { color: var(--muted); font-size: 12px; }
.v { font-weight: 600; font-variant-numeric: tabular-nums; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 8px 0; }
.inline { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
input[type=time], input[type=date], select { background: var(--bg); color: var(--fg); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 8px; font: inherit; font-size: 14px; min-height: 38px; color-scheme: dark; }
select { max-width: 200px; }
.chip { background: var(--bg); color: var(--fg); border: 1px solid var(--border); border-radius: 999px; padding: 7px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.chip:active, .chip:hover { border-color: var(--accent); }
.check { display: flex; gap: 10px; align-items: center; padding: 6px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.ramp { height: 14px; border-radius: 7px;
  background: linear-gradient(90deg, rgba(255,247,168,.25) 0%, #ffcc4d 30%, #f77b21 55%, #d92620 78%, #73051a 100%); }
.ramp-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 3px; }
#traj-legend { margin-top: 8px; }
#traj-legend .item { display: flex; align-items: center; gap: 8px; margin: 3px 0; font-size: 12px; }
.line { width: 18px; height: 3px; border-radius: 2px; flex: none; }
.links { display: flex; flex-direction: column; gap: 6px; }
.links a { text-decoration: none; font-size: 13px; }
footer { display: flex; flex-direction: column; gap: 4px; padding-bottom: 4px; }

.banner { position: fixed; top: calc(10px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 1100;
  background: #7f1d1d; color: #fff; padding: 8px 14px; border-radius: 8px; max-width: 92vw; font-size: 13px; box-shadow: 0 4px 20px rgba(0,0,0,.4); }

/* ---------- map ---------- */
.leaflet-container { background: #0a0e14; }
.state-label { color: rgba(203, 213, 225, .55); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-align: center; white-space: nowrap; text-shadow: 0 1px 2px #000; }
.city-label { white-space: nowrap; }
.city-label i { position: absolute; left: -3px; top: -3px; width: 6px; height: 6px; border-radius: 50%; background: #e2e8f0; box-shadow: 0 0 0 1.5px #0a0e14; }
.city-label span { position: absolute; left: 6px; top: -8px; color: #e2e8f0; font-size: 12px; font-weight: 600; text-shadow: 0 0 3px #000, 0 1px 2px #000, 0 0 6px #000; }
.light .city-label span { color: #0f172a; text-shadow: 0 0 3px #fff, 0 0 6px #fff; }
.light .city-label i { background: #0f172a; box-shadow: 0 0 0 1.5px #fff; }
.light .state-label { color: rgba(15, 23, 42, .5); text-shadow: 0 0 3px #fff; }
.leaflet-bottom { bottom: calc(var(--peek) + var(--sab)); }
.src-icon { font-size: 20px; line-height: 24px; text-align: center; width: 28px; height: 28px; border-radius: 50%;
  background: #111; color: #facc15; border: 2px solid #facc15; box-shadow: 0 0 0 4px rgba(250,204,21,.25), 0 0 18px rgba(250,204,21,.6); }
.ring-label { color: #cbd5e1; font-weight: 600; font-size: 11px; text-shadow: 0 1px 2px #000, 0 0 4px #000; white-space: nowrap; }
.light .ring-label { color: #1f2937; text-shadow: 0 0 3px #fff; }
.leaflet-popup-content { font-size: 13px; line-height: 1.5; }
.pop-level { display: inline-block; padding: 1px 8px; border-radius: 4px; font-weight: 700; }

/* ---------- desktop: sidebar ---------- */
@media (min-width: 820px) {
  #map { left: var(--side); }
  .sheet { top: 0; right: auto; width: var(--side); max-height: none; border-radius: 0; border-top: 0;
    border-right: 1px solid var(--border); transform: none; transition: none; box-shadow: none; overflow-y: auto; }
  .handle { display: none; }
  .head { padding-top: 14px; }
  .body { overflow: visible; }
  .leaflet-bottom { bottom: 0; }
}
