@font-face { font-family: 'Fredoka'; src: url('../fonts/fredoka.woff2') format('woff2'); font-weight: 300 700; font-display: swap; }
:root {
  --ink: #2b2b3a; --purple: #7C5CFF; --pink: #FF5FA2; --yellow: #FFD93D; --sky: #38BDF8; --green: #22C55E;
  --card: #ffffff; --radius: 28px; --shadow: 0 8px 0 rgba(60, 40, 120, .12), 0 14px 30px rgba(60, 40, 120, .12);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Fredoka', 'Baloo 2', 'Comic Sans MS', system-ui, sans-serif; color: var(--ink);
  background: linear-gradient(160deg, #F6EEFF 0%, #E6F6FF 50%, #FFF5E1 100%) fixed; overflow-x: hidden;
  -webkit-user-select: none; user-select: none;
}
button { font-family: inherit; color: inherit; cursor: pointer; border: 0; background: none; touch-action: manipulation; }
button:focus-visible { outline: 4px solid var(--purple); outline-offset: 3px; }
.hidden { display: none !important; }

/* floating background bubbles */
.sky { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.sky span { position: absolute; border-radius: 50%; opacity: .35; filter: blur(2px); animation: float 14s ease-in-out infinite; }
.sky span:nth-child(1) { width: 180px; height: 180px; background: #FFD93D; left: -40px; top: 10%; }
.sky span:nth-child(2) { width: 120px; height: 120px; background: #FF8FC0; right: 5%; top: 6%; animation-delay: -3s; }
.sky span:nth-child(3) { width: 220px; height: 220px; background: #8EE3FF; right: -60px; top: 55%; animation-delay: -6s; }
.sky span:nth-child(4) { width: 90px; height: 90px; background: #B9F5A6; left: 12%; bottom: 8%; animation-delay: -9s; }
.sky span:nth-child(5) { width: 140px; height: 140px; background: #D2B8FF; left: 45%; top: 30%; animation-delay: -2s; }
.sky span:nth-child(6) { width: 70px; height: 70px; background: #FFB37A; left: 70%; bottom: 15%; animation-delay: -5s; }
@keyframes float { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-30px) scale(1.08); } }

/* ---------- HOME ---------- */
#home { max-width: 1240px; margin: 0 auto; padding: 14px clamp(12px, 3vw, 28px) 30px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 58px; height: 58px; filter: drop-shadow(0 4px 0 rgba(0,0,0,.1)); animation: wobble 4s ease-in-out infinite; }
@keyframes wobble { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
.brand h1 { margin: 0; font-size: clamp(28px, 5.5vw, 44px); line-height: 1; letter-spacing: .5px; color: var(--purple); font-weight: 700;
  text-shadow: 0 3px 0 #fff, 0 5px 0 rgba(124, 92, 255, .2); }
.brand h1 span { color: #F5A400; }
.tag { margin: 4px 0 0; font-size: 15px; font-weight: 500; opacity: .7; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.pill { display: flex; align-items: center; gap: 6px; background: #fff; border-radius: 999px; padding: 10px 18px; font-size: 22px; font-weight: 700; box-shadow: var(--shadow); }
.pill:active, .round-btn:active, .big-btn:active, .tool:active, .tile:active { transform: translateY(3px) scale(.97); }
.star-ico { display: inline-block; animation: twinkle 2.4s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.2) rotate(15deg); } }
.round-btn { width: 56px; height: 56px; border-radius: 50%; background: #fff; font-size: 26px; box-shadow: var(--shadow); display: grid; place-items: center; transition: transform .12s; flex: none; }
.round-btn.off { opacity: .55; filter: grayscale(1); }

.hero { text-align: center; margin: 22px 0 10px; }
.hero h2 { margin: 0 0 12px; font-size: clamp(26px, 5.5vw, 46px); font-weight: 700; }
.big-btn { font-size: 22px; font-weight: 700; padding: 14px 26px; border-radius: 999px; background: var(--yellow); box-shadow: 0 6px 0 #E0A800, 0 12px 24px rgba(224,168,0,.25); transition: transform .12s; }
.surprise { background: linear-gradient(90deg, #FF8A3D, #FF5FA2, #A35CFF); color: #fff; box-shadow: 0 6px 0 #8B3FD9, 0 12px 26px rgba(139,63,217,.3); }

.chips { position: sticky; top: 0; z-index: 5; display: flex; gap: 10px; overflow-x: auto; padding: 12px 4px; margin: 0 -4px; scrollbar-width: none;
  background: linear-gradient(180deg, rgba(246,238,255,.95) 70%, rgba(246,238,255,0)); }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 999px; background: #fff; font-size: 19px; font-weight: 600;
  box-shadow: 0 4px 0 rgba(60,40,120,.12); border: 3px solid transparent; transition: transform .12s, background .2s; }
.chip .e { font-size: 24px; }
.chip.active { background: var(--c, var(--purple)); color: #fff; box-shadow: 0 4px 0 rgba(0,0,0,.18); transform: scale(1.04); }

.section { margin: 18px 0 8px; }
.section h3 { display: flex; align-items: center; gap: 10px; font-size: clamp(22px, 4vw, 30px); margin: 0 0 12px 4px; }
.section h3 .e { font-size: 1.3em; display: inline-block; animation: bob 3s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(46%, 190px), 1fr)); gap: clamp(12px, 2.2vw, 22px); }
.tile { position: relative; background: var(--card); border-radius: var(--radius); padding: 10px 10px 12px; box-shadow: var(--shadow); text-align: center; transition: transform .18s cubic-bezier(.3,1.6,.5,1); animation: tileIn .45s both; }
.tile:hover { transform: translateY(-6px) rotate(-1.2deg); }
.tile:nth-child(even):hover { transform: translateY(-6px) rotate(1.2deg); }
@keyframes tileIn { from { opacity: 0; transform: translateY(18px) scale(.92); } }
.tile .thumb { border-radius: 20px; overflow: hidden; aspect-ratio: 1; display: block; }
.tile .thumb svg { width: 100%; height: 100%; display: block; }
.tile .name { display: block; margin-top: 8px; font-size: 18px; font-weight: 600; line-height: 1.15; }
.badge { position: absolute; top: -8px; right: -8px; width: 46px; height: 46px; border-radius: 50%; background: var(--yellow); display: grid; place-items: center; font-size: 26px;
  box-shadow: 0 4px 0 #E0A800; animation: twinkle 2.4s ease-in-out infinite; }
.badge.wip { background: #fff; box-shadow: 0 4px 0 rgba(0,0,0,.12); font-size: 22px; animation: none; }
.foot { text-align: center; margin-top: 34px; opacity: .6; font-size: 14px; }

/* ---------- STUDIO ---------- */
#studio { height: 100vh; height: 100dvh; display: flex; flex-direction: column; padding: 10px clamp(8px, 2vw, 18px) max(10px, env(safe-area-inset-bottom)); gap: 10px; }
.studio-bar { display: flex; align-items: center; gap: 12px; flex: none; }
.title-wrap { flex: 1; min-width: 0; text-align: center; }
.title-wrap h2 { margin: 0; font-size: clamp(20px, 4vw, 30px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress { height: 12px; background: #fff; border-radius: 99px; overflow: hidden; max-width: 340px; margin: 6px auto 0; box-shadow: inset 0 2px 3px rgba(0,0,0,.1); }
#progressFill { height: 100%; width: 0; background: linear-gradient(90deg, #FF5FA2, #FFD93D, #22C55E, #38BDF8, #7C5CFF); border-radius: 99px; transition: width .4s cubic-bezier(.3,1.4,.5,1); }
.progress-txt { font-size: 14px; font-weight: 600; opacity: .7; margin-top: 2px; }
.bar-right { display: flex; gap: 8px; }

.studio-body { flex: 1; min-height: 0; display: grid; gap: 12px; grid-template-columns: auto 1fr auto; grid-template-areas: "tools stage palette"; }
.tools { grid-area: tools; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; padding: 4px; scrollbar-width: none; }
.tool { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 78px; min-height: 70px; border-radius: 22px; background: #fff; box-shadow: 0 5px 0 rgba(60,40,120,.14); transition: transform .12s, background .2s; flex: none; }
.tool span { font-size: 30px; line-height: 1; }
.tool small { font-size: 14px; font-weight: 600; margin-top: 3px; }
.tool.active { background: var(--purple); color: #fff; box-shadow: 0 5px 0 #5232D6; transform: scale(1.05); }
.sizes { display: flex; flex-direction: column; gap: 6px; align-items: center; padding: 6px 0; background: rgba(255,255,255,.6); border-radius: 22px; width: 78px; }
.sizes.dim { opacity: .35; pointer-events: none; }
.size { width: 48px; height: 40px; border-radius: 14px; display: grid; place-items: center; }
.size i { display: block; border-radius: 50%; background: var(--ink); }
.size.active { background: #fff; box-shadow: 0 0 0 3px var(--purple); }

.stage-wrap { grid-area: stage; min-width: 0; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.stage { position: relative; background: #fff; border-radius: 30px; box-shadow: var(--shadow), 0 0 0 6px #fff; overflow: hidden; touch-action: none; width: 300px; height: 300px; }
.stage > * { position: absolute; inset: 0; width: 100%; height: 100%; }
#art .rg { cursor: pointer; transition: fill .25s ease; }
#paint { pointer-events: none; }
.stage.brushing #paint { pointer-events: auto; cursor: crosshair; }
#lines { pointer-events: none; }
.fx { pointer-events: none; overflow: visible; }
.ripple { position: absolute; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; border: 5px solid var(--c); animation: ripple .55s ease-out forwards; }
@keyframes ripple { to { transform: scale(6); opacity: 0; } }
.spark { position: absolute; font-size: 22px; margin: -11px 0 0 -11px; animation: spark .8s ease-out forwards; }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) scale(.4) rotate(160deg); opacity: 0; } }
.done-btn { background: var(--green); color: #fff; box-shadow: 0 6px 0 #15803D, 0 12px 24px rgba(21,128,61,.25); flex: none; }
.done-btn.ready { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }

.palette-wrap { grid-area: palette; display: flex; flex-direction: column; gap: 10px; min-height: 0; min-width: 0; }
.current { display: grid; place-items: center; background: rgba(255,255,255,.7); border-radius: 22px; padding: 8px; }
#currentBlob { width: 64px; height: 64px; border-radius: 50%; border: 5px solid #fff; box-shadow: 0 0 0 3px rgba(0,0,0,.12); transition: background .2s; animation: blob 3s ease-in-out infinite; }
@keyframes blob { 0%,100% { border-radius: 50% 46% 52% 48%; } 50% { border-radius: 44% 54% 46% 56%; } }
.palette { display: grid; grid-template-columns: repeat(3, 58px); gap: 10px; overflow-y: auto; padding: 6px; scrollbar-width: thin; align-content: start; }
.swatch { width: 58px; height: 58px; border-radius: 50%; border: 4px solid #fff; box-shadow: 0 4px 0 rgba(0,0,0,.15); transition: transform .15s cubic-bezier(.3,1.8,.5,1); position: relative; }
.swatch.white { box-shadow: 0 4px 0 rgba(0,0,0,.15), inset 0 0 0 2px #ddd; }
.swatch.active { transform: scale(1.18); box-shadow: 0 0 0 4px var(--ink), 0 4px 0 rgba(0,0,0,.2); z-index: 1; }
.swatch.magic::after { content: '✨'; position: absolute; right: -8px; top: -10px; font-size: 18px; }
.pal-label { grid-column: 1 / -1; font-size: 15px; font-weight: 700; opacity: .65; margin: 4px 0 -4px 2px; }

/* portrait / phones */
@media (max-aspect-ratio: 1/1), (max-width: 700px) {
  .studio-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto auto; grid-template-areas: "stage" "tools" "palette"; gap: 8px; }
  .tools { flex-direction: row; overflow-x: auto; overflow-y: hidden; padding: 4px 2px 8px; }
  .tool { width: 66px; min-height: 62px; border-radius: 18px; }
  .tool span { font-size: 26px; }
  .tool small { font-size: 12px; }
  .sizes { flex-direction: row; width: auto; padding: 0 6px; border-radius: 18px; }
  .size { width: 40px; }
  .palette-wrap { flex-direction: row; align-items: center; }
  .current { padding: 4px; }
  #currentBlob { width: 48px; height: 48px; }
  .palette { grid-template-columns: none; grid-auto-flow: column; grid-template-rows: repeat(2, 48px); grid-auto-columns: 48px; overflow-x: auto; overflow-y: hidden; padding: 8px 6px; flex: 1; }
  .swatch { width: 48px; height: 48px; border-width: 3px; }
  .pal-label { display: none; }
  .round-btn { width: 50px; height: 50px; font-size: 23px; }
  .done-btn { font-size: 19px; padding: 10px 22px; }
}
@media (max-width: 420px) { .tag { display: none; } .logo { width: 46px; height: 46px; } .pill { padding: 8px 14px; font-size: 19px; } }

/* ---------- MODALS ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(60, 30, 120, .35); backdrop-filter: blur(4px); padding: 16px; }
.card { position: relative; background: #fff; border-radius: 34px; padding: 24px 26px; text-align: center; box-shadow: 0 20px 60px rgba(40,20,90,.35); max-width: 520px; width: 100%; }
.card h3 { font-size: clamp(28px, 7vw, 46px); margin: 6px 0; color: var(--purple); }
.card p { font-size: 20px; margin: 4px 0 14px; font-weight: 500; }
.big-emoji { font-size: 64px; }
.row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.big-btn.yes { background: var(--green); color: #fff; box-shadow: 0 6px 0 #15803D; }
.big-btn.no { background: #EEE8FF; box-shadow: 0 6px 0 #C9BCF5; }
.big-btn.next { background: var(--sky); color: #fff; box-shadow: 0 6px 0 #0284C7; }
.pop-in { animation: popIn .5s cubic-bezier(.3,1.7,.5,1) both; }
@keyframes popIn { from { transform: scale(.3) rotate(-8deg); opacity: 0; } }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.celebrate-card { z-index: 1; }
.trophy { width: 120px; height: 120px; margin: -80px auto 0; animation: spinIn 1s cubic-bezier(.3,1.6,.5,1) both, twinkle 2s 1s ease-in-out infinite; filter: drop-shadow(0 8px 10px rgba(245,158,11,.45)); }
@keyframes spinIn { from { transform: scale(0) rotate(-360deg); } }
#celebrateTitle { background: linear-gradient(90deg, #FF5FA2, #FF9F1C, #22C55E, #38BDF8, #7C5CFF); -webkit-background-clip: text; background-clip: text; color: transparent; animation: bounceT 1s ease-in-out infinite; }
@keyframes bounceT { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
#celebrateThumb { width: min(220px, 50vw); aspect-ratio: 1; border-radius: 22px; box-shadow: 0 0 0 6px #FFF3B0, 0 10px 24px rgba(0,0,0,.15); background: #fff; }
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 10px; max-height: 50vh; overflow-y: auto; padding: 8px; }
.sticker { aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; font-size: 34px; background: #F3F0FF; position: relative; }
.sticker.got { background: radial-gradient(circle at 35% 30%, #FFF6B8, #FFD93D); box-shadow: 0 4px 0 #E0A800; }
.sticker.got::after { content: '⭐'; position: absolute; right: -4px; bottom: -4px; font-size: 20px; }
.sticker:not(.got) { filter: grayscale(1); opacity: .35; }

#printArea { display: none; }
@media print {
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block !important; text-align: center; }
  #printImg { width: 100%; max-width: 18cm; }
  body { background: #fff; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

@media (max-height: 820px) and (min-aspect-ratio: 1/1) and (min-width: 701px) {
  .tool { min-height: 56px; width: 72px; } .tool span { font-size: 25px; } .tool small { font-size: 12px; }
  .sizes { width: 72px; flex-direction: row; justify-content: center; gap: 1px; padding: 4px 2px; } .size { width: 22px; height: 32px; } .size i { transform: scale(.7); }
  .tools { gap: 6px; }
  .palette { grid-template-columns: repeat(3, 50px); gap: 8px; } .swatch { width: 50px; height: 50px; } #currentBlob { width: 50px; height: 50px; }
}

.grownups { display: inline-block; margin-top: 8px; color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
/* grown-ups page */
.doc { max-width: 760px; margin: 0 auto; padding: 18px 18px 40px; -webkit-user-select: text; user-select: text; }
.doc .card { text-align: left; max-width: none; margin: 16px 0; padding: 22px 26px; }
.doc h1 { font-size: clamp(30px, 6vw, 44px); margin: 10px 0 0; color: var(--purple); }
.doc h1 span { color: #F5A400; }
.doc h2 { font-size: 26px; margin: 0 0 8px; color: var(--purple); }
.doc p, .doc li { font-size: 18px; line-height: 1.55; }
.doc .card p { font-size: 18px; margin: 0 0 10px; }
.doc .back { display: inline-block; margin-top: 8px; }
.doc a { color: #5232D6; }
.doc a.big-btn { color: var(--ink); text-decoration: none; }
