/* alevel-lesson.css — see docs/ALEVEL.md §3.2–§3.4, §5.2. Brand tokens from app.css only; everything works at 360 px.
   Prefixes: .alq-* quick question card (alevel/quick.js) · .alx-* exam-style question and self-marking
   (alevel/examq.js) · .alsn-* additions to the lesson page (#/alevel/cs/learn/:slug, which otherwise uses the SAT
   lesson's .lsn-* layout from learn.css) · .alc-* flashcards (#/alevel/cs/cards, whose overview reuses the .rev-*
   cards of study.css). */

/* Colours: app.css tokens (docs/ARCHITECTURE.md §12), plus these few of this file's own; their dark values and the
   one rule that keeps a literal colour (.alc-knew, AA-checked by tests/alevel-ui-shell.test.mjs) are at the end. */
:root {
  --alq-note-bg: rgba(255, 255, 255, .7); /* a note chip on the tinted result box */
  --alq-rule: rgba(0, 0, 0, .08);         /* dividers inside the result box */
  --alq-blank: #fffaf7;                   /* table cells to fill in */
  --alx-ms-bg: #f7f9ff;                   /* the mark scheme panel */
  --alx-ms-rule: #dbe4fb;                 /* dividers inside it */
}

/* `hidden` must win over component display rules (the components are also used outside .lsn pages). */
.alq [hidden], .alx [hidden], .alsn [hidden], .alc [hidden] { display: none !important; }

/* =========================================================================
   Quick question card (mirrors the SAT lesson's worked example, .lsn-ex)
   ========================================================================= */
.alq { margin: 0 0 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; font-size: 16px; line-height: 1.55; }
.alq:last-child { margin-bottom: 0; }
.alq:focus { outline: none; }
.alq:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.alq-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--bg); border-bottom: 1px solid var(--line); }
.alq-num { flex: none; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 4px; background: var(--ink); color: var(--on-ink); font-size: 14px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.alq-head-text { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; }
.alq-title { margin: 0; font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.alq-type { font-size: 12.5px; color: var(--muted); }
.alq-body { padding: 16px; }
.alq-prompt { margin-bottom: 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.alq .rich p { margin: 0 0 .8em; }
.alq .rich p:last-child { margin-bottom: 0; }

/* mcq + multi: buttons with a letter; "select all" letters are square, like check boxes */
.alq-choices { display: flex; flex-direction: column; gap: 10px; }
.alq-choice {
  width: 100%; min-height: 52px; display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px;
  border: 1px solid var(--choice-line); border-radius: 10px; background: var(--card); color: var(--ink); cursor: pointer; text-align: left;
  font: inherit; font-size: 16px; line-height: 1.45; transition: box-shadow .12s, background .12s;
}
.alq-choice:hover:not(:disabled) { background: var(--bg); box-shadow: 0 0 0 1px var(--choice-line); }
.alq-choice:disabled { cursor: default; }
.alq-letter { flex: none; width: 28px; height: 28px; margin-top: 1px; border-radius: 50%; border: 1.5px solid var(--choice-line); display: inline-flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; }
.alq-choice.is-multi .alq-letter { border-radius: 6px; }
.alq-choice-text { display: block; flex: 1; min-width: 0; padding-top: 2px; }
.alq-choice-mark { flex: none; width: 20px; margin-top: 4px; display: inline-flex; }
.alq-choice.is-selected { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand); }
.alq-choice.is-selected .alq-letter { background: var(--brand); border-color: var(--brand); color: #fff; }
.alq-choice.is-correct { border-color: var(--ok); background: var(--ok-soft); box-shadow: 0 0 0 2px var(--ok); }
.alq-choice.is-correct .alq-letter { background: var(--ok); border-color: var(--ok); color: var(--on-status); }
.alq-choice.is-correct .alq-choice-mark, .alq-choice.is-missed .alq-choice-mark { color: var(--ok); }
.alq-choice.is-wrong { border-color: var(--bad); background: var(--bad-soft); box-shadow: 0 0 0 2px var(--bad); }
.alq-choice.is-wrong .alq-letter { background: var(--bad); border-color: var(--bad); color: var(--on-status); }
.alq-choice.is-wrong .alq-choice-mark { color: var(--bad); }
.alq-choice.is-missed { border: 2px dashed var(--ok); background: var(--card); box-shadow: none; }
.alq-choice.is-missed .alq-letter { border-color: var(--ok); color: var(--ok-text); }

/* short answer */
.alq-short { display: flex; flex-direction: column; gap: 6px; }
.alq-input-row { display: flex; align-items: center; gap: 10px; max-width: 100%; }
.alq-input { flex: 0 1 280px; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 18px; font-weight: 700; letter-spacing: .02em; border: 1.5px solid var(--choice-line); }
.alq-input::placeholder { font-weight: 400; color: var(--muted); }
.alq-suffix { flex: none; font-weight: 600; color: var(--muted); }
.alq-input.is-correct, .alq-cell-input.is-correct { border-color: var(--ok); background: var(--ok-soft); }
.alq-input.is-wrong, .alq-cell-input.is-wrong { border-color: var(--bad); background: var(--bad-soft); }

/* table: a real table, inputs only in the blank cells; it scrolls on its own on phones */
.alq-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.alq-table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.4; }
.alq-table th, .alq-table td { padding: 6px 10px; border: 0; border-bottom: 1px solid var(--line); text-align: center; vertical-align: middle; }
.alq-table th + th, .alq-table td + td, .alq-table th + td, .alq-table td + th { border-left: 1px solid var(--line); }
.alq-table thead th { background: var(--bg); font-size: 13.5px; font-weight: 700; white-space: nowrap; }
.alq-table tbody th { font-weight: 600; }
.alq-table tbody tr:last-child > * { border-bottom: 0; }
/* values (bit patterns, hex, numbers) in monospace; the headers stay in the text font */
.alq-table td .rich { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.alq-cell-blank { background: var(--alq-blank); }
.alq-cell-box { display: inline-flex; align-items: center; gap: 4px; }
.alq-cell-input { width: 7.5em; min-height: 38px; padding: 6px 8px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 15px; font-weight: 700; text-align: center; border: 1.5px solid var(--faint); border-radius: 8px; }
.alq-cell-input.is-invalid { border-color: var(--warn); box-shadow: 0 0 0 3px rgba(232, 163, 23, .25); }
.alq-cell-mark { display: inline-flex; width: 16px; }
.alq-cell-mark.is-ok { color: var(--ok); }
.alq-cell-mark.is-bad { color: var(--bad); }
.alq-cell-key { display: block; margin-top: 2px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; font-weight: 700; color: var(--ok-text); }
.alq-cell-key.is-ok { display: none; }
.alq-table-help, .alq-order-help { margin: 8px 0 0; }
.alq.is-done .alq-table-help, .alq.is-done .alq-order-help { display: none; }

/* order: rearranged with Move up / Move down (or dragged by the grip) */
.alq-order { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.alq-order-item { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 8px 6px 4px; border: 1px solid var(--line-input); border-radius: 10px; background: var(--card); transition: box-shadow .12s, border-color .12s; }
.alq-order-item.is-dragging { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand), var(--shadow-lg); position: relative; z-index: 1; }
.alq-grip { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 28px; align-self: stretch; color: var(--faint); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.alq-order-item.is-dragging .alq-grip { cursor: grabbing; color: var(--brand); }
.alq-order-num { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--fill); color: var(--muted); font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.alq-order-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.alq-order-mark { flex: none; display: inline-flex; }
.alq-order-moves { flex: none; display: flex; gap: 4px; }
.alq-order-item.is-correct { border-color: var(--ok); background: var(--ok-soft); }
.alq-order-item.is-correct .alq-order-num { background: var(--ok); color: var(--on-status); }
.alq-order-item.is-correct .alq-order-mark { color: var(--ok); }
.alq-order-item.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.alq-order-item.is-wrong .alq-order-num { background: var(--bad); color: var(--on-status); }
.alq-order-item.is-wrong .alq-order-mark { color: var(--bad); }
.alq-order-item.is-correct .alq-order-moves, .alq-order-item.is-wrong .alq-order-moves,
.alq-order-item.is-correct .alq-grip, .alq-order-item.is-wrong .alq-grip { display: none; }
.alq-order-item.is-correct, .alq-order-item.is-wrong { padding-left: 10px; }
@media (max-width: 420px) { .alq-order-moves { flex-direction: column; } }

/* hint, actions, result */
.alq-hint { margin: 10px 0 0; }
.alq-hintbox { margin-top: 12px; padding: 10px 14px; border: 1px solid var(--warn-line); border-radius: 10px; background: var(--warn-soft); font-size: 15px; }
.alq-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
@media (max-width: 480px) { .alq-actions .btn { flex: 1 1 auto; } }
.alq-result { margin-top: 16px; padding: 14px 16px; border: 1px solid transparent; border-radius: 12px; }
.alq-result.is-ok { background: var(--ok-soft); border-color: var(--ok-line); }
.alq-result.is-bad { background: var(--bad-soft); border-color: var(--bad-line); }
.alq-result.is-shown { background: var(--info-soft); border-color: var(--info-line); }
.alq-result-head { display: flex; align-items: center; gap: 8px; font-size: 17px; }
.alq-result-icon { flex: none; width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--on-status); background: var(--info); }
.alq-result.is-ok .alq-result-icon { background: var(--ok); }
.alq-result.is-bad .alq-result-icon { background: var(--bad); }
.alq-result-line { margin: 8px 0 0; font-size: 14px; display: flex; flex-wrap: wrap; gap: 0 4px; }
.alq-key { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.alq-dot { color: var(--muted); }
.alq-key-order { margin-top: 10px; font-size: 15px; }
.alq-key-order h4, .alq-expl h4 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.alq-key-order ol { margin: 0; padding-left: 1.5em; }
.alq-key-order li { margin: 2px 0; }
.alq-notes:empty { display: none; }
.alq-note { display: flex; align-items: flex-start; gap: 8px; margin: 10px 0 0; padding: 8px 10px; border-radius: 8px; background: var(--alq-note-bg); font-size: 14px; font-weight: 600; }
.alq-note .icon { flex: none; margin-top: 2px; }
.alq-note.is-ok { color: var(--ok-text-strong); }
.alq-note.is-bad { color: var(--bad-text-strong); }
.alq-expl { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--alq-rule); font-size: 15px; line-height: 1.6; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.alq-more { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--alq-rule); }
.alq-learn { max-width: 100%; height: auto; min-height: 36px; white-space: normal; text-align: left; }

/* =========================================================================
   Exam-style question: laid out like a Cambridge paper
   ========================================================================= */
.alx { --alx-indent: calc(4.6em + 12px); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px 18px; font-size: 16px; line-height: 1.6; }
.alx:focus { outline: none; }
.alx:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.alx .rich p { margin: 0 0 .7em; }
.alx .rich p:last-child { margin-bottom: 0; }
.alx-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 12px; }
.alx-qnum { flex: none; min-width: 32px; height: 32px; padding: 0 6px; border: 2px solid var(--ink); border-radius: 4px; font-size: 16px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.alx-title { flex: 1 1 auto; margin: 0; font-size: 16px; font-weight: 700; }
.alx-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.alx-context { margin: 0 0 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.alx-parts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 22px; }
.alx-part { min-width: 0; }
/* margin labels (a) and (i), the prompt, the marks [n] on the right */
.alx-q { display: grid; grid-template-columns: 2.2em 2.4em minmax(0, 1fr) auto; column-gap: 6px; align-items: start; }
.alx-l1, .alx-l2 { font-weight: 700; white-space: nowrap; }
.alx-prompt { min-width: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.alx-marks { align-self: end; padding-left: 10px; font-weight: 700; white-space: nowrap; }
.alx-part.is-plain { --alx-indent: 0px; }
.alx-part.is-plain .alx-q { grid-template-columns: minmax(0, 1fr) auto; }
.alx-part.is-plain .alx-l1, .alx-part.is-plain .alx-l2 { display: none; }
.alx-answer, .alx-mark-row, .alx-ms { margin-left: var(--alx-indent); }
.alx-answer { margin-top: 10px; }
@media (max-width: 560px) {
  .alx { --alx-indent: 0px; padding: 14px 14px 16px; }
  .alx-q { grid-template-columns: auto auto minmax(0, 1fr) auto; }
  .alx-l1:not(:empty), .alx-l2:not(:empty) { margin-right: 4px; }
}
/* answer boxes: ruled lines like the paper */
.alx-text {
  min-height: 0; padding: 4px 12px; font-size: 16px; line-height: 28px; resize: vertical;
  background-color: var(--card); background-attachment: local; background-position: 0 4px;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 27px, var(--line) 27px, var(--line) 28px);
}
.alx-text[readonly] { background-color: var(--bg); }
.alx-code-wrap { min-width: 0; }
.alx-paper-note, .alx-empty-answer { display: flex; align-items: center; gap: 8px; margin: 0; padding: 12px 14px; border: 1.5px dashed var(--line-input); border-radius: 10px; background: var(--bg); color: var(--muted); font-size: 15px; }
.alx-paper-note .icon { flex: none; }
.alx-mark-row { margin-top: 10px; }
/* the mark scheme as a checklist */
.alx-ms { margin-top: 12px; padding: 14px 16px; border: 1px solid var(--info-line); border-radius: 12px; background: var(--alx-ms-bg); font-size: 15px; line-height: 1.55; }
.alx-ms-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.alx-ms-title { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.alx-score { font-variant-numeric: tabular-nums; white-space: nowrap; }
.alx-score strong { font-size: 20px; }
.alx-score.is-final strong { color: var(--ok-text); }
.alx-ms-help { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.alx-points { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; counter-reset: alx-point; }
.alx-points.is-numbered > li { counter-increment: alx-point; }
.alx-point { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); cursor: pointer; transition: background .12s, border-color .12s; }
.alx-points.is-numbered .alx-point::before { content: counter(alx-point); flex: none; min-width: 1.3em; font-weight: 700; color: var(--muted); }
.alx-point:has(.alx-point-cb:checked) { border-color: var(--ok-line); background: var(--ok-soft); }
.alx-point-cb { flex: none; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--ok); cursor: pointer; }
.alx-point-cb:disabled { cursor: default; }
.alx-point-text { flex: 1; min-width: 0; }
.alx-mode-review .alx-point, .alx-part.is-done .alx-point { cursor: default; }
.alx-max-note { margin: 8px 0 0; font-size: 13.5px; font-weight: 600; color: var(--warn-text); }
.alx-msnotes { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--alx-ms-rule); }
.alx-msnotes-label, .alx-tip-label { display: inline-flex; align-items: center; gap: 5px; margin-bottom: 2px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.alx-ms-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.alx-ms-actions .btn-ok:disabled { opacity: 1; cursor: default; }
@media (max-width: 480px) { .alx-ms-actions .btn { flex: 1 1 auto; } }
.alx-model { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--alx-ms-rule); }
.alx-model h5 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); outline-offset: 4px; }
.alx-model-h:focus:not(:focus-visible) { outline: none; } /* focused after "Save mark" */
.alx-save-err { margin: 8px 0 0; }
.alx-tip { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--brand-line); border-radius: 10px; background: var(--brand-soft); }
.alx-tip-label { color: var(--brand-dark); }
.alx-total { margin: 18px 0 0; padding-top: 12px; border-top: 1px solid var(--line); text-align: right; font-size: 15px; }
.alx-total strong { font-size: 18px; font-variant-numeric: tabular-nums; }

/* =========================================================================
   Lesson page additions (the layout, section list, callouts and pager are learn.css .lsn-*)
   ========================================================================= */
.alsn-exam .alx { margin-top: 4px; font-size: 16px; }
.alsn-terms-note { display: flex; align-items: flex-start; gap: 8px; }
.alsn-terms-note .icon { flex: none; margin-top: .25em; color: var(--brand-dark); }
.alsn-terms { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.alsn-term { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); font-size: .94em; line-height: 1.55; }
.alsn-term dt { font-weight: 700; overflow-wrap: anywhere; }
.alsn-term dd { margin: 4px 0 0; color: var(--ink); }
.alsn-mastery { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 14px; font-size: 14px; }
.alsn-mastery-sub { color: var(--muted); }
.alsn-soon-icon { width: 60px; height: 60px; margin: 0 auto 12px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; }

/* =========================================================================
   Flashcards
   ========================================================================= */
.alc-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 640px) { .alc-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.alc-how { margin-bottom: 20px; }

/* browse */
.alc-browse .card-header { flex-wrap: wrap; }
.alc-filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 220px); gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
@media (max-width: 560px) { .alc-filters { grid-template-columns: minmax(0, 1fr); padding: 12px 14px; } }
.alc-filters .field { gap: 4px; }
.alc-filter-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 18px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); }
@media (max-width: 560px) { .alc-filter-bar { padding: 10px 14px; } }
.alc-groups { padding: 6px 0 8px; }
.alc-topic { padding: 10px 18px 6px; }
@media (max-width: 560px) { .alc-topic { padding: 10px 14px 6px; } }
.alc-topic-title { margin: 0 0 6px; font-size: 15px; }
.alc-sub-title { margin: 10px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.alc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.alc-item { border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.alc-item[open] { border-color: var(--line-strong); }
.alc-item summary { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 8px 12px; cursor: pointer; list-style: none; font-weight: 700; }
.alc-item summary::-webkit-details-marker { display: none; }
.alc-item summary .alc-chev { flex: none; color: var(--muted); transition: transform .15s; }
.alc-item[open] summary .alc-chev { transform: rotate(180deg); }
.alc-item-term { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.alc-item-body { padding: 0 12px 12px; font-size: 15px; line-height: 1.55; }
.alc-item-body .rich { margin-bottom: 8px; }
.alc-item-link { font-size: 13px; font-weight: 700; text-decoration: none; }
.alc-item-link:hover { text-decoration: underline; }
.alc-more { padding: 8px 18px 4px; }

/* session: one card at a time — term, flip, definition, "I knew it" / "I didn't" */
.alc-session { max-width: 46rem; margin: 0 auto; }
.alc-session-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.alc-session-label { font-size: 14px; font-weight: 700; }
.alc-session-count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.alc-session-bar { height: 6px; margin-bottom: 16px; }
.alc-stage { perspective: 1400px; }
.alc-flip { display: grid; transform-style: preserve-3d; transition: transform .45s cubic-bezier(.2, .7, .2, 1); }
.alc-flip.is-flipped { transform: rotateY(180deg); }
.alc-flip.is-instant { transition: none; }
.alc-face {
  grid-area: 1 / 1; min-height: 240px; display: flex; flex-direction: column; justify-content: center; gap: 10px;
  padding: 24px 22px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  -webkit-backface-visibility: hidden; backface-visibility: hidden; text-align: center; cursor: pointer;
}
.alc-back { transform: rotateY(180deg); text-align: left; cursor: default; }
.alc-face:focus { outline: none; } /* focused by the page after a flip (screen readers read the definition) */
.alc-face-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.alc-term { font-size: 26px; font-weight: 800; letter-spacing: -.01em; line-height: 1.25; overflow-wrap: anywhere; }
.alc-back .alc-term { font-size: 18px; }
.alc-def { font-size: 17px; line-height: 1.6; }
.alc-def .rich p { margin: 0 0 .6em; }
.alc-def .rich p:last-child { margin-bottom: 0; }
.alc-face-src { font-size: 13px; color: var(--muted); }
@media (max-width: 480px) { .alc-face { min-height: 210px; padding: 20px 16px; } .alc-term { font-size: 22px; } .alc-def { font-size: 16px; } }
@media (prefers-reduced-motion: reduce) {
  .alc-flip { transition: none; }
  .alc-item summary .alc-chev { transition: none; }
}
.alc-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin-top: 16px; }
.alc-controls .btn { min-height: 52px; font-size: 16px; white-space: normal; text-align: center; line-height: 1.2; }
.alc-controls .alc-flip-btn { grid-column: 1 / -1; }
.alc-knew { background: #137a40; color: #fff; }
.alc-knew:hover:not(:disabled) { background: #0f5f32; }
.alc-kbd { display: none; min-width: 22px; padding: 1px 6px; border: 1px solid currentColor; border-radius: 5px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; font-weight: 700; line-height: 1.5; opacity: .75; }
@media (hover: hover) and (pointer: fine) { .alc-kbd { display: inline-block; } }
.alc-keys { display: none; margin: 10px 0 0; text-align: center; font-size: 12.5px; color: var(--muted); }
@media (hover: hover) and (pointer: fine) { .alc-keys { display: block; } }
.alc-session-foot { display: flex; justify-content: center; margin-top: 14px; }

/* summary */
.alc-summary-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 16px; }
.alc-summary-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 480px) { .alc-summary-actions .btn { flex: 1 1 100%; } }
.alc-missed { margin-top: 18px; }
.alc-missed-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.alc-missed-list li { padding: 10px 12px; border: 1px solid var(--bad-line); border-radius: 10px; background: var(--bad-soft); font-size: 15px; }
.alc-missed-list strong { display: block; margin-bottom: 2px; }

/* ---------- Dark theme ---------- */
:root[data-theme="dark"] {
  --alq-note-bg: rgba(255, 255, 255, .06);
  --alq-rule: rgba(255, 255, 255, .1);
  --alq-blank: #1C2129;
  --alx-ms-bg: #161e2f;
  --alx-ms-rule: #22355c;
}
/* "I knew it": light keeps #137a40 (white text needs a darker green than --ok); in dark it is the bright --ok
   with --on-status text, and the hover rule is repeated because the dark base rule out-ranks it. */
:root[data-theme="dark"] .alc-knew { background: var(--ok); color: var(--on-status); }
:root[data-theme="dark"] .alc-knew:hover:not(:disabled) { background: var(--ok-text); }
