*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  background: #222;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  overflow: hidden;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #fff;
}

/* ─── Canvas ─────────────────────────────────────────────────── */
canvas {
  display: block;
  background: #4ec0ca;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.7);
}

/* ─── HUD ─────────────────────────────────────────────────────── */
/* Score is drawn directly on the canvas — no DOM pill needed */
#hud { display: none !important; }

/* ─── Overlay ─────────────────────────────────────────────────── */
/* Transparent so the canvas (sky, ground, bird) shows behind it */
#overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  background: transparent;        /* canvas always visible behind */
  transition: opacity 0.2s ease;
}
#overlay.hidden { opacity: 0; pointer-events: none; }

/* Panel card — Flappy Bird style (cream/tan panel) */
.overlay-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 48px;
  text-align: center;
  background: rgba(255,255,255,0.92);
  border-radius: 16px;
  border: 4px solid #d4a855;
  box-shadow: 0 6px 0 #a07030, 0 12px 30px rgba(0,0,0,0.45);
  animation: card-pop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 300px;
  width: 90%;
}
@keyframes card-pop {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

/* Title */
#overlay h1 {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: #fff;
  -webkit-text-stroke: 3px #e07010;
  text-shadow: 0 3px 0 #c05000, 0 5px 12px rgba(0,0,0,0.35);
  line-height: 1.1;
  white-space: nowrap;
}
/* Game over title */
#overlay[data-screen="gameover"] h1 {
  color: #fff;
  -webkit-text-stroke: 3px #b82020;
  text-shadow: 0 3px 0 #800, 0 5px 12px rgba(0,0,0,0.35);
}

/* Subtitle */
#overlay p {
  font-size: 14px;
  color: #6b4c2a;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Score panel */
.overlay-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 28px;
  border-radius: 10px;
  background: #deb86a;
  border: 3px solid #a07030;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
  margin: 4px 0;
}
.overlay-stat span {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(100,70,20,0.7);
  font-weight: 700;
}
.overlay-stat strong {
  font-size: 36px;
  font-weight: 900;
  color: #fff;
  -webkit-text-stroke: 2px #8b5a00;
  text-shadow: 0 2px 0 #704000;
  font-variant-numeric: tabular-nums;
}

/* High score line */
#overlay-highscore {
  font-size: 12px;
  color: #9b7040;
  font-weight: 700;
  letter-spacing: 0.06em;
}

/* Start / Play Again button — classic Flappy green */
#primary-btn {
  margin-top: 6px;
  padding: 12px 40px;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: none;
  border-radius: 10px;
  background: #73bf2e;
  color: #fff;
  -webkit-text-stroke: 1px rgba(0,0,0,0.25);
  cursor: pointer;
  box-shadow: 0 5px 0 #4a8f15, 0 8px 16px rgba(0,0,0,0.3);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
#primary-btn:hover {
  background: #82d436;
  transform: translateY(-2px);
  box-shadow: 0 7px 0 #4a8f15, 0 10px 20px rgba(0,0,0,0.35);
}
#primary-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #4a8f15, 0 4px 10px rgba(0,0,0,0.3);
}

/* Hint text */
.overlay-hint {
  font-size: 11px;
  color: #9b7040;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Pause screen — hide stat/highscore */
#overlay[data-screen="paused"] .overlay-card { animation: none; }
#overlay[data-screen="paused"] #overlay-stat,
#overlay[data-screen="paused"] #overlay-highscore { display: none !important; }
