:root {
  --bg: #111827; --panel: #1f2937; --panel2: #374151; --fg: #f9fafb; --muted: #9ca3af;
  --accent: #9333ea; --accent2: #c084fc; --ok: #22c55e; --warn: #f59e0b; --bad: #ef4444;
  --sheet-collapsed: 104px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--fg);
  font: 15px/1.35 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#map { position: absolute; inset: 0; }

button { font: inherit; color: var(--fg); background: var(--panel2); border: 0; border-radius: 10px;
  padding: 10px 12px; min-height: 42px; cursor: pointer; }
button:active { filter: brightness(1.3); }
button.on { background: var(--accent); }
input, select { font: inherit; color: var(--fg); background: #0b1220; border: 1px solid #4b5563;
  border-radius: 8px; padding: 9px 10px; width: 100%; min-height: 42px; }
input:focus, select:focus { outline: 2px solid var(--accent2); border-color: transparent; }

/* floating buttons */
.fab-col { position: absolute; right: 12px; top: calc(12px + env(safe-area-inset-top)); z-index: 1000;
  display: flex; flex-direction: column; gap: 8px; }
.fab { width: 48px; height: 48px; border-radius: 50%; font-size: 22px; padding: 0;
  background: rgba(31, 41, 55, .92); box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.leaflet-top.leaflet-left { top: env(safe-area-inset-top); }
.leaflet-top.leaflet-right { top: calc(112px + env(safe-area-inset-top)); }
.leaflet-top.leaflet-right .leaflet-control { margin-right: 12px; }

/* banner */
.banner { position: absolute; left: 50%; transform: translateX(-50%); top: calc(12px + env(safe-area-inset-top));
  z-index: 1001; background: var(--accent); padding: 6px 6px 6px 14px; border-radius: 12px;
  display: flex; align-items: center; gap: 10px; box-shadow: 0 2px 10px rgba(0,0,0,.5); }
.banner button { background: rgba(0,0,0,.25); min-height: 34px; padding: 6px 10px; }
.hidden { display: none !important; }

/* nav HUD */
.hud { position: absolute; left: 12px; right: 72px; top: calc(12px + env(safe-area-inset-top)); z-index: 1000;
  background: rgba(17, 24, 39, .94); border-radius: 14px; padding: 10px 12px; display: flex; gap: 12px;
  align-items: center; box-shadow: 0 2px 10px rgba(0,0,0,.5); }
.arrow { font-size: 42px; width: 56px; height: 56px; display: grid; place-items: center; color: var(--accent2);
  transition: transform .25s linear; }
.arrow-inner { display: inline-block; transform: rotate(-90deg); } /* ➤ points east; rotate to north */
.hud-text { flex: 1; min-width: 0; }
.hud-title { font-weight: 600; }
.hud-big { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hud-sub { color: var(--muted); font-size: 13px; }
.hud-close { background: transparent; font-size: 18px; min-height: 36px; }
.hud.arrived .hud-big { color: var(--ok); }

/* bottom sheet */
.sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1002; background: var(--panel);
  border-radius: 16px 16px 0 0; box-shadow: 0 -4px 16px rgba(0,0,0,.45); max-height: 62vh;
  display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom);
  transition: max-height .2s ease; }
.sheet.collapsed { max-height: none; }
.sheet.collapsed .tab { display: none; }
.sheet-handle { padding: 8px 0 4px; display: flex; justify-content: center; cursor: pointer; }
.sheet-handle span { width: 44px; height: 5px; border-radius: 3px; background: #6b7280; }
.status-row { display: flex; gap: 6px; padding: 0 12px 6px; overflow: hidden; white-space: nowrap; }
.pill { font-size: 12px; padding: 3px 8px; border-radius: 999px; background: var(--panel2); color: var(--muted); }
.pill.ok { background: #14532d; color: #bbf7d0; } .pill.warn { background: #78350f; color: #fde68a; }
.pill.bad { background: #7f1d1d; color: #fecaca; }
.tabs { display: flex; gap: 4px; padding: 0 8px 6px; }
.tabs button { flex: 1; min-height: 38px; padding: 6px; background: transparent; color: var(--muted); border-radius: 8px; }
.tabs button.active { background: var(--panel2); color: var(--fg); }
.tab { display: none; overflow-y: auto; padding: 0 12px 16px; -webkit-overflow-scrolling: touch; }
.tab.active { display: block; }
h3 { margin: 12px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent2); }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0; }
.row { display: flex; gap: 8px; margin: 6px 0; }
.row > label { flex: 1; min-width: 0; }
label { display: block; font-size: 12px; color: var(--muted); }
label > input, label > select, label > .stepper { margin-top: 3px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--fg); margin: 8px 0; }
.check input { width: 22px; height: 22px; min-height: 0; accent-color: var(--accent); }
.btn-row { display: flex; gap: 6px; margin: 6px 0; flex-wrap: wrap; }
.btn-row > button { flex: 1; }
.stepper { display: flex; gap: 4px; }
.stepper button { flex: 1; padding: 6px 0; min-height: 42px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: #0b1220;
  border-radius: 8px; padding: 8px; white-space: pre-wrap; }
.saved { list-style: none; padding: 0; margin: 6px 0; }
.saved li { display: flex; gap: 6px; align-items: center; padding: 4px 0; border-bottom: 1px solid #374151; }
.saved li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved li button { min-height: 36px; padding: 6px 10px; }

/* toast */
.toast { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--sheet-collapsed) + 40px);
  z-index: 1003; background: #000c; padding: 8px 14px; border-radius: 10px; max-width: 90vw; text-align: center; }

/* map markers */
.gp-icon { display: grid; place-items: center; border-radius: 50%; background: #fff; color: #111;
  border: 2px solid var(--accent); font: 700 11px/1 ui-sans-serif, system-ui, sans-serif;
  white-space: nowrap; overflow: visible;
  box-shadow: 0 1px 4px rgba(0,0,0,.6); }
.gp-icon.first { background: var(--accent); color: #fff; border-color: #fff; }
.gp-icon.target { background: #facc15; border-color: #000; }
.ab-icon { display: grid; place-items: center; border-radius: 6px; color: #fff; font: 800 14px/1 sans-serif;
  border: 2px solid #fff; box-shadow: 0 1px 5px rgba(0,0,0,.7); }
.ab-icon.b { background: #2563eb; }
.a-ring { width: 44px; height: 44px; border-radius: 50%; border: 4px solid #dc2626; position: relative;
  box-shadow: 0 0 0 2px #fff, 0 1px 6px rgba(0,0,0,.6); }
.a-ring span { position: absolute; top: -16px; left: -16px; min-width: 20px; text-align: center; background: #dc2626; color: #fff; border: 2px solid #fff;
  border-radius: 6px; font: 800 14px/1 ui-sans-serif, system-ui, sans-serif; padding: 3px 4px; }
.me-icon { width: 18px; height: 18px; border-radius: 50%; background: #3b82f6; border: 3px solid #fff;
  box-shadow: 0 0 0 2px rgba(59,130,246,.5), 0 1px 4px rgba(0,0,0,.6); }
.leaflet-container { background: #1f2937; }

/* runway tab */
details.oaip { margin: 8px 0; background: #111827; border-radius: 8px; padding: 6px 10px; }
details.oaip summary { cursor: pointer; color: var(--fg); padding: 4px 0; }
.rwy-list { list-style: none; padding: 0; margin: 6px 0; }
.rwy-list li { padding: 8px 10px; margin: 4px 0; border-radius: 8px; background: var(--panel2); cursor: pointer; }
.rwy-list li.sel { outline: 2px solid var(--accent2); background: #4c1d95; }
.rwy-list li b { font-size: 16px; }
.rwy-list li small { display: block; color: var(--muted); }
button.primary { background: var(--accent); font-weight: 600; }
.rwy-label { background: #fbbf24; color: #111; font: 800 12px/1 sans-serif; padding: 3px 5px; border-radius: 4px;
  border: 1px solid #111; white-space: nowrap; }
