/* الخطوط: Alexandria للعناوين، IBM Plex Sans Arabic للنص، الرقعة للسبورة فقط */
@font-face { font-family: 'Alexandria'; src: url(/fonts/alexandria-arabic-600-normal.woff2) format('woff2'); font-weight: 600; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: 'Alexandria'; src: url(/fonts/alexandria-latin-600-normal.woff2) format('woff2'); font-weight: 600; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0300-0309, U+0323, U+2000-206F, U+20AC, U+2122, U+2190-2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Alexandria'; src: url(/fonts/alexandria-arabic-800-normal.woff2) format('woff2'); font-weight: 800; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: 'Alexandria'; src: url(/fonts/alexandria-latin-800-normal.woff2) format('woff2'); font-weight: 800; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0300-0309, U+0323, U+2000-206F, U+20AC, U+2122, U+2190-2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Plex'; src: url(/fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: 'Plex'; src: url(/fonts/ibm-plex-sans-arabic-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0300-0309, U+0323, U+2000-206F, U+20AC, U+2122, U+2190-2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Plex'; src: url(/fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2) format('woff2'); font-weight: 600; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: 'Plex'; src: url(/fonts/ibm-plex-sans-arabic-latin-600-normal.woff2) format('woff2'); font-weight: 600; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0300-0309, U+0323, U+2000-206F, U+20AC, U+2122, U+2190-2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Ruqaa'; src: url(/fonts/aref-ruqaa-arabic-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: 'Ruqaa'; src: url(/fonts/aref-ruqaa-latin-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0300-0309, U+0323, U+2000-206F, U+20AC, U+2122, U+2190-2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --board: #1D4A3C;
  --board-deep: #163A2F;
  --chalk: #F1F4EC;
  --frame: #9A6B43;
  --paper: #F1F4F2;
  --surface: #FFFFFF;
  --ink: #17232B;
  --muted: #5A6872;
  --line: #DCE3DF;
  --saffron: #F2AC2E;
  --saffron-deep: #D9921A;
  --danger: #C2412D;
  --ok: #2E8B57;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --head: 'Alexandria', 'Plex', system-ui, sans-serif;
  --body: 'Plex', system-ui, sans-serif;
  --chalkfont: 'Ruqaa', 'Alexandria', serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  min-height: 100dvh;
}
h1, h2, h3 { font-family: var(--head); font-weight: 800; line-height: 1.3; margin: 0; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--saffron); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- الهيكل ---------- */
.shell { max-width: 560px; margin: 0 auto; padding: 20px 18px 110px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.hello { font-family: var(--head); font-weight: 800; font-size: 1.35rem; }
.chip { display: inline-block; font-size: .82rem; font-weight: 600; padding: 3px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.section-title { font-size: 1.05rem; margin: 30px 0 12px; }

/* ---------- السبورة ---------- */
.board {
  position: relative;
  background:
    radial-gradient(ellipse at 20% 15%, rgba(255,255,255,.07), transparent 55%),
    radial-gradient(ellipse at 85% 80%, rgba(255,255,255,.05), transparent 50%),
    var(--board);
  color: var(--chalk);
  border: 9px solid var(--frame);
  border-radius: var(--r-lg);
  padding: 22px 22px 26px;
  box-shadow: inset 0 0 40px rgba(0,0,0,.25);
  margin-bottom: 16px;
}
.board::after { /* رفّ الطباشير */
  content: '';
  position: absolute;
  inset-inline: 18%;
  bottom: -9px;
  height: 7px;
  background: #7E5433;
  border-radius: 0 0 6px 6px;
}
.board .chalk-piece {
  position: absolute;
  bottom: -6px;
  inset-inline-start: 26%;
  width: 26px; height: 6px;
  background: var(--chalk);
  border-radius: 3px;
  z-index: 1;
}
.board-label { font-family: var(--body); font-size: .85rem; color: rgba(241,244,236,.72); }
.board-title {
  font-family: var(--chalkfont);
  font-weight: 700;
  font-size: clamp(1.7rem, 7vw, 2.25rem);
  line-height: 1.45;
  margin: 4px 0 6px;
  text-shadow: 0 0 1px rgba(241,244,236,.6);
}
.board-sub { font-size: .92rem; color: rgba(241,244,236,.8); }
.board .btn { margin-top: 18px; }

/* ---------- الأزرار والحقول ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 24px;
  border: 0; border-radius: var(--r-md);
  font-family: var(--head); font-weight: 600; font-size: 1rem;
  background: var(--saffron); color: var(--ink);
  cursor: pointer; transition: background .15s, transform .1s;
}
.btn:hover { background: var(--saffron-deep); }
.btn:active { transform: scale(.98); }
.btn[disabled] { background: #C9D1CD; color: #56625B; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); color: var(--ink); }
.btn.ghost:hover { background: var(--surface); }
.btn.small { min-height: 38px; padding: 0 14px; font-size: .9rem; border-radius: var(--r-sm); }
.btn.danger { background: transparent; border: 1.5px solid #E7C3BC; color: var(--danger); }

.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.input, select.input {
  width: 100%; min-height: 50px; padding: 0 14px;
  border: 1.5px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); outline: none;
}
.input:focus { border-color: var(--board); }
.input[dir=ltr] { text-align: left; }
.error { background: #FBEDEA; color: #8E2D1F; border-radius: var(--r-sm); padding: 10px 14px; font-size: .92rem; margin-bottom: 14px; }
.note { background: #E8F0EC; color: var(--board-deep); border-radius: var(--r-sm); padding: 10px 14px; font-size: .92rem; margin-bottom: 14px; }

/* ---------- المواد (دفاتر) ---------- */
.subjects { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.notebook {
  position: relative;
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 132px;
  background: var(--surface);
  border-radius: 8px var(--r-md) var(--r-md) 8px;
  border-inline-start: 10px solid var(--c);
  padding: 14px 14px 14px 12px;
  box-shadow: 0 1px 0 var(--line), 0 2px 0 #E5EAE7;
}
.notebook h3 { font-size: 1.08rem; font-weight: 600; }
.notebook .meta { font-size: .82rem; color: var(--muted); }
.notebook .bar { height: 6px; background: #EDF1EE; border-radius: 3px; overflow: hidden; margin-top: 10px; }
.notebook .bar i { display: block; height: 100%; background: var(--c); border-radius: 3px; }
.notebook.soon { opacity: .62; }
.notebook.soon .meta { font-weight: 600; }
a.notebook:hover { box-shadow: 0 1px 0 var(--line), 0 4px 12px rgba(23,35,43,.08); }

/* ---------- صفحة المادة ---------- */
.subject-head {
  background: var(--c); color: #fff;
  border-radius: var(--r-lg);
  padding: 22px 20px;
  margin-bottom: 8px;
}
.subject-head h1 { font-size: 1.6rem; }
.subject-head p { opacity: .9; font-size: .92rem; }
.back { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--muted); margin-bottom: 12px; padding: 6px 0; }
.chapter { margin-top: 26px; }
.chapter h2 { font-size: 1.05rem; margin-bottom: 4px; }
.chapter .count { color: var(--muted); font-size: .85rem; margin-bottom: 10px; }
.path { list-style: none; margin: 0; padding: 0; position: relative; }
.path::before { content: ''; position: absolute; inset-inline-start: 21px; top: 22px; bottom: 22px; width: 2px; background: var(--line); }
.path li a {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  padding: 8px 0;
}
.dot {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--head); font-weight: 600; font-size: .82rem;
  background: var(--surface); border: 2px solid var(--line); color: var(--muted);
  position: relative; z-index: 1;
}
.path li.done .dot { background: var(--c); border-color: var(--c); color: #fff; }
.path li.next .dot { border-color: var(--saffron); border-width: 3px; color: var(--ink); }
.path .lt { font-weight: 600; line-height: 1.45; }
.path .ls { font-size: .82rem; color: var(--muted); }
.path li a:hover .lt { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- صفحة الدرس ---------- */
.card { background: var(--surface); border-radius: var(--r-lg); padding: 20px; margin-top: 14px; }
.card h2 { font-size: 1.05rem; margin-bottom: 10px; }
.card ul { margin: 0; padding-inline-start: 20px; }
.card li { margin-bottom: 6px; }
.waiting { display: flex; gap: 12px; align-items: flex-start; }
.waiting svg { flex: none; margin-top: 3px; }

/* ---------- الحساب ---------- */
.rows { background: var(--surface); border-radius: var(--r-lg); padding: 4px 20px; }
.rows > div { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.rows > div:last-child { border-bottom: 0; }
.rows dt { color: var(--muted); }
.rows dd { margin: 0; font-weight: 600; text-align: end; }
.device { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.tag { font-size: .78rem; font-weight: 600; color: var(--ok); }

/* ---------- الشريط السفلي ---------- */
.tabbar {
  position: fixed; bottom: 0; inset-inline: 0;
  background: var(--surface);
  border-top: 1px solid var(--line);
  display: flex; justify-content: center;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 10;
}
.tabbar nav { display: flex; width: 100%; max-width: 560px; }
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 0 8px; font-size: .78rem; font-weight: 600; color: var(--muted);
}
.tabbar a[aria-current=page] { color: var(--board); }
.tabbar a[aria-current=page] svg { stroke: var(--board); }
.tabbar svg { width: 24px; height: 24px; stroke: var(--muted); }

/* ---------- الدخول ---------- */
.login { max-width: 440px; margin: 0 auto; padding: 32px 18px 40px; }
.login .board { text-align: center; padding: 30px 20px 34px; margin-bottom: 28px; }
.login .board-title { font-size: clamp(2rem, 9vw, 2.6rem); }
.help { text-align: center; color: var(--muted); font-size: .9rem; margin-top: 18px; }

.loading { padding: 60px 0; text-align: center; color: var(--muted); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media (min-width: 700px) {
  .shell { padding-top: 36px; }
  .subjects { grid-template-columns: 1fr 1fr 1fr; }
}

/* ---------- الدرس الحيّ ---------- */
.live { display: flex; flex-direction: column; min-height: 100dvh; max-width: 760px; margin: 0 auto; padding: 12px 14px calc(14px + env(safe-area-inset-bottom)); gap: 12px; }
.live-top { display: grid; grid-template-columns: auto 1fr auto; gap: 6px 12px; align-items: center; }
.live-exit { background: none; border: 1.5px solid var(--line); border-radius: 999px; padding: 4px 14px; font-weight: 600; font-size: .9rem; color: var(--muted); cursor: pointer; }
.live-title { font-family: var(--head); font-weight: 600; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-progress { grid-column: 1 / -1; height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.live-progress span { display: block; height: 100%; width: 0; background: var(--saffron); border-radius: 99px; transition: width .5s ease; }

.live-board {
  position: relative; flex: 1 1 auto; min-height: 36dvh; max-height: 52dvh; overflow-y: auto;
  background: radial-gradient(ellipse at 30% 20%, rgba(255,255,255,.06), transparent 60%), var(--board);
  border: 10px solid var(--frame); border-radius: var(--r-md);
  box-shadow: inset 0 0 30px rgba(0,0,0,.25); padding: 16px 18px 26px; color: var(--chalk);
}
.board-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.chalk { font-family: 'Alexandria', var(--chalkfont); font-weight: 600; font-size: clamp(1.15rem, 4.6vw, 1.5rem); line-height: 1.6; min-height: .8em; letter-spacing: .01em; text-shadow: 0 0 1px rgba(241,244,236,.6); animation: chalkIn .6s ease both; }
.chalk .bnote { font-family: var(--body); font-weight: 600; font-size: .78em; color: rgba(241,244,236,.78); }
.chalk.still { animation: none; }
.chalk.summary { font-family: var(--body); font-weight: 600; font-size: clamp(1rem, 4vw, 1.15rem); line-height: 1.8; }
.chalk.summary.review { color: #FFD08A; }
.teacher-say .m { font-family: 'Alexandria', var(--body); font-weight: 600; white-space: nowrap; unicode-bidi: isolate; }
.teacher-say .m sup, .chalk sup { font-size: .62em; vertical-align: .7em; line-height: 0; }
.teacher-say.fresh { animation: sayIn .35s ease both; }
@keyframes sayIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.chalk sup { font-size: .62em; vertical-align: .7em; }
.chalk.title { font-family: var(--chalkfont); font-size: clamp(1.5rem, 6vw, 2rem); color: #FFE7A8; text-align: center; }
.chalk.small { font-family: var(--body); font-weight: 400; font-size: 1rem; color: rgba(241,244,236,.85); }
.chalk.question { color: #FFE7A8; }
.chalk.ok { color: #A8E6B8; }
.chalk.bad { color: #F4A99B; text-decoration: line-through; text-decoration-thickness: 1px; }
@keyframes chalkIn { from { clip-path: inset(0 0 0 100%); opacity: .4; } to { clip-path: inset(0 0 0 0); opacity: 1; } }
.chalk[dir=ltr], .chalk:not([dir=rtl]) { animation-name: chalkInL; }
@keyframes chalkInL { from { clip-path: inset(0 100% 0 0); opacity: .4; } to { clip-path: inset(0 0 0 0); opacity: 1; } }

.live-teacher { display: flex; gap: 12px; align-items: flex-start; }
.teacher-face { flex: 0 0 52px; height: 52px; border-radius: 50%; background: var(--board); color: var(--chalk); display: grid; place-items: center; font-family: var(--chalkfont); font-size: 1.6rem; box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--line); transition: box-shadow .2s; }
.teacher-face.speaking { animation: talk 1s ease-in-out infinite; }
/* الحاسبة: السبورة كبيرة وهي البطل، والأستاذ وكلامه بعمود جانبي */
@keyframes talk { 0%,100% { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--saffron); } 50% { box-shadow: 0 0 0 3px var(--paper), 0 0 0 9px rgba(242,172,46,.35); } }
.teacher-say { flex: 1; background: var(--surface); border-radius: 4px var(--r-lg) var(--r-lg) var(--r-lg); padding: 12px 16px; min-height: 52px; font-size: 1.05rem; line-height: 1.75; }

.live-actions { min-height: 60px; transition: opacity .2s; }
.live-actions.busy { opacity: .45; }
.live-actions .choice { display: flex; flex-wrap: wrap; gap: 10px; }
.live-actions .choice .btn { flex: 1 1 160px; }
.answer { display: flex; flex-direction: column; gap: 10px; }
.answer .input { font-size: 1.2rem; text-align: center; font-family: 'Alexandria', var(--body); }
.answer.ask .input { text-align: start; font-family: var(--body); font-size: 1rem; resize: none; }
.keys { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; direction: ltr; }
.key { flex: 1 0 28px; max-width: 56px; direction: ltr; unicode-bidi: isolate; min-height: 42px; border: 1.5px solid var(--line); background: var(--surface); border-radius: var(--r-sm); font-family: 'Alexandria', var(--body); font-size: 1.15rem; cursor: pointer; }
.key:active { background: var(--paper); }
.thinking { color: var(--muted); text-align: center; padding: 14px; }

.live-help { display: flex; gap: 10px; position: sticky; bottom: 0; padding-top: 6px; background: linear-gradient(transparent, var(--paper) 30%); }
.help-btn { flex: 1; min-height: 44px; border-radius: 999px; border: 1.5px solid var(--board); background: var(--surface); color: var(--board); font-weight: 600; cursor: pointer; }
.help-btn:active { background: #E8F0EC; }

@media (min-width: 720px) { .live-board { min-height: 44dvh; } }
@media (prefers-reduced-motion: reduce) { .chalk, .teacher-face.speaking, .teacher-say.fresh { animation: none; } }

/* ---------- رسوم السبورة ---------- */
.chalk.visual { animation: none; padding: 4px 0; }
.vis { color: var(--chalk); }
.vis.groups { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; direction: ltr; }
.vis.groups .grp { display: grid; grid-template-columns: repeat(3, 12px); gap: 5px; padding: 8px; border: 2px dashed rgba(241,244,236,.55); border-radius: 12px; }
.vis i { display: block; width: 12px; height: 12px; border-radius: 50%; background: #FFE7A8; }
.vis.square { display: grid; grid-template-columns: repeat(var(--n), 14px); gap: 6px; justify-content: center; direction: ltr; }
.vis.square i { width: 14px; height: 14px; }
.vis.place, .vis.tbl { margin: 0 auto; border-collapse: collapse; font-family: 'Alexandria', var(--body); }
.vis.place th { font-family: var(--body); font-weight: 400; font-size: .62rem; color: rgba(241,244,236,.75); padding: 0 6px 4px; }
.vis.place td, .vis.tbl td { border: 1.5px solid rgba(241,244,236,.5); min-width: 36px; padding: 4px 8px; text-align: center; font-size: 1.25rem; }
.vis.place td.hl { color: #2B1B05; background: #FFD08A; }
.vis.tbl td { font-size: 1.05rem; }
.vis.area, .vis.numline { display: block; width: 100%; max-width: 360px; margin: 0 auto; }
.vis.area rect { fill: rgba(255,231,168,.12); stroke: var(--chalk); stroke-width: 2; }
.vis.area text, .vis.numline text { fill: var(--chalk); font-family: 'Alexandria', sans-serif; font-size: 13px; text-anchor: middle; }
.vis.area text.in { font-size: 17px; fill: #FFE7A8; font-weight: 600; }
.vis.numline line { stroke: var(--chalk); stroke-width: 2; }
.vis.numline path { fill: none; stroke: #FFE7A8; stroke-width: 2; }
.vis.numline text.j { fill: #FFE7A8; font-size: 12px; }
.live .m { white-space: nowrap; unicode-bidi: isolate; direction: ltr; display: inline-block; }

/* ---------- الاستراحة ---------- */
.live { position: relative; }
.live-rest { background: #FFF4DC; border: 1.5px solid var(--saffron); color: #7A4E00; border-radius: 999px; padding: 4px 12px; font-weight: 600; font-size: .85rem; cursor: pointer; white-space: nowrap; }
.live-break { position: fixed; inset: 0; z-index: 50; background: rgba(15, 40, 32, .55); display: grid; place-items: center; padding: 18px; }
.live-break[hidden] { display: none; }
.break-card { width: min(460px, 100%); max-height: 90dvh; overflow-y: auto; background: var(--surface); border-radius: var(--r-lg); padding: 22px 20px 18px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 50px rgba(0,0,0,.25); animation: sayIn .3s ease both; }
.break-card .teacher-face { align-self: center; flex: none; width: 52px; height: 52px; }
.break-line { margin: 0; font-size: 1.08rem; line-height: 1.8; text-align: center; }
.break-line.lead { font-weight: 600; }
.break-line.item { background: #FFF8E7; border-radius: var(--r-md); padding: 14px; font-size: 1.15rem; }
.break-line.answer { color: var(--board); font-weight: 700; }
.break-card .choice { display: flex; flex-wrap: wrap; gap: 10px; }
.break-card .choice .btn { flex: 1 1 140px; }
.breath { width: 90px; height: 90px; border-radius: 50%; background: radial-gradient(circle, #A8E6B8, var(--board)); align-self: center; transform: scale(.6); transition: transform 4s ease-in-out; }
.breath.in, .breath.hold { transform: scale(1.15); }
.breath.out { transform: scale(.6); }
@media (prefers-reduced-motion: reduce) { .breath { transition: none; } .break-card { animation: none; } }

/* ---------- كلام الأستاذ الطبيعي ---------- */
.teacher-col { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.teacher-say .w { transition: opacity .25s ease, color .25s ease; }
.teacher-say .w.dim { opacity: .22; }
.teacher-say .w.on { opacity: 1; }
.live-prefs { display: flex; gap: 8px; justify-content: flex-start; }
.pref { background: none; border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: .78rem; color: var(--muted); cursor: pointer; }
.pref[hidden] { display: none; }
.thinking-dots { color: var(--muted); }
.thinking-dots::after { content: '…'; display: inline-block; animation: dots 1s steps(3) infinite; width: 1.2em; overflow: hidden; vertical-align: bottom; }
@keyframes dots { from { width: 0; } to { width: 1.2em; } }
@media (prefers-reduced-motion: reduce) { .teacher-say .w { transition: none; } .thinking-dots::after { animation: none; } }

/* ---------- أزرار التحكم وتنبيه الصوت ---------- */
.live-prefs { flex-wrap: wrap; }
.pref.on { background: var(--board); color: var(--chalk); border-color: var(--board); }
.voice-note { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: #FFF4DC; border: 1px solid var(--saffron); border-radius: var(--r-sm); padding: 6px 10px; font-size: .85rem; }
.voice-note[hidden] { display: none; }
.chalk.flash { background: rgba(255,231,168,.16); border-radius: 6px; outline: 2px dashed rgba(255,231,168,.6); outline-offset: 2px; }
.explain-help { display: flex; flex-wrap: wrap; gap: 8px; }
.explain-help[hidden] { display: none; }
.explain-help .pref { border-color: var(--saffron); }
.explain-help .pref:disabled { opacity: .6; }

/* الأستاذ المرسوم: خلف السبورة وقت الشرح، وقدّام الطالب وقت الحوار */
.board-wrap { position: relative; flex: 1 1 auto; display: flex; flex-direction: column; min-height: 36dvh; max-height: 52dvh; }
.board-wrap .live-board { flex: 1 1 auto; min-height: 0; max-height: none; }
.live.stage-explain .live-board { padding-bottom: 84px; }
/* التلفون: وقت الشرح السبورة تطول للأسفل وتاخذ الفراغ اللي تحت الأزرار. إذا ظهر حقل جواب ترجع لحجمها حتى يبقى الحقل والأزرار ظاهرة */
@media (max-width: 899px) {
  .live.stage-explain .board-wrap { min-height: 62dvh; max-height: 66dvh; }
  .live.stage-explain:has(.live-actions input, .live-actions .keys, .live-actions textarea) .board-wrap { min-height: 36dvh; max-height: 52dvh; }
}
.teacher-col { flex: 1 1 auto; min-width: 0; }
.t-svg { width: 100%; height: 100%; display: block; }
.t-svg .t-eyes { transform-box: fill-box; transform-origin: center; animation: blink 5.5s infinite; }
.t-svg .t-mouth-open { opacity: 0; transition: opacity .06s; }
.live.mo .t-svg .t-mouth-open { opacity: 1; }
.live.mo .t-svg .t-mouth { opacity: 0; }
@keyframes blink { 0%, 95%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }
.teacher-face { overflow: hidden; background: #E9E2D3; }
.teacher-face .t-svg { width: 118%; height: 118%; margin-top: 10%; }
.teacher-peek { position: absolute; left: -12px; bottom: 6px; width: 74px; height: 82px; pointer-events: none;
  transition: transform .45s cubic-bezier(.2,.8,.2,1), opacity .35s; transform-origin: bottom left; filter: drop-shadow(0 4px 6px rgba(0,0,0,.25)); }
.live.talking .teacher-peek { animation: peekTalk 2.4s ease-in-out infinite; }
@keyframes peekTalk { 0%,100% { transform: rotate(0deg); } 50% { transform: rotate(-2.5deg) translateY(-1px); } }
/* وقت الحوار: يختفي من خلف السبورة ويطلع كبير جنب كلامه */
.live.stage-dialog .teacher-peek { opacity: 0; transform: translateY(24px) scale(.8); }
.live { overflow-x: clip; }
.live.stage-explain .teacher-face { flex-basis: 40px; height: 40px; opacity: .0; width: 0; flex-basis: 0; margin: 0; box-shadow: none; }
.live.stage-dialog .teacher-face { flex: 0 0 96px; height: 96px; border-radius: 22px; }
.teacher-face { transition: flex-basis .45s cubic-bezier(.2,.8,.2,1), height .45s, opacity .3s; }
.live.stage-dialog .teacher-face.speaking { animation: none; box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--saffron); }
.answer-row { display: flex; gap: 8px; align-items: stretch; }
.answer-row .input { flex: 1; min-width: 0; }
.mic { flex: 0 0 52px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--paper); display: grid; place-items: center; cursor: pointer; }
.mic svg { width: 24px; height: 24px; fill: var(--board); }
.mic.on { background: var(--saffron); animation: talk 1s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .t-svg .t-eyes, .live.talking .teacher-peek { animation: none; } } 
/* ---------- الحاسبة: سبورة كبيرة ---------- */
@media (min-width: 900px) {
  .live { max-width: 1320px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 380px); grid-template-rows: auto auto 1fr; column-gap: 24px; row-gap: 14px; align-items: start; }
  .live-top { grid-column: 1 / -1; }
  .board-wrap { grid-column: 1; grid-row: 2 / span 2; min-height: 74dvh; max-height: 78dvh; }
  .live-teacher { grid-column: 2; grid-row: 2; flex-direction: column; align-items: stretch; }
  .live-actions { grid-column: 2; grid-row: 3; }
  .chalk { font-size: clamp(1.4rem, 1.9vw, 2rem); }
  .chalk.title { font-size: clamp(1.8rem, 2.6vw, 2.6rem); }
  .live.stage-dialog .teacher-face { flex: 0 0 auto; width: 100%; height: 230px; }
  .teacher-peek { width: 120px; height: 132px; }
  .live.has-photo .teacher-peek { width: 150px; height: 150px; }
  .live.stage-explain .live-board { padding-bottom: 24px; padding-left: 140px; }
  .live.has-photo.stage-explain .live-board { padding-left: 170px; }
}

/* ---------- صورة الأستاذ من HeyGen ---------- */
.t-photo { position: relative; width: 100%; height: 100%; overflow: hidden; border-radius: inherit; background: #1d2a24; }
.t-photo img, .t-photo .t-vid { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; }
.t-photo .t-vid.talk { opacity: 0; transition: opacity .18s; }
.live.talking .t-photo .t-vid.talk { opacity: 1; }
.live.has-photo .teacher-peek { border-radius: 16px; overflow: hidden; border: 3px solid #A87749; background: #1d2a24; width: 92px; height: 92px; left: 8px; bottom: 8px; filter: drop-shadow(0 6px 10px rgba(0,0,0,.35)); }
.live.has-photo.stage-explain .live-board { padding-bottom: 110px; }
.live.has-photo .teacher-face { background: #1d2a24; }
.live.has-photo .teacher-face .t-photo { border-radius: inherit; }

/* ---------- فيديو الترحيب ---------- */
.intro-video { position: absolute; inset: 0; z-index: 5; border-radius: var(--r-md, 18px); overflow: hidden; background: #111; display: grid; place-items: center; transition: transform .45s cubic-bezier(.2,.8,.2,1), opacity .45s; transform-origin: bottom left; }
.intro-video video { width: 100%; height: 100%; object-fit: cover; }
.intro-video.out { transform: scale(.18); opacity: 0; }
.intro-play { position: absolute; padding: 14px 22px; border-radius: 999px; border: 0; background: var(--saffron); font: inherit; font-weight: 700; font-size: 1.1rem; cursor: pointer; }
.intro-skip { position: absolute; top: 10px; left: 10px; padding: 6px 12px; border-radius: 999px; border: 1px solid rgba(255,255,255,.5); background: rgba(0,0,0,.45); color: #fff; font: inherit; font-size: .9rem; cursor: pointer; }
.live.stage-intro .live-teacher .teacher-face { opacity: 0; width: 0; flex-basis: 0; }

/* ---------- إيد الطباشير ---------- */
.chalk.hw { animation: none; }
.chalk.hw .wr { position: relative; display: inline-block; max-width: 100%; }
.chalk.hw .ink { display: inline-block; animation: chalkInL var(--dur, 1s) linear backwards; }
.chalk.hw[dir=rtl] .ink { animation-name: chalkIn; }
.chalk-hand { position: absolute; top: 30%; width: 44px; height: 44px; pointer-events: none; z-index: 2; filter: drop-shadow(0 3px 3px rgba(0,0,0,.35)); animation: handL var(--dur, 1s) linear both; }
.chalk.hw[dir=rtl] .chalk-hand { animation-name: handR; }
.chalk-hand svg { width: 100%; height: 100%; display: block; }
.chalk-hand.gone { opacity: 0; transition: opacity .3s; }
@keyframes handL { from { left: -8px; } to { left: calc(100% - 8px); } }
@keyframes handR { from { left: calc(100% - 8px); } to { left: -8px; } }
@media (prefers-reduced-motion: reduce) { .chalk-hand { display: none; } .chalk.hw .ink { animation: none; } }

/* ---------- فقاعة الكلام: تنشال وقت الشرح، وترجع بس إذا الصوت ما يشتغل ---------- */
.live.stage-explain:not(.captions) .teacher-say { display: none; }

/* ---------- وسائل الإيضاح على السبورة ---------- */
.tk { position: relative; display: inline-block; padding: 0 .08em; transition: color .3s, opacity .3s; }
.tk.c-blue { color: #8EC9FF; }
.tk.c-orange { color: #FFB86B; }
.tk.c-green { color: #A5E8A0; }
.tk.ring::after { content: ''; position: absolute; inset: -.06em -.3em; border: 2.5px solid #F2C14E; border-radius: 50%; transform: rotate(-4deg); animation: ringIn .55s ease-out both; pointer-events: none; }
.tk.ring-green::after { border-color: #A5E8A0; border-width: 3px; }
.tk.ans { font-weight: 800; }
@keyframes ringIn { from { clip-path: inset(0 100% 0 0); opacity: .3; } to { clip-path: inset(0 0 0 0); opacity: 1; } }
.tk.struck { text-decoration: line-through; text-decoration-color: #FF8A80; text-decoration-thickness: 3px; opacity: .7; }
.chalk.past { opacity: .45; transition: opacity .4s; }
.chalk.past .tk.ring::after { opacity: .5; }
.scene-arrows { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; z-index: 1; }
.scene-arrows .arr { fill: none; stroke-width: 2.4; stroke-linecap: round; }
.scene-arrows .past { opacity: .35; }

/* المستطيل اللي يتقسّم */
.area-model, .dots-model { width: min(100%, 420px); margin: 4px auto; }
.area-svg, .dots-svg { width: 100%; height: auto; display: block; overflow: visible; font-family: 'Alexandria', var(--chalkfont); }
.area-svg .frame { fill: none; stroke: #F1F4EC; stroke-width: 2.5; }
.area-svg .grid line { stroke: rgba(241,244,236,.28); stroke-width: 1; }
.area-svg .part { opacity: 0; transition: opacity .6s; }
.area-svg text { fill: #F1F4EC; font-size: 15px; font-weight: 700; text-anchor: middle; }
.area-svg .side { text-anchor: end; }
.area-svg .tops text, .area-svg .labs text, .area-svg .splits line { opacity: 0; transition: opacity .5s; }
.area-svg .split { stroke: #F2C14E; stroke-width: 3; stroke-dasharray: 6 5; }
.area-svg .labs text { fill: #10241B; font-size: 14px; }
.area-model.stage1 .part { opacity: .22; }
.area-model.stage1 .tops text, .area-model.stage1 .splits line { opacity: 1; }
.area-model.stage1 .whole { opacity: 0; }
.area-model.fill0 .part.p0, .area-model.fill1 .part.p1 { opacity: .85; }
.area-model.fill0 .labs .l0, .area-model.fill1 .labs .l1 { opacity: 1; }
.area-svg .whole, .area-svg .part { transition: opacity .5s; }

/* النقاط بمجموعات */
.dots-svg .dot { fill: #F1F4EC; transition: fill .5s, opacity .5s; }
.dots-svg text { fill: #F1F4EC; font-size: 15px; font-weight: 700; text-anchor: middle; }
.dots-svg .split { stroke: #F2C14E; stroke-width: 3; stroke-dasharray: 6 5; opacity: 0; transition: opacity .5s; }
.dots-svg .labs text { opacity: 0; transition: opacity .5s; }
.dots-model.stage1 .split { opacity: 1; }
.dots-model.stage1 .dot { opacity: .45; }
.dots-model.fill0 .dot.g0, .dots-model.fill1 .dot.g1 { opacity: 1; }
.dots-model.fill0 .labs .l0, .dots-model.fill1 .labs .l1 { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .tk.ring::after { animation: none; } }

.chalk.split-line { margin-top: .9em; }

/* أرقام تطير لمكانها الجديد، وقوس تحت الرقمين اللي يكمّلون بعض */
.chalk.fly-line { animation: none; }
.tk.flying { z-index: 3; }
.tk.pop { animation: tkPop .55s .55s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes tkPop { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.chalk.has-brace { position: relative; padding-bottom: 1.9em; }
.brace { position: absolute; display: block; height: 1.7em; pointer-events: none; }
.brace i { position: absolute; left: 0; right: 0; top: .15em; height: .55em; border: 2.5px solid currentColor; border-top: 0; border-radius: 0 0 12px 12px; animation: braceIn .5s ease-out both; }
.brace b { position: absolute; left: 50%; top: .65em; transform: translateX(-50%); font-size: .85em; white-space: nowrap; direction: rtl; unicode-bidi: isolate; animation: tkPop .45s .35s cubic-bezier(.3,1.6,.5,1) both; }
.brace-green { color: #A5E8A0; } .brace-blue { color: #8EC9FF; } .brace-orange { color: #FFB86B; }
@keyframes braceIn { from { clip-path: inset(0 50% 0 50%); } to { clip-path: inset(0 0 0 0); } }
@media (prefers-reduced-motion: reduce) { .tk.pop, .brace i, .brace b { animation: none; } }

/* أسهم عليها كتابة (÷ 2) */
.scene-arrows .arr-lab { font: 700 15px 'Alexandria', sans-serif; unicode-bidi: plaintext; }
/* المكعب: القطع تنبني وحدة وحدة */
.cube-model { width: min(100%, 260px); margin: 2px auto; }
.cube-svg { width: 100%; height: auto; display: block; }
.cube-svg .cb { animation: tkPop .45s cubic-bezier(.3,1.5,.5,1) both; transform-box: fill-box; transform-origin: center; }
/* القيمة المكانية: الأرقام تزحف خانة لليسار كل ما نضرب في 10 */
.chalk.pv-row { text-align: right; padding-right: 22%; font-variant-numeric: tabular-nums; letter-spacing: .12em; }
@media (prefers-reduced-motion: reduce) { .cube-svg .cb { animation: none; } }
/* «اسأل الأستاذ» بالصوت */
.coach { display: grid; gap: .6rem; }
.coach-mic { display: flex; align-items: center; gap: .8rem; }
.mic.big { flex: 0 0 64px; width: 64px; height: 64px; border-radius: 50%; font-size: 1.6rem; background: var(--saffron); border: 0; }
.mic.big.on { background: #d9534f; color: #fff; }
.coach-q { margin: 0; font-weight: 600; }
.choice.col { display: flex; flex-direction: column; align-items: stretch; }
.choice.col .btn { flex: 0 0 auto; }
.coach-face { position: fixed; inset-inline-end: 12px; bottom: 120px; width: 150px; aspect-ratio: 1; border-radius: 18px; overflow: hidden; box-shadow: 0 8px 24px rgba(0,0,0,.25); z-index: 30; background: #222; }
.coach-face video { width: 100%; height: 100%; object-fit: cover; }
.coach-face[hidden] { display: none; }

/* ---------- «امتحان تجريبي»: ورقة مثل ورقة المدرسة ---------- */
.exam { padding-bottom: 120px; }
.exam .back { display: inline-block; margin-bottom: 10px; }
.exam-entry h2 { margin: 0 0 6px; font-size: 1.1rem; }
.exam-entry p { margin: 0 0 12px; color: var(--muted); }
.ex-cover { background: var(--surface); border-radius: var(--r-lg); padding: 22px 20px; border-top: 6px solid var(--board); }
.ex-cover h1 { font-family: var(--chalkfont, 'Ruqaa'), serif; font-size: 1.9rem; margin: 0; color: var(--board); }
.ex-sub { color: var(--muted); margin: 4px 0 14px; }
.ex-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 14px; }
.ex-facts div { background: var(--paper); border-radius: 12px; padding: 10px 6px; text-align: center; }
.ex-facts dt { font-size: .8rem; color: var(--muted); }
.ex-facts dd { margin: 2px 0 0; font-weight: 700; font-size: 1.15rem; }
.ex-rules { margin: 0 0 18px; padding-inline-start: 18px; line-height: 1.9; }
.ex-hist { margin-top: 18px; }
.ex-hist h2 { font-size: 1rem; margin: 0 0 8px; }
.ex-hrow { display: flex; justify-content: space-between; width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 6px; font: inherit; color: inherit; cursor: pointer; }

.ex-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; background: var(--board); color: var(--chalk); padding: 8px 12px; border-radius: 0 0 14px 14px; margin: 0 -4px 12px; box-shadow: 0 2px 0 var(--frame); }
.ex-t { font-family: 'Alexandria', sans-serif; font-weight: 800; font-size: 1.35rem; direction: ltr; min-width: 4.2ch; }
.ex-t.low { color: #FFB4A3; animation: exPulse 1s ease-in-out infinite; }
@keyframes exPulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .ex-t.low { animation: none; } }
.ex-done { flex: 1; font-size: .85rem; opacity: .85; }

.ex-sheet { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 18px 16px 22px; box-shadow: 0 1px 0 var(--line), 0 6px 0 -3px #fff, 0 6px 0 -2px var(--line); }
.ex-sheet.busy { opacity: .55; pointer-events: none; }
.ex-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; font-size: .9rem; border-bottom: 2px solid var(--ink); padding-bottom: 8px; }
.ex-title { text-align: center; font-family: var(--chalkfont, 'Ruqaa'), serif; font-size: 1.5rem; margin: 10px 0 4px; }
.ex-note { font-size: .92rem; margin: 0 0 6px; text-decoration: underline; text-underline-offset: 5px; text-decoration-color: var(--line); }
.ex-q { border-top: 1.5px solid var(--ink); padding-top: 10px; margin-top: 12px; }
.ex-q > header { display: flex; align-items: baseline; gap: 8px; }
.ex-q h2 { font-family: var(--chalkfont, 'Ruqaa'), serif; font-size: 1.35rem; margin: 0; }
.ex-marks { margin-inline-start: auto; font-size: .82rem; color: var(--muted); white-space: nowrap; }
.ex-part { margin-top: 8px; }
.ex-head { display: flex; align-items: baseline; gap: 6px; margin: 0 0 4px; font-weight: 600; }
.ex-lab { font-family: 'Alexandria', sans-serif; display: inline-grid; place-items: center; width: 1.6em; height: 1.6em; border: 1.5px solid var(--ink); border-radius: 50%; font-size: .8rem; flex: none; }
.ex-items { margin: 0; padding-inline-start: 22px; }
.ex-items li { padding: 6px 0; }
.ex-text { display: block; }
.ex-text .m, .ex-res .m { font-family: 'Alexandria', sans-serif; }
.ex-text sup, .ex-res sup { font-size: .65em; }
.ex-in { width: 100%; max-width: 260px; margin-top: 4px; font: 600 1.1rem 'Alexandria', sans-serif; border: 0; border-bottom: 2px dotted #9AA6A0; background: transparent; padding: 4px 2px; color: var(--ink); text-align: left; }
.ex-in:focus { outline: none; border-bottom: 2px solid var(--saffron-deep); background: #FFF8E9; }
.ex-in::placeholder { color: #B8C1BC; font-weight: 400; font-size: .9rem; }
.ex-end { text-align: center; margin: 22px 0 0; font-family: var(--chalkfont, 'Ruqaa'), serif; color: var(--muted); }

.ex-keys { display: none; flex-wrap: wrap; justify-content: flex-start; gap: 6px; padding: 6px 0 2px; direction: ltr; }
.ex-keys.on { display: flex; }
.ex-keys .key { direction: ltr; unicode-bidi: isolate; min-width: 38px; min-height: 40px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font: 700 1.1rem 'Alexandria', sans-serif; color: var(--ink); }
.ex-confirm { position: fixed; inset: 0; background: rgba(23,35,43,.45); display: grid; place-items: center; z-index: 9; padding: 18px; }
.ex-confirm[hidden] { display: none; }
.ex-dlg { background: #fff; border-radius: var(--r-lg); padding: 20px; max-width: 360px; width: 100%; }
.ex-dlg p { margin: 0 0 14px; font-weight: 600; }
.ex-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ex-row.end { margin-top: 18px; }
.ex-row .ex-in { flex: 1; max-width: 200px; margin: 0; }
.ex-flash { background: #FBE9E5; color: var(--danger); border-radius: 12px; padding: 10px 14px; margin-top: 12px; }

.ex-score { background: var(--board); color: var(--chalk); border-radius: var(--r-lg); padding: 20px; text-align: center; border: 6px solid var(--frame); }
.ex-score .ex-sub { color: rgba(241,244,236,.8); }
.ex-big { margin: 0; font-family: 'Alexandria', sans-serif; display: flex; align-items: baseline; justify-content: center; gap: 8px; }
.ex-big b { font-size: 4rem; font-weight: 800; color: #FFE7A8; line-height: 1.1; }
.ex-big span { font-size: 1.1rem; opacity: .8; }
.ex-weak { color: #FFD08A; font-weight: 600; }
.ex-qsum { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.ex-qsum li { background: rgba(255,255,255,.08); border-radius: 10px; padding: 6px 2px; display: flex; flex-direction: column; font-size: .85rem; }
.ex-qsum b { font-family: 'Alexandria', sans-serif; }
.ex-q.review { background: #fff; border-radius: 12px; border-top: 0; padding: 12px 14px; }
.ex-q.review li.ok .ex-res { color: var(--ok); }
.ex-q.review li.bad .ex-res, .ex-q.review li.skip .ex-res { color: var(--danger); }
.ex-res { display: block; font-weight: 600; margin: 2px 0 6px; }
.ex-fix { margin-top: 8px; }
.ex-fix .mini-board { position: relative; background: var(--board); color: var(--chalk); border-radius: 14px; padding: 12px 14px 16px; min-height: 120px; max-height: 55vh; overflow: auto; border: 6px solid var(--frame); }
.ex-say { margin: 6px 2px 10px; color: var(--ink); line-height: 1.8; min-height: 1.8em; }
.ex-check { background: var(--paper); border-radius: 12px; padding: 10px 12px; margin-top: 8px; }
.ex-check > p { margin: 0 0 8px; }
.ex-fb { margin: 6px 0 0; font-weight: 600; }
.ex-fb.ok { color: var(--ok); }
.ex-fb.bad { color: var(--danger); }
.ex-teach { margin: 14px 0 4px; }
.input[dir=ltr]:placeholder-shown { text-align: right; direction: rtl; }

/* أسطر الرياضيات على السبورة: من اليسار بكل المتصفحات، حتى التفكيك والأسهم ينحسبون صح */
.board-lines .chalk[dir=ltr] { text-align: left; }
.board-lines .chalk.split-line { white-space: nowrap; }
.live-board, .mini-board { overflow-x: hidden; }

/* ---------- الدرس 1-2: سلّم ترتيب العمليات، وخط الأعداد ---------- */
.chalk.ladder-line { position: sticky; top: -16px; z-index: 2; background: var(--board); padding: 4px 0 6px; margin: -4px 0 4px; animation: none; }
.vis.ladder { display: flex; align-items: stretch; justify-content: center; gap: 4px; flex-wrap: nowrap; font-family: var(--body); }
.vis.ladder .rg { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 0; padding: 4px 8px; border-radius: 10px; border: 1.5px dashed rgba(241,244,236,.35); color: rgba(241,244,236,.7); transition: background .3s, color .3s, border-color .3s; }
.vis.ladder .rg b { font-size: .7rem; font-weight: 600; opacity: .75; }
.vis.ladder .rg em { font-style: normal; font-family: 'Alexandria', sans-serif; font-weight: 700; font-size: 1rem; white-space: nowrap; }
.vis.ladder .rg small { font-size: .62rem; opacity: .8; white-space: nowrap; }
.vis.ladder .rg.on { background: rgba(255,184,107,.2); border: 1.5px solid #FFB86B; color: #FFE7A8; }
.vis.ladder .rg.done { border-style: solid; border-color: rgba(165,232,160,.55); color: #A5E8A0; }
.vis.ladder .rg.done.on { border-color: #FFB86B; color: #FFE7A8; }
.vis.ladder i { align-self: center; font-style: normal; opacity: .5; font-size: .9rem; }
@media (max-width: 420px) { .vis.ladder .rg { padding: 3px 5px; } .vis.ladder .rg em { font-size: .88rem; } .vis.ladder i { display: none; } }
.vis.nl-model { width: 100%; max-width: 520px; margin: 0 auto; }
.numline { width: 100%; height: auto; overflow: visible; }
.numline .nl-axis { stroke: rgba(241,244,236,.85); stroke-width: 2; }
.numline .nl-head { fill: rgba(241,244,236,.85); }
.numline .nl-tick { stroke: rgba(241,244,236,.7); stroke-width: 1.5; }
.numline .nl-tick.zero { stroke: #FFE7A8; stroke-width: 2.5; }
.numline .nl-num { fill: rgba(241,244,236,.85); font: 600 11px 'Alexandria', sans-serif; text-anchor: middle; }
.numline .nl-num.hot { fill: #FFE7A8; font-size: 13px; }
.numline .nl-jump { fill: none; stroke-width: 2.5; stroke-dasharray: 400; stroke-dashoffset: 400; transition: stroke-dashoffset 1.2s ease; }
.numline .c0.nl-jump { stroke: #FFB86B; } .numline .c1.nl-jump { stroke: #8EC9FF; }
.numline .nl-lab { font: 700 11px 'Plex', sans-serif; text-anchor: middle; opacity: 0; transition: opacity .4s .8s; direction: rtl; }
.numline .c0.nl-lab { fill: #FFB86B; } .numline .c1.nl-lab { fill: #8EC9FF; }
.nl-model.show0 .j0 .nl-jump, .nl-model.show1 .j1 .nl-jump { stroke-dashoffset: 0; }
.nl-model.show0 .j0 .nl-lab, .nl-model.show1 .j1 .nl-lab { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .numline .nl-jump, .numline .nl-lab, .vis.ladder .rg { transition: none; } }
.board-lines li.chalk.ladder-line { background-color: #1D4A3C; background-image: none; box-shadow: 0 8px 10px -8px rgba(0,0,0,.55); opacity: 1; }
.board-lines li.chalk.ladder-line .rg { background-color: #1D4A3C; }
.board-lines li.chalk.ladder-line .rg.on { background-color: #5a5232; }

/* ---------- أدوات الرئيسية ---------- */
.desk { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.desk-tile { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 14px 6px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); color: var(--ink); text-decoration: none; min-height: 112px; }
.desk-tile:active { transform: scale(.98); }
.desk-tile:focus-visible { outline: 3px solid var(--saffron); outline-offset: 2px; }
.desk-ic { font-size: 1.9rem; line-height: 1.1; }
.desk-t { font-family: var(--head); font-weight: 600; font-size: .92rem; }
.desk-note { font-size: .74rem; color: var(--muted); line-height: 1.35; }
.desk-tile[data-desk="ask"], .desk-tile[data-desk="photo"] { background: var(--board); border-color: var(--board-deep); color: var(--chalk); }
.desk-tile[data-desk="ask"] .desk-note, .desk-tile[data-desk="photo"] .desk-note { color: #C9D6CF; }
@media (min-width: 640px) { .desk-tile { min-height: 124px; } }

.desk-page .top { gap: 10px; justify-content: flex-start; }
.desk-page .back { margin: 0; padding: 0; display: inline-flex; width: 40px; height: 40px; align-items: center; justify-content: center; border-radius: 50%; background: var(--surface); color: var(--ink); }
.desk-lead { color: var(--muted); margin: 6px 0 16px; }
.desk-mic { display: block; margin: 10px auto 6px; width: 96px; height: 96px; border-radius: 50%; border: 0; background: var(--board); color: var(--chalk); font-size: 2.4rem; box-shadow: 0 0 0 8px #DCE8E2; cursor: pointer; }
.desk-mic.on { background: var(--danger); box-shadow: 0 0 0 8px #F3D6D0; animation: deskpulse 1.2s ease-in-out infinite; }
@keyframes deskpulse { 50% { box-shadow: 0 0 0 14px #F3D6D0; } }
@media (prefers-reduced-motion: reduce) { .desk-mic.on { animation: none; } }
.desk-st { text-align: center; min-height: 1.5em; color: var(--muted); font-size: .92rem; }
.desk-ask { display: grid; gap: 10px; margin-top: 8px; }
.desk-ask textarea { resize: vertical; min-height: 64px; font: inherit; }
.desk-shot { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 26px 12px; border: 2px dashed var(--board); border-radius: var(--r-lg); background: var(--surface); color: var(--board); font-weight: 600; cursor: pointer; text-align: center; }
.desk-shot .desk-ic { font-size: 2.6rem; }
.desk-prev { display: block; max-width: 100%; max-height: 220px; margin: 12px auto 0; border-radius: var(--r-md); }
.desk-heard { font-weight: 600; margin-bottom: 8px; }
.desk-small { font-size: .82rem; color: var(--muted); margin-top: 8px; }
.desk-steps { padding-inline-start: 22px; margin: 8px 0; }
.desk-steps li { margin-bottom: 6px; }
.desk-ans { margin-top: 8px; }
.desk-msg { color: var(--danger); min-height: 1.2em; font-size: .9rem; margin-top: 6px; }
.desk-q { font-size: 1.1rem; font-weight: 600; line-height: 1.7; }
.desk-answer { display: grid; gap: 10px; margin-top: 12px; }
.desk-keys { display: flex; flex-wrap: wrap; gap: 6px; direction: ltr; justify-content: center; }
.desk-keys .key { min-width: 42px; height: 42px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--paper); font-size: 1.1rem; font-weight: 600; color: var(--ink); direction: ltr; unicode-bidi: isolate; }
.desk-streak { font-family: var(--head); font-weight: 600; font-size: 1.05rem; margin: 4px 0 6px; }
.card.ok { border: 2px solid var(--ok); }
.card.ok h2 { color: var(--ok); }
.card.bad { border: 2px solid #E7C3BC; }
.card .btn.block { margin-top: 10px; }
.mists { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mist { background: var(--surface); border-radius: var(--r-md); padding: 14px; border-inline-start: 4px solid var(--line); }
.mist.ready { border-inline-start-color: var(--saffron); }
.mist .btn { margin-top: 8px; }
.mist-wins { font-size: .82rem; color: var(--ok); margin: 4px 0 0; }
.desk-page bdi.m, .desk-tile bdi.m { font-family: var(--body); white-space: nowrap; }

/* الميزان (الدرس 1-4): المعادلة مثل الميزان */
.vis.bl-model { width: 100%; max-width: 360px; margin: 0 auto; }
.vis .balance { display: block; width: 100%; height: auto; }
.balance .bl-base, .balance .bl-bar { stroke: var(--chalk); stroke-width: 3; stroke-linecap: round; fill: none; }
.balance .bl-pivot { fill: #FFE7A8; }
.balance .bl-str { stroke: rgba(241,244,236,.7); stroke-width: 1.5; fill: none; }
.balance .bl-pan { fill: rgba(255,231,168,.14); stroke: var(--chalk); stroke-width: 2; }
.balance text { font-family: 'Alexandria', sans-serif; text-anchor: middle; fill: var(--chalk); }
.balance .bl-t { font-size: 17px; font-weight: 700; fill: #FFE7A8; }
.balance .bl-n { font-size: 14px; font-weight: 700; fill: #FFB86B; }
.balance .bl-eq { font-size: 18px; fill: #A5E8A0; }
.bl-model .bl-beam { transform-origin: 170px 40px; }
.bl-model.wob .bl-beam { animation: blwob 1.1s ease-in-out; }
@keyframes blwob { 25% { transform: rotate(-5deg); } 60% { transform: rotate(3deg); } 100% { transform: rotate(0); } }
@media (prefers-reduced-motion: reduce) { .bl-model.wob .bl-beam { animation: none; } }

/* «ليش؟»: خط أعداد بعدة قفزات، ترتسم وحدة بعد وحدة */
.numline.walk .nl-lab { direction: ltr; unicode-bidi: isolate; }
.nl-model.wk0 .w0 .nl-jump, .nl-model.wk1 .w1 .nl-jump, .nl-model.wk2 .w2 .nl-jump, .nl-model.wk3 .w3 .nl-jump { stroke-dashoffset: 0; }
.nl-model.wk0 .w0 .nl-lab, .nl-model.wk1 .w1 .nl-lab, .nl-model.wk2 .w2 .nl-lab, .nl-model.wk3 .w3 .nl-lab { opacity: 1; }
.why-tag { display: inline-block; font-size: .78rem; color: #FFE7A8; border: 1px solid rgba(255,231,168,.5); border-radius: 999px; padding: 1px 10px; }
.coach .why-list { display: grid; gap: 8px; margin-top: 6px; }
.coach .why-list .btn { text-align: start; }
.coach-type { display: flex; gap: 8px; margin: 8px 0; }
.coach-type input { flex: 1; }

/* الدرس 1-5: المربع والمكعب والمثلث وسلّم التحليل */
.vis.rt-model { width: 100%; max-width: 340px; margin: 0 auto; }
.rt-model svg { display: block; width: 100%; height: auto; }
.rt-model .rt-fill { fill: rgba(142,201,255,.16); }
.rt-model .rt-fill.top { fill: rgba(142,201,255,.28); }
.rt-model .rt-fill.side { fill: rgba(142,201,255,.08); }
.rt-model .rt-edge { fill: none; stroke: var(--chalk); stroke-width: 2.5; stroke-linejoin: round; }
.rt-model .rt-grid { stroke: rgba(241,244,236,.28); stroke-width: 1; }
.rt-model .rt-right { fill: none; stroke: #FFE7A8; stroke-width: 2; }
.rt-model text { font-family: 'Alexandria', sans-serif; text-anchor: middle; fill: var(--chalk); }
.rt-model .rt-area { font-size: 14px; fill: rgba(241,244,236,.8); }
.rt-model .rt-area.big { font-size: 20px; font-weight: 700; fill: #8EC9FF; }
.rt-model .rt-side { font-size: 18px; font-weight: 700; fill: #FFB86B; }
.rt-model .rt-side.hyp { fill: #A5E8A0; }
.rt-model .rt-side.sm { font-size: 12px; font-weight: 600; fill: rgba(241,244,236,.75); }
.rt-model.got .rt-side:not(.sm) { fill: #A5E8A0; }
.vis.fl { display: grid; justify-content: center; margin: 4px auto; font-family: 'Alexandria', sans-serif; font-weight: 700; direction: ltr; }
.fl .fl-row { display: grid; grid-template-columns: 4.5em 2.2em; opacity: 0; transform: translateY(-4px); transition: opacity .3s, transform .3s; }
.fl .fl-row.on { opacity: 1; transform: none; }
.fl .fl-n { text-align: end; padding: 1px 10px 1px 0; border-inline-end: 2px solid var(--chalk); color: var(--chalk); }
.fl .fl-p { padding: 1px 0 1px 10px; }
.fl .g0 .fl-p { color: #8EC9FF; } .fl .g1 .fl-p { color: #FFB86B; }
.fl .end .fl-n { color: #A5E8A0; }
@media (prefers-reduced-motion: reduce) { .fl .fl-row { transition: none; } }

/* الدرس 1-6: خطوات حل المسألة وجدول التخمين */
.vis.gp-plan { display: flex; justify-content: center; align-items: center; gap: 3px; flex-wrap: nowrap; margin: 4px 0 2px; font-weight: 700; font-size: .78em; }
.gp-plan .gp-ar { color: rgba(241,244,236,.45); }
.gp-st { white-space: nowrap; padding: 1px 8px; border-radius: 999px; border: 1.5px solid rgba(241,244,236,.35); color: rgba(241,244,236,.6); font-size: .92em; }
.gp-st.done { border-color: rgba(165,232,160,.6); color: #A5E8A0; }
.gp-st.on { background: #FFE7A8; border-color: #FFE7A8; color: #1E3A2F; }
.vis.gt { display: flex; justify-content: center; margin: 4px 0; }
.gt table { border-collapse: collapse; font-weight: 700; font-size: .8em; }
.gt td, .gt th { white-space: nowrap; }
.gt th { color: rgba(241,244,236,.75); font-weight: 600; font-size: .85em; padding: 3px 8px; border-bottom: 1.5px solid rgba(241,244,236,.5); }
.gt td { padding: 4px 6px; border-bottom: 1px dashed rgba(241,244,236,.2); text-align: center; color: var(--chalk); }
.gt tr { animation: gtin .35s ease-out; }
.gt tr.gt-low td:last-child { color: #8EC9FF; }
.gt tr.gt-high td:last-child { color: #FFB86B; }
.gt tr.gt-ok td { color: #A5E8A0; }
@keyframes gtin { from { opacity: 0; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .gt tr { animation: none; } }

/* ---- الدرس 2-1: الكسور فوق بعض، شريط الكسور، خط الأعداد النسبية ---- */
.fr { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; line-height: 1.02; font-size: .78em; margin: 0 .14em; direction: ltr; }
.fr > span { display: block; padding: 0 .18em; }
.fr > span:first-child { border-bottom: 2px solid currentColor; }
.vis.fb-model { width: 100%; max-width: 340px; margin: 4px auto; }
.vis.fb-model .fbar.grid { max-width: 190px; display: block; margin: 0 auto; }
.fbar { width: 100%; height: auto; display: block; }
.fbar .fb-c { fill: rgba(241,244,236,.06); stroke: rgba(241,244,236,.55); stroke-width: 1.2; }
.fbar .fb-c.on { fill: #8EC9FF; animation: fbOn .35s ease both; }
.fbar .fb-box { fill: none; stroke: var(--chalk); stroke-width: 2.2; }
@keyframes fbOn { from { fill: rgba(241,244,236,.06); } to { fill: #8EC9FF; } }
.ratline .nl-tick.sm { stroke: rgba(241,244,236,.45); stroke-width: 1; }
.ratline .nl-pt { opacity: 0; animation: nlPt .5s ease both; }
.ratline .nl-pt circle { stroke: #1d3b2f; stroke-width: 1.5; }
.ratline .nl-stem { stroke-width: 1.2; stroke-dasharray: 2 2; }
.ratline .nl-plab { font: 700 12px 'Alexandria', sans-serif; text-anchor: middle; direction: ltr; unicode-bidi: isolate; }
.ratline .c0 circle, .ratline .c0 .nl-plab { fill: #8EC9FF; } .ratline .c0 .nl-stem { stroke: #8EC9FF; }
.ratline .c1 circle, .ratline .c1 .nl-plab { fill: #FFB86B; } .ratline .c1 .nl-stem { stroke: #FFB86B; }
.ratline .c2 circle, .ratline .c2 .nl-plab { fill: #A5E8A0; } .ratline .c2 .nl-stem { stroke: #A5E8A0; }
@keyframes nlPt { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .fbar .fb-c.on, .ratline .nl-pt { animation: none; opacity: 1; } }

/* ---- وسائل من الحياة: كعكة، جدار الكسور، فلوس، شريط قياس، محرار، والتلوين باليد ---- */
.vis.ck-model { width: 100%; max-width: 360px; margin: 4px auto; display: flex; justify-content: center; gap: 6px; }
.vis.ck-model.two .cake { width: 48%; }
.cake { width: 100%; max-width: 340px; height: auto; display: block; }
.cake .ck-plate { fill: rgba(241,244,236,.08); stroke: rgba(241,244,236,.35); stroke-width: 1.5; }
.cake .ck-s { fill: rgba(241,244,236,.10); stroke: none; }
.cake .ck-s.on { fill: #E8B36B; animation: ckOn .45s ease both; }
.cake .ck-cut { stroke: #5a3b1c; stroke-width: 2; }
.cake .ck-cut2 { stroke: #fff6dc; stroke-width: 1.6; stroke-dasharray: 3 2; opacity: 0; animation: ckCut .4s ease both; }
.cake .ck-lab { fill: var(--chalk); font: 700 14px 'Alexandria', sans-serif; text-anchor: middle; }
.ck-model.recut .ck-lab.a, .ck-model.two .ck-lab.a { animation: labOut .4s 1.6s ease both; }
.ck-model.recut .ck-lab.b, .ck-model.two .ck-lab.b { opacity: 0; animation: labIn .4s 1.9s ease both; fill: #FFE7A8; }
@keyframes ckOn { from { fill: rgba(241,244,236,.10); } to { fill: #E8B36B; } }
@keyframes ckCut { to { opacity: 1; } }
@keyframes labOut { to { opacity: 0; } }
@keyframes labIn { to { opacity: 1; } }
.vis.wl-model { width: 100%; max-width: 340px; margin: 4px auto; }
.wall { width: 100%; height: auto; display: block; }
.wall .wl-c { fill: rgba(241,244,236,.06); stroke: rgba(241,244,236,.5); stroke-width: 1; }
.wall .wl-c.on { animation: fbOn .35s ease both; }
.wall .wl-c.on.c0 { fill: #8EC9FF; } .wall .wl-c.on.c1 { fill: #FFB86B; } .wall .wl-c.on.c2 { fill: #A5E8A0; }
.wall .wl-box { fill: none; stroke: var(--chalk); stroke-width: 2; }
.wall .wl-lab { font: 700 13px 'Alexandria', sans-serif; text-anchor: end; direction: ltr; unicode-bidi: isolate; }
.wall .wl-lab.c0 { fill: #8EC9FF; } .wall .wl-lab.c1 { fill: #FFB86B; } .wall .wl-lab.c2 { fill: #A5E8A0; }
.wall .wl-end { stroke-width: 1.4; stroke-dasharray: 3 3; }
.wall .wl-end.c0 { stroke: #8EC9FF; } .wall .wl-end.c1 { stroke: #FFB86B; } .wall .wl-end.c2 { stroke: #A5E8A0; }
.vis.mn-model { width: 100%; max-width: 320px; margin: 4px auto; }
.money { width: 100%; height: auto; display: block; }
.money .mn-note { fill: #3f7a54; stroke: #cfe8c9; stroke-width: 2; }
.money .mn-on { fill: rgba(255,231,168,.55); animation: mnOn .9s ease both; transform-box: fill-box; transform-origin: left; }
.money .mn-cut { stroke: rgba(255,255,255,.55); stroke-width: 1.2; stroke-dasharray: 4 3; }
.money .mn-big { fill: #e9f6e4; font: 800 34px 'Alexandria', sans-serif; text-anchor: middle; }
.money .mn-sm { fill: #e9f6e4; font: 600 15px 'Alexandria', sans-serif; text-anchor: middle; }
.money .mn-lab { fill: #FFE7A8; font: 700 14px 'Alexandria', sans-serif; text-anchor: middle; }
@keyframes mnOn { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.tape .tp-band { fill: #E9C46A; stroke: #8a6d1f; stroke-width: 1.5; }
.tape .tp-t { stroke: #3b2f12; stroke-width: 1; }
.tape .tp-n { fill: var(--chalk); font: 600 10px 'Alexandria', sans-serif; text-anchor: middle; }
.tape .nl-pt path { stroke: #1d3b2f; stroke-width: 1; }
.tape .c0 path { fill: #8EC9FF; } .tape .c1 path { fill: #FFB86B; } .tape .c2 path { fill: #A5E8A0; }
.vis.th-model { width: 100%; max-width: 240px; margin: 4px auto; }
.thermo { width: 100%; height: auto; display: block; }
.thermo .th-tube { fill: rgba(241,244,236,.12); stroke: var(--chalk); stroke-width: 2; }
.thermo .th-bulb { fill: #ef6b5b; stroke: var(--chalk); stroke-width: 2; }
.thermo .th-merc { fill: #ef6b5b; }
.thermo .th-t { stroke: rgba(241,244,236,.8); stroke-width: 1.5; } .thermo .th-t.sm { stroke-width: 1; stroke: rgba(241,244,236,.45); } .thermo .th-t.zero { stroke: #FFE7A8; stroke-width: 2.5; }
.thermo .th-n { fill: rgba(241,244,236,.85); font: 600 11px 'Alexandria', sans-serif; text-anchor: end; }
.tap-wrap { display: grid; gap: 10px; }
.tap-bar { display: grid; grid-template-columns: repeat(var(--n), 1fr); border: 2px solid var(--ink, #23312a); border-radius: 10px; overflow: hidden; min-height: 54px; }
.tap-c { border: 0; border-left: 1px solid rgba(0,0,0,.25); background: #f3efe4; min-height: 54px; cursor: pointer; transition: background .15s; }
.tap-c:first-child { border-left: 0; }
.tap-c.on { background: #E8B36B; }
.tap-c:focus-visible { outline: 3px solid #2F6FDB; outline-offset: -3px; }
.tap-count { text-align: center; font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .cake .ck-s.on, .cake .ck-cut2, .ck-lab, .wall .wl-c.on, .money .mn-on { animation: none; opacity: 1; } .ck-model .ck-lab.a { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ck-model .ck-lab.b { opacity: 1 !important; } .ratline .nl-pt { opacity: 1; } }
.thermo text, .tape text, .ratline text, .wall text, .cake text { direction: ltr; unicode-bidi: isolate; }
.money text { unicode-bidi: isolate; }

/* ---- الدرس 2-2: قفزة على خط الأعداد، ونموذج المساحة للضرب ---- */
.jump .jp-arc { fill: none; stroke-width: 2.4; stroke-dasharray: 400; stroke-dashoffset: 400; animation: jpDraw 1.2s .5s ease forwards; }
.jump .jp-arc.pos { stroke: #A5E8A0; } .jump .jp-arc.neg { stroke: #FFB86B; }
@keyframes jpDraw { to { stroke-dashoffset: 0; } }
.vis.ar-model { width: 100%; max-width: 320px; margin: 4px auto; }
.area { width: 100%; height: auto; display: block; }
.area .ar-c { fill: rgba(241,244,236,.06); stroke: rgba(241,244,236,.5); stroke-width: 1; }
.area .ar-c.a { fill: rgba(142,201,255,.45); animation: fbOn .4s ease both; }
.area .ar-c.b { fill: rgba(255,184,107,.45); }
.area .ar-c.ab { fill: #A5E8A0; }
.area .ar-box { fill: none; stroke: var(--chalk); stroke-width: 2; }
.area .ar-lab { font: 700 13px 'Alexandria', sans-serif; text-anchor: middle; direction: ltr; unicode-bidi: isolate; }
.area .ar-lab.a { fill: #8EC9FF; } .area .ar-lab.b { fill: #FFB86B; }
@media (prefers-reduced-motion: reduce) { .jump .jp-arc { animation: none; stroke-dashoffset: 0; } }

/* ---- الدرس 2-3: شريط النسبة المئوية ---- */
.vis.pb-model { width: 100%; max-width: 340px; margin: 4px auto; }
.pbar { width: 100%; height: auto; display: block; }
.pbar .pb-band { fill: rgba(241,244,236,.08); stroke: var(--chalk); stroke-width: 2; }
.pbar .pb-on { fill: #FFB86B; transform-box: fill-box; transform-origin: left; animation: mnOn .9s ease both; }
.pbar .pb-t { stroke: rgba(241,244,236,.35); stroke-width: 1; stroke-dasharray: 3 3; }
.pbar text { font: 700 11px "Alexandria", sans-serif; direction: ltr; unicode-bidi: isolate; fill: rgba(241,244,236,.85); }
.pbar text.on { fill: #FFE7A8; font-size: 13px; }
@media (prefers-reduced-motion: reduce) { .pbar .pb-on { animation: none; } }
.pbar text:not([text-anchor]) { text-anchor: middle; }
/* 2-4 شريط الحصص (التقسيم التناسبي) */
.shares { width: 100%; height: auto; display: block; }
.shares .sh-c { stroke: rgba(241,244,236,.55); stroke-width: 1.5; transform-box: fill-box; transform-origin: left; animation: mnOn .6s ease both; }
.shares .sh-c.a { fill: rgba(107,184,255,.55); }
.shares .sh-c.b { fill: rgba(255,184,107,.55); }
.shares .sh-box { fill: none; stroke: var(--chalk); stroke-width: 2; }
.shares .sh-cut { stroke: #FFF27A; stroke-width: 2.5; stroke-dasharray: 4 3; }
.shares text { font: 700 11px "Alexandria", sans-serif; text-anchor: middle; fill: rgba(241,244,236,.9); }
.shares .sh-u { direction: ltr; unicode-bidi: isolate; dominant-baseline: middle; fill: #fff; }
.shares .sh-l { direction: rtl; unicode-bidi: isolate; font-size: 12px; }
.shares .sh-l.a { fill: #9CCBFF; } .shares .sh-l.b { fill: #FFC98A; }
.shares .sh-t { direction: ltr; unicode-bidi: isolate; font-size: 13px; fill: #FFF27A; }
/* 2-5 جدول التناسب ومستطيلات المساحة الثابتة */
.vtab, .vrect { width: 100%; height: auto; display: block; }
.vtab .vt-h { fill: rgba(107,184,255,.22); stroke: var(--chalk); stroke-width: 1.5; }
.vtab .vt-h.c, .vtab .vt-c.c { fill: rgba(255,242,122,.12); }
.vtab .vt-c { fill: rgba(241,244,236,.05); stroke: var(--chalk); stroke-width: 1.5; }
.vtab text { font: 700 12px "Alexandria", sans-serif; text-anchor: middle; dominant-baseline: middle; }
.vtab .vt-l { direction: rtl; unicode-bidi: isolate; font-size: 10.5px; fill: #CFE6FF; }
.vtab .vt-v { direction: ltr; unicode-bidi: isolate; fill: #fff; }
.vtab .vt-v.q { fill: #FFB86B; }
.vtab .vt-v.f { fill: #8FE3A1; animation: mnOn .6s ease both; }
.vrect .vr-r { fill: rgba(107,184,255,.35); stroke: var(--chalk); stroke-width: 2; }
.vrect .vr-r.q { fill: rgba(255,184,107,.18); stroke-dasharray: 5 4; }
.vrect text { font: 700 12px "Alexandria", sans-serif; text-anchor: middle; dominant-baseline: middle; direction: ltr; unicode-bidi: isolate; }
.vrect .vr-c { fill: #FFF27A; font-size: 13px; }
.vrect .vr-d { fill: rgba(241,244,236,.9); }
.vrect .vr-t { direction: rtl; fill: #9CCBFF; font-size: 11px; }
/* 2-6 خط الأعداد لتقدير الجذر، والمربع والمكعب */
.rline, .sqarea { width: 100%; height: auto; display: block; }
.rline .rl-ax { stroke: var(--chalk); stroke-width: 2.5; }
.rline .rl-tk { stroke: rgba(241,244,236,.7); stroke-width: 1.5; } .rline .rl-tk.b { stroke: #fff; stroke-width: 3; }
.rline .rl-band { fill: rgba(143,227,161,.22); stroke: #8FE3A1; stroke-width: 1.5; animation: mnOn .6s ease both; }
.rline text { font: 700 12px "Alexandria", sans-serif; text-anchor: middle; direction: ltr; unicode-bidi: isolate; }
.rline .rl-n { fill: #fff; font-size: 15px; } .rline .rl-p { fill: #9CCBFF; font-size: 11px; } .rline .rl-s { fill: #8FE3A1; font-size: 10px; }
.rline .rl-pt { fill: #FFB86B; stroke: #fff; stroke-width: 1.5; } .rline .rl-q { fill: #FFB86B; font-size: 12px; }
.sqarea .sq-f { fill: rgba(107,184,255,.3); stroke: var(--chalk); stroke-width: 2; }
.sqarea .sq-t { fill: rgba(107,184,255,.45); stroke: var(--chalk); stroke-width: 2; } .sqarea .sq-s { fill: rgba(107,184,255,.18); stroke: var(--chalk); stroke-width: 2; }
.sqarea text { font: 700 13px "Alexandria", sans-serif; text-anchor: middle; dominant-baseline: middle; direction: ltr; unicode-bidi: isolate; }
.sqarea .sq-a { fill: #FFF27A; } .sqarea .sq-l { fill: #FFB86B; }
/* 3-1 الحد الجبري: صندوقا المعامل والقسم الرمزي، الأكياس، المستطيل، جدول المتشابهة، المجموعات */
.tbox, .tbags, .trect { width: 100%; height: auto; display: block; }
.tbox .tb-c { fill: rgba(107,184,255,.22); stroke: #8EC9FF; stroke-width: 2.5; } .tbox .tb-v { fill: rgba(255,184,107,.2); stroke: #FFB86B; stroke-width: 2.5; }
.tbox text { font: 700 20px "Alexandria", sans-serif; text-anchor: middle; dominant-baseline: middle; fill: #fff; direction: ltr; unicode-bidi: isolate; }
.tbox .tb-t.q { fill: rgba(255,255,255,.55); } .tbox .tb-x { fill: var(--chalk); font-size: 26px; }
.tbox .tb-l { font-size: 14px; fill: #FFF27A; direction: rtl; }
.tbags .tg-bag path { fill: rgba(255,184,107,.3); stroke: #FFB86B; stroke-width: 2; } .tbags .tg-bag.b path { fill: rgba(107,184,255,.28); stroke: #8EC9FF; } .tbags .tg-bag.g path { fill: rgba(165,232,160,.28); stroke: #A5E8A0; }
.tbags .tg-bag { animation: mnOn .5s ease both; } .tbags text { font: 700 16px "Alexandria", sans-serif; text-anchor: middle; fill: #fff; direction: ltr; unicode-bidi: isolate; }
.tbags .tg-cap { text-anchor: end; font-size: 20px; fill: #FFF27A; }
.trect .tr-f { fill: rgba(107,184,255,.25); stroke: var(--chalk); stroke-width: 2.5; }
.trect text { font: 700 16px "Alexandria", sans-serif; text-anchor: middle; dominant-baseline: middle; fill: #FFB86B; direction: ltr; unicode-bidi: isolate; } .trect .tr-a { fill: #FFF27A; font-size: 22px; }
.tsim { width: 100%; border-collapse: collapse; font-size: .95rem; color: var(--chalk); }
.tsim th { font-weight: 700; color: #FFF27A; padding: 6px 4px; border-bottom: 2px solid rgba(241,244,236,.35); }
.tsim td { text-align: center; padding: 6px 4px; border-bottom: 1px solid rgba(241,244,236,.18); font-weight: 700; }
.tsim tr.main td { color: #8EC9FF; } .tsim .ts-y { color: #A5E8A0; font-size: 1.1rem; } .tsim .ts-n { color: #FF9C8A; font-size: 1.1rem; }
.tgroup { display: flex; flex-wrap: wrap; gap: 8px; }
.tgroup .tg-box { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 12px; border: 2px solid; }
.tgroup .tg-v { font-size: .78rem; opacity: .85; margin-inline-end: 4px; }
.tgroup .tg-chip { background: rgba(255,255,255,.12); border-radius: 8px; padding: 2px 8px; font-weight: 700; }
.tgroup .g0 { border-color: #8EC9FF; } .tgroup .g1 { border-color: #FFB86B; } .tgroup .g2 { border-color: #A5E8A0; } .tgroup .g3 { border-color: #E3A5FF; } .tgroup .g4 { border-color: #FFF27A; } .tgroup .g5 { border-color: #FF9C8A; }
.tgroup .alone { border-style: dashed; border-color: rgba(241,244,236,.5); }
/* 3-3 نموذج المساحة لخاصية التوزيع */
.tdist { width: 100%; height: auto; display: block; }
.tdist .td-c { stroke: rgba(241,244,236,.6); stroke-width: 1.5; animation: mnOn .5s ease both; } .tdist .td-e { fill: none; stroke: var(--chalk); stroke-width: 2.5; }
.tdist .c0 { fill: rgba(107,184,255,.28); } .tdist .c1 { fill: rgba(255,184,107,.26); } .tdist .c2 { fill: rgba(165,232,160,.26); } .tdist .c3 { fill: rgba(227,165,255,.26); }
.tdist text { font: 700 15px "Alexandria", sans-serif; text-anchor: middle; dominant-baseline: middle; direction: ltr; unicode-bidi: isolate; }
.tdist .td-t { fill: #FFB86B; } .tdist .td-h { fill: #8EC9FF; font-size: 16px; } .tdist .td-p { fill: #FFF27A; } .tdist .td-p.q { fill: rgba(255,255,255,.55); }
/* اختبار الفصل */
.chtest-entry { display: flex; gap: 12px; align-items: center; margin-top: 12px; padding: 14px 16px; border-radius: 16px; background: #fff; border: 2px dashed var(--c); color: inherit; text-decoration: none; }
.chtest-entry .ct-ic { font-size: 1.6rem; }
.ct-tip { background: #fff8e1; border-radius: 12px; padding: 10px 14px; font-size: .85rem; color: #6b5a1f; margin: 10px 0 4px; }
.ct-sec h2 { font-size: 1rem; margin: 22px 0 10px; }
.ct-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.ct-item { display: flex; gap: 10px; background: #fff; border-radius: 14px; padding: 12px; border: 2px solid transparent; }
.ct-item.ok { border-color: #4caf72; } .ct-item.bad { border-color: #e2725b; }
.ct-pic.mini-board { position: relative; background: var(--board); color: var(--chalk); border-radius: 12px; padding: 8px 10px; margin: 0 0 8px; border: 4px solid var(--frame); overflow: hidden; }
.ct-pic .board-lines { gap: 0; }
.ct-pic .vis svg { max-width: 100%; height: auto; max-height: 260px; display: block; margin: 0 auto; }
.ct-n { flex: 0 0 30px; height: 30px; border-radius: 50%; background: var(--c); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.ct-body { flex: 1; min-width: 0; }
.ct-q bdi.nw { white-space: nowrap; }
.ct-q { margin: 2px 0 8px; line-height: 1.7; }
.ct-in { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1.5px solid #d6d9de; font-size: 1.05rem; text-align: left; }
.ct-res { margin: 8px 0 0; font-size: .9rem; line-height: 1.8; }
.ct-item.ok .ct-res { color: #2e7d4f; } .ct-item.bad .ct-res { color: #b4442f; }
.ct-ex { color: #555; }
.ct-summary { background: #fff; border-radius: 16px; padding: 16px; margin: 20px 0 12px; }
.ct-lessons { padding-inline-start: 18px; line-height: 2; } .ct-lessons li.ok { color: #2e7d4f; } .ct-lessons li.bad { color: #b4442f; }
.ct .btn { margin-top: 10px; }

/* الدرس 3-5: جدول الدالة وماكنة الدالة */
.ftab { width: 100%; border-collapse: collapse; font-size: .95rem; color: var(--chalk); }
.ftab th { font-weight: 700; color: #FFF27A; padding: 6px 4px; border-bottom: 2px solid rgba(241,244,236,.35); line-height: 1.35; }
.ftab th bdi { color: #8EC9FF; font-size: .95em; }
.ftab td { text-align: center; padding: 6px 4px; border-bottom: 1px solid rgba(241,244,236,.18); font-weight: 700; }
.ftab td:first-child { color: #A5E8A0; } .ftab td:last-child { color: #FFD08A; }
.ftab td.q { color: rgba(241,244,236,.55); }
.fmach { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 6px 0; color: var(--chalk); font-weight: 700; }
.fmach .fm-io { display: flex; flex-direction: column; align-items: center; min-width: 54px; padding: 8px 10px; border: 2px dashed rgba(241,244,236,.45); border-radius: 12px; font-size: 1.25rem; color: #A5E8A0; }
.fmach .fm-io.out { color: #FFD08A; }
.fmach .fm-io small { font-size: .7rem; color: rgba(241,244,236,.7); margin-top: 2px; }
.fmach .fm-box { padding: 14px 16px; border-radius: 14px; background: rgba(142,201,255,.18); border: 2px solid #8EC9FF; font-size: 1.2rem; color: #8EC9FF; }
.fmach .fm-ar { font-size: 1.4rem; color: rgba(241,244,236,.8); }

/* الدرس 4-1: خط الأعداد الصحيحة، شكل فن، وعناصر المجموعة */
.snl { width: 100%; max-width: 360px; display: block; margin: 0 auto; }
.snl .sn-ax { stroke: rgba(241,244,236,.75); stroke-width: 2; }
.snl .sn-t { stroke: rgba(241,244,236,.6); stroke-width: 1.5; }
.snl .sn-l { fill: rgba(241,244,236,.7); font-size: 11px; text-anchor: middle; font-weight: 700; }
.snl .sn-l.on { fill: #FFF27A; }
.snl .sn-p { fill: #FFF27A; }
.snl .sn-b { fill: #1f4a3d; stroke: #8EC9FF; stroke-width: 2.5; }
.snl .sn-b.fill { fill: #8EC9FF; }
.snl .sn-ar { fill: none; stroke: rgba(241,244,236,.8); stroke-width: 2; }
.venn { width: 100%; max-width: 360px; display: block; margin: 0 auto; }
.venn .vn-c { fill: none; stroke-width: 2.5; }
.venn .vn-c.c0 { stroke: #A5E8A0; } .venn .vn-c.c1 { stroke: #8EC9FF; } .venn .vn-c.c2 { stroke: #FFB3C7; }
.venn .vn-h { fill: rgba(255,242,122,.32); }
.venn .vn-e { fill: #F1F4EC; font-size: 13px; font-weight: 700; text-anchor: middle; }
.venn .vn-n { fill: #FFF27A; font-size: 17px; font-weight: 700; text-anchor: middle; }
.schips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; padding: 4px 0; }
.schips .sc { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; border: 1.5px solid rgba(241,244,236,.45); color: var(--chalk); font-weight: 700; }
.schips .sc.y { border-color: #A5E8A0; } .schips .sc.y b { color: #A5E8A0; }
.schips .sc.n { border-color: #FF9C8A; } .schips .sc.n b { color: #FF9C8A; }
/* الدرس 5-1: المضلعات (أقطار، مثلثات من رأس واحد، زوايا خارجية ومركزية) */
.vis.pgon-model { display: flex; justify-content: center; margin: 4px 0; }
.pgon { width: 230px; max-width: 100%; display: block; }
.pgon .pg-p { fill: rgba(142,201,255,.12); stroke: #8EC9FF; stroke-width: 2.6; stroke-linejoin: round; }
.pgon .pg-v { fill: #F1F4EC; }
.pgon .pg-dg { stroke: #F1F4EC; stroke-width: 1.3; stroke-dasharray: 4 3; opacity: .75; }
.pgon .pg-bad { stroke: #FF8A80; stroke-width: 2.6; stroke-dasharray: 5 3; }
.pgon .pg-fan { stroke: #FFD54F; stroke-width: 1.6; }
.pgon .pg-tn { fill: #FFD54F; font-size: 12px; font-weight: 700; text-anchor: middle; }
.pgon .pg-ce { stroke: #A5E8A0; stroke-width: 1.5; }
.pgon .pg-c { fill: #A5E8A0; }
.pgon .pg-lab { fill: #A5E8A0; font-size: 12px; font-weight: 700; text-anchor: middle; }
.pgon .pg-ex { stroke: #FFB3C7; stroke-width: 1.8; stroke-dasharray: 3 3; }
/* الدرس 5-2: المجسمات (الأحرف المخفية متقطعة) */
.vis.solid-model { display: flex; justify-content: center; margin: 4px 0; }
.solid { width: 220px; max-width: 100%; display: block; }
.solid .sd-e { stroke: #8EC9FF; stroke-width: 2.2; fill: none; stroke-linejoin: round; }
.solid .sd-h { stroke: #8EC9FF; stroke-width: 1.4; fill: none; stroke-dasharray: 4 3; opacity: .7; }
.solid .sd-f { fill: rgba(142,201,255,.14); stroke: #8EC9FF; stroke-width: 2.2; }
.solid .sd-v { fill: #FFD54F; }
/* الدرس 5-3: المستوى الإحداثي */
.vis.cplane-model { display: flex; justify-content: center; margin: 4px 0; }
.cplane { width: 250px; max-width: 100%; display: block; }
.cplane .cp-g { stroke: rgba(241,244,236,.16); stroke-width: 1; }
.cplane .cp-ax { stroke: #F1F4EC; stroke-width: 2; }
.cplane .cp-al { fill: #F1F4EC; font-size: 13px; font-weight: 700; }
.cplane .cp-n { fill: rgba(241,244,236,.7); font-size: 9px; text-anchor: middle; }
.cplane .cp-ny { text-anchor: end; }
.cplane .cp-qd { fill: #A5E8A0; font-size: 13px; font-weight: 700; text-anchor: middle; }
.cplane .cp-qs { fill: #FFD54F; font-size: 12px; text-anchor: middle; }
.cplane .cp-wx { stroke: #8EC9FF; stroke-width: 3; }
.cplane .cp-wy { stroke: #FFB3C7; stroke-width: 3; }
.cplane .cp-poly { fill: rgba(255,213,79,.18); stroke: #FFD54F; stroke-width: 2.4; }
.cplane .cp-pt { fill: #8EC9FF; }
.cplane .cp-pt.hl { fill: #FFD54F; }
.cplane .cp-pl { fill: #F1F4EC; font-size: 12px; font-weight: 700; }
/* الدرس 5-4: الانسحاب والانعكاس والتناظر */
.vis.tf-model { display: flex; justify-content: center; margin: 4px 0; }
.tf-fig { width: 190px; max-width: 100%; display: block; }
.tf-fig.tf-pair { width: 250px; }
.tf-fig .tf-fill { fill: rgba(142,201,255,.28); stroke: #8EC9FF; stroke-width: 3; stroke-linejoin: round; }
.tf-fig .tf-stroke { fill: none; stroke: #8EC9FF; stroke-width: 14; stroke-linecap: round; stroke-linejoin: round; }
.tf-fig .b { stroke: #FFB74D; }
.tf-fig .tf-fill.b { fill: rgba(255,183,77,.28); }
.tf-fig .tf-ghost { fill: none; stroke-width: 3; stroke-dasharray: 7 5; }
.tf-fig .tf-ghost.ok { stroke: #A5E8A0; }
.tf-fig .tf-ghost.no { stroke: #FF8A80; }
.tf-fig .tf-axis { stroke-width: 3; stroke-dasharray: 9 6; }
.tf-fig .tf-axis.ok { stroke: #A5E8A0; }
.tf-fig .tf-axis.no { stroke: #FF8A80; }
.tf-fig .tf-arrow { stroke: #FFD54F; stroke-width: 3; }
.tf-fig .tf-arrowhead { fill: #FFD54F; }
.cplane .cp-ax.tf-mirror { stroke: #A5E8A0; stroke-width: 3.5; }
.cplane .cp-poly.tf-img { fill: rgba(255,183,77,.2); stroke: #FFB74D; }
.cplane .cp-pt.tf-ip { fill: #FFB74D; }
.cplane .cp-pl.tf-il { fill: #FFE0B2; }
.cplane .tf-link { stroke: rgba(241,244,236,.55); stroke-width: 1.5; stroke-dasharray: 4 4; }
/* الدرس 5-5: التطابق والتشابه */
.vis.cg-model { display: flex; justify-content: center; margin: 4px 0; }
.cg-fig { width: 290px; max-width: 100%; display: block; }
.cg-fig .cg-poly { stroke-width: 2.4; stroke-linejoin: round; }
.cg-fig .cg-poly.a { fill: rgba(142,201,255,.22); stroke: #8EC9FF; }
.cg-fig .cg-poly.b { fill: rgba(255,183,77,.22); stroke: #FFB74D; }
.cg-fig .cg-ang { fill: #FFD54F; font-size: 12px; text-anchor: middle; }
.cg-fig .cg-sid { fill: #F1F4EC; font-size: 13px; font-weight: 700; text-anchor: middle; }
.cg-fig .cg-sid.st { text-anchor: start; }
.cg-fig .cg-sid.st2 { text-anchor: end; }
.cg-fig .q { fill: #FF8A80; font-size: 15px; font-weight: 700; }
.cg-fig .cg-lab { fill: rgba(241,244,236,.75); font-size: 11px; text-anchor: middle; }
.cg-fig .cg-r { stroke: #F1F4EC; stroke-width: 1.5; }
.cg-fig .cg-ground { stroke: #A5D6A7; stroke-width: 2; }
.cg-fig .cg-shade { fill: rgba(0,0,0,.28); }
/* الدرس 5-6: أنشئ نموذجاً */
.vis.md-model { display: flex; justify-content: center; margin: 4px 0; }
.md-fig { width: 100%; display: block; }
.md-fig .md-chip { stroke: rgba(0,0,0,.35); stroke-width: 1.2; }
.md-fig .md-chip.out { opacity: .3; }
.md-fig .md-chip.hl { stroke: #FFD54F; stroke-width: 2.6; }
.md-fig .md-t { fill: #1B2A22; font-size: 12px; font-weight: 700; text-anchor: middle; }
.md-fig .md-x { stroke: #B71C1C; stroke-width: 2.5; }
.md-fig .md-n { fill: rgba(241,244,236,.7); font-size: 12px; text-anchor: middle; }
.md-fig .md-sq { fill: #F06292; stroke: #AD1457; stroke-width: .8; }
.md-fig .md-cap { fill: #F1F4EC; font-size: 10px; text-anchor: middle; }
.md-fig .md-cap.st { text-anchor: start; font-size: 12px; }
.md-fig .md-box { fill: rgba(255,255,255,.06); stroke: rgba(241,244,236,.5); stroke-width: 1.2; }
.md-fig .md-box.on { stroke: #A5E8A0; }
.md-fig .md-can { fill: #FFB74D; }
.md-fig .md-pic { fill: #E3F2FD; stroke: #90CAF9; }
.md-fig .md-brick { fill: #C0784A; stroke: #7B3F1E; stroke-width: .8; }
.md-fig .md-ground { stroke: #A5D6A7; stroke-width: 2; }
.md-fig .md-cap.big { font-size: 13px; font-weight: 700; fill: #FFD54F; }
/* الدرس 6-1: التكبير والتصغير */
.vis.sc-model { display: flex; justify-content: center; margin: 4px 0; }
.sc-fig { width: 290px; max-width: 100%; display: block; }
.sc-fig .sc-r { stroke-width: 2.4; }
.sc-fig .sc-r.a, .sc-fig .sc-l.a { fill: rgba(142,201,255,.22); stroke: #8EC9FF; }
.sc-fig .sc-r.b, .sc-fig .sc-l.b { fill: rgba(255,183,77,.22); stroke: #FFB74D; }
.sc-fig .sc-l { stroke-width: 5; stroke-linecap: round; }
.sc-fig .sc-t { fill: #F1F4EC; font-size: 12px; font-weight: 700; text-anchor: middle; }
.sc-fig .sc-t.st { text-anchor: start; }
.sc-fig .sc-t.en { text-anchor: end; }
.sc-fig .sc-rad { stroke: #F1F4EC; stroke-width: 1.5; }
/* الدرس 6-2: الأحجام */
.vis.vl-model { display: flex; justify-content: center; margin: 4px 0; }
.vl-fig { width: 100%; display: block; }
.vl-fig .vl-f { fill: rgba(142,201,255,.18); stroke: #8EC9FF; stroke-width: 2; }
.vl-fig .vl-s { fill: rgba(142,201,255,.10); stroke: #8EC9FF; stroke-width: 2; }
.vl-fig .vl-t { fill: rgba(142,201,255,.26); stroke: #8EC9FF; stroke-width: 2; }
.vl-fig .vl-base { fill: rgba(255,213,79,.35); stroke: #FFD54F; stroke-width: 1.5; }
.vl-fig .vl-hid { fill: none; stroke: rgba(142,201,255,.6); stroke-width: 1.4; stroke-dasharray: 5 4; }
.vl-fig .vl-gr { stroke: rgba(142,201,255,.6); stroke-width: 1; }
.vl-fig .vl-water { fill: rgba(79,195,247,.45); }
.vl-fig .vl-water.top { fill: rgba(129,212,250,.55); }
.vl-fig .vl-t1 { fill: #F1F4EC; font-size: 12px; font-weight: 700; text-anchor: middle; }
.vl-fig .vl-t1.st { text-anchor: start; }
.vl-fig .vl-t1.en { text-anchor: end; }
/* 6-3: شبكة المجسم (الأوجه مفرودة) */
.vis.sa-model { display: flex; justify-content: center; margin: 4px 0; }
.sa-fig { width: 100%; display: block; }
.sa-fig .sa-side { fill: rgba(255,213,79,.22); stroke: #FFD54F; stroke-width: 2; }
.sa-fig .sa-side.b { fill: rgba(255,213,79,.12); }
.sa-fig .sa-base { fill: rgba(142,201,255,.22); stroke: #8EC9FF; stroke-width: 2; }
.sa-fig .sa-base.off { fill: none; stroke-dasharray: 5 4; stroke: rgba(142,201,255,.5); }
.sa-fig .dim { opacity: .35; }
.sa-fig .sa-t { fill: #F1F4EC; font-size: 12px; font-weight: 700; text-anchor: middle; }
.sa-fig .sa-t.st { text-anchor: start; }
/* 6-4: المجسم قبل التمدد وبعده بنفس المقياس */
.vis.rk-model { display: flex; justify-content: center; margin: 4px 0; }
.rk-fig { width: 100%; display: block; }
.rk-fig .rk-f { fill: rgba(142,201,255,.18); stroke: #8EC9FF; stroke-width: 2; }
.rk-fig .rk-s { fill: rgba(142,201,255,.10); stroke: #8EC9FF; stroke-width: 2; }
.rk-fig .rk-t { fill: rgba(142,201,255,.26); stroke: #8EC9FF; stroke-width: 2; }
.rk-fig .b.rk-f { fill: rgba(255,213,79,.20); stroke: #FFD54F; }
.rk-fig .b.rk-s { fill: rgba(255,213,79,.10); stroke: #FFD54F; }
.rk-fig .b.rk-t { fill: rgba(255,213,79,.28); stroke: #FFD54F; }
.rk-fig .rk-l { fill: #F1F4EC; font-size: 11px; font-weight: 700; text-anchor: middle; }
/* 6-5: الأشكال المجسمة المركبة */
.vis.cm-model { display: flex; justify-content: center; margin: 4px 0; }
.cm-fig { width: 100%; display: block; }
.cm-fig .cm-f { fill: rgba(142,201,255,.18); stroke: #8EC9FF; stroke-width: 2; }
.cm-fig .cm-s { fill: rgba(142,201,255,.10); stroke: #8EC9FF; stroke-width: 2; }
.cm-fig .cm-t { fill: rgba(142,201,255,.26); stroke: #8EC9FF; stroke-width: 2; }
.cm-fig .b.cm-f, .cm-fig .b.cm-s, .cm-fig .b.cm-t { stroke: #FFD54F; fill: rgba(255,213,79,.18); }
.cm-fig .c.cm-f, .cm-fig .c.cm-s, .cm-fig .c.cm-t { stroke: #A5D6A7; fill: rgba(165,214,167,.18); }
.cm-fig .cm-hole { fill: #1E3A2F; stroke: #F1F4EC; stroke-width: 1.5; stroke-dasharray: 4 3; }
.cm-fig .cm-l { fill: #F1F4EC; font-size: 11px; font-weight: 700; text-anchor: middle; }
.cm-fig .cm-l.st { text-anchor: start; }
/* 6-6: المضلع المنتظم والرصف */
.vis.tl-model { display: flex; justify-content: center; margin: 4px 0; }
.tl-fig { width: 100%; display: block; }
.tl-fig .tl-p { fill: rgba(142,201,255,.18); stroke: #8EC9FF; stroke-width: 2; }
.tl-fig .tl-p.c1 { fill: rgba(255,213,79,.18); stroke: #FFD54F; }
.tl-fig .tl-p.c2 { fill: rgba(165,214,167,.2); stroke: #A5D6A7; }
.tl-fig .tl-d { stroke: #FFD54F; stroke-width: 1.6; stroke-dasharray: 5 3; }
.tl-fig .tl-v { fill: #FF8A80; }
.tl-fig .tl-gap { fill: rgba(255,138,128,.55); stroke: #FF8A80; stroke-width: 1.5; }
.tl-fig .tl-t { fill: #F1F4EC; font-size: 12px; font-weight: 700; }
.tl-fig .tl-r { fill: rgba(142,201,255,.12); stroke: #8EC9FF; stroke-width: 2; }
.tl-fig .tl-g { stroke: rgba(142,201,255,.45); stroke-width: 1; }
.tl-fig .tl-one { fill: rgba(255,213,79,.6); stroke: #FFD54F; stroke-width: 1.5; }
.tl-fig .tl-h { fill: #1E3A2F; stroke: #F1F4EC; stroke-width: 1.2; }
.tl-fig .tl-in { fill: rgba(165,214,167,.45); stroke: rgba(165,214,167,.8); }
.tl-fig .tl-b { fill: rgba(176,190,197,.5); stroke: #CFD8DC; }
/* 7-1: الجدول التكراري */
.vis.fq-model { display: flex; justify-content: center; margin: 4px 0; }
.fq-t { border-collapse: collapse; font-size: 14px; color: #F1F4EC; min-width: 200px; }
.fq-t th, .fq-t td { border: 1.5px solid rgba(142,201,255,.6); padding: 3px 10px; text-align: center; }
.fq-t th { background: rgba(142,201,255,.18); font-weight: 700; }
.fq-t tr.hl td { background: rgba(255,213,79,.28); }
.fq-t tr.tot td { font-weight: 700; border-top: 2.5px solid #FFD54F; }
.fq-tal line { stroke: #FFD54F; stroke-width: 2; stroke-linecap: round; }
/* 7-2: الدائرة البيانية */
.vis.pi-model { display: flex; justify-content: center; margin: 4px 0; }
.pi-fig { width: 100%; display: block; }
.pi-fig .pi-s { stroke: #1E3A2F; stroke-width: 2; opacity: .85; }
.pi-fig .pi-s.hl { opacity: 1; stroke: #F1F4EC; stroke-width: 3; }
.pi-fig .pi-t { fill: #1E2A24; font-size: 12px; font-weight: 800; text-anchor: middle; }
/* 7-3: المضلع التكراري */
.vis.fp-model { display: flex; justify-content: center; margin: 4px 0; }
.fp-fig { width: 100%; display: block; }
.fp-fig .fp-ax { stroke: #F1F4EC; stroke-width: 1.6; }
.fp-fig .fp-ln { fill: none; stroke: #8EC9FF; stroke-width: 2.5; }
.fp-fig .fp-end { stroke: #8EC9FF; stroke-width: 2; stroke-dasharray: 4 4; }
.fp-fig .fp-pt { fill: #FF8A80; }
.fp-fig .fp-pt.hl { fill: #FFD54F; stroke: #F1F4EC; stroke-width: 1.5; }
.fp-fig .fp-tx { fill: #F1F4EC; font-size: 10px; text-anchor: middle; }
.fp-fig .fp-ty { fill: #F1F4EC; font-size: 10px; text-anchor: end; }
.fp-fig .fp-lb { fill: #FFD54F; font-size: 10px; font-weight: 700; text-anchor: end; }
.fp-fig .fp-lb.st { text-anchor: start; }

/* 7-4 الساق والورقة */
.lf-t td.lf-s { font-weight: 700; width: 3.2em; }
.lf-t td.lf-l { text-align: left; letter-spacing: .06em; min-width: 9em; }
.lf-t td.lf-l span.lf-m { color: #FFD54F; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.lf-t caption.lf-cap { caption-side: top; font-size: 12px; color: #C9D7C0; padding-bottom: 4px; text-align: center; }

/* 7-5 نتائج التجربة: الرسم الشجري */
.ox-fig { width: 100%; height: auto; }
.ox-fig .ox-n { fill: #FFF6D5; font-size: 14px; font-weight: 700; }
.ox-fig .ox-n.hl, .ox-fig .ox-o.hl { fill: #FFD54F; }
.ox-fig .ox-l { stroke: #8EC9FF; stroke-width: 1.6; }
.ox-fig .ox-l.hl { stroke: #FFD54F; stroke-width: 2.4; }
.ox-fig .ox-o { fill: #C9F0C1; font-size: 12.5px; }
.ox-box { border-collapse: separate; border-spacing: 4px; color: #F1F4EC; font-size: 13px; margin: 0 auto; }
.ox-box td { border: 1.5px solid rgba(142,201,255,.6); border-radius: 8px; padding: 4px 8px; text-align: center; vertical-align: top; }
.ox-box td.ox-x { border: 0; font-size: 20px; font-weight: 700; vertical-align: middle; color: #FFD54F; }
.ox-box .ox-bh { font-weight: 700; color: #FFF6D5; margin-bottom: 3px; }
.ox-box .ox-bi { line-height: 1.5; }
.ox-box .ox-bc { margin-top: 4px; font-size: 18px; font-weight: 700; color: #FFD54F; }
.ox-t td { white-space: nowrap; }

/* 7-6 المقارنة بين الاحتمالات */
.pb-box { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; max-width: 300px; margin: 0 auto; }
.pb-c { width: 26px; height: 26px; border-radius: 50%; background: var(--c); border: 2px solid rgba(255,255,255,.55); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #fff; }
.pb-c.pb-card { border-radius: 4px; width: 26px; height: 34px; font-size: 18px; }
.pb-c.pb-die { border-radius: 6px; color: #222; }
.pb-c.pb-shape, .pb-c.pb-person { width: auto; min-width: 26px; padding: 0 6px; border-radius: 13px; font-size: 11px; }
.pb-c.hl { outline: 3px solid #FFD54F; outline-offset: 2px; }
.pb-spin .pb-sec { stroke: #fff; stroke-width: 1.5; }
.pb-spin .pb-sec.hl { stroke: #FFD54F; stroke-width: 4; }
.pb-spin .pb-arr { stroke: #111; stroke-width: 3; }
.pb-scale .pb-ax { stroke: #8EC9FF; stroke-width: 2; }
.pb-scale .pb-tx { fill: #F1F4EC; font-size: 11px; }
.pb-scale .pb-mk { fill: #FFD54F; stroke: #fff; stroke-width: 1.5; }

/* 3.82 تحليل السؤال: خط تحت المعطيات، دائرة على الرموز والكلمات، خط متموج تحت المطلوب */
li.studied .mk-u { background-image: linear-gradient(#FFD54F, #FFD54F); background-repeat: no-repeat; background-position: right bottom; background-size: 0% 2px; padding-bottom: 2px; animation: mkU .45s ease forwards; animation-delay: var(--d, 0s); }
li.studied bdi .mk-u { background-position: left bottom; }
li.studied .mk-c { border-radius: 999px; padding: 0 2px; box-shadow: 0 0 0 0 #FF8A80; animation: mkC .4s ease forwards; animation-delay: var(--d, 0s); }
li.studied .mk-q { text-decoration-line: underline; text-decoration-style: wavy; text-decoration-color: transparent; text-underline-offset: 5px; animation: mkQ .5s ease forwards; animation-delay: var(--d, 0s); }
@keyframes mkU { to { background-size: 100% 2px; } }
@keyframes mkC { to { box-shadow: 0 0 0 2px #FF8A80; } }
@keyframes mkQ { to { text-decoration-color: #8EC9FF; } }
@media (prefers-reduced-motion: reduce) {
  li.studied .mk-u { animation: none; background-size: 100% 2px; }
  li.studied .mk-c { animation: none; box-shadow: 0 0 0 2px #FF8A80; }
  li.studied .mk-q { animation: none; text-decoration-color: #8EC9FF; }
}
li.study-ln { color: #FFF6D5; }

/* 3.85 دفتر الغلطات: نوع الغلطة */
.mist-kind { font-size: 13px; color: #8A5A00; background: #FFF4D6; border-radius: 8px; padding: 4px 8px; margin: 4px 0; }

/* 3.86 قياس الأثر */
.chtest-entry.pre { background: #F3F8FF; }
.chtest-entry.due { background: #FFF6E0; border-color: #F2B84B; }
.ct-impact { margin: 6px 4px 0; font-size: 14px; color: #2D6A3E; }
.ct-note { background: #F3F8FF; border-radius: 12px; padding: 10px 12px; font-size: 14px; line-height: 1.7; color: #33415C; }

/* 4.00: ترحيب الأستاذ (الوجه مسجّل والكلام حي) */
.wel { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 18px; background: radial-gradient(120% 90% at 50% 0%, var(--board) 0%, var(--board-deep) 70%); color: var(--chalk); animation: welIn .3s ease-out; }
.wel.out { opacity: 0; transition: opacity .25s; }
@keyframes welIn { from { opacity: 0; } to { opacity: 1; } }
.wel-card { width: min(420px, 100%); display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.wel-face { width: 168px; height: 168px; border-radius: 50%; overflow: hidden; background: #24584a; border: 4px solid var(--frame); box-shadow: 0 10px 30px rgba(0,0,0,.28); transition: transform .2s; }
.wel-face .t-svg { width: 100%; height: 100%; padding: 10px 8px 0; }
.wel.grown .wel-face { width: 190px; height: 190px; }
.wel.talking .wel-face { transform: scale(1.03); }
.wel .t-photo .t-vid.talk { opacity: 0; transition: opacity .18s; }
.wel.talking .t-photo .t-vid.talk { opacity: 1; }
.wel.talking .t-svg .t-mouth-open { animation: welMouth .32s steps(2) infinite; }
@keyframes welMouth { 0% { opacity: 0; } 50% { opacity: 1; } }
.wel-say { margin: 0; min-height: 3.2em; font: 600 1.15rem/1.6 var(--head); }
.wel-status { margin: 0; min-height: 1.6em; font-size: .95rem; opacity: .9; }
.wel-status.listen::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-inline-end: 8px; border-radius: 50%; background: var(--saffron); vertical-align: middle; }
.wel.loud .wel-status.listen::before { box-shadow: 0 0 0 6px rgba(242,172,46,.35); }
.wel-status.think { font-style: italic; }
.wel-start .btn { font-size: 1.1rem; padding: 16px 22px; background: var(--saffron); color: #1b1b1b; border-color: var(--saffron); }
.wel-type { display: flex; gap: 8px; width: 100%; }
.wel-type .input { flex: 1; }
.wel-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.wel-actions .btn.ghost { color: var(--chalk); border-color: rgba(241,244,236,.5); background: transparent; }
@media (prefers-reduced-motion: reduce) { .wel, .wel.talking .t-svg .t-mouth-open { animation: none; } .wel.talking .wel-face { transform: none; } }
.wel-prof { padding: 14px 16px; display: grid; gap: 12px; }
.wel-prof .field { display: grid; gap: 6px; }
.wel-prof fieldset { border: 0; padding: 0; margin: 0; display: flex; gap: 20px; align-items: center; }
.wel-prof legend { float: right; margin-inline-end: 12px; font-weight: 600; }
.wel-prof .desk-msg { color: var(--ok); margin-inline-start: 10px; }

/* 4.04: الثاني المتوسط 1-1: سلّم القسمة للمقام المشترك، والجمع العشري بالأعمدة */
.rl-model { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 4px; }
.rl-lad { border-collapse: collapse; font-size: 1.05rem; direction: ltr; }
.rl-lad td { padding: 2px 10px; }
.rl-lad .rl-p { border-right: 2px solid currentColor; text-align: right; color: var(--chalk-orange, #f0a35e); font-weight: 700; }
.rl-lad tr:not(:last-child) .rl-v { border-bottom: 2px solid currentColor; }
.rl-prod { font-weight: 700; }
.rl-col { display: flex; flex-direction: column; align-items: flex-end; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.15rem; white-space: pre; line-height: 1.35; }
.rl-col .rl-hr { align-self: stretch; border-top: 2px solid currentColor; margin: 2px 0; }
.rl-col .rl-res { font-weight: 700; }

/* 4.06: الثاني المتوسط 1-2: تحريك الفاصلة بالصورة العلمية */
.rp-shift { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rp-row { display: flex; align-items: flex-end; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.3rem; direction: ltr; }
.rp-d { display: inline-block; min-width: 1.1em; text-align: center; border-bottom: 2px solid rgba(255,255,255,.35); margin: 0 1px; }
.rp-d.z { opacity: .55; }
.rp-old { font-style: normal; color: rgba(255,255,255,.45); text-decoration: line-through; margin: 0 1px; }
.rp-new { font-style: normal; color: var(--chalk-orange, #f0a35e); font-weight: 700; font-size: 1.5rem; margin: 0 1px; }
.rp-arr { font-size: .95rem; color: var(--chalk-orange, #f0a35e); }
