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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: #39b5b5;
}

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: linear-gradient(to bottom, #51d9d9 0%, #36b8b8 60%, #1e8e91 100%);
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

/* Top Right Score */
#score-display {
  position: absolute;
  top: clamp(8px, 3vh, 24px);
  right: clamp(12px, 4vw, 32px);
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.8rem, 6vh, 3.5rem);
  font-weight: 700;
  color: #2b394a;
  z-index: 10;
  pointer-events: none;
}

/* Overlay Screens */
.overlay-screen {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(18, 44, 48, 0.55);
  backdrop-filter: blur(8px);
  padding: clamp(8px, 2vh, 20px);
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.overlay-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal-card {
  width: 100%;
  max-width: clamp(280px, 88vw, 420px);
  max-height: 94%;
  background: rgba(15, 32, 39, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: clamp(16px, 4vw, 28px);
  padding: clamp(14px, 3.5vh, 36px) clamp(16px, 4vw, 28px);
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow-y: auto;
}

.logo-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.6rem, 5vh, 2.8rem);
  font-weight: 700;
  letter-spacing: -1px;
  color: #ffffff;
  margin-bottom: clamp(4px, 1vh, 8px);
}

.logo-title span {
  color: #ff4b72;
}

.subtitle {
  font-size: clamp(0.75rem, 2vh, 0.95rem);
  color: #b2d5d8;
  line-height: 1.4;
  margin-bottom: clamp(12px, 2.5vh, 24px);
}

.gameover-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.3rem, 4.5vh, 2.4rem);
  font-weight: 700;
  color: #ff4b72;
  margin-bottom: clamp(8px, 2vh, 20px);
  letter-spacing: -0.5px;
}

.stats-row {
  display: flex;
  gap: clamp(8px, 2vw, 16px);
  margin-bottom: clamp(12px, 2.5vh, 24px);
}

.stat-box {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: clamp(10px, 3vw, 18px);
  padding: clamp(8px, 2vh, 16px) clamp(6px, 2vw, 12px);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-box .label {
  font-size: clamp(0.65rem, 1.6vh, 0.75rem);
  font-weight: 800;
  letter-spacing: 1px;
  color: #8bbdc2;
  margin-bottom: 2px;
}

.stat-box .val {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.2rem, 3.5vh, 2rem);
  font-weight: 700;
  color: #ffffff;
}

.stat-box.best .val {
  color: #ffd166;
}

.primary-btn {
  width: 100%;
  padding: clamp(10px, 2.2vh, 16px) clamp(16px, 4vw, 24px);
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(0.85rem, 2.5vh, 1.1rem);
  font-weight: 700;
  color: #0f2027;
  background: #00e676;
  border: none;
  border-radius: clamp(10px, 2.5vw, 16px);
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 230, 118, 0.35);
  transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.primary-btn:hover {
  background: #10fb82;
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0, 230, 118, 0.45);
}

.primary-btn:active {
  transform: translateY(1px);
}

.control-hints {
  margin-top: clamp(10px, 2vh, 24px);
  padding-top: clamp(8px, 1.8vh, 20px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1.2vh, 12px);
}

.hint {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hint strong {
  font-size: clamp(0.65rem, 1.5vh, 0.75rem);
  letter-spacing: 1px;
  color: #38ef7d;
}

.hint span {
  font-size: clamp(0.75rem, 1.8vh, 0.85rem);
  color: #a0cacd;
}