/* ==========================================================================
   POKÉDEX ULTIME - MODERN CSS STYLESHEET
   ========================================================================== */

:root {
  /* Design Tokens */
  --font-primary: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Theme Palette */
  --bg-dark: #0f1219;
  --bg-surface: rgba(22, 28, 42, 0.75);
  --bg-surface-elevated: rgba(30, 39, 60, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(255, 255, 255, 0.25);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --primary-accent: #fa5252;
  --primary-glow: rgba(250, 82, 82, 0.4);

  /* Type Colors */
  --type-plante: #48d0b0;
  --type-feu: #fb6c6c;
  --type-eau: #60a5fa;
  --type-electrik: #ffd86f;
  --type-poison: #b97fc9;
  --type-insecte: #a8b820;
  --type-vol: #93c5fd;
  --type-normal: #a8a878;
  --type-combat: #e27d36;
  --type-sol: #e0c068;
  --type-roche: #b8a038;
  --type-spectre: #7b62a3;
  --type-acier: #b8b8d0;
  --type-psy: #f472b6;
  --type-glace: #7dd3fc;
  --type-dragon: #818cf8;
  --type-tenebres: #705848;
  --type-fee: #f9a8d4;

  /* Transitions & Curves */
  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --ease-out-smooth: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 0.18s ease;
  --transition-normal: 0.3s cubic-bezier(0.2, 0.8, 0.4, 1);
}

/* ==========================================================================
   Base & Layout
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
  background-image: 
    radial-gradient(circle at 15% 10%, rgba(238, 21, 21, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 60%, rgba(96, 165, 250, 0.08) 0%, transparent 45%),
    linear-gradient(to bottom, #0d1117 0%, #111827 50%, #0d1117 100%);
}

/* Ambient glow orbs */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(120px);
  opacity: 0.35;
}
.glow-1 {
  width: 500px;
  height: 500px;
  top: -150px;
  left: -100px;
  background: radial-gradient(circle, #fa5252, transparent 70%);
}
.glow-2 {
  width: 600px;
  height: 600px;
  bottom: 50px;
  right: -150px;
  background: radial-gradient(circle, #3b82f6, transparent 70%);
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(15, 18, 25, 0.82);
  border-bottom: 1px solid var(--border-subtle);
  padding: 16px 28px 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  user-select: none;
}

.pokeball-icon {
  width: 44px;
  height: 44px;
  position: relative;
  border-radius: 50%;
  border: 3px solid #1e293b;
  box-shadow: 0 4px 15px rgba(238, 21, 21, 0.35);
  overflow: hidden;
  transition: transform 0.6s var(--ease-spring);
  cursor: pointer;
  flex-shrink: 0;
}

.pokeball-icon:hover {
  transform: rotate(180deg) scale(1.1);
}

.pokeball-top {
  position: absolute;
  top: 0;
  width: 100%;
  height: 50%;
  background: linear-gradient(180deg, #ff3b30, #e02424);
}

.pokeball-bottom {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 50%;
  background: linear-gradient(180deg, #ffffff, #e2e8f0);
}

.pokeball-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 6px;
  background-color: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.pokeball-button {
  width: 14px;
  height: 14px;
  background-color: #fff;
  border-radius: 50%;
  border: 3px solid #1e293b;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
  animation: pokeballPulse 2.5s infinite ease-in-out;
}

@keyframes pokeballPulse {
  0%, 100% { box-shadow: 0 0 4px rgba(255, 255, 255, 0.6); }
  50% { box-shadow: 0 0 12px rgba(255, 75, 75, 0.9); }
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-family: var(--font-primary);
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: 1px;
  margin: 0;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.logo-title span {
  background: linear-gradient(135deg, #fa5252, #f59e0b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-subtitle {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Header Action Controls */
.header-actions {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.header-btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.control-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.select-wrapper {
  position: relative;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  overflow: hidden;
  transition: all var(--transition-fast);
}

.select-wrapper:hover,
.select-wrapper:focus-within {
  border-color: var(--primary-accent);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.select-wrapper select {
  appearance: none;
  background: transparent;
  border: none;
  color: #fff;
  padding: 8px 36px 8px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  min-width: 170px;
}

.select-wrapper select option {
  background-color: #1e293b;
  color: #fff;
}

.select-wrapper::after {
  content: "▾";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 0.85rem;
}

.icon-btn {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border-subtle);
  color: #fff;
  width: 40px;
  min-width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition-fast);
  font-size: 1.1rem;
}

.icon-btn:hover {
  background: rgba(51, 65, 85, 0.9);
  border-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.icon-btn:active {
  transform: scale(0.95);
}

/* Search Bar Section */
.search-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.search-bar {
  flex: 1;
  min-width: 260px;
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 0 16px;
  transition: all var(--transition-fast);
}

.search-bar:focus-within {
  background: rgba(30, 41, 59, 0.95);
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.25);
}

.search-icon {
  color: var(--text-dim);
  margin-right: 10px;
  flex-shrink: 0;
  transition: color var(--transition-fast);
}

.search-bar:focus-within .search-icon {
  color: #60a5fa;
}

.search-bar input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 0.95rem;
  font-family: inherit;
  padding: 11px 0;
}

.search-bar input::placeholder {
  color: var(--text-dim);
}

.search-clear-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0 4px;
  border-radius: 50%;
  line-height: 1;
  transition: color var(--transition-fast);
}

.search-clear-btn:hover {
  color: #fff;
}

.status-counter .count-badge {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

/* Type Filter Chips */
.types-filter-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.types-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.filter-label {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.reset-filter-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 3px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.reset-filter-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.05);
}

.types-chips-wrapper {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.types-chips-wrapper::-webkit-scrollbar {
  height: 5px;
}
.types-chips-wrapper::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 4px;
}

.type-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: 30px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  transition: all var(--transition-fast);
  user-select: none;
  flex-shrink: 0;
}

.type-chip img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
  transition: transform var(--transition-fast);
}

.type-chip:hover {
  background: rgba(51, 65, 85, 0.8);
  color: #fff;
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.2);
}

.type-chip:hover img {
  transform: scale(1.2);
}

.type-chip.active {
  background: var(--chip-color, var(--primary-accent));
  color: #0f1219;
  border-color: transparent;
  font-weight: 800;
  box-shadow: 0 4px 15px var(--chip-glow, rgba(250, 82, 82, 0.4));
  transform: translateY(-2px) scale(1.04);
}

/* ==========================================================================
   Main Grid & Cards
   ========================================================================== */

main {
  flex: 1;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 28px 60px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 26px;
  position: relative;
  z-index: 1;
}

/* Card Entrance Stagger */
@keyframes cardFadeInUp {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.pokemon-card {
  position: relative;
  border-radius: 22px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  cursor: pointer;
  outline: none;
  display: flex;
  flex-direction: column;
  transform-style: preserve-3d;
  transform: perspective(1000px) rotateX(var(--rotate-x, 0deg)) rotateY(var(--rotate-y, 0deg)) translateZ(0);
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.4, 1), 
              box-shadow 0.28s ease, 
              border-color 0.28s ease;
  animation: cardFadeInUp 0.45s cubic-bezier(0.16, 1, 0.3, 1) backwards;
  animation-delay: calc(var(--stagger-index, 0) * 35ms);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

.pokemon-card:hover,
.pokemon-card:focus-visible {
  border-color: var(--card-color, #fa5252);
  box-shadow: 0 22px 45px -10px rgba(0, 0, 0, 0.7),
              0 0 30px var(--card-glow, rgba(250, 82, 82, 0.3));
  z-index: 10;
}

/* Card Glow Effect Behind Sprite */
.card-ambient-glow {
  position: absolute;
  top: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--card-color, #3b82f6) 0%, transparent 70%);
  opacity: 0.25;
  filter: blur(35px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.pokemon-card:hover .card-ambient-glow {
  opacity: 0.55;
  transform: translateX(-50%) scale(1.15);
}

/* Holographic Foil Reflection */
.card-foil {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  background: 
    radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255, 255, 255, 0.28) 0%, transparent 55%),
    linear-gradient(135deg, transparent 20%, rgba(255,200,255,0.12) 40%, rgba(180,240,255,0.15) 50%, rgba(255,220,180,0.12) 60%, transparent 80%);
  mix-blend-mode: overlay;
  z-index: 4;
}

.pokemon-card:hover .card-foil {
  opacity: 1;
}

/* Card Header */
.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 18px 0;
  z-index: 3;
}

.pokemon-id-tag {
  font-family: var(--font-primary);
  font-weight: 800;
  font-size: 0.88rem;
  color: #fff;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  letter-spacing: 0.8px;
  flex-shrink: 0;
}

.pokemon-category-tag {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 3px 9px;
  border-radius: 8px;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Card Sprite Section */
.card-sprite-area {
  position: relative;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  z-index: 3;
}

.sprite-wrapper {
  position: relative;
  width: 145px;
  height: 145px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sprite-img {
  position: absolute;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.45));
  transition: transform 0.4s var(--ease-spring), opacity 0.35s ease;
  user-select: none;
}

.sprite-img.primary-sprite {
  opacity: 1;
  transform: scale(1);
}

.sprite-img.alt-sprite {
  opacity: 0;
  transform: scale(0.92);
  pointer-events: none;
}

.pokemon-card:hover .sprite-img.primary-sprite {
  transform: translateY(-6px) scale(1.08);
}

/* Floating Animation */
@keyframes floatSprite {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.pokemon-card:hover .sprite-wrapper {
  animation: floatSprite 3s ease-in-out infinite;
}

/* Evolution preview active state */
.pokemon-card.showing-evolution .sprite-img.primary-sprite {
  opacity: 0;
  transform: scale(0.85);
}

.pokemon-card.showing-evolution .sprite-img.alt-sprite {
  opacity: 1;
  transform: scale(1.08);
}

/* Hover Evolution Badge */
.card-evo-badge {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%) translateY(-8px) scale(0.92);
  opacity: 0;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-focus);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
  padding: 4px 12px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  pointer-events: none;
  transition: all 0.28s var(--ease-spring);
  z-index: 5;
}

.card-evo-badge.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

.evo-badge-icon {
  font-size: 0.82rem;
}

.evo-badge-name {
  font-weight: 700;
  font-size: 0.75rem;
  color: #fff;
}

.evo-badge-cond {
  font-size: 0.68rem;
  color: #38bdf8;
  font-weight: 600;
}

/* Evolution Stage Indicators (Dots) */
.evo-dots-container {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  border-radius: 20px;
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 6;
}

.pokemon-card:hover .evo-dots-container {
  opacity: 1;
}

.evo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 0.2s ease;
}

.evo-dot:hover {
  background: rgba(255, 255, 255, 0.8);
  transform: scale(1.3);
}

.evo-dot.active {
  background: #38bdf8;
  box-shadow: 0 0 8px #38bdf8;
  width: 16px;
  border-radius: 4px;
}

/* Card Content / Body */
.card-content {
  background: var(--bg-surface-elevated);
  backdrop-filter: blur(12px);
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  z-index: 3;
}

.card-name-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pokemon-name {
  font-family: var(--font-primary);
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0;
  color: #fff;
  line-height: 1.2;
}

.pokemon-subname {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-weight: 600;
}

/* Card Types */
.card-types-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.type-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  background: var(--type-bg, rgba(255, 255, 255, 0.15));
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.type-pill img {
  width: 14px;
  height: 14px;
  object-fit: contain;
}

/* Card Mini Stat Bars */
.card-stats-preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  background: rgba(15, 23, 42, 0.45);
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.stat-preview-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
}

.stat-val {
  color: #fff;
  font-weight: 800;
}

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

.stat-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--stat-color, #38bdf8);
  transition: width 0.6s var(--ease-out-smooth);
}

/* Card Action Hint */
.card-footer-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
  transition: color var(--transition-fast);
}

.card-footer-hint span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-arrow {
  transition: transform var(--transition-fast);
}

.pokemon-card:hover .card-footer-hint {
  color: var(--card-color, #fa5252);
}

.pokemon-card:hover .card-arrow {
  transform: translateX(4px);
}

/* Empty State / Loader */
.state-container {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
  gap: 16px;
}

.loader-pokeball {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 4px solid #fff;
  position: relative;
  animation: spinPokeball 0.9s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
  box-shadow: 0 0 25px rgba(250, 82, 82, 0.5);
  background: linear-gradient(180deg, #ff3b30 50%, #ffffff 50%);
}

.loader-pokeball::before {
  content: "";
  position: absolute;
  top: calc(50% - 3px);
  left: 0;
  width: 100%;
  height: 6px;
  background-color: #0f1219;
}

.loader-pokeball::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: #fff;
  border: 3px solid #0f1219;
  box-shadow: 0 0 10px #fff;
}

@keyframes spinPokeball {
  0% { transform: rotate(0deg) scale(0.9); }
  50% { transform: rotate(180deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(0.9); }
}

.state-title {
  font-family: var(--font-primary);
  font-size: 1.4rem;
  font-weight: 800;
  margin: 0;
}

.state-desc {
  color: var(--text-muted);
  max-width: 420px;
  margin: 0;
  font-size: 0.95rem;
}

/* ==========================================================================
   Detail Modal Dialog (Modern @starting-style & top-layer animations)
   ========================================================================== */

dialog#pokemon-modal {
  border: none;
  background: transparent;
  padding: 0;
  max-width: 980px;
  width: min(94vw, 980px);
  max-height: 90vh;
  margin: auto;
  border-radius: 28px;
  overflow: visible;
  outline: none;
  color: var(--text-main);
}

dialog#pokemon-modal[open] {
  animation: modalEnter 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalEnter {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(24px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

dialog#pokemon-modal::backdrop {
  background-color: rgba(10, 15, 25, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: backdropEnter 0.35s ease forwards;
}

@keyframes backdropEnter {
  from {
    opacity: 0;
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
  }
  to {
    opacity: 1;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }
}

/* Modal Card Container */
.modal-card {
  position: relative;
  background: #141a29;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 28px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.85),
              0 0 50px var(--modal-type-glow, rgba(250, 82, 82, 0.25));
  overflow-y: auto;
  max-height: 90vh;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.modal-card::-webkit-scrollbar {
  width: 6px;
}
.modal-card::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

/* Close button */
.modal-close-btn {
  position: sticky;
  top: 18px;
  float: right;
  margin-right: 18px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid var(--border-subtle);
  color: #fff;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  transition: all var(--transition-fast);
  backdrop-filter: blur(8px);
}

.modal-close-btn:hover {
  background: #fa5252;
  border-color: #fa5252;
  transform: rotate(90deg) scale(1.1);
  box-shadow: 0 0 15px rgba(250, 82, 82, 0.6);
}

/* Nav Arrows */
.modal-nav-arrows {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  pointer-events: none;
  display: flex;
  justify-content: space-between;
  padding: 0 12px;
  transform: translateY(-50%);
  z-index: 10;
}

.nav-arrow {
  pointer-events: auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.nav-arrow:hover {
  background: #3b82f6;
  border-color: #3b82f6;
  transform: scale(1.15);
}

.nav-arrow:disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* Modal Body Content */
.modal-body {
  padding: 20px 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.modal-header-info {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.modal-title-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.modal-id-badge {
  font-family: var(--font-primary);
  font-size: 0.92rem;
  font-weight: 800;
  color: #38bdf8;
  letter-spacing: 1px;
}

.modal-pokemon-name {
  font-family: var(--font-primary);
  font-size: 1.95rem;
  font-weight: 900;
  margin: 0;
  color: #fff;
  line-height: 1.1;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.modal-foreign-names {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}

.modal-badges-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.gen-pill, .cat-pill {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Modal Main Grid: Visuals Left, Details Right */
.modal-main-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 24px;
  align-items: start;
}

/* Left Visual Column */
.modal-visual-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.modal-artwork-stage {
  position: relative;
  width: 100%;
  max-width: 280px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-artwork-glow {
  position: absolute;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--modal-type-color, #fa5252) 0%, transparent 70%);
  opacity: 0.35;
  filter: blur(35px);
  animation: pulseGlow 4s infinite ease-in-out;
}

@keyframes pulseGlow {
  0%, 100% { transform: scale(0.9); opacity: 0.3; }
  50% { transform: scale(1.15); opacity: 0.5; }
}

.modal-big-sprite {
  max-width: 190px;
  max-height: 190px;
  object-fit: contain;
  filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.5));
  z-index: 2;
  transition: transform 0.4s var(--ease-spring), filter 0.3s ease;
  animation: floatSprite 4s ease-in-out infinite;
}

/* Form Switcher Tabs (Regular, Shiny, Mega, Gmax) */
.form-switcher-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(30, 41, 59, 0.7);
  padding: 5px;
  border-radius: 30px;
  border: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  justify-content: center;
}

.form-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.form-tab-btn:hover {
  color: #fff;
}

.form-tab-btn.active {
  background: #3b82f6;
  color: #fff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.form-tab-btn.shiny-tab.active {
  background: linear-gradient(135deg, #f59e0b, #ec4899);
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}

/* Sound cry button */
.cry-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.cry-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: scale(1.05);
}

/* Physical Profile Cards */
.profile-specs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%;
}

.spec-box {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.spec-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
}

.spec-value {
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
}

/* Gender bar */
.gender-bar {
  display: flex;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
  background: rgba(255, 255, 255, 0.1);
}
.gender-male {
  background: #60a5fa;
  height: 100%;
}
.gender-female {
  background: #f472b6;
  height: 100%;
}

/* Right Details Column */
.modal-details-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.details-section-title {
  font-family: var(--font-primary);
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 12px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.total-bst-badge {
  font-size: 0.8rem;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 800;
}

/* Animated Stats Bars */
.stats-bars-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(22, 28, 42, 0.6);
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--border-subtle);
}

.stat-row {
  display: grid;
  grid-template-columns: 85px 42px 1fr;
  align-items: center;
  gap: 12px;
}

.stat-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}

.stat-number {
  font-size: 0.85rem;
  font-weight: 800;
  color: #fff;
  text-align: right;
}

.stat-track {
  height: 9px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.stat-fill {
  height: 100%;
  border-radius: 6px;
  background: var(--bar-gradient, linear-gradient(90deg, #38bdf8, #818cf8));
  width: 0%;
  transition: width 1s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 8px var(--bar-glow, rgba(56, 189, 248, 0.4));
}

/* Talents / Abilities */
.talents-container {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.talent-pill {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: 12px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.talent-pill.hidden-talent {
  border-color: #f59e0b;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.12);
}

/* Resistances / Matchups */
.resistances-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.matchup-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.matchup-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.4px;
}

.matchup-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.matchup-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  background: var(--match-color, #334155);
}

.matchup-chip .multiplier {
  background: rgba(0, 0, 0, 0.35);
  padding: 1px 4px;
  border-radius: 4px;
  font-size: 0.68rem;
}

/* Evolution Chain Timeline (Full Width Bottom) */
.modal-evolution-section {
  border-top: 1px solid var(--border-subtle);
  padding-top: 14px;
}

.evolution-chain-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 6px 0 8px;
}

.evo-chain-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 14px;
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-fast);
}

.evo-chain-node:hover {
  background: rgba(51, 65, 85, 0.8);
  border-color: #38bdf8;
  transform: translateY(-3px) scale(1.04);
}

.evo-chain-node.current {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.3);
}

.evo-node-img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
  transition: transform var(--transition-fast);
}

.evo-chain-node:hover .evo-node-img {
  transform: scale(1.15);
}

.evo-node-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
  text-align: center;
}

.evo-node-id {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-weight: 600;
}

.evo-chain-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-dim);
}

.evo-condition-tag {
  font-size: 0.68rem;
  font-weight: 700;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid rgba(245, 158, 11, 0.25);
  max-width: 140px;
  text-align: center;
  white-space: normal;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.app-footer {
  margin-top: auto;
  background: #0b0e14;
  border-top: 1px solid var(--border-subtle);
  padding: 30px 24px;
  position: relative;
  z-index: 10;
}

.footer-content {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.footer-brand a {
  color: #fa5252;
  text-decoration: none;
  font-weight: 700;
}

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

.footer-note {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin: 0;
}

.back-to-top-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-top: 6px;
}

.back-to-top-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

/* ==========================================================================
   Media Queries & Responsive
   ========================================================================== */

@media (max-width: 900px) {
  .app-header {
    padding: 14px 18px 10px;
  }

  main {
    padding: 20px 16px 40px;
    gap: 18px;
  }

  .modal-main-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .modal-artwork-stage {
    height: 220px;
  }

  .modal-big-sprite {
    max-width: 190px;
    max-height: 190px;
  }

  .modal-nav-arrows {
    display: none;
  }

  .modal-body {
    padding: 20px 18px 24px;
  }
}

@media (max-width: 600px) {
  .header-top {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
    width: 100%;
  }

  .header-actions .control-group {
    flex: 1 1 calc(50% - 6px);
    min-width: 135px;
  }

  .select-wrapper {
    width: 100%;
  }

  .select-wrapper select {
    min-width: unset;
    width: 100%;
  }

  .header-btn-group {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 2px;
  }

  main {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .header-btn-group {
    justify-content: space-between;
  }

  .action-pill-btn {
    padding: 0 10px;
    font-size: 0.8rem;
    gap: 6px;
  }
}

/* ==========================================================================
   Action Pill Buttons (Random & Team in Header)
   ========================================================================== */

.action-pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0 14px;
  height: 40px;
  min-height: 40px;
  width: auto !important;
  min-width: max-content;
  white-space: nowrap;
  flex-shrink: 0;
  box-sizing: border-box;
  border-radius: 12px;
  font-family: var(--font-primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.action-pill-btn:hover {
  background: rgba(45, 60, 88, 0.85);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.action-pill-btn:active {
  transform: translateY(0);
}

.action-pill-btn .btn-emoji {
  font-size: 1.1rem;
}

.team-trigger-btn .badge-pill {
  background: var(--primary-accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: 0.5px;
}

/* ==========================================================================
   Filters & Sorting Toolbar
   ========================================================================== */

.filters-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: rgba(20, 26, 40, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
}

.sort-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.sort-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.compact-select select {
  padding: 6px 32px 6px 12px;
  font-size: 0.82rem;
  min-width: 190px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-main);
}

.attribute-chips-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0;
  scrollbar-width: none;
  flex: 1;
}

.attribute-chips-wrapper::-webkit-scrollbar {
  display: none;
}

.attr-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(30, 41, 59, 0.55);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  color: var(--text-muted);
  font-family: var(--font-primary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.attr-chip:hover {
  color: #fff;
  background: rgba(45, 60, 88, 0.75);
  border-color: rgba(255, 255, 255, 0.2);
}

.attr-chip.active {
  background: linear-gradient(135deg, rgba(238, 21, 21, 0.25), rgba(244, 63, 94, 0.35));
  border-color: rgba(244, 63, 94, 0.6);
  color: #fff;
  box-shadow: 0 0 14px rgba(238, 21, 21, 0.3);
}

.fav-chip .attr-count {
  background: rgba(234, 179, 8, 0.25);
  color: #facc15;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
}

/* ==========================================================================
   Card Top Actions: Favorites & Team Buttons
   ========================================================================== */

.card-actions-top {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  z-index: 5;
}

.card-action-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  color: var(--text-muted);
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0;
}

.card-action-btn:hover {
  background: rgba(30, 41, 59, 0.9);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.card-action-btn.fav-btn.active {
  color: #facc15;
  background: rgba(234, 179, 8, 0.2);
  border-color: rgba(234, 179, 8, 0.5);
  box-shadow: 0 0 10px rgba(234, 179, 8, 0.35);
  animation: starPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card-action-btn.team-btn.active {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.2);
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
}

@keyframes starPop {
  0% { transform: scale(0.7); }
  60% { transform: scale(1.3) rotate(15deg); }
  100% { transform: scale(1) rotate(0); }
}

/* ==========================================================================
   Modal Header Actions Bar (Favorite, Team, Share, Authentic Cry)
   ========================================================================== */

.modal-action-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.modal-btn-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 12px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-family: var(--font-primary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-btn-pill:hover {
  background: rgba(51, 65, 85, 0.8);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.modal-btn-pill.active-fav {
  background: rgba(234, 179, 8, 0.2);
  border-color: rgba(234, 179, 8, 0.5);
  color: #facc15;
}

.modal-btn-pill.active-team {
  background: rgba(56, 189, 248, 0.2);
  border-color: rgba(56, 189, 248, 0.5);
  color: #38bdf8;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #e2e8f0;
}

/* Sound wave playing animation */
.cry-btn.playing {
  animation: pulseGlow 0.8s infinite alternate;
}

@keyframes pulseGlow {
  0% { box-shadow: 0 0 8px rgba(238, 21, 21, 0.4); }
  100% { box-shadow: 0 0 22px rgba(238, 21, 21, 0.8); transform: scale(1.02); }
}

/* ==========================================================================
   Team Builder Drawer (Flyout / Bottom Sheet)
   ========================================================================== */

.team-drawer {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
}

.team-drawer:not([hidden]) {
  pointer-events: auto;
}

.team-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 15, 25, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.team-drawer:not([hidden]) .team-drawer-backdrop {
  opacity: 1;
}

.team-drawer-panel {
  position: relative;
  width: min(520px, 94vw);
  height: 100%;
  background: rgba(18, 24, 38, 0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-left: 1px solid var(--border-subtle);
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.6);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.team-drawer:not([hidden]) .team-drawer-panel {
  transform: translateX(0);
}

.team-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 16px;
}

.team-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.team-header-ball {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(180deg, #ee1515 50%, #f8fafc 50%);
  border: 2px solid #334155;
  box-shadow: 0 2px 8px rgba(238, 21, 21, 0.4);
}

.team-panel-title {
  margin: 0;
  font-family: var(--font-primary);
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
}

.team-panel-subtitle {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.team-panel-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.danger-pill-btn {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.danger-pill-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.6);
  color: #fff;
}

.drawer-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0 6px;
  line-height: 1;
  transition: color var(--transition-fast);
}

.drawer-close-btn:hover {
  color: #fff;
}

/* 6 Slots Grid */
.team-slots-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.team-slot-card {
  position: relative;
  background: rgba(30, 41, 59, 0.45);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all var(--transition-fast);
}

.team-slot-card:hover {
  background: rgba(45, 60, 88, 0.65);
  border-color: rgba(255, 255, 255, 0.2);
}

.team-slot-card.empty-slot {
  border: 2px dashed rgba(255, 255, 255, 0.12);
  background: transparent;
  justify-content: center;
  flex-direction: column;
  padding: 20px 12px;
  text-align: center;
}

.empty-pokeball-outline {
  width: 36px;
  height: 36px;
  opacity: 0.25;
  margin-bottom: 6px;
}

.empty-slot-text {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 600;
}

.team-slot-sprite {
  width: 58px;
  height: 58px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
  cursor: pointer;
}

.team-slot-info {
  flex: 1;
  min-width: 0;
}

.team-slot-name {
  margin: 0;
  font-family: var(--font-primary);
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.team-slot-types {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.team-slot-remove {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all var(--transition-fast);
}

.team-slot-remove:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

/* Team Analysis Block */
.team-analysis-block {
  background: rgba(20, 28, 44, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.team-analysis-title {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.team-metrics-row {
  display: flex;
  justify-content: space-around;
  background: rgba(15, 23, 42, 0.5);
  border-radius: 12px;
  padding: 10px;
}

.team-metric-item {
  text-align: center;
}

.team-metric-val {
  font-family: var(--font-primary);
  font-size: 1.2rem;
  font-weight: 800;
  color: #38bdf8;
}

.team-metric-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-top: 2px;
}

.team-coverage-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast-message {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(18, 24, 38, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-left: 4px solid var(--primary-accent);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-family: var(--font-primary);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  pointer-events: auto;
}

.toast-message.success {
  border-left-color: #22c55e;
}

.toast-message.warning {
  border-left-color: #f59e0b;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(16px) scale(0.95); }
}

/* ==========================================================================
   Accessibility: Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .pokemon-card {
    transform: none !important;
  }

  .card-foil {
    display: none !important;
  }

  dialog#pokemon-modal {
    transform: none !important;
  }
}
