/* Lightning Alarm web app.
   Storm-instrument: the palette and the rule that strike yellow means lightning and nothing else
   come from the iOS Theme. Type is Archivo (the landing page's face; its width axis gives the
   verdict a condensed, gauge-plate look) with IBM Plex Mono for readings you compare at a glance.
   Tokens live on :root and flip under prefers-color-scheme. */

:root {
  color-scheme: light dark;
  --font-body: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;

  --bg: #f1f4f9;
  --surface: #ffffff;
  --raised: #f7f9fc;
  --line: #d5dbe6;
  --text: #0f1420;
  --text-2: #465068;
  --text-3: #5b667c;

  --clear: #1e8e5a;
  --watch: #c2700a;
  --suspended: #c2262b;
  --neutral: #5a6478;
  --clear-ink: #136b43;
  --watch-ink: #8f5000;
  --suspended-ink: #a81e23;
  --neutral-ink: #465068;
  --strike: #b8860b; /* lightning only */

  --accent: #1f4fd1;
  --accent-fg: #ffffff;
  --focus: #1f4fd1;
  --danger: #b3261e;

  --hit: 2.75rem;
  --radius: 0.75rem;
  --tabbar-h: 3.75rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0e14;
    --surface: #141924;
    --raised: #1c2331;
    --line: #2a3444;
    --text: #f2f5fa;
    --text-2: #b7c0cf;
    --text-3: #98a3b6;

    --clear: #3fb984;
    --watch: #f59e42;
    --suspended: #e5484d;
    --neutral: #98a3b6;
    --clear-ink: #3fb984;
    --watch-ink: #f59e42;
    --suspended-ink: #ff7075;
    --neutral-ink: #b7c0cf;
    --strike: #f5d547;

    --accent: #7fa8ff;
    --accent-fg: #0b0e14;
    --focus: #9dbcff;
    --danger: #ff8a80;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.5 var(--font-body);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: hidden;
}
/* Atmosphere: two soft washes behind everything, never over content. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60rem 28rem at 88% -12%, color-mix(in oklab, var(--accent) 11%, transparent), transparent 70%),
    radial-gradient(42rem 26rem at -12% 112%, color-mix(in oklab, var(--accent) 7%, transparent), transparent 70%);
}
h1, h2, h3, p, li, dt, dd, span, label, a, button { overflow-wrap: anywhere; }
h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 800; font-stretch: 88%; letter-spacing: -0.01em; }
h1 { font-size: 1.65rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.6rem; }
a { color: var(--accent); }
.muted { color: var(--text-2); }
.small { font-size: 0.85rem; }
.strong { font-weight: 700; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }
.ico { flex: none; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 0.3rem; }
.skip { position: absolute; left: 0.5rem; top: -4rem; z-index: 100; background: var(--surface); padding: 0.6rem 1rem; border-radius: 0.5rem; }
.skip:focus { top: 0.5rem; }

/* ------------------------------------------------------------------ shell */

#shell {
  display: grid;
  height: 100dvh;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: 'top' 'main';
}

#topbar {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 3.25rem;
  padding: max(0.4rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) 0.4rem max(1rem, env(safe-area-inset-left));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 0.55rem; color: var(--text); text-decoration: none; font-weight: 800; font-stretch: 85%; font-size: 1.1rem; letter-spacing: -0.005em; min-height: var(--hit); }
.brand img { width: 1.9rem; height: 1.9rem; border-radius: 0.45rem; }
#feedchip {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.8rem; font-weight: 600; color: var(--text-2);
}
#feedchip[data-state='ok'] { color: var(--clear-ink); }
#feedchip[data-state='warn'] { color: var(--watch-ink); }
#feedchip[data-state='bad'] { color: var(--suspended-ink); }

/* Navigation: a bottom tab bar on phones, links in the top bar from 720 px. */
#mainnav {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 30;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.nav-item {
  flex: 1 1 0;
  min-width: 0;
  min-height: var(--tabbar-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.15rem;
  color: var(--text-2); text-decoration: none; font-size: 0.75rem; font-weight: 600;
  box-shadow: inset 0 3px 0 transparent;
}
.nav-item[aria-current='page'] { color: var(--accent); font-weight: 800; box-shadow: inset 0 3px 0 var(--accent); }
.nav-item[aria-current='page'] .ico { stroke-width: 2.6; }

#rail { display: none; grid-area: rail; overflow: auto; padding: 1rem; background: var(--surface); border-right: 1px solid var(--line); }
#view { grid-area: main; overflow: auto; min-width: 0; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 4rem); outline: none; }
#map-pane {
  display: none;
  grid-area: main;
  flex-direction: column;
  min-height: 0; min-width: 0;
  background: var(--surface);
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}
#shell[data-route='map'] #map-pane { display: flex; }
@media (max-width: 1099px) { #shell[data-route='map'] #view { display: none; } }
/* The picker covers the whole screen below 1100 px so the crosshair has room. */
#map-pane[data-mode='pick'] { display: flex; position: fixed; inset: 0; z-index: 50; padding-bottom: env(safe-area-inset-bottom); }

.narrow-only { display: revert; }
.wide-only { display: none; }

@media (min-width: 720px) {
  #shell {
    grid-template-columns: 19rem minmax(0, 1fr);
    grid-template-areas: 'top top' 'rail main';
  }
  #rail { display: block; }
  #mainnav {
    position: static; order: 2; inset: auto; z-index: auto; border: 0; background: none; padding: 0;
    margin-left: 1rem; gap: 0.25rem;
  }
  .nav-item {
    flex: none; flex-direction: row; gap: 0.45rem; min-height: var(--hit); padding: 0 0.8rem;
    font-size: 0.95rem; border-radius: 0.6rem; box-shadow: none;
  }
  .nav-item[aria-current='page'] { box-shadow: inset 0 -3px 0 var(--accent); border-radius: 0.3rem; }
  #feedchip { order: 3; }
  #view { padding-bottom: calc(env(safe-area-inset-bottom) + 4rem); }
  #map-pane { padding-bottom: 0; }
  .narrow-only { display: none !important; }
  .wide-only { display: revert; }
}

@media (min-width: 1100px) {
  #shell {
    grid-template-columns: 19rem minmax(26rem, 32rem) minmax(0, 1fr);
    grid-template-areas: 'top top top' 'rail main map';
  }
  #shell[data-withmap='0'] { grid-template-areas: 'top top top' 'rail main main'; }
  #shell[data-withmap='1'] #map-pane { display: flex; grid-area: map; border-left: 1px solid var(--line); }
  #shell[data-route='map'] #view { display: block; }
  #map-pane[data-mode='pick'] { position: relative; inset: auto; z-index: auto; }
}

#feedchip { white-space: nowrap; }
/* Between 720 and 959 px the five nav links and the feed chip need the brand's width: icon only. */
@media (min-width: 720px) and (max-width: 959px) { .brand span { display: none; } #topbar { gap: 0.5rem; } #mainnav { margin-left: 0.25rem; } }

/* Below 20rem there is no room for labels under the icons; the icons keep their names. */
@media (max-width: 19.99rem) {
  .nav-item span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .brand span { display: none; }
}

/* ---------------------------------------------------------------- controls */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: var(--hit); padding: 0.4rem 1rem;
  border: 1px solid transparent; border-radius: 0.65rem;
  font: 600 1rem var(--font-body); text-decoration: none; cursor: pointer;
  color: var(--text); background: transparent;
}
.btn-primary { background: var(--accent); color: var(--accent-fg); }
.btn-quiet { background: var(--surface); border-color: var(--line); }
.btn-quiet[aria-pressed='true'] { border-color: var(--accent); background: color-mix(in oklab, var(--accent) 14%, var(--surface)); box-shadow: inset 0 0 0 1px var(--accent); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-small { padding: 0.25rem 0.8rem; font-size: 0.9rem; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-chip { background: var(--surface); border-color: var(--line); font-weight: 600; }
.btn-chip[aria-pressed='true'] { border-color: var(--accent); background: color-mix(in oklab, var(--accent) 14%, var(--surface)); box-shadow: inset 0 0 0 1px var(--accent); }
.icon-btn { display: inline-grid; place-items: center; min-width: var(--hit); min-height: var(--hit); background: none; border: 0; color: var(--text-2); cursor: pointer; }

label, .label { display: block; font-weight: 700; margin: 0 0 0.3rem; }
input[type='text'], input[type='email'], input[type='search'], input[type='time'], input[type='tel'], select {
  width: 100%; min-height: var(--hit); padding: 0.45rem 0.75rem;
  font: inherit; color: inherit; background: var(--surface);
  border: 1px solid var(--line); border-radius: 0.6rem;
}
input[aria-invalid='true'], select[aria-invalid='true'] { border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
.hint { font-size: 0.85rem; color: var(--text-2); margin: 0.35rem 0 0; }
.warn-text { color: var(--watch-ink); font-weight: 600; }
.field { margin: 0 0 1.25rem; }
.field-error { color: var(--danger); font-weight: 600; font-size: 0.9rem; margin: 0.35rem 0 0; }
.form-error { border: 1px solid var(--danger); border-radius: var(--radius); padding: 0.75rem 1rem; margin: 0 0 1rem; color: var(--text); }
.form-status { min-height: 1.5rem; color: var(--text-2); }
.form-status.error { color: var(--danger); }
.form-status.compact { min-height: 0; margin: 0 0 0.5rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.75rem; }
.row-split { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.coord { font-family: var(--font-mono); font-size: 1.05rem; font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; border: 0; padding: 0; margin: 0 0 0.25rem; min-width: 0; }
.chip { position: relative; display: inline-block; margin: 0; font-weight: 600; }
.chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.chip span {
  display: inline-flex; align-items: center; gap: 0.4rem; min-height: var(--hit); padding: 0 0.8rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 0.65rem;
}
.chip input:checked + span { border-color: var(--accent); background: color-mix(in oklab, var(--accent) 14%, var(--surface)); box-shadow: inset 0 0 0 1px var(--accent); font-weight: 800; }
.chip input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

.switch { display: flex; align-items: center; gap: 0.75rem; min-height: var(--hit); cursor: pointer; position: relative; margin: 0; }
.switch input { position: absolute; opacity: 0; width: 2.9rem; height: var(--hit); margin: 0; cursor: pointer; }
.switch .track { flex: none; width: 2.9rem; height: 1.6rem; border-radius: 1rem; background: var(--line); position: relative; transition: background 0.15s; }
.switch .track::after { content: ''; position: absolute; top: 0.2rem; left: 0.2rem; width: 1.2rem; height: 1.2rem; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgb(0 0 0 / 0.35); transition: transform 0.15s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(1.3rem); }
.switch input:focus-visible + .track { outline: 3px solid var(--focus); outline-offset: 2px; }

.days { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.6rem 0; }
.day { min-width: var(--hit); min-height: var(--hit); font: 700 0.9rem var(--font-body); color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 0.6rem; cursor: pointer; }
.day[aria-pressed='true'] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.times { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0.75rem; margin-bottom: 0.75rem; }
.schedule-body { padding-top: 0.5rem; }

.banner { display: flex; align-items: flex-start; gap: 0.6rem; margin: 0 0 0.6rem; padding: 0.7rem 0.9rem; border: 1px solid var(--line); border-radius: var(--radius); font-size: 0.92rem; background: var(--surface); }
.banner p { flex: 1; margin: 0.15rem 0 0; }
.banner .ico { margin-top: 0.15rem; }
.banner.tone-watch { background: color-mix(in oklab, var(--watch) 12%, var(--surface)); border-color: color-mix(in oklab, var(--watch) 50%, var(--line)); }
.banner.tone-watch .ico { color: var(--watch-ink); }
.banner.tone-info { background: color-mix(in oklab, var(--accent) 9%, var(--surface)); border-color: color-mix(in oklab, var(--accent) 40%, var(--line)); }
.banner.tone-info .ico { color: var(--accent); }

.tag { display: inline-block; padding: 0.05rem 0.55rem; border: 1px solid var(--line); border-radius: 0.4rem; font-size: 0.75rem; font-weight: 700; color: var(--text-2); }

.dialog { max-width: min(26rem, calc(100vw - 2rem)); padding: 1.25rem; border: 1px solid var(--line); border-radius: 1rem; background: var(--surface); color: var(--text); }
.dialog::backdrop { background: rgb(5 8 14 / 0.6); }
.dialog h2 { margin-bottom: 0.5rem; }

/* ------------------------------------------------------------------- pages */

.page { max-width: 46rem; margin: 0 auto; padding: 1rem max(1rem, env(safe-area-inset-right)) 1rem max(1rem, env(safe-area-inset-left)); }
.page-narrow { max-width: 32rem; }
.page-form { max-width: 36rem; }
.page-head { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin-right: auto; }
.page-head .muted { margin: 0; }
.back { display: inline-grid; place-items: center; min-width: var(--hit); min-height: var(--hit); color: var(--text); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 1rem; padding: 1rem 1.1rem; margin-bottom: 1rem; }
.panel h2 { margin-bottom: 0.4rem; }
.danger-zone { border-color: color-mix(in oklab, var(--danger) 45%, var(--line)); margin-top: 1.5rem; }
.empty { display: grid; justify-items: center; gap: 0.6rem; text-align: center; padding: 2.5rem 1rem; color: var(--text-2); }
.empty h1, .empty h2 { color: var(--text); }
.turnstile { margin: 1rem 0; min-height: 4rem; }

/* ---------------------------------------------------------- status screen */

.status-view { max-width: 44rem; margin: 0 auto; padding: 1rem max(1rem, env(safe-area-inset-right)) 1rem max(1rem, env(safe-area-inset-left)); }
.chip-row { display: flex; gap: 0.5rem; overflow-x: auto; padding: 0.1rem 0 0.75rem; margin: 0 -0.25rem; scrollbar-width: thin; }
.chip-row .btn { flex: none; max-width: 14rem; }

.tone-clear { --tone-ink: var(--clear-ink); }
.tone-watch { --tone-ink: var(--watch-ink); }
.tone-suspended { --tone-ink: var(--suspended-ink); }
.tone-muted { --tone-ink: var(--neutral-ink); }
.status-line { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 800; font-stretch: 85%; letter-spacing: 0.03em; font-size: 0.9rem; color: var(--tone-ink); }

.status-card {
  --tone: var(--neutral);
  --glyph: var(--surface);
  container-type: inline-size;
  position: relative;
  overflow: hidden;
  padding: 1.25rem 1.1rem 1.1rem;
  background: var(--surface);
  border: 1.5px solid color-mix(in oklab, var(--tone) 42%, var(--line));
  border-radius: 1.5rem;
  box-shadow: 0 1px 2px rgb(10 14 24 / 0.06), 0 12px 32px -12px rgb(10 14 24 / 0.18);
}
.status-card[data-tone='clear'] { --tone: var(--clear); }
.status-card[data-tone='watch'] { --tone: var(--watch); }
.status-card[data-tone='suspended'] { --tone: var(--suspended); }
.status-card > * { position: relative; }
/* Range rings behind the verdict, tinted by status. */
.status-card .rings {
  position: absolute; left: -10%; right: -10%; top: -30%; height: 110%; pointer-events: none;
  background: repeating-radial-gradient(circle at 50% 46%, transparent 0 2.2rem, color-mix(in oklab, var(--tone) 26%, transparent) 2.2rem calc(2.2rem + 1px));
  -webkit-mask-image: radial-gradient(circle at 50% 46%, #000 0, transparent 68%);
  mask-image: radial-gradient(circle at 50% 46%, #000 0, transparent 68%);
}
.card-head { display: flex; align-items: center; justify-content: center; gap: 0.6rem; flex-wrap: wrap; text-align: center; }
.place-name { font-size: 1.05rem; font-weight: 700; font-stretch: 100%; color: var(--text-2); letter-spacing: 0; }
.verdict { display: flex; align-items: center; justify-content: center; gap: 0.6rem; margin: 1rem 0 0.5rem; color: var(--tone); }
.verdict-icon { width: clamp(2.5rem, 11cqi, 3.75rem); height: clamp(2.5rem, 11cqi, 3.75rem); }
.verdict-word {
  font-weight: 900; font-stretch: 78%; text-transform: uppercase; line-height: 1;
  font-size: clamp(2.2rem, 12.5cqi, 4.4rem); letter-spacing: 0.01em; text-align: center;
}
.reassure { text-align: center; color: var(--text-2); margin: 0.4rem auto 0; max-width: 30rem; }
.countdown { text-align: center; margin-top: 0.25rem; }
.clock { font-family: var(--font-mono); font-weight: 600; font-variant-numeric: tabular-nums; font-size: clamp(2.6rem, 17cqi, 5.2rem); line-height: 1.05; letter-spacing: -0.02em; }
.clock-caption { color: var(--text-2); font-size: 0.9rem; margin: 0.2rem 0 0; }
.resets { display: inline-block; margin: 0.5rem 0 0; font-weight: 700; font-size: 0.85rem; color: var(--watch-ink); }
.caveats { list-style: none; margin: 0.9rem 0 0; padding: 0; display: grid; gap: 0.35rem; }
.caveats li { display: flex; gap: 0.45rem; align-items: flex-start; font-size: 0.88rem; color: var(--text-2); justify-content: center; text-align: left; }
.caveats .ico { margin-top: 0.15rem; color: var(--watch-ink); }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.65rem; margin: 1.25rem 0 0; }
.tile { background: var(--raised); border: 1px solid var(--line); border-radius: 1rem; padding: 0.7rem 0.8rem; min-width: 0; }
.tile dt { display: flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; font-weight: 700; color: var(--text-2); }
.tile:first-child dt .ico { color: var(--strike); } /* the nearest-flash bolt is lightning */
.tile-value { margin: 0.25rem 0 0; font-family: var(--font-mono); font-weight: 600; font-size: 1.15rem; line-height: 1.25; }
.tile-caption { margin: 0.1rem 0 0; font-size: 0.75rem; color: var(--text-3); }
@container (min-width: 34rem) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.provenance { text-align: center; font-size: 0.75rem; color: var(--text-3); margin: 1rem 0; }
.provenance p { margin: 0 0 0.25rem; }

/* One orchestrated entrance: the rings open out, then the card's contents rise in turn. */
@keyframes rings-in { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(0.6rem); } to { opacity: 1; transform: none; } }
.status-card .rings { animation: rings-in 1s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.status-card > :not(.rings) { animation: rise 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.status-card > .card-head { animation-delay: 0.1s; }
.status-card > .verdict { animation-delay: 0.2s; }
.status-card > .reassure, .status-card > .countdown { animation-delay: 0.3s; }
.status-card > .caveats { animation-delay: 0.36s; }
.status-card > .tiles { animation-delay: 0.42s; }

/* ------------------------------------------------------------ rail & lists */

.rail-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.rail-list, .place-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.rail-row {
  display: grid; gap: 0.15rem; width: 100%; text-align: left; padding: 0.7rem 0.8rem; min-height: var(--hit);
  font: inherit; color: var(--text); background: var(--raised); border: 1px solid var(--line); border-radius: 0.85rem; cursor: pointer;
}
.rail-row[aria-current='true'] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.row-name { font-weight: 700; }
.row-rule { font-size: 0.8rem; }

.place-list > li { container-type: inline-size; }
.place-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.35rem 0.75rem; align-items: center;
  padding: 0.85rem 1rem; color: var(--text); text-decoration: none; background: var(--surface);
  border: 1px solid var(--line); border-radius: 1rem;
}
.place-row .row-main { display: grid; }
.place-row .row-watch { grid-column: 1 / -1; display: flex; gap: 0.45rem; align-items: flex-start; font-size: 0.88rem; }
.place-row .row-watch .ico { margin-top: 0.15rem; }
.place-row.watch-off .row-watch .ico { color: var(--watch-ink); }
.place-row .row-chevron { display: none; color: var(--text-3); }
@container (min-width: 36rem) {
  .place-row { grid-template-columns: minmax(0, 1.2fr) auto minmax(0, 1.6fr) auto; }
  .place-row .row-watch { grid-column: auto; }
  .place-row .row-chevron { display: block; }
}

.demo-panel h2 { margin-bottom: 0.4rem; }
.showcase { display: grid; gap: 0.4rem; margin: 0.75rem 0; }
.showcase .btn { justify-content: flex-start; }
.cta { margin-top: 1.25rem; padding: 1rem; border: 1px solid color-mix(in oklab, var(--accent) 45%, var(--line)); border-radius: 1rem; background: color-mix(in oklab, var(--accent) 8%, var(--surface)); }
.cta h3 { margin-bottom: 0.3rem; }
.status-view .demo-panel { margin-top: 1rem; padding: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 1rem; }

/* --------------------------------------------------------------------- map */

.map-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; padding: 0.5rem max(0.75rem, env(safe-area-inset-right)) 0.5rem max(0.75rem, env(safe-area-inset-left)); border-bottom: 1px solid var(--line); }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 0.65rem; overflow: hidden; background: var(--surface); }
.segmented label { position: relative; margin: 0; font-weight: 600; }
.segmented input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.segmented span { display: grid; place-items: center; min-height: var(--hit); min-width: 3.4rem; padding: 0 0.7rem; font-size: 0.9rem; }
.segmented input:checked + span { background: var(--accent); color: var(--accent-fg); font-weight: 800; }
.segmented input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: -3px; }

.map-search-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: flex-start; padding: 0.5rem max(0.75rem, env(safe-area-inset-right)) 0.5rem max(0.75rem, env(safe-area-inset-left)); border-bottom: 1px solid var(--line); }
.search { position: relative; flex: 1 1 14rem; min-width: 0; }
.search-box { display: flex; align-items: center; gap: 0.4rem; padding-left: 0.7rem; min-height: var(--hit); background: var(--surface); border: 1px solid var(--line); border-radius: 0.65rem; color: var(--text-2); }
.search-box input { border: 0; min-height: calc(var(--hit) - 2px); padding-left: 0; background: transparent; }
.search-box input:focus-visible { outline: none; }
.search-box:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
#search-results {
  position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 0.25rem); margin: 0; padding: 0.25rem; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 0.75rem; box-shadow: 0 12px 28px rgb(5 8 14 / 0.28); max-height: 18rem; overflow: auto;
}
#search-results li { display: grid; min-height: var(--hit); padding: 0.4rem 0.6rem; border-radius: 0.5rem; cursor: pointer; align-content: center; }
#search-results li span { font-size: 0.8rem; color: var(--text-2); }
#search-results li[aria-selected='true'], #search-results li:hover { background: color-mix(in oklab, var(--accent) 14%, var(--surface)); }
.map-note { margin: 0; padding: 0.5rem 1rem; font-size: 0.9rem; background: color-mix(in oklab, var(--watch) 12%, var(--surface)); border-bottom: 1px solid var(--line); }

.map-stage { position: relative; flex: 1 1 auto; min-height: 12rem; background: #0b0e14; }
.map-canvas { position: absolute; inset: 0; }
.flash-canvas { position: absolute; pointer-events: none; }
.map-fab {
  position: absolute; right: 0.75rem; bottom: 1.75rem; z-index: 2; width: var(--hit); height: var(--hit);
  display: grid; place-items: center; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 0.7rem; cursor: pointer;
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.3);
}
.map-failure { position: absolute; inset: 1rem; z-index: 3; margin: 0; padding: 1rem; align-self: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.crosshair { position: absolute; left: 50%; top: 50%; width: 3rem; height: 3rem; transform: translate(-50%, -50%); pointer-events: none; z-index: 2; }
.crosshair span { position: absolute; background: #fff; box-shadow: 0 0 0 1px rgb(0 0 0 / 0.7); }
.crosshair span:first-child { left: 0; right: 0; top: calc(50% - 1px); height: 2px; }
.crosshair span:last-child { top: 0; bottom: 0; left: calc(50% - 1px); width: 2px; }

.map-legend, .map-pickbar { padding: 0.6rem max(1rem, env(safe-area-inset-right)) 0.6rem max(1rem, env(safe-area-inset-left)); border-top: 1px solid var(--line); background: var(--surface); }
.map-legend p { margin: 0 0 0.3rem; }
.legend-flash, .legend-radar { display: flex; align-items: center; gap: 0.6rem; font-size: 0.88rem; font-weight: 600; }
.legend-radar.warn { color: var(--watch-ink); }
.swatch-flash { flex: none; width: 1rem; height: 1rem; border-radius: 50%; border: 1.5px solid var(--strike); background: color-mix(in oklab, var(--strike) 30%, transparent); }
.swatch-radar { flex: none; width: 3.4rem; height: 0.5rem; border-radius: 0.25rem; background: linear-gradient(90deg, #149933, #f2d926, #d9331f, #b3269a); }
.legend-about summary { display: flex; align-items: center; min-height: var(--hit); font-size: 0.85rem; font-weight: 600; color: var(--text-2); cursor: pointer; }
.legend-about p { margin: 0 0 0.5rem; }
@media (max-width: 719px) {
  .map-search-row .btn-label { display: none; }
  .map-search-row .btn { min-width: var(--hit); padding: 0 0.6rem; }
  .map-search-row, .map-toolbar { padding-top: 0.35rem; padding-bottom: 0.35rem; }
  .map-search-row { flex-wrap: nowrap; }
}
.map-pickbar { display: grid; gap: 0.35rem; padding-bottom: max(0.75rem, env(safe-area-inset-bottom)); }
.map-pickbar p { margin: 0; }
.pick-title { font-weight: 800; }
.readout { font-family: var(--font-mono); font-size: 1.1rem; font-weight: 600; }
.map-pickbar .row { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.4rem; }
.map-pickbar .row .btn { flex: 1 1 8rem; }

/* ------------------------------------------------- plans, alerts, log, setup */

.mono { font-family: var(--font-mono); font-weight: 600; font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.ico.ok { color: var(--clear); }
.btn-wide { width: 100%; }
.tag-ok { color: var(--clear-ink); border-color: color-mix(in oklab, var(--clear) 55%, var(--line)); background: color-mix(in oklab, var(--clear) 10%, var(--surface)); }
.tag-warn { color: var(--watch-ink); border-color: color-mix(in oklab, var(--watch) 55%, var(--line)); background: color-mix(in oklab, var(--watch) 10%, var(--surface)); }
.tag-bad { color: var(--suspended-ink); border-color: color-mix(in oklab, var(--suspended) 55%, var(--line)); background: color-mix(in oklab, var(--suspended) 10%, var(--surface)); }

/* Paywall */
.paywall h1, .paywall h2 { margin-bottom: 0.5rem; }
.included { list-style: none; margin: 1rem 0; padding: 0; display: grid; gap: 0.6rem; }
.included li { display: flex; gap: 0.6rem; align-items: flex-start; }
.included .ico { color: var(--clear); margin-top: 0.1rem; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0.65rem; border: 0; padding: 0; margin: 1.25rem 0; min-width: 0; }
.plan { position: relative; display: block; margin: 0; font-weight: 400; }
.plan input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.plan-body { display: grid; gap: 0.2rem; height: 100%; padding: 0.9rem 1rem; background: var(--surface); border: 1.5px solid var(--line); border-radius: 1rem; }
.plan input:checked + .plan-body { border-color: var(--accent); background: color-mix(in oklab, var(--accent) 9%, var(--surface)); box-shadow: inset 0 0 0 1px var(--accent); }
.plan input:focus-visible + .plan-body { outline: 3px solid var(--focus); outline-offset: 2px; }
.plan-name { font-weight: 800; font-stretch: 88%; }
.plan-price strong { font-size: 1.9rem; font-weight: 800; font-stretch: 85%; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.plan-extra { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; font-size: 0.85rem; color: var(--text-2); }

/* Alerts and recipients */
.recipients { margin-top: 1.5rem; }
.channel-list { list-style: none; margin: 0.75rem 0; padding: 0; display: grid; gap: 0.5rem; }
.channel-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 0.75rem; padding: 0.7rem 0.85rem; background: var(--raised); border: 1px solid var(--line); border-radius: 0.85rem; }
.channel-main { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.6rem; min-width: 0; flex: 1 1 12rem; }
.channel-main .hint { flex-basis: 100%; margin: 0; }
.channel-name { font-weight: 700; }
.channel-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.phone-form label { margin-top: 0.25rem; }
.code-input { max-width: 12rem; font-family: var(--font-mono); font-size: 1.4rem; letter-spacing: 0.3em; text-align: center; }
.install-help { padding: 0.85rem 1rem; border: 1px solid var(--line); border-radius: 0.85rem; background: var(--raised); }
.install-help ol { margin: 0.5rem 0; padding-left: 1.3rem; }
.install-help li { margin-bottom: 0.3rem; }
.choices { display: grid; gap: 0.5rem; border: 0; padding: 0; margin: 0.75rem 0; min-width: 0; }
.choice { display: flex; align-items: flex-start; gap: 0.7rem; min-height: var(--hit); margin: 0; padding: 0.55rem 0.75rem; font-weight: 400; background: var(--surface); border: 1px solid var(--line); border-radius: 0.75rem; cursor: pointer; }
.choice input { flex: none; width: 1.3rem; height: 1.3rem; margin: 0.15rem 0 0; accent-color: var(--accent); }
.choice span { display: grid; min-width: 0; }
.choice .hint { margin: 0; }

/* Incident log */
.log-filter { max-width: 20rem; margin-bottom: 1rem; }
.incident-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.incident { container-type: inline-size; padding: 1rem 1.1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 1rem; }
.incident-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.incident-times { margin: 0.2rem 0 0; }
.incident-tiles { margin-top: 0.8rem; }
.incident-foot { margin: 0.7rem 0 0; }

/* Setup runs without the demo rail: the page is the focus, and the map joins it on wide screens. */
@media (min-width: 720px) {
  #shell[data-route='start'] { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'top' 'main'; }
  #shell[data-route='start'] #rail { display: none; }
}
@media (min-width: 1100px) {
  #shell[data-route='start'] { grid-template-columns: minmax(26rem, 32rem) minmax(0, 1fr); grid-template-areas: 'top top' 'main map'; }
}

/* Setup */
.stepper ol { list-style: none; display: flex; justify-content: space-between; gap: 0.25rem; margin: 0 0 1.5rem; padding: 0; counter-reset: none; }
.stepper li { flex: 1 1 0; min-width: 0; display: grid; justify-items: center; gap: 0.3rem; position: relative; font-size: 0.75rem; font-weight: 600; color: var(--text-3); text-align: center; }
.stepper li + li::before { content: ''; position: absolute; top: 0.85rem; right: 50%; width: 100%; height: 2px; background: var(--line); z-index: 0; }
.stepper li.done + li::before, .stepper li.now::before { background: var(--accent); }
.step-dot { position: relative; z-index: 1; display: grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; font-size: 0.8rem; font-weight: 800; background: var(--surface); border: 2px solid var(--line); color: var(--text-2); }
.stepper .done .step-dot { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); --glyph: var(--accent); }
.stepper .now .step-dot { border-color: var(--accent); color: var(--accent); }
.stepper .now { color: var(--text); font-weight: 800; }
@media (max-width: 479px) { .stepper li:not(.now) .step-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); } }
.start h1 { margin-bottom: 0.5rem; outline: none; }
.goals { display: grid; gap: 0.5rem; border: 0; padding: 0; margin: 1rem 0 0.5rem; min-width: 0; }
.goal { position: relative; display: block; margin: 0; font-weight: 400; }
.goal input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.goal-body { display: flex; align-items: center; gap: 0.8rem; min-height: 3.4rem; padding: 0.6rem 0.9rem; background: var(--surface); border: 1.5px solid var(--line); border-radius: 0.9rem; }
.goal-body > span { display: grid; min-width: 0; }
.goal-body .hint { margin: 0; }
.goal input:checked + .goal-body { border-color: var(--accent); background: color-mix(in oklab, var(--accent) 9%, var(--surface)); box-shadow: inset 0 0 0 1px var(--accent); }
.goal input:focus-visible + .goal-body { outline: 3px solid var(--focus); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ------------------------------------------------------------------ help button */
/* Bottom right, above the tab bar on phones. On the map views that corner is the legend strip under
   the map, so it clears Google's zoom control, attribution and the locate button. The picker overlay
   (z-index 50) and dialogs sit above it. */
.help-fab {
  position: fixed; z-index: 40;
  right: max(0.75rem, env(safe-area-inset-right));
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 0.75rem);
  display: grid; place-items: center; width: var(--hit); height: var(--hit);
  text-decoration: none; border-radius: 50%;
}
.help-fab span {
  display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 50%;
  font: 800 1.2rem/1 var(--font-body); color: var(--text); background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.22);
}
.help-fab:hover span { background: var(--raised); }
.help-fab:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
@media (min-width: 720px) { .help-fab { bottom: calc(env(safe-area-inset-bottom) + 0.75rem); } }
@media print { .help-fab { display: none; } }
