:root { font-family: system-ui, sans-serif; color: #64311e; background: #eaeae7; letter-spacing: 0; color-scheme: light; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-width: 280px; }
html { scrollbar-gutter: stable; overflow-anchor: none; }
html[data-loading="true"] { scroll-behavior: auto !important; }
body.route-locked { position: fixed; left: 0; right: 0; width: 100%; overflow: hidden; }
button, select { font: inherit; touch-action: manipulation; }
button, a, select { -webkit-tap-highlight-color: transparent; }
button, a { cursor: pointer; }
#app { position: relative; width: min(100%, 640px); margin: 0 auto; outline: none; min-height: 100vh; min-height: 100svh; }
.page { position: relative; width: 100%; overflow: hidden; isolation: isolate; background: #efd29a; }
.page-background, .motion-layer { position: absolute; display: block; pointer-events: none; }
.page-background { z-index: 0; }
.motion-layer { opacity: 0; }
.motion-layer[data-phase="shown"] { opacity: 1; }
.text-strip { overflow: hidden; }
.strip-image { position: absolute; left: 0; display: block; max-width: none; }
.hotspot { position: absolute; z-index: 1000; appearance: none; padding: 0; border: 0; border-radius: 0; background: transparent; }
.hotspot { min-width: 44px; min-height: 44px; }
.hotspot:disabled { pointer-events: none; }
.hotspot:focus-visible, select:focus-visible, .icon-button:focus-visible { outline: 3px solid #226d88; outline-offset: 3px; }
.hotspot.is-playing { background: transparent; }
.icon-button { display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 44px; padding: 0; color: #783621; background: #fff4dbe8; border: 1px solid #b7876470; border-radius: 50%; text-decoration: none; }
.icon-button svg { width: 23px; height: 23px; }
.sound { position: fixed; z-index: 110; right: max(16px, calc((100vw - 640px) / 2 + 16px)); top: max(16px, env(safe-area-inset-top)); box-shadow: 0 2px 8px #301b151a; }
.scroll-cue { position: fixed; z-index: 105; left: calc(50% - 20px); bottom: max(14px, env(safe-area-inset-bottom)); width: 40px; height: 40px; opacity: .85; animation: cue 1.8s ease-in-out infinite; }
.waveform { position: absolute; z-index: 1020; pointer-events: none; }
.voice-control-art { display: block; width: 100%; height: 100%; }
.reading-prompt-art { display: block; width: 100%; height: 100%; opacity: 1; transition: opacity 320ms linear; }
.motion-layer[data-motion="reading-prompt"][data-phase="shown"] .reading-prompt-art { animation: reading-text-glow 2.8s ease-in-out infinite; }
@keyframes reading-text-glow {
  0%,100% { filter: drop-shadow(0 0 .3px rgba(255,220,151,.12)); }
  50% { filter: drop-shadow(0 0 1.5px rgba(255,220,151,.45)); }
}
.diary-reading-started .reading-prompt-art { opacity: 0; }
.diary-reading-started .motion-layer[data-motion="reading-prompt"] .reading-prompt-art { animation: none; filter: none; }
@media (prefers-reduced-motion: reduce) {
  .motion-layer[data-motion="reading-prompt"][data-phase="shown"] .reading-prompt-art { animation: none; }
}
#province-dialog { width: min(calc(100% - 24px), 440px); max-height: calc(100dvh - 24px); margin: auto; padding: 18px 16px 14px; border: 1px solid #c49a50; border-top: 4px solid #a52524; border-radius: 6px; background: #fff4d8; color: #8c221c; box-shadow: 0 18px 70px #170f0c33, inset 0 0 0 2px #fff9e9; box-sizing: border-box; }
#province-dialog::backdrop { background: rgb(20 15 12 / 60%); }
#province-dialog h2 { margin: 0 44px 18px 0; font-size: 19px; line-height: 26px; font-weight: 650; }
#province-dialog .dialog-close { top: 8px; right: 8px; width: 40px; height: 40px; color: #9a4b2a; background: transparent; border: 0; }
.province-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: 44px; gap: 4px; overflow: visible; }
.province-option { position: relative; appearance: none; display: grid; place-items: center; background: #ffedc4; border: 1px solid #e7ce96; border-radius: 3px; padding: 0; min-width: 0; min-height: 0; cursor: pointer; }
.province-option[aria-checked="true"] { border-color: #a52524; background: #ffe4a8; box-shadow: inset 0 0 0 1px #a52524; }
.province-option:focus-visible { outline: 2px solid #226d88; outline-offset: 1px; }
.province-option canvas { display: block; width: 100%; max-width: 88px; height: auto; pointer-events: none; }
.province-footer { display: grid; grid-template-columns: 1fr 2fr; align-items: center; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid #dfbf7e; }
.province-footer button { min-height: 44px; padding: 8px 10px; border: 1px solid #caa260; border-radius: 3px; font: inherit; font-size: 14px; color: #8c221c; background: transparent; cursor: pointer; }
.province-footer button:last-child { background: #a52524; border-color: #a52524; color: #fff0bd; }
@media (max-height: 640px) { #province-dialog { padding: 12px; } #province-dialog h2 { margin-bottom: 12px; } .province-options { grid-auto-rows: 36px; } .province-footer { margin-top: 10px; padding-top: 8px; } }
@media (max-height: 480px) { #province-dialog { width: min(calc(100% - 24px), 640px); } .province-options { grid-template-columns: repeat(6, minmax(0, 1fr)); grid-auto-rows: 32px; } }
@media (prefers-reduced-motion: reduce) { .reading-prompt-art { transition: none; } }
.text-group-art, .native-text-row { position: absolute; display: block; pointer-events: none; }
.native-text-row { opacity: 0; }
.native-text-row[data-phase="shown"] { opacity: 1; }
.voice-control .waveform { z-index: 1; }
.province-control { position: absolute; z-index: 1000; }
.province-glyph, .province-arrow { position: absolute; display: block; pointer-events: none; }
.province-pending-font { display: flex; align-items: center; justify-content: center; gap: 4px; color: #a75023; font-family: serif; font-size: 14px; font-weight: 600; }
.province-pending-font span { max-width: calc(100% - 20px); text-align: center; line-height: 1.1; overflow-wrap: anywhere; }
.province-pending-font svg { width: 14px; height: 14px; flex: 0 0 14px; }
.province-control select { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.poster-button-pulse { position: absolute; z-index: 200; pointer-events: none; animation: poster-button-glow 1.6s ease-in-out infinite; }
@font-face { font-family: 'ProvinceRuiHu'; src: url('assets/controls-v0523/HYRuiHuSongW-provinces.woff2') format('woff2'); font-display: swap; }
.province-control select { font-family: 'ProvinceRuiHu', serif; }
.province-control:focus-within { outline: 2px solid #226d88; }
.fixed-art { position: fixed; z-index: 600; display: block; padding: 0; border: 0; border-radius: 0; background: transparent; aspect-ratio: var(--art-ratio); height: auto; }
.fixed-art img { width: 100%; height: 100%; display: block; pointer-events: none; }
.page-back { left: max(12px, calc((100vw - 640px) / 2 + 18px)); bottom: max(22px, env(safe-area-inset-bottom)); width: 70px; }
.page-back:not([hidden]) { animation: page-back-reveal 420ms ease-out both; }
@keyframes page-back-reveal { from { opacity: 0; } to { opacity: 1; } }
.scroll-cue.fixed-art { left: auto; right: max(10px, calc((100vw - 640px) / 2 + 18px)); bottom: max(22px, env(safe-area-inset-bottom)); width: 72px; opacity: 1; animation: cue 1.55s ease-in-out infinite; }
#page-number { position: fixed; left: max(12px, calc((100vw - 640px) / 2 + 12px)); top: max(12px, env(safe-area-inset-top)); z-index: 610; color: #713c25; background: #fff4d5dc; border: 1px solid #a9744740; border-radius: 3px; padding: 4px 7px; font-size: 12px; line-height: 1; font-variant-numeric: tabular-nums; pointer-events: none; }
.sound { z-index: 620; }
html[data-page="P04"] #page-number { left: auto; right: max(12px, calc((100vw - 640px) / 2 + 12px)); }
.motion-layer[data-effect="hand"] { transform-origin: 50% 50%; }
.motion-layer[data-effect="route"] { -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 var(--route-solid, 0%), transparent var(--route-edge, 0%), transparent 100%); mask-image: linear-gradient(to bottom, #000 0, #000 var(--route-solid, 0%), transparent var(--route-edge, 0%), transparent 100%); }
.motion-layer[data-effect="hand"][data-phase="shown"] { animation: hand-breathe 1.5s ease-in-out infinite; }
.motion-layer.voice-active { visibility: visible; }
.bookmark-lit { position: absolute; z-index: 350; opacity: 0; pointer-events: none; }
.bookmark-lit[data-phase="shown"] { opacity: 1; }
.bookmark-occlusion { position: absolute; pointer-events: none; mask-size: 100% 100%; -webkit-mask-size: 100% 100%; mask-repeat: no-repeat; -webkit-mask-repeat: no-repeat; }
.effect-field { position: absolute; z-index: 900; overflow: hidden; pointer-events: none; -webkit-mask-image: linear-gradient(transparent,#000 8%,#000 86%,transparent); mask-image: linear-gradient(transparent,#000 8%,#000 86%,transparent); }
.effect-field i { position: absolute; left: var(--x); top: -8px; width: 4px; height: 4px; background: #fff; border-radius: 50%; animation: snowfall 1.3s var(--delay) ease-out both; }
.bookmark-spark i { background: #ffe078; box-shadow: 0 0 5px #ffb826; }
.effect-field.vehicle { -webkit-mask-image: linear-gradient(90deg,transparent,#000 22%,#000 80%,transparent); mask-image: linear-gradient(90deg,transparent,#000 22%,#000 80%,transparent); }
.effect-field.vehicle i { top: var(--x); left: -25%; width: 24%; height: 2px; border-radius: 2px; background: linear-gradient(90deg,transparent,#ffdc8ec2,transparent); animation: vehicle-pass 1.1s var(--delay) cubic-bezier(.2,.72,.22,1) both; }
#boot { position: fixed; z-index: 1000; inset: 0; height: var(--boot-height, 100vh); display: grid; place-items: center; overflow: hidden; background: #f4bb68; color: #7b2b12; }
html[data-loading="true"] { overflow: hidden; }
.boot-scene { position: relative; width: min(100%, 640px, calc(var(--boot-height, 100vh) * 640 / 1260)); aspect-ratio: 640 / 1260; overflow: hidden; container-type: inline-size; }
.boot-scene img { position: absolute; display: block; height: auto; pointer-events: none; }
.boot-bg { position: absolute; display: block; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.boot-title { left: 18.90625%; top: 18.65079%; width: 67.65625%; }
.boot-book { left: 41.40625%; top: 44.92063%; width: 17.34375%; }
.boot-archive { left: 31.875%; top: 52.85714%; width: 36.71875%; }
.boot-intro { left: 29.0625%; top: 57.06349%; width: 42.1875%; }
.boot-track { position: absolute; top: 39.04762%; left: 8.4375%; width: 83.4375%; height: 1.19048%; border-radius: 8px; background: #f5aa2e; box-shadow: 0 2px 5px #49140824; }
#boot-fill { display: block; height: 100%; background: #7f210c; border-radius: inherit; transform: scaleX(0); transform-origin: left; transition: transform 120ms linear; }
#boot-number { position: absolute; z-index: 3; top: -286.66667%; right: -1.87266%; width: 16.85393%; color: #7b2b12; font-size: 34px; font-size: 5.3125cqi; font-weight: 800; line-height: 1; text-align: right; font-variant-numeric: tabular-nums; }
.boot-track .boot-marchers { z-index: 2; left: -32.58427%; bottom: 53.33333%; width: 40.26217%; aspect-ratio: 215 / 104; object-fit: contain; object-position: left bottom; transform: translate3d(calc(var(--loaded, 0) * 199.06977%), 0, 0); transition: transform 120ms linear; visibility: hidden; }
.boot-title, .boot-book, .boot-archive, .boot-intro { visibility: hidden; }
#boot[data-ready="true"] :is(.boot-title, .boot-book, .boot-archive, .boot-intro, .boot-marchers) { visibility: visible; }
.boot-recovery { position: absolute; top: 68%; width: 100%; text-align: center; }
#boot-error { margin: 0 0 8px; font-size: 14px; }
#boot-retry { min-height: 44px; border: 1px solid #8c3e08; border-radius: 4px; background: #fff2d8; color: #6b2d13; padding: 8px 18px; }
#section-status { position: fixed; z-index: 650; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; align-items: center; justify-content: center; gap: 10px; max-width: calc(100% - 32px); padding: 0; border: 0; background: transparent; pointer-events: none; }
.section-wait-art { display: block; position: relative; width: 90px; height: 56px; animation: section-wait-in 180ms ease-out both; }
.section-wait-book { display: block; width: 90px; height: 44px; object-fit: contain; filter: drop-shadow(0 2px 2px #51281445); }
.section-book-still { display: none; width: 90px; height: 44px; align-items: center; justify-content: center; color: #923618; filter: drop-shadow(0 1px 1px #fff7df); }
.section-book-still svg { width: 46px; height: 34px; }
.section-wait-trace { position: absolute; left: 19px; bottom: 2px; width: 52px; height: 2px; overflow: hidden; background: #b36a3530; border-radius: 1px; }
.section-wait-trace::after { content: ''; display: block; width: 26px; height: 100%; background: linear-gradient(90deg, #8d261500, #a6301b 55%, #d39536); animation: section-wait-trace 1.4s linear infinite; }
#section-status[data-state="error"] { bottom: max(82px, calc(env(safe-area-inset-bottom) + 62px)); pointer-events: auto; }
#section-status[data-state="error"] .section-wait-art { display: none; }
#section-status[data-state="error"] #section-message { color: #642b17; font-size: 14px; line-height: 1.4; text-align: center; text-shadow: 0 1px 2px #fff9ed, 0 0 5px #fff9ed, 0 0 9px #fff9ed; }
#section-retry { background: #fff2e2f5; box-shadow: 0 1px 4px #51281426; pointer-events: auto; }
dialog { width: min(360px, calc(100% - 40px)); padding: 30px 24px 24px; border: 1px solid #caad7d; border-radius: 6px; color: #663c2c; background: #fff3d9; box-shadow: 0 15px 60px #351d1438; }
dialog::backdrop { background: #221b1699; }
dialog h2 { font-size: 20px; margin: 12px 40px 14px 0; }
dialog p { font-size: 15px; line-height: 1.75; margin-bottom: 4px; }
.dialog-close { position: absolute; top: 8px; right: 8px; border: 0; background: transparent; }
.video-open { overflow: hidden; }
.video-open #app { filter: blur(10px); }
.video-dialog { width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; border: 0; border-radius: 0; padding: 56px 12px; background: transparent; box-shadow: none; color: #fff; }
.video-dialog::backdrop { background: rgb(0 0 0 / 70%); }
.video-dialog[open] { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.video-dialog video { width: min(100%, 1280px); aspect-ratio: 16 / 9; max-height: calc(100vh - 112px); max-height: calc(100svh - 112px); object-fit: contain; background: #000; }
.video-close { position: absolute; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); }
.video-status { margin: 0; font-size: 14px; }
.poster-view { position: relative; width: 100%; }
.generated-poster { display: block; width: 100%; height: auto; -webkit-touch-callout: default; -webkit-user-select: auto; user-select: auto; }
.poster-tools { position: absolute; z-index: 150; left: 89.4%; top: 21.1%; transform: translate(-50%, -50%); display: flex; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@keyframes cue { 0%,100% { transform: translateY(-3px); } 50% { transform: translateY(3px); } }
@keyframes hand-breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(.92); } }
@keyframes poster-button-glow { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.32) drop-shadow(0 0 5px #ffc65b); } }
@keyframes snowfall { 0% { opacity: 0; transform: translate(0,0); } 15% { opacity: .8; } 100% { opacity: 0; transform: translate(var(--drift),180px); } }
@keyframes vehicle-pass { from { opacity: 0; transform: translateX(0) scaleX(.55); } 24% { opacity: 1; } to { opacity: 0; transform: translate(650%,-12px) scaleX(1.25); } }
@keyframes section-wait-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes section-wait-trace { 0% { opacity: 0; transform: translateX(-26px); } 15%,75% { opacity: 1; } 100% { opacity: 0; transform: translateX(52px); } }
@media (max-width: 640px) { html { scrollbar-gutter: auto; } }
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { animation: none !important; scroll-behavior: auto !important; } }
@media (prefers-reduced-motion: reduce) { .section-wait-book { display: none; } .section-book-still { display: flex; } .section-wait-trace::after { width: 100%; background: #a6301b; } }

.motion-layer[data-motion="cover-light"][data-phase="shown"] { animation: home-light-illuminate 5.6s ease-in-out infinite; }
@keyframes home-light-illuminate { 0%,100% { opacity: 1; } 50% { opacity: .88; } }
@media (prefers-reduced-motion: reduce) { .motion-layer[data-motion="cover-light"][data-phase="shown"] { animation: none; opacity: 1; } }
