/* ==========================================================
   Drawing Focus – calm, soft, focused
   The white coloring page is the brightest thing on screen;
   everything around it is muted so attention stays on coloring.
   ========================================================== */
:root {
  --ink: #3a3557;
  --card: #ffffff;
  --mist: #f4f2f8;
  --calm: #8f86c9;
  --calm-deep: #6f66ad;
  --sage: #9fd3b8;
  --sky: #a9d6ee;
  --peach: #f7c9a8;
  --butter: #f6e3a1;
  --radius: 26px;
  --soft-shadow: 0 8px 24px rgba(40, 34, 80, 0.14);
  --font: 'Fredoka', 'Baloo 2', system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  /* the same calm night sky as the welcome – the white page is the only bright thing */
  background: radial-gradient(ellipse at 50% 30%, #13224f 0%, #0d1838 60%, #091129 100%);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button { font-family: inherit; color: inherit; cursor: pointer; }
h1, h2 { margin: 0.2em 0; line-height: 1.15; font-weight: 600; }
h2 { font-size: clamp(1.5rem, 4.4vw, 1.9rem); }
.lead { font-size: clamp(1.05rem, 3vw, 1.2rem); line-height: 1.45; margin: 0.4em 0 1em; }
.small { font-size: 1rem; }
.muted { opacity: 0.65; }
.row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 12px 0; }

#bg-deco { display: none; }
#bg-deco i { position: absolute; animation: drift linear infinite; opacity: 0.18; }
#bg-deco .emo { font-size: clamp(24px, 4vw, 40px); font-style: normal; }
@keyframes drift { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(16px, -24px); } }
/* a still, softly twinkling star field behind the coloring page */
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0.5;
  background-image:
    radial-gradient(1.6px 1.6px at 22px 34px, #fff, transparent), radial-gradient(1px 1px at 128px 84px, #fff, transparent),
    radial-gradient(1.3px 1.3px at 206px 168px, #fff, transparent), radial-gradient(1px 1px at 64px 214px, #fff, transparent),
    radial-gradient(1.6px 1.6px at 266px 44px, #fff, transparent), radial-gradient(1px 1px at 300px 252px, #fff, transparent),
    radial-gradient(1.2px 1.2px at 90px 120px, #fff, transparent), radial-gradient(1.8px 1.8px at 380px 300px, #fff, transparent),
    radial-gradient(1px 1px at 420px 60px, #fff, transparent), radial-gradient(1.4px 1.4px at 180px 360px, #fff, transparent);
  background-size: 320px 280px, 320px 280px, 320px 280px, 320px 280px, 320px 280px, 320px 280px, 470px 390px, 470px 390px, 470px 390px, 470px 390px;
  animation: star-field 7s ease-in-out infinite;
}
@keyframes star-field { 50% { opacity: 0.3; } }
#app { position: relative; z-index: 1; min-height: 100dvh; display: flex; flex-direction: column; }

/* ---------- buttons ---------- */
.btn {
  --b: var(--butter);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 3px solid var(--ink); border-radius: 999px; background: var(--b);
  font-weight: 600; font-size: 1.1rem; padding: 12px 24px; box-shadow: 0 3px 0 var(--ink);
  transition: transform 0.1s, box-shadow 0.1s; text-decoration: none; color: var(--ink);
  user-select: none; min-height: 52px;
}
.btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.btn-big { font-size: clamp(1.2rem, 3.4vw, 1.4rem); padding: 14px 38px; margin-top: 6px; }
.btn-calm { --b: var(--calm); color: #fff; }
.btn-yellow { --b: var(--butter); }
.btn-blue { --b: var(--sky); }
.btn-orange { --b: var(--peach); }
.btn-green { --b: var(--sage); }
.btn-purple { --b: var(--calm); color: #fff; }
.btn-mini { min-height: 38px; padding: 4px 14px; font-size: 0.95rem; }
.btn-ghost { background: transparent; border: none; font-weight: 600; text-decoration: underline; padding: 10px; }
.icon-btn {
  width: 46px; height: 46px; display: grid; place-items: center; font-size: 1.2rem;
  background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 14px;
}
.icon-btn:active { transform: scale(0.94); }

/* ---------- quiet corner (stars / pictures / sound) ---------- */
.corner { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 5; display: flex; gap: 8px; align-items: center; opacity: 0.6; color: #e9e6f5; }
.chip {
  display: flex; align-items: center; gap: 4px; height: 46px; padding: 0 14px; font-size: 1.1rem;
  background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 999px;
}
.chip.bump { animation: bump 0.5s; }
@keyframes bump { 40% { transform: scale(1.15); } }
.mini-logo { position: fixed; right: 14px; bottom: 10px; z-index: 2; font-size: 0.8rem; font-weight: 500; color: #e9e6f5; opacity: 0.25; text-decoration: none; }

/* ---------- coloring screen ---------- */
:root { --size: min(94vw, calc(100dvh - 270px), 720px); }
.main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; justify-content: safe center; padding: 72px 12px 30px; gap: 8px; }
.title-pill { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; font-size: clamp(1.05rem, 3vw, 1.3rem); color: #e9e6f5; opacity: 0.7; }
.title-pill b { font-weight: 600; }
.title-pill small { font-weight: 500; opacity: 0.7; }
.board { display: flex; flex-direction: column; align-items: center; gap: 14px; width: var(--size); min-width: 300px; }
.canvas-card { width: 100%; background: var(--card); border-radius: var(--radius); box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 20px 60px rgba(0, 0, 0, 0.45); padding: 10px; }
.progress { width: 50%; margin: 2px auto 0; height: 5px; border-radius: 999px; overflow: hidden; background: #f0eef6; }
.progress-fill { height: 100%; width: 0; transition: width 0.6s; background: linear-gradient(90deg, var(--sage), var(--sky), var(--calm)); }
.canvas-wrap { position: relative; width: 100%; aspect-ratio: 1; margin-top: 4px; }
.canvas { width: 100%; height: 100%; display: block; touch-action: none; user-select: none; -webkit-user-select: none; }
.canvas[data-tool='fill'] .fillable { cursor: pointer; }
.canvas[data-tool='crayon'] { cursor: crosshair; }
.canvas:not([data-tool='eraser']) .stroke-layer { pointer-events: none; }
.canvas[data-tool='crayon'] .fillable { pointer-events: none; }
.shape { transform-box: fill-box; transform-origin: center; }
.shape.pop { animation: shape-pop 0.4s ease-out; }
@keyframes shape-pop { 40% { transform: scale(1.03); } }
.ripple { animation: ripple 0.8s ease-out forwards; }
@keyframes ripple { to { r: 60; opacity: 0; stroke-width: 1; } }
.floaters { position: absolute; inset: 0; pointer-events: none; }
.floater { position: absolute; transform: translate(-50%, -50%); font-weight: 600; font-size: 1.2rem; color: var(--ink); white-space: nowrap; animation: float-up 1.2s ease-out forwards; }
@keyframes float-up { from { opacity: 0.9; margin-top: 0; } to { opacity: 0; margin-top: -50px; } }

.tool-panel { width: 100%; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.tool-row { display: flex; gap: 10px; justify-content: center; }
.tool {
  width: 76px; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 2px;
  font-size: 1.5rem; color: #e9e6f5; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 18px;
  transition: background 0.2s, transform 0.15s;
}
.tool small { font-size: 0.78rem; font-weight: 600; opacity: 0.8; }
.tool.active { background: #fff; color: var(--ink); border-color: #fff; }
.tool:active { transform: scale(0.95); }
.palette { display: grid; grid-template-columns: repeat(12, 1fr); gap: 8px; width: 100%; }
.swatch {
  aspect-ratio: 1; border-radius: 50%; background: var(--c); border: 3px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35); transition: transform 0.2s ease;
}
.swatch.active { transform: scale(1.18); border-color: #fff; }
.quiet-links { display: flex; gap: 10px; align-items: center; opacity: 0.45; font-size: 0.95rem; color: #e9e6f5; }
.quiet-links button { background: none; border: none; padding: 6px 4px; font-weight: 500; }
.quiet-links button:hover { text-decoration: underline; }

/* ---------- the daily adventure (welcome → breathe → reveal → choose) ----------
   A night sky: dark blue with a few stars (like from Earth). On each in-breath it slowly
   deepens into a near-black galaxy full of stars; on the out-breath it settles back. */
body.adventuring #app { visibility: hidden; } /* never flash today's picture before the reveal */
.adventure {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; overflow: auto;
  background: radial-gradient(ellipse at 50% 30%, #13224f 0%, #0d1838 60%, #091129 100%); /* dark navy night */
  color: #e6e3f3;
}
.sky { position: absolute; inset: 0; pointer-events: none; }
.sky-galaxy {
  opacity: 0; transition: opacity 4s ease-in-out;
  background: #000; /* full black on the in-breath */
}
.adventure.inhale .sky-galaxy { opacity: 1; }
.adventure.exhale .sky-galaxy { opacity: 0; }
.tw { position: absolute; border-radius: 50%; background: #fff; opacity: 0.55; animation: twinkle ease-in-out infinite; }
.tw.dim { opacity: 0.4; }
@keyframes twinkle { 50% { opacity: 0.12; } }
.adv-stage { position: relative; z-index: 1; width: 100%; display: grid; place-items: center; }
.adventure.leaving { animation: fade-out 0.6s forwards; }
@keyframes fade-out { to { opacity: 0; } }
.adv-card {
  width: min(440px, 100%); background: rgba(14, 20, 48, 0.62); border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 32px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4); padding: 24px 22px 26px; text-align: center;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.adv-card h2 { color: #f0edfa; font-weight: 500; }
.adv-card .lead { color: #cfcbe3; }
.adv-card .mascot { opacity: 0.92; }
.adventure .btn { border-color: rgba(255, 255, 255, 0.15); box-shadow: none; }
.btn-calm { --b: #5e5a9c; color: #f0edfa; }
.how-list { display: flex; flex-direction: column; gap: 10px; margin: 12px 0 18px; text-align: left; }
.how-item { display: flex; align-items: center; gap: 12px; background: rgba(255, 255, 255, 0.05); border-radius: 18px; padding: 10px 14px; }
.how-item > span { font-size: 1.7rem; }
.how-item b { display: block; font-size: 1.05rem; font-weight: 500; color: #f0edfa; }
.how-item small { font-size: 0.9rem; color: #b9b4d4; }

.power { display: flex; justify-content: center; gap: 12px; margin-bottom: 6px; }
.power span { font-size: 1.5rem; filter: grayscale(1) brightness(0.6); opacity: 0.35; transition: all 1.2s ease; }
.power span.on { filter: none; opacity: 0.95; text-shadow: 0 0 14px rgba(255, 220, 140, 0.6); }

.intro-card { min-height: 380px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.intro-dots { display: flex; gap: 8px; margin-bottom: 10px; }
.intro-dots span { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, 0.18); transition: background 0.4s; }
.intro-dots span.on { background: #c9c2ee; }
.intro-art { min-height: 150px; display: grid; place-items: center; }
.intro-emoji { font-size: 5rem; animation: float 5s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-8px); } }
.intro-card .lead { max-width: 340px; }

/* Fluffy breathes with you: bigger on the in-breath, smaller on the out-breath */
.sky-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.breathe-stage { height: 230px; display: grid; place-items: center; }
.breathe-puff .mascot { transition: transform 4s ease-in-out; }
.adventure.inhale .breathe-puff .mascot { transform: scale(1.55); }
.adventure.exhale .breathe-puff .mascot { transform: scale(1); }
.breathe-word { margin: 4px 0 0; }
.sky-spot { min-height: 1.4em; margin: 6px 0 0; font-size: 0.95rem; color: #b9b4d4; transition: opacity 0.6s; }

.mystery { width: 190px; height: 190px; margin: 10px auto 16px; perspective: 1000px; }
.mystery-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 1.1s ease; }
.mystery.flipped { width: 250px; height: 250px; transition: width 0.7s, height 0.7s; }
.mystery.flipped .mystery-inner { transform: rotateY(180deg); }
.mystery-front, .mystery-back { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 26px; display: grid; place-items: center; }
.mystery-front { background: linear-gradient(145deg, #3d4380, #2c3166); border: 1px solid rgba(255, 255, 255, 0.1); }
.mystery-front .q { font-size: 5rem; opacity: 0.85; }
.mystery-back { background: #eeecf5; transform: rotateY(180deg); }
.mystery-back svg { width: 100%; height: 100%; }
.glow .mystery-front { box-shadow: 0 0 40px rgba(200, 190, 255, 0.25); }
.wobble { animation: wobble 0.3s ease-in-out infinite; }
@keyframes wobble { 25% { transform: rotate(-2deg); } 75% { transform: rotate(2deg); } }
.key-btn { animation: breathe-btn 3s ease-in-out infinite; }
@keyframes breathe-btn { 50% { transform: scale(1.03); } }
.choose { font-weight: 500; margin: 14px 0 10px; color: #f0edfa; }
.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 8px; font-size: 1.05rem; font-weight: 500;
  color: #f0edfa; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 22px;
  transition: background 0.2s, transform 0.15s;
}
.choice span { font-size: 2.2rem; }
.choice:hover { background: rgba(255, 255, 255, 0.1); }
.choice:active { transform: scale(0.97); }
.rainbow-text { color: var(--calm-deep); }
.adv-card .rainbow-text { color: #d9cffd; }

/* ---------- modals ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(30, 26, 60, 0.45); display: grid; place-items: center; padding: 16px; animation: fade 0.3s; }
.modal {
  position: relative; width: min(480px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: #fff;
  border-radius: 32px; box-shadow: 0 20px 60px rgba(10, 10, 40, 0.3); padding: 28px clamp(16px, 4vw, 32px); text-align: center;
}
.modal-backdrop.wide .modal { width: min(800px, 100%); }
.close-x { position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--mist); font-size: 1.1rem; }
@keyframes fade { from { opacity: 0; } }
.pop-in { animation: pop-in 0.5s ease-out; }
@keyframes pop-in { from { transform: scale(0.94) translateY(10px); opacity: 0; } }

.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; margin-top: 12px; }
.gallery-card { border: 2px solid rgba(58, 53, 87, 0.15); border-radius: 20px; background: var(--mist); padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-weight: 500; }
.gallery-card img { width: 100%; aspect-ratio: 1; background: #fff; border-radius: 14px; }
.gallery-card.locked { justify-content: center; min-height: 170px; }
.lock { font-size: 2.6rem; }
.celebrate .trophy { font-size: 4rem; }
.celebrate-thumb img { width: min(240px, 65vw); border-radius: 20px; box-shadow: var(--soft-shadow); }
.print-options { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 10px; }
.print-opt { border: 2px solid rgba(58, 53, 87, 0.15); border-radius: 20px; background: var(--mist); padding: 12px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 1.05rem; }
.print-opt img { width: 100%; border-radius: 12px; background: #fff; }

/* ---------- toasts ---------- */
#toasts { position: fixed; z-index: 60; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, 0.95); border-radius: 999px; box-shadow: var(--soft-shadow); padding: 8px 22px; font-size: 1.1rem; animation: pop-in 0.4s ease-out; }
.toast.out { animation: toast-out 0.5s forwards; }
.toast-emoji { font-size: 1.6rem; }
@keyframes toast-out { to { transform: translateY(20px); opacity: 0; } }
.confetti-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 70; }

/* ---------- mascot (Fluffy the cloud) ---------- */
.mascot { display: block; margin: 0 auto; overflow: visible; }
.mascot-arm-wave { transform-origin: 136px 128px; animation: wave 1.8s ease-in-out infinite; }
.mascot-eyes { animation: blink 5s infinite; transform-origin: 80px 118px; }
@keyframes wave { 50% { transform: rotate(-18deg); } }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(0.1); } }
.wiggle { display: inline-block; }

/* ---------- phone ---------- */
@media (max-width: 640px) {
  :root { --size: min(96vw, calc(100dvh - 280px)); }
  .main { padding: 66px 8px 24px; }
  .board { min-width: 0; width: 96vw; }
  .canvas-card { padding: 6px; border-radius: 22px; }
  .palette { grid-template-columns: repeat(6, 1fr); gap: 12px; padding: 0 6px; }
  .tool { width: 68px; font-size: 1.4rem; }
  .corner { top: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
  #bg-deco { display: none; }
}

/* ---------- print ---------- */
#print-sheet { display: none; }
@media print {
  @page { size: auto; margin: 12mm; }
  body { background: #fff !important; }
  #app, #bg-deco, #toasts, #modal-root, .confetti-canvas { display: none !important; }
  #print-sheet { display: flex !important; flex-direction: column; align-items: center; gap: 10px; font-family: var(--font); color: #000; }
  .print-head { width: 100%; display: flex; justify-content: space-between; font-size: 22pt; border-bottom: 3px solid #000; padding-bottom: 6px; }
  .print-head span { font-size: 12pt; align-self: flex-end; }
  .print-art svg { width: 175mm; height: 175mm; max-width: 100%; }
  .print-foot { width: 100%; display: flex; justify-content: space-between; font-size: 12pt; margin-top: 8px; }
}
