:root {
  --ink: #14212a;
  --ink-soft: #52616a;
  --paper: #fffdf5;
  --cream: #f4ecd9;
  --navy: #162733;
  --navy-light: #263e4b;
  --red: #d95142;
  --red-dark: #a93631;
  --gold: #efbd4d;
  --green: #4ba269;
  --line: rgba(20, 33, 42, 0.14);
  --shadow: 0 24px 60px rgba(20, 33, 42, 0.16);
  --pixel-shadow: 4px 4px 0 rgba(20, 33, 42, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  font-family: Inter, ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  background:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    var(--navy);
  background-size: 24px 24px;
}

button,
input,
select {
  font: inherit;
}

button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 4px solid var(--gold);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

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

.app-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 16px 0 30px;
}

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 70px;
  padding: 10px 12px 10px 14px;
  border: 2px solid rgba(255, 255, 255, 0.13);
  border-radius: 18px;
  color: #fff;
  background: rgba(10, 24, 33, 0.82);
  box-shadow: 0 14px 40px rgba(5, 14, 20, 0.25);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  font-weight: 950;
  letter-spacing: -0.025em;
}

.brand small {
  display: block;
  margin-top: 2px;
  color: #aebbc2;
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 3px solid #fff;
  border-radius: 50%;
  color: var(--navy);
  background:
    linear-gradient(transparent 43%, var(--navy) 43% 57%, transparent 57%),
    linear-gradient(#e5594e 0 50%, #f8f3df 50%);
  box-shadow: inset 0 0 0 3px var(--navy), var(--pixel-shadow);
  font-size: 0.56rem;
  font-weight: 1000;
}

.topbar-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-links a,
.sound-toggle,
.quiet-button {
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  color: #dce5e8;
  background: rgba(255, 255, 255, 0.08);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 850;
}

.topbar-links a {
  display: inline-flex;
  align-items: center;
}

.topbar-links a:hover,
.sound-toggle:hover,
.quiet-button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
}

main {
  min-height: 70vh;
}

.loading-screen,
.error-panel {
  display: grid;
  place-items: center;
  min-height: 72vh;
  color: #e9f0f2;
  text-align: center;
}

.loading-screen p {
  margin-top: 22px;
  font-weight: 800;
}

.loading-orb {
  position: relative;
  width: 66px;
  height: 66px;
  border: 5px solid #f8f3df;
  border-radius: 50%;
  background: linear-gradient(#d95142 0 46%, var(--navy) 46% 54%, #f8f3df 54%);
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.2);
  animation: orb-hop 1s steps(4) infinite;
}

.loading-orb::after {
  content: "";
  position: absolute;
  inset: 20px;
  border: 4px solid var(--navy);
  border-radius: 50%;
  background: #f8f3df;
}

.setup-screen {
  padding-top: 42px;
}

.setup-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(320px, 0.72fr);
  gap: clamp(35px, 8vw, 110px);
  align-items: end;
  padding: clamp(42px, 7vw, 90px) clamp(8px, 4vw, 48px) 50px;
  color: #fff;
}

.setup-hero > *,
.selector-grid > *,
.panel-heading > *,
.selected-card > *,
.filters > * {
  min-width: 0;
}

.eyebrow,
.step-label,
.console-label,
.result-kicker {
  display: block;
  margin: 0 0 13px;
  color: var(--gold);
  font-size: 0.68rem;
  font-weight: 950;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.setup-hero h1 {
  margin: 0;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: clamp(4.2rem, 9vw, 8.6rem);
  font-weight: 900;
  line-height: 0.78;
  letter-spacing: -0.055em;
  text-transform: uppercase;
  text-shadow: 7px 7px 0 rgba(0, 0, 0, 0.22);
}

.setup-hero h1 span {
  color: var(--gold);
  font-size: 0.71em;
}

.hero-copy {
  padding-bottom: 4px;
}

.hero-copy > p {
  margin: 0 0 25px;
  color: #c5d1d6;
  font-size: clamp(1rem, 1.5vw, 1.13rem);
  line-height: 1.7;
}

.difficulty-control {
  display: grid;
  gap: 8px;
}

.difficulty-control span,
.level-control label {
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

select,
input[type="search"] {
  min-height: 46px;
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  background: #fffdf7;
}

select {
  padding: 0 38px 0 12px;
}

input[type="search"] {
  padding: 0 14px;
}

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

.selector-panel {
  overflow: hidden;
  padding: clamp(20px, 3vw, 31px);
  border: 3px solid var(--ink);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 8px 8px 0 rgba(4, 14, 20, 0.34);
}

.player-panel {
  --panel-accent: #4c8fc0;
}

.opponent-panel {
  --panel-accent: var(--red);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 18px;
}

.panel-heading h2,
.dialog-heading h2 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: clamp(1.75rem, 3.2vw, 2.55rem);
  letter-spacing: -0.04em;
}

.panel-heading .step-label {
  color: var(--panel-accent);
  margin-bottom: 7px;
}

.random-button {
  min-height: 42px;
  padding: 0 15px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  color: var(--ink);
  background: var(--gold);
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
}

.random-button:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

.selected-card {
  display: grid;
  grid-template-columns: 145px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  min-height: 170px;
  padding: 18px;
  border: 2px solid var(--ink);
  border-radius: 17px;
  background:
    radial-gradient(circle at 85% 18%, color-mix(in srgb, var(--selected-color) 28%, transparent), transparent 42%),
    #edf1e9;
  box-shadow: inset 0 -7px 0 rgba(20, 33, 42, 0.06);
}

.selected-visual {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 130px;
  border-radius: 14px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px),
    var(--selected-color);
  background-size: 15px 15px;
}

.pokemon-art {
  display: block;
  max-width: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
  user-select: none;
}

.selected-art {
  position: relative;
  z-index: 2;
  width: 132px;
  height: 132px;
  object-fit: contain;
  filter: drop-shadow(5px 7px 0 rgba(20, 33, 42, 0.2));
}

.selected-visual .mini-monster {
  position: absolute;
  z-index: 1;
}

.mini-monster {
  position: relative;
  width: 84px;
  height: 78px;
  filter: drop-shadow(6px 8px 0 rgba(20, 33, 42, 0.2));
}

.mini-monster::before {
  content: "";
  position: absolute;
  inset: 8px 4px 0;
  border: 4px solid var(--ink);
  border-radius: 45% 52% 38% 42%;
  background: color-mix(in srgb, var(--selected-color) 68%, white);
  clip-path: var(--mini-shape, polygon(13% 17%, 33% 20%, 50% 2%, 67% 20%, 91% 16%, 82% 46%, 91% 82%, 62% 100%, 27% 96%, 5% 67%));
}

.mini-monster::after {
  content: "••";
  position: absolute;
  top: 35px;
  left: 29px;
  color: var(--ink);
  font-size: 1.1rem;
  letter-spacing: 10px;
}

.selected-details h3 {
  margin: 0 0 8px;
  font-size: clamp(1.45rem, 2.5vw, 2rem);
}

.selected-number {
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.09em;
}

.type-row,
.method-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 11px;
}

.type-badge,
.method-badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 9px;
  border-radius: 999px;
  color: #fff;
  background: var(--badge-color, var(--ink-soft));
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.method-badge {
  color: var(--ink);
  background: rgba(20, 33, 42, 0.09);
}

.level-control {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 45px;
  gap: 13px;
  align-items: center;
  margin: 18px 0;
}

.level-control input {
  accent-color: var(--panel-accent);
}

.level-control output {
  display: grid;
  place-items: center;
  height: 39px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  box-shadow: 2px 2px 0 var(--ink);
  font-weight: 950;
}

.filters {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr 0.9fr;
  gap: 8px;
  margin-bottom: 10px;
}

.roster {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  max-height: 315px;
  overflow: auto;
  padding: 5px 5px 5px 1px;
  scrollbar-color: var(--panel-accent) transparent;
}

.roster-button {
  display: grid;
  grid-template-columns: 42px 38px minmax(0, 1fr);
  align-items: center;
  min-height: 54px;
  padding: 5px 9px;
  border: 2px solid transparent;
  border-radius: 10px;
  color: var(--ink);
  background: #ece9df;
  text-align: left;
}

.roster-button:hover {
  border-color: rgba(20, 33, 42, 0.35);
  background: #fff;
}

.roster-button[aria-selected="true"] {
  border-color: var(--ink);
  background: color-mix(in srgb, var(--entry-color) 23%, white);
  box-shadow: 3px 3px 0 var(--ink);
}

.roster-visual {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 42px;
}

.roster-art {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 42px;
  height: 42px;
  object-fit: contain;
  filter: drop-shadow(2px 3px 0 rgba(20, 33, 42, 0.15));
}

.roster-dot {
  display: block;
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--entry-color);
}

.roster-number {
  color: var(--ink-soft);
  font-size: 0.65rem;
  font-weight: 900;
}

.roster-name {
  overflow: hidden;
  font-size: 0.78rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-roster {
  grid-column: 1 / -1;
  padding: 30px 15px;
  color: var(--ink-soft);
  text-align: center;
}

.start-dock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 25px;
  margin-top: 18px;
  padding: 18px 20px 18px 27px;
  border: 3px solid #09141b;
  border-radius: 20px;
  color: #fff;
  background: #0e1e27;
  box-shadow: 8px 8px 0 rgba(4, 12, 17, 0.4);
}

.matchup-summary {
  color: #b8c8ce;
  line-height: 1.55;
}

.matchup-summary strong {
  color: #fff;
}

.start-button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  min-width: 230px;
  min-height: 62px;
  padding: 0 22px;
  border: 3px solid #fff;
  border-radius: 13px;
  color: #fff;
  background: var(--red);
  box-shadow: 5px 5px 0 var(--red-dark);
  font-weight: 950;
  text-transform: uppercase;
}

.start-button:hover {
  background: #e65f50;
  transform: translateY(-2px);
}

.battle-screen {
  padding-top: 18px;
}

.battle-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 66px;
  padding: 0 8px 14px;
  color: #fff;
}

.battle-topline h1 {
  margin: 3px 0 0;
  font-size: 1.25rem;
}

.battle-round {
  color: var(--gold);
  font-size: 0.7rem;
  font-weight: 950;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.battle-arena {
  position: relative;
  min-height: clamp(430px, 57vw, 690px);
  overflow: hidden;
  border: 4px solid #09141b;
  border-radius: 25px 25px 0 0;
  background:
    radial-gradient(ellipse at 50% 105%, #4e8b55 0 27%, transparent 27.5%),
    linear-gradient(#7fc8df 0 59%, #83ad66 59% 72%, #5e8d4d 72%);
  box-shadow: 0 24px 70px rgba(3, 11, 15, 0.36);
  isolation: isolate;
}

.battle-arena::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.2;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.25) 2px, transparent 2px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.25) 2px, transparent 2px);
  background-size: 18px 18px;
}

.sky-decor {
  position: absolute;
  width: 18%;
  height: 8%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.46);
  filter: blur(1px);
}

.sky-decor::before,
.sky-decor::after {
  content: "";
  position: absolute;
  bottom: 0;
  border-radius: 50%;
  background: inherit;
}

.sky-decor::before {
  left: 16%;
  width: 38%;
  aspect-ratio: 1;
}

.sky-decor::after {
  right: 13%;
  width: 47%;
  aspect-ratio: 1;
}

.sky-decor-one {
  top: 13%;
  left: 10%;
}

.sky-decor-two {
  top: 26%;
  right: 13%;
  transform: scale(0.72);
}

.arena-platform {
  position: absolute;
  width: 33%;
  height: 9%;
  border: 4px solid rgba(31, 72, 41, 0.25);
  border-radius: 50%;
  background: rgba(205, 229, 151, 0.68);
  box-shadow: inset 0 8px 0 rgba(255, 255, 255, 0.22);
}

.opponent-platform {
  top: 44%;
  right: 8%;
}

.player-platform {
  bottom: 10%;
  left: 7%;
  width: 40%;
  height: 11%;
}

.combatant-card {
  position: absolute;
  z-index: 7;
  width: min(36%, 430px);
  padding: 17px 20px 14px;
  border: 4px solid var(--ink);
  border-radius: 14px 14px 14px 4px;
  background: var(--paper);
  box-shadow: 7px 7px 0 rgba(20, 33, 42, 0.27);
}

.combatant-card::after {
  content: "";
  position: absolute;
  right: -4px;
  bottom: -11px;
  width: 44%;
  height: 11px;
  border: 4px solid var(--ink);
  border-top: 0;
  border-radius: 0 0 10px 10px;
  background: var(--gold);
}

.opponent-card {
  top: 8%;
  left: 5%;
}

.player-card {
  right: 5%;
  bottom: 9%;
}

.combatant-title,
.combatant-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.combatant-title strong {
  overflow: hidden;
  font-size: clamp(1rem, 2vw, 1.45rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combatant-title > span {
  flex: none;
  font-size: 0.79rem;
  font-weight: 950;
}

.hp-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin: 11px 0 6px;
}

.hp-line > span {
  color: #b17b18;
  font-size: 0.68rem;
  font-weight: 1000;
}

.hp-track {
  height: 13px;
  overflow: hidden;
  padding: 2px;
  border-radius: 999px;
  background: var(--ink);
}

.hp-fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: #55bd70;
  transition: width 0.75s cubic-bezier(0.2, 0.8, 0.2, 1), background 0.3s ease;
}

.hp-fill.medium {
  background: #e9b642;
}

.hp-fill.low {
  background: #d95142;
}

.combatant-meta {
  min-height: 25px;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 850;
}

.status-badge {
  --badge-color: #6e588b;
  padding-inline: 8px;
  min-height: 22px;
}

.monster-stage {
  --monster-color: #72a866;
  position: absolute;
  z-index: 5;
  width: clamp(130px, 20vw, 275px);
  aspect-ratio: 1;
  transform-origin: center bottom;
}

.monster-art {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(8px 11px 0 rgba(20, 33, 42, 0.2));
  transform-origin: center bottom;
}

.monster-stage.has-art .monster-body {
  display: none;
}

.monster-stage.has-art .monster-aura {
  inset: 4%;
}

.opponent-stage {
  top: 19%;
  right: 13%;
}

.player-stage {
  bottom: 7%;
  left: 13%;
  width: clamp(165px, 26vw, 350px);
}

.monster-aura {
  position: absolute;
  inset: 6%;
  border: 5px dashed color-mix(in srgb, var(--monster-color) 58%, white);
  border-radius: 50%;
  opacity: 0.64;
  filter: blur(2px);
  animation: aura-turn 12s linear infinite;
}

.monster-body {
  position: absolute;
  inset: 15% 12% 9%;
  border: clamp(4px, 0.55vw, 8px) solid var(--ink);
  border-radius: 50% 48% 38% 42%;
  background:
    radial-gradient(circle at 37% 30%, rgba(255, 255, 255, 0.52), transparent 12%),
    var(--monster-color);
  box-shadow:
    inset -20px -25px 0 color-mix(in srgb, var(--monster-color) 75%, black),
    12px 15px 0 rgba(20, 33, 42, 0.2);
  clip-path: polygon(8% 25%, 26% 21%, 36% 3%, 52% 18%, 73% 7%, 83% 29%, 96% 42%, 87% 69%, 91% 89%, 64% 96%, 49% 88%, 25% 100%, 19% 79%, 3% 67%);
}

.shape-1 .monster-body {
  border-radius: 36% 61% 42% 55%;
  clip-path: polygon(2% 38%, 18% 22%, 22% 0, 45% 18%, 65% 4%, 76% 27%, 100% 35%, 88% 59%, 96% 84%, 67% 91%, 50% 100%, 31% 88%, 8% 92%, 13% 65%);
}

.shape-2 .monster-body {
  clip-path: polygon(12% 12%, 35% 22%, 48% 1%, 61% 24%, 88% 12%, 82% 40%, 98% 59%, 79% 72%, 84% 100%, 53% 87%, 25% 99%, 22% 77%, 2% 59%, 18% 39%);
}

.shape-3 .monster-body {
  border-radius: 65% 38% 54% 39%;
  clip-path: polygon(4% 29%, 24% 22%, 34% 4%, 54% 18%, 79% 2%, 78% 30%, 98% 45%, 84% 66%, 95% 87%, 63% 89%, 45% 100%, 28% 84%, 7% 91%, 14% 61%);
}

.monster-eye {
  position: absolute;
  z-index: 3;
  top: 40%;
  width: 9%;
  aspect-ratio: 0.78;
  border: max(2px, 0.25vw) solid var(--ink);
  border-radius: 50%;
  background: #fff;
}

.monster-eye::after {
  content: "";
  position: absolute;
  right: 5%;
  bottom: 5%;
  width: 55%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--ink);
}

.eye-left {
  left: 31%;
  transform: rotate(9deg);
}

.eye-right {
  right: 27%;
  transform: rotate(-9deg);
}

.monster-mouth {
  position: absolute;
  z-index: 3;
  top: 57%;
  left: 45%;
  width: 17%;
  height: 8%;
  border: max(2px, 0.25vw) solid var(--ink);
  border-top: 0;
  border-radius: 0 0 999px 999px;
}

.monster-mark {
  position: absolute;
  z-index: 2;
  width: 13%;
  aspect-ratio: 1;
  border: max(2px, 0.22vw) solid var(--ink);
  border-radius: 35%;
  background: color-mix(in srgb, var(--monster-color) 55%, white);
  transform: rotate(45deg);
}

.mark-one {
  top: 23%;
  right: 15%;
}

.mark-two {
  left: 18%;
  bottom: 16%;
  transform: rotate(18deg) scale(0.72);
}

.is-back .monster-body {
  transform: scaleX(-1);
}

.is-back .monster-art {
  transform: none;
}

.is-back .monster-eye,
.is-back .monster-mouth {
  display: none;
}

.monster-stage.attack-forward {
  animation: attack-forward 0.42s steps(5);
}

.monster-stage.hit-shake {
  animation: hit-shake 0.45s steps(5);
}

.monster-stage.fainted {
  filter: grayscale(0.8);
  transform: translateY(42%) scaleY(0.32);
  opacity: 0.55;
  transition: 0.55s ease;
}

.battle-arena.hit-flash::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.48);
  animation: flash-out 0.25s ease-out forwards;
}

.battle-arena.critical-hit {
  animation: arena-shake 0.38s steps(5);
}

.battle-arena.arena-special-fx {
  box-shadow:
    0 24px 70px rgba(3, 11, 15, 0.36),
    inset 0 0 42px color-mix(in srgb, var(--fx-color, #fff) 18%, transparent);
}

.battle-arena.arena-status-fx {
  box-shadow:
    0 24px 70px rgba(3, 11, 15, 0.36),
    inset 0 0 36px rgba(255, 255, 255, 0.28);
}

.attack-fx {
  position: absolute;
  z-index: 6;
  left: var(--fx-start-x, 50%);
  top: var(--fx-start-y, 50%);
  width: clamp(28px, 5vw, 74px);
  height: clamp(28px, 5vw, 74px);
  color: var(--fx-color, #fff);
  pointer-events: none;
  transform: translate(-50%, -50%);
  will-change: left, top, opacity, transform;
}

.attack-fx i {
  position: absolute;
  display: block;
  border-radius: 999px;
  background: currentColor;
}

.fx-projectile {
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 32%, #fff 0 12%, currentColor 13% 45%, color-mix(in srgb, currentColor 56%, #111) 74%);
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.32),
    0 0 24px currentColor,
    calc(var(--fx-sign, 1) * -18px) 14px 0 color-mix(in srgb, currentColor 32%, transparent);
  animation: fx-projectile-flight 0.58s cubic-bezier(0.12, 0.78, 0.28, 1) forwards;
}

.fx-projectile i {
  width: 22%;
  height: 22%;
  opacity: 0.85;
  animation: fx-particle-drift 0.56s ease-out forwards;
}

.fx-projectile i:nth-child(1) { left: -18%; top: 23%; animation-delay: 0.03s; }
.fx-projectile i:nth-child(2) { left: 11%; top: 78%; animation-delay: 0.08s; }
.fx-projectile i:nth-child(3) { right: -8%; top: 18%; animation-delay: 0.12s; }
.fx-projectile i:nth-child(4) { right: 18%; bottom: -15%; animation-delay: 0.16s; }
.fx-projectile i:nth-child(5) { left: 37%; top: -15%; animation-delay: 0.2s; }

.fx-fire {
  border-radius: 70% 38% 62% 42%;
  background:
    radial-gradient(circle at 39% 34%, #fff8b0 0 11%, #ffdb55 12% 28%, transparent 29%),
    linear-gradient(135deg, #ffed67, currentColor 45%, #d9482f);
  clip-path: polygon(45% 0, 62% 28%, 83% 12%, 75% 46%, 100% 62%, 67% 70%, 72% 100%, 48% 80%, 24% 100%, 31% 70%, 0 62%, 24% 44%, 17% 14%, 38% 29%);
}

.fx-water {
  border-radius: 66% 58% 62% 48%;
  background:
    radial-gradient(circle at 34% 32%, rgba(255,255,255,0.9) 0 12%, transparent 13%),
    linear-gradient(135deg, #b9f7ff, currentColor);
  filter: saturate(1.18);
}

.fx-electric {
  width: clamp(34px, 6vw, 86px);
  height: clamp(42px, 7vw, 100px);
  border-radius: 0;
  background: linear-gradient(#fff5a6, currentColor);
  clip-path: polygon(51% 0, 79% 0, 58% 34%, 87% 34%, 33% 100%, 45% 55%, 16% 55%);
  box-shadow: 0 0 26px currentColor;
}

.fx-grass {
  border-radius: 0 90% 0 90%;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.45), transparent 36%),
    currentColor;
  box-shadow:
    0 0 20px currentColor,
    calc(var(--fx-sign, 1) * -18px) 18px 0 color-mix(in srgb, currentColor 64%, white),
    calc(var(--fx-sign, 1) * -33px) -10px 0 color-mix(in srgb, currentColor 75%, #243);
  transform: translate(-50%, -50%) rotate(calc(var(--fx-sign, 1) * 38deg));
}

.fx-ice {
  border-radius: 20%;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.86), transparent 30%),
    currentColor;
  clip-path: polygon(50% 0, 100% 28%, 87% 86%, 28% 100%, 0 47%);
  box-shadow:
    0 0 18px #e7ffff,
    inset 0 0 12px rgba(255,255,255,0.65);
}

.fx-poison,
.fx-ghost,
.fx-dark,
.fx-dragon {
  background:
    radial-gradient(circle at 32% 32%, rgba(255,255,255,0.72), transparent 15%),
    radial-gradient(circle at 58% 60%, currentColor 0 47%, transparent 49%);
  filter: blur(0.2px);
}

.fx-poison {
  border-radius: 50% 45% 52% 45%;
  box-shadow:
    0 0 24px currentColor,
    -16px 16px 0 color-mix(in srgb, currentColor 42%, transparent),
    18px -11px 0 color-mix(in srgb, currentColor 36%, transparent);
}

.fx-ghost {
  border-radius: 48% 48% 35% 35%;
  clip-path: polygon(0 13%, 100% 13%, 91% 100%, 70% 80%, 52% 100%, 34% 80%, 14% 100%);
  opacity: 0.82;
}

.fx-dark {
  border-radius: 50%;
  background:
    radial-gradient(circle at 37% 34%, rgba(255,255,255,0.28), transparent 11%),
    radial-gradient(circle, #1d1516 0 38%, currentColor 39% 68%, transparent 70%);
}

.fx-dragon {
  border-radius: 38% 62% 39% 60%;
  clip-path: polygon(6% 32%, 38% 12%, 48% 0, 59% 14%, 94% 33%, 71% 48%, 90% 85%, 53% 68%, 35% 100%, 31% 61%);
}

.fx-ground,
.fx-rock,
.fx-steel {
  border-radius: 22%;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.33), transparent 34%),
    currentColor;
  box-shadow:
    0 0 18px color-mix(in srgb, currentColor 55%, transparent),
    calc(var(--fx-sign, 1) * -15px) 16px 0 color-mix(in srgb, currentColor 70%, #342),
    calc(var(--fx-sign, 1) * -29px) -4px 0 color-mix(in srgb, currentColor 48%, #fff);
}

.fx-ground {
  clip-path: polygon(18% 16%, 76% 0, 100% 48%, 70% 100%, 14% 82%, 0 43%);
}

.fx-rock {
  clip-path: polygon(14% 8%, 70% 0, 100% 35%, 91% 78%, 45% 100%, 0 69%);
}

.fx-steel {
  clip-path: polygon(50% 0, 93% 24%, 93% 74%, 50% 100%, 7% 74%, 7% 24%);
  filter: brightness(1.16);
}

.fx-flying,
.fx-bug {
  background: none;
  box-shadow: none;
}

.fx-flying::before,
.fx-flying::after,
.fx-bug::before,
.fx-bug::after {
  content: "";
  position: absolute;
  inset: 16% 8%;
  border: 5px solid currentColor;
  border-left-color: transparent;
  border-bottom-color: transparent;
  border-radius: 50%;
  transform: rotate(calc(var(--fx-sign, 1) * 24deg));
}

.fx-flying::after,
.fx-bug::after {
  inset: 35% 20% 6%;
  opacity: 0.5;
  transform: rotate(calc(var(--fx-sign, 1) * -18deg));
}

.fx-bug i {
  width: 16%;
  height: 16%;
  box-shadow: 0 0 10px currentColor;
}

.fx-slash {
  left: var(--fx-end-x, 50%);
  top: var(--fx-end-y, 50%);
  width: clamp(86px, 13vw, 170px);
  height: clamp(66px, 10vw, 130px);
  animation: fx-impact-pop 0.5s ease-out forwards;
}

.fx-slash i {
  left: 7%;
  width: 88%;
  height: 16%;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, #fff 21%, currentColor 58%, transparent);
  box-shadow: 0 0 18px currentColor;
  transform: rotate(calc(var(--fx-sign, 1) * -31deg));
  animation: fx-slash-cut 0.42s ease-out forwards;
}

.fx-slash i:nth-child(1) { top: 18%; animation-delay: 0s; }
.fx-slash i:nth-child(2) { top: 42%; animation-delay: 0.05s; transform: rotate(calc(var(--fx-sign, 1) * -15deg)); }
.fx-slash i:nth-child(3) { top: 65%; animation-delay: 0.1s; transform: rotate(calc(var(--fx-sign, 1) * -42deg)); }

.fx-strike {
  left: var(--fx-end-x, 50%);
  top: var(--fx-end-y, 50%);
  width: clamp(92px, 14vw, 190px);
  height: clamp(92px, 14vw, 190px);
  border: 6px solid currentColor;
  border-radius: 50%;
  box-shadow:
    0 0 24px currentColor,
    inset 0 0 28px color-mix(in srgb, currentColor 26%, transparent);
  animation: fx-strike-ring 0.46s ease-out forwards;
}

.fx-strike i {
  left: 50%;
  top: 50%;
  width: 11%;
  height: 43%;
  border-radius: 999px;
  background: currentColor;
  transform-origin: 50% 0;
  box-shadow: 0 0 12px currentColor;
}

.fx-strike i:nth-child(1) { transform: rotate(0deg) translateY(-105%); }
.fx-strike i:nth-child(2) { transform: rotate(90deg) translateY(-105%); }
.fx-strike i:nth-child(3) { transform: rotate(180deg) translateY(-105%); }
.fx-strike i:nth-child(4) { transform: rotate(270deg) translateY(-105%); }

.fx-ring {
  left: var(--fx-end-x, 50%);
  top: var(--fx-end-y, 50%);
  width: clamp(112px, 16vw, 220px);
  height: clamp(112px, 16vw, 220px);
}

.fx-ring i {
  inset: 50%;
  width: 30%;
  height: 30%;
  border: 5px solid currentColor;
  border-radius: 50%;
  background: transparent;
  box-shadow: 0 0 20px currentColor;
  transform: translate(-50%, -50%);
  animation: fx-ring-pulse 0.76s ease-out forwards;
}

.fx-ring i:nth-child(2) { animation-delay: 0.12s; }
.fx-ring i:nth-child(3) { animation-delay: 0.24s; }

.fx-psychic i {
  border-color: color-mix(in srgb, currentColor 68%, #fff);
}

.fx-beam {
  left: 50%;
  top: 50%;
  width: 54%;
  height: clamp(10px, 1.3vw, 18px);
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, #fff, currentColor, transparent);
  box-shadow: 0 0 22px currentColor;
  transform:
    translate(-50%, -50%)
    rotate(calc(var(--fx-sign, 1) * -31deg))
    scaleX(0);
  animation: fx-beam-fire 0.42s ease-out forwards;
}

.battle-console {
  display: grid;
  grid-template-columns: minmax(270px, 0.72fr) minmax(0, 1.28fr);
  min-height: 250px;
  overflow: hidden;
  border: 4px solid #09141b;
  border-top: 0;
  border-radius: 0 0 25px 25px;
  background: var(--paper);
}

.battle-log-wrap {
  padding: 22px;
  color: #fff;
  background: #142832;
}

.battle-log {
  display: flex;
  flex-direction: column;
  gap: 7px;
  height: 160px;
  overflow-y: auto;
  padding-right: 8px;
  color: #c8d6db;
  font-size: 0.82rem;
  line-height: 1.45;
}

.log-line {
  padding-left: 12px;
  border-left: 3px solid rgba(255, 255, 255, 0.18);
}

.log-line.latest {
  color: #fff;
  border-left-color: var(--gold);
}

.command-panel {
  padding: 22px;
  background:
    linear-gradient(rgba(20, 33, 42, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 33, 42, 0.04) 1px, transparent 1px),
    var(--paper);
  background-size: 18px 18px;
}

.command-prompt {
  margin-bottom: 15px;
  font-family: Georgia, serif;
  font-size: clamp(1rem, 2vw, 1.35rem);
}

.main-commands,
.move-menu {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.command-button,
.move-button {
  min-height: 74px;
  padding: 12px 15px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
  box-shadow: 4px 4px 0 var(--ink);
  text-align: left;
}

.command-button:hover,
.move-button:hover:not(:disabled) {
  transform: translate(-1px, -1px);
  box-shadow: 6px 6px 0 var(--ink);
}

.command-button span,
.move-name {
  display: block;
  font-weight: 1000;
  text-transform: uppercase;
}

.command-button small {
  color: var(--ink-soft);
}

.fight-button {
  color: #fff;
  background: var(--red);
}

.fight-button small {
  color: #ffe1dd;
}

.move-button {
  position: relative;
  overflow: hidden;
  padding-left: 19px;
}

.move-button::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 8px;
  background: var(--move-color);
}

.move-button:disabled {
  cursor: not-allowed;
  filter: grayscale(1);
  opacity: 0.55;
}

.move-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 0.69rem;
  font-weight: 850;
}

.move-back {
  grid-column: 1 / -1;
  min-height: 42px;
  border: 0;
  border-radius: 9px;
  color: var(--ink-soft);
  background: rgba(20, 33, 42, 0.08);
  font-weight: 900;
}

.info-dialog {
  width: min(760px, calc(100% - 26px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 25px;
  border: 4px solid var(--ink);
  border-radius: 20px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.32);
}

.info-dialog::backdrop {
  background: rgba(5, 15, 20, 0.74);
  backdrop-filter: blur(5px);
}

.dialog-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.dialog-heading .step-label {
  color: var(--red);
}

.dialog-close {
  width: 44px;
  height: 44px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  color: var(--ink);
  background: #fff;
  font-size: 1.5rem;
  line-height: 1;
}

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

.info-fighter {
  padding: 18px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: #f1eee5;
}

.info-fighter h3 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.stat-list {
  display: grid;
  gap: 6px;
  margin: 16px 0 0;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 5px;
  border-bottom: 1px dashed var(--line);
  font-size: 0.82rem;
}

.result-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 15, 20, 0.76);
  backdrop-filter: blur(7px);
}

.result-card {
  width: min(510px, 100%);
  padding: clamp(30px, 6vw, 55px);
  border: 5px solid var(--ink);
  border-radius: 24px;
  background:
    radial-gradient(circle at 90% 10%, rgba(239, 189, 77, 0.32), transparent 30%),
    var(--paper);
  box-shadow: 12px 12px 0 rgba(0, 0, 0, 0.38);
  text-align: center;
  animation: result-in 0.45s steps(5);
}

.result-kicker {
  color: var(--red);
}

.result-card h2 {
  margin: 0;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: clamp(3.5rem, 10vw, 6rem);
  letter-spacing: -0.04em;
  text-transform: uppercase;
}

.result-card p {
  color: var(--ink-soft);
  line-height: 1.6;
}

.result-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 25px;
}

.result-actions button {
  min-height: 52px;
  border: 3px solid var(--ink);
  border-radius: 10px;
  color: #fff;
  background: var(--red);
  box-shadow: 4px 4px 0 var(--ink);
  font-weight: 950;
}

.result-actions button:last-child {
  color: var(--ink);
  background: var(--gold);
}

.disclaimer {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  padding: 25px 5px 0;
  color: #9fb0b7;
  font-size: 0.72rem;
  line-height: 1.5;
}

.disclaimer a {
  flex: none;
  color: var(--gold);
}

.error-panel {
  max-width: 700px;
  margin: 0 auto;
}

.error-panel div {
  padding: 35px;
}

.error-panel a {
  color: var(--gold);
}

@keyframes orb-hop {
  50% { transform: translateY(-12px) rotate(18deg); }
}

@keyframes aura-turn {
  to { transform: rotate(360deg); }
}

@keyframes attack-forward {
  50% { transform: translateX(var(--attack-direction, -18%)) scale(1.07); }
}

@keyframes hit-shake {
  20% { transform: translateX(-8%); filter: brightness(1.8); }
  40% { transform: translateX(8%); }
  60% { transform: translateX(-5%); filter: brightness(1.4); }
  80% { transform: translateX(4%); }
}

@keyframes flash-out {
  to { opacity: 0; }
}

@keyframes arena-shake {
  25% { transform: translateX(-5px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
}

@keyframes fx-projectile-flight {
  0% {
    left: var(--fx-start-x);
    top: var(--fx-start-y);
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.35) rotate(0deg);
  }
  18% {
    opacity: 1;
  }
  82% {
    opacity: 1;
  }
  100% {
    left: var(--fx-end-x);
    top: var(--fx-end-y);
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.08) rotate(calc(var(--fx-sign, 1) * 95deg));
  }
}

@keyframes fx-particle-drift {
  to {
    opacity: 0;
    transform:
      translate(
        calc(var(--fx-sign, 1) * -34px),
        24px
      )
      scale(0.2);
  }
}

@keyframes fx-slash-cut {
  0% {
    opacity: 0;
    transform:
      translate(calc(var(--fx-sign, 1) * -34px), 14px)
      rotate(calc(var(--fx-sign, 1) * -31deg))
      scaleX(0.35);
  }
  40% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform:
      translate(calc(var(--fx-sign, 1) * 28px), -11px)
      rotate(calc(var(--fx-sign, 1) * -31deg))
      scaleX(1);
  }
}

@keyframes fx-impact-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
  32% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.12); }
}

@keyframes fx-strike-ring {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.18);
  }
  35% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.72);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.18);
  }
}

@keyframes fx-ring-pulse {
  0% {
    opacity: 0.85;
    transform: translate(-50%, -50%) scale(0.2);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(2.4);
  }
}

@keyframes fx-beam-fire {
  0% {
    opacity: 0;
    transform:
      translate(-50%, -50%)
      rotate(calc(var(--fx-sign, 1) * -31deg))
      scaleX(0);
  }
  35% {
    opacity: 1;
    transform:
      translate(-50%, -50%)
      rotate(calc(var(--fx-sign, 1) * -31deg))
      scaleX(1);
  }
  100% {
    opacity: 0;
    transform:
      translate(-50%, -50%)
      rotate(calc(var(--fx-sign, 1) * -31deg))
      scaleX(0.3);
  }
}

@keyframes result-in {
  from { transform: translateY(25px) scale(0.9); opacity: 0; }
}

@media (max-width: 1050px) {
  .setup-hero {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .hero-copy {
    max-width: 680px;
  }

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

  .combatant-card {
    width: 43%;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(calc(100% - 16px), 680px);
    max-width: 100%;
    padding-top: 8px;
  }

  .brand > span:last-child,
  .topbar-links a {
    display: none;
  }

  .setup-screen {
    padding-top: 16px;
  }

  .setup-hero {
    padding: 44px 10px 34px;
  }

  .setup-hero h1 {
    font-size: clamp(3.4rem, 18vw, 6.4rem);
  }

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

  .search-field {
    grid-column: 1 / -1;
  }

  .start-dock,
  .disclaimer {
    align-items: stretch;
    flex-direction: column;
  }

  .start-button {
    width: 100%;
  }

  .battle-arena {
    min-height: 540px;
  }

  .combatant-card {
    width: 64%;
    padding: 12px 14px 11px;
  }

  .opponent-card {
    top: 5%;
    left: 4%;
  }

  .player-card {
    right: 4%;
    bottom: 5%;
  }

  .opponent-stage {
    top: 25%;
    right: 5%;
  }

  .player-stage {
    bottom: 12%;
    left: 3%;
  }

  .opponent-platform {
    top: 49%;
    right: 1%;
    width: 47%;
  }

  .player-platform {
    bottom: 14%;
    left: 1%;
    width: 54%;
  }

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

  .battle-log {
    height: 105px;
  }

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

@media (max-width: 520px) {
  .selector-panel {
    padding: 17px;
    border-radius: 18px;
  }

  .panel-heading {
    align-items: center;
  }

  .selected-card {
    grid-template-columns: 105px minmax(0, 1fr);
    min-height: 145px;
    padding: 12px;
  }

  .selected-visual {
    min-height: 108px;
  }

  .mini-monster {
    transform: scale(0.78);
  }

  .selected-art {
    width: 105px;
    height: 105px;
  }

  .roster {
    grid-template-columns: 1fr;
    max-height: 285px;
  }

  .matchup-summary {
    font-size: 0.82rem;
  }

  .battle-topline .quiet-button {
    display: none;
  }

  .combatant-card {
    width: 75%;
  }

  .main-commands,
  .move-menu {
    grid-template-columns: 1fr 1fr;
  }

  .command-panel,
  .battle-log-wrap {
    padding: 16px;
  }

  .command-button,
  .move-button {
    min-height: 68px;
    padding: 10px 11px;
  }

  .move-name {
    font-size: 0.76rem;
  }

  .move-meta {
    gap: 5px;
    font-size: 0.61rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
