*{margin:0;padding:0;box-sizing:border-box}
html,body{width:100%;height:100%;overflow:hidden;overscroll-behavior:none;touch-action:manipulation;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
body{background:#000;color:#fff;font-family:"Hiragino Mincho ProN","Yu Mincho",serif}
#game-container{width:100vw;height:100dvh;overflow:hidden;background:#000}
#game{width:100%;height:100%;max-width:1920px;position:relative;overflow:hidden}
.title-screen{width:100%;height:100%;display:flex;flex-direction:column;justify-content:center;align-items:center}
.title-screen h1{font-size:clamp(30px,57.6px,60px);font-weight:normal;white-space:nowrap;letter-spacing:.05em;margin-bottom:70px}
.title-screen h2{font-size:clamp(22px,38.4px,36px);font-weight:normal;margin-bottom:30px}
.title-screen input{width:260px;height:52px;border:0;border-radius:10px;font-size:24px;text-align:center}
.title-screen button{width:220px;height:60px;border-radius:12px;font-size:24px}
.title-menu{display:grid;gap:14px;width:min(280px,787.2px)}.title-menu button{width:100%;height:56px;border:1px solid #c8c8c8;background:#fff;color:#222;font:inherit;font-size:22px;cursor:pointer;transition:background .2s,transform .2s}.title-menu button:hover:not(:disabled){background:#f0f0f0;transform:translateY(-1px)}.title-menu button:disabled{opacity:.45;cursor:not-allowed}.title-notice{min-height:1.5em;margin-top:20px;color:#ddd;font-size:16px}
.menu-overlay{position:absolute;inset:0;z-index:10;display:grid;place-items:center;padding:20px;background:rgba(0,0,0,.55);color:#222}.menu-panel{position:relative;width:min(480px,100%);padding:44px 34px 32px;border-radius:18px;background:#fafaf8;box-shadow:0 12px 32px rgba(0,0,0,.4)}.menu-panel h2{margin-bottom:26px;font-size:26px;font-weight:normal}.menu-panel label{display:grid;grid-template-columns:1fr auto;gap:10px 18px;align-items:center;margin:20px 0;font-size:19px}.menu-panel input[type=range]{grid-column:1/-1;width:100%;accent-color:#444}.menu-panel output{min-width:48px;text-align:right;font-variant-numeric:tabular-nums}.menu-panel .device-close{position:absolute;top:12px;right:16px;color:#333}.author-comment{font-size:19px;line-height:1.8}
.opening{width:100%;height:100%;position:relative;background:#fff;opacity:0}
.fade-in{animation:fadeIn 3s forwards}
#character-area{width:100%;height:100%}
.dialog,.room-dialog{display:flex;flex-direction:column;width:min(900px,calc(100% - 40px));max-height:calc(100% - 80px);min-height:210px;padding:22px 25px 16px;background:rgba(248,253,255,.98);border:2px solid #c5e3f0;border-radius:20px;box-shadow:0 5px 20px rgba(24,72,96,.2);overflow:hidden}
.dialog{position:absolute;left:50%;bottom:40px;transform:translateX(-50%)}
.dialog-message-area{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable;padding:2px}
.message-row{display:flex;width:100%;justify-content:center}.message-row.player{flex-direction:column;align-items:flex-end;justify-content:flex-end;gap:5px}.message-row.heroine{justify-content:flex-start}
.message{display:block;max-width:78%;padding:16px 20px;border:2px solid transparent;border-radius:18px;font-size:30px;line-height:1.8;overflow-wrap:anywhere;text-align:left;color:#333}
.message.heroine{background:#fff1f5;color:#5c3440;border-color:#c77893}
.message-row.character{flex-direction:column;align-items:flex-start;gap:5px}.message.character{background:#fff9ed;color:#443c30;border-color:#d8c9ae}.message-speaker{padding-left:10px;font-size:14px;color:#695d4e}.message-row.player .message-speaker{padding:0 10px 0 0;color:#4f7182}
.room-exit-menu{display:grid;gap:16px;color:#38312f}.room-exit-menu h2{padding-right:28px}.room-exit-menu>button:not(.device-close){padding:14px;border:1px solid #c9bdb6;border-radius:10px;background:#fffdfa;color:#38312f;font:inherit;cursor:pointer}.room-transition-overlay{background:rgba(255,255,255,.96)}
.message.player{background:#eaf5fc;color:#2f4653;border-color:#94c5df}
.message-row.player.thought .message,.message.player.thought,.message-row.player[aria-label="主人公の心の声"] .message{background:#fbfdff;color:#516773;border-color:#9db9c7;border-style:dashed;font-style:italic}
.message.narration{max-width:92%;background:#fff;color:#333;border-color:#dedede}
.message.system{max-width:92%;background:#eceeef;color:#333;border-color:#ced2d6}
.dialog-controls{display:flex;flex:0 0 auto;align-items:center;justify-content:flex-end;gap:14px;padding-top:12px}
.dialog-controls button{position:static;display:inline-flex;align-items:center;justify-content:center;min-height:44px;margin:0;border:1px solid transparent;color:#444;font:inherit;cursor:pointer}
.dialog-controls .auto-button,.dialog-controls .skip-button,.dialog-controls .log-button{padding:8px 12px;border-color:#b4b8bd;border-radius:8px;background:#fff;font-size:15px;letter-spacing:.04em;white-space:nowrap}
.dialog-controls .auto-button{min-width:100px}.dialog-controls .skip-button{min-width:88px}.dialog-controls .log-button{min-width:60px}
.dialog-controls .auto-button[aria-pressed=true],.dialog-controls .skip-button[aria-pressed=true],.dialog-controls .log-button[aria-pressed=true]{border-color:#697f94;background:#dce9f5;color:#223a51;box-shadow:inset 0 0 0 1px #697f94}
.dialog-controls .next-button{min-width:48px;padding:0 6px;background:transparent;font-size:34px;line-height:1}
.dialog-controls button:hover{filter:brightness(.95)}.dialog-controls button:focus-visible{outline:3px solid #2563eb;outline-offset:2px}.dialog-controls button:disabled{opacity:.45;cursor:not-allowed}
.flash{width:100%;height:100%;background:#f00}
.black{width:100%;height:100%;background:#000}
@container game-viewport (max-width:768px){.dialog,.room-dialog{width:calc(100% - 24px);max-height:calc(100% - 48px);min-height:180px;padding:16px 14px 12px}.dialog{bottom:24px}.message{max-width:88%;padding:12px 14px;font-size:24px}.message.narration,.message.system{max-width:96%}.menu-panel{padding:44px 24px 28px}.menu-panel label{font-size:17px}}
@keyframes fadeIn{from{opacity:0}to{opacity:1}}

.room{width:100%;height:100%;position:relative;display:grid;grid-template-rows:32px minmax(0,1fr) 48px 44px;gap:10px;padding:14px 18px;overflow:hidden;background:#eeece6;color:#343831}
.room-header{display:flex;align-items:center;justify-content:space-between;gap:12px;width:min(100%,1440px);margin:auto}
.room-label{font-size:17px;letter-spacing:.14em;white-space:nowrap}.room-color-status{font-size:13px;letter-spacing:.06em;color:#71766b}
.room-stage-wrap{min-width:0;min-height:0;display:grid;place-items:center;container-type:size}
.room-stage{position:relative;width:min(100%,calc((540px - 182px)*1.5));aspect-ratio:3/2;isolation:isolate;overflow:hidden;background:#e9e7e1;box-shadow:0 3px 18px rgba(39,45,35,.12);border-radius:3px}
@supports(width:1cqw){.room-stage{width:min(100cqw,150cqh)}}
.room-background{position:absolute;inset:0;display:block;width:100%;height:100%;object-fit:contain;pointer-events:none;filter:none;transition:filter 2.8s ease}
/* Keep the restored-state hook; both states currently show the approved colors. */
.room.is-restored .room-background{filter:none}
.room-wall{position:absolute;inset:0}.room-wall[hidden]{display:none}
.object{position:absolute;border:0;background:transparent;color:#333;font:inherit;cursor:pointer;z-index:1}.object:before{content:"";position:absolute;inset:-10px}.object:focus-visible{outline:3px solid #2563eb;outline-offset:5px}.object span{position:absolute;bottom:-27px;left:50%;transform:translateX(-50%);white-space:nowrap;background:rgba(255,255,255,.92);padding:3px 8px;border-radius:4px;font-size:clamp(12px,14.4px,16px);box-shadow:0 1px 4px rgba(0,0,0,.1)}
.door-object{top:5%;left:36.5%;width:27%;height:74%}
.hana-object{left:17%;bottom:18%;width:14%;height:42%;border-radius:48% 48% 12% 12%;background:linear-gradient(#322b2c 0 25%,#f4d5c5 25% 42%,#e7e9ed 42%)}
.item-object{opacity:1;transition:opacity .2s,transform .2s}.item-object:hover{transform:scale(1.04)}.item-object.is-locked{opacity:0;pointer-events:none}
#phoneButton{left:61%;bottom:56%;width:5%;height:12%;z-index:2}#phoneButton:before{inset:-16px}#phoneButton img{display:block;width:100%;height:100%;object-fit:contain;object-position:center bottom;pointer-events:none}#pianoButton{left:23%;top:24%;width:53%;height:54%}#posterButton{left:55%;top:17%;width:17%;height:37%}#posterButton img{position:absolute;inset:4% 6%;display:block;width:88%;height:92%;object-fit:cover;pointer-events:none}#shelfButton{left:27%;top:16%;width:18%;height:62%}#deskButton{left:65%;top:40%;width:9%;height:10%}
.room-navigation{display:grid;grid-template-columns:1fr minmax(76px,140px) 1fr;align-items:center;gap:14px;width:min(100%,620px);margin:auto}.room-navigation button{display:flex;align-items:center;justify-content:center;gap:14px;min-height:44px;padding:5px 18px;border:1px solid #9caa93;border-radius:5px;background:#f8f8f3;color:#424d3e;font:inherit;font-size:22px;cursor:pointer}.room-navigation button span{font-size:14px}.room-navigation button:hover{background:#fff}.room-navigation button:focus-visible{outline:3px solid #2563eb;outline-offset:2px}.room-navigation p{text-align:center;letter-spacing:.08em;font-size:15px}
.explore-status{align-self:center;justify-self:center;width:min(100%,900px);text-align:center;color:#5f675a;font-size:clamp(12px,14.4px,15px);line-height:1.6}
.room-dialog-overlay{position:absolute;inset:0;z-index:5;background:rgba(0,0,0,.25);display:flex;align-items:flex-end;justify-content:center}.room-dialog{position:relative;margin-bottom:40px}.room-dialog .message{font-size:28px}
.inspection-overlay{position:absolute;inset:0;z-index:7;display:grid;place-items:center;padding:20px;background:rgba(0,0,0,.55);color:#333}
.inspection-panel{position:relative;display:flex;flex-direction:column;align-items:center;gap:16px;width:min(720px,100%);max-height:100%;padding:28px 28px 22px;border-radius:18px;background:#fafaf8;box-shadow:0 12px 32px rgba(0,0,0,.4);overflow:hidden}
.inspection-title{flex:0 0 auto;max-width:calc(100% - 70px);font-size:24px;font-weight:normal;text-align:center}
.inspection-close{position:absolute;top:10px;right:12px;display:grid;place-items:center;width:44px;height:44px;border:0;border-radius:6px;background:transparent;color:#333;font:inherit;font-size:30px;line-height:1;cursor:pointer}
.inspection-art-button{display:flex;flex:0 1 auto;align-items:center;justify-content:center;width:100%;height:min(313.2px,560px);min-height:0;padding:12px;border:1px solid #dfdfd8;border-radius:10px;background:#f1f0e9;color:#333;font:inherit;cursor:pointer}
.inspection-image{display:block;width:100%;height:100%;object-fit:contain;pointer-events:none}
.inspection-placeholder{flex:0 1 auto;max-width:100%;max-height:100%;pointer-events:none}.piano-preview{width:min(460px,90%);aspect-ratio:2/1;background:repeating-linear-gradient(90deg,#fff 0 12%,#222 12% 16%,#fff 16% 25%);border:12px solid #392f2c}.poster-preview{height:100%;aspect-ratio:2/3;background:#e4d4ae;border:8px solid #9b865f}
.inspection-help{flex:0 0 auto;font-size:15px;line-height:1.6;text-align:center}.inspection-art-button:hover{background:#e9e9e1}.inspection-close:hover{background:#e9e9e5}.inspection-art-button:focus-visible,.inspection-close:focus-visible{outline:3px solid #2563eb;outline-offset:2px}
.door-object.is-unlocked{background:transparent}
.device-overlay{position:absolute;inset:0;z-index:6;display:grid;place-items:center;padding:20px;background:rgba(0,0,0,.5);color:#222}.phone-screen,.piano-screen{position:relative;width:min(580px,100%);max-height:90%;overflow:auto;border:10px solid #252b34;border-radius:24px;background:#f6f8fb;box-shadow:0 12px 32px rgba(0,0,0,.4)}.phone-screen header{display:flex;align-items:center;justify-content:space-between;padding:15px 18px;background:#3c4653;color:#fff}.phone-screen header p{font-size:21px}.device-close{border:0;background:transparent;color:inherit;font-size:30px;line-height:1;cursor:pointer}.mail-tabs{display:flex;background:#e5e9ef}.mail-tabs button{flex:1;padding:13px;border:0;border-bottom:3px solid transparent;background:transparent;color:#4b5563;font:inherit;cursor:pointer}.mail-tabs button.is-active{border-color:#396ec7;color:#183a73;font-weight:bold}.mail-list{max-height:235px;overflow:auto;padding:8px 10px}.mail-item{display:grid;grid-template-columns:1fr auto;gap:3px;width:100%;padding:12px;border:0;background:#fff;text-align:left;color:#222;cursor:pointer}.mail-item+.mail-item{border-top:2px solid #c4d1dc}.mail-item:hover{background:#edf6fb}.mail-item.is-selected,.mail-item[aria-current="true"]{position:relative;z-index:1;padding:9px;border:3px solid #4b7898;border-radius:4px;background:#e9f5fb}.mail-item small{grid-column:1/-1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#58616d}.mail-item span{font-size:14px;color:#67717d}.mail-detail{min-height:170px;margin:10px;padding:16px;background:#fff;border:3px solid #4b7898;border-radius:5px;line-height:1.7}.mail-detail h3{margin:8px 0;font-size:17px}.mail-detail>p:first-child{font-size:14px;color:#58616d}.piano-screen{padding:54px 30px 30px;border-color:#392f2c;background:#f8f3ea}.piano-screen .device-close{position:absolute;top:14px;right:16px;color:#333}.piano-screen h2{margin-bottom:12px;font-weight:normal}.piano-screen label{display:grid;gap:8px;margin:24px 0 12px}.piano-screen input{width:100%;padding:13px;border:2px solid #a79b8b;border-radius:6px;font:inherit;font-size:22px;letter-spacing:.14em}.piano-screen button#playMelodyButton{width:100%;padding:14px;border:0;border-radius:7px;background:#392f2c;color:#fff;font:inherit;font-size:20px;cursor:pointer}.piano-result{min-height:1.8em;margin:12px 0;color:#8f1c1c}
@container game-viewport (max-width:768px){.room{padding:12px 10px;gap:8px}.room-label{font-size:15px}.room-color-status{font-size:11px}.room-navigation{gap:8px}.room-navigation button{padding:5px 10px;gap:8px}.room-navigation button span{font-size:12px}.room-navigation p{font-size:13px}.door-object{border-width:3px}#posterButton{border-width:2px}#pianoButton{border-width:4px}.object span{bottom:-24px;padding:3px 5px}.room-dialog{margin-bottom:24px}.room-dialog .message{font-size:21px}.inspection-overlay{padding:12px}.inspection-panel{gap:12px;padding:24px 16px 18px}.inspection-title{font-size:21px}.inspection-help{font-size:13px}.inspection-art-button{padding:10px}}
@container game-viewport (max-height:500px){.room{grid-template-rows:24px minmax(0,1fr) 44px 32px;gap:5px;padding:6px 12px}.room-stage{width:min(100%,calc((540px - 127px)*1.5))}.room-label{font-size:14px}.room-color-status{font-size:11px}.dialog,.room-dialog{min-height:0;max-height:calc(100% - 24px);padding:10px 14px}.dialog{bottom:12px}.room-dialog{margin-bottom:12px}.dialog .message,.room-dialog .message{font-size:18px;padding:8px 12px}.dialog-controls{padding-top:6px}.object span{bottom:-21px;font-size:11px;padding:2px 5px}.inspection-overlay{padding:10px}.inspection-panel{gap:8px;padding:12px 20px}.inspection-title{font-size:19px}.inspection-art-button{height:280.8px;padding:8px}.inspection-help{font-size:12px}}
@media(prefers-reduced-motion:reduce){.room-background,.item-object{transition:none}}

/* Previously read Hana topics stay available, with a quieter visual treatment. */
.hana-choice-button.is-viewed:not(.is-cancel){background:#e5e8eb;color:#5f666b;border-color:#c4cbd1;box-shadow:none}
.hana-choice-button.is-viewed:not(.is-cancel):hover{background:#dce2e6;border-color:#aeb9c1}

/* LOG grows the existing bottom-anchored dialogue; only its text region scrolls. */
.dialog,.room-dialog{--log-edge:40px;--log-side:20px}
.dialog.is-log-open,.room-dialog.is-log-open{height:min(410.4px,720px);min-height:0;max-height:calc(100% - max(var(--log-edge),env(safe-area-inset-top,0px)) - max(var(--log-edge),env(safe-area-inset-bottom,0px)));width:min(900px,calc(100% - max(var(--log-side),env(safe-area-inset-left,0px)) - max(var(--log-side),env(safe-area-inset-right,0px))))}
.dialog.is-log-open{bottom:max(var(--log-edge),env(safe-area-inset-bottom,0px))}
.room-dialog.is-log-open{margin-bottom:max(var(--log-edge),env(safe-area-inset-bottom,0px))}
.dialog-log-area{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable;padding:2px;touch-action:pan-y;-webkit-overflow-scrolling:touch}
.dialog-log-area[hidden],.dialog-message-area[hidden]{display:none}
.dialog-log-area .message{white-space:pre-wrap}
.dialog-log-area .message-row+.message-row{margin-top:14px}
.log-current-caption{margin:18px 2px 10px;padding-top:12px;border-top:1px solid #d5d9de;color:#66717c;font-size:13px;line-height:1.5;text-align:center}
.dialog-log-area:focus-visible{outline:2px solid #697f94;outline-offset:-2px;border-radius:4px}
@container game-viewport (max-width:768px){.dialog,.room-dialog{--log-edge:24px;--log-side:12px}.dialog-controls{gap:8px}}
@container game-viewport (max-height:500px){.dialog,.room-dialog{--log-edge:12px}.dialog.is-log-open,.room-dialog.is-log-open{height:calc(100% - 24px)}}

/* Title artwork is kept as supplied; screen blending hides its black JPEG backing. */
.title-home{position:relative;justify-content:initial;isolation:isolate;background:#211b21 url("images/ui/title-background.jpg") center/cover no-repeat}
.title-home::before{content:"";position:absolute;inset:0;background:linear-gradient(90deg,rgba(12,9,18,.48),transparent 50%),linear-gradient(180deg,rgba(12,9,18,.38),transparent 38%,rgba(12,9,18,.22));pointer-events:none}
.title-home .title-logo{position:absolute;z-index:1;top:5%;left:50%;width:min(900px,921.6px);height:auto;aspect-ratio:1280/190;overflow:hidden;transform:translateX(-50%);margin:0;font-size:0;mix-blend-mode:screen}
.title-home .title-logo img{position:absolute;top:0;left:0;display:block;width:100%;height:auto;transform:translateY(-35%);pointer-events:none}
.title-home .title-menu{position:absolute;z-index:1;left:5%;bottom:7%;display:grid;gap:6px;width:min(260px,768px);mix-blend-mode:screen}
.title-home .title-menu button{position:relative;display:block;width:100%;height:62px;overflow:hidden;border:0;border-radius:0;background:transparent;cursor:pointer;transition:opacity .2s,filter .2s,transform .2s}
.title-home .title-menu button img{position:absolute;top:0;left:var(--art-left);display:block;width:var(--art-width);max-width:none;height:auto;transform:translateY(var(--art-y));pointer-events:none}
.title-home #startButton{--art-width:230%;--art-left:-40%;--art-y:-39%}
.title-home #continueButton{--art-width:130%;--art-left:-13%;--art-y:-36%}
.title-home #settingsButton{--art-width:200%;--art-left:-32%;--art-y:-34%}
.title-home #commentButton{--art-width:220%;--art-left:-45%;--art-y:-39%}
.title-home .title-menu button:hover:not(:disabled){background:transparent;filter:drop-shadow(0 0 6px #fff);transform:translateX(6px)}
.title-home .title-menu button:disabled{opacity:.46;cursor:not-allowed}
.title-home .title-menu button:focus-visible{outline:2px solid #fff;outline-offset:-3px}
.title-home .title-notice{position:absolute;z-index:1;left:5%;bottom:1%;margin:0;text-shadow:0 1px 4px #000}
@container game-viewport (max-width:650px){.title-home{background-position:center}.title-home::before{background:linear-gradient(180deg,rgba(12,9,18,.48),transparent 32%,transparent 55%,rgba(12,9,18,.64))}.title-home .title-logo{top:8%;width:940.8px}.title-home .title-menu{left:50%;bottom:5%;width:min(260px,720px);transform:translateX(-50%);gap:2px}.title-home .title-menu button{height:58px}.title-home .title-notice{left:5%;right:5%;bottom:1%;text-align:center;font-size:13px}}
@container game-viewport (max-height:500px){.title-home .title-logo{top:2%;width:min(680px,768px)}.title-home .title-menu{bottom:2%;gap:0}.title-home .title-menu button{height:45px}.title-home .title-notice{bottom:0;font-size:12px}}

/* Room 02: approved artwork is split pixel-exactly into backdrop and desk foreground.
   Hana keeps her existing expression/idle rendering, but stands BEHIND the desk.
   All exploration hit targets are separate from noninteractive visual layers. */
.room-two{background:#e8e5df}
.room2-stage{border:0;background:#dedbd4}
.room2-background-art,.room2-desk-foreground-art{position:absolute;inset:0;display:block;width:100%;height:100%;object-fit:fill;pointer-events:none;user-select:none;image-rendering:pixelated}
.room2-background-art{z-index:0}
.room2-desk-foreground-art{z-index:5}
.room2-object{min-width:0;min-height:0;border-radius:0;z-index:2}
.room2-object:hover{background:#ffffff18}
.room2-object:focus-visible{outline:3px solid #c8a65c;outline-offset:-3px}
.room2-door{left:42.5%;top:22.5%;width:14.5%;height:41%;z-index:7}
.room2-table{left:19.5%;top:75%;width:60%;height:25%;z-index:7}
.room2-blocks{left:24%;top:62.5%;width:51%;height:13.5%;z-index:8}
.room2-blocks:disabled{cursor:default}
/* Hana moved inward/upward; the desk-alpha image hides her lower body naturally. */
.room2-hana{left:22%;top:35%;width:13%;height:38%;z-index:4;border-radius:45% 45% 10% 10%;background:linear-gradient(90deg,#544f50,#7e7776 45%,#514e50);opacity:.65}
.room2-hana:after{content:"";position:absolute;top:-18%;left:29%;width:42%;height:26%;border-radius:50%;background:#d1b9a8;box-shadow:0 -5px 0 5px #403b3e}
.room2-puzzle-overlay{z-index:8}.room2-puzzle{position:relative;width:min(900px,100%);max-height:100%;overflow:auto;padding:28px;background:#f4f1e9;border-radius:14px;box-shadow:0 10px 35px #0005}.room2-puzzle h2{margin:0 45px 8px 0;font-size:24px}.room2-rule{margin:0 0 14px;color:#555}.room2-answer-slots{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:6px}.room2-answer-slot{display:grid;min-width:0;min-height:72px;place-items:center;padding:3px;border:2px dashed #52617d;border-radius:10px;background:#fff;cursor:pointer}.room2-answer-slot.is-selected{border-style:solid;border-color:#387da4;background:#e3f3fa;transform:translateY(-3px)}.room2-answer-slot>span{color:#66738c;font-size:13px;font-weight:700}.room2-answer-slot i,.room2-palette-token i{display:grid;width:100%;min-width:34px;min-height:52px;place-items:center;border:2px solid #ffffff70;border-radius:9px;color:#fff;font-size:clamp(1.6rem,67.2px,2.2rem);font-style:normal;font-weight:800;text-shadow:0 2px 2px #0007}.room2-answer-slot i.red,.room2-palette-token i.red,.room2-history-row i.red{background:#a94b46}.room2-answer-slot i.blue,.room2-palette-token i.blue,.room2-history-row i.blue{background:#46678e}.room2-palette{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:6px;margin-top:12px}.room2-palette-token{min-width:0;padding:3px;border:2px solid transparent;border-radius:10px;background:transparent;cursor:pointer}.room2-palette-token.is-active{border-color:#387da4;background:#d9edf5}.room2-palette-token i{min-height:48px}.room2-palette-token small{display:block;margin-top:3px;color:#333;font-size:12px}.room2-puzzle-actions{display:flex;flex-wrap:wrap;justify-content:center;gap:10px;margin:14px 0}.room2-puzzle-actions button{min-height:42px;padding:6px 16px;border:1px solid #89937f;border-radius:5px;background:#fff;font:inherit;cursor:pointer}.room2-attempt-counter{margin:0 0 14px;padding:10px 12px;border:1px solid #bac5d1;border-radius:8px;background:#e8edf1;color:#27394b}
.room2-attempt-summary{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:4px 12px;font-size:14px}
.room2-attempt-left{font-weight:800}
.room2-attempt-track{display:grid;grid-template-columns:repeat(8,minmax(0,1fr));gap:4px;margin-top:8px}
.room2-attempt-step{display:block;min-width:0;height:8px;border-radius:3px;background:#cbd4dc}
.room2-attempt-step.is-used{background:#46678e}
.room2-feedback{text-align:center;min-height:24px;font-weight:700}.room2-history{display:grid;gap:4px;max-height:129.6px;overflow:auto}.room2-history-row{display:flex;justify-content:space-between;align-items:center;padding:5px 9px;border-bottom:1px solid #ddd}.room2-history-row.is-latest{background:#e6eef5;border-left:3px solid #46678e;padding-left:6px}.room2-history-row span{display:flex;gap:8px}.room2-history-turn{flex:0 0 auto;color:#52617d;font-size:12px;font-weight:700;white-space:nowrap}.room2-history-row i{width:31px;height:31px;display:grid;place-items:center;border-radius:4px;color:#fff;font-style:normal;font-weight:700}
@container game-viewport (max-width:600px){.room2-answer-slots{gap:4px}.room2-answer-slot{min-height:58px;padding:2px}.room2-answer-slot i{min-width:28px;min-height:44px;font-size:1.55rem}.room2-answer-slot>span{font-size:11px}.room2-palette{gap:3px}.room2-palette-token{padding:2px}.room2-palette-token i{min-width:27px;min-height:39px;font-size:1.45rem}.room2-palette-token small{font-size:10px}.room2-puzzle{padding:24px 12px 14px}.room2-puzzle h2{font-size:20px}.room2-rule{font-size:13px}.room2-history-turn{font-size:10px}.room2-history-row i{width:25px;height:25px}}

/* LOG grows the existing bottom-anchored dialogue; only its text region scrolls. */
.dialog,.room-dialog{--log-edge:40px;--log-side:20px}
.dialog.is-log-open,.room-dialog.is-log-open{height:min(410.4px,720px);min-height:0;max-height:calc(100% - max(var(--log-edge),env(safe-area-inset-top,0px)) - max(var(--log-edge),env(safe-area-inset-bottom,0px)));width:min(900px,calc(100% - max(var(--log-side),env(safe-area-inset-left,0px)) - max(var(--log-side),env(safe-area-inset-right,0px))))}
.dialog.is-log-open{bottom:max(var(--log-edge),env(safe-area-inset-bottom,0px))}
.room-dialog.is-log-open{margin-bottom:max(var(--log-edge),env(safe-area-inset-bottom,0px))}
.dialog-log-area{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable;padding:2px;touch-action:pan-y;-webkit-overflow-scrolling:touch}
.dialog-log-area[hidden],.dialog-message-area[hidden]{display:none}
.dialog-log-area .message{white-space:pre-wrap}
.dialog-log-area .message-row+.message-row{margin-top:14px}
.log-current-caption{margin:18px 2px 10px;padding-top:12px;border-top:1px solid #d5d9de;color:#66717c;font-size:13px;line-height:1.5;text-align:center}
.dialog-log-area:focus-visible{outline:2px solid #697f94;outline-offset:-2px;border-radius:4px}
@container game-viewport (max-width:768px){.dialog,.room-dialog{--log-edge:24px;--log-side:12px}.dialog-controls{gap:8px}}
@container game-viewport (max-height:500px){.dialog,.room-dialog{--log-edge:12px}.dialog.is-log-open,.room-dialog.is-log-open{height:calc(100% - 24px)}}

/* Title artwork is kept as supplied; screen blending hides its black JPEG backing. */
.title-home{position:relative;justify-content:initial;isolation:isolate;background:#211b21 url("images/ui/title-background.jpg") center/cover no-repeat}
.title-home::before{content:"";position:absolute;inset:0;background:linear-gradient(90deg,rgba(12,9,18,.48),transparent 50%),linear-gradient(180deg,rgba(12,9,18,.38),transparent 38%,rgba(12,9,18,.22));pointer-events:none}
.title-home .title-logo{position:absolute;z-index:1;top:5%;left:50%;width:min(900px,921.6px);height:auto;aspect-ratio:1280/190;overflow:hidden;transform:translateX(-50%);margin:0;font-size:0;mix-blend-mode:screen}
.title-home .title-logo img{position:absolute;top:0;left:0;display:block;width:100%;height:auto;transform:translateY(-35%);pointer-events:none}
.title-home .title-menu{position:absolute;z-index:1;left:5%;bottom:7%;display:grid;gap:6px;width:min(260px,768px);mix-blend-mode:screen}
.title-home .title-menu button{position:relative;display:block;width:100%;height:62px;overflow:hidden;border:0;border-radius:0;background:transparent;cursor:pointer;transition:opacity .2s,filter .2s,transform .2s}
.title-home .title-menu button img{position:absolute;top:0;left:var(--art-left);display:block;width:var(--art-width);max-width:none;height:auto;transform:translateY(var(--art-y));pointer-events:none}
.title-home #startButton{--art-width:230%;--art-left:-40%;--art-y:-39%}
.title-home #continueButton{--art-width:130%;--art-left:-13%;--art-y:-36%}
.title-home #settingsButton{--art-width:200%;--art-left:-32%;--art-y:-34%}
.title-home #commentButton{--art-width:220%;--art-left:-45%;--art-y:-39%}
.title-home .title-menu button:hover:not(:disabled){background:transparent;filter:drop-shadow(0 0 6px #fff);transform:translateX(6px)}
.title-home .title-menu button:disabled{opacity:.46;cursor:not-allowed}
.title-home .title-menu button:focus-visible{outline:2px solid #fff;outline-offset:-3px}
.title-home .title-notice{position:absolute;z-index:1;left:5%;bottom:1%;margin:0;text-shadow:0 1px 4px #000}
@container game-viewport (max-width:650px){.title-home{background-position:center}.title-home::before{background:linear-gradient(180deg,rgba(12,9,18,.48),transparent 32%,transparent 55%,rgba(12,9,18,.64))}.title-home .title-logo{top:8%;width:940.8px}.title-home .title-menu{left:50%;bottom:5%;width:min(260px,720px);transform:translateX(-50%);gap:2px}.title-home .title-menu button{height:58px}.title-home .title-notice{left:5%;right:5%;bottom:1%;text-align:center;font-size:13px}}
@container game-viewport (max-height:500px){.title-home .title-logo{top:2%;width:min(680px,768px)}.title-home .title-menu{bottom:2%;gap:0}.title-home .title-menu button{height:45px}.title-home .title-notice{bottom:0;font-size:12px}}

/* Room 1 to room 2 door transition and room 2 inline feedback. */
.room-transition{position:absolute;inset:0;z-index:40;display:grid;place-items:center;background:#211b18;animation:roomDoorTransition 1.1s ease both}.room-transition img{display:block;width:100%;height:100%;object-fit:contain}
@keyframes roomDoorTransition{0%{opacity:0}12%,78%{opacity:1}100%{opacity:0}}
.room-two.room2-arriving{animation:room2Arrival 1.35s ease-out both}
@keyframes room2Arrival{from{opacity:0;filter:brightness(.72)}to{opacity:1;filter:brightness(1)}}
.room2-reaction{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:4px 12px;align-items:center;margin:8px 0 12px;padding:10px 14px;border:1px solid #b9d5e2;border-radius:12px;background:#eef7fb;color:#2f414a}
.room2-reaction[hidden]{display:none}.room2-reaction-speaker{grid-column:1/-1;margin:0;color:#8a4058;font-size:13px;font-weight:700}.room2-reaction-text{margin:0;line-height:1.6}.room2-reaction-next{min-width:86px;min-height:40px;padding:7px 12px;border:1px solid #9ab9c7;border-radius:8px;background:#fff;color:#2f414a;font:inherit;cursor:pointer}
.room2-leftmost-hint{margin:8px 0;padding:10px 13px;border:1px solid #c5aa65;border-radius:9px;background:#fff8df;color:#554519;font-weight:700;text-align:center}.room2-leftmost-hint[hidden]{display:none}
@container game-viewport (max-width:600px){.room2-reaction{padding:8px 10px;gap:4px 7px}.room2-reaction-text{font-size:13px}.room2-reaction-next{min-width:70px;min-height:36px;padding:6px;font-size:12px}}
.title-home .title-menu #testRoomButton{height:42px;border:1px solid rgba(255,255,255,.58);border-radius:8px;background:rgba(31,28,36,.68);color:#fff;font:inherit;font-size:14px;letter-spacing:.08em;text-shadow:0 1px 4px #000;mix-blend-mode:normal}
.title-home .title-menu #testRoomButton:hover:not(:disabled){background:rgba(69,63,75,.9);filter:drop-shadow(0 0 6px #fff);transform:translateX(4px)}
.test-room-overlay{position:absolute;inset:0;z-index:70;display:flex;align-items:center;justify-content:center;box-sizing:border-box;padding:clamp(8px,10.8px,18px);overflow:hidden;background:rgba(18,16,19,.76);color:#302b29}
.test-room-panel{position:relative;box-sizing:border-box;width:min(460px,100%);max-width:100%;max-height:100%;min-height:0;display:flex;flex-direction:column;overflow:hidden;padding:34px 28px 26px;border:1px solid #d2c8c0;border-radius:16px;background:#f8f6f2;box-shadow:0 16px 42px #0008}
.test-room-panel h2{margin:0 44px 10px 0;font-size:22px;font-weight:normal}.test-room-panel>p{margin:0 0 18px;color:#6b625d;font-size:13px;line-height:1.65}
.test-room-panel .device-close{position:absolute;top:8px;right:10px;color:#302b29}.test-room-options{display:grid;gap:9px;flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;-webkit-overflow-scrolling:touch}.test-room-options button{min-height:48px;padding:10px 14px;border:1px solid #c7bcb4;border-radius:9px;background:#fff;color:#302b29;font:inherit;text-align:left;cursor:pointer}.test-room-options button:hover{background:#f1ece7;border-color:#9c8d83}.test-room-options button:focus-visible{outline:3px solid #367da0;outline-offset:2px}
@container game-viewport (max-width:600px){.title-home .title-menu #testRoomButton{height:35px;font-size:12px}.test-room-panel{padding:30px 17px 20px}.test-room-panel h2{font-size:19px}}
/* Keep all eight test rooms reachable inside the game canvas on short landscape screens. */
@container game-viewport (max-height:600px) and (min-width:480px){
 .test-room-panel{width:min(670px,100%);padding:18px 18px 12px}
 .test-room-panel h2{font-size:20px;margin-bottom:5px}
 .test-room-panel>p{font-size:12px;line-height:1.4;margin-bottom:10px;padding-right:66px}
 .test-room-options{grid-template-columns:repeat(2,minmax(0,1fr));gap:6px 10px}
 .test-room-options button{min-height:42px;padding:6px 12px;font-size:14px}
}
@container game-viewport (max-height:320px){
 .test-room-panel{padding-top:12px;padding-bottom:9px}
 .test-room-panel h2{font-size:16px;margin-bottom:4px}
 .test-room-panel>p{font-size:11px;line-height:1.25;margin-bottom:6px}
 .test-room-options button{min-height:36px}
}

/* Room 03 provisional, replaceable room and puzzle artwork. The authored board has 10 rows and 10 columns. */
.room-three{background:#e9e2df}.room3-stage{background:linear-gradient(180deg,#d8d5d4 0 68%,#9d8e83 68%);border:1px solid #c9c0b9}
.room3-stage:before{display:none}
.room3-bed-art{position:absolute;left:4%;bottom:16%;width:32%;height:27%;border:8px solid #6a5d58;border-radius:4px;background:linear-gradient(#e7d9d9 0 26%,#8d777b 27%);box-shadow:0 9px 9px #55483e66}
.room3-desk-art{position:absolute;left:35%;bottom:20%;width:34%;height:17%;background:linear-gradient(#393b3a 0 18%,#765f51 19% 48%,#4e4038 49%);clip-path:polygon(2% 0,98% 0,100% 27%,93% 100%,87% 100%,86% 40%,14% 40%,13% 100%,7% 100%,0 27%);filter:drop-shadow(0 5px 5px #3337)}
.room3-shelf-art{position:absolute;left:7%;top:8%;width:19%;height:49%;border:7px solid #63564d;background:repeating-linear-gradient(180deg,#826b57 0 31%,#59483e 32% 35%);box-shadow:inset 0 0 0 2px #b0987d}
.room3-trumpet-art{position:absolute;left:27%;top:51%;width:8%;height:16%;display:grid;place-items:center;border:3px solid #9d7a35;border-radius:12px;color:#b6934c;background:linear-gradient(90deg,#4c4945,#272727);font-size:22px}
.room3-object{border-radius:4px}.room3-door{left:74%;top:19%;width:14%;height:51%;border:8px solid #695448;background:linear-gradient(90deg,#93735a,#b18f71 50%,#927359);box-shadow:inset 0 0 0 3px #c7a98b}.room3-bed{left:4%;bottom:15%;width:32%;height:28%}.room3-desk{left:37%;top:64%;width:31%;height:19%}.room3-shelf{left:7%;top:8%;width:19%;height:48%}.room3-trumpet{left:27%;top:50%;width:9%;height:18%}.room3-hana{left:62%;bottom:17%;width:10%;height:35%;border-radius:46% 46% 9% 9%;background:linear-gradient(#453a3c 0 28%,#dbc0ae 29% 43%,#d9d7dd 44%)}.room3-hana:after{content:"";position:absolute;left:29%;top:-17%;width:42%;height:23%;border-radius:50%;background:#e0c8b7;box-shadow:0 -5px 0 4px #493c40}
.room3-phone{left:43%;top:58%;width:6%;height:11%;border:3px solid #333;border-radius:5px;background:linear-gradient(145deg,#596574,#19212a)}.room3-board{left:53%;top:57%;width:9%;height:11%;border:2px solid #9d8968;background:#e6d9bd}
.room3-arriving{animation:room3Arrive 1.1s ease both}@keyframes room3Arrive{from{opacity:0}to{opacity:1}}
.room3-puzzle-overlay{z-index:9}.room3-puzzle-panel{position:relative;width:min(880px,100%);max-height:95%;overflow:auto;padding:32px 26px 22px;border-radius:16px;background:#f7f4ed;color:#302d29;box-shadow:0 12px 36px #0006}.room3-puzzle-panel h2{margin:0 50px 8px 0;font-size:24px;font-weight:normal}.room3-puzzle-instruction{min-height:1.6em;margin-bottom:10px;color:#59544e;line-height:1.6}.room3-morse-entry,.room3-final-entry{display:grid;grid-template-columns:1fr auto;align-items:end;gap:12px;margin:12px 0}.room3-morse-entry label,.room3-final-entry label{display:grid;gap:6px}.room3-answer-input,.room3-final-input{min-width:0;padding:10px;border:1px solid #a9a195;border-radius:5px;font:inherit;font-size:18px}.room3-answer-submit,.room3-final-submit{min-height:42px;padding:7px 16px;border:1px solid #998f81;border-radius:5px;background:#fff;font:inherit;cursor:pointer}
.room3-letterboard{display:grid;gap:3px;max-width:760px;margin:12px auto;padding:8px;border:1px solid #c4b79f;background:#e9e1d3}.room3-letterboard[hidden],.room3-final-entry[hidden],.room3-morse-entry[hidden]{display:none}.room3-board-row{display:grid;grid-template-columns:repeat(10,minmax(0,1fr));gap:3px}.room3-board-row span{display:grid;aspect-ratio:1;place-items:center;border:1px solid #d3c5ae;background:#fbf7ed;color:#3f3933;font-size:clamp(11px,22.08px,20px)}.room3-puzzle-feedback{min-height:1.7em;text-align:center;color:#8f1c1c;font-weight:700}.room3-puzzle-note{margin-top:10px;color:#6d6b64;font-size:12px;text-align:center}
.room3-chat-overlay{z-index:9}.room3-chat-panel{position:relative;width:min(600px,100%);max-height:92%;overflow:auto;padding:20px;border:9px solid #303640;border-radius:22px;background:#f5f3ed;color:#292d33}.room3-chat-panel header{display:flex;align-items:center;justify-content:space-between;padding:0 4px 10px}.room3-chat-panel header h2{font-weight:normal}.room3-chat-panel .device-close{color:#333}.room3-chat-copy{display:grid;gap:5px;padding:10px;background:#fff;border-radius:8px}.room3-chat-copy p{line-height:1.6}.room3-chat-context{padding:10px 0 5px;color:#626970;font-size:13px}.room3-chat-list{display:grid;gap:6px;max-height:189px;overflow:auto;padding:10px;background:#e8edf1}.room3-chat-message{display:grid;gap:2px;width:max-content;max-width:82%}.room3-chat-message.player{justify-self:end;text-align:right}.room3-chat-message small{color:#687078;font-size:11px}.room3-chat-message p{padding:8px 11px;border-radius:12px;background:white;font-size:19px}.room3-chat-message.player p{background:#d8eaff}
@container game-viewport (max-width:620px){.room3-puzzle-panel{padding:30px 12px 16px}.room3-puzzle-panel h2{font-size:20px}.room3-letterboard{gap:2px;padding:4px}.room3-board-row{gap:2px}.room3-board-row span{font-size:clamp(10px,26.88px,17px)}.room3-morse-entry,.room3-final-entry{grid-template-columns:1fr}.room3-answer-submit,.room3-final-submit{width:100%}.room3-door{border-width:5px}.room3-chat-panel{padding:14px}}


/* Room 04: astronomy exhibit. Artwork is CSS-based until final assets are supplied. */
.room-four{background:#090d1d;color:#eef3ff}.room4-stage{background:radial-gradient(circle at 30% 30%,#263354 0,#111a36 38%,#070b18 78%);border:1px solid #33436c;box-shadow:inset 0 0 70px #000}
.r4-sky{position:absolute;inset:0;background-image:radial-gradient(circle,#fff 0 1px,transparent 1.6px),radial-gradient(circle,#9fc9ff 0 1px,transparent 1.5px);background-size:83px 67px,121px 97px;background-position:13px 9px,51px 31px;opacity:.65}
.r4-door-art{position:absolute;left:43%;top:15%;width:15%;height:57%;border:6px solid #32384b;background:linear-gradient(90deg,#20283d,#343d56 50%,#1d2539);box-shadow:0 0 18px #6e8fd633}
.r4-light-art{position:absolute;left:43%;bottom:13%;width:12%;height:10%;border-radius:50%;background:radial-gradient(circle,#f9f4cf,#a79f73 38%,#3c3d45 40%);box-shadow:0 0 20px #fff8b955}
.r4-display-art{position:absolute;right:5%;top:12%;width:27%;height:48%;border:3px solid #68728c;background:linear-gradient(#1b2747,#11192e);box-shadow:inset 0 0 0 2px #202b47}
.r4-projection{position:absolute;left:4%;top:16%;width:30%;height:48%;border-radius:50%;opacity:0;transition:opacity .3s;background:radial-gradient(circle,#24365b55,transparent 70%)}.r4-projection.on{opacity:1}.r4-projection i{position:absolute;left:var(--x);top:var(--y);width:5px;height:5px;border-radius:50%;background:#fff;box-shadow:0 0 8px #b9d7ff}.r4-projection.complete{filter:drop-shadow(0 0 8px #fff)}.r4-projection.complete i:nth-child(4){width:9px;height:9px;box-shadow:0 0 18px #d9ecff}
.r4obj{border-radius:5px}.r4door{left:44%;top:18%;width:13%;height:52%}.r4light{left:43%;bottom:12%;width:13%;height:13%}.r4stand{left:35%;bottom:9%;width:8%;height:18%}.r4const{right:7%;top:15%;width:11%;height:20%}.r4meteor{right:19%;top:15%;width:11%;height:20%}.r4p1{right:7%;top:38%;width:8%;height:13%}.r4p2{right:16%;top:38%;width:8%;height:13%}.r4p3{right:25%;top:38%;width:8%;height:13%}.r4wall{left:8%;top:57%;width:10%;height:15%;border:2px solid #8da8c766;background:#d9efff12}.r4box{left:20%;bottom:13%;width:10%;height:17%;background:#5d647088}.r4hana{left:60%;bottom:16%;width:10%;height:35%;border-radius:46% 46% 9% 9%;background:linear-gradient(#302b3d 0 27%,#d6bba9 28% 42%,#d7d9e5 43%)}
.room4-arriving{animation:r4arrive 1.1s ease both}@keyframes r4arrive{from{opacity:0;filter:brightness(.55)}to{opacity:1;filter:brightness(1)}}
.r4-panel-overlay,.r4-mini-overlay{z-index:10}.r4-panel-ui,.r4-mini{position:relative;width:min(850px,100%);max-height:94%;overflow:auto;padding:28px;border-radius:16px;background:#f7f5ef;color:#272b35;box-shadow:0 12px 36px #0008}.r4-panel-ui h2,.r4-mini h2{margin:0 44px 10px 0}
.r4-panels{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px;margin:15px 0}.r4-panels article{padding:8px;border:1px solid #b9c1ce;border-radius:10px;text-align:center}.r4-panels h3{font-size:13px}.r4-glass{position:relative;aspect-ratio:1;border:2px solid #7891ad;background:#dff2ff55;transition:transform .2s}.r4-glass i{position:absolute;width:8px;height:8px;border-radius:50%;background:#fff;box-shadow:0 0 5px #2f72a7}.r4-glass i:nth-child(1){left:20%;top:25%}.r4-glass i:nth-child(2){left:67%;top:38%}.r4-glass i:nth-child(3){left:43%;top:70%}.r4-panels button,.r4-shine,.r4-answer,.r4-rainbow button{min-height:38px;border:1px solid #8b96a8;border-radius:6px;background:#fff;font:inherit;cursor:pointer}.r4-shine{display:block;margin:12px auto;padding:6px 20px}.r4-feedback{min-height:1.6em;color:#8f1c1c;text-align:center}
/* Keep the five glass panes and light action in a short landscape viewport. */
@container game-viewport (min-aspect-ratio: 1/1) and (max-height:460px){
 #game .r4-panel-ui{width:min(820px,100%);max-height:calc(540px - 8px);padding:10px 14px;border-radius:10px}
 .r4-panel-ui h2{font-size:19px;line-height:1.2;margin:0 44px 2px 0}
 .r4-panel-ui>p{font-size:12px;line-height:1.2;margin:3px 0}
 .r4-panel-ui .r4-panels{margin:6px 0;gap:6px}
 .r4-panel-ui .r4-panels article{padding:4px;border-radius:6px}
 .r4-panel-ui .r4-panels h3{font-size:11px;line-height:1.15;margin:0 0 4px}
 .r4-panel-ui .r4-glass{width:min(100%,78px);margin:0 auto}
 .r4-panel-ui .r4-panels article p{font-size:12px;line-height:1.15;margin:3px 0}
 .r4-panel-ui .r4-panels button{min-height:32px;padding:0 4px;font-size:12px}
 .r4-panel-ui .r4-feedback{min-height:13px;font-size:12px;margin:3px 0}
 .r4-panel-ui .r4-shine{min-height:34px;font-size:13px;margin:3px auto 0;padding:2px 16px}
}
.r4-digits{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin:18px 0;padding:20px;background:#f1e7cf}.r4-digits b{display:grid;place-items:center;min-height:100px;font-size:58px}.r4-digits .silver{color:#aaa}.r4-digits .white{color:#fff;text-shadow:0 0 2px #222}.r4-digits .black{color:#222}.r4-digits .green{color:#16a34a}.r4-mini label{display:grid;gap:5px;margin:12px 0}.r4-mini input{padding:10px;border:1px solid #9da5b1;font:inherit}.r4-flags{display:grid;gap:8px;margin:12px 0}.r4-flags span{padding:8px;border:1px solid #ccd2db;background:#fff;line-height:1.4}.r4-moon{padding:10px;border-left:4px solid #7d8faf;background:#e8edf5;font-size:13px}.r4-rainbow{display:grid;gap:6px}.r4-rainbow>div{display:grid;grid-template-columns:1fr auto auto;gap:7px;align-items:center;padding:8px 12px;border:1px solid #bbb;border-radius:7px;background:#fff}
.r4-next{position:absolute;inset:0;display:grid;place-items:center;background:radial-gradient(circle,#202c4c,#080b15);color:#fff;text-align:center}.r4-next>div{padding:30px}.r4-next button{padding:10px 18px;border:1px solid #c8d7ef;border-radius:8px;background:#fff;color:#222;font:inherit}
@container game-viewport (max-width:650px){.r4-panels{grid-template-columns:repeat(2,1fr)}.r4-panel-ui,.r4-mini{padding:25px 12px 16px}.r4obj span{font-size:10px}.r4const,.r4meteor{width:13%}.r4p1,.r4p2,.r4p3{width:9%}}

/* Room 3: approved four views share a single image coordinate system. */
#game .room3-stage{background:#eee7dc;border:0}
.room3-background-art{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;pointer-events:none;z-index:0;image-rendering:pixelated}
#game .room3-object:not(.room3-hana){background:transparent;border:0;box-shadow:none;border-radius:0;z-index:7}
#game .room3-object[hidden]{display:none!important}
#game .room3-door{left:40.4%;top:1.6%;width:18.8%;height:58%;bottom:auto}
.room3-shared-door{display:none;position:absolute;left:40.4%;top:1.6%;width:18.8%;height:58%;background:url(images/background/room01/pixel/room01_front_fine.png) 49.4536% 16.6008%/350.6849% 132.8145% no-repeat;image-rendering:pixelated;pointer-events:none;z-index:1}
.room3-stage[data-view=front] .room3-shared-door{display:block}
#game .room3-desk{left:33%;top:40%;width:34%;height:31%;bottom:auto}
#game .room3-phone{left:50.8%;top:34.2%;width:4.2%;height:5.5%}
#game .room3-board{left:41.4%;top:33.8%;width:6.4%;height:6%}
#game .room3-shelf{left:35.3%;top:24%;width:16.4%;height:41.5%}
#game .room3-trumpet{left:53.3%;top:42%;width:19.5%;height:25%}
#game .room3-bed{left:11.3%;top:33.5%;width:75.6%;height:38%;bottom:auto}
#game .room3-hana{left:23%;top:34%;width:13%;height:38%;bottom:auto;z-index:4}

/* Approved full-body sleep pose; keep the bed and interaction target fixed. */
.room3-sleeping-hana,.room3-sleep-shoes{display:none;position:absolute;pointer-events:none;z-index:3;image-rendering:pixelated}
.room3-stage[data-view=left].hana-asleep :is(.room3-sleeping-hana,.room3-sleep-shoes){display:block}
.room3-sleeping-hana{left:23.3%;top:26.7%;width:42%;height:21%;background:url(images/characters/hana-hires/poses/sleeping.webp) center/contain no-repeat;image-rendering:auto;transform-origin:99% 81%;animation:hanaSleepBreath 4.8s ease-in-out infinite}
.room3-sleeping-hana span{display:none}
.room3-sleep-shoes{left:64.4%;top:68.8%;width:8.1%;height:8.7%;background:url(images/characters/hana-current/poses/shoes-generated-v2.webp) center/contain no-repeat}
#game .room3-object.room3-sleep-target{left:23.3%;top:26.7%;width:42%;height:21%;z-index:9}
#game .room .room3-sleep-target::after{left:13%;top:5%}
@keyframes hanaSleepBreath{0%,100%{transform:rotate(0deg)}50%{transform:rotate(.07deg)}}
@media(prefers-reduced-motion:reduce){.room3-sleeping-hana{animation:none}}

#game .room3-stage.hana-asleep .room3-bed::after{display:none}

/* Adopted room 4 art: front / right / back / left. */
#game .room4-stage{background:#101b34;border:0;box-shadow:none}
.room4-background-art{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;image-rendering:pixelated;pointer-events:none;z-index:0}
#game .room4-stage .r4obj:not(.r4hana){background:transparent;border:0;box-shadow:none;border-radius:0;z-index:7}
#game .room4-stage .r4obj[hidden]{display:none!important}
.room4-shared-door{display:none;position:absolute;left:41.55%;top:23.4%;width:17%;height:51.8%;background:url(images/background/room01/pixel/room01_front_fine.png) 49.4536% 16.6008%/350.6849% 132.8145% no-repeat;image-rendering:pixelated;pointer-events:none;z-index:1}
.room4-stage[data-view=front] .room4-shared-door{display:block}
#game .room4-stage .r4door{left:41.55%;top:23.4%;width:17%;height:51.8%;bottom:auto}
#game .room4-stage .r4wall{left:23.4%;top:29.4%;width:14%;height:22.5%;bottom:auto}
#game .room4-stage .r4box{left:64.4%;top:50.8%;width:10.5%;height:28.3%;bottom:auto}
#game .room4-stage .r4hana{left:79%;top:40%;width:10%;height:35%;bottom:auto;z-index:4}
#game .room4-stage .r4light{left:46.5%;top:69%;width:7.2%;height:14.5%;bottom:auto}
#game .room4-stage .r4stand{left:44.7%;top:64.8%;width:10.6%;height:7.2%;bottom:auto}
#game .room4-stage .r4const{left:16%;top:22.5%;width:29%;height:35.5%;right:auto;bottom:auto}
#game .room4-stage .r4flowers{left:55.5%;top:22.5%;width:28.5%;height:35.5%;bottom:auto}
#game .room4-stage .r4p1{left:42.8%;top:54%;width:14.5%;height:29%;right:auto;bottom:auto}
#game .room4-stage .r4meteor{left:15.5%;top:22.5%;width:30%;height:35.5%;right:auto;bottom:auto}
#game .room4-stage .r4moon{left:53%;top:22.5%;width:32%;height:35.5%;bottom:auto}
#game .room4-stage .r4p3{left:23%;top:57.5%;width:13.5%;height:25%;right:auto;bottom:auto}
#game .room4-stage .r4p2{left:63.5%;top:57.5%;width:13.5%;height:25%;right:auto;bottom:auto}
.room4-light-overlay{display:none;position:absolute;left:25%;top:9%;width:50%;height:80%;object-fit:fill;image-rendering:pixelated;pointer-events:none;z-index:2}
.room4-stage[data-view=left] .room4-light-overlay:not([hidden]){display:block}
#game .room4-stage .r4-projection{display:none;left:35%;top:17%;width:30%;height:30%;background:none;border-radius:0;z-index:3;pointer-events:none}
#game .room4-stage[data-view=left] .r4-projection.on{display:block}


/* Room 4: orientation comes only from the stars on each glass panel. */
#game .r4-panel-ui{--panel-ink:#ecf4f9;--panel-edge:#9bb9ca;--panel-bg:#102438;display:flex;flex-direction:column;justify-content:center;width:min(1100px,96%);max-height:calc(540px - 16px);padding:46px 22px 18px;background:var(--panel-bg);color:var(--panel-ink);border:1px solid #9bb9ca88;border-radius:12px;overflow:auto}
#game .r4-panel-ui .device-close{color:var(--panel-ink)}
#game .r4-panel-ui .r4-panels{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:12px;margin:0}
#game .r4-panel-ui .r4-panels article{padding:0;border:0;background:none;text-align:center}
#game .r4-panel-ui .r4-glass{width:100%;margin:0;border:0;background:none;overflow:visible;transform:none}
#game .r4-panel-ui .r4-glass img{display:block;width:100%;height:100%;transform-origin:50% 50%;transition:transform .25s ease;user-select:none}
#game .r4-panel-ui .r4-panels button{min-width:48px;min-height:44px;padding:0 12px;margin-top:8px;font-size:28px;line-height:1;border:1px solid #9bb9ca99;background:#ffffff0a;color:var(--panel-ink)}
#game .r4-panel-ui button:focus-visible{outline:2px solid #fff;outline-offset:3px}
#game .r4-panel-ui .r4-shine{min-height:44px;margin:0 auto;padding:6px 24px;background:#edf2f4;color:#172c3b}
#game .r4-panel-ui .r4-feedback{min-height:1.3em;margin:8px 0;color:var(--panel-ink);font-size:13px}
@container game-viewport (max-height:500px){#game .r4-panel-ui{width:min(950px,96%);padding:36px 14px 10px}#game .r4-panel-ui .r4-panels{gap:8px;max-width:calc((540px - 155px)*5);width:100%;align-self:center}#game .r4-panel-ui .r4-panels button{margin-top:3px}#game .r4-panel-ui .r4-feedback{margin:4px 0}}
@media(prefers-reduced-motion:reduce){#game .r4-panel-ui .r4-glass img{transition:none}}

/* The central composite follows the same angles as the five controls. */
#game .r4-panel-ui{align-items:center}
#game .r4-panel-stack{position:relative;flex:none;width:min(205.2px,330px,576px);aspect-ratio:1;margin:0 auto 8px}
#game .r4-panel-stack img{position:absolute;inset:0;display:block;width:100%;height:100%;transform-origin:50% 50%;transition:transform .25s ease;pointer-events:none;user-select:none}
#game .r4-panel-ui .r4-panels{width:min(100%,680px);gap:12px}
#game .r4-panel-ui .r4-glass{width:min(100%,100px);margin:0 auto}
@container game-viewport (max-height:500px){#game .r4-panel-ui{padding-top:32px}#game .r4-panel-stack{width:min(199.8px,160px);margin-bottom:2px}#game .r4-panel-ui .r4-panels{width:min(100%,510px);max-width:none;gap:6px}#game .r4-panel-ui .r4-glass{width:min(100%,66px)}}
@media(prefers-reduced-motion:reduce){#game .r4-panel-stack img{transition:none}}

#game .r4-panel-ui{box-sizing:border-box;min-height:0}

@container game-viewport (max-height:500px){#game .r4-panel-stack{width:min(151.2px,120px)}#game .r4-panel-ui .r4-glass{width:min(100%,52px)}#game .r4-panel-ui{padding-top:28px}}

/* Room 2 bonus challenge: result and replay controls share one panel (review No.116). */
.room2-result-overlay{z-index:8}
.room2-result-panel{position:relative;display:grid;gap:10px;width:min(480px,100%);max-height:min(475.2px,530px);overflow-y:auto;padding:26px 28px 24px;border:4px solid #4a4039;border-radius:12px;background:#f7f2e7;color:#342d29;box-shadow:0 14px 40px rgba(0,0,0,.47);text-align:center}
.room2-result-panel .device-close{position:absolute;top:8px;right:12px;font-size:25px}
.room2-result-kicker{margin:0;color:#766650;font-size:13px;font-weight:700;letter-spacing:.14em}
.room2-result-title{margin:4px 20px 0;font-size:25px;line-height:1.25}
.room2-result-attempts{margin:3px 0 0;font-size:20px;font-weight:600}
.room2-result-best{margin:0;padding:9px 12px;border:2px solid #b6a087;border-radius:6px;background:#fffaf0;font-size:17px;font-weight:700}
.room2-result-note{margin:0;color:#695a4e;font-size:14px}
.room2-result-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:8px}
.room2-result-actions button{min-height:48px;padding:10px;border:2px solid #877564;border-radius:8px;background:#fffdf8;color:#302a26;font:inherit;font-size:16px;font-weight:700;cursor:pointer}
.room2-result-actions .room2-result-retry{border-color:#574739;background:#574739;color:#fffaf0}
.room2-result-actions button:focus-visible,.room2-result-panel .device-close:focus-visible{outline:3px solid #3476a4;outline-offset:2px}
@container game-viewport (max-height:500px){.room2-result-overlay{padding:8px}.room2-result-panel{width:min(480px,95%);max-height:507.6px;gap:5px;padding:12px 16px 10px;border-width:3px}.room2-result-title{font-size:21px}.room2-result-attempts{font-size:17px}.room2-result-best{padding:6px 8px;font-size:14px}.room2-result-note{font-size:12px}.room2-result-actions{margin-top:3px}.room2-result-actions button{min-height:38px;padding:7px;font-size:14px}}
@container game-viewport (max-width:520px){.room2-result-actions{grid-template-columns:1fr 1fr;gap:7px}.room2-result-panel{padding-right:16px;padding-left:16px}}

/* Room 2 eight-turn challenge: start and result share the same compact panel (No.117). */
.room2-start-overlay{z-index:8}
.room2-start-panel .room2-result-attempts{font-size:clamp(16px,22.08px,20px)}
.room2-start-panel .room2-start-confirm{border-color:#574739;background:#574739;color:#fffaf0}
.room2-start-panel>.design-op-button{display:none}

/* No.118: non-blocking abandon confirmation inside the existing Room 2 challenge board. */
.room2-puzzle .room2-abandon-confirm{position:absolute;inset:0;z-index:20;display:grid;place-items:center;min-height:100%;padding:12px;background:rgba(26,22,21,.71)}
.room2-abandon-panel{display:grid;gap:13px;width:min(440px,100%);padding:22px 24px;border:3px solid #594a40;border-radius:12px;background:#f7f2e7;color:#342d29;text-align:center;box-shadow:0 12px 32px #0006}
.room2-puzzle .room2-abandon-panel h2{margin:0;font-size:22px;line-height:1.4}
.room2-abandon-panel>p:not(.room2-result-kicker){margin:0;font-size:16px;line-height:1.7}
.room2-abandon-panel .room2-result-actions{margin:3px 0 0}
.room2-abandon-panel .room2-abandon-accept{border-color:#574739;background:#574739;color:#fffaf0}
.room2-abandon-panel button:focus-visible{outline:3px solid #3476a4;outline-offset:3px}
@container game-viewport (max-height:500px){.room2-puzzle .room2-abandon-confirm{padding:6px}.room2-abandon-panel{width:min(450px,100%);padding:12px 16px;gap:7px}.room2-puzzle .room2-abandon-panel h2{font-size:19px}.room2-abandon-panel>p:not(.room2-result-kicker){font-size:13px;line-height:1.5}.room2-abandon-panel .room2-result-actions button{min-height:38px;padding:6px;font-size:14px}}

/* No.119: a paused eight-turn challenge retains its board and history. */
.room2-puzzle .room2-pause{float:right;position:relative;z-index:2;margin:0 0 7px 9px;padding:9px 12px;border:1px solid #7b776c;border-radius:7px;background:#e7e1d5;color:#39342c;font-size:14px;font-weight:700;line-height:1.15;white-space:nowrap}
.room2-puzzle .room2-pause:hover{background:#ded4c2}
.room2-puzzle .room2-pause:focus-visible{outline:3px solid #3476a4;outline-offset:2px}
.room2-puzzle .room2-pause+h2{margin-right:0;min-height:36px}
@container game-viewport (max-height:500px){.room2-puzzle .room2-pause{padding:6px 8px;font-size:12px;margin-bottom:3px}.room2-puzzle .room2-pause+h2{min-height:28px}}

/* No.127: cleared Room 2 door choices resemble a compact two-option retro game menu. */
#game .room2-choice-overlay .room2-choice-panel{display:block;width:min(420px,calc(100% - 16px));max-height:min(475.2px,450px);padding:43px clamp(12px,2.5cqw,22px) 17px!important;border:3px solid #74634d!important;border-radius:0!important;background:#f4efe3!important;color:#302b27;box-shadow:5px 5px 0 #29231b80,0 12px 32px #0006;overflow-y:auto}
#game .room2-choice-panel .room2-choice-options{display:grid;grid-template-columns:minmax(0,1fr);gap:9px}
#game .room2-choice-panel .room2-choice-options>[data-choice]{display:block;width:100%;min-height:46px;margin:0;padding:9px 13px;border:2px solid #877564;border-radius:0;background:#fffaf0;color:#332c25;text-align:left;font:inherit;font-size:clamp(14px,2cqw,18px);line-height:1.45;white-space:normal;overflow-wrap:anywhere;cursor:pointer}
#game .room2-choice-panel .room2-choice-options>[data-choice]:hover{background:#e9e0d1}
#game .room2-choice-panel .room2-choice-options>[data-choice]:focus-visible{outline:3px solid #3476a4;outline-offset:2px}
#game .room2-choice-panel>.device-close{top:5px;right:7px;display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:44px;height:44px;min-width:44px;min-height:44px;margin:0;padding:0;border-radius:0;font-size:20px;line-height:1;touch-action:manipulation}
@container game-viewport (max-height:500px){#game .room2-choice-overlay .room2-choice-panel{max-height:507.6px;padding:35px 12px 10px!important}#game .room2-choice-panel .room2-choice-options{gap:6px}#game .room2-choice-panel .room2-choice-options>[data-choice]{min-height:37px;padding:6px 10px;font-size:14px}}
/* The game remains a 960x540 canvas and is uniformly scaled down on phones.
   Keep the cleared-door close target at least 44 physical pixels tall in landscape. */
@media (max-height:500px){
 #game .room2-choice-overlay .room2-choice-panel{padding-top:74px!important}
 #game .room2-choice-panel>.device-close{
  width:68px!important;height:68px;min-width:68px;min-height:68px;
  top:4px;right:6px;
 }
}
@media (max-height:360px){
 #game .room2-choice-overlay .room2-choice-panel{padding-top:84px!important}
 #game .room2-choice-panel>.device-close{
  width:78px!important;height:78px;min-width:78px;min-height:78px;
 }
}


/* Room 03: the same dialogue-synchronized glow/whiteout structure as room 02.
   Stays above scenery and memory artwork, below the dialogue overlay. */
#game .room3-memory-light{
 position:absolute;inset:0;z-index:60;pointer-events:none;
 --r3-glow:0;--r3-white:0;
}
#game .room3-memory-light::before,
#game .room3-memory-light::after{
 content:"";position:absolute;inset:0;pointer-events:none;
 transition:opacity .85s ease-in-out;
}
#game .room3-memory-light::before{
 background:radial-gradient(ellipse 38% 35% at 50% 45%,#fff9d9 2%,#fff0bc88 40%,transparent 100%);
 opacity:var(--r3-glow);
}
#game .room3-memory-light::after{background:#fff;opacity:var(--r3-white)}
#game .room3-memory-light[data-beat="device"]{--r3-glow:.66}
#game .room3-memory-light[data-beat="spread"]{--r3-glow:1;--r3-white:.3}
#game .room3-memory-light[data-beat="flash"]{--r3-glow:1;--r3-white:1}
#game .room3-memory-light[data-beat="memory"]{--r3-glow:0;--r3-white:0}
/* Keep the last hand-holding CG visible until the white covers it;
   then reveal the present room beneath the same effect layer. */
#game .room3-memory-light[data-beat="return"]::before{
 background:url("images/cg/memories/room03/right-hand-warmth-v4.png") center/cover no-repeat;
 animation:room3ReturnMemoryPicture 1.6s linear both;
}
#game .room3-memory-light[data-beat="return"]::after{
 background:#fff;
 animation:room3ReturnWhite 1.6s ease-in-out both;
}
@keyframes room3ReturnMemoryPicture{
 0%,50%{opacity:1}
 60%,100%{opacity:0}
}
@keyframes room3ReturnWhite{
 0%{opacity:0}
 36%,56%{opacity:1}
 100%{opacity:0}
}
@media(prefers-reduced-motion:reduce){
 #game .room3-memory-light[data-beat="return"]::before,
 #game .room3-memory-light[data-beat="return"]::after{animation:none!important;opacity:0}
}
@media(prefers-reduced-motion:reduce){
 #game .room3-memory-light::before,#game .room3-memory-light::after{transition:none}
}
