* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #000;
  font-family: 'Segoe UI', Arial, sans-serif;
  touch-action: none;
  user-select: none;
}

#app {
  width: 100%;
  height: 100svh;
  position: relative;
  overflow: hidden;
}

/* ── Screens ── */
.screen {
  position: absolute; inset: 0;
  display: none; align-items: center; justify-content: center;
  flex-direction: column;
}
.screen.active { display: flex; }

/* ── Start Screen ── */
#startScreen {
  background: linear-gradient(180deg, #87CEEB 0%, #98FB98 70%, #5D8A3C 100%);
}
.start-content {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  background: rgba(0,0,0,0.45); border-radius: 20px;
  padding: 36px 50px; backdrop-filter: blur(6px);
  border: 2px solid rgba(255,255,255,0.2);
}
.game-title {
  font-size: clamp(2.2rem, 8vw, 4rem);
  font-weight: 900; letter-spacing: 4px;
  color: #FFD700; text-shadow: 3px 3px 0 #B8860B, 0 0 20px rgba(255,215,0,0.5);
}
.cat-preview { font-size: 4.5rem; animation: bounce 1s ease-in-out infinite alternate; }
.subtitle { color: #fff; font-size: 1.1rem; opacity: 0.9; }
.controls-hint {
  display: flex; gap: 16px; color: #ddd; font-size: 0.8rem; margin-top: 4px; flex-wrap: wrap; justify-content: center;
}
.controls-hint span {
  background: rgba(255,255,255,0.15); padding: 4px 10px; border-radius: 20px;
}

/* ── Game Over / Win ── */
#gameOverScreen { background: rgba(0,0,0,0.88); }
#winScreen      { background: rgba(10,40,10,0.92); }
.over-content {
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  background: rgba(255,255,255,0.1); border-radius: 20px;
  padding: 36px 54px; border: 2px solid rgba(255,255,255,0.2);
}
.over-content h2 { color: #FFD700; font-size: 2.4rem; }
.over-score, .over-coins { color: #fff; font-size: 1.3rem; }

/* ── Shared button ── */
.btn-start {
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: #1a1a00; font-size: 1.3rem; font-weight: 700;
  border: none; border-radius: 30px; padding: 14px 40px;
  cursor: pointer; box-shadow: 0 4px 15px rgba(255,165,0,0.5);
  transition: transform 0.1s, box-shadow 0.1s;
}
.btn-start:active { transform: scale(0.96); }

/* ── Game Screen ── */
#gameScreen {
  display: none; background: #000;
  position: absolute; inset: 0;
}
#gameScreen.active { display: block; }

/* HUD — sits at very top */
#hud {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 14px;
  background: rgba(0,0,0,0.6);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.hud-left  { display: flex; gap: 14px; }
.hud-right { display: flex; align-items: center; gap: 10px; }
.hud-item  { color: #fff; font-size: clamp(0.72rem, 2.4vw, 1rem); font-weight: 600; }
#scoreDisplay { color: #FFD700; font-size: clamp(0.85rem, 2.8vw, 1.1rem); font-weight: 900; letter-spacing: 2px; }
#pauseBtn {
  background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.25);
  color: #fff; border-radius: 8px; padding: 3px 10px; cursor: pointer; font-size: 1rem;
}

/* Canvas — fills entire game screen */
#gameCanvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
}

/* ── Overlay control buttons ── */
/* Shared button style */
.dpad-btn, .action-btn {
  display: flex; align-items: center; justify-content: center;
  width: clamp(60px, 16vw, 88px);
  height: clamp(60px, 16vw, 88px);
  background: rgba(30, 20, 10, 0.55);
  border: 2px solid rgba(255,255,255,0.22);
  border-radius: 50%;
  color: #fff; cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.12);
  backdrop-filter: blur(4px);
  transition: transform 0.07s, background 0.07s;
  -webkit-user-select: none; user-select: none;
}
.dpad-btn svg, .action-btn svg {
  width: clamp(22px, 6vw, 34px);
  height: clamp(22px, 6vw, 34px);
  stroke: #fff; stroke-width: 2.5;
  fill: none; stroke-linecap: round; stroke-linejoin: round;
  pointer-events: none;
}
.dpad-btn.pressed, .action-btn.pressed {
  transform: scale(0.9);
  background: rgba(255, 200, 80, 0.35);
  border-color: rgba(255,200,80,0.6);
}

/* Left cluster — bottom-left corner */
#ctrl-left {
  position: absolute;
  bottom: clamp(16px, 4svh, 32px);
  left: clamp(14px, 4vw, 28px);
  display: flex;
  gap: clamp(10px, 3vw, 20px);
  z-index: 30;
  touch-action: none;
}

/* Right cluster — bottom-right corner */
#ctrl-right {
  position: absolute;
  bottom: clamp(16px, 4svh, 32px);
  right: clamp(14px, 4vw, 28px);
  display: flex;
  gap: clamp(10px, 3vw, 20px);
  z-index: 30;
  touch-action: none;
}

/* Animations */
@keyframes bounce {
  from { transform: translateY(0); }
  to   { transform: translateY(-12px); }
}
