.story-open{overflow:hidden}#story-root{position:fixed;inset:0;z-index:75;overflow:auto;background:#f8f5ef;color:#353e50;font-size:16px;line-height:1.65}.story-header{max-width:1320px;padding:18px 28px;gap:20px;border-bottom:1px solid #dfd9cf;background:#fffdf7;position:sticky;top:0;z-index:20}.story-header h1{font-size:22px;color:#414b68;letter-spacing:0}.story-header small{font-size:12px;letter-spacing:2px;color:#8b7049}.story-tools{display:flex;gap:8px}.story-tools button{font-size:14px;white-space:nowrap;padding:9px 14px}.story-hub,.story-collection,.story-history,.story-settings{max-width:1180px;padding:25px 25px 80px}.story-intro{max-width:750px;margin:5px auto 30px;text-align:center}.story-intro>span{font-size:12px;color:#94713e;letter-spacing:2px}.story-intro h2{font-size:30px;margin:12px 0}.story-intro p{font-size:16px;color:#626b7b}.story-intro .story-help{font-size:14px;margin-top:14px}.story-chapter-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:22px}.story-chapter{border:1px solid #ddd9ca;border-radius:24px;overflow:hidden;background:#fffdf7}.story-art{background-image:url('assets/story-scenes-s1.png');background-size:200% 500%;background-position:var(--scene-x) var(--scene-y);background-repeat:no-repeat;aspect-ratio:1.5}.story-chapter .story-art{position:relative}.story-chapter-label{position:absolute;left:13px;top:12px;background:#fff7df;padding:5px 11px;border-radius:13px;font-size:14px;color:#6c573f}.story-lock{position:absolute;inset:0;display:grid;place-items:center;font-size:28px;background:#15254550;backdrop-filter:grayscale(1)}.story-chapter-copy{padding:18px}.story-chapter-copy small{font-size:13px;color:#786e5d}.story-chapter-copy h3{font-size:19px;margin:8px 0}.story-chapter-copy p{font-size:14px;color:#6e7783;min-height:46px;margin:9px 0}.story-chapter-copy>button{width:100%;margin-top:7px}.story-quiet{background:transparent;text-decoration:underline;font-size:14px}.story-epilogue{padding:35px;text-align:center;background:#e9eddd;border-radius:25px;margin-top:30px}.story-play{max-width:1240px;padding:12px 24px 55px}.story-play-top{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:13px;font-size:14px}.story-play-top>div{display:flex;gap:5px}.story-play-top button{padding:8px 12px;font-size:13px}.story-stage{position:relative;isolation:isolate;aspect-ratio:1.5;max-width:780px;margin:0 auto;border:5px solid #fffaf0;border-radius:24px;overflow:hidden;background:#283552}.story-scene{position:absolute;inset:0;width:100%;height:100%;aspect-ratio:auto;pointer-events:none;z-index:0;transform-origin:center}.camera-pan{animation:story-pan 18s ease-in-out infinite alternate}.camera-zoom{animation:story-zoom 15s ease-in-out infinite alternate}.camera-fade{animation:story-fade .6s ease-out}.story-scene.paused{animation-play-state:paused}.story-atmosphere{position:absolute;inset:0;z-index:1;pointer-events:none;background:linear-gradient(0deg,#09162418,transparent 35%)}.story-atmosphere.chapter-8{background:linear-gradient(transparent,#a8b6ca30)}.story-actor{position:absolute;left:0;top:0;width:19%;max-width:140px;aspect-ratio:1;z-index:5;pointer-events:none;will-change:transform}.story-npc{position:absolute;width:23%;aspect-ratio:1;max-width:180px;right:15%;bottom:17%;background-image:url('assets/story-npcs-s1.png');background-size:300% 200%;background-position:var(--npc-x) var(--npc-y);background-repeat:no-repeat;z-index:3;pointer-events:none}.story-lumi{position:absolute;width:8%;aspect-ratio:1;max-width:65px;background-image:url('assets/story-npcs-s1.png');background-size:300% 200%;background-position:var(--npc-x) var(--npc-y);background-repeat:no-repeat;z-index:4;pointer-events:none;transition:left 1s ease,top 1s ease;animation:story-lumi 3s ease-in-out infinite}.story-lumi.lumi-happy{animation:story-lumi .65s ease-in-out infinite}.story-hotspot{position:absolute;transform:translate(-50%,-50%);z-index:6;min-width:44px;max-width:130px;padding:7px 10px;border:1px solid #f4dd97;background:#fffbe9e8;color:#584f3e;border-radius:16px;font-size:14px}.story-hotspot b{display:block;color:#a77d29;font-size:20px}.story-hotspot span{font-size:12px}.story-hotspot:disabled{opacity:.55}.story-below{display:grid;grid-template-columns:1fr 1fr;gap:18px;margin-top:18px}.story-dialogue,.story-task{background:#fffdf7;border:1px solid #ded8c6;border-radius:22px;padding:21px}.story-speaker{font-size:14px;font-weight:700;color:#877142;margin-bottom:10px}.story-dialogue>p{font-size:17px;min-height:85px;line-height:1.85}.story-dialogue-controls{display:flex;align-items:center;flex-wrap:wrap;gap:7px;margin-top:18px}.story-dialogue-controls button{font-size:13px;padding:8px 10px}.story-dialogue-controls span{font-size:13px;color:#7b8290}.story-task-heading{display:flex;justify-content:space-between;align-items:start;gap:10px;margin-bottom:15px}.story-task-heading h3{font-size:18px}.story-task-heading button{font-size:13px;padding:5px 10px;min-height:36px}.story-options{display:grid;grid-template-columns:1fr 1fr;gap:9px}.story-options button{font-size:14px;line-height:1.5;padding:12px;text-align:left;min-height:51px;background:#edf0e2}.story-options .selected,.story-match .selected,.story-piece-grid .selected{outline:2px solid #9b854c;background:#fff1c8}.story-feedback,.story-task-progress{font-size:14px;margin-top:13px;line-height:1.7}.story-hint{margin-top:13px;border-radius:13px;padding:12px;background:#fff0c9;font-size:14px;color:#6b562d}.story-task-done{color:#46794b;background:#e6f0de;padding:15px;border-radius:15px}.story-clock-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin-bottom:13px}.story-clock-grid label{font-size:14px}.story-clock-grid select{appearance:none;background:#f2f4eb;padding:10px 22px 10px 10px;background-image:linear-gradient(45deg,transparent 50%,#66735b 50%),linear-gradient(135deg,#66735b 50%,transparent 50%);background-position:calc(100% - 13px) 50%,calc(100% - 8px) 50%;background-size:5px 5px;background-repeat:no-repeat}.story-match{display:grid;grid-template-columns:1fr 1fr;gap:15px}.story-match>div{display:grid;gap:10px}.story-match button{font-size:14px;padding:10px}.story-piece-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:9px;margin-bottom:12px}.story-piece-grid button{width:100%;font-size:14px;display:block;padding:10px 5px;margin-bottom:6px}.story-rotate{display:block;font-size:35px;line-height:1.2;color:#b2883e;transition:transform .3s}.story-piece-grid small{display:block;font-size:12px}.story-slots{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-bottom:12px}.story-slots button{font-size:13px;border:2px dashed #c4b37c;background:#fff7dd;padding:9px 5px}.story-slots strong{display:block;font-size:13px}.story-next{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-top:18px;font-size:13px;color:#7e8474}.story-next>.primary{min-width:230px}.story-echo{background:#f3eedc;border-radius:12px;font-size:14px!important;padding:10px;min-height:0!important;margin-top:12px}.story-reward{max-width:700px;padding:30px 25px 70px;text-align:center}.story-reward .story-art{border-radius:24px;margin-bottom:25px}.story-reward h2{font-size:29px;margin:12px 0}.story-reward p{margin:15px 0;line-height:1.8}.story-reward>button{margin:8px}.story-diary-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:14px;margin-top:22px}.story-diary-page{padding:8px;background:#e6e5dc;text-align:left;border:1px solid #d8d2bc}.story-diary-page .story-art{filter:grayscale(1);border-radius:12px}.story-diary-page.unlocked{background:#fff5d9}.story-diary-page.unlocked .story-art{filter:none}.story-diary-page h3{font-size:15px;margin:8px 5px}.story-diary-page>span{font-size:12px;margin-left:5px}.story-diary-detail{max-width:750px;margin:30px auto;padding:25px;background:#fffaf0;border:1px solid #d8caac;border-radius:25px}.story-diary-detail>.story-art{border-radius:18px}.story-diary-detail h2{margin:18px 0}.story-diary-detail p{font-size:16px;line-height:1.9}.story-diary-detail blockquote{font-size:18px;color:#866744;border-left:3px solid #d8bb7b;padding-left:15px;margin-left:0}.story-history-list{display:grid;gap:12px;margin:20px 0}.story-history-list button{text-align:left}.story-history-list small{display:block;font-size:13px}.story-settings{max-width:600px}.story-settings label{display:flex;align-items:center;gap:12px;margin:20px 0;font-size:17px}.story-settings input{width:23px;height:23px;margin:0}.story-settings p{margin:20px 0}.story-entry{background:#e7e5f1;color:#555071;border:1px solid #d4cfe5}.title-cover>.story-entry{margin-top:12px;display:block;margin-inline:auto;font-size:15px}.story-root button:focus-visible,#story-root button:focus-visible{outline:3px solid #c8a557;outline-offset:3px}@keyframes story-pan{to{transform:scale(1.035) translateX(-.6%)}}@keyframes story-zoom{to{transform:scale(1.07)}}@keyframes story-fade{from{opacity:.5}to{opacity:1}}@keyframes story-lumi{50%{transform:translateY(-5px) rotate(3deg)}}
@media(max-width:760px){.story-header{padding:12px 14px;display:block}.story-header h1{font-size:19px}.story-header small{font-size:11px}.story-tools{margin-top:9px;justify-content:space-between}.story-tools button{font-size:13px;padding:7px 10px}.story-hub,.story-collection,.story-history{padding:20px 14px 50px}.story-intro h2{font-size:24px}.story-intro p{font-size:15px}.story-chapter-grid{grid-template-columns:1fr 1fr;gap:12px}.story-chapter-copy{padding:12px}.story-chapter-copy h3{font-size:17px}.story-chapter-copy small{font-size:12px}.story-chapter-copy p{font-size:13px;min-height:63px}.story-chapter-copy>button{font-size:14px;padding:9px 7px}.story-play{padding:10px 10px 40px}.story-play-top{flex-wrap:wrap;font-size:13px;gap:7px}.story-play-top>div{width:100%;justify-content:space-between}.story-play-top button{font-size:12px;padding:7px 9px}.story-stage{border:3px solid #fffaf0;border-radius:18px}.story-actor{width:22%}.story-hotspot{padding:4px 7px;max-width:85px;border-radius:11px}.story-hotspot b{font-size:16px}.story-hotspot span{font-size:10px;line-height:1.2;display:block}.story-below{grid-template-columns:1fr;gap:12px;margin-top:12px}.story-dialogue,.story-task{padding:16px}.story-dialogue>p{font-size:16px;min-height:60px}.story-dialogue-controls{margin-top:12px}.story-options button{font-size:14px}.story-clock-grid{gap:7px}.story-clock-grid label{font-size:13px}.story-clock-grid select{font-size:14px}.story-next{align-items:stretch;flex-direction:column}.story-next>.primary{min-width:0}.story-diary-grid{grid-template-columns:repeat(2,1fr)}.story-diary-detail{padding:17px}.story-npc{width:24%;right:11%}.story-stage .mini-pet-speech{font-size:8px;padding:2px 5px;max-width:120px}.story-piece-grid button{font-size:13px}.story-match button{font-size:13px}.story-slots strong{font-size:12px}.story-reward h2{font-size:25px}}
.story-clock-face{display:block;max-width:100px;width:100%;margin:10px auto;background:#fff4d8;border-radius:50%}.story-clock-face circle{fill:none;stroke:#b3985e;stroke-width:3}.story-clock-face path{stroke:#63708a;stroke-width:3;fill:none;stroke-linecap:round}.story-clock-face .hour-hand{stroke:#937033;stroke-width:5}.story-map-picture{aspect-ratio:1!important;width:100%;height:auto;min-height:75px;border:3px solid #f6e2aa;border-radius:12px;overflow:hidden;margin:5px 0 12px}.story-map-picture b{display:block;color:#fff6c4;font-size:28px;line-height:1.6;text-align:center}.story-circuit-shape{position:relative;aspect-ratio:1.5;background:#263a4a;border-radius:13px;color:#f8d989;padding:10px;margin-bottom:10px}.story-circuit-shape svg{position:absolute;inset:0;width:100%;height:100%;fill:#f9e0a4;stroke:#e8c472;stroke-width:4}.story-circuit-shape svg path{fill:none}.story-lumi.lumi-follow:after{content:'✦';position:absolute;right:-7px;bottom:8px;color:#fff3ac;font-size:17px;animation:story-lumi .8s infinite}.story-actor .mini-pet-speech{font-size:10px}
@media(max-width:760px){.story-clock-face{max-width:75px}.story-map-picture{min-height:60px}.story-actor .mini-pet-speech{font-size:8px}}
/* Preserve the generated panel ratio rather than stretching it to device width. */
.story-art,.story-stage{aspect-ratio:5/3}.story-scene{aspect-ratio:auto}
.story-credits{font-size:14px;color:#7b7d83;line-height:1.9!important;margin-top:30px!important}
@media(max-width:760px){#app>header{flex-wrap:wrap;gap:10px}#app>header .topright{margin-left:auto}.topright>.story-entry{font-size:12px;padding:8px 10px}.story-stage .story-hotspot{min-width:44px}}
.story-atmosphere.story-mist{background:radial-gradient(ellipse at 20% 75%,#c1c7d7a8,transparent 70%),linear-gradient(15deg,#9ba5b46b,#9dabc431);animation:story-mist 7s ease-in-out infinite alternate}.story-atmosphere.story-restored{background:radial-gradient(ellipse at 50% 50%,#ffe7a53d,transparent 75%);animation:story-restore 1.4s ease-out}.story-stage[data-paused=true] *{animation-play-state:paused!important}@keyframes story-mist{to{opacity:.65;transform:scale(1.04)}}@keyframes story-restore{from{opacity:1;background-color:#fff4ae8a}to{opacity:.3}}
@media(min-width:761px){.story-play{display:grid;grid-template-columns:minmax(0,1.65fr) minmax(310px,1fr);gap:16px;align-items:start}.story-play-top{grid-column:1/-1;margin-bottom:0}.story-stage{grid-column:1;grid-row:2 / span 2;width:100%;max-width:none;position:sticky;top:115px}.story-below{grid-column:2;grid-row:2;display:flex;flex-direction:column;margin:0;gap:14px}.story-next{grid-column:2;grid-row:3;flex-direction:column;align-items:stretch;margin:0}.story-dialogue>p{min-height:70px}.story-dialogue-controls{margin-top:10px}.story-task{padding:17px}}
/* Text and characters share one in-game window; dialogue never covers the floor. */
.story-window{border:2px solid #d7c9a8;border-radius:23px;overflow:hidden;background:#fff9eb;min-width:0}.story-window>.story-stage{position:relative;top:auto;grid-column:auto;grid-row:auto;border:0;border-radius:0;width:100%;max-width:none;margin:0;aspect-ratio:5/3}.story-window>.story-dialogue{border:0;border-top:1px solid #d7c9a8;border-radius:0;margin:0;padding:17px 20px;background:linear-gradient(110deg,#fffdf7,#fbf3df)}.story-window .story-dialogue>p{min-height:52px;font-size:17px;line-height:1.7}.story-window .story-dialogue-controls{margin-top:10px}.story-window .story-actor{width:24%;max-width:140px}.story-window .story-actor .mini-pet-speech{display:none}.story-window .story-lumi{animation:none!important;transition:none!important;will-change:transform}.story-window .story-lumi:after{display:none!important}.story-below:empty{display:none}.story-window .story-speaker{font-size:15px;margin-bottom:5px;color:#77592c}
@media(min-width:761px){.story-window{grid-column:1;grid-row:2 / span 2;width:100%;max-width:min(100%,calc((100svh - 390px)*5/3));position:sticky;top:115px;justify-self:center}.story-below{grid-column:2;grid-row:2}.story-next{grid-column:2;grid-row:3}}
@media(max-width:760px){.story-window{margin-top:8px;border-radius:18px}.story-window>.story-dialogue{padding:13px 14px}.story-window .story-dialogue>p{font-size:16px;min-height:55px}.story-window .story-dialogue-controls{gap:5px}.story-window .story-dialogue-controls button{font-size:12px;padding:8px}.story-window .story-actor{width:26%;max-width:110px}.story-window .story-speaker{font-size:14px}.story-window .story-lumi{width:10%;max-width:55px}}
@media(max-height:520px) and (min-width:761px){.story-window{max-width:100%;position:relative;top:auto}.story-window>.story-stage{max-height:55svh;aspect-ratio:5/3;width:auto;margin-inline:auto}}
.story-window>.story-next{margin:0;padding:12px 17px 16px;background:#fff9eb;border-top:1px solid #e6dcc4;display:flex;flex-direction:column;align-items:stretch;gap:7px}.story-window>.story-next>span{font-size:12px;text-align:center}.story-window>.story-next>.primary{min-width:0;font-size:14px;padding:9px;min-height:43px}.story-window .story-next{grid-column:auto;grid-row:auto}
@media(min-width:761px){.story-play:not(.has-quest){grid-template-columns:1fr}.story-window{grid-row:2;max-width:min(100%,calc((100svh - 440px)*5/3))}.story-below{grid-row:2}.story-play:not(.has-quest) .story-window{grid-column:1}}
@media(max-height:520px) and (min-width:761px){.story-window{max-width:100%}}
.story-window>.story-next{padding:8px 14px 9px;gap:5px}
/* Keep exploration markers above the walking floor; full labels remain in the quest panel. */
.story-window .story-hotspot{width:44px;height:44px;min-width:44px;min-height:44px;padding:3px;border-radius:50%;display:grid;place-items:center}.story-window .story-hotspot b{font-size:22px;line-height:1}.story-window .story-hotspot small{position:absolute;right:-2px;top:-5px;background:#fff9e5;color:#6f5b35;border:1px solid #ddc88c;border-radius:50%;font-size:12px;line-height:19px;min-width:19px;text-align:center}.story-window .story-hotspot>span{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.story-window .story-hotspot:focus-visible>span{clip:auto;width:max-content;max-width:130px;height:auto;white-space:normal;background:#fff9e8;top:46px;left:50%;transform:translateX(-50%);padding:5px 8px;font-size:13px;border-radius:10px}
@media(max-width:760px){.story-window .story-npc{right:2%;width:21%;bottom:14%}}
/* Keep chapter actions aligned within each mobile card row. */
@media(max-width:760px){
 .story-chapter-grid{align-items:stretch}
 .story-chapter{display:flex;flex-direction:column;min-width:0}
 .story-chapter>.story-art{flex:none;width:100%}
 .story-chapter-copy{display:flex;flex-direction:column;flex:1;min-width:0}
 .story-chapter-copy>small{display:block;min-height:3.3em}
 .story-chapter-copy>h3{line-height:1.65;min-height:3.3em}
 .story-chapter-copy>p{flex:1}
 .story-chapter-copy>button{display:flex;align-items:center;justify-content:center;min-height:44px;line-height:1.5;text-align:center}
 .story-chapter-copy>button[data-story-chapter]{margin-top:auto}
 .story-chapter-copy:not(:has([data-story-history]))::after{content:"";display:block;min-height:44px;margin-top:7px}
}
.story-library-grid{max-width:1060px;margin:auto;padding:30px 24px 70px;display:grid;grid-template-columns:1fr 1fr;gap:24px}.story-library-card{border:1px solid #d9d4c6;border-radius:26px;overflow:hidden;background:#fffdf7;display:flex;flex-direction:column}.story-library-picture{height:220px;display:grid;place-items:center;background:radial-gradient(circle,#ffebbd,#e7e5ef)}.story-library-card.puimek .story-library-picture{background:radial-gradient(circle,#fcf4d5,#d4f1f0 65%,#ded6ee)}.story-library-picture img{height:90%;width:80%;object-fit:contain}.story-library-card>div:last-child{padding:24px;display:flex;flex-direction:column;flex:1}.story-library-card h2{font-size:24px;line-height:1.5;margin:8px 0}.story-library-card p{font-size:16px;line-height:1.8}.story-library-card small,.story-library-progress{color:#747c71}.story-library-card button{margin-top:auto;min-height:48px;width:100%}.story-power{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:12px}.story-power button{display:grid;justify-items:center;gap:8px;touch-action:none;user-select:none;background:#e5f3f2;padding:15px 10px;min-height:120px}.story-power button>span{font-size:30px}.story-power progress{width:100%;height:12px;accent-color:#75bfc6}.story-power small{font-size:13px}.story-balance{display:grid;gap:12px;margin-bottom:18px}.story-balance label{display:flex;align-items:center;justify-content:space-between;gap:15px}.story-balance select{width:95px;min-height:44px;background:#e6eeeb;padding:8px}.story-stage:has(.story-actor[data-pose=cast])::after{content:'💧';position:absolute;left:42%;top:15%;font-size:24px;pointer-events:none;z-index:4;animation:puimek-rain .65s ease-in infinite}.story-stage:has(.story-actor[data-pose=cast]) .story-atmosphere{background:radial-gradient(ellipse at 45% 65%,#a7f4eb80,transparent 60%)}@keyframes puimek-rain{from{transform:translateY(0);opacity:1}to{transform:translateY(65px);opacity:0}}
@media(max-width:760px){.story-library-grid{grid-template-columns:1fr;padding:20px 14px 50px;gap:18px}.story-library-card{display:grid;grid-template-columns:100px 1fr;align-items:stretch}.story-library-picture{height:auto;min-height:220px}.story-library-picture img{width:100%;height:150px;align-self:center}.story-library-card>div:last-child{padding:17px 13px}.story-library-card h2{font-size:20px}.story-library-card p{font-size:14px}.story-tools{flex-wrap:wrap;gap:6px}.story-tools button{flex:1}.story-power{grid-template-columns:1fr 1fr}.story-power button:only-child{grid-column:1/-1}}
@media(prefers-reduced-motion:reduce){.story-stage:has(.story-actor[data-pose=cast])::after{animation:none}}
[data-story-world=puimek] .story-stage[data-story-shot="8.04"] .story-lumi:not(.lumi-happy)::before{content:"";position:absolute;inset:-7px;border:2px solid #b8ddf0;border-top-color:#e6d8fa;border-radius:50%;animation:puimek-wind 2s linear infinite;pointer-events:none}@keyframes puimek-wind{to{transform:rotate(360deg)}}
[data-story-world=somdao] .story-scene{filter:saturate(var(--somdao-saturation,1));transition:filter .8s ease}[data-story-world=somdao] .story-stage:has(.story-actor[data-pose=cast])::after{content:'✦';color:#ffe6a0;font-size:34px;text-shadow:0 0 18px #ffd66c;animation:somdao-spark .8s ease-out infinite}[data-story-world=somdao] .story-stage:has(.story-actor[data-pose=cast]) .story-atmosphere{background:radial-gradient(ellipse at 45% 65%,#ffdf8980,transparent 65%)}[data-story-world=somdao] .story-power button{background:#fff0d9;color:#775331}[data-story-world=somdao] .story-power progress{accent-color:#dcaa56}[data-story-world=somdao] .story-stage[data-story-shot="8.04"] .story-lumi:not(.lumi-happy)::before{content:"";position:absolute;inset:-8px;border:3px solid #938bb5;border-radius:45% 55%;box-shadow:0 0 8px #615e90;animation:puimek-wind 3s linear infinite;pointer-events:none}.story-library-card.somdao .story-library-picture{background:radial-gradient(circle,#fff3ca,#f0d4bb 65%,#d7c4e1)}.story-chapter-copy>.story-synopsis{font-size:14px;line-height:1.7;min-height:0;flex:0 0 auto;margin:8px 0}.story-chapter-copy>.story-reward-caption{font-size:13px;line-height:1.7;min-height:0;margin:5px 0 12px;color:#8a6b41}@keyframes somdao-spark{from{transform:translate(-5px,50px) scale(.4);opacity:0}40%{opacity:1}to{transform:translate(35px,-20px) scale(1.3);opacity:0}}
@media(min-width:761px){.story-library-grid{grid-template-columns:repeat(3,minmax(0,1fr));max-width:1180px}}
@media(prefers-reduced-motion:reduce){[data-story-world=somdao] .story-scene{transition:none}[data-story-world=somdao] .story-stage:has(.story-actor[data-pose=cast])::after{animation:none}}

/* Let Somdao chapter text keep its natural height at every screen size. */
[data-story-world="somdao"] .story-chapter-copy{gap:10px}
[data-story-world="somdao"] .story-chapter-copy>small,[data-story-world="somdao"] .story-chapter-copy>h3,[data-story-world="somdao"] .story-chapter-copy>p{flex:0 0 auto;min-height:0;margin:0;line-height:1.75;overflow-wrap:anywhere}
[data-story-world="somdao"] .story-chapter-copy>button{flex-shrink:0}
@media(max-width:600px){[data-story-world="somdao"] .story-chapter-grid{grid-template-columns:minmax(0,1fr);gap:20px}[data-story-world="somdao"] .story-chapter-copy{padding:18px}[data-story-world="somdao"] .story-chapter-copy>h3{font-size:20px}[data-story-world="somdao"] .story-chapter-copy>p{font-size:15px}[data-story-world="somdao"] .story-chapter-copy>small{font-size:14px}}
/* Crystal Veil keeps the companion readable and its chapter cards in natural flow. */
[data-story-world="prongsai"] .story-chapter-copy{gap:10px}
[data-story-world="prongsai"] .story-chapter-copy>small,[data-story-world="prongsai"] .story-chapter-copy>h3,[data-story-world="prongsai"] .story-chapter-copy>p{flex:0 0 auto;min-height:0;margin:0;line-height:1.75;overflow-wrap:anywhere}
[data-story-world="prongsai"] .story-chapter-copy>button{flex-shrink:0}
.story-ability{padding:12px 16px;border:1px solid #ccdfed;border-radius:16px;background:#eff8fc;color:#536c87;font-size:14px;line-height:1.7;grid-column:1/-1}
[data-story-world="prongsai"] .story-power button{background:#eaf4fc;color:#555777}
[data-story-world="prongsai"] .story-power progress{accent-color:#9b9bd8}
[data-story-world="prongsai"] .story-stage:has(.story-actor[data-pose=cast])::after{content:'◈';color:#dffcff;text-shadow:0 0 12px #96cde4;animation:somdao-spark .8s ease-out infinite}
[data-story-world="prongsai"] .story-stage[data-story-power=resonance]:has(.story-actor[data-pose=cast])::after{content:'♪'}
[data-story-world="prongsai"] .story-stage[data-story-power=sight] .story-atmosphere{background:radial-gradient(ellipse at 50% 55%,transparent 45%,#c1bee930 90%)}
[data-story-world="prongsai"] .story-stage[data-story-shot="3.02"] .story-npc,[data-story-world="prongsai"] .story-stage[data-story-shot="3.03"] .story-npc{border:2px solid #d5edff88;border-radius:50%}
.story-library-card.prongsai .story-library-picture{background:radial-gradient(circle,#edfaff,#ded3f4 70%)}
.story-library-card>div:last-child{min-width:0}
@media(min-width:761px){.story-library-grid{grid-template-columns:repeat(2,minmax(0,1fr));max-width:1100px}}
@media(max-width:600px){[data-story-world="prongsai"] .story-chapter-grid{grid-template-columns:minmax(0,1fr);gap:20px}[data-story-world="prongsai"] .story-chapter-copy{padding:18px}[data-story-world="prongsai"] .story-chapter-copy>h3{font-size:20px}[data-story-world="prongsai"] .story-chapter-copy>p{font-size:15px}[data-story-world="prongsai"] .story-chapter-copy>small{font-size:14px}}

.story-library-picture{overflow:hidden;min-width:0}.story-library-picture img{width:90%;height:198px;max-width:100%;max-height:198px;min-width:0;min-height:0;object-fit:contain}@media(max-width:760px){.story-library-picture img{width:100%;height:150px;max-height:150px}}
/* Compact play screen only; desktop and chapter browsing retain their layout. */
@media(max-width:480px) and (max-height:740px){
 #story-root:has(.story-play)>.story-header{position:static;padding:6px 10px;border:0}
 #story-root:has(.story-play)>.story-header small,#story-root:has(.story-play)>.story-header .story-tools{display:none}
 #story-root:has(.story-play)>.story-header h1{font-size:16px;line-height:1.4;margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 .story-play{padding:0 8px 12px;display:flex;flex-direction:column;gap:6px}
 .story-play-top{order:0;margin:0;gap:5px;flex-wrap:wrap}
 .story-play-top>span{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:12px}
 .story-play-top>div{display:contents}
 .story-play-top button{min-height:36px;padding:5px 8px}
 .story-play-top [data-story=skip],.story-play-top [data-story=readskip]{display:none}
 .story-play .story-window{display:contents}
 .story-play .story-stage{order:1;width:100%;height:clamp(115px,25svh,170px);aspect-ratio:auto;border:0;border-radius:14px;margin:0}
 .story-play .story-dialogue{order:2;padding:8px 10px;border:1px solid #ded8c6;border-radius:14px}
 .story-play .story-speaker{margin-bottom:2px;font-size:14px}
 .story-play .story-dialogue>p{font-size:16px;line-height:1.5;min-height:0;margin:0;max-height:4.5em;overflow:auto;overscroll-behavior:contain}
 .story-play .story-dialogue-controls{margin-top:5px;gap:4px}
 .story-play .story-dialogue-controls button{min-height:36px;padding:5px 7px;font-size:12px}
 .story-play .story-below{order:3;display:flex;flex-direction:column;margin:0;gap:5px}
 .story-play .story-below:empty{display:none}
 .story-play .story-ability{padding:5px 8px;margin:0;font-size:12px;line-height:1.4}
 .story-play .story-task{padding:8px 10px;border-radius:14px}
 .story-play .story-task-heading{margin-bottom:6px;gap:6px}
 .story-play .story-task-heading h3{font-size:16px;line-height:1.4}
 .story-play .story-task-heading button{min-height:36px}
 .story-play .story-task button,.story-play .story-task select{max-width:100%;min-width:0;overflow-wrap:anywhere}
 .story-play .story-options{gap:5px}
 .story-play .story-task-heading h3{margin:0}
 .story-play .story-match{gap:6px}
 .story-play .story-match>div{gap:5px;min-width:0}
 .story-play .story-match button{padding:6px;min-height:44px;font-size:14px;line-height:1.4}
 .story-play .story-power{gap:6px}
 .story-play .story-power:has(>button:nth-child(3)){grid-template-columns:repeat(3,minmax(0,1fr))}
 .story-play .story-power button{padding:7px;min-height:82px;gap:3px;line-height:1.3;grid-template-columns:22px minmax(0,1fr);text-align:left}
 .story-play .story-power button>span{font-size:22px;grid-column:1;grid-row:1}
 .story-play .story-power strong{font-size:14px;grid-column:2;grid-row:1;justify-self:start}
 .story-play .story-power progress,.story-play .story-power small{grid-column:1/-1;font-size:12px}
 .story-play .story-balance{grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;margin-bottom:7px}
 .story-play .story-balance label{display:flex;flex-direction:column;align-items:stretch;justify-content:space-between;gap:4px;min-width:0;font-size:13px;line-height:1.4}
 .story-play .story-balance select{width:100%;min-height:44px;padding:5px;font-size:14px}
 .story-play .story-clock-grid{gap:5px;margin-bottom:7px}
 .story-play .story-clock-face{max-width:44px;margin:4px auto}
 .story-play .story-clock-grid select{width:100%;min-height:44px;padding:5px 19px 5px 5px}
 .story-play .story-piece-grid{grid-template-columns:repeat(auto-fit,minmax(60px,1fr));gap:5px;margin-bottom:6px}
 .story-play .story-piece-grid>div{min-width:0}
 .story-play .story-piece-grid button{padding:5px;min-height:44px;margin-bottom:4px;line-height:1.35}
 .story-play .story-circuit-shape{display:block;aspect-ratio:1;width:42px;height:42px;padding:3px;margin:4px auto 6px;font-size:24px}
 .story-play .story-map-picture{width:44px;height:44px;min-height:44px;aspect-ratio:1!important;margin:4px auto 6px}
 .story-play .story-map-picture b{font-size:22px}
 .story-play .story-slots{gap:5px;margin-bottom:6px}
 .story-play .story-slots button{padding:5px;min-height:44px;line-height:1.4}
 .story-play .story-task>.primary{width:100%;min-height:44px;padding:7px}
 .story-play .story-options button{padding:7px;min-height:44px}
 .story-play .story-task-done{padding:7px;margin:0}
 .story-play .story-feedback:empty{display:none}
 .story-play .story-feedback,.story-play .story-task-progress,.story-play .story-echo{margin-top:5px;line-height:1.5}
 .story-play .story-next{order:4;margin:0;padding:0;border:0;display:block}
 .story-play .story-next>span{display:none}
 .story-play .story-next>.primary{width:100%;min-width:0;min-height:44px;padding:8px}
}

/* Pipsy's fifth story retains the established care-game character. */
[data-story-world="pipsy"] .story-chapter-copy{display:flex;flex-direction:column;gap:10px;min-width:0}
[data-story-world="pipsy"] .story-chapter-copy>small,[data-story-world="pipsy"] .story-chapter-copy>h3,[data-story-world="pipsy"] .story-chapter-copy>p{min-height:0;margin:0;flex:0 0 auto;overflow-wrap:anywhere}
[data-story-world="pipsy"] .story-chapter-copy>button{flex-shrink:0}
[data-story-world="pipsy"] .story-stage:has(.story-actor[data-pose=cast])::after{content:'✒';color:#ffe3a2;text-shadow:0 0 12px #edb64b;animation:somdao-spark .8s ease-out infinite}
[data-story-world="pipsy"] .story-stage:has(.story-actor[data-pose=cast]) .story-atmosphere{background:radial-gradient(ellipse at 45% 65%,#ffe39a60,transparent 65%)}
.story-library-card.pipsy .story-library-picture{background:radial-gradient(circle,#fff2cf,#f7d0b8 70%)}
@media(max-width:600px){[data-story-world="pipsy"] .story-chapter-grid{grid-template-columns:minmax(0,1fr)}}
/* Reserve a clear strip above Pipsy's silhouette on compact phones. */
@media(max-width:480px) and (max-height:740px){
 [data-story-world="pipsy"] .story-stage{container-type:size}
 [data-story-world="pipsy"] .story-stage .story-hotspot{top:24px!important}
 [data-story-world="pipsy"] .story-hotspot small{top:0;right:0}
 [data-story-world="pipsy"] .story-actor{width:min(26%,calc(95cqh - 60px))}
}
