@import url('https://fonts.googleapis.com/css2?family=Pixelify+Sans:wght@400;700&family=Noto+Sans+SC:wght@400&family=Noto+Serif+SC:wght@600;800&display=swap');
:root{color-scheme:light;--ink:#49302c;--cream:#fff5e7;--gold:#f5d58f;--base:'assets/baiyibai_asset_pack/'}
*{box-sizing:border-box}html{height:100%;background:#3d303e}body{margin:0;min-height:100%;font-family:'Pixelify Sans','Noto Serif SC',monospace;font-weight:700;color:var(--ink);display:grid;place-items:center;background:radial-gradient(ellipse at 50% 25%,#9c7c97 0,#5b465c 45%,#302b35 100%)}button,textarea,a{-webkit-tap-highlight-color:transparent}button{font:inherit;cursor:pointer;touch-action:manipulation}button:disabled{cursor:default}button:focus-visible,a:focus-visible,textarea:focus-visible{outline:3px solid #e7a832;outline-offset:3px}img{user-select:none;image-rendering:pixelated;pointer-events:none}#game{--panel-height:230px;position:relative;isolation:isolate;width:min(100%,480px);height:100svh;height:var(--viewport-height,100svh);min-height:550px;overflow:hidden;background:#ab819b;box-shadow:0 0 100px #24192688}.background{position:absolute;inset:-1%;width:102%;height:102%;object-fit:cover;object-position:center;z-index:-4}.shade{position:absolute;inset:0;z-index:-3;pointer-events:none;background:linear-gradient(180deg,#33253875 0,transparent 22%,transparent 58%,#5c3d5188 100%)}header{position:absolute;left:20px;right:20px;top:max(16px,env(safe-area-inset-top));display:flex;align-items:center;justify-content:space-between;z-index:8;color:#fff0d9}.brand{font:800 23px 'Noto Serif SC',serif;color:inherit;text-decoration:none;text-shadow:2px 2px #49302c}.brand span{font:700 12px 'Pixelify Sans','Noto Serif SC',monospace;letter-spacing:2px;margin-left:8px}.sound{background:#49302c80;color:#fff1da;border:1px solid #ead6be80;min-height:44px;padding:7px 10px;font-size:16px}.chapter{position:absolute;left:21px;top:calc(max(16px,env(safe-area-inset-top)) + 55px);color:#fff3dc;text-shadow:1px 2px #49302c;font-size:14px;letter-spacing:1.6px;z-index:5}#steps{display:flex;gap:5px;margin-top:7px}#steps i{height:3px;width:23px;background:#fff5e75c}#steps i.active{background:var(--gold)}.title{position:absolute;top:16%;left:0;width:100%;text-align:center;pointer-events:none;z-index:4}.title img{width:210px;filter:drop-shadow(3px 5px 0 #49302c55)}.title p{color:#fff2d7;font-size:19px;text-shadow:2px 2px #49302c;margin:7px 0}#game:not([data-scene="0"]) .title{display:none}.world{position:absolute;inset:0 0 calc(var(--panel-height) + max(52px,env(safe-area-inset-bottom) + 38px)) 0;z-index:1;pointer-events:none}.sprite{position:absolute;object-fit:contain;filter:drop-shadow(0 4px 1px #4c344738);transform-origin:center bottom}.player{height:clamp(68px,10svh,94px);width:80px;left:calc(50% - 40px);bottom:0;z-index:8;transition:bottom 1.1s,scale 1.1s}.caishen{height:clamp(112px,18svh,153px);width:164px;left:calc(50% - 82px);bottom:22%;z-index:4;animation:bob 3s ease-in-out infinite}.cat-button{position:absolute;bottom:1%;left:14%;width:68px;height:70px;padding:0;background:none;border:none;pointer-events:auto;z-index:9}.cat-button img{width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 4px 1px #4c344738)}.cat-button:active{transform:translateY(-3px)}.cat-note{position:absolute;bottom:18%;left:7%;background:#fff4dce8;border:2px solid #93645c;padding:5px 8px;font-size:17px;z-index:10;animation:appear .2s}.scenery{z-index:0}.bush-left{width:87px;left:-27px;bottom:0}.bush-right{width:83px;right:-25px;bottom:-2%;transform:scaleX(-1)}.lantern-left,.lantern-right{height:104px;width:65px;bottom:17%}.lantern-left{left:4%}.lantern-right{right:4%}.petals{width:58px;left:8%;top:31%;animation:petal-fall 15s linear infinite;opacity:.75}.sparkles{width:145px;left:calc(50% - 72px);bottom:22%;z-index:5;animation:twinkle 2.2s infinite alternate}.altar{width:74%;left:13%;bottom:10%;z-index:6}.altar-offering{width:17%;left:26%;bottom:calc(10% + 70px);z-index:7;animation:offering-arrive .7s ease-out}.altar-display{position:absolute;width:100%;height:44%;bottom:4%;z-index:6}.altar-display .altar{width:84%;left:8%;bottom:0}.altar-display .altar-offering{width:19%;left:21%;bottom:48%;animation:none}.altar-display .burner{position:absolute;width:80px;height:116px;object-fit:contain;left:calc(50% - 40px);bottom:42%;z-index:8;animation:appear .5s}.ritual-incense{position:absolute;left:calc(50% - 80px);bottom:29%;width:160px;display:flex;justify-content:center;align-items:flex-end;gap:9px;z-index:9;pointer-events:auto}.incense-stick{position:relative;width:48px;height:123px;background:none;border:0;padding:0;transition:transform .4s;filter:drop-shadow(0 2px 2px #35233266)}.incense-stick .stick-art{position:absolute;width:16px;height:83px;left:16px;bottom:0;background-image:url('assets/baiyibai_asset_pack/ritual/incense_unlit.png');background-size:57px 83px;background-repeat:no-repeat;background-position:left bottom;image-rendering:pixelated}.incense-stick.lit .stick-art{width:28px;height:107px;left:10px;background-image:url('assets/baiyibai_asset_pack/ritual/incense_single_lit.png');background-size:contain;filter:drop-shadow(0 -5px 10px #ffcf79)}.incense-stick .smoke{position:absolute;width:36px;top:0;left:6px;opacity:.6;animation:smoke 3s infinite}.incense-stick:enabled:hover{transform:translateY(-4px)}.incense-progress{position:absolute;bottom:8%;left:0;width:100%;text-align:center;font-size:19px;color:#fff2d6;text-shadow:1px 2px #49302c}.ritual-ready .player{left:calc(50% - 40px);bottom:0}.ritual-ready .caishen{left:65%;width:106px;height:125px;bottom:3%}.incense-settling .ritual-incense{animation:place-incense .8s forwards}.incense-settling .player{opacity:.5}#game[data-scene="2"] .player{left:calc(50% - 40px);height:70px}#game[data-scene="2"] .caishen{bottom:27%}#game[data-scene="3"] .caishen{left:69%;width:98px;height:120px;bottom:3%}#game[data-scene="3"] .cat-button{left:5%;width:60px}#game[data-scene="4"] .caishen{bottom:21%;height:clamp(120px,19svh,166px)}.walking .player{bottom:22%;scale:.84}.controls{position:absolute;left:18px;right:18px;bottom:max(50px,calc(env(safe-area-inset-bottom) + 36px));z-index:10;display:grid;gap:10px}.dialogue-frame{padding:17px 19px 19px;border:12px solid transparent;border-image:url('assets/baiyibai_asset_pack/ui/dialogue_blank.png') 28 fill / 12px / 0 stretch;background:none;min-height:105px;filter:drop-shadow(3px 5px 0 #49302c40)}.speaker{font-size:13px;letter-spacing:1.5px;color:#a36357;margin:0 0 9px}.dialogue{font-size:23px;line-height:1.18;margin:0;white-space:pre-line}.dialogue-advance{position:absolute;right:12px;bottom:8px;width:44px;height:44px;border:0;background:none;color:var(--ink);font-size:21px}.dialogue-frame.clickable{cursor:pointer;padding-right:38px}.actions{display:grid;gap:8px}.rpg-button{min-height:51px;border:11px solid transparent;border-image:url('assets/baiyibai_asset_pack/ui/button_red_blank.png') 27 fill / 11px / 0 stretch;background:none;padding:3px 11px 5px;color:#fff3da;font-size:23px;line-height:1.1;filter:drop-shadow(2px 3px 0 #49302c45);transition:filter .15s,translate .15s}.rpg-button:hover{filter:brightness(1.06) drop-shadow(2px 3px 0 #49302c45)}.rpg-button:active{translate:0 2px}.rpg-button.cream{border-image-source:url('assets/baiyibai_asset_pack/ui/button_cream_blank.png');color:var(--ink)}.rpg-button.pink{border-image-source:url('assets/baiyibai_asset_pack/ui/button_pink_blank.png');color:var(--ink)}.text-button{font:700 17px 'Pixelify Sans','Noto Serif SC',monospace;min-height:38px;padding:6px 4px;background:#49302c66;border:0;color:#fff1dc;text-shadow:1px 1px #49302c}.offering-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:5px}.offering{border:8px solid transparent;border-image:url('assets/baiyibai_asset_pack/ui/offering_card_blank.png') 24 fill / 8px / 0 stretch;padding:5px 1px 6px;min-height:98px;background:none;color:var(--ink);font:700 16px 'Pixelify Sans','Noto Serif SC',monospace;line-height:1.05;position:relative}.offering.selected{border-image-source:url('assets/baiyibai_asset_pack/ui/offering_card_selected_blank.png');filter:drop-shadow(0 0 6px #f5d58f80)}.offering img{width:100%;height:48px;object-fit:contain;display:block;margin-bottom:6px}.offering small{display:block;font:13px 'Noto Serif SC',serif;margin-top:3px}.offering-description{color:#fff3dd;text-shadow:1px 1px #49302c;font-size:18px;line-height:1.1;margin:0;text-align:center;min-height:21px}.wish-frame{border:10px solid transparent;border-image:url('assets/baiyibai_asset_pack/ui/wish_input_blank.png') 26 fill / 10px / 0 stretch;padding:7px 9px 5px}.wish-frame textarea{display:block;width:100%;height:66px;padding:0;resize:none;background:none;border:0;font:700 22px 'Pixelify Sans','Noto Serif SC',monospace;line-height:1.2;color:var(--ink)}.wish-frame textarea::placeholder{color:#a57874}.counter{text-align:right;font-size:14px;color:#986758;margin-top:4px}.ritual-hint{background:#49302c95;color:#fff0d9;padding:8px 12px;margin:0;text-align:center;font-size:18px}.incense-meter{display:flex;align-items:center;justify-content:center;gap:8px}.incense-meter i{width:6px;height:18px;background:#9f735e;border:1px solid #e7bd91}.incense-meter i.lit{background:#ffcf6f;box-shadow:0 0 7px #ffd590}.wish-light{position:absolute;width:34px;left:calc(50% - 17px);bottom:0;animation:wish-rise 1.6s forwards;z-index:12;filter:drop-shadow(0 0 15px #ffe5a2)}.controls.wishing{opacity:0;pointer-events:none;transition:opacity .4s}.controls.wishing~#veil{background:#fff0bd66}#veil{position:absolute;inset:0;pointer-events:none;z-index:20;background:#fff1dc00;transition:background .45s,opacity .45s}.transition #veil{background:#fff1dce8}#particles{position:absolute;inset:0;pointer-events:none;z-index:2}#particles img{position:absolute;width:22px;opacity:.7;animation:float 9s infinite ease-in-out}footer{position:absolute;bottom:max(9px,env(safe-area-inset-bottom));left:0;right:0;text-align:center;z-index:11}footer button{border:0;background:none;color:#fff4df;text-shadow:1px 1px #49302c;font-size:16px;min-height:35px;padding:5px 12px}dialog{width:min(88%,390px);padding:25px;border:12px solid transparent;border-image:url('assets/baiyibai_asset_pack/ui/dialogue_blank.png') 28 fill / 12px / 0 stretch;color:var(--ink);background:none;filter:drop-shadow(4px 6px 0 #49302c55)}dialog::backdrop{background:#302333b8}.eyebrow{font-size:13px;letter-spacing:1px;color:#a36357}dialog h2{font-size:30px;margin:19px 0 12px}dialog p{font-size:22px;line-height:1.25}dialog .rpg-button{width:100%}.status{color:#fff3dc;background:#49302c99;font-size:18px;margin:0;text-align:center;padding:7px}
@keyframes bob{50%{transform:translateY(-4px)}}@keyframes appear{from{opacity:0;transform:translateY(6px)}}@keyframes twinkle{to{opacity:.35;transform:scale(.95)}}@keyframes petal-fall{0%{transform:translate(0,-30px);opacity:0}10%,80%{opacity:.7}100%{transform:translate(110px,220px) rotate(35deg);opacity:0}}@keyframes float{50%{transform:translate(12px,-40px);opacity:.2}}@keyframes offering-arrive{from{opacity:0;transform:translateY(60px)}}@keyframes smoke{to{transform:translate(6px,-30px);opacity:0}}@keyframes place-incense{to{transform:translateY(60px) scale(.6);opacity:0}}@keyframes wish-rise{0%{opacity:0;transform:scale(.7)}25%{opacity:1}100%{transform:translateY(-240px) scale(1.5);opacity:0}}
@media(min-width:600px){#game{height:min(100svh,950px);border-left:1px solid #e9c4ad50;border-right:1px solid #e9c4ad50}body{padding:0 25px}}@media(max-height:740px){.controls{gap:7px;left:14px;right:14px}.dialogue-frame{padding:13px 15px 14px}.dialogue{font-size:21px}.speaker{margin-bottom:7px}.rpg-button{font-size:21px;min-height:46px}.offering{min-height:84px;font-size:14px}.offering img{height:36px;margin-bottom:3px}.offering-description{font-size:16px}.title{top:17%}.title img{width:170px}.title p{font-size:17px}.caishen{height:110px}.player{height:64px}.cat-button{width:54px;height:58px}.altar-offering{bottom:calc(10% + 56px)}.ritual-incense{bottom:26%}.altar-display{height:47%}.wish-frame textarea{height:51px}.text-button{min-height:34px}.ritual-ready .caishen{height:95px}}@media(max-width:360px){.brand span{display:none}.dialogue{font-size:20px}.offering{font-size:13px}.controls{left:12px;right:12px}}@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important}.walking .player{bottom:22%}.incense-settling .ritual-incense{opacity:0}}
/* Compact the scene only while a mobile keyboard is taking up the viewport. */
#game.keyboard-open{min-height:380px}#game.keyboard-open header,#game.keyboard-open .chapter,#game.keyboard-open .world{visibility:hidden}#game.keyboard-open .controls{bottom:8px}#game.keyboard-open footer{display:none}#game.keyboard-open .dialogue-frame{min-height:60px;padding:7px 12px}#game.keyboard-open .speaker{display:none}#game.keyboard-open .dialogue{font-size:20px}
/* Keep the interior floor under the independent actors rather than behind UI. */
#game[data-scene="2"] .background,#game[data-scene="3"] .background{height:calc(100% - var(--panel-height) + 20px);object-position:center bottom}
#game[data-scene="3"] .caishen{z-index:9;left:auto;right:1%;bottom:0}
/* Reuse the table front, with one separately layered burner and two candles. */
.altar-display .altar{clip-path:inset(44% 0 0)}
.altar-display .burner{width:82px;height:116px;bottom:46%}
.altar-display .empty-burner{clip-path:inset(59% 0 0);animation:none}
.altar-display .ritual-candle{height:81px;width:32px;bottom:46%;z-index:7}
.altar-display .candle-left{left:10%}.altar-display .candle-right{right:10%}
.altar-display .altar-offering{bottom:46%;left:24%}
@media(max-height:740px){.altar-display .burner{height:100px;width:71px}.altar-display .ritual-candle{height:68px;width:26px}}
.offering-table{position:absolute;width:78%;aspect-ratio:247/134;left:11%;bottom:8%;z-index:6}
.offering-table .altar{width:100%;left:0;bottom:0;clip-path:inset(44% 0 0)}
.table-offerings{position:absolute;left:5%;right:5%;bottom:51%;display:flex;align-items:end;gap:3px;z-index:7}
.table-offerings img{width:calc((100% - 9px)/4);max-height:59px;object-fit:contain}
.table-offerings .chosen{animation:offering-arrive .7s ease-out;filter:drop-shadow(0 0 7px #ffe7a2)}
.table-offerings .unchosen{opacity:.18;transition:opacity .3s}

/* Softer, substantial English pixel lettering. Chinese keeps its serif face. */
body{letter-spacing:0;font-synthesis:none}
.brand span{letter-spacing:.5px;font-size:11px}
:lang(zh){font-family:'Noto Serif SC',serif;font-weight:600}
.offering small{font-weight:400}
.chapter{font-size:12px;letter-spacing:.6px}
.speaker{font-size:12px;letter-spacing:.4px;line-height:1.3}
.title p{font-size:17px;line-height:1.3;letter-spacing:0;text-wrap:balance}
.dialogue-frame{padding:16px 15px 17px}
.dialogue{font-size:19px;line-height:1.35;letter-spacing:0;text-wrap:balance;overflow-wrap:break-word}
.rpg-button{font-size:19px;line-height:1.2;letter-spacing:0;padding:2px 9px 3px;text-wrap:balance}
.text-button{font-size:15px;line-height:1.3;letter-spacing:0;text-wrap:balance}
.sound{font-size:13px;line-height:1.2}
.offering{font-size:13px;line-height:1.2;letter-spacing:0;overflow-wrap:normal}
.offering[data-item="4"]{font-size:12px}
.offering-description{font-size:15px;line-height:1.3;letter-spacing:0;text-wrap:balance;overflow-wrap:break-word}
.wish-frame textarea{font-size:18px;line-height:1.35;letter-spacing:0}
.counter{font-size:12px;line-height:1.3}
.ritual-hint{font-size:14px;line-height:1.3;text-wrap:balance}
.incense-meter{gap:6px}.incense-meter span{min-width:0}
.cat-note{font-size:14px;line-height:1.3;max-width:85%;text-wrap:balance}
footer button{font-size:14px;line-height:1.2;letter-spacing:0}
.eyebrow{font-size:11px;line-height:1.4;letter-spacing:.4px;text-wrap:balance}
dialog h2{font-size:24px;line-height:1.2;text-wrap:balance}
dialog p{font-size:18px;line-height:1.4;text-wrap:balance}
.status{font-size:15px;line-height:1.3;text-wrap:balance}
@media(max-height:740px){
  .dialogue-frame{padding:12px 12px 13px}
  .dialogue{font-size:18px;line-height:1.3}
  .rpg-button{font-size:18px;line-height:1.2}
  .offering{font-size:13px}.offering[data-item="4"]{font-size:12px}
  .offering-description{font-size:14px;line-height:1.25}
  .title p{font-size:16px}.text-button{font-size:14px;line-height:1.3}
}
@media(max-width:360px){.dialogue{font-size:17px}.rpg-button{font-size:17px}.offering{font-size:12px}.offering[data-item="4"]{font-size:11px}}
#game.keyboard-open .dialogue{font-size:18px;line-height:1.3}
/* Give the longer offering name a little more room without changing the row. */
.offering-grid{grid-template-columns:repeat(3,minmax(0,1fr)) minmax(0,1.2fr)}
.offering{text-wrap:balance}
.dialogue :lang(zh){font-size:23px;line-height:1.18}
.speaker :lang(zh){font-size:13px}
@media(max-height:740px){.dialogue :lang(zh){font-size:21px}}
@media(max-width:360px){.dialogue :lang(zh){font-size:20px}}
#game.keyboard-open .dialogue :lang(zh){font-size:20px}
/* A compact, stepped music note keeps the audio control in the pixel UI. */
.sound{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-width:100px;border-radius:0}
.music-icon{flex:none;shape-rendering:crispEdges;overflow:visible}
.sound[aria-pressed="true"] .music-icon{color:var(--gold)}
.music-slash{display:none}.sound[aria-pressed="false"] .music-slash{display:block}
/* Existing-game add-ons: shared bilingual type, compact toolbar, and parchment views. */
@font-face{font-family:'Fusion Pixel SC';src:url('assets/fonts/fusion-pixel-12px-proportional-sc.woff2') format('woff2');font-style:normal;font-weight:400;font-display:swap}
body{font-family:'Pixelify Sans','Fusion Pixel SC',sans-serif;font-weight:400;font-synthesis:none}
:lang(zh){font-family:'Fusion Pixel SC','Noto Sans SC',sans-serif;font-weight:400;letter-spacing:0}
.brand{font-family:'Noto Serif SC',serif;font-weight:800}
.brand span{font-family:'Pixelify Sans',monospace;font-weight:700}
.rpg-button,.text-button,.offering,.wish-frame textarea,.speaker,.chapter,footer button{font-weight:400}
.text-button,.offering,.wish-frame textarea{font-family:'Pixelify Sans','Fusion Pixel SC',sans-serif}
.dialogue :lang(zh){font:inherit;font-family:'Fusion Pixel SC','Noto Sans SC',sans-serif;font-weight:400}
.speaker :lang(zh){font-family:'Fusion Pixel SC','Noto Sans SC',sans-serif;font-weight:400;font-size:inherit}
html[lang="zh-CN"] .dialogue{font-family:'Fusion Pixel SC','Noto Sans SC',sans-serif;font-size:20px;line-height:1.5;text-wrap:pretty}
html[lang="zh-CN"] .rpg-button{font-size:19px;line-height:1.4}
html[lang="zh-CN"] .offering{font-size:18px;line-height:1.4}
html[lang="zh-CN"] .chapter{font-size:16px;letter-spacing:0}
html[lang="zh-CN"] .title p{font-size:18px}
html[lang="zh-CN"] .offering-description{font-size:16px;line-height:1.5}
.offering small{font-family:'Fusion Pixel SC','Noto Sans SC',sans-serif;font-weight:400;font-size:15px}
header{left:14px;right:14px;z-index:50;gap:8px}
.header-controls{display:flex;align-items:center;gap:4px;flex:none}
.language-switcher{display:flex;align-items:center;border:1px solid #ead6be80;background:#49302c88}
.language-switcher button{min-height:44px;min-width:38px;padding:5px 6px;background:none;color:#fff1da;border:0;font:400 14px 'Pixelify Sans','Fusion Pixel SC',sans-serif;line-height:1}
.language-switcher button[lang="zh-CN"]{font-family:'Fusion Pixel SC',sans-serif;font-size:16px}
.language-switcher button[aria-pressed="true"]{background:#f5d58f;color:var(--ink)}
.audio-toggle{min-width:44px;min-height:46px;padding:8px;display:grid;place-items:center;border:1px solid #ead6be80;background:#49302c88;color:#fff1da;border-radius:0}
.audio-toggle svg{shape-rendering:crispEdges;flex:none}
.audio-toggle[aria-pressed="true"]{color:var(--gold)}
.audio-slash{display:none}.audio-toggle[aria-pressed="false"] .audio-slash{display:block}
@media(max-width:420px){.brand span{display:none}.brand{font-size:23px}}
.book-entry-link{display:flex;align-items:center;justify-content:center;gap:9px;text-align:left;padding:8px 12px;line-height:1.2}
.book-entry-link img{width:30px;height:auto;object-fit:contain}.book-entry-link small{display:block;font-size:13px;line-height:1.3;margin-top:4px}
.creator-entry{font-size:15px;line-height:1.3}
/* A single renderer composes existing body/face art with the supplied 192×224 hair. */
.character-avatar{position:relative;display:inline-block;width:96px;height:112px;vertical-align:bottom;flex:none}
.avatar-canvas{position:absolute;inset:0;overflow:hidden}
.guest-avatar>img{width:100%;height:100%;object-fit:contain}
.player.character-avatar{--avatar-height:clamp(68px,10svh,94px);height:var(--avatar-height);width:calc(var(--avatar-height)*.857142);left:calc(50% - var(--avatar-height)*.428571)}
#game[data-scene="2"] .player.character-avatar{--avatar-height:70px;height:var(--avatar-height);width:calc(var(--avatar-height)*.857142);left:calc(50% - var(--avatar-height)*.428571)}
.addon-backdrop{display:none;position:absolute;inset:0;z-index:22;background:linear-gradient(#4d30384d,#57384488),url('assets/addons/book/backgrounds/temple_book_nook_square.png') center/cover}
#game[data-panel] .addon-backdrop{display:block}
#game[data-panel] #world,#game[data-panel] #controls,#game[data-panel] #title,#game[data-panel] .chapter{visibility:hidden}
#game[data-panel] footer{z-index:50}
.addon-view{position:absolute;inset:88px 0 48px;z-index:30;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;padding:7px 14px 20px;scrollbar-width:thin;scrollbar-color:#d7a18b #f8e2c4}
.addon-view[hidden]{display:none}
.addon-nav{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:8px;color:#fff2d6}
.quiet-back{border:1px solid #f5d58f80;background:#49302c88;color:#fff2df;font:inherit;font-size:16px;min-height:44px;padding:6px 10px;text-align:left}
.addon-kicker{font-size:12px;line-height:1.25;letter-spacing:.4px;text-align:right;text-shadow:1px 1px #49302c}
.addon-heading{font-size:27px;line-height:1.15;margin:0;padding:14px 18px;text-align:center;border:10px solid transparent;border-image:url('assets/addons/book/buttons/header_plaque_blank.png') 24 fill / 10px / 0 stretch;font-weight:400;text-wrap:balance;filter:drop-shadow(2px 3px #49302c40)}
.addon-intro{color:#fff2db;text-shadow:1px 1px #49302c;margin:10px 7px 12px;text-align:center;font-size:17px;line-height:1.3;text-wrap:balance}
.parchment-panel{padding:17px 15px;border:11px solid transparent;border-image:url('assets/baiyibai_asset_pack/ui/dialogue_blank.png') 28 fill / 11px / 0 stretch;background:none;filter:drop-shadow(2px 4px #49302c40)}
.parchment-panel fieldset{margin:0 0 16px;padding:0;border:0;min-width:0}
.parchment-panel legend,.parchment-panel>label{display:block;font-size:18px;line-height:1.3;margin-bottom:8px}
.parchment-panel input[type="text"],.parchment-panel input:not([type]),.parchment-panel textarea{width:100%;min-height:44px;padding:10px 11px;border:2px solid #ba8a72;background:#fff8ed;color:var(--ink);font:400 18px/1.4 'Pixelify Sans','Fusion Pixel SC',sans-serif;border-radius:0;resize:vertical}
.parchment-panel textarea{min-height:130px;max-height:260px;white-space:pre-wrap}
.parchment-panel .rpg-button{width:100%;margin-top:10px}
.parchment-panel input::placeholder,.parchment-panel textarea::placeholder{color:#a4786c;opacity:1}
.creator-preview{position:relative;display:flex;align-items:center;justify-content:center;flex-direction:column;min-height:178px;margin-top:4px}
.preview-mount{position:absolute;width:151px;height:164px;top:0;left:calc(50% - 75px);object-fit:contain;filter:drop-shadow(3px 5px #49302c55)}
.creator-avatar{width:137px;height:160px;z-index:1}
.preview-name{position:relative;z-index:2;max-width:90%;font-size:17px;line-height:1.3;color:#fff3dc;text-shadow:1px 1px #49302c;margin:6px 0;text-align:center;white-space:pre-wrap;overflow-wrap:anywhere}
.view-picker{display:flex;justify-content:center;margin:4px 0 14px;gap:8px}
.view-picker button{font:inherit;font-size:16px;background:#49302caa;color:#fff0d8;border:1px solid #dfb591;min-height:40px;padding:5px 18px}
.view-picker button[aria-pressed="true"]{background:#f5d58f;color:var(--ink)}
.base-picker{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.small-choice{font:inherit;font-size:19px;min-height:44px;border:2px solid #be8b73;background:#f7e2ca;color:var(--ink);padding:7px}
.small-choice[aria-pressed="true"]{border-color:#b88119;background:#fff0bd;box-shadow:inset 0 0 0 2px #f4cc6c}
.hair-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.hair-choice{font:inherit;font-size:14px;line-height:1.2;background:#f9e8d1;border:2px solid #c59b82;color:var(--ink);min-height:94px;padding:3px 4px 7px;display:flex;align-items:center;justify-content:space-between;flex-direction:column;text-wrap:balance}
.hair-choice img{width:61px;height:63px;object-fit:contain}
.hair-choice[aria-pressed="true"]{border-color:#af7d20;box-shadow:0 0 0 2px #f5d58f;background:#fff1c5}
.color-picker{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:2px}
.color-choice{min-width:0;min-height:44px;display:grid;place-items:center;background:none;border:2px solid transparent;padding:2px}
.color-choice span{display:block;background:var(--swatch);width:26px;height:26px;border:2px solid #67443c;box-shadow:inset 2px 2px #ffffff45;clip-path:polygon(5px 0,calc(100% - 5px) 0,calc(100% - 5px) 2px,100% 2px,100% calc(100% - 5px),calc(100% - 2px) calc(100% - 5px),calc(100% - 2px) 100%,5px 100%,5px calc(100% - 2px),0 calc(100% - 2px),0 5px,2px 5px,2px 0)}
.color-choice[aria-pressed="true"]{border-color:#bf8d22;box-shadow:inset 0 0 0 1px #f2cf70;background:#f5d58f40}
.fine-copy{font-size:14px;line-height:1.4;color:#9c6c60;margin:10px 0 2px;text-wrap:balance}
.form-error{color:#923e3d;background:#f6d8d0;border-left:3px solid #b75252;font-size:17px;line-height:1.4;padding:9px 11px}
.book-hero{position:relative;display:flex;align-items:center;justify-content:center;height:130px;margin:1px 0 8px}
.book-hero img{width:235px;height:130px;object-fit:contain;filter:drop-shadow(3px 6px #49302c45)}
.book-hero span{position:absolute;font-size:14px;line-height:1.25;letter-spacing:1px;max-width:110px;text-align:center;top:52px;left:calc(50% - 103px);transform:rotate(-6deg);color:#9f6455}
.local-notice{font-size:16px;line-height:1.4;padding:11px 13px;background:#fff1d9e8;border:2px solid #b27c65;color:#795143;margin:9px 0 14px;text-wrap:balance}
.book-status{padding:10px 12px;background:#e5ead6;border:2px solid #8e9f76;color:#4f664d;font-size:17px;line-height:1.4}
.book-entries{display:grid;gap:12px}
.empty-page{padding:21px 18px;border:12px solid transparent;border-image:url('assets/addons/book/frames/entry_card_cream.png') 26 fill / 12px / 0 stretch;text-align:center;min-height:145px}
.empty-page>img{width:40px;height:42px;object-fit:contain}.empty-page h2{font-size:22px;line-height:1.3;font-weight:400;text-wrap:balance;margin:6px 0 12px}.empty-page p{font-size:17px;line-height:1.4;text-wrap:balance}
.book-entry{border:11px solid transparent;border-image:url('assets/addons/book/frames/entry_card_cream.png') 26 fill / 11px / 0 stretch;padding:10px 12px 12px;min-width:0}
.book-entry.blush{border-image-source:url('assets/addons/book/frames/entry_card_blush.png')}
.entry-top{display:flex;align-items:center;gap:9px;min-width:0}
.entry-avatar{border:7px solid transparent;border-image:url('assets/addons/book/frames/avatar_frame_gold.png') 15 fill / 7px / 0 stretch;display:flex;align-items:center;justify-content:center;width:66px;height:73px;flex:none;overflow:hidden}
.book-avatar{width:62px;height:72px}
.entry-byline{min-width:0;flex:1}.entry-name{font-size:19px;font-weight:400;line-height:1.3;margin:0 0 5px;white-space:pre-wrap;overflow-wrap:anywhere}
.entry-byline time{font-size:13px;line-height:1.3;color:#986c5d}
.remove-entry{background:none;color:#a4786c;border:0;min-width:36px;min-height:44px;font:400 25px 'Pixelify Sans',sans-serif;align-self:start}
.user-message{font:400 18px/1.5 'Pixelify Sans','Fusion Pixel SC',sans-serif;white-space:pre-wrap;overflow-wrap:anywhere;margin:12px 0}
.user-message[lang="zh-CN"]{font-family:'Noto Sans SC',sans-serif;font-size:16px;line-height:1.65}
.entry-language{font-size:12px;line-height:1.35;color:#a47767;display:block}
.addon-actions{display:grid;gap:9px;margin-top:15px}
.book-pagination{display:flex;justify-content:center;align-items:center;gap:15px;margin:12px 0;color:#fff1d8;font-size:17px;text-shadow:1px 1px #49302c}
.book-pagination button{font:inherit;font-size:25px;width:44px;height:44px;background:#fff0d6;border:2px solid #a16e59;color:var(--ink)}
.book-pagination button:disabled{opacity:.4}
.compose-avatar{display:flex;align-items:center;gap:18px;margin-bottom:13px;justify-content:center}
.compose-avatar .book-avatar{width:80px;height:94px}
.quiet-link{border:1px solid #bf947a;background:#f4e0c5;font:inherit;font-size:16px;line-height:1.3;min-height:44px;padding:7px 11px;color:var(--ink)}
.compose-form>label:not(.consent-label){margin-top:14px}
.message-limit{font-size:14px;line-height:1.3;color:#9d705f;text-align:right;margin:5px 0 13px}
.consent-label{display:flex!important;align-items:start;gap:9px;font-size:15px!important;line-height:1.5!important;text-wrap:pretty}
.consent-label input{width:22px;height:22px;margin:1px 0 0;accent-color:#b75252;flex:none}
.remove-confirm{margin-bottom:14px}.remove-confirm h2{font-weight:400;font-size:21px;line-height:1.3}.remove-confirm p{font-size:16px;line-height:1.4}
.long-copy:lang(zh){font-family:'Noto Sans SC',sans-serif;font-weight:400;letter-spacing:0;line-height:1.65}
html[lang="zh-CN"] .addon-heading{font-family:'Fusion Pixel SC',sans-serif;font-size:26px;line-height:1.4}
html[lang="zh-CN"] .hair-choice{font-size:16px;line-height:1.25}
html[lang="zh-CN"] .parchment-panel input,html[lang="zh-CN"] .parchment-panel textarea{font-family:'Fusion Pixel SC','Noto Sans SC',sans-serif;font-size:19px;line-height:1.5}
html[lang="zh-CN"] .book-entry-link small{font-size:14px;line-height:1.4}
@media(max-height:740px){.player.character-avatar{--avatar-height:64px}.addon-view{inset:82px 0 44px}.addon-heading{font-size:24px;padding:10px 13px}.creator-preview{min-height:154px}.creator-avatar{width:117px;height:137px}.preview-mount{height:144px;width:132px;left:calc(50% - 66px)}.dialogue{font-size:18px}.book-entry-link small{font-size:12px}.book-hero{height:111px}.book-hero img{width:201px;height:111px}.book-hero span{top:43px;left:calc(50% - 89px);font-size:12px;max-width:92px}}
@media(max-width:340px){.addon-view{padding-left:10px;padding-right:10px}.header-controls{gap:2px}.language-switcher button{min-width:36px}.audio-toggle{min-width:42px}.color-picker{grid-template-columns:repeat(4,minmax(0,1fr))}.hair-choice{font-size:13px}.parchment-panel{padding:13px 10px}.addon-heading{font-size:23px}}
#game.keyboard-open[data-panel] .addon-view{inset:8px 0 0;padding-bottom:15px}
#game.keyboard-open[data-panel] .addon-nav{display:none}
/* Calibrated front face: remove the original cap before layering supplied hair. */
.addon-heading{color:#fff1da}
h1,h2,h3{font-weight:400}
.language-switcher button,.language-switcher button[lang="zh-CN"]{min-width:44px}
.audio-toggle{min-width:44px}
@media(max-width:420px){.color-picker{grid-template-columns:repeat(4,minmax(44px,1fr))}.color-choice{min-height:44px}}
html[lang="zh-CN"] dialog p{font-family:'Noto Sans SC',sans-serif;font-weight:400;line-height:1.65}
#game.keyboard-open[data-panel] header{visibility:visible;top:4px}
#game.keyboard-open[data-panel] .addon-view{inset:56px 0 0}
.player.character-avatar{position:absolute}
html:not([data-ui-ready]) #title p,html:not([data-ui-ready]) footer button{visibility:hidden}
/* Rear-facing custom art moves as a composite; it is never rotated into fake side frames. */
.walking .custom-avatar .avatar-canvas{animation:custom-step .22s steps(2,end) infinite}
@keyframes custom-step{50%{transform:translateY(-2px)}}
.book-honeypot{position:absolute!important;left:-10000px!important;width:1px;height:1px;overflow:hidden}
.report-entry{display:block;margin:8px 0 0 auto;min-height:44px;font-size:14px}
/* Standardized v2: every transparent layer has one canvas and one transform. */
.character-avatar[data-template="2"]{aspect-ratio:4/5}
.custom-avatar[data-template="2"] .avatar-canvas{overflow:visible}
.sprite-layer{position:absolute;inset:0;display:block;width:100%;height:100%;image-rendering:pixelated;image-rendering:crisp-edges;object-fit:fill;pointer-events:none}
.player.character-avatar[data-template="2"]{width:calc(var(--avatar-height)*.8);left:calc(50% - var(--avatar-height)*.4)}
.creator-studio{display:flex;align-items:center;justify-content:center;gap:12px;margin:0 0 12px}
.creator-studio .creator-preview{min-height:184px;width:170px;margin:0}
.creator-studio .creator-avatar{width:128px;height:160px}
.creator-studio .view-picker{flex-direction:column;margin:0}
.creator-studio .preview-mount{width:155px;height:175px;left:calc(50% - 77.5px)}
.creator-studio .preview-name{bottom:0;font-size:16px}
.creator-categories{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px;margin-bottom:12px}
.category-tab{min-height:44px;background:#f6e4c5;color:var(--ink);border:2px solid #b39079;font:inherit;font-size:15px;padding:6px 2px;text-wrap:balance}
.category-tab[aria-pressed="true"]{background:#fff0b9;border-color:#b78e3c;box-shadow:inset 0 0 0 2px #e8c46b}
.sprite-choice-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:5px}
.sprite-choice{min-width:0;background:#faecd6;border:2px solid #b9947d;color:var(--ink);font:inherit;display:flex;flex-direction:column;align-items:center;justify-content:start;padding:4px 2px 6px;gap:3px}
.sprite-choice[aria-pressed="true"]{background:#fff1bf;border-color:#b18b35;box-shadow:inset 0 0 0 2px #e6c371}
.sprite-choice span:not(.character-avatar):not(.avatar-canvas){font-size:12px;line-height:1.15;overflow-wrap:normal;text-wrap:balance}
.choice-avatar{width:48px!important;height:60px!important;flex:none}
.creator-options{min-height:117px}
.creator-form #traveller-name{margin-bottom:9px}
.creator-form .rpg-button{margin-top:8px}
.creator-studio+.creator-form{padding:12px}
@media(max-height:740px){.creator-studio .creator-preview{min-height:140px}.creator-studio .creator-avatar{width:96px;height:120px}.creator-studio .preview-mount{width:124px;height:138px;left:calc(50% - 62px)}}
@media(max-width:350px){.sprite-choice span:not(.character-avatar):not(.avatar-canvas){font-size:11px}.category-tab{font-size:13px}.choice-avatar{width:44px!important;height:55px!important}}
#game[data-panel="creator"] .addon-heading{font-size:26px;padding:10px 12px;line-height:1.15;margin-bottom:6px}
#game[data-panel="creator"] .addon-intro{font-size:16px;margin:4px 0 8px;line-height:1.3}
.creator-studio .creator-preview{min-height:144px;width:142px}
.creator-studio .creator-avatar{width:96px;height:120px}
.creator-studio .preview-mount{width:124px;height:138px;left:calc(50% - 62px)}
.creator-studio .preview-name{font-size:13px}
.creator-commit{display:grid;grid-template-columns:1.4fr 1fr;gap:8px}
.creator-commit .rpg-button{font-size:18px;min-height:46px;margin:0}
.creator-form #traveller-name{min-height:42px;padding:7px 10px;font-size:18px}
@media(min-width:375px){.creator-form .color-picker{grid-template-columns:repeat(7,minmax(0,1fr));gap:0}}
.creator-options[data-category="accessory"] .sprite-choice-grid,.creator-options[data-category="backpack"] .sprite-choice-grid{grid-template-columns:repeat(5,minmax(0,1fr))}
.creator-options[data-category="accessory"] .choice-avatar,.creator-options[data-category="backpack"] .choice-avatar{width:40px!important;height:50px!important}
.creator-options[data-category="accessory"] .sprite-choice span:not(.character-avatar):not(.avatar-canvas),.creator-options[data-category="backpack"] .sprite-choice span:not(.character-avatar):not(.avatar-canvas){font-size:11px}
.creator-studio+.creator-form{padding:12px 8px}
/* Scene-specific legacy dimensions must never stretch a standardized stack. */
#game .player.character-avatar[data-template="2"]{width:calc(var(--avatar-height)*.8);left:calc(50% - var(--avatar-height)*.4)}
.book-avatar[data-template="2"]{width:44px;height:55px}
.compose-avatar .book-avatar[data-template="2"]{width:64px;height:80px}
/* Approved corrected pack: no individual layer transforms or facial masks. */
.character-avatar[data-template="3"]{aspect-ratio:3/4}
.character-avatar[data-template="3"] .avatar-canvas{overflow:visible}
.character-avatar[data-template="3"] .sprite-layer{inset:0;width:100%;height:100%;image-rendering:pixelated}
.character-avatar[data-template="3"] .dressed-base{clip-path:inset(0 0 48.4375% 0)}
#game .player.character-avatar[data-template="3"]{width:calc(var(--avatar-height)*.75);left:calc(50% - var(--avatar-height)*.375)}
.creator-studio .creator-avatar[data-template="3"]{width:90px;height:120px}
.choice-avatar[data-template="3"]{width:45px!important;height:60px!important}
.creator-options[data-category="accessory"] .choice-avatar[data-template="3"],.creator-options[data-category="backpack"] .choice-avatar[data-template="3"]{width:37.5px!important;height:50px!important}
.book-avatar[data-template="3"]{width:41.25px;height:55px}
.compose-avatar .book-avatar[data-template="3"]{width:60px;height:80px}
.creator-form .color-picker{grid-template-columns:repeat(5,minmax(0,1fr))}
@media(max-width:350px){.choice-avatar[data-template="3"]{width:41.25px!important;height:55px!important}}
/* Fifth offering uses the existing cards and altar layout. */
.offering-grid{grid-template-columns:repeat(5,minmax(0,1fr))}
.offering{overflow-wrap:normal;text-wrap:balance}
.table-offerings img{width:calc((100% - 12px)/5)}
#game[data-scene="4"] .speaker{letter-spacing:.2px;text-wrap:balance;font-size:15px;line-height:1.2}
@media(max-width:360px){.offering{font-size:11px;padding-left:0;padding-right:0}.offering small{font-size:11px}.offering img{height:33px}}
@media(max-width:420px){.offering-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.offering{min-height:78px;font-size:13px}.offering img{height:32px;margin-bottom:3px}.offering small{font-size:12px;margin-top:1px}}
@media(max-width:360px){.offering{font-size:12px;min-height:72px}.offering img{height:28px}}
@media(min-width:421px){.offering{font-size:13px}}
@media(max-height:650px){#game[data-scene="4"] .dialogue-frame{padding:12px 14px;border-width:10px}#game[data-scene="4"] .dialogue{font-size:17px;line-height:1.18}#game[data-scene="4"] .speaker{font-size:13px;margin-bottom:6px}}
.offering[data-item="2"] img{transform:scale(1.3)}


/* Supplied ornate signboard, unchanged. The window omits only surrounding
   transparent canvas (source viewport 54,268 → 1394,806), not the artwork. */
.title .signboard-window{display:block;position:relative;width:210px;aspect-ratio:1340/538;margin:0 auto;overflow:hidden;filter:drop-shadow(3px 5px 0 #49302c55)}
.title .signboard-window img{position:absolute;display:block;width:108.0597015%;max-width:none;height:auto;left:-4.02985075%;top:-49.8141264%;filter:none;clip-path:none}
@media(max-height:740px){.title .signboard-window{width:170px}}

/* Keep the full traveller stack inside a roomy portrait; name sits below it. */
.creator-studio{align-items:flex-start;gap:14px}
.creator-studio .creator-preview{width:172px;min-height:0;flex:none;gap:10px}
.creator-portrait{position:relative;display:grid;place-items:center;width:160px;height:174px;flex:none}
.creator-studio .creator-portrait .preview-mount{inset:0;width:160px;height:174px;object-fit:contain}
.creator-studio .preview-name{position:static;max-width:100%;width:100%;margin:0;padding:0 4px;font-size:14px;line-height:1.35;white-space:normal;text-wrap:balance;overflow-wrap:anywhere}
.creator-studio .view-picker{align-self:flex-start;margin-top:40px}
@media(max-width:350px){.creator-studio{gap:8px}.creator-studio .creator-preview{width:160px}.creator-studio .view-picker button{padding-inline:12px}}
/* Release 1.2: compact extensions using existing panels, buttons and type. */
.temple-extras{display:grid;grid-template-columns:1fr 1fr;gap:8px;align-items:start}
.temple-extras>.text-button,.share-controls>.text-button{width:100%;min-height:44px;text-wrap:balance;font-size:16px}
.share-controls{min-width:0;text-align:center}
.share-status{font-size:14px;line-height:1.25;margin:3px 0 0;color:#fff3dc;text-shadow:1px 1px #49302c}
.share-status:empty{display:none}
.share-manual{margin-top:6px;color:#fff3dc;font-size:14px;text-align:left}
.share-manual input{display:block;width:100%;min-height:44px;background:#fff4df;color:var(--ink);border:2px solid #b39079;font:inherit;padding:6px;user-select:text}
.moon-ritual{text-align:center}
.moon-blocks{display:flex;justify-content:center;gap:12px;margin:18px 0;perspective:500px}
.moon-block{margin:0;width:min(44%,160px);min-width:0;transform-origin:50% 75%}
.moon-block img{display:block;width:100%;height:auto;aspect-ratio:3/2;object-fit:contain;image-rendering:pixelated}
.moon-art-slot{aspect-ratio:3/2;display:flex;flex-direction:column;justify-content:center;gap:5px;background:#a95259;border:4px solid #753e42;box-shadow:inset 0 0 0 2px #e0b080;color:#fff0d4;padding:8px;font-size:17px;line-height:1.15}
.moon-art-slot small{font-size:12px;opacity:.85}
.moon-block figcaption{font-size:13px;line-height:1.3;margin-top:8px;color:#fff2d8;text-shadow:1px 1px #49302c;text-wrap:balance}
.moon-result{padding:14px;min-height:105px;color:var(--ink)}
.moon-result h2{font-size:22px;line-height:1.25;margin:0 0 9px;text-wrap:balance}
.moon-result p{font-size:18px;line-height:1.35;margin:0;text-wrap:balance}
.moon-note{font-size:14px;line-height:1.4;color:#fff3dc;text-shadow:1px 1px #49302c;margin:12px 4px}
.moon-ritual>.share-controls{margin-top:12px}
.moon-blocks.tossing .moon-block{animation:moon-toss .85s ease-in-out both}
.moon-blocks.tossing .moon-block:nth-child(2){animation-name:moon-toss-other}
@keyframes moon-toss{35%{transform:translateY(-20px) rotate(-24deg)}70%{transform:translateY(-8px) rotate(14deg)}85%{transform:translateY(3px) rotate(-5deg)}100%{transform:none}}
@keyframes moon-toss-other{35%{transform:translateY(-25px) rotate(26deg)}70%{transform:translateY(-7px) rotate(-15deg)}85%{transform:translateY(3px) rotate(5deg)}100%{transform:none}}
@media(prefers-reduced-motion:reduce){.moon-blocks.tossing .moon-block{animation:none}}
/* Kau Chim reuses the parchment UI; these are replaceable artwork slots. */
.kau-container{width:160px;min-height:150px;margin:22px auto;transform-origin:50% 85%}
.kau-art-slot{max-width:220px;min-height:94px;margin:14px auto;padding:18px 12px;background:#a95259;border:4px solid #753e42;box-shadow:inset 0 0 0 2px #e0b080;color:#fff0d4;text-align:center;font-size:20px;line-height:1.25}
.kau-art-slot small{display:block;margin-top:9px;font-size:13px}
.kau-art{display:block;width:160px;height:150px;object-fit:contain;margin:12px auto;image-rendering:pixelated}
.kau-number{font-size:25px;text-align:center;color:#fff3dc;text-shadow:1px 1px #49302c;margin:12px}
.kau-message{text-align:center;padding:18px;margin:18px 0}
.kau-message h2{font-size:24px}.kau-message p{font-size:19px;line-height:1.4}
.fortune-paper{position:relative;margin:16px 0;padding:18px;text-align:center}
.fortune-paper-art{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;z-index:0}
.fortune-paper-content{position:relative;z-index:1}
.fortune-paper h2{font-size:24px;line-height:1.3;margin:4px 0 18px}
.fortune-poem{font:700 21px/1.9 'Noto Serif SC',serif;letter-spacing:0}
.fortune-paper p:not(.fortune-poem){font-size:16px;line-height:1.4}
.fortune-source{font-size:13px!important;overflow-wrap:anywhere}
.fortune-source a{color:inherit;text-decoration:underline}
.fortune-copy-label{display:block;color:#fff3dc;font-size:16px;line-height:1.4}
.fortune-copy{display:block;width:100%;min-height:170px;padding:10px;font-family:inherit;font-size:16px;line-height:1.5;background:#fff4df;color:var(--ink);border:2px solid #b39079;resize:vertical}
.shaking{animation:kau-shake .85s ease-in-out both}
@keyframes kau-shake{20%,60%{transform:rotate(-9deg) translateX(-3px)}40%,80%{transform:rotate(9deg) translateX(3px)}100%{transform:none}}
@media(prefers-reduced-motion:reduce){.shaking{animation:none}}
/* Pre-throw viewport trims only the supplied image's transparent canvas margin. */
.moon-hands{position:relative;width:min(100%,260px);height:180px;margin:12px auto;overflow:hidden}
.moon-hands img{position:absolute;left:50%;top:50%;width:360px;max-width:none;height:270px;object-fit:contain;transform:translate(-50%,-52%);image-rendering:pixelated}
.moon-calm{font-size:17px;line-height:1.35;text-align:center;color:#fff3dc;text-shadow:1px 1px #49302c;margin:6px 8px;text-wrap:balance}
.moon-flight{height:180px;align-items:center}
.moon-flight.tossing .moon-block{animation:moon-flight .85s ease-in-out both}
.moon-flight.tossing .moon-block:nth-child(2){animation:moon-flight-other .85s ease-in-out both}
@keyframes moon-flight{0%{transform:translateY(18px) rotate(80deg) rotateY(60deg)}45%{transform:translateY(-24px) rotate(225deg) rotateY(140deg)}85%{transform:translateY(4px) rotate(330deg) rotateY(230deg)}100%{transform:rotate(360deg) rotateY(270deg)}}
@keyframes moon-flight-other{0%{transform:translateY(18px) rotate(-80deg) rotateY(60deg)}45%{transform:translateY(-30px) rotate(-225deg) rotateY(140deg)}85%{transform:translateY(4px) rotate(-330deg) rotateY(230deg)}100%{transform:rotate(-360deg) rotateY(270deg)}}
@media(prefers-reduced-motion:reduce){.moon-flight.tossing .moon-block{animation:none}}
/* Task A: completion-only presentation. The ritual and sprite stacks are untouched. */
#game[data-completion="true"]{--completion-scene-height:clamp(310px,43svh,380px);height:auto;min-height:100svh;overflow:hidden}
#game[data-completion="true"] .world{inset:0 0 auto;height:calc(var(--completion-scene-height) - 12px)}
#game[data-completion="true"] .controls{position:relative;top:auto;bottom:auto;left:auto;right:auto;margin:var(--completion-scene-height) 18px 0;gap:8px;grid-template-rows:max-content max-content;padding:2px 4px max(12px,env(safe-area-inset-bottom));align-content:start;scroll-margin:8px}
#game[data-completion="true"] .dialogue-frame{padding:12px 14px 14px;min-height:0}
#game[data-completion="true"] .dialogue{font-size:clamp(20px,5.4vw,22px);line-height:1.25;text-wrap:balance}
#game[data-completion="true"] .speaker{margin-bottom:7px;line-height:1.3;text-wrap:balance}
#game[data-completion="true"] .actions{gap:8px}
.completion-main-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;align-items:start}
.completion-main-actions.share-only{grid-template-columns:minmax(0,1fr)}
.completion-main-actions .rpg-button{width:100%;min-height:46px;font-size:19px;margin:0;padding:3px 7px 5px;line-height:1.15;text-wrap:balance}
.completion-main-actions .share-controls{width:100%;min-width:0}
.completion-charity{padding:10px 12px;text-align:center}
.completion-charity h2{font-size:17px;line-height:1.25;margin:0 0 4px;text-wrap:balance}
.completion-charity p{font-size:14px;line-height:1.35;margin:0 0 7px;text-wrap:balance}
.completion-charity .rpg-button{min-height:44px;font-size:16px;line-height:1.15;margin:0;border-width:8px;padding:2px 5px 3px;text-wrap:balance}
.completion-guestbook{display:flex;align-items:center;justify-content:center;gap:8px;min-height:44px;font-size:16px;line-height:1.25;padding:7px 10px;text-wrap:balance}
.completion-guestbook img{width:24px;height:24px;object-fit:contain;flex:none}
.completion-home{justify-self:center;min-width:44px;min-height:44px;padding:7px 18px;background:none;font-size:16px;line-height:1.25}
@media(max-width:300px){.completion-main-actions{grid-template-columns:minmax(0,1fr)}}
/* Existing addon overlays retain their viewport-sized navigation above completion. */
#game[data-completion="true"][data-panel]{height:var(--viewport-height,100svh);min-height:550px;overflow:hidden}
/* Task B: content-only subsections inside Task A's existing result card. */
.completion-result p{margin:0 0 .85em;white-space:pre-line}
.completion-result p:last-child{margin-bottom:0}
.completion-result-section+.completion-result-section{margin-top:16px}
.completion-subtitle{font:inherit;font-size:16px;line-height:1.3;color:#a36357;margin:0 0 8px;text-wrap:balance}
.completion-poem{letter-spacing:0;text-wrap:initial}

/* Confirmation uses the approved hands as one native touch/keyboard control. */
.moon-hands-button{display:block;padding:0;border:0;background:transparent;color:inherit;cursor:pointer;touch-action:manipulation}
.moon-hands-button img{pointer-events:none}
.moon-hands-button:focus-visible{outline:3px solid #f5d58f;outline-offset:4px}

.book-actions{margin:10px 0 12px}
.completion-result a{color:inherit;text-decoration:underline}

/* Keep the book privacy notice readable without competing with its invitation. */
#addon-view .book-privacy-note{font-size:13px;line-height:1.35;padding:6px 8px;margin:4px 0 10px;border-width:1px;text-wrap:pretty;background:#49302c66;border-color:#ead6be55;color:#fff3dc;text-shadow:1px 1px #49302c}

.completion-main-actions [data-action="save"]{display:flex;align-items:center;justify-content:center;gap:8px}
.save-download-icon{width:18px;height:18px;flex:none}

/* Fade only the charity panel fill; keep its pixel border and contents opaque. */
.completion-charity{position:relative;isolation:isolate;border-image:url('assets/baiyibai_asset_pack/ui/dialogue_blank.png') 28 / 11px / 0 stretch}
.completion-charity::before{content:"";position:absolute;inset:-11px;z-index:-1;pointer-events:none;border:11px solid transparent;border-image:url('assets/baiyibai_asset_pack/ui/dialogue_blank.png') 28 fill / 11px / 0 stretch;opacity:.88}
.completion-charity h2,.completion-charity p{text-align:center}
.completion-charity .rpg-button,#actions>[data-action="kau"],#actions>[data-action="moon"],#actions>[data-action="finish"],.moon-ritual .addon-actions .rpg-button{display:flex;align-items:center;justify-content:center;text-align:center}
@media(max-width:360px){.completion-main-actions [data-action="save"]{gap:5px}.completion-main-actions [data-action="save"] .save-label{font-size:17px}.save-download-icon{width:14px;height:14px}}

.kau-container-button{display:block;border:0;padding:0;background:transparent;color:inherit;touch-action:manipulation}
.kau-container-button:focus-visible{outline:3px solid #f5d58f;outline-offset:4px}

.completion-coffee{display:block;justify-self:center;max-width:100%;padding:8px 12px;min-height:44px;color:#fff3dc;font-size:14px;line-height:1.4;text-align:center;text-decoration:underline;text-underline-offset:3px;text-shadow:1px 1px #49302c;text-wrap:balance}

.charity-link{text-decoration:none}

/* Make the guestbook invitation the prominent contribution action. */
.completion-guestbook.rpg-button{width:100%;min-height:56px;font-size:19px;line-height:1.25;text-align:center}
#addon-view .book-privacy-note{text-align:center}

.completion-credit{display:block;justify-self:center;padding:8px 12px;min-height:44px;color:#fff3dc;font-size:13px;line-height:1.4;text-align:center;text-decoration:none;text-shadow:1px 1px #49302c}
.completion-credit:hover{text-decoration:underline;text-underline-offset:3px}

.fortune-save-actions{grid-template-columns:repeat(2,minmax(0,1fr))}
.fortune-save-actions .rpg-button{min-width:0;display:flex;align-items:center;justify-content:center;text-align:center;text-wrap:balance}

/* Landscape artwork: retain mobile UI geometry; crop each scene deliberately. */
#game .background,#game[data-scene="2"] .background,#game[data-scene="3"] .background{inset:0;width:100%;height:100%;object-fit:cover;object-position:50% 50%}
#game[data-scene="0"] .background{object-position:64% 50%}
.addon-backdrop{background:linear-gradient(#4d303826,#57384455),url('assets/baiyibai_asset_pack/backgrounds/temple_book_nook.png') 34% center/cover}
/* Completion scrolls independently of the viewport-sized artwork. */
#game[data-completion="true"] .background{position:fixed;height:100svh}
@media(min-width:600px){
 body{padding:0;display:block}
 #game{width:100%;height:var(--viewport-height,100svh);max-width:none;border:0;box-shadow:none}
 #game .background{object-position:center}
 header{left:28px;right:28px}
 .chapter{left:245px;top:22px}
 .controls{width:min(680px,calc(100% - 48px));left:50%;right:auto;transform:translateX(-50%)}
 #game[data-scene="1"] #actions{grid-template-columns:repeat(2,minmax(0,1fr))}
 #game[data-scene="1"] .world,#game[data-scene="4"] .world{left:50%;right:auto;width:min(800px,100%);transform:translateX(-50%)}
 #game[data-scene="1"] .caishen{left:calc(50% - 82px);bottom:13%;height:170px}
 #game[data-scene="1"] .player{left:calc(44% - 40px);bottom:0}
 #game[data-scene="1"] .cat-button{left:29%;bottom:0}
 #game[data-scene="2"] .world,#game[data-scene="3"] .world{left:50%;right:auto;width:480px;transform:translateX(-50%)}
 .addon-view{left:50%;right:auto;width:min(800px,calc(100% - 64px));transform:translateX(-50%);padding-inline:20px}
 .addon-backdrop{background-position:center,center}
 .fortune-paper-content{max-width:680px;margin-inline:auto}
 #game[data-completion="true"] .controls{width:min(720px,calc(100% - 48px));margin:var(--completion-scene-height) auto 0;transform:none}
 #game[data-completion="true"]{--completion-scene-height:clamp(560px,68svh,640px)}
}

/* Keep overlay navigation below the toolbar even when entered from a scrolled farewell. */
#game[data-panel]{position:fixed;top:0;left:50%;transform:translateX(-50%)}

#resume-divination[hidden],#game[data-panel] #resume-divination{display:none}
.motion-controls{margin:16px auto 0;text-align:center;max-width:440px}
.motion-controls .quiet-back{text-align:center;font-size:15px}
.motion-hint{color:#fff2db;text-shadow:1px 1px #49302c;font-size:14px;line-height:1.4;text-wrap:balance}
@media(max-width:360px){header{left:10px;right:10px}.brand{font-size:20px}}

.completion-links{display:flex;flex-direction:column;align-items:center;gap:8px}
@media(min-width:600px){
 .completion-links{flex-direction:row;justify-content:center;gap:24px}
 .completion-links .completion-credit{order:-1}
 .completion-links a{display:inline-flex;align-items:center;white-space:nowrap}
}

@media(max-width:599px){
 .completion-links{flex-direction:row;justify-content:center;gap:8px}
 .completion-links .completion-credit{order:-1}
 .completion-links a{display:inline-flex;align-items:center;white-space:nowrap;font-size:12px;padding-inline:6px}
}

/* Point to the remaining sticks without moving their touch targets. */
#game:not([data-panel]) .incense-stick:not(.lit):enabled::after{
 content:"";position:absolute;left:17px;top:-16px;width:14px;height:14px;
 background:var(--gold);filter:drop-shadow(0 2px #49302c);
 clip-path:polygon(4px 0,10px 0,10px 6px,14px 6px,14px 8px,8px 14px,6px 14px,0 8px,0 6px,4px 6px);
 pointer-events:none;animation:incense-tap-cue 2s ease-in-out infinite;
}
#game:not([data-panel]) .incense-stick:not(.lit):enabled::before{
 content:"";position:absolute;left:8px;bottom:20px;width:32px;height:32px;
 border:2px solid var(--gold);opacity:.35;pointer-events:none;
 animation:incense-tap-ring 2s ease-out infinite;
}
.incense-stick:nth-child(2){--tap-delay:.25s}
.incense-stick:nth-child(3){--tap-delay:.5s}
#game .incense-stick::before,#game .incense-stick::after{animation-delay:var(--tap-delay,0s)}
@keyframes incense-tap-cue{0%,65%,100%{transform:translateY(0);opacity:.7}30%{transform:translateY(5px);opacity:1}}
@keyframes incense-tap-ring{0%,70%,100%{transform:scale(.8);opacity:0}25%{opacity:.45}60%{transform:scale(1.15);opacity:0}}
@media(prefers-reduced-motion:reduce){
 #game .incense-stick::after{animation:none;opacity:.85}
 #game .incense-stick::before{animation:none;opacity:0}
}
