/* ============================================
   PokéScout — Modern dark theme
   Clean, spacious layout inspired by live
   leaderboard UIs: deep navy, soft glows,
   pill shapes, high contrast white text.
   ============================================ */
:root {
  --bg-deep: #0d1117;
  --bg-card: rgba(22, 32, 48, 0.92);
  --bg-row: rgba(32, 45, 66, 0.85);
  --bg-row-hover: rgba(40, 55, 80, 0.95);
  --bg-input: #ffffff;
  --bg-elevated: rgba(255, 255, 255, 0.06);

  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.55);
  --text-muted: rgba(255, 255, 255, 0.38);

  --accent: #5eead4;
  --accent-dim: rgba(94, 234, 212, 0.25);
  --accent-blue: #60a5fa;

  --success: #4ade80;
  --error: #f87171;

  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;

  --shadow-card: 0 24px 64px rgba(0, 0, 0, 0.45);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

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

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Soft ambient glow behind the card */
.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(96, 165, 250, 0.18), transparent),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(94, 234, 212, 0.1), transparent),
    radial-gradient(ellipse 50% 30% at 10% 80%, rgba(139, 92, 246, 0.08), transparent);
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 3rem;
}

.app.compare-active {
  max-width: 820px;
}

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

/* ============================================
   Main card container
   ============================================ */
.main-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(12px);
  overflow: hidden;
  transition: box-shadow 0.3s, border-color 0.3s;
}

.main-card.is-busy {
  border-color: var(--accent-dim);
  box-shadow: var(--shadow-card), 0 0 0 1px var(--accent-dim);
}

/* ============================================
   Header
   ============================================ */
.header {
  text-align: center;
  padding: 2.5rem 2rem 1.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}

.logo {
  margin: 0;
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.tagline {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ============================================
   Main content area
   ============================================ */
.main {
  padding: 1.5rem 1.75rem 0.5rem;
}

.section-label,
.stats-heading {
  margin: 0 0 1rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ============================================
   Mode toggle — pill tabs
   ============================================ */
.mode-toggle {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.mode-btn {
  flex: 1;
  padding: 0.65rem 1rem;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.mode-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.mode-btn.is-active {
  background: var(--text-primary);
  color: var(--bg-deep);
  border-color: var(--text-primary);
}

.mode-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ============================================
   Search
   ============================================ */
.search-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

/* hidden attribute must win over display:flex above */
.search-section[hidden],
.compare-section[hidden] {
  display: none !important;
}

.search-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 1rem;
  font-size: 1.1rem;
  color: #94a3b8;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 2.75rem;
  min-height: 48px;
  border: none;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--bg-input);
  color: #1e293b;
  transition: box-shadow 0.15s;
}

.search-input::placeholder {
  color: #94a3b8;
}

.search-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.compare-section {
  margin-bottom: 1.5rem;
}

.compare-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.compare-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.compare-input-group label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.compare-input-group .search-input {
  padding-left: 1rem;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  padding: 0.75rem 1.25rem;
  min-height: 44px;
  border: none;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s, background 0.15s;
  touch-action: manipulation;
}

.btn-primary {
  background: var(--text-primary);
  color: var(--bg-deep);
}

.btn-primary:hover {
  opacity: 0.92;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-ghost:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.btn:active {
  transform: scale(0.98);
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ============================================
   Status messages
   ============================================ */
.status {
  text-align: center;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.status.loading {
  background: rgba(96, 165, 250, 0.12);
  color: var(--accent-blue);
  border: 1px solid rgba(96, 165, 250, 0.2);
}

.status.error {
  background: rgba(248, 113, 113, 0.1);
  color: var(--error);
  border: 1px solid rgba(248, 113, 113, 0.2);
}

/* ============================================
   Pokémon result card
   ============================================ */
.result {
  margin-bottom: 1.5rem;
}

.pokemon-card {
  background: var(--bg-row);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.pokemon-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.pokemon-identity {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.pokemon-thumb {
  width: 48px;
  height: 48px;
  object-fit: contain;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.pokemon-name {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  text-transform: capitalize;
  letter-spacing: -0.01em;
}

.pokemon-id {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

.pokemon-hero {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem 1.5rem;
  background: rgba(0, 0, 0, 0.15);
}

.pokemon-sprite {
  width: 100%;
  max-width: 200px;
  height: auto;
  image-rendering: pixelated;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.4));
  animation: fade-up 0.35s ease-out;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.pokemon-meta {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.meta-block h3 {
  margin: 0 0 0.5rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.meta-value {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.meta-row {
  display: flex;
  gap: 2.5rem;
}

.stats-section {
  padding: 1.25rem 1.5rem;
}

/* ============================================
   Type badges
   ============================================ */
.type-list,
.ability-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.type-badge {
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: white;
}

.ability-item {
  padding: 0.3rem 0.75rem;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 500;
  text-transform: capitalize;
  color: var(--text-secondary);
}

.type-normal   { background: #9ca3af; }
.type-fire     { background: #f97316; }
.type-water    { background: #3b82f6; }
.type-electric { background: #eab308; color: #1e293b; }
.type-grass    { background: #22c55e; }
.type-ice      { background: #67e8f9; color: #1e293b; }
.type-fighting { background: #ef4444; }
.type-poison   { background: #a855f7; }
.type-ground   { background: #d97706; color: #1e293b; }
.type-flying   { background: #818cf8; }
.type-psychic  { background: #ec4899; }
.type-bug      { background: #84cc16; color: #1e293b; }
.type-rock     { background: #a8a29e; color: #1e293b; }
.type-ghost    { background: #7c3aed; }
.type-dragon   { background: #6366f1; }
.type-dark     { background: #78716c; }
.type-steel    { background: #94a3b8; color: #1e293b; }
.type-fairy    { background: #f472b6; color: #1e293b; }

/* ============================================
   Stat bars — clean rows
   ============================================ */
.stats-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.stat-row {
  display: grid;
  grid-template-columns: 100px 1fr 40px;
  align-items: center;
  gap: 0.75rem;
}

.stat-name {
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: capitalize;
  color: var(--text-secondary);
}

.stat-bar-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width 0.5s cubic-bezier(0.34, 1.1, 0.64, 1);
  min-width: 2px;
}

.stat-value {
  text-align: right;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.stat-row[data-stat="hp"]              .stat-bar-fill { background: #f87171; }
.stat-row[data-stat="attack"]          .stat-bar-fill { background: #fb923c; }
.stat-row[data-stat="defense"]         .stat-bar-fill { background: #facc15; }
.stat-row[data-stat="special-attack"]  .stat-bar-fill { background: #c084fc; }
.stat-row[data-stat="special-defense"] .stat-bar-fill { background: #4ade80; }
.stat-row[data-stat="speed"]           .stat-bar-fill { background: #60a5fa; }

/* ============================================
   Battle Matchup Guide
   ============================================ */
.matchup-section {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.matchup-loading {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.matchup-content {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.matchup-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.matchup-subgroup {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.matchup-subgroup-danger {
  padding: 0.85rem;
  margin-bottom: 0.35rem;
  background: rgba(220, 38, 38, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.45);
  border-radius: var(--radius-sm);
  animation: danger-pulse 2.5s ease-in-out infinite;
}

@keyframes danger-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.15); }
  50% { box-shadow: 0 0 16px 2px rgba(248, 113, 113, 0.25); }
}

.matchup-group-warning .matchup-heading {
  color: #fca5a5;
}

.matchup-heading {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.matchup-helper {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.matchup-helper-danger {
  color: #fecaca;
}

.matchup-helper-danger strong {
  color: #f87171;
  font-weight: 800;
}

.matchup-list {
  gap: 0.45rem;
}

.matchup-list-danger {
  gap: 0.55rem;
}

.matchup-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.matchup-mult {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.25);
  letter-spacing: 0.02em;
}

/* 4× weaknesses — loud and unmissable */
.matchup-major-weak {
  font-size: 0.88rem;
  padding: 0.5rem 1rem;
  transform: scale(1.02);
  box-shadow:
    0 0 0 2px #f87171,
    0 0 20px rgba(248, 113, 113, 0.5),
    inset 0 0 12px rgba(255, 255, 255, 0.15);
  animation: major-weak-glow 1.8s ease-in-out infinite;
}

@keyframes major-weak-glow {
  0%, 100% { box-shadow: 0 0 0 2px #f87171, 0 0 16px rgba(248, 113, 113, 0.4); }
  50% { box-shadow: 0 0 0 3px #ef4444, 0 0 24px rgba(239, 68, 68, 0.65); }
}

.matchup-major-weak .matchup-mult {
  background: #dc2626;
  color: white;
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
}

/* 2× weaknesses — noticeable but calmer than 4× */
.matchup-weak {
  opacity: 0.92;
}

.matchup-weak .matchup-mult {
  background: rgba(248, 113, 113, 0.25);
  color: #fca5a5;
  font-size: 0.62rem;
}

.matchup-resist .matchup-mult {
  background: rgba(74, 222, 128, 0.25);
  color: #bbf7d0;
}

.matchup-immune {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.matchup-immune .matchup-mult {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.matchup-nve {
  opacity: 0.85;
}

.matchup-empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

.matchup-summary {
  margin: 0.25rem 0 0;
  padding: 0.85rem 1rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
}

/* ============================================
   Recommended Opponents
   ============================================ */
.opponents-section {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.opponents-disclaimer {
  margin: 0 0 1rem;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-muted);
  padding: 0.65rem 0.85rem;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.generation-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.generation-select {
  width: 100%;
  max-width: 320px;
  padding: 0.65rem 0.85rem;
  margin-bottom: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.generation-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.opponents-loading {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.opponents-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.opponents-block {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.opponents-heading {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.opponents-block-good .opponents-heading {
  color: #86efac;
}

.opponents-block-avoid .opponents-heading {
  color: #fca5a5;
}

.opponents-helper {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.opponents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}

.opponent-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 1rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
  text-align: center;
}

.opponent-card:hover {
  transform: translateY(-2px);
}

.opponent-card-good {
  border-color: rgba(74, 222, 128, 0.25);
  background: rgba(74, 222, 128, 0.06);
}

.opponent-card-good:hover {
  border-color: rgba(74, 222, 128, 0.45);
  background: rgba(74, 222, 128, 0.1);
}

.opponent-card-avoid {
  border-color: rgba(248, 113, 113, 0.25);
  background: rgba(248, 113, 113, 0.06);
}

.opponent-card-avoid:hover {
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.1);
}

.opponent-label {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-pill);
}

.opponent-card-good .opponent-label {
  background: rgba(74, 222, 128, 0.2);
  color: #86efac;
}

.opponent-card-avoid .opponent-label {
  background: rgba(248, 113, 113, 0.2);
  color: #fca5a5;
}

.opponent-sprite {
  width: 72px;
  height: 72px;
  object-fit: contain;
  image-rendering: pixelated;
}

.opponent-name {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: capitalize;
  color: var(--text-primary);
}

.opponent-id {
  margin: 0;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.opponent-types {
  justify-content: center;
}

.opponent-why {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.opponents-empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ============================================
   Evolution chain
   ============================================ */
.evolution-section {
  padding: 1.25rem 1.5rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.evolution-loading {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.evolution-chain {
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.evo-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.evo-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-width: 80px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.evo-node:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-dim);
}

.evo-node.evo-current {
  border-color: var(--accent);
  background: rgba(94, 234, 212, 0.08);
}

.evo-node img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  image-rendering: pixelated;
}

.evo-node span {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: capitalize;
  text-align: center;
  color: var(--text-secondary);
}

.evo-children {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.evo-child-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.evo-arrow {
  color: var(--text-muted);
  font-size: 1rem;
}

/* ============================================
   Compare mode
   ============================================ */
.compare-result {
  margin-bottom: 1.5rem;
}

.compare-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.compare-card,
.panel {
  background: var(--bg-row);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 1.25rem;
  text-align: center;
}

.compare-card-name {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: capitalize;
}

.compare-card-id {
  margin: 0.2rem 0 0.75rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.compare-card-sprite {
  width: 96px;
  height: 96px;
  object-fit: contain;
  image-rendering: pixelated;
}

.compare-card-types {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
}

.panel {
  text-align: left;
}

.compare-stats-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.compare-stat-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.65rem;
}

.compare-stat-side {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.compare-stat-side-a {
  flex-direction: row-reverse;
}

.compare-stat-value {
  font-weight: 700;
  font-size: 0.88rem;
  min-width: 1.75rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

.compare-stat-side .stat-bar-track {
  flex: 1;
  min-width: 0;
}

.compare-stat-side-a .stat-bar-fill {
  background: #f87171;
  margin-left: auto;
}

.compare-stat-side-b .stat-bar-fill {
  background: #60a5fa;
}

.compare-stat-name {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-align: center;
  min-width: 64px;
}

.stat-winner .compare-stat-value {
  color: var(--accent);
}

.stat-tie .compare-stat-value {
  color: var(--text-muted);
}

.compare-stat-side-a .stat-bar-track {
  display: flex;
  justify-content: flex-end;
}

/* ============================================
   Footer
   ============================================ */
.footer {
  text-align: center;
  padding: 1.25rem 1.75rem 1.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.footer p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.footer a {
  color: var(--accent);
  text-decoration: none;
}

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

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 640px) {
  .app {
    padding: 1rem 0.75rem 2rem;
  }

  .header {
    padding: 2rem 1.25rem 1.5rem;
  }

  .main {
    padding: 1.25rem 1.25rem 0.25rem;
  }

  .pokemon-card-header {
    flex-direction: column;
    align-items: stretch;
  }

  .meta-row {
    gap: 1.5rem;
  }

  .stat-row {
    grid-template-columns: 80px 1fr 36px;
    gap: 0.5rem;
  }

  .compare-cards {
    grid-template-columns: 1fr;
  }

  .compare-stat-row {
    grid-template-columns: 1fr;
    gap: 0.3rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

  .compare-stat-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  .compare-stat-name {
    order: -1;
  }

  .compare-stat-side-a {
    flex-direction: row;
  }

  .compare-stat-side-a .stat-bar-track {
    justify-content: flex-start;
  }

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

  .generation-select {
    max-width: none;
  }
}

@supports (padding: env(safe-area-inset-bottom)) {
  .app {
    padding-bottom: calc(2rem + env(safe-area-inset-bottom));
  }
}
