* { box-sizing: border-box; margin: 0; padding: 0; cursor: none !important; }

body {
  font-family: 'Segoe UI', sans-serif;
  background: #1a1a2e;
  color: #fff;
  overflow-x: hidden;
  user-select: none;
  cursor: none;
}

/* ── CUSTOM POKEBALL CURSOR ── */
#cursor-ball {
  position: fixed;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(to bottom, #e63946 50%, #fff 50%);
  border: 2.5px solid #111;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: opacity 0.2s;
  will-change: left, top;
}
#cursor-ball::before {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 2.5px;
  background: #111;
}
#cursor-ball::after {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid #111;
}

/* Wiggle when hovering a sprite */
#cursor-ball.on-sprite {
  animation: cursor-catch 0.45s ease-in-out infinite;
}
@keyframes cursor-catch {
  0%   { transform: translate(-50%,-50%) rotate(-22deg) scale(1.25); }
  25%  { transform: translate(-50%,-50%) rotate( 22deg) scale(1.25); }
  50%  { transform: translate(-50%,-50%) rotate(-16deg) scale(1.2);  }
  75%  { transform: translate(-50%,-50%) rotate( 16deg) scale(1.2);  }
  100% { transform: translate(-50%,-50%) rotate(-22deg) scale(1.25); }
}

/* ── HEADER ── */
#header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(135deg, #16213e 0%, #0f3460 100%);
  border-bottom: 3px solid #e94560;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

/* Pure-CSS Poké Ball */
.pokeball {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(to bottom, #e63946 50%, #fff 50%);
  border: 3px solid #222;
  position: relative;
  flex-shrink: 0;
  animation: spin 4s linear infinite;
}
.pokeball::before {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%,-50%);
  width: 100%; height: 3px;
  background: #222;
}
.pokeball::after {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%,-50%);
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #222;
}
@keyframes spin { to { transform: rotate(360deg); } }

#find-label {
  font-size: 1rem;
  font-weight: 600;
  color: #f0c040;
  white-space: nowrap;
}

#target-preview {
  width: 64px; height: 64px;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 8px #f0c040);
  flex-shrink: 0;
}

#target-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  text-transform: capitalize;
  min-width: 80px;
}

.stat-group {
  display: flex;
  gap: 20px;
  margin-left: auto;
  align-items: center;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255,255,255,0.08);
  padding: 6px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.15);
}
.stat-label { font-size: 0.65rem; color: #aaa; text-transform: uppercase; letter-spacing: 1px; }
.stat-value { font-size: 1.1rem; font-weight: 700; color: #f0c040; }

/* ── FLASH MESSAGE ── */
#flash {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #e63946;
  color: #fff;
  padding: 12px 28px;
  border-radius: 30px;
  font-size: 1rem;
  font-weight: 700;
  z-index: 200;
  transition: transform 0.3s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  pointer-events: none;
}
#flash.show { transform: translateX(-50%) translateY(0); }

/* ── GAME AREA ── */
#scene-wrapper {
  overflow: hidden;
  width: 100%;
  height: calc(100vh - 86px);
  cursor: none;
}

#scene {
  position: relative;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  transition: background-image 0.4s ease;
}

/* Level badge that briefly shows the background theme */
#bg-label {
  position: absolute;
  top: 12px;
  right: 14px;
  background: rgba(0,0,0,0.55);
  color: #f0c040;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: 0.5px;
  pointer-events: none;
  z-index: 20;
  opacity: 1;
  transition: opacity 1s ease 2s;
}
#bg-label.fade { opacity: 0; }

.poke-sprite {
  position: absolute;
  image-rendering: pixelated;
  cursor: none;
  transition: filter 0.15s;
}
.poke-sprite:hover { filter: brightness(1.3); z-index: 10; }

/* ── RIPPLE ── */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(230,57,70,0.5);
  pointer-events: none;
  animation: ripple-out 0.6s ease-out forwards;
  z-index: 50;
}
@keyframes ripple-out {
  from { width: 0; height: 0; opacity: 1; transform: translate(-50%,-50%); }
  to   { width: 80px; height: 80px; opacity: 0; transform: translate(-50%,-50%); }
}

/* Target ring when found */
.target-ring {
  position: absolute;
  border-radius: 50%;
  border: 4px solid #2ecc71;
  pointer-events: none;
  animation: ring-pulse 0.8s ease-out infinite;
  z-index: 50;
}
@keyframes ring-pulse {
  0%   { transform: translate(-50%,-50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%,-50%) scale(1.6); opacity: 0; }
}

/* ── CONFETTI ── */
.confetti-dot {
  position: fixed;
  width: 10px; height: 10px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 300;
  animation: confetti-fall 1.2s ease-in forwards;
}
@keyframes confetti-fall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(400px) rotate(720deg); opacity: 0; }
}

/* ── READY OVERLAY ── */
#ready-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.80);
  z-index: 450;
  align-items: center;
  justify-content: center;
}
#ready-overlay.show { display: flex; }

#ready-img {
  width: 180px;
  height: 180px;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 18px #f0c040);
  display: block;
  margin: 12px auto;
}

#ready-btn {
  margin-top: 18px;
  padding: 14px 36px;
  font-size: 1.1rem;
  font-weight: 700;
  background: #2ecc71;
  color: #fff;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, opacity 0.2s;
  box-shadow: 0 4px 15px rgba(46,204,113,0.5);
}
#ready-btn:hover:not(:disabled) { background: #27ae60; transform: scale(1.05); }
#ready-btn:disabled { opacity: 0.55; cursor: default; }

/* ── WIN OVERLAY ── */
#overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 400;
  align-items: center;
  justify-content: center;
}
#overlay.show { display: flex; }

#overlay-box {
  background: linear-gradient(135deg, #16213e, #0f3460);
  border: 3px solid #e94560;
  border-radius: 20px;
  padding: 40px 50px;
  text-align: center;
  box-shadow: 0 0 60px rgba(233,69,96,0.4);
  animation: pop-in 0.4s cubic-bezier(0.175,0.885,0.32,1.275);
}
@keyframes pop-in {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

#overlay-box h2 { font-size: 2rem; color: #f0c040; margin-bottom: 8px; }
#overlay-box p  { color: #ccc; margin-bottom: 6px; }
#overlay-img    { width: 96px; image-rendering: pixelated; margin: 16px auto; display: block; filter: drop-shadow(0 0 12px #2ecc71); }

#overlay-btn {
  margin-top: 20px;
  padding: 14px 36px;
  font-size: 1.1rem;
  font-weight: 700;
  background: #e63946;
  color: #fff;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  box-shadow: 0 4px 15px rgba(230,57,70,0.5);
}
#overlay-btn:hover { background: #c1121f; transform: scale(1.05); }

/* ── START SCREEN ── */
#start-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}
#start-screen h1 { font-size: 2.8rem; color: #f0c040; text-shadow: 0 0 20px rgba(240,192,64,0.5); }
#start-screen p  { color: #aaa; font-size: 1rem; max-width: 380px; text-align: center; line-height: 1.6; }
#start-btn {
  padding: 16px 48px;
  font-size: 1.2rem;
  font-weight: 700;
  background: #e63946;
  color: #fff;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(230,57,70,0.5);
  transition: transform 0.15s;
}
#start-btn:hover { transform: scale(1.06); }
.big-pokeball {
  width: 100px; height: 100px;
  border-radius: 50%;
  background: linear-gradient(to bottom, #e63946 50%, #fff 50%);
  border: 6px solid #222;
  position: relative;
  animation: spin 3s linear infinite;
}
.big-pokeball::before {
  content: ''; position: absolute; left: 50%; top: 50%;
  transform: translate(-50%,-50%); width: 100%; height: 6px; background: #222;
}
.big-pokeball::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  transform: translate(-50%,-50%); width: 28px; height: 28px;
  border-radius: 50%; background: #fff; border: 6px solid #222;
}
