:root {
  --bg: #030812; --ink: #e9f1f8; --mute: #8ea3b9; --line: rgba(255,255,255,.11);
  --panel: rgba(5,13,25,.74); --accent: #5cc8ff; --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(3,8,18,.82), rgba(3,8,18,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 35% 30%, #bfeaff, #2c8fd6 45%, #062a55 100%); box-shadow: 0 0 12px rgba(92,200,255,.5); 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="dive"] .tabs [data-go="dive"],
body[data-mode="creatures"] .tabs [data-go="creatures"] { background: var(--ink); color: #04101f; }

/* shared */
.ui { position: fixed; inset: 0; z-index: 10; pointer-events: none; display: none; }
body[data-mode="origins"] #ui-origins, body[data-mode="dive"] #ui-dive, body[data-mode="creatures"] #ui-creatures { 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: #c9d6e3; }
.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: #04101f; 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: #0a1626; border: 1.5px solid #47607a; 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(92,200,255,.7); }
.tl-stop.past i { background: #47607a; }

/* 02 dive */
.hud { left: 16px; top: 62px; width: 210px; padding: 12px 14px; }
.depth { display: flex; align-items: baseline; gap: 5px; font-variant-numeric: tabular-nums; }
.depth b { font-size: 34px; line-height: 1; font-weight: 650; letter-spacing: -.03em; }
.depth span { color: var(--mute); font-size: 14px; }
.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: 66px; bottom: 44px; width: 150px; 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(3,8,18,.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: #b9c8d8; white-space: nowrap; font-variant-numeric: tabular-nums; text-shadow: 0 1px 3px #000; }
.rail-mark::after { content: ""; width: 8px; height: 1px; background: #6d8299; }
.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(92,200,255,.45), 0 0 14px rgba(92,200,255,.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(4,12,24,.62); 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: #04101f; }

/* 03 creatures */
.list { left: 16px; top: 62px; bottom: 44px; width: 236px; padding: 6px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #33475c 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(92,200,255,.16); box-shadow: inset 0 0 0 1px rgba(92,200,255,.5); }
.cr img { width: 52px; height: 38px; border-radius: 6px; background: #071425; 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: #04101f; border-color: var(--ink); }
.row .primary:hover { background: #fff; }

#tip { position: fixed; z-index: 30; pointer-events: none; padding: 4px 9px; border-radius: 6px; background: var(--ink); color: #04101f; 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 { display: none; }
  .top { padding: 0 10px; gap: 6px; } .brand b { font-size: 15px; }
  .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: 168px; padding: 9px 11px; } .depth b { font-size: 26px; }
  .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 { display: none; } .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; }
}
