:root {
  --bg: #04060d;
  --panel: rgba(10, 14, 28, 0.82);
  --panel-2: rgba(16, 22, 44, 0.9);
  --line: rgba(140, 170, 255, 0.18);
  --text: #e8ecf8;
  --dim: #8d97b8;
  --accent: #8fd6ff;
  --accent-2: #c38bff;
  --warn: #ffb35c;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --sans: 'Space Grotesk', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); overflow: hidden; }
#app { position: fixed; inset: 0; }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#labels { position: absolute; inset: 0; pointer-events: none; }
#labels > div { position: absolute; inset: 0; }
#bhOverlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#bhHud { position: absolute; left: 50%; transform: translateX(-50%); bottom: 160px; font: 11px var(--mono); color: #cfe3ff; background: rgba(6,10,24,0.6); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; display: flex; gap: 16px; white-space: nowrap; z-index: 13; }
#bhHud span b { color: var(--dim); font-weight: 400; margin-right: 4px; }
@media (max-width: 900px) { #bhHud { display: none; } }
.lbl { font: 500 11px var(--mono); color: #d7e3ff; background: rgba(6, 10, 24, 0.55); padding: 2px 6px; border-radius: 4px; border: 1px solid var(--line); white-space: nowrap; pointer-events: none; }
.lbl-big { font-size: 13px; color: #ffe1b0; }
.lbl-hi { color: #9ee7ff; border-color: rgba(143, 214, 255, 0.5); }
.lbl-dim { color: var(--dim); background: transparent; border-color: transparent; }
.mono { font-family: var(--mono); }
.dim { color: var(--dim); }
[hidden] { display: none !important; }

/* Landing */
#landing { position: absolute; inset: 0; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 40%, rgba(60, 40, 120, 0.35), transparent 60%), linear-gradient(180deg, rgba(4,6,13,0.4), rgba(4,6,13,0.85)); z-index: 30; padding: 16px; }
.landing-card { max-width: 720px; text-align: center; animation: rise 1.2s ease-out; }
.eyebrow { font: 500 12px var(--mono); letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent-2); }
.landing-card h1 { font-size: clamp(42px, 9vw, 96px); letter-spacing: 0.22em; margin: 8px 0 0; font-weight: 700; background: linear-gradient(90deg, #dbe9ff, #8fd6ff 40%, #c38bff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.landing-card h2 { font-weight: 500; font-size: clamp(15px, 2.4vw, 22px); color: #cfd8f2; margin: 6px 0 18px; }
.landing-card p { color: var(--dim); line-height: 1.55; font-size: 15px; }
.landing-actions { display: flex; gap: 12px; justify-content: center; margin: 22px 0 12px; flex-wrap: wrap; }
@keyframes rise { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }

/* Buttons */
.btn { font-family: var(--sans); font-size: 14px; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; cursor: pointer; transition: 0.15s; }
.btn:hover { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(143, 214, 255, 0.15); }
.btn.primary { background: linear-gradient(90deg, #4c7dff, #8f5cff); border-color: transparent; font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.icon { width: 34px; padding: 6px 0; text-align: center; }
.btn.active { border-color: var(--accent); background: rgba(143, 214, 255, 0.12); }
.btn-row { display: flex; gap: 8px; margin: 10px 0; }

/* Top bar */
#topbar { position: absolute; top: 0; left: 0; right: 0; height: 52px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; background: linear-gradient(180deg, rgba(4,6,13,0.85), rgba(4,6,13,0)); z-index: 20; gap: 8px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: 0.12em; font-size: 14px; }
.brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); animation: pulse 0.82s infinite; }
@keyframes pulse { 0%, 100% { opacity: 0.25; } 8% { opacity: 1; } }
.brand .sep { color: var(--dim); }
.scale-switch { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); }
.seg { background: transparent; border: 0; color: var(--dim); padding: 7px 14px; cursor: pointer; font-family: var(--sans); font-size: 13px; }
.seg.active { color: var(--text); background: rgba(143, 214, 255, 0.15); }
.top-actions { display: flex; gap: 6px; }

/* Left panel */
#left { position: absolute; top: 60px; left: 12px; bottom: 150px; width: 270px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; backdrop-filter: blur(10px); z-index: 15; transition: transform 0.25s; }
#left.collapsed { transform: translateX(-262px); }
.tab-toggle { position: absolute; right: -34px; top: 8px; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer; }
.panel-scroll { height: 100%; overflow-y: auto; padding: 12px 14px 20px; scrollbar-width: thin; }
#left h3 { font: 600 11px var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-2); margin: 14px 0 8px; }
.tour-list { display: grid; gap: 5px; }
.tour-list button { text-align: left; background: transparent; border: 1px solid transparent; color: var(--text); padding: 6px 8px; border-radius: 8px; cursor: pointer; font-family: var(--sans); font-size: 13px; }
.tour-list button:hover, .tour-list button.active { border-color: var(--line); background: rgba(143, 214, 255, 0.08); }
.tour-list button b { color: var(--dim); font-family: var(--mono); font-weight: 400; margin-right: 6px; }
.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; }
.toggles label { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; padding: 3px 0; }
.toggles input { accent-color: var(--accent); }
.toggles kbd { margin-left: auto; font: 10px var(--mono); color: var(--dim); border: 1px solid var(--line); padding: 0 4px; border-radius: 4px; }
.slider-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; align-items: center; margin: 6px 0; font-size: 13px; }
.slider-row label { grid-column: 1 / -1; color: var(--dim); }
.slider-row input[type=range] { width: 100%; accent-color: var(--accent); }
.link { display: block; margin-top: 14px; font-size: 12px; text-decoration: none; }
.link:hover { color: var(--accent); }

/* Info panel */
#info { position: absolute; top: 60px; right: 12px; width: min(380px, calc(100vw - 24px)); max-height: calc(100vh - 220px); overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; backdrop-filter: blur(10px); padding: 16px 18px; z-index: 16; animation: rise 0.3s ease-out; scrollbar-width: thin; }
#info h2 { margin: 0 24px 8px 0; font-size: 18px; }
#info p { line-height: 1.5; font-size: 14px; color: #d4dbf0; margin: 8px 0; }
.close { position: absolute; top: 8px; right: 10px; background: transparent; border: 0; color: var(--dim); font-size: 22px; cursor: pointer; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 10px 0; font-size: 12.5px; }
.facts .k { color: var(--dim); }
.facts .v { font-family: var(--mono); }
.facts .v.assumed { color: var(--warn); }
.badge { display: inline-block; font: 600 10px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; padding: 2px 6px; border-radius: 4px; border: 1px solid var(--warn); color: var(--warn); margin-bottom: 8px; }
.badge.ok { border-color: #7dffb0; color: #7dffb0; }
.sources { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; font-size: 12px; }
.sources a { color: var(--accent); text-decoration: none; display: block; margin: 3px 0; }
.sources a:hover { text-decoration: underline; }

/* Tooltip */
#tip { position: absolute; pointer-events: none; font: 500 12px var(--mono); color: #fff; background: rgba(6, 10, 24, 0.85); border: 1px solid var(--accent); padding: 4px 8px; border-radius: 6px; z-index: 18; transform: translate(12px, 12px); }

/* HUD */
#hud { position: absolute; left: 12px; right: 12px; bottom: 12px; display: grid; grid-template-columns: 220px 1fr; gap: 10px; z-index: 14; }
.hud-stats { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 4px; font-size: 12px; align-content: start; }
.hud-stats .k { color: var(--dim); display: inline-block; width: 92px; }
.hud-stats .v { color: var(--accent); }
.hud-stats .hint { color: var(--dim); font-size: 11px; margin-top: 4px; }
.hud-charts { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; }
.chart { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 6px 8px 4px; min-width: 0; }
.chart-title { font: 10px var(--mono); color: var(--dim); letter-spacing: 0.05em; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart canvas { width: 100%; height: 70px; display: block; }

/* Modal */
#modal { position: absolute; inset: 0; background: rgba(2, 4, 10, 0.7); display: grid; place-items: center; z-index: 40; padding: 16px; }
.modal-card { position: relative; width: min(860px, 100%); max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; background: var(--panel-2); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-right: 30px; }
.tabs button { background: transparent; border: 1px solid var(--line); color: var(--dim); border-radius: 8px; padding: 6px 10px; cursor: pointer; font-family: var(--sans); font-size: 13px; }
.tabs button.active { color: var(--text); border-color: var(--accent); background: rgba(143, 214, 255, 0.12); }
.modal-body { overflow-y: auto; padding: 6px 4px; line-height: 1.55; font-size: 14.5px; color: #d4dbf0; }
.modal-body h3 { margin: 10px 0 6px; color: var(--accent); }
.orbit-lab { border-top: 1px solid var(--line); padding-top: 10px; overflow-y: auto; }
.orbit-lab .facts { grid-template-columns: auto 1fr auto 1fr; }

/* Responsive */
@media (max-width: 900px) {
  #hud { grid-template-columns: 1fr; bottom: 8px; left: 8px; right: 8px; }
  .hud-stats { display: flex; flex-wrap: wrap; gap: 8px 14px; }
  .hud-stats .k { width: auto; margin-right: 4px; }
  .hud-stats .hint { display: none; }
  .hud-charts { grid-template-columns: 1fr; }
  .chart:nth-child(3) { display: none; }
  .chart canvas { height: 46px; }
  #left { width: 240px; bottom: 210px; }
  #left.collapsed { transform: translateX(-232px); }
  #info { top: auto; bottom: 8px; right: 8px; left: 8px; width: auto; max-height: 50vh; }
  .brand span:not(.dot):not(.mono) { display: none; }
  .orbit-lab .facts { grid-template-columns: auto 1fr; }
}
