:root {
  color-scheme: dark;
  --bg: #03070d;
  --panel: rgba(8, 17, 28, 0.82);
  --panel-line: rgba(136, 191, 217, 0.17);
  --text: #eef8fb;
  --muted: #718796;
  --cyan: #56e8ff;
  --teal: #43f1c4;
  --amber: #ffc75a;
  --red: #ff647c;
  --font-display: "Arial Narrow", "Roboto Condensed", Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: var(--bg); }
body { color: var(--text); font-family: var(--font-display); letter-spacing: 0.02em; }
button, input { font: inherit; }
button { color: inherit; }

.app-shell { position: relative; width: 100%; height: 100%; min-height: 650px; overflow: hidden; background: radial-gradient(circle at 53% 48%, #102136 0, #050b13 42%, #020509 76%); }
#globe { position: absolute; inset: 0; }
#globe canvas { outline: none; }
.ambient-grid { position: absolute; inset: 0; pointer-events: none; opacity: .26; background-image: linear-gradient(rgba(63, 134, 158, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(63, 134, 158, .06) 1px, transparent 1px); background-size: 58px 58px; mask-image: radial-gradient(circle at center, transparent 20%, black 85%); }

.panel { border: 1px solid var(--panel-line); background: linear-gradient(145deg, rgba(12, 25, 39, .9), rgba(4, 11, 19, .76)); box-shadow: 0 24px 80px rgba(0, 0, 0, .28), inset 0 1px rgba(255, 255, 255, .025); backdrop-filter: blur(18px); }
.topbar { position: absolute; top: 18px; left: 18px; right: 18px; height: 66px; padding: 0 22px; display: flex; align-items: center; justify-content: space-between; }
.brand { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 13px; }
.brand-mark { width: 34px; height: 34px; position: relative; display: block; border: 1px solid rgba(86, 232, 255, .38); transform: rotate(45deg); }
.brand-mark::before, .brand-mark::after, .brand-mark i { content: ""; position: absolute; inset: 7px; border: 1px solid var(--cyan); }
.brand-mark::after { inset: 12px; background: var(--cyan); box-shadow: 0 0 16px var(--cyan); }
.brand-mark i:first-child { inset: -4px 15px; border-width: 0 1px; }
.brand-mark i:last-child { inset: 15px -4px; border-width: 1px 0; }
.brand > span:last-child { display: flex; flex-direction: column; }
.brand strong { font-size: 19px; letter-spacing: .24em; }
.brand small { color: var(--muted); font: 9px var(--font-mono); letter-spacing: .19em; margin-top: 3px; }
.topbar-meta { display: flex; align-items: center; gap: 24px; color: #94a9b6; font: 11px var(--font-mono); letter-spacing: .11em; }
.experiments-link { padding: 8px 10px; border: 1px solid var(--panel-line); color: #94a9b6; text-decoration: none; }
.experiments-link:hover { border-color: var(--cyan); color: var(--cyan); }
.mobile-filter-button, .mobile-close, .mobile-detail-toggle { display: none; }
.status-pill { display: flex; align-items: center; gap: 8px; }
.status-pill i { width: 7px; height: 7px; display: inline-block; border-radius: 50%; background: #60717e; box-shadow: 0 0 8px #60717e; }
.status-pill i.live { background: var(--teal); box-shadow: 0 0 9px var(--teal); }

.left-rail, .right-rail { position: absolute; top: 102px; bottom: 82px; width: 284px; display: flex; flex-direction: column; gap: 12px; pointer-events: none; }
.left-rail { left: 18px; }
.right-rail { right: 18px; }
.left-rail > *, .right-rail > * { pointer-events: auto; }
.control-panel, .filter-panel, .metrics-panel, .aircraft-card { padding: 22px; }
.eyebrow { margin: 0 0 12px; color: var(--cyan); font: 10px var(--font-mono); letter-spacing: .18em; }
h1 { margin: 0; font-size: 42px; line-height: .95; letter-spacing: -.035em; text-transform: uppercase; }
h1 span { color: transparent; -webkit-text-stroke: 1px rgba(238, 248, 251, .48); }
.lede { color: #7e929f; font-size: 13px; line-height: 1.55; margin: 18px 0; }
.refresh-button { width: 100%; min-height: 58px; border: 1px solid rgba(86, 232, 255, .4); background: rgba(27, 171, 196, .11); display: flex; align-items: center; gap: 13px; padding: 10px 14px; text-align: left; cursor: pointer; transition: .2s ease; }
.refresh-button:hover { background: rgba(52, 208, 232, .19); border-color: var(--cyan); box-shadow: 0 0 30px rgba(86, 232, 255, .08); }
.refresh-button:disabled { opacity: .5; cursor: wait; }
.button-icon { color: var(--cyan); font-size: 25px; }
.refresh-button.loading .button-icon { animation: spin 1s linear infinite; }
.refresh-button strong, .refresh-button small { display: block; }
.refresh-button strong { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.refresh-button small { color: var(--muted); font: 9px var(--font-mono); margin-top: 4px; }
.manual-note { color: #718591; font: 9px var(--font-mono); text-align: center; letter-spacing: .08em; margin: 12px 0 0; }
.manual-note i { display: inline-block; width: 5px; height: 5px; margin-right: 5px; background: var(--amber); border-radius: 50%; }

.section-heading { display: flex; align-items: center; justify-content: space-between; color: #8ba0ad; font: 9px var(--font-mono); letter-spacing: .16em; margin-bottom: 14px; }
.section-heading button { border: 0; background: none; color: #5e7482; font: 9px var(--font-mono); cursor: pointer; }
.search-box { height: 39px; display: flex; align-items: center; gap: 9px; padding: 0 11px; border: 1px solid rgba(122, 165, 184, .15); background: rgba(0, 0, 0, .2); }
.search-box span { color: var(--cyan); }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--text); background: transparent; font: 10px var(--font-mono); }
.search-box input::placeholder { color: #526875; }
.filter-row { display: flex; gap: 6px; margin: 12px 0 17px; }
.filter-chip { flex: 1; padding: 8px 3px; border: 1px solid rgba(122, 165, 184, .15); background: transparent; color: #69808e; font: 8px var(--font-mono); cursor: pointer; }
.filter-chip.active { color: var(--cyan); border-color: rgba(86, 232, 255, .42); background: rgba(86, 232, 255, .08); }
.range-label { display: flex; justify-content: space-between; color: #657c89; font: 8px var(--font-mono); letter-spacing: .12em; }
.range-label strong { color: #aec0c9; font-weight: 400; }
input[type="range"] { width: 100%; height: 3px; margin-top: 12px; accent-color: var(--cyan); }

.metric-primary { border-bottom: 1px solid rgba(125, 169, 188, .12); padding-bottom: 15px; margin-bottom: 15px; }
.metric-primary strong { display: block; font: 42px var(--font-mono); letter-spacing: -.08em; }
.metric-primary span, .metric-grid span { display: block; color: #617683; font: 8px var(--font-mono); letter-spacing: .15em; }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 19px 14px; }
.metric-grid strong { display: block; font: 17px var(--font-mono); color: #ccdae0; margin-bottom: 4px; }
.aircraft-card { min-height: 258px; }
.aircraft-card.empty { opacity: .68; }
.signal-bars { color: var(--teal); letter-spacing: 2px; }
.empty-detail { min-height: 175px; display: grid; place-items: center; color: #5f7481; font: 10px/1.6 var(--font-mono); text-align: center; padding: 20px; }
.empty-detail[hidden], #aircraft-detail[hidden] { display: none; }
.aircraft-title { margin: 4px 0 17px; }
.aircraft-title strong { display: block; font: 27px var(--font-mono); color: var(--cyan); }
.aircraft-title span { color: #7a909c; font-size: 11px; }
dl { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
dl div { border-left: 1px solid rgba(86, 232, 255, .18); padding-left: 8px; }
dt { color: #586d7a; font: 8px var(--font-mono); letter-spacing: .12em; }
dd { margin: 4px 0 0; color: #c9d8de; font: 11px var(--font-mono); }

.bottom-bar { position: absolute; height: 56px; left: 18px; right: 18px; bottom: 14px; display: flex; align-items: center; gap: 27px; padding: 0 20px; }
.bottom-bar > div { white-space: nowrap; }
.bottom-bar span { display: block; color: #526875; font: 7px var(--font-mono); letter-spacing: .15em; }
.bottom-bar strong { display: block; color: #9bb0bb; font: 9px var(--font-mono); margin-top: 4px; font-weight: 400; }
.quota-track { position: relative; width: 120px; height: 3px; background: #1c303b; overflow: hidden; }
.quota-track i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.legend { display: flex; gap: 13px; margin-left: auto; }
.legend span { display: flex; flex-direction: row; align-items: center; gap: 5px; }
.legend i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; }
.legend .low { background: var(--teal); }.legend .mid { background: var(--cyan); }.legend .high { background: var(--amber); }
.attribution { color: #526875; font: 8px var(--font-mono); letter-spacing: .13em; }

.welcome { position: absolute; left: 50%; top: 50%; width: 340px; transform: translate(-50%, -44%); padding: 28px; text-align: center; transition: opacity .3s, transform .3s; }
.welcome.hidden { opacity: 0; pointer-events: none; transform: translate(-50%, -40%); }
.welcome-orbit { position: relative; display: block; width: 58px; height: 58px; margin: 0 auto 22px; border: 1px solid rgba(86, 232, 255, .35); border-radius: 50%; box-shadow: inset 0 0 25px rgba(86, 232, 255, .06); }
.welcome-orbit::before { content: ""; position: absolute; width: 76px; height: 24px; border: 1px solid var(--cyan); border-radius: 50%; left: -10px; top: 16px; transform: rotate(-22deg); }
.welcome-orbit::after { content: ""; position: absolute; width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 12px var(--cyan); right: -3px; top: 22px; }
.welcome h2 { margin: 0; font-size: 27px; text-transform: uppercase; }
.welcome > p:not(.eyebrow) { color: #768b97; font-size: 12px; line-height: 1.6; }
.welcome button { border: 1px solid var(--cyan); padding: 11px 22px; background: rgba(86, 232, 255, .1); color: var(--cyan); font: 10px var(--font-mono); letter-spacing: .14em; cursor: pointer; }
.toast { position: absolute; left: 50%; bottom: 88px; transform: translate(-50%, 18px); min-width: 260px; max-width: 520px; padding: 12px 18px; border: 1px solid rgba(255, 100, 124, .4); background: rgba(32, 8, 15, .92); color: #ffc2cc; text-align: center; font: 10px/1.5 var(--font-mono); opacity: 0; pointer-events: none; transition: .2s; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 980px) {
  .left-rail, .right-rail { width: 240px; }
  h1 { font-size: 33px; }
  .control-panel, .filter-panel, .metrics-panel, .aircraft-card { padding: 17px; }
  .legend { display: none; }
}
@media (max-width: 820px) {
  html, body { height: 100%; height: 100dvh; overflow: hidden; }
  .app-shell { min-height: 0; height: 100%; height: 100dvh; overflow: hidden; }
  .topbar { z-index: 5; left: 6px; right: 6px; top: 6px; height: 48px; padding: 0 11px; }
  .brand { gap: 8px; }
  .brand-mark { width: 22px; height: 22px; }
  .brand-mark::before { inset: 5px; }
  .brand-mark::after { inset: 8px; }
  .brand-mark i:first-child { inset: -3px 10px; }
  .brand-mark i:last-child { inset: 10px -3px; }
  .brand strong { font-size: 13px; letter-spacing: .18em; }
  .brand small { font-size: 7px; }
  .topbar-meta { gap: 0; }
  .topbar-meta .status-pill, .utc-clock { display: none; }
  .mobile-filter-button { display: block; border: 1px solid rgba(86, 232, 255, .35); background: rgba(86, 232, 255, .08); padding: 7px 8px; color: var(--cyan); font: 7px var(--font-mono); letter-spacing: .1em; }

  .left-rail { z-index: 3; left: 6px; top: 60px; bottom: auto; width: 153px; display: block; }
  .control-panel { padding: 8px; }
  .control-panel .eyebrow, .control-panel h1, .control-panel .lede { display: none; }
  .refresh-button { min-height: 39px; margin: 0; padding: 6px 8px; gap: 7px; }
  .button-icon { font-size: 17px; }
  .refresh-button strong { font-size: 8px; }
  .refresh-button small { font-size: 6px; margin-top: 2px; }
  .manual-note { display: none; }

  .filter-panel { display: block; position: fixed; z-index: 9; left: 8px; right: 8px; bottom: 54px; padding: 18px; transform: translateY(calc(100% + 80px)); opacity: 0; transition: transform .25s ease, opacity .25s ease; }
  .filter-panel.open { transform: translateY(0); opacity: 1; }
  .filter-actions { display: flex; gap: 12px; }
  .mobile-close { display: inline-block; border: 0; background: transparent; color: var(--cyan); font: 8px var(--font-mono); letter-spacing: .1em; }

  .right-rail { z-index: 2; right: 6px; left: auto; top: 60px; bottom: auto; width: 98px; display: block; }
  .metrics-panel { padding: 8px; }
  .metrics-panel .eyebrow { display: none; }
  .metric-primary { margin: 0; padding: 0; border: 0; }
  .metric-primary strong { font-size: 20px; }
  .metric-primary span { font-size: 6px; }
  .metric-grid { display: none; }

  .aircraft-card { display: none; position: fixed; z-index: 8; left: 6px; right: 6px; top: auto; bottom: 54px; width: auto; height: 84px; min-height: 0; max-height: 38dvh; padding: 13px 16px; overflow: hidden; transition: height .25s ease, background-color .25s ease; touch-action: pan-x; }
  .aircraft-card:not(.empty) { display: block; }
  .aircraft-card.expanded { height: min(310px, 38dvh); overflow-y: auto; }
  .aircraft-card .section-heading > span:last-child { display: flex; align-items: center; gap: 12px; }
  .aircraft-card .section-heading { margin-bottom: 6px; }
  .mobile-detail-toggle { display: inline-grid; place-items: center; width: 30px; height: 26px; padding: 0; border: 1px solid rgba(86, 232, 255, .4); background: rgba(86, 232, 255, .08); color: var(--cyan); font: 18px/1 var(--font-mono); cursor: pointer; }
  .empty-detail { min-height: 0; }
  .aircraft-title { margin: 0 0 13px; }
  .aircraft-title strong { font-size: 19px; }
  .aircraft-title span { display: none; }
  .aircraft-card:not(.expanded) dl { display: none; }
  .aircraft-card.expanded .aircraft-title span { display: block; }

  .bottom-bar { z-index: 6; left: 6px; right: 6px; top: calc(100dvh - 48px); bottom: auto; height: 42px; padding: 0 10px; gap: 14px; }
  .bottom-bar .attribution, .bottom-bar .legend, .quota-track { display: none; }
  .bottom-bar > div:nth-child(2) { margin-left: auto; text-align: right; }

  .welcome { z-index: 7; width: min(330px, calc(100% - 32px)); padding: 22px; }
  .welcome-orbit { width: 48px; height: 48px; margin-bottom: 17px; }
  .welcome-orbit::before { width: 66px; left: -10px; top: 11px; }
  .welcome h2 { font-size: 23px; }
  .toast { z-index: 12; bottom: 70px; min-width: 0; width: calc(100% - 24px); }
}

@media (max-width: 390px) {
  .brand small { display: none; }
  .left-rail { width: 145px; }
  .right-rail { width: 92px; }
}
