:root {
  --bg: #070b14;
  --bg-2: #0c1424;
  --bg-3: #101b2e;
  --line: #22304a;
  --amber: #ffb000;
  --ink: #1a1204;
  --text: #d7e0ea;
  --muted: #7f8da0;
  --down: #ff5d6c;
  --up: #3ddc97;
  color: var(--text);
  background: var(--bg);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
button, input, select { font-family: inherit; font-size: 16px; }
button { cursor: pointer; }
a { color: var(--amber); }
img { max-width: 100%; }

.gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
  background: radial-gradient(ellipse at center, #141c2e 0%, var(--bg) 62%);
}
.gate-card { width: min(420px, 100%); }
.eyebrow { margin: 0 0 8px; color: var(--amber); letter-spacing: 0.18em; font-size: 12px; }
.gate h1 { margin: 0; font-size: 32px; font-weight: 600; letter-spacing: 0.04em; }
.lede { color: var(--muted); line-height: 1.45; }
.gate form { display: grid; gap: 8px; }
.gate label { font-size: 12px; letter-spacing: 0.08em; color: var(--muted); }
.gate input {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
}
.gate button, .watch-form button, .sheet-bar button, .layers button, .tabs button, .chips button {
  min-height: 44px;
  border: 1px solid var(--line);
  background: var(--bg-3);
  color: var(--text);
}
.gate button {
  margin-top: 8px;
  background: var(--amber);
  color: var(--ink);
  border-color: var(--amber);
  font-weight: 700;
  letter-spacing: 0.08em;
}
.gate-error { margin: 0; color: var(--down); }

.shell {
  height: 100dvh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  background: var(--amber);
  color: var(--ink);
}
.brand { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.brand strong { letter-spacing: 0.12em; font-size: 13px; }
#clock { font-size: 12px; letter-spacing: 0.04em; }
.out {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 4px;
}

.map-wrap { position: relative; height: 42dvh; min-height: 240px; background: #070b14; }
#map { height: 100%; width: 100%; background: #070b14; }
.layers {
  position: absolute;
  z-index: 500;
  top: 10px;
  left: 10px;
  display: flex;
  gap: 0;
}
.layers button {
  min-height: 36px;
  padding: 0 12px;
  background: rgba(7, 11, 20, 0.92);
  color: var(--text);
}
.layers button[aria-pressed="true"] {
  background: var(--amber);
  color: var(--ink);
  border-color: var(--amber);
}
.leaflet-control-attribution { font-size: 10px; max-width: 70%; }

.stage { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.filters { display: grid; gap: 8px; padding: 8px 12px 0; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.chips button { flex: 0 0 auto; padding: 0 12px; }
.chips button[aria-pressed="true"], .tabs button[aria-selected="true"] {
  background: var(--amber);
  color: var(--ink);
  border-color: var(--amber);
}
.region-label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; letter-spacing: 0.06em; }
.region-label select, .watch-form input, .watch-form select {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
}
.feed-status { margin: 8px 12px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.feed-status .delayed { color: var(--muted); }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 0 12px 8px; }
.tabs button { letter-spacing: 0.06em; }
.panel { flex: 1; min-height: 180px; overflow: auto; padding: 0 12px calc(16px + env(safe-area-inset-bottom)); }

.row, .card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
}
.badge {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  background: var(--bg-3);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}
.row-time, .meta { color: var(--muted); font-size: 12px; }
.row-place { font-size: 14px; }
.row-title { display: block; margin-top: 2px; }
.row.active { background: #152238; }

.watch-form { display: grid; gap: 8px; margin-bottom: 12px; }
.watch-form button { background: var(--amber); color: var(--ink); border-color: var(--amber); font-weight: 700; }
.hint, .empty { color: var(--muted); line-height: 1.45; }
.warn { color: var(--down); }
.card { grid-template-columns: 1fr; border: 1px solid var(--line); padding: 12px; margin-bottom: 10px; background: var(--bg-2); }
.level { font-size: 28px; letter-spacing: 0.08em; margin: 0 0 4px; }
.level.Low { color: var(--up); }
.level.Elevated { color: var(--amber); }
.level.High, .level.Avoid { color: var(--down); }
.card h3 { margin: 0 0 6px; font-size: 18px; }
.card p { margin: 0 0 8px; line-height: 1.4; }
.card-actions, .inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card-actions button, .ghost {
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
}
.incident { padding: 8px 0; border-top: 1px solid var(--line); }
.avoid-note { font-size: 16px; color: var(--text); }

.sheet {
  position: fixed;
  z-index: 2000;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 78dvh;
  overflow: auto;
  background: var(--bg-2);
  border-top: 2px solid var(--amber);
  padding: 8px 12px calc(16px + env(safe-area-inset-bottom));
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
}
.sheet-bar { display: flex; justify-content: flex-end; }
.sheet-bar button { padding: 0 14px; background: var(--bg-3); color: var(--text); }
.sheet h2 { margin: 4px 0 8px; font-size: 20px; line-height: 1.3; }
.sat {
  display: block;
  width: 100%;
  height: auto;
  margin: 8px 0;
  background: #000;
  border: 1px solid var(--line);
}
.sheet-links { display: grid; gap: 10px; margin-top: 8px; }
.sheet-links a {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  text-decoration: none;
  background: var(--bg-3);
}

@media (min-width: 900px) {
  .shell { height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.8fr); grid-template-rows: auto minmax(0, 1fr); }
  .top { grid-column: 1 / -1; }
  .map-wrap { height: auto; min-height: 0; }
  .stage { height: auto; }
}
