/* ==========================================================================
   فهيم — Grammar: overview (grammar.html) and lesson (grammar-unit.html).
   A calm reading page: cream paper, one white column, forest-ink type.
   Colour carries meaning only — yellow = the word that matters / your next
   step, mint = right, terracotta = needs a fix — and every state also has
   words and a symbol, never colour alone.
   English is set in a plain reading face and isolated inside Arabic text
   (grammar-core.js → <bdi class="gx-en">). Text never animates (Safari drops
   Arabic marks under effects).
   ========================================================================== */
:root {
  --font-en: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --gx-good: #2f6b1f;          /* right: text and ticks */
  --gx-good-bg: #e7efdb;
  --gx-bad: #a8431a;           /* needs a fix: terracotta, darkened for contrast */
  --gx-bad-bg: #fbe9df;
  --gx-check: #6a5300;         /* waiting for the student's own review */
  --gx-check-bg: #fff6c4;
  --gx-col: 70ch;              /* reading measure for Arabic paragraphs */
}
.gx-en { font-family: var(--font-en); }
bdi.gx-en { unicode-bidi: isolate; }
.gx-page .main { max-width: 1080px; }
.gx-muted { color: var(--muted); }
.gx-small { font-size: 13px; }
.v-none { padding: 20px 4px; color: var(--muted); font-size: 14px; }
.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; }
.gx-label { font-size: 12.5px; font-weight: var(--w-semibold); color: var(--muted); }
.gx-note { font-size: 13.5px; color: var(--muted); line-height: 1.8; }
.gx-link { font: inherit; font-size: 14px; font-weight: var(--w-semibold); background: none; border: 0; padding: 4px 0; color: var(--ink); text-decoration: underline; text-decoration-color: var(--ink); text-decoration-thickness: 1.5px; text-underline-offset: 5px; cursor: pointer; }
.gx-link:hover { background: var(--highlight); }
/* a reference to open (the basics, an earlier lesson): a button, never a word inside the sentence */
.gx-open { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 13.5px; font-weight: var(--w-semibold); line-height: 1.5; color: var(--ink); text-decoration: none;
  background: var(--surface); border: 1.5px solid var(--ink); border-radius: var(--r-pill); padding: 5px 14px; cursor: pointer; white-space: nowrap; }
.gx-open .icon { width: 16px; height: 16px; flex: none; }
.gx-open:hover { background: var(--highlight); }
.gx-open:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.gx-hl { background: var(--highlight); color: var(--ink); padding: 0 .15em; border-radius: 3px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }

/* ============================ overview ============================ */
.gx-hub { display: grid; gap: 20px; }
/* the top of the hub (chips, «خطوتك التالية», the two doors) is the reading hub's: reading-lessons.css (rh-*) */
/* every lesson: one white card, the rows in the reading lessons list's look (gold numbers, the next one in gold) */
.gx-browse { display: grid; gap: 14px; padding: 22px 24px 24px; border-radius: 28px; background: var(--surface); border: 1px solid rgba(255, 255, 255, .9); scroll-margin-top: 16px; }
.gx-browse__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 18px; }
.gx-browse__head h2 { font-size: 21px; font-weight: var(--w-medium); }
.gx-browse__head h2 small { font-size: 13px; font-weight: 400; color: var(--muted); margin-inline-start: 6px; }
.gx-browse__links { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.gx-tools { display: flex; flex-wrap: wrap; gap: 10px; }
.gx-search { flex: 1 1 260px; position: relative; display: block; }
.gx-search svg { position: absolute; inset-inline-start: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.gx-search input, .gx-topic select { font: inherit; font-size: 15px; width: 100%; min-height: 46px; padding: 10px 14px; border: 1.5px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--ink); }
.gx-search input { padding-inline-start: 40px; }
.gx-topic { flex: 0 1 220px; }
.gx-search input:focus, .gx-topic select:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px rgba(23, 25, 23, .15); }
.gx-count { font-size: 13.5px; color: var(--muted); min-height: 1px; }
.gx-count:empty { display: none; }
.gx-empty { display: block; padding: 16px 18px; border-radius: var(--r-card); background: var(--lilac); color: var(--ink-2); font-size: 14.5px; line-height: 1.8; }

/* one list in study order */
.gx-list { display: grid; gap: 10px; list-style: none; padding: 0; margin: 0; }
.gx-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 4px 16px; align-items: center; padding: 16px 18px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); color: var(--ink); text-decoration: none; transition: border-color var(--dur-fast), background-color var(--dur-fast); }
.gx-row:hover { border-color: var(--l-plan); background: color-mix(in srgb, var(--t-plan) 35%, #fff); }
.gx-row.is-next { border-color: var(--highlight-edge); background: var(--t-plan); }
.gx-row__n { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; font-weight: var(--w-display); background: var(--t-plan); color: var(--c-plan); border: 1.5px solid var(--l-plan); align-self: start; }
.gx-row.is-progress .gx-row__n, .gx-row.is-next .gx-row__n { background: var(--highlight); border-color: var(--highlight); color: var(--ink); }
.gx-row.is-done .gx-row__n { background: var(--c-speaking); border-color: var(--c-speaking); color: #fff; }
.gx-row__main { display: grid; gap: 3px; min-width: 0; }
.gx-row__t { font-size: 16.5px; font-weight: var(--w-display); line-height: 1.5; }
.gx-row__t .gx-en { font-size: 13px; font-weight: 400; color: var(--muted); margin-inline-start: 8px; }
.gx-row__goal { font-size: 14px; line-height: 1.75; color: var(--ink-2); }
.gx-row__meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.gx-status { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-weight: var(--w-medium); }
.gx-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--muted); flex: none; }
.gx-status.is-progress::before { background: var(--highlight); border-color: var(--ink); }
.gx-status.is-review { color: var(--gx-bad); }
.gx-status.is-review::before { background: var(--gx-bad); border-color: var(--gx-bad); }
.gx-status.is-done { color: var(--gx-good); }
.gx-status.is-done::before { background: var(--gx-good); border-color: var(--gx-good); }
.gx-row__go { font-size: 14px; font-weight: var(--w-semibold); padding: 8px 14px; border-radius: var(--r-button); border: 1px solid var(--ink); white-space: nowrap; }
.gx-row.is-next .gx-row__go, .gx-row:hover .gx-row__go { background: var(--ink); color: var(--canvas); }

/* ============================ lesson: header + the two choices ============================ */
.gx-head { display: grid; gap: 4px; flex: 1 1 0; min-width: 0; }
.gx-back { font-size: 14px; justify-self: start; }
.gx-eyebrow { font-size: 13px; color: var(--muted); }
.gx-head h1 { font-size: 30px; line-height: 1.35; font-weight: var(--w-display); }
.gx-head h1 .gx-en { display: block; text-align: right; font-size: 15px; font-weight: 400; color: var(--muted); margin-top: 2px; }
.gx-goal { font-size: 15px; color: var(--ink-2); line-height: 1.7; }

.gx-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 5px; border-radius: 14px; background: var(--lilac); max-width: 560px; }
.gx-switch[hidden], .gx-switch:empty { display: none; }
.gx-switch button { font: inherit; display: grid; gap: 1px; text-align: center; padding: 10px 12px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--ink-2); font-size: 16px; font-weight: var(--w-display); cursor: pointer; }
.gx-switch button small { font-size: 12px; font-weight: 400; color: var(--muted); }
.gx-switch button[aria-selected="true"] { background: var(--surface); color: var(--ink); border-color: var(--ink); box-shadow: var(--shadow-sm); }
.gx-switch button:not([aria-selected="true"]):hover { background: rgba(255, 255, 255, .6); }
.gx-view:focus { outline: none; }

/* ============================ lesson: layout ============================ */
#gx-lesson { container-type: inline-size; }
.gx-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 36px; align-items: start; }
.gx-toc { position: sticky; top: 20px; display: grid; gap: 8px; padding-top: 6px; }
.gx-toc__h { font-size: 12.5px; font-weight: var(--w-semibold); color: var(--muted); }
.gx-toc__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; border-inline-start: 2px solid var(--border); }
.gx-toc__list a { display: block; padding: 6px 12px; margin-inline-start: -2px; border-inline-start: 2px solid transparent; font-size: 13.5px; line-height: 1.6; color: var(--ink-2); text-decoration: none; }
.gx-toc__list a:hover { color: var(--ink); background: var(--lilac); }
.gx-toc__list a[aria-current] { color: var(--ink); font-weight: var(--w-semibold); border-color: var(--ink); background: var(--surface); }
.gx-toc-m { display: none; }

.gx-article { min-width: 0; display: grid; gap: 0; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-panel); overflow: hidden; }
.gx-resume { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; padding: 14px 28px; background: var(--highlight-soft); border-bottom: 1px solid var(--border-strong); font-size: 15px; }
.gx-resume[hidden] { display: none; }

.gx-sec { padding: 30px 32px 32px; display: grid; gap: 16px; align-content: start; scroll-margin-top: 16px; }
.gx-sec + .gx-sec { border-top: 1px solid var(--border); }
.gx-sec h2 { font-size: 22px; line-height: 1.45; font-weight: var(--w-display); display: flex; align-items: center; gap: 12px; }
.gx-sec h2:focus { outline: none; }
.gx-sec__n { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; background: var(--highlight); box-shadow: inset 0 0 0 1px var(--ink); }

/* the explanation */
.gx-text { display: grid; gap: 12px; max-width: var(--gx-col); font-size: 16.5px; line-height: 1.95; color: var(--ink); }
.gx-text p { margin: 0; }
.gx-lead-in { font-size: 17.5px; line-height: 1.9; font-weight: var(--w-medium); }
.gx-goal-text { font-size: 18px; line-height: 1.85; font-weight: var(--w-medium); max-width: var(--gx-col); }
.gx-pre, .gx-terms { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; font-size: 14.5px; line-height: 1.85; color: var(--ink-2); max-width: var(--gx-col);
  padding: 12px 14px; border-radius: var(--r-card); }
.gx-pre { background: var(--canvas); border: 1px solid var(--border-strong); }
.gx-terms { background: var(--lilac); }
.gx-pre > p, .gx-terms > p { flex: 1 1 260px; margin: 0; min-width: 0; }
.gx-pre b, .gx-terms b { color: var(--ink); }
.gx-pre__acts { display: flex; flex-wrap: wrap; gap: 8px; }
.gx-pair { display: grid; gap: 2px; padding: 10px 14px; border-radius: var(--r-card); background: var(--canvas); border-inline-start: 3px solid var(--border-strong); }
.gx-pair__en { direction: ltr; text-align: left; font-family: var(--font-en); font-size: 17px; line-height: 1.7; color: var(--ink); overflow-wrap: anywhere; }
.gx-pair__ar { font-size: 15px; line-height: 1.85; color: var(--ink-2); }
.gx-eng { direction: ltr; text-align: left; font-family: var(--font-en); font-size: 17.5px; line-height: 1.75; color: var(--ink); overflow-wrap: anywhere; }

/* «مثال قبل ما نبدأ» (kept from the earlier lessons) */
.gx-intro { display: grid; gap: 8px; padding: 16px 18px; border-radius: var(--r-card); background: var(--canvas); border: 1px dashed var(--border-strong); max-width: var(--gx-col); }
.gx-intro__ar { font-size: 14.5px; line-height: 1.85; color: var(--ink-2); }

/* an explained example and its «why?» */
.gx-example { margin: 4px 0 0; display: grid; gap: 6px; padding: 18px 20px; border-radius: 14px; background: var(--canvas); border: 1px solid var(--border-strong); max-width: var(--gx-col); }
.gx-example__en { direction: ltr; text-align: left; font-family: var(--font-en); font-size: 20px; line-height: 1.6; color: var(--ink); overflow-wrap: anywhere; }
.gx-example__ar { font-size: 15px; line-height: 1.8; color: var(--ink-2); }
.gx-why { display: grid; gap: 10px; margin-top: 8px; padding-top: 14px; border-top: 1px dashed var(--border-strong); }
.gx-why__q { display: grid; gap: 2px; font-size: 15px; line-height: 1.75; }
.gx-why__q span { font-size: 13.5px; color: var(--muted); }
.gx-why__a { display: grid; gap: 4px; padding: 12px 14px; border-radius: var(--r-card); background: var(--gx-good-bg); font-size: 15.5px; line-height: 1.85; }
.gx-why__a .gx-note:empty { display: none; }

/* «كيف أبني الجملة؟»: forms read left to right, each with its role */
.gx-note-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; font-size: 14.5px; line-height: 1.85; color: var(--ink-2); max-width: var(--gx-col); }
.gx-note-line > p { flex: 1 1 260px; margin: 0; min-width: 0; }
.gx-forms { display: grid; gap: 8px; }
.gx-form-row { display: grid; gap: 6px; padding: 12px 14px; border-radius: var(--r-card); background: var(--canvas); border: 1px solid var(--border); direction: ltr; text-align: left; }
.gx-form-row__k { justify-self: start; font-family: var(--font-en); font-size: 12.5px; font-weight: 700; padding: 1px 8px; border-radius: var(--r-pill); background: var(--ink); color: var(--canvas); }
.gx-form-row__v { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.gx-form-row__v > span { display: grid; gap: 0; font-family: var(--font-en); font-size: 16.5px; line-height: 1.6; color: var(--ink); overflow-wrap: anywhere; }
.gx-form-row__v small { font-family: var(--font); direction: rtl; text-align: left; font-size: 12px; color: var(--muted); }
.gx-form-note { font-size: 15px; line-height: 1.85; color: var(--ink-2); padding: 4px 2px; }
.gx-form { justify-self: start; direction: ltr; text-align: left; font-family: var(--font-en); font-size: 15.5px; font-weight: 600; line-height: 1.6; padding: 6px 12px; border-radius: 8px; background: var(--accent-soft); color: var(--ink); overflow-wrap: anywhere; }

/* «انتبه لهالنقطة» */
.gx-caution { padding: 16px 18px; border-radius: var(--r-card); background: var(--gx-bad-bg); border-inline-start: 4px solid var(--terracotta); }
.gx-caution .gx-pair { background: rgba(255, 255, 255, .7); }

/* your turn: the correction and the IELTS task sit on a quiet tint */
.gx-sec--task { background: #fbfaf4; }
.gx-task-ask { font-size: 16.5px; line-height: 1.9; font-weight: var(--w-medium); max-width: var(--gx-col); }
.gx-wrongline { padding: 10px 14px; border-radius: var(--r-card); background: var(--surface); border: 1px dashed var(--gx-bad); }
.gx-tag { justify-self: start; font-family: var(--font-en); font-size: 12.5px; font-weight: 700; padding: 3px 10px; border-radius: var(--r-pill); background: var(--ink); color: var(--canvas); }
.gx-steps { display: grid; gap: 8px; padding: 14px 16px; border-radius: var(--r-card); background: var(--surface); border: 1px solid var(--border); }
.gx-steps h3 { font-size: 15px; font-weight: var(--w-display); }
.gx-steps ol { display: grid; gap: 4px; padding-inline-start: 22px; font-size: 15px; line-height: 1.85; }
.gx-good-line { color: var(--gx-good); font-weight: 600; }
.gx-steps__ans { display: grid; gap: 2px; font-size: 15px; }
.gx-model { display: grid; gap: 6px; padding: 14px 16px; border-radius: var(--r-card); background: var(--gx-good-bg); }
.gx-model:focus { outline: none; }
.gx-after { display: grid; gap: 10px; }
.gx-text-sm { font-size: 15px; line-height: 1.85; max-width: var(--gx-col); }
.gx-words { font-size: 12.5px; color: var(--muted); }

/* summary + the way to the test */
.gx-sec--summary .gx-text { font-size: 17px; }
.gx-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 18px 20px; border-radius: var(--r-card); background: var(--highlight-soft); border: 1px solid var(--border-strong); }
.gx-cta p { font-size: 15.5px; line-height: 1.8; max-width: 52ch; }

/* optional extra exercises */
.gx-extra > summary { list-style: none; cursor: pointer; display: grid; gap: 4px; padding: 14px 16px; border-radius: var(--r-card); border: 1px solid var(--border-strong); background: var(--canvas); }
.gx-extra > summary::-webkit-details-marker { display: none; }
.gx-extra > summary h2 { font-size: 18px; }
.gx-extra > summary h2::after { content: "＋"; margin-inline-start: auto; font-weight: 700; }
.gx-extra[open] > summary h2::after { content: "−"; }
.gx-extra > summary span { font-size: 13.5px; color: var(--muted); }
.gx-extra__in { display: grid; gap: 14px; padding: 18px 2px 0; }

/* inputs and actions */
.gx-input { font: inherit; font-family: var(--font-en); font-size: 17px; direction: ltr; text-align: left; padding: 8px 12px; border: 1.5px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--ink); min-width: 9ch; max-width: 100%; }
.gx-input--ar { font-family: var(--font); font-size: 15.5px; text-align: start; }
.gx-input--gap { width: 11ch; padding: 3px 8px; margin: 0 4px; font-size: 17px; }
.gx-input:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px rgba(23, 25, 23, .15); }
.gx-input[readonly] { background: var(--lilac); }
.gx-input.is-good { border-color: var(--gx-good); background: var(--gx-good-bg); }
.gx-input.is-bad { border-color: var(--gx-bad); background: var(--gx-bad-bg); }
textarea.gx-input { width: 100%; min-height: 64px; resize: vertical; line-height: 1.7; }
textarea.gx-input.gx-long { min-height: 140px; }
input[type="text"].gx-input:not(.gx-input--gap) { width: 100%; }
.gx-acts { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.gx-acts[hidden] { display: none; }
.gx-hint { display: grid; gap: 6px; padding: 12px 14px; border-radius: var(--r-card); background: var(--lilac); font-size: 14.5px; line-height: 1.85; }

/* feedback: one band, coloured by meaning, always with words */
.gx-fb { display: grid; gap: 8px; padding: 14px 16px; border-radius: var(--r-card); font-size: 15px; line-height: 1.85; border-inline-start: 4px solid; }
.gx-fb > b { font-size: 15.5px; }
.gx-fb p { margin: 0; }
.gx-fb.is-good { background: var(--gx-good-bg); border-color: var(--gx-good); }
.gx-fb.is-good > b { color: var(--gx-good); }
.gx-fb.is-bad { background: var(--gx-bad-bg); border-color: var(--gx-bad); }
.gx-fb.is-bad > b { color: var(--gx-bad); }
.gx-fb.is-info { background: var(--lilac); border-color: var(--border-strong); }
.gx-compare { display: grid; gap: 8px; }
.gx-compare > div { display: grid; gap: 2px; padding: 8px 12px; border-radius: 8px; background: rgba(255, 255, 255, .75); }
.gx-compare small { font-size: 12.5px; color: var(--muted); font-family: var(--font); direction: rtl; display: block; text-align: right; }
.gx-diff .is-add { background: var(--highlight); padding: 0 .15em; border-radius: 3px; }
.gx-diff .is-del { background: var(--lilac); text-decoration: underline dotted; text-underline-offset: 3px; padding: 0 .15em; border-radius: 3px; }   /* differs from the model — not marked wrong */

/* extra exercises (kept from the earlier lessons) */
.gx-ex { display: grid; gap: 14px; }
.gx-ex h3 { font-size: 16px; font-weight: var(--w-display); }
.gx-ex h3:focus { outline: none; }
.gx-ex__top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; align-items: baseline; }
.gx-meter { height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; }
.gx-meter span { display: block; height: 100%; background: var(--ink); }
.gx-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.gx-opts--col { flex-direction: column; align-items: stretch; }
.gx-opt { font: inherit; font-family: var(--font-en); direction: ltr; text-align: left; font-size: 16px; padding: 9px 16px; border-radius: 10px; border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--ink); cursor: pointer; }
.gx-opt:hover:not(:disabled) { border-color: var(--ink); }
.gx-opt[aria-pressed="true"] { border-color: var(--ink); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--ink); }
.gx-opt.is-good { border-color: var(--gx-good); background: var(--gx-good-bg); color: var(--gx-good); }
.gx-opt.is-bad { border-color: var(--gx-bad); background: var(--gx-bad-bg); color: var(--gx-bad); }
.gx-opt:disabled { cursor: default; }
.gx-line { min-height: 50px; display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; border-radius: 10px; border: 1.5px dashed var(--border-strong); direction: ltr; }
.gx-line.is-good { border-color: var(--gx-good); }
.gx-line.is-bad { border-color: var(--gx-bad); }
.gx-line:empty::before { content: attr(data-empty); font-family: var(--font); direction: rtl; color: var(--faint); font-size: 14px; padding: 6px; margin-inline-start: auto; }
.gx-pool { display: flex; flex-wrap: wrap; gap: 6px; direction: ltr; }
.gx-chip { font: inherit; font-family: var(--font-en); font-size: 16px; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); cursor: pointer; text-align: left; }
.gx-chip--sent { flex: 1 1 100%; }
.gx-block { display: grid; gap: 8px; }
.gx-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 16px; align-items: center; padding-top: 14px; border-top: 1px solid var(--border); }
.gx-foot__end { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-inline-start: auto; }

/* ============================ اختبر نفسك ============================ */
.gx-card { display: grid; gap: 18px; padding: 28px 32px 30px; border-radius: var(--r-panel); background: var(--surface); border: 1px solid var(--border-strong); max-width: 860px; }
.gx-card h2 { font-size: 22px; line-height: 1.45; font-weight: var(--w-display); }
.gx-card h2:focus { outline: none; }
.gx-lead { font-size: 16px; line-height: 1.9; color: var(--ink-2); max-width: var(--gx-col); }
.gx-facts { display: grid; gap: 6px; padding-inline-start: 20px; font-size: 14.5px; line-height: 1.8; color: var(--ink-2); list-style: disc; }
.gx-kicker { font-size: 13px; font-weight: var(--w-semibold); color: var(--muted); }
.gx-history { display: grid; gap: 6px; }
.gx-history ul { display: grid; gap: 4px; list-style: none; padding: 0; margin: 0; }
.gx-history li { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding: 8px 12px; border-radius: 8px; background: var(--canvas); font-size: 14px; }
.gx-history li span { color: var(--muted); font-size: 13px; }
.gx-history li.is-old { background: transparent; border: 1px dashed var(--border-strong); }
.gx-test-head { display: grid; gap: 2px; }
.gx-qs { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; }
.gx-q { display: grid; gap: 10px; padding: 20px 0; }
.gx-qs > .gx-q + .gx-q { border-top: 1px solid var(--border); }
.gx-q__n { font-size: 12.5px; font-weight: var(--w-semibold); color: var(--muted); }
.gx-q__ask { font-size: 16px; font-weight: var(--w-semibold); line-height: 1.85; }
.gx-q__ask small { display: block; font-weight: 400; color: var(--muted); font-size: 13.5px; }
.gx-q__ask--after { font-weight: var(--w-medium); color: var(--ink-2); font-size: 15px; }
.gx-q__en { direction: ltr; text-align: left; font-family: var(--font-en); font-size: 18px; line-height: 2; color: var(--ink); overflow-wrap: anywhere; }
.gx-blank { display: inline-block; min-width: 4ch; border-bottom: 2px solid var(--ink); color: transparent; }
.gx-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.gx-choice { position: relative; display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 10px; border: 1.5px solid var(--border-strong); background: var(--surface); cursor: pointer; font-size: 16px; line-height: 1.5; }
.gx-choice:not(.is-ar) > span { font-family: var(--font-en); }
.gx-choice input { width: 18px; height: 18px; margin: 0; accent-color: var(--ink); flex: none; }
.gx-choice:hover { border-color: var(--ink); }
.gx-choice:has(input:checked) { border-color: var(--ink); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--ink); }
.gx-choice:has(input:focus-visible) { outline: 3px solid var(--ink); outline-offset: 2px; }
.gx-submit { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; justify-content: space-between; padding-top: 18px; border-top: 1px solid var(--border); }
.gx-left { font-size: 14px; color: var(--ink-2); line-height: 1.8; }

/* results */
.gx-score { display: flex; gap: 18px; align-items: center; padding: 18px 20px; border-radius: var(--r-card); background: var(--canvas); border: 1px solid var(--border-strong); }
.gx-score > b { font-size: 40px; font-weight: var(--w-display); line-height: 1; white-space: nowrap; }
.gx-score > b small { display: block; font-size: 13px; font-weight: var(--w-semibold); color: var(--muted); margin-top: 6px; }
.gx-score h2 { font-size: 19px; }
.gx-score p { font-size: 15px; line-height: 1.8; color: var(--ink-2); }
.gx-score.is-pass { background: var(--gx-good-bg); border-color: var(--gx-good); }
.gx-score.is-pass > b { color: var(--gx-good); }
.gx-score.is-review { background: var(--gx-bad-bg); border-color: var(--gx-bad); }
.gx-score.is-review > b { color: var(--gx-bad); }
.gx-score.is-pending { background: var(--gx-check-bg); border-color: var(--gx-check); }
.gx-save { font-size: 13.5px; color: var(--muted); }
.gx-save:empty { display: none; }
.gx-save b { color: var(--gx-bad); }
.gx-review-pts { display: grid; gap: 6px; }
.gx-review-pts ul { display: grid; gap: 4px; list-style: none; padding: 0; margin: 0; }
.gx-review-pts li { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; font-size: 14px; }
.gx-results { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.gx-r { display: grid; gap: 6px; padding: 14px 16px; border-radius: var(--r-card); background: var(--canvas); border-inline-start: 4px solid var(--gx-good); }
.gx-r.is-wrong { background: var(--gx-bad-bg); border-color: var(--gx-bad); }
.gx-r.is-check { background: var(--gx-check-bg); border-color: var(--gx-check); }
.gx-r__top { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: 13px; }
.gx-badge { font-size: 13px; font-weight: var(--w-display); padding: 2px 10px; border-radius: var(--r-pill); background: var(--surface); color: var(--gx-good); }
.gx-r.is-wrong .gx-badge { color: var(--gx-bad); }
.gx-r.is-check .gx-badge { color: var(--gx-check); }
.gx-r .gx-q__en { font-size: 16.5px; line-height: 1.7; }
.gx-r__line { font-size: 15px; line-height: 1.85; }

.gx-empty-state { justify-items: start; }
.gx-empty-state p { font-size: 15.5px; line-height: 1.85; color: var(--ink-2); }

/* ============================ the basics panel ============================ */
.gx-dialog { width: min(640px, calc(100vw - 24px)); max-height: min(86vh, 900px); padding: 0; border: 1px solid var(--border-strong); border-radius: var(--r-panel); background: var(--surface); color: var(--ink); }
.gx-dialog::backdrop { background: rgba(23, 25, 23, .35); }
.gx-dialog__head { position: sticky; top: 0; z-index: 1; display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 18px 20px 12px; background: var(--surface); border-bottom: 1px solid var(--border); }
.gx-dialog__head h2 { font-size: 20px; font-weight: var(--w-display); }
.gx-dialog__head p { font-size: 13.5px; color: var(--muted); }
.gx-dialog__x { font: inherit; font-size: 16px; width: 40px; height: 40px; flex: none; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); cursor: pointer; }
.gx-dialog__body { display: grid; gap: 8px; padding: 14px 20px 22px; }
.gx-basic { border: 1px solid var(--border); border-radius: var(--r-card); background: var(--canvas); }
.gx-basic > summary { cursor: pointer; padding: 12px 14px; font-size: 15px; font-weight: var(--w-semibold); list-style: none; display: flex; gap: 8px; }
.gx-basic > summary::-webkit-details-marker { display: none; }
.gx-basic > summary::before { content: "＋"; font-weight: 700; }
.gx-basic[open] > summary::before { content: "−"; }
.gx-basic__in { display: grid; gap: 10px; padding: 0 14px 14px; font-size: 15px; line-height: 1.85; }
.gx-basic__ex { display: grid; gap: 2px; padding: 8px 12px; border-radius: 8px; background: var(--surface); font-family: var(--font-en); font-size: 16px; text-align: left; }
.gx-basic__try { display: grid; gap: 4px; }
.gx-basic__sol { padding: 8px 12px; border-radius: 8px; background: var(--gx-good-bg); }

/* «تصحيح إجابتك» and «اشرح بطريقة أخرى» (the AI helper) */
.gx-ai__out:empty { display: none; }
.gx-ai__out .ai-box { margin-top: 0; }
.gx-retry { display: grid; gap: 10px; margin-top: 4px; }
.gx-retry .ai-intro[hidden] { display: none; }

/* keyboard focus: always visible on our own controls */
.gx-hub :focus-visible, .gx-view :focus-visible, .gx-switch :focus-visible, .gx-dialog :focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.gx-opt:focus-visible, .gx-chip:focus-visible, .gx-row:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.gx-view .btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.gx-view .btn, .gx-next .btn { white-space: normal; max-width: 100%; text-align: center; }

/* ============================ responsive ============================ */
/* the contents list sits beside the lesson only when the lesson itself has room (the sidebar takes its share) */
@container (max-width: 900px) {
  .gx-layout { grid-template-columns: minmax(0, 1fr); }
  .gx-toc { display: none; }
  .gx-toc-m { display: block; border-bottom: 1px solid var(--border); }
  .gx-toc-m > summary { cursor: pointer; padding: 14px 28px; font-size: 14.5px; font-weight: var(--w-semibold); list-style: none; display: flex; gap: 8px; align-items: center; }
  .gx-toc-m > summary::-webkit-details-marker { display: none; }
  .gx-toc-m > summary::before { content: "☰"; font-weight: 400; }
  .gx-toc-m .gx-toc__list { margin: 0 28px 14px; }
}
@container (max-width: 520px) {
  .gx-toc-m > summary { padding-inline: 16px; }
  .gx-toc-m .gx-toc__list { margin-inline: 16px; }
}
@media (max-width: 760px) {
  .gx-next { grid-template-columns: minmax(0, 1fr); padding: 20px; }
  .gx-next .btn { justify-self: start; }
  .gx-row { grid-template-columns: 36px minmax(0, 1fr); padding: 14px; gap: 4px 12px; }
  .gx-row__n { width: 36px; height: 36px; font-size: 14px; }
  .gx-row__go { display: none; }
  .gx-row__t .gx-en { display: block; margin: 0; text-align: right; }
}
@media (max-width: 560px) {
  .gx-head h1 { font-size: 24px; }
  .gx-switch { max-width: none; }
  .gx-switch button { font-size: 15px; padding: 9px 6px; }
  .gx-sec { padding: 22px 16px 24px; }
  .gx-resume { padding: 12px 16px; }
  .gx-sec h2 { font-size: 19.5px; gap: 10px; }
  .gx-sec__n { width: 28px; height: 28px; font-size: 14px; }
  .gx-text { font-size: 16px; }
  .gx-lead-in { font-size: 16.5px; }
  .gx-example { padding: 14px; }
  .gx-example__en { font-size: 18px; }
  .gx-eng, .gx-q__en { font-size: 16.5px; }
  .gx-card { padding: 20px 16px 22px; }
  .gx-score { flex-direction: column; align-items: flex-start; }
  .gx-cta .btn, .gx-submit .btn, .gx-foot .btn { flex: 1 1 auto; justify-content: center; }
  .gx-choice { flex: 1 1 auto; }
}

/* ==========================================================================
   A lesson (grammar-unit.html), in the reading lesson's look (reading-lesson.html):
   the header in a gold card, the lesson / test switch as pill tabs with a charcoal
   selected tab, the contents in a white card (charcoal for where you are).
   ========================================================================== */
.gxu-page .dash-head { padding: 24px 28px; border-radius: 30px; border: 1px solid var(--l-plan);
  background: linear-gradient(115deg, var(--t-plan) 0%, color-mix(in srgb, var(--t-plan) 45%, #fff) 65%, #fff 100%); }
.gxu-page .gx-switch { background: rgba(255, 255, 255, .85); border-radius: var(--r-pill); }
.gxu-page .gx-switch button { border-radius: var(--r-pill); border: 0; }
.gxu-page .gx-switch button[aria-selected="true"] { background: var(--ink); color: var(--on-accent); box-shadow: none; }
.gxu-page .gx-switch button[aria-selected="true"] small { color: rgba(245, 243, 238, .75); }
.gxu-page .gx-toc { padding: 16px; border-radius: 24px; background: var(--surface); border: 1px solid rgba(255, 255, 255, .9); }
.gxu-page .gx-toc__list { border-inline-start: 0; }
.gxu-page .gx-toc__list a { margin-inline-start: 0; border-inline-start: 0; border-radius: 12px; padding: 8px 12px; }
.gxu-page .gx-toc__list a[aria-current] { background: var(--ink); color: var(--on-accent); }
.gxu-page .gx-article { border-radius: 28px; border-color: rgba(255, 255, 255, .9); }
@media (max-width: 960px) {
  .gxu-page .dash-head { padding: 18px 20px; border-radius: 24px; }
  .gxu-page .gx-article { border-color: var(--border); }
}

/* ==========================================================================
   The lessons list (grammar-lessons.html): reading-lessons.html's look (rll-* in
   reading-lessons.css): the gold top card, then each topic as a white card with its
   lessons in one vertical list. Grammar adds a search row and two more states.
   ========================================================================== */
.gxl-tools { display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap; }
.gxl-tools .gx-search input { background: var(--surface); border-color: transparent; border-radius: var(--r-pill); }
.gxl-tools .gx-search input:focus { border-color: var(--ink); }
.gxl-page .gx-count:empty { display: none; }
.rll-chip.gxl-chip--review { background: var(--t-exam); color: var(--c-exam); }
.rll-chip.gxl-chip--progress { background: var(--highlight-soft); color: var(--ink); }
/* the hub's recent lessons */
.gx-recent { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
