:root {
  --bg: #020408;
  --glass: rgba(8, 13, 22, 0.78);
  --glass-strong: rgba(7, 12, 21, 0.94);
  --line: rgba(171, 195, 219, 0.15);
  --line-strong: rgba(174, 206, 240, 0.3);
  --text: #eef3fa;
  --muted: #a0afc2;
  --faint: #788ba2;
  --accent: #aed9ff;
  --accent-2: #e8c69b;
  --good: #b4dfd8;
  --radius: 10px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
  /* notch / home indicator (viewport-fit=cover) */
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; color: var(--text); font-family: var(--sans); -webkit-font-smoothing: antialiased; overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
#gl, #overlay { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
/* touch: no grey tap flashes, no callouts / text selection on controls, no double-tap zoom on buttons */
#ui, #ui * { -webkit-tap-highlight-color: transparent; }
#ui button, #ui .result, #ui a, #ui summary { touch-action: manipulation; }
.topbar, .timebar, .scale, .view-button, .stats, .crumbs, .panel-head, .discover-filters, .toggles { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.sheet-grab { display: none; }
#gl { cursor: grab; touch-action: none; }
#gl:active { cursor: grabbing; }
#overlay { pointer-events: none; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.glass { background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 32px rgba(0,0,0,0.2); }
.eyebrow { color: var(--accent-2); font-size: 9px; font-weight: 600; letter-spacing: .2em; line-height: 1.6; }

/* A quiet perimeter leaves the sky open. */
.topbar { position: absolute; z-index: 9; top: 24px; left: 24px; display: flex; gap: 10px; align-items: center; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 17px; height: 48px; text-align: left; }
.brand-mark { position: relative; width: 21px; height: 21px; border: 1px solid #e9cba0; border-radius: 50%; }
.brand-mark::before { content: ''; position: absolute; inset: 4px -7px; border: 1px solid #e9cba0; border-radius: 50%; transform: rotate(-38deg); }
.brand-mark::after { content: ''; position: absolute; width: 4px; height: 4px; border-radius: 50%; background: #faf2e4; left: 8px; top: 8px; box-shadow: 0 0 10px #f3d09a; }
.brand-name { font-weight: 500; letter-spacing: .26em; font-size: 12px; line-height: 1.3; }
.brand-name > span { display: block; letter-spacing: .15em; font-size: 7px; color: var(--faint); margin-top: 4px; }
.search { position: relative; width: 285px; }
.search input { width: 100%; height: 48px; padding: 0 32px 0 39px; background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); font: 400 12px var(--sans); outline: none; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.search input::placeholder { color: var(--muted); }
.search input:focus { border-color: var(--line-strong); background: var(--glass-strong); }
.search svg { position: absolute; left: 14px; top: 16px; opacity: .6; z-index: 2; pointer-events: none; }
.search .kbd { z-index: 2; pointer-events: none; position: absolute; right: 12px; top: 15px; font: 400 10px var(--mono); color: var(--faint); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.results { position: absolute; top: 56px; left: 0; width: max(100%, 370px); max-height: 65vh; overflow-y: auto; padding: 6px; display: none; background: var(--glass-strong); }
.results.open { display: block; }
.result { display: flex; align-items: center; gap: 10px; padding: 11px 10px; border-radius: 6px; cursor: pointer; }
.result:hover, .result.active { background: rgba(140,200,255,.1); }
.result .dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.result .nm { font-size: 12px; font-weight: 500; }
.result .ty { margin-left: auto; font-size: 10px; color: var(--muted); white-space: nowrap; }
.result .al { font-size: 10px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 90px; }
.discover-button, .view-button { height: 48px; padding: 0 17px; font-size: 12px; display: flex; align-items: center; justify-content: center; gap: 9px; }
.discover-button { color: var(--accent-2); }
.compass-icon { font-size: 23px; line-height: 1; }
.discover-button:hover, .view-button:hover, .brand:hover { border-color: var(--line-strong); background: var(--glass-strong); }
.discover-button[aria-expanded="true"], .view-button[aria-expanded="true"] { border-color: var(--line-strong); }
.view-actions { position: absolute; right: 24px; top: 24px; z-index: 8; display: flex; align-items: center; gap: 14px; }
#ui > .view-actions { pointer-events: none; }
.view-actions > * { pointer-events: auto; }
.site-credit { display: flex; align-items: center; min-height: 48px; color: var(--muted); font-size: .75rem; line-height: 1.5; white-space: nowrap; text-decoration: none; text-shadow: 0 1px 5px #000; }
.site-credit:hover { color: var(--text); text-decoration: underline; text-underline-offset: 4px; }
.view-button > span { font-size: 18px; }

/* Discover is an optional navigator, never a wall over the opening view. */
.discover { position: absolute; top: 84px; left: 24px; z-index: 10; width: 390px; max-height: calc(100vh - 180px); display: none; flex-direction: column; overflow: hidden; background: var(--glass-strong); }
.discover.open { display: flex; animation: panelIn .18s ease-out; }
.discover-head { position: relative; padding: 21px 22px 14px; }
.discover-head h2 { font-size: 23px; font-weight: 400; letter-spacing: -.035em; margin: 5px 0 0; }
.discover-filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 20px 15px; border-bottom: 1px solid var(--line); }
.discover-filter { padding: 6px 10px; border: 1px solid transparent; border-radius: 5px; font-size: 10px; color: var(--muted); background: rgba(255,255,255,.035); }
.discover-filter:hover { color: var(--text); }
.discover-filter.active { background: rgba(174,217,255,.11); border-color: rgba(174,217,255,.22); color: var(--accent); }
.discover-list { padding: 7px 10px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.destination { display: flex; width: 100%; align-items: center; gap: 14px; text-align: left; border: 1px solid transparent; border-radius: 7px; background: transparent; padding: 11px 10px; }
.destination:hover { background: rgba(174,217,255,.06); border-color: var(--line); }
.destination-copy { min-width: 0; }
.destination-copy strong { display: block; font-size: 12px; font-weight: 500; }
.destination-copy small { display: block; font-size: 10px; color: var(--faint); margin-top: 4px; }
.destination-arrow { margin-left: auto; color: var(--faint); font-size: 17px; }
.destination:hover .destination-arrow { color: var(--accent); }
.destination-icon { width: 28px; height: 28px; border-radius: 50%; flex: none; position: relative; opacity: .85; }
.destination-icon.planet { border: 1px solid #91b5cf; background: linear-gradient(110deg, #9eb2c5, #203b50 60%, #0b1017); }
.destination-icon.star { background: radial-gradient(circle, #fff3d9 0 12%, #e7c38e 15%, rgba(231,195,142,.13) 35%, transparent 65%); }
.destination-icon.star::before, .destination-icon.star::after { content: ''; position: absolute; background: linear-gradient(90deg, transparent, #efd0a4, transparent); width: 28px; height: 1px; left: 0; top: 13px; }
.destination-icon.star::after { transform: rotate(90deg); }
.destination-icon.black-hole { border: 1px solid #d8ae82; box-shadow: 0 0 8px #c7864938, inset 0 0 6px #dfa76544; }
.destination-icon.black-hole::after { content: ''; position: absolute; inset: 9px -6px; border: 1px solid #e6bf8b; border-radius: 50%; transform: rotate(-22deg); }
.destination-icon.galaxy { background: radial-gradient(ellipse, #f3debf 0, #9dbfda 12%, #799bb650 32%, transparent 65%); transform: rotate(-35deg) scaleY(.6); }
.destination-icon.nebula { border-radius: 40% 65% 45% 55%; background: radial-gradient(ellipse at 35% 35%, #c0a1cd66, transparent 65%), radial-gradient(ellipse at 70% 60%, #7facd488, transparent 65%); }
.discover-foot { padding: 13px 20px; color: var(--faint); border-top: 1px solid var(--line); font-size: 10px; }
.discover-empty { color: var(--muted); font-size: 12px; padding: 10px; line-height: 1.7; }
@keyframes panelIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }

.crumbs { position: absolute; top: 85px; left: 27px; display: flex; align-items: center; gap: 7px; max-width: calc(100vw - 430px); overflow: hidden; white-space: nowrap; padding: 0; background: none; border: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.crumbs .c { padding: 3px 0; border: 0; background: none; font-size: 10px; color: var(--muted); text-shadow: 0 1px 5px #000; }
.crumbs .c:hover, .crumbs .c.cur { color: var(--text); }
.crumbs .sep { color: var(--faint); font-size: 10px; margin: 0 3px; }
.toggles { position: absolute; z-index: 10; top: 84px; right: 24px; display: none; flex-direction: column; gap: 3px; padding: 8px; width: 222px; max-height: calc(100vh - 170px); overflow-y: auto; background: var(--glass-strong); }
.toggles.open { display: flex; animation: panelIn .18s ease-out; }
.tbtn { min-height: 36px; min-width: 32px; padding: 0 11px; border-radius: 5px; border: 1px solid transparent; background: transparent; color: var(--muted); font-size: 11px; font-weight: 400; display: flex; align-items: center; gap: 9px; text-align: left; }
.tbtn:hover { color: var(--text); background: rgba(255,255,255,.05); }
.tbtn.on { color: var(--accent); background: rgba(140,200,255,.08); border-color: rgba(140,200,255,.13); }
.tbtn .k { margin-left: auto; font: 400 10px var(--mono); color: var(--faint); }

/* The selected object's field notes. */
.panel { position: absolute; z-index: 6; top: 88px; right: 24px; width: 364px; max-height: calc(100vh - 180px); overflow: hidden; display: flex; flex-direction: column; transform: translateX(calc(100% + 30px)); opacity: 0; visibility: hidden; transition: transform .3s cubic-bezier(.2,.8,.2,1), opacity .25s, visibility .25s; }
.panel.open { transform: none; opacity: 1; visibility: visible; }
.panel-head { padding: 22px 22px 17px; border-bottom: 1px solid var(--line); position: relative; }
.panel-close { position: absolute; right: 12px; top: 12px; width: 30px; height: 30px; border-radius: 6px; border: none; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; }
.panel-close:hover { background: rgba(255,255,255,.08); color: var(--text); }
.badge { display: inline-flex; align-items: center; gap: 7px; max-width: calc(100% - 24px); font-size: 9px; letter-spacing: .15em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.badge i { width: 5px; height: 5px; border-radius: 50%; display: inline-block; flex: none; }
.panel h1 { margin: 11px 0 5px; font-size: 30px; font-weight: 400; letter-spacing: -.035em; line-height: 1.15; }
.panel .aka { font-size: 10px; color: var(--faint); line-height: 1.65; }
.panel .actions { display: flex; gap: 8px; margin-top: 17px; flex-wrap: wrap; }
.abtn { height: 33px; padding: 0 13px; border-radius: 6px; border: 1px solid var(--line-strong); background: rgba(140,200,255,.08); color: var(--text); font-size: 11px; font-weight: 500; display: inline-flex; align-items: center; gap: 7px; text-decoration: none; }
.abtn:hover { background: rgba(140,200,255,.17); }
.abtn.primary { background: #b9d7ee; color: #132332; border-color: #c0ddef; }
.abtn.primary:hover { background: #d0e7f8; }
.abtn.ghost { background: transparent; color: var(--muted); }
.panel-body { overflow-y: auto; padding: 18px 22px 22px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.panel-body p { margin: 0 0 16px; font-size: 12px; line-height: 1.75; color: #bac8db; }
.summary { font-size: 12px !important; color: var(--text) !important; }
.data-context { margin: 4px 0 21px; border-left: 2px solid #bc9c6c66; padding-left: 10px; }
.data-context summary { color: var(--accent-2); font-size: 10px; line-height: 1.6; cursor: pointer; }
.data-context p { font-size: 11px; margin: 9px 0 0; color: var(--muted); }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin: 4px 0 20px; }
.fact { background: rgba(8,13,22,.92); padding: 10px 11px; min-width: 0; }
.fact.wide { grid-column: span 2; }
.fact .fl { font-size: 8px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); font-weight: 500; margin-bottom: 5px; line-height: 1.5; }
.fact .fv { font-size: 12px; color: var(--text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.section-t { font-size: 9px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-weight: 500; margin: 6px 0 10px; }
.live .fv { color: var(--good); font-family: var(--mono); font-size: 10px; line-height: 1.7; }
.proc-chip { margin-left: 4px; padding: 2px 6px; border-radius: 3px; border: 1px solid rgba(232,198,155,.35); color: var(--accent-2); font-size: 8px; letter-spacing: .12em; }
.data-context.procedural { border-left-color: #e8c69baa; background: rgba(232,198,155,.05); padding: 8px 10px; border-radius: 0 6px 6px 0; }
.children { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 8px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--line); }
.child { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 11px; border: 0; background: rgba(8,13,22,.92); text-align: left; min-width: 0; }
.child:hover { background: rgba(28,40,58,.95); }
.child i { width: 5px; height: 5px; border-radius: 50%; flex: none; }
.child-name { font-size: 11px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.child-type { margin-left: auto; font-size: 9px; color: var(--faint); white-space: nowrap; padding-left: 8px; }
.child-more { font-size: 10px; color: var(--faint); margin: 0 0 20px; }
.crumbs .c.proc { font-style: italic; }
.crumbs .c.proc::before { content: '◇ '; color: var(--accent-2); font-style: normal; }

.scale { position: absolute; left: 24px; bottom: 24px; width: 280px; padding: 15px 17px 0; }
.scale .dist { font: 400 26px var(--sans); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.scale .dist small { font-size: 9px; color: var(--muted); font-weight: 400; letter-spacing: .11em; text-transform: uppercase; display: block; margin-bottom: 5px; }
.scale .span { font-size: 10px; color: var(--faint); margin-top: 5px; font-variant-numeric: tabular-nums; }
.scale-toggle { display: flex; justify-content: space-between; gap: 8px; width: calc(100% + 34px); margin: 13px -17px 0; padding: 10px 17px; border: 0; border-top: 1px solid var(--line); background: none; font-size: 9px; color: var(--faint); text-align: left; }
.scale-current { color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 135px; }
.scale-chevron { margin-left: 5px; }
.ladder { position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); display: none; flex-direction: column-reverse; gap: 1px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--glass-strong); max-height: calc(100vh - 275px); overflow-y: auto; }
.scale.expanded .ladder { display: flex; }
.scale.expanded .scale-chevron { display: inline-block; transform: rotate(180deg); }
.rung { display: flex; align-items: center; gap: 10px; font-size: 10px; color: var(--muted); padding: 6px 6px; border: 0; background: none; border-radius: 4px; text-align: left; }
.rung:hover { color: var(--text); background: rgba(255,255,255,.05); }
.rung .tick { width: 12px; height: 1px; background: currentColor; opacity: .5; flex: none; }
.rung.cur { color: var(--accent); }
.rung.cur .tick { width: 18px; height: 2px; opacity: 1; }

.timebar { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 4px; padding: 6px 8px 6px 15px; }
.timebar .date { font: 400 10px var(--mono); min-width: 190px; font-variant-numeric: tabular-nums; color: #bdc9d9; }
.timebar .rate { font: 400 9px var(--mono); color: var(--muted); min-width: 65px; text-align: center; }
.tb { height: 29px; min-width: 29px; padding: 0 7px; border-radius: 5px; border: none; background: transparent; color: var(--muted); font-size: 11px; }
.tb:hover { background: rgba(255,255,255,.07); color: var(--text); }
.stats { position: absolute; right: 27px; bottom: 30px; font: 400 10px var(--mono); color: var(--muted); text-align: right; line-height: 1.7; text-shadow: 0 1px 6px #000; }
.fps-value { color: var(--text); }
.stats-sep { color: var(--faint); padding: 0 4px; }
.quality-value { display: block; color: var(--faint); font-size: 8px; }

.help { position: absolute; z-index: 30; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,.65); }
.help.open { display: flex; }
.help-card { position: relative; width: 590px; max-width: calc(100vw - 32px); max-height: calc(100vh - 40px); overflow-y: auto; padding: 28px 30px; background: var(--glass-strong); scrollbar-width: thin; }
.help-card h2 { margin: 8px 0 10px; font-size: 25px; font-weight: 400; letter-spacing: -.03em; }
.help-card .sub { color: var(--muted); font-size: 12px; margin-bottom: 21px; line-height: 1.7; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; font-size: 11px; }
.keys kbd { font: 400 10px var(--mono); background: rgba(255,255,255,.06); border: 1px solid var(--line-strong); border-radius: 4px; padding: 2px 5px; color: var(--text); white-space: nowrap; }
.keys div:nth-child(odd) { text-align: right; }
.keys div:nth-child(even) { color: #bac8db; }
.science-note { border-top: 1px solid var(--line); margin-top: 25px; padding-top: 20px; color: var(--accent-2); font-size: 11px; line-height: 1.75; }
.science-note b { font-weight: 500; }
.science-note p { color: var(--muted); font-size: 11px; margin: 9px 0 0; }
.toast { position: absolute; z-index: 20; bottom: 86px; left: 50%; transform: translateX(-50%) translateY(20px); padding: 11px 16px; font-size: 12px; opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none !important; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.hint { position: absolute; bottom: 91px; left: 50%; transform: translateX(-50%); padding: 12px 17px; font-size: 11px; color: var(--muted); white-space: nowrap; transition: opacity .8s, transform .8s; pointer-events: none !important; animation: hintIn 1.2s 2.2s both; }
.hint b { color: var(--text); font-weight: 400; }
.hint-orbit { color: var(--accent-2); margin-right: 6px; }
.hint.gone { animation: none; opacity: 0; transform: translateX(-50%) translateY(10px); }
/* Select-and-scroll: a quiet reminder that the selection can be approached. */
.approach { position: absolute; bottom: 91px; left: 50%; transform: translateX(-50%) translateY(8px); display: flex; align-items: center; gap: 8px; padding: 9px 15px; font-size: 11px; color: var(--muted); white-space: nowrap; opacity: 0; transition: opacity .35s, transform .35s; pointer-events: none !important; max-width: calc(100vw - 48px); }
.approach.show { opacity: 1; transform: translateX(-50%); }
.approach b { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; display: inline-block; max-width: 260px; vertical-align: bottom; }
.approach kbd { font: 400 9px var(--mono); background: rgba(255,255,255,.06); border: 1px solid var(--line-strong); border-radius: 4px; padding: 1px 5px; color: var(--text); }
.approach-icon { color: var(--accent); font-size: 13px; }
.approach-sep { color: var(--faint); }
@keyframes hintIn { from { opacity: 0; transform: translateX(-50%) translateY(12px); } to { opacity: 1; transform: translateX(-50%); } }

#loading { position: fixed; inset: 0; background: radial-gradient(ellipse at 50% 60%, #0b1422 0%, #020408 70%); display: flex; align-items: center; justify-content: center; z-index: 40; transition: opacity 1.2s ease; }
#loading.done { opacity: 0; pointer-events: none; }
.load-inner { text-align: center; width: 360px; max-width: calc(100vw - 32px); }
.load-title { font-weight: 300; letter-spacing: .6em; font-size: 30px; margin-right: -.6em; }
.load-sub { color: var(--muted); font-size: 12px; margin: 17px 0 28px; line-height: 1.7; }
.load-bar { height: 1px; background: rgba(255,255,255,.08); border-radius: 2px; overflow: hidden; }
.load-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #8baece, #e4c497); transition: width .4s; }
.load-status { margin-top: 14px; font: 400 10px var(--mono); color: var(--faint); min-height: 14px; }

@media (max-width: 1200px) {
  .scale { bottom: 85px; }
  .timebar { left: 24px; transform: none; }
  .hint { bottom: 88px; left: auto; right: 24px; transform: none; white-space: normal; max-width: 300px; line-height: 1.7; animation: none; }
  .hint span:not(.hint-orbit) { display: block; }
  .hint.gone { transform: translateY(10px); }
  .approach { left: auto; right: 24px; transform: translateY(8px); }
  .approach.show { transform: none; }
}
@media (max-width: 900px) {
  .topbar { top: 16px; left: 16px; gap: 8px; }
  .brand { height: 44px; padding: 0 14px; }
  .search { width: 235px; }
  .search input, .discover-button, .view-button { height: 44px; }
  .search svg { top: 14px; }
  .search .kbd { top: 13px; }
  .view-actions { top: 16px; right: 16px; flex-direction: column-reverse; align-items: flex-end; gap: 2px; }
  .site-credit { min-height: 30px; }
  .view-button { padding: 0 12px; }
  .discover { left: 16px; top: 72px; }
  .toggles { top: 72px; right: 16px; }
  .crumbs { top: 74px; left: 18px; max-width: calc(100vw - 250px); }
  .panel { right: 16px; top: 100px; width: 338px; max-height: calc(100vh - 185px); }
  .scale { left: 16px; width: 245px; }
  .scale .dist { font-size: 23px; }
  .scale-current { max-width: 100px; }
  .timebar { left: 16px; bottom: 16px; }
  .stats { right: 16px; bottom: 21px; font-size: 9px; }
  .quality-value { font-size: 7px; }
  .timebar .rate { display: none; }
}
/* ---------------------------------------------------------------- phones (portrait) ---
   One header row (mark, search, Discover, View), the sky in the middle, the distance card and time bar at the
   bottom; the selected object's notes are a bottom sheet: a peek with name and actions, dragged up for everything. */
@media (max-width: 650px) {
  .topbar { top: calc(10px + var(--sat)); left: calc(10px + var(--sal)); right: calc(62px + var(--sar)); gap: 8px; }
  .brand { flex: none; width: 44px; height: 44px; padding: 0; justify-content: center; gap: 0; }
  .brand-name { display: none; }
  .brand-mark { width: 19px; height: 19px; }
  .brand-mark::after { top: 7px; left: 7px; }
  .search { position: relative; top: auto; left: auto; flex: 1; width: auto; min-width: 0; }
  .search input { height: 44px; font-size: 16px; padding-left: 38px; }     /* 16 px: iOS does not zoom into the field */
  .search svg { top: 14px; }
  .search .kbd { display: none; }
  .results { position: fixed; top: calc(62px + var(--sat)); left: calc(10px + var(--sal)); right: calc(10px + var(--sar)); width: auto; max-height: calc(100dvh - 150px - var(--sat)); overscroll-behavior: contain; }
  .result .al { display: none; }
  .result .nm { font-size: 14px; }
  .result .ty { max-width: 130px; white-space: normal; text-align: right; font-size: 11px; }
  .discover-button { flex: none; width: 44px; height: 44px; padding: 0; gap: 0; font-size: 0; }
  .compass-icon { font-size: 20px; }
  .view-actions { top: calc(10px + var(--sat)); right: calc(10px + var(--sar)); }
  .view-button { width: 44px; height: 44px; padding: 0; gap: 0; font-size: 0; }
  .view-button > span { font-size: 19px; }
  .crumbs { display: none; }
  .discover { top: calc(62px + var(--sat)); left: calc(10px + var(--sal)); right: calc(10px + var(--sar)); width: auto; max-height: calc(100dvh - 82px - var(--sat) - var(--sab)); }
  .discover-head { padding: 18px 18px 12px; }
  .discover-head h2 { font-size: 23px; }
  .discover-filters { gap: 6px; padding: 0 16px 14px; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .discover-filters::-webkit-scrollbar { display: none; }
  .discover-filter { flex: none; }
  .discover-list { overscroll-behavior: contain; }
  .destination-copy strong { font-size: 14px; }
  .destination-copy small { font-size: 11px; }
  .toggles { top: calc(62px + var(--sat)); right: calc(10px + var(--sar)); width: 236px; max-height: calc(100dvh - 82px - var(--sat) - var(--sab)); }
  .tbtn { font-size: 13px; }

  /* bottom sheet */
  .panel { top: auto; left: var(--sal); right: var(--sar); bottom: 0; width: auto; max-height: calc(100dvh - 58px - var(--sat)); border-radius: 18px 18px 0 0; border-bottom: 0; background: var(--glass-strong); padding-bottom: var(--sab);
    transform: translateY(calc(100% + 24px)); transition: transform .34s cubic-bezier(.2,.8,.2,1), opacity .2s, visibility .34s; }
  .panel.open { transform: translateY(calc(100% - var(--peek, 190px))); }
  .panel.open.expanded { transform: none; }
  .panel.dragging { transition: none; }
  .sheet-grab { display: block; flex: none; height: 22px; touch-action: none; cursor: grab; position: relative; }
  .sheet-grab::before { content: ''; position: absolute; left: 50%; top: 8px; width: 38px; height: 5px; margin-left: -19px; border-radius: 3px; background: rgba(255,255,255,.3); }
  .panel-head { padding: 2px 18px 14px; touch-action: none; }
  .panel-close { top: 6px; right: 8px; width: 40px; height: 40px; font-size: 24px; }
  .panel h1 { font-size: 26px; margin: 8px 0 4px; }
  .panel .aka { font-size: 11px; }
  .panel .actions { margin-top: 13px; }
  .panel-body { padding: 14px 18px 22px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .panel:not(.expanded) .panel-body { overflow: hidden; }
  .panel-body p { font-size: 14px; line-height: 1.7; }
  .summary { font-size: 14px !important; }
  .data-context summary { font-size: 12px; }
  .data-context p { font-size: 13px; }
  .fact .fl { font-size: 9px; }
  .fact .fv { font-size: 13px; }
  .live .fv { font-size: 11px; }
  .section-t { font-size: 10px; }
  .child-name { font-size: 13px; }
  .child-type { font-size: 10px; }
  .child-more { font-size: 11px; }
  /* the sheet takes the bottom: distance card, time bar and read-outs step aside */
  #ui.sheet-open .scale, #ui.sheet-open .timebar, #ui.sheet-open .stats, #ui.sheet-open .hint { opacity: 0; transform: translateY(14px); pointer-events: none !important; transition: opacity .2s, transform .2s; }

  .scale { left: calc(10px + var(--sal)); bottom: calc(62px + var(--sab)); width: min(236px, calc(100vw - 132px)); padding: 11px 13px 0; }
  .scale .dist { font-size: 21px; }
  .scale .dist small { font-size: 8px; }
  .scale .span { font-size: 10px; }
  .scale-toggle { margin-left: -13px; margin-right: -13px; width: calc(100% + 26px); padding: 11px 13px; font-size: 10px; margin-top: 9px; }
  .scale-current { max-width: 110px; }
  .ladder { max-height: calc(100dvh - 330px - var(--sat) - var(--sab)); }
  .rung { font-size: 13px; padding: 9px 8px; }
  .timebar { left: calc(10px + var(--sal)); right: calc(10px + var(--sar)); bottom: calc(10px + var(--sab)); transform: none; gap: 2px; padding: 4px 6px 4px 12px; justify-content: space-between; }
  .timebar .date { min-width: 0; font-size: 10px; }
  .stats { right: calc(14px + var(--sar)); bottom: calc(68px + var(--sab)); font-size: 9px; max-width: calc(100vw - 270px); }
  .resolution-value { display: block; font-size: 8px; }
  .stats-sep { display: none; }
  .quality-value { display: none; }
  .hint { bottom: calc(190px + var(--sab)); right: calc(12px + var(--sar)); left: calc(12px + var(--sal)); text-align: center; max-width: none; padding: 11px; font-size: 12px; }
  .hint span:not(.hint-orbit) { display: inline; }
  .approach { bottom: calc(190px + var(--sab)); left: calc(12px + var(--sal)); right: calc(12px + var(--sar)); white-space: normal; flex-wrap: wrap; justify-content: center; font-size: 12px; }
  #ui.sheet-open .approach { bottom: calc(var(--peek, 190px) + 12px); }
  .approach-sep { display: none; }
  .toast { bottom: calc(190px + var(--sab)); max-width: calc(100vw - 32px); text-align: center; }
  .help-card { padding: 24px 20px; max-height: calc(100dvh - 40px - var(--sat) - var(--sab)); }
  .keys { gap: 11px 12px; font-size: 13px; }
  .keys kbd { font-size: 11px; padding: 3px 5px; }
}

/* ---------------------------------------------------------------- phones (landscape) ---
   Height is scarce: one header row, the notes as a side sheet on the right, distance and time along the bottom. */
@media (pointer: coarse) and (max-height: 500px) and (min-width: 560px) {
  .topbar { top: calc(8px + var(--sat)); left: calc(10px + var(--sal)); gap: 8px; }
  .brand { width: 42px; height: 42px; padding: 0; justify-content: center; gap: 0; }
  .brand-name { display: none; }
  .search { width: min(300px, 40vw); }
  .search input { height: 42px; font-size: 16px; }
  .search svg { top: 13px; }
  .search .kbd { display: none; }
  .results { max-height: calc(100dvh - 70px - var(--sat)); }
  .discover-button { height: 42px; width: 42px; padding: 0; gap: 0; font-size: 0; }
  .compass-icon { font-size: 19px; }
  .view-actions { top: calc(8px + var(--sat)); right: calc(10px + var(--sar)); flex-direction: row; align-items: center; gap: 10px; }
  .site-credit { max-width: 140px; white-space: normal; text-align: right; }
  .view-button { height: 42px; width: 42px; padding: 0; gap: 0; font-size: 0; }
  .view-button > span { font-size: 18px; }
  .crumbs { display: none; }
  .discover { top: calc(58px + var(--sat)); left: calc(10px + var(--sal)); width: min(400px, 58vw); max-height: calc(100dvh - 68px - var(--sat) - var(--sab)); }
  .toggles { top: calc(58px + var(--sat)); right: calc(10px + var(--sar)); max-height: calc(100dvh - 68px - var(--sat) - var(--sab)); }
  .panel { top: calc(58px + var(--sat)); right: calc(10px + var(--sar)); bottom: calc(10px + var(--sab)); width: min(360px, 46vw); max-height: none; }
  .panel-head { padding: 16px 18px 12px; }
  .panel h1 { font-size: 23px; }
  .panel-body p { font-size: 13px; }
  .scale { left: calc(10px + var(--sal)); bottom: calc(10px + var(--sab)); width: 214px; padding: 9px 12px 0; }
  .scale .dist { font-size: 19px; }
  .scale-toggle { margin: 7px -12px 0; width: calc(100% + 24px); padding: 8px 12px; }
  .ladder { max-height: calc(100dvh - 150px - var(--sat) - var(--sab)); }
  .timebar { left: calc(234px + var(--sal)); bottom: calc(10px + var(--sab)); transform: none; padding: 4px 6px 4px 12px; }
  .timebar .date { min-width: 0; font-size: 10px; }
  .timebar .rate { display: none; }
  .stats { display: none; }
  .hint, .approach, .toast { bottom: calc(118px + var(--sab)); left: 50%; right: auto; transform: translateX(-50%); max-width: calc(100vw - 420px); white-space: normal; text-align: center; }
  .approach.show { transform: translateX(-50%); }
  .hint.gone { transform: translateX(-50%) translateY(10px); }
  .help-card { max-height: calc(100dvh - 24px); }
}

/* ---------------------------------------------------------------- touch targets --- */
@media (pointer: coarse) {
  .tbtn { min-height: 44px; }
  .tb { height: 38px; min-width: 38px; font-size: 13px; }
  .abtn { height: 40px; padding: 0 16px; font-size: 13px; }
  .discover-filter { padding: 9px 12px; font-size: 12px; }
  .destination { padding: 12px 10px; }
  .child { padding: 11px 12px; }
  .result { padding: 13px 10px; }
  .rung { padding: 9px 8px; }
  .scale-toggle { min-height: 40px; }
  .data-context summary { padding: 4px 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
/* HST catalogue overlay: bounded measured source samples, independent of scene quality. */
.catalogue-hud { position: absolute; top: 112px; left: 28px; width: min(320px, calc(100vw - 56px)); padding: 12px 14px; border-radius: 13px; display: grid; gap: 5px; pointer-events: auto; }
.catalogue-hud[hidden], .destination[hidden] { display: none; }
.catalogue-title { color: var(--text); font-size: 12px; font-weight: 500; }
.catalogue-count { color: var(--muted); font-size: 11px; line-height: 1.5; }
.catalogue-note { color: var(--faint); font-size: 10px; line-height: 1.4; }
.catalogue-hud button { border: 0; background: none; padding: 7px 0 0; text-align: left; color: #b8ddff; font: inherit; font-size: 11px; cursor: pointer; }
.catalogue-intro { color: var(--muted); font-size: 12px; line-height: 1.7; padding: 0 10px; }
.catalogue-filter { width: calc(100% - 20px); margin: 8px 10px 12px; padding: 12px; border: 1px solid #ffffff25; border-radius: 8px; background: #0005; color: var(--text); font: inherit; font-size: 13px; }
.panel h1, .destination-copy strong { overflow-wrap: anywhere; }
.discover-head, .discover-filters, .discover-foot { flex-shrink: 0; }
.discover-list { min-height: 0; }
@media (max-width: 650px) {
  .catalogue-hud { top: calc(66px + var(--sat)); left: calc(10px + var(--sal)); width: calc(100vw - 20px - var(--sal) - var(--sar)); padding: 9px 12px; gap: 3px; }
  .catalogue-note { display: none; }
  .catalogue-hud button { min-height: 32px; padding: 4px 0; }
  .sheet-open .catalogue-hud { display: none; }
}
