    * { box-sizing: border-box; }

    :root{
      color-scheme: dark;
      --bg: #070b18;
      --panel-base: rgba(12, 18, 34, 0.75);
      --border-light: rgba(130, 170, 255, 0.18);

      --text-primary: rgba(245, 250, 255, 0.98);
      --text-muted: rgba(180, 200, 240, 0.7);
      --text-soft: rgba(210, 225, 255, 0.85);

      --accent-cyan: #6cd4ff;
      --accent-glow: #40b9ff;

      --radius-xl: 24px;
      --radius-lg: 18px;
      --radius-md: 14px;

      --shadow-float: 0 20px 40px -10px rgba(0, 10, 30, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
      --shadow-panel: 0 20px 42px -8px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;

      --backdrop-blur: blur(18px) saturate(200%);
      --transition-micro: 0.16s cubic-bezier(0.2, 0, 0, 1);

      /* mobile sizing helpers */
      --safe-bottom: env(safe-area-inset-bottom, 0px);
      --safe-top: env(safe-area-inset-top, 0px);
      --dock-collapsed: 72px;
    }

    body.light-theme {
      color-scheme: light;
      --bg: #eef2f8;
      --panel-base: rgba(255, 255, 255, 0.72);
      --border-light: rgba(60, 100, 160, 0.25);

      --text-primary: #0b1a2e;
      --text-muted: #2f405c;
      --text-soft: #1e2f47;

      --accent-cyan: #0077be;
      --accent-glow: #005faa;

      --shadow-float: 0 12px 30px -10px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.6) inset;
      --shadow-panel: 0 15px 35px -10px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255,255,255,0.8) inset;
    }

    html, body {
      height: 100%;
      margin: 0;
      background: var(--bg);
      font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
      -webkit-font-smoothing: antialiased;
      transition: background-color 0.2s, color 0.2s;
    }

    #app { height: 100%; width: 100%; position: relative; overflow: hidden; }
    #map { position: absolute; inset: 0; z-index: 0; }

    #app:before{
      content:"";
      position:absolute; inset:0; z-index:5; pointer-events:none;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.18'/%3E%3C/svg%3E");
      opacity: 0.16;
      mix-blend-mode: overlay;
    }
    body.light-theme #app:before{
      opacity: 0.09;
      mix-blend-mode: multiply;
    }

    #hud{
      position:absolute; inset:0;
      z-index: 6;
      pointer-events:none;
      width:100%;
      height:100%;
      mix-blend-mode: screen;
      opacity: 1;
    }
    body.light-theme #hud{
      mix-blend-mode: multiply;
      opacity: 0.55;
    }

    #topbar {
      position: absolute; left: 16px; right: 16px; top: 16px; z-index: 10;
      display: flex; align-items: center; gap: 16px;
      padding: 8px 16px 8px 20px;
      background: var(--panel-base);
      backdrop-filter: var(--backdrop-blur);
      border: 1px solid var(--border-light);
      border-radius: 80px;
      box-shadow: var(--shadow-float);
      color: var(--text-primary);
      flex-wrap: wrap;
  /* Allow floating menus (like the More dropdown) to render outside the pill */
  overflow: visible;
      transform: translateZ(0);
    }

    .brand { display: flex; flex-direction: column; gap: 0px; }
    .brand .t {
      font-weight: 750; font-size: 1.1rem; letter-spacing: -0.01em;
      background: linear-gradient(130deg, var(--text-primary), var(--accent-cyan));
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
    }
    .brand .s {
      font-size: 0.7rem; font-weight: 450; color: var(--text-muted);
      letter-spacing: -0.01em;
      max-width: 380px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }

    .search { flex: 1; display: flex; justify-content: center; min-width: 200px; }
    .search input {
      width: min(620px, 100%);
      padding: 10px 18px;
      border-radius: 60px;
      border: 1px solid var(--border-light);
      background: rgba(255,255,255,0.1);
      color: var(--text-primary);
      font-size: 0.85rem;
      outline: none;
      backdrop-filter: blur(4px);
      transition: var(--transition-micro);
    }
    .search input:focus {
      border-color: var(--accent-cyan);
      box-shadow: 0 0 0 3px rgba(100, 180, 255, 0.2);
    }
    .search input::placeholder { color: var(--text-muted); opacity: 0.6; }

/* Keep the top controls in a single clean row on desktop; overflow scrolls if needed */
.kpiRow { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; overflow-x: auto; overflow-y: visible; -webkit-overflow-scrolling: touch; }
    .kpi {
      padding: 4px 14px;
      border: 1px solid var(--border-light);
      background: rgba(128,128,128,0.1);
      border-radius: 40px;
      font-size: 0.8rem;
      font-weight: 500;
      color: var(--text-soft);
      white-space: nowrap;
      backdrop-filter: blur(4px);
    }
    .kpi b { color: var(--text-primary); font-weight: 800; margin-left: 4px; }

    .btn {
      padding: 6px 14px;
      border-radius: 999px;
      border: 1px solid var(--border-light);
      background: rgba(128,128,128,0.1);
      color: var(--text-primary);
      font-size: 0.8rem;
      font-weight: 600;
      cursor: pointer;
      backdrop-filter: blur(4px);
      transition: var(--transition-micro);
      user-select: none;
    }
    .btn:hover {
      background: rgba(100,160,255,0.2);
      border-color: var(--accent-cyan);
      transform: scale(0.985);
    }
    .btn.on {
      background: rgba(0, 160, 255, 0.25);
      border-color: var(--accent-cyan);
      box-shadow: 0 0 8px var(--accent-glow);
    }

    /* "More" dropdown (topbar) */
    .moreMenu{ position: relative; display: inline-flex; align-items: center; }
    .moreDropdown{
      position: absolute;
      top: calc(100% + 10px);
      right: 0;
      min-width: 220px;
      padding: 10px;
      border-radius: 18px;
      border: 1px solid var(--border-light);
      background: var(--panel-base);
      box-shadow: var(--shadow-float);
      display: none;
      flex-direction: column;
      gap: 8px;
  /* Make sure it sits above the header and map UI */
  z-index: 9999;
    }
    .moreDropdown.open{ display: flex; }

    /* When the dropdown is moved to <body> to avoid overflow clipping */
    .moreDropdown.portalled{
      position: fixed;
      left: -9999px;
      top: -9999px;
      right: auto;
    }
    .moreDropdown .btn{ width: 100%; text-align: left; justify-content: flex-start; }
    .moreDropdown select.btn{ width: 100%; }
    .moreDropdown .menuRow{ display: flex; gap: 8px; width: 100%; }
    .moreDropdown .menuRow .btn{ flex: 1; }

    .statusPill {
      margin-left: 6px;
      display: flex; align-items: center; gap: 8px;
      padding: 4px 12px 4px 10px;
      border-radius: 999px;
      border: 1px solid var(--border-light);
      background: rgba(0,0,0,0.2);
      font-size: 0.75rem;
      color: var(--text-muted);
    }
    .dot {
      width: 8px; height: 8px; border-radius: 10px;
      background: #ff5e6b;
      box-shadow: 0 0 6px #ff5e6b;
      transition: background 0.2s, box-shadow 0.2s;
    }
    .dot.ok { background: #58d68d; box-shadow: 0 0 10px #58d68d; }

    /* Popup for rings and label fields */
    .popup-overlay {
      position: fixed; top: 0; left: 0; width: 100%; height: 100%;
      background: rgba(0,0,0,0.3); backdrop-filter: blur(4px);
      z-index: 100; display: none;
      align-items: center; justify-content: center;
    }
    .popup-card {
      background: var(--panel-base);
      backdrop-filter: var(--backdrop-blur);
      border: 1px solid var(--border-light);
      border-radius: var(--radius-xl);
      box-shadow: var(--shadow-panel);
      padding: 24px;
      max-width: 400px;
      width: 90%;
      color: var(--text-primary);
    }
    .popup-card h3 {
      margin: 0 0 16px 0; font-weight: 800; color: var(--accent-cyan);
    }
    .popup-row {
      margin-bottom: 16px; display: flex; align-items: center; gap: 12px;
    }
    .popup-row label { width: 70px; color: var(--text-muted); font-weight: 650; }
    .popup-row input[type="number"] {
      width: 100px; padding: 8px; border-radius: 999px; border: 1px solid var(--border-light);
      background: rgba(0,0,0,0.2); color: var(--text-primary); text-align: center;
    }
    .popup-close {
      text-align: right; margin-top: 20px;
    }
    .popup-close button {
      padding: 8px 24px;
    }
    .label-checkboxes {
      display: flex; flex-direction: column; gap: 10px; margin: 16px 0;
    }
    .label-checkboxes label {
      display: flex; align-items: center; gap: 10px; font-size: 0.9rem;
    }

    #rightDock {
      position: absolute; right: 16px; top: 92px; bottom: 16px; width: 460px;
      z-index: 9;
      display: flex; flex-direction: column; overflow: hidden;
      background: var(--panel-base);
      backdrop-filter: var(--backdrop-blur);
      border: 1px solid var(--border-light);
      border-radius: var(--radius-xl);
      box-shadow: var(--shadow-panel);
      color: var(--text-primary);
      transform: translateZ(0);
    }

    #rightHeader {
      padding: 16px 18px 10px;
      border-bottom: 1px solid var(--border-light);
      display: flex; align-items: center; justify-content: space-between;
    }
    .titleStack .t {
      font-weight: 800; font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.02em;
      color: var(--accent-cyan);
    }
    .titleStack .s { font-size: 0.72rem; color: var(--text-muted); font-weight: 500; margin-top: 2px; }

    .opFilter { display: flex; align-items: center; gap: 8px; position: relative; flex-wrap: wrap; }
    select {
      padding: 6px 12px;
      border-radius: 999px;
      border: 1px solid var(--border-light);
      background: var(--panel-base);
      color: var(--text-primary);
      font-size: 0.8rem;
      outline: none;
      backdrop-filter: blur(4px);
      cursor: pointer;
    }

    .col-selector { position: relative; }
    .col-dropdown {
      position: absolute;
      top: 40px;
      right: 0;
      background: var(--panel-base);
      backdrop-filter: var(--backdrop-blur);
      border: 1px solid var(--border-light);
      border-radius: var(--radius-md);
      padding: 12px;
      min-width: 180px;
      box-shadow: 0 25px 50px -8px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(160, 200, 255, 0.08) inset;
      display: none;
      z-index: 20;
      flex-direction: column;
      gap: 8px;
    }
    .col-dropdown.show { display: flex; }
    .col-item { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--text-primary); }
    .col-item.histOnly { display: none; }
    body.ptracks24h .col-item.histOnly { display: flex; }
    .col-item input { accent-color: var(--accent-cyan); }
    .col-reset {
      margin-top: 8px;
      text-align: center;
      font-size: 0.72rem;
      color: var(--accent-cyan);
      cursor: pointer;
      text-decoration: underline dotted;
    }

    .chips {
      display: flex; gap: 8px; flex-wrap: wrap;
      padding: 12px 18px;
      border-bottom: 1px solid var(--border-light);
    }
    .chip {
      padding: 6px 14px;
      border-radius: 999px;
      border: 1px solid var(--border-light);
      background: rgba(128,128,128,0.1);
      color: var(--text-soft);
      font-size: 0.78rem;
      font-weight: 650;
      cursor: pointer;
      backdrop-filter: blur(2px);
      transition: var(--transition-micro);
    }
    .chip:hover { background: rgba(100,160,255,0.2); border-color: var(--accent-cyan); }

    /* Filter chips coloured by mode */
    .chip[data-chip="ADSB"]  { border-color: #2a5363; color: rgba(226,232,240,0.92); }
    .chip[data-chip="MLAT"]  { border-color: #ffb347; color: rgba(226,232,240,0.92); }
    .chip[data-chip="ModeS"] { border-color: #1e3a8a; color: rgba(226,232,240,0.92); }
    .chip[data-chip="ModeA"] { border-color: #ef4444; color: rgba(226,232,240,0.92); }
    .chip[data-chip="ModeC"] { border-color: #22c55e; color: rgba(226,232,240,0.92); }
    .chip[data-chip="Other"] { border-color: rgba(148,163,184,0.6); color: rgba(226,232,240,0.92); }

    .chip.on { color: var(--text-primary); }
    .chip.on[data-chip="ADSB"]  { background: rgba(42, 83, 99, 0.28); box-shadow: 0 0 8px rgba(42,83,99,0.22); }
    .chip.on[data-chip="MLAT"]  { background: rgba(255, 200, 80, 0.25); box-shadow: 0 0 8px rgba(255,179,71,0.22); }
    .chip.on[data-chip="ModeS"] { background: rgba(30, 58, 138, 0.22); box-shadow: 0 0 8px rgba(30,58,138,0.22); }
    .chip.on[data-chip="ModeA"] { background: rgba(239, 68, 68, 0.20); box-shadow: 0 0 8px rgba(239,68,68,0.18); }
    .chip.on[data-chip="ModeC"] { background: rgba(34, 197, 94, 0.20); box-shadow: 0 0 8px rgba(34,197,94,0.18); }
    .chip.on[data-chip="Other"] { background: rgba(148,163,184,0.14); box-shadow: 0 0 8px rgba(148,163,184,0.10); }

    /* Coverage reset button appears only when coverage overlay is enabled */
    /* Coverage reset should always be visible; it becomes meaningful once
       coverage points exist / coverage overlay is toggled on. */
    #btnCoverageReset { display: inline-flex; }

    .subLine {
      padding: 10px 18px;
      display: flex; justify-content: space-between;
      font-size: 0.72rem;
      color: var(--text-muted);
      border-bottom: 1px solid var(--border-light);
      font-weight: 600;
    }

    #listWrap { overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }
    table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
    thead th {
      position: sticky; top: 0; z-index: 2;
      text-align: left; font-weight: 800;
      padding: 12px 8px 8px 12px;
      background: var(--panel-base);
      backdrop-filter: blur(10px);
      color: var(--accent-cyan);
      font-size: 0.7rem;
      letter-spacing: 0.05em;
      text-transform: uppercase;
      border-bottom: 1px solid var(--border-light);
    }

    /* Click-to-sort headers */
    thead th.sortable{ cursor:pointer; user-select:none; }
    thead th.sortable:hover{ color:#bff3ff; }
    thead th.sortable.on{ text-shadow: 0 0 14px rgba(56,189,248,0.35); }
    tbody td {
      padding: 10px 8px 10px 12px;
      border-bottom: 1px solid var(--border-light);
      white-space: nowrap;
      color: var(--text-soft);
      font-weight: 600;
    }

    /* Prevent the mode strip from visually touching the first character */
    thead th:first-child{ padding-left: 18px; }
    tbody td:first-child{ padding-left: 18px; }
    tbody tr { background: rgba(128,128,128,0.02); cursor: pointer; position: relative; }
    tbody tr:nth-child(2n){ background: rgba(255,255,255,0.015); }
    tbody tr:hover {
      background: rgba(100,160,255,0.15);
      box-shadow:
        inset 12px 0 0 var(--mode-color, transparent),
        inset 13px 0 0 rgba(255,255,255,0.08),
        0 0 18px var(--mode-glow, rgba(56,189,248,0.24)),
        0 0 0 1px rgba(108,212,255,0.25) inset;
    }
    tbody tr.sel {
      background: rgba(0, 140, 255, 0.2);
      outline: 1px solid var(--accent-cyan);
      outline-offset: -1px;
      box-shadow:
        inset 12px 0 0 var(--mode-color, transparent),
        inset 13px 0 0 rgba(255,255,255,0.08),
        0 0 22px var(--mode-glow, rgba(56,189,248,0.24));
    }

    /* Mode colour bar (replaces the need for a Modes column)
       Implemented as an inset shadow (not a ::before pseudo-element) to avoid
       any browser-specific table layout quirks that can look like column shifts. */
    tbody tr {
      /* existing properties also apply; this adds the mode strip + glow */
      box-shadow:
        inset 12px 0 0 var(--mode-color, transparent),
        inset 13px 0 0 rgba(255,255,255,0.08),
        0 0 18px var(--mode-glow, rgba(56,189,248,0.24));
    }
    /* Brighter, more distinct swatches for fast scanning */
    tbody tr.mode-a { --mode-color: #ff3344; --mode-glow: rgba(255,51,68,0.35); }
    tbody tr.mode-c { --mode-color: #22c55e; --mode-glow: rgba(34,197,94,0.30); }
    tbody tr.mode-s { --mode-color: #3b82f6; --mode-glow: rgba(59,130,246,0.30); }
    tbody tr.mode-b { --mode-color: #06b6d4; --mode-glow: rgba(6,182,212,0.30); }
    tbody tr.mode-mlat { --mode-color: #f59e0b; --mode-glow: rgba(245,158,11,0.32); }
    tbody tr.mode-other { --mode-color: rgba(148,163,184,0.65); --mode-glow: rgba(148,163,184,0.18); }

    .mono { font-family: 'SF Mono', 'Fira Code', ui-monospace, monospace; color: var(--text-soft); }

    .badgeCell { display: flex; gap: 6px; flex-wrap: wrap; }
    .b {
      font-size: 0.66rem; font-weight: 850;
      padding: 3px 9px;
      border-radius: 999px;
      border: 1px solid var(--border-light);
      background: rgba(128,128,128,0.1);
      color: var(--text-primary);
    }
    /* Legacy badge styles (kept for compatibility with older UI parts) */
    .b.adsb { background: rgba(42, 83, 99, 0.28); border-color: #2a5363; } /* ADS-B */
    .b.mlat { background: rgba(255, 200, 80, 0.25); border-color: #ffb347; } /* MLAT */
    .b.emg { background: rgba(255, 80, 100, 0.3); border-color: #ff5e6b; }


/* 24h snapshot mode pills: (S) (A) (C) (B) (MLAT) */
.modes { display: flex; gap: 6px; flex-wrap: wrap; }
.m {
  font-size: 0.66rem; font-weight: 850;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-light);
  background: rgba(128,128,128,0.10);
  color: var(--text-primary);
  opacity: 0.22;
  filter: saturate(0.6);
}
.m.on {
  opacity: 1;
  filter: none;
  box-shadow: 0 0 10px rgba(56,189,248,0.12);
}
.m.a { background: rgba(239, 68, 68, 0.18); border-color: #ef4444; }   /* Mode-A (distinct from MLAT) */
.m.c { background: rgba(34, 197, 94, 0.20); border-color: #22c55e; }   /* Mode-C */
.m.s { background: rgba(30, 58, 138, 0.20); border-color: #1e3a8a; }   /* Mode-S (dark blue) */
.m.b { background: rgba(42, 83, 99, 0.22); border-color: #2a5363; }    /* ADS-B (match swatch) */
.m.mlat { background: rgba(255, 200, 80, 0.20); border-color: #ffb347; } /* MLAT */

    .vr {
      display: inline-block;
      font-weight: 900;
      margin-left: 6px;
      line-height: 1;
      transform: translateY(-0.5px);
    }
    .vr.up { color: #58d68d; text-shadow: 0 0 10px rgba(88,214,141,0.18); }
    .vr.down { color: #ff5e6b; text-shadow: 0 0 10px rgba(255,94,107,0.18); }
    .vr.lvl { color: var(--text-soft); }

    #inspector {
      position: absolute; left: 16px; bottom: 16px; z-index: 9;
      width: min(760px, calc(100vw - 32px - 480px));
      min-width: 380px;
      background: var(--panel-base);
      backdrop-filter: var(--backdrop-blur);
      border: 1px solid var(--border-light);
      border-radius: var(--radius-xl);
      box-shadow: 0 25px 50px -8px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(160, 200, 255, 0.08) inset;
      overflow: hidden;
      color: var(--text-primary);
      display: none;
    }

    #insHeader {
      padding: 16px 20px;
      border-bottom: 1px solid var(--border-light);
      display: flex; align-items: center; justify-content: space-between;
    }
    .callsignBig {
      font-weight: 900; font-size: 1.35rem; letter-spacing: -0.02em;
      background: linear-gradient(140deg, var(--text-primary), var(--accent-cyan));
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
    }
    .subId { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; font-weight: 600; }

    .links { display: flex; gap: 8px; }
    .linkBtn {
      padding: 7px 14px;
      border-radius: 999px;
      border: 1px solid var(--border-light);
      background: rgba(128,128,128,0.1);
      color: var(--text-soft);
      text-decoration: none;
      font-size: 0.75rem;
      font-weight: 750;
      transition: var(--transition-micro);
      white-space: nowrap;
    }
    .linkBtn:hover { background: rgba(100,160,255,0.2); border-color: var(--accent-cyan); }

    #insBody { display: grid; grid-template-columns: 200px 1fr; gap: 16px; padding: 16px; }

    .photo {
      border-radius: var(--radius-lg);
      border: 1px solid var(--border-light);
      background: rgba(0, 0, 0, 0.2);
      overflow: hidden;
      height: 140px;
      position: relative;
    }
    .photo img {
      position: absolute; inset: 0;
      width: 100%; height: 100%;
      object-fit: cover;
      display: none;
    }
    .photo .phTxt {
      position: absolute; inset: 0;
      display: flex; align-items: center; justify-content: center;
      color: var(--text-muted); font-size: 0.72rem; padding: 16px; text-align: center;
      font-weight: 650;
    }
    .photo .phCredit {
      position: absolute; left: 10px; right: 10px; bottom: 8px;
      font-size: 0.62rem; color: white; text-shadow: 0 1px 4px black; display: none;
      background: rgba(0,0,0,0.55); padding: 4px 9px; border-radius: 999px;
      backdrop-filter: blur(6px);
      overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
      font-weight: 650;
    }
    .photo .phCredit a{ color: white; }

    .kvGrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
    .kv { padding: 12px 10px; border-radius: var(--radius-md); border: 1px solid var(--border-light); background: rgba(128,128,128,0.05); }
    .kv .k { font-size: 0.62rem; color: var(--text-muted); text-transform: uppercase; font-weight: 800; letter-spacing: 0.05em; }
    .kv .v { margin-top: 6px; font-size: 1rem; font-weight: 900; color: var(--text-primary); }
    .kvWide { grid-column: span 2; }

    .maplibregl-ctrl-group {
      border-radius: 999px !important;
      overflow: hidden;
      border: 1px solid var(--border-light) !important;
      background: var(--panel-base) !important;
      backdrop-filter: blur(10px) !important;
      box-shadow: var(--shadow-float) !important;
    }
    .maplibregl-control-container .maplibregl-ctrl-top-right { margin-top: 100px; margin-right: 18px; }

    @media (max-width: 980px) {
      #rightDock { width: 400px; }
      #inspector { width: calc(100vw - 32px); max-width: none; }
    }
    @media (max-width: 820px) {
      #rightDock { left: 16px; right: 16px; top: auto; bottom: 16px; height: 360px; width: auto; }
      #inspector { display: none; }
    }

    /* =========================
       MOBILE: smoother + less rough
       ========================= */

    @media (max-width: 720px) {
      #topbar{
        left: 10px; right: 10px;
        top: calc(10px + var(--safe-top));
        padding: 10px 12px;
        gap: 10px;
        border-radius: 22px;
        overflow: hidden;
        transition: max-height 220ms cubic-bezier(0.2,0,0,1), opacity 200ms;
        max-height: 220px;
      }
      #topbar.collapsed{
        max-height: 64px;
      }
      #topbar.collapsed .search,
      #topbar.collapsed .kpiRow{
        display: none;
      }

      #topbar::before{
        content:"";
        display:none;
      }
      #topbar.collapsed::before{
        display:block;
        width: 44px;
        height: 4px;
        border-radius: 999px;
        margin: 0 auto 10px auto;
        background: rgba(255,255,255,0.18);
        border: 1px solid rgba(255,255,255,0.08);
      }
      body.light-theme #topbar.collapsed::before{
        background: rgba(0,0,0,0.18);
        border-color: rgba(0,0,0,0.08);
      }

      .brand .t{ font-size: 0.98rem; }
      .brand .s{ max-width: 100%; }

      .search{ order: 3; flex: 1 1 100%; min-width: 0; }
      .search input{ width: 100%; padding: 12px 14px; font-size: 0.95rem; }

      .kpiRow{ order: 4; width: 100%; gap: 8px; flex-wrap: wrap; overflow-x: visible; overflow-y: visible; }

      .btn, select{
        padding: 10px 12px;
        font-size: 0.88rem;
        border-radius: 999px;
      }

      .maplibregl-control-container .maplibregl-ctrl-top-right{
        margin-top: calc(92px + var(--safe-top));
        margin-right: 10px;
      }

      /* bottom-sheet dock */
      #rightDock{
        left: 10px;
        right: 10px;
        top: auto;
        bottom: calc(10px + var(--safe-bottom));
        width: auto;
        height: min(62vh, 520px);
        border-radius: 22px;
        overflow: hidden;
        transition: height 220ms cubic-bezier(0.2, 0, 0, 1);
      }
      #rightDock.collapsed{
        height: var(--dock-collapsed);
      }

      #rightHeader{
        padding: 12px 14px 10px;
      }
      #rightHeader::before{
        content:"";
        display:block;
        width: 44px;
        height: 4px;
        border-radius: 999px;
        margin: 0 auto 10px auto;
        background: rgba(255,255,255,0.18);
        border: 1px solid rgba(255,255,255,0.08);
      }
      body.light-theme #rightHeader::before{
        background: rgba(0,0,0,0.18);
        border-color: rgba(0,0,0,0.08);
      }

      #rightDock.collapsed .chips,
      #rightDock.collapsed .ring-controls,
      #rightDock.collapsed .subLine,
      #rightDock.collapsed #listWrap{
        display: none;
      }

      #inspector{ display:none !important; }

      /* mobile aircraft card (NEW, polished) */
      #mobileCard{
        position: absolute;
        left: 10px;
        right: 10px;
        z-index: 11;
        /* sits above dock */
        bottom: calc(10px + var(--safe-bottom) + var(--dock-collapsed) + 10px);
        background: var(--panel-base);
        border: 1px solid var(--border-light);
        border-radius: 20px;
        box-shadow: var(--shadow-panel);
        backdrop-filter: var(--backdrop-blur);
        overflow: hidden;
        display: none;
        pointer-events: auto;
        transform: translateY(16px);
        opacity: 0;
        transition: transform 180ms cubic-bezier(0.2,0,0,1), opacity 180ms;
      }
      #mobileCard.show{
        display:block;
        transform: translateY(0);
        opacity: 1;
      }

      #mobileCard .mcHead{
        padding: 12px 14px 10px;
        display:flex;
        align-items:flex-start;
        justify-content: space-between;
        gap: 10px;
        border-bottom: 1px solid var(--border-light);
      }
      #mobileCard .mcTitle{
        display:flex;
        flex-direction:column;
        gap: 2px;
        min-width: 0;
      }
      #mobileCard .mcCall{
        font-weight: 950;
        font-size: 1.08rem;
        letter-spacing: -0.02em;
        background: linear-gradient(140deg, var(--text-primary), var(--accent-cyan));
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      #mobileCard .mcSub{
        font-size: 0.72rem;
        color: var(--text-muted);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-weight: 650;
      }
      #mobileCard .mcX{
        border: 1px solid var(--border-light);
        background: rgba(128,128,128,0.1);
        color: var(--text-primary);
        border-radius: 999px;
        padding: 7px 10px;
        font-size: 0.9rem;
        cursor: pointer;
        line-height: 1;
        font-weight: 900;
      }

      #mobileCard .mcMain{
        display:grid;
        grid-template-columns: 96px 1fr;
        gap: 10px;
        padding: 10px 12px 12px;
      }

      .mcPhoto{
        border-radius: 16px;
        border: 1px solid var(--border-light);
        background: rgba(0,0,0,0.18);
        overflow:hidden;
        height: 96px;
        position: relative;
      }
      .mcPhoto img{
        position:absolute; inset:0;
        width:100%; height:100%;
        object-fit: cover;
        display:none;
      }
      .mcPhoto .mcPhTxt{
        position:absolute; inset:0;
        display:flex;
        align-items:center;
        justify-content:center;
        padding: 10px;
        text-align:center;
        color: var(--text-muted);
        font-size: 0.7rem;
        font-weight: 750;
      }
      .mcPhoto .mcPhCredit{
        position:absolute;
        left: 8px; right: 8px; bottom: 8px;
        border-radius: 999px;
        padding: 3px 8px;
        font-size: 0.58rem;
        background: rgba(0,0,0,0.55);
        color: #fff;
        display:none;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        backdrop-filter: blur(6px);
        font-weight: 650;
      }
      .mcPhoto .mcPhCredit a{ color:#fff; }

      .mcKvs{
        display:grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        align-content:start;
      }
      .mcKv{
        border: 1px solid var(--border-light);
        background: rgba(128,128,128,0.05);
        border-radius: 14px;
        padding: 8px 10px;
      }
      .mcKv .k{
        font-size: 0.6rem;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.06em;
        font-weight: 900;
      }
      .mcKv .v{
        margin-top: 5px;
        font-weight: 950;
        color: var(--text-primary);
        font-size: 0.9rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      #mobileCard .mcLinks{
        padding: 10px 12px 12px;
        display:flex;
        gap: 8px;
        flex-wrap: wrap;
        border-top: 1px solid var(--border-light);
      }
      #mobileCard .mcLink{
        text-decoration: none;
        padding: 9px 12px;
        border-radius: 999px;
        border: 1px solid var(--border-light);
        background: rgba(128,128,128,0.1);
        color: var(--text-soft);
        font-size: 0.78rem;
        font-weight: 850;
      }

      /* keep desktop layout uncluttered */
      table{ font-size: 0.82rem; }
    }

    @media (max-width: 420px){
      .brand .s{ display:none; }
      .kpi{ padding: 4px 10px; font-size: 0.75rem; }
      @media (max-width: 720px){
        .mcKvs{ grid-template-columns: repeat(2, 1fr); }
      }
    }
  


    /* Changelog popup */
    .changelog-card{
      width: min(720px, 92vw);
      max-height: 82vh;
      overflow: hidden;
    }
    .changelog-body{
      margin-top: 12px;
      overflow: auto;
      max-height: calc(82vh - 120px);
      padding-right: 6px;
    }
    .cl-section{ margin: 14px 0; }
    .cl-h{
      font-weight: 700;
      margin: 10px 0 8px;
    }
    .changelog-body ul{
      margin: 0;
      padding-left: 18px;
      line-height: 1.35;
    }
    .changelog-body li{ margin: 7px 0; }
    .cl-foot{
      font-size: 0.9rem;
      color: var(--text-muted);
    }


/* Changelog tags */
.cl-subhead{
  margin-top: 12px;
  margin-bottom: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text, #e7eefc);
}
.cl-dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.06);
}
.cl-dot.new{ background: #26d07c; }
.cl-dot.improved{ background: #f5c84c; }

.cl-tag{
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.2px;
  margin-right: 8px;
  vertical-align: middle;
  border: 1px solid rgba(255,255,255,0.12);
}
.cl-tag.new{
  background: rgba(38,208,124,0.15);
  color: #26d07c;
}
.cl-tag.improved{
  background: rgba(245,200,76,0.16);
  color: #f5c84c;
}

/* Ensure changelog lists remain clean */
.cl-section ul{
  margin-top: 6px;
}
