/* ألعاب التعلّم (2–6 سنين): كروت كبيرة، ألوان مبهجة، وكل الاتجاهات منطقية عشان العربي والإنجليزي */

/* ---------- كارت الدخول في الرئيسية ---------- */
.kg-entry-wrap { margin: 18px 0; }
.kg-entry { width: 100%; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 14px; border: 0; border-radius: 24px; text-align: start;
  background: linear-gradient(135deg, #FFF1CF, #FBE0E6 55%, #DCEFF9); color: #2E2640; box-shadow: inset 0 -5px 0 #F0A43A, var(--shadow); transition: transform .15s; }
.kg-entry:active { transform: scale(.98); }
.kg-entry-ics { display: grid; grid-template-columns: repeat(2, 46px); gap: 6px; }
.kg-entry-ics i { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: #fff; box-shadow: inset 0 -3px 0 var(--g); }
.kg-entry-ics svg { width: 38px; height: 38px; }
.kg-entry-txt { display: grid; gap: 2px; min-width: 0; }
.kg-entry-txt b { font-family: var(--f-display); font-size: 1.35rem; line-height: 1.2; }
.kg-entry-txt span { font-size: .88rem; color: #6F6578; }
@media (max-width: 520px) {
  .kg-entry { grid-template-columns: auto 1fr; }
  .kg-entry-go { grid-column: 1 / -1; }
}

/* ---------- الطبقة ---------- */
.kg, .kg-play { position: fixed; inset: 0; z-index: 66; display: grid; grid-template-rows: auto 1fr; background: var(--sky); color: var(--ink);
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); animation: kgIn .25s ease-out;
  background-image: radial-gradient(circle at 10% 15%, rgba(255, 200, 61, .18) 0 60px, transparent 61px), radial-gradient(circle at 90% 85%, rgba(46, 143, 191, .12) 0 90px, transparent 91px);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.kg-play { z-index: 67; }
@keyframes kgIn { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: none; } }

.kg-top { display: flex; align-items: center; gap: 10px; padding: 10px max(14px, env(safe-area-inset-left, 0px)); background: var(--paper); border-bottom: 1px solid var(--line); }
.kg-btn { display: grid; place-items: center; width: 48px; height: 48px; flex: none; border-radius: 16px; border: 0; background: var(--soft); color: var(--ink); box-shadow: inset 0 -3px 0 var(--line); }
.kg-btn .ic { width: 26px; height: 26px; }
.kg-btn:active { transform: scale(.94); }
.kg-parent { margin-inline-start: auto; opacity: .75; }
.kg-title { font-family: var(--f-display); font-size: 1.25rem; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kg-me { display: flex; align-items: center; gap: 8px; padding-block: 4px; padding-inline: 4px 14px; border: 0; border-radius: 28px; background: var(--soft); min-width: 0; }
.kg-me b { font-family: var(--f-display); font-size: 1.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 30vw; }
.kg-stars { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 0; border-radius: 24px; background: var(--sun); color: var(--sun-ink); font-family: var(--f-display); font-size: 1.2rem; box-shadow: 0 3px 0 #E0A51A; }
.kg-stars .ic { width: 22px; height: 22px; }
.kg-play .kg-stars { margin-inline-start: auto; }

.kg-main { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.kg-in { max-width: 980px; margin: 0 auto; padding: 18px max(14px, env(safe-area-inset-left, 0px)) 40px; display: grid; gap: 16px; }
.kg-h { font-family: var(--f-display); font-size: 1.7rem; text-align: center; display: flex; gap: 8px; align-items: center; justify-content: center; }
.kg-h .ic { color: var(--sun); width: 28px; height: 28px; }
.kg-h3 { font-family: var(--f-display); font-size: 1.3rem; }

/* صورة كرتونية */
.kg-av { display: inline-grid; place-items: center; flex: none; border-radius: 50%; background: var(--av); overflow: hidden; }
.kg-av svg { width: 92%; height: 92%; }
.kg-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.kg-av.off { background: var(--line); }
.kg-av.off svg, .kg-av.off img { filter: grayscale(1) brightness(1.15); opacity: .35; }

/* ---------- شبكة الألعاب ---------- */
.kg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.kg-tile { position: relative; display: grid; justify-items: center; align-content: center; gap: 8px; min-height: 168px; padding: 16px 8px 18px; border: 0; border-radius: 26px;
  background: var(--paper); box-shadow: inset 0 -6px 0 var(--g), var(--shadow); font-family: var(--f-display); font-size: 1.12rem; line-height: 1.2; text-align: center; transition: transform .15s; }
.kg-tile:active { transform: scale(.95); }
.kg-tile-ic { display: grid; place-items: center; width: 96px; height: 96px; border-radius: 28px; background: var(--soft); background: color-mix(in srgb, var(--g) 14%, var(--paper)); }
.kg-tile.soon .kg-tile-ic { filter: saturate(.55); }
.kg-tile.soon b { opacity: .75; }
.kg-badge { position: absolute; top: 10px; inset-inline-end: 10px; padding: 2px 10px; border-radius: 12px; background: var(--soft); color: var(--muted); font-family: var(--f-body); font-size: .75rem; font-weight: 600; }
.kg-lock { position: absolute; top: 10px; inset-inline-end: 10px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--paper); box-shadow: var(--shadow); color: var(--muted); }
.kg-best { position: absolute; top: 10px; inset-inline-start: 10px; display: flex; color: var(--sun); }
.kg-best .ic { width: 16px; height: 16px; }
.kg-tile.wiggle { animation: kgWiggle .5s; }
@keyframes kgWiggle { 20% { transform: rotate(-4deg); } 40% { transform: rotate(4deg); } 60% { transform: rotate(-3deg); } 80% { transform: rotate(2deg); } }
@media (max-width: 380px) { .kg-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } .kg-tile { min-height: 150px; } .kg-tile-ic { width: 80px; height: 80px; } .kg-tile-ic svg { width: 70px; height: 70px; } }

/* ---------- ترحيب واختيار اللاعب ---------- */
.kg-welcome { display: grid; justify-items: center; gap: 12px; text-align: center; padding: 30px 10px; }
.kg-welcome h2 { font-size: 2rem; }
.kg-welcome p { font-size: 1.1rem; color: var(--muted); max-width: 30ch; }
.kg-faces { display: flex; align-items: flex-end; gap: 4px; animation: kgBob 2.4s ease-in-out infinite; }
@keyframes kgBob { 50% { transform: translateY(-6px); } }
.kg-pick { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; }
.kg-pick-b { display: grid; justify-items: center; gap: 6px; width: 150px; padding: 16px 10px; border: 0; border-radius: 28px; background: var(--paper); box-shadow: var(--shadow); }
.kg-pick-b:active { transform: scale(.95); }
.kg-pick-b b { font-family: var(--f-display); font-size: 1.3rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.kg-pick-b span { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.kg-pick-b .ic { color: var(--sun); }

/* ---------- أصحابي ---------- */
.kg-friends-top { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 18px; border-radius: 26px; background: var(--paper); box-shadow: var(--shadow); }
.kg-bigstar { display: inline-flex; align-items: center; gap: 8px; font-family: var(--f-display); font-size: 2.6rem; line-height: 1; }
.kg-bigstar .ic { width: 52px; height: 52px; color: var(--sun); }
.kg-friends-top p { font-size: 1.05rem; }
.kg-bar { width: min(320px, 100%); height: 16px; border-radius: 10px; background: var(--soft); overflow: hidden; box-shadow: inset 0 0 0 1.5px var(--line); }
.kg-bar span { display: block; height: 100%; background: linear-gradient(90deg, #FFC83D, #F08A3C); border-radius: 10px; transition: width .6s; }
.kg-friends { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
.kg-friend { display: grid; justify-items: center; gap: 6px; padding: 12px 6px; border-radius: 22px; background: var(--paper); box-shadow: var(--shadow); font-family: var(--f-display); }
.kg-friend span { display: inline-flex; align-items: center; gap: 3px; font-size: .95rem; color: var(--muted); }
.kg-friend.on span { color: var(--ink); }
.kg-friend .ic { width: 14px; height: 14px; color: var(--sun); }

/* ---------- منطقة الأهل ---------- */
.kg-card { display: grid; gap: 10px; padding: 16px; border-radius: 20px; background: var(--paper); box-shadow: var(--shadow); -webkit-user-select: text; user-select: text; }
.kg-card h3 { display: flex; align-items: center; gap: 6px; font-size: 1.1rem; }
.kg-card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kg-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.kg-row-t { display: grid; flex: 1; min-width: 0; }
.kg-row-t b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kg-row-t .ic { width: 14px; height: 14px; vertical-align: -2px; color: var(--sun); }
.kg-seg { display: flex; flex-wrap: wrap; gap: 8px; }
.kg-seg button { flex: 1 1 0; min-width: 90px; padding: 10px 12px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--soft); font-weight: 600; }
.kg-seg button.on { background: var(--leaf); color: var(--leaf-ink); border-color: var(--leaf); }
.kg-sync { font-size: .9rem; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.kg-sync.ok { color: var(--good); }
.kg-form { max-width: 560px; width: 100%; margin: 0 auto; }
.kg-lbl { font-weight: 600; font-size: .95rem; }
.kg-input { width: 100%; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--soft); font-size: 1.1rem; -webkit-user-select: text; user-select: text; }
.kg-input:focus { outline: 3px solid var(--sea); outline-offset: 1px; }
.kg-avs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.kg-av-b { display: grid; place-items: center; padding: 6px; border-radius: 20px; border: 3px solid transparent; background: var(--soft); }
.kg-av-b.on { border-color: var(--leaf); background: var(--good-bg); }
.kg-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.kg-actions .btn { flex: 1; }

/* ---------- بوابة الأهل ---------- */
.kg-gate { position: fixed; inset: 0; z-index: 72; display: grid; place-items: center; padding: 16px; background: rgba(15, 22, 36, .6); animation: fade .2s; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.kg-gate-card { position: relative; width: min(420px, 100%); display: grid; gap: 12px; padding: 22px; border-radius: 24px; background: var(--paper); color: var(--ink); text-align: center; }
.kg-gate-card h3 { display: flex; justify-content: center; gap: 8px; align-items: center; }
.kg-gate-x { position: absolute; top: 12px; inset-inline-end: 12px; }
.kg-gate-row { display: flex; padding: 8px 0; }
.kg-spot-s { justify-content: flex-start; } .kg-spot-c { justify-content: center; } .kg-spot-e { justify-content: flex-end; }
.kg-hold { position: relative; width: 120px; height: 120px; border: 0; padding: 0; border-radius: 50%; background: var(--soft); touch-action: none; }
.kg-hold > svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.kg-hold-bg { fill: none; stroke: var(--line); stroke-width: 10; }
.kg-hold-fg { fill: none; stroke: var(--leaf); stroke-width: 10; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; }
.kg-hold-ic { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.kg-hold-ic .ic { width: 38px; height: 38px; }
.kg-hold:not(.on) .kg-hold-fg { opacity: 0; }
.kg-hold.on { transform: scale(.96); }
.kg-hold.on .kg-hold-ic { color: var(--leaf); }

/* ---------- فقاعة الكلام ---------- */
.kg-bubble { position: fixed; inset-inline: 16px; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 85; margin: 0 auto; width: fit-content; max-width: min(520px, calc(100% - 32px));
  padding: 14px 22px; border-radius: 22px; background: #2E2640; color: #fff; font-family: var(--f-display); font-size: 1.3rem; text-align: center; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); animation: kgPop .3s ease-out; transition: opacity .35s, transform .35s; }
.kg-bubble.out { opacity: 0; transform: translateY(12px); }
@keyframes kgPop { from { opacity: 0; transform: translateY(14px) scale(.95); } to { opacity: 1; transform: none; } }

/* ---------- إطار اللعبة والاحتفال ---------- */
.kg-play-body { position: relative; overflow: hidden; display: grid; }
.kg-party { position: fixed; inset: 0; z-index: 76; display: grid; place-items: center; padding: 16px; background: rgba(15, 22, 36, .45); animation: fade .2s; }
.kg-party-card { display: grid; justify-items: center; gap: 10px; width: min(380px, 100%); padding: 24px; border-radius: 28px; background: var(--paper); color: var(--ink); text-align: center; animation: kgPop .35s ease-out; }
.kg-party-t { font-family: var(--f-display); font-size: 2.2rem; line-height: 1; }
.kg-party-stars { display: flex; gap: 6px; }
.kg-party-stars i { color: var(--sun); animation: kgStar .5s both; }
.kg-party-stars .ic { width: 56px; height: 56px; }
@keyframes kgStar { from { transform: scale(0) rotate(-90deg); opacity: 0; } 70% { transform: scale(1.25); } to { transform: none; opacity: 1; } }
.kg-newfriend { display: grid; justify-items: center; gap: 6px; padding: 12px 18px; border-radius: 22px; background: var(--soft); font-family: var(--f-display); }
.kg-newfriend span { color: var(--berry); font-weight: 700; }
.kg-confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.kg-confetti i { position: absolute; top: -20px; left: var(--x); width: 10px; height: 16px; border-radius: 3px; background: var(--c); animation: kgFall 2.2s var(--d) ease-in forwards; }
@keyframes kgFall { to { transform: translateY(110vh) rotate(540deg); } }

@media (prefers-reduced-motion: reduce) {
  .kg, .kg-play, .kg-faces, .kg-confetti i, .kg-party-stars i, .kg-bubble, .kg-tile.wiggle { animation: none !important; }
}

/* =====================================================================
   الألعاب (Phase 2–5)
   ===================================================================== */
.kg-play-body { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.kx { display: flex; flex-direction: column; align-items: center; gap: 16px; width: 100%; max-width: 900px; margin: 0 auto; padding: 14px max(12px, env(safe-area-inset-left, 0px)) 28px; min-height: 100%; }
.kx-head { display: flex; align-items: center; justify-content: center; gap: 14px; width: 100%; min-height: 56px; }
.kx-speak { display: grid; place-items: center; width: 56px; height: 56px; flex: none; border: 0; border-radius: 50%; background: var(--g, var(--sea)); color: #fff; box-shadow: 0 4px 0 rgba(0, 0, 0, .15); }
.kx-speak svg { width: 30px; height: 30px; }
.kx-speak:active { transform: scale(.92); }
.kx-dots { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.kx-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--line); transition: background .3s, transform .3s; }
.kx-dots i.on { background: var(--sun); }
.kx-dots i.now { background: var(--g, var(--sea)); transform: scale(1.25); }
.kx-row { display: flex; justify-content: center; gap: 14px; }
.kx-btn { display: grid; place-items: center; width: 60px; height: 60px; border: 0; border-radius: 20px; background: var(--paper); color: var(--ink); box-shadow: inset 0 -4px 0 var(--line), var(--shadow); }
.kx-btn .ic { width: 28px; height: 28px; }
.kx-btn.kx-main { background: var(--g); color: #fff; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .18); }
.kx-btn:active { transform: scale(.93); }
.kx-opts { display: grid; gap: 14px; width: min(560px, 100%); grid-template-columns: repeat(2, 1fr); }
.kx-opts.kx-n3 { grid-template-columns: repeat(3, 1fr); }
.kx-opts.kx-n4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) { .kx-opts.kx-n4 { grid-template-columns: repeat(4, 1fr); width: min(760px, 100%); } }
.kx-opt { display: grid; place-items: center; aspect-ratio: 1; min-height: 96px; border: 0; border-radius: 28px; background: var(--paper); color: var(--ink); box-shadow: inset 0 -6px 0 var(--line), var(--shadow); font-family: var(--f-display); transition: transform .15s; }
.kx-opt b { font-size: clamp(2.4rem, 11vw, 4rem); line-height: 1; font-weight: 800; }
.kx-opt:active { transform: scale(.94); }
.kx-opt.kx-right { box-shadow: inset 0 0 0 5px #3FA66B, inset 0 -6px 0 #2F8A55, var(--shadow); }
.kx-opt.kx-wrong { opacity: .55; }
.kx-lock .kx-opt { pointer-events: none; }
.kx-shake { animation: kxShake .45s; }
@keyframes kxShake { 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(4px); } }
.kx-pop { animation: kxPop .45s; }
@keyframes kxPop { 40% { transform: scale(1.15); } }
.kx-hint { animation: kxHint 1.2s ease-in-out 2; }
@keyframes kxHint { 50% { transform: scale(1.12); filter: drop-shadow(0 0 10px rgba(255, 200, 61, .95)); } }
.kx-drag { z-index: 30; position: relative; cursor: grabbing; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .25)); }
.kx-over { outline: 4px dashed var(--sun); outline-offset: 3px; }

/* أحرف أ ب ت */
.abc-slots { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.abc-slot { position: relative; display: grid; place-items: center; width: clamp(78px, 21vw, 120px); aspect-ratio: 1; border-radius: 24px; border: 3px dashed var(--line); background: var(--soft); }
.abc-ghost { font-family: var(--f-display); font-size: clamp(2.6rem, 12vw, 4.4rem); font-weight: 800; color: var(--ink); opacity: .16; line-height: 1; }
.abc-pic { position: absolute; bottom: -12px; inset-inline-end: -8px; font-style: normal; font-size: 1.7rem; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .15)); }
.abc-slot.full { border-style: solid; border-color: transparent; }
.abc-slot.full .abc-ghost { display: none; }
.abc-slot.full .abc-tile { position: absolute; inset: 0; width: auto; height: auto; }
.abc-tray { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; padding: 16px; border-radius: 28px; background: color-mix(in srgb, var(--g) 10%, transparent); min-height: 120px; width: min(640px, 100%); }
.abc-tile { display: grid; place-items: center; width: clamp(74px, 20vw, 110px); aspect-ratio: 1; border: 0; border-radius: 24px; background: var(--c); color: #fff; box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .18); font-family: var(--f-display); }
.abc-tile b { font-size: clamp(2.4rem, 11vw, 4rem); line-height: 1; font-weight: 800; text-shadow: 0 2px 0 rgba(0, 0, 0, .12); }

/* اكتب الحرف */
.tr-name { font-family: var(--f-display); font-size: 1.6rem; }
.tr-wrap { position: relative; width: min(520px, 92vw); aspect-ratio: 1; max-height: 58vh; border-radius: 30px; background: var(--paper); box-shadow: var(--shadow); overflow: hidden; }
.tr-cv { display: block; touch-action: none; }

/* أصوات الحروف */
.snd-big { display: grid; place-items: center; width: 130px; height: 130px; border: 0; border-radius: 50%; background: var(--g); color: #fff; box-shadow: 0 8px 0 rgba(0, 0, 0, .15); animation: kgBob 2.4s ease-in-out infinite; }
.snd-big svg { width: 66px; height: 66px; }
.snd-opt { background: var(--c); color: #2E2640; box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .15); border-radius: 50%; }

/* كروت الذاكرة */
.mem-grid { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 12px; width: min(560px, 100%); }
.mem-card { aspect-ratio: 3 / 4; border: 0; padding: 0; background: none; }
.mem-in { position: relative; display: block; width: 100%; height: 100%; }
.mem-card.up .mem-in, .mem-card.got .mem-in { animation: memFlip .35s ease-out; }
@keyframes memFlip { 0% { transform: scaleX(1); } 50% { transform: scaleX(0); } 100% { transform: scaleX(1); } }
.mem-back, .mem-front { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 20px; }
.mem-back { background: var(--g); color: rgba(255, 255, 255, .85); box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .18); background-image: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .25) 0 12px, transparent 13px); }
.mem-back .ic { width: 40%; height: 40%; }
.mem-front { visibility: hidden; background: var(--paper); box-shadow: var(--shadow); font-size: clamp(2.4rem, 12vw, 3.8rem); }
.mem-card.up .mem-front, .mem-card.got .mem-front { visibility: visible; }
.mem-card.up .mem-back, .mem-card.got .mem-back { visibility: hidden; }
.mem-card.got .mem-front { box-shadow: inset 0 0 0 4px #3FA66B, var(--shadow); }

/* نعدّ سوا */
.cnt-field { display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: 10px; width: min(620px, 100%); min-height: 180px; padding: 16px; border-radius: 28px; background: var(--paper); box-shadow: var(--shadow); }
.cnt-item { position: relative; border: 0; background: none; padding: 4px; transform: rotate(var(--r)); font-size: clamp(2.6rem, 12vw, 3.6rem); line-height: 1; }
.cnt-many .cnt-item { font-size: clamp(2.1rem, 9vw, 3rem); }
.cnt-item i { position: absolute; top: -6px; inset-inline-end: -6px; display: none; place-items: center; min-width: 30px; height: 30px; padding: 0 6px; border-radius: 15px; background: var(--sun); color: var(--sun-ink); font: 800 1.05rem/1 var(--f-display); font-style: normal; box-shadow: 0 2px 0 #E0A51A; }
.cnt-item.on i { display: grid; }
.cnt-item.on span { filter: saturate(1.2); }

/* ألوان وأشكال */
.col-q { display: grid; place-items: center; min-height: 48px; }
.col-dot { display: block; width: 42px; height: 42px; border-radius: 50%; box-shadow: 0 0 0 4px var(--paper), 0 0 0 6px var(--line); }
.col-opt svg { width: 72%; height: 72%; }

/* بازل */
.jg-board { position: relative; display: grid; grid-template-columns: repeat(var(--cols), 1fr); grid-template-rows: repeat(var(--rows), 1fr); width: min(520px, 92vw); aspect-ratio: 1 / 1; border-radius: 20px; overflow: hidden; background: var(--soft); box-shadow: var(--shadow); }
.jg-ghost { position: absolute; inset: 0; background-size: cover; opacity: .18; filter: grayscale(1); }
.jg-cell { position: relative; border: 1.5px dashed rgba(46, 38, 64, .2); }
.jg-cell.full { border-color: transparent; }
.jg-cell .jg-piece { position: absolute; inset: 0; width: auto; height: auto; border-radius: 0; box-shadow: none; }
.jg-board.done { box-shadow: 0 0 0 5px #3FA66B, var(--shadow); }
.jg-tray { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; width: min(520px, 92vw); }
.jg-piece { width: calc(min(520px, 92vw) / var(--cols) * .8); aspect-ratio: calc(1 * var(--rows)) / calc(1 * var(--cols)); border-radius: 12px; box-shadow: 0 4px 10px rgba(0, 0, 0, .2); background-repeat: no-repeat; }

/* كمّل الناقص */
.gp-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.gp-box { display: grid; place-items: center; width: clamp(62px, 17vw, 96px); aspect-ratio: 1; border-radius: 20px; background: var(--paper); box-shadow: var(--shadow); font: 800 clamp(2rem, 9vw, 3.2rem)/1 var(--f-display); }
.gp-miss { border: 3px dashed var(--g); background: var(--soft); color: var(--g); animation: kgBob 2s ease-in-out infinite; }
.gp-filled { box-shadow: inset 0 0 0 4px #3FA66B, var(--shadow); }
.gp-dot { display: block; width: 62%; aspect-ratio: 1; border-radius: 50%; }
.gp-opt .gp-dot { width: 52%; }

/* رتّب وفرز */
.so-field { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; width: min(620px, 100%); min-height: 120px; }
.so-item { display: grid; place-items: center; width: 84px; height: 84px; border-radius: 22px; background: var(--paper); box-shadow: var(--shadow); touch-action: none; }
.so-emo { font-size: 3rem; line-height: 1; }
.so-emo.big { font-size: 3.4rem; } .so-emo.small { font-size: 1.6rem; }
.so-bins { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: min(620px, 100%); margin-top: auto; }
.so-bin { display: grid; grid-template-rows: auto 1fr; gap: 6px; min-height: 170px; padding: 10px; border-radius: 0 0 30px 30px; background: color-mix(in srgb, var(--b) 18%, var(--paper)); box-shadow: inset 0 -8px 0 var(--b), inset 0 0 0 3px color-mix(in srgb, var(--b) 45%, transparent); }
.so-bin-cue { display: grid; place-items: center; }
.so-cue { font-size: 2.2rem; line-height: 1; } .so-cue.big { font-size: 2.8rem; } .so-cue.small { font-size: 1.3rem; }
.so-bin-in { display: flex; flex-wrap: wrap; align-content: flex-end; justify-content: center; gap: 4px; }
.so-bin-in .so-item { width: 50px; height: 50px; border-radius: 14px; box-shadow: none; background: rgba(255, 255, 255, .7); }
.so-bin-in .so-emo { font-size: 1.8rem; } .so-bin-in .so-emo.small { font-size: 1.1rem; }
.so-bin-in svg { width: 38px; height: 38px; }

/* الأرقام المستخبية */
.hd-field { position: relative; width: min(640px, 100%); aspect-ratio: 5 / var(--rows); max-height: 64vh; border-radius: 28px; overflow: hidden;
  background: linear-gradient(#DFF3FF, #E9F8E4 70%, #CDEBB8); box-shadow: var(--shadow); }
:root[data-theme="dark"] .hd-field { background: linear-gradient(#1D3250, #1F3A2C 70%, #23452E); }
.hd-num, .hd-clut { position: absolute; transform: translate(-50%, -50%) rotate(var(--r)) scale(var(--s)); line-height: 1; }
.hd-num { border: 0; background: none; padding: 6px; font: 800 2.4rem/1 var(--f-display); opacity: .82; text-shadow: 0 0 2px rgba(255, 255, 255, .8); }
.hd-num.got { opacity: 1; z-index: 2; }
.hd-num.got::after { content: ""; position: absolute; inset: -4px; border: 4px solid #3FA66B; border-radius: 50%; }
.hd-clut { font-size: 2.2rem; }
.hd-num.kx-shake, .hd-clut.kx-shake { animation: kxShakeAbs .45s; }
@keyframes kxShakeAbs { 30% { transform: translate(-58%, -50%) rotate(var(--r)) scale(var(--s)); } 60% { transform: translate(-42%, -50%) rotate(var(--r)) scale(var(--s)); } }
.hd-num.kx-hint { animation: kxHintAbs 1.2s ease-in-out 2; }
@keyframes kxHintAbs { 50% { transform: translate(-50%, -50%) rotate(0) scale(1.6); opacity: 1; } }

/* لوّن */
.cl-wrap { width: min(460px, 88vw); aspect-ratio: 1; max-height: 52vh; border-radius: 28px; background: #fff; box-shadow: var(--shadow); padding: 8px; }
.cl-svg { width: 100%; height: 100%; display: block; }
.cl-svg .rg { fill: #fff; stroke: #2E2640; stroke-width: 3.5; stroke-linejoin: round; cursor: pointer; transition: fill .2s; }
.cl-svg .ln { fill: none; stroke: #2E2640; stroke-width: 3; stroke-linecap: round; pointer-events: none; }
.cl-svg .ln.dot { fill: #2E2640; }
.cl-pal { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; width: min(520px, 100%); }
.cl-c { width: 46px; height: 46px; border-radius: 50%; border: 3px solid var(--paper); background: var(--c); box-shadow: 0 0 0 2px var(--line); transition: transform .15s; }
.cl-c.on { transform: scale(1.2); box-shadow: 0 0 0 3px var(--ink); }
.cl-c.eraser { background: repeating-linear-gradient(45deg, #fff 0 6px, #EEE 6px 12px); }

/* أغاني */
.sg-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; width: 100%; }
.sg-card { display: grid; justify-items: center; gap: 8px; padding: 18px 10px; border: 0; border-radius: 26px; background: var(--paper); box-shadow: inset 0 -6px 0 var(--g), var(--shadow); font-family: var(--f-display); font-size: 1.15rem; }
.sg-card .ic { color: var(--g); width: 28px; height: 28px; }
.sg-pic { font-size: 3.2rem; line-height: 1; }
.sg-stage { display: grid; justify-items: center; gap: 14px; width: 100%; }
.sg-dance { display: flex; align-items: flex-end; gap: 6px; }
.sg-big { font-size: 3.4rem; line-height: 1; }
.sg-pic, .sg-big { font-family: var(--f-display); font-weight: 800; white-space: nowrap; color: var(--g); }
.sg-stage.playing .sg-dance > * { animation: kgBob .9s ease-in-out infinite; }
.sg-stage.playing .sg-dance > *:nth-child(2) { animation-delay: .3s; }
.sg-stage.playing .sg-dance > *:nth-child(3) { animation-delay: .15s; }
.sg-lines { list-style: none; margin: 0; padding: 14px; display: grid; gap: 6px; width: min(560px, 100%); border-radius: 24px; background: var(--paper); box-shadow: var(--shadow); text-align: center; -webkit-user-select: text; user-select: text; }
.sg-lines li { padding: 6px 10px; border-radius: 14px; font: 600 1.2rem/1.5 var(--f-display); color: var(--muted); transition: background .3s, color .3s, transform .3s; }
.sg-lines li.on { background: var(--g); color: #fff; transform: scale(1.04); }
.sg-lines li.past { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .snd-big, .gp-miss, .sg-stage.playing .sg-dance > *, .kx-hint, .hd-num.kx-hint { animation: none !important; }
}

/* ---------- 15 لعبة زيادة ---------- */
.mg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (min-width: 640px) { .mg-grid { grid-template-columns: repeat(5, 1fr); } }
.mg-tile { position: relative; display: grid; justify-items: center; gap: 4px; border: 0; border-radius: 20px; padding: 12px 6px 10px; background: var(--paper); color: var(--ink); box-shadow: 0 4px 0 color-mix(in srgb, var(--g) 60%, #000 0%), 0 6px 16px rgba(0,0,0,.08); border-top: 6px solid var(--g); cursor: pointer; }
.mg-tile:active { transform: translateY(2px); }
.mg-tile-e { font-size: 34px; line-height: 1.1; }
.mg-tile b { font-size: .85rem; text-align: center; line-height: 1.3; }
.mg-tile.locked { opacity: .6; }
.mg-tile .lk { position: absolute; top: 6px; inset-inline-end: 6px; width: 20px; height: 20px; }
.ln-emo { font-size: 40px; display: grid; place-items: center; }
.mg-em { display: inline-block; line-height: 1; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.mg-head { display: grid; justify-items: center; gap: 6px; margin: 4px 0 12px; }
.mg-word { font-size: 1.3rem; }
.mg-shadow .mg-em { filter: brightness(0) opacity(.75); }
.mg-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: center; background: var(--paper); border-radius: 18px; padding: 10px 14px; }
.mg-qm { font-size: 36px; font-weight: 800; color: var(--g, #8B6CC9); width: 44px; height: 44px; border-radius: 12px; border: 3px dashed currentColor; display: grid; place-items: center; }
.mg-opts { flex-wrap: wrap; }
.mg-opt { display: grid; justify-items: center; gap: 4px; min-width: 96px; min-height: 96px; }
.mg-opt small { font-size: .85rem; font-weight: 700; }
.mg-txt { font-size: 1.05rem; padding: 6px 10px; }
.mg-score { font-size: 1.1rem; }
.mg-goal { font-weight: 700; font-size: .95rem; }
.mg-area { position: relative; width: min(100%, 560px); height: min(62vh, 520px); margin: 8px auto 0; border-radius: 24px; background: linear-gradient(#DFF2FB, #F6FBFF); overflow: hidden; touch-action: none; }
[data-theme="dark"] .mg-area { background: linear-gradient(#1D2B44, #23324F); }
.mg-bub { position: absolute; bottom: -110px; border-radius: 50%; border: 0; background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.95), rgba(160,215,255,.55) 45%, rgba(120,190,245,.35)); box-shadow: inset 0 0 0 2px rgba(255,255,255,.7), 0 4px 12px rgba(0,80,140,.15); font-size: 30px; animation: mgUp linear forwards; cursor: pointer; }
.mg-bub.pop { animation: mgPop .3s ease forwards; }
@keyframes mgUp { to { transform: translateY(calc(-1 * (min(62vh, 520px) + 140px))); } }
@keyframes mgPop { to { transform: scale(1.6); opacity: 0; } }
.mg-holes { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; padding: 18px; align-content: center; }
.mg-h6 { grid-template-columns: repeat(3, 1fr); }
.mg-hole { position: relative; aspect-ratio: 1.3; border: 0; border-radius: 50%; background: radial-gradient(ellipse at 50% 70%, #6B4A2E 55%, #8C6440 56%); overflow: hidden; cursor: pointer; }
.mg-hole span { position: absolute; left: 50%; bottom: -60%; transform: translateX(-50%); font-size: 46px; transition: bottom .18s ease; }
.mg-hole.up span { bottom: 18%; }
.mg-hole.hit { box-shadow: 0 0 0 5px #FFC83D; }
.mg-basket { position: absolute; bottom: 4%; left: 50%; transform: translateX(-50%); font-size: 64px; transition: left .08s linear; pointer-events: none; }
.mg-fruit { position: absolute; top: -8%; transform: translateX(-50%); font-size: 40px; pointer-events: none; }
.mg-keys { position: absolute; inset: 16px 16px 76px; display: flex; gap: 8px; }
.mg-key { flex: 1; border: 0; border-radius: 0 0 18px 18px; background: var(--c); box-shadow: inset 0 -10px 0 rgba(0,0,0,.18); cursor: pointer; transition: transform .1s, filter .1s; }
.mg-key.on, .mg-key:active { transform: translateY(6px); filter: brightness(1.25); box-shadow: 0 0 22px var(--c); }
.mg-again { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); }
.mg-maze { --n: 5; position: absolute; top: 14px; left: 50%; transform: translateX(-50%); width: min(86%, 46vh); aspect-ratio: 1; display: grid; grid-template-columns: repeat(var(--n), 1fr); background: #FFF8E7; border-radius: 12px; padding: 4px; touch-action: none; }
.mg-maze i { display: grid; place-items: center; font-style: normal; font-size: calc(min(86vw, 46vh) / var(--n) * .55); border: 3px solid transparent; }
.mg-maze i.bn { border-top-color: #6B4A2E; } .mg-maze i.be { border-right-color: #6B4A2E; } .mg-maze i.bs { border-bottom-color: #6B4A2E; } .mg-maze i.bw { border-left-color: #6B4A2E; }
.mg-pad { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); display: grid; grid-template-columns: repeat(3, 52px); grid-template-rows: repeat(2, 52px); gap: 6px; }
.mg-pad button { border: 0; border-radius: 14px; background: var(--paper, #fff); font-size: 26px; box-shadow: 0 3px 0 rgba(0,0,0,.15); cursor: pointer; }
.mg-pad [data-d="n"] { grid-column: 2; grid-row: 1; } .mg-pad [data-d="w"] { grid-column: 1; grid-row: 2; } .mg-pad [data-d="s"] { grid-column: 2; grid-row: 2; } .mg-pad [data-d="e"] { grid-column: 3; grid-row: 2; }

/* ===== البيانو ===== */
.pn-modes { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 6px 0; }
.pn-mode { display: flex; align-items: center; gap: 6px; border: 0; border-radius: 99px; padding: 8px 14px; background: #fff; color: #2E2640; font: 700 .95rem var(--f-body, inherit); box-shadow: 0 3px 0 rgba(0,0,0,.12); }
.pn-mode span { font-size: 1.2rem; }
.pn-mode.on { background: #7C5CC4; color: #fff; }
.pn-panel { display: grid; justify-items: center; gap: 8px; min-height: 78px; margin: 4px auto 8px; width: min(100%, 560px); }
.pn-tip { margin: 0; font-weight: 600; text-align: center; }
.pn-songs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.pn-prog { width: 80%; height: 8px; border-radius: 99px; background: rgba(0,0,0,.1); overflow: hidden; }
.pn-prog i { display: block; height: 100%; width: 0; background: #7C5CC4; transition: width .2s; }
.pn-demo, .pn-again { padding: 8px 18px; min-height: 0; }
.pn-piano { --n: 8; position: relative; width: min(100%, 560px); height: min(46vh, 300px); margin: 0 auto; padding: 14px 10px 10px; border-radius: 22px 22px 18px 18px; background: linear-gradient(#3A2A55, #22183A); box-shadow: 0 14px 30px rgba(0,0,0,.3), inset 0 3px 0 rgba(255,255,255,.12); touch-action: none; user-select: none; -webkit-user-select: none; }
.pn-piano::before { content: ""; position: absolute; inset: 0 0 auto; height: 10px; border-radius: 22px 22px 0 0; background: linear-gradient(90deg, #E2453C, #FFC83D, #3FA66B, #2E8FBF, #8B6CC9); opacity: .9; }
.pn-whites { display: flex; height: 100%; gap: 3px; }
.pn-w { position: relative; flex: 1; border: 0; border-radius: 0 0 12px 12px; background: linear-gradient(#FFFFFF 70%, #EDEAF2); box-shadow: inset 0 -6px 0 #D8D3E2, 0 2px 0 rgba(0,0,0,.25); display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; padding-bottom: 10px; color: #2E2640; transition: transform .06s, background .06s; }
.pn-w[hidden] { display: none; }
.pn-w b { font-size: clamp(.75rem, 3.4vw, 1rem); font-family: var(--f-display, inherit); }
.pn-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--c); box-shadow: 0 2px 0 rgba(0,0,0,.15); }
.pn-w.down { transform: translateY(3px); background: linear-gradient(color-mix(in srgb, var(--c) 30%, #fff), #EDEAF2); box-shadow: inset 0 -2px 0 #D8D3E2; }
.pn-w.show { background: color-mix(in srgb, var(--c) 55%, #fff); }
.pn-w.next { animation: pnNext 1s infinite; }
.pn-w.next .pn-dot { transform: scale(1.35); }
@keyframes pnNext { 0%, 100% { box-shadow: inset 0 -6px 0 #D8D3E2, 0 0 0 0 var(--c); } 50% { box-shadow: inset 0 -6px 0 #D8D3E2, 0 0 0 6px var(--c); } }
.pn-b { position: absolute; top: 14px; height: 58%; width: calc((100% - 20px) / var(--n) * .6); left: calc(10px + (100% - 20px) / var(--n) * var(--x) - (100% - 20px) / var(--n) * .3); border: 0; border-radius: 0 0 8px 8px; background: linear-gradient(#3B3346, #121016); box-shadow: inset 0 -5px 0 #000, 0 3px 4px rgba(0,0,0,.35); z-index: 2; }
.pn-b[hidden] { display: none; }
.pn-b.down { background: linear-gradient(#5B4E6E, #241E2C); height: 57%; }

/* لمسة الطفل: حركة صغيرة مع الصوت */
.kv-tap { animation: kvTap .35s ease; }
@keyframes kvTap { 0% { transform: scale(1); } 35% { transform: scale(.93); } 70% { transform: scale(1.05); } 100% { transform: scale(1); } }

/* المتاهة: كل المربعات بنفس المقاس دايماً (السلحفاة ماتكبّرش الشكل وهي بتتحرك) */
.mg-maze { container-type: inline-size; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); grid-template-rows: repeat(var(--n), minmax(0, 1fr)); box-sizing: border-box; box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.mg-maze i { min-width: 0; min-height: 0; overflow: hidden; line-height: 1; box-sizing: border-box; font-size: calc((100cqw - 8px) / var(--n) * .58); }
@supports not (container-type: inline-size) { .mg-maze i { font-size: calc(min(86vw, 46vh) / var(--n) * .5); } }
.mg-maze i.tr { background: radial-gradient(circle, #8FD19E 0 22%, rgba(143,209,158,.35) 23% 100%); }
.mg-maze .mz-me { font-weight: normal; display: block; filter: drop-shadow(0 2px 2px rgba(0,0,0,.2)); }
.mz-tip { position: absolute; left: 0; right: 0; bottom: 132px; margin: 0; text-align: center; font-size: .9rem; color: var(--muted, #6F6578); font-weight: 600; }
.cl-lv { font-family: var(--f-display); font-size: 1.05rem; color: var(--ink); background: var(--soft); border-radius: 99px; padding: 4px 14px; }
