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

/* ─── Body / Space Background ──────────────────────────────────── */
body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #060816;
  background-image: radial-gradient(ellipse 80% 60% at 50% 50%, #142054 0%, #060816 70%);
  font-family: 'Press Start 2P', monospace;
  color: #e8f4ff;
}

/* Star specks via pseudo-element */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(1px 1px at  8% 12%, rgba(255,255,255,.75) 0%, transparent 100%),
    radial-gradient(1px 1px at 15% 68%, rgba(255,255,255,.55) 0%, transparent 100%),
    radial-gradient(1px 1px at 22% 35%, rgba(255,255,255,.65) 0%, transparent 100%),
    radial-gradient(1px 1px at 30% 88%, rgba(255,255,255,.45) 0%, transparent 100%),
    radial-gradient(1px 1px at 38% 22%, rgba(255,255,255,.70) 0%, transparent 100%),
    radial-gradient(1px 1px at 45% 55%, rgba(255,255,255,.50) 0%, transparent 100%),
    radial-gradient(1px 1px at 53% 10%, rgba(255,255,255,.65) 0%, transparent 100%),
    radial-gradient(1px 1px at 60% 75%, rgba(255,255,255,.45) 0%, transparent 100%),
    radial-gradient(1px 1px at 67% 40%, rgba(255,255,255,.70) 0%, transparent 100%),
    radial-gradient(1px 1px at 75% 18%, rgba(255,255,255,.55) 0%, transparent 100%),
    radial-gradient(1px 1px at 82% 62%, rgba(255,255,255,.60) 0%, transparent 100%),
    radial-gradient(1px 1px at 90% 85%, rgba(255,255,255,.40) 0%, transparent 100%),
    radial-gradient(1px 1px at 93% 30%, rgba(255,255,255,.70) 0%, transparent 100%),
    radial-gradient(2px 2px at 48% 90%, rgba(200,220,255,.50) 0%, transparent 100%),
    radial-gradient(2px 2px at 72%  5%, rgba(200,220,255,.45) 0%, transparent 100%),
    radial-gradient(1px 1px at  5% 50%, rgba(255,255,255,.55) 0%, transparent 100%),
    radial-gradient(1px 1px at 57% 33%, rgba(255,255,255,.45) 0%, transparent 100%),
    radial-gradient(1px 1px at 35% 70%, rgba(200,220,255,.60) 0%, transparent 100%);
}

/* ─── Main Panel (D/P double-border box) ───────────────────────── */
.container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.8rem;
  padding: 2.5rem 3rem;
  background: linear-gradient(180deg, #2554c8 0%, #112878 50%, #090e40 100%);
  border-radius: 14px;
  /* Characteristic D/P double border */
  box-shadow:
    0 0 0 3px #050d30,
    0 0 0 7px #6aaeff,
    0 0 0 10px #050d30,
    0 24px 64px rgba(0, 0, 60, .85);
  min-width: 340px;
  max-width: 460px;
}

/* ─── D/P Header ────────────────────────────────────────────────── */
.dp-header {
  display: flex;
  align-items: center;
  gap: .9rem;
  justify-content: center;
  width: 100%;
}

.dp-diamond {
  color: #f8d860;
  font-size: .9rem;
  text-shadow: 0 0 10px #f8d86088;
  flex-shrink: 0;
}

h1 {
  font-size: 0.7rem;
  line-height: 1.7;
  letter-spacing: .1em;
  text-align: center;
  color: #f8d860;
  text-shadow:
    2px 2px 0 #7a4800,
    0 0 24px #f8d86055;
}

/* Horizontal divider (D/P info-box separator) */
.dp-divider {
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, #6aaeff, #b8dcff, #6aaeff, transparent);
  border-radius: 2px;
}

/* ─── Page wrapper – holds legendaries + panel side by side ────── */
.page-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 1.2rem;
  z-index: 1;
}

/* ─── D/P Legendary sprites (Dialga / Palkia) ────────────────── */
.dp-legendary {
  width: 180px;
  height: 180px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 18px rgba(0, 0, 100, 0.55));
}

.dp-legendary--left {
  transform: scaleX(-1);
}

@media (max-width: 700px) {
  .dp-legendary { display: none; }
}

/* ─── Pokéball sprite ───────────────────────────────────── */
.pokeball-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pokeball {
  width: 160px;
  height: 160px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 80, 0.7));
  cursor: default;
}

/* ─── Idle subtle float ─────────────────────────────────────────── */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}
.pokeball { animation: float 3s ease-in-out infinite; }

/* ─── PokéCenter heal animation ─────────────────────────────────── */

/* 1. Ball shakes / wobbles */
@keyframes healShake {
  0%,100% { transform: rotate(0deg) translateY(0); }
  10%      { transform: rotate(-8deg) translateY(-6px); }
  20%      { transform: rotate(8deg)  translateY(-6px); }
  30%      { transform: rotate(-6deg) translateY(-4px); }
  40%      { transform: rotate(6deg)  translateY(-4px); }
  50%      { transform: rotate(-4deg) translateY(-2px); }
  60%      { transform: rotate(4deg)  translateY(-2px); }
  70%      { transform: rotate(-2deg) translateY(0); }
  80%      { transform: rotate(2deg)  translateY(0); }
}

/* 2. Bright white flash on the whole ball */
@keyframes healFlash {
  0%,100% { opacity: 1; }
  25%      { opacity: 0.15; }
  50%      { opacity: 1; }
  75%      { opacity: 0.15; }
}

/* 3. Soft pink glow ring around the ball (filter respects sprite transparency) */
@keyframes glowRing {
  0%,100% { filter: drop-shadow(0 4px 10px rgba(0, 0, 80, 0.7)); }
  50%      { filter: drop-shadow(0 0 18px #ff9de2) drop-shadow(0 0 32px rgba(255,157,226,.55)); }
}

/* ── Classes applied by JavaScript ── */
.pokeball.healing {
  animation: healShake 0.6s ease-in-out 2, healFlash 0.6s ease-in-out 2, glowRing 1.2s ease-in-out;
}

/* After healing: the ball opens / "releases" spark */
@keyframes openBall {
  0%   { transform: scale(1) rotate(0deg); }
  40%  { transform: scale(1.15) rotate(-10deg); }
  60%  { transform: scale(1.15) rotate(10deg); }
  80%  { transform: scale(1) rotate(0deg); }
  100% { transform: scale(1) rotate(0deg); }
}
.pokeball.opening {
  animation: openBall 0.5s ease-in-out forwards;
}

/* Stars / sparkles that appear during heal */
.sparkle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  pointer-events: none;
}
@keyframes sparklePop {
  0%   { transform: translate(0,0) scale(1); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(0); opacity: 0; }
}
.sparkle { animation: sparklePop 0.8s ease-out forwards; }

/* ─── Status text ───────────────────────────────────────────────── */
.status {
  font-size: 0.5rem;
  min-height: 1.6em;
  color: #a8d8ff;
  text-align: center;
  line-height: 2;
  letter-spacing: .06em;
  transition: opacity 0.3s;
}

/* ─── Generate Button (D/P menu style) ─────────────────────────── */
.btn-generate {
  position: relative;
  padding: .9rem 2.4rem .9rem 2.8rem;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.58rem;
  letter-spacing: .1em;
  border: none;
  border-radius: 6px;
  background: linear-gradient(180deg, #e8f2ff 0%, #bcd4f8 100%);
  color: #091640;
  cursor: pointer;
  box-shadow:
    0 4px 0 #2a4898,
    0 6px 14px rgba(0, 0, 80, .55);
  transition: transform .1s, box-shadow .1s, opacity .15s;
}
/* D/P menu cursor arrow */
.btn-generate::before {
  content: '▶';
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.45rem;
  color: #091640;
  opacity: 0;
  transition: opacity .15s;
}
.btn-generate:hover:not(:disabled)::before { opacity: 1; }
.btn-generate:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #2a4898, 0 8px 20px rgba(0, 0, 80, .55);
}
.btn-generate:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #2a4898, 0 2px 6px rgba(0, 0, 80, .55);
}
.btn-generate:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ─── ROM Counter ───────────────────────────────────────────────── */
.rom-counter {
  font-size: 0.42rem;
  color: #6aaeffaa;
  letter-spacing: .06em;
  min-height: 1.2em;
  text-align: center;
  line-height: 2;
}
