:root{--ink:#f7efe2;--muted:#c7baa9;--panel:rgba(8,14,16,.94);--line:rgba(240,214,169,.35);--font:"Noto Serif CJK JP","Hiragino Mincho ProN","Yu Mincho","YuMincho","Hiragino Mincho Pro",serif}*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;overflow:hidden;background:#07170f;color:var(--ink);font-family:var(--font);font-weight:800;touch-action:none;-webkit-text-size-adjust:100%}body{position:fixed;inset:0}button{color:inherit;cursor:pointer;font-family:var(--font);font-weight:900;border:1px solid var(--line);border-radius:13px;background:rgba(18,28,25,.90);font-size:clamp(15px,4vw,19px);padding:12px 15px;min-height:44px;touch-action:manipulation}button:active{background:#6f483e}button:focus-visible{outline:2px solid #ffdb9d}button:disabled{opacity:.5;cursor:default}#scene{position:fixed;inset:0;width:100vw;height:100dvh;touch-action:none;display:block;background:#15572b}#vignette{pointer-events:none;position:fixed;inset:0;background:radial-gradient(ellipse at center,transparent 42%,rgba(2,5,8,.53) 100%)}#vignette::after{content:'';position:absolute;inset:0;pointer-events:none;opacity:0;background:rgba(250,245,225,.12);mix-blend-mode:screen;}body.anomaly-flicker #vignette{animation:anomaly-vignette-flicker 1.18s steps(8,end) infinite;}body.anomaly-flicker #vignette::after{animation:anomaly-light-flicker 1.18s steps(8,end) infinite;}@keyframes anomaly-vignette-flicker{0%{opacity:1}9%{opacity:.86}18%{opacity:.98}27%{opacity:.79}38%{opacity:1}49%{opacity:.72}61%{opacity:.94}72%{opacity:.80}84%{opacity:1}100%{opacity:.88}}@keyframes anomaly-light-flicker{0%{opacity:.02}9%{opacity:.16}18%{opacity:.04}27%{opacity:.26}38%{opacity:.08}49%{opacity:.22}61%{opacity:.03}72%{opacity:.19}84%{opacity:.06}100%{opacity:.14}}.hud{position:fixed;z-index:5;pointer-events:none}#topbar{top:0;left:0;right:0;display:flex;justify-content:space-between;padding:calc(env(safe-area-inset-top) + 11px) 13px 0;align-items:center;gap:8px}#topdecor{font-size:20px;letter-spacing:7px;color:rgba(251,215,155,.88);text-shadow:0 2px 6px black}.topright{display:flex;gap:7px;pointer-events:auto}.smallbtn{font-size:13px;border-radius:12px;min-height:43px;padding:8px 10px;background:rgba(7,17,14,.78)}#aim{top:49%;left:50%;transform:translate(-50%,-50%);font-family:system-ui;font-size:18px;font-weight:300;color:#ffffffa5;text-shadow:0 1px 3px black}#toast{top:24%;left:50%;transform:translateX(-50%);width:88vw;max-width:460px;text-align:center;font-size:clamp(17px,4.5vw,23px);text-shadow:1px 2px 5px #000,0 0 15px #000;line-height:1.6;opacity:0;transition:opacity .2s;color:white;white-space:pre-line}#toast.on{opacity:1}#interact{bottom:calc(180px + env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);pointer-events:auto}#interact .action{background:#ecd6af;color:#1e1914;font-size:21px;border:2px solid white;box-shadow:0 3px 25px #0008;min-width:150px;border-radius:18px}#bottomcontrols{bottom:calc(22px + env(safe-area-inset-bottom));left:20px;right:17px;height:144px;display:flex;justify-content:space-between;align-items:center}#joystick{pointer-events:auto;width:142px;height:142px;border-radius:100%;touch-action:none;display:grid;place-items:center}.joyring{width:124px;height:124px;border-radius:100%;border:2px solid #fff6;background:rgba(9,17,20,.32);box-shadow:0 0 0 8px #0002,inset 0 0 25px #fff1;position:relative}#knob{width:56px;height:56px;position:absolute;top:32px;left:32px;border-radius:100%;background:#d8e1d9a8;border:2px solid #fff8;box-shadow:0 3px 12px #0008;pointer-events:none}#buttonwell{pointer-events:auto;margin-right:12px}#dropButton{width:91px;height:75px;border:2px solid #f0d6a6b0;background:#12251bdf;font-size:21px;border-radius:20px;line-height:1.1}#dropButton span{display:block;color:#eccb9e;font-size:17px}#hintText{font-size:11px;bottom:calc(8px + env(safe-area-inset-bottom));width:100%;text-align:center;opacity:.7;text-shadow:0 0 8px black}.overlay{position:fixed;inset:0;z-index:20;display:flex;align-items:center;justify-content:center;padding:calc(16px + env(safe-area-inset-top)) 14px calc(16px + env(safe-area-inset-bottom));background:rgba(1,5,7,.85);touch-action:pan-y}.overlay.hidden,.hidden{display:none!important}.storypane{position:relative;width:100%;max-width:540px;min-height:260px;padding:38px 25px 30px;border:1px solid #dfc6a67d;border-radius:14px;background:linear-gradient(155deg,#112019ee,#080d12f5);box-shadow:0 16px 50px #000a;display:flex;flex-direction:column;justify-content:center;gap:16px;max-height:90dvh}.storypane:before{content:'✦  ☾  ✦';font-size:14px;letter-spacing:.5rem;color:#dbbe83;position:absolute;top:11px;left:24px}.speaker{color:#f3c88b;font-size:12px;min-height:10px;margin-top:3px;letter-spacing:.12rem}.storytext{font-size:clamp(22px,5.45vw,29px);line-height:1.85;white-space:pre-line;overflow-wrap:anywhere;min-height:100px;text-shadow:0 1px 2px #000;font-weight:900}.storytext.dead{color:#ffd1c5}.storyfoot{display:flex;align-items:center;justify-content:space-between;font-size:12px;color:#b6aea3;min-height:17px}.skip{position:absolute;top:0;right:9px;padding:4px 8px;font-size:11px;min-height:44px;border:0;background:transparent;color:#ddd0bb}.panel{background:linear-gradient(160deg,#131d1cf7,#080c13fa);border:1px solid var(--line);border-radius:19px;box-shadow:0 22px 65px #000c;padding:21px;max-height:94%;overflow:auto;overscroll-behavior:contain;width:100%;max-width:560px;touch-action:pan-y}.panel h1,.panel h2{font-size:clamp(23px,6vw,32px);line-height:1.4;margin:9px 0 20px;font-weight:900}.panel p{line-height:1.8}.menupanel{display:grid;gap:11px}.eyebrow{font-size:11px;color:#e8bd8b;letter-spacing:.18rem}.wide{width:100%;display:block;min-height:50px}.primary{background:#e4cdac;color:#18181a;border-color:#fff2da}.buttonrow{display:flex;gap:9px;margin-top:10px}.buttonrow>*{flex:1}.smallnote{font-size:12px!important;color:#beb4a5;line-height:1.6!important;font-weight:600}.endpanel{text-align:center}.endpicture{display:block;width:100%;max-width:280px;aspect-ratio:4/5;object-fit:cover;margin:5px auto;border-radius:12px;box-shadow:0 0 15px #0009;border:1px solid #dfb38588;cursor:zoom-in;touch-action:manipulation}.rowhead{display:flex;align-items:center;justify-content:space-between;gap:8px}.rowhead h2{margin:0 0 14px}.closebtn{font-size:29px;min-height:44px;min-width:44px;padding:2px 11px}.recordsPanel{max-width:620px}.endgrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:16px 0}.recordTile{border:1px solid #d8bc8c75;border-radius:14px;background:#0c1717;padding:8px;cursor:pointer;text-align:center;min-height:160px;touch-action:manipulation}.recordTile img{width:100%;aspect-ratio:4/5;object-fit:cover;border-radius:9px;max-height:200px}.recordTile.locked{cursor:default;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:20px;color:#9eaaad;background:linear-gradient(130deg,#162c24,#162021);font-size:25px}.recordTile .recordtitle{font-size:12px;line-height:1.6;margin-top:7px}.deathstats{font-size:13px;line-height:1.9;padding:10px;border-top:1px solid #fff2;margin:7px 0 16px;color:#d0c8bf}.zoomLayer{background:#020608f5;padding:28px 15px;z-index:35}.zoomLayer img{max-width:min(90vw,620px);max-height:87dvh;object-fit:contain;box-shadow:0 0 45px #000;border:1px solid #fff6;touch-action:pan-y}.zoomClose{position:absolute;top:calc(env(safe-area-inset-top) + 8px);right:14px;z-index:1;font-size:29px}.sharepanel{max-width:500px}.sharepanel canvas{display:block;width:auto;height:auto;max-height:50dvh;max-width:100%;aspect-ratio:4/5;margin:auto;border:1px solid #ffffff5c;border-radius:8px}.debug-panel{position:fixed;inset:calc(env(safe-area-inset-top) + 3px) 5px calc(env(safe-area-inset-bottom) + 3px);z-index:70;background:#090d13f9;color:#e6f1e9;border:2px solid #69b19b;border-radius:12px;display:flex;flex-direction:column;padding:10px;font-family:system-ui,sans-serif;font-weight:400;touch-action:pan-y}.debugtabs{display:flex;gap:5px;overflow-x:auto;padding:9px 0;flex:none}.debugtabs button,.debugcontent button{font-family:system-ui,sans-serif;font-weight:600;font-size:12px;border-radius:7px;min-height:32px;padding:5px 8px}.debugcontent{flex:1;overflow-y:auto;overscroll-behavior:contain;padding:4px;line-height:1.6}.debugcontent .dbgitem{border-bottom:1px solid #52615d;padding:9px 2px;display:flex;flex-direction:column;gap:6px}.debugcontent .dbgitem button{max-width:200px}.debugcontent img{max-width:120px;max-height:155px;object-fit:cover}.debugcontent input{font-size:16px;width:76px;padding:7px;border-radius:5px;color:#111;background:#fff}.debugcontent canvas{max-width:100%;border:1px solid #777}.debugcontent pre{white-space:pre-wrap;word-break:break-all;font-size:11px}.debugcontent .dbgrow{display:flex;flex-wrap:wrap;gap:5px;margin:8px 0}#fatal{z-index:100}#fatal .panel{font-size:17px}@media(max-height:710px){#bottomcontrols{bottom:calc(8px + env(safe-area-inset-bottom));height:115px}#joystick{width:120px;height:120px}.joyring{width:108px;height:108px}#knob{top:26px;left:26px}#interact{bottom:calc(135px + env(safe-area-inset-bottom))}.storypane{min-height:210px;padding:32px 18px 20px}.storytext{font-size:clamp(19px,4.85vw,25px)}.endpicture{max-width:190px}.panel{padding:16px}.panel h1{margin:3px 0 7px}}@media(min-width:800px){#bottomcontrols{max-width:680px;margin:auto;left:0;right:0}#hintText{font-size:12px}.storypane{min-height:340px}.endpicture{max-width:260px}}
@media(max-width:430px){.storypane{padding-left:15px;padding-right:15px}.storytext{font-size:clamp(19px,4.85vw,21px);line-height:1.90;letter-spacing:-.02em}.storypane{min-height:255px}} 

/* Halloween picture-book design pass: purely presentational; fog and game rules untouched. */
:root{--ink:#f5ebd8;--muted:#c8b9a4;--panel:rgba(13,26,24,.96);--line:rgba(205,173,120,.48);--gold:#c8a575;--cream:#f3e7ce;--deep:#101b1b}
button{border-color:var(--line);background:linear-gradient(155deg,rgba(25,45,38,.94),rgba(12,25,25,.96));box-shadow:inset 0 1px 0 #fff1,0 3px 10px #0003;transition:background-color .16s,filter .16s,transform .16s,border-color .16s}
button:active{transform:scale(.975);filter:brightness(1.13);background-color:#314937}
button:disabled:active{transform:none;filter:none}
.smallbtn{min-width:46px;min-height:48px;padding:9px 11px;font-size:13px;border-radius:13px;background:linear-gradient(155deg,#14291eda,#081613e8);border:1px solid #d9bb8585}
.topright{gap:8px}#topdecor{font-size:19px;letter-spacing:6px;color:#eacb9c;text-shadow:0 1px 7px #0008}
#aim{font-size:20px;color:#f3e7ceb9;text-shadow:0 1px 4px #000b,0 0 9px #0009;transition:color .15s}
#aim.target{color:#ffe0ac}#aim.target:after{content:"";position:absolute;left:50%;top:50%;width:24px;height:24px;transform:translate(-50%,-50%);border:1.5px solid #ffe6b4cc;border-radius:50%;box-shadow:0 0 10px #f6c68a55;pointer-events:none}
#interact .action{min-height:56px;min-width:150px;padding:12px 20px;background:linear-gradient(165deg,#fff2d6,#e7c995);color:#271d13;font-size:21px;border:2px solid #fff4d3;box-shadow:0 4px 20px #0008,inset 0 2px 1px #fff8;letter-spacing:.055em}
#interact .action:active{background:#d4b47c}
.joyring{border-color:#e6ecd08a;background:radial-gradient(circle,#10241b35,#0b201c75);box-shadow:0 0 0 8px #040c0920,inset 0 0 23px #fff1}
#knob{background:radial-gradient(circle at 30% 26%,#f3f6e6c9,#a9bcbaad 73%);border-color:#fff9;box-shadow:0 2px 14px #0008,inset 0 2px 6px #fff4;transition:transform .075s linear}
#dropButton{background:linear-gradient(160deg,#224632ec,#102a25f0);border-color:#d3b17aba;color:#f7e5c5;box-shadow:inset 0 1px 0 #fff2,0 4px 16px #0008;letter-spacing:.05em}
#dropButton span{color:#e4ba82}
.overlay{background:rgba(4,9,11,.84)}
.storypane,.panel{border:1px solid #bba079a3;background:linear-gradient(160deg,#182923f7 0%,#0c1b1af9 53%,#091016fb 100%);box-shadow:0 18px 56px #000c,inset 0 1px 0 #fff1;position:relative}
.storypane{padding:41px 25px 28px;gap:14px;min-height:260px;max-height:min(90dvh,720px);border-radius:15px}
.storypane:before{content:'✦  ☾  ✦';font-size:13px;letter-spacing:.42rem;color:#d3b586;position:absolute;top:11px;left:23px}
.storypane:after{content:'✧';position:absolute;right:20px;bottom:12px;font-size:13px;color:#c4a57599;pointer-events:none}
.speaker{color:#e6bf88;font-size:12px;letter-spacing:.14em}
.storytext{color:#f4ead8;text-shadow:0 1px 3px #000a;line-height:1.85}
.storytext.notice{color:#eed8b0}
.storytext.ghostvoice{color:#ffd0c6;text-shadow:0 0 12px #8e2f2c60,0 1px 3px black}
.storytext.secretvoice{color:#e4edf0;text-shadow:0 1px 8px #90a5c633}
.storyfoot{color:#b6ae9f;gap:8px}.storyfoot>span:last-child{white-space:nowrap}
.skip{min-height:44px;padding:6px 11px;top:2px;right:6px;color:#ddceb9}
.panel{border-radius:18px;padding:21px}
.panel h1,.panel h2{color:#f6e8ce;letter-spacing:.015em}
.eyebrow{color:#d4af77;letter-spacing:.16em}
.primary{background:linear-gradient(150deg,#fae9cf,#dfc299);color:#1b2722;border-color:#f9e4be;box-shadow:0 3px 15px #0005,inset 0 1px 0 #fff9}
.primary:active{background:#c9ad83}
.wide{min-height:50px}
.menupanel{gap:11px}
.menupanel .eyebrow{text-align:center;font-size:12px}
.menupanel h2{text-align:center;margin:1px 0 12px}
.menupanel .smallnote{text-align:center;margin:5px 0 0}
.endpanel{max-width:540px}
.endpicture{border:2px solid #bca075;border-radius:10px;box-shadow:0 0 0 4px #55422a77,0 0 18px #000b;object-fit:cover}
.endpanel .eyebrow{display:inline-block;padding:5px 13px;border-top:1px solid #b89a6c77;border-bottom:1px solid #b89a6c77}
.recordsPanel{max-width:620px}
.rowhead h2{margin:0 0 14px}
.closebtn{min-width:44px;min-height:44px;border-color:#bca47a88}
.endgrid{gap:12px;margin:16px 0}
.recordTile{border:1px solid #c1a375b2;border-radius:13px;background:linear-gradient(150deg,#2d3328,#101b1b);padding:8px;text-align:center;min-height:160px;box-shadow:inset 0 1px #fff1,0 4px 10px #0004}
.recordTile img{display:block;width:100%;aspect-ratio:4/5;max-height:200px;object-fit:cover;border:1px solid #bca074b0;border-radius:6px;box-shadow:0 0 0 3px #43352266}
.recordTile.locked{background:linear-gradient(150deg,#20352f,#0f211e);color:#e0ceb0;gap:13px;min-height:205px;cursor:default;box-shadow:inset 0 0 0 6px #172720,inset 0 0 0 7px #b7a0754a}
.recordTile.locked:before{content:'☾';display:flex;align-items:center;justify-content:center;color:#b7a17c78;font-size:42px;min-height:60px}
.recordTile .recordtitle{color:#e9d5b6;line-height:1.6;margin-top:9px;font-size:12px}
.recordTile.locked:active{filter:none;transform:none}
#secretEntry .wide{margin-top:8px}
.deathstats{border-top-color:#bfa57755;color:#d1c0a8}
.sharepanel canvas{border:2px solid #bfa377;border-radius:7px;box-shadow:0 0 0 3px #312920,0 4px 15px #0008}
.sharepanel .buttonrow{margin-top:14px}
.zoomLayer img{border:2px solid #c1a074;box-shadow:0 0 0 4px #252018,0 0 45px #000}
@media(max-height:710px){.storypane{min-height:210px;padding:34px 18px 20px}.menupanel{gap:7px}.menupanel h2{margin:0 0 5px}.endpicture{max-width:190px}.panel{padding:16px}}
@media(max-width:430px){.storypane{min-height:245px;padding:38px 16px 23px}.storytext{font-size:clamp(19px,4.85vw,21px);line-height:1.86}.topright{gap:7px}#topbar{padding-left:12px;padding-right:12px}.smallbtn{padding-left:9px;padding-right:9px}#topdecor{font-size:17px;letter-spacing:4px}}
@media(max-width:360px){.storytext{font-size:19px}.panel{padding:15px}.recordTile{padding:6px}.buttonrow{gap:7px}.buttonrow button{padding-inline:8px;font-size:14px}#hintText{font-size:10px}#bottomcontrols{left:12px;right:8px}}
@media(prefers-reduced-motion:reduce){button,#aim,#knob{transition:none!important}.storytext.ghostvoice{text-shadow:0 1px 3px #000}}
.storytext.dead:not(.ghostvoice){color:var(--cream)}

/* Keep the initial control hint clear of the joystick, home indicator and the pickup action. */
#hintText{top:calc(env(safe-area-inset-top) + 69px);bottom:auto;left:0;right:0;width:auto;padding:0 14px;line-height:1.5;text-shadow:0 1px 6px #000,0 0 4px #000}

/* Debug-only: prevent decorative header from squeezing controls on narrow screens. */
@media(max-width:360px){#topbar:has(#debugOpen:not([hidden])) #topdecor{display:none}}

/* Detail polish: same Halloween palette, no map/fog/speed changes. */
#hintText{top:calc(env(safe-area-inset-top) + 69px);left:50%;right:auto;transform:translateX(-50%);width:max-content;max-width:calc(100vw - 24px);padding:5px 12px;border:1px solid #eacb9c35;border-radius:12px;background:rgba(5,18,16,.72);font-size:clamp(12px,2.8vw,13px);font-weight:800;line-height:1.5;white-space:normal;overflow-wrap:anywhere;opacity:.84;text-align:center}
button{border-radius:13px;border-width:1px}
button.primary{border-radius:16px}
button.smallbtn,button.closebtn{border-radius:12px}
button:focus-visible{outline-offset:3px}
.storypane{justify-content:flex-start}
.speaker{height:20px;min-height:20px;line-height:20px;margin-top:3px;flex:none}
.storytext{min-height:95px;display:flex;align-items:center;white-space:pre-line}
.storyfoot{margin-top:auto;min-height:21px;align-items:center}
@media(max-height:560px){.storytext{min-height:65px}}
#aim{font-size:15px}
#aim.target:after{width:23px;height:23px;transition:border-color .12s}
#interact .action.picked{filter:brightness(1.12);transform:scale(.97)}
#dropButton.drop-ok{border-color:#fff3b5;filter:brightness(1.23)}
#dropButton.drop-no{border-color:#d9806e;filter:brightness(.90)}
.endpanel h1{line-height:1.40;text-wrap:balance;overflow-wrap:anywhere;max-width:100%;margin-inline:auto}
.endpanel .eyebrow{font-variant-numeric:tabular-nums}
.endgrid{align-items:stretch}
.recordTile{display:flex;flex-direction:column;min-width:0}
.recordTile img{flex:none;max-height:none;aspect-ratio:4/5;object-fit:cover}
.recordTile .recordtitle{min-height:2.8em;display:flex;align-items:center;justify-content:center;margin-top:8px;overflow-wrap:anywhere}
.recordTile.locked{gap:0;min-height:0;justify-content:flex-start}
.recordTile.locked:before{width:100%;aspect-ratio:4/5;min-height:0;font-size:clamp(30px,10vw,44px);flex:none}
.recordTile.locked .locklabel{display:flex;align-items:center;justify-content:center;min-height:2.8em;font-size:17px}
.sharepanel .buttonrow{margin-top:14px;gap:10px}
.sharepanel .buttonrow button{min-height:52px}
.sharepanel .smallnote{font-size:clamp(12px,2.8vw,13px);line-height:1.6;margin:8px 0 0}
#retryShare{border-color:#f3d29d;margin-top:8px}
#saveWarning{position:fixed;z-index:85;top:calc(env(safe-area-inset-top) + 66px);left:50%;transform:translateX(-50%);width:max-content;max-width:calc(100vw - 24px);padding:12px 15px;border-radius:12px;background:#2f1718f0;border:1px solid #d7a58a;color:#fff1db;box-shadow:0 5px 24px #000a;text-align:center;font-size:13px;line-height:1.6;font-weight:800;pointer-events:none}
#saveWarning[hidden]{display:none!important}
@media(max-width:360px){#hintText{font-size:12px}}
@media(prefers-reduced-motion:reduce){#interact .action.picked{transform:none}}
/* The utility display:block styles must never defeat semantic hidden attributes. */
[hidden]{display:none!important}

/* Timed release, rules emphasis, and explored-only map. */
#countdown{top:calc(env(safe-area-inset-top) + 73px);left:50%;transform:translateX(-50%);z-index:6;
 background:rgba(10,22,21,.83);border:1px solid #e6c39b89;border-radius:12px;min-width:154px;
 padding:7px 11px;text-align:center;font-size:clamp(13px,3.7vw,17px);font-variant-numeric:tabular-nums;
 text-shadow:0 1px 5px #000;white-space:nowrap}
#countdown.danger{color:#ff7774;border-color:#e86a68;animation:countPulse 1s ease-in-out infinite}
#countdown.released{color:#ffb0a6;border-color:#a4433e}
#countdown{white-space:pre-line;line-height:1.32;min-width:186px;letter-spacing:.025em}
#countdown.guiding{border-color:#efce6a;color:#ffe9ab}
#countdown.ending{color:#ff6464;border-color:#ef4949}
#spottedAlert{z-index:12;left:50%;top:41%;transform:translate(-50%,-50%) scale(.82);max-width:94vw;width:max-content;
 padding:14px 18px;text-align:center;color:#ff4f51;font-size:clamp(36px,10.5vw,72px);font-weight:900;
 letter-spacing:.03em;line-height:1.3;white-space:pre-line;text-shadow:0 3px 2px #210000,0 0 12px #000,0 0 25px #c00000;
 opacity:0;visibility:hidden;pointer-events:none;transition:opacity .12s,transform .12s}
#spottedAlert.on{opacity:1;visibility:visible;transform:translate(-50%,-50%) scale(1)}
#spottedAlert.timeout{color:#ffe9a5;text-shadow:0 2px 3px #300,0 0 15px #900}
@media(prefers-reduced-motion:reduce){#spottedAlert{transition:none}}

@keyframes countPulse{50%{transform:translateX(-50%) scale(1.055)}}
#hintText{top:calc(env(safe-area-inset-top) + 145px)}
.storytext .rule-red{color:#ff6467;font-weight:900;font-size:clamp(25px,6.6vw,34px);
 line-height:1.55;text-shadow:0 0 12px #6e1a2177;display:block;letter-spacing:.025em}
.storytext .rule-regular{display:block;color:#f5e9d6}
.storytext:has(.rule-red){display:block;min-height:0}
.mapPanel{max-width:540px;display:flex;flex-direction:column;gap:9px}
#exploredMap{display:block;width:min(100%,min(55dvh,490px));max-width:490px;aspect-ratio:1;
 height:auto;align-self:center;border:2px solid #d4ba8f;border-radius:8px;background:#091714;
 image-rendering:pixelated;touch-action:manipulation}
#mapReturn{margin-top:4px}
@media(max-width:390px){#topbar{padding-inline:8px}#topdecor{font-size:13px;letter-spacing:1px}
 .smallbtn{min-width:42px;font-size:12px;padding:7px 7px}
 #countdown{top:calc(env(safe-area-inset-top) + 69px)}#hintText{top:calc(env(safe-area-inset-top) + 145px)}
 .storytext .rule-red{font-size:clamp(23px,6.2vw,28px)}}
@media(max-height:560px){#exploredMap{width:min(100%,44dvh)}.mapPanel{gap:5px}.mapPanel h2{margin:0;font-size:20px}}
@media(prefers-reduced-motion:reduce){#countdown.danger{animation:none}}

@media(max-width:430px){.storypane:after{display:none}}
@media(max-width:360px){.storytext .rule-red{font-size:23px}}

/* Map pan, pinch zoom, cat choices and post-END results. Gameplay visuals preserved. */
#exploredMap{touch-action:none;user-select:none;-webkit-user-select:none;cursor:grab}
#exploredMap:active{cursor:grabbing}
#mapTools{display:flex;gap:8px;justify-content:center;align-items:center;flex-wrap:wrap}
#mapTools button{min-width:46px;min-height:44px;padding:8px 12px}
#mapScale{min-width:58px;text-align:center;font-variant-numeric:tabular-nums;color:#e5cfad}
.mapPanel{overflow-y:auto;overscroll-behavior:contain}
.runPanel{max-width:480px;display:flex;flex-direction:column;gap:14px}
.runPanel h2{text-align:center;margin:3px 0}
.runFacts{margin:0;display:grid;gap:0;border-block:1px solid #ae936a80}
.runFacts>div{display:flex;justify-content:space-between;align-items:center;gap:14px;padding:12px 4px;border-bottom:1px solid #ae936a40}
.runFacts>div:last-child{border-bottom:0}
.runFacts dt{color:#d6c7ad;font-size:14px}
.runFacts dd{margin:0;color:#f6e9d6;font-size:17px;font-weight:900;font-variant-numeric:tabular-nums;text-align:right}
#runStatsButton{margin-top:7px}
@media(max-height:540px){#mapTools button{min-height:40px}.runFacts>div{padding:7px 4px}.runPanel{gap:7px}}

/* Touch-only adventure: prevent Safari long-press selection and copy callouts. */
html,body,body *{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent}
input,textarea,[contenteditable="true"]{-webkit-user-select:text;user-select:text;-webkit-touch-callout:default}
/* Cat stays visible above the bottom conversation/menu window. */
#catLayer,#modalLayer.cat-dialog-mode{align-items:flex-end;justify-content:center;background:rgba(1,5,7,.12);padding:12px 12px calc(12px + env(safe-area-inset-bottom))}
#catLayer .cat-menu-window{width:100%;max-width:540px;max-height:min(61dvh,460px);overflow-y:auto;gap:7px;padding:17px 18px 15px;background:linear-gradient(155deg,#192a26f2,#090f14f5);border:1px solid #d0a970;box-shadow:0 0 24px #000b}
#catLayer .cat-menu-window h2{margin:0 0 3px}#catLayer .cat-menu-window .smallnote{margin:0 0 2px}
#catLayer .cat-menu-window button{min-height:44px}
#modalLayer.cat-dialog-mode .storypane{width:100%;max-width:540px;min-height:0;max-height:min(44dvh,365px);padding:29px 18px 13px;gap:6px;justify-content:flex-start;background:linear-gradient(155deg,#162723f5,#070e13f9);border-color:#d0a970;box-shadow:0 0 30px #000c}
#modalLayer.cat-dialog-mode .storytext{min-height:0;flex:1;align-items:center;overflow-y:auto;font-size:clamp(17px,4.35vw,22px);line-height:1.68;white-space:pre-line}
#modalLayer.cat-dialog-mode .speaker{height:20px;min-height:20px}#modalLayer.cat-dialog-mode .storyfoot{margin-top:3px;flex:none}
#mapHeading{text-align:center;color:#ffe2a1;font-size:clamp(15px,4vw,19px);font-weight:900;line-height:1.3;margin:0}
@media(max-height:560px){#modalLayer.cat-dialog-mode .storypane{max-height:57dvh;padding-top:24px}#modalLayer.cat-dialog-mode .storytext{font-size:17px}#catLayer .cat-menu-window{max-height:80dvh}}
/* In short landscape viewports, dock cat dialogue to the right so the cat stays visible on the left. */
@media (max-height:560px) and (min-width:600px){
 #catLayer,#modalLayer.cat-dialog-mode{align-items:center;justify-content:flex-end;padding:8px calc(10px + env(safe-area-inset-right)) 8px 8px}
 #catLayer .cat-menu-window{width:min(45vw,390px);max-height:calc(100dvh - 16px);padding:10px 13px;gap:4px}
 #catLayer .cat-menu-window button{min-height:42px;padding:7px 10px}
 #modalLayer.cat-dialog-mode .storypane{width:min(46vw,440px);max-height:calc(100dvh - 16px);padding:24px 14px 10px;gap:4px}
 #modalLayer.cat-dialog-mode .storytext{font-size:clamp(15px,2.2vw,20px);line-height:1.5}
}

/* Narrative navigation: all dialogue scenes support a BACK button and a local page index. */
.story-page-nav{display:flex;gap:8px;align-items:center;justify-content:space-between;flex:none;margin-top:2px}
.story-page-nav button{font-size:clamp(12px,3.3vw,15px);min-height:44px;padding:7px 12px;flex:1;border-radius:10px;background:#182823e8}
.story-page-nav button:disabled{opacity:.37}
.story-index{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;max-height:min(35dvh,240px);overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;padding:5px 2px}
.story-index[hidden],#storyText[hidden]{display:none!important}
.story-index button{min-width:0;text-align:left;padding:7px 9px;min-height:44px;font-size:12px;line-height:1.45;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.story-index button[aria-current="page"]{border-color:#f2c67e;background:#624632}
#modalLayer.cat-dialog-mode .story-index{max-height:min(20dvh,155px)}
@media(max-height:560px){.story-page-nav button{min-height:44px;padding:5px 8px}.story-index{max-height:27dvh;grid-template-columns:repeat(2,minmax(0,1fr))}}

/* Intro: prominent rule text with deliberate confirmation. Other dialogues unchanged. */
#modalLayer.intro-rule-mode .storypane{max-width:610px;height:min(490px,calc(100dvh - 36px - env(safe-area-inset-top) - env(safe-area-inset-bottom)));overflow-y:auto;overscroll-behavior:contain;gap:11px;padding-bottom:20px;min-height:0}
#modalLayer.intro-rule-mode .storytext{display:block;min-height:0;white-space:pre-line;font-size:clamp(25px,6.9vw,39px);line-height:1.58;letter-spacing:.012em;font-weight:900;overflow-wrap:normal;word-break:normal;text-align:left}
#modalLayer.intro-rule-mode .storytext .rule-red{font-size:inherit;line-height:inherit;white-space:pre-line}
#modalLayer.intro-rule-mode .storyfoot{margin-top:4px}
#modalLayer.intro-rule-mode .story-understand{display:block;width:100%;min-height:58px;font-size:clamp(20px,5.2vw,25px);margin-top:2px;flex:none}
#modalLayer.intro-rule-mode #storyPageNav{flex:none}
@media(max-height:600px){#modalLayer.intro-rule-mode .storypane{gap:5px;padding:27px 15px 12px;max-height:94dvh}#modalLayer.intro-rule-mode .storytext{font-size:clamp(22px,5.2vw,29px);line-height:1.37}#modalLayer.intro-rule-mode .storytext .rule-red{font-size:inherit;line-height:inherit}#modalLayer.intro-rule-mode .story-understand{min-height:46px}}

/* Hidden ending reuses the already-shipped male-face sprite; do not crop its alpha edges. */
.endpicture.monster-ending{object-fit:contain;background:#050b0a}

/* Deep forward joystick push: no extra button or changed touch target. */
#joystick.sprinting .joyring{box-shadow:0 0 0 8px #0002,inset 0 0 25px #fff1,0 0 18px #f5d28285}
#joystick.sprinting #knob{background:#f4ddacdb;border-color:#fff8ca}
/* END records: legible death totals and larger titles across mobile and desktop. */
.recordsPanel .recordTile .recordtitle{font-size:clamp(14px,3.6vw,17px);line-height:1.45;font-weight:900;min-height:3em}
.recordsPanel .deathstats{font-size:16px;line-height:1.55;padding:15px 2px 5px;margin-top:14px}
.recordsPanel .deathstats h3{font-size:clamp(20px,5.3vw,26px);margin:0 0 12px;color:#f3dfc2}
.recordsPanel .deathstats-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.recordsPanel .deathstat-item{display:flex;flex-direction:column;gap:4px;align-items:center;text-align:center;min-width:0;padding:13px 7px;border:1px solid #bfa57755;border-radius:12px;background:#101d1bb3}
.recordsPanel .deathstat-item span{font-size:clamp(14px,3.6vw,17px)}
.recordsPanel .deathstat-item strong{font-size:clamp(27px,7vw,39px);line-height:1.2;color:#f6d69e;font-variant-numeric:tabular-nums}
@media(max-width:350px){.recordsPanel .deathstats-grid{gap:7px}.recordsPanel .deathstat-item{padding:10px 3px}}


/* Dialogue stability: equal type size and panel geometry through every page.
   Story text alone scrolls when long; actions stay in one place. */
#modalLayer:not(.cat-dialog-mode):not(.intro-rule-mode) .storypane{
 height:min(460px,calc(100dvh - 34px - env(safe-area-inset-top) - env(safe-area-inset-bottom)));
 min-height:0;overflow:hidden;
}
#modalLayer.cat-dialog-mode .storypane{
 height:min(44dvh,365px);min-height:0;overflow:hidden;
}
#modalLayer.intro-rule-mode .storypane{overflow:hidden}
#modalLayer .storytext{
 min-height:0;flex:1 1 auto;overflow-x:hidden;overflow-y:auto;
 overscroll-behavior:contain;touch-action:pan-y;
}
/* Keep emphasis colored without changing its point size. */
#modalLayer .storytext .rule-red{
 font-size:inherit;line-height:inherit;
}
#modalLayer .speaker,#modalLayer .storyfoot,#modalLayer #storyPageNav,#modalLayer .story-understand{
 flex-shrink:0;
}
@media(max-height:560px){
 #modalLayer.cat-dialog-mode .storypane{height:57dvh;max-height:57dvh}
}
@media(orientation:landscape) and (max-height:560px){
 #modalLayer.cat-dialog-mode .storypane{height:calc(100dvh - 16px);max-height:calc(100dvh - 16px)}
}


/* Text size follows screen width, not the changing mobile browser toolbar height. */
@media (min-width:431px){
 #modalLayer:not(.intro-rule-mode):not(.cat-dialog-mode) .storytext{font-size:clamp(22px,5.45vw,29px)}
}
@media (orientation:landscape) and (max-width:1000px){
 #modalLayer:not(.intro-rule-mode):not(.cat-dialog-mode) .storytext{font-size:25px}
}
@media (orientation:portrait){
 #modalLayer.cat-dialog-mode .storytext{font-size:clamp(17px,4.35vw,22px)}
}
@media (orientation:landscape){
 #modalLayer.cat-dialog-mode .storytext{font-size:clamp(15px,2.2vw,20px)}
}
@media (orientation:portrait){
 #modalLayer.intro-rule-mode .storytext{font-size:clamp(25px,6.9vw,39px)}
}
@media (orientation:landscape){
 #modalLayer.intro-rule-mode .storytext{font-size:clamp(22px,5.2vw,29px)}
}

/* Map dialog heading also stays stable while mobile toolbars appear/disappear. */
@media (orientation:portrait){.mapPanel h2{font-size:clamp(23px,6vw,32px)}}
@media (orientation:landscape) and (max-width:1000px){.mapPanel h2{font-size:20px}}


/* V33: Heisei-era photographic END presentation, dialogue consistently docked below. */
#modalLayer.end-photo-mode,#endResult{background:#020304;padding:0;align-items:flex-end;justify-content:center}
.end-photo-stage{position:absolute;inset:0;z-index:0;overflow:hidden;display:block;background:#080908;pointer-events:none}
.end-photo-stage[hidden]{display:none!important}
.end-photo-stage img{display:block;width:100%;height:100%;object-fit:cover;object-position:center 41%}
.end-photo-stage::after{content:"";position:absolute;inset:0;background:linear-gradient(to bottom,transparent 40%,rgba(0,0,0,.10) 55%,rgba(0,0,0,.78) 100%);pointer-events:none}
#modalLayer.end-photo-mode .storypane{
 position:relative;z-index:1;width:min(100%,680px);max-width:680px;
 height:min(228px,29svh);min-height:min(228px,29svh);max-height:min(228px,29svh);flex:0 0 auto;margin:0 8px calc(8px + env(safe-area-inset-bottom));
 padding:9px 14px 8px;border:1px solid #e4d0b48a;border-radius:12px;
 background:rgba(7,10,13,.72);box-shadow:0 4px 30px #000a;
 display:flex;justify-content:flex-start;gap:3px;overflow:hidden;backdrop-filter:blur(2px);
}
#modalLayer.end-photo-mode .storypane:before{display:none}
#modalLayer.end-photo-mode .speaker{height:16px;min-height:16px;margin:0;font-size:11px}
#modalLayer.end-photo-mode .storypane .storytext{display:block;font-size:clamp(19px,5.0vw,25px);line-height:1.46;letter-spacing:0;flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;white-space:pre-line;touch-action:pan-y;-webkit-overflow-scrolling:touch}
#modalLayer.end-photo-mode .storyfoot{font-size:12px;min-height:14px;gap:4px}
#modalLayer.end-photo-mode .story-page-nav{display:none!important}
#modalLayer.end-photo-mode .story-page-nav button{min-height:44px;font-size:13px;padding:6px 9px}
#modalLayer.end-photo-mode .story-index{display:none!important;max-height:135px}
#endResult>.endpanel{position:relative;z-index:1;max-width:680px;margin:0 10px calc(10px + env(safe-area-inset-bottom));max-height:min(57dvh,550px);
 background:rgba(7,10,13,.88);backdrop-filter:blur(4px);padding:13px 17px;border-color:#d0b389a3}
#endResult .endpanel h1{font-size:clamp(22px,5.6vw,34px);margin:3px 0 6px}
#endResult .endpicture{width:auto;max-width:125px;max-height:min(14dvh,115px);aspect-ratio:9/16;object-fit:cover;margin:3px auto}
#endResult .smallnote{margin:2px auto 5px}
#endResult .buttonrow{margin-top:6px;gap:7px}
#endResult button{min-height:44px;padding:8px 11px}
.x-share-primary{background:#f4e9db;color:#100f10;border:2px solid #fcfbf4;box-shadow:0 0 0 2px #28272780,0 3px 13px #0008;font-size:clamp(17px,4.5vw,21px);font-weight:900;min-height:53px}
.x-share-primary:active{background:#fff4c5}
#endXButton{margin-top:9px}
#shareLayer .sharepanel{max-height:calc(100dvh - 18px);overflow-y:auto;padding:13px}
#shareLayer .sharepanel canvas{max-height:43dvh}
#shareLayer .sharepanel button{min-height:46px}
#shareNotice{font-size:12px;line-height:1.5;margin:7px 0}
/* Old photo album is only the records view. Death statistics keep original keys and numeric values. */
#recordsLayer{background:rgba(8,7,6,.92)}
#recordsLayer .recordsPanel{background:linear-gradient(130deg,#d0b58d,#a98a62);border:4px solid #624a35;color:#2b2119;box-shadow:inset 0 0 28px #44322370,0 15px 50px #000b;max-width:780px}
#recordsLayer .recordsPanel h2{font-size:clamp(25px,6vw,34px);color:#281913;margin:0 0 8px}
#recordsLayer .recordsPanel .smallnote{color:#4a3324}
.album-progress{text-align:center;font-size:19px;font-weight:900;letter-spacing:.06em;padding:6px;border-top:1px solid #563e2788;border-bottom:1px solid #563e2788;margin:5px 0}
#recordsLayer .endgrid{gap:12px;margin:14px 0}
#recordsLayer .recordTile.album-tile{padding:8px 6px 11px;border:1px solid #886d47;border-radius:5px;background:#e9ddbf;min-height:190px;box-shadow:2px 3px 1px #533d2760;transform:rotate(-.4deg)}
#recordsLayer .recordTile.album-tile:nth-child(even){transform:rotate(.55deg)}
#recordsLayer .recordTile.album-tile.locked{background:linear-gradient(140deg,#9e907b,#776a59);color:#e5dcc9;min-height:175px;font-size:clamp(17px,4vw,22px)}
.album-photo-pair{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px}
#recordsLayer .album-photo{padding:0;border:0;box-shadow:none;background:#241e1a;border-radius:2px;min-width:0;min-height:0;overflow:hidden;display:flex;flex-direction:column}
#recordsLayer .album-photo img{width:100%;height:auto;aspect-ratio:9/13;object-fit:cover;border-radius:1px;max-height:none}
#recordsLayer .album-photo span{font-family:var(--font);color:#eedab4;font-size:11px;line-height:1.4;padding:3px 1px}
#recordsLayer .album-photo.album-placeholder{opacity:.6}
#recordsLayer .recordTile .recordtitle{font-size:clamp(13px,3.5vw,18px);color:#302019;line-height:1.35;min-height:0;margin-top:8px}
#recordsLayer .deathstats{color:#2d211c;border-top:2px solid #63472c}
#recordsLayer .deathstats h3{color:#261b14}
#recordsLayer .deathstat-item{border:1px solid #896c47;background:#f0e2c5}
#recordsLayer .deathstat-item span{color:#332218}
#recordsLayer .deathstat-item strong{color:#4d201b}
#recordsLayer button#showSecret{background:#392719;color:#f3dab3}
#recordsLayer button#recordClose{background:#493526;color:#fff}
#recordsLayer #secretEntry{display:grid;gap:10px;margin:14px 0}
#recordsLayer #secretEntry[hidden]{display:none!important}
#recordsLayer #secretEntry .x-share-primary{background:#f2deb4;color:#201811}
@media(max-height:560px){
 #modalLayer.end-photo-mode .storypane{height:min(92svh,214px);min-height:min(92svh,214px);max-height:min(92svh,214px);padding:6px 11px 5px;margin-bottom:6px}
 #modalLayer.end-photo-mode .storypane .storytext{font-size:clamp(18px,2.7vw,21px);line-height:1.4}
 #modalLayer.end-photo-mode .story-page-nav button{min-height:44px;padding:3px 6px}
 #endResult>.endpanel{max-height:96dvh}
 #endResult .endpicture{display:none}
}
@media(max-width:360px){#recordsLayer .album-photo span{font-size:10px}}

/* V33: only one X reporting control, no separate share-panel steps. */
.share-status{font-size:12px;line-height:1.5;color:#ffedca;margin:4px auto 2px;max-width:95%;text-align:center;min-height:0}
.share-status:empty{display:none}
.x-share-primary:disabled{opacity:.62;cursor:wait}
#shareLayer{display:none!important}

/* V34: readable basic rules in the existing pause/settings window; no HUD controls added. */
#guideLayer .rulesSummary{border:1px solid #d0a45c80;border-radius:12px;background:#1b251fe8;padding:12px 15px;text-align:left}
#guideLayer .rulesSummary h3{color:#f7d897;font-size:clamp(18px,4.4vw,22px);line-height:1.4;margin:2px 0 12px}
#guideLayer .rulesSummary ol{padding-left:1.8em;margin:0;display:grid;gap:9px;font-size:clamp(15px,3.7vw,17px);font-weight:800;line-height:1.65}
#guideLayer .rulesSummary li{padding-left:2px;overflow-wrap:anywhere}
#guideLayer .rulesSummary strong{color:#ffdc93}

/* Debug-only: readable asset/sign galleries and reliable touch targets. */
.debug-panel .debugcontent button,.debug-panel .debugtabs button{min-height:44px;min-width:44px}
.debugcontent .debug-sign-preview{display:block;width:min(100%,320px);height:auto;aspect-ratio:12/5;border:1px solid #777;border-radius:7px}
.debugcontent details{margin:6px 0;padding:6px;border:1px solid #52615d;border-radius:8px}
.debugcontent summary{cursor:pointer;min-height:44px;display:flex;align-items:center;font-size:14px}
.debugcontent .dbgitem img{object-fit:contain;max-width:200px;max-height:190px}
/* Debug-only: keep the DEBUG entry accessible even during the introductory overlay. */
#topbar:has(#debugOpen:not([hidden])){z-index:26}
.debug-panel .debugtabs button{flex:0 0 auto;min-width:max-content;white-space:nowrap}


/* V47 full-screen story slab for intro / regular dialogue, with candy ornament on top. */
#storyCandyTop{
 display:none;
 width:74px;height:44px;align-self:center;flex:none;
 background:url('assets/candy_wrapped.webp') center/contain no-repeat;
 filter:drop-shadow(0 4px 10px rgba(0,0,0,.45));
 margin:0 auto 6px;
}
#modalLayer:not(.cat-dialog-mode):not(.end-photo-mode){
 padding:0;
 background:#07110d;
}
#modalLayer:not(.cat-dialog-mode):not(.end-photo-mode) .storypane{
 width:100%;max-width:none;
 height:100dvh;max-height:none;min-height:100dvh;
 margin:0;border:none;border-radius:0;
 background:#07110d;box-shadow:none;
 padding:calc(env(safe-area-inset-top) + 18px) 18px calc(env(safe-area-inset-bottom) + 18px);
 gap:10px;justify-content:flex-start;
}
#modalLayer:not(.cat-dialog-mode):not(.end-photo-mode) .storypane::before,
#modalLayer:not(.cat-dialog-mode):not(.end-photo-mode) .storypane::after{display:none}
#modalLayer:not(.cat-dialog-mode):not(.end-photo-mode) #storyCandyTop{display:block}
#modalLayer:not(.cat-dialog-mode):not(.end-photo-mode) .speaker{
 height:auto;min-height:0;margin:0;
 color:#e8c794;font-size:12px;letter-spacing:.16em;text-align:center;
}
#modalLayer:not(.cat-dialog-mode):not(.end-photo-mode) .storytext{
 display:block;flex:1 1 auto;min-height:0;
 color:#f5ead7;text-shadow:none;
 font-size:clamp(24px,6.2vw,34px);line-height:1.72;
 padding:4px 0 2px;white-space:pre-line;text-align:center;
}
#modalLayer:not(.cat-dialog-mode):not(.end-photo-mode) .storyfoot{
 margin-top:0;min-height:22px;color:#d2c3ad;font-size:13px;
}
#modalLayer:not(.cat-dialog-mode):not(.end-photo-mode) .story-page-nav{
 display:none!important;
}
#modalLayer:not(.cat-dialog-mode):not(.end-photo-mode) .story-page-nav button,
#modalLayer:not(.cat-dialog-mode):not(.end-photo-mode) .story-understand{
 min-height:56px;font-size:clamp(20px,5vw,27px);
 }
#modalLayer:not(.cat-dialog-mode):not(.end-photo-mode) #storyBack,
#modalLayer:not(.cat-dialog-mode):not(.end-photo-mode) #storyIndexToggle{
 background:#102019;border-color:#ccb184;
}
#modalLayer:not(.cat-dialog-mode):not(.end-photo-mode) .skip{
 top:calc(env(safe-area-inset-top) + 8px);right:10px;
 font-size:12px;color:#eadcc4;min-height:44px;
}
#modalLayer:not(.cat-dialog-mode):not(.end-photo-mode) .story-index{
 max-height:22dvh;background:#0b1713;border:1px solid #ccb18466;border-radius:14px;padding:10px;
}
#modalLayer.intro-first-line .storypane{justify-content:center;padding-top:calc(env(safe-area-inset-top) + 18px);padding-bottom:calc(env(safe-area-inset-bottom) + 18px)}
#modalLayer.intro-first-line #storyCandyTop{margin-bottom:16px}
#modalLayer.intro-first-line .speaker{margin-bottom:10px;font-size:clamp(20px,5vw,26px);letter-spacing:.12em}
#modalLayer.intro-first-line .storytext{flex:0 0 auto;max-width:13em;align-self:center;padding:0}
#modalLayer.intro-first-line .storyfoot{position:absolute;left:18px;right:18px;bottom:calc(env(safe-area-inset-bottom) + 18px)}
#modalLayer.intro-first-line .skip{top:calc(env(safe-area-inset-top) + 8px)}
#modalLayer.intro-rule-mode .storytext{font-size:clamp(26px,6.7vw,39px);line-height:1.66}
#modalLayer.intro-rule-mode .storytext .rule-red{font-size:inherit;line-height:inherit}
@media (orientation:landscape){
 #modalLayer:not(.cat-dialog-mode):not(.end-photo-mode) .storypane{padding-left:24px;padding-right:24px}
 #modalLayer:not(.cat-dialog-mode):not(.end-photo-mode) .storytext{font-size:clamp(20px,2.6vw,30px)}
 #modalLayer.intro-rule-mode .storytext{font-size:clamp(22px,2.9vw,32px)}
}
@media (max-width:390px){
 #modalLayer:not(.cat-dialog-mode):not(.end-photo-mode) .storypane{padding-left:14px;padding-right:14px}
 #modalLayer:not(.cat-dialog-mode):not(.end-photo-mode) .storytext{font-size:clamp(22px,6vw,30px);line-height:1.65}
 #storyCandyTop{width:68px;height:40px}
}


#storyPageNav,#storyBack,#storyIndexToggle,.story-understand{display:none!important}
#modalLayer .storyfoot{justify-content:space-between}
#modalLayer.cat-dialog-mode .storytext{text-align:center}
#modalLayer.end-photo-mode .speaker,#modalLayer.end-photo-mode .storytext{text-align:center}

/* Pause menu priority: Back and END records are dominant, utilities smaller. */
#menuLayer .menupanel{gap:10px}
#menuLayer #resumeButton,#menuLayer #recordButton{
 width:100%;min-height:74px;padding:13px 16px;
 font-size:clamp(22px,5.8vw,27px);line-height:1.3;
 border:2px solid #f0d9b3;border-radius:17px;
 box-shadow:0 3px 12px #0007;
}
#menuLayer #resumeButton{background:#e9d0a7;color:#191b17;border-color:#fff0d0}
#menuLayer #recordButton{background:#1d493b;color:#fff4dc;border-color:#b7d9bc}
#menuLayer .pause-secondary-actions{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:9px}
#menuLayer .pause-secondary-actions button{
 width:100%;min-width:0;min-height:45px;padding:8px 5px;
 font-size:clamp(12px,3.25vw,15px);line-height:1.4;
 background:#15201ddc;color:#d9d2c4;border-color:#8b8b7770;
 border-radius:11px;
}
@media(max-height:560px){
 #menuLayer #resumeButton,#menuLayer #recordButton{min-height:60px;padding:8px 12px;font-size:clamp(19px,3vw,23px)}
 #menuLayer .pause-secondary-actions button{min-height:42px}
}

/* END result redesign: real generated card + short horror recap + inline run facts. */
#endResult{align-items:flex-end;justify-content:center;background:#020304}
#endResult .end-photo-stage img{filter:brightness(.66) saturate(.82)}
#endResult .end-photo-stage::after{background:linear-gradient(to bottom,rgba(0,0,0,.12),rgba(0,0,0,.25) 32%,rgba(0,0,0,.88) 72%,#000 100%)}
#endResult>.endpanel{
 position:relative;z-index:2;width:min(calc(100% - 20px),600px);max-width:600px;
 max-height:calc(100svh - 18px - env(safe-area-inset-bottom));
 overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;
 padding:16px 16px calc(13px + env(safe-area-inset-bottom));
 margin:0 0 6px;border:1px solid #c8ad7e95;border-radius:22px 22px 14px 14px;
 background:linear-gradient(150deg,rgba(9,14,14,.94),rgba(3,8,9,.97));
 box-shadow:0 -16px 45px #0008;
}
#endResult .endpanel .eyebrow{font-size:11px;letter-spacing:.22em;color:#d7b886}
#endResult .endpanel h1{font-size:clamp(25px,6.1vw,35px);line-height:1.3;margin:2px 0 14px;color:#f7e7cd}
#endResult .end-story-row{display:grid;grid-template-columns:130px minmax(0,1fr);gap:14px;align-items:stretch;text-align:left}
#endResult .end-card-preview{min-width:0;display:flex;flex-direction:column;align-items:center;gap:5px}
#endResult .end-subhead{font-size:11px;letter-spacing:.08em;color:#d5b786;font-weight:800;align-self:stretch}
#endResult .endpicture{display:block;width:100%;max-width:130px;height:auto;max-height:none;aspect-ratio:4/5;object-fit:contain;margin:0; border:1px solid #e1c18a9c;border-radius:6px;box-shadow:0 0 16px #0008;cursor:zoom-in}
#endResult .end-zoom-hint{font-size:10px;color:#b4aa99}
#endResult .end-story-content{min-width:0;display:flex;flex-direction:column;gap:9px}
#endResult .end-summary-text{color:#efe1d3;margin:0;font-size:clamp(14px,3.8vw,17px);font-weight:900;line-height:1.78;text-align:left;overflow-wrap:anywhere}
#endResult .end-run-receipt{margin-top:13px;border-top:1px solid #c7ae825a;border-bottom:1px solid #c7ae825a;padding:10px 0 11px}
#endResult .end-run-receipt h2{font-size:12px;letter-spacing:.1em;text-align:left;color:#d6bd93;margin:0 0 10px;font-weight:900}
#endResult .end-run-grid{margin:0;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px 5px}
#endResult .end-run-grid>div{display:flex;flex-direction:column;gap:3px;min-width:0}
#endResult .end-run-grid dt{font-size:10px;font-weight:700;color:#b6ab9a;line-height:1.25}
#endResult .end-run-grid dd{margin:0;font-size:clamp(14px,4vw,19px);font-weight:900;line-height:1.2;color:#f9e8c9;font-variant-numeric:tabular-nums;white-space:nowrap}
#endResult #endXButton{display:block;min-height:77px;margin:13px 0 0;
 background:#f2e3ca;color:#1a1916;border:3px solid #fffcf5;border-radius:17px;
 box-shadow:0 4px 0 #8e7560,0 10px 25px #000b;
 font-size:clamp(21px,6vw,28px);letter-spacing:.04em;font-weight:900}
#endResult #endXButton:active{background:#fff1d4;transform:translateY(2px);box-shadow:0 2px 0 #8e7560}
#endResult #endXButton:disabled{opacity:.78}
#endResult .end-result-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:13px}
#endResult .end-result-actions button{min-height:48px;font-size:clamp(16px,4.2vw,19px);border-radius:11px;padding:8px}
#endResult #retryButton{background:#1f342c;color:#faebd2;border-color:#8f9f85}
#endResult #endBookButton{background:#182b2d;color:#faebd2;border-color:#8f9f85}
#endResult #bonusButton{margin-top:12px;font-size:15px}
/* END cinematic: photograph and caption occupy separate areas, never overlap. */
#modalLayer.end-photo-mode{--end-dialog-h:min(222px,28svh);display:flex;align-items:flex-end;justify-content:center;padding:0;background:#060707}
#modalLayer.end-photo-mode .end-photo-stage{
 position:absolute;inset:0 0 calc(var(--end-dialog-h) + 11px + env(safe-area-inset-bottom));
 background:#070808;display:flex;align-items:center;justify-content:center;
}
#modalLayer.end-photo-mode .end-photo-stage img{width:100%;height:100%;object-fit:contain;object-position:center center}
#modalLayer.end-photo-mode .end-photo-stage::after{display:none}
#modalLayer.end-photo-mode .storypane{
 width:min(calc(100% - 14px),680px);max-width:680px;
 height:var(--end-dialog-h);min-height:var(--end-dialog-h);max-height:var(--end-dialog-h);
 margin:0 7px calc(7px + env(safe-area-inset-bottom));
 background:#0c1214ed;backdrop-filter:none;
}
/* All in-game dialogue is right-aligned; only the very first monologue is centered. */
#modalLayer:not(.intro-first-line) .storytext{text-align:left!important}
#modalLayer:not(.intro-first-line) .speaker{text-align:left!important}
#modalLayer.intro-first-line .storytext,#modalLayer.intro-first-line .speaker{text-align:center!important}
@media (max-height:560px) and (orientation:landscape){
 #modalLayer.end-photo-mode{--end-dialog-h:min(170px,47svh)}
 #modalLayer.end-photo-mode .storypane{height:var(--end-dialog-h);min-height:var(--end-dialog-h);max-height:var(--end-dialog-h)}
}
@media(max-width:380px){
 #endResult>.endpanel{padding:12px 13px calc(10px + env(safe-area-inset-bottom))}
 #endResult .end-story-row{grid-template-columns:112px minmax(0,1fr);gap:10px}
 #endResult .endpanel h1{margin-bottom:10px}
 #endResult .end-run-grid dd{font-size:14px}
}
@media (max-height:560px){
 #endResult #endXButton{position:sticky;bottom:0;z-index:3}
}

/* Encounter journal: END-only, preserves X sharing and the existing game UI. */
#endResult .end-encounters{margin:15px 0 0;padding:13px 0 0;border-top:1px solid #c7ae825a;text-align:left}
#endResult .end-encounter-heading{display:flex;align-items:baseline;justify-content:space-between;gap:8px;margin-bottom:10px}
#endResult .end-encounter-heading h2{margin:0;font-size:clamp(13px,3.5vw,17px);line-height:1.55;color:#f1d4a9;font-weight:900;letter-spacing:.02em}
#endResult .end-encounter-count{flex:none;font-size:12px;color:#ceb38e;font-variant-numeric:tabular-nums}
#endResult .end-encounter-list{display:grid;grid-template-columns:1fr;gap:8px}
#endResult .end-encounter-card{display:grid;grid-template-columns:76px minmax(0,1fr);gap:12px;align-items:center;min-width:0;padding:8px;border:1px solid #b59b744d;border-radius:12px;background:rgba(28,35,31,.75)}
#endResult .end-encounter-card img{width:76px;height:76px;object-fit:contain;display:block;border-radius:9px;background:radial-gradient(ellipse at center,#e3d3b933,#25312933);border:1px solid #b4a58830}
#endResult .end-encounter-copy{min-width:0}
#endResult .end-encounter-copy h3{margin:0 0 2px;font-size:clamp(16px,4.1vw,19px);line-height:1.35;color:#fff1db}
#endResult .end-encounter-role{margin:0 0 5px;color:#d5b786;font-size:11px;line-height:1.4}
#endResult .end-encounter-detail{margin:0;font-size:clamp(12px,3.35vw,14px);font-weight:800;line-height:1.55;color:#eee0c9;overflow-wrap:anywhere}
#endResult .end-encounter-empty{font-size:13px;line-height:1.7;color:#baa992;margin:6px 0 0}
@media(min-width:850px){#endResult .end-encounter-card{grid-template-columns:88px minmax(0,1fr)}#endResult .end-encounter-card img{width:88px;height:88px}}
@media(max-width:360px){#endResult .end-encounter-card{grid-template-columns:66px minmax(0,1fr);gap:9px}#endResult .end-encounter-card img{width:66px;height:66px}#endResult .end-encounter-heading h2{font-size:13px}}
/* The debug-only top bar sits above generic overlays; END presentations must stay in front. */
#endResult,#modalLayer.end-photo-mode{z-index:27}

/* Targeted readability and horror presentation. The first monologue alone remains centered. */
#modalLayer .storytext{white-space:pre-line;overflow-wrap:anywhere;word-break:normal}
#modalLayer.npc-horror .storytext{font-size:clamp(30px,8.4vw,48px)!important;font-weight:900;text-shadow:2px 2px 0 #7c081e,-2px 0 4px #000;line-height:1.5}
#modalLayer.npc-horror .storypane{animation:npc-shudder .12s steps(2) 5}
@keyframes npc-shudder{0%{transform:translateX(-3px)}50%{transform:translateX(4px)}100%{transform:translateX(0)}}
.horror-noise{position:fixed;inset:-6%;z-index:48;pointer-events:none;opacity:0;visibility:hidden;background:repeating-linear-gradient(0deg,#fff5 0px,#fff1 1px,#000d 2px,#0000 4px),repeating-linear-gradient(90deg,#f008 0px,#0000 3px,#0ff5 5px,#000a 8px),radial-gradient(circle at 50% 50%,#ff003320 0 18%,#0000 48%);mix-blend-mode:screen;filter:contrast(1.35) saturate(1.35)}
.horror-noise.on{visibility:visible;opacity:.88;animation:horror-static .06s steps(4) infinite, horror-jitter .18s steps(2) infinite}
.horror-noise.late{opacity:.58;background:repeating-linear-gradient(0deg,#f00a 0px,#0000 2px,#fffb 3px,#000a 5px),repeating-linear-gradient(90deg,#f006 0px,#0000 3px,#0ff3 5px,#0008 9px),radial-gradient(circle at 50% 50%,#ff003820 0 21%,#0000 52%)}
.horror-noise.hand{background:repeating-linear-gradient(0deg,#ffb3 0px,#0000 3px,#000a 5px),repeating-linear-gradient(90deg,#fff4 0px,#0000 2px,#f004 4px,#0008 8px),radial-gradient(circle at 50% 50%,#ffffff18 0 14%,#0000 48%)}
.horror-noise.foot{background:repeating-linear-gradient(0deg,#fff5 0px,#0000 2px,#000b 4px),repeating-linear-gradient(90deg,#7fd1ff55 0px,#0000 4px,#fff2 6px,#0008 10px),radial-gradient(circle at 50% 50%,#66c7ff20 0 16%,#0000 54%)}
.horror-noise.eye{background:repeating-linear-gradient(0deg,#ff003a48 0px,#0000 2px,#fff5 3px,#000b 5px),repeating-linear-gradient(90deg,#ffec 0px,#0000 2px,#f005 4px,#0009 9px),radial-gradient(circle at 50% 50%,#ff002240 0 22%,#0000 56%)}
@keyframes horror-static{0%{background-position:0 0,0 0;transform:translateX(-3px)}33%{background-position:6px 9px,15px -8px;transform:translateX(2px)}66%{background-position:-7px -6px,-3px 12px;transform:translateX(-2px)}100%{background-position:0 13px,15px 0;transform:translateX(0)}}
#runRuleBanner{position:fixed;inset:0;z-index:30;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:18px;padding:calc(env(safe-area-inset-top) + 24px) 24px calc(env(safe-area-inset-bottom) + 24px);background:radial-gradient(ellipse at center,rgba(75,17,16,.52) 0%,rgba(24,8,8,.18) 42%,rgba(2,4,3,.05) 72%,rgba(0,0,0,0) 100%);text-align:center;color:#fff1da;pointer-events:none}
#runRuleBanner.hidden{display:none}
#runRuleBanner .big-rule{font-family:'Hiragino Mincho ProN','Yu Mincho',serif;font-size:clamp(28px,8vw,56px);font-weight:900;line-height:1.48;text-shadow:0 2px 18px #b80f08,0 0 28px #6c0f0a;text-wrap:balance;background:rgba(4,10,8,.28);padding:16px 18px;border-radius:24px;backdrop-filter:blur(1.5px)}
#runRuleBanner strong{color:#ff7770;font-size:1.35em}
#runRuleBanner .rule-note{color:#f0d8c7;font-size:clamp(13px,3.5vw,18px);background:rgba(4,10,8,.22);padding:8px 12px;border-radius:999px}
#recordsLayer .character-encyclopedia{margin:20px 0 16px;padding-top:13px;border-top:1px solid #ffffff22}
#recordsLayer .character-encyclopedia h3{font-size:clamp(16px,4.6vw,21px);color:#f1d4a9;margin:0 0 12px;line-height:1.5}
#recordsLayer .character-encyclopedia .character-counter{float:right;font-size:13px;color:#c7b096}
#recordsLayer .encyclopedia-list{display:grid;grid-template-columns:1fr;gap:9px}
#recordsLayer .encyclopedia-item{display:grid;grid-template-columns:78px minmax(0,1fr);gap:12px;align-items:center;border:1px solid #ffffff24;border-radius:10px;padding:8px;background:#15201be8;min-width:0}
#recordsLayer .encyclopedia-picture{width:78px;height:84px;background:#304039;border-radius:8px;display:flex;align-items:center;justify-content:center;color:#e2d1bc;font-weight:900;font-size:19px;overflow:hidden}
#recordsLayer .encyclopedia-picture img{width:100%;height:100%;object-fit:contain}
#recordsLayer .encyclopedia-item h3{color:#fff1df;font-size:16px;margin:0 0 5px}
#recordsLayer .encyclopedia-item p{font-size:12px;color:#d6c8b1;line-height:1.6;margin:0;overflow-wrap:anywhere}
#recordsLayer .encyclopedia-item.unknown{filter:saturate(.25)}

/* Dialogue: explicit newlines remain in the SAME panel, including END photographs. */
#modalLayer .storytext{white-space:pre-wrap;overflow-wrap:anywhere;line-break:strict}
#modalLayer.end-photo-mode .storypane{--end-dialog-h:min(300px,39svh)}
#modalLayer.end-photo-mode .storytext{white-space:pre-wrap!important;overflow-y:auto;-webkit-overflow-scrolling:touch}
/* Subtle pursuit atmosphere; never flash the entire display continuously. */
body.final-chase #vignette{animation:late-danger-vignette 2.8s ease-in-out infinite}
@keyframes late-danger-vignette{0%,100%{box-shadow:inset 0 0 65px 9px rgba(125,8,17,.18)}50%{box-shadow:inset 0 0 96px 25px rgba(165,10,22,.36)}}
@media (prefers-reduced-motion:reduce){body.final-chase #vignette{animation:none;box-shadow:inset 0 0 55px rgba(110,10,18,.25)}}

/* END cinematic: edge-to-edge photographs, compact legible dialogue anchored to the bottom.
   The picture is never shrunk into a separate box; safe character faces stay above the text. */
#modalLayer.end-photo-mode{background:#080b09;align-items:flex-end;justify-content:center;padding:0}
#modalLayer.end-photo-mode #endPhotoStage{
 position:absolute;inset:0!important;width:100%;height:100%;z-index:0;
 display:block;overflow:hidden;background:#090b0a;
}
#modalLayer.end-photo-mode #endPhotoStage img{
 width:100%;height:100%;object-fit:cover!important;
 object-position:var(--end-photo-pos,center 43%)!important;display:block;
 transform:scale(var(--end-photo-scale,1));transform-origin:center center;
 transition:transform .65s ease,object-position .65s ease,filter .35s ease;
 filter:brightness(var(--end-photo-bright,1));
}
#modalLayer.end-photo-mode #endPhotoStage::after{
 content:"";position:absolute;inset:0;display:block;
 background:linear-gradient(180deg,transparent 52%,rgba(0,0,0,.02) 70%,rgba(0,0,0,.30) 100%);
}
#modalLayer.end-photo-mode .storypane{
 position:relative;z-index:2;
 width:min(calc(100% - 18px),680px);max-width:680px;
 height:auto!important;min-height:0!important;max-height:min(36svh,262px)!important;
 margin:0 9px calc(8px + env(safe-area-inset-bottom));
 padding:10px 14px 9px;gap:3px;
 border:1px solid rgba(225,202,160,.68);border-radius:14px;
 background:linear-gradient(140deg,rgba(7,16,16,.87),rgba(4,9,11,.90));
 box-shadow:0 4px 26px rgba(0,0,0,.45);backdrop-filter:blur(2px);
 display:flex;flex-direction:column;justify-content:flex-start;overflow:hidden;
}
#modalLayer.end-photo-mode .speaker{
 height:auto;min-height:0;margin:0 0 2px;
 font-size:clamp(14px,3.7vw,17px);line-height:1.35;font-weight:900;
}
#modalLayer.end-photo-mode .storypane .storytext{
 flex:0 1 auto;min-height:0;max-height:calc(min(36svh,262px) - 68px);
 font-size:clamp(24px,6.7vw,32px)!important;
 font-weight:900;line-height:1.36;letter-spacing:0;
 padding:0;margin:0;overflow-y:auto;
 text-align:left!important;white-space:pre-wrap!important;
 touch-action:pan-y;overscroll-behavior:contain;
}
#modalLayer.end-photo-mode .storyfoot{
 flex:0 0 auto;min-height:19px;margin:2px 0 0;
 font-size:clamp(12px,3vw,14px);line-height:1.45;
}
#modalLayer.end-photo-mode .storypane::before,#modalLayer.end-photo-mode .storypane::after{display:none}
@media(orientation:landscape) and (max-height:600px){
 #modalLayer.end-photo-mode .storypane{max-height:48svh!important;padding:6px 12px}
 #modalLayer.end-photo-mode .storypane .storytext{font-size:clamp(18px,2.5vw,24px)!important;max-height:calc(48svh - 48px)}
}

/* All-END collection becomes visible before the bonus text auto-opens. */
#endResult #bonusButton.just-unlocked{background:#f8e0ae;color:#1c1b19;border:2px solid #fff0bc;animation:end-unlock-glow 1.15s ease-in-out infinite alternate}
@keyframes end-unlock-glow{from{box-shadow:0 0 8px rgba(250,203,113,.35)}to{box-shadow:0 0 25px rgba(250,203,113,.75)}}
@media(prefers-reduced-motion:reduce){#endResult #bonusButton.just-unlocked{animation:none}}


#spottedAlert{background:linear-gradient(180deg,rgba(20,0,0,.30),rgba(0,0,0,.05));padding:14px 22px;border-radius:18px;backdrop-filter:blur(1px)}
#spottedAlert.emergency{font-size:clamp(34px,10.8vw,76px);line-height:1.06;letter-spacing:.02em;text-shadow:0 3px 2px #210000,0 0 12px #000,0 0 25px #c00000,0 0 40px #ff1111;animation:spotted-pulse .11s steps(2) 10}
@keyframes spotted-pulse{0%{transform:translate(-50%,-50%) scale(.97)}50%{transform:translate(-50%,-50%) scale(1.04)}100%{transform:translate(-50%,-50%) scale(1)}}
.panic-words{position:fixed;inset:0;z-index:49;pointer-events:none;display:grid;place-items:center;padding:8vh 6vw;opacity:0;visibility:hidden;transition:opacity .12s ease;overflow:hidden}
.panic-words.on{visibility:visible;opacity:1}
.panic-words .panic-grid{position:absolute;inset:-8%;display:grid;grid-template-columns:repeat(3,1fr);gap:1.2vh 2.2vw;align-content:center;justify-items:center;transform:rotate(-9deg)}
.panic-words .panic-grid span{font-size:clamp(28px,7vw,82px);font-weight:900;letter-spacing:.12em;line-height:1;color:rgba(255,40,40,.88);text-shadow:0 0 10px rgba(0,0,0,.72),0 0 26px rgba(255,255,255,.22)}
.panic-words .panic-center{position:relative;text-align:center;font-size:clamp(34px,9vw,104px);font-weight:900;letter-spacing:.08em;line-height:1.08;color:#fff;text-shadow:0 0 10px rgba(0,0,0,.82),0 0 24px rgba(255,50,50,.55)}
.panic-words.danger .panic-center{color:#ffe9e9}
.panic-words.warning .panic-center{color:#fff6d6}
@keyframes horror-jitter{0%{transform:translate(0,0)}25%{transform:translate(-1.4%,.8%)}50%{transform:translate(1.6%,-.9%)}75%{transform:translate(-.8%,-1.1%)}100%{transform:translate(0,0)}}
.horror-noise.blast{opacity:.92;background:repeating-linear-gradient(0deg,#fff7 0px,#ff001828 1px,#000b 2px,#0000 4px),repeating-linear-gradient(90deg,#f006 0px,#0000 4px,#0ff4 6px,#0008 11px);animation:horror-static .055s steps(4) infinite}
#modalLayer.end-photo-mode #endPhotoStage.grave-zoom img{filter:brightness(.95) contrast(1.05)}
#modalLayer.end-photo-mode #endPhotoStage.grave-zoom-strong img{filter:brightness(.92) contrast(1.08)}
#modalLayer.end-photo-mode #endPhotoStage.end-shudder{animation:end-shudder .10s steps(2) 6}
@keyframes end-shudder{0%{transform:translateX(-4px)}50%{transform:translateX(5px)}100%{transform:translateX(0)}}

/* QA71: emergency text is readable even with the noise layer active. */
#spottedAlert.emergency{z-index:51;white-space:pre-line;overflow-wrap:anywhere;word-break:break-word;max-width:calc(100vw - 20px);width:calc(100vw - 20px);font-size:clamp(28px,7.9vw,56px);line-height:1.22;text-align:center}
/* Preserve the large original font for most pages; give unusually long lines more room only if needed. */
#modalLayer.end-photo-mode .storypane.long-dialogue{max-height:min(44svh,320px)!important}
#modalLayer.end-photo-mode .storypane.long-dialogue .storytext{max-height:calc(min(44svh,320px) - 65px)}

/* QA71: keep the first-sighting scream legible over the green maze and static. */
#spottedAlert.emergency{background:rgba(13,0,3,.78);border:2px solid rgba(250,74,74,.72);color:#ff5959;box-shadow:0 0 28px rgba(0,0,0,.85),inset 0 0 25px rgba(110,0,0,.46);text-shadow:0 2px 2px #000,0 0 6px #000,0 0 18px rgba(255,30,42,.88)}

/* Targeted touch & readability refinements; no palette or layout replacement. */
#topbar .smallbtn{min-width:48px;min-height:48px;white-space:nowrap}
#countdown{font-variant-numeric:tabular-nums;font-feature-settings:"tnum" 1;font-size:clamp(15px,4.0vw,19px);min-width:186px;max-width:calc(100vw - 28px)}
#interact .action{min-height:58px;min-width:156px}
#dropButton{min-height:78px;min-width:91px}
#modalLayer.end-photo-mode .storypane{padding-bottom:calc(9px + max(0px,env(safe-area-inset-bottom) - 6px))}
@media(max-width:360px){#topbar{gap:4px;padding-left:8px;padding-right:8px}.topright{gap:5px}#topbar .smallbtn{padding:8px;min-width:45px}}
/* First narration is vertically centered; page footer remains docked at bottom. */
#modalLayer.intro-first-line:not(.cat-dialog-mode):not(.end-photo-mode) .storypane{justify-content:center!important}
#modalLayer.intro-first-line:not(.cat-dialog-mode):not(.end-photo-mode) .storytext{flex:0 0 auto!important;min-height:0!important;align-self:center;padding:0!important}
#modalLayer.intro-first-line:not(.cat-dialog-mode):not(.end-photo-mode) #storyCandyTop{margin-bottom:0}
#modalLayer.intro-first-line:not(.cat-dialog-mode):not(.end-photo-mode) .speaker{font-size:clamp(18px,4.8vw,24px);margin-bottom:8px}

/* 74: organized, tap-friendly developer tabs. Production HUD remains untouched. */
.debug-panel{padding:12px;gap:3px}
.debug-panel .debugtabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));align-items:stretch;gap:6px;overflow-y:auto;overflow-x:hidden;max-height:min(28dvh,192px);padding:8px 2px 12px;flex:none;border-bottom:1px solid #52665e}
.debug-panel .debugtabs button{min-width:0;max-width:100%;min-height:43px;font-size:12px;white-space:normal;text-align:center;line-height:1.3;padding:7px 3px}
.debug-panel .debugcontent{padding:8px 4px 20px;line-height:1.65}
.debug-panel .debugcontent .dbgitem{border:1px solid #3a5c50;background:rgba(19,36,31,.62);border-radius:10px;padding:12px;gap:9px;margin:8px 0}
.debug-panel .debugcontent .dbgitem strong{color:#f6dcab;font-size:14px}
.debug-panel .debugcontent .dbgrow{gap:8px;margin:12px 0}
.debug-panel .debugcontent button{min-height:44px;white-space:normal;line-height:1.4}
.debug-panel .rowhead b{font-size:15px}
@media(min-width:700px){.debug-panel .debugtabs{grid-template-columns:repeat(6,minmax(0,1fr));max-height:130px}.debug-panel{max-width:1100px;margin:auto}}


/* 76: All five opening-monologue pages are centered. Other dialogues retain their alignment. */
#modalLayer.intro-rule-mode:not(.cat-dialog-mode):not(.end-photo-mode) .storypane{
  justify-content:center!important;
}
#modalLayer.intro-rule-mode:not(.cat-dialog-mode):not(.end-photo-mode) .storytext{
  flex:0 0 auto!important;
  min-height:0!important;
  width:100%;
  text-align:center!important;
  text-wrap:balance;
  align-self:center;
}
#modalLayer.intro-rule-mode:not(.cat-dialog-mode):not(.end-photo-mode) .speaker{
  text-align:center!important;
}
#modalLayer.intro-rule-mode:not(.cat-dialog-mode):not(.end-photo-mode) .storyfoot{
  position:absolute;
  left:18px;
  right:18px;
  bottom:calc(env(safe-area-inset-bottom) + 18px);
}
/* Keep the last opening page's final sentence from ending with a single orphan glyph. */
#modalLayer.intro-rule-mode:not(.intro-first-line) .storytext:not(.notice){max-width:12.5em}

/* 78: All dialogue windows have fixed geometry. Overflow creates a TAP subpage,
   never a taller window, smaller font, or an inner scroll area. */
#modalLayer:not(.end-photo-mode) .storypane{overflow:hidden!important}
#modalLayer:not(.end-photo-mode):not(.intro-rule-mode):not(.cat-dialog-mode) .storypane{
 height:min(460px,calc(100dvh - 34px - env(safe-area-inset-top) - env(safe-area-inset-bottom)))!important;
 max-height:90dvh!important;min-height:0!important;
}
#modalLayer.cat-dialog-mode .storypane{height:min(44dvh,365px)!important;min-height:0!important;max-height:60dvh!important}
#modalLayer.intro-rule-mode .storypane{
 height:min(490px,calc(100dvh - 36px - env(safe-area-inset-top) - env(safe-area-inset-bottom)))!important;
 min-height:0!important;max-height:94dvh!important;
}
#modalLayer.end-photo-mode .storypane,
#modalLayer.end-photo-mode .storypane.long-dialogue{
 height:min(36svh,262px)!important;min-height:0!important;max-height:min(36svh,262px)!important;
}
#modalLayer .storypane .storytext,
#modalLayer.end-photo-mode .storypane .storytext{
 overflow:hidden!important;overflow-y:hidden!important;overflow-x:hidden!important;
 touch-action:manipulation!important;max-height:none!important;min-height:0!important;
 flex:1 1 0%!important;
}
#modalLayer.intro-rule-mode .storypane .storytext{flex:0 1 auto!important}
#modalLayer.end-photo-mode .storypane .storytext{flex:1 1 0%!important}
#modalLayer .storypane{gap:10px}
#modalLayer.end-photo-mode .storypane{gap:3px}
#modalLayer.intro-rule-mode .storypane{gap:11px}
#modalLayer.cat-dialog-mode .storypane{gap:6px}
@media(prefers-reduced-motion:reduce){.panic-words.on{transition:none}}
/* Balanced END lines avoid isolated final kana without changing font size. */
#modalLayer.end-photo-mode .storytext{text-wrap:balance}
/* Intro pages also constrain the text itself, even for arbitrarily long lines.
   The inner wrapper centers short pages without permitting long content to grow the pane. */
#modalLayer.intro-rule-mode:not(.cat-dialog-mode):not(.end-photo-mode) .storypane .storytext{
 flex:1 1 0%!important;display:flex!important;align-items:center;justify-content:center;
 min-height:0!important;max-height:none!important;overflow:hidden!important;
}
#modalLayer.intro-rule-mode .storytext .story-lines{
 display:block;width:100%;min-width:0;flex:0 1 auto;max-width:100%;
 white-space:pre-line;line-height:inherit;overflow-wrap:anywhere;text-align:center;
}

/* Ver80: five clearly differentiated horror-screen effects. None captures touches. */
#terrorTint,#terrorRGB{position:fixed;inset:0;pointer-events:none;visibility:hidden;opacity:0;z-index:42;contain:paint;}
#terrorTint{background:radial-gradient(ellipse at center,rgba(215,0,7,.56) 0%,rgba(170,0,5,.81) 57%,rgba(61,0,3,.94) 100%);mix-blend-mode:screen;}
#terrorTint.on{visibility:visible;opacity:1;animation:terror-red-flood .78s ease-out both;}
#terrorRGB{z-index:43;background:repeating-linear-gradient(90deg,rgba(255,3,56,.24) 0 3px,transparent 4px 10px,rgba(0,243,249,.20) 12px 15px,transparent 18px 25px),repeating-linear-gradient(0deg,rgba(255,255,255,.20) 0 1px,transparent 2px 6px);mix-blend-mode:screen;}
#terrorRGB.on{visibility:visible;opacity:.85;animation:terror-rgb-overlay .12s steps(3) infinite;}
/* RGB separation uses contrasting ghost outlines + independent shifting color bands. */
body.terror-rgb #scene,body.terror-rgb #endPhotoStage img,body.terror-rgb #endResultPhoto img{animation:terror-chromatic .11s steps(2) infinite;}
/* Physical frame warping is restricted to imagery, so tappable controls stay still. */
body.terror-warp #scene,body.terror-warp #endPhotoStage img{animation:terror-warping .34s ease-in-out infinite;transform-origin:50% 50%;}
body.terror-warp.terror-rgb #scene,body.terror-warp.terror-rgb #endPhotoStage img{animation:terror-combined .17s steps(3) infinite;}
.panic-words.on .panic-grid{animation:terror-word-surge .35s steps(3) infinite;}
.panic-words.on .panic-center{animation:terror-word-lurch .24s steps(2) infinite;}
.panic-words .panic-grid span:nth-child(3n+2){color:#fff5ec;transform:rotate(13deg) scale(.9)}
.panic-words .panic-grid span:nth-child(4n){color:#ff1f34;transform:rotate(-11deg) scale(1.26)}
@keyframes terror-red-flood{0%{opacity:0;filter:brightness(2)}24%{opacity:1}66%{opacity:.93}100%{opacity:.7}}
@keyframes terror-rgb-overlay{0%{transform:translate(-5px,0);background-position:0 0,0 0}50%{transform:translate(7px,-1px);background-position:16px 4px,0 2px}100%{transform:translate(-3px,2px);background-position:-8px -3px,0 -2px}}
@keyframes terror-chromatic{0%{filter:drop-shadow(6px 0 rgba(255,0,43,.9)) drop-shadow(-6px 0 rgba(0,245,255,.9)) saturate(1.8) contrast(1.16);transform:translateX(-3px)}50%{filter:drop-shadow(9px 0 rgba(255,0,43,.9)) drop-shadow(-8px 0 rgba(0,245,255,.9)) saturate(2.1);transform:translateX(3px)}100%{filter:drop-shadow(4px 0 rgba(255,0,43,.9)) drop-shadow(-4px 0 rgba(0,245,255,.9));transform:translateX(0)}}
@keyframes terror-warping{0%{transform:scale(1.04,1.015) skewX(-1.2deg) translateX(-1%)}30%{transform:scale(1.11,.965) skewX(2.7deg) translateX(1.4%)}65%{transform:scale(.99,1.065) skewY(-1.2deg)}100%{transform:scale(1.045,1.01) skewX(-1.1deg)}}
@keyframes terror-combined{0%{transform:scale(1.05,1.015) skewX(-2.5deg) translateX(-1%);filter:drop-shadow(7px 0 #f03) drop-shadow(-6px 0 #00eafc)}50%{transform:scale(1.08,.95) skewX(2.5deg) translateX(1%);filter:drop-shadow(10px 0 #f03) drop-shadow(-9px 0 #00eafc)}100%{transform:scale(1.04,1.025) skewY(-1.3deg);filter:drop-shadow(4px 0 #f03) drop-shadow(-5px 0 #00eafc)}}
@keyframes terror-word-surge{0%{transform:rotate(-9deg) scale(1)}50%{transform:rotate(-7deg) scale(1.12) translateX(1.2%)}100%{transform:rotate(-10deg) scale(1.03) translateX(-1.3%)}}
@keyframes terror-word-lurch{0%{transform:translateX(-2px) scale(1)}50%{transform:translateX(4px) scale(1.055)}100%{transform:translateX(-3px) scale(.99)}}
/* Keep dialogue panel stationary and its text readable during END photomontage. */
#modalLayer.end-photo-mode.terror-passage .storypane{position:relative;z-index:2}
@media(prefers-reduced-motion:reduce){
 #terrorRGB.on{animation:none;opacity:.45}
 #terrorTint.on{animation:none;opacity:.65}
 body.terror-rgb #scene,body.terror-rgb #endPhotoStage img,
 body.terror-warp #scene,body.terror-warp #endPhotoStage img,
 body.terror-warp.terror-rgb #scene,body.terror-warp.terror-rgb #endPhotoStage img{animation:none!important}
 .panic-words.on .panic-center,.panic-words.on .panic-grid{animation:none!important}
 .horror-noise.on{animation:none!important;opacity:.48}
}
/* 81: developer-only exhaustive audio preview gallery. Never changes gameplay HUD. */
.debug-panel .debug-audio-status{position:sticky;top:0;z-index:2;margin:8px 1px;padding:10px 12px;border:1px solid #6f8d83;border-radius:8px;background:#10251f;color:#f4e3be;font-size:14px;font-weight:800;overflow-wrap:anywhere}
.debug-panel .debugcontent .dbgitem span{overflow-wrap:anywhere;word-break:break-word}
.debug-panel .debugcontent .debug-end-sequence>summary{font-size:14px;font-weight:800;line-height:1.45;padding:8px 4px}

.debug-panel .debugcontent .dbgitem .debug-audio-file{font-size:11px;letter-spacing:0;line-height:1.4;color:#b4d3c6;overflow-wrap:anywhere;word-break:break-word}

/* v92: only the rabbit encounter shows its existing live 3D character above
   the subtitles. Other dialogues retain their exact fullscreen appearance. */
#modalLayer.npc-rabbit-view:not(.cat-dialog-mode):not(.end-photo-mode){
 background:transparent;align-items:flex-end;justify-content:center;
 padding:0 8px calc(8px + env(safe-area-inset-bottom));
}
#modalLayer.npc-rabbit-view:not(.cat-dialog-mode):not(.end-photo-mode) .storypane{
 position:relative;z-index:2;
 width:min(100%,600px);max-width:600px;
 height:min(245px,40dvh)!important;min-height:min(245px,40dvh)!important;max-height:min(245px,40dvh)!important;
 margin:0;padding:12px 16px;gap:4px;justify-content:flex-start;
 border:1px solid rgba(221,191,145,.8);border-radius:14px;
 background:rgba(7,17,13,.96);box-shadow:0 4px 24px rgba(0,0,0,.7);
}
#modalLayer.npc-rabbit-view #storyCandyTop{display:none}
#modalLayer.npc-rabbit-view .storytext{flex:1 1 auto;overflow-y:auto}
@media(max-height:560px) and (orientation:landscape){
 #modalLayer.npc-rabbit-view:not(.cat-dialog-mode):not(.end-photo-mode) .storypane{
  height:49dvh!important;min-height:49dvh!important;max-height:49dvh!important;padding:7px 12px;
 }
}

/* Happiness rabbit: only the temporary wrong-answer cold visual effect. */
body.happy-cold #vignette::before{content:'';position:absolute;inset:0;pointer-events:none;background:radial-gradient(ellipse at center,transparent 45%,rgba(100,200,255,.64) 96%);opacity:.9;}
#modalLayer.happy-story-cold:not(.end-photo-mode){background:#001a62;}
#modalLayer.happy-story-cold:not(.end-photo-mode) .storypane{background:#001a62;}
#happyBunnyChoices{width:100%;display:grid;gap:12px;margin-bottom:12px;flex:none;}
#happyBunnyChoices button{min-height:58px;background:#e4cdac;color:#18181a;border:2px solid #fff2da;font-size:clamp(17px,4.8vw,24px);}

/* Happiness rabbit only: lightweight frozen-view layer. Hidden unless the wrong answer is chosen. */
#happyColdFX{position:fixed;inset:0;z-index:4;pointer-events:none;overflow:hidden;opacity:0;visibility:hidden;transition:opacity .65s ease,visibility 0s linear .65s;contain:layout paint}
body.happy-cold #happyColdFX{opacity:1;visibility:visible;background:rgba(12,65,197,.27);transition:opacity .18s ease,visibility 0s}
#happyColdFX span{position:absolute;pointer-events:none}
#happyColdFX .cold-frost{inset:0;background:radial-gradient(ellipse 45% 34% at 0 0,rgba(229,252,255,.83),transparent 96%),radial-gradient(ellipse 40% 32% at 100% 0,rgba(218,250,255,.73),transparent 98%),radial-gradient(ellipse 50% 39% at 0 100%,rgba(238,254,255,.71),transparent 97%),radial-gradient(ellipse 48% 34% at 100% 100%,rgba(235,250,255,.75),transparent 96%),repeating-linear-gradient(113deg,transparent 0 27px,rgba(236,251,255,.22) 28px,transparent 30px,transparent 69px);-webkit-mask-image:radial-gradient(ellipse at center,transparent 34%,#000 100%);mask-image:radial-gradient(ellipse at center,transparent 34%,#000 100%);animation:happy-frost-grow 2.1s ease-out both}
#happyColdFX .cold-drift{inset:-20%;opacity:.63;background-image:radial-gradient(circle at 16% 22%,rgba(234,254,255,.9) 0 1.3px,transparent 2.7px),radial-gradient(circle at 75% 38%,rgba(208,239,255,.8) 0 1.4px,transparent 2.8px),radial-gradient(circle at 33% 70%,rgba(234,253,255,.8) 0 1.2px,transparent 2.5px),radial-gradient(circle at 89% 86%,rgba(237,252,255,.75) 0 1.4px,transparent 2.8px);background-size:94px 110px,145px 123px,120px 190px,204px 160px;animation:happy-cold-drift 7s linear infinite}
#happyColdFX .cold-breath{bottom:17%;left:50%;width:110px;height:44px;margin-left:-55px;border-radius:50%;background:radial-gradient(ellipse,rgba(245,254,255,.72) 0%,rgba(220,248,255,.32) 48%,transparent 76%);filter:blur(6px);animation:happy-breath 3.15s ease-in-out infinite}
@keyframes happy-frost-grow{from{opacity:.15;transform:scale(1.22)}to{opacity:.95;transform:scale(1)}}
@keyframes happy-cold-drift{from{transform:translate3d(-4%,6%,0)}to{transform:translate3d(6%,-6%,0)}}
@keyframes happy-breath{0%,100%{opacity:0;transform:translate3d(0,12px,0) scale(.45)}30%{opacity:.72;transform:translate3d(0,-8px,0) scale(1)}80%{opacity:.12;transform:translate3d(0,-32px,0) scale(1.45)}}
#modalLayer.happy-story-cold:not(.end-photo-mode)::after{content:'';position:absolute;inset:0;z-index:0;pointer-events:none;box-shadow:inset 0 0 85px 22px rgba(199,244,255,.48);background:radial-gradient(circle at 18% 24%,rgba(223,249,255,.16) 0 1px,transparent 3px);background-size:67px 88px;opacity:.8}
#modalLayer.happy-story-cold .storypane{z-index:1}
body.happy-cold-shock #happyColdFX::after{content:'';position:absolute;inset:0;background:#000;pointer-events:none;animation:happy-cold-blackout .66s steps(1,end) both}
@keyframes happy-cold-blackout{0%{opacity:1}34%{opacity:1}35%{opacity:0}70%{opacity:.75}71%,100%{opacity:0}}
#happyCandyBurst{position:fixed;inset:0;z-index:25;pointer-events:none;overflow:hidden}
#happyCandyBurst img{position:absolute;top:43%;left:50%;width:clamp(25px,7vw,49px);height:auto;filter:drop-shadow(0 3px 4px #000c);animation:happy-candy-fall 1.35s ease-in forwards;animation-delay:var(--delay);opacity:0;transform-origin:center}
@keyframes happy-candy-fall{0%{opacity:0;transform:translate3d(-50%,-70px,0) scale(.5) rotate(0deg)}9%{opacity:1}40%{opacity:1}85%{opacity:1}100%{opacity:0;transform:translate3d(calc(-50% + var(--dx)),var(--dy),0) scale(.68) rotate(var(--rotate))}}
@media(prefers-reduced-motion:reduce){#happyColdFX .cold-drift,#happyColdFX .cold-breath,#happyColdFX .cold-frost{animation:none}#happyCandyBurst img{animation-duration:.2s}}
/* During the instant freeze, briefly black out the dialogue as well as the maze. */
body.happy-cold-shock #modalLayer.happy-story-cold::before{content:'';position:absolute;inset:0;z-index:3;pointer-events:none;background:#000;animation:happy-cold-blackout .66s steps(1,end) both}
