/* ============================================================
   Pokémon Battle Arena — Styles
   ============================================================ */

:root {
  --bg-0: #0a0e27;
  --bg-1: #141a3d;
  --bg-2: #1d2554;

  --text: #f3f4f6;
  --text-dim: #aab1d4;
  --text-muted: #6b7299;

  --card: rgba(255, 255, 255, 0.06);
  --card-hover: rgba(255, 255, 255, 0.10);
  --card-border: rgba(255, 255, 255, 0.10);
  --card-border-strong: rgba(255, 255, 255, 0.22);

  --pk-yellow: #ffcb05;
  --pk-blue: #3d7dca;
  --pk-red: #ee1515;
  --pk-dark: #003a70;

  --hp-green: #2ecc71;
  --hp-yellow: #f1c40f;
  --hp-red: #e74c3c;

  --p1-color: #5b8cff;
  --p2-color: #ff6b8a;

  --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.55);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-glow-yellow: 0 0 40px rgba(255, 203, 5, 0.4);

  --transition: 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Type colors */
.type-normal   { --type-color: #a8a878; }
.type-fire     { --type-color: #f08030; }
.type-water    { --type-color: #6890f0; }
.type-grass    { --type-color: #78c850; }
.type-electric { --type-color: #f8d030; }
.type-ice      { --type-color: #98d8d8; }
.type-fighting { --type-color: #c03028; }
.type-poison   { --type-color: #a040a0; }
.type-ground   { --type-color: #e0c068; }
.type-flying   { --type-color: #a890f0; }
.type-psychic  { --type-color: #f85888; }
.type-bug      { --type-color: #a8b820; }
.type-rock     { --type-color: #b8a038; }
.type-ghost    { --type-color: #705898; }
.type-dragon   { --type-color: #7038f8; }
.type-dark     { --type-color: #705848; }
.type-steel    { --type-color: #b8b8d0; }
.type-fairy    { --type-color: #ee99ac; }

/* ============================================================
   Reset & Base
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Sukhumvit Set', 'Noto Sans Thai', 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(ellipse at top left, var(--bg-2) 0%, transparent 50%),
    radial-gradient(ellipse at bottom right, #2a1d54 0%, transparent 50%),
    linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

button, input {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; }

img { max-width: 100%; display: block; }

/* ============================================================
   Background decoration
   ============================================================ */

.bg-decoration {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
  animation: float 18s ease-in-out infinite;
}

.orb-1 {
  width: 460px; height: 460px;
  top: -150px; left: -150px;
  background: radial-gradient(circle, var(--pk-blue), transparent 70%);
}
.orb-2 {
  width: 380px; height: 380px;
  bottom: -120px; right: -80px;
  background: radial-gradient(circle, var(--pk-red), transparent 70%);
  animation-delay: -6s;
}
.orb-3 {
  width: 320px; height: 320px;
  top: 40%; left: 50%;
  background: radial-gradient(circle, var(--pk-yellow), transparent 70%);
  animation-delay: -12s;
  opacity: 0.25;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(60px, -40px) scale(1.05); }
  66%      { transform: translate(-50px, 30px) scale(0.95); }
}

/* ============================================================
   Layout
   ============================================================ */

#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.screen {
  display: none;
  width: 100%;
  max-width: 980px;
  animation: fadeIn 360ms ease;
}
.screen.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Title screen
   ============================================================ */

.title-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 48px 40px;
  text-align: center;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg);
}

.pokeball-logo {
  width: 80px; height: 80px;
  margin: 0 auto 24px;
  position: relative;
  animation: spin-slow 8s linear infinite;
}
.pokeball-top, .pokeball-bottom {
  position: absolute;
  width: 100%; height: 50%;
  left: 0;
  border: 4px solid #1a1a1a;
}
.pokeball-top {
  top: 0;
  background: var(--pk-red);
  border-radius: 80px 80px 0 0;
  border-bottom: 0;
}
.pokeball-bottom {
  bottom: 0;
  background: #f5f5f5;
  border-radius: 0 0 80px 80px;
  border-top: 0;
}
.pokeball-band {
  position: absolute;
  width: 100%; height: 8px;
  top: 50%; left: 0;
  background: #1a1a1a;
  transform: translateY(-50%);
}
.pokeball-button {
  position: absolute;
  width: 24px; height: 24px;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border: 4px solid #1a1a1a;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px white, 0 0 0 0 rgba(255,255,255,0);
}

@keyframes spin-slow {
  to { transform: rotate(360deg); }
}

.game-title {
  font-size: clamp(40px, 7vw, 64px);
  font-weight: 900;
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, var(--pk-yellow) 0%, #ff9b30 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 4px 20px rgba(255, 203, 5, 0.25);
  line-height: 1;
}
.game-subtitle {
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 700;
  letter-spacing: 0.4em;
  color: var(--text);
  margin-top: 6px;
}
.tagline {
  margin-top: 16px;
  color: var(--text-dim);
  font-size: 15px;
}

.player-inputs {
  margin-top: 36px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: end;
}

.input-group {
  text-align: left;
}
.input-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.label-badge {
  display: inline-grid;
  place-items: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  font-weight: 800;
  font-size: 11px;
  color: white;
  letter-spacing: 0.05em;
}
.label-badge.p1 { background: var(--p1-color); }
.label-badge.p2 { background: var(--p2-color); }

.input-group input {
  width: 100%;
  padding: 14px 18px;
  border: 1px solid var(--card-border-strong);
  border-radius: 14px;
  background: rgba(0,0,0,0.25);
  color: var(--text);
  font-size: 15px;
  transition: var(--transition);
  outline: none;
}
.input-group input::placeholder { color: var(--text-muted); }
.input-group input:focus {
  border-color: var(--pk-yellow);
  background: rgba(0,0,0,0.4);
  box-shadow: 0 0 0 4px rgba(255, 203, 5, 0.12);
}

.vs-divider {
  font-size: 22px;
  font-weight: 900;
  color: var(--pk-yellow);
  padding-bottom: 14px;
  letter-spacing: 0.05em;
}

.hint {
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* ============================================================
   Buttons
   ============================================================ */

.btn-primary {
  margin-top: 28px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 36px;
  background: linear-gradient(180deg, var(--pk-yellow) 0%, #f5a623 100%);
  color: #1a1a1a;
  border: none;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow:
    0 8px 24px rgba(255, 203, 5, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: var(--transition);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow:
    0 14px 36px rgba(255, 203, 5, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}
.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.3);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--card-border-strong);
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
}
.btn-ghost:hover {
  background: var(--card-hover);
  border-color: var(--text-dim);
}

/* ============================================================
   Select screen
   ============================================================ */

.select-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  padding: 0 8px;
}
.select-header h2 {
  font-size: clamp(20px, 3vw, 26px);
  font-weight: 800;
  letter-spacing: 0.02em;
}
.select-sub {
  color: var(--text-dim);
  margin-top: 4px;
  font-size: 14px;
}

.pokemon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.poke-card {
  position: relative;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  border: 2px solid var(--card-border);
  border-radius: 20px;
  padding: 20px 16px 16px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  overflow: hidden;
  backdrop-filter: blur(10px);
}
.poke-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top, var(--type-color, var(--pk-blue)) 0%, transparent 70%);
  opacity: 0.18;
  pointer-events: none;
  transition: var(--transition);
}
.poke-card:hover {
  transform: translateY(-4px);
  border-color: var(--type-color, var(--pk-yellow));
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}
.poke-card:hover::before { opacity: 0.32; }

.poke-card.selected {
  border-color: var(--pk-yellow);
  background: linear-gradient(180deg, rgba(255, 203, 5, 0.18), rgba(255, 203, 5, 0.04));
  box-shadow:
    0 0 0 3px rgba(255, 203, 5, 0.35),
    0 20px 40px rgba(0, 0, 0, 0.4);
}
.poke-card.selected::before { opacity: 0.5; }

.poke-card .card-id {
  position: absolute;
  top: 10px; right: 14px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 700;
}
.poke-card .card-img-wrap {
  width: 110px; height: 110px;
  margin: 0 auto 8px;
  display: grid;
  place-items: center;
  position: relative;
  z-index: 1;
}
.poke-card img {
  max-width: 100%; max-height: 100%;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.4));
  transition: transform var(--transition);
}
.poke-card:hover img {
  transform: scale(1.08) translateY(-4px);
}
.poke-card .card-name {
  font-size: 15px;
  font-weight: 700;
  text-transform: capitalize;
  letter-spacing: 0.02em;
  position: relative;
  z-index: 1;
}
.poke-card .card-types {
  margin-top: 8px;
  display: flex;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.type-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--type-color);
  color: white;
  text-shadow: 0 1px 0 rgba(0,0,0,0.25);
}

.poke-card .card-stats {
  margin-top: 12px;
  display: flex;
  justify-content: space-around;
  font-size: 11px;
  color: var(--text-dim);
  position: relative;
  z-index: 1;
}
.poke-card .card-stats span {
  display: flex; flex-direction: column; align-items: center;
}
.poke-card .card-stats b {
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.select-footer {
  display: flex;
  justify-content: center;
  margin-top: 28px;
}

/* ============================================================
   Battle screen
   ============================================================ */

#screen-battle {
  max-width: 1100px;
}

.battle-arena {
  position: relative;
  background:
    radial-gradient(ellipse at center, rgba(61, 125, 202, 0.12) 0%, transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 24px;
  min-height: 360px;
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 24px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.battle-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  mask: radial-gradient(ellipse at center, black 30%, transparent 100%);
}

.battler {
  position: relative;
  z-index: 1;
  display: grid;
  align-items: center;
  gap: 20px;
}
.battler-1 {
  grid-template-columns: auto 1fr;
}
.battler-2 {
  grid-template-columns: 1fr auto;
}

.battler.fainted {
  filter: grayscale(0.85) brightness(0.55);
  opacity: 0.7;
  transform: translateY(8px) rotate(-2deg);
  transition: all 600ms ease;
}

.battler-info {
  background: linear-gradient(180deg, rgba(0,0,0,0.45), rgba(0,0,0,0.30));
  border: 1px solid var(--card-border-strong);
  border-radius: 16px;
  padding: 14px 18px;
  min-width: 0;
  backdrop-filter: blur(6px);
}

.info-top {
  display: flex; align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.trainer-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  border-radius: 999px;
  color: white;
  text-transform: uppercase;
  white-space: nowrap;
}
.p1-tag { background: var(--p1-color); }
.p2-tag { background: var(--p2-color); }

.poke-name {
  font-size: 18px;
  font-weight: 800;
  text-transform: capitalize;
  letter-spacing: 0.02em;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hp-block { margin-top: 6px; }
.hp-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--text-dim);
}
.hp-text {
  font-weight: 800;
  color: var(--pk-yellow);
  letter-spacing: 0.08em;
}
.hp-numbers {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text);
}

.hp-bar-outer {
  height: 10px;
  background: rgba(0,0,0,0.5);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
}
.hp-bar-inner {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--hp-green), #58e095);
  border-radius: 999px;
  transition: width 700ms cubic-bezier(0.4, 0, 0.2, 1), background 300ms ease;
}
.hp-bar-inner.medium {
  background: linear-gradient(90deg, var(--hp-yellow), #ffd95e);
}
.hp-bar-inner.low {
  background: linear-gradient(90deg, var(--hp-red), #ff7766);
  animation: pulse-hp 1.4s ease-in-out infinite;
}
@keyframes pulse-hp {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}

.types-row {
  display: flex; gap: 6px; margin-top: 10px;
}
.battler-2 .types-row { justify-content: flex-start; }
.battler-1 .types-row { justify-content: flex-end; }

.sprite-wrapper {
  position: relative;
  width: 180px; height: 180px;
  display: grid; place-items: center;
}
@media (max-width: 720px) {
  .sprite-wrapper { width: 130px; height: 130px; }
}

.sprite-shadow {
  position: absolute;
  bottom: 6px;
  width: 60%; height: 18px;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.55) 0%, transparent 70%);
  filter: blur(2px);
}

.sprite {
  position: relative;
  max-width: 100%; max-height: 100%;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.6));
  image-rendering: pixelated;
  animation: idle-bounce 2.6s ease-in-out infinite;
}
@keyframes idle-bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

.battler.attacking .sprite { animation: attack-shake 360ms ease; }
@keyframes attack-shake {
  0%   { transform: translateX(0); }
  25%  { transform: translateX(-12px) rotate(-3deg); }
  60%  { transform: translateX(20px) rotate(3deg); }
  100% { transform: translateX(0); }
}
.battler-2.attacking .sprite {
  animation-name: attack-shake-rev;
}
@keyframes attack-shake-rev {
  0%   { transform: translateX(0); }
  25%  { transform: translateX(12px) rotate(3deg); }
  60%  { transform: translateX(-20px) rotate(-3deg); }
  100% { transform: translateX(0); }
}

.battler.hit .sprite { animation: hit-flash 600ms ease; }
@keyframes hit-flash {
  0%, 100% { filter: drop-shadow(0 6px 14px rgba(0,0,0,0.6)); }
  20%      { filter: drop-shadow(0 6px 14px rgba(0,0,0,0.6)) brightness(2.5) saturate(0); transform: translateX(-6px); }
  40%      { transform: translateX(8px); }
  60%      { transform: translateX(-4px); }
}

.dmg-popup {
  position: absolute;
  top: 30%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 28px;
  font-weight: 900;
  color: var(--pk-yellow);
  text-shadow:
    -2px -2px 0 #000, 2px -2px 0 #000,
    -2px 2px 0 #000,  2px 2px 0 #000,
    0 0 12px rgba(255, 203, 5, 0.7);
  pointer-events: none;
  opacity: 0;
}
.dmg-popup.show {
  animation: dmg-fly 1100ms ease-out;
}
@keyframes dmg-fly {
  0%   { opacity: 0; transform: translate(-50%, -30%) scale(0.5); }
  20%  { opacity: 1; transform: translate(-50%, -55%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -100%) scale(1); }
}

/* ============================================================
   Battle bottom: turn / moves / log
   ============================================================ */

.battle-bottom {
  margin-top: 20px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.turn-banner {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: var(--card);
  border: 1px solid var(--card-border-strong);
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  align-self: start;
  width: fit-content;
}
.turn-dot {
  width: 10px; height: 10px;
  background: var(--pk-yellow);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--pk-yellow);
  animation: pulse-dot 1.4s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.3); opacity: 0.6; }
}
.turn-banner.p1 .turn-dot { background: var(--p1-color); box-shadow: 0 0 12px var(--p1-color); }
.turn-banner.p2 .turn-dot { background: var(--p2-color); box-shadow: 0 0 12px var(--p2-color); }

.moves {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.move-btn {
  position: relative;
  text-align: left;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
  border: 2px solid var(--card-border);
  border-radius: 14px;
  color: var(--text);
  transition: var(--transition);
  overflow: hidden;
}
.move-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--type-color, var(--pk-blue));
  opacity: 0.10;
  pointer-events: none;
  transition: opacity var(--transition);
}
.move-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--type-color, var(--pk-yellow));
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}
.move-btn:hover:not(:disabled)::before { opacity: 0.22; }
.move-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.move-btn .move-name {
  font-weight: 700;
  font-size: 14px;
  text-transform: capitalize;
  letter-spacing: 0.01em;
}
.move-btn .move-meta {
  margin-top: 6px;
  display: flex; gap: 8px; align-items: center;
  font-size: 11px;
  color: var(--text-dim);
}
.move-btn .move-meta .type-pill { font-size: 9px; padding: 2px 6px; }
.move-btn .move-power {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text);
}

.battle-log {
  background: rgba(0,0,0,0.45);
  border: 1px solid var(--card-border-strong);
  border-radius: 14px;
  padding: 12px 16px;
  max-height: 110px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.6;
  scroll-behavior: smooth;
}
.battle-log::-webkit-scrollbar { width: 6px; }
.battle-log::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.18);
  border-radius: 3px;
}

.log-line {
  padding: 2px 0;
  animation: log-in 280ms ease;
  color: var(--text-dim);
}
.log-line.log-system { color: var(--pk-yellow); font-weight: 600; }
.log-line.log-effective { color: #ff8c5a; font-weight: 600; }
.log-line.log-ineffective { color: #76b7e6; font-weight: 600; }
.log-line.log-immune { color: var(--text-muted); font-style: italic; }
.log-line.log-attack { color: var(--text); }

@keyframes log-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Victory screen
   ============================================================ */

.victory-card {
  position: relative;
  background: linear-gradient(180deg, rgba(255, 203, 5, 0.12), rgba(255,255,255,0.02));
  border: 1px solid rgba(255, 203, 5, 0.32);
  border-radius: 24px;
  padding: 56px 40px;
  text-align: center;
  backdrop-filter: blur(20px);
  box-shadow: 0 30px 80px rgba(0,0,0,0.55), 0 0 80px rgba(255, 203, 5, 0.15);
  overflow: hidden;
}

.confetti-area {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  width: 8px; height: 12px;
  top: -20px;
  animation: fall linear forwards;
}
@keyframes fall {
  to {
    top: 110%;
    transform: translateX(var(--drift, 0)) rotate(720deg);
  }
}

.trophy {
  display: inline-grid;
  place-items: center;
  width: 110px; height: 110px;
  border-radius: 50%;
  margin-bottom: 16px;
  background: linear-gradient(180deg, var(--pk-yellow), #f5a623);
  color: #1a1a1a;
  box-shadow: 0 12px 36px rgba(255, 203, 5, 0.5);
  animation: trophy-bounce 1.6s ease-in-out infinite;
}
@keyframes trophy-bounce {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50%      { transform: translateY(-8px) rotate(3deg); }
}

.victory-label {
  color: var(--pk-yellow);
  font-weight: 700;
  letter-spacing: 0.3em;
  font-size: 14px;
  text-transform: uppercase;
}

.winner-name {
  font-size: clamp(34px, 6vw, 52px);
  font-weight: 900;
  margin-top: 8px;
  background: linear-gradient(180deg, white 0%, var(--pk-yellow) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.winner-detail {
  margin-top: 8px;
  color: var(--text-dim);
  font-size: 15px;
}

.victory-buttons {
  margin-top: 36px;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ============================================================
   Loader overlay
   ============================================================ */

.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  background: rgba(10, 14, 39, 0.85);
  backdrop-filter: blur(8px);
  flex-direction: column;
  gap: 18px;
}
.loader.show { display: grid; }

.loader-pokeball {
  width: 64px; height: 64px;
  position: relative;
  animation: spin-fast 1s linear infinite;
}
.loader-top, .loader-bottom {
  position: absolute;
  width: 100%; height: 50%;
  left: 0;
  border: 3px solid #1a1a1a;
}
.loader-top {
  top: 0;
  background: var(--pk-red);
  border-radius: 64px 64px 0 0;
  border-bottom: 0;
}
.loader-bottom {
  bottom: 0;
  background: white;
  border-radius: 0 0 64px 64px;
  border-top: 0;
}
.loader-band {
  position: absolute;
  width: 100%; height: 6px;
  top: 50%; left: 0;
  background: #1a1a1a;
  transform: translateY(-50%);
}
.loader-button {
  position: absolute;
  width: 18px; height: 18px;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border: 3px solid #1a1a1a;
  border-radius: 50%;
}

@keyframes spin-fast {
  to { transform: rotate(360deg); }
}

#loader-text {
  color: var(--text-dim);
  font-size: 14px;
  letter-spacing: 0.04em;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 720px) {
  .title-card { padding: 32px 24px; }
  .player-inputs {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .vs-divider {
    padding: 4px 0;
    text-align: center;
  }
  .battler-1, .battler-2 {
    grid-template-columns: 1fr !important;
    text-align: center;
    justify-items: center;
  }
  .battler-2 .sprite-wrapper { order: 2; }
  .battler-1 .sprite-wrapper { order: 1; }
  .types-row { justify-content: center !important; }
  .poke-name { text-align: center; }
  .moves { grid-template-columns: 1fr; }
}
