/* =============================================
   RANDOM POKÉMON GENERATOR — style.css
   Aesthetic: Retro-arcade × modern glass
   ============================================= */

:root {
  --bg-dark: #0d0d1a;
  --bg-card: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.12);
  --text-primary: #f0f0ff;
  --text-muted: rgba(240, 240, 255, 0.5);
  --accent: #ffde00;
  --accent-2: #ff6b6b;
  --accent-glow: rgba(255, 222, 0, 0.3);

  /* Type colors */
  --type-normal:   #A8A878; --type-fire:     #F08030;
  --type-water:    #6890F0; --type-electric: #F8D030;
  --type-grass:    #78C850; --type-ice:      #98D8D8;
  --type-fighting: #C03028; --type-poison:   #A040A0;
  --type-ground:   #E0C068; --type-flying:   #A890F0;
  --type-psychic:  #F85888; --type-bug:      #A8B820;
  --type-rock:     #B8A038; --type-ghost:    #705898;
  --type-dragon:   #7038F8; --type-dark:     #705848;
  --type-steel:    #B8B8D0; --type-fairy:    #EE99AC;

  --font-pixel: 'Press Start 2P', monospace;
  --font-body:  'Nunito', sans-serif;

  --radius: 24px;
  --transition: 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Reset & Base ─────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg-dark);
  color: var(--text-primary);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  position: relative;
}

/* ── Background Orbs ──────────────────────── */
.bg-orbs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.25;
  animation: drift 12s ease-in-out infinite alternate;
}

.orb-1 {
  width: 500px; height: 500px;
  background: #4f46e5;
  top: -150px; left: -150px;
  animation-duration: 14s;
}

.orb-2 {
  width: 400px; height: 400px;
  background: #f59e0b;
  bottom: -100px; right: -100px;
  animation-duration: 11s;
  animation-delay: -4s;
}

.orb-3 {
  width: 300px; height: 300px;
  background: #ec4899;
  top: 40%; left: 60%;
  animation-duration: 9s;
  animation-delay: -7s;
}

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(40px, 30px) scale(1.08); }
}

.noise-overlay {
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
  opacity: 0.035;
  pointer-events: none;
  z-index: 0;
}

/* ── Container ────────────────────────────── */
.container {
  position: relative;
  z-index: 1;
  width: min(480px, 92vw);
  padding: 2rem 0 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

/* ── Header ───────────────────────────────── */
.header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

/* Pokéball Icon (decorative) */
.pokeball-icon {
  width: 52px; height: 52px;
  position: relative;
  animation: spin-slow 8s linear infinite;
}

.pb-top, .pb-bottom {
  height: 50%;
  border-radius: 50px 50px 0 0;
  background: #e53e3e;
}
.pb-bottom {
  border-radius: 0 0 50px 50px;
  background: #f0f0f0;
}
.pb-middle {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  height: 6px;
  background: #1a1a2e;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.pb-button {
  width: 14px; height: 14px;
  background: #f0f0f0;
  border-radius: 50%;
  border: 3px solid #1a1a2e;
}

@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.title {
  font-family: var(--font-pixel);
  font-size: clamp(1.1rem, 4vw, 1.4rem);
  line-height: 1.9;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  text-shadow: 0 0 30px rgba(255, 222, 0, 0.2);
}

.title-accent {
  color: var(--accent);
  text-shadow: 0 0 20px var(--accent-glow), 0 0 40px var(--accent-glow);
}

.subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* ── Card ─────────────────────────────────── */
.card {
  width: 100%;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  min-height: 340px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  transition: background 0.8s ease, border-color 0.8s ease, box-shadow 0.8s ease;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255,255,255,0.07) 0%, transparent 60%);
  pointer-events: none;
}

.card-inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Placeholder */
.placeholder-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  animation: pulse-fade 3s ease-in-out infinite;
}

.placeholder-pokeball {
  width: 80px; height: 80px;
  opacity: 0.3;
}

.placeholder-pokeball .pb-button { width: 22px; height: 22px; }
.placeholder-pokeball .pb-middle { height: 8px; }

.placeholder-text {
  font-family: var(--font-pixel);
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 1px;
}

@keyframes pulse-fade {
  0%, 100% { opacity: 0.6; }
  50%       { opacity: 1; }
}

/* Loading */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.pokeball-spin {
  width: 70px; height: 70px;
  animation: pokeball-bounce 0.7s ease-in-out infinite alternate;
}

.pokeball-spin .pb-button { width: 20px; height: 20px; }
.pokeball-spin .pb-middle { height: 7px; }

@keyframes pokeball-bounce {
  from { transform: translateY(-10px) rotate(-15deg); }
  to   { transform: translateY(5px) rotate(15deg); }
}

.loading-text {
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.dots::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
}

/* Result */
.result-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
  animation: pop-in 0.5s var(--transition) both;
}

@keyframes pop-in {
  from { opacity: 0; transform: scale(0.85) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.pokemon-id {
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  color: var(--text-muted);
  letter-spacing: 2px;
}

.image-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-glow {
  position: absolute;
  width: 160px; height: 80px;
  border-radius: 50%;
  background: var(--accent);
  filter: blur(30px);
  opacity: 0.35;
  bottom: -10px;
  transition: background 0.8s ease;
}

#pokemon-img {
  width: 160px;
  height: 160px;
  object-fit: contain;
  image-rendering: pixelated;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.4));
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

.pokemon-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.pokemon-name {
  font-family: var(--font-pixel);
  font-size: clamp(0.9rem, 3vw, 1.15rem);
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 2px;
  text-align: center;
}

/* Type Badges */
.type-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.type-badge {
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  padding: 5px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Stats Row */
.stats-row {
  display: flex;
  gap: 1.2rem;
  margin-top: 0.25rem;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.stat-value {
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  color: var(--text-primary);
}

/* ── Utility ──────────────────────────────── */
.hidden { display: none !important; }

/* ── Buttons ──────────────────────────────── */
.actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

.btn {
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  letter-spacing: 1px;
  cursor: pointer;
  border: none;
  border-radius: 14px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background 0.2s ease;
}

.btn:hover::after { background: rgba(255,255,255,0.08); }
.btn:active { transform: scale(0.96) !important; }

.btn-primary {
  background: var(--accent);
  color: #1a1a2e;
  padding: 1rem 2rem;
  font-size: 0.65rem;
  box-shadow: 0 4px 24px rgba(255, 222, 0, 0.35), 0 0 0 0 rgba(255, 222, 0, 0.3);
  animation: pulse-btn 2.5s ease-in-out infinite;
}

@keyframes pulse-btn {
  0%, 100% { box-shadow: 0 4px 24px rgba(255,222,0,0.35), 0 0 0 0 rgba(255,222,0,0.2); }
  50%       { box-shadow: 0 4px 30px rgba(255,222,0,0.5), 0 0 0 10px rgba(255,222,0,0); }
}

.btn-primary:hover { transform: translateY(-3px) scale(1.02); }

.secondary-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-secondary {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
  padding: 0.7rem 1.2rem;
  border: 1px solid var(--border);
}

.btn-secondary:hover { transform: translateY(-2px); border-color: rgba(255,255,255,0.25); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 0.7rem 1.2rem;
  border: 1px solid rgba(255,255,255,0.08);
}

.btn-ghost:hover { color: var(--text-primary); transform: translateY(-2px); }

/* ── Toast ────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #22c55e;
  color: #fff;
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  box-shadow: 0 4px 20px rgba(34,197,94,0.4);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  z-index: 100;
  letter-spacing: 1px;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Footer ───────────────────────────────── */
.footer {
  text-align: center;
}

.footer p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

.footer a:hover { text-decoration: underline; }

/* ── Card theming by type ─────────────────── */
.card.type-fire   { border-color: rgba(240,128,48,0.4);  box-shadow: 0 0 60px rgba(240,128,48,0.1); }
.card.type-water  { border-color: rgba(104,144,240,0.4); box-shadow: 0 0 60px rgba(104,144,240,0.1); }
.card.type-grass  { border-color: rgba(120,200,80,0.4);  box-shadow: 0 0 60px rgba(120,200,80,0.1); }
.card.type-electric { border-color: rgba(248,208,48,0.4); box-shadow: 0 0 60px rgba(248,208,48,0.1); }
.card.type-psychic { border-color: rgba(248,88,136,0.4); box-shadow: 0 0 60px rgba(248,88,136,0.1); }
.card.type-dragon  { border-color: rgba(112,56,248,0.4); box-shadow: 0 0 60px rgba(112,56,248,0.1); }
.card.type-ghost   { border-color: rgba(112,88,152,0.4); box-shadow: 0 0 60px rgba(112,88,152,0.1); }
.card.type-ice     { border-color: rgba(152,216,216,0.4); box-shadow: 0 0 60px rgba(152,216,216,0.1); }
.card.type-fighting { border-color: rgba(192,48,40,0.4); box-shadow: 0 0 60px rgba(192,48,40,0.1); }
.card.type-poison  { border-color: rgba(160,64,160,0.4); box-shadow: 0 0 60px rgba(160,64,160,0.1); }
.card.type-fairy   { border-color: rgba(238,153,172,0.4); box-shadow: 0 0 60px rgba(238,153,172,0.1); }
.card.type-dark    { border-color: rgba(112,88,72,0.4);  box-shadow: 0 0 60px rgba(112,88,72,0.1); }
.card.type-steel   { border-color: rgba(184,184,208,0.4); box-shadow: 0 0 60px rgba(184,184,208,0.1); }
.card.type-normal  { border-color: rgba(168,168,120,0.4); box-shadow: 0 0 60px rgba(168,168,120,0.05); }
.card.type-bug     { border-color: rgba(168,184,32,0.4); box-shadow: 0 0 60px rgba(168,184,32,0.1); }
.card.type-rock    { border-color: rgba(184,160,56,0.4); box-shadow: 0 0 60px rgba(184,160,56,0.1); }
.card.type-ground  { border-color: rgba(224,192,104,0.4); box-shadow: 0 0 60px rgba(224,192,104,0.1); }
.card.type-flying  { border-color: rgba(168,144,240,0.4); box-shadow: 0 0 60px rgba(168,144,240,0.1); }

/* ── Responsive ───────────────────────────── */
@media (max-width: 420px) {
  .title { font-size: 1rem; }
  .card  { padding: 1.5rem 1rem; }
  #pokemon-img { width: 130px; height: 130px; }
  .btn-primary  { padding: 0.85rem 1.4rem; }
  .stats-row    { gap: 0.8rem; }
}
