/* SAII Learn v2: the lesson player (screens, three layouts, reward). Loads after app.css and only uses its tokens.
   Indigo only for the main action and the active state. Level colours only for levels. */
.lp { --lp-top: 86px; --lp-bar: 74px; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.lp [hidden] { display: none !important; }

/* top: close, title, view toggle, segmented progress */
.lp-top { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 92%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.lp-top-in { max-width: 1180px; margin: 0 auto; padding: 10px 16px 8px; display: grid; gap: 6px; }
.lp-top-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lp-title { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lp-doc { color: var(--ink3); margin-right: 8px; }
.lp-close, .lp-toggle { background: var(--sf2); }
.lp-segs { display: flex; gap: 4px; }
.lp-segs button { flex: 1; min-width: 0; height: 22px; padding: 8px 0; border: 0; background: transparent; border-radius: 4px; }
.lp-segs button:disabled { cursor: default; }
.lp-segs i { display: block; height: 6px; border-radius: 3px; background: var(--line); transition: background-color .35s ease; }
.lp-segs .d i { background: var(--ink); }
.lp-segs .c i { background: var(--ind); }
.lp[data-mode="page"] .lp-segs { display: none; }
.lp[data-mode="page"] { --lp-top: 60px; }

/* stage */
.lp-stage { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.lp-screen { width: 100%; outline: none; flex: 1; }
.lp-screen.enter[data-dir="fwd"] { animation: lp-in-f .34s cubic-bezier(.22, 1, .36, 1); }
.lp-screen.enter[data-dir="back"] { animation: lp-in-b .34s cubic-bezier(.22, 1, .36, 1); }
@keyframes lp-in-f { from { opacity: 0; transform: translateX(22px); } }
@keyframes lp-in-b { from { opacity: 0; transform: translateX(-22px); } }
@keyframes lp-task-in { from { opacity: 0; transform: translateX(34px); } }
@keyframes lp-sheet-in { from { opacity: 0; transform: translateY(40px); } }

.lp-eyebrow { margin-bottom: 14px; color: var(--ink3); }
.lp-fallback { margin-bottom: 14px; height: auto; padding: 6px 12px; white-space: normal; }
.lp-lead { font-size: clamp(22px, 3vw, 30px); line-height: 1.3; letter-spacing: -0.02em; font-weight: 500; color: var(--ink); max-width: 30em; }
.lp-lead + * { margin-top: 22px; }

/* focus: one centred column */
.lp-focus { display: flex; padding: 20px 16px calc(var(--lp-bar) + 36px); }
.lp-focus .lp-col { width: 100%; max-width: 640px; margin: auto; }
.lp-focus .prose { font-size: clamp(20px, 2.3vw, 25px); line-height: 1.42; letter-spacing: -0.012em; }
.lp-focus .prose > * + * { margin-top: 16px; }
.lp-focus .prose h3 { font-size: clamp(28px, 4vw, 40px); margin-top: 0; }
.lp-focus .prose h3 + * { margin-top: 14px; }
.lp-focus .prose ul, .lp-focus .prose ol { padding-left: 24px; }
.lp-focus .callout { font-size: inherit; padding: 18px 20px; }
.lp-focus .blk { margin-top: 24px; padding: 0; background: transparent; }
.lp-focus .blk > header { margin-bottom: 16px; gap: 8px; }
.lp-focus .blk > header h4 { font-size: clamp(24px, 3.2vw, 32px); line-height: 1.16; letter-spacing: -0.025em; flex-basis: 100%; }
.lp-focus .blk > header .tag:empty { display: none; }
.lp-focus section[data-block]:has(.wdg) > header h4 { font-size: 22px; }
.lp-focus .wdg { background: var(--sf); border-radius: var(--r); padding: 18px; }
.lp-focus .opts { gap: 10px; }
.lp-focus .opt { min-height: 58px; padding: 15px 18px; font-size: 17.5px; line-height: 1.4; background: var(--sf); align-items: center; border-radius: 16px; }
.lp-focus .opt:has(small) { align-items: flex-start; }
.lp-focus .opt small { font-size: 15px; line-height: 1.45; }
.lp-focus .opt .mk { width: 24px; height: 24px; }
.lp-focus .btn { height: 48px; }
.lp-focus .try .steps { gap: 10px; }

/* results, XP note */
.lp-actions, .cmp-after, .lp-verdict { scroll-margin-bottom: calc(var(--lp-bar) + 24px); }
.lp-result { font-size: 16px; font-weight: 500; line-height: 1.4; }
.lp-result.ok { color: var(--ok); } .lp-result.bad { color: var(--bad); }
.lp-result.big { font-size: 26px; letter-spacing: -0.02em; line-height: 1.2; }
.lp-actions .lp-result { margin-left: 4px; }
.xp-pop { position: fixed; left: 50%; bottom: calc(var(--lp-bar, 74px) + 28px); transform: translateX(-50%); z-index: 90; background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font: 500 15px var(--font); animation: xp-rise 1.6s ease forwards; pointer-events: none; }
@keyframes xp-rise { 0% { opacity: 0; transform: translate(-50%, 12px); } 15%, 80% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -8px); } }

/* compare as a choice */
.cmp.pick { display: grid; grid-template-columns: 1fr 1fr; align-items: stretch; margin-top: 0; gap: 12px; }
.cmp-opt { display: flex; flex-direction: column; gap: 10px; text-align: left; border: 0; border-radius: 18px; padding: 18px; background: var(--sf); box-shadow: inset 0 0 0 1.5px transparent; min-height: 132px; transition: box-shadow .15s, transform .16s cubic-bezier(.22, 1, .36, 1); }
.cmp-opt:not([aria-disabled]):hover { box-shadow: inset 0 0 0 1.5px var(--ink3); transform: translateY(-1px); }
.cmp-opt:not([aria-disabled]):active { transform: scale(.985); }
.cmp-opt[aria-disabled] { cursor: default; }
.cmp-opt.right { box-shadow: inset 0 0 0 2px var(--ok); } .cmp-opt.wrong { box-shadow: inset 0 0 0 2px var(--bad); }
.cmp-cap { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; }
.cmp-cap .mono { color: var(--ink3); text-transform: uppercase; letter-spacing: .05em; }
.cmp-body { font: 15px/1.6 var(--mono); white-space: pre-wrap; word-break: break-word; }
.cmp-after { margin-top: 14px; display: grid; gap: 8px; }
.cmp-after .cmp-note { margin-top: 0; font-size: 17px; color: var(--ink); }
.cmp-wrap { margin-top: 22px; }
@media (max-width: 700px) { .cmp.pick { grid-template-columns: 1fr; } .cmp-opt { min-height: 0; } }

/* try: tick the steps */
.ticks-steps li { display: block; }
.ticks-steps li::before { display: none; }
.stp { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-s); background: var(--sf); min-height: 56px; font-size: 17px; line-height: 1.45; cursor: pointer; }
.stp input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--ind); flex: none; }
.ticks-steps li.on .stp { color: var(--ink2); }
.blk.try .textarea { background: var(--sf); }

/* criteria light up while typing */
.crit li.live .mk { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ok); color: var(--ok); }
.crit li { transition: opacity .2s; }

/* checkpoint */
.cp-q { font-size: clamp(24px, 3.4vw, 32px); margin: 8px 0 20px; }
.cp .lp-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* workbench: instruction left, task right */
.lp-workbench { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 6fr); gap: 32px; align-items: start; max-width: 1240px; margin: 0 auto; padding: 28px 24px calc(var(--lp-bar) + 36px); }
.lp-ins > header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.lp-ins > header h4 { font-size: clamp(24px, 2.6vw, 30px); line-height: 1.16; letter-spacing: -0.025em; flex-basis: 100%; }
.lp-ins > header:not(:first-child) { margin-top: 30px; }
.lp-ins .prose { font-size: 17.5px; }
.lp-ins .blk { margin-top: 20px; }
.lp-ins .rev { margin-top: 14px; }
.lp-task { background: var(--sf); border-radius: var(--r); padding: 22px; position: sticky; top: calc(var(--lp-top) + 10px); max-height: calc(100vh - var(--lp-top) - var(--lp-bar) - 20px); max-height: calc(100dvh - var(--lp-top) - var(--lp-bar) - 20px); overflow-y: auto; display: grid; gap: 14px; align-content: start; }
.lp-workbench.enter .lp-task { animation: lp-task-in .46s cubic-bezier(.22, 1, .36, 1) .06s both; }
.lp-task .blk { margin-top: 0; }
.lp-crit { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.lp-task .wdg { background: transparent; padding: 0; }
.lp-task .editor, .lp-task .editor pre, .lp-task .editor textarea { min-height: 240px; }
.lp-task .msgs { max-height: 300px; }
.lp-task .ws { grid-auto-flow: row; }
.lp-grab { display: none; }
.lp-crit-ins { display: none; }
.lp-task .msgs:empty { display: none; }
.lp-workbench.has-lab { grid-template-columns: minmax(0, 4fr) minmax(0, 6fr); }
.lp-workbench.has-lab .lp-task { background: transparent; padding: 0; max-height: none; overflow: visible; position: static; }

/* reader: a normal article */
.lp-reader { padding: 28px 16px calc(var(--lp-bar) + 36px); }
.lp-article { max-width: 720px; margin: 0 auto; }
.lp-article .prose { font-size: 17px; }
.lp-article .lp-lead { font-size: 20px; font-weight: 400; color: var(--ink2); line-height: 1.5; letter-spacing: -0.005em; }
.lp-h1 { font-size: clamp(30px, 4vw, 44px); margin-bottom: 14px; }
.lp-pagebody { margin-top: 26px; }
.lp[data-mode="page"] .lp-reader { padding-bottom: 96px; }

/* bottom bar */
.lp-bar { position: sticky; bottom: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 90%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
.lp-bar-in { max-width: 760px; margin: 0 auto; display: flex; align-items: center; gap: 10px; }
.lp-bar-in .sp { flex: 1; }
.lp-bar .btn { height: 48px; }
.lp-cont { min-width: 140px; }
.lp-skip { min-height: 44px; padding: 0 10px; border: 0; background: none; color: var(--ink3); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.lp-skip:hover { color: var(--ink); }

/* tutor button */
.lp-fab { position: fixed; right: 18px; bottom: calc(var(--lp-bar) + 14px); z-index: 38; border: 0; background: none; padding: 0; border-radius: 999px; }
.lp-fab .ai-ring { display: block; }
.lp-fab-in { display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 18px 0 14px; border-radius: 999px; background: var(--sf); font-size: 14.5px; font-weight: 500; }
.lp[data-mode="page"] .lp-fab, .lp[data-mode="reward"] .lp-fab { bottom: 18px; }

/* reward */
.lp-reward .lp-col { display: grid; gap: 18px; }
.lp-xp { display: flex; align-items: baseline; gap: 10px; font-size: clamp(72px, 16vw, 120px); font-weight: 600; letter-spacing: -0.05em; line-height: .95; font-variant-numeric: tabular-nums; }
.lp-xp-u { font-size: .26em; letter-spacing: 0; color: var(--ink3); }
.lp-skill { display: flex; gap: 14px; align-items: center; padding: 16px 18px; border-radius: var(--r-s); background: var(--sf); box-shadow: inset 0 0 0 1.5px var(--spark); animation: lp-light 1.4s ease .2s both; }
@keyframes lp-light { 0% { box-shadow: inset 0 0 0 1.5px var(--line); } 40% { box-shadow: inset 0 0 0 1.5px var(--spark), 0 0 0 6px color-mix(in srgb, var(--spark) 45%, transparent); } 100% { box-shadow: inset 0 0 0 1.5px var(--spark); } }
.lp-skill-mk { width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--spark); color: #0B0C10; display: inline-flex; align-items: center; justify-content: center; }
.lp-skill-t { font-size: 18px; font-weight: 500; line-height: 1.35; letter-spacing: -0.01em; }
.lp-where { margin-top: -6px; }
.lp-prompt { display: grid; gap: 8px; }
.lp-pcard { background: var(--sf); border-radius: var(--r-s); padding: 14px; }
.lp-pcard pre { max-height: 220px; overflow: auto; }
.lp-pcard-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; font-size: 16px; }
.lp-saved { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ok); }
.lp-streak { font-size: 14.5px; }
.lp-reward-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; position: sticky; bottom: 0; z-index: 3; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 92%, transparent); }
.lp-big { height: 56px; padding: 0 28px; font-size: 17px; }
.lp[data-mode="reward"] .lp-focus { padding-bottom: 64px; }

/* phones: the task becomes a bottom sheet, widgets stay in the flow */
@media (max-width: 860px) {
  .lp-doc { display: none; }
  .lp-toggle-t { display: none; }
  .lp-toggle { width: 40px; padding: 0; }
  .lp-focus { padding: 16px 16px calc(var(--lp-bar) + 90px); }
  .lp-workbench { display: block; padding: 18px 16px calc(var(--lp-bar) + 24px); }
  .lp-workbench.has-sheet { padding-bottom: calc(var(--lp-bar) + 40dvh); }
  .lp-workbench.has-sheet .lp-crit-ins { display: block; margin-top: 18px; }
  .lp-workbench.has-sheet .lp-task .lp-crit { display: none; }
  .lp-workbench.has-lab .lp-task { margin-top: 18px; }
  .lp-workbench.has-sheet .lp-task { position: fixed; left: 0; right: 0; bottom: calc(var(--lp-bar) - 4px); top: auto; z-index: 36; max-height: 52dvh; border-radius: 22px 22px 0 0; padding: 4px 16px 0; box-shadow: 0 -14px 32px -14px rgba(11, 12, 16, .3); animation: lp-sheet-in .4s cubic-bezier(.22, 1, .36, 1); }
  .lp-workbench.has-sheet .lp-task.collapsed { overflow: hidden; }
  .lp-workbench.has-sheet .lp-task.collapsed > :not(.lp-grab) { display: none; }
  .lp-grab { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 40px; border: 0; background: none; color: var(--ink2); font-size: 13.5px; font-weight: 500; position: sticky; top: 0; z-index: 2; background: var(--sf); }
  .lp-grab i { width: 36px; height: 4px; border-radius: 2px; background: var(--line); }
  .lp-task .lp-actions { position: sticky; bottom: 0; z-index: 2; background: var(--sf); padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); margin: 0; }
  .lp-task .ws .lp-actions { order: 5; }
  .lp-task .editor, .lp-task .editor pre, .lp-task .editor textarea { min-height: 180px; }
  .lp-task .msgs { max-height: 22dvh; }
  .lp-fab { bottom: calc(var(--lp-bar) + 12px); right: 12px; }
  .lp-fab-in { width: 48px; padding: 0; justify-content: center; }
  .lp-fab-t { display: none; }
  .lp[data-sheet] .lp-fab { bottom: auto; top: calc(var(--lp-top) + 8px); }
  .lp-reward-cta .btn { flex: 1; }
  .lp-bar-in .btn { padding: 0 18px; }
  .lp-cont { min-width: 0; flex: 1; }
  .lp-bar-in .sp { flex: 0 0 auto; width: 0; }
}
@media (max-width: 420px) { .lp-top-in { padding-inline: 12px; } .lp-bar { padding-inline: 12px; } }

/* motion and contrast preferences */
@media (prefers-reduced-motion: reduce) {
  .lp *, .lp *::before, .lp *::after, .xp-pop { animation: none !important; transition: none !important; }
  .xp-pop { opacity: 1; transform: translateX(-50%); }
}
/* choice cards must read as two separate tappable cards even inside a white block */
.cmp.pick .cmp-opt { background: var(--bg); box-shadow: inset 0 0 0 1.5px var(--line); }
.cmp.pick .cmp-opt:not([aria-disabled]):hover { box-shadow: inset 0 0 0 1.5px var(--ink3); }
.cmp.pick .cmp-opt.right { box-shadow: inset 0 0 0 2px var(--ok); } .cmp.pick .cmp-opt.wrong { box-shadow: inset 0 0 0 2px var(--bad); }
