/* Keep the playable centre clear. These rules move instruments only; combat,
   input, damage charge and the live ranking continue unchanged. */
#arena.touch {
  --hud-top: max(8px, env(safe-area-inset-top));
  --hud-edge: max(10px, env(safe-area-inset-left));
  --power-height: 72px;
  --power-gap: 10px;
}
#arena.touch .upper-right { top: var(--hud-top); right: max(8px, env(safe-area-inset-right)); gap: 4px; }
#arena.touch .upper-right button { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
#arena.touch .scoreline {
  top: var(--hud-top); width: min(420px, calc(100% - 330px)); height: 58px;
  padding: 3px; gap: 3px; grid-template-columns: minmax(0, 1fr) 70px minmax(0, 1fr);
  border-radius: 11px; box-shadow: 0 3px #160d24, inset 0 1px #fff7ce;
}
#arena.touch .scoreline .team-strip { padding: 4px 7px 7px; gap: 4px; border-radius: 7px; }
#arena.touch .scoreline .team-strip b { font-size: 31px; }
#arena.touch .scoreline .team-strip span { font-size: 11px; }
#arena.touch .scoreline .team-glyph { display: none; }
#arena.touch .score-goal { padding: 0 2px; }
#arena.touch .score-goal span { font-size: 10px; letter-spacing: .08em; }
#arena.touch .score-goal strong { font-size: 15px; }
#arena.touch .upper-left { top: calc(var(--hud-top) + 68px); left: var(--hud-edge); max-width: calc(100% - 20px); }
#arena.touch .feed { margin: 0; font-size: 11px; gap: 3px; }
#arena.touch .feed > div { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#arena.touch .feed > div:nth-last-child(n + 3) { display: none; }

/* The short vitals panel sits between the thumbs, not over the arena. The name
   is already above the tank; full ranking is still available while holding it. */
#arena.touch .player-status {
  left: 50%; right: auto; bottom: calc(var(--pad-inset) + 17px);
  transform: translateX(-50%); width: min(166px, calc(100% - (var(--pad-size) + var(--drive-left)) * 2 - 20px));
  padding: 6px 8px; border-width: 1px; border-color: #ddaf6377; border-radius: 9px;
  background: linear-gradient(155deg, #34223ce8, #21182acc);
  box-shadow: inset 0 1px #f8c59f55, 0 2px #160e2388;
}
#arena.touch .player-status > div:first-child,
#arena.touch .player-status .own-team,
#arena.touch .player-status #critical-stat {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
#arena.touch .player-status .health { height: 6px; margin: 0 0 4px; }
#arena.touch .player-status small { flex-direction: column; flex-wrap: nowrap; justify-content: center; gap: 1px; line-height: 1.15; }
#arena.touch .player-status #health { font-size: 11px; }
#arena.touch .player-status #kills { margin: 0; font-size: 23px; line-height: 1.05; }
#arena.touch .weapon-status { margin-top: 3px; padding-top: 3px; gap: 4px; justify-content: center; font-size: 12px; min-width: 0; }
#arena.touch .weapon-status .supply-glyph { display: none; }
#arena.touch #weapon-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#arena.touch #weapon-ammo { margin-left: 0; min-width: 16px; font-size: 13px; }
#arena.touch .critical-status { margin: 3px 0 0; padding: 0; border: 0; justify-content: center; }
#arena.touch .critical-status b { font-size: 11px; line-height: 1.1; }
#arena.touch .pickup-gain { top: auto; bottom: calc(100% + 6px); left: 50%; right: auto; width: 180px; transform: translateX(-50%); }

/* Power remains directly above movement in either orientation. */
#arena.touch .tank-power-control {
  left: var(--drive-left); right: auto;
  bottom: calc(var(--pad-inset) + 17px + var(--pad-size) + var(--power-gap));
  width: 124px; height: var(--power-height); transform: none;
}
#arena.touch .tank-ability { min-height: 44px; padding: 7px 6px 18px; gap: 3px; border-radius: 11px; }
#arena.touch .power-label {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
#arena.touch .power-name { font-size: 14px; line-height: 1.1; }
#arena.touch .power-state { font-size: 11px; line-height: 1.1; }
#arena.touch .power-meter { bottom: 7px; height: 7px; }
#arena.touch #next-target { bottom: calc(var(--pad-inset) + 17px + var(--pad-size) + var(--power-gap)); min-height: 48px; width: 144px; min-width: 0; padding: 5px 8px; }
#arena.touch #next-target .target-copy { overflow: hidden; }
#arena.touch #next-target .target-copy strong { font-size: 12px; }
#arena.touch #target-label { font-size: 11px; }
#arena.touch .world-warning {
  top: calc(var(--hud-top) + 68px); width: max-content; max-width: calc(100% - 24px);
  padding: 6px 12px; margin: 0; font-size: 13px; line-height: 1.2;
  border: 1px solid #ffd67988; border-radius: 7px; pointer-events: none;
}
#arena.touch #hud:has(.world-warning:not([hidden])) .upper-left { top: calc(var(--hud-top) + 105px); }
#arena.touch .upgrade-award { top: 30%; padding: 7px 12px; font-size: 14px; }
#arena.touch .power-notice { top: 24%; padding: 6px 12px; font-size: 16px; }

@media (orientation: portrait) {
  #arena.touch .scoreline {
    left: max(8px, env(safe-area-inset-left)); transform: none;
    width: calc(100% - max(8px, env(safe-area-inset-left)) - max(8px, env(safe-area-inset-right)) - 100px);
    grid-template-columns: minmax(0, 1fr) 56px minmax(0, 1fr); height: 54px;
  }
  #arena.touch:has(#fullscreen:not([hidden])) .scoreline { width: calc(100% - max(8px, env(safe-area-inset-left)) - max(8px, env(safe-area-inset-right)) - 148px); }
  #arena.touch .scoreline .team-strip { padding: 3px 5px 6px; gap: 2px; }
  #arena.touch .scoreline .team-strip span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  #arena.touch .scoreline .team-strip b { margin: 0; font-size: 30px; }
  #arena.touch .score-goal strong { font-size: 13px; }
  #arena.touch .scoreline .team-blue::before { content: 'TÚ'; font-size: 9px; font-weight: 900; }
  #arena.touch .upper-left { top: calc(var(--hud-top) + 63px); }
  #arena.touch .world-warning { top: calc(var(--hud-top) + 63px); }
  #arena.touch #hud:has(.world-warning:not([hidden])) .upper-left { top: calc(var(--hud-top) + 99px); }
  #arena.touch .practice-hud {
    top: calc(var(--hud-top) + 51px); width: calc(100% - 20px); min-height: 48px;
    padding: 5px 8px; grid-template-columns: minmax(0, 1.45fr) 55px minmax(70px, 1fr); gap: 3px;
  }
  #arena.touch .practice-hud strong { font-size: 14px; }
  #arena.touch .practice-hud b { font-size: 22px; }
  #arena.touch .practice-hud .pve-hud-label { display: none; }
  #arena.touch #hud:has(.practice-hud:not([hidden])) .world-warning { top: calc(var(--hud-top) + 108px); }
  #arena.touch #hud:has(.practice-hud:not([hidden])) .upper-left { top: calc(var(--hud-top) + 108px); }
  #arena.touch #hud:has(.practice-hud:not([hidden])):has(.world-warning:not([hidden])) .upper-left { top: calc(var(--hud-top) + 144px); }
}
@media (max-width: 360px) and (orientation: portrait) {
  #arena.touch { --pad-size: 74px; --drive-left: max(12px, env(safe-area-inset-left)); }
  #arena.touch #trigger { right: max(12px, env(safe-area-inset-right)); }
  #arena.touch .tank-power-control { width: 116px; }
  #arena.touch #next-target { width: 138px; right: max(12px, env(safe-area-inset-right)); }
  #arena.touch .scoreline .team-blue::before { display: none; }
  #arena.touch:has(#fullscreen:not([hidden])) .scoreline { grid-template-columns: minmax(0, 1fr) 48px minmax(0, 1fr); }
  #arena.touch:has(#fullscreen:not([hidden])) .scoreline .team-strip b { font-size: 25px; }
  #arena.touch .power-name { font-size: 13px; }
}
@media (orientation: landscape) and (max-height: 600px) {
  #arena.touch { --pad-size: 74px; --pad-inset: max(7px, env(safe-area-inset-bottom)); --power-height: 70px; --power-gap: 8px; }
  #arena.touch .power-name { font-size: 13px; }
  #arena.touch .scoreline { width: min(390px, calc(100% - 330px)); height: 54px; grid-template-columns: minmax(0, 1fr) 63px minmax(0, 1fr); }
  #arena.touch .scoreline .team-strip { padding-inline: 5px; }
  #arena.touch .scoreline .team-strip b { font-size: 28px; }
  #arena.touch .scoreline .team-strip span { font-size: 10px; }
  #arena.touch .player-status { left: 50%; right: auto; bottom: calc(var(--pad-inset) + 17px); width: 230px; padding: 5px 8px; }
  #arena.touch .player-status small { flex-direction: row; gap: 8px; }
  #arena.touch .player-status #kills { font-size: 21px; }
  #arena.touch .critical-status b { font-size: 11px; }
  #arena.touch .upper-left { top: calc(var(--hud-top) + 61px); max-width: 230px; }
  #arena.touch .feed > div:nth-last-child(n + 2) { display: none; }
  #arena.touch .world-warning { top: calc(var(--hud-top) + 62px); max-width: min(420px, calc(100% - 500px)); }
  #arena.touch #hud:has(.world-warning:not([hidden])) .upper-left { top: calc(var(--hud-top) + 61px); }
  #arena.touch .practice-hud { top: var(--hud-top); width: min(385px, calc(100% - 330px)); padding: 5px 8px; grid-template-columns: minmax(120px, 1fr) 56px 76px; gap: 3px; min-height: 54px; }
  #arena.touch .practice-hud .pve-hud-label { display: none; }
  #arena.touch .practice-hud strong { font-size: 14px; }
  #arena.touch .practice-hud b { font-size: 22px; }
  #arena.touch .power-notice { top: 32%; }
  #arena.touch .upgrade-award { top: 43%; }
}
@media (orientation: landscape) and (max-height: 600px) and (max-width: 720px) {
  #arena.touch .scoreline { width: calc(100% - 300px); grid-template-columns: minmax(0, 1fr) 55px minmax(0, 1fr); }
  #arena.touch .scoreline .team-strip span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  #arena.touch .scoreline .team-strip b { margin: 0; }
  #arena.touch .world-warning { max-width: 48%; font-size: 12px; }
  #arena.touch .upper-left { max-width: 145px; }
  #arena.touch .practice-hud { width: calc(100% - 300px); grid-template-columns: minmax(96px, 1fr) 48px 58px; }
  #arena.touch .practice-hud strong { font-size: 12px; }
  #arena.touch .practice-hud b { font-size: 18px; }
}
