/* ============================================================
   APOGEE - Starship Flight Profiles
   SpaceX broadcast aesthetic: true black, thin white hairlines,
   clean uppercase type, deep-blue play accent, monochrome hub.
   ============================================================ */

:root {
  /* Space palette */
  --bg-0: #000000;
  --bg-1: #04060b;
  --bg-2: #080b12;
  --panel: rgba(6, 9, 14, 0.72);
  --panel-solid: #07090f;
  --panel-2: rgba(14, 18, 26, 0.7);
  --hairline: rgba(255, 255, 255, 0.14);
  --hairline-soft: rgba(255, 255, 255, 0.08);
  --hairline-strong: rgba(255, 255, 255, 0.28);
  --glass-blur: 20px;

  /* Text */
  --ink-0: #ffffff;
  --ink-1: #cdd3dd;
  --ink-2: #888f9c;
  --ink-3: #555c68;

  /* Deep space blue accent (play button, interactive) */
  --blue: #3b82f6;
  --blue-bright: #5b9dff;
  --blue-deep: #14306e;
  --blue-glow: rgba(59, 130, 246, 0.45);

  /* status */
  --good: #46d39e;
  --warn: #ffc24b;
  --bad: #ff5a5a;
  --partial: #ffc24b;

  /* path channels (overridden per flight) */
  --ship: #6cb6ff;
  --booster: #ff9f6b;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 22px;

  --topbar-h: 58px;
  --playbar-h: 80px;
  --list-w: 312px;
  --insp-w: 388px;

  --shadow-2: 0 8px 30px rgba(0,0,0,.5);
  --shadow-3: 0 24px 80px rgba(0,0,0,.7);

  --font: 'Saira', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: 'Saira', ui-monospace, 'SF Mono', Menlo, monospace;

  --ease: cubic-bezier(.22,.61,.36,1);
  --ease-out: cubic-bezier(.16,1,.3,1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: radial-gradient(130% 110% at 72% -10%, #060a14 0%, #000 60%);
  color: var(--ink-1);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  letter-spacing: 0.01em;
}
h1,h2,h3,h4 { margin: 0; color: var(--ink-0); font-weight: 600; letter-spacing: 0; }
button { font-family: inherit; color: inherit; cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
input, select { font-family: inherit; }
a { color: var(--blue-bright); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 8px; top: -50px; z-index: 100; background: var(--blue); color: #fff; padding: 8px 14px; border-radius: 8px; font-weight: 600; transition: top .2s var(--ease); }
.skip-link:focus { top: 8px; }
:focus-visible { outline: 2px solid var(--blue-bright); outline-offset: 2px; border-radius: 4px; }

.label, .uc { text-transform: uppercase; letter-spacing: .14em; }

/* ============================================================ APP GRID */
.app {
  display: grid; height: 100dvh;
  grid-template-columns: var(--list-w) 1fr var(--insp-w);
  grid-template-rows: var(--topbar-h) 1fr var(--playbar-h);
  grid-template-areas: "top top top" "list globe insp" "play play play";
  transition: grid-template-columns .42s var(--ease-out);
}
.app[data-list="closed"]   { grid-template-columns: 0 1fr var(--insp-w); }
.app[data-inspector="closed"] { grid-template-columns: var(--list-w) 1fr 0; }
.app[data-list="closed"][data-inspector="closed"] { grid-template-columns: 0 1fr 0; }

/* ============================================================ TOP BAR */
.topbar {
  grid-area: top; display: flex; align-items: center; gap: 12px; padding: 0 14px;
  background: linear-gradient(180deg, rgba(0,0,0,.94), rgba(0,0,0,.62));
  backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--hairline-soft); z-index: 30;
}
.topbar__left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar__center { flex: 1; display: flex; justify-content: center; min-width: 0; }
.topbar__right { display: flex; align-items: center; gap: 4px; }
.topbar__divider { width: 1px; height: 22px; background: var(--hairline); margin: 0 4px; }

.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; min-width: 0; }
.brand__mark { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 9px; background: rgba(255,255,255,.04); border: 1px solid var(--hairline); }
.brand__mark svg { width: 22px; height: 22px; stroke: #fff; stroke-width: 1.6; fill: none; }
.brand__mark circle { fill: #fff; stroke: none; }
.brand__text { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.brand__name { font-weight: 600; font-size: 16px; letter-spacing: .26em; color: var(--ink-0); }
.brand__sub { font-size: 9.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-2); }

.search { position: relative; width: min(420px, 44vw); display: flex; align-items: center; }
.search__icon { position: absolute; left: 12px; width: 15px; height: 15px; color: var(--ink-2); pointer-events: none; }
.search input {
  width: 100%; height: 36px; padding: 0 14px 0 35px; background: rgba(255,255,255,.04);
  border: 1px solid var(--hairline-soft); border-radius: 8px; color: var(--ink-0); font-size: 13px;
  letter-spacing: .02em; transition: border-color .2s, background .2s;
}
.search input::placeholder { color: var(--ink-3); text-transform: uppercase; letter-spacing: .1em; font-size: 11px; }
.search input:focus { background: rgba(255,255,255,.07); border-color: var(--hairline-strong); outline: none; }

.era-filters { display: flex; gap: 3px; }
.era-chip {
  font-size: 10.5px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase;
  padding: 6px 10px; border-radius: 6px; background: transparent; border: 1px solid transparent;
  color: var(--ink-2); transition: all .16s var(--ease);
}
.era-chip:hover { color: var(--ink-0); }
.era-chip.is-active { background: rgba(255,255,255,.08); border-color: var(--hairline); color: var(--ink-0); }

.iconbtn {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center;
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  color: var(--ink-2); transition: all .16s var(--ease);
}
.iconbtn:hover { background: rgba(255,255,255,.06); color: var(--ink-0); }
.iconbtn svg { width: 18px; height: 18px; }
.iconbtn[aria-pressed="true"] { color: var(--ink-0); background: rgba(255,255,255,.08); border-color: var(--hairline); }
.iconbtn--sm { width: 28px; height: 28px; }
.iconbtn--sm svg { width: 15px; height: 15px; }

.textbtn {
  height: 32px; padding: 0 12px; border-radius: 7px; background: transparent;
  border: 1px solid var(--hairline); color: var(--ink-1); font-size: 11.5px;
  font-weight: 600; text-transform: uppercase; letter-spacing: .1em; transition: all .16s var(--ease);
}
.textbtn:hover { color: #fff; border-color: var(--hairline-strong); background: rgba(255,255,255,.05); }

/* ============================================================ FLIGHT LIST */
.listpanel {
  grid-area: list; background: var(--panel); backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur)); border-right: 1px solid var(--hairline-soft);
  display: flex; flex-direction: column; min-width: 0; overflow: hidden; transition: opacity .3s var(--ease);
}
.app[data-list="closed"] .listpanel { opacity: 0; pointer-events: none; }
.listpanel__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px 10px 16px; }
.listpanel__head h2 { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-2); display: flex; align-items: center; gap: 8px; font-weight: 600; }
.count { font-size: 10px; font-weight: 600; color: var(--ink-0); background: rgba(255,255,255,.1); padding: 2px 7px; border-radius: 999px; letter-spacing: .04em; }
.listpanel__tools { display: flex; align-items: center; gap: 4px; }
#sortSelect { background: rgba(255,255,255,.04); border: 1px solid var(--hairline-soft); color: var(--ink-1); font-size: 11px; border-radius: 7px; padding: 5px 7px; text-transform: uppercase; letter-spacing: .06em; }
.listpanel__compareHint { margin: 0 14px 8px; padding: 8px 12px; border-radius: 8px; font-size: 11.5px; background: rgba(59,130,246,.12); border: 1px solid rgba(59,130,246,.3); color: #cfe0ff; }
.flightlist { list-style: none; margin: 0; padding: 4px 10px 24px; overflow-y: auto; flex: 1; }
.flightlist::-webkit-scrollbar { width: 7px; }
.flightlist::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 8px; }

.flightcard {
  --c: var(--blue); position: relative; display: block; width: 100%; text-align: left;
  margin: 6px 0; padding: 11px 13px 11px 15px; background: rgba(255,255,255,.018);
  border: 1px solid var(--hairline-soft); border-radius: var(--r-md); color: var(--ink-1);
  transition: background .16s, border-color .16s;
}
.flightcard::before { content: ""; position: absolute; left: 0; top: 11px; bottom: 11px; width: 2px; background: var(--c); }
.flightcard:hover { background: rgba(255,255,255,.05); border-color: var(--hairline); }
.flightcard.is-active { background: rgba(255,255,255,.07); border-color: var(--hairline-strong); }
.flightcard.is-compare { box-shadow: inset 0 0 0 1px var(--c); }
.flightcard__top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.flightcard__name { font-size: 13.5px; font-weight: 600; color: var(--ink-0); letter-spacing: .01em; }
.flightcard__date { font-size: 10.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; text-transform: uppercase; letter-spacing: .05em; }
.flightcard__meta { display: flex; align-items: center; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.chip { font-size: 10px; font-weight: 500; padding: 2px 7px; border-radius: 5px; background: rgba(255,255,255,.06); color: var(--ink-2); letter-spacing: .04em; }
.chip--era { text-transform: uppercase; letter-spacing: .08em; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 9.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .08em; }
.badge::before { content:""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge--success { color: var(--good); background: rgba(70,211,158,.1); }
.badge--partial { color: var(--partial); background: rgba(255,194,75,.12); }
.badge--failure { color: var(--bad); background: rgba(255,90,90,.12); }

/* ============================================================ GLOBE */
.globe { grid-area: globe; position: relative; overflow: hidden; background: var(--bg-0); }
.cesium-root { position: absolute; inset: 0; }
.cesium-viewer-bottom, .cesium-widget-credits, .cesium-viewer-toolbar, .cesium-viewer-animationContainer,
.cesium-viewer-timelineContainer, .cesium-viewer-fullscreenContainer { display: none !important; }
.cesium-widget canvas { outline: none; }

.skeleton { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; background: radial-gradient(60% 60% at 50% 45%, #060c16 0%, #000 80%); transition: opacity .5s var(--ease); }
.skeleton.is-hidden { opacity: 0; pointer-events: none; }
.skeleton__globe { width: 200px; height: 200px; border-radius: 50%; background: radial-gradient(40% 40% at 35% 30%, rgba(59,130,246,.22), transparent 70%), conic-gradient(from 0deg, rgba(255,255,255,.02), rgba(59,130,246,.1), rgba(255,255,255,.02)); box-shadow: inset 0 0 60px rgba(59,130,246,.18), 0 0 80px rgba(30,60,120,.25); animation: spin 9s linear infinite; }
.skeleton__text { position: absolute; bottom: 22%; display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.skeleton__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--blue-bright); animation: pulse 1.3s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: .3; transform: scale(.8);} 50% { opacity: 1; transform: scale(1.1);} }

.fallback { position: absolute; inset: 0; z-index: 18; display: flex; flex-direction: column; gap: 14px; padding: 30px; overflow: auto; background: var(--bg-0); }
.fallback__card { max-width: 460px; background: var(--panel-2); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: 22px; }
.fallback__card h3 { font-size: 18px; margin-bottom: 8px; }
.fallback__card p { font-size: 13px; color: var(--ink-2); line-height: 1.55; margin: 0 0 14px; }
.fallback__profile { flex: 1; min-height: 240px; border-radius: var(--r-lg); border: 1px solid var(--hairline-soft); background: var(--bg-1); }

.legend {
  position: absolute; left: 16px; bottom: 16px; z-index: 14; background: var(--panel);
  backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--hairline-soft); border-radius: var(--r-md); padding: 12px 14px; min-width: 162px; box-shadow: var(--shadow-2);
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.legend[hidden] { display: block; opacity: 0; transform: translateY(8px); pointer-events: none; }
.globe[data-hud="on"] .legend { bottom: 150px; }
.legend__title { font-size: 9px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 8px; }
.legend__title--sm { margin-top: 12px; }
.legend ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.legend li { display: flex; align-items: center; gap: 9px; font-size: 11px; color: var(--ink-1); }
.lk { width: 22px; height: 0; flex: none; }
.lk--ship-actual { border-top: 3px solid var(--ship); }
.lk--ship-planned { border-top: 2px dashed var(--ship); opacity: .7; }
.lk--booster-actual { border-top: 3px solid var(--booster); }
.lk--booster-planned { border-top: 2px dashed var(--booster); opacity: .7; }
.mk { width: 10px; height: 10px; flex: none; border-radius: 50%; border: 1.5px solid #fff; }
.mk--liftoff { background: #cfe0ff; } .mk--stage { background: #fff; } .mk--catch { background: var(--good); }
.mk--splash { background: var(--blue-bright); } .mk--rud { background: var(--bad); }

.hud { position: absolute; top: 16px; left: 16px; z-index: 14; background: var(--panel); backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur)); border: 1px solid var(--hairline-soft); border-radius: var(--r-md); padding: 10px 15px; box-shadow: var(--shadow-2); max-width: 320px; }
.hud__name { font-size: 13.5px; font-weight: 600; color: var(--ink-0); }
.hud__meta { font-size: 10.5px; color: var(--ink-2); margin-top: 3px; text-transform: uppercase; letter-spacing: .06em; }

.globetip { position: absolute; z-index: 40; pointer-events: none; background: rgba(0,0,0,.92); border: 1px solid var(--hairline); border-radius: 8px; padding: 9px 12px; max-width: 260px; box-shadow: var(--shadow-2); transform: translate(-50%, calc(-100% - 14px)); }
.globetip h4 { font-size: 12px; margin-bottom: 3px; text-transform: uppercase; letter-spacing: .05em; }
.globetip p { margin: 0; font-size: 11px; color: var(--ink-2); line-height: 1.45; }
.globetip .tip-met { color: var(--ink-0); font-variant-numeric: tabular-nums; font-size: 11px; letter-spacing: .05em; }

/* ============================================================ INSPECTOR */
.inspector {
  grid-area: insp; position: relative; background: var(--panel); backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur)); border-left: 1px solid var(--hairline-soft);
  display: flex; flex-direction: column; min-width: 0; overflow: hidden; transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.app[data-inspector="closed"] .inspector { opacity: 0; transform: translateX(20px); pointer-events: none; }
.inspector__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 16px 12px 12px 16px; border-bottom: 1px solid var(--hairline-soft); }
.inspector__heading { display: flex; gap: 11px; min-width: 0; }
.inspector__swatch { width: 10px; height: 10px; border-radius: 3px; margin-top: 6px; flex: none; }
.inspector__title { font-size: 16px; line-height: 1.15; font-weight: 600; }
.inspector__sub { font-size: 11px; color: var(--ink-2); margin-top: 3px; text-transform: uppercase; letter-spacing: .06em; }
.inspector__cta { padding: 12px 16px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--r-md); border: 1px solid var(--hairline); background: rgba(255,255,255,.04); color: var(--ink-0); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; transition: all .16s var(--ease); text-decoration: none; }
.btn svg { width: 17px; height: 17px; fill: currentColor; stroke: none; }
.btn:hover { background: rgba(255,255,255,.09); }
.btn--block { width: 100%; }
.btn--primary { background: linear-gradient(180deg, #3f86f7, #1a48b8); border-color: rgba(91,157,255,.5); color: #fff; box-shadow: 0 6px 22px var(--blue-glow); }
.btn--primary:hover { background: linear-gradient(180deg, #5a98f8, #2052cc); filter: brightness(1.08); }

.tabs { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--hairline-soft); }
.tab { position: relative; padding: 11px 11px; background: none; border: none; font-size: 11px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .1em; transition: color .16s; }
.tab:hover { color: var(--ink-0); }
.tab.is-active { color: var(--ink-0); }
.tab.is-active::after { content:""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; background: #fff; }
.inspector__body { flex: 1; overflow-y: auto; padding: 16px; }
.inspector__body::-webkit-scrollbar { width: 7px; }
.inspector__body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 8px; }
.tabpanel { animation: fade .3s var(--ease); }
.tabpanel[hidden] { display: none; }
@keyframes fade { from { opacity: 0; transform: translateY(6px);} to { opacity: 1; transform: none;} }

.summary { font-size: 13px; line-height: 1.6; color: var(--ink-1); margin: 0 0 16px; }
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.kv { background: rgba(255,255,255,.025); border: 1px solid var(--hairline-soft); border-radius: var(--r-sm); padding: 9px 11px; }
.kv__k { font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.kv__v { font-size: 12.5px; color: var(--ink-0); margin-top: 3px; font-weight: 500; }
.kv__v.mono { font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.section-h { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); margin: 18px 0 9px; display: flex; align-items: center; gap: 8px; }
.section-h::after { content:""; flex: 1; height: 1px; background: var(--hairline-soft); }
.firsts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.first-chip { font-size: 10.5px; font-weight: 500; padding: 4px 9px; border-radius: 999px; background: rgba(255,255,255,.05); color: var(--ink-1); border: 1px solid var(--hairline-soft); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 10px; color: var(--ink-2); background: rgba(255,255,255,.05); padding: 3px 8px; border-radius: 5px; text-transform: uppercase; letter-spacing: .04em; }

.timeline { position: relative; margin: 4px 0 8px; padding-left: 4px; }
.tl-item { position: relative; display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding: 9px 0 9px 18px; border-left: 1px solid var(--hairline-soft); cursor: pointer; transition: border-color .16s; }
.tl-item:hover { border-color: var(--hairline-strong); }
.tl-item::before { content:""; position: absolute; left: -5px; top: 13px; width: 9px; height: 9px; border-radius: 50%; background: var(--bg-2); border: 2px solid var(--c, #fff); }
.tl-item.is-rud::before { border-color: var(--bad); background: rgba(255,90,90,.25); }
.tl-item.is-current::before { box-shadow: 0 0 0 4px rgba(255,255,255,.18); }
.tl-met { font-variant-numeric: tabular-nums; font-size: 11px; color: var(--ink-0); padding-top: 2px; letter-spacing: .03em; }
.tl-body h5 { font-size: 12.5px; color: var(--ink-0); font-weight: 600; }
.tl-body p { margin: 3px 0 0; font-size: 11px; color: var(--ink-2); line-height: 1.45; }
.tl-vehicle { font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-left: 6px; }

.sources-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.source-item a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: rgba(255,255,255,.025); border: 1px solid var(--hairline-soft); border-radius: var(--r-sm); text-decoration: none; color: var(--ink-1); font-size: 12px; transition: all .16s; }
.source-item a:hover { background: rgba(255,255,255,.06); color: var(--ink-0); }
.source-type { font-size: 8.5px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; padding: 2px 6px; border-radius: 5px; background: rgba(255,255,255,.1); color: var(--ink-1); flex: none; }
.source-item svg { width: 14px; height: 14px; margin-left: auto; color: var(--ink-3); }

.confidence { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; color: var(--ink-2); margin-top: 12px; padding: 8px 11px; border-radius: var(--r-sm); background: rgba(255,255,255,.025); border: 1px solid var(--hairline-soft); }
.conf-dots { display: inline-flex; gap: 3px; }
.conf-dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.18); }
.conf-dot.on { background: var(--good); }
.conf--medium .conf-dot.on { background: var(--warn); }
.conf--low .conf-dot.on { background: var(--bad); }
.est-note { font-size: 10.5px; color: var(--ink-2); line-height: 1.5; margin-top: 10px; padding: 9px 11px; border-radius: var(--r-sm); border: 1px dashed var(--hairline); background: rgba(255,255,255,.02); }

.profilechart { width: 100%; height: 180px; margin: 6px 0 14px; overflow: visible; }
.profile-axis { stroke: var(--hairline-soft); stroke-width: 1; }
.profile-label { fill: var(--ink-3); font-size: 9px; font-variant-numeric: tabular-nums; }

/* ============================================================ PLAYBACK BAR */
.playbar {
  grid-area: play; display: flex; align-items: center; gap: 16px; padding: 0 18px;
  background: linear-gradient(0deg, rgba(0,0,0,.96), rgba(0,0,0,.66));
  backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur));
  border-top: 1px solid var(--hairline-soft); z-index: 30;
}
.playbar__transport { display: flex; align-items: center; gap: 8px; }
.playbtn {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(180deg, #3f86f7, #16357f); border: 1px solid rgba(91,157,255,.5);
  color: #fff; box-shadow: 0 6px 24px var(--blue-glow), inset 0 1px 0 rgba(255,255,255,.25); transition: transform .12s var(--ease), filter .12s;
}
.playbtn:hover { transform: scale(1.05); filter: brightness(1.12); }
.playbtn:active { transform: scale(.96); }
.playbtn svg { width: 22px; height: 22px; fill: currentColor; stroke: none; }

.playbar__clock { display: flex; flex-direction: column; min-width: 130px; }
.clock { font-variant-numeric: tabular-nums; font-size: 19px; font-weight: 500; color: var(--ink-0); letter-spacing: .04em; }
.phase { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); margin-top: 2px; }

.playbar__scrub { flex: 1; min-width: 0; }
.scrubber { position: relative; height: 44px; display: flex; align-items: center; cursor: pointer; }
.scrubber__track { position: relative; width: 100%; height: 4px; border-radius: 999px; background: rgba(255,255,255,.12); }
.scrubber__phases { position: absolute; inset: 0; border-radius: 999px; overflow: hidden; }
.scrubber__phase { position: absolute; top: 0; bottom: 0; opacity: .5; }
.scrubber__fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 999px; background: #fff; }
.scrubber__head { position: absolute; top: 50%; left: 0; width: 13px; height: 13px; border-radius: 50%; background: #fff; transform: translate(-50%, -50%); box-shadow: 0 0 0 4px rgba(255,255,255,.18), 0 2px 6px rgba(0,0,0,.6); }
.scrubber__events { position: absolute; inset: 0; }
.ev-marker { position: absolute; top: 50%; width: 8px; height: 8px; border-radius: 50%; transform: translate(-50%, -50%); border: 1.5px solid #000; cursor: pointer; transition: transform .15s var(--ease); background: #fff; }
.ev-marker:hover { transform: translate(-50%, -50%) scale(1.5); }
.ev-marker.is-rud { background: var(--bad); } .ev-marker.is-catch { background: var(--good); } .ev-marker.is-splash { background: var(--blue-bright); }

.playbar__layers { display: flex; gap: 3px; }
.layerbtn { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 7px; background: transparent; border: 1px solid var(--hairline-soft); color: var(--ink-2); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; transition: all .16s; }
.layerbtn:hover { color: var(--ink-0); }
.layerbtn.is-on { color: var(--ink-0); background: rgba(255,255,255,.06); border-color: var(--hairline); }
.layerbtn:not(.is-on) { opacity: .5; }
.layerbtn .lk { width: 14px; }

.playbar__speed { display: flex; gap: 1px; background: rgba(255,255,255,.04); border: 1px solid var(--hairline-soft); border-radius: 8px; padding: 3px; }
.speedbtn { height: 26px; padding: 0 10px; border-radius: 6px; border: none; background: none; color: var(--ink-2); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .04em; transition: all .16s; }
.speedbtn:hover { color: var(--ink-0); }
.speedbtn.is-active { background: #fff; color: #000; }

/* ============================================================ BROADCAST HUB */
.bhud {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 15;
  display: grid; grid-template-columns: auto 1fr auto; align-items: end; gap: 26px; padding: 18px 34px 22px;
  background: linear-gradient(0deg, rgba(0,0,0,.88) 0%, rgba(0,0,0,.42) 58%, rgba(0,0,0,0) 100%);
  pointer-events: none; font-variant-numeric: tabular-nums;
}
.bhud[hidden] { display: none !important; }
.bhud__side { display: flex; align-items: flex-end; gap: 26px; }
.bhud__right { justify-content: flex-end; }

.gauge { position: relative; width: 100px; height: 100px; text-align: center; }
.gauge svg { width: 100px; height: 100px; transform: rotate(-90deg); }
.gauge__track { fill: none; stroke: rgba(255,255,255,.12); stroke-width: 3; }
.gauge__val { fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 263.9; stroke-dashoffset: 263.9; transition: stroke-dashoffset .12s linear; }
.gauge[data-gauge="alt"] .gauge__val { stroke: var(--blue-bright); }
.gauge__readout { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gauge__num { font-size: 21px; font-weight: 600; color: var(--ink-0); line-height: 1; letter-spacing: .02em; }
.gauge__unit { font-size: 9px; letter-spacing: .16em; color: var(--ink-2); margin-top: 4px; }
.gauge__cap { font-size: 10.5px; letter-spacing: .2em; color: var(--ink-1); margin-top: 7px; text-transform: uppercase; }

.bhud__center { text-align: center; min-width: 0; padding-bottom: 2px; }
.bhud__arc { position: relative; height: 70px; margin: 0 auto 4px; max-width: 760px; }
.bhud__arc svg { width: 100%; height: 70px; overflow: visible; }
.arc-line { fill: none; stroke: rgba(255,255,255,.25); stroke-width: 1.25; }
.arc-prog { fill: none; stroke: #fff; stroke-width: 1.75; }
.arc-node { fill: #000; stroke: rgba(255,255,255,.6); stroke-width: 1.25; pointer-events: auto; cursor: pointer; }
.arc-node.is-done { fill: #fff; stroke: #fff; }
.arc-node.is-rud { stroke: var(--bad); }
.arc-node-label { fill: var(--ink-1); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; }
.arc-node-label.is-active { fill: #fff; font-weight: 600; }
.arc-head { fill: #fff; }
.bhud__clock { font-size: 30px; font-weight: 400; color: var(--ink-0); letter-spacing: .08em; }
.bhud__title { font-size: 11px; letter-spacing: .32em; color: var(--ink-2); margin-top: 4px; text-transform: uppercase; }

.enginegrp { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.engine-ring { position: relative; width: 88px; height: 88px; }
.engine-ring.ship { width: 72px; height: 72px; }
.engine-ring.small { width: 54px; height: 54px; }
.eng-dot { position: absolute; width: 5px; height: 5px; border-radius: 50%; transform: translate(-50%, -50%); background: transparent; box-shadow: inset 0 0 0 1px rgba(255,255,255,.3); transition: background .15s, box-shadow .15s; }
.eng-dot.lit { background: #fff; box-shadow: 0 0 5px rgba(255,255,255,.85); }
.engine-cap { display: flex; flex-direction: column; align-items: center; line-height: 1.35; gap: 1px; }
.engine-cap span:first-child { font-size: 13px; color: var(--ink-0); letter-spacing: .04em; font-weight: 600; }
.engine-cap span:last-child { font-size: 9px; letter-spacing: .16em; color: var(--ink-2); text-transform: uppercase; }

.attitude svg { width: 62px; height: 62px; }
.att__ring { fill: rgba(0,0,0,.3); stroke: rgba(255,255,255,.2); stroke-width: 1.25; }
.att__tick { stroke: rgba(255,255,255,.4); stroke-width: 1.25; }
.att__n { fill: var(--ink-2); font-size: 8px; text-anchor: middle; font-weight: 600; }
.att__craft { fill: #fff; stroke: none; }

/* ============================================================ COMPARE */
.app[data-compare="on"] .inspector { display: none; }
.app[data-compare="on"] { grid-template-columns: var(--list-w) 1fr 0; }
.compare-panel { position: absolute; right: 16px; top: 16px; bottom: 96px; width: 330px; z-index: 16; background: var(--panel); backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur)); border: 1px solid var(--hairline-soft); border-radius: var(--r-lg); padding: 16px; overflow-y: auto; box-shadow: var(--shadow-3); }

/* ============================================================ DIALOGS */
.dialog { border: none; background: none; padding: 0; max-width: 560px; width: calc(100vw - 32px); color: var(--ink-1); }
.dialog::backdrop { background: rgba(0,0,0,.78); backdrop-filter: blur(6px); }
.dialog__inner { position: relative; background: var(--panel-solid); border: 1px solid var(--hairline); border-radius: var(--r-xl); padding: 30px; box-shadow: var(--shadow-3); }
.dialog__close { position: absolute; top: 14px; right: 14px; }
.dialog__eyebrow { font-size: 10px; letter-spacing: .22em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 8px; }
.dialog__inner h2 { font-size: 26px; margin-bottom: 14px; letter-spacing: .04em; }
.dialog__inner h3.dialog__h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .14em; color: var(--ink-2); margin: 20px 0 8px; }
.dialog__inner p { font-size: 13px; line-height: 1.62; color: var(--ink-1); margin: 0 0 12px; }
.dialog__lead { font-size: 14.5px; color: var(--ink-0); }
.dialog__meta { font-size: 11px; color: var(--ink-3); }
.dialog__credit { font-size: 12px; color: var(--ink-3); margin-top: 10px; }
.dialog__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0 6px; }
.dialog__stat { background: rgba(255,255,255,.03); border: 1px solid var(--hairline-soft); border-radius: var(--r-md); padding: 14px; text-align: center; }
.dialog__statnum { display: block; font-size: 22px; font-weight: 600; color: #fff; font-variant-numeric: tabular-nums; }
.dialog__statlbl { display: block; font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); margin-top: 4px; }

.donate-tiers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0; }
.donate-tier { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 10px; border-radius: var(--r-md); border: 1px solid var(--hairline); background: rgba(255,255,255,.025); text-decoration: none; transition: all .16s var(--ease); }
.donate-tier:hover { background: rgba(255,255,255,.06); border-color: var(--hairline-strong); transform: translateY(-2px); }
.donate-tier--featured { border-color: rgba(91,157,255,.55); background: rgba(59,130,246,.1); }
.donate-amt { font-size: 22px; font-weight: 600; color: #fff; }
.donate-lbl { font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); }
.donate-cta { margin-top: 4px; }
.donate-cta svg { fill: currentColor; stroke: none; }

/* ============================================================ MOBILE SHEET */
.sheet-handle { position: fixed; left: 50%; bottom: calc(var(--playbar-h) + 8px); transform: translateX(-50%); z-index: 40; width: 44px; height: 5px; border-radius: 99px; border: none; background: rgba(255,255,255,.3); }

/* ============================================================ RESPONSIVE */
@media (max-width: 1180px) { :root { --list-w: 280px; --insp-w: 356px; } .topbar__center { display: none; } }
@media (max-width: 980px) { .era-filters { display: none; } }

@media (max-width: 900px) {
  :root { --playbar-h: 74px; }
  .app { grid-template-columns: 1fr !important; grid-template-rows: var(--topbar-h) 1fr auto; grid-template-areas: "top" "globe" "play"; }
  #listMinimize { display: none; }
  .listpanel, .inspector {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; height: min(72dvh, 560px); z-index: 50;
    border-radius: var(--r-xl) var(--r-xl) 0 0; border: 1px solid var(--hairline);
    transform: translateY(calc(100% + 20px)); transition: transform .42s var(--ease-out); opacity: 1;
  }
  .app[data-list="open"] .listpanel { transform: translateY(0); }
  .app[data-list="closed"] .listpanel { transform: translateY(calc(100% + 20px)); pointer-events: none; }
  .app[data-inspector="open"] .inspector { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .app[data-inspector="closed"] .inspector { transform: translateY(calc(100% + 20px)); }
  .legend { display: none; }
  .playbar { flex-wrap: wrap; gap: 10px; padding: 8px 12px; height: auto; }
  .playbar__scrub { order: -1; flex-basis: 100%; }
  .playbar__layers { display: none; }
  .playbar__clock { min-width: 104px; }
  .clock { font-size: 15px; }
  .globe[data-hud="on"] .legend { bottom: 16px; }
  /* compact, stacked telemetry hub on small screens */
  .bhud { grid-template-columns: 1fr; gap: 8px; padding: 12px 16px; }
  .bhud__side, .bhud__right { justify-content: center; gap: 22px; }
  .bhud__left .enginegrp, .attitude { display: none; }
  .bhud__right { order: 2; }
  .bhud__center { order: 1; }
  .gauge { width: 78px; height: 78px; }
  .gauge svg { width: 78px; height: 78px; }
  .gauge__num { font-size: 18px; }
  .bhud__clock { font-size: 24px; }
  .bhud__arc { height: 60px; max-width: 94vw; }
  .arc-node-label { font-size: 8.5px; }
}

@media (max-width: 480px) {
  .brand__sub { display: none; }
  .playbar__speed .speedbtn { padding: 0 7px; font-size: 10.5px; }
  .topbar { gap: 6px; padding: 0 8px; }
  .topbar__right .iconbtn { width: 32px; height: 32px; }
  #allPathsToggle, #followToggle { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .skeleton__globe { animation: none; }
}
@media (prefers-contrast: more) { :root { --ink-1: #fff; --ink-2: #d4dbe8; --hairline: rgba(255,255,255,.3); --hairline-soft: rgba(255,255,255,.18); } }

[hidden] { display: none !important; }
