/* Arcade hub (/arcade), arcade games (/arcade-play) and the extra KG corner games. Session B. */

.arc-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin: 26px 0 10px; }
.arc-head h2 { margin: 0; font-size: clamp(21px, 3vw, 26px); }
.arc-head p { margin: 2px 0 0; color: var(--muted); font-size: 15px; }
.arc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.arc-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: start; border: 0; border-radius: 22px; padding: 16px; cursor: pointer; color: var(--ink); text-decoration: none; font: inherit; box-shadow: 0 6px 0 rgba(10, 19, 48, .09); transition: transform .15s; min-height: 128px; }
.arc-card:hover { transform: translateY(-3px); }
.arc-card:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(10, 19, 48, .09); }
.arc-card .em { font-size: 40px; line-height: 1; }
.arc-card strong { font: 700 19px var(--font-display); }
.arc-card small { color: var(--muted); font-size: 14px; line-height: 1.35; }
.arc-card .stars { font-size: 14px; letter-spacing: 1px; margin-top: auto; }
.arc-card .new { position: absolute; top: 10px; inset-inline-end: 10px; background: var(--pink); color: #fff; font-size: 12px; font-weight: 800; padding: 2px 9px; border-radius: 999px; }
.arc-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--muted); font-weight: 700; }
.arc-lessons { display: grid; gap: 12px; }
.arc-lesson { border: 1px solid var(--line); border-radius: 18px; padding: 12px 14px; }
.arc-lesson h3 { margin: 0 0 2px; font-size: 18px; }
.arc-lesson p { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.arc-flag-note { color: var(--muted); font-size: 13px; }

@media (max-width: 480px) {
  .arc-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .arc-card { padding: 12px; min-height: 116px; }
  .arc-card .em { font-size: 34px; }
  .arc-card strong { font-size: 17px; }
  .arc-card small { font-size: 13px; }
}

/* ---- Arcade game page ---- */
.ap-menu { text-align: center; max-width: 560px; margin: 0 auto; padding: 6px 0 10px; }
.ap-icon { font-size: 64px; line-height: 1; }
.ap-menu h2 { margin: 8px 0 4px; font-size: clamp(24px, 4vw, 32px); }
.ap-how { color: var(--muted); margin: 0 auto 14px; line-height: 1.6; }
.ap-center { justify-content: center; margin-bottom: 8px; }
.ap-levels { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 10px 0 6px; }
.ap-levels button { width: 74px; padding: 10px 4px 8px; border-radius: 18px; border: 3px solid var(--line); background: var(--card); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; font: inherit; color: var(--ink); }
.ap-levels button b { font: 800 24px var(--font-display); }
.ap-levels button.on { border-color: var(--primary); background: var(--primary-soft); }
.ap-levels button:disabled { opacity: .45; cursor: not-allowed; }
.ap-stars { font-size: 11px; letter-spacing: 1px; }
.ap-stars span { filter: grayscale(1) opacity(.3); }
.ap-stars span.on { filter: none; }
.ap-hint { color: var(--muted); font-size: 13px; margin: 4px 0 16px; }
.ap-go { font-size: 20px; padding: 14px 40px; }
.ap-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-weight: 700; color: var(--muted); margin-bottom: 14px; }
.ap-bar b { color: var(--ink); }
.ap-actions { display: flex; justify-content: center; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 16px; color: var(--muted); font-weight: 700; }
@keyframes ap-shake { 25% { translate: -8px 0; } 75% { translate: 8px 0; } }
.shake { animation: ap-shake .35s ease 2; }

/* Pipe Puzzle */
.pp-grid { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 4px; width: min(100%, calc(var(--n) * 76px)); margin: 0 auto; background: var(--tint-purple); padding: 6px; border-radius: 18px; }
.pp-tile { aspect-ratio: 1; border: 0; padding: 0; background: var(--card); border-radius: 10px; cursor: pointer; overflow: hidden; }
.pp-rot { display: block; width: 100%; height: 100%; transition: transform .18s ease; }
.pp-rot svg { width: 100%; height: 100%; display: block; }
.pp-pipe { stroke: #b8b4d6; stroke-width: 20; stroke-linecap: round; fill: #b8b4d6; }
.pp-house { fill: #fff; stroke-width: 8; }
.pp-src { fill: var(--tint-blue); stroke: var(--sky); stroke-width: 6; }
.pp-tile.lit .pp-pipe { stroke: var(--sky); fill: var(--sky); }
.pp-tile.lit .pp-house { fill: #ffe9a8; }
.pp-grid.done { box-shadow: 0 0 0 4px var(--green); }

/* Rhythm Memory */
.rh-pads { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: min(100%, 360px); margin: 0 auto; }
.rh-pad { aspect-ratio: 1; border: 0; border-radius: 28px; background: var(--c); opacity: .45; cursor: pointer; box-shadow: 0 8px 0 rgba(10, 19, 48, .15); transition: opacity .1s, transform .1s; }
.rh-pad.on { opacity: 1; transform: scale(1.05); box-shadow: 0 0 0 6px #fff, 0 0 28px var(--c); }
.rh-pad:disabled { cursor: default; }
.rh-pad:not(:disabled):active { transform: translateY(3px); }

/* Kids Sudoku */
.sd-grid { display: grid; grid-template-columns: repeat(var(--n), 1fr); width: min(100%, calc(var(--n) * 64px)); margin: 0 auto; border: 3px solid var(--ink); border-radius: 12px; overflow: hidden; background: var(--card); }
.sd-cell { aspect-ratio: 1; border: 0; border-inline-end: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--card); font: 800 clamp(22px, 6vw, 30px) var(--font-display); color: var(--link); cursor: pointer; padding: 0; }
.sd-grid[dir="ltr"] .sd-cell.br { border-right: 3px solid var(--ink); }
.sd-cell.bb { border-bottom: 3px solid var(--ink); }
.sd-cell.given { color: var(--ink); background: var(--tint-grey); cursor: default; }
.sd-cell.same { background: var(--tint-purple); }
.sd-cell.sel { background: #ffe9a8; color: var(--on-bright); }
.sd-cell.bad { color: var(--danger-ink); background: var(--tint-red); }
.sd-grid.done { border-color: var(--green); }
.sd-pad { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.sd-pad button { width: 52px; height: 52px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); font: 800 24px var(--font-display); color: var(--ink); cursor: pointer; box-shadow: 0 4px 0 var(--line); }
.sd-pad button:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--line); }
@media (max-width: 480px) {
  .sd-pad { gap: 6px; }
  .sd-pad button { width: 40px; height: 46px; font-size: 21px; }
  .pp-grid { gap: 3px; padding: 4px; }
}

/* Quiz-style games (core.js quiz) */
.aq-dots { display: flex; gap: 6px; justify-content: center; margin: -4px 0 14px; }
.aq-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--line); }
.aq-dots i.now { background: var(--primary); transform: scale(1.25); }
.aq-dots i.ok { background: var(--green); }
.aq-dots i.no { background: var(--danger); }
.aq-q { font: 700 clamp(19px, 3.4vw, 24px) var(--font-display); text-align: center; margin: 12px 0; line-height: 1.5; }
.aq-choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; max-width: 520px; margin: 10px auto 0; }
.aq-choices button { border: 3px solid var(--line); background: var(--card); border-radius: 18px; padding: 14px 10px; font: 800 clamp(19px, 3.4vw, 24px) var(--font-display); color: var(--ink); cursor: pointer; box-shadow: 0 5px 0 var(--line); min-height: 64px; }
.aq-choices button:hover:not(:disabled) { border-color: var(--blue); }
.aq-choices button:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 var(--line); }
.aq-choices button.right { border-color: var(--green); background: var(--tint-green); }
.aq-choices button.wrong { border-color: var(--danger); background: var(--tint-red); }
.aq-feedback { min-height: 30px; text-align: center; font-weight: 800; margin-top: 12px; }
.aq-feedback.ok { color: var(--green); }
.aq-feedback.no { color: var(--danger-ink); }

/* Market Math */
.mk-shelf { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.mk-item { position: relative; background: var(--card); border: 2px solid var(--line); border-radius: 18px; padding: 10px 12px; min-width: 104px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.mk-e { font-size: 44px; line-height: 1.1; }
.mk-qty { position: absolute; top: 6px; inset-inline-end: 8px; background: var(--primary); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: 14px; }
.mk-item small { color: var(--muted); font-weight: 700; }
.mk-price { background: var(--tint-yellow); border-radius: 999px; padding: 2px 10px; font-weight: 800; font-size: 15px; }
.mk-price i { font-style: normal; font-weight: 600; color: var(--muted); font-size: 12px; }
.mk-wallet { text-align: center; margin-top: 10px; font-weight: 800; font-size: 18px; }

/* Pizza Fractions */
.fr { display: inline-flex; flex-direction: column; align-items: center; line-height: 1; vertical-align: middle; font-weight: 800; }
.fr b { border-bottom: 3px solid currentColor; padding: 0 4px 2px; }
.fr i { font-style: normal; padding-top: 2px; }
.pz-row { display: flex; justify-content: center; gap: 22px; flex-wrap: wrap; }
.pz-row figure { margin: 0; text-align: center; font-size: 22px; }
.pz { width: min(200px, 60vw); height: auto; }
.pz-crust { fill: #f2c37b; }
.pz-slice { fill: #fff3d6; stroke: #c98b3a; stroke-width: 1.2; }
.pz-slice.on { fill: #ff8a3d; }
.pz-click .pz-slice { cursor: pointer; }
.pz-click .pz-slice:hover { fill: #ffd2ad; }
.pz-click .pz-slice.on:hover { fill: #ff7a24; }
.pz-eq { text-align: center; font: 800 28px var(--font-display); margin-bottom: 10px; }
.pz-count { font-weight: 800; color: var(--ink); }

/* Number Line Jump */
.nl { position: relative; height: 110px; margin: 10px 0 4px; }
.nl-svg { position: absolute; inset: 30px 0 0; width: 100%; height: 60px; overflow: visible; }
.nl-svg line { stroke: var(--ink); stroke-width: 1; vector-effect: non-scaling-stroke; stroke-width: 3px; }
.nl-arcs { fill: none; stroke: var(--green); stroke-width: 3px; vector-effect: non-scaling-stroke; stroke-dasharray: 6 5; }
.nl-num { position: absolute; top: 92px; transform: translateX(-50%); font-weight: 800; font-size: 14px; }
.nl-mark { position: absolute; top: 34px; transform: translate(-50%, -100%); background: var(--primary); color: #fff; border-radius: 10px; padding: 2px 9px; font-weight: 800; }
.nl-frog { position: absolute; top: 18px; transform: translate(-50%, -50%); font-size: 34px; transition: left .9s cubic-bezier(.5, -0.4, .5, 1.4); }

/* Speed Math */
.sm-start { text-align: center; padding: 30px 0; }
.sm-bar { height: 12px; border-radius: 999px; background: var(--line); overflow: hidden; margin-bottom: 18px; }
.sm-bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--green), var(--yellow)); transition: width .2s linear; }
.sm-q { text-align: center; font: 800 clamp(40px, 9vw, 64px) var(--font-display); margin: 8px 0 14px; }
.sm-q.pop { animation: kg-pop .3s ease; color: var(--green); }
.sm-q.nope { animation: ap-shake .3s ease; color: var(--danger-ink); }
@media (max-width: 480px) {
  .mk-item { min-width: 88px; padding: 8px; }
  .mk-e { font-size: 36px; }
  .nl-num { font-size: 11px; }
}

/* Word games */
.wt-pic { font-size: 72px; line-height: 1; text-align: center; display: block; }
.wt-cat { text-align: center; margin: 0; }
.wt-cat, .wt-cat + .aq-q { font-weight: 800; }
.wt-slots { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 6px 0 16px; }
.wt-slot { width: 50px; height: 58px; border-radius: 14px; border: 3px dashed var(--edge-purple); background: var(--card); font: 800 28px var(--font-display); color: var(--link); cursor: pointer; padding: 0; }
.wt-slot.full { border-style: solid; border-color: var(--primary); }
.wt-slots.ok .wt-slot { border-color: var(--green); color: var(--green); background: var(--tint-green); }
.wt-slots.no .wt-slot { border-color: var(--danger); color: var(--danger-ink); background: var(--tint-red); }
.wt-pool { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.wt-tile { width: 50px; height: 54px; border-radius: 14px; border: 0; background: var(--yellow); font: 800 26px var(--font-display); color: var(--on-bright); cursor: pointer; box-shadow: 0 5px 0 #d9a514; }
.wt-tile:active { transform: translateY(3px); box-shadow: 0 2px 0 #d9a514; }
.wt-tile.used { visibility: hidden; }
.wt-answer { text-align: center; font-size: 18px; margin: 10px 0 0; }
.wt-answer b { font: 800 24px var(--font-display); color: var(--green); }
.sp-top { display: flex; align-items: center; justify-content: center; gap: 16px; }
.sp-say { width: 64px; height: 64px; border-radius: 50%; border: 0; background: var(--primary); color: #fff; font-size: 30px; cursor: pointer; box-shadow: 0 5px 0 var(--primary-dark); }
.sp-say:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--primary-dark); }
.sp-word { min-height: 60px; max-width: 420px; margin: 0 auto 14px; background: var(--card); border: 3px solid var(--line); border-radius: 16px; display: flex; align-items: center; justify-content: center; font: 800 32px var(--font-display); letter-spacing: 2px; }
.sp-word.ok { border-color: var(--green); color: var(--green); }
.sp-word.no { border-color: var(--danger); color: var(--danger-ink); }
.sp-caret { width: 3px; height: 32px; background: var(--primary); margin-inline-start: 3px; animation: sp-blink 1s steps(1) infinite; }
@keyframes sp-blink { 50% { opacity: 0; } }
.sp-keys { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; max-width: 560px; margin: 0 auto; }
.sp-keys button { min-width: 40px; height: 46px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); font: 800 21px var(--font-display); color: var(--ink); cursor: pointer; box-shadow: 0 3px 0 var(--line); padding: 0 6px; }
.sp-keys button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.sp-keys .sp-wide { min-width: 80px; font-size: 17px; }
.sp-keys .sp-ok { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 3px 0 var(--primary-dark); }
@media (max-width: 480px) {
  .wt-slot, .wt-tile { width: 42px; height: 50px; font-size: 23px; }
  .sp-keys button { min-width: 32px; height: 42px; font-size: 18px; padding: 0 4px; }
  .sp-keys .sp-wide { min-width: 70px; }
}

/* KG corner: animal sounds and letter tracing */
.kg-animal { font-size: clamp(64px, 14vw, 110px); line-height: 1; }
.kg-trace { display: flex; justify-content: center; }
.kg-trace canvas { width: min(100%, 360px); aspect-ratio: 1; background: var(--card); border: 4px dashed var(--edge-purple); border-radius: 28px; touch-action: none; cursor: crosshair; }
.kg-trace-btns { display: flex; gap: 12px; justify-content: center; margin-top: 12px; }
@media (max-width: 480px) {
  .kg-menu-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kg-tile { padding: 16px 6px; font-size: 17px; }
  .kg-tile .big { font-size: 44px; }
}

/* ---- Games made for each age (Balloon Pop … Formula Builder) ---- */
.arc-grade { position: absolute; top: 10px; inset-inline-end: 10px; background: color-mix(in srgb, var(--card) 80%, transparent); color: var(--muted); font-size: 12px; font-weight: 800; padding: 2px 9px; border-radius: 999px; }
.kg-prompt { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.kg-prompt .sp-say { width: 52px; height: 52px; font-size: 24px; flex: none; }

/* Balloon Pop */
.bl-things { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 460px; margin: 6px auto; font-size: clamp(40px, 10vw, 54px); line-height: 1.1; }
.bl-nums button { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bl-nums button b { font-size: 30px; }
.bl-dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; max-width: 90px; }
.bl-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); }
.bl-target { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 4px auto 8px; padding: 6px 18px; width: max-content; border-radius: 16px; background: var(--tint-yellow); }
.bl-target b { font: 800 40px var(--font-display); line-height: 1; }
.bl-target.ok { background: var(--tint-green); }
.bl-target.no { background: var(--tint-red); }
.bl-sky { display: flex; flex-wrap: wrap; gap: 10px 14px; justify-content: center; max-width: 520px; margin: 0 auto; padding: 10px; background: linear-gradient(var(--tint-blue), var(--card)); border-radius: 22px; min-height: 140px; }
.bl-balloon { width: 58px; height: 72px; border: 0; padding: 0; border-radius: 50% 50% 48% 48%; background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, .7) 0 12%, transparent 13%), var(--c); cursor: pointer; position: relative; animation: bl-bob 2.4s ease-in-out infinite; animation-delay: var(--d); }
.bl-balloon::after { content: ''; position: absolute; left: 50%; top: 100%; width: 2px; height: 16px; background: #9aa0b8; }
.bl-balloon.popped { animation: bl-pop .25s ease forwards; pointer-events: none; }
@keyframes bl-bob { 50% { transform: translateY(-6px); } }
@keyframes bl-pop { to { transform: scale(1.5); opacity: 0; } }
.bl-row { display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: 18px; font-weight: 800; font-size: 20px; }

/* Shape Sorter */
.sh-board { display: flex; justify-content: center; margin: 6px 0; }
.sh-hole { width: 130px; height: 130px; fill: #d9d5ef; stroke: #a59fd0; stroke-width: 3; stroke-dasharray: 6 4; }
.sh-board .sh-shape { width: 130px; height: 130px; }
.sh-choices button { display: flex; justify-content: center; align-items: center; padding: 10px; }
.sh-shape { width: 74px; height: 74px; }

/* Animal Memory */
.mm-grid { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 10px; width: min(100%, calc(var(--cols) * 104px)); margin: 0 auto; }
.mm-card { aspect-ratio: 1; border: 0; border-radius: 18px; background: var(--primary); cursor: pointer; font-size: clamp(30px, 8vw, 46px); box-shadow: 0 5px 0 var(--primary-dark); padding: 0; transition: transform .2s; }
.mm-card .mm-front { display: none; }
.mm-card.up { background: var(--card); box-shadow: 0 5px 0 var(--line); transform: rotateY(180deg) scaleX(-1); }
.mm-card.up .mm-front { display: inline; }
.mm-card.up .mm-back { display: none; }
.mm-card.done { background: var(--tint-green); box-shadow: 0 5px 0 var(--edge-green); cursor: default; }

/* Clock */
.ck-face { display: block; width: min(230px, 64vw); margin: 0 auto 6px; }
.ck-rim { fill: #fff; stroke: var(--primary); stroke-width: 6; }
.ck-face text { font: 800 15px var(--font-display); text-anchor: middle; dominant-baseline: central; fill: var(--on-bright); }
.ck-hr { stroke: var(--on-bright); stroke-width: 3; }
.ck-min { stroke: #c9c4ef; stroke-width: 1.5; }
.ck-h { stroke: var(--on-bright); stroke-width: 7; stroke-linecap: round; }
.ck-m { stroke: var(--pink); stroke-width: 4; stroke-linecap: round; }
.ck-dot { fill: var(--on-bright); }

/* Riyal Coins */
.cn-pile, .cn-tray, .cn-wallet { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }
.cn-tray { min-height: 86px; max-width: 540px; margin: 0 auto; border: 3px dashed var(--edge-purple); border-radius: 18px; padding: 8px; }
.cn-tray.ok { border-style: solid; border-color: var(--green); background: var(--tint-green); }
.cn-tray.no { border-style: solid; border-color: var(--danger); background: var(--tint-red); }
.cn-tray button, .cn-wallet button { border: 0; background: none; padding: 0; cursor: pointer; }
.cn-wallet { margin-top: 10px; }
.cn-wallet button:active { transform: translateY(2px); }
.cn-empty { color: var(--muted); font-size: 14px; }
.cn-coin, .cn-note { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; font-weight: 800; color: #3a2a00; }
.cn-coin { width: 58px; height: 58px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff6c9, #e7c45a 60%, #c9a13a); box-shadow: inset 0 0 0 3px #b8902e; }
.cn-coin.cn-2 { background: radial-gradient(circle at 35% 30%, #fff, #d9dde6 55%, #e7c45a 56%, #c9a13a); }
.cn-note { width: 92px; height: 50px; border-radius: 8px; color: #fff; box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .5); }
.cn-coin b, .cn-note b { font: 800 22px var(--font-display); }
.cn-coin small, .cn-note small { font-size: 10px; }
.cn-5 { background: #8d5bf5; } .cn-10 { background: #a0703a; } .cn-50 { background: #22a06b; } .cn-100 { background: #d24f6a; }
.cn-sum { text-align: center; font-weight: 800; font-size: 18px; margin: 8px 0 0; }
.cn-sum.over b { color: var(--danger-ink); }

/* Odd One Out */
.od-pic { font-size: clamp(44px, 11vw, 60px); line-height: 1.1; }

/* Times Table Race */
.mr-track { position: relative; background: #3b3f55; border-radius: 16px; padding: 8px 40px 8px 8px; margin-bottom: 12px; }
.mr-lane { position: relative; height: 40px; border-bottom: 2px dashed rgba(255, 255, 255, .45); }
.mr-lane:last-of-type { border-bottom: 0; }
.mr-car { position: absolute; left: 0; top: 2px; font-size: 32px; transition: left .4s ease; transform: scaleX(-1); }
.mr-rival { transition: left .2s linear; }
.mr-flag { position: absolute; right: 8px; top: 50%; translate: 0 -50%; font-size: 28px; }
.mr-typed { min-height: 52px; max-width: 220px; margin: 0 auto 12px; border: 3px solid var(--line); background: var(--card); border-radius: 14px; text-align: center; font: 800 32px var(--font-display); white-space: pre; }
.mr-typed.ok { border-color: var(--green); color: var(--green); }
.mr-typed.no { border-color: var(--danger); color: var(--danger-ink); font-size: 24px; line-height: 46px; }
.mr-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 300px; margin: 0 auto; }
.mr-pad button { height: 56px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); font: 800 26px var(--font-display); color: var(--ink); cursor: pointer; box-shadow: 0 4px 0 var(--line); }
.mr-pad button:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--line); }
.mr-pad .sp-ok { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 4px 0 var(--primary-dark); }

/* Saudi Regions */
.rg-map { display: block; width: min(100%, 420px); margin: 0 auto; }
.rg-land { fill: #e6f4ea; stroke: #2f8f5b; stroke-width: 2.5; stroke-linejoin: round; }
.rg-dot { fill: #fff; stroke: var(--primary); stroke-width: 3; }
.rg-hit { fill: transparent; }
.rg-tap .rg-pin { cursor: pointer; }
.rg-tap .rg-pin:hover .rg-dot, .rg-tap .rg-pin:focus .rg-dot { fill: #ffe9a8; }
.rg-pin.on .rg-dot { fill: var(--yellow); stroke: var(--ink); r: 11px; animation: rg-pulse 1s ease-in-out infinite; }
.rg-pin.right .rg-dot { fill: var(--green); stroke: #fff; animation: none; }
.rg-pin.wrong .rg-dot { fill: var(--danger); stroke: #fff; }
@keyframes rg-pulse { 50% { stroke-width: 6; } }
.rg-note { text-align: center; color: var(--muted); font-size: 13px; margin: 4px 0; }

/* Shapes & Angles */
.an-art { display: flex; justify-content: center; }
.an-svg { width: min(240px, 70vw); height: auto; overflow: visible; }
.an-svg line { stroke: var(--ink); stroke-width: 4; stroke-linecap: round; }
.an-svg circle { fill: var(--ink); }
.an-arc { fill: none; stroke: var(--pink); stroke-width: 3.5; }
.an-poly { fill: var(--tint-purple); stroke: var(--primary); stroke-width: 4; stroke-linejoin: round; }
.an-svg text { font: 800 15px var(--font-display); fill: var(--ink); }
.an-svg .an-q { fill: var(--pink); font-size: 22px; }

/* Balance Scales */
.bs-scale { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 40px; max-width: 480px; margin: 0 auto; padding-bottom: 46px; }
.bs-side { display: flex; justify-content: center; align-items: flex-end; min-height: 80px; }
.bs-pan { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; align-items: flex-end; width: 100%; min-height: 50px; padding: 6px; border-bottom: 6px solid #8a6d3b; border-radius: 0 0 40px 40px; background: var(--tint-yellow); }
.bs-x { width: 34px; height: 34px; border-radius: 8px; background: var(--primary); color: #fff; font: 800 20px var(--font-display); display: inline-flex; align-items: center; justify-content: center; }
.bs-pan > b { font: 800 18px var(--font-display); align-self: center; }
.bs-w { min-width: 40px; height: 40px; padding: 0 6px; border-radius: 10px 10px 4px 4px; background: #5c6070; color: #fff; font: 800 18px var(--font-display); display: inline-flex; align-items: center; justify-content: center; }
.bs-b { position: relative; font-size: 34px; align-self: flex-start; }
.bs-b b { position: absolute; inset: 0 0 6px; display: flex; align-items: center; justify-content: center; font: 800 14px var(--font-display); color: #fff; }
.bs-beam { position: absolute; left: 8%; right: 8%; bottom: 40px; height: 8px; border-radius: 4px; background: #8a6d3b; }
.bs-stand { position: absolute; left: 50%; bottom: 0; translate: -50% 0; width: 0; height: 0; border-left: 26px solid transparent; border-right: 26px solid transparent; border-bottom: 40px solid #8a6d3b; }
.bs-eq { font-size: clamp(28px, 6vw, 40px); margin: 6px 0 0; }

/* Periodic Table Match */
.el-wrap { display: flex; justify-content: center; margin: 4px 0; }
.el-tile { width: 140px; height: 150px; border-radius: 14px; border: 3px solid var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; background: var(--card); }
.el-metal { background: var(--tint-blue); } .el-nonmetal { background: var(--tint-yellow); } .el-noble { background: var(--tint-pink); } .el-metalloid { background: var(--tint-green); }
.el-num { position: absolute; top: 8px; left: 10px; font-weight: 800; font-size: 16px; }
.el-sym { font: 800 56px var(--font-display); line-height: 1; }
.el-name { font-weight: 700; font-size: 15px; margin-top: 6px; }

/* Idioms */
.id-phrase { text-align: center; font: 800 clamp(24px, 5vw, 34px) var(--font-display); color: var(--link); margin: 10px 0 0; }
.id-choices { grid-template-columns: 1fr; }
.id-choices button { font: 700 18px var(--font-body, inherit); min-height: 54px; }

/* Pattern Detective */
.pt-seq { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 8px 0 4px; }
.pt-seq span { min-width: 56px; height: 56px; padding: 0 8px; border-radius: 14px; background: var(--card); border: 3px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font: 800 24px var(--font-display); }
.pt-seq .pt-gap { border-style: dashed; border-color: var(--pink); color: var(--pink); }
.pt-seq .pt-gap.ok { border-style: solid; border-color: var(--green); color: var(--green); }
.pt-seq .pt-gap.no { border-style: solid; border-color: var(--danger); color: var(--danger-ink); }

/* Graph Match */
.gr-wrap { display: flex; justify-content: center; }
.gr-svg { width: min(260px, 72vw); height: auto; background: var(--card); border-radius: 14px; border: 2px solid var(--line); }
.gr-grid line { stroke: var(--line); stroke-width: 1; }
.gr-axis { stroke: var(--ink); stroke-width: 1.6; }
.gr-line { fill: none; stroke: var(--pink); stroke-width: 3.2; stroke-linejoin: round; stroke-linecap: round; }
.gr-svg text { font: 700 11px var(--font-display); fill: var(--muted); }
.gr-small { width: 100%; border: 0; }
.gr-picks button { padding: 6px; }
.gr-eqs button { font-size: clamp(16px, 3vw, 20px); }
.gr-label { font-size: clamp(26px, 5vw, 36px); }

/* Formula Builder */
.fm-name { text-align: center; font: 800 clamp(22px, 4.4vw, 30px) var(--font-display); color: var(--link); margin: 6px 0 0; }
.fm-parts { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 4px 0 8px; }
.fm-part { background: var(--card); border: 3px solid var(--line); border-radius: 18px; padding: 8px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 104px; }
.fm-part > b { font: 800 30px var(--font-display); }
.fm-step { display: flex; align-items: center; gap: 6px; }
.fm-step button { width: 40px; height: 40px; border-radius: 12px; border: 0; background: var(--primary-soft); color: var(--link); font: 800 24px var(--font-display); cursor: pointer; }
.fm-step span { min-width: 26px; text-align: center; font: 800 24px var(--font-display); }
.fm-parts.ok .fm-part { border-color: var(--green); background: var(--tint-green); }
.fm-parts.no .fm-part { border-color: var(--danger); background: var(--tint-red); }

@media (max-width: 480px) {
  .bl-balloon { width: 50px; height: 62px; }
  .sh-shape { width: 60px; height: 60px; }
  .mm-grid { gap: 7px; }
  .cn-coin { width: 50px; height: 50px; }
  .cn-note { width: 78px; height: 44px; }
  .bs-scale { gap: 18px; }
  .bs-x { width: 28px; height: 28px; font-size: 17px; }
  .el-tile { width: 120px; height: 130px; }
  .el-sym { font-size: 46px; }
  .pt-seq span { min-width: 46px; height: 48px; font-size: 20px; }
  .fm-part { min-width: 88px; }
  .mr-pad button { height: 52px; }
}

/* ---- Classic puzzles for older students ---- */
/* Word Search */
.ws-grid { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 2px; width: min(100%, calc(var(--n) * 40px)); margin: 0 auto; background: var(--tint-purple); padding: 5px; border-radius: 14px; touch-action: none; user-select: none; -webkit-user-select: none; }
.ws-cell { aspect-ratio: 1; border: 0; padding: 0; border-radius: 7px; background: var(--card); font: 800 clamp(13px, 3.6vw, 20px) var(--font-display); color: var(--ink); text-transform: uppercase; cursor: pointer; -webkit-tap-highlight-color: transparent; }
/* The game itself: the grid fills the width (up to 720px) and the letters grow with it. */
.ap-wordsearch .ws-grid { grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 3px; width: min(100%, 720px); padding: 6px; border-radius: 16px; box-sizing: border-box; }
.ap-wordsearch .ws-cell { min-width: 0; border-radius: 8px; font-size: min(calc((100vw - 56px) / var(--n) * 0.56), calc(708px / var(--n) * 0.56)); transition: background .08s; }
.ws-cell:focus-visible { outline: 3px solid var(--primary); outline-offset: -3px; }
.ws-cell.sel { background: #ffe9a8; color: var(--on-bright); }
.ws-cell.got { color: #fff; }
.ws-cell.g0 { background: #5b45f8; } .ws-cell.g1 { background: #22b67e; } .ws-cell.g2 { background: #ff6b9a; }
.ws-cell.g3 { background: #ff8a3d; } .ws-cell.g4 { background: #3d7bf5; } .ws-cell.g5 { background: #8d5bf5; }
.ws-cell.got.sel { background: #ffe9a8; color: var(--on-bright); }
.ws-list { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; list-style: none; padding: 0; margin: 16px auto 0; max-width: 720px; }
.ws-list li { font-weight: 700; text-transform: uppercase; }
.ws-chips li { background: var(--card); border: 2px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: 17px; box-shadow: 0 3px 0 var(--line); }
.ws-chips li.got { border-color: var(--green); background: var(--tint-green); box-shadow: none; }
.ws-list li.got b { text-decoration: line-through; text-decoration-thickness: 3px; color: var(--green); }
.ws-clues { display: grid; gap: 6px; text-align: start; }
.ws-clues li { text-transform: none; background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 6px 10px; font-weight: 600; }
.ws-clues li.got { border-color: var(--green); background: var(--tint-green); }
.ws-clues .ws-word { color: var(--green); text-decoration: none !important; text-transform: uppercase; }
.ws-len { color: var(--muted); font-size: 13px; }

/* Crossword */
.cw-now { min-height: 48px; text-align: center; font-weight: 600; margin: 0 0 10px; background: var(--tint-yellow); border-radius: 12px; padding: 8px 12px; }
.cw-grid { display: grid; grid-template-columns: repeat(var(--w), 1fr); gap: 2px; width: min(100%, calc(var(--w) * 42px)); margin: 0 auto 12px; }
.cw-x { aspect-ratio: 1; }
.cw-cell { position: relative; aspect-ratio: 1; border: 2px solid var(--ink); border-radius: 5px; background: var(--card); padding: 0; cursor: pointer; font: 800 clamp(13px, 3.8vw, 21px) var(--font-display); color: var(--ink); text-transform: uppercase; }
.cw-cell i { position: absolute; top: 0; inset-inline-start: 2px; font: 700 9px var(--font-body, sans-serif); font-style: normal; color: var(--muted); }
.cw-cell.on { background: var(--tint-purple); }
.cw-cell.cur { background: #ffe9a8; color: var(--on-bright); }
.cw-cell.cur i { color: var(--on-bright); opacity: .75; }
.cw-keys { margin-bottom: 12px; }
.cw-clues { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; max-width: 760px; margin: 0 auto; }
.cw-clues h4 { margin: 0 0 6px; }
.cw-clues ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 5px; }
.cw-clues li { padding: 6px 8px; border-radius: 10px; cursor: pointer; border: 2px solid transparent; line-height: 1.45; }
.cw-clues li.on { border-color: var(--primary); background: var(--primary-soft); }

/* Guess the Word */
.hm-lives { text-align: center; font-size: 22px; letter-spacing: 2px; margin-bottom: 6px; }
.hm-slots .wt-slot { display: inline-flex; align-items: center; justify-content: center; cursor: default; text-transform: uppercase; }
.hm-keys button.hit { background: var(--tint-green); border-color: var(--green); }
.hm-keys button.miss { background: var(--tint-red); border-color: var(--danger); opacity: .6; }

/* Memory Pro */
.mp-grid .mm-card { font: 800 clamp(14px, 3.4vw, 19px) var(--font-display); padding: 6px; line-height: 1.25; overflow-wrap: anywhere; }
.mp-grid .mm-card .mm-back { font-size: clamp(28px, 7vw, 40px); }
.mp-elements .mm-card { font-size: clamp(16px, 4vw, 22px); }
.mp-terms { width: min(100%, 560px); }
.mp-terms .mm-card { aspect-ratio: 4 / 3; font-size: clamp(12px, 2.9vw, 15px); font-weight: 700; }

@media (max-width: 480px) {
  .ap-wordsearch .ws-grid { gap: 2px; padding: 4px; }
  .ws-chips li { font-size: 15px; padding: 5px 11px; }
  .cw-clues { grid-template-columns: 1fr; }
  .mp-grid { --cols: 3 !important; }
  .mp-terms { --cols: 2 !important; }
}

/* "How to play" tutorial (arcade-play) */
.ap-tut-btn { background: var(--tint-yellow); color: var(--ink); border: 2px solid #ffc93c; font-size: 17px; padding: 10px 22px; margin: 4px 0 10px; box-shadow: 0 4px 0 #f0b72f; }
.ap-tut-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #f0b72f; }
.tut-dialog { width: min(520px, calc(100% - 32px)); border: 0; border-radius: 24px; padding: 18px; }
.tut-dialog::backdrop { background: rgba(10, 19, 48, .45); }
.tut-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tut-top h2 { margin: 0; font-size: clamp(18px, 3.6vw, 22px); }
.tut-x { border: 0; background: var(--line); width: 36px; height: 36px; border-radius: 50%; font-size: 16px; cursor: pointer; flex: none; }
.tut-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; background: var(--card); border-radius: 20px; padding: 20px 16px; margin: 14px 0 10px; min-height: 190px; justify-content: center; }
.tut-icon { font-size: 60px; line-height: 1; animation: kg-pop .35s ease; }
.tut-card p { margin: 0; font-size: 18px; line-height: 1.6; font-weight: 600; }
.tut-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 12px; }
.tut-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.tut-dots i.on { background: var(--primary); transform: scale(1.3); }
.tut-nav { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

/* Game page: a big Back button before the title (game → its menu, menu → games list) */
.play-top:has(.ap-back) { justify-content: flex-start; flex-wrap: nowrap; }
.ap-back { flex: none; background: var(--card); border: 3px solid var(--line); border-radius: 999px; padding: 10px 18px; font: 700 18px var(--font-display); color: var(--ink); box-shadow: 0 4px 0 var(--line); cursor: pointer; }
.ap-back:hover { border-color: var(--primary); color: var(--link); }
.ap-back:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
