/* Touch controls v2: in-run button layout for phones held sideways (mobile rework plan 2026-11-22 §4.3, approved).
   Only applies with the per-device switch (html.touch-v2 is set by touch-controls-v2.js) on a touch screen in landscape.
   One sheet owns the in-run HUD geometry; !important is needed only because the v1 layers (mobile-v40...v57.css) still
   load for switch-off phones. When v2 ships to everyone those layers are deleted and the !important can go.
   Layout at 844x390: FIRE Ø96 centred 88 px from the right safe edge and 94 px up; JUMP / DASH / ULT / BOMB Ø60 on an arc
   r = 100 around it at 180 / 222 / 264 / 306 degrees (12 px gaps); ammo count inside FIRE; MELEE / USE share one round slot
   left of SKILL (one at a time, USE first; owner 2026-11-24);
   stick base Ø120 floating in the left 45% (ghost ring at the default spot); PAUSE 44x44.
   Short screens: every right-hand button size and corner offset is multiplied by --t2-k (touch-controls-v2.js: 1 at
   420 px tall or more, down to 0.76), so the whole group shrinks toward the bottom-right corner. Labels keep 9 px. */
/* MELEE (owner 2026-11-24) exists in the markup for every device but shows only on a v2 phone while something is in melee
   reach (touch-controls-v2.js sets .reach-v2). PC and switch-off phones never see it. */
#mobile-controls#mobile-controls [data-mobile="bash"]:not(.reach-v2) {display: none !important}
@media (pointer:coarse) and (orientation:landscape) {
 html.touch-v2 {
  --t2-sl: max(12px, env(safe-area-inset-left));
  --t2-sr: max(12px, env(safe-area-inset-right));
  --t2-sb: max(8px, env(safe-area-inset-bottom));
  --t2-st: max(8px, env(safe-area-inset-top));
  --t2-k: 1;
 }
 html.touch-v2 #mobile-controls, html.touch-v2 #mobile-controls .mobile-actions {transform: none !important; filter: none !important; contain: none !important}
 html.touch-v2 #mobile-controls .mobile-actions {position: static !important; width: auto !important; height: auto !important}

 /* Buttons: fixed to the safe edges so every phone width gets the same thumb geometry. */
 html.touch-v2 #mobile-controls [data-mobile="fire"],
 html.touch-v2 #mobile-controls [data-mobile="jump"],
 html.touch-v2 #mobile-controls [data-mobile="grenade"],
 html.touch-v2 #mobile-controls [data-mobile="bash"],
 html.touch-v2 #mobile-controls #dash-skill,
 html.touch-v2 #mobile-controls #ultimate-skill,
 html.touch-v2 #mobile-interact-v2 {
  position: fixed !important; left: auto !important; top: auto !important; margin: 0 !important; transform: none !important;
  width: calc(60px * var(--t2-k)) !important; height: calc(60px * var(--t2-k)) !important; min-width: 0 !important; min-height: 0 !important; border-radius: 50% !important;
  opacity: .85 !important; transition: transform 80ms ease-out, opacity 80ms ease-out; touch-action: none;
 }
 html.touch-v2 #mobile-controls [data-mobile="fire"] {width: calc(96px * var(--t2-k)) !important; height: calc(96px * var(--t2-k)) !important; right: calc(var(--t2-sr) + 40px * var(--t2-k)) !important; bottom: calc(var(--t2-sb) + 46px * var(--t2-k)) !important}
 html.touch-v2 #mobile-controls [data-mobile="jump"] {right: calc(var(--t2-sr) + 158px * var(--t2-k)) !important; bottom: calc(var(--t2-sb) + 64px * var(--t2-k)) !important}
 html.touch-v2 #mobile-controls #dash-skill {right: calc(var(--t2-sr) + 132px * var(--t2-k)) !important; bottom: calc(var(--t2-sb) + 131px * var(--t2-k)) !important}
 html.touch-v2 #mobile-controls #ultimate-skill {right: calc(var(--t2-sr) + 69px * var(--t2-k)) !important; bottom: calc(var(--t2-sb) + 164px * var(--t2-k)) !important}
 html.touch-v2 #mobile-controls [data-mobile="grenade"] {right: calc(var(--t2-sr) + -1px * var(--t2-k)) !important; bottom: calc(var(--t2-sb) + 145px * var(--t2-k)) !important}
 /* MELEE and USE share one slot, one thumb-slide left of the arc (40 px clear of SKILL); only one shows at a time. */
 html.touch-v2 #mobile-controls [data-mobile="bash"] {right: calc(var(--t2-sr) + 232px * var(--t2-k)) !important; bottom: calc(var(--t2-sb) + 128px * var(--t2-k)) !important; opacity: .92 !important}
 html.touch-v2 #mobile-controls :is([data-mobile], #dash-skill, #ultimate-skill):is(.held, :active):not(.cooldown) {opacity: 1 !important; transform: scale(.94) !important}

 /* Ammo sits inside FIRE (owner 2026-11-24: 'กระสุนเอาไว้ในปืน'); the game already writes the count into #mobile-ammo.
    An empty magazine reloads by itself. */
 html.touch-v2 #mobile-controls #mobile-ammo {
  position: fixed !important; left: auto !important; top: auto !important; right: calc(var(--t2-sr) + 40px * var(--t2-k)) !important; bottom: calc(var(--t2-sb) + 58px * var(--t2-k)) !important; z-index: 3 !important;
  width: calc(96px * var(--t2-k)) !important; height: 16px !important; margin: 0 !important; padding: 0 !important; transform: none !important; display: flex !important; align-items: center; justify-content: center;
  border: 0 !important; background: none !important; color: #e8a35b !important; text-shadow: 0 1px 0 #0b1115;
  font: 13px/1 "Ops Pixel", monospace !important; letter-spacing: .04em; opacity: 1 !important; pointer-events: none !important;
 }

 /* USE (interact-v1.js) appears only near something usable: a round button in the MELEE slot with an amber ring (it is
    contextual), the owner's action icon and one short word under it, like the other buttons. */
 html.touch-v2 #mobile-interact-v2 {right: calc(var(--t2-sr) + 232px * var(--t2-k)) !important; bottom: calc(var(--t2-sb) + 128px * var(--t2-k)) !important; max-width: none !important; padding: 0 !important; gap: 0 !important;
  flex-direction: column !important; align-items: center !important; justify-content: flex-start !important; z-index: 6 !important;
  background: rgba(11, 17, 21, .8) !important; border: 3px solid #e8a35b !important; box-shadow: 0 2px 0 rgba(0, 0, 0, .4) !important; opacity: .92 !important}
 html.touch-v2 #mobile-interact-v2[hidden] {display: none !important}
 html.touch-v2 #mobile-interact-v2 img {width: 48% !important; height: 48% !important; margin-top: 12% !important}
 html.touch-v2 #mobile-interact-v2 svg {width: 40% !important; height: 40% !important; margin-top: 16% !important}
 html.touch-v2 #mobile-interact-v2 span {position: absolute; left: 0; right: 0; bottom: 6px; text-align: center !important; overflow: visible !important; font: 9px/1 "Ops Pixel", monospace !important; letter-spacing: .06em}
 html.touch-v2 #mobile-interact-v2:active {opacity: 1 !important; transform: scale(.94) !important}

 /* Top right (owner 2026-11-24): PAUSE stays the code-drawn system box (44x44), a shorter SCORE, no MISSION LOOT panel (too busy on a phone). */
 html.touch-v2 body #pause {width: 44px !important; height: 44px !important; min-width: 44px !important; min-height: 44px !important}
 html.touch-v2 body #hud-score {height: 30px !important; min-height: 0 !important; padding-top: 0 !important; padding-bottom: 0 !important; display: flex !important; align-items: center !important; align-self: center !important}
 html.touch-v2 body #hud-loot {display: none !important}

 /* Stick: touch anywhere in the left 45% below the top bar; the base appears under the thumb. Code-drawn, not an icon (owner 2026-11-24). */
 html.touch-v2 #mobile-controls #move-zone {position: fixed !important; left: 0 !important; top: 64px !important; bottom: 0 !important; right: auto !important; width: 45vw !important; height: auto !important; transform: none !important}
 html.touch-v2 #mobile-controls #move-stick {
  position: absolute !important; width: 120px !important; height: 120px !important; margin: 0 !important; transform: none !important;
  left: calc(var(--t2-sl) + 30px) !important; top: auto !important; bottom: calc(var(--t2-sb) + 35px) !important; right: auto !important;
  opacity: .38 !important; transition: opacity 120ms ease-out; pointer-events: none;
 }
 html.touch-v2 #mobile-controls #move-stick.floating {left: calc(var(--t2-x) - 60px) !important; top: calc(var(--t2-y) - 60px) !important; bottom: auto !important}
 html.touch-v2 #mobile-controls #move-stick.held {opacity: .95 !important}
 html.touch-v2 #mobile-controls #move-stick .joystick-art {position: absolute; inset: 0; width: 100% !important; height: 100% !important}
 html.touch-v2 #mobile-controls #stick-knob {
  position: absolute !important; left: 34px !important; top: 34px !important; right: auto !important; bottom: auto !important; margin: 0 !important;
  width: 52px !important; height: 52px !important; border-radius: 50% !important;
 }

 /* Skin: the owner's icon set (2026-11-24, 'mobile-controller-D-final-selected', pixel cream + amber). Dark disc, cream
    ring, icon above a small label; FIRE keeps the weapon art with an amber ring. Old ring/glyph layers are hidden.
    The doubled #mobile-controls id outweighs the v1 layers; :where() keeps the shared rule below the per-button ones. */
 html.touch-v2 #mobile-controls#mobile-controls :where([data-mobile="jump"], [data-mobile="grenade"], [data-mobile="fire"], [data-mobile="bash"], #dash-skill, #ultimate-skill) {
  background-color: rgba(11, 17, 21, .8) !important; background-repeat: no-repeat !important; background-position: center 30% !important; background-size: 56% !important;
  border: 2px solid #e8e0cc !important; box-shadow: 0 2px 0 rgba(0, 0, 0, .4) !important; color: #e8e0cc !important; padding: 0 !important; overflow: visible !important;
 }
 html.touch-v2 #mobile-controls#mobile-controls :where([data-mobile="jump"], [data-mobile="grenade"], [data-mobile="fire"], #dash-skill, #ultimate-skill) > :is(svg.touch-icon, .mobile-pixel-ring, .mobile-pixel-glyph, .pc-source-ring, img, span) {display: none !important}
 html.touch-v2 #mobile-controls#mobile-controls [data-mobile="jump"] {background-image: url(assets/touch-v2/jump-v1.webp) !important}
 html.touch-v2 #mobile-controls#mobile-controls [data-mobile="grenade"] {background-image: url(assets/touch-v2/bomb-v1.webp) !important}
 html.touch-v2 #mobile-controls#mobile-controls [data-mobile="fire"] {border: 3px solid #e8a35b !important}
 /* Operative skill art (masked, cream) sits where the icon sits on the other buttons. */
 html.touch-v2 #mobile-controls#mobile-controls :is(#dash-skill, #ultimate-skill) > .pc-action-art {left: 24% !important; top: 10% !important; width: 52% !important; height: 52% !important; right: auto !important; bottom: auto !important}
 html.touch-v2 #mobile-controls#mobile-controls [data-mobile="fire"] > .pc-action-art {left: 18% !important; top: 16% !important; width: 64% !important; height: 46% !important; right: auto !important; bottom: auto !important}
 html.touch-v2 #mobile-controls#mobile-controls :where([data-mobile="jump"], [data-mobile="grenade"], [data-mobile="fire"], [data-mobile="bash"], #dash-skill, #ultimate-skill)::after {
  position: absolute !important; left: 0 !important; right: 0 !important; top: auto !important; bottom: 6px !important; display: block !important; width: auto !important; height: auto !important;
  background: none !important; border: 0 !important; transform: none !important; text-align: center; pointer-events: none;
  font: 9px/1 "Ops Pixel", monospace !important; letter-spacing: .06em; color: #e8e0cc !important;
 }
 html.touch-v2 #mobile-controls#mobile-controls [data-mobile="jump"]::after {content: "JUMP" !important}
 html.touch-v2 #mobile-controls#mobile-controls [data-mobile="grenade"]::after {content: "BOMB" !important}
 html.touch-v2 #mobile-controls#mobile-controls [data-mobile="bash"]::after {content: "MELEE" !important}
 /* MELEE has no owner icon yet: the game's code-drawn pixel blade (TOUCH_ICONS.bash) in cream, where the icons sit. */
 html.touch-v2 #mobile-controls#mobile-controls [data-mobile="bash"] > svg.touch-icon {display: block !important; position: absolute !important; left: 27% !important; top: 13% !important; width: 46% !important; height: 46% !important; margin: 0 !important; transform: none !important; color: #e8e0cc !important; filter: none !important; opacity: 1 !important}
 html.touch-v2 #mobile-controls#mobile-controls [data-mobile="bash"] > svg.touch-icon path {fill: #e8e0cc !important; stroke: none !important}
 html.touch-v2 #mobile-controls#mobile-controls [data-mobile="bash"] > :is(.mobile-pixel-ring, .mobile-pixel-glyph, .pc-source-ring, img, span) {display: none !important}
 html.touch-v2 #mobile-controls#mobile-controls #dash-skill::after {content: "SKILL" !important}
 html.touch-v2 #mobile-controls#mobile-controls #ultimate-skill::after {content: "ULT" !important}
 html.touch-v2 #mobile-controls#mobile-controls [data-mobile="fire"]::after {content: none !important}
 html.touch-v2 #mobile-controls#mobile-controls #mobile-bombs {position: absolute !important; right: -4px !important; top: -4px !important; left: auto !important; bottom: auto !important; min-width: 18px; height: 18px; padding: 0 3px; border-radius: 9px; background: #e8a35b !important; color: #0b1115 !important; font: 11px/18px "Ops Pixel", monospace !important; text-align: center}
 /* Cooldown: dim the button and show the seconds left (the state text the game already writes). ULT ready = amber ring. */
 html.touch-v2 #mobile-controls#mobile-controls :is(#dash-skill, #ultimate-skill).cooldown {opacity: .5 !important}
 html.touch-v2 #mobile-controls#mobile-controls :is(#dash-skill, #ultimate-skill).cooldown > .pc-action-art {opacity: .35}
 html.touch-v2 #mobile-controls#mobile-controls :is(#dash-skill, #ultimate-skill).cooldown > small {display: flex !important; position: absolute !important; inset: 0 !important; align-items: center; justify-content: center; padding-bottom: 8px; font: 15px/1 "Ops Pixel", monospace !important; color: #e8e0cc !important; background: none !important; transform: none !important}
 html.touch-v2 #mobile-controls#mobile-controls #ultimate-skill:not(.cooldown) {border-color: #e8a35b !important}

}

/* Settings → MOBILE CONTROLS NEW / OLD (any touch screen, mobile-v2-switch.js) and AIM ASSIST ON / OFF (v2 phones,
   touch-controls-v2.js), owner 2026-11-24. Styled like
   the AUDIO box above it, with the shared corner token. */
:is(#touch-assist-v2, #mobile-controls-setting-v2, #play-stats-setting-v1):not([hidden]) {display: grid; gap: 10px; margin: 18px 0; padding: 18px; background: var(--a73-panel); border: 1px solid var(--a73-line); color: var(--a73-text); font: 13px/1.5 var(--a73-font); font-synthesis: none}
:is(#touch-assist-v2, #mobile-controls-setting-v2, #play-stats-setting-v1) h3 {font: inherit; color: var(--a73-amber); margin: 0; letter-spacing: .5px}
:is(#touch-assist-v2, #mobile-controls-setting-v2, #play-stats-setting-v1) .assist-choices-v2 {display: grid; grid-template-columns: 1fr 1fr; gap: 10px}
:is(#touch-assist-v2, #mobile-controls-setting-v2, #play-stats-setting-v1) .assist-choices-v2 button {min-height: 44px; margin: 0; padding: 0 12px; border: 1px solid var(--a73-line); border-radius: var(--a73-corner, 0px); background: var(--a73-bg); color: var(--a73-text); font: inherit; letter-spacing: .5px; cursor: pointer}
:is(#touch-assist-v2, #mobile-controls-setting-v2, #play-stats-setting-v1) .assist-choices-v2 button[aria-checked="true"] {background: var(--a73-amber); border-color: var(--a73-amber); color: var(--a73-bg)}
:is(#touch-assist-v2, #mobile-controls-setting-v2, #play-stats-setting-v1) .assist-choices-v2 button:focus-visible {outline: 3px solid var(--a73-text); outline-offset: 3px}
:is(#touch-assist-v2, #mobile-controls-setting-v2, #play-stats-setting-v1) p {margin: 0; font-size: 11px; opacity: .8}

/* Main-menu notice for touch screens still on OLD controls (mobile-v2-switch.js builds it). Armory tokens, like the
   Settings boxes above. Sits above the menu footer and never blocks it. */
#mobile-v2-nudge:not([hidden]) {position: fixed; z-index: 60; left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); bottom: calc(env(safe-area-inset-bottom) + 84px); max-width: 420px; margin: 0 auto; display: grid; gap: 8px; padding: 14px 16px; background: var(--a73-panel); border: 1px solid var(--a73-amber); border-radius: var(--a73-corner, 0px); box-shadow: 0 8px 24px rgba(0, 0, 0, .55); color: var(--a73-text); font: 13px/1.45 var(--a73-font); font-synthesis: none}
#mobile-v2-nudge h3 {font: inherit; color: var(--a73-amber); margin: 0; letter-spacing: .5px}
#mobile-v2-nudge p {margin: 0; font-size: 11px; opacity: .85}
#mobile-v2-nudge .nudge-choices-v2 {display: grid; grid-template-columns: 1fr 1fr; gap: 10px}
#mobile-v2-nudge button {min-height: 44px; margin: 0; padding: 0 10px; border: 1px solid var(--a73-line); border-radius: var(--a73-corner, 0px); background: var(--a73-bg); color: var(--a73-text); font: inherit; letter-spacing: .5px; cursor: pointer}
#mobile-v2-nudge button[data-nudge="new"] {background: var(--a73-amber); border-color: var(--a73-amber); color: var(--a73-bg)}
#mobile-v2-nudge button:focus-visible {outline: 3px solid var(--a73-text); outline-offset: 3px}
