*{box-sizing:border-box}body{margin:0;background:#202940;color:#f4f5fc;font-family:system-ui,sans-serif}.novel{max-width:1200px;margin:auto;min-height:100svh;padding:22px 32px 26px}header{display:flex;align-items:center;justify-content:space-between;gap:20px}#brand{font-size:18px;font-weight:650}nav{display:flex;gap:18px;align-items:center}button,select{font:inherit;color:inherit;background:transparent;border:1px solid #8996ae;padding:9px 16px;border-radius:4px;cursor:pointer}select{background:#202940;padding:8px}button:hover{background:#34445c}button:focus-visible,select:focus-visible{outline:3px solid #ffd684;outline-offset:4px}button:disabled{opacity:.35;cursor:default}.stage{position:relative;margin:20px 0 0;height:min(52vh,460px);min-height:285px;overflow:hidden;border-radius:8px 8px 0 0;background:#29364f}#art{height:100%;width:100%}#art svg{height:100%;width:100%;display:block}.chapter{position:absolute;left:30px;top:25px;max-width:70%}.chapter span{color:#becbe0;font-size:13px}h1{font-family:Georgia,'Songti SC','Noto Serif CJK SC',serif;font-size:clamp(23px,3vw,36px);font-weight:500;margin:9px 0;color:#f4f5fc}.dialogue{position:relative;background:#f4f5fc;color:#202940;padding:25px 32px 18px;border-left:5px solid #ef9db6;min-height:235px;border-radius:0 0 8px 8px}h2{font-size:15px;margin:0 0 12px;color:#74506b}#line{font-family:Georgia,'Songti SC','Noto Serif CJK SC',serif;font-size:clamp(20px,2.1vw,25px);line-height:1.65;max-width:850px;min-height:82px;margin:0 0 20px;white-space:pre-line}.controls{display:flex;align-items:center;gap:20px}.controls button{color:#202940;border-color:#9ca6b7}.controls button:hover{background:#e0e5f0}#next{margin-left:auto;background:#202940;color:white;min-width:106px}#cue{color:#59677e;font-size:12px}#choices{display:grid;gap:10px;margin:10px 0 22px}#choices:empty{display:none}#choices button{text-align:left;color:#202940;background:#e5e9f3;border-color:#a7b2c6;line-height:1.4;padding:14px 18px}#choices button:hover{background:#d6deee;border-color:#202940}dialog{background:#f4f5fc;color:#202940;border:0;border-radius:8px;padding:28px;width:min(680px,90vw);max-height:80vh}dialog::backdrop{background:#10192bc9}dialog button{color:#202940}#history{padding-left:23px;line-height:1.65}#history li{margin-bottom:15px}#history strong{display:block;color:#74506b;font-size:13px}@media(max-width:600px){.novel{padding:12px 12px 20px}header{gap:8px}#brand{font-size:14px}nav{gap:6px;font-size:12px}nav button,select{padding:7px 9px}#langLabel{display:none}.stage{height:38svh;min-height:240px;margin-top:12px}.chapter{left:16px;top:17px;max-width:90%}.dialogue{padding:20px 18px 16px}#line{min-height:100px}.controls{gap:10px}#cue{max-width:95px}.controls button{padding:9px 12px}}@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto}}

#escapedActor{position:absolute;right:28px;top:-44px;width:88px;height:66px}#escapedActor[hidden]{display:none}#escapedActor svg{width:100%;height:100%}

/* Compact desk comedy: choices share the same visible stage. */
.novel{max-width:980px;padding:16px 24px 20px;min-height:0}.stage{height:290px;min-height:0;margin-top:14px}.chapter{top:18px;left:24px;max-width:62%}h1{font-size:27px}.dialogue{padding:20px 24px 16px;min-height:0}#line{font-size:21px;line-height:1.5;min-height:64px;margin-bottom:16px}#choices{grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:9px;margin:10px 0 16px}#choices button{font-size:15px;padding:12px;min-height:56px}.props{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}.novel[data-scene="outside"] #next{background:#754763;border-color:#754763}.novel[data-scene="outside"] .dialogue{border-color:#ef9db6}@media(max-width:600px){.novel{padding:10px}.stage{height:215px}.chapter{left:14px;top:14px;max-width:85%}h1{font-size:22px}.dialogue{padding:18px 16px 14px}#line{font-size:19px;min-height:65px}#choices{grid-template-columns:1fr}#choices button{min-height:44px;padding:10px 12px}#next{max-width:195px;font-size:14px}.controls{gap:8px}#cue{display:none}}

.novel[data-scene="dance"] #art>svg:first-child{transform:rotate(-2deg)}
/* Raster direction is separate from branching content. */
.chapter{position:static;max-width:none;display:flex;align-items:baseline;gap:20px;margin:16px 0 10px}.chapter span{font-size:12px;white-space:nowrap}h1{font-family:system-ui,sans-serif;font-size:19px;font-weight:600;margin:0}.stage{margin-top:0;height:310px;border:1px solid #59647c;border-bottom:0}.scene-backdrop{position:absolute;inset:0;background-image:url('./assets/scenes-v1.png');background-repeat:no-repeat}.scene-0{background-size:100% 320%;background-position:0 0}.scene-1{background-size:100% 342.85714%;background-position:0 44.11765%}.scene-2{background-size:100% 252.63158%;background-position:0 100%}.scene-location{position:absolute;left:16px;top:14px;padding:5px 9px;background:#202940e8;color:#f4f5fc;font-size:12px;border-radius:3px}.cast{position:absolute;inset:0;pointer-events:none}.actor-sprite{width:220px;aspect-ratio:1;background-image:url('./assets/actors-v1.png');background-repeat:no-repeat;background-size:300% var(--sheet-height);background-position:var(--column) var(--row)}.cast .actor-sprite{position:absolute;bottom:5%;filter:drop-shadow(0 6px 3px #14203470);opacity:.83}.slot-c{left:15%}.slot-e{left:42%}.slot-k{left:68%}.cast .speaking{opacity:1;transform:translateY(-5px) scale(1.07)}.cast.closeup .actor-sprite:not(.speaking){opacity:.5;transform:scale(.83)}.cast.closeup .speaking{width:300px;left:38%;bottom:-2%;transform:none}.cast{animation:cast-in .16s ease-out}.props{pointer-events:none}#escapedActor{right:24px;top:-104px;width:130px;height:130px;z-index:3}#escapedActor .actor-sprite{width:130px}.dialogue h2{font-weight:700;font-size:16px}.novel[data-scene="dance"] #art>svg:first-child{transform:none}@keyframes cast-in{from{opacity:.65}to{opacity:1}}@media(max-width:600px){.chapter{display:block;margin:12px 0 8px}.chapter span{font-size:11px}h1{font-size:17px;margin-top:4px}.stage{height:225px}.actor-sprite{width:125px}.slot-c{left:2%}.slot-e{left:34%}.slot-k{left:66%}.cast .actor-sprite{bottom:6%}.cast.closeup .speaking{width:205px;left:23%;bottom:-1%}.scene-location{top:9px;left:9px;font-size:10px}#escapedActor{width:100px;height:100px;top:-80px;right:15px}#escapedActor .actor-sprite{width:100px}.controls{flex-wrap:wrap}#next{max-width:220px}}@media(prefers-reduced-motion:reduce){.cast{animation:none}}
.cast .actor-sprite{opacity:1;filter:brightness(.88) drop-shadow(0 6px 3px #14203470)}.cast .speaking{filter:drop-shadow(0 6px 3px #14203470)}.cast.closeup .actor-sprite:not(.speaking){opacity:1;filter:brightness(.7);width:165px;transform:none}.cast.closeup[data-focus="c"] .slot-e{left:75%}.cast.closeup[data-focus="c"] .slot-k{left:2%}.cast.closeup[data-focus="e"] .slot-c{left:2%}.cast.closeup[data-focus="e"] .slot-k{left:75%}.cast.closeup[data-focus="k"] .slot-c{left:2%}.cast.closeup[data-focus="k"] .slot-e{left:75%}@media(max-width:600px){.cast.closeup .actor-sprite:not(.speaking){width:95px}.cast.closeup[data-focus="c"] .slot-e,.cast.closeup[data-focus="e"] .slot-k,.cast.closeup[data-focus="k"] .slot-e{left:73%}}

#saveStatus{font-size:12px;color:#becbe0;margin:12px 0 0}#skip{font-size:13px}#restartDialog p{line-height:1.6}#keepPlaying{background:#202940;color:white}#line{scroll-margin:20px}@media(max-width:600px){#skip{font-size:12px;padding:9px}#saveStatus{font-size:11px}}

.soundtrack{margin-top:16px;padding-top:12px;border-top:1px solid #59647c;font-size:12px;color:#becbe0}.soundtrack-controls{display:flex;align-items:center;gap:18px;flex-wrap:wrap}.soundtrack-controls label{display:flex;align-items:center;gap:8px}.soundtrack button{font-size:13px;min-width:108px}.soundtrack input{width:105px;accent-color:#ffd684}.soundtrack input:focus-visible{outline:3px solid #ffd684;outline-offset:4px}.soundtrack p{margin:8px 0;line-height:1.5}.soundtrack a{color:#ffd684}.soundtrack summary{cursor:pointer}.soundtrack audio{display:none}

#choiceHistory{padding-left:23px}#choiceHistory li{margin:8px 0}#choiceHistory button{width:100%;text-align:left;background:#e5e9f3;line-height:1.45}#choiceHistoryHint{font-size:13px;line-height:1.6;color:#59677e}dialog h3{font-size:15px;margin:22px 0 10px}#saveConflict{margin-top:14px;padding:14px;background:#fff0ce;color:#202940;border-radius:5px;font-size:14px;line-height:1.6}#saveConflict[hidden],#undoRevisit[hidden]{display:none}#saveConflict button{color:#202940;border-color:#59677e;margin:4px 0}#undoRevisit{margin-top:14px;font-size:13px;border-color:#ffd684;color:#ffd684}@media(max-width:600px){nav{gap:4px}nav button{padding:7px}#saveConflict button{width:100%;text-align:left}}

.log-heading{position:sticky;top:-28px;z-index:2;display:flex;align-items:center;justify-content:space-between;gap:16px;background:#f4f5fc;padding:12px 0;margin-top:-12px;border-bottom:1px solid #d6deee}.log-heading h2{margin:0}#closeLog{min-height:44px}

/* First-visit entry: let the scene explain itself. */
.chapter span{font-size:13px;color:#f4f5fc;font-weight:600}
.brand-tools{display:flex;align-items:center;gap:18px}#musicButton{font-size:13px;min-height:44px;white-space:nowrap}#musicButton[aria-pressed="true"]{border-color:#ffd684;color:#ffd684}
#speaker[data-actor="e"]{color:#854761}#speaker[data-actor="c"]{color:#66502d}#speaker[data-actor="k"]{color:#765700}
.soundtrack-controls{margin:12px 0}.soundtrack details>p{margin-top:12px}
@media(max-width:600px){header{flex-wrap:wrap;gap:6px}.brand-tools{width:100%;justify-content:space-between}nav{width:100%;justify-content:flex-end}.chapter{margin:10px 0 7px;display:flex;gap:12px;flex-wrap:wrap}.chapter span{font-size:11px}h1{margin:0;font-size:16px}.stage{height:clamp(145px,25svh,205px)}.scene-location{display:none}.actor-sprite{width:110px}.cast.closeup .speaking{width:175px}.dialogue{padding:14px 15px 12px}h2{margin-bottom:8px}#line{font-size:18px;line-height:1.45;min-height:0;margin-bottom:12px}#choices{margin-bottom:10px}.controls{display:grid;grid-template-columns:1fr 1fr;gap:8px}.controls button{min-height:44px}#next{grid-column:1/-1;grid-row:1;width:100%;max-width:none;min-height:48px;margin:0}.soundtrack{margin-top:10px}}

#musicStatus{font-size:13px;line-height:1.5;color:#ffd684;margin:8px 0}#musicStatus[hidden]{display:none}

@media(max-width:600px) and (max-height:640px){.stage{height:120px}.actor-sprite{width:100px}.cast.closeup .speaking{width:150px}#line{font-size:17px;line-height:1.4}}

/* Actions live on the stage; each attempted rescue visibly changes it. */
#stageChoices{position:absolute;inset:0;pointer-events:none}#stageChoices:empty{display:none}#stageChoices button{position:absolute;bottom:8px;z-index:5;pointer-events:auto;min-height:44px;background:#fff4d5;color:#202940;border:2px solid #ffd684;box-shadow:0 2px 0 #202940;font-size:14px;padding:9px 12px;width:42%;white-space:normal;line-height:1.3}#stageChoices button:first-child{left:5%}#stageChoices button:last-child{right:5%}#stageChoices button:hover{background:#ffd684}
.novel[data-stage-choice="true"] .cast .actor-sprite{bottom:19%}.novel[data-scene="mouseTrouble"] .scene-backdrop{transform:translateX(-12%)}.novel[data-scene="mousePanic"] .scene-backdrop{transform:translateX(-40%)}.novel[data-scene="mousePanic"] .cast{transform:translateX(-18%)}.novel[data-rescue="unplug"] .scene-backdrop{filter:brightness(.15)}.novel[data-rescue="unplug"] .cast .actor-sprite{filter:brightness(.4)}.novel[data-rescue="unplug"] .stage{background:#080e18}
@media(max-width:600px){#stageChoices button{font-size:12px;padding:7px 9px}.novel[data-stage-choice="true"] .cast .actor-sprite{bottom:27%}}

.cast .trapped-cup{left:12%;bottom:0;width:190px;transform:rotate(180deg);filter:none}.cast .wheel-key{left:53%;bottom:2%;width:190px;transform:rotate(60deg);filter:none}@media(max-width:600px){.cast .trapped-cup{width:115px;left:8%}.cast .wheel-key{width:115px;left:50%}}

#stageChoices button{width:132px;background:#202940df;color:#fff;border-color:#ffd684;padding:5px;display:flex;flex-direction:column;align-items:center;gap:4px;bottom:9px}#stageChoices button:first-child,#stageChoices button:last-child{left:auto;right:auto}#stageChoices button[data-target="mouse"]{left:36%}#stageChoices button[data-target="usb"]{right:7%}#stageChoices button[data-target="cup"]{left:8%}#stageChoices button[data-target="key"]{right:8%}.prop-icon{display:block;width:100px;height:80px;overflow:hidden}.prop-icon svg{width:100%;height:100%}.prop-icon .actor-sprite{width:100px}.prop-caption{font-size:13px;line-height:1.3}#stageChoices button:hover{background:#34445c}.novel[data-stage-choice="true"] .stage{min-height:225px}
@media(max-width:600px){#stageChoices button{width:112px}.prop-icon{width:86px;height:72px}.prop-icon .actor-sprite{width:86px}.prop-caption{font-size:12px}#stageChoices button[data-target="mouse"]{left:12%}#stageChoices button[data-target="usb"]{right:3%}.novel[data-stage-choice="true"] .cast .actor-sprite{bottom:40%}}
