@import url("https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Press+Start+2P&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family: "Orbitron", monospace;
  background: linear-gradient(-45deg, #0a0a0a, #1a0033, #330033, #000011);
  background-size: 400% 400%;
  animation: gradientShift 8s ease infinite;
  color: #fff;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: saturate(1.2) blur(10px);
  background: rgba(0, 0, 0, 0.45);
  border-bottom: 2px solid #bb86fc44;
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: center;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
}
.brand img {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 0 6px rgba(187, 134, 252, 0.5));
}
.brand strong {
  letter-spacing: 0.6px;
  font-family: "Press Start 2P", cursive;
  font-size: 0.9rem;
  color: #bb86fc;
}

.controls {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
#searchInput {
  width: 260px;
  max-width: 70vw;
  padding: 10px 12px;
  border-radius: 16px;
  border: 2px solid #bb86fc66;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  outline: none;
}
#searchInput:focus {
  border-color: #03dac6;
  box-shadow: 0 0 20px rgba(3, 218, 198, 0.35);
}

.btn,
.back-btn {
  padding: 10px 14px;
  border-radius: 16px;
  border: 2px solid #bb86fc66;
  cursor: pointer;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.35));
  color: #fff;
  font-family: "Orbitron", monospace;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 15px rgba(187, 134, 252, 0.25);
  transition: 0.2s;
  text-decoration: none;
}
.btn:hover,
.back-btn:hover {
  border-color: #03dac6;
  box-shadow: 0 8px 20px rgba(3, 218, 198, 0.25);
  transform: translateY(-2px);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  border: 2px solid #bb86fc55;
  font-size: 12px;
  color: #03dac6;
}

.wrap {
  max-width: 1200px;
  margin: 18px auto 64px;
  padding: 0 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}
.card {
  background: linear-gradient(
    145deg,
    rgba(0, 0, 0, 0.6),
    rgba(187, 134, 252, 0.12)
  );
  border: 2px solid #bb86fc55;
  border-radius: 18px;
  overflow: hidden;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease,
    border-color 0.15s ease;
  text-decoration: none;
  color: inherit;
}
.card:hover {
  transform: translateY(-3px);
  border-color: #03dac6;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}
.thumb {
  display: grid;
  place-items: center;
  height: 120px;
  background: radial-gradient(
    200px 120px at 50% 65%,
    rgba(187, 134, 252, 0.15),
    transparent 60%
  );
}
.thumb img {
  max-width: 100%;
  max-height: 110px;
  object-fit: contain;
  image-rendering: high-quality;
}
.meta {
  padding: 10px 12px 12px;
}
.name {
  font-weight: 800;
  letter-spacing: 0.3px;
  font-size: 14px;
  text-transform: capitalize;
  color: #fff;
  text-shadow: 1px 1px 0 #000;
}
.id {
  font-size: 12px;
  color: #03dac6;
  opacity: 0.9;
}

.status {
  display: flex;
  justify-content: center;
  padding: 16px;
  color: #bb86fc;
  font-family: "Orbitron", monospace;
}
.footer-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
}

#loading {
  text-align: center;
  margin: 24px 0;
}
.spinner {
  width: 60px;
  height: 60px;
  margin: 0 auto 12px;
  border: 4px solid rgba(187, 134, 252, 0.3);
  border-top: 4px solid #bb86fc;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% {
    transform: rotate(0);
  }
  100% {
    transform: rotate(360deg);
  }
}
#loading p {
  font-size: 1rem;
  color: #03dac6;
  font-weight: bold;
}

/* HORIZONTAL DETAIL CARD */
#pokemonCard {
  background: linear-gradient(
    135deg,
    rgba(0, 0, 0, 0.7),
    rgba(187, 134, 252, 0.15)
  );
  backdrop-filter: blur(15px);
  border: 3px solid #bb86fc;
  border-radius: 25px;
  padding: 32px;
  margin: 0 auto 20px;
  max-width: 1000px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
  align-items: start;
}

.pokemon-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

#pokemonName {
  font-family: "Press Start 2P", cursive;
  font-size: 1.5rem;
  color: #bb86fc;
  text-align: center;
  text-shadow: 2px 2px 0 #000;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

#pokemonImage {
  width: 240px;
  height: 240px;
  display: block;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.5));
  transition: 0.25s;
  animation: bounce 2s ease-in-out infinite;
  object-fit: contain;
  image-rendering: high-quality;
}

@keyframes bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-8px);
  }
  60% {
    transform: translateY(-4px);
  }
}

.pokemon-right {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

.info-item {
  background: rgba(0, 0, 0, 0.4);
  padding: 12px 16px;
  border-radius: 12px;
  border-left: 4px solid #03dac6;
  transition: all 0.3s ease;
}

.info-item:hover {
  background: rgba(3, 218, 198, 0.2);
  transform: translateX(5px);
  border-left-color: #bb86fc;
}

.info-item strong {
  display: block;
  color: #03dac6;
  font-size: 0.85rem;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-item span {
  font-size: 1rem;
  color: #fff;
}

.stats-section {
  margin-top: 8px;
}

.stats-section h3 {
  font-family: "Press Start 2P", cursive;
  font-size: 1rem;
  color: #cf6679;
  margin-bottom: 12px;
  text-shadow: 1px 1px 0 #000;
}

#pokemonStats {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 8px;
}

#pokemonStats li {
  position: relative;
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid #333;
  border-radius: 12px;
  padding: 10px 16px;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s ease;
}

#pokemonStats li:hover {
  border-color: #03dac6;
  transform: scale(1.02);
}

#pokemonStats li::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, #cf6679, #bb86fc, #03dac6);
  border-radius: 10px;
  width: var(--stat-width, 0%);
  z-index: 0;
  transition: width 1s ease;
  opacity: 0.5;
}

#pokemonStats li .stat-name,
#pokemonStats li .stat-value {
  position: relative;
  z-index: 1;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  font-weight: 700;
}

#pokemonStats li .stat-name {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#pokemonStats li .stat-value {
  font-size: 1rem;
  color: #03dac6;
}

.back-btn-container {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  margin-top: 8px;
}

/* EVOLUTION CARD */
#evolutionCard {
  background: linear-gradient(
    135deg,
    rgba(0, 0, 0, 0.7),
    rgba(3, 218, 198, 0.15)
  );
  backdrop-filter: blur(15px);
  border: 3px solid #03dac6;
  border-radius: 25px;
  padding: 32px;
  margin: 0 auto 24px;
  max-width: 1000px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

#evolutionCard h3 {
  font-family: "Press Start 2P", cursive;
  font-size: 1.2rem;
  color: #03dac6;
  text-align: center;
  margin-bottom: 24px;
  text-shadow: 2px 2px 0 #000;
}

#evolutionChain {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.evolution-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid #bb86fc55;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 140px;
}

.evolution-item:hover {
  transform: translateY(-5px) scale(1.05);
  border-color: #03dac6;
  box-shadow: 0 10px 25px rgba(3, 218, 198, 0.3);
}

.evolution-item img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.5));
}

.evolution-item p {
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  text-transform: capitalize;
  text-shadow: 1px 1px 2px #000;
}

.evolution-item .evo-id {
  font-size: 0.8rem;
  color: #03dac6;
}

.evolution-arrow {
  font-size: 2.5rem;
  color: #bb86fc;
  font-weight: 900;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  animation: pulse 2s ease-in-out infinite;
  display: flex;
  align-items: center;
  justify-content: center;
}

.evolution-arrow.vertical {
  font-size: 2rem;
  transform: none;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.7;
  }
}

.hidden {
  display: none;
}

@media (max-width: 768px) {
  #pokemonCard {
    grid-template-columns: 1fr;
    padding: 24px 20px;
    gap: 20px;
  }

  .pokemon-left {
    margin: 0 auto;
  }

  #pokemonName {
    font-size: 1.2rem;
  }

  #pokemonImage {
    width: 180px;
    height: 180px;
  }

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

  #evolutionCard {
    padding: 24px 16px;
  }

  #evolutionChain {
    gap: 12px;
    flex-direction: column;
    align-items: center;
  }

  .evolution-item {
    min-width: 110px;
    padding: 12px;
  }

  .evolution-item img {
    width: 90px;
    height: 90px;
  }

  .evolution-arrow {
    font-size: 2rem;
    transform: none;
  }

  .evolution-arrow.vertical {
    transform: none;
  }
}

@media (max-width: 560px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }

  .wrap {
    padding: 0 12px;
  }
}

:root {
  --topbar-h: 72px;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--topbar-h);
}

#pokemonCard,
#evolutionCard {
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}