/* ============================================================
   Cubs Play — Car Wash
   ============================================================ */
:root {
  --color-sky:   #7ec8ff;
  --color-sky2:  #4fa8f5;
  --color-dark:  #14324f;
  --color-card:  #ffffff;
  --color-accent:#ff8a3d;
  --color-accent2:#ffb74d;
  --color-bubble:#eaf6ff;
  --font: 'Baloo 2', 'Comic Sans MS', 'Segoe UI', system-ui, sans-serif;
}

@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@500;600;700;800&display=swap');

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

body {
  font-family: var(--font);
  min-height: 100vh;
  color: var(--color-dark);
  background:
    radial-gradient(circle at 20% 15%, #bfe7ff 0%, transparent 45%),
    radial-gradient(circle at 85% 10%, #d9f2ff 0%, transparent 40%),
    linear-gradient(180deg, #aee0ff 0%, #6fc0f7 55%, #4aa3e8 100%);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ---------------------------------------------------- Site header / footer */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  position: sticky; top: 0; z-index: 50;
}
.sh-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--color-dark); font-weight: 800; font-size: 1.2rem; }
.sh-brand img { height: 38px; width: auto; }
.sh-back { text-decoration: none; color: var(--color-dark); font-weight: 700; background: #fff; padding: 8px 14px; border-radius: 999px; box-shadow: 0 3px 8px rgba(0,0,0,0.12); font-size: 0.95rem; }
.sh-back:hover { background: var(--color-accent2); }

.site-footer {
  margin-top: 30px; padding: 18px;
  display: flex; gap: 18px; align-items: center; justify-content: center;
  color: #0d3a5c; font-weight: 600;
  background: rgba(255,255,255,0.55);
}
.site-footer a { color: #0d3a5c; }

/* ----------------------------------------------------------- App container */
.app-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 18px 16px 8px;
}
.app-container > header { text-align: center; margin-bottom: 14px; }
.app-container > header h1 {
  font-size: clamp(1.8rem, 6vw, 2.8rem);
  color: #fff;
  text-shadow: 0 3px 0 #2b7ec4, 0 6px 14px rgba(0,0,0,0.25);
  letter-spacing: 1px;
}

/* --------------------------------------------------------------- Wash bay */
.wash-bay {
  background: var(--color-card);
  border-radius: 28px;
  padding: 18px 18px 22px;
  box-shadow: 0 18px 40px rgba(13, 58, 92, 0.25);
  border: 4px solid #fff;
}

.stage-banner {
  text-align: center;
  font-weight: 800;
  font-size: clamp(1.1rem, 4vw, 1.5rem);
  color: var(--color-dark);
  background: linear-gradient(180deg, #fff7ec 0%, #ffe9d3 100%);
  border: 2px dashed var(--color-accent2);
  border-radius: 16px;
  padding: 10px 14px;
  margin-bottom: 14px;
  min-height: 48px;
  display: flex; align-items: center; justify-content: center;
}

/* Helper */
.hidden { display: none !important; }

/* Mascot encouragement line */
.mascot {
  display: flex; align-items: center; gap: 10px;
  background: var(--color-bubble);
  border: 2px solid #cfe9ff;
  border-radius: 14px;
  padding: 8px 14px;
  margin-bottom: 12px;
  font-weight: 700; color: #1c5a86;
  font-size: clamp(0.9rem, 3.4vw, 1.05rem);
  min-height: 42px;
}
.mascot-face { font-size: 1.6rem; animation: bobMascot 1.6s ease-in-out infinite; }
@keyframes bobMascot { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-3px) rotate(4deg); } }

/* The interactive car stage */
.car-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 560 / 340;
  border-radius: 22px;
  overflow: hidden;
  background:
    linear-gradient(180deg, #e9f7ff 0%, #cdecff 60%, #bfe3fb 100%);
  border: 3px solid #d4ecff;
  cursor: none;
  touch-action: none;
}
/* tiled "tile wall" feel for the wash bay floor */
.car-stage::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(transparent 78%, rgba(120,180,220,0.18) 78%),
    repeating-linear-gradient(90deg, transparent 0 54px, rgba(120,180,220,0.12) 54px 56px);
}

.vehicle-wrap, .car-art, .decals-layer, .layer-canvas, .fx-canvas, .sparkle-layer {
  position: absolute; inset: 0; width: 100%; height: 100%;
}
.vehicle-wrap { z-index: 1; will-change: transform; }
.car-art { display: flex; align-items: center; justify-content: center; padding: 4% 3% 2%; }
.car-svg { width: 100%; height: 100%; }
.decals-layer { z-index: 2; pointer-events: none; }
.layer-canvas { z-index: 3; }
.fx-canvas { z-index: 5; pointer-events: none; }
.sparkle-layer { z-index: 4; pointer-events: none; }

/* Stickers placed on the vehicle during the decorate phase */
.decal {
  position: absolute; font-size: 2rem; transform: translate(-50%, -50%);
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.3));
  user-select: none;
}
.decal.pop { animation: decalPop 0.35s cubic-bezier(.18,.89,.32,1.4); }
@keyframes decalPop { 0% { transform: translate(-50%, -50%) scale(0); } 70% { transform: translate(-50%, -50%) scale(1.3); } 100% { transform: translate(-50%, -50%) scale(1); } }

/* Googly vehicle face blinks now and then for personality */
.vehicle-face { animation: blink 4s infinite; transform-origin: center; }
@keyframes blink { 0%, 92%, 100% { opacity: 1; } 95% { opacity: 0.15; } }

.car-art.shiny .car-svg {
  filter: drop-shadow(0 0 10px rgba(255,255,255,0.9)) saturate(1.15);
  animation: shinePulse 1.2s ease-in-out infinite alternate;
}
@keyframes shinePulse { from { filter: drop-shadow(0 0 6px rgba(255,255,255,0.6)) saturate(1.05); } to { filter: drop-shadow(0 0 18px rgba(255,255,255,1)) saturate(1.25); } }

.car-art.wiggle .car-svg { animation: wiggle 0.18s ease; }
@keyframes wiggle { 0% { transform: scale(1); } 50% { transform: scale(1.012, 0.99); } 100% { transform: scale(1); } }

/* Floating tool emoji that follows the finger */
.tool-cursor {
  position: absolute; z-index: 6; pointer-events: none;
  font-size: 2.4rem; transform: translate(-50%, -55%) rotate(-12deg);
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
  opacity: 0; transition: opacity 0.15s;
}
.tool-cursor.show { opacity: 1; }

/* Sparkle pops */
.spark {
  position: absolute; font-size: 1.6rem; pointer-events: none;
  animation: sparkUp 1s ease-out forwards;
}
@keyframes sparkUp {
  0% { transform: translateY(0) scale(0.3); opacity: 0; }
  30% { opacity: 1; transform: translateY(-8px) scale(1.1); }
  100% { transform: translateY(-40px) scale(0.6); opacity: 0; }
}

/* ------------------------------------------------------------- Progress */
.progress-wrap { margin: 16px 4px 4px; }
.progress-bar {
  height: 20px; border-radius: 999px;
  background: #e3eef6; overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.12);
}
.progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #4fc3f7, #66e08a);
  border-radius: 999px;
  transition: width 0.25s ease;
}

/* --------------------------------------------------------------- Toolbar */
.toolbar {
  display: flex; justify-content: center; gap: 16px;
  margin-top: 16px;
}
.tool {
  width: 62px; height: 62px; border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.9rem;
  background: #f0f6fb; border: 3px solid #dcebf7;
  box-shadow: 0 4px 0 #cdd9e3;
  opacity: 0.55; transition: all 0.2s;
  position: relative;
}
.tool.active {
  opacity: 1; transform: translateY(-4px) scale(1.08);
  background: linear-gradient(180deg, #fff3e0, #ffe0b2);
  border-color: var(--color-accent);
  box-shadow: 0 6px 0 #e69a4a, 0 8px 16px rgba(255,138,61,0.35);
  animation: bob 0.9s ease-in-out infinite alternate;
}
.tool.done {
  opacity: 1; background: #e7f9ee; border-color: #66e08a;
  box-shadow: 0 4px 0 #9bd9b0;
}
.tool.done::after {
  content: "✓"; position: absolute; top: -8px; right: -8px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #43c463; color: #fff; font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
@keyframes bob { from { transform: translateY(-4px) scale(1.08); } to { transform: translateY(-9px) scale(1.08); } }

/* ------------------------------------------------------------- Decorate */
.decorate-panel {
  margin-top: 14px;
  background: linear-gradient(180deg, #fff8f0 0%, #ffeede 100%);
  border: 2px solid #ffd9b3; border-radius: 18px;
  padding: 14px 14px 16px;
  animation: slideUp 0.35s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.deco-section { margin-bottom: 12px; }
.deco-title { font-weight: 800; color: var(--color-dark); margin-bottom: 8px; font-size: 1.05rem; }
.deco-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

.swatch {
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  border: 3px solid #fff; box-shadow: 0 3px 6px rgba(0,0,0,0.18);
  transition: transform 0.12s;
}
.swatch:hover { transform: scale(1.12); }
.swatch:active { transform: scale(0.95); }

.sticker-btn {
  width: 46px; height: 46px; border-radius: 14px; cursor: pointer;
  font-size: 1.5rem; background: #fff; border: 2px solid #ffd9b3;
  box-shadow: 0 3px 0 #f0c89a; transition: transform 0.12s;
}
.sticker-btn:hover { transform: translateY(-2px); }
.sticker-btn.sel { background: #fff0d6; border-color: var(--color-accent); transform: translateY(-3px) scale(1.08); box-shadow: 0 5px 0 #e69a4a; }

.finish-btn { display: block; margin: 6px auto 0; }

/* ------------------------------------------------------------------- HUD */
.hud {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin: 14px auto 0; flex-wrap: wrap;
}
.hud-pill {
  background: rgba(255,255,255,0.9); border-radius: 999px;
  padding: 8px 18px; font-weight: 800; color: var(--color-dark);
  box-shadow: 0 4px 10px rgba(0,0,0,0.12); font-size: 1.05rem;
}
.icon-btn {
  background: rgba(255,255,255,0.9); border: none; cursor: pointer;
  width: 46px; height: 46px; border-radius: 50%; font-size: 1.4rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}
.icon-btn:active { transform: scale(0.92); }

#coins-pill.bump { animation: coinBump 0.5s ease; }
@keyframes coinBump {
  0% { transform: scale(1); }
  35% { transform: scale(1.22); background: #fff4cc; }
  100% { transform: scale(1); }
}

/* ------------------------------------------------------------ Win modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(13, 58, 92, 0.55);
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.active { display: flex; }
.win-modal {
  background: #fff; border-radius: 28px; padding: 30px 26px;
  text-align: center; max-width: 360px; width: 100%;
  box-shadow: 0 20px 50px rgba(0,0,0,0.35);
  animation: pop 0.4s cubic-bezier(.18,.89,.32,1.28);
  border: 5px solid var(--color-accent2);
}
@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.win-modal .big-emoji { font-size: 3.6rem; display: block; margin-bottom: 6px; }
.win-modal h2 { color: var(--color-accent); font-size: 1.8rem; margin-bottom: 8px; }
.win-modal p { font-weight: 600; margin-bottom: 18px; color: #355; }

.play-btn {
  font-family: var(--font); font-weight: 800; font-size: 1.2rem;
  color: #fff; border: none; cursor: pointer;
  padding: 14px 28px; border-radius: 999px;
  background: linear-gradient(180deg, #ff9f4d, #ff7a1a);
  box-shadow: 0 6px 0 #d9620d, 0 8px 18px rgba(255,122,26,0.4);
  transition: transform 0.1s;
}
.play-btn:active { transform: translateY(3px); box-shadow: 0 3px 0 #d9620d; }

/* ----------------------------------------------------------- About card */
.about-app { max-width: 720px; margin: 22px auto 0; padding: 0 16px; }
.ab-card {
  background: rgba(255,255,255,0.92); border-radius: 22px;
  padding: 22px 24px; box-shadow: 0 10px 26px rgba(13,58,92,0.18);
}
.ab-card h2 { color: var(--color-dark); margin-bottom: 10px; }
.ab-card p { color: #2c4a60; line-height: 1.55; margin-bottom: 10px; font-weight: 500; }

@media (max-width: 480px) {
  .tool { width: 54px; height: 54px; font-size: 1.6rem; }
  .toolbar { gap: 12px; }
}
