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

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(145deg, #f5f7fa 0%, #e4e8ec 100%);
  color: #222;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  text-align: center;
}

/* Header */
h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 2rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

/* Primary button */
#discover-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border: none;
  padding: 1rem 2.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: 50px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

#discover-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

#discover-btn:active {
  transform: translateY(0);
}

#discover-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Pokemon card */
#pokemon-card {
  margin-top: 2.5rem;
  background: #fff;
  border-radius: 24px;
  padding: 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  transition: background 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
  animation: cardIn 0.4s ease-out;
}

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

/* Type-themed card backgrounds */
#pokemon-card.theme-normal { background: linear-gradient(145deg, #fff 0%, #d4d4a8 100%); }
#pokemon-card.theme-fire { background: linear-gradient(145deg, #fff 0%, #fcd5b5 100%); }
#pokemon-card.theme-water { background: linear-gradient(145deg, #fff 0%, #c5d7f7 100%); }
#pokemon-card.theme-electric { background: linear-gradient(145deg, #fff 0%, #fcf0b5 100%); }
#pokemon-card.theme-grass { background: linear-gradient(145deg, #fff 0%, #c5e8b5 100%); }
#pokemon-card.theme-ice { background: linear-gradient(145deg, #fff 0%, #d5f0f0 100%); }
#pokemon-card.theme-fighting { background: linear-gradient(145deg, #fff 0%, #e8c5c5 100%); }
#pokemon-card.theme-poison { background: linear-gradient(145deg, #fff 0%, #dcc5dc 100%); }
#pokemon-card.theme-ground { background: linear-gradient(145deg, #fff 0%, #f0e0c0 100%); }
#pokemon-card.theme-flying { background: linear-gradient(145deg, #fff 0%, #d8d0f8 100%); }
#pokemon-card.theme-psychic { background: linear-gradient(145deg, #fff 0%, #fcc8d8 100%); }
#pokemon-card.theme-bug { background: linear-gradient(145deg, #fff 0%, #d8dc98 100%); }
#pokemon-card.theme-rock { background: linear-gradient(145deg, #fff 0%, #e0d8a8 100%); }
#pokemon-card.theme-ghost { background: linear-gradient(145deg, #fff 0%, #c8c0d8 100%); }
#pokemon-card.theme-dragon { background: linear-gradient(145deg, #fff 0%, #c0a8f8 100%); }
#pokemon-card.theme-dark { background: linear-gradient(145deg, #fff 0%, #c8c0b8 100%); }
#pokemon-card.theme-steel { background: linear-gradient(145deg, #fff 0%, #d8d8e8 100%); }
#pokemon-card.theme-fairy { background: linear-gradient(145deg, #fff 0%, #f8d0dc 100%); }

#pokemon-sprite {
  width: 200px;
  height: 200px;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.1));
}

#pokemon-name {
  font-size: 2rem;
  font-weight: 700;
  text-transform: capitalize;
  margin: 0.5rem 0 0.25rem;
  color: #1a1a2e;
}

#pokemon-number {
  color: #888;
  font-size: 1rem;
  font-weight: 500;
}

/* Type badges */
#pokemon-types {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin: 1.25rem 0;
}

.type-badge {
  padding: 0.35rem 1rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #fff;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

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

/* Stats */
#stats-container {
  margin: 1.5rem 0;
  text-align: left;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  padding: 1rem 1.25rem;
}

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

.stat-row:last-child {
  margin-bottom: 0;
}

.stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-bar {
  height: 10px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 5px;
  overflow: hidden;
}

.stat-fill {
  height: 100%;
  background: #222;
  border-radius: 5px;
  transition: width 0.4s ease-out, background 0.3s ease;
}

/* Type-themed stat bars */
.theme-normal .stat-fill { background: #A8A878; }
.theme-fire .stat-fill { background: #F08030; }
.theme-water .stat-fill { background: #6890F0; }
.theme-electric .stat-fill { background: #D4B000; }
.theme-grass .stat-fill { background: #78C850; }
.theme-ice .stat-fill { background: #70C8C8; }
.theme-fighting .stat-fill { background: #C03028; }
.theme-poison .stat-fill { background: #A040A0; }
.theme-ground .stat-fill { background: #C8A848; }
.theme-flying .stat-fill { background: #A890F0; }
.theme-psychic .stat-fill { background: #F85888; }
.theme-bug .stat-fill { background: #A8B820; }
.theme-rock .stat-fill { background: #B8A038; }
.theme-ghost .stat-fill { background: #705898; }
.theme-dragon .stat-fill { background: #7038F8; }
.theme-dark .stat-fill { background: #705848; }
.theme-steel .stat-fill { background: #8888A8; }
.theme-fairy .stat-fill { background: #E87890; }

.stat-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: #333;
  text-align: right;
}

/* Expand/collapse buttons */
.expand-btn {
  background: none;
  border: none;
  color: #667eea;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.5rem 1rem;
  margin-top: 0.75rem;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
}

.expand-btn:hover {
  background: rgba(102, 126, 234, 0.1);
  color: #5a6fd6;
}

/* Expanded info */
#expanded-info {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  text-align: left;
  animation: fadeIn 0.3s ease-out;
}

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

#pokemon-genus {
  font-style: italic;
  color: #555;
  margin-bottom: 1rem;
  text-align: center;
  font-size: 1.05rem;
}

#pokemon-abilities h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 0.5rem;
  letter-spacing: 0.5px;
}

#abilities-list {
  list-style: none;
  margin-bottom: 1.25rem;
}

#abilities-list li {
  text-transform: capitalize;
  margin-bottom: 0.3rem;
  color: #333;
}

#pokemon-flavor {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #444;
  background: rgba(255, 255, 255, 0.5);
  padding: 1rem;
  border-radius: 12px;
}

#less-btn {
  display: block;
  margin: 1rem auto 0;
}

/* Error message */
#error-message {
  margin-top: 1.5rem;
  color: #e74c3c;
  font-size: 0.95rem;
  font-weight: 500;
}

/* Footer */
footer {
  padding: 1.5rem;
  text-align: center;
  color: #888;
  font-size: 0.85rem;
}

footer a {
  color: #667eea;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

footer a:hover {
  color: #5a6fd6;
  text-decoration: underline;
}

/* Sprite container and controls */
#sprite-container {
  position: relative;
}

#sprite-controls {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.icon-btn {
  background: rgba(0, 0, 0, 0.06);
  border: none;
  padding: 0.4rem 0.8rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 20px;
  cursor: pointer;
  color: #555;
  transition: background 0.2s, color 0.2s, transform 0.1s;
}

.icon-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #333;
}

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

.icon-btn.active {
  background: #667eea;
  color: #fff;
}

/* Evolution chain */
#evolution-chain {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

#evolution-chain h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 0.75rem;
  letter-spacing: 0.5px;
}

#evolution-sprites {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.evo-pokemon {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 12px;
  transition: background 0.2s;
}

.evo-pokemon:hover {
  background: rgba(0, 0, 0, 0.05);
}

.evo-pokemon.current {
  background: rgba(102, 126, 234, 0.1);
}

.evo-pokemon img {
  width: 60px;
  height: 60px;
  object-fit: contain;
}

.evo-pokemon span {
  font-size: 0.7rem;
  color: #666;
  text-transform: capitalize;
  margin-top: 0.25rem;
}

.evo-arrow {
  color: #aaa;
  font-size: 1.25rem;
}

/* Type effectiveness */
#type-effectiveness {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

#type-effectiveness h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 0.75rem;
  letter-spacing: 0.5px;
}

#weaknesses, #resistances, #immunities {
  margin-bottom: 0.75rem;
}

.effectiveness-label {
  font-size: 0.7rem;
  color: #888;
  text-transform: uppercase;
  display: block;
  margin-bottom: 0.4rem;
}

#weakness-types, #resistance-types, #immunity-types {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.eff-badge {
  padding: 0.2rem 0.5rem;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #fff;
}

.eff-badge.super {
  box-shadow: 0 0 0 2px rgba(255, 0, 0, 0.3);
}

/* Moves section */
#moves-section {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

#moves-section h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 0.75rem;
  letter-spacing: 0.5px;
}

#moves-count {
  font-weight: 400;
  color: #aaa;
}

#moves-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  max-height: 150px;
  overflow-y: auto;
}

.move-badge {
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  font-size: 0.7rem;
  background: rgba(0, 0, 0, 0.06);
  color: #444;
  text-transform: capitalize;
}

/* Copied toast */
#copy-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-size: 0.9rem;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

#copy-toast.show {
  opacity: 1;
}

/* Utility */
.hidden {
  display: none;
}

/* Responsive */
@media (max-width: 480px) {
  h1 {
    font-size: 2rem;
  }

  #pokemon-card {
    padding: 1.5rem;
    margin-top: 2rem;
  }

  #pokemon-sprite {
    width: 160px;
    height: 160px;
  }

  #pokemon-name {
    font-size: 1.75rem;
  }
}
