/* Solar System Explorer: interface styles */
:root {
  --panel: rgba(11, 15, 25, 0.74);
  --panel-solid: #0c111c;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #e9eef7;
  --dim: #94a1b9;
  --faint: #5f6b82;
  --accent: #ffcf70;
  --accent-2: #7db7ff;
  --warn: #ff9a6b;
  --radius: 12px;
  --bar: 52px;
  --nav: 268px;
  --blur: saturate(140%) blur(18px);
  font-family: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: #000; color: var(--text); font-size: 14px; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: var(--accent-2); }
kbd { font: 11px/1 ui-monospace, "Cascadia Mono", Consolas, monospace; padding: 3px 6px; border-radius: 5px; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); color: var(--dim); }

#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; cursor: grab; }
#view:active { cursor: grabbing; }
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }

.panel { background: var(--panel); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45); }

/* ---------------------------------------------------------------- labels */
.label { position: absolute; left: 0; top: 0; white-space: nowrap; font-size: 12px; letter-spacing: 0.02em; color: #fff; text-shadow: 0 0 4px #000, 0 1px 2px #000, 0 0 12px rgba(0, 0, 0, 0.8); will-change: transform, opacity; user-select: none; padding: 1px 2px; }
.label.clickable { pointer-events: auto; cursor: pointer; }
.label.clickable:hover { color: var(--accent); }
.label-sun { color: #ffe7ad; font-weight: 600; }
.label-planet { font-weight: 600; font-size: 12.5px; }
.label-dwarf { color: #ffbfb0; }
.label-moon { color: #b9c6ff; font-size: 11px; }
.label-asteroid { color: #b9dfb1; font-size: 10.5px; }
.label-comet { color: #a9dcff; font-size: 10.5px; }
.label-star { color: #cdd6ea; font-size: 10.5px; }
.label-satellite { color: #bfe6ff; font-size: 10.5px; letter-spacing: 0.02em; }
.label-craft { color: #ffe0a8; font-size: 10.5px; letter-spacing: 0.02em; }
.label-nebula { color: #ffc0cb; font-size: 10.5px; font-style: italic; }
.label-galaxy { color: #d9defe; font-size: 11.5px; font-style: italic; }
.label-cluster { color: #ffdfb5; font-size: 11.5px; font-style: italic; }
.label-blackhole { color: #ffc9a3; font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em; }
.label-constellation { color: #6f8bd0; font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; }

/* ---------------------------------------------------------------- top bar */
#topbar { position: fixed; z-index: 20; top: 10px; left: 10px; right: 10px; height: var(--bar); display: flex; align-items: center; gap: 10px; padding: 0 10px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: 0.01em; font-size: 15px; white-space: nowrap; margin-right: 6px; }
.brand svg { width: 24px; height: 24px; flex: none; }
.brand em { font-style: normal; color: var(--dim); font-weight: 450; }
.icon-btn { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; color: var(--dim); transition: background 0.15s, color 0.15s; flex: none; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pill-btn { height: 34px; padding: 0 14px; border-radius: 17px; border: 1px solid var(--line-strong); color: var(--text); font-weight: 550; font-size: 13px; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; transition: background 0.15s, border-color 0.15s; flex: none; }
.pill-btn:hover { background: rgba(255, 255, 255, 0.08); }
.pill-btn.primary { background: linear-gradient(135deg, #ffd27a, #ff9d5c); color: #1a1206; border-color: transparent; }
.pill-btn.primary:hover { filter: brightness(1.08); }
.pill-btn.on { background: linear-gradient(135deg, #ff7d6b, #d94bd0); color: #fff; }
.spacer { flex: 1; }

#search-box { position: relative; flex: 1 1 260px; max-width: 420px; min-width: 120px; }
#search { width: 100%; height: 34px; border-radius: 17px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); padding: 0 14px 0 36px; outline: none; transition: border-color 0.15s, background 0.15s; }
#search::placeholder { color: var(--faint); }
#search:focus { border-color: rgba(125, 183, 255, 0.6); background: rgba(255, 255, 255, 0.08); }
#search-box > svg { position: absolute; left: 12px; top: 9px; width: 16px; height: 16px; stroke: var(--faint); fill: none; stroke-width: 2; stroke-linecap: round; pointer-events: none; }
#search-results { position: absolute; top: 40px; left: 0; right: 0; list-style: none; padding: 6px; display: none; max-height: 60vh; overflow: auto; }
#search-results.open { display: block; }
#search-results li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
#search-results li em { font-style: normal; color: var(--faint); font-size: 12px; }
#search-results li:hover, #search-results li.active { background: rgba(125, 183, 255, 0.16); }

/* ---------------------------------------------------------------- object browser */
#sidebar { position: fixed; z-index: 15; top: calc(var(--bar) + 20px); left: 10px; bottom: 10px; width: var(--nav); display: flex; flex-direction: column; overflow: hidden; transform: translateX(calc(-100% - 20px)); transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); }
body.nav-open #sidebar { transform: none; }
#nav-list { overflow-y: auto; padding: 6px 8px 14px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.18) transparent; }
.nav-section h3 { position: sticky; top: -6px; z-index: 1; display: flex; align-items: center; justify-content: space-between; font-size: 10.5px; font-weight: 650; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); padding: 14px 8px 7px; cursor: pointer; background: linear-gradient(rgba(11, 15, 25, 0.96) 70%, transparent); user-select: none; }
.nav-section h3:hover { color: var(--dim); }
.nav-section h3 i { width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); transition: transform 0.2s; margin-right: 4px; }
.nav-section.collapsed h3 i { transform: rotate(-45deg); }
.nav-section.collapsed ul { display: none; }
.nav-section ul { list-style: none; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 7px 9px; border-radius: 8px; cursor: pointer; transition: background 0.12s; border-left: 2px solid transparent; }
.nav-item:hover { background: rgba(255, 255, 255, 0.07); }
.nav-item.active { background: rgba(255, 207, 112, 0.13); border-left-color: var(--accent); }
.nav-item.child { padding: 5px 9px 5px 28px; }
.nav-item .nm { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.nav-item.child .nm { font-weight: 400; color: #c2cbe0; font-size: 13px; }
.nav-item .sub { color: var(--faint); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.dot { width: 11px; height: 11px; border-radius: 50%; background: var(--c); box-shadow: 0 0 9px -1px var(--c); flex: none; }
.nav-item.child .dot { width: 7px; height: 7px; }
.dot.rock { border-radius: 3px 5px 3px 6px; transform: rotate(12deg); }
.dot.comet { border-radius: 50% 0 50% 50%; transform: rotate(-45deg); background: linear-gradient(135deg, var(--c), transparent 85%); }
.dot.ring { background: none; border: 1.5px solid var(--c); box-shadow: none; }
.dot.hole { background: #000; border: 2px solid var(--c); box-shadow: 0 0 8px 0 var(--c); }
.nav-note { color: var(--faint); font-size: 11.5px; padding: 6px 9px; line-height: 1.4; }

/* ---------------------------------------------------------------- info panel */
#info { position: fixed; z-index: 14; top: calc(var(--bar) + 20px); right: 10px; width: 330px; max-height: calc(100vh - var(--bar) - 190px); overflow-y: auto; padding: 18px 18px 16px; transform: translateX(calc(100% + 20px)); transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.18) transparent; }
#info.open { transform: none; }
#info-close { position: absolute; top: 10px; right: 10px; }
#info-name { font-size: 22px; font-weight: 680; letter-spacing: -0.01em; padding-right: 36px; line-height: 1.15; }
#info-type { color: var(--accent); font-size: 11px; font-weight: 650; letter-spacing: 0.13em; text-transform: uppercase; margin: 5px 0 11px; }
#info-desc { color: #c9d2e4; line-height: 1.58; font-size: 13.5px; }
#info-live { margin-top: 12px; display: grid; gap: 5px; }
#info-live div { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; }
#info-live label { color: var(--faint); }
#info-live b { font-weight: 550; font-variant-numeric: tabular-nums; text-align: right; }
#info-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 13px; }
.stat { background: rgba(255, 255, 255, 0.045); border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 9px; padding: 8px 10px; }
.stat.wide { grid-column: span 2; }
.stat label { display: block; color: var(--faint); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 3px; }
.stat b { font-weight: 600; font-size: 13px; }
#info-facts h4 { color: var(--faint); font-size: 10.5px; letter-spacing: 0.13em; text-transform: uppercase; margin: 15px 0 7px; }
#info-facts ul { list-style: none; }
#info-facts li { position: relative; padding: 3px 0 3px 15px; color: #b6c0d6; font-size: 13px; line-height: 1.45; }
#info-facts li::before { content: ""; position: absolute; left: 2px; top: 11px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.info-actions { display: flex; gap: 8px; margin-top: 15px; }
.info-actions .pill-btn { flex: 1; justify-content: center; text-decoration: none; }
#info-credit { color: var(--faint); font-size: 11px; line-height: 1.45; margin-top: 11px; }
#info-credit:empty { display: none; }

/* ---------------------------------------------------------------- bottom dock */
#dock { position: fixed; z-index: 12; left: 10px; right: 10px; bottom: 10px; display: flex; align-items: flex-end; gap: 12px; pointer-events: none; transition: left 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); }
body.nav-open #dock { left: calc(var(--nav) + 22px); }
#dock > * { pointer-events: auto; }
#hud { padding: 11px 14px; width: 250px; flex: none; }
#hud-context { color: var(--accent-2); font-size: 10.5px; font-weight: 650; letter-spacing: 0.13em; text-transform: uppercase; }
#hud-where { margin-top: 3px; font-size: 13px; font-weight: 550; font-variant-numeric: tabular-nums; }
.scale { display: flex; align-items: center; gap: 9px; margin-top: 9px; color: var(--dim); font-size: 11.5px; font-variant-numeric: tabular-nums; }
#scale-bar { height: 7px; min-width: 20px; border: 1.5px solid var(--dim); border-top: 0; transition: width 0.12s linear; }
#debug { color: var(--faint); font: 11px ui-monospace, Consolas, monospace; margin-top: 7px; }
#debug:empty { display: none; }

.center-stack { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 9px; min-width: 0; }

/* scale ladder: the whole zoom range on one ruler */
#ladder { width: min(100%, 720px); padding: 23px 26px 24px; position: relative; }
#ladder-track { position: relative; height: 16px; cursor: ew-resize; touch-action: none; }
#ladder-track::before { content: ""; position: absolute; left: 0; right: 0; top: 7px; height: 2px; border-radius: 1px; background: linear-gradient(90deg, #6fd3ff, #ffe08a 28%, #ffa46b 52%, #c58bff 76%, #7d8cff); opacity: 0.55; }
.rung { position: absolute; top: 3px; width: 2px; height: 10px; background: rgba(255, 255, 255, 0.5); transform: translateX(-1px); }
.rung span { position: absolute; top: 15px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--faint); white-space: nowrap; transition: color 0.15s; letter-spacing: 0.01em; }
.rung.up span { top: auto; bottom: 15px; }
.rung:hover span { color: var(--text); }
.rung:hover { background: #fff; }
#ladder-thumb { position: absolute; top: 0; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.16), 0 0 16px rgba(255, 255, 255, 0.7); pointer-events: none; }

/* time controls */
#timebar { display: flex; align-items: center; gap: 4px; padding: 6px 8px; height: 46px; }
#timebar .icon-btn { width: 32px; height: 32px; }
#timebar .icon-btn.on { color: var(--accent); background: rgba(255, 207, 112, 0.14); }
.time-read { display: flex; align-items: baseline; gap: 8px; padding: 0 10px; cursor: pointer; border-radius: 8px; height: 32px; line-height: 32px; white-space: nowrap; flex: none; }
#timebar { white-space: nowrap; }
.time-read:hover { background: rgba(255, 255, 255, 0.07); }
#t-date { font-weight: 600; }
#t-clock { color: var(--dim); font-variant-numeric: tabular-nums; }
#t-rate { min-width: 96px; text-align: center; color: var(--accent); font-weight: 600; font-size: 12.5px; font-variant-numeric: tabular-nums; }
#t-input { display: none; height: 32px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--panel-solid); padding: 0 8px; color-scheme: dark; }
#timebar.editing #t-input { display: block; }
#timebar.editing .time-read { display: none; }
#timebar.warn #t-date::after { content: " ·approx."; color: var(--warn); font-weight: 500; font-size: 11px; }
#t-events { height: 32px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); padding: 0 8px; max-width: 132px; color-scheme: dark; cursor: pointer; font-size: 12.5px; }
.sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }

#credits { margin-top: 8px; font-size: 10.5px; color: var(--faint); line-height: 1.4; }
#credits a { color: var(--dim); }
#credits-imagery:not(:empty)::after { content: " · "; }

/* ---------------------------------------------------------------- popovers */
.popover { position: fixed; z-index: 30; top: calc(var(--bar) + 20px); right: 10px; width: 300px; padding: 16px; display: none; max-height: calc(100vh - var(--bar) - 40px); overflow-y: auto; }
.popover.open { display: block; }
.popover h2 { font-size: 11px; letter-spacing: 0.13em; text-transform: uppercase; color: var(--faint); margin-bottom: 10px; }
.popover h2:not(:first-child) { margin-top: 16px; }
.toggle { display: flex; align-items: center; gap: 10px; padding: 6px 2px; cursor: pointer; user-select: none; font-size: 13.5px; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle .sw { width: 30px; height: 17px; border-radius: 9px; background: rgba(255, 255, 255, 0.14); position: relative; flex: none; transition: background 0.15s; }
.toggle .sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.toggle input:checked + .sw { background: var(--accent-2); }
.toggle input:checked + .sw::after { transform: translateX(13px); }
.toggle input:focus-visible + .sw { outline: 2px solid #fff; outline-offset: 2px; }
.toggle span:nth-of-type(2) { flex: 1; }
.popover select { width: 100%; height: 34px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--panel-solid); padding: 0 10px; color-scheme: dark; }
.popover p { color: var(--dim); font-size: 12px; line-height: 1.5; margin-top: 8px; }
#help { width: 380px; }
#help dl { display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; font-size: 13px; align-items: center; }
#help dt { white-space: nowrap; }
#help dd { color: var(--dim); }
#help ul { list-style: none; color: var(--dim); font-size: 12px; line-height: 1.6; }

/* ---------------------------------------------------------------- tour card */
#tour-card { position: fixed; z-index: 13; top: calc(var(--bar) + 26px); left: 50%; transform: translateX(-50%); width: min(560px, calc(100vw - 24px)); padding: 16px 18px 14px; display: none; }
body.touring #tour-card { display: block; }
#tour-card.flash { animation: rise 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
#tour-title { font-size: 20px; font-weight: 680; letter-spacing: -0.01em; }
#tour-text { color: #c9d2e4; line-height: 1.55; margin-top: 6px; font-size: 13.5px; }
.tour-row { display: flex; align-items: center; gap: 8px; margin-top: 11px; }
#tour-count { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.tour-progress { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
#tour-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #ff9d5c); }

/* ---------------------------------------------------------------- loading and notices */
#loading { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 60%, #0b1224, #000 70%); transition: opacity 0.9s ease, visibility 0.9s; }
#loading.done { opacity: 0; visibility: hidden; }
#loading .box { text-align: center; }
#loading .orbit { width: 74px; height: 74px; margin: 0 auto 22px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, 0.14); position: relative; animation: spin 2.6s linear infinite; }
#loading .orbit::before { content: ""; position: absolute; inset: 27px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff3c4, #ffb347 60%, #ff7a2f); box-shadow: 0 0 26px #ffb347; }
#loading .orbit::after { content: ""; position: absolute; top: -5px; left: 50%; width: 9px; height: 9px; margin-left: -4.5px; border-radius: 50%; background: #7db7ff; box-shadow: 0 0 10px #7db7ff; }
@keyframes spin { to { transform: rotate(360deg); } }
#loading h1 { font-size: 22px; font-weight: 650; letter-spacing: 0.02em; }
#loading p { color: var(--dim); margin-top: 8px; font-size: 13px; }
#notice { position: fixed; inset: 0; z-index: 200; display: none; place-items: center; background: #05070c; padding: 24px; }
#notice.show { display: grid; }
#notice .box { max-width: 560px; line-height: 1.6; }
#notice h1 { font-size: 22px; margin-bottom: 10px; }
#notice p { color: var(--dim); margin-top: 10px; }
#notice code { background: rgba(255, 255, 255, 0.08); padding: 2px 7px; border-radius: 5px; color: var(--text); font-family: ui-monospace, Consolas, monospace; font-size: 13px; }

/* ---------------------------------------------------------------- modes */
body.cinema #topbar, body.cinema #sidebar, body.cinema #info, body.cinema #dock, body.cinema #labels, body.cinema .popover { display: none !important; }

@media (max-width: 1180px) {
  .rung span { font-size: 9px; }
}
@media (max-width: 980px) {
  .brand em, #random-btn, #t-events { display: none; }
  .rung:nth-child(even) span { display: none; }
}
@media (max-width: 760px) {
  :root { --nav: min(300px, 84vw); }
  body.nav-open #dock { left: 10px; }
  .brand span { display: none; }
  #info { top: auto; bottom: 150px; left: 10px; right: 10px; width: auto; max-height: 38vh; transform: translateY(calc(100% + 170px)); }
  #dock { flex-direction: column; align-items: stretch; }
  #hud { max-width: none; min-width: 0; padding: 8px 12px; }
  .scale { display: none; }
  #timebar { justify-content: center; }
  #t-clock, #fullscreen-btn, #home-btn { display: none; }
  .pill-btn { padding: 0 11px; }
  #ladder { padding: 8px 14px 10px; }
  .rung span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
