/* A single game viewport. Only reading panels scroll. */
html:has(.game-screen){height:100%;overscroll-behavior:none}
body.game-screen{padding:0;margin:0;height:100dvh;overflow:hidden;overscroll-behavior:none;background:#10120e}
#game-shell{height:100dvh;width:100%;display:grid;grid-template-rows:minmax(0,1fr) auto;overflow:hidden}
#game-shell .scene-frame{position:relative;min-height:0;height:100%;width:100%;aspect-ratio:auto;outline:0;border:0;border-bottom:1px solid #a58b56;box-shadow:none}
#game-shell .scene-frame canvas{width:100%;height:100%;object-fit:fill}
#game-shell .scene-vignette{box-shadow:none;background:none}
#game-shell .scene-top{position:absolute;top:0;left:0;right:0;z-index:5;display:flex;align-items:flex-start;gap:8px;padding:calc(8px + env(safe-area-inset-top,0px)) max(10px,env(safe-area-inset-right,0px)) 0 max(12px,env(safe-area-inset-left,0px));pointer-events:none}
.location-time{min-width:0;flex:1}.location-time #location{display:block;font:600 1.25rem/1.15 var(--serif);color:#f4e7c4;text-shadow:0 2px 4px #000}
.clock-line{display:flex;align-items:center;gap:6px;flex-wrap:wrap;font-size:.75rem;line-height:1.4;color:#e6d7b6;margin-top:5px}.clock-line strong{font-weight:500}.clock-line #day{font-size:.75rem}#sun-icon{color:#d9b86e}
.hud-tools{display:flex;gap:4px;pointer-events:auto}.hud-tools button{min-width:44px;width:44px;min-height:44px;padding:0;color:#f0dbaf;background:#11170fa3;border:1px solid #a38a5359;font:24px Georgia,serif;box-shadow:inset 0 0 8px #0005}
.heading-strip{position:absolute;top:calc(76px + env(safe-area-inset-top,0px));left:max(12px,env(safe-area-inset-left,0px));right:12px;display:flex;align-items:center;justify-content:space-between;gap:10px;color:#eedeb8;text-shadow:0 2px 3px #000;pointer-events:none;font-size:.75rem}
#game-shell #compass{font-size:.75rem;letter-spacing:0}#turn{font-size:.75rem;color:#d8c49e}
.mini-compass{position:relative;display:block;width:30px;height:30px;border:1px solid #9f8251;border-radius:50%;background:radial-gradient(circle,#33291bcf 0 43%,#17140fdf 46% 63%,#a8864e 65% 68%,#18150fdf 70%);box-shadow:inset 0 0 0 2px #08070499,0 2px 5px #0008}
.compass-rose{position:absolute;inset:4px;border-radius:50%;transition:transform .32s ease-out;will-change:transform}
.compass-rose::before,.compass-rose::after{content:"";position:absolute;inset:1px 7px;background:linear-gradient(#d9be7a 0 45%,#832e27 46% 100%);clip-path:polygon(50% 0,72% 43%,100% 50%,72% 57%,50% 100%,28% 57%,0 50%,28% 43%);filter:drop-shadow(0 1px 1px #000)}
.compass-rose::after{inset:4px 7px;background:#e4cf99;transform:rotate(45deg);opacity:.7}
.compass-rose i{position:absolute;z-index:2;left:50%;top:50%;width:5px;height:5px;transform:translate(-50%,-50%);border-radius:50%;background:#17110b;border:1px solid #d8b76f}
@media(prefers-reduced-motion:reduce){.compass-rose{transition:none}}
#game-shell .story-peek{position:absolute;inset:auto 0 0;z-index:5;width:100%;padding:12px max(14px,env(safe-area-inset-right,0px)) 10px max(14px,env(safe-area-inset-left,0px));border:0;border-radius:0;background:linear-gradient(transparent,#080e0be8);color:#f0e3c4;display:flex;align-items:center;gap:12px;text-align:left;min-height:54px;text-shadow:0 1px 3px #000}
#narration{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;font:500 1.15rem/1.3 var(--serif);flex:1}#story-peek>span:last-child{font:22px Georgia,serif;color:var(--gold)}
.game-controls{position:relative;z-index:6;flex:none;padding:8px max(10px,env(safe-area-inset-right,0px)) calc(4px + env(safe-area-inset-bottom,0px)) max(10px,env(safe-area-inset-left,0px));background:linear-gradient(120deg,#292a20,#181c16 48%,#28291f);box-shadow:inset 0 2px 0 #55543a,0 -5px 22px #0007;max-height:48dvh;overflow-y:auto}
.hud-main{display:grid;grid-template-columns:64px minmax(0,1fr) 144px;gap:10px;align-items:start}
.hud-map-status{min-width:0}#map-expand{padding:3px;min-height:44px;width:100%;display:block;border:1px solid #ae8c51;background:#302e20;box-shadow:inset 0 0 0 2px #171b13}#map-expand canvas{display:block;width:100%;height:auto;aspect-ratio:1}
.hud-health{position:relative;padding-top:3px}.hud-health strong{display:block;font-size:.75rem;font-weight:500;line-height:1.25;text-align:center;color:#f1e7ce}.hud-health meter{height:5px;margin-top:3px}.hud-health meter::-webkit-meter-optimum-value{background:linear-gradient(90deg,#702b26,#c8583d)}.hud-health meter::-moz-meter-bar{background:#b34734}
.hud-primary{min-width:0;display:grid;gap:4px}.hud-primary #interact{min-height:44px;padding:6px 7px;line-height:1.2;font-size:.875rem;width:100%;background:linear-gradient(#c7ad77,#a28450);box-shadow:inset 0 0 0 2px #574b302e;white-space:normal}.hud-primary kbd{display:none}
.hud-utility{display:grid;grid-template-columns:repeat(2,minmax(44px,1fr));gap:4px}.hud-utility button{min-height:44px;font-size:26px;line-height:1;background:linear-gradient(#383b2c,#23291f);color:#dac28d}
.hud-motion{min-width:0}.hud-motion .movement{display:grid;grid-template-columns:44px 48px 44px;grid-template-rows:44px 44px;gap:4px}.hud-motion .movement button{min-width:44px;min-height:44px;padding:0;font-size:29px;color:#d1d3b7;background:linear-gradient(#393d2d,#252b20);border-color:#777251;box-shadow:inset 0 0 0 2px #161d1655}.hud-motion .movement .strafe-left,.hud-motion .movement .strafe-right{color:#c6a365}.hud-motion .movement .forward{color:#e8cf99}
.hud-tabs{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:2px;margin-top:6px;border-top:1px solid #4c4c34;padding-top:3px}.hud-tabs button{display:flex;align-items:center;justify-content:center;gap:5px;min-height:44px;padding:4px 2px;font-size:.875rem;border-color:transparent;min-width:0;color:#e4d6b4;line-height:1.2}.hud-tabs button>span:first-child:not(:last-child){font-size:23px;color:#c4a76f}.hud-tabs img{width:25px;height:28px;object-fit:cover;object-position:50% 20%;border-radius:2px;border:1px solid #786444}.hud-tabs button:last-child img{object-fit:contain}
#game-shell #inn-nav{display:grid;grid-template-columns:44px minmax(0,1fr) 44px;gap:4px;align-items:center;border:0;padding:0;background:none}#inn-nav>button{min-height:44px;padding:0;color:#e6cb92;font-size:24px}#inn-nav #inn-choose{font-size:.875rem;padding:4px 0;overflow-wrap:anywhere}#inn-view-name{grid-column:1/-1;min-height:44px;display:flex;align-items:center;justify-content:center;font:600 1.1rem/1.1 var(--serif);color:#ead6a9;text-align:center}
#game-shell .combat-actions{grid-column:2/-1;grid-row:1;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px;margin:0}#game-shell .combat-actions button{min-width:0;min-height:44px;padding:5px;font-size:.875rem;line-height:1.2}#game-shell .combat-actions .danger-button{grid-column:1/-1;background:linear-gradient(#803a2f,#532c27)}
.fighting .hud-primary,.fighting .hud-motion{visibility:hidden}
.fighting #encounter{border:2px solid #9e2427;box-shadow:0 0 0 2px #26090bcc,0 0 24px #8b161955}
#game-shell .scene-center{top:calc(106px + env(safe-area-inset-top,0px));left:12px;transform:none;width:min(250px,calc(100% - 24px));max-height:calc(100% - 180px);overflow:auto;padding:9px 12px;text-align:left;background:#171b14ca;border-color:#8d674f;box-shadow:none}#game-shell .scene-center h2{font-size:1.35rem}#game-shell .scene-center p{font-size:.875rem;margin:5px 0}.scene-center .eyebrow{display:none}
#game-drawer{padding:0;width:min(680px,100%);max-width:100%;max-height:85dvh;margin:auto auto 0;border-radius:12px 12px 0 0;border:1px solid #9e814f;background:#1a2219;box-shadow:0 -16px 70px #0009;overflow-y:auto;overscroll-behavior:contain}
#game-drawer::backdrop{background:#03080480;backdrop-filter:blur(1px)}.drawer-header{position:sticky;top:0;z-index:4;display:flex;justify-content:space-between;align-items:center;gap:12px;padding:10px 16px;background:#20271beF;border-bottom:1px solid #6c6042;backdrop-filter:blur(10px)}.drawer-header h2{font-size:1.65rem}.drawer-header button{flex:0 0 44px;min-height:44px;font-size:25px}
#drawer-body{padding:16px 16px calc(20px + env(safe-area-inset-bottom,0px))}#drawer-body .journal-panel{border:0;background:none}#drawer-body .tab-panel{padding:16px 0 0}#drawer-body .tabs{padding:0;gap:0}#drawer-body .tabs button{font-size:.875rem;flex:1;padding:10px 5px;min-height:44px}#drawer-body .dialogue-mode{display:none}#drawer-body .quest-panel{margin-bottom:20px}#drawer-body .log{max-height:none}#drawer-body .inn-panel{margin:0;border:0;padding:0;background:none}#drawer-body .inn-heading h2{display:none}.inn-leave{padding:10px 16px;margin-top:18px;width:100%;min-height:44px}#drawer-body .inn-places{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:0;padding:0;overflow:visible}#drawer-body .inn-places button{min-width:0;min-height:54px;white-space:normal;font-size:1rem}#drawer-body .context-actions{display:grid;gap:10px;margin:0}#drawer-body .context-actions button{min-height:48px;text-align:left}#drawer-body .inventory-summary{font-size:.875rem;margin-bottom:14px;color:#d2bc8d}#drawer-body .inn-options{grid-template-columns:1fr}#drawer-body #inn-line{font-size:1.3rem}
.game-screen dialog:not(#game-drawer){max-height:88dvh;z-index:20}.game-screen dialog .modal-header h2{font-size:1.7rem}.game-screen dialog button{min-height:44px}.game-screen .toast{bottom:calc(174px + env(safe-area-inset-bottom,0px));font-size:.875rem;z-index:100}
@media(max-width:360px){.hud-main{grid-template-columns:48px minmax(0,1fr) 144px;gap:6px}.game-controls{padding-inline:8px}.hud-tabs button{font-size:.8125rem;gap:3px}.hud-tabs img{width:20px;height:25px}.hud-tools{gap:2px}.hud-tools button{width:44px;min-width:44px}.location-time #location{font-size:1.1rem}.clock-line #day{display:none}.heading-strip{top:66px}.hud-utility{grid-template-columns:repeat(2,minmax(44px,1fr))}}
@media(orientation:landscape) and (min-width:600px){.game-controls{display:grid;grid-template-columns:minmax(0,1fr) 190px;gap:14px;padding-top:7px;padding-bottom:calc(7px + env(safe-area-inset-bottom,0px));max-height:45dvh}.hud-tabs{grid-template-columns:1fr 1fr;gap:4px;margin:0;padding:0 0 0 12px;border-top:0;border-left:1px solid #5c533b}.hud-tabs button{min-height:44px;font-size:.875rem}.hud-main{grid-template-columns:60px minmax(0,1fr) 144px;gap:12px}.hud-health strong{font-size:.75rem}.location-time #location{font-size:1.2rem}.clock-line{margin-top:3px}.heading-strip{top:65px}.clock-line #day{display:inline}#game-shell .story-peek{min-height:44px;padding-block:8px}#narration{-webkit-line-clamp:1;font-size:1.125rem}#game-shell .scene-center{top:87px;width:220px;max-height:calc(100% - 137px)}#game-shell .scene-center h2{font-size:1.125rem}#game-shell .scene-center p{font-size:.75rem;margin:3px 0}.game-screen .toast{bottom:120px}#game-drawer{margin:0 0 0 auto;width:min(480px,65vw);height:100dvh;max-height:100dvh;border-radius:0;border-right:0}#drawer-body{padding:14px}#drawer-body .party-line{grid-template-columns:64px minmax(0,1fr)}#drawer-body .party-line .avatar-button,#drawer-body .party-line img{width:64px}#drawer-body .inn-party{grid-template-columns:1fr}}
@media(min-width:1100px) and (min-height:650px){.game-controls{grid-template-columns:minmax(0,680px) 360px;justify-content:center;gap:28px;padding-block:12px}.hud-main{grid-template-columns:78px minmax(0,1fr) 164px;gap:22px}.hud-motion .movement{grid-template-columns:52px 52px 52px;grid-template-rows:50px 50px}.hud-primary #interact,.hud-utility button{min-height:50px}.hud-tabs{grid-template-columns:repeat(4,1fr)}.hud-tabs button{flex-direction:column;font-size:1rem}.hud-tabs img{width:38px;height:42px}}
@media(prefers-reduced-motion:reduce){#game-drawer{scroll-behavior:auto}}

#inn-nav #inn-choose{font-size:25px;line-height:1}
.hud-tabs button>span:last-child{white-space:nowrap}
@media(orientation:portrait),(max-width:599px){.hud-tabs button{flex-direction:column;gap:2px;min-height:49px;font-size:.875rem}.hud-tabs img{width:20px;height:20px}.hud-tabs button>span:first-child:not(:last-child){font-size:20px;line-height:20px}}
@media(orientation:landscape) and (min-width:600px){.hud-tabs img{width:20px;height:25px}.hud-tabs button{gap:4px}}

/* The overlay follows its text height, including enlarged fonts. */
#game-shell .scene-frame{display:grid;grid-template-rows:auto minmax(0,1fr) auto}
#game-shell .scene-frame canvas{position:absolute;inset:0}
#game-shell .scene-top{position:relative;grid-row:1;display:grid;grid-template-columns:minmax(0,1fr) auto;row-gap:8px}
#game-shell .heading-strip{position:static;grid-column:1/-1}
#game-shell .scene-center{position:relative;grid-row:2;top:auto;left:auto;align-self:start;max-height:100%;margin:8px 12px;min-height:0}
#game-shell .story-peek{position:relative;grid-row:3;align-self:end;inset:auto}

@media(orientation:portrait),(max-width:599px){.hud-tabs{grid-template-columns:repeat(auto-fit,minmax(min(4.3rem,100%),1fr))}.hud-tabs button>span:last-child{white-space:normal}}

@media(orientation:landscape) and (min-width:600px){.hud-tabs{grid-template-columns:repeat(auto-fit,minmax(min(4.3rem,100%),1fr))}.hud-tabs button>span:last-child{white-space:normal}}
.hud-map-status{grid-column:1;grid-row:1}.hud-primary{grid-column:2;grid-row:1}.hud-motion{grid-column:3;grid-row:1}
.fighting .hud-primary,.fighting .hud-motion{display:none}
@media(orientation:landscape) and (min-width:600px){.hud-tabs button{flex-direction:column;gap:2px}.hud-tabs img{height:20px}.hud-tabs button>span:first-child:not(:last-child){font-size:20px;line-height:20px}}

/* Controls remain part of the HUD, clear of location names and the compass. */
body.game-screen, .game-screen *{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
.game-screen input,.game-screen textarea,.game-screen [contenteditable="true"]{-webkit-user-select:text;user-select:text}
.game-screen button,.game-screen canvas{touch-action:manipulation}
.hud-utility{grid-template-columns:repeat(auto-fit,minmax(44px,1fr))}
#sky-look[aria-pressed="true"]{background:#80673b;color:#fff0c7;border-color:#dbc48a}
.world-tools:has(#work-status[hidden]):has(#riding-controls[hidden]){display:none}
.world-tools #work-status{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:4px 0 8px;font-size:14px}
.world-tools #work-status[hidden]{display:none}
.world-tools button{min-height:44px;padding:4px 10px}
.world-tools{grid-column:1/-1}

.hud-utility button{min-width:44px;padding:0}

/* Forged bronze, dark leather and parchment: the same quiet material language as the world. */
body.game-screen{--gold:#c1a16b;--pale:#f0dfb5;--text:#ddd0b6;--line:#66543a;--muted:#ada18b}
.game-controls{background-color:#251c14;background-image:linear-gradient(#17120ed9,#231911b0),url('art/world-materials.webp');background-size:auto,200% 200%;background-position:center,left bottom;border-top:2px solid #8e7042;box-shadow:inset 0 2px #c6a16655,0 -5px 18px #0008}
.hud-motion .movement button,.hud-utility button,.hud-tabs button{border-radius:3px;border-color:#705a38;color:#d4b982;background:linear-gradient(145deg,#483a26ed,#211b14e8);box-shadow:inset 0 1px #d5b67940,inset 0 -2px #0009,0 1px 2px #0007}
.hud-motion .movement .forward{color:#ffe2a0}.hud-motion .movement .strafe-left,.hud-motion .movement .strafe-right{color:#bc9b66}
.hud-primary #interact,.game-screen .gold-button{background:linear-gradient(135deg,#d0b076,#ac854d);border:1px solid #dfc18b;color:#21190f;text-shadow:0 1px #f3dfb14d;box-shadow:inset 0 0 0 2px #4c361f50;font-family:var(--serif);font-weight:700;font-size:1rem}
.hud-health meter::-webkit-meter-optimum-value{background:linear-gradient(90deg,#65201e,#bd4433)}
.hud-tabs{border-top-color:#8b714a}.hud-tabs button{font-family:var(--serif);font-size:1rem}.hud-tabs img{border-color:#b89355}
#map-expand{border-color:#ba965b;background:#3b2c1b;box-shadow:inset 0 0 0 2px #15110d,0 1px 4px #0008}
.game-screen dialog:not(#game-drawer),#game-drawer{background:#221c14;color:#e5d5b6;border:1px solid #ad8852;box-shadow:inset 0 0 0 3px #34291b,0 12px 70px #000c;border-radius:4px}
.game-screen dialog::backdrop{background:#080704a6}.game-screen .modal-header,.drawer-header{background:linear-gradient(#392c1e,#221b13);border-bottom:1px solid #806440}
.game-screen dialog button{border-color:#79603c}.game-screen dialog h2{color:#e9c98e}
.camp-menu .menu-location{font-family:var(--serif);color:#c6b087;margin-bottom:16px;font-size:1.1rem}
.menu-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px}.menu-actions button{padding:12px 14px;text-align:left;background:linear-gradient(#382c1e,#261e15)}
.menu-actions button:first-child{grid-column:1/-1}.menu-actions strong{display:block;font:600 1.2rem var(--serif)}.menu-actions small{display:block;font-size:.875rem;line-height:1.4;margin-top:5px;color:inherit;opacity:.8}
.save-status{font-size:.875rem;color:#bfae90;margin-top:18px}.menu-links{display:flex;gap:20px;flex-wrap:wrap;margin:16px 0}.menu-links a{min-height:44px;padding-block:10px;text-decoration:underline;color:#d3b580}
@media(max-width:380px){.menu-actions{grid-template-columns:1fr}.menu-actions button:first-child{grid-column:auto}}

/* Notices have their own line in the scene header: never overlap controls or story. */
#game-shell .scene-frame{grid-template-rows:auto 28px minmax(0,1fr) auto}
#game-shell #notice{grid-row:2;z-index:6;min-width:0;margin:0 12px;padding:3px 8px;line-height:22px;font:14px/22px system-ui,sans-serif;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#d7c9ab;background:#141710c9;border-left:2px solid currentColor;opacity:0;pointer-events:none;transition:opacity .18s}
#game-shell #notice.visible{opacity:1}#game-shell #notice[data-kind=warning]{color:#e1b86c}#game-shell #notice[data-kind=success]{color:#a8c58b}#game-shell #notice[data-kind=error]{color:#f0a28e}
#game-shell .scene-center{grid-row:3}#game-shell .story-peek{grid-row:4}
#work-status{color:#b3ceda}#narration{color:#f0e3c4}
@media(prefers-reduced-motion:reduce){#game-shell #notice{transition:none}}

.dialog-notice{margin:0 0 8px;padding:5px 8px;color:#d7c9ab;border-left:2px solid currentColor;font:14px/22px system-ui;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.dialog-notice[data-kind=error],.log article[data-kind=error]{color:#f0a28e}.dialog-notice[data-kind=warning],.log article[data-kind=warning]{color:#e1b86c}.dialog-notice[data-kind=success],.log article[data-kind=success]{color:#a8c58b}

.crt-overlay{position:absolute;inset:0;pointer-events:none;z-index:2;display:none;background:repeating-linear-gradient(0deg,#0000 0px,#0000 2px,#05080455 3px,#0000 4px);box-shadow:inset 0 0 65px #0006}
[data-crt=soft] .crt-overlay{display:block;opacity:.28}[data-crt=strong] .crt-overlay{display:block;opacity:.62}
.graphics-option{display:grid;gap:8px;margin:18px 0;font-size:16px}.graphics-option select{width:100%;min-height:48px;padding:10px;background:#33291d;color:#eddbb8;border:1px solid #9e7c4b;font:inherit}

/* Compact controls: two utility buttons, weather on the actual clock. */
.hud-main{grid-template-columns:48px minmax(0,1fr) 144px;gap:6px;align-items:start}
.hud-utility{grid-template-columns:repeat(2,minmax(44px,1fr))}
.hud-primary{grid-template-rows:minmax(44px,1fr) 44px}
#world-weather.clock-line{display:flex;flex-wrap:wrap;align-items:center;gap:6px;min-height:44px;padding:2px 0;border:0;background:none;box-shadow:none;color:inherit;text-align:left;font:inherit}
#inn-view-name{min-height:0;font-size:.85rem;line-height:1.2;padding:4px 0}
#game-shell .scene-frame{grid-template-rows:auto auto minmax(0,1fr) auto}
#game-shell #notice:not(.visible){display:none}
[hidden],.mini-person[hidden],.party-line[hidden],.morholt[hidden],.dialogue-options[hidden]{display:none!important}
.mini-party{grid-template-columns:repeat(auto-fit,minmax(80px,1fr))}
@media(min-width:1100px) and (min-height:650px){.game-controls{grid-template-columns:minmax(0,560px) 280px;gap:14px;padding-block:8px}.hud-main{grid-template-columns:64px minmax(0,1fr) 164px;gap:12px}.hud-primary{grid-template-rows:50px 50px}.hud-utility button{height:50px}.hud-tabs button{min-height:44px}}

/* Six movement buttons plus a separate, fixed look column to their right. */
#world-weather{pointer-events:auto}
.hud-main{grid-template-columns:48px minmax(0,1fr) 188px}
.hud-motion{display:grid;grid-template-columns:minmax(0,1fr) 44px;gap:4px}
.hud-motion .movement{grid-template-columns:repeat(3,minmax(44px,1fr));grid-template-rows:44px 44px;touch-action:none}
.hud-motion .movement button{touch-action:none}
.look-controls{display:grid;grid-template-rows:44px 44px;gap:4px}
.look-controls button{display:flex;flex-direction:column;align-items:center;justify-content:center;min-width:44px;min-height:44px;padding:0;font:26px/20px Georgia,serif;color:#d4b982;border:1px solid #705a38;border-radius:3px;background:linear-gradient(145deg,#483a26ed,#211b14e8);touch-action:manipulation}
.look-controls button span{font:11px/15px system-ui,sans-serif}
.look-controls button[aria-pressed=true]{background:#80673b;color:#fff0c7;border-color:#dbc48a}
.hud-utility{grid-template-columns:1fr}
.inside-inn .hud-motion{grid-template-columns:1fr}
@media(max-width:360px) and (orientation:portrait){
 .hud-main{grid-template-columns:48px minmax(0,1fr);gap:6px}
 .hud-primary{grid-column:1/-1;grid-row:1;grid-template-columns:minmax(0,1fr) 44px;grid-template-rows:auto}
 .hud-map-status{grid-column:1;grid-row:2}
 .hud-motion{grid-column:2;grid-row:2}
 #game-shell .combat-actions{grid-column:2;grid-row:1/3}
 .fighting .hud-map-status{grid-row:1}
}
@media(min-width:1100px) and (min-height:650px){
 .hud-main{grid-template-columns:64px minmax(0,1fr) 212px}
 .hud-motion{grid-template-columns:minmax(0,1fr) 44px}
 .hud-motion .movement{grid-template-columns:repeat(3,minmax(44px,1fr));grid-template-rows:50px 50px}
 .look-controls{grid-template-rows:50px 50px}
}
/* Phone landscape: the viewport and controls occupy separate full-height columns.
   Desktop retains the compact bottom panel. Account for either notch position. */
@media (orientation:landscape) and (min-width:600px) and (max-height:600px), (orientation:landscape) and (min-width:600px) and (pointer:coarse){
 #game-shell{grid-template-rows:minmax(0,1fr);grid-template-columns:minmax(0,1fr) calc(224px + env(safe-area-inset-right,0px))}
 #game-shell .scene-frame{grid-column:1;grid-row:1;min-width:0;border-bottom:0}
 #game-shell .game-controls{grid-column:2;grid-row:1;display:flex;flex-direction:column;justify-content:flex-start;gap:6px;width:100%;height:100%;max-height:none;min-height:0;padding:calc(6px + env(safe-area-inset-top,0px)) calc(8px + env(safe-area-inset-right,0px)) calc(6px + env(safe-area-inset-bottom,0px)) 8px;border-top:0;border-left:1px solid #8e7042;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain}
 body[data-hud-side=left] #game-shell{grid-template-columns:calc(224px + env(safe-area-inset-left,0px)) minmax(0,1fr)}
 body[data-hud-side=left] #game-shell .scene-frame{grid-column:2}
 body[data-hud-side=left] #game-shell .game-controls{grid-column:1;border-left:0;border-right:1px solid #8e7042;padding-right:8px;padding-left:calc(8px + env(safe-area-inset-left,0px))}
 #game-shell .hud-main{display:grid;grid-template-columns:1fr;gap:6px;width:100%}
 #game-shell .hud-map-status{grid-column:1;grid-row:1;display:flex;align-items:center;gap:10px}
 #game-shell #map-expand{width:54px;flex:0 0 54px}
 #game-shell .hud-health{flex:1;min-width:0;padding-top:0}
 #game-shell .hud-health strong{font-size:14px}
 #game-shell .hud-health meter{width:100%;margin-top:6px}
 #game-shell .hud-motion{grid-column:1;grid-row:2;grid-template-columns:minmax(0,1fr) 44px}
 #game-shell .hud-motion .movement{grid-template-columns:repeat(3,minmax(44px,1fr));grid-template-rows:44px 44px}
 #game-shell .look-controls{grid-template-rows:44px 44px}
 #game-shell .hud-primary{grid-column:1;grid-row:3;grid-template-columns:minmax(0,1fr) 44px;grid-template-rows:auto}
 #game-shell .hud-primary #interact,#game-shell .hud-utility button{min-height:44px;height:auto;font-size:14px}
 #game-shell .hud-utility button{font-size:25px}
 #game-shell .hud-tabs{display:grid;flex:none;grid-template-columns:1fr 1fr;gap:4px;margin:0;padding:6px 0 0;border-left:0;border-top:1px solid #8b714a}
 #game-shell .hud-tabs button{min-height:44px;flex-direction:row;gap:5px;font-size:14px}
 #game-shell .hud-tabs img{width:19px;height:22px}
 #game-shell .world-tools #work-status{flex-wrap:wrap;padding:0;font-size:12px;gap:4px}
 #game-shell .world-tools #work-status button{min-height:44px}
 #game-shell .scene-top{padding:calc(6px + env(safe-area-inset-top,0px)) 8px 0 max(8px,env(safe-area-inset-left,0px));gap:4px}
 body[data-hud-side=left] #game-shell .scene-top{padding-left:8px;padding-right:max(8px,env(safe-area-inset-right,0px))}
 #game-shell .location-time #location{font-size:1.05rem}
 #game-shell .hud-tools{gap:2px}
 #game-shell .hud-tools button{min-width:44px;width:44px}
 #game-shell .clock-line{font-size:12px;margin-top:0}
 #game-shell .heading-strip{gap:4px}
 #game-shell .inside-inn .hud-motion,.inside-inn #game-shell .hud-motion{grid-template-columns:1fr}
 #game-shell .combat-actions{grid-column:1;grid-row:2/4}
 #game-shell .story-peek{padding:6px 8px;min-height:44px}
 #game-shell #narration{font-size:1rem;-webkit-line-clamp:2}
 #game-drawer{width:min(480px,100vw);max-width:100%;height:100dvh;max-height:100dvh}
 body[data-hud-side=left] #game-drawer{margin:0 auto 0 0}
}

/* v0.6.20 — phone space is a design constraint, not a desktop dialog scaled down. */
#inn-shortcuts{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:4px;margin:0 0 6px}
#inn-shortcuts button{min-height:44px;padding:4px;font:14px Georgia,serif}
#inn-choose{font-size:14px!important}
.movement,#inn-nav{touch-action:none;-webkit-touch-callout:none}
.inside-inn #map-expand{display:none}
.inside-inn .hud-map-status{align-self:center}
#game-drawer,dialog#modal{height:auto!important;max-height:min(82dvh,680px);width:min(520px,calc(100vw - 16px));max-width:calc(100vw - 16px);margin:auto auto 8px;padding:0}
#game-drawer[open],dialog#modal[open]{display:flex;flex-direction:column;overflow:hidden}
#game-drawer .drawer-header,#modal .modal-header{padding:8px 10px;gap:8px;flex:none;touch-action:none}
#game-drawer h2,#modal h2{font-size:1.15rem;line-height:1.25;margin:0}
#drawer-body,#modal-body{padding:10px;overflow:auto;min-height:0;overscroll-behavior:contain}
#drawer-body p,#modal-body p,#inn-line{font-size:16px;line-height:1.45;margin:8px 0}
#drawer-body .small,#modal-body .small{font-size:13px}
.dialog-return{flex:none;min-height:44px;margin:0 10px 8px;font-size:15px;border-color:#977c4b}
#inn-panel .inn-heading{margin:0 0 6px;padding:0;gap:4px}
#inn-panel .inn-heading h2{display:none}
#inn-panel .inn-options{gap:6px}
#inn-panel button{min-height:44px;padding:8px 10px;font-size:15px}
#inn-panel .inn-leave{margin-top:8px}
#inn-panel .inn-party{display:grid;grid-template-columns:1fr;gap:6px}
#inn-panel .inn-party>div{display:grid;grid-template-columns:36px minmax(0,1fr) 112px;grid-template-rows:auto auto;gap:0 7px;align-items:center;padding:6px;text-align:left}
#inn-panel .inn-party img{width:36px;height:48px;grid-row:1/3;object-fit:cover;object-position:top}
#inn-panel .inn-party strong{font-size:15px;grid-column:2;grid-row:1}
#inn-panel .inn-party small{font-size:11px;grid-column:2;grid-row:2}
#inn-panel .inn-party button{grid-column:3;grid-row:1/3;font-size:13px;padding:4px}
@media(orientation:landscape) and (max-height:600px){
 #game-drawer,dialog#modal{max-height:calc(100dvh - 16px);width:min(440px,calc(100vw - 16px));margin:8px 8px 8px auto}
 body[data-hud-side=left] #game-drawer,body[data-hud-side=left] dialog#modal{margin:8px auto 8px 8px}
 #inn-shortcuts{grid-template-columns:1fr 1fr;margin:0}
 .inside-inn #game-shell .hud-map-status{grid-row:auto;display:block}
 .inside-inn #game-shell .hud-health{display:flex;gap:8px;align-items:center}
 .inside-inn #game-shell .hud-health meter{flex:1;margin:0}
}

#inn-shortcuts{grid-column:1/-1;flex:none}
#drawer-body #inn-line{font-size:16px;line-height:1.45}
#modal .modal-header{position:static}
#drawer-body .inn-options button,#drawer-body .inn-places button{min-height:44px}

.movement button.is-held,#inn-nav button.is-held{background:#80673b;color:#fff0c7;border-color:#dbc48a;box-shadow:inset 0 0 0 1px #ceb277}

#riding-controls{display:flex;gap:6px;padding:3px 0}#riding-controls button{flex:1;font-size:14px}#horse-condition{font-size:13px;line-height:1.4}#horse-care-actions{display:flex;flex-wrap:wrap;gap:6px}

/* Compact ongoing work: the bar uses the actual continuous world clock. */
#game-shell .world-tools #work-status{gap:12px;min-width:0;flex-wrap:nowrap}
.work-copy{flex:1;min-width:0;display:flex;flex-direction:column;gap:5px}
#work-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#work-progress{appearance:none;-webkit-appearance:none;display:block;width:100%;height:8px;border:1px solid #806a42;border-radius:2px;overflow:hidden;background:#15120e;color:#c5a267}
#work-progress::-webkit-progress-bar{background:#15120e}
#work-progress::-webkit-progress-value{background:linear-gradient(90deg,#76613e,#d2b576);transition:width .25s linear}
#work-progress::-moz-progress-bar{background:linear-gradient(90deg,#76613e,#d2b576)}
#work-status>button{flex:none;min-width:74px;min-height:44px}
@media(prefers-reduced-motion:reduce){#work-progress::-webkit-progress-value{transition:none}}
/* Compact mobile HUD: no inherited header inset or decorative compass. */
#game-shell .scene-top{inset:auto;top:0;align-self:start;margin:0;padding-top:max(4px,env(safe-area-inset-top,0px));row-gap:0}
#game-shell .location-time{padding:0;margin:0}
#game-shell .clock-line{margin-top:0;font-size:14px}
#game-shell .heading-strip{justify-content:flex-start;min-height:0}
#game-shell #compass{font:600 16px var(--sans);letter-spacing:1px;color:#f2e3bc;text-shadow:0 1px 3px #000}
#game-shell #turn{display:none}
#game-shell .hud-tabs{grid-template-columns:repeat(3,minmax(0,1fr))}
#party-status{display:flex;gap:4px;grid-column:1/-1;min-width:0}
#party-status button{display:flex;align-items:center;justify-content:center;flex:1;min-width:0;min-height:44px;padding:2px;gap:4px;font-size:12px}
#party-status img{width:26px;height:34px;object-fit:cover;object-position:50% 15%;border:1px solid #927447;border-radius:2px}
#party-status span{overflow:hidden;text-overflow:ellipsis}
@media(max-width:380px){#party-status button{flex-direction:column;gap:0}#party-status img{height:26px}}
#fps-meter{margin-left:auto;color:#f2e3bc;font:12px var(--sans);text-shadow:0 1px 3px #000;white-space:nowrap}

/* Local settlement chapter: compact material ledger and character words. */
.building-project{padding:12px 0;border-bottom:1px solid #84704766}.building-project strong{display:block;margin-bottom:7px}.building-project progress{width:100%;height:9px;accent-color:#c7a35d}.project-counts{display:flex;gap:12px;flex-wrap:wrap;font-size:14px;margin:7px 0}.project-counts span{display:flex;gap:5px}.word-stats{display:grid;grid-template-columns:1fr 1fr;gap:6px 16px;margin:12px 0}.word-stats div{display:flex;justify-content:space-between;gap:8px;font-size:14px}.word-stats dd{margin:0;color:#e0c895}.word-stats dt{color:#b9ae95}.arrival-card{display:flex;flex-direction:column;gap:8px;min-width:0}.arrival-card p{font-size:15px;margin:0;line-height:1.4}.arrival-card img{height:110px!important;object-fit:cover;object-position:top}.arrival-card details summary{min-height:44px;padding:10px 0}.arrival-card .word-stats{grid-template-columns:1fr}.settlement-campaign .inn-party{grid-template-columns:repeat(2,minmax(0,1fr))}.settlement-campaign .inn-party article{border:1px solid #87704b;padding:10px}.settlement-campaign #arrival-form{display:grid;gap:10px}.settlement-campaign #arrival-form label{display:grid;gap:5px;font-size:16px}.settlement-campaign #arrival-form input,.settlement-campaign #arrival-form select{padding:10px;background:#17120c;border:1px solid #87704b;color:#ebd9af;width:100%;font-size:16px;box-sizing:border-box;user-select:text}.settlement-campaign #settlement-character{padding-bottom:10px;border-bottom:1px solid #87704b}.settlement-campaign .saddlebags{display:none}.settlement-campaign .mini-party .portrait{object-fit:cover;object-position:top}.settlement-campaign #party-status:empty{display:none}

/* Analog controls overlay the world; opening the dock never changes camera FOV. */
body[data-controls=stick] #game-shell{position:relative;display:block}
body[data-controls=stick] #game-shell .scene-frame{height:100%;border:0}
#fps-controls{position:absolute;inset:0;z-index:7;pointer-events:none}
#move-stick{position:absolute;bottom:82px;left:max(14px,env(safe-area-inset-left));width:136px;height:136px;border:1px solid #ddc79188;border-radius:50%;background:#131a1752;touch-action:none;pointer-events:auto;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
.stick-ring{position:absolute;inset:15px;border:1px solid #d3c5a344;border-radius:50%;pointer-events:none}
.stick-knob{position:absolute;left:44px;top:44px;width:46px;height:46px;border-radius:50%;border:1px solid #dfc88eaa;background:radial-gradient(circle at 35% 30%,#b3a17888,#302a2088);transform:translate(var(--stick-x,0px),var(--stick-y,0px));pointer-events:none}
.stick-label{position:absolute;bottom:8px;width:100%;text-align:center;font:10px var(--sans);letter-spacing:2px;color:#e4d5af88;pointer-events:none}
#move-stick.active{border-color:#edd5a4;background:#19231980}
#quick-actions{position:absolute;bottom:232px;left:max(14px,env(safe-area-inset-left));display:flex;gap:5px;pointer-events:auto}
#quick-actions button{width:70px;min-height:48px;padding:5px 3px;font:13px/1.2 var(--sans);color:#f0dfb7;background:#1d201aca;border:1px solid #ac915e;box-shadow:inset 0 0 8px #0005;border-radius:5px;touch-action:manipulation}
#quick-interact{border-color:#ecd098!important}
#quick-vitals{position:absolute;right:max(14px,env(safe-area-inset-right));bottom:70px;color:#efdab3;font:14px var(--sans);text-shadow:0 1px 3px #000}
body[data-controls=stick] #game-shell .game-controls{position:absolute;bottom:0;left:0;right:0;width:auto;height:auto;max-height:46dvh;display:block;z-index:8}
body[data-controls=stick]:not(.inside-inn) #game-shell .movement,body[data-controls=stick]:not(.inside-inn) #game-shell .look-controls{display:none}
body[data-controls=stick].hud-collapsed #game-shell .game-controls{overflow:visible;background:transparent;border:0;box-shadow:none;padding:0;pointer-events:none;max-height:none}
body[data-controls=stick].hud-collapsed #game-shell .hud-main,body[data-controls=stick].hud-collapsed #party-status{display:none}
body[data-controls=stick].hud-collapsed #game-shell .hud-tabs{display:grid;grid-template-columns:repeat(3,1fr);width:200px;margin:0 10px max(10px,env(safe-area-inset-bottom)) auto;padding:0;gap:4px;border:0;pointer-events:auto}
body[data-controls=stick].hud-collapsed #game-shell .hud-tabs button{min-height:48px;padding:4px;gap:2px;font:12px var(--sans);border:1px solid #ac915e88;background:#191a15c9;border-radius:4px}
body[data-controls=stick].hud-collapsed #game-shell .hud-tabs button span:first-child{font-size:17px;line-height:18px}
body[data-controls=stick].hud-collapsed #game-shell .hud-tabs img{height:19px;width:19px;object-fit:cover;object-position:top}
body[data-controls=stick].hud-collapsed #game-shell .world-tools{pointer-events:auto;position:absolute;left:12px;right:12px;bottom:292px;background:transparent;padding:0}
body[data-controls=stick].hud-collapsed #game-shell #work-status{padding:6px 10px;background:#171a12e8;border:1px solid #a68d60;border-radius:4px}
body[data-controls=stick].hud-collapsed #game-shell #riding-controls{display:none}
body[data-controls=stick].hud-collapsed #game-shell .story-peek{left:166px;right:10px;bottom:108px;width:auto;min-height:44px;padding:6px;background:#1317109c;border-radius:3px}
body[data-controls=stick].hud-collapsed #narration{font-size:14px;line-height:1.35;-webkit-line-clamp:3}
body[data-controls=stick]:not(.hud-collapsed) #fps-controls{display:none}
body[data-controls=stick]:not(.hud-collapsed) #game-shell .story-peek{bottom:46dvh}
body[data-controls=stick].inside-inn.hud-collapsed #inn-shortcuts{pointer-events:auto;margin:0 10px 8px;grid-template-columns:repeat(4,minmax(0,1fr))}
body[data-controls=stick].inside-inn.hud-collapsed #game-shell .story-peek{left:10px;bottom:130px}
body[data-controls=stick].inside-inn.hud-collapsed #game-shell .world-tools{bottom:190px}
#audio-retry-hint{position:absolute;top:106px;left:12px;z-index:9;min-height:44px;padding:6px 10px;font-size:13px;background:#281c12ed;border:1px solid #c5a267}
@media(orientation:landscape) and (max-height:600px){
 #move-stick{bottom:max(16px,env(safe-area-inset-bottom));width:120px;height:120px}
 .stick-knob{left:36px;top:36px}#quick-actions{bottom:152px}#quick-actions button{width:65px}
 body[data-controls=stick].hud-collapsed #game-shell .story-peek{bottom:74px;left:auto;width:min(38vw,280px)}
 body[data-controls=stick].hud-collapsed #game-shell .world-tools{left:236px;right:14px;bottom:160px}
 body[data-controls=stick].inside-inn.hud-collapsed #inn-shortcuts{width:340px;margin-left:auto;grid-template-columns:repeat(4,1fr)}
 body[data-controls=stick].inside-inn.hud-collapsed #game-shell .story-peek{left:14px;right:auto;bottom:10px;width:calc(100% - 380px)}
 body[data-controls=stick]:not(.hud-collapsed) #game-shell .game-controls{left:auto;right:0;bottom:0;top:0;width:min(340px,46vw);max-height:100dvh}
 body[data-controls=stick][data-hud-side=left]:not(.hud-collapsed) #game-shell .game-controls{right:auto;left:0}
 body[data-controls=stick]:not(.hud-collapsed) #game-shell .story-peek{display:none}
}
/* One compact card per companion; portraits and membership are independent. */
#inn-panel .inn-party .arrival-card{display:grid;grid-template-columns:52px minmax(0,1fr) 92px;grid-template-rows:auto auto;gap:6px 8px;padding:8px}
#inn-panel .arrival-card>img{grid-column:1;grid-row:1;width:52px!important;height:66px!important;object-fit:cover;object-position:top}
#inn-panel .arrival-card .arrival-name{grid-column:2;grid-row:1;min-width:0;align-self:center}
#inn-panel .arrival-name strong,#inn-panel .arrival-name small,#inn-panel .arrival-name .membership{display:block;overflow-wrap:anywhere}
#inn-panel .arrival-card>button{grid-column:3;grid-row:1;font-size:13px;min-height:44px;align-self:center}
#inn-panel .arrival-card>details{grid-column:1/-1;grid-row:2;border-top:1px solid #806a423f}
#inn-panel .arrival-card summary{font-size:14px;padding:8px 0;min-height:40px;box-sizing:border-box}
.membership{font:12px var(--sans);margin-top:4px;color:#c5bca4}.membership[data-active=true]{color:#a7c18a}
#drawer-body .mini-party{display:flex;gap:6px;flex-wrap:wrap}
#drawer-body .mini-person{position:relative;display:grid;grid-template-columns:42px minmax(0,1fr);column-gap:7px;flex:1 1 140px;min-height:62px;height:auto;padding:6px;text-align:left;overflow:hidden}
#drawer-body .mini-person .portrait{position:static;width:42px;height:50px;grid-row:1/3;object-fit:cover;object-position:top;transform:none}
#drawer-body .mini-person strong,#drawer-body .mini-person small{position:static;grid-column:2;display:block;margin:0;padding:0;align-self:center;font-size:14px;line-height:1.2;overflow-wrap:anywhere}
#drawer-body .mini-person small{font-size:11px;color:#cabb9c}
#drawer-body .word-stats{grid-template-columns:1fr;gap:5px;margin:10px 0}
#drawer-body .word-stats div{flex-wrap:wrap}
body[data-controls=stick]:not(.inside-inn) #game-shell .hud-motion{display:none}
body[data-controls=stick]:not(.inside-inn) #game-shell .hud-main{grid-template-columns:64px minmax(0,1fr)}
body[data-controls=stick].fighting.hud-collapsed #quick-actions{bottom:100px;flex-direction:column}
body[data-controls=stick].fighting.hud-collapsed #quick-actions button{width:88px}

body[data-controls=stick] #game-shell .story-peek{position:absolute}
body[data-controls=stick] #game-shell .scene-top{z-index:10}
@media(orientation:landscape) and (max-height:600px){body[data-controls=stick]:not(.hud-collapsed) #game-shell .game-controls{top:86px;max-height:calc(100dvh - 86px)}}

/* Independent device preferences: keep labels and directions unchanged when mirroring. */
#scene-map-button{position:absolute;z-index:7;top:112px;right:12px;width:84px;height:84px;padding:3px;background:#171b13d9;border:1px solid #b99b64;box-shadow:inset 0 0 0 2px #34291b;border-radius:4px}
#game-shell #scene-map-button canvas{position:static;width:100%;height:100%;display:block}
#scene-map-button>span{position:absolute;top:-15px;left:0;right:0;font:12px var(--sans);color:#f2d9a7;text-shadow:0 1px 3px #000}
body[data-controls=arrows] #scene-map-button,body[data-controls=stick]:not(.hud-collapsed) #scene-map-button,body[data-minimap=off] #scene-map-button,body[data-minimap=off] #map-expand{display:none}
body[data-stick-side=right] #move-stick,body[data-stick-side=right] #quick-actions{left:auto;right:max(14px,env(safe-area-inset-right))}
body[data-stick-side=right] #quick-vitals{right:auto;left:14px}
body[data-stick-side=right] #scene-map-button{right:auto;left:12px}
body[data-controls=stick][data-stick-side=right].hud-collapsed #game-shell .hud-tabs{margin-left:10px;margin-right:auto}
body[data-controls=stick][data-stick-side=right].hud-collapsed #game-shell .story-peek{left:10px;right:166px}
body[data-controls=stick][data-stick-side=right].inside-inn.hud-collapsed #game-shell .story-peek{left:10px;right:10px}
@media(orientation:landscape) and (max-height:600px){
 #scene-map-button{top:92px;width:72px;height:72px}
 body[data-controls=stick][data-stick-side=right].hud-collapsed #game-shell .story-peek{left:10px;right:auto}
 body[data-controls=stick][data-stick-side=right].hud-collapsed #game-shell .world-tools{left:14px;right:236px}
 body[data-controls=stick][data-stick-side=right].inside-inn.hud-collapsed #inn-shortcuts{margin-left:10px;margin-right:auto}
 body[data-controls=stick][data-stick-side=right].inside-inn.hud-collapsed #game-shell .story-peek{left:auto;right:14px}
 /* Old dock and expanded analog dock use a single predictable column. */
 #game-shell .game-controls .hud-main{grid-template-columns:minmax(0,1fr);gap:6px}
 #game-shell .game-controls .hud-map-status{grid-column:1;grid-row:1;display:flex;align-items:center;gap:8px}
 #game-shell .game-controls .hud-primary{grid-column:1;grid-row:2;grid-template-columns:minmax(0,1fr) 44px;grid-template-rows:auto}
 #game-shell .game-controls .hud-motion{grid-column:1;grid-row:3}
 #game-shell .game-controls .combat-actions{grid-column:1;grid-row:2}
 #game-shell .game-controls .hud-tabs{grid-template-columns:repeat(3,minmax(0,1fr));margin-top:4px;padding:4px 0 0;border-left:0;gap:3px}
 #game-shell .game-controls .hud-tabs button{font-size:12px;min-width:0;min-height:44px;padding:4px;flex-direction:column}
 #game-shell .game-controls #party-status{flex-wrap:wrap}
 #game-shell .game-controls #party-status button{flex:1 1 42%;min-height:40px}
 body[data-controls=stick]:not(.hud-collapsed) #game-shell .game-controls{height:auto;max-height:calc(100dvh - 86px);overflow:auto;overscroll-behavior:contain;padding:8px}
 .inside-inn #game-shell .game-controls .hud-motion{grid-template-columns:1fr}
 #modal .menu-actions{display:grid;grid-template-columns:1fr 1fr;gap:6px}
 #modal .menu-actions button{min-width:0;padding:8px;text-align:left}
 #modal .menu-actions small{font-size:12px}
}

@media(orientation:landscape) and (max-height:600px){body[data-controls=stick]:not(.inside-inn) #game-shell .game-controls .hud-main{grid-template-columns:minmax(0,1fr)}}

/* Quiet map, clear corners: one navigation cluster, no opaque block over the world. */
#game-shell #scene-map-button{width:68px;height:68px;top:96px;right:12px;padding:3px;background:#151b1238;border-color:#bdab7045;box-shadow:none;opacity:.8}
#game-shell #scene-map-button #scene-map{opacity:.55}
#game-shell #scene-map-button>span{font-size:11px;opacity:.8}
#game-shell #scene-map-button:hover,#game-shell #scene-map-button:focus-visible{opacity:1;background:#151b12b0}
#game-shell #scene-map-button:hover #scene-map,#game-shell #scene-map-button:focus-visible #scene-map{opacity:.95}
body[data-stick-side=right] #game-shell #scene-map-button{right:auto;left:12px}
body[data-controls=stick].hud-collapsed #game-shell .hud-tools button{width:42px;min-width:42px;height:42px;min-height:42px;padding:4px}
body[data-controls=stick].hud-collapsed #game-shell .scene-top{top:max(6px,env(safe-area-inset-top));padding-top:0}
body[data-controls=stick].hud-collapsed #game-shell .heading-strip{margin-top:2px}
body[data-controls=stick].hud-collapsed #game-shell .hud-tabs button{min-height:46px;padding:5px 8px}
body[data-controls=stick].hud-collapsed #game-shell .story-peek{font-size:16px;line-height:1.3;max-height:45px;overflow:hidden}
@media(orientation:landscape) and (max-height:600px){
 #game-shell #scene-map-button{width:58px;height:58px;top:85px;right:max(12px,env(safe-area-inset-right))}
 body[data-stick-side=right] #game-shell #scene-map-button{left:max(12px,env(safe-area-inset-left));right:auto}
 body[data-controls=stick].hud-collapsed #game-shell .hud-tools button{width:40px;min-width:40px;height:40px;min-height:40px}
}

#guardian-status{position:absolute;z-index:8;left:12px;top:115px;max-width:calc(100% - 120px);width:auto;min-height:44px;padding:7px 10px;border:1px solid #a66d59;background:#181410dc;color:#e4cba1;font:14px var(--sans);text-align:left;line-height:1.4}
#guardian-status[hidden]{display:none}
@media(orientation:landscape) and (max-height:520px){#guardian-status{top:76px;max-width:50%}}

/* Four compact actions, mirrored with the existing handedness preference. */
#quick-actions button{width:64px;font-size:14px}
#quick-kick{border-color:#aa7654!important}
#panel-kick{font-size:14px;min-height:44px}
body.inside-inn #panel-kick{display:none}

/* Terrain correction release: legible controls and stable mobile slots. */
#game-shell button,#modal button,#game-drawer button{overflow-wrap:normal;word-break:normal;hyphens:none}
#quick-actions button{width:auto;min-width:58px;max-width:96px;font-size:14px;padding:7px 9px;line-height:1.25}
body[data-controls=stick].hud-collapsed #game-shell .hud-tabs{width:224px;max-width:calc(100vw - 130px)}
body[data-controls=stick].hud-collapsed #game-shell .hud-tabs button{font-size:13px;padding:4px;white-space:nowrap}
body[data-controls=stick].hud-collapsed #game-shell .story-peek{bottom:110px;max-height:64px;line-height:1.3;padding:5px 24px 5px 7px}
#game-shell #scene-map-button{top:112px;opacity:1;background:#151b1266}
#game-shell #scene-map-button #scene-map{opacity:1}
#quick-vitals{bottom:76px}
#quick-vitals [data-forces]{display:grid;gap:4px;width:124px;margin-top:6px;padding:7px 9px;background:#141c17e8;border:1px solid #8e805880;border-radius:5px;font:14px/1.2 var(--sans)}
#quick-vitals [data-forces][hidden]{display:none}
#quick-vitals [data-forces]>span{display:flex;justify-content:space-between;gap:5px}
#quick-vitals meter{appearance:none;display:block;width:100%;height:8px;border:0;border-radius:4px;background:#3a3d2d;overflow:hidden}
#quick-vitals meter::-webkit-meter-bar{background:#3a3d2d;border:0;border-radius:4px}
#quick-vitals meter::-webkit-meter-optimum-value{background:#bcba66;border-radius:4px}
#quick-vitals meter::-moz-meter-bar{background:#bcba66}
#quick-vitals[data-exhausted=true] meter::-webkit-meter-optimum-value{background:#bf7553}
#move-stick.running{border-color:#e5c673;box-shadow:0 0 0 2px #a58b4940}
#move-stick.running .stick-label{color:#ffe6a4}
#modal .modal-header{position:static;flex-shrink:0;margin:0;top:auto;padding:12px}
#modal .modal-body,#modal #modal-body{min-height:0;overflow-y:auto;padding:12px}
#modal .menu-actions button{min-height:56px;height:auto}
#modal .menu-actions strong{font-size:18px;line-height:1.2}
@media(orientation:landscape) and (max-height:600px){
 #game-shell #scene-map-button{top:96px;width:62px;height:62px}
 body[data-controls=stick].hud-collapsed #game-shell .story-peek{bottom:110px;max-height:52px;width:min(40vw,360px)}
 #game-shell .game-controls .hud-primary{align-content:start;grid-template-rows:auto auto}
 #game-shell .game-controls .hud-primary #interact{max-height:64px;align-self:start}
 #game-shell .game-controls #panel-kick{font-size:14px;padding:4px;min-width:58px}
 #game-shell .game-controls .hud-primary{grid-template-columns:minmax(0,1fr) 64px}
}
.arrival-toga-sheet{display:block;width:100%;max-height:280px;object-fit:contain;background:#28342d;border-radius:6px;margin:.6rem 0}#arrival-form fieldset{border:1px solid #786945;margin:.8rem 0;padding:.7rem}#arrival-form label{display:block;margin:.5rem 0}#arrival-form input[type=number]{width:5rem;margin-left:.8rem;font-size:1rem}#arrival-form input[type=checkbox]{width:22px;height:22px;vertical-align:middle}#arrival-form textarea{width:100%;font:inherit;padding:.6rem;box-sizing:border-box}
