/* YAHYA Kids — games world, memorisation check and Quran heroes. Uses the tokens of kids.css. */

/* dock: ten buttons → five per row on wider screens */
.yk-dock-btn.d9 { background: linear-gradient(#a98bf0, var(--violet)); box-shadow: 0 7px 0 #5c3ea3; }
.yk-dock-btn.d10 { background: linear-gradient(#f3b062, #d9822b); box-shadow: 0 7px 0 #9a5410; }
@media (min-width: 620px) { .yk-dock { grid-template-columns: repeat(5, minmax(0, 1fr)); max-width: 900px; } }

@keyframes gm-bounce-in { 0% { transform: scale(.3); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
@keyframes gm-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes gm-rise { from { transform: translateY(0); } to { transform: translateY(calc(-1 * var(--h, 560px) - 140px)); } }
@keyframes gm-pop { to { transform: scale(1.7); opacity: 0; } }
@keyframes gm-swim { to { transform: translate(120px, -40px) rotate(-10deg); opacity: 0; } }
@keyframes gm-grow { from { scale: .2; } 70% { scale: 1.15; } to { scale: 1; } }
@keyframes gm-pulse { 0%, 100% { scale: 1; } 50% { scale: 1.1; } }
@keyframes gm-glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(215, 182, 109, .0); } 50% { box-shadow: 0 0 0 10px rgba(215, 182, 109, .35); } }
@keyframes gm-spin-in { from { transform: rotate(-200deg) scale(0); } to { transform: rotate(0) scale(1); } }
.shake { animation: yk-shake .45s; }
@keyframes yk-shake { 20% { transform: translateX(-7px) rotate(-3deg); } 40% { transform: translateX(7px) rotate(3deg); } 60% { transform: translateX(-5px); } 80% { transform: translateX(4px); } }

/* ------------------------------------------------------------------ the map */
.gm-world { margin: 18px 0 10px; border-radius: 28px; padding: 14px 14px 18px; background:
    radial-gradient(circle at 12% 0, color-mix(in srgb, var(--accent) 22%, #fff) 0, transparent 55%),
    linear-gradient(color-mix(in srgb, var(--accent) 10%, #fff), #fff); box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--accent) 30%, #fff); }
.gm-world header { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.gm-world header h2 { margin: 0; color: var(--emerald); font-size: 1.35rem; }
.gm-world header small { color: #4b5a55; }
.gm-world-emoji { font-size: 2.6rem; animation: gm-float 3s ease-in-out infinite; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .12)); }
.gm-world-count { margin-inline-start: auto; background: var(--accent); color: #fff; font-weight: 800; padding: 4px 12px; border-radius: 99px; white-space: nowrap; }
.gm-path { list-style: none; margin: 0; padding: 6px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.gm-path li { animation: gm-bounce-in .5s both; animation-delay: calc(var(--i) * 70ms); }
.gm-path li:nth-child(even) { margin-top: 12px; }
.gm-node { width: 100%; min-height: 150px; border: 0; cursor: pointer; border-radius: 26px; display: grid; justify-items: center; align-content: center; gap: 4px;
    padding: 12px 8px; font: inherit; color: var(--emerald); background: #fff; box-shadow: 0 7px 0 color-mix(in srgb, var(--accent) 55%, #000 10%), 0 10px 22px rgba(0, 0, 0, .08); transition: transform .15s; }
.gm-node b { font-size: 1rem; line-height: 1.25; }
.gm-node small { color: #6b7a75; }
.gm-node-icon { display: grid; place-items: center; width: 70px; height: 70px; border-radius: 50%; font-size: 2.2rem;
    background: radial-gradient(circle at 35% 30%, #fff, color-mix(in srgb, var(--accent) 45%, #fff)); }
.gm-node.is-open .gm-node-icon { animation: gm-glow 2.2s ease-in-out infinite; }
.gm-node.is-open:hover { transform: translateY(-4px) rotate(-1deg); }
.gm-node:active { transform: translateY(5px); }
.gm-node.is-locked { filter: saturate(.25); opacity: .8; }
.gm-node.is-done { box-shadow: 0 7px 0 #b88e14, 0 0 0 4px var(--gold) inset; }
.gm-stars i, .gm-big-stars i { font-style: normal; color: #d7d3c8; }
.gm-stars i.on { color: #f5b301; text-shadow: 0 2px 0 #b88e14; }
.gm-lock { text-align: center; }
.gm-lock-actions { display: grid; gap: 10px; margin-top: 10px; }
.gm-or { margin: 4px 0; color: #6b7a75; font-weight: 700; }

/* ------------------------------------------------------------------ play screen */
.gm-play { max-width: 980px; margin: 0 auto; display: grid; gap: 8px; }
.gm-hud { display: flex; align-items: center; gap: 10px; margin-inline-start: auto; }
.gm-hud #gm-rounds { display: flex; gap: 5px; }
.gm-hud #gm-rounds i { width: 16px; height: 16px; border-radius: 50%; background: rgba(255, 255, 255, .6); box-shadow: inset 0 0 0 2px var(--accent); }
.gm-hud #gm-rounds i.on { background: var(--gold); box-shadow: 0 0 0 2px #fff; animation: gm-bounce-in .35s; }
.gm-mist { color: #e2574c; font-weight: 800; letter-spacing: 2px; }
.gm-hint { margin: 0; text-align: center; font-weight: 800; font-size: 1.25rem; color: var(--emerald); background: #fff; border-radius: 20px; padding: 10px 14px; box-shadow: 0 5px 0 rgba(18, 60, 50, .1); }
.gm-target { display: inline-grid; place-items: center; min-width: 56px; height: 56px; padding: 0 8px; border-radius: 16px; background: var(--accent); color: #fff; font-size: 2rem; vertical-align: middle; animation: gm-bounce-in .4s; }
.gm-say { border: 0; background: none; font-size: 1.6rem; cursor: pointer; vertical-align: middle; }
.gm-area { position: relative; min-height: min(62vh, 560px); border-radius: 28px; overflow: hidden; background: linear-gradient(#fffaf0, #fff);
    box-shadow: inset 0 0 0 4px color-mix(in srgb, var(--accent) 30%, #fff); padding: 14px; --h: min(62vh, 560px); }
.gm-area.gm-sky { background: linear-gradient(#8fd3ff, #d9f1ff 70%, #bfe7a8); }
.gm-area.gm-water { background: linear-gradient(#5cc6e8, #1f7fb8 85%, #e8c98f 85%); }
.gm-ghost { position: fixed; z-index: 99; pointer-events: none; transform: scale(1.12) rotate(-4deg); filter: drop-shadow(0 12px 12px rgba(0, 0, 0, .25)); }
.is-dragging { opacity: .35; }
.gm-result h2 { margin: 6px 0; }
.gm-big-stars { font-size: 3.6rem; display: flex; justify-content: center; gap: 6px; }
.gm-big-stars i.on { color: #f5b301; text-shadow: 0 4px 0 #b88e14; animation: gm-spin-in .6s both; animation-delay: calc(var(--k) * .25s); }

/* balloons */
.gm-balloon { position: absolute; bottom: -120px; width: 78px; height: 96px; border: 0; cursor: pointer; border-radius: 50% 50% 48% 48%; font: 800 2.1rem "YK Display", sans-serif;
    color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .2); background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, .7), transparent 22%), var(--c);
    box-shadow: inset -8px -10px 0 rgba(0, 0, 0, .12); animation: gm-rise linear forwards; touch-action: manipulation; }
.gm-balloon::after { content: ""; position: absolute; left: 50%; top: 100%; width: 2px; height: 40px; background: rgba(0, 0, 0, .3); }
.gm-balloon.nope { filter: grayscale(1); opacity: .45; }
.gm-balloon.popped { animation: gm-pop .3s forwards !important; }

/* memory cards */
.gm-cards { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 620px; margin: 10px auto; }
.gm-cards-6 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.gm-card { aspect-ratio: 3 / 4; border: 0; padding: 0; background: none; cursor: pointer; perspective: 800px; }
.gm-card-in { position: relative; display: block; width: 100%; height: 100%; transition: transform .45s; transform-style: preserve-3d; }
.gm-card.flip .gm-card-in { transform: rotateY(180deg); }
.gm-card-back, .gm-card-front { position: absolute; inset: 0; border-radius: 20px; backface-visibility: hidden; display: grid; place-items: center; align-content: center;
    box-shadow: 0 6px 0 rgba(0, 0, 0, .15); }
.gm-card-back { background: repeating-linear-gradient(45deg, var(--accent), var(--accent) 12px, color-mix(in srgb, var(--accent) 75%, #fff) 12px 24px); color: #fff; font-size: 2.2rem; }
.gm-card-front { background: #fff; transform: rotateY(180deg); }
.gm-card-front em { font-style: normal; font-size: clamp(2.2rem, 7vw, 3.6rem); }
.gm-card-front small { font-weight: 800; color: var(--emerald); }
.gm-card.matched .gm-card-front { box-shadow: 0 0 0 4px var(--gold), 0 6px 0 #b88e14; }
.gm-card.matched { animation: gm-pulse .45s; }

/* shadows */
.gm-shadow-board { display: grid; grid-template-columns: 1fr 1.6fr; gap: 16px; align-items: start; }
.gm-tray, .gm-holes { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.gm-piece { display: grid; place-items: center; width: 96px; height: 96px; border: 0; border-radius: 24px; background: #fff; cursor: grab; touch-action: none;
    box-shadow: 0 6px 0 color-mix(in srgb, var(--accent) 50%, #000 10%); font: inherit; }
.gm-piece em { font-style: normal; font-size: 3.2rem; line-height: 1; }
.gm-piece small { font-weight: 800; color: var(--emerald); font-size: .85rem; }
.gm-piece.selected { outline: 4px solid var(--gold); }
.gm-piece.placed { visibility: hidden; }
.gm-hole { display: grid; place-items: center; width: 112px; height: 124px; border-radius: 24px; border: 3px dashed color-mix(in srgb, var(--accent) 60%, #fff); background: rgba(255, 255, 255, .7); cursor: pointer; }
.gm-hole em { font-style: normal; font-size: 3.4rem; filter: brightness(0) opacity(.28); transition: filter .4s; }
.gm-hole small { font-weight: 800; color: #6b7a75; font-size: .85rem; }
.gm-hole.filled { border-style: solid; border-color: var(--gold); background: #fffbea; animation: gm-bounce-in .4s; }
.gm-hole.filled em { filter: none; }
@media (max-width: 560px) { .gm-shadow-board { grid-template-columns: 1fr; } .gm-piece { width: 78px; height: 78px; } .gm-hole { width: 92px; height: 104px; } }

/* sort */
.gm-sort { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; min-height: 330px; }
.gm-basket { display: grid; place-items: center; align-content: center; gap: 6px; min-height: 260px; border-radius: 30px; cursor: pointer; color: #fff; font-size: 1.2rem;
    box-shadow: 0 8px 0 rgba(0, 0, 0, .18); transition: transform .2s; }
.gm-basket span { font-size: 2.8rem; }
.gm-basket.land { background: linear-gradient(#f3d58f, #d9a85a); color: #5b3f00; }
.gm-basket.sea { background: linear-gradient(#6fd0f0, #2e86c1); }
.gm-basket.yum { transform: scale(1.08); }
.gm-sort-item { min-width: 110px; display: grid; place-items: center; }
.gm-sort-item .gm-piece { width: 120px; height: 130px; }
.gm-pop-in { animation: gm-grow .4s; }
@media (max-width: 560px) { .gm-sort { grid-template-columns: 1fr 1fr; } .gm-sort-item { grid-column: 1 / -1; order: -1; } .gm-basket { min-height: 160px; } }

/* count */
.gm-count { position: relative; height: min(42vh, 360px); border-radius: 22px; background: linear-gradient(#fff6dc, #ffe9b8); }
.gm-count.is-sea { background: linear-gradient(#8fdcf5, #3fa4d6); }
.gm-thing { position: absolute; left: var(--x); top: var(--y); font-size: clamp(2rem, 6vw, 3rem); animation: gm-grow .45s both, gm-float 2.6s ease-in-out infinite; animation-delay: var(--d), calc(var(--d) + .5s); }
.gm-date { display: inline-block; width: 30px; height: 46px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #c98a52, #6b3a1e 70%); box-shadow: inset -4px -6px 0 rgba(0, 0, 0, .2); }
.gm-numbers { display: flex; justify-content: center; gap: 14px; margin-top: 14px; }
.gm-num { width: 92px; height: 92px; border: 0; border-radius: 50%; cursor: pointer; font: 800 2.6rem "YK Display", sans-serif; color: #fff; background: var(--accent);
    box-shadow: 0 7px 0 color-mix(in srgb, var(--accent) 55%, #000 25%); }
.gm-num.right { background: var(--mint); animation: gm-bounce-in .4s; }

/* build the ayah */
.gm-surah { text-align: center; font-weight: 800; color: var(--emerald); margin: 4px 0 10px; }
.gm-slots { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 14px; border-radius: 22px; background: #fffbea; box-shadow: inset 0 0 0 3px var(--gold); min-height: 76px; }
.gm-slots.done { animation: gm-glow 1s 2; }
.gm-slot { min-width: 70px; min-height: 52px; border-radius: 14px; border: 2px dashed #d5c08a; display: grid; place-items: center; padding: 0 10px; font: 700 1.6rem "Amiri Quran", "KFGQPC Uthmanic Script HAFS", "YK Display", serif; color: var(--emerald); }
.gm-slot.filled { border-style: solid; border-color: var(--mint); background: #e3f6ee; animation: gm-bounce-in .3s; }
.gm-chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 16px 0; }
.gm-chip { border: 0; cursor: pointer; border-radius: 16px; padding: 10px 16px; background: #fff; font: 700 1.7rem "Amiri Quran", "KFGQPC Uthmanic Script HAFS", "YK Display", serif; color: var(--emerald);
    box-shadow: 0 5px 0 color-mix(in srgb, var(--accent) 55%, #000 10%); }
.gm-chip.used { visibility: hidden; }

/* bubbles */
.gm-bubble { position: absolute; bottom: -110px; border: 0; padding: 0; cursor: pointer; border-radius: 50%; display: grid; place-items: center;
    background: radial-gradient(circle at 30% 28%, rgba(255, 255, 255, .95), rgba(255, 255, 255, .25) 30%, rgba(170, 230, 255, .3) 70%, rgba(255, 255, 255, .6));
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .7); animation: gm-rise linear forwards; touch-action: manipulation; }
.gm-bubble em { font-style: normal; font-size: 2rem; }
.gm-bubble.popped { animation: none; background: none; box-shadow: none; }
.gm-bubble.popped em { animation: gm-swim .9s forwards; }

/* maze */
.gm-maze { position: relative; display: grid; grid-template-columns: repeat(var(--n), 1fr); width: min(92vw, 52vh, 460px); aspect-ratio: 1; margin: 6px auto;
    background: #e9f7e4; border-radius: 18px; overflow: hidden; box-shadow: 0 7px 0 rgba(0, 0, 0, .12); --wall: 5px solid #6b4f2e; }
.gm-cell { position: relative; display: grid; place-items: center; cursor: pointer; }
.gm-cell.wn { border-top: var(--wall); } .gm-cell.ws { border-bottom: var(--wall); } .gm-cell.we { border-right: var(--wall); } .gm-cell.ww { border-left: var(--wall); }
.gm-cell.trail { background: rgba(215, 182, 109, .28); }
.gm-cell em { font-style: normal; font-size: calc(min(92vw, 52vh, 460px) / var(--n) * .6); animation: gm-float 2s ease-in-out infinite; }
.gm-hero { position: absolute; left: 0; top: 0; width: calc(100% / var(--n)); height: calc(100% / var(--n)); display: grid; place-items: center; pointer-events: none;
    font-size: calc(min(92vw, 52vh, 460px) / var(--n) * .62); transform: translate(calc(var(--x, 0) * 100%), calc(var(--y, 0) * 100%)); transition: transform .18s; }
.gm-hero i { display: inline-block; font-style: normal; }
.gm-hero.flip i { scale: -1 1; } /* hoopoe faces the way it walks */
.gm-pad { display: grid; grid-template-columns: repeat(3, 70px); grid-template-rows: repeat(2, 62px); gap: 8px; justify-content: center; margin-top: 8px; }
.gm-pad button { border: 0; border-radius: 18px; background: #fff; font-size: 1.8rem; cursor: pointer; box-shadow: 0 5px 0 rgba(0, 0, 0, .15); }
.gm-pad [data-d="n"] { grid-column: 2; } .gm-pad [data-d="w"] { grid-column: 1; grid-row: 2; } .gm-pad [data-d="s"] { grid-column: 2; grid-row: 2; } .gm-pad [data-d="e"] { grid-column: 3; grid-row: 2; }

/* trace */
.gm-trace { display: grid; place-items: center; }
.gm-trace canvas { background: repeating-linear-gradient(#fff, #fff 34px, #eef6f2 35px); border-radius: 26px; box-shadow: inset 0 0 0 4px color-mix(in srgb, var(--accent) 35%, #fff); }
.gm-trace canvas.done { animation: gm-glow 1s 2; }

/* ------------------------------------------------------------------ memorisation check */
.hz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.hz-card { position: relative; border: 0; cursor: pointer; border-radius: 22px; padding: 14px 10px 12px; background: #fff; display: grid; gap: 2px; justify-items: center; font: inherit; color: var(--emerald);
    box-shadow: 0 6px 0 rgba(18, 60, 50, .14); }
.hz-card b { font-size: 1.1rem; }
.hz-card small { color: #6b7a75; }
.hz-card.is-key::before { content: "🎮"; position: absolute; top: 6px; inset-inline-end: 8px; font-size: .9rem; }
.hz-card.is-done { background: linear-gradient(#fffbea, #fff3c4); box-shadow: 0 6px 0 #b88e14, inset 0 0 0 3px var(--gold); }
.hz-num { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--mint); color: #fff; font-weight: 800; }
.hz-check { max-width: 860px; }
.hz-count { text-align: center; font-weight: 800; color: var(--emerald); }
.hz-ayah .yk-ayah-text { line-height: 2.3; }
.hz-blank { display: inline-block; min-width: 90px; padding: 0 10px; border-radius: 12px; background: #fff3c4; box-shadow: inset 0 0 0 2px var(--gold); color: var(--gold-2); text-align: center; }
.hz-blank.filled { color: var(--emerald); background: #e3f6ee; box-shadow: inset 0 0 0 2px var(--mint); animation: gm-bounce-in .3s; }
.hz-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.hz-opt { border: 0; cursor: pointer; border-radius: 20px; padding: 16px 8px; background: #fff; font: 700 1.8rem "Amiri Quran", "KFGQPC Uthmanic Script HAFS", "YK Display", serif; color: var(--emerald);
    box-shadow: 0 6px 0 rgba(18, 60, 50, .18); }
.hz-opt.picked { background: var(--mint); color: #fff; }
@media (max-width: 560px) { .hz-options { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ heroes */
.hr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.hr-card { position: relative; border: 0; cursor: pointer; border-radius: 28px; padding: 18px 14px 16px; display: grid; justify-items: center; gap: 6px; font: inherit; color: var(--emerald);
    background: radial-gradient(circle at 50% 0, color-mix(in srgb, var(--accent) 28%, #fff), #fff 70%); box-shadow: 0 8px 0 color-mix(in srgb, var(--accent) 55%, #000 15%), 0 14px 24px rgba(0, 0, 0, .08);
    animation: gm-bounce-in .5s both; animation-delay: calc(var(--i) * 60ms); transition: transform .15s; }
.hr-card:hover { transform: translateY(-5px) rotate(-.6deg); }
.hr-card b { font-size: 1.05rem; }
.hr-card small { text-align: center; }
.hr-card.is-done { box-shadow: 0 8px 0 #b88e14, inset 0 0 0 4px var(--gold); }
.hr-done { position: absolute; top: 10px; inset-inline-end: 12px; font-style: normal; }
.hr-emblem { position: relative; display: grid; place-items: center; width: 132px; height: 132px; animation: gm-float 3.2s ease-in-out infinite; }
.hr-emblem::before { content: ""; position: absolute; inset: 0; background: conic-gradient(from 0deg, #fff3c4, #d7b66d, #b88f3e, #fff3c4, #d7b66d, #b88f3e, #fff3c4);
    clip-path: polygon(50% 0, 61% 15%, 79% 9%, 82% 27%, 100% 33%, 92% 50%, 100% 67%, 82% 73%, 79% 91%, 61% 85%, 50% 100%, 39% 85%, 21% 91%, 18% 73%, 0 67%, 8% 50%, 0 33%, 18% 27%, 21% 9%, 39% 15%);
    filter: drop-shadow(0 6px 6px rgba(120, 90, 20, .35)); }
.hr-emblem span { position: relative; display: grid; place-items: center; width: 92px; height: 92px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--accent) 60%, #fff), var(--accent));
    color: #fff; font-weight: 800; font-size: .92rem; line-height: 1.15; text-align: center; padding: 6px; box-shadow: inset 0 0 0 4px #fff3c4; text-shadow: 0 2px 2px rgba(0, 0, 0, .3); }
.hr-rule { margin-top: 18px; }
.hr-stage { background: linear-gradient(#bfe6ff, #fff3d6); }
.hr-stage canvas { display: block; width: 100% !important; height: 100% !important; touch-action: pan-y; }
.hr-fallback { position: absolute; inset: 0; display: grid; place-items: center; }
.hr-fallback[hidden] { display: none; }
.hr-tale { font-size: 1.25rem; line-height: 1.9; }
.hr-source { display: block; margin-top: 10px; color: #6b7a75; font-size: .9rem; }
.gm-ghost em, .gm-piece em { pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
    .gm-path li, .hr-card, .gm-world-emoji, .hr-emblem, .gm-thing, .gm-node.is-open .gm-node-icon { animation: none !important; }
}
@media (max-width: 560px) {
    .gm-path { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .gm-node { min-height: 128px; }
    .gm-node-icon { width: 58px; height: 58px; font-size: 1.8rem; }
    .gm-world header { flex-wrap: wrap; }
    .gm-world-count { margin-inline-start: 0; }
}
