/* Responsive command-center layouts. */
@media (max-width: 900px) {
  .command-shell-content {
    padding-inline: 12px;
  }

  .command-topbar {
    grid-template-columns: minmax(150px, 0.7fr) minmax(180px, 1fr) minmax(210px, 0.9fr);
    gap: 10px;
  }

  .command-home-grid,
  .command-hangar-grid {
    grid-template-columns: 1fr;
  }

  .command-mode-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

}

@media (max-width: 620px) and (orientation: portrait) {
  body.page-match .game.is-command-shell {
    height: 100dvh;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
  }

  body.page-match .game.is-command-shell .command-shell {
    min-height: 100%;
  }

  .command-shell-content {
    width: 100%;
    padding: max(7px, env(safe-area-inset-top)) 8px 12px;
  }

  .has-command-dock .command-shell-content {
    padding-bottom: calc(92px + env(safe-area-inset-bottom));
  }

  .command-page {
    gap: 10px;
  }

  .command-topbar {
    position: sticky;
    z-index: 20;
    top: 0;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 7px;
    min-height: 54px;
    padding: 6px 7px 7px;
    background: rgba(2, 11, 19, 0.94);
  }

  .command-brand img {
    width: 36px;
    height: 36px;
  }

  .command-brand > span {
    display: none;
  }

  .command-page-title {
    justify-items: start;
    text-align: left;
  }

  .command-page-title > span {
    font-size: 0.56rem;
  }

  .command-page-title h1 {
    max-width: 100%;
    font-size: 0.98rem;
    overflow-wrap: anywhere;
  }

  .command-player-slot {
    gap: 4px;
  }

  .command-player {
    max-width: 126px;
    padding: 3px 5px;
  }

  .command-player-avatar {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }

  .command-player-copy small,
  .command-player-copy em {
    display: none;
  }

  .command-player-copy strong {
    max-width: 78px;
    font-size: 0.7rem;
  }

  .command-player-slot .lobby-install-button {
    display: none;
  }

  .command-auth-slot .lobby-account {
    gap: 4px;
    padding: 2px;
    border: 0;
    background: transparent;
  }

  .command-auth-slot .lobby-account-avatar,
  .command-auth-slot .lobby-account-copy {
    display: none;
  }

  .command-auth-slot .lobby-account-actions {
    gap: 4px;
  }

  .command-auth-slot .lobby-account-button {
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
  }

  .command-auth-slot .lobby-account-button > span:last-child {
    display: none;
  }

  .command-home-grid,
  .command-mode-grid,
  .command-hangar-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .command-quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .command-panel {
    gap: 10px;
    padding: 12px;
  }

  .command-primary-scenario {
    min-height: 0;
  }

  .command-scenario-body {
    min-height: 0;
    padding: 10px;
  }

  .command-panel-heading h2,
  .command-training-card h2,
  .command-locked-page h2 {
    font-size: 0.96rem;
  }

  .command-panel-heading > em {
    font-size: 0.58rem;
  }

  .command-arena-body {
    grid-template-columns: 1fr;
    gap: 10px;
    min-height: 0;
  }

  .command-rank-symbol {
    width: 58px;
    height: 58px;
    font-size: 1.5rem;
  }

  .command-rank-copy strong {
    font-size: 1.12rem;
  }

  .command-rank-copy em {
    font-size: 0.64rem;
  }

  .command-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .command-metrics > span {
    padding: 7px 8px;
  }

  .command-metrics strong {
    font-size: 0.88rem;
  }

  .command-action-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .command-action-row > :only-child {
    grid-column: 1 / -1;
  }

  .command-primary,
  .command-secondary {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 8px 9px;
    font-size: 0.68rem;
    white-space: normal;
  }

  .command-deck-card {
    min-height: 0;
  }

  .command-active-deck {
    min-height: 68px;
  }

  .command-active-deck.is-large {
    min-height: 82px;
  }

  .command-deck-mark {
    width: 48px;
    height: 54px;
    font-size: 1.35rem;
  }

  .command-active-deck strong {
    font-size: 0.92rem;
  }

  .command-section {
    gap: 7px;
  }

  .command-section-heading h2 {
    font-size: 0.84rem;
  }

  .command-quick-action {
    min-height: 62px;
    grid-template-columns: 34px minmax(0, 1fr);
    padding: 8px 10px;
  }

  .command-quick-action > b {
    display: none;
  }

  .command-hex-icon {
    width: 34px;
    height: 38px;
    font-size: 1.05rem;
  }

  .command-hex-icon.is-large {
    width: 50px;
    height: 56px;
    font-size: 1.4rem;
  }

  .command-quick-action strong {
    font-size: 0.76rem;
  }

  .command-quick-action small {
    font-size: 0.61rem;
  }

  .command-training-card {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
  }

  .command-training-actions {
    grid-column: 1 / -1;
    align-items: stretch;
  }

  .command-training-actions em {
    text-align: center;
  }

  .command-deck-row {
    align-items: flex-start;
    gap: 8px;
    padding: 8px;
  }

  .command-deck-row-main {
    align-items: flex-start;
  }

  .command-deck-row-main .command-deck-mark {
    width: 30px;
    height: 34px;
  }

  .command-deck-row-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 142px;
  }

  .command-icon-button {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }

  .command-deck-row-actions > em {
    width: 100%;
    text-align: right;
  }

  .command-locked-page {
    min-height: 310px;
  }

  .command-hangar-empty-state {
    grid-template-columns: 1fr;
    justify-items: center;
    min-height: 0;
    text-align: center;
  }

  .command-hangar-empty-state .command-action-row {
    width: 100%;
  }

  .command-matchmaking-banner {
    right: 6px;
    left: 6px;
    width: auto;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 8px;
    min-height: 0;
    padding: 8px;
  }

  .command-matchmaking-banner.is-above-dock {
    bottom: calc(70px + env(safe-area-inset-bottom));
  }

  .command-matchmaking-copy strong {
    font-size: 0.76rem;
  }

  .command-matchmaking-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .command-matchmaking-actions > :only-child {
    grid-column: 1 / -1;
  }

  .has-matchmaking-banner.has-command-dock .command-shell-content {
    padding-bottom: calc(210px + env(safe-area-inset-bottom));
  }

  .command-dock {
    bottom: 0;
    width: 100%;
    min-height: calc(64px + env(safe-area-inset-bottom));
    padding: 5px 5px env(safe-area-inset-bottom);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 0;
    transform: translateX(-50%);
    clip-path: none;
  }

  .command-dock button {
    min-height: 54px;
  }

  .command-dock button > span {
    font-size: 1rem;
  }

  .command-dock button > strong {
    font-size: 0.56rem;
  }

  .is-command-shell .lobby-mode-setup-screen {
    gap: 8px;
  }

  .is-command-shell .lobby-mode-setup-header {
    top: max(7px, env(safe-area-inset-top));
  }

  .lobby-compact-loadout {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 9px;
    padding: 9px;
  }

  .lobby-compact-loadout-icon {
    width: 40px;
    height: 46px;
    font-size: 1.1rem;
  }

  .lobby-compact-loadout-action {
    grid-column: 1 / -1;
    width: 100%;
  }
}

@media (max-width: 900px) and (max-height: 520px) and (orientation: landscape) {
  body.page-match .game.is-command-shell {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  body.page-match .game.is-command-shell .command-shell {
    min-height: 100%;
  }

  .command-shell-content {
    width: 100%;
    padding: 7px 8px 8px;
  }

  .has-command-dock .command-shell-content {
    max-height: calc(100dvh - 68px);
    padding-bottom: 12px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .command-battle .command-context-strip {
    display: none;
  }

  .command-page {
    gap: 8px;
  }

  .command-topbar {
    grid-template-columns: 150px minmax(180px, 1fr) minmax(190px, 0.8fr);
    min-height: 48px;
    padding: 4px 8px 5px;
  }

  .command-brand img,
  .command-player-avatar {
    width: 32px;
    height: 32px;
  }

  .command-brand img {
    flex: 0 0 32px;
  }

  .command-page-title h1 {
    font-size: 1rem;
  }

  .command-home-grid {
    grid-template-columns: minmax(0, 1.55fr) minmax(230px, 0.75fr);
    gap: 8px;
  }

  .command-panel {
    gap: 8px;
    padding: 10px;
  }

  .command-arena-body {
    min-height: 78px;
  }

  .command-rank-symbol {
    width: 56px;
    height: 56px;
    font-size: 1.35rem;
  }

  .command-rank-copy strong {
    font-size: 1rem;
  }

  .command-metrics > span {
    padding: 5px 7px;
  }

  .command-progress-block {
    display: none;
  }

  .command-primary,
  .command-secondary {
    min-height: 44px;
    padding: 6px 10px;
    font-size: 0.66rem;
  }

  .command-auth-slot .lobby-account-button {
    min-height: 44px;
  }

  .command-text-button {
    min-height: 44px;
  }

  .command-quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .command-quick-action {
    min-height: 54px;
    grid-template-columns: 32px minmax(0, 1fr) auto;
    padding: 6px 8px;
  }

  .command-hex-icon {
    width: 30px;
    height: 34px;
    font-size: 0.95rem;
  }

  .command-dock {
    bottom: 0;
    min-height: 58px;
    width: min(680px, 100%);
  }

  .command-dock button {
    min-height: 44px;
  }

  .command-matchmaking-banner {
    right: 8px;
    left: 8px;
    width: auto;
    min-height: 58px;
    padding: 6px 9px;
  }

  .command-matchmaking-banner.is-above-dock {
    bottom: 62px;
  }

  .has-matchmaking-banner.has-command-dock .command-shell-content {
    padding-bottom: 86px;
  }

  .is-mode-setup .command-shell-content {
    min-height: 100dvh;
    overflow-y: auto;
  }

  .lobby-compact-loadout {
    grid-template-columns: 42px minmax(0, 1fr) auto;
    padding: 8px;
  }

  .lobby-compact-loadout-icon {
    width: 38px;
    height: 42px;
    font-size: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .command-primary,
  .command-secondary,
  .command-quick-action,
  .command-dock button {
    transition: none;
  }
}
