/* FlaroCity Pokédex: twilight glassmorphism. Self-contained; no external fonts or CDNs. */

:root {
  --bg-top: #1b1636;
  --bg-bottom: #0c0a1f;
  --glass: rgba(255, 255, 255, 0.07);
  --glass-edge: rgba(255, 255, 255, 0.16);
  --text: #f4f1ff;
  --muted: #a9a3c9;
  --accent: #8b7bff;
  --gold: #ffd700;
  --focus: #ffd166;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg-top), var(--bg-bottom)) fixed;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.dex-header { padding: 1.5rem 1.25rem 0.5rem; text-align: center; }
.dex-back { color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.dex-network { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.5rem 1rem; }
.dex-network a { display: inline-flex; align-items: center; min-height: 44px; padding: 0.35rem 0.2rem; color: var(--muted); text-decoration: none; font-size: 0.8rem; }
.dex-network a:hover { color: var(--gold); }
.dex-header h1 { margin: 0.25rem 0; font-size: 2rem; letter-spacing: 0.02em; }
.dex-header h1 span { color: var(--accent); font-weight: 600; font-size: 1.1rem; }
.dex-sub { margin: 0; color: var(--muted); font-size: 0.9rem; }

.dex-controls {
  display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: end;
  max-width: 1100px; margin: 1rem auto; padding: 1rem;
  background: var(--glass); border: 1px solid var(--glass-edge); border-radius: 16px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}

.dex-search { flex: 1 1 280px; }
.dex-search input {
  width: 100%; padding: 0.7rem 0.9rem; border-radius: 10px;
  border: 1px solid var(--glass-edge); background: rgba(0, 0, 0, 0.3); color: var(--text); font-size: 1rem;
}

.dex-select { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.8rem; color: var(--muted); }
.dex-select select {
  padding: 0.6rem; border-radius: 10px; border: 1px solid var(--glass-edge);
  background: rgba(0, 0, 0, 0.3); color: var(--text); min-width: 150px;
}

/* Shiny switch: a real checkbox with role=switch, visually replaced by the track. */
.dex-switch { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; user-select: none; }
.dex-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.dex-track {
  position: relative; width: 46px; height: 26px; border-radius: 13px;
  background: rgba(0, 0, 0, 0.4); border: 1px solid var(--glass-edge); transition: background 0.2s;
}
.dex-knob {
  position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--muted); transition: transform 0.2s, background 0.2s;
}
.dex-switch input:checked + .dex-track { background: linear-gradient(90deg, var(--accent), var(--gold)); }
.dex-switch input:checked + .dex-track .dex-knob { transform: translateX(20px); background: #fff; }
.dex-switch input:focus-visible + .dex-track { outline: 3px solid var(--focus); outline-offset: 2px; }
.dex-switch-label { font-size: 0.9rem; color: var(--muted); }

.dex-status { text-align: center; color: var(--muted); min-height: 1.2em; margin: 0.25rem 0 0.75rem; }

.dex-grid {
  display: grid; gap: 1rem; padding: 0 1rem 1rem; max-width: 1200px; margin: 0 auto;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.dex-more-wrap { display: flex; justify-content: center; padding: 0.25rem 1rem 3rem; }
.dex-more {
  min-height: 44px; padding: 0.7rem 1.2rem; border: 1px solid var(--glass-edge); border-radius: 999px;
  background: linear-gradient(135deg, rgba(139, 123, 255, 0.28), rgba(94, 224, 194, 0.16));
  color: var(--text); font: inherit; font-weight: 700; cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
}
.dex-more:hover { border-color: var(--accent); transform: translateY(-1px); }
.dex-more[hidden] { display: none; }

.dex-card {
  position: relative; cursor: pointer; padding: 0.9rem; border-radius: 16px;
  background: var(--glass); border: 1px solid var(--glass-edge);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: transform 0.15s, border-color 0.15s;
}
.dex-card:hover, .dex-card:focus-visible { transform: translateY(-3px); border-color: var(--accent); }

.dex-number { margin: 0; font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.sprite { display: block; margin: 0.25rem auto; image-rendering: pixelated; width: 96px; height: 96px; }
.dex-name { margin: 0.1rem 0 0.4rem; font-size: 1.05rem; text-align: center; }

.type-row { display: flex; flex-wrap: wrap; gap: 0.3rem; justify-content: center; margin-bottom: 0.5rem; }
.type-pill {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 0.2rem 0.55rem; border-radius: 999px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
.type-normal { background: #8a8a7a; } .type-fire { background: #e8651c; } .type-water { background: #3a7bd5; }
.type-electric { background: #d4b000; color: #1a1400; text-shadow: none; } .type-grass { background: #4fa34a; }
.type-ice { background: #5fc7c0; color: #062326; text-shadow: none; } .type-fighting { background: #b5312a; }
.type-poison { background: #8e4aa6; } .type-ground { background: #b98a3e; } .type-flying { background: #7f9cd9; }
.type-psychic { background: #e0457b; } .type-bug { background: #8ba62a; } .type-rock { background: #9a8242; }
.type-ghost { background: #5b4b8a; } .type-dragon { background: #5a3ddb; } .type-dark { background: #4b4136; }
.type-steel { background: #7e8ea3; } .type-fairy { background: #e88ad0; color: #2a0a1f; text-shadow: none; }

.stat-bars { margin: 0; display: grid; gap: 0.2rem; }
.stat-row { display: grid; grid-template-columns: 4.2rem 1fr 2rem; align-items: center; gap: 0.4rem; font-size: 0.7rem; }
.stat-row dt { color: var(--muted); }
.stat-row dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.stat-bar { height: 6px; border-radius: 3px; background: rgba(0,0,0,0.35); overflow: hidden; }
.stat-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #5ee0c2); }

.card-biomes { margin: 0.5rem 0 0; font-size: 0.72rem; color: var(--muted); text-align: center; min-height: 2.2em; }

.dex-detail {
  width: min(560px, 92vw); border: 1px solid var(--glass-edge); border-radius: 18px; padding: 1.25rem;
  background: #171232; color: var(--text);
}
.dex-detail::backdrop { background: rgba(5, 3, 15, 0.7); }
.dex-close {
  float: right; background: none; border: 0; color: var(--text); font-size: 1.8rem; line-height: 1; cursor: pointer;
}
.detail-head { display: flex; gap: 1rem; align-items: center; }
.detail-head .sprite { width: 128px; height: 128px; margin: 0; }
.detail-name { margin: 0.1rem 0 0.4rem; }
.detail-total { margin: 0.4rem 0 0; color: var(--muted); font-size: 0.9rem; }
.dex-detail h3 { margin: 1rem 0 0.4rem; font-size: 0.95rem; color: var(--gold); }
.biome-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.biome-chip { font-size: 0.8rem; padding: 0.3rem 0.6rem; border-radius: 999px; background: var(--glass); border: 1px solid var(--glass-edge); }
.biomes-none { color: var(--muted); margin: 0; }

@media (prefers-reduced-motion: reduce) {
  .dex-card, .dex-track, .dex-knob { transition: none; }
}
