:root {
  color-scheme: light;
  --forest: #173e2d;
  --deep: #102d22;
  --leaf: #2a6948;
  --mint: #e6f3e9;
  --gold: #f4c84a;
  --sun: #ffe797;
  --coral: #e96950;
  --ink: #1d2c25;
  --muted: #62736a;
  --paper: #fffdf7;
  --line: #dce6dc;
  --shadow: 0 18px 46px rgba(25, 49, 36, .11);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: #f7f8f2; }
body { margin: 0; color: var(--ink); background: #f7f8f2; min-width: 320px; }
a { color: inherit; }
button, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #e09f13; outline-offset: 3px; }
.topbar { min-height: 74px; display: flex; align-items: center; justify-content: space-between; padding: 12px clamp(20px, 6vw, 88px); background: var(--deep); color: white; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px 13px 13px 4px; background: var(--gold); color: var(--forest); font: 700 28px/1 "Noto Naskh Arabic", "Amiri", serif; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 18px; letter-spacing: .03em; }
.brand small { margin-top: 2px; color: #c8d7ca; font-size: 11px; }
.top-link { color: #f4d975; text-decoration: none; font-size: 14px; font-weight: 700; }
.top-link:hover { color: white; }
#app { min-height: 70vh; }
.hero { position: relative; overflow: hidden; padding: clamp(38px, 8vw, 104px) clamp(22px, 9vw, 132px) 82px; color: white; background: radial-gradient(ellipse at 88% 25%, rgba(244,200,74,.22), transparent 32%), linear-gradient(125deg, #173e2d 0%, #1f583b 65%, #32784f 100%); }
.hero::before, .hero::after { content: ""; position: absolute; border: 1px solid rgba(250,221,126,.22); border-radius: 50%; pointer-events: none; }
.hero::before { width: 340px; height: 340px; right: -85px; top: -128px; }
.hero::after { width: 245px; height: 245px; right: -36px; top: -80px; }
.hero-inner { position: relative; z-index: 1; max-width: 1120px; margin: auto; display: grid; grid-template-columns: 1.25fr .75fr; align-items: center; gap: clamp(30px, 7vw, 100px); }
.eyebrow { margin: 0 0 16px; color: var(--gold); font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.hero h1 { max-width: 670px; margin: 0; font-size: clamp(38px, 6.2vw, 76px); line-height: 1.02; letter-spacing: -.055em; }
.hero h1 span { display: block; margin-top: 13px; color: #f7d96d; font-size: .72em; letter-spacing: -.035em; }
.hero-copy { max-width: 590px; margin: 25px 0 0; color: #d8e7d9; font-size: 17px; line-height: 1.75; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.button { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 0 20px; border: 0; border-radius: 12px; text-decoration: none; font-weight: 800; cursor: pointer; transition: transform .18s ease, box-shadow .18s ease, background .18s ease; }
.button:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(11,30,19,.17); }
.button-primary { background: var(--gold); color: var(--deep); }
.button-outline { border: 1px solid rgba(255,255,255,.4); color: white; background: rgba(255,255,255,.06); }
.hero-note { max-width: 270px; padding: 26px; border: 1px solid rgba(255,255,255,.2); border-radius: 25px 25px 25px 6px; background: rgba(255,255,255,.08); backdrop-filter: blur(4px); transform: rotate(2deg); }
.hero-note .arabic { color: var(--sun); font-size: 35px; line-height: 1.8; }
.hero-note p:last-child { margin: 8px 0 0; color: #dce9de; line-height: 1.6; font-size: 13px; }
.main-content { max-width: 1180px; margin: 0 auto; padding: 50px clamp(20px, 5vw, 70px) 84px; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin: 0 0 22px; }
.section-head h2 { margin: 0; font-size: clamp(23px, 3vw, 32px); letter-spacing: -.035em; }
.section-head p { max-width: 470px; margin: 8px 0 0; color: var(--muted); line-height: 1.65; }
.progress-card { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; margin: 25px 0 30px; padding: 18px 22px; border: 1px solid var(--line); border-radius: 17px; background: white; box-shadow: 0 7px 25px rgba(25,49,36,.04); }
.progress-number { color: var(--leaf); font-weight: 850; white-space: nowrap; }
.progress-track { height: 10px; overflow: hidden; border-radius: 999px; background: #eaf0e9; }
.progress-fill { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #5b9e69, var(--gold)); transition: width .4s ease; }
.progress-caption { color: var(--muted); font-size: 13px; }
.lesson-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.lesson-card { min-height: 176px; position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: 20px; border: 1px solid var(--line); border-radius: 17px; background: white; text-decoration: none; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.lesson-card:hover { transform: translateY(-3px); border-color: #8ab795; box-shadow: var(--shadow); }
.lesson-card.ready:nth-child(3n+2) { background: #fff9e8; border-color: #f0dfaa; }
.lesson-card.ready:nth-child(3n) { background: #eef7ef; border-color: #d0e3d2; }
.lesson-card.pending { background: #f3f4ef; border-style: dashed; color: #6e7970; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lesson-index { color: var(--leaf); font-size: 12px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.status-pill { padding: 5px 9px; border-radius: 99px; background: #e2f1e5; color: #28633e; font-size: 11px; font-weight: 800; }
.pending .status-pill { background: #e7e9e3; color: #657066; }
.lesson-card h3 { margin: 15px 0 8px; font-size: 18px; line-height: 1.35; }
.lesson-card p { margin: 0; color: #65736a; font-size: 13px; line-height: 1.5; }
.card-arrow { position: absolute; right: 20px; bottom: 18px; color: var(--leaf); font-size: 20px; }
.course-callout { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 28px; padding: 22px 24px; border-radius: 16px; background: #1d4834; color: white; }
.course-callout strong { display: block; margin-bottom: 5px; }
.course-callout span { color: #d0dfd2; font-size: 13px; line-height: 1.55; }
.course-callout .arabic { color: var(--gold); font-size: 26px; white-space: nowrap; }
.lesson-banner { padding: 28px clamp(20px, 6vw, 90px); background: linear-gradient(110deg, #edf6ed, #fff7db 68%, #ffecd9); border-bottom: 1px solid #e5e8da; }
.lesson-banner-inner { max-width: 1080px; margin: auto; }
.breadcrumb { display: inline-block; margin-bottom: 18px; color: #56705e; text-decoration: none; font-size: 13px; font-weight: 700; }
.breadcrumb:hover { text-decoration: underline; }
.lesson-heading { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: start; }
.lesson-number { min-width: 64px; height: 64px; display: grid; place-items: center; border-radius: 20px 20px 20px 5px; background: var(--forest); color: var(--gold); font-size: 22px; font-weight: 900; }
.lesson-heading h1 { margin: 1px 0 9px; font-size: clamp(27px, 4vw, 42px); letter-spacing: -.04em; }
.lesson-heading p { max-width: 750px; margin: 0; color: #52645a; font-size: 16px; line-height: 1.65; }
.lesson-progress { max-width: 1080px; margin: 20px auto 0; display: flex; align-items: center; gap: 14px; }
.lesson-progress small { color: #52645a; white-space: nowrap; }
.lesson-progress .progress-track { flex: 1; }
.lesson-body { max-width: 1080px; margin: 0 auto; padding: 36px clamp(20px, 5vw, 60px) 76px; }
.rule-card { display: grid; grid-template-columns: 180px 1fr; gap: 28px; padding: 26px; border-radius: 18px; background: var(--forest); color: white; box-shadow: var(--shadow); }
.rule-label { color: var(--gold); font-size: 12px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.rule-label .arabic { display: block; margin-top: 11px; font-size: 27px; line-height: 1.7; }
.rule-copy { margin: 0; color: #e1ece2; font-size: 16px; line-height: 1.85; }
.content-section { margin-top: 40px; }
.content-section-head { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-bottom: 17px; }
.content-section-head h2 { margin: 0; font-size: clamp(21px, 3vw, 28px); letter-spacing: -.025em; }
.content-section-head p { margin: 0; color: var(--muted); font-size: 13px; }
.example-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.example-card { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: white; }
.example-card:nth-child(3n+2) { background: #fff9e9; border-color: #f0e2b4; }
.example-meta { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 13px; color: #748176; font-size: 10px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.example-target { color: #36714a; letter-spacing: 0; text-transform: none; }
.arabic { font-family: "Noto Naskh Arabic", "Amiri", "Times New Roman", serif; font-weight: 500; direction: rtl; unicode-bidi: isolate; }
.example-text { margin: 0 0 12px; color: #172b1f; font-size: clamp(28px, 3vw, 34px); line-height: 1.95; text-align: right; overflow-wrap: anywhere; }
details { border-top: 1px solid rgba(72, 106, 79, .16); padding-top: 11px; }
details summary { color: #356d48; font-size: 13px; font-weight: 800; cursor: pointer; }
.detail-copy { margin: 10px 0 0; color: #52645a; font-size: 14px; line-height: 1.75; }
.exercise-list { display: grid; gap: 14px; }
.exercise-card { padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); transition: border-color .2s, background .2s, box-shadow .2s; }
.exercise-card:nth-child(even) { background: #f0f7f0; }
.exercise-card.is-correct { border-color: #4b9c63; background: #e8f5e9; box-shadow: inset 4px 0 #4b9c63; }
.exercise-card.is-wrong { border-color: var(--coral); background: #fff0ed; box-shadow: inset 4px 0 var(--coral); }
.exercise-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; color: #718077; font-size: 11px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.exercise-prompt { margin: 8px 0 10px; font-size: clamp(28px, 3.2vw, 36px); line-height: 1.95; text-align: right; color: #152d20; overflow-wrap: anywhere; }
.exercise-question { margin: 0 0 13px; color: #53645a; font-size: 14px; line-height: 1.55; }
.exercise-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.exercise-select { min-height: 47px; width: 100%; padding: 9px 13px; border: 1px solid #c7d6c9; border-radius: 11px; background: white; color: var(--ink); font-size: 14px; }
.feedback { min-height: 20px; margin-top: 8px; font-size: 13px; font-weight: 750; }
.feedback.correct { color: #226d39; }
.feedback.wrong { color: #b24530; }
.answer-details { margin-top: 11px; }
.answer-details summary { font-size: 12px; }
.quiz-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 19px; }
.check-button { min-height: 50px; padding: 0 22px; background: var(--coral); color: white; }
.quiz-result { color: var(--muted); font-size: 14px; font-weight: 700; }
.lesson-nav { display: flex; justify-content: space-between; gap: 14px; margin-top: 42px; padding-top: 21px; border-top: 1px solid var(--line); }
.nav-button { min-width: 130px; background: var(--forest); color: white; }
.nav-button.next { background: var(--gold); color: var(--deep); }
.nav-button[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.template-notice { padding: 22px; border: 1px solid #e7dcae; border-radius: 16px; background: #fff8df; color: #5b5130; line-height: 1.7; }
.template-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; margin-top: 25px; }
.template-slot { min-height: 135px; padding: 20px; border: 1px dashed #c8d3c7; border-radius: 15px; background: rgba(255,255,255,.75); }
.template-slot h3 { margin: 0 0 12px; color: #607064; font-size: 14px; }
.template-slot .arabic { color: #8a998c; font-size: 25px; line-height: 1.8; text-align: right; }
.site-footer { display: flex; justify-content: space-between; gap: 16px; padding: 24px clamp(20px, 6vw, 88px); background: #122e23; color: #d6e2d7; font-size: 12px; line-height: 1.5; }
.loading, .load-error { padding: 80px 24px; text-align: center; color: var(--muted); }
.load-error { color: #9c3e30; }
@media (max-width: 820px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-note { display: none; }
  .lesson-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .rule-card { grid-template-columns: 1fr; gap: 10px; }
  .rule-label .arabic { display: inline-block; margin: 0 12px 0 0; vertical-align: middle; }
}
@media (max-width: 560px) {
  .topbar { min-height: 64px; padding-inline: 17px; }
  .hero { padding: 46px 22px 58px; }
  .hero h1 { font-size: 43px; }
  .hero-copy { font-size: 15px; }
  .main-content { padding-top: 38px; }
  .section-head { display: block; }
  .progress-card { grid-template-columns: auto 1fr; gap: 9px 14px; padding: 15px; }
  .progress-caption { grid-column: 1 / -1; }
  .lesson-grid, .example-grid, .template-grid { grid-template-columns: 1fr; }
  .lesson-card { min-height: 150px; }
  .lesson-banner { padding: 22px 19px; }
  .lesson-heading { grid-template-columns: 48px 1fr; gap: 13px; }
  .lesson-number { min-width: 48px; height: 48px; border-radius: 15px 15px 15px 4px; font-size: 17px; }
  .lesson-heading h1 { font-size: 27px; }
  .lesson-heading p { font-size: 14px; }
  .lesson-body { padding: 25px 17px 50px; }
  .rule-card { padding: 19px; }
  .rule-copy { font-size: 15px; }
  .content-section-head { display: block; }
  .content-section-head p { margin-top: 6px; }
  .example-card, .exercise-card { padding: 16px; }
  .example-text, .exercise-prompt { font-size: 27px; }
  .exercise-controls { grid-template-columns: 1fr; }
  .check-button { width: 100%; }
  .lesson-nav .button { min-width: 0; flex: 1; padding-inline: 12px; font-size: 13px; }
  .site-footer { flex-direction: column; }
  .course-callout { align-items: flex-start; }
  .course-callout .arabic { font-size: 21px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
