/* =========================================================
   Car Dodge - Stylesheet
   Bright, cheerful, kid-friendly UI.
   The game is drawn on <canvas>; this only styles the page,
   overlays, buttons and the score HUD.
   ========================================================= */

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

html, body {
  height: 100%;
}

body {
  background: linear-gradient(180deg, #9be7ff 0%, #d6f5ff 60%, #eafff0 100%);
  font-family: "Trebuchet MS", "Comic Sans MS", Verdana, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  color: #2b3a4a;
  -webkit-tap-highlight-color: transparent; /* no blue flash on tap */
}

/* Scales the canvas while keeping its 420x640 aspect ratio */
#game-wrapper {
  position: relative;
  height: min(92vh, 640px);
  aspect-ratio: 420 / 640;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0, 80, 120, 0.25);
  background: #fff;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: manipulation; /* faster taps on mobile */
}

/* ===== Overlays (start / game over) ===== */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6%;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(2px);
  gap: 1.6vh;
}

.overlay h1 {
  font-size: clamp(1.8rem, 7vw, 2.8rem);
  color: #ff7a59;
  text-shadow: 2px 2px 0 #fff;
}

.subtitle {
  font-size: clamp(0.95rem, 3.4vw, 1.25rem);
  color: #3a7d44;
  font-weight: bold;
}

.hint {
  font-size: clamp(0.8rem, 3vw, 1rem);
  color: #5a6b7a;
}

.score-line {
  font-size: clamp(1.1rem, 4vw, 1.5rem);
  font-weight: bold;
  color: #2b3a4a;
}

/* ===== Big friendly buttons ===== */
.big-button {
  font: inherit;
  font-size: clamp(1.05rem, 4vw, 1.4rem);
  font-weight: bold;
  color: #fff;
  background: #ff7a59;
  border: none;
  border-radius: 999px;
  padding: 0.6em 1.7em;
  cursor: pointer;
  box-shadow: 0 6px 0 #d85a3c;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.big-button:hover { background: #ff8c70; }

.big-button:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #d85a3c;
}

/* ===== Score HUD shown during play ===== */
#hud {
  position: absolute;
  top: 2.5%;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 6%;
  font-size: clamp(1.1rem, 5vw, 1.7rem);
  font-weight: bold;
  color: #ffffff;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
  pointer-events: none; /* never blocks taps to the canvas */
}

/* Small "back to the games hub" chip (bottom-left, clear of the HUD) */
.menu-link {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 10;
  font-weight: bold;
  font-size: clamp(0.75rem, 2.2vw, 0.95rem);
  text-decoration: none;
  color: #2b3a4a;
  background: rgba(255, 255, 255, 0.85);
  padding: 0.35em 0.8em;
  border-radius: 999px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

.menu-link:hover { background: #fff; }

.hidden { display: none !important; }
