* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: #5E7F45;
  overscroll-behavior: none; touch-action: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  font-family: -apple-system, "Helvetica Neue", Arial, sans-serif;
}
#backdrop {
  position: fixed; inset: -40px; background-size: cover; background-position: center;
  filter: blur(24px) saturate(0.9); transition: opacity .8s;
}
#stage {
  position: fixed; left: 50%; top: 50%; width: 1200px; height: 800px;
  transform-origin: 0 0; overflow: hidden; touch-action: none;
}
#bg {
  position: absolute; inset: 0; background-size: cover; background-position: center;
  transform-origin: 50% 62%; transition: transform 1.2s ease-in-out;
}
#world { position: absolute; inset: 0; }
#dim { position: absolute; inset: 0; background: #1d2a44; opacity: 0; pointer-events: none; transition: opacity 2.5s ease; }

.spr { position: absolute; display: block; pointer-events: none; -webkit-user-drag: none; }
.spr.touch { pointer-events: auto; }
.box { position: absolute; }
.box > img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; -webkit-user-drag: none; }

/* gentle paper-puppet idle */
@keyframes bob { 0%,100% { transform: translateY(0) rotate(0) } 50% { transform: translateY(-5px) rotate(.6deg) } }
.bob { animation: bob 3.2s steps(6, end) infinite; transform-origin: 50% 100%; }
@keyframes pulse { 0%,100% { transform: scale(1) } 50% { transform: scale(1.08) } }
.pulse { animation: pulse 1.1s ease-in-out infinite; }
@keyframes glow { 0%,100% { filter: drop-shadow(0 0 0 rgba(255,236,170,0)) } 50% { filter: drop-shadow(0 0 22px rgba(255,236,170,.95)) } }
.glow { animation: glow 2s ease-in-out infinite; }

.shadow-slot { position: absolute; filter: brightness(0); opacity: .16; pointer-events: none; }
.mat { position: absolute; background: #9a6a48; border-radius: 22px; box-shadow: inset 0 0 0 7px #84563a, 0 4px 0 rgba(60,35,15,.25); }
.drip { position: absolute; width: 16px; height: 22px; background: #8DB1CC; border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%; opacity: .95; pointer-events: none; }
.bubble { position: absolute; border-radius: 50%; background: rgba(255,255,255,.75); box-shadow: inset -3px -3px 0 rgba(141,177,204,.5); pointer-events: none; }
.blob { position: absolute; border-radius: 50%; background: #6b4129; pointer-events: none; }
.confetti { position: absolute; width: 16px; height: 16px; border-radius: 4px; pointer-events: none; }

#hand { position: absolute; width: 84px; height: auto; left: 0; top: 0; opacity: 0; pointer-events: none; z-index: 50;
  filter: drop-shadow(0 4px 4px rgba(0,0,0,.25)); }

/* grown-ups corner: small, quiet, needs a long press */
#grown { position: absolute; right: 84px; top: 18px; width: 64px; height: 64px; border: 0; background: none; padding: 0; z-index: 60; touch-action: none; }
#grown span { display: block; width: 30px; height: 30px; margin: 17px; border-radius: 50%;
  background: rgba(243,231,207,.55); box-shadow: 0 0 0 3px rgba(243,231,207,.25); }
#grown.holding span { transition: transform 1.5s linear, background 1.5s linear; transform: scale(1.9); background: rgba(232,178,58,.95); }
#grown.moon { right: auto; left: 925px; top: 55px; width: 200px; height: 200px; }
#grown.moon span { width: 150px; height: 150px; margin: 25px; background: rgba(243,231,207,0); box-shadow: none; }
#grown.moon.holding span { transform: scale(1.1); background: rgba(243,231,207,.3); }

[hidden] { display: none !important; }
#panel, #gate { position: fixed; inset: 0; z-index: 100; background: rgba(29,42,68,.55); display: flex; align-items: center; justify-content: center; touch-action: auto; }
.card { background: #F3E7CF; color: #3b2f25; border-radius: 26px; padding: 26px 30px; width: min(520px, 90vw); max-height: 92vh; overflow-y: auto;
  -webkit-overflow-scrolling: touch; touch-action: pan-y; overscroll-behavior: contain; box-shadow: 0 10px 0 rgba(0,0,0,.18); }
.card h1 { margin: 0 0 14px; font-size: 24px; }
.card h2 { margin: 20px 0 4px; padding-top: 14px; border-top: 3px dotted rgba(138,90,60,.35); font-size: 15px; letter-spacing: .06em; text-transform: uppercase; color: #8A5A3C; }
.card label { display: flex; align-items: center; gap: 12px; font-size: 19px; padding: 9px 0; min-height: 48px; }
.card label small { display: block; font-size: 14px; opacity: .7; }
.card input { flex: none; width: 26px; height: 26px; accent-color: #D4553A; }
.card .row { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 4px; }
.card button { flex: 1 1 130px; min-height: 56px; font: inherit; font-size: 17px; font-weight: 600; padding: 12px 10px; border: 0; border-radius: 16px; background: #8FA65B; color: #fff;
  box-shadow: 0 4px 0 rgba(60,40,20,.18); }
.card button.warm { background: #D4553A; }
.card button.plain { background: #fff8e6; color: #3b2f25; }
.card button.cool { background: #8DB1CC; color: #1d2a44; }
.card p { margin: 8px 0 0; font-size: 14px; line-height: 1.45; opacity: .75; }
.gatecard { width: min(460px, 90vw); text-align: center; }
.gatecard .q { margin: 6px 0 16px; font-size: 30px; font-weight: 700; opacity: 1; }
.gatecard button { min-height: 96px; font-size: 34px; background: #E8B23A; color: #3b2f25; }

/* parents' pages, shown over the game so nothing navigates away */
#legal { position: fixed; inset: 0; z-index: 120; background: #F3E7CF; display: flex; flex-direction: column; touch-action: auto; }
#legal header { flex: none; display: flex; justify-content: flex-end; padding: 12px 16px; background: #8FA65B; }
#legal button { min-width: 150px; min-height: 60px; font: inherit; font-size: 20px; font-weight: 700; border: 0; border-radius: 16px; background: #F3E7CF; color: #3b2f25; box-shadow: 0 4px 0 rgba(60,40,20,.2); }
#legal iframe { flex: 1; width: 100%; border: 0; background: #F3E7CF; }

#rotate { display: none; position: fixed; inset: 0; z-index: 200; background: #5E7F45; color: #F3E7CF; font-size: 26px; align-items: center; justify-content: center; text-align: center; padding: 30px; }
@media (orientation: portrait) and (max-width: 900px) { #rotate { display: flex; } }

body.calm .bob, body.calm .pulse, body.calm .glow { animation: none; }
body.calm #bg { transition: none; }

/* ---------- v2: start screen, hints, transitions, ambience ---------- */
#iris { position: absolute; left: 600px; top: 400px; width: 2800px; height: 2800px; border-radius: 50%; transform: translate(-50%, -50%);
  box-shadow: 0 0 0 16px #E8B23A, 0 0 0 3200px #F3E7CF; pointer-events: none; z-index: 70; }

.play { position: absolute; width: 230px; height: 230px; border-radius: 50%; border: 0; padding: 0; background: #E8B23A; touch-action: none;
  box-shadow: 0 0 0 14px #F3E7CF, 0 14px 0 14px rgba(60,40,20,.22); }
.play::after { content: ""; position: absolute; left: 84px; top: 58px; border-style: solid; border-width: 57px 0 57px 92px; border-color: transparent transparent transparent #fff8e6; filter: drop-shadow(0 4px 0 rgba(120,80,10,.25)); }
@keyframes playpulse { 0%,100% { transform: scale(1) } 50% { transform: scale(1.09) } }
.play { animation: playpulse 1.5s ease-in-out infinite; }

.ring { position: absolute; border-radius: 50%; border: 7px solid rgba(255,244,200,.95); pointer-events: none;
  box-shadow: 0 0 26px 8px rgba(255,236,150,.75), inset 0 0 22px 4px rgba(255,236,150,.55); }
@keyframes ringpulse { 0%,100% { opacity: .6 } 50% { opacity: 1 } }
.ring { animation: ringpulse 1.6s steps(4, end) infinite; }
.ghost { opacity: .6; filter: drop-shadow(0 0 10px rgba(255,236,150,.9)); z-index: 49 !important; }

/* the "look here" nudge: a small lean left, rest, small lean right, rest. Held poses, never a shake. */
@keyframes wiggle { 0%,100% { transform: rotate(0) } 20% { transform: rotate(-2.2deg) } 40% { transform: rotate(0) } 60% { transform: rotate(2.2deg) } 80% { transform: rotate(0) } }
.wiggle { animation: wiggle 2.4s step-end infinite; }

.star4 { position: absolute; background: #FFF3C4; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); pointer-events: none; }
@keyframes twinkle { 0%,100% { opacity: .15; transform: scale(.7) } 50% { opacity: 1; transform: scale(1.15) } }
.twinkle { animation: twinkle 3.2s ease-in-out infinite; }
.glowdot { position: absolute; border-radius: 50%; background: radial-gradient(circle, rgba(255,226,130,.75), rgba(255,226,130,0) 70%); pointer-events: none; }
@keyframes breathe { 0%,100% { opacity: .45 } 50% { opacity: 1 } }
.breathe { animation: breathe 4s ease-in-out infinite; }

.butterfly { position: absolute; width: 44px; height: 34px; pointer-events: none; }
.butterfly i { position: absolute; top: 0; width: 22px; height: 34px; border-radius: 60% 60% 45% 45%; }
.butterfly i:first-child { left: 0; transform-origin: 100% 50%; animation: flapL .28s ease-in-out infinite alternate; }
.butterfly i:last-child { right: 0; transform-origin: 0 50%; animation: flapR .28s ease-in-out infinite alternate; }
@keyframes flapL { from { transform: rotateY(0) } to { transform: rotateY(70deg) } }
@keyframes flapR { from { transform: rotateY(0) } to { transform: rotateY(-70deg) } }

.zzz { position: absolute; color: #F3E7CF; font: 700 44px/1 -apple-system, "Helvetica Neue", Arial, sans-serif; pointer-events: none; text-shadow: 0 3px 0 rgba(0,0,0,.18); }
.ripple { position: absolute; border-radius: 50%; border: 5px solid rgba(243,231,207,.8); pointer-events: none; }
.mote { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: rgba(255,246,214,.8); pointer-events: none; }

body.calm .play, body.calm .ring, body.calm .wiggle, body.calm .twinkle, body.calm .breathe { animation: none; }
body.calm .butterfly, body.calm .mote { display: none; }

/* ---------- shell: splash wordmark and adventure cards (all motion comes from the JS helpers) ---------- */
.wordmark { position: absolute; width: 400px; text-align: center; pointer-events: none; }
.wordmark > div { transform: rotate(-4deg); }
.wordmark span { display: block; white-space: nowrap; }
.wordmark b { display: inline-block; font: 800 104px/0.98 ui-rounded, "Arial Rounded MT Bold", "Chalkboard SE", -apple-system, "Helvetica Neue", Arial, sans-serif;
  color: #F3E7CF; text-shadow: 3px 4px 0 #E8B23A, -1px 5px 0 #E8B23A, 2px 12px 0 rgba(60,40,20,.25); }

.pcard { touch-action: none; }
.pcard .paper { position: absolute; inset: 0; background: #F3E7CF; border-radius: 22px; pointer-events: none;
  box-shadow: 0 7px 0 rgba(60,40,20,.2), 0 14px 18px rgba(60,40,20,.18); }
.pcard .pic { position: absolute; inset: 12px; border-radius: 13px; overflow: hidden; }
.pcard.soon .paper { filter: saturate(.35); opacity: .55; }   /* not built yet: smaller and softer, never locked */
.dot { position: absolute; border-radius: 50%; }
.blk { position: absolute; }

/* owner feedback: no ring drawn on top of things. The hint is a soft glow that sits BEHIND the paper piece. */
.ring { border: 0; box-shadow: none; background: radial-gradient(closest-side, rgba(255,240,170,.95), rgba(255,236,150,.55) 55%, rgba(255,236,150,0) 100%); }

/* back button, bottom left */
#back { position: absolute; left: 84px; bottom: 14px; width: 86px; height: 86px; border: 0; background: none; padding: 0; z-index: 60; touch-action: none; }
#back img { width: 100%; height: 100%; display: block; pointer-events: none; }
#back.holding img { transform: scale(.84) rotate(-10deg); }

/* back button is top-left, clear of the play area */
#back { left: 84px; top: 12px; bottom: auto; }
/* tells a grown-up where settings, privacy and terms are (menu screens only) */
#grownLabel { position: absolute; right: 150px; top: 30px; z-index: 60; padding: 9px 16px; border-radius: 999px; background: rgba(243,231,207,.92); color: #3b2f25; font: 600 17px/1.2 -apple-system, "Helvetica Neue", Arial, sans-serif; box-shadow: 0 3px 0 rgba(60,40,20,.2); pointer-events: none; }

/* level title under its card: torn-cloud lettering on a dusty-blue paper tag */
/* the label under a card is part of the card: a tap on it chooses the adventure too */
.pcard img.cardtitle { pointer-events: auto; background: #8DB1CC; padding: 8px 14px; border-radius: 16px; box-sizing: border-box; box-shadow: 0 4px 0 rgba(40,60,80,.25); transform: rotate(-2deg); }

/* grown-ups menu: a hamburger, top right, on every screen (still press-and-hold, then the adult question) */
#grown { right: 78px; top: 12px; width: 76px; height: 76px; }
#grown span { position: relative; width: 62px; height: 62px; margin: 7px; border-radius: 18px; background: rgba(243,231,207,.94); box-shadow: 0 4px 0 rgba(60,40,20,.22);
  background-image: linear-gradient(#7a4a2a, #7a4a2a), linear-gradient(#7a4a2a, #7a4a2a), linear-gradient(#7a4a2a, #7a4a2a);
  background-size: 34px 6px, 34px 6px, 34px 6px; background-position: 14px 17px, 14px 28px, 14px 39px; background-repeat: no-repeat; background-color: rgba(243,231,207,.94); }
#grown.holding span { transform: scale(.86); background-color: rgba(232,178,58,.98); }
#grown.moon span { background-image: none; background-color: rgba(243,231,207,0); box-shadow: none; }

/* a finished adventure wears a paper tick on its top right corner */
.pcard img.cardtick { position: absolute; right: -26px; top: -30px; width: 92px; height: auto; transform: rotate(9deg); filter: drop-shadow(0 4px 0 rgba(60,50,30,.22)); pointer-events: none; z-index: 3; }

/* Little Days Plus (plus.js): a small paper star on Plus cards; the grown-ups section and its number pad */
.pcard img.cardplus { position: absolute; left: -22px; top: -26px; width: 64px; height: auto; transform: rotate(-12deg); filter: drop-shadow(0 4px 0 rgba(60,50,30,.22)); pointer-events: none; z-index: 3; }
#plusGate { margin-top: 10px; padding: 12px; border-radius: 16px; background: #fff8e6; text-align: center; }
#plusGate .q { font-size: 18px; font-weight: 700; opacity: 1; }
#plusGate .typed { font-size: 30px; font-weight: 700; letter-spacing: .1em; opacity: 1; }
#plusGate .pad button { flex: 1 1 18%; min-height: 56px; font-size: 24px; }
#plusMsg { font-weight: 600; opacity: 1; }
