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

:root {
  --bg: var(--ui-bg);
  --surface: var(--ui-surface);
  --surface2: var(--ui-surface-3);
  --border: var(--ui-border);
  --text: var(--ui-text);
  --muted: var(--ui-muted);
  --accent: var(--ui-accent);
  --accent2: var(--ui-accent-2);
  --radius: var(--ui-radius);
}

body { font-family: var(--ui-font); background: var(--bg); color: var(--text); min-height: calc(100vh - var(--ui-bar-h, 0px)); padding: 28px 16px 64px; }

header { text-align: center; margin-bottom: 32px; }
header h1 { font-size: 1.8rem; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 10px; }
.ball-icon { width: 32px; height: 32px; }
.accent { color: var(--accent2); }
.subtitle { color: var(--muted); font-size: .85rem; margin-top: 6px; }

main { max-width: 1100px; margin: 0 auto; }

/* Filters */
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filters input, .filters select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: .85rem;
  outline: none;
  flex: 1;
  min-width: 160px;
}
.filters input:focus, .filters select:focus { border-color: var(--accent); }

.stats-bar { font-size: .8rem; color: var(--muted); margin-bottom: 16px; }

/* Grid */
.poke-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.loader { grid-column: 1/-1; text-align: center; padding: 60px; color: var(--muted); font-size: .9rem; }

.poke-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: transform .15s, border-color .15s;
  position: relative;
}
.poke-card:hover { transform: translateY(-3px); border-color: rgba(255,255,255,.12); }
.poke-card .poke-id { font-size: .7rem; color: var(--muted); position: absolute; top: 10px; left: 12px; }
.poke-card img { width: 96px; height: 96px; image-rendering: pixelated; }
.poke-card .poke-name { font-weight: 600; font-size: .88rem; margin-top: 6px; text-transform: capitalize; }
.poke-card .poke-types { display: flex; gap: 4px; justify-content: center; margin-top: 8px; }

.type-badge {
  font-size: .65rem; font-weight: 600;
  padding: 2px 10px; border-radius: 99px;
  text-transform: capitalize; color: #fff;
}

/* Type Colors */
.type-normal   { background: #a8a878; } .type-fire     { background: #f08030; }
.type-water    { background: #6890f0; } .type-electric  { background: #f8d030; color: #333; }
.type-grass    { background: #78c850; } .type-ice       { background: #98d8d8; color: #333; }
.type-fighting { background: #c03028; } .type-poison    { background: #a040a0; }
.type-ground   { background: #e0c068; color: #333; } .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: #333; } .type-fairy { background: #ee99ac; }

/* Load More */
.btn-loadmore {
  display: block;
  margin: 28px auto 0;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 32px;
  border-radius: 10px;
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  transition: opacity .2s;
}
.btn-loadmore:hover { opacity: .85; }

/* Modal */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}
.modal-close {
  position: absolute; top: 14px; right: 14px;
  background: var(--surface2); border: none;
  color: var(--muted); width: 32px; height: 32px;
  border-radius: 50%; cursor: pointer; font-size: .9rem;
  z-index: 10;
}
.modal-close:hover { color: var(--text); }

.modal-body { padding: 28px; }
.modal-header { text-align: center; margin-bottom: 20px; }
.modal-header img { width: 140px; height: 140px; image-rendering: pixelated; }
.modal-header h2 { font-size: 1.4rem; text-transform: capitalize; margin-top: 8px; }
.modal-header .modal-id { color: var(--muted); font-size: .85rem; }
.modal-header .poke-types { display: flex; gap: 6px; justify-content: center; margin-top: 10px; }
.modal-header .type-badge { font-size: .75rem; padding: 4px 14px; }

.stat-grid { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 20px; }
.stat-row { display: flex; align-items: center; gap: 10px; }
.stat-name { width: 80px; font-size: .78rem; color: var(--muted); text-align: right; }
.stat-val { width: 32px; font-size: .82rem; font-weight: 600; text-align: right; }
.stat-bar-bg { flex: 1; height: 6px; background: var(--surface2); border-radius: 3px; overflow: hidden; }
.stat-bar { height: 100%; border-radius: 3px; transition: width .5s; }

.detail-section { margin-top: 18px; }
.detail-section h4 { font-size: .85rem; color: var(--muted); margin-bottom: 8px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.detail-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: .82rem; }
.detail-row .label { color: var(--muted); }

.evo-chain { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.evo-item { text-align: center; cursor: pointer; }
.evo-item img { width: 64px; height: 64px; image-rendering: pixelated; }
.evo-item span { display: block; font-size: .72rem; text-transform: capitalize; margin-top: 2px; }
.evo-arrow { color: var(--muted); font-size: 1rem; }

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

