:root {
  color-scheme: dark;
  --night: #0c1019;
  --ink: #f4efe6;
  --ink-soft: rgba(244, 239, 230, .72);
  --ink-faint: rgba(244, 239, 230, .46);
  --rule: rgba(242, 232, 213, .24);
  --gold: #d3bf91;
  --rose: #c9899e;
  --font-editorial: 'Palatino Linotype', 'Book Antiqua', Georgia, serif;
  --font-ui: 'Aptos', 'Segoe UI', sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: var(--font-ui);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--night);
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { min-width: 320px; min-height: 420px; background: var(--night); }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid #ead8a8; outline-offset: 3px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.story-app { width: 100%; height: 100%; min-height: 100svh; background: var(--night); }
.story-stage {
  --light-ambient-opacity: .3;
  --light-key-opacity: .5;
  --light-key-x: 50%;
  --light-key-y: 50%;
  --light-direction: 145deg;
  --light-fog-opacity: .03;
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
  background: #111725;
}
.scene-content, .scene-root { position: absolute; inset: 0; overflow: hidden; }
.scene-content { z-index: 1; transform-origin: 50% 50%; }
.scene-root { animation: scene-arrive 1.4s cubic-bezier(.16, 1, .3, 1) both; }
.scene-root::before, .scene-root::after { position: absolute; content: ''; pointer-events: none; }
.scene-root::before { inset: 0; z-index: 0; }
.scene-root > :not(.spatial-node) { position: absolute; }
.scene-root > .spatial-node { position: absolute; left: 50%; top: 50%; transform-origin: center center; will-change: transform, filter, opacity; }
.ambient-node { position: relative; transform-origin: center center; }
.spatial-node.is-in-focus { --focus-edge: rgba(249, 226, 174, .9); }
.depth-label { display: none; position: absolute; z-index: 50; left: 50%; top: -18px; transform: translateX(-50%); padding: 4px 6px; border: 1px solid rgba(240, 220, 171, .5); background: rgba(12, 15, 24, .78); color: #f4dfaa; font: 9px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .03em; white-space: nowrap; pointer-events: none; }
.depth-debug-active .depth-label { display: block; }
.focus-debug-active .spatial-node.is-in-focus .ambient-node { outline: 1px solid rgba(250, 229, 178, .74); outline-offset: 5px; }
.focus-guide { position: absolute; z-index: 60; left: 26px; top: 50%; display: none; align-items: center; gap: 10px; color: rgba(251, 231, 188, .88); font: 9px/1.3 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .12em; }
.focus-guide::before { display: block; width: 20px; height: 1px; content: ''; background: currentColor; }
.focus-debug-active .focus-guide { display: flex; }

/* Separate light compositing keeps the light field independent of the camera tree. */
.lighting-root { position: absolute; z-index: 7; inset: 0; overflow: hidden; pointer-events: none; mix-blend-mode: screen; }
.ambient-field { position: absolute; inset: 0; opacity: var(--light-ambient-opacity); background: radial-gradient(ellipse at 50% 48%, rgba(162, 136, 201, .22), transparent 72%); transition: opacity 1.1s ease; }
.directional-gradient { position: absolute; inset: 0; opacity: .34; background: linear-gradient(var(--light-direction), rgba(250, 230, 187, .16), transparent 54%); }
.radial-light { position: absolute; inset: -12%; opacity: var(--light-key-opacity); background: radial-gradient(ellipse at var(--light-key-x) var(--light-key-y), rgba(255, 244, 214, .7) 0%, rgba(236, 201, 153, .25) 18%, rgba(190, 171, 234, .08) 42%, transparent 68%); transition: opacity .8s ease, background-position 1s ease; }
.fog-field { position: absolute; inset: 0; opacity: var(--light-fog-opacity); background: radial-gradient(ellipse at 50% 80%, rgba(255, 238, 211, .9), transparent 54%); transition: opacity .7s ease; }
.story-stage[data-palette="garden"] .ambient-field { background: radial-gradient(ellipse at 70% 18%, rgba(255, 231, 164, .32), transparent 57%), linear-gradient(180deg, rgba(209, 226, 206, .18), transparent 60%); }
.story-stage[data-palette="forest"] .ambient-field { background: radial-gradient(ellipse at 80% 55%, rgba(188, 207, 151, .28), transparent 56%), linear-gradient(90deg, rgba(16, 42, 38, .36), transparent); }
.story-stage[data-palette="tunnel"] .ambient-field { background: radial-gradient(ellipse at 50% 45%, rgba(138, 104, 177, .25), transparent 68%); }
.story-stage[data-palette="hall"] .ambient-field { background: radial-gradient(ellipse at 74% 37%, rgba(225, 186, 112, .24), transparent 53%); }
.story-stage[data-palette="clock-garden"] .ambient-field { background: radial-gradient(ellipse at 67% 22%, rgba(250, 218, 226, .25), transparent 53%); }
.story-stage[data-palette="tea"] .ambient-field { background: radial-gradient(ellipse at 52% 43%, rgba(232, 192, 143, .24), transparent 58%); }
.story-stage[data-palette="card-kingdom"] .ambient-field { background: radial-gradient(ellipse at 52% 34%, rgba(209, 105, 115, .3), transparent 60%); }
.story-stage[data-palette="wake"] .ambient-field { background: radial-gradient(ellipse at 70% 17%, rgba(255, 233, 182, .22), transparent 56%); }
.story-stage[data-palette="tunnel"] .radial-light { background: radial-gradient(ellipse at var(--light-key-x) var(--light-key-y), rgba(255, 247, 222, .95) 0%, rgba(155, 180, 255, .3) 22%, rgba(50, 33, 95, 0) 62%); }
.story-stage[data-palette="forest"] .radial-light { background: radial-gradient(ellipse at var(--light-key-x) var(--light-key-y), rgba(239, 226, 168, .48), rgba(143, 169, 137, .12) 30%, transparent 62%); }
.story-stage[data-palette="hall"] .radial-light { background: radial-gradient(ellipse at var(--light-key-x) var(--light-key-y), rgba(246, 219, 157, .62), rgba(202, 166, 111, .13) 34%, transparent 65%); }
.story-stage[data-palette="clock-garden"] .radial-light { background: radial-gradient(ellipse at var(--light-key-x) var(--light-key-y), rgba(247, 224, 228, .66), rgba(216, 192, 237, .15) 34%, transparent 68%); }
.story-stage[data-palette="card-kingdom"] .radial-light { background: radial-gradient(ellipse at var(--light-key-x) var(--light-key-y), rgba(240, 201, 139, .52), rgba(177, 76, 87, .15) 30%, transparent 66%); }
.atmosphere-canvas { position: absolute; z-index: 10; inset: 0; display: block; width: 100%; height: 100%; pointer-events: none; }
.paper-texture { position: absolute; z-index: 11; inset: 0; opacity: .075; background: url('/src/assets/paper-grain.svg') repeat; background-size: 256px 256px; mix-blend-mode: soft-light; pointer-events: none; }

/* Story chrome */
.story-topbar { position: absolute; z-index: 34; top: 0; left: 0; display: flex; align-items: center; justify-content: space-between; width: 100%; padding: calc(var(--safe-top) + 22px) clamp(22px, 4vw, 64px) 0; transition: opacity .35s ease; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; color: rgba(249, 239, 218, .94); text-decoration: none; font: 20px/1 var(--font-editorial); letter-spacing: .2em; }
.wordmark-mark { display: block; width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.1; }
.wordmark-mark circle { fill: currentColor; stroke: none; }
.chapter-progress { position: absolute; left: 50%; top: calc(var(--safe-top) + 35px); display: flex; align-items: center; gap: 5px; transform: translateX(-50%); }
.progress-segment { display: block; width: clamp(10px, 1.45vw, 22px); height: 1px; background: rgba(237, 226, 205, .28); transition: background .45s ease, box-shadow .45s ease; }
.progress-segment.is-past { background: rgba(237, 226, 205, .72); }
.progress-segment.is-current { height: 2px; background: #ead8ae; box-shadow: 0 0 12px rgba(235, 215, 169, .3); }
.topbar-right { display: flex; align-items: center; gap: 21px; }
.scene-count { color: rgba(249, 239, 218, .94); font: 15px/1 var(--font-editorial); letter-spacing: .11em; white-space: nowrap; }
.scene-count i { padding: 0 4px; color: rgba(249, 239, 218, .54); font-style: normal; }
.diagnostics-open, .diagnostics-close { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 1px solid rgba(246, 234, 211, .3); border-radius: 50%; color: rgba(249, 239, 218, .84); background: rgba(12, 15, 23, .12); cursor: pointer; transition: border-color .25s ease, background .25s ease, transform .25s ease; }
.diagnostics-open:hover, .diagnostics-close:hover { border-color: rgba(246, 234, 211, .78); background: rgba(12, 15, 23, .38); transform: rotate(18deg); }
.diagnostics-open svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.1; }
.scene-title-block { position: absolute; z-index: 31; left: 50%; bottom: calc(110px + var(--safe-bottom)); width: min(90vw, 680px); transform: translateX(-50%); text-align: center; transition: opacity .35s ease, transform .45s ease; pointer-events: none; }
.scene-title-block h1 { margin: 0; color: rgba(250, 242, 228, .97); font: 400 clamp(25px, 3.1vw, 42px)/1.18 var(--font-editorial); letter-spacing: .015em; text-shadow: 0 3px 22px rgba(8, 10, 15, .34); }
.story-navigation { position: absolute; z-index: 34; right: 0; bottom: calc(34px + var(--safe-bottom)); left: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(96px, 17vw, 250px); transition: opacity .35s ease; }
.nav-button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-width: 104px; min-height: 46px; padding: 0 12px; border: 1px solid rgba(241, 229, 205, .56); border-radius: 999px; color: rgba(251, 241, 224, .9); background: rgba(8, 12, 20, .22); font: 500 10px/1 var(--font-ui); letter-spacing: .21em; cursor: pointer; backdrop-filter: blur(8px); transition: color .25s ease, border-color .25s ease, background .25s ease, transform .25s ease, opacity .25s ease; }
.nav-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.3; }
.nav-button:hover:not(:disabled) { color: #fff6e7; border-color: rgba(247, 231, 195, .95); background: rgba(8, 12, 20, .52); transform: translateY(-2px); }
.nav-button:disabled { opacity: .36; cursor: default; }
.nav-prev:disabled { visibility: hidden; }
.story-stage.is-transitioning .story-topbar, .story-stage.is-transitioning .story-navigation, .story-stage.is-transitioning .scene-title-block { opacity: .16; }
.story-stage.is-entering .scene-title-block { animation: title-arrive 1.2s cubic-bezier(.16, 1, .3, 1) both; }
.carrier-debug-badge { position: absolute; z-index: 63; right: 24px; bottom: 104px; display: none; padding: 7px 9px; border: 1px solid rgba(248, 220, 164, .7); color: #f8dca4; background: rgba(11, 13, 21, .8); font: 10px/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .08em; }
.carrier-debug-active .carrier-debug-badge { display: block; }

/* Scene handoff: the carrier is never black and is fully opaque at the swap point. */
.handoff-carrier { position: absolute; z-index: 25; inset: -1px; overflow: hidden; opacity: 0; pointer-events: none; transform: translateZ(0); }
.carrier-surface { position: absolute; inset: -3%; transform: scale(var(--carrier-scale, .9)); transform-origin: 50% 50%; background: radial-gradient(ellipse at 50% 50%, rgba(255, 244, 220, .94), rgba(155, 180, 255, .45) 37%, rgba(50, 33, 95, .98) 100%); }
.carrier-motif { position: absolute; left: 50%; top: 50%; width: min(72vmin, 740px); aspect-ratio: 1; border: 1px solid rgba(255, 247, 225, .45); border-radius: 50%; transform: translate(-50%, -50%) scale(var(--carrier-scale, .9)) rotate(calc(var(--carrier-progress, 0) * 40deg)); opacity: .65; }
.carrier-motif-b { width: min(49vmin, 500px); border-style: dashed; opacity: .33; }
.carrier-glyph { position: absolute; left: 50%; top: 50%; width: 23vmin; height: 36vmin; min-width: 118px; min-height: 190px; border: 1px solid rgba(255, 239, 207, .5); border-radius: 48% 48% 52% 52% / 42% 42% 58% 58%; transform: translate(-50%, -50%) rotate(calc(var(--carrier-progress, 0) * 24deg)) scale(var(--carrier-scale, .9)); opacity: .58; }
.handoff-carrier[data-kind="foliage"] .carrier-surface { background: radial-gradient(ellipse at 45% 50%, rgba(155, 175, 129, .92), rgba(48, 76, 61, .98) 64%, #182a29 100%); }
.handoff-carrier[data-kind="foliage"] .carrier-glyph { border: 0; border-radius: 55% 4% 55% 4%; background: rgba(198, 206, 158, .34); box-shadow: -24vmin 15vmin 0 2vmin rgba(171, 190, 140, .22), 24vmin -16vmin 0 3vmin rgba(171, 190, 140, .2), 42vmin 20vmin 0 4vmin rgba(171, 190, 140, .14); }
.handoff-carrier[data-kind="rabbit-hole"] .carrier-surface { background: radial-gradient(ellipse at 50% 68%, #171426 0 18%, #413451 19% 23%, #b99b83 24% 27%, #25213d 28% 100%); }
.handoff-carrier[data-kind="rabbit-hole"] .carrier-glyph { width: 62vmin; height: 34vmin; min-width: 260px; min-height: 150px; border-radius: 50%; border: 12px solid rgba(218, 193, 155, .72); box-shadow: inset 0 0 50px rgba(167, 131, 177, .65), 0 0 70px rgba(188, 159, 205, .34); }
.handoff-carrier[data-kind="moonlight"] .carrier-surface { background: radial-gradient(ellipse at 50% 83%, #fff7df 0, #f8f0df 25%, #e5e1ef 54%, rgba(143, 164, 230, .98) 100%); }
.handoff-carrier[data-kind="moonlight"] .carrier-motif { border-color: rgba(91, 95, 129, .22); }
.handoff-carrier[data-kind="moonlight"] .carrier-glyph { border-color: rgba(196, 170, 119, .4); opacity: .22; }
.handoff-carrier[data-kind="portal"] .carrier-surface { background: radial-gradient(ellipse at 50% 52%, #d9c69f, #556078 52%, #182333 100%); }
.handoff-carrier[data-kind="portal"] .carrier-glyph { width: 43vmin; height: 76vmin; border: 9px solid rgba(227, 194, 128, .82); border-radius: 48% 48% 0 0; box-shadow: 0 0 45px rgba(230, 190, 116, .46); }
.handoff-carrier[data-kind="petal"] .carrier-surface { background: radial-gradient(ellipse at 48% 48%, #e8bec7, #b4829b 54%, #4b3b60 100%); }
.handoff-carrier[data-kind="petal"] .carrier-glyph { width: 52vmin; height: 90vmin; border: 0; background: rgba(238, 205, 208, .3); border-radius: 50% 50% 8% 8% / 62% 62% 15% 15%; }
.handoff-carrier[data-kind="playing-card"] .carrier-surface { background: radial-gradient(ellipse at 50% 52%, #ede2c8, #c8b493 56%, #604858 100%); }
.handoff-carrier[data-kind="playing-card"] .carrier-glyph { width: 52vmin; height: 84vmin; border: 5px solid #f1e8d6; border-radius: 12px; background: linear-gradient(135deg, rgba(255,255,255,.16), rgba(117,52,67,.18)); box-shadow: inset 0 0 0 10px rgba(102, 55, 68, .3), 0 15px 80px rgba(27, 16, 28, .24); }
.handoff-carrier[data-kind="warm-light"] .carrier-surface { background: radial-gradient(ellipse at 50% 50%, #fff9e9 0, #f4e8ca 40%, #d9cba9 75%, #a9938a 100%); }
.handoff-carrier[data-kind="warm-light"] .carrier-glyph { border: 0; background: rgba(255, 248, 227, .24); box-shadow: 0 0 120px 40px rgba(255, 249, 231, .52); }

/* Shared vector primitives */
.vector-art { display: block; width: 100%; height: 100%; overflow: visible; }
.primitive { position: relative; flex: 0 0 auto; }
.ring-primitive { width: min(88vw, 1160px); height: min(72vh, 710px); }
.ring-primitive .vector-art { overflow: visible; fill: none; stroke: rgba(218, 206, 234, .54); stroke-width: 3; }
.ring-primitive .ring-inner { stroke: rgba(237, 199, 200, .34); stroke-width: 2; stroke-dasharray: 3 5; }
.ring-tone-rose .vector-art { stroke: rgba(222, 168, 178, .62); }
.ring-tone-ivory .vector-art { stroke: rgba(224, 217, 237, .5); }
.door-primitive { width: clamp(116px, 19vw, 270px); height: clamp(220px, 60vh, 610px); }
.door-primitive .door-shadow { fill: rgba(12, 17, 28, .54); stroke: rgba(202, 194, 178, .42); stroke-width: 2; }
.door-primitive .door-outline { fill: none; stroke: rgba(220, 206, 176, .78); stroke-width: 3; }
.door-primitive .door-panel { fill: rgba(152, 146, 145, .15); stroke: rgba(226, 216, 196, .42); stroke-width: 1; }
.door-tone-moon .door-outline { stroke: rgba(195, 205, 209, .7); }
.door-tone-gold .door-outline { stroke: rgba(223, 186, 116, .9); }
.card-primitive { width: clamp(80px, 12vw, 174px); height: auto; aspect-ratio: 120 / 176; filter: drop-shadow(0 17px 24px rgba(11, 12, 20, .24)); }
.card-paper { fill: #e9dec9; stroke: #f5edda; stroke-width: 2; }
.card-border { fill: none; stroke: rgba(133, 76, 77, .65); stroke-width: 1.5; }
.card-rank { fill: #71404b; font: 18px Georgia, serif; }
.card-suit { fill: #874653; }
.card-tone-crimson .card-suit { fill: #923e4c; }
.card-tone-ivory .card-suit { fill: #4d3f4c; }
.card-suit-center { opacity: .82; }
.petal-primitive { width: clamp(48px, 8vw, 124px); height: clamp(85px, 16vw, 225px); }
.petal-primitive .vector-art { fill: rgba(198, 128, 151, .82); stroke: rgba(238, 202, 204, .7); stroke-width: 2; }
.petal-tone-rose .vector-art { fill: rgba(177, 95, 121, .83); }
.petal-tone-ivory .vector-art { fill: rgba(233, 223, 194, .84); }
.petal-vein { fill: none; stroke: rgba(248, 221, 213, .52); stroke-width: 1.4; }
.clock-primitive { width: clamp(66px, 11vw, 154px); height: auto; aspect-ratio: 1; }
.clock-rim { fill: #5d4551; stroke: #d4b982; stroke-width: 3; }
.clock-face { fill: #e5d9c2; stroke: #f4ead5; stroke-width: 1.5; }
.clock-tick { stroke: #654b52; stroke-width: 1.4; }
.clock-hand { fill: none; stroke: #764653; stroke-width: 2.4; stroke-linecap: round; transform-origin: 50px 51px; }
.clock-hand-minute { animation: clock-minute 22s linear infinite; }
.clock-pin { fill: #8e5c50; }
.clock-label { fill: #836b62; font: 6px Georgia, serif; text-anchor: middle; letter-spacing: .08em; }
.clock-tone-moon .clock-rim { fill: #39394d; stroke: #e2d0a8; }
.clock-tone-rose .clock-rim { fill: #624557; stroke: #ddb5bd; }
.arch-primitive { position: absolute; inset: 0; width: 100%; height: 100%; }
.arch-primitive .vector-art { fill: rgba(74, 22, 43, .3); stroke: rgba(226, 182, 149, .68); stroke-width: 2; }
.arch-tone-gold .vector-art { stroke: rgba(227, 197, 141, .8); }
.arch-inner { fill: none; stroke: rgba(243, 210, 165, .32); stroke-width: 1; }
.light-field { position: absolute; inset: -15%; border-radius: 50%; pointer-events: none; }
.light-field-radial { background: radial-gradient(ellipse, rgba(255, 239, 202, .6), transparent 65%); }
.fog-band { z-index: 9; left: -8%; right: -8%; bottom: -5%; height: 24%; pointer-events: none; background: radial-gradient(ellipse at 50% 100%, rgba(237, 229, 208, .23), transparent 70%); filter: blur(16px); opacity: .76; }
.fog-tone-lavender { background: radial-gradient(ellipse at 50% 100%, rgba(215, 192, 228, .22), transparent 72%); }
.fog-tone-moon { background: radial-gradient(ellipse at 50% 100%, rgba(222, 225, 217, .3), transparent 70%); }
.fog-tone-rose { background: radial-gradient(ellipse at 50% 100%, rgba(224, 183, 200, .24), transparent 70%); }
.fog-tone-plum { background: radial-gradient(ellipse at 50% 100%, rgba(206, 134, 150, .22), transparent 70%); }
.flower-primitive { width: 46px; height: 58px; }
.flower-primitive .vector-art { overflow: visible; }
.flower-petal { fill: #e4d7b6; stroke: rgba(249, 233, 196, .6); stroke-width: 1; transform-origin: 50px 50px; }
.flower-tone-rose .flower-petal { fill: #c68898; }
.flower-tone-sage .flower-petal { fill: #c3c9a3; }
.flower-tone-gold .flower-petal { fill: #d8bc7f; }
.flower-tone-lavender .flower-petal { fill: #b7a8c7; }
.flower-center { fill: #a98656; }
.flower-stem { fill: none; stroke: rgba(99, 121, 86, .86); stroke-width: 2; }
.cup-primitive { width: clamp(80px, 13vw, 176px); height: auto; aspect-ratio: 150 / 110; }
.cup-body { fill: #e5d9c1; stroke: #967f70; stroke-width: 2; }
.cup-rim, .cup-handle { fill: none; stroke: #9a8172; stroke-width: 3; }
.cup-saucer { fill: #d9c7aa; stroke: #967f70; stroke-width: 2; }
.cup-tone-rose .cup-body { fill: #d7b0b7; }
.book-primitive { width: clamp(90px, 14vw, 186px); height: auto; aspect-ratio: 180 / 120; }
.book-left, .book-right { fill: #645263; stroke: #d6bf92; stroke-width: 2; }
.book-right { fill: #766473; }
.book-spine, .book-primitive .vector-art path:not(.book-left):not(.book-right) { fill: none; stroke: #ead7b2; stroke-width: 1.4; }
.key-primitive { width: clamp(95px, 15vw, 190px); height: auto; aspect-ratio: 180 / 100; }
.key-head, .key-stem { fill: #bf9e5b; stroke: #f2dfac; stroke-width: 3; }
.key-hole { fill: #222437; stroke: #ead4a0; stroke-width: 2; }
.leaf-primitive { width: clamp(100px, 19vw, 260px); height: auto; aspect-ratio: 160 / 100; transform: scaleX(var(--leaf-direction, 1)); }
.leaf-primitive .vector-art { fill: #758962; stroke: rgba(187, 194, 145, .55); stroke-width: 2; }
.leaf-tone-moss .vector-art { fill: #3d5849; }
.leaf-vein { fill: none; stroke: rgba(219, 221, 175, .5); stroke-width: 1.2; }
.steam-curve { position: absolute; left: 45%; top: -80%; width: 34%; height: 90%; overflow: visible; }
.steam-curve path { fill: none; stroke: rgba(245, 237, 219, .6); stroke-width: 2; stroke-dasharray: 7 7; animation: steam-rise 3.8s ease-in-out infinite; }
.steam-curve:nth-child(2) path { animation-delay: -1.4s; }

/* Alice and Rabbit are transparent, reusable character atlases. */
.character-figure { width: clamp(112px, 19vw, 274px); aspect-ratio: 3 / 4; }
.character-sprite { width: 100%; height: 100%; background-repeat: no-repeat; background-size: 400% 200%; image-rendering: auto; }
.alice-sprite { background-image: url('/src/assets/alice-character-atlas.png'); }
.rabbit-sprite { background-image: url('/src/assets/white-rabbit-atlas.png'); }
.alice-sprite[data-pose="idle"] { background-position: 0% 0%; }
.alice-sprite[data-pose="curious"] { background-position: 33.333% 0%; }
.alice-sprite[data-pose="side"] { background-position: 66.667% 0%; }
.alice-sprite[data-pose="run"] { background-position: 100% 0%; }
.alice-sprite[data-pose="fall"] { background-position: 0% 100%; }
.alice-sprite[data-pose="fall-reach"] { background-position: 33.333% 100%; }
.alice-sprite[data-pose="reach"] { background-position: 66.667% 100%; }
.alice-sprite[data-pose="wake"] { background-position: 100% 100%; }
.rabbit-sprite[data-pose="idle"] { background-position: 0% 0%; }
.rabbit-sprite[data-pose="alert"] { background-position: 33.333% 0%; }
.rabbit-sprite[data-pose="run"] { background-position: 66.667% 0%; }
.rabbit-sprite[data-pose="jump"] { background-position: 100% 0%; }
.rabbit-sprite[data-pose="reach"] { background-position: 0% 100%; }
.rabbit-sprite[data-pose="distance"] { background-position: 33.333% 100%; }
.rabbit-sprite[data-pose="back"] { background-position: 66.667% 100%; }
.rabbit-sprite[data-pose="end"] { background-position: 100% 100%; }
.character-figure.is-falling { animation: alice-weightless 5.8s ease-in-out infinite; }
.character-figure.is-reaching { animation: alice-reach 4.8s ease-in-out infinite; }
.character-figure.is-running { animation: run-bob .52s ease-in-out infinite alternate; }
.rabbit-small { width: clamp(74px, 12vw, 170px); }
.scene-garden .alice-figure, .scene-wake .alice-figure { width: clamp(180px, 22vw, 300px); }
.scene-garden .rabbit-figure, .scene-wake .rabbit-figure { width: clamp(96px, 13vw, 175px); }
.scene-follow .alice-figure { width: clamp(170px, 20vw, 280px); }
.scene-follow .rabbit-figure { width: clamp(120px, 14vw, 190px); }
.scene-tunnel .alice-figure { width: clamp(250px, 29vw, 390px); }
.scene-hall .alice-figure { width: clamp(180px, 22vw, 300px); }
.scene-clock-garden .alice-figure { width: clamp(150px, 18vw, 240px); }
.scene-tea .alice-figure { width: clamp(142px, 18vw, 240px); }
.scene-tea .rabbit-figure { width: clamp(118px, 15vw, 210px); }
.scene-card-kingdom .alice-figure { width: clamp(180px, 23vw, 310px); }
.scene-wake .rabbit-figure { opacity: .9; }
.alice-sprite[data-pose="wake"] { background-position: 0% 0%; }

/* 01 — The Garden */
.scene-garden { background: #9eae9f; }
.scene-garden::before { background: linear-gradient(180deg, #9db3b5 0%, #c5c4ab 48%, #718165 100%); }
.scene-garden::after { inset: 0; z-index: 1; background: linear-gradient(90deg, rgba(19, 37, 34, .24), transparent 27% 75%, rgba(25, 38, 31, .22)), linear-gradient(0deg, rgba(22, 40, 31, .52), transparent 34%); }
.garden-sky { z-index: 0; inset: 0; background: linear-gradient(180deg, rgba(203, 216, 208, .45), transparent 48%); }
.garden-sun { z-index: 1; top: 5%; right: 10%; width: min(49vw, 630px); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, rgba(249, 230, 179, .42) 0 8%, rgba(244, 225, 174, .18) 31%, transparent 68%); filter: blur(5px); }
.garden-hill { z-index: 2; left: -12%; width: 124%; border-radius: 50% 50% 0 0 / 18% 20% 0 0; }
.garden-hill-far { bottom: 17%; height: 37%; background: linear-gradient(180deg, #687f6b, #5d765f); transform: rotate(-3deg); }
.garden-hill-mid { bottom: 5%; height: 38%; background: linear-gradient(180deg, #738266, #53694f); transform: rotate(2deg); }
.garden-meadow { z-index: 4; left: -8%; right: -8%; bottom: -16%; height: 38%; border-radius: 52% 48% 0 0 / 16% 22% 0 0; background: linear-gradient(180deg, #617654, #374e40); }
.garden-path { z-index: 5; left: 0; top: 25%; width: 100%; height: 80%; overflow: visible; }
.garden-path path { fill: none; stroke: rgba(227, 213, 177, .3); stroke-width: 44; stroke-linecap: round; }
.garden-path .path-highlight { stroke: rgba(244, 230, 190, .2); stroke-width: 8; }
.garden-canopy { z-index: 8; top: -16%; width: 28%; height: 57%; border-radius: 47%; background: radial-gradient(ellipse at 42% 62%, rgba(66, 88, 66, .78), rgba(35, 58, 50, .05) 72%); filter: blur(5px); }
.garden-canopy-left { left: -13%; transform: rotate(27deg); }
.garden-canopy-right { right: -14%; transform: rotate(-30deg); }
.stone-bench { position: relative; width: clamp(120px, 17vw, 248px); height: 82px; opacity: .64; }
.stone-bench > span { position: absolute; left: 0; top: 20px; width: 100%; height: 17px; border-radius: 4px; background: linear-gradient(#958d7a, #6a6d60); }
.stone-bench > span:last-child { top: 38px; left: 9%; width: 82%; height: 5px; }
.stone-bench i { position: absolute; left: 14%; top: 37px; width: 8px; height: 37px; background: #65695e; box-shadow: 140px 0 0 #65695e; }
.flower-cluster { position: relative; width: 230px; height: 180px; }
.flower-cluster .flower-primitive { position: absolute; bottom: 0; animation: flower-sway 6.4s ease-in-out infinite; transform-origin: 50% 100%; }
.flower-cluster .flower-primitive:nth-child(1) { left: 0; transform: scale(.95) rotate(-8deg); }
.flower-cluster .flower-primitive:nth-child(2) { left: 48px; bottom: 14px; transform: scale(.78) rotate(9deg); animation-delay: -1s; }
.flower-cluster .flower-primitive:nth-child(3) { left: 92px; bottom: -7px; transform: scale(1.05) rotate(-3deg); animation-delay: -2.1s; }
.flower-cluster .flower-primitive:nth-child(4) { left: 137px; bottom: 10px; transform: scale(.84) rotate(10deg); animation-delay: -3s; }
.garden-pollen-note { z-index: 9; inset: 0; opacity: .08; background-image: radial-gradient(#fff1cf 1px, transparent 1.5px); background-size: 78px 93px; }
.wake-memory-glow { z-index: 8; left: 50%; top: 26%; width: 38vw; aspect-ratio: 1; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(circle, rgba(253, 240, 199, .3), transparent 68%); }
.scene-wake::before { background: linear-gradient(180deg, #aebcba, #c8c4aa 48%, #859076 100%); filter: saturate(.78); }
.scene-wake .garden-hill-far { background: linear-gradient(180deg, #7e9281, #70846e); }
.scene-wake .garden-hill-mid { background: linear-gradient(180deg, #86917b, #6c7f68); }
.scene-wake .garden-meadow { background: linear-gradient(180deg, #7d8b6a, #526751); }

/* 02 — Follow the Rabbit */
.scene-follow { background: #16302e; }
.scene-follow::before { background: radial-gradient(ellipse at 74% 55%, rgba(161, 166, 118, .28), transparent 43%), linear-gradient(180deg, #1c3734 0%, #29473e 43%, #213a34 100%); }
.scene-follow::after { inset: 0; z-index: 1; background: linear-gradient(90deg, rgba(12, 29, 28, .34), transparent 48%, rgba(11, 26, 29, .35)), linear-gradient(0deg, rgba(11, 23, 24, .7), transparent 46%); }
.forest-canopy { z-index: 2; inset: -18% -5% auto; height: 47%; background: radial-gradient(ellipse at 50% 100%, #516248 0 24%, #273e35 65%, transparent 70%); opacity: .72; }
.forest-light-slash { z-index: 2; top: 5%; bottom: 28%; width: 23%; background: linear-gradient(180deg, rgba(236, 226, 167, .17), rgba(223, 207, 151, .03) 77%, transparent); filter: blur(14px); transform: skewX(-21deg) rotate(8deg); }
.forest-light-slash-one { left: 25%; }
.forest-light-slash-two { right: 17%; top: 0; bottom: 40%; opacity: .72; transform: skewX(-17deg) rotate(-8deg); }
.forest-trunk { position: relative; width: clamp(72px, 14vw, 210px); height: 125vh; margin-top: -12vh; border-radius: 45% 55% 17% 14% / 8% 5% 0 0; background: linear-gradient(90deg, #162c2b, #53614d 18%, #344a3d 42%, #182f30 74%, #101f23); box-shadow: inset 12px 0 21px rgba(212, 185, 127, .07), 16px 0 35px rgba(8, 22, 23, .24); transform: rotate(-2deg); }
.forest-trunk i, .forest-trunk b, .forest-trunk span { position: absolute; display: block; border-radius: 50%; background: rgba(10, 26, 28, .3); }
.forest-trunk i { left: 24%; top: 21%; width: 9px; height: 40%; transform: rotate(6deg); }
.forest-trunk b { right: 17%; top: 38%; width: 5px; height: 48%; transform: rotate(-4deg); }
.forest-trunk span { left: 7%; top: 59%; width: 62%; height: 2px; transform: rotate(-18deg); }
.forest-path { z-index: 3; left: 0; top: 27%; width: 100%; height: 80%; }
.forest-path path { fill: none; stroke: rgba(176, 172, 130, .38); stroke-width: 51; stroke-linecap: round; }
.forest-path .path-shadow { stroke: rgba(12, 27, 29, .46); stroke-width: 82; }
.rabbit-hole-mouth { z-index: 4; left: 69%; top: 33%; width: min(24vw, 340px); height: min(40vh, 390px); transform: translate(-50%, -50%) rotate(14deg); border-radius: 50%; background: radial-gradient(ellipse, #0d1218 0 44%, #342f3b 46% 52%, rgba(197, 174, 131, .26) 56%, transparent 64%); box-shadow: 0 0 80px rgba(191, 181, 140, .11); animation: hole-pulse 7s ease-in-out infinite; }
.rabbit-hole-mouth span { position: absolute; inset: 21%; border: 1px solid rgba(198, 183, 148, .2); border-radius: 50%; }
.rabbit-hole-mouth i { position: absolute; left: 51%; top: 51%; width: 8px; height: 8px; border-radius: 50%; background: #d7c494; box-shadow: 0 0 30px 8px rgba(231, 208, 157, .45); }
.forest-ground-mist { z-index: 8; inset: auto -10% -10%; height: 32%; background: radial-gradient(ellipse at 50% 50%, rgba(204, 211, 190, .19), transparent 70%); filter: blur(24px); }
.forest-tree-node .ambient-node { animation: tree-drift 10s ease-in-out infinite; }
.forest-tree-node:nth-child(even) .ambient-node { animation-delay: -4s; }

/* 03 — Down the Rabbit Hole */
.scene-tunnel { background: #17132a; }
.scene-tunnel::before { background: radial-gradient(ellipse at 50% 78%, rgba(233, 214, 177, .12), transparent 28%), radial-gradient(ellipse at 50% 46%, #2b2440 0%, #1b1730 36%, #0c0d1d 78%, #080b13 100%); }
.scene-tunnel::after { z-index: 3; inset: 0; background: radial-gradient(ellipse at 50% 50%, transparent 35%, rgba(7, 8, 17, .46) 100%); }
.tunnel-vignette { z-index: 2; inset: 0; background: repeating-radial-gradient(ellipse at 50% 49%, transparent 0 9.7%, rgba(191, 171, 208, .035) 10% 10.2%, transparent 10.6% 16.4%); mix-blend-mode: screen; }
.tunnel-wall-motifs { z-index: 2; inset: 0; opacity: .12; background: repeating-linear-gradient(163deg, transparent 0 75px, rgba(225, 208, 223, .16) 76px 77px, transparent 78px 143px); mask-image: radial-gradient(ellipse at center, transparent 22%, #000 67%, transparent 100%); }
.tunnel-ring-node .ambient-node { animation: tunnel-ring-float calc(12s + var(--node-depth, 0) * 2s) ease-in-out infinite alternate; }
.ring-depth-0 { opacity: .42; }
.ring-depth-1 { opacity: .62; }
.ring-depth-2 { opacity: .88; }
.ring-depth-3 { opacity: .92; }
.ring-depth-4 { opacity: .48; }
.clock-pass-node .ambient-node { animation: clock-pass 8s cubic-bezier(.18,.7,.32,1) infinite; }
.book-pass-node .ambient-node { animation: prop-float 9s ease-in-out infinite; }
.picture-frame { width: clamp(90px, 14vw, 180px); aspect-ratio: 220 / 300; padding: 5px; border: 2px solid #ad8c5f; background: rgba(47, 37, 49, .9); box-shadow: inset 0 0 0 3px rgba(226, 194, 138, .27), 0 0 28px rgba(13, 10, 27, .3); }
.picture-frame svg { width: 100%; height: 100%; fill: none; stroke: rgba(216, 189, 145, .73); stroke-width: 3; }
.picture-frame svg path { fill: rgba(176, 154, 180, .12); }
.frame-tone-rose { border-color: #a37282; filter: hue-rotate(336deg); }
.tunnel-bottom-portal { z-index: 2; left: 50%; bottom: -21%; width: min(72vw, 980px); height: 52%; transform: translateX(-50%); border-radius: 50% 50% 0 0; background: radial-gradient(ellipse at 50% 0%, rgba(255, 243, 207, .82), rgba(201, 211, 247, .24) 25%, rgba(131, 112, 172, .08) 51%, transparent 70%); filter: blur(13px); animation: portal-breath 7s ease-in-out infinite; }
.tunnel-bottom-portal span { position: absolute; left: 16%; right: 16%; top: 0; height: 3px; border-radius: 50%; background: rgba(255, 245, 218, .7); box-shadow: 0 0 38px 13px rgba(247, 229, 183, .26); }
.tunnel-light-ray { z-index: 2; left: 50%; top: 54%; width: 13%; height: 50%; transform-origin: 50% 0; background: linear-gradient(180deg, rgba(249, 235, 198, .12), transparent); filter: blur(15px); }
.tunnel-light-ray-one { transform: rotate(17deg); }
.tunnel-light-ray-two { transform: rotate(-20deg); opacity: .7; }

/* 04 — Hall of Doors */
.scene-hall { background: #17212c; }
.scene-hall::before { background: radial-gradient(ellipse at 74% 38%, rgba(218, 190, 132, .24), transparent 32%), linear-gradient(180deg, #1f2b39, #27333a 58%, #111b25); }
.hall-architecture { z-index: 1; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 18%, rgba(187, 199, 195, .055) 18.1% 18.25%, transparent 18.4% 35%); }
.hall-wall-glow { z-index: 2; right: 18%; top: 17%; width: 34%; height: 42%; border-radius: 50%; background: radial-gradient(ellipse, rgba(235, 204, 145, .28), transparent 68%); filter: blur(18px); }
.hall-perspective { z-index: 4; inset: 43% -5% -5%; background: repeating-linear-gradient(172deg, transparent 0 44px, rgba(199, 191, 171, .17) 45px 46px, transparent 47px 88px); transform: perspective(400px) rotateX(56deg); transform-origin: center top; mask-image: linear-gradient(180deg, #000, transparent 87%); }
.hall-floor-reflection { z-index: 3; left: 29%; right: 21%; bottom: 0; height: 34%; background: linear-gradient(180deg, transparent, rgba(224, 200, 152, .12)); transform: perspective(300px) rotateX(32deg); }
.hall-door-node .ambient-node { filter: drop-shadow(0 18px 22px rgba(7, 12, 20, .28)); }

/* 05A — Clock Garden */
.scene-clock-garden { background: #555366; }
.scene-clock-garden::before { background: radial-gradient(ellipse at 69% 25%, #c5aeb9 0 3%, rgba(196, 176, 199, .46) 18%, transparent 52%), linear-gradient(180deg, #645f74 0%, #82788b 43%, #575769 100%); }
.scene-clock-garden::after { z-index: 2; inset: 0; background: linear-gradient(0deg, rgba(43, 45, 56, .55), transparent 42%); }
.clock-moon { z-index: 1; top: 4%; right: 12%; width: min(28vw, 410px); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, rgba(251, 229, 219, .75) 0 14%, rgba(238, 211, 218, .19) 44%, transparent 69%); filter: blur(2px); }
.clock-landscape { z-index: 2; left: -10%; width: 120%; border-radius: 50% 50% 0 0 / 18% 18% 0 0; }
.clock-landscape-far { bottom: 19%; height: 34%; background: linear-gradient(180deg, #77768a, #5c6172); transform: rotate(-2deg); }
.clock-landscape-near { bottom: -14%; height: 40%; background: linear-gradient(180deg, #707178, #353d4c); transform: rotate(3deg); }
.clock-garden-moon-haze { z-index: 4; inset: 20% -10% 14%; background: radial-gradient(ellipse at 50% 75%, rgba(224, 199, 204, .19), transparent 72%); filter: blur(23px); }
.hero-petal-node .ambient-node { animation: petal-sway 7s ease-in-out infinite; }

/* 05B — Tea Party */
.scene-tea { background: #5a4655; }
.scene-tea::before { background: linear-gradient(180deg, #54485c, #827078 44%, #423c4a 100%); }
.scene-tea::after { z-index: 2; inset: 0; background: linear-gradient(180deg, rgba(31, 32, 43, .2), transparent 42%, rgba(22, 19, 27, .36)); }
.tea-room-glow { z-index: 1; top: 8%; left: 36%; width: 45%; height: 44%; background: radial-gradient(ellipse, rgba(247, 219, 176, .24), transparent 68%); filter: blur(14px); }
.tea-wall { z-index: 2; top: 15%; left: 50%; width: 30%; height: 39%; transform: translateX(-50%); border: 1px solid rgba(232, 209, 180, .27); border-radius: 50% 50% 0 0; background: linear-gradient(180deg, rgba(221, 200, 187, .08), transparent); }
.tea-window { z-index: 3; top: 18%; left: 50%; width: 15%; height: 28%; transform: translateX(-50%); border: 1px solid rgba(227, 204, 176, .26); border-radius: 50% 50% 0 0; background: radial-gradient(ellipse at 50% 28%, rgba(221, 205, 191, .28), rgba(81, 75, 88, .4)); }
.tea-table-back { z-index: 3; left: 9%; right: 9%; top: 47%; height: 11%; border-radius: 50%; background: linear-gradient(180deg, #a38c7c, #725d5c); box-shadow: 0 -6px 0 rgba(210, 187, 159, .43); }
.tea-table-surface { z-index: 3; left: 8%; right: 8%; top: 48%; height: 17%; background: linear-gradient(180deg, rgba(198, 174, 147, .8), #917a6d 55%, #62535a); clip-path: polygon(9% 0, 91% 0, 100% 100%, 0 100%); }
.tea-table-front { z-index: 4; left: 8%; right: 8%; bottom: -7%; height: 39%; background: linear-gradient(180deg, #5e4b51, #352f3b); clip-path: polygon(0 0, 100% 0, 92% 100%, 8% 100%); }
.tea-table-perspective { z-index: 4; inset: 48% 8% 0; width: 84%; height: 52%; fill: none; stroke: rgba(233, 212, 178, .21); stroke-width: 2; }
.tea-cup-wrap { position: relative; width: 100%; height: 100%; }
.tea-card-pass .ambient-node { animation: card-float 5.8s ease-in-out infinite; }

/* 06 — Card Kingdom */
.scene-card-kingdom { background: #301924; }
.scene-card-kingdom::before { background: radial-gradient(ellipse at 50% 31%, rgba(172, 72, 83, .42), transparent 51%), linear-gradient(180deg, #401e31, #552333 53%, #291722); }
.scene-card-kingdom::after { z-index: 3; inset: 0; background: linear-gradient(0deg, rgba(21, 15, 24, .48), transparent 42%); }
.card-kingdom-plane { z-index: 1; inset: 12% 12% auto; height: 66%; border: 1px solid rgba(223, 180, 135, .2); clip-path: polygon(50% 0, 100% 20%, 82% 100%, 18% 100%, 0 20%); background: linear-gradient(135deg, rgba(111, 42, 61, .6), rgba(58, 28, 48, .22)); }
.card-kingdom-plane-back { inset: 6% 23% auto; height: 70%; background: linear-gradient(180deg, rgba(152, 59, 76, .24), transparent); }
.card-kingdom-arches { z-index: 2; inset: 12% 23% 16%; display: flex; align-items: stretch; justify-content: center; gap: -2%; opacity: .8; }
.card-kingdom-arches .arch-primitive { position: relative; flex: 0 1 34%; height: 100%; margin: 0 -4%; }
.card-kingdom-arches .arch-primitive:nth-child(2) { flex-basis: 43%; height: 112%; margin-top: -5%; }
.card-kingdom-throne { z-index: 3; left: 50%; bottom: 22%; width: min(34vw, 470px); height: 39%; transform: translateX(-50%); border: 1px solid rgba(235, 193, 134, .37); border-radius: 48% 48% 3px 3px; background: linear-gradient(180deg, rgba(138, 59, 71, .25), rgba(79, 33, 50, .55)); box-shadow: inset 0 0 45px rgba(211, 158, 112, .07); }
.card-kingdom-ground { z-index: 4; left: -10%; right: -10%; bottom: -20%; height: 39%; border-radius: 50% 50% 0 0; background: linear-gradient(180deg, #5b2937, #241620); }
.soldier-card { position: relative; width: clamp(62px, 9vw, 132px); height: clamp(110px, 23vh, 220px); border: 1px solid rgba(246, 223, 191, .76); border-radius: 5px; background: linear-gradient(180deg, rgba(230, 216, 195, .86), rgba(155, 131, 123, .9)); box-shadow: 0 15px 30px rgba(20, 11, 18, .26); }
.soldier-card::before, .soldier-card::after { position: absolute; left: 50%; content: ''; border-radius: 50%; }
.soldier-card::before { top: 22%; width: 25%; aspect-ratio: 1; transform: translateX(-50%); border: 1px solid #594349; background: #d6c4aa; }
.soldier-card::after { top: 41%; width: 61%; height: 38%; transform: translateX(-50%); background: #873d4d; clip-path: polygon(25% 0, 75% 0, 100% 100%, 0 100%); }
.soldier-head { position: absolute; left: 50%; top: 10%; width: 44%; height: 13%; transform: translateX(-50%); background: #69414a; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.soldier-spear { position: absolute; right: -10%; top: 4%; width: 2px; height: 97%; background: rgba(226, 194, 147, .75); }
.foreground-card-node .ambient-node { transform: rotate(-13deg); }
.crimson-beam { z-index: 4; left: 50%; top: 17%; width: 34%; height: 70%; transform: translateX(-50%); background: linear-gradient(180deg, rgba(228, 177, 128, .12), transparent); clip-path: polygon(42% 0, 58% 0, 100% 100%, 0 100%); filter: blur(8px); }

/* Debug inspector, hidden until explicitly opened. */
.diagnostics-scrim { position: fixed; z-index: 79; inset: 0; background: rgba(5, 7, 12, .48); backdrop-filter: blur(2px); }
.diagnostics-panel { position: fixed; z-index: 80; top: 0; right: 0; bottom: 0; display: flex; flex-direction: column; width: min(420px, 38vw); min-width: 330px; padding: calc(var(--safe-top) + 27px) 26px calc(var(--safe-bottom) + 24px); overflow-y: auto; overscroll-behavior: contain; border-left: 1px solid rgba(237, 226, 206, .16); background: rgba(17, 21, 31, .96); box-shadow: -22px 0 64px rgba(0, 0, 0, .28); backdrop-filter: blur(20px); color: #eee8dc; }
.diagnostics-header { display: flex; align-items: flex-start; justify-content: space-between; padding-bottom: 19px; border-bottom: 1px solid rgba(235, 226, 211, .13); }
.diagnostics-overline { margin: 0 0 6px; color: rgba(230, 213, 177, .7); font: 9px/1 var(--font-ui); letter-spacing: .2em; }
.diagnostics-header h2 { margin: 0; color: #f1eadc; font: 400 27px/1 var(--font-editorial); }
.diagnostics-close { width: 36px; height: 36px; border-color: rgba(240, 228, 204, .2); background: rgba(255,255,255,.03); }
.diagnostics-close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.3; }
.diagnostics-note { margin: 16px 0 4px; color: rgba(232, 225, 213, .58); font-size: 11px; line-height: 1.65; }
.diagnostics-section { padding: 20px 0 18px; border-bottom: 1px solid rgba(235, 226, 211, .11); }
.debug-section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; color: rgba(230, 213, 177, .66); font: 9px/1.2 var(--font-ui); letter-spacing: .14em; }
.debug-section-title output { color: #e8d4a7; font: 9px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.reset-button { min-height: 26px; padding: 0 8px; border: 1px solid rgba(234, 220, 194, .28); background: transparent; color: rgba(240, 231, 212, .72); font: 9px/1 var(--font-ui); letter-spacing: .14em; cursor: pointer; }
.range-control { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; align-items: center; min-height: 48px; color: rgba(245, 238, 224, .85); font-size: 11px; }
.range-control output { color: #decb9d; font: 10px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.range-control input { grid-column: 1 / -1; width: 100%; height: 18px; margin: 5px 0 0; accent-color: #d4bd88; cursor: pointer; }
.debug-mode-section { padding-bottom: 10px; }
.debug-row { display: flex; align-items: center; justify-content: space-between; min-height: 42px; color: rgba(244, 237, 225, .83); font-size: 11px; }
.switch { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 2px; border: 0; background: transparent; color: rgba(237, 230, 216, .62); font: 9px/1 var(--font-ui); letter-spacing: .1em; cursor: pointer; }
.switch-track { position: relative; display: block; width: 34px; height: 18px; border: 1px solid rgba(239, 229, 208, .36); border-radius: 999px; background: rgba(255,255,255,.05); transition: background .2s ease, border-color .2s ease; }
.switch-track i { position: absolute; left: 2px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: rgba(240, 231, 213, .74); transition: transform .2s ease, background .2s ease; }
.switch.is-on .switch-track { border-color: rgba(215, 191, 137, .78); background: rgba(159, 129, 70, .4); }
.switch.is-on .switch-track i { transform: translateX(16px); background: #edd7a7; }
.switch.is-on .switch-value { color: #ead5a7; }
.runtime-debug { padding-bottom: 18px; }
.runtime-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.runtime-grid > div { display: flex; flex-direction: column; gap: 5px; min-height: 40px; }
.runtime-grid span { color: rgba(230, 221, 205, .42); font: 8px/1 var(--font-ui); letter-spacing: .13em; }
.runtime-grid strong { color: #e8ddc5; font: 10px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; }
.lighting-readout { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px 12px; margin-top: 13px; padding: 12px 0 0; border-top: 1px solid rgba(235, 226, 211, .11); color: rgba(236, 224, 201, .56); font: 8px/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .08em; }
.lighting-readout span { display: flex; justify-content: space-between; gap: 6px; }
.lighting-readout output { color: #f0d99f; }
.tier-control { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.tier-control button { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; border: 1px solid rgba(236, 226, 206, .17); background: rgba(255,255,255,.025); color: rgba(242, 232, 214, .61); font: 500 10px/1 var(--font-ui); cursor: pointer; }
.tier-control button[aria-pressed="true"] { border-color: rgba(211, 190, 143, .64); background: rgba(205, 177, 116, .12); color: #e9d7ad; }
.tier-control small { font: 8px/1 var(--font-ui); letter-spacing: .05em; }

/* Scene 05 tea steam, transitions and general atmosphere */
.scene-tea .steam-curve { z-index: 1; }
.scene-card-kingdom .soldier-card-node .ambient-node { animation: card-soldier-sway 8s ease-in-out infinite; }
.scene-card-kingdom .soldier-card-node:nth-of-type(even) .ambient-node { animation-delay: -3s; }
.scene-clock-garden .clock-primitive:nth-of-type(2) .clock-hand-minute { animation-duration: 13s; }

@keyframes scene-arrive { from { opacity: .36; filter: saturate(.72); transform: scale(1.035); } to { opacity: 1; filter: saturate(1); transform: scale(1); } }
@keyframes title-arrive { from { opacity: .25; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes alice-weightless { 0%, 100% { transform: translateY(-3px) rotate(-1.3deg); } 50% { transform: translateY(5px) rotate(1.2deg); } }
@keyframes alice-reach { 0%,100% { transform: translateY(0) rotate(-.5deg); } 50% { transform: translateY(-5px) rotate(.8deg); } }
@keyframes run-bob { from { transform: translateY(-1px) rotate(-.5deg); } to { transform: translateY(4px) rotate(.8deg); } }
@keyframes tunnel-ring-float { from { transform: rotate(calc(var(--ring-index) * 7deg)) scale(.985); } to { transform: rotate(calc(var(--ring-index) * -9deg)) scale(1.018); } }
@keyframes clock-pass { 0%, 100% { transform: translate3d(0, 0, 0) rotate(-8deg) scale(.76); opacity: .58; } 52% { transform: translate3d(5vw, 4vh, 0) rotate(14deg) scale(1.42); opacity: 1; } }
@keyframes prop-float { 0%,100% { transform: translateY(0) rotate(-7deg); } 50% { transform: translateY(-15px) rotate(7deg); } }
@keyframes portal-breath { 0%,100% { opacity: .58; transform: translateX(-50%) scale(.94); } 50% { opacity: .94; transform: translateX(-50%) scale(1.05); } }
@keyframes flower-sway { 0%,100% { rotate: -3deg; } 50% { rotate: 4deg; } }
@keyframes steam-rise { 0% { opacity: 0; stroke-dashoffset: 25; transform: translateY(14px); } 35%,70% { opacity: .75; } 100% { opacity: 0; stroke-dashoffset: 0; transform: translateY(-12px); } }
@keyframes card-float { 0%,100% { transform: translateY(0) rotate(-8deg); } 50% { transform: translateY(-16px) rotate(8deg); } }
@keyframes card-soldier-sway { 0%,100% { transform: rotate(-1deg); } 50% { transform: rotate(1.5deg) translateY(-4px); } }
@keyframes petal-sway { 0%,100% { transform: rotate(-8deg); } 50% { transform: rotate(9deg); } }
@keyframes hole-pulse { 0%,100% { filter: brightness(.88); } 50% { filter: brightness(1.16); } }
@keyframes tree-drift { 0%,100% { transform: translateX(0); } 50% { transform: translateX(7px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.reduced-motion *, .reduced-motion *::before, .reduced-motion *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }

@media (max-width: 900px) {
  .story-topbar { padding-right: 25px; padding-left: 25px; }
  .story-navigation { padding-right: 12vw; padding-left: 12vw; }
  .diagnostics-panel { width: min(420px, 54vw); }
  .ring-primitive { width: 108vw; height: 66vh; }
  .hall-door-node:nth-of-type(3) .door-primitive { height: 54vh; }
}

@media (max-width: 720px) {
  .story-topbar { padding: calc(var(--safe-top) + 16px) 18px 0; }
  .wordmark { gap: 7px; font-size: 17px; letter-spacing: .18em; }
  .wordmark-mark { width: 25px; height: 25px; }
  .chapter-progress { top: calc(var(--safe-top) + 28px); gap: 3px; }
  .progress-segment { width: clamp(8px, 2.2vw, 14px); }
  .topbar-right { gap: 10px; }
  .scene-count { font-size: 13px; }
  .diagnostics-open { width: 38px; height: 38px; }
  .scene-title-block { bottom: calc(105px + var(--safe-bottom)); width: 88vw; }
  .scene-title-block h1 { font-size: clamp(25px, 6.2vw, 34px); }
  .story-navigation { bottom: calc(20px + var(--safe-bottom)); padding: 0 clamp(40px, 13vw, 68px); }
  .nav-button { min-width: 86px; min-height: 46px; gap: 7px; font-size: 9px; letter-spacing: .16em; }
  .carrier-debug-badge { right: 14px; bottom: calc(84px + var(--safe-bottom)); }
  .focus-guide { left: 14px; font-size: 8px; }
  .ring-primitive { width: 132vw; height: 63vh; }
  .scene-tunnel .ring-depth-0 { transform: scale(1.02); }
  .scene-tunnel .ring-depth-4 { transform: scale(.77); }
  .rabbit-hole-mouth { left: 71%; top: 32%; width: 37vw; height: 32vh; }
  .forest-trunk { width: clamp(62px, 18vw, 126px); }
  .garden-hill-far { bottom: 17%; height: 32%; }
  .garden-hill-mid { bottom: 6%; height: 35%; }
  .garden-meadow { bottom: -11%; height: 34%; }
  .garden-path { top: 33%; height: 69%; }
  .scene-hall .door-primitive { width: clamp(99px, 29vw, 180px); height: 50vh; }
  .hall-perspective { inset: 46% -8% -8%; }
  .clock-moon { right: -4%; width: 43vw; }
  .clock-landscape-far { bottom: 19%; height: 31%; }
  .clock-landscape-near { height: 34%; }
  .tea-table-surface { left: -7%; right: -7%; top: 51%; height: 16%; }
  .tea-table-back { left: -6%; right: -6%; top: 50%; }
  .tea-table-front { left: -8%; right: -8%; height: 35%; }
  .tea-table-perspective { inset: 50% -7% 0; width: 114%; height: 50%; }
  .card-kingdom-arches { inset: 12% 12% 19%; }
  .card-kingdom-throne { bottom: 21%; width: 46vw; height: 35%; }
  .soldier-card { width: clamp(58px, 14vw, 100px); height: clamp(108px, 22vh, 176px); }
  .diagnostics-panel { top: auto; right: 0; bottom: 0; left: 0; width: 100%; min-width: 0; max-height: min(88svh, 760px); padding: calc(var(--safe-top) + 18px) 22px calc(var(--safe-bottom) + 20px); border-top: 1px solid rgba(237, 226, 206, .2); border-left: 0; border-radius: 17px 17px 0 0; }
  .diagnostics-header { padding-bottom: 15px; }
  .diagnostics-note { margin: 12px 0 0; }
  .diagnostics-section { padding: 15px 0 13px; }
  .range-control { min-height: 43px; }
  .range-control input { height: 21px; }
  .debug-mode-section { display: flex; flex-direction: column; }
  .debug-row { min-height: 40px; font-size: 10px; }
  .switch { min-height: 38px; }
  .runtime-grid { gap: 9px 15px; }
  .lighting-readout { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 390px) {
  .story-topbar { padding-right: 13px; padding-left: 13px; }
  .wordmark { font-size: 15px; }
  .wordmark-mark { width: 22px; height: 22px; }
  .chapter-progress { top: calc(var(--safe-top) + 26px); }
  .progress-segment { width: 8px; }
  .topbar-right { gap: 7px; }
  .scene-count { font-size: 12px; }
  .diagnostics-open { width: 36px; height: 36px; }
  .scene-title-block { bottom: calc(101px + var(--safe-bottom)); }
  .scene-title-block h1 { font-size: 25px; }
  .story-navigation { padding: 0 clamp(38px, 12vw, 52px); }
  .nav-button { min-width: 78px; min-height: 44px; padding: 0 8px; font-size: 8px; }
  .scene-tunnel .alice-figure { width: clamp(220px, 67vw, 280px); }
  .scene-garden .alice-figure, .scene-wake .alice-figure { width: clamp(174px, 49vw, 210px); }
  .scene-follow .alice-figure { width: clamp(180px, 53vw, 230px); }
  .scene-follow .rabbit-figure { width: clamp(126px, 37vw, 166px); }
  .scene-hall .alice-figure { width: clamp(178px, 50vw, 216px); }
  .scene-clock-garden .alice-figure { width: clamp(154px, 43vw, 188px); }
  .scene-tea .alice-figure { width: clamp(148px, 42vw, 184px); }
  .scene-tea .rabbit-figure { width: clamp(122px, 35vw, 154px); }
  .scene-card-kingdom .alice-figure { width: clamp(184px, 51vw, 224px); }
  .scene-wake .rabbit-figure { width: clamp(84px, 26vw, 110px); }
  .scene-tunnel .ring-primitive { width: 145vw; height: 58vh; }
  .rabbit-hole-mouth { width: 43vw; height: 29vh; }
  .diagnostics-panel { padding-right: 18px; padding-left: 18px; }
  .debug-mode-section { display: flex; flex-direction: column; }
}

@media (max-height: 620px) and (min-width: 721px) {
  .scene-title-block { bottom: 88px; }
  .story-navigation { bottom: 18px; }
  .ring-primitive { height: 78vh; }
  .door-primitive { height: 82vh; }
}
