/* Eri Code Lab */
.eri-lab, .eri-dash, .eri-track, .eri-board, .eri-toast { --eri-bg: #0f1420; --eri-panel: #161c2b; --eri-line: #263049; --eri-text: #e6e9f2; --eri-muted: #8a93a8; --eri-accent: #3b82f6; --eri-go: #22c55e; --eri-bad: #ef4444; --eri-gold: #f5b301; }

/* ── Layout, mobile first ─────────────────────────────────────────────
   Phone  (<640px, or a short landscape screen): one panel at a time, switched with tabs.
   Tablet (640–1099): lesson on the left, code above output on the right.
   Desktop (≥1100):  three panels side by side with draggable dividers.        */
/* The lab adapts to the width of the column it sits in (container queries), not the screen:
   LearnPress lessons are often ~800px wide even on a large monitor. */
.eri-lab-wrap { container: eri-lab / inline-size; margin: 1.5em 0; max-width: 100%; }
.eri-lab-wrap > .eri-lab { margin: 0; }
/* Full-screen workspace: the whole window, so even narrow lesson columns get all three panels. */
.eri-lab-wrap.is-full { position: fixed; inset: 0; z-index: 100000; margin: 0; background: #0b0f19; padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); display: flex; }
.eri-lab-wrap.is-full > .eri-lab { flex: 1; height: auto; min-height: 0; border-radius: 0; border: 0; }
.eri-lab-wrap.is-full .eri-lab__learn { overflow: auto; }
html.eri-noscroll, html.eri-noscroll body { overflow: hidden !important; }
.eri-lab-wrap.is-full .eri-lab__panel { overflow: auto; }
.eri-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.eri-lab { position: relative; display: flex; flex-direction: column; background: var(--eri-line); border: 1px solid var(--eri-line); border-radius: 12px; overflow: clip; margin: 1.5em 0; font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--eri-text); max-width: 100%; min-width: 0; }
.eri-lab * { box-sizing: border-box; }
.eri-lab [hidden] { display: none !important; }
.eri-lab__actions { display: inline-flex; gap: 6px; margin-left: auto; }
.eri-lab :focus-visible { outline: 3px solid #82aaff; outline-offset: 2px; }
.eri-lab__panel { background: var(--eri-panel); display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.eri-lab__learn { padding: 16px; background: #fbfcfe; color: #1c2333; }
.eri-lab__code .eri-lab__editor { height: clamp(260px, 55vh, 520px); flex: none; }
.eri-lab__out { min-height: 240px; }
.eri-lab__split { display: none; }

/* Tabs (phones only) */
.eri-lab__tabs { display: flex; position: sticky; top: var(--eri-sticky-top, 0px); z-index: 3; background: var(--eri-bg); border-bottom: 1px solid var(--eri-line); }
.eri-lab__tab { flex: 1; appearance: none; background: transparent; border: 0; border-bottom: 3px solid transparent; color: var(--eri-muted); font: 600 14px/1 system-ui, sans-serif; min-height: 46px; padding: 0 8px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.eri-lab__tab[aria-selected="true"] { color: #fff; border-bottom-color: var(--eri-go); }
.eri-lab__tab-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--eri-gold); display: none; }
.eri-lab__tab.has-news .eri-lab__tab-dot { display: inline-block; }
.eri-lab.has-tabs .eri-lab__panel:not(.is-active) { display: none; }
.eri-lab__kbd { display: none; }

@container eri-lab (min-width: 640px) {
  .eri-lab { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); grid-template-rows: minmax(0, 1.25fr) minmax(0, 1fr); grid-template-areas: "learn code" "learn out"; gap: 1px; height: clamp(600px, 84vh, 900px); }
  .eri-lab__tabs { display: none; }
  .eri-lab__learn { grid-area: learn; overflow: auto; padding: 18px 20px; }
  .eri-lab__code { grid-area: code; }
  .eri-lab__out { grid-area: out; min-height: 0; }
  .eri-lab__code .eri-lab__editor { height: auto; flex: 1; min-height: 0; }
  .eri-lab__kbd { display: inline; font: 11px ui-monospace, Consolas, monospace; opacity: .7; }
}
@container eri-lab (min-width: 1100px) {
  .eri-lab { grid-template-columns: minmax(240px, var(--eri-c1, 1fr)) 8px minmax(300px, 1.35fr) 8px minmax(240px, var(--eri-c3, 1fr)); grid-template-rows: minmax(0, 1fr); grid-template-areas: "learn s1 code s2 out"; gap: 0; height: min(82vh, 820px); min-height: 560px; }
  .eri-lab__split { display: block; background: var(--eri-line); cursor: col-resize; position: relative; touch-action: none; }
  .eri-lab__split[data-split="1"] { grid-area: s1; } .eri-lab__split[data-split="2"] { grid-area: s2; }
  .eri-lab__split::after { content: ""; position: absolute; left: 3px; top: 50%; width: 2px; height: 32px; margin-top: -16px; border-radius: 2px; background: var(--eri-muted); opacity: .6; }
  .eri-lab__split:hover, .eri-lab__split:focus-visible, .eri-lab__split.is-drag { background: #3b4a6b; }
}
.eri-lab.is-resizing { user-select: none; cursor: col-resize; }

/* Phone mode chosen by the script (narrow space, or a phone held sideways): always one panel + tabs. */
.eri-lab.has-tabs { display: flex; flex-direction: column; height: auto; min-height: 0; }
.eri-lab.has-tabs .eri-lab__tabs { display: flex; }
.eri-lab.has-tabs .eri-lab__split { display: none; }
.eri-lab.has-tabs .eri-lab__learn { overflow: visible; }
.eri-lab.has-tabs .eri-lab__code .eri-lab__editor { height: clamp(200px, 55vh, 520px); flex: none; }
.eri-lab.has-tabs .eri-lab__out { min-height: 200px; }
.eri-lab-wrap.is-full > .eri-lab.has-tabs { overflow: auto; }
.eri-lab__head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.eri-lab__tag { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: #e7efff; color: #1d4ed8; padding: 2px 8px; border-radius: 99px; }
.eri-lab__tag--challenge { background: #fff1c2; color: #8a5a00; }
.eri-lab--challenge { border-color: #f5b301; }
.eri-tip, .eri-warn { border-radius: 10px; padding: 12px 16px; margin: 1.2em 0; }
.eri-tip { background: #effaf3; border: 1px solid #bfe8cf; }
.eri-warn { background: #fff5f5; border: 1px solid #f6c9c9; }
.eri-tip > strong:first-child, .eri-warn > strong:first-child { display: block; margin-bottom: 4px; }
.eri-mistake { margin: 8px 0 0; }
.eri-mistake pre { margin: 4px 0 !important; }
.eri-lab__pts { font-size: 12px; color: #92600a; background: #fff4d6; padding: 2px 8px; border-radius: 99px; font-weight: 600; }
.eri-lab__done { font-size: 12px; color: #166534; background: #dcfce7; padding: 2px 8px; border-radius: 99px; font-weight: 600; }
.eri-lab__title { margin: 12px 0 8px; font-size: 20px; line-height: 1.3; color: #0f172a; }
.eri-lab__instructions { font-size: 15px; overflow-wrap: anywhere; }
.eri-lab__instructions pre { background: #0f1420; color: #e6e9f2; padding: 10px 12px; border-radius: 8px; overflow: auto; font-size: 13px; }
.eri-lab__instructions code { background: #eef1f7; padding: 1px 5px; border-radius: 4px; font-size: .92em; }
.eri-lab__instructions pre code { background: none; padding: 0; }
.eri-lab__instructions img, .eri-lab__instructions iframe, .eri-lab__instructions video { max-width: 100%; height: auto; border-radius: 8px; }
.eri-hint { margin-top: 10px; background: #fff8e1; border-left: 3px solid var(--eri-gold); padding: 8px 10px; border-radius: 6px; font-size: 13.5px; }

.eri-lab__toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px; background: var(--eri-bg); border-bottom: 1px solid var(--eri-line); flex: 0 0 auto; }
.eri-lab__file { font: 600 12px ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--eri-muted); }
.eri-lab__spacer { flex: 1; }
.eri-lab__status { margin-left: auto; font-size: 12px; color: var(--eri-muted); }
.eri-btn { appearance: none; border: 1px solid transparent; background: var(--eri-accent); color: #fff !important; font: 600 13px/1 system-ui, sans-serif; padding: 8px 12px; border-radius: 7px; cursor: pointer; text-decoration: none !important; display: inline-flex; align-items: center; gap: 4px; }
.eri-btn:hover { filter: brightness(1.1); }
.eri-btn:disabled { opacity: .5; cursor: not-allowed; }
.eri-lab.is-busy .eri-btn:disabled { cursor: wait; }
@media (pointer: coarse) {
  .eri-btn { min-height: 44px; padding: 10px 14px; font-size: 14px; }
  .eri-sol__steps li { padding-block: 12px; }
}
.eri-btn--go { background: var(--eri-go); color: #06210f !important; }
.eri-btn--ghost { background: transparent; border-color: var(--eri-line); color: var(--eri-text) !important; }
.eri-lab__editor { flex: 1; min-height: 0; }
.eri-lab__editor .CodeMirror { height: 100%; font: 16px/1.6 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; }
/* 16px on phones stops iOS Safari zooming in when the editor gets focus. */
@container eri-lab (min-width: 640px) { .eri-lab__editor .CodeMirror { font-size: 14px; } }
.eri-lab .CodeMirror textarea { font-size: 16px; }
.eri-line-err { background: rgba(239, 68, 68, .18); }

.eri-lab__out { overflow: hidden; }
.eri-lab__preview { flex: 1 1 55%; width: 100%; border: 0; background: #fff; min-height: 160px; }
.eri-lab__console { flex: 1 1 auto; margin: 0; padding: 12px 14px; overflow: auto; background: var(--eri-panel); color: var(--eri-text); font: 13.5px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; word-break: break-word; border: 0; border-radius: 0; min-height: 80px; }
.eri-lab__preview:not([hidden]) + .eri-lab__console { flex: 0 0 22%; border-top: 1px solid var(--eri-line); }
.eri-err { color: #fca5a5; }
.eri-muted { color: var(--eri-muted); }
.eri-lab__feedback:empty { display: none; }
.eri-lab__feedback { flex: 0 0 auto; max-height: 50%; overflow: auto; padding: 12px 14px; border-top: 1px solid var(--eri-line); }
.eri-lab__feedback.is-pass { background: #0e2a1a; }
.eri-lab__feedback.is-fail { background: #2a1414; }
.eri-fb__title { font-weight: 700; margin-bottom: 6px; }
.is-pass .eri-fb__title { color: #86efac; }
.is-fail .eri-fb__title { color: #fca5a5; }
.eri-lab__feedback ul { list-style: none; margin: 0; padding: 0; }
.eri-lab__feedback li { display: flex; gap: 8px; flex-wrap: wrap; padding: 3px 0; }
.eri-fb__mark { width: 1em; }
li.ok .eri-fb__mark { color: #86efac; }
li.no .eri-fb__mark { color: #fca5a5; }
.eri-fb__detail { flex-basis: 100%; margin: 4px 0 0 1.5em; padding: 8px; background: rgba(0,0,0,.3); color: var(--eri-text); border-radius: 6px; font-size: 12.5px; white-space: pre-wrap; }
.eri-fb__actions { display: flex; gap: 10px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.eri-fb__actions a:not(.eri-btn) { color: #93c5fd; }
.eri-fb__pts { color: var(--eri-gold); font-weight: 700; }
.eri-fb__lesson { color: #86efac; font-weight: 600; }
.eri-lab.is-busy .eri-lab__status::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; border: 2px solid var(--eri-muted); border-top-color: transparent; border-radius: 50%; animation: eri-spin .7s linear infinite; vertical-align: -1px; }
@keyframes eri-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .eri-lab *, .eri-toast, .eri-task__box { transition: none !important; animation: none !important; }
}

/* Lesson content blocks (used in LearnPress lessons) */
p code, li code, td code { overflow-wrap: anywhere; }
@media (max-width: 767.98px) {
  table.eri-table, .eri-board { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  pre.eri-code, pre.eri-output { font-size: 13.5px; }
}
pre.eri-code, pre.eri-output { font: 14px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; padding: 12px 14px; border-radius: 8px; overflow: auto; white-space: pre; margin: 0 0 1em; }
pre.eri-code { background: #0f1420; color: #e6e9f2; border: 0; }
pre.eri-code code { background: none; color: inherit; padding: 0; font: inherit; }
pre.eri-output { background: #f3f5f9; color: #1c2333; border-left: 4px solid #22c55e; }
p.eri-out-label { margin: -.4em 0 .3em; font-size: 13px; color: #5b6478; }
table.eri-table { width: 100%; border-collapse: collapse; margin: 0 0 1.2em; font-size: 14.5px; }
table.eri-table th, table.eri-table td { border: 1px solid #e3e8f2; padding: 8px 10px; text-align: left; vertical-align: top; }
table.eri-table th { background: #f6f8fc; }
.eri-keys { background: #eef6ff; border: 1px solid #cfe2ff; border-radius: 10px; padding: 12px 16px; margin: 1.5em 0; }
.eri-keys h3 { margin: 0 0 6px; font-size: 16px; }
.eri-keys ul { margin: 0; padding-left: 1.2em; }

/* Task checklist */
.eri-tasks { margin-top: 14px; background: #f3f6fb; border: 1px solid #e1e7f0; border-radius: 10px; padding: 10px 12px; }
.eri-tasks__title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #5b6478; margin-bottom: 6px; }
.eri-tasks__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.eri-task { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.45; }
.eri-task__box { width: 20px; height: 20px; flex: none; border: 2px solid #c8d0de; border-radius: 6px; background: #fff; margin-top: 1px; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; transition: background .2s, border-color .2s; }
.eri-task.is-ok .eri-task__box { background: #22c55e; border-color: #22c55e; }
.eri-task.is-ok .eri-task__box::after { content: "✓"; }
.eri-task.is-no .eri-task__box { border-color: #ef4444; }
.eri-task.is-ok .eri-task__text { color: #5b6478; }

/* Solution panel */
.eri-lab__out { overflow: auto; }
.eri-sol { flex: 0 0 auto; border-top: 1px solid var(--eri-line); padding: 12px 14px; display: grid; gap: 10px; background: var(--eri-panel); }
.eri-sol__head { display: flex; align-items: center; gap: 8px; }
.eri-sol__lock { margin-left: auto; font-size: 12px; color: var(--eri-muted); }
.eri-sol__open { justify-self: start; }
.eri-sol__gate { background: #3a2d12; border: 1px solid #6b5420; border-radius: 8px; padding: 10px 12px; font-size: 13.5px; }
.eri-sol__gate p { margin: 0 0 8px; color: var(--eri-text); }
.eri-sol__row { display: flex; gap: 8px; flex-wrap: wrap; }
.eri-btn--warn { background: #f59e0b; color: #1f1400 !important; }
.eri-sol__code .CodeMirror { height: auto; border-radius: 8px; font: 13.5px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; }
.eri-sol-hl { background: rgba(130, 170, 255, .22); }
.eri-sol__subtitle { font-weight: 700; font-size: 14px; margin-top: 4px; }
.eri-sol__steps { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; counter-reset: eristep; }
.eri-sol__steps li { counter-increment: eristep; position: relative; padding: 8px 10px 8px 40px; border: 1px solid var(--eri-line); border-radius: 8px; font-size: 13.5px; line-height: 1.5; color: var(--eri-text); outline: none; }
.eri-sol__steps li::before { content: counter(eristep); position: absolute; left: 10px; top: 8px; width: 22px; height: 22px; border-radius: 50%; background: #1d3b16; color: #b6f09c; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.eri-sol__steps li:hover, .eri-sol__steps li:focus { border-color: #82aaff; }
.eri-sol__steps code { background: rgba(255,255,255,.08); color: #e6e9f2; padding: 1px 5px; border-radius: 4px; }
.eri-sol__ln { display: block; margin-top: 4px; font-size: 12px; color: var(--eri-muted); }
.eri-sol__note { margin: 0; font-size: 12.5px; color: var(--eri-muted); }

/* Lesson progress strip */
.eri-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 14px; margin: 0 0 1.4em; border: 1px solid #e1e7f0; border-radius: 12px; background: #f7f9fc; font: 600 13.5px/1.3 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #1c2333; }
.eri-strip__bar { flex: 1 1 160px; height: 8px; border-radius: 99px; background: #e3e8f0; overflow: hidden; min-width: 120px; }
.eri-strip__bar span { display: block; height: 100%; background: #7fb82e; border-radius: 99px; }
.eri-strip__pct { color: #5b6478; font-weight: 500; font-variant-numeric: tabular-nums; }
.eri-strip__chip { background: #fff; border: 1px solid #e1e7f0; border-radius: 99px; padding: 3px 10px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Toast */
@media (max-width: 767.98px) {
  .eri-toast { left: 12px; right: 12px !important; bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important; max-width: none !important; }
  .eri-dash__hello { flex-wrap: wrap; }
  .eri-strip__bar { flex-basis: 100%; order: 2; }
}
.eri-toast { position: fixed; right: 20px; bottom: 20px; z-index: 99999; background: #111827; color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.35); font: 14px/1.45 system-ui, sans-serif; transform: translateY(20px); opacity: 0; transition: .3s; max-width: 320px; border-left: 4px solid var(--eri-gold); }
.eri-toast.is-in { transform: none; opacity: 1; }

/* Dashboard */
.eri-dash { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.eri-dash__hello { display: flex; gap: 16px; align-items: center; padding: 20px; border-radius: 14px; background: linear-gradient(135deg, #1e3a8a, #0f766e); color: #fff; }
.eri-dash__hello h2 { margin: 0 0 4px; color: #fff; font-size: 22px; }
.eri-dash__hello p { margin: 0 0 8px; opacity: .9; }
.eri-dash__hello > div { flex: 1; }
.eri-dash__hello img { border-radius: 50%; }
.eri-bar { height: 8px; background: rgba(127,127,127,.25); border-radius: 99px; overflow: hidden; margin: 4px 0; }
.eri-bar span { display: block; height: 100%; background: var(--eri-gold); border-radius: 99px; }
.eri-dash__stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 16px 0 8px; }
.eri-stat { background: #f6f8fc; border: 1px solid #e3e8f2; border-radius: 12px; padding: 14px; text-align: center; }
.eri-stat b { display: block; font-size: 24px; color: #0f172a; }
.eri-stat span { font-size: 13px; color: #5b6478; }
.eri-badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.eri-badge { border: 1px solid #e3e8f2; border-radius: 12px; padding: 12px; text-align: center; filter: grayscale(1); opacity: .45; }
.eri-badge.is-earned { filter: none; opacity: 1; background: #fffbea; border-color: #f5d76e; }
.eri-badge__icon { display: block; font-size: 30px; }
.eri-badge__name { display: block; font-weight: 700; font-size: 13.5px; }
.eri-badge small { color: #5b6478; font-size: 12px; }
.eri-history { list-style: none; padding: 0; }
.eri-history li { display: flex; justify-content: space-between; border-bottom: 1px solid #eef1f6; padding: 8px 0; }
.eri-history small { color: #5b6478; }
.eri-card { padding: 16px; border: 1px solid #e3e8f2; border-radius: 12px; }

/* Leaderboard */
.eri-board { width: 100%; border-collapse: collapse; font-family: system-ui, sans-serif; }
.eri-board th, .eri-board td { padding: 10px 12px; border-bottom: 1px solid #eef1f6; text-align: left; }
.eri-board th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: #5b6478; }
.eri-board tr.is-me td { background: #eef5ff; font-weight: 600; }

/* Track */
.eri-track ol { list-style: none; padding: 0; margin: 12px 0; }
.eri-track li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid #e3e8f2; border-radius: 10px; margin-bottom: 8px; }
.eri-track li a { flex: 1; font-weight: 600; text-decoration: none; }
.eri-track__dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #eef1f7; font-weight: 700; font-size: 13px; flex: none; }
.eri-track li.is-done .eri-track__dot { background: #22c55e; color: #fff; }
.eri-track__progress { font-weight: 600; }

/* ---- v0.5: exams, locks, course progress ---- */
.eri-lab__tag--exam { background: #e0e7ff; color: #3730a3; }
.eri-fb__score { font-weight: 700; color: var(--eri-gold); }
.eri-exam, .eri-lock, .eri-course { --eri-go: #16a34a; --eri-line: #e3e7ee; --eri-muted: #5b6474; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.eri-exam { border: 1px solid var(--eri-line); border-radius: 12px; padding: 14px 16px; margin: 1.2em 0; background: #f8fafc; }
.eri-exam__top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.eri-exam__pct { font: 800 24px/1 system-ui, sans-serif; color: #1e293b; }
.eri-exam__bar { position: relative; height: 10px; border-radius: 6px; background: #e2e8f0; margin: 10px 0 6px; overflow: visible; }
.eri-exam__bar > span { display: block; height: 100%; border-radius: 6px; background: #3b82f6; transition: width .4s; }
.eri-exam__bar > i { position: absolute; top: -4px; bottom: -4px; width: 2px; background: #0f172a; }
.eri-exam__state { font-size: 13px; color: var(--eri-muted); }
.eri-exam.is-pass { background: #f0fdf4; border-color: #bbf7d0; }
.eri-exam.is-pass .eri-exam__bar > span { background: var(--eri-go); }
.eri-exam.is-pass .eri-exam__state { color: #166534; font-weight: 600; }
.eri-lock { border: 1px solid #fde68a; background: #fffbeb; border-radius: 12px; padding: 18px 20px; margin: 1em 0; }
.eri-lock h3 { margin: 0 0 6px; font-size: 18px; }
.eri-lock p { margin: 0 0 12px; }
.eri-lock .eri-btn, .eri-course .eri-btn { --eri-accent: #2563eb; }
.eri-course { border: 1px solid var(--eri-line); border-radius: 12px; padding: 16px; margin: 0 0 16px; background: #fff; color: #1e293b; }
.eri-course__head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; }
.eri-course__head h4 { margin: 0; font-size: 17px; }
.eri-course__status { font: 700 12px/1 system-ui, sans-serif; padding: 6px 9px; border-radius: 99px; background: #e2e8f0; color: #334155; white-space: nowrap; }
.eri-course__status.is-done { background: #dcfce7; color: #166534; }
.eri-course__status.is-locked { background: #fef3c7; color: #92400e; }
.eri-course__status.is-active { background: #dbeafe; color: #1e40af; }
.eri-course .eri-bar { margin: 10px 0; }
.eri-course__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin: 10px 0; }
.eri-course__grid div { background: #f8fafc; border-radius: 8px; padding: 8px 10px; }
.eri-course__grid b { display: block; font-size: 18px; }
.eri-course__grid span { font-size: 12px; color: var(--eri-muted); }
.eri-course__actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.eri-course details { margin-top: 10px; }
.eri-course summary { cursor: pointer; font-weight: 600; min-height: 32px; display: flex; align-items: center; }
.eri-course__lessons { list-style: none; margin: 6px 0 0; padding: 0; }
.eri-course__lessons li { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px solid #f1f5f9; font-size: 14px; }
.eri-course__lessons li small { margin-left: auto; color: var(--eri-muted); white-space: nowrap; }
.eri-course__lessons .is-locked { color: #94a3b8; }

/* ---- v0.6: quizzes (light card inside the lesson) ---- */
.eri-quiz { --eri-line: #e2e8f0; --eri-muted: #5b6474; --eri-accent: #2563eb; --eri-go: #16a34a; --eri-gold: #b45309; border: 1px solid var(--eri-line); border-radius: 12px; padding: 18px; margin: 1.5em 0; background: #fff; color: #1e293b; font: 15.5px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.eri-quiz--challenge { border-color: #fcd34d; background: #fffdf5; }
.eri-quiz--exam { border-color: #c7d2fe; }
.eri-quiz .eri-lab__instructions { margin-bottom: 8px; }
.eri-q { border: 1px solid var(--eri-line); border-radius: 10px; padding: 12px 14px 10px; margin: 0 0 12px; min-width: 0; }
.eri-q legend { display: flex; gap: 10px; align-items: flex-start; padding: 0 4px; font-weight: 600; float: left; width: 100%; margin-bottom: 8px; }
.eri-q legend + * { clear: both; }
.eri-q__n { flex: 0 0 auto; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #e0e7ff; color: #3730a3; font-size: 13px; }
.eri-q__text { flex: 1; min-width: 0; }
.eri-q__opt { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border: 1px solid var(--eri-line); border-radius: 8px; margin: 6px 0; cursor: pointer; min-height: 44px; clear: both; }
.eri-q__opt:hover { border-color: #93c5fd; background: #f8fbff; }
.eri-q__opt input { margin-top: 4px; width: 18px; height: 18px; flex: 0 0 auto; accent-color: #2563eb; }
.eri-q__opt:has(input:checked) { border-color: #2563eb; background: #eff6ff; }
.eri-q__opt:has(input:focus-visible) { outline: 3px solid #93c5fd; outline-offset: 2px; }
.eri-q__fb:empty { display: none; }
.eri-q__fb { margin-top: 6px; font-size: 14px; font-weight: 600; }
.eri-q.is-ok { border-color: #86efac; background: #f6fef9; }
.eri-q.is-ok .eri-q__fb { color: #166534; }
.eri-q.is-no { border-color: #fca5a5; background: #fffafa; }
.eri-q.is-no .eri-q__fb { color: #b91c1c; }
.eri-quiz__bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-top: 6px; }
.eri-quiz__count { font-size: 13px; color: var(--eri-muted); }
.eri-quiz .eri-btn { min-height: 44px; padding: 10px 16px; font-size: 14px; }
.eri-quiz .eri-quiz__result { max-height: none; border: 1px solid var(--eri-line); border-radius: 10px; margin-top: 12px; color: #1e293b; }
.eri-quiz .eri-quiz__result.is-pass { background: #f0fdf4; border-color: #bbf7d0; }
.eri-quiz .eri-quiz__result.is-fail { background: #fef2f2; border-color: #fecaca; }
.eri-quiz .is-pass .eri-fb__title { color: #166534; }
.eri-quiz .is-fail .eri-fb__title { color: #b91c1c; }
.eri-quiz .eri-fb__lesson { color: #166534; }
.eri-quiz .eri-fb__pts, .eri-quiz .eri-fb__score { color: #b45309; }
.eri-quiz .eri-sol { margin-top: 14px; border: 1px dashed #cbd5e1; border-radius: 10px; padding: 12px 14px; background: #f8fafc; color: #1e293b; }
.eri-quiz .eri-sol__head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.eri-quiz .eri-sol__lock { font-size: 13px; color: var(--eri-muted); }
.eri-quiz .eri-btn--ghost { background: #fff; border-color: #cbd5e1; color: #1e293b !important; }
.eri-quiz .eri-btn:disabled { opacity: .55; cursor: not-allowed; }
.eri-sol__answers { margin: 8px 0 0; padding-left: 1.3em; }
.eri-sol__a { margin-bottom: 12px; }
.eri-sol__q { font-weight: 600; }
.eri-sol__right { color: #166534; font-weight: 600; margin: 2px 0; }
.eri-sol__why { color: #334155; font-size: 14.5px; }
/* Scratch blocks in lessons */
pre.blocks { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px; overflow-x: auto; white-space: pre; font-size: 14px; }
.scratchblocks { max-width: 100%; overflow-x: auto; }
.eri-scratch-try { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; border: 1px solid #fde68a; background: #fffbeb; border-radius: 10px; padding: 12px 14px; margin: 1em 0; }
.eri-scratch-try a { font-weight: 700; }

/* Lesson figures ([eri_fig]) */
.eri-fig { margin: 1.4em 0 1.6em; text-align: center; }
.eri-fig p { margin: 0; }
.eri-fig__img { display: inline-block; max-width: 100%; cursor: zoom-in; }
.eri-fig img { display: block; max-width: 100%; height: auto; margin: 0 auto; border: 1px solid #e5e7eb; border-radius: 12px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.eri-fig figcaption { margin-top: .6em; font-size: .92em; color: #4b5563; line-height: 1.45; max-width: 760px; margin-left: auto; margin-right: auto; }
.eri-fig figcaption strong { color: #111827; }
