/* Modification ChatGPT v4 : feuille complète responsive, conservée depuis v3 avec cache cassé par versionnement. */
:root {
  color-scheme: dark;
  --bg: #0e1220;
  --panel: #171d31;
  --panel-soft: #202842;
  --text: #f6f8ff;
  --muted: #aab4d6;
  --line: rgba(255, 255, 255, 0.13);
  --accent: #ffcb05;
  --blue: #3b82f6;
  --danger: #ff6b6b;
  --radius: 18px;
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.38);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at 15% -10%, #2a3c70 0, var(--bg) 32rem);
  color: var(--text);
}
button, input, select { font: inherit; }
button { color: inherit; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-height: 68px;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(14, 18, 32, 0.9);
  backdrop-filter: blur(16px);
}
.header-title { min-width: 0; }
.app-header h1 { margin: 0; font-size: clamp(1.15rem, 2.2vw, 1.75rem); white-space: nowrap; }
.eyebrow { margin: 0 0 0.1rem; color: var(--accent); font-size: 0.72rem; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; }

.icon-button, .ghost-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  cursor: pointer;
}
.icon-button { width: 42px; height: 42px; font-size: 1.35rem; flex: 0 0 auto; }
.ghost-button { margin-left: auto; padding: 0.62rem 0.85rem; }
.icon-button:hover, .ghost-button:hover, .pokemon-card:hover { background: rgba(255,255,255,0.14); }

.app-shell {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  min-height: calc(100vh - 68px);
}
.sidebar {
  position: sticky;
  top: 68px;
  height: calc(100vh - 68px);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
  border-right: 1px solid var(--line);
  background: rgba(23, 29, 49, 0.95);
  overflow: hidden;
}
.sidebar-section { display: grid; gap: 0.45rem; }
.sidebar label { color: var(--muted); font-size: 0.9rem; font-weight: 800; }
select, input[type="search"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #10162a;
  color: var(--text);
  padding: 0.74rem 0.85rem;
  outline: none;
}
select:focus, input[type="search"]:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59,130,246,0.22); }
.list-section { min-height: 0; flex: 1; }
.list-header { display: flex; align-items: center; justify-content: space-between; gap: 0.7rem; }
.list-header h2 { margin: 0; font-size: 1rem; }
.badge { min-width: 2rem; text-align: center; padding: 0.2rem 0.55rem; border-radius: 999px; background: var(--accent); color: #1f2937; font-weight: 900; }
.status { margin: 0; color: var(--muted); font-size: 0.88rem; }
.status.error, .error { color: var(--danger); }
.pokemon-list { min-height: 0; overflow: auto; display: grid; gap: 0.45rem; padding-right: 0.2rem; }
.pokemon-card {
  display: grid;
  grid-template-columns: 4.1rem 44px minmax(0, 1fr);
  align-items: center;
  gap: 0.62rem;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,0.055);
  padding: 0.45rem 0.55rem;
  text-align: left;
  cursor: pointer;
}
.pokemon-card.active { border-color: var(--accent); background: rgba(255,203,5,0.13); }
.dex-number { color: var(--muted); font-weight: 900; }
.mini-sprite { width: 44px; height: 44px; object-fit: contain; image-rendering: pixelated; }
.pokemon-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 850; }

.detail-panel { min-width: 0; padding: clamp(1rem, 3vw, 2rem); }
.details-empty { min-height: calc(100vh - 108px); display: grid; place-items: center; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); text-align: center; padding: 2rem; }
.pokemon-detail { display: grid; gap: 1rem; }
.hero-card, .info-card { border: 1px solid var(--line); border-radius: var(--radius); background: rgba(23,29,49,0.9); box-shadow: var(--shadow); }
.hero-card { display: grid; grid-template-columns: minmax(150px, 260px) minmax(0, 1fr); gap: clamp(1rem, 3vw, 2rem); padding: clamp(1rem, 3vw, 2rem); align-items: center; }
.main-art { width: 100%; max-height: 260px; object-fit: contain; image-rendering: pixelated; border-radius: var(--radius); background: radial-gradient(circle, rgba(255,255,255,0.14), rgba(255,255,255,0.035)); }
.detail-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.75rem; }
.detail-title h2 { margin: 0; font-size: clamp(2rem, 5vw, 4rem); }
.detail-title span { color: var(--muted); font-weight: 900; font-size: 1.15rem; }
.meta-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.pill { border: 1px solid var(--line); border-radius: 999px; padding: 0.35rem 0.65rem; background: rgba(255,255,255,0.07); font-weight: 750; }
.info-card { padding: clamp(1rem, 2vw, 1.4rem); }
.info-card h3 { margin: 0 0 1rem; }
.sprite-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.sprite-toolbar select { max-width: 280px; }
.sprite-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 0.8rem; }
.sprite-tile { display: grid; place-items: center; gap: 0.4rem; min-height: 146px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,0.045); padding: 0.75rem; text-align: center; }
.sprite-tile img { width: 96px; height: 96px; object-fit: contain; image-rendering: pixelated; }
.sprite-tile span { color: var(--muted); font-size: 0.82rem; }
.evolution-chain { display: grid; gap: 0.75rem; }
.evo-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.evo-name { font-weight: 900; }
.evo-method { color: var(--muted); }
.sidebar-backdrop { display: none; }

@media (max-width: 860px) {
  .app-shell { display: block; }
  .sidebar {
    position: fixed;
    z-index: 60;
    top: 68px;
    left: 0;
    width: min(88vw, 380px);
    transform: translateX(-105%);
    transition: transform 190ms ease;
    box-shadow: var(--shadow);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop { display: block; position: fixed; inset: 68px 0 0; z-index: 55; border: 0; background: rgba(0,0,0,0.48); }
  body:not(.sidebar-open) .sidebar-backdrop { display: none; }
  .hero-card { grid-template-columns: 1fr; }
  .main-art { max-height: 210px; }
  .ghost-button { padding: 0.55rem 0.7rem; font-size: 0.9rem; }
}
@media (min-width: 861px) { .icon-button { display: none; } }

/* Modification ChatGPT v4 : largeur mobile un peu mieux contenue sur iPhone. */
@media (max-width: 430px) { .detail-panel { padding: 0.8rem; } .app-header { padding-left: 0.75rem; padding-right: 0.75rem; } .ghost-button { font-size: .82rem; } }

/* Modification ChatGPT v5 : affichage des sprites comme dans l'ancienne version.
   Raison : deux grandes cartes seulement, normal + shiny, au lieu d'une grille multi-sprites. */
.sprite-grid {
  grid-template-columns: repeat(2, minmax(120px, 220px));
  justify-content: center;
  gap: clamp(0.8rem, 8vw, 4rem);
}
.single-sprite-tile {
  min-height: 260px;
  align-content: center;
  background: #10142d;
}
.single-sprite-tile img {
  width: 180px;
  height: 180px;
}
.sprite-placeholder {
  width: 180px;
  height: 180px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px dashed var(--line);
  color: var(--danger);
  text-align: center;
  padding: 1rem;
}
@media (max-width: 520px) {
  .sprite-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
  .single-sprite-tile { min-height: 170px; padding: 0.6rem; }
  .single-sprite-tile img { width: 112px; height: 112px; }
  .sprite-placeholder { width: 112px; height: 112px; font-size: .8rem; }
}
