* {
  box-sizing: border-box;
}
:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  color: #eef6ff;
  background: #101b28;
}
#arena-training-hint {
  border-left: 3px solid #eacb80;
  padding-left: 12px;
  color: #c5e3d7;
}
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
  color: inherit;
  border: 1px solid #ffffff25;
  background: #263648;
  border-radius: 9px;
  padding: 10px 14px;
  cursor: pointer;
}
button:focus-visible,
body[data-arena-input='gamepad'] button:focus,
a:focus-visible {
  outline: 3px solid #fbe3a1;
  outline-offset: 3px;
}
button:hover {
  border-color: #a8d9dd;
}
button:disabled {
  cursor: wait;
  opacity: 0.65;
}
[hidden] {
  display: none !important;
}
#arena-app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom)
    env(safe-area-inset-left);
}
#topbar {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px;
  background: #101b28;
  z-index: 3;
  border-bottom: 1px solid #ffffff18;
}
#topbar button {
  padding: 6px 10px;
  font-size: 12px;
  min-height: 34px;
}
.brand {
  flex: 1;
  color: #f6d996;
  letter-spacing: 0.05em;
}
#input-settings {
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100dvh - 24px);
  overflow: auto;
  color: #eef6ff;
  background: #162432;
  border: 1px solid #a8d9dd;
  border-radius: 14px;
  padding: 22px;
}
#input-settings::backdrop {
  background: #07111ddd;
}
#input-settings h2 {
  margin-top: 0;
  color: #f6d996;
}
#control-scheme {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  font: inherit;
  color: inherit;
  background: #263648;
  border: 1px solid #a8d9dd;
  border-radius: 8px;
}
#control-help {
  line-height: 1.6;
}
#control-note {
  font-size: 13px;
  color: #a8c3d5;
}
body[data-control-scheme='mouse'] #arena {
  cursor: crosshair;
}
@media (max-width: 480px) {
  #topbar {
    gap: 2px;
    padding-inline: 4px;
  }
  #topbar .brand strong {
    display: none;
  }
}
#battle-hud {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 7px 22px;
  background: #162432;
  z-index: 2;
  box-shadow: 0 5px 16px #0003;
}
#portrait {
  width: 44px;
  height: 44px;
  image-rendering: pixelated;
}
.meters {
  width: 230px;
  max-width: 35vw;
}
.meters div {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #d5e3ed;
}
.meters meter {
  display: block;
  width: 100%;
  height: 9px;
  margin: 1px 0 3px;
  appearance: none;
  border: 0;
  background: #081520;
  border-radius: 4px;
  overflow: hidden;
}
meter::-webkit-meter-bar {
  background: #081520;
  border: 0;
}
meter::-webkit-meter-optimum-value {
  background: #7bd5a1;
}
meter::-moz-meter-bar {
  background: #7bd5a1;
}
#energy::-webkit-meter-optimum-value {
  background: #6ccbe8;
}
#energy::-moz-meter-bar {
  background: #6ccbe8;
}
.match {
  display: grid;
  gap: 3px;
  flex: 1;
  text-align: center;
}
.match strong {
  text-transform: uppercase;
  letter-spacing: 0.13em;
  font-size: 12px;
  color: #f1daac;
}
.match span,
.score span {
  font-size: 11px;
  color: #a4b8c9;
}
.score {
  display: grid;
  gap: 3px;
  text-align: right;
}
.score strong {
  font-variant-numeric: tabular-nums;
  font-size: 19px;
}
#field {
  flex: 1;
  min-height: 0;
  position: relative;
  background: #192733;
  overflow: hidden;
  touch-action: none;
}
#arena {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
#combat-status {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 13px;
  border-radius: 20px;
  background: #0d1927bf;
  color: #ffe4a5;
  font-size: 12px;
  pointer-events: none;
}
#combat-status:empty {
  display: none;
}
#controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  padding: 8px 20px 12px;
  background: #101b28;
  border-top: 1px solid #ffffff1c;
  touch-action: none;
  z-index: 2;
}
#movement {
  display: flex;
  gap: 10px;
  align-items: center;
}
#stick {
  position: relative;
  z-index: 3;
  width: 88px;
  height: 88px;
  border: 1px solid #79969e66;
  border-radius: 50%;
  background: radial-gradient(circle, #345760 0%, #1d303f 65%);
  box-shadow: inset 0 0 0 10px #101b2833;
  touch-action: none;
}
#stick i {
  position: absolute;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background: #dfedda;
  left: 26px;
  top: 26px;
  box-shadow:
    0 4px 0 #96b2ad,
    0 7px 12px #0007;
}
#stick span {
  position: absolute;
  bottom: 4px;
  width: 100%;
  text-align: center;
  font-size: 9px;
  color: #b9cace;
}
#dodge {
  min-width: 74px;
  min-height: 52px;
  font-size: 12px;
  color: #a3e1d7;
}
#attack-panel {
  max-width: 700px;
  flex: 1;
}
#aim-help {
  font-size: 10px;
  color: #a4b8c9;
  margin-bottom: 6px;
}
#attacks {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}
.attack {
  position: relative;
  overflow: hidden;
  padding: 7px 5px 5px;
  min-height: 70px;
  background: linear-gradient(150deg, #304358, #1a2a3a);
  border-bottom: 3px solid var(--accent, #e4ad7b);
  touch-action: none;
}
.attack::before {
  content: '';
  position: absolute;
  inset: 0;
  background: #06101ec9;
  transform: translateY(calc(100% - var(--cool, 0%)));
  pointer-events: none;
}
.attack > * {
  position: relative;
  z-index: 1;
}
.attack em {
  display: block;
  font-size: 21px;
  line-height: 24px;
  color: var(--accent, #e4ad7b);
  font-style: normal;
}
.attack b {
  display: block;
  font-size: 10px;
  line-height: 13px;
  min-height: 26px;
}
.attack small {
  font-size: 9px;
  color: #bed0de;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: 6px;
  row-gap: 1px;
}
.attack-cost {
  color: #ffe1a1;
  white-space: nowrap;
}
.attack-status {
  white-space: nowrap;
}
.attack kbd {
  position: absolute;
  top: 5px;
  left: 6px;
  font: 9px system-ui;
  color: #afc1d0;
}
.attack[data-unavailable='true'] {
  border-bottom-color: #536174;
}
.attack[data-aiming='true'] {
  outline: 2px solid #fff0bb;
  background: #46515f;
}
.overlay {
  position: absolute;
  inset: 49px 0 0;
  z-index: 4;
  display: grid;
  place-items: center;
  overflow-y: auto;
  background: #07131be8;
  padding: 24px;
  backdrop-filter: blur(5px);
}
.menu-card {
  max-width: 880px;
  width: 100%;
  padding: 8px 0;
}
.eyebrow {
  color: #b9cab9;
  letter-spacing: 0.26em;
  font-size: 10px;
  font-weight: 800;
}
h1 {
  font-size: clamp(28px, 4.5vw, 48px);
  margin: 6px 0;
  letter-spacing: -0.04em;
  color: #ffe1a1;
}
h2 {
  font-size: 17px;
  font-weight: 500;
  color: #e4eee9;
  margin: 0 0 14px;
}
p {
  line-height: 1.6;
  color: #aec1ca;
  font-size: 13px;
}
h3 {
  font-size: 12px;
  color: #b6cfc8;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 9px;
}
#roster {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 9px;
}
.fighter {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px;
  background: #21323ec9;
  text-align: center;
  gap: 4px;
}
.fighter img {
  width: 78px;
  height: 78px;
  image-rendering: pixelated;
}
.fighter strong {
  font-size: 12px;
}
.fighter span {
  font-size: 9px;
  color: #aabdc8;
}
.fighter[aria-pressed='true'] {
  background: #3b433c;
  border: 1px solid #f0d395;
  box-shadow: 0 0 0 2px #f0d39518;
}
#loadout {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px 14px;
  margin: 14px 0;
  font-size: 11px;
}
#loadout span {
  display: block;
  font-size: 10px;
  color: #9db3bc;
  margin-top: 2px;
}
.primary {
  background: #e8c887;
  color: #172634;
  font-weight: 800;
  border: 0;
  padding: 13px 28px;
  box-shadow: 0 3px 0 #a98953;
}
#instructions {
  font-size: 11px;
}
#practice,
#best {
  font-size: 10px;
  margin: 10px 0 5px;
}
nav {
  display: flex;
  gap: 20px;
  margin-top: 12px;
}
nav a {
  color: #d3dec7;
  font-size: 11px;
}
.result-card {
  text-align: center;
  padding: 32px;
  border: 1px solid #96b3a844;
  border-radius: 18px;
  max-width: 540px;
  background: #182b37;
  box-shadow: 0 20px 80px #0006;
}
.result-card button {
  margin: 8px;
}
body[data-touch='false'] #stick {
  display: none;
}
@media (max-width: 700px) {
  #topbar {
    padding: 5px 8px;
    gap: 5px;
  }
  .brand {
    font-size: 12px;
  }
  #topbar button {
    font-size: 10px;
    padding: 5px 8px;
  }
  #battle-hud {
    padding: 5px 10px;
    gap: 8px;
  }
  #portrait {
    width: 32px;
    height: 32px;
  }
  .meters {
    max-width: 34vw;
  }
  .match strong {
    font-size: 10px;
  }
  .match span {
    font-size: 9px;
  }
  .score strong {
    font-size: 14px;
  }
  #controls {
    gap: 12px;
    padding: 8px 10px 12px;
  }
  #movement {
    flex-direction: column;
    gap: 8px;
  }
  #dodge {
    padding: 7px 8px;
    min-height: 36px;
    font-size: 10px;
  }
  #attacks {
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
  }
  .attack {
    min-height: 59px;
    padding: 4px 3px;
  }
  .attack em {
    font-size: 18px;
    line-height: 19px;
  }
  .attack b {
    font-size: 9px;
    line-height: 11px;
    min-height: 22px;
  }
  .attack kbd {
    display: none;
  }
  #aim-help {
    font-size: 9px;
  }
  .overlay {
    padding: 18px;
    place-items: start center;
    inset-block-start: 45px;
  }
  #roster {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  .fighter img {
    width: 62px;
    height: 62px;
  }
  .fighter span {
    font-size: 8px;
  }
  #loadout {
    grid-template-columns: repeat(2, 1fr);
  }
  #intro {
    font-size: 12px;
  }
  .result-card {
    margin: auto;
    padding: 20px;
  }
}
@media (orientation: landscape) and (max-height: 550px) {
  #battle-hud {
    padding: 3px 12px;
  }
  #portrait {
    width: 30px;
    height: 30px;
  }
  #topbar {
    padding-block: 3px;
  }
  #controls {
    padding: 4px 12px;
    gap: 12px;
  }
  #stick {
    width: 65px;
    height: 65px;
  }
  #stick i {
    left: 15px;
    top: 15px;
  }
  #movement {
    flex-direction: row;
  }
  .attack {
    min-height: 57px;
    padding: 3px;
  }
  .attack em {
    font-size: 16px;
    line-height: 17px;
  }
  .attack b {
    font-size: 9px;
    line-height: 11px;
    min-height: 22px;
  }
  #aim-help {
    display: none;
  }
  #attacks {
    grid-template-columns: repeat(4, 1fr);
  }
  #dodge {
    min-width: 58px;
    min-height: 40px;
    font-size: 10px;
  }
  .overlay {
    place-items: start center;
    padding: 14px 30px;
  }
  .fighter img {
    width: 55px;
    height: 55px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .overlay {
    backdrop-filter: none;
  }
}

#all-pokemon {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  background: #203447;
  color: #eef6ff;
  font: inherit;
  margin: 12px 0;
}
#arena-party {
  display: flex;
  gap: 4px;
  padding: 3px 8px;
  background: #152533;
  justify-content: center;
  z-index: 3;
}
#arena-party button {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 5px;
  font-size: 10px;
  max-width: 16%;
}
#arena-party img {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
}
#arena-party button[aria-pressed='true'] {
  border-color: #9cffcf;
  opacity: 1;
}
#arena-party button:disabled {
  cursor: default;
}
#arena-party button[data-withdrawing='true'] {
  border-color: #f6d996;
  background: #4c4128;
  opacity: 1;
}
#switch-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 3px 10px;
  background: #10202d;
  color: #a7e6f8;
  font-size: 11px;
  text-align: center;
  min-height: 22px;
}
#switch-status[data-state='withdrawing'] {
  color: #f6d996;
}
#switch-progress {
  flex: 0 0 65px;
  width: 65px;
  height: 7px;
  accent-color: #f6d996;
}
@media (orientation: landscape) and (max-height: 550px) {
  #arena-party img {
    width: 24px;
    height: 24px;
  }
  #arena-party span {
    font-size: 9px;
  }
  #switch-status {
    font-size: 10px;
    min-height: 18px;
    padding-block: 1px;
  }
}
@media (max-width: 600px) {
  #arena-party span {
    font-size: 8px;
  }
  #arena-party img {
    width: 24px;
    height: 24px;
  }
}

/* Short landscape viewports include Safari with its browser bars visible.
   The arena owns the height; only the actual controls intercept touches. */
@media (orientation: landscape) and (max-height: 550px) {
  #arena-app {
    position: relative;
  }
  #field {
    position: absolute;
    inset: 0;
  }
  #topbar {
    background: #0d1b29e8;
    border: 0;
    padding: 0 max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left));
    height: 44px;
    flex-shrink: 0;
  }
  #topbar button {
    min-height: 44px;
    background: transparent;
    border: 0;
  }
  .brand {
    font-size: 12px;
  }
  #battle-hud {
    background: #10212ade;
    padding: 3px max(12px, env(safe-area-inset-right)) 4px max(12px, env(safe-area-inset-left));
    gap: 8px;
    height: 39px;
    flex-shrink: 0;
    pointer-events: none;
    box-shadow: none;
  }
  #portrait {
    width: 28px;
    height: 28px;
  }
  .meters {
    width: 160px;
    max-width: 26vw;
  }
  .meters div {
    font-size: 8px;
    line-height: 9px;
  }
  .meters meter {
    height: 5px;
    margin: 1px 0;
  }
  .match {
    gap: 1px;
  }
  .match strong {
    font-size: 10px;
  }
  .match span,
  .score span {
    font-size: 9px;
  }
  .score strong {
    font-size: 15px;
    line-height: 16px;
  }
  #controls {
    position: absolute;
    inset: auto 0 max(6px, env(safe-area-inset-bottom));
    background: transparent;
    border: 0;
    padding: 0 max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left));
    justify-content: space-between;
    align-items: end;
    pointer-events: none;
  }
  #movement {
    flex-direction: row;
    align-items: end;
    gap: 8px;
  }
  #stick,
  #dodge,
  .attack {
    pointer-events: auto;
  }
  #stick {
    width: 80px;
    height: 80px;
    background: #162d3cbf;
  }
  #stick i {
    left: 22px;
    top: 22px;
  }
  #dodge {
    min-height: 44px;
    min-width: 62px;
    padding: 6px;
    background: #162d3cd9;
  }
  #attack-panel {
    flex: none;
    width: clamp(168px, 24vw, 216px);
  }
  #attacks {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
  }
  .attack {
    min-height: 52px;
    padding: 3px;
    border-radius: 8px;
    background: #142b3bdf;
  }
  .attack em {
    display: none;
  }
  .attack b {
    min-height: 24px;
    font-size: 9px;
    line-height: 11px;
  }
  .attack small {
    font-size: 9px;
  }
  .attack kbd {
    display: none;
  }
  #arena-party {
    position: absolute;
    right: calc(clamp(192px, 29vw, 252px) + max(18px, env(safe-area-inset-right)));
    bottom: max(6px, env(safe-area-inset-bottom));
    padding: 0;
    gap: 3px;
    background: transparent;
  }
  #arena-party button {
    position: relative;
    width: 44px;
    min-height: 44px;
    max-width: none;
    padding: 3px;
    background: #102536dd;
  }
  #arena-party button::after {
    content: '';
    position: absolute;
    left: 4px;
    right: 4px;
    bottom: 2px;
    height: 3px;
    background: linear-gradient(to right, #83d9aa var(--health), #192833 var(--health));
  }
  #arena-party img {
    width: 34px;
    height: 34px;
  }
  #arena-party span {
    display: none;
  }
  #switch-status {
    position: absolute;
    bottom: calc(54px + env(safe-area-inset-bottom));
    right: calc(clamp(192px, 29vw, 252px) + max(18px, env(safe-area-inset-right)));
    max-width: 275px;
    z-index: 2;
    border-radius: 5px;
    background: #10202dcc;
    pointer-events: none;
    padding: 2px 5px;
    font-size: 9px;
  }
  #combat-status {
    top: 88px;
    max-width: 40%;
    font-size: 10px;
  }
  .overlay {
    inset-block-start: 44px;
  }
}
@media (orientation: landscape) and (max-height: 550px) and (max-width: 750px) {
  #arena-party {
    display: grid;
    grid-template-columns: repeat(3, 44px);
  }
  #switch-status {
    bottom: calc(102px + env(safe-area-inset-bottom));
    max-width: 160px;
  }
}

#arena-location,
#arena-mode,
#arena-difficulty {
  width: 100%;
  margin-top: 6px;
  padding: 10px;
  color: inherit;
  background: #172938;
  border: 1px solid #71868c;
  border-radius: 8px;
  font: inherit;
}
#arena-difficulty {
  -webkit-appearance: none;
  appearance: none;
  min-height: 44px;
  height: 44px;
  padding-right: 36px;
  background-image:
    linear-gradient(45deg, transparent 50%, #eef6ff 50%),
    linear-gradient(135deg, #eef6ff 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 12px) 50%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}
#city-help,
#mode-help,
#difficulty-help {
  color: #b5d7cd;
  font-size: 0.85rem;
  line-height: 1.45;
}

/* Fury dial and definitive attack. It floats over the field so the four-attack
   grid keeps its tested geometry on every screen. */
#ultimate {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 2;
  width: 84px;
  height: 84px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #cdb98a;
  font-weight: 900;
  text-transform: uppercase;
  touch-action: none;
  background:
    radial-gradient(circle, #14212e 0 58%, #0000 59%),
    conic-gradient(#ffcf5a calc(var(--fury, 0) * 1%), #2a3948 0);
  box-shadow: 0 0 0 3px #0c1622cc;
  opacity: 0.88;
}
#ultimate[hidden] {
  display: none;
}
#ultimate b {
  font-size: 9px;
  line-height: 11px;
  text-align: center;
}
#ultimate small {
  font-size: 12px;
  color: #8fa4b3;
}
#ultimate small:empty {
  display: none;
}
#ultimate[data-ready='true'] {
  color: #2a1c05;
  opacity: 1;
  background:
    radial-gradient(circle, #ffe9a8 0 58%, #0000 59%), conic-gradient(#ff9d3c 100%, #2a3948 0);
  box-shadow:
    0 0 0 3px #fff3c4,
    0 0 26px 6px #ffb347b3;
  animation: ultimate-ready 0.7s ease-in-out infinite alternate;
}
#ultimate[data-ready='true'] small {
  color: #6b4a12;
}
@keyframes ultimate-ready {
  to {
    transform: scale(1.09);
  }
}
#loadout [data-ultimate] {
  grid-column: 1 / -1;
  color: #ffdf94;
}
@media (max-width: 700px) {
  #ultimate {
    width: 68px;
    height: 68px;
    right: 10px;
    bottom: 10px;
  }
  #ultimate b {
    font-size: 7.5px;
  }
}
/* Short landscape: the attack grid overlays the bottom-right corner and the
   radar the top-right, so the dial sits above the joystick. */
@media (orientation: landscape) and (max-height: 550px) {
  #ultimate {
    width: 60px;
    height: 60px;
    right: auto;
    left: max(12px, env(safe-area-inset-left));
    bottom: auto;
    top: 96px;
  }
  #ultimate b {
    font-size: 7px;
  }
  #ultimate small {
    font-size: 10px;
  }
}
@media (prefers-reduced-motion: reduce) {
  #ultimate[data-ready='true'] {
    animation: none;
  }
}

/* Two-thumb layout: the movement hand never has to leave its stick to dodge. */
body[data-touch='true'] #controls {
  gap: 10px;
  justify-content: space-between;
  align-items: end;
  padding-inline: max(var(--touch-inset, 10px), env(safe-area-inset-left))
    max(var(--touch-inset, 10px), env(safe-area-inset-right));
  padding-bottom: max(var(--touch-lift, 8px), env(safe-area-inset-bottom));
}
body[data-touch='true'] #stick {
  width: min(22vw, calc(80px * var(--touch-size, 1)));
  height: min(22vw, calc(80px * var(--touch-size, 1)));
  flex-shrink: 0;
}
body[data-touch='true'] #stick i {
  left: calc(50% - 17.5px);
  top: calc(50% - 17.5px);
}
body[data-touch='true'] #attack-panel {
  flex: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  width: min(
    calc(180px * var(--touch-size, 1)),
    calc(100vw - 110px - var(--touch-inset, 10px) * 2)
  );
}
body[data-touch='true'] #attacks {
  grid-column: 1 / -1;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}
body[data-touch='true'] #aim-help {
  display: none;
}
body[data-touch='true'] .attack {
  min-height: calc(54px * var(--touch-size, 1));
  padding: 5px 3px;
  border-radius: 18px;
}
body[data-touch='true'] .attack em,
body[data-touch='true'] .attack kbd {
  display: none;
}
body[data-touch='true'] .attack b {
  font-size: calc(10px * var(--touch-size, 1));
  line-height: 1.15;
  min-height: 23px;
}
body[data-touch='true'] .attack small {
  font-size: 10px;
}
body[data-touch='true'] #dodge,
body[data-touch='true'] #ultimate {
  position: static;
  min-width: 0;
  width: 100%;
  height: calc(46px * var(--touch-size, 1));
  min-height: 44px;
  border-radius: 18px;
  pointer-events: auto;
  font-size: 11px;
}
body[data-touch='true'] #ultimate b {
  font-size: 9px;
}
.attack[data-cancelled='true'] {
  outline: 3px solid #ff9b99;
  opacity: 0.55;
}
#touch-settings {
  margin-block: 12px;
  border: 1px solid #58727d;
  border-radius: 10px;
}
#touch-settings p {
  font-size: 12px;
  line-height: 1.5;
}
#touch-settings input {
  display: block;
  width: 100%;
  margin-block: 10px 16px;
  min-height: 28px;
}
#touch-settings output {
  float: right;
}
#input-settings {
  max-height: 85dvh;
  overflow-y: auto;
}
@media (orientation: landscape) and (max-height: 550px) {
  body[data-touch='true'] #controls {
    bottom: max(var(--touch-lift, 8px), env(safe-area-inset-bottom));
    padding-bottom: 0;
  }
}

#roster {
  max-height: 290px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 3px;
}
#pokemon-search,
#arena-opponent {
  width: 100%;
  padding: 12px;
  margin: 8px 0;
  background: #203447;
  color: #eef6ff;
  border: 1px solid #638391;
  border-radius: 8px;
  font: inherit;
}
#free-arena {
  border-color: #e8c887;
  color: #ffe1a1;
  margin: 8px 0;
}
body.arena-video #battle-hud {
  display: none;
}
body.arena-video #topbar .brand,
body.arena-video #topbar #sound {
  display: none;
}
body.arena-video #controls {
  opacity: 0.08;
}
body.arena-video #controls:focus-within,
body.arena-video #controls:active {
  opacity: 0.75;
}
@media (pointer: fine) {
  body.arena-video #controls {
    visibility: hidden;
  }
}
@media (max-width: 600px) {
  #roster {
    max-height: 230px;
  }
  #arena-video {
    max-width: 105px;
  }
}
.arena-video #controls {
  position: absolute;
  bottom: env(safe-area-inset-bottom);
  left: 0;
  right: 0;
  z-index: 4;
}
.arena-video #topbar {
  position: absolute;
  inset: 0 0 auto;
  opacity: 0.15;
}
.arena-video #topbar:hover,
.arena-video #topbar:focus-within {
  opacity: 1;
}
.arena-video #ultimate {
  opacity: 0.08;
}

/* One 44px battle row in short landscape viewports, including browser bars. */
#battle-menu {
  display: none;
}
#battle-options {
  width: min(460px, calc(100vw - 32px));
  max-height: calc(100dvh - 24px);
  overflow: auto;
  color: #eef6ff;
  background: #162432;
  border: 1px solid #a8d9dd;
  border-radius: 14px;
  padding: 16px;
}
#battle-options::backdrop {
  background: #07111d99;
}
#battle-options-info {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  text-align: center;
}
#battle-options-info .match strong {
  font-size: 14px;
}
#battle-options-info .match span,
#battle-options-info #timer {
  font-size: 13px;
  color: #a4b8c9;
}
#battle-options-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
#battle-options button {
  min-height: 44px;
}
body.arena-compact #topbar {
  display: none;
}
body.arena-compact #battle-hud {
  position: absolute;
  top: env(safe-area-inset-top);
  left: env(safe-area-inset-left);
  right: env(safe-area-inset-right);
  height: 44px;
  padding: 4px 88px 4px 10px;
  gap: 10px;
  background: #10212abf;
}
body.arena-compact .meters {
  width: clamp(150px, 28vw, 260px);
  max-width: none;
}
body.arena-compact .meters div {
  font-size: 10px;
  line-height: 11px;
}
body.arena-compact .meters meter {
  height: 5px;
  margin: 1px 0;
}
body.arena-compact .score {
  margin-left: auto;
}
body.arena-compact #battle-menu {
  display: block;
  position: absolute;
  z-index: 4;
  top: env(safe-area-inset-top);
  right: calc(6px + env(safe-area-inset-right));
  height: 44px;
  min-width: 72px;
  padding: 6px 10px;
  font-size: 12px;
  background: transparent;
  border: 0;
}

/* Desktop combat: six teammates share the meters' row, leaving the field
   between two shallow bars. Touch layouts keep their larger targets. */
body.arena-desktop:not(.arena-video) #arena-app {
  position: relative;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) 120px;
  grid-template-rows: 36px 48px auto minmax(0, 1fr) 40px;
  column-gap: 12px;
}
body.arena-desktop:not(.arena-video) #topbar {
  grid-area: 1 / 1 / 2 / -1;
  padding: 2px 10px;
  gap: 8px;
}
body.arena-desktop:not(.arena-video) #topbar button {
  min-height: 28px;
  padding: 4px 8px;
}
body.arena-desktop:not(.arena-video) .brand {
  flex: none;
  font-size: 12px;
}
body.arena-desktop:not(.arena-video) .match {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}
body.arena-desktop:not(.arena-video) .match strong {
  font-size: 11px;
  letter-spacing: 0.06em;
}
body.arena-desktop:not(.arena-video) .match span {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
body.arena-desktop:not(.arena-video) #battle-hud {
  grid-area: 2 / 1 / 3 / -1;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) 120px;
  gap: 12px;
  padding: 0;
  box-shadow: none;
}
body.arena-desktop:not(.arena-video) #portrait {
  display: none;
}
body.arena-desktop:not(.arena-video):has(#arena-party[hidden]) #portrait {
  display: block;
  grid-area: 1 / 2;
  justify-self: center;
  width: 32px;
  height: 32px;
}
body.arena-desktop:not(.arena-video) .meters {
  grid-area: 1 / 1;
  align-self: center;
  width: auto;
  max-width: none;
  margin-left: 10px;
}
body.arena-desktop:not(.arena-video) .meters meter {
  height: 5px;
  margin: 1px 0 2px;
}
body.arena-desktop:not(.arena-video) .score {
  grid-area: 1 / 3;
  align-self: center;
  margin-right: 10px;
}
body.arena-desktop:not(.arena-video) .score strong {
  font-size: 15px;
}
body.arena-desktop:not(.arena-video) .score span {
  font-size: 10px;
}
body.arena-desktop:not(.arena-video) #arena-party {
  grid-area: 2 / 2;
  align-items: stretch;
  padding: 4px 0;
  background: transparent;
}
body.arena-desktop:not(.arena-video) #arena-party button {
  flex: 1;
  min-width: 0;
  max-width: none;
  padding: 2px 4px;
  gap: 4px;
}
body.arena-desktop:not(.arena-video) #arena-party img {
  width: 26px;
  height: 26px;
}
body.arena-desktop:not(.arena-video) #arena-party span {
  font-size: 10px;
  line-height: 12px;
  text-align: left;
}
body.arena-desktop:not(.arena-video) #switch-status {
  grid-area: 3 / 1 / 4 / -1;
  min-height: 18px;
  padding: 1px 10px;
  font-size: 10px;
}
body.arena-desktop:not(.arena-video) #field {
  grid-area: 4 / 1 / 5 / -1;
}
body.arena-desktop:not(.arena-video) #controls {
  grid-area: 5 / 1 / 6 / -1;
  gap: 8px;
  padding: 4px 10px;
}
body.arena-desktop:not(.arena-video) #aim-help {
  display: none;
}
body.arena-desktop:not(.arena-video) #attack-panel {
  max-width: 1000px;
}
body.arena-desktop:not(.arena-video) #dodge {
  min-height: 30px;
  height: 30px;
  padding: 3px 10px;
  font-size: 11px;
}
body.arena-desktop:not(.arena-video) .attack {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  height: 30px;
  padding: 3px 7px;
  border-bottom-width: 2px;
  border-radius: 6px;
}
body.arena-desktop:not(.arena-video) .attack kbd {
  position: static;
  flex-shrink: 0;
  font-size: 9px;
}
body.arena-desktop:not(.arena-video) .attack em {
  font-size: 14px;
  line-height: 14px;
}
body.arena-desktop:not(.arena-video) .attack b {
  min-height: 0;
  min-width: 0;
  font-size: 11px;
  line-height: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.arena-desktop:not(.arena-video) .attack small {
  flex-shrink: 0;
  margin-left: auto;
  font-size: 9px;
  line-height: 11px;
  flex-direction: column;
  text-align: right;
}
.alternative-entry {
  display: block;
  margin: 12px 0;
  padding: 14px 18px;
  border: 1px solid #e9bc67;
  border-radius: 12px;
  background: #28233d;
  color: #ffe3a5;
  font-weight: 700;
  text-decoration: none;
}
.alternative-entry:hover,
.alternative-entry:focus-visible {
  background: #383050;
  outline: 2px solid #ffe3a5;
  outline-offset: 3px;
}

#adventure-arena {
  border-color: #93e3ca;
  color: #c3ffe9;
  margin-block: 8px;
}
body[data-adventure='true'] #combat-status {
  width: max-content;
  max-width: min(80%, 620px);
  white-space: normal;
  text-align: center;
}
body[data-adventure='true'] #dodge {
  font-size: 11px;
}
@media (orientation: landscape) and (max-height: 550px) {
  body[data-adventure='true'] #combat-status {
    max-width: 42%;
    top: 72px;
  }
  body[data-adventure='true'] #dodge {
    font-size: 9px;
  }
}
