/* ==========================================================================
   فهيم — Listening (listening.html, listening-practice.html + listening-test.html)
   Arabic interface around English test content: everything inside .ls-en is
   left-to-right English, laid out like the printed question paper.
   ========================================================================== */
@media (min-width: 1321px) { .hub-page .app { grid-template-columns: var(--side-w) minmax(0, 1fr); } }
.hub-page .main { max-width: 900px; gap: var(--s-24); align-content: start; }
.hub-page .main > * { min-width: 0; }
.ls-page .icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ls-page .sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.ls-crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 2px; }
.ls-crumbs a { color: var(--ink-2); text-decoration: none; }
.ls-crumbs a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* English test content */
.ls-en { direction: ltr; text-align: left; unicode-bidi: isolate; font-family: "Helvetica Neue", Arial, var(--font); line-height: 1.6; overflow-wrap: anywhere; }

/* ---------- hub: one card per test ---------- */
.ls-tests { display: grid; gap: var(--s-16); }
.ls-test { display: grid; gap: 10px; padding: 20px; color: var(--ink); text-decoration: none; }
.ls-test__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ls-test__title { font-size: 18px; font-weight: var(--w-display); }
.ls-test__topics { display: flex; flex-wrap: wrap; gap: 6px; }
.ls-test__topics li { font-size: 12.5px; padding: 3px 10px; border-radius: var(--r-pill); background: var(--canvas); border: 1px solid var(--border); }
.ls-test__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.ls-test__modes { font-size: 12.5px; line-height: 1.8; color: var(--muted); }
.ls-test__modes b { color: var(--ink-2); font-weight: var(--w-semibold); }
.ls-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.ls-facts li { display: grid; gap: 2px; padding: 12px; border-radius: var(--r-card); background: var(--canvas); border: 1px solid var(--border); font-size: 13px; color: var(--ink-2); }
.ls-facts b { font-size: 20px; font-weight: var(--w-display); color: var(--ink); }
@media (max-width: 720px) { .ls-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- test page: intro + mode choice ---------- */
.ls-intro { display: grid; gap: 14px; padding: 20px; }
.ls-intro p { font-size: 14.5px; line-height: 1.8; color: var(--ink-2); }
.ls-pdf { display: inline-flex; align-items: center; gap: 8px; width: fit-content; font-size: 14px; font-weight: var(--w-semibold); color: var(--ink); text-decoration: underline; text-decoration-color: var(--highlight); text-decoration-thickness: 3px; text-underline-offset: 4px; }
.ls-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ls-mode { display: grid; gap: 6px; padding: 16px; text-align: start; border: 1px solid var(--border-strong); border-radius: var(--r-card); background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; transition: border-color var(--dur-fast), background-color var(--dur-fast); }
.ls-mode:hover { border-color: var(--ink); }
.ls-mode:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.ls-mode b { font-size: 16px; font-weight: var(--w-display); }
.ls-mode span { font-size: 13px; color: var(--muted); line-height: 1.7; }
.ls-mode--exam { background: var(--lilac); }
@media (max-width: 600px) { .ls-modes { grid-template-columns: 1fr; } }
.ls-modebar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13.5px; color: var(--ink-2); }
.ls-modebar #ls-change { margin-inline-start: auto; }

/* ---------- a part ---------- */
.ls-part { padding: 0; overflow: hidden; }
.ls-part__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 20px; border-bottom: 1px solid var(--border-strong); }
.ls-part--1 .ls-part__head { background: var(--tint-violet); }
.ls-part--2 .ls-part__head { background: var(--tint-cyan); }
.ls-part--3 .ls-part__head { background: var(--tint-magenta); }
.ls-part--4 .ls-part__head { background: var(--tint-peach); }
.ls-part__title { font-size: 18px; font-weight: var(--w-display); }
.ls-part__range { font-size: 13px; font-weight: var(--w-semibold); }
.ls-part__body { display: grid; gap: 22px; padding: 20px; }
.ls-part__score { font-size: 13px; font-weight: var(--w-semibold); padding: 3px 10px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--border-strong); }

/* audio */
.ls-audio { display: grid; gap: 10px; padding: 14px 16px; border-radius: var(--r-card); background: var(--canvas); border: 1px solid var(--border); }
.ls-audio audio { width: 100%; direction: ltr; }
.ls-audio__note { font-size: 12.5px; color: var(--muted); line-height: 1.7; }
.ls-audio--soon { display: flex; gap: 10px; align-items: center; background: var(--lilac); border-style: dashed; border-color: var(--border-strong); font-size: 14px; color: var(--ink-2); }
.ls-player { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ls-player .btn[disabled] { opacity: .55; cursor: not-allowed; }
.ls-track { flex: 1 1 160px; height: 8px; border-radius: var(--r-pill); background: var(--border); overflow: hidden; direction: ltr; }
.ls-track i { display: block; height: 100%; width: 0; background: var(--ink); transition: width .25s linear; }
.ls-time { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-2); direction: ltr; unicode-bidi: isolate; min-width: 92px; text-align: end; }

/* a task (one block of questions) */
.ls-task { display: grid; gap: 12px; }
.ls-task__q { font-weight: 700; font-size: 15px; }
.ls-task__inst { font-style: italic; font-size: 14.5px; }
.ls-box { border: 1px solid var(--border-strong); border-radius: 4px; padding: 16px 18px; background: var(--surface); }
.ls-box__title { font-weight: 700; text-align: center; margin-bottom: 10px; font-size: 15.5px; }
.ls-notes h4 { font-weight: 700; font-size: 14.5px; margin: 12px 0 4px; }
.ls-notes h4:first-of-type { margin-top: 0; }
.ls-notes ul { list-style: disc; padding-left: 20px; display: grid; gap: 6px; }
.ls-notes li { font-size: 15px; line-height: 2.1; }
.ls-example { font-size: 15px; margin-bottom: 4px; }
.ls-example u { text-underline-offset: 3px; padding: 0 6px; }
.ls-no { font-weight: 700; margin-right: 4px; flex: none; white-space: nowrap; }
.ls-gap {
  display: inline-block; width: 9em; max-width: 100%; height: 32px; padding: 0 8px; vertical-align: baseline;
  border: 0; border-bottom: 2px solid var(--ink); border-radius: 4px 4px 0 0; background: var(--canvas);
  font: inherit; font-size: 15px; color: var(--ink); direction: ltr;
}
.ls-gap:focus { outline: none; background: var(--highlight); }

.ls-mcq { display: grid; gap: 16px; }
.ls-q { border: 0; padding: 0; margin: 0; min-width: 0; }
.ls-q legend { display: flex; gap: 10px; font-size: 15px; padding: 0; margin-bottom: 6px; }
.ls-opts { display: grid; gap: 6px; padding-left: 28px; }
.ls-opt { display: flex; align-items: flex-start; gap: 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r-input); background: var(--surface); font-size: 14.5px; cursor: pointer; transition: border-color var(--dur-fast), background-color var(--dur-fast); }
.ls-opt:hover { border-color: var(--ink); }
.ls-opt input { margin: 4px 0 0; accent-color: var(--ink); flex: none; width: 16px; height: 16px; }
.ls-opt:has(input:checked) { background: var(--tint-cyan); border-color: var(--ink); }
.ls-opt b { flex: none; }

.ls-map { display: block; width: 100%; max-width: 640px; height: auto; margin: 0 auto; border: 1px solid var(--border); border-radius: 4px; background: #fff; }
.ls-box--letters { max-width: 420px; margin-inline: auto; }
.ls-box--letters dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 14.5px; }
.ls-box--letters dt { font-weight: 700; }
.ls-list__title { font-weight: 700; font-size: 15px; }
.ls-rows { display: grid; gap: 8px; }
.ls-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: 15px; }
.ls-select { height: 38px; min-width: 76px; padding: 0 8px; border: 1px solid var(--border-strong); border-radius: var(--r-input); background: var(--surface); font: inherit; font-size: 15px; color: var(--ink); }
.ls-select:focus, .ls-opt input:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* after marking */
.ls-fb { display: block; font-family: var(--font); direction: rtl; text-align: right; font-size: 12.5px; line-height: 1.7; margin-top: 2px; }
.ls-fb--ok { color: #2f6b12; }
.ls-fb--no { color: var(--terracotta); }
.ls-fb bdi { font-family: var(--font-mono); font-weight: 600; color: var(--ink); }
.is-right .ls-gap, .is-right .ls-select { background: var(--tint-violet); border-color: var(--ink); }
.is-wrong .ls-gap, .is-wrong .ls-select { background: #fbe1d3; border-color: var(--terracotta); }
.ls-notes li > .ls-fb { line-height: 1.7; margin-bottom: 4px; }
.ls-q.is-right legend .ls-no, .ls-row.is-right .ls-no, .ls-notes .is-right .ls-no { color: #2f6b12; }
.ls-q.is-wrong legend .ls-no, .ls-row.is-wrong .ls-no, .ls-notes .is-wrong .ls-no { color: var(--terracotta); }
.ls-row .ls-fb { grid-column: 2 / -1; }
.ls-checked input, .ls-checked select { cursor: default; }

/* transcript (only after marking) */
.ls-script { border-top: 1.5px dashed var(--border-strong); padding-top: 16px; }
.ls-script summary { cursor: pointer; font-weight: var(--w-semibold); font-size: 15px; }
.ls-script__body { display: grid; gap: 10px; margin-top: 12px; padding: 14px 16px; border-radius: var(--r-card); background: var(--canvas); max-height: 460px; overflow-y: auto; }
.ls-script__body p { font-size: 14.5px; line-height: 1.75; }
.ls-script__body b { font-size: 12px; letter-spacing: .04em; margin-right: 6px; }
.ls-script__none { font-size: 14px; color: var(--muted); margin-top: 10px; }

/* end of the test: check + result */
.ls-end { display: grid; gap: 14px; padding: 20px; }
.ls-end__count { font-size: 14px; color: var(--ink-2); }
.ls-end__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.ls-result { display: grid; gap: 14px; padding: 20px; border-radius: var(--r-panel); background: var(--highlight-soft); border: 1px solid var(--border-strong); }
.ls-result:focus { outline: none; }
.ls-result__stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ls-result__stats div { display: grid; gap: 2px; }
.ls-result__stats div > span { font-size: 12.5px; color: var(--ink-2); }
.ls-result__stats b { font-size: 30px; line-height: 1.2; font-weight: var(--w-display); }
.ls-result__parts { display: flex; flex-wrap: wrap; gap: 8px; }
.ls-result__parts li { font-size: 13px; padding: 4px 10px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--border-strong); }
.ls-result__note { font-size: 12.5px; color: var(--ink-2); line-height: 1.7; }

@media (max-width: 720px) {
  .ls-part__body, .ls-intro, .ls-end { padding: 16px; }
  .ls-box { padding: 14px 12px; }
  .ls-opts { padding-left: 0; }
  .ls-notes ul { padding-left: 16px; }
  .ls-gap { width: 8em; }
}

/* ---------- exam mode: like the real test ---------- */
.ls-confirm { width: min(520px, calc(100% - 32px)); }
.ls-rules { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.ls-rules li { position: relative; padding-inline-start: 22px; font-size: 14.5px; line-height: 1.75; color: var(--ink-2); }
.ls-rules li::before { content: ""; position: absolute; inset-inline-start: 2px; top: .7em; width: 8px; height: 8px; border-radius: 50%; background: var(--highlight); border: 1px solid var(--border-strong); }

/* while the recordings play: no menus, the test fills the page */
.ls-exam-on .side, .ls-exam-on .mbar, .ls-exam-on .bnav, .ls-exam-on .ls-crumbs, .ls-exam-on .dash-tools { display: none !important; }
.ls-exam-on .app { grid-template-columns: minmax(0, 1fr) !important; }
.ls-exam-on .main { max-width: 900px; width: 100%; margin-inline: auto; }
body.ls-exam-on { padding-bottom: 0; }

.ls-exambar { position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px;
  margin-bottom: var(--s-16); padding: 12px 16px; border: 1px solid var(--border-strong); border-radius: var(--r-card); background: var(--surface); box-shadow: var(--shadow-float); }
.ls-steps { display: flex; gap: 6px; margin: 0; padding: 0; list-style: none; }
.ls-steps li { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--canvas); color: var(--muted); font-weight: var(--w-semibold); font-size: 14px; }
.ls-steps li small { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.ls-steps li.is-done { background: var(--tint-violet); border-color: var(--ink); color: var(--ink); }
.ls-steps li.is-now { background: var(--ink); border-color: var(--ink); color: var(--on-accent); }
.ls-exambar__main { display: grid; gap: 6px; min-width: 0; }
.ls-exambar__title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font-size: 14px; }
.ls-exambar__title b { font-weight: var(--w-display); font-size: 15.5px; }
.ls-exambar__title span { font-size: 12.5px; color: var(--muted); }
.ls-live { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.ls-live.is-on { color: var(--ink); font-weight: var(--w-semibold); }
.ls-live.is-on::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-inline-end: 6px; border-radius: 50%; background: var(--terracotta); animation: ls-blink 1.4s ease-in-out infinite; }
@keyframes ls-blink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .ls-live.is-on::before { animation: none; } }
.ls-exambar__resume { display: grid; gap: 8px; padding: 10px 12px; border-radius: var(--r-input); background: var(--highlight-soft); border: 1px solid var(--border-strong); }
.ls-exambar__resume p { font-size: 13.5px; line-height: 1.7; }
.ls-exambar__resume .btn { width: fit-content; }
.ls-end__note { font-size: 14.5px; line-height: 1.8; color: var(--ink-2); }
@media (max-width: 720px) {
  .ls-exambar { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 10px 12px; border-radius: 0 0 var(--r-card) var(--r-card); margin-inline: calc(-1 * var(--s-16)); }
  .ls-steps { grid-column: 1; }
  .ls-exambar__quit { grid-column: 2; grid-row: 1; }
  .ls-exambar__main { grid-column: 1 / -1; }
  .ls-steps li { width: 28px; height: 28px; font-size: 13px; }
}

/* Choose TWO letters: the pair's numbers turn green/red one by one after marking */
.ls-multi .ls-no { display: inline-flex; gap: 1px; }
.ls-mq.is-right { color: #2f6b12; }
.ls-mq.is-wrong { color: var(--terracotta); }
.ls-multi legend > span > b { font-weight: 700; }

/* table completion */
.ls-table { width: 100%; border-collapse: collapse; font-size: 14.5px; background: var(--surface); }
.ls-table th, .ls-table td { border: 1px solid var(--border-strong); padding: 8px 10px; text-align: left; vertical-align: top; line-height: 2; }
.ls-table th { background: var(--lilac); font-weight: 700; }
.ls-table td > .ls-fb { display: block; }
@media (max-width: 600px) {
  .ls-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .ls-table, .ls-table tbody, .ls-table tr, .ls-table td { display: block; width: 100%; }
  .ls-table tr { margin-bottom: 10px; border: 1px solid var(--border-strong); border-radius: 4px; overflow: hidden; }
  .ls-table td { border: 0; border-bottom: 1px dashed var(--border); }
  .ls-table td:last-child { border-bottom: 0; }
  .ls-table td::before { content: attr(data-col); display: block; font-size: 11.5px; font-weight: 700; color: var(--muted); line-height: 1.4; }
}

/* flow chart */
.ls-flow { display: grid; justify-items: center; gap: 26px; margin: 0; padding: 0; list-style: none; }
.ls-flow li { position: relative; width: min(100%, 460px); padding: 10px 14px; border: 1px solid var(--ink); border-radius: 4px; background: var(--surface); text-align: center; font-size: 15px; line-height: 2.1; }
.ls-flow li + li::before { content: ""; position: absolute; left: 50%; top: -24px; height: 18px; border-left: 1.5px solid var(--ink); }
.ls-flow li + li::after { content: ""; position: absolute; left: calc(50% - 5px); top: -8px; border: 5px solid transparent; border-top: 6px solid var(--ink); border-bottom: 0; }
.ls-flow .ls-fb { display: block; text-align: center; }

/* sentence completion */
.ls-sentences { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.ls-sentences li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 4px 8px; font-size: 15px; line-height: 2.1; }
.ls-sentences li > .ls-fb { grid-column: 2; }
.ls-modes--one { grid-template-columns: minmax(0, 1fr); max-width: 520px; }

/* Listening page: practice tests, then the exams */
.ls-group { display: grid; gap: var(--s-12); }
.ls-group + .ls-group { margin-top: var(--s-24); }
.ls-group__head h3 { font-size: 17px; font-weight: var(--w-display); }
.ls-group__head p { font-size: 13.5px; line-height: 1.8; color: var(--muted); margin-top: 2px; }
.ls-test--exam { border-color: var(--border-strong); background: linear-gradient(var(--surface), var(--surface)) padding-box; box-shadow: none; }
.ls-test__result { font-size: 13.5px; color: var(--ink-2); }

/* the Tests tab holds the intro and the list (the analysis is the other tab) */
.ls-panel { display: grid; gap: var(--s-24); min-width: 0; }
.ls-result__counts { font-size: 13.5px; line-height: 1.8; padding: 10px 14px; border-radius: 10px; background: var(--canvas); border: 1px dashed var(--border-strong); color: var(--ink-2); }
.ls-result__counts.is-counted { background: color-mix(in srgb, var(--highlight) 45%, var(--surface)); border: 1px solid var(--border-strong); color: var(--ink); }
.ls-result__counts a { margin-inline-start: 6px; font-weight: var(--w-semibold); }

/* ==========================================================================
   The hub (listening.html), laid out like reading.html: chips, «خطوتك التالية»
   and the two doors come from reading-lessons.css (rh-*). The tests sit in white
   group cards as rounded rows, like the reading library; the level exam in its red tint.
   ========================================================================== */
.ls-page .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; }
.ls-top { display: grid; gap: 20px; }
.ls-top:empty { display: none; }
.ls-group { padding: 22px 24px 24px; border-radius: 28px; background: var(--surface); border: 1px solid rgba(255, 255, 255, .9); scroll-margin-top: 16px; }
.ls-group + .ls-group { margin-top: 20px; }
.ls-group__head h3 { font-size: 21px; font-weight: var(--w-medium); }
.ls-group__head p { max-width: 75ch; }
.ls-group__head p b { color: var(--ink-2); font-weight: var(--w-semibold); }
.ls-group .ls-test { border: 1px solid var(--border); border-radius: 20px; box-shadow: none; transition: border-color var(--dur-fast), background-color var(--dur-fast); }
.ls-group .ls-test:hover { border-color: var(--l-vocab); background: color-mix(in srgb, var(--t-vocab) 30%, #fff); }
.ls-group .ls-test--exam { border-color: var(--l-exam); background: color-mix(in srgb, var(--t-exam) 45%, #fff); }
.ls-group .ls-test--exam:hover { border-color: var(--c-exam); background: color-mix(in srgb, var(--t-exam) 60%, #fff); }
@media (max-width: 960px) { .ls-group { padding: 18px; border-radius: 22px; border-color: var(--border); } }

/* a test (listening-test.html): the header in the practice door's teal card, like the reading library's header */
.lst-page .dash-head { padding: 24px 28px; border-radius: 30px; border: 1px solid var(--l-vocab);
  background: linear-gradient(115deg, var(--t-vocab) 0%, color-mix(in srgb, var(--t-vocab) 45%, #fff) 65%, #fff 100%); }
.lst-page .ls-intro, .lst-page .ls-end { border-radius: 28px; }
@media (max-width: 960px) { .lst-page .dash-head { padding: 18px 20px; border-radius: 24px; } }

/* ==========================================================================
   The practice door (listening-practice.html), like reading-practice.html: a teal
   header card, the next test in a teal card, then the tests and the level exam.
   ========================================================================== */
.lp-page .dash-head { padding: 24px 28px; border-radius: 30px; border: 1px solid var(--l-vocab);
  background: linear-gradient(115deg, var(--t-vocab) 0%, color-mix(in srgb, var(--t-vocab) 45%, #fff) 65%, #fff 100%); }
.lp-next { display: flex; align-items: center; flex-wrap: wrap; gap: 14px 24px; padding: 22px 26px; border-radius: 28px;
  background: var(--t-vocab); border: 1px solid var(--l-vocab); }
.lp-next[hidden] { display: none; }
.lp-next__text { flex: 1 1 300px; min-width: 0; display: grid; gap: 4px; }
.lp-next__k { font-size: 13px; font-weight: var(--w-semibold); color: var(--ink-2); }
.lp-next__title { font-size: 22px; font-weight: var(--w-medium); line-height: 1.4; }
.lp-next__why { font-size: 14px; line-height: 1.8; color: var(--ink-2); max-width: 62ch; }
.lp-next .btn { border-radius: var(--r-pill); }
@media (max-width: 960px) {
  .lp-page .dash-head { padding: 18px 20px; border-radius: 24px; }
  .lp-next { padding: 18px 20px; border-radius: 22px; }
  .lp-next .btn { width: 100%; justify-content: center; }
}
