.card-carousel {
  display: flex !important;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--lime) #101b16;
  padding: 12px calc(50% - 76px);
  scroll-padding-inline: calc(50% - 76px);
  align-items: stretch;
}
.carousel-card {
  flex: 0 0 152px;
  min-width: 152px;
  display: flex !important;
  flex-direction: column;
  justify-content: center !important;
  text-align: center;
  gap: 8px;
  padding: 18px 12px;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  opacity: 0.62;
  transform: scale(0.93);
  border: 1px solid var(--line);
  background: linear-gradient(145deg, #253329, #101914);
  transition:
    transform 0.18s,
    opacity 0.18s,
    border-color 0.18s;
}
.carousel-card strong {
  font-size: 23px;
  letter-spacing: -1px;
}
.carousel-card small {
  font:
    11px/1.5 Consolas,
    monospace;
  color: var(--muted);
  white-space: normal;
}
.carousel-card[aria-pressed="true"] {
  opacity: 1;
  transform: scale(1);
  border-color: var(--lime);
  color: var(--lime);
  box-shadow: inset 0 -3px var(--lime);
}
.carousel-card:hover,
.carousel-card:focus-visible {
  opacity: 1;
  outline: 2px solid var(--lime);
  outline-offset: -2px;
}
.menu-actions {
  width: min(420px, 100%);
}
.menu {
  overflow-y: auto;
  pointer-events: auto;
  padding-top: 2vh;
  padding-bottom: 24px;
}
.menu:has(#playActions:not([hidden])) h1 {
  font-size: clamp(42px, 5vw, 68px);
}
.card-carousel {
  pointer-events: auto;
}
.menu-modes h2 {
  font-size: 18px;
  margin: 0;
}
.menu-modes .small {
  min-height: 44px;
  max-width: none;
}
.matchmaking-panel {
  overflow: hidden;
}
#garage .garage-left {
  width: 285px;
  top: 90px;
  bottom: 85px;
  max-height: none;
}
#garage .garage-right {
  width: 330px;
  top: 15px;
  bottom: 85px;
  max-height: none;
}
#garage h2 {
  font-size: 19px;
  margin-bottom: 8px;
}
#garage #categories {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 12px;
}
#garage #categories button {
  font-size: 11px;
  padding: 8px;
}
#garage #parts .part {
  width: 152px;
  min-width: 152px;
  font-size: 13px;
}
#garage #parts {
  margin: 0 -8px;
}
#garage #garageRobotStatus {
  margin-top: 10px;
}
.maps-manager {
  border-top: 1px solid var(--line);
  margin-top: 30px;
  padding-top: 24px;
}
.maps-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.maps-workspace {
  display: grid;
  grid-template-columns: 180px minmax(180px, 1fr) minmax(250px, 320px);
  gap: 16px;
  align-items: start;
}
.maps-workspace > * {
  min-width: 0;
  background: #0d1712;
  border: 1px solid var(--line);
  padding: 14px;
}
.maps-workspace h3 {
  font-size: 16px;
  margin: 0 0 14px;
}
#mapFolders {
  display: grid;
  gap: 6px;
  margin-bottom: 20px;
}
#mapFolders button {
  text-align: left;
  overflow-wrap: anywhere;
}
#mapFolders button[aria-pressed="true"],
.map-card[aria-pressed="true"] {
  border-color: var(--lime);
  color: var(--lime);
  background: #c6ed6510;
}
.maps-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}
.map-card {
  display: grid;
  gap: 8px;
  text-align: left;
  padding: 14px;
  overflow-wrap: anywhere;
}
.map-card p {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}
.map-card small {
  font:
    10px/1.5 Consolas,
    monospace;
}
.map-editor label {
  margin-top: 12px;
}
.map-editor textarea {
  width: 100%;
  resize: vertical;
  background: #0a130f;
  color: var(--text);
  border: 1px solid #536145;
  padding: 10px;
  font: inherit;
}
.map-editor fieldset {
  border: 1px solid var(--line);
  padding: 10px;
  margin: 12px 0;
}
.map-mode-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.check-line {
  display: flex;
  align-items: center;
  gap: 8px;
}
.check-line input {
  width: auto;
  accent-color: var(--lime);
}
#mapThumbnail {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  margin-bottom: 12px;
}
.map-asset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
  align-items: center;
}
.map-asset-row button {
  padding: 6px;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 11px;
}
.map-editor input[type="file"] {
  font-size: 11px;
}
#admin .library-panel {
  max-width: 1250px;
  width: 100%;
}
@media (max-width: 1050px) {
  .maps-workspace {
    grid-template-columns: 150px 1fr;
  }
  .map-editor {
    grid-column: 1/-1;
  }
}
@media (max-width: 900px) {
  #garage {
    overflow-y: auto;
    padding-top: 290px;
    padding-bottom: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-content: start;
  }
  #garage[hidden] {
    display: none;
  }
  #garage .garage-left,
  #garage .garage-right {
    position: static;
    width: auto;
    height: auto;
    max-height: none;
    overflow: visible;
  }
  #garage .garage-bottom {
    position: static;
    grid-column: 1/-1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  #garage .orbit-hint {
    top: 240px;
    bottom: auto;
    font-size: 10px;
  }
  #garage .scene-heading {
    top: 0;
  }
}
@media (max-width: 600px) {
  #garage {
    grid-template-columns: minmax(0, 1fr);
    padding-top: 250px;
  }
  #garage .orbit-hint {
    top: 205px;
  }
  .maps-workspace {
    grid-template-columns: minmax(0, 1fr);
  }
  .map-editor {
    grid-column: auto;
  }
  #mapFolders {
    display: flex;
    overflow-x: auto;
  }
  .maps-heading {
    flex-wrap: wrap;
  }
  .menu-actions {
    margin-top: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .carousel-card {
    transition: none;
  }
}
.leaderboard-filters {
  display: flex;
  align-items: end;
  gap: 16px;
  flex-wrap: wrap;
}
.leaderboard-filters label {
  min-width: 160px;
  flex: 1;
}
.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
}
.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}
.leaderboard-table caption {
  text-align: left;
  color: var(--muted);
  padding: 12px;
  font-size: 11px;
}
.leaderboard-table th,
.leaderboard-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: right;
}
.leaderboard-table th {
  color: var(--lime);
  font:
    11px Consolas,
    monospace;
  background: #101b15;
}
.leaderboard-table td:nth-child(2),
.leaderboard-table th:nth-child(2) {
  text-align: left;
}
.leaderboard-table .is-me {
  background: #c6ed6514;
  color: var(--lime);
}
.leaderboard-table tbody tr:hover {
  background: #c6ed650a;
}
/* Persistent account navigation, with a swipeable row on smaller screens. */
#header {
  height: 116px;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 28px;
  background: #0c150ff2;
}
#header nav {
  flex: 1;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}
#header #accountActions {
  display: flex;
  gap: 4px;
  margin: 0;
  flex-wrap: nowrap;
}
#header nav button {
  white-space: nowrap;
  background: transparent;
  border: 0;
  padding: 10px 8px;
  font-size: 11px;
  color: var(--muted);
}
#header nav button:hover,
#header nav button:focus-visible {
  color: var(--lime);
  background: #c6ed6512;
}
.screen {
  top: 126px;
}
@media (max-width: 1200px) {
  #header {
    padding: 10px 16px;
  }
  #header nav {
    flex-basis: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: thin;
  }
  #header nav > * {
    flex-shrink: 0;
  }
  #header nav .text-button {
    display: inline-block;
  }
  #header #wallet {
    margin-left: auto;
  }
}
@media (max-width: 700px) {
  #header {
    height: 116px;
  }
  .screen {
    top: 126px;
  }
  #header nav button {
    padding: 9px 7px;
  }
}
/* Keep the arena edge-to-edge, including short landscape phone viewports. */
#match {
  inset: 0;
}
#rotatePhone {
  position: fixed;
  z-index: 50;
  top: max(72px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  padding: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  background: #14231bf5;
  border: 1px solid var(--lime);
  box-shadow: 0 8px 32px #0008;
}
#rotatePhone > span {
  font-size: 30px;
  color: var(--lime);
}
#rotatePhone > div {
  flex: 1;
  min-width: 170px;
}
#rotatePhone p {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
}
#dismissRotate {
  margin-left: auto;
}
@media (any-pointer: coarse) {
  .mobile-play #touchControls {
    display: flex;
    left: max(16px, env(safe-area-inset-left));
    right: max(16px, env(safe-area-inset-right));
    bottom: max(78px, calc(env(safe-area-inset-bottom) + 66px));
  }
  .mobile-play #touchControls > div {
    display: grid;
    grid-template-columns: repeat(3, 52px);
    grid-template-rows: repeat(2, 48px);
    gap: 5px;
  }
  .mobile-play #touchControls button {
    width: 52px;
    height: 48px;
    padding: 0;
    touch-action: none;
    user-select: none;
    background: #233821ed;
    font-size: 20px;
  }
  .mobile-play #touchControls [data-control="up"] {
    grid-column: 2;
    grid-row: 1;
  }
  .mobile-play #touchControls [data-control="down"] {
    grid-column: 2;
    grid-row: 2;
  }
  .mobile-play #touchControls [data-control="left"] {
    grid-column: 1;
    grid-row: 2;
  }
  .mobile-play #touchControls [data-control="right"] {
    grid-column: 3;
    grid-row: 2;
  }
  .mobile-play #touchControls > button {
    align-self: end;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    font-size: 16px;
  }
  .mobile-play #touchControls button.pressed {
    background: var(--lime);
    color: #152210;
  }
  .mobile-play .match-top {
    top: max(6px, env(safe-area-inset-top));
    gap: 10px;
    padding: 4px 9px;
    font-size: 10px;
    max-width: calc(
      100% - env(safe-area-inset-left) - env(safe-area-inset-right) - 16px
    );
  }
  .mobile-play .match-top strong {
    font-size: 20px;
  }
  .mobile-play .match-top button {
    padding: 8px;
    font-size: 11px;
  }
  .mobile-play .match-bottom {
    left: max(16px, env(safe-area-inset-left));
    right: max(16px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    gap: 8px;
  }
  .mobile-play .hud-meter,
  .mobile-play .weapon-hud {
    width: 33%;
    min-width: 0;
    padding: 8px;
    font-size: 10px;
  }
  .mobile-play .hud-meter label {
    font-size: 9px;
    margin-bottom: 4px;
  }
  .mobile-play .weapon-hud small {
    font-size: 9px;
  }
  .mobile-play #onboarding {
    display: none;
  }
  .mobile-play #trainingBanner {
    top: max(54px, calc(env(safe-area-inset-top) + 48px));
    font-size: 8px;
    white-space: normal;
    text-align: center;
    width: 80%;
  }
}
.mobile-play #touchControls #driveJoystick {
  display: block;
  position: relative;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: #14231bd9;
  border: 2px solid #c6ed6580;
  box-shadow: inset 0 0 24px #0008;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
#joystickKnob {
  pointer-events: none;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: #c6ed65cc;
  border: 2px solid #e1ffb2;
  box-shadow: 0 4px 12px #0009;
}
@media (any-pointer: coarse) and (orientation: landscape) and (max-height: 450px) {
  .mobile-play #touchControls {
    bottom: max(64px, calc(env(safe-area-inset-bottom) + 58px));
  }
  .mobile-play #touchControls #driveJoystick {
    width: 112px;
    height: 112px;
  }
}
html,
body {
  height: 100%;
  height: 100dvh;
}
.mobile-play #driveJoystick {
  pointer-events: auto;
  -webkit-touch-callout: none;
}
/* Keep the balance separate from the scrolling navigation at every width. */
#header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  height: 116px;
  gap: 6px 16px;
}
#header .brand {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
}
#header nav {
  grid-column: 1 / -1;
  grid-row: 2;
  width: 100%;
  min-width: 0;
  justify-content: flex-start;
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  scrollbar-width: thin;
}
#header nav > * {
  flex-shrink: 0;
}
#walletBadge {
  grid-column: 2;
  grid-row: 1;
  padding: 9px 12px;
  border: 1px solid #c6ed6560;
  border-radius: 6px;
  background: #19291d;
  white-space: nowrap;
}
#header #wallet {
  display: inline;
  border: 0;
  padding: 0;
  margin: 0;
  color: var(--lime);
  font:
    700 14px Consolas,
    monospace;
}
#header #connection {
  margin-left: auto;
}
@media (max-width: 700px) {
  #header {
    padding: 10px 12px;
    gap: 5px 8px;
  }
  #walletBadge {
    padding: 8px;
  }
  #header #wallet {
    font-size: 12px;
  }
}
