:root {
  --ink: #3b2418;
  --card: #fffdf8;
  --pink: #ff7eb6;
  --blue: #5ab0ff;
  --green: #4cc98a;
  --yellow: #ffc83d;
  --purple: #a08cff;
  --font: "Baloo 2", "Chalkboard SE", "Comic Sans MS", "Comic Neue", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font); color: var(--ink); font-size: 20px; font-weight: 600;
  background: linear-gradient(180deg, #bfe4ff 0%, #e4d4ff 55%, #ffd9ec 100%) fixed;
  display: flex; justify-content: center; overflow-x: hidden;
}
body.parent { background: linear-gradient(180deg, #d9ebf5 0%, #e8e4f2 60%, #f3e6ea 100%) fixed; }
body.parent .bear-wrap { animation-duration: 6s; }
body.parent .btn, body.parent .card { box-shadow: 0 3px 0 rgba(59, 36, 24, .18); }

/* Sky decoration */
.sky { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.cloud { position: absolute; width: 130px; height: 44px; background: #fff; border-radius: 40px; opacity: .85; animation: drift 40s linear infinite; }
.cloud::before, .cloud::after { content: ""; position: absolute; background: #fff; border-radius: 50%; }
.cloud::before { width: 60px; height: 60px; top: -30px; left: 20px; }
.cloud::after { width: 46px; height: 46px; top: -20px; left: 68px; }
.c1 { top: 8%; left: -160px; }
.c2 { top: 28%; left: -160px; animation-duration: 55s; animation-delay: -20s; transform: scale(.7); }
.c3 { top: 60%; left: -160px; animation-duration: 70s; animation-delay: -45s; transform: scale(.9); opacity: .6; }
.star { position: absolute; font-size: 26px; animation: twinkle 2.5s ease-in-out infinite; }
.s1 { top: 6%; left: 12%; } .s2 { top: 14%; right: 10%; animation-delay: .6s; }
.s3 { top: 46%; left: 5%; animation-delay: 1.2s; } .s4 { top: 72%; right: 6%; animation-delay: 1.8s; }
@keyframes drift { to { transform: translateX(calc(100vw + 320px)); } }
@keyframes twinkle { 50% { transform: scale(1.35) rotate(15deg); opacity: .6; } }

/* Phone frame */
.phone {
  position: relative; width: 100%; max-width: 430px; min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; padding: 14px 16px 24px;
}
@media (min-width: 560px) {
  body { align-items: center; padding: 24px 0; }
  .phone { min-height: 0; height: min(860px, calc(100vh - 48px)); overflow-y: auto; border-radius: 40px;
    background: rgba(255, 255, 255, .35); border: 6px solid #fff; box-shadow: 0 20px 60px rgba(90, 60, 160, .3); }
}

/* Paw trail */
.trail { display: flex; justify-content: center; gap: 6px; padding: 4px 0 8px; }
.paw { font-size: 26px; filter: grayscale(1); opacity: .35; transition: .4s; }
.paw.on { filter: none; opacity: 1; transform: scale(1.15) rotate(-10deg); }

/* Bear and bubble */
.stage { display: flex; flex-direction: column; align-items: center; }
.bear-wrap { width: 170px; animation: idle 3.2s ease-in-out infinite; transform-origin: 50% 100%; }
.bear { width: 100%; height: auto; overflow: visible; }
.eye { transform-box: fill-box; transform-origin: center; animation: blink 4.5s infinite; }
.arm-wave { transform-box: fill-box; transform-origin: 50% 90%; animation: wave 1s ease-in-out infinite; }
.arm-wave.alt { animation-direction: reverse; }
@keyframes idle { 0%, 100% { transform: translateY(0) rotate(-1.5deg); } 50% { transform: translateY(-8px) rotate(1.5deg); } }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }
@keyframes wave { 0%, 100% { transform: rotate(-12deg); } 50% { transform: rotate(18deg); } }

.bubble {
  position: relative; margin-top: 14px; width: 100%; background: #fff; border: 4px solid var(--ink);
  border-radius: 28px; padding: 14px 18px; font-size: 22px; line-height: 1.25; text-align: center;
  box-shadow: 0 6px 0 rgba(59, 36, 24, .2); min-height: 72px;
}
.bubble::before, .bubble::after { content: ""; position: absolute; left: 50%; margin-left: -14px; border: 14px solid transparent; }
.bubble::before { top: -32px; border-bottom-color: var(--ink); }
.bubble::after { top: -24px; border-bottom-color: #fff; }

/* Panel and buttons */
.panel { margin-top: 18px; display: flex; flex-direction: column; gap: 14px; animation: pop .4s ease; }
@keyframes pop { from { transform: scale(.92); opacity: 0; } }
.card { background: var(--card); border: 4px solid var(--ink); border-radius: 26px; padding: 16px; box-shadow: 0 6px 0 rgba(59, 36, 24, .2); }
.btn {
  font: inherit; font-weight: 800; font-size: 22px; color: var(--ink); min-height: 64px; min-width: 64px;
  padding: 10px 20px; border: 4px solid var(--ink); border-radius: 999px; background: var(--yellow);
  box-shadow: 0 6px 0 var(--ink); cursor: pointer; transition: transform .12s;
}
.btn:hover, .btn:focus-visible { animation: wobble .5s; }
.btn:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--ink); }
.btn:focus-visible, input:focus-visible, textarea:focus-visible { outline: 5px solid var(--blue); outline-offset: 3px; }
.btn.go { background: var(--green); } .btn.soft { background: #fff; } .btn.pink { background: var(--pink); }
.btn:disabled { opacity: .6; cursor: wait; }
@keyframes wobble { 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }

.field { width: 100%; font: inherit; font-size: 28px; font-weight: 800; text-align: center; letter-spacing: 2px; min-height: 72px;
  border: 4px solid var(--ink); border-radius: 22px; padding: 8px 12px; background: #fff; color: var(--ink); text-transform: uppercase; }
textarea.field { text-transform: none; letter-spacing: 0; font-size: 22px; text-align: left; min-height: 140px; resize: vertical; }
.label { margin: 0 0 8px; font-size: 18px; text-align: center; }
.demo { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; font-size: 15px; }
.demo .btn { font-size: 15px; min-height: 64px; padding: 6px 12px; box-shadow: 0 4px 0 var(--ink); }

/* Option grids */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.opt {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 104px; padding: 10px 6px;
  font: inherit; font-weight: 800; font-size: 18px; line-height: 1.1; color: var(--ink); background: #fff;
  border: 4px solid var(--ink); border-radius: 24px; box-shadow: 0 6px 0 var(--ink); cursor: pointer; text-align: center;
}
.opt:hover, .opt:focus-visible { animation: wobble .5s; }
.opt:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--ink); }
.opt:focus-visible { outline: 5px solid var(--blue); outline-offset: 3px; }
.opt .emoji { font-size: 44px; line-height: 1; }
.opt[aria-pressed="true"] { background: var(--yellow); transform: scale(1.04); }
.opt[aria-pressed="true"]::after { content: "✔"; position: absolute; }
.opt { position: relative; }
.opt[aria-pressed="true"]::after { top: 4px; right: 10px; color: var(--green); font-size: 24px; }
.opt .face-svg { width: 84px; height: 84px; }
.grid.one { grid-template-columns: 1fr; }
.grid.one .opt { flex-direction: row; justify-content: flex-start; gap: 16px; padding-left: 20px; font-size: 22px; }
.actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* States */
.loading { text-align: center; font-size: 22px; }
.loading .dots span { display: inline-block; animation: hop 1s infinite; }
.loading .dots span:nth-child(2) { animation-delay: .15s; } .loading .dots span:nth-child(3) { animation-delay: .3s; }
@keyframes hop { 50% { transform: translateY(-10px); } }
.oops { text-align: center; }

/* Celebration */
.sticker { display: grid; place-items: center; width: 150px; height: 150px; margin: 0 auto; border-radius: 50%; border: 5px solid var(--ink);
  background: radial-gradient(circle at 30% 30%, #fff6b0, var(--yellow)); font-size: 76px; box-shadow: 0 6px 0 var(--ink); animation: spin-in .8s ease-out, idle 3s ease-in-out .8s infinite; }
@keyframes spin-in { from { transform: scale(0) rotate(-360deg); } }
.brave { font-size: 34px; font-weight: 800; text-align: center; margin: 0; color: #d6336c; text-shadow: 2px 2px 0 #fff; }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.confetti i { position: absolute; top: -20px; width: 12px; height: 18px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .confetti { display: none; }
}
.field[type=date] { letter-spacing: 0; font-size: 30px; }
