:root { --red: #d62828; --red-dark: #9d1c1c; --yellow: #ffd23f; --cream: #fff7e0; --green: #6cc04a; --green-dark: #3f8f2a; --ink: #3b2a1a; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #2b2118; font-family: 'Andika', 'Trebuchet MS', sans-serif; touch-action: none; }
#stage { position: absolute; left: 0; top: 0; width: 1600px; height: 900px; transform-origin: 0 0; overflow: hidden; background: #f3e3c3; }
#view { position: absolute; inset: 0; }
#view > * { position: absolute; }
.bg { left: 0; top: 0; width: 1600px; height: 900px; object-fit: cover; pointer-events: none; }
button { font-family: inherit; cursor: pointer; border: none; }

/* turn the phone */
#turn { display: none; position: fixed; inset: 0; background: #2b2118; color: #fff; z-index: 99; align-items: center; justify-content: center; flex-direction: column; font-size: 28px; }
#turn div { font-size: 90px; animation: spin 2.5s infinite; }
body.portrait #turn { display: flex; }
@keyframes spin { 0%, 40% { transform: rotate(0); } 70%, 100% { transform: rotate(90deg); } }

/* letter tiles like the board game's */
.tile { position: absolute; width: 88px; height: 88px; border-radius: 10px; background: var(--red); color: #fff; font-weight: 700; font-size: 60px;
  display: flex; align-items: center; justify-content: center; line-height: 1; cursor: grab; touch-action: none;
  box-shadow: 0 4px 0 var(--red-dark), 0 7px 10px rgba(0,0,0,.25); border: 3px solid #fff2; transition: box-shadow .15s; z-index: 5; }
.tile.lift { z-index: 50; box-shadow: 0 10px 0 var(--red-dark), 0 18px 24px rgba(0,0,0,.3); transform: scale(1.12) rotate(0) !important; cursor: grabbing; }
.tile.home { transition: left .3s ease-out, top .3s ease-out; }
.tile.placed { box-shadow: 0 2px 0 var(--red-dark); cursor: pointer; z-index: 4; }
.tile.glow { animation: glow .5s; background: #e85d04; }
.tile.big { width: 110px; height: 110px; font-size: 76px; }
@keyframes glow { 50% { transform: scale(1.18); } }

/* round buttons */
.round { width: 92px; height: 92px; border-radius: 50%; background: #fffbe9; box-shadow: 0 5px 0 #c9b98a, 0 8px 14px rgba(0,0,0,.2); z-index: 20; display: flex; align-items: center; justify-content: center; }
.round svg, .next svg { width: 52px; height: 52px; fill: none; stroke: var(--ink); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.round svg .fill { fill: var(--ink); stroke-width: 2; }
.round:active, .next:active, .gamecard:active { transform: translateY(4px); }
.back { left: 24px; top: 20px; }
.ear { right: 24px; top: 20px; }
.again { right: 24px; bottom: 24px; }
.next { right: 40px; bottom: 120px; width: 150px; height: 150px; border-radius: 50%; background: var(--green); box-shadow: 0 7px 0 var(--green-dark), 0 12px 20px rgba(0,0,0,.25); z-index: 30; animation: pop .5s, pulse 1.4s .5s infinite; display: flex; align-items: center; justify-content: center; }
.next svg { stroke: #fff; width: 80px; height: 80px; stroke-width: 7; }
.songbtn { font-size: 90px; color: #fff; right: 640px; bottom: 360px; }
@keyframes pop { from { transform: scale(0); } }
@keyframes pulse { 50% { transform: scale(1.07); } }
.starcount { right: 140px; top: 30px; background: #fffbe9; border-radius: 40px; padding: 8px 26px; font-size: 44px; font-weight: 700; color: var(--ink); box-shadow: 0 4px 0 #c9b98a; z-index: 20; }
.starcount span { color: #f2a900; }

/* start + menu */
.alfa-start { width: 560px; left: 170px; top: 170px; animation: bob 3s infinite ease-in-out; }
.bigplay { left: 900px; top: 330px; width: 260px; height: 260px; border-radius: 50%; background: var(--red); box-shadow: 0 10px 0 var(--red-dark), 0 18px 30px rgba(0,0,0,.3); display: flex; align-items: center; justify-content: center; animation: pulse 1.6s infinite; }
.bigplay svg { width: 150px; height: 150px; fill: #fff; margin-left: 18px; }
.alfa-menu { width: 330px; left: 30px; top: 300px; animation: bob 3s infinite ease-in-out; cursor: pointer; }
@keyframes bob { 50% { transform: translateY(-14px) rotate(-2deg); } }
.wiggle { animation: wiggle .6s !important; }
@keyframes wiggle { 25% { transform: rotate(-8deg) scale(1.08); } 75% { transform: rotate(8deg) scale(1.08); } }
.menu { left: 380px; top: 130px; width: 1180px; height: 700px; display: flex; flex-wrap: wrap; gap: 40px; align-content: center; justify-content: center; }
.gamecard { position: relative; width: 340px; height: 300px; border-radius: 34px; background: var(--cream); box-shadow: 0 8px 0 #d4b97a, 0 14px 24px rgba(0,0,0,.2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; animation: pop .4s backwards; }
.gamecard.c1 { animation-delay: .06s; } .gamecard.c2 { animation-delay: .12s; } .gamecard.c3 { animation-delay: .18s; } .gamecard.c4 { animation-delay: .24s; }
.gamecard img { width: 150px; height: 150px; object-fit: contain; }
.gamecard.pressed { transform: scale(.95); }
.mini { display: flex; gap: 6px; }
.mini b { width: 56px; height: 56px; border-radius: 7px; background: var(--red); color: #fff; font-size: 40px; display: flex; align-items: center; justify-content: center; box-shadow: 0 3px 0 var(--red-dark); }
.grid9 { flex-wrap: wrap; width: 190px; justify-content: center; }
.note { font-size: 130px; line-height: 1; color: #7b2cbf; }
.earart { width: 150px; height: 150px; fill: none; stroke: #b5654a; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.earart .skin { fill: #f8c9a8; }
.grown { left: 24px; bottom: 18px; background: #fffbe9cc; color: #6b5a3a; border-radius: 20px; padding: 10px 18px; font-size: 22px; z-index: 20; }

/* board */
.board { background: var(--yellow); border: 14px solid var(--red); border-radius: 18px; box-shadow: 0 10px 24px rgba(0,0,0,.25); }
.pic { object-fit: contain; filter: drop-shadow(0 3px 3px rgba(0,0,0,.2)); cursor: pointer; z-index: 3; }
.pic.done { animation: wiggle .6s; }
.slot { background: #b51f1f; border-radius: 8px; box-shadow: inset 0 3px 6px rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; font-weight: 700; z-index: 2; }
.slot span { color: #ffffff55; }
.slot span.hint { animation: pulse 1s 3; }
.alfa-side { right: 40px; top: 230px; width: 330px; animation: bob 3s infinite ease-in-out; cursor: pointer; }

/* worm */
.choices { inset: 0; pointer-events: none; }
.choices .tile { pointer-events: auto; }
.seg { width: 108px; height: 108px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #a6e07c, var(--green) 60%, var(--green-dark)); color: #fff; font-weight: 700; font-size: 62px;
  display: flex; align-items: center; justify-content: center; text-shadow: 0 2px 0 var(--green-dark); box-shadow: 0 5px 8px rgba(0,0,0,.25); animation: pop .35s; z-index: 4; cursor: pointer; }
.seg.ghost { background: #ffffff66; border: 4px dashed #ffffffd0; box-shadow: none; color: #2f6e2266; text-shadow: none; animation: none; z-index: 2; pointer-events: none; }
.seg.alt { background: radial-gradient(circle at 35% 30%, #c8ec8a, #8fcf4f 60%, #4c9a2e); }
.wormhead { width: 170px; z-index: 6; transition: left .35s, top .35s; pointer-events: auto; cursor: pointer; }
.wormhead.chomp { animation: chomp .35s; }
.wormhead.shake, .card.shake { animation: shake .4s; }
@keyframes chomp { 50% { scale: 1.15; } }
@keyframes shake { 20%, 60% { translate: -10px 0; } 40%, 80% { translate: 10px 0; } }
.bubble { width: 120px; height: 120px; border-radius: 50%; background: #fff; box-shadow: 0 4px 10px rgba(0,0,0,.2); font-size: 80px; font-weight: 700; color: var(--red); display: flex; align-items: center; justify-content: center; opacity: 0; transform: scale(.4); transition: .25s; z-index: 7; pointer-events: none; }
.bubble.on { opacity: 1; transform: scale(1); }

/* find */
.card { width: 300px; height: 300px; background: #fff; border-radius: 30px; box-shadow: 0 8px 0 #d8c9a8, 0 14px 22px rgba(0,0,0,.2); display: flex; align-items: center; justify-content: center; cursor: pointer; animation: pop .35s backwards; transition: opacity .3s, transform .3s; }
.card img { width: 250px; height: 250px; object-fit: contain; pointer-events: none; }
.card.right { transform: scale(1.12); box-shadow: 0 0 0 10px var(--green), 0 14px 22px rgba(0,0,0,.2); }
.card.fade { opacity: .25; }
.cardword { position: absolute; bottom: -78px; display: flex; gap: 6px; }
.cardword b { width: 62px; height: 62px; border-radius: 8px; background: var(--red); color: #fff; font-size: 44px; display: flex; align-items: center; justify-content: center; }
.cardword b.first { background: #e85d04; transform: scale(1.12); }
.alfa-find { left: 40px; top: 40px; width: 200px; cursor: pointer; animation: bob 3s infinite ease-in-out; }
.dots { left: 0; right: 0; bottom: 40px; display: flex; justify-content: center; gap: 18px; }
.dots i { width: 34px; height: 34px; border-radius: 50%; background: #fff8; border: 4px solid #fff; }
.dots i.on { background: #f2a900; }

/* letter board + song */
.grid { inset: 0; }
.grid .tile { width: 96px; height: 96px; font-size: 66px; cursor: pointer; }
.grid .tile.on { background: #e85d04; transform: scale(1.1); }
.popup { right: 50px; top: 140px; width: 330px; height: 560px; background: var(--cream); border-radius: 30px; box-shadow: 0 8px 0 #d4b97a; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; opacity: 0; transition: .25s; cursor: pointer; }
.popup.on { opacity: 1; }
.popup .tile.huge { position: relative; width: 190px; height: 190px; font-size: 140px; }
.popup img { width: 230px; height: 230px; object-fit: contain; }
.songgrid .tile { transition: transform .12s, background .12s; }
.songgrid .tile.sung { background: #c1121f; }
.songgrid .tile.sing { background: #f2a900; transform: scale(1.25) translateY(-10px); z-index: 10; }
.alfa-sing { left: 40px; top: 520px; width: 300px; }
.alfa-sing.dance { animation: dance .65s infinite ease-in-out; }
@keyframes dance { 25% { transform: rotate(-6deg) translateY(-12px); } 75% { transform: rotate(6deg) translateY(-12px); } }
.play { left: 720px; top: 660px; width: 170px; height: 170px; border-radius: 50%; background: var(--red); color: #fff; font-size: 70px; box-shadow: 0 8px 0 var(--red-dark), 0 14px 22px rgba(0,0,0,.3); }

/* confetti */
.confetti { inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti i { position: absolute; top: -30px; width: 16px; height: 24px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { top: 940px; rotate: 540deg; } }

/* grown-ups panel (normal page coordinates, readable on a phone) */
.panel { position: fixed; inset: 0; background: rgba(30, 20, 10, .55); z-index: 80; display: flex; align-items: center; justify-content: center; touch-action: auto; }
.sheet { background: #fffaf0; border-radius: 18px; padding: 18px 22px; width: min(560px, 94vw); max-height: 92vh; overflow-y: auto; font-size: 16px; color: var(--ink); user-select: text; }
.sheet h2 { margin: 0 0 8px; }
.sheet label { display: block; margin: 14px 0 6px; font-weight: 700; }
.sheet label.row { font-weight: 400; display: flex; gap: 10px; align-items: center; }
.sheet label.row input { width: 24px; height: 24px; }
.sheet input[type=range] { width: 100%; }
.sheet .scale { display: flex; justify-content: space-between; font-size: 13px; color: #8a7a5a; }
.sheet .seg { display: flex; flex-wrap: wrap; gap: 6px; }
.sheet .seg button { padding: 8px 12px; border-radius: 10px; background: #efe3c8; font-size: 15px; }
.sheet .seg button.on { background: var(--red); color: #fff; }
.sheet .small { font-size: 14px; color: #8a7a5a; }
.sheet #reset { background: none; text-decoration: underline; color: #8a7a5a; font-size: 14px; }
.sheet .close { margin-top: 10px; width: 100%; padding: 12px; border-radius: 12px; background: var(--green); color: #fff; font-size: 18px; font-weight: 700; }
