/*
 * SEISMIC — the design system. "Harbour".
 *
 * Deep navy like the sea floor along a fault line, cream text like survey
 * paper, and coral as the one warm highlight — the only bright thing on
 * screen. A pale harbour blue carries anything secondary. Verdict colours —
 * sea green, sulphur amber, raspberry red — stay reserved for verdicts, and
 * the red leans pink so it is never mistaken for the coral accent.
 *
 * Deliberately flat. No glass, no blur, no glow, no specular edges: surfaces
 * are solid, separated by hairlines, the way a printed survey sheet is. The
 * only texture is the topographic contour map behind everything.
 *
 * Matched to Seismic/DesignSystem/Theme.swift so the browser and the phone are
 * the same instrument.
 */

@font-face { font-family: 'Instrument Serif'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/instrument-serif-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Instrument Serif'; font-style: italic; font-weight: 400; font-display: swap; src: url('../fonts/instrument-serif-400-italic.woff2') format('woff2'); }
@font-face { font-family: 'Schibsted Grotesk'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/schibsted-grotesk-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Schibsted Grotesk'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/schibsted-grotesk-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Schibsted Grotesk'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/schibsted-grotesk-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Schibsted Grotesk'; font-style: normal; font-weight: 700 900; font-display: swap; src: url('../fonts/schibsted-grotesk-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'DM Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/dm-mono-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'DM Mono'; font-style: normal; font-weight: 500 700; font-display: swap; src: url('../fonts/dm-mono-500-normal.woff2') format('woff2'); }

:root {
  --background: #0a1324;
  --background-raised: #0e1a30;
  --surface: #111f38;
  --surface-solid: #111f38;
  --surface-raised: #172946;
  --surface-highest: #213659;

  --glass: rgba(244, 236, 220, 0.04);
  --glass-strong: rgba(244, 236, 220, 0.08);

  --hairline: rgba(244, 236, 220, 0.08);
  --hairline-strong: rgba(244, 236, 220, 0.15);

  --text-primary: #f4ecdc;
  --text-secondary: rgba(244, 236, 220, 0.68);
  --text-tertiary: rgba(244, 236, 220, 0.44);
  --text-ghost: rgba(244, 236, 220, 0.24);

  /* Coral: the one bright thing. Harbour blue: everything secondary. */
  --accent: #ff6f61;
  --accent-secondary: #9ec3e6;
  --accent-dim: rgba(255, 111, 97, 0.13);
  --accent-text: #0a1324;
  /* Kept as a token name so existing references still resolve — but flat. */
  --accent-gradient: #ff6f61;

  --verdict-green: #6fd3a0;
  --verdict-amber: #f6c453;
  --verdict-red: #ff4f8b;
  --verdict-grey: rgba(244, 236, 220, 0.42);

  --axis-x: #ff6f61;
  --axis-y: #9ec3e6;
  --axis-z: #e9c79c;

  --radius: 12px;
  --radius-large: 16px;
  --radius-small: 8px;
  --radius-pill: 999px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 22px;
  --space-6: 28px;
  --space-7: 36px;

  --tap: 48px;

  --font: 'Schibsted Grotesk', 'Helvetica Neue', sans-serif;
  --font-display: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --font-rounded: 'Schibsted Grotesk', 'Helvetica Neue', sans-serif;
  --font-mono: 'DM Mono', ui-monospace, Menlo, monospace;

  --shadow: 0 24px 48px rgba(0, 0, 0, 0.6);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.36, 0.64, 1);

  --dock-height: 64px;
  --dock-inset: 12px;
  --sab: env(safe-area-inset-bottom, 0px);
}

/* ── Reset ─────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior: none;
}

body {
  background: var(--background);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  /* The web view must not offer to select the interface itself; text inside
     content areas opts back in below. */
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; padding: 0; }
h1, h2, h3, h4, p, figure { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── App shell ─────────────────────────────────────────────────────────── */

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  /* env() keeps content clear of the notch and the home indicator. Without it
     the tab bar sits under the gesture area and cannot be tapped. */
  padding-top: env(safe-area-inset-top);
}

#screen {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  /* Clears the floating dock so the last row of any list is reachable. */
  padding-bottom: calc(var(--dock-height) + var(--dock-inset) + 28px + env(safe-area-inset-bottom));
}

.screen-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

/* ── Navigation bar ────────────────────────────────────────────────────── */

.navbar {
  /* The same centred column as the screen content, so on a wide screen the
     title sits above the content as it does on a phone, not off in the
     window's top-left corner. */
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  min-height: 52px;
}

.navbar h1 {
  font-family: var(--font-display);
  font-size: 2.3rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.05;
}

.navbar-title { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding-top: 2px; }
.navbar-blurb {
  font-size: 0.84rem;
  line-height: 1.35;
  color: var(--text-tertiary);
  max-width: 44ch;
}
.navbar { align-items: flex-start; }
.navbar-actions { display: flex; gap: var(--space-2); align-items: center; flex: none; padding-top: 4px; }
.help-glyph {
  font-family: var(--font-display);
  font-size: 1.45rem;
  line-height: 1;
  color: var(--accent);
}
@media (max-width: 420px) {
  .navbar-actions .icon-button { width: 42px; height: 42px; }
}

.icon-button {
  width: var(--tap);
  height: var(--tap);
  border-radius: var(--radius-small);
  background: transparent;
  color: var(--text-primary);
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  border: 1px solid var(--hairline-strong);
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.icon-button:hover { border-color: var(--accent); }
.icon-button:active { background: var(--surface-highest); }

/* ── Panels ────────────────────────────────────────────────────────────── */

.panel {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.panel-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

/* ── Type ──────────────────────────────────────────────────────────────── */

.title { font-family: var(--font-display); font-size: 1.65rem; font-weight: 400; letter-spacing: -0.005em; line-height: 1.1; }
.headline { font-size: 1.02rem; font-weight: 600; }
.body { font-size: 0.96rem; color: var(--text-secondary); }
.body strong { color: var(--text-primary); font-weight: 600; }
.caption { font-size: 0.82rem; color: var(--text-tertiary); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.prose { -webkit-user-select: text; user-select: text; }

/* ── Readouts ──────────────────────────────────────────────────────────── */

.readout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: var(--space-4) var(--space-3);
}

.readout-label {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 2px;
}

.readout-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.35rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.15;
}
.readout-value.large { font-size: 1.7rem; }
.readout-value .unit {
  font-size: 0.72em;
  color: var(--text-tertiary);
  margin-left: 3px;
}

/* ── Buttons ───────────────────────────────────────────────────────────── */
/*
 * The padding lives on the button itself, so the filled background always
 * wraps the label. Putting spacing on a wrapper instead is how a pill ends up
 * hugging its own text with dead space around it.
 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--tap);
  padding: 0 var(--space-5);
  border-radius: var(--radius-small);
  font-size: 0.96rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: transform 0.12s var(--ease), opacity 0.12s var(--ease),
              background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.btn:active { transform: scale(0.985); opacity: 0.85; }
.btn[disabled] { opacity: 0.4; pointer-events: none; }
.btn.block { width: 100%; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
}
.btn-primary:hover { background: #ff8577; }
.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--hairline-strong);
}
.btn-secondary:hover { border-color: var(--text-tertiary); }
.btn-quiet { color: var(--accent); background: none; padding: 0 var(--space-3); }
.btn-danger { background: var(--verdict-red); color: var(--accent-text); }

.button-bar {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius);
}
.button-bar .btn { flex: 1; }

/* ── Segmented control ─────────────────────────────────────────────────── */

.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  padding: 3px;
  background: var(--background);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-small);
}
.segmented button {
  min-height: 36px;
  padding: 0 var(--space-2);
  border-radius: 5px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  /* Labels are kept short enough to fit; this stops a long one destroying the
     layout rather than hiding it behind an ellipsis. */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.segmented button[aria-selected='true'] {
  background: var(--text-primary);
  color: var(--accent-text);
  font-weight: 600;
}

/* ── Pills, badges, notices ────────────────────────────────────────────── */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 4px;
  font-size: 0.76rem;
  font-weight: 600;
  background: var(--surface-highest);
  color: var(--text-secondary);
  white-space: nowrap;
}
.pill.accent { background: var(--accent-dim); color: var(--accent); }
.pill.green { background: rgba(111, 211, 160, 0.13); color: var(--verdict-green); }
.pill.amber { background: rgba(246, 196, 83, 0.13); color: var(--verdict-amber); }
.pill.red { background: rgba(255, 79, 139, 0.13); color: var(--verdict-red); }
.pill.violet { background: rgba(158, 195, 230, 0.14); color: var(--accent-secondary); }

.notice {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-small);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--accent);
}
.notice.warning {
  background: rgba(246, 196, 83, 0.06);
  border-color: rgba(246, 196, 83, 0.22);
  border-left-color: var(--verdict-amber);
}
.notice.critical {
  background: rgba(255, 79, 139, 0.07);
  border-color: rgba(255, 79, 139, 0.26);
  border-left-color: var(--verdict-red);
}
.notice-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.notice-title { font-weight: 600; font-size: 0.96rem; }

/* ── Verdict placard ───────────────────────────────────────────────────── */

.placard {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-5);
  border-radius: var(--radius);
  border: 1px solid currentColor;
  border-left-width: 5px;
  background: var(--surface);
}
.placard .verdict {
  font-family: var(--font-display);
  font-size: 2.3rem;
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.01em;
}
.placard .meaning { color: var(--text-secondary); font-size: 0.95rem; }
.placard.green { color: var(--verdict-green); background: rgba(111, 211, 160, 0.06); }
.placard.amber { color: var(--verdict-amber); background: rgba(246, 196, 83, 0.06); }
.placard.red { color: var(--verdict-red); background: rgba(255, 79, 139, 0.07); }
.placard.grey { color: var(--verdict-grey); }

/* ── Rows ──────────────────────────────────────────────────────────────── */

.row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  min-height: 60px;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
  width: 100%;
  text-align: left;
}
.row:hover { border-color: var(--hairline-strong); }
.row:active { background: var(--surface-raised); }
.row-icon {
  width: 42px;
  height: 42px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--radius-small);
  background: var(--background);
  border: 1px solid var(--hairline);
  color: var(--accent);
}
.row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title {
  font-weight: 600;
  font-size: 1rem;
  /* Long building names wrap rather than truncating: the name is how somebody
     recognises their own building. */
  overflow-wrap: anywhere;
}
.row-chevron { color: var(--text-tertiary); flex: none; }

/* ── Toggle ────────────────────────────────────────────────────────────── */

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: var(--tap);
}
.toggle {
  position: relative;
  width: 52px;
  height: 31px;
  flex: none;
  border-radius: var(--radius-pill);
  background: var(--surface-highest);
  transition: background 0.2s var(--ease);
}
.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: var(--text-primary);
  transition: transform 0.2s var(--ease);
}
.toggle[aria-checked='true'] { background: var(--accent); }
.toggle[aria-checked='true']::after { background: var(--accent-text); }
.toggle[aria-checked='true']::after { transform: translateX(21px); }

/* ── Slider ────────────────────────────────────────────────────────────── */

input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: var(--tap);
  background: none;
}
input[type='range']::-webkit-slider-runnable-track {
  height: 2px;
  border-radius: 1px;
  background: var(--hairline-strong);
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -10px;
  border-radius: 50%;
  background: var(--accent);
  border: 4px solid var(--background);
  box-shadow: 0 0 0 1px var(--accent);
}

/* ── Text fields ───────────────────────────────────────────────────────── */

.field { display: flex; flex-direction: column; gap: 5px; }
.field label {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.field input, .field select, .field textarea {
  min-height: var(--tap);
  padding: 0 var(--space-3);
  border-radius: var(--radius-small);
  background: var(--background);
  border: 1px solid var(--hairline-strong);
  color: var(--text-primary);
  -webkit-user-select: text;
  user-select: text;
  /* 16px minimum stops iOS zooming the whole page when a field is focused. */
  font-size: 16px;
}
.field textarea { padding: var(--space-3); min-height: 90px; resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--accent); outline: none; }

/* ── Empty state ───────────────────────────────────────────────────────── */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--space-4);
  /* Fills the screen so it sits in the middle rather than under the title with
     two-thirds of the screen blank beneath it. */
  min-height: 58vh;
  padding: var(--space-6) var(--space-4);
}
.empty-icon {
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--hairline-strong);
  box-shadow: 0 0 0 10px var(--background), 0 0 0 11px var(--hairline), 0 0 0 22px var(--background), 0 0 0 23px var(--hairline);
  color: var(--accent);
  margin-bottom: 12px;
}
.empty p { max-width: 34ch; }
.empty .btn { width: min(100%, 320px); }

/* ── Charts ────────────────────────────────────────────────────────────── */

.chart { width: 100%; display: block; touch-action: pan-y; }
.chart-legend {
  font-family: var(--font-mono);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  background: currentColor;
  display: inline-block;
}

/* ── 3D ────────────────────────────────────────────────────────────────── */

.scene {
  width: 100%;
  aspect-ratio: 4 / 5;
  max-height: 58vh;
  border-radius: var(--radius);
  background: var(--background);
  overflow: hidden;
  touch-action: none;
  position: relative;
}
.scene canvas { display: block; width: 100%; height: 100%; }

/* ── Overlays ──────────────────────────────────────────────────────────── */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 12, 24, 0.78);
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet {
  width: min(100%, 640px);
  max-height: 92vh;
  overflow-y: auto;
  background: var(--surface-solid);
  border-radius: var(--radius) var(--radius) 0 0;
  border-top: 1px solid var(--hairline-strong);
  padding: var(--space-4);
  padding-bottom: calc(var(--space-6) + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  animation: rise 0.28s var(--ease);
}
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

/* ── Coach marks ───────────────────────────────────────────────────────── */

.tour-dim {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
}
.tour-ring {
  position: fixed;
  z-index: 81;
  border: 2px solid var(--accent);
  border-radius: 12px;
  pointer-events: none;
  transition: all 0.3s var(--ease);
}
.tour-card {
  position: fixed;
  z-index: 82;
  width: min(calc(100% - 32px), 380px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-solid);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: top 0.3s var(--ease);
}
.tour-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.tour-chapter { color: var(--accent); }
.tour-count { color: var(--text-tertiary); }
.tour-try {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border-radius: var(--radius-small);
  background: var(--accent-dim);
  border-left: 3px solid var(--accent);
  font-size: 0.9rem;
  color: var(--text-primary);
}
.tour-try-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.tour-card { max-height: calc(100vh - 32px); overflow-y: auto; }
.tour-progress { display: flex; gap: 4px; }
.tour-progress i {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--surface-highest);
}
.tour-progress i.done { background: var(--accent); }

/* ── Utility ───────────────────────────────────────────────────────────── */

.stack { display: flex; flex-direction: column; gap: var(--space-3); }
.stack-tight { display: flex; flex-direction: column; gap: var(--space-2); }
.hstack { display: flex; align-items: center; gap: var(--space-3); }
.spacer { flex: 1; }
.hidden { display: none !important; }
.center { text-align: center; }

.provenance {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Motion is decoration; anybody who has asked for less gets none. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Ambient background ────────────────────────────────────────────────── */
/*
 * A survey sheet rather than a light show: a faint seismograph grid, the
 * contour map of an epicentre in the top corner, and a low coral warmth from
 * below. Static and non-interactive — AmbientBackground.swift draws
 * the same thing on the phone.
 */

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(90% 55% at 85% -10%, rgba(46, 82, 140, 0.38), transparent 70%),
    radial-gradient(120% 60% at 15% 115%, rgba(255, 111, 97, 0.09), transparent 60%),
    var(--background);
}
.ambient::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(244, 236, 220, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(244, 236, 220, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 75%);
  mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 75%);
}
.ambient i { display: none; }
.ambient i:nth-child(1) {
  display: block;
  position: absolute;
  width: max(1100px, 120vmax);
  aspect-ratio: 1;
  right: max(-420px, -30vmax);
  top: max(-280px, -18vmax);
  background: url('contours.svg') center / contain no-repeat;
  opacity: 0.9;
  animation: settle 2.4s var(--ease) both;
}
@keyframes settle {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 0.9; transform: none; }
}

/* ── Arrival ───────────────────────────────────────────────────────────── */
/*
 * One orchestrated moment per screen: the title, then each panel, lifting in
 * one after another like a trace being drawn. Plays on arrival only.
 */

#screen.arriving .screen-inner > * > *,
#app:has(#screen.arriving) .navbar h1 {
  animation: reveal 0.6s var(--ease) backwards;
}
#screen.arriving .screen-inner > * > *:nth-child(1) { animation-delay: 0.06s; }
#screen.arriving .screen-inner > * > *:nth-child(2) { animation-delay: 0.12s; }
#screen.arriving .screen-inner > * > *:nth-child(3) { animation-delay: 0.18s; }
#screen.arriving .screen-inner > * > *:nth-child(4) { animation-delay: 0.24s; }
#screen.arriving .screen-inner > * > *:nth-child(5) { animation-delay: 0.30s; }
#screen.arriving .screen-inner > * > *:nth-child(6) { animation-delay: 0.36s; }
#screen.arriving .screen-inner > * > *:nth-child(n+7) { animation-delay: 0.42s; }
@keyframes reveal {
  from { opacity: 0; transform: translateY(10px); }
}

/* ── Orb dock ──────────────────────────────────────────────────────────── */
/*
 * Four tabs and the orb between them, as OrbNavigation.swift lays them out:
 * two tabs, the orb, two tabs, in one glass capsule. The orb opens the bloom.
 */

.dock {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--dock-inset) + env(safe-area-inset-bottom));
  width: min(calc(100% - 28px), 520px);
  height: var(--dock-height);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 8px;
  border-radius: var(--radius-large);
  background: var(--surface-solid);
  border: 1px solid var(--hairline-strong);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  z-index: 50;
}

.dock-tab {
  flex: 1;
  min-width: 0;
  height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: var(--radius-small);
  color: var(--text-ghost);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  position: relative;
  transition: color 0.2s var(--ease), transform 0.15s var(--ease);
}
.dock-tab:hover { color: var(--text-secondary); }
.dock-tab:active { transform: scale(0.94); }
.dock-tab span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.dock-tab::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 0;
  height: 2px;
  background: var(--accent);
  transform: translateX(-50%);
  transition: width 0.25s var(--ease);
}
.dock-tab[aria-selected='true'] { color: var(--text-primary); }
.dock-tab[aria-selected='true']::after { width: 22px; }

.orb {
  flex: none;
  width: 50px;
  height: 50px;
  margin: 0 6px;
  border-radius: 50%;
  position: relative;
  display: grid;
  place-items: center;
  color: var(--accent-text);
  background: var(--accent);
  transition: transform 0.35s var(--spring), background 0.2s var(--ease);
}
.orb:hover { background: #ff8577; }
.orb::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  animation: orb-pulse 3s ease-out infinite;
  pointer-events: none;
}
.orb.open { transform: rotate(90deg); }
.orb.open::after { display: none; }
.orb:active { transform: scale(0.92); }
.orb.open:active { transform: rotate(90deg) scale(0.92); }
/* A P-wave leaving the epicentre. */
@keyframes orb-pulse {
  from { transform: scale(1); opacity: 0.7; }
  to { transform: scale(1.7); opacity: 0; }
}

/* ── The bloom ─────────────────────────────────────────────────────────── */

.bloom {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(8, 15, 30, 0.9);
  animation: fade-in 0.16s var(--ease);
  touch-action: none;
}
.bloom-hint {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 14px);
  left: 50%;
  transform: translateX(-50%);
  padding: 7px 12px;
  border-radius: 4px;
  border: 1px solid var(--hairline);
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  max-width: calc(100% - 32px);
  overflow: hidden;
  text-overflow: ellipsis;
  animation: fade-in 0.4s 0.18s var(--ease) backwards;
}
.bloom-purpose {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 58px);
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - 32px), 420px);
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface-solid);
  border: 1px solid var(--hairline-strong);
  border-left: 3px solid var(--accent);
  display: flex;
  flex-direction: column;
  gap: 3px;
  opacity: 0;
  transition: opacity 0.2s var(--ease);
  pointer-events: none;
}
.bloom-purpose.shown { opacity: 1; }
.bloom-purpose strong { font-family: var(--font-display); font-weight: 400; font-size: 1.35rem; }
.bloom-purpose span { font-size: 0.88rem; color: var(--text-secondary); }
.bloom-tile {
  position: absolute;
  width: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  transform: translate(-50%, -50%) scale(0.3);
  opacity: 0;
  transition: transform 0.5s var(--spring), opacity 0.25s var(--ease);
}
.bloom.open .bloom-tile { opacity: 1; }
.bloom-tile .tile {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-small);
  display: grid;
  place-items: center;
  color: var(--text-primary);
  background: var(--surface-solid);
  border: 1px solid var(--hairline-strong);
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.bloom-tile .label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.2;
}
.bloom-tile.focused .tile {
  color: var(--accent-text);
  background: var(--accent);
  border-color: var(--accent);
}
.bloom-tile.focused .label { color: var(--text-primary); }
@keyframes fade-in { from { opacity: 0; } }

/* ── Event takeover ────────────────────────────────────────────────────── */
/*
 * Life safety outranks everything: it covers the whole screen. The colour says
 * which phase without a word — amber before the shaking, red during, blue for
 * a drill — as EventTakeoverView.swift does.
 */

.takeover {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: calc(env(safe-area-inset-top) + 20px) 28px calc(env(safe-area-inset-bottom) + 16px);
  background: #331c05;
  color: #fff;
  overflow-y: auto;
  transition: background 0.4s var(--ease);
}
.takeover.arrived { background: #380d0f; }
.takeover.drill { background: #1a243d; }
.takeover-inner {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}
.takeover-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.09em;
}
.takeover-header .mag { text-align: right; font-family: var(--font-mono); letter-spacing: 0; }
.takeover-header .mag small { display: block; font-size: 9px; opacity: 0.6; font-family: var(--font); }
.takeover-call {
  margin-top: 12px;
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.28);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.1em;
}
.takeover-call small { font-size: 11px; opacity: 0.6; letter-spacing: 0.02em; }
.takeover-call .dot { animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.35; } }
.takeover-count {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 16px 0;
}
.takeover-count .number {
  font-family: var(--font-mono);
  font-size: min(180px, 40vw);
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.takeover-count .now {
  font-family: var(--font-rounded);
  font-size: min(54px, 13vw);
  font-weight: 900;
  letter-spacing: 0.04em;
  animation: throb 1.6s ease-in-out infinite;
}
@keyframes throb { 50% { transform: scale(1.03); } }
.takeover-count .unit {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.11em;
  opacity: 0.85;
}
.takeover-verdict {
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  margin-bottom: 16px;
  border: 2px solid var(--verdict-red);
  background: rgba(255, 79, 139, 0.22);
  animation: rise 0.3s var(--ease);
}
.takeover-verdict.safe { border-color: var(--verdict-green); background: rgba(111, 211, 160, 0.22); }
.takeover-verdict h2 {
  font-family: var(--font-rounded);
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0.03em;
}
.takeover-live {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 12px 16px;
  border-radius: var(--radius-small);
  background: rgba(0, 0, 0, 0.24);
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 16px;
  animation: rise 0.3s var(--ease);
}
.takeover-instruction { text-align: center; margin-bottom: 22px; }
.takeover-instruction h2 {
  font-family: var(--font-rounded);
  font-size: min(32px, 8vw);
  font-weight: 900;
  letter-spacing: 0.03em;
  margin-bottom: 8px;
}
.takeover-instruction p { opacity: 0.85; }
.takeover-actuators { display: flex; gap: 8px; margin-bottom: 12px; }
.takeover-actuators div {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 9px 4px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.45);
}
.takeover-actuators .commanded { color: #fff; }
.takeover-actuators .confirmed { color: #8cf2a6; }
.takeover-actuators .failed { color: #ffa699; }
.btn-emergency {
  width: 100%;
  min-height: 68px;
  border-radius: var(--radius-large);
  background: var(--text-primary);
  color: #0a1324;
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: 0.06em;
}
.btn-emergency:active { transform: scale(0.98); }
.takeover-quiet {
  min-height: var(--tap);
  color: rgba(255, 255, 255, 0.7);
  width: 100%;
}
.takeover-safe {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 16px 22px;
  border-radius: var(--radius-large);
  background: rgba(255, 255, 255, 0.16);
  font-weight: 500;
}

/* ── Emergency call ────────────────────────────────────────────────────── */

.call {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: var(--background);
  display: flex;
  flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 12px) 20px calc(env(safe-area-inset-bottom) + 20px);
  animation: rise 0.3s var(--ease);
}
.call-inner {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 0;
}
.call-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 16px;
  border-radius: var(--radius-small);
  color: var(--verdict-amber);
  background: rgba(246, 196, 83, 0.07);
  border: 1px solid rgba(246, 196, 83, 0.3);
  font-size: 0.82rem;
}
.call-banner strong { display: block; letter-spacing: 0.1em; font-size: 0.72rem; }
.call-header { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.call-header .ring {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--verdict-red);
  background: transparent;
  border: 1px solid rgba(255, 79, 139, 0.5);
  animation: ring 2.2s ease-in-out infinite;
}
@keyframes ring { 50% { transform: scale(1.12); } }
.call-transcript {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 4px 0;
}
.utterance { display: flex; flex-direction: column; gap: 6px; max-width: 88%; animation: rise 0.3s var(--ease); }
.utterance.app { align-self: flex-end; align-items: flex-end; text-align: right; }
.utterance .who { font-family: var(--font-mono); font-size: 0.66rem; font-weight: 400; letter-spacing: 0.13em; color: var(--text-tertiary); }
.utterance.app .who { color: var(--accent); }
.utterance .said {
  padding: 12px 16px;
  border-radius: var(--radius-small);
  background: var(--glass);
  color: var(--text-primary);
  border: 1px solid transparent;
}
.utterance.app .said { background: rgba(255, 111, 97, 0.08); }
.utterance.current .said { border-color: rgba(255, 111, 97, 0.55); }
.utterance.app.current .said { background: rgba(255, 111, 97, 0.15); }
.btn-hangup {
  width: 100%;
  min-height: 62px;
  border-radius: var(--radius);
  background: var(--verdict-red);
  color: #0a1324;
  font-weight: 700;
  font-size: 1.05rem;
}

/* ── Hardware instruments ──────────────────────────────────────────────── */

.test-quake {
  width: 100%;
  min-height: 116px;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--accent-text);
  background: var(--accent);
  transition: transform 0.12s var(--ease), opacity 0.12s var(--ease);
}
.test-quake:active { transform: scale(0.985); }
.test-quake[disabled] { opacity: 0.45; pointer-events: none; }
.test-quake .big { font-family: var(--font-display); font-size: 30px; font-weight: 400; letter-spacing: 0; }
.test-quake .small { font-size: 0.82rem; opacity: 0.85; }

.command-state { font-size: 0.78rem; color: var(--text-tertiary); text-align: center; }
.command-state.sending { color: var(--accent-secondary); }
.command-state.acknowledged { color: var(--accent); }
.command-state.failed { color: var(--verdict-amber); }

.cmd {
  flex: 1;
  min-width: 0;
  min-height: var(--tap);
  padding: 6px 10px;
  border-radius: var(--radius-small);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: transparent;
  border: 1px solid var(--hairline-strong);
  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 600;
  transition: transform 0.12s var(--ease), opacity 0.12s var(--ease);
}
.cmd .cmd-title { display: inline-flex; align-items: center; gap: 6px; }
.cmd:active { transform: scale(0.97); }
.cmd[disabled] { opacity: 0.5; pointer-events: none; }
.cmd.prominent { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.cmd.warn { color: var(--verdict-amber); }
.cmd .command-state { font-size: 0.7rem; font-weight: 500; }
.cmd-row { display: flex; gap: var(--space-3); }

.commentary { max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding-right: 4px; }
.commentary-line { display: flex; gap: 12px; align-items: flex-start; animation: rise 0.25s var(--ease); }
.commentary-line .dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 8px; flex: none; background: var(--text-ghost); }
.commentary-line .dot.sensing { background: var(--accent); }
.commentary-line .dot.acting { background: var(--verdict-amber); }
.commentary-line .dot.good { background: var(--verdict-green); }
.commentary-line .dot.bad { background: var(--verdict-red); }
.commentary-line .text { font-size: 0.94rem; color: var(--text-primary); }
.commentary-line.routine .text { color: var(--text-secondary); }
.commentary-line .spoken { font-size: 0.7rem; color: var(--text-ghost); font-weight: 600; margin-top: 2px; }

.raw-feed { max-height: 280px; overflow-y: auto; font-family: var(--font-mono); font-size: 10.5px; display: flex; flex-direction: column; gap: 3px; -webkit-user-select: text; user-select: text; }
.raw-feed .incoming { color: var(--text-secondary); }
.raw-feed .outgoing { color: var(--accent-secondary); }
.raw-feed .note { color: var(--text-tertiary); }
.raw-feed .fault { color: var(--verdict-amber); }

.step { display: flex; gap: 12px; align-items: flex-start; }
.step .badge {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
  background: var(--surface-highest);
  color: var(--text-ghost);
  font-size: 12px;
  font-weight: 700;
  transition: background 0.3s var(--ease);
}
.step.done .badge { background: var(--accent); color: var(--accent-text); }
.step.active .badge { background: var(--accent-secondary); color: var(--accent-text); animation: blink 1.2s ease-in-out infinite; }
.step .step-title { font-weight: 500; color: var(--text-secondary); }
.step.done .step-title, .step.active .step-title { color: var(--text-primary); }

.dial { width: 62px; height: 62px; flex: none; }

.meter { height: 10px; border-radius: 2px; background: var(--surface-highest); position: relative; overflow: hidden; }
.meter .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; background: var(--accent); transition: width 0.2s var(--ease); }
.meter .fill.hot { background: var(--verdict-amber); }
.meter .mark { position: absolute; top: 0; bottom: 0; width: 1.5px; background: var(--text-secondary); }

.vote-lamps { display: flex; gap: var(--space-3); }
.vote-lamp { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.vote-lamp .lamp {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--text-ghost);
  background: var(--surface-highest);
  border: 1px solid var(--hairline);
  transition: all 0.16s var(--ease);
}
.vote-lamp.on .lamp {
  color: var(--verdict-amber);
  background: rgba(246, 196, 83, 0.12);
  border: 2.5px solid var(--verdict-amber);
}
.vote-lamp .name { font-size: 10px; font-weight: 600; color: var(--text-tertiary); }
.vote-lamp.on .name { color: var(--text-primary); }
.vote-lamp .yes { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-ghost); }
.vote-lamp.on .yes { color: var(--verdict-amber); }

.fusion-summary {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 400;
  text-align: center;
}
.fusion-summary.declared { color: var(--verdict-amber); }

.signal-bars { display: inline-flex; align-items: flex-end; gap: 2px; }
.signal-bars i { width: 3px; border-radius: 1px; background: var(--text-ghost); }
.signal-bars i.on { background: var(--accent); }

.connection-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 4px;
  font-size: 0.76rem;
  font-weight: 600;
  background: var(--surface-highest);
  color: var(--text-secondary);
}
.connection-badge i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.connection-badge.connected { color: var(--verdict-green); background: rgba(111, 211, 160, 0.12); }
.connection-badge.simulated { color: var(--accent-secondary); background: rgba(158, 195, 230, 0.13); }
.connection-badge.connecting, .connection-badge.reconnecting, .connection-badge.scanning {
  color: var(--verdict-amber);
  background: rgba(246, 196, 83, 0.12);
}
.connection-badge.connecting i, .connection-badge.reconnecting i, .connection-badge.scanning i {
  animation: blink 1s ease-in-out infinite;
}

/* ── Demonstration caption ─────────────────────────────────────────────── */

.demo-caption {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  top: calc(env(safe-area-inset-top) + 10px);
  width: min(calc(100% - 24px), 620px);
  z-index: 90;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: var(--surface-solid);
  border: 1px solid var(--hairline-strong);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.demo-caption .demo-text { font-size: 1.02rem; font-weight: 500; min-height: 2.9em; }
.demo-caption .demo-progress { height: 3px; border-radius: 2px; background: var(--surface-highest); overflow: hidden; }
.demo-caption .demo-progress i { display: block; height: 100%; background: var(--accent); transition: width 0.4s var(--ease); }

/* ── Printable report ──────────────────────────────────────────────────── */

.report-sheet { display: none; }
@media print {
  body { background: #fff !important; color: #111 !important; }
  body > *:not(.report-sheet) { display: none !important; }
  .report-sheet { display: block !important; color: #111; font: 11pt/1.45 'Schibsted Grotesk', 'Helvetica Neue', sans-serif; padding: 0; }
  .report-sheet h1 { font-size: 20pt; margin-bottom: 4pt; }
  .report-sheet h2 { font-size: 12pt; margin: 14pt 0 4pt; border-bottom: 1px solid #ccc; padding-bottom: 2pt; }
  .report-sheet table { border-collapse: collapse; width: 100%; }
  .report-sheet td { padding: 3pt 6pt; border-bottom: 1px solid #eee; vertical-align: top; }
  .report-sheet td:first-child { color: #555; width: 40%; }
  .report-sheet .verdict-box { border: 2pt solid #111; padding: 8pt 12pt; margin: 10pt 0; font-size: 14pt; font-weight: 700; }
}

/* ── Web welcome and the Simulate button ─────────────────────────────────── */
.welcome-backdrop {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(6, 12, 24, 0.82);
  animation: rise 0.28s var(--ease);
}
.welcome-card {
  width: min(100%, 520px);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px 20px 18px;
  border-radius: var(--radius);
  background: var(--surface-solid);
  border: 1px solid var(--hairline-strong);
  box-shadow: var(--shadow);
}
.welcome-badge {
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  color: var(--accent);
  border: 1px solid rgba(255, 111, 97, 0.4);
  padding: 4px 9px;
  border-radius: 4px;
}
.welcome-card h2 { font-family: var(--font-display); font-size: 2rem; font-weight: 400; line-height: 1.05; margin: 2px 0 4px; }
.welcome-points { display: flex; flex-direction: column; gap: 12px; margin-bottom: 6px; }
.welcome-point { display: flex; gap: 12px; align-items: flex-start; }
.welcome-point strong { display: block; font-size: 0.95rem; margin-bottom: 2px; }
.welcome-point p { font-size: 0.86rem; line-height: 1.45; color: var(--text-secondary); margin: 0; }
.welcome-icon {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-small);
  display: grid;
  place-items: center;
  color: var(--accent);
  border: 1px solid var(--hairline-strong);
}
.welcome-card .btn { gap: 8px; }
.welcome-foot { font-size: 0.78rem; color: var(--text-tertiary); text-align: center; margin: 2px 0 0; }

.simulate-fab {
  position: fixed;
  right: max(16px, calc(50% - 260px));
  bottom: calc(var(--dock-height) + var(--dock-inset) + 14px + env(safe-area-inset-bottom));
  z-index: 55;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 44px;
  padding: 0 18px 0 15px;
  border: none;
  border-radius: var(--radius-small);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--accent-text);
  background: var(--accent);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  animation: rise 0.28s var(--ease);
}
.simulate-fab:active { transform: scale(0.96); }
.simulate-fab:hover { background: #ff8577; }
.simulate-fab:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 3px; }
/* Room for the Simulate button, so it never covers the last line of a screen. */
#screen { padding-bottom: calc(var(--dock-height) + var(--dock-inset) + 84px + env(safe-area-inset-bottom)); }

/* ── The map ─────────────────────────────────────────────────────────────── */
.quake-map {
  height: 360px;
  border-radius: var(--radius);
  overflow: hidden;
  background: #0d1830;
  border: 1px solid var(--hairline-strong);
  z-index: 0;
}
.quake-map .leaflet-popup-content-wrapper,
.quake-map .leaflet-popup-tip { background: var(--surface-solid); color: var(--text-primary); }
.quake-map .leaflet-popup-content { font: 13px/1.45 var(--font); margin: 10px 14px; }
.quake-map .leaflet-popup-content a { color: var(--accent); }
.quake-map .leaflet-control-attribution { background: rgba(10, 19, 36, 0.8); color: var(--text-tertiary); font-size: 10px; }
.quake-map .leaflet-control-attribution a { color: var(--accent-secondary); }
.quake-map .leaflet-bar a { background: var(--surface-solid); color: var(--text-primary); border-color: var(--hairline-strong); }
.welcome-alert {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: -22px -20px 4px;
  padding: 20px 16px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--accent);
  color: var(--accent-text);
}
.welcome-alert h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 10vw, 3.4rem);
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0;
  line-height: 1;
}
.welcome-lead {
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
  margin: 4px 0 2px;
}

/* A desktop scrollbar takes width from one side of the content only, which
   pushed the column a few pixels off the navbar above it. Reserving the same
   space on both sides keeps the title and the panels on one centre line. */
#screen { scrollbar-gutter: stable both-edges; }
