:root {
  --glass: rgba(11, 15, 23, 0.66);
  --glass-strong: rgba(11, 15, 23, 0.84);
  --line: rgba(255, 255, 255, 0.09);
  --text: #e9edf3;
  --muted: #8d97a8;
  --amber: #ffb547;
  --sky: #8ec5ff;
  --radius: 14px;
  --ui: "Manrope", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #05070b; color: var(--text); font: 13px/1.45 var(--ui); }
#cesium { position: fixed; inset: 0; }
.street-overlay { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.cesium-viewer-bottom { left: auto !important; right: 8px; bottom: 96px !important; opacity: 0.75; }
.cesium-widget-credits { font-size: 10px; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--sky); }
kbd { font: 11px var(--mono); padding: 1px 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: rgba(255,255,255,0.05); }
.muted { color: var(--muted); }
.small { font-size: 11px; }
[hidden] { display: none !important; }

/* ---------- glass panels */
.topbar, .panel, .timebar, .card, .modal-box {
  background: var(--glass);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

.topbar { position: fixed; top: 14px; left: 14px; right: 14px; height: 48px; display: flex; align-items: center; gap: 10px; padding: 0 10px 0 16px; z-index: 5; max-width: 900px; }
.brand { font-weight: 700; letter-spacing: 0.18em; font-size: 14px; }
.brand b { color: var(--amber); font-weight: 700; margin-left: 2px; }
.search { position: relative; flex: 1; }
#search { width: 100%; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: rgba(255,255,255,0.05); color: var(--text); padding: 0 12px; font: inherit; outline: none; }
#search:focus { border-color: rgba(255,181,71,0.5); background: rgba(255,255,255,0.08); }
#search-results { position: absolute; top: 38px; left: 0; right: 0; margin: 0; padding: 4px; list-style: none; background: var(--glass-strong); border: 1px solid var(--line); border-radius: 10px; max-height: 360px; overflow: auto; }
#search-results li { padding: 7px 10px; border-radius: 7px; cursor: pointer; display: flex; gap: 8px; align-items: baseline; }
#search-results li:hover, #search-results li.sel { background: rgba(255,255,255,0.08); }
#search-results .desc { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: rgba(255,255,255,0.05); white-space: nowrap; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sky); box-shadow: 0 0 8px var(--sky); }
.pill.photo .dot { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.icon-btn { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: rgba(255,255,255,0.05); display: grid; place-items: center; }

.panel { position: fixed; z-index: 4; width: 270px; padding: 12px 14px; }
.panel.left { top: 76px; left: 14px; }
.panel.right { top: 14px; right: 14px; max-height: calc(100vh - 130px); display: flex; flex-direction: column; }
.panel.right .panel-body { overflow: auto; }
.panel.collapsed .panel-body { display: none; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.panel.collapsed .panel-head { margin-bottom: 0; }
h3 { margin: 0; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
h4 { margin: 18px 0 6px; font-size: 12px; letter-spacing: 0.06em; }
.collapse { background: none; border: 0; color: var(--muted); font-size: 16px; line-height: 1; padding: 2px 6px; }

.seg { display: flex; background: rgba(255,255,255,0.05); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { flex: 1; border: 0; background: none; padding: 6px 4px; border-radius: 7px; color: var(--muted); font-weight: 600; font-size: 12px; }
.seg button.on { background: rgba(255,255,255,0.12); color: var(--text); }
.seg.small button { font-size: 11px; padding: 4px; }

.routes { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 4px; }
.routes li { padding: 8px 10px; border-radius: 9px; border: 1px solid transparent; cursor: pointer; }
.routes li:hover { background: rgba(255,255,255,0.05); }
.routes li.on { border-color: rgba(255,181,71,0.45); background: rgba(255,181,71,0.08); }
.routes .name { font-weight: 600; }
.routes .blurb { color: var(--muted); font-size: 11px; }

.field { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 8px; margin: 8px 0; }
.field > span { color: var(--muted); font-size: 12px; }
.field output { font: 11px var(--mono); color: var(--muted); min-width: 52px; text-align: right; }
.field select { grid-column: 2 / 4; background: rgba(255,255,255,0.06); color: var(--text); border: 1px solid var(--line); border-radius: 7px; padding: 4px 6px; font: inherit; }
.row { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.row .seg { flex: 1; }
.btn { border: 1px solid var(--line); background: rgba(255,255,255,0.06); border-radius: 8px; padding: 6px 12px; font-weight: 600; font-size: 12px; }
.btn:hover { background: rgba(255,255,255,0.1); }
.btn.primary { background: var(--amber); color: #1a1206; border-color: transparent; }
.check { display: flex; gap: 8px; align-items: center; margin: 6px 0; color: var(--text); cursor: pointer; }
.check input { accent-color: var(--amber); }
.hint { color: var(--muted); font-size: 11.5px; margin: 10px 0 0; line-height: 1.7; }
.progress { height: 3px; border-radius: 3px; background: rgba(255,255,255,0.08); overflow: hidden; margin-top: 8px; }
#route-progress { height: 100%; width: 0; background: var(--amber); }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 4px; background: rgba(255,255,255,0.15); outline: none; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--text); border: 0; box-shadow: 0 1px 6px rgba(0,0,0,0.5); }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--text); border: 0; }

.chips { display: flex; gap: 4px; }
.chip { height: 30px; padding: 0 11px; border-radius: 99px; border: 1px solid var(--line); background: rgba(255,255,255,0.04); color: var(--muted); font-weight: 600; font-size: 12px; }
.chip[aria-pressed="true"] { color: #1a1206; background: var(--amber); border-color: transparent; }

.nav-controls { position: fixed; right: 14px; bottom: 112px; z-index: 4; display: grid; gap: 8px; }
.nav-btn { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--line); box-shadow: 0 6px 24px rgba(0,0,0,0.35); }
.nav-btn:hover { background: var(--glass-strong); }
#info-card:not([hidden]) ~ .nav-controls { display: none; }
#stream-bar { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 30; overflow: hidden; }
#stream-bar::after { content: ""; position: absolute; top: 0; bottom: 0; width: 30%; background: linear-gradient(90deg, transparent, var(--amber), transparent); animation: stream 1.3s ease-in-out infinite; }
@keyframes stream { from { left: -30%; } to { left: 100%; } }

/* ---------- in view */
#inview-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
#inview-list li { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: center; padding: 6px 6px; border-radius: 8px; cursor: pointer; }
#inview-list li:hover { background: rgba(255,255,255,0.06); }
#inview-list .swatch { width: 8px; height: 8px; border-radius: 50%; }
#inview-list .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#inview-list .dist { font: 11px var(--mono); color: var(--muted); display: flex; gap: 6px; align-items: center; }
#inview-list .arrow { display: inline-block; width: 10px; text-align: center; color: var(--amber); }
#inview-list .empty { color: var(--muted); cursor: default; display: block; }

/* ---------- info card */
.card { position: fixed; z-index: 6; right: 14px; bottom: 104px; width: 340px; max-height: calc(100vh - 220px); overflow: auto; padding: 0; }
.card .thumb { width: 100%; height: 170px; object-fit: cover; display: block; border-radius: var(--radius) var(--radius) 0 0; background: #111; }
.card .body { padding: 14px 16px 16px; }
.card .kicker { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--amber); font-weight: 700; }
.card h2 { margin: 4px 0 2px; font-size: 19px; line-height: 1.2; }
.card .sub { color: var(--muted); margin-bottom: 10px; }
.card .facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.card .fact { background: rgba(255,255,255,0.05); border-radius: 9px; padding: 7px 9px; }
.card .fact .k { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.card .fact .v { font: 500 13px var(--mono); }
.card p.extract { margin: 8px 0; color: #c9d0db; }
.card .actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.card .close { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,0.55); color: #fff; font-size: 16px; }
.card dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 8px 0 0; }
.card dt { color: var(--muted); }
.card dd { margin: 0; }

/* ---------- time bar */
.timebar { position: fixed; z-index: 5; left: 50%; transform: translateX(-50%); bottom: 14px; width: min(980px, calc(100vw - 28px)); display: flex; align-items: center; gap: 16px; padding: 12px 16px; }
.round { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255,255,255,0.07); display: grid; place-items: center; flex: none; }
.round.on { background: var(--amber); color: #1a1206; }
.time-readout { width: 104px; flex: none; }
#time-label { font: 500 22px var(--mono); letter-spacing: -0.02em; }
#phase-label { font-size: 11px; color: var(--amber); letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; }
.slider-wrap { position: relative; flex: 1; padding-top: 6px; }
#sky-track { position: absolute; left: 0; right: 0; top: 6px; height: 10px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08); }
#time-slider { position: relative; height: 10px; background: transparent; }
#time-slider::-webkit-slider-thumb { width: 6px; height: 22px; border-radius: 3px; background: #fff; box-shadow: 0 0 0 2px rgba(0,0,0,0.35), 0 0 12px rgba(255,255,255,0.6); }
#time-slider::-moz-range-thumb { width: 6px; height: 22px; border-radius: 3px; background: #fff; }
.ticks { display: flex; justify-content: space-between; font: 10px var(--mono); color: var(--muted); margin-top: 6px; }
.time-side { display: flex; flex-direction: column; gap: 6px; flex: none; }
#date-input { background: rgba(255,255,255,0.06); color: var(--text); border: 1px solid var(--line); border-radius: 7px; padding: 3px 6px; font: 12px var(--mono); color-scheme: dark; }
.presets { display: flex; gap: 3px; }
.presets button { border: 1px solid var(--line); background: rgba(255,255,255,0.04); border-radius: 6px; font-size: 10.5px; padding: 2px 6px; color: var(--muted); }
.presets button:hover { color: var(--text); }

/* ---------- modal */
.modal { position: fixed; inset: 0; z-index: 10; background: rgba(0,0,0,0.45); display: grid; place-items: center; padding: 16px; }
.modal-box { width: min(480px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 18px 20px; background: var(--glass-strong); }
.stack { display: grid; gap: 4px; margin: 10px 0; }
.stack small { color: var(--muted); }
.stack input { background: rgba(255,255,255,0.06); border: 1px solid var(--line); border-radius: 8px; color: var(--text); padding: 7px 10px; font: 12px var(--mono); }

/* ---------- airplane window */
#window-frame { position: fixed; inset: 0; z-index: 3; pointer-events: none; }
#window-frame::before {
  content: ""; position: absolute; left: 50%; top: 46%; width: min(64vw, 92vh); height: min(78vh, 112vw);
  transform: translate(-50%, -50%); border-radius: 46% / 36%;
  box-shadow: 0 0 0 200vmax #d9d6cf, inset 0 0 0 10px #c4c0b7, inset 0 0 0 22px #e6e3dc, inset 0 0 60px 26px rgba(0,0,0,0.38);
}
#window-frame .pane {
  position: absolute; left: 50%; top: 46%; width: min(64vw, 92vh); height: min(78vh, 112vw);
  transform: translate(-50%, -50%); border-radius: 46% / 36%;
  background: radial-gradient(ellipse at 30% 20%, rgba(255,255,255,0.07), transparent 45%),
              linear-gradient(160deg, rgba(255,255,255,0.03), transparent 40%);
}
#window-frame.night::before { box-shadow: 0 0 0 200vmax #2a2a2c, inset 0 0 0 10px #232325, inset 0 0 0 22px #333336, inset 0 0 60px 26px rgba(0,0,0,0.6); }

/* ---------- loading & toast */
#loading { position: fixed; inset: 0; z-index: 20; display: grid; place-content: center; justify-items: center; gap: 14px; background: radial-gradient(ellipse at 50% 120%, #2a1a0a 0%, #05070b 60%); transition: opacity 0.8s; }
.brand.big { font-size: 26px; letter-spacing: 0.3em; }
.load-track { width: min(320px, 70vw); height: 4px; border-radius: 4px; background: rgba(255,255,255,0.08); overflow: hidden; }
#load-bar { height: 100%; width: 2%; background: var(--amber); border-radius: 4px; transition: width 0.4s ease; }
#loading-text { color: var(--muted); font-size: 12.5px; }
#loading.done { opacity: 0; pointer-events: none; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.12); border-top-color: var(--amber); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#toast { position: fixed; z-index: 15; top: 74px; left: 50%; transform: translateX(-50%); background: var(--glass-strong); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; max-width: 90vw; }

@media (max-width: 760px) {
  .panel { width: calc(100vw - 28px); }
  .panel.right { display: none; }
  .panel.left { top: auto; bottom: 168px; max-height: 42vh; overflow: auto; }
  .routes .blurb { display: none; }
  .timebar { flex-wrap: wrap; gap: 10px; }
  .slider-wrap { order: 3; flex-basis: 100%; }
  .card { left: 14px; right: 14px; width: auto; }
  .brand { display: none; }
  .brand.big { display: block; }
  .chip { padding: 0 8px; }
  .nav-controls { top: 74px; bottom: auto; }
}
