/* ============================================================
   MIKO — The Leaflet · interface styles
   ============================================================ */
@font-face { font-family: 'Instrument Serif'; src: url("../fonts/instrument-serif-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Instrument Serif'; src: url("../fonts/instrument-serif-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Instrument Serif'; src: url("../fonts/instrument-serif-latin-ext-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Manrope'; src: url("../fonts/manrope-latin.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Manrope'; src: url("../fonts/manrope-latin-ext.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'JetBrains Mono'; src: url("../fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url("../fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --ink: #f3f5f9;
  --ink-2: rgba(243, 245, 249, 0.68);
  --ink-3: rgba(243, 245, 249, 0.42);
  --line: rgba(255, 255, 255, 0.12);
  --glass: rgba(9, 12, 19, 0.58);
  --glass-2: rgba(14, 18, 28, 0.82);
  --cyan: #6ad9ff;
  --royal: #3b8cff;
  --warm: #ffcf9e;
  --paper: #f3efe6;
  --navy: #0b1f4d;
  --serif: 'Instrument Serif', 'Times New Roman', serif;
  --sans: Manrope, 'Helvetica Neue', Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  --cjk: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans CJK SC', 'Noto Sans SC', sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);
  --pad: clamp(16px, 2.4vw, 34px);
  --bar: 0px;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #030304; color: var(--ink); }
body { font-family: var(--sans); font-size: 16px; line-height: 1.5; overflow: hidden; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overscroll-behavior: none; touch-action: none; }
body.is-reading, body.is-overlay { touch-action: auto; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
::selection { background: rgba(106, 217, 255, 0.35); }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 8px; }

/* ---------- stage ---------- */
#stage { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; z-index: 0; background: #030304; }
#living { position: fixed; inset: 0; z-index: 1; pointer-events: none; mix-blend-mode: multiply; overflow: hidden; }
.lp { position: absolute; left: 0; top: 0; transform-origin: 0 0; opacity: 0; transition: opacity .5s var(--ease); backface-visibility: hidden; }
.lp.is-on { opacity: 1; }
.lp svg.lp__ink { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.lp__fig { position: absolute; }
.lp__fig .scene-svg { position: absolute; inset: 0; width: 100%; height: 100%; font-family: var(--sans); transition: opacity .45s var(--ease); }
.lp__fig .scene-svg.is-leaving { opacity: 0; }
/* labels pinned to the real objects in the room */
.tags3d { position: fixed; inset: 0; z-index: 4; pointer-events: none; overflow: hidden; }
.tag3d { position: absolute; left: 0; top: 0; width: 0; height: 0; opacity: 0; transition: opacity .55s var(--ease); will-change: transform, opacity; }
.tag3d.is-on { opacity: 1; }
.tag3d__dot { position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%; background: #bff0ff; box-shadow: 0 0 0 3px rgba(111, 216, 255, .22), 0 0 12px rgba(111, 216, 255, .85); }
.tag3d__line { position: absolute; left: -0.5px; bottom: 4px; width: 1px; height: var(--lift, 46px); background: linear-gradient(to top, rgba(191, 240, 255, .95), rgba(191, 240, 255, .35)); transform-origin: 50% 100%; transform: scaleY(0); transition: transform .5s .05s var(--ease); }
.tag3d.is-on .tag3d__line { transform: scaleY(1); }
.tag3d__box { position: absolute; left: calc(8px + var(--sx, 0px)); bottom: calc(var(--lift, 46px) - 4px); display: block; width: max-content; max-width: min(300px, 60vw); padding: 7px 11px 8px; border-radius: 10px; background: rgba(6, 10, 16, .66); border: 1px solid rgba(191, 240, 255, .26); -webkit-backdrop-filter: blur(10px) saturate(1.2); backdrop-filter: blur(10px) saturate(1.2); box-shadow: 0 10px 30px rgba(0, 0, 0, .35); transform: translateY(6px); opacity: 0; transition: opacity .45s .18s var(--ease), transform .55s .18s var(--ease); }
.tag3d.is-on .tag3d__box { opacity: 1; transform: none; }
.tag3d.is-left .tag3d__box { left: auto; right: calc(8px - var(--sx, 0px)); text-align: right; }
.tag3d.is-down .tag3d__line { bottom: auto; top: 4px; transform-origin: 50% 0; background: linear-gradient(to bottom, rgba(191, 240, 255, .95), rgba(191, 240, 255, .35)); }
.tag3d.is-down .tag3d__box { bottom: auto; top: calc(var(--lift, 46px) - 4px); transform: translateY(-6px); }
.tag3d.is-on.is-down .tag3d__box { transform: none; }
.tag3d__box b { display: block; font: 700 13.5px/1.25 Manrope, system-ui, sans-serif; letter-spacing: .01em; color: #f1f8ff; }
.tag3d__box em { display: block; margin-top: 3px; font: 400 11.5px/1.4 'JetBrains Mono', ui-monospace, monospace; font-style: normal; color: rgba(214, 236, 255, .74); white-space: normal; }
.tag3d.is-warn .tag3d__dot { background: #ffd08a; box-shadow: 0 0 0 3px rgba(255, 176, 90, .25), 0 0 12px rgba(255, 176, 90, .85); }
body[data-lay="portrait"] .tag3d__box { max-width: 52vw; padding: 6px 9px 7px; }
body[data-lay="portrait"] .tag3d__box b { font-size: 12.5px; }
body[data-lay="portrait"] .tag3d__box em { font-size: 10.5px; }
body[data-lay="side"] .tag3d__box { max-width: 34vw; }
#flare { position: fixed; inset: 0; z-index: 2; pointer-events: none; opacity: 0; background:
  radial-gradient(60% 50% at 18% 6%, rgba(255, 196, 140, 0.16), transparent 70%); mix-blend-mode: screen; transition: opacity 1.2s var(--ease); }

/* ---------- letterbox ---------- */
#bars { position: fixed; inset: 0; z-index: 3; pointer-events: none; }
.bar { position: absolute; left: 0; right: 0; height: 10.5vh; background: #000; transform: scaleY(0); transition: transform 1.2s var(--ease-io); }
.bar--top { top: 0; transform-origin: 50% 0; }
.bar--bottom { bottom: 0; transform-origin: 50% 100%; }
body.is-letterbox .bar { transform: scaleY(1); }

/* ---------- buttons ---------- */
.ibtn { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: rgba(8, 10, 16, 0.42); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); display: inline-grid; place-items: center; cursor: pointer; transition: border-color .3s, background .3s, transform .3s var(--ease); }
.ibtn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ibtn:hover { border-color: rgba(255, 255, 255, 0.35); background: rgba(20, 26, 40, 0.6); }
.ibtn:active { transform: scale(.94); }
#btn-auto .i-play { display: none; fill: currentColor; stroke: none; }
#btn-auto[aria-pressed="false"] .i-play { display: block; }
#btn-auto[aria-pressed="false"] .i-pause { display: none; }
#btn-sound .i-wave { display: none; }
#btn-sound[aria-pressed="true"] .i-wave { display: block; }
#btn-sound[aria-pressed="true"] .i-mute { display: none; }
.tbtn { display: inline-flex; align-items: center; gap: .55em; padding: .78em 1.25em; border-radius: 999px; border: 1px solid var(--line); background: rgba(10, 13, 20, 0.5); color: var(--ink); font-size: 14px; font-weight: 600; letter-spacing: .01em; cursor: pointer; transition: background .3s, border-color .3s, transform .3s var(--ease), color .3s; white-space: nowrap; }
.tbtn:hover { border-color: rgba(255, 255, 255, 0.4); background: rgba(24, 30, 46, 0.7); }
.tbtn:active { transform: scale(.97); }
.tbtn--primary { background: linear-gradient(180deg, #f6f8fc, #dfe6f3); color: #071022; border-color: transparent; box-shadow: 0 10px 40px rgba(106, 217, 255, 0.18); }
.tbtn--primary:hover { background: #fff; color: #071022; }
.tbtn--ghost { background: transparent; }
.tbtn--lg { font-size: 15px; padding: 1em 1.6em; }
.tbtn--ink { background: var(--navy); color: #fff; border-color: transparent; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.linkbtn:hover { color: var(--ink); }

/* ---------- HUD ---------- */
.hud { position: fixed; z-index: 10; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: calc(var(--pad) + env(safe-area-inset-top, 0px)) var(--pad) 0; pointer-events: none; opacity: 0; transform: translateY(-8px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
body.is-playing .hud { opacity: 1; transform: none; }
.hud > * { pointer-events: auto; }
.hud__brand { display: inline-flex; align-items: center; gap: 14px; color: var(--ink); text-decoration: none; padding: 8px 4px; }
.hud__mark { font-family: var(--mono); font-weight: 500; font-size: 13px; letter-spacing: .32em; }
.hud__sep { width: 26px; height: 1px; background: var(--ink-3); }
.hud__chapter { font-family: var(--mono); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-2); max-width: 46vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud__tools { display: flex; gap: 10px; }

/* ---------- title card ---------- */
.titlecard { position: fixed; z-index: 6; left: clamp(20px, 7vw, 120px); bottom: calc(10.5vh + clamp(28px, 6vh, 70px)); max-width: min(880px, 86vw); pointer-events: none; }
.titlecard::before { content: ''; position: absolute; z-index: -1; left: -18vw; right: -24vw; top: -16vh; bottom: -14vh; background: radial-gradient(closest-side, rgba(2, 3, 6, 0.62), rgba(2, 3, 6, 0.28) 60%, transparent); opacity: 0; transition: opacity 1.2s var(--ease); pointer-events: none; }
.titlecard.is-on::before { opacity: 1; }
.titlecard--center::before { left: -14vw; right: -14vw; }
.titlecard > * { opacity: 0; transform: translateY(18px); filter: blur(8px); transition: opacity 1.1s var(--ease), transform 1.4s var(--ease), filter 1.2s var(--ease); }
.titlecard.is-on > * { opacity: 1; transform: none; filter: none; }
.titlecard.is-on .titlecard__title { transition-delay: .12s; }
.titlecard.is-on .titlecard__sub { transition-delay: .28s; }
.titlecard__kicker { margin: 0 0 14px; font-family: var(--mono); font-size: 12.5px; letter-spacing: .3em; text-transform: uppercase; color: var(--warm); }
.titlecard__title { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(46px, 7.4vw, 124px); line-height: .96; letter-spacing: -.012em; text-shadow: 0 8px 60px rgba(0, 0, 0, .55); }
.titlecard__title em { font-style: italic; color: #bfe9ff; }
.titlecard__sub { margin: 18px 0 0; max-width: 620px; font-size: clamp(15px, 1.25vw, 18px); color: var(--ink-2); text-shadow: 0 2px 20px rgba(0, 0, 0, .8); }
.titlecard--right { left: auto; right: clamp(20px, 7vw, 120px); text-align: right; }
.titlecard--right .titlecard__sub { margin-left: auto; }
.titlecard--right::before { left: -24vw; right: -18vw; }
.titlecard--center { left: 50%; transform: translateX(-50%); text-align: center; bottom: auto; top: 50%; margin-top: -1em; }
.titlecard--center .titlecard__sub { margin-left: auto; margin-right: auto; }

/* ---------- subtitles ---------- */
.subs { position: fixed; z-index: 6; left: 50%; bottom: calc(10.5vh + 22px); transform: translateX(-50%); margin: 0; width: min(900px, 90vw); text-align: center; font-size: clamp(15px, 1.35vw, 19px); line-height: 1.5; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .9), 0 4px 30px rgba(0, 0, 0, .8); pointer-events: none; opacity: 0; transition: opacity .8s var(--ease); }
.subs.is-on { opacity: 1; }
body:not(.is-letterbox) .subs { bottom: 96px; }

/* ---------- codex ---------- */
.codex { position: fixed; z-index: 7; left: 50%; bottom: 74px; transform: translate(-50%, 20px); width: min(1080px, calc(100vw - 2 * var(--pad))); display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "rail rail rail" "head body actions"; align-items: center; column-gap: 26px; row-gap: 12px; padding: 14px 22px 18px 26px; border-radius: 22px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(18px) saturate(1.25); -webkit-backdrop-filter: blur(18px) saturate(1.25); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45); opacity: 0; transition: opacity .7s var(--ease), transform .9s var(--ease); }
.codex.is-on { opacity: 1; transform: translate(-50%, 0); }
.codex, .overlay, .read, .record { touch-action: pan-y; }
.codex__rail { grid-area: rail; display: flex; gap: 8px; }
.codex.is-archive .codex__rail { display: none; }
.seg { flex: 1; min-width: 0; display: grid; gap: 7px; padding: 6px 0 2px; border: 0; background: none; cursor: pointer; text-align: left; color: var(--ink-3); -webkit-tap-highlight-color: transparent; }
.seg__bar { position: relative; display: block; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.seg__bar i { position: absolute; inset: 0; transform-origin: 0 50%; transform: scaleX(0); background: linear-gradient(90deg, var(--royal), var(--cyan)); border-radius: 3px; box-shadow: 0 0 12px rgba(106, 217, 255, 0.55); will-change: transform; }
.seg.is-done .seg__bar i { background: rgba(243, 245, 249, 0.55); box-shadow: none; }
.seg__lab { font-size: 11.5px; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color .3s; }
.seg__lab b { font-family: var(--mono); font-weight: 500; font-size: 10.5px; margin-right: 7px; }
.seg.is-on { color: var(--ink); }
.seg.is-on .seg__lab b { color: var(--cyan); }
.seg:hover { color: var(--ink-2); }
.seg:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; border-radius: 4px; }
.codex__head { grid-area: head; display: grid; gap: 12px; justify-items: start; align-self: start; padding-top: 4px; }
.codex__count { font-family: var(--mono); font-size: 13px; letter-spacing: .12em; color: var(--cyan); }
.codex__body { grid-area: body; min-width: 0; }
.codex__product { margin: 0 0 4px; font-family: var(--mono); font-size: 11.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--ink-3); }
.codex__title { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(22px, 2vw, 30px); line-height: 1.12; }
.codex__cue { display: flex; gap: 11px; align-items: baseline; margin: 9px 0 0; font-size: 15.5px; line-height: 1.45; color: #dff5ff; opacity: 0; transform: translateY(5px); transition: opacity .35s var(--ease), transform .5s var(--ease); max-width: 70ch; }
.codex__cue.is-in { opacity: 1; transform: none; }
.codex__cuedot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); transform: translateY(-1px); animation: cuepulse 1.6s ease-in-out infinite; }
@keyframes cuepulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.codex:not(.has-cue) .codex__cue { display: none; }
.codex__text { margin: 8px 0 0; font-size: 14.5px; line-height: 1.55; color: var(--ink-2); max-width: 64ch; transition: color .4s; }
.codex.has-cue .codex__text { color: var(--ink-3); font-size: 13.5px; }
.codex__list { margin: 10px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.codex__list li { font-size: 12px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); }
.codex__list li b { color: var(--cyan); font-weight: 600; margin-right: 6px; font-family: var(--mono); font-size: 11px; }
.codex__actions { grid-area: actions; display: grid; gap: 8px; align-self: end; }
.codex__more { display: none; }
.codex__body > * { transition: opacity .35s var(--ease); }
.codex.is-swap .codex__body > * { opacity: 0; }
/* phones in portrait: a bottom sheet led by the live caption */
body[data-lay="portrait"] .codex { left: 10px; right: 10px; width: auto; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); transform: translateY(20px); grid-template-columns: 1fr auto; grid-template-areas: "rail rail" "body body" "head actions"; row-gap: 8px; column-gap: 12px; padding: 10px 16px 12px; border-radius: 18px; max-height: 46vh; overflow: auto; }
body[data-lay="portrait"] .codex.is-on { transform: none; }
body[data-lay="portrait"] .seg { padding: 12px 0 8px; }
body[data-lay="portrait"] .seg__lab { display: none; }
body[data-lay="portrait"] .codex__title { font-size: 21px; }
body[data-lay="portrait"] .codex__product { font-size: 10.5px; letter-spacing: .16em; }
body[data-lay="portrait"] .codex__cue { font-size: 14.5px; margin-top: 7px; }
body[data-lay="portrait"] .codex.has-cue .codex__text, body[data-lay="portrait"] .codex__list { display: none; }
body[data-lay="portrait"] .codex.is-more .codex__text { display: block; }
body[data-lay="portrait"] .codex.is-more .codex__list { display: flex; }
body[data-lay="portrait"] .codex.has-cue .codex__more { display: inline-flex; }
body[data-lay="portrait"] .codex__head { align-self: center; padding: 0; }
body[data-lay="portrait"] .codex__count, body[data-lay="side"] .codex__count { white-space: nowrap; font-size: 12px; }
body[data-lay="portrait"] .codex__actions { grid-auto-flow: column; justify-content: end; align-self: center; gap: 6px; }
body[data-lay="portrait"] .codex__actions .tbtn { padding: 9px 13px; font-size: 13px; }
/* landscape phones and small screens: the codex docks to the right */
body[data-lay="side"] .codex { left: auto; right: 12px; top: 64px; bottom: 12px; width: min(400px, 42vw); transform: translateX(24px); grid-template-columns: 1fr; grid-template-areas: "rail" "head" "body" "actions"; align-content: start; row-gap: 10px; padding: 12px 16px 14px; border-radius: 18px; overflow: auto; }
body[data-lay="side"] .codex.is-on { transform: none; }
body[data-lay="side"] .seg { padding: 10px 0 6px; }
body[data-lay="side"] .seg__lab { display: none; }
body[data-lay="side"] .codex__title { font-size: 20px; }
body[data-lay="side"] .codex__list { display: none; }
body[data-lay="side"] .codex__actions { grid-auto-flow: column; justify-content: start; align-self: end; }
body[data-lay="side"] .codex__actions .tbtn { padding: 9px 13px; font-size: 13px; }
@media (max-height: 500px) {
  body[data-lay="side"] .codex.has-cue .codex__text { display: none; }
  body[data-lay="side"] .codex.is-more .codex__text { display: block; }
  body[data-lay="side"] .codex.has-cue .codex__more { display: inline-flex; }
  body[data-lay="side"] .codex__title { font-size: 18px; }
}
body.has-codex[data-lay="portrait"] .rail, body.has-codex[data-lay="side"] .rail { opacity: 0; pointer-events: none; }

/* ---------- rail ---------- */
.rail { position: fixed; z-index: 8; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); width: min(560px, 70vw); height: 30px; opacity: 0; transition: opacity 1s var(--ease); }
body.is-playing .rail { opacity: 1; }
.rail__track { position: absolute; left: 0; right: 0; top: 14px; height: 1px; background: var(--line); }
.rail__fill { position: absolute; left: 0; top: 0; height: 1px; width: 0; background: linear-gradient(90deg, rgba(106, 217, 255, .2), var(--cyan)); transition: width 1.2s var(--ease); }
.rail__dots { position: absolute; inset: 0; }
.rail__dots button { position: absolute; top: 5px; width: 20px; height: 20px; margin-left: -10px; border: 0; background: transparent; cursor: pointer; padding: 0; }
.rail__dots button::after { content: ''; position: absolute; left: 7px; top: 7px; width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, .28); transition: transform .4s var(--ease), background .4s; }
.rail__dots button.is-major::after { width: 8px; height: 8px; left: 6px; top: 6px; background: rgba(255, 255, 255, .5); }
.rail__dots button.is-seen::after { background: rgba(255, 255, 255, .62); }
.rail__dots button.is-on::after { background: var(--cyan); transform: scale(1.6); box-shadow: 0 0 14px var(--cyan); }
.rail__dots button span { position: absolute; bottom: 24px; left: 50%; transform: translate(-50%, 4px); white-space: nowrap; font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink); background: var(--glass-2); border: 1px solid var(--line); padding: 6px 10px; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; }
.rail__dots button:hover span, .rail__dots button:focus-visible span { opacity: 1; transform: translate(-50%, 0); }

/* ---------- hint ---------- */
.hint { position: fixed; z-index: 8; right: var(--pad); bottom: 22px; display: flex; align-items: center; gap: 12px; margin: 0; font-family: var(--mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-2); opacity: 0; transition: opacity .9s var(--ease); pointer-events: none; }
.hint.is-on { opacity: 1; }
.hint__mouse { width: 18px; height: 28px; border-radius: 10px; border: 1.4px solid var(--ink-2); position: relative; }
.hint__mouse::after { content: ''; position: absolute; left: 50%; top: 6px; width: 2px; height: 6px; margin-left: -1px; border-radius: 2px; background: var(--ink); animation: wheel 1.8s var(--ease) infinite; }
@keyframes wheel { 0% { transform: translateY(0); opacity: 1; } 70% { transform: translateY(8px); opacity: 0; } 100% { opacity: 0; } }

/* ---------- boot ---------- */
.boot { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(60% 50% at 50% 42%, rgba(30, 60, 120, 0.22), transparent 70%), rgba(3, 3, 4, 0.92); transition: opacity 1.4s var(--ease), visibility 1.4s; }
.boot.is-ready { background: radial-gradient(60% 50% at 50% 42%, rgba(10, 20, 40, 0.5), transparent 75%), rgba(3, 3, 4, 0.38); }
.boot.is-gone { opacity: 0; visibility: hidden; pointer-events: none; }
.boot__inner { width: min(640px, 100%); text-align: center; display: grid; justify-items: center; }
.boot__mark { width: 150px; height: 114px; margin-bottom: 30px; filter: drop-shadow(0 18px 50px rgba(60, 160, 255, 0.35)); animation: breathe 5s ease-in-out infinite; }
.boot__mark img { width: 100%; height: 100%; object-fit: contain; }
@keyframes breathe { 0%, 100% { transform: translateY(0) scale(1); opacity: .92; } 50% { transform: translateY(-4px) scale(1.02); opacity: 1; } }
.boot__kicker { margin: 0 0 12px; font-family: var(--mono); font-size: 12px; letter-spacing: .34em; text-transform: uppercase; color: var(--warm); }
.boot__title { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(44px, 8vw, 92px); line-height: 1; letter-spacing: -.01em; }
.boot__title em { color: #bfe9ff; }
.boot__lede { margin: 20px 0 34px; max-width: 520px; color: var(--ink-2); font-size: 16px; }
.boot__progress { width: min(320px, 70vw); height: 1px; background: var(--line); position: relative; overflow: hidden; }
.boot__progress i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, transparent, var(--cyan)); transition: width .4s var(--ease); }
.boot__status { margin: 14px 0 0; font-family: var(--mono); font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); min-height: 1.5em; }
.boot__actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 6px; animation: rise .9s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.boot.is-ready .boot__progress, .boot.is-ready .boot__status { display: none; }
.boot__foot { margin: 30px 0 0; display: flex; flex-wrap: wrap; gap: 8px 10px; justify-content: center; font-size: 12.5px; color: var(--ink-3); }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 20; padding: calc(var(--pad) + env(safe-area-inset-top, 0px)) var(--pad) var(--pad); background: rgba(4, 6, 10, 0.72); backdrop-filter: blur(22px) saturate(1.2); -webkit-backdrop-filter: blur(22px) saturate(1.2); overflow: auto; animation: fade .5s var(--ease) both; }
@keyframes fade { from { opacity: 0; } }
.overlay__bar { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: clamp(18px, 4vh, 40px); }
.overlay__kicker { margin: 0 0 6px; font-family: var(--mono); font-size: 12px; letter-spacing: .3em; text-transform: uppercase; color: var(--warm); }

/* menu */
.menu__grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(24px, 6vw, 90px); max-width: 1240px; margin: 0 auto; }
.menu__title { margin: 0 0 18px; font-family: var(--serif); font-weight: 400; font-size: clamp(40px, 5vw, 72px); line-height: 1; }
.menu__list ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.menu__item { display: grid; grid-template-columns: 56px 1fr auto; align-items: baseline; gap: 10px; width: 100%; padding: 12px 14px; border: 0; border-radius: 12px; background: transparent; text-align: left; cursor: pointer; color: var(--ink-2); transition: background .25s, color .25s; }
.menu__item:hover, .menu__item:focus-visible, .menu__item.is-on { background: rgba(255, 255, 255, 0.06); color: var(--ink); }
.menu__item.is-current .menu__name::after { content: '  ●'; color: var(--cyan); font-size: 10px; vertical-align: middle; }
.menu__num { font-family: var(--serif); font-size: 26px; color: var(--warm); }
.menu__name { font-size: 17px; font-weight: 600; }
.menu__sub { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.menu__item.is-child { grid-template-columns: 56px 1fr auto; padding-top: 8px; padding-bottom: 8px; }
.menu__item.is-child .menu__num { font-family: var(--mono); font-size: 11px; color: var(--ink-3); letter-spacing: .1em; }
.menu__item.is-child .menu__name { font-weight: 500; font-size: 15.5px; }
.menu__aside { position: sticky; top: 0; align-self: start; padding: 28px; border-radius: 22px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); min-height: 320px; }
.menu__aside img { width: 120px; height: 92px; object-fit: contain; margin-bottom: 18px; }
.menu__aside h3 { margin: 0 0 6px; font-family: var(--serif); font-weight: 400; font-size: 40px; line-height: 1.04; }
.menu__aside .k { margin: 0 0 14px; font-family: var(--mono); font-size: 11.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--cyan); }
.menu__aside p { color: var(--ink-2); margin: 0 0 12px; }
.menu__aside .rec { font-family: var(--mono); font-size: 12px; color: var(--ink-3); letter-spacing: .06em; }
.menu__settings { max-width: 1240px; margin: 34px auto 0; padding-top: 22px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; }
.toggle, .select { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.toggle input { appearance: none; width: 38px; height: 22px; border-radius: 22px; background: rgba(255, 255, 255, 0.14); position: relative; cursor: pointer; transition: background .3s; margin: 0; }
.toggle input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .3s var(--ease); }
.toggle input:checked { background: var(--royal); }
.toggle input:checked::after { transform: translateX(16px); }
.select select { font: inherit; color: var(--ink); background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; }
.select option { background: #0c1018; }

/* archive */
.archive__title { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(36px, 4.6vw, 64px); line-height: 1; }
.archive__tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: 1320px; margin: 0 auto 14px; }
.tab { padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.tab.is-on { background: var(--ink); color: #071022; border-color: transparent; }
.archive__search { margin-left: auto; flex: 0 1 380px; }
.archive__search input { width: 100%; font: inherit; font-size: 14px; color: var(--ink); background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-radius: 999px; padding: 10px 16px; outline: none; }
.archive__search input:focus { border-color: rgba(106, 217, 255, 0.6); }
.archive__filters { display: flex; flex-wrap: wrap; gap: 8px; max-width: 1320px; margin: 0 auto 22px; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink-2); font-size: 12.5px; cursor: pointer; }
.chip.is-on { border-color: var(--cyan); color: var(--ink); background: rgba(106, 217, 255, 0.1); }
.archive__panel { max-width: 1320px; margin: 0 auto; }
.recs { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.rcard { position: relative; text-align: left; padding: 20px 20px 18px; border-radius: 18px; border: 1px solid var(--line); background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015)); cursor: pointer; color: var(--ink); display: grid; gap: 10px; transition: border-color .3s, transform .4s var(--ease), background .3s; }
.rcard:hover { border-color: rgba(106, 217, 255, 0.45); transform: translateY(-3px); }
.rcard__top { display: flex; align-items: center; gap: 12px; }
.rcard__top img { width: 46px; height: 35px; object-fit: contain; }
.rcard__name { font-family: var(--serif); font-size: 26px; line-height: 1; }
.rcard__no { font-family: var(--mono); font-size: 12.5px; letter-spacing: .08em; color: var(--cyan); }
.rcard__zh { margin: 0; font-family: var(--cjk); font-size: 15px; line-height: 1.5; color: var(--ink); }
.rcard__en { margin: 0; font-size: 13px; color: var(--ink-2); }
.rcard__meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.rcard__seen { position: absolute; top: 16px; right: 16px; font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--cyan); opacity: 0; }
.rcard.is-seen .rcard__seen { opacity: 1; }
.empty { color: var(--ink-3); padding: 40px 0; }
.tline { list-style: none; margin: 0; padding: 0 0 0 26px; position: relative; display: grid; gap: 18px; }
.tline::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 1px; background: linear-gradient(var(--cyan), rgba(106, 217, 255, 0.1)); }
.tline li { position: relative; display: grid; grid-template-columns: 120px 1fr; gap: 16px; }
.tline li::before { content: ''; position: absolute; left: -24px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: #071022; border: 1.5px solid var(--cyan); }
.tline li.is-pub::before { background: var(--cyan); }
.tline time { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); letter-spacing: .06em; padding-top: 2px; }
.tline .ev { font-size: 14.5px; }
.tline .ev b { font-weight: 700; }
.tline .ev span { display: block; font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); letter-spacing: .06em; }
.tline .ev button { all: unset; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(255, 255, 255, 0.3); }
.record { position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100vw); z-index: 25; background: #f3efe6; color: var(--navy); overflow: auto; padding: calc(28px + env(safe-area-inset-top, 0px)) clamp(20px, 4vw, 48px) 60px; box-shadow: -40px 0 120px rgba(0, 0, 0, 0.55); animation: slide .6s var(--ease) both; }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.record__bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 26px; }
.record__bar .tbtn { background: transparent; color: var(--navy); border-color: rgba(11, 31, 77, 0.2); }
.record__bar .tbtn:hover { background: rgba(11, 31, 77, 0.06); }
.record__k { margin: 0 0 6px; font-family: var(--mono); font-size: 12px; letter-spacing: .24em; text-transform: uppercase; color: #1268e8; }
.record h3 { margin: 0 0 6px; font-family: var(--serif); font-weight: 400; font-size: clamp(34px, 4vw, 52px); line-height: 1.02; }
.record .zh { font-family: var(--cjk); font-size: 18px; line-height: 1.6; margin: 18px 0 4px; }
.record .en { color: #4d5b7c; margin: 0 0 22px; }
.record dl { display: grid; grid-template-columns: 170px 1fr; gap: 10px 18px; margin: 0 0 26px; padding: 18px 0; border-top: 1px solid rgba(11, 31, 77, 0.14); border-bottom: 1px solid rgba(11, 31, 77, 0.14); font-size: 14.5px; }
.record dt { font-family: var(--mono); font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: #6a7898; padding-top: 2px; }
.record dd { margin: 0; }
.record dd .cn { font-family: var(--cjk); }
.record h4 { margin: 26px 0 10px; font-family: var(--mono); font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: #1268e8; }
.record p { line-height: 1.65; }
.record .abs-zh { font-family: var(--cjk); font-size: 15px; line-height: 1.85; color: #233056; }
.record ol { padding-left: 20px; line-height: 1.6; }
.record ol li { margin-bottom: 8px; }
.record .note { font-size: 13px; color: #6a7898; }

/* ---------- read mode ---------- */
.read { position: fixed; inset: 0; z-index: 32; background: var(--paper); color: var(--navy); overflow: auto; animation: fade .5s var(--ease) both; }
.read__bar { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px var(--pad); background: rgba(243, 239, 230, 0.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid rgba(11, 31, 77, 0.1); }
.read__bar p { margin: 0; font-family: var(--mono); font-size: 12px; letter-spacing: .2em; text-transform: uppercase; }
.read__bar p span { color: #6a7898; }
.read__doc { max-width: 780px; margin: 0 auto; padding: clamp(30px, 6vw, 80px) 22px 120px; font-size: 17px; line-height: 1.7; }
.read__doc h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(46px, 7vw, 86px); line-height: 1; margin: 0 0 18px; }
.read__doc h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(32px, 4vw, 48px); line-height: 1.05; margin: 70px 0 10px; }
.read__doc h3 { font-family: var(--serif); font-weight: 400; font-size: 32px; margin: 46px 0 4px; }
.read__doc h4 { font-size: 17px; margin: 24px 0 4px; }
.read__doc .k { font-family: var(--mono); font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: #1268e8; margin: 0; }
.read__doc .lede { font-size: 20px; color: #3a476a; }
.read__doc .meta { font-family: var(--mono); font-size: 13px; color: #6a7898; }
.read__doc .prod { display: flex; align-items: center; gap: 16px; margin-top: 50px; }
.read__doc .prod img { width: 72px; height: 56px; object-fit: contain; }
.read__doc ol, .read__doc ul { padding-left: 22px; }
.read__doc .zh { font-family: var(--cjk); }
.read__doc hr { border: 0; border-top: 1px solid rgba(11, 31, 77, 0.14); margin: 50px 0; }

/* ---------- credits ---------- */
.credits { position: fixed; inset: 0; z-index: 15; overflow: hidden; pointer-events: none; display: grid; place-items: center; }
.credits__roll { position: absolute; left: 50%; top: 100%; width: min(560px, 88vw); transform: translateX(-50%); text-align: center; color: var(--ink); }
.credits__roll.is-rolling { animation: roll var(--roll, 48s) linear forwards; }
@keyframes roll { to { transform: translate(-50%, calc(-100% - 100vh)); } }
.credits__roll h2 { font-family: var(--serif); font-weight: 400; font-size: 64px; line-height: 1; margin: 0 0 8px; }
.credits__roll h3 { margin: 56px 0 10px; font-family: var(--mono); font-size: 12px; letter-spacing: .3em; text-transform: uppercase; color: var(--warm); font-weight: 500; }
.credits__roll p { margin: 4px 0; color: var(--ink-2); font-size: 15.5px; }
.credits__roll .zh { font-family: var(--cjk); color: var(--ink); }
.credits__roll .end { margin-top: 90px; font-family: var(--serif); font-size: 40px; font-style: italic; color: #bfe9ff; }
.credits__actions { position: absolute; left: 50%; bottom: calc(10.5vh + 24px); transform: translateX(-50%); display: flex; gap: 12px; pointer-events: auto; opacity: 0; transition: opacity 1s var(--ease); }
.credits.is-done .credits__actions { opacity: 1; }

/* ---------- toast, cursor ---------- */
.toast { position: fixed; z-index: 40; left: 50%; top: 84px; transform: translateX(-50%); padding: 10px 16px; border-radius: 12px; background: var(--glass-2); border: 1px solid var(--line); font-size: 13.5px; color: var(--ink); animation: rise .5s var(--ease) both; }
#cursor { position: fixed; z-index: 50; left: 0; top: 0; pointer-events: none; width: 34px; height: 34px; margin: -17px 0 0 -17px; opacity: 0; transition: opacity .4s; }
#cursor i { position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.6); transition: transform .35s var(--ease), border-color .35s, background .35s; }
body.has-cursor #cursor { opacity: 1; }
body.cursor-hot #cursor i { transform: scale(1.5); border-color: var(--cyan); background: rgba(106, 217, 255, 0.08); }
body.is-dragging #cursor i { transform: scale(.7); }
body.has-cursor.is-playing #stage { cursor: none; }

.noscript { position: fixed; inset: 0; z-index: 99; background: #030304; color: #fff; padding: 10vh 8vw; font-size: 18px; }
.noscript h1 { font-family: var(--serif); font-weight: 400; font-size: 60px; }

/* ---------- small screens ---------- */
@media (max-width: 1240px) {
  .hint { bottom: 58px; }
}
@media (max-width: 760px) {
  .hud__chapter { display: none; }
  .hud__sep { display: none; }
  .hud__tools { gap: 6px; }
  .ibtn { width: 38px; height: 38px; }
  #btn-read { display: none; }
  .titlecard { left: 20px; right: 20px; bottom: calc(10.5vh + 28px); }
  .titlecard--center { left: 50%; right: auto; width: 88vw; }
  .rail { width: 86vw; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
  .hint { left: 50%; right: auto; transform: translateX(-50%); bottom: 54px; }
  .menu__grid { grid-template-columns: 1fr; }
  .menu__aside { display: none; }
  .record dl { grid-template-columns: 1fr; gap: 2px 0; }
  .record dd { margin-bottom: 10px; }
  .tline li { grid-template-columns: 1fr; gap: 2px; }
  .boot__foot span:last-child { flex-basis: 100%; }
}
@media (max-height: 560px) and (orientation: landscape) {
  .titlecard__title { font-size: clamp(36px, 6vw, 64px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .2s !important; }
}
