:root {
  --ink: #f5f5f7;
  --dim: #a1a1a6;
  --faint: #6e6e73;
  --line: rgba(255, 255, 255, 0.12);
  --hover: rgba(255, 255, 255, 0.08);
  --accent: #ebc27a;
  --material: rgba(28, 28, 30, 0.7);
  --blur: saturate(180%) blur(20px);
  --sans: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', 'Segoe UI', system-ui, sans-serif;
  --serif: 'New York', ui-serif, 'Newsreader', Georgia, serif;
  --shadow: 0 0 10px #000, 0 0 2px #000;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; color: var(--ink); overflow: hidden; font: 400 13px/1.45 var(--sans); letter-spacing: -0.006em; -webkit-font-smoothing: antialiased; }
canvas#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; touch-action: none; }
button { font: inherit; color: var(--ink); background: none; border: 0; padding: 0; cursor: pointer; }
kbd { font: 600 1em var(--sans); color: var(--ink); }
.dim { color: var(--dim); margin-left: 8px; }
.panel { background: var(--material); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border: 1px solid var(--line); border-radius: 12px; }

/* ---- where am I ---- */
#where { position: fixed; top: 24px; left: 78px; pointer-events: none; max-width: 46vw; text-shadow: var(--shadow); }
#crumbs { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 6px; color: var(--dim); font-size: 12px; }
#crumbs li + li::before { content: '›'; margin-right: 6px; color: var(--faint); }
#place { margin: 4px 0 0; font: 600 38px/1.1 var(--serif); letter-spacing: -0.012em; }
#placeNote { margin: 4px 0 0; color: var(--dim); font-variant-numeric: tabular-nums; }

/* ---- the scale ladder: log10 metres from 1 m to the observable universe ---- */
#ladder { position: fixed; left: 24px; top: 128px; bottom: 150px; width: 44px; pointer-events: none; text-shadow: var(--shadow); }
#rail { position: absolute; left: 10px; top: 0; bottom: 0; border-left: 1px solid var(--line); }
#rail .tick { position: absolute; left: -4px; width: 8px; border-top: 1px solid var(--faint); }
#rail .tick span { position: absolute; left: 12px; top: -8px; white-space: nowrap; font-size: 11px; color: var(--faint); }
#rail .minor { left: -2px; width: 3px; border-color: var(--line); }
#rail .tick span { transition: opacity 0.2s; }
#rail .tick.under span { opacity: 0; }
#needle { position: absolute; left: 3px; width: 16px; height: 0; border-top: 2px solid var(--accent); transition: top 0.15s linear; }
#needle::after { content: ''; position: absolute; left: -5px; top: -6px; border: 5px solid transparent; border-left-color: var(--accent); }
#needleText { position: absolute; left: 22px; top: -9px; white-space: nowrap; color: var(--accent); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---- readout ---- */
#readout { position: fixed; left: 78px; bottom: 24px; display: grid; gap: 3px; text-shadow: var(--shadow); font-variant-numeric: tabular-nums; }
#readout .k { display: inline-block; width: 62px; color: var(--dim); font-size: 12px; }
#readout .k::first-letter, #cardKind::first-letter, #cardFacts dt::first-letter { text-transform: uppercase; }
#readout b { font-weight: 500; font-size: 14px; }

/* ---- destinations and search ---- */
#dest { position: fixed; top: 20px; right: 24px; display: flex; gap: 8px; align-items: flex-start; z-index: 5; }
.search { position: relative; }
#search {
  width: 260px; font: inherit; color: var(--ink); background: var(--material); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px 7px 32px; outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%23a1a1a6' stroke-width='1.6'%3E%3Ccircle cx='6' cy='6' r='4.6'/%3E%3Cpath d='M9.4 9.4 13 13' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 11px 50%;
}
#search::placeholder { color: var(--faint); }
#search:focus { border-color: rgba(235, 194, 122, 0.6); }
#results { position: absolute; top: 100%; left: 0; right: 0; margin: 6px 0 0; padding: 4px; list-style: none; }
#results:empty { display: none; }
#results li { padding: 6px 10px; border-radius: 6px; cursor: pointer; }
#results li:hover, #results li.on { background: var(--hover); }
#destBtn { padding: 7px 14px; border-radius: 8px; font-weight: 500; }
#destBtn:hover, #destBtn[aria-expanded='true'] { background: rgba(58, 58, 60, 0.8); }
#destList { position: absolute; top: 42px; right: 0; width: 340px; max-height: calc(100vh - 90px); overflow: auto; padding: 4px 6px 8px; scrollbar-width: thin; scrollbar-color: var(--faint) transparent; }
#destList h3 { margin: 14px 10px 4px; font-size: 12px; font-weight: 600; color: var(--dim); }
#destList button { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; width: 100%; padding: 5px 10px; border-radius: 6px; text-align: left; }
#destList button:hover { background: var(--hover); }
#destList button small { flex-shrink: 0; color: var(--dim); font-size: 12px; font-variant-numeric: tabular-nums; }

/* ---- selection card ---- */
#card { position: fixed; right: 24px; top: 70px; width: 300px; padding: 16px 18px 18px; }
#cardKind { margin: 0; color: var(--accent); font-size: 12px; font-weight: 500; }
#cardName { margin: 2px 0 10px; font: 600 28px/1.1 var(--serif); letter-spacing: -0.012em; }
#cardFacts { display: grid; grid-template-columns: auto 1fr; margin: 0 0 14px; font-variant-numeric: tabular-nums; }
#cardFacts dt, #cardFacts dd { padding: 5px 0; border-top: 1px solid var(--line); }
#cardFacts dt { color: var(--dim); padding-right: 12px; }
#cardFacts dd { margin: 0; text-align: right; }
.actions { display: flex; gap: 8px; }
.actions button { flex: 1; padding: 8px 12px; border-radius: 8px; font-weight: 600; }
.actions button kbd { font-weight: 500; opacity: 0.55; margin-left: 4px; color: inherit; }
#goBtn { background: var(--accent); color: #1d1a14; }
#goBtn:hover { background: #f3d299; }
#lookBtn { background: rgba(255, 255, 255, 0.1); }
#lookBtn:hover { background: rgba(255, 255, 255, 0.16); }

/* ---- current system ---- */
#sys { position: fixed; right: 24px; bottom: 92px; width: 250px; max-height: calc(100vh - 540px); min-height: 60px; overflow: auto; text-align: right; text-shadow: var(--shadow); scrollbar-width: none; }
#sys h3 { margin: 0; font-size: 15px; font-weight: 600; }
#sysMeta { margin: 1px 0 8px; color: var(--dim); font-size: 12px; }
#sysList { list-style: none; margin: 0; padding: 0; }
#sysList li { cursor: pointer; padding: 1px 0; font-size: 13.5px; font-weight: 500; }
#sysList li.moon { font-size: 12px; font-weight: 400; color: var(--dim); padding-right: 12px; }
#sysList li.star { color: #f6dfae; }
#sysList li:hover { color: var(--accent); }

/* ---- help ---- */
#help { position: fixed; right: 24px; bottom: 20px; text-align: right; color: var(--dim); font-size: 12px; text-shadow: var(--shadow); }
#help p { margin: 2px 0; }
#help.hide { display: none; }

/* ---- labels ---- */
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.lbl { position: absolute; transform: translate(10px, -50%); white-space: nowrap; font-size: 13px; font-weight: 500; color: var(--ink); text-shadow: var(--shadow); opacity: 0.92; }
.lbl::before { content: ''; position: absolute; left: -10px; top: 50%; width: 6px; border-top: 1px solid currentColor; opacity: 0.6; }
.lbl.moon { font-size: 12px; font-weight: 400; color: #c7c7cc; }
.lbl.star { color: #f6dfae; }
.lbl.galaxy { color: #cad5f2; }
.lbl.dso { color: #efb8aa; }
.lbl.sel { color: var(--accent); font-weight: 600; }
.lbl .d { font-size: 11px; font-weight: 400; color: var(--dim); margin-left: 6px; font-variant-numeric: tabular-nums; }

/* ---- boot ---- */
#boot { position: fixed; inset: 0; display: grid; place-items: center; background: #000; font: 400 24px var(--serif); color: var(--dim); transition: opacity 0.8s; }
#boot.gone { opacity: 0; pointer-events: none; }
#boot pre { font: 12px ui-monospace, monospace; color: #e0a080; }

@media (max-width: 760px) {
  #where { left: 60px; max-width: 70vw; }
  #place { font-size: 28px; }
  #card { top: auto; bottom: 90px; width: calc(100vw - 32px); right: 16px; }
  #help { display: none; }
  #search { width: 150px; }
}
