/* Iron Rift — mobile touch layer styles v2 (redesign 2026-11-21).
 * Layout = thumb zones, not a button stack:
 *  - right thumb: look drag everywhere; FIRE (92px) low in its arc,
 *    ADS/JUMP beside it, RLD above — all clear of the game's panels
 *    (style card top-right, ammo bottom-right, vitals bottom-left).
 *  - left thumb: floating stick; FIRE-L (80px) above the stick so the
 *    left thumb can fire while the right thumb aims; OD + AUTO above it.
 * Positions use safe-area insets so nothing hides under the notch or
 * the browser chrome. Final numbers set from harness HUD measurements. */
#game { touch-action: none; }
#tc-layer {
  position: fixed; inset: 0;
  touch-action: none;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  font-family: "Chakra Petch", system-ui, sans-serif;
}
/* The layer only exists while playing — menus keep their own buttons. */
body:not([data-screen="hud"]):not([data-screen="pause"]) #tc-layer { display: none; }
#tc-stick {
  position: absolute; width: 124px; height: 124px;
  margin: -62px 0 0 -62px;
  border: 2px solid rgba(255, 255, 255, 0.35); border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  display: none; pointer-events: none; touch-action: none;
}
#tc-knob {
  position: absolute; left: 50%; top: 50%;
  width: 56px; height: 56px; margin: -28px 0 0 -28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  border: 2px solid rgba(255, 255, 255, 0.5);
}
.tc-btn {
  position: absolute; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  background: rgba(20, 16, 12, 0.35);
  color: #ffd9a0; font-weight: 700; letter-spacing: 0.04em;
  display: flex; align-items: center; justify-content: center;
  text-shadow: 0 1px 2px #000;
  touch-action: none;
}
.tc-btn.on { background: rgba(255, 150, 50, 0.45); }
#tc-fire { border-color: rgba(255, 120, 60, 0.75); color: #ffc9a3; }
#tc-fire-l { border-color: rgba(255, 120, 60, 0.6); color: #ffc9a3; }
#tc-auto {
  position: absolute;
  min-width: 84px; height: 36px; padding: 0 12px;
  border-radius: 18px;
  border: 2px solid rgba(120, 255, 170, 0.55);
  background: rgba(10, 30, 18, 0.5);
  color: #b9ffd2; font-weight: 700; font-size: 13px; letter-spacing: 0.06em;
  display: flex; align-items: center; justify-content: center;
  text-shadow: 0 1px 2px #000;
  touch-action: none;
}
#tc-auto.off { border-color: rgba(255, 255, 255, 0.3); background: rgba(20, 16, 12, 0.4); color: rgba(255, 255, 255, 0.55); }

/* Default (landscape / larger) positions — set from harness-measured HUD
 * boxes at 844x390: style panel x682-822/y18-183, weapon panel
 * x607-820/y272-368, vitals x24-228/y299-368. The first-pass values put
 * FIRE/ADS over the weapon panel and RLD/JUMP over the style panel.
 * Now: ADS/JUMP/RLD form a row in the free band between the two panels
 * (y202-262), and FIRE sits left of the weapon panel (x504-596) in the
 * right thumb's reach — zero box overlap with any HUD panel. */
#tc-fire   { right: calc(248px + env(safe-area-inset-right)); bottom: calc(30px + env(safe-area-inset-bottom));  width: 92px; height: 92px; font-size: 17px; }
#tc-ads    { right: calc(24px + env(safe-area-inset-right));  bottom: calc(128px + env(safe-area-inset-bottom)); width: 60px; height: 60px; font-size: 12px; }
#tc-jump   { right: calc(96px + env(safe-area-inset-right));  bottom: calc(128px + env(safe-area-inset-bottom)); width: 60px; height: 60px; font-size: 12px; }
#tc-reload { right: calc(168px + env(safe-area-inset-right)); bottom: calc(128px + env(safe-area-inset-bottom)); width: 56px; height: 56px; font-size: 11px; }
#tc-fire-l { left: calc(20px + env(safe-area-inset-left));    bottom: calc(168px + env(safe-area-inset-bottom)); width: 80px; height: 80px; font-size: 15px; }
#tc-od     { left: calc(112px + env(safe-area-inset-left));   bottom: calc(168px + env(safe-area-inset-bottom)); width: 52px; height: 52px; font-size: 12px; }
#tc-auto   { left: calc(112px + env(safe-area-inset-left));   bottom: calc(232px + env(safe-area-inset-bottom)); }

@media (orientation: portrait) and (max-width: 600px) {
  /* Right cluster lifted 12px from the first pass: harness-measured HUD
   * geometry at 390x844 puts the .weapon ammo panel's top edge at y=685
   * and FIRE's box bottom kissed it by 9px. Now FIRE's bottom edge is
   * y=682 — clear, and still low in the right thumb's arc. */
  #tc-fire   { right: calc(16px + env(safe-area-inset-right));  bottom: calc(162px + env(safe-area-inset-bottom)); }
  #tc-ads    { right: calc(122px + env(safe-area-inset-right)); bottom: calc(162px + env(safe-area-inset-bottom)); }
  #tc-jump   { right: calc(122px + env(safe-area-inset-right)); bottom: calc(234px + env(safe-area-inset-bottom)); }
  #tc-reload { right: calc(24px + env(safe-area-inset-right));  bottom: calc(266px + env(safe-area-inset-bottom)); }
  #tc-fire-l { left: calc(20px + env(safe-area-inset-left));    bottom: calc(246px + env(safe-area-inset-bottom)); }
  #tc-od     { left: calc(32px + env(safe-area-inset-left));    bottom: calc(340px + env(safe-area-inset-bottom)); }
  #tc-auto   { left: calc(20px + env(safe-area-inset-left));    bottom: calc(404px + env(safe-area-inset-bottom)); }
  /* G9 menu overflow fix (from v1, still needed): title-menu buttons
   * min-width 320px inside an offset column run off a 390px screen. */
  .title-left { left: 16px; right: 16px; }
  .title-left .btn { min-width: 0; width: 100%; }
  .tagline { max-width: 100%; }
  .title-foot { left: 16px; right: 16px; }
}
@media (orientation: landscape) and (max-height: 600px) {
  .title-left { left: 16px; right: 16px; }
  .title-left .btn { min-width: 0; width: 100%; }
  .tagline { max-width: 100%; }
  .title-foot { left: 16px; right: 16px; }
}
