* {
  box-sizing: border-box;
}

:root {
  --bg-dark: #0a0a12;
  --neon-yellow: #ffd93b;
  --neon-cyan: #4deeea;
  --neon-pink: #ff5c9e;
  --neon-orange: #ff9f45;
  --neon-red: #ff4d4d;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-dark);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
  color: #fff;
}

.bg-glow {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 92, 158, 0.18), transparent 40%),
    radial-gradient(circle at 80% 30%, rgba(77, 238, 234, 0.18), transparent 40%),
    radial-gradient(circle at 50% 80%, rgba(255, 217, 59, 0.12), transparent 45%);
  animation: glowShift 12s ease-in-out infinite alternate;
  z-index: 0;
}

@keyframes glowShift {
  0%   { filter: hue-rotate(0deg) brightness(1); }
  100% { filter: hue-rotate(35deg) brightness(1.15); }
}

.stars {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image: radial-gradient(1.5px 1.5px at 20px 30px, #fff, transparent),
    radial-gradient(1.5px 1.5px at 90px 120px, #fff, transparent),
    radial-gradient(1px 1px at 160px 60px, #fff, transparent),
    radial-gradient(1.5px 1.5px at 230px 180px, #fff, transparent),
    radial-gradient(1px 1px at 300px 40px, #fff, transparent),
    radial-gradient(1.5px 1.5px at 340px 220px, #fff, transparent);
  background-repeat: repeat;
  background-size: 400px 260px;
  opacity: 0.35;
  animation: starDrift 60s linear infinite;
}

@keyframes starDrift {
  from { background-position: 0 0; }
  to   { background-position: -400px 260px; }
}

.container {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 20px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

.hero {
  text-align: center;
  margin-bottom: 24px;
  animation: fadeInDown 0.8s ease both;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.title {
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  letter-spacing: 4px;
  margin: 0;
  font-weight: 800;
}

.pac-letter {
  display: inline-block;
  color: var(--neon-yellow);
  text-shadow: 0 0 10px rgba(255, 217, 59, 0.7), 0 0 22px rgba(255, 217, 59, 0.4);
  animation: bounce 2.4s ease-in-out infinite;
}

.pac-letter.accent {
  color: var(--neon-cyan);
  text-shadow: 0 0 10px rgba(77, 238, 234, 0.7), 0 0 22px rgba(77, 238, 234, 0.4);
}

.pac-letter:nth-child(1) { animation-delay: 0s; }
.pac-letter:nth-child(2) { animation-delay: 0.08s; }
.pac-letter:nth-child(3) { animation-delay: 0.16s; }
.pac-letter:nth-child(4) { animation-delay: 0.24s; }
.pac-letter:nth-child(5) { animation-delay: 0.32s; }
.pac-letter:nth-child(6) { animation-delay: 0.40s; }
.pac-letter:nth-child(7) { animation-delay: 0.48s; }
.pac-letter:nth-child(8) { animation-delay: 0.56s; }

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

.subtitle {
  color: #b8b8c8;
  margin: 10px 0 20px;
  font-size: 1.05rem;
}

.ip-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  backdrop-filter: blur(6px);
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #3ddc84;
  box-shadow: 0 0 8px #3ddc84;
}

.dot.pulse {
  animation: pulseDot 1.6s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.5); opacity: 0.6; }
}

.stage {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 460px;
  animation: fadeIn 1s ease 0.2s both;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.start-screen {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 50px;
}

.floating-ghosts {
  position: absolute;
  inset: -40px;
  pointer-events: none;
  z-index: -1;
}

.ghost {
  position: absolute;
  width: 46px;
  height: 46px;
  border-radius: 50% 50% 0 0;
  filter: drop-shadow(0 0 10px currentColor);
  opacity: 0.85;
  animation: floaty 5s ease-in-out infinite;
}

.ghost::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  right: 0;
  height: 10px;
  background: inherit;
  clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 83% 40%, 66% 100%, 50% 40%, 33% 100%, 16% 40%, 0% 100%);
}

.ghost-red    { background: var(--neon-red);    color: var(--neon-red);    top: 0%;  left: 5%;  animation-delay: 0s; }
.ghost-pink   { background: var(--neon-pink);   color: var(--neon-pink);   top: 60%; left: 85%; animation-delay: 1.2s; }
.ghost-cyan   { background: var(--neon-cyan);   color: var(--neon-cyan);   top: 75%; left: 10%; animation-delay: 2.1s; }
.ghost-orange { background: var(--neon-orange); color: var(--neon-orange); top: 5%;  left: 82%; animation-delay: 0.6s; }

@keyframes floaty {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50%      { transform: translate(6px, -14px) rotate(4deg); }
}

.start-btn {
  position: relative;
  border: none;
  cursor: pointer;
  padding: 22px 64px;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 3px;
  color: #1a1a1a;
  background: linear-gradient(135deg, var(--neon-yellow), var(--neon-orange));
  border-radius: 16px;
  box-shadow: 0 0 20px rgba(255, 217, 59, 0.5), 0 8px 20px rgba(0,0,0,0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  animation: breathe 2.6s ease-in-out infinite;
}

.start-btn:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 0 34px rgba(255, 217, 59, 0.8), 0 10px 26px rgba(0,0,0,0.5);
}

.start-btn:active {
  transform: translateY(0) scale(0.98);
}

@keyframes breathe {
  0%, 100% { box-shadow: 0 0 20px rgba(255, 217, 59, 0.5), 0 8px 20px rgba(0,0,0,0.4); }
  50%      { box-shadow: 0 0 34px rgba(255, 217, 59, 0.75), 0 8px 20px rgba(0,0,0,0.4); }
}

.hint {
  color: #8a8a9a;
  font-size: 0.85rem;
}

.game-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  animation: popIn 0.35s ease both;
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

.hidden {
  display: none !important;
}

.hud {
  display: flex;
  align-items: center;
  gap: 18px;
  font-weight: 600;
  background: rgba(255,255,255,0.06);
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
}

.hud-item span {
  color: var(--neon-yellow);
}

.mini-btn {
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.05);
  color: #fff;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.15s ease, transform 0.15s ease;
}

.mini-btn:hover {
  background: rgba(255,255,255,0.15);
  transform: translateY(-1px);
}

#game-canvas {
  background: #000;
  border-radius: 10px;
  border: 3px solid #1e3a8a;
  box-shadow: 0 0 30px rgba(30, 58, 138, 0.6);
  image-rendering: pixelated;
}

.controls-hint {
  color: #8a8a9a;
  font-size: 0.8rem;
  margin: 0;
}

.overlay-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(10, 10, 18, 0.92);
  border: 2px solid var(--neon-yellow);
  border-radius: 14px;
  padding: 28px 40px;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  box-shadow: 0 0 30px rgba(255, 217, 59, 0.5);
  z-index: 5;
}

.footer {
  margin-top: auto;
  padding-top: 30px;
  color: #6b6b7d;
  font-size: 0.8rem;
  text-align: center;
}

.footer code {
  background: rgba(255,255,255,0.08);
  padding: 2px 8px;
  border-radius: 6px;
}
