:root {
  --ink: #f2f5fa;
  --dim: rgba(242, 245, 250, 0.68);
  --faint: rgba(242, 245, 250, 0.22);
  --bg: #04070c;
  --sans: Geist, system-ui, -apple-system, "Segoe UI", sans-serif;
  --gut: clamp(20px, 3vw, 44px);
  --h: clamp(42px, 6.6vw, 112px);
}
* { box-sizing: border-box; }
html { background: var(--bg); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
body { margin: 0; min-height: 100%; overflow-x: hidden; }
body:not(.entered) { overflow: hidden; height: 100vh; }
body.flying { overflow: hidden; height: 100vh; }
a { color: inherit; }
button { font: inherit; color: inherit; }

#game { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100lvh; display: block; z-index: 0; }
#track { height: 1500vh; }
body.flying #track { display: none; }
/* a soft floor of shade so words always read over a bright frame */
#scrim { position: fixed; inset: 0; pointer-events: none; z-index: 1; background: linear-gradient(180deg, rgba(2, 5, 30, 0.28) 0%, rgba(2, 5, 30, 0) 22%, rgba(2, 5, 30, 0) 58%, rgba(2, 5, 30, 0.42) 100%); transition: opacity 1.2s ease; }
body.dark #scrim { opacity: 0.4; }

/* ---------------------------------------------------------------- header */
.top { position: fixed; top: 0; left: 0; right: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; padding: calc(var(--gut) * 0.8) var(--gut); padding-top: max(calc(var(--gut) * 0.8), env(safe-area-inset-top)); opacity: 0; transition: opacity 0.8s ease; }
body.ready .top { opacity: 1; }
.mark { font-size: 16px; font-weight: 500; letter-spacing: -0.02em; text-decoration: none; }
.top nav { display: flex; gap: clamp(14px, 2.4vw, 32px); align-items: center; }
.link { background: none; border: 0; padding: 4px 0; cursor: pointer; font-size: 13px; letter-spacing: 0.005em; color: var(--dim); text-decoration: none; display: inline-flex; gap: 8px; align-items: center; transition: color 0.2s ease; }
.link:hover, .link:focus-visible { color: var(--ink); outline: none; }
.link[data-fly] { color: var(--ink); }
.bars { display: inline-flex; gap: 2px; align-items: flex-end; height: 10px; }
.bars b { width: 2px; height: 3px; background: currentColor; transition: height 0.3s ease; }
#sound[aria-pressed="true"] .bars b { animation: eq 0.9s ease-in-out infinite; }
#sound[aria-pressed="true"] .bars b:nth-child(2) { animation-delay: -0.3s; }
#sound[aria-pressed="true"] .bars b:nth-child(3) { animation-delay: -0.6s; }
@keyframes eq { 0%, 100% { height: 3px; } 50% { height: 10px; } }

/* ---------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 22px; border-radius: 3px; border: 1px solid var(--faint); background: rgba(4, 7, 12, 0.12); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); cursor: pointer; font-size: 14px; letter-spacing: -0.005em; text-decoration: none; transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease; }
.btn:hover, .btn:focus-visible { border-color: var(--ink); outline: none; }
.btn.solid { background: var(--ink); color: #05070d; border-color: var(--ink); }
.btn.solid:hover, .btn.solid:focus-visible { background: #fff; }
.btn.small { height: 34px; padding: 0 14px; font-size: 13px; }
.choices { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- intro */
#gate { position: fixed; left: var(--gut); right: var(--gut); bottom: calc(var(--gut) * 1.2); z-index: 5; display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 14px 24px; }
#gate .title { grid-column: 1 / -1; margin: 0; font-weight: 300; font-size: clamp(96px, 21vw, 360px); line-height: 0.78; letter-spacing: -0.075em; margin-left: -0.06em; opacity: 0; transform: translateY(30px); transition: opacity 1.4s ease, transform 1.6s cubic-bezier(0.2, 0.7, 0.1, 1); }
#gate .tag { margin: 0; font-size: 15px; color: var(--dim); }
#gate .loading { position: absolute; right: 0; bottom: 12px; margin: 0; font-size: 13px; color: var(--dim); animation: breathe 1.6s ease-in-out infinite; }
#gate .choices { opacity: 0; pointer-events: none; transition: opacity 0.8s ease 0.4s; }
body.ready #gate .title { opacity: 1; transform: none; }
body.ready #gate .loading { display: none; }
body.ready #gate .choices { opacity: 1; pointer-events: auto; }
body.entered #gate { opacity: 0; pointer-events: none; transform: translateY(-20px); transition: opacity 0.7s ease, transform 0.9s ease; }
@keyframes breathe { 50% { opacity: 0.35; } }

#hint { position: fixed; left: 50%; bottom: calc(var(--gut) * 1.1); transform: translateX(-50%); z-index: 4; display: grid; justify-items: center; gap: 10px; font-size: 12px; color: var(--dim); opacity: 0; transition: opacity 0.8s ease; pointer-events: none; }
#hint i { width: 1px; height: 34px; background: linear-gradient(var(--ink), transparent); animation: drip 1.8s ease-in-out infinite; transform-origin: top; }
body.entered:not(.scrolled):not(.flying) #hint { opacity: 1; transition-delay: 0.6s; }
@keyframes drip { 0% { transform: scaleY(0); opacity: 1; } 70% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }

#depth { position: fixed; right: var(--gut); bottom: calc(var(--gut) * 1.1); z-index: 4; font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; opacity: 0; transition: opacity 0.8s ease; }
body.entered #depth { opacity: 1; }

/* ---------------------------------------------------------------- story beats */
#story { position: fixed; inset: 0; z-index: 3; pointer-events: none; }
.beat { position: absolute; opacity: 0; max-width: min(92vw, 980px); will-change: opacity, transform; }
.beat.live { pointer-events: auto; }
.beat h2 { text-shadow: 0 2px 40px rgba(2, 5, 20, 0.25); margin: 0; font-weight: 300; font-size: var(--h); line-height: 0.95; letter-spacing: -0.045em; text-wrap: balance; }
.beat h2 em { font-style: normal; color: #fff; text-shadow: 0 0 40px rgba(160, 190, 255, 0.55); }
.beat p { text-shadow: 0 1px 14px rgba(2, 5, 12, 0.7); margin: 18px 0 0; max-width: 340px; font-size: 15px; line-height: 1.5; color: var(--dim); }
.beat .num { font-variant-numeric: tabular-nums; }
.bl { left: var(--gut); bottom: calc(var(--gut) * 2.2); }
.br { right: var(--gut); bottom: calc(var(--gut) * 2.2); text-align: right; }
.br p { margin-left: auto; }
.tl { left: var(--gut); top: 19vh; }
.tr { right: var(--gut); top: 15vh; text-align: right; }
.tr p { margin-left: auto; }
.c { left: 50%; top: 50%; translate: -50% -50%; text-align: center; width: max-content; }
.c p { margin-left: auto; margin-right: auto; }
.wide h2 { font-size: calc(var(--h) * 0.86); }
.count { display: grid; gap: 4px; }
.count .num { font-size: calc(var(--h) * 1.3); line-height: 0.9; font-weight: 300; letter-spacing: -0.06em; color: var(--ink); }
.look { top: 74%; }
.look h2 { font-size: calc(var(--h) * 0.6); letter-spacing: 0.32em; text-transform: uppercase; margin-right: -0.32em; font-weight: 400; }
.look.live h2 { animation: track-in 2.6s cubic-bezier(0.2, 0.7, 0.1, 1) both; }
@keyframes track-in { from { letter-spacing: 0.02em; filter: blur(8px); } to { letter-spacing: 0.32em; filter: blur(0); } }
.spec .big { margin: 0; max-width: none; font-size: clamp(120px, 15vw, 250px); line-height: 0.8; font-weight: 300; letter-spacing: -0.07em; color: var(--ink); }
.spec .sub { margin-top: 22px; font-size: 16px; color: var(--ink); }
.spec .note { margin-top: 10px; font-size: 13px; }
.lede { font-size: clamp(20px, 2.2vw, 30px) !important; line-height: 1.25 !important; color: var(--ink) !important; max-width: 640px !important; font-weight: 300; letter-spacing: -0.02em; }
.cta p { max-width: 420px; }
.cta .choices { justify-content: center; margin-top: 26px; }
.cite { display: inline-grid; place-items: center; min-width: 17px; height: 17px; margin-left: 4px; padding: 0 4px; border: 1px solid var(--faint); border-radius: 9px; font-size: 10px; line-height: 1; vertical-align: 3px; text-decoration: none; color: var(--dim); }
.cite:hover, .cite:focus-visible { color: var(--ink); border-color: var(--ink); outline: none; }
body.flying #story, body.flying #depth { display: none; }

/* ---------------------------------------------------------------- free roam */
#hud { position: fixed; inset: auto var(--gut) calc(var(--gut) * 1) var(--gut); z-index: 6; display: none; grid-template-columns: auto auto 1fr auto; align-items: end; gap: 34px; pointer-events: none; }
body.flying #hud { display: grid; }
body.nohud #hud, body.nohud #help, body.nohud .top { display: none; }
.stat { display: grid; gap: 6px; }
.stat .num { font-size: clamp(44px, 5.4vw, 84px); line-height: 0.85; font-weight: 300; letter-spacing: -0.06em; font-variant-numeric: tabular-nums; }
.stat small { font-size: 12px; color: var(--dim); max-width: 170px; }
.stat.pop .num { animation: pop 0.35s ease; }
@keyframes pop { 30% { transform: scale(1.06); } }
.hud-actions { display: flex; gap: 8px; justify-self: end; pointer-events: auto; grid-column: 4; }
#boost { position: fixed; left: 50%; top: calc(var(--gut) * 1.1 + 4px); transform: translateX(-50%); display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--dim); }
#boostbar { width: 120px; height: 1px; background: var(--faint); }
#boostfill { height: 100%; background: var(--ink); transform-origin: left; }
#help { position: fixed; left: 50%; bottom: calc(var(--gut) * 5.2); transform: translateX(-50%); z-index: 6; display: none; font-size: 13px; color: var(--dim); text-align: center; transition: opacity 1s ease; pointer-events: none; }
body.flying #help { display: block; }
#help.gone { opacity: 0; }
#help .touch { display: none; }
#toast { position: fixed; left: 50%; top: 22vh; transform: translateX(-50%); z-index: 6; font-size: clamp(20px, 2.4vw, 32px); font-weight: 300; letter-spacing: -0.02em; text-align: center; opacity: 0; transition: opacity 0.8s ease; pointer-events: none; text-shadow: 0 2px 30px rgba(2, 5, 20, 0.5); width: max-content; max-width: 90vw; }
#toast.on { opacity: 1; }
#win { position: fixed; left: 50%; top: 50%; translate: -50% -50%; z-index: 7; text-align: center; display: none; width: max-content; max-width: 90vw; }
#win h2 { margin: 0; font-weight: 300; font-size: var(--h); line-height: 0.95; letter-spacing: -0.045em; }
#win p { margin: 16px 0 26px; color: var(--dim); font-size: 16px; }
#win .choices { justify-content: center; }
body.won #win { display: block; animation: fadein 1.6s ease both; }
body.won #hud .stat, body.won #help { opacity: 0.3; }
@keyframes fadein { from { opacity: 0; } }
#pause { position: fixed; inset: 0; display: none; place-items: center; z-index: 8; font-size: 15px; background: rgba(4, 7, 12, 0.5); }
#pause.on { display: grid; }
#boostbtn { display: none; }

/* ---------------------------------------------------------------- sources */
dialog#more { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: transparent; color: var(--ink); overflow: auto; overscroll-behavior: contain; }
#story, .top, #depth, #hud, #help, #toast, #win { transition: opacity 0.5s ease; }
body.sheet-on #story, body.sheet-on .top, body.sheet-on #depth, body.sheet-on #hud, body.sheet-on #help, body.sheet-on #toast, body.sheet-on #win, body.sheet-on #hint { opacity: 0 !important; }
dialog#more::backdrop { background: linear-gradient(90deg, rgba(3, 5, 10, 0.94) 0%, rgba(3, 5, 10, 0.84) 50%, rgba(3, 5, 10, 0.3) 100%); }
dialog#more[open]::backdrop { animation: fadein 0.6s ease both; }
.sheet { position: relative; max-width: 1080px; padding: clamp(84px, 13vh, 150px) var(--gut) 60px; }
.sheet .close { position: fixed; top: calc(var(--gut) * 0.8); right: var(--gut); z-index: 2; background: none; border: 0; padding: 4px 0; cursor: pointer; font-size: 13px; color: var(--dim); }
.sheet .close:hover, .sheet .close:focus-visible { color: var(--ink); outline: none; }
.more-head { max-width: 760px; margin-bottom: clamp(36px, 7vh, 72px); }
.kick { margin: 0 0 22px; font-size: 14px; color: var(--dim); font-variant-numeric: tabular-nums; }
.sheet h2 { margin: 0; font-weight: 300; font-size: clamp(42px, 5.8vw, 92px); line-height: 0.95; letter-spacing: -0.05em; text-wrap: balance; }
.lede2 { margin: 26px 0 0; max-width: 470px; font-size: 16px; line-height: 1.5; color: var(--dim); }
.acts { list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--faint); }
.acts li { position: relative; border-top: 1px solid var(--faint); }
.acts li::before { content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 1px; background: var(--ink); box-shadow: 0 0 18px 1px rgba(170, 195, 255, 0.7); transform: scaleX(0); transform-origin: left; transition: transform 0.7s cubic-bezier(0.2, 0.7, 0.1, 1); }
.acts li:hover::before, .acts li:focus-within::before { transform: scaleX(1); }
.acts a, .acts button { display: grid; grid-template-columns: 150px 1fr auto; gap: 8px 32px; align-items: baseline; width: 100%; padding: 30px 0 32px; background: none; border: 0; text-align: left; text-decoration: none; cursor: pointer; outline: none; }
.cost { font-size: 13px; color: var(--dim); transition: color 0.3s ease; }
.what { display: grid; gap: 12px; }
.what b { font-weight: 300; font-size: clamp(28px, 3.1vw, 46px); line-height: 1; letter-spacing: -0.04em; transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.1, 1), text-shadow 0.5s ease; }
.what > span { max-width: 46ch; font-size: 15px; line-height: 1.5; color: var(--dim); }
.go { font-size: 13px; color: var(--dim); white-space: nowrap; display: inline-flex; gap: 8px; transition: color 0.3s ease; }
.go i { font-style: normal; display: inline-block; transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.1, 1); }
.acts li:hover .cost, .acts li:focus-within .cost, .acts li:hover .go, .acts li:focus-within .go { color: var(--ink); }
.acts li:hover .what b, .acts li:focus-within .what b { transform: translateX(10px); text-shadow: 0 0 34px rgba(170, 195, 255, 0.55); }
.acts li:hover .go i, .acts li:focus-within .go i { transform: translate(3px, -3px); }
.acts .cite { position: relative; z-index: 1; }
dialog#more[open] .more-head > * { animation: rise 1s cubic-bezier(0.2, 0.7, 0.1, 1) both; }
dialog#more[open] .more-head h2 { animation-delay: 0.08s; }
dialog#more[open] .more-head .lede2 { animation-delay: 0.16s; }
dialog#more[open] .acts li { animation: rise 1s cubic-bezier(0.2, 0.7, 0.1, 1) both; animation-delay: calc(0.26s + var(--i) * 0.07s); }
@keyframes rise { from { opacity: 0; transform: translateY(24px); filter: blur(6px); } }
.srcs-wrap { margin-top: 56px; }
.srcs-wrap summary { display: inline-flex; gap: 14px; align-items: baseline; cursor: pointer; list-style: none; font-size: 15px; }
.srcs-wrap summary::-webkit-details-marker { display: none; }
.srcs-wrap summary::before { content: "+"; width: 12px; color: var(--dim); }
.srcs-wrap[open] summary::before { content: "−"; }
.srcs-wrap summary span { font-size: 13px; color: var(--dim); }
.srcs-wrap summary:hover span, .srcs-wrap summary:focus-visible span { color: var(--ink); }
.srcs-wrap summary:focus-visible { outline: none; }
.srcs { margin: 20px 0 0; padding-left: 1.6em; display: grid; gap: 9px; max-width: 860px; font-size: 13px; line-height: 1.5; color: var(--dim); }
.srcs li:target, .srcs li.hl { color: var(--ink); }
.srcs a { color: var(--ink); }
.credit { margin: 40px 0 0; max-width: 520px; font-size: 12px; line-height: 1.5; color: var(--dim); }
@media (max-width: 760px) {
  dialog#more::backdrop { background: rgba(3, 5, 10, 0.88); }
  .acts a, .acts button { grid-template-columns: 1fr auto; padding: 24px 0 26px; }
  .cost { grid-column: 1; grid-row: 1; }
  .what { grid-column: 1 / -1; }
  .go { grid-column: 2; grid-row: 1; justify-self: end; }
  .go { font-size: 0; } .go i { font-size: 15px; }
  .go { align-self: center; }
  .acts li:hover .what b, .acts li:focus-within .what b { transform: none; }
}
@media (prefers-reduced-motion: reduce) { dialog#more[open] .more-head > *, dialog#more[open] .acts li { animation: none; } }

/* ---------------------------------------------------------------- small screens */
@media (max-width: 720px) {
  :root { --h: clamp(40px, 12vw, 64px); }
  .top nav .link[data-more] { display: none; }
  #gate { grid-template-columns: 1fr; }
  #gate .title { font-size: 34vw; }
  .tl { top: 15vh; }
  .tr { top: 13vh; }
  .bl, .br { bottom: calc(var(--gut) * 3.2); }
  .br, .tr { text-align: left; left: var(--gut); right: auto; }
  .br p, .tr p { margin-left: 0; }
  .c { width: calc(100vw - var(--gut) * 2); }
  .look h2 { letter-spacing: 0.2em; }
  .spec .big { font-size: 34vw; }
  #hud { grid-template-columns: auto auto; gap: 18px 26px; }
  .hud-actions { grid-column: 1 / -1; justify-self: start; }
  #help .keys { display: none; }
  #help .touch { display: block; }
  #help { bottom: auto; top: calc(var(--gut) * 4); width: 80vw; }
  #boostbtn { display: grid; place-items: center; position: fixed; right: var(--gut); bottom: calc(var(--gut) * 6); width: 64px; height: 64px; border-radius: 50%; border: 1px solid var(--faint); background: rgba(4, 7, 12, 0.3); z-index: 7; font-size: 12px; }
  body:not(.flying) #boostbtn { display: none; }
}
@media (pointer: coarse) {
  #boost { display: none; }
  body.flying #game { touch-action: none; }
  body.flying { overscroll-behavior: none; }
  #help .keys { display: none; }
  #help .touch { display: block; }
}
@media (prefers-reduced-motion: reduce) {
  #hint i, .loading, #sound[aria-pressed="true"] .bars b, .look.live h2 { animation: none; }
}
