/* while Baloo Bhaijaan 2 loads, a local Arabic font stands in with Baloo's own vertical metrics (it has a very deep
   descent) and close widths, so the hero title and lede do not move when the web font swaps in */
@font-face {
  font-family: 'Baloo fallback';
  src: local('Segoe UI'), local('Noto Sans Arabic'), local('Noto Sans Arabic UI'), local('Geeza Pro'), local('Tahoma'), local('Arial');
  size-adjust: 97%; ascent-override: 111%; descent-override: 65%; line-gap-override: 0%;
}
:root {
  --sky: #bfe9ff; --sky2: #eaf8ff; --cream: #fff4dc; --sand: #ffe3ad;
  --ink: #16325c; --ink2: #4a5f80; --green: #23a66a; --green-d: #15804f;
  --orange: #ff7a2f; --orange-d: #d9581a; --gold: #ffc23a; --gold-d: #e09a00;
  --card: #ffffff; --line: #d7e6f2;
  --r: 22px;
  --f: 'Baloo Bhaijaan 2', 'Baloo fallback', system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; font-family: var(--f); color: var(--ink); font-size: 17px; line-height: 1.6;
  background: linear-gradient(180deg, var(--sky) 0, var(--sky2) 640px, var(--cream) 1400px, #fff8ea 100%);
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 800; letter-spacing: 0; }
p { margin: 0; }
.skip { position: absolute; inset-inline-start: 12px; top: -60px; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; z-index: 100; }
.skip:focus { top: 12px; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }
iconify-icon { display: inline-block; width: 1em; height: 1em; }
.eyebrow { font-weight: 700; font-size: 15px; color: var(--green-d); }
.sub { color: var(--ink2); font-size: 17px; }

/* ---------- الأزرار ---------- */
.btn-play {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 58px; padding: 6px 30px; border: 0; border-radius: 20px; cursor: pointer;
  background: linear-gradient(180deg, #ff9a52, var(--orange)); color: #fff; font-weight: 800; font-size: 21px;
  box-shadow: 0 6px 0 var(--orange-d), 0 14px 26px rgba(217, 88, 26, .35);
  transition: box-shadow .15s ease, translate .15s ease;
  text-decoration: none;
}
.btn-play iconify-icon { font-size: 24px; }
.btn-play:active { translate: 0 4px; box-shadow: 0 2px 0 var(--orange-d), 0 6px 14px rgba(217, 88, 26, .3); }
.btn-play.sm { min-height: 48px; padding: 4px 20px; font-size: 18px; border-radius: 16px; }
.btn-soft {
  display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 6px 22px;
  border-radius: 18px; border: 2px solid #cfe2f2; background: #fff; color: var(--ink); font-weight: 700; font-size: 18px;
  box-shadow: 0 4px 0 #cfe2f2; cursor: pointer; text-decoration: none;
  transition: box-shadow .15s ease, translate .15s ease;
}
.btn-soft:active { translate: 0 3px; box-shadow: 0 1px 0 #cfe2f2; }

/* ---------- البطل ---------- */
.hero { position: relative; min-height: max(640px, 100svh); display: grid; grid-template-rows: auto 1fr auto; padding: calc(30px + var(--safe-t)) 18px 26px; overflow: hidden; isolation: isolate; }
.sky { position: absolute; inset: 0; z-index: -2; background: radial-gradient(120% 70% at 50% 100%, #fff4dc 0, rgba(255, 244, 220, 0) 55%), linear-gradient(180deg, #8fd6ff 0, #bfe9ff 45%, #e6f7ff 100%); }
.sun { position: absolute; width: 340px; height: 340px; inset-inline-start: -90px; top: 60px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 236, 170, .95) 0, rgba(255, 216, 120, .45) 35%, rgba(255, 216, 120, 0) 70%); }
#hero3d { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; touch-action: pan-y; }
.hero-copy { text-align: center; max-width: 760px; margin-inline: auto; }
.hero h1 { font-size: clamp(46px, 13.5vw, 112px); margin-top: 4px; color: var(--ink); text-shadow: 0 2px 0 #fff, 0 10px 30px rgba(255, 255, 255, .8); }
.hero h1 .hl {
  display: inline-block; color: var(--orange);
  text-shadow: 0 1px 0 #f06a20, 0 2px 0 #e9611b, 0 3px 0 #e05a17, 0 4px 0 #d65314, 0 5px 0 #c94b11, 0 12px 22px rgba(201, 75, 17, .35);
}
.lede { font-size: 19px; color: var(--ink); margin-top: 8px; font-weight: 600; text-shadow: 0 0 12px #eaf8ff, 0 0 4px #eaf8ff, 0 1px 0 #fff; }
.hero-cta { grid-row: 3; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.hero-cta .btn-play { width: min(100%, 360px); }
.hero-cta .btn-soft { background: rgba(255, 255, 255, .75); }

/* ---------- الخريطة ---------- */
section[id] { scroll-margin-top: 24px; }
.stat b#rep-time { font-size: 26px; }
.map { padding: 70px 18px 40px; max-width: 1160px; margin-inline: auto; display: grid; gap: 26px; }
.map-head h2, .lesson-head h2, .report-head h2 { font-size: clamp(34px, 8vw, 56px); margin: 4px 0 6px; }
.node-card {
  margin-top: 18px; display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--r);
  background: #fff; box-shadow: 0 14px 34px rgba(22, 50, 92, .12); border: 2px solid #eaf2f9;
}
.nc-ico { width: 56px; height: 56px; border-radius: 18px; flex: none; display: grid; place-items: center; font-size: 28px; color: #fff; background: var(--orange); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .15); }
.node-card > div { flex: 1; min-width: 0; }
.nc-unit { font-size: 14px; color: var(--ink2); font-weight: 600; }
.node-card h3 { font-size: 22px; }
.nc-meta { font-size: 14px; color: var(--green-d); font-weight: 700; }
.node-card .btn-play[hidden] { display: none; }
.path { position: relative; height: 1040px; max-width: 420px; width: 100%; margin-inline: auto; overflow-x: clip; overflow-clip-margin: 16px; /* the pulsing ring on the current stop must not widen a 320 phone */ }
.path-line { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.path-line path { fill: none; stroke-linecap: round; }
#path-d { stroke: #f7dfae; stroke-width: 26; }
#path-fill { stroke: var(--gold); stroke-width: 10; }
.nodes { list-style: none; margin: 0; padding: 0; position: absolute; inset: 0; }
.node { position: absolute; transform: translate(-50%, -42px); display: grid; justify-items: center; gap: 4px; width: 150px; }
.node button {
  width: 84px; height: 84px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center; font-size: 34px; color: #fff;
  background: radial-gradient(circle at 35% 30%, #4cd08f, var(--green) 60%); box-shadow: 0 8px 0 var(--green-d), 0 16px 26px rgba(21, 128, 79, .3);
  transition: translate .15s ease, box-shadow .15s ease;
}
.node button:active { translate: 0 5px; box-shadow: 0 3px 0 var(--green-d); }
.node.now { transform: translate(-50%, -52px); }
.node.now button { width: 104px; height: 104px; font-size: 42px; background: radial-gradient(circle at 35% 30%, #ffad6e, var(--orange) 60%); box-shadow: 0 9px 0 var(--orange-d), 0 18px 30px rgba(217, 88, 26, .38); }
.node.now::before { content: ''; position: absolute; top: 0; width: 104px; height: 104px; border-radius: 50%; border: 4px solid var(--orange); opacity: .5; animation: ring 1.8s ease-out infinite; }
@keyframes ring { from { scale: 1; opacity: .55; } to { scale: 1.5; opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .node.now::before { animation: none; } }
.node.lock button { background: radial-gradient(circle at 35% 30%, #e9eff5, #c9d6e2 60%); color: #7d8fa6; box-shadow: 0 8px 0 #a9b9c9, 0 14px 22px rgba(22, 50, 92, .12); }
.node.sel button { outline: 4px solid var(--ink); outline-offset: 4px; }
.node .lbl { font-weight: 800; font-size: 16px; background: rgba(255, 255, 255, .9); padding: 0 12px; border-radius: 12px; white-space: nowrap; }
.node .st { display: flex; gap: 2px; }
.node .st svg { width: 18px; height: 18px; fill: var(--gold); stroke: var(--gold-d); stroke-width: 1.2; }
.node .st svg.e { fill: #e3ebf3; stroke: #c3d1de; }
.node .me { position: absolute; top: -48px; width: 56px; height: 56px; object-fit: contain; filter: drop-shadow(0 6px 8px rgba(22, 50, 92, .25)); pointer-events: none; }

/* ---------- الدرس ---------- */
.lesson { padding: 50px 18px; max-width: 1160px; margin-inline: auto; }
.same { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.same span { direction: rtl; unicode-bidi: isolate; padding: 6px 16px; border-radius: 16px; background: #fff1d9; color: var(--orange-d); font-weight: 800; font-size: 24px; box-shadow: inset 0 -3px 0 rgba(217, 88, 26, .18); }
.same span.x { background: var(--green); color: #fff; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .15); }
.same i { font-style: normal; font-weight: 700; color: var(--ink2); }
.levels { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 18px; }
.lv { position: relative; background: #fff; border-radius: 26px; padding: 22px; box-shadow: 0 16px 36px rgba(22, 50, 92, .1); border: 2px solid #eef4fa; display: grid; gap: 8px; overflow: hidden; }
.lv h3 { font-size: 26px; }
.lv p { color: var(--ink2); }
.lv .btn-soft { justify-self: start; margin-top: 6px; }
.lv-n { position: absolute; inset-inline-start: 34px; top: 34px; z-index: 1; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; font-weight: 800; color: #fff; background: var(--ink); box-shadow: 0 6px 14px rgba(22, 50, 92, .3); }
.lv-art { margin: 0 0 8px; border-radius: 18px; overflow: hidden; aspect-ratio: 4 / 3; background: #dfeefa; }
.lv-art img { width: 100%; height: 100%; object-fit: cover; }
.lv-art img { width: 100%; height: 100%; object-fit: cover; }
.lv-art img { width: 100%; height: 100%; object-fit: cover; }
.lv-art img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- التقرير ---------- */
.report { padding: 50px 18px; max-width: 1160px; margin-inline: auto; }
.rep-grid { display: grid; gap: 16px; margin-top: 22px; }
.rep-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: #fff; border-radius: 20px; padding: 14px 10px; text-align: center; box-shadow: 0 10px 26px rgba(22, 50, 92, .08); display: grid; justify-items: center; }
.stat iconify-icon { font-size: 30px; color: var(--orange); }
.stat b { font-size: 30px; line-height: 1.2; }
.stat span { font-size: 13px; color: var(--ink2); font-weight: 600; line-height: 1.3; }
.rep-levels { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rep-levels li { background: #fff; border-radius: 18px; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; box-shadow: 0 8px 22px rgba(22, 50, 92, .06); font-weight: 700; }
.rep-levels .rn { font-style: normal; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; background: #eef5fc; margin-inline-end: 10px; font-size: 16px; }
.rep-levels .st { display: flex; gap: 3px; }
.rep-levels svg { width: 24px; height: 24px; fill: var(--gold); stroke: var(--gold-d); stroke-width: 1.2; }
.rep-levels svg.e { fill: #e3ebf3; stroke: #c3d1de; }
.rep-facts { background: #fff; border-radius: 24px; padding: 18px; box-shadow: 0 10px 26px rgba(22, 50, 92, .08); }
.rep-facts h3 { font-size: 22px; }
.legend { font-size: 14px; color: var(--ink2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 4px 0 12px; }
.legend .k { width: 14px; height: 14px; border-radius: 5px; display: inline-block; }
.legend .k + .k, .legend .k.re { margin-inline-start: 10px; }
.k.ok { background: #bfeccf; } .k.re { background: #ffd9a8; }
.facts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.facts li { padding: 6px 12px; border-radius: 12px; font-weight: 800; font-size: 17px; background: #bfeccf; color: #0f5a37; direction: rtl; }
.facts li.re { background: #ffd9a8; color: #7a3d00; }
.advice .fx { display: inline-block; padding: 0 10px; margin: 2px 3px; border-radius: 10px; background: #ffd9a8; color: #7a3d00; font-weight: 800; }
.advice { margin-top: 14px; padding: 12px 14px; border-radius: 16px; background: #eef7ff; color: var(--ink); font-weight: 600; }

/* ---------- الختام والتذييل ---------- */
.closing { text-align: center; padding: 60px 18px 70px; display: grid; justify-items: center; gap: 12px; }
.closing img { width: 120px; height: 120px; object-fit: contain; }
.closing h2 { font-size: clamp(34px, 8.5vw, 60px); }
.closing p { color: var(--ink2); font-size: 18px; max-width: 42ch; }
.closing .btn-play { margin-top: 8px; }
.foot { text-align: center; padding: 22px 18px 34px; display: grid; gap: 2px; color: var(--ink2); font-size: 14px; border-top: 1px solid #f0e2c4; }
.foot b { color: var(--ink); font-size: 17px; }

/* ---------- اللعبة ---------- */
.game { position: fixed; inset: 0; z-index: 60; background: linear-gradient(180deg, #8fd6ff 0, #c4ecff 42%, #e3f5ff 60%, #f6deaa 100%); overscroll-behavior: contain; }
.game[hidden] { display: none; }
#game3d { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.g-top { position: absolute; top: calc(10px + var(--safe-t)); inset-inline: 10px; display: flex; align-items: center; gap: 10px; z-index: 2; }
.g-x { width: 48px; height: 48px; border: 0; border-radius: 16px; background: rgba(255, 255, 255, .85); color: var(--ink); font-size: 28px; display: grid; place-items: center; cursor: pointer; box-shadow: 0 6px 16px rgba(22, 50, 92, .14); }
.g-steps { list-style: none; margin: 0; padding: 0; flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.g-steps li { position: relative; height: 30px; border-radius: 12px; background: rgba(255, 255, 255, .95); overflow: hidden; display: grid; place-items: center; box-shadow: inset 0 -3px 0 rgba(22, 50, 92, .08); }
/* المستوى الحالي: رقمه داكن ظاهر دائماً، وتقدّمه شريط رفيع أسفله. المنتهي يمتلئ أخضر */
.g-steps .fill { position: absolute; bottom: 0; height: 100%; inset-inline-start: 0; width: 100%; transform-origin: right center; transform: scaleX(0); background: linear-gradient(180deg, #4cd08f, var(--green)); transition: height .35s ease; }
.g-steps li.on { box-shadow: inset 0 0 0 2px var(--green); }
.g-steps li.on .fill { height: 5px; }
.g-steps b { position: relative; font-size: 16px; color: var(--ink2); }
.g-steps li.on b { color: var(--ink); font-weight: 800; }
.g-steps li.done b { color: #fff; }
.g-stars { display: flex; align-items: center; gap: 4px; min-height: 48px; padding: 0 12px; border-radius: 16px; background: linear-gradient(180deg, #fff6d6, #ffe7a3); color: #8a5a00; font-weight: 800; font-size: 19px; box-shadow: 0 6px 16px rgba(22, 50, 92, .12); }
.g-stars svg { width: 22px; height: 22px; fill: var(--gold); stroke: var(--gold-d); stroke-width: 1.2; }
.g-card {
  position: absolute; z-index: 2; inset-inline: 10px; bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-radius: 26px; padding: 14px 16px 16px; box-shadow: 0 18px 40px rgba(22, 50, 92, .2); display: grid; gap: 8px;
}
.g-head { display: flex; align-items: center; gap: 10px; }
.g-falcon { width: 52px; height: 52px; object-fit: contain; margin-top: -34px; filter: drop-shadow(0 6px 8px rgba(22, 50, 92, .2)); }
.g-kicker { font-size: 14px; font-weight: 700; color: var(--green-d); flex: 1; }
.g-say { width: 44px; height: 44px; border-radius: 14px; border: 0; background: #eef5fc; color: var(--ink); font-size: 22px; display: grid; place-items: center; cursor: pointer; }
.g-say[hidden] { display: none; }
.g-prompt { font-size: 23px; line-height: 1.3; }
.g-prompt.big { font-size: 40px; text-align: center; }
.g-eq { display: flex; justify-content: center; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 0; font-size: 26px; font-weight: 800; }
.g-eq:empty { display: none; }
.g-eq b { min-width: 46px; height: 46px; padding: 0 8px; border-radius: 14px; background: #fff1d9; color: var(--orange-d); display: grid; place-items: center; box-shadow: inset 0 -3px 0 rgba(217, 88, 26, .18); }
.g-eq i { font-style: normal; color: var(--ink2); }
.g-eq small { flex-basis: 100%; text-align: center; font-size: 15px; color: var(--ink2); font-weight: 600; }
.g-chips { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.g-chips:empty { display: none; }
.chip { display: inline-flex; gap: 4px; padding: 4px 12px; border-radius: 12px; background: #dff5e7; color: var(--green-d); font-weight: 800; font-size: 18px; }
.chip i { font-style: normal; } .chip b { font-weight: 800; }
.g-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.g-choices:empty { display: none; }
.choice {
  min-height: 62px; border: 0; border-radius: 18px; background: #fff; color: var(--ink); font-weight: 800; font-size: 28px; cursor: pointer;
  box-shadow: 0 5px 0 #cfe2f2, 0 0 0 2px #e3eef8 inset; display: flex; align-items: center; justify-content: center; gap: 3px; flex-wrap: wrap;
  transition: translate .12s ease, box-shadow .12s ease, background-color .2s ease;
}
.choice:active { translate: 0 3px; box-shadow: 0 2px 0 #cfe2f2, 0 0 0 2px #e3eef8 inset; }
.choice b { font-weight: 800; } .choice i { font-style: normal; color: var(--ink2); font-size: .8em; }
.g-choices:has(.choice b) { grid-template-columns: 1fr; }
.g-choices:has(.choice b) .choice { font-size: 24px; min-height: 52px; }
.choice.ok { background: var(--green); color: #fff; box-shadow: 0 5px 0 var(--green-d); }
.choice.ok i { color: #e3fff0; }
.choice.no { background: #ffe3d6; color: #a2410f; box-shadow: 0 5px 0 #f4b79b; }
.choice:disabled { cursor: default; }
.alt-row { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.ghost { min-height: 44px; padding: 4px 14px; border-radius: 14px; border: 2px solid #dbe8f3; background: #fff; font-weight: 700; font-size: 15px; cursor: pointer; color: var(--ink); }
.stepper { display: none; }
.sr-btn { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); padding: 0; border: 0; }
.sr-btn:focus-visible { position: static; width: auto; height: auto; clip: auto; padding: 4px 14px; border: 2px solid #dbe8f3; }
@media (hover: hover) and (pointer: fine) { .stepper { display: flex; } }
.g-hint { font-size: 15px; color: var(--ink2); font-weight: 600; text-align: center; min-height: 1.6em; }
.g-over { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 20px; background: rgba(22, 50, 92, .35); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.g-over[hidden] { display: none; }
.panel { position: relative; z-index: 1; width: min(100%, 420px); background: #fff; border-radius: 30px; padding: 26px 22px 24px; text-align: center; display: grid; gap: 10px; justify-items: center; box-shadow: 0 30px 60px rgba(22, 50, 92, .3); }
.panel .pl { font-weight: 700; color: var(--green-d); font-size: 16px; }
.panel h3 { font-size: 32px; }
.panel p { color: var(--ink2); }
.panel .btn-play { width: 100%; margin-top: 6px; }
.gd-btns { display: grid; gap: 10px; width: 100%; }
.gd-btns .btn-soft { width: 100%; }
.big-stars { display: flex; gap: 6px; align-items: flex-end; margin-top: -60px; }
.big-stars svg { width: 76px; height: 76px; fill: #e3ebf3; stroke: #c3d1de; stroke-width: 1; filter: drop-shadow(0 8px 10px rgba(22, 50, 92, .2)); }
.big-stars svg:nth-child(2) { width: 96px; height: 96px; }
.big-stars svg.got { fill: var(--gold); stroke: var(--gold-d); }
.dom-confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.dom-confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 3px; }
.fly-star { position: fixed; z-index: 80; width: 34px; height: 34px; pointer-events: none; left: 0; top: 0; }
.fly-star svg { width: 100%; height: 100%; fill: var(--gold); stroke: var(--gold-d); stroke-width: 1.2; filter: drop-shadow(0 4px 6px rgba(224, 154, 0, .5)); }
body.playing { overflow: hidden; }

/* ---------- الشاشات الصغيرة جداً ---------- */
@media (max-width: 350px) {
  .hero h1 { font-size: 44px; }
  .btn-play { font-size: 19px; padding-inline: 20px; }
  .choice { font-size: 24px; min-height: 56px; }
  .g-prompt { font-size: 20px; }
  .node { width: 130px; }
}

/* ---------- سطح المكتب ---------- */
@media (min-width: 900px) {
  body { font-size: 18px; }
  .hero { padding: 64px 48px 48px; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr auto; align-items: center; }
  .hero-copy { grid-column: 1; grid-row: 1; text-align: start; margin: 0; }
  .hero h1 { font-size: clamp(76px, 7.4vw, 120px); }
  .lede { font-size: 22px; }
  .hero-cta { grid-column: 1; grid-row: 2; flex-direction: row; justify-content: flex-start; align-self: start; margin-top: -120px; }
  .hero-cta .btn-play { width: auto; }
  .map { grid-template-columns: 1fr 1.1fr; align-items: start; padding-top: 100px; }
  .map-head { position: sticky; top: 48px; }
  .path { max-width: 520px; }
  .levels { grid-template-columns: repeat(3, 1fr); }
  .rep-grid { grid-template-columns: 1fr 1.3fr; align-items: start; }
  .rep-stats { grid-column: 1; grid-row: 1; }
  .rep-levels { grid-column: 1; grid-row: 2; }
  .rep-facts { grid-column: 2; grid-row: 1 / span 2; }
  .g-card { inset-inline: auto 24px; inset-inline-start: 24px; inset-inline-end: auto; top: 90px; bottom: auto; width: 400px; }
  .g-top { inset-inline: 24px; }
  .g-steps { max-width: 520px; margin-inline: auto; }
}

/* ---------- إصلاحات جولة التحكيم ---------- */
.pre .hero-copy, .pre .hero-cta { visibility: hidden; }
/* Baloo's glyphs are taller than the title's 1.15 line box: the hamza and alef of «ألعاب» rise about 0.3em above it, so on a wide
   screen (120px title) they ran into the eyebrow. The gap now grows with the title size */
.hero .eyebrow { margin-bottom: 0; position: relative; z-index: 1; }
.hero h1 { margin-top: .36em; }
.lede { text-wrap: balance; }
.btn-play svg { width: 24px; height: 24px; flex: none; }
.btn-play.sm svg { width: 20px; height: 20px; }
.g-snd svg { width: 24px; height: 24px; }
.g-snd { color: var(--ink); }
.g-snd .off { display: none; }
.g-snd[aria-pressed="false"] .on { display: none; }
.g-snd[aria-pressed="false"] .off { display: inline-block; }
.node button svg { width: 34px; height: 34px; }
.node.now button svg { width: 46px; height: 46px; margin-inline-start: 6px; }
.nc-ico svg { width: 28px; height: 28px; }
.g-top { z-index: 6; }
.g-card:focus { outline: none; }
.g-card:focus-visible { outline: none; }
.g-eq:has(.row) { flex-direction: column; gap: 6px; }
.g-card.keep-eq .g-eq:empty { display: flex; min-height: 46px; }
.g-eq .row { display: flex; justify-content: center; align-items: center; gap: 6px; flex-wrap: wrap; }
.g-eq .row.sm b { min-width: 34px; height: 34px; font-size: 18px; border-radius: 11px; }
.g-eq .row.sm i { font-size: 18px; }
.node-sheet {
  position: fixed; z-index: 40; inset-inline: 10px; bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 22px; background: #fff;
  box-shadow: 0 18px 44px rgba(22, 50, 92, .25); border: 2px solid #eaf2f9;
}
.node-sheet[hidden] { display: none; }
.node-sheet > div { flex: 1; min-width: 0; }
.node-sheet h3 { font-size: 20px; }
.node-sheet .nc-unit { font-size: 14px; color: var(--ink2); font-weight: 600; }
.node-sheet .nc-meta { font-size: 14px; color: var(--green-d); font-weight: 700; }
.node-sheet .btn-play[hidden] { display: none; }
.ns-x { width: 44px; height: 44px; border: 0; border-radius: 14px; background: #eef5fc; color: var(--ink); display: grid; place-items: center; flex: none; cursor: pointer; }
.ns-x svg { width: 20px; height: 20px; }
@media (min-width: 900px) { .node-sheet { display: none !important; } }
@media (max-width: 350px) {
  .stat b { font-size: 24px; }
  .stat b#rep-time { font-size: 19px; }
  .rep-levels li { font-size: 15px; padding: 10px 12px; }
}
/* جوال أفقي: البطاقة جانبية حتى يبقى المشهد ظاهراً */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 899px) {
  .g-card { inset-inline-start: 10px; inset-inline-end: auto; top: 64px; bottom: 8px; width: min(46vw, 380px); overflow-y: auto; gap: 4px; padding: 10px 12px; align-content: start; }
  .g-falcon { display: none; }
  .g-prompt { font-size: 18px; }
  .g-prompt.big { font-size: 28px; }
  .choice { min-height: 46px; font-size: 20px; }
  .g-choices:has(.choice b) .choice { min-height: 44px; font-size: 18px; }
  .g-eq b { min-width: 38px; height: 38px; font-size: 20px; }
  .g-top { top: 8px; }
}
.g-eq small { flex-basis: auto; width: 100%; }
@media (min-width: 900px) {
}

.advice { display: grid; gap: 6px; }
.advice .fxs { display: flex; flex-wrap: wrap; gap: 4px; }
.advice .fx { margin: 0; }
.g-stars.zero b { display: none; }
@media (max-width: 899px) { .hero .lede { max-width: 30ch; margin-inline: auto; } }

/* ---------- الجولة الثالثة: كل عنصر له مبرر ---------- */
#game3d, .game, .node button, .btn-play, .btn-soft { -webkit-tap-highlight-color: transparent; }
.rep-line { background: #fff; border-radius: 20px; padding: 16px 18px; font-size: 18px; line-height: 1.7; box-shadow: 0 10px 26px rgba(22, 50, 92, .08); }
.rep-line b { color: var(--orange-d); font-weight: 800; display: inline-block; }
.g-eq .row.faint b { opacity: .45; }
.g-eq .row.faint i { opacity: .5; }
.g-say { width: auto; min-width: 64px; padding: 0 14px; font-weight: 800; font-size: 16px; }
.g-head { min-height: 44px; }
/* لحظة الفوز: العالم المحتفل ظاهر خلف اللوحة، وبطاقة السؤال تختفي */
.game.celebrate .g-card { visibility: hidden; }
#g-done { background: rgba(22, 50, 92, .16); backdrop-filter: none; -webkit-backdrop-filter: none; }
.closing { padding-top: 40px; }
.hero h1 .hl { white-space: nowrap; direction: rtl; unicode-bidi: isolate; }
.node-card, .node-sheet { gap: 14px; }
@media (min-width: 900px) { .rep-line { grid-column: 1; grid-row: 1; } }

/* لوحة الفوز في الثلث السفلي، فيبقى العالم المحتفل ظاهراً */
#g-done { align-items: end; padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 900px) { #g-done { align-items: center; } }
.hero h1 .nw { white-space: nowrap; }
/* the star pill keeps its place from the start (hidden, not removed), so the top bar does not jump when it appears */
.g-stars.zero { display: flex; visibility: hidden; }
/* زر التسجيل العائم (أسفل اليسار): لا يغطي أزرار البطل ولا آخر الصفحة على الجوال */
@media (max-width: 899px) {
  .hero { padding-bottom: 88px; }
  .foot { padding-bottom: 96px; }
}

/* ---------- جولة الإطلاق (20 نوفمبر 2026) ---------- */
/* the 3D sky and its clouds fade into the page instead of ending on a hard line where the map starts */
#hero3d, .sky { -webkit-mask-image: linear-gradient(180deg, #000 80%, transparent); mask-image: linear-gradient(180deg, #000 80%, transparent); }
/* no single word alone on the last line */
#close-title, #gd-text, .g-prompt, #rep-line, .lv p { text-wrap: balance; }
/* the lesson pictures are taken from the games themselves (tools/shot/caplv13.js), already cropped */

/* ---------- بلا WebGL: صور بدل المشهد ---------- */
.hero-art { position: absolute; z-index: -1; left: 50%; top: 52%; width: min(86vw, 420px); height: auto; transform: translate(-50%, -50%); border-radius: 28px; box-shadow: 0 24px 50px rgba(22, 50, 92, .22); }
@media (min-width: 900px) { .hero-art { left: 28%; width: min(40vw, 520px); } }
.g-nogl { position: absolute; inset: 0; overflow-y: auto; padding: calc(80px + var(--safe-t)) 16px 24px; display: grid; align-content: start; gap: 10px; text-align: center; }
.g-nogl h2 { font-size: 24px; }
.g-nogl p { color: var(--ink2); max-width: 40ch; margin-inline: auto; }
.g-nogl ol { list-style: none; margin: 8px auto 0; padding: 0; display: grid; gap: 12px; width: min(100%, 980px); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.g-nogl li { background: rgba(255, 255, 255, .9); border-radius: 22px; padding: 8px 8px 12px; display: grid; gap: 6px; box-shadow: 0 10px 24px rgba(22, 50, 92, .12); }
.g-nogl img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 16px; }
.g-nogl b { justify-self: center; min-width: 32px; height: 32px; border-radius: 10px; background: var(--ink); color: #fff; display: grid; place-items: center; }
.g-nogl span { font-weight: 800; }
.game.nogl #game3d, .game.nogl .g-card, .game.nogl .g-steps, .game.nogl .g-stars, .game.nogl .g-snd, .game.nogl .g-over { display: none; }
.game.nogl .g-top { justify-content: flex-start; }

/* ---------- صفحة ألعاب المادة أولاً (21 نوفمبر 2026) ---------- */
/* البطل: اسم المادة والصف، ثم اللعبة المفتوحة الآن ورابط كل الوحدات */
.hero-now {
  width: min(100%, 400px); display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; padding-inline-start: 16px;
  border-radius: 24px; background: rgba(255, 255, 255, .92); border: 2px solid #fff; box-shadow: 0 14px 34px rgba(22, 50, 92, .16);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.hero-now > div { flex: 1; min-width: 0; }
.hero-now .nc-unit { font-size: 14px; color: var(--ink2); font-weight: 600; }
.hero-now h2 { font-size: 24px; }
.hero-now .btn-play { flex: none; }
.hero-cta .hero-now .btn-play { width: auto; }
/* سؤال الدرس في قسمه، بلون البطل */
.lesson-head h2 .hl { display: inline-block; color: var(--orange); white-space: nowrap; direction: rtl; unicode-bidi: isolate; text-shadow: 0 1px 0 #f06a20, 0 2px 0 #e9611b, 0 3px 0 #d65314, 0 8px 16px rgba(201, 75, 17, .25); }
.lesson-head h2 .nw { white-space: nowrap; }
.lesson-head .sub { font-weight: 600; }
/* المستوى ١: نعم / لا في عمودين، وأعداد السلال قبل أن تُعدّ */
.g-choices:has(> .choice:nth-child(2):last-child) { grid-template-columns: 1fr 1fr; }
.g-eq b.q { opacity: .45; }
@media (min-width: 900px) {
  .hero-cta { align-items: flex-start; flex-direction: column; margin-top: -60px; }
}
.advice:empty { display: none; }

/* short phones: the subtitle goes so the island keeps clear of the game card */
@media (max-height: 700px) and (max-width: 420px) { .hero .lede { display: none; } }

/* ---------- رحلة اللعب الجديدة (22 نوفمبر 2026) ---------- */
/* المهارة التي تدرّبها كل لعبة، للمعلم */
.lv-skill { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 15px; font-weight: 700; color: var(--green-d); }
.lv .lv-skill { color: var(--green-d); }
.lv-skill span { padding: 0 10px; border-radius: 10px; background: #dff5e7; font-size: 13px; }
/* في لعبة البالونات المسألة كبيرة، والتعليمة تحتها واضحة */
.g-prompt.big + .g-eq + .g-chips + .g-choices + .g-hint { font-size: 18px; color: var(--ink); font-weight: 700; }

/* ---------- 23 نوفمبر 2026: صفحة المنصة بلا شريط اللاعب، وزر العودة العائم ---------- */
/* زر «العودة لقائمة النماذج» ثابت أسفل اليسار (48px على بعد 16px). على الجوال تنتهي بطاقة السؤال ولوحة الفوز
   وبطاقة المحطة فوقه بـ 12px على الأقل، فلا يغطي سطر التلميح ولا الأزرار */
@media (max-width: 899px) and (min-height: 521px) {
  .g-card { padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px)); }
  #g-done { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
  .node-sheet { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- 23 نوفمبر 2026 مساءً: أحكام المحكّمين ---------- */
/* بطاقة المحطة تظهر بعد اختيار محطة فقط (على الحاسوب)، وعلى الجوال تكفي البطاقة السفلية */
.node-card[hidden] { display: none; }
@media (max-width: 899px) { .node-card { display: none; } }
/* حلقة المحطة الحالية زينة: اللمس يصل إلى زرها */
.node.now::before { pointer-events: none; }
/* كل زر يبدأ لعبة يحمل علامة التشغيل نفسها */
.btn-soft .i-play { width: 20px; height: 20px; flex: none; margin-inline-end: 8px; }
/* التقرير بلا سطر الملخص: صفوف الألعاب تبدأ من أعلى العمود */
@media (min-width: 900px) { .rep-levels { grid-row: 1; } .rep-facts { grid-row: 1; } }
/* الجوال: بين «كل الألعاب» و«خريطة المنهج» كان ~160px فارغة. البطل يترك مكان الزر العائم وحده (48 + 16 + 12)، والخريطة تبدأ بعده مباشرة */
@media (max-width: 899px) {
  .hero { padding-bottom: 76px; }
  .map { padding-top: 12px; }
}
.advice span { text-wrap: balance; }
