/* Lesson player, course path and embedded exercises (owner: quiz agent). Loaded on /learn/ pages and on pages with an
   exercise. Uses the design tokens of styles/core/00-tokens.css only. */
.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; }

/* ---------- player ---------- */
.page--lesson main { padding: 16px var(--gutter) 24px; }
.page--lesson { padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
.lesson-app { max-width: 480px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.lesson-app h1 { font-size: clamp(28px, 7vw, 36px); margin: 0; }
.lesson-app h1:focus, .lesson-q h2:focus { outline: none; }
.lesson-top { display: flex; align-items: center; gap: 12px; }
.lesson-close { color: var(--muted); font-size: 26px; text-decoration: none; line-height: 1; padding: 2px 6px; border-radius: 8px; }
.bar { flex: 1; height: 12px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .35s ease; }
.chip { font-family: var(--mono); font-size: 13px; display: flex; align-items: center; gap: 10px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.chip span { display: inline-flex; align-items: center; gap: 3px; }
.chip .flame { color: var(--xp); }
.chip b { color: var(--xp); font-weight: 500; }
.lesson-q h2 { margin: 0 0 4px; font-size: clamp(21px, 5.4vw, 25px); }
.lesson-q .kicker { margin-bottom: 4px; }
.hint { font-size: 15px; color: var(--muted); margin: 0; }
.dek { margin: 0; }
.goals-title { margin: 6px 0 0; font-weight: 700; }
.goals { padding-left: 1.2em; color: var(--muted); margin: 0; }
.fineprint { font-size: 13px; color: var(--muted); text-align: center; margin: 4px 0 0; }
.lesson-zone { display: flex; flex-direction: column; gap: 12px; }
.chart-card { padding: 10px 6px 6px; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opts--wide { grid-template-columns: 1fr; }
.opt { background: var(--surface); border: 1.5px solid var(--line); border-bottom-width: 4px; border-radius: var(--radius); padding: 13px 12px; text-align: left; font-weight: 600; transition: transform .08s; display: flex; gap: 10px; align-items: baseline; min-height: 48px; }
.opt kbd { font-family: var(--mono); font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; flex: none; }
.opt:active { transform: translateY(2px); }
.opt:disabled { cursor: default; }
.opt.sel.ok { border-color: var(--up); background: var(--good); }
.opt.sel.no { border-color: var(--down); background: var(--bad); }
.opt.sel.neutral { border-color: var(--accent); background: var(--soft); }
.opt.right { border-color: var(--up); }
.opt--small { padding: 8px 10px; min-height: 40px; font-size: 14px; }
.level-keys { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.calc { background: var(--soft); border-radius: var(--radius); padding: 12px 16px; font-family: var(--mono); font-size: 14px; display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-variant-numeric: tabular-nums; }
.calc span { color: var(--muted); font-family: var(--body); }
.calc b { font-weight: 500; }
.calc--wide { margin-top: 8px; font-size: 12.5px; grid-template-columns: auto 1fr; gap: 4px 10px; }
.sheet { border-radius: var(--radius-lg); padding: 16px; display: flex; flex-direction: column; gap: 10px; animation: rise .25s ease; position: sticky; bottom: 8px; box-shadow: 0 8px 24px color-mix(in srgb, var(--ink) 14%, transparent); }
.sheet.ok { background: var(--good); } .sheet.no { background: var(--bad); } .sheet.neutral { background: var(--soft); }
.sheet h3 { margin: 0; font-size: 20px; }
.sheet.ok h3 { color: var(--up-text); } .sheet.no h3 { color: var(--down-text); } .sheet.neutral h3 { color: var(--accent); }
.sheet p { margin: 0; font-size: 15px; }
.sheet p b { font-weight: 700; }
@keyframes rise { from { transform: translateY(10px); opacity: .4; } to { transform: none; opacity: 1; } }
.level-mark { opacity: 0; transition: opacity .25s; }
.level-mark line { stroke: var(--muted); }
.show-levels .level-mark { opacity: 1; }
.picks { font-size: 14px; color: var(--muted); margin: 0; min-height: 1.2em; }
.picks-note { margin: -4px 0 0; }
.check { margin-top: 2px; }
.callout { margin: 0; font-size: 15px; }

/* numeric input */
.numeric { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.numeric__row { display: flex; align-items: center; gap: 8px; }
.numeric input { font: inherit; font-family: var(--mono); font-size: 20px; width: 100%; min-width: 0; padding: 12px 14px; border-radius: var(--radius); border: 2px solid var(--line); background: var(--surface); color: var(--ink); }
.numeric input:focus { border-color: var(--accent); outline: none; }
.numeric.is-ok input { border-color: var(--up); background: var(--good); }
.numeric.is-no input { border-color: var(--down); background: var(--bad); }
.numeric__row span { color: var(--muted); font-weight: 600; }

/* builder */
svg.chart.builder { touch-action: none; }
.builder-label { font-size: 9px; pointer-events: none; fill: var(--accent); font-weight: 700; }
.builder-readout { font-family: var(--mono); font-size: 13px; color: var(--muted); text-align: center; margin: 4px 0 2px; }

/* order steps */
.order { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.order li { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 8px 8px 8px 12px; }
.order__n { font-family: var(--mono); font-size: 13px; color: var(--muted); width: 18px; flex: none; }
.order__t { flex: 1; font-weight: 600; font-size: 15px; }
.order__btns { display: flex; gap: 4px; flex: none; }
.order__b { width: 40px; height: 40px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--soft); font-size: 17px; }
.order__b:disabled { opacity: .35; cursor: default; }
.order--answer li { border-color: var(--up); background: var(--good); }

/* match pairs */
.match { display: flex; flex-direction: column; gap: 12px; }
.match__charts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.match__chart { padding: 6px; display: flex; flex-direction: column; gap: 4px; text-align: left; border-bottom-width: 4px; }
.match__chart .chart .axis { display: none; }
.match__chart.is-selected { border-color: var(--accent); border-width: 2px; border-bottom-width: 4px; }
.match__chart.is-paired { border-color: var(--xp); }
.match__chart.is-ok { border-color: var(--up); background: var(--good); }
.match__chart.is-no { border-color: var(--down); background: var(--bad); }
.match__tag { font-size: 13px; font-weight: 700; color: var(--muted); }
.match__labels { display: flex; flex-wrap: wrap; gap: 8px; }
.match__label { padding: 10px 12px; min-height: 44px; }
.match__label.is-used { opacity: .5; }

/* replay */
.replay-plan { display: flex; flex-direction: column; gap: 10px; }
.replay-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.replay-controls .btn { flex: 1 1 100%; }
.replay-controls .opt { flex: 1 1 40%; justify-content: center; }
.replay-status { font-weight: 600; margin: 0; }

/* summary */
.badge { display: inline-block; align-self: flex-start; background: var(--xp); color: #1b1300; font-weight: 800; border-radius: 99px; padding: 4px 12px; margin: 0; font-size: 14px; }
.badge--goal { background: var(--up); color: #fff; }
.stats--summary { grid-template-columns: repeat(2, 1fr); margin: 0; }
.progress-rows { display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.progress-rows > div { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 15px; }
.progress-rows span { color: var(--muted); }
.progress-rows b { font-family: var(--mono); font-weight: 500; font-size: 14px; }
.progress-rows .meter { grid-column: 1 / -1; }
.meter { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--xp); border-radius: 99px; }
.fixed h2 { font-size: 19px; margin: 6px 0 6px; }
.fixed ul { margin: 0 0 6px; padding-left: 1.2em; font-size: 15px; }
.summary-actions { display: flex; flex-direction: column; gap: 10px; }
.btn--ghost { background: var(--surface); color: var(--accent); border: 1.5px solid var(--line); box-shadow: 0 3px 0 var(--line); }
.linklike { background: none; border: 0; color: var(--accent); text-decoration: underline; padding: 0; font-size: inherit; }

/* ---------- path (/learn/) ---------- */
.path-head { display: flex; flex-direction: column; gap: 12px; margin: 0 0 12px; }
.path-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.path-actions .btn--big { flex: 1 1 260px; }
.path-actions .btn--ghost { flex: 0 1 auto; padding: 15px 18px; }
.path-summary[hidden] { display: none; }
.path-summary .goal { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.settings { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 0 0 8px; }
.settings summary { cursor: pointer; font-weight: 700; }
.settings__row { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: 10px 0 0; border: 0; padding: 0; }
.settings legend { font-weight: 600; padding: 0; margin-right: 6px; float: left; }
.settings label { display: inline-flex; gap: 6px; align-items: center; }
.settings .hint { margin-top: 10px; }
.unit { margin-top: 28px; }
.unit h2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.unit__n { font-family: var(--mono); font-size: 14px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); flex: none; }
.unit__badge { font-family: var(--body); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: #1b1300; background: var(--xp); border-radius: 99px; padding: 3px 10px; }
.lessons { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.lesson > a, .lesson > span { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1.5px solid var(--line); border-bottom-width: 4px; text-decoration: none; color: var(--ink); }
.lesson__n { font-family: var(--mono); font-size: 13px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--line); color: var(--muted); flex: none; }
.lesson__body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.lesson__title { font-weight: 700; }
.lesson small { color: var(--muted); font-size: 14px; }
.lesson__state { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); flex: none; }
.lesson em { font-style: normal; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.lesson--soon > span { opacity: .6; }
.lesson--done > a { border-color: var(--up); }
.lesson--done .lesson__n { background: var(--up); color: var(--surface); }
.lesson--done .lesson__state { color: var(--up-text); }
.lesson--current > a { border-color: var(--accent); border-width: 2px; border-bottom-width: 4px; }
.lesson--current .lesson__n { background: var(--accent); color: var(--accent-ink); }
.lesson--current .lesson__state { color: var(--accent); }
.lesson--locked > a { opacity: .62; }
.lesson--checkpoint > a { background: var(--soft); }
.lesson--checkpoint .lesson__n { background: var(--xp); color: #1b1300; }

@media (min-width: 720px) {
  .stats--summary { grid-template-columns: repeat(4, 1fr); }
  .match__charts { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
