/* AI School — منصة الأولمبياد البرمجي
   أبيض ورمادي نظيف، بنفسجي #6d3af2 للفعل، برتقالي للتوجيه ("أنت هنا"، التالي) */
:root {
  --primary: #6d3af2;
  --primary-ink: #5326d6;
  --accent: #ff7f1a;
  --accent-ink: #e2680a;
  --ink: #1e1b2e;
  --ink-2: #4a4560;
  --muted: #7a7690;
  --line: #e9e7f0;
  --line-2: #f3f2f7;
  --bg: #f7f7fa;
  --card: #fff;
  --ok: #12a150;
  --bad: #e5484d;
  --r-lg: 20px;
  --r: 14px;
  --r-sm: 10px;
  --shadow: 0 1px 2px rgba(30, 27, 46, .04), 0 8px 24px rgba(30, 27, 46, .05);
  --font: "DIN Next LT Arabic", "DIN Next W1G", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, "Courier New", monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 16px; line-height: 1.75; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; font-weight: 700; }
h1 { font-size: 30px; letter-spacing: -.2px; }
h2 { font-size: 22px; }
h3 { font-size: 17px; }
p { margin: 0; }
:focus-visible { outline: 3px solid rgba(109, 58, 242, .35); outline-offset: 2px; border-radius: 8px; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.en { direction: ltr; unicode-bidi: isolate; color: var(--muted); font-size: 13px; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.icon.lg { width: 22px; height: 22px; }
.icon.xl { width: 28px; height: 28px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- الشريط العلوي ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(255, 255, 255, .94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1200px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); white-space: nowrap; font-size: 17px; }
.brand img { width: 34px; height: 34px; object-fit: contain; }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav a { padding: 8px 13px; border-radius: 10px; color: var(--ink-2); font-size: 15px; white-space: nowrap; display: flex; align-items: center; gap: 7px; transition: background .15s, color .15s; }
.nav a:hover { background: var(--line-2); }
.nav a.on { color: var(--primary); font-weight: 600; }
.nav a.on::after { content: ""; }
.who { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: var(--primary); border: 1.5px solid var(--primary); background: #fff; flex: none; }
.who .name { font-size: 14px; font-weight: 600; line-height: 1.3; }
.who .role { font-size: 12px; color: var(--muted); line-height: 1.3; }

main { max-width: 1200px; margin: 0 auto; padding: 32px 24px 90px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { margin-top: 6px; }
.crumb { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.crumb:hover { color: var(--primary); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.pad { padding: 22px; }
.grid { display: grid; gap: 16px; }
.cols-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 14px; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 10px 18px; border-radius: 12px; font-size: 15px; font-weight: 600; cursor: pointer; transition: transform .12s, background .15s, border-color .15s, box-shadow .15s; white-space: nowrap; }
.btn:hover { border-color: #d6d3e2; background: #fcfcfe; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(109, 58, 242, .22); }
.btn.primary:hover { background: var(--primary-ink); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 6px 16px rgba(255, 127, 26, .25); }
.btn.accent:hover { background: var(--accent-ink); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--line-2); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 6px 12px; font-size: 13.5px; border-radius: 9px; }
.btn.lg { padding: 13px 24px; font-size: 16.5px; border-radius: 14px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.icon-btn { width: 38px; height: 38px; padding: 0; }

input, select, textarea { font-family: inherit; font-size: 15px; width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(109, 58, 242, .12); }
label.field { display: block; }
label.field > span { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--ink-2); }
input[dir="ltr"] { text-align: left; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14.5px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }

.bar { height: 8px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--primary); border-radius: 99px; transition: width 1s var(--ease); }
.bar.accent > i { background: var(--accent); }
.bar.ok > i { background: var(--ok); }

.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.tag.ok { color: var(--ok); }
.tag.bad { color: var(--bad); }
.tag.pri { color: var(--primary); }
.tag.acc { color: var(--accent-ink); }

/* ---------- جداول ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: right; padding: 13px 16px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
th { font-size: 13px; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td .actions { display: flex; gap: 4px; justify-content: flex-end; }
.num { font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 22px; overflow-x: auto; }
.tabs a { padding: 11px 14px; color: var(--muted); font-weight: 600; border-bottom: 2.5px solid transparent; margin-bottom: -1px; white-space: nowrap; display: flex; gap: 7px; align-items: center; }
.tabs a.on { color: var(--primary); border-color: var(--primary); }

/* ---------- الدخول ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; background: #fff; }
.login-art { display: flex; flex-direction: column; justify-content: center; padding: 56px 64px; border-left: 1px solid var(--line); }
.login-art .brand { margin-bottom: 30px; }
.login-art h1 { font-size: 40px; line-height: 1.25; max-width: 520px; }
.login-art p { margin-top: 14px; max-width: 470px; color: var(--ink-2); font-size: 17px; }
.login-art img { width: 100%; max-width: 560px; margin-top: 28px; }
.login-form { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.login-form .card { width: 100%; max-width: 420px; padding: 34px; }

/* ---------- رحلة الطالب ---------- */
.hello { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; padding: 28px 30px; margin-bottom: 30px; overflow: hidden; }
.hello h1 { font-size: 30px; }
.hello .next { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }
.hello-stats { display: flex; gap: 28px; margin-top: 22px; flex-wrap: wrap; }
.hello-stats div b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.hello-stats div span { font-size: 13px; color: var(--muted); }
.hello img { width: 240px; }

.trail { position: relative; padding: 10px 0 30px; }
.trail-line { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.trail-line path { fill: none; stroke: var(--line); stroke-width: 4; stroke-dasharray: 2 12; stroke-linecap: round; }
.trail-line path.done { stroke: var(--primary); stroke-dasharray: none; opacity: .5; }
.station { position: relative; display: grid; grid-template-columns: 280px 1fr; gap: 26px; align-items: center; width: min(860px, 100%); margin: 0 0 34px; }
.station:nth-child(even of .station) { margin-inline-start: auto; grid-template-columns: 1fr 280px; }
.station:nth-child(even of .station) .st-img { order: 2; }
.st-img { position: relative; border-radius: var(--r-lg); background: #fff; border: 1px solid var(--line); overflow: hidden; aspect-ratio: 4 / 3; box-shadow: var(--shadow); transition: transform .3s var(--ease); }
.st-img img { width: 100%; height: 100%; object-fit: cover; }
.station.locked .st-img img { filter: grayscale(1); opacity: .45; }
.st-num { position: absolute; top: 12px; inset-inline-start: 12px; width: 44px; height: 44px; border-radius: 50%; background: #fff; border: 2px solid var(--primary); color: var(--primary); display: grid; place-items: center; font-weight: 700; font-size: 18px; }
.station.locked .st-num { border-color: var(--line); color: #b4b1c2; }
.station.done .st-num { background: var(--primary); color: #fff; }
.st-lock { position: absolute; inset: 0; display: grid; place-items: center; color: #9a97ab; }
.st-lock .icon { width: 34px; height: 34px; }
.here { position: absolute; top: 12px; inset-inline-start: 12px; background: var(--accent); color: #fff; font-size: 13px; font-weight: 700; padding: 4px 12px; border-radius: 99px; box-shadow: 0 6px 14px rgba(255, 127, 26, .35); display: flex; gap: 6px; align-items: center; z-index: 2; }
.st-body h2 { font-size: 22px; }
.st-body .en { font-size: 13.5px; }
.st-body .goal { color: var(--ink-2); margin-top: 8px; font-size: 15px; }
.st-parts { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; align-items: center; }
.pip { width: 30px; height: 8px; border-radius: 99px; background: var(--line); }
.pip.open { background: #cdbcfb; }
.pip.mastered { background: var(--primary); }
.pip.quiz { width: 10px; background: var(--line); }
.pip.quiz.open { background: var(--accent); }
.st-body .btn { margin-top: 16px; }
a.station:hover .st-img { transform: translateY(-3px); }
a.station { color: inherit; }

/* ---------- صفحة المحاضرة ---------- */
.lec-hero { display: grid; grid-template-columns: 1fr 360px; gap: 30px; align-items: center; padding: 30px; margin-bottom: 24px; }
.lec-hero img { border-radius: var(--r); }
.lec-hero .goals { margin-top: 16px; display: grid; gap: 8px; }
.lec-hero .goals div { display: flex; gap: 10px; align-items: flex-start; color: var(--ink-2); }
.lec-hero .goals .icon { color: var(--ok); margin-top: 4px; }
.steps { display: grid; gap: 12px; }
.step { display: grid; grid-template-columns: 56px 1fr auto; gap: 16px; align-items: center; padding: 18px 20px; color: inherit; transition: border-color .15s, transform .2s var(--ease); }
a.step:hover { border-color: #cdbcfb; transform: translateX(-3px); }
.step .disc { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 18px; border: 2px solid var(--line); color: #b4b1c2; position: relative; }
.step.open .disc { border-color: var(--primary); color: var(--primary); }
.step.done .disc { background: var(--primary); border-color: var(--primary); color: #fff; }
.step.quiz .disc { border-color: var(--accent); color: var(--accent); }
.step.locked { opacity: .7; }
.step h3 { font-size: 17px; }
.step .meta { display: flex; gap: 14px; align-items: center; }
.ring { width: 46px; height: 46px; }
.ring circle { fill: none; stroke-width: 5; }
.ring .bg { stroke: var(--line-2); }
.ring .fg { stroke: var(--primary); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset 1s var(--ease); }
.ring.ok .fg { stroke: var(--ok); }
.ring text { font-size: 13px; font-weight: 700; fill: var(--ink-2); font-family: var(--font); }

/* ---------- مشغّل الدرس ---------- */
.lesson-top { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.stepper { display: flex; gap: 8px; margin-bottom: 22px; overflow-x: auto; padding-bottom: 2px; }
.stepper button { flex: 1; min-width: 130px; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; color: var(--muted); font-weight: 600; font-size: 15px; cursor: pointer; transition: border-color .2s, color .2s; text-align: right; }
.stepper button .n { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--line); font-size: 13px; }
.stepper button.on { border-color: var(--primary); color: var(--primary); }
.stepper button.on .n { border-color: var(--primary); }
.stepper button.seen .n { background: var(--primary); border-color: var(--primary); color: #fff; }
.panel { animation: rise .35s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.learn { display: grid; grid-template-columns: 1fr 340px; gap: 22px; align-items: start; }
.learn-main { padding: 28px; }
.learn-main .goal { display: flex; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 22px; color: var(--ink-2); }
.learn-main .goal .icon { color: var(--primary); margin-top: 4px; }
.points { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.points li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; font-size: 17.5px; line-height: 1.8; }
.points li::before { content: ""; width: 10px; height: 10px; margin-top: 12px; border-radius: 50%; background: var(--primary); justify-self: center; }
.imagine { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; margin-top: 24px; padding: 18px 20px; border-radius: var(--r); background: #fff7f0; border: 1px solid #ffe2c9; }
.imagine b { display: block; color: var(--accent-ink); margin-bottom: 2px; }
.imagine .icon { color: var(--accent); margin-top: 4px; }
.side-art { padding: 14px; }
.side-art img { border-radius: var(--r); }
.watch { padding: 18px 20px; margin-top: 16px; }
.watch h3 { display: flex; gap: 8px; align-items: center; color: var(--bad); font-size: 16px; margin-bottom: 8px; }
.watch ul { margin: 0; padding: 0 20px 0 0; }
.watch li { margin: 6px 0; color: var(--ink-2); }
.prose code, .q-text code, .points code, .imagine code, .watch code { font-family: var(--mono); direction: ltr; unicode-bidi: isolate; font-size: .9em; padding: 1px 7px; border-radius: 7px; border: 1px solid var(--line); background: #fafafc; color: var(--primary-ink); }

pre.code { direction: ltr; text-align: left; margin: 0; font-family: var(--mono); font-size: 15px; line-height: 1.7; background: #fbfbfd; border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; overflow-x: auto; white-space: pre; color: #27272a; }
pre.code .kw { color: var(--primary); font-weight: 600; }
pre.code .str { color: #b45309; }
pre.code .num { color: #0e7490; }
pre.code .cm { color: #a19eb2; }
pre.code .pp { color: #be185d; }
.code-wrap { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; align-items: start; }
.term { border: 1px solid var(--line); border-radius: var(--r); background: #fff; overflow: hidden; }
.term-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); font-size: 13px; color: var(--muted); font-weight: 600; }
.term-head i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); display: inline-block; }
.term pre { margin: 0; padding: 16px 18px; min-height: 120px; font-family: var(--mono); font-size: 15.5px; direction: ltr; text-align: left; white-space: pre-wrap; color: var(--ink); }
.term pre .caret { display: inline-block; width: 8px; height: 18px; background: var(--primary); vertical-align: -3px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.label { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 8px; display: flex; gap: 6px; align-items: center; }

/* ---------- الأسئلة ---------- */
.q { padding: 24px; }
.q + .q { margin-top: 14px; }
.q-top { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.q-n { flex: none; min-width: 32px; height: 32px; padding: 0 8px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: 14px; color: var(--primary); border: 1.5px solid var(--primary); }
.q-text { font-weight: 600; font-size: 18px; flex: 1; white-space: pre-line; line-height: 1.7; }
.q pre.code { margin: 0 0 14px; }
.opts { display: grid; gap: 10px; }
.opts.two { grid-template-columns: 1fr 1fr; }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; text-align: right; border: 1.5px solid var(--line); background: #fff; border-radius: 14px; padding: 13px 16px; cursor: pointer; font-size: 16.5px; color: var(--ink); transition: border-color .15s, transform .12s, background .15s; }
.opt:hover:not([disabled]) { border-color: #c8b6fb; }
.opt .l { width: 30px; height: 30px; flex: none; border-radius: 9px; border: 1px solid var(--line); display: grid; place-items: center; font-size: 14px; font-weight: 700; color: var(--muted); }
.opt .v { flex: 1; }
.opt .v.mono { font-family: var(--mono); direction: ltr; text-align: left; white-space: pre; }
.opt.sel { border-color: var(--primary); }
.opt.sel .l { border-color: var(--primary); color: var(--primary); }
.opt.right { border-color: var(--ok); }
.opt.right .l { border-color: var(--ok); color: var(--ok); }
.opt.right .icon { color: var(--ok); }
.opt.wrong { border-color: var(--bad); animation: shake .35s; }
.opt.wrong .l { border-color: var(--bad); color: var(--bad); }
.opt.wrong .icon { color: var(--bad); }
.opt[disabled] { cursor: default; }
@keyframes shake { 25% { transform: translateX(4px); } 75% { transform: translateX(-4px); } }
.feedback { margin-top: 14px; display: flex; gap: 10px; align-items: flex-start; font-size: 15.5px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); animation: rise .3s var(--ease); }
.feedback.ok { border-color: #bfe8cf; }
.feedback.ok b { color: var(--ok); }
.feedback.bad { border-color: #f6c6c7; }
.feedback.bad b { color: var(--bad); }
.feedback .why { color: var(--ink-2); }

/* مشغّل سؤال سؤال */
.runner { max-width: 820px; margin: 0 auto; }
.runner-top { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.dots { display: flex; gap: 6px; flex: 1; }
.dots i { flex: 1; height: 8px; border-radius: 99px; background: var(--line); transition: background .3s; cursor: pointer; }
.dots i.cur { background: #cdbcfb; }
.dots i.ok { background: var(--ok); }
.dots i.bad { background: var(--bad); }
.dots i.ans { background: var(--primary); }
.runner-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; gap: 10px; }
.done-card { text-align: center; padding: 34px 26px; }
.done-card img { width: 220px; margin: 0 auto 10px; }
.done-card h2 { font-size: 26px; }
.done-card p { color: var(--ink-2); margin-top: 8px; }
.done-card .row { justify-content: center; margin-top: 20px; }

.score-ring { width: 130px; height: 130px; }
.score-ring circle { fill: none; stroke-width: 11; }
.score-ring .bg { stroke: var(--line-2); }
.score-ring .fg { stroke: var(--primary); stroke-linecap: round; transition: stroke-dashoffset 1.2s var(--ease); transform: rotate(-90deg); transform-origin: 50% 50%; }
.score-ring text { font-size: 28px; font-weight: 700; fill: var(--ink); font-family: var(--font); }

/* ---------- المعلم ---------- */
.teach-hero { display: grid; grid-template-columns: 1fr 300px; gap: 24px; align-items: center; padding: 26px 30px; margin-bottom: 24px; }
.class-card { display: grid; grid-template-columns: 1fr; color: inherit; overflow: hidden; transition: transform .2s var(--ease), border-color .2s; }
.class-card:hover { transform: translateY(-3px); border-color: #cdbcfb; }
.lec { overflow: hidden; }
.lec + .lec { margin-top: 12px; }
.lec-head { display: flex; align-items: center; gap: 14px; padding: 14px 18px; cursor: pointer; user-select: none; }
.lec-head img { width: 76px; height: 57px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.lec-head .chev { transition: transform .25s; color: var(--muted); }
.lec.open .lec-head .chev { transform: rotate(180deg); }
.lec-body { display: none; border-top: 1px solid var(--line-2); }
.lec.open .lec-body { display: block; animation: rise .25s var(--ease); }
.item { display: flex; align-items: center; gap: 12px; padding: 13px 18px; border-top: 1px solid var(--line-2); }
.item:first-child { border-top: 0; }
.item .dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; border: 1.5px solid var(--line); color: #b4b1c2; font-size: 13px; font-weight: 700; }
.item .dot.open { border-color: var(--primary); color: var(--primary); }
.item .dot.quiz { border-color: var(--accent); color: var(--accent); }
.item .t { flex: 1; min-width: 0; }
.item .t .title { font-weight: 600; }
.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: #d6d3e2; border-radius: 99px; cursor: pointer; transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .25s var(--ease); box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(-20px); }

.heat td { text-align: center; }
.heat td:first-child, .heat th:first-child { text-align: right; position: sticky; right: 0; background: #fff; z-index: 1; }
.cellv { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px; }
.cellv.ok { color: var(--ok); }
.cellv.mid { color: var(--accent-ink); }
.cellv.no { color: #c8c5d4; }

/* ---------- وضع العرض: لوحة المعلم ---------- */
.console { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
.console-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.conn { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.conn i { width: 9px; height: 9px; border-radius: 50%; background: #c8c5d4; }
.conn.on { color: var(--ok); }
.conn.on i { background: var(--ok); box-shadow: 0 0 0 4px rgba(18, 161, 80, .15); }
.stage-frame { border-radius: var(--r-lg); border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow); overflow: hidden; }
.stage-cap { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line-2); font-size: 13px; color: var(--muted); font-weight: 600; }
.mini { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #fff; }
.mini .slide { position: absolute; top: 0; right: 0; width: 1280px; height: 720px; transform-origin: top right; pointer-events: none; }
.side { display: grid; gap: 14px; }
.notes { padding: 18px 20px; max-height: 52vh; overflow: auto; }
.notes h3 { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; font-size: 16px; }
.notes .prose { font-size: 15.5px; }
.notes .prose p + p { margin-top: 10px; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 20px; }
.kbd { font-family: var(--mono); font-size: 12px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 0 6px; color: var(--muted); background: #fff; }

/* ---------- الشريحة (مشتركة بين الشاشة ولوحة المعلم) ---------- */
.slide { width: 1280px; height: 720px; background: #fff; padding: 64px 80px; display: flex; flex-direction: column; position: relative; font-size: 26px; line-height: 1.6; }
.slide .s-kicker { color: var(--accent-ink); font-weight: 700; font-size: 20px; margin-bottom: 10px; }
.slide h2 { font-size: 48px; line-height: 1.25; }
.slide .s-sub { color: var(--muted); font-size: 22px; margin-top: 6px; direction: ltr; text-align: right; }
.slide .s-goal { margin-top: 34px; display: flex; gap: 14px; align-items: flex-start; font-size: 26px; color: var(--ink-2); }
.slide .s-goal .icon { width: 32px; height: 32px; color: var(--primary); margin-top: 6px; }
.slide .s-split { display: grid; grid-template-columns: 1fr 460px; gap: 50px; align-items: center; flex: 1; }
.slide .s-split img { border-radius: 24px; }
.slide .points li { font-size: 28px; grid-template-columns: 36px 1fr; }
.slide .points li::before { width: 14px; height: 14px; margin-top: 18px; }
.slide .imagine { font-size: 24px; margin-top: 30px; }
.slide pre.code { font-size: 24px; line-height: 1.6; padding: 24px 28px; }
.slide .q { border: 0; box-shadow: none; padding: 0; background: transparent; }
.slide .q-text { font-size: 32px; }
.slide .q-n { min-width: 44px; height: 44px; font-size: 20px; }
.slide .opt { font-size: 25px; padding: 16px 20px; }
.slide .opt .l { width: 40px; height: 40px; font-size: 20px; }
.slide .feedback { font-size: 22px; }
.slide .s-foot { position: absolute; bottom: 26px; left: 80px; right: 80px; display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 16px; }
.slide .s-foot img { width: 34px; height: 34px; }
.slide .s-center { flex: 1; display: grid; place-items: center; text-align: center; }
.slide .mist { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px; margin-top: 34px; }
.slide .mist div { border: 1.5px solid var(--line); border-radius: 22px; padding: 26px; font-size: 24px; }
.slide .mist .icon { width: 34px; height: 34px; color: var(--accent); margin-bottom: 10px; }
.slide .bigout { margin-top: 18px; border: 1.5px dashed var(--line); border-radius: 18px; padding: 18px 24px; font-family: var(--mono); font-size: 26px; direction: ltr; text-align: left; white-space: pre; }

/* ---------- شاشة العرض للطلاب ---------- */
body.screen-mode { background: #fff; overflow: hidden; }
.screen { position: fixed; inset: 0; display: grid; place-items: center; background: #fff; }
.screen .fit { position: absolute; top: 50%; left: 50%; width: 1280px; height: 720px; transform-origin: center center; }
.screen-hint { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 8px 10px; box-shadow: var(--shadow); transition: opacity .4s; z-index: 3; }
.screen-hint.hide { opacity: 0; pointer-events: none; }

/* ---------- عام ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(30, 27, 46, .35); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fadein .15s; }
@keyframes fadein { from { opacity: 0; } }
.modal { width: 100%; max-width: 540px; max-height: 90vh; overflow: auto; animation: pop .22s var(--ease); }
.modal.wide { max-width: 880px; }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(8px); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; border-bottom: 1px solid var(--line-2); }
.modal-body { padding: 22px; }
.modal-foot { display: flex; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line-2); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 12px; font-size: 14.5px; z-index: 60; animation: pop .2s; max-width: 90vw; }
.toast.err { background: var(--bad); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty img { width: 220px; margin: 0 auto 12px; }
.empty .icon { width: 34px; height: 34px; margin-bottom: 10px; color: #b4b1c2; }
.fade-in { animation: rise .4s var(--ease) both; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); } }

@media (max-width: 980px) {
  .console { grid-template-columns: 1fr; }
  .learn { grid-template-columns: 1fr; }
  .side-art { display: none; }
  .lec-hero, .teach-hero { grid-template-columns: 1fr; }
  .lec-hero img, .teach-hero img { max-width: 360px; }
  .code-wrap { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-art { border-left: 0; border-bottom: 1px solid var(--line); padding: 32px 24px; }
  .login-art h1 { font-size: 28px; }
  .login-art img { max-width: 360px; }
}
@media (max-width: 720px) {
  main { padding: 20px 16px 80px; }
  .topbar-in { padding: 8px 16px; gap: 10px; flex-wrap: wrap; }
  .nav { order: 3; flex-basis: 100%; }
  .who .name, .who .role, .brand span { display: none; }
  h1 { font-size: 24px; }
  .hello { grid-template-columns: 1fr; padding: 22px; }
  .hello img { display: none; }
  .hello h1 { font-size: 24px; }
  .station, .station:nth-child(even of .station) { grid-template-columns: 1fr; margin-inline-start: 0; gap: 14px; }
  .station:nth-child(even of .station) .st-img { order: 0; }
  .trail-line { display: none; }
  .opts.two { grid-template-columns: 1fr; }
  .q { padding: 18px; }
  .q-text { font-size: 16.5px; }
  .opt { font-size: 15.5px; padding: 12px 14px; }
  .points li { font-size: 16px; }
  .learn-main { padding: 20px; }
  .step { grid-template-columns: 44px 1fr; padding: 14px; }
  .step .disc { width: 44px; height: 44px; }
  .step .meta { grid-column: 1 / -1; }
  .stepper button { min-width: 110px; font-size: 14px; padding: 10px; }
  th, td { padding: 10px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
