.arena-picker {
  min-width: 0;
  width: 100%;
  margin: 12px 0;
}
.arena-picker label {
  display: block;
  font-size: 11px;
  margin-bottom: 6px;
}
.arena-picker select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
}
.home-hero > .arena-picker {
  max-width: 360px;
}
.chat-tabs {
  top: auto;
  bottom: max(18px, env(safe-area-inset-bottom));
  right: max(18px, env(safe-area-inset-right));
  flex-direction: column;
  max-height: 40dvh;
  width: 280px;
}
.chat-person-tab {
  flex: 0 0 auto;
}
.chat-person-tab button {
  min-height: 44px;
}
.chat-dock {
  position: fixed;
  z-index: 170;
  right: max(18px, env(safe-area-inset-right));
  bottom: calc(
    max(18px, env(safe-area-inset-bottom)) + var(--keyboard-inset, 0px)
  );
  width: min(370px, calc(100vw - 24px));
  height: min(540px, calc(var(--visible-height, 100dvh) - 24px));
  display: flex;
  flex-direction: column;
  border: 1px solid #a6d65e;
  border-radius: 12px;
  background: #081f18;
  box-shadow: 0 12px 45px #0009;
  overflow: hidden;
}
.chat-dock-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: #173b2c;
}
.chat-dock-heading button {
  min-width: 44px;
  min-height: 44px;
}
.chat-dock .friends-chat {
  flex: 1;
  min-height: 0;
  padding: 12px;
  border: 0;
  border-radius: 0;
}
.chat-dock #chatTitle {
  margin: 0 0 6px;
  font-size: 18px;
}
.chat-dock #chatHint {
  font-size: 11px;
  margin: 0 0 6px;
}
.chat-dock #chatMessages {
  flex: 1;
  min-height: 40px;
  height: auto;
  overscroll-behavior: contain;
}
.chat-dock #chatForm {
  flex: none;
  margin-top: 8px;
}
.chat-dock #chatForm textarea {
  width: 100%;
  min-height: 48px;
  max-height: 90px;
  font-size: 16px;
}
.chat-dock #chatForm label {
  display: none;
}
.chat-dock-open .chat-tabs {
  right: 400px;
}
.mobile-play .chat-tabs {
  bottom: calc(190px + env(safe-area-inset-bottom));
  width: 210px;
  max-height: 100px;
}
@media (max-width: 760px), (max-height: 500px) and (pointer: coarse) {
  #ui > .screen:not(#match):not(#results) {
    top: max(112px, calc(var(--header-height, 100px) + 12px));
  }
  #header {
    height: auto;
    min-height: 100px;
    padding: 6px max(10px, env(safe-area-inset-right)) 0
      max(10px, env(safe-area-inset-left));
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
  }
  #header .brand {
    margin-right: auto;
    font-size: 22px;
  }
  #header nav {
    order: 10;
    flex: 1 0 100%;
    display: flex;
    height: 44px;
    overflow-x: auto;
    white-space: nowrap;
    min-width: 0;
  }
  #header nav button {
    flex: none;
    min-height: 44px;
  }
  #header .pilot-badge {
    display: none;
  }
  #header .header-queue {
    max-width: 145px;
    font-size: 9px;
  }
  #header .header-party {
    max-width: 70px;
  }
  .game-footer {
    display: none;
  }
  input,
  select,
  textarea {
    font-size: 16px;
  }
  #garage {
    inset: 112px 10px 12px;
    display: flex;
    flex-direction: column;
    padding-top: 210px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
  }
  #garage .garage-left,
  #garage .garage-right,
  #garage .parts-shelf {
    position: static;
    width: 100%;
    height: auto;
    max-height: none;
    flex: none;
    min-height: 0;
  }
  #garage .parts-shelf {
    order: 1;
    overflow: visible;
  }
  #garage .garage-right {
    order: 2;
    display: flex;
  }
  #garage .garage-left {
    order: 3;
  }
  #garage #parts {
    max-height: 290px;
    min-height: 130px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  #garage #categories button {
    min-height: 44px;
  }
  #garage #partInfo {
    position: static;
    order: initial;
    margin-top: 10px;
    flex: none;
  }
  #garage #partInfo p {
    flex-basis: auto;
  }
  #garage .garage-bottom {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  #garage .garage-bottom > button {
    min-height: 44px;
    flex: 1;
  }
  #garage .arena-picker {
    flex-basis: 100%;
  }
  #play,
  #friends,
  #robots {
    top: 112px;
    bottom: 12px;
  }
  .chat-tabs {
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    width: min(280px, calc(100vw - 24px));
  }
  .chat-dock {
    right: 12px;
  }
  .chat-dock-open .chat-tabs {
    display: none;
  }
  .notification-panel {
    top: 105px;
    max-height: calc(100dvh - 125px);
  }
}
@media (max-width: 380px) {
  #garage #parts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #header .header-party {
    display: none;
  }
}
@media (any-pointer: coarse) {
  .mobile-play .match-top {
    width: calc(100% - 24px);
    gap: 6px;
  }
  .mobile-play #round {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mobile-play .match-top button {
    min-height: 40px;
  }
  .mobile-play #touchControls {
    display: flex;
    pointer-events: none;
  }
  .mobile-play #touchControls > * {
    pointer-events: auto;
  }
  .mobile-play #touchControls > button {
    min-width: 70px;
    min-height: 70px;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .mobile-play .combat-health {
    width: 180px;
    padding: 6px 8px;
  }
  .mobile-play .component-status,
  .mobile-play .combat-health small {
    display: none;
  }
  .mobile-play .hazard-notice {
    top: 48px;
    max-width: calc(100vw - 400px);
    font-size: 10px;
  }
  .mobile-play .chat-tabs {
    bottom: 155px;
    max-height: 58px;
  }
  .chat-dock #chatHint {
    display: none;
  }
  .chat-dock #chatForm {
    display: flex;
    gap: 6px;
  }
  .chat-dock #chatForm button {
    width: 90px;
    margin: 0;
  }
}
