/* GSV1 Calculator — UI v2
   Dark-first, phone-first. Tokens → components. */

@font-face { font-family: "Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Plex Mono"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Plex Mono"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/ibm-plex-mono-latin-700-normal.woff2") format("woff2"); }

:root {
  --bg: #0b0f17;
  --bg-2: #0f1522;
  --surface: #121a28;
  --surface-2: #182236;
  --surface-3: #1f2b44;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #eef2f7;
  --text-2: #aab4c3;
  --text-3: #6f7a8c;
  --accent: #4da3ff;
  --accent-soft: rgba(77, 163, 255, 0.14);
  --gate: #3ddc97;
  --gate-soft: rgba(61, 220, 151, 0.12);
  --caution: #ffb547;
  --caution-soft: rgba(255, 181, 71, 0.12);
  --critical: #ff5c6c;
  --critical-soft: rgba(255, 92, 108, 0.12);
  --info: #4da3ff;
  --info-soft: rgba(77, 163, 255, 0.10);
  --advisory: #a78bfa;
  --runway: #e6ebf3;
  --runway-ink: #0b0f17;
  --wind: #ffb547;
  --speed: #4da3ff;
  --radius: 16px;
  --radius-sm: 10px;
  --mono: "Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --shadow: 0 1px 0 rgba(255,255,255,0.03) inset, 0 12px 32px -16px rgba(0,0,0,0.8);
  --focus: 0 0 0 3px rgba(77, 163, 255, 0.35);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #eef1f6;
  --bg-2: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f3f6fa;
  --surface-3: #e8edf4;
  --line: rgba(16, 24, 40, 0.08);
  --line-2: rgba(16, 24, 40, 0.14);
  --text: #121826;
  --text-2: #4b5565;
  --text-3: #8491a5;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.10);
  --gate: #0f9d6e;
  --gate-soft: rgba(15, 157, 110, 0.10);
  --caution: #b45309;
  --caution-soft: rgba(217, 119, 6, 0.12);
  --critical: #dc2626;
  --critical-soft: rgba(220, 38, 38, 0.08);
  --info: #2563eb;
  --info-soft: rgba(37, 99, 235, 0.08);
  --advisory: #7c3aed;
  --runway: #1f2937;
  --runway-ink: #ffffff;
  --wind: #ea580c;
  --speed: #2563eb;
  --shadow: 0 1px 2px rgba(16,24,40,0.04), 0 10px 24px -16px rgba(16,24,40,0.18);
  --focus: 0 0 0 3px rgba(37, 99, 235, 0.25);
  color-scheme: light;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1;
  min-height: 100vh;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: none; box-shadow: var(--focus); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------- shell ---------- */
.shell { max-width: 1280px; margin: 0 auto; padding: 0 16px; }
/* Phone: one column in priority order (search, gate, hazards, inputs, wind, derived).
   Desktop: two columns; the wrappers become real columns again. */
@media (max-width: 1023px) {
  .col-left, .col-right { display: contents; }
  .o-head { order: 0; } .o-gate { order: 1; } .o-hz { order: 2; } .o-in { order: 3; } .o-wind { order: 4; } .o-der { order: 5; } .o-foot { order: 6; }
  .shell { display: flex; flex-direction: column; }
}
@media (min-width: 1024px) {
  .shell { display: grid; grid-template-columns: 420px minmax(0, 1fr); gap: 24px; align-items: start; padding: 0 24px; }
  .col-left { position: sticky; top: 16px; }
}

/* top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 0 10px;
}
.wordmark { display: flex; align-items: baseline; gap: 6px; font-weight: 700; letter-spacing: -0.01em; font-size: 1.05rem; }
.wordmark sub { font-size: 0.7em; vertical-align: baseline; position: relative; top: 0.15em; }
.wordmark .tag { font-weight: 500; color: var(--text-3); font-size: 0.8rem; margin-left: 6px; }
.topbar-right { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  display: inline-grid; place-items: center;
  background: transparent; border: 1px solid transparent; color: var(--text-2);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

/* airport search */
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px;
  padding: 6px 6px 6px 14px; box-shadow: var(--shadow);
}
.search:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.search svg { width: 18px; height: 18px; color: var(--text-3); flex-shrink: 0; }
.search input {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: none;
  font-family: var(--mono); font-weight: 600; font-size: 1.25rem; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 8px 0;
}
.search input::placeholder { color: var(--text-3); letter-spacing: 0.02em; font-weight: 500; text-transform: none; font-family: var(--sans); font-size: 1rem; }
.search .go {
  min-height: 40px; padding: 0 16px; border-radius: 10px; border: 0;
  background: var(--accent); color: #fff; font-weight: 700;
}
.search .go:hover { filter: brightness(1.08); }
.search .go[disabled] { opacity: 0.6; cursor: progress; }
.airport-line {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 10px 2px 0; font-size: 0.85rem; color: var(--text-2); min-height: 1.3em;
}
.airport-line .name { font-weight: 600; color: var(--text); }
.airport-line .dot { color: var(--text-3); }
.airport-line .obs { font-family: var(--mono); color: var(--text-3); font-size: 0.8rem; }
.airport-line .warn { color: var(--critical); font-weight: 600; }
.metar-raw {
  margin: 6px 2px 0; font-family: var(--mono); font-size: 0.72rem; line-height: 1.5; color: var(--text-3);
  word-break: break-word;
}

/* ---------- panels ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-top: 14px; overflow: hidden;
}
.panel-h {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 16px 0; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.02em; color: var(--text-3);
}
.panel-h .count { font-family: var(--mono); color: var(--text-2); }
.panel-b { padding: 12px 16px 16px; }

/* ---------- gate hero ---------- */
.gate {
  position: relative;
  padding: 18px 16px 14px; text-align: center;
  background:
    radial-gradient(120% 90% at 50% 0%, var(--gate-soft) 0%, transparent 60%),
    var(--surface);
}
.gate .label { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.02em; color: var(--text-3); }
.gate .num {
  font-family: var(--mono); font-weight: 700; line-height: 1;
  font-size: clamp(5rem, 24vw, 7.5rem); letter-spacing: -0.04em; color: var(--gate);
  margin: 2px 0 0;
}
.gate .num .unit { font-size: 0.28em; font-weight: 600; letter-spacing: 0; color: var(--text-2); margin-left: 0.1em; }
.gate .formula { margin-top: 2px; font-size: 0.82rem; color: var(--text-3); }
.gate .formula b { color: var(--text-2); font-weight: 600; }
.decision {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  margin: 14px -16px -14px; border-top: 1px solid var(--line); background: var(--line);
}
.decision > div { background: var(--surface-2); padding: 10px 12px; text-align: left; }
.decision .k { font-size: 0.72rem; color: var(--text-3); font-weight: 600; }
.decision .v { font-family: var(--mono); font-weight: 600; font-size: 0.95rem; margin-top: 2px; }
.decision .v b { font-weight: 700; letter-spacing: 0.04em; margin-left: 6px; }
.decision .reject b { color: var(--critical); }
.decision .continue b { color: var(--gate); }
.decision .note { font-size: 0.72rem; color: var(--text-3); margin-top: 2px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 600;
  background: var(--surface-3); color: var(--text-2);
}
.pill.ok { background: var(--gate-soft); color: var(--gate); }
.pill.warn { background: var(--caution-soft); color: var(--caution); }
.pill.err { background: var(--critical-soft); color: var(--critical); }

/* ---------- hazards feed ---------- */
.hz-list { display: flex; flex-direction: column; }
.hz {
  display: grid; grid-template-columns: 4px 1fr auto; gap: 12px; align-items: center;
  padding: 11px 16px 11px 12px; border-top: 1px solid var(--line);
  cursor: pointer; user-select: none; text-align: left; background: transparent; border-left: 0; border-right: 0; border-bottom: 0; width: 100%;
}
.hz:first-child { border-top: 0; }
.hz:hover { background: var(--surface-2); }
.hz .rail { width: 4px; height: 100%; min-height: 34px; border-radius: 2px; background: var(--text-3); }
.hz.critical .rail { background: var(--critical); }
.hz.caution .rail { background: var(--caution); }
.hz.info .rail { background: var(--info); }
.hz.advisory .rail { background: var(--advisory); }
.hz .t { font-weight: 600; font-size: 0.95rem; }
.hz .s { font-size: 0.82rem; color: var(--text-2); margin-top: 1px; }
.hz .meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.hz .when { font-family: var(--mono); font-size: 0.74rem; color: var(--text-3); white-space: nowrap; }
/* rows open in place: ⌄ when closed, ⌃ when open (a right-pointing chevron would read as "go to another screen") */
.hz .chev { color: var(--text-3); transition: transform 0.2s ease; transform: rotate(90deg); }
.hz[aria-expanded="true"] .chev { transform: rotate(-90deg); }
.hz-body { padding: 0 16px 14px 28px; font-size: 0.85rem; color: var(--text-2); border-top: 0; }
.hz-body .item { padding: 8px 0; border-top: 1px solid var(--line); }
.hz-body .item:first-child { border-top: 0; }
.hz-body .raw { font-family: var(--mono); font-size: 0.74rem; line-height: 1.5; color: var(--text-3); background: var(--bg-2); border-radius: 8px; padding: 8px 10px; margin-top: 6px; white-space: pre-wrap; word-break: break-word; }
.hz-body .src { font-size: 0.72rem; color: var(--text-3); margin-top: 8px; }
.hz-body a { color: var(--accent); text-decoration: none; font-weight: 600; }
.hz-empty { padding: 16px; color: var(--text-3); font-size: 0.9rem; display: flex; align-items: center; gap: 10px; }
.hz-empty .ok-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gate); box-shadow: 0 0 0 4px var(--gate-soft); }
.badge {
  display: inline-block; padding: 1px 6px; border-radius: 5px; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.03em;
  background: var(--surface-3); color: var(--text-2); vertical-align: middle;
}
.badge.red { background: var(--critical); color: #fff; }
.badge.amber { background: var(--caution); color: #1a1200; }
.badge.blue { background: var(--info); color: #fff; }
.badge.blue.dim { background: transparent; color: var(--info); box-shadow: inset 0 0 0 1px var(--info); }
.badge.green { background: var(--gate); color: #052e1c; }
.badge.purple { background: var(--advisory); color: #fff; }

/* ---------- input tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tile {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 10px 9px; text-align: left; min-height: 64px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 4px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.tile:hover { border-color: var(--line-2); background: var(--surface-3); }
.tile:active { transform: scale(0.985); }
.tile .k { font-size: 0.7rem; font-weight: 600; color: var(--text-3); letter-spacing: 0.01em; }
.tile .v { font-family: var(--mono); font-weight: 600; font-size: 1.12rem; color: var(--text); line-height: 1.1; }
.tile .v small { font-size: 0.68em; color: var(--text-2); font-weight: 500; margin-left: 2px; }
.tile .src { font-size: 0.64rem; color: var(--accent); font-weight: 600; }
.tile.muted .v { color: var(--text-3); }
.tile.wide { grid-column: span 3; }
.seg { display: inline-flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: 9px; padding: 2px; gap: 2px; }
.seg button { min-height: 30px; padding: 0 10px; border-radius: 7px; border: 0; background: transparent; color: var(--text-2); font-weight: 600; font-size: 0.8rem; }
.seg button.active { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.tile-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* editor sheet */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 90; display: none; }
.sheet-backdrop.open { display: block; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  background: var(--surface); border-radius: 20px 20px 0 0; border-top: 1px solid var(--line-2);
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateY(102%); transition: transform 0.25s cubic-bezier(.2,.8,.2,1);
  max-width: 560px; margin: 0 auto;
}
.sheet.open { transform: translateY(0); }
.sheet .grab { width: 36px; height: 4px; border-radius: 2px; background: var(--line-2); margin: 0 auto 10px; }
.sheet .sh-title { font-size: 0.8rem; font-weight: 600; color: var(--text-3); }
.sheet .sh-val { font-family: var(--mono); font-weight: 700; font-size: 2.4rem; letter-spacing: -0.02em; margin: 2px 0 8px; }
.sheet .sh-val small { font-size: 0.4em; color: var(--text-2); font-weight: 600; margin-left: 4px; }
.sheet .row { display: flex; align-items: center; gap: 10px; }
.step { width: 48px; height: 48px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface-2); font-size: 1.4rem; font-weight: 600; }
.range { -webkit-appearance: none; appearance: none; flex: 1; height: 6px; border-radius: 999px; background: var(--surface-3); outline: none; margin: 0; }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); border: 3px solid var(--surface); box-shadow: 0 1px 6px rgba(0,0,0,0.5); cursor: pointer; }
.range::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); border: 3px solid var(--surface); cursor: pointer; }
.sheet .ticks { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 0.7rem; color: var(--text-3); margin: 6px 58px 0; }
.sheet .sh-note { font-size: 0.8rem; color: var(--text-3); margin-top: 10px; }
.sheet .done { width: 100%; margin-top: 14px; min-height: 46px; border-radius: 12px; border: 0; background: var(--accent); color: #fff; font-weight: 700; }

/* ---------- wind & runway ---------- */
.rwy-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rwy-select {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px;
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 10px; font-weight: 600;
}
.rwy-select .id { font-family: var(--mono); font-size: 1.1rem; }
.rwy-select svg { width: 14px; height: 14px; color: var(--text-3); }
.wind-readout { font-family: var(--mono); font-size: 0.9rem; color: var(--text-2); }
.wind-readout b { color: var(--text); font-weight: 600; }
.dial-wrap { position: relative; max-width: 380px; margin: 6px auto 0; }
.dial-wrap svg { width: 100%; height: auto; display: block; touch-action: pan-y; user-select: none; }
.dial-wrap .ring-lbl { position: absolute; font-family: var(--mono); font-size: 0.66rem; color: var(--text-3); }
.components { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.comp { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.comp .k { font-size: 0.68rem; color: var(--text-3); font-weight: 600; }
.comp .v { font-family: var(--mono); font-weight: 600; font-size: 1rem; margin-top: 2px; }
.comp .v.hw { color: var(--gate); }
.comp .v.tw { color: var(--critical); }
.legend { display: flex; gap: 14px; justify-content: center; font-size: 0.72rem; color: var(--text-3); margin-top: 8px; flex-wrap: wrap; }
.legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.legend .l-rwy::before { background: var(--runway); }
.legend .l-wind::before { background: var(--wind); }
.legend .l-spd::before { background: var(--speed); }

/* runway list popover */
.rwy-pop {
  position: absolute; z-index: 60; top: calc(100% + 6px); right: 0; min-width: 280px; max-width: 100%;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 16px 40px -8px rgba(0,0,0,0.6);
  padding: 4px; display: none;
}
.rwy-pop.open { display: block; }
.rwy-opt { display: grid; grid-template-columns: 56px 1fr auto; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.rwy-opt:hover { background: var(--surface-2); }
.rwy-opt.selected { background: var(--accent-soft); }
.rwy-opt .id { font-family: var(--mono); font-weight: 700; font-size: 1.05rem; }
.rwy-opt .d { font-size: 0.75rem; color: var(--text-3); }
.rwy-opt .w { font-family: var(--mono); font-size: 0.8rem; text-align: right; }
.rwy-opt .w .hw { color: var(--gate); } .rwy-opt .w .tw { color: var(--critical); } .rwy-opt .w .xw { color: var(--text-2); }

/* ---------- details grid ---------- */
.kv { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.kv > div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.kv .k { font-size: 0.66rem; color: var(--text-3); font-weight: 600; }
.kv .v { font-family: var(--mono); font-weight: 600; font-size: 0.95rem; margin-top: 2px; }
@media (max-width: 420px) { .kv { grid-template-columns: repeat(2, 1fr); } }

/* ---------- actions & footer ---------- */
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.btn { min-height: 46px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; font-weight: 700; }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn svg { width: 16px; height: 16px; }
.foot { margin: 22px 0 0; font-size: 0.72rem; color: var(--text-3); line-height: 1.6; }
.foot a { color: var(--text-2); text-decoration: none; }
.foot a:hover { color: var(--accent); }
.foot .warn { color: var(--text-2); }

/* status chips */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 0.74rem; font-weight: 600; color: var(--text-2); }
.chip .d { width: 7px; height: 7px; border-radius: 50%; background: var(--gate); }
.chip.off .d { background: var(--critical); }

/* mobile sticky gate */
.gate-mini {
  position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); z-index: 50;
  display: none; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; padding: 8px 14px;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.7); cursor: pointer;
}
.gate-mini.visible { display: flex; }
@media (min-width: 1024px) { .gate-mini.visible { display: none; } }
.gate-mini .k { font-size: 0.7rem; color: var(--text-3); font-weight: 600; }
.gate-mini .v { font-family: var(--mono); font-weight: 700; font-size: 1.3rem; color: var(--gate); line-height: 1; }
.gate-mini .go { font-size: 0.78rem; color: var(--accent); font-weight: 600; }

/* loading */
.loading { position: fixed; inset: 0; z-index: 200; display: none; align-items: center; justify-content: center; flex-direction: column; gap: 12px; background: rgba(11,15,23,0.85); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
:root[data-theme="light"] .loading { background: rgba(238,241,246,0.85); }
.loading.active { display: flex; }
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading .t { font-weight: 700; }
.loading .d { font-size: 0.85rem; color: var(--text-2); max-width: 320px; text-align: center; }

/* ======================================================= v2 components (app) */
.metar-raw.err { color: var(--critical); font-family: var(--sans); font-weight: 600; font-size: 0.85rem; }
.metar-raw:empty { display: none; }
.load-progress { margin: 10px 2px 0; }
.load-progress .bar { height: 3px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.load-progress .fill { height: 100%; width: 10%; background: var(--accent); transition: width .3s ease; }
.load-progress .txt { font-size: 0.75rem; color: var(--text-3); margin-top: 6px; }
.note { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--caution-soft); color: var(--text-2); font-size: 0.82rem; line-height: 1.5; }
.note.warn { color: var(--caution); font-weight: 600; margin: 10px 0 0; }
.note b { color: var(--text); }
.tile[hidden] { display: none; }
.tile .k, .tile .v, .tile .src { pointer-events: none; }
.kv .s { font-size: 0.64rem; color: var(--text-3); margin-top: 2px; }
.kv > div[hidden] { display: none; }
.components { grid-template-columns: 1fr 1fr; }
.gate .num #gs_gate { display: inline; }
.gate .note-s { font-size: 0.72rem; color: var(--text-3); margin-top: 2px; }
.seg.small button { min-height: 26px; padding: 0 8px; font-size: 0.74rem; }

/* runway selector */
.rwy-select-wrap { position: relative; flex: 1; min-width: 0; }
.rwy-select { width: 100%; justify-content: flex-start; text-align: left; color: var(--text); }
.rwy-select .d { font-size: 0.76rem; color: var(--text-3); font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rwy-select:hover { border-color: var(--accent); }
.rwy-side { font-family: var(--mono); font-size: 0.85rem; color: var(--text-2); white-space: nowrap; }
.rwy-pop { left: 0; right: auto; width: 100%; min-width: 300px; max-height: 340px; overflow-y: auto; }
@media (max-width: 380px) { .rwy-pop { min-width: 0; } }
.rwy-opt { grid-template-columns: 52px 1fr auto; }
.rwy-opt .runway-row-main { display: block; }
.rwy-opt .mid { min-width: 0; }
.rwy-opt .runway-row-details { margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px; }
.rwy-opt.replay-hover { background: var(--surface-2); }

/* hazard rows & details */
.hz-row + .hz-row .hz { border-top: 1px solid var(--line); }
.hz-row:first-child .hz { border-top: 0; }
.hz .main { min-width: 0; }
.hz .t { overflow-wrap: anywhere; }
.hz[data-static] { cursor: default; }
.hz[data-static]:hover { background: transparent; }
.hz-body[hidden] { display: none; }
.hz-body { padding: 0 16px 14px 28px; }
.item .ih { color: var(--text); font-size: 0.85rem; line-height: 1.5; }
.item .ib { margin-top: 3px; line-height: 1.5; }
.item .sub, .sub { font-size: 0.76rem; color: var(--text-3); margin-top: 2px; }
.sub-block { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--bg-2); }
.sub-block .ib { margin-top: 4px; }
details.more { margin-top: 6px; }
details.more summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 0.78rem; }
.notam-item-active .ih { color: var(--critical); }
.radar-img { display: block; width: 100%; max-width: 600px; border-radius: 10px; cursor: zoom-in; background: var(--bg-2); min-height: 120px; }
:root:not([data-theme="light"]) .radar-img { filter: invert(1) hue-rotate(180deg) brightness(0.9); }
.radar-tools { display: flex; gap: 12px; align-items: center; margin-top: 8px; }
.btn-sm { min-height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface-2); font-weight: 600; font-size: 0.78rem; }
.link { color: var(--accent); font-weight: 600; text-decoration: none; font-size: 0.82rem; }
.hz-empty[hidden] { display: none; }
.hz-row[data-severity="critical"] .hz .t { color: var(--text); }

/* sheets */
.sheet { max-height: 88vh; overflow-y: auto; }
.sh-head { display: flex; align-items: center; justify-content: space-between; }
.sh-val { display: flex; align-items: baseline; gap: 6px; }
.sh-input { width: 7ch; background: transparent; border: 0; border-bottom: 2px solid var(--line-2); font-family: var(--mono); font-weight: 700; font-size: 2.4rem; letter-spacing: -0.02em; color: var(--text); padding: 0; outline: none; }
.sh-input:focus { border-color: var(--accent); }
.help-body { font-size: 0.9rem; color: var(--text-2); line-height: 1.6; }
.help-body ol { padding-left: 1.2rem; margin: 8px 0; }
.help-body li { margin-bottom: 6px; }
.help-body b { color: var(--text); }
.help-body .fine { font-size: 0.8rem; color: var(--text-3); }
#help-section .sh-title { margin-bottom: 6px; font-size: 0.95rem; color: var(--text); }
@media (min-width: 768px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: 480px; border-radius: 20px; border: 1px solid var(--line-2); transform: translate(-50%, -46%) scale(0.98); opacity: 0; pointer-events: none; transition: transform .2s ease, opacity .2s ease; padding-bottom: 20px; }
  .sheet.open { transform: translate(-50%, -50%); opacity: 1; pointer-events: auto; }
  .sheet .grab { display: none; }
}

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); opacity: 0; z-index: 300;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 24px);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; padding: 10px 12px 10px 16px; box-shadow: 0 16px 40px -8px rgba(0,0,0,0.6); transition: transform .25s ease, opacity .25s ease; font-size: 0.88rem; }
.toast.in { transform: translate(-50%, 0); opacity: 1; }
.toast .ta { display: flex; gap: 8px; }
.toast .btn { min-height: 34px; padding: 0 12px; font-size: 0.82rem; }

/* auth menu */
.auth-dropdown { position: relative; }
.auth-icon.signed-in { color: var(--gate); }
.auth-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 120; width: 280px; display: none; background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; padding: 14px; box-shadow: 0 16px 40px -8px rgba(0,0,0,0.6); }
.auth-menu.show { display: block; }
.auth-menu .sh-title { margin-bottom: 10px; }
.fld { display: block; margin-bottom: 8px; }
.fld span { display: block; font-size: 0.72rem; color: var(--text-3); margin-bottom: 4px; font-weight: 600; }
.fld input { width: 100%; min-height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text); font-size: 16px; }
.fld input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.btn-row { display: flex; gap: 8px; margin-top: 10px; }
.btn-row .btn { flex: 1; min-height: 40px; font-size: 0.85rem; }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 400; background: rgba(0,0,0,0.92); display: flex; align-items: center; justify-content: center; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100vw; max-height: 100vh; object-fit: contain; touch-action: pinch-zoom; }
.lb-close { position: fixed; top: calc(14px + env(safe-area-inset-top, 0px)); right: 14px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,0.14); color: #fff; font-size: 1.6rem; }

/* replay */
.replay-pointer { position: fixed; z-index: 500; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; background: rgba(77,163,255,0.35); border: 2px solid var(--accent); pointer-events: none; transition: left .18s ease, top .18s ease; }
.replay-pointer.ripple { animation: ripple .6s ease-out; }
@keyframes ripple { from { box-shadow: 0 0 0 0 rgba(77,163,255,0.6); } to { box-shadow: 0 0 0 22px rgba(77,163,255,0); } }
.replay-flash { box-shadow: 0 0 0 3px var(--accent) !important; transition: box-shadow .2s; }

/* safe areas (notch / home indicator) */
.shell { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.topbar { padding-top: max(14px, env(safe-area-inset-top)); }
body { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 1024px) { body { padding-bottom: 32px; } }
@media (hover: none) { .tile:hover, .hz:hover, .icon-btn:hover { background: inherit; } }

/* ======================================================= print briefing */
.print-sheet { display: none; }
@media print {
  :root, html { color-scheme: light !important; }
  @page { size: auto; margin: 0.5in; }
  html, body { background: #fff !important; color: #0f172a !important; padding: 0 !important; }
  body > *:not(.print-sheet) { display: none !important; }
  .print-sheet { display: block !important; font-family: -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 9pt; line-height: 1.25; color: #0f172a; }
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  .p-head { text-align: center; border-radius: 4px; overflow: hidden; margin-bottom: 4pt; }
  .p-title { background: #0f172a; color: #fff; font-weight: 800; font-size: 12pt; letter-spacing: .5pt; padding: 4pt; }
  .p-apt { background: #1e3a8a; color: #fff; font-weight: 600; padding: 3pt; }
  .p-banner { border: 2px solid #dc2626; background: #fee2e2; color: #991b1b; font-weight: 800; text-align: center; padding: 3pt; border-radius: 4px; margin: 4pt 0; font-size: 8pt; text-transform: uppercase; }
  .p-rw1 { font-family: ui-monospace, Menlo, monospace; font-weight: 800; font-size: 11pt; text-align: center; padding: 3pt; background: #fef3c7; border: 2px solid #f59e0b; border-radius: 4px 4px 0 0; color: #78350f; }
  .p-v1 { color: #b91c1c; }
  .p-rw2 { font-family: ui-monospace, Menlo, monospace; font-size: 7.5pt; text-align: center; padding: 2pt; background: #fffbeb; border: 2px solid #f59e0b; border-top: 0; border-radius: 0 0 4px 4px; color: #78350f; }
  .p-wind { font-family: ui-monospace, Menlo, monospace; font-weight: 600; font-size: 8.5pt; text-align: center; padding: 3pt; margin: 4pt 0; background: #dbeafe; border: 2px solid #3b82f6; border-radius: 4px; color: #1e3a8a; }
  .p-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3pt; margin: 4pt 0; }
  .p-grid > div { border: 1px solid #cbd5e1; background: #f8fafc; border-radius: 3px; text-align: center; padding: 3pt; }
  .p-k { font-size: 6.5pt; font-weight: 700; color: #475569; letter-spacing: .3pt; }
  .p-v { font-size: 11pt; font-weight: 700; color: #1e3a8a; font-family: ui-monospace, Menlo, monospace; }
  .p-dial { text-align: center; margin: 2pt 0; }
  .p-box { border-radius: 4px; padding: 4pt 6pt; margin: 4pt 0; font-size: 8pt; }
  .p-box.amber { background: #fef3c7; border: 2px solid #f59e0b; color: #78350f; }
  .p-hz { margin: 1pt 0; padding-left: 4pt; border-left: 2px solid #f59e0b; }
  .p-s { font-size: 7pt; color: #64748b; }
  .p-gate { text-align: center; border: 2px solid #059669; background: #ecfdf5; border-radius: 4px; padding: 4pt; margin: 4pt 0; }
  .p-gnum { font-family: ui-monospace, Menlo, monospace; font-weight: 800; font-size: 38pt; line-height: 1; color: #065f46; margin: 2pt 0; }
  .p-sop { border: 2px solid #22c55e; background: #f0fdf4; border-radius: 4px; padding: 4pt 6pt; margin: 4pt 0; font-size: 9pt; }
  .p-sop .r { color: #b91c1c; } .p-sop .g { color: #047857; }
  .p-foot { font-size: 6.5pt; color: #64748b; text-align: center; border-top: 1px solid #cbd5e1; margin-top: 6pt; padding-top: 3pt; }
  .p-head, .p-rw, .p-wind, .p-grid, .p-dial, .p-gate, .p-sop, .p-box, .p-foot { break-inside: avoid; }
}
[hidden] { display: none !important; }
.sheet:not(.open) { visibility: hidden; }
@media (min-width: 768px) { .sheet:not(.open) { visibility: hidden; } }

/* ======================================================= v0.20261017-C: refresh, curtain, i18n */
:root {
  --bg: #090d15; --bg-2: #0d1320; --surface: #111827; --surface-2: #172033; --surface-3: #1e2a42;
  --radius: 20px; --radius-sm: 12px;
  --glow-a: rgba(77, 163, 255, 0.16); --glow-b: rgba(61, 220, 151, 0.10);
  --panel-hi: rgba(255, 255, 255, 0.035);
  --shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 20px 40px -24px rgba(0,0,0,0.9);
}
:root[data-theme="light"] {
  --bg: #eef2f8; --bg-2: #f5f7fb; --surface: #ffffff; --surface-2: #f4f6fb; --surface-3: #e7ecf4;
  --glow-a: rgba(37, 99, 235, 0.10); --glow-b: rgba(15, 157, 110, 0.08);
  --panel-hi: rgba(255, 255, 255, 0);
  --shadow: 0 1px 2px rgba(16,24,40,0.04), 0 16px 32px -20px rgba(16,24,40,0.22);
}
body {
  background:
    radial-gradient(900px 520px at 8% -8%, var(--glow-a), transparent 60%),
    radial-gradient(800px 480px at 100% 0%, var(--glow-b), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  letter-spacing: -0.005em;
}

/* top bar */
.wordmark { align-items: center; gap: 8px; font-size: 1.12rem; }
.wordmark .logo { width: 28px; height: 28px; border-radius: 8px; box-shadow: 0 4px 14px -4px rgba(77,163,255,0.45); }
.wordmark sub { top: 0.2em; }
.wordmark .tag { margin-left: 2px; }
@media (max-width: 400px) { .wordmark .tag { display: none; } }
.lang-pick { position: relative; display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 6px 0 9px; border-radius: 10px; color: var(--text-2); cursor: pointer; }
.lang-pick:hover { background: var(--surface-2); color: var(--text); }
.lang-pick svg { width: 17px; height: 17px; flex-shrink: 0; }
.lang-pick select { appearance: none; -webkit-appearance: none; background: transparent; border: 0; color: inherit; font: 600 0.78rem var(--sans); letter-spacing: 0.04em; padding: 0 2px; cursor: pointer; outline: none; }
.lang-pick select option { color: #111; }
.lang-pick:focus-within { box-shadow: var(--focus); }

/* search */
.search { border-radius: 16px; padding: 7px 7px 7px 16px; background: linear-gradient(180deg, var(--panel-hi), transparent), var(--surface); }
.search .go { min-height: 42px; padding: 0 18px; border-radius: 12px; background: linear-gradient(180deg, #62b2ff, #2f86f0); box-shadow: 0 6px 16px -8px rgba(47,134,240,0.9); }
:root[data-theme="light"] .search .go { background: linear-gradient(180deg, #3b82f6, #1d5fe0); }

/* panels */
.panel { border-radius: var(--radius); background: linear-gradient(180deg, var(--panel-hi), transparent 120px), var(--surface); margin-top: 16px; }
.panel-h { padding: 14px 18px 0; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; }
.panel-h .ph-t { display: inline-flex; align-items: center; gap: 8px; }
.panel-h .ph-t svg { width: 15px; height: 15px; color: var(--accent); opacity: 0.9; }
.panel-h .pill { text-transform: none; letter-spacing: 0; }
.panel-b { padding: 12px 18px 18px; }

/* gate hero */
.gate { padding: 20px 18px 18px; background:
  radial-gradient(70% 90% at 50% -10%, rgba(61, 220, 151, 0.18) 0%, transparent 70%),
  linear-gradient(180deg, var(--panel-hi), transparent 120px), var(--surface); }
:root[data-theme="light"] .gate { background: radial-gradient(70% 90% at 50% -10%, rgba(15, 157, 110, 0.12) 0%, transparent 70%), var(--surface); }
.gate .label { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; }
.gate .num { font-size: clamp(5.4rem, 26vw, 8.5rem); margin-top: 4px;
  background: linear-gradient(180deg, #7dfcc4 0%, var(--gate) 55%, #1fae75 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 8px 28px rgba(61, 220, 151, 0.22)); }
:root[data-theme="light"] .gate .num { background: linear-gradient(180deg, #16b47f, #0b7a55); -webkit-background-clip: text; background-clip: text; filter: none; }
.gate .num .unit { -webkit-text-fill-color: var(--text-3); color: var(--text-3); }
.decision { margin: 18px 0 0; gap: 10px; background: transparent; border-top: 0; }
.decision > div { border-radius: 14px; padding: 12px 14px; border: 1px solid var(--line); }
.decision .reject { background: linear-gradient(135deg, var(--critical-soft), transparent 80%), var(--surface-2); }
.decision .continue { background: linear-gradient(135deg, var(--gate-soft), transparent 80%), var(--surface-2); }
.decision .v { font-size: 1.02rem; }
.decision .continue .k { display: none; }
@media (max-width: 420px) { .decision { grid-template-columns: 1fr; } .decision .continue .k { display: none; } }

/* hazards */
.hz { padding: 13px 18px 13px 14px; gap: 14px; }
.hz .rail { width: 4px; border-radius: 4px; }
.hz.critical .rail { box-shadow: 0 0 12px rgba(255, 92, 108, 0.55); }
.hz-row[data-severity="critical"] > .hz { background: linear-gradient(90deg, var(--critical-soft), transparent 55%); }
.hz-row[data-severity="caution"] > .hz { background: linear-gradient(90deg, var(--caution-soft), transparent 45%); }
.hz .t { font-size: 0.98rem; letter-spacing: -0.01em; }
.hz-body { padding: 2px 18px 16px 32px; }
.hz-empty { padding: 18px; }

/* tiles: rows always fill (no empty slots) */
.tiles { display: flex; flex-wrap: wrap; gap: 10px; }
.tile { flex: 1 1 calc(33.333% - 10px); min-width: 96px; border-radius: 14px; padding: 11px 12px 10px; min-height: 70px;
  background: linear-gradient(180deg, var(--panel-hi), transparent), var(--surface-2); transition: border-color .15s ease, background-color .15s ease, transform .15s ease; }
.tile:hover { transform: translateY(-1px); }
.tile .v { font-size: 1.28rem; }
.tile.wide { flex-basis: 100%; min-height: 0; padding: 9px 12px; }
.seg { border-radius: 11px; padding: 3px; }
.seg button { border-radius: 8px; min-height: 32px; padding: 0 12px; }
.seg button.active { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px rgba(77,163,255,0.35); }
:root[data-theme="light"] .seg button.active { box-shadow: inset 0 0 0 1px rgba(37,99,235,0.30); }

/* derived: rows always fill */
.kv { display: flex; flex-wrap: wrap; gap: 10px; }
.kv > div { flex: 1 1 calc(25% - 10px); min-width: 130px; border-radius: 12px; padding: 10px 12px; }
@media (max-width: 420px) { .kv > div { flex-basis: calc(50% - 10px); min-width: 0; } }
.kv .v { font-size: 1.02rem; }

/* wind */
.components { gap: 10px; }
.comp { border-radius: 12px; padding: 10px 12px; }
.rwy-select { border-radius: 12px; min-height: 44px; }
.dial-wrap { max-width: 400px; }

/* actions */
.btn { border-radius: 14px; min-height: 48px; }
.btn.primary { background: linear-gradient(180deg, #62b2ff, #2f86f0); box-shadow: 0 10px 22px -12px rgba(47,134,240,0.9); }
:root[data-theme="light"] .btn.primary { background: linear-gradient(180deg, #3b82f6, #1d5fe0); }
.gate-mini { border-radius: 16px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); background: color-mix(in srgb, var(--surface) 82%, transparent); }
.gate-mini .v { color: var(--gate); }

/* curtain */
.curtain { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center;
  background: radial-gradient(700px 420px at 50% 30%, var(--glow-a), transparent 70%), var(--bg);
  transition: opacity .38s ease, visibility .38s ease; }
.curtain.lifting { opacity: 0; }
.curtain.gone { opacity: 0; visibility: hidden; pointer-events: none; }
.curtain-card { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 24px; text-align: center; }
.curtain-logo svg { width: 92px; height: 92px; display: block; }
.curtain-arc { transform-origin: 60px 60px; animation: spin 1.1s linear infinite; }
.curtain-title { font-weight: 700; font-size: 1.4rem; letter-spacing: -0.01em; }
.curtain-title sub { font-size: 0.65em; }
.curtain-msg { font-size: 0.9rem; color: var(--text-2); min-height: 1.4em; max-width: 320px; }
.curtain-bar { width: 200px; height: 3px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.curtain-fill { height: 100%; width: 8%; background: linear-gradient(90deg, var(--accent), var(--gate)); transition: width .35s ease; }
body.booting { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .curtain-arc { animation: none; } }

/* print: exactly one page */
@media print {
  html, body { height: auto !important; min-height: 0 !important; overflow: visible !important; background: #fff !important; }
  body { padding: 0 !important; margin: 0 !important; }
  .curtain { display: none !important; }
  @page { size: portrait; margin: 0.4in; }
  .print-sheet { max-height: 10in; overflow: hidden; break-after: avoid; page-break-after: avoid; }
  .print-sheet > :last-child { margin-bottom: 0; }
}
.wordmark .tag, .chip { white-space: nowrap; }
@media (max-width: 480px), (min-width: 1024px) { .wordmark .tag { display: none; } }
.panel-h .wind-readout, .panel-h .count { text-transform: none; letter-spacing: 0; }

/* ---- always-visible gate: top bar that drops in when the big number scrolls away (all screen sizes) */
.gate-mini { display: none !important; }
body { padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)); }
.gate-bar {
  position: fixed; z-index: 95; top: 0; left: 50%; width: min(100%, 1280px); transform: translate(-50%, -110%);
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--surface) 95%, transparent); backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border-bottom: 1px solid var(--line-2); box-shadow: 0 10px 30px -18px rgba(0,0,0,0.8);
  transition: transform .22s cubic-bezier(.2,.8,.2,1); cursor: pointer;
}
@media (min-width: 1024px) { .gate-bar { border-radius: 0 0 18px 18px; border: 1px solid var(--line-2); border-top: 0; width: min(calc(100% - 48px), 1232px); } }
.gate-bar.visible { transform: translate(-50%, 0); }
.gate-bar .gb-l { display: flex; flex-direction: column; line-height: 1.05; }
.gate-bar .gb-l .k { font-size: 0.64rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.gate-bar .gb-l .v { font-family: var(--mono); font-weight: 700; font-size: 1.75rem; letter-spacing: -0.03em; color: var(--gate); }
.gate-bar .gb-m { display: flex; flex-direction: column; gap: 1px; font-family: var(--mono); font-size: 0.72rem; color: var(--text-2); }
.gate-bar .gb-m .rj b { color: var(--critical); } .gate-bar .gb-m .ct b { color: var(--gate); }
.gate-bar .gb-r { font-size: 0.72rem; color: var(--text-3); text-align: right; font-family: var(--mono); }
@media (max-width: 380px) { .gate-bar .gb-r { display: none; } .gate-bar { grid-template-columns: auto 1fr; } }
.gate-bar.bump .gb-l .v { animation: gatebump .5s ease; }
@keyframes gatebump { 0% { transform: scale(1); } 30% { transform: scale(1.12); text-shadow: 0 0 18px rgba(61,220,151,.6); } 100% { transform: scale(1); } }
.gate-bar .gb-l .v { display: inline-block; transform-origin: left center; }

/* live gate inside the editor sheet */
.sh-gate { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 0 10px; padding: 8px 12px; border-radius: 12px; background: var(--gate-soft); border: 1px solid color-mix(in srgb, var(--gate) 30%, transparent); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); }
.sh-gate b { font-family: var(--mono); font-size: 1.5rem; letter-spacing: -0.02em; color: var(--gate); text-transform: none; }

/* curtain percentage */
.curtain-pct { font-family: var(--mono); font-weight: 700; font-size: 1.05rem; color: var(--text); letter-spacing: 0.02em; }
.curtain-msg { transition: opacity .2s ease; }
@media print { .gate-bar { display: none !important; } }

/* gate not computed yet: grey dashes until an airport is loaded or a value is entered */
.gate.idle .num { background: none; -webkit-text-fill-color: var(--text-3); color: var(--text-3); filter: none; opacity: 0.55; letter-spacing: 0.02em; }
.gate.idle .num .unit { opacity: 0.6; }
.gate.idle .formula { color: var(--text-2); }
.gate.idle .decision { opacity: 0.45; filter: grayscale(1); }
.gate.idle { background: linear-gradient(180deg, var(--panel-hi), transparent 120px), var(--surface); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; filter: grayscale(0.6); }
:root[data-theme="light"] .gate.idle { background: var(--surface); }

/* loading curtain: runway-in-weather photo, darkened for legibility (same look in both themes) */
.curtain {
  --c-img-wide: url("img/load-storm-wide.webp"); --c-img-tall: url("img/load-storm-tall.webp");
  background-color: #05070c;
  background-image: linear-gradient(180deg, rgba(5,7,12,0.35) 0%, rgba(5,7,12,0.15) 45%, rgba(5,7,12,0.70) 100%), var(--c-img-wide);
  background-size: cover; background-position: center;
  color: #fff;
  --surface-3: rgba(255,255,255,0.18); --runway: #e6ebf3; --text: #fff; --text-2: rgba(255,255,255,0.82);
}
.curtain.photo-rainshaft { --c-img-wide: url("img/load-rainshaft-wide.webp"); --c-img-tall: url("img/load-rainshaft-tall.webp"); background-position: 30% center; }
@media (orientation: portrait) {
  .curtain { background-image: linear-gradient(180deg, rgba(5,7,12,0.30) 0%, rgba(5,7,12,0.10) 45%, rgba(5,7,12,0.70) 100%), var(--c-img-tall); }
}
.curtain-card { padding: 22px 26px; border-radius: 22px; background: rgba(8, 11, 18, 0.42); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,0.10); }
.curtain-title, .curtain-pct { color: #fff; }
.curtain-msg { color: rgba(255,255,255,0.85); }
.curtain-bar { background: rgba(255,255,255,0.16); }
.curtain-credit { position: absolute; right: max(12px, env(safe-area-inset-right)); bottom: calc(10px + env(safe-area-inset-bottom, 0px)); font-size: 0.62rem; color: rgba(255,255,255,0.55); letter-spacing: 0.02em; }

/* ---- brand: option C logo + GSV₁ wordmark (IBM Plex Sans Bold, 1 as subscript) */
@font-face { font-family: "Plex Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2"); }
.wm { font-family: "Plex Sans", var(--sans); font-weight: 700; letter-spacing: -0.02em; }
.wm sub { font-size: 0.55em; vertical-align: -0.28em; position: static; margin-left: 1px; }
.wordmark .wm { font-size: 1.22rem; }
.wordmark .logo { border-radius: 8px; box-shadow: 0 4px 14px -6px rgba(77,163,255,0.5); }
.curtain-title.wm { font-size: 1.6rem; }
.curtain-logo svg { width: 104px; height: 104px; }
.curtain-gate { animation: gatepulse 1.4s ease-in-out infinite; }
@keyframes gatepulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { .curtain-gate { animation: none; } }
.gate-bar .gb-m span { white-space: nowrap; }

/* ---- v0.20261017-M: scroll-linked gate morph, V1 first, tiles that never overflow ---- */
:root { --gp: 0; }
/* the big number eases out as the bar eases in, both tied to scroll position */
.gate .num { transform-origin: 50% 0; transform: scale(calc(1 - var(--gp) * 0.28)) translateY(calc(var(--gp) * 10px)); opacity: calc(1 - var(--gp) * 0.85); will-change: transform, opacity; }
.gate-bar { transition: none; transform: translate(-50%, calc((1 - var(--gp)) * -105%)); opacity: calc(0.15 + var(--gp) * 0.85); pointer-events: none; }
.gate-bar.visible { transform: translate(-50%, calc((1 - var(--gp)) * -105%)); pointer-events: auto; }
.gate-bar .gb-l .v { font-size: calc(1.75rem * (1.22 - var(--gp) * 0.22)); }
@media (prefers-reduced-motion: reduce) {
  .gate .num { transform: none; opacity: 1; }
  .gate-bar { transition: transform .2s ease, opacity .2s ease; }
}

/* V1 chip inside the gate card: the one value a pilot almost always enters */
.v1-chip { display: inline-flex; align-items: center; gap: 8px; margin: 10px auto 2px; padding: 7px 12px 7px 14px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer; transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease; }
.v1-chip .k { font-family: var(--mono); font-weight: 700; font-size: 0.82rem; color: var(--text-3); letter-spacing: 0.02em; }
.v1-chip b { font-family: var(--mono); font-weight: 700; font-size: 1.02rem; letter-spacing: -0.01em; }
.v1-chip svg { width: 15px; height: 15px; color: var(--text-3); }
.v1-chip:hover { border-color: var(--accent); }
.v1-chip.need { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); animation: v1pulse 2.2s ease-in-out infinite; }
.v1-chip.need .k, .v1-chip.need svg { color: var(--accent); }
.v1-chip.need b { font-family: var(--sans); font-size: 0.92rem; font-weight: 700; letter-spacing: 0; }
@keyframes v1pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(77,163,255,0.0); } 50% { box-shadow: 0 0 0 6px rgba(77,163,255,0.18); } }
@media (prefers-reduced-motion: reduce) { .v1-chip.need { animation: none; } }
.gate .label { display: block; }

/* tiles: V1 gets its own full-width row; the others are 2 per row on phones, 4 per row when there's room */
.tiles { container-type: inline-size; }
.tile { min-width: 0; }
.tile-v1 { flex: 1 1 100%; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: 12px; row-gap: 3px; align-items: center; min-height: 76px; padding: 12px 16px;
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: linear-gradient(135deg, var(--accent-soft), transparent 70%), var(--surface-2); }
.tile-v1 .k { font-size: 0.82rem; color: var(--text-2); }
.tile-v1 .k { grid-column: 1; grid-row: 1; align-self: end; }
.tile-v1 .src { grid-column: 1; grid-row: 2; align-self: start; font-size: 0.7rem; }
.tile-v1 .v { grid-column: 2; grid-row: 1 / span 2; font-size: 2rem; }
.tile-v1.need { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.tile-v1.need .v { color: var(--text-3); }
.tile:not(.tile-v1):not(.wide) { flex: 1 1 calc(50% - 10px); }
@container (min-width: 560px) { .tile:not(.tile-v1):not(.wide) { flex-basis: calc(25% - 10px); } }
/* values shrink to fit their tile instead of spilling out (e.g. "30.02 inHg") */
.tile:not(.tile-v1) .v { font-size: clamp(1.05rem, 6.2cqi, 1.32rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .v small { font-size: 0.6em; }

/* ---- v0.20261017-N: what the gate is valid for (runway, offset from V1) ---- */
.gate-ctx { margin-top: 4px; font-size: 0.86rem; font-weight: 600; color: var(--text-2); }
.gate-ctx:empty { display: none; }
.gate-ctx b { font-family: var(--mono); font-weight: 700; }
.gate-ctx b.neg { color: var(--text); }
.gate-ctx b.pos { color: var(--caution); }

/* ---- v0.20261017-O: tooltips (hover on desktop, touch and hold on phones) ---- */
.tip-bubble { position: fixed; z-index: 4000; left: 0; top: 0; max-width: 300px; padding: 9px 12px; border-radius: 12px; pointer-events: none;
  background: color-mix(in srgb, var(--surface-3) 94%, black); color: var(--text); border: 1px solid var(--line-2);
  box-shadow: 0 14px 34px -14px rgba(0,0,0,0.75); font: 500 0.8rem/1.4 var(--sans); letter-spacing: 0; text-transform: none; text-align: left;
  opacity: 0; transform: translateY(4px); transition: opacity .14s ease, transform .14s ease; }
.tip-bubble.below { transform: translateY(-4px); }
.tip-bubble.in { opacity: 1; transform: none; }
.tip-arrow { position: absolute; bottom: -6px; width: 10px; height: 10px; margin-left: -5px; transform: rotate(45deg);
  background: inherit; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.tip-bubble.below .tip-arrow { bottom: auto; top: -6px; border: 0; border-left: 1px solid var(--line-2); border-top: 1px solid var(--line-2); }
:root[data-theme="light"] .tip-bubble { background: #1f2937; color: #f3f6fa; border-color: transparent; }
:root[data-theme="light"] .tip-arrow { border-color: transparent !important; }
@media (prefers-reduced-motion: reduce) { .tip-bubble { transition: none; transform: none; } }
/* holding a control shows its tip, not the system text menu */
[data-tip] { -webkit-touch-callout: none; }
button[data-tip], .tile[data-tip], .chip[data-tip], .comp[data-tip], .kv > div[data-tip], .gate .num, .gate-ctx { -webkit-user-select: none; user-select: none; }
/* on mouse devices, explained labels get a help cursor */
@media (hover: hover) and (pointer: fine) { .comp[data-tip] .k, .kv > div[data-tip] .k, .gate-ctx, .gate .label, #metar_status { cursor: help; } }
.tip-hint { margin: 0 0 10px; padding: 8px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--text-2); font-size: 0.82rem; }
@media print { .tip-bubble { display: none !important; } }

/* ---- v0.20261017-P: airport without a current METAR ---- */
.metar-raw.warn { color: var(--caution); font-family: var(--sans); font-weight: 600; font-size: 0.85rem; }
/* ---- v0.20261017-Q: METAR borrowed from a station within 5 SM ---- */
.metar-note { font-family: var(--sans); font-size: 0.82rem; font-weight: 600; color: var(--caution); margin-bottom: 4px; }

/* ---- v0.20261017-S: worldwide weather map, model outlook ---- */
.wxmap-img { width: 100%; height: auto; aspect-ratio: 3 / 2; border-radius: 12px; display: block; cursor: zoom-in; background: var(--bg-2); }
.wx-legend { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 8px; font-size: 0.72rem; color: var(--text-2); }
.wx-legend i { width: 18px; height: 10px; border-radius: 3px; display: inline-block; }
.wx-legend span:first-child { margin-right: 4px; font-weight: 600; }
.wx-legend .wx-l-end { margin-left: 4px; color: var(--text-3); }
.wx-legend .wx-ltg { margin-left: auto; font-weight: 600; color: var(--caution); }
.wx-src { margin-top: 6px; font-size: 0.72rem; color: var(--text-3); line-height: 1.5; }
.wx-attr { margin-top: 2px; font-size: 0.68rem; color: var(--text-3); font-style: italic; }
.ol-table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 0.8rem; }
.ol-table th { text-align: left; font-family: var(--sans); font-size: 0.7rem; color: var(--text-3); font-weight: 600; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.ol-table td { padding: 4px 6px; border-bottom: 1px solid var(--line); }

/* ---- live weather map (v0.20261017-T) ---- */
:root:not([data-theme="light"]) .wxmap-img { filter: none; }   /* drawn for the theme already: never invert */
.wxlive-slot.live > .wxmap-img { display: none; }
.wxlive { position: relative; width: 100%; }
.wxlive-map { width: 100%; aspect-ratio: 3 / 2; max-height: 70vh; border-radius: 12px; overflow: hidden; background: var(--bg-2); z-index: 0; font: 13px/1.4 var(--font-sans, system-ui, sans-serif); }
.wxlive-hint { font-size: 12px; color: var(--text-3, #6b7280); margin-top: 6px; }
.wxlive.wxlive-full { position: fixed; inset: 0; z-index: 9000; background: var(--bg, #000); padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.wxlive.wxlive-full .wxlive-map { aspect-ratio: auto; height: 100%; max-height: none; border-radius: 0; }
.wxlive.wxlive-full .wxlive-hint { display: none; }
body.wxlive-open { overflow: hidden; }
:root:not([data-theme="light"]) .wx-base { filter: invert(1) hue-rotate(180deg) brightness(0.85) contrast(0.9) saturate(0.6); }
.wxlive .wx-ctl { width: 34px; height: 34px; display: grid; place-items: center; font-size: 18px; line-height: 1; border: 2px solid rgba(0,0,0,0.2); border-radius: 6px; background: #fff; color: #1f2937; cursor: pointer; padding: 0; background-clip: padding-box; }
.wxlive .wx-ctl:hover { background: #f1f5f9; }
.wxlive .wx-ring-label { color: #334155; font: 600 11px/16px system-ui, sans-serif; text-align: center; text-shadow: 0 0 3px #fff, 0 0 3px #fff; white-space: nowrap; }
:root:not([data-theme="light"]) .wxlive .wx-ring-label { color: #e2e8f0; text-shadow: 0 0 3px #000, 0 0 3px #000; }
:root:not([data-theme="light"]) .wxlive .wx-ring { stroke: #cbd5e1; }
.wxlive .wx-apt-label { font: 700 12px system-ui, sans-serif; padding: 1px 6px; }
.wxlive .leaflet-control-layers-expanded { max-width: 260px; font-size: 13px; }
.wxlive .leaflet-control-attribution { font-size: 10px; }
/* base map a step back so rain and lightning stand out over parks and roads */
.wxlive .wx-base { filter: opacity(0.55) saturate(0.7); }
:root:not([data-theme="light"]) .wxlive .wx-base { filter: invert(1) hue-rotate(180deg) brightness(0.85) contrast(0.9) saturate(0.5) opacity(0.75); }

/* ---- entry conventions (v0.20261019-U, blank line since v0.20261019-H) ----
   A blank line marks the required entry (only V₁), like a blank on a form; the gate shows the same line, larger.
   Entered values read larger and bolder, like pilot entries in large font on a Boeing CDU; values from a source
   (METAR, NOAA, airport data) keep the regular weight with the source in blue. The gate stays green: computed. */
.blank-line { display: inline-block; width: 2.4em; height: 0; border-bottom: 0.08em solid currentColor; vertical-align: 0.12em; margin-right: 0.18em; opacity: 0.75; border-radius: 1px; }
.tile-v1.need .v { color: var(--accent); }
.tile-v1.need .v small { color: var(--accent); }
#gs_gate .blank-line { width: 1.5em; border-bottom-width: 0.04em; opacity: 0.45; vertical-align: 0.18em; -webkit-text-fill-color: initial; border-color: var(--text-3); }
.tile.entered .v { font-weight: 800; }
.tile.entered:not(.tile-v1) .v { font-size: clamp(1.12rem, 6.6cqi, 1.42rem); }
.tile.entered .src { color: var(--text); }

/* typeset gate formula (MathML) */
#gate_formula math { font-size: 1.25em; math-style: normal; color: var(--text-2); }
#gate_formula math mfrac { font-size: 0.92em; }
