/* Colouring book, word search, memory match */
.hidden { display: none !important; }

/* colouring */
.cl-name { text-align: center; margin: 4px 0 10px; font-size: 1.3rem; }
.cl-canvas { max-width: 460px; margin: 0 auto; background: #fff; border-radius: 22px; border: 3px solid var(--line); overflow: hidden; touch-action: manipulation; }
.cl-canvas svg { display: block; width: 100%; height: auto; }
.cl-canvas .r, .cl-thumb .r { stroke: #1d2340; stroke-width: 3; stroke-linejoin: round; fill: #fff; cursor: pointer; transition: fill .15s; }
.cl-palette { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; max-width: 460px; margin: 14px auto 6px; }
.cl-swatch { aspect-ratio: 1; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--line); cursor: pointer; }
.cl-swatch[aria-pressed="true"] { box-shadow: 0 0 0 4px var(--night); transform: scale(1.08); }
.cl-pick { text-align: center; font-size: 1.05rem; margin: 18px 0 8px; }
.cl-pics { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.cl-thumb { background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 6px; cursor: pointer; font: inherit; font-weight: 700; font-size: .85rem; color: var(--ink); }
.cl-thumb svg { display: block; width: 100%; height: auto; pointer-events: none; }
.cl-thumb .r { stroke-width: 6; cursor: inherit; }
.cl-thumb[aria-pressed="true"] { border-color: var(--green); box-shadow: 0 0 0 2px var(--green); }

/* word search */
.ws-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-weight: 800; margin-bottom: 10px; }
.ws-grid { --n: 8; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 4px; max-width: 440px; margin: 0 auto; touch-action: none; user-select: none; -webkit-user-select: none; }
.ws-cell { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; background: #fff; border: 2px solid var(--line); border-radius: 10px; font-weight: 800; font-size: clamp(1rem, 4.6vw, 1.45rem); cursor: pointer; color: var(--ink); }
html[lang="ar"] .ws-cell, html[lang="ur"] .ws-cell { font-family: var(--arabic); font-size: clamp(1rem, 4.8vw, 1.6rem); line-height: 1; overflow: hidden; }
.ws-cell.sel { background: #ffe8a3; border-color: var(--gold); }
.ws-cell.found { background: #c8f0dd; border-color: var(--green); color: var(--green-dark); }
.ws-hint { text-align: center; color: var(--ink-soft); font-size: .92rem; margin: 10px 0; }
.ws-words { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 0; list-style: none; }
.ws-words li { background: #fff; border: 2px solid var(--line); border-radius: 999px; padding: 4px 12px; font-weight: 800; }
html[lang="ar"] .ws-words li, html[lang="ur"] .ws-words li { font-family: var(--arabic); font-size: 1.2rem; }
.ws-words li.found { background: #c8f0dd; border-color: var(--green); text-decoration: line-through; }
.ws-done { text-align: center; font-weight: 800; font-size: 1.1rem; color: var(--green-dark); }

/* memory match */
.mm-controls { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 8px; }
.mm-moves { text-align: center; font-weight: 800; margin: 6px 0 10px; }
.mm-board { display: grid; gap: 10px; max-width: 460px; margin: 0 auto; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mm-card { aspect-ratio: 3 / 4; position: relative; border: 0; border-radius: 16px; cursor: pointer; background: transparent; padding: 0; perspective: 600px; }
.mm-card span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; border-radius: 16px; backface-visibility: hidden; transition: transform .35s; }
.mm-back { background: var(--night); color: var(--gold); font-size: 1.6rem; box-shadow: inset 0 0 0 3px rgba(255,255,255,.15); }
.mm-face { background: #fff; border: 3px solid var(--line); font-size: clamp(1.8rem, 9vw, 2.8rem); transform: rotateY(180deg); }
.mm-face.arabic { font-family: var(--arabic); color: var(--night); }
.mm-card.open .mm-back, .mm-card.matched .mm-back { transform: rotateY(180deg); }
.mm-card.open .mm-face, .mm-card.matched .mm-face { transform: rotateY(360deg); }
.mm-card.matched .mm-face { border-color: var(--green); background: #e3f6ee; }
.mm-done { text-align: center; }
.mm-done .stars-row { font-size: 2rem; color: var(--gold); }

.cl-name::first-letter { text-transform: uppercase; }

/* ---------- My Stars ---------- */
.ms h2 { font-size: 1.25rem; margin: 0 0 10px; }
.ms-top { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.ms-balance { background: var(--night); color: #ffd166; border-radius: 22px; padding: 12px 18px; display: flex; align-items: center; gap: 8px; font-size: 1.8rem; font-weight: 800; font-family: "Baloo 2", system-ui, sans-serif; }
.ms-level { flex: 1; min-width: 200px; }
.ms-level small { display: block; color: var(--ink-soft); }
.ms-level b { font-size: 1.3rem; }
.ms-bar { height: 12px; background: #eee4d0; border-radius: 999px; overflow: hidden; margin: 6px 0; }
.ms-bar i { display: block; height: 100%; background: linear-gradient(90deg, #ffd166, #2fb67c); border-radius: 999px; transition: width .4s; }
.ms-today, .ms-bricks, .ms-built, .ms-small { color: var(--ink-soft); font-size: .95rem; text-align: center; margin: 8px 0 0; }
.ms-masjid { max-width: 460px; margin: 0 auto; border-radius: 22px; overflow: hidden; border: 3px solid var(--line); }
.ms-masjid svg { display: block; width: 100%; height: auto; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-top: 10px; }
.shop-item { display: flex; flex-direction: column; align-items: center; gap: 2px; background: #fff; border: 2px solid var(--line); border-radius: 18px; padding: 12px 8px; cursor: pointer; font: inherit; color: var(--ink); }
.shop-item .ic { font-size: 1.8rem; }
.shop-item small { color: var(--ink-soft); font-weight: 700; }
.shop-item.owned { background: #e3f6ee; border-color: var(--green); cursor: default; }
/* ===== Small games (minigames.js) ===== */
.mg { min-height: 320px; }
.mg-prompt { text-align: center; font-weight: 800; font-size: 1.15rem; margin: 6px 0 12px; }
.mg-fb { min-height: 48px; text-align: center; color: var(--ink-soft); margin: 10px 0 0; }
.mg-fb b { color: var(--green-dark); }
.mg-small { text-align: center; color: var(--ink-soft); font-weight: 700; margin: 4px 0 10px; }
.mg-emo { font-size: 1.7rem; line-height: 1; flex: none; }
.mg-ar { font-family: var(--arabic); direction: rtl; font-weight: 400; }
.mg-shake { animation: shake .35s; }
.mg-ok { background: #e3f6ee !important; border-color: var(--green) !important; }
.mg-no { background: #fde9e7 !important; border-color: var(--rose) !important; opacity: .7; }
.mg-done { text-align: center; padding: 20px 6px; }
.mg-done .stars-row { font-size: 2.4rem; color: var(--gold); letter-spacing: 4px; }
.mg-controls { display: grid; gap: 4px; margin-bottom: 6px; }
/* order */
.mg-order-done { list-style: none; counter-reset: s; padding: 0; margin: 0 0 6px; display: grid; gap: 6px; }
.mg-order-done li { counter-increment: s; display: flex; align-items: center; gap: 10px; background: #e3f6ee; border: 2px solid var(--green); border-radius: 14px; padding: 8px 12px; font-weight: 700; }
.mg-order-done li::before { content: counter(s); flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center; font-size: .9rem; }
.mg-pool { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 8px; }
.mg-step, .mg-opt, .mg-big, .mg-card, .mg-food { font: inherit; color: var(--ink); background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 10px 12px; cursor: pointer; display: flex; align-items: center; gap: 10px; text-align: start; font-weight: 700; transition: transform .12s, border-color .12s; }
.mg-step:hover, .mg-opt:hover:not(:disabled), .mg-card:hover:not(:disabled), .mg-food:hover:not(:disabled) { border-color: var(--gold); transform: translateY(-2px); }
.mg-hint { border-color: var(--gold); box-shadow: 0 0 0 4px #ffe7a6; animation: mgPulse 1s infinite; }
@keyframes mgPulse { 50% { box-shadow: 0 0 0 8px #fff3cc; } }
/* bubbles */
.mg-bub-top { display: flex; gap: 10px; align-items: stretch; margin-bottom: 10px; }
.mg-target { flex: 1; color: #fff; border-radius: 18px; padding: 8px 14px; display: grid; text-align: center; }
.mg-target .mg-ar { font-size: 1.8rem; line-height: 1.5; }
.mg-target small { opacity: .9; }
.mg-count { flex: none; min-width: 84px; background: var(--night); color: #ffd166; border-radius: 18px; display: grid; place-content: center; text-align: center; padding: 6px 10px; }
.mg-count b { font-size: 1.5rem; } .mg-count small { color: #c7d0f2; font-size: .75rem; }
.mg-sky { position: relative; height: 380px; overflow: hidden; border-radius: 22px; background: linear-gradient(180deg, #e8f4ff, #c9e6ff); touch-action: manipulation; }
.mg-bubble { position: absolute; bottom: -120px; width: 104px; height: 104px; border-radius: 50%; border: 0; cursor: pointer; color: #fff; font: inherit; padding: 6px;
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,.75) 0 10%, transparent 11%), radial-gradient(circle at 50% 50%, var(--c) 0 60%, color-mix(in srgb, var(--c) 70%, #000) 100%);
  background-color: var(--c); box-shadow: 0 6px 16px rgba(0,0,0,.18); display: grid; place-content: center; text-align: center; animation: mgRise linear forwards; }
.mg-bubble .mg-ar { font-size: 1.15rem; line-height: 1.4; } .mg-bubble small { font-size: .7rem; font-weight: 700; }
.mg-bubble.pop { animation: mgPop .25s forwards !important; }
@keyframes mgRise { to { transform: translateY(-540px); } }
@keyframes mgPop { to { transform: scale(1.5); opacity: 0; } }
/* kitchen */
.mg-table { text-align: center; background: linear-gradient(180deg, #fff6e5, #f6e2bd); border-radius: 22px; padding: 10px 10px 16px; margin-bottom: 10px; }
.mg-table small { color: var(--ink-soft); font-weight: 700; }
.mg-plate { display: block; margin: 6px auto 0; width: 200px; max-width: 70%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, #fff 0 58%, #e9e4da 60% 64%, #fff 66%); border: 3px solid #e2dccf; font-size: 2.2rem; cursor: default; letter-spacing: 4px; }
.mg-plate.mg-glow { cursor: pointer; box-shadow: 0 0 0 6px #ffe7a6; animation: mgPulse 1s infinite; }
.mg-plate.mg-chomp { animation: mgChomp .2s; }
@keyframes mgChomp { 50% { transform: scale(.92); } }
.mg-area { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 10px; }
.mg-big { justify-content: center; font-size: 1.15rem; padding: 16px; }
.mg-foods { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.mg-food { flex-direction: column; justify-content: center; text-align: center; padding: 8px 4px; gap: 4px; }
.mg-food small { font-size: .78rem; }
/* choice + names */
.mg-scene { font-size: 3.4rem; text-align: center; line-height: 1.2; }
.mg-choices { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 640px) { .mg-choices { grid-template-columns: 1fr 1fr; } }
.mg-namechoice { display: grid; gap: 2px; } .mg-namechoice .mg-ar { font-size: 1.7rem; line-height: 1.5; } .mg-namechoice small { color: var(--ink-soft); }
.mg-name { text-align: center; background: linear-gradient(160deg, #1d2b66, #0b1533); color: #fff; border-radius: 24px; padding: 18px 14px; margin: 8px 0 4px; }
.mg-name small { color: #c7d0f2; font-weight: 700; }
.mg-name-ar { font-size: clamp(2.6rem, 11vw, 4rem); color: #ffd166; line-height: 1.6; }
.mg-name b { display: block; font-size: 1.3rem; } .mg-name p { margin: 6px 0 0; font-size: 1.1rem; color: #e3e9ff; }
/* jigsaw */
.mg-jig-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 90px; gap: 10px; align-items: start; max-width: 520px; margin: 0 auto; }
.mg-jig { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 3px; background: var(--night); padding: 3px; border-radius: 14px; touch-action: manipulation; }
.mg-tile { aspect-ratio: 1; border: 0; padding: 0; border-radius: 6px; cursor: pointer; background-repeat: no-repeat; outline: 0; }
.mg-tile.sel { box-shadow: inset 0 0 0 4px #ffd166; }
.mg-tile.in { box-shadow: inset 0 0 0 2px rgba(61,179,143,.7); }
.mg-jig.solved { gap: 0; padding: 0; } .mg-jig.solved .mg-tile { border-radius: 0; box-shadow: none; }
.mg-peek { aspect-ratio: 1; border-radius: 10px; background-size: cover; border: 2px solid var(--line); }
/* pairs */
.mg-pairs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mg-col { display: grid; gap: 8px; align-content: start; }
.mg-card { min-height: 64px; font-size: .92rem; }
.mg-card.sel { border-color: var(--gold); box-shadow: 0 0 0 3px #ffe7a6; }
.mg-dua { flex-direction: column; justify-content: center; gap: 0; text-align: center; }
.mg-dua .mg-ar { font-size: 1.3rem; line-height: 1.6; color: var(--green-dark); }
.mg-dua small { font-size: .75rem; color: var(--ink-soft); }
@media (max-width: 420px) { .mg-sit .mg-emo { display: none; } .mg-card { padding: 8px; } }
/* sort */
.mg-sortcard { margin: 12px auto; max-width: 360px; background: #fff; border: 3px solid var(--line); border-radius: 24px; padding: 20px 14px; text-align: center; display: grid; gap: 8px; transition: transform .25s, border-color .25s; }
.mg-sortcard .mg-emo { font-size: 3.6rem; } .mg-sortcard b { font-size: 1.2rem; }
.mg-sortcard.is-good { border-color: var(--green); background: #e3f6ee; transform: rotate(-3deg); }
.mg-sortcard.is-bad { border-color: var(--rose); background: #fde9e7; transform: rotate(3deg); }
.mg-sortbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 420px; margin: 0 auto; }
.mg-good, .mg-bad { font: inherit; font-weight: 800; font-size: 1.15rem; padding: 14px; border-radius: 18px; border: 0; cursor: pointer; color: #fff; }
.mg-good { background: var(--green); } .mg-bad { background: var(--rose); }
.mg-good:disabled, .mg-bad:disabled { opacity: .5; cursor: default; }
/* games hub */
.mg-more { margin-top: 10px; }