/* Arena X3 V56 — responsive layout only. Load after lobby-v55.css.
   Size the content first; clipping at the root is only an overflow guard.
   No transforms, canvas-resolution changes, or restrictions on pinch zoom. */
html {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
}
#lobby, .site-header, .site-footer, .section-wrap, .game-screen {
  width: 100%;
  min-width: 0;
}
#lobby { max-width: 100%; }
.game-screen > *, .selection-layout > *, .roster-toolbar > *,
.mode-options > *, .fight-setup > *, .online-picks > *,
.online-slots > *, .lobby-details, .lobby-details > *,
.site-header nav, .site-footer > * {
  min-width: 0;
}
.game-screen > *, .battle-frame canvas, .fighter-search,
.universe-filter, .lobby-details, .lobby-details > *,
.tournament-route, .gamepad-guide { max-width: 100%; }
.mode-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.game-topbar, .game-topbar > div { flex-wrap: wrap; }
.game-topbar > div { min-width: 0; max-width: 100%; }
.game-topbar > div:last-child { row-gap: 6px; }
.radio-track { min-width: 0; }
.radio-track strong, .radio-track > span { max-width: 100%; }
.ranged-status-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gamepad-guide > span { min-width: 0; overflow-wrap: anywhere; }
.modal { min-width: 0; }

@media (max-width: 760px) {
  .site-header, body:not(.playing) .site-header {
    height: auto;
    min-height: 68px;
    padding: 8px 14px;
    gap: 12px;
  }
  .site-header .brand { flex: 0 0 auto; }
  .site-header .brand > span { display: none; }
  .site-header nav { flex-wrap: wrap; justify-content: flex-end; gap: 4px 14px; }
  .site-header nav > a, .site-header nav > button,
  .nav-more > summary { min-height: 44px; align-items: center; }
  .nav-more-panel { max-width: calc(100vw - 28px); }
  .hero-content, .pc-first-notice { min-width: 0; max-width: 100%; }
  .pc-first-notice > div { min-width: 0; }
  .hero-cta { min-width: 0; max-width: 100%; }
  .hero-actions { min-width: 0; }
  .selection-layout { grid-template-columns: minmax(0, 1fr); }
  .mode-title, .mode-options small, .section-intro,
  .lobby-details > summary, .online-heading p { overflow-wrap: anywhere; }
  .roster-top, .roster-result-bar, .section-heading { flex-wrap: wrap; gap: 10px; }
  .roster-top > *, .section-heading > * { min-width: 0; }
  .fighter-search input, .universe-filter select,
  .fight-setup select, .graphics-setting select,
  .online-body input, .online-body select,
  .modal input:not([type=range]):not([type=file]), .modal select {
    font-size: 16px;
    min-width: 0;
    max-width: 100%;
  }
  .fighter-search input { flex: 1 1 0; width: 0; }
  .universe-filter select { width: 100%; }
  .fight-setup, .fight-setup.tournament-setup {
    grid-template-columns: minmax(0, 1fr);
  }
  .lobby-match-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lobby-match-summary .text-link { min-width: 0; white-space: normal; }
  .lobby-details > summary > span:last-child { flex: 0 0 auto; }
  .online-picks, .online-entry { grid-template-columns: minmax(0, 1fr); }
  .online-slots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-footer { flex-wrap: wrap; }
  .site-footer a { white-space: normal; }
  .game-screen {
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
    contain: inline-size;
  }
  .game-screen > .battle-frame { min-width: 0; max-width: 100%; }
  .modal { max-width: calc(100% - 24px); }
  .audio-modal { max-width: min(480px, calc(100% - 24px)); }
  .game-topbar { row-gap: 10px; }
  .game-topbar > div:last-child { flex-wrap: wrap; }
  .game-topbar button { min-height: 44px; }
  .now-playing { flex-wrap: wrap; height: auto; }
  .now-playing .radio-track { flex: 1 1 100px; }
  .radio-settings, .radio-retry { min-height: 44px; }
  .ranged-status { grid-template-columns: minmax(0, 1fr) auto; }
}

/* Both pads share the space actually available inside the arena wrapper.
   Eight buttons remain in the DOM and retain their original action bindings. */
@media (max-width: 760px), (hover: none), (pointer: coarse) {
  .mobile-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(8px, 2vw, 20px);
    width: 100%;
    max-width: 720px;
    min-width: 0;
    margin-left: auto;
    margin-right: auto;
    align-items: end;
    padding: 12px 0 8px;
  }
  .mobile-controls .move-pad, .mobile-controls .attack-pad {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(2, 54px);
    gap: 4px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    align-items: stretch;
  }
  .mobile-controls .move-pad button, .mobile-controls .attack-pad button {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: 54px;
    min-height: 44px;
    padding: 3px;
    border-radius: 7px;
  }
  .mobile-controls .move-pad button { font-size: 24px; }
  .mobile-controls .attack-pad button { font-size: 9px; line-height: 1.2; }
  .mobile-controls .move-pad [data-action=left] { grid-column: 1; grid-row: 2; }
  .mobile-controls .move-pad [data-action=jump] { grid-column: 2; grid-row: 1; }
  .mobile-controls .move-pad [data-action=right] { grid-column: 3; grid-row: 2; }
  .mobile-controls #touch-ranged {
    width: 100%;
    grid-column: 1 / 3;
    grid-row: 2;
    flex-direction: column;
    gap: 3px;
    font-size: 10px;
  }
  .mobile-controls #touch-ranged small { font-size: 8px; }
  .mobile-controls #touch-special { grid-column: 3; grid-row: 2; font-size: 8px; }
}

@media (min-width: 480px) and (max-height: 520px) and (orientation: landscape) {
  .mobile-controls {
    grid-template-columns: minmax(0, 3fr) minmax(0, 5fr);
    max-width: 900px;
    gap: clamp(10px, 2vw, 24px);
    align-items: center;
    padding: 7px 0 3px;
  }
  .mobile-controls .move-pad, .mobile-controls .attack-pad {
    grid-template-rows: 44px;
    gap: 4px;
  }
  .mobile-controls .attack-pad { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .mobile-controls .move-pad [data-action],
  .mobile-controls .attack-pad [data-action] {
    grid-column: auto;
    grid-row: auto;
    order: 0;
    height: 44px;
  }
  .mobile-controls #touch-ranged, .mobile-controls #touch-special {
    grid-column: auto;
    grid-row: auto;
    width: 100%;
  }
  .mobile-controls #touch-ranged { font-size: 8px; gap: 2px; }
  .mobile-controls #touch-ranged small { font-size: 7px; }
  .game-topbar button { min-height: 32px; }
  .now-playing { height: auto; min-height: 28px; }
  .radio-settings { min-height: 28px; }
}

@media (max-width: 359px) {
  #lobby > .section-wrap { padding-left: 14px; padding-right: 14px; }
  .roster-toolbar { grid-template-columns: minmax(0, 1fr); }
  .hero-content { padding-left: 18px; padding-right: 18px; }
  .mode-options { grid-template-columns: minmax(0, 1fr); }
  .mode-options button { min-height: 90px; }
}
