/* Mobile controls own their gestures; menus and reading panels retain native scrolling. */
.touch-controls{position:fixed;inset:0;z-index:25;pointer-events:none;--touch-left:max(14px,env(safe-area-inset-left));--touch-right:max(14px,env(safe-area-inset-right));--touch-bottom:max(10px,env(safe-area-inset-bottom));--touch-top:max(12px,env(safe-area-inset-top));color:#f1ecd7;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
.touch-controls[hidden]{display:none!important}
.touch-controls button{pointer-events:auto;touch-action:none;min-width:46px;min-height:46px;margin:0;padding:8px 10px;border:1px solid rgba(213,231,198,.43);border-radius:12px;background:rgba(13,30,24,.84);color:#e9edd9;font:650 13px/1.2 var(--font,system-ui);box-shadow:0 3px 0 rgba(1,11,9,.8),inset 0 1px 0 rgba(223,239,202,.1);text-shadow:0 1px 3px #0007;-webkit-tap-highlight-color:transparent;cursor:pointer}
.touch-controls button:focus-visible{outline:3px solid #f4d69d;outline-offset:3px}
.touch-controls button:disabled{opacity:.52;cursor:default}
.touch-controls button.touch-pressed,.touch-controls button[aria-pressed=true]{border-color:#e4c07e;background:rgba(97,82,44,.88);box-shadow:0 1px 0 #07120d,inset 0 1px 6px #edc78224;color:#fff0bd}
.touch-controls button>span[aria-hidden]{font-size:20px;line-height:1;display:block;margin-bottom:3px}
.touch-look{position:absolute;left:39%;right:0;top:165px;bottom:110px;pointer-events:auto;touch-action:none;-webkit-touch-callout:none}
.touch-look-label{position:absolute;left:20%;right:15%;top:35%;text-align:center;font:10px/1.4 var(--mono,monospace);letter-spacing:.14em;color:#e5eac282;text-shadow:0 1px 4px #000;pointer-events:none;transition:opacity .3s}
.touch-look-learned .touch-look-label{opacity:0}
.touch-tools{position:absolute;z-index:3;left:var(--touch-left);right:var(--touch-right);top:calc(var(--touch-top) + 108px);display:flex;justify-content:center;gap:6px;pointer-events:none}
.touch-tools button{flex:1;max-width:76px;min-height:48px;padding:5px 7px;font-size:12px;display:flex;gap:5px;align-items:center;justify-content:center;background:rgba(11,25,20,.88);border-radius:9px}
.touch-tools button>span[aria-hidden]{font-size:17px;margin:0}
.touch-tools button.touch-help-ready{border-color:#f4cf8b;color:#ffe0a4}
.touch-movement{position:absolute;z-index:2;left:var(--touch-left);bottom:calc(var(--touch-bottom) + 85px);width:158px;pointer-events:none}
.touch-move-options{display:flex;gap:5px;margin-bottom:11px;pointer-events:none}
.touch-move-options button{min-width:0;flex:1;min-height:43px;padding:8px 4px;font-size:11px;border-radius:9px}
.touch-controls .touch-stick{position:relative;display:block;width:138px;height:138px;margin:0 auto;padding:0;border:1px solid rgba(216,232,198,.33);border-radius:50%;background:radial-gradient(circle,rgba(30,53,42,.33) 35%,rgba(10,25,20,.68) 69%,rgba(173,194,155,.16) 70%,rgba(12,27,21,.4) 74%);box-shadow:0 4px 24px #0003;overflow:visible;touch-action:none}
.touch-stick-ring{position:absolute;inset:23px;border:1px solid #bfcead40;border-radius:50%;pointer-events:none}
.touch-stick-cross{position:absolute;inset:27px;pointer-events:none;background:linear-gradient(90deg,transparent calc(50% - .5px),#e1e9bd21 calc(50% - .5px),#e1e9bd21 calc(50% + .5px),transparent calc(50% + .5px)),linear-gradient(0deg,transparent calc(50% - .5px),#e1e9bd21 calc(50% - .5px),#e1e9bd21 calc(50% + .5px),transparent calc(50% + .5px))}
.touch-stick-knob{position:absolute;left:calc(50% - 25px);top:calc(50% - 25px);width:50px;height:50px;border:1px solid #d9e1b885;border-radius:50%;background:radial-gradient(circle at 40% 30%,#80977ca8,#304d3bdc);box-shadow:0 5px 12px #0005,inset 0 1px 0 #f9ffdd38;pointer-events:none;will-change:transform}
.touch-stick-label{position:absolute;bottom:12px;left:0;right:0;text-align:center;font:9px var(--mono,monospace);letter-spacing:.13em;color:#d1dbbb8c;pointer-events:none}
.touch-stick.touch-pressed .touch-stick-label{opacity:.35}
.touch-actions{position:absolute;z-index:2;right:var(--touch-right);bottom:calc(var(--touch-bottom) + 85px);width:158px;display:grid;grid-template-columns:1fr 1fr;gap:8px;pointer-events:none}
.touch-actions button{min-height:47px}
.touch-actions .touch-interact{grid-column:1/-1;min-height:58px;border-color:#9bbaa6;background:rgba(30,53,43,.9);padding:8px 10px;text-align:center}
.touch-action-title{display:block;font-size:15px;letter-spacing:.015em}
.touch-context{display:block;margin-top:4px;color:#d4dec8;font-size:10px;font-weight:450;line-height:1.3;overflow:hidden;max-height:2.6em}
.touch-interact.touch-ready{border-color:#f0ce86;background:rgba(101,80,40,.91)}
.touch-actions .touch-use,.touch-actions [data-touch-role=guard]{min-height:63px}
.touch-actions [data-touch-action=uv]{color:#d9b6ff}
.touch-actions .touch-locked{border-style:dashed}

.touch-mode .mobile-notice,.touch-mode #pointer-hint,.touch-mode .hud-toolbar,.touch-mode .equipment-help{display:none!important}
.touch-mode .game-hud{--safe-x:14px;--safe-y:12px}
.touch-mode .objective-panel{left:max(14px,env(safe-area-inset-left));top:max(12px,env(safe-area-inset-top));width:calc(100% - 151px);max-width:380px;padding:0}
.touch-mode .hud-location{font-size:10px;letter-spacing:.04em;padding-bottom:6px;gap:6px}
.touch-mode .objective-panel .eyebrow{font-size:9px;letter-spacing:.05em;line-height:1.3}
.touch-mode .objective-panel h2{font-size:16px;line-height:1.18;letter-spacing:-.025em;margin-top:4px;max-width:100%}
.touch-mode .objective-panel>p:not(.eyebrow){font-size:12px;line-height:1.35;margin-top:5px;max-width:100%;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.touch-mode .checkpoint-label{display:none}
.touch-mode .vitals-panel{top:max(15px,env(safe-area-inset-top));right:max(14px,env(safe-area-inset-right));width:110px}
.touch-mode .vital-heading{font-size:9px;letter-spacing:.02em}
.touch-mode .vital-heading strong{font-size:20px}
.touch-mode .vital-total{font-size:9px}
.touch-mode .vital-heading>span:last-child{white-space:nowrap;flex-shrink:0}
.touch-mode .health-track{height:6px;margin-top:7px}
.touch-mode .stamina-line{font-size:8px;gap:5px;margin-top:7px}
.touch-mode .stamina-track{height:4px}
.touch-mode .threat-label{font-size:10px;line-height:1.4;margin-top:8px;letter-spacing:0}
.touch-mode .equipment-dock{position:absolute;left:50%;bottom:max(8px,env(safe-area-inset-bottom));width:calc(100% - 28px);max-width:420px;transform:translateX(-50%);pointer-events:auto}
.touch-mode .equipment-topline{font-size:9px;letter-spacing:.035em;padding:0 1px 6px;gap:8px}
.touch-mode .equipment-topline>span:first-child{display:none}
.touch-mode .equipment-topline .ammo-label{margin-left:auto;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.touch-mode .weapon-slots{gap:6px;pointer-events:auto}
.touch-mode .weapon-slot{min-width:0;height:57px;min-height:48px;border-radius:9px;pointer-events:auto;touch-action:manipulation;padding:4px}
.touch-mode .weapon-slot kbd{display:none}
.touch-mode .weapon-slot .slot-icon{font-size:22px;line-height:1.1;width:25px;height:25px;margin:0 0 4px}
.touch-mode .weapon-slot>span:last-child,.touch-mode .weapon-slot .slot-name{font-size:10px;letter-spacing:.015em;line-height:1.1}
.touch-mode .interact-prompt{top:43%;max-width:calc(100vw - 36px);width:max-content;padding:7px 11px;font-size:13px;line-height:1.4;background:rgba(7,19,13,.91);pointer-events:none}
.touch-mode .interact-prompt kbd{display:none}
.touch-mode .subtitle,.touch-mode .npc-caption{bottom:calc(max(10px,env(safe-area-inset-bottom)) + 282px);max-width:calc(100vw - 30px);width:max-content;padding:9px 12px;font-size:14px;line-height:1.45;pointer-events:none}
.touch-mode .uv-indicator{left:auto;right:max(14px,env(safe-area-inset-right));bottom:calc(max(10px,env(safe-area-inset-bottom)) + 276px);font-size:10px;letter-spacing:.04em;padding:5px 8px;pointer-events:none}
.touch-mode .toast-stack{top:calc(max(12px,env(safe-area-inset-top)) + 168px);left:max(14px,env(safe-area-inset-left));right:auto;width:min(260px,70vw);pointer-events:none}
.touch-mode .toast,.touch-mode .toast-stack>div{font-size:12px;line-height:1.4;padding:9px 12px}
.touch-mode .toast-stack>div:nth-child(n+3){display:none}

.touch-mode .overlay{padding:max(10px,env(safe-area-inset-top)) max(10px,env(safe-area-inset-right)) max(10px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left));touch-action:pan-y;overscroll-behavior:contain}
.touch-mode .modal,.touch-mode .modal-wide{width:min(760px,100%);max-width:100%;max-height:calc(100dvh - max(10px,env(safe-area-inset-top)) - max(10px,env(safe-area-inset-bottom)));overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;-webkit-overflow-scrolling:touch;border-radius:12px}
.touch-mode .modal-header{padding:20px 18px 15px;gap:14px;position:relative}
.touch-mode .modal-header h2,.touch-mode .modal>h2{font-size:27px;line-height:1.15}
.touch-mode .modal-header .eyebrow{font-size:11px;letter-spacing:.07em}
.touch-mode .modal-header p.muted{font-size:14px;line-height:1.5}
.touch-mode .icon-close,.touch-mode .modal-close,.touch-mode .modal-header .close-btn{min-width:44px;width:44px;min-height:44px;height:44px;padding:0;flex-shrink:0;font-size:27px;touch-action:manipulation}
.touch-mode .modal-body{padding:18px;font-size:16px;line-height:1.6;overflow-wrap:anywhere}
.touch-mode .modal-body .story-paragraph,.touch-mode .modal-body>p,.touch-mode .journal-entry p,.touch-mode .clue-card p,.touch-mode .hint-card p{font-size:16px;line-height:1.6}
.touch-mode .modal-body h3,.touch-mode .journal-entry h3{font-size:18px;line-height:1.3}
.touch-mode .modal-body .muted,.touch-mode .inventory-layout>div>p.muted{font-size:14px;line-height:1.5}
.touch-mode .modal-footer{padding:14px 18px;gap:10px;flex-wrap:wrap}
.touch-mode .modal-footer .btn,.touch-mode .modal .btn{min-height:46px;font-size:14px;padding:11px 16px;touch-action:manipulation}
.touch-mode .modal-footer>.muted{font-size:12px;line-height:1.4}
.touch-mode .inventory-layout,.touch-mode .settings-grid,.touch-mode .help-grid{grid-template-columns:1fr;gap:22px}
.touch-mode .inventory-grid{grid-template-columns:1fr 1fr;gap:10px}
.touch-mode .inventory-grid .item-card{min-height:118px;padding:14px;font-size:14px;touch-action:manipulation}
.touch-mode .item-card strong{font-size:16px;line-height:1.25}
.touch-mode .item-card small,.touch-mode .item-description{font-size:13px;line-height:1.5}
.touch-mode .inventory-slots{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.touch-mode .inventory-slots .btn{justify-content:flex-start;gap:7px;min-width:0;font-size:13px}
.touch-mode .assembly-panel{padding:18px;grid-template-columns:1fr}
.touch-mode .assembly-panel p,.touch-mode .part-row small{font-size:13px;line-height:1.5}
.touch-mode .part-row strong{font-size:15px}
.touch-mode .binding-list{max-height:none;overflow:visible}
.touch-mode .binding-list .key-row,.touch-mode .key-row{font-size:14px;gap:12px;padding:10px 0}
.touch-mode .binding-list .binding-btn,.touch-mode .key-row button{min-height:44px;min-width:92px;font-size:13px;padding:9px 12px}
.touch-mode .field,.touch-mode .field label,.touch-mode .field>span,.touch-mode .toggle{font-size:15px;line-height:1.5}
.touch-mode .modal input[type=range]{min-height:36px;touch-action:pan-y}
.touch-mode .modal input[type=checkbox]{width:24px;height:24px}
.touch-mode .modal select,.touch-mode .modal input[type=text],.touch-mode .modal input[type=number],.touch-mode .modal textarea{font-size:16px;min-height:44px}
.touch-mode .settings-grid>div+div{border-top:1px solid var(--line);padding-top:18px}
.touch-mode .map-grid{touch-action:pan-x pan-y;overscroll-behavior:contain}
.touch-mode .menu-screen{justify-content:flex-start;overflow-y:auto;overflow-x:hidden;touch-action:pan-y;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding:max(20px,env(safe-area-inset-top)) max(22px,env(safe-area-inset-right)) max(22px,env(safe-area-inset-bottom)) max(22px,env(safe-area-inset-left))}
.touch-mode .menu-topline{position:relative;left:auto;top:auto;font-size:10px;flex-shrink:0;align-self:flex-start}
.touch-mode .menu-content{padding:27px 0 22px;margin:0;max-width:480px;width:100%;flex-shrink:0}
.touch-mode .chapter-label{font-size:10px;line-height:1.5;letter-spacing:.07em;flex-wrap:wrap}
.touch-mode #game-title{font-size:clamp(68px,18vw,100px);margin:22px 0 20px}
.touch-mode .menu-hook{font-size:20px;line-height:1.3}
.touch-mode .menu-story{font-size:14px;line-height:1.6;max-width:440px;margin-top:18px}
.touch-mode .menu-mission{font-size:14px;line-height:1.5;max-width:440px}
.touch-mode .menu-actions{margin-top:23px;width:100%;max-width:360px}
.touch-mode .menu-start{min-height:54px;font-size:16px}
.touch-mode .menu-secondary-actions{flex-wrap:wrap;gap:8px 16px}
.touch-mode .menu-secondary-actions .btn{font-size:14px;min-height:44px}
.touch-mode .menu-footer{position:relative;left:auto;bottom:auto;display:flex;flex-direction:column;gap:7px;font-size:10px;letter-spacing:.02em;padding-bottom:10px;flex-shrink:0}
.touch-mode .menu-world-note{display:none}
.touch-mode .ending-overlay{overflow-y:auto;align-items:flex-start;touch-action:pan-y}
.touch-mode .ending-content{margin:auto;padding:24px 16px;max-width:660px;width:100%}
.touch-mode .ending-content h1{font-size:clamp(48px,13vw,76px)}
.touch-mode .ending-content>p{font-size:16px;line-height:1.6}
.touch-mode .ending-content blockquote{font-size:14px;line-height:1.5}
.touch-mode .ending-actions{display:flex;flex-wrap:wrap;gap:10px}
.touch-mode .ending-actions .btn{min-height:48px;font-size:15px}

@media(orientation:landscape) and (min-width:650px){
  .touch-controls{--touch-left:max(17px,env(safe-area-inset-left));--touch-right:max(17px,env(safe-area-inset-right))}
  .touch-tools{left:50%;right:auto;transform:translateX(-50%);top:var(--touch-top);width:292px;gap:5px}
  .touch-tools button{min-height:44px;min-width:44px;padding:5px;font-size:11px;flex-direction:column;gap:2px}
  .touch-tools button>span[aria-hidden]{font-size:15px}
  .touch-look{left:33%;top:67px;bottom:90px}
  .touch-movement{bottom:calc(var(--touch-bottom) + 8px);width:158px}
  .touch-controls .touch-stick{width:128px;height:128px}
  .touch-move-options{margin-bottom:8px}
  .touch-move-options button{min-height:42px}
  .touch-actions{bottom:calc(var(--touch-bottom) + 8px);width:152px;gap:6px}
  .touch-actions .touch-interact{min-height:52px}
  .touch-actions .touch-use,.touch-actions [data-touch-role=guard]{min-height:52px}
  .touch-actions button{min-height:44px}
  .touch-mode .objective-panel{max-width:calc(50vw - 166px);width:255px}
  .touch-mode .objective-panel h2{font-size:15px}
  .touch-mode .objective-panel>p:not(.eyebrow){font-size:11px;line-height:1.35;-webkit-line-clamp:2}
  .touch-mode .objective-panel .hud-location{font-size:9px;padding-bottom:4px}
  .touch-mode .objective-panel .eyebrow{font-size:8px}
  .touch-mode .vitals-panel{width:120px;top:max(12px,env(safe-area-inset-top))}
  .touch-mode .equipment-dock{width:calc(100vw - 386px);max-width:380px;min-width:234px;bottom:max(10px,env(safe-area-inset-bottom))}
  .touch-mode .equipment-topline{font-size:9px}
  .touch-mode .weapon-slot{height:52px}
  .touch-mode .weapon-slot .slot-icon{font-size:20px;height:21px;width:22px;margin-bottom:2px}
  .touch-mode .weapon-slot>span:last-child{font-size:9px}
  .touch-mode .interact-prompt{top:42%;font-size:13px;max-width:calc(100vw - 320px)}
  .touch-mode .subtitle,.touch-mode .npc-caption{bottom:calc(max(10px,env(safe-area-inset-bottom)) + 87px);max-width:calc(100vw - 360px);font-size:13px;line-height:1.45;padding:8px 11px}
  .touch-mode .uv-indicator{bottom:calc(max(10px,env(safe-area-inset-bottom)) + 190px);font-size:9px}
  .touch-mode .toast-stack{top:75px;width:240px;left:50%;transform:translateX(-50%)}
  .touch-mode .toast-stack>div:nth-child(n+2){display:none}
  .touch-mode .menu-content{max-width:560px;padding-top:20px}
  .touch-mode #game-title{font-size:76px}
  .touch-mode .menu-story{max-width:520px}
  .touch-mode .menu-footer{font-size:10px}
}
@media(max-width:370px) and (orientation:portrait){
  .touch-controls{--touch-left:max(9px,env(safe-area-inset-left));--touch-right:max(9px,env(safe-area-inset-right))}
  .touch-movement{width:145px}
  .touch-controls .touch-stick{width:128px;height:128px}
  .touch-actions{width:145px;gap:6px}
  .touch-tools{gap:4px}
  .touch-tools button{font-size:11px;padding:5px 4px}
  .touch-mode .objective-panel{left:10px;width:calc(100% - 137px)}
  .touch-mode .objective-panel h2{font-size:15px}
  .touch-mode .vitals-panel{right:10px;width:105px}
  .touch-mode .weapon-slot>span:last-child{font-size:9px}
}
@media(orientation:portrait){.touch-mode .vital-total{display:none}}
@media(max-height:600px) and (orientation:portrait){
  .touch-tools{top:calc(var(--touch-top) + 91px)}
  .touch-look{top:150px}
  .touch-mode .objective-panel>p:not(.eyebrow){-webkit-line-clamp:1}
  .touch-mode .subtitle,.touch-mode .npc-caption{bottom:calc(max(10px,env(safe-area-inset-bottom)) + 279px);font-size:12px}
  .touch-mode .uv-indicator{display:none}
}
@media(prefers-reduced-motion:reduce){.touch-look-label{transition:none}.touch-stick-knob{will-change:auto}}
