

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); color: #1f2430; background: #fffdf6;
  -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.page { width: 210mm; height: 297mm; padding: 14mm 15mm 18mm; position: relative;
  page-break-after: always; overflow: hidden; background: #fffdf6; }
.page:last-child { page-break-after: auto; }
.ar, [dir=rtl] { font-family: var(--font); }

/* hero */
.hero { background: #0f5257; border-radius: 16px; padding: 11mm 11mm 10mm; color: #fff; position: relative; overflow: hidden; }
.eyebrow { font-size: 9.5px; letter-spacing: 2px; color: #b9d3d4; }
.hero h1 { font-size: 30px; line-height: 1.15; margin: 8px 0 10px; font-weight: bold; position: relative; z-index: 1; }
.gold { color: #f5c84b; }
.hero p { font-size: 12.5px; color: #d7e7e7; margin: 0; max-width: 112mm; line-height: 1.5; position: relative; z-index: 1; }
.wm { position: absolute; right: 12mm; top: 15mm; font-size: 58px; color: rgba(255,255,255,.13); }

h2 { font-size: 19px; color: #0f5257; margin: 9mm 0 3mm; display: flex; align-items: center; gap: 10px; }
.num { width: 26px; height: 26px; border-radius: 50%; background: #0f5257; color: #fff; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center; }
.sub { font-size: 12px; color: #5f6672; margin: 0 0 4mm; }
h3.sh { font-size: 14px; color: #0f5257; margin: 6mm 0 2mm; }

.how { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.hw { border: 1px solid #ddd8cb; border-radius: 12px; background: #fff; padding: 10px 10px 8px; font-size: 12px; }
.hw b { color: #0f5257; display: block; margin: 6px 0 3px; }
.hw p { margin: 0; font-size: 11px; color: #4d5460; line-height: 1.45; }
.hn { width: 20px; height: 20px; border-radius: 6px; background: #1f2430; color: #fff; font-size: 11px; font-weight: bold;
  display: flex; align-items: center; justify-content: center; }

.kkgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kk { border-left: 5px solid; border-radius: 8px; padding: 9px 12px; }
.kkt { display: flex; justify-content: space-between; font-weight: bold; font-size: 13.5px; }
.kkar { font-size: 15px; font-weight: normal; color: #2b2f38; }
.kkr { font-size: 14px; font-weight: bold; margin-top: 4px; }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 7px; vertical-align: -1px; }

.tipbox { background: #fff3cf; border-radius: 8px; padding: 9px 12px; font-size: 12px; margin-top: 5mm; line-height: 1.5; }
.three { background: #0f5257; color: #fff; border-radius: 14px; padding: 7mm 9mm 6mm; margin-top: 6mm; }
.three h3 { color: #f5c84b; margin: 0 0 3mm; font-size: 16px; }
.three ol { margin: 0; padding-left: 18px; font-size: 13px; line-height: 2.1; }
.wc { display: inline-flex; width: 24px; height: 24px; border-radius: 50%; background: #fff; color: #0f5257;
  align-items: center; justify-content: center; font-weight: bold; font-size: 15px; vertical-align: middle; margin-left: 4px; }

.foot { position: absolute; left: 15mm; right: 15mm; bottom: 9mm; border-top: 1px solid #ddd8cb; padding-top: 3mm;
  font-size: 10px; color: #6a707b; display: flex; justify-content: space-between; }

/* run sheet */
.timeline { display: flex; gap: 4px; margin-bottom: 4mm; }
.tl { background: #e3eeee; border-radius: 8px; padding: 7px 8px; font-size: 10.5px; color: #0f5257; min-width: 0; }
.tl b { display: block; font-size: 13px; }
.tl.main { background: #0f5257; color: #fff; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tcol { background: #fff; border: 1px solid #ddd8cb; border-radius: 12px; padding: 10px 12px; font-size: 12px; line-height: 1.5; }
.tcol b:first-child { color: #0f5257; }
.tcol ol { margin: 5px 0 0; padding-left: 16px; }
.tcol p { margin: 5px 0 0; }
table.score { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 11.5px; background: #fff;
  border: 1px solid #ddd8cb; border-radius: 10px; overflow: hidden; }
.score th { background: #0f5257; color: #fff; padding: 6px; font-weight: bold; font-size: 11px; }
.score td { border-top: 1px solid #ece7da; height: 8.6mm; padding: 0 6px; }
.score td.c { text-align: center; }
.score th.name { width: 42%; }
.score td.box::after { content: ""; display: inline-block; width: 13px; height: 13px; border: 1.5px solid #b8b2a3; border-radius: 3px; }
.st { color: #d8d2c3; font-size: 11px; }
.st.on { color: #e0a10b; }

/* problem cards */
.page.cards { padding-top: 10mm; }
.card { height: 125mm; border: 1px solid #ddd8cb; border-radius: 14px; background: #fff; padding: 6mm 7mm 5mm; position: relative; }
.chead { display: flex; align-items: center; gap: 10px; }
.qn { background: #1f2430; color: #fff; font-weight: bold; font-size: 13px; border-radius: 7px; padding: 4px 9px; }
.en { font-style: italic; color: #5f6672; font-size: 13px; }
.lvl { margin-left: auto; }
.lvl .st { font-size: 15px; }
.sent { text-align: center; font-size: 34px; margin: 6mm 0 5mm; line-height: 1.6; word-spacing: 6px; }
.blank { display: inline-block; border: 2.5px dashed #0f5257; border-radius: 10px; padding: 0 12px 2px; background: #f2f8f8; position: relative; margin: 0 4px; }
.qm { position: absolute; top: -12px; left: -12px; width: 24px; height: 24px; border-radius: 50%; background: #f5c84b; color: #1f2430;
  font-size: 14px; font-weight: bold; display: flex; align-items: center; justify-content: center; line-height: 1; }
.step { font-size: 12.5px; margin: 3mm 0 2mm; display: flex; align-items: center; gap: 7px; color: #2b2f38; }
.sn { width: 19px; height: 19px; border-radius: 50%; background: #0f5257; color: #fff; font-size: 10.5px; font-weight: bold;
  display: inline-flex; align-items: center; justify-content: center; }
.opts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.opt { border: 1.5px solid #ddd8cb; border-radius: 10px; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 3px 6px; }
.opt .ar { font-size: 25px; direction: rtl; }
.ol { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid #9aa0a8; font-size: 10.5px; font-weight: bold; color: #5f6672;
  display: inline-flex; align-items: center; justify-content: center; flex: none; }
.roles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.rc { border: 1.5px solid; border-radius: 999px; padding: 4px 10px; font-size: 11px; font-weight: bold; display: flex; align-items: center; gap: 7px; }
.rc .box { width: 12px; height: 12px; border: 1.5px solid currentColor; border-radius: 3px; background: #fff; flex: none; }
.rcar { margin-left: auto; font-weight: normal; font-size: 12px; color: #2b2f38; }
.line { border-bottom: 1.5px dotted #b8b2a3; height: 9mm; margin: 0 2mm; }
.pts { position: absolute; right: 7mm; bottom: 4mm; font-size: 10px; color: #6a707b; }
.cut { height: 11mm; display: flex; align-items: center; justify-content: center; position: relative; }
.cut::before { content: ""; position: absolute; left: -15mm; right: -15mm; top: 50%; border-top: 1.5px dashed #c9c2b1; }
.cut span { background: #fffdf6; padding: 0 8px; color: #9a937f; position: relative; font-size: 15px; }
.card.done { display: flex; align-items: center; justify-content: center; text-align: center; background: #e3eeee; border-color: #c4dada; }
.donein { max-width: 120mm; font-size: 13px; color: #0f5257; }
.donein .big { font-size: 40px; }
.donein p { color: #3d4450; line-height: 1.6; }

/* answer key */
.kcard { border: 1px solid #ddd8cb; border-radius: 12px; background: #fff; padding: 3.5mm 5mm; margin-bottom: 3mm; }
.khead { display: flex; align-items: center; gap: 10px; }
.khead .qn { font-size: 11.5px; padding: 3px 8px; }
.khead .en { font-size: 12px; }
.kbody { display: flex; gap: 5mm; align-items: center; margin-top: 2mm; }
.kleft { width: 50mm; flex: none; }
.kans { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.kans .ar { font-size: 22px; direction: rtl; }
.kans .ol { border-color: #0f5257; color: #fff; background: #0f5257; }
.pill { display: inline-block; border: 1.5px solid; border-radius: 999px; padding: 2px 9px; font-size: 10px; font-weight: bold; }
.why { font-size: 10.5px; color: #3d4450; line-height: 1.45; margin-top: 4px; }
.kright { flex: 1; display: flex; gap: 6px; justify-content: flex-start; flex-wrap: wrap; }
.kg { border: 2px solid; border-radius: 10px; padding: 3px 6px 5px; }
.kgl { font-size: 9.5px; text-align: right; margin-bottom: 2px; }
.kgw { display: flex; gap: 4px; align-items: flex-end; }
.kw { text-align: center; padding: 2px 5px 3px; border-radius: 8px; min-width: 15mm; }
.kw.small { border: 1.5px solid; }
.kw.target { border: 3px solid #1f2430 !important; box-shadow: 0 0 0 2px #f5c84b; background: #fffdf0 !important; }
.kt { font-size: 21px; line-height: 1.5; }
.vc { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid; margin: 0 auto; font-size: 15px; display: flex; align-items: center; justify-content: center; background: #fff; line-height: 1; }
.klab { font-size: 8px; margin-top: 1px; white-space: nowrap; direction: ltr; }
.klab.muted { color: #9aa0a8; margin-top: 23px; }

/* v2: full-sentence cards */
.sent { margin: 4mm 0 3mm; font-size: 32px; }
.sw { display: inline-block; border-bottom: 2px dashed #0f5257; padding: 0 3px; margin: 0 5px; }
.hy { color: #a87805; font-weight: bold; } .hr { color: #b8322a; font-weight: bold; }
.step { margin: 1.5mm 0; font-size: 11.5px; }
table.wt { width: 100%; border-collapse: collapse; margin-top: 2mm; }
.wt td { border-top: 1px solid #ece7da; padding: 2.3mm 1mm; vertical-align: middle; }
.wt tr:last-child td { border-bottom: 1px solid #ece7da; }
.wt .wn { width: 6mm; font-size: 10px; color: #9aa0a8; font-weight: bold; }
.wt .wd { width: 34mm; font-size: 23px; text-align: right; padding-right: 3mm; white-space: nowrap; }
.wb { display: inline-block; width: 7px; height: 20px; border-bottom: 2px solid #f5c84b; vertical-align: -3px; }
.wt .ends { width: 52mm; white-space: nowrap; }
.ec { display: inline-flex; width: 25px; height: 25px; border-radius: 50%; border: 1.5px solid #c9c2b1; margin-right: 3px;
  align-items: center; justify-content: center; font-size: 15px; background: #fff; }
.wt .jobs { white-space: nowrap; text-align: right; }
.jc { display: inline-block; border: 1.5px solid; border-radius: 999px; padding: 3px 6px; font-size: 9.5px; font-weight: bold; margin-left: 2px; }
.score .sq { display: inline-block; width: 13px; height: 13px; border: 1.5px solid #b8b2a3; border-radius: 3px; }

/* v2 key */
.kcard { padding: 3mm 4.5mm 3.5mm; margin-bottom: 3mm; }
.kp { margin-left: auto; font-size: 10px; color: #6a707b; }
.kbody { align-items: flex-start; }
.kleft { width: 78mm; }
.rl { display: flex; align-items: center; gap: 5px; font-size: 10px; color: #3d4450; margin: 1.6mm 0; }
.rw { width: 21mm; flex: none; text-align: right; font-size: 15px; color: #1f2430; }
.rl .pill { flex: none; min-width: 13mm; text-align: center; font-size: 9px; padding: 1px 5px; }
.rt { line-height: 1.35; }
.kright { justify-content: flex-start; }
.kt { font-size: 19px; }
.kw { min-width: 13mm; }

/* ---- naṣb lesson: flowing pages ---- */

body.flow { background: #fffdf6; }
.pb { break-before: page; }
h2 { break-after: avoid; }
h2.pb { margin-top: 0; }
h2.nomt { margin-top: 0; }
.ab { font-weight: bold; font-size: 1.12em; }
.hero { margin-bottom: 2mm; }

.cases { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.case { border-radius: 12px; padding: 8px 10px 9px; text-align: center; position: relative; background: #fff; border: 1.5px dashed #cfc8b8; }
.case.done { border: 1.5px solid #9fc6c8; background: #eef6f6; }
.case.now { border: 2.5px solid #d63384; background: #fde6f1; }
.cl { position: absolute; left: 9px; top: 6px; font-size: 10px; font-weight: bold; color: #6a707b; }
.cm { font-size: 22px; color: #e04a3a; line-height: 1.2; }
.case.now .cm { color: #d63384; }
.ca { font-size: 20px; font-weight: bold; }
.ce { font-size: 10.5px; color: #4d5460; }
.cs { font-size: 10px; font-weight: bold; margin-top: 3px; color: #0f5257; }
.case.now .cs { color: #a61e62; }
.case.later .cs { color: #9aa0a8; }

.scope { margin-top: 4mm; background: #e3eeee; border-radius: 10px; padding: 8px 12px; font-size: 11.5px; color: #12393c; line-height: 1.5; }
.scope ul { margin: 4px 0 0; padding-left: 18px; }

.rule { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 3mm; }
.rr { border-left: 5px solid; background: #fff; border-radius: 8px; padding: 8px 12px; font-size: 11.5px; line-height: 1.5; border-top: 1px solid #ece7da; border-right: 1px solid #ece7da; border-bottom: 1px solid #ece7da; }
.rr p { margin: 3px 0 0; color: #3d4450; }
.rbox { border-left: 5px solid; border-radius: 8px; padding: 9px 13px; font-size: 12px; line-height: 1.55; margin-bottom: 3mm; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ex { background: #fff; border: 1px solid #ddd8cb; border-radius: 14px; padding: 4.5mm 5mm 4mm; margin-bottom: 3.5mm; break-inside: avoid; }
.exh { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: #5f6672; margin-bottom: 3mm; }
.exh .qn { font-size: 12px; padding: 3px 9px; }
.sbox { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-start; }
.ex .sbox { justify-content: center; }
.ex .kt { font-size: 25px; }
.ex .kw { min-width: 16mm; }
.ex .vc { width: 25px; height: 25px; font-size: 16px; }
.ex .klab { font-size: 8.5px; }
.kw.ghost { border: 1.5px dashed; background: rgba(255,255,255,.7); }
.kw.ghost .kt { font-size: 17px !important; line-height: 2.1; }
.xls { margin-top: 3mm; border-top: 1px dashed #e3ddcf; padding-top: 2.5mm; }
.xl { display: flex; align-items: center; gap: 8px; font-size: 11.5px; margin: 1.6mm 0; color: #2b2f38; }
.xl .pill { flex: none; min-width: 27mm; text-align: center; font-size: 9.5px; }
.tipbox.in { margin-top: 3mm; }
.pair .ex .kt { font-size: 23px; }

.signs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sg { background: #fde6f1; border: 1.5px solid #d63384; border-radius: 12px; padding: 9px 11px; text-align: center; }
.sgt { font-size: 11.5px; font-weight: bold; color: #a61e62; }
.sga { font-size: 22px; margin: 5px 0; }
.sgd { font-size: 10.5px; color: #3d4450; line-height: 1.45; }

.kkd { font-size: 10.5px; color: #4d5460; margin-top: 3px; }
.oldrow { margin-top: 3mm; font-size: 11px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: #3d4450; }
.oldc { border: 1.5px solid; border-radius: 999px; padding: 2px 9px; font-size: 10px; font-weight: bold; }

table.glance { width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; border: 1px solid #ddd8cb; border-radius: 12px; overflow: hidden; font-size: 11.5px; }
.glance th { background: #0f5257; color: #fff; text-align: left; padding: 7px 10px; font-size: 11px; }
.glance td { padding: 8px 10px; border-top: 1px solid #ece7da; vertical-align: middle; }
.glance .pill { font-size: 10px; }
.garr { font-size: 13px; margin-top: 4px; }
.gd { font-size: 10.5px; color: #5f6672; margin-top: 2px; }
.gex { font-size: 19px; text-align: right; white-space: nowrap; }

.three { break-inside: avoid; }

/* practice cards in flow */
.cardpage { break-after: page; }
.cardpage .card { height: 121mm; }
.cardpage.first .card { height: 121mm; }
.cut::before { left: -15mm; right: -15mm; }
.wt2 td { padding: 1.4mm 1mm; }
.wt2 .wd { font-size: 21px; vertical-align: middle; }
.wt2 .ends .ec { width: 22px; height: 22px; font-size: 13px; margin-right: 2px; }
.jobs2 { margin-top: 1.2mm; white-space: normal; }
.jobs2 .jc { font-size: 8.5px; padding: 2px 5px; margin: 0 2px 2px 0; }
.pc .sent { font-size: 29px; margin: 3mm 0 2mm; }
.pc .step { font-size: 10.5px; margin: 1mm 0; }

/* key in flow */
.kcard { break-inside: avoid; }
.kright .sbox { justify-content: flex-start; }
.kright .kgl { font-size: 8.5px; }
.rbox, .sub { break-after: avoid; }

.rule3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 2mm; }
.qc { height: auto !important; margin-bottom: 4mm; break-inside: avoid; }
.qref { font-size: 10px; color: #6a707b; white-space: nowrap; }
.qref bdi { font-size: 12px; }
.qc .sent { font-size: 30px; }
.vt td { padding: 6px 8px; }
.vt .vx { font-size: 18px; text-align: right; white-space: nowrap; }
.vt .vr { font-size: 10px; color: #5f6672; white-space: nowrap; }
.vt .pill { font-size: 8.5px; padding: 1px 6px; margin: 1px 0; }
.vt td.c { text-align: center; width: 6mm; }


/* Layout: teal masthead + lesson shelf on cream paper; inside a lesson, one big worksheet card at a time.
   A single light "printed worksheet" look on purpose: the role colours match the class handouts. */
:root {
  color-scheme: light;
  --paper: #fffdf6;
  --card: #ffffff;
  --ink: #1f2430;
  --muted: #5f6672;
  --line: #ddd8cb;
  --teal: #0f5257;
  --teal-soft: #e3eeee;
  --gold: #f5c84b;
  --ok: #1f9d55;
  --bad: #d64534;
  --font: "Noto Sans", "Noto Sans Arabic", "DejaVu Sans", "Segoe UI", sans-serif;
  --arabic: "Noto Sans Arabic", "Noto Sans", "DejaVu Sans", "Segoe UI", sans-serif;
}
html, body { background: var(--paper); }
body { color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; }
[dir=rtl], bdi, .ab { font-family: var(--arabic); }
button { font: inherit; color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- top bar ---------- */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--teal); }
.bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 9; background: var(--teal); color: #fff; }
.bar-in { max-width: 1080px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  padding-block: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.brand { display: flex; align-items: center; gap: 10px; background: none; border: 0; cursor: pointer; padding: 0; color: #fff; }
.brand b { font-size: 16px; letter-spacing: .2px; }
.brand .mk { font-family: var(--arabic); font-size: 20px; color: var(--gold); line-height: 1; }
.crumb { color: #b9d3d4; font-size: 14px; min-width: 0; }
.tabs { margin-left: auto; display: flex; flex-wrap: wrap; gap: 4px; }
.tab { background: transparent; border: 1.5px solid rgba(255,255,255,.25); color: #e6f0f0; border-radius: 999px; padding: 5px 14px; font-size: 13px; font-weight: 600; cursor: pointer; }
.tab:hover { border-color: rgba(255,255,255,.6); }
.tab[aria-current="true"] { background: var(--gold); border-color: var(--gold); color: var(--ink); }

.wrap { max-width: 1080px; margin: 0 auto; padding-block: 22px 60px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* ---------- home ---------- */
.home-hero { background: var(--teal); color: #fff; border-radius: 18px; padding: 28px 30px; position: relative; overflow: hidden; }
.home-hero .eyebrow { font-size: 11px; letter-spacing: 2px; color: #b9d3d4; }
.home-hero h1 { font-size: clamp(26px, 4vw, 38px); line-height: 1.15; margin: 8px 0 10px; text-wrap: balance; position: relative; }
.home-hero p { margin: 0; color: #d7e7e7; max-width: 560px; position: relative; }
.home-hero .wm { position: absolute; right: 26px; top: 14px; font-family: var(--arabic); font-size: clamp(48px, 9vw, 92px); color: rgba(255,255,255,.12); line-height: 1.4; }
.how-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; position: relative; }
.how-strip span { background: rgba(255,255,255,.1); border-radius: 999px; padding: 4px 12px; font-size: 12.5px; color: #e6f0f0; }
.how-strip b { color: var(--gold); }

.stage { margin-top: 30px; }
.stage-h { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.stage-h h2 { margin: 0; font-size: 20px; color: var(--teal); }
.stage-h .sar { font-family: var(--arabic); font-size: 18px; color: var(--muted); }
.stage-h .cases-mini { display: flex; gap: 6px; margin-left: auto; }
.cm-chip { font-family: var(--arabic); font-size: 14px; border-radius: 999px; padding: 1px 11px; border: 1.5px solid var(--line); background: var(--card); }
.cm-chip.on { border-color: var(--teal); background: var(--teal-soft); color: var(--teal); font-weight: 700; }
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tile-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.tile h3 { margin: 0; font-size: 17px; text-wrap: balance; }
.tile .count { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tile .tar { font-family: var(--arabic); font-size: 15px; color: var(--teal); }
.tile .sample { font-family: var(--arabic); font-size: 26px; text-align: center; background: var(--paper); border-radius: 12px; padding: 10px 8px 12px; line-height: 1.7; }
.tile .sample span { border-bottom: 3px solid; padding: 0 3px; margin: 0 2px; }
.tile p { margin: 0; font-size: 13.5px; color: var(--muted); }
.tile .jobs-mini { display: flex; flex-wrap: wrap; gap: 4px; }
.tile .jobs-mini span { font-size: 10.5px; font-weight: 700; border: 1.5px solid; border-radius: 999px; padding: 1px 8px; }
.tile-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 4px; }
.btn { border: 1.5px solid var(--line); background: var(--card); border-radius: 10px; padding: 7px 14px; font-size: 13.5px; font-weight: 600; cursor: pointer; color: var(--ink); }
.btn:hover { border-color: var(--teal); color: var(--teal); }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: #0b4044; color: #fff; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--ink); }

/* ---------- static sheets (intro / lesson / teacher / key) ---------- */
.sheet { background: var(--paper); }
.sheet h2:first-child, .view > h2:first-child { margin-top: 0; }
.view { max-width: 880px; margin: 0 auto; }
.view .card, .view .page { height: auto; }
.view .hero { margin-bottom: 4px; }
.view .wm { line-height: 1.4; }
.view table.glance, .view table.score { display: block; overflow-x: auto; }
.view .pb { break-before: auto; }
.kbody { flex-wrap: wrap; }
.kleft { min-width: 0; flex: 1 1 260px; }
.kright { min-width: 0; flex: 1 1 300px; }
.kcard { margin-bottom: 12px; }
.ex .sbox, .kright .sbox { overflow-x: auto; }
.key-list .kcard { margin-bottom: 12px; }

/* ---------- live results (teacher) ---------- */
.res { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; font-size: 13.5px; }
.res th { background: var(--teal); color: #fff; text-align: left; padding: 8px 10px; font-size: 12px; }
.res td { border-top: 1px solid #ece7da; padding: 6px 10px; font-variant-numeric: tabular-nums; }
.res input { width: 100%; min-width: 120px; border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; font: inherit; background: var(--paper); color: var(--ink); }
.res .st-ok { color: var(--ok); font-weight: 700; } .res .st-part { color: #b26a00; font-weight: 700; } .res .st-none { color: #9aa0a8; }
.res-wrap { overflow-x: auto; }
.res .go { padding: 3px 10px; font-size: 12px; }

/* ---------- card stage ---------- */
.stage-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.pills { display: flex; flex-wrap: wrap; gap: 5px; flex: 1; min-width: 0; }
.pillnav { min-width: 38px; height: 34px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--card); font-weight: 700; font-size: 13px; cursor: pointer; font-variant-numeric: tabular-nums; }
.pillnav:hover { border-color: var(--teal); }
.pillnav.cur { background: var(--ink); border-color: var(--ink); color: #fff; }
.pillnav.done { border-color: var(--ok); color: var(--ok); }
.pillnav.done.cur { background: var(--ok); color: #fff; }
.pillnav.part { border-color: #e0a10b; color: #a87805; }
.pillnav.part.cur { background: #e0a10b; color: #fff; }
.navbtns { display: flex; gap: 6px; }

.icard { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 22px 24px 20px; }
.ic-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.ic-head .qn { background: var(--ink); color: #fff; font-weight: 700; font-size: 14px; border-radius: 8px; padding: 4px 10px; }
.ic-head .en { font-style: italic; color: var(--muted); font-size: 15px; }
.ic-head .tag { margin-left: auto; font-size: 13px; color: #a87805; letter-spacing: 1px; }
.ic-head .tag.ref { color: var(--muted); letter-spacing: 0; font-family: var(--font); }
.ic-sent { font-family: var(--arabic); text-align: center; font-size: clamp(30px, 5.4vw, 52px); line-height: 1.9; margin: 14px 0 8px; direction: rtl; }
.tok { display: inline-block; margin: 0 8px; border-bottom: 3px dashed #9fc6c8; padding: 0 2px; }
.pc { border-radius: 8px; transition: background-color .2s, box-shadow .2s; }
.ic-note { text-align: center; font-size: 13.5px; color: #b05705; margin-bottom: 6px; }
.ic-help { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.ic-help b { color: var(--teal); }

.rows { display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: 26px minmax(96px, 150px) auto 1fr; align-items: center; gap: 8px 14px; padding: 9px 4px; border-top: 1px solid #ece7da; border-radius: 10px; transition: background-color .2s; }
.row:last-child { border-bottom: 1px solid #ece7da; }
.row.ok { background: #eaf7ef; }
.row.bad { background: #fdecea; }
.rn { font-size: 12px; font-weight: 700; color: #9aa0a8; text-align: center; }
.rwd { font-family: var(--arabic); font-size: 26px; text-align: right; direction: rtl; white-space: nowrap; }
.rwd::after { content: ""; display: inline-block; width: 9px; height: 24px; border-bottom: 3px solid var(--gold); vertical-align: -4px; margin-right: 1px; }
.ends { display: flex; gap: 5px; }
.eb { width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid #c9c2b1; background: var(--card); font-family: var(--arabic); font-size: 20px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; line-height: 1; }
.eb:hover { border-color: var(--teal); }
.eb.sel { background: var(--teal); border-color: var(--teal); color: #fff; }
.jobs { display: flex; flex-wrap: wrap; gap: 5px; }
.jb { border: 1.5px solid; border-radius: 999px; padding: 5px 11px; font-size: 12.5px; font-weight: 700; cursor: pointer; background: var(--card); }
.jb.sel { color: #fff !important; }
.eb.right, .jb.right { box-shadow: 0 0 0 3px var(--ok); }
.eb.wrong, .jb.wrong { box-shadow: 0 0 0 3px var(--bad); }
.eb.want, .jb.want { box-shadow: 0 0 0 3px var(--ok); outline: 2px dashed var(--ok); outline-offset: 3px; }

.ic-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
.score { margin-left: auto; font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.score.ok { color: var(--ok); } .score.part { color: #a87805; }
.answer { margin-top: 14px; }
.answer-h { font-size: 13px; font-weight: 700; color: var(--teal); margin: 0 0 6px; letter-spacing: .5px; text-transform: uppercase; }

@media (max-width: 760px) {
  .row { grid-template-columns: 22px 1fr; }
  .row .ends, .row .jobs { grid-column: 2; }
  .rwd { text-align: right; }
  .tabs { margin-left: 0; width: 100%; }
  .stage-h .cases-mini { margin-left: 0; }
  .how, .cases { grid-template-columns: 1fr 1fr !important; }
  .kkgrid, .pair, .signs, .rule3, .rule, .split { grid-template-columns: 1fr !important; }
  .icard { padding: 16px 14px; }
  .home-hero { padding: 22px 18px; }
}
@media (max-width: 420px) {
  .eb { width: 34px; height: 34px; font-size: 18px; }
  .how { grid-template-columns: 1fr !important; }
}

/* ---------- v2 additions ---------- */
.acct { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #d7e7e7; }
.acct .who { background: rgba(255,255,255,.12); border-radius: 999px; padding: 4px 12px; white-space: nowrap; }
.acct .who b { color: #fff; }
.acct .dotok { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #5fd38d; margin-right: 6px; }
.acct .dotoff { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #e0a10b; margin-right: 6px; }
.acct .tabsheet { background: var(--gold); border: 0; color: var(--ink); font-weight: 700; border-radius: 999px; padding: 5px 14px; font-size: 13px; cursor: pointer; }

.reg { background: var(--card); border: 2px solid var(--gold); border-radius: 16px; padding: 16px 18px; margin-bottom: 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.reg h3 { margin: 0; font-size: 16px; color: var(--teal); }
.reg p { margin: 0; font-size: 13.5px; color: var(--muted); flex: 1 1 260px; }
.reg form { display: flex; gap: 8px; flex-wrap: wrap; }
.reg input { border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 12px; font: inherit; min-width: 0; width: 220px; max-width: 100%; background: var(--paper); color: var(--ink); }
.reg.warn { border-color: #e0a10b; background: #fff8e6; }
.reg.note { border-color: var(--line); }

.stage-h .num0 { font-family: var(--arabic); }
.shelf.s0 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.tile.unit .sample { font-size: 22px; }
.unitno { font-size: 11px; letter-spacing: 1.5px; color: var(--muted); font-weight: 700; }
.prog { height: 6px; border-radius: 999px; background: #ece7da; overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--ok); }
.tile .mine { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* stage 0 note blocks */
.s0p { margin: 0 0 12px; font-size: 15px; line-height: 1.65; max-width: 70ch; }
.view .rbox { font-size: 14px; }
.view .tipbox { font-size: 13.5px; }
.s0cols .kkd { font-size: 12.5px; }
.wtiles { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 16px; }
.wt0 { border: 2px solid; border-radius: 14px; padding: 8px 14px 10px; text-align: center; min-width: 96px; background: #fff; }
.wta { font-family: var(--arabic); font-size: 30px; line-height: 1.6; direction: rtl; }
.wtl { font-size: 12.5px; font-weight: 700; }
.wts { font-size: 12px; color: var(--muted); }
.exlist { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 16px; }
.exl { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; }
.exa { font-family: var(--arabic); font-size: 26px; text-align: right; line-height: 1.7; }
.exe { font-size: 14px; color: var(--ink); }
.exn { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.tblwrap { overflow-x: auto; margin: 6px 0 16px; }
.s0t { display: table !important; width: 100%; }
.s0t td.tar { font-family: var(--arabic); font-size: 20px; direction: rtl; text-align: right; }
.view h2 { margin-top: 28px; }
.view .hero h1 { text-wrap: balance; }

/* generic card engine */
.ic-prompt { font-family: var(--arabic); text-align: center; font-size: clamp(28px, 5vw, 46px); line-height: 1.8; margin: 12px 0 0; direction: rtl; }
.ic-prompt-en { text-align: center; color: var(--muted); font-style: italic; font-size: 14px; margin-bottom: 6px; }
.row.gen { grid-template-columns: 26px minmax(110px, 200px) 1fr; }
.row.gen .rwd::after { display: none; }
.rwd .gl { display: block; font-family: var(--font); font-size: 12px; color: var(--muted); direction: ltr; text-align: right; white-space: normal; }
.fields { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fg { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.fg .fl { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; min-width: 64px; }
.row.irab .fields { flex-direction: row; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.jb.neutral { border-color: #b9c9c9; color: var(--teal); background: var(--card); }
.jb.neutral.sel { background: var(--teal); border-color: var(--teal); }
.jb.arlab { font-family: var(--arabic); font-size: 19px; font-weight: 600; padding: 2px 14px; }
.why { font-size: 12.5px; color: var(--muted); grid-column: 2 / -1; display: none; }
.row.showwhy .why { display: block; }
.autokey { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 6px 14px; }
.ak { display: grid; grid-template-columns: minmax(90px, 180px) auto 1fr; gap: 6px 12px; align-items: center; padding: 7px 0; border-top: 1px solid #ece7da; }
.ak:first-child { border-top: 0; }
.ak .aw { font-family: var(--arabic); font-size: 22px; text-align: right; direction: rtl; }
.ak .aa { display: flex; flex-wrap: wrap; gap: 4px; }
.ak .aa span { border: 1.5px solid; border-radius: 999px; padding: 1px 10px; font-size: 12px; font-weight: 700; }
.ak .aa span.arl { font-family: var(--arabic); font-size: 17px; }
.ak .ay { font-size: 12.5px; color: var(--muted); }
.lockmsg { font-size: 12.5px; color: var(--muted); }
.saved { font-size: 12.5px; color: var(--ok); font-weight: 600; }
.saved.err { color: var(--bad); }

/* set switcher inside a lesson */
.setnote { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin-bottom: 10px; }
.setnote h2 { margin: 0; font-size: 18px; color: var(--teal); }
.setnote span { font-size: 13px; color: var(--muted); }

/* tracking sheet */
.trk-top { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.trk-top h2 { margin: 0; font-size: 20px; color: var(--teal); }
.trk-top .sub { margin: 0; }
.trk-top .sp { flex: 1; }
.trk-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
table.trk { border-collapse: separate; border-spacing: 0; font-size: 12.5px; min-width: 100%; }
.trk th, .trk td { padding: 6px 8px; border-bottom: 1px solid #ece7da; white-space: nowrap; text-align: center; font-variant-numeric: tabular-nums; }
.trk thead th { background: var(--teal); color: #fff; font-weight: 600; font-size: 11.5px; position: sticky; top: 0; }
.trk thead tr.grp th { background: #0b4044; font-size: 11px; letter-spacing: .5px; }
.trk th.stu, .trk td.stu { text-align: left; position: sticky; left: 0; background: var(--card); z-index: 1; min-width: 160px; }
.trk thead th.stu { background: var(--teal); z-index: 2; }
.trk td.stu b { display: block; font-size: 13.5px; }
.trk td.stu small { color: var(--muted); }
.cell { display: inline-block; min-width: 54px; border-radius: 8px; padding: 3px 6px; font-weight: 700; }
.cell.none { color: #b5b0a3; font-weight: 400; }
.cell.c0 { background: #fdecea; color: #a8321f; }
.cell.c1 { background: #fff3d6; color: #8a5d00; }
.cell.c2 { background: #e5f4ea; color: #17803f; }
.cell.c3 { background: #1f9d55; color: #fff; }
.trk .det { padding: 2px 8px; font-size: 11.5px; }
.detail { margin-top: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.detail h3 { margin: 0 0 8px; color: var(--teal); }
.dsets { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.dset { border: 1px solid #ece7da; border-radius: 10px; padding: 8px 10px; }
.dset b { font-size: 13px; }
.dcards { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.dcards span { font-size: 11px; border-radius: 6px; padding: 2px 6px; border: 1px solid #ddd8cb; font-variant-numeric: tabular-nums; }
.dcards span.ok { background: #e5f4ea; border-color: #9fd5b1; color: #17803f; }
.dcards span.part { background: #fff3d6; border-color: #f0d28a; color: #8a5d00; }
.danger { color: var(--bad); border-color: #f1b8b0; }
.empty { padding: 30px 16px; text-align: center; color: var(--muted); }

@media (max-width: 760px) {
  .row.gen { grid-template-columns: 22px 1fr; }
  .row.gen .fields { grid-column: 2; }
  .exl { grid-template-columns: 1fr; }
  .exa { text-align: right; }
  .ak { grid-template-columns: 1fr; }
  .ak .aw { text-align: right; }
}

/* ---------- accounts ---------- */
.authf { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.authf input { border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 12px; font: inherit; flex: 1 1 180px; min-width: 0; background: var(--paper); color: var(--ink); }
.authbtns { display: flex; gap: 8px; flex-wrap: wrap; }
.authalt { font-size: 13px; color: var(--muted); margin: 0; width: 100%; }
.autherr { font-size: 13px; color: #a8321f; margin: 0; width: 100%; }
.autherr:empty { display: none; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--teal); font-weight: 600; cursor: pointer; text-decoration: underline; font-size: inherit; }
.linkbtn.light { color: #d7e7e7; font-size: 13px; }
.empty { padding: 30px 16px; text-align: center; color: var(--muted); }
