:root {
  --red: #e3363f;
  --red-dark: #9e1f2f;
  --yellow: #ffd84d;
  --blue: #2f6db5;
  --ink: #152033;
  --muted: #607089;
  --line: #d8e0ec;
  --paper: #fffaf0;
  --white: #ffffff;
  --grass: #56b56f;
  --grass-dark: #2f8755;
  --shadow: 0 18px 45px rgba(21, 32, 51, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 14% 12%, rgba(255, 216, 77, 0.38), transparent 24rem),
    radial-gradient(circle at 92% 8%, rgba(47, 109, 181, 0.2), transparent 26rem),
    linear-gradient(135deg, #f7f9fc 0%, #fff3e4 48%, #e7f5ed 100%);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.control-deck,
.stat-panel,
.api-console,
.battle-console {
  border: 1px solid rgba(21, 32, 51, 0.1);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  position: relative;
}

.control-deck {
  display: grid;
  grid-template-columns: minmax(230px, 0.9fr) minmax(320px, 1.4fr) auto;
  gap: 18px;
  align-items: center;
  padding: 18px;
  border-radius: 8px;
  z-index: 30;
}

.brand-block {
  display: flex;
  gap: 14px;
  align-items: center;
}

.pokeball {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border: 4px solid var(--ink);
  border-radius: 50%;
  background: linear-gradient(#ef3f42 0 47%, var(--ink) 47% 55%, #fff 55% 100%);
  box-shadow: 0 8px 16px rgba(21, 32, 51, 0.18);
}

.pokeball::after {
  content: "";
  width: 15px;
  height: 15px;
  border: 4px solid var(--ink);
  border-radius: 50%;
  background: var(--white);
}

.pokeball.large {
  width: 76px;
  height: 76px;
}

.pokeball.large::after {
  width: 24px;
  height: 24px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--red-dark);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.75rem, 3vw, 3rem);
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 1.1rem;
}

.title-with-help {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.help-button {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 50%;
  color: var(--white);
  background: var(--blue);
  box-shadow: 0 6px 14px rgba(47, 109, 181, 0.22);
  font-size: 0.85rem;
  font-weight: 1000;
  line-height: 1;
}

.help-button:hover {
  filter: brightness(1.05);
}

.help-dialog {
  width: min(460px, calc(100% - 32px));
  padding: 0;
  border: 1px solid rgba(21, 32, 51, 0.14);
  border-radius: 8px;
  color: var(--ink);
  background: var(--white);
  box-shadow: 0 24px 70px rgba(21, 32, 51, 0.28);
}

.help-dialog::backdrop {
  background: rgba(21, 32, 51, 0.38);
}

.help-dialog-header {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.help-close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  color: var(--ink);
  background: #edf1f7;
  font-weight: 1000;
}

.help-dialog p {
  margin: 0;
  padding: 18px;
  color: var(--muted);
  font-weight: 750;
  line-height: 1.5;
}

.intro-dialog {
  width: min(540px, calc(100% - 32px));
  padding: 0;
  border: 1px solid rgba(21, 32, 51, 0.14);
  border-radius: 8px;
  color: var(--ink);
  background: var(--white);
  box-shadow: 0 28px 80px rgba(21, 32, 51, 0.3);
}

.intro-dialog::backdrop {
  background: rgba(21, 32, 51, 0.42);
  backdrop-filter: blur(3px);
}

.intro-content {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 22px;
}

.intro-content h2 {
  margin-bottom: 8px;
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.intro-content p:last-of-type {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 760;
  line-height: 1.5;
}

.intro-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 12px;
  width: 100%;
}

.intro-close {
  flex: 1;
  min-height: 44px;
  border-radius: 8px;
  color: var(--white);
  background: var(--red);
  font-weight: 1000;
  transition: background-color 160ms, transform 160ms;
}

.intro-close:hover {
  background: var(--red-dark);
}

.github-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  color: var(--ink);
  background: var(--paper);
  text-decoration: none;
  font-weight: 1000;
  transition: background-color 160ms, transform 160ms, box-shadow 160ms;
  box-shadow: 4px 4px 0 rgba(21, 32, 51, 0.15);
}

.github-link-btn:hover {
  background: #edf1f7;
  transform: translateY(-2px);
  box-shadow: 4px 6px 0 rgba(21, 32, 51, 0.2);
}

.github-link-btn:active {
  transform: translateY(0);
  box-shadow: 4px 4px 0 rgba(21, 32, 51, 0.15);
}

.github-link-btn i {
  width: 20px;
  height: 20px;
}

.search-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 48px;
  gap: 10px;
}

.suggest-field {
  position: relative;
  min-width: 0;
}

.search-bar input,
.rival-form input {
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border: 2px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--white);
  outline: none;
}

.search-bar input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(47, 109, 181, 0.16);
}

.suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 100;
  display: none;
  overflow: hidden;
  border: 1px solid rgba(216, 224, 236, 0.95);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 32px rgba(21, 32, 51, 0.16);
}

.suggestions.is-open {
  display: grid;
}

.suggestions button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 0 12px;
  color: var(--ink);
  background: transparent;
  font-weight: 850;
  text-align: left;
  text-transform: capitalize;
}

.suggestions button:hover,
.suggestions button.is-active {
  background: #edf1f7;
  outline: none;
}

.suggestions small {
  color: var(--muted);
  font-weight: 900;
}

.search-bar > button,
.quick-actions button,
.type-filter button {
  min-height: 48px;
  padding: 0 16px;
  border-radius: 8px;
  color: var(--white);
  background: var(--blue);
  font-weight: 800;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.search-bar > button:first-of-type {
  background: var(--red);
}

.search-bar > button:hover,
.quick-actions button:hover,
.type-filter button:hover,
.pokemon-card:hover {
  transform: translateY(-2px);
}

.search-bar .suggestions button,
.rival-form .suggestions button {
  min-height: 38px;
  padding: 0 12px;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
  font-size: 0.9rem;
}

.search-bar .suggestions button:hover,
.search-bar .suggestions button.is-active,
.rival-form .suggestions button:hover,
.rival-form .suggestions button.is-active {
  transform: none;
  background: #edf1f7;
  outline: none;
}

.icon-button {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink) !important;
  color: var(--white);
  padding: 0 !important;
  cursor: pointer;
  border: none;
  width: 48px;
  height: 48px;
}

.icon-button:hover {
  filter: brightness(1.2);
}

.icon-button i {
  width: 22px;
  height: 22px;
}


.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}

.stage-column {
  display: grid;
  gap: 18px;
}

.battle-stage {
  font-family: 'Press Start 2P', monospace;
  display: flex;
  flex-direction: column;
  min-height: 520px;
  overflow: hidden;
  border: 4px solid var(--ink);
  border-radius: 4px;
  background: #b0e0e6;
  box-shadow: var(--shadow);
  image-rendering: pixelated;
  position: relative; /* Container for absolute positioned submenus */
}

.arena-sky {
  position: relative;
  min-height: 180px;
  background: linear-gradient(180deg, #b0e0e6 0%, #e0f7fa 100%);
  border-bottom: 2px solid #6cb57f;
}



.arena-sky::before,
.arena-sky::after {
  display: none;
}

.score-chip {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 1;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 11px 14px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 6px 6px 0 rgba(21, 32, 51, 0.15);
  font-weight: 900;
  text-transform: capitalize;
}

.rival-chip {
  position: absolute;
  top: 18px;
  right: 76px;
  z-index: 1;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 11px 14px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: #eef7ff;
  box-shadow: 6px 6px 0 rgba(21, 32, 51, 0.15);
  font-weight: 900;
  text-transform: capitalize;
}

.battle-random-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 10;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--paper) !important;
  color: var(--ink) !important;
  box-shadow: 6px 6px 0 rgba(21, 32, 51, 0.15);
  transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
  cursor: pointer;
}

.battle-random-btn:hover {
  background: #edf1f7 !important;
  transform: translateY(-2px);
  box-shadow: 6px 8px 0 rgba(21, 32, 51, 0.2);
}

.battle-random-btn:active {
  transform: translateY(0);
  box-shadow: 6px 6px 0 rgba(21, 32, 51, 0.15);
}

.score-chip strong {
  color: var(--blue);
}

.arena-field {
  position: relative;
  flex: 1;
  min-height: 220px;
  background: radial-gradient(ellipse at 50% 0%, #c2e2b5 0%, #a8d08d 70%); /* Perspective light gradient at the horizon */
  border-bottom: 4px solid var(--ink);
  transition: background 600ms ease, box-shadow 600ms ease;
}

.center-battle-btn {
  display: none;
}

.battle-turn-counter {
  display: none;
}

.is-hidden {
  display: none !important;
}

.pokemon-spotlight {
  position: absolute;
  bottom: 4px;
  display: grid;
  align-items: end; /* Sit elements on the bottom line */
  justify-items: center; /* Center horizontally */
  width: min(48%, 360px);
  aspect-ratio: 1.75 / 1;
  --pokemon-height: 210px;
  --shadow-scale: 1;
}

.player-spotlight {
  left: 2%;
  bottom: -40px;
  transform: scale(1.25);
  transform-origin: bottom center;
}

.rival-spotlight {
  right: -2%;
  bottom: 90px; /* Ajustado para el nuevo scale */
  transform: scale(0.85); /* Más grande para que sea visible */
  transform-origin: bottom center;
}

.pokemon-spotlight::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2%;
  z-index: 0;
  width: calc(35% + (var(--shadow-scale) * 12%));
  height: 18%;
  border-radius: 50%;
  background: rgba(21, 32, 51, 0.14);
  filter: blur(2px);
  transform: translateX(-50%);
  pointer-events: none;
}
.pokemon-spotlight img {
  position: relative;
  grid-area: 1 / 1;
  align-self: end;
  z-index: 1;
  width: auto;
  height: var(--pokemon-height);
  max-width: 95%;
  max-height: 400px;
  object-fit: contain;
  object-position: bottom center;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  opacity: 0;
  transform: translateY(12px);
  transform-origin: bottom center;
  transition: opacity 220ms ease, transform 220ms ease, filter 220ms ease;
}

.pokemon-spotlight.is-flying img {
  bottom: 24px;
}

.pokemon-spotlight.is-defeated img {
  filter: grayscale(1) saturate(0.08) contrast(0.82);
  opacity: 0.48;
}

.pokemon-spotlight.is-attacking img {
  animation: lunge-hit 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.player-spotlight.is-attacking img {
  animation: lunge-hit-player 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.player-spotlight.is-attacking::after {
  animation: lunge-hit-shadow-player 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.rival-spotlight.is-attacking img {
  animation: lunge-hit-rival 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.rival-spotlight.is-attacking::after {
  animation: lunge-hit-shadow-rival 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.pokemon-spotlight.is-hit img {
  animation: receive-hit 420ms ease;
}

.arena-field.is-hit-flash {
  animation: arena-flash 420ms ease;
}

.defeated-label {
  position: absolute;
  left: 50%;
  top: 48%;
  z-index: 3;
  display: none;
  padding: 8px 14px;
  border: 3px solid rgba(141, 24, 36, 0.92);
  border-radius: 8px;
  color: #ffffff;
  background: rgba(227, 54, 63, 0.95);
  box-shadow: 4px 4px 0 rgba(21, 32, 51, 0.2);
  font-size: clamp(0.9rem, 2vw, 1.2rem);
  font-weight: 1000;
  letter-spacing: 0;
  text-transform: uppercase;
  transform: translate(-50%, -50%) rotate(-7deg);
}

.pokemon-spotlight.is-defeated .defeated-label {
  display: block;
  animation: defeat-stamp 260ms ease both;
}

.hit-effect {
  position: absolute;
  left: 50%;
  top: 42%;
  z-index: 2;
  width: 78px;
  aspect-ratio: 1;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.4);
}

.pokemon-spotlight.is-hit .hit-effect {
  animation: hit-flash 360ms ease;
}

.hit-effect::before,
.hit-effect::after {
  content: "";
  position: absolute;
  inset: 0;
  clip-path: polygon(50% 0, 60% 34%, 100% 28%, 68% 52%, 92% 86%, 56% 68%, 42% 100%, 38% 62%, 0 72%, 30% 48%, 8% 14%, 42% 32%);
}

.hit-effect::before {
  background: #ffe66d;
}

.hit-effect::after {
  inset: 12px;
  background: #e3363f;
}

.rival-spotlight img {
  max-width: 88%;
}

.rival-spotlight .height-tag {
  right: 8%;
}

.pokemon-spotlight img.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.height-tag {
  display: none;
}

.empty-state {
  position: absolute;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 12px;
  max-width: 360px;
  color: var(--ink);
  text-align: center;
  font-weight: 800;
}

.empty-state.is-hidden {
  display: none;
}

.battle-hud {
  display: grid;
  gap: 8px;
  width: min(280px, 46%);
  padding: 12px 16px;
  border: 4px solid #5a5a5a;
  background: #f8f8f8;
  box-shadow: inset -2px -2px 0px rgba(0,0,0,0.1), 4px 4px 0 rgba(0,0,0,0.2);
  font-size: 0.65rem;
  text-transform: uppercase;
  color: #333;
}

.player-hud {
  position: absolute;
  left: 18px;
  bottom: 12px;
  z-index: 5;
  border-bottom-right-radius: 16px;
  border-top-left-radius: 16px;
}

.rival-hud {
  position: absolute;
  right: 18px;
  bottom: 12px;
  z-index: 5;
  border-bottom-left-radius: 16px;
  border-top-right-radius: 16px;
}

.hud-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 2px solid #ccc;
  padding-bottom: 4px;
}

.hud-level {
  font-size: 0.6rem;
}

.hp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #5a5a5a;
  padding: 4px;
  border-radius: 4px;
  border: 2px solid #333;
}

.ps-label {
  color: #f2c94c;
  font-weight: 900;
  font-size: 0.6rem;
}

.hp-track {
  flex: 1;
  height: 6px;
  background: #4a4a4a;
  border: 1px solid #222;
}

.hp-track span {
  display: block;
  width: 0;
  height: 100%;
  background: #20a866;
  transition: width 220ms ease, background 220ms ease;
}

.player-hud strong {
  text-align: right;
  font-size: 0.65rem;
  margin-top: 2px;
}

/* Pokemon Spotlight Retro Shadow */
/* Player platform base */
.player-spotlight::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2%;
  z-index: 0;
  width: calc(65% + (var(--shadow-scale) * 15%)); /* Massive wide base */
  height: 24%; /* Steeper perspective ellipse */
  border-radius: 50%;
  background: #7ca863;
  border: 4px solid #5a8a43;
  transform: translateX(-50%);
  pointer-events: none;
  box-shadow: 0 8px 0 #4c7538; /* 3D thickness */
}

/* Rival platform base */
.rival-spotlight::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 4%;
  z-index: 0;
  width: calc(45% + (var(--shadow-scale) * 10%)); /* Distant smaller base */
  height: 16%; /* Flatter perspective ellipse */
  border-radius: 50%;
  background: #7ca863;
  border: 2px solid #5a8a43;
  transform: translateX(-50%);
  pointer-events: none;
  box-shadow: 0 4px 0 #4c7538; /* Distant smaller 3D thickness */
}

/* Bottom Menu */
.battle-bottom-menu {
  font-family: 'Press Start 2P', monospace;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  height: 120px;
  background: #2a2a2a;
  position: relative; /* Contain absolute positioned submenus */
}

.battle-bottom-menu.actions-hidden {
  grid-template-columns: 1fr;
}

.battle-dialog-box {
  padding: 16px;
  border: 4px solid #b0b0b0;
  border-radius: 8px;
  margin: 6px;
  background: #f8f8f8;
  color: #333;
  font-size: 0.85rem;
  line-height: 1.6;
}

.battle-dialog-box p {
  margin: 0;
}

.battle-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 6px;
}

.battle-action-grid.is-hidden {
  display: none;
}

.battle-submenu {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(21, 32, 51, 0.65); /* Dark transparent backdrop */
  backdrop-filter: blur(2px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
}

.battle-submenu.is-hidden {
  display: none !important;
}

.submenu-modal {
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 8px;
  width: min(340px, 90%);
  max-height: 280px;
  padding: 16px;
  gap: 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  animation: modal-pop 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modal-pop {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.submenu-title {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  border-bottom: 2px solid var(--line);
  padding-bottom: 6px;
  margin-bottom: 4px;
}

.submenu-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  flex: 1;
}

.submenu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--white);
  border: 2px solid var(--ink);
  font-family: 'Press Start 2P', monospace;
  font-size: 0.65rem;
  color: var(--ink);
  cursor: pointer;
}

.submenu-item:hover {
  background: #f0f0f0;
}

.submenu-item.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.submenu-item img {
  width: 28px;
  height: 28px;
  image-rendering: pixelated;
}

.submenu-item span {
  flex: 1;
  text-align: left;
  margin-left: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.submenu-item strong {
  white-space: nowrap;
  margin-left: 8px;
}

.btn-cancel {
  background: #e3363f;
  color: white;
  border: 2px solid var(--ink);
  padding: 4px;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.7rem;
  margin-top: auto;
}

.gba-btn {
  border: 4px solid #e0e0e0;
  border-radius: 8px;
  font-family: "Press Start 2P", system-ui, sans-serif;
  font-size: 0.7rem;
  color: #333;
  background: #f8f8f8;
  text-transform: uppercase;
  box-shadow: inset -2px -2px 0px rgba(0,0,0,0.15);
  transition: transform 100ms, filter 100ms;
  padding: 4px;
}

.gba-btn:hover {
  transform: scale(0.98);
  filter: brightness(0.9);
}

.gba-btn:active {
  box-shadow: inset 2px 2px 0px rgba(0,0,0,0.2);
}

.btn-fight {
  background: #ff8a8a;
  border-color: #ff4a4a;
}

.btn-bag {
  background: #ffcc80;
  border-color: #ff9800;
}

.btn-pokemon {
  background: #81c784;
  border-color: #4caf50;
}

.btn-run {
  background: #64b5f6;
  border-color: #2196f3;
}

.stat-panel {
  padding: 18px;
  border-radius: 8px;
  align-self: start;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.profile-grid div {
  min-height: 58px;
  padding: 10px;
  border: 1px solid rgba(216, 224, 236, 0.85);
  border-radius: 8px;
  background: #fbfdff;
}

.profile-grid span,
.data-panel h3 {
  display: block;
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.profile-grid strong {
  display: block;
  font-size: 0.86rem;
}

.lore-panel {
  margin-top: 14px;
  padding: 12px;
  border-left: 4px solid var(--yellow);
  border-radius: 8px;
  color: var(--ink);
  background: #fffaf0;
  font-size: 0.86rem;
  font-weight: 750;
  line-height: 1.45;
}

.data-panel {
  margin-top: 14px;
}

.location-list,
.evolution-line,
.move-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.location-list span,
.evolution-line span,
.move-list span {
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--ink);
  background: #edf1f7;
  font-size: 0.76rem;
  font-weight: 850;
}

.evolution-line span {
  background: rgba(255, 216, 77, 0.46);
}

.move-list span {
  background: rgba(47, 109, 181, 0.12);
}

.battle-console {
  margin-top: 18px;
  padding: 18px;
  border-radius: 8px;
  z-index: 20;
}

.battle-controls {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(320px, 1.2fr);
  gap: 16px;
  align-items: center;
}

.rival-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
}

.rival-form input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 4px rgba(227, 54, 63, 0.14);
}

.rival-form > button {
  min-height: 46px;
  padding: 0 14px;
  border-radius: 8px;
  color: var(--white);
  background: var(--red);
  font-weight: 900;
}

.rival-form > button:last-child {
  background: var(--ink);
}

.battle-summary.is-finished {
  color: var(--red);
  border-color: var(--red);
  background: #fff5f5;
}

.versus-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-top: 16px;
  padding: 12px;
  border-radius: 8px;
  color: var(--white);
  background:
    linear-gradient(90deg, rgba(47, 109, 181, 0.92), rgba(21, 32, 51, 0.96) 48%, rgba(227, 54, 63, 0.92));
}

.versus-card {
  min-height: 70px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.versus-card.rival {
  text-align: right;
}

.versus-card span {
  display: block;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.versus-card strong {
  display: block;
  margin-top: 5px;
  font-size: clamp(1.15rem, 2.4vw, 2rem);
  line-height: 1;
}

.versus-mark {
  display: grid;
  place-items: center;
  min-height: 74px;
  border-radius: 8px;
  color: var(--yellow);
  background: rgba(21, 32, 51, 0.58);
  font-size: 2rem;
  font-weight: 1000;
  text-shadow: 3px 3px 0 rgba(227, 54, 63, 0.7);
}

.fighter-roster {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.fighter-card {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 116px;
  padding: 8px;
  border: 2px solid rgba(21, 32, 51, 0.16);
  border-radius: 8px;
  color: var(--ink);
  background: linear-gradient(180deg, #ffffff, #eef4fb);
  box-shadow: 0 8px 18px rgba(21, 32, 51, 0.12);
  transition: filter 160ms ease, opacity 160ms ease, transform 160ms ease, border-color 160ms ease;
}

.fighter-roster.has-selection .fighter-card:not(.is-selected) {
  filter: grayscale(1);
  opacity: 0.42;
}

.fighter-card.is-selected {
  border-color: var(--yellow);
  background: linear-gradient(180deg, #fff7c4, #ffffff);
  transform: translateY(-4px);
  box-shadow: 0 12px 26px rgba(227, 54, 63, 0.22);
}

.fighter-card img {
  width: 68px;
  height: 68px;
  object-fit: contain;
}

.fighter-card strong {
  font-size: 0.76rem;
  line-height: 1.1;
  text-align: center;
}

.fighter-id {
  position: absolute;
  top: 6px;
  right: 7px;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 900;
}

.roster-loading {
  grid-column: 1 / -1;
  padding: 14px;
  color: var(--muted);
  font-weight: 900;
}

.vs-burst {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  color: var(--yellow);
  font-size: clamp(5rem, 16vw, 10rem);
  font-weight: 1000;
  letter-spacing: 0;
  text-shadow: 7px 7px 0 var(--red), -4px -4px 0 var(--blue);
  opacity: 0;
  pointer-events: none;
  transform: scale(0.4) rotate(-10deg);
}

.vs-burst.is-active {
  animation: vs-pop 1100ms ease-out;
}

@keyframes receive-hit {
  0% { transform: translateY(0) rotate(0deg); filter: brightness(1); }
  15% { transform: translate(-8px, -4px) rotate(-3deg); filter: brightness(2) saturate(0.2); }
  35% { transform: translate(8px, 2px) rotate(3deg); filter: brightness(1.8) saturate(0.3); }
  58% { transform: translate(-4px, 0) rotate(-1deg); filter: brightness(1.2); }
  100% { transform: translateY(0) rotate(0deg); filter: brightness(1); }
}

@keyframes arena-flash {
  0% { filter: brightness(1); }
  30% { filter: brightness(1.4) saturate(1.5); }
  100% { filter: brightness(1); }
}

@keyframes vs-pop {
  0% {
    opacity: 0;
    transform: scale(0.4) rotate(-10deg);
  }
  32% {
    opacity: 1;
    transform: scale(1.08) rotate(-4deg);
  }
  78% {
    opacity: 1;
    transform: scale(0.98) rotate(-4deg);
  }
  100% {
    opacity: 0;
    transform: scale(1.35) rotate(-4deg);
  }
}

@keyframes lunge-hit {
  0% { transform: translateY(0) scale(1); }
  45% { transform: translate(60px, -12px) scale(1.1); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes lunge-hit-player {
  0% { transform: translateY(0) scale(1); }
  30% { transform: translate(110px, -18px) scale(1.15) rotate(6deg); }
  60% { transform: translate(40px, -4px) scale(1.05); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes lunge-hit-shadow-player {
  0% { transform: translateX(-50%) scale(1); opacity: 1; }
  30% { transform: translate(calc(-50% + 110px), 0) scale(0.9); opacity: 0.6; }
  60% { transform: translate(calc(-50% + 40px), 0) scale(0.95); opacity: 0.8; }
  100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

@keyframes lunge-hit-rival {
  0% { transform: translateY(0) scale(1); }
  30% { transform: translate(-110px, -18px) scale(1.15) rotate(-6deg); }
  60% { transform: translate(-40px, -4px) scale(1.05); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes lunge-hit-shadow-rival {
  0% { transform: translateX(-50%) scale(1); opacity: 1; }
  30% { transform: translate(calc(-50% - 110px), 0) scale(0.9); opacity: 0.6; }
  60% { transform: translate(calc(-50% - 40px), 0) scale(0.95); opacity: 0.8; }
  100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

/* Arena Themes by Type */
.arena-field.theme-normal { background: linear-gradient(180deg, #9da0aa 0%, #83868f 100%); }
.arena-field.theme-fire { background: linear-gradient(180deg, #ff7455 0%, #e3363f 100%); }
.arena-field.theme-water { background: linear-gradient(180deg, #58abf6 0%, #2f6db5 100%); }
.arena-field.theme-electric { background: linear-gradient(180deg, #f8d030 0%, #c4a000 100%); }
.arena-field.theme-grass { background: linear-gradient(180deg, #78c850 0%, #56b56f 100%); }
.arena-field.theme-ice { background: linear-gradient(180deg, #98d8d8 0%, #48a9bc 100%); }
.arena-field.theme-fighting { background: linear-gradient(180deg, #c03028 0%, #9e1f2f 100%); }
.arena-field.theme-poison { background: linear-gradient(180deg, #a040a0 0%, #6b246b 100%); }
.arena-field.theme-ground { background: linear-gradient(180deg, #e0c068 0%, #b78345 100%); }
.arena-field.theme-flying { background: linear-gradient(180deg, #a890f0 0%, #668ad8 100%); }
.arena-field.theme-psychic { background: linear-gradient(180deg, #f85888 0%, #d94b80 100%); }
.arena-field.theme-bug { background: linear-gradient(180deg, #a8b820 0%, #7a9f34 100%); }
.arena-field.theme-rock { background: linear-gradient(180deg, #b8a038 0%, #9b8449 100%); }
.arena-field.theme-ghost { background: linear-gradient(180deg, #705898 0%, #5f5a9d 100%); }
.arena-field.theme-dragon { background: linear-gradient(180deg, #7038f8 0%, #4e6fd2 100%); }
.arena-field.theme-dark { background: linear-gradient(180deg, #705848 0%, #4f5562 100%); }
.arena-field.theme-steel { background: linear-gradient(180deg, #b8b8d0 0%, #637c91 100%); }
.arena-field.theme-fairy { background: linear-gradient(180deg, #f0b6bc 0%, #ce67a5 100%); }

.turn-log {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.turn-row {
  min-height: 72px;
  padding: 12px;
  border: 1px solid rgba(21, 32, 51, 0.1);
  border-radius: 8px;
  background: #fffaf0;
}

.turn-row strong,
.turn-attacks span {
  display: block;
}

.turn-row strong {
  margin-bottom: 5px;
  text-transform: capitalize;
}

.turn-attacks {
  display: grid;
  gap: 6px;
}

.turn-attacks span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
}

.panel-header,
.console-header,
.section-title {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
}

.status-pill {
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--muted);
  background: #edf1f7;
  font-size: 0.78rem;
  font-weight: 900;
}

.status-pill.is-online {
  color: #0c5f38;
  background: #c9f3dc;
}

.type-row,
.ability-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.type-badge,
.ability-badge {
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--white);
  background: var(--blue);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: capitalize;
}

.ability-badge {
  color: var(--ink);
  background: #edf1f7;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 18px 0;
}

.metric-grid div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.metric-grid dt {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.metric-grid dd {
  margin: 5px 0 0;
  font-size: 1.12rem;
  font-weight: 900;
}

.stats-list {
  display: grid;
  gap: 10px;
}

.stat-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 38px;
  gap: 10px;
  align-items: center;
  font-size: 0.84rem;
  font-weight: 900;
  text-transform: capitalize;
}

.stat-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4eaf4;
}

.stat-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), var(--yellow));
}

.explore-band {
  margin-top: 18px;
  padding: 12px 0 2px;
}

.section-title {
  margin-bottom: 8px;
}

.section-title p {
  max-width: 300px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.type-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 16px;
}

.type-filter button {
  min-height: 38px;
  background: var(--ink);
}

.type-filter button.is-active {
  color: var(--ink);
  background: var(--yellow);
}

.pokemon-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.pokemon-card {
  min-height: 132px;
  padding: 14px;
  border: 1px solid rgba(21, 32, 51, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 26px rgba(21, 32, 51, 0.1);
  text-align: left;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.pokemon-card img {
  display: block;
  width: 82px;
  height: 82px;
  margin: 0 auto 4px;
  object-fit: contain;
}

.pokemon-card strong {
  display: block;
  color: var(--ink);
  text-transform: capitalize;
}

.pokemon-card span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.api-console {
  padding: 16px;
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(21, 32, 51, 0.1);
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 22px;
  padding: 18px;
  border-top: 1px solid rgba(21, 32, 51, 0.12);
  color: var(--muted);
  font-weight: 850;
}

.site-footer a {
  color: var(--blue);
  font-weight: 1000;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.matchup-panel {
  padding: 16px;
  border: 1px solid rgba(21, 32, 51, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 12px 32px rgba(21, 32, 51, 0.1);
}

.matchup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.matchup-card {
  min-height: 300px;
  padding: 14px;
  border: 1px solid rgba(216, 224, 236, 0.92);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(251, 253, 255, 0.88)),
    linear-gradient(135deg, rgba(47, 109, 181, 0.16), transparent 52%);
}

.matchup-card.is-empty {
  min-height: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: var(--muted);
  padding: 32px 14px;
}

.matchup-card.rival {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(251, 253, 255, 0.88)),
    linear-gradient(135deg, rgba(227, 54, 63, 0.14), transparent 52%);
}

.matchup-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: start;
}

.matchup-label {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 1000;
  text-transform: uppercase;
}

.matchup-head strong {
  overflow: hidden;
  font-size: clamp(1.1rem, 2vw, 1.55rem);
  line-height: 1;
  text-overflow: ellipsis;
  text-transform: capitalize;
  white-space: nowrap;
}

.matchup-head small {
  color: var(--muted);
  font-weight: 900;
}

.matchup-types {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.matchup-types span {
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--white);
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: capitalize;
}

.matchup-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin: 12px 0;
}

.matchup-metrics div {
  min-height: 54px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(237, 241, 247, 0.78);
}

.matchup-metrics dt {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
}

.matchup-metrics dd {
  margin: 4px 0 0;
  font-weight: 1000;
}

.matchup-stats {
  display: grid;
  gap: 8px;
}

.matchup-stats div {
  display: grid;
  grid-template-columns: 92px 34px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: capitalize;
}

.matchup-stats i {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4eaf4;
}

.matchup-stats em {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--yellow));
}

.console-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.console-metrics span {
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--ink);
  background: rgba(237, 241, 247, 0.82);
  font-size: 0.85rem;
  font-weight: 800;
}

.call-log {
  display: grid;
  gap: 6px;
  max-height: 216px;
  margin-top: 14px;
  overflow: auto;
  padding-right: 6px;
}

.call-row {
  display: grid;
  grid-template-columns: 12px 48px minmax(0, 1fr) 76px 76px;
  gap: 8px;
  align-items: center;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid rgba(216, 224, 236, 0.72);
  border-radius: 8px;
  background: rgba(251, 253, 255, 0.72);
  font-size: 0.78rem;
}

.call-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d8e0ec;
  box-shadow: 0 0 0 4px rgba(216, 224, 236, 0.32);
}

.call-dot.ok {
  background: #40c47a;
  box-shadow: 0 0 0 4px rgba(64, 196, 122, 0.16);
}

.call-dot.cache {
  background: var(--blue);
  box-shadow: 0 0 0 4px rgba(47, 109, 181, 0.16);
}

.call-dot.fail {
  background: #e3363f;
  box-shadow: 0 0 0 4px rgba(227, 54, 63, 0.14);
}

.call-row code {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.method,
.result {
  padding: 4px 7px;
  border-radius: 999px;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 900;
}

.method {
  color: #2f5f9d;
  background: rgba(47, 109, 181, 0.12);
}

.result {
  color: #7a5800;
  background: #ffe9a3;
}

.result.ok {
  color: #0c5f38;
  background: #c9f3dc;
}

.result.cache {
  color: #2f5f9d;
  background: rgba(47, 109, 181, 0.14);
}

.result.fail {
  color: #8d1824;
  background: #ffd1d6;
}

.latency {
  color: var(--muted);
  font-weight: 900;
  text-align: right;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (max-width: 980px) {
  .control-deck,
  .dashboard-grid,
  .battle-controls {
    grid-template-columns: 1fr;
  }

  .quick-actions {
    justify-content: flex-start;
  }

  .pokemon-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .fighter-roster {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .stage-column {
    order: 1;
  }

  .stat-panel {
    order: 2;
  }

  .turn-log {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 20px, 1220px);
    padding-top: 10px;
  }

  .gba-btn {
    font-size: 0.55rem;
    padding: 2px;
    border-width: 2px;
  }

  .battle-dialog-box {
    padding: 8px 12px;
    font-size: 0.75rem;
    margin: 4px;
  }

  .battle-action-grid {
    margin: 4px;
    gap: 3px;
  }

  .control-deck,
  .stat-panel,
  .api-console,
  .battle-console {
    padding: 14px;
  }

  .search-bar {
    grid-template-columns: 1fr 48px;
  }

  .rival-form {
    grid-template-columns: 1fr;
  }

  .search-bar > button:first-of-type {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .battle-stage {
    min-height: 430px;
  }

  .hud-rail {
    left: 12px;
    right: 12px;
    bottom: 12px;
    gap: 10px;
  }

  .rival-chip {
    top: 72px;
    left: 18px;
    right: auto;
  }

  .score-chip,
  .rival-chip {
    padding: 8px 10px;
    font-size: 0.9rem;
  }

  .arena-sky {
    min-height: 214px;
  }

  .pokemon-spotlight {
    width: 58%;
  }

  .player-spotlight {
    left: -4%;
    bottom: -70px;
    transform: scale(1.4);
  }

  .rival-spotlight {
    right: -6%;
    bottom: 105px;
    transform: scale(0.62);
  }

  .center-battle-btn {
    top: 24%;
    min-height: 38px;
    padding: 0 14px;
    font-size: 0.82rem;
  }

  .battle-hud {
    width: min(150px, 44%);
    padding: 6px 8px;
    font-size: 0.55rem;
    gap: 4px;
  }

  .player-spotlight .defeated-label {
    left: 70%;
  }

  .rival-spotlight .defeated-label {
    left: 30%;
  }

  .battle-summary {
    font-size: 0.8rem;
    padding: 10px;
    text-align: center;
  }

  .console-header {
    display: grid;
    grid-template-columns: 1fr;
  }

  .console-metrics {
    justify-content: flex-start;
  }

  .intro-content {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .metric-grid,
  .pokemon-grid,
  .profile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .matchup-grid {
    grid-template-columns: 1fr;
  }

  .matchup-card {
    min-height: 0;
  }

  .matchup-stats div {
    grid-template-columns: 82px 32px minmax(0, 1fr);
  }

  .versus-panel {
    grid-template-columns: 1fr;
  }

  .versus-card.rival {
    text-align: left;
  }

  .fighter-roster {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .call-row {
    grid-template-columns: 12px 44px minmax(0, 1fr);
  }

  .call-row .result,
  .latency {
    display: none;
  }
}


/* Arena Themes by Type */
.arena-field.theme-normal { background: linear-gradient(180deg, #9da0aa 0%, #83868f 100%); }
.arena-field.theme-fire { background: linear-gradient(180deg, #ff7455 0%, #e3363f 100%); }
.arena-field.theme-water { background: linear-gradient(180deg, #58abf6 0%, #2f6db5 100%); }
.arena-field.theme-electric { background: linear-gradient(180deg, #f8d030 0%, #c4a000 100%); }
.arena-field.theme-grass { background: linear-gradient(180deg, #78c850 0%, #56b56f 100%); }
.arena-field.theme-ice { background: linear-gradient(180deg, #98d8d8 0%, #48a9bc 100%); }
.arena-field.theme-fighting { background: linear-gradient(180deg, #c03028 0%, #9e1f2f 100%); }
.arena-field.theme-poison { background: linear-gradient(180deg, #a040a0 0%, #6b246b 100%); }
.arena-field.theme-ground { background: linear-gradient(180deg, #e0c068 0%, #b78345 100%); }
.arena-field.theme-flying { background: linear-gradient(180deg, #a890f0 0%, #668ad8 100%); }
.arena-field.theme-psychic { background: linear-gradient(180deg, #f85888 0%, #d94b80 100%); }
.arena-field.theme-bug { background: linear-gradient(180deg, #a8b820 0%, #7a9f34 100%); }
.arena-field.theme-rock { background: linear-gradient(180deg, #b8a038 0%, #9b8449 100%); }
.arena-field.theme-ghost { background: linear-gradient(180deg, #705898 0%, #5f5a9d 100%); }
.arena-field.theme-dragon { background: linear-gradient(180deg, #7038f8 0%, #4e6fd2 100%); }
.arena-field.theme-dark { background: linear-gradient(180deg, #705848 0%, #4f5562 100%); }
.arena-field.theme-steel { background: linear-gradient(180deg, #b8b8d0 0%, #637c91 100%); }
.arena-field.theme-fairy { background: linear-gradient(180deg, #f0b6bc 0%, #ce67a5 100%); }

.turn-log {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.turn-row {
  min-height: 72px;
  padding: 12px;
  border: 1px solid rgba(21, 32, 51, 0.1);
  border-radius: 8px;
  background: #fffaf0;
}

.turn-row strong,
.turn-attacks span {
  display: block;
}

.turn-row strong {
  margin-bottom: 5px;
  text-transform: capitalize;
}

.turn-attacks {
  display: grid;
  gap: 6px;
}

.turn-attacks span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
}

.panel-header,
.console-header,
.section-title {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
}

.status-pill {
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--muted);
  background: #edf1f7;
  font-size: 0.78rem;
  font-weight: 900;
}

.status-pill.is-online {
  color: #0c5f38;
  background: #c9f3dc;
}

.type-row,
.ability-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.type-badge,
.ability-badge {
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--white);
  background: var(--blue);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: capitalize;
}

.ability-badge {
  color: var(--ink);
  background: #edf1f7;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 18px 0;
}

.metric-grid div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.metric-grid dt {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.metric-grid dd {
  margin: 5px 0 0;
  font-size: 1.12rem;
  font-weight: 900;
}

.stats-list {
  display: grid;
  gap: 10px;
}

.stat-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 38px;
  gap: 10px;
  align-items: center;
  font-size: 0.84rem;
  font-weight: 900;
  text-transform: capitalize;
}

.stat-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4eaf4;
}

.stat-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), var(--yellow));
}

.explore-band {
  margin-top: 18px;
  padding: 12px 0 2px;
}

.section-title {
  margin-bottom: 8px;
}

.section-title p {
  max-width: 300px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.type-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 16px;
}

.type-filter button {
  min-height: 38px;
  background: var(--ink);
}

.type-filter button.is-active {
  color: var(--ink);
  background: var(--yellow);
}

.pokemon-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.pokemon-card {
  min-height: 132px;
  padding: 14px;
  border: 1px solid rgba(21, 32, 51, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 26px rgba(21, 32, 51, 0.1);
  text-align: left;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.pokemon-card img {
  display: block;
  width: 82px;
  height: 82px;
  margin: 0 auto 4px;
  object-fit: contain;
}

.pokemon-card strong {
  display: block;
  color: var(--ink);
  text-transform: capitalize;
}

.pokemon-card span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.api-console {
  padding: 16px;
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(21, 32, 51, 0.1);
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 22px;
  padding: 18px;
  border-top: 1px solid rgba(21, 32, 51, 0.12);
  color: var(--muted);
  font-weight: 850;
}

.site-footer a {
  color: var(--blue);
  font-weight: 1000;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.matchup-panel {
  padding: 16px;
  border: 1px solid rgba(21, 32, 51, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 12px 32px rgba(21, 32, 51, 0.1);
}

.matchup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.matchup-card {
  min-height: 300px;
  padding: 14px;
  border: 1px solid rgba(216, 224, 236, 0.92);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(251, 253, 255, 0.88)),
    linear-gradient(135deg, rgba(47, 109, 181, 0.16), transparent 52%);
}

.matchup-card.rival {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(251, 253, 255, 0.88)),
    linear-gradient(135deg, rgba(227, 54, 63, 0.14), transparent 52%);
}

.matchup-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: start;
}

.matchup-label {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 1000;
  text-transform: uppercase;
}

.matchup-head strong {
  overflow: hidden;
  font-size: clamp(1.1rem, 2vw, 1.55rem);
  line-height: 1;
  text-overflow: ellipsis;
  text-transform: capitalize;
  white-space: nowrap;
}

.matchup-head small {
  color: var(--muted);
  font-weight: 900;
}

.matchup-types {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.matchup-types span {
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--white);
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: capitalize;
}

.matchup-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin: 12px 0;
}

.matchup-metrics div {
  min-height: 54px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(237, 241, 247, 0.78);
}

.matchup-metrics dt {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
}

.matchup-metrics dd {
  margin: 4px 0 0;
  font-weight: 1000;
}

.matchup-stats {
  display: grid;
  gap: 8px;
}

.matchup-stats div {
  display: grid;
  grid-template-columns: 92px 34px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: capitalize;
}

.matchup-stats i {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4eaf4;
}

.matchup-stats em {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--yellow));
}

.console-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.console-metrics span {
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--ink);
  background: rgba(237, 241, 247, 0.82);
  font-size: 0.85rem;
  font-weight: 800;
}

.call-log {
  display: grid;
  gap: 6px;
  max-height: 216px;
  margin-top: 14px;
  overflow: auto;
  padding-right: 6px;
}

.call-row {
  display: grid;
  grid-template-columns: 12px 48px minmax(0, 1fr) 76px 76px;
  gap: 8px;
  align-items: center;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid rgba(216, 224, 236, 0.72);
  border-radius: 8px;
  background: rgba(251, 253, 255, 0.72);
  font-size: 0.78rem;
}

.call-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d8e0ec;
  box-shadow: 0 0 0 4px rgba(216, 224, 236, 0.32);
}

.call-dot.ok {
  background: #40c47a;
  box-shadow: 0 0 0 4px rgba(64, 196, 122, 0.16);
}

.call-dot.cache {
  background: var(--blue);
  box-shadow: 0 0 0 4px rgba(47, 109, 181, 0.16);
}

.call-dot.fail {
  background: #e3363f;
  box-shadow: 0 0 0 4px rgba(227, 54, 63, 0.14);
}

.call-row code {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.method,
.result {
  padding: 4px 7px;
  border-radius: 999px;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 900;
}

.method {
  color: #2f5f9d;
  background: rgba(47, 109, 181, 0.12);
}

.result {
  color: #7a5800;
  background: #ffe9a3;
}

.result.ok {
  color: #0c5f38;
  background: #c9f3dc;
}

.result.cache {
  color: #2f5f9d;
  background: rgba(47, 109, 181, 0.14);
}

.result.fail {
  color: #8d1824;
  background: #ffd1d6;
}

.latency {
  color: var(--muted);
  font-weight: 900;
  text-align: right;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (max-width: 980px) {
  .control-deck,
  .dashboard-grid,
  .battle-controls {
    grid-template-columns: 1fr;
  }


  .pokemon-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .fighter-roster {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .stage-column {
    order: 1;
  }

  .stat-panel {
    order: 2;
  }

  .turn-log {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 20px, 1220px);
    padding-top: 10px;
  }

  .control-deck,
  .stat-panel,
  .api-console,
  .battle-console {
    padding: 14px;
  }

  .search-bar {
    grid-template-columns: 1fr 48px;
  }

  .rival-form {
    grid-template-columns: 1fr;
  }

  .search-bar > button:first-of-type {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .battle-stage {
    min-height: 430px;
  }

  .player-hud {
    left: 12px;
    bottom: 12px;
  }

  .rival-hud {
    right: 12px;
    bottom: 12px;
  }

  .rival-chip {
    top: 72px;
    left: 18px;
    right: auto;
  }

  .battle-random-btn {
    width: 38px;
    height: 38px;
    top: 18px;
    right: 18px;
  }

  .score-chip,
  .rival-chip {
    padding: 8px 10px;
    font-size: 0.9rem;
  }

  .arena-sky {
    min-height: 214px;
  }

  .pokemon-spotlight {
    width: 50%;
  }

  .player-spotlight {
    left: -4%;
    bottom: -80px;
    transform: scale(1.5);
  }

  .rival-spotlight {
    right: -12%;
    bottom: 120px;
    transform: scale(0.65);
  }

  .center-battle-btn {
    top: 24%;
    min-height: 38px;
    padding: 0 14px;
    font-size: 0.82rem;
  }

  .battle-hud {
    width: min(150px, 44%);
    padding: 6px 8px;
    font-size: 0.55rem;
    gap: 4px;
  }

  .player-spotlight .defeated-label {
    left: 70%;
  }

  .rival-spotlight .defeated-label {
    left: 30%;
  }

  .battle-summary {
    font-size: 0.8rem;
    padding: 10px;
    text-align: center;
  }

  .console-header {
    display: grid;
    grid-template-columns: 1fr;
  }

  .console-metrics {
    justify-content: flex-start;
  }

  .intro-content {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .metric-grid,
  .pokemon-grid,
  .profile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .matchup-grid {
    grid-template-columns: 1fr;
  }

  .matchup-card {
    min-height: 0;
  }

  .matchup-stats div {
    grid-template-columns: 82px 32px minmax(0, 1fr);
  }

  .versus-panel {
    grid-template-columns: 1fr;
  }

  .versus-card.rival {
    text-align: left;
  }

  .fighter-roster {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .call-row {
    grid-template-columns: 12px 44px minmax(0, 1fr);
  }

  .call-row .result,
  .latency {
    display: none;
  }
}


/* Toast System */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: grid;
  gap: 12px;
  pointer-events: none;
}

.toast {
  min-width: 280px;
  max-width: 400px;
  padding: 14px 18px;
  border-radius: 8px;
  color: var(--white);
  background: var(--ink);
  box-shadow: 0 12px 32px rgba(21, 32, 51, 0.24);
  font-weight: 800;
  font-size: 0.9rem;
  pointer-events: auto;
  animation: toast-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.error {
  background: var(--red);
}

.toast.success {
  background: var(--grass-dark);
}

.toast.out {
  animation: toast-out 0.2s ease forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(20px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateX(40px); }
}

/* Skeleton Loading */
.is-loading-skeleton {
  position: relative;
  overflow: hidden !important;
  color: transparent !important;
  background: #f0f3f8 !important;
  border-color: #e4eaf4 !important;
  pointer-events: none;
}

.is-loading-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.6),
    transparent
  );
  animation: skeleton-sweep 1.5s infinite;
}

.is-loading-skeleton * {
  visibility: hidden !important;
}

@keyframes skeleton-sweep {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

/* History Icon in Suggestions */
.suggestions button .history-icon {
  margin-right: 8px;
  color: var(--muted);
  opacity: 0.6;
}

/* Load More Button */
.load-more-container {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  margin-top: 24px;
}

.load-more-btn {
  min-height: 48px;
  padding: 0 24px;
  border-radius: 8px;
  color: var(--white);
  background: var(--ink);
  font-weight: 800;
  transition: transform 160ms ease, box-shadow 160ms ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.load-more-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.load-more-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.load-more-btn.is-hidden {
  display: none;
}

@media (max-width: 680px) {
  .toast-container {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }
  .toast {
    min-width: 0;
  }
}
