:root{--ink:#fdf2fb;--navy:#25264a;--deep:#18172f;--pink:#ff93cf;--pink2:#ffc8e9;--line:#ffc7e7;--serif:"Noto Serif CJK JP","Yu Mincho","Hiragino Mincho ProN","MS PMincho",serif;--sans:"Noto Sans CJK JP","Hiragino Kaku Gothic ProN",sans-serif}
*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;overflow:hidden;overscroll-behavior:none;background:#141021;color:var(--ink);font-family:var(--serif);-webkit-text-size-adjust:100%}button,textarea{font:inherit}button{cursor:pointer;-webkit-tap-highlight-color:transparent}button:focus-visible,[tabindex]:focus-visible{outline:3px solid #fff;outline-offset:3px}[hidden]{display:none!important}
body{background:radial-gradient(ellipse at 50% 40%,#3b315e,#10101a 80%)}
.shell{position:relative;display:flex;flex-direction:column;isolation:isolate;width:100%;max-width:520px;margin:0 auto;height:100vh;height:100dvh;min-height:0;padding-top:env(safe-area-inset-top,0px);padding-bottom:env(safe-area-inset-bottom,0px);overflow:hidden;background:#29213f;border-left:2px solid #ff99c8;border-right:2px solid #ff99c8;box-shadow:0 0 50px #0009}
.topbar{display:flex;align-items:center;gap:5px;justify-content:space-between;flex:0 0 52px;height:52px;padding:5px 9px;background:linear-gradient(180deg,#57548d,#303565 84%,#212747);border-bottom:3px solid #ecc1e7;box-shadow:0 2px 8px #14112b66;z-index:3;font-family:var(--sans)}
.topmini{display:flex;align-items:center;gap:5px;font-weight:900;white-space:nowrap;font-size:clamp(11px,3vw,13px);letter-spacing:-.04em}.heartmark{font-size:18px;color:#ffb6d9}.topsep{opacity:.35}.topactions{display:flex;gap:4px}.mini-btn{min-width:52px;min-height:37px;padding:3px 6px;background:linear-gradient(#fff8,#d8c2e866);border:2px solid #f7c9ed;border-radius:6px;color:#fff;font-size:12px;font-weight:900;box-shadow:0 2px 0 #1a1549}
.scene{position:relative;flex:1 1 auto;min-height:130px;overflow:hidden;background:linear-gradient(180deg,#c4afca 0%,#c9abc3 65%,#a886a2 100%);transition:filter .4s}
.scene-glow{position:absolute;inset:0}.scene-glow{background:radial-gradient(ellipse 76% 75% at 55% 80%,#fff7ff3b,transparent 75%),linear-gradient(180deg,transparent 60%,#2c193455)}
.hero-image{position:absolute;left:50%;top:44%;width:min(104%,540px);height:110%;object-fit:contain;transform:translate(-50%,-44%);filter:drop-shadow(1px 12px 10px #23152966);pointer-events:none;user-select:none;transition:opacity .16s,filter .4s}.scene.uneasy .hero-image{filter:saturate(.8) brightness(.87) drop-shadow(1px 12px 10px #161126aa)}.scene.danger .hero-image{filter:saturate(.65) brightness(.74) drop-shadow(1px 12px 13px #111329aa)}.scene-ribbon{position:absolute;top:12px;right:10px;z-index:2;padding:7px 11px;border-radius:6px;background:#4e2559dd;border:2px solid #ffb9db;font:900 12px var(--sans);box-shadow:0 2px 8px #0e0d28aa}.scene-ribbon.safe{background:#315a74e8;border-color:#d8e9ff}.scene-ribbon.danger{background:#711b36;border-color:#ffd2db;animation:pulse .7s infinite alternate}.scene-tip{position:absolute;bottom:8px;left:10px;right:10px;border:1px solid #ffe5f5;background:#221d3ac9;padding:7px 8px;font-size:clamp(12px,3.1vw,14px);font-weight:900;text-align:center;z-index:2;line-height:1.25}
.food-zone{flex:0 0 clamp(137px,22dvh,188px);height:clamp(137px,22dvh,188px);position:relative;z-index:2;border-top:5px solid #eec8e2;border-bottom:3px solid #eec8e2;background:linear-gradient(110deg,#886382,#c994a3 45%,#8a6184);box-shadow:inset 0 9px 20px #4b31535e}
.food-zone-header{height:33px;padding:3px 12px;display:flex;justify-content:space-between;align-items:center;gap:4px;font:900 clamp(12px,3.5vw,16px) var(--sans);text-shadow:0 1px 2px #482a55}.course-pill{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.food-bench{position:relative;height:calc(100% - 33px);display:flex;align-items:center;justify-content:flex-start}.food-plate{position:absolute;width:59%;height:100%;left:4%;top:0;display:grid;place-items:center;pointer-events:none}.drag-piece{position:absolute;z-index:4;top:-11%;left:7%;width:53%;height:110%;object-fit:contain;touch-action:none;user-select:none;-webkit-user-drag:none;cursor:grab;filter:drop-shadow(0 8px 6px #291a31b5);will-change:transform}.drag-piece.dragging{cursor:grabbing;filter:drop-shadow(0 15px 12px #2d193e);z-index:20;opacity:.92}.drag-piece:focus-visible{outline:3px solid #fff}.drag-hint{position:absolute;left:7%;bottom:0;max-width:60%;white-space:nowrap;font:900 clamp(10px,2.8vw,13px) var(--sans);text-shadow:0 2px 2px #21143d;pointer-events:none}.trash-target{position:absolute;right:5%;top:5%;height:90%;width:29%;max-width:135px;border-radius:13px;border:3px solid #fff0fa99;background:#30223a9c;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:0;box-shadow:inset 0 0 19px #0b071caa}.trash-target.active{background:#ff9fd5b8;box-shadow:0 0 26px #fff9}.trash-lid{width:63%;height:7px;border-radius:8px;background:#efe3ef;box-shadow:0 -5px 0 -2px #e0a8d2}.trash-can{width:53%;height:63%;background:linear-gradient(90deg,#ebdfe9,#958ca8);border:3px solid #eee3f0;border-radius:4px 4px 12px 12px;display:flex;align-items:center;justify-content:center;color:#7b5e8a}.trash-can span{font:900 27px var(--sans)}.trash-target small{font:900 11px var(--sans);letter-spacing:1px}
.dialog{position:relative;flex:0 0 clamp(116px,17dvh,142px);height:clamp(116px,17dvh,142px);padding:8px 13px 7px;border-top:3px solid #fff4fe;border-bottom:3px solid #dfbde3;background:linear-gradient(145deg,#252952,#1e213f 75%);box-shadow:inset 0 0 0 3px #6a6a9b;cursor:pointer;touch-action:manipulation;user-select:none}.dialog-head{display:flex;align-items:center;justify-content:space-between;height:22px;gap:5px}.dialog-head #speaker{display:inline-flex;align-items:center;min-width:72px;padding:1px 12px;border:1px solid #fff3f5;background:#bb689d;color:white;font:900 13px var(--sans);border-radius:4px}.dialog-count{font:600 11px var(--sans);opacity:.55;text-align:right}.dialog-text{height:calc(100% - 43px);display:flex;align-items:flex-start;padding:5px 4px 0;overflow:hidden;font-family:var(--serif);font-size:clamp(17px,4.5vw,22px);font-weight:900;line-height:1.48;letter-spacing:.01em;white-space:pre-wrap;word-break:normal;overflow-wrap:anywhere}.dialog-text.evil{color:#ff606f;text-shadow:0 0 5px #b5143666}.advance{height:19px;text-align:right;font:700 11px var(--sans);color:#ffe9f2;opacity:.77}.advance span{animation:bounce .8s infinite alternate;display:inline-block}.dialog.playing{cursor:default}.dialog.playing .advance{opacity:.48}.dialog.playing .dialog-count{opacity:0}
.footbar{flex:0 0 40px;display:flex;align-items:center;justify-content:space-between;padding:4px 12px;background:linear-gradient(90deg,#24264d,#4d2d5c);font:700 11px var(--sans)}.foot-label{letter-spacing:1.3px;opacity:.7}.foot-label b{color:#ffa6d8}.foot-button{min-height:31px;padding:3px 14px;background:#4b3668;border:1px solid #c7b4e3;color:#fff;border-radius:5px;font:900 12px var(--sans)}
.flash{position:absolute;inset:0;z-index:25;background:#ed1247;pointer-events:none;opacity:0;transition:opacity .15s}.flash.show{opacity:.68}.flash.black{background:#000;opacity:1;transition:opacity 1s}
.modal-screen{position:absolute;inset:0;z-index:30;background:linear-gradient(145deg,#282445,#15152f);overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding:calc(env(safe-area-inset-top) + 12px) 14px calc(env(safe-area-inset-bottom) + 22px);font-family:var(--serif)}.modal-head{position:sticky;top:-12px;z-index:2;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:9px 4px 14px;background:#242242e8;backdrop-filter:blur(9px)}.modal-title{font-size:clamp(19px,5vw,25px);font-weight:900}.close-btn{min-height:40px;padding:4px 16px;color:white;background:#634365;border:2px solid #f1b4d9;border-radius:7px;font:900 14px var(--sans)}.modal-sub{margin:10px 0 15px;font-weight:700;font-size:14px;line-height:1.6;color:#eadde9}.records-list{display:grid;grid-template-columns:1fr;gap:13px}.record{display:flex;align-items:center;gap:12px;width:100%;padding:10px;background:#403459;border:2px solid #a585b5;border-radius:13px;color:white;text-align:left}.record img,.record .locked-img{width:36%;aspect-ratio:4/5;object-fit:cover;border-radius:6px;background:repeating-linear-gradient(135deg,#524668,#524668 12px,#453852 12px,#453852 24px)}.locked-img{display:grid;place-items:center;font:900 30px var(--serif);color:#c4abc6}.record b{font:900 17px var(--serif)}.record small{display:block;margin-top:7px;font:700 12px var(--sans);color:#dbced9;line-height:1.45}
.end-body{min-height:100%;display:flex;flex-direction:column;gap:12px}.end-hero{width:100%;max-height:min(49dvh,500px);object-fit:cover;object-position:top center;border:3px solid #e7ccf2;border-radius:10px}.end-number{font:900 24px var(--sans);color:#ffacdb}.end-name{margin:0;font:900 clamp(22px,6vw,32px) var(--serif);line-height:1.4}.end-story{padding:12px 14px;min-height:65px;background:#10112bd9;border:2px solid #d0b0da;border-radius:10px;font-size:clamp(16px,4.2vw,20px);font-weight:900;line-height:1.6;white-space:pre-line}.end-story .red{color:#ff7d95;font-weight:900}.end-actions{display:grid;gap:9px}.main-button{width:100%;min-height:52px;border-radius:8px;border:2px solid #f8eafa;background:linear-gradient(#ed70ba,#af347c);color:white;font:900 clamp(15px,4vw,20px) var(--serif);box-shadow:0 3px 0 #4d285b}.main-button.secondary{background:linear-gradient(#7773a1,#3d416d)}.main-button.ghost{background:#4b3c59}.share-caption{font:700 11px var(--sans);line-height:1.6;color:#e5d5e9}.end-share-thumb{width:34%;max-width:190px;margin:0 auto;border:2px solid #eec5e9;border-radius:9px;display:block}.end-meta{display:flex;align-items:center;gap:10px;justify-content:center}.end-meta span{font:800 12px var(--sans)}
.lightbox{position:absolute;z-index:50;inset:0;background:#070711f5;display:flex;flex-direction:column;justify-content:center;align-items:center;padding:60px 15px 76px}.lightbox img{max-width:100%;max-height:100%;object-fit:contain;transition:transform .2s;touch-action:pinch-zoom}.lightbox-close,.zoom-btn{position:absolute;z-index:3;min-height:44px;padding:6px 20px;border:2px solid #fff4;color:#fff;border-radius:8px;background:#565077;font:900 14px var(--sans)}.lightbox-close{top:calc(env(safe-area-inset-top) + 15px);right:15px}.zoom-btn{bottom:calc(env(safe-area-inset-bottom) + 18px);left:50%;transform:translateX(-50%)}
.debug-row{border:1px solid #706487;padding:9px;border-radius:9px;background:#3f3457;margin:7px 0;display:flex;flex-wrap:wrap;gap:7px;align-items:center}.debug-row button,.debug-item{border:1px solid #ddc0ea;background:#635077;border-radius:5px;color:#fff;font:700 12px var(--sans);min-height:33px;padding:5px 10px}.debug-group{margin:20px 0 7px;font:900 17px var(--sans);color:#ffb9e1;border-bottom:1px solid #a37699;padding-bottom:8px}.debug-item{width:100%;text-align:left;margin-top:5px;line-height:1.5}.debug-thumb{width:83px;height:86px;object-fit:cover;border:2px solid white;border-radius:5px}.debug-cards{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}.debug-card-btn{background:#463858;border:1px solid #d9bbde;border-radius:7px;color:white;padding:7px 4px;min-height:80px}.debug-card-btn img{width:100%;height:105px;object-fit:cover;display:block}.toast{position:absolute;z-index:80;bottom:calc(env(safe-area-inset-bottom) + 20px);left:5%;right:5%;padding:11px 12px;text-align:center;background:#fff4e4;color:#332946;border-radius:8px;font:900 13px var(--sans);box-shadow:0 6px 20px #0007;opacity:0;pointer-events:none;transition:opacity .2s}.toast.show{opacity:1}
@keyframes bounce{to{transform:translateY(3px)}}@keyframes pulse{to{transform:scale(1.03);filter:brightness(1.4)}}
@media(max-height:650px){.topbar{flex-basis:43px;height:43px}.food-zone{flex-basis:130px;height:130px}.food-zone-header{height:28px}.food-bench{height:calc(100% - 28px)}.dialog{flex-basis:106px;height:106px;padding:6px 11px}.dialog-text{font-size:clamp(15px,4vw,19px)}.footbar{flex-basis:31px}.scene-tip{font-size:11px;padding:4px}}
@media(min-width:650px){.shell{border-radius:12px;max-height:100dvh}.topbar{flex-basis:57px}.scene{min-height:240px}}
@media(prefers-reduced-motion:reduce){*{animation-duration:.001ms!important;transition-duration:.001ms!important}}
.drag-piece.returning{filter:drop-shadow(0 7px 7px #221329) brightness(1.09)}
/* ENDも主要操作を1画面で完結。スチルだけタップで拡大表示する */
#endModal{overflow:hidden;padding:calc(env(safe-area-inset-top) + 8px) 13px calc(env(safe-area-inset-bottom) + 9px)}
#endModal .end-body{height:100%;min-height:0;gap:clamp(4px,1vh,8px);overflow:hidden}
#endModal .modal-head{position:static;flex:0 0 43px;padding:0 2px 4px;background:transparent}
#endModal .end-hero{flex:1 1 auto;min-height:80px;max-height:28vh;height:25vh;object-position:50% 17%;border-width:2px}
#endModal .end-number{display:none}
#endModal .end-name{flex:0 0 auto;font-size:clamp(18px,5.4vw,25px);line-height:1.25}
#endModal .end-story{flex:0 0 auto;min-height:0;padding:8px 10px;font-size:clamp(13px,3.7vw,16px);line-height:1.4}
#endModal .end-meta{flex:0 0 52px;justify-content:flex-start;gap:13px}
#endModal .end-share-thumb{height:51px;width:46px;max-width:none;object-fit:cover;object-position:top;margin:0}
#endModal .end-actions{flex:0 0 auto;gap:6px}
#endModal .main-button{min-height:44px;font-size:clamp(14px,3.9vw,18px)}
#endModal .share-caption{margin:0;font-size:10px;line-height:1.3}
@media(max-height:750px){#endModal .end-hero{height:19vh;max-height:21vh;min-height:66px}#endModal .end-meta{display:none}#endModal .end-story{font-size:13px;line-height:1.32;padding:7px 9px}#endModal .share-caption{display:none}#endModal .end-actions{gap:5px}#endModal .main-button{min-height:43px}}
@media(max-height:600px){#endModal .end-hero{max-height:15vh;min-height:58px}#endModal .end-story{font-size:11.5px;line-height:1.25}#endModal .main-button{min-height:37px}#endModal .modal-head{flex-basis:38px}}
@media(min-height:751px){#endModal .end-hero{height:35vh;max-height:35vh}}

/* 新素材レイヤー：椅子は一切表示しない。スマホ縦／PC横で背景と机のみ専用素材。 */

.room-photo{position:absolute;inset:0;display:block;z-index:0;overflow:hidden}
.room-photo img{display:block;width:100%;height:100%;object-fit:cover;object-position:center center}
.scene-glow{pointer-events:none;z-index:1;opacity:.45}
.hero-image{z-index:2;left:50%;top:auto;bottom:-20%;transform:translateX(-50%);width:min(100%,450px);height:130%;object-fit:contain;object-position:center bottom}
.scene-ribbon{z-index:4}
.scene-tip{z-index:4}
.food-zone{background:#806052;isolation:isolate}
.table-photo{display:block;position:absolute;inset:0;z-index:0;pointer-events:none}
.table-photo img{width:100%;height:100%;display:block;object-fit:cover;object-position:center 35%}
.food-zone-header{position:relative;z-index:6;background:linear-gradient(90deg,#493350b8,#6f4c50b0);border-bottom:1px solid #fbd2e7a1}
.food-bench{z-index:1}
.food-plate{height:100%;width:59%;left:4%;top:0}
.food-plate img{width:100%;height:100%;object-fit:contain;object-position:center center;display:block;filter:drop-shadow(0 3px 4px #28161399)}
.food-plate.no-plate img{opacity:0}

.drag-piece{max-width:none;filter:drop-shadow(0 4px 3px #251821a1)}
.drag-piece.dragging{filter:drop-shadow(0 11px 9px #24171e9a)}
.trash-target{display:none!important}
.drag-hint{bottom:3px;z-index:8;left:6%;max-width:90%;background:#291d3888;border-radius:4px;padding:2px 6px}
.foot-button{min-height:40px}
.mini-btn{min-height:40px}
/* 320px・Split Viewでも右端の操作を必ず表示。 */
.topbar{min-width:0;padding-inline:clamp(4px,1.8vw,12px)}
.topmini{min-width:0;overflow:hidden;text-overflow:ellipsis;gap:clamp(2px,.6vw,5px);font-size:clamp(9px,2.7vw,13px)}
.topmini #caughtLabel{overflow:hidden;text-overflow:ellipsis}
.topactions{flex-shrink:0}
.mini-btn{min-width:0;padding-inline:clamp(4px,1.6vw,9px)}
/* END画像は切り抜かない。最小画面では縦スクロールを許可してボタンを消さない。 */
#endModal{overflow-y:auto;overflow-x:hidden}
#endModal .end-body{height:auto;min-height:100%;overflow:visible}
#endModal .end-picture{display:block;flex:0 0 auto;width:100%;height:clamp(155px,34dvh,400px)}
#endModal .end-hero{display:block;width:100%;height:100%;max-height:none;min-height:0;object-fit:contain;object-position:center center;background:#1d162b;border:2px solid #e7ccf2;border-radius:10px}
#endModal .modal-head{position:static}
#endModal .end-meta{display:flex}
#endModal .share-caption{display:block}
#endModal .main-button{min-height:44px}
#endModal .end-story{font-size:clamp(14px,3.7vw,19px);line-height:1.45}
@media(max-height:650px){#endModal .end-picture{height:clamp(125px,28dvh,220px)}#endModal .end-story{font-size:14px;line-height:1.35}#endModal .modal-head{flex-basis:auto}}
@media(max-width:359px){.topsep{display:none}.foot-label{font-size:10px;letter-spacing:.3px}.food-zone-header{font-size:12px}}
/* PCは16:9の画面全体を使用し、プレイエリアを画面中央に大きく展開。 */
@media(min-width:900px) and (orientation:landscape){
 .shell{width:100%;max-width:none;max-height:none;border:0;border-radius:0;box-shadow:none}
 .topbar{height:54px;flex-basis:54px;padding-inline:28px}
 .topmini{font-size:15px;gap:12px}
 .mini-btn{min-width:80px;font-size:14px}
 .scene{min-height:0}
 .room-photo img{object-fit:cover}
 .hero-image{height:115%;width:min(37vw,680px);bottom:-19%}
 .scene-ribbon{top:17px;right:24px;font-size:15px;padding:8px 16px}
 .scene-tip{left:30%;right:30%;bottom:14px;font-size:16px}
 .food-zone{flex-basis:clamp(170px,23vh,270px);height:clamp(170px,23vh,270px)}
 .food-zone-header{height:38px;justify-content:center;gap:60px;font-size:17px}
 .food-bench{height:calc(100% - 38px);width:min(760px,65%);margin:0 auto}
 .food-plate{width:67%;left:15%}
 .drag-hint{left:20%;bottom:4px;font-size:14px}
 .dialog{flex-basis:clamp(115px,17vh,175px);height:clamp(115px,17vh,175px);padding-inline:max(28px,16vw)}
 .dialog-text{font-size:clamp(21px,1.8vw,27px)}
 .dialog-head #speaker{font-size:16px}
 .footbar{height:42px;flex-basis:42px;padding-inline:28px}
 #endModal{padding-inline:max(18px,22vw)}
 #endModal .end-picture{height:min(39dvh,450px)}
 .modal-screen{padding-inline:max(18px,22vw)}
}
@media(max-height:500px) and (orientation:landscape) and (max-width:899px){
 .shell{max-width:none;border:0}.topbar{height:38px;flex-basis:38px}.food-zone{height:98px;flex-basis:98px}.food-zone-header{height:24px}.food-bench{height:calc(100% - 24px)}.dialog{height:75px;flex-basis:75px;padding-block:3px}.dialog-text{font-size:15px;line-height:1.2}.footbar{height:30px;flex-basis:30px}.scene{min-height:60px}.hero-image{height:120%;bottom:-15%}
}

/* Keep the plate wholly inside the tabletop; grid min-content previously overflowed. */
.food-plate{display:block;overflow:visible}
.food-plate img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;display:block}
/* Align a full-size white plate beneath the food; no imagery extends into dialogue. */
.food-plate{width:67%;height:170%;top:-46%;left:0%;pointer-events:none}
@media(min-width:900px) and (orientation:landscape){.food-plate{width:min(36vw,450px);height:150%;top:-26%;left:50%;transform:translateX(-50%)}}
/* Small-device ending: keep the three primary actions on screen without clipping. */
@media(max-height:750px){
 #endModal .end-body{gap:4px}
 #endModal .end-picture{height:clamp(110px,22dvh,170px)}
 #endModal .end-meta{flex-basis:36px}
 #endModal .end-share-thumb{height:35px;width:32px}
 #endModal .end-actions{gap:4px}
 #endModal .main-button{min-height:41px}
}
@media(min-width:900px) and (max-height:850px){
 #endModal .end-picture{height:min(25dvh,235px)}
 #endModal .end-body{gap:4px}
}


/* PC横画面の見た目修正：縦長の細い箱を廃止し、横16:9で自然に広げる */
@media (min-width: 900px) and (orientation: landscape){
  body{background:#141021}
  .shell{max-width:none;width:100vw;height:100dvh;margin:0;border-left:none;border-right:none;box-shadow:none}
  .topbar{flex-basis:58px;height:58px;padding:7px 18px}
  .topmini{font-size:clamp(12px,1.1vw,15px)}
  .mini-btn{min-width:64px}
  .scene{min-height:0}
  .hero-image{width:min(31vw,440px);height:122%;bottom:-19%}
  .scene-ribbon{top:14px;right:18px}
  .scene-tip{left:18px;right:18px;bottom:10px;font-size:clamp(12px,1vw,15px)}
  .food-zone{flex-basis:clamp(190px,25vh,250px);height:clamp(190px,25vh,250px)}
  .food-zone-header{height:38px;padding:4px 20px;font-size:clamp(14px,1.15vw,18px)}
  .food-bench{height:calc(100% - 38px)}
  .food-plate{left:50%;transform:translateX(-50%);width:min(36vw,450px);height:100%}
  .drag-hint{left:50%;transform:translateX(-50%);max-width:none;text-align:center;font-size:clamp(11px,0.95vw,14px)}
  .dialog{flex-basis:146px;height:146px;padding:9px 18px}
  .dialog-head{height:24px}
  .dialog-text{height:calc(100% - 46px);font-size:clamp(20px,1.6vw,27px);padding:7px 4px 0}
  .footbar{flex-basis:42px;padding:5px 18px}
}

/* Align the painted food and the painted plate (not just their element boxes).
   Both source sprites are square, but their transparent insets differ. */
.food-plate{top:-50%}
@media(min-width:900px) and (orientation:landscape){
 .food-plate{height:175%;top:-52%}
}
/* Short landscape viewports: show the full one-line dialogue, including glyph descenders. */
@media(max-height:500px) and (orientation:landscape) and (max-width:899px){
 .dialog .dialog-text{height:calc(100% - 37px)}
 .dialog .advance{height:14px;font-size:10px}
}
/* Keep two-line Mincho dialogue fully visible on short portrait screens without
   changing the fixed dialogue-window height or letting the text scroll. */
@media(max-height:650px) and (min-height:501px){
 .dialog .dialog-text{height:calc(100% - 38px)}
 .dialog .advance{height:14px}
}


/* Frame composition: keep the plate, meal and hand target on the same visual axis. */
.food-plate{left:50%;transform:translateX(-50%);width:67%}
.drag-hint{left:50%;right:auto;transform:translateX(-50%);max-width:96%;white-space:nowrap;text-align:center}
@media(min-width:900px) and (orientation:landscape){
 .scene .hero-image{width:min(42vw,620px);height:142%;bottom:-24%}
 .food-bench{width:min(800px,75%)}
 .food-plate{left:50%;width:min(40vw,480px);height:175%;top:-52%;transform:translateX(-50%)}
 .dialog{padding-inline:max(20px,calc((100vw - 920px)/2))}
 .dialog-text{font-size:clamp(22px,1.55vw,28px)}
 .dialog-head{width:100%}
 .dialog .advance{text-align:right}
}
@media(max-width:899px){
 .food-plate{left:50%;width:67%}
 .scene-tip{left:9px;right:9px}
}
/* Dedicated ending scene: the still is the visual centerpiece, not a small thumbnail. */
.end-scene{position:absolute;inset:0;z-index:32;display:block;overflow:hidden;background:#100e1b;cursor:pointer;touch-action:manipulation;user-select:none;isolation:isolate}
.ending-art{position:absolute;inset:0;display:block}
.ending-art img{display:block;width:100%;height:100%;object-fit:cover;object-position:center center}
.ending-vignette{position:absolute;inset:0;background:linear-gradient(180deg,#0807145c,transparent 18%,transparent 54%,#0b0814b0 79%,#0b0814e9 100%);pointer-events:none}
.ending-chapter{position:absolute;top:calc(env(safe-area-inset-top) + 12px);left:16px;padding:5px 13px;background:#252246b8;border:1px solid #f5c7e5c7;border-radius:6px;color:#ffe9f5;font:900 clamp(14px,3vw,20px) var(--serif);letter-spacing:.05em}
.ending-window{position:absolute;left:clamp(10px,2vw,24px);right:clamp(10px,2vw,24px);bottom:calc(env(safe-area-inset-bottom) + 14px);height:clamp(145px,24dvh,205px);padding:12px 17px 8px;background:#161933e9;border:2px solid #edc5e8;box-shadow:inset 0 0 0 2px #666391,0 7px 24px #0009;display:flex;flex-direction:column;gap:4px;border-radius:8px}
.ending-window-head{display:flex;justify-content:space-between;align-items:center;font:800 13px var(--sans);color:#e5d8ee}
#endingSpeaker{background:#9f5082;border-radius:4px;padding:2px 11px;color:white}
#endingCount{font-size:11px;opacity:.65}
.ending-line{flex:1 1 auto;min-height:0;font:900 clamp(17px,4.7vw,24px)/1.48 var(--serif);color:#fff6fe;white-space:pre-wrap;overflow-wrap:anywhere;overflow:hidden}
.ending-line.red{color:#ff697c;text-shadow:0 0 5px #9b153e99}
.ending-next{font:800 12px var(--sans);color:#eed6e8;text-align:right;flex:0 0 auto}
#recordsModal,#debugModal{z-index:34}
@media(min-width:900px) and (orientation:landscape){
 .ending-window{left:max(30px,calc((100vw - 900px)/2));right:max(30px,calc((100vw - 900px)/2));height:clamp(155px,23dvh,220px);bottom:clamp(18px,2vh,30px);padding:15px 22px}
 .ending-line{font-size:clamp(22px,1.8vw,28px)}
 .ending-chapter{left:24px;top:18px}
}
@media(max-height:600px){
 .ending-window{height:clamp(112px,32dvh,155px);bottom:calc(env(safe-area-inset-bottom) + 5px);padding:7px 12px 4px}
 .ending-line{font-size:clamp(14px,3.6vw,19px);line-height:1.26}
 .ending-next{font-size:10px}
}

/* Prevent character's head from clipping at the top of wide PC displays. */
@media(min-width:900px) and (orientation:landscape){
 .scene .hero-image{bottom:-42%}
 .scene-tip{left:50%;right:auto;transform:translateX(-50%);width:min(620px,72vw)}
}


/* Visual refinement: use only existing art and CSS; all gameplay coordinates stay fixed. */
.topbar{position:relative;border-bottom-color:#f9cae6;box-shadow:inset 0 1px 0 #fff5,0 2px 8px #14112b66}
.sleep-track{position:absolute;z-index:6;left:0;right:0;bottom:0;height:3px;background:#211b3a88;pointer-events:none}
.sleep-track span{display:block;height:100%;width:0;background:#e9b5e3;box-shadow:0 0 4px #ffc7e778;transition:width .25s ease,background-color .25s ease}
.sleep-track[data-level="mid"] span{background:#f2acb2}
.sleep-track[data-level="high"] span{background:#f76d91}
.sleep-track[data-level="full"] span{background:#e83361}
.mini-btn{border-color:#fbd4ea;box-shadow:inset 0 1px 0 #ffffff66,0 2px 0 #1a1549}
.mini-btn:active,.foot-button:active{filter:brightness(1.12)}
.dialog{background:linear-gradient(145deg,#2a2f5bdc,#1c203de9 75%);border-top-color:#fff1fc;box-shadow:inset 0 0 0 2px #64659d,inset 0 0 0 4px #ce9bb850}
.dialog::before,.dialog::after{position:absolute;content:"";width:15px;height:15px;pointer-events:none;opacity:.8}
.dialog::before{top:4px;left:4px;border-top:1px solid #f9cce7;border-left:1px solid #f9cce7}
.dialog::after{right:4px;bottom:4px;border-right:1px solid #f9cce7;border-bottom:1px solid #f9cce7}
.dialog-head #speaker{border-color:#f9dae8;background:linear-gradient(120deg,#c77cad,#99537e);box-shadow:inset 0 1px 0 #fff7}
.dialog-text{font-feature-settings:"palt" 0;line-break:strict;text-wrap:pretty;text-shadow:0 1px 1px #0004}
.dialog-text.suspicious:not(.evil){color:#efe5ff;text-shadow:0 0 4px #9690d344}
.advance{letter-spacing:.02em}
.advance span{color:#ffbfdd;filter:drop-shadow(0 0 2px #f7b7de)}
.scene-ribbon{font-size:clamp(10px,2.6vw,13px);padding:5px 9px;border-width:1px;background:#422444ce;backdrop-filter:blur(3px)}
.scene-ribbon.safe{background:#2f5265da;border-color:#d5e9f5}
.scene-tip{border-color:#f2d4e2aa;box-shadow:0 1px 2px #2a1c3638;backdrop-filter:blur(2px)}
.scene-glow{transition:opacity .45s ease,filter .45s ease}
.scene.uneasy .scene-glow{opacity:.62;filter:saturate(.83) brightness(.85)}
.scene.danger .scene-glow{opacity:.83;filter:saturate(.66) brightness(.7)}
.scene.glance-return::after{content:"";position:absolute;inset:0;z-index:3;pointer-events:none;background:radial-gradient(ellipse at 50% 48%,transparent 40%,#250e3680 100%);animation:glance-fade .23s ease-out both}
@keyframes glance-fade{from{opacity:.78}to{opacity:0}}
/* The tabletop softly overlaps the scene instead of reading as an unrelated panel. */
.food-zone{box-shadow:inset 0 8px 14px #2b1a2630,0 -3px 7px #24141d55}
.food-zone::before{content:"";position:absolute;inset:1px 0 auto;height:14px;z-index:1;pointer-events:none;background:linear-gradient(#2e1b2659,transparent)}
.food-plate img{filter:drop-shadow(0 3px 3px #24191970)}
.drag-piece{transition:filter .13s ease}
.drag-piece.dragging{filter:brightness(1.09) drop-shadow(0 11px 8px #24171ec0)}
.drag-piece.bite-feedback{animation:bite-feedback .16s ease-out}
@keyframes bite-feedback{from{opacity:.74;filter:brightness(1.12) drop-shadow(0 5px 4px #291a3188)}to{opacity:1;filter:drop-shadow(0 4px 3px #251821a1)}}
.food-bench.drag-active:not(.returning)::after{content:"⌄";position:absolute;z-index:5;bottom:-3px;left:50%;transform:translateX(-50%);font:900 26px var(--sans);color:#fff1f9;text-shadow:0 1px 4px #24101e;pointer-events:none;animation:arrow-pulse .35s ease-in-out alternate infinite}
@keyframes arrow-pulse{to{opacity:.4;transform:translate(-50%,3px)}}
.return-guide{position:absolute;z-index:2;pointer-events:none;display:none;left:35.5%;top:-15%;width:29%;height:125%;background:#fff1f6;opacity:.24;mask:url('assets/food_5_empty.webp') center / contain no-repeat;-webkit-mask:url('assets/food_5_empty.webp') center / contain no-repeat}
.food-bench.returning .return-guide{display:block;animation:guide-pulse 1.3s ease-in-out infinite alternate}
@keyframes guide-pulse{to{opacity:.12}}
/* The hit area for the cup remains unchanged; only its return destination gains a ghost. */
.flash.show{background:radial-gradient(ellipse at 50% 50%,#f00a2206 15%,#ed1247aa 64%,#d90538f0 100%)}
.ending-art img{transition:filter .35s ease}
.end-scene:not([hidden]){animation:ending-appear .42s ease-out both}
@keyframes ending-appear{from{opacity:0}to{opacity:1}}
.end-scene[data-ending="01"] .ending-chapter{background:#8f406bab}
.end-scene[data-ending="01"] .ending-window{border-color:#f9d2e9}
.end-scene[data-ending="01"].last-reveal .ending-art img{filter:saturate(.76) brightness(.79)}
.end-scene[data-ending="01"].last-reveal .ending-vignette{background:linear-gradient(180deg,#1a10275b,transparent 17%,#130a2377 58%,#0b0814ee 100%)}
#endModal[data-ending="01"] .end-name{color:#ffe5f5}
#endModal .main-button{min-height:44px}
#endModal .main-button:not(.secondary):not(.ghost){box-shadow:0 3px 0 #4d285b,0 0 11px #a3448d2c}
#endModal .end-actions{gap:7px}
#recordsModal .record{box-shadow:inset 0 1px 0 #e8d3ef2b,0 2px 7px #0003}
#recordsModal .record:not(:disabled):active{background:#5f456d}
#recordsModal .record:disabled{opacity:.7}
#recordsModal .locked-img{border:1px solid #a996bb9c}
#recordsModal .modal-title{letter-spacing:.04em}
@media (min-width:900px) and (orientation:landscape){
  .return-guide{width:190px;left:calc(50% - 95px)}
  .scene-ribbon{top:16px;right:23px;padding:7px 12px;font-size:13px}
  .scene .hero-image{width:min(40vw,590px)}
  .room-photo img{object-position:center center}
  .dialog-head #speaker{min-width:83px}
}
@media (max-width:430px){
  .scene-ribbon{max-width:44%;text-align:center;line-height:1.2}
  .dialog-text{letter-spacing:0;line-height:1.42}
  .dialog-head #speaker{font-size:12px}
}
@media (max-height:500px) and (orientation:landscape){
  .dialog-text{line-height:1.2}
  .scene-ribbon{font-size:10px;padding:3px 6px}
  .return-guide{opacity:.15}
}
@media(prefers-reduced-motion:reduce){
  .drag-piece.bite-feedback,.end-scene:not([hidden]),.scene.glance-return::after,.food-bench.drag-active:not(.returning)::after,.food-bench.returning .return-guide{animation:none!important}
}
/* END-specific UI accents use existing artwork without regenerating any cards. */
#endModal[data-ending="02"] .end-share-thumb{border-color:#a7b5ff}
#endModal[data-ending="03"] .end-share-thumb{border-color:#ff8b9a}
#endModal[data-ending="02"] .end-name{color:#e0dfff}
#endModal[data-ending="03"] .end-name{color:#ffc3d1}
.end-scene[data-ending="02"] .ending-window{border-color:#b6b8ef}
.end-scene[data-ending="03"] .ending-window{border-color:#f5adba}


/* ===== 12: visual audit refinements (original story and image assets retained) ===== */
:root{--frame-thin:1px;--frame-color:#f2bedf;--ui-radius:5px}
/* 05, 11, 13, 15: make dividers recede and keep decorative detail in the dialogue. */
.food-zone{border-top-width:2px;border-bottom-width:1px;border-color:#e1c2d6b5;box-shadow:0 -4px 12px #24162235,inset 0 6px 8px #130c1718}
.food-zone::before{height:22px;background:linear-gradient(#2b192334,transparent)}
.food-zone-header{border-bottom-color:#d7a8c28a;box-shadow:inset 0 1px 0 #fcdcf228}
.dialog{border-top-width:2px;box-shadow:inset 0 0 0 1px #7473a0,inset 0 0 0 3px #b988ab4f}
.mini-btn,.foot-button,.scene-ribbon,.dialog-head #speaker{border-radius:var(--ui-radius)}
/* 06,07,08,25: legible counters, comfortable click areas, stable digits. */
.topbar{gap:7px}
.topmini{gap:clamp(4px,1vw,10px);font-variant-numeric:tabular-nums;letter-spacing:0;overflow:visible}
.topmini #stageLabel{font-weight:900;color:#ffe1f1;letter-spacing:.02em}
.topmini #caughtLabel{font-weight:900;color:#fff0f7;white-space:nowrap}
.sleep-indicator{font-weight:900;font-size:clamp(9px,2.4vw,12px);color:#ffe2f0;white-space:nowrap}
.topactions{align-items:center;gap:5px}
.mini-btn{min-height:44px;min-width:47px;padding:4px 8px;line-height:1.25;touch-action:manipulation}
.food-zone-header{align-items:baseline;letter-spacing:.01em;font-variant-numeric:tabular-nums}
.food-zone-header #bitesLabel{font-variant-numeric:tabular-nums;font-weight:900;flex-shrink:0}
/* 09,24: single persistent operating hint, no duplicated text on the plate or dialogue footer. */
.drag-hint{opacity:0;pointer-events:none;transition:opacity .15s;white-space:nowrap;font-size:12px}
.food-bench.drag-active .drag-hint{opacity:1}
.dialog.playing .advance{visibility:hidden}
.scene-tip{max-width:min(90%,570px);margin:0 auto;background:#201833ad;padding:5px 10px;border-color:#f6d7e5b5;line-height:1.3}
/* 10,12,14: fixed height of the single dialogue window; baseline and next marker never jump. */
.dialog{padding-bottom:10px}
.dialog-head #speaker{font-weight:900;background:linear-gradient(180deg,#c582b2,#9c537f);box-shadow:inset 0 1px 0 #ffffff4d;border-width:1px}
.dialog-text{padding-top:7px;padding-inline:5px;line-height:1.42;text-wrap:pretty;word-break:normal}
.advance{position:absolute;right:clamp(12px,3vw,24px);bottom:6px;height:16px;text-align:right;font-size:11px}
.advance span{display:inline-block;font-size:14px;margin-left:3px}
/* 01,02,03,19: preserve the 16:9 room, let the character feel seated behind the table. */
.scene{isolation:isolate}
.scene-glow{background:radial-gradient(ellipse 46% 70% at 50% 74%,#fff2e52b,transparent 88%),linear-gradient(180deg,transparent 67%,#2f172d4c)}
.scene .hero-image{object-position:center bottom;transform-origin:center bottom;filter:sepia(.035) drop-shadow(1px 9px 9px #24131865)}
.scene.uneasy .hero-image{filter:sepia(.05) saturate(.78) brightness(.89) drop-shadow(1px 9px 10px #16112699)}
.scene.danger .hero-image{filter:sepia(.05) saturate(.62) brightness(.76) drop-shadow(1px 9px 11px #111329aa)}
/* 04,17,20,21,22,23: the plate and food share an optical centre, dish scale can vary without shifting hit area. */
.food-plate img{transform-origin:50% 51%;transform:scale(var(--dish-plate-scale,1));filter:drop-shadow(0 4px 3px #2419197f)}
.food-zone[data-stage="1"]{--dish-plate-scale:1}
.food-zone[data-stage="2"]{--dish-plate-scale:1}
.food-zone[data-stage="3"]{--dish-plate-scale:.92}
.food-zone[data-stage="4"]{--dish-plate-scale:.88}
.food-zone[data-stage="5"]{--dish-plate-scale:1}
.drag-piece{object-position:center center;transform-origin:center center;image-rendering:auto}
/* Character pose positions are anchored to one invisible frame rather than native image pixel dimensions. */
.hero-image{object-fit:contain;object-position:50% 100%}
/* 26-30: tie the ending still to the results page and distinguish each ending without changing artwork. */
#endModal .end-picture{position:relative;overflow:hidden;isolation:isolate;border-radius:10px;background:#21192e}
#endModal .end-picture::before{content:"";position:absolute;inset:-18px;z-index:-1;background-image:var(--end-art);background-position:center;background-size:cover;filter:blur(13px) brightness(.48);opacity:.88;pointer-events:none}
#endModal .end-picture img{position:relative;z-index:1;object-fit:contain;object-position:center center;background:transparent;border-color:#dec2de}
#endModal .end-name{font-size:clamp(21px,5.8vw,31px);line-height:1.28;font-weight:900;letter-spacing:.025em}
#endModal .end-story{color:#f3eaf5;font-size:clamp(13px,3.7vw,18px);line-height:1.48;letter-spacing:.01em}
#endModal .end-actions{gap:clamp(8px,1.2vh,12px);margin-block:4px 3px}
#endModal .main-button{min-height:44px;line-height:1.35;padding-block:8px;border-radius:6px}
#endModal .share-caption{color:#c2b2c5;line-height:1.45}
#endModal[data-ending="01"]{--end-accent:#f4aacd}
#endModal[data-ending="02"]{--end-accent:#aaaaff}
#endModal[data-ending="03"]{--end-accent:#ff93a7}
#endModal .end-name{color:var(--end-accent,#f4c3e8)!important}
#endModal .end-picture img{border-color:var(--end-accent,#e7ccf2)!important}
#endModal .modal-title{color:var(--end-accent,#eee)}
#endModal .end-story{border-color:var(--end-accent,#a9a3cf)}
#endModal[data-ending="02"] .main-button:not(.secondary):not(.ghost){background:linear-gradient(#a69bda,#7068b2)}
#endModal[data-ending="03"] .main-button:not(.secondary):not(.ghost){background:linear-gradient(#e77c9c,#a94a68)}
#recordsModal .record{border-radius:8px;outline-offset:2px}
#recordsModal .record:not(:disabled):focus-visible{outline:2px solid #f3cde6}
@media (min-width:900px) and (orientation:landscape){
 /* Reduce the broad empty wooden stripe, and subtly blend it into the room. */
 .food-zone{background:linear-gradient(90deg,#392d37 0%,#74504d 12%,#8e6049 50%,#74504d 88%,#392d37 100%)}
 .table-photo{left:50%;right:auto;transform:translateX(-50%);width:min(100%,1320px);opacity:.99}
 .food-zone::after{content:"";position:absolute;inset:0;z-index:0;pointer-events:none;background:linear-gradient(90deg,#2218237d,transparent 16%,transparent 84%,#2218237d)}
 .scene .hero-image{width:min(40vw,570px);height:140%;bottom:-36%}
 .scene-tip{left:50%;right:auto;transform:translateX(-50%);width:min(580px,72vw);max-width:unset}
 .food-bench{width:min(780px,69%)}
 .food-zone-header{justify-content:center;gap:clamp(30px,4vw,74px)}
 .dialog{padding-inline:max(28px,calc((100vw - 940px)/2))}
 .dialog-head #speaker{min-width:95px}
 #endModal .end-picture{max-height:43vh}
 #endModal .end-body{max-width:960px;margin-inline:auto}
}
@media (max-width:899px){
 .scene .hero-image{width:min(99%,480px);height:125%;bottom:-20%}
 .scene-tip{left:50%;right:auto;transform:translateX(-50%);width:calc(100% - 18px)}
 .dialog-text{font-size:clamp(17px,4.25vw,22px)}
 .mini-btn{min-width:43px;padding-inline:6px}
}
@media (max-width:430px){
 .topbar{padding-inline:6px;gap:3px}
 .topmini{font-size:clamp(10px,2.8vw,12px);gap:4px}
 .topactions{gap:3px}
 .mini-btn{font-size:11px;min-width:42px;padding-inline:5px}
 .heartmark{font-size:15px}
 .sleep-indicator{font-size:10px}
 .food-zone-header{font-size:clamp(12px,3vw,14px)}
 .dialog-head #speaker{padding-inline:8px}
 .dialog-text{padding-inline:4px;padding-top:6px}
 #endModal .end-body{gap:clamp(3px,.6vh,7px)}
 #endModal .end-actions{gap:5px}
}
@media(max-width:360px){
 .topsep{opacity:.3}
 .topbar{padding-inline:4px}
 .mini-btn{min-width:39px;padding-inline:4px}
 .dialog-text{font-size:16.5px}
}
@media (max-height:520px){
 .mini-btn{min-height:37px}
 .dialog-text{font-size:clamp(14px,2.4vw,18px);line-height:1.19;padding-top:2px}
 .dialog{padding-bottom:4px}
 .advance{bottom:2px;font-size:10px}
 .food-zone-header{align-items:center}
 #endModal .end-picture{height:18vh;min-height:95px}
}
@media(prefers-reduced-motion:reduce){
 .food-plate img,.hero-image,.scene-glow,.drag-hint{transition:none!important}
}
/* 12 follow-up: the advance indicator is absolutely positioned, so it no longer
   needs the old 43px reservation. Keep the dialogue window fixed, not scrollable. */
.dialog .dialog-text{height:calc(100% - 30px)}
@media(max-height:650px){.dialog .dialog-text{height:calc(100% - 26px)}}


/* PC table/view composition — room photo covers the entire game viewport.
   The tabletop has transparent edges and MUST NOT reveal an opaque food-band.
   Shared game controls and all touch/drag hit areas are unchanged. */
.shell > .room-photo{position:absolute;inset:0;z-index:0;display:block;overflow:hidden;pointer-events:none}
.shell > .room-photo img{display:block;width:100%;height:100%;object-fit:cover;object-position:center center}
.scene{position:relative;z-index:1;background:transparent}
.food-zone{position:relative;z-index:2;background:transparent;box-shadow:none;border-top-color:#f0d7ea42;border-bottom-color:#f0d7ea58}
.food-zone::after{display:none}
.food-zone::before{background:linear-gradient(180deg,#24151a29,transparent)}
.dialog,.footbar{position:relative;z-index:3}
/* Make the dining-room floor visible through the table's actual transparent shape. */
.table-photo{left:0;right:0;width:100%;transform:none;overflow:hidden}
.table-photo img{display:block;width:100%;height:100%;object-fit:cover;object-position:center 27%}
/* Consistent optical centre; original independent plate and food hit target retained. */
.food-plate img{filter:drop-shadow(0 4px 4px #21131780)}
.food-zone-header{font-variant-numeric:tabular-nums}
@media (min-width:900px) and (orientation:landscape){
 .shell{background:#332537}
 .shell > .room-photo img{object-position:center center}
 .scene{min-height:0}
 /* The wood image fills the width, while its transparent edges reveal the room. */
 .food-zone{flex-basis:clamp(184px,25dvh,264px);height:clamp(184px,25dvh,264px);border-top:0;border-bottom:0}
 .table-photo{inset:0;width:100%;transform:none;opacity:1}
 .table-photo img{object-fit:cover;object-position:center 24%}
 .food-zone-header{height:36px;width:min(650px,70vw);max-width:calc(100% - 28px);margin:0 auto;justify-content:center;gap:clamp(30px,4vw,64px);border:1px solid #d9b7ce90;border-radius:0 0 7px 7px;background:#3e2945c9;box-shadow:0 3px 8px #261a2170;padding:3px 15px;font-size:clamp(15px,1.1vw,18px);font-variant-numeric:tabular-nums}
 .food-bench{height:calc(100% - 36px);width:min(790px,66vw);margin:0 auto}
 .food-plate{width:min(39vw,500px);left:50%;transform:translateX(-50%)}
 .drag-hint{left:50%;right:auto;transform:translateX(-50%);max-width:none;text-align:center}
 /* Girl sits directly across the table, without an abrupt cut at the waist. */
 .scene .hero-image{width:min(43vw,630px);height:143%;bottom:-40%;object-fit:contain;object-position:center bottom}
 .scene-tip{left:50%;right:auto;transform:translateX(-50%);width:min(600px,70vw);max-width:none;bottom:9px;padding:6px 12px;font-size:clamp(13px,1vw,16px)}
 .scene-glow{background:radial-gradient(ellipse 45% 70% at 50% 68%,#fff0dd2b,transparent 95%);opacity:.58}
 /* The dialogue window spans the PC but its reading column stays short. */
 .dialog{flex-basis:clamp(144px,16dvh,178px);height:clamp(144px,16dvh,178px);padding:10px max(26px,calc((100vw - 1050px)/2)) 8px}
 .dialog-head{height:27px}
 .dialog-head #speaker{min-width:95px;font-size:15px}
 .dialog-text{font-size:clamp(24px,1.55vw,31px);line-height:1.38;letter-spacing:.01em;padding-top:8px;padding-left:4px}
 .dialog .dialog-text{height:calc(100% - 38px)}
 .dialog .advance{right:max(26px,calc((100vw - 1050px)/2));bottom:6px}
 .topbar{height:60px;flex-basis:60px;padding-inline:25px}
 .topmini{font-size:clamp(15px,1.1vw,18px);font-variant-numeric:tabular-nums;gap:12px}
 .mini-btn{min-width:78px;min-height:44px;font-size:14px;border-radius:5px}
 .topactions{gap:8px}
 .footbar{height:42px;flex-basis:42px;padding-inline:25px}
 .foot-button{min-height:34px}
 /* Background and furniture should be legible, but should not compete with her face. */
 .scene-ribbon{right:25px;top:14px;max-width:220px;font-size:14px}
 .mini-btn:hover,.foot-button:hover{filter:brightness(1.08)}
 .mini-btn:focus-visible,.foot-button:focus-visible{outline:2px solid #fff;outline-offset:2px}
}
/* Short landscape displays: leave enough height for dialogue and meal. */
@media (min-width:900px) and (orientation:landscape) and (max-height:700px){
 .topbar{height:49px;flex-basis:49px}
 .food-zone{height:clamp(147px,23dvh,185px);flex-basis:clamp(147px,23dvh,185px)}
 .dialog{height:clamp(118px,20dvh,146px);flex-basis:clamp(118px,20dvh,146px);padding-top:7px}
 .dialog .dialog-text{font-size:clamp(19px,1.65vw,24px);line-height:1.3;height:calc(100% - 34px);padding-top:4px}
 .footbar{height:32px;flex-basis:32px}
 .scene .hero-image{height:145%;bottom:-43%}
}
/* Phone/tablet: the same full-room background, no dark strips around the wood. */
@media(max-width:899px), (orientation:portrait){
 .shell > .room-photo img{object-position:center center}
 .food-zone{background:transparent}
 .table-photo{width:100%;left:0;right:0;transform:none}
 .table-photo img{object-fit:cover;object-position:center 28%}
}
@media(prefers-reduced-motion:reduce){.mini-btn:hover,.foot-button:hover{filter:none}}
/* Maintain the same close dining-room perspective on shorter desktop viewports. */
@media (min-width:900px) and (orientation:landscape) and (max-height:800px){
 .scene .hero-image{width:min(48vw,650px);height:160%;bottom:-57%}
}


/* Desktop dining table proportion: the room remains edge-to-edge. The desk must
   read as a tabletop in the foreground, not a giant wall of wood. Phone/tablet
   sizes and the existing drop gesture retain their original layout. */
@media (min-width:900px) and (orientation:landscape){
 .food-zone{flex-basis:clamp(140px,17.5dvh,190px);height:clamp(140px,17.5dvh,190px)}
 .food-plate{height:124%;top:-14%}
 .drag-piece{transform-origin:50% 50%}
 .table-photo img{object-position:center 31%}
 .food-zone-header{height:33px}
 .food-bench{height:calc(100% - 33px)}
 .scene .hero-image{height:137%;bottom:-36%}
}
@media (min-width:900px) and (orientation:landscape) and (max-height:800px){
 .food-zone{flex-basis:clamp(115px,18dvh,145px);height:clamp(115px,18dvh,145px)}
 .scene .hero-image{height:150%;bottom:-46%}
}
/* Final PC balance: reduce the wooden surface while retaining readable food art. */
@media (min-width:900px) and (orientation:landscape){
 .food-zone{flex-basis:clamp(155px,20dvh,210px);height:clamp(155px,20dvh,210px)}
 .food-plate{height:128%;top:-14%}
}
@media (min-width:900px) and (orientation:landscape) and (max-height:800px){
 .food-zone{flex-basis:clamp(130px,20.5dvh,166px);height:clamp(130px,20.5dvh,166px)}
}

/* 第15版：既存の画像・操作領域は維持し、30項目の演出だけを重ねる。 */
.shell{--fx-pink:#ffc9ed}
/* Decorative feedback does not catch mouse/touch events. */
.shell::after{content:"";position:absolute;inset:0;z-index:24;opacity:0;pointer-events:none;transition:opacity .18s ease;background:transparent}
.shell.fx-intro::after{animation:scene-welcome .85s ease-out both;background:#fff0f7}
@keyframes scene-welcome{0%{opacity:.9}55%{opacity:.12}100%{opacity:0}}
.shell.fx-omen::after,.shell.fx-cold::after{animation:fx-cold .65s ease-out both;background:radial-gradient(ellipse at 50% 45%,transparent 23%,#38346d9a 100%)}
@keyframes fx-cold{0%,100%{opacity:0}40%{opacity:.6}}
.shell.fx-glance::after{animation:fx-glance .28s both;background:radial-gradient(ellipse at 50% 55%,#fff7f24b,transparent 69%)}
@keyframes fx-glance{0%,100%{opacity:0}40%{opacity:1}}
.shell.fx-warning::after,.shell.fx-turn::after{animation:fx-warning .33s ease-out both;background:radial-gradient(ellipse at 50% 45%,transparent 42%,#f03b666e)}
@keyframes fx-warning{0%,100%{opacity:0}45%{opacity:.82}}
.shell.fx-caught1::after,.shell.fx-caught2::after,.shell.fx-caught3::after{animation:fx-hurt .9s ease-out both;background:radial-gradient(ellipse at 50% 50%,transparent 20%,#cd285f9e 94%)}
.shell.fx-caught2::after{background:radial-gradient(ellipse at 50% 50%,#54497942 30%,#9b2259c4 100%)}
.shell.fx-caught3::after{background:radial-gradient(ellipse at 50% 50%,#fb294786 10%,#110714f4 100%)}
@keyframes fx-hurt{0%{opacity:0}14%{opacity:1}50%{opacity:.65}100%{opacity:0}}
.shell.fx-caught1 .scene{animation:fx-dizzy .65s ease-out}
.shell.fx-caught2 .scene{animation:fx-dizzy-heavy .98s ease-out}
@keyframes fx-dizzy{0%,100%{filter:none}38%{filter:blur(1.9px) saturate(.78)}}
@keyframes fx-dizzy-heavy{0%,100%{filter:none}38%{filter:blur(4.5px) saturate(.64) brightness(.80)}68%{filter:blur(2px) saturate(.8)}}
.shell.fx-drop .food-zone-header{animation:fx-drop .26s ease-out}
@keyframes fx-drop{0%,100%{filter:none}40%{filter:brightness(1.55)}}
.shell.fx-clear .food-zone-header{animation:fx-course-title .34s ease-out}
.shell.fx-course .food-zone-header{animation:fx-course-title .6s ease-out}
@keyframes fx-course-title{0%{filter:brightness(1)}35%{filter:brightness(1.55)}100%{filter:brightness(1)}}
.shell.fx-lock::after,.shell.fx-ending-glitch::after{animation:fx-lock .8s ease-out both;background:repeating-linear-gradient(0deg,#1c0f2ca9 0 2px,transparent 2px 10px)}
@keyframes fx-lock{0%{opacity:0}12%{opacity:.65}20%{opacity:0}29%{opacity:.4}100%{opacity:0}}
.shell.fx-result #endModal:not([hidden]) .end-body{animation:fx-result .5s ease-out both}
@keyframes fx-result{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
.shell[data-course="2"] .scene-glow{opacity:.4;filter:saturate(.92)}
.shell[data-course="3"] .scene-glow{opacity:.5;filter:saturate(.76)}
.shell[data-course="4"] .scene-glow{opacity:.60;filter:saturate(.65)}
.shell[data-course="5"] .scene-glow{opacity:.70;filter:saturate(.50)}
/* Preserve full visibility of the face, draggable sprite, and all labels. */
.ending-art img{animation:ending-art-appear .72s ease-out both}
@keyframes ending-art-appear{from{opacity:0;filter:brightness(1.35)}to{opacity:1;filter:none}}
.end-scene[data-ending="02"] .ending-art img{animation:ending-wake 1.25s ease-out both}
@keyframes ending-wake{from{filter:blur(10px) brightness(.55)}to{filter:none}}
.end-scene[data-ending="03"] .ending-art img{animation:ending-lock-in .75s ease-out both}
@keyframes ending-lock-in{from{filter:saturate(.6) brightness(.5)}to{filter:brightness(1)}}
.end-scene[data-ending="01"].last-reveal .ending-art img{filter:saturate(.66) brightness(.76)}

/* Share-card-forward ending screen: the very same still appears in the film and
   on its matching, distinct 1080×1350 card. Existing collection CGs are untouched. */
#endModal{overflow:hidden;padding:calc(env(safe-area-inset-top) + 6px) clamp(8px,2.5vw,20px) calc(env(safe-area-inset-bottom) + 7px)}
#endModal .end-body{display:flex;flex-direction:column;align-items:stretch;height:100%;min-height:0;max-width:960px;margin:auto;gap:clamp(3px,.55dvh,7px);overflow:hidden}
#endModal .modal-head{flex:0 0 39px;min-height:0;padding:0 2px;position:static;order:0}
#endModal .end-name{flex:0 0 auto;text-align:center;font-size:clamp(17px,4.4vw,26px);line-height:1.13;order:1;margin:0}
#endModal .end-story{flex:0 0 auto;text-align:center;font-size:clamp(12px,3.25vw,16px);line-height:1.28;min-height:0;margin:0;padding:4px 6px;order:2}
#endModal .end-card-display{order:3;min-height:0;flex:1 1 auto;display:grid;place-items:center;align-self:stretch;overflow:hidden;background:linear-gradient(110deg,#1b142b,#2c2039);border:1px solid var(--end-accent,#e5c4dc);border-radius:8px;padding:3px;cursor:zoom-in}
#endModal .end-card-display .end-hero{display:block;flex:none;width:auto;height:100%;max-height:100%;max-width:100%;min-height:0;object-fit:contain;object-position:center;border:0;border-radius:4px;background:none}
#endModal .end-actions{order:4;flex:0 0 auto;display:grid;gap:5px;margin:0}
#endModal .main-button{min-height:42px;padding:5px 7px;font-size:clamp(13px,3.35vw,17px)}
#endModal .share-caption{order:5;flex:0 0 auto;margin:0;padding:0 3px;text-align:center;font-size:10px;line-height:1.25}
#endModal[data-ending="01"] .end-card-display{background:#513449}
#endModal[data-ending="02"] .end-card-display{background:#292344}
#endModal[data-ending="03"] .end-card-display{background:#351b28}
@media(max-height:650px){
 #endModal .modal-head{flex-basis:35px}
 #endModal .end-story{font-size:12px;line-height:1.22;padding:3px 5px}
 #endModal .end-name{font-size:clamp(15px,4vw,20px)}
 #endModal .main-button{min-height:39px;padding:5px}
 #endModal .share-caption{display:none}
}
@media(max-height:420px) and (orientation:landscape){
 #endModal .modal-head{flex-basis:31px}
 #endModal .end-name{font-size:16px}
 #endModal .end-story{display:none}
 #endModal .end-actions{grid-template-columns:repeat(3,minmax(0,1fr));gap:5px}
 #endModal .main-button{min-height:36px;font-size:clamp(10px,1.5vw,14px);padding:3px}
}
@media(prefers-reduced-motion:reduce){
 .shell::after,.shell.fx-intro::after,.shell.fx-glance::after,.shell.fx-cold::after,.shell.fx-omen::after,.shell.fx-warning::after,.shell.fx-turn::after,.shell.fx-caught1::after,.shell.fx-caught2::after,.shell.fx-caught3::after,.shell.fx-lock::after,.shell.fx-ending-glitch::after{animation:none!important;opacity:0!important}
 .shell.fx-caught1 .scene,.shell.fx-caught2 .scene,.shell.fx-drop .food-zone-header,.shell.fx-course .food-zone-header,.shell.fx-result #endModal .end-body,.ending-art img{animation:none!important}
}
/* Stage lighting stays behind the player-facing text and never receives events. */
.scene::after{content:"";pointer-events:none;position:absolute;inset:0;z-index:3;opacity:0}
.shell[data-course="3"] .scene::after{opacity:.11;background:radial-gradient(ellipse at 50% 58%,transparent 33%,#21203d 100%)}
.shell[data-course="4"] .scene::after{opacity:.27;background:radial-gradient(ellipse at 50% 58%,transparent 28%,#190b2b 100%)}
.shell[data-course="5"] .scene::after{opacity:.38;background:radial-gradient(ellipse at 50% 58%,transparent 23%,#180922 100%)}
@media (max-height:650px){#endModal .end-card-display{min-height:30px}#endModal .end-actions .main-button{min-height:38px}}
@media(max-width:360px) and (max-height:600px){
 #endModal{padding-bottom:calc(env(safe-area-inset-bottom) + 10px)}
 #endModal .end-actions .main-button{min-height:37px}
}
/* ================================================================
   Visual refinement: ONE dining scene + quiet navy-glass controls.
   No new images and no changes to game hitboxes or narration rules.
   ================================================================ */
:root{
 --ink:#f8f0f6;
 --navy:#222840;
 --deep:#151a30;
 --pink:#e7a8c7;
 --pink2:#f7e5ed;
 --line:#efd2e2;
 --glass:rgba(19,24,47,.79);
 --glass-line:rgba(255,234,246,.58);
 --glass-shadow:0 14px 38px rgba(9,11,26,.25);
 --soft-text:#e4dce7;
}
body{background:#111729}
.shell{
 --course-accent:#efb9d1;
 width:100%;height:100vh;height:100dvh;min-height:0;
 overflow:hidden;background:#1c223a;
 border:0;border-radius:0;box-shadow:none;
}
.shell[data-course="3"]{--course-accent:#d9b1cf}
.shell[data-course="4"]{--course-accent:#b9abd1}
.shell[data-course="5"]{--course-accent:#a8a8ce}
/* Reuse the single existing background across the entire viewport. */
.shell > .room-photo{position:absolute;inset:0;z-index:0;pointer-events:none}
.shell > .room-photo img{width:100%;height:100%;object-fit:cover;object-position:50% 49%}

/* Compact floating HUD: one hierarchy for chapter, risk and actions. */
.topbar{
 position:absolute;z-index:8;top:calc(env(safe-area-inset-top) + 10px);
 left:clamp(10px,1.9vw,30px);right:clamp(10px,1.9vw,30px);
 width:auto;height:50px;min-height:50px;flex:none;
 display:flex;justify-content:space-between;align-items:center;
 gap:10px;padding:4px 8px 4px 14px;
 border:1px solid var(--glass-line);border-radius:8px;
 background:var(--glass);box-shadow:var(--glass-shadow),inset 0 1px 0 #ffffff18;
 backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);
 font-family:var(--sans);
}
.topmini{
 display:flex;align-items:baseline;gap:clamp(6px,1.1vw,16px);min-width:0;
 font-size:clamp(11px,1.1vw,15px);font-weight:750;letter-spacing:0;
 font-variant-numeric:tabular-nums;white-space:nowrap;
}
.topmini #stageLabel{font-size:clamp(17px,1.7vw,23px);font-family:var(--serif);color:#fff8fe;letter-spacing:.02em;line-height:1.1}
.topmini #caughtLabel{font-weight:700;color:#f0deeb}
.topmini #sleepIndicator{font-size:clamp(10px,1vw,12px);font-weight:650;color:#e5cbd9}
.topsep{height:13px;width:1px;background:#e8d2e7aa;opacity:.6;font-size:0}
.heartmark{font-size:15px;color:var(--course-accent);opacity:.82}
.topactions{display:flex;gap:5px;align-items:center;min-width:0}
.mini-btn,.foot-button{
 appearance:none;min-width:49px;min-height:41px;height:41px;
 padding:5px 11px;border:1px solid rgba(248,233,244,.47);
 border-radius:5px;color:#fff6fb;background:rgba(32,39,65,.62);
 font:750 clamp(11px,.87vw,14px)/1.2 var(--sans);letter-spacing:.01em;
 box-shadow:inset 0 1px 0 #ffffff19,0 2px 5px #080b1c1c;
 transition:background .13s,border-color .13s,box-shadow .13s;
 white-space:nowrap;touch-action:manipulation;
}
.mini-btn:hover,.foot-button:hover{background:rgba(72,75,111,.86);border-color:#ffe5f4}
.mini-btn:active{background:rgba(94,83,121,.95);box-shadow:inset 0 2px 4px #0b0e21aa}
.restart-mini{color:#f0dce9;border-color:#eacbdd65}
.footbar{display:none!important}
.sleep-track{bottom:-2px;height:3px;left:12px;right:12px;border-radius:4px;background:transparent;border:0;box-shadow:none}
.sleep-track span{border-radius:4px;box-shadow:0 0 9px #e2a0d0a5}
.shell[data-course="4"] .topbar{background:rgba(20,23,47,.87)}
.shell[data-course="5"] .topbar{background:rgba(17,21,43,.89)}
/* The heroine and the meal live in the SAME room, not separate stripes. */
.scene{
 position:relative;flex:1 1 auto;min-height:0;z-index:1;overflow:hidden;
 background:transparent;isolation:isolate;
}
.scene-glow{z-index:1;pointer-events:none;opacity:.36;
 background:radial-gradient(ellipse 44% 56% at 51% 64%,#fff3ee32,transparent 87%),linear-gradient(0deg,#2110242d,transparent 33%);
}
.scene .hero-image{
 z-index:2;left:50%;width:min(100%,490px);
 height:129%;bottom:-22%;top:auto;transform:translateX(-50%);
 object-fit:contain;object-position:center bottom;
 filter:drop-shadow(1px 8px 9px #1e18374a);
 transition:opacity .16s,filter .24s;
}
.scene.uneasy .hero-image{filter:saturate(.88) brightness(.94) drop-shadow(1px 8px 9px #1b17366b)}
.scene.danger .hero-image{filter:saturate(.72) brightness(.84) drop-shadow(1px 8px 11px #11142985)}
.scene-ribbon{
 z-index:5;top:75px;right:clamp(12px,2vw,34px);
 display:flex;align-items:center;justify-content:center;gap:4px;
 max-width:38%;min-height:29px;padding:5px 10px;
 background:rgba(22,27,47,.73);border:1px solid #e4d3e487;
 border-radius:5px;box-shadow:0 4px 16px #12152b2b;
 color:#f8f1f6;font:700 clamp(10px,.85vw,12px)/1.22 var(--sans);
 backdrop-filter:blur(7px);-webkit-backdrop-filter:blur(7px);
 text-align:center;
}
.scene-ribbon.safe{background:rgba(29,61,74,.75);border-color:#add9e4bb;color:#f0fcff}
.scene-ribbon.danger{background:rgba(96,29,52,.86);border-color:#ffb9cbbd;color:#fff6f9}
/* One operating hint, only while manipulating the food. */
.scene-tip{
 display:block;position:absolute;z-index:6;
 bottom:clamp(12px,2.1vh,23px);left:50%;right:auto;
 transform:translateX(-50%);width:max-content;max-width:calc(100% - 26px);
 margin:0;padding:6px 14px;
 background:rgba(17,23,45,.72);border:1px solid #ede1eca1;
 border-radius:5px;box-shadow:0 4px 16px #1010233a;
 font:700 clamp(11px,2.7vw,14px)/1.28 var(--serif);
 text-align:center;white-space:normal;pointer-events:none;
 opacity:0;visibility:hidden;transition:opacity .18s,visibility .18s;
 backdrop-filter:blur(5px);
}
.shell[data-mode="play"] .scene-tip{opacity:.95;visibility:visible}
.drag-hint{display:none!important}
/* The existing transparent tabletop has NO opaque fill and no top/bottom bars. */
.food-zone{
 position:relative;z-index:3;isolation:isolate;
 flex:0 0 clamp(154px,22dvh,213px);height:clamp(154px,22dvh,213px);
 margin-top:-25px;overflow:visible;background:transparent;
 border:0!important;box-shadow:none!important;
}
.food-zone::before,.food-zone::after{display:none!important}
.table-photo{position:absolute;inset:0;display:block;z-index:0;width:100%;left:0;right:0;transform:none;opacity:1;pointer-events:none}
.table-photo img{width:100%;height:100%;object-fit:cover;object-position:center 31%}
.food-zone-header{
 position:absolute;z-index:7;top:1px;left:clamp(12px,2vw,27px);
 width:auto;max-width:calc(100% - 24px);margin:0;height:32px;
 display:flex;justify-content:flex-start;align-items:center;
 gap:clamp(9px,2vw,27px);padding:4px 12px;
 border:1px solid rgba(242,222,237,.6);border-radius:5px;
 background:rgba(18,24,46,.77);box-shadow:0 4px 14px #1415233d;
 font:700 clamp(12px,2.95vw,14px)/1.3 var(--sans);text-shadow:none;
 letter-spacing:.01em;backdrop-filter:blur(8px);
}
.food-zone-header #courseName{font-weight:800;color:#fff8fe}
.food-zone-header #bitesLabel{font-weight:650;color:#f2dce9;font-variant-numeric:tabular-nums}
.food-bench{width:100%;height:100%;margin:0;position:relative}
.food-plate{z-index:3}
.food-plate img{filter:drop-shadow(0 3px 3px #1b15187a)}
.drag-piece{z-index:4;filter:drop-shadow(0 3px 4px #2117197a);touch-action:none}
.drag-piece.dragging{filter:brightness(1.085) drop-shadow(0 12px 9px #1a101dae)}
.food-bench.drag-active:not(.returning)::after{font-size:22px;bottom:2px;color:#fff4fa}
/* Floating VN dialogue with fixed outer height on every page. */
.dialog{
 position:relative;z-index:7;align-self:center;
 width:calc(100% - 18px);max-width:1110px;
 flex:0 0 clamp(126px,17dvh,154px);height:clamp(126px,17dvh,154px);
 margin:-12px auto 12px;padding:11px clamp(13px,2vw,24px) 8px;
 border:1px solid rgba(255,234,246,.77);border-radius:7px;
 background:linear-gradient(135deg,rgba(23,29,56,.88),rgba(19,25,46,.86));
 box-shadow:var(--glass-shadow),inset 0 0 0 1px #a8a7c94d,inset 0 1px 0 #ffffff26;
 color:#f9f3fa;cursor:pointer;touch-action:manipulation;
 backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px);
}
.dialog::before,.dialog::after{
 content:"";position:absolute;z-index:1;pointer-events:none;
 width:17px;height:17px;opacity:.65;
 border-color:#f3cce2;
}
.dialog::before{left:5px;top:5px;border-top:1px solid;border-left:1px solid}
.dialog::after{right:5px;bottom:5px;border-right:1px solid;border-bottom:1px solid}
.dialog-head{height:23px;display:flex;align-items:center;gap:14px}
.dialog-head #speaker{
 min-width:76px;height:24px;padding:3px 12px;display:inline-flex;align-items:center;
 border:1px solid #efc4db86;border-radius:3px;
 background:rgba(130,74,111,.64);box-shadow:inset 0 1px 0 #ffffff2b;
 font:800 clamp(12px,2.65vw,14px)/1 var(--sans);letter-spacing:.04em;
}
.dialog-count{color:#d1c5d7;font:650 11px/1.2 var(--sans);opacity:.7}
.dialog .dialog-text{
 height:calc(100% - 35px);padding:10px 4px 0;overflow:hidden;
 font-family:var(--serif);font-weight:900;
 font-size:clamp(18px,4.65vw,24px);line-height:1.41;
 letter-spacing:.018em;color:#f9f5fa;
 white-space:pre-wrap;word-break:normal;overflow-wrap:anywhere;
}
.dialog-text.suspicious{color:#e8eafa}
.dialog-text.evil{color:#ff8296}
.advance{position:absolute;right:17px;bottom:9px;height:16px;color:#ead6e6;opacity:.72;font-size:0;line-height:1}
.advance span{display:none!important}
.dialog:not(.playing) .advance::after{
 content:"";display:block;width:10px;height:10px;
 background:#f3c6dc;transform:rotate(45deg);
 border:1px solid #fff1f7;box-shadow:0 0 7px #ffbdd86d;
 animation:nav-diamond 1.05s infinite ease-in-out alternate;
}
.dialog.playing .advance{display:none}
@keyframes nav-diamond{to{opacity:.48;transform:translateY(3px) rotate(45deg)}}
/* Consistent panel and button visual language: no thick bevels. */
.modal-screen{background:linear-gradient(155deg,#161b30,#23233d);color:#f5ebf6}
.modal-head{background:rgba(25,29,51,.93);border-bottom:1px solid #f2d9e33d}
.close-btn,.lightbox-close,.zoom-btn{
 border:1px solid #f0d9e087;border-radius:5px;
 background:rgba(40,44,70,.96);box-shadow:inset 0 1px 0 #ffffff27;
 color:#fff7fc;
}
.records-list{gap:10px}
.record{background:rgba(35,39,66,.78);border:1px solid #b9acc567;border-radius:5px;box-shadow:0 7px 20px #07091818}
.record:disabled{opacity:.75}
.locked-img{background:#171e32;border:1px solid #b8aabb52;color:#c9bdd2}
#endModal{background:linear-gradient(145deg,#1a1d34,#292440)}
#endModal .modal-head{background:transparent}
#endModal .end-body{max-width:1050px}
#endModal .end-name{letter-spacing:.015em;font-weight:900}
#endModal .end-story{background:rgba(20,25,46,.76);border:1px solid #e9cce39c;border-radius:5px;box-shadow:none}
#endModal .end-card-display{background:rgba(14,18,34,.66);border:1px solid var(--end-accent,#e6bfd8);border-radius:5px;box-shadow:0 8px 22px #080a1980}
#endModal .end-card-display .end-hero{border-radius:3px}
#endModal .end-actions{gap:7px}
#endModal .main-button{
 border:1px solid #f7dcecb5;border-radius:5px;
 min-height:44px;background:rgba(50,53,83,.76);box-shadow:none;
 font-family:var(--serif);font-weight:900;
}
#endModal .main-button:not(.secondary):not(.ghost){
 background:linear-gradient(110deg,#b04d80,#83436f);box-shadow:0 6px 16px #170a205e;
 border-color:#f7c8e5b8;
}
#endModal[data-ending="02"] .main-button:not(.secondary):not(.ghost){background:linear-gradient(110deg,#6e65b5,#4e4a89)}
#endModal[data-ending="03"] .main-button:not(.secondary):not(.ghost){background:linear-gradient(110deg,#a74862,#722d49)}
#endModal .main-button.secondary,#endModal .main-button.ghost{background:rgba(30,36,61,.78);box-shadow:none}
#recordsModal .record{border-radius:5px;box-shadow:none}
#recordsModal .record:not(:disabled):hover{border-color:#ffe2f0;background:#383452}
#recordsModal .locked-img{background:#161b31}
/* Desktop: scene is full-bleed, dialogue floats in the center, HUD hugs its sides. */
@media(min-width:900px) and (orientation:landscape){
 .shell{max-width:none}
 .topbar{height:54px;min-height:54px;top:14px;left:clamp(28px,4vw,75px);right:clamp(28px,4vw,75px);padding-inline:18px}
 .topmini{font-size:15px;gap:15px}
 .topmini #stageLabel{font-size:23px}
 .mini-btn{min-width:64px;height:42px;min-height:42px;font-size:13px}
 .scene{min-height:0}
 .scene .hero-image{width:min(44vw,660px);height:143%;bottom:-38%;object-fit:contain}
 .scene-glow{opacity:.34}
 .scene-ribbon{top:86px;right:clamp(34px,5vw,92px);font-size:12px;min-height:31px}
 .scene-tip{bottom:clamp(18px,2.2vh,34px);font-size:14px}
 .food-zone{flex-basis:clamp(154px,18.8dvh,200px);height:clamp(154px,18.8dvh,200px);margin-top:-34px}
 .table-photo img{object-position:center 29%}
 .food-zone-header{left:clamp(34px,5vw,92px);top:-4px;height:37px;padding:4px 17px;gap:20px;font-size:15px;width:auto;max-width:min(650px,70vw);border-radius:5px}
 .food-bench{height:100%;width:100%;margin:0}
 .food-plate{width:min(39vw,490px);left:50%;transform:translateX(-50%)}
 .dialog{width:min(1120px,calc(100% - 150px));flex-basis:clamp(144px,15.5dvh,170px);height:clamp(144px,15.5dvh,170px);margin:-7px auto 21px;padding:13px 25px 10px}
 .dialog-head{height:26px}
 .dialog-head #speaker{min-width:90px;font-size:15px}
 .dialog .dialog-text{height:calc(100% - 38px);font-size:clamp(25px,1.58vw,32px);line-height:1.35;padding:9px 5px 0;max-width:1010px}
 .dialog .advance{right:25px;bottom:10px}
 .modal-screen{padding-inline:clamp(16px,4vw,80px)}
}
/* Small and medium portrait sizes use the same components without splitting into bands. */
@media(max-width:899px), (orientation:portrait){
 .topbar{left:8px;right:8px;top:calc(env(safe-area-inset-top) + 8px);padding:4px 7px 4px 10px;height:47px;min-height:47px}
 .topmini{gap:5px;font-size:clamp(10px,2.9vw,13px)}
 .topmini #stageLabel{font-size:clamp(15px,4vw,20px)}
 .topactions{gap:3px}
 .mini-btn{height:38px;min-height:38px;padding:5px 7px;min-width:38px;font-size:clamp(10px,2.8vw,12px)}
 .restart-mini{padding-inline:7px}
 .scene .hero-image{width:min(99%,480px);height:129%;bottom:-20%}
 .scene-ribbon{top:64px;right:12px;max-width:48%;padding:5px 8px;font-size:clamp(10px,2.8vw,12px)}
 .scene-tip{font-size:clamp(11px,3vw,13px);max-width:calc(100% - 24px);bottom:15px}
 .food-zone{flex-basis:clamp(150px,22.8dvh,196px);height:clamp(150px,22.8dvh,196px);margin-top:-20px}
 .food-zone-header{left:10px;top:0px;height:30px;max-width:calc(100% - 20px);padding:3px 10px;gap:10px;font-size:clamp(11px,2.7vw,13px)}
 .food-bench{height:100%}
 .food-plate{width:67%;height:120%;left:50%;top:-14%;transform:translateX(-50%)}
 .dialog{width:calc(100% - 16px);height:clamp(122px,17.2dvh,148px);flex-basis:clamp(122px,17.2dvh,148px);margin:-4px auto 10px;padding:9px 12px 7px}
 .dialog-head{height:22px}
 .dialog-head #speaker{height:22px;min-width:70px;font-size:12px}
 .dialog .dialog-text{height:calc(100% - 31px);font-size:clamp(17px,4.6vw,21px);line-height:1.39;padding:6px 4px 0;letter-spacing:0}
 .dialog .advance{right:13px;bottom:8px}
}
@media(max-width:360px){
 .topbar{left:6px;right:6px;gap:3px;padding-left:6px;padding-right:5px}
 .heartmark{font-size:12px}
 .topmini{gap:3px;font-size:10px}
 .topmini #stageLabel{font-size:15px}
 .mini-btn{min-width:35px;padding:4px 5px;font-size:10px}
 .dialog .dialog-text{font-size:16.5px;line-height:1.34}
 .dialog-count{font-size:10px}
}
@media(max-height:650px){
 .topbar{height:40px;min-height:40px;top:calc(env(safe-area-inset-top) + 5px)}
 .mini-btn{height:34px;min-height:34px}
 .scene-ribbon{top:50px;padding:4px 7px;min-height:24px}
 .scene-tip{bottom:7px;font-size:11px;padding:4px 8px}
 .food-zone{flex-basis:clamp(112px,22dvh,148px);height:clamp(112px,22dvh,148px);margin-top:-8px}
 .food-zone-header{height:26px;font-size:11px;top:0}
 .dialog{flex-basis:clamp(101px,22dvh,128px);height:clamp(101px,22dvh,128px);margin:-2px auto 6px;padding:6px 10px 4px}
 .dialog-head{height:20px}
 .dialog-head #speaker{height:20px;font-size:11px}
 .dialog .dialog-text{height:calc(100% - 26px);font-size:clamp(14px,3.9vw,18px);line-height:1.23;padding:3px 3px 0}
 .dialog .advance{bottom:4px}
}
@media(min-width:900px) and (orientation:landscape) and (max-height:800px){
 .scene .hero-image{width:min(46vw,620px);height:154%;bottom:-48%}
 .food-zone{flex-basis:clamp(120px,20.2dvh,160px);height:clamp(120px,20.2dvh,160px)}
 .dialog{flex-basis:clamp(118px,19dvh,142px);height:clamp(118px,19dvh,142px);margin-bottom:10px}
 .dialog .dialog-text{font-size:clamp(19px,1.6vw,25px);line-height:1.31}
}
@media(max-height:450px) and (orientation:landscape){
 .topbar{height:34px;min-height:34px;top:3px}
 .mini-btn{height:29px;min-height:29px;font-size:10px}
 .scene-ribbon{top:39px}
 .scene-tip{bottom:2px;padding:2px 7px;font-size:10px}
 .food-zone{flex-basis:clamp(92px,23dvh,116px);height:clamp(92px,23dvh,116px);margin-top:-4px}
 .food-zone-header{height:24px;font-size:10px}
 .dialog{flex-basis:clamp(90px,24dvh,109px);height:clamp(90px,24dvh,109px);margin-bottom:4px;padding:4px 9px}
 .dialog-head{height:18px}
 .dialog-head #speaker{height:17px;font-size:10px}
 .dialog .dialog-text{height:calc(100% - 22px);font-size:clamp(13px,2.5vw,17px);line-height:1.18;padding:2px 3px 0}
}
@media(prefers-reduced-motion:reduce){
 .dialog:not(.playing) .advance::after{animation:none}
 .mini-btn{transition:none}
}
/* Final optical alignment and single operation caption, visually anchored to the meal. */
.food-zone .scene-tip{
 position:absolute;z-index:9;top:-32px;bottom:auto;right:clamp(10px,2vw,27px);
 left:auto;transform:none;width:auto;max-width:45%;min-height:25px;
 padding:5px 9px;font:700 clamp(10px,2.6vw,12px)/1.28 var(--serif);
 background:rgba(18,24,46,.79);border:1px solid rgba(239,226,240,.6);
 border-radius:5px;white-space:normal;
}
.food-zone .food-plate img{scale:1.1;transition:filter .16s}
.food-zone .drag-piece{scale:.89}
@media(min-width:900px) and (orientation:landscape){
 .food-zone .scene-tip{top:-34px;right:clamp(35px,5vw,92px);max-width:280px;padding:6px 12px;font-size:13px}
 .food-zone .drag-piece{scale:.94}
 .food-zone .food-plate img{scale:1.08}
}
@media(max-width:430px){.food-zone .scene-tip{font-size:10.5px;max-width:48%;top:-29px}}
@media(max-height:650px){.food-zone .scene-tip{top:-25px;padding:3px 7px;min-height:20px}}
/* A full instruction is only needed before the first successful discard. */
.shell.has-discard .food-zone .scene-tip{font-weight:650;letter-spacing:.025em;padding-inline:9px}

/* 平成ホラーゲーム演出：既存画像・操作レイヤー・当たり判定は変更しない。
   All optical overlays ignore input. Dramatic flashes are brief and disabled by
   reduced-motion preferences. The story, timers, and hit testing remain unchanged. */
.fx-overlay,.stage-sting{position:absolute;inset:0;pointer-events:none;user-select:none}
.fx-overlay{z-index:23;overflow:hidden;isolation:isolate}
.fx-overlay::before,.fx-overlay::after{content:"";position:absolute;inset:0;opacity:0;pointer-events:none}
.stage-sting{inset:auto;left:50%;top:38%;width:max-content;max-width:92%;z-index:23;
 transform:translate(-50%,-50%);opacity:0;
 font:900 clamp(48px,10vw,154px)/1 var(--serif);letter-spacing:.05em;
 color:#fff1f7;text-shadow:0 3px 0 #39204f,0 0 20px #ffd2f2,0 0 42px #d5679d;}
.shell.fx-course .stage-sting{animation:arcade-stage-title .65s cubic-bezier(.12,.8,.3,1) both}
.shell[data-course="4"].fx-course .stage-sting,.shell[data-course="5"].fx-course .stage-sting{
 color:#ffd6eb;text-shadow:0 4px 0 #4c1025,0 0 22px #f4195a,0 0 48px #871448;}
@keyframes arcade-stage-title{0%{opacity:0;transform:translate(-50%,-50%) scale(1.5);filter:blur(10px)}
 17%{opacity:.92;filter:blur(0)}63%{opacity:.83;transform:translate(-50%,-50%) scale(1)}
 100%{opacity:0;transform:translate(-50%,-50%) scale(.93)}}
/* 01 welcome / 03 plate / 04 glance, with comic-book streaks rather than new art. */
.shell.fx-intro .fx-overlay::before{background:
 radial-gradient(circle at 29% 38%,#fff9 0 2px,transparent 4px),
 radial-gradient(circle at 72% 27%,#fff9 0 3px,transparent 6px),
 radial-gradient(circle at 54% 61%,#ffe6ff 0 3px,transparent 7px),
 radial-gradient(circle at 84% 64%,#fff9 0 2px,transparent 6px),
 repeating-conic-gradient(from 10deg at 50% 45%,#ffdbfb80 0deg 4deg,transparent 4deg 22deg);
 animation:arcade-spark .8s ease-out both}
.shell.fx-course .fx-overlay::before{background:radial-gradient(ellipse 25% 30% at 50% 65%,#fff6ffb8,transparent 75%);
 animation:arcade-spark .62s ease-out both}
@keyframes arcade-spark{0%{opacity:0;transform:scale(.65)}20%{opacity:.83}100%{opacity:0;transform:scale(1.26)}}
.shell.fx-glance .fx-overlay::before{background:radial-gradient(ellipse 27% 22% at 50% 77%,transparent 30%,#fff7e9b0 38%,transparent 55%);
 animation:arcade-chance .32s ease-out both}
@keyframes arcade-chance{0%{opacity:0;transform:scale(.73)}38%{opacity:.86}100%{opacity:0;transform:scale(1.28)}}
/* 02 Dialogue letters stay readable and do not shift the fixed-size window. */
.dialog .dialog-text.line-enter{animation:arcade-line .23s ease-out}
.dialog .dialog-text.line-enter.suspicious{text-shadow:0 0 9px #a5b6ff7a}
.dialog .dialog-text.line-enter.evil{text-shadow:0 0 12px #f34b68c0}
.dialog:has(.line-enter) .dialog-head #speaker{animation:arcade-name .32s ease-out}
@keyframes arcade-line{from{opacity:.22;filter:brightness(1.6)}to{opacity:1;filter:none}}
@keyframes arcade-name{0%,100%{box-shadow:inset 0 1px 0 #ffffff2b}40%{box-shadow:0 0 14px #ffe1f0, inset 0 0 8px #fff8}}
/* 05 Carrying food: color shifts only; no element moves under the pointer. */
.shell.holding-food .fx-overlay::before{opacity:1;background:radial-gradient(ellipse 72% 67% at 50% 58%,transparent 46%,#7d092b54 100%);
 animation:arcade-heart-vignette .82s ease-in-out infinite alternate}
@keyframes arcade-heart-vignette{from{opacity:.44}to{opacity:.78}}
.shell.holding-food .drag-piece{filter:brightness(1.13) drop-shadow(0 13px 11px #1d0a1fbc)}
/* 06 The drop produces a short lower-edge arcade streak. */
.shell.fx-drop .fx-overlay::after{background:
 linear-gradient(7deg,transparent 60%,#fff0 76%,#fff8 81%,transparent 85%),
 repeating-linear-gradient(164deg,transparent 0 17px,#f7d7f07a 18px 21px,transparent 22px 48px);
 clip-path:polygon(0 69%,100% 69%,100% 100%,0 100%);
 animation:arcade-discard .34s ease-out both}
@keyframes arcade-discard{0%{opacity:.05;transform:translateY(22px) scaleY(.3)}35%{opacity:.9}100%{opacity:0;transform:translateY(-8px) scaleY(1)}}
/* 07 feint, 08 turning slash; neither touches geometry. */
.shell.fx-feint .fx-overlay::before{background:linear-gradient(180deg,#18162b24,#1112217d);animation:arcade-feint .24s steps(2,end) both}
@keyframes arcade-feint{0%,100%{opacity:0}36%{opacity:.65}}
.shell.fx-turn .fx-overlay::after{background:linear-gradient(120deg,transparent 42%,#fa164877 47%,#ffe9f2bc 49%,#ff1a537c 51%,transparent 56%);
 animation:arcade-slash .31s cubic-bezier(.24,.75,.2,1) both}
@keyframes arcade-slash{0%{opacity:0;transform:translateX(-35%)}42%{opacity:.75}100%{opacity:0;transform:translateX(35%)}}
/* 09 glitch and 10 fixed facial spotlight. The scene never gets a transform. */
.shell.fx-glitch .fx-overlay::before,.shell.fx-ending-glitch .fx-overlay::before{
 background:repeating-linear-gradient(180deg,transparent 0 8px,#7fafe454 9px 11px,transparent 12px 20px);
 mix-blend-mode:screen;animation:arcade-digital .41s steps(5,end) both}
@keyframes arcade-digital{0%,100%{opacity:0;transform:translateX(0)}16%{opacity:.62;transform:translateX(5px)}32%{opacity:0}58%{opacity:.35;transform:translateX(-4px)}}
.shell.fx-stare .fx-overlay::after{background:radial-gradient(ellipse 28% 27% at 50% 35%,transparent 28%,#10091dba 100%);
 animation:arcade-stare .6s ease-in-out both}
@keyframes arcade-stare{0%,100%{opacity:0}35%{opacity:.63}}
/* 11–12–17 escalating catches, blur only while the player cannot drag. */
.shell.fx-caught1 .fx-overlay::after,.shell.fx-caught2 .fx-overlay::after{
 background:repeating-linear-gradient(160deg,transparent 0 36px,#ff34547a 37px 40px,transparent 41px 75px);
 animation:arcade-caught .67s ease-out both}
.shell.fx-caught2 .fx-overlay::before{background:linear-gradient(100deg,#4b41ad36,transparent 32%,#ff4b9270 54%,transparent 74%);
 animation:arcade-caught .95s both}
@keyframes arcade-caught{0%{opacity:0;transform:scale(1.18)}17%{opacity:.82}100%{opacity:0;transform:scale(1)}}
.shell.fx-caught3 .fx-overlay::after{background:radial-gradient(circle at 50% 45%,#fff2f05c,transparent 21%,#fa0b4b9c 85%);
 animation:arcade-caught .65s both}
/* 14 fourth-course silence and 15 CRT scanlines: unobtrusive persistent texture. */
.shell.fx-silent-cut .fx-overlay::before{background:#100e20;animation:arcade-silence .75s both}
@keyframes arcade-silence{0%{opacity:0}19%{opacity:.86}30%{opacity:.86}100%{opacity:0}}
.shell:is([data-course="4"],[data-course="5"]) .scene::before{
 content:"";position:absolute;inset:0;z-index:3;pointer-events:none;
 background:repeating-linear-gradient(180deg,transparent 0 3px,#10152520 4px 5px,transparent 6px 8px);
 opacity:.24;mix-blend-mode:multiply}
.shell[data-course="5"] .scene::before{opacity:.38}
/* 16 final course: slow anxious pulse, with all food and dialog still crisp. */
.shell.fx-final-enter .fx-overlay::before{background:radial-gradient(ellipse at 50% 42%,transparent 27%,#5e053e95 100%);
 animation:arcade-final-enter .8s ease-out both}
@keyframes arcade-final-enter{0%{opacity:0}18%{opacity:.7}40%{opacity:.27}68%{opacity:.57}100%{opacity:0}}
.shell[data-course="5"][data-mode="play"]:not(.holding-food) .scene-glow{
 animation:arcade-final-breathe 2.2s ease-in-out infinite alternate}
@keyframes arcade-final-breathe{to{opacity:.7;filter:saturate(.5) brightness(.8)}}
/* 18–20 Ending stills use only their existing assets. */
.shell.fx-end-shatter .end-scene .ending-vignette{animation:arcade-end-shatter .94s steps(3,end) both}
@keyframes arcade-end-shatter{0%,100%{filter:none}24%{filter:hue-rotate(55deg) saturate(1.8)}43%{filter:hue-rotate(-18deg) contrast(1.35)}67%{filter:grayscale(.5)}}
.shell.fx-waking .end-scene .ending-art img{animation:arcade-waking 1.05s ease-out both}
@keyframes arcade-waking{0%{filter:blur(12px) brightness(.35)}36%{filter:blur(5px) brightness(1.4)}100%{filter:none}}
.shell.fx-lock .end-scene .ending-window{animation:arcade-lock-window .5s ease-out both}
@keyframes arcade-lock-window{0%{filter:brightness(1)}28%{filter:brightness(2) saturate(1.7)}100%{filter:none}}
.shell.fx-result #endModal:not([hidden]) .end-card-display{animation:arcade-card .65s ease-out both}
@keyframes arcade-card{0%{opacity:.3;filter:brightness(1.7)}100%{opacity:1;filter:none}}
/* Motion reduction takes precedence over every decorative effect, including continuous ones. */
@media(prefers-reduced-motion:reduce){
 .fx-overlay::before,.fx-overlay::after,.stage-sting,.dialog .dialog-text.line-enter,
 .dialog:has(.line-enter) .dialog-head #speaker,.shell[data-course="5"] .scene-glow,
 .shell.fx-end-shatter .end-scene .ending-vignette,.shell.fx-waking .end-scene .ending-art img,
 .shell.fx-lock .end-scene .ending-window,.shell.fx-result #endModal .end-card-display{
  animation:none!important;opacity:0!important;filter:none!important}
 .dialog .dialog-text.line-enter,.dialog:has(.line-enter) .dialog-head #speaker,
 .shell.fx-waking .end-scene .ending-art img,.shell.fx-lock .end-scene .ending-window,
 .shell.fx-result #endModal .end-card-display{opacity:1!important}
 .shell.holding-food .drag-piece{filter:drop-shadow(0 3px 4px #2117197a)}
}

/* Desktop tabletop balance (PC only).
   Keep the full-bleed room background and the existing food interaction.
   The translucent tabletop art no longer occupies the entire window width. */
@media (min-width:900px) and (orientation:landscape) {
  .food-zone {
    flex-basis:clamp(130px,15dvh,160px);
    height:clamp(130px,15dvh,160px);
    margin-top:-20px;
  }
  .table-photo {
    left:6%;
    right:auto;
    width:88%;
  }
  .table-photo img {object-position:center 23%;}
  .food-plate {height:152%;top:-24%;}
}

/* Dining-layout correction: use the table artwork's actual aspect ratio on PC.
   The tabletop remains a separate layer; food drag coordinates are unchanged. */
@media (min-width:900px) and (orientation:landscape){
  .scene .hero-image{
    width:min(35vw,520px);
    height:132%;
    bottom:-12%;
  }
  .food-zone{
    flex:0 0 clamp(142px,18dvh,190px);
    height:clamp(142px,18dvh,190px);
    margin-top:-8px;
    z-index:4;
  }
  .table-photo{
    top:auto;
    bottom:-24px;
    left:50%;right:auto;
    width:clamp(540px,42vw,700px);
    height:auto;
    aspect-ratio:1920 / 760;
    transform:translateX(-50%);
    overflow:visible;
  }
  .table-photo img{
    width:100%;height:100%;display:block;
    object-fit:fill;object-position:center center;
  }
  .food-plate{
    width:min(34vw,420px);
    height:142%;top:-20%;left:50%;
    transform:translateX(-50%);
  }
  .food-zone-header{top:8px}
  .dialog{margin:-2px auto 12px}
}

/* Fine PC correction: a two-seat table with visible wooden supports.
   Supports are CSS only, behind the original tabletop, and never take pointer events. */
@media (min-width:900px) and (orientation:landscape){
  .table-photo{
    width:clamp(520px,38vw,640px);
    bottom:-20px;
    isolation:isolate;
  }
  .table-photo::before,.table-photo::after{
    content:"";position:absolute;top:75%;height:65%;
    width:clamp(18px,2vw,26px);z-index:0;
    pointer-events:none;
    background:linear-gradient(90deg,#5d3018,#ad7440 30%,#9a5a2e 75%,#5b2a15);
    border:1px solid #6c401f;
    box-shadow:inset 2px 0 2px #d9a1637d,3px 7px 11px #25170d50;
  }
  .table-photo::before{left:4.5%}
  .table-photo::after{right:4.5%}
  .table-photo img{position:relative;z-index:1}
  .food-plate{top:-28%}
  #piece{margin-top:-14px}
}

/* Headroom at shorter desktop heights: no hair hidden behind the top HUD. */
@media (min-width:900px) and (orientation:landscape) and (max-height:850px){
  .scene .hero-image{width:min(28vw,330px);height:112%;bottom:-15%}
}
@media (min-width:900px) and (orientation:landscape) and (min-height:851px) and (max-height:960px){
  .scene .hero-image{width:min(30.5vw,440px);height:124%;bottom:-12%}
}
@media (min-width:900px) and (orientation:landscape) and (min-height:961px){
  .food-zone{transform:translateY(-30px)}
  .scene .hero-image{bottom:-7%}
}

/* v22: use the two completed user-supplied dining furniture assets.
   Only landscape PC layout changes; preserve mobile art, interaction and story. */
.chair-photo{display:none}
@media (min-width:900px) and (orientation:landscape){
  .scene .chair-photo{
    display:block;position:absolute;z-index:2;left:50%;
    top:clamp(218px,33dvh,358px);bottom:auto;
    width:clamp(230px,38dvh,410px);height:auto;
    transform:translateX(-50%);object-fit:contain;
    pointer-events:none;user-select:none;
    filter:drop-shadow(0 8px 6px #25160e40);
  }
  .scene .hero-image{z-index:3}
  .table-photo{
    left:50%;right:auto;top:auto;bottom:-72px;
    transform:translateX(-50%);width:clamp(495px,32vw,620px);
    height:auto;aspect-ratio:1536/1024;
    overflow:visible;isolation:auto;
  }
  .table-photo::before,.table-photo::after{content:none!important}
  .table-photo img{
    display:block;position:relative;z-index:1;
    width:100%;height:100%;object-fit:contain;object-position:center;
  }
  .food-plate{top:calc(-28% - 16.667dvh + 10px)}
  .food-plate img{scale:.44}
  #piece{margin-top:calc(-5px - 16.667dvh);scale:.66}
  #foodZone[data-stage="5"] #piece{scale:.80}
}

/* PC dining composition — user-supplied wooden table, chair and character.
   Preserve the full-room photo and all mobile/tablet layout rules.
   Natural PNG ratios, grounded legs, one shared axis for plate/meal/hit target. */
@media(min-width:900px) and (orientation:landscape){
  .food-zone{
    transform:none;flex:0 0 clamp(142px,17.6dvh,190px);
    height:clamp(142px,17.6dvh,190px);
    margin-top:-8px;overflow:visible;z-index:4;
  }
  .table-photo{
    position:absolute;left:50%;right:auto;top:auto;bottom:-21px;
    width:400px;height:auto;aspect-ratio:1536/1024;
    transform:translateX(-50%);overflow:visible;pointer-events:none;
  }
  .table-photo img{
    display:block;position:relative;z-index:1;
    width:100%;height:100%;object-fit:contain;object-position:center;
    filter:drop-shadow(0 9px 12px rgba(45,26,13,.24));
  }
  .table-photo::before,.table-photo::after{content:none!important}
  .scene .hero-image{
    width:clamp(345px,24vw,455px);height:125%;bottom:-8%;z-index:3;
    clip-path:inset(0 0 16% 0);
    filter:drop-shadow(1px 7px 9px #1e18374a);
  }
  .scene .chair-photo{
    display:block;position:absolute;z-index:2;left:50%;
    top:clamp(230px,26dvh,320px);bottom:auto;
    width:clamp(350px,37dvh,435px);height:auto;
    transform:translateX(-50%);object-fit:contain;
    pointer-events:none;user-select:none;
    clip-path:inset(0 0 52% 0);
    filter:drop-shadow(0 3px 4px #25160e30);
  }
  .food-plate{
    left:50%;top:-133px;width:190px;height:190px;
    transform:translateX(-50%);pointer-events:none;
  }
  .food-plate img{
    display:block;width:100%;height:100%;object-fit:contain;
    scale:1!important;transform:none!important;
    filter:drop-shadow(0 4px 4px rgba(40,25,16,.37));
  }
  #piece,#piece.returning,#foodZone[data-stage="5"] #piece{scale:1!important}
  .food-zone-header{
    position:fixed;top:77px;left:clamp(28px,4vw,75px);
    max-width:min(500px,60vw);height:33px;font-size:14px;
    pointer-events:none;
  }
  .food-zone .scene-tip{
    position:fixed;top:79px;
    left:calc(50% + clamp(150px,13vw,220px));
    right:auto;bottom:auto;max-width:230px;
    transform:none;font-size:12px;text-align:left;pointer-events:none;
  }
  .dialog{margin:-2px auto 12px}
}
@media(min-width:900px) and (orientation:landscape) and (max-height:830px){
  .scene .hero-image{
    width:clamp(295px,26vw,360px);height:117%;bottom:-15%;
    clip-path:inset(0 0 20% 0);
  }
  .scene .chair-photo{
    top:clamp(190px,28dvh,270px);
    width:clamp(265px,37dvh,330px);
  }
  .table-photo{width:420px;bottom:-12px}
  .food-plate{top:-165px;width:170px;height:170px}
}
@media(min-width:900px) and (orientation:landscape) and (min-height:961px){
  .table-photo{width:480px;bottom:-13px}
  .food-plate{top:-151px}
}

/* PC dining composition — one continuous foreground dining table.
   Retain the supplied furniture photos, all mobile styles and all game mechanics.
   Never crop the heroine at the scene/food-zone seam. */
@media (min-width:900px) and (orientation:landscape) {
  .shell { position:relative; }
  .scene {
    position:absolute; inset:0; width:100%; height:100%;
    min-height:0; flex:none; overflow:visible;
    isolation:auto; z-index:1; pointer-events:none;
  }
  .scene .hero-image {
    position:absolute; z-index:3;
    left:50%; top:10.1dvh; bottom:auto;
    width:min(34vw,50dvh); height:auto;
    max-height:none; object-fit:contain; object-position:center top;
    transform:translateX(-50%); clip-path:none;
    filter:drop-shadow(1px 7px 8px rgba(27,14,30,.25));
  }
  .scene .chair-photo {
    display:block; position:absolute; z-index:2;
    left:50%; top:21dvh; bottom:auto;
    width:min(22vw,29dvh); height:auto;
    transform:translateX(-50%); clip-path:none;
    object-fit:contain; pointer-events:none;
  }
  .scene-ribbon { top:76px; }
  .food-zone {
    position:absolute; top:45.8dvh; left:0; right:0;
    width:100%; height:24dvh; flex:none;
    margin:0; transform:none; overflow:visible;
    background:transparent; isolation:auto; z-index:4;
    pointer-events:none;
  }
  .food-zone .food-bench {
    position:relative; width:100%;height:100%;margin:0;
    display:block;pointer-events:none;
  }
  .table-photo {
    display:block; position:absolute; z-index:1;
    left:50%; top:0; right:auto; bottom:auto;
    width:min(70vw,112dvh); height:auto;
    aspect-ratio:1536 / 1024;
    transform:translateX(-50%);
    opacity:1; pointer-events:none; overflow:visible;
  }
  .table-photo img {
    display:block;width:100%;height:100%;object-fit:contain;
    object-position:center center;filter:drop-shadow(0 7px 12px #351b1438);
  }
  .table-photo::before,.table-photo::after {content:none!important;}
  .food-plate {
    position:absolute; z-index:3;
    left:50%;top:clamp(25px,4.5dvh,50px);
    width:clamp(160px,23dvh,255px);
    height:clamp(160px,23dvh,255px);
    margin:0;transform:translateX(-50%);pointer-events:none;
  }
  .food-plate img {
    width:100%;height:100%;scale:1!important;
    transform:none!important;filter:drop-shadow(0 4px 4px #2e1a1255);
  }
  #piece,#piece.returning,#foodZone[data-stage="5"] #piece {
    position:absolute;z-index:5;scale:1!important;
    max-width:none;margin:0;object-fit:contain;
    pointer-events:auto;touch-action:none;
  }
  .food-zone-header {
    position:fixed; top:78px; left:clamp(24px,4vw,75px);
    width:auto; max-width:calc(50vw - 40px); height:33px;
    z-index:7; pointer-events:none;
  }
  .food-zone .scene-tip {
    position:fixed;top:80px;left:calc(50% + clamp(125px,12vw,200px));
    right:auto;bottom:auto;max-width:230px;
    transform:none;font-size:12px;text-align:left;pointer-events:none;
  }
  .dialog {
    position:absolute; z-index:8;
    bottom:clamp(22px,5dvh,56px);left:50%;
    width:calc(100% - 36px);max-width:1110px;
    height:clamp(125px,16dvh,160px);
    flex:none;margin:0;transform:translateX(-50%);
  }
}
/* Lower the foreground surface just enough to reveal her bodice/waist.
   The table apron now naturally hides the art's unfinished lower edge. */
@media (min-width:900px) and (orientation:landscape) {
  .food-zone { top:50.1dvh; }
}

/* Full-width bottom dialogue and grounded food composition.
   Only the game dialogue is affected; END/modal layouts are untouched. */
@media (min-width:900px) and (orientation:landscape) {
  .dialog {
    left:0;right:0;bottom:0;
    transform:none;
    width:100%;max-width:none;
    height:clamp(170px,26dvh,330px);
    min-height:0;
    margin:0;
    padding:16px clamp(22px,4.2vw,90px) 12px;
    border-radius:8px 8px 0 0;
    border-left:0;border-right:0;border-bottom:0;
    background:linear-gradient(110deg,rgba(27,27,51,.95),rgba(21,24,49,.92));
    box-shadow:0 -10px 26px rgba(11,10,22,.40),inset 0 1px 0 rgba(255,232,249,.25);
    z-index:9;
  }
  .dialog .dialog-text {
    max-width:1120px;
    padding-top:12px;
  }
  .dialog .advance {right:clamp(18px,4vw,78px);bottom:16px}
}
@media (min-width:900px) and (orientation:landscape) and (min-height:950px) {
  .dialog{height:25dvh;}
}
@media (max-width:899px), (orientation:portrait) {
  .dialog {
    width:100%;max-width:none;
    margin:-4px 0 0;
    border-radius:7px 7px 0 0;
    border-left:0;border-right:0;border-bottom:0;
    background:linear-gradient(135deg,rgba(23,29,56,.94),rgba(19,25,46,.92));
  }
}

@media (min-width:900px) and (orientation:landscape) {
  .food-plate {
    top:clamp(15px,2dvh,25px);
    width:clamp(160px,20dvh,240px);
    height:clamp(160px,20dvh,240px);
  }
}

/* Additional END stills: preserve both existing artwork and fixed dialogue geometry. */
.ending-art-second{opacity:0;visibility:hidden;transition:opacity .38s ease,visibility 0s linear .38s}
.end-scene[data-shot="2"] .ending-art-second{opacity:1;visibility:visible;transition:opacity .38s ease}
.end-scene[data-shot="2"] .ending-art-first{visibility:hidden;transition:visibility 0s linear .38s}
.end-scene .ending-art-second img{animation:none!important}
/* Only subtle visible warning distinguishes a genuine short feint. */
.scene-ribbon.safe.feint-cue{border-style:dashed;border-color:#f2deff;background:#394759eb;color:#fff0fb}
.end-scene.ending-climax .ending-line.red{text-shadow:0 0 12px #fa365e,0 1px 2px #14030b}
.shell.fx-ending-shift .end-scene .ending-vignette{animation:ending-shift .58s ease-out both}
@keyframes ending-shift{0%,100%{filter:none}30%{filter:brightness(1.6) saturate(1.45)}}
.shell.fx-ending-zoom .end-scene .ending-art-second img{animation:ending-small-zoom .72s ease-out both!important}
@keyframes ending-small-zoom{0%{transform:scale(1)}45%{transform:scale(1.045)}100%{transform:scale(1)}}
@media(prefers-reduced-motion:reduce){.ending-art-second,.end-scene[data-shot="2"] .ending-art-second{transition:none!important}.shell.fx-ending-shift .end-scene .ending-vignette,.shell.fx-ending-zoom .end-scene .ending-art-second img{animation:none!important}}
/* END03 second still: keep the actual knife visible above the fixed dialogue box.
   The supplied art places the knife low; contain the full frame in the upper region
   instead of cropping it behind dialogue. Neither the source art nor the window moves. */
.end-scene[data-ending="03"][data-shot="2"] .ending-art-second{background:linear-gradient(90deg,#271822,#120d1c 40%,#120d1c 60%,#271822)}
.end-scene[data-ending="03"][data-shot="2"] .ending-art-second img{width:100%;height:100%;object-fit:cover;object-position:center center}

/* 第27版：20場面の演出強化。画像・当たり判定・レイアウト・既存台詞には非干渉。 */
/* gameplay: 01–10 */
.shell.fx-opening-unease .fx-overlay::before{
 background:radial-gradient(ellipse 55% 60% at 52% 38%,transparent 28%,#26132ec7 100%);
 animation:yan-opening-cut .55s ease-out both}
@keyframes yan-opening-cut{0%,100%{opacity:0}25%{opacity:.86}45%{opacity:.12}}
.shell.fx-stage2-hush .scene .hero-image{animation:yan-frozen-smile .72s ease-out both}
@keyframes yan-frozen-smile{0%,100%{filter:none}35%{filter:grayscale(.25) contrast(1.15) brightness(.82)}}
.shell.fx-feint-stare .scene-ribbon{animation:yan-lookback .55s ease-out both}
.shell.fx-feint-stare .scene .hero-image{animation:yan-blank-look .55s ease-out both}
@keyframes yan-lookback{0%,100%{filter:none}30%{filter:brightness(1.7);box-shadow:0 0 19px #ea8aaec0}}
@keyframes yan-blank-look{0%,100%{filter:none}32%{filter:contrast(1.22) saturate(.58)}}
.shell.fx-discard-omen .food-zone::after{content:"";position:absolute;inset:0;z-index:19;pointer-events:none;
 background:radial-gradient(ellipse at center,transparent 34%,#3d0c478c 100%);animation:yan-wrong-bite .46s ease-out both}
@keyframes yan-wrong-bite{0%,100%{opacity:0}40%{opacity:1}}
.shell.fx-preturn-close .scene .hero-image{animation:yan-near-turn .39s ease-out both;transform-origin:center 42%}
.shell.fx-preturn-close .fx-overlay::before{background:radial-gradient(ellipse 75% 80% at 50% 40%,transparent 35%,#170b27a9);animation:yan-wrong-bite .39s both}
@keyframes yan-near-turn{0%,100%{scale:1}50%{scale:1.026}}
.shell.fx-final-heartstop .fx-overlay::after{background:#0b0b1fe8;animation:yan-last-heart .9s ease-out both}
@keyframes yan-last-heart{0%{opacity:0}20%,50%{opacity:.75}100%{opacity:0}}
.shell.fx-anger-snap .scene .hero-image{animation:yan-anger .6s ease-out both}
.shell.fx-anger-snap .fx-overlay::before{background:radial-gradient(ellipse at 50% 40%,transparent 20%,#ff164e9e 100%);animation:yan-wrong-bite .6s both}
@keyframes yan-anger{0%,100%{scale:1}16%{scale:1.035}30%{scale:.992}}
.shell.fx-sweet-after-anger .fx-overlay::before{background:radial-gradient(circle at 50% 43%,#ffe1f58a,transparent 53%);animation:yan-sweet-switch .65s ease-out both}
@keyframes yan-sweet-switch{0%,100%{opacity:0}31%{opacity:1}}
.shell.fx-second-sickness > .room-photo img{animation:yan-ill-backdrop 1.1s ease-out both}
@keyframes yan-ill-backdrop{0%,100%{filter:none}35%{filter:blur(5px) saturate(.43) brightness(.59)}}
/* Blackout text is a real in-game overlay; only synthesizer notes, not a recorded voice. */
.flash.whispering::after{content:"……やっと、二人きりだね♡";display:block;position:absolute;
 left:5%;right:5%;top:48%;transform:translateY(-50%);text-align:center;
 font:900 clamp(20px,5vw,34px)/1.5 var(--serif);color:#f9ddeb;letter-spacing:.07em;
 text-shadow:0 0 16px #f23877b8;animation:yan-whisper .85s ease-in both}
@keyframes yan-whisper{0%{opacity:0;filter:blur(9px)}35%{opacity:.9;filter:none}100%{opacity:.9;filter:none}}
/* ending still accents: 11–20, using the existing paintings only */
.end-scene .ending-art img{transform-origin:center top}
.shell.fx-end01-bottle .end-scene[data-ending="01"] .ending-art-first img{animation:yan-jar-find .73s ease-out both!important}
@keyframes yan-jar-find{0%,100%{transform:scale(1)}50%{transform:scale(1.025);filter:brightness(.77)}}
.shell.fx-end01-ticks .end-scene[data-ending="01"] .ending-vignette{
 animation:yan-end-ticks .82s ease-out both}
@keyframes yan-end-ticks{0%,100%{filter:none}28%,65%{filter:contrast(1.35) brightness(.72)}}
.shell.fx-end01-clock-stop .end-scene[data-ending="01"] .ending-vignette{animation:yan-clock-stop 1s ease-out both}
@keyframes yan-clock-stop{0%{background-color:transparent}25%{background-color:#110a2ba1}100%{background-color:transparent}}
.shell.fx-end01-slow .end-scene[data-ending="01"] .ending-art-second img{animation:yan-creepy-love 1.75s ease-in-out both!important}
@keyframes yan-creepy-love{0%{filter:none;transform:scale(1)}80%{filter:saturate(.62) contrast(1.17);transform:scale(1.025)}100%{filter:none;transform:scale(1)}}
.shell.fx-end02-awakening .end-scene[data-ending="02"] .ending-art-first img{animation:yan-wake-focus 1.65s ease-out both!important}
@keyframes yan-wake-focus{0%{filter:blur(15px) brightness(.25)}48%{filter:blur(4px) brightness(.75)}100%{filter:none}}
.shell.fx-end02-love .end-scene[data-ending="02"] .ending-vignette{animation:yan-pink-welcome 1.35s ease-out both}
@keyframes yan-pink-welcome{0%,100%{background-color:transparent}30%{background-color:#ffa3ef75}62%{background-color:#ffe5fb25}}
.shell.fx-end02-poison .end-scene[data-ending="02"] .ending-vignette{animation:yan-poison 1.75s ease-in both}
@keyframes yan-poison{0%{box-shadow:inset 0 0 0 0 #1a082b00}100%{box-shadow:inset 0 0 130px 45px #200821b5}}
.shell.fx-end02-close .end-scene[data-ending="02"] .ending-vignette{animation:yan-closed-room 1.9s ease-in both}
@keyframes yan-closed-room{0%{box-shadow:inset 0 0 20px 6px #130a2200}100%{box-shadow:inset 0 0 170px 62px #0c0818d9}}
/* END03 escalation: scrutiny -> locked exit -> knife -> the truth -> suffocation. */
.end-scene[data-ending="03"] .ending-vignette{z-index:2}
.end-scene[data-ending="03"] .ending-window{z-index:6}
.end-scene[data-ending="03"] .ending-chapter{z-index:5}
.end-scene .ending-ghost{position:absolute;z-index:4;top:39%;left:6%;right:6%;text-align:center;
 color:#ffd6e2;font:900 clamp(19px,4.3vw,56px)/1.55 var(--serif);letter-spacing:.05em;
 opacity:0;visibility:hidden;text-shadow:0 0 20px #ff2b6e,0 2px 5px #160914;
 pointer-events:none;user-select:none}
.shell.fx-end03-scrutiny .end-scene[data-ending="03"] .ending-vignette{
 animation:yan-judgement 1.15s ease-out both}
@keyframes yan-judgement{0%,100%{box-shadow:inset 0 0 0 #21091900}55%{box-shadow:inset 0 0 160px 40px #1e061ddc}}
.shell.fx-end03-lockdown .end-scene[data-ending="03"] .ending-window{
 animation:yan-lock-hit .95s cubic-bezier(.2,.1,.2,1) both}
.shell.fx-end03-lockdown .end-scene[data-ending="03"] .ending-vignette{
 animation:yan-door-shut .95s ease-out both}
@keyframes yan-lock-hit{0%,100%{translate:0 0}10%{translate:-6px 0}24%{translate:6px 0}35%{translate:-3px 0}42%{translate:0 0}}
@keyframes yan-door-shut{0%,100%{background-color:transparent}23%{background-color:#9b102655}55%{background-color:#330b2855}}
.shell.fx-end03-knife .end-scene[data-ending="03"][data-shot="2"] .ending-art-second img{
 animation:yan-knife-jump 1.2s ease-out both!important}
@keyframes yan-knife-jump{0%{filter:brightness(.35) grayscale(.5);transform:scale(.987)}15%{filter:brightness(1.65) saturate(1.3);transform:scale(1.02)}38%{filter:brightness(.83);transform:scale(1.01)}100%{filter:none;transform:scale(1)}}
.shell.fx-end03-knife .end-scene[data-ending="03"] .ending-vignette{
 animation:yan-knife-red 1s steps(2,end) both}
@keyframes yan-knife-red{0%,100%{background-color:transparent}15%{background-color:#e006395c}28%{background-color:#230a1f7a}}
.end-scene.end03-truth-page .ending-ghost{visibility:visible}
.shell.fx-end03-truth .end-scene.end03-truth-page .ending-ghost{
 animation:yan-truth-confession 1.65s cubic-bezier(.17,.6,.25,1) both}
@keyframes yan-truth-confession{0%{opacity:0;transform:scale(1.13);filter:blur(9px)}25%{opacity:.87;filter:none}68%{opacity:.48;transform:scale(1.02)}100%{opacity:0;transform:scale(1)}}
.shell.fx-end03-truth .end-scene.end03-truth-page .ending-window{animation:yan-truth-red 1.65s ease-out both}
@keyframes yan-truth-red{0%,100%{box-shadow:inset 0 0 0 2px #666391,0 7px 24px #0009}25%{box-shadow:0 0 29px #e32261,inset 0 0 28px #a3194670}}
.shell.fx-end03-closed-in .end-scene[data-ending="03"] .ending-vignette{
 animation:yan-end03-drown 1.9s ease-in both}
@keyframes yan-end03-drown{0%{box-shadow:inset 0 0 0 0 #10041700}100%{box-shadow:inset 0 0 180px 85px #090513ee}}
.shell.fx-end03-closed-in .end-scene[data-ending="03"] .ending-art-second img{
 animation:yan-final-frozen-face 1.9s ease-in-out both!important}
@keyframes yan-final-frozen-face{0%{filter:none;transform:scale(1)}100%{filter:contrast(1.24) brightness(.75);transform:scale(1.015)}}
/* No flashing/shaking/zooming for motion-sensitive users; readable text always remains. */
@media(prefers-reduced-motion:reduce){
 .flash.whispering::after,.shell.fx-opening-unease .fx-overlay::before,
 .shell.fx-stage2-hush .scene .hero-image,.shell.fx-feint-stare .scene-ribbon,
 .shell.fx-feint-stare .scene .hero-image,.shell.fx-discard-omen .food-zone::after,
 .shell.fx-preturn-close .scene .hero-image,.shell.fx-preturn-close .fx-overlay::before,
 .shell.fx-final-heartstop .fx-overlay::after,.shell.fx-anger-snap .scene .hero-image,
 .shell.fx-anger-snap .fx-overlay::before,.shell.fx-sweet-after-anger .fx-overlay::before,
 .shell.fx-second-sickness > .room-photo img,
 .shell.fx-end01-bottle .end-scene .ending-art img,
 .shell.fx-end01-ticks .end-scene .ending-vignette,
 .shell.fx-end01-clock-stop .end-scene .ending-vignette,
 .shell.fx-end01-slow .end-scene .ending-art img,
 .shell.fx-end02-awakening .end-scene .ending-art img,
 .shell.fx-end02-love .end-scene .ending-vignette,
 .shell.fx-end02-poison .end-scene .ending-vignette,
 .shell.fx-end02-close .end-scene .ending-vignette,
 .shell.fx-end03-scrutiny .end-scene .ending-vignette,
 .shell.fx-end03-lockdown .end-scene .ending-window,
 .shell.fx-end03-lockdown .end-scene .ending-vignette,
 .shell.fx-end03-knife .end-scene .ending-art img,
 .shell.fx-end03-knife .end-scene .ending-vignette,
 .shell.fx-end03-truth .end-scene .ending-ghost,
 .shell.fx-end03-truth .end-scene .ending-window,
 .shell.fx-end03-closed-in .end-scene .ending-vignette,
 .shell.fx-end03-closed-in .end-scene .ending-art img {animation:none!important;scale:1!important;translate:0 0!important;transform:none!important;filter:none!important;box-shadow:none!important}
 .shell.fx-end03-truth .end-scene .ending-ghost{opacity:0!important}
 .flash.whispering::after{opacity:1!important;filter:none!important}
}

/* Audit: raise narrow-screen touch targets without adding new controls. */
@media(max-width:899px) and (orientation:portrait){
 .topbar{min-height:50px;height:50px;flex-basis:50px;padding-top:1px;padding-bottom:1px}
 .topactions .mini-btn{min-width:44px;min-height:44px;height:44px}
}
@media(max-height:650px){
 #endModal .end-actions .main-button{min-height:44px}
}
/* On compact landscape phones, keep the three header actions finger-sized. */
@media(max-width:899px) and (orientation:landscape) and (max-height:450px){
 .topbar{min-height:49px;height:49px;flex-basis:49px;padding-top:1px;padding-bottom:1px}
 .topactions .mini-btn{min-width:44px;min-height:44px;height:44px}
}

/* Full-viewport END illustrations on portrait tablets as well as phone/desktop.
   Keep the existing text window and original artwork; remove the letterboxed crop. */
#endScene{position:fixed;inset:0;width:100vw;height:100dvh}
#endScene .ending-art img{width:100%;height:100%;object-fit:cover;object-position:center center}
/* END03 uses the same fixed-size dialogue window as every other END/page.
   A smaller second-still window clipped long lines on narrow iPhones. */


/* Secret diary: an independent pink reading layer. No changes to gameplay styling. */
.diary-records-entry{margin:18px 0 4px}
.diary-entry-button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:7px;width:100%;min-height:75px;border:1px solid #ffd6ea;border-radius:12px;background:linear-gradient(120deg,#895174,#61375d);color:#fff1f8;box-shadow:0 4px 12px #0b091c45}
.diary-entry-button>span{font:900 clamp(18px,5vw,23px) var(--serif)}
.diary-entry-button small{font:700 12px var(--sans);color:#ffe5f5}
#diaryModal{z-index:41;display:block;background:radial-gradient(ellipse at 48% 0%,#ffedf6,#fbd1e4 57%,#edaccb);color:#713b5c;padding:calc(env(safe-area-inset-top) + 14px) clamp(12px,3.4vw,23px) calc(env(safe-area-inset-bottom) + 18px);font-family:var(--serif)}
.diary-head{position:sticky;top:-14px;z-index:3;display:flex;justify-content:space-between;align-items:center;gap:8px;min-height:47px;padding:7px 0 12px;background:#ffe5f0ef;border-bottom:1px solid #d88caa;backdrop-filter:blur(8px)}
.diary-head-title{font:900 clamp(14px,4vw,19px) var(--serif);color:#9d456e}
.diary-back{flex-shrink:0;min-height:44px;padding:7px 11px;border:1px solid #cc89a8;border-radius:9px;background:#fff9fc;color:#8c3c60;font:900 12px var(--sans)}
.diary-cover{text-align:center;padding:15px 7px 19px;border-bottom:1px dashed #d899b6}
.diary-deco{color:#db73a0;letter-spacing:.38em;font-size:16px}
.diary-cover h2{margin:6px 0;font:900 clamp(24px,6vw,30px) var(--serif);color:#94435f}
.diary-cover p{margin:2px 0 12px;font-size:13px;color:#925e77}
.diary-stats{display:inline-block;border:1px solid #dea4ba;border-radius:99px;background:#fff7fb;padding:6px 15px;font:700 12px var(--sans)}
.diary-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin:15px 0}
.diary-tile{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;min-width:0;min-height:113px;padding:9px 4px;border:1px solid #d48bae;border-radius:10px;background:#fff8fb;color:#8a4568;box-shadow:0 3px 10px #af6c9240;text-align:center}
.diary-tile-icon{font-size:20px;line-height:1.1;color:#d675a1}
.diary-tile strong{font:900 19px var(--sans)}
.diary-tile small{max-width:100%;font:700 11px/1.4 var(--sans);overflow-wrap:anywhere}
.diary-tile.is-read{background:#ffeff5}
.diary-read-mark{font:700 10px var(--sans);color:#af6483}
.diary-tile.is-locked{background:#e9cbd9;color:#9e8391;box-shadow:none;border-style:dashed}
.diary-tile.is-locked .diary-tile-icon{filter:grayscale(.6)}
.diary-bottom-note{margin:13px 0 5px;text-align:center;color:#8e526f;font:700 12px var(--sans)}
.diary-paper{position:relative;margin:18px auto 10px;padding:17px clamp(14px,4vw,25px) 32px;width:100%;max-width:610px;min-height:min(63dvh,570px);border:1px solid #df96b7;border-radius:10px;background:#fffafc;color:#75435d;box-shadow:0 7px 20px #b2658759,inset 7px 0 0 #f9dce9}
.diary-paper-top{display:flex;justify-content:space-between;gap:10px;padding:0 1px 7px;border-bottom:1px solid #db9aba;color:#bf7193;font:800 12px var(--sans)}
.diary-paper h2{margin:15px 0 13px;font:900 clamp(18px,4.8vw,25px) var(--serif);color:#a34d72}
.diary-paper-lines{display:flex;flex-direction:column;gap:8px}
.diary-paper-lines p{margin:0;padding-bottom:5px;border-bottom:1px solid #eed3df;line-height:1.65;font-size:clamp(14px,3.6vw,17px);font-weight:700;overflow-wrap:anywhere}
.diary-paper-heart{position:absolute;right:15px;bottom:7px;color:#d379a5;font-size:18px}
.diary-nav{display:flex;gap:14px;align-items:center;justify-content:space-between;max-width:610px;margin:0 auto 10px}
.diary-progress{font:800 12px var(--sans);color:#8c5570}
.diary-turn{min-height:45px;padding:9px 20px;border:1px solid #ba6f94;border-radius:99px;background:linear-gradient(120deg,#d96f9d,#b85081);color:#fff;font:900 14px var(--serif)}
@media (min-width:500px){.diary-grid{grid-template-columns:repeat(4,minmax(0,1fr))}}
@media(max-height:600px){.diary-paper{min-height:0;margin-top:8px;padding-top:11px;padding-bottom:25px}.diary-paper h2{margin:8px 0 9px}.diary-paper-lines{gap:5px}.diary-paper-lines p{line-height:1.45}.diary-nav{margin-bottom:5px}}
@media(prefers-reduced-motion:reduce){.diary-modal *{transition:none!important;animation:none!important}}

/* 第37版：最初の料理でだけ大きく表示する操作指示。ドラッグを妨げない。 */
.opening-instruction{position:absolute;left:50%;top:35%;z-index:24;
 width:max-content;max-width:calc(100% - 20px);padding:13px 16px;
 border:3px solid #ffc6e5;border-radius:10px;
 background:rgba(21,16,42,.91);color:#fff5fb;
 font:900 clamp(24px,7vw,66px)/1.3 var(--serif);text-align:center;
 text-shadow:0 2px 0 #53204f,0 0 12px #ff9bce;box-shadow:0 8px 30px #090614bb;
 transform:translate(-50%,-50%) scale(.94);opacity:0;visibility:hidden;
 pointer-events:none;transition:opacity .22s,transform .22s,visibility .22s;
 overflow-wrap:anywhere}
.opening-instruction.show{visibility:visible;opacity:1;transform:translate(-50%,-50%) scale(1)}
.shell:not([data-mode="play"]) .opening-instruction{visibility:hidden;opacity:0}
@media(max-width:360px){.opening-instruction{padding:9px 8px;font-size:clamp(22px,7.4vw,27px)}}
@media(max-height:450px){.opening-instruction{top:34%;padding:7px 10px;font-size:clamp(19px,4vw,32px)}}
@media(prefers-reduced-motion:reduce){.opening-instruction{transition:none}}

/* iPad portrait fullscreen: extend the already fullscreen PC/landscape layout
   across the entire available tablet viewport. No gameplay, artwork, or
   JavaScript changes. Phones retain their original 520px portrait design. */
@media (min-width:700px) and (orientation:portrait){
 .shell{width:100%;max-width:none;margin:0;border-left:0;border-right:0;box-shadow:none}
 .topbar{height:60px;flex-basis:60px;padding:6px 22px}
 .topmini{font-size:15px;gap:8px}
 .mini-btn{min-width:68px;min-height:44px;font-size:14px}
 .scene .hero-image{width:min(84vw,650px);height:125%;bottom:-20%}
 .scene-tip{left:50%;right:auto;transform:translateX(-50%);width:min(600px,80vw);max-width:none;font-size:15px;bottom:10px}
 .food-zone{height:clamp(190px,22dvh,260px);flex-basis:clamp(190px,22dvh,260px)}
 .food-zone-header{height:40px;padding:4px 26px;font-size:17px}
 .food-bench{height:calc(100% - 40px);width:min(720px,92%);margin:0 auto}
 .food-plate{width:min(68%,500px)}
 .drag-hint{font-size:14px}
 .dialog{height:clamp(170px,17dvh,205px);flex-basis:clamp(170px,17dvh,205px);padding:10px clamp(24px,7vw,80px)}
 .dialog-text{font-size:clamp(22px,3vw,25px);line-height:1.35}
 .dialog .dialog-text{height:calc(100% - 38px)}
 .dialog .advance{right:clamp(24px,7vw,80px)}
 .footbar{padding-inline:22px;font-size:12px}
 .records-list{max-width:700px;margin-inline:auto}
 .diary-grid{grid-template-columns:repeat(4,minmax(0,1fr));max-width:720px;margin-inline:auto}
 .diary-cover{max-width:720px;margin-inline:auto}
 .diary-bottom-note{max-width:720px;margin-inline:auto}
}

/* Responsive viewport refinements: keep existing artwork and gameplay positions.
   The game scene fills the available browser viewport on phones, tablets and PCs.
   Dialogue panels are attached to the bottom edge rather than floating above it. */
.shell{width:100%;height:100dvh;min-height:0}
@media (min-width:521px){
 .shell{max-width:none;max-height:none;margin:0;border:0;border-radius:0;box-shadow:none}
 .dialog{
   align-self:stretch;width:100%;max-width:none;
   margin:-2px 0 0;flex-shrink:0;
   padding-inline:clamp(18px,4vw,58px);
   border-left:0;border-right:0;border-bottom:0;
   border-radius:9px 9px 0 0;
 }
 .dialog .dialog-text{max-width:none;overflow:hidden}
 .dialog .advance{right:clamp(18px,4vw,58px)}
 .end-scene .ending-window{
   left:0;right:0;bottom:0;width:100%;
   border-left:0;border-right:0;border-bottom:0;
   border-radius:9px 9px 0 0;
   padding-left:clamp(18px,4vw,58px);
   padding-right:clamp(18px,4vw,58px);
 }
 .end-scene .ending-line{min-width:0}
}
/* iPad in portrait and split-screen: don't revert to the 520px phone column. */
@media (min-width:521px) and (orientation:portrait){
 .topbar{padding-inline:clamp(9px,2.5vw,22px)}
 .food-zone{flex-basis:clamp(165px,22dvh,260px);height:clamp(165px,22dvh,260px)}
 .dialog{
   height:clamp(148px,17dvh,205px);
   flex-basis:clamp(148px,17dvh,205px);
   padding-block:10px 9px;
 }
 .dialog .dialog-text{height:calc(100% - 35px);font-size:clamp(19px,2.6vw,25px);line-height:1.38}
 .end-scene .ending-window{height:clamp(176px,23dvh,260px)}
 .records-list{max-width:760px;margin-inline:auto}
}
/* Desktop / landscape tablet: full-width dialogue, with a stable reading size. */
@media (min-width:900px) and (orientation:landscape){
 .dialog{
   width:100%;max-width:none;
   height:clamp(145px,19dvh,216px);
   flex-basis:clamp(145px,19dvh,216px);
   margin:-2px 0 0;
   padding:12px clamp(24px,4.5vw,86px) 11px;
 }
 .dialog .dialog-text{
   max-width:none;height:calc(100% - 40px);
   font-size:clamp(22px,1.55vw,29px);
   line-height:1.35;
 }
 .dialog .advance{right:clamp(24px,4.5vw,86px);bottom:10px}
 .end-scene .ending-window{
   left:0;right:0;bottom:0;width:100%;
   height:clamp(175px,24dvh,260px);
   padding:14px clamp(24px,4.5vw,86px) 12px;
 }
}
/* Wide but short windows must retain enough room for the game field. */
@media (min-width:900px) and (orientation:landscape) and (max-height:700px){
 .dialog{height:clamp(112px,23dvh,160px);flex-basis:clamp(112px,23dvh,160px)}
 .dialog .dialog-text{font-size:clamp(16px,1.65vw,22px);line-height:1.22}
 .end-scene .ending-window{height:clamp(135px,30dvh,190px)}
}
/* Compact phones keep their original typography, but remove the unused strip
   beneath the VN panel. */
@media (max-width:520px){
 .dialog{margin-bottom:0}
}
/* Split view and mobile landscape: ensure the dialogue is on the bottom edge. */
@media (max-width:899px) and (orientation:landscape){
 .shell{max-width:none;border:0}
 .dialog{width:100%;max-width:none;margin:-2px 0 0;border-radius:8px 8px 0 0;border-left:0;border-right:0;border-bottom:0}
}
/* On tablet/desktop END scenes, keep every part of the original still inside
   the viewport. A softened copy of the same supplied asset fills side gutters;
   no new images and no image distortion/cropping of the principal painting. */
@media (min-width:521px){
 .end-scene .ending-art{isolation:isolate;overflow:hidden;background:#191320}
 .end-scene .ending-art::before{
   content:"";position:absolute;inset:-28px;z-index:0;pointer-events:none;
   background-image:var(--ending-fullscreen-art);
   background-position:center;background-size:cover;
   filter:blur(18px) brightness(.46);transform:scale(1.04);
 }
 .end-scene .ending-art img{
   position:relative;z-index:1;object-fit:contain;object-position:center center;
 }
 .end-scene[data-ending="01"] .ending-art-first{--ending-fullscreen-art:url('assets/still_01_sp.webp')}
 .end-scene[data-ending="02"] .ending-art-first{--ending-fullscreen-art:url('assets/still_02_sp.webp')}
 .end-scene[data-ending="03"] .ending-art-first{--ending-fullscreen-art:url('assets/still_03_sp.webp')}
 .end-scene[data-ending="01"] .ending-art-second{--ending-fullscreen-art:url('assets/still_01_2_sp.webp')}
 .end-scene[data-ending="02"] .ending-art-second{--ending-fullscreen-art:url('assets/still_02_2_sp.webp')}
 .end-scene[data-ending="03"] .ending-art-second{--ending-fullscreen-art:url('assets/still_03_2_sp.webp')}
}
@media (min-width:900px) and (orientation:landscape){
 .end-scene[data-ending="01"] .ending-art-first{--ending-fullscreen-art:url('assets/still_01_pc.webp')}
 .end-scene[data-ending="02"] .ending-art-first{--ending-fullscreen-art:url('assets/still_02_pc.webp')}
 .end-scene[data-ending="03"] .ending-art-first{--ending-fullscreen-art:url('assets/still_03_pc.webp')}
 .end-scene[data-ending="01"] .ending-art-second{--ending-fullscreen-art:url('assets/still_01_2_pc.webp')}
 .end-scene[data-ending="02"] .ending-art-second{--ending-fullscreen-art:url('assets/still_02_2_pc.webp')}
 .end-scene[data-ending="03"] .ending-art-second{--ending-fullscreen-art:url('assets/still_03_2_pc.webp')}
}
@media (min-width:521px){
 #endScene .ending-art img{object-fit:contain;object-position:center center}
}

/* Keyboard hints occupy only unused upper-left space on wide layouts.
   Never intercept touch, mouse, or the dialogue and drag hit targets. */
.keyboard-help{display:none;position:absolute;left:clamp(14px,2vw,30px);top:calc(env(safe-area-inset-top,0px) + 61px);z-index:6;
 pointer-events:none;max-width:min(70vw,760px);padding:6px 11px;color:#fff3fb;
 font:700 clamp(13px,1.1vw,15px)/1.5 var(--sans);letter-spacing:.01em;
 background:#201d3bca;border:1px solid #eec2df94;border-radius:7px;box-shadow:0 3px 10px #17122577}
@media (min-width:700px){.keyboard-help{display:block}}
@media (min-width:700px) and (max-height:560px){.keyboard-help{top:calc(env(safe-area-inset-top,0px) + 52px);padding:3px 7px;font-size:10px}}
/* Keep the existing phone controls unchanged; larger touch devices get 44px targets. */
@media (min-width:700px) and (pointer:coarse){.mini-btn{min-height:44px}}

/* TRUE ENDの記録帳・ランキング。既存画面には最小限の追加のみ。 */
#endModal .rank-from-result{order:3;flex:0 0 auto;width:100%;min-height:31px;border:1px solid #dbb6c7;background:#443248;color:#ffe7f0;border-radius:7px;font:800 clamp(11px,3.1vw,14px) var(--sans);cursor:pointer}
#rankModal{z-index:45;background:linear-gradient(155deg,#171927,#26213a);padding:calc(env(safe-area-inset-top) + 12px) max(12px,env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 18px);font-family:var(--sans)}
#rankModal .rank-panel{max-width:900px;margin:0 auto 16px;display:flex;flex-direction:column;gap:12px}
#rankModal .modal-head{top:-12px;padding:8px 4px 12px}
#rankModal .modal-title{font:900 clamp(17px,4.5vw,25px) var(--serif)}
#rankModal .rank-lead{margin:0;color:#e3c7d4;font-size:14px;line-height:1.5}
#rankModal .rank-mine{background:#f1e8ec;color:#3e303a;border:2px solid #b3889e;border-radius:11px;padding:14px 15px;display:flex;flex-direction:column;gap:10px}
#rankModal .rank-mine-head{display:flex;justify-content:space-between;align-items:center;gap:9px;color:#694a5a;font-weight:900;font-size:13px}
#rankModal .rank-mine-head small{font-weight:700;color:#937889;font-size:11px}
#rankModal .rank-mine-stats{display:flex;flex-wrap:wrap;gap:7px 13px;align-items:baseline}
#rankModal .rank-mine-stats strong{font:900 clamp(24px,7.4vw,40px) var(--serif);color:#9c466c}
#rankModal .rank-mine-stats span{font-size:clamp(14px,3.5vw,18px);font-weight:850}
#rankModal .rank-mine-stats small{font-size:11px;color:#72596b}
#rankModal .rank-error{margin:0;color:#99334d;font-size:12px;line-height:1.5;font-weight:700}
#rankModal .rank-name-row{display:flex;flex-direction:column;gap:5px}
#rankModal .rank-name-row label{font-size:12px;font-weight:850}
#rankModal .rank-name-row>div{display:flex;gap:6px;min-height:40px}
#rankModal input{min-width:0;flex:1 1 auto;width:0;max-width:500px;border:1px solid #b89eac;border-radius:6px;background:#fff;color:#352732;font:700 16px var(--sans);padding:8px 9px}
#rankModal .rank-mini-btn,#rankModal .rank-retry{min-height:40px;border:1px solid #ad7893;border-radius:7px;background:#a65f82;color:#fff;font:900 12px var(--sans);padding:7px 11px;cursor:pointer}
#rankModal .rank-retry{background:#7a5168}
#rankModal .rank-card-controls{display:flex;flex-wrap:wrap;gap:8px}
#rankModal .rank-card-controls button{flex:1 1 150px}
#rankModal .rank-list-head{display:flex;align-items:center;justify-content:space-between;padding:0 4px;gap:10px}
#rankModal .rank-list-head b{font:900 19px var(--serif);color:#fff}
#rankModal .rank-list-head small{font-size:12px;color:#d7bdc7}
#rankModal .rank-lines{display:flex;flex-direction:column;gap:7px}
#rankModal .rank-line{display:grid;grid-template-columns:minmax(44px,76px) minmax(0,1fr) minmax(75px,155px);gap:10px;align-items:center;min-height:56px;padding:7px 12px;background:#393349;border:1px solid #806c86;border-radius:8px}
#rankModal .rank-line-me{border:2px solid #ffc7de;background:#513348}
#rankModal .rank-place{font-size:clamp(14px,3.6vw,19px);color:#efbfd2}
#rankModal .rank-person{display:flex;flex-direction:column;gap:4px;min-width:0}
#rankModal .rank-person span{font-weight:850;font-size:clamp(13px,3.5vw,17px);overflow-wrap:anywhere;color:#fff}
#rankModal .rank-person small{font-size:11px;font-weight:600;color:#d4b9c5}
#rankModal .rank-clock{text-align:right;font:900 clamp(13px,3.5vw,18px) var(--sans);font-variant-numeric:tabular-nums;color:#fff}
#rankModal .rank-empty{text-align:center;padding:32px 10px;font-size:14px;color:#dec2cf;background:#302c3b;border-radius:8px}
#rankModal .rank-pager{display:flex;justify-content:center;align-items:center;gap:12px}
#rankModal .rank-pager button{min-width:75px;min-height:40px;border:1px solid #b390a5;background:#5a4560;color:white;border-radius:7px;font-weight:850}
#rankModal .rank-pager button:disabled{opacity:.34}
#rankModal .rank-pager span{font-size:12px;font-weight:800}
#rankModal .rank-foot{font-size:11px;line-height:1.7;color:#cbb4c0;margin:0 3px 10px}
@media(min-width:900px) and (orientation:landscape){#rankModal{padding-inline:max(18px,12vw)}#rankModal .rank-line{min-height:52px}#endModal .rank-from-result{min-height:27px}}
@media(max-width:359px){#rankModal .rank-line{grid-template-columns:44px minmax(0,1fr) 79px;gap:5px;padding:7px}#rankModal .rank-clock{font-size:12px}#rankModal .rank-name-row>div{flex-wrap:wrap}#rankModal input{flex-basis:160px}}


/* Compact HUD: remove the full-width strip. Keep counters and gaze always visible,
   while placing the old actions in an accessible on-demand menu. */
.topbar,
.shell[data-course="4"] .topbar,
.shell[data-course="5"] .topbar {
  position:absolute;z-index:12;
  top:calc(env(safe-area-inset-top,0px) + 10px);
  left:clamp(9px,2vw,28px);right:clamp(9px,2vw,28px);
  width:auto;height:44px;min-height:0;flex:none;
  padding:0;gap:8px;align-items:flex-start;
  background:transparent;border:0;border-radius:0;
  box-shadow:none;backdrop-filter:none;-webkit-backdrop-filter:none;
  pointer-events:none;
}
.topmini {
  position:relative;display:flex;flex:0 1 auto;align-items:center;
  min-width:0;max-width:calc(100% - 58px);height:43px;
  gap:clamp(4px,1vw,11px);padding:2px 13px 4px 11px;
  border:1px solid rgba(250,232,245,.52);border-radius:24px;
  background:rgba(23,26,48,.67);color:#fff6fc;
  box-shadow:0 3px 14px #07081936;
  backdrop-filter:blur(9px);-webkit-backdrop-filter:blur(9px);
  pointer-events:auto;white-space:nowrap;overflow:visible;
}
.topmini .heartmark{font-size:14px;line-height:1;flex:none}
.topmini .topsep{height:12px;flex:none}
.topmini #stageLabel{font-size:clamp(14px,1.4vw,19px);line-height:1.1;flex:none}
.topmini #caughtLabel{font-size:clamp(10px,1.05vw,13px);line-height:1.1;white-space:nowrap;flex:none}
.topmini #sleepIndicator{font-size:clamp(10px,.94vw,12px);white-space:nowrap;flex:none}
.topmini .sleep-track{
  position:absolute;bottom:0;left:12px;right:12px;height:2px;
  border:0;border-radius:99px;background:transparent;pointer-events:none;
}
.topmini .sleep-track span{border-radius:99px}
.topactions{position:relative;z-index:13;display:block;flex:0 0 auto;pointer-events:auto}
.hud-menu-button{
  width:43px;height:43px;min-height:43px;display:grid;place-items:center;
  border:1px solid rgba(250,232,245,.6);border-radius:12px;
  background:rgba(23,26,48,.72);color:#fff4fc;
  font:700 21px/1 var(--sans);
  box-shadow:0 3px 14px #07081938;
  backdrop-filter:blur(9px);-webkit-backdrop-filter:blur(9px);
  touch-action:manipulation;
}
.hud-menu-button[aria-expanded="true"]{background:rgba(59,43,69,.96);border-color:#ffdaeb}
.hud-menu{
  position:absolute;top:calc(100% + 7px);right:0;z-index:14;
  display:flex;flex-direction:column;gap:6px;
  width:min(245px,calc(100vw - 24px));padding:10px;
  border:1px solid rgba(250,232,245,.62);border-radius:12px;
  background:rgba(25,26,46,.97);box-shadow:0 10px 30px #090b20a6;
  backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);
}
.hud-menu .mini-btn{
  display:block;width:100%;height:auto;min-height:44px;padding:10px 13px;
  text-align:left;font:750 14px/1.25 var(--sans);
  border-radius:8px;white-space:normal;
}
.hud-menu .keyboard-help{
  display:block;position:static;max-width:none;width:100%;
  padding:8px 3px 2px;margin-top:2px;
  font:650 11px/1.5 var(--sans);color:#e7d5e4;
  background:none;border:0;border-top:1px solid #e9cfe34b;
  border-radius:0;box-shadow:none;pointer-events:none;
}
@media (max-width:699px){.hud-menu .keyboard-help{display:none}}
@media (max-width:899px), (orientation:portrait){
 .topbar{top:calc(env(safe-area-inset-top,0px) + 8px);left:9px;right:9px;height:43px}
 .topmini{height:42px;max-width:calc(100% - 53px);padding:2px 11px 4px 10px;gap:6px}
 .topmini #stageLabel{font-size:clamp(15px,3.8vw,19px)}
 .topmini #caughtLabel{font-size:clamp(10px,2.75vw,13px)}
 .hud-menu-button{width:42px;height:42px;min-height:42px}
}
@media (max-width:430px){
 .topmini{gap:5px;padding-left:9px;padding-right:10px}
 .topmini .heartmark{font-size:12px}
 .topmini #stageLabel{font-size:15px}
 .topmini #caughtLabel{font-size:11px}
 .topmini #sleepIndicator{font-size:10px}
}
@media (max-height:650px){
 .topbar{top:calc(env(safe-area-inset-top,0px) + 5px);height:37px}
 .topmini,.hud-menu-button{height:37px;min-height:37px}
 .topmini{padding-top:1px;padding-bottom:3px}
 .hud-menu .mini-btn{min-height:40px}
}
@media (min-width:900px) and (orientation:landscape){
 .topbar{top:14px;left:clamp(28px,4vw,75px);right:clamp(28px,4vw,75px);height:44px;padding:0}
 .topmini{max-width:calc(100% - 58px)}
}

/* While the menu temporarily covers the scene badge, duplicate its CURRENT
   state as the first menu row so the essential gameplay cue stays readable. */
.hud-menu-gaze{padding:5px 8px 8px;border-bottom:1px solid #ead3e442;color:#f7eaf3;
 font:750 12px/1.35 var(--sans);white-space:nowrap}
.hud-menu-gaze.safe{color:#cdeefa}.hud-menu-gaze.danger{color:#ffc0cf}

/* Complete-memorial bonus: independent modal, the game's original UI is untouched. */
#bonusModal{z-index:36;overflow-y:auto;overflow-x:hidden;background:linear-gradient(160deg,#2c233b,#171629);padding:calc(env(safe-area-inset-top) + 10px) clamp(10px,3vw,36px) calc(env(safe-area-inset-bottom) + 15px)}
#bonusModal .bonus-panel{max-width:670px;margin:0 auto;display:flex;flex-direction:column;gap:10px;align-items:stretch}
#bonusModal .modal-head{position:sticky;top:-10px;min-height:43px;padding:8px 0;z-index:2}
#bonusModal .bonus-intro{font:700 clamp(12px,3.1vw,15px)/1.5 var(--sans);color:#f6d9e7;text-align:center;margin:0}
#bonusModal .bonus-preview{display:block;align-self:center;max-height:min(57dvh,610px);max-width:100%;width:auto;aspect-ratio:4/5;object-fit:contain;background:#fff2f6;border:2px solid #f2c2d7;border-radius:6px}
#bonusModal .bonus-name-row{display:flex;flex-direction:column;gap:5px;font:700 12px var(--sans);color:#f6d9e7}
#bonusModal .bonus-name-row>div{display:flex;gap:8px}
#bonusModal .bonus-name-row input{flex:1;min-width:0;min-height:43px;border:1px solid #eab1ce;background:#fff9fa;color:#352739;border-radius:7px;padding:8px;font-size:16px}
#bonusModal button[data-bonus-action]{min-height:43px;border-radius:7px;border:1px solid #eebbd3;background:#6f4d73;color:white;padding:8px 13px;font:800 clamp(12px,3.2vw,15px) var(--sans)}
#bonusModal .bonus-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
#bonusModal .bonus-actions button[data-bonus-action]{background:#a85f83;min-width:0}
#bonusModal .bonus-note{font:600 11px/1.5 var(--sans);color:#d8beca;text-align:center;padding-bottom:7px}
#recordsModal .bonus-entry-button:disabled{opacity:.64}
@media (max-height:520px){#bonusModal .bonus-preview{max-height:42dvh}#bonusModal .bonus-panel{gap:5px}#bonusModal .bonus-intro{font-size:11px}#bonusModal .modal-head{min-height:36px}}

/* END record access: make ONLY the two existing entry buttons stand out. */
#hudMenu #recordsBtn{
  color:#40243b;
  background:linear-gradient(180deg,#fff1f8,#ffc4e2);
  border:2px solid #ff92c6;
  border-left:5px solid #eb5c9b;
  box-shadow:0 2px 12px #f987bf55;
  font-weight:900;
  min-height:44px;
}
/* END results: put the prominent collection link directly BELOW the X report button. */
#endModal .end-actions .end-records-large{
  display:flex;align-items:center;justify-content:center;
  width:100%;min-height:52px;padding:9px 12px;
  background:linear-gradient(180deg,#fff1f8,#ffc1df);
  color:#40243b;border:2px solid #ff8cbe;border-radius:9px;
  font:900 clamp(16px,4.2vw,20px)/1.3 var(--sans);
  box-shadow:0 3px 12px #e56ba44e;
}
@media(max-height:420px) and (orientation:landscape){
  #endModal .end-actions{grid-template-columns:repeat(2,minmax(0,1fr))}
  #endModal .end-actions button[data-action="share"],
  #endModal .end-actions .end-records-large{grid-column:1/-1}
  #endModal .end-actions .end-records-large{min-height:43px;font-size:14px;padding:5px 8px}
}
#hudMenu #recordsBtn:focus-visible,
#endModal .end-actions .end-records-large:focus-visible{
  outline:3px solid #fff;outline-offset:3px;
}

/* END04 only: an easier-to-find key at the top edge of the diary index. */
.diary-cover{position:relative}
.diary-cover .diary-secret-key{position:absolute;top:-8px;right:-4px;z-index:2;display:block;width:clamp(100px,30vw,120px);height:clamp(100px,30vw,120px);padding:2px;border:0;border-radius:12px;background:transparent;filter:drop-shadow(0 3px 4px #5c4b6388);cursor:pointer;touch-action:manipulation}
.diary-cover .diary-secret-key:focus-visible{outline:3px solid #984264;outline-offset:2px}
.diary-secret-key img{display:block;width:100%;height:100%;object-fit:contain;pointer-events:none}
.secret-notebook-entry{display:block;width:100%;max-width:610px;margin:18px auto;padding:12px;border:1px solid #c985a8;border-radius:10px;background:#f9ecf3;color:#873a60;font:900 15px var(--serif)}
.secret-notebook-paper{width:100%;max-width:610px;min-height:clamp(435px,76dvh,760px);margin:13px auto 10px;padding:clamp(64px,11dvh,118px) clamp(20px,6vw,58px) clamp(48px,7dvh,80px);background:#ffe7ef url('assets/end04_notebook_sp.webp') center/100% 100% no-repeat;border-radius:12px;color:#63384d;box-shadow:0 7px 20px #853b6359}
.secret-notebook-content h2{margin:10px 0 18px;color:#903f62;font:900 clamp(19px,4.5vw,28px) var(--serif)}
.secret-notebook-content p{margin:0 0 11px;font:700 clamp(14px,3.5vw,18px)/1.7 var(--serif);overflow-wrap:anywhere}
.secret-notebook-content .secret-notebook-last{color:#971d56;font-weight:900}
.secret-notebook-index{font:800 12px var(--sans);color:#ac5b7f}
.secret-notebook-button{display:block;width:100%;min-height:52px;margin:24px 0;padding:9px;border:1px solid #c16b97;border-radius:9px;background:#a44c77;color:white;font:900 16px var(--serif)}
.secret-notebook-nav{padding-bottom:15px}
.secret-choice{z-index:38;display:flex;align-items:center;justify-content:center;background:radial-gradient(ellipse at 50% 40%,#5a2747,#140e1b 84%)}
.secret-choice-body{width:min(100%,520px);margin:auto;text-align:center}
.secret-choice-hero{display:block;max-width:100%;width:auto;height:clamp(180px,43dvh,430px);object-fit:contain;margin:0 auto -8px;filter:drop-shadow(0 8px 13px #18041499)}
.secret-choice-speech{padding:13px 8px;color:#fff1f8;font:900 clamp(17px,4vw,24px)/1.65 var(--serif)}
.secret-choice-option{display:block;width:100%;min-height:54px;margin:12px auto;padding:12px;border:2px solid #f8c3df;border-radius:9px;background:#7c2b55;color:#fff4fa;font:900 clamp(15px,3.8vw,19px) var(--serif)}
.secret-choice-option.normal{background:#343047;border-color:#a99bb6}
.end-scene[data-ending="04"] .ending-ghost{display:none}
.end-scene[data-ending="04"] .ending-chapter{background:#66283fcb}
.end-scene[data-ending="04"] .ending-window{border-color:#efaac7}
.end-scene[data-ending="04"].last-reveal .ending-art img{filter:saturate(.85) brightness(.88)}
@media(max-height:580px){.secret-notebook-paper{min-height:0;padding-top:50px;padding-bottom:45px}.secret-notebook-content p{margin-bottom:7px;line-height:1.45}.secret-choice-hero{height:27dvh}}

/* The 10-year time jump briefly covers the scene so the switch feels deliberate. */
.end-scene[data-ending="04"].end04-timeskip::after{content:"10年後";position:absolute;inset:0;z-index:8;display:grid;place-items:center;background:#07040b;color:#ffeaf3;font:900 clamp(29px,8vw,62px) var(--serif);letter-spacing:.14em;pointer-events:none;animation:end04-time-jump 1.05s ease-in-out forwards}
@keyframes end04-time-jump{0%,43%{opacity:1}100%{opacity:0}}
@media(prefers-reduced-motion:reduce){.end-scene[data-ending="04"].end04-timeskip::after{display:none}}
@media(min-width:521px){
 .end-scene[data-ending="04"] .ending-art-first{--ending-fullscreen-art:url('assets/end04_1_sp.webp')}
 .end-scene[data-ending="04"] .ending-art-second{--ending-fullscreen-art:url('assets/end04_2_sp.webp')}
}
@media(min-width:900px) and (orientation:landscape){
 .end-scene[data-ending="04"] .ending-art-first{--ending-fullscreen-art:url('assets/end04_1_pc.webp')}
 .end-scene[data-ending="04"] .ending-art-second{--ending-fullscreen-art:url('assets/end04_2_pc.webp')}
}
/* END04's ten-year food photograph remains visible above the fixed dialogue box. */
.end-scene[data-ending="04"] .ending-art-second{background:#39232d}
#endScene[data-ending="04"] .ending-art-second img{
 height:calc(100% - clamp(145px,24dvh,205px) - 14px);
 width:100%;object-fit:contain;object-position:center top;
}


/* Secret END04: localized psychological horror. All legacy END styles remain intact. */
.shell.fx-end04-key-discovered .secret-notebook-paper{animation:end04-paper-shiver .85s ease-out both}
.shell.fx-end04-unsealed .secret-notebook-paper{animation:end04-secret-unseal 1.1s ease-out both}
.shell.fx-end04-notebook-final .secret-notebook-paper{animation:end04-secret-last 1.1s ease-out both}
.shell.fx-end04-choice-reveal .secret-choice-body{animation:end04-choice-focus 1.65s ease-out both}
@keyframes end04-paper-shiver{0%,100%{filter:none}20%{filter:brightness(.82)}45%{filter:brightness(1.09)}}
@keyframes end04-secret-unseal{0%{filter:brightness(.25) blur(4px);transform:scale(.986)}55%{filter:brightness(.78) blur(0)}100%{filter:none;transform:scale(1)}}
@keyframes end04-secret-last{0%,100%{filter:none}46%{filter:sepia(.6) brightness(.78) contrast(1.15)}}
@keyframes end04-choice-focus{0%{filter:blur(7px) brightness(.5);transform:scale(1.02)}30%{filter:none}100%{filter:none;transform:scale(1)}}
.end-scene[data-ending="04"] .ending-vignette{z-index:2}
.end-scene[data-ending="04"] .ending-window{z-index:6}
.end-scene[data-ending="04"] .ending-chapter{z-index:5}
.shell.fx-end04-frozen-smile .end-scene[data-ending="04"] .ending-art-first img{animation:end04-frozen-smile 1.25s ease-out both!important}
@keyframes end04-frozen-smile{0%{filter:saturate(.8) brightness(.64);transform:scale(1.016)}55%{filter:brightness(.87) saturate(.6)}100%{filter:none;transform:scale(1)}}
.shell.fx-end04-first-smile .end-scene[data-ending="04"] .ending-art-first img{animation:end04-smile-bloom 1.1s ease-in-out both!important}
@keyframes end04-smile-bloom{0%{filter:brightness(.55) saturate(.35);transform:scale(.993)}30%{filter:brightness(1.15) saturate(1.08)}100%{filter:none;transform:scale(1.012)}}
.shell.fx-end04-memory .end-scene[data-ending="04"] .ending-vignette{animation:end04-memory-tunnel 1.5s ease-in-out both}
@keyframes end04-memory-tunnel{0%,100%{box-shadow:inset 0 0 0 transparent}55%{box-shadow:inset 0 0 115px 42px #220521d8}}
.shell.fx-end04-love-freezes .end-scene[data-ending="04"] .ending-art-first img{animation:end04-cold-realization 1.1s ease-in-out both!important}
@keyframes end04-cold-realization{0%,100%{filter:none}45%{filter:grayscale(.7) contrast(1.27) brightness(.58)}}
.shell.fx-end04-trapped .end-scene[data-ending="04"] .ending-window{animation:yan-lock-hit .95s ease-out both}
.shell.fx-end04-trapped .end-scene[data-ending="04"] .ending-vignette{animation:end04-door-shadows 1.7s ease-out both}
@keyframes end04-door-shadows{0%,100%{box-shadow:inset 0 0 0 0 #0f041800}45%{box-shadow:inset 0 0 140px 48px #110518de}}
.shell.fx-end04-closed-room .end-scene[data-ending="04"] .ending-vignette{animation:end04-room-narrow 1.8s ease-in-out both}
@keyframes end04-room-narrow{0%,100%{box-shadow:inset 0 0 0 #12001400}64%{box-shadow:inset 0 0 220px 80px #110719df}}
.shell.fx-end04-years-vanish .end-scene[data-ending="04"] .ending-art-second img{animation:end04-aged-memory 2.25s ease-in-out both!important}
@keyframes end04-aged-memory{0%{filter:grayscale(1) brightness(.24) blur(6px)}60%{filter:sepia(.5) brightness(.65) blur(2px)}100%{filter:none}}
.shell.fx-end04-routine .end-scene[data-ending="04"] .ending-art-second img{animation:end04-routine 1.55s ease-in-out both!important}
@keyframes end04-routine{0%,100%{filter:none}50%{filter:sepia(.55) brightness(.7)}}
.shell.fx-end04-last-close .end-scene[data-ending="04"] .ending-art-second img{animation:end04-face-draws-near 1.65s ease-in-out both!important}
@keyframes end04-face-draws-near{0%{filter:none;transform:scale(1)}100%{filter:brightness(.72) saturate(.8);transform:scale(1.018)}}
.shell.fx-end04-final-prison .end-scene[data-ending="04"] .ending-art-second img{animation:end04-final-freeze 2.15s ease-in-out both!important}
.shell.fx-end04-final-prison .end-scene[data-ending="04"] .ending-vignette{animation:end04-final-curtain 2.15s ease-in-out both}
@keyframes end04-final-freeze{0%{filter:none;transform:scale(1)}100%{filter:brightness(.55) contrast(1.16);transform:scale(1.026)}}
@keyframes end04-final-curtain{0%{box-shadow:inset 0 0 0 0 #09030d00}100%{box-shadow:inset 0 0 230px 110px #09030ddf}}
@media(prefers-reduced-motion:reduce){
 .shell.fx-end04-key-discovered .secret-notebook-paper,.shell.fx-end04-unsealed .secret-notebook-paper,
 .shell.fx-end04-notebook-final .secret-notebook-paper,.shell.fx-end04-choice-reveal .secret-choice-body,
 .shell.fx-end04-frozen-smile .end-scene .ending-art img,
 .shell.fx-end04-first-smile .end-scene .ending-art img,
 .shell.fx-end04-memory .end-scene .ending-vignette,
 .shell.fx-end04-love-freezes .end-scene .ending-art img,
 .shell.fx-end04-trapped .end-scene .ending-window,
 .shell.fx-end04-trapped .end-scene .ending-vignette,
 .shell.fx-end04-closed-room .end-scene .ending-vignette,
 .shell.fx-end04-years-vanish .end-scene .ending-art img,
 .shell.fx-end04-routine .end-scene .ending-art img,
 .shell.fx-end04-last-close .end-scene .ending-art img,
 .shell.fx-end04-final-prison .end-scene .ending-art img,
 .shell.fx-end04-final-prison .end-scene .ending-vignette{
  animation:none!important;transform:none!important;filter:none!important;box-shadow:none!important;
 }
}

/* Player name: opening-only modal, keyboard/phone safe, no title screen. */
.name-modal{position:absolute;inset:0;z-index:75;display:grid;place-items:center;overflow-y:auto;overscroll-behavior:contain;padding:max(14px,env(safe-area-inset-top)) 14px max(14px,env(safe-area-inset-bottom));background:#161027ed;backdrop-filter:blur(8px)}
.name-panel{width:min(100%,460px);max-height:100%;overflow-y:auto;padding:clamp(16px,4vw,30px);border:2px solid #f5b6db;border-radius:16px;background:linear-gradient(160deg,#493553,#25223f);box-shadow:0 14px 40px #0009;text-align:center;display:flex;flex-direction:column;align-items:stretch;gap:11px}
.name-panel-heart{font:900 36px var(--serif);color:#f1abcf;line-height:1}
.name-panel h2{margin:0;font:900 clamp(22px,5vw,30px)/1.35 var(--serif);color:#fff2fc}
.name-panel p{margin:0 0 4px;font:700 clamp(13px,3vw,16px)/1.55 var(--serif);color:#f4dce9}
.name-panel label{font:900 14px var(--sans);text-align:left;color:#ffe7f5}
.name-panel input{width:100%;min-height:52px;padding:10px 13px;border:2px solid #e8c8df;border-radius:9px;background:#fff9fd;color:#33223c;font:900 20px var(--sans);text-align:center}
.name-panel input:focus{outline:3px solid #ff9ccd;outline-offset:1px}
.name-error{display:block;min-height:18px;color:#ffc5d6;font:800 12px var(--sans)}
.name-submit{min-height:54px;padding:10px 12px;background:linear-gradient(180deg,#f389c1,#b94d8d);border:2px solid #ffe0f2;border-radius:10px;color:white;font:900 clamp(16px,4.2vw,21px) var(--serif)}
@media(max-height:500px){.name-panel{padding:12px;gap:6px}.name-panel-heart{font-size:23px}.name-panel h2{font-size:20px}.name-panel p{font-size:12px}.name-panel input{min-height:42px}.name-submit{min-height:42px}.name-error{min-height:12px}}

/* Short in-app portrait viewports (e.g. X): show the sprite's full head outline.
   Use the original image without cropping or modifying its pixels. */
@media (max-width:520px) and (orientation:portrait) and (max-height:700px){
 .scene .hero-image{
  top:clamp(13px,3dvh,30px);bottom:auto;
  width:min(99%,480px);height:auto;max-height:calc(100% + 18px);
  object-fit:contain;object-position:center top;clip-path:none;
 }
}
