/* ===== طبقة التصميم المحدَّث (تُحمَّل قبل theme.css) ===== */
:root {
  --radius: 18px;
  --primary: #0b7285;
  --primary-dark: #0a5a68;
  --grad: linear-gradient(135deg, #0b7285 0%, #1c7ed6 60%, #5f3dc4 100%);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .07);
  --shadow-hi: 0 2px 4px rgba(16, 24, 40, .05), 0 16px 36px rgba(16, 24, 40, .13);
  --bg: #f3f6fb;
}
body { background: radial-gradient(1200px 500px at 100% -10%, #e3f2fd 0, transparent 60%), radial-gradient(900px 500px at -10% 110%, #f3e8ff 0, transparent 60%), var(--bg); background-attachment: fixed; }
[data-theme='dark'] body { background: radial-gradient(1200px 500px at 100% -10%, #0e2a3a 0, transparent 60%), radial-gradient(900px 500px at -10% 110%, #1e1538 0, transparent 60%), var(--bg); background-attachment: fixed; }

/* أزرار */
.btn { border-radius: 12px; font-weight: 600; transition: transform .12s, box-shadow .15s, background .15s; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16, 24, 40, .1); }
.btn:active { transform: translateY(0); }
.btn.primary { background: var(--grad); border: 0; box-shadow: 0 6px 16px rgba(28, 126, 214, .28); }
.btn.primary:hover { filter: brightness(1.07); }
.chip { border-radius: 999px; font-weight: 600; transition: .15s; }
.chip.active { background: var(--grad); border-color: transparent; box-shadow: 0 4px 12px rgba(28, 126, 214, .25); }

/* بطاقات */
.card { border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.exp-card { background: var(--card); border-top: 0; border: 1px solid var(--line); position: relative; overflow: hidden; padding-top: 20px; transition: transform .15s, box-shadow .15s; }
.exp-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 5px; background: linear-gradient(90deg, var(--c), color-mix(in srgb, var(--c) 40%, #fff)); }
.exp-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hi); text-decoration: none; }
.grade-card { background: var(--card); border: 1px solid var(--line); transition: transform .15s, box-shadow .15s; }
.grade-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hi); text-decoration: none; }

/* شريط الخطوات */
.tabs { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 6px; }
.tabs button { border-radius: 12px; font-weight: 700; }
.tabs button.active { background: var(--grad); box-shadow: 0 4px 14px rgba(28, 126, 214, .3); }

/* رأس الدرس */
.exp-head { background: var(--card); border: 1px solid var(--line); border-inline-start: 0; overflow: visible; }
.exp-head::before { content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; width: 7px; border-radius: 0 var(--radius) var(--radius) 0; background: linear-gradient(180deg, var(--c), color-mix(in srgb, var(--c) 45%, #fff)); }
.exp-title .big-icon { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 16px; background: color-mix(in srgb, var(--c) 14%, var(--card)); }

/* ===== صفحة الدرس: بطاقات ملوّنة بأيقونة ===== */
.lesson .card { border: 1px solid var(--line); border-inline-start-width: 6px; padding: 18px 22px; }
.lesson .card h2 { display: flex; align-items: center; gap: 8px; }
.lesson-goal { border-inline-start-color: #1c7ed6 !important; background: color-mix(in srgb, #1c7ed6 6%, var(--card)); }
.lesson .card:nth-child(2) { border-inline-start-color: #fab005; background: color-mix(in srgb, #fab005 7%, var(--card)); }
.lesson .card:has(.lesson-steps) { border-inline-start-color: #7048e8; }
.lesson-steps { list-style: none; padding: 0; counter-reset: st; }
.lesson-steps li { counter-increment: st; position: relative; padding: 8px 46px 8px 12px; border-radius: 12px; background: color-mix(in srgb, #7048e8 5%, var(--card)); }
.lesson-steps li::before { content: counter(st); position: absolute; inset-inline-start: 8px; top: 8px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #7048e8, #1c7ed6); color: #fff; font-weight: 800; font-size: 14px; }
.lesson-example { border-inline-start-color: #12b886 !important; }
.lesson-example .ex-q { font-size: 18px; }
.lesson-example details summary { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; background: color-mix(in srgb, #12b886 14%, var(--card)); list-style: none; }
.lesson-warn { border-inline-start-color: #f76707 !important; background: color-mix(in srgb, #f76707 6%, var(--card)); }
.lesson-remember { border-inline-start-color: #2f9e44 !important; background: color-mix(in srgb, #2f9e44 7%, var(--card)); }
.lesson-remember li { font-weight: 700; }

/* شريط الخطوات «التالي» */
.step-next .btn { min-width: 240px; }

/* ===== ركن الصغار ===== */
body.kids-mode #main { background: radial-gradient(circle at 15% 10%, #fff3bf 0, transparent 35%), radial-gradient(circle at 85% 20%, #d0ebff 0, transparent 35%), radial-gradient(circle at 50% 100%, #ffdeeb 0, transparent 45%); }
.ktile { border-radius: 26px !important; transition: transform .2s cubic-bezier(.34, 1.56, .64, 1), box-shadow .2s !important; box-shadow: 0 10px 0 rgba(0, 0, 0, .12), 0 16px 30px rgba(0, 0, 0, .12) !important; }
.ktile:hover { transform: translateY(-6px) rotate(-1.5deg) scale(1.03); }
.ktile:active { transform: translateY(4px); box-shadow: 0 4px 0 rgba(0, 0, 0, .12) !important; }
.kg-opt { border-radius: 22px !important; box-shadow: 0 6px 0 rgba(0, 0, 0, .1) !important; transition: transform .15s cubic-bezier(.34, 1.56, .64, 1) !important; }
.kg-opt:hover { transform: translateY(-4px) scale(1.04); }
.kg-opt:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, .1) !important; }
.kcard { border-radius: 22px !important; box-shadow: 0 6px 0 rgba(0, 0, 0, .08), 0 10px 22px rgba(0, 0, 0, .08) !important; transition: transform .2s cubic-bezier(.34, 1.56, .64, 1) !important; }
.kcard:hover { transform: translateY(-4px) scale(1.05); }

/* ===== لوحات التجارب ===== */
.sim-stage { border-radius: 20px; border: 1px solid var(--line); }
.measure-svg { border-radius: 16px; }
.lcd { border-radius: 14px; box-shadow: inset 0 2px 8px rgba(0, 0, 0, .45), 0 4px 12px rgba(0, 0, 0, .15); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* صفحة الصف: فصول في شبكة، لكل فصل بطاقة تجمع دروسه */
.chap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 14px; margin-bottom: 10px; }
.chap-block { background: color-mix(in srgb, var(--c) 6%, var(--card)); border: 1px solid color-mix(in srgb, var(--c) 22%, var(--line)); border-radius: 20px; padding: 12px 12px 14px; }
.chap-block .chapter-title { margin: 2px 4px 10px; color: color-mix(in srgb, var(--c) 70%, var(--ink)); font-weight: 800; font-size: 15px; }
.chap-items { display: grid; gap: 10px; }
.chap-items .exp-card { margin: 0; }

/* اختبار الفصل */
.chap-test { display: flex; justify-content: center; gap: 8px; margin-top: 10px; width: 100%; border: 2px dashed color-mix(in srgb, var(--c, #1c7ed6) 45%, transparent); background: transparent; color: color-mix(in srgb, var(--c, #1c7ed6) 75%, var(--ink)); }
.chap-test:hover { background: color-mix(in srgb, var(--c, #1c7ed6) 10%, transparent); text-decoration: none; }
.ct-done { background: #2f9e44; color: #fff; border-radius: 999px; padding: 0 8px; font-size: 13px; }
.ct { max-width: 780px; margin-inline: auto; }
.ct-head { display: flex; justify-content: space-between; color: var(--muted); font-weight: 700; margin: 8px 0; }
.ct-q { font-size: 19px; font-weight: 700; line-height: 1.8; margin: 10px 0 16px; }
.ct-kind { display: block; font-size: 13px; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.ct-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.ct-result { text-align: center; padding: 22px; border-radius: 20px; display: grid; gap: 6px; margin-bottom: 14px; }
.ct-result.good { background: color-mix(in srgb, #2f9e44 12%, var(--card)); }
.ct-result.mid { background: color-mix(in srgb, #f59f00 14%, var(--card)); }
.ct-result.low { background: color-mix(in srgb, #e03131 10%, var(--card)); }
.ct-pct { font-size: 54px; font-weight: 900; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ct-review { display: flex; flex-wrap: wrap; gap: 8px; }
