/* Listen first (listen_first/show): three steps, Listen · Answer · Read.
   Numbered rows with soft length bars stand in for the hidden sentences;
   right and wrong carry ✓ / ✗ in words. */
.lf { max-width: 920px; margin: 0 auto; gap: 14px; }
.lf__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lf__end { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-pill);
           color: var(--ink); font-size: 14px; font-weight: 600; text-decoration: none; }
.lf__end:hover { border-color: var(--ink); color: var(--ink); text-decoration: none; }
.lf__steps { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 6px; }
.lf__step { display: flex; align-items: center; gap: 6px; padding: 4px 11px 4px 5px; border-radius: var(--radius-pill); color: var(--text-body); font-size: 13px; font-weight: 700; }
.lf__step[aria-current="step"] { background: var(--ink); color: var(--paper); }
.lf__step-dot { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--line); color: var(--ink); font-size: 11px; }
.lf__step[aria-current="step"] .lf__step-dot { background: var(--peach); }
.lf__step.is-done .lf__step-dot { background: var(--green-soft); }
.lf__level { min-width: 90px; text-align: right; font-size: 14px; font-weight: 700; }
.lf__progress { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.lf__progress-bar { display: block; height: 100%; width: 8%; background: var(--ink); transition: width .2s; }

.lf__main { width: 100%; max-width: 820px; align-self: center; display: flex; flex-direction: column; gap: 14px; }
.lf__head { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.lf__kicker { font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); font-weight: 700; }
.lf__title { margin: 0; font-family: var(--font-serif); font-weight: 400; font-size: 36px; line-height: 1.1; }
.lf__meta { font-size: 14px; color: var(--text-body); }
.lf__tag { padding: 1px 7px; border-radius: 6px; background: var(--sand); color: var(--ink); font-weight: 700; }

/* The hidden text */
.lf__hidden { display: flex; flex-direction: column; gap: 8px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 20px; background: var(--card); }
.lf__hidden[hidden] { display: none; }
.lf__hidden-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.lf__hidden-note { font-size: 13px; color: var(--ink-line); font-weight: 600; }
.lf__translate { min-height: 44px; padding: 0 16px; border: 1.5px solid var(--ink); border-radius: var(--radius-pill); background: none; color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.lf__translate:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; }
.lf__used { padding: 4px 12px; border-radius: var(--radius-pill); background: var(--sand); font-size: 12px; font-weight: 700; }
.lf__used[hidden], .lf__translate[hidden] { display: none; }
.lf__rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.lf__row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 12px; border: 1.5px solid var(--line-soft); border-radius: 12px; }
.lf__row.is-current { background: var(--mark); border-color: var(--peach); }
.lf__n { width: 28px; height: 28px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--sand); font-size: 12px; font-weight: 700; }
.lf__row.is-current .lf__n { background: var(--ink); color: var(--paper); }
.lf__row.is-heard .lf__n { background: var(--green-soft); }
.lf__en { flex: 1; min-width: 0; font-family: var(--font-serif); font-style: italic; font-size: 19px; line-height: 1.3; }
.lf__len { flex: 1; display: flex; justify-content: flex-end; }
.lf__len[hidden], .lf__en[hidden] { display: none; }
.lf__len > span { display: block; height: 10px; border-radius: 6px; background: var(--line); }
.lf__row.is-current .lf__len > span { background: var(--peach); }
.lf__row.is-heard .lf__len > span { background: var(--line-strong); }
.lf__row-tag { min-width: 84px; text-align: right; white-space: nowrap; font-size: 12px; font-weight: 700; color: var(--green); }
.lf__row.is-current .lf__row-tag { color: var(--ink); }

/* The quiz */
.lf__quiz { display: flex; flex-direction: column; gap: 12px; }
.lf__quiz[hidden] { display: none; }
.lf__quiz-title { margin: 0; font-family: var(--font-serif); font-weight: 400; font-size: 30px; }
.lf__score { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px; border-radius: 16px; background: var(--ink); color: var(--paper); }
.lf__score[hidden] { display: none; }
.lf__score-big { font-family: var(--font-serif); font-size: 34px; line-height: 1; }
.lf__score-note { font-size: 13px; color: var(--text-on-dark-muted); }
.lf__question { margin: 0; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.lf__legend { float: left; width: 100%; padding: 0; display: flex; justify-content: space-between; gap: 10px; font-size: 16px; font-weight: 700; }
.lf__mark { font-size: 13px; white-space: nowrap; }
.lf__mark.is-right { color: var(--green); }
.lf__mark.is-wrong { color: var(--clay); }
.lf__options { clear: both; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.lf__option { min-height: 52px; padding: 6px 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; text-align: center;
              border: 1.5px solid var(--line-strong); border-radius: 12px; background: var(--field); color: var(--ink); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.lf__option:hover:not(:disabled) { border-color: var(--ink); }
.lf__option:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; }
.lf__option:disabled { cursor: default; }
.lf__option-tag { font-size: 12px; font-weight: 700; }
.lf__option-tag:empty { display: none; }
.lf__option.is-chosen { border: 2px solid var(--ink); }
.lf__option.is-right { background: var(--green-soft); border: 2px solid var(--green); }
.lf__option.is-right .lf__option-tag { color: var(--green); }
.lf__option.is-wrong { background: var(--clay-soft); border: 2px solid var(--clay); }
.lf__option.is-wrong .lf__option-tag { color: var(--clay); }
.lf__option.is-dim { background: transparent; border-color: var(--line); }

/* The text, shown at the end */
.lf__reveal { display: flex; flex-direction: column; gap: 4px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 20px; background: var(--card); }
.lf__reveal-label { font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); font-weight: 700; }
.lf__line { display: flex; flex-direction: column; padding: 2px 10px; border-radius: 12px; }
.lf__line.is-current { background: var(--mark); }
.lf__ar { margin: 0; font-family: var(--font-arabic); font-size: 30px; line-height: 2; }
.lf__line-en { padding-bottom: 6px; font-family: var(--font-serif); font-style: italic; font-size: 19px; line-height: 1.3; color: var(--text-body); }

/* The player */
.lf__player { display: flex; align-items: center; gap: 18px; padding: 10px 12px 10px 20px; border-radius: 20px; background: var(--ink); color: var(--paper); }
.lf__state { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; justify-content: center; }
.lf__status { font-size: 14px; font-weight: 700; }
.lf__ticks { display: grid; grid-template-columns: repeat(var(--count, 5), 1fr); gap: 3px; max-width: 220px; }
.lf__tick { height: 4px; border-radius: 4px; background: var(--ink-line-strong); }
.lf__tick.is-done { background: var(--peach); }
.lf__tick.is-current { background: var(--paper); }
.lf__sub { font-size: 12px; color: var(--text-on-dark-muted); }
.lf__sub.is-warn { color: var(--peach); }
.lf__controls { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.lf__transport { display: flex; align-items: center; gap: 8px; }
.lf__transport[hidden], .lf__replay[hidden] { display: none; }
.lf__replay { height: 44px; padding: 0 14px; display: flex; align-items: center; gap: 6px; border: 1px solid var(--ink-line-strong); border-radius: var(--radius-pill); background: none;
              color: var(--paper); font: inherit; font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.lf__replay[aria-disabled="true"] { border-style: dashed; color: var(--text-on-dark-muted); cursor: not-allowed; }
.lf__play { position: relative; width: 56px; height: 56px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border: 0; border-radius: 50%;
            background: var(--peach); color: var(--ink); font-size: 20px; cursor: pointer; }
.lf__play.is-loading .listen__spinner { display: block; }
.lf__play.is-loading .lf__play-icon { display: none; }
.lf__next { width: 44px; height: 44px; border: 0; border-radius: 50%; background: none; color: var(--paper); font-size: 18px; cursor: pointer; }
.lf__speed-wrap { position: relative; }
.lf__speed { height: 44px; min-width: 52px; padding: 0 12px; border: 1px solid var(--ink-line-strong); border-radius: var(--radius-pill); background: none; color: var(--paper);
             font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.lf__menu { position: absolute; right: 0; bottom: 52px; z-index: 5; }
.lf__player button:focus-visible { outline: 3px solid var(--peach); outline-offset: 3px; }

.lf__ctas { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.lf__cta { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 26px; border: 0; border-radius: var(--radius-pill);
           background: var(--clay); color: var(--text-on-accent); font: inherit; font-size: 16px; font-weight: 600; white-space: nowrap; text-decoration: none; cursor: pointer; }
.lf__cta:hover { color: var(--text-on-accent); text-decoration: none; }
.lf__cta[hidden] { display: none; }
.lf__cta[aria-disabled="true"] { background: var(--line); color: var(--text-body); cursor: default; }
.lf__cta--ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }
.lf__cta--ghost:hover { color: var(--ink); background: var(--sand-hover); }
.lf__cta:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; }
.lf__hint { margin: 0; text-align: center; font-size: 13px; color: var(--text-body); }
.lf__hint[hidden], .lf__back[hidden] { display: none; }
.lf__back { align-self: center; font-size: 14px; color: var(--ink); text-decoration: underline; }

@media (max-width: 640px) {
  .lf__end-text, .lf__level { display: none; }
  .lf__step:not([aria-current="step"]) .lf__step-label { display: none; }
  .lf__step:not([aria-current="step"]) { padding-right: 5px; }
  .lf__title { font-size: 26px; }
  .lf__hidden, .lf__reveal { padding: 14px 12px; }
  .lf__row { min-height: 46px; }
  .lf__en, .lf__line-en { font-size: 17px; }
  .lf__row-tag { min-width: 62px; }
  .lf__quiz-title { font-size: 24px; }
  .lf__options { grid-template-columns: 1fr; }
  .lf__ar { font-size: 25px; }
  .lf__player { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 12px; }
  .lf__controls { justify-content: space-between; }
  .lf__cta { flex: 1 1 100%; }
}
