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

:root {
  --bg-dark: #0a0e17;
  --bg-mid: #111827;
  --accent: #00ff88;
  --accent-dim: #00cc6a;
  --danger: #ff3366;
  --text: #e0e7ff;
  --text-dim: #6b7fa3;
  --font-game: 'Press Start 2P', monospace;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
  font-family: var(--font-game);
  color: var(--text);
}

/* ===== Game Container ===== */
#game-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(0, 255, 136, 0.06) 0%, transparent 60%),
    linear-gradient(180deg, var(--bg-dark) 0%, var(--bg-mid) 100%);
}

#game-canvas {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  image-rendering: auto;
}

#cat-sprite {
  position: absolute;
  pointer-events: none;
  z-index: 5;
  image-rendering: auto;
  filter: drop-shadow(0 0 12px rgba(0, 255, 136, 0.35));
}

/* ===== Overlay Screens ===== */
#overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
}

.screen {
  text-align: center;
  pointer-events: auto;
  animation: fadeIn 0.4s ease;
}

.hidden {
  display: none !important;
}

h1 {
  font-size: clamp(1.4rem, 5vw, 2.8rem);
  line-height: 1.5;
  text-shadow:
    0 0 20px rgba(0, 255, 136, 0.4),
    0 4px 12px rgba(0, 0, 0, 0.6);
  margin-bottom: 0.6em;
}

h1 .accent {
  color: var(--accent);
}

h2 {
  font-size: clamp(1.2rem, 4vw, 2.2rem);
  color: var(--danger);
  text-shadow: 0 0 20px rgba(255, 51, 102, 0.5);
  margin-bottom: 0.8em;
}

.subtitle {
  font-size: clamp(0.45rem, 1.5vw, 0.7rem);
  color: var(--text-dim);
  margin-bottom: 1.8em;
  letter-spacing: 0.05em;
}

.instructions {
  font-size: clamp(0.4rem, 1.2vw, 0.6rem);
  color: var(--text-dim);
  margin-bottom: 2em;
}

.key {
  display: inline-block;
  padding: 0.3em 0.7em;
  border: 1px solid var(--accent-dim);
  border-radius: 4px;
  color: var(--accent);
  font-size: inherit;
  margin: 0 0.15em;
  background: rgba(0, 255, 136, 0.05);
}

.blink {
  font-size: clamp(0.4rem, 1.2vw, 0.6rem);
  color: var(--accent);
  animation: blink 1.2s ease-in-out infinite;
}

.restart-text {
  margin-top: 1.5em;
}

#gameover-screen p {
  font-size: clamp(0.5rem, 1.6vw, 0.8rem);
  margin-bottom: 0.5em;
}

#gameover-screen #final-score {
  color: var(--accent);
}

#gameover-screen #best-score {
  color: var(--accent-dim);
}

/* ===== Score ===== */
#score-display {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-game);
  font-size: clamp(1.2rem, 4vw, 2.4rem);
  color: var(--text);
  text-shadow:
    0 0 10px rgba(0, 255, 136, 0.3),
    0 2px 6px rgba(0, 0, 0, 0.7);
  z-index: 20;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

#score-display.visible {
  opacity: 1;
}

/* ===== Animations ===== */
@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.2;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}