:root {
  --ink: #4a2f1c;
  --cream: #fff8ea;
  --cream-2: #ffe9c9;
  --gold: #ffd36b;
  --glow: rgba(255, 214, 130, .75);
  --leaf: #6fbf73;
  --plum: #7a4a26;
  --ease-pop: cubic-bezier(.3, 1.6, .5, 1);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #f3e6cc; overflow: hidden; }
body { position: relative; font-family: Fredoka, system-ui, sans-serif; color: var(--ink); -webkit-user-select: none; user-select: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
svg { display: block; }
[hidden] { display: none !important; }

/* Escenario 16:9 que se adapta a cualquier pantalla o proyector */
/* Escenari fix de 1600×900 que s'escala sencer (com un videojoc): es veu igual en qualsevol pantalla */
.stage { position: absolute; left: 50%; top: 50%; width: 1600px; height: 900px; overflow: hidden; transform: translate(-50%, -50%) scale(var(--s, 1)); transform-origin: 50% 50%; }
.sky { position: absolute; inset: 0; background: linear-gradient(#9fd3ee 0%, #c4e6f2 32%, #f3f0d4 62%, #ffe6b8 100%); }
.scene .rays { animation: spin 90s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.scene-wrap, .scene { position: absolute; inset: 0; width: 100%; height: 100%; }
.scene .tw { animation: twinkle 3.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.scene .wind path { stroke-dasharray: 60 40; animation: blow 2.4s linear infinite; }
.scene .fall { animation: fall 3.5s ease-in infinite; transform-box: fill-box; }
.scene .fall:nth-child(odd) { animation-delay: -1.4s; }
@keyframes twinkle { 50% { opacity: .35; transform: scale(.8); } }
@keyframes blow { to { stroke-dashoffset: -200; } }
@keyframes fall { 0% { transform: translateY(-40px) rotate(0); opacity: 0 } 15% { opacity: 1 } 100% { transform: translateY(420px) rotate(var(--rot, 40deg)); opacity: 0 } }

.flies { position: absolute; inset: 0; pointer-events: none; }
.firefly { position: absolute; width: 9.6px; height: 9.6px; border-radius: 50%; background: #fffbe0; box-shadow: 0 0 22.4px 8px rgba(255, 224, 120, .9); animation: float 7s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translate(0, 0); opacity: .25 } 50% { transform: translate(40px, -56px); opacity: 1 } }

.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; animation: screenIn .6s var(--ease-out) both; }
@keyframes screenIn { from { opacity: 0; transform: scale(1.03) } to { opacity: 1; transform: none } }

.title { margin: 48px 0 0; font-size: 96px; font-weight: 700; color: #fff; letter-spacing: .02em; -webkit-text-stroke: 8px #a0582a; paint-order: stroke fill; text-shadow: 0 7.2px 0 #7a3f1c, 0 0 48px rgba(255, 220, 140, .8); text-align: center; line-height: 1.05; }
.title.small { font-size: 70.4px; margin-top: 48px; }
.title.inline { margin: 0; font-size: 54.4px; }

/* Botones comunes */
.topbar { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 32px 38.4px 0; position: relative; z-index: 6; }
.icon-btn { width: 96px; height: 96px; aspect-ratio: 1; border-radius: 50%; background: rgba(255, 248, 234, .92); display: grid; place-items: center; box-shadow: 0 7.2px 0 rgba(90, 55, 25, .3); transition: transform .2s var(--ease-pop); }
.icon-btn:hover { transform: scale(1.08); }
.icon-btn svg { width: 55%; fill: none; stroke: var(--plum); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.ghost { visibility: hidden; }
.fs { position: absolute; right: 38.4px; bottom: 35.2px; width: 67.2px; height: 67.2px; opacity: .5; z-index: 8; }
.fs:hover { opacity: 1; }
.narr { position: absolute; right: 38.4px; top: 32px; z-index: 8; display: flex; align-items: center; gap: 11.2px; height: 96px; padding: 0 28.8px 0 22.4px; border-radius: 99px; background: rgba(255, 248, 234, .92); box-shadow: 0 7.2px 0 rgba(90, 55, 25, .3); font-weight: 600; font-size: 27.2px; color: var(--plum); transition: transform .2s var(--ease-pop); }
.narr:hover { transform: scale(1.05); }
.narr svg { width: 51.2px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.narr .cross { display: none; }
.narr[aria-pressed="false"] { opacity: .75; }
.narr[aria-pressed="false"] .waves { display: none; }
.narr[aria-pressed="false"] .cross { display: block; }

/* Fades i donyets */
.char { position: absolute; pointer-events: none; z-index: 4; animation: hover 3.4s ease-in-out infinite; }
.char .char-svg { width: 100%; height: auto; overflow: visible; }
.char .wings { transform-origin: 100px 125px; animation: flap .35s ease-in-out infinite alternate; }
.char .wand-star { transform-box: fill-box; transform-origin: center; animation: twinkle 1.6s ease-in-out infinite; }
.char.tomas, .char.donyet2 { animation: hop 1.8s ease-in-out infinite; }
.char .wave { transform-box: fill-box; transform-origin: 0% 100%; animation: wave 1.2s ease-in-out infinite alternate; }
@keyframes hover { 50% { translate: 0 -25.6px; } }
@keyframes hop { 0%, 60%, 100% { translate: 0 0 } 30% { translate: 0 -16px } }
@keyframes flap { to { transform: scaleX(.86); } }
@keyframes wave { to { transform: rotate(-18deg); } }

/* ---------- INICI ---------- */
#home .title { font-size: 105.6px; margin-top: 64px; }
.home-cast { position: absolute; inset: 0; pointer-events: none; }
.menu { position: absolute; bottom: 80px; display: flex; gap: 64px; }
.menu-btn { width: 352px; padding: 35.2px 0 32px; border-radius: 54.4px; background: radial-gradient(circle at 50% 30%, #fffdf6, var(--cream) 60%, var(--cream-2)); box-shadow: 0 16px 0 rgba(150, 95, 45, .45), 0 0 56px rgba(255, 214, 140, .4); display: flex; flex-direction: column; align-items: center; gap: 19.2px; font-weight: 700; font-size: 40px; color: var(--plum); transition: transform .3s var(--ease-pop), box-shadow .3s; animation: cardIn .7s var(--ease-pop) backwards; }
.menu-btn:nth-child(2) { animation-delay: .1s; } .menu-btn:nth-child(3) { animation-delay: .2s; }
.menu-btn:hover { transform: translateY(-16px) scale(1.04); box-shadow: 0 25.6px 0 rgba(150, 95, 45, .4), 0 0 80px rgba(255, 214, 140, .7); }
.menu-btn .ico { width: 144px; height: 144px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; background: var(--gold); box-shadow: inset 0 -8px 0 rgba(200, 120, 40, .3); }
.menu-btn:nth-child(2) .ico { background: #9fe6a0; } .menu-btn:nth-child(3) .ico { background: #ffb3c4; }
.menu-btn .ico svg { width: 55%; fill: none; stroke: var(--plum); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.menu-btn .ico .f { fill: var(--plum); stroke: none; }

/* ---------- CONTE: pàgines ---------- */
.cast { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.cover-title { position: absolute; top: 112px; margin: 0; font-size: 96px; text-align: center; color: #fff; -webkit-text-stroke: 8px #a0582a; paint-order: stroke fill; text-shadow: 0 7.2px 0 #7a3f1c, 0 0 48px rgba(255, 220, 140, .8); line-height: 1.05; z-index: 5; }
.story-text { position: absolute; left: 50%; bottom: 28.8px; translate: -50% 0; width: 1216px; margin: 0; padding: 19.2px 38.4px; border-radius: 32px; background: rgba(255, 248, 234, .92); box-shadow: 0 9.6px 0 rgba(150, 95, 45, .35); font-size: 29.6px; font-weight: 500; line-height: 1.38; text-align: center; color: #4a2f1c; z-index: 5; white-space: pre-line; }
.story-text.long { font-size: 25.6px; }
.parade { position: absolute; left: 256px; right: 256px; top: 208px; display: flex; flex-wrap: wrap; justify-content: center; gap: 6.4px 16px; z-index: 3; }
.parade button { width: 137.6px; height: 137.6px; aspect-ratio: 1; }
.parade .animal-svg { width: 100%; height: 100%; animation: dance 1s ease-in-out infinite; transform-origin: 50% 90%; }
.parade button:nth-child(odd) .animal-svg { animation-delay: -.5s; }
.magic-star { position: absolute; left: 40%; top: 66%; width: 176px; translate: -50% -50%; z-index: 5; filter: drop-shadow(0 0 22.4px rgba(255, 230, 120, .7)) saturate(.6) brightness(.8); animation: invite 1.6s ease-in-out infinite; transition: filter .6s, width .8s var(--ease-pop); }
.magic-star svg { width: 100%; }
.magic-star.lit { width: 272px; filter: drop-shadow(0 0 48px #fff3a0) drop-shadow(0 0 96px #ffe76b) brightness(1.1); animation: shine 2s ease-in-out infinite; }
@keyframes shine { 50% { transform: rotate(12deg) scale(1.08); } }
@keyframes invite { 50% { transform: scale(1.06) rotate(-2deg); } }

/* ---------- CONTE: el camí ---------- */
#map .topbar { padding-right: 352px; }
.map-path { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
.map-path .road { fill: none; stroke: #d9b48a; stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; opacity: .92; }
.map-path .road-dash { fill: none; stroke: #fff4d6; stroke-width: .5; stroke-dasharray: 1.4 1.6; stroke-linecap: round; opacity: .8; }
.stops { position: absolute; inset: 0; z-index: 2; }
.stop { position: absolute; width: 144px; height: 144px; aspect-ratio: 1; translate: -50% -50%; border-radius: 50%; background: radial-gradient(circle at 50% 38%, #fffdf6, var(--cream) 55%, var(--cream-2)); box-shadow: 0 9.6px 0 rgba(150, 95, 45, .45); display: grid; place-items: center; padding: 9.6px; transition: transform .25s var(--ease-pop); }
.stop span { font-weight: 700; font-size: 48px; color: #b59a7a; }
.stop .animal-svg, .stop svg { width: 100%; height: 100%; }
.stop.locked { opacity: .55; filter: saturate(.4); }
.stop.current { box-shadow: 0 9.6px 0 rgba(150, 95, 45, .45), 0 0 0 8px var(--gold), 0 0 64px 16px var(--glow); animation: beckon 1.4s ease-in-out infinite; }
.stop.current span { color: var(--plum); font-size: 70.4px; }
.stop.done:hover, .stop.current:hover { transform: scale(1.1); }
.stop.oak { width: 176px; }
.stop.nope { animation: shake .5s; }
@keyframes beckon { 50% { transform: scale(1.1); } }
.token { position: absolute; z-index: 3; width: 0; height: 0; pointer-events: none; transition: left 1.6s var(--ease-out), top 1.6s var(--ease-out); }
.token.instant { transition: none; }
.token .char { width: 102.4px; top: -168px; }
.token .char.flor { left: -128px; } .token .char.tomas { left: 22.4px; top: -153.6px; width: 92.8px; }

/* ---------- CONTE: una parada ---------- */
#level .topbar { padding-right: 272px; }
.lvl-cast { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.hide-spot { position: absolute; left: 144px; top: 208px; width: 480px; height: 480px; aspect-ratio: 1; z-index: 3; }
.hide-spot .animal { position: absolute; inset: 0; opacity: 0; transform: scale(.4) translateY(20%); transition: transform .6s var(--ease-pop), opacity .3s; }
.hide-spot .animal .animal-svg { width: 100%; height: 100%; }
.hide-spot .cover { position: absolute; inset: -6%; transition: transform .7s var(--ease-out), opacity .6s; transform-origin: 50% 100%; filter: drop-shadow(0 0 22.4px rgba(255, 230, 150, .55)); animation: invite 2.2s ease-in-out infinite; }
.hide-spot .cover-svg { width: 100%; height: 100%; }
.hide-spot .ask { position: absolute; right: -16px; top: -16px; width: 112px; height: 112px; aspect-ratio: 1; border-radius: 50%; background: var(--gold); display: grid; place-items: center; font-weight: 700; font-size: 73.6px; color: var(--plum); box-shadow: 0 6.4px 0 rgba(120, 70, 40, .35); animation: bob 1s ease-in-out infinite alternate; }
.hide-spot.heard .cover { animation: rustle .35s ease-in-out infinite alternate; }
.hide-spot.open .cover { transform: translateY(45%) scale(.9); opacity: 0; animation: none; }
.hide-spot.open .ask { opacity: 0; transform: scale(.3); animation: none; transition: transform .3s, opacity .3s; }
.hide-spot.open .animal { opacity: 1; transform: none; }
.hide-spot.open.dance .animal-svg { animation: dance .9s ease-in-out 3; transform-origin: 50% 90%; }
.hide-spot .label { position: absolute; left: 50%; bottom: -54.4px; translate: -50% 0; background: var(--gold); padding: 4.8px 28.8px; border-radius: 99px; font-weight: 700; font-size: 41.6px; white-space: nowrap; box-shadow: 0 5.6px 0 rgba(90, 55, 25, .3); opacity: 0; transition: opacity .3s .4s; }
.hide-spot.open .label { opacity: 1; }
@keyframes rustle { from { transform: rotate(-3deg) } to { transform: rotate(3deg) translateY(-2%) } }
@keyframes bob { to { translate: 0 -12.8px; } }

.riddle { position: absolute; left: 736px; top: 150.4px; width: 736px; padding: 22.4px 38.4px 25.6px; border-radius: 38.4px; background: rgba(255, 248, 234, .94); box-shadow: 0 11.2px 0 rgba(150, 95, 45, .4), 0 0 64px rgba(255, 214, 140, .3); color: #4a2f1c; z-index: 5; }
.r-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-weight: 700; font-size: 30.4px; color: var(--plum); }
.riddle.solved .r-head span { color: #3f8a4a; }
.r-say { width: 64px; height: 64px; aspect-ratio: 1; border-radius: 50%; background: var(--gold); display: grid; place-items: center; flex: none; transition: transform .2s var(--ease-pop); }
.r-say:hover { transform: scale(1.1); }
.r-say svg { width: 60%; fill: none; stroke: var(--plum); stroke-width: 2.2; stroke-linecap: round; }
.r-say .f { fill: var(--plum); stroke: none; }
.r-intro { margin: 9.6px 0 0; font-size: 25.6px; font-style: italic; line-height: 1.3; color: #8a6a4e; }
.r-verse { margin: 12.8px 0 0; font-size: 34.4px; font-weight: 600; line-height: 1.32; white-space: pre-line; }
.lvl-cards { position: absolute; left: 736px; width: 736px; bottom: 51.2px; display: flex; justify-content: space-between; z-index: 5; }
.lvl-cards .card { width: 214.4px; border-radius: 44.8px; padding: 12.8px; }
.r-answer { position: absolute; left: 736px; width: 576px; bottom: 64px; margin: 0; padding: 22.4px 35.2px; border-radius: 38.4px; background: var(--gold); box-shadow: 0 11.2px 0 rgba(150, 100, 40, .45); font-size: 32px; font-weight: 600; line-height: 1.35; color: #4a2f1c; white-space: pre-line; z-index: 5; animation: pop .5s var(--ease-pop) both; }
.r-answer::first-line { font-size: 41.6px; font-weight: 700; }
.lvl-next { top: auto; bottom: 57.6px; right: 48px; translate: none; width: 134.4px; height: 134.4px; }

.nav { position: absolute; top: 50%; translate: 0 -50%; width: 112px; height: 112px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; z-index: 6; transition: transform .2s var(--ease-pop), opacity .3s; }
.nav svg { width: 55%; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.nav.prev { left: 25.6px; background: rgba(160, 100, 50, .35); }
.nav.next { right: 25.6px; background: var(--leaf); box-shadow: 0 11.2px 0 #3f8a4a, 0 0 48px rgba(140, 230, 140, .5); }
.nav.next.ready { animation: nudge 1.4s ease-in-out infinite; }
.nav.next.wait { opacity: .45; }
.nav:hover { transform: scale(1.08); }
.nav.off { opacity: 0; pointer-events: none; }

/* ---------- JOC ---------- */
#game .topbar { padding-right: 272px; }
.progress { display: flex; gap: 19.2px; }
.slot { width: 83.2px; height: 83.2px; aspect-ratio: 1; border-radius: 50%; border: 4.8px dashed rgba(160, 100, 50, .5); background: rgba(255, 248, 234, .5); display: grid; place-items: center; }
.slot.current { border-color: var(--gold); border-style: solid; box-shadow: 0 0 25.6px var(--glow); }
.slot.done { border: 5.6px solid var(--cream); background: var(--cream); animation: pop .6s var(--ease-pop); }
.slot svg { width: 92%; }

.play { position: relative; margin-top: 32px; width: 208px; height: 208px; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 38% 32%, #fffbe8, #ffe08a 55%, #ffc65a); box-shadow: 0 0 64px 16px rgba(255, 220, 120, .55), 0 12.8px 0 #d99a3a; display: grid; place-items: center; transition: transform .25s var(--ease-pop); }
.play:hover { transform: scale(1.06); }
.play:active { transform: scale(.96); }
.play svg { width: 48%; fill: none; stroke: #6b3f7a; stroke-width: 2.2; stroke-linecap: round; }
.play svg .fill { fill: #6b3f7a; stroke: none; }
.play::before, .play::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 7.2px solid #ffe7a6; opacity: 0; }
.play.playing::before { animation: ring 1.4s infinite; }
.play.playing::after { animation: ring 1.4s .7s infinite; }
.play.playing svg { animation: wobble .5s ease-in-out infinite alternate; }
@keyframes ring { 0% { transform: scale(1); opacity: .8 } 100% { transform: scale(1.8); opacity: 0 } }
@keyframes wobble { to { transform: scale(1.08) rotate(-4deg); } }

.cards { display: flex; gap: 72px; margin-top: 54.4px; }
.card { position: relative; width: 336px; height: 336px; aspect-ratio: 1; border-radius: 64px; background: radial-gradient(circle at 50% 38%, #fffdf6 0%, var(--cream) 55%, var(--cream-2) 100%); box-shadow: 0 16px 0 rgba(150, 95, 45, .45), 0 0 48px rgba(255, 214, 140, .35); border: 5.6px solid rgba(255, 255, 255, .9); display: grid; place-items: center; padding: 22.4px; transition: transform .3s var(--ease-pop), opacity .4s ease, filter .4s ease, box-shadow .3s; animation: cardIn .6s var(--ease-pop) backwards; }
.card:nth-child(2) { animation-delay: .1s; } .card:nth-child(3) { animation-delay: .2s; }
.card:nth-child(1) { rotate: -2deg; } .card:nth-child(3) { rotate: 2deg; }
.card:hover { transform: translateY(-16px) scale(1.04); box-shadow: 0 25.6px 0 rgba(150, 95, 45, .4), 0 0 80px rgba(255, 214, 140, .7); }
.card .animal-svg { width: 100%; height: 100%; }
.card .num { position: absolute; left: 20.8px; top: 16px; font-size: 24px; font-weight: 600; color: #b59a7a; opacity: .7; }
.card.wrong { animation: shake .55s; opacity: .5; filter: saturate(.5); }
.card.right { transform: scale(1.12); z-index: 2; box-shadow: 0 16px 0 rgba(150, 95, 45, .45), 0 0 0 9.6px var(--gold), 0 0 112px 32px var(--glow); }
.card.right .animal-svg { animation: dance .9s ease-in-out infinite; transform-origin: 50% 90%; }
.card.faded { opacity: .25; transform: scale(.9); filter: saturate(.3); pointer-events: none; }
.card .name, .acard .name { position: absolute; bottom: -67.2px; left: 50%; translate: -50% 0; background: var(--gold); padding: 4.8px 25.6px; border-radius: 99px; font-weight: 700; font-size: 35.2px; white-space: nowrap; box-shadow: 0 5.6px 0 rgba(90, 55, 25, .3); animation: pop .5s var(--ease-pop) both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(64px) scale(.8) } to { opacity: 1; transform: none } }
@keyframes shake { 0%, 100% { translate: 0 } 20% { translate: -20.8px 0; rotate: -4deg } 40% { translate: 20.8px 0; rotate: 4deg } 60% { translate: -11.2px 0 } 80% { translate: 11.2px 0 } }
@keyframes dance { 0%, 100% { transform: rotate(-5deg) translateY(0) } 50% { transform: rotate(5deg) translateY(-6%) } }
@keyframes pop { 0% { transform: scale(.3); opacity: 0 } 60% { transform: scale(1.15); opacity: 1 } 100% { transform: scale(1) } }
@keyframes nudge { 50% { transform: translateX(12.8px) } }

.next { position: absolute; right: 48px; top: 50%; translate: 0 -50%; width: 144px; height: 144px; aspect-ratio: 1; border-radius: 50%; background: var(--leaf); box-shadow: 0 12.8px 0 #3f8a4a, 0 0 64px rgba(140, 230, 140, .6); display: grid; place-items: center; animation: pop .5s var(--ease-pop) both, nudge 1.6s 1s ease-in-out infinite; }
.next svg { width: 55%; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

.spark { position: absolute; left: 50%; top: 45%; width: 48px; height: 48px; pointer-events: none; z-index: 5; animation: flyout 1.1s var(--ease-out) forwards; }
@keyframes flyout { from { transform: translate(-50%, -50%) scale(.3) rotate(0); opacity: 1 } to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1) rotate(220deg); opacity: 0 } }

/* Final del joc */
.win-row { margin-top: 48px; display: flex; gap: 25.6px; flex-wrap: wrap; justify-content: center; width: 1344px; }
.win-row button { width: 224px; height: 224px; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, var(--cream) 55%, var(--cream-2)); box-shadow: 0 11.2px 0 rgba(150, 95, 45, .45), 0 0 48px rgba(255, 214, 140, .4); padding: 19.2px; animation: pop .6s var(--ease-pop) backwards; }
.win-row .animal-svg { width: 100%; height: 100%; animation: dance 1s ease-in-out infinite; transform-origin: 50% 90%; }
.actions { display: flex; gap: 38.4px; margin-top: 64px; }
.pill { display: flex; align-items: center; gap: 16px; padding: 19.2px 48px; border-radius: 99px; background: var(--leaf); color: #fff; font-weight: 700; font-size: 38.4px; box-shadow: 0 11.2px 0 #3f8a4a; transition: transform .2s var(--ease-pop); }
.pill.alt { background: var(--cream); color: var(--plum); box-shadow: 0 11.2px 0 rgba(150, 95, 45, .45); }
.pill:hover { transform: scale(1.05); }
.pill svg { width: 44.8px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- ÀLBUM ---------- */
#album .topbar { padding-right: 272px; }
.album-grid { margin: auto 0 80px; display: grid; grid-template-columns: repeat(7, 1fr); gap: 86.4px 38.4px; width: 1472px; }
.acard { position: relative; aspect-ratio: 1; border-radius: 38.4px; background: radial-gradient(circle at 50% 38%, #fffdf6, var(--cream) 55%, var(--cream-2)); box-shadow: 0 11.2px 0 rgba(150, 95, 45, .45); padding: 12.8px; transition: transform .3s var(--ease-pop), box-shadow .3s; animation: cardIn .6s var(--ease-pop) backwards; }
.acard:hover { transform: translateY(-9.6px) scale(1.05); }
.acard .animal-svg { width: 100%; height: 100%; }
.acard .name { bottom: -51.2px; font-size: 25.6px; padding: 2.4px 16px; background: var(--cream); animation: none; }
.acard.on { transform: scale(1.18); z-index: 2; box-shadow: 0 11.2px 0 rgba(150, 95, 45, .45), 0 0 0 7.2px var(--gold), 0 0 80px 22.4px var(--glow); }
.acard.on .animal-svg { animation: dance .9s ease-in-out infinite; transform-origin: 50% 90%; }
.acard.on .name { background: var(--gold); }

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

/* ---------- Il·lustracions (estil conte pintat) ---------- */
.animal-img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 16%; -webkit-user-drag: none; }
.card .animal-img, .acard .animal-img { box-shadow: inset 0 0 0 1px rgba(0,0,0,.05); }
.stop .animal-img, .slot .animal-img, .parade .animal-img, .win-row .animal-img { border-radius: 50%; }
.stop.done { padding: 5.6px; background: #fff; }
.slot.done { background: #fff; padding: 3.2px; }
.parade button, .win-row button { border-radius: 50%; background: #fff; padding: 5.6px; box-shadow: 0 8px 0 rgba(150, 95, 45, .35), 0 0 38.4px rgba(255, 220, 140, .6); }
.parade .animal-img, .win-row .animal-img { width: 100%; height: 100%; }
.hide-spot .animal { inset: 4%; border-radius: 16%; background: #fff; padding: 2.5%; box-shadow: 0 16px 0 rgba(150, 95, 45, .4), 0 0 64px rgba(255, 220, 140, .7); }
.portrait { background: #fff; padding: 4%; border-radius: 10%; box-shadow: 0 11.2px 0 rgba(150, 95, 45, .35), 0 0 48px rgba(255, 225, 150, .8); rotate: -3deg; }
.portrait.tomas { rotate: 3deg; }
.portrait img { display: block; width: 100%; height: auto; border-radius: 7%; -webkit-user-drag: none; }
.token .portrait { padding: 5%; border-radius: 50%; }
.token .portrait img { aspect-ratio: 1; object-fit: cover; border-radius: 50%; }
.token .char { width: 105.6px; top: -137.6px; }
.token .char.flor { left: -118.4px; } .token .char.tomas { left: 9.6px; top: -128px; width: 99.2px; }
.story-pic { position: absolute; left: 50%; top: 168px; translate: -50% 0; width: 1280px; border: 11.2px solid #fff; border-radius: 38.4px; box-shadow: 0 16px 0 rgba(150, 95, 45, .35), 0 0 80px rgba(255, 225, 150, .8); z-index: 3; animation: pop .7s var(--ease-pop) both; }

/* ---------- Personatges dins de l'escena ---------- */
.anchor { position: absolute; width: 0; height: 0; padding: 0; }
.actor { position: absolute; left: 0; bottom: 0; translate: -50% 0; pointer-events: none; }
button.anchor .actor { pointer-events: auto; cursor: pointer; }
.actor .lean, .actor .body, .actor img { transform-origin: 50% 100%; }
.actor img { display: block; width: 100%; height: auto; -webkit-user-drag: none; filter: drop-shadow(0 6px 6px rgba(70, 45, 15, .25)); }
.actor .shadow { position: absolute; left: 14%; right: 14%; bottom: -10px; height: 22px; border-radius: 50%; background: radial-gradient(closest-side, rgba(60, 40, 10, .38), transparent); }
.actor.fly .shadow { display: none; }
.dust { position: absolute; width: 9px; height: 9px; margin: -4px; border-radius: 50%; background: #fffbe0; box-shadow: 0 0 10px 4px rgba(255, 220, 110, .85); pointer-events: none; z-index: 5; animation: dust 1s ease-out forwards; }
@keyframes dust { from { opacity: 1; transform: translate(0, 0) scale(1) } to { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.2) } }
.parade { position: absolute; inset: 0; z-index: 3; }
.parade button.anchor { width: 0; height: 0; aspect-ratio: auto; background: none; box-shadow: none; padding: 0; border-radius: 0; }
.hide-spot { left: 208px; top: 240px; width: 384px; height: 384px; }
.hide-spot .animal { inset: 6% 6% 0; background: none; padding: 0; box-shadow: none; border-radius: 0; }
.hide-spot .animal .actor { width: 100%; left: 50%; }
.hide-spot .label { z-index: 2; }
.token .anchor { z-index: 3; }

/* Botons rodons i targetes quadrades: que no s'aplanen mai */
.icon-btn, .nav, .next, .play, .stop, .slot, .r-say, .menu-btn .ico, .hide-spot .ask, .card, .win-row button, .narr, .menu-btn, .pill { flex: none; }
.lvl-cards .card { height: 214.4px; }
.stop.oak { height: 176px; }
.acard { height: 177px; }
.next.lvl-next { top: auto; bottom: 57.6px; right: 48px; translate: none; width: 134.4px; height: 134.4px; }
/* L'estrela de l'amistat parla: batega i, si la toquen, creix una miqueta */
.magic-star.talk { top: 58%; transform-origin: 50% 85%; scale: var(--grow, 1); transition: scale .6s var(--ease-pop), filter .6s; animation: talk 1.1s ease-in-out infinite; }
.magic-star.talk.grow { cursor: pointer; }
@keyframes talk { 0%, 100% { transform: scale(1) rotate(0) } 30% { transform: scale(1.08) rotate(-4deg) } 60% { transform: scale(.97) rotate(3deg) } }

/* ---------- JOCS: menú ---------- */
#jocs .topbar, #joc .topbar { padding-right: 352px; }
.jocs-grid { position: absolute; left: 120px; right: 120px; top: 170px; display: flex; flex-wrap: wrap; justify-content: center; gap: 44px 40px; }
.joc-card { position: relative; width: 300px; height: 300px; flex: none; border-radius: 48px; background: radial-gradient(circle at 50% 35%, #fffdf6, var(--cream) 60%, var(--cream-2)); box-shadow: 0 14px 0 rgba(150, 95, 45, .4), 0 0 48px rgba(255, 214, 140, .45); display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 24px; transition: transform .3s var(--ease-pop); animation: cardIn .6s var(--ease-pop) backwards; }
.joc-card:hover { transform: translateY(-12px) scale(1.04); }
.m-name { font-weight: 700; font-size: 34px; color: var(--plum); }
.m-art { position: absolute; left: 20px; right: 20px; top: 18px; height: 196px; }
.m-img { position: absolute; left: 50%; bottom: 0; height: 190px; translate: -50% 0; filter: drop-shadow(0 6px 6px rgba(70, 45, 15, .25)); }
.m-img.small { height: 120px; left: 72%; }
.m-img.shadow-img { left: 32%; height: 170px; filter: brightness(0); opacity: .28; }
.m-badge { position: absolute; right: 10px; top: 6px; width: 80px; height: 80px; border-radius: 50%; background: var(--gold); color: var(--plum); display: grid; place-items: center; }
.m-badge svg { width: 54%; }
.m-home, .m-food { position: absolute; left: 0; top: 10px; width: 66%; }
.m-food { width: 54%; top: 30px; }
.m-parts { position: absolute; left: 50%; top: 6px; width: 150px; height: 186px; translate: -50% 0; display: flex; flex-direction: column; gap: 6px; }
.m-parts div { flex: 1; background-size: 150px 186px; background-repeat: no-repeat; border-radius: 6px; }
.m-parts div:nth-child(1) { background-position: 0 0 !important; } .m-parts div:nth-child(2) { background-position: 0 -62px !important; } .m-parts div:nth-child(3) { background-position: 0 -124px !important; }
.m-cards { position: absolute; inset: 20px 10px 0; display: flex; justify-content: center; align-items: center; gap: 12px; }
.m-cards span { width: 76px; height: 100px; border-radius: 14px; background: #fff; box-shadow: 0 5px 0 rgba(150, 95, 45, .35); overflow: hidden; display: grid; place-items: center; }
.m-cards span:nth-child(1) { rotate: -8deg; } .m-cards span:nth-child(3) { rotate: 8deg; }
.m-cards img { width: 100%; height: 100%; object-fit: cover; }
.m-back, .mem-back { background: repeating-linear-gradient(45deg, #ffd36b 0 14px, #ffc94a 14px 28px) !important; }
.m-count { position: absolute; inset: 0; }
.m-count img { position: absolute; width: 36%; }
.m-num { position: absolute; right: 0; top: 0; width: 80px; height: 80px; border-radius: 50%; background: var(--gold); color: var(--plum); font-weight: 700; font-size: 52px; display: grid; place-items: center; }

/* ---------- JOCS: comú ---------- */
.joc-area { position: absolute; inset: 0; z-index: 3; }
.joc-cast { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.pdot { width: 40px; height: 40px; flex: none; border-radius: 50%; border: 5px dashed rgba(160, 100, 50, .5); background: rgba(255, 248, 234, .5); }
.pdot.cur { border: 5px solid var(--gold); box-shadow: 0 0 22px var(--glow); }
.pdot.on { border: 5px solid #fff; background: var(--gold); animation: pop .6s var(--ease-pop); }
#jocProg { gap: 18px; }
.drag { position: absolute; translate: -50% -50%; scale: var(--sc, 1); rotate: var(--rot, 0deg); cursor: grab; touch-action: none; z-index: 4; transition: scale .3s var(--ease-pop), rotate .3s; animation: pop .6s var(--ease-pop) backwards; }
.drag.dragging { cursor: grabbing; z-index: 9; scale: calc(var(--sc, 1) * 1.1); filter: drop-shadow(0 18px 14px rgba(70, 45, 15, .3)); }
.drag.returning { transition: left .35s var(--ease-out), top .35s var(--ease-out), scale .3s; }
.drag.placed { cursor: default; transition: left .45s var(--ease-pop), top .45s var(--ease-pop), scale .45s var(--ease-pop), rotate .45s; z-index: 5; }
.drag.nope { animation: shake .5s; }
.drag .actor { left: 50%; width: 100%; }
.drag .actor img { pointer-events: none; }

/* Destins: cases, menjar i ombres */
.target { position: absolute; translate: -50% -50%; display: flex; flex-direction: column; align-items: center; animation: pop .6s var(--ease-pop) backwards; }
.target.cases .home-svg { width: 330px; height: 264px; filter: drop-shadow(0 10px 8px rgba(70, 45, 15, .2)); }
.target .plate { width: 250px; height: 250px; border-radius: 50%; background: radial-gradient(circle, #fff 60%, #f3e6cc); box-shadow: 0 10px 0 rgba(150, 95, 45, .3); display: grid; place-items: center; }
.target .food-svg { width: 190px; height: 190px; }
.t-label { margin-top: 10px; padding: 4px 22px; border-radius: 99px; background: rgba(255, 248, 234, .92); font-weight: 700; font-size: 28px; color: var(--plum); box-shadow: 0 5px 0 rgba(150, 95, 45, .3); }
.target.done .t-label { background: var(--gold); }
.target.ombres { width: 230px; height: 230px; justify-content: flex-end; }
.target.ombres .shadow-img, .board .shadow-img { width: 100%; filter: brightness(0); opacity: .3; }
.target.ombres.filled .shadow-img { opacity: 0; transition: opacity .4s; }
.animal-drag .actor .shadow { display: none; }

/* Construïm l'animal */
.board { position: absolute; border-radius: 20px; }
.board .shadow-img { position: absolute; inset: 0; height: 100%; object-fit: contain; }
.slot-line { position: absolute; left: -16px; right: -16px; border: 4px dashed rgba(160, 100, 50, .45); border-radius: 18px; }
.board.complete .slot-line { opacity: 0; transition: opacity .4s; }
.board.complete .shadow-img { opacity: 0; }
.drag.part { background-repeat: no-repeat; filter: drop-shadow(0 6px 6px rgba(70, 45, 15, .25)); }
.drag.part.whole { animation: dance .9s ease-in-out 2; transform-origin: 50% 100%; }

/* Parelles */
.mem { position: absolute; translate: -50% -50%; perspective: 900px; animation: pop .5s var(--ease-pop) backwards; }
.mem-in { position: absolute; inset: 0; transition: transform .45s var(--ease-out); transform-style: preserve-3d; }
.mem.open .mem-in { transform: rotateY(180deg); }
.mem-back, .mem-face { position: absolute; inset: 0; border-radius: 28px; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: 0 9px 0 rgba(150, 95, 45, .4); border: 6px solid #fff; overflow: hidden; }
.mem-back::after { content: "?"; position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: 90px; color: rgba(255, 255, 255, .85); }
.mem-face { transform: rotateY(180deg); background: #fff; }
.mem-face img { width: 100%; height: 100%; object-fit: cover; }
.mem:not(.open):hover .mem-in { transform: scale(1.05); }
.mem.match .mem-face { box-shadow: 0 9px 0 rgba(150, 95, 45, .4), 0 0 0 8px var(--gold), 0 0 50px 10px var(--glow); }
.mem.match { animation: pop .5s var(--ease-pop); }

/* Comptem */
.count-me { z-index: 4; }
.count-me .actor { pointer-events: auto; cursor: pointer; }
.count-num { position: absolute; left: 0; bottom: 190px; translate: -50% 0; width: 84px; height: 84px; border-radius: 50%; background: var(--gold); color: var(--plum); font-weight: 700; font-size: 56px; display: grid; place-items: center; box-shadow: 0 6px 0 rgba(150, 95, 45, .4); animation: pop .5s var(--ease-pop); pointer-events: none; }
.big-num { position: absolute; left: 50%; top: 250px; translate: -50% -50%; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fff6c8, var(--gold)); color: var(--plum); font-weight: 700; font-size: 160px; display: grid; place-items: center; box-shadow: 0 12px 0 rgba(150, 95, 45, .4), 0 0 80px 20px var(--glow); animation: pop .7s var(--ease-pop); z-index: 6; }
