/* Fonts loaded via <link> in index.html for non-blocking render */

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --road: #4a4a5a;
  --sky: #87CEEB;
  --grass: #7ec850;
  --sun: #FFD700;
  --red: #FF4757;
  --blue: #3742fa;
  --green: #2ed573;
  --orange: #FF6348;
  --purple: #a55eea;
  --pink: #ff6b81;
  --yellow: #ffa502;
}

html {
  height: 100%;
  min-height: calc(100% + env(safe-area-inset-top, 0px));
}
body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: 'Baloo 2', cursive, sans-serif;
  touch-action: manipulation;
  background: var(--sky);
}

#app {
  width: 100%; height: 100%;
  position: relative;
  overflow: hidden;
  transition: background .5s;
}

/* ============ THEME BACKGROUNDS ============ */
/* Smooth gradient transitions — no hard cuts between sky/ground/road */

/* Cars: sky + grass + road */
#app[data-theme="cars"] {
  background: linear-gradient(180deg,
    #6ab8e0 0%, #87CEEB 15%, #a8ddf0 30%, #b8e8c0 38%,
    #7ec850 44%, #6bba42 60%, #5aad35 75%,
    #5a7a5a 82%, #4a4a5a 86%, #4a4a5a 100%);
}
#app[data-theme="cars"] .road { background: #4a4a5a; }
#app[data-theme="cars"] .road::before {
  background: repeating-linear-gradient(90deg, #fff 0, #fff 30px, transparent 30px, transparent 60px);
}
#app[data-theme="cars"] .sun { background: radial-gradient(circle at 35% 35%, #fff6c8 0%, #FFD700 50%, #f0a000 100%); box-shadow: 0 0 50px rgba(255,215,0,.4), 0 0 100px rgba(255,215,0,.15); }
#app[data-theme="cars"] .cloud { background: white; }

/* Space: deep sky + stars + moon surface */
#app[data-theme="space"] {
  background: linear-gradient(180deg,
    #080820 0%, #0c0c2e 15%, #151548 30%, #1a1a4e 45%,
    #2d2d6b 58%, #444466 70%, #555577 80%,
    #666680 84%, #666688 88%, #555570 100%);
}
#app[data-theme="space"] .road { background: linear-gradient(180deg, #606075 0%, #555566 100%); }
#app[data-theme="space"] .road::before {
  background: radial-gradient(circle at 20% 50%, rgba(0,0,0,.15) 8px, transparent 8px),
              radial-gradient(circle at 50% 30%, rgba(0,0,0,.1) 6px, transparent 6px),
              radial-gradient(circle at 80% 60%, rgba(0,0,0,.12) 10px, transparent 10px),
              radial-gradient(circle at 35% 70%, rgba(0,0,0,.08) 5px, transparent 5px),
              radial-gradient(circle at 65% 40%, rgba(0,0,0,.1) 7px, transparent 7px);
  height: 100%; top: 0; width: 100%;
}
#app[data-theme="space"] .sun { background: radial-gradient(circle at 40% 40%, #f8f8ff 0%, #e8e8f0 40%, #c0c0d8 100%); box-shadow: 0 0 50px rgba(200,200,255,.5), 0 0 100px rgba(180,180,240,.2); }
#app[data-theme="space"] .sun::after { background: radial-gradient(circle, rgba(200,200,255,.2) 30%, transparent 70%); }
#app[data-theme="space"] .cloud { background: rgba(255,255,255,.1); }
#app[data-theme="space"] .cloud::before, #app[data-theme="space"] .cloud::after { background: rgba(255,255,255,.1); }

/* Planes: bright sky + runway */
#app[data-theme="planes"] {
  background: linear-gradient(180deg,
    #4ab0f0 0%, #5BC0F8 15%, #87CEEB 30%, #a8d8ea 42%,
    #c0e0c0 48%, #90c56a 55%, #7ab850 70%,
    #6a8a5a 80%, #5a6a5a 84%, #555 87%, #555 100%);
}
#app[data-theme="planes"] .road { background: linear-gradient(180deg, #606060 0%, #555 100%); }
#app[data-theme="planes"] .road::before {
  background: repeating-linear-gradient(90deg, #FFD700 0, #FFD700 40px, transparent 40px, transparent 80px);
  height: 3px;
}
#app[data-theme="planes"] .sun { background: radial-gradient(circle at 35% 35%, #fff6c8 0%, #FFD700 50%, #f0a000 100%); box-shadow: 0 0 50px rgba(255,215,0,.4), 0 0 100px rgba(255,215,0,.15); }

/* Boats: ocean + beach */
#app[data-theme="boats"] {
  background: linear-gradient(180deg,
    #68b8e8 0%, #87CEEB 15%, #a8d8f0 28%,
    #e8d8b8 38%, #f5e6c8 42%, #e8d5a8 47%,
    #80c0e0 52%, #2196F3 58%, #1976D2 75%, #1565C0 88%, #0D47A1 100%);
}
#app[data-theme="boats"] .road { background: linear-gradient(180deg, #2196F3 0%, #1976D2 40%, #1565C0 70%, #0D47A1 100%); overflow: hidden; }
#app[data-theme="boats"] .road::before {
  background: none; height: 100%; top: 0; width: 200%; left: -50%;
  border-top: none;
  background:
    repeating-linear-gradient(90deg,
      transparent 0px, transparent 30px,
      rgba(255,255,255,.08) 30px, rgba(255,255,255,.08) 60px
    );
  animation: ocean-wave 4s ease-in-out infinite;
}
#app[data-theme="boats"] .road::after {
  content: '';
  position: absolute;
  top: 0; left: -50%; width: 200%; height: 8px;
  background:
    radial-gradient(ellipse 40px 6px at 10% 50%, rgba(255,255,255,.25) 0%, transparent 100%),
    radial-gradient(ellipse 50px 8px at 30% 50%, rgba(255,255,255,.2) 0%, transparent 100%),
    radial-gradient(ellipse 35px 5px at 55% 50%, rgba(255,255,255,.25) 0%, transparent 100%),
    radial-gradient(ellipse 45px 7px at 75% 50%, rgba(255,255,255,.2) 0%, transparent 100%),
    radial-gradient(ellipse 40px 6px at 90% 50%, rgba(255,255,255,.18) 0%, transparent 100%);
  animation: ocean-wave-top 3s ease-in-out infinite;
}
@keyframes ocean-wave { 0%,100% { transform: translateX(0) translateY(0); } 50% { transform: translateX(-40px) translateY(3px); } }
@keyframes ocean-wave-top { 0%,100% { transform: translateX(0); } 50% { transform: translateX(30px); } }
#app[data-theme="boats"] .sun { background: radial-gradient(circle at 35% 35%, #fff6c8 0%, #FFD700 50%, #f0a000 100%); box-shadow: 0 0 50px rgba(255,215,0,.4), 0 0 100px rgba(255,215,0,.15); }

/* Unicorns: pink sky + sparkly path */
#app[data-theme="unicorns"] {
  background: linear-gradient(180deg,
    #ffd6e0 0%, #ffb3c6 18%, #e0b0e8 30%, #c8b6ff 40%,
    #d8e8d0 48%, #c0e0b8 55%, #b8e6b0 72%,
    #d0b8d8 80%, #e8c8f0 85%, #d4a8e8 100%);
}
#app[data-theme="unicorns"] .road { background: linear-gradient(180deg, #e0c0e8 0%, #d4a8e8 100%); }
#app[data-theme="unicorns"] .road::before {
  background: radial-gradient(circle at 10% 50%, rgba(255,255,255,.4) 2px, transparent 2px),
              radial-gradient(circle at 25% 30%, rgba(255,255,255,.3) 1.5px, transparent 1.5px),
              radial-gradient(circle at 40% 60%, rgba(255,255,255,.5) 2px, transparent 2px),
              radial-gradient(circle at 55% 40%, rgba(255,255,255,.3) 1px, transparent 1px),
              radial-gradient(circle at 70% 55%, rgba(255,255,255,.4) 2px, transparent 2px),
              radial-gradient(circle at 85% 35%, rgba(255,255,255,.3) 1.5px, transparent 1.5px);
  height: 100%; top: 0; width: 100%;
  animation: twinkle 2s ease-in-out infinite;
}
#app[data-theme="unicorns"] .sun { background: radial-gradient(circle at 40% 35%, #ffe0f0 0%, #ffb3c6 50%, #e090a8 100%); box-shadow: 0 0 50px rgba(255,179,198,.4), 0 0 100px rgba(255,179,198,.15); }
#app[data-theme="unicorns"] .sun::after { background: radial-gradient(circle, rgba(255,179,198,.3) 30%, transparent 70%); }
#app[data-theme="unicorns"] .cloud { background: rgba(255,255,255,.7); }

/* Animals: jungle + dirt path */
#app[data-theme="animals"] {
  background: linear-gradient(180deg,
    #70b8d8 0%, #87CEEB 15%, #a8d8ea 28%,
    #80c060 36%, #4a8c3f 44%, #3d7a35 55%, #2d6b25 70%,
    #5a6a40 78%, #8B7355 84%, #7a6248 100%);
}
#app[data-theme="animals"] .road { background: linear-gradient(180deg, #907860 0%, #7a6248 100%); }
#app[data-theme="animals"] .road::before {
  background: radial-gradient(ellipse at 15% 50%, rgba(0,0,0,.08) 12px, transparent 12px),
              radial-gradient(ellipse at 45% 40%, rgba(0,0,0,.06) 8px, transparent 8px),
              radial-gradient(ellipse at 75% 55%, rgba(0,0,0,.07) 10px, transparent 10px),
              radial-gradient(ellipse at 60% 65%, rgba(0,0,0,.05) 6px, transparent 6px);
  height: 100%; top: 0; width: 100%;
}
#app[data-theme="animals"] .sun { background: radial-gradient(circle at 35% 35%, #fff6c8 0%, #FFD700 50%, #f0a000 100%); box-shadow: 0 0 50px rgba(255,215,0,.4), 0 0 100px rgba(255,215,0,.15); }

/* Flowers: garden + flower path */
#app[data-theme="flowers"] {
  background: linear-gradient(180deg,
    #a0d8f0 0%, #B0E0F6 15%, #c8e8ff 28%,
    #b0e070 36%, #90d468 42%, #7ec850 55%, #6ab840 70%,
    #a0a880 78%, #e8b8d0 84%, #d4a0c0 100%);
}
#app[data-theme="flowers"] .road { background: linear-gradient(180deg, #e0b0c8 0%, #d4a0c0 100%); }
#app[data-theme="flowers"] .road::before {
  background: radial-gradient(circle at 8% 40%, rgba(255,200,220,.5) 4px, transparent 4px),
              radial-gradient(circle at 22% 60%, rgba(255,220,180,.4) 3px, transparent 3px),
              radial-gradient(circle at 38% 35%, rgba(200,255,200,.4) 4px, transparent 4px),
              radial-gradient(circle at 55% 55%, rgba(255,200,220,.5) 3px, transparent 3px),
              radial-gradient(circle at 72% 40%, rgba(220,200,255,.4) 4px, transparent 4px),
              radial-gradient(circle at 90% 50%, rgba(255,220,180,.4) 3px, transparent 3px);
  height: 100%; top: 0; width: 100%;
}
#app[data-theme="flowers"] .sun { background: radial-gradient(circle at 35% 35%, #fff6c8 0%, #FFD700 50%, #f0a000 100%); box-shadow: 0 0 50px rgba(255,215,0,.4), 0 0 100px rgba(255,215,0,.15); }

/* ============ ANIMATED SCENE ITEMS — UNIQUE PER THEME ============ */
.road-vehicle {
  position: absolute;
  z-index: 2;
  opacity: .65;
}
.road-vehicle.rv2 { opacity: .5; }
.v-svg-road { width: 80px; width: clamp(50px, 8vw, 80px); height: auto; }

/* ---- CARS: Drive smoothly along the road ---- */
@keyframes cars-drive {
  0%   { left: -100px; }
  100% { left: calc(100% + 100px); }
}
@keyframes cars-drive-back {
  0%   { right: -100px; }
  100% { right: calc(100% + 100px); }
}
#app[data-theme="cars"] .road-vehicle {
  bottom: 1%; left: auto; right: auto;
  animation: cars-drive 12s linear infinite;
}
#app[data-theme="cars"] .road-vehicle.rv2 {
  bottom: 6%;
  animation: cars-drive-back 16s linear infinite 4s;
  transform: scaleX(-1);
}

/* ---- SPACE: Rockets float and rotate through starfield ---- */
@keyframes space-rocket {
  0%   { left: -100px; top: 55%; transform: rotate(15deg); }
  15%  { top: 35%; transform: rotate(-5deg); }
  30%  { top: 50%; transform: rotate(10deg); }
  50%  { top: 25%; transform: rotate(-10deg); }
  70%  { top: 45%; transform: rotate(5deg); }
  85%  { top: 30%; transform: rotate(-8deg); }
  100% { left: calc(100% + 100px); top: 40%; transform: rotate(0deg); }
}
@keyframes space-ufo {
  0%   { right: -100px; top: 30%; transform: rotate(0deg) scale(1); }
  20%  { top: 20%; transform: rotate(8deg) scale(1.05); }
  40%  { top: 40%; transform: rotate(-5deg) scale(.95); }
  60%  { top: 15%; transform: rotate(10deg) scale(1.08); }
  80%  { top: 35%; transform: rotate(-3deg) scale(1); }
  100% { right: calc(100% + 100px); top: 25%; transform: rotate(5deg) scale(1.02); }
}
#app[data-theme="space"] .road-vehicle {
  bottom: auto;
  animation: space-rocket 18s ease-in-out infinite;
}
#app[data-theme="space"] .road-vehicle.rv2 {
  bottom: auto; left: auto;
  animation: space-ufo 22s ease-in-out infinite 5s;
}

/* ---- PLANES: Fly with altitude dips and banking ---- */
/* SVGs face LEFT, so rv1 (flying right) needs scaleX(-1) to face right */
@keyframes planes-fly {
  0%   { left: -120px; top: 25%; transform: scaleX(-1) rotate(8deg); }
  10%  { top: 15%; transform: scaleX(-1) rotate(12deg); }
  25%  { top: 35%; transform: scaleX(-1) rotate(-5deg); }
  35%  { top: 20%; transform: scaleX(-1) rotate(6deg); }
  50%  { top: 40%; transform: scaleX(-1) rotate(-8deg); }
  65%  { top: 10%; transform: scaleX(-1) rotate(15deg); }
  80%  { top: 30%; transform: scaleX(-1) rotate(-3deg); }
  100% { left: calc(100% + 120px); top: 20%; transform: scaleX(-1) rotate(5deg); }
}
/* rv2 (helicopter flying left) — SVG already faces left, no flip needed */
@keyframes planes-heli {
  0%   { right: -120px; top: 35%; transform: rotate(0deg); }
  15%  { top: 25%; transform: rotate(-5deg); }
  30%  { top: 40%; transform: rotate(5deg); }
  50%  { top: 20%; transform: rotate(-8deg); }
  70%  { top: 38%; transform: rotate(3deg); }
  85%  { top: 28%; transform: rotate(-4deg); }
  100% { right: calc(100% + 120px); top: 32%; transform: rotate(0deg); }
}
#app[data-theme="planes"] .road-vehicle {
  bottom: auto;
  animation: planes-fly 10s ease-in-out infinite;
}
#app[data-theme="planes"] .road-vehicle.rv2 {
  bottom: auto; left: auto;
  animation: planes-heli 14s ease-in-out infinite 3s;
}

/* ---- BOATS: Sail on water with realistic wave bobbing ---- */
@keyframes boats-sail {
  0%   { left: -100px; transform: translateY(0px) rotate(0deg); }
  5%   { transform: translateY(-6px) rotate(4deg); }
  10%  { transform: translateY(2px) rotate(-2deg); }
  15%  { transform: translateY(-8px) rotate(5deg); }
  20%  { transform: translateY(3px) rotate(-3deg); }
  25%  { transform: translateY(-5px) rotate(3deg); }
  30%  { transform: translateY(4px) rotate(-4deg); }
  35%  { transform: translateY(-7px) rotate(5deg); }
  40%  { transform: translateY(1px) rotate(-1deg); }
  45%  { transform: translateY(-6px) rotate(4deg); }
  50%  { transform: translateY(3px) rotate(-3deg); }
  55%  { transform: translateY(-8px) rotate(5deg); }
  60%  { transform: translateY(2px) rotate(-2deg); }
  65%  { transform: translateY(-5px) rotate(3deg); }
  70%  { transform: translateY(4px) rotate(-4deg); }
  75%  { transform: translateY(-7px) rotate(5deg); }
  80%  { transform: translateY(1px) rotate(-1deg); }
  85%  { transform: translateY(-4px) rotate(2deg); }
  90%  { transform: translateY(3px) rotate(-3deg); }
  95%  { transform: translateY(-6px) rotate(4deg); }
  100% { left: calc(100% + 100px); transform: translateY(0px) rotate(0deg); }
}
@keyframes boats-sub {
  0%   { right: -100px; transform: scaleX(-1) translateY(0px); }
  20%  { transform: scaleX(-1) translateY(8px); }
  40%  { transform: scaleX(-1) translateY(-4px); }
  60%  { transform: scaleX(-1) translateY(10px); }
  80%  { transform: scaleX(-1) translateY(-2px); }
  100% { right: calc(100% + 100px); transform: scaleX(-1) translateY(0px); }
}
#app[data-theme="boats"] .road-vehicle {
  bottom: 3%;
  animation: boats-sail 20s linear infinite;
}
#app[data-theme="boats"] .road-vehicle.rv2 {
  bottom: 1%; left: auto;
  animation: boats-sub 24s ease-in-out infinite 6s;
}

/* ---- PRINCESSES: Magical floating with gentle up-down sparkle motion ---- */
@keyframes princess-float {
  0%   { left: -100px; transform: translateY(0) scale(1); }
  10%  { transform: translateY(-12px) scale(1.02); }
  20%  { transform: translateY(-4px) scale(1); }
  30%  { transform: translateY(-16px) scale(1.03); }
  40%  { transform: translateY(-2px) scale(.99); }
  50%  { transform: translateY(-14px) scale(1.02); }
  60%  { transform: translateY(-6px) scale(1); }
  70%  { transform: translateY(-18px) scale(1.03); }
  80%  { transform: translateY(-3px) scale(.99); }
  90%  { transform: translateY(-10px) scale(1.01); }
  100% { left: calc(100% + 100px); transform: translateY(0) scale(1); }
}
@keyframes princess-unicorn {
  0%   { right: -100px; transform: scaleX(-1) translateY(0); }
  8%   { transform: scaleX(-1) translateY(-18px); }
  16%  { transform: scaleX(-1) translateY(0); }
  24%  { transform: scaleX(-1) translateY(-14px); }
  32%  { transform: scaleX(-1) translateY(0); }
  40%  { transform: scaleX(-1) translateY(-20px); }
  48%  { transform: scaleX(-1) translateY(0); }
  56%  { transform: scaleX(-1) translateY(-16px); }
  64%  { transform: scaleX(-1) translateY(0); }
  72%  { transform: scaleX(-1) translateY(-18px); }
  80%  { transform: scaleX(-1) translateY(0); }
  88%  { transform: scaleX(-1) translateY(-12px); }
  96%  { transform: scaleX(-1) translateY(0); }
  100% { right: calc(100% + 100px); transform: scaleX(-1) translateY(-5px); }
}
#app[data-theme="unicorns"] .road-vehicle {
  bottom: 5%;
  animation: princess-float 18s ease-in-out infinite;
}
#app[data-theme="unicorns"] .road-vehicle.rv2 {
  bottom: 2%; left: auto;
  animation: princess-unicorn 16s linear infinite 4s;
}

/* ---- ANIMALS: Trot with rhythmic hopping gait ---- */
@keyframes animals-trot {
  0%    { left: -100px; transform: translateY(0); }
  4%    { transform: translateY(-8px) rotate(-2deg); }
  8%    { transform: translateY(0) rotate(0); }
  12%   { transform: translateY(-8px) rotate(-2deg); }
  16%   { transform: translateY(0) rotate(0); }
  20%   { transform: translateY(-8px) rotate(-2deg); }
  24%   { transform: translateY(0) rotate(0); }
  28%   { transform: translateY(-8px) rotate(-2deg); }
  32%   { transform: translateY(0) rotate(0); }
  36%   { transform: translateY(-8px) rotate(-2deg); }
  40%   { transform: translateY(0) rotate(0); }
  44%   { transform: translateY(-8px) rotate(-2deg); }
  48%   { transform: translateY(0) rotate(0); }
  52%   { transform: translateY(-8px) rotate(-2deg); }
  56%   { transform: translateY(0) rotate(0); }
  60%   { transform: translateY(-8px) rotate(-2deg); }
  64%   { transform: translateY(0) rotate(0); }
  68%   { transform: translateY(-8px) rotate(-2deg); }
  72%   { transform: translateY(0) rotate(0); }
  76%   { transform: translateY(-8px) rotate(-2deg); }
  80%   { transform: translateY(0) rotate(0); }
  84%   { transform: translateY(-8px) rotate(-2deg); }
  88%   { transform: translateY(0) rotate(0); }
  92%   { transform: translateY(-8px) rotate(-2deg); }
  96%   { transform: translateY(0) rotate(0); }
  100%  { left: calc(100% + 100px); transform: translateY(0); }
}
@keyframes animals-hop {
  0%    { right: -100px; transform: scaleX(-1) translateY(0); }
  6%    { transform: scaleX(-1) translateY(-20px) rotate(5deg); }
  12%   { transform: scaleX(-1) translateY(0) rotate(0); }
  14%   { transform: scaleX(-1) translateY(0) rotate(0); }
  20%   { transform: scaleX(-1) translateY(-22px) rotate(5deg); }
  26%   { transform: scaleX(-1) translateY(0) rotate(0); }
  28%   { transform: scaleX(-1) translateY(0) rotate(0); }
  34%   { transform: scaleX(-1) translateY(-18px) rotate(5deg); }
  40%   { transform: scaleX(-1) translateY(0) rotate(0); }
  42%   { transform: scaleX(-1) translateY(0) rotate(0); }
  48%   { transform: scaleX(-1) translateY(-24px) rotate(5deg); }
  54%   { transform: scaleX(-1) translateY(0) rotate(0); }
  56%   { transform: scaleX(-1) translateY(0) rotate(0); }
  62%   { transform: scaleX(-1) translateY(-20px) rotate(5deg); }
  68%   { transform: scaleX(-1) translateY(0) rotate(0); }
  70%   { transform: scaleX(-1) translateY(0) rotate(0); }
  76%   { transform: scaleX(-1) translateY(-22px) rotate(5deg); }
  82%   { transform: scaleX(-1) translateY(0) rotate(0); }
  84%   { transform: scaleX(-1) translateY(0) rotate(0); }
  90%   { transform: scaleX(-1) translateY(-16px) rotate(5deg); }
  96%   { transform: scaleX(-1) translateY(0) rotate(0); }
  100%  { right: calc(100% + 100px); transform: scaleX(-1) translateY(0); }
}
#app[data-theme="animals"] .road-vehicle {
  bottom: 1%;
  animation: animals-trot 14s linear infinite;
}
#app[data-theme="animals"] .road-vehicle.rv2 {
  bottom: 2%; left: auto;
  animation: animals-hop 18s linear infinite 4s;
}

/* ---- FLOWERS: Butterflies with erratic zigzag flutter ---- */
@keyframes flowers-flutter {
  0%   { left: -80px; top: 50%; transform: rotate(0deg) scale(1); }
  5%   { top: 38%; transform: rotate(12deg) scale(1.1); }
  10%  { top: 55%; transform: rotate(-8deg) scale(.9); }
  15%  { top: 30%; transform: rotate(15deg) scale(1.05); }
  20%  { top: 48%; transform: rotate(-5deg) scale(.95); }
  25%  { top: 25%; transform: rotate(10deg) scale(1.1); }
  30%  { top: 52%; transform: rotate(-12deg) scale(.9); }
  35%  { top: 35%; transform: rotate(8deg) scale(1.05); }
  40%  { top: 58%; transform: rotate(-10deg) scale(.95); }
  45%  { top: 28%; transform: rotate(14deg) scale(1.08); }
  50%  { top: 50%; transform: rotate(-6deg) scale(.92); }
  55%  { top: 32%; transform: rotate(11deg) scale(1.06); }
  60%  { top: 55%; transform: rotate(-9deg) scale(.93); }
  65%  { top: 22%; transform: rotate(13deg) scale(1.1); }
  70%  { top: 45%; transform: rotate(-7deg) scale(.95); }
  75%  { top: 30%; transform: rotate(9deg) scale(1.04); }
  80%  { top: 52%; transform: rotate(-11deg) scale(.92); }
  85%  { top: 35%; transform: rotate(7deg) scale(1.03); }
  90%  { top: 48%; transform: rotate(-5deg) scale(.97); }
  95%  { top: 40%; transform: rotate(6deg) scale(1.02); }
  100% { left: calc(100% + 80px); top: 42%; transform: rotate(0deg) scale(1); }
}
@keyframes flowers-bee {
  0%   { right: -80px; top: 40%; transform: scaleX(-1) rotate(0deg); }
  8%   { top: 28%; transform: scaleX(-1) rotate(-10deg); }
  16%  { top: 50%; transform: scaleX(-1) rotate(8deg); }
  24%  { top: 32%; transform: scaleX(-1) rotate(-12deg); }
  32%  { top: 55%; transform: scaleX(-1) rotate(6deg); }
  40%  { top: 25%; transform: scaleX(-1) rotate(-8deg); }
  48%  { top: 48%; transform: scaleX(-1) rotate(10deg); }
  56%  { top: 30%; transform: scaleX(-1) rotate(-6deg); }
  64%  { top: 52%; transform: scaleX(-1) rotate(9deg); }
  72%  { top: 35%; transform: scaleX(-1) rotate(-11deg); }
  80%  { top: 45%; transform: scaleX(-1) rotate(5deg); }
  88%  { top: 28%; transform: scaleX(-1) rotate(-7deg); }
  96%  { top: 42%; transform: scaleX(-1) rotate(4deg); }
  100% { right: calc(100% + 80px); top: 38%; transform: scaleX(-1) rotate(0deg); }
}
#app[data-theme="flowers"] .road-vehicle {
  bottom: auto;
  animation: flowers-flutter 16s ease-in-out infinite;
}
#app[data-theme="flowers"] .road-vehicle.rv2 {
  bottom: auto; left: auto;
  animation: flowers-bee 20s ease-in-out infinite 5s;
}

/* Rolling hills — landscape depth between sky and ground */
.hills {
  position: absolute;
  bottom: 14%;
  left: -5%;
  width: 110%;
  height: 10%;
  z-index: 1;
  border-radius: 70% 50% 0 0 / 100% 100% 0 0;
  pointer-events: none;
}
.hills::before {
  content: '';
  position: absolute;
  bottom: 0; left: 10%;
  width: 50%;
  height: 130%;
  border-radius: 50% 60% 0 0 / 100% 100% 0 0;
  background: inherit;
  opacity: .7;
}
#app[data-theme="cars"] .hills { background: #5aad35; }
#app[data-theme="cars"] .hills::before { background: #4fa030; }
#app[data-theme="space"] .hills { background: #555577; border-radius: 40% 55% 0 0 / 100% 100% 0 0; }
#app[data-theme="space"] .hills::before { background: #4a4a68; }
#app[data-theme="planes"] .hills { background: #6aaa48; }
#app[data-theme="planes"] .hills::before { background: #5a9a3a; }
#app[data-theme="boats"] .hills { display: none; }
#app[data-theme="unicorns"] .hills { background: #b8e6b0; }
#app[data-theme="unicorns"] .hills::before { background: #a8d8a0; }
#app[data-theme="animals"] .hills { background: #2d6b25; }
#app[data-theme="animals"] .hills::before { background: #256020; }
#app[data-theme="flowers"] .hills { background: #6ab840; }
#app[data-theme="flowers"] .hills::before { background: #5aa835; }

/* Scene decorations — SVG illustrations */
.decor {
  position: absolute;
  z-index: 2;
  opacity: .8;
  animation: sway 5s ease-in-out infinite;
  pointer-events: none;
}
.decor svg { display: block; }
.decor:nth-child(odd) { animation-delay: 2s; }
.decor:nth-child(3n) { animation-delay: 3.5s; }
@keyframes sway { 0%,100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg); } }
@keyframes twinkle { 0%,100% { opacity: .3; } 50% { opacity: .9; } }
.decor.twinkle { animation: twinkle 2.5s ease-in-out infinite; }

.cloud {
  position: absolute;
  background: rgba(255,255,255,.85);
  border-radius: 50px;
  opacity: .75;
  z-index: 1;
  box-shadow: 0 4px 20px rgba(255,255,255,.3), inset 0 -2px 6px rgba(0,0,0,.03);
}
.cloud::before, .cloud::after {
  content: ''; position: absolute; border-radius: 50%;
  background: rgba(255,255,255,.9);
}
.cloud::before { width: 55%; height: 130%; top: -55%; left: 18%; }
.cloud::after { width: 40%; height: 110%; top: -35%; right: 18%; }

@keyframes drift { from { transform: translateX(-180px); } to { transform: translateX(calc(100vw + 180px)); } }
.cloud-1 { width: 130px; height: 42px; top: 4%; animation: drift 35s linear infinite; }
.cloud-2 { width: 95px; height: 32px; top: 13%; animation: drift 45s linear infinite 12s; opacity: .6; }
.cloud-3 { width: 110px; height: 38px; top: 7%; animation: drift 40s linear infinite 22s; }

.sun {
  position: absolute; top: 3%; right: 8%;
  width: 80px; height: 80px;
  background: radial-gradient(circle at 35% 35%, #fff8d0 0%, #FFD700 50%, #f0a000 100%);
  border-radius: 50%;
  box-shadow: 0 0 50px rgba(255,215,0,.4), 0 0 100px rgba(255,215,0,.15);
  animation: pulse-sun 4s ease-in-out infinite;
  z-index: 1;
}
.sun::after {
  content: ''; position: absolute; top: -25px; right: -25px; bottom: -25px; left: -25px; inset: -25px;
  background: radial-gradient(circle, rgba(255,215,0,.2) 20%, rgba(255,200,0,.08) 50%, transparent 70%);
  border-radius: 50%;
  animation: pulse-sun 4s ease-in-out infinite reverse;
}
@keyframes pulse-sun { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }

.road {
  position: absolute; bottom: 0; width: 100%; height: 15%;
  background: #4a4a5a;
  z-index: 1;
  box-shadow: 0 -6px 20px rgba(0,0,0,.12);
}
.road::before {
  content: ''; position: absolute;
  top: 48%; left: 0; width: 100%; height: 4px;
  background: repeating-linear-gradient(90deg, #fff 0, #fff 30px, transparent 30px, transparent 60px);
}

.screen { display: none; position: absolute; top: 0; right: 0; bottom: 0; left: 0; inset: 0; z-index: 10; opacity: 0; }
.screen.active { display: flex; animation: screen-in .4s ease forwards; }
@keyframes screen-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }

#menu-screen {
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px; gap: clamp(4px, 1.2vh, 8px);
  padding: calc(1vh + env(safe-area-inset-top, 0px)) calc(16px + env(safe-area-inset-right, 0px)) calc(15vh + env(safe-area-inset-bottom, 0px)) calc(16px + env(safe-area-inset-left, 0px));
}

.menu-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: bounce-title 3s ease-in-out infinite;
  text-align: center;
}
.title-logo {
  width: 360px; width: clamp(180px, 36vw, 360px);
  height: auto;
  object-fit: contain;
  -webkit-user-drag: none;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.2));
}
@keyframes bounce-title {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.menu-subtitle {
  font-size: 20px; font-size: clamp(14px, 2.5vw, 20px);
  color: rgba(255,255,255,.9);
  font-weight: 800;
  text-align: center;
}

.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  width: 100%;
  max-width: 700px;
  padding: 4px;
}

.menu-btn {
  background: linear-gradient(135deg, #fff 0%, #f8f9ff 100%);
  border: none;
  border-radius: 16px;
  padding: 8px 6px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0,0,0,.12), 0 6px 16px rgba(0,0,0,.08);
  transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s;
  -webkit-user-select: none;
  border-left: 5px solid transparent;
  min-height: 48px;
  position: relative;
  overflow: hidden;
}
.menu-btn::after {
  content: '';
  position: absolute; top: 0; right: 0; bottom: 0; left: 0; inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,.4) 50%, transparent 60%);
  background-size: 300% 300%;
  opacity: 0;
  transition: opacity .3s;
}
.menu-btn:active {
  transform: translateY(3px) scale(.97);
  box-shadow: 0 1px 0 rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.08);
}
.menu-btn:active::after { opacity: 1; }
.menu-icon {
  width: 80px; width: clamp(48px, 10vw, 80px);
  height: 80px; height: clamp(48px, 10vw, 80px);
  object-fit: contain;
  flex-shrink: 0;
  -webkit-user-drag: none;
  transition: transform .3s cubic-bezier(.34,1.56,.64,1);
}
.menu-btn:active .menu-icon { transform: scale(1.15) rotate(-6deg); }
.menu-btn .label {
  font-family: 'Nunito', sans-serif; font-weight: 800;
  font-size: 14px; font-size: clamp(11px, 1.6vw, 14px);
  color: #555;
  text-align: center;
  line-height: 1.1;
}
/* Color accent stripe on menu buttons */
.menu-btn[data-game="tap"] { border-left-color: var(--red); }
.menu-btn[data-game="match"] { border-left-color: var(--blue); }
.menu-btn[data-game="order"] { border-left-color: #2ed573; }
.menu-btn[data-game="missing"] { border-left-color: var(--yellow); }
.menu-btn[data-game="math-add"] { border-left-color: #00b894; }
.menu-btn[data-game="math-sub"] { border-left-color: var(--orange); }
.menu-btn[data-game="math-mix"] { border-left-color: var(--purple); }
.menu-btn[data-game="write"] { border-left-color: var(--pink); }
.menu-btn[data-game="solve"] { border-left-color: #00d2d3; }

/* Theme picker */
.theme-picker {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 4px 0;
}
.theme-btn {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.5);
  background: rgba(255,255,255,.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 3px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  cursor: pointer;
  transition: all .3s cubic-bezier(.34,1.56,.64,1);
  -webkit-user-select: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
}
.theme-btn:active { transform: scale(.85); }
.theme-icon {
  width: 100%; height: 100%;
  object-fit: contain;
  border-radius: 50%;
  -webkit-user-drag: none;
}
.theme-btn.active {
  border-color: white;
  background: rgba(255,255,255,.7);
  transform: scale(1.35);
  box-shadow: 0 4px 16px rgba(0,0,0,.25), 0 0 28px rgba(255,255,255,.5);
  z-index: 2;
}

.game-header {
  position: absolute; top: 0; left: 0; right: 0;
  height: 52px;
  display: flex; align-items: center; justify-content: center;
  padding: calc(6px + env(safe-area-inset-top, 0px)) 16px 6px;
  z-index: 20;
}

.back-btn {
  position: absolute;
  top: calc(6px + env(safe-area-inset-top, 0px));
  left: calc(10px + env(safe-area-inset-left, 0px));
  z-index: 30;
  background: rgba(0,0,0,.25);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: none;
  border-radius: 50%;
  width: 40px; height: 40px;
  min-width: 40px; min-height: 40px;
  max-width: 40px; max-height: 40px;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
  display: flex; align-items: center; justify-content: center;
  transition: transform .2s, background .2s;
  opacity: .7;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
}
.back-btn:hover { opacity: 1; background: rgba(0,0,0,.4); }
.back-btn:active { transform: scale(.85); }
.back-btn svg path, .back-btn svg rect { fill: #fff; }

/* In fullscreen, system X is at top-left — shift back button right */
:fullscreen .back-btn,
:-webkit-full-screen .back-btn {
  left: calc(100px + env(safe-area-inset-left, 0px));
}

.game-title-bar {
  display: none;
}

.stars-display {
  display: flex; gap: 4px;
  font-size: 28px;
  filter: drop-shadow(0 2px 4px rgba(255,215,0,.3));
  flex: 1;
  justify-content: center;
}
.stars-bump {
  animation: stars-arrive .4s cubic-bezier(.34,1.56,.64,1);
}
@keyframes stars-arrive {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.game-area {
  position: absolute;
  top: 52px; left: 0; right: 0; bottom: 0;
  padding-bottom: 15vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 16px 15vh;
  gap: 12px;
  overflow: hidden;
}

.vehicle-container {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .2s;
  -webkit-user-select: none;
}
.vehicle-container:active { transform: scale(.92); }
.vehicle-container.counted {
  animation: pop .4s cubic-bezier(.175, .885, .32, 1.275);
}

@keyframes pop {
  0% { transform: scale(0); opacity: 0; }
  40% { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.count-badge {
  position: absolute;
  top: -10px; right: -10px;
  background: var(--red);
  color: white;
  font-family: 'Nunito', sans-serif; font-weight: 800;
  font-size: 28px; font-size: clamp(20px, 3.5vw, 28px);
  width: 44px; width: clamp(34px, 5vw, 44px); height: 44px; height: clamp(34px, 5vw, 44px);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
  animation: badge-pop .3s cubic-bezier(.175, .885, .32, 1.275);
}
@keyframes badge-pop { 0% { transform: scale(0); } 100% { transform: scale(1); } }

#tap-screen { flex-direction: column; }

.tap-prompt {
  font-family: 'Nunito', sans-serif; font-weight: 800;
  font-size: 36px; font-size: clamp(22px, 4vw, 36px);
  color: white;
  text-shadow: 2px 2px 0 rgba(0,0,0,.2);
  text-align: center;
  padding: 8px;
}

.tap-counter {
  font-family: 'Nunito', sans-serif; font-weight: 800;
  font-size: 80px; font-size: clamp(48px, 10vw, 80px);
  color: white;
  text-shadow: 4px 4px 0 rgba(0,0,0,.15);
  line-height: 1;
  transition: transform .2s;
}
.tap-counter.bump { animation: number-bump .3s ease; }
@keyframes number-bump {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.vehicles-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  max-width: 900px;
  padding: 10px;
}

.match-question, .math-question {
  font-family: 'Nunito', sans-serif; font-weight: 800;
  font-size: 32px; font-size: clamp(20px, 3.5vw, 32px);
  color: white;
  text-shadow: 2px 2px 0 rgba(0,0,0,.2);
  text-align: center;
}

.match-vehicles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  padding: 10px;
}

.match-options, .math-options {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.match-option, .math-option {
  background: white;
  border: 4px solid #ddd;
  border-radius: 22px;
  width: 110px; width: clamp(68px, 13vw, 110px);
  height: 110px; height: clamp(68px, 13vw, 110px);
  font-family: 'Nunito', sans-serif; font-weight: 800;
  font-size: 48px; font-size: clamp(30px, 6vw, 48px);
  color: #333;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s, border-color .15s, background .15s;
  box-shadow: 0 4px 0 rgba(0,0,0,.1);
}
.match-option:active, .math-option:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.1); }
.match-option.correct, .math-option.correct {
  background: #d4edda; border-color: var(--green);
  animation: correct-shake .6s cubic-bezier(.34,1.56,.64,1);
}
.match-option.wrong, .math-option.wrong {
  background: #f8d7da; border-color: var(--red);
  animation: wrong-shake .6s ease;
}
@keyframes correct-shake {
  0% { transform: scale(1); }
  25% { transform: scale(1.35) rotate(-5deg); }
  50% { transform: scale(1.15) rotate(3deg); }
  75% { transform: scale(1.25) rotate(-2deg); }
  100% { transform: scale(1); }
}
@keyframes wrong-shake {
  0%,100% { transform: translateX(0) rotate(0); }
  10% { transform: translateX(-10px) rotate(-4deg); }
  20% { transform: translateX(10px) rotate(4deg); }
  30% { transform: translateX(-10px) rotate(-4deg); }
  40% { transform: translateX(8px) rotate(3deg); }
  50% { transform: translateX(-6px) rotate(-2deg); }
  60% { transform: translateX(6px) rotate(2deg); }
  70% { transform: translateX(-4px) rotate(-1deg); }
  80% { transform: translateX(2px); }
}

/* Math problem display */
.math-problem {
  font-family: 'Nunito', sans-serif; font-weight: 800;
  font-size: 96px; font-size: clamp(48px, 12vw, 96px);
  color: white;
  text-shadow: 3px 3px 0 rgba(0,0,0,.2);
  text-align: center;
  line-height: 1.1;
  letter-spacing: 4px;
}
.math-problem .op { color: var(--yellow); }
.math-problem .eq { color: rgba(255,255,255,.6); }

.math-vehicles-row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  padding: 8px;
}
.math-op-symbol {
  font-family: 'Nunito', sans-serif; font-weight: 800;
  font-size: 44px; font-size: clamp(28px, 5vw, 44px);
  color: var(--yellow);
  text-shadow: 2px 2px 0 rgba(0,0,0,.15);
  margin: 0 6px;
}

.order-instruction {
  font-family: 'Nunito', sans-serif; font-weight: 800;
  font-size: 28px; font-size: clamp(18px, 3vw, 28px);
  color: white;
  text-shadow: 2px 2px 0 rgba(0,0,0,.2);
  text-align: center;
}

.order-slots {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 10px;
}

.order-slot {
  width: 68px; width: clamp(48px, 8vw, 68px);
  height: 68px; height: clamp(48px, 8vw, 68px);
  background: rgba(255,255,255,.3);
  border: 3px dashed rgba(255,255,255,.7);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Nunito', sans-serif; font-weight: 800;
  font-size: 34px; font-size: clamp(22px, 4vw, 34px);
  color: white;
  text-shadow: 1px 1px 0 rgba(0,0,0,.15);
  transition: background .2s, border-color .2s;
}
.order-slot.filled {
  background: rgba(255,255,255,.85);
  border: 3px solid var(--green);
  color: #333;
  text-shadow: none;
}
.order-slot.next {
  border-color: var(--yellow);
  background: rgba(255,255,255,.5);
  animation: pulse-slot 1s ease-in-out infinite;
}
@keyframes pulse-slot {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.order-choices {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.order-choice {
  background: white;
  border: 3px solid #ddd;
  border-radius: 16px;
  width: 72px; width: clamp(52px, 9vw, 72px);
  height: 72px; height: clamp(52px, 9vw, 72px);
  font-family: 'Nunito', sans-serif; font-weight: 800;
  font-size: 36px; font-size: clamp(24px, 4vw, 36px);
  color: #333;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 0 rgba(0,0,0,.1);
  transition: transform .15s, opacity .3s;
}
.order-choice:active { transform: translateY(3px); }
.order-choice.used { opacity: .3; pointer-events: none; }
.order-choice.wrong { animation: wrong-shake .4s ease; }

.missing-instruction {
  font-family: 'Nunito', sans-serif; font-weight: 800;
  font-size: 28px; font-size: clamp(18px, 3vw, 28px);
  color: white;
  text-shadow: 2px 2px 0 rgba(0,0,0,.2);
  text-align: center;
}

.missing-sequence {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 10px;
}

.seq-num {
  width: 72px; width: clamp(50px, 9vw, 72px);
  height: 72px; height: clamp(50px, 9vw, 72px);
  background: rgba(255,255,255,.85);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Nunito', sans-serif; font-weight: 800;
  font-size: 38px; font-size: clamp(24px, 4.5vw, 38px);
  color: #333;
  box-shadow: 0 3px 8px rgba(0,0,0,.1);
}
.seq-num.blank {
  background: rgba(255,255,255,.35);
  border: 3px dashed var(--yellow);
  color: transparent;
  animation: pulse-slot 1s ease-in-out infinite;
}
.seq-num.filled-blank {
  background: #d4edda;
  border: 3px solid var(--green);
  color: #333;
  animation: correct-shake .5s ease;
}

.missing-choices {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

.missing-choice {
  background: white;
  border: 3px solid #ddd;
  border-radius: 16px;
  width: 80px; width: clamp(56px, 10vw, 80px);
  height: 80px; height: clamp(56px, 10vw, 80px);
  font-family: 'Nunito', sans-serif; font-weight: 800;
  font-size: 40px; font-size: clamp(26px, 4.5vw, 40px);
  color: #333;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 0 rgba(0,0,0,.1);
  transition: transform .15s;
}
.missing-choice:active { transform: translateY(3px); }
.missing-choice.correct {
  background: #d4edda; border-color: var(--green);
}
.missing-choice.wrong {
  animation: wrong-shake .4s ease;
}

.success-overlay {
  display: none;
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0; inset: 0;
  z-index: 50;
  background: radial-gradient(circle at center, rgba(0,0,0,.15) 0%, rgba(0,0,0,.5) 100%);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.success-overlay.active { display: flex; animation: overlay-in .5s ease; }
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
.success-overlay.active::before {
  content: ''; position: absolute; top: 0; right: 0; bottom: 0; left: 0; inset: 0;
  background: radial-gradient(circle at 50% 40%, rgba(255,215,0,.15) 0%, transparent 60%);
  animation: success-glow 2s ease-in-out infinite;
  pointer-events: none;
}
@keyframes success-glow {
  0%,100% { opacity: .5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
}

.success-stars {
  font-size: 70px;
  animation: success-bounce .8s cubic-bezier(.34,1.56,.64,1);
  filter: drop-shadow(0 4px 12px rgba(255,215,0,.4));
}
@keyframes success-bounce {
  0% { transform: scale(0) rotate(-30deg); opacity: 0; }
  50% { transform: scale(1.4) rotate(8deg); opacity: 1; }
  70% { transform: scale(.85) rotate(-4deg); }
  85% { transform: scale(1.1) rotate(2deg); }
  100% { transform: scale(1) rotate(0); }
}

.success-text {
  font-family: 'Nunito', sans-serif; font-weight: 800;
  font-size: 56px; font-size: clamp(36px, 7vw, 56px);
  color: white;
  text-shadow: 2px 2px 0 rgba(0,0,0,.2), 0 4px 20px rgba(0,0,0,.15), 0 0 40px rgba(255,255,255,.2);
  text-align: center;
  white-space: pre-line;
  animation: none;
}
@keyframes text-pop { from { opacity: 0; transform: translateY(30px) scale(.8); } to { opacity: 1; transform: translateY(0) scale(1); } }

.success-btn {
  background: linear-gradient(135deg, #fff 0%, #f0f0ff 100%);
  border: none;
  border-radius: 24px;
  padding: 18px 48px;
  font-family: 'Nunito', sans-serif; font-weight: 800;
  font-size: 26px; font-size: clamp(20px, 3.5vw, 26px);
  color: #333;
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(0,0,0,.12), 0 8px 20px rgba(0,0,0,.1);
  transition: transform .2s cubic-bezier(.34,1.56,.64,1);
  margin-top: 10px;
  animation: none;
}
.success-btn:active { transform: translateY(4px) scale(.96); box-shadow: 0 2px 0 rgba(0,0,0,.12); }

/* ============ FLOATING STAR CELEBRATION ============ */
.star-celebrate-backdrop {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0; inset: 0;
  z-index: 54;
  background: rgba(0,0,0,.25);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  pointer-events: none;
  animation: star-backdrop 1.2s ease forwards;
}
@keyframes star-backdrop {
  0% { opacity: 0; }
  20% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; }
}
.star-celebrate {
  position: fixed;
  z-index: 55;
  font-size: 60px;
  pointer-events: none;
  animation: star-fly 1.1s cubic-bezier(.2,.8,.3,1) forwards;
  filter: drop-shadow(0 4px 12px rgba(255,215,0,.5));
  --fly-x: 50%;
  --fly-y: 40px;
}
@keyframes star-fly {
  0% { transform: scale(0) rotate(-20deg); opacity: 0; }
  25% { transform: scale(1.5) rotate(10deg); opacity: 1; }
  50% { transform: scale(1.2) rotate(-5deg); opacity: 1; }
  100% { left: var(--fly-x); top: var(--fly-y); transform: scale(.5) rotate(0deg); opacity: 0; font-size: 28px; }
}

.confetti-piece {
  position: absolute;
  z-index: 60;
  border-radius: 2px;
  animation: confetti-fall var(--dur, 2s) cubic-bezier(.25,.46,.45,.94) forwards;
  pointer-events: none;
}
@keyframes confetti-fall {
  0% { transform: translateY(0) translateX(0) rotate(0deg) scale(1); opacity: 1; }
  50% { opacity: 1; }
  100% { transform: translateY(100vh) translateX(var(--drift, 30px)) rotate(var(--spin, 720deg)) scale(.3); opacity: 0; }
}

.next-btn {
  background: linear-gradient(135deg, #FFB347 0%, var(--yellow) 50%, #FF8C00 100%);
  border: none;
  border-radius: 24px;
  padding: 18px 48px;
  font-family: 'Nunito', sans-serif; font-weight: 800;
  font-size: 28px; font-size: clamp(22px, 4vw, 28px);
  color: white;
  text-shadow: 1px 1px 0 rgba(0,0,0,.15);
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(200,120,0,.4), 0 8px 20px rgba(255,165,0,.3);
  transition: transform .2s cubic-bezier(.34,1.56,.64,1);
  animation: next-bounce 1.2s ease-in-out infinite;
  min-width: 200px;
  text-align: center;
}
@keyframes next-bounce {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.1) translateY(-4px); }
}
.next-btn:active { transform: translateY(4px) scale(.95); box-shadow: 0 2px 0 rgba(200,120,0,.4); }
.next-hidden { visibility: hidden; pointer-events: none; animation: none !important; }

.v-svg, .v-svg-sm, .v-svg-xs, .v-svg-road {
  height: auto; object-fit: contain; -webkit-user-drag: none; user-select: none; pointer-events: none;
}
.v-svg { width: 150px; width: clamp(80px, 14vw, 150px); }
.v-svg-sm { width: 110px; width: clamp(60px, 11vw, 110px); }
.v-svg-xs { width: 90px; width: clamp(48px, 9vw, 90px); }
.v-svg-road { width: 90px; width: clamp(60px, 9vw, 90px); }

/* ============ DRAWING CANVAS ============ */
.draw-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.draw-prompt {
  font-family: 'Nunito', sans-serif; font-weight: 800;
  font-size: 32px; font-size: clamp(20px, 3.5vw, 32px);
  color: white;
  text-shadow: 2px 2px 0 rgba(0,0,0,.2);
  text-align: center;
}
.canvas-wrap {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0,0,0,.2), inset 0 0 0 4px rgba(255,255,255,.3);
  background: white;
  touch-action: none;
}
.draw-canvas {
  display: block;
  border-radius: 24px;
  cursor: crosshair;
}
.canvas-ghost {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0; inset: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Nunito', sans-serif; font-weight: 800;
  font-size: 160px;
  color: rgba(0,0,0,.15);
  user-select: none;
  -webkit-user-select: none;
  opacity: 0;
  transition: opacity .3s;
}
.draw-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.draw-btn {
  border: none;
  border-radius: 16px;
  padding: 12px 28px;
  font-family: 'Nunito', sans-serif; font-weight: 800;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0,0,0,.15);
  transition: transform .15s;
}
.draw-btn:active { transform: translateY(3px); }
.draw-btn.clear { background: #f1f2f6; color: #555; }
.draw-btn.hint-btn { background: #FFF3E0; color: #F0A000; }
.canvas-ghost.ghost-visible {
  opacity: 1;
  animation: ghost-show 2.5s ease forwards;
}
@keyframes ghost-show {
  0% { opacity: 0; transform: scale(.8); }
  15% { opacity: 1; transform: scale(1); }
  75% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.05); }
}
.draw-btn.submit { background: var(--green); color: white; text-shadow: 1px 1px 0 rgba(0,0,0,.15); }
.draw-btn.submit:disabled { opacity: .4; pointer-events: none; }

.draw-result {
  font-family: 'Nunito', sans-serif; font-weight: 800;
  font-size: 30px; font-size: clamp(20px, 3.5vw, 30px);
  color: white;
  text-shadow: 2px 2px 0 rgba(0,0,0,.2);
  text-align: center;
  min-height: 36px;
}
.draw-result.correct-msg { color: #7bed9f; }
.draw-result.wrong-msg { color: #ff6b81; }

/* Sparkle effect for correct answers */
.sparkle {
  position: absolute;
  pointer-events: none;
  z-index: 30;
}
.sparkle-dot {
  position: absolute;
  width: 8px; height: 8px;
  background: var(--yellow);
  border-radius: 50%;
  animation: sparkle-fly .6s ease-out forwards;
}
@keyframes sparkle-fly {
  0% { transform: translate(0,0) scale(1); opacity: 1; }
  100% { transform: translate(var(--sx), var(--sy)) scale(0); opacity: 0; }
}

/* ============ FULLSCREEN BUTTON ============ */
.fullscreen-btn {
  position: absolute;
  top: calc(6px + env(safe-area-inset-top, 0px));
  right: calc(6px + env(safe-area-inset-right, 0px));
  display: none;
  z-index: 30;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,.25);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s, background .2s;
  opacity: .7;
}
.fullscreen-btn:hover { opacity: 1; background: rgba(0,0,0,.4); }
.fullscreen-btn:active { transform: scale(.85); }
.fullscreen-btn svg { display: block; }

.sound-btn {
  position: absolute;
  top: calc(6px + env(safe-area-inset-top, 0px));
  right: calc(50px + env(safe-area-inset-right, 0px));
  z-index: 30;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,.25);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s, background .2s;
  opacity: .7;
}
.sound-btn:hover { opacity: 1; background: rgba(0,0,0,.4); }
.sound-btn:active { transform: scale(.85); }
.sound-btn svg { display: block; }

/* Hide on iOS Safari (no Fullscreen API support) */
@supports not ((-webkit-touch-callout: none) and (not (fullscreen: auto))) {
}

/* ============ AGE BADGE ON MENU BUTTONS ============ */
.age-badge {
  position: absolute;
  top: 4px;
  right: 6px;
  background: rgba(0,0,0,.06);
  color: rgba(0,0,0,.35);
  font-family: 'Nunito', sans-serif; font-weight: 800;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 8px;
  line-height: 1.4;
  pointer-events: none;
}

/* ============ WRONG ANSWER HINT ============ */
.hint-pulse {
  animation: hint-glow .4s ease 3 !important;
  border-color: var(--green) !important;
}
@keyframes hint-glow {
  0%, 100% { box-shadow: 0 4px 0 rgba(0,0,0,.1); transform: scale(1); }
  50% { box-shadow: 0 0 24px rgba(46,213,115,.5); transform: scale(1.12); }
}

/* ============ EXIT CONFIRMATION ============ */
.confirm-overlay {
  display: none;
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0; inset: 0;
  z-index: 55;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}
.confirm-overlay.active { display: flex; animation: overlay-in .3s ease; }
.confirm-box {
  background: white;
  border-radius: 28px;
  padding: 28px 32px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,.2);
  animation: text-pop .4s cubic-bezier(.34,1.56,.64,1);
  max-width: 320px;
  width: 85%;
}
.confirm-text {
  font-family: 'Nunito', sans-serif; font-weight: 800;
  font-size: 30px; font-size: clamp(22px, 4vw, 30px);
  color: #333;
  margin-bottom: 20px;
  line-height: 1.3;
}
.confirm-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
}
.confirm-btn {
  border: none;
  border-radius: 20px;
  padding: 16px 32px;
  font-family: 'Nunito', sans-serif; font-weight: 800;
  font-size: 24px; font-size: clamp(18px, 3vw, 24px);
  cursor: pointer;
  min-width: 100px;
  transition: transform .2s cubic-bezier(.34,1.56,.64,1);
  box-shadow: 0 4px 0 rgba(0,0,0,.15);
}
.confirm-btn:active { transform: translateY(3px) scale(.96); box-shadow: 0 1px 0 rgba(0,0,0,.15); }
.confirm-no {
  background: linear-gradient(135deg, #2ed573 0%, #26c064 100%);
  color: white;
  text-shadow: 1px 1px 0 rgba(0,0,0,.1);
  box-shadow: 0 4px 0 rgba(30,160,80,.4);
}
.confirm-yes {
  background: linear-gradient(135deg, #ff6b81 0%, #FF4757 100%);
  color: white;
  text-shadow: 1px 1px 0 rgba(0,0,0,.1);
  box-shadow: 0 4px 0 rgba(200,50,60,.4);
}

/* ============ VISUAL STAR SCORING ============ */
.success-stars {
  display: flex;
  gap: 8px;
}
.star-earned, .star-missed {
  display: inline-block;
  font-size: 60px; font-size: clamp(40px, 8vw, 60px);
  animation: star-pop .4s cubic-bezier(.34,1.56,.64,1) both;
}
.star-earned {
  filter: drop-shadow(0 3px 10px rgba(255,215,0,.5));
}
.star-missed {
  filter: grayscale(1) opacity(.25);
}
@keyframes star-pop {
  from { transform: scale(0) rotate(-30deg); opacity: 0; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}

/* ============ PHONES PORTRAIT (up to 480px) ============ */
@media (max-width: 480px) and (orientation: portrait) {
  .title-logo { width: 260px; width: clamp(200px, 55vw, 260px); }
  .theme-btn { width: 46px; height: 46px; }
  .menu-grid { gap: 8px; max-width: 100%; }
  .menu-btn { padding: 10px 6px 8px; border-radius: 16px; }
  .menu-icon { width: 72px; width: clamp(56px, 15vw, 72px); height: 72px; height: clamp(56px, 15vw, 72px); }
  .menu-btn .label { font-size: 15px; font-size: clamp(12px, 3.2vw, 15px); }
  .menu-subtitle { font-size: 14px; }
}

/* ============ SMALL PHONES ============ */
@media (max-width: 380px) {
  .menu-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .menu-btn .label { font-size: 11px; }
  .title-logo { width: 180px; }
  .menu-icon { width: 50px; height: 50px; }
  .match-option, .math-option { width: 60px; height: 60px; font-size: 26px; }
  .order-slot { width: 44px; height: 44px; font-size: 20px; }
  .order-choice { width: 48px; height: 48px; font-size: 22px; }
  .missing-choice { width: 52px; height: 52px; font-size: 24px; }
  .seq-num { width: 46px; height: 46px; font-size: 22px; }
  .game-area { padding: 10px; gap: 10px; }
}

/* Show fullscreen button in landscape on mobile/tablet */
@media (orientation: landscape) {
  .fullscreen-btn { display: flex; }
}
/* Always show on desktop */
@media (min-width: 1024px) {
  .fullscreen-btn { display: flex; }
}

/* ============ ROTATE OVERLAY FOR PHONES IN LANDSCAPE ============ */
.rotate-overlay {
  display: none;
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0; inset: 0;
  z-index: 9999;
  background: #87CEEB;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.rotate-overlay svg {
  animation: rotate-wobble 2s ease-in-out infinite;
}
@keyframes rotate-wobble {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(20deg); }
  75% { transform: rotate(-20deg); }
}
.rotate-overlay p {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 22px;
  color: white;
  text-shadow: 1px 1px 0 rgba(0,0,0,.15);
  text-align: center;
  padding: 0 20px;
}

@media (max-height: 500px) and (max-width: 932px) and (orientation: landscape) {
  .rotate-overlay { display: flex; }
}

/* Phone landscape is blocked by rotate overlay */

/* ============ TABLETS (768px+) ============ */
@media (min-width: 768px) {
  #menu-screen { gap: 1.2vh; padding: 1.5vh 4vw 15vh; }
  .title-logo { width: min(360px, 40vw); }
  .menu-grid { max-width: 90vw; gap: 1.5vw; }
  .menu-btn { padding: 1.2vh 1vw 1vh; min-height: auto; border-radius: 2.5vw; }
  .menu-icon { width: min(100px, 11vw); height: min(100px, 11vw); }
  .menu-btn .label { font-size: min(16px, 2vw); }
  .menu-subtitle { font-size: min(18px, 2.2vw); }
  .theme-btn { width: min(62px, 7vw); height: min(62px, 7vw); }
  .theme-picker { gap: 1.5vw; padding: 0.5vh 0; }

  .back-btn { width: min(56px, 5vw); height: min(56px, 5vw); min-width: min(44px, 4vw); min-height: min(44px, 4vw); max-width: 56px; max-height: 56px; }
  .stars-display { font-size: min(32px, 3vw); }
  .game-area { padding: 2vh 2.5vw; gap: 2vh; }

  .tap-prompt, .match-question, .math-question { font-size: min(36px, 3.5vw); }
  .tap-counter { font-size: min(100px, 10vw); }
  .math-problem { font-size: min(90px, 8.5vw); }
  .math-op-symbol { font-size: min(44px, 4vw); }
  .vehicles-grid { max-width: 90vw; }

  .v-svg { width: min(150px, 14vw); }
  .v-svg-sm { width: min(110px, 10vw); }
  .v-svg-xs { width: min(90px, 8vw); }

  .match-option, .math-option { width: min(110px, 10vw); height: min(110px, 10vw); font-size: min(48px, 4.5vw); border-radius: min(24px, 2.2vw); }
  .match-options, .math-options { gap: min(22px, 2vw); }
  .order-slot { width: min(78px, 7vw); height: min(78px, 7vw); font-size: min(38px, 3.5vw); }
  .order-choice { width: min(82px, 7.5vw); height: min(82px, 7.5vw); font-size: min(40px, 3.8vw); }
  .seq-num { width: min(80px, 7.5vw); height: min(80px, 7.5vw); font-size: min(40px, 3.8vw); }
  .missing-choice { width: min(90px, 8vw); height: min(90px, 8vw); font-size: min(44px, 4vw); }

  .next-btn { padding: 2vh 4vw; font-size: min(26px, 2.5vw); min-width: min(260px, 22vw); }
  .success-text { font-size: min(52px, 5vw); }
  .success-btn { padding: 2vh 4.5vw; font-size: min(26px, 2.5vw); }
  .count-badge { width: min(44px, 4vw); height: min(44px, 4vw); font-size: min(26px, 2.4vw); }

  .draw-canvas { width: min(320px, 30vw); height: min(320px, 30vw); }
  .canvas-ghost { font-size: min(200px, 20vw); }
  .draw-btn { padding: 1.5vh 3.5vw; font-size: min(22px, 2vw); }
  .draw-prompt { font-size: min(32px, 3vw); }

  .sun { width: min(110px, 10vw); height: min(110px, 10vw); }
}

/* ============ INTERACTIVE WHITEBOARDS (1400px+) ============ */
@media (min-width: 1400px) and (min-height: 800px) {
  .title-logo { width: 480px; }
  .menu-subtitle { font-size: 26px; }
  .menu-grid { max-width: 1100px; gap: 18px; }
  .menu-btn { padding: 18px 14px; border-radius: 24px; min-height: 100px; }
  .menu-icon { width: 120px; height: 120px; }
  .menu-btn .label { font-size: 20px; }
  .theme-btn { width: 76px; height: 76px; }
  .theme-picker { gap: 14px; }

  .game-header { height: 90px; padding: 14px 34px; }
  .back-btn { width: 64px; height: 64px; min-width: 64px; min-height: 64px; max-width: 64px; max-height: 64px; }
  .stars-display { font-size: 36px; }
  .game-area { top: 90px; padding: 28px; gap: 22px; }

  .tap-prompt, .match-question, .math-question { font-size: 40px; }
  .tap-counter { font-size: 110px; }
  .vehicles-grid { gap: 20px; max-width: 1100px; }

  .v-svg { width: 170px; }
  .v-svg-sm { width: 120px; }
  .v-svg-xs { width: 100px; }
  .v-svg-road { width: 100px; }

  .match-option, .math-option { width: 120px; height: 120px; font-size: 52px; border-radius: 26px; }
  .match-options, .math-options { gap: 22px; }
  .order-slot { width: 88px; height: 88px; font-size: 44px; }
  .order-choice { width: 92px; height: 92px; font-size: 44px; }
  .order-instruction, .missing-instruction { font-size: 34px; }
  .seq-num { width: 92px; height: 92px; font-size: 46px; }
  .missing-choice { width: 100px; height: 100px; font-size: 48px; }

  .math-problem { font-size: 110px; }
  .math-op-symbol { font-size: 52px; }

  .next-btn { padding: 20px 52px; font-size: 26px; min-width: 260px; }
  .success-text { font-size: 56px; }
  .success-stars { gap: 10px; }
  .star-earned, .star-missed { font-size: 56px; }
  .success-btn { padding: 22px 54px; font-size: 28px; }
  .count-badge { width: 44px; height: 44px; font-size: 26px; }

  .draw-canvas { width: 360px; height: 360px; }
  .canvas-wrap { border-radius: 28px; }
  .canvas-ghost { font-size: 220px; }
  .draw-btn { padding: 16px 40px; font-size: 24px; }
  .draw-prompt { font-size: 34px; }
  .draw-result { font-size: 34px; }

  .sun { width: 110px; height: 110px; }
  .confetti-piece { width: 14px; height: 14px; }
  .sparkle-dot { width: 12px; height: 12px; }
}

/* ============ FULL HD INTERACTIVE PANELS (2200px+) ============ */
@media (min-width: 2200px) {
  .title-logo { width: 560px; }
  .menu-grid { max-width: 1400px; gap: 24px; }
  .menu-btn { padding: 24px 18px; min-height: 120px; }
  .menu-icon { width: 140px; height: 140px; }
  .menu-btn .label { font-size: 24px; }
  .theme-btn { width: 86px; height: 86px; }

  .tap-prompt, .match-question, .math-question { font-size: 48px; }
  .tap-counter { font-size: 130px; }

  .v-svg { width: 200px; }
  .v-svg-sm { width: 140px; }
  .v-svg-xs { width: 110px; }

  .match-option, .math-option { width: 140px; height: 140px; font-size: 60px; }
  .order-slot { width: 100px; height: 100px; font-size: 50px; }
  .order-choice { width: 105px; height: 105px; font-size: 50px; }
  .seq-num { width: 105px; height: 105px; font-size: 52px; }
  .missing-choice { width: 115px; height: 115px; font-size: 54px; }

  .draw-canvas { width: 420px; height: 420px; }
  .canvas-ghost { font-size: 260px; }
  .math-problem { font-size: 130px; }
}

/* ============ 4K INTERACTIVE DISPLAYS (3000px+ touch) ============ */
/* Samsung Interactive WAC/WAD series at DPR=1 report 3840x2160 CSS pixels */
@media (min-width: 3000px) {
  /* App must fill the massive viewport — scale everything 2x from 1900px values */
  #menu-screen { gap: 20px; padding: 3vh 60px 15vh; }
  .title-logo { width: 900px; }
  .menu-subtitle { font-size: 42px; }
  .menu-grid { max-width: 2400px; gap: 40px; }
  .menu-btn { padding: 36px 28px; min-height: 200px; border-radius: 36px; }
  .menu-icon { width: 220px; height: 220px; }
  .menu-btn .label { font-size: 36px; }
  .theme-btn { width: 130px; height: 130px; }
  .theme-picker { gap: 24px; padding: 10px 0; }
  .age-badge { font-size: 16px; padding: 4px 10px; border-radius: 12px; }

  .game-header { height: 140px; padding: 20px 60px; }
  .back-btn { width: 100px; height: 100px; min-width: 100px; min-height: 100px; max-width: 100px; max-height: 100px; }
  .back-btn svg { width: 48px; height: 48px; }
  .sound-btn, .fullscreen-btn { width: 80px; height: 80px; }
  .sound-btn svg, .fullscreen-btn svg { width: 40px; height: 40px; }
  .sound-btn { right: calc(96px + env(safe-area-inset-right, 0px)); }
  .stars-display { font-size: 60px; }
  .game-area { top: 140px; padding: 40px 60px; gap: 36px; }

  .tap-prompt, .match-question, .math-question { font-size: 72px; }
  .tap-counter { font-size: 200px; }
  .vehicles-grid { gap: 36px; max-width: 2400px; }
  .match-vehicles { gap: 24px; }
  .math-vehicles-row { gap: 20px; }

  .v-svg { width: 300px; }
  .v-svg-sm { width: 220px; }
  .v-svg-xs { width: 170px; }
  .v-svg-road { width: 160px; }

  .match-option, .math-option { width: 220px; height: 220px; font-size: 96px; border-radius: 40px; border-width: 6px; }
  .match-options, .math-options { gap: 36px; }
  .order-slot { width: 160px; height: 160px; font-size: 80px; border-radius: 28px; }
  .order-choice { width: 170px; height: 170px; font-size: 80px; }
  .order-instruction, .missing-instruction { font-size: 56px; }
  .seq-num { width: 170px; height: 170px; font-size: 84px; }
  .missing-choice { width: 180px; height: 180px; font-size: 88px; }

  .math-problem { font-size: 200px; letter-spacing: 8px; }
  .math-op-symbol { font-size: 80px; }

  .next-btn { padding: 32px 80px; font-size: 42px; min-width: 400px; border-radius: 32px; }
  .success-text { font-size: 88px; }
  .success-stars { gap: 16px; }
  .star-earned, .star-missed { font-size: 88px; }
  .success-btn { padding: 36px 80px; font-size: 44px; border-radius: 32px; }
  .count-badge { width: 70px; height: 70px; font-size: 40px; }

  .draw-canvas { width: 700px; height: 700px; }
  .canvas-wrap { border-radius: 40px; }
  .canvas-ghost { font-size: 420px; }
  .draw-btn { padding: 24px 60px; font-size: 36px; border-radius: 24px; }
  .draw-prompt { font-size: 52px; }
  .draw-result { font-size: 52px; }

  .sun { width: 180px; height: 180px; }
  .cloud-1 { width: 240px; height: 80px; }
  .cloud-2 { width: 180px; height: 60px; }
  .cloud-3 { width: 200px; height: 70px; }
  .confetti-piece { width: 24px; height: 24px; }
  .sparkle-dot { width: 20px; height: 20px; }

  .confirm-box { max-width: 600px; padding: 48px 56px; border-radius: 40px; }
  .confirm-text { font-size: 48px; margin-bottom: 36px; }
  .confirm-btn { padding: 28px 56px; font-size: 36px; border-radius: 28px; min-width: 180px; }
  .confirm-buttons { gap: 28px; }
}
