:root {
  --bg: #010103; --ink: #e9f1f8; --mute: #9aa0ae; --line: rgba(255,255,255,.11);
  --panel: rgba(9,10,16,.76); --accent: #ffc56e; --r: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); overflow: hidden; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
h1, h2, p, ul, dl, dd { margin: 0; padding: 0; }
#stage { position: fixed; inset: 0; }
#gl { width: 100%; height: 100%; display: block; touch-action: none; outline: none; }

/* top bar */
.top { position: fixed; z-index: 20; top: 0; left: 0; right: 0; height: 52px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: linear-gradient(rgba(1,1,3,.85), rgba(1,1,3,0)); pointer-events: none; }
.top > * { pointer-events: auto; }
.brand { display: flex; align-items: baseline; gap: 8px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand b { font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.brand i { font-style: normal; color: var(--mute); font-size: 12.5px; }
.mark { width: 14px; height: 14px; border-radius: 50%; align-self: center; background: radial-gradient(circle at 50% 50%, #fff, #ffd58a 40%, #c8641a 100%); box-shadow: 0 0 12px rgba(255,197,110,.6); display: inline-block; }
.tabs { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.tabs button { padding: 6px 14px; border-radius: 999px; color: var(--mute); font-weight: 550; font-size: 13px; white-space: nowrap; transition: color .15s, background .15s; }
.tabs button span { font-size: 10.5px; margin-right: 6px; opacity: .6; font-variant-numeric: tabular-nums; }
.tabs button:hover { color: var(--ink); }
body[data-mode="origins"] .tabs [data-go="origins"],
body[data-mode="voyage"] .tabs [data-go="voyage"],
body[data-mode="atlas"] .tabs [data-go="atlas"] { background: var(--ink); color: #08090d; }

/* the voice guide */
.top { justify-content: flex-start; } .tabs { margin-left: auto; }
.guide { display: flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
#guide-btn { display: flex; align-items: center; gap: 7px; height: 30px; padding: 0 13px 0 11px; border-radius: 999px; font-weight: 600; font-size: 13px; background: var(--accent); color: #08090d; white-space: nowrap; }
#guide-btn i { width: 0; height: 0; border-left: 8px solid currentColor; border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
#guide-btn[aria-pressed="true"] { background: var(--ink); }
#guide-btn[aria-pressed="true"] i { width: 9px; height: 9px; border: 0; background: currentColor; border-radius: 1px; }
#guide-btn.busy i { width: 10px; height: 10px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; background: none; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#guide-lang { height: 30px; padding: 0 6px 0 8px; border: 0; border-radius: 999px; background: transparent; color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; outline: none; }
#guide-lang option { color: #08090d; }
#caption { position: fixed; z-index: 15; left: 50%; top: 62px; transform: translateX(-50%); width: min(560px, calc(100vw - 560px)); max-height: 104px; overflow-y: auto; padding: 10px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); display: none; scrollbar-width: thin; }
#caption.on { display: block; }
#caption p { font-size: 13.5px; line-height: 1.55; color: #dbe6f0; }
#caption small { display: block; margin-top: 4px; color: var(--mute); font-size: 11px; }

/* shared */
.ui { position: fixed; inset: 0; z-index: 10; pointer-events: none; display: none; }
body[data-mode="origins"] #ui-origins, body[data-mode="voyage"] #ui-voyage, body[data-mode="atlas"] #ui-atlas { display: block; }
.panel { pointer-events: auto; position: absolute; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.eyebrow { font-size: 11px; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; color: var(--accent); }
.panel h1, .panel h2 { font-size: 21px; line-height: 1.2; font-weight: 650; letter-spacing: -.015em; margin: 4px 0 8px; }
.panel p { color: #cfd3dc; }
.panel ul { list-style: none; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.panel li { position: relative; padding-left: 14px; color: var(--mute); font-size: 13px; }
.panel li::before { content: ""; position: absolute; left: 0; top: .62em; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.hint { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); font-size: 12px; color: var(--mute); white-space: nowrap; text-shadow: 0 1px 4px #000; }

/* 01 origins */
.era { left: 16px; bottom: 104px; width: min(390px, calc(100vw - 32px)); padding: 16px 18px; }
.timeline { pointer-events: auto; position: absolute; left: 16px; right: 16px; bottom: 40px; display: flex; align-items: center; gap: 14px; padding: 8px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.tl-btns { display: flex; gap: 4px; }
.tl-btns button { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); font-size: 15px; line-height: 1; color: var(--ink); }
.tl-btns button:hover { background: rgba(255,255,255,.1); }
#era-play { background: var(--ink); color: #08090d; font-size: 11px; }
.tl-track { position: relative; flex: 1; display: flex; justify-content: space-between; min-width: 0; }
.tl-track::before { content: ""; position: absolute; left: 6px; right: 6px; top: 6px; height: 1px; background: var(--line); }
.tl-stop { position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; flex: 1; color: var(--mute); font-size: 11px; font-variant-numeric: tabular-nums; }
.tl-stop i { width: 13px; height: 13px; border-radius: 50%; background: #0b0c12; border: 1.5px solid #5a5f6e; transition: all .2s; }
.tl-stop:hover i { border-color: var(--ink); }
.tl-stop.on { color: var(--ink); }
.tl-stop.on i { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 10px rgba(255,197,110,.7); }
.tl-stop.past i { background: #5a5f6e; }

/* 02 voyage */
.hud { left: 16px; top: 62px; width: 252px; padding: 12px 14px; }
.depth { display: flex; align-items: baseline; gap: 5px; font-variant-numeric: tabular-nums; }
.depth b { font-size: 27px; line-height: 1; font-weight: 650; letter-spacing: -.03em; }
.depth span { color: var(--mute); font-size: 13px; }
.zone { margin-top: 4px; font-size: 12px; font-weight: 600; color: var(--accent); }
.hud dl { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); display: grid; gap: 3px; }
.hud dl div { display: flex; justify-content: space-between; font-size: 12.5px; }
.hud dt { color: var(--mute); } .hud dd { font-variant-numeric: tabular-nums; }
.find { left: 16px; bottom: 44px; width: min(370px, calc(100vw - 110px)); padding: 14px 16px; }
.find h2 { font-size: 18px; }
.rail { pointer-events: auto; position: absolute; right: 14px; top: 70px; bottom: 48px; width: 170px; cursor: ns-resize; touch-action: none; }
.rail-bar { position: absolute; right: 0; top: 0; bottom: 0; width: 8px; border-radius: 4px; overflow: hidden; border: 1px solid var(--line); }
.rail-bar div { position: absolute; left: 0; right: 0; }
.rail-marks { position: absolute; inset: 0 14px 0 0; }
.rail::before { content: ""; position: absolute; inset: -6px -14px -6px 0; background: linear-gradient(90deg, transparent, rgba(1,1,3,.5)); pointer-events: none; }
.rail-mark { position: absolute; right: 0; transform: translateY(-50%); display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: #c3c7d2; white-space: nowrap; font-variant-numeric: tabular-nums; text-shadow: 0 1px 3px #000; }
.rail-mark::after { content: ""; width: 8px; height: 1px; background: #70758a; }
.rail-mark.z { color: var(--ink); font-weight: 600; font-size: 11px; }
.rail-mark:hover { color: var(--accent); }
.rail-knob { position: absolute; right: -4px; width: 16px; height: 16px; margin-top: -8px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(255,197,110,.45), 0 0 14px rgba(255,197,110,.9); }
.pad { pointer-events: auto; position: absolute; left: 50%; bottom: 40px; transform: translateX(-50%); display: flex; align-items: center; gap: 4px; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.pad button { width: 34px; height: 34px; border-radius: 50%; font-size: 13px; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.pad button:hover { background: rgba(255,255,255,.12); }
.pad i { width: 1px; height: 18px; background: var(--line); margin: 0 3px; }
#labels { position: absolute; inset: 0; overflow: hidden; }
.lbl { pointer-events: auto; position: absolute; left: 0; top: 0; padding: 3px 9px 3px 7px; border-radius: 999px; font-size: 11.5px; font-weight: 550; white-space: nowrap; color: var(--ink); background: rgba(6,7,12,.66); border: 1px solid rgba(255,255,255,.18); cursor: pointer; will-change: transform; display: none; }
.lbl::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--accent); vertical-align: 1px; }
.lbl:hover { background: var(--ink); color: #08090d; }

/* 03 atlas */
.list { left: 16px; top: 62px; bottom: 44px; width: 236px; padding: 6px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #3a3d4a transparent; }
.list h3 { margin: 10px 8px 4px; font-size: 10.5px; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; color: var(--mute); }
.list h3:first-child { margin-top: 6px; }
.cr { display: flex; align-items: center; gap: 10px; width: 100%; padding: 5px 8px 5px 5px; border-radius: 8px; text-align: left; }
.cr:hover { background: rgba(255,255,255,.07); }
.cr.on { background: rgba(255,197,110,.16); box-shadow: inset 0 0 0 1px rgba(255,197,110,.5); }
.cr img { width: 52px; height: 38px; border-radius: 6px; background: #05060a; object-fit: cover; flex: none; }
.cr b { display: block; font-size: 13px; font-weight: 600; line-height: 1.25; }
.cr small { color: var(--mute); font-size: 11px; font-variant-numeric: tabular-nums; }
.info { right: 16px; bottom: 44px; width: min(380px, calc(100vw - 32px)); max-height: calc(100vh - 110px); overflow-y: auto; padding: 16px 18px; }
.sci { font-style: italic; color: var(--mute); margin: -4px 0 10px; font-size: 13px; }
.info dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; padding: 9px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.info dt { font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--mute); }
.info dd { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 6px; margin-top: 14px; }
.row button { height: 34px; min-width: 34px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); font-weight: 600; font-size: 13px; }
.row button:hover { background: rgba(255,255,255,.1); }
.row .primary { flex: 1; background: var(--ink); color: #08090d; border-color: var(--ink); }
.row .primary:hover { background: #fff; }

/* the guide */
.guide { display: flex; gap: 6px; align-items: center; }
.guide select, #explain { height: 32px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; font-size: 13px; font-weight: 550; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.guide select { padding: 0 8px 0 12px; cursor: pointer; outline: none; color-scheme: dark; }
#explain { display: flex; align-items: center; gap: 7px; padding: 0 14px 0 11px; background: var(--ink); color: #08090d; border-color: var(--ink); white-space: nowrap; }
#explain:hover { background: #fff; }
#explain.busy { opacity: .7; cursor: progress; }
#explain.on { background: var(--accent); border-color: var(--accent); }
.say { z-index: 18; left: 50%; top: 60px; transform: translateX(-50%); width: min(560px, calc(100vw - 32px)); padding: 12px 16px 14px; max-height: 38vh; overflow-y: auto; }
.say[hidden] { display: none; }
.say .eyebrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.say .eyebrow button { font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; }
.say .eyebrow button:hover { color: var(--ink); }
.say p { font-size: 15px; line-height: 1.6; color: var(--ink); }
.say.err p { color: var(--mute); font-size: 13.5px; }

/* ad slots: invisible until the network tag puts something in them */
.ad { display: none; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); overflow: hidden; }
.ad:has([data-yld]:not(:empty)) { display: block; }
.ad small { display: block; margin-bottom: 6px; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.ad [data-yld] { max-width: 100%; color: var(--ink); }
.ad a { color: var(--accent); }
.list .ad { margin: 8px 6px 4px; }
#tip { position: fixed; z-index: 30; pointer-events: none; padding: 4px 9px; border-radius: 6px; background: var(--ink); color: #08090d; font-size: 12px; font-weight: 600; transform: translate(-50%, -150%); display: none; white-space: nowrap; }
#boot { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: grid; place-items: center; transition: opacity .5s; }
#boot div { display: flex; align-items: baseline; gap: 9px; }
#boot b { font-size: 18px; font-weight: 650; } #boot i { font-style: normal; color: var(--mute); }
#boot.gone { opacity: 0; pointer-events: none; }

@media (max-width: 760px) {
  .brand i, .hint, .tabs button span, #explain span { display: none; }
  .guide select { max-width: 74px; } #explain { padding: 0 9px; }
  .say { top: 58px; left: 10px; right: 10px; width: auto; transform: none; z-index: 25; }
  .top { padding: 0 8px; gap: 5px; } .brand b { display: none; }
  #guide-btn { padding: 0 10px; } #guide-btn span { display: none; } #guide-lang { max-width: 74px; padding: 0 2px 0 4px; font-size: 12px; }
  #caption { top: auto; bottom: 46vh; width: calc(100vw - 20px); max-height: 74px; padding: 8px 10px; } #caption p { font-size: 12.5px; }
  .tabs button { padding: 6px 9px; font-size: 12px; }
  .era { bottom: 92px; padding: 12px 14px; max-height: 44vh; overflow-y: auto; }
  .panel h1, .panel h2 { font-size: 18px; }
  .timeline { bottom: 12px; left: 10px; right: 10px; gap: 8px; padding: 8px; }
  .tl-stop span { display: none; } .tl-stop.on span { display: block; position: absolute; top: 17px; white-space: nowrap; }
  .tl-track { padding-bottom: 14px; }
  .hud { top: 58px; left: 10px; width: 216px; padding: 9px 11px; } .depth b { font-size: 21px; }
  .rail { width: 30px; right: 8px; bottom: 70px; } .rail-mark { display: none; }
  .find { left: 10px; bottom: 64px; width: calc(100vw - 60px); padding: 10px 12px; max-height: 30vh; overflow-y: auto; }
  .pad { bottom: 12px; }
  .list { left: 10px; right: 10px; top: 58px; bottom: auto; width: auto; display: flex; gap: 4px; overflow-x: auto; overflow-y: hidden; padding: 5px; }
  .list h3, .list .ad { display: none !important; } .cr { flex: none; width: auto; } .cr small { display: none; }
  .cr img { width: 40px; height: 30px; }
  .info { left: 10px; right: 10px; bottom: 12px; width: auto; max-height: 40vh; padding: 12px 14px; }
}
@media (max-width: 420px) {
  .top { padding: 0 8px; gap: 4px; } .tabs button { padding: 6px 7px; font-size: 11.5px; }
  .guide { gap: 4px; } .guide select { max-width: 58px; padding: 0 2px 0 8px; font-size: 12px; } #explain { padding: 0 8px; }
}
