:root {
  --bg: #ffffff;
  --fg: #0f1b2b;
  --muted: #586374;
  --line: #d8dde4;
  --navy: #000e1e;
  --gold: #a87900;
  --gold-bright: #db9e00;
  --accent: #000e1e;
  --accent-fg: #ffffff;
  --highlight: #a87900;
  --warn: #9a3412;
  --good: #15803d;
  --shadow: 0 4px 18px rgba(0, 0, 0, .18);
  --bar-h: 50px;
  --top: calc(var(--bar-h) + env(safe-area-inset-top) + 10px);
  /* The screen's unsafe edges (Dynamic Island / notch / status bar, home bar). iOS reports them;
     app.js also sets a minimum for each kind of iPhone in case it reports 0 (--safe-*-min). */
  --safe-t: max(env(safe-area-inset-top), var(--safe-t-min, 0px));
  --safe-b: max(env(safe-area-inset-bottom), var(--safe-b-min, 0px));
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1726;
    --fg: #e9edf2;
    --muted: #a3adba;
    --line: #26354a;
    --accent: #db9e00;
    --accent-fg: #000e1e;
    --highlight: #db9e00;
    --warn: #f0a070;
    --good: #4ade80;
    --shadow: 0 4px 18px rgba(0, 0, 0, .5);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
#appbar { position: fixed; top: 0; left: 0; right: 0; z-index: 1200; display: flex; align-items: center; gap: 10px;
  height: calc(var(--bar-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 16px 0;
  background: var(--navy); color: #fff; box-shadow: 0 1px 0 var(--gold), 0 2px 8px rgba(0, 0, 0, .25); }
#appbar h1 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: .01em; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
#appbar .brand { color: var(--gold-bright); }
#appbar .by { font-weight: 500; font-size: 14px; color: #cfd8e3; }
/* The icon's art as tall as the bar, flush with the left edge: its sky is see-through, so it's the
   bar itself, and the gold hill eases down into the bar's gold line. */
#appbar .logo { align-self: flex-end; height: var(--bar-h); flex: none; margin-left: -16px;
  margin-left: calc(-16px + env(safe-area-inset-left)); }
#appbar .logo img { display: block; width: auto; height: 100%; } /* the hill slopes down into the gold line on its right */
#map { position: fixed; inset: calc(var(--bar-h) + env(safe-area-inset-top)) 0 0 0;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; } /* press and hold: no callout or text selection */

#search { position: fixed; top: var(--top); left: 12px; right: 64px; 
  max-width: 420px; z-index: 1000; }
#q { width: 100%; padding: 11px 40px 11px 14px; font-size: 16px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--fg); box-shadow: var(--shadow); }
#suggest { list-style: none; margin: 4px 0 0; padding: 4px 0; background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow); }
#suggest li { padding: 9px 14px; cursor: pointer; }
#suggest li.recent { color: var(--fg); }
#suggest li.recent-clear { font-size: 13px; color: var(--muted); text-align: right; padding: 6px 14px; }
#suggest li:hover, #suggest li[aria-selected=true] { background: color-mix(in srgb, var(--highlight) 18%, transparent); }

.fabs { position: fixed; top: var(--top); right: 12px; z-index: 1000;
  display: flex; flex-direction: column; gap: 8px; }
.fabs button { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); font-size: 20px;
  background: var(--bg); color: var(--fg); box-shadow: var(--shadow); cursor: pointer; }

#hint { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom));
  margin: 0; padding: 8px 14px; border-radius: 999px; background: var(--bg); color: var(--muted);
  box-shadow: var(--shadow); z-index: 900; font-size: 13px; white-space: nowrap; max-width: calc(100% - 32px);
  overflow: hidden; text-overflow: ellipsis; }

#panel { position: fixed; z-index: 1100; background: var(--bg); color: var(--fg); box-shadow: var(--shadow);
  left: 0; right: 0; bottom: 0; max-height: 50vh; max-height: 50dvh; overflow-y: auto; /* the top half stays map */ border-radius: 16px 16px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
@media (min-width: 760px) {
  #panel { left: auto; right: 68px; top: var(--top); bottom: auto; width: 380px; max-height: calc(100vh - var(--bar-h) - 40px);
    border-radius: 14px; }
}
#close { position: absolute; top: 8px; right: 10px; border: 0; background: none; color: var(--muted);
  font-size: 26px; line-height: 1; cursor: pointer; padding: 4px 8px; }
#panel h2 { margin: 0 32px 2px 0; font-size: 18px; }
#panel .sub { color: var(--muted); margin: 0 0 14px; font-size: 13px; }
.owner { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.owner .label { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.owner .name { font-size: 17px; font-weight: 600; margin: 2px 0; }
.owner .note { font-size: 13px; color: var(--muted); }
.owner .warn { color: var(--warn); }
.btn { display: inline-block; margin-top: 8px; padding: 9px 14px; border-radius: 9px; border: 0; cursor: pointer;
  background: var(--accent); color: var(--accent-fg); font-weight: 600; font-size: 14px; }
.btn[disabled] { opacity: .6; cursor: default; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
.links { margin-top: 14px; font-size: 13px; }
a { color: var(--highlight); }

dialog { border: 0; border-radius: 14px; background: var(--bg); color: var(--fg); box-shadow: var(--shadow);
  width: min(420px, calc(100% - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, .35); }
/* Every popup starts below the Dynamic Island / status bar and ends above the home bar, on every
   device; anything taller scrolls inside it. */
dialog:modal:not(#lightbox) { inset-block: calc(var(--safe-t) + 10px) calc(var(--safe-b) + 10px);
  max-height: min(calc(100dvh - var(--safe-t) - var(--safe-b) - 20px), 980px); overflow-y: auto; overscroll-behavior: contain; }
dialog h2 { margin-top: 0; font-size: 18px; }
dialog label { display: block; font-size: 14px; }
dialog input { display: block; width: 100%; margin-top: 4px; padding: 9px 11px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); }
dialog menu { display: flex; gap: 8px; justify-content: flex-end; padding: 0; margin: 16px 0 0; }
dialog menu button { padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--fg); cursor: pointer; }
dialog menu button[value=ok] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.small { font-size: 13px; color: var(--muted); }

.leaflet-container { background: var(--line); }
/* Map credits: a small ⓘ in the bottom-right corner (the map and imagery licenses need the credits
   on the map); tap it to read them all, tap again to fold them away. */
.leaflet-control-attribution { cursor: pointer; margin: 0 12px calc(12px + var(--safe-b)) 0 !important; }
/* closed: an 18 px circle, with a 30 px area to tap */
.leaflet-control-attribution:not(.open) { width: 30px; height: 30px; padding: 0 !important; overflow: hidden; margin: 0 6px calc(6px + var(--safe-b)) 0 !important;
  font-size: 0; color: transparent; background: transparent !important; position: relative; }
.leaflet-control-attribution:not(.open) * { display: none; }
.leaflet-control-attribution:not(.open)::after { content: "i"; position: absolute; inset: 6px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, .45); font: italic 700 11px/1 Georgia, serif; color: rgba(30, 41, 59, .75); }
body.credits-open #hint { visibility: hidden; }
.leaflet-control-attribution.open { font-size: 11px; max-width: min(360px, calc(100vw - 80px)); padding: 6px 10px !important;
  border-radius: 10px; white-space: normal; background: rgba(255, 255, 255, .95) !important; box-shadow: var(--shadow); }

#layer-menu { position: fixed; top: var(--top); right: 64px; z-index: 1150; margin: 0; min-width: 230px; max-width: calc(100% - 80px);
  max-height: calc(100dvh - var(--top) - 16px); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 10px 14px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--fg);
  box-shadow: var(--shadow); }
#layer-menu .menu-x { position: sticky; top: 0; float: right; width: 32px; height: 32px; margin: -4px -6px 0 8px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 24px; line-height: 1; cursor: pointer; z-index: 1; }
#layer-menu .menu-x:hover { color: var(--fg); background: var(--line); }
#layer-menu .menu-title { margin: 0 0 4px; font-weight: 600; font-size: 14px; }
#layer-menu label { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 15px; cursor: pointer; }
#layer-menu input { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }
#layer-menu .small { margin: 6px 0 0; }
#layer-menu .menu-gap { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
#sma-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; margin: 4px 0 2px 26px; font-size: 12px; color: var(--muted); }
#sma-legend span { display: flex; align-items: center; gap: 6px; }
#sma-legend i { width: 14px; height: 14px; flex: none; border: 1px solid rgba(0, 0, 0, .25); border-radius: 3px; }
.land { border-left: 4px solid var(--highlight); background: color-mix(in srgb, var(--highlight) 9%, transparent);
  border-radius: 0 10px 10px 0; padding: 10px 12px; margin-bottom: 14px; font-size: 14px; }
.land .label { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.land .agency { font-size: 16px; font-weight: 600; margin: 2px 0; }
.land .wild { margin-top: 6px; }
.land .wild strong { color: var(--fg); }
.wild-label { background: none; border: 0; box-shadow: none; padding: 0; color: #0f5132; font-weight: 700; font-size: 12px;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff; }
#q::-webkit-search-cancel-button { display: none; }
#q-clear { position: absolute; top: 4px; right: 4px; width: 36px; height: 36px; border: 0; border-radius: 8px; background: none;
  color: var(--muted); font-size: 24px; line-height: 1; cursor: pointer; }
#q-clear:hover { color: var(--fg); background: color-mix(in srgb, var(--fg) 8%, transparent); }
.landing { border: 1px solid var(--line); border-left-width: 5px; border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; font-size: 14px; }
.landing.yes { border-left-color: #15803d; }
.landing.maybe { border-left-color: #b45309; }
.landing.no { border-left-color: #b91c1c; }
.landing .label { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.landing .verdict { font-size: 17px; font-weight: 700; margin: 2px 0 4px; }
.landing.yes .verdict { color: #15803d; } .landing.maybe .verdict { color: #b45309; } .landing.no .verdict { color: #b91c1c; }
.landing .conf { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 6px; }
.landing ul { margin: 6px 0 0; padding-left: 18px; }
.landing li { margin: 2px 0; color: var(--muted); }
.landing .disclaimer { margin-top: 6px; font-size: 11px; color: var(--muted); font-style: italic; }
@media (prefers-color-scheme: dark) {
  .landing.yes .verdict { color: #4ade80; } .landing.maybe .verdict { color: #fbbf24; } .landing.no .verdict { color: #f87171; }
}
.landing .sources { margin-top: 8px; font-size: 13px; }
.landing .sources summary { cursor: pointer; color: var(--highlight); font-weight: 600; }
.landing .sources ol { margin: 6px 0 0; padding-left: 20px; }
.landing .sources li { margin: 3px 0; }
.fabs button.on { background: var(--navy); color: #fff; border-color: var(--gold); }
.ruler-end { border-radius: 50%; background: #fff; border: 2px solid #000e1e; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.ruler-label { width: 0 !important; height: 0 !important; }
.ruler-label .box { position: absolute; left: 0; top: 0; transform: translate(-50%, calc(-100% - 10px)); padding: 5px 9px; border-radius: 8px;
  background: rgba(0, 14, 30, .66); color: #fff; font-size: 13px; line-height: 1.3; text-align: center; white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .8);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .35); pointer-events: none; }
.ruler-label b { display: block; font-size: 16px; color: #ffcf4d; letter-spacing: .03em; }
.ruler-label span { display: block; }
.ruler-label small { display: block; font-size: 11px; opacity: .8; }
#offline { position: fixed; z-index: 1150; left: 50%; transform: translateX(-50%); top: calc(var(--top) + 52px);
  padding: 5px 12px; border-radius: 999px; background: #b45309; color: #fff; font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow); white-space: nowrap; }
.settings-h { margin: 14px 0 4px; font-size: 15px; }
.state-row { display: flex !important; align-items: flex-start; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); }
.state-row input { width: 18px !important; height: 18px; margin-top: 2px !important; flex: none; accent-color: var(--accent); }
/* The welcome (terms) and Help dialogs fill the screen between the Dynamic Island / status bar
   and the home bar, with a small gap above and below, on every phone. */
#terms, #help { position: fixed; margin: 0 auto; max-height: none; height: auto;
  inset: calc(var(--safe-t) + 10px) 0 calc(var(--safe-b) + 10px) 0;
  display: flex; flex-direction: column; padding-top: 14px; padding-bottom: 12px; }
#terms:not([open]), #help:not([open]) { display: none; }
#terms form, #help form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
#terms .terms-body, #help .terms-body { flex: 1; min-height: 0; }
.terms-body { overflow-y: auto; font-size: 14px; line-height: 1.45; padding: 8px 4px 0 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.terms-body:focus, .terms-body:focus-visible { outline: none; }
.terms-body p { margin: 0 0 10px; }
.terms-check { display: flex !important; align-items: center; gap: 8px; margin-top: 10px; }
.terms-check input { width: 18px !important; height: 18px; margin: 0 !important; flex: none; accent-color: var(--accent); }
.terms-h { margin: 18px 0 4px; padding-top: 14px; border-top: 2px solid var(--line); font-size: 16px; }
.terms-body > .terms-h:first-child { border-top: 0; padding-top: 0; }
#terms-agree[aria-disabled=true] { background: var(--line) !important; border-color: var(--line) !important; color: var(--muted) !important; cursor: not-allowed; }
.terms-scroll-note { margin: 8px 0 0; color: var(--warn); font-weight: 600; }
.terms-body > .terms-h:first-child { margin-top: 4px; }
.terms-feedback { margin: 12px 0 0; text-align: center; }

/* Settings opens with focus on its heading, so the iPhone keyboard doesn't pop up. */
#settings h2:focus { outline: none; }

/* "Go to" menu (Lower 48 / Alaska / Hawaii), next to the 🌎 button. */
#region-menu { position: fixed; top: var(--top); right: 64px; z-index: 1150; margin: 0; min-width: 170px;
  padding: 10px 14px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--fg);
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; }
#region-menu[hidden] { display: none; }
#region-menu .menu-title { margin: 0 0 2px; font-weight: 600; font-size: 14px; }
#region-menu button { text-align: left; padding: 8px 10px; font-size: 15px; border: 1px solid var(--line); border-radius: 8px;
  background: transparent; color: inherit; cursor: pointer; }
.fabs button svg { display: block; margin: auto; }

/* ---------- flight mode ---------- */
/* The map is enlarged to the screen's diagonal and turned track-up, so its corners never show. */
body.flying #map { inset: auto; left: 50%; top: calc(var(--bar-h) + env(safe-area-inset-top) + (100dvh - var(--bar-h) - env(safe-area-inset-top)) / 2);
  width: var(--fly-d, 150vmax); height: var(--fly-d, 150vmax); transform: translate(-50%, -50%) rotate(var(--fly-rot, 0deg));
  transition: transform .6s ease-out; }
body.flying .leaflet-control-container, body.flying #search, body.flying #panel, body.flying #hint,
body.flying .fabs button:not(#flight-btn):not(#fl-orient):not(#fl-locate), body.flying #layer-menu, body.flying #region-menu, body.flying #map-legend { display: none !important; }
#flight-ownship { display: none; }
body.flying #flight-ownship { display: block; position: fixed; z-index: 950; pointer-events: none; left: 50%;
  top: calc(var(--bar-h) + env(safe-area-inset-top) + (100dvh - var(--bar-h) - env(safe-area-inset-top)) / 2);
  transform: translate(-50%, -50%) rotate(var(--ownship-rot, 0deg)); transition: transform .6s ease-out;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .5)); }
#flight-strip { position: fixed; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 1100;
  padding: 10px 12px; border-radius: 14px; background: rgba(0, 14, 30, .88); color: #fff; box-shadow: var(--shadow);
  font-size: 15px; line-height: 1.35; }
@media (min-width: 760px) { #flight-strip { left: 50%; right: auto; width: 560px; transform: translateX(-50%); } }
#flight-strip .fl-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
#fl-nav { font-variant-numeric: tabular-nums; color: #cfd8e3; white-space: nowrap; }
#fl-cur b.ok { color: #4ade80; }
#fl-cur b.bad { color: #f87171; }
#fl-cur .what { color: #cfd8e3; font-size: 13px; }
#fl-next { margin-top: 4px; }
#fl-note { color: #f5c46b; margin-top: 2px; }
#fl-note:empty { display: none; }
.fl-buttons { display: flex; gap: 8px; margin-top: 8px; }
.fl-buttons button { border: 1px solid #39506b; background: #0b2238; color: #fff; border-radius: 8px; padding: 6px 12px; font-size: 15px; }
.fl-buttons #flight-exit { margin-left: auto; }
.legal-shade { image-rendering: pixelated; }

/* ---------- settings slider and help ---------- */
.slider-row { display: block; font-size: 14px; }
.units-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; font-size: 14px; }
.units-grid select { width: 100%; min-height: 34px; font: inherit; padding: 4px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); }
.slider-row span { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.slider-row input[type=range] { flex: 1; accent-color: var(--accent); }
.slider-row output { min-width: 64px; text-align: right; font-variant-numeric: tabular-nums; }
.help-body ul { padding-left: 18px; }
.help-icons { list-style: none; padding-left: 0 !important; }
.help-icons > li { display: flex; gap: 8px; align-items: flex-start; margin: 0; padding: 12px 0; }
.help-icons > li + li { border-top: 1px solid var(--line); } /* a clear break between capabilities */
.help-icons .ico { flex: none; width: 26px; height: 26px; display: grid; place-items: center; border: 1px solid var(--line);
  border-radius: 6px; font-size: 14px; }

/* Close (×) buttons at the top right of the settings and help dialogs */
dialog form { position: relative; }
.dlg-x { position: absolute; top: -6px; right: -6px; border: 0; background: none; color: var(--muted);
  font-size: 28px; line-height: 1; padding: 4px 8px; cursor: pointer; }
.help-terms { margin: 10px 0 4px; }
/* Flight mode: track-up / north-up button, shown only while flying */
.fl-zoom #fl-locate.locked { box-shadow: 0 0 0 3px var(--gold), var(--shadow); }
/* Looking around in flight mode (map dragged): the airplane is drawn on the map instead of in the middle */
body.flying.fl-free #flight-ownship { display: none; }
.fl-free-ship svg { filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .5)); }

/* ---------- strip check ---------- */
.strip { font-size: 14px; }
.strip .row { padding: 7px 0; border-top: 1px solid var(--line); }
.strip .row:first-child { border-top: 0; }
.strip .row ul { margin: 4px 0 0; padding-left: 18px; }
.strip .muted, .muted { color: var(--muted); }
.strip .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; margin-top: 4px; word-break: break-word; }
.warn { color: var(--warn); font-weight: 600; }
.good { color: var(--good); font-weight: 600; }
.obstacle { color: #dc2626; font-size: 14px; line-height: 16px; text-align: center; text-shadow: 0 0 2px #fff, 0 0 2px #fff; }

/* ---------- landable overlay legend, strip finder ---------- */
.landable-legend { display: flex; flex-direction: column; gap: 3px; font-size: 12px; margin: 2px 0 8px 24px; }
.landable-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -2px; opacity: .7; }
#finder fieldset { border: 0; padding: 0; margin: 10px 0; }
#finder legend { font-size: 14px; padding: 0; margin-bottom: 4px; }
#finder label.inline { display: inline-flex; align-items: center; gap: 6px; margin-right: 16px; }
#finder label.inline input { width: auto; margin: 0; }
#finder select { display: block; width: 100%; margin-top: 4px; padding: 8px; font-size: 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); }
.fs-row { margin: 10px 0; }
#finder .slider-row { margin: 10px 0; }
.strip-list { padding-left: 0; list-style: none; }
.strip-list li { padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px; }
.strip-list li .muted { display: block; font-size: 12px; }
.strip-num { background: #16a34a; color: #fff; border: 2px solid #fff; border-radius: 50%; font-size: 11px; font-weight: 700;
  line-height: 16px; text-align: center; box-shadow: 0 1px 3px rgba(0, 0, 0, .4); }

/* ---------- map tools menu (hamburger) ---------- */
.fab-tools { display: none; flex-direction: column; gap: 8px; }
.fabs.open .fab-tools, body.flying .fab-tools { display: flex; }
#menu-btn svg { display: block; margin: auto; }
.fabs.open #menu-btn { background: var(--navy); color: #fff; border-color: var(--gold); }
#menu-btn.tool-on { box-shadow: 0 0 0 3px var(--gold), var(--shadow); }

/* ---------- Strip Check button (ruler) ---------- */
#strip-check-btn { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(44px + var(--safe-b)); z-index: 950;
  padding: 10px 20px; border-radius: 999px; border: 1px solid var(--gold); background: var(--navy); color: #fff;
  font-size: 15px; font-weight: 600; box-shadow: var(--shadow); cursor: pointer; }
#strip-check-btn[hidden] { display: none; }

/* ---------- zoom buttons styled like the other map buttons ---------- */
.leaflet-touch .leaflet-control-zoom, .leaflet-control-zoom { border: 0 !important; box-shadow: none; display: flex; flex-direction: column; gap: 8px;
  margin-left: 12px !important; margin-bottom: calc(12px + var(--safe-b)) !important; }
.leaflet-touch .leaflet-control-zoom a, .leaflet-control-zoom a { width: 44px !important; height: 44px !important; line-height: 42px !important;
  font-size: 22px !important; border-radius: 10px !important; border: 1px solid var(--line) !important; background: var(--bg) !important;
  color: var(--fg) !important; box-shadow: var(--shadow); font-weight: 400; }
.leaflet-control-zoom a.leaflet-disabled { opacity: .45; }

/* Strip finder results take the bottom third of the screen (phones), so the map shows above. */
@media (max-width: 759px) { #panel.third { max-height: 34vh; } }
.back-row { margin: 0 0 8px; font-size: 14px; }
.fs-criteria { font-size: 12px; color: var(--muted); margin: -6px 0 6px; }
.fs-criteria summary { cursor: pointer; }

/* Layers menu: VFR chart notes behind "- more info" (only "more info" is the link) */
.vfr-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vfr-row label { flex: none; }
.vfr-more-wrap { font-size: 13px; color: var(--muted); }
#vfr-more { color: var(--highlight); }
/* Settings: offline land data folded under a summary with the count */
.offline-box { margin: 14px 0 4px; }
.offline-box summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.offline-box summary::-webkit-details-marker { display: none; }
/* A gold arrow on the left of each collapsed section shows there are settings inside; it turns when open. */
.offline-box summary { padding: 4px 0; }
.offline-box summary::before { content: ""; flex: none; align-self: center; width: 22px; height: 22px; border-radius: 6px;
  background: color-mix(in srgb, var(--gold, #a87900) 16%, transparent) center / 12px 12px no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M4 2l4 4-4 4' fill='none' stroke='%23a87900' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  transition: transform .2s; }
.offline-box[open] summary::before { transform: rotate(90deg); }
.offline-box summary .settings-h { margin: 0; font-weight: 700; }

/* Strip check: bottom half of the screen (phones), with the strip centered above */
@media (max-width: 759px) { #panel.half { max-height: 50vh; } }
.dir-list { margin: 4px 0 0; }
.dir-list li:first-child { border-top: 0; }
.dir-list li b { color: var(--highlight); }
/* × on the strip finder's search circle */
.circle-x { width: 30px !important; height: 30px !important; }
.circle-x button { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); color: var(--fg);
  font-size: 20px; line-height: 1; box-shadow: var(--shadow); cursor: pointer; padding: 0; }

/* Legend for the strip finder and strip check (top left, under the search box). */
.map-legend { position: fixed; z-index: 900; top: calc(var(--top) + 50px); left: 12px; display: flex; gap: 10px;
  padding: 3px 9px; border-radius: 10px; background: color-mix(in srgb, var(--bg) 90%, transparent); color: var(--fg);
  box-shadow: var(--shadow); font-size: 12px; pointer-events: none; }
.map-legend[hidden] { display: none; }
.map-legend span { display: flex; align-items: center; gap: 7px; }
.map-legend span[hidden] { display: none; }
.map-legend span { gap: 5px; white-space: nowrap; }
.map-legend i { display: inline-block; width: 18px; flex: none; text-align: center; font-style: normal; }
.lg-strip { height: 6px; border-radius: 3px; background: repeating-linear-gradient(90deg, #15803d 0 4px, #fff 4px 6px, #15803d 6px 10px); border: 1px solid #15803d; }
.lg-obs { color: #dc2626; font-size: 13px; line-height: 1; text-shadow: 0 0 2px #fff; }
.lg-power { height: 3px; background: #ea580c; }
.strip-hit { cursor: pointer; }
.strip-num { cursor: pointer; }

/* Help: section headings and indented point lists */
.help-body .help-h { margin: 18px 0 6px; font-size: 16px; }
.help-steps { margin: 4px 0 10px; padding-left: 22px; }
.help-steps li { margin: 6px 0; }
.help-signin { margin: 10px 0; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--accent) 10%, transparent); }
.help-signin p { margin: 0 0 4px; }
.help-signin[hidden] { display: none; }
.help-sec { margin: 6px 0; padding: 4px 0; border-top: 1px solid var(--line); }
.help-sec > :not(summary) { margin-left: 2px; }
.help-body .help-h:first-child { margin-top: 4px; }
.help-body .help-sub { margin: 6px 0 2px; padding-left: 18px; }
.help-body .help-sub li { margin: 4px 0; }
.help-icons > li > div { flex: 1; min-width: 0; }

/* ---------- saved spots ---------- */
.spot-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.spot-actions .btn { margin-top: 0; padding: 7px 12px; font-size: 13px; }
.spot-actions .btn.secondary, .spot-actions .btn:not(.primary) { background: var(--bg); color: var(--fg); border: 1px solid var(--line); }
.file-btn { cursor: pointer; }
.spot-pin { cursor: pointer; filter: drop-shadow(0 1px 2px rgba(0,0,0,.35)); }
.spot-dl { margin: 6px 0 10px; }
.spot-dl .pre { white-space: pre-wrap; }
.spot-gallery { display: flex; gap: 6px; overflow-x: auto; margin: 6px 0; }
.spot-gallery img { height: 96px; border-radius: 8px; display: block; }
.spots-bar { margin: 0 0 6px; font-size: 14px; }
.spots-bar select { font: inherit; padding: 4px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); }
.spots-list { list-style: none; padding: 0; margin: 0 0 10px; }
.spots-list li { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: start; padding: 8px 0; border-top: 1px solid var(--line); }
.spots-list li > input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--accent); }
.spots-list a { color: var(--fg); text-decoration: none; display: flex; flex-direction: column; }
.spots-list .muted { font-size: 13px; }
.spot-row-btns { grid-column: 2; display: flex; gap: 14px; }
.link-btn { border: 0; background: none; padding: 2px 0; font: inherit; font-size: 13px; color: var(--highlight); cursor: pointer; text-decoration: underline; }
.link-btn.danger, dialog menu button.danger { color: #b91c1c; }
dialog menu button.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
dialog menu #spot-delete { margin-right: auto; }
#spot-dlg textarea, #spot-dlg select { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; font: inherit; font-size: 16px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); }
#spot-dlg label { margin: 8px 0; }
.spot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.perm-box { border: 1px solid var(--line); border-radius: 10px; padding: 4px 10px 6px; margin: 8px 0; }
.perm-box legend { font-size: 13px; font-weight: 600; padding: 0 4px; }
.spot-photos-row { display: flex; align-items: center; gap: 10px; }
.spot-photos-row .btn { background: var(--bg); color: var(--fg); border: 1px solid var(--line); }
.spot-photos { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.spot-photos figure { position: relative; margin: 0; }
.spot-photos img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; display: block; }
.spot-photos button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0;
  background: #000e1e; color: #fff; font-size: 14px; line-height: 1; cursor: pointer; }
dialog label.file-btn, label.file-btn { display: inline-block; width: auto; margin: 0; }
.file-btn input[type=file] { display: none !important; }

/* ---------- permission help ---------- */
.pilot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.pilot-grid label { margin: 6px 0; }
#perm-dlg textarea, #perm-dlg input { font: inherit; font-size: 16px; }
#perm-dlg textarea { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); }
#perm-letter { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.4; }
#perm-dlg label { margin: 8px 0; }
.who-to-ask { margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; }
.who-to-ask .label { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 4px; }
.who-to-ask > div + div { margin-top: 4px; }
.perm-badge { margin: 0 0 10px; padding: 8px 10px; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; }
.perm-badge.ok { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); }
.perm-badge.soon { background: color-mix(in srgb, #d97706 16%, transparent); color: #b45309; }
.perm-badge.warn { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.perm-badge.info { background: color-mix(in srgb, #2563eb 12%, transparent); color: #2563eb; }
.perm-badge .muted { font-weight: 400; }
#print-area { display: none; }
@media print {
  body.printing-letter > *:not(#print-area) { display: none !important; }
  body.printing-letter #print-area { display: block; white-space: pre-wrap; font: 12pt/1.5 Georgia, serif; color: #000; margin: 0; }
}

/* ---------- known strips and pilot reports ---------- */
.ks-pin { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; box-sizing: border-box;
  font: 700 11px/1 system-ui, sans-serif; color: #fff; cursor: pointer; box-shadow: 0 0 0 2px #fff, 0 1px 3px rgba(0,0,0,.4); }
.ks-pin.ks-pub.ks-paved { background: #475569; }
.ks-pin.ks-pub.ks-unpaved { background: #a16207; }
.ks-pin.ks-priv { background: #fff; border: 3px solid #475569; color: #475569; }
.ks-pin.ks-priv.ks-unpaved { border-color: #a16207; color: #a16207; }
.ks-pin.ks-osm { width: 16px; height: 16px; border-radius: 3px; transform: rotate(45deg); background: #15803d; }
.ks-legend .ks-pin { width: 14px; height: 14px; margin-right: 6px; font-size: 8px; vertical-align: -2px; box-shadow: 0 0 0 1px #fff; opacity: 1; }
.ks-legend .ks-pin.ks-priv { border-width: 2px; }
.ks-legend .ks-pin.ks-osm { width: 11px; height: 11px; margin: 0 8px 0 2px; }
.ks-use { margin: 0 0 10px; padding: 8px 10px; border-radius: 10px; font-size: 14px; }
.ks-use.pub { background: color-mix(in srgb, var(--good) 12%, transparent); }
.ks-use.priv { background: color-mix(in srgb, #d97706 14%, transparent); }
.ks-rwy { margin: 0 0 8px; padding-left: 18px; font-size: 14px; }
.reports { margin: 12px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.reports .label { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 6px; }
.report-items { list-style: none; padding: 0; margin: 0; }
.report-items li { padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.report-items li:first-child { border-top: 0; }
.report-items .pre { white-space: pre-wrap; margin-top: 2px; }
.report-photo { display: block; max-height: 140px; border-radius: 8px; margin-top: 6px; }
.reports .reports-add { background: var(--bg); color: var(--fg); border: 1px solid var(--line); }
#report-dlg textarea, #report-dlg select { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; font: inherit; font-size: 16px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); }
#report-dlg label { margin: 8px 0; }

/* Settings and Help in the title bar, on the right */
#appbar .bar-btns { margin-left: auto; display: flex; gap: 6px; flex: none; }
#appbar .bar-btns button { width: 36px; height: 36px; border-radius: 9px; border: 1px solid rgba(255,255,255,.25); background: transparent;
  color: #fff; font-size: 19px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
#appbar .bar-btns button:hover { background: rgba(255,255,255,.12); }
#help-btn { font-weight: 700; }
/* The zoom buttons sit in the bottom-left corner; the hint stays clear of them on phones. */
@media (max-width: 759px) {
  #hint { left: 68px; right: 12px; transform: none; max-width: none; text-align: center; white-space: normal; border-radius: 14px;
    right: 40px; bottom: calc(12px + var(--safe-b)); } /* bottom edge level with the − button; the credits' ⓘ to its right */
}
/* Press and hold feedback: a ring that closes in while the finger stays down */
.hold-ring { position: absolute; z-index: 650; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%;
  border: 3px solid #e4572e; pointer-events: none; animation: hold-ring 450ms linear forwards; }
@keyframes hold-ring { from { transform: scale(1.4); opacity: .2; } to { transform: scale(.5); opacity: .9; } }
/* Known strips: position caution */
.ks-pos { font-size: 13px; color: var(--muted); margin: -4px 0 10px; }

/* ◎ (your location) above the zoom buttons, bottom left (fixed, so it stays put when the map turns) */
#locate-wrap { position: fixed; z-index: 950; left: 12px; bottom: calc(12px + var(--safe-b) + 96px + 8px); }
body.flying #locate-wrap { display: none; }
#locate-wrap #locate, .fl-zoom #fl-locate { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--fg);
  box-shadow: var(--shadow); cursor: pointer; display: grid; place-items: center; padding: 0; font-size: 22px; }
/* ◎ locked on your position: a ring around the button */
/* (two ids: the button's own rule above, #locate-wrap #locate, would otherwise hide the ring) — gold, as in flight mode */
#locate-wrap #locate.locked { box-shadow: 0 0 0 3px var(--gold), var(--shadow); }
/* Track up outside flight mode: the same enlarged, turned map */
body.map-rotated #map { inset: auto; left: 50%; top: calc(var(--bar-h) + env(safe-area-inset-top) + (100dvh - var(--bar-h) - env(safe-area-inset-top)) / 2);
  width: var(--fly-d, 150vmax); height: var(--fly-d, 150vmax); transform: translate(-50%, -50%) rotate(var(--fly-rot, 0deg));
  transition: transform .6s ease-out; }
body.map-rotated .leaflet-control-container { display: none; } /* they'd turn with the map; fixed zoom buttons instead */
#rot-zoom { display: none; }
body.map-rotated #rot-zoom { display: flex; flex-direction: column; gap: 8px; position: fixed; z-index: 950; left: 12px; bottom: calc(12px + var(--safe-b)); }
#rot-zoom button { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--fg);
  box-shadow: var(--shadow); font-size: 22px; line-height: 1; cursor: pointer; }
.fabs #map-orient.on { background: var(--navy); color: #fff; border-color: var(--gold); }
/* Strip check: the verdict's heading on its own line */
#sc-verdict .row-h { margin-bottom: 6px; }

/* ---------- account (Settings) ---------- */
.account-box { margin: 0 0 10px; }
.acct-who { margin: 0 0 4px; font-size: 15px; }
.signin-btns { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 4px; }
.signin { display: flex; align-items: center; justify-content: center; gap: 8px; height: 44px; border-radius: 10px; font: 600 15px/1 -apple-system, system-ui, sans-serif;
  cursor: pointer; border: 1px solid var(--line); background: var(--bg); color: var(--fg); }
.signin.apple { background: #000; color: #fff; border-color: #000; }
.signin.google { background: #fff; color: #1f1f1f; border-color: #747775; }
.danger-btn { color: #b91c1c !important; }
/* iPad and desktop: the welcome (terms) and Help dialogs use a normal reading width
   instead of the phone width (the screen width decides; resizing the window adjusts it). */
@media (min-width: 760px) {
  #terms, #help { width: min(760px, calc(100% - 64px)); padding: 22px 28px; }
  #terms .terms-body, #help .terms-body { font-size: 15px; line-height: 1.5; }
  #help .help-icons > li { gap: 12px; }
}
@media (min-width: 760px) and (min-height: 700px) {
  #terms, #help { inset: 0; margin: auto; height: min(86dvh, 900px); }
}
/* iPad and desktop: other dialogs and the side panel a little wider than the phone layout
   (the permission letter most, so its text isn't cramped). */
@media (min-width: 760px) {
  #panel { width: clamp(380px, 32vw, 460px); }
  #settings, #spot-dlg { width: min(520px, calc(100% - 64px)); }
  #report-dlg, #finder { width: min(480px, calc(100% - 64px)); }
  #perm-dlg { width: min(680px, calc(100% - 64px)); }
  #perm-dlg #perm-letter { font-size: 14px; }
  dialog:modal:not(#lightbox):not(#terms):not(#help):not(#wing-dlg) { max-height: min(90dvh, 980px); }
}

/* ---------- strip submissions ---------- */
#submit-dlg textarea, #submit-dlg select { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; font: inherit; font-size: 16px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); }
#submit-dlg label { margin: 8px 0; }
#submit-dlg label.check-row { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
#submit-dlg label.check-row input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.sub-status { display: block; }
.sub-status.approved { color: var(--good); }
.sub-status.rejected { color: var(--warn); }
.ks-pin.ks-sub { background: #7c3aed; border-radius: 4px; }
@media (min-width: 760px) { #submit-dlg { width: min(520px, calc(100% - 64px)); } }

/* A private saved spot: who can see it, and making it public */
.private-box { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; font-size: 14px;
  background: color-mix(in srgb, #2563eb 9%, transparent); border: 1px solid color-mix(in srgb, #2563eb 25%, transparent); }
.private-box > div { margin-top: 6px; }

/* Map scale: beside the − button, above the hint box when it shows (app.js moves it), clear of the credits line */
#scale { position: fixed; z-index: 900; left: 70px; bottom: calc(12px + var(--safe-b)); pointer-events: none;
  display: flex; flex-direction: column-reverse; align-items: flex-start; gap: 0; font-size: 10px; line-height: 12px; font-weight: 600; color: #111;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 2px #fff; }
#scale .scale-bar { display: block; height: 6px; border: 2px solid #111; border-top: 0; box-shadow: 0 1px 0 #fff, 1px 0 0 #fff, -1px 0 0 #fff; }
body.flying #scale { display: none; }

/* Distance rings' labels, at the top of each ring */
.ring-label { width: 0; height: 0; }
.ring-label span { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; font-size: 11px; font-weight: 700; color: #0b3d91;
  background: rgba(255,255,255,.85); padding: 1px 6px; border-radius: 999px; border: 1px solid #0b3d91; }

/* ---------- Wingmen and squadrons ---------- */
#wing-btn { position: relative; }
.fab-badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: #d92d20; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.fab-badge[hidden] { display: none; }
.wing-tabs { display: flex; gap: 4px; margin: 4px 0 8px; border-bottom: 1px solid var(--line); }
.wing-tabs button { flex: 1; padding: 8px 4px; border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer;
  border-bottom: 3px solid transparent; }
.wing-tabs button[aria-selected=true] { color: var(--fg); border-bottom-color: var(--gold, #a87900); }
.tab-badge:not(:empty) { display: inline-block; min-width: 16px; padding: 0 4px; border-radius: 999px; background: #d92d20; color: #fff; font-size: 11px; line-height: 16px; }
.wing-body { max-height: min(60dvh, 560px); overflow-y: auto; }
.wing-list { list-style: none; padding: 0; margin: 4px 0 8px; }
.wing-list li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line); }
.wing-list li:first-child { border-top: 0; }
.wing-list li > div { flex: 1; min-width: 0; }
.wing-list li.unread b::after { content: " •"; color: #d92d20; }
.wing-ico { flex: none; width: 26px; text-align: center; font-size: 18px; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { flex: 1; margin: 0 !important; }
.share-choices { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.share-choices .btn { padding: 12px; font-size: 15px; text-align: left; }
.send-list { max-height: 40dvh; overflow-y: auto; }
#send-dlg textarea { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; font: inherit; font-size: 16px; border: 1px solid var(--line); border-radius: 8px; }
.eyebrow { margin: 0 0 2px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.pre { white-space: pre-wrap; }
.btn.danger { background: var(--bg); color: #b91c1c; border: 1px solid #e5b4b4; }
.share-choices .btn:not(.primary) { background: var(--bg); color: var(--fg); border: 1px solid var(--line); }

/* ---------- Recording and logbook ---------- */
#log-btn .log-rec { opacity: 0; }
#log-btn.rec-on { color: #d92d20; box-shadow: 0 0 0 3px #d92d20, var(--shadow); }
#log-btn.rec-on .log-rec { opacity: 1; animation: rec-blink 1.2s infinite; }
@keyframes rec-blink { 50% { opacity: .2; } }
.rec-dot, body.flying .rec-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #fff; vertical-align: -1px; margin-right: 2px; }
.rec-box { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin: 4px 0 10px; }
.rec-box p { margin: 6px 0; }
.rec-box .rec-dot { background: #d92d20; }
.btn.rec-start { background: #d92d20; color: #fff; font-size: 16px; padding: 12px 18px; }
.btn.rec-start .rec-dot { background: #fff; }
.log-stats { margin: 8px 0; }
.log-landings { margin: 4px 0 8px; padding-left: 18px; }
#log-dlg textarea, #panel textarea#log-notes { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; font: inherit; font-size: 16px; border: 1px solid var(--line); border-radius: 8px; }
#panel-body label:has(#log-title), #panel-body label:has(#log-notes) { display: block; font-size: 14px; margin: 6px 0; }
#log-title { display: block; width: 100%; margin-top: 4px; padding: 9px 11px; font: inherit; font-size: 16px; border: 1px solid var(--line); border-radius: 8px; }
.lg-chip { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: 0; }
.help-signin .btn { margin-top: 6px; }

/* ---------- One look for every strip and spot card (strip-card.js) ---------- */
.sc-label { display: inline-block; margin: 0 0 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #fff; }
.sc-label.sc-faa { background: #334155; }
.sc-label.sc-osm { background: #15803d; }
.sc-label.sc-sub { background: #7c3aed; }
.sc-label.sc-squadron { background: #0f8a3c; }
.sc-label.sc-private { background: #2a7de1; }
.sc-title { margin: 2px 0 2px; }
.sc-actions { margin: 6px 0 10px; }
.ks-use.sq { background: color-mix(in srgb, #0f8a3c 12%, transparent); }
.ks-use.mine { background: color-mix(in srgb, #2a7de1 12%, transparent); }
.sc-notes { margin: 6px 0; }
.sc-extra { margin: 8px 0; font-size: 14px; }
.sc-trips { margin: 10px 0; }
.sc-trip-list { margin: 4px 0; padding-left: 18px; }
.sc-source { margin-top: 10px; }
#suggest li.place { display: flex; gap: 8px; align-items: baseline; }
#suggest .pl-ico { flex: none; width: 18px; text-align: center; font-weight: 700; }
.pl-squadron { color: #0f8a3c; } .pl-osm { color: #15803d; } .pl-sub { color: #7c3aed; } .pl-faa { color: #334155; }
.sc-facts .ks-rwy { list-style: none; padding: 0; margin: 0; }

/* A logbook entry's fields */
.log-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 10px; margin: 6px 0; }
.log-form label { min-width: 0; }
.log-form input { box-sizing: border-box; max-width: 100%; min-width: 0; -webkit-appearance: none; appearance: none; min-height: 38px; }

.log-form label, label.log-wide { display: block; font-size: 13px; color: var(--muted); }
.log-form .log-wide { grid-column: 1 / -1; }
.log-form input, .log-landing-rows input, .log-landing-rows select, #log-notes { display: block; width: 100%; margin-top: 3px; padding: 7px 9px; font: inherit; font-size: 16px;
  color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.log-landing-rows { list-style: none; padding: 0; margin: 4px 0; }
/* Each landing: time, kind and Remove on one line; where, below it, full width; then a link to the strip. */
.log-landing-rows li { margin: 6px 0; padding: 8px; border: 1px solid var(--line); border-radius: 10px; }
.log-landing-rows .lr-top { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.log-landing-rows .lr-top input { flex: 0 1 120px; min-width: 0; }
.log-landing-rows .lr-top select { flex: 1 1 auto; min-width: 0; }
.log-landing-rows .lr-top button { flex: none; }
.log-landing-rows input, .log-landing-rows select { margin: 0; box-sizing: border-box; }
.log-landing-rows .lr-go { display: block; margin-top: 6px; }
.log-list li { cursor: pointer; align-items: center; }
.log-chev { flex: none; font-size: 22px; color: var(--muted); }
.log-back { display: block; margin: 0 0 6px; }
#menu-btn.rec-on { box-shadow: 0 0 0 3px #d92d20, var(--shadow); }

/* Messages */
.msg-threads li { cursor: pointer; }
.msg-preview { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-list { display: flex; flex-direction: column; gap: 6px; max-height: min(45dvh, 420px); overflow-y: auto; padding: 4px 2px; }
.msg { max-width: 85%; align-self: flex-start; padding: 7px 10px; border-radius: 12px; background: color-mix(in srgb, var(--line) 55%, transparent); font-size: 15px; }
.msg.mine { align-self: flex-end; background: color-mix(in srgb, #2a7de1 18%, transparent); }
.msg-from { font-weight: 700; margin-bottom: 2px; }
.msg-meta { margin-top: 3px; font-size: 11px; }
.msg-item .spot-row-btns { display: block; margin-top: 2px; }
/* The box to write in takes the full width; 📷 and Send sit on the next line, at the right. */
.msg-compose { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px 10px; margin-top: 8px; }
.msg-compose textarea { flex: 1 0 100%; padding: 8px 10px; font: inherit; font-size: 16px; border: 1px solid var(--line); border-radius: 10px; resize: vertical; color: var(--fg); background: var(--bg); }
.msg-compose .btn { margin: 0; }
.msg-photo { font-size: 20px; cursor: pointer; padding: 6px 2px; }

/* Pilot details: account-only parts show when signed in */
#pilot-box .acct-only { display: none; }
#pilot-box.signed-in .acct-only { display: block; }
#pilot-box.signed-in .acct-out-only { display: none; }
#pilot-box .findme { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
#findby-box[hidden] { display: none; }
.pilot-grid .acct-only { grid-column: 1 / -1; }

/* Legend: squadron and private spots (pin) and strips (line) */
.ks-legend .lg-dot { display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; margin-right: 3px; vertical-align: -2px;
  font-size: 8px; font-style: normal; box-shadow: 0 0 0 2px #fff; }
.ks-legend .lg-line { display: inline-block; width: 16px; height: 4px; border-radius: 2px; margin-right: 6px; vertical-align: 3px; }
.ks-legend .lg-sq { background: #0f8a3c; }
.ks-legend .lg-mine { background: #2563eb; }

/* Wingmen and messages: the whole screen on phones (between the Dynamic Island and the home bar) */
@media (max-width: 759px) {
  #wing-dlg[open] { position: fixed; margin: 0 auto; max-height: none !important; height: auto; inset: calc(var(--safe-t) + 10px) 0 calc(var(--safe-b) + 10px) 0;
    display: flex; flex-direction: column; }
  #wing-dlg form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
  #wing-dlg .wing-body { flex: 1; min-height: 0; max-height: none; }
}
@media (min-width: 760px) { #wing-dlg { width: min(560px, calc(100% - 64px)); } #wing-dlg .wing-body { max-height: min(70dvh, 640px); } }
/* A conversation: the messages fill the space, the box to write in stays at the bottom */
.wing-body.thread { display: flex; flex-direction: column; overflow: hidden; }
.wing-body.thread .msg-list { flex: 1; min-height: 120px; max-height: none; }
@media (min-width: 760px) { .wing-body.thread { height: min(70dvh, 640px); } }
.msg { max-width: 85%; word-wrap: break-word; overflow-wrap: anywhere; }
.msg-compose textarea { min-width: 0; }
/* A hidden input stays hidden even where inputs are styled to show (dialogs). */
input[hidden] { display: none !important; }
.log-landing-rows .lr-top input[type=time] { flex: 0 0 auto; width: 132px; }
.ks-legend > span { display: flex; align-items: flex-start; gap: 0; }
.ks-legend > span > i { flex: none; margin-top: 2px; }
.wing-ico svg { display: inline-block; vertical-align: middle; color: var(--fg); }

/* Logbook: wingmen on the flight */
.log-crew { font-size: 13px; color: var(--muted); }
.log-crew .log-lbl { display: block; margin-bottom: 3px; }
.crew-chip { display: inline-flex; align-items: center; gap: 4px; margin: 2px 4px 2px 0; padding: 2px 4px 2px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--gold) 16%, transparent); color: var(--fg); font-size: 14px; }
.crew-chip button { border: 0; background: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 0 4px; }
#log-crew-pick { display: block; width: 100%; margin-top: 6px; padding: 7px 9px; font: inherit; font-size: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); }
#log-crew-pick[hidden] { display: none; }
.fl-buttons #fl-record { margin-left: auto; }
.fl-buttons #fl-record.on { background: #d92d20; border-color: #d92d20; font-weight: 700; }
.fl-buttons #fl-record + #flight-exit { margin-left: 0; }
.taildragger .cut { fill: var(--bg); }
.wing-ico { width: 30px; }

/* The taildragger image (flight mode button, squadrons, search, Help) */
.td-ico { display: inline-block; vertical-align: middle; object-fit: contain; }
.fabs #flight-btn .td-ico { display: block; margin: auto; }
.td-inline { vertical-align: -2px; }
#suggest .pl-faa .td-ico { vertical-align: 0; }

/* Avatars */
.avatar { display: inline-block; border-radius: 50%; object-fit: cover; vertical-align: middle; flex: none; }
.wing-ico .avatar { width: 30px; height: 30px; }
.wing-ico { width: 32px; }
.avatar-grid { display: grid; grid-template-columns: repeat(4, 60px); gap: 6px; margin: 8px 0; }
.avatar-pick { padding: 2px; border: 2px solid transparent; border-radius: 50%; background: none; cursor: pointer; }
.avatar-pick.on { border-color: var(--gold); }
.avatar-actions { display: flex; gap: 12px; align-items: center; }
.me-avatar-row { gap: 10px; align-items: center; margin: 6px 0; grid-column: 1 / -1; }
#pilot-box.signed-in .me-avatar-row { display: flex !important; }
#me-avatar-box { grid-column: 1 / -1; }
.sq-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.sq-head .settings-h { margin: 0; }
.msg-from .avatar { width: 18px; height: 18px; vertical-align: -4px; }
.sq-spot-row { cursor: pointer; display: flex; gap: 8px; align-items: center; }
.thread-head .settings-h { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.thread-head .avatar { width: 26px; height: 26px; }
#me-avatar-box[hidden], #sq-av-box[hidden] { display: none !important; }

/* Squadron invitations: who invited you, who's in it */
.inv-detail { margin: 2px 0 4px; }
.inv-detail .avatar { width: 18px; height: 18px; vertical-align: -4px; }
.inv-members { display: flex; flex-wrap: wrap; gap: 4px 8px; margin: 4px 0 2px; }
.inv-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px 1px 2px; border-radius: 999px; background: color-mix(in srgb, var(--line) 60%, transparent); }
.inv-chip.wm { font-weight: 700; background: color-mix(in srgb, var(--gold) 18%, transparent); }

/* The Wingmen button lives in the title bar now */
#appbar #wing-btn { position: relative; display: grid; place-items: center; }
#appbar #wing-btn svg { width: 20px; height: 20px; }
#appbar #wing-btn .fab-badge { top: -5px; right: -5px; box-shadow: 0 0 0 2px var(--navy); }
/* Show / Save under a shared spot in a conversation: room between them */
.msg-item .spot-row-btns { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 6px; }
.sc-also { margin: 8px 0; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--line) 45%, transparent); font-size: 14px; }
.sc-also > div { margin-top: 3px; }

/* Squadron spot notes */
.sq-notes { list-style: none; padding: 0; margin: 4px 0 8px; }
.sq-notes li { padding: 6px 0; border-top: 1px solid var(--line); }
.sq-notes li:first-child { border-top: 0; }
.sq-add-note textarea { display: block; width: 100%; padding: 8px 10px; font: inherit; font-size: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); }
.sq-note-btns { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.sq-note-btns .btn { margin: 0; }
.sq-edit { margin: 8px 0; }
.sq-edit input, .sq-edit select { display: block; width: 100%; margin: 3px 0 6px; padding: 7px 9px; font: inherit; font-size: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); }
.sq-edit[hidden] { display: none; }

.msg { position: relative; }
.msg.mine { padding-right: 24px; }
.msg-x { position: absolute; top: 2px; right: 4px; border: 0; background: none; color: var(--muted); font-size: 16px; line-height: 1; padding: 2px 4px; cursor: pointer; }
.sq-row { cursor: pointer; align-items: center; }
/* Photos open over the app, not in a new window */
#lightbox { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none;
  padding: calc(env(safe-area-inset-top) + 40px) 12px calc(env(safe-area-inset-bottom) + 20px); }
#lightbox[open] { display: grid; place-items: center; }
#lightbox::backdrop { background: rgba(0, 0, 0, .9); }
#lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
#lightbox button { position: absolute; top: calc(env(safe-area-inset-top) + 8px); right: 12px; width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .15); color: #fff; font-size: 26px; line-height: 1; cursor: pointer; }
#account-actions:not(:empty) { margin: 10px 0 4px; }
/* One place, one card: the private, squadron and public parts */
.sc-part { margin: 12px 0; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); }
.sc-part-h { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; font-size: 15px; }
.sc-part-h.sq { color: #0f8a3c; }
.sc-part-h.pub { color: var(--highlight); }
.sc-part-h .avatar { flex: none; }
.push-box { margin: 8px 0 4px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.push-box[hidden] { display: none; }
.msg-more { text-align: center; margin: 4px 0; }

/* Cropping an avatar photo (crop.js) */
.crop-dlg { width: min(340px, calc(100% - 32px)); }
.crop-box { position: relative; width: 280px; height: 280px; margin: 8px auto; touch-action: none; cursor: grab; border-radius: 8px; overflow: hidden; }
.crop-box canvas { width: 280px; height: 280px; display: block; }
.crop-ring { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 200px rgba(0, 0, 0, .45); pointer-events: none; outline: 2px solid rgba(255, 255, 255, .85); outline-offset: -2px; }
.crop-zoom { display: flex !important; align-items: center; gap: 10px; margin: 6px 4px; }
.crop-zoom input { flex: 1; margin: 0; padding: 0; accent-color: var(--highlight); }

/* The FAA airport record on an FAA card */
.faa-who > div { margin: 4px 0; }
.faa-rwy { margin: 6px 0; }
.faa-rwy ul, .faa-rmk ul { margin: 2px 0 0; padding-left: 18px; }
.faa-rmk summary { cursor: pointer; margin: 8px 0 4px; }

/* Every field in a popup the same: full width of its column, 44 px tall, 16 px text. iOS draws
   date fields at their own width and height unless told otherwise, so they could spill out of a
   two-column row over the field next to them. */
dialog input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]), dialog select, dialog textarea {
  box-sizing: border-box; width: 100%; max-width: 100%; min-width: 0; font-size: 16px; }
dialog input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]), dialog select { height: 44px; padding: 0 11px; line-height: 42px; }
dialog input[type=date], dialog input[type=time] { -webkit-appearance: none; appearance: none; display: block; background: var(--bg); color: var(--fg); }
dialog input[type=date]::-webkit-date-and-time-value { text-align: left; margin: 0; }
dialog select { -webkit-appearance: none; appearance: none; background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2364748b' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 12px center;
  padding-right: 32px; border: 1px solid var(--line); border-radius: 8px; color: var(--fg); }
.spot-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 10px; }
.spot-grid > label { min-width: 0; }

/* Messages with the keyboard open (social.js fitToKeyboard): just the conversation and the box */
#wing-dlg.kb-open #wing-title, #wing-dlg.kb-open .wing-tabs { display: none; }
#wing-dlg.kb-open { padding-top: 8px; padding-bottom: 8px; }
#wing-dlg.kb-open .wing-body.thread .msg-list { min-height: 40px; }
#wing-dlg.kb-open .thread-head .settings-h { margin: 2px 0; }

/* Traffic (traffic.js): an arrow along the track, with the tail number and altitude under it */
/* (No position here: Leaflet places markers with position: absolute.) */
.tfc-ico svg { display: block; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .5)); }
.tfc-lbl { position: absolute; left: 50%; top: 31px; transform: translateX(-50%); white-space: nowrap; font: 600 11px/1.15 -apple-system, system-ui, sans-serif;
  color: #fff; text-align: center; text-shadow: 0 0 2px #000, 0 0 3px #000, 0 1px 2px #000; pointer-events: none; }
.tfc-ico.friend .tfc-lbl { color: #ffd166; }
.tfc-ico.close .tfc-lbl { color: #fecaca; }
.traffic-opts { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 0 0 6px 26px; font-size: 13px; }
.traffic-opts label { display: flex; align-items: center; gap: 4px; margin: 0; }
.traffic-opts select { font: inherit; font-size: 13px; padding: 2px 4px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg); max-width: 210px; }
.traffic-opts .small { flex-basis: 100%; }
/* The tail number box beside Record (flight mode and the logbook) */
.fl-buttons #fl-tail { margin-left: auto; }
.fl-buttons #fl-record { margin-left: 0; }
.fl-tail { width: 96px; min-width: 0; padding: 6px 6px; text-align: center; border-radius: 8px; border: 1px solid #39506b; background: #0b2238;
  color: #fff; font: 600 14px/1 -apple-system, system-ui, sans-serif; text-transform: uppercase; }
.fl-tail::placeholder { color: rgba(255, 255, 255, .5); }
.rec-row { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; }
.rec-row .rec-tail { width: 100px; min-width: 0; }
.rec-tail { width: 110px; height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; font: 600 16px/1 -apple-system, system-ui, sans-serif;
  text-transform: uppercase; background: var(--bg); color: var(--fg); }
.rec-tail-lbl { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; }

/* Flight mode zoom buttons: bottom left, just above the flight box (its height is --fl-strip-h) */
.fl-zoom { display: none; }
body.flying .fl-zoom { display: flex; flex-direction: column; gap: 8px; position: fixed; z-index: 1100; left: 12px;
  bottom: calc(var(--fl-strip-h, 140px) + 10px); }
.fl-zoom button { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--fg);
  font-size: 22px; line-height: 1; box-shadow: var(--shadow); cursor: pointer; }
.chart-line { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 6px 28px; }
.state-lines[hidden] { display: none; }
.state-block { margin-bottom: 4px; }
.chart-line[hidden] { display: none; }
.chart-line input { width: 18px; height: 18px; margin: 1px 0 0; flex: none; }

/* No "double-tap to zoom" on buttons: iOS could swallow a quick second tap (◎ twice to follow) */
button, .leaflet-control a { touch-action: manipulation; }

/* Flying now (top of the Wingmen dialog) */
.flying-now { margin: 0 0 8px; padding: 6px 10px; border: 1px solid var(--gold); border-radius: 10px; background: color-mix(in srgb, var(--gold) 10%, transparent); }
.flying-now[hidden] { display: none; }
.flying-now ul { list-style: none; margin: 4px 0 0; padding: 0; }
.flying-now li { display: flex; align-items: center; gap: 8px; padding: 6px 0; cursor: pointer; border-top: 1px solid var(--line); }
.flying-now li:first-child { border-top: 0; }
.flying-now li > div { flex: 1; min-width: 0; }

/* Layer groups in the layers menu */
.layer-group { margin: 6px 0 4px; padding: 6px 0 2px; border-top: 1px solid var(--line); }
.layer-group .group-head { font-size: 14px; }
.layer-group .group-items { margin-left: 22px; }

/* Traffic: a see-through info box (the path shows through it), and the alert banner */
.tfc-pop .leaflet-popup-content-wrapper, .tfc-pop .leaflet-popup-tip { background: rgba(255, 255, 255, .72); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
@media (prefers-color-scheme: dark) { .tfc-pop .leaflet-popup-content-wrapper, .tfc-pop .leaflet-popup-tip { background: rgba(15, 23, 42, .72); color: #fff; } }
#tfc-alert { position: fixed; z-index: 1300; left: 50%; transform: translateX(-50%); top: calc(var(--bar-h) + env(safe-area-inset-top) + 8px);
  min-width: 260px; max-width: calc(100% - 24px); padding: 10px 16px; border-radius: 12px; background: #b91c1c; color: #fff; text-align: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .35); font-size: 20px; cursor: pointer; }
#tfc-alert[hidden] { display: none; }
#tfc-alert b { display: block; font-size: 22px; letter-spacing: .01em; }
#tfc-alert span { display: block; font-size: 14px; opacity: .9; }
.group-items label > .ks-pin { width: 14px; height: 14px; font-size: 8px; vertical-align: -2px; margin: 0 2px; box-shadow: 0 0 0 1px #fff; }
.group-items label > .ks-pin.ks-priv { border-width: 2px; }
/* Settings: the sign-in line at the top */
.settings-acct { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: -4px 0 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line, #e2e8f0); }
.settings-acct:empty { display: none; }
#settings .settings-acct .signin-btns { display: flex; flex-direction: row; gap: 8px; width: 100%; margin: 0; }
#settings .settings-acct .signin-btns .signin { flex: 1; min-height: 0; height: 36px; padding: 0 6px; font-size: 13px; gap: 5px; width: auto; white-space: nowrap; }
.group-items label > input { flex: none; }
.state-size { margin-left: 6px; font-size: 12px; font-weight: 600; color: var(--muted, #64748b); }
/* Traffic: an alert's red ring; a ground target's gray arrow (smaller); the info box beside the target */
.tfc-ring { position: absolute; left: -10px; top: -10px; width: 52px; height: 52px; box-sizing: border-box; border: 3px solid #dc2626; border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .85), inset 0 0 0 1px rgba(255, 255, 255, .6); animation: tfc-pulse 1.2s ease-in-out infinite; pointer-events: none; }
@keyframes tfc-pulse { 50% { transform: scale(1.12); } }
.tfc-ico.alert .tfc-lbl { color: #fecaca; }
.tfc-ico.gnd svg { transform-origin: 50% 50%; scale: .8; opacity: .9; }
.tfc-pop.tfc-side .leaflet-popup-tip-container { display: none; }
/* Flight mode: the shortest-stretch slider at the bottom of the box */
.fl-min { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; color: #cbd5e1; }
.fl-min input { flex: 1; min-width: 0; accent-color: #22c55e; }
.fl-min output { min-width: 56px; text-align: right; font-weight: 600; color: #fff; }
/* Flight plans: the box at the bottom, the waypoints on the map, the "next waypoint" chip */
.plan-box { position: fixed; z-index: 1150; left: 0; right: 0; bottom: 0; max-height: 45vh; max-height: 45dvh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--fg); box-shadow: var(--shadow); border-radius: 16px 16px 0 0; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); box-sizing: border-box; }
.plan-box[hidden] { display: none; }
@media (min-width: 760px) { .plan-box { left: auto; right: 68px; bottom: 16px; width: 400px; border-radius: 16px; } }
.plan-head { display: flex; gap: 8px; align-items: center; }
.plan-head input { flex: 1; font-size: 17px; font-weight: 600; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); }
.plan-head .dlg-x { position: static; }
.plan-box > p { margin: 6px 0; }
.plan-wps { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.plan-wps li { display: grid; grid-template-columns: 24px 1fr auto; grid-template-rows: auto auto; gap: 0 8px; align-items: center; padding: 5px 0; border-top: 1px solid var(--line); }
.plan-wps li.next .plan-n { background: #d0109f; color: #fff; }
.plan-n { grid-row: span 2; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #d0109f; color: #d0109f; font: 700 12px/1 system-ui, sans-serif; box-sizing: border-box; }
.plan-wps input { min-width: 0; border: 0; border-bottom: 1px dashed var(--line); background: transparent; color: var(--fg); font-size: 15px; padding: 2px 0; }
.plan-leg { grid-column: 2; }
.plan-btns { grid-row: 1 / span 2; grid-column: 3; display: flex; gap: 2px; }
.plan-btns button { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg); font-size: 15px; padding: 0; }
.plan-btns button:disabled { opacity: .3; }
.plan-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.plan-actions select { padding: 7px 6px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); max-width: 150px; }
.plan-actions .danger { margin-left: auto; }
.plan-wp { display: grid; place-items: center; }
.plan-wp b { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 3px solid #d0109f; color: #d0109f; font: 800 12px/1 system-ui, sans-serif; box-sizing: border-box; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.plan-wp.next b { background: #d0109f; color: #fff; }
.plan-wp span { position: absolute; top: 25px; left: 50%; transform: translateX(-50%); white-space: nowrap; font: 700 12px/1.1 system-ui, sans-serif; color: #fff;
  text-shadow: 0 0 3px #000, 0 0 3px #000; pointer-events: none; }
.plan-chip { position: fixed; z-index: 1050; left: 50%; transform: translateX(-50%); top: calc(var(--top) + 58px); max-width: calc(100% - 140px);
  padding: 6px 12px; border-radius: 10px; border: 0; background: #d0109f; color: #fff; font: 600 14px/1.25 system-ui, sans-serif; box-shadow: var(--shadow); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-chip[hidden] { display: none; }
.fl-plan { margin: 4px 0 2px; padding: 4px 8px; border-radius: 8px; background: #d0109f; color: #fff; font-weight: 600; font-size: 15px; }
.fl-plan[hidden] { display: none; }
/* Messages: a squadron (group) conversation has a 👥 badge; the rest are wingmen */
.thread-sq { display: inline-grid; place-items: center; width: 22px; height: 18px; border-radius: 9px; background: #dcfce7; font-size: 12px; vertical-align: 1px; }
/* Traffic zoomed out: smaller arrows */
.tfc-z6 .tfc-ico svg { scale: .45; }
.tfc-z8 .tfc-ico svg { scale: .65; }
/* TFR details box */
.tfr-pop p { margin: 6px 0; }
.tfr-pop .tfr-on { color: #dc2626; }
.tfr-pop .tfr-up { color: #ea580c; }
.tfr-pop details { margin: 4px 0 6px; }
.tfr-pop .pre { white-space: pre-wrap; max-height: 160px; overflow-y: auto; }

/* North up / track up: under ◎, above the zoom buttons (map and flight mode) */
#locate-wrap { display: flex; flex-direction: column; gap: 8px; }
body.flying #locate-wrap { display: none; }
#locate-wrap #map-orient, .fl-zoom #fl-orient { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--fg);
  box-shadow: var(--shadow); cursor: pointer; display: grid; place-items: center; padding: 0; }
#locate-wrap #map-orient.on, .fl-zoom #fl-orient.on { background: var(--navy); color: #fff; border-color: var(--gold); }
#locate-wrap button svg, .fl-zoom button svg { display: block; margin: auto; }
/* Airport card: flight category badge and frequencies */
.fltcat { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 8px; font-size: 13px; font-weight: 700; color: #fff; vertical-align: 2px; }
.fltcat.vfr { background: #16a34a; }
.fltcat.mvfr { background: #2563eb; }
.fltcat.ifr { background: #dc2626; }
.fltcat.lifr { background: #a21caf; }
.faa-freq .freq { font-variant-numeric: tabular-nums; }
.metar-raw { font-family: ui-monospace, Menlo, monospace; font-size: 11px; word-break: break-word; }
/* FAA waypoints: a small triangle (fix / RNAV) or a magenta flag-like diamond (VFR reporting point), name beside it */
/* (No "position" on the pin itself: Leaflet places markers absolutely and moves them while zooming.) */
.fix-pin i, .fix-key { display: block; width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 11px solid #0f172a; filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff); margin: 1px; }
.fix-pin.vfr i, .fix-key.vfr { width: 10px; height: 10px; border: 2px solid #fff; background: #c026d3; transform: rotate(45deg); box-sizing: border-box; filter: none; margin: 2px; }
.fix-key { display: inline-block; margin: 0 6px 0 0; vertical-align: -1px; }
.fix-pin span { position: absolute; left: 15px; top: -2px; white-space: nowrap; font: 700 11px/1.2 system-ui, sans-serif; color: #0f172a; text-shadow: 0 0 2px #fff, 0 0 2px #fff, 0 0 2px #fff; pointer-events: none; }
.fix-pin.vfr span { color: #86198f; }
/* TFR details: see-through like the traffic box */
.tfr-popup .leaflet-popup-content-wrapper, .tfr-popup .leaflet-popup-tip { background: rgba(255, 255, 255, .78); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
@media (prefers-color-scheme: dark) { .tfr-popup .leaflet-popup-content-wrapper, .tfr-popup .leaflet-popup-tip { background: rgba(15, 23, 42, .78); color: #fff; } }
/* Weather and runways boxes */
.wx-src { font-weight: 400; margin-left: 4px; }
.wx-taf { margin-top: 6px; }
.wx-taf summary { cursor: pointer; font-size: 14px; }
.wx-periods { list-style: none; padding: 0; margin: 6px 0; font-size: 14px; }
.wx-periods li { margin: 4px 0; }
.wx-periods .fltcat { margin: 0 4px 0 0; font-size: 11px; }
.rwy-ends { list-style: none; padding: 0; margin: 4px 0; font-size: 14px; }
.rwy-ends li { padding: 4px 0; border-top: 1px solid var(--line); }
.rwy-ends li:first-child { border-top: 0; }
.rwy-ends li.rwy-best, .rwy-ends li.rwy-best .rwy-wind { color: #15803d; }
@media (prefers-color-scheme: dark) { .rwy-ends li.rwy-best, .rwy-ends li.rwy-best .rwy-wind { color: #4ade80; } }
/* Every map info box (waypoints, TFRs, traffic, wingmen…): see-through, so the map shows under it */
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: rgba(255, 255, 255, .78); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
@media (prefers-color-scheme: dark) { .leaflet-popup-content-wrapper, .leaflet-popup-tip { background: rgba(15, 23, 42, .78); color: #fff; } }
/* Flight plan box: tabs, typing a route, inserting, saved plans with their tags */
.plan-tabs { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); margin: -4px 0 8px; }
.plan-tabs [role="tab"] { border: 0; background: none; color: var(--muted, #64748b); font: 600 15px/1 system-ui, sans-serif; padding: 8px 10px; border-bottom: 3px solid transparent; cursor: pointer; }
.plan-tabs [role="tab"][aria-selected="true"] { color: var(--fg); border-bottom-color: #d0109f; }
.plan-tabs .dlg-x { position: static; margin-left: auto; }
.plan-head { display: flex; flex-direction: column; gap: 4px; }
.plan-type { display: flex; gap: 6px; margin-top: 6px; }
.plan-type input, .plan-ins input { flex: 1; min-width: 0; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); font: 15px ui-monospace, Menlo, monospace; text-transform: uppercase; }
.plan-wps li.plan-gap { display: block; border-top: 0; padding: 0 0 0 32px; min-height: 0; }
.plan-wps li.plan-gap .link-btn { font-size: 12px; padding: 0; }
.plan-wps li.plan-ins { display: flex; gap: 6px; padding: 4px 0 4px 32px; border-top: 0; }
.plan-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.plan-tag { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 8px; background: #fef3c7; color: #92400e; }
.plan-tag.sq { background: #dcfce7; color: #166534; }
.plan-tag.from, .plan-tag.by { background: #e0e7ff; color: #3730a3; }
.plan-saved { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.plan-saved li { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--line); }
.plan-saved li:first-child { border-top: 0; }
.plan-saved li.cur > div > b { color: #d0109f; }
.plan-saved .plan-btns { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.plan-saved .plan-btns .btn { width: auto; height: auto; padding: 5px 12px; }
.plan-route { color: var(--muted, #64748b); }
.plan-leg-hit { cursor: grab; }
.plan-saved .plan-btns .link-btn { width: auto; height: auto; border: 0; background: none; color: #dc2626; font-size: 13px; }
.plan-head input { width: 100%; box-sizing: border-box; align-self: stretch; }
/* A group inside a group (TFRs, FAA waypoints under Airspace) */
.layer-subgroup { margin: 2px 0 4px; }
.layer-subgroup > .group-head { font-weight: 400; }
.layer-subgroup > .group-items { margin-left: 22px; }
.lg-sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin: 0 2px; }
/* Flight plan: the route as boxes, colored by what each is */
.route-box { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 6px; padding: 5px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); cursor: text; max-height: 84px; overflow-y: auto; }
.route-box input { flex: 1; min-width: 90px; border: 0; outline: 0; background: transparent; color: var(--fg); font: 15px ui-monospace, Menlo, monospace; text-transform: uppercase; padding: 3px 2px; }
.rchip { display: inline-block; padding: 2px 7px; border-radius: 6px; font: 600 13px/1.3 ui-monospace, Menlo, monospace; border: 1.5px solid; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: pointer; white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.rchip.k-apt { background: #dbeafe; border-color: #2563eb; color: #1e3a8a; }
.rchip.k-fix { background: #e2e8f0; border-color: #334155; color: #0f172a; }
.rchip.k-vfr { background: #fae8ff; border-color: #c026d3; color: #86198f; }
.rchip.k-osm, .rchip.k-spot { background: #dcfce7; border-color: #16a34a; color: #14532d; } /* strips and spots without an identifier */
.rchip.k-gps { background: #fef3c7; border-color: #d97706; color: #78350f; }
.rchip-key { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.rchip-key .rchip { font-size: 10px; padding: 0 5px; cursor: default; }
.rchip-menu { position: absolute; z-index: 5; display: flex; flex-direction: column; min-width: 160px; background: var(--bg); color: var(--fg); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 4px; }
.rchip-menu b { padding: 6px 10px 4px; font-size: 13px; }
.rchip-menu button { border: 0; background: none; color: var(--fg); text-align: left; padding: 8px 10px; font-size: 15px; border-radius: 6px; cursor: pointer; }
.rchip-menu button:hover { background: rgba(0, 0, 0, .06); }
.plan-box { max-height: 60vh; max-height: 60dvh; position: fixed; }
.plan-wps { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y; min-height: 60px; }
.plan-wps li.plan-ins { align-items: center; padding-left: 4px; }
.plan-ins .ins-x { width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 50%; background: var(--bg); color: var(--fg); font-size: 16px; line-height: 1; padding: 0; flex: none; }
.plan-saved li[data-open] { cursor: pointer; }
.plan-saved li[data-open]:hover { background: rgba(0, 0, 0, .03); }
.plan-box > :not(.plan-wps):not(.plan-saved) { flex: none; }
.plan-box > .plan-wps, .plan-box > .plan-saved { flex: 1 1 auto; min-height: 60px; }
/* Flying a flight plan: a magenta ring on its button */
#plan-btn.plan-flying { box-shadow: 0 0 0 3px #d0109f, var(--shadow); border-color: #d0109f; color: #d0109f; }
.fabs:not(.open) #menu-btn.plan-flying { box-shadow: 0 0 0 3px #d0109f, var(--shadow); }
