/* Touch navigator. Shared actions, warm paper/bronze colours, cut panel edges. */
.mobile-control-deck{display:none}
@media(max-width:900px) and (orientation:portrait), (max-width:1100px) and (max-height:600px) and (orientation:landscape){
 .mobile-ds .mobile-ds-idle{--deck-ink:#4b3323;--deck-edge:#977346;--deck-paper:#f9edcc;gap:6px;padding:10px 12px;background:radial-gradient(ellipse at 50% 100%,#cfb58366,transparent 70%),repeating-linear-gradient(0deg,transparent 0 17px,#896a3d0c 18px),#ecdbaf;border:2px solid #89663f;border-radius:7px;overflow:auto}
 .mobile-ds .mobile-ds-idle>small{font-size:9px;letter-spacing:.18em;display:flex;align-items:center;gap:8px}
 .mobile-ds .mobile-ds-idle>small:after{content:'';height:1px;background:#97734666;flex:1}
 .mobile-ds .mobile-ds-idle>p{flex:none;font:18px/1.1 'Nintendo DS',monospace;color:#795c3d;margin:0}
 .mobile-ds .mobile-control-deck{position:relative;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:minmax(56px,1fr);gap:8px 12px;flex:1;min-height:120px;padding:2px}
 .mobile-control-deck:before{content:'';position:absolute;inset:50% 14px auto;height:1px;background:#a98b5d;pointer-events:none}
 .mobile-ds .mobile-control-deck>button{position:relative;inset:auto;width:100%;min-width:0;min-height:56px;height:auto;margin:0;padding:8px 10px;display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:10px;border:1px solid var(--deck-edge);border-radius:3px 16px 3px 16px;background:linear-gradient(145deg,#fff8e0,#e0c99c);box-shadow:inset 0 1px #fff9e8,0 2px 0 #a48151;color:var(--deck-ink);font:22px/1 'Nintendo DS',monospace;text-align:left;cursor:pointer;transition:background .12s,box-shadow .12s;filter:none;order:initial}
 .mobile-ds .mobile-control-deck>button:nth-child(even){border-radius:16px 3px 16px 3px}
 .mobile-ds .mobile-control-deck>button svg{width:30px;height:30px;flex:none;filter:drop-shadow(0 1px #fff6)}
 .mobile-ds .mobile-control-deck>button>span{display:block!important;min-width:0;max-width:none;font:inherit;white-space:normal;color:inherit}
 .mobile-ds .mobile-control-deck>button:active,.mobile-ds .mobile-control-deck>button[aria-expanded=true],.mobile-ds .mobile-control-deck>button[aria-pressed=true]{background:linear-gradient(#d0b181,#f3dfb4);box-shadow:inset 0 2px 4px #77563144,0 1px #a48151}
 .mobile-ds .mobile-control-deck>button:focus-visible{outline:2px solid #79492d;outline-offset:2px}
 .mobile-ds .mobile-control-deck #item-count{position:absolute;right:7px;top:5px;font:10px Arial,sans-serif;background:#825735;color:#fff2cf;border-radius:10px;padding:2px 5px}
 .mobile-ds .mobile-control-deck #mobile-notebook{display:flex}
 .mobile-ds .mobile-control-deck #phone{background:linear-gradient(145deg,#f8ead8,#d9b595)}
 .mobile-ds .mobile-control-deck #inventory-toggle{background:linear-gradient(145deg,#f5e6bf,#d7bc84)}
 .mobile-ds .mobile-control-deck #mobile-notebook{background:linear-gradient(145deg,#f4edd2,#d6c9a1)}
}
@media(max-width:900px) and (orientation:portrait) and (max-height:650px){
 .mobile-ds .mobile-control-deck{grid-template-columns:repeat(4,minmax(0,1fr));grid-auto-rows:minmax(58px,1fr);gap:5px;min-height:58px}
 .mobile-ds .mobile-control-deck>button{flex-direction:column;gap:4px;padding:5px 2px;font-size:18px;text-align:center;border-radius:3px 12px 3px 12px}
 .mobile-ds .mobile-control-deck>button svg{width:24px;height:24px}
 .mobile-ds .mobile-ds-idle>p{display:none}
}
@media(max-width:1100px) and (max-height:600px) and (orientation:landscape){
 .mobile-ds .mobile-control-deck{gap:6px;min-height:112px}
 .mobile-ds .mobile-control-deck>button{font-size:19px;padding:6px;gap:6px}
 .mobile-ds .mobile-control-deck>button svg{width:23px;height:23px}
 .mobile-ds .mobile-ds-idle>p{display:none}
}
@media(prefers-reduced-motion:reduce){.mobile-ds .mobile-control-deck>button{transition:none}}
@media(max-width:900px) and (orientation:portrait), (max-width:1100px) and (max-height:600px) and (orientation:landscape){
 .mobile-ds .mobile-control-deck #phone{order:0}.mobile-ds .mobile-control-deck #inventory-toggle{order:1}.mobile-ds .mobile-control-deck #mobile-notebook{order:2}.mobile-ds .mobile-control-deck>button[aria-pressed]{order:3}
}
/* Consistent line icons, no cartoon shadows or chunky outlines. */
.mobile-ds .mobile-control-deck>button .deck-icon{color:#795a3e;filter:none;stroke-width:1.6;overflow:visible}
.mobile-ds .mobile-control-deck>button[aria-pressed=true] .deck-icon{color:#4e654d}
/* Retain the upper information screen, without a visible scrollbar. */
.mobile-ds .mobile-ds-top{scrollbar-width:none;-ms-overflow-style:none}
.mobile-ds .mobile-ds-top::-webkit-scrollbar{display:none;width:0;height:0}
/* Upper screen is a fitted information card, never a scroll container. */
@media(max-width:900px) and (orientation:portrait), (max-width:1100px) and (max-height:600px) and (orientation:landscape){
 .mobile-ds .game-window>.mobile-ds-top{--context-scale:1;display:flex;flex-direction:column;justify-content:flex-start;gap:4px;padding:12px 18px;overflow:hidden}
 .mobile-ds-top .mobile-ds-heading{flex:none;font-size:calc(10px * var(--context-scale));line-height:1.2}
 .mobile-ds-top h2{flex:none;font-size:calc(24px * var(--context-scale));line-height:1.05;margin:0}
 .mobile-ds-top .mobile-ds-rule,.mobile-ds-top .mobile-ds-footer{display:none}
 .mobile-ds-top>small{flex:none;font-size:calc(9px * var(--context-scale));line-height:1.2;margin-top:2px}
 .mobile-ds-top .mobile-ds-objective{flex:none;font-size:calc(21px * var(--context-scale));line-height:1.08;margin:0;max-width:none;overflow:visible}
 .mobile-ds-top .mobile-ds-selection{flex:none;font-size:calc(18px * var(--context-scale));line-height:1.1;margin:0}
 .mobile-ds-top .mobile-ds-selection:empty{display:none}
}
@media(max-width:900px) and (orientation:portrait){
 .mobile-ds .game-window>.mobile-ds-top{flex:0 0 clamp(160px,24dvh,180px);max-height:none}
}
@media(max-width:1100px) and (max-height:600px) and (orientation:landscape){
 .mobile-ds .game-window>.mobile-ds-top{padding:8px 12px;gap:3px;max-height:none}
 .mobile-ds-top h2{font-size:calc(21px * var(--context-scale))}
 .mobile-ds-top .mobile-ds-objective{font-size:calc(18px * var(--context-scale))}
 .mobile-ds-top .mobile-ds-selection{font-size:calc(16px * var(--context-scale))}
}
/* Fit the actual lower-screen slot, including Safari's changing viewport. */
@media(max-width:900px) and (orientation:portrait), (max-width:1100px) and (max-height:600px) and (orientation:landscape){
 .mobile-ds .mobile-ds-idle{overflow:hidden;min-height:0}
 .mobile-ds .mobile-control-deck{min-height:0;grid-auto-rows:minmax(44px,1fr);flex:1 1 0}
 .mobile-ds .mobile-control-deck>button{min-height:44px;min-width:0}
}
@media(max-width:900px) and (orientation:portrait){
 .mobile-ds .mobile-ds-idle.deck-compact{padding:8px;gap:5px}
 .mobile-ds .mobile-ds-idle.deck-compact>p{display:none}
 .mobile-ds .deck-compact .mobile-control-deck{grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:minmax(44px,1fr);gap:5px;min-height:0}
 .mobile-ds .deck-compact .mobile-control-deck>button{flex-direction:column;justify-content:center;padding:5px 2px;gap:3px;font-size:18px}
 .mobile-ds .deck-compact .mobile-control-deck>button svg{width:24px;height:24px}
}
/* Keep the four shortcuts in a 2×2 grid, even in the compact lower slot. */
@media(max-width:900px) and (orientation:portrait), (max-width:1100px) and (max-height:600px) and (orientation:landscape){
 .mobile-ds .mobile-control-deck,.mobile-ds .deck-compact .mobile-control-deck{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(2,minmax(44px,1fr));grid-auto-rows:minmax(44px,1fr);gap:6px;min-height:0}
 .mobile-ds .mobile-control-deck>button,.mobile-ds .deck-compact .mobile-control-deck>button{flex-direction:row;justify-content:center;align-items:center;gap:7px;padding:5px 7px;font-size:20px;text-align:center}
 .mobile-ds .mobile-control-deck>button>span{text-align:center;flex:0 1 auto}
 .mobile-ds .mobile-control-deck>button svg,.mobile-ds .deck-compact .mobile-control-deck>button svg{width:24px;height:24px}
 .mobile-ds .mobile-ds-idle.deck-compact{padding:6px 8px;gap:4px}
 .mobile-ds .mobile-ds-idle.deck-compact>small,.mobile-ds .mobile-ds-idle.deck-compact>p{display:none}
}
/* Tooltips are clamped to the artwork bounds, including top-edge doors. */
@media(max-width:900px) and (orientation:portrait), (max-width:1100px) and (max-height:600px) and (orientation:landscape){
 .mobile-ds .scene .hotspot>span{left:var(--label-left,0px);top:var(--label-top,6px);bottom:auto;transform:none;width:max-content;min-width:0;max-width:min(200px,calc(100cqw - 16px));padding:6px 10px;font:600 14px/1.25 'Trebuchet MS',Arial,sans-serif;text-align:center;white-space:normal;overflow-wrap:normal;word-break:normal;box-sizing:border-box}
 .mobile-ds .scene .hotspot:focus{z-index:20}
}
/* Centre the lock artwork in the usable modal body, rather than at its top. */
@media(max-width:900px) and (orientation:portrait), (max-width:1100px) and (max-height:600px) and (orientation:landscape){
 .mobile-ds #panel.lock-panel #panel-content>.ui-surface-body{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:8px}
 .mobile-ds #panel.lock-panel .combination-lock{flex:none;width:min(320px,100%);margin:auto}
}

/* Only delay touch interactions after a room change; preserve all visuals. */
@media(hover:none), (pointer:coarse){
 body.mobile-ds .scene.touch-scene-cooldown :is(.hotspot,.case-hotspot,.case-context-target,.case-npc,.scene-navigation){pointer-events:none!important}
}

/* Four tactile quadrants surrounding a dedicated menu hub. */
@media(max-width:900px) and (orientation:portrait), (max-width:1100px) and (max-height:600px) and (orientation:landscape){
 .mobile-ds .mobile-ds-idle{background:radial-gradient(ellipse at 50% 50%,#f7e6bc66,transparent 65%),linear-gradient(135deg,#dbc18e,#eddbb2);border:1px solid #9b7d4d;box-shadow:inset 0 0 0 3px #f4e4bd55,inset 0 1px #fff4d9;border-radius:10px}
 .mobile-ds .mobile-control-deck,.mobile-ds .deck-compact .mobile-control-deck{isolation:isolate;gap:10px;padding:3px;grid-template-rows:repeat(2,minmax(44px,1fr))}
 .mobile-control-deck:before{inset:50% 14px auto;background:#987b4855;z-index:-1}
 .mobile-control-deck:after{content:'';position:absolute;left:50%;top:14px;bottom:14px;width:1px;background:#987b4855;z-index:-1;pointer-events:none}
 .mobile-ds .mobile-control-deck>button:not(.deck-menu),.mobile-ds .deck-compact .mobile-control-deck>button:not(.deck-menu){position:relative;overflow:hidden;border:1px solid #a68b56;border-radius:9px;background:radial-gradient(ellipse at 30% 0,#fff9e4aa,transparent 75%),linear-gradient(145deg,#f8e8c6,#d8be8b)!important;box-shadow:inset 0 1px #fff8e3,inset 0 -2px #ba9b5a55,0 3px 0 #8a6b3d55;color:#4c3b25;padding:10px 12px;gap:8px;font:22px/1.05 'Nintendo DS',monospace;transition:background .16s,box-shadow .16s,color .16s}
 .mobile-ds .mobile-control-deck>button:not(.deck-menu):before{content:'';position:absolute;inset:4px;border:1px solid #9e7b3b25;border-radius:5px;pointer-events:none}
 .mobile-ds .mobile-control-deck>button:not(.deck-menu) .deck-icon{width:27px;height:27px;color:#7a623b;stroke-width:1.5;filter:none}
 .mobile-ds .mobile-control-deck>button:not(.deck-menu):is(:active,[aria-pressed=true],[aria-expanded=true]){background:linear-gradient(145deg,#d1b37d,#f0dfb4)!important;box-shadow:inset 0 2px 5px #76572d44,0 1px #8a6b3d55;color:#334b36}
 .mobile-ds .mobile-control-deck>button:not(.deck-menu):is([aria-pressed=true],[aria-expanded=true]) .deck-icon{color:#426347}
 .mobile-ds .mobile-control-deck>button.deck-menu,.mobile-ds .deck-compact .mobile-control-deck>button.deck-menu{position:absolute;z-index:3;inset:auto;left:50%;top:50%;translate:-50% -50%;display:grid;place-items:center;box-sizing:border-box;width:58px;height:58px;min-width:58px;min-height:58px;margin:0;padding:13px;border:2px solid #bba16a;border-radius:50%;background:radial-gradient(circle at 35% 20%,#525b3e,#252e20 70%);box-shadow:0 0 0 5px #e3cda0,inset 0 0 0 3px #172015,inset 0 4px 7px #ffffff12,0 5px 10px #38280c44;color:#f3dfa7;cursor:pointer;transform:none;transition:box-shadow .15s,background .15s}
 .mobile-ds .mobile-control-deck>button.deck-menu:before{content:'';position:absolute;inset:5px;border:1px solid #dfc78e60;border-radius:50%;pointer-events:none}
 .mobile-ds .mobile-control-deck>button.deck-menu .deck-icon{width:28px;height:28px;color:inherit;stroke-width:1.7;filter:none}
 .mobile-ds .mobile-control-deck>button.deck-menu:active{background:#172117;box-shadow:0 0 0 5px #e3cda0,inset 0 3px 7px #0006,0 2px 5px #38280c44;transform:none}
 .mobile-ds .mobile-control-deck>button:focus-visible{outline:2px solid #4f633f;outline-offset:3px}
 .mobile-ds .mobile-control-deck #item-count{right:8px;top:7px;background:#4a583a;color:#fff1cb;box-shadow:inset 0 1px #ffffff30}
}
@media(max-width:900px) and (max-height:650px) and (orientation:portrait){
 .mobile-ds .deck-compact .mobile-control-deck>button:not(.deck-menu){font-size:19px;padding:6px 8px;gap:5px}
 .mobile-ds .mobile-control-deck>button.deck-menu,.mobile-ds .deck-compact .mobile-control-deck>button.deck-menu{width:50px;height:50px;min-width:50px;min-height:50px;padding:10px}
 .mobile-ds .deck-compact .mobile-control-deck>button:not(.deck-menu) .deck-icon{width:23px;height:23px}
}
@media(prefers-reduced-motion:reduce){.mobile-ds .mobile-control-deck>button{transition:none!important}}

/* Keep the original centered groups; only constrain the wrapping objects label. */
@media(max-width:900px) and (orientation:portrait), (max-width:1100px) and (max-height:600px) and (orientation:landscape){
 .mobile-ds .mobile-control-deck>button[aria-pressed]>span{flex:0 0 66px;width:66px;max-width:66px}
}

/* Travel journal: stitched spine, layered paper and a clear current objective. */
@media(max-width:900px) and (orientation:portrait), (max-width:1100px) and (max-height:600px) and (orientation:landscape){
 .mobile-ds .game-window>.mobile-ds-top{isolation:isolate;padding:12px 20px 14px 34px;gap:5px;color:#352e20;border-bottom:1px solid #8f774b;background:radial-gradient(ellipse at 80% 0,#fff9e0c9,transparent 65%),repeating-linear-gradient(0deg,transparent 0 23px,#967f4d0e 23px 24px),linear-gradient(115deg,#dcc591,#f4e7c3 38%,#e7d3a2);box-shadow:inset 0 1px #fff3d4,inset 0 -4px #b99e6c44,0 3px 0 #171e1480}
 .mobile-ds .mobile-ds-top:before{content:'';position:absolute;z-index:-1;left:0;top:0;bottom:0;width:18px;border-right:1px solid #ae8e53;background:repeating-linear-gradient(0deg,transparent 0 12px,#dfd0a37a 12px 15px,transparent 15px 29px) 9px 3px/2px 100% no-repeat,linear-gradient(90deg,#17251d,#384435 70%,#202f24);box-shadow:2px 0 4px #56412135}
 .mobile-ds .mobile-ds-top:after{content:'';position:absolute;right:0;bottom:0;width:26px;height:26px;background:linear-gradient(135deg,transparent 48%,#c7af7a 50%,#f9edcd 54%,#e2cc9a 100%);pointer-events:none}
 .mobile-ds-top .mobile-ds-heading{align-items:center;gap:12px;min-height:25px;flex:none;font:calc(9px * var(--context-scale))/1.2 'Syne Mono',monospace;letter-spacing:.08em;color:#665535}
 .journal-brand{display:flex;align-items:center;gap:7px;white-space:nowrap}
 .journal-brand b{display:inline-flex;align-items:baseline;gap:1px;font:italic 700 calc(28px * var(--context-scale))/.9 Georgia,serif;letter-spacing:-2px;color:#334633}
 .journal-brand sup{position:static;font:italic 700 calc(13px * var(--context-scale))/1 Georgia,serif;letter-spacing:0}
 .journal-brand>span{font:calc(8px * var(--context-scale))/1 'Syne Mono',monospace;letter-spacing:.15em}
 .journal-title{display:flex;align-items:center;gap:5px;font-size:calc(8px * var(--context-scale));letter-spacing:.09em;white-space:nowrap}
 .journal-title svg{width:16px;height:16px;flex:none;color:#6d7650}
 .mobile-ds-top h2{font-size:calc(25px * var(--context-scale));line-height:1.05;color:#3a3527;padding:2px 0 7px;border-bottom:1px solid #a18a5640;letter-spacing:.01em}
 .mobile-ds-top>small{align-self:flex-start;display:flex;align-items:center;gap:6px;color:#5b6947;font:calc(8px * var(--context-scale))/1.2 'Syne Mono',monospace;letter-spacing:.12em;margin-top:1px}
 .mobile-ds-top>small:before{content:'';width:5px;height:5px;background:#77835a;rotate:45deg;box-shadow:0 0 0 2px #6b784418}
 .mobile-ds-top .mobile-ds-objective{font-size:calc(22px * var(--context-scale));line-height:1.1;color:#3b3728;padding-left:10px;border-left:2px solid #a0a47a;max-width:100%;box-sizing:border-box}
 .mobile-ds-top .mobile-ds-selection{padding-left:12px;color:#736343;font-size:calc(18px * var(--context-scale))}
}
@media(max-width:350px){.mobile-ds .game-window>.mobile-ds-top{padding-right:14px;padding-left:30px}.journal-brand>span{display:none}.journal-title{letter-spacing:.03em}}
