/* Reset-ish */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: #fff7e6;
  color: #222;
  line-height: 1.45;
}

/* Layout shell */
.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.hidden { display: none; }

/* Header */
.header { background: #ffcf33; border-bottom: 4px solid #f1b400; }
.title { margin: 0; padding: 16px 0 4px; font-size: 28px; }
.subtitle { margin: 0 0 12px; color: #5c4a00; }

/* Toolbar */
.toolbar { background: #ffe89c; border-bottom: 2px solid #f5d368; }
.search {
  width: 100%; max-width: 420px;
  padding: 12px 14px; margin: 14px 0;
  border: 2px solid #f1b400; border-radius: 12px;
  font-size: 16px; background: #fff;
}

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  padding: 18px 0 32px;
}
.card {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  background: #fff; border: 2px solid #ffd87a; border-radius: 16px;
  box-shadow: 0 2px 0 #f0c24d;
  padding: 10px; cursor: pointer;
  transition: transform .05s ease-in, box-shadow .05s ease-in;
}
.card:active { transform: translateY(1px); box-shadow: 0 1px 0 #e2b338; }
.card-art {
  width: 100%; aspect-ratio: 1 / 1; /* keeps squares */
  display: grid; place-items: center;
}
.card-art img {
  max-width: 100%; max-height: 100%;
  object-fit: contain; image-rendering: auto; display: block;
}
.card-name {
  margin-top: 8px; font-weight: 600; font-size: 14px; text-align: center; color: #332700;
}

/* Details panel */
.details {
  background: #fff; border: 3px solid #ffd87a; border-radius: 18px;
  padding: 16px; margin: 16px 0 6px;
  box-shadow: 0 4px 0 #f0c24d;
}
@media (min-width: 900px) {
  .details {
    display: grid; grid-template-columns: 280px 1fr; gap: 18px; align-items: start;
  }
}
.hero-art {
  width: 100%; max-width: 260px; height: auto; display: block; margin: 0 auto;
}

/* Type row */
.type-row { margin: 8px 0 6px; }
.type-icons { display: inline-flex; flex-wrap: wrap; gap: 8px; margin-left: 6px; }
.type-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fffaf0; border: 1.5px solid #ffd87a; border-radius: 999px;
  padding: 4px 8px;
}
.type-icon { width: 20px; height: 20px; display: inline-block; }
.type-name { font-weight: 600; font-size: 13px; }

/* Info text */
.details p { margin: 6px 0; }

/* Evolutions */
.evo-section { margin-top: 10px; }
.evo-title { font-weight: 700; margin: 8px 0 6px; }
.evo-row { display: flex; flex-wrap: wrap; gap: 10px; }
.evo-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; border: 2px solid #ffd87a; border-radius: 14px; padding: 6px 8px;
  cursor: pointer;
}
.evo-chip img { width: 36px; height: 36px; object-fit: contain; }
.evo-name { font-weight: 600; font-size: 14px; }

/* Moves */
.moves-section { margin-top: 12px; }
.moves-section h3 { margin: 10px 0 6px; }
.move-category { font-weight: 700; margin: 10px 0 6px; }
.move-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}
.move-card {
  display: grid; grid-template-columns: 26px 1fr; gap: 8px;
  align-items: center;
  background: #fff; border: 2px solid #ffe09e; border-radius: 12px;
  padding: 8px 10px;
}
.move-type-icon { width: 22px; height: 22px; }
.move-name { font-weight: 700; margin-bottom: 4px; }
.move-info { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-block; font-size: 12px; font-weight: 600;
  background: #fffaf0; border: 1.5px solid #ffd87a; border-radius: 999px;
  padding: 2px 8px;
}

/* Buttons */
.btn {
  appearance: none; border: none; background: #ffcf33; color: #2a2200;
  border-radius: 12px; padding: 10px 14px; font-weight: 700; cursor: pointer;
  box-shadow: 0 2px 0 #f0c24d; border: 2px solid #f1b400; margin-top: 12px;
}
.btn:active { transform: translateY(1px); box-shadow: 0 1px 0 #e2b338; }

/* Helpers */
.empty-hint { color: #7a6b3a; padding: 10px 0; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Helps performance on long lists */
.card { content-visibility: auto; contain-intrinsic-size: 180px 220px; }

/* Back-to-top floating button */
.back-to-top {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1000;
  background: #ffcf33;
  color: #2a2200;
  border: 2px solid #f1b400;
  border-radius: 999px;
  padding: 10px 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 0 #f0c24d;
}
.back-to-top.hidden { display: none; }
