:root{--ink:#fff0d5;--gold:#ffd17f;--mint:#97e5d4;font-family:'Comic Sans MS','Chalkboard SE',Georgia,serif}h1,h2,.feedback strong,.answer{font-family:'Comic Sans MS','Chalkboard SE',Georgia,serif}h1{letter-spacing:-2px}button,.answer,.feedback{border-radius:12px 9px 14px 8px}.primary{border:2px solid #543621;box-shadow:3px 4px 0 #21190b88}.vignette{background:linear-gradient(90deg,#061e24d4,#09232244 56%,#10262122),linear-gradient(0deg,#081e25d9,transparent 40%,#0b212655)}.quest-bar{position:relative}.quest-bar>div:first-child{flex:1}.decision-clock{width:106px;flex:0 0 106px;position:relative;text-align:center;filter:drop-shadow(3px 4px 0 #1b131a88);margin-top:-12px;margin-bottom:-10px}.decision-clock svg{display:block;width:100%;overflow:visible}.decision-clock>span{display:block;color:#ffe0a3;font:800 9px/1.3 system-ui,sans-serif;letter-spacing:1.2px;text-shadow:1px 1px 1px #241d10}.clock-numbers{font:bold 17px 'Comic Sans MS',Georgia,serif}#secondsLeft{font:bold 15px system-ui,sans-serif;fill:#512f1d}#clockHand{transform-origin:60px 60px}.decision-clock.urgent svg{filter:drop-shadow(0 0 5px #ff976377)}.decision-clock.urgent #secondsLeft{fill:#a0221f}.decision-clock.idle{opacity:.75}.spirit-shadows{position:fixed;inset:0;overflow:hidden;pointer-events:none}.shadow{position:absolute;top:15%;left:14%;width:15vw;min-width:100px;height:44vh;background:#030b18;filter:blur(6px);opacity:0;clip-path:polygon(44% 0,59% 4%,67% 17%,69% 29%,91% 21%,100% 0,96% 42%,79% 49%,92% 100%,62% 87%,49% 99%,38% 87%,6% 100%,23% 49%,5% 37%,0 8%,12% 25%,34% 32%,34% 17%);transform-origin:50% 100%;animation:spiritSway 17s ease-in-out infinite}.s2{left:65%;top:12%;height:48vh;animation-delay:-8s;animation-duration:21s}.s3{left:44%;top:20%;height:38vh;animation-delay:-12s;animation-duration:25s}.help-bubble{position:absolute;z-index:8;pointer-events:none;padding:10px 15px;background:#fff1c8;color:#4d3b46;border:2px solid #392534;border-radius:45% 42% 47% 9%;font:700 20px/1.15 'Comic Sans MS',Georgia,serif;box-shadow:3px 4px #29162066;white-space:nowrap;opacity:0}.title-help{right:9%;top:30%;animation:titlePlea 14s 3s infinite}.inside-help{right:-3%;top:35%}.calling .inside-help{animation:plea 3s ease both}.rescue-rig{display:none;position:absolute;inset:0;pointer-events:none;z-index:7}.rescuing .rescue-rig{display:block}.rescuing .doll,.rescuing .inside{visibility:hidden}.rescuing .doll-wrap{animation:crackingShake 1.6s ease-in-out}.rescuing .answer{border-color:var(--mint)}.empty-choice{opacity:.28;transition:opacity 1s}.freed-girl,.shard{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;object-position:50% 100%;pointer-events:none}.freed-girl{z-index:2;opacity:0;transform-origin:50% 99%;animation:girlEscape 1.3s 1.5s cubic-bezier(.2,.8,.25,1) forwards;filter:drop-shadow(0 0 12px #ffd67555)}.shard{z-index:4}.shard-left{clip-path:polygon(0 0,50% 0,47% 16%,54% 24%,48% 34%,57% 43%,46% 53%,51% 63%,44% 72%,0 80%);animation:breakLeft 1.5s 1.6s cubic-bezier(.2,.5,.45,1) forwards}.shard-right{clip-path:polygon(50% 0,100% 0,100% 80%,44% 72%,51% 63%,46% 53%,57% 43%,48% 34%,54% 24%,47% 16%);animation:breakRight 1.5s 1.6s cubic-bezier(.2,.5,.45,1) forwards}.shard-base{clip-path:polygon(0 80%,44% 72%,100% 80%,100% 100%,0 100%);animation:breakBase 1.5s 1.6s ease forwards}.cracks{position:absolute;inset:0;width:100%;height:100%;z-index:5;fill:none;stroke:#ffeca1;stroke-width:2;filter:drop-shadow(1px 1px 1px #432018);animation:crackFade .3s 1.6s forwards}.crack-main,.crack-branch{stroke-dasharray:1;stroke-dashoffset:1}.crack-main{animation:crackDraw 1.1s .1s ease forwards}.crack-branch{animation:crackDraw .8s .6s ease forwards}.rescue-glow{position:absolute;inset:0;background:radial-gradient(ellipse,#ffe496b0,transparent 65%);opacity:0;animation:releaseGlow 3s .8s forwards}.rescue-spark{position:absolute;z-index:6;color:#ffe688;font-size:40px;opacity:0;animation:sparkFly 1.4s 1.6s ease-out forwards}.sp1{left:10%;top:25%;--dx:-30px;--dy:-60px}.sp2{left:65%;top:20%;--dx:35px;--dy:-70px}.sp3{left:70%;top:60%;--dx:25px;--dy:-25px}.rescue-thanks{position:absolute;z-index:8;right:-8%;top:5%;white-space:nowrap;background:#fff1c8;color:#3f3429;border:2px solid #513429;border-radius:45% 43% 45% 4%;padding:10px 14px;font:700 22px 'Comic Sans MS',Georgia,serif;opacity:0;animation:thanksAppear .5s 2.5s forwards}.rescuing .inside-help{animation:finalPlea 1.55s ease forwards}.rescue-complete .freed-girl{opacity:1;transform:scale(.94);animation:girlHappy 3s ease-in-out infinite}.rescue-complete .game-bottom>span:nth-child(2){visibility:hidden}.end-actions{flex-shrink:0}#feedback:has(#endActions:not([hidden])){flex-wrap:wrap}.tab-hidden .shadow,.tab-hidden .hero-doll img{animation-play-state:paused!important}
@keyframes spiritSway{0%,100%{opacity:0;transform:translateX(-30px) skewX(-10deg) scaleY(.9)}25%{opacity:.32;transform:translateX(10px) skewX(6deg) scaleY(1.15)}55%{opacity:.12;transform:translateX(40px) skewX(-5deg) scaleY(1)}75%{opacity:.3;transform:translateX(20px) skewX(9deg) scaleY(1.1)}}
@keyframes titlePlea{0%,15%,100%{opacity:0;transform:translateY(7px) rotate(-6deg)}3%,12%{opacity:1;transform:translateY(0) rotate(-6deg)}}
@keyframes plea{0%,100%{opacity:0;transform:translateY(7px)}15%,80%{opacity:1;transform:translateY(0)}}
@keyframes finalPlea{0%,90%{opacity:1}100%{opacity:0}}
@keyframes crackingShake{0%,100%{transform:scale(var(--scale)) rotate(0)}15%,40%,65%,85%{transform:scale(var(--scale)) rotate(-2deg)}25%,50%,75%,95%{transform:scale(var(--scale)) rotate(2deg)}}
@keyframes crackDraw{to{stroke-dashoffset:0}}
@keyframes crackFade{to{opacity:0}}
@keyframes breakLeft{30%{transform:translate(-22%,-5%) rotate(-18deg)}100%{transform:translate(-34%,41%) rotate(-52deg) scale(.64);opacity:.55}}
@keyframes breakRight{30%{transform:translate(22%,-5%) rotate(18deg)}100%{transform:translate(34%,41%) rotate(52deg) scale(.64);opacity:.55}}
@keyframes breakBase{to{transform:translateY(12%) scale(.9);opacity:.65}}
@keyframes girlEscape{0%{opacity:0;transform:scale(.65) translateY(6%);clip-path:inset(0 0 42% 0)}30%{opacity:1}100%{opacity:1;transform:scale(.94);clip-path:inset(0)}}
@keyframes releaseGlow{0%{opacity:0;transform:scale(.5)}35%{opacity:.8;transform:scale(1.2)}100%{opacity:.3;transform:scale(1)}}
@keyframes sparkFly{0%{opacity:0;transform:translate(0,0) scale(.3)}25%{opacity:1}100%{opacity:0;transform:translate(var(--dx),var(--dy)) scale(1)}}
@keyframes thanksAppear{to{opacity:1;transform:translateY(-5px)}}
@keyframes girlHappy{0%,100%{transform:scale(.94) rotate(-1deg)}50%{transform:scale(.94) rotate(1deg)}}
.hero-doll img{position:absolute;inset:0;width:100%;height:100%;max-height:100%;object-fit:contain}
@media(min-width:701px) and (max-height:850px){.table-stage{height:46vh;min-height:280px}}
@media(max-width:700px){.decision-clock{width:84px;flex-basis:84px;margin-top:0;margin-bottom:0}.quest-bar{gap:10px;flex-wrap:wrap}.quest-bar>div:first-child{flex-basis:calc(100% - 100px)}.layer-count{position:absolute;right:0;top:100%;margin-top:9px}.layer-count strong{font-size:18px}.progress{margin-right:80px;margin-top:12px}.table-stage{margin-top:8px}.spirit-shadows .shadow{min-width:70px;height:40vh;filter:blur(3px)}.s3{display:none}.rescue-thanks{right:-20%;font-size:19px;padding:8px}.inside-help{font-size:18px;right:-12%}.end-actions{width:100%;justify-content:center}.end-actions button{flex:1}.feedback{position:relative;z-index:4}}
@media(prefers-reduced-motion:reduce){.shadow{animation:none;opacity:.12}.help-bubble.title-help{animation:none;opacity:1}.rescue-complete .freed-girl{animation:none}.rescuing .doll-wrap{animation:none}.tab-hidden .shadow,.tab-hidden .hero-doll img{animation-play-state:paused!important}}

.decision-clock.finished{visibility:hidden}
/* Keep speech and shell fragments inside narrow viewports on either side. */
@media(max-width:700px){.rescue-thanks,.inside-help{right:0}.table-stage{overflow-x:clip;overflow-y:visible}}

#bgMusic{display:none}

/* 0.4: a captured girl, two chapters, and visible lives. */
.prologue{position:relative;min-height:calc(100svh - 130px);display:flex;flex-direction:column;align-items:center;justify-content:center;overflow:hidden;isolation:isolate}
.prologue::before{content:"";position:absolute;inset:5% 10%;background:radial-gradient(ellipse at 50% 55%,#52dbc33d,transparent 55%);pointer-events:none}
.capture-stage{position:relative;width:min(430px,72vw);height:min(66svh,630px);min-height:290px;filter:drop-shadow(0 18px 40px #000c)}
.capture-stage img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;object-position:50% 100%}
.capture-girl{z-index:1;opacity:1}
.capture-doll{opacity:0;z-index:2;mask-image:radial-gradient(ellipse 48% 56% at 50% 50%,#000 78%,transparent 100%)}
.capture-bottom{clip-path:inset(62% 0 0 0)}.capture-lid{clip-path:inset(0 0 38% 0);z-index:3}
.capture-halo{position:absolute;z-index:0;left:0;right:0;bottom:3%;height:25%;border-radius:50%;background:radial-gradient(ellipse,#89ffe281,transparent 70%);filter:blur(10px)}
.capture-caption{position:relative;z-index:4;margin:7px 0 20px;text-align:center;color:#ffecbd;font:700 clamp(18px,2.4vw,27px)/1.3 'Comic Sans MS',Georgia,serif;text-shadow:0 3px 15px #000}
.capture-skip{position:absolute;right:clamp(16px,4vw,55px);bottom:clamp(8px,3vh,32px);z-index:5;background:#0b302de6}
.prologue.playing .capture-girl{animation:girlSealed 4.6s ease-in-out both}
.prologue.playing .capture-bottom{animation:dollBottomClose 4.6s ease-in-out both}
.prologue.playing .capture-lid{animation:dollLidClose 4.6s ease-in-out both}
.prologue.playing .capture-halo{animation:captureLight 4.6s ease-in-out both}
@keyframes girlSealed{0%,25%{opacity:1;transform:scale(1)}60%{opacity:1;transform:scale(.72) translateY(6%)}83%,100%{opacity:0;transform:scale(.34) translateY(20%)}}
@keyframes dollBottomClose{0%,23%{opacity:0;transform:translateY(52%) scale(.7)}42%{opacity:1}70%,100%{opacity:1;transform:translateY(0) scale(1)}}
@keyframes dollLidClose{0%,48%{opacity:0;transform:translateY(-55%) scale(.7)}62%{opacity:1}90%,100%{opacity:1;transform:translateY(0) scale(1)}}
@keyframes captureLight{0%{opacity:.1;transform:scale(.4)}48%{opacity:1;transform:scale(1.15)}100%{opacity:.4;transform:scale(.8)}}
.hearts{display:flex;gap:5px;margin-top:7px;min-height:24px;align-items:center}
.heart{color:#f66e85;font:900 25px/1 system-ui,sans-serif;text-shadow:0 0 9px #e92b6caa}
.heart.spent{color:#627574;text-shadow:none;opacity:.55}
.play.sentence-stage .answer{font-size:clamp(16px,1.7vw,22px);line-height:1.3;min-height:76px;text-align:center}
.play.sentence-stage .answer-text{overflow-wrap:normal;hyphens:none}
.play.game-lost .feedback{border-color:#f58188;box-shadow:0 0 24px #c72a4a55}
@media(max-width:700px){
 .capture-stage{width:min(340px,78vw);height:min(53svh,490px)}
 .capture-caption{margin-bottom:30px;font-size:18px;max-width:82%}
 .capture-skip{bottom:max(12px,env(safe-area-inset-bottom));right:15px}
 .hearts{margin-top:4px}.heart{font-size:21px}
 .play.sentence-stage .table-stage{height:clamp(320px,48svh,420px)}
 .play.sentence-stage .answer{font-size:clamp(14px,3.6vw,17px);min-height:95px;padding:7px 5px}
 .play.sentence-stage .choices{gap:5vw}
}
@media(prefers-reduced-motion:reduce){
 .prologue.playing .capture-girl{animation:none;opacity:0}
 .prologue.playing .capture-doll{animation:none;opacity:1;transform:none}
 .prologue.playing .capture-halo{animation:none;opacity:.4}
}
.tab-hidden .prologue.playing img,.tab-hidden .capture-halo{animation-play-state:paused!important}

/* 0.5: a clearer opening spell, quiet interface, and direct phone choices. */
.welcome .intro .primary{font-size:clamp(17px,2vw,23px);min-width:150px}
.welcome .intro h1{margin-bottom:34px}
.welcome .whisper,.welcome .title-help{display:none}
.brand span{font-size:12px;letter-spacing:.06em;text-transform:none}
.settings #how{font-size:18px;width:40px;padding:8px;line-height:1}
.prologue{min-height:calc(100svh - 105px)}
.capture-stage{width:min(950px,94vw);height:min(73svh,690px);min-height:350px}
.capture-stage .capture-witch{left:-2%;right:auto;top:0;bottom:0;width:58%;height:100%;z-index:2;object-fit:contain;object-position:50% 100%;filter:drop-shadow(0 12px 14px #000a);animation:witchCast 4.6s ease-in-out both}
.capture-stage .capture-girl,.capture-stage .capture-doll{left:auto;right:2%;top:1%;bottom:0;width:47%;height:97%;object-fit:contain;object-position:50% 100%}
.capture-stage .capture-girl{z-index:3}
.capture-stage .capture-bottom{z-index:4}
.capture-stage .capture-lid{z-index:5}
.capture-halo{left:32%;right:0;bottom:5%}
.capture-skip{bottom:16px;right:18px;padding:9px 14px}
@keyframes witchCast{0%{opacity:0;transform:translateX(-6%) rotate(-2deg)}15%,85%{opacity:1}45%{transform:translateX(1%) rotate(1deg)}100%{opacity:.9;transform:translateX(0) rotate(0)}}
.expression{z-index:5;opacity:0;filter:none;mask-image:radial-gradient(ellipse 24% 14% at 50% 25%,#000 58%,transparent 100%);-webkit-mask-image:radial-gradient(ellipse 24% 14% at 50% 25%,#000 58%,transparent 100%)}
.opened .expression{opacity:0!important}
.feedback{min-height:0;margin:5px auto 0;padding:8px 12px;max-width:790px;background:#0a1c1bc9;border:0;box-shadow:none}
.feedback strong{font-size:19px}
.feedback p{margin:2px 0 0;font-size:13px}
.touch-choices{display:none}
.game-bottom{justify-content:flex-end;opacity:.75}
.game-bottom #attempts{display:none}
.play .table-stage{height:clamp(300px,52svh,530px)}
body:has(.play:not([hidden])) footer,body:has(.prologue:not([hidden])) footer{display:none}
@media(max-width:700px){
 .welcome .intro h1{margin-bottom:18px}
 .capture-stage{width:98vw;height:min(57svh,520px);min-height:270px}
 .capture-stage .capture-witch{left:-5%;width:61%}
 .capture-stage .capture-girl,.capture-stage .capture-doll{right:1%;width:51%}
 .capture-skip{bottom:max(8px,env(safe-area-inset-bottom));right:12px}
 .play .table-stage,.play.sentence-stage .table-stage{height:clamp(255px,38svh,390px)}
 .play .choices{gap:5vw}
 .touch-choices{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin:10px auto 0;max-width:470px}
 .touch-choices button{font-size:clamp(26px,8vw,42px);font-weight:800;min-height:64px;padding:5px;background:#ac6e36e8;border:3px solid #f5cf8e;box-shadow:inset 0 3px #fff4,0 6px 15px #0009;touch-action:manipulation}
 .touch-choices button:disabled{opacity:.55}
 .feedback{padding:8px 10px;gap:5px;min-height:0}
 .feedback p{font-size:12px}
 .game-bottom{margin-top:3px}
 .play{padding-top:10px}
}
@media(prefers-reduced-motion:reduce){.capture-stage .capture-witch{animation:none;opacity:1}}

/* 0.6: no visible clock; phone play uses the horizontal room. */
.rotate-hint{display:none}
.quest-bar .layer-count{margin-left:auto}
@media (pointer:coarse) and (orientation:portrait) and (max-width:700px){
 body:has(.play:not([hidden])) .rotate-hint{display:flex;position:fixed;inset:0;z-index:100;align-items:center;justify-content:center;flex-direction:column;gap:14px;padding:30px;text-align:center;background:linear-gradient(#08191bf5,#24111df5);color:#ffe2aa;font:700 21px/1.3 system-ui,sans-serif}
 .rotate-hint::first-line{font-size:42px}
 .rotate-hint span{display:block;max-width:20ch}
}
@media (pointer:coarse) and (orientation:landscape) and (max-height:650px){
 .app{padding:4px 2vw;min-height:100svh}
 header{min-height:33px}
 .brand{font-size:23px}.brand span{font-size:10px}
 .settings button{padding:5px 9px;font-size:11px}
 main{align-items:stretch}
 .play{padding:0!important}
 .quest-bar{align-items:center;gap:8px;min-height:52px;flex-wrap:nowrap}
 .quest-bar>div:first-child{flex-basis:auto}
 .quest-bar h2{font-size:clamp(17px,2.2vw,24px)}
 .quest-bar .eyebrow{margin:0;font-size:9px}
 .hearts{margin:1px 0 0;min-height:15px}.heart{font-size:17px}
 .layer-count{position:static!important;margin:0!important;align-items:center}.layer-count strong{font-size:25px}.layer-count span{font-size:12px}
 .progress{margin:1px 0 4px!important;height:3px}
 .play .table-stage,.play.sentence-stage .table-stage{height:clamp(168px,45svh,285px);min-height:0;margin:0 auto;width:min(98vw,850px)}
 .choices,.play.sentence-stage .choices{gap:12vw}
 .answer,.play.sentence-stage .answer{font-size:clamp(14px,1.8vw,19px);min-height:48px;padding:5px 8px;line-height:1.18}
 .answer kbd{display:none}
 .crystal{width:49px;height:49px;top:59%;font-size:24px}
 .touch-choices{display:grid;grid-template-columns:1fr 1fr;gap:10px;max-width:750px;margin:4px auto 0}
 .touch-choices button{font-size:24px;font-weight:800;min-height:42px;padding:2px;background:#ac6e36e8;border:2px solid #f5cf8e;touch-action:manipulation}
 .feedback{margin:4px auto 0;padding:4px 8px;min-height:0}
 .feedback strong{font-size:18px}.feedback p{font-size:12px}
 .game-bottom{display:none}
 .prologue{min-height:calc(100svh - 40px)}
 .capture-stage{height:min(77svh,540px);min-height:0;width:min(88vw,860px)}
 .capture-skip{bottom:5px}
 .welcome{grid-template-columns:1fr 1fr;min-height:calc(100svh - 50px);padding:0;gap:10px;text-align:left}
 .welcome h1{font-size:clamp(34px,5vw,65px)}
 .welcome .hero-doll{grid-row:auto;height:65svh;min-height:0;margin:0}
 .welcome .class-credit{padding:0;font-size:9px}
 footer{display:none}
}
