:root {
  --bg: #0b0c0f; --ink: #eef0f2; --mute: #a0a4ad; --line: rgba(255,255,255,.12);
  --panel: rgba(12,13,17,.78); --accent: #f6a04d; --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, h4, p, ul, dl, dd { margin: 0; padding: 0; }
#stage { position: fixed; inset: 0; transition: opacity .17s; }
#stage.dim { opacity: 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; gap: 12px;
  background: linear-gradient(rgba(6,7,9,.8), rgba(6,7,9,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; align-self: center; display: inline-block; border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%; background: radial-gradient(circle at 50% 55%, #14100c 0 24%, #f6a04d 26% 100%); box-shadow: 0 0 10px rgba(246,160,77,.45); }
.tabs { margin-left: auto; 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="hunt"] .tabs [data-go="hunt"],
body[data-mode="realms"] .tabs [data-go="realms"],
body[data-mode="predators"] .tabs [data-go="predators"] { background: var(--ink); color: #0b0c0f; }

/* shared */
.ui { position: fixed; inset: 0; z-index: 10; pointer-events: none; display: none; }
body[data-mode="hunt"] #ui-story, body[data-mode="realms"] #ui-story, body[data-mode="predators"] #ui-predators { 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 h4 { margin: 12px 0 4px; font-size: 10.5px; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; color: var(--mute); }
.panel p { color: #d3d6dc; }
.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; }

/* name tags on the animals */
#labels { position: fixed; inset: 0; z-index: 9; overflow: hidden; pointer-events: none; }
.lbl { pointer-events: auto; position: absolute; left: 0; top: 0; padding: 3px 10px 3px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 550; white-space: nowrap; color: var(--ink); background: rgba(8,9,12,.7); border: 1px solid rgba(255,255,255,.2); 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; }
button.lbl:hover { background: var(--ink); color: #0b0c0f; }
.lbl.quiet { pointer-events: none; color: #c9ccd3; background: rgba(8,9,12,.5); border-color: rgba(255,255,255,.1); font-weight: 500; }
.lbl.quiet::before { background: #7d828c; }

/* 01 · 02 story */
.era { left: 16px; bottom: 104px; width: min(390px, calc(100vw - 32px)); max-height: calc(100vh - 176px); overflow-y: auto; padding: 16px 18px; scrollbar-width: thin; }
.cast { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.cast:empty { display: none; }
.chip { padding: 4px 11px; border-radius: 999px; border: 1px solid var(--line); font-size: 12px; font-weight: 550; }
.chip::after { content: " ›"; color: var(--accent); }
.chip:hover { background: var(--ink); color: #0b0c0f; border-color: var(--ink); }
.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); }
#st-play { background: var(--ink); color: #0b0c0f; 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; }
.tl-stop i { width: 13px; height: 13px; border-radius: 50%; background: #0e0f13; border: 1.5px solid #5d616c; 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(246,160,77,.6); }
.tl-stop.past i { background: #5d616c; }

/* 03 predators */
.list { left: 16px; top: 62px; bottom: 44px; width: 236px; padding: 6px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #3c3f48 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(246,160,77,.16); box-shadow: inset 0 0 0 1px rgba(246,160,77,.5); }
.cr img, .pry img { border-radius: 6px; background: #0b0c0f; object-fit: cover; flex: none; }
.cr img { width: 52px; height: 38px; }
.cr img:not([src]), .pry img:not([src]) { visibility: hidden; }
.cr span { min-width: 0; }
.cr b { display: block; font-size: 13px; font-weight: 600; line-height: 1.25; }
.cr small { display: block; color: var(--mute); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.info { right: 16px; top: 62px; bottom: 44px; width: min(380px, calc(100vw - 32px)); overflow-y: auto; padding: 16px 18px; scrollbar-width: thin; scrollbar-color: #3c3f48 transparent; }
.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; }
.info dl.meta { grid-template-columns: 1fr; margin: 12px 0 0; border-bottom: 0; padding-bottom: 0; }
.info dl.meta dd { font-weight: 500; color: #d3d6dc; }
.prey { display: grid; gap: 2px; }
.pry { display: flex; align-items: center; gap: 10px; padding: 3px 0; }
.pry img { width: 44px; height: 32px; }
.pry i { flex: none; width: 44px; height: 32px; border-radius: 6px; border: 1px dashed var(--line); }
.pry b { display: block; font-size: 13px; font-weight: 600; line-height: 1.25; }
.pry small { display: block; color: var(--mute); font-size: 11.5px; }
.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: #0b0c0f; 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: #0b0c0f; 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; }
#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: 1100px) { .brand i { display: none; } }
@media (max-width: 760px) {
  .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; }
  .tabs button { padding: 6px 9px; font-size: 12px; }
  .era { left: 10px; right: 10px; width: auto; bottom: 66px; padding: 12px 14px; max-height: 40vh; }
  .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; }
  .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; top: auto; bottom: 12px; width: auto; max-height: 42vh; padding: 12px 14px; }
  .lbl { font-size: 10.5px; padding: 2px 8px 2px 6px; }
}
@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; }
}
