@font-face{font-family:'DotGothic16';src:url('fonts/DotGothic16-Regular.woff') format('woff');font-weight:400;font-style:normal;font-display:swap}
/* Confirmed UI direction, 2026-10-11. Scenario and puzzle colors are independent. */
:root{--paper:#faf7ee;--ink:#35332e;--gold:#ae9157;--paper-line:#d9ccb0;--ui-duration:150ms}
body{background:#171b19!important;font-family:"Yu Gothic",Meiryo,sans-serif}
:root{--display-width:calc(100vw - env(safe-area-inset-left,0px) - env(safe-area-inset-right,0px));--display-height:calc(100vh - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px))}
@supports(height:100dvh){:root{--display-height:calc(100dvh - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px))}}
#game-container{width:min(var(--display-width),calc(var(--display-height)*16/9))!important;height:min(calc(var(--display-width)*9/16),var(--display-height))!important;max-width:none!important;max-height:none!important;aspect-ratio:16/9;position:absolute;left:calc(env(safe-area-inset-left,0px) + var(--display-width)/2);top:calc(env(safe-area-inset-top,0px) + var(--display-height)/2);transform:translate(-50%,-50%);margin:0;overflow:hidden;container-type:inline-size}
#game{width:100%;height:100%;max-width:none;position:relative}
/* A stable logical viewport for all game content; independent of device size. */
#game{container-type:size;container-name:game-viewport}
#game.gameplay-ui-active{--ui-ink:var(--ink);--ui-muted:#7b7568;--ui-paper:var(--paper);--ui-border:var(--paper-line);--ui-accent:var(--gold);--ui-dark:var(--paper)}
#game button:not(.title-button):not(.object):not(.late-object){font-family:inherit;border-radius:5px;touch-action:manipulation}
#game :is(.gameplay-panel,.menu-panel,.phone-screen,.piano-screen,.room2-puzzle,.room3-puzzle-panel,.room3-chat-panel,.r4-mini,.r4-light-panel,.late-panel,.inspection-panel,.save-slot-panel){background:var(--paper)!important;color:var(--ink)!important;border:1px solid var(--gold)!important;border-radius:8px!important;max-height:92%;box-shadow:0 14px 45px #10161055;padding:clamp(12px,2cqw,30px);overflow:auto}
#game :is(.device-overlay,.inspection-overlay,.menu-overlay,.save-slot-overlay,.gameplay-log-overlay,.gameplay-menu-overlay,.design-overlay){background:#111b1766!important;padding:3%;z-index:70}
#game .save-slot-overlay{z-index:110}
#game h2,#game .gameplay-room-title{font-family:"Yu Mincho",serif;font-weight:500}
#game :is(.device-close,.inspection-close,.save-slot-close,.gameplay-panel-close){color:var(--ink);background:var(--paper);border:1px solid var(--paper-line);min-width:44px;min-height:36px;font-size:14px!important;z-index:2;width:auto!important;padding:5px 10px}
#game :is(input,select){font:inherit;color:var(--ink);background:#fffdf8;border:1px solid var(--paper-line);border-radius:4px;min-height:36px}
#game button:focus-visible{outline:3px solid var(--gold);outline-offset:2px}
#game .gameplay-hud{z-index:65;top:2%;left:2%;right:2%;align-items:center}
#game .gameplay-room-title{background:#faf7eee8;box-shadow:none;font-size:clamp(12px,1.5cqw,22px);border-radius:4px;padding:5px 10px;max-width:35cqw}
#game .gameplay-goal-row,#game .gameplay-highlight-toggle{display:none}
#game .gameplay-hud-actions{gap:6px}
#game .gameplay-top-button{color:var(--ink);background:#faf7eef5;border:1px solid var(--paper-line);box-shadow:none;min-height:36px;min-width:54px;padding:5px 10px;font-size:clamp(11px,1.15cqw,16px)}
#game .gameplay-top-button[aria-pressed=true]{border-color:var(--gold)}
#game .room.gameplay-shell{padding:0!important;display:block;background:#eee9de;height:100%}
#game .room-stage-wrap{height:100%;width:100%;display:block;padding:0}
#game .room-stage{height:100%!important;width:100%!important;max-width:none!important;aspect-ratio:16/9;border-radius:0!important;box-shadow:none!important}
#game .room-background{object-fit:cover}
#game .room-navigation{position:absolute;inset:50% 2% auto;transform:translateY(-50%);width:96%;max-width:none;display:flex;justify-content:space-between;pointer-events:none;z-index:20}
#game .room-navigation button{pointer-events:auto;border:1px solid var(--paper-line);border-radius:5px!important;background:#faf7eee8;width:40px;height:44px;padding:0}
#game .room-navigation p{position:absolute;left:50%;top:calc(28cqw - 48px);transform:translateX(-50%);font-size:12px;white-space:nowrap;background:#faf7eedd}
#game .room-navigation button span{display:none}
#game .explore-status:empty{display:none}
#game .explore-status{position:absolute;bottom:2%;left:50%;transform:translateX(-50%);width:70%;background:#faf7eee8;border-radius:4px;color:#686251;font-size:clamp(10px,1.1cqw,15px);padding:4px;z-index:15;pointer-events:none}
#game .late-room .late-stage{height:100%;padding-top:7%;background-color:#eee9de}
#game .gameplay-bottom-bar{display:none!important}
/* Static investigation rings, with hover labels and large hit areas. */
#game .room .object::after,#game .late-object::after,#game .r8-paper::after{content:""!important;position:absolute;left:50%;top:50%;width:22px;height:22px;transform:translate(-50%,-50%);border:2px solid #e9c36a!important;border-radius:50%;background:#fff8d51a!important;box-shadow:0 0 0 2px #35332e66!important;animation:none!important;pointer-events:none}
#game .room .object.is-investigated::after,#game .late-object.is-investigated::after{border-color:#72b68a!important;background:#79bf921a!important}
#game .object:disabled::after,#game .late-object:disabled::after{display:none}
#game .object>span{display:none}
#game .object:hover>span,#game .object:focus-visible>span{display:block!important;position:absolute;top:calc(50% + 18px);left:50%;transform:translateX(-50%);background:var(--paper);border:1px solid var(--paper-line);bottom:auto!important;width:max-content;height:auto;padding:3px 6px;color:var(--ink);font-size:12px;white-space:nowrap;z-index:12}
#game .object:hover::after{box-shadow:0 0 0 4px #f9efc966!important}
#game.has-dialogue .object::after,#game.has-dialogue .late-object::after,#game.has-dialogue .room-navigation{visibility:hidden}
/* One paper panel, different text positions INSIDE its lower-screen bounds. */
#game .room-dialog-overlay{background:transparent!important;z-index:78;pointer-events:none;padding:0!important}
#game .room-dialog{position:absolute;transform:none;bottom:0;left:2%;width:96%!important;height:30%;margin:0!important;padding:clamp(9px,1.5cqw,22px) 3% 38px!important;background:var(--paper)!important;border:1px solid var(--gold)!important;border-radius:7px 7px 0 0!important;box-shadow:0 -5px 25px #1a211d22;pointer-events:auto}
#game .dialog-message-area{height:100%;max-height:none;overflow:hidden;display:flex;align-items:flex-start;padding:0!important}
#game .message-row{position:relative;flex-direction:column;gap:3px;width:max-content;max-width:72%;margin:0;text-align:left;align-items:flex-start}
#game .message-row.heroine,#game .message-row.character{margin-left:22%;align-self:flex-start}
#game .message-row.player{margin-left:30%;margin-right:auto;max-width:65%;align-self:flex-end}
#game .message-row.narration,#game .message-row.system{margin:auto auto 0;align-self:flex-end;max-width:80%}
#game .room-dialog .message{padding:0!important;margin:0;background:transparent!important;color:var(--ink)!important;border:0!important;border-radius:0;font-style:normal!important;text-align:left;white-space:pre-wrap;width:100%;line-height:1.55;overflow-wrap:anywhere;font-size:clamp(15px,1.8cqw,26px)!important;max-width:100%;max-height:none}
html[data-game-text-size=large] #game .room-dialog .message{font-size:clamp(18px,2.2cqw,32px)!important}
#game .message-speaker{font-size:clamp(11px,1.15cqw,17px);padding:0;color:#74603c}
#game .room-dialog .dialog-controls{position:absolute;bottom:5px;left:10px;right:10px;padding:0;display:flex;gap:6px;justify-content:flex-start}
#game .room-dialog .next-button{margin-left:auto;background:transparent;color:var(--gold);border:0;min-height:30px;min-width:36px;font-size:16px}
#game .room-dialog .dialog-controls>.auto-button,#game .room-dialog .dialog-controls>.skip-button,#game .room-dialog .dialog-controls>.log-button{display:none!important}
#game .design-controls{position:absolute;bottom:4px;left:12px;right:50px;display:flex;gap:6px;pointer-events:auto;z-index:3}
#game .design-controls button{background:transparent;border:1px solid transparent;color:#746c5e;min-height:28px;padding:3px 8px;font-size:clamp(10px,1cqw,14px)}
#game .design-controls button[aria-pressed=true]{border-color:var(--gold);background:#eee4cb}
#game .hana-portrait{position:absolute;pointer-events:none;left:1%;bottom:21%;height:66%;aspect-ratio:1;max-width:38%;background-image:url(images/characters/hana-hires/portrait-neutral.webp);background-size:contain;background-position:center bottom;z-index:-1;animation:none}
#game .hana-portrait[hidden]{display:none}
#game .room-dialog-overlay[data-memory-stage] .hana-portrait{display:none!important}
#game .room-dialog.dialog-hidden{background:transparent!important;border:0!important;box-shadow:none!important;transition:none!important;pointer-events:none}
#game .room-dialog.dialog-hidden .dialog-message-area,#game .room-dialog.dialog-hidden .dialog-controls,#game .room-dialog.dialog-hidden .design-controls{visibility:hidden}
#game .dialogue-restore{position:absolute;inset:0;border:0;background:transparent;pointer-events:auto;z-index:0}
#game .dialogue-restore[hidden]{display:none}
#game .design-overlay{position:absolute;inset:0;display:grid;place-items:center;z-index:95;color:var(--ink)}
#game .design-panel{background:var(--paper);border:1px solid var(--gold);border-radius:7px;width:92%;height:90%;padding:2%;display:flex;flex-direction:column;gap:10px;box-shadow:0 12px 32px #17221955;min-height:0;overflow:hidden}
#game .design-panel>header{display:flex;justify-content:space-between;align-items:center;flex-shrink:0;border-bottom:1px solid var(--paper-line);padding-bottom:8px}
#game .design-panel>header h2{margin:0;font-size:clamp(16px,2cqw,28px)}
#game .design-panel button{min-height:34px;padding:5px 12px;background:#fffdf7;border:1px solid var(--paper-line);color:var(--ink);font-size:clamp(11px,1.2cqw,17px)}
#game .design-panel button[aria-pressed=true]{border-color:var(--gold);background:#eee4cb}
#game .design-tabs{display:flex;gap:5px;flex-wrap:wrap}
#game .design-content{flex:1;min-height:0;overflow:hidden;display:flex;flex-direction:column;gap:8px;font-size:clamp(13px,1.5cqw,21px);line-height:1.7}
#game .design-content>p{margin:0}
#game .design-page{white-space:pre-wrap;flex:1;min-height:0;overflow:hidden;margin:0;line-height:1.7;font-size:inherit}
/* G02: the record panel has its own scrollable surfaces inside the fixed 16:9 viewport.
   Keep other modal pages' original pagination and layout unchanged. */
#game .design-panel[aria-label="記録"] .design-tabs{flex-wrap:nowrap;flex-shrink:0;overflow-x:auto;overflow-y:hidden;touch-action:pan-x;overscroll-behavior-x:contain;scrollbar-width:thin;-webkit-overflow-scrolling:touch}
#game .design-panel[aria-label="記録"] .design-tabs>button{flex:0 0 auto}
#game .design-panel[aria-label="記録"] .design-content{overflow-y:auto;overflow-x:hidden;overscroll-behavior-y:contain;touch-action:pan-y;-webkit-overflow-scrolling:touch;scrollbar-width:thin}
#game .design-panel[aria-label="記録"] .design-record,#game .design-panel[aria-label="記録"] .design-actions{flex:0 0 auto}
#game .design-panel[aria-label="記録"] .design-page{overflow-y:auto;overflow-x:hidden;overscroll-behavior-y:contain;touch-action:pan-y;-webkit-overflow-scrolling:touch}
/* G03: compact navigation above the existing scrollable list. */
#game .design-panel[aria-label="記録"] .design-record-jump{display:flex;align-items:center;gap:9px;flex:0 0 auto;font-size:clamp(11px,1.3cqw,16px)}
#game .design-panel[aria-label="記録"] select{font:inherit;color:var(--ink);background:#fffdf7;border:1px solid var(--paper-line);border-radius:5px;min-height:34px;padding:3px 8px;max-width:100%}
#game .design-panel[aria-label="記録"] .design-record-jump select{flex:1;min-width:0}
#game .design-panel[aria-label="記録"] .design-record-categories{gap:5px}
#game .design-panel[aria-label="記録"] .design-record-order{margin-left:auto;white-space:nowrap}
#game .design-panel[aria-label="記録"] .design-record-summary{display:flex;flex-direction:column;align-items:flex-start;gap:1px;flex:1;min-width:0;overflow-wrap:anywhere}
#game .design-panel[aria-label="記録"] .design-record-summary small{font-size:clamp(10px,1cqw,13px);color:#746a56;line-height:1.2}
#game .design-panel[aria-label="記録"] .design-record-summary>span{display:block;text-align:left;line-height:1.35}
#game .design-panel[aria-label="記録"] .design-record-pager{margin-top:0;flex:0 0 auto;padding-top:6px;border-top:1px solid var(--paper-line)}
#game .design-panel[aria-label="記録"] .design-record-pager[hidden]{display:none!important}
#game .design-panel[aria-label="記録"] .design-record-page-select{display:flex;align-items:center;gap:6px;white-space:nowrap;font-size:clamp(10px,1.2cqw,15px)}
#game .design-panel[aria-label="記録"] .design-record-pager button{white-space:nowrap;flex:0 1 auto}
@container game-viewport (max-height:460px){
 #game .design-panel[aria-label="記録"] .design-record-jump select{min-height:30px}
 #game .design-panel[aria-label="記録"] .design-record-pager{padding-top:3px}
 #game .design-panel[aria-label="記録"] .design-record-page-select{gap:4px}
}


#game .design-pager{display:flex;justify-content:space-between;align-items:center;gap:8px;flex-shrink:0;font-size:12px}
#game .design-record{width:100%;text-align:left;display:flex;justify-content:space-between;gap:8px;min-height:38px!important}
#game .design-record small{color:#83775f;font-size:11px}
#game mark{background:#eee1bb!important;text-decoration:underline;text-decoration-color:var(--gold);color:var(--ink)}
/* G01: a restrained bookmark, not a highlighted answer or an underlined page. */
#game .design-record.final-clue,#game .design-page.final-clue{background:#f7f1e6!important;box-shadow:inset 3px 0 0 #c7b087;text-decoration:none;color:var(--ink)}
#game .design-clue-dot{color:var(--gold)}
#game .design-item-art{font-size:clamp(28px,5cqw,70px);margin:auto;text-align:center}
#game .design-settings{display:grid;grid-template-columns:1fr 1fr;gap:10px 24px;align-content:start;font-size:clamp(12px,1.25cqw,18px)}
#game .design-settings label{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
#game .design-settings input[type=range]{width:60%;height:24px;min-height:24px;accent-color:var(--gold)}
#game .design-actions{display:flex;gap:8px;flex-wrap:wrap}
#game .save-slot-card{grid-template-columns:80px minmax(0,1fr) auto;min-height:75px}
#game .save-slot-card:not(:has(.save-slot-preview)){grid-template-columns:minmax(0,1fr) auto}
#game .save-slot-preview{width:80px;height:45px;object-fit:cover;border:1px solid var(--paper-line);grid-row:1/4}
#game .save-slot-action{grid-column:-2;grid-row:1/4}
#game .device-overlay section{position:relative}
#game .room2-puzzle{width:94%;height:92%;display:grid;grid-template-columns:1.05fr 1fr;grid-template-rows:auto auto auto 1fr auto;gap:8px 3%;padding-top:3%}
#game .room2-puzzle h2{grid-column:1;grid-row:1;margin:0}
#game .room2-rule{grid-column:1;grid-row:2;font-size:clamp(10px,1.1cqw,15px);margin:0}
#game .room2-answer-slots{grid-column:1;grid-row:3;display:grid;grid-template-columns:repeat(5,1fr);gap:5px;padding:0}
#game .room2-palette{grid-column:1;grid-row:4;display:grid;grid-template-columns:repeat(5,1fr);grid-template-rows:repeat(2,1fr);gap:5px;min-height:0;margin:0}
#game .room2-answer-slot,#game .room2-palette-token{background:#fffdf7!important;color:var(--ink);border:1px solid var(--paper-line);min-height:38px;padding:3px;border-radius:4px}
#game .room2-answer-slot.is-selected,#game .room2-palette-token.is-active{border:2px solid var(--gold);background:#f0e7d4!important}
#game .room2-palette-token.is-active:after{content:"✓";color:var(--gold)}
#game .room2-palette-token i,#game .room2-answer-slot i{font-size:clamp(21px,3cqw,44px);font-style:normal}
#game .room2-palette-token small{font-size:10px}
#game .room2-history{grid-column:2;grid-row:2/5;min-height:0;max-height:none;border-left:1px solid var(--paper-line);padding:8px 0 0 14px;margin:0;overflow:auto}
#game .room2-history-row{font-size:clamp(11px,1.3cqw,18px);padding:8px 0;border-bottom:1px solid var(--paper-line);background:transparent}
#game .room2-history-row i{font-size:clamp(15px,2cqw,27px)}
#game .room2-puzzle-actions{grid-column:1/3;grid-row:5;display:flex;justify-content:flex-start;padding:0;margin:0;border-top:1px solid var(--paper-line)}
#game .room2-puzzle-actions{flex-wrap:wrap;gap:6px}
#game .room2-leftmost-request{background:#fff8df!important;border-color:var(--gold)!important}
#game .room2-leftmost-request[hidden]{display:none!important}
#game .room2-submit{order:3;margin-left:auto!important;background:#eee2c5!important;border-color:var(--gold)!important}
#game .room2-feedback,#game .room2-leftmost-hint{grid-column:2;grid-row:1;font-size:12px;padding-right:55px;margin:0}
#game .room2-reaction{position:absolute;left:2%;right:2%;bottom:1%;background:var(--paper);border:1px solid var(--gold);padding:12px;z-index:3}
#game .room2-reaction[hidden]{display:none}
#game .design-submit{display:block;margin-left:auto!important;min-width:100px;background:#eee2c5!important;border-color:var(--gold)!important}
#game .hana-choice-overlay{padding:0!important}
#game .hana-choice-menu{position:absolute;inset:auto auto 0 50%;justify-self:start;transform:translateX(-50%);width:min(840px,92%);max-height:60%;margin:0;padding:clamp(10px,1.4cqw,20px);overflow:auto;box-sizing:border-box}
@container game-viewport (max-height:550px){
 #game .hana-choice-menu{max-height:70%;padding:8px 12px}
 #game .hana-choice-menu h2{font-size:16px;margin-bottom:4px}
 #game .hana-choice-lead{margin-bottom:6px;font-size:11px}
 #game .hana-choice-list{gap:6px}
 #game .hana-choice-button{min-height:36px;padding:6px 10px;font-size:13px}
}
#game .hana-choice-button{background:var(--paper);color:var(--ink);border-color:var(--paper-line);text-align:center}
#game .design-op-button{font-size:11px;position:absolute;left:16px;bottom:8px}
#game .design-orientation{position:absolute;inset:0;z-index:200;display:none;place-items:center;background:#202820;color:var(--paper);text-align:center;padding:24px}
#game .design-orientation h2{margin:12px;font-size:24px}
#game .design-orientation p{font-size:15px}
#game .is-keyboard-open{max-height:100%;overflow:auto}
#game .is-keyboard-open input:focus{scroll-margin:20px}
@media(orientation:portrait) and (pointer:coarse){#game .design-orientation{display:grid}}
@container game-viewport (max-height:550px){#game .room-dialog{height:34%;padding-bottom:32px!important}#game .hana-portrait{bottom:25%;height:67%}#game .design-panel{gap:5px;padding:1.5%}#game .design-content{gap:4px}#game .design-panel>header{padding-bottom:4px}#game .design-panel button{min-height:30px}#game .design-settings{gap:5px 15px}#game .room2-rule{font-size:10px}#game .room2-answer-slot,#game .room2-palette-token{min-height:34px}#game .room2-puzzle{gap:5px 3%}#game .save-slot-card{min-height:54px;padding:7px}#game .save-slot-guide{margin:0;font-size:11px}}
@media(prefers-reduced-motion:no-preference){#game :is(.device-overlay,.inspection-overlay,.design-overlay){animation:designFade var(--ui-duration) ease-out}@keyframes designFade{from{opacity:0}to{opacity:1}}}
@media(prefers-reduced-motion:reduce){#game *{animation-duration:0.01ms!important;transition-duration:0.01ms!important}}
/* Use the approved spirit-world portrait in exploration as well as dialogue. */
#game :is(.hana-object,.room2-hana,.room3-hana,.r4hana){background:transparent!important;opacity:1;border-radius:0}
#game :is(.hana-object,.room2-hana,.room3-hana,.r4hana)::before{content:"";position:absolute;bottom:0;left:50%;transform:translateX(-50%);width:200%;aspect-ratio:1;background:url(images/characters/hana-hires/idle/01.webp) center bottom/contain no-repeat;pointer-events:none}
#game :is(.device-close,.inspection-close){position:absolute;right:12px;top:10px}
#game .design-orientation{pointer-events:auto}
/* Size every room against the game canvas, including letterboxed phones. */
#game .room-dialog{min-height:0!important;max-height:none!important}
#game .late-room .late-stage{width:100%;height:100%;min-height:0;margin:0;border:0;border-radius:0;padding:70px 3% 46px;overflow:hidden}
#game .late-stage.othello{grid-template-columns:minmax(0,calc(56.25cqw - 116px)) minmax(0,1fr);gap:3%}
#game .r6-map{grid-template-columns:repeat(8,minmax(0,1fr));grid-template-rows:repeat(8,minmax(0,1fr));height:100%;aspect-ratio:1;gap:3px}
#game .r6-cell{min-height:0!important;min-width:0;aspect-ratio:auto;padding:0;font-size:clamp(9px,1cqw,15px)}
#game .late-side{min-width:0;min-height:0;overflow:auto;font-size:clamp(11px,1.3cqw,18px)}
#game .late-pending{margin:4px 0;padding:8px;font-size:clamp(10px,1.1cqw,15px)}
#game .late-stage.zodiac{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:3%}
#game .r7-books,#game .r7-doors{min-height:0;overflow:auto;padding:8px}
#game .r7-book{display:flex;min-height:34px;margin:3px 0;padding:5px 8px;font-size:clamp(11px,1.2cqw,17px)}
#game .r7-doors{grid-template-columns:repeat(4,minmax(0,1fr));gap:5px}
#game .r7-doors button{min-height:34px;padding:5px}
#game .late-object{position:relative}
#game .late-object::after{left:calc(100% - 18px);top:18px;width:16px;height:16px}
#game .late-object-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}
#game .late-room-note{font-size:clamp(12px,1.4cqw,20px)}
#game :is(.late-main-action,.late-sub-action,.late-next,.late-row button){min-height:34px;padding:5px 10px;font-size:clamp(12px,1.3cqw,18px)}
#game .final-living{min-height:0;height:100%}
#game .r8-table{min-height:0;height:52%;width:72%;padding:15px;font-size:clamp(12px,1.5cqw,22px)}
#game .late-ending,#game .late-transition{min-height:0;height:100%}
#game .design-op-button{position:absolute;left:auto;right:100px;top:10px;bottom:auto;min-height:30px;font-size:11px;background:var(--paper);border:1px solid var(--paper-line);padding:5px 8px}
#game .design-panel .design-op-button{position:static}
@container game-viewport (max-height:550px){
 #game .late-room .late-stage{padding-top:55px;padding-bottom:38px}
 #game .late-stage.othello{grid-template-columns:minmax(0,calc(56.25cqw - 93px)) minmax(0,1fr)}
 #game .late-object{min-height:54px;padding:6px;font-size:14px}
 #game .late-object small{font-size:10px;margin-bottom:1px}
 #game .room2-puzzle h2{font-size:18px}
 #game .room2-answer-slot i,#game .room2-palette-token i{min-height:30px;min-width:0}
 #game .room2-puzzle-actions button{min-height:34px;padding:5px 10px;font-size:12px}
}
#game .gameplay-hud{z-index:85}
#game :is(.device-overlay,.inspection-overlay,.save-slot-overlay){padding:55px 3% 2%}
#game .room2-puzzle{height:100%;max-height:100%}
#game .late-panel{max-width:100%}

/* Hana v2: full-body exploration and individually rendered facial PNGs.
   Activate only after each image successfully loads, keeping the previous atlas as fallback. */
#game .hana-portrait.hana-v2-portrait{
  background-repeat:no-repeat;
  background-position:center bottom!important;
  background-size:contain!important;
  aspect-ratio:2/3;
  height:74%;
  max-width:36%;
  bottom:21%;
  left:1%;
}
#game.hana-v2-full-ready :is(.hana-object,.room2-hana,.room3-hana,.r4hana)::before{
  background-image:url("images/characters/hana-hires/idle/01.webp");
  background-size:contain;
  background-position:center bottom;
  background-repeat:no-repeat;
  top:auto;
  right:auto;
  width:26cqw;
  height:40.5cqw;
  aspect-ratio:auto;
  bottom:-6.1875cqw;
}
#game.hana-v2-full-ready .room2-hana::before{bottom:-5.25cqw;width:21.5cqw;height:33.6cqw}
#game.hana-v2-full-ready .room3-hana::before{bottom:-5.625cqw}
#game.hana-v2-full-ready .r4hana::before{bottom:-5.0625cqw}
@container game-viewport (max-height:550px){
 #game .hana-portrait.hana-v2-portrait{height:73%;bottom:25%}
}

#game .late-room .hana-v2-world{
 position:absolute;left:1.5%;bottom:2%;height:66%;width:23%;
 background:url("images/characters/hana-hires/idle/01.webp") center bottom/contain no-repeat;
 z-index:8;pointer-events:none;opacity:.96;
}
@container game-viewport (max-height:550px){#game .late-room .hana-v2-world{height:65%;width:20%;left:.5%}}
#game .late-room:has(.othello,.zodiac) .hana-v2-world{
 left:auto;right:7%;bottom:5%;height:45%;width:18%;
}


/* Shared pixel typography from the opening through room 8. */
body,#game{font-family:"DotGothic16","Yu Gothic",Meiryo,sans-serif;font-synthesis:none}
#game :is(button,input,select,textarea,h1,h2,h3){font-family:inherit}

/* One first-room illustration per wall; inspections crop that same artwork. */
#game .first-room .room-background,#game .first-room-keyboard,#game .inspection-crop img{image-rendering:pixelated}
#game .first-room-keyboard{position:absolute;pointer-events:none;z-index:1;object-fit:fill}
#game .first-room-keyboard[hidden]{display:none}
#game .inspection-crop{position:relative;display:block;overflow:hidden;max-height:100%;flex:none;pointer-events:none}
#game .inspection-art-layer{position:absolute;display:block;overflow:hidden;pointer-events:none}
#game .inspection-art-layer img{display:block;width:100%;height:100%;object-fit:fill}
#game .poster-paper-content img,#game #posterButton .first-room-poster-paper img{position:absolute!important;inset:-3% -4%!important;width:108%!important;height:106%!important;object-fit:fill}
#game #posterButton .first-room-poster-paper{display:block!important;position:absolute!important;left:10%!important;top:7.99%!important;width:79.31%!important;height:84.02%!important;overflow:hidden;padding:0!important;border:0!important;transform:none!important;background:transparent!important;pointer-events:none}
/* Phone sprite includes its side walls and contact shadow; never flatten it. */
#game .phone-on-desk{overflow:visible}
#game .phone-on-desk img{position:absolute;inset:0;display:block;width:100%;height:100%;object-fit:contain;transform:none;pointer-events:none;image-rendering:pixelated}
#game #phoneButton::after{left:45%;top:15%}


/* Approved pixel-opening presentation shared by opening and rooms 1–8. */
:root{--paper:#fffdf8;--ink:#332d25;--gold:#b18a3c;--paper-line:#d8bf85}
body{background:#0b1322!important;display:grid;place-items:center}
#game .title-home{background-image:url('images/pixel-ui/title-background-pixel.png');background-size:100% 100%;image-rendering:pixelated}
#game .gameplay-room-title{display:none!important}
#game .gameplay-hud{justify-content:flex-end;top:2.2%;left:2.2%;right:2.2%}
#game .gameplay-hud-left{display:none}
#game button:not(.title-button):not(.object):not(.late-object),#game :is(.design-panel,.gameplay-panel,.menu-panel,.phone-screen,.piano-screen,.room2-puzzle,.room3-puzzle-panel,.room3-chat-panel,.r4-mini,.r4-light-panel,.late-panel,.inspection-panel,.save-slot-panel){border-radius:0!important}
#game .gameplay-top-button{background:var(--paper);border:2px solid var(--gold);box-shadow:3px 3px 0 #6c542940;color:var(--ink)}
#game .room-dialog{left:2.2%;bottom:2.5%;width:95.6%!important;height:25%;padding:1.5% 1.5% 4%!important;border:3px solid var(--gold)!important;border-radius:0!important;background:var(--paper)!important;box-shadow:inset 0 0 0 3px #f5e9cb,4px 4px 0 #6c542940;display:flex;flex-direction:row;gap:2%;align-items:stretch}
#game .room-dialog .dialog-message-area{flex:1;min-width:0;height:100%;overflow:auto;scrollbar-gutter:auto;padding:0!important;display:block}
#game .room-dialog .message-row{margin:0!important;align-self:auto;max-width:100%!important;width:100%!important;display:flex;align-items:flex-start}
#game .room-dialog .message{font-size:clamp(11px,1.8cqw,26px)!important;line-height:1.55;max-width:100%}
#game .room-dialog .message-speaker{color:#80601f;font-size:.9em;padding:0;margin-bottom:.25em}
#game .room-dialog .message.player:not(.thought)::before,#game .room-dialog .message.heroine::before,#game .room-dialog .message.character::before{content:'「'}
#game .room-dialog .message.player:not(.thought)::after,#game .room-dialog .message.heroine::after,#game .room-dialog .message.character::after{content:'」'}
#game .room-dialog .message.thought::before{content:'（'}#game .room-dialog .message.thought::after{content:'）'}
#game .room-dialog .hana-portrait,#game .room-dialog .hana-portrait.hana-v2-portrait{position:relative;inset:auto;z-index:auto;height:100%;width:auto;aspect-ratio:1;max-width:30%;flex-shrink:0;border:2px solid var(--gold);background-color:#fff8e7;background-size:contain!important;background-position:center!important;image-rendering:pixelated}
#game .room-dialog .design-controls{left:auto;right:45px;bottom:3%;gap:6px}
#game .room-dialog .design-controls button{border:2px solid var(--gold);background:var(--paper);color:var(--ink);font-size:clamp(9px,1.2cqw,17px);min-height:24px;padding:.15em .6em;line-height:1.2}
#game .room-dialog .design-controls button[aria-pressed=true]{background:#f7e6bb;color:#4f3c19}
#game .room-dialog .dialog-controls{bottom:3%;right:1%;left:auto}
#game .room-dialog .next-button{font-size:clamp(15px,2cqw,27px);color:#80601f;min-height:24px}
#game .room-dialog.is-log-open{height:76%;padding-top:2%!important;padding-bottom:4.5%!important;display:block}
#game .room-dialog.is-log-open .hana-portrait{display:none!important}
#game .room-dialog .dialog-log-area{height:100%;overflow:auto;color:var(--ink);scrollbar-color:var(--gold) var(--paper);touch-action:pan-y}
#game .room-dialog.is-log-open .dialog-log-area .message-row{border-bottom:1px solid #e8d9b7;padding:.4em 0}
#game.hana-v2-full-ready :is(.hana-object,.room2-hana,.room3-hana,.r4hana)::before{background-image:url('images/characters/hana-hires/idle/01.webp');image-rendering:pixelated}
#game .late-room .hana-v2-world{background-image:url('images/characters/hana-hires/idle/01.webp');image-rendering:pixelated}
.pixel-opening-world{position:absolute;inset:0;background:#fff;isolation:isolate}
.pixel-opening-background,.pixel-opening-veil,.pixel-opening-whiteout{position:absolute;inset:0;pointer-events:none}
.pixel-opening-background{background:url('images/pixel-ui/white-room-fine.png') center/100% 100%;image-rendering:pixelated;opacity:0;transition:opacity 1s}
.pixel-opening-veil{background:white;transition:background .8s,opacity .8s;z-index:1}
.opening[data-phase=red] .pixel-opening-veil{background:#ac3039}
.opening[data-phase=black] .pixel-opening-veil{background:#000}
.opening[data-phase=room] .pixel-opening-veil{opacity:0}
.opening[data-phase=room] .pixel-opening-background{opacity:1}
.pixel-opening-hana{position:absolute;left:75%;bottom:14%;height:69%!important;width:auto!important;aspect-ratio:1/2;transform:translateX(-50%);z-index:3}
#openingHanaSprite{display:block;height:100%;width:100%;image-rendering:pixelated}
.pixel-opening-door{position:absolute;left:44%;bottom:29%;width:12%;height:39%;opacity:0;transition:opacity .9s;z-index:2}
.pixel-opening-door.visible{opacity:1}
.pixel-opening-door svg{position:absolute;inset:0;width:100%;height:100%}
.pixel-opening-door svg.door-panel{width:77.8%;height:93.3%;left:11.1%;top:6.7%;transform-origin:left center;transition:transform 1.5s}
.pixel-opening-door.open .door-panel{transform:scaleX(.055)}
.pixel-opening-whiteout{opacity:0;background:#fff;transition:opacity 1.6s;z-index:4}
.pixel-opening-whiteout.visible{opacity:1}
.pixel-opening-world.is-turning{animation:pixelOpeningTurn .66s ease-in-out}
@keyframes pixelOpeningTurn{0%{transform:translateX(0);opacity:1}45%{transform:translateX(-12%);opacity:0}46%{transform:translateX(12%);opacity:0}100%{transform:translateX(0);opacity:1}}
@container game-viewport (max-height:550px){#game .room-dialog{height:25%;padding-bottom:4%!important}#game .room-dialog .design-controls button{min-height:20px;font-size:9px;padding:.1em .35em}}
/* Layout rules must never override the dialogue engine's hidden state. */
#game [hidden]{display:none!important}

/* Inspections use the canvas instead of shrinking objects into a 720px card. */
#game .inspection-overlay{padding:1.5%!important;z-index:90}
#game:has(.inspection-overlay) .gameplay-hud{visibility:hidden}
#game .inspection-panel{width:100%!important;height:100%;max-height:100%!important;min-height:0;padding:clamp(8px,1.2cqw,18px)!important;gap:clamp(4px,.6cqw,9px);overflow:hidden!important}
#game .inspection-title{font-size:clamp(15px,1.8cqw,25px);line-height:1.3;padding-right:55px}
#game .inspection-help{font-size:clamp(10px,1cqw,14px);line-height:1.3}
#game .inspection-art-button{flex:1 1 0;min-height:0;height:auto;max-height:none;padding:0;container-type:size;overflow:hidden;border:0;background:transparent}
#game .inspection-crop{max-height:none}
#game .inspection-image{image-rendering:pixelated}

/* Darkness through 「瞼が重い」; the next line opens both eyelids. */
.pixel-opening-veil{transition:opacity .8s}
.opening[data-eye-opening=true] .pixel-opening-world::before,
.opening[data-eye-opening=true] .pixel-opening-world::after{content:"";position:absolute;left:0;right:0;height:calc(50% - 1px);background:#000;z-index:6;pointer-events:none;animation:openingEyelids 3s ease-in-out both}
.opening[data-eye-opening=true] .pixel-opening-world::before{top:0;transform-origin:center top}
.opening[data-eye-opening=true] .pixel-opening-world::after{bottom:0;transform-origin:center bottom}
@keyframes openingEyelids{0%,10%{transform:scaleY(1)}100%{transform:scaleY(0)}}

/* Approach the inspected object: full canvas artwork without a paper frame. */
#game .inspection-overlay{padding:0!important;background:rgba(5,8,10,.94)!important}
#game .inspection-panel{position:absolute;inset:0;width:100%!important;height:100%;padding:0!important;gap:0;border:0!important;border-radius:0!important;box-shadow:none!important;background:transparent!important}
#game .inspection-title{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
#game .inspection-help{display:none}
#game .inspection-art-button{width:100%;height:100%;flex:none;border:0!important;padding:0;box-shadow:none!important;background:transparent!important}
#game .inspection-art-button:hover{background:transparent}
#game .inspection-close{top:2%;right:2%;z-index:3;min-width:64px;min-height:40px;background:var(--paper);border:2px solid var(--gold)}
#game .inspection-focus-background{position:absolute;inset:0;background:#080b0d;z-index:60;pointer-events:none}
#game .inspection-focus-background .inspection-art-button{display:flex;align-items:center;justify-content:center;opacity:1;pointer-events:none}
#game:has(.inspection-focus-background) .gameplay-hud{visibility:hidden}

/* Keep the resting silhouette steady; share only a brief blink with the opening. */
@keyframes hanaExplorationIdle{
  0%,100%{background-image:url("images/characters/hana-hires/idle/01.webp")}
  89.84%{background-image:url("images/characters/hana-hires/idle/03.webp")}
  91.97%{background-image:url("images/characters/hana-hires/idle/04.webp")}
  94.33%{background-image:url("images/characters/hana-hires/idle/03.webp")}
  96.46%{background-image:url("images/characters/hana-hires/idle/01.webp")}
}
@media(prefers-reduced-motion:no-preference){
  #game.hana-idle-ready.hana-v2-full-ready :is(.hana-object,.room2-hana,.room3-hana,.r4hana)::before,
  #game.hana-idle-ready .late-room .hana-v2-world{animation:hanaExplorationIdle 4.23s steps(1,end) infinite}
}

/* Keep Hana's artwork as the click target and place her ring above her head.
   The portrait canvas is 40.5cqw tall with 56/1024 transparent pixels at the top. */
#game.hana-v2-full-ready :is(.hana-object,.room2-hana,.room3-hana,.r4hana){--hana-head-offset:32.0977cqw}
#game.hana-v2-full-ready .room2-hana{--hana-head-offset:26.4cqw}
#game.hana-v2-full-ready .room3-hana{--hana-head-offset:32.6602cqw}
#game.hana-v2-full-ready .r4hana{--hana-head-offset:33.2227cqw}
#game.hana-v2-full-ready :is(.hana-object,.room2-hana,.room3-hana,.r4hana)::before{pointer-events:auto;cursor:pointer}
#game.hana-v2-full-ready :is(.hana-object,.room2-hana,.room3-hana,.r4hana)::after{top:calc(100% - var(--hana-head-offset) - 18px);left:50%}
#game.hana-v2-full-ready :is(.hana-object,.room2-hana,.room3-hana,.r4hana):is(:hover,:focus-visible)>span{top:calc(100% - var(--hana-head-offset) - 50px)}

/* Place the existing advance control directly after the final character. */
#game .room-dialog .message-body{width:100%;font-size:clamp(11px,1.8cqw,26px);line-height:1.55}
#game .room-dialog .message-body .message{display:inline;white-space:pre-wrap}
#game .room-dialog .message-body .next-button{display:inline-block;position:static;margin:0 0 0 .2em;padding:0;min-width:1em;min-height:0;vertical-align:baseline;font-size:1em;line-height:inherit}
#game .room-dialog .message-body .next-button[data-typing]{visibility:hidden}
#game .room-dialog .design-controls{right:1.5%}
#game.has-world-expression.hana-v2-full-ready :is(.hana-object,.room2-hana,.room3-hana,.r4hana)::before,
#game.has-world-expression .late-room .hana-v2-world{background-image:var(--hana-world-expression);animation:none}
@keyframes hanaExpressionBreath{0%,100%{background-position:center bottom}50%{background-position:center calc(100% - 1px)}}
@media(prefers-reduced-motion:no-preference){
 #game.has-world-expression.hana-v2-full-ready :is(.hana-object,.room2-hana,.room3-hana,.r4hana)::before,
 #game.has-world-expression .late-room .hana-v2-world{animation:hanaExpressionBreath 4.23s ease-in-out infinite}
}

#game .room-navigation button:disabled{opacity:.35;cursor:default}

/* Continue the opening's white light, revealing the first room underneath. */
#game .first-room-entry-fade{position:absolute;inset:0;background:#fff;z-index:200;animation:firstRoomReveal 1.6s ease-in-out both;pointer-events:auto}
#game.is-entering-first-room .gameplay-hud{pointer-events:none}
@keyframes firstRoomReveal{from{opacity:1}to{opacity:0}}
@media(prefers-reduced-motion:reduce){#game .first-room-entry-fade{animation:none;display:none}}

/* Fixed phone body; only the LCD content changes between mail views. */
#game .flip-phone-overlay{padding:0;background:#101014b8}
#game .phone-screen.flip-phone{position:relative;height:94%;width:auto;aspect-ratio:941/1671;max-width:94%;max-height:none!important;padding:0!important;border:0!important;background:transparent!important;box-shadow:none;overflow:visible;container-type:inline-size}
#game .flip-phone-body{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;pointer-events:none;image-rendering:pixelated}
#game .phone-lcd{position:absolute;left:27%;top:13.82%;width:46%;height:39.5%;display:flex;flex-direction:column;overflow:hidden;background:#fffdf0;color:#18232f;font-size:clamp(10px,3.4cqw,16px);line-height:1.25}
#game .phone-lcd [hidden]{display:none!important}
#game .phone-status{display:flex;align-items:center;justify-content:space-between;flex:none;gap:4px;padding:2px 4px;font-size:.8em;border-bottom:1px solid #b4b7aa}
#game .phone-lcd-title{display:block;padding:3px!important;background:#142d54;color:#fff;text-align:center;flex:none}
#game .phone-lcd-title p{font-size:1em;margin:0;line-height:1.15}
#game .phone-lcd .mail-tabs{display:flex;flex:none;background:#e5e4d8;padding:2px}
#game .phone-lcd .mail-tabs button{min-width:0;min-height:0;padding:3px 0;border:0;font-size:.85em;line-height:1.2;color:#58616c;background:transparent}
#game .phone-lcd .mail-tabs button.is-active{background:#a9dfff;color:#172d48}
#game .phone-lcd .mail-list{flex:1;min-height:0;max-height:none;margin:0;padding:2px 3px;overflow:auto;touch-action:pan-y;scrollbar-width:thin}
#game .phone-lcd .mail-item{padding:4px 3px;gap:1px;min-height:0;border:0;border-bottom:1px solid #c4c5b7;background:transparent;color:#18232f;font-size:.9em;line-height:1.15;box-shadow:none;border-radius:0}
#game .phone-lcd .mail-item strong{font-weight:normal;white-space:nowrap}
#game .phone-lcd .mail-item span{font-size:1em;color:inherit}
#game .phone-lcd .mail-item small{font-size:.95em;color:inherit;line-height:1.3}
#game .phone-lcd .mail-item:is(:hover,:focus-visible,.is-selected){background:#b2e0f5;outline-offset:-2px}
#game .phone-lcd .mail-detail{flex:1;min-height:0;margin:0;padding:5px 4px;border:0;box-shadow:none;border-radius:0;background:transparent;overflow:auto;line-height:1.5;touch-action:pan-y;scrollbar-width:thin}
#game .phone-lcd .mail-detail>p:first-child{font-size:.9em;color:inherit;border-bottom:1px solid #b8bdac;padding-bottom:3px}
#game .phone-lcd .mail-detail h3{font-size:1em;font-weight:normal;margin:4px 0;padding-bottom:4px;border-bottom:1px solid #b8bdac;overflow-wrap:anywhere}
#game .phone-lcd .mail-detail p{white-space:normal;overflow-wrap:anywhere}
#game .phone-softkeys{display:flex;align-items:stretch;flex:none;border-top:1px solid #c5cbcf;background:#142d54;color:#fff;font-size:.8em}
#game .phone-softkeys button,#game .phone-list-guide{position:static;flex:1;min-width:0;padding:4px 1px;border:0;background:transparent;color:#fff;font-size:1em;line-height:1.2;text-align:center;white-space:nowrap}
#game .phone-softkeys>:first-child{border-right:1px solid #d2dbe7}
#game .phone-softkeys button:disabled{color:#93a0b4}
#game .phone-lcd button:focus-visible{outline:2px solid #367da0;outline-offset:-2px}
/* Transparent hit targets aligned to the existing 941x1671 pixel-art flip phone. */
#game .phone-hardware-keys{position:absolute;inset:0;z-index:2;pointer-events:none}
#game .phone-hardware-key{position:absolute;display:block;min-width:0;min-height:0;padding:0;border:0;border-radius:6px;background:transparent;color:transparent;pointer-events:auto;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent}
#game .phone-hardware-key:active{background:rgba(212,240,255,.22)}
#game .phone-hardware-key:focus-visible{outline:2px solid #c8f5ff;outline-offset:-2px;background:rgba(212,240,255,.14)}
#game .phone-key-soft-left{left:25.2%;top:64.8%;width:12%;height:3.3%}
#game .phone-key-soft-right{left:63.8%;top:64.8%;width:12%;height:3.3%}
#game .phone-key-mail{left:24.8%;top:68.6%;width:11.8%;height:3.5%}
#game .phone-key-clear{left:63.9%;top:68.6%;width:12%;height:3.5%}
#game .phone-key-up{left:44.3%;top:64.1%;width:11.4%;height:2.3%}
#game .phone-key-left{left:38.5%;top:66.4%;width:5.8%;height:4.1%}
#game .phone-key-ok{left:44.3%;top:66.4%;width:11.4%;height:4.1%;border-radius:40%}
#game .phone-key-right{left:55.7%;top:66.4%;width:5.8%;height:4.1%}
#game .phone-key-down{left:44.3%;top:70.5%;width:11.4%;height:2.2%}
#game .phone-key-num-1{left:23.2%;top:73.1%;width:17.5%;height:3.5%}
#game .phone-key-num-2{left:41.8%;top:73.1%;width:17.4%;height:3.5%}
#game .phone-key-num-3{left:60.1%;top:73.1%;width:17.5%;height:3.5%}
#game .phone-key-num-4{left:23.2%;top:77.1%;width:17.5%;height:3.6%}
#game .phone-lcd .mail-item.is-cursor{outline:2px solid #3e7da2;outline-offset:-2px;background:#deeff9}
/* Room 1 piano: tappable diatonic keys retain the original text-entry option. */
#game .room1-piano-panel{width:min(580px,100%);padding-top:46px!important}
#game .room1-piano-panel .device-close{position:absolute;top:8px;right:10px}
#game .piano-keyboard{position:relative;display:grid;grid-template-columns:repeat(7,minmax(0,1fr));height:clamp(96px,118.8px,168px);margin:12px 0 4px;border:3px solid #293039;background:#293039;border-radius:3px;overflow:hidden;touch-action:manipulation}
#game .piano-note-key{position:relative;min-width:0;min-height:0;padding:0 1px 10px;border:1px solid #657078;border-bottom:6px solid #abb6b7;border-radius:0 0 4px 4px;background:#fffdf3;color:#2f373c;font:inherit;font-size:clamp(12px,15.36px,18px);cursor:pointer;box-shadow:inset 0 -6px 6px #c9cbbe;touch-action:manipulation}
#game .piano-note-key span{position:absolute;bottom:4px;left:0;right:0;text-align:center}
#game .piano-note-key:is(:active,:focus-visible){background:#d8ecf3;border-bottom-width:2px;outline:2px solid #367da0;outline-offset:-3px}
#game .piano-note-key:disabled{opacity:.65;cursor:default}
#game .piano-sharp{position:absolute;top:0;width:8%;height:58%;background:#242833;border:2px solid #11151c;border-top:0;border-radius:0 0 3px 3px;box-shadow:2px 3px 1px #18212a80;pointer-events:none}
#game .piano-sharp-1{left:10.3%}#game .piano-sharp-2{left:24.6%}#game .piano-sharp-3{left:53.2%}#game .piano-sharp-4{left:67.5%}#game .piano-sharp-5{left:81.8%}
#game .piano-keyboard-tools{display:flex;justify-content:flex-end;gap:8px;margin-top:8px}
#game .piano-keyboard-tools button{min-height:34px;padding:5px 12px;border:1px solid #a79b8b;border-radius:5px;background:#fffaf1;color:#392f2c;font:inherit;font-size:14px;cursor:pointer}
#game .piano-keyboard-tools button:disabled{opacity:.55;cursor:default}
#game .room1-piano-panel label{margin:10px 0 8px}
/* Keep the input and confirmation in flow so scrolling never covers the melody. */
#game .room1-piano-panel #playMelodyButton{
  position:static;
  display:block;
  min-height:44px;
  margin-top:6px;
  box-shadow:none;
}

@container game-viewport (max-height:520px){#game .piano-keyboard{height:84px;margin-top:6px}#game .room1-piano-panel{padding-top:40px!important}#game .room1-piano-panel label{margin:6px 0}}
/* Issue #25: Room 1 piano must keep its answer button visible without scrolling.
   Only the controls/results above the button may scroll on cramped viewports. */
#game .room1-piano-panel{
  display:flex;
  flex-direction:column;
  height:min(452px,90%);
  min-height:0;
  overflow:hidden!important;
  padding-bottom:clamp(10px,1.5cqw,16px)!important;
}
#game .room1-piano-panel .piano-main{
  display:flex;
  flex:1 1 auto;
  flex-direction:column;
  gap:5px;
  min-height:0;
  overflow-y:auto;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
}
#game .room1-piano-panel .piano-main>h2{flex:none;margin:0;font-size:clamp(18px,2cqw,24px)}
#game .room1-piano-panel .piano-main>p:first-of-type{flex:none;line-height:1.35}
#game .room1-piano-panel .piano-keyboard{flex:none;height:112px;margin:3px 0 0}
#game .room1-piano-panel .piano-keyboard-tools{flex:none;margin-top:0}
#game .room1-piano-panel label{flex:none;margin:2px 0 0;gap:3px}
#game .room1-piano-panel #melodyInput{min-height:40px;padding:7px 10px;font-size:18px}
#game .room1-piano-panel .piano-result{
  flex:none;
  min-height:1.3em;
  margin:0;
  font-size:clamp(12px,1.35cqw,17px);
  line-height:1.45;
  white-space:pre-line;
}
#game .room1-piano-panel .piano-submit-bar{
  flex:0 0 auto;
  padding-top:8px;
  border-top:1px solid var(--paper-line);
  background:var(--paper);
}
#game .room1-piano-panel .piano-submit-bar #playMelodyButton{
  width:100%;
  min-height:46px;
  margin:0;
  padding:8px;
}

/* Room 3 companion uses the existing independent idle/expression sprite. */
#game.hana-v2-full-ready .room3-hana::before{width:21.5cqw;height:33.6cqw;bottom:-5.25cqw}
#game.hana-v2-full-ready .room3-hana{--hana-head-offset:26.4cqw}

/* Room 3: a fixed black smartphone shell, one scrollable conversation inside the LCD. */
#game:has(.room3-chat-overlay) .gameplay-hud{visibility:hidden}
#game .room3-chat-overlay{padding:2.2%}
#game .room3-chat-panel.r3-handset{width:auto;height:100%;max-height:100%!important;aspect-ratio:9/17;min-height:0;display:flex;flex-direction:column;gap:0;padding:clamp(7px,1cqw,14px)!important;border:3px solid #414854!important;border-radius:16px!important;background:#151a21!important;color:#f7f7f5!important;overflow:hidden;box-shadow:inset 0 0 0 2px #080c12,5px 6px 0 #05080c80}
.r3-phone-speaker{flex:0 0 4%;display:flex;justify-content:center;align-items:center}
.r3-phone-speaker::before{content:"";width:22%;height:4px;background:#070b10;border:1px solid #414954;box-shadow:0 1px 0 #66707a}
.r3-phone-lcd{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden;border:2px solid #06090d;background:#b9cbd3;color:#253139}
.r3-phone-status{flex:0 0 auto;display:flex;justify-content:space-between;padding:2px 7px;background:#252e37;color:#eee;font:10px/1.1 monospace}
#game .r3-handset .r3-app-header{flex:0 0 auto;display:flex;align-items:center;justify-content:space-between;gap:4px;background:#3d535e;color:#fff;padding:3px 4px;border-bottom:2px solid #233943}
#game .r3-app-header h2{font:inherit;font-size:clamp(12px,1.45cqw,20px);font-weight:600;margin:0;color:#fff}
#game .r3-app-header .device-close{position:static;min-width:36px;width:36px!important;min-height:32px;height:32px;padding:0;background:#304550;color:#fff;border:1px solid #69808a;box-shadow:none;font-size:14px!important}
.r3-header-spacer{width:36px}
.r3-chat-scroll{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;padding:clamp(7px,.9cqw,12px);display:flex;flex-direction:column;gap:clamp(7px,.7cqw,10px);scrollbar-width:thin;scrollbar-color:#6c8793 #c6d6dc;font:clamp(12px,1.35cqw,18px)/1.65 "DotGothic16",sans-serif}
.r3-chat-scroll:focus-visible{outline:2px solid #587a8a;outline-offset:-2px}
/* Chat messages keep their natural height; only the phone LCD scrolls. */
#game .r3-chat-scroll > *{flex-shrink:0}
#game .r3-chat-scroll :is(.room3-chat-message,.r3-text-message){display:flex;flex-direction:column;align-items:flex-start;gap:2px;width:auto;max-width:88%;align-self:flex-start;text-align:left}
#game .r3-chat-scroll :is(.room3-chat-message,.r3-text-message).player{align-self:flex-end;align-items:flex-end}
.r3-chat-scroll small{font-size:.73em;line-height:1.2;color:#40535e;padding:0 2px}
#game .r3-chat-scroll article p{margin:0;padding:6px 9px;background:#fffef8;color:#26323a;border:1px solid #80959f;border-radius:4px;box-shadow:1px 2px 0 #5f778533;overflow-wrap:anywhere}
#game .r3-chat-scroll article.player p{background:#ddedc3;border-color:#839e6b}
#game .r3-chat-scroll .room3-chat-message p{font-size:1.25em;line-height:1.4;white-space:pre;overflow-wrap:normal}
#game .r3-chat-scroll .room3-chat-context{align-self:center;margin:5px 0;padding:4px 7px;font-size:.68em;line-height:1.5;color:#405862;background:#d4e1e7;border-radius:3px;text-align:center}
.r3-phone-home{flex:0 0 5%;display:flex;align-items:center;justify-content:center}
.r3-phone-home::before{content:"";width:12%;height:48%;border:1px solid #505965;background:#0b1017;box-shadow:inset 0 0 0 1px #242c36}

/* A–Z reference sheet: seven rows per column, no puzzle-specific highlighting. */
#game:has(.r3-morse-overlay) .gameplay-hud{visibility:hidden}
#game .r3-morse-overlay{padding:2.5%}
.r3-morse-chart{--morse-unit:clamp(4px,.55cqw,8px);width:min(1040px,96%);height:94%;min-height:0;display:flex;flex-direction:column;padding:clamp(10px,1.9cqw,26px);border:2px solid #998e73;background:#f6f0df;color:#343229;box-shadow:inset 0 0 0 4px #e9dfc6,5px 6px 0 #30281e55;gap:clamp(8px,1cqw,14px);font-family:"DotGothic16",sans-serif}
.r3-morse-chart header{display:flex;align-items:center;justify-content:space-between;flex:0 0 auto;gap:10px;border-bottom:2px solid #9d947b;padding-bottom:clamp(5px,.6cqw,9px)}
#game .r3-morse-chart h2{font-family:inherit;font-size:clamp(15px,2.1cqw,29px);font-weight:normal;margin:0}
#game .r3-morse-chart .device-close{position:static;flex:0 0 auto}
.r3-morse-grid{display:grid;grid-template-rows:repeat(7,minmax(0,1fr));grid-template-columns:repeat(4,minmax(0,1fr));grid-auto-flow:column;gap:clamp(4px,.6cqw,8px) clamp(6px,1.6cqw,22px);flex:1;min-height:0}
.r3-morse-cell{display:flex;align-items:center;gap:clamp(5px,1.1cqw,16px);padding:0 clamp(4px,.75cqw,10px);border-bottom:1px solid #c7bea6;background:#fffdf644;min-width:0}
.r3-morse-cell strong{width:1em;flex:0 0 auto;font-size:clamp(16px,2.1cqw,30px);font-weight:normal;line-height:1}
.r3-morse-code{display:flex;align-items:center;gap:calc(var(--morse-unit)*.65);height:1em;white-space:nowrap}
.r3-morse-code i{display:block;flex:0 0 auto;height:var(--morse-unit);background:#343229}
.r3-morse-code .morse-dot{width:var(--morse-unit)}
.r3-morse-code .morse-dash{width:calc(var(--morse-unit)*3)}
.r3-morse-legend{flex:0 0 auto;text-align:center;margin:0;font-size:clamp(11px,1.2cqw,17px);line-height:1.2;color:#6a614e}
/* The adopted 10×10 sheet fits beside the answer field on desktop and landscape. */
#game .room3-puzzle-panel.r3-board-ready{width:min(1040px,96%);height:92%;display:grid;grid-template-columns:minmax(0,1fr) minmax(170px,.8fr);grid-template-rows:auto minmax(0,1fr) auto;gap:12px;overflow:hidden}
#game .r3-board-ready h2{grid-column:1/-1;grid-row:1;margin:0 44px 0 0}
#game .r3-board-ready .room3-letterboard{grid-column:1;grid-row:2/4;justify-self:center;align-self:center;height:100%;width:auto;max-width:100%;max-height:100%;aspect-ratio:1;min-height:0;margin:0;grid-template-rows:repeat(10,minmax(0,1fr));padding:5px;gap:2px}
#game .r3-board-ready .room3-board-row{min-height:0;gap:2px}
#game .r3-board-ready .room3-board-row span{aspect-ratio:auto;font-size:clamp(11px,1.6cqw,23px);font-family:"DotGothic16",sans-serif}
#game .r3-board-ready .room3-puzzle-instruction{grid-column:2;grid-row:2;align-self:start;margin:0;min-height:0;font-size:clamp(12px,1.45cqw,20px)}
#game .r3-board-ready .room3-final-entry{grid-column:2;grid-row:2;align-self:end;grid-template-columns:1fr;margin:0;gap:8px}
#game .r3-board-ready .room3-puzzle-feedback{grid-column:2;grid-row:3;min-height:1em;font-size:clamp(11px,1.3cqw,18px);margin:0}
#game .r3-board-ready .room3-final-entry[hidden]{display:none}


/* Room 4: stage-depth companion scale and a calm ceiling-gaze pose.
   Override only Room 4; reuse the approved pixel full-body sprite. */
#game.hana-v2-full-ready .room4-stage .r4hana::before{
 width:var(--r4-hana-width,18.2cqw);
 height:var(--r4-hana-height,28.35cqw);
 bottom:var(--r4-hana-bottom,-4.777734375cqw);
}
#game.hana-v2-full-ready .room4-stage .r4hana{
 --hana-head-offset:var(--r4-hana-head-offset,22.021875cqw);
}
/* Dedicated approved full-body gaze artwork; align its shoes with the idle sprite. */
#game .room4-stage .r4hana .r4-hana-look-pose{
 position:absolute;
 left:50%;
 bottom:var(--r4-hana-bottom,-4.777734375cqw);
 width:var(--r4-hana-width,18.2cqw);
 height:var(--r4-hana-height,28.35cqw);
 background:url("images/characters/hana-hires/poses/look-up-left.webp") center bottom/contain no-repeat;
 image-rendering:pixelated;
 transform:translateX(-50%);
 opacity:0;
 pointer-events:none;
 z-index:1;
}
#game.hana-v2-full-ready .room4-stage .r4hana.is-looking-up::before{
 opacity:0;
 animation:none!important;
}
#game .room4-stage .r4hana.is-looking-up .r4-hana-look-pose{
 opacity:1;
 animation:r4HanaLookUp .18s ease-out both;
}
/* Only the approved pose is shown; retired frames must never flash during entry. */
@keyframes r4HanaLookUp{
 from{opacity:0}
 to{opacity:1}
}
#game .room4-stage .r4-hana-look-pose{transform-origin:50% 96%}
@media(prefers-reduced-motion:reduce){
 #game .room4-stage .r4hana.is-looking-up .r4-hana-look-pose{
  animation:none!important;
  transform:translateX(-50%);
 }
}

/* Room 4: equally weighted, readable zodiac exhibition. */
#game .r4-zodiac-overlay{z-index:90;background:#09131ee8;padding:2%;color:#f5f1e5}
#game .r4-zodiac-exhibit{position:relative;width:100%;height:100%;min-height:0;display:flex;flex-direction:column;border:2px solid #ae9560;background:#0d2032;box-shadow:0 8px 24px #0006;padding:clamp(10px,1.5cqw,22px);gap:clamp(6px,.8cqw,12px);overflow:hidden}
#game .r4-zodiac-exhibit header{display:flex;align-items:center;justify-content:space-between;flex:none;border-bottom:1px solid #a9956755;padding-bottom:6px}
#game .r4-zodiac-exhibit h2{margin:0;font-size:clamp(20px,2.8cqw,36px);font-weight:500;color:#faf3df}
#game .r4-zodiac-kicker{margin:0 0 2px;color:#bba984;font-size:clamp(10px,1cqw,14px);letter-spacing:.12em}
#game .r4-zodiac-exhibit .device-close{position:static;width:auto;min-height:32px;padding:4px 12px;background:#faf5e8;color:#243348;border:1px solid #bda470;border-radius:0;font-size:clamp(12px,1.2cqw,18px)}
#game .r4-zodiac-list{flex:1;display:flex;flex-direction:column;min-height:0;gap:8px}
#game .r4-zodiac-guide{margin:0;flex:none;font-size:clamp(11px,1.15cqw,16px);color:#ccd2d6}
#game .r4-zodiac-grid{flex:1;min-height:0;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:repeat(3,minmax(0,1fr));gap:clamp(5px,.7cqw,10px)}
#game .r4-zodiac-card{min-height:0;padding:4px 8px;display:flex;flex-direction:column;align-items:center;gap:2px;color:#f3f0e4;background:#142c43;border:1px solid #55738c;border-radius:0;overflow:hidden;box-shadow:none;cursor:pointer}
#game .r4-zodiac-card:hover,#game .r4-zodiac-card:focus-visible{background:#203c55;border-color:#e3c885;outline:2px solid #e3c885;outline-offset:-3px}
#game .r4-zodiac-card svg{flex:1;min-height:0;width:100%;max-height:100%}
#game .r4-zodiac-card strong{flex:none;font-weight:500;font-size:clamp(12px,1.5cqw,21px);line-height:1.15}
#game .r4-zodiac-card small{flex:none;font-size:clamp(9px,.85cqw,12px);color:#b6c5d3;line-height:1}
#game .r4-zodiac-lines{stroke:#8daac1;stroke-width:1.2;fill:none;vector-effect:non-scaling-stroke}
#game .r4-zodiac-stars{fill:#fff5d9;stroke:#ffffff55;stroke-width:.6}
#game .r4-zodiac-detail{flex:1;min-height:0;display:grid;grid-template-columns:1.3fr 1fr;gap:4%;align-items:center;overflow-y:auto;touch-action:pan-y}
#game .r4-zodiac-large{min-height:0;display:grid;place-items:center;background:#11273b;border:1px solid #547089;aspect-ratio:3/2;width:100%}
#game .r4-zodiac-large svg{width:100%;height:100%}
#game .r4-zodiac-copy{min-width:0}
#game .r4-zodiac-latin{color:#b9a77b;font-size:clamp(12px,1.4cqw,20px);margin:0 0 4px}
#game .r4-zodiac-copy h3{font-size:clamp(20px,3cqw,40px);font-weight:500;margin:0 0 16px}
#game .r4-zodiac-description{font-size:clamp(14px,1.7cqw,24px);line-height:1.8;margin:0 0 16px}
#game .r4-zodiac-note{font-size:clamp(10px,1cqw,14px);line-height:1.5;color:#aebcc9;margin:0 0 16px}
#game .r4-zodiac-back{background:#faf5e8;color:#243348;border:1px solid #bda470;padding:8px 14px;font-size:clamp(12px,1.3cqw,18px);min-height:34px}
#game .r4-zodiac-exhibit footer{flex:none;display:flex;justify-content:space-between;gap:10px;font-size:clamp(9px,.85cqw,12px);color:#aab5bc}
#game .r4-zodiac-exhibit details{position:relative;text-align:right}
#game .r4-zodiac-exhibit details p{position:absolute;bottom:16px;right:0;background:#102a40;border:1px solid #55738c;width:min(420px,75cqw);padding:12px;line-height:1.6;z-index:2;text-align:left}
#game .r4-zodiac-exhibit a{color:#c7dcef}
#game .r4-zodiac-list[hidden],#game .r4-zodiac-detail[hidden]{display:none}
@container game-viewport (max-height:460px) and (min-width:480px){
 #game .r4-zodiac-overlay{padding:1%}
 #game .r4-zodiac-exhibit{padding:8px;gap:4px}
 #game .r4-zodiac-kicker{display:none}
 #game .r4-zodiac-exhibit h2{font-size:18px}
 #game .r4-zodiac-exhibit header{padding-bottom:3px}
 #game .r4-zodiac-guide{font-size:10px}
 #game .r4-zodiac-list{gap:3px}
 #game .r4-zodiac-grid{gap:4px}
 #game .r4-zodiac-card{padding:2px 4px;gap:1px}
 #game .r4-zodiac-card strong{font-size:11px}
 #game .r4-zodiac-card small{font-size:8px}
 #game .r4-zodiac-copy h3{font-size:21px;margin-bottom:8px}
 #game .r4-zodiac-description{font-size:13px;line-height:1.6;margin-bottom:8px}
 #game .r4-zodiac-note{margin-bottom:8px}
 #game .r4-zodiac-exhibit footer>span{display:none}
 #game .r4-zodiac-exhibit footer{justify-content:flex-end}
}

/* Keep exploration free of persistent guidance and progress labels. */
#game .explore-status,#game .room-navigation p{display:none!important}
#game .r4-zodiac-guide,#game .r4-zodiac-kicker,#game .r4-zodiac-exhibit footer>span{display:none}

/* Sourced zodiac flowers share the established minimal exhibition layout. */
#game .r4-flower-illustration{flex:1;min-height:0;width:100%;display:flex;align-items:center;justify-content:center}
#game .r4-flower-sprite{display:block;height:100%;aspect-ratio:1;max-width:100%;background-image:url('images/exhibits/room04/zodiac-flowers-atlas-coarse.png');background-size:400% 300%;background-repeat:no-repeat;image-rendering:pixelated}
#game .r4-flower-card small{font-size:clamp(10px,1.1cqw,15px);color:#d2c6a9;line-height:1.2}
#game .r4-flower-large{aspect-ratio:3/2;align-items:center;justify-content:center;display:flex;padding:3%}
#game .r4-flower-large .r4-flower-sprite{height:100%;width:auto;max-width:100%;flex:0 1 auto}
#game .r4-flower-english{font-size:clamp(11px,1.25cqw,18px);color:#b9a77b;margin:-8px 0 16px}
#game .r4-flower-exhibit footer{justify-content:flex-end}
#game .r4-flower-board{position:absolute;left:57.2%;top:26.1%;width:25.8%;height:29.75%;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:repeat(3,minmax(0,1fr));gap:.45cqw;padding:.18cqw;background:#121e2f;z-index:2;pointer-events:none}
#game .r4-flower-board>i{display:flex;min-height:0;align-items:center;justify-content:center;border:1px solid #8e6d38;background:#121e2f;padding:4%}
#game .room4-stage:not([data-view="right"]) .r4-flower-board{display:none}
@container game-viewport (max-height:460px) and (min-width:480px){
 #game .r4-flower-card small{font-size:9px}
 #game .r4-flower-exhibit .r4-zodiac-copy h3{font-size:20px}
 #game .r4-flower-english{margin:0 0 8px;font-size:11px}
}

/* Mask atlas cell-edge remnants without changing the accepted 64px artwork. */
#game .r4-flower-sprite{clip-path:inset(3%)}

/* Keep cold-load title controls legible until all existing artwork is decoded. */
#game .title-home:is(.title-art-loading,.title-art-fallback){background-image:none}
#game .title-text-fallback,#game .title-art-status{display:none}
#game .title-home:is(.title-art-loading,.title-art-fallback) .title-logo img,
#game .title-home:is(.title-art-loading,.title-art-fallback) .title-menu button img{visibility:hidden}
#game .title-home:is(.title-art-loading,.title-art-fallback) .title-text-fallback{display:block;font:clamp(18px,3.8cqw,54px)/1.7 'DotGothic16',sans-serif;color:#fff;text-align:center}
#game .title-home:is(.title-art-loading,.title-art-fallback) .title-menu button:not(#testRoomButton):not(#puzzleGuideButton)::after{content:attr(aria-label);color:#fff;font:clamp(14px,1.5cqw,22px)/1.5 'DotGothic16',sans-serif}
#game .title-art-loading .title-art-status{display:block;position:absolute;top:40%;left:50%;transform:translateX(-50%);color:#ddd;font-size:clamp(12px,1.2cqw,18px)}
#game .title-art-status[hidden]{display:none}

/* The new high-resolution neutral artwork needs normal downsampling. */
#game.hana-v2-full-ready :is(.hana-object,.room2-hana,.room3-hana,.r4hana)::before,
#game .late-room .hana-v2-world,
#game .pixel-opening-hana img,
#game .hana-portrait:is([data-expression=gentle],[data-expression=neutral]){image-rendering:auto}

/* Room 7: approved four-view library and independent puzzle layers. */
#game .r7-full{position:absolute;inset:0;height:100%;min-height:0;padding:0;overflow:hidden;background:#30251c}
#game .r7-room-wrap{position:absolute;inset:0;display:flex;align-items:flex-start;overflow:auto;overscroll-behavior:contain;touch-action:pan-x pan-y;scrollbar-width:none}
#game .r7-room-wrap::-webkit-scrollbar{display:none}
#game .r7-scene{position:relative;flex:none;margin:auto;height:100%;max-width:100%;aspect-ratio:3/2;background-position:center;background-size:100% 100%;background-repeat:no-repeat}
#game .r7-scene[data-view=front]{background-image:url('images/background/room07/front.webp')}
#game .r7-scene[data-view=left]{background-image:url('images/background/room07/left.webp')}
#game .r7-scene[data-view=right]{background-image:url('images/background/room07/right.webp')}
#game .r7-scene[data-view=back]{background-image:url('images/background/room07/back.webp')}
#game .r7-target{position:absolute;border:0;border-radius:0!important;padding:0;min-height:0;background:transparent;cursor:pointer;z-index:3}
#game .r7-target::after{content:'';position:absolute;left:50%;top:50%;width:16px;height:16px;border:2px solid #e9c36a;border-radius:50%;transform:translate(-50%,-50%);box-shadow:0 0 0 2px #35332e88;pointer-events:none}
#game .r7-target:hover{background:#fff6}
#game .r7-target:focus-visible{outline:3px solid var(--gold);outline-offset:-3px}
#game .r7-nav{position:absolute;inset:0;display:flex;justify-content:space-between;align-items:center;pointer-events:none;z-index:8;padding:0 1%}
#game .r7-nav button{pointer-events:auto;width:44px;height:48px;border:1px solid var(--paper-line);background:var(--paper);color:var(--ink);font-size:20px}
#game .r7-scene .r7-hana.hana-v2-world{position:absolute!important;left:3%!important;bottom:14%!important;top:auto!important;height:68%!important;width:25.7%!important;z-index:4!important;pointer-events:auto;border:0;background-color:transparent;cursor:pointer;padding:0;max-width:none!important}
#game .r7-hana::after{content:'';position:absolute;left:50%;top:2%;width:16px;height:16px;border:2px solid #e9c36a;border-radius:50%;box-shadow:0 0 0 2px #35332e88}
#game.has-dialogue .r7-target::after,#game.has-dialogue .r7-hana::after,#game.has-dialogue .r7-nav{visibility:hidden}
#game .r7-dial-target{position:absolute;z-index:5;left:41.2%;top:11.2%;width:18.2%;aspect-ratio:1;border:0;padding:0;background:none;cursor:pointer}
#game .r7-dial-art{position:relative;width:100%;aspect-ratio:1;touch-action:none;user-select:none}
#game .r7-dial-wheel{position:absolute;inset:0;transform-origin:50% 50%;transition:transform .25s ease}
#game .r7-dial-wheel>img,#game .r7-dial-wheel>svg{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
#game .r7-dial-wheel svg text{font-family:'Yu Mincho','Hiragino Mincho ProN',serif;font-size:84px;font-weight:600;fill:#24170d}
#game .r7-fixed-pointer{position:absolute;left:17.6%;top:-14.4%;width:64.8%;height:auto;pointer-events:none;z-index:2}
#game .r7-shelf-row{position:absolute;left:35.8%;top:22.3%;width:28.4%;height:19.7%;display:grid;grid-template-columns:repeat(10,minmax(0,1fr));grid-template-rows:minmax(0,1fr);pointer-events:none;z-index:2}
#game .r7-spine-slot{position:relative;display:block;height:100%;min-width:0;min-height:0}
#game .r7-spine-slot img{position:absolute;inset:0;display:block;width:100%;height:100%;object-fit:fill;object-position:center bottom}
#game .r7-red-ribbon{position:absolute;top:-5%;left:68%;width:14%;height:13%;background:#b72329;border:1px solid #69171a;clip-path:polygon(0 0,100% 0,100% 100%,50% 75%,0 100%);z-index:2}
#game .r7-overlay{position:absolute;inset:0;display:grid;place-items:center}
#game .r7-panel{position:relative;box-sizing:border-box;width:94%;height:92%;padding:5% 3% 2%;background:var(--paper);border:1px solid var(--gold);color:var(--ink);overflow:hidden}
#game .r7-panel>.device-close{position:absolute;top:8px;right:8px;z-index:10}
#game .r7-panel h2{font-size:clamp(15px,2cqw,26px);margin:0 0 10px}
#game .r7-panel p{font-size:clamp(13px,1.6cqw,22px);line-height:1.6}
#game .r7-panel button:not(.device-close):not(.r7-slot){min-height:40px;padding:7px 12px;background:var(--paper);border:1px solid var(--paper-line);color:var(--ink);font-size:clamp(12px,1.35cqw,20px)}
#game .r7-search{height:100%;display:flex;flex-direction:column;align-items:center;gap:5px;overflow:auto}
#game .r7-search p{margin:5px 0;text-align:center}
#game .r7-cover{min-height:0;max-height:65%;max-width:42%;object-fit:contain}
#game .r7-cover-view{height:100%;display:flex;align-items:center;justify-content:center;gap:5%;overflow:auto}
#game .r7-cover-view>.r7-cover{height:95%;max-height:95%;width:42%;max-width:42%;object-fit:contain}
#game .r7-cover-view>div{width:43%}
#game .r7-shelf-inspection{height:100%;display:flex;flex-direction:column;gap:8px;align-items:stretch}
#game .r7-shelf-zoom{display:grid;grid-template-columns:repeat(10,minmax(0,1fr));height:65%;min-height:0;padding:2% 2% 0;background:linear-gradient(#3b2418,#624028);border:clamp(5px,1cqw,14px) solid #9b5e2f;box-shadow:inset 0 6px 12px #0008;flex-shrink:1}
#game .r7-slot{position:relative;height:100%;padding:0;border:0;border-radius:0!important;background:none;min-width:0;cursor:pointer}
#game .r7-slot>img{width:100%;height:100%;object-fit:contain;object-position:center bottom;display:block}
#game .r7-slot:not(.is-filled):hover,#game .r7-slot:not(.is-filled):focus-visible{background:#f7dfad44}
#game .r7-empty-slot{position:absolute;inset:8% 15% 2%;border-bottom:2px solid #f4d59d66}
#game .r7-shelf-status{flex-shrink:0;min-height:1.7em;margin:0!important;text-align:center}
#game .r7-held-books{display:flex;flex-wrap:wrap;justify-content:center;gap:5px;min-height:0;overflow:auto}
#game .r7-held-books button[aria-pressed=true]{background:#eadab7!important;border-color:var(--gold)!important}
#game .r7-reader-panel{width:98%;height:98%;padding:0;background:#30251c}
#game .r7-reader{height:100%;display:grid;grid-template-columns:1fr auto auto;grid-template-rows:minmax(0,1fr) auto;gap:5px}
#game .r7-reading-viewport{grid-column:1/-1;overflow:auto;min-height:0;display:flex;align-items:center;justify-content:center}
#game .r7-open-book{width:100%;height:100%;object-fit:contain;display:block}
#game .r7-reader #r7Zoom{grid-column:2}
#game .r7-reader #r7BackShelf{grid-column:3}
#game .r7-reader-panel.is-zoomed .r7-reading-viewport{display:block}
#game .r7-reader-panel.is-zoomed .r7-open-book{width:170%;height:auto;max-width:none}
#game .r7-sr-only{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}
#game .r7-dial-inspection{height:100%;display:grid;grid-template-rows:minmax(0,1fr) auto auto;justify-items:center;align-items:center;gap:4px}
#game .r7-dial-inspection>.r7-dial-art{height:100%;width:auto;max-width:80%;aspect-ratio:1}
#game .r7-dial-selection{margin:0!important}
#game .r7-dial-actions{display:flex;justify-content:center;gap:8px}
@container game-viewport (max-height:450px){#game .r7-panel{padding-top:42px}#game .r7-panel p{font-size:13px}#game .r7-shelf-zoom{height:58%}#game .r7-shelf-inspection{gap:4px}#game .r7-panel button:not(.device-close):not(.r7-slot){min-height:36px;padding:4px 8px}#game .r7-nav button{width:36px;height:42px}#game .r7-target::after{width:12px;height:12px}}
@media(prefers-reduced-motion:reduce){#game .r7-dial-wheel{transition:none}}
/* A bounded grid row must not inherit the natural 650px sprite height. */
#game .r7-shelf-zoom{grid-template-rows:minmax(0,1fr)}
#game .r7-slot{min-height:0;overflow:visible}
#game .r7-slot>img{max-height:100%;min-height:0}
#game .r7-dial-wheel svg text{font-family:'DotGothic16',sans-serif;font-weight:400}
/* Keep the companion clear of the cabinet's main investigation target. */
#game .r7-scene[data-view=front] .r7-hana.hana-v2-world{left:17%!important;width:23%!important}
#game .r7-target.is-investigated::after{border-color:#72b68a;background:#79bf921a}
/* Read the approved spreads at full scene height, including on phones. */
#game .r7-overlay:has(.r7-reader-panel){padding:0!important}
#game .r7-panel.r7-reader-panel{width:100%;height:100%;padding:0;border:0}
#game .r7-reader{display:block;position:relative}
#game .r7-reading-viewport{height:100%;width:100%}
#game .r7-reader #r7Zoom{position:absolute;right:118px;bottom:6px;z-index:3}
#game .r7-reader #r7BackShelf{position:absolute;right:6px;bottom:6px;z-index:3}
#game:has(.r7-overlay) .gameplay-hud{visibility:hidden}

/* Direct fullscreen access keeps the mobile playfield available without opening settings. */
#game .design-title-fullscreen{position:absolute;right:2%;top:2%;z-index:66;min-height:40px;padding:7px 12px;border:1px solid var(--paper-line);background:var(--paper);color:var(--ink);font-size:clamp(12px,1.3cqw,18px)}
#game .design-display-note{font-size:clamp(11px,1.2cqw,17px);line-height:1.6;margin:4px 0}
#game .design-settings select{max-width:100%;min-height:36px}
@media(pointer:coarse){#game .gameplay-top-button{min-height:40px;padding:4px 8px}#game .gameplay-hud-actions{gap:4px}}
@media(orientation:portrait) and (pointer:coarse){#game .design-title-fullscreen{display:none}}

/* Keep the enlarged inspection shelf bounded to ten book slots. */
#game .r7-shelf-zoom{box-sizing:border-box;width:auto;max-width:100%;aspect-ratio:1320/650;align-self:center;padding:0;border-bottom-width:clamp(5px,1cqw,14px)}

/* Leave the curtain, desk drawer and diary accessible in the left view. */
#game .r7-scene[data-view=left] .r7-hana.hana-v2-world{left:74%!important}
#game .r7-scene[data-view=left] #r7Photo{z-index:5}

/* Room 7: one gentle pulse after all six books are in the correct order. */
@keyframes r7-books-glow{0%,100%{filter:none}40%{filter:brightness(1.7) drop-shadow(0 0 6px #fff4cf)}70%{filter:brightness(1.2) drop-shadow(0 0 3px #fff4cf)}}
#game .r7-books-glow img{animation:r7-books-glow .9s ease-out 1}
@media(prefers-reduced-motion:reduce){#game .r7-books-glow img{animation:none;filter:brightness(1.2) drop-shadow(0 0 3px #fff4cf)}}

/* The final conversation begins seated; use its dialogue portraits. */
#game .r8-living[data-hana-pose="seated"] > .hana-v2-world,
#game .r8-living[data-hana-pose="gone"] > .hana-v2-world{display:none!important}
#r8Feedback{white-space:pre-line}

/* Room 8 uses its own seated/standing art and a first-person dialogue view. */
#game .r8-living > .hana-v2-world,
#game .r8-exit > .hana-v2-world{display:none!important}
#game .r8-exit .late-stage{position:relative}
#game .r8-story-art{position:absolute;inset:0;z-index:10;overflow:hidden;pointer-events:none}
#game .r8-story-frame{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;opacity:0;transition:opacity var(--r8-art-duration,300ms) ease-in-out;pointer-events:none}
#game .r8-story-frame.is-visible{opacity:1}
#game .r8-story-art::after{content:'';position:absolute;inset:0;background:#fff;opacity:0;pointer-events:none;transition:opacity .8s ease-in-out}
#game .r8-story-art[data-glow="soft"]::after{opacity:.28}
#game .r8-story-art[data-glow="white"]::after{opacity:1}
#game .room-dialog-overlay[data-r8-pov] .hana-portrait{display:none!important}
@media(prefers-reduced-motion:reduce){
 #game .r8-story-frame,#game .r8-story-art::after{transition:none}
}

/* Recollections use their own scene and a faded ivory / gray-brown dialogue palette. */
#game .memory-scene{position:absolute;inset:0;z-index:50;overflow:hidden;pointer-events:none;background:#d6cbb9}
#game .memory-scene[data-location="r7tiger"],#game .memory-scene[data-location="r7rabbit"],#game .memory-scene[data-location="r7sheep"],#game .memory-scene[data-location="r7monkey"]{animation:r7-memory-arrive .65s ease-out both}
@keyframes r7-memory-arrive{from{filter:brightness(2)}to{filter:brightness(1)}}
@media(prefers-reduced-motion:reduce){#game .memory-scene[data-location="r7tiger"],#game .memory-scene[data-location="r7rabbit"],#game .memory-scene[data-location="r7sheep"],#game .memory-scene[data-location="r7monkey"]{animation:none}}
#game .memory-background{display:block;width:100%;height:100%;object-fit:cover;filter:saturate(.72) sepia(.12) contrast(.94)}
#game .memory-girl{position:absolute;left:12%;bottom:-36%;height:128%;width:auto;max-width:none;object-fit:contain;image-rendering:auto}
#game .memory-girl[hidden]{display:none!important}
#game:has(.room-dialog:not(.dialog-hidden)) .memory-girl{clip-path:inset(0 0 48% 0)}
#game[data-memory-stage] :is(.hana-object,.room2-hana,.room3-hana,.r4hana,.hana-v2-world){visibility:hidden}
#game .room-dialog-overlay[data-memory-stage]{--paper:#e7dfce;--ink:#514a43;--gold:#9b8a76;--paper-line:#c4b6a1}
#game .room-dialog-overlay[data-memory-stage] .room-dialog{box-shadow:inset 0 0 0 3px #f2eadc,4px 4px 0 #665c4e35}
#game .room-dialog-overlay[data-memory-stage] .message-speaker,
#game .room-dialog-overlay[data-memory-stage] .next-button{color:#796b5d}
#game .room-dialog-overlay[data-memory-stage] .design-controls button[aria-pressed=true]{background:#d4c8b4;color:#514a43}


/* room02 tactile puzzle board + automatic story dialogue (2026-10-20) */
#game .room2-puzzle{
 --r2-wood:#624730;--r2-rim:#c29a60;--r2-ink:#33271f;
 width:min(860px,100%)!important;max-height:94%!important;
 padding:clamp(12px,1.8cqw,24px)!important;
 background:repeating-linear-gradient(0deg,#0000000b 0 2px,#ffffff05 2px 4px),
 linear-gradient(105deg,#695039 0%,#886547 42%,#6c513a 100%)!important;
 border:8px solid #34261c!important;border-radius:3px!important;
 outline:2px solid #c49e61;outline-offset:-12px;
 box-shadow:inset 0 0 0 3px #b68e55,inset 0 0 0 7px #493422,0 14px 40px #140d0acc!important;
 color:#f7e9cf!important;font-family:'DotGothic16',Meiryo,sans-serif;
}
#game .room2-puzzle h2{
 margin:0 34px 8px 0!important;padding:0 0 7px;border-bottom:2px solid #c6a26b;
 color:#ffe6ad;font-family:'DotGothic16',Meiryo,sans-serif;font-size:clamp(17px,2.2cqw,25px);
 letter-spacing:.08em;text-shadow:2px 2px 0 #322317;
}
#game .room2-puzzle .device-close{
 position:absolute;right:10px;top:9px;min-width:36px;min-height:32px;
 color:#ffebc0!important;background:#543c29!important;border:2px solid #c09a62!important;
 border-radius:2px!important;font-family:'DotGothic16',sans-serif!important;
 box-shadow:inset 2px 2px 0 #826344,2px 2px 0 #2a1b12;
}
#game .room2-board-help{margin:0 0 9px;color:#f1ddbc;font-size:clamp(11px,1.2cqw,14px);}
#game .room2-board-help summary{cursor:pointer;display:list-item;margin-left:18px;width:max-content;max-width:calc(100% - 18px);padding:4px 8px;text-decoration:underline;text-underline-offset:3px;}
#game .room2-board-help .room2-rule{margin:4px 0 7px;padding:9px 11px;border:2px solid #b49361;border-radius:1px;background:#edd9b3;color:#382a1c;line-height:1.65;}
#game .room2-wells-label,#game .room2-tray-label{margin:7px 0 5px;color:#f0d5a4;font-size:clamp(11px,1.2cqw,14px);letter-spacing:.08em;}
#game .room2-puzzle .room2-answer-slots{
 padding:clamp(7px,1.05cqw,13px);gap:clamp(4px,.8cqw,10px);
 background:linear-gradient(#3b2b21,#634935);border:4px solid #c49e64;border-radius:3px;
 box-shadow:inset 0 3px 8px #150c07b8,0 3px 0 #3e2a1a;
}
#game .room2-puzzle .room2-answer-slot{
 position:relative;min-width:0;min-height:clamp(49px,7cqw,78px);padding:4px;
 border:3px solid #231910!important;border-top-color:#170f0a!important;border-left-color:#170f0a!important;
 border-right-color:#947149!important;border-bottom-color:#947149!important;
 border-radius:3px!important;background:linear-gradient(#2b211a,#4e3a2a)!important;
 box-shadow:inset 3px 3px 5px #120b09bb,inset -2px -2px 0 #ae885c70!important;
 transform:none!important;
}
#game .room2-puzzle .room2-answer-slot:not(.is-filled)::after{
 content:"";position:absolute;inset:12%;border:1px dashed #c5a57a55;pointer-events:none;
}
#game .room2-puzzle .room2-answer-slot>span{color:#bba077;font-size:clamp(10px,1.1cqw,13px);position:relative;z-index:1;}
#game .room2-puzzle .room2-answer-slot.is-selected{border-color:#f0d18a!important;box-shadow:inset 2px 2px 6px #1a0e08,0 0 0 2px #ffe09c!important;}
#game .room2-puzzle .room2-answer-slot.is-filled{background:#372a20!important;}
#game .room2-puzzle :is(.room2-answer-slot,.room2-palette-token) i{
 width:100%;height:100%;min-width:0;min-height:clamp(36px,5.5cqw,60px);
 border:3px solid #fff4db4d;border-right-color:#190d0b77;border-bottom-color:#190d0b99;
 border-radius:2px;font:normal 800 clamp(21px,3.3cqw,34px)/1 'DotGothic16',sans-serif;
 text-shadow:2px 2px 0 #1610109e;
 box-shadow:inset 3px 3px 0 #ffffff2e,inset -3px -3px 0 #170d0b40,2px 4px 0 #1c110f70;
}
#game .room2-puzzle :is(.room2-answer-slot,.room2-palette-token) i.red{background:linear-gradient(145deg,#c46f63,#ac4b45 58%,#7a312e)!important;}
#game .room2-puzzle :is(.room2-answer-slot,.room2-palette-token) i.blue{background:linear-gradient(145deg,#698eae,#446688 58%,#263d59)!important;}
#game .room2-puzzle .room2-answer-slot.is-snapping i{animation:room2BlockSnap 260ms cubic-bezier(.12,.73,.23,1.25) both;}
@keyframes room2BlockSnap{0%{transform:translateY(-14px) scale(1.06);filter:brightness(1.28)}58%{transform:translateY(2px) scale(.97)}100%{transform:translateY(0) scale(1);filter:brightness(1)}}
#game .room2-puzzle .room2-palette{
 padding:clamp(7px,1.05cqw,13px);gap:2px 6px;border:4px solid #b5915f;
 border-radius:3px;background:linear-gradient(#4b3829,#39291f);
 box-shadow:inset 0 3px 7px #170d0aab,0 3px 0 #342418;
}
#game .room2-puzzle .room2-palette-token{
 min-width:0;padding:3px!important;background:transparent!important;
 border:2px solid transparent!important;border-radius:2px!important;
 box-shadow:none!important;transition:transform .1s ease;
}
#game .room2-puzzle .room2-palette-token:active{transform:translateY(3px);}
#game .room2-puzzle .room2-palette-token.is-active{border-color:#f0c678!important;background:#a381504d!important;}
#game .room2-puzzle .room2-palette-token small{color:#edd4a9;font-size:clamp(10px,1cqw,12px);margin-top:5px;}
#game .room2-puzzle .room2-puzzle-actions{gap:5px 8px;margin:11px 0;}
#game .room2-puzzle .room2-puzzle-actions button{
 min-height:36px;padding:6px 13px;border:2px solid #c6a171!important;border-radius:2px!important;
 color:#f5e4c5!important;background:#3d2d22!important;
 box-shadow:inset 2px 2px 0 #795b3a,2px 3px 0 #291b13;font-family:'DotGothic16',sans-serif;
 font-size:clamp(11px,1.2cqw,14px);
}
#game .room2-puzzle .room2-puzzle-actions button.room2-submit{
 color:#2f2418!important;background:#e2be7c!important;border-color:#f8e1a6!important;
 box-shadow:inset 2px 2px 0 #fff0c9,2px 3px 0 #382514;font-weight:800;
}
#game .room2-puzzle .room2-puzzle-actions button:active{transform:translateY(2px);box-shadow:inset 2px 2px 0 #795b3a,0 1px 0 #291b13;}
#game .room2-puzzle .room2-puzzle-actions button:disabled{opacity:.42;cursor:default;}
#game .room2-puzzle .room2-feedback{
 min-height:27px;margin:8px 0;padding:5px 8px;border:2px solid #c7ab7b;border-radius:2px;
 background:#ead8b7;color:#423126;font-weight:600;font-size:clamp(11px,1.2cqw,15px);
 white-space:pre-line;
}
#game .room2-puzzle .room2-attempt-counter{
 margin:4px 0 9px;padding:6px 11px;background:#e4d1a7;border:3px solid #4c3826;
 border-radius:2px;color:#362719;box-shadow:inset 2px 2px 0 #fff0c9;
}
#game .room2-puzzle .room2-attempt-track{margin-top:4px;}
#game .room2-puzzle .room2-attempt-step{background:#ad987a;border:1px solid #776448;border-radius:1px;}
#game .room2-puzzle .room2-attempt-step.is-used{background:#865047;}
#game .room2-puzzle .room2-history{
 max-height:min(113.4px,115px);margin-top:9px;padding:4px;border:3px solid #644b2f;border-radius:2px;
 background:#ddcba8;color:#36271d;box-shadow:inset 2px 2px 4px #75542e66;
}
#game .room2-puzzle .room2-history-row{border-bottom:1px solid #ac9772;padding:4px 6px;}
#game .room2-puzzle .room2-history-row.is-latest{border-left:4px solid #78512d;padding-left:3px;background:#f7e6bc;}
#game .room2-puzzle .room2-history-turn{color:#654b31;}
#game .room2-puzzle .room2-history-row i{width:clamp(22px,3.5cqw,30px);height:clamp(23px,3.5cqw,30px);}
#game .room2-puzzle .room2-reaction{
 display:block;position:sticky;bottom:4px;z-index:8;margin:10px 0 0;padding:11px 15px 12px;
 border:4px solid #d6b879;border-radius:2px;background:#282f37;color:#fbf1de;
 box-shadow:inset 0 0 0 2px #6f7d82,0 7px 0 #2e2119,0 12px 18px #1a110ca8;
 font-family:'DotGothic16',sans-serif;
}
#game .room2-puzzle .room2-reaction[hidden]{display:none!important;}
#game .room2-puzzle .room2-reaction-top{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:6px;}
#game .room2-puzzle .room2-reaction-speaker{
 margin:0;padding:3px 12px;border:1px solid #cda972;background:#e6c88b;color:#37281d;
 font-size:clamp(12px,1.3cqw,16px);font-weight:bold;
}
#game .room2-puzzle .room2-reaction-text{
 margin:3px 0 10px;min-height:2em;color:#f9edd6;
 font-size:clamp(13px,1.7cqw,18px);line-height:1.65;white-space:pre-wrap;
}
#game .room2-puzzle .room2-reaction-skip{
 flex-shrink:0;min-height:31px;padding:3px 9px;border:1px solid #c6ab83!important;
 background:#444e56!important;color:#f8eddc!important;border-radius:2px!important;
 font:inherit;font-size:clamp(10px,1.1cqw,12px);
}
#game .room2-puzzle .room2-reaction-auto{height:3px;background:#78838a55;overflow:hidden;}
#game .room2-puzzle .room2-reaction-auto span{display:block;width:0;height:100%;background:#ecd094;}
@keyframes room2DialogueProgress{from{width:0}to{width:100%}}
#game .room2-puzzle .room2-leftmost-hint{border-radius:2px;background:#efddb4;color:#51391c;}
@container game-viewport (max-width:650px) or (max-height:460px){
 #game .room2-puzzle{padding:9px 12px!important;border-width:6px!important;outline-offset:-9px;}
 #game .room2-puzzle h2{font-size:16px;margin-bottom:4px!important;padding-bottom:4px;}
 #game .room2-board-help{margin-bottom:4px;font-size:11px;}
 #game .room2-wells-label,#game .room2-tray-label{margin:3px 0;font-size:10px;}
 #game .room2-puzzle .room2-answer-slots,#game .room2-puzzle .room2-palette{padding:5px;border-width:3px;gap:3px;}
 #game .room2-puzzle .room2-answer-slot{min-height:45px;padding:2px;}
 #game .room2-puzzle :is(.room2-answer-slot,.room2-palette-token) i{min-height:34px;font-size:22px;}
 #game .room2-puzzle .room2-palette-token small{margin-top:2px;font-size:9px;}
 #game .room2-puzzle .room2-puzzle-actions{margin:6px 0;}
 #game .room2-puzzle .room2-puzzle-actions button{min-height:31px;padding:3px 7px;font-size:11px;}
 #game .room2-puzzle .room2-feedback{font-size:11px;margin:5px 0;}
 #game .room2-puzzle .room2-history{max-height:65px;}
 #game .room2-puzzle .room2-reaction{padding:7px 9px;}
 #game .room2-puzzle .room2-reaction-text{font-size:12px;line-height:1.45;margin-bottom:5px;}
}
@media(prefers-reduced-motion:reduce){
 #game .room2-puzzle .room2-answer-slot.is-snapping i{animation:none;}
 #game .room2-puzzle .room2-palette-token{transition:none;}
 #game .room2-puzzle .room2-reaction-auto span{animation:none!important;width:100%!important;}
}


/* Room 02: minimal visible copy; compact help + uncluttered physical board */
#game .room2-puzzle{
 grid-template-columns:minmax(0,1.05fr) minmax(0,.95fr);
 grid-template-rows:auto auto auto minmax(0,1fr) auto;
}
#game .room2-puzzle .room2-answer-slots{grid-column:1;grid-row:3}
#game .room2-puzzle .room2-palette{grid-column:1;grid-row:4}
#game .room2-puzzle .room2-attempt-counter{grid-column:1;grid-row:2;margin:0 0 6px}
#game .room2-puzzle .room2-history{grid-column:2;grid-row:3/5;min-height:0}
#game .room2-puzzle .room2-history:empty{border-color:transparent;background:transparent;box-shadow:none}
#game .room2-puzzle .room2-feedback{
 grid-column:2;grid-row:2;align-self:start;min-height:0;margin:0 0 5px;
 padding:5px 8px;white-space:pre-line;
}
#game .room2-puzzle .room2-feedback:empty{display:none!important}
#game .room2-puzzle .room2-leftmost-hint{grid-column:2;grid-row:1;align-self:center}
#game .room2-puzzle .room2-puzzle-actions{grid-column:1/-1;grid-row:5}
#game .room2-board-help{
 position:absolute;right:84px;top:9px;z-index:12;
 margin:0!important;padding:0;line-height:1;
}
#game .room2-puzzle>.design-op-button{right:130px}
#game .room2-board-help summary{
 display:grid;place-items:center;list-style:none;
 min-width:34px;min-height:34px;width:34px;height:34px;
 margin:0!important;padding:0!important;
 background:#493423;color:#ffedbe;border:2px solid #c09a62;
 border-radius:2px;font-size:21px;font-weight:700;
 text-decoration:none;box-shadow:inset 2px 2px 0 #816243,2px 2px 0 #291b13;
 cursor:pointer;
}
#game .room2-board-help summary::-webkit-details-marker{display:none}
#game .room2-board-help summary:focus-visible{outline:3px solid #ffe5a0;outline-offset:2px}
#game .room2-board-help .room2-rule{
 position:absolute;right:0;top:calc(100% + 8px);z-index:13;
 width:min(350px,672px);max-height:min(230px,324px);overflow:auto;
 margin:0!important;padding:10px 12px!important;
 background:#edd9b3!important;color:#382a1c!important;
 line-height:1.65;font-size:12px;white-space:normal;
 box-shadow:0 8px 0 #3e291a,0 14px 22px #150d0b77;
}
#game .room2-puzzle .room2-reaction{
 position:absolute;left:3%;right:3%;bottom:7px;margin:0;max-height:54%;overflow:auto;
}
@container game-viewport (max-width:650px) or (max-height:460px){
 #game .room2-board-help{right:51px;top:5px}
 #game .room2-board-help summary{min-width:31px;min-height:31px;width:31px;height:31px;font-size:18px}
 #game .room2-board-help .room2-rule{width:min(330px,748.8px);max-height:291.6px;font-size:11px}
 #game .room2-puzzle .room2-feedback{font-size:11px;padding:3px 5px}
 #game .room2-puzzle .room2-reaction{left:2%;right:2%;bottom:3px}
}


/* Room 02 proof100: readable sections inside compact question-mark help */
#game .room2-board-help .room2-rule p{margin:0 0 6px;line-height:1.55;}
#game .room2-board-help .room2-rule p:last-child{margin-bottom:0;}
#game .room2-board-help .room2-rule p:nth-child(odd){
 margin:8px 0 3px;padding-bottom:2px;border-bottom:1px solid #b79b6b;
 font-weight:800;color:#503b26;
}
#game .room2-board-help .room2-rule p:first-child{margin-top:0;}


/* Room 02: simultaneous nonblocking two-character judge dialogue */
#game .room2-puzzle .room2-sidebar{
 grid-column:2;grid-row:2/5;min-width:0;min-height:0;
 display:flex;flex-direction:column;gap:6px;overflow:hidden;
}
#game .room2-puzzle .room2-sidebar .room2-feedback,
#game .room2-puzzle .room2-sidebar .room2-leftmost-hint{
 grid-column:auto;grid-row:auto;align-self:stretch;
}
#game .room2-puzzle .room2-sidebar .room2-history{
 grid-column:auto;grid-row:auto;flex:1 1 auto;min-height:34px;max-height:none;
 overflow-y:auto;overflow-x:hidden;
}
#game .room2-puzzle .room2-sidebar .room2-reaction{
 position:relative;left:auto;right:auto;top:auto;bottom:auto;
 display:flex;flex-direction:column;flex:0 1 auto;
 width:100%;min-width:0;min-height:0;max-height:65%;
 margin:0;padding:9px 11px;border-width:3px;
 overflow:hidden;box-sizing:border-box;
}
#game .room2-puzzle .room2-reaction[hidden]{display:none!important}
#game .room2-puzzle .room2-reaction-top{flex:0 0 auto;margin:0 0 6px;gap:6px}
#game .room2-puzzle .room2-reaction-title{
 color:#f8d99d;font:700 clamp(11px,1.2cqw,14px)/1.3 'DotGothic16',sans-serif;
}
#game .room2-puzzle .room2-reaction-skip{
 padding:1px 7px;min-width:28px;min-height:25px;
 font-size:17px;line-height:1;cursor:pointer;
}
#game .room2-puzzle .room2-reaction-lines{
 display:flex;flex-direction:column;gap:7px;min-height:0;
 max-height:100%;overflow-y:auto;overscroll-behavior:contain;
}
#game .room2-puzzle .room2-reaction-line{
 display:grid;grid-template-columns:minmax(36px,auto) minmax(0,1fr);
 align-items:start;gap:6px;min-width:0;
}
#game .room2-puzzle .room2-reaction-name{
 padding:2px 5px;background:#dcc185;color:#382a20;
 font-size:clamp(10px,1.1cqw,13px);line-height:1.45;
 border:1px solid #aa8954;white-space:nowrap;
}
#game .room2-puzzle .room2-reaction-speech{
 margin:0;color:#f9edd6;line-height:1.5;
 font-size:clamp(11px,1.4cqw,15px);
 white-space:pre-wrap;overflow-wrap:anywhere;
}
@container game-viewport (max-width:650px) or (max-height:460px){
 #game .room2-puzzle .room2-sidebar{gap:3px}
 #game .room2-puzzle .room2-sidebar .room2-reaction{padding:5px 7px;max-height:70%;border-width:2px}
 #game .room2-puzzle .room2-reaction-top{margin-bottom:3px}
 #game .room2-puzzle .room2-reaction-lines{gap:4px}
 #game .room2-puzzle .room2-reaction-line{grid-template-columns:minmax(31px,auto) minmax(0,1fr);gap:4px}
 #game .room2-puzzle .room2-reaction-name{font-size:10px;padding:1px 3px}
 #game .room2-puzzle .room2-reaction-speech{font-size:11px;line-height:1.35}
 #game .room2-puzzle .room2-sidebar .room2-history{min-height:27px;max-height:none}
}


/* The logical game never switches to a portrait aspect ratio. Show a separate
   readable device-rotation notice above the 16:9 letterboxed game instead. */
#portrait-cover{display:none}
@media (orientation:portrait) and (pointer:coarse){
 #portrait-cover{position:fixed;inset:0;display:grid;place-items:center;z-index:9999;background:#171b19;color:#faf7ee;padding:24px;text-align:center}
 #portrait-cover>div{max-width:420px;padding:28px 22px;border:1px solid #ae9157;border-radius:8px;background:#242925}
 #portrait-cover h2{margin-bottom:12px;font-size:24px;font-weight:normal}
 #portrait-cover p{font-size:16px;line-height:1.7}
}
/* Authored recollections: seated poses stay behind their real furniture. */
#game .memory-foreground{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;z-index:2;filter:saturate(.72) sepia(.12) contrast(.94);clip-path:inset(63% 0 0 0)}
#game .memory-foreground[hidden],#game .memory-prop[hidden]{display:none!important}
#game .memory-scene[data-layout=dining] .memory-girl,#game .memory-scene[data-layout=desk] .memory-girl{left:50%;transform:translateX(-50%);top:11%;bottom:auto;height:94%;clip-path:inset(0 0 37% 0)}
#game .memory-scene[data-layout=desk] .memory-girl{top:7%;height:90%;clip-path:inset(0 0 24% 0)}
#game .memory-scene[data-layout=desk] .memory-foreground{clip-path:inset(70.7% 0 0 0)}
#game .memory-scene[data-layout=sofa] .memory-girl{left:76%;transform:translateX(-50%);top:21%;bottom:auto;height:77%;clip-path:none}
#game .memory-scene[data-layout=sofa] .memory-foreground{clip-path:polygon(50.5% 65%,54% 63%,89% 76%,92% 80%,92% 100%,50.5% 100%)}
#game .memory-scene[data-layout=cooking] .memory-girl{left:48%;transform:translateX(-50%);top:2%;bottom:auto;height:104%;clip-path:none}
#game .memory-scene[data-layout=cooking] .memory-foreground{clip-path:polygon(47.6% 53.5%,100% 53.5%,100% 100%,47.6% 100%)}
#game .memory-girl{z-index:1}
#game .memory-prop{position:absolute;z-index:3;left:43%;top:70%;width:16%;height:15%;pointer-events:none}
#game .memory-prop[data-kind=rabbit]{background:#f4eddf;transform:rotate(-5deg);box-shadow:1px 2px 4px #0003}
#game .memory-prop-image{width:100%;height:100%;object-fit:contain}
#game .memory-prop[data-kind=cards]{display:flex;left:34%;width:33%;gap:3px}
#game .memory-prop[data-kind=cards] img{width:12%;height:100%;object-fit:contain;background:#e8dfcb}
#game .memory-notebook{width:100%;height:100%;display:flex;background:#f5eddf;border:2px solid #7b6a50;transform:rotate(-5deg)}
#game .memory-notebook i{width:50%;border-right:1px solid #b3a58c;background:repeating-linear-gradient(transparent 0 15%,#a79b8622 16% 17%)}
#game .memory-scene[data-location="r7monkey"] .memory-notebook{box-sizing:border-box;clip-path:polygon(16% 0,84% 0,100% 100%,0 100%);transform:none}
#game .memory-scene[data-location="r7monkey"] .memory-notebook i{position:relative}
#game .memory-scene[data-location="r7monkey"] .memory-notebook i::after{content:"";position:absolute;inset:16% 15%;opacity:.55;background:linear-gradient(#705f50,#705f50) 0 0/72% 2px no-repeat,linear-gradient(#705f50,#705f50) 0 24%/88% 2px no-repeat,linear-gradient(#705f50,#705f50) 0 48%/56% 2px no-repeat,linear-gradient(#705f50,#705f50) 0 72%/78% 2px no-repeat,linear-gradient(#705f50,#705f50) 0 96%/64% 2px no-repeat}
#game .memory-effect{position:absolute;inset:0;z-index:4;pointer-events:none;opacity:0}
#game .memory-scene[data-effect=white] .memory-effect{opacity:.6;background:#fff}
#game .memory-scene[data-effect=red] .memory-effect{opacity:.96;background:#831e22}

/* Room 2 secret: a furniture hit area without the ordinary investigation ring.
   It remains discoverable by tapping the left dresser, even when highlight is enabled. */
#game .room-two .room2-secret-dresser{
 position:absolute;
 left:5.5%;top:35%;width:15%;height:35%;
 z-index:7;
 margin:0;padding:0!important;border:0!important;
 background:transparent!important;box-shadow:none!important;
 opacity:1;cursor:pointer;appearance:none;
}
#game .room-two .room2-secret-dresser:is(:hover,:active){background:transparent!important;box-shadow:none!important}
#game .room-two .room2-secret-dresser::before,
#game .room-two .room2-secret-dresser::after{content:none!important;display:none!important}
#game .room-two .room2-secret-dresser:focus-visible{outline:2px solid #c8a65c;outline-offset:-2px}

/* Room 2 eight-turn challenge: a defined place for every panel.
   The counter shares the title row; the reaction uses the entire bottom row.
   Allow vertical scrolling before ever letting puzzle controls overlap. */
#game .room2-puzzle.room2-challenge-board{
 display:grid;
 grid-template-columns:minmax(0,1.08fr) minmax(0,.92fr);
 grid-template-rows:auto minmax(48px,auto) minmax(118px,1fr) auto auto;
 gap:clamp(5px,.7cqw,10px) 3%;
 align-items:stretch;
 min-height:0;
 overflow-x:hidden;
 overflow-y:auto;
}
#game .room2-challenge-board>h2{
 grid-column:1;grid-row:1;
 align-self:center;
 margin-bottom:0!important;
}
#game .room2-puzzle.room2-challenge-board .room2-attempt-counter{
 grid-column:2;grid-row:1;
 justify-self:stretch;align-self:center;
 min-width:0;
 margin:0 123px 0 0!important;
 padding:5px 8px!important;
}
#game .room2-challenge-board .room2-attempt-summary{
 display:flex;flex-wrap:nowrap;
 justify-content:space-between;align-items:center;gap:5px;
 font-size:clamp(10px,1.13cqw,13px);
}
#game .room2-challenge-board :is(.room2-attempt-used,.room2-attempt-left){white-space:nowrap}
#game .room2-challenge-board .room2-attempt-track{display:none}
#game .room2-challenge-board .room2-answer-slots{
 grid-column:1;grid-row:2;
 align-self:stretch;min-width:0;min-height:0;
}
#game .room2-challenge-board .room2-palette{
 grid-column:1;grid-row:3;
 min-width:0;min-height:118px;
 grid-template-rows:repeat(2,minmax(43px,1fr));
 overflow-y:auto;overscroll-behavior:contain;
}
#game .room2-challenge-board .room2-sidebar{
 grid-column:2;grid-row:2/4;
 min-height:0;min-width:0;overflow:hidden;
}
#game .room2-challenge-board .room2-sidebar .room2-history{
 flex:1 1 auto;min-height:0;max-height:none;
 margin:0;overflow-y:auto;
}
#game .room2-challenge-board .room2-puzzle-actions{
 grid-column:1/-1;grid-row:4;
 align-self:stretch;
 margin:0!important;
 padding-top:5px;
}
#game .room2-puzzle.room2-challenge-board>.room2-reaction{
 grid-column:1/-1;grid-row:5;
 position:relative;left:auto;right:auto;top:auto;bottom:auto;
 z-index:8;
 display:flex;flex-direction:column;
 box-sizing:border-box;width:100%;min-width:0;
 max-height:120px;min-height:0;
 margin:0;padding:8px 12px;
 overflow-y:auto;
}
#game .room2-challenge-board>.room2-reaction .room2-reaction-top{
 flex:0 0 auto;margin:0 0 5px;
}
#game .room2-challenge-board>.room2-reaction .room2-reaction-lines{
 display:grid;
 grid-template-columns:repeat(2,minmax(0,1fr));
 gap:8px 12px;min-height:0;max-height:none;
 overflow:visible;
}
#game .room2-challenge-board>.room2-reaction .room2-reaction-line{min-width:0}
#game .room2-challenge-board .room2-puzzle-actions button.room2-submit{
 min-width:120px!important;
 font-family:Meiryo,"Hiragino Kaku Gothic ProN","Yu Gothic",sans-serif!important;
 font-weight:900!important;
 font-size:clamp(15px,1.8cqw,19px)!important;
 letter-spacing:.1em;
 text-shadow:0 0 .55px currentColor;
 line-height:1.25;
}
#game .room2-challenge-board .room2-puzzle-actions button.room2-submit:disabled{
 opacity:.74;
}
@container game-viewport (max-width:650px) or (max-height:520px){
 #game .room2-puzzle.room2-challenge-board{
  grid-template-rows:auto minmax(40px,auto) minmax(94px,1fr) auto auto;
  gap:4px 3%;
 }
 #game .room2-puzzle.room2-challenge-board .room2-attempt-counter{
  margin-right:113px!important;padding:3px 5px!important;
 }
 #game .room2-challenge-board .room2-attempt-summary{font-size:10px;gap:3px}
 #game .room2-challenge-board .room2-palette{
  min-height:94px;grid-template-rows:repeat(2,minmax(34px,1fr));
 }
 #game .room2-puzzle.room2-challenge-board>.room2-reaction{
  max-height:105px;padding:5px 8px;
 }
 #game .room2-challenge-board>.room2-reaction .room2-reaction-lines{
  grid-template-columns:1fr;gap:4px;
 }
 #game .room2-challenge-board .room2-puzzle-actions button.room2-submit{
  min-width:94px!important;font-size:15px!important;
 }
}


/* Room 2 regular puzzle: give judgement dialogue the same wide, lower
   panel used by the eight-turn challenge. History stays in the right column. */
#game .room2-puzzle.room2-standard-board{
 display:grid;
 grid-template-columns:minmax(0,1.08fr) minmax(0,.92fr);
 grid-template-rows:auto minmax(48px,auto) minmax(118px,1fr) auto auto;
 gap:clamp(5px,.7cqw,10px) 3%;
 min-height:0;
 overflow-x:hidden;
 overflow-y:auto;
 align-items:stretch;
}
#game .room2-standard-board>h2{
 grid-column:1;grid-row:1;
 align-self:center;
 margin-bottom:0!important;
}
#game .room2-standard-board .room2-answer-slots{
 grid-column:1;grid-row:2;
 min-width:0;min-height:0;align-self:stretch;
}
#game .room2-standard-board .room2-palette{
 grid-column:1;grid-row:3;
 min-width:0;min-height:118px;
 grid-template-rows:repeat(2,minmax(43px,1fr));
 overflow-y:auto;overscroll-behavior:contain;
}
#game .room2-standard-board .room2-sidebar{
 grid-column:2;grid-row:2/4;
 min-width:0;min-height:0;overflow:hidden;
}
#game .room2-standard-board .room2-sidebar .room2-history{
 flex:1 1 auto;min-height:0;max-height:none;
 margin:0;overflow-y:auto;
}
#game .room2-standard-board .room2-puzzle-actions{
 grid-column:1/-1;grid-row:4;
 align-self:stretch;margin:0!important;padding-top:5px;
}
#game .room2-puzzle.room2-standard-board>.room2-reaction{
 grid-column:1/-1;grid-row:5;
 position:relative;left:auto;right:auto;top:auto;bottom:auto;
 z-index:8;
 display:flex;flex-direction:column;
 box-sizing:border-box;width:100%;min-width:0;
 max-height:120px;min-height:0;
 margin:0;padding:8px 12px;
 overflow-y:auto;
}
#game .room2-standard-board>.room2-reaction .room2-reaction-top{
 flex:0 0 auto;margin:0 0 5px;
}
#game .room2-standard-board>.room2-reaction .room2-reaction-lines{
 display:grid;
 grid-template-columns:repeat(2,minmax(0,1fr));
 gap:8px 12px;min-height:0;max-height:none;
 overflow:visible;
}
#game .room2-standard-board>.room2-reaction .room2-reaction-line{min-width:0}
@container game-viewport (max-width:650px) or (max-height:520px){
 #game .room2-puzzle.room2-standard-board{
  grid-template-rows:auto minmax(40px,auto) minmax(94px,1fr) auto auto;
  gap:4px 3%;
 }
 #game .room2-standard-board .room2-palette{
  min-height:94px;grid-template-rows:repeat(2,minmax(34px,1fr));
 }
 #game .room2-puzzle.room2-standard-board>.room2-reaction{
  max-height:105px;padding:5px 8px;
 }
 #game .room2-standard-board>.room2-reaction .room2-reaction-lines{
  grid-template-columns:1fr;gap:4px;
 }
}


/* Room 03 review: keep unearned solution instructions off the puzzle screen.
   Once decoded, the player's own words stay visible as a small paper clue. */
#game .room3-puzzle-panel .room3-puzzle-instruction:empty{display:none!important}
#game .room3-puzzle-panel.r3-board-ready .room3-puzzle-instruction{
  justify-self:stretch;
  align-self:start;
  padding:clamp(8px,1cqw,14px)!important;
  border:1px solid #b8a078;
  border-left:4px solid #907653;
  background:#efe6d4;
  color:#493824;
  font:normal clamp(16px,1.85cqw,22px)/1.45 "DotGothic16",sans-serif!important;
  letter-spacing:.07em;
}

/* Room 03: one phone conversation for both answers, with a companion reference.
   The full-size attachment and Morse chart remain readable in landscape. */
#game .room3-chat-overlay{padding:1.5%!important}
#game .room3-chat-overlay .r3-chat-workspace{
  box-sizing:border-box;
  display:grid;grid-template-columns:minmax(180px,.34fr) minmax(0,.66fr);
  align-items:stretch;justify-items:stretch;
  width:min(96%,1110px);height:96%;max-height:100%;min-height:0;gap:clamp(10px,1.6cqw,20px);
  background:transparent;border:0;overflow:visible;
}
#game .r3-chat-workspace>.r3-handset{
  justify-self:center;
  height:100%!important;max-width:100%!important;min-height:0;
  box-sizing:border-box;
}
#game .r3-chat-workspace .r3-reply-form{
  flex:0 0 auto;display:flex;align-items:stretch;gap:4px;
  padding:6px 5px;
  border-top:2px solid #738c99;
  background:#d6e4e7;
}
#game .r3-chat-workspace .r3-reply-form[hidden]{display:none!important}
#game .r3-chat-workspace .r3-reply-input{
  flex:1 1 auto;min-width:0;min-height:32px;
  box-sizing:border-box;
  margin:0;padding:4px 6px;
  font:normal clamp(12px,1.5cqw,16px)/1.35 'DotGothic16',sans-serif;
  color:#26333a;background:#fafbf8;
  border:1px solid #879aa2;border-radius:4px;
}
#game .r3-chat-workspace .r3-reply-send{
  flex:0 0 auto;min-width:48px;min-height:32px;
  padding:3px 6px!important;
  color:#fff!important;background:#365f73!important;
  border:1px solid #2b4656!important;
  font:normal clamp(12px,1.3cqw,14px)/1 'DotGothic16',sans-serif!important;
}
#game .r3-chat-workspace .r3-reply-send:disabled{opacity:.5}
#game .r3-chat-workspace .r3-photo-message{
  display:flex;flex-direction:column;align-items:flex-start;
  gap:3px;max-width:88%;align-self:flex-start;
}
#game .r3-chat-workspace .r3-photo-message small{font-size:.73em;color:#40535e}
#game .r3-chat-workspace .r3-board-preview{
  display:block;width:min(186px,100%);height:auto;
  padding:5px!important;border:1px solid #879ba2!important;
  border-radius:4px;background:#f7f0e3!important;
  cursor:zoom-in;
}
#game .r3-chat-workspace .r3-board-preview img{
  display:block;width:100%;height:auto;aspect-ratio:1;
  object-fit:contain;image-rendering:auto;pointer-events:none;
}
#game .r3-chat-workspace .r3-companion-sheet{
  display:flex;flex-direction:column;min-height:0;min-width:0;
  padding:clamp(8px,1.2cqw,16px);
  box-sizing:border-box;
  border:3px solid #7c674e;
  background:linear-gradient(100deg,#dbd0b8,#f6ecd6 40%,#e5d7b9);
  box-shadow:inset 0 0 0 3px #faf2e0,4px 6px 0 #17120ca1;
}
#game .r3-chat-workspace .r3-companion-tabs{
  flex:0 0 auto;display:flex;flex-wrap:wrap;gap:6px;margin-bottom:8px;
}
#game .r3-chat-workspace .r3-companion-tabs button{
  padding:5px 10px!important;min-height:30px;
  font:normal clamp(12px,1.4cqw,16px)/1.25 'DotGothic16',sans-serif!important;
  background:#e4d5b8!important;color:#3e3428!important;
  border:1px solid #a18b69!important;cursor:pointer;
}
#game .r3-chat-workspace .r3-companion-tabs button[aria-pressed="true"]{
  background:#68513a!important;color:#fff4dc!important;
}
#game .r3-chat-workspace .r3-companion-tabs button:disabled{
  opacity:.35;cursor:default;
}
#game .r3-chat-workspace .r3-companion-content{
  flex:1 1 auto;min-height:0;min-width:0;position:relative;
  display:flex;align-items:center;justify-content:center;
  overflow:hidden;
}
#game .r3-chat-workspace .r3-inline-morse{
  --morse-unit:clamp(3px,.44cqw,6px);
  display:flex;flex-direction:column;flex:1;
  gap:5px;width:100%;height:100%;min-width:0;min-height:0;
  box-sizing:border-box;
  padding:clamp(5px,.8cqw,10px);
  background:#f8f2e6;border:2px solid #a48c6e;
  box-shadow:none;overflow:hidden;
}
#game .r3-chat-workspace .r3-inline-morse .r3-morse-grid{
  flex:1;min-height:0;gap:clamp(2px,.4cqw,5px) clamp(3px,.7cqw,9px);
}
#game .r3-chat-workspace .r3-inline-morse .r3-morse-cell{
  min-width:0;min-height:0;gap:clamp(4px,.55cqw,8px);
  padding:0 2px;
}
#game .r3-chat-workspace .r3-inline-morse .r3-morse-cell strong{
  font-size:clamp(12px,1.6cqw,18px);width:1em;
}
#game .r3-chat-workspace .r3-inline-morse .r3-morse-code{
  gap:calc(var(--morse-unit)*.55);
}
#game .r3-chat-workspace .r3-inline-morse .r3-morse-legend{
  font-size:clamp(10px,1.2cqw,13px);
}
#game .r3-chat-workspace .r3-large-letterboard{
  display:flex;align-items:center;justify-content:center;
  height:100%;width:100%;min-width:0;min-height:0;
  padding:4px;box-sizing:border-box;overflow:hidden;
}
#game .r3-chat-workspace .r3-large-letterboard img{
  display:block;flex:0 1 auto;
  box-sizing:border-box;
  max-height:calc(100% - 12px);max-width:calc(100% - 12px);
  width:auto;height:auto;
  object-fit:contain;border:3px solid #927c5d;background:#f3e9d5;
}
#game .r3-chat-workspace .r3-no-attachment{
  flex:1;background:repeating-linear-gradient(0deg,transparent 0 22px,#b5a68b3b 23px 24px);
}
#game .r3-chat-workspace :is(.r3-inline-morse,.r3-large-letterboard,.r3-no-attachment)[hidden]{display:none!important}
@container game-viewport (max-width:900px) or (max-height:470px){
  #game .room3-chat-overlay .r3-chat-workspace{
    grid-template-columns:minmax(165px,.30fr) minmax(0,.70fr);
    width:98%;height:98%;gap:8px;
  }
  #game .r3-chat-workspace .r3-companion-sheet{padding:6px;border-width:2px}
  #game .r3-chat-workspace .r3-companion-tabs{gap:4px;margin-bottom:4px}
  #game .r3-chat-workspace .r3-companion-tabs button{padding:4px 7px!important;min-height:25px;font-size:12px!important}
  #game .r3-chat-workspace .r3-reply-form{padding:3px;gap:3px}
  #game .r3-chat-workspace .r3-reply-input{min-height:28px;font-size:12px}
  #game .r3-chat-workspace .r3-reply-send{min-height:28px;min-width:42px;font-size:11px!important}
  #game .r3-chat-workspace .r3-inline-morse{padding:3px}
  #game .r3-chat-workspace .r3-inline-morse .r3-morse-cell strong{font-size:12px}
  #game .r3-chat-workspace .r3-inline-morse .r3-morse-legend{font-size:10px}
}

/* A clue is visible only after discovery. No prepared empty display frame. */
#game .room3-chat-overlay .r3-chat-workspace:not(.has-reference){
 display:flex!important;
 flex-direction:row;
 align-items:stretch;
 justify-content:center;
 width:min(100%,1110px);
}
#game .room3-chat-overlay .r3-chat-workspace:not(.has-reference)>.r3-handset{
 flex:0 0 auto;
 max-width:100%!important;
}
#game .room3-chat-overlay .r3-chat-workspace>.r3-companion-sheet[hidden],
#game .r3-chat-workspace .r3-companion-tabs[hidden],
#game .r3-chat-workspace .r3-companion-tabs button[hidden]{
 display:none!important;
}
@container game-viewport (max-width:900px) or (max-height:470px){
 #game .room3-chat-overlay .r3-chat-workspace:not(.has-reference){
  width:100%!important;
  justify-content:center!important;
 }
}


/* Room 04 / small puzzle 3: seven physical color plates in a display rail.
   One row fits the game's landscape viewport; no up/down controls or hints. */
#game .r4-plate-overlay .r4-mini.r4-plate-exhibit{
 box-sizing:border-box;
 position:relative;
 display:flex!important;
 flex-direction:column!important;
 align-items:stretch;
 justify-content:center;
 width:min(1060px,97%);
 height:auto;
 max-height:94%!important;
 min-height:0;
 overflow:hidden!important;
 gap:clamp(8px,1.35cqh,14px);
 padding:clamp(14px,2.15cqw,30px)!important;
 color:#e9e3d6!important;
 background:linear-gradient(137deg,#283f4c 0%,#142531 55%,#263442 100%)!important;
 border:clamp(4px,.65cqw,8px) solid #7d6547!important;
 border-radius:5px!important;
 box-shadow:inset 0 0 0 3px #b39768,inset 0 0 0 7px #152331,0 14px 35px #050c13cc!important;
}
#game .r4-plate-overlay .r4-plate-exhibit .device-close{
 position:absolute;
 top:clamp(8px,1cqw,15px);
 right:clamp(8px,1cqw,15px);
 z-index:12;
 min-width:38px;
 min-height:34px;
 background:#192b37!important;
 color:#f5ead2!important;
 border:1px solid #a38c65!important;
}
#game .r4-plate-exhibit .r4-plate-exhibit-header{
 display:flex;align-items:center;justify-content:center;
 gap:clamp(10px,1.6cqw,25px);
 flex:0 0 auto;min-width:0;
 padding-right:30px;
 color:#e8d4ab;
}
#game .r4-plate-exhibit .r4-plate-exhibit-header h2{
 color:inherit;
 text-align:center;
 font:normal clamp(18px,2.25cqw,30px)/1.3 "DotGothic16",sans-serif;
 letter-spacing:.12em;
 margin:0!important;
}
#game .r4-plate-exhibit .r4-plate-emblem{
 color:#aa9474;font-size:clamp(15px,1.65cqw,24px);
}
#game .r4-plate-exhibit .r4-plate-rail{
 position:relative;
 flex:0 1 auto;
 width:100%;
 box-sizing:border-box;
 min-height:0;
 padding:clamp(12px,1.85cqw,22px) clamp(10px,1.5cqw,18px);
 background:
  linear-gradient(90deg,#2a2524,#71553c 4%,#48392f 14%,#504032 85%,#795a3d 96%,#2a2524);
 border:3px solid #a5855b;
 outline:2px solid #101c25;
 box-shadow:inset 0 8px 10px #0b0b0a8c,inset 0 -7px 8px #170e0b8c,0 4px 0 #14181c;
}
#game .r4-plate-exhibit .r4-rainbow{
 display:grid!important;
 grid-template-columns:repeat(7,minmax(0,1fr))!important;
 grid-template-rows:minmax(0,1fr)!important;
 gap:clamp(3px,.65cqw,9px)!important;
 width:100%;
 height:clamp(96px,27cqh,182px);
 max-height:100%;
 min-height:0;
 margin:0!important;
 padding:0!important;
 background:repeating-linear-gradient(90deg,#211b18,#211b18 8px,#40342b 8px,#40342b 12px);
 border:0!important;
 overflow:visible;
}
#game .r4-plate-exhibit .r4-rainbow-plate{
 position:relative;
 display:block;
 box-sizing:border-box;
 min-width:0;
 width:100%;
 min-height:0!important;
 height:100%;
 padding:clamp(4px,.7cqw,9px)!important;
 border:3px solid #e0c99c!important;
 border-radius:3px!important;
 background:#342c27!important;
 cursor:grab;
 touch-action:none;
 user-select:none;
 -webkit-user-select:none;
 box-shadow:inset 0 0 0 2px #554632,0 3px 1px #100e0eaa;
 transition:transform .13s ease,box-shadow .13s ease;
}
#game .r4-plate-exhibit .r4-rainbow-face{
 display:flex;
 flex-direction:column;
 align-items:center;
 justify-content:center;
 width:100%;height:100%;
 box-sizing:border-box;
 gap:clamp(1px,.5cqh,6px);
 border:2px solid #ffebc96e;
 background:linear-gradient(125deg,#ffffff42,#ffffff00 42%,#05050524 85%),var(--plate-color,#777);
 box-shadow:inset 2px 2px 0 #ffffff32,inset -3px -3px 0 #0808093b;
 pointer-events:none;
}
#game .r4-plate-exhibit .r4-rainbow-letter{
 font:800 clamp(25px,4.5cqw,53px)/1 "DotGothic16",sans-serif;
 color:#fffdf2;
 text-shadow:2px 2px 0 #212121b8,0 0 2px #121212;
}
#game .r4-plate-exhibit .r4-rainbow-color{
 font:normal clamp(12px,1.65cqw,19px)/1.1 "DotGothic16",sans-serif;
 color:#fffdf2;text-shadow:1px 1px 0 #1b1a1a9e;
}
#game .r4-plate-exhibit .r4-rainbow-plate.is-selected,
#game .r4-plate-exhibit .r4-rainbow-plate:focus-visible{
 transform:translateY(-9px);
 border-color:#fff1c4!important;
 outline:2px solid #fff1c4!important;
 outline-offset:2px;
 box-shadow:0 8px 0 #111820,0 0 10px #f6dfac75;
}
#game .r4-plate-exhibit .r4-rainbow-plate.is-dragging{
 z-index:10;
 transform:translate(var(--drag-x,0px),var(--drag-y,0px)) scale(1.055);
 pointer-events:none;
 cursor:grabbing;
 box-shadow:0 11px 20px #060e14c7,0 0 12px #e8d5a57d;
 transition:none;
}
#game .r4-plate-exhibit .r4-plate-status{
 flex:0 0 auto;
 min-height:0!important;
 margin:0!important;
 padding:0!important;
 font-size:0!important;
 line-height:0!important;
 color:transparent!important;
}
@container game-viewport (max-width:880px) or (max-height:465px){
 #game .r4-plate-overlay .r4-mini.r4-plate-exhibit{
  padding:clamp(10px,1.45cqw,15px)!important;
  gap:clamp(5px,1.2cqh,9px);
 }
 #game .r4-plate-exhibit .r4-plate-exhibit-header h2{
  font-size:clamp(17px,2.2cqw,23px);
 }
 #game .r4-plate-exhibit .r4-plate-rail{
  padding:clamp(8px,1.2cqw,13px);
 }
 #game .r4-plate-exhibit .r4-rainbow{
  height:clamp(82px,26cqh,120px);
  gap:clamp(2px,.55cqw,5px)!important;
 }
 #game .r4-plate-exhibit .r4-rainbow-plate{
  padding:clamp(2px,.45cqw,5px)!important;
  border-width:2px!important;
 }
 #game .r4-plate-exhibit .r4-rainbow-letter{font-size:clamp(24px,4.35cqw,39px)}
 #game .r4-plate-exhibit .r4-rainbow-color{font-size:clamp(11px,1.65cqw,14px)}
}
@media (prefers-reduced-motion:reduce){
 #game .r4-plate-exhibit .r4-rainbow-plate{transition:none!important}
}


/* Room 04: the completed rainbow remains in view before the panel is awarded.
   Settles for 750ms, then a warm sweep lights each real plate. */
#game .r4-plate-overlay.is-solved .r4-rainbow-plate{
 cursor:default;
}
#game .r4-plate-overlay.is-solved .r4-rainbow-plate.is-selected{
 transform:none;
}
#game .r4-plate-overlay.is-revealing .r4-plate-rail{
 border-color:#f6db9c;
 box-shadow:inset 0 8px 10px #0b0b0a8c,inset 0 -7px 8px #170e0b8c,
  0 0 12px #ffe5a478,0 0 28px #fff0bd33;
}
#game .r4-plate-overlay.is-revealing .r4-rainbow-plate{
 border-color:#fff1c5!important;
 box-shadow:inset 0 0 0 2px #f5e0b9a3,0 3px 1px #100e0eaa,0 0 15px #ffdea186;
 animation:r4RainbowGlint .75s ease-in-out both;
}
#game .r4-plate-overlay.is-revealing .r4-rainbow-plate:nth-child(2){animation-delay:.12s}
#game .r4-plate-overlay.is-revealing .r4-rainbow-plate:nth-child(3){animation-delay:.24s}
#game .r4-plate-overlay.is-revealing .r4-rainbow-plate:nth-child(4){animation-delay:.36s}
#game .r4-plate-overlay.is-revealing .r4-rainbow-plate:nth-child(5){animation-delay:.48s}
#game .r4-plate-overlay.is-revealing .r4-rainbow-plate:nth-child(6){animation-delay:.60s}
#game .r4-plate-overlay.is-revealing .r4-rainbow-plate:nth-child(7){animation-delay:.72s}
@keyframes r4RainbowGlint{
 0%{filter:brightness(1);transform:translateY(0)}
 45%{filter:brightness(1.48);transform:translateY(-5px)}
 100%{filter:brightness(1.1);transform:translateY(0)}
}
@media(prefers-reduced-motion:reduce){
 #game .r4-plate-overlay.is-revealing .r4-rainbow-plate{
  animation:none!important;
  filter:brightness(1.15);
 }
}


/* Fourth room: the color of each metal-glass plate speaks for itself.
   The letter is heavier and dominates the face on small displays too. */
#game .r4-plate-exhibit .r4-rainbow-letter{
 font-size:clamp(35px,5.5cqw,66px)!important;
 font-weight:900!important;
 -webkit-text-stroke:1.1px #fffdf2;
 paint-order:stroke fill;
 letter-spacing:.015em;
 line-height:1.05;
}
#game .r4-plate-exhibit .r4-rainbow-color{display:none!important}

/* Collected glass pane: the real star-bearing, transparent sprite fills the
   item reveal instead of the former text diamond / acquisition count. */
#game .design-panel.design-pickup-panel{
 width:min(600px,90%)!important;
 height:min(480px,94%)!important;
 min-height:0;
 max-height:94%;
}
#game .design-pickup-panel .design-content{
 align-items:center;
 justify-content:center;
 gap:clamp(4px,.9cqw,10px);
 text-align:center;
}
#game .design-pickup-panel .design-pickup-image{
 display:block;
 flex:1 1 auto;
 min-height:0;
 height:min(280px,49cqh);
 max-height:min(300px,51cqh);
 width:min(300px,55cqw);
 max-width:96%;
 aspect-ratio:1;
 object-fit:contain;
 box-sizing:border-box;
 padding:clamp(8px,1.6cqw,16px);
 border:3px solid #8a9eab;
 background:radial-gradient(circle at 50% 35%,#2e4b5e,#0b2134);
 box-shadow:inset 0 0 0 3px #d7dfdf57,0 3px 10px #2434415c;
 image-rendering:auto;
}
#game .design-pickup-panel .design-content>p{
 flex:0 0 auto;
 text-align:center;
 line-height:1.35;
}
#game .design-pickup-panel .design-content>button{
 flex:0 0 auto;
 min-width:140px;
}
@container game-viewport (max-height:460px){
 #game .r4-plate-exhibit .r4-rainbow-letter{
  font-size:clamp(29px,5.25cqw,47px)!important;
  -webkit-text-stroke:1px #fffdf2;
 }
 #game .design-panel.design-pickup-panel{height:95%!important;padding:1%!important}
 #game .design-pickup-panel .design-content{gap:4px}
 #game .design-pickup-panel .design-pickup-image{
  height:min(170px,37cqh);max-height:39cqh;
  width:min(190px,33cqw);padding:7px;
 }
}


/* Cleared fourth-room exhibits remain inspectable without looking interactive. */
#game .r4-mini.r4-mini-inspected .r4-solved-answer{
 display:grid;
 place-items:center;
 width:min(310px,82%);
 min-height:clamp(66px,12cqh,100px);
 box-sizing:border-box;
 margin:clamp(10px,2cqh,20px) auto 0;
 padding:clamp(8px,1.25cqw,16px);
 color:#e9d5a9;
 background:linear-gradient(150deg,#304651,#162936);
 border:3px solid #957b56;
 box-shadow:inset 0 0 0 3px #182a33,0 4px 0 #76634448;
}
#game .r4-mini.r4-mini-inspected .r4-solved-answer span{
 font:900 clamp(26px,4.1cqw,48px)/1.2 "DotGothic16",sans-serif;
 color:#fff7dd;
 letter-spacing:.17em;
 text-shadow:0 0 8px #ffefbf7d;
}
#game .r4-plate-overlay.is-inspection .r4-rainbow-plate:disabled,
#game .r4-plate-overlay.is-solved .r4-rainbow-plate:disabled{
 opacity:1!important;
 cursor:default!important;
}
#game .r4-plate-overlay.is-inspection .r4-rainbow-plate:disabled:focus-visible{
 outline:none!important;
 transform:none!important;
}
@container game-viewport (max-height:465px){
 #game .r4-mini.r4-mini-inspected .r4-solved-answer{
  min-height:clamp(47px,13cqh,60px);
  margin:5px auto 0;
  padding:5px;
 }
 #game .r4-mini.r4-mini-inspected .r4-solved-answer span{
  font-size:clamp(22px,3.7cqw,32px);
 }
}


/* Room 04, mini puzzle 1: four real colored enamel specimens in an exhibition case.
   The 1/4/3/2 order and answer STAR are unchanged; no written color names. */
#game .r4-mini.r4-color-exhibit{
 box-sizing:border-box;
 width:min(820px,94%)!important;
 max-height:94%!important;
 min-height:0;
 overflow:hidden!important;
 display:grid;
 grid-template-columns:minmax(0,1fr) auto;
 grid-template-rows:auto auto auto auto;
 align-content:center;
 gap:clamp(8px,1.65cqh,16px) clamp(9px,1.7cqw,20px);
 padding:clamp(16px,2.2cqw,30px)!important;
 background:linear-gradient(130deg,#2c4150 0%,#142935 55%,#293b49 100%)!important;
 color:#f6ead1!important;
 border:clamp(4px,.65cqw,7px) solid #8b714d!important;
 box-shadow:inset 0 0 0 3px #bd9e71,inset 0 0 0 7px #112333,0 12px 38px #050c13bd!important;
 border-radius:3px!important;
}
#game .r4-mini.r4-color-exhibit>h2{
 grid-column:1/-1;
 justify-self:center;
 text-align:center;
 padding-right:0;
 margin:0!important;
 font:normal clamp(18px,2.25cqw,28px)/1.3 "DotGothic16",sans-serif;
 letter-spacing:.13em;
 color:#ebd7aa!important;
}
#game .r4-mini.r4-color-exhibit .device-close{
 position:absolute;
 right:clamp(8px,1.1cqw,16px);
 top:clamp(8px,1.1cqw,16px);
 min-height:34px;
 min-width:38px;
 z-index:2;
 background:#182c37!important;
 color:#f1e2c1!important;
 border:1px solid #967c53!important;
}
#game .r4-mini.r4-color-exhibit .r4-color-samples{
 grid-column:1/-1;
 position:relative;
 box-sizing:border-box;
 display:grid;
 grid-template-columns:repeat(4,minmax(0,1fr));
 gap:clamp(6px,1.5cqw,16px);
 width:100%;
 height:clamp(120px,30cqh,190px);
 max-height:100%;
 min-height:0;
 padding:clamp(10px,1.4cqw,17px);
 background:linear-gradient(100deg,#2d2622,#6b523c 5%,#46392d 17%,#55412f 82%,#806244 95%,#2c241f);
 border:3px solid #a78b62;
 outline:2px solid #111f28;
 box-shadow:inset 0 7px 8px #13110db8,inset 0 -7px 8px #1b130fba,0 4px 0 #17202a;
}
#game .r4-mini.r4-color-exhibit .r4-color-plaque{
 display:grid;place-items:center;
 position:relative;
 min-width:0;
 width:100%;height:100%;
 box-sizing:border-box;
 padding:clamp(4px,.9cqw,10px);
 border:3px solid #e2cca2;
 border-radius:3px;
 box-shadow:inset 0 0 0 3px #67573d,0 4px 1px #160f0aa6;
}
#game .r4-mini.r4-color-exhibit .r4-color-plaque::before{
 content:"";
 position:absolute;
 inset:clamp(4px,.85cqw,9px);
 border:2px solid #ffffff47;
 box-shadow:inset 0 2px 0 #ffffff2b,inset 0 -3px 0 #00000018;
 pointer-events:none;
}
#game .r4-mini.r4-color-exhibit .r4-color-plaque.silver{
 background:linear-gradient(115deg,#c7d2d3 0%,#ecf1ec 23%,#80949b 43%,#bbc9cc 62%,#647e87 82%,#d4e0da 100%);
 color:#17262b;
}
#game .r4-mini.r4-color-exhibit .r4-color-plaque.white{
 background:linear-gradient(135deg,#fffefa,#efeadd 65%,#d2c9b4 100%);
 color:#263039;
}
#game .r4-mini.r4-color-exhibit .r4-color-plaque.black{
 background:linear-gradient(135deg,#3a464e,#151b23 64%,#313e43);
 color:#fff5db;
}
#game .r4-mini.r4-color-exhibit .r4-color-plaque.green{
 background:linear-gradient(145deg,#729883,#376751 64%,#668775);
 color:#fff5df;
}
#game .r4-mini.r4-color-exhibit .r4-color-plaque b{
 display:block;
 position:relative;
 z-index:1;
 font:900 clamp(40px,6.3cqw,70px)/1 "DotGothic16",sans-serif;
 -webkit-text-stroke:.7px currentColor;
 letter-spacing:0;
 text-shadow:1px 2px 0 #00000035;
}
#game .r4-mini.r4-color-exhibit label{
 grid-column:1;
 display:flex;
 align-items:center;
 gap:clamp(8px,1.2cqw,16px);
 min-width:0;
 margin:0!important;
 color:#f1dfbc;
 font:normal clamp(13px,1.65cqw,18px)/1.2 "DotGothic16",sans-serif;
}
#game .r4-mini.r4-color-exhibit label input{
 box-sizing:border-box;
 flex:1;
 min-width:0;
 height:clamp(41px,7.2cqh,59px);
 margin:0;
 padding:5px 14px!important;
 border:2px solid #bea478!important;
 border-radius:2px!important;
 background:linear-gradient(#08151e,#142631)!important;
 color:#fff7dd!important;
 outline-offset:2px;
 font:900 clamp(21px,3.35cqw,34px)/1 "DotGothic16",sans-serif;
 letter-spacing:.22em;
 text-align:center;
 text-transform:uppercase;
}
#game .r4-mini.r4-color-exhibit label input::placeholder{
 color:#9da49a;
 opacity:.8;
 letter-spacing:.12em;
}
#game .r4-mini.r4-color-exhibit .r4-answer{
 grid-column:2;
 min-height:clamp(41px,7.2cqh,59px);
 min-width:clamp(72px,11cqw,115px);
 margin:0;
 padding:5px 15px!important;
 background:linear-gradient(#d9bf87,#a48152)!important;
 color:#1d2830!important;
 border:2px solid #e8d3a5!important;
 border-radius:3px!important;
 font:900 clamp(15px,2cqw,22px)/1.2 "DotGothic16",sans-serif!important;
 box-shadow:inset 0 2px 0 #ffffff5c,0 3px 0 #4b3b29;
}
#game .r4-mini.r4-color-exhibit .r4-feedback{
 grid-column:1/-1;
 margin:0!important;
 padding:0!important;
 min-height:1.3em;
 text-align:center;
 color:#f6caab!important;
 font-size:clamp(11px,1.35cqw,15px);
}
#game .r4-mini.r4-color-exhibit .r4-solved-answer{
 grid-column:1/-1;
 min-height:clamp(51px,8.3cqh,75px);
 margin:0 auto!important;
 border-color:#b79a63!important;
}
#game .r4-mini.r4-color-exhibit .r4-solved-answer span{
 font-weight:900!important;
 font-size:clamp(24px,3.8cqw,44px)!important;
}
@container game-viewport (max-height:465px) or (max-width:850px){
 #game .r4-mini.r4-color-exhibit{
  padding:clamp(11px,1.6cqw,18px)!important;
  gap:clamp(6px,1.4cqh,10px) clamp(6px,1.2cqw,10px);
 }
 #game .r4-mini.r4-color-exhibit .r4-color-samples{
  height:clamp(104px,29cqh,145px);
  padding:clamp(7px,1.1cqw,12px);
  gap:clamp(4px,.9cqw,8px);
 }
 #game .r4-mini.r4-color-exhibit .r4-color-plaque{border-width:2px}
 #game .r4-mini.r4-color-exhibit .r4-color-plaque b{font-size:clamp(35px,5.5cqw,53px)}
 #game .r4-mini.r4-color-exhibit label{font-size:clamp(12px,1.55cqw,15px)}
 #game .r4-mini.r4-color-exhibit label input{
  height:clamp(35px,8cqh,45px);
  font-size:clamp(19px,3.15cqw,29px);
  letter-spacing:.15em;
 }
 #game .r4-mini.r4-color-exhibit .r4-answer{
  min-height:clamp(35px,8cqh,45px);
  min-width:clamp(65px,10cqw,90px);
  font-size:clamp(14px,1.65cqw,17px)!important;
 }
}


/* Room 04, mini puzzle 2: equal-sized color specimens, with area percentages.
   Swatches never recreate flag geometry or stripe order. */
#game .r4-mini.r4-ratio-exhibit{width:min(880px,96%)!important;grid-template-rows:auto auto auto;padding-top:clamp(45px,8cqh,52px)!important}
#game .r4-mini.r4-ratio-exhibit.r4-mini-inspected{grid-template-rows:auto auto}
#game .r4-mini.r4-ratio-exhibit .r4-solved-answer{height:60px;min-height:0!important;padding:6px 18px!important;display:grid;place-items:center}
#game .r4-mini.r4-ratio-exhibit .r4-solved-answer span{line-height:1}
#game .r4-ratio-specimens{grid-column:1/-1;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:clamp(6px,1.1cqw,12px);padding:clamp(9px,1.4cqw,16px);border:2px solid #ae9062;background:#10212d;box-shadow:inset 0 3px 10px #0008}
#game .r4-ratio-specimen{min-width:0;padding:clamp(7px,1cqw,12px);border:1px solid #8f7955;background:#203642;display:flex;flex-direction:column;align-items:stretch;gap:clamp(8px,1.5cqh,13px)}
#game .r4-ratio-colors{display:flex;flex-direction:column;justify-content:center;gap:4px;height:170px;min-height:0}
#game .r4-ratio-sample{display:flex;align-items:center;justify-content:space-between;gap:clamp(3px,.65cqw,7px);white-space:nowrap}
#game .r4-ratio-sample i{flex:none;display:block;width:20px;height:20px;background:var(--sample-color);border:1px solid #d2c7a8;box-shadow:0 2px 0 #0a1822}
#game .r4-ratio-sample span{font:700 clamp(14px,1.8cqw,19px)/1.2 "DotGothic16",sans-serif;color:#fff4d9;letter-spacing:0}
#game .r4-ratio-digit{display:block;border-top:1px solid #8f7955;padding-top:clamp(6px,1cqh,10px);text-align:center;color:#f8e6ba;font:900 clamp(29px,4.2cqw,45px)/1 "DotGothic16",sans-serif;-webkit-text-stroke:.45px currentColor}
#game .r4-world-exhibit{position:relative;width:100%;height:100%;min-height:0;display:flex;flex-direction:column;gap:clamp(6px,1.3cqh,12px);background:#142935;color:#f6ead1;border:3px solid #ae9062;padding:clamp(12px,2cqw,24px);box-shadow:inset 0 0 0 2px #2d414c}
#game .r4-world-exhibit header{display:flex;align-items:center;justify-content:flex-end;flex:none}
#game .r4-world-exhibit h2{color:#ebd7aa;font:normal clamp(18px,2.5cqw,30px)/1.3 "DotGothic16",sans-serif;margin:0}
#game .r4-world-exhibit .device-close{position:static;background:#243d4a!important;color:#f6ead1!important;border:1px solid #ae9062!important}
#game .r4-world-intro{flex:none;font:normal clamp(11px,1.4cqw,16px)/1.5 "DotGothic16",sans-serif;color:#d5d7cd;margin:0}
#game .r4-world-countries{flex:1;min-height:0;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));gap:clamp(6px,1.2cqw,13px)}
#game .r4-world-country{display:flex;flex-direction:row;align-items:center;justify-content:center;gap:clamp(3px,.65cqh,7px);min-height:0;min-width:0;border:1px solid #6b7f82;background:#203642;padding:clamp(5px,1cqw,10px)}
#game .r4-moon-illustration{display:block;width:32%;height:auto;aspect-ratio:1;max-width:130px;min-height:0;flex-shrink:0;overflow:hidden;border-radius:50%}
#game .r4-moon-caption{display:flex;align-items:center;justify-content:flex-start;gap:clamp(5px,.8cqw,9px);flex:none;min-width:0;max-width:100%}
#game .r4-moon-caption .r4-reference-flag{height:18px;width:auto;max-width:31px;flex:none;filter:none}
#game .r4-reference-flag{display:block;width:auto;height:clamp(35px,10cqh,68px);max-width:85%;flex-shrink:1;min-height:0;filter:drop-shadow(0 2px 1px #0008)}
#game .r4-world-country strong{font:900 clamp(11px,1.55cqw,19px)/1.2 "DotGothic16",sans-serif;color:#fff4d9;letter-spacing:.06em;-webkit-text-stroke:.25px currentColor}
#game .r4-moon-copy{flex:1;min-width:0;display:flex;flex-direction:column;gap:clamp(3px,.7cqh,7px)}
#game .r4-moon-copy h3{margin:0;color:#ebd7aa;font:700 clamp(11px,1.45cqw,18px)/1.3 "DotGothic16",sans-serif;overflow-wrap:anywhere}
#game .r4-moon-copy p{margin:0;color:#e0ded0;font:normal clamp(10px,1.25cqw,15px)/1.6 "DotGothic16",sans-serif;overflow-wrap:anywhere}
#game .r4-world-exhibit header{justify-content:space-between}
#game .r4-moon-pages{display:flex;align-items:center;gap:clamp(9px,1.3cqw,16px)}
#game .r4-moon-pages button{background:#243d4a;color:#f6ead1;border:1px solid #ae9062;padding:5px 12px;font:inherit;cursor:pointer}
#game .r4-moon-pages button:disabled{opacity:.35;cursor:default}
#game .r4-moon-pages output{font:700 clamp(12px,1.5cqw,18px)/1.2 "DotGothic16",sans-serif;color:#ebd7aa}

#game .r4-world-note{flex:none;margin:0;color:#bcbcae;font:normal clamp(9px,1.1cqw,13px)/1.5 "DotGothic16",sans-serif}
@container game-viewport (max-height:465px) or (max-width:850px){
 #game .r4-ratio-specimens{padding:7px;gap:6px}
 #game .r4-ratio-specimen{padding:6px}
 #game .r4-ratio-colors{height:180px;min-height:0;gap:4px}
 #game .r4-ratio-sample i{width:20px;height:20px}
 #game .r4-ratio-sample span{font-size:clamp(12px,1.9cqw,17px)}
 #game .r4-ratio-digit{font-size:30px;padding-top:6px}
}

/* Room 04 — Virgo: touch the actual glass to rotate it.
   The accepted panes are unchanged; thin star connections are an overlay. */
#game .room4-stage .r4-projection{
 left:26%;top:15%;width:48%;height:44%;
}
#game .r4-projected-constellation{display:block;width:100%;height:100%;overflow:visible}
#game .r4-projected-lines line{
 stroke:#d6ecff;stroke-width:1.4;stroke-linecap:round;
 vector-effect:non-scaling-stroke;filter:drop-shadow(0 0 2px #8dcaff);
}
#game .r4-projected-star{fill:#fff7df;filter:drop-shadow(0 0 3px #dceaff)}
#game .r4-projection.complete .r4-projected-star[data-hip="65474"]{
 fill:#fff;filter:drop-shadow(0 0 7px #d9ecff);
}
#game .r4-panel-ui.r4-linked-puzzle{
 box-sizing:border-box!important;
 display:flex;
 flex-direction:column;
 justify-content:center;
 align-items:center;
 gap:clamp(5px,1cqh,10px);
 width:min(900px,96%)!important;
 height:min(590px,94%)!important;
 max-height:96%!important;
 padding:clamp(35px,4.4cqh,43px) clamp(12px,2cqw,25px) clamp(9px,1.4cqh,15px)!important;
 overflow:hidden!important;
}
#game .r4-linked-puzzle>.r4-panel-stack{
 position:relative;
 display:block;
 flex:0 1 auto;
 width:min(274px,36cqh,48cqw)!important;
 height:auto!important;
 aspect-ratio:1;
 margin:0 auto!important;
 min-width:0;
 min-height:0;
 padding:0!important;
 border:2px solid #9bb9ca77!important;
 border-radius:2px!important;
 background:radial-gradient(circle at 50% 45%,#24445966,#0b2039bb)!important;
 cursor:pointer;
 opacity:1!important;
 box-shadow:inset 0 0 0 3px #192e40,0 3px 12px #050d1570;
}
#game .r4-linked-puzzle>.r4-panel-stack:disabled{
 cursor:default!important;
 opacity:1!important;
}
#game .r4-linked-puzzle>.device-close{color:#172c3b!important}
#game .r4-linked-puzzle>.r4-panel-stack.can-turn-all{
 border-color:#f1d99b!important;
 box-shadow:0 0 9px #f7dfa34f,inset 0 0 0 2px #eed9a444!important;
}
#game .r4-linked-puzzle>.r4-panel-stack.can-turn-all::after{
 content:"↻";
 position:absolute;
 right:4%;bottom:4%;
 z-index:3;
 display:grid;
 place-items:center;
 width:clamp(23px,3cqw,30px);
 height:clamp(23px,3cqw,30px);
 font:bold clamp(17px,2.4cqw,25px)/1 sans-serif;
 color:#1c3546;
 background:#edddb5e6;
 border:1px solid #9e8760;
 border-radius:50%;
}
#game .r4-linked-puzzle>.r4-panel-stack img{
 position:absolute;
 inset:0;
 width:100%;height:100%;
 z-index:2;
 pointer-events:none;
 user-select:none;
 transform-origin:50% 50%;
 transition:transform .25s ease;
}
#game .r4-linked-puzzle>.r4-panel-stack img[hidden]{display:none}
#game .r4-linked-puzzle>.r4-panel-stack .r4-constellation-lines{
 position:absolute;
 inset:0;
 display:block;
 width:100%;
 height:100%;
 z-index:1;
 overflow:visible;
 pointer-events:none;
}
#game .r4-linked-puzzle .r4-constellation-edge{
 fill:none;
 stroke:#bfeaff;
 stroke-width:3.7;
 stroke-linecap:round;
 opacity:0;
 filter:drop-shadow(0 0 2px #86ceff);
 transform-origin:50% 50%;
 transform-box:view-box;
 transition:transform .25s ease,opacity .2s ease;
}
#game .r4-linked-puzzle .r4-constellation-edge.is-visible{opacity:.97}
#game .r4-linked-puzzle>.r4-panels{
 flex:0 0 auto;
 display:grid!important;
 grid-template-columns:repeat(5,minmax(0,1fr))!important;
 gap:clamp(6px,1.2cqw,12px)!important;
 width:min(620px,94%)!important;
 max-width:100%!important;
 margin:0 auto!important;
 align-items:center;
}
#game .r4-linked-puzzle>.r4-panels article{
 display:grid!important;
 place-items:center;
 background:none!important;
 border:0!important;
 padding:0!important;
 min-width:0;
}
#game .r4-linked-puzzle>.r4-panels .r4-rotate-plate{
 box-sizing:border-box;
 position:relative;
 display:block;
 width:min(96px,100%)!important;
 height:auto!important;
 min-height:0!important;
 min-width:0!important;
 aspect-ratio:1;
 margin:0!important;
 padding:3px!important;
 border:2px solid #84aabb!important;
 border-radius:2px!important;
 background:#163247b8!important;
 cursor:pointer;
 box-shadow:inset 0 0 0 2px #37526666;
}
#game .r4-linked-puzzle>.r4-panels .r4-rotate-plate img{
 display:block;
 width:100%;height:100%;
 aspect-ratio:1;
 pointer-events:none;
 user-select:none;
 transform-origin:50% 50%;
 transition:transform .25s ease;
}
#game .r4-linked-puzzle>.r4-panels .r4-rotate-plate:disabled{
 opacity:.38;cursor:default;border-style:dashed!important;box-shadow:none;
}
#game .r4-linked-puzzle>.r4-panels .r4-rotate-plate:disabled::before{
 content:"";position:absolute;inset:14%;border:1px solid #84aabb55;
}
#game .r4-linked-puzzle>.r4-panels .r4-rotate-plate:not(:disabled)::after{
 content:"＋";position:absolute;right:4%;bottom:4%;
 display:grid;place-items:center;width:21px;height:21px;
 color:#e9f2f7;background:#102438e6;border-radius:50%;font:bold 17px/1 sans-serif;
 pointer-events:none;
}
#game .r4-linked-puzzle>.r4-panels .r4-rotate-plate.is-mounted{
 border-color:#e5cc91!important;
}
#game .r4-linked-puzzle>.r4-panels .r4-rotate-plate.is-mounted::after{content:"↻"}
#game .r4-linked-puzzle>.r4-panels .r4-rotate-plate:hover,
#game .r4-linked-puzzle>.r4-panels .r4-rotate-plate:focus-visible{
 border-color:#f4dfb3!important;
 box-shadow:0 0 8px #f4dfb34d;
}
#game .r4-linked-puzzle>.r4-feedback{
 flex:0 0 auto;
 min-height:1.3em!important;
 margin:0!important;
 padding:0!important;
 font-size:clamp(11px,1.4cqw,15px);
 text-align:center;
}
#game .r4-linked-puzzle>.r4-shine{
 flex:0 0 auto;
 min-height:clamp(39px,6cqh,47px)!important;
 margin:0 auto!important;
 padding:6px 22px!important;
}
@container game-viewport (max-height:470px){
 #game .r4-panel-ui.r4-linked-puzzle{
  height:95%!important;
  padding:28px 10px 7px!important;
  gap:3px;
 }
 #game .r4-linked-puzzle>.r4-panel-stack{
  width:min(175px,43cqh,45cqw)!important;
  border-width:1px!important;
 }
 #game .r4-linked-puzzle>.r4-panels{
  width:min(470px,98%)!important;
  gap:5px!important;
 }
 #game .r4-linked-puzzle>.r4-panels .r4-rotate-plate{
  width:min(68px,100%)!important;
  min-width:0!important;
  padding:2px!important;
  border-width:1px!important;
 }
 #game .r4-linked-puzzle>.r4-feedback{font-size:11px}
 #game .r4-linked-puzzle>.r4-shine{min-height:35px!important;padding:3px 14px!important}
}
@media(prefers-reduced-motion:reduce){
 #game .r4-linked-puzzle>.r4-panel-stack img,
 #game .r4-linked-puzzle>.r4-panels .r4-rotate-plate img,
 #game .r4-linked-puzzle .r4-constellation-edge{
  transition:none!important;
 }
}


/* Room 04 must occupy the same 16:9 stage on first entry and saved re-entry.
   Intro/header grid padding otherwise reduces the actual cqw reference width.
   Keep width non-important so inline resize and mobile layout remain testable. */
#game .room-four .room-stage-wrap{
 position:absolute;
 inset:0;
 display:block;
 width:100%;
 height:100%;
 min-width:0;
 min-height:0;
 margin:0;
 padding:0;
}

/* Room 5: the user's black pen combinations live on a physical inlay board.
   Keep the entire work surface inside the uniformly scaled 960 x 540 game. */
#game .device-overlay.r5-board-overlay{padding:52px 38px 12px!important;display:grid;place-items:stretch;grid-template-rows:minmax(0,1fr);background:#201a14b8!important}
#game .r5-board-overlay .r5-handdrawn-panel{
 --r5-paper:#fff8e7;--r5-ink:#352d25;--r5-wood:#b67d4c;--r5-rim:#d0a472;--r5-hole:#73492f;--r5-glow:#fce2a3;
 position:relative;box-sizing:border-box;width:100%;height:100%;max-height:none;min-height:0;margin:0;padding:10px 18px 12px;
 display:grid;grid-template-rows:32px minmax(0,1fr) 76px 50px;gap:8px;overflow:visible;
 background:#f6efdf;color:var(--r5-ink);border:2px solid #a98a56;box-shadow:0 10px 32px #120d0a80;
}
#game .r5-handdrawn-panel .r5-board-header{display:flex;align-items:center;gap:8px;min-width:0}
#game .r5-handdrawn-panel .r5-problem{flex:1;padding:0;margin:0;border:0;background:none;text-align:left;font-size:15px;line-height:1.4;letter-spacing:.025em}
#game .r5-handdrawn-panel .r5-board-header button{position:static;flex:0 0 auto;min-width:32px;min-height:30px;height:30px;padding:2px 10px;font:inherit;font-size:13px!important;background:var(--r5-paper);border:1px solid #b99a6b;color:var(--r5-ink);cursor:pointer}
#game .r5-handdrawn-panel .r5-inlay-board{
 position:relative;justify-self:center;align-self:stretch;width:min(100%,640px);min-height:0;
 background:repeating-linear-gradient(1deg,#ffffff06 0 2px,#00000004 2px 4px,transparent 4px 22px),linear-gradient(90deg,#a87040,#bc8956 25%,#b47c49 70%,#9e673a);
 border:7px solid #825334;box-shadow:inset 0 0 0 2px #e1b887,inset 0 5px 0 #ffffff20,0 3px 0 #61402b;
}
#game .r5-handdrawn-panel .r5-counter-grid{display:grid;position:absolute;inset:0;grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));gap:10px 24px;margin:0;padding:10px 22px}
#game .r5-handdrawn-panel .r5-counter-slot{
 position:relative;inset:auto;transform:none;align-self:center;justify-self:center;display:grid;place-items:center;
 width:auto;height:100%;max-width:100%;aspect-ratio:1;min-width:0;min-height:0;overflow:hidden;
 padding:10px;border:5px solid var(--r5-rim);background:var(--r5-hole);
 box-shadow:inset 0 3px 7px 2px #23140db0,0 1px 0 #efc79a;color:#e0ba89;cursor:pointer;
}
#game .r5-board-overlay .r5-handdrawn-panel .r5-counter-grid .r5-counter-slot{border-radius:50%!important}
#game .r5-handdrawn-panel .r5-counter-slot>svg{display:block;width:68%;height:68%;stroke:currentColor;pointer-events:none}
#game .r5-handdrawn-panel .r5-counter-slot.filled,#game .r5-handdrawn-panel .r5-counter-slot.is-preview{background:var(--r5-paper);padding:7px;box-shadow:inset 0 0 0 1px #87613c,0 2px 0 #67412c;color:var(--r5-ink);opacity:1}
#game .r5-handdrawn-panel .r5-counter-slot.filled:not(:disabled){cursor:pointer}
#game .r5-handdrawn-panel .r5-counter-slot.filled:disabled{cursor:default}
#game .r5-handdrawn-panel .r5-counter-slot.filled:not(:disabled):is(:hover,:focus-visible){outline:3px solid var(--r5-glow);outline-offset:1px}
#game .r5-handdrawn-panel .r5-counter-slot.is-preview{border-color:#cfaa79}
#game .r5-handdrawn-panel .r5-combination-picture{width:100%;height:100%;min-width:0;min-height:0;object-fit:contain;pointer-events:none;image-rendering:auto}
#game .r5-handdrawn-panel .r5-counter-slot.available:hover,#game .r5-handdrawn-panel .r5-counter-slot.is-over{outline:3px solid var(--r5-glow);outline-offset:1px;background:#855637}
#game .r5-handdrawn-panel .r5-counter-grid.has-selection .r5-counter-slot:not(:disabled){border-color:#e1b77c}
#game .r5-handdrawn-panel .r5-inventory{display:grid;grid-template-columns:repeat(7,68px);justify-content:center;align-items:center;gap:12px;min-height:0;margin:0;padding:3px 8px;border:0;border-bottom:2px solid #bb9c72;background:linear-gradient(transparent,#d9c7a366)}
#game .r5-handdrawn-panel .r5-inventory-tile,#game .r5-handdrawn-panel .r5-tile-rest{position:relative;box-sizing:border-box;display:block;width:68px;height:68px;min-width:0;min-height:0;margin:0;padding:3px;touch-action:none;border:1px solid #997b55;background:#fff8e8;box-shadow:0 3px 0 #947249;color:var(--r5-ink);cursor:grab}
#game .r5-handdrawn-panel .r5-inventory-tile img{position:static;display:block;width:100%;height:100%;object-fit:contain;pointer-events:none}
#game .r5-board-overlay .r5-handdrawn-panel button.r5-inventory-tile{touch-action:none;user-select:none;-webkit-user-select:none}
#game .r5-handdrawn-panel .r5-inventory-tile.selected{outline:3px solid #8e6133;outline-offset:2px;transform:translateY(-3px);background:#ffe6b6}
#game .r5-handdrawn-panel .r5-inventory-tile.is-dragging{opacity:.3}
#game .r5-handdrawn-panel .r5-tile-rest{background:#d5c5a84d;border:1px dashed #c5b18e;box-shadow:none;cursor:default}
#game .r5-handdrawn-panel .r5-tile-rest.is-used{border-style:solid;background:#cab49330}
#game .r5-handdrawn-panel .r5-drag-ghost{position:absolute;width:68px;height:68px;padding:0;border:0;background:var(--r5-paper);transform:translate(-50%,-50%);box-shadow:0 6px 12px #37231266;pointer-events:none;z-index:8}
#game .r5-handdrawn-panel .r5-drag-ghost img{width:100%;height:100%;object-fit:contain;pointer-events:none}
#game .r5-handdrawn-panel .r5-board-feedback{box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;gap:3px;min-height:0;margin:0;padding:4px 16px;text-align:left;background:#293d43;border:1px solid #bd9c5c;color:#fff7de;font-size:14px;line-height:1.35;overflow:auto}
#game .r5-handdrawn-panel .r5-board-feedback:empty{background:#e8dfcc;border-color:#c9b68f}
#game .r5-handdrawn-panel .r5-board-feedback p{margin:0;font-size:inherit;line-height:inherit}
#game .r5-handdrawn-panel .r5-board-feedback b{display:inline-block;min-width:4em;margin-right:14px;color:#e6c78b;font-weight:400}
#game .r5-handdrawn-panel .r5-help-note{position:absolute;z-index:10;top:47px;right:16px;max-width:440px;padding:16px;background:#fff8e8;border:2px solid #a98a56;box-shadow:0 6px 15px #261b1255;font-size:14px;line-height:1.8}
#game .r5-handdrawn-panel .r5-help-note[hidden],#game .r5-handdrawn-panel .r5-inlay-code[hidden]{display:none}
#game .r5-handdrawn-panel .r5-inlay-code{position:absolute;inset:50% 28% auto;transform:translateY(-50%);z-index:2;background:#302a24;border:2px solid #d8b56f;box-shadow:0 0 12px #ffdf9380;color:#fff0b3;text-align:center;font:700 25px/1.15 'DotGothic16',monospace;letter-spacing:.3em;padding:2px 0 2px .3em;pointer-events:none}
/* Full completion only: readable narration floats over the completed wooden board. */
#game .r5-handdrawn-panel .r5-completion-caption{
 position:absolute;z-index:6;left:16px;right:16px;bottom:12px;
 box-sizing:border-box;min-height:54px;max-height:112px;overflow:auto;
 display:flex;flex-direction:column;justify-content:center;gap:5px;
 padding:9px 15px;border:2px solid #dbb978;
 background:#263439ef;box-shadow:0 4px 18px #20120fc9;
 color:#fff5dc;font-size:16px;line-height:1.45;text-align:center;
 pointer-events:none;
}
#game .r5-handdrawn-panel .r5-completion-caption p{margin:0}
#game .r5-handdrawn-panel .r5-completion-caption b{margin-right:12px;color:#f7d9a4;font-weight:600}
#game .r5-handdrawn-panel.r5-completing .r5-counter-slot.filled{
 animation:r5-complete-glow 1.6s ease-in-out infinite;
}
@keyframes r5-complete-glow{
 0%,100%{filter:brightness(1);box-shadow:inset 0 0 0 1px #87613c,0 2px 0 #67412c}
 50%{filter:brightness(1.12);box-shadow:inset 0 0 0 1px #c7953e,0 0 18px #ffdc8f}
}
@media (prefers-reduced-motion:reduce){
 #game .r5-handdrawn-panel.r5-completing .r5-counter-slot.filled{animation:none}
}
#game .r5-handdrawn-panel button:focus-visible{outline:3px solid #f5d68a;outline-offset:2px}
#game .r5-handdrawn-panel .r5-inventory-tile:focus-visible{outline-color:#694521}
/* The small wall board shows the same handwritten combinations, also after load. */
#game .r5-board-wall-grid,#game .r5-board-wall-grid.is-complete{background:none;gap:3px;padding:2px;box-sizing:border-box;pointer-events:none}
#game .r5-board-wall-grid>.r5-wall-tile,#game .r5-board-wall-grid.is-complete>.r5-wall-tile{visibility:inherit;border-radius:50%;border:2px solid #b58e5d;background:#70492e;color:#dfb789;box-shadow:inset 0 2px 3px #2b170c88}
#game .r5-board-wall-grid>.r5-wall-tile.is-placed,#game .r5-board-wall-grid>.r5-wall-tile.fixed{background:#fff5df}
#game .r5-board-wall-grid>.r5-wall-tile img{width:90%;height:90%;image-rendering:auto}
#game .r5-board-wall-grid>.r5-wall-tile svg{width:62%;height:62%}
@media(prefers-reduced-motion:no-preference){
 #game .r5-handdrawn-panel .r5-inventory-tile{transition:transform .15s ease,outline-color .15s ease}
 #game .r5-handdrawn-panel .r5-combination-picture{animation:r5-ink-appear .24s ease-out}
 @keyframes r5-ink-appear{from{opacity:.25;transform:scale(.9)}to{opacity:1;transform:scale(1)}}
}
/* Room 5 memories: the heroine belongs to the dialogue window, leaving the
   room and the drawing on the table unobstructed. Original art is unchanged. */
#game .room-dialog{--memory-portrait-gutter:260px}
#game .room-dialog .memory-window-portrait{position:absolute;left:2px;bottom:0;width:270px;height:285px;overflow:hidden;pointer-events:none;z-index:2}
#game .room-dialog .memory-window-portrait[hidden]{display:none}
#game .room-dialog .memory-window-portrait .memory-girl{position:static;display:block;width:100%;height:auto;max-width:none;transform:none;clip-path:none;object-fit:contain;image-rendering:auto}
#game .room-dialog.has-memory-portrait .dialog-message-area{margin-left:var(--memory-portrait-gutter)}
#game .room-dialog.has-memory-portrait{overflow:visible}
#game .room-dialog.is-log-open .memory-window-portrait{display:none}
#game .room-dialog.dialog-hidden .memory-window-portrait{visibility:visible}
#game .memory-scene[data-presentation=dialogue][data-layout=dining]{background:#b38964}
#game .memory-scene[data-presentation=dialogue][data-layout=dining] .memory-background{transform:translateY(-20%)}
#game .memory-scene[data-presentation=dialogue][data-layout=dining] .memory-prop{left:36%;top:54%;width:28%;height:17%}
#game .memory-scene[data-presentation=dialogue] .memory-prop[data-kind=rabbit]{background:transparent;transform:none;box-shadow:none}
#game .memory-scene[data-presentation=dialogue] .memory-prop[data-kind=cards]{left:35%;width:30%;gap:3px;align-items:center}


/* Room 7: a selected zodiac is applied by touching the actual door.
   A correct intermediate answer shows one brief open-and-close reaction. */
#game .r7-door-reveal{position:absolute;left:35.4%;top:4.1%;width:28.5%;height:75.2%;pointer-events:none;z-index:4;overflow:visible;opacity:0}
#game .r7-door-reveal::before{content:"";position:absolute;inset:4% 28%;background:linear-gradient(90deg,#ead7a2,#fff9e8 50%,#a6b9c9);box-shadow:0 0 18px 8px #fff1ad99;transform:scaleX(.01);opacity:0;transform-origin:center}
#game .r7-scene.is-door-opening .r7-door-reveal{opacity:1}
#game .r7-scene.is-door-opening .r7-door-reveal::before{animation:r7-door-peek 1.1s ease-in-out both}
@keyframes r7-door-peek{0%,100%{transform:scaleX(.01);opacity:0}28%,65%{transform:scaleX(.92);opacity:1}}
#game .r7-door-feedback{position:absolute;z-index:6;left:24%;width:52%;bottom:3%;margin:0;padding:5px 8px;text-align:center;color:#f8ebd2;background:#20180bde;border:1px solid #e3c9889e;font-size:clamp(11px,1.5cqw,18px);pointer-events:none;opacity:0}
#game .r7-scene.is-door-opening .r7-door-feedback{opacity:1}
#game .r7-dial-instruction{margin:0!important;text-align:center;font-size:clamp(12px,1.3cqw,18px)!important}
@media (prefers-reduced-motion:reduce){#game .r7-scene.is-door-opening .r7-door-reveal::before{animation:none;transform:scaleX(.8);opacity:.9}}


/* Issue #25 A04: keypad is a single-screen device, never a scrollable sheet.
   Keep all twelve keys, the readout, feedback and Close visible in 960x540. */
#game .device-overlay.late-overlay:has(.r5-keypad-panel){
  display:grid;
  place-items:center;
  box-sizing:border-box;
  padding:16px 24px;
}
#game .late-panel.r5-keypad-panel{
  box-sizing:border-box;
  position:relative;
  display:flex;
  flex-direction:column;
  width:min(390px,100%);
  height:min(456px,100%);
  max-height:100%;
  min-height:0;
  overflow:hidden!important;
  padding:46px 18px 13px!important;
  text-align:center;
}
#game .r5-keypad-panel>.device-close{
  position:absolute;
  top:7px;
  right:9px;
}
#game .r5-keypad-panel>h2{
  flex:0 0 auto;
  margin:0 36px 7px 0;
  padding:0;
  font-size:clamp(18px,2cqw,23px);
  line-height:1.25;
}
#game .r5-keypad-panel>.r5-keypad-display{
  flex:0 0 auto;
  display:grid;
  place-items:center;
  min-height:50px;
  margin:0 0 8px;
  padding:6px;
  font-size:30px;
  line-height:1.2;
  letter-spacing:.16em;
}
#game .r5-keypad-panel>.r5-keypad-grid{
  flex:1 1 auto;
  min-height:0;
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  grid-template-rows:repeat(4,minmax(0,1fr));
  gap:7px;
}
#game .r5-keypad-panel .r5-keypad-grid button{
  display:grid;
  place-items:center;
  min-width:0;
  min-height:0;
  width:100%;
  height:100%;
  padding:3px;
  border:1px solid var(--gold);
  background:#fffdf8;
  color:var(--ink);
  font:700 21px/1 "DotGothic16",sans-serif;
  touch-action:manipulation;
}
#game .r5-keypad-panel .r5-keypad-grid [data-key="enter"]{
  background:#59462c;
  color:#fff5df;
}
#game .r5-keypad-panel .r5-keypad-grid [data-key="clear"]{
  background:#eee6d5;
}
#game .r5-keypad-panel>#r5KeypadFeedback{
  flex:0 0 auto;
  display:grid;
  place-items:center;
  min-height:23px;
  margin:8px 0 0;
  color:#8f2727;
  font-size:14px;
  line-height:1.3;
}


/* Issue #25 A05: consistent passage across the eight rooms.
   Room 1 retains the hand-authored half-open door. Other rooms get a neutral
   light/dark passage instead of reusing art from the wrong room. */
#game .room-transition.room-transition-abstract{
  position:absolute;
  inset:0;
  z-index:90;
  overflow:hidden;
  display:grid;
  place-items:center;
  animation:roomPassageFade var(--room-passage-ms,650ms) ease-in-out both;
}
#game .room-transition-abstract.room-transition-dark{
  background:#17181a;
}
#game .room-transition-abstract.room-transition-light{
  background:#f3f1e9;
}
#game .room-transition-glow{
  display:block;
  width:100%;
  height:100%;
  background:radial-gradient(ellipse at center,#fff8e41c 0,transparent 68%);
  pointer-events:none;
}
#game .room-transition-light .room-transition-glow{
  background:radial-gradient(ellipse at center,#fff 0,#f7f6f1 50%,#eae7e0 100%);
}
#game .room-transition-illustrated{
  --room-passage-ms:2200ms;
  animation-duration:var(--room-passage-ms);
}
#game.room-entry-fade{
  animation:roomArrivalFromPassage 650ms ease-out both;
}
#game.room-entry-from-dark{
  animation:roomArrivalFromPassage 850ms ease-out both;
}
@keyframes roomPassageFade{
  0%{opacity:0}
  18%,76%{opacity:1}
  100%{opacity:0}
}
@keyframes roomArrivalFromPassage{
  0%{opacity:0}
  100%{opacity:1}
}
@media(prefers-reduced-motion:reduce){
  #game .room-transition.room-transition-abstract,
  #game.room-entry-fade,
  #game.room-entry-from-dark{animation:none!important}
}


/* Issue #25 A06: memory UI follows one dialogue layout in either presentation.
   Hide only exploration controls while the authored recollection is on screen:
   AUTO, SKIP, LOG, and hide/restore remain available in the dialogue window. */
#game[data-memory-stage] > .gameplay-hud,
#game[data-memory-stage] > .gameplay-bottom-bar,
#game[data-memory-stage] .explore-status{
  visibility:hidden!important;
  pointer-events:none!important;
}
#game .room-dialog-overlay[data-memory-stage] .room-dialog:not(.is-log-open){
  box-sizing:border-box;
  left:2.2%;
  bottom:2.5%;
  width:95.6%!important;
  height:25%;
}
/* Scene portraits and window portraits remain different by design.
   In dialogue-portrait scenes the same gutter is reserved for the text,
   and the log always uses the full width again. */
#game .room-dialog-overlay[data-memory-presentation="dialogue"] .room-dialog.has-memory-portrait:not(.is-log-open) .dialog-message-area{
  margin-left:var(--memory-portrait-gutter);
  min-width:0;
}
#game .room-dialog-overlay[data-memory-presentation="dialogue"] .room-dialog.is-log-open .dialog-message-area{
  margin-left:0;
}
#game .room-dialog-overlay[data-memory-presentation="dialogue"] .room-dialog .memory-window-portrait{
  pointer-events:none;
}


/* Issue #25 A07: make answers visually distinct from ordinary paper controls.
   The Room 2 HIT/BLOW answer remains a physical lever, with its own artwork. */
#game :is(
  .design-submit,
  .room1-piano-panel #playMelodyButton,
  .room3-answer-submit,
  .room3-final-submit,
  .r4-mini .r4-answer,
  .r8-puzzle #r8Submit,
  .r5-keypad-panel .r5-keypad-grid [data-key="enter"]
),
#game .r4-mini.r4-color-exhibit .r4-answer{
  background:linear-gradient(180deg,#ffe4ac 0%,#e8b95f 100%)!important;
  color:#312314!important;
  border:2px solid #88602d!important;
  box-shadow:inset 0 2px 0 #fff1cd,0 3px 0 #644622!important;
  text-shadow:none!important;
  font-weight:800!important;
  cursor:pointer;
}
#game :is(
  .design-submit,
  .room1-piano-panel #playMelodyButton,
  .room3-answer-submit,
  .room3-final-submit,
  .r4-mini .r4-answer,
  .r8-puzzle #r8Submit,
  .r5-keypad-panel .r5-keypad-grid [data-key="enter"]
):hover:not(:disabled),
#game .r4-mini.r4-color-exhibit .r4-answer:hover:not(:disabled){
  filter:brightness(1.045);
}
#game :is(
  .design-submit,
  .room1-piano-panel #playMelodyButton,
  .room3-answer-submit,
  .room3-final-submit,
  .r4-mini .r4-answer,
  .r8-puzzle #r8Submit,
  .r5-keypad-panel .r5-keypad-grid [data-key="enter"]
):focus-visible,
#game .r4-mini.r4-color-exhibit .r4-answer:focus-visible{
  outline:3px solid #246788!important;
  outline-offset:3px;
}
#game :is(
  .design-submit,
  .room1-piano-panel #playMelodyButton,
  .room3-answer-submit,
  .room3-final-submit,
  .r4-mini .r4-answer,
  .r8-puzzle #r8Submit,
  .r5-keypad-panel .r5-keypad-grid [data-key="enter"]
):disabled,
#game .r4-mini.r4-color-exhibit .r4-answer:disabled{
  opacity:.52;
  filter:grayscale(.45);
  cursor:not-allowed;
}

/* Issue #25 D06: Spica flash -> darkness -> first planetarium recollection.
   This veil covers both the room and dialogue, preventing visual pop-in. */
#game .r4-memory-bridge{
 position:absolute;
 inset:0;
 z-index:130;
 background:#fff;
 pointer-events:auto;
}
#game .r4-memory-bridge.is-white{
 animation:r4MemoryBloom 600ms ease-in both;
}
#game .r4-memory-bridge.is-dark{
 animation:r4MemoryNightfall 700ms ease-in-out both;
}
#game .r4-memory-bridge.is-revealing{
 background:#0a0a10;
 pointer-events:none;
 animation:r4MemoryReveal 380ms ease-out both;
}
@keyframes r4MemoryBloom{
 from{opacity:0}
 to{opacity:1}
}
@keyframes r4MemoryNightfall{
 from{background:#fff;opacity:1}
 to{background:#0a0a10;opacity:1}
}
@keyframes r4MemoryReveal{
 from{opacity:1}
 to{opacity:0}
}


/* Issue #25 E03: full-size counter panel reveal using the actual Room 5 art.
   Keep the hand-drawn paper look, not the star-glass frame from Room 4. */
#game .design-pickup-panel .design-pickup-image[src*="/room05/panels/"]{
  background:#faf6eb;
  border:3px solid #897459;
  border-radius:6px;
  padding:clamp(3px,.5cqw,7px);
  width:min(380px,66cqw);
  max-width:96%;
  height:min(325px,56cqh);
  max-height:58cqh;
  box-shadow:0 5px 15px #382c2340,inset 0 0 0 2px #dfd2bb;
  image-rendering:auto;
}
@container game-viewport (max-height:460px){
 #game .design-pickup-panel .design-pickup-image[src*="/room05/panels/"]{
   width:min(250px,48cqw);
   height:min(190px,46cqh);
   max-height:48cqh;
 }
}


/* Mobile landscape: keep memory-window character art outside the text lane.
   Size the portrait and its text reservation from the same game viewport. */
#game .room-dialog.has-memory-portrait{
  --memory-portrait-width:clamp(110px,22cqw,240px);
  --memory-portrait-gutter:calc(var(--memory-portrait-width) + 12px);
}
#game .room-dialog.has-memory-portrait .memory-window-portrait{
  width:var(--memory-portrait-width);
  max-width:calc(100% - 24px);
}
#game .room-dialog.has-memory-portrait:not(.is-log-open) .dialog-message-area{
  margin-left:var(--memory-portrait-gutter);
  min-width:0;
}
#game .room-dialog.is-log-open .dialog-message-area{
  margin-left:0;
}

/* Playthrough review: remove residual glass and labels; preserve accessible names. */
#game .room-dialog{backdrop-filter:none!important;-webkit-backdrop-filter:none!important;box-shadow:none!important}
#game .object>span,#game .late-object>span,#game .ambient-target>span{display:none!important}
#game:has(.memory-scene) .gameplay-objective,#game:has(.memory-scene) .gameplay-goal-row{display:none!important}
#game .title-cleared{background-position:center;background-size:cover}
/* After clearing, display the supplied handwritten ending title without atlas cropping. */
#game .title-cleared .title-logo{
  top:4%;
  width:min(900px,90%);
  aspect-ratio:1476/265;
  mix-blend-mode:screen;
}
#game .title-cleared .title-logo img{
  width:100%;
  height:100%;
  object-fit:contain;
  transform:none;
}

#game .room3-desk::after{top:15%!important;left:85%!important}
#game .r8-final-door{position:absolute;left:42%;top:8%;height:78%;width:24%;border:0;background:transparent url("images/background/room01/room01_door_closeup.png") center/contain no-repeat;font-size:0;color:transparent}
#game:has(.memory-scene) .memory-prop[data-kind="cards"]{display:none!important}


#game .r8-final-door{inset:0;width:100%;height:100%;background-image:url("images/background/room01/pixel/room01_front_fine.png");background-size:cover}
#game .r8-dissolve-fallback{display:none!important}

#game.has-world-expression #openingHanaSprite{animation:none!important}

/* Keep handwritten menu artwork over the cleared room. */
#game .title-cleared:not(.title-art-loading):not(.title-art-fallback){
 background-image:url("images/ui/title-cleared-background-v2.png?v=20261030-restored")!important;
 background-size:100% 100%!important;
}
#game .title-home #commentButton[data-afterword-ready]{--art-width:220%;--art-left:-40%;--art-y:-39%}

/* The title art stays uncluttered; contact details live behind a quiet footer control. */
#game .title-home .title-community{
 position:absolute;z-index:2;right:3%;bottom:5%;
}
#game .title-home .title-community-trigger{
 box-sizing:border-box;display:flex;align-items:center;justify-content:center;
 width:auto;min-width:182px;max-width:28cqw;height:44px;
 padding:7px 13px;margin:0;border:1px solid rgba(255,251,241,.24);
 border-radius:2px;background:rgba(9,16,26,.32);
 color:rgba(255,249,237,.77);font:clamp(12px,1.4cqw,16px)/1.4 "DotGothic16",sans-serif;
 letter-spacing:.05em;text-shadow:0 1px 3px #000;box-shadow:none;
 cursor:pointer;transition:color .15s,background .15s,border-color .15s;
}
#game .title-home .title-community-trigger:hover{
 background:rgba(9,16,26,.65);border-color:rgba(255,251,241,.65);color:#fff9ee;
}
#game .title-home .title-community-trigger:focus-visible{
 outline:2px solid #fff8e7;outline-offset:3px;
}
#game .title-home.title-cleared .title-community{bottom:18%}
#game .title-home .title-community-overlay[hidden]{display:none!important}
#game .title-home .title-community-overlay{
 position:absolute;inset:0;z-index:70;display:grid;place-items:center;
 padding:3%;box-sizing:border-box;background:rgba(6,10,17,.82);
}
#game .title-home .title-community-panel{
 position:relative;box-sizing:border-box;width:min(630px,88%);max-height:88%;
 overflow-y:auto;overscroll-behavior:contain;
 padding:clamp(28px,4cqw,48px) clamp(20px,4cqw,45px);
 border:2px solid rgba(237,220,184,.72);
 outline:3px solid rgba(4,8,14,.9);
 background:#101d28;color:#fbf5e9;
 box-shadow:0 10px 32px rgba(0,0,0,.4);
 text-align:center;font:clamp(13px,1.6cqw,19px)/1.7 "DotGothic16",sans-serif;
 text-shadow:0 1px 2px rgba(0,0,0,.5);
}
#game .title-home .title-community-panel h2{
 margin:0 40px 14px;font:clamp(17px,2.3cqw,27px)/1.4 "DotGothic16",sans-serif;
 color:#f8e6c4;
}
#game .title-home .title-community-panel p{margin:12px 0}
#game .title-home .title-community-panel .title-community-account{
 color:#f4dba6;text-decoration:underline;text-underline-offset:4px;
}
#game .title-home .title-community-panel strong{color:#f4dba6;font-weight:normal}
#game .title-home .title-community-panel :is(a,button):focus-visible{
 outline:2px solid #fff;outline-offset:3px;
}
#game .title-home .title-community-panel .title-community-close{
 position:absolute;right:8px;top:8px;display:grid;place-items:center;
 padding:0;margin:0;width:42px;height:42px;min-width:42px;
 border:1px solid rgba(250,234,209,.42);border-radius:2px;
 background:transparent;color:#fff2d6;cursor:pointer;
 font:28px/1 sans-serif;
}
@container game-viewport (max-height:490px){
 #game .title-home .title-community-panel{padding:22px 30px;max-height:90%}
 #game .title-home .title-community-panel p{margin:6px 0}
 #game .title-home .title-community-panel h2{margin-bottom:7px}
}
