/* Coast road: the canvas fills the play area; HUD, steering buttons and panels float over it. */
.cr-main { padding: 0; gap: 0; }
.cr-stage {
  --sun: #f6c344; --pink: #ef7b6b; --teal: #3aa6a0; --sky: #bfe6ef;
  --steer: clamp(120px, 15vh, 156px);
  position: relative; flex: 1; align-self: stretch; min-height: 0; overflow: hidden;
  background: #e9d6b0;
}
.cr-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: pointer; }

/* ---------- HUD ---------- */
.cr-hud {
  position: absolute; top: 14px; left: 16px; right: 16px; z-index: 2;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; pointer-events: none;
}
.cr-hud[hidden] { display: none; }
.cr-pill {
  display: inline-flex; align-items: center; gap: 0.45em; min-height: 56px; padding: 0 0.9em;
  border-radius: 999px; background: rgba(250,247,242,0.92); color: var(--sea-deep);
  box-shadow: 0 4px 14px rgba(22,44,51,0.18);
  font-size: 1.45rem; font-weight: 600; font-variant-numeric: tabular-nums;
}
.cr-hearts { gap: 0.2em; }
.cr-heart { width: 1.35em; height: 1.35em; }
.cr-heart path { fill: var(--pink); stroke: #c2554a; stroke-width: 1.2; }
.cr-heart.is-lost path { fill: #d9cfc4; stroke: #c3b8ab; }
.cr-heart.is-lost { transform: scale(0.85); }
.cr-right { display: flex; align-items: center; gap: 10px; }
.cr-coin-icon {
  width: 1.05em; height: 1.05em; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff3b8 0 18%, var(--sun) 45%, #d99a1e 100%);
  box-shadow: inset 0 0 0 2px #c98a14;
}
.cr-coins.is-bump { animation: cr-bump 0.25s ease-out; }
@keyframes cr-bump { 50% { transform: scale(1.15); } }
.cr-pause { pointer-events: auto; border-radius: 999px; background: rgba(250,247,242,0.92); color: var(--sea-deep); box-shadow: 0 4px 14px rgba(22,44,51,0.18); }
.cr-pause svg { stroke-width: 3; }

.cr-trip { font-size: 0.95rem; font-weight: 400; gap: 1.1em; }
.cr-trip-bar { position: relative; width: clamp(140px, 22vw, 380px); height: 12px; border-radius: 999px; background: #e3d8ca; }
.cr-trip-fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--teal), #6cc7c0); }
.cr-trip-car {
  position: absolute; top: 50%; left: 0; width: 26px; height: 18px; margin: -9px 0 0 -13px; border-radius: 7px;
  background: var(--car, var(--pink)); box-shadow: 0 0 0 3px #fff, 0 2px 6px rgba(0,0,0,0.25);
}

/* ---------- countdown ---------- */
.cr-count {
  position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; pointer-events: none;
  font-family: var(--sans); font-weight: 600; font-size: clamp(110px, 24vh, 240px); color: #fff;
  -webkit-text-stroke: 6px var(--sea-deep); paint-order: stroke fill; text-shadow: 0 10px 30px rgba(22,44,51,0.35);
}
.cr-count[hidden] { display: none; }
.cr-count span { animation: cr-count 0.9s ease-out both; }
.cr-count .is-go { color: var(--sun); }
@keyframes cr-count { from { transform: scale(1.6); opacity: 0; } 25% { transform: scale(1); opacity: 1; } to { transform: scale(0.9); opacity: 0.9; } }

/* ---------- steering buttons ---------- */
.cr-steer {
  position: absolute; bottom: 20px; z-index: 2; width: var(--steer); height: var(--steer);
  display: grid; place-items: center; padding: 0; border: 0; border-radius: 36px; cursor: pointer;
  background: rgba(250,247,242,0.9); color: var(--sea-deep);
  box-shadow: 0 8px 0 rgba(22,44,51,0.25), 0 12px 24px rgba(22,44,51,0.2);
  touch-action: none;
}
.cr-steer svg { width: 56%; height: 56%; fill: none; stroke: currentColor; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.cr-steer.is-down { transform: translateY(5px); box-shadow: 0 3px 0 rgba(22,44,51,0.25), 0 6px 14px rgba(22,44,51,0.2); background: var(--sun); }
.cr-left { left: 20px; }
.cr-right-btn { right: 20px; }
.cr-steer[hidden] { display: none; }

/* ---------- panels (start, paused) ---------- */
.cr-panel {
  position: absolute; z-index: 4; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: clamp(10px, 2vh, 18px);
  width: min(94%, 860px); max-height: calc(100% - 24px); padding: clamp(16px, 3vh, 32px) clamp(18px, 3vw, 40px);
  border-radius: 28px; background: rgba(250,247,242,0.96); box-shadow: 0 24px 70px rgba(22,44,51,0.35);
  text-align: center;
}
.cr-panel[hidden] { display: none; }
.cr-panel h2 { font-size: clamp(2rem, 5vh, 2.8rem); color: var(--sea-deep); }
.cr-cars { display: flex; gap: clamp(8px, 1.4vw, 16px); justify-content: center; }
.cr-car {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-width: clamp(120px, 11vw, 168px); padding: 10px 10px 8px; white-space: nowrap; border: 4px solid transparent; border-radius: 20px;
  background: var(--sand); cursor: pointer; font-size: 1.05rem; font-weight: 400; touch-action: manipulation;
}
.cr-car canvas { width: 100%; height: clamp(64px, 11vh, 110px); display: block; }
.cr-car[aria-pressed="true"] { border-color: var(--sea-deep); background: #fff; box-shadow: 0 6px 16px rgba(22,44,51,0.18); font-weight: 600; }
.cr-go { min-height: 76px; padding: 0 2em; font-size: 1.35rem; border-radius: 22px; background: var(--pink); }
.cr-go svg { fill: currentColor; stroke: none; }
.cr-hint { margin: 0; max-width: 46em; font-size: 0.98rem; color: #4a5157; line-height: 1.35; }
.cr-paused { width: min(90%, 460px); }

@media (prefers-reduced-motion: reduce) {
  .cr-count span, .cr-coins.is-bump { animation: none; }
}
