:root {
  --pink: #ff6fa5;
  --purple: #8b5cf6;
  --blue: #38bdf8;
  --green: #34d399;
  --yellow: #fbbf24;
  --orange: #fb923c;
  --red: #ef4444;
  --ink: #2b2140;
  --paper: #fffdf7;
  --sky: #e0f2fe;
  --card: #ffffff;
  --shadow: 0 8px 0 rgba(43, 33, 64, 0.18);
  --radius: 24px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Baloo 2', 'Comic Sans MS', system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, #ffe9f3 0, transparent 45%),
    radial-gradient(circle at 90% 10%, #e8f4ff 0, transparent 40%),
    radial-gradient(circle at 50% 100%, #fff6dd 0, transparent 45%),
    var(--paper);
  min-height: 100vh;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 22px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 4px dashed #ffd6e7;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.4rem; }
.brand-emoji { font-size: 1.9rem; animation: bob 2.4s ease-in-out infinite; }
.brand-text {
  background: linear-gradient(90deg, var(--pink), var(--purple), var(--blue));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }

.nav-btn {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  padding: 9px 16px;
  border-radius: 999px;
  border: 3px solid transparent;
  background: #f3e8ff;
  color: #5b3fa8;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s, border-color 0.2s;
}
.nav-btn:hover { transform: translateY(-3px) rotate(-1.5deg); background: #e9d5ff; }
.nav-btn.active { background: var(--purple); color: #fff; border-color: #4c1d95; }

.sound-toggle {
  font-size: 1.3rem;
  background: #fff3cd;
  border: 3px solid #fde68a;
  border-radius: 14px;
  cursor: pointer;
  padding: 4px 10px;
}
.sound-toggle.off { opacity: 0.45; }

/* ---------- Layout ---------- */
main { max-width: 1000px; margin: 0 auto; padding: 26px 20px 80px; }

.view { display: none; animation: pop 0.35s ease both; }
.view.active { display: block; }

@keyframes pop {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.section-title {
  font-size: 2.1rem;
  margin: 6px 0;
  text-align: center;
}
.section-sub { text-align: center; margin-top: 0; color: #6b6382; font-size: 1.05rem; }

/* ---------- Hero ---------- */
.hero { text-align: center; padding-top: 10px; }
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  margin: 10px 0 6px;
  color: #7c3aed;
  text-shadow: 3px 3px 0 #ffe0f0;
}
.subtitle { font-size: 1.15rem; color: #6b6382; max-width: 620px; margin: 0 auto 28px; }

.hero-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 20px;
  margin-top: 10px;
}

.big-card {
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 26px 18px;
  border-radius: var(--radius);
  border: 4px solid #fff;
  background: var(--card);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.big-card:hover {
  transform: translateY(-8px) rotate(-1.5deg) scale(1.03);
  box-shadow: 0 14px 0 rgba(43, 33, 64, 0.16);
}
.card-emoji { font-size: 3rem; line-height: 1; }
.card-title { font-size: 1.5rem; font-weight: 800; }
.card-desc { font-size: 0.95rem; color: #7b7490; }

.card-shapes { background: linear-gradient(160deg, #dbeafe, #bfdbfe); }
.card-colors { background: linear-gradient(160deg, #fce7f3, #fbcfe8); }
.card-draw   { background: linear-gradient(160deg, #dcfce7, #bbf7d0); }
.card-quiz   { background: linear-gradient(160deg, #fef3c7, #fde68a); }

/* ---------- Shapes ---------- */
.shape-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 16px;
  margin: 22px 0 28px;
}

.shape-tile {
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 10px;
  border-radius: 20px;
  border: 3px solid #fff;
  background: #fff;
  box-shadow: 0 6px 0 rgba(43, 33, 64, 0.12);
  cursor: pointer;
  transition: transform 0.2s;
}
.shape-tile:hover { transform: translateY(-6px) rotate(2deg); }
.shape-tile svg { width: 64px; height: 64px; transition: transform 0.4s ease; }
.shape-tile.spin svg { transform: rotate(360deg); }
.shape-name { font-weight: 700; font-size: 1.05rem; }

.shape-canvas-wrap { position: relative; }
#shapeStage {
  width: 100%;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #eef7ff, #fdf4ff);
  border: 4px dashed #c7d2fe;
  display: block;
  cursor: pointer;
}
.hint { text-align: center; color: #8b829e; font-size: 0.95rem; }

/* ---------- Colors ---------- */
.rainbow {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 24px 0 34px;
  flex-wrap: wrap;
}
.rainbow-band {
  width: 78px;
  height: 130px;
  border-radius: 40px 40px 14px 14px;
  border: 4px solid #fff;
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(43, 33, 64, 0.14);
  transition: transform 0.2s, filter 0.2s;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 10px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.35);
}
.rainbow-band:hover { transform: translateY(-8px) scale(1.05); filter: brightness(1.08); }
.rainbow-band.lit { animation: bob 0.7s ease 2; }

.mixer {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 8px 0 rgba(43, 33, 64, 0.1);
  border: 4px solid #fff7e6;
}
.mixer h3 { margin: 0 0 4px; text-align: center; font-size: 1.6rem; }
.mix-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 18px 0;
}
.mix-pick { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.mix-label { font-weight: 700; color: #7b7490; }
.swatch-current {
  width: 74px; height: 74px;
  border-radius: 18px;
  border: 4px solid #fff;
  box-shadow: 0 4px 0 rgba(43, 33, 64, 0.16), inset 0 0 0 2px #eee;
  transition: background 0.4s;
}
.swatch-current.big { width: 96px; height: 96px; }
.mix-plus { font-size: 2rem; font-weight: 800; color: #a78bfa; }

.mix-palette { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.mix-dot {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 3px solid #fff;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(43,33,64,0.15);
  transition: transform 0.15s;
}
.mix-dot:hover { transform: scale(1.15); }
.mix-dot.selected { outline: 4px solid #8b5cf6; outline-offset: 2px; }

/* ---------- Draw ---------- */
.draw-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  margin: 16px 0;
}
.tool-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.color-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 3px solid #fff;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(43,33,64,0.18);
  transition: transform 0.15s;
}
.color-btn:hover { transform: scale(1.12); }
.color-btn.selected { outline: 4px solid #8b5cf6; outline-offset: 2px; }
.tool-btn {
  font-family: inherit;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 14px;
  border: 3px solid #ede9fe;
  background: #f8f5ff;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s;
}
.tool-btn:hover { transform: translateY(-2px); background: #ede9fe; }
.tool-btn.selected { background: #8b5cf6; color: #fff; border-color: #6d28d9; }

#drawPad {
  width: 100%;
  border-radius: var(--radius);
  background: #fff;
  border: 4px solid #e9d5ff;
  box-shadow: 0 8px 0 rgba(43, 33, 64, 0.1);
  touch-action: none;
  cursor: crosshair;
  display: block;
}

/* ---------- Quiz ---------- */
.quiz-card {
  max-width: 640px;
  margin: 24px auto;
  background: #fff;
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: 0 10px 0 rgba(43,33,64,0.12);
  border: 4px solid #fff6dd;
}
.quiz-top { display: flex; justify-content: space-between; font-weight: 700; color: #8b829e; }
.quiz-score { color: #f59e0b; }
.quiz-prompt {
  font-size: 1.5rem;
  font-weight: 800;
  text-align: center;
  margin: 22px 0;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.quiz-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
}
.quiz-opt {
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 18px 12px;
  border-radius: 18px;
  border: 4px solid #e0e7ff;
  background: #f5f7ff;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s, border-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.quiz-opt:hover:not(:disabled) { transform: translateY(-4px); background: #eef2ff; }
.quiz-opt.correct { background: #dcfce7; border-color: #34d399; }
.quiz-opt.wrong { background: #fee2e2; border-color: #ef4444; }
.quiz-opt:disabled { cursor: default; }
.quiz-opt svg { width: 40px; height: 40px; }

.quiz-feedback { text-align: center; font-size: 1.2rem; font-weight: 800; min-height: 34px; margin-top: 16px; }
.restart-btn {
  display: block;
  margin: 18px auto 0;
  font-family: inherit;
  font-size: 1.2rem;
  font-weight: 800;
  padding: 14px 30px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(90deg, #8b5cf6, #ec4899);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 0 #6d28d9;
}
.restart-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #6d28d9; }
.hidden { display: none !important; }

/* ---------- Confetti ---------- */
.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(720deg); opacity: 0.9; }
}

@media (max-width: 620px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .nav { margin-left: 0; order: 3; width: 100%; justify-content: center; }
  .nav-btn { font-size: 0.85rem; padding: 7px 11px; }
  .brand { font-size: 1.15rem; }
  .rainbow-band { width: 56px; height: 100px; }
  .mix-row { gap: 8px; }
  .swatch-current { width: 56px; height: 56px; }
  .swatch-current.big { width: 72px; height: 72px; }
}
