/* Globe — original UI for the airplanes.hughesit.us tracker.
   Dark-first ops-console look; light theme is its own palette, not a flip. */

:root {
  --bg: #0b0f1a;
  --surface: rgba(17, 23, 38, 0.86);
  --surface-solid: #111726;
  --border: rgba(148, 163, 184, 0.16);
  --ink: #e6ebf4;
  --ink-2: #9aa7bd;
  --ink-3: #64748b;
  --accent: #38bdf8;
  --accent-ink: #082f49;
  --danger: #f87171;
  --danger-bg: #7f1d1d;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  --radius: 14px;
  --blur: saturate(1.2) blur(14px);
  --sel: #7dd3fc;
  --past: #e8a13c;                       /* "seen in the past" accent — amber, never the danger red */
  --past-bg: rgba(232, 161, 60, 0.12);
}
[data-theme="light"] {
  --bg: #eef1f6;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-solid: #ffffff;
  --border: rgba(15, 23, 42, 0.12);
  --ink: #17233b;
  --ink-2: #52617c;
  --ink-3: #8a97ad;
  --accent: #0284c7;
  --accent-ink: #f0f9ff;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --shadow: 0 8px 30px rgba(15, 23, 42, 0.18);
  --sel: #0369a1;
  --past: #b45309;
  --past-bg: rgba(180, 83, 9, 0.09);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  touch-action: none;
  overscroll-behavior: none;
}
#app { position: fixed; inset: 0; }
#mapstack, #mapstack canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#cv-ac { cursor: grab; }
#cv-ac.dragging { cursor: grabbing; }
#cv-ac.pick { cursor: pointer; }

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
input[type="search"] { -webkit-appearance: none; appearance: none; }

/* ---------- top bar ---------- */
#topbar {
  position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 12px; right: 12px;
  display: flex; align-items: center; gap: 10px; z-index: 30; pointer-events: none;
}
#topbar > * { pointer-events: auto; }
.brand {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 14px 8px 11px; border-radius: var(--radius);
  background: var(--surface); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  font-weight: 650; letter-spacing: 0.2px; cursor: pointer; user-select: none;
  color: var(--ink);
}
.brand svg { color: var(--accent); }
#searchwrap { position: relative; flex: 0 1 340px; }
#search {
  width: 100%; padding: 9px 14px; border-radius: var(--radius);
  background: var(--surface); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  color: var(--ink); outline: none;
}
#search::placeholder { color: var(--ink-3); }
#search:focus { border-color: var(--accent); }
#searchresults {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40;
  background: var(--surface-solid); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); overflow: hidden; max-height: 50vh; overflow-y: auto;
}
.sres { display: flex; gap: 10px; align-items: baseline; width: 100%; text-align: left; padding: 9px 13px; }
.sres:hover, .sres.hot { background: rgba(56, 189, 248, 0.12); }
.sres b { min-width: 74px; }
.sres small { color: var(--ink-2); }
.sres .far { margin-left: auto; color: var(--ink-3); font-size: 12px; flex: none; }
.sres.gone b, .sres.gone small { opacity: 0.72; }
.sres .far.ago { color: var(--past); font-weight: 600; }
.sres .far.apt {
  color: var(--accent); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 5px; padding: 1px 6px;
}
.topbtns { margin-left: auto; display: flex; gap: 8px; }
.iconbtn {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px;
  background: var(--surface); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border); box-shadow: var(--shadow); color: var(--ink-2);
}
.iconbtn:hover { color: var(--ink); border-color: var(--accent); }
.iconbtn.on { color: var(--accent); }

/* ---------- emergency banner ---------- */
#embanner {
  position: absolute; top: calc(58px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  z-index: 29; max-width: min(92vw, 560px);
  background: var(--danger-bg); color: #fff; border: 1px solid rgba(255,255,255,0.25);
  border-radius: 12px; box-shadow: var(--shadow); padding: 8px 12px;
  display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-weight: 600;
}
[data-theme="light"] #embanner { color: #7f1d1d; border-color: rgba(127,29,29,0.3); }
#embanner .emtag { animation: empulse 1.6s ease-in-out infinite; }
#embanner button {
  padding: 2px 9px; border-radius: 8px; background: rgba(255,255,255,0.16); font-weight: 600;
}
[data-theme="light"] #embanner button { background: rgba(127,29,29,0.12); }
#embanner button:hover { background: rgba(255,255,255,0.3); }
@keyframes empulse { 50% { opacity: 0.55; } }

/* ---------- pin bar ---------- */
#pinbar {
  position: absolute; top: calc(58px + env(safe-area-inset-top)); left: 12px; z-index: 24;
  max-width: min(60vw, 520px); display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.pinchip {
  display: inline-flex; align-items: center; border-radius: 999px; overflow: hidden;
  background: var(--surface); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--pc, var(--border)); box-shadow: var(--shadow); font-size: 12px;
}
.pinchip button { padding: 4px 4px 4px 10px; font-weight: 600; }
.pinchip button:first-child { border-left: 3px solid var(--pc); }
.pinchip button:last-child { padding: 4px 8px 4px 4px; color: var(--ink-3); font-size: 10px; }
.pinchip button:last-child:hover { color: var(--danger); }
.pinclear {
  font-size: 11.5px; color: var(--ink-2); padding: 4px 10px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.pinclear:hover { color: var(--danger); }

/* ---------- aircraft list ---------- */
#pinbar:not([hidden]) ~ #listpanel { top: calc(100px + env(safe-area-inset-top)); }
#listpanel {
  position: absolute; top: calc(58px + env(safe-area-inset-top)); left: 12px; bottom: 12px; z-index: 23;
  width: min(300px, calc(100vw - 24px)); display: flex; flex-direction: column;
  background: var(--surface); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
#list-top { display: flex; align-items: center; gap: 8px; padding: 10px 8px 8px 14px; border-bottom: 1px solid var(--border); }
#list-top b { font-size: 14px; }
#list-count { color: var(--ink-3); font-size: 11.5px; flex: 1; }
#list-close { width: 28px; height: 28px; font-size: 12px; flex: none; }
#list-scroll { overflow-y: auto; overscroll-behavior: contain; flex: 1; }
#list-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
#list-table th {
  position: sticky; top: 0; background: var(--surface-solid); text-align: right;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--ink-3);
  padding: 6px 10px; cursor: pointer; user-select: none; white-space: nowrap;
}
#list-table th:first-child { text-align: left; padding-left: 14px; }
#list-table th.on { color: var(--accent); }
#list-table th.on.desc::after { content: " ↓"; }
#list-table th.on.asc::after { content: " ↑"; }
#list-table td { padding: 5px 10px; text-align: right; border-top: 1px solid var(--border); white-space: nowrap; }
#list-table td:first-child { text-align: left; padding-left: 14px; }
#list-table td b { display: block; font-weight: 600; }
#list-table td small { color: var(--ink-3); font-size: 10.5px; }
#list-table tbody tr { cursor: pointer; }
#list-table tbody tr:hover { background: rgba(56, 189, 248, 0.1); }
#list-table tbody tr.sel { background: rgba(56, 189, 248, 0.16); }

/* ---------- layers sheet ---------- */
#layers {
  position: absolute; top: calc(58px + env(safe-area-inset-top)); right: 12px; z-index: 35;
  width: min(320px, calc(100vw - 24px)); max-height: calc(100vh - 140px); overflow-y: auto;
  background: var(--surface); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px;
}
#layers h2 { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-3); margin: 14px 0 8px; }
#layers h2:first-child { margin-top: 0; }
.lrow { display: flex; align-items: center; gap: 11px; padding: 7px 2px; }
.lmeta b { font-weight: 600; display: block; }
.lmeta small { color: var(--ink-2); display: block; margin-top: 1px; }
.lsub { padding: 4px 2px 8px 47px; }
.lsub.open { padding-left: 2px; }
.rangeline { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 13px; }
.rangeline input { flex: 1; accent-color: var(--accent); }
.optline { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 0; color: var(--ink-2); }
.seg { display: inline-flex; background: rgba(100, 116, 139, 0.14); border-radius: 9px; padding: 2px; }
.seg button { padding: 4px 11px; border-radius: 7px; color: var(--ink-2); font-size: 13px; }
.seg button.on { background: var(--surface-solid); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,0.25); }

.switch { position: relative; display: inline-block; width: 36px; height: 21px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0; border-radius: 21px; background: rgba(100, 116, 139, 0.4);
  transition: background 0.15s; cursor: pointer;
}
.switch span::after {
  content: ""; position: absolute; top: 2.5px; left: 2.5px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: transform 0.15s;
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(15px); }

/* filters */
#filtersec .optline { padding-top: 0; }
#fl-alt-val { color: var(--ink); font-weight: 600; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chips button {
  padding: 4px 11px; border-radius: 999px; font-size: 12.5px; color: var(--ink-2);
  background: rgba(100, 116, 139, 0.14); border: 1px solid transparent;
}
.chips button.on { background: rgba(56, 189, 248, 0.16); border-color: var(--accent); color: var(--ink); }
#fl-types {
  flex: 1; min-width: 0; padding: 5px 9px; border-radius: 8px; font: inherit; font-size: 12.5px;
  background: rgba(100, 116, 139, 0.12); border: 1px solid var(--border); color: var(--ink); outline: none;
}
#fl-types:focus { border-color: var(--accent); }
#fl-reset { margin-top: 6px; color: var(--danger); font-size: 12.5px; }

#aboutdata { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
#btn-about { color: var(--ink-2); font-size: 13px; }
#btn-about:hover { color: var(--ink); }
#abouttext { margin-top: 8px; font-size: 12.5px; color: var(--ink-2); }
#abouttext p + p { margin-top: 8px; }

/* ---------- detail panel ---------- */
#panel {
  position: absolute; top: calc(58px + env(safe-area-inset-top)); right: 12px; bottom: 12px; z-index: 25;
  width: min(330px, calc(100vw - 24px));
  background: var(--surface); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow-y: auto; overscroll-behavior: contain;
}
#panel-drag { display: none; }
#panel-close { position: absolute; top: 10px; right: 10px; z-index: 2; width: 30px; height: 30px; font-size: 13px; }
#panel-photo { position: relative; height: 168px; background: rgba(100, 116, 139, 0.12); border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; }
#panel-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-empty { display: grid; place-items: center; height: 100%; color: var(--ink-3); font-size: 12px; letter-spacing: 1px; text-transform: uppercase; }
#panel-lastseen {
  margin: 10px 16px 0; padding: 9px 12px; border-radius: 12px;
  background: var(--past-bg);
  border: 1px solid color-mix(in srgb, var(--past) 40%, transparent);
  font-size: 12.5px;
}
#panel-lastseen b {
  display: block; color: var(--past); font-size: 10.5px;
  text-transform: uppercase; letter-spacing: 0.8px;
}
#panel-lastseen span { color: var(--ink); font-weight: 600; }
#panel-lastseen small { display: block; color: var(--ink-2); margin-top: 3px; line-height: 1.35; }
#panel-head { padding: 12px 16px 4px; }
#panel-callsign { font-size: 22px; font-weight: 700; letter-spacing: 0.3px; }
#panel-callsign .reg { font-size: 14px; font-weight: 500; color: var(--ink-2); margin-left: 8px; }
#panel-type { color: var(--ink-2); margin-top: 2px; }
#panel-route { margin: 10px 16px 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: rgba(56, 189, 248, 0.06); }
.route-line { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 16px; }
.route-line .arrow { color: var(--ink-3); flex: 1; text-align: center; position: relative; height: 14px; }
.route-line .arrow::before { content: ""; position: absolute; left: 0; right: 12px; top: 6px; border-top: 2px dotted var(--ink-3); }
.route-line .arrow::after { content: "➤"; position: absolute; right: 0; top: -2px; font-size: 11px; }
.route-sub { color: var(--ink-2); font-size: 12px; margin-top: 4px; }
.route-note { color: var(--ink-3); font-size: 11px; margin-top: 3px; }
#panel-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; padding: 12px 16px; }
.stat { background: rgba(100, 116, 139, 0.1); border-radius: 10px; padding: 7px 9px; }
.stat small { display: block; color: var(--ink-3); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.6px; }
.stat b { font-size: 15px; font-weight: 650; }
.stat b .u { font-size: 11px; color: var(--ink-2); font-weight: 500; margin-left: 2px; }
.stat.warn b { color: var(--danger); }
/* track block: live vs. a browsed day, legs, exports */
#panel-track { margin: 0 16px 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 12px; }
.track-row { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.track-row.meta { margin-top: 6px; color: var(--ink-3); font-size: 11.5px; }
.track-row .grow, .tsep { flex: 1; }
.tbtn {
  padding: 3px 9px; border-radius: 7px; font-size: 12px; font-weight: 600; color: var(--ink-2);
  background: rgba(100, 116, 139, 0.12);
}
.tbtn:hover { color: var(--ink); }
.tbtn.on { background: rgba(56, 189, 248, 0.18); color: var(--accent); }
.tbtn:disabled { opacity: 0.35; cursor: default; }
.track-legs { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.tbtn.leg { text-align: left; font-weight: 500; font-variant-numeric: tabular-nums; }
.track-note { color: var(--ink-3); font-size: 12px; margin-top: 6px; }

#panel-extra { padding: 0 16px; color: var(--ink-2); font-size: 13px; }
#panel-extra .kv { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
#panel-extra .kv span:last-child { color: var(--ink); text-align: right; }
/* full telemetry disclosure */
#panel-more { padding: 4px 16px 0; }
#panel-more summary {
  cursor: pointer; color: var(--ink-2); font-size: 12.5px; font-weight: 600;
  padding: 6px 0; user-select: none; list-style-position: inside;
}
#panel-more summary:hover { color: var(--ink); }
#panel-more-body { font-size: 13px; color: var(--ink-2); padding-bottom: 4px; }
#panel-more-body .kv { display: flex; justify-content: space-between; gap: 12px; padding: 2.5px 0; }
#panel-more-body .kv span:last-child { color: var(--ink); text-align: right; }
#panel-more-body .kv small { color: var(--ink-3); }
.more-group {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--ink-3);
  margin: 8px 0 2px; border-bottom: 1px solid var(--border); padding-bottom: 2px;
}

#panel-actions { display: flex; gap: 8px; padding: 12px 16px; }
#panel-actions button {
  flex: 1; padding: 8px; border-radius: 10px; font-weight: 600;
  background: rgba(100, 116, 139, 0.14); color: var(--ink);
}
#panel-actions button:hover { background: rgba(56, 189, 248, 0.18); }
#panel-actions button.on { background: var(--accent); color: var(--accent-ink); }
#panel-credit { padding: 0 16px 12px; font-size: 11px; color: var(--ink-3); }

/* ---------- radar timeline ---------- */
#wxbar {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(52px + env(safe-area-inset-bottom)); z-index: 20;
  display: flex; align-items: center; gap: 10px; padding: 7px 12px;
  background: var(--surface); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  width: min(400px, calc(100vw - 24px));
}
#wx-play { width: 30px; height: 30px; flex: none; }
#wx-scrub { flex: 1; accent-color: var(--accent); }
#wx-time { color: var(--ink-2); font-size: 12px; white-space: nowrap; }

/* ---------- timelapse bar ---------- */
#rpbar {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(52px + env(safe-area-inset-bottom)); z-index: 21;
  display: flex; flex-direction: column; gap: 7px; padding: 8px 12px;
  background: var(--surface); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid color-mix(in srgb, var(--past) 50%, transparent);
  border-radius: var(--radius); box-shadow: var(--shadow);
  width: min(516px, calc(100vw - 24px));
}
.rp-row { display: flex; align-items: center; gap: 8px; }
.rp-lab { color: var(--ink-3); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.8px; }
.rp-quick { display: flex; gap: 4px; }
.rp-quick button {
  font: inherit; font-size: 12px; font-weight: 600; color: var(--ink-2);
  background: rgba(100, 116, 139, 0.14); border: 1px solid transparent;
  border-radius: 7px; padding: 3px 7px; white-space: nowrap;
}
.rp-quick button:hover:not(:disabled) { background: color-mix(in srgb, var(--past) 26%, transparent); color: var(--ink); }
.rp-quick button.on { background: color-mix(in srgb, var(--past) 34%, transparent); border-color: var(--past); color: var(--ink); }
.rp-quick button:disabled { opacity: 0.35; }
#rp-when {
  flex: 1; min-width: 0; font: inherit; font-size: 12.5px; color: var(--ink);
  background: rgba(100, 116, 139, 0.12); border: 1px solid var(--border); border-radius: 8px; padding: 4px 7px;
}
#rp-speed, #rp-trails {
  font: inherit; font-size: 12.5px; color: var(--ink); background: var(--surface-solid);
  border: 1px solid var(--border); border-radius: 8px; padding: 4px 5px;
}
#rp-play, #rp-exit, #rp-clean { width: 30px; height: 30px; flex: none; }
#rp-time { flex: 1; text-align: right; color: var(--past); font-weight: 650; font-size: 12.5px; white-space: nowrap; }

/* ---------- recording view ---------- */
/* Chrome out of the way for a screen capture, but reachable: the bar fades
   back in when the pointer goes near it. The legend stays — it is the thing
   that explains the colors on camera. */
body.cinema #topbar, body.cinema #hud, body.cinema #pinbar,
body.cinema #listpanel, body.cinema #panel, body.cinema #wxbar,
body.cinema #embanner, body.cinema #attrib-extra { display: none !important; }
body.cinema #rpbar { opacity: 0; transition: opacity 0.25s ease; }
body.cinema #rpbar:hover, body.cinema #rpbar:focus-within { opacity: 1; }
/* clear of the bar, so the hint doesn't land in the middle of the shot */
body.cinema #toast { bottom: calc(150px + env(safe-area-inset-bottom)); }
#tl-clock {
  position: absolute; top: 18px; left: 50%; transform: translateX(-50%); z-index: 22;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 8px 18px; pointer-events: none;
  background: var(--surface); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid color-mix(in srgb, var(--past) 45%, transparent);
  border-radius: 12px; box-shadow: var(--shadow);
}
#tl-time { font: 650 25px/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink); letter-spacing: 0.5px; }
#tl-date { font-size: 11px; color: var(--ink-3); letter-spacing: 0.6px; text-transform: uppercase; }

/* ---------- keyboard help ---------- */
#helpoverlay {
  position: absolute; inset: 0; z-index: 60; display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.4);
}
.helpcard {
  background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 22px; width: min(360px, 92vw);
}
.helpcard h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-3); margin: 0 0 12px; }
.helpgrid { display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; align-items: center; font-size: 13px; }
.helpgrid kbd {
  justify-self: start; font: 600 11.5px ui-monospace, monospace; color: var(--ink);
  background: rgba(100, 116, 139, 0.16); border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 6px; padding: 2px 7px; white-space: nowrap;
}
.helpgrid span { color: var(--ink-2); }
#help-close { margin-top: 14px; width: 100%; padding: 7px; border-radius: 9px; background: rgba(100, 116, 139, 0.14); font-weight: 600; }
#help-close:hover { background: rgba(56, 189, 248, 0.18); }

/* ---------- minimal chrome (?ui=min) ---------- */
body.ui-min #topbar, body.ui-min #hud, body.ui-min #legends, body.ui-min #pinbar,
body.ui-min #listpanel, body.ui-min #panel, body.ui-min #wxbar, body.ui-min #rpbar { display: none !important; }

/* ---------- embed frame (?ui=embed) ----------
   ui=min's opposite twin: same chrome gone, but #panel KEPT — these frames
   exist so a click on an aircraft shows its details. Camera locking is JS
   (MapView.lock); here we only drop the panel controls whose actions are
   camera motion. Attribution is untouched: it's a license, not chrome. */
body.ui-embed #topbar, body.ui-embed #hud, body.ui-embed #legends, body.ui-embed #pinbar,
body.ui-embed #listpanel, body.ui-embed #wxbar, body.ui-embed #rpbar { display: none !important; }
body.ui-embed #btn-follow { display: none !important; }

/* ---------- legends ---------- */
#legends {
  position: absolute; left: 12px; bottom: calc(30px + env(safe-area-inset-bottom)); z-index: 15;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.legend {
  background: var(--surface); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow);
  padding: 7px 10px 5px; width: 200px;
}
.legend canvas { display: block; width: 180px; height: 8px; border-radius: 4px; }
.lg-ticks { display: flex; justify-content: space-between; color: var(--ink-3); font-size: 10px; margin-top: 2px; }
.lg-title { color: var(--ink-2); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.8px; margin-top: 1px; }
#lg-cov-swatches { display: flex; gap: 4px; }
#lg-cov-swatches .sw { flex: 1; display: flex; align-items: center; gap: 4px; font-size: 10px; color: var(--ink-2); }
#lg-cov-swatches .sw i { width: 12px; height: 12px; border-radius: 3px; flex: none; }

/* ---------- hud ---------- */
#hud {
  position: absolute; right: 12px; bottom: calc(30px + env(safe-area-inset-bottom)); z-index: 15;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
}
#statuschip {
  padding: 5px 11px; border-radius: 999px; font-size: 12px; color: var(--ink-2);
  background: var(--surface); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border); box-shadow: var(--shadow); white-space: nowrap;
}
#fastboard {
  width: 218px; padding: 8px 6px 6px; border-radius: 12px;
  background: var(--surface); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.fb-title {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--ink-2);
  padding: 0 6px 6px;
}
.fb-empty { color: var(--ink-3); font-size: 12px; padding: 0 6px 4px; }
.fb-row {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 5px 6px; border-radius: 8px; font-variant-numeric: tabular-nums;
}
.fb-row:hover { background: rgba(56, 189, 248, 0.12); }
.fb-row.sel { background: rgba(56, 189, 248, 0.16); }
.fb-rank { color: var(--ink-3); font-size: 11px; font-weight: 700; width: 12px; flex: none; text-align: center; }
.fb-id { flex: 1; min-width: 0; }
.fb-id b { display: block; font-size: 12.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-id small { display: block; color: var(--ink-3); font-size: 10.5px; }
.fb-spd { color: var(--accent); font-weight: 700; font-size: 13px; flex: none; }
.fb-spd small { color: var(--ink-3); font-weight: 500; font-size: 10px; }
#zoomctl {
  display: flex; flex-direction: column; border-radius: 12px; overflow: hidden;
  background: var(--surface); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
#zoomctl button { width: 38px; height: 36px; font-size: 19px; color: var(--ink-2); }
#zoomctl button:hover { color: var(--ink); background: rgba(56, 189, 248, 0.12); }
#zoomctl button:first-child { border-bottom: 1px solid var(--border); }

#attrib {
  position: absolute; right: 12px; bottom: calc(6px + env(safe-area-inset-bottom)); z-index: 14;
  font-size: 10.5px; color: var(--ink-3);
  background: color-mix(in srgb, var(--bg) 55%, transparent); padding: 2px 7px; border-radius: 7px;
}
#attrib a { color: var(--ink-3); text-decoration: underline; }

/* ---------- tooltip / toast ---------- */
#tooltip {
  position: absolute; z-index: 28; pointer-events: none;
  background: var(--surface-solid); border: 1px solid var(--border); border-radius: 9px;
  box-shadow: var(--shadow); padding: 6px 10px; font-size: 12.5px; max-width: 240px;
}
#tooltip b { display: block; }
#tooltip small { color: var(--ink-2); }
#toast {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(90px + env(safe-area-inset-bottom));
  z-index: 50; background: var(--surface-solid); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); padding: 8px 14px; font-size: 13px; max-width: 90vw;
}

/* ---------- mobile ---------- */
@media (max-width: 640px) {
  #searchwrap { flex: 1; }
  .brand span { display: none; }
  #btn-list, #listpanel { display: none !important; }   /* the list is a desktop power view */
  #pinbar { max-width: calc(100vw - 24px); }
  #panel {
    top: auto; right: 0; left: 0; bottom: 0; width: 100%;
    max-height: 62vh; border-radius: 16px 16px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  #panel-drag {
    display: block; width: 44px; height: 4px; border-radius: 2px;
    background: var(--ink-3); margin: 8px auto 0;
  }
  #panel-photo { border-radius: 0; height: 140px; }
  /* minimized peek: selection and track stay alive, map stays visible */
  #panel.min { max-height: 96px; overflow: hidden; }
  #panel.min #panel-photo, #panel.min #panel-route, #panel.min #panel-stats,
  #panel.min #panel-track, #panel.min #panel-extra, #panel.min #panel-more,
  #panel.min #panel-actions, #panel.min #panel-credit,
  #panel.min #panel-lastseen b, #panel.min #panel-lastseen small { display: none; }
  #panel.min #panel-lastseen { margin: 4px 16px 0; padding: 3px 10px; font-size: 11.5px; }
  #panel.min #panel-head { padding: 6px 16px 12px; }
  #panel.min #panel-callsign { font-size: 17px; }
  #panel.min #panel-type {
    font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  #legends { bottom: auto; top: calc(112px + env(safe-area-inset-top)); }
  .legend { width: 160px; }
  .legend canvas { width: 140px; }
  #wxbar { bottom: calc(12px + env(safe-area-inset-bottom)); }
  #hud { bottom: calc(46px + env(safe-area-inset-bottom)); }
  #zoomctl { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  #embanner .emtag { animation: none; }
}
