/* Layout: one sticky cinema stage (painted canvas world + a faceted three.js chibi rig, Kinoloom diorama style) inside a tall scroll track; letterbox bars carry slug line + subtitles. Single, deliberately dark film look. */
:root {
  --ink: #07070c;          /* letterbox black */
  --paper: #f4efe6;        /* subtitle white */
  --dim: #a9a3b8;          /* timecode / meta */
  --gold: #ffc861;         /* film accent */
  --rose: #ff8fa3;
  --display: "Dela Gothic One", "Hiragino Sans", "Arial Black", sans-serif;
  --body: "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --bar: clamp(56px, 11vh, 104px);
  color-scheme: dark;
}
html, body { background: var(--ink); color: var(--paper); }
html { overflow-anchor: none; }
.next { position: absolute; right: max(16px, env(safe-area-inset-right, 0px)); top: 50%; transform: translateY(-50%); font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); opacity: 0; transition: opacity .5s; pointer-events: none; display: flex; gap: 8px; align-items: center; }
.next.on { opacity: .9; }
.next i { font-style: normal; display: inline-block; animation: nudge 1.6s ease-in-out infinite; }
.fact { position: absolute; z-index: 4; top: calc(var(--bar) + 14px); left: max(16px, env(safe-area-inset-left, 0px)); width: min(270px, 62vw); padding: 12px 14px 13px; border-radius: 12px; background: rgba(10,10,18,.6); border: 1px solid rgba(255,255,255,.12); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: var(--paper); transition: opacity .35s, transform .35s; }
.fact.swap { opacity: 0; transform: translateY(-6px); }
.fact[hidden] { display: none !important; }
.fact h3 { margin: 0 0 8px; font-family: var(--mono); font-weight: 500; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.fact .bar-row { display: grid; grid-template-columns: 92px 1fr 30px; align-items: center; gap: 8px; font-size: 12.5px; margin: 4px 0; }
.fact .track-bar { height: 5px; border-radius: 3px; background: rgba(255,255,255,.12); overflow: hidden; }
.fact .track-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--rose), var(--gold)); border-radius: 3px; }
.fact .pct { font-family: var(--mono); font-size: 11px; color: var(--dim); text-align: right; font-variant-numeric: tabular-nums; }
.fact .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.fact .chips span, .fact .chips a { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: rgba(255,255,255,.1); color: var(--paper); text-decoration: none; }
.fact .chips a { border: 1px solid rgba(255,200,97,.5); color: var(--gold); }
.fact .chips a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
@media (max-width: 560px) { .fact { top: calc(var(--bar) + 8px); padding: 9px 11px; } .fact .bar-row { grid-template-columns: 74px 1fr 26px; font-size: 11.5px; } }
@media (max-height: 520px) and (orientation: landscape) {
  :root { --bar: 40px; }
  .bar.top { font-size: 9.5px; letter-spacing: .08em; }
  .sub { gap: 8px; max-width: 70vw; }
  .sub p { font-size: 12px; line-height: 1.3; }
  .sub .portrait { width: 30px; height: 30px; border-width: 1.5px; }
  .next { font-size: 9px; } .next span { display: none; }
  .dots { bottom: 3px; gap: 4px; } .dots b { width: 4px; height: 4px; }
  .fact { top: calc(var(--bar) + 6px); width: min(200px, 34vw); padding: 7px 9px; border-radius: 9px; max-height: calc(100vh - var(--bar) * 2 - 16px); overflow: hidden; }
  .fact h3 { font-size: 9px; margin-bottom: 4px; }
  .fact .bar-row { grid-template-columns: 60px 1fr 22px; font-size: 10px; gap: 5px; margin: 2px 0; }
  .fact .chips { gap: 4px; margin-top: 3px; } .fact .chips span, .fact .chips a { font-size: 10px; padding: 2px 6px; }
  .titlecard h1 { font-size: min(16vw, 26vh); }
  .titlecard .kicker { font-size: 9px; } .titlecard .hint { font-size: 11px; margin-top: 6px; }
  .endcard { top: calc(var(--bar) + 8px); gap: 3px; } .endcard h2 { font-size: 28px; } .endcard a, .endcard span { font-size: 10.5px; }
}
.dots { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); display: flex; gap: 6px; }
.dots b { width: 6px; height: 6px; border-radius: 50%; background: var(--dim); opacity: .35; transition: opacity .3s, background .3s, transform .3s; }
.dots b.on { background: var(--gold); opacity: 1; transform: scale(1.3); }
@media (max-width: 720px) { .next span { display: none; } }
@media (prefers-reduced-motion: reduce) { .next i { animation: none; } }
body { font-family: var(--body); margin: 0; }
.track { height: 2700vh; position: relative; }
.stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; background: var(--ink); }
canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#gl { z-index: 3; pointer-events: none; }


.bar { position: absolute; left: 0; right: 0; height: var(--bar); background: var(--ink); z-index: 5; display: flex; align-items: center; gap: 16px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.bar.top { top: 0; justify-content: space-between; font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }
.bar.top .slug { color: var(--paper); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: opacity .4s; }
.bar.top .tc { font-variant-numeric: tabular-nums; color: var(--gold); flex: none; }
.bar.bottom { bottom: 0; justify-content: center; }
.sub { display: flex; align-items: center; gap: 14px; max-width: 760px; min-width: 0; transition: opacity .35s, transform .35s; }
.sub .portrait { width: 60px; height: 60px; flex: none; border-radius: 50%; overflow: hidden; background: radial-gradient(circle at 50% 35%, #5b4a7a, #2a2240); border: 2px solid var(--gold); }
.sub .portrait canvas { position: static; width: 100%; height: 100%; }
.sub p { margin: 0; font-size: clamp(14px, 2.1vw, 19px); line-height: 1.45; text-wrap: balance; min-width: 0; }
.sub p a { color: var(--gold); text-underline-offset: 3px; }
.sub.swap { opacity: 0; transform: translateY(6px); }

.titlecard { position: absolute; inset: var(--bar) 0; z-index: 4; display: grid; place-content: center; text-align: center; gap: 10px; pointer-events: none; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.titlecard h1 { margin: 0; font-family: var(--display); font-weight: 400; font-size: clamp(64px, 16vw, 200px); line-height: .9; letter-spacing: .02em; color: var(--paper); text-shadow: 0 4px 0 rgba(0,0,0,.18), 0 18px 40px rgba(40,20,60,.35); }
.titlecard .kicker, .titlecard .hint { text-shadow: 0 1px 2px rgba(0,0,0,.6), 0 0 18px rgba(30,20,50,.5); }
.titlecard .kicker { font-family: var(--mono); font-size: 12px; letter-spacing: .3em; text-transform: uppercase; color: var(--paper); opacity: .85; }
.titlecard .hint { margin-top: 18px; font-size: 14px; color: var(--paper); opacity: .9; animation: nudge 1.8s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(6px); } }

.endcard { position: absolute; z-index: 4; right: max(16px, env(safe-area-inset-right, 0px)); top: calc(var(--bar) + 24px); display: grid; gap: 8px; text-align: right; opacity: 0; transition: opacity .6s; pointer-events: none; }
.endcard.on { opacity: 1; pointer-events: auto; }
.endcard h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: clamp(28px, 5vw, 56px); color: var(--paper); }
.endcard a, .endcard span { font-family: var(--mono); font-size: 13px; color: var(--gold); letter-spacing: .04em; }
.endcard a:focus-visible, .sub a:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) { .titlecard .hint { animation: none; } }
@media (max-width: 520px) { .bar.top .tc span { display: none; } .sub .portrait { width: 48px; height: 48px; } }
.bar.top .right { display: flex; align-items: center; gap: 18px; flex: none; }
.skip { color: var(--paper); text-decoration: none; border: 1px solid rgba(255,255,255,.25); border-radius: 999px; padding: 5px 12px; letter-spacing: .1em; }
.skip:hover, .skip:focus-visible { border-color: var(--gold); color: var(--gold); outline: none; }
.endcard a.enter { margin-top: 10px; justify-self: end; font-family: var(--display); font-size: 18px; letter-spacing: .02em; color: var(--ink); background: var(--gold); padding: 10px 18px; border-radius: 999px; text-decoration: none; }
.endcard a.enter:hover, .endcard a.enter:focus-visible { background: var(--paper); outline: none; }
.endcard .count { font-family: var(--mono); font-size: 12px; color: var(--dim); min-height: 1em; }
.low .sub .portrait { display: none; }
@media (max-height: 520px) and (orientation: landscape) { .skip { padding: 3px 8px; font-size: 9px; } .endcard a.enter { font-size: 13px; padding: 6px 12px; margin-top: 4px; } .endcard .count { font-size: 10px; } }
/* phones held upright: a taller subtitle bar, a compact top bar, the fact card across the top */
@media (orientation: portrait) and (max-width: 760px) {
  :root { --bar: 54px; }
  .bar.top { font-size: 9.5px; letter-spacing: .06em; gap: 10px; }
  .bar.top .tc { display: none; }
  .skip { padding: 4px 9px; font-size: 9.5px; }
  .bar.bottom { height: auto; min-height: 92px; padding-block: 12px 22px; }
  .sub { max-width: none; }
  .sub p { font-size: 14px; line-height: 1.4; }
  .fact { right: max(16px, env(safe-area-inset-right, 0px)); width: auto; top: calc(var(--bar) + 10px); }
  .fact .bar-row { grid-template-columns: 96px 1fr 28px; }
  .titlecard h1 { font-size: 22vw; }
  .endcard { top: calc(var(--bar) + 14px); }
  .endcard a.enter { font-size: 15px; }
}
