* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body { color: var(--wm-ink); font-family: "Trebuchet MS", "Arial Rounded MT Bold", Arial, sans-serif; background: #f2d6a8; }
button { font: inherit; }
button:focus-visible { outline: 5px solid #fff3a6; outline-offset: 4px; }

.game-shell {
  --magic-deep: #4d315c;
  --magic-mid: #765084;
  --magic-soft: #b88ac6;
  position: relative; width: 100%; height: 100%; min-height: 100dvh; overflow: hidden; isolation: isolate;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.world-background, .world-background img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.world-background { z-index: -4; }
.world-background img { object-fit: cover; }
.game-shell::before { content: ""; position: absolute; z-index: -3; inset: 0; background: linear-gradient(rgb(255 250 231 / .02), rgb(103 69 45 / .09)); pointer-events: none; }
.screen { position: absolute; inset: 0; display: none; }
.screen.is-active { display: block; }

/* Dedicated, text-free story art: separate landscape and portrait compositions. */
.opening-screen { z-index: 2; overflow: hidden; background: var(--magic-deep); }
.opening-screen::before { content: ""; position: absolute; z-index: 1; inset: 0; background: linear-gradient(transparent 72%, rgb(49 26 59 / .32)); pointer-events: none; }
.opening-story-art, .opening-story-art img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.opening-story-art { z-index: 0; }
.opening-story-art img { object-fit: cover; object-position: center; }
.play-button { position: absolute; z-index: 3; left: 50%; bottom: max(4.3vh, calc(env(safe-area-inset-bottom) + 16px)); width: clamp(82px,8vw,112px); aspect-ratio: 1; padding: 0; border: 0; border-radius: 50%; background: transparent; transform: translateX(-50%); filter: drop-shadow(0 10px 12px rgb(61 35 76 / .35)); cursor: pointer; animation: play-breathe 2.4s ease-in-out infinite; }
.play-button:active { transform: translateX(-50%) translateY(3px) scale(.96); }
.play-button img, .icon-button img, .check-button img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* Star-led HUD. */
.top-hud { position: absolute; z-index: 8; left: max(12px,calc(env(safe-area-inset-left) + 8px)); right: max(12px,calc(env(safe-area-inset-right) + 8px)); top: max(8px,calc(env(safe-area-inset-top) + 5px)); min-height: 66px; display: grid; grid-template-columns: minmax(170px,1fr) auto minmax(230px,1fr); align-items: center; gap: 12px; }
.round-stars, .level-path { display: flex; align-items: center; min-height: 50px; padding: 6px 12px; border: 3px solid rgb(225 179 95 / .78); border-radius: 999px; background: rgb(255 248 230 / .9); box-shadow: 0 5px 0 rgb(92 53 39 / .21), 0 9px 22px rgb(61 35 76 / .13); }
.round-stars { width: max-content; gap: 4px; }
.round-star { width: clamp(31px,3.1vw,43px); aspect-ratio: 1; object-fit: contain; filter: drop-shadow(0 2px 2px rgb(61 35 76 / .2)); transition: transform .25s ease; }
.round-star.is-earned { animation: star-pop .55s ease-out; }
.level-path { justify-content: center; gap: clamp(3px,.5vw,7px); padding-inline: 10px; }
.level-node { position: relative; width: clamp(34px,3.5vw,46px); aspect-ratio: 1; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; }
.level-node img { width: 100%; height: 100%; object-fit: contain; opacity: .62; filter: saturate(.72) sepia(.08); }
.level-node span { position: absolute; left: 50%; bottom: -1px; translate: -50% 0; display: grid; place-items: center; width: 21px; height: 21px; border: 2px solid #d8a64f; border-radius: 50%; background: rgb(255 251 236 / .96); color: #633d2f; font-size: 12px; font-weight: 900; box-shadow: 0 2px 4px rgb(92 53 39 / .22); }
.level-node.is-active { transform: scale(1.13); filter: drop-shadow(0 0 10px #ffd65f); }
.level-node.is-active img,.level-node.is-complete img { opacity: 1; filter: saturate(1.08) drop-shadow(0 0 5px rgb(255 205 69 / .7)); }
.level-node.is-locked img { opacity: .25; filter: grayscale(.85) sepia(.12); }
.hud-controls { justify-self: end; display: flex; gap: 7px; }
.icon-button, .check-button, .guide-button { padding: 0; border: 0; background: transparent; cursor: pointer; }
.icon-button { width: 55px; height: 55px; border-radius: 50%; filter: drop-shadow(0 5px 5px rgb(61 35 76 / .23)); }

/* Landscape composition: Dralo and Luno both lead into the central console. */
.game-layout { position: absolute; inset: 80px 16px 14px; display: grid; grid-template-columns: minmax(145px,.66fr) minmax(500px,2.25fr) minmax(160px,.72fr); align-items: center; gap: clamp(8px,1.4vw,22px); }
.hero-zone, .guide-zone { position: relative; min-width: 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.hero-zone { padding-bottom: 7vh; }
.hero-character { width: min(100%,240px); max-height: 56vh; object-fit: contain; filter: drop-shadow(0 0 2px rgb(255 253 239 / .92)) drop-shadow(0 14px 13px rgb(61 35 76 / .28)); transform-origin: 50% 100%; }
.hero-character.is-happy { animation: hero-happy .72s ease-out; }.hero-character.is-oops { animation: hero-oops .58s ease-in-out; }
.hero-glow { position: absolute; bottom: 5vh; display: flex; gap: 8px; opacity: 0; }
.hero-glow i { width: 13px; aspect-ratio: 1; border-radius: 50%; background: var(--wm-gold); box-shadow: 0 0 17px var(--wm-gold); }
.hero-zone.is-celebrating .hero-glow { opacity: 1; animation: lights-dance .8s ease-out; }
.guide-zone { flex-direction: column; align-items: center; justify-content: center; padding-top: 2vh; }
.guide-button { position: relative; z-index: 2; width: clamp(126px,15vw,205px); min-height: 126px; border-radius: 45%; }
.guide-character { width: 100%; max-height: 41vh; object-fit: contain; display: block; filter: drop-shadow(0 0 2px rgb(255 253 239 / .92)) drop-shadow(0 12px 12px rgb(61 35 76 / .28)); }
.speech-bubble { position: relative; z-index: 3; width: min(230px,100%); min-height: 92px; margin-bottom: -18px; padding: 15px 15px 20px; display: grid; place-items: center; gap: 2px; text-align: center; color: var(--wm-ink); font-size: clamp(14px,1.35vw,20px); line-height: 1.08; font-weight: 900; border: 5px solid #d6a959; border-radius: 42% 48% 40% 45% / 44% 42% 48% 44%; background: linear-gradient(#fffdf4,var(--wm-cream-1)); box-shadow: var(--wm-shadow-card); }
.speech-bubble::after { content: ""; position: absolute; right: 27%; bottom: -20px; width: 34px; height: 34px; border-right: 5px solid #d6a959; border-bottom: 5px solid #d6a959; background: var(--wm-cream-1); transform: rotate(39deg) skew(9deg,9deg); z-index: -1; }
.speech-bubble.is-speaking { animation: speech-glow 1s ease-in-out 2; }
.speech-icon { color: var(--wm-gold); font-size: 24px; text-shadow: 0 0 8px #fff0a0; }
.bodi-helper { position: absolute; z-index: 6; left: -20px; bottom: 5vh; width: clamp(72px,8vw,112px); max-height: 30vh; object-fit: contain; filter: drop-shadow(0 10px 10px rgb(61 35 76 / .25)); animation: helper-arrive .45s ease-out; }

/* A curved magical machine, not a generic card. */
.game-board { position: relative; width: 100%; height: min(77vh,620px); min-height: 455px; padding: clamp(66px,8vh,84px) clamp(20px,2vw,32px) clamp(18px,2.2vh,28px); display: grid; grid-template-rows: minmax(90px,1fr) minmax(60px,.62fr) minmax(116px,1.08fr) 76px; align-items: center; gap: 7px; border: 10px solid var(--wm-wood-1); border-bottom: 17px solid var(--wm-wood-2); border-radius: 44% 44% 12% 12% / 9% 9% 8% 8%; background: radial-gradient(ellipse at 50% 27%, #936ea0 0%, #644672 47%, #3e294b 100%); box-shadow: inset 0 0 0 6px #e6bd70, inset 0 0 34px rgb(255 231 156 / .16), 0 18px 0 rgb(94 55 33 / .33), 0 28px 34px rgb(61 35 76 / .28); overflow: hidden; }
.game-board::before { content: ""; position: absolute; inset: 18px 15px 15px; border: 2px solid rgb(255 223 139 / .32); border-radius: 41% 41% 10% 10% / 8% 8% 8% 8%; pointer-events: none; }
.console-top { position: absolute; z-index: 2; top: 10px; left: 50%; translate: -50% 0; width: 68%; height: 52px; display: flex; justify-content: center; align-items: center; gap: 28px; color: var(--wm-gold); font-size: 31px; }
.console-top i { width: 16px; aspect-ratio: 1; border-radius: 50%; background: #ffd65f; box-shadow: 0 0 15px #fff0a0; }
.console-top b { text-shadow: 0 0 17px #fff0a0; }
.demo-badge { position: absolute; z-index: 8; top: 18px; left: 50%; translate: -50% 0; padding: 7px 20px; border: 3px solid var(--wm-gold); border-radius: 999px; color: var(--wm-cream-1); background: var(--magic-deep); font-size: 16px; font-weight: 900; box-shadow: 0 5px 12px rgb(61 35 76 / .25); }
.task-display { position: relative; z-index: 3; justify-self: center; width: min(92%,650px); min-height: 90px; padding: 13px 19px; display: flex; align-items: center; justify-content: center; gap: clamp(9px,1.4vw,20px); border: 5px solid #d7ad64; border-radius: 32px; background: radial-gradient(ellipse at 50% 50%, #fff8df, #ead8ba); box-shadow: inset 0 6px 12px rgb(118 80 43 / .16), 0 7px 0 #704222; }
.task-display::before { content: ""; position: absolute; inset: 7px; border: 2px dotted rgb(141 97 151 / .3); border-radius: 22px; pointer-events: none; }
.task-group { display: flex; align-items: center; justify-content: center; gap: clamp(7px,1vw,13px); }
.task-plus { color: #7a4c87; font-size: clamp(34px,4vw,54px); font-weight: 900; }
.light-dot { --light-main: #e6b637; --light-soft: #ffe39a; position: relative; width: clamp(48px,5.7vw,72px); aspect-ratio: 1; flex: none; display: grid; place-items: center; border: 6px solid #9c6532; border-radius: 50%; background: radial-gradient(circle at 35% 25%, #fff9d8 0 10%, var(--light-soft) 11% 39%, var(--light-main) 72%); color: #fff5be; font-size: clamp(24px,3vw,38px); font-weight: 900; box-shadow: inset 0 -8px 0 rgb(74 40 70 / .19), inset 0 4px 0 rgb(255 255 255 / .48), 0 0 16px color-mix(in srgb,var(--light-main) 68%,transparent); }
.light-dot.plum { --light-main:#a465b5; --light-soft:#ddb7e7; }.light-dot.gold { --light-main:#e6b637; --light-soft:#ffe39a; }
.light-dot.small { width: clamp(35px,4vw,50px); border-width: 5px; font-size: clamp(18px,2.2vw,27px); }
.light-dot.empty { border-color: #9d744b; background: #d7c5a7; box-shadow: inset 0 4px 8px rgb(80 48 32 / .18); color: transparent; opacity: .8; }
.sequence-arrow { color: #7a4c87; font-size: clamp(29px,3.2vw,42px); font-weight: 900; }
.mystery-light { width: clamp(49px,5.7vw,72px); aspect-ratio: 1; display: grid; place-items: center; border: 5px dashed #9c6532; border-radius: 50%; color: var(--magic-mid); background: #fff8e6; font-size: clamp(28px,3vw,40px); font-weight: 900; }
.answer-track { position: relative; z-index: 3; min-height: 55px; display: flex; align-items: center; justify-content: center; gap: 9px; }
.answer-track:empty { min-height: 10px; }
.answer-slot { width: clamp(45px,5vw,62px); aspect-ratio: 1; display: grid; place-items: center; border: 4px dashed #e4c987; border-radius: 50%; background: rgb(255 248 230 / .16); color: #fff0b4; font-size: 25px; }
.answer-slot.is-filled { border-style: solid; background: rgb(255 248 230 / .22); }
.answer-slot .light-dot { width: 100%; border-width: 4px; }
.button-rack { position: relative; z-index: 4; width: 100%; display: flex; align-items: center; justify-content: center; flex-wrap: nowrap; gap: clamp(10px,1.45vw,20px); }
.magic-key, .choice-card { position: relative; flex: none; cursor: pointer; touch-action: manipulation; }
.magic-key { --key-main:#a465b5; --key-soft:#ddb7e7; width: clamp(74px,8vw,105px); aspect-ratio: 1; display: grid; place-items: center; border: 7px solid #b3743c; border-bottom: 11px solid #78441f; border-radius: 50%; color: #fff4bd; background: radial-gradient(circle at 35% 24%, #fff7cf 0 7%, var(--key-soft) 9% 34%, var(--key-main) 68%); box-shadow: inset 0 -10px 0 rgb(54 29 62 / .23), inset 0 5px 0 rgb(255 255 255 / .48), 0 9px 14px rgb(36 19 44 / .35); font-size: clamp(35px,4vw,51px); font-weight: 900; text-shadow: 0 2px 0 rgb(74 43 61 / .2); }
.magic-key.gold { --key-main:#d9a42e; --key-soft:#ffe09a; }.magic-key.plum { --key-main:#9d60ae; --key-soft:#dcb5e6; }
.magic-key[aria-pressed="true"], .magic-key.is-selected { transform: translateY(6px) scale(.96); border-color: #f6cf5b; box-shadow: inset 0 -4px 0 rgb(54 29 62 / .18), 0 0 0 6px rgb(255 235 138 / .66), 0 0 23px #ffe98b; }
.magic-key.is-hint, .choice-card.is-hint { animation: hint-glow 1.2s ease-in-out infinite; }
.magic-key.is-wrong, .choice-card.is-wrong { animation: control-nudge .5s ease-in-out; }
.magic-key.is-correct, .choice-card.is-correct { animation: correct-pop .7s ease-out; }
.choice-card { width: clamp(106px,12vw,145px); min-height: 104px; padding: 12px 10px; display: grid; place-items: center; border: 7px solid var(--wm-wood-1); border-bottom: 11px solid var(--wm-wood-2); border-radius: 27px; background: linear-gradient(#fff4d8,#e8c897); box-shadow: inset 0 4px 0 rgb(255 255 255 / .44), 0 8px 12px rgb(36 19 44 / .29); }
.choice-card[aria-pressed="true"] { transform: translateY(5px); border-color: var(--wm-gold); box-shadow: inset 0 4px 0 rgb(255 255 255 / .44), 0 0 0 6px rgb(255 235 138 / .63), 0 9px 14px rgb(36 19 44 / .3); }
.choice-dots { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 5px; max-width: 78px; }
.choice-dots i { width: 27px; aspect-ratio: 1; border: 4px solid #9c6532; border-radius: 50%; background: radial-gradient(circle at 35% 25%,#fffbd8,#dfad35 72%); box-shadow: inset 0 -4px 0 rgb(75 44 25 / .18); }
.check-button { position: relative; z-index: 6; justify-self: center; align-self: end; width: 72px; height: 72px; border-radius: 50%; filter: drop-shadow(0 8px 8px rgb(32 17 41 / .31)); }
.check-button:disabled { cursor: default; filter: saturate(.55) opacity(.84) drop-shadow(0 5px 5px rgb(32 17 41 / .2)); }
.check-button.is-demo { animation: check-pulse .72s ease-in-out infinite; }
.demo-hand { position: absolute; z-index: 10; font-size: 50px; filter: drop-shadow(0 4px 3px rgb(31 16 37 / .3)); pointer-events: none; transition: left .62s ease,top .62s ease; }

.toast { position: fixed; z-index: 15; left: 50%; bottom: max(92px,calc(env(safe-area-inset-bottom) + 72px)); translate: -50% 0; max-width: min(86vw,460px); padding: 12px 22px; border: 4px solid var(--wm-gold); border-radius: 999px; color: var(--wm-cream-1); background: var(--magic-deep); font-size: clamp(15px,1.7vw,21px); font-weight: 900; text-align: center; box-shadow: 0 10px 21px rgb(61 35 76 / .32); }

/* Modal shell and actual star rewards. */
.overlay { position: absolute; z-index: 30; inset: 0; display: grid; place-items: center; padding: max(16px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left)); background: radial-gradient(circle at 50% 45%,rgb(255 232 153 / .16),transparent 35%),rgb(49 29 59 / .64); backdrop-filter: blur(6px); animation: overlay-arrive .28s ease-out both; }
.overlay.is-leaving { pointer-events: none; animation: overlay-leave .36s ease-in both; }
.overlay.is-leaving .modal-panel { animation: panel-leave .16s ease-in both; }
.modal-panel { position: relative; width: min(92vw,680px); max-height: 92vh; padding: clamp(24px,4vw,42px); display: grid; justify-items: center; gap: 18px; overflow: hidden; text-align: center; border: 8px solid var(--wm-wood-1); border-bottom: 13px solid var(--wm-wood-2); border-radius: 40px; background: radial-gradient(circle at 50% 15%,#fffdf3,#f3dfbd); box-shadow: inset 0 0 0 5px #e4b96b,0 24px 46px rgb(34 18 43 / .4); }
.modal-panel:not([hidden]) { animation: panel-arrive .46s cubic-bezier(.2,.9,.25,1.12) both; }
.modal-panel h1 { margin: 0; color: var(--magic-deep); font-size: clamp(26px,4vw,42px); }.modal-panel p { margin: 6px 0 0; font-size: clamp(17px,2.3vw,24px); font-weight: 800; }
.modal-symbol { width: clamp(76px,9vw,96px); aspect-ratio: 1; }
.modal-symbol img { width: 100%; height: 100%; display: block; object-fit: contain; filter: drop-shadow(0 7px 7px rgb(61 35 76 / .22)); }
.modal-actions { display: flex; justify-content: center; gap: 14px; }
.wood-action { width: clamp(68px,7.4vw,86px); aspect-ratio: 1; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; color: var(--magic-deep); background: transparent; filter: drop-shadow(0 7px 7px rgb(61 35 76 / .25)); cursor: pointer; }
.wood-action img { width: 100%; height: 100%; display: block; object-fit: contain; }
.wood-action:active { transform: translateY(4px) scale(.96); filter: drop-shadow(0 3px 3px rgb(61 35 76 / .22)); }
.coral-action { filter: sepia(.08) drop-shadow(0 7px 7px rgb(61 35 76 / .25)); }
.menu-heading { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--magic-deep); font-size: clamp(23px,3vw,34px); font-weight: 900; }.menu-heading img { width: 52px; height: 52px; object-fit: contain; filter: drop-shadow(0 0 8px rgb(255 205 69 / .6)); }
.level-buttons { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; }
.level-select { position: relative; width: 78px; aspect-ratio: 1; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.level-select img { width: 100%; height: 100%; object-fit: contain; opacity: .72; filter: saturate(.82); }.level-select span { position: absolute; left: 50%; bottom: 5px; translate: -50% 0; width: 27px; height: 27px; display: grid; place-items: center; border: 2px solid #d8a64f; border-radius: 50%; color: #633d2f; background: rgb(255 251 236 / .96); font-size: 16px; font-weight: 900; box-shadow: 0 2px 4px rgb(92 53 39 / .22); }
.level-select.is-current { filter: drop-shadow(0 0 11px #e6b637); transform: scale(1.1); }.level-select.is-complete img { opacity: 1; filter: saturate(1.08) drop-shadow(0 0 7px rgb(255 205 69 / .7)); }.level-select:disabled { filter: grayscale(.65); opacity: .43; cursor: default; }
.reward-panel { grid-template-columns: minmax(130px,.7fr) minmax(180px,1.2fr) minmax(160px,.85fr); align-items: center; width: min(94vw,820px); }
.reward-star-wrap { position: relative; width: clamp(145px,20vw,220px); aspect-ratio: 1; display: grid; place-items: center; }.reward-burst { position: absolute; width: 100%; animation: burst-turn 10s linear infinite; }.reward-star { position: relative; width: 64%; filter: drop-shadow(0 0 16px #fff0a0); animation: star-pop .7s ease-out; }
.highfive { width: min(100%,220px); max-height: 39vh; object-fit: contain; filter: drop-shadow(0 10px 10px rgb(61 35 76 / .2)); }.reward-panel .modal-actions { grid-column: 1/-1; }
.final-panel { width: min(92vw,700px); }
.final-panel > :not(.confetti) { position: relative; z-index: 1; }
.final-stars { display: flex; justify-content: center; gap: 1px; }.final-stars img { width: clamp(50px,8vw,76px); filter: drop-shadow(0 0 10px #fff0a0); }.final-stars img:nth-child(2),.final-stars img:nth-child(4) { transform: translateY(12px); }.final-highfive { width: clamp(170px,27vw,260px); }
.confetti { position: absolute; z-index: 0; inset: 0; overflow: hidden; pointer-events: none; }.confetti i { position: absolute; top: -20px; width: 12px; height: 18px; border-radius: 4px; animation: confetti-fall linear infinite; }
.corner-rune { position: absolute; z-index: 45; left: max(8px,env(safe-area-inset-left)); bottom: max(8px,env(safe-area-inset-bottom)); width: clamp(38px,4.5vw,60px); opacity: .88; pointer-events: none; }

@keyframes play-breathe { 50% { filter: drop-shadow(0 12px 18px rgb(255 220 105 / .6)); transform: translateX(-50%) scale(1.06); } }
@keyframes star-pop { 0% { transform: scale(.35) rotate(-25deg); opacity: .3; } 70% { transform: scale(1.18) rotate(7deg); } }
@keyframes hero-happy { 35% { transform: translateY(-15px) rotate(-3deg); } 70% { transform: translateY(-5px) rotate(3deg); } }
@keyframes hero-oops { 25%,75% { transform: translateX(-7px) rotate(-2deg); } 50% { transform: translateX(7px) rotate(2deg); } }
@keyframes lights-dance { 40% { transform: translateY(-22px) scale(1.35); } }
@keyframes speech-glow { 50% { box-shadow: var(--wm-shadow-card),0 0 20px #fff0a0; transform: scale(1.025); } }
@keyframes helper-arrive { from { opacity: 0; transform: translateY(26px) scale(.8); } }
@keyframes hint-glow { 50% { filter: drop-shadow(0 0 16px #ffe77d); transform: translateY(-5px) scale(1.05); } }
@keyframes control-nudge { 25%,75% { transform: translateX(-8px); } 50% { transform: translateX(8px); } }
@keyframes correct-pop { 45% { transform: translateY(-12px) scale(1.1); filter: drop-shadow(0 0 18px #fff09c); } }
@keyframes check-pulse { 50% { transform: scale(1.12); filter: drop-shadow(0 0 18px #9bea71); } }
@keyframes burst-turn { to { transform: rotate(360deg); } }
@keyframes confetti-fall { to { transform: translateY(105vh) rotate(740deg); } }
@keyframes overlay-arrive { from { opacity: 0; backdrop-filter: blur(0); } }
@keyframes overlay-leave { to { opacity: 0; backdrop-filter: blur(0); transform: scale(1.025); } }
@keyframes panel-arrive { from { opacity: 0; transform: translateY(24px) scale(.9); } 70% { transform: translateY(-3px) scale(1.012); } }
@keyframes panel-leave { to { opacity: 0; transform: translateY(-12px) scale(.97); } }
@keyframes board-arrive { from { opacity: 0; transform: translateY(18px) scale(.965); } 70% { transform: translateY(-2px) scale(1.006); } }

/* Tablet and phone portrait are deliberately recomposed, not cropped. */
@media (orientation: portrait), (max-width: 780px) {
  .top-hud { min-height: 98px; grid-template-columns: auto 1fr; grid-template-rows: 50px 42px; align-items: center; gap: 3px 7px; }
  .round-stars { grid-column: 1; grid-row: 1; min-height: 46px; padding: 4px 7px; gap: 1px; }.round-star { width: clamp(27px,8vw,37px); }
  .hud-controls { grid-column: 2; grid-row: 1; gap: 2px; }.icon-button { width: 48px; height: 48px; }
  .level-path { grid-column: 1/-1; grid-row: 2; justify-self: center; min-height: 39px; padding: 2px 8px; }.level-node { width: clamp(31px,9vw,39px); }.level-node span { width: 18px; height: 18px; font-size: 11px; }
  .game-layout { inset: 108px 7px 7px; grid-template-columns: .78fr 1.22fr; grid-template-rows: minmax(88px,20vh) minmax(0,1fr); gap: 2px 5px; align-items: center; }
  .hero-zone { grid-column: 1; grid-row: 1; height: 100%; padding: 0; align-items: end; }.hero-character { width: min(95%,130px); max-height: 18vh; }.hero-glow { bottom: 0; }
  .guide-zone { grid-column: 2; grid-row: 1; height: 100%; padding: 0; display: grid; grid-template-columns: minmax(86px,1fr) minmax(78px,.8fr); align-items: center; }
  .speech-bubble { grid-column: 1; grid-row: 1; width: 100%; min-height: 67px; margin: 0 -14px 0 0; padding: 9px 12px; font-size: clamp(12px,3.6vw,16px); border-width: 4px; }.speech-bubble::after { right: -17px; bottom: 30%; border: 0; border-right: 4px solid #d6a959; border-top: 4px solid #d6a959; transform: rotate(45deg); }
  .speech-icon { font-size: 18px; }.guide-button { grid-column: 2; grid-row: 1; width: min(100%,118px); min-height: 78px; }.guide-character { max-height: 18vh; }
  .bodi-helper { left: auto; right: -1px; bottom: -5px; width: 66px; max-height: 14vh; }
  .game-board { grid-column: 1/-1; grid-row: 2; height: 100%; min-height: 0; padding: 46px 10px 8px; grid-template-rows: minmax(70px,1fr) minmax(46px,.53fr) minmax(76px,.9fr) 58px; gap: 3px; border-width: 7px; border-bottom-width: 11px; border-radius: 38% 38% 9% 9% / 6% 6% 6% 6%; box-shadow: inset 0 0 0 4px #e6bd70,0 10px 0 rgb(94 55 33 / .34),0 17px 24px rgb(61 35 76 / .25); }
  .game-board::before { inset: 11px 8px 8px; }.console-top { top: 3px; height: 37px; font-size: 22px; gap: 18px; }.console-top i { width: 11px; }
  .demo-badge { top: 5px; padding: 5px 15px; font-size: 13px; }.task-display { width: 96%; min-height: 70px; padding: 9px 9px; gap: 6px; border-width: 4px; border-radius: 23px; }.task-display::before { inset: 5px; border-radius: 15px; }
  .light-dot { width: clamp(38px,12vw,55px); border-width: 5px; font-size: clamp(20px,7vw,30px); }.light-dot.small { width: clamp(29px,8vw,39px); border-width: 4px; font-size: 17px; }.mystery-light { width: clamp(39px,12vw,54px); border-width: 4px; font-size: 25px; }.sequence-arrow { font-size: 25px; }.task-plus { font-size: 28px; }
  .answer-track { min-height: 42px; gap: 5px; }.answer-slot { width: clamp(36px,10vw,46px); border-width: 3px; }
  .button-rack { gap: clamp(7px,2.5vw,12px); }.magic-key { width: clamp(61px,18vw,82px); border-width: 5px; border-bottom-width: 8px; font-size: clamp(29px,9vw,39px); }.choice-card { width: clamp(88px,27vw,112px); min-height: 78px; padding: 7px; border-width: 5px; border-bottom-width: 8px; }.choice-dots { max-width: 67px; gap: 3px; }.choice-dots i { width: 22px; border-width: 3px; }
  .button-rack:has(.magic-key:nth-child(5)) { gap: clamp(3px,1.3vw,6px); }
  .button-rack:has(.magic-key:nth-child(5)) .magic-key { width: clamp(50px,15.2vw,66px); min-width: 50px; }
  .check-button { width: 56px; height: 56px; }.toast { bottom: max(190px,calc(env(safe-area-inset-bottom) + 174px)); padding: 9px 16px; font-size: 14px; }.corner-rune { width: 36px; }
  .play-button { width: clamp(78px,22vw,100px); bottom: max(3vh,calc(env(safe-area-inset-bottom) + 10px)); }
  .reward-panel { grid-template-columns: 1fr 1fr; gap: 8px; }.reward-star-wrap { width: clamp(120px,36vw,175px); }.reward-copy { text-align: left; }.highfive { grid-column: 1/-1; width: min(47vw,190px); max-height: 28vh; }.reward-panel .modal-actions { grid-column: 1/-1; }.modal-panel { gap: 12px; padding: 20px; }.final-stars img { width: clamp(42px,14vw,62px); }
}

@media (orientation: portrait) and (max-height: 700px) {
  .top-hud { min-height: 92px; grid-template-rows: 47px 38px; }.game-layout { top: 101px; grid-template-rows: 85px minmax(0,1fr); }.hero-character,.guide-character { max-height: 15vh; }.speech-bubble { min-height: 58px; font-size: 12px; padding: 6px 9px; }
  .game-board { padding-top: 39px; grid-template-rows: minmax(61px,1fr) minmax(38px,.5fr) minmax(69px,.9fr) 55px; }.console-top { height: 32px; }.light-dot { width: clamp(35px,11vw,47px); }.magic-key { width: clamp(57px,17vw,72px); }.choice-card { min-height: 67px; }.check-button { width: 56px; height: 56px; }
  .modal-panel { max-height: 96vh; padding: 14px; gap: 7px; }.reward-star-wrap { width: 104px; }.highfive { max-height: 22vh; }.modal-actions { gap: 8px; }.wood-action { width: 58px; }.final-highfive { width: 125px; }
}

/* 1.2 art direction — a warm, painterly Magic Realm instrument. */
.game-layout {
  inset: 82px 22px 18px;
  grid-template-columns: minmax(180px,.78fr) minmax(520px,2.5fr) minmax(190px,.82fr);
  gap: clamp(12px,1.5vw,26px);
}
.hero-zone { padding-bottom: 3vh; align-items: flex-end; }
.hero-character { width: min(100%,275px); max-height: 62vh; }
.hero-zone .hero-character { width: min(138%,330px); transform: translateX(16px); }
.guide-button { width: clamp(175px,19vw,248px); }
.guide-character { max-height: 47vh; }
.speech-bubble { width: min(250px,100%); margin-bottom: -11px; }

.game-board {
  justify-self: center;
  width: min(100%,760px);
  height: min(69vh,560px);
  min-height: 490px;
  padding: 64px clamp(28px,3.2vw,48px) 22px;
  grid-template-rows: minmax(106px,1.05fr) minmax(78px,.72fr) minmax(128px,1fr) 74px;
  gap: 6px;
  border: 12px solid #8f552d;
  border-bottom: 20px solid #61391f;
  border-radius: 84px 84px 46px 46px / 50px 50px 38px 38px;
  background:
    radial-gradient(ellipse at 50% 8%,rgb(255 239 176 / .34) 0 8%,transparent 34%),
    radial-gradient(circle at 13% 37%,rgb(213 151 232 / .23) 0 2%,transparent 23%),
    radial-gradient(circle at 87% 62%,rgb(247 202 85 / .16) 0 2%,transparent 22%),
    linear-gradient(152deg,#795984 0%,#684876 27%,#563861 58%,#3f294e 100%);
  box-shadow:
    inset 0 0 0 5px #efc76f,
    inset 0 0 0 10px rgb(75 39 85 / .7),
    inset 0 26px 52px rgb(255 226 145 / .12),
    inset 0 -34px 54px rgb(37 19 49 / .32),
    0 13px 0 #4d2b1d,
    0 24px 40px rgb(49 28 61 / .3);
  overflow: visible;
}
.game-board.is-entering { animation: board-arrive .56s cubic-bezier(.2,.82,.24,1) both; }
.game-board::before {
  inset: 20px 18px 18px;
  z-index: 0;
  border: 3px solid rgb(246 205 105 / .58);
  border-radius: 64px 64px 30px 30px / 38px 38px 26px 26px;
  background:
    radial-gradient(ellipse at 50% 34%,rgb(255 244 197 / .12),transparent 39%),
    radial-gradient(circle at 50% 88%,rgb(202 135 218 / .11),transparent 31%);
  box-shadow: inset 0 0 0 4px rgb(255 244 193 / .1),inset 0 0 38px rgb(225 174 237 / .12),0 0 18px rgb(255 219 119 / .13);
}
.game-board::after {
  content: "";
  position: absolute;
  z-index: 1;
  left: 5%; right: 5%; bottom: 88px;
  height: 29px;
  border: 4px solid #87502c;
  border-bottom: 8px solid #5d351e;
  border-radius: 50%;
  background: linear-gradient(#e7ad56,#b86c35);
  box-shadow: inset 0 4px 0 rgb(255 229 150 / .55),0 7px 12px rgb(73 41 53 / .24);
}
.console-top {
  top: -24px;
  width: 180px;
  height: 82px;
  gap: 12px;
  border: 7px solid #8f552d;
  border-bottom-width: 10px;
  border-radius: 50%;
  background: linear-gradient(#ffe7a5,#d49342);
  box-shadow: inset 0 0 0 4px #fff0bd,0 8px 10px rgb(68 37 48 / .24);
}
.console-top img { width: 72px; height: 72px; object-fit: contain; filter: drop-shadow(0 0 7px #ffdf78); }
.console-top i { width: 10px; background: #fff2a7; box-shadow: 0 0 12px #f6b83d; }
.console-crystal { position: absolute; z-index: 2; top: 43%; width: clamp(62px,7vw,92px); height: 150px; object-fit: contain; pointer-events: none; opacity: .68; filter: saturate(.76) drop-shadow(0 8px 8px rgb(73 35 91 / .22)) drop-shadow(0 0 12px rgb(239 155 255 / .27)); }
.console-crystal-left { left: -52px; transform: rotate(-10deg); }
.console-crystal-right { right: -52px; transform: scaleX(-1) rotate(-10deg); }
.task-display {
  width: min(88%,610px);
  min-height: 108px;
  padding: 15px 24px;
  gap: clamp(10px,1.35vw,18px);
  border: 7px solid #b87935;
  border-bottom-width: 10px;
  border-radius: 46px;
  background: radial-gradient(ellipse at 50% 32%,#fffef5 0 30%,#ffedbd 70%,#e2b974 100%);
  box-shadow: inset 0 0 0 4px #f0c966,inset 0 8px 15px rgb(255 255 255 / .72),inset 0 -7px 12px rgb(130 75 38 / .12),0 8px 0 #714123,0 13px 18px rgb(38 20 48 / .3),0 0 24px rgb(255 222 126 / .2);
}
.task-display::before {
  inset: 8px;
  border: 2px solid rgb(123 73 117 / .25);
  border-radius: 32px;
  box-shadow: inset 0 0 14px rgb(255 255 255 / .58);
}
.light-dot {
  width: clamp(58px,6.2vw,78px);
  border: 4px solid #ba7b35;
  background: radial-gradient(circle,#fffdf0 0 36%,#f5d680 38% 57%,#92562f 59% 68%,#f0c461 70% 100%);
  box-shadow: inset 0 3px 0 rgb(255 255 255 / .7),0 5px 7px rgb(92 53 54 / .22),0 0 17px rgb(255 219 102 / .52);
  overflow: visible;
}
.light-dot.plum { background: radial-gradient(circle,#fff9f0 0 35%,#d8b2e1 37% 57%,#74417e 59% 68%,#c798d3 70% 100%); border-color: #7d4c75; box-shadow: inset 0 3px 0 rgb(255 255 255 / .65),0 5px 7px rgb(74 38 78 / .24),0 0 17px rgb(211 153 232 / .5); }
.light-dot img { width: 89%; height: 89%; object-fit: contain; display: block; transform: scale(1.18); filter: drop-shadow(0 0 7px #ffd760); pointer-events: none; }
.light-dot.plum img { transform: scale(.88); filter: drop-shadow(0 0 8px #e3a2f2); }
.light-dot.small { width: clamp(44px,4.6vw,58px); border-width: 3px; }
.light-dot.empty { border: 4px solid #ac7d54; background: radial-gradient(circle,#6d4a72 0 31%,#4d315c 33% 47%,#d7b267 49% 56%,#8b552f 58% 100%); box-shadow: inset 0 3px 7px rgb(42 21 51 / .45),0 3px 5px rgb(72 43 50 / .18); opacity: .72; }
.mystery-light { border: 5px solid #a56635; background: #fff5d7; box-shadow: inset 0 0 0 4px #e7b95e,0 5px 8px rgb(74 42 54 / .2); }

.answer-track {
  z-index: 4;
  justify-self: center;
  width: min(76%,500px);
  max-width: 82%;
  min-height: 82px;
  padding: 8px 26px 11px;
  gap: clamp(8px,1vw,14px);
  border: 4px solid #d0a04c;
  border-bottom: 7px solid #754027;
  border-radius: 999px;
  background: radial-gradient(ellipse at 50% 22%,rgb(255 245 201 / .29),transparent 42%),linear-gradient(180deg,#70477a 0%,#56345f 58%,#3c2548 100%);
  box-shadow: inset 0 3px 0 rgb(255 236 166 / .45),inset 0 0 0 3px rgb(255 223 135 / .16),0 8px 0 rgb(61 34 41 / .58),0 14px 19px rgb(38 19 48 / .3),0 0 23px rgb(220 160 236 / .18);
}
.answer-track:empty { min-height: 18px; border: 0; padding: 0; background: transparent; box-shadow: none; }
.answer-slot {
  position: relative;
  width: clamp(54px,5.5vw,68px);
  border: 4px solid #e2b75c;
  border-bottom: 7px solid #8a542f;
  border-radius: 46% 46% 42% 42% / 40% 40% 54% 54%;
  background: radial-gradient(ellipse at 50% 32%,#8e6598 0 30%,#5a3867 51%,#35213f 100%);
  box-shadow: inset 0 5px 8px rgb(28 13 36 / .43),inset 0 0 0 3px rgb(245 211 121 / .16),0 5px 8px rgb(30 14 39 / .34),0 0 13px rgb(217 157 234 / .23);
  overflow: hidden;
}
.answer-slot::after { content: ""; position: absolute; inset: 17%; background: url("assets/props/prop-magicrealm-flame-gold-v2.webp") center/contain no-repeat; opacity: .2; filter: grayscale(.35) sepia(.2) drop-shadow(0 0 5px rgb(255 224 131 / .5)); }
.answer-slot:not(.is-filled) { border-color: transparent; border-bottom-color: transparent; background: transparent; box-shadow: none; overflow: visible; }
.answer-slot:not(.is-filled)::before { content: ""; position: absolute; z-index: 0; left: 20%; right: 20%; bottom: 5px; height: 8px; border-radius: 50%; background: radial-gradient(ellipse,#f0c866 0 24%,rgb(240 200 102 / .35) 46%,transparent 72%); filter: blur(.3px); }
.answer-slot:not(.is-filled)::after { inset: 8%; opacity: .34; filter: sepia(.12) drop-shadow(0 0 8px rgb(255 224 131 / .72)); }
.answer-slot.is-filled { border-style: solid; background: radial-gradient(ellipse at 50% 32%,#9c70a6,#5b3866 56%,#35213f); box-shadow: 0 0 0 3px #e4bc5e,0 0 20px #ffe184,inset 0 0 12px rgb(255 225 145 / .25); }
.answer-slot.is-filled::after { opacity: 0; }
.answer-slot .light-dot { position: relative; z-index: 1; width: 100%; border-width: 3px; }

.button-rack { z-index: 4; gap: clamp(14px,1.55vw,22px); align-self: end; }
.magic-key {
  width: clamp(82px,8.2vw,104px);
  border: 8px solid #9d6033;
  border-bottom: 13px solid #63391f;
  background: radial-gradient(circle at 42% 33%,#fffdf0 0 38%,#f3d69b 40% 58%,#c58a48 60% 100%);
  box-shadow: inset 0 5px 0 rgb(255 255 255 / .62),inset 0 -7px 0 rgb(113 65 36 / .2),0 8px 11px rgb(54 31 47 / .28);
  overflow: visible;
}
.magic-key.plum { background: radial-gradient(circle at 42% 33%,#fffaf0 0 36%,#dfc1e4 38% 58%,#a66eb0 60% 100%); border-color: #784878; border-bottom-color: #503052; }
.magic-key img { width: 76%; height: 76%; object-fit: contain; display: block; transform: scale(1.18); filter: drop-shadow(0 0 7px #ffcd43); pointer-events: none; transition: transform .18s ease; }
.magic-key.plum img { transform: scale(.9); filter: drop-shadow(0 0 8px #e3a2f2); }
.magic-key[aria-pressed="true"] img,.magic-key.is-selected img { transform: scale(1.04); }
.magic-key.plum[aria-pressed="true"] img,.magic-key.plum.is-selected img { transform: scale(.79); }
.magic-key[aria-pressed="true"],.magic-key.is-selected { transform: translateY(7px) scale(.97); border-color: #efbd4f; box-shadow: inset 0 -4px 0 rgb(70 37 45 / .16),0 0 0 5px rgb(255 235 138 / .7),0 0 25px #ffe98b; }
.choice-card { border-color: #9d6033; border-bottom-color: #63391f; background: radial-gradient(circle at 50% 20%,#fffdf0,#edc98f); }
.choice-dots i { background: radial-gradient(circle at 40% 27%,#fffbd8 0 15%,#f5bd42 18% 52%,#aa692b 55% 100%); }
.check-button { z-index: 6; }

@media (orientation: portrait), (max-width: 780px) {
  .game-layout {
    inset: 104px 8px 8px;
    grid-template-columns: .82fr 1.18fr;
    grid-template-rows: minmax(92px,19vh) minmax(0,1fr);
    gap: 1px 6px;
  }
  .hero-zone { padding: 0; }
  .hero-character { width: min(100%,150px); max-height: 20vh; }
  .hero-zone .hero-character { width: min(105%,158px); transform: none; }
  .guide-button { width: min(100%,132px); }
  .guide-character { max-height: 20vh; }
  .game-board {
    width: min(100%,580px);
    height: 100%;
    min-height: 0;
    padding: 44px 12px 8px;
    grid-template-rows: minmax(74px,1fr) minmax(58px,.72fr) minmax(90px,.94fr) 58px;
    gap: 3px;
    border-width: 8px;
    border-bottom-width: 13px;
    border-radius: 56px 56px 28px 28px / 34px 34px 24px 24px;
  }
  .game-board::before { inset: 12px 9px 9px; border-width: 2px; border-radius: 44px 44px 20px 20px / 28px 28px 17px 17px; }
  .game-board::after { left: 4%; right: 4%; bottom: 63px; height: 20px; border-width: 3px; border-bottom-width: 6px; }
  .console-top { top: -17px; width: 126px; height: 58px; border-width: 5px; border-bottom-width: 7px; }
  .console-top img { width: 50px; height: 50px; }.console-top i { width: 7px; }
  .console-crystal { top: 42%; width: 50px; height: 105px; }.console-crystal-left { left: -30px; }.console-crystal-right { right: -30px; }
  .task-display { width: 91%; min-height: 73px; padding: 8px 10px; border-width: 5px; border-bottom-width: 8px; border-radius: 28px; }
  .task-display::before { inset: 5px; border-radius: 19px; }
  .light-dot { width: clamp(39px,11vw,55px); border-width: 3px; }.light-dot.small { width: clamp(34px,9.5vw,43px); }
  .answer-track { width: min(86%,380px); max-width: 86%; min-height: 52px; padding: 5px 10px; gap: 5px; border-width: 3px; border-bottom-width: 5px; }
  .answer-slot { width: clamp(39px,10.6vw,48px); border-width: 3px; }
  .button-rack { gap: clamp(7px,2.2vw,12px); }
  .magic-key { width: clamp(61px,18vw,78px); border-width: 6px; border-bottom-width: 9px; }
  .button-rack:has(.magic-key:nth-child(5)) { gap: clamp(4px,1.5vw,7px); }
  .button-rack:has(.magic-key:nth-child(5)) .magic-key { width: clamp(53px,15.6vw,66px); min-width: 53px; }
  .check-button { width: 56px; height: 56px; }
}

@media (orientation: portrait) and (max-height: 700px) {
  .game-layout { top: 98px; grid-template-rows: 83px minmax(0,1fr); }
  .hero-zone .hero-character { width: min(92px,100%); max-height: 12vh; }
  .game-board { padding-top: 36px; grid-template-rows: minmax(61px,1fr) minmax(46px,.7fr) minmax(75px,.9fr) 52px; }
  .console-top { width: 108px; height: 49px; }.console-top img { width: 41px; height: 41px; }
  .console-crystal { height: 84px; width: 42px; }
  .task-display { min-height: 61px; }
  .light-dot { width: clamp(35px,10vw,46px); }.light-dot.small { width: clamp(30px,8.7vw,38px); }
  .answer-track { min-height: 46px; }.answer-slot { width: clamp(35px,9.7vw,42px); }
  .magic-key { width: clamp(56px,16.8vw,70px); }
}

/* Short landscape phones need a compact composition instead of a vertically cropped tablet board. */
@media (orientation: landscape) and (max-height: 520px) {
  .top-hud { top: 4px; left: 8px; right: 8px; min-height: 56px; grid-template-columns: minmax(150px,1fr) auto minmax(205px,1fr); gap: 5px; }
  .round-stars,.level-path { min-height: 48px; padding: 2px 7px; border-width: 2px; }
  .round-star { width: 39px; }.level-node { width: 38px; }.level-node span { width: 18px; height: 18px; font-size: 11px; }
  .hud-controls { gap: 2px; }.icon-button { width: 48px; height: 48px; }
  .game-layout { inset: 62px 7px 5px; grid-template-columns: minmax(92px,.48fr) minmax(490px,2.9fr) minmax(108px,.56fr); gap: 4px; }
  .hero-zone { height: 100%; padding: 0; }.hero-character,.hero-zone .hero-character { width: min(128px,116%); max-height: 77vh; transform: none; }
  .guide-zone { height: 100%; padding: 0; justify-content: center; }.guide-button { width: min(118px,100%); min-height: 82px; }.guide-character { max-height: 35vh; }
  .speech-bubble { width: min(132px,118%); min-height: 66px; margin: 0 0 -5px; padding: 8px 7px 12px; border-width: 4px; font-size: 12px; }
  .speech-bubble::after { bottom: -14px; width: 24px; height: 24px; border-width: 4px; }.speech-icon { font-size: 17px; }
  .bodi-helper { left: -5px; bottom: 1px; width: 58px; max-height: 18vh; }
  .game-board { width: 100%; height: 100%; min-height: 0; padding: 34px 12px 4px; grid-template-rows: minmax(65px,1fr) minmax(38px,.55fr) minmax(64px,.9fr) 48px; gap: 2px; border-width: 7px; border-bottom-width: 11px; border-radius: 48px 48px 25px 25px / 28px 28px 20px 20px; box-shadow: inset 0 0 0 3px #efc76f,inset 0 0 0 7px rgb(108 62 96 / .28),0 7px 0 #4d2b1d,0 12px 20px rgb(49 28 61 / .3); overflow: visible; }
  .game-board::before { inset: 10px 8px 7px; border-width: 2px; border-radius: 38px 38px 18px 18px / 23px 23px 15px 15px; }
  .game-board::after { left: 7%; right: 7%; bottom: 52px; height: 15px; border-width: 2px; border-bottom-width: 5px; }
  .console-top { top: -14px; width: 105px; height: 47px; gap: 7px; border-width: 4px; border-bottom-width: 6px; }.console-top img { width: 39px; height: 39px; }.console-top i { width: 6px; }
  .console-crystal { top: 42%; width: 39px; height: 72px; }.console-crystal-left { left: -24px; }.console-crystal-right { right: -24px; }
  .task-display { width: 90%; min-height: 61px; padding: 5px 8px; gap: 6px; border-width: 4px; border-bottom-width: 7px; border-radius: 24px; }.task-display::before { inset: 4px; border-radius: 16px; }
  .light-dot { width: 43px; border-width: 3px; }.light-dot.small { width: 34px; }.mystery-light { width: 43px; border-width: 3px; font-size: 24px; }.sequence-arrow,.task-plus { font-size: 25px; }
  .answer-track { min-height: 38px; padding: 3px 7px; gap: 4px; border-width: 2px; border-bottom-width: 4px; }.answer-track:empty { min-height: 8px; }.answer-slot { width: 36px; border-width: 2px; }
  .button-rack { gap: 7px; }.magic-key { width: 56px; border-width: 5px; border-bottom-width: 8px; }.button-rack:has(.magic-key:nth-child(5)) { gap: 3px; }.button-rack:has(.magic-key:nth-child(5)) .magic-key { width: 50px; min-width: 50px; }
  .choice-card { width: 92px; min-height: 58px; padding: 4px; border-width: 4px; border-bottom-width: 7px; }.choice-dots i { width: 18px; border-width: 2px; }
  .check-button { width: 48px; height: 48px; }.toast { bottom: 56px; padding: 6px 12px; font-size: 12px; }
  .modal-panel { max-height: 96vh; padding: 12px; gap: 6px; border-width: 6px; border-bottom-width: 9px; }.modal-symbol { width: 64px; }.modal-panel h1 { font-size: 27px; }.modal-panel p { font-size: 16px; }.wood-action { width: 54px; }.reward-star-wrap { width: 112px; }.highfive { max-height: 28vh; }.final-highfive { width: 120px; }.final-stars img { width: 44px; }
  .corner-rune { width: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }

/* Wondermaths juice layer: visual feedback only; never changes puzzle geometry. */
#fx-layer { position: fixed; inset: 0; z-index: 20; overflow: hidden; pointer-events: none; }
#juice-vignette,#juice-spotlight,#juice-ambient { position: absolute; inset: 0; pointer-events: none; }
#juice-vignette { background: radial-gradient(ellipse at center,transparent 55%,rgb(93 61 42 / .055) 100%); }
#juice-spotlight { opacity: 0; background: radial-gradient(circle at 50% 48%,transparent 0 26%,rgb(88 55 39 / .09) 70%,rgb(88 55 39 / .15) 100%); transition: opacity .55s ease; }
.is-juice-spotlight #juice-spotlight { opacity: 1; }
.is-juice-final-bloom #juice-spotlight { animation: juice-final-bloom 1.65s cubic-bezier(.22,.75,.25,1) both; background: radial-gradient(circle at 50% 48%,rgb(255 238 156 / .25),transparent 31%,rgb(101 63 43 / .12) 74%,rgb(101 63 43 / .2)); }
.corner-rune { z-index: 70; }

.juice-ambient-mote { position: absolute; width: 12px; aspect-ratio: 1; border-radius: 2px; opacity: .48; background: #f7ca55; clip-path: polygon(50% 0,63% 36%,100% 50%,63% 64%,50% 100%,37% 64%,0 50%,37% 36%); box-shadow: 0 0 9px 3px rgb(247 202 85 / .38),0 0 17px 5px rgb(141 97 151 / .19); animation: juice-ambient-drift 15s ease-in-out infinite alternate; will-change: transform,opacity; }
.juice-ambient-mote::after { content: none; }
.juice-ambient-mote-2 { width: 9px; background: #d9afe3; }
.juice-ambient-mote-3 { width: 7px; opacity: .42; }

.juice-particle { position: fixed; left: 0; top: 0; width: 11px; height: 11px; z-index: 24; border-radius: 50%; background: var(--juice-color); box-shadow: 0 0 9px var(--juice-color); transform: translate3d(var(--x),var(--y),0); animation: juice-particle-fly .78s cubic-bezier(.2,.74,.24,1) forwards; will-change: transform,opacity; }
.juice-particle-1 { border-radius: 2px; clip-path: polygon(50% 0,63% 37%,100% 50%,63% 63%,50% 100%,37% 63%,0 50%,37% 37%); }
.juice-particle-2 { width: 7px; height: 7px; }

.juice-reward-token { position: fixed; left: 0; top: 0; z-index: 26; width: clamp(30px,4.2vw,50px); aspect-ratio: 1; border: 4px solid #a76b32; border-bottom-width: 7px; border-radius: 50%; background: radial-gradient(circle at 40% 28%,#fffbd6 0 13%,#f7ca55 17% 48%,#b46c2f 53% 100%); box-shadow: 0 0 0 3px rgb(255 242 177 / .7),0 0 22px #f9cf5f; transform: translate3d(calc(var(--sx) - 50%),calc(var(--sy) - 50%),0); animation: juice-token-flight cubic-bezier(.28,.68,.3,1) forwards; will-change: transform,opacity; }
.juice-reward-token::after { content: ""; position: absolute; inset: 23%; background: #fff7be; clip-path: polygon(50% 0,63% 37%,100% 50%,63% 63%,50% 100%,37% 63%,0 50%,37% 37%); }
.juice-reward-token.is-plum { border-color: #68416f; border-bottom-color: #422949; background: radial-gradient(circle at 40% 28%,#fff7dc 0 13%,#c98ad4 17% 48%,#704077 53% 100%); box-shadow: 0 0 0 3px rgb(244 209 249 / .62),0 0 22px #c98ad4; }

.juice-gold-flash { animation: juice-gold-verdict .78s cubic-bezier(.2,.8,.3,1) both !important; }
.juice-target-punch .hero-character { animation: juice-target-punch .23s cubic-bezier(.18,.8,.3,1.2) both !important; }
.is-juice-touch { animation: juice-touch-pop .2s cubic-bezier(.18,.9,.26,1.35) both !important; }
.is-juice-idle { animation: juice-idle-breath 1.15s ease-in-out 1 !important; filter: drop-shadow(0 0 10px rgb(255 225 123 / .78)); }

.juice-object-gag { animation: juice-object-gag .65s ease-in-out 2 !important; filter: sepia(.16) saturate(1.2) drop-shadow(0 0 8px rgb(222 154 73 / .8)); }
.juice-breath-gag { animation: juice-breath-gag 1.15s ease-in-out 2 !important; transform-origin: 68% 42%; }
.juice-scan-gag { animation: juice-scan-gag 1.05s ease-in-out 2 !important; }
.juice-tail-gag { animation: juice-tail-gag .7s ease-in-out 3 !important; transform-origin: 48% 78%; }
.juice-orbit-gag { animation: juice-orbit-gag 1s ease-in-out 2 !important; filter: drop-shadow(0 0 9px rgb(247 202 85 / .75)); }

.game-board.juice-hinting .magic-key:not(.is-hint),.game-board.juice-hinting .choice-card:not(.is-hint),.game-board.juice-hinting .answer-slot:not(.is-hint) { opacity: .72; filter: saturate(.78); }
.game-board.juice-hinting .is-hint { animation: juice-hint-ring 1s ease-in-out 2 !important; z-index: 9; }

.juice-rare-delight { position: fixed; left: -42px; top: var(--delight-y); z-index: 21; width: 34px; height: 34px; border-radius: 55% 45% 58% 42%; background: radial-gradient(circle at 38% 35%,#fff8d6 0 10%,#f7ca55 14% 29%,#8d6197 34% 58%,transparent 61%); filter: drop-shadow(0 0 9px #f7ca55); animation: juice-rare-delight 4.8s ease-in-out forwards; }
.juice-rare-delight::after { content: ""; position: absolute; left: 65%; top: 56%; width: 21px; height: 3px; border-radius: 50%; background: linear-gradient(90deg,#f7ca55,transparent); transform: rotate(18deg); }

.juice-paused #fx-layer * { animation-play-state: paused !important; }

@keyframes juice-touch-pop { 0% { transform: scale(1); } 48% { transform: scale(.91); } 100% { transform: scale(1.04); } }
@keyframes juice-gold-verdict { 0% { filter: brightness(1); } 38% { transform: translateY(-5px) scale(1.08); filter: brightness(1.2) drop-shadow(0 0 15px #f7ca55); } 100% { transform: translateY(0) scale(1); filter: brightness(1); } }
@keyframes juice-particle-fly { 0% { opacity: 0; transform: translate3d(var(--x),var(--y),0) scale(.35) rotate(0); } 18% { opacity: 1; } 100% { opacity: 0; transform: translate3d(calc(var(--x) + var(--dx)),calc(var(--y) + var(--dy)),0) scale(.04) rotate(var(--spin)); } }
@keyframes juice-token-flight { 0% { opacity: 0; transform: translate3d(calc(var(--sx) - 50%),calc(var(--sy) - 50%),0) scale(.55); } 12% { opacity: 1; } 52% { transform: translate3d(calc(var(--mx) - 50%),calc(var(--my) - 50% + var(--arc)),0) scale(1.12) rotate(12deg); } 100% { opacity: .1; transform: translate3d(calc(var(--tx) - 50%),calc(var(--ty) - 50%),0) scale(.42) rotate(28deg); } }
@keyframes juice-target-punch { 0%,100% { transform: scale(1); } 48% { transform: scale(1.1) rotate(-2deg); } }
@keyframes juice-object-gag { 0%,100% { transform: translateX(0) rotate(0); } 25% { transform: translateX(-5px) rotate(-3deg); } 75% { transform: translateX(5px) rotate(3deg); } }
@keyframes juice-breath-gag { 0%,100% { transform: scale(1) rotate(0); } 35% { transform: scale(.98) rotate(-3deg); } 58% { transform: scale(1.05) rotate(4deg); } }
@keyframes juice-scan-gag { 0%,100% { transform: translateX(0) rotate(0); } 30% { transform: translateX(-6px) rotate(-2deg); } 65% { transform: translateX(6px) rotate(2deg); } }
@keyframes juice-tail-gag { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-5deg); } 75% { transform: rotate(5deg); } }
@keyframes juice-orbit-gag { 0%,100% { transform: rotate(0) scale(1); } 33% { transform: rotate(-3deg) scale(1.035); } 66% { transform: rotate(3deg) scale(.985); } }
@keyframes juice-hint-ring { 0%,100% { filter: brightness(1); box-shadow: inherit; } 50% { filter: brightness(1.22); box-shadow: 0 0 0 6px rgb(255 235 138 / .72),0 0 25px #ffe98b; } }
@keyframes juice-idle-breath { 0%,100% { transform: scale(1); } 50% { transform: scale(1.055); } }
@keyframes juice-ambient-drift { 0% { transform: translate3d(-6px,8px,0) scale(.75); opacity: .23; } 48% { opacity: .55; } 100% { transform: translate3d(18px,-23px,0) scale(1.15); opacity: .3; } }
@keyframes juice-final-bloom { 0% { opacity: 0; transform: scale(.86); } 35% { opacity: 1; } 100% { opacity: .5; transform: scale(1.08); } }
@keyframes juice-rare-delight { 0% { opacity: 0; transform: translate3d(0,18px,0) rotate(-12deg) scale(.65); } 12% { opacity: .72; } 50% { transform: translate3d(52vw,-28px,0) rotate(14deg) scale(1); } 88% { opacity: .72; } 100% { opacity: 0; transform: translate3d(108vw,10px,0) rotate(-8deg) scale(.72); } }

@media (prefers-reduced-motion: reduce) {
  #juice-ambient,.juice-particle,.juice-reward-token,.juice-rare-delight { display: none !important; }
  #juice-spotlight { transition: none; }
}
.reduce-motion #juice-ambient,.reduce-motion .juice-particle,.reduce-motion .juice-reward-token,.reduce-motion .juice-rare-delight { display: none !important; }
