:root {
  --bg-primary: #0f0f23;
  --bg-secondary: #1a1a2e;
  --bg-card: #16213e;
  --text-primary: #e0e0e0;
  --text-secondary: #a0a0b0;
  --accent: #e74c3c;
  --accent-hover: #c0392b;
  --border-color: #2a2a4a;
  --shadow: rgba(0, 0, 0, 0.4);
  --font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;

  /* Type colors */
  --type-normal: #A8A878;
  --type-fire: #F08030;
  --type-water: #6890F0;
  --type-electric: #F8D030;
  --type-grass: #78C850;
  --type-ice: #98D8D8;
  --type-fighting: #C03028;
  --type-poison: #A040A0;
  --type-ground: #E0C068;
  --type-flying: #A890F0;
  --type-psychic: #F85888;
  --type-bug: #A8B820;
  --type-rock: #B8A038;
  --type-ghost: #705898;
  --type-dragon: #7038F8;
  --type-dark: #705848;
  --type-steel: #B8B8D0;
  --type-fairy: #EE99AC;
}

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

html {
  overscroll-behavior: none;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
}

/* Header */
.header {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-bottom: 3px solid var(--accent);
  padding: 1.25rem 1rem;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 100;
  overflow: hidden;
}

.header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(231,76,60,0.05) 0%, transparent 60%);
  animation: headerGlow 8s ease-in-out infinite;
}

@keyframes headerGlow {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(20px, 10px); }
}

.header-content {
  position: relative;
  z-index: 1;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 0.35rem;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.logo h1 {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), #f39c12);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 2px;
}

.pokeball {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--accent) 50%, white 50%);
  position: relative;
  display: inline-block;
  animation: pokeballSpin 4s ease-in-out infinite;
  box-shadow: 0 0 20px rgba(231, 76, 60, 0.3);
}

.pokeball::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 4px;
  background: #333;
  transform: translateY(-50%);
}

.pokeball::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  background: white;
  border: 4px solid #333;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

@keyframes pokeballSpin {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(15deg); }
  75% { transform: rotate(-15deg); }
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  font-weight: 300;
}

/* Controls */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

.controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 250px;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
}

.search-box input {
  width: 100%;
  padding: 12px 14px 12px 44px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 1rem;
  transition: border-color 0.3s, box-shadow 0.3s;
  touch-action: manipulation;
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.2);
}

.search-box input::placeholder {
  color: var(--text-secondary);
}

.filter-box,
.generation-filter {
  min-width: 180px;
}

.filter-box select,
.generation-filter select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 1rem;
  cursor: pointer;
  transition: border-color 0.3s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a0a0b0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  touch-action: manipulation;
}

.filter-box select:focus,
.generation-filter select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Filter Toggle Button (in header) */
.filter-toggle {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 0.3s, background 0.3s;
}

.filter-toggle:hover,
.filter-toggle:focus {
  border-color: var(--accent);
  background: rgba(231, 76, 60, 0.15);
  outline: none;
}

/* Hide filter toggle on desktop, show only on mobile */
@media (min-width: 769px) {
  .filter-toggle {
    display: none !important;
  }
}

.filter-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
}

.filter-badge.hidden {
  display: none;
}

.desktop-only {
  display: flex;
}

/* Sidebar */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 300px;
  max-width: 85vw;
  height: 100%;
  background: var(--bg-secondary);
  z-index: 201;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border-color);
}

.sidebar.active {
  transform: translateX(0);
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
}

.sidebar-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.8rem;
  cursor: pointer;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  transition: background 0.2s, color 0.2s;
}

.sidebar-close:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--accent);
}

.sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-select {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 16px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a0a0b0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  touch-action: manipulation;
  transition: border-color 0.3s;
}

.sidebar-select:focus {
  outline: none;
  border-color: var(--accent);
}

.sidebar-apply {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: white;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.2s;
}

.sidebar-apply:hover {
  background: var(--accent-hover);
}

.sidebar-reset {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 0.3s, color 0.3s;
}

.sidebar-reset:hover {
  border-color: var(--accent);
  color: var(--accent);
}

body.sidebar-open {
  overflow: hidden;
}

.results-info {
  margin-bottom: 1rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* Pokemon Grid */
.pokemon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.5rem;
  min-height: 400px;
  position: relative;
}

/* Pokemon Card */
.pokemon-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 1.25rem;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid var(--border-color);
  animation: cardFadeIn 0.4s ease forwards;
  opacity: 0;
}

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

.pokemon-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 12px 40px var(--shadow);
}

.pokemon-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--card-accent, var(--accent));
  opacity: 0;
  transition: opacity 0.3s;
}

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

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.pokemon-id {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.05);
  padding: 2px 10px;
  border-radius: 20px;
}

.pokemon-name {
  font-size: 1.15rem;
  font-weight: 700;
  text-transform: capitalize;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pokemon-image-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 130px;
  position: relative;
}

.pokemon-image-wrapper::before {
  content: '';
  position: absolute;
  width: 100px;
  height: 100px;
  background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, transparent 70%);
  border-radius: 50%;
}

.pokemon-image {
  width: 120px;
  height: 120px;
  object-fit: contain;
  image-rendering: pixelated;
  transition: transform 0.4s ease;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
  position: relative;
  z-index: 1;
}

.pokemon-card:hover .pokemon-image {
  transform: scale(1.15) translateY(-4px);
  animation: pokemonBounce 0.6s ease;
}

@keyframes pokemonBounce {
  0% { transform: scale(1.15) translateY(-4px); }
  30% { transform: scale(1.2) translateY(-12px); }
  50% { transform: scale(1.15) translateY(-4px); }
  70% { transform: scale(1.18) translateY(-8px); }
  100% { transform: scale(1.15) translateY(-4px); }
}

.pokemon-types {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

.type-badge {
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Type Colors */
.type-normal { background: var(--type-normal); }
.type-fire { background: var(--type-fire); }
.type-water { background: var(--type-water); }
.type-electric { background: var(--type-electric); color: #333 !important; text-shadow: none !important; }
.type-grass { background: var(--type-grass); }
.type-ice { background: var(--type-ice); color: #333 !important; text-shadow: none !important; }
.type-fighting { background: var(--type-fighting); }
.type-poison { background: var(--type-poison); }
.type-ground { background: var(--type-ground); color: #333 !important; text-shadow: none !important; }
.type-flying { background: var(--type-flying); }
.type-psychic { background: var(--type-psychic); }
.type-bug { background: var(--type-bug); color: #333 !important; text-shadow: none !important; }
.type-rock { background: var(--type-rock); }
.type-ghost { background: var(--type-ghost); }
.type-dragon { background: var(--type-dragon); }
.type-dark { background: var(--type-dark); }
.type-steel { background: var(--type-steel); color: #333 !important; text-shadow: none !important; }
.type-fairy { background: var(--type-fairy); }

/* Card accent by primary type */
.pokemon-card[data-type="normal"] { --card-accent: var(--type-normal); }
.pokemon-card[data-type="fire"] { --card-accent: var(--type-fire); }
.pokemon-card[data-type="water"] { --card-accent: var(--type-water); }
.pokemon-card[data-type="electric"] { --card-accent: var(--type-electric); }
.pokemon-card[data-type="grass"] { --card-accent: var(--type-grass); }
.pokemon-card[data-type="ice"] { --card-accent: var(--type-ice); }
.pokemon-card[data-type="fighting"] { --card-accent: var(--type-fighting); }
.pokemon-card[data-type="poison"] { --card-accent: var(--type-poison); }
.pokemon-card[data-type="ground"] { --card-accent: var(--type-ground); }
.pokemon-card[data-type="flying"] { --card-accent: var(--type-flying); }
.pokemon-card[data-type="psychic"] { --card-accent: var(--type-psychic); }
.pokemon-card[data-type="bug"] { --card-accent: var(--type-bug); }
.pokemon-card[data-type="rock"] { --card-accent: var(--type-rock); }
.pokemon-card[data-type="ghost"] { --card-accent: var(--type-ghost); }
.pokemon-card[data-type="dragon"] { --card-accent: var(--type-dragon); }
.pokemon-card[data-type="dark"] { --card-accent: var(--type-dark); }
.pokemon-card[data-type="steel"] { --card-accent: var(--type-steel); }
.pokemon-card[data-type="fairy"] { --card-accent: var(--type-fairy); }

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2rem;
  padding: 1rem 0;
  flex-wrap: wrap;
}

.page-btn {
  padding: 8px 16px;
  border: 2px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s;
  min-width: 44px;
  min-height: 44px;
  text-align: center;
  touch-action: manipulation;
}

.page-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: rgba(231, 76, 60, 0.15);
  color: var(--accent);
}

.page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

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

/* Loading */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: var(--bg-primary);
  z-index: 10;
}

.pokeball-loader {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--accent) 50%, white 50%);
  position: relative;
  animation: loaderBounce 1s ease-in-out infinite;
  box-shadow: 0 4px 20px rgba(231, 76, 60, 0.4);
}

.pokeball-loader::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 5px;
  background: #333;
  transform: translateY(-50%);
}

.pokeball-loader::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  background: white;
  border: 5px solid #333;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

@keyframes loaderBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}

.loading-overlay p {
  margin-top: 1rem;
  color: var(--text-secondary);
  font-size: 1rem;
}

/* No Results */
.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary);
}

.no-results h3 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.no-results p {
  font-size: 1rem;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 1rem;
  animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 2rem;
  max-width: 500px;
  width: 100%;
  position: relative;
  border: 1px solid var(--border-color);
  animation: modalSlideIn 0.3s ease;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

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

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.8rem;
  cursor: pointer;
  transition: color 0.2s;
  line-height: 1;
}

.modal-close:hover {
  color: var(--accent);
}

.modal-drag-handle {
  display: none;
}

.modal-pokemon-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.modal-pokemon-header .pokemon-image {
  width: 160px;
  height: 160px;
  animation: modalPokemonFloat 3s ease-in-out infinite;
}

@keyframes modalPokemonFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.modal-pokemon-header h2 {
  font-size: 1.8rem;
  text-transform: capitalize;
  margin: 0.5rem 0 0.25rem;
}

.modal-pokemon-header .pokemon-id {
  font-size: 1rem;
  display: inline-block;
}

.modal-stats {
  margin-top: 1.5rem;
}

.modal-stats h3 {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.85rem;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.stat-name {
  width: 110px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: capitalize;
}

.stat-bar-bg {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  overflow: hidden;
}

.stat-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s ease;
  background: var(--accent);
}

.stat-value {
  width: 35px;
  text-align: right;
  font-size: 0.85rem;
  font-weight: 700;
}

.modal-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.5rem;
}

.detail-item {
  text-align: center;
  padding: 0.75rem;
  background: rgba(255,255,255,0.03);
  border-radius: 12px;
}

.detail-item label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.25rem;
}

.detail-item span {
  font-size: 1rem;
  font-weight: 700;
  text-transform: capitalize;
}

/* Sprites Gallery */
.sprites-gallery {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.sprites-gallery img {
  width: 60px;
  height: 60px;
  image-rendering: pixelated;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  padding: 4px;
  transition: transform 0.2s;
}

.sprites-gallery img:hover {
  transform: scale(1.2);
}

/* Footer */
.footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
  border-top: 1px solid var(--border-color);
  margin-top: 2rem;
}

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

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

/* Responsive — Tablet */
@media (max-width: 768px) {
  .header {
    padding: 1.25rem 0.75rem;
  }

  .logo {
    gap: 0.75rem;
  }

  .logo h1 {
    font-size: 1.6rem;
    letter-spacing: 1px;
  }

  .pokeball {
    width: 36px;
    height: 36px;
  }

  .pokeball::after {
    width: 12px;
    height: 12px;
    border-width: 3px;
  }

  .pokeball::before {
    height: 3px;
  }

  .subtitle {
    font-size: 0.95rem;
  }

  .container {
    padding: 1rem 0.75rem;
  }

  .controls {
    flex-direction: column;
    gap: 0.75rem;
  }

  .desktop-only {
    display: none !important;
  }

  .search-box,
  .filter-box,
  .generation-filter {
    min-width: 100%;
  }

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

  .pokemon-card {
    padding: 0.75rem;
    border-radius: 12px;
  }

  .pokemon-image-wrapper {
    height: 100px;
  }

  .pokemon-image {
    width: 90px;
    height: 90px;
  }

  .pokemon-name {
    font-size: 1rem;
  }

  .pokemon-id {
    font-size: 0.75rem;
    padding: 2px 8px;
  }

  .type-badge {
    font-size: 0.65rem;
    padding: 3px 10px;
  }

  .pagination {
    gap: 0.35rem;
    margin-top: 1.5rem;
  }

  .page-btn {
    padding: 10px 12px;
    font-size: 0.8rem;
    min-width: 40px;
  }

  .page-info {
    margin: 0 0.25rem;
    font-size: 0.8rem;
  }

  .modal-content {
    border-radius: 16px;
    padding: 1.5rem;
    max-height: 85vh;
  }

  .modal-close {
    top: 8px;
    right: 12px;
    font-size: 2rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .modal-pokemon-header .pokemon-image {
    width: 130px;
    height: 130px;
  }

  .modal-pokemon-header h2 {
    font-size: 1.4rem;
  }

  .stat-name {
    width: 80px;
    font-size: 0.75rem;
  }

  .stat-value {
    font-size: 0.75rem;
    width: 30px;
  }

  .stat-bar-bg {
    height: 6px;
  }

  .modal-details {
    gap: 0.75rem;
  }

  .detail-item {
    padding: 0.5rem;
  }

  .detail-item label {
    font-size: 0.65rem;
  }

  .detail-item span {
    font-size: 0.85rem;
  }

  .sprites-gallery img {
    width: 50px;
    height: 50px;
  }

  .footer {
    padding: 1rem;
    font-size: 0.8rem;
  }
}

/* Responsive — Phone */
@media (max-width: 480px) {
  .header {
    padding: 1rem 0.5rem;
  }

  .logo h1 {
    font-size: 1.35rem;
  }

  .pokeball {
    width: 30px;
    height: 30px;
  }

  .pokeball::after {
    width: 10px;
    height: 10px;
    border-width: 2px;
  }

  .pokeball::before {
    height: 2px;
  }

  .subtitle {
    font-size: 0.8rem;
  }

  .container {
    padding: 0.75rem 0.5rem;
  }

  .search-box input {
    padding: 14px 14px 14px 40px;
    font-size: 16px;
    border-radius: 10px;
  }

  .search-icon {
    width: 18px;
    height: 18px;
  }

  .filter-box select,
  .generation-filter select {
    padding: 14px 14px;
    font-size: 16px;
    border-radius: 10px;
  }

  .results-info {
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
  }

  .pokemon-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .pokemon-card {
    padding: 0.6rem 0.5rem;
    border-radius: 10px;
  }

  .pokemon-image-wrapper {
    height: 80px;
  }

  .pokemon-image {
    width: 72px;
    height: 72px;
  }

  .pokemon-name {
    font-size: 0.9rem;
    margin-bottom: 0.15rem;
  }

  .pokemon-id {
    font-size: 0.7rem;
    padding: 1px 6px;
  }

  .pokemon-types {
    margin-top: 0.5rem;
    gap: 0.35rem;
  }

  .type-badge {
    font-size: 0.6rem;
    padding: 2px 8px;
  }

  .pagination {
    gap: 0.25rem;
    margin-top: 1rem;
  }

  .page-btn {
    padding: 10px 10px;
    font-size: 0.75rem;
    min-width: 38px;
    border-radius: 8px;
  }

  .page-info {
    margin: 0 0.15rem;
    font-size: 0.75rem;
  }

  .modal {
    padding: 0;
    align-items: flex-end;
  }

  .modal-content {
    border-radius: 20px 20px 0 0;
    max-height: 92vh;
    padding: 1.25rem 1rem;
    max-width: 100%;
    animation: modalSlideUp 0.3s ease;
  }

  @keyframes modalSlideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }

  .modal-drag-handle {
    display: block;
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin: 0 auto 0.75rem;
  }

  .modal-close {
    top: 6px;
    right: 8px;
    font-size: 1.8rem;
  }

  .modal-pokemon-header {
    margin-bottom: 1rem;
  }

  .modal-pokemon-header .pokemon-image {
    width: 110px;
    height: 110px;
  }

  .modal-pokemon-header h2 {
    font-size: 1.2rem;
  }

  .modal-pokemon-header .pokemon-id {
    font-size: 0.85rem;
  }

  .modal-stats {
    margin-top: 1rem;
  }

  .modal-stats h3 {
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
  }

  .stat-row {
    gap: 0.5rem;
    margin-bottom: 0.4rem;
  }

  .stat-name {
    width: 65px;
    font-size: 0.7rem;
  }

  .stat-bar-bg {
    height: 5px;
  }

  .stat-value {
    font-size: 0.7rem;
    width: 26px;
  }

  .modal-details {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-top: 1rem;
  }

  .detail-item {
    padding: 0.5rem 0.25rem;
    border-radius: 8px;
  }

  .detail-item label {
    font-size: 0.6rem;
    letter-spacing: 0.5px;
    margin-bottom: 0.15rem;
  }

  .detail-item span {
    font-size: 0.8rem;
  }

  .sprites-gallery {
    margin-top: 0.75rem;
    gap: 0.35rem;
  }

  .sprites-gallery img {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    padding: 2px;
  }

  .footer {
    padding: 0.75rem;
    font-size: 0.75rem;
    margin-top: 1rem;
  }

  .no-results {
    padding: 2rem 1rem;
  }

  .no-results h3 {
    font-size: 1.2rem;
  }

  .no-results p {
    font-size: 0.9rem;
  }
}

/* Touch device — disable sticky hover */
@media (hover: none) {
  .pokemon-card:hover {
    transform: none;
    box-shadow: none;
  }

  .pokemon-card:hover::before {
    opacity: 0;
  }

  .pokemon-card:active {
    transform: scale(0.97);
  }

  .pokemon-card:hover .pokemon-image {
    transform: none;
    animation: none;
  }

  .sprites-gallery img:hover {
    transform: none;
  }
}
