:root {
  --bg: #0a0b0f;
  --ink: #f2f4f8;
  --muted: #9aa3b2;
  --card-border: rgba(255, 255, 255, 0.08);
  --chip: rgba(255, 255, 255, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: "Poppins", system-ui, sans-serif;
  color: var(--ink);
  background: radial-gradient(
      55vw 55vw at 82% -8%,
      rgba(99, 102, 180, 0.12),
      transparent 60%
    ),
    radial-gradient(50vw 50vw at -8% 112%, rgba(70, 150, 120, 0.1), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}

p {
  margin: 0;
  padding: 0;
}

/* ---------- Logo + search ---------- */
.search-area {
  margin-top: 34px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 22px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  user-select: none;
}

.logo-mark {
  width: 42px;
  height: 42px;
  filter: drop-shadow(0 6px 16px rgba(255, 167, 81, 0.35));
}

.logo-text {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.logo-accent {
  background: linear-gradient(135deg, #ffe259, #ffa751);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.search-bar {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 0 18px;
  height: 46px;
  width: 250px;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.search-bar::placeholder {
  color: var(--muted);
}

.search-bar:focus {
  border-color: #ffc93c;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 4px rgba(255, 201, 60, 0.15);
}

.search-bar:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Results grid ---------- */
.results-list {
  width: 100%;
  display: grid;
  /* Fixed-width columns that fill left-to-right; the whole track group is
     centered on screen. grid-auto-rows:1fr makes every row as tall as the
     tallest card, so all cards share a uniform height. */
  grid-template-columns: repeat(auto-fit, 244px);
  grid-auto-rows: 1fr;
  justify-content: center;
  gap: 26px;
  padding: 40px 24px 96px;
}

.results-list.is-centered {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 55vh;
}

.empty-results {
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 500;
  text-align: center;
}

/* ---------- Card ---------- */
.single-poke {
  --type-color: #888;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 20px 22px;
  border-radius: 22px;
  /* Per-type background: a faint full-card tint plus a stronger glow rising
     from the bottom, so each card clearly reads as its primary type. */
  background: radial-gradient(
      100% 78% at 50% 120%,
      color-mix(in srgb, var(--type-color) 70%, transparent),
      transparent 60%
    ),
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--type-color) 12%, #15161c) 0%,
      #111217 72%
    );
  border: 1px solid var(--card-border);
  box-shadow: 0 18px 40px -22px rgba(0, 0, 0, 0.9);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.single-poke:hover {
  transform: translateY(-5px);
  border-color: color-mix(in srgb, var(--type-color) 45%, var(--card-border));
  box-shadow: 0 26px 50px -24px rgba(0, 0, 0, 0.95);
}

.poke-img {
  width: auto;
  height: 132px;
  object-fit: contain;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.55));
}

.poke-name {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 14px 0 12px;
  font-size: 1.2rem;
  font-weight: 700;
}

.poke-name::before,
.poke-name::after {
  content: "•";
  color: var(--type-color);
  font-size: 1.1rem;
}

/* ---------- Type badges ---------- */
.type-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.type-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px 5px 7px;
  border-radius: 999px;
  background: var(--type-color);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  box-shadow: 0 5px 16px -6px var(--type-color);
}

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

/* ---------- Stats toggle button ---------- */
.stats-button {
  margin-top: 18px;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.12s;
}

.stats-button svg {
  width: 15px;
  height: 15px;
  color: var(--type-color);
}

.stats-button:hover {
  background: color-mix(in srgb, var(--type-color) 20%, transparent);
  border-color: color-mix(in srgb, var(--type-color) 55%, transparent);
}

.stats-button:active {
  transform: translateY(1px);
}

/* ---------- Weaknesses / resists & stats (toggled) ---------- */
.weak-resist {
  width: 100%;
  margin-top: 16px;
  text-align: left;
}

.weak-resist[hidden],
.stats[hidden] {
  display: none;
}

.sub-title {
  margin-top: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.weaknesses,
.resistances {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 7px;
}

.w-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px 3px 4px;
  border-radius: 999px;
  background: var(--chip);
  font-size: 12px;
  font-weight: 600;
}

.none {
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Stats ---------- */
.stats {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 16px;
}

.prog-bars {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stats-text {
  width: 32px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.stats-value {
  width: 28px;
  text-align: right;
  font-size: 12px;
  font-weight: 600;
}

progress.stat-bar {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 8px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

progress.stat-bar::-webkit-progress-bar {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
}

progress.stat-bar::-webkit-progress-value {
  background: var(--type-color);
  border-radius: 999px;
}

progress.stat-bar::-moz-progress-bar {
  background: var(--type-color);
  border-radius: 999px;
}

/* ---------- Footer ---------- */
footer {
  display: flex;
  justify-content: center;
  width: 100%;
  background: rgba(10, 11, 15, 0.8);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--card-border);
  position: fixed;
  bottom: 0;
  padding: 12px 0;
  z-index: 100;
}

footer p {
  font-size: 0.82rem;
  color: var(--muted);
}

/* ---------- Per-type accent colors ---------- */
.bug      { --type-color: #83c300; }
.dark     { --type-color: #5b5466; }
.dragon   { --type-color: #006fc9; }
.electric { --type-color: #fbd100; }
.fairy    { --type-color: #fb89eb; }
.fighting { --type-color: #e0306a; }
.fire     { --type-color: #ff9741; }
.flying   { --type-color: #89aae3; }
.ghost    { --type-color: #4c6ab2; }
.grass    { --type-color: #38bf4b; }
.ground   { --type-color: #e87236; }
.ice      { --type-color: #4cd1c0; }
.normal   { --type-color: #919aa2; }
.poison   { --type-color: #b567ce; }
.psychic  { --type-color: #ff6675; }
.rock     { --type-color: #c8b686; }
.steel    { --type-color: #5a8ea2; }
.water    { --type-color: #3692dc; }

/* ---------- Responsive ---------- */
@media only screen and (max-width: 600px) {
  .search-area {
    flex-direction: column;
    gap: 16px;
  }

  .results-list {
    grid-template-columns: minmax(0, 360px);
    gap: 20px;
    padding: 28px 16px 96px;
  }
}
