/* ---------- The night he fell: 2.5D scroll story (/story) ---------- */
body[data-page="story"] { background: #04136b; color: #fff; }
html.st-locked, html.st-locked body { overflow: hidden; }
.st-root { --ink: #092b42; --u: 0; --conf: 0; position: relative; font: 400 17px/1.55 Rubik, system-ui, Arial, sans-serif; color: #fff; }
.st-root .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.st-track { width: 1px; height: 2400vh; }
.st-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100lvh; display: block; z-index: 0; background: #04136b; }
.st-ov { position: fixed; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.st-root [data-in] { visibility: hidden; opacity: 0; will-change: opacity, transform; }

/* top bar */
.st-top {
  position: fixed; inset: 0 0 auto; z-index: 12; display: flex; align-items: center; gap: 16px;
  padding: max(14px, env(safe-area-inset-top)) clamp(14px, 3vw, 32px) 14px;
  background: linear-gradient(rgba(3, 10, 50, .42), rgba(3, 10, 50, 0));
}
.st-brand { color: #fff; font-size: 28px; text-shadow: 0 2px 0 var(--ink); }
.st-brand img { width: 36px; height: 31px; }
.st-page { position: absolute; left: 50%; top: max(24px, calc(env(safe-area-inset-top) + 10px)); transform: translateX(-50%); margin: 0; height: 1.4em; min-width: 20em; text-align: center; font-size: 11px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; color: rgba(255, 255, 255, .9); text-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.st-page span { position: absolute; inset: 0; white-space: nowrap; }
.st-actions { display: flex; gap: 8px; margin-left: auto; }
.st-btn { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 8px 14px; border: 2px solid var(--ink); border-radius: 999px; background: #fff9e9; color: var(--ink); font-size: 14px; font-weight: 800; box-shadow: 2px 3px 0 var(--ink); transition: transform .15s, box-shadow .15s, opacity .3s; }
.st-btn:hover:not(:disabled) { transform: translate(-1px, -1px); box-shadow: 3px 4px 0 var(--ink); }
.st-btn:active:not(:disabled) { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
.st-btn:disabled { opacity: 0; pointer-events: none; }
.st-sound[aria-pressed="true"] { background: #ffdc6e; }
.st-skip { background: #ffdc6e; }
.st-skip svg { margin-right: -2px; }
.st-end .st-skip { opacity: 0; pointer-events: none; }
[data-phase="loading"] .st-top, [data-phase="ready"] .st-top { background: none; }

/* chapter dots */
.st-dots { position: fixed; right: clamp(10px, 2vw, 26px); top: 50%; transform: translateY(-50%); z-index: 5; display: grid; gap: 4px; }
.st-dots button { position: relative; display: grid; place-items: center; width: 26px; height: 22px; padding: 0; border: 0; background: none; }
.st-dots button::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, .55); box-shadow: 0 0 0 1.5px rgba(9, 43, 66, .5); transition: transform .25s, background .25s; }
.st-dots button.on::before { background: #ffdc6e; transform: scale(1.5); box-shadow: 0 0 0 2px var(--ink); }
.st-dots button span { position: absolute; right: 30px; top: 50%; transform: translate(6px, -50%); white-space: nowrap; padding: 4px 9px; border: 2px solid var(--ink); border-radius: 8px; background: #fff9e9; color: var(--ink); font-size: 12px; font-weight: 800; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.st-dots button:hover span, .st-dots button:focus-visible span { opacity: 1; transform: translate(0, -50%); }
.st-dots button:disabled { opacity: 0; }

.st-scroll { position: fixed; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); z-index: 3; transform: translateX(-50%); margin: 0; display: grid; justify-items: center; gap: 6px; font-size: 11px; font-weight: 800; letter-spacing: .3em; text-transform: uppercase; color: rgba(255, 255, 255, .85); transition: opacity .5s; pointer-events: none; }
.st-scroll i { width: 20px; height: 32px; border: 2px solid rgba(255, 255, 255, .8); border-radius: 12px; position: relative; }
.st-scroll i::after { content: ''; position: absolute; left: 50%; top: 6px; width: 4px; height: 7px; margin-left: -2px; border-radius: 2px; background: #fff; animation: st-wheel 1.6s ease-in-out infinite; }
@keyframes st-wheel { 0% { transform: translateY(0); opacity: 1; } 70% { transform: translateY(10px); opacity: 0; } 100% { opacity: 0; } }
.st-moved .st-scroll, [data-phase="loading"] .st-scroll, [data-phase="ready"] .st-scroll { opacity: 0; }

/* lettering shared */
.st-kicker { margin: 0 0 .5em; font-size: 12px; font-weight: 800; letter-spacing: .24em; text-transform: uppercase; color: #ffdc6e; text-shadow: 0 1px 0 var(--ink); }
.st-title { position: absolute; left: 50%; top: 11%; translate: -50% 0; width: min(92vw, 900px); text-align: center; }
.st-title h1, .st-gate h1 { margin: 0; text-wrap: balance; font-size: clamp(38px, 8.4vw, 118px); font-weight: 900; line-height: .9; letter-spacing: -.055em; text-transform: uppercase; color: #fff9e9; -webkit-text-stroke: .045em var(--ink); paint-order: stroke fill; text-shadow: .04em .06em 0 var(--ink); }
.st-place { position: absolute; left: clamp(18px, 6vw, 90px); bottom: max(76px, 11vh); max-width: min(88vw, 640px); }
.st-place h2 { margin: 0 0 .18em; font-size: clamp(56px, 11vw, 150px); font-weight: 900; line-height: .85; letter-spacing: -.06em; text-transform: uppercase; color: #fff9e9; -webkit-text-stroke: .04em var(--ink); paint-order: stroke fill; text-shadow: .035em .055em 0 var(--ink); rotate: -3deg; }
.st-cap { display: inline-block; margin: 0; padding: .42em .7em; max-width: min(90vw, 26em); border: 2.5px solid var(--ink); background: #fff0a5; color: var(--ink); box-shadow: 4px 4px 0 var(--ink); font-size: clamp(17px, 2.1vw, 28px); font-weight: 700; font-style: italic; line-height: 1.2; rotate: -1.4deg; text-wrap: balance; }
.st-bottom { position: absolute; left: 50%; bottom: max(70px, calc(env(safe-area-inset-bottom) + 56px)); translate: -50% 0; text-align: center; }
.st-sfx span, .st-stamp span { display: block; }

/* projected lettering: the wrapper is moved by script, the inner span pops */
.st-at { position: absolute; left: 0; top: 0; }
.st-at > span { position: absolute; left: 0; top: 0; translate: -50% -50%; white-space: nowrap; }
.st-sfx > span { font-weight: 900; font-style: italic; letter-spacing: -.07em; line-height: 1; color: #fff9e4; -webkit-text-stroke: .075em var(--ink); paint-order: stroke fill; text-shadow: .04em .07em 0 var(--ink), .05em .09em 0 var(--ink); }
.st-plip > span { font-size: clamp(34px, 6vw, 84px); color: #c6fbf3; rotate: -10deg; }
.st-plink > span { font-size: clamp(18px, 2.2vw, 30px); color: #e6fbff; rotate: -6deg; letter-spacing: -.03em; }
.st-krrk > span { font-size: clamp(64px, 13vw, 190px); text-transform: uppercase; color: #fff; rotate: -12deg; }
.st-pop > span { font-size: clamp(80px, 17vw, 250px); text-transform: uppercase; color: #ffda49; rotate: -12deg; }
.st-sfx.on > span { animation: st-slam .5s cubic-bezier(.2, 1.9, .4, 1) both; }
@keyframes st-slam { 0% { scale: 2.2; opacity: 0; } 60% { opacity: 1; } 100% { scale: 1; } }
.st-plip.on > span, .st-plink.on > span { animation: st-blip .6s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes st-blip { 0% { scale: .3; opacity: 0; } 100% { scale: 1; opacity: 1; } }

.st-q > span { display: grid; place-items: center; min-width: 1.6em; height: 1.6em; padding: 0 .25em; border: 3px solid var(--ink); border-radius: 50% 50% 50% 12%; background: #fff; color: var(--ink); font-size: clamp(20px, 2.4vw, 32px); font-weight: 900; box-shadow: 2px 3px 0 var(--ink); translate: -50% -100%; }
.st-q.on > span { animation: st-q .55s cubic-bezier(.3, 2, .5, 1) both, st-bob 2.4s 0.6s ease-in-out infinite; }
@keyframes st-q { 0% { scale: 0; rotate: -30deg; } 100% { scale: 1; rotate: 0deg; } }
@keyframes st-bob { 50% { transform: translateY(-6px) rotate(4deg); } }

.st-bubble > span { padding: .5em .85em; translate: -12% -112%; max-width: 86vw; border: 4px solid var(--ink); border-radius: 52% 48% 47% 53% / 60% 55% 45% 40%; background: #fffdf0; color: var(--ink); box-shadow: 3px 4px 0 var(--ink); font-size: clamp(24px, 3.6vw, 52px); rotate: 3deg; }
.st-bubble > span::before, .st-bubble > span::after { content: ''; position: absolute; left: 12%; bottom: -.62em; width: .8em; height: .8em; background: var(--ink); clip-path: polygon(30% 0, 100% 0, 0 100%); }
.st-bubble > span::after { left: calc(12% + 4px); bottom: -.36em; width: .56em; height: .58em; background: #fffdf0; }
.st-bubble.on > span { animation: st-pop-in .5s cubic-bezier(.3, 1.8, .5, 1) both; }
@keyframes st-pop-in { 0% { scale: .2; opacity: 0; } 100% { scale: 1; opacity: 1; } }

/* no map. no money. no idea. */
.st-stamp { position: absolute; }
.st-stamp > span { padding: .12em .38em .18em; border: .09em solid #e2477e; border-radius: .18em; color: #e2477e; background: rgba(255, 249, 233, .9); font-size: clamp(34px, 6.4vw, 92px); font-weight: 900; line-height: 1; letter-spacing: -.04em; text-transform: uppercase; box-shadow: .06em .07em 0 var(--ink); }
.st-stamp.on > span { animation: st-stamp .38s cubic-bezier(.2, 1.7, .5, 1) both; }
@keyframes st-stamp { 0% { scale: 2.4; opacity: 0; filter: blur(2px); } 100% { scale: 1; opacity: 1; filter: none; } }
.st-stamp-0 { right: 5vw; top: 13vh; rotate: 8deg; }
.st-stamp-1 { right: 3vw; bottom: 16vh; rotate: -6deg; }
.st-stamp-2 { left: 4vw; bottom: 7vh; rotate: -9deg; }

.st-inv { position: absolute; left: clamp(14px, 3vw, 36px); top: max(86px, calc(env(safe-area-inset-top) + 74px)); width: min(270px, 62vw); padding: 12px 14px 14px; border: 2.5px solid var(--ink); border-radius: 14px; background: #fff9e9; color: var(--ink); box-shadow: 4px 5px 0 var(--ink); font-size: 14px; rotate: -2deg; }
.st-inv-title { margin: 0 0 8px; font-size: 11px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; color: #0b7fb8; }
.st-inv-row { display: flex; justify-content: space-between; margin: 0; padding: 5px 0; border-top: 1.5px dashed rgba(9, 43, 66, .25); }
.st-inv-row span { font-family: var(--hand); font-weight: 700; }
.st-inv-conf { margin-top: 6px; padding-top: 7px; border-top: 1.5px dashed rgba(9, 43, 66, .25); }
.st-meter { position: relative; height: 14px; margin: 6px 0 4px; border: 2px solid var(--ink); border-radius: 8px; background: #fff; }
.st-meter i { position: absolute; left: -1px; top: -1px; bottom: -1px; width: calc(var(--conf) * 160% + 2px); max-width: 190%; border-radius: 7px; background: linear-gradient(90deg, #2fb6ea, #ffdc6e 60%, #ff9cbc); border: 2px solid var(--ink); margin: -2px; }
.st-over { display: inline-block; font-family: var(--hand); font-weight: 700; color: #e2477e; opacity: calc((var(--conf) - .55) * 3); transform: scale(calc(.8 + var(--conf) * .3)) rotate(-4deg); transform-origin: left; }

/* finale */
.st-finale { position: fixed; z-index: 4; left: 50%; top: max(92px, 13vh); width: min(92vw, 760px); translate: -50% 0; text-align: center; color: var(--ink); }
.st-finale h2 { margin: 0; font-size: clamp(40px, 7vw, 92px); font-weight: 900; line-height: .9; letter-spacing: -.055em; text-transform: uppercase; color: #fff9e9; -webkit-text-stroke: .045em var(--ink); paint-order: stroke fill; text-shadow: .035em .055em 0 var(--ink); }
.st-finale h2 span { display: block; }
.st-finale h2 span + span { color: #ffdc6e; font-size: .62em; margin-top: .12em; }
.st-finale .st-kicker { color: #fff; text-shadow: 0 1px 2px rgba(9, 43, 66, .6); }
.st-shout { margin: .3em 0 .7em; font-family: var(--hand); font-size: clamp(26px, 3.6vw, 44px); font-weight: 700; color: var(--ink); text-shadow: 0 2px 0 rgba(255, 255, 255, .7); rotate: -3deg; }
.st-cta { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.st-go { display: inline-flex; align-items: center; justify-content: center; min-height: 54px; padding: 12px 24px; border: 2.5px solid var(--ink); border-radius: 999px; background: #fff9e9; color: var(--ink); font-size: 17px; font-weight: 900; box-shadow: 4px 5px 0 var(--ink); transition: transform .15s, box-shadow .15s; }
.st-go:hover { transform: translate(-2px, -2px) rotate(-1deg); box-shadow: 6px 7px 0 var(--ink); }
.st-go:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.st-go-play { background: #ffdc6e; }
.st-again { display: flex; justify-content: center; align-items: center; gap: 14px; margin: 16px 0 0; font-size: 14px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px rgba(9, 43, 66, .7); }
.st-again button { min-height: 40px; padding: 6px 12px; border: 0; border-radius: 999px; background: rgba(9, 43, 66, .55); color: #fff; font-weight: 800; }
.st-again button:hover { background: var(--ink); }
.st-again span { font-family: var(--hand); padding: 6px 12px; border-radius: 999px; background: rgba(9, 43, 66, .55); }

/* gate */
.st-gate { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 24px; background: radial-gradient(120% 90% at 50% 100%, #0b2a8c 0%, #04136b 45%, #020a3a 100%); text-align: center; animation: st-fade .4s both; }
.st-gate::before { content: ''; position: absolute; inset: 0; background-image: radial-gradient(1.5px 1.5px at 12% 18%, #fff 50%, transparent 52%), radial-gradient(1px 1px at 72% 12%, #fff 50%, transparent 52%), radial-gradient(1.5px 1.5px at 88% 40%, #ffe9b0 50%, transparent 52%), radial-gradient(1px 1px at 30% 70%, #fff 50%, transparent 52%), radial-gradient(1.5px 1.5px at 55% 32%, #fff 50%, transparent 52%), radial-gradient(1px 1px at 8% 60%, #ffe9b0 50%, transparent 52%), radial-gradient(1px 1px at 92% 78%, #fff 50%, transparent 52%), radial-gradient(1.5px 1.5px at 44% 88%, #fff 50%, transparent 52%); opacity: .8; animation: st-twinkle 3s ease-in-out infinite alternate; }
@keyframes st-twinkle { to { opacity: .35; } }
@keyframes st-fade { from { opacity: 0; } }
.st-gate-in { position: relative; display: grid; justify-items: center; gap: 10px; max-width: 560px; }
.st-gate-bean { width: 128px; height: auto; animation: st-float 3s ease-in-out infinite; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, .25)); }
@keyframes st-float { 50% { transform: translateY(-10px) rotate(-4deg); } }
.st-gate h1 { font-size: clamp(38px, 8vw, 96px); margin-bottom: 14px; }
.st-load { width: min(260px, 70vw); height: 12px; border: 2px solid #fff9e9; border-radius: 8px; overflow: hidden; }
.st-load i { display: block; height: 100%; width: calc(var(--p) * 100%); background: #ffdc6e; transition: width .3s; }
.st-note { margin: 4px 0 0; font-family: var(--hand); font-size: 15px; color: rgba(255, 255, 255, .8); }
.st-begin { font-size: 19px; min-height: 60px; padding: 14px 30px; animation: st-pop-in .5s cubic-bezier(.3, 1.8, .5, 1) both; }
.st-quiet { border: 0; background: none; color: #fff; font-weight: 700; font-size: 14px; text-decoration: underline; text-underline-offset: 4px; padding: 10px; }
.st-fail { max-width: 26em; color: #fff; }
[data-phase="playing"] .st-gate { display: none; }

@media (max-width: 760px) {
  .st-brand { font-size: 23px; }
  .st-brand img { width: 28px; height: 25px; }
  .st-page { top: auto; bottom: max(14px, env(safe-area-inset-bottom)); font-size: 10px; letter-spacing: .14em; min-width: 18em; position: fixed; }
  .st-btn { min-height: 38px; padding: 6px 11px; font-size: 13px; }
  .st-sound span { display: none; }
  .st-dots { right: 4px; gap: 0; }
  .st-dots button { width: 22px; height: 20px; }
  .st-dots button::before { width: 7px; height: 7px; }
  .st-dots button span { display: none; }
  .st-title { top: 13%; }
  .st-title h1, .st-gate h1 { font-size: clamp(36px, 12.5vw, 64px); }
  .st-bubble > span { translate: -50% -112%; font-size: 26px; }
  .st-bubble > span::before { left: 46%; } .st-bubble > span::after { left: calc(46% + 4px); }
  .st-place { bottom: 12vh; left: 16px; }
  .st-bottom { bottom: max(64px, calc(env(safe-area-inset-bottom) + 50px)); width: 86vw; max-width: 86vw; text-wrap: balance; }
  .st-inv { top: max(70px, calc(env(safe-area-inset-top) + 60px)); width: min(220px, 58vw); font-size: 12.5px; padding: 9px 11px 11px; }
  .st-stamp-0 { right: 5vw; top: auto; bottom: 34vh; }
  .st-stamp-1 { right: 5vw; top: auto; bottom: 22vh; }
  .st-stamp-2 { left: 5vw; bottom: 10vh; }
  .st-finale { top: max(78px, 11vh); }
  .st-go { min-height: 50px; padding: 11px 18px; font-size: 16px; flex: 1 1 100%; max-width: 340px; }
}
@media (prefers-reduced-motion: reduce) {
  .st-root *, .st-root *::before, .st-root *::after { animation-duration: .01s !important; animation-iteration-count: 1 !important; }
}
