:root {
  --ink: #24324a;
  --glass: rgba(255,255,255,.72);
  --shadow: 0 18px 50px rgba(48, 79, 120, .18);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; }
body {
  font-family: ui-rounded, "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  color: var(--ink);
  background: #8fdfff;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}
button { font: inherit; }

.app, .screen { width: 100%; height: 100%; min-height: 100dvh; }
.screen { position: relative; overflow: hidden; touch-action: none; -webkit-touch-callout: none; }
.hidden { display: none !important; }

.home-screen {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 20% 15%, rgba(255,255,255,.9) 0 8%, transparent 9%),
    radial-gradient(circle at 85% 20%, rgba(255,255,255,.72) 0 6%, transparent 7%),
    linear-gradient(160deg, #89e5ff 0%, #a7f0dc 48%, #fff0a4 100%);
}

.hero-card {
  width: min(92vw, 560px);
  padding: 34px 28px 28px;
  text-align: center;
  border-radius: 34px;
  background: var(--glass);
  border: 3px solid rgba(255,255,255,.85);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 2;
}

.home-logo {
  display: block;
  width: min(82%, 390px);
  height: auto;
  margin: 0 auto 24px;
  transform: translateX(15px);
}

.start-btn {
  border: 0;
  border-radius: 999px;
  padding: 19px 44px;
  font-size: clamp(24px, 4vw, 34px);
  font-weight: 900;
  color: white;
  background: linear-gradient(180deg, #ff7e6e, #ff5e79);
  box-shadow: 0 10px 0 #db3d59, 0 18px 30px rgba(219,61,89,.28);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.start-btn:hover { transform: translateY(-2px) scale(1.02); }
.start-btn:active { transform: translateY(7px); box-shadow: 0 3px 0 #db3d59; }

.mode-picker { display: flex; justify-content: center; gap: 10px; margin-top: 28px; flex-wrap: wrap; }
.pill, .icon-btn, .corner-btn {
  border: 0;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(36,50,74,.12);
}
.pill {
  border-radius: 999px;
  background: rgba(255,255,255,.76);
  padding: 12px 18px;
  font-weight: 900;
  color: var(--ink);
}
.pill.active { background: #fff; outline: 4px solid rgba(70,188,255,.22); }

.mini-controls { display: flex; justify-content: center; gap: 10px; margin-top: 16px; }
.icon-btn {
  width: 52px; height: 52px; border-radius: 16px; background: rgba(255,255,255,.82); font-size: 25px;
}
.parent-note { margin: 18px 0 0; font-size: 13px; opacity: .55; }

.cloud { position: absolute; font-size: clamp(56px, 9vw, 120px); filter: drop-shadow(0 12px 20px rgba(56,100,150,.1)); opacity: .95; }
.cloud-a { left: 5%; top: 8%; animation: drift 8s ease-in-out infinite alternate; }
.cloud-b { right: 6%; bottom: 8%; animation: drift 10s ease-in-out infinite alternate-reverse; }

.play-screen {
  outline: none;
  background: linear-gradient(160deg, #82ddff, #b7f5d1 55%, #ffefad);
  transition: background 900ms ease;
}
.stage, .sky-decor, .message { position: absolute; inset: 0; pointer-events: none; }

.corner-controls { position: absolute; z-index: 30; display: flex; gap: 8px; }
.top-right { top: max(14px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right)); }
.corner-btn {
  width: 48px; height: 48px; border-radius: 16px; background: rgba(255,255,255,.72); color: #21314a; font-size: 22px; backdrop-filter: blur(8px);
}
.home-btn { position: absolute; z-index: 30; left: max(14px, env(safe-area-inset-left)); top: max(14px, env(safe-area-inset-top)); }

.mode-badge {
  position: absolute;
  z-index: 25;
  left: 50%; top: 16px;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.68);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .07em;
  opacity: .72;
  pointer-events: none;
}
.hint {
  position: absolute;
  left: 50%; bottom: max(24px, calc(env(safe-area-inset-bottom) + 10px));
  transform: translateX(-50%);
  z-index: 20;
  padding: 10px 16px;
  background: rgba(255,255,255,.55);
  border-radius: 999px;
  font-weight: 900;
  animation: hintPulse 1.5s ease-in-out infinite;
  pointer-events: none;
}

.toy {
  position: absolute;
  left: var(--x); top: var(--y);
  font-size: var(--size);
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 12px 10px rgba(0,0,0,.12));
  will-change: transform, opacity;
  z-index: 10;
}
.toy.pop { animation: popIn 2.4s cubic-bezier(.2,.9,.25,1) forwards; }
.toy.bounce { animation: bounceIn 2.8s cubic-bezier(.2,.8,.25,1) forwards; }
.toy.spin { animation: spinIn 2.5s cubic-bezier(.2,.8,.25,1) forwards; }
.toy.fly { animation: flyAcross 3.4s ease-in-out forwards; }
.toy.wobble { animation: wobbleIn 2.8s ease-out forwards; }

.word-pop {
  position: absolute;
  left: var(--x); top: calc(var(--y) + 90px);
  transform: translate(-50%, -50%);
  z-index: 15;
  font-size: clamp(22px, 4vw, 46px);
  font-weight: 1000;
  color: white;
  text-shadow: 0 3px 0 rgba(0,0,0,.2), 0 8px 18px rgba(0,0,0,.18);
  animation: wordIn 2.1s ease-out forwards;
}

.particle {
  position: absolute;
  left: var(--x); top: var(--y);
  font-size: var(--size);
  transform: translate(-50%, -50%);
  animation: particleBurst 1.4s ease-out forwards;
  z-index: 8;
}

.big-event {
  position: absolute;
  z-index: 12;
  font-size: min(34vw, 420px);
  line-height: 1;
  filter: drop-shadow(0 30px 30px rgba(0,0,0,.15));
  pointer-events: none;
}
.big-event.stomp { left: -30vw; bottom: -8vh; animation: stompAcross 4s linear forwards; }
.big-event.rocket { left: 44%; bottom: -35vh; animation: rocketLaunch 3.4s ease-in forwards; }
.big-event.whale { left: 40%; bottom: -34vh; animation: whaleJump 3.8s ease-in-out forwards; }
.big-event.rainbow { left: 50%; top: 48%; transform: translate(-50%,-50%); animation: rainbowBoom 3s ease-in-out forwards; }

.flash-message {
  position: absolute;
  left: 50%; top: 20%;
  transform: translate(-50%,-50%) scale(.7);
  font-size: clamp(34px, 8vw, 92px);
  font-weight: 1000;
  color: white;
  text-shadow: 0 5px 0 rgba(0,0,0,.13), 0 15px 35px rgba(0,0,0,.18);
  animation: flashMessage 1.8s ease-out forwards;
}


.play-logo {
  position: absolute;
  z-index: 24;
  left: max(18px, env(safe-area-inset-left));
  bottom: max(16px, env(safe-area-inset-bottom));
  width: clamp(90px, 8.5vw, 120px);
  height: auto;
  opacity: .42;
  pointer-events: none;
  filter: drop-shadow(0 2px 8px rgba(255,255,255,.18));
}

button { min-width: 48px; min-height: 48px; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

@media (max-height: 620px) {
  .hero-card { padding-top: 18px; padding-bottom: 16px; }
  .home-logo { width: min(66%, 300px); margin-bottom: 12px; }
  .start-btn { padding-top: 13px; padding-bottom: 13px; }
  .mode-picker { margin-top: 16px; }
  .mini-controls { margin-top: 10px; }
  .parent-note { margin-top: 10px; }
}

@media (max-width: 600px) {
  .home-logo { width: min(84%, 330px); margin-bottom: 18px; }
  .play-logo { width: clamp(70px, 22vw, 90px); opacity: .38; }
}

@media (orientation: landscape) and (max-height: 520px) {
  .hero-card { width: min(88vw, 620px); padding: 12px 22px; border-radius: 24px; }
  .home-logo { width: min(48%, 270px); margin-bottom: 8px; }
  .start-btn { padding: 10px 34px; font-size: clamp(21px, 5vh, 29px); }
  .mode-picker { margin-top: 10px; }
  .pill { padding: 8px 15px; }
  .mini-controls { margin-top: 7px; }
  .icon-btn { width: 48px; height: 48px; }
  .parent-note { margin-top: 7px; }
}

@keyframes drift { to { transform: translate(28px, -14px) scale(1.06); } }
@keyframes hintPulse { 50% { transform: translateX(-50%) scale(1.05); opacity:.7; } }
@keyframes popIn {
  0% { transform: translate(-50%,-50%) scale(.05) rotate(-18deg); opacity:0; }
  24% { transform: translate(-50%,-50%) scale(1.3) rotate(8deg); opacity:1; }
  55% { transform: translate(-50%,-50%) scale(.96) rotate(-4deg); opacity:1; }
  100% { transform: translate(-50%,-65%) scale(1.08); opacity:0; }
}
@keyframes bounceIn {
  0% { transform: translate(-50%,120vh) scale(.8); opacity:0; }
  35% { transform: translate(-50%,-65%) scale(1.12); opacity:1; }
  50% { transform: translate(-50%,-20%) scale(.95,1.08); }
  68% { transform: translate(-50%,-55%) scale(1.03); }
  100% { transform: translate(-50%,-80%) scale(.9); opacity:0; }
}
@keyframes spinIn {
  0% { transform: translate(-50%,-50%) scale(.1) rotate(-540deg); opacity:0; }
  40% { transform: translate(-50%,-50%) scale(1.2) rotate(18deg); opacity:1; }
  100% { transform: translate(-50%,-50%) scale(.8) rotate(480deg); opacity:0; }
}
@keyframes flyAcross {
  0% { transform: translate(-130vw,-50%) rotate(-9deg); opacity:0; }
  15% { opacity:1; }
  85% { opacity:1; }
  100% { transform: translate(130vw,-85%) rotate(8deg); opacity:0; }
}
@keyframes wobbleIn {
  0% { transform: translate(-50%,-50%) scale(.1); opacity:0; }
  30% { transform: translate(-50%,-50%) scale(1.2) rotate(12deg); opacity:1; }
  45% { transform: translate(-50%,-50%) scale(1) rotate(-12deg); }
  60% { transform: translate(-50%,-50%) scale(1.12) rotate(8deg); }
  75% { transform: translate(-50%,-50%) scale(1) rotate(-5deg); }
  100% { transform: translate(-50%,-68%) scale(.85); opacity:0; }
}
@keyframes wordIn {
  0% { transform: translate(-50%,-50%) scale(.2); opacity:0; }
  22% { transform: translate(-50%,-50%) scale(1.15); opacity:1; }
  70% { transform: translate(-50%,-60%) scale(1); opacity:1; }
  100% { transform: translate(-50%,-90%) scale(.92); opacity:0; }
}
@keyframes particleBurst {
  0% { transform: translate(-50%,-50%) scale(.1); opacity:0; }
  18% { opacity:1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--rot)) scale(.9); opacity:0; }
}
@keyframes stompAcross { from { transform: translateX(0) rotate(-3deg); } to { transform: translateX(145vw) rotate(4deg); } }
@keyframes rocketLaunch { 0% { transform: translateY(0) rotate(-5deg); } 18% { transform: translateY(-8vh) rotate(3deg); } 100% { transform: translateY(-160vh) rotate(-8deg); } }
@keyframes whaleJump { 0% { transform: translateY(0) rotate(-14deg); } 45% { transform: translateY(-95vh) translateX(14vw) rotate(18deg); } 100% { transform: translateY(20vh) translateX(34vw) rotate(40deg); } }
@keyframes rainbowBoom { 0% { opacity:0; transform: translate(-50%,-50%) scale(.1) rotate(-8deg); } 25% { opacity:1; transform: translate(-50%,-50%) scale(1.15) rotate(4deg); } 75% { opacity:1; } 100% { opacity:0; transform: translate(-50%,-50%) scale(1.35) rotate(0); } }
@keyframes flashMessage { 0% { opacity:0; transform: translate(-50%,-50%) scale(.4) rotate(-6deg); } 25% { opacity:1; transform: translate(-50%,-50%) scale(1.15) rotate(3deg); } 75% { opacity:1; } 100% { opacity:0; transform: translate(-50%,-70%) scale(.9); } }

@media (max-width: 600px) {
  .hero-card { padding: 28px 18px 22px; border-radius: 28px; }
  .corner-btn { width: 44px; height: 44px; border-radius: 14px; }
  .mode-badge { top: 20px; }
}
