/* The interface stays quiet so the changing density of the canvas carries scale. */
:root {
  color-scheme: dark;
  --night: #080b0d;
  --ink: #e8dfcf;
  --muted: #a39e94;
  --faint: #726f67;
  --gold: #c3a675;
  --hairline: rgba(232, 223, 207, .17);
  --soft-line: rgba(232, 223, 207, .09);
  --side: clamp(24px, 4.45vw, 72px);
  --ui: 'Manrope', sans-serif;
  --editorial: 'Bodoni Moda', Georgia, serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: var(--night); color: var(--ink); font: 400 13px/1.6 var(--ui); -webkit-font-smoothing: antialiased; }
button, select, input { font: inherit; }
button { color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 5px; }
button:disabled { opacity: .3; cursor: default; }
button, a, input, select { touch-action: manipulation; }
[hidden] { display: none !important; }
::selection { background: var(--gold); color: var(--night); }

.app-shell { width: 100%; height: 100%; min-height: 480px; position: relative; isolation: isolate; }
#cosmos { position: fixed; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; }
/* Edge shading reserves readable space without obscuring the central observatory. */
.app-shell::before {
  content: ''; position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, rgba(8,11,13,.58), transparent 21%, transparent 65%, rgba(8,11,13,.75)),
    linear-gradient(90deg, rgba(8,11,13,.28), transparent 48%, rgba(8,11,13,.12));
}

.site-header, .realm-caption, .selection-panel, .explore-controls, .scale-dock,
.connection-toggle, .journey-status, .help-panel, .toast { position: absolute; z-index: 2; }
.site-header, .realm-caption, .explore-controls, .scale-dock { pointer-events: none; }
button, select, input, a, .selection-panel, .help-panel, .connection-toggle { pointer-events: auto; }
.site-header { top: 35px; left: var(--side); right: var(--side); display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; column-gap: 15px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 27px; height: 27px; flex: 0 0 27px; position: relative; display: inline-block; border: 1px solid var(--gold); border-radius: 50%; font-size: 0; }
.brand-mark::before { content: ''; position: absolute; inset: 6px; border: 1px solid var(--gold); border-radius: 50%; opacity: .65; }
.brand-mark::after { content: ''; position: absolute; width: 37px; height: 1px; background: var(--gold); left: -6px; top: 12px; transform: rotate(-43deg); opacity: .7; }
.brand-name { font-size: 15px; font-weight: 500; letter-spacing: .2em; text-transform: uppercase; }
.brand-subtitle { display: block; margin-left: 4px; padding-left: 18px; border-left: 1px solid var(--hairline); color: var(--muted); font-size: 10px; font-weight: 400; letter-spacing: .17em; text-transform: uppercase; }
.header-actions { display: flex; align-items: center; gap: 20px; }
.quiet-button { border: 0; background: transparent; padding: 10px 0; color: var(--muted); font-size: 11px; letter-spacing: .04em; transition: color 180ms ease; }
.quiet-button:hover, .quiet-button[aria-pressed='true'], .quiet-button[aria-expanded='true'] { color: var(--ink); }
.quiet-button svg { width: 16px; height: 16px; vertical-align: middle; }

.realm-caption { left: var(--side); bottom: clamp(232px, 28vh, 320px); width: min(480px, 44vw); transition: opacity 280ms ease, transform 400ms ease; }
.eyebrow, .panel-kicker { display: block; margin: 0 0 13px; color: var(--gold); text-transform: uppercase; font-size: 10px; letter-spacing: .21em; font-weight: 500; }
#realm-name { margin: 0 0 18px -4px; max-width: 540px; font: 400 clamp(60px, 7.2vw, 112px)/.98 var(--editorial); letter-spacing: -.045em; text-wrap: balance; }
#realm-description { margin: 0; max-width: 350px; color: #b3ada1; font-size: 12px; line-height: 1.95; text-wrap: pretty; }
.realm-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 17px; margin-top: 24px; font-size: 10px; letter-spacing: .055em; color: var(--muted); }
#realm-scale { color: var(--ink); font-variant-numeric: tabular-nums; }
#realm-evidence { display: flex; gap: 7px; align-items: center; }
#realm-evidence::before { content: ''; width: 4px; height: 4px; border: 1px solid var(--gold); border-radius: 50%; }

.connection-toggle { right: var(--side); top: 105px; display: flex; align-items: center; gap: 9px; cursor: pointer; color: var(--muted); font-size: 10px; letter-spacing: .055em; }
.connection-toggle input { position: absolute; opacity: 0; width: 30px; height: 24px; margin: 0; }
.toggle-track { display: inline-block; position: relative; width: 25px; height: 13px; border: 1px solid var(--hairline); border-radius: 9px; transition: border-color 180ms; }
.toggle-track::after { content: ''; width: 5px; height: 5px; position: absolute; left: 3px; top: 3px; border-radius: 50%; background: var(--faint); transition: transform 180ms ease, background 180ms ease; }
.connection-toggle input:checked + .toggle-track { border-color: rgba(195,166,117,.65); }
.connection-toggle input:checked + .toggle-track::after { transform: translateX(12px); background: var(--gold); }
.connection-toggle input:focus-visible + .toggle-track { outline: 2px solid var(--gold); outline-offset: 5px; }
.journey-status { left: 50%; top: 103px; transform: translateX(-50%); max-width: 48%; color: var(--muted); font-size: 10px; letter-spacing: .1em; text-align: center; pointer-events: none; }

/* A selected object's roles read like marginal notes, rather than an app drawer. */
.selection-panel { width: 264px; top: 30%; right: var(--side); padding-left: 24px; border-left: 1px solid rgba(195,166,117,.38); background: linear-gradient(90deg, rgba(8,11,13,.2), rgba(8,11,13,.65)); animation: panel-arrive 320ms ease both; }
.panel-kicker { margin-bottom: 10px; }
#selection-name { margin: 0 18px 11px 0; font: 400 31px/1.15 var(--editorial); letter-spacing: -.02em; }
#selection-description { margin: 0 0 20px; color: #b3ada1; font-size: 11px; line-height: 1.9; }
#clear-selection { position: absolute; top: -9px; right: -4px; width: 32px; height: 32px; padding: 0; font-size: 19px; line-height: 1; }
#relations { display: flex; flex-direction: column; }
.relation-link { text-align: left; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 0; border: 0; border-top: 1px solid var(--soft-line); background: transparent; transition: color 180ms; }
.relation-link > span { display: block; font-size: 11px; color: var(--ink); }
.relation-link > small { display: block; flex: 0 0 auto; font-size: 9px; color: var(--muted); letter-spacing: .025em; }
.relation-link::after { content: '↗'; color: var(--gold); font-size: 14px; margin-left: auto; transition: transform 180ms; }
.relation-link:hover::after { transform: translate(2px,-2px); }
.relation-link:hover > span { color: var(--gold); }
.selection-panel .selection-evidence, .selection-panel .panel-note { margin: 12px 0 0; color: var(--faint); font-size: 10px; }

.explore-controls { right: var(--side); bottom: 192px; display: flex; align-items: center; gap: 22px; }
.zoom-controls { display: flex; border: 1px solid var(--hairline); border-radius: 24px; overflow: hidden; pointer-events: auto; background: rgba(8,11,13,.25); }
.zoom-controls button { background: transparent; border: 0; width: 40px; height: 38px; font-size: 20px; font-weight: 400; line-height: 1; color: var(--muted); transition: background 180ms, color 180ms; }
.zoom-controls button + button { border-left: 1px solid var(--hairline); }
.zoom-controls button:hover { background: rgba(232,223,207,.06); color: var(--ink); }
.zoom-controls button:focus-visible { outline-offset: -4px; }
.drift-button { display: inline-flex; align-items: center; gap: 11px; padding: 11px 0; border: 0; background: transparent; color: var(--ink); font-size: 11px; letter-spacing: .05em; }
.drift-button::before { content: ''; display: block; width: 0; height: 0; border-top: 4px solid transparent; border-bottom: 4px solid transparent; border-left: 6px solid var(--gold); }
.drift-button.is-drifting::before, .is-drifting .drift-button::before { width: 6px; height: 8px; border: 0; border-left: 2px solid var(--gold); border-right: 2px solid var(--gold); }

/* Landmarks orient the journey; the continuous marker belongs to the scale engine. */
.scale-dock { left: var(--side); right: var(--side); bottom: 27px; }
.scale-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 13px; color: var(--gold); font-size: 9px; letter-spacing: .2em; text-transform: uppercase; }
#scale-position { flex: 1; text-align: center; font-size: 10px; font-weight: 400; letter-spacing: .07em; text-transform: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.scale-rail { position: relative; min-height: 61px; }
.scale-rail::before { content: ''; position: absolute; left: 0; right: 0; top: 13px; height: 1px; background: var(--hairline); }
#landmarks { width: 100%; display: flex; justify-content: space-between; gap: 0; }
.landmark { position: relative; display: flex; flex: 1 1 0; flex-direction: column; align-items: center; gap: 15px; min-width: 0; padding: 9px 0 10px; border: 0; background: transparent; color: var(--muted); }
.landmark:first-child { align-items: flex-start; }
.landmark:last-child { align-items: flex-end; }
.tick { width: 1px; height: 9px; display: block; background: #656158; transition: background 200ms ease, height 200ms ease; }
.landmark-name { display: block; max-width: 100%; color: var(--muted); font-size: 9px; font-weight: 400; letter-spacing: .035em; white-space: nowrap; transition: color 200ms; }
.landmark:hover .landmark-name, .landmark.is-active .landmark-name { color: var(--ink); }
.landmark:hover .tick, .landmark.is-active .tick { background: var(--gold); }
.landmark.is-active .tick { box-shadow: 0 0 10px rgba(195,166,117,.24); }
/* The diamond has a real finger-sized grip above the bookmark buttons. Only
   this grip scrubs; labels and the phone dropdown remain explicit jumps. */
.scale-control { position: absolute; top: -9px; left: 25%; width: 44px; height: 44px; transform: translateX(-50%); pointer-events: auto; touch-action: none; user-select: none; -webkit-user-select: none; cursor: ew-resize; z-index: 2; transition: left 160ms ease-out; }
.scale-control.is-scrubbing { transition: none; }
.scale-control:focus-visible { outline: 1px solid var(--gold); outline-offset: 1px; border-radius: 50%; }
.scale-marker { position: absolute; top: 17px; left: 50%; width: 11px; height: 11px; transform: translateX(-50%) rotate(45deg); background: var(--gold); box-shadow: 0 0 18px rgba(195,166,117,.2); pointer-events: none; }
.scale-control:hover .scale-marker, .scale-control:focus-visible .scale-marker, .scale-control.is-scrubbing .scale-marker { box-shadow: 0 0 0 6px rgba(195,166,117,.12), 0 0 18px rgba(195,166,117,.35); }
.dock-footer { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; padding-top: 13px; border-top: 1px solid var(--soft-line); }
.controls-hint, .evidence-note { margin: 0; font-size: 9px; color: var(--faint); letter-spacing: .025em; }
.evidence-note { max-width: 280px; text-align: right; }
.controls-hint kbd { font: inherit; color: var(--muted); }
#jump-select, .jump-label { display: none; }

.help-panel { top: 94px; right: var(--side); width: 328px; padding: 25px 26px 22px; background: rgba(12,15,17,.96); border: 1px solid var(--hairline); box-shadow: 0 20px 70px rgba(0,0,0,.22); backdrop-filter: blur(16px); animation: panel-arrive 220ms ease both; }
.help-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.help-heading h2 { margin: 0; font: 400 30px/1.2 var(--editorial); }
#close-help { padding: 4px; font-size: 19px; }
.help-list { margin: 24px 0; display: grid; grid-template-columns: 105px 1fr; gap: 13px 12px; font-size: 11px; }
.help-list dt { color: var(--ink); }
.help-list dd { margin: 0; color: var(--muted); }
.help-footer { margin: 0; padding-top: 17px; border-top: 1px solid var(--soft-line); color: var(--muted); font-size: 10px; line-height: 1.9; }
.toast { bottom: 158px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 48px); padding: 8px 16px; background: rgba(8,11,13,.88); color: var(--ink); font-size: 11px; text-align: center; pointer-events: none; }
.is-cinematic .connection-toggle, .is-cinematic .scale-dock, .is-cinematic .explore-controls, .is-cinematic .journey-status { opacity: 0; pointer-events: none; }
.is-cinematic .realm-caption { opacity: .72; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@keyframes panel-arrive { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: translateY(0); } }

@media (min-width: 1500px) {
  .realm-caption { width: 520px; }
  #realm-description { max-width: 370px; font-size: 13px; }
  .selection-panel { width: 290px; }
}
@media (max-width: 1050px) {
  .brand-subtitle { display: none; }
  .header-actions { gap: 18px; }
  .realm-caption { width: 47vw; }
  #realm-name { font-size: clamp(56px, 8vw, 82px); }
  .selection-panel { width: 235px; padding-left: 20px; }
  .landmark-name { font-size: 8px; }
}
@media (max-width: 760px) {
  :root { --side: 28px; }
  .site-header { top: 25px; }
  .brand-name { font-size: 13px; letter-spacing: .16em; }
  .brand { column-gap: 12px; }
  .header-actions { gap: 15px; }
  .connection-toggle { top: 92px; }
  .journey-status { top: 100px; left: var(--side); transform: none; max-width: 48%; text-align: left; }
  .realm-caption { bottom: 255px; width: min(76vw, 420px); }
  #realm-name { font-size: clamp(56px, 10vw, 78px); }
  #realm-description { max-width: 300px; }
  .realm-meta { margin-top: 19px; }
  .selection-panel { top: auto; bottom: 244px; width: 290px; max-height: calc(100dvh - 370px); overflow-y: auto; }
  .has-selection .realm-caption { opacity: 0; visibility: hidden; }
  .explore-controls { bottom: 175px; }
  .scale-dock { bottom: 24px; }
  .scale-heading { margin-bottom: 10px; }
  .scale-rail { min-height: 46px; }
  .landmark-name { display: none; }
  .landmark { padding-bottom: 13px; }
  .landmark.is-active .landmark-name { display: block; position: absolute; top: 28px; font-size: 9px; }
  .dock-footer { padding-top: 12px; }
  .controls-hint { max-width: 50%; }
  .evidence-note { max-width: 48%; }
  .help-panel { top: 86px; width: min(328px, calc(100vw - 56px)); }
}
@media (max-width: 480px) {
  :root { --side: 24px; }
  .site-header { top: 20px; gap: 12px; }
  .brand-name { font-size: 12px; letter-spacing: .17em; }
  .brand-mark { width: 22px; height: 22px; flex-basis: 22px; }
  .brand-mark::before { inset: 5px; }
  .brand-mark::after { width: 30px; top: 9px; left: -5px; }
  .header-actions { gap: 13px; }
  .quiet-button { font-size: 10px; }
  #sound-button { display: none; }
  .connection-toggle { top: 82px; font-size: 9px; min-height: 36px; }
  .journey-status { top: 92px; font-size: 9px; }
  .realm-caption { bottom: 275px; width: calc(100% - 48px); }
  .eyebrow { margin-bottom: 12px; font-size: 9px; }
  #realm-name { max-width: 310px; margin-left: -2px; margin-bottom: 15px; font-size: clamp(52px, 15vw, 72px); }
  #realm-description { max-width: 280px; font-size: 11px; line-height: 1.85; }
  .realm-meta { gap: 8px 14px; margin-top: 17px; font-size: 9px; }
  .explore-controls { bottom: 205px; left: var(--side); right: var(--side); justify-content: space-between; gap: 20px; }
  .zoom-controls button { width: 43px; height: 42px; }
  .drift-button { min-height: 44px; }
  .scale-dock { bottom: max(21px, env(safe-area-inset-bottom)); }
  .scale-heading { margin-bottom: 9px; font-size: 8px; }
  #scale-position { font-size: 9px; }
  .scale-rail { min-height: 35px; }
  .landmark.is-active .landmark-name { display: none; }
  .dock-footer { gap: 15px; padding-top: 12px; }
  .controls-hint { display: none; }
  .evidence-note { max-width: none; text-align: left; flex: 1; font-size: 8px; line-height: 1.7; }
  #jump-select { display: block; width: 100%; min-height: 34px; padding: 4px 20px 4px 0; margin: 0 0 13px; border: 0; border-bottom: 1px solid var(--soft-line); border-radius: 0; background: transparent; color: var(--ink); font-size: 11px; }
  #jump-select option { background: var(--night); }
  .selection-panel { left: var(--side); right: var(--side); width: auto; bottom: 269px; max-height: calc(100dvh - 405px); min-height: 150px; padding-left: 17px; padding-right: 3px; }
  #selection-name { font-size: 29px; }
  #selection-description { margin-bottom: 12px; font-size: 11px; }
  .relation-link { padding: 11px 0; min-height: 44px; }
  #clear-selection { width: 40px; height: 40px; top: -11px; right: -6px; }
  .panel-kicker { font-size: 9px; margin-bottom: 8px; }
  .help-panel { top: 80px; width: calc(100vw - 48px); padding: 22px; }
  .help-list { grid-template-columns: 98px 1fr; }
  .toast { bottom: 253px; font-size: 10px; width: max-content; }
}
/* Short screens retain the scale dock and let selected relationships scroll. */
@media (max-height: 680px) and (min-width: 761px) {
  .realm-caption { bottom: 200px; }
  #realm-name { font-size: clamp(54px, 6.5vw, 84px); }
  #realm-description { line-height: 1.7; }
  .realm-meta { margin-top: 16px; }
  .selection-panel { top: 24%; max-height: calc(100vh - 290px); overflow-y: auto; }
  .explore-controls { bottom: 150px; }
  .scale-dock { bottom: 18px; }
}
@media (max-height: 700px) and (max-width: 760px) {
  .realm-caption { bottom: 238px; }
  #realm-name { font-size: 51px; margin-bottom: 10px; }
  #realm-description { max-width: 300px; font-size: 10px; line-height: 1.7; }
  .realm-meta { margin-top: 12px; }
  .explore-controls { bottom: 169px; }
  .scale-dock { bottom: 16px; }
  .selection-panel { bottom: 231px; max-height: calc(100dvh - 355px); }
  .eyebrow { margin-bottom: 8px; }
  .toast { bottom: 220px; }
}
@media (pointer: coarse) {
  .quiet-button { min-height: 44px; }
  .landmark { min-height: 44px; }
  .connection-toggle { min-height: 44px; }
  .zoom-controls button { min-width: 44px; min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* These small adaptations follow the semantic HTML: each relationship keeps its
   verb above its destination, and each guide entry owns its definition. */
.brand-subtitle { margin: 3px 0 0; padding: 0; border: 0; font-size: 8px; line-height: 1.5; letter-spacing: .15em; }
.brand-name { line-height: 1.5; }
.drift-button > span[aria-hidden] { display: none; }
.relation-link { flex-direction: column; align-items: flex-start; justify-content: center; gap: 3px; }
.relation-link > small { color: var(--muted); font-size: 9px; letter-spacing: .065em; }
.relation-link > span { font-size: 11px; }
.relation-link::after { display: none; }
#help-title { margin: 9px 0 0; font: 400 32px/1.15 var(--editorial); letter-spacing: -.025em; }
.help-heading .eyebrow { margin-bottom: 0; }
.help-list { display: flex; flex-direction: column; gap: 16px; margin: 23px 0; }
.help-list > div { display: grid; grid-template-columns: 100px 1fr; gap: 14px; }
.help-list dt { font-size: 10px; }
.help-list dd { font-size: 10px; line-height: 1.8; }
.source-link { display: inline-block; margin: 15px 12px 0 0; color: var(--gold); font-size: 9px; text-decoration: none; text-underline-offset: 3px; }
.source-link:hover { text-decoration: underline; }
.no-script { position: absolute; z-index: 5; left: var(--side); right: var(--side); top: 45%; color: var(--ink); }
.mobile-jump { display: none; }
.help-panel { max-height: calc(100dvh - 130px); overflow-y: auto; z-index: 4; }
.has-help .selection-panel { visibility: hidden; }
@media (max-width: 480px) {
  .mobile-jump { display: block; }
  .help-list { gap: 14px; margin: 20px 0; }
  .help-list > div { grid-template-columns: 94px 1fr; gap: 12px; }
  .help-panel { max-height: calc(100dvh - 106px); }
  .relation-link { padding: 9px 0; }
  .scale-heading .quiet-button { font-size: 9px; }
}

/* On compact phones, keep a clear interval between caption, manual controls,
   and the bookmark dock even when a realm name occupies two lines. */
@media (max-width: 480px) and (max-height: 700px) {
  .realm-caption { bottom: 260px; }
  #realm-name { font-size: 40px; }
  .explore-controls { bottom: 205px; }
}

/* Compact phones keep long realm names clear of the header annotations. */
@media (max-height: 600px) and (max-width: 480px) {
  .journey-status { display: none; }
  .connection-toggle { top: 64px; min-height: 44px; }
  #realm-name { font-size: 34px; }
}

/* Landscape uses a shallow bookmark rail. No shell minimum may extend this
   fixed viewport, and object details retain their own scrollable area. */
@media (min-width: 600px) and (max-height: 520px) {
  .app-shell { min-height: 0; }
  .site-header { top: 13px; }
  .brand-subtitle { display: none; }
  .brand-name { font-size: 12px; }
  .header-actions { gap: 17px; }
  .header-actions .quiet-button { padding-top: 5px; padding-bottom: 5px; min-height: 30px; font-size: 10px; }
  .connection-toggle { top: 58px; min-height: 27px; font-size: 9px; }
  .journey-status { top: 63px; font-size: 9px; }
  .realm-caption { left: var(--side); width: 45vw; bottom: 110px; }
  .eyebrow { font-size: 9px; margin-bottom: 8px; }
  #realm-name { font-size: 44px; margin-bottom: 10px; max-width: 370px; }
  #realm-description { max-width: 290px; font-size: 10px; line-height: 1.7; }
  .realm-meta { margin-top: 12px; font-size: 9px; gap: 7px 12px; }
  .scale-dock { bottom: max(12px, env(safe-area-inset-bottom)); }
  .scale-heading { margin-bottom: 0; }
  .scale-heading .quiet-button { padding: 4px 0; min-height: 28px; font-size: 9px; }
  #scale-position { font-size: 9px; }
  .scale-rail { min-height: 30px; }
  .scale-rail::before { top: 10px; }
  .landmark { padding: 6px 0; min-height: 30px; gap: 0; }
  .tick { height: 8px; }
  .landmark-name, .landmark.is-active .landmark-name { display: none; }
  .scale-control { top: -12px; }
  .dock-footer { display: none; }
  .explore-controls { left: auto; right: var(--side); bottom: 90px; gap: 20px; }
  .zoom-controls button { width: 38px; height: 36px; min-width: 38px; min-height: 36px; }
  .drift-button { min-height: 36px; }
  .selection-panel { top: 100px; bottom: 145px; width: 220px; max-height: calc(100dvh - 245px); min-height: 110px; overflow-y: auto; }
  #selection-name { font-size: 26px; }
  #selection-description { margin-bottom: 10px; font-size: 10px; line-height: 1.7; }
  .relation-link { padding: 9px 0; }
  .help-panel { top: 64px; max-height: calc(100dvh - 82px); }
  .toast { bottom: 72px; }
}
@media (min-width: 600px) and (max-height: 520px) and (pointer: coarse) {
  .header-actions .quiet-button, .scale-heading .quiet-button { min-height: 44px; }
  .connection-toggle { min-height: 44px; }
  .landmark { min-height: 44px; }
  .scale-rail { min-height: 44px; }
  .explore-controls { bottom: 110px; }
  .zoom-controls button { min-width: 44px; min-height: 44px; }
  .drift-button { min-height: 44px; }
  .selection-panel { bottom: 170px; max-height: calc(100dvh - 270px); min-height: 0; }
}
@media (min-width: 600px) and (max-height: 360px) {
  .realm-caption { bottom: 125px; }
  #realm-name { font-size: 36px; }
  #realm-description { display: none; }
  .realm-meta { margin-top: 8px; }
}

/* The path identifies the actual world being explored. It is separate from the
   scale bookmarks, because two sibling objects can have the same scale. */
.world-trail { position: absolute; z-index: 2; top: 101px; left: var(--side); right: calc(var(--side) + 185px); display: flex; align-items: center; gap: 14px; min-width: 0; pointer-events: none; }
.trail-back { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; min-height: 34px; padding: 5px 0; border: 0; background: transparent; color: var(--gold); font-size: 11px; letter-spacing: .025em; }
.trail-back:disabled { color: var(--faint); }
#world-breadcrumbs { display: flex; align-items: center; gap: 9px; min-width: 0; overflow: hidden; }
#world-breadcrumbs button { display: block; flex: 0 1 auto; max-width: 158px; min-width: 0; min-height: 34px; padding: 5px 0; overflow: hidden; border: 0; background: transparent; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
#world-breadcrumbs button:hover, #world-breadcrumbs button[aria-current] { color: var(--ink); }
#world-breadcrumbs > span { flex: 0 0 auto; color: var(--faint); font-size: 10px; }
#world-breadcrumbs { flex: 1 1 auto; }
.journey-button { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 4px 0 4px 9px; color: var(--gold); font-size: 10px; }
#journey-count { min-width: 18px; text-align: center; font-variant-numeric: tabular-nums; color: var(--muted); }
.journey-status { top: 155px; }

/* Research starts as a restrained annotation. The evidence is available on
   demand, leaving the canvas free of permanent numeric cards. */
.caption-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 18px 25px; margin-top: 22px; max-width: 480px; }
.research-button { display: flex; flex-direction: column; align-items: flex-start; min-height: 46px; max-width: 280px; padding: 0 0 0 13px; border: 0; border-left: 1px solid rgba(195,166,117,.6); background: transparent; text-align: left; color: var(--ink); }
.research-button strong, .research-button .research-value, .research-button #research-headline { display: block; font: 500 15px/1.5 var(--ui); letter-spacing: -.015em; }
.research-button span { display: block; max-width: 260px; color: var(--muted); font-size: 9px; line-height: 1.65; }
.research-button .research-link, .research-button .research-link-label { margin-top: 3px; color: var(--gold); font-size: 9px; letter-spacing: .035em; }
.research-button:hover strong, .research-button:hover #research-headline { color: var(--gold); }
.caption-actions #inspect-world { margin: 0; max-width: 150px; text-align: left; font-size: 10px; }

.research-panel { position: absolute; z-index: 4; top: 155px; right: var(--side); width: min(390px, calc(100% - 48px)); max-height: calc(100dvh - 340px); padding: 24px 25px 25px; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--hairline); border-left-color: rgba(195,166,117,.45); background: rgba(12,15,17,.97); box-shadow: 0 20px 70px rgba(0,0,0,.2); backdrop-filter: blur(16px); animation: panel-arrive 220ms ease both; }
.research-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.research-heading h2 { margin: 0; font: 400 32px/1.15 var(--editorial); letter-spacing: -.025em; }
.research-heading .eyebrow { margin-bottom: 8px; }
#close-research { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; width: 32px; height: 32px; min-height: 32px; margin-top: -7px; padding: 0; font-size: 20px; }
.research-context { margin: 14px 0 18px; color: var(--muted); font-size: 11px; line-height: 1.85; text-wrap: pretty; }
#research-metrics { display: block; }
.research-metric { padding: 17px 0; border-top: 1px solid var(--soft-line); }
.metric-value { display: block; margin: 0 0 5px; color: var(--ink); font: 400 27px/1.25 var(--editorial); letter-spacing: -.015em; overflow-wrap: anywhere; }
.metric-label { display: block; color: var(--ink); font-size: 11px; line-height: 1.7; }
.metric-status { display: inline-block; margin-top: 7px; color: var(--gold); font-size: 9px; line-height: 1.6; letter-spacing: .065em; text-transform: uppercase; }
.metric-detail { margin: 9px 0 8px; color: var(--muted); font-size: 10px; line-height: 1.9; }
.metric-source, #research-sources a { display: inline; color: var(--gold); font-size: 10px; line-height: 1.8; text-decoration: none; text-underline-offset: 3px; overflow-wrap: anywhere; }
.metric-source:hover, #research-sources a:hover { text-decoration: underline; }
#research-note { margin: 4px 0 0; padding-top: 16px; border-top: 1px solid var(--soft-line); color: var(--muted); font-size: 10px; line-height: 1.9; }
#research-sources { display: grid; gap: 8px; margin: 16px 0 0; padding: 0; list-style: none; }
#research-sources li { min-width: 0; }
.has-research .selection-panel, .has-research .help-panel { visibility: hidden; }
.has-help .research-panel { visibility: hidden; }
.selection-actions { display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin: 0 0 16px; }
.enter-button { display: inline-flex; align-items: center; justify-content: space-between; gap: 15px; width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid rgba(195,166,117,.4); background: rgba(195,166,117,.07); color: var(--ink); font-size: 11px; text-align: left; }
.enter-button:hover { border-color: var(--gold); background: rgba(195,166,117,.12); }
.selection-actions .quiet-button { min-height: 36px; padding: 5px 0; font-size: 10px; text-align: left; }
.is-cinematic .world-trail { opacity: 0; pointer-events: none; }

@media (max-width: 1050px) {
  .world-trail { right: calc(var(--side) + 165px); gap: 10px; }
  #world-breadcrumbs button { max-width: 120px; }
  .caption-actions { gap: 15px; }
  .research-panel { width: 355px; }
}
@media (max-width: 760px) {
  .world-trail { top: 132px; left: var(--side); right: var(--side); gap: 12px; }
  .journey-status { top: 100px; }
  #world-breadcrumbs { gap: 7px; }
  #world-breadcrumbs button { max-width: 135px; }
  .realm-caption { bottom: 250px; }
  .caption-actions { gap: 15px; margin-top: 18px; }
  .research-button strong, .research-button .research-value, .research-button #research-headline { font-size: 13px; }
  .research-panel { top: 188px; left: var(--side); right: var(--side); bottom: 192px; width: auto; max-height: none; padding: 22px; }
  .has-research .realm-caption { opacity: 0; visibility: hidden; }
  .has-research .explore-controls { visibility: hidden; }
}
@media (max-width: 480px) {
  .world-trail { top: 129px; gap: 10px; }
  .trail-back { font-size: 10px; }
  #world-breadcrumbs button { max-width: 105px; font-size: 9px; }
  .realm-caption { bottom: 275px; }
  #realm-name { font-size: clamp(45px, 13vw, 63px); }
  #realm-description { font-size: 10px; }
  .caption-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; margin-top: 18px; }
  .research-button { width: 100%; min-height: 44px; padding-left: 10px; }
  .research-button strong, .research-button .research-value, .research-button #research-headline { font-size: 12px; line-height: 1.45; }
  .research-button span { font-size: 9px; line-height: 1.55; }
  .caption-actions #inspect-world { max-width: 98px; min-height: 44px; font-size: 9px; line-height: 1.7; }
  .research-panel { top: 183px; bottom: 210px; padding: 19px 20px; }
  .research-heading h2 { font-size: 29px; }
  #close-research { width: 40px; height: 40px; min-height: 40px; margin: -7px -7px 0 0; }
  .research-context { margin-top: 12px; font-size: 10px; }
  .research-metric { padding: 14px 0; }
  .metric-value { font-size: 25px; }
  .metric-label { font-size: 10px; }
  .metric-source, #research-sources a { font-size: 10px; }
}
/* Secondary copy yields to the actual path, title, evidence and controls on
   short phones; source details remain fully available inside the panel. */
@media (max-width: 480px) and (max-height: 700px) {
  .connection-toggle { top: 66px; min-height: 44px; }
  .journey-status { display: none; }
  .world-trail { top: 113px; }
  .realm-caption { bottom: 260px; }
  .realm-caption > .eyebrow, #realm-description { display: none; }
  #realm-name { font-size: 30px; margin-bottom: 9px; }
  .realm-meta { margin-top: 0; font-size: 8px; gap: 6px 11px; }
  .caption-actions { margin-top: 13px; gap: 12px; }
  .research-button strong, .research-button .research-value, .research-button #research-headline { font-size: 11px; }
  .research-button span { font-size: 8px; }
  .research-button .research-link, .research-button .research-link-label { display: none; }
  .research-panel { top: 170px; bottom: 210px; }
}
@media (min-width: 600px) and (max-height: 520px) {
  .world-trail { top: 65px; right: calc(var(--side) + 180px); gap: 12px; }
  #world-breadcrumbs button, .trail-back { min-height: 30px; font-size: 9px; }
  .journey-status { display: none; }
  .realm-caption { bottom: 125px; }
  .realm-caption > .eyebrow { display: none; }
  #realm-name { font-size: 35px; margin-bottom: 8px; }
  #realm-description { display: none; }
  .realm-meta { margin-top: 0; font-size: 8px; }
  .caption-actions { gap: 14px; margin-top: 13px; flex-wrap: nowrap; }
  .research-button { max-width: 220px; min-height: 38px; }
  .research-button strong, .research-button .research-value, .research-button #research-headline { font-size: 11px; }
  .research-button span { font-size: 8px; }
  .research-button .research-link, .research-button .research-link-label { display: none; }
  .caption-actions #inspect-world { max-width: 98px; font-size: 9px; min-height: 38px; }
  .research-panel { top: 109px; bottom: 105px; left: auto; right: var(--side); width: min(355px, 55vw); max-height: none; padding: 19px 22px; }
  .research-heading h2 { font-size: 27px; }
  .research-context { margin-top: 10px; }
  .has-research .explore-controls { visibility: hidden; }
  .selection-actions { gap: 5px; margin-bottom: 12px; }
  .selection-actions .quiet-button { min-height: 30px; }
}
@media (pointer: coarse) {
  .trail-back, #world-breadcrumbs button, #close-research, .enter-button, .selection-actions .quiet-button { min-height: 44px; }
  .metric-source, #research-sources a { display: inline-flex; align-items: center; min-height: 36px; }
}

/* Match the shipped markup and reserve the manual controls' vertical band. */
.research-button .research-action { margin-top: 3px; color: var(--gold); font-size: 9px; letter-spacing: .035em; }
.research-source-heading { margin-top: 21px; color: var(--muted); font-size: 9px; letter-spacing: .11em; text-transform: uppercase; }
#research-sources { margin-top: 10px; }
@media (min-width: 761px) and (min-height: 521px) {
  .selection-panel { top: max(192px, 27%); bottom: 250px; max-height: none; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .research-panel { max-height: calc(100dvh - 405px); }
}
@media (max-width: 480px) and (max-height: 700px) {
  .research-button .research-action { display: none; }
}
@media (min-width: 600px) and (max-height: 520px) {
  .research-button .research-action { display: none; }
}

/* Compact source panels put the first reference value above the fold. The
   remaining qualifications and sources stay in the same scrollable reading
   flow, while the bookmark dropdown and evidence footer remain outside it. */
@media (max-width: 480px) and (max-height: 700px) {
  .research-panel { top: 154px; bottom: 170px; padding: 14px 16px 18px; }
  .research-heading { gap: 12px; }
  .research-heading .eyebrow { display: none; }
  .research-heading h2 { font-size: 22px; line-height: 1.15; }
  #close-research { margin-top: -7px; }
  .research-context { margin: 8px 0 10px; font-size: 10px; line-height: 1.55; }
  .research-metric { padding: 12px 0; }
  .research-metric:first-child { padding-top: 10px; }
  .metric-value { margin-bottom: 4px; font-size: 24px; line-height: 1.15; }
  .metric-detail { margin-top: 7px; line-height: 1.7; }
  .research-source-heading { margin-top: 16px; }
}
@media (min-width: 600px) and (max-height: 520px) {
  .research-panel { top: 98px; bottom: 105px; width: min(390px, 55vw); padding: 15px 18px 18px; }
  .research-heading { gap: 12px; }
  .research-heading .eyebrow { display: none; }
  .research-heading h2 { font-size: 22px; line-height: 1.15; }
  .research-context { margin: 8px 0 10px; font-size: 10px; line-height: 1.55; }
  .research-metric { padding: 12px 0; }
  .research-metric:first-child { padding-top: 10px; }
  .metric-value { margin-bottom: 4px; font-size: 24px; line-height: 1.15; }
  .metric-detail { margin-top: 7px; line-height: 1.7; }
}

/* Selected-object copy needs the same optical separation as source reading.
   Shrinkable action rows prevent long object names or buttons from creating an
   internal horizontal scrollbar on narrow landscape viewports. */
.selection-panel { min-width: 0; overflow-x: hidden; background: rgba(12,15,17,.97); padding: 18px 20px 20px; box-shadow: 0 18px 60px rgba(0,0,0,.18); }
.selection-header { position: relative; min-width: 0; min-height: 27px; padding-right: 30px; }
.selection-header .panel-kicker { margin-bottom: 0; }
#clear-selection { top: -8px; right: -9px; }
#selection-name, #selection-description, .selection-actions, #relations { min-width: 0; max-width: 100%; }
#selection-name, #selection-description, .relation-link, .enter-button { overflow-wrap: anywhere; }
.selection-actions > button, .relation-link { min-width: 0; max-width: 100%; }
.enter-button > span { flex: 0 0 auto; }
.relation-link > span, .relation-link > small { min-width: 0; max-width: 100%; white-space: normal; }
@media (max-width: 760px) {
  .has-selection .explore-controls { visibility: hidden; }
}
@media (max-width: 480px) {
  .selection-panel { padding: 15px 17px 18px; }
  .selection-header { min-height: 26px; }
  #selection-name { font-size: 27px; }
}
/* A short phone's selection must start below the complete breadcrumb hit area.
   Its manual controls are hidden, so the panel can use that lower reading band. */
@media (max-width: 480px) and (max-height: 700px) {
  .selection-panel { top: 154px; bottom: 170px; max-height: none; min-height: 0; overscroll-behavior: contain; }
}
@media (min-width: 600px) and (max-height: 520px) {
  .selection-panel { top: 98px; bottom: 105px; left: auto; right: var(--side); width: min(320px, 45vw); max-height: none; min-height: 0; padding: 14px 17px 17px; }
  #selection-name { font-size: 25px; line-height: 1.1; margin-bottom: 9px; }
  #selection-description { margin-bottom: 12px; }
  .selection-actions { margin-bottom: 10px; }
  .has-selection .explore-controls { visibility: hidden; }
}

/* Finite matter references expose their literal composition without turning
   the observatory into a dashboard. Both selection and return remain native,
   visible controls, including when secondary caption actions yield on phones. */
.has-matter-view .journey-status { visibility: hidden; }
.matter-context { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px 17px; width: min(100%, 360px); max-width: 100%; margin-top: 19px; padding-left: 13px; border-left: 1px solid rgba(195,166,117,.6); }
#matter-summary { grid-column: 1 / -1; min-width: 0; color: var(--ink); font-size: 14px; font-weight: 500; line-height: 1.6; letter-spacing: -.015em; }
#matter-note { grid-column: 1 / -1; min-width: 0; color: var(--muted); font-size: 10px; line-height: 1.7; text-wrap: pretty; }
#matter-inspect, #matter-return { justify-self: start; min-width: 0; max-width: 100%; min-height: 36px; margin: 0; padding: 6px 0; color: var(--gold); font-size: 10px; line-height: 1.6; text-align: left; white-space: normal; }
#matter-inspect:hover, #matter-return:hover { color: var(--ink); }
.matter-reference { max-width: 150px; min-height: 44px; color: var(--gold); font-size: 10px; line-height: 1.7; text-align: left; white-space: normal; }
#matter-selection { order: -1; }
#selection-sources { min-width: 0; max-width: 100%; min-height: 36px; white-space: normal; }
.realm-caption:has(.matter-context:not([hidden])) #realm-description { display: none; }
.realm-caption:has(.matter-context:not([hidden])) #realm-name { font-size: clamp(48px, 6vw, 88px); }
@media (max-width: 760px) {
  .matter-context { margin-top: 16px; }
  #matter-summary { font-size: 13px; }
  .realm-caption:has(.matter-context:not([hidden])) #realm-name { font-size: clamp(42px, 10vw, 65px); }
}
@media (max-width: 480px) {
  .matter-context { gap: 3px 12px; padding-left: 10px; }
  #matter-summary { font-size: 12px; }
  #matter-note { font-size: 9px; line-height: 1.65; }
  #matter-inspect, #matter-return { min-height: 44px; font-size: 10px; }
  .matter-reference { max-width: 98px; font-size: 9px; }
  /* The new literal-count action occupies the existing second action slot. */
  .caption-actions:has(.matter-reference:not([hidden])) #inspect-world { display: none; }
}
@media (max-width: 480px) and (max-height: 700px) {
  .realm-caption:has(.matter-context:not([hidden])) #realm-name { font-size: 26px; margin-bottom: 8px; }
  .realm-caption:has(.matter-context:not([hidden])) .realm-meta,
  .realm-caption:has(.matter-context:not([hidden])) .caption-actions { display: none; }
  .matter-context { margin-top: 8px; }
  #matter-summary { line-height: 1.5; }
  #matter-note { font-size: 9px; line-height: 1.55; }
}
@media (min-width: 600px) and (max-height: 520px) {
  .realm-caption:has(.matter-context:not([hidden])) #realm-name { font-size: 30px; margin-bottom: 8px; }
  .app-shell.has-matter-view .realm-caption { width: min(300px, 34vw); }
  .realm-caption:has(.matter-context:not([hidden])) .realm-meta,
  .realm-caption:has(.matter-context:not([hidden])) .caption-actions { display: none; }
  .matter-context { width: min(100%, 340px); margin-top: 8px; gap: 2px 14px; }
  #matter-summary { font-size: 12px; line-height: 1.5; }
  #matter-note { font-size: 9px; line-height: 1.55; }
  #matter-inspect, #matter-return { min-height: 36px; font-size: 9px; }
  .caption-actions:has(.matter-reference:not([hidden])) #inspect-world { display: none; }
}
@media (pointer: coarse) {
  #matter-inspect, #matter-return, #selection-sources { min-height: 44px; }
}

/* The semantic actions wrapper spans the annotation, keeping the two touch
   targets beside each other rather than stacking inside one grid column. */
.matter-actions { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 17px; min-width: 0; }
/* Medium portrait windows stack the reference caption below its fitted field,
   rather than borrowing a desktop column that covers counted constituents. */
@media (min-width: 481px) and (max-width: 760px) and (min-height: 701px) {
  .app-shell.has-matter-view .realm-caption { top: calc(27dvh + 190px); bottom: auto; width: min(480px, calc(100% - 2 * var(--side))); }
  .realm-caption:has(.matter-context:not([hidden])) #realm-name { font-size: 48px; line-height: 1.05; }
}
@media (max-width: 480px) {
  .matter-actions { column-gap: 12px; }
}
@media (min-width: 600px) and (max-height: 520px) {
  .matter-actions { column-gap: 14px; }
}

/* A direct source link sits with the reference qualification, so reading its
   evidence never depends on first selecting a particle. The note can wrap
   while the source control keeps a complete keyboard and touch target. */
.matter-footnote { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; min-width: 0; }
.matter-footnote #matter-note { flex: 1 1 0; min-width: 0; }
#matter-sources { flex: 0 0 auto; min-height: 32px; margin: 0; padding: 4px 0; color: var(--gold); font-size: 9px; line-height: 1.6; white-space: nowrap; }
#matter-sources:hover { color: var(--ink); }
@media (max-width: 480px) and (max-height: 700px) {
  .realm-caption:has(.matter-context:not([hidden])) { bottom: 245px; }
}
@media (min-width: 600px) and (max-height: 520px) {
  .realm-caption:has(.matter-context:not([hidden])) { bottom: 110px; }
}
@media (pointer: coarse) {
  #matter-sources { min-height: 44px; }
}

/* Finite references use a bounded marginal caption rather than the large
   cinematic realm headline. Their own count, qualification and source action
   replace the duplicated generic research annotation. */
.realm-caption:has(.matter-context:not([hidden])) > .eyebrow,
.realm-caption:has(.matter-context:not([hidden])) .realm-meta,
.realm-caption:has(.matter-context:not([hidden])) .caption-actions { display: none; }
@media (min-width: 761px) and (min-height: 621px) {
  .realm-caption:has(.matter-context:not([hidden])) { top: 190px; bottom: auto; width: 300px; }
  .realm-caption:has(.matter-context:not([hidden])) #realm-name { max-width: 300px; margin-bottom: 15px; font-size: 44px; line-height: 1.04; }
  .matter-context { margin-top: 15px; }
}
@media (min-width: 761px) and (min-height: 521px) and (max-height: 620px) {
  .realm-caption:has(.matter-context:not([hidden])) { top: 175px; bottom: auto; width: 330px; }
  .realm-caption:has(.matter-context:not([hidden])) #realm-name { max-width: 330px; margin-bottom: 10px; font-size: 34px; line-height: 1.04; }
  .matter-context { margin-top: 10px; }
  #matter-summary { font-size: 12px; line-height: 1.5; }
  #matter-note { font-size: 9px; line-height: 1.55; }
}

/* Short finite scenes reserve the upper field for the literal constituents.
   Match the renderer's 35%-height focal center; the caption begins below its
   fitted radius and remains above the bookmark dock at the 320×568 minimum. */
@media (max-width: 480px) and (max-height: 700px) {
  .app-shell.has-matter-view .realm-caption { top: calc(35dvh + 72px); bottom: auto; }
}

/* Astronomy, micro, and biology references share one measured framing contract with the canvas: the app
   sets --reference-caption-bottom from the actual dock rectangle, then fits
   the scene above this caption in portrait or beside it in landscape. These
   rules leave the existing matter reference poses intact. */
.app-shell:is(.has-astronomy-view, .has-micro-view, .has-biology-view, .has-cosmic-view) .realm-caption { top: 190px; bottom: auto; width: 300px; max-width: calc(100% - var(--side) * 2); }
.app-shell:is(.has-astronomy-view, .has-micro-view, .has-biology-view, .has-cosmic-view) #realm-name { max-width: 100%; margin: 0 0 13px -2px; font-size: 42px; line-height: 1.05; letter-spacing: -.035em; overflow-wrap: normal; }
.app-shell:is(.has-astronomy-view, .has-micro-view, .has-biology-view, .has-cosmic-view) .realm-caption > .eyebrow,
.app-shell:is(.has-astronomy-view, .has-micro-view, .has-biology-view, .has-cosmic-view) #realm-description,
.app-shell:is(.has-astronomy-view, .has-micro-view, .has-biology-view, .has-cosmic-view) .realm-meta,
.app-shell:is(.has-astronomy-view, .has-micro-view, .has-biology-view, .has-cosmic-view) .caption-actions,
.app-shell:is(.has-astronomy-view, .has-micro-view, .has-biology-view, .has-cosmic-view) #matter-context { width: 100%; margin-top: 13px; padding-left: 11px; }
.app-shell:is(.has-astronomy-view, .has-micro-view, .has-biology-view, .has-cosmic-view) #matter-summary { font-size: 13px; line-height: 1.5; }
.app-shell:is(.has-astronomy-view, .has-micro-view, .has-biology-view, .has-cosmic-view) #matter-note { font-size: 10px; line-height: 1.65; }
.app-shell:is(.has-astronomy-view, .has-micro-view, .has-biology-view, .has-cosmic-view) .matter-footnote { gap: 2px 9px; }
.app-shell:is(.has-astronomy-view, .has-micro-view, .has-biology-view, .has-cosmic-view) #matter-inspect,
.app-shell:is(.has-astronomy-view, .has-micro-view, .has-biology-view, .has-cosmic-view) #matter-return { min-height: 44px; font-size: 10px; }
.app-shell:is(.has-astronomy-view, .has-micro-view, .has-biology-view, .has-cosmic-view) #matter-sources { min-height: 44px; }

/* One Enter action remains primary. Named examples and alternative physical
   routes form a quiet, scrollable list, rather than a stack of primary boxes. */
#astronomy-actions { display: flex; flex-direction: column; min-width: 0; max-width: 100%; gap: 0; margin: 3px 0 7px; padding-top: 4px; border-top: 1px solid var(--soft-line); }
#astronomy-actions button { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; max-width: 100%; min-width: 0; min-height: 44px; padding: 9px 0; border: 0; background: transparent; color: var(--muted); font-size: 10px; line-height: 1.7; text-align: left; white-space: normal; }
#astronomy-actions button:hover, #astronomy-actions button:focus-visible { color: var(--ink); }
#astronomy-actions button > span { min-width: 0; overflow-wrap: anywhere; }
#astronomy-actions button > [aria-hidden] { flex: 0 0 auto; color: var(--gold); }
#astronomy-actions small { color: var(--faint); font-size: 9px; }
#astronomy-actions .is-primary { color: var(--ink); }

/* Compact reference bookmarks keep the research and named-example actions on
   one row; the canvas still selects the generic molecule or atom directly. */
@media (max-width: 900px) and (orientation: portrait) {
  .caption-actions:has(:is(.micro-reference, .biology-reference, .cosmic-reference):not([hidden])) #inspect-world { display: none; }
  .caption-actions :is(.micro-reference, .biology-reference, .cosmic-reference) { max-width: 120px; }
}

/* The journey is a reading surface over the observatory. Native modal behavior
   contains keyboard focus while its independently scrolling path grows. */
.journey-panel { position: fixed; inset: 24px var(--side) 24px auto; width: min(500px, calc(100vw - 48px)); height: calc(100dvh - 48px); max-width: none; max-height: none; margin: 0; padding: 25px 26px 0; border: 1px solid var(--hairline); color: var(--ink); background: rgba(12,15,17,.98); box-shadow: 0 20px 80px rgba(0,0,0,.4); overflow: hidden; }
.journey-panel[open] { display: flex; flex-direction: column; animation: panel-arrive 220ms ease both; }
.journey-panel::backdrop { background: rgba(5,8,10,.64); backdrop-filter: blur(3px); }
.journey-heading { display: flex; flex: 0 0 auto; align-items: flex-start; justify-content: space-between; gap: 20px; }
.journey-heading .eyebrow { margin: 1px 0 8px; font-size: 9px; }
#journey-title { margin: 0; font: 400 43px/1.08 var(--editorial); letter-spacing: -.035em; }
#close-journey { flex: 0 0 auto; width: 40px; min-height: 40px; margin: -12px -10px 0 0; padding: 0; font-size: 22px; }
#journey-intro { flex: 0 0 auto; margin: 14px 0 15px; max-width: 45ch; color: var(--muted); font-size: 11px; line-height: 1.8; }
.journey-tools { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 19px; border-bottom: 1px solid var(--hairline); }
#keep-place { width: auto; min-width: 148px; min-height: 42px; gap: 16px; }
#jump-kept, #jump-path { flex: 0 0 auto; min-height: 38px; font-size: 10px; color: var(--gold); }
.journey-reading { flex: 1 1 auto; min-height: 0; margin: 0 -12px 0 0; padding: 22px 12px 26px 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.journey-section-title { margin: 0; color: var(--gold); font-size: 10px; font-weight: 500; line-height: 1.6; letter-spacing: .1em; text-transform: uppercase; }
.journey-path { margin: 12px 0 0; padding: 0; list-style: none; }
.journey-path li { position: relative; margin: 0; padding: 0; }
.journey-path li:not(:last-child)::after { content: ''; position: absolute; left: 13px; top: 37px; bottom: -6px; width: 1px; background: var(--hairline); pointer-events: none; }
.journey-stop { display: flex; align-items: flex-start; gap: 15px; width: 100%; min-height: 68px; padding: 10px 2px 16px 0; border: 0; background: transparent; text-align: left; color: var(--muted); }
.journey-stop:disabled { cursor: default; opacity: 1; }
.journey-stop:hover:not(:disabled) strong, .journey-stop:hover:not(:disabled) .journey-ordinal { color: var(--gold); }
.journey-ordinal { position: relative; z-index: 1; flex: 0 0 27px; display: grid; place-items: center; min-height: 26px; border: 1px solid var(--hairline); border-radius: 50%; background: #0c0f11; color: var(--muted); font-size: 9px; font-variant-numeric: tabular-nums; }
.journey-stop-words { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 3px; }
.journey-stop small { color: var(--muted); font-size: 9px; line-height: 1.6; }
.journey-stop strong { color: var(--ink); font-size: 12px; line-height: 1.7; font-weight: 500; overflow-wrap: anywhere; }
.journey-stop-detail { color: var(--muted); font-size: 10px; line-height: 1.7; overflow-wrap: anywhere; }
.journey-path .is-current .journey-ordinal { color: var(--ink); border-color: var(--gold); }
.journey-path .is-current small { color: var(--gold); }
.journey-path .is-authored .journey-ordinal { border-style: dashed; }
.journey-selection { margin: 5px 0 22px 42px; padding: 10px 0; border-top: 1px solid var(--soft-line); }
.journey-selection small { color: var(--gold); font-size: 9px; }
.journey-selection strong { display: block; margin-top: 5px; font-size: 12px; font-weight: 500; line-height: 1.7; overflow-wrap: anywhere; }
.journey-selection p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.8; }
.kept-section { margin-top: 20px; padding-top: 22px; border-top: 1px solid var(--hairline); }
.kept-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
#kept-count { margin-right: auto; color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.kept-note, .kept-empty { margin: 10px 0 0; color: var(--muted); font-size: 10px; line-height: 1.8; }
.journey-feedback { flex: 0 0 auto; margin: 12px 0 0; color: var(--gold); font-size: 10px; line-height: 1.8; }
.journey-feedback:empty { display: none; }
.kept-places { margin: 14px 0 0; padding: 0; list-style: none; }
.kept-places li { display: flex; align-items: center; gap: 12px; border-top: 1px solid var(--soft-line); }
.kept-open { flex: 1 1 auto; min-width: 0; min-height: 60px; padding: 12px 0; border: 0; background: transparent; color: var(--ink); text-align: left; }
.kept-open strong { display: block; font-size: 11px; font-weight: 500; line-height: 1.8; overflow-wrap: anywhere; }
.kept-open small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.8; }
.kept-open:hover strong { color: var(--gold); }
.kept-remove { flex: 0 0 40px; min-height: 44px; font-size: 20px; }
.journey-undo { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.journey-undo span { color: var(--muted); font-size: 10px; line-height: 1.7; overflow-wrap: anywhere; }
#undo-place { flex: 0 0 auto; min-height: 44px; font-size: 10px; color: var(--gold); }
@media (max-width: 600px) {
  .journey-panel { inset: 12px; width: calc(100vw - 24px); height: calc(100dvh - 24px); padding: 19px 20px 0; }
  #journey-title { font-size: 34px; }
  #journey-intro { font-size: 10px; margin: 10px 0 12px; }
  .journey-tools { padding-bottom: 15px; }
  .journey-reading { padding-top: 18px; }
  .journey-stop { gap: 11px; }
  .journey-selection { margin-left: 38px; }
}
@media (max-height: 520px) {
  .journey-panel { inset-block: 12px; height: calc(100dvh - 24px); padding-top: 15px; }
  .journey-heading .eyebrow { display: none; }
  #journey-title { font-size: 30px; }
  #journey-intro { margin: 8px 0 10px; font-size: 10px; }
  .journey-tools { padding-bottom: 12px; }
  #keep-place { min-height: 38px; }
  .journey-reading { padding-top: 14px; }
}
@media (prefers-reduced-motion: reduce) { .journey-panel[open] { animation: none; } }

@media (max-width: 900px) and (orientation: portrait) {
  .app-shell:is(.has-astronomy-view, .has-micro-view, .has-biology-view, .has-cosmic-view) .realm-caption { top: auto; bottom: var(--reference-caption-bottom, 190px); left: var(--side); right: var(--side); width: auto; max-width: none; }
  .app-shell:is(.has-astronomy-view, .has-micro-view, .has-biology-view, .has-cosmic-view) #realm-name { font-size: clamp(32px, 6.5vw, 42px); margin-bottom: 9px; }
  .app-shell:is(.has-astronomy-view, .has-micro-view, .has-biology-view, .has-cosmic-view) #matter-context { width: min(100%, 420px); margin-top: 9px; padding-left: 10px; }
  .app-shell:is(.has-astronomy-view, .has-micro-view, .has-biology-view, .has-cosmic-view) #matter-summary { font-size: 12px; }
  .app-shell:is(.has-astronomy-view, .has-micro-view, .has-biology-view, .has-cosmic-view) #matter-note { font-size: 9px; line-height: 1.55; }
  .app-shell:is(.has-astronomy-view, .has-micro-view, .has-biology-view, .has-cosmic-view) .matter-actions { column-gap: 12px; }
  .app-shell:is(.has-astronomy-view, .has-micro-view, .has-biology-view, .has-cosmic-view) .matter-footnote { column-gap: 8px; }
  .app-shell:is(.has-astronomy-view, .has-micro-view, .has-biology-view, .has-cosmic-view) .journey-status { display: none; }
}
@media (max-width: 480px) and (orientation: portrait) {
  .app-shell:is(.has-astronomy-view, .has-micro-view, .has-biology-view, .has-cosmic-view) .realm-caption { bottom: var(--reference-caption-bottom, 180px); }
  .app-shell:is(.has-astronomy-view, .has-micro-view, .has-biology-view, .has-cosmic-view) #realm-name { font-size: 32px; }
  .app-shell:is(.has-astronomy-view, .has-micro-view, .has-biology-view, .has-cosmic-view) #matter-context { margin-top: 8px; gap: 2px 12px; }
  .app-shell:is(.has-astronomy-view, .has-micro-view, .has-biology-view, .has-cosmic-view) #matter-inspect,
  .app-shell:is(.has-astronomy-view, .has-micro-view, .has-biology-view, .has-cosmic-view) #matter-return { font-size: 10px; }
}
@media (min-width: 600px) and (max-height: 520px) {
  .app-shell:is(.has-astronomy-view, .has-micro-view, .has-biology-view, .has-cosmic-view) .realm-caption { top: 108px; bottom: auto; left: var(--side); right: auto; width: min(270px, 34vw); max-width: none; }
  .app-shell:is(.has-astronomy-view, .has-micro-view, .has-biology-view, .has-cosmic-view) #realm-name { font-size: 32px; margin-bottom: 8px; }
  .app-shell:is(.has-astronomy-view, .has-micro-view, .has-biology-view, .has-cosmic-view) #matter-context { margin-top: 8px; gap: 2px 12px; }
  .app-shell:is(.has-astronomy-view, .has-micro-view, .has-biology-view, .has-cosmic-view) #matter-summary { font-size: 12px; }
  .app-shell:is(.has-astronomy-view, .has-micro-view, .has-biology-view, .has-cosmic-view) #matter-note { font-size: 9px; line-height: 1.55; }
  .app-shell:is(.has-astronomy-view, .has-micro-view, .has-biology-view, .has-cosmic-view) #matter-inspect,
  .app-shell:is(.has-astronomy-view, .has-micro-view, .has-biology-view, .has-cosmic-view) #matter-return { min-height: 44px; font-size: 9px; }
}

/* Manual magnification and the active drift's pause never disappear at a
   reference boundary. Compact controls use the header's spare reading row. */
.app-shell.has-reference-view .explore-controls { display: flex; visibility: visible; top: 146px; bottom: auto; left: auto; right: var(--side); gap: 6px; z-index: 3; pointer-events: auto; }
.has-reference-view .zoom-controls button { min-width: 44px; min-height: 44px; }
.has-reference-view .drift-button { display: grid; place-items: center; width: 44px; min-height: 44px; padding: 0; border: 1px solid var(--hairline); border-radius: 50%; background: rgba(8,11,13,.5); }
.has-reference-view .drift-label { display: none; }
.app-shell.has-reference-view:is(.has-research, .has-help) .explore-controls { visibility: hidden; }
.has-reference-view #scale-position { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.approach-cue { position: absolute; z-index: 2; top: 151px; left: 50%; transform: translateX(-50%); width: min(360px, 48vw); color: var(--gold); font-size: 10px; line-height: 1.7; text-align: center; pointer-events: none; }
.approach-cue span, .approach-cue small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.approach-cue small { color: var(--muted); font-size: 9px; }
.is-approaching .journey-status { visibility: hidden; }
.journey-tools { flex-wrap: wrap; }
#previous-journey { flex: 1 0 100%; min-height: 36px; padding: 0; text-align: left; font-size: 10px; color: var(--gold); }
@media (max-width: 760px) and (orientation: portrait) {
  .app-shell.has-reference-view .explore-controls { top: 84px; left: var(--side); right: auto; }
  .approach-cue { top: 177px; width: calc(100vw - 2 * var(--side)); }
}
@media (max-width: 480px) and (orientation: portrait) {
  .app-shell.has-reference-view .explore-controls { top: 78px; }
  .approach-cue { top: 173px; }
}
@media (max-width: 480px) and (max-height: 700px) {
  .app-shell.has-reference-view .explore-controls { top: 64px; }
  .approach-cue { top: 155px; }
}
@media (min-width: 600px) and (max-height: 520px) {
  .app-shell.has-reference-view .explore-controls { top: 8px; left: 50%; right: auto; transform: translateX(-50%); }
  .approach-cue { top: 101px; left: auto; right: var(--side); transform: none; width: 44vw; }
}

/* Connection evidence shares the selected owner's surface, so reading a
   relationship never creates a competing world or a second modal. */
.connection-explorer { margin: 18px 0 22px; padding-top: 15px; border-top: 1px solid var(--hairline); }
.connection-heading { margin: 0 0 10px; color: var(--muted); font-size: 10px; letter-spacing: .04em; }
.connection-tabs { display: flex; flex-wrap: wrap; gap: 3px 12px; margin: 0 0 15px; border-bottom: 1px solid var(--soft-line); }
.connection-tab { flex: 1 0 auto; min-height: 44px; padding: 7px 0; border: 0; border-bottom: 1px solid transparent; background: transparent; color: var(--muted); font: 500 10px/1.4 var(--ui); text-align: left; }
.connection-tab[aria-selected="true"] { border-bottom-color: var(--gold); color: var(--ink); }
.connection-tab:hover { color: var(--gold); }
.connection-tab:focus-visible, .connection-follow:focus-visible, .connection-detail:focus-visible, .connection-source:focus-visible { outline: 1px solid var(--gold); outline-offset: 4px; }
.connection-type { margin: 0 0 5px; color: var(--gold); font-size: 9px; line-height: 1.6; letter-spacing: .08em; text-transform: uppercase; }
.connection-name { margin: 0 0 9px; color: var(--ink); font: 400 24px/1.25 var(--editorial); letter-spacing: -.02em; overflow-wrap: anywhere; }
.connection-summary { margin: 0 0 16px; color: var(--ink); font-size: 11px; line-height: 1.8; }
.connection-metrics { margin: 0; }
.connection-metric { padding: 12px 0; border-top: 1px solid var(--soft-line); }
.connection-metric dt { margin: 0 0 5px; color: var(--muted); font-size: 10px; line-height: 1.7; }
.connection-metric dd { margin: 0; }
.connection-metric dd > strong { color: var(--ink); font: 500 18px/1.5 var(--ui); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.connection-status { display: block; margin: 3px 0 0; color: var(--gold); font-size: 9px; line-height: 1.7; }
.connection-metric-detail, .connection-note, .connection-action-note { margin: 7px 0 0; color: var(--muted); font-size: 10px; line-height: 1.85; overflow-wrap: anywhere; }
.connection-source { display: inline-flex; align-items: center; min-height: 44px; color: var(--gold); font-size: 10px; line-height: 1.7; text-decoration: none; text-underline-offset: 3px; }
.connection-source:hover { text-decoration: underline; }
.connection-scope summary { display: list-item; min-height: 44px; padding: 12px 0; color: var(--gold); font-size: 10px; line-height: 1.8; cursor: pointer; }
.connection-scope summary:focus-visible { outline: 1px solid var(--gold); outline-offset: 2px; }
.connection-follow { width: 100%; min-height: 44px; margin-top: 15px; padding: 9px 12px; border: 1px solid var(--hairline); background: oklch(24% .015 80 / .4); color: var(--ink); font: 500 11px/1.6 var(--ui); text-align: left; }
.connection-follow:hover { border-color: var(--gold); }
.connection-choices { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0 0 12px; }
.connection-choices button { min-height: 44px; text-align: left; }
.connection-choices button[aria-pressed="true"] { color: var(--ink); text-decoration: underline; text-underline-offset: 5px; }
.selection-primary { margin-bottom: 0; }
.selection-secondary { border-top: 1px solid var(--soft-line); padding-top: 12px; }
.selection-header { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; min-height: 44px; padding-right: 44px; background: oklch(17% .008 230 / .99); }
#selection-panel .selection-header #clear-selection { top: 0; right: 0; width: 44px; height: 44px; min-height: 44px; }
.selection-owner-label { display: none; color: var(--ink); font-size: 11px; line-height: 1.6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.is-reading-connections .selection-header .panel-kicker { display: none; }
.is-reading-connections .selection-owner-label { display: block; }
/* The selected identity and breadcrumb provide orientation while its three
   threads use the field; a large realm caption would cover the left thread. */
.app-shell[data-selected-object-id] .realm-caption { opacity: 0; visibility: hidden; }
@media (min-width: 901px) and (min-height: 521px) { .selection-panel { width: 340px; } }
@media (max-width: 480px) { .connection-name { font-size: 23px; } .connection-tabs { gap: 0 10px; } }
@media (min-width: 901px) and (min-height: 621px) {
  .selection-panel { top: 202px; bottom: 160px; max-height: none; }
  .app-shell.has-selection .explore-controls { top: 146px; bottom: auto; left: auto; right: var(--side); transform: none; }
}
@media (max-width: 760px) and (orientation: portrait) {
  .selection-panel { top: 176px; bottom: 210px; max-height: none; min-height: 0; }
}
@media (max-width: 480px) and (max-height: 700px) {
  .selection-panel { top: 160px; bottom: 170px; }
}
