/* TECH HEAVEN: course player. Loaded only on the learning page. */

.page-learn { padding-bottom: 0; background: var(--surface); --bar: 64px; }

/* ---------- top bar ---------- */
.learn-bar {
  position: sticky; top: 0; z-index: 40; height: var(--bar);
  display: flex; align-items: center; gap: .75rem; padding: 0 var(--gut);
  background: var(--ink); color: var(--ink-text); border-bottom: 3px solid var(--red);
}
.learn-brand { display: flex; flex: none; }
.learn-brand .brand-mark { width: 34px; height: 34px; }
.learn-course { flex: 1; min-width: 0; display: grid; grid-template-columns: 1fr; gap: .2rem; }
.learn-course-title { color: #fff; font-weight: 700; font-size: .9375rem; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.learn-course-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.progress { height: 6px; background: var(--ink-line); border-radius: 99px; overflow: hidden; max-width: 420px; }
.progress-fill { display: block; height: 100%; width: 0; background: var(--teal-on-ink); border-radius: 99px; transition: width .4s ease; }
.progress-text { font-size: .75rem; color: var(--ink-muted); }
.learn-points, .learn-menu {
  display: inline-flex; align-items: center; gap: .4rem; min-height: 40px; padding: .4rem .75rem;
  background: var(--ink-2); color: #fff; border: 1px solid var(--ink-line); border-radius: var(--r-sm); font-weight: 600; font-size: .875rem; cursor: pointer;
}
.learn-points .ic { color: var(--red-on-ink); }
.learn-points:hover, .learn-menu:hover { background: var(--ink-hover); }
.learn-account { display: inline-flex; align-items: center; gap: .4rem; min-height: 40px; padding: .4rem .75rem; border-radius: var(--r-sm); background: var(--ink-2); border: 1px solid var(--ink-line); color: #fff; font-weight: 600; font-size: .875rem; text-decoration: none; white-space: nowrap; max-width: 9.5rem; }
.learn-account span { overflow: hidden; text-overflow: ellipsis; }
.learn-account .ic { color: var(--teal-on-ink); }
.learn-account:hover { background: var(--ink-hover); }
@media (max-width: 479.98px) { .learn-points span, .learn-account span { display: none; } .progress-text { display: none; } .learn-bar { gap: .5rem; } }
@media (min-width: 1024px) { .learn-menu { display: none; } }

/* ---------- layout ---------- */
.learn-layout { display: grid; grid-template-columns: minmax(0, 1fr); min-height: calc(100vh - var(--bar)); }
@media (min-width: 1024px) { .learn-layout { grid-template-columns: 320px minmax(0, 1fr); } }

.outline { background: var(--bg); border-right: 1px solid var(--line); padding: 1rem 0 2rem; overflow-y: auto; }
@media (min-width: 1024px) { .outline { position: sticky; top: var(--bar); height: calc(100vh - var(--bar)); } }
@media (max-width: 1023.98px) {
  .outline { position: fixed; inset: var(--bar) auto 0 0; width: min(340px, 88vw); z-index: 35; transform: translateX(-102%); transition: transform .25s ease; box-shadow: var(--sh-3); visibility: hidden; }
  .outline-open .outline { transform: none; visibility: visible; }
  .outline-open::after { content: ""; position: fixed; inset: var(--bar) 0 0 0; background: rgba(15, 23, 42, .45); z-index: 30; }
}
.outline-loading { padding: 1rem 1.25rem; color: var(--muted); }
.ol-module { padding: .5rem 0; }
.ol-title { font-size: .8125rem; font-weight: 700; color: var(--muted); padding: .5rem 1.25rem; letter-spacing: 0; }
.ol-lesson { display: flex; gap: .65rem; align-items: flex-start; padding: .6rem 1.25rem; text-decoration: none; color: var(--text-2); font-size: .9375rem; line-height: 1.4; border-left: 3px solid transparent; }
.ol-lesson:hover { background: var(--well); color: var(--text); }
.ol-lesson[aria-current="page"] { background: var(--surface); color: var(--text); font-weight: 700; border-left-color: var(--red); }
.ol-state { flex: none; width: 18px; height: 18px; margin-top: .1rem; display: grid; place-items: center; }
.ol-state .ic { width: 18px; height: 18px; color: var(--teal); }
.ol-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line-strong); display: inline-block; }
.ol-tag { display: inline-block; margin-left: .4rem; font-size: .6875rem; font-weight: 700; background: var(--red-tint); color: var(--red-dark); border-radius: 4px; padding: .05rem .35rem; vertical-align: 1px; }
.ol-lesson.is-done .ol-name { color: var(--muted); }
.ol-locked { display: flex; gap: .65rem; align-items: flex-start; padding: .7rem 1.25rem; text-decoration: none; color: var(--muted); font-size: .875rem; line-height: 1.4; }
.ol-locked:hover { background: var(--well); }
.ol-locked .ic { width: 16px; height: 16px; margin-top: .15rem; }
.ol-locked strong { display: block; color: var(--text-2); font-weight: 600; }
.ol-foot { display: grid; gap: .75rem; padding: 1.25rem; border-top: 1px solid var(--line); margin-top: .75rem; }
.ol-foot .text-link { justify-self: start; }

/* ---------- lesson ---------- */
.lesson { outline: none; min-width: 0; }
.prose, .widget, .fig { max-width: 100%; overflow-wrap: break-word; }
.lesson-inner { max-width: 780px; margin: 0 auto; padding: clamp(1.5rem, 4vw, 3rem) var(--gut) 3rem; }
.lesson-kicker { font-size: .875rem; font-weight: 600; color: var(--muted); margin-bottom: .5rem; white-space: pre-wrap; }
.lesson-head h1 { font-size: clamp(1.75rem, 1.3rem + 1.8vw, 2.375rem); margin-bottom: .6rem; }
.lesson-meta { display: inline-flex; align-items: center; gap: .4rem; font-size: .875rem; color: var(--muted); }
.lesson-meta .ic { width: 16px; height: 16px; }
.lesson-head { margin-bottom: 1.75rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--line); }

.objectives { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-md); padding: 1.1rem 1.25rem; margin-bottom: 1.75rem; }
.objectives h2 { font-size: 1rem; margin-bottom: .6rem; }

.prose { font-size: 1.0625rem; line-height: 1.7; color: var(--text-2); }
.prose > * + * { margin-top: 1rem; }
.prose h2 { font-size: 1.3125rem; color: var(--text); margin-top: 2.25rem; }
.prose .lead { font-size: 1.1875rem; color: var(--text); max-width: none; }
.prose ul { list-style: disc; padding-left: 1.4rem; }
.prose ol { list-style: decimal; padding-left: 1.4rem; }
.prose li + li { margin-top: .4rem; }
.prose a { color: var(--teal-dark); font-weight: 600; text-underline-offset: 3px; }
.prose strong { color: var(--text); }
.prose code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; background: var(--well); border: 1px solid var(--line); border-radius: 5px; padding: .05rem .35rem; color: var(--text); }
kbd { display: inline-block; min-width: 1.6em; text-align: center; font-family: inherit; font-size: .85em; font-weight: 700; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-bottom-width: 3px; border-radius: 6px; padding: .05rem .4rem; line-height: 1.5; }
.prose .callout { background: var(--amber-tint); border: 1px solid var(--amber-line); color: #713F12; border-radius: var(--r-md); padding: 1rem 1.15rem; font-size: 1rem; }
.prose .callout strong { color: inherit; }
.prose .muted { color: var(--muted); font-size: .9375rem; }
.prose ol.steps, .prose ol.rhythm, .prose ol.rules { list-style: none; padding: 0; counter-reset: st; }
.prose ol.steps li, .prose ol.rhythm li, .prose ol.rules li { counter-increment: st; position: relative; padding-left: 2.5rem; }
.prose ol.steps li::before, .prose ol.rhythm li::before, .prose ol.rules li::before { content: counter(st); position: absolute; left: 0; top: .15rem; display: grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--ink); color: #fff; font-weight: 700; font-size: .8125rem; }
.prose ol.rhythm li::before { background: var(--red); }
.prose dl.terms { display: grid; gap: .25rem; }
.prose dl.terms dt { font-weight: 700; color: var(--text); margin-top: .85rem; }
.prose dl.terms dd { margin: 0; }
.prose table.simple, .widget table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.prose table.simple th, .prose table.simple td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose table.simple th { background: var(--well); color: var(--text); font-weight: 700; }
.prose .num { text-align: right !important; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--r-sm); }
.table-wrap table.simple th, .table-wrap table.simple td { white-space: nowrap; }
.prose blockquote.memo { margin: 0; background: var(--ink); color: var(--ink-text); border-radius: var(--r-md); padding: 1.1rem 1.25rem; border-left: 4px solid var(--red); }
.prose blockquote.memo strong { color: #fff; }
.prose blockquote.memo p + p { margin-top: .4rem; font-size: 1.125rem; color: #fff; }
.prose .shortcut { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; border: 1px dashed var(--line-strong); border-radius: var(--r-md); padding: .9rem 1.1rem; }
.prose .shortcut-label { font-size: .8125rem; font-weight: 700; color: var(--red-dark); }
.fig { margin: 1.5rem 0; }
.fig svg { width: 100%; height: auto; display: block; }
.fig figcaption { margin-top: .6rem; font-size: .875rem; color: var(--muted); line-height: 1.5; }
.dl-list { display: grid; gap: .6rem; }
.prose a.dl { display: flex; flex-direction: column; gap: .15rem; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--teal); border-radius: var(--r-sm); padding: .8rem 1rem; color: var(--text); }
.prose a.dl:hover { border-color: var(--line-strong); box-shadow: var(--sh-2); }
.dl-name { font-weight: 700; }
.dl-name::before { content: "↓ "; color: var(--teal-dark); }
.dl-meta { font-size: .875rem; color: var(--muted); font-weight: 500; }

/* ---------- video ---------- */
.video { position: relative; aspect-ratio: 16 / 9; background: var(--ink); border-radius: var(--r-md); overflow: hidden; margin-bottom: 1.75rem; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-btn { position: absolute; inset: 0; width: 100%; padding: 0; border: 0; background: var(--ink); cursor: pointer; }
.video-btn img { width: 100%; height: 100%; object-fit: cover; opacity: .85; }
.video-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: var(--red); color: #fff; box-shadow: var(--sh-3); }
.video-play .ic { width: 34px; height: 34px; stroke-width: 1.6; }
.video-btn:hover .video-play { background: var(--red-dark); }
.recording-box { margin-top: 2.5rem; }
.recording-box h2 { font-size: 1.125rem; margin-bottom: 1rem; }

/* ---------- widgets ---------- */
.widget { margin: 1.25rem 0; font-size: 1rem; }
.widget-msg { margin-top: .75rem; font-size: .9375rem; color: var(--teal-dark); font-weight: 600; }
.widget-msg:empty { display: none; }

.track-pick { display: grid; gap: .75rem; }
@media (min-width: 640px) { .track-pick { grid-template-columns: 1fr 1fr; } }
.track-card { position: relative; display: block; cursor: pointer; }
.track-card input { position: absolute; opacity: 0; inset: 0; }
.track-card-body { display: grid; gap: .25rem; height: 100%; padding: 1rem 1.1rem; border: 1.5px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); }
.track-card-body strong { color: var(--text); font-size: 1.0625rem; }
.track-card-body span { font-size: .875rem; color: var(--text-2); line-height: 1.45; }
.track-card .track-need { color: var(--muted); }
.track-card input:checked + .track-card-body { border-color: var(--teal); background: #F0FDFA; box-shadow: inset 0 0 0 1px var(--teal); }
.track-card input:focus-visible + .track-card-body { outline: 3px solid var(--teal); outline-offset: 2px; }

.placement { list-style: none !important; padding: 0 !important; display: grid; gap: .9rem; }
.placement li { display: grid; gap: .5rem; }
@media (min-width: 640px) { .placement li { grid-template-columns: 1fr auto; align-items: center; } }
.placement p { color: var(--text); font-weight: 600; font-size: .9375rem; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: block; padding: .5rem .8rem; font-size: .875rem; font-weight: 600; cursor: pointer; border-left: 1px solid var(--line); }
.seg label:first-child span { border-left: 0; }
.seg input:checked + span { background: var(--ink); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid var(--teal); outline-offset: -3px; }

.practice { display: grid; gap: 1.25rem; }
.pr-text { font-weight: 600; color: var(--text); margin-bottom: .5rem; }
.quiz-options { display: grid; gap: .5rem; }
.pr-opt { text-align: left; min-height: 44px; padding: .6rem .9rem; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; font-size: .9375rem; }
.pr-opt:hover { background: var(--bg); }
.pr-opt.is-right { border-color: var(--teal); background: #F0FDFA; font-weight: 700; }
.pr-opt.is-wrong { border-color: #FCA5A5; background: var(--red-tint); }
.quiz-feedback { font-size: .9375rem; color: var(--text-2); margin-top: .5rem; }
.quiz-feedback:empty { display: none; }

.checklist { list-style: none !important; padding: 0 !important; display: grid; gap: .5rem; }
.checklist li + li { margin-top: 0 !important; }
.checklist label { display: flex; gap: .75rem; align-items: flex-start; padding: .65rem .85rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; line-height: 1.5; }
.checklist input { width: 20px; height: 20px; margin-top: .15rem; flex: none; accent-color: var(--teal); }
.checklist label:has(input:checked) { background: #F0FDFA; border-color: var(--teal-line); }
.checklist label:has(input:checked) > span { color: var(--muted); }

.quickwin { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.qw-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; padding: .6rem .75rem; background: var(--well); border-bottom: 1px solid var(--line); }
.qw-label { font-size: .8125rem; font-weight: 600; color: var(--muted); }
.qw-group { display: flex; gap: .35rem; }
.qw-btn { min-width: 44px; min-height: 40px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 6px; font-weight: 700; cursor: pointer; }
.qw-swatch { width: 32px; height: 32px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line-strong); background: var(--sw); cursor: pointer; }
.qw-text { width: 100%; border: 0; padding: 1rem; resize: vertical; min-height: 120px; font: inherit; line-height: 1.5; }
.qw-text:focus { outline: none; box-shadow: inset 0 0 0 2px var(--teal); }

/* mouse lab */
.lab-tasks { list-style: none !important; padding: 0 !important; display: grid; gap: .35rem; margin-bottom: 1rem; font-size: .9375rem; }
.lab-tasks li { display: flex; gap: .5rem; align-items: center; margin: 0 !important; }
.lab-tasks .ic { width: 18px; height: 18px; color: var(--teal); }
.lab-tasks li.is-done span { color: var(--muted); text-decoration: line-through; }
.lab-grid { display: grid; gap: .75rem; }
@media (min-width: 640px) { .lab-grid { grid-template-columns: 1fr 1fr; } .lab-wide { grid-column: 1 / -1; } }
.lab-cell { border: 1px solid var(--line); border-radius: var(--r-md); padding: .9rem; background: var(--surface); }
.lab-cell h3 { font-size: .9375rem; margin-bottom: .6rem; color: var(--text); }
.lab-arena { position: relative; height: 180px; background: var(--well); border-radius: var(--r-sm); overflow: hidden; }
.lab-target { position: absolute; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--red); color: #fff; font-weight: 800; cursor: pointer; box-shadow: 0 0 0 6px rgba(200, 16, 46, .18); transition: left .2s ease, top .2s ease; }
.lab-target:disabled { background: var(--teal); box-shadow: none; }
.lab-icon { display: inline-flex; flex-direction: column; align-items: center; gap: .25rem; padding: .6rem .9rem; border: 1px solid transparent; border-radius: var(--r-sm); background: none; cursor: default; font: inherit; user-select: none; }
.lab-icon.is-selected { background: #DBEAFE; border-color: #93C5FD; }
.lab-big { width: 40px !important; height: 40px !important; color: var(--amber-text); }
.lab-note { font-size: .8125rem; color: var(--muted); margin-top: .4rem; }
.lab-rel { position: relative; display: inline-block; }
.lab-menu { position: absolute; left: 70%; top: 40%; z-index: 5; list-style: none !important; padding: .3rem !important; margin: 0; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm); box-shadow: var(--sh-2); min-width: 140px; }
.lab-menu li { margin: 0 !important; }
.lab-menu button { display: block; width: 100%; text-align: left; padding: .45rem .7rem; border: 0; background: none; border-radius: 6px; cursor: pointer; font-size: .9375rem; }
.lab-menu button:hover, .lab-menu button:focus { background: var(--well); outline: none; }
.lab-drag { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 110px; }
.lab-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .5rem .75rem; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm); font-weight: 600; cursor: grab; touch-action: none; user-select: none; position: relative; z-index: 2; }
.lab-chip.is-dragging { cursor: grabbing; box-shadow: var(--sh-2); }
.lab-drop { display: flex; flex-direction: column; align-items: center; gap: .2rem; padding: .75rem; border: 2px dashed var(--line-strong); border-radius: var(--r-md); font-size: .875rem; font-weight: 600; min-width: 120px; }
.lab-drop.is-full { border-style: solid; border-color: var(--teal); background: #F0FDFA; }
.lab-scroll { height: 120px; overflow-y: auto; background: var(--well); border-radius: var(--r-sm); padding: .75rem; font-size: .875rem; }
.lab-spacer { height: 160px; }
.lab-star { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--amber-tint); color: var(--amber-text); cursor: pointer; }
.lab-star.is-found { background: var(--teal); color: #fff; }

/* typing test */
.tt-passage { font-size: 1.125rem; line-height: 1.8; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-md); padding: 1rem 1.1rem; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.tt-passage .ok { color: var(--text); }
.tt-passage .bad { color: #fff; background: var(--red); border-radius: 2px; }
.tt-passage .cur { box-shadow: inset 0 -2px 0 var(--teal); color: var(--text); }
.tt-input { width: 100%; margin-top: .75rem; padding: .8rem 1rem; font-size: 1.0625rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; border: 1px solid var(--line-strong); border-radius: var(--r-sm); resize: vertical; }
.tt-input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(13, 148, 136, .18); }
.tt-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; margin-top: .6rem; }
.tt-live { font-size: .875rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.tt-result:empty { display: none; }
.tt-result { margin-top: 1rem; background: var(--ink); color: var(--ink-text); border-radius: var(--r-md); padding: 1.1rem 1.25rem; }
.tt-result p + p { margin-top: .3rem; }
.tt-score { font-size: 1rem; color: #fff; }
.tt-score strong { font-size: 2.25rem; font-weight: 800; color: #fff; margin-right: .25rem; }

/* stopwatch & compare */
.sw-row { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; padding: .75rem 1rem; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg); }
.sw-label { font-weight: 600; font-size: .9375rem; color: var(--text); margin-right: auto; }
.sw-face { font-size: 1.75rem; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 4ch; color: var(--text); }
.compare { border: 1px solid var(--line); border-radius: var(--r-md); padding: .75rem 1rem; }
.cmp-row { display: flex; justify-content: space-between; padding: .4rem 0; border-bottom: 1px solid var(--well); }
.cmp-row strong { font-variant-numeric: tabular-nums; }
.cmp-row.is-win strong { color: var(--teal-dark); }
.cmp-x { margin-top: .5rem; font-weight: 700; color: var(--text); }

/* mission & reflection */
.mission-mine { background: var(--ink); color: var(--ink-text); border-radius: var(--r-md); padding: 1.1rem 1.25rem; margin-top: .75rem; border-left: 4px solid var(--red); }
.mission-track { font-size: .8125rem; font-weight: 700; color: var(--red-on-ink); }
.mission-task { color: #fff; font-size: 1.0625rem; margin-top: .25rem; }
.mission-others { margin-top: .75rem; }
.mission-others summary { cursor: pointer; font-weight: 600; color: var(--text); }
.mission-others dl { margin-top: .5rem; display: grid; gap: .5rem; }
.mission-others dt { font-weight: 700; color: var(--text); font-size: .9375rem; }
.mission-others dd { margin: 0; font-size: .9375rem; }
.mission-note { display: flex; gap: .4rem; align-items: flex-start; margin-top: .75rem; font-size: .9375rem; color: var(--muted); }
.mission-note .ic { width: 16px; height: 16px; margin-top: .2rem; }
.reflection label { font-weight: 700; color: var(--text); }
.reflection textarea { width: 100%; }

/* quiz */
.quiz { display: grid; gap: 1.25rem; }
.quiz-intro { color: var(--text-2); }
.quiz-q { border: 1px solid var(--line); border-radius: var(--r-md); padding: 1rem 1.1rem 1.1rem; margin: 0; }
.quiz-q legend { display: flex; gap: .6rem; align-items: baseline; font-weight: 700; color: var(--text); padding: 0 .25rem; font-size: 1.0625rem; line-height: 1.4; }
.quiz-n { display: inline-grid; place-items: center; flex: none; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--ink); color: #fff; font-size: .8125rem; }
.quiz-opt { display: flex; gap: .65rem; align-items: center; min-height: 44px; padding: .5rem .85rem; border: 1px solid var(--line-strong); border-radius: var(--r-sm); cursor: pointer; }
.quiz-opt input { width: 18px; height: 18px; accent-color: var(--teal); flex: none; }
.quiz-opt:has(input:checked) { border-color: var(--teal); background: #F0FDFA; }
.quiz-q .quiz-options { margin-top: .75rem; }
.quiz-q.is-right { border-color: var(--teal-line); background: #F0FDFA; }
.quiz-q.is-wrong { border-color: var(--red-line); background: #FFF7F8; }
.quiz-result:empty { display: none; }
.quiz-result { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; border-radius: var(--r-md); padding: 1rem 1.15rem; font-size: 1rem; }
.quiz-result.is-pass { background: var(--teal); color: #fff; }
.quiz-result.is-fail, .quiz-result.is-error { background: var(--red-tint); color: #9F1239; border: 1px solid var(--red-line); }
.quiz .btn-lg { justify-self: start; }

/* lesson footer, locked and finish panels */
.lesson-foot { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .75rem; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.lesson-foot > :nth-child(2) { justify-self: center; text-align: center; }
.foot-done { display: inline-flex; gap: .4rem; align-items: center; color: var(--teal-dark); font-weight: 700; }
.foot-note { font-size: .875rem; color: var(--muted); }
@media (max-width: 599.98px) {
  .lesson-foot { grid-template-columns: 1fr 1fr; }
  .lesson-foot > :nth-child(2) { grid-column: 1 / -1; grid-row: 1; justify-self: stretch; }
  .lesson-foot > :nth-child(2).btn { width: 100%; }
  .lesson-foot > a:last-child { justify-self: end; }
}
.locked-panel, .finish { text-align: left; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.75rem; display: grid; gap: .85rem; justify-items: start; }
.finish { margin-top: 2rem; background: var(--ink); color: var(--ink-text); border-color: var(--ink); }
.finish h2 { color: #fff; }
.locked-ic, .finish-ic { width: 36px !important; height: 36px !important; color: var(--red); }
.finish .btn-outline { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .35); }

/* toast & badges */
.toast { position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); z-index: 70; display: flex; gap: .6rem; align-items: center; max-width: calc(100vw - 2rem); background: var(--ink); color: #fff; border-radius: var(--r-md); padding: .85rem 1.1rem; box-shadow: var(--sh-3); font-weight: 600; border-left: 4px solid var(--red); }
.toast .ic { color: var(--red-on-ink); }
.toast.is-in { animation: toast-in .35s cubic-bezier(.2, .7, .2, 1); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
.badges-total { font-size: 1rem; margin-bottom: 1rem; }
.badges-total strong { font-size: 2rem; font-weight: 800; }
.badge-list { display: grid; gap: .5rem; margin-bottom: 1rem; }
.badge-list li { display: grid; grid-template-columns: 40px 1fr auto; gap: .75rem; align-items: center; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--muted); }
.badge-list li strong { display: block; color: var(--text-2); }
.badge-list li span span { font-size: .8125rem; }
.badge-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--well); }
.badge-list li.is-earned { border-color: var(--red-line); background: #FFF7F8; }
.badge-list li.is-earned .badge-ic { background: var(--red); color: #fff; }
.badge-list li.is-earned strong { color: var(--text); }
.badge-pts { font-weight: 800; color: var(--text); }
.muted { color: var(--muted); font-size: .875rem; }

@media print { .learn-bar, .outline, .lesson-foot, .toast { display: none !important; } }

/* ---------- prompts (AI for Beginners) ---------- */
.prompt-box { display: grid; grid-template-columns: 1fr auto; gap: .25rem 1rem; align-items: center; border: 1px solid var(--line); border-left: 4px solid var(--teal); border-radius: var(--r-sm); padding: .8rem 1rem; background: var(--surface); }
.prose .prompt-box + .prompt-box { margin-top: .6rem; }
.prompt-label { grid-column: 1 / -1; font-size: .8125rem; font-weight: 700; color: var(--teal-dark); }
.prompt-text { color: var(--text); font-size: 1rem; line-height: 1.5; }
.chip-prompts { display: grid; gap: .5rem; }
@media (min-width: 640px) { .chip-prompts { grid-template-columns: 1fr 1fr; } .chip-prompts .prompt-box + .prompt-box { margin-top: 0; } }
.two-lists { display: grid; gap: 1rem; }
@media (min-width: 640px) { .two-lists { grid-template-columns: 1fr 1fr; } }
.two-lists > div { border: 1px solid var(--line); border-radius: var(--r-md); padding: 1rem 1.1rem; }
.two-lists h3 { font-size: 1rem; color: var(--text); margin-bottom: .4rem; }
.two-lists ul { font-size: .9375rem; }
.compare-prompts { display: grid; gap: .75rem; }
@media (min-width: 640px) { .compare-prompts { grid-template-columns: 1fr 1fr; } }
.compare-prompts > div { border-radius: var(--r-md); padding: 1rem 1.1rem; font-size: .9375rem; }
.cp-weak { background: var(--red-tint); border: 1px solid var(--red-line); }
.cp-strong { background: #F0FDFA; border: 1px solid var(--teal-line); }
.cp-tag { font-size: .8125rem; font-weight: 700; color: var(--text); margin-bottom: .3rem; }
.craft { display: grid; gap: 1rem; }
@media (min-width: 900px) { .craft { grid-template-columns: 1fr 1fr; align-items: start; } }
.craft-fields { display: grid; gap: .75rem; }
.craft-field label { display: flex; gap: .65rem; align-items: center; margin-bottom: .35rem; }
.craft-letter { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--ink); color: var(--red-on-ink); font-weight: 800; flex: none; }
.craft-field label span span { display: block; font-size: .8125rem; color: var(--muted); }
.craft-field strong { color: var(--text); font-size: .9375rem; }
.craft-field textarea { width: 100%; padding: .6rem .75rem; border: 1px solid var(--line-strong); border-radius: var(--r-sm); font: inherit; font-size: .9375rem; resize: vertical; }
.craft-field textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(13, 148, 136, .18); }
.craft-result { background: var(--ink); color: var(--ink-text); border-radius: var(--r-md); padding: 1.1rem 1.25rem; display: grid; gap: .75rem; }
@media (min-width: 900px) { .craft-result { position: sticky; top: calc(var(--bar) + 1rem); } }
.craft-result-h { font-size: .8125rem; font-weight: 700; color: var(--red-on-ink); }
.craft-out { color: #fff; font-size: 1.0625rem; line-height: 1.6; }
.craft-out.is-empty { color: var(--ink-muted); font-style: italic; }
.craft-tweak { color: var(--ink-muted); font-size: .9375rem; }
.craft-tweak:empty { display: none; }
.craft-result .btn-outline { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .35); }
.next-q { font-weight: 700; color: var(--text); margin-bottom: .6rem; }
.next-step .seg { flex-wrap: wrap; }
.next-result:empty { display: none; }
.next-result { margin-top: 1rem; border: 1px solid var(--line); border-left: 4px solid var(--red); border-radius: var(--r-md); padding: 1rem 1.25rem; display: grid; gap: .5rem; justify-items: start; }
.next-label { font-size: .8125rem; font-weight: 700; color: var(--red-dark); }
.next-result h3 { font-size: 1.1875rem; color: var(--text); }

/* ---------- v1.3: generated lessons, uploads, certificate ---------- */
.prose .tryit { background: var(--teal-tint); border: 1px solid var(--teal-line); border-radius: var(--r-md); padding: .9rem 1.1rem; color: var(--text); }
.prose .tryit-h { font-weight: 800; color: var(--teal-dark); font-size: .875rem; margin-bottom: .25rem; }
.prose .table-wrap { overflow-x: auto; }
.prose h3 { font-size: 1.0625rem; color: var(--text); margin-top: 1.5rem; }
.locked-list { list-style: decimal; padding-left: 1.4rem !important; color: var(--text-2); display: grid; gap: .25rem; font-size: .9375rem; }
.upload { border: 1px solid var(--line); border-radius: var(--r-md); padding: 1rem 1.1rem; background: var(--bg); }
.upload.is-capstone { border-color: var(--ink); border-width: 2px; }
.upload-h { display: flex; align-items: center; gap: .5rem; font-size: 1.0625rem; margin-bottom: .5rem; }
.upload-h .ic { color: var(--red); }
.upload .field { margin-bottom: .75rem; }
.upload input[type="file"] { width: 100%; padding: .55rem; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r-sm); font-size: .9375rem; }
.upload textarea { width: 100%; min-height: 70px; }
.upload-locked { display: flex; gap: .5rem; align-items: flex-start; color: var(--text-2); font-size: .9375rem; margin-bottom: .75rem; }
.upload-locked .ic { width: 18px; height: 18px; margin-top: .15rem; color: var(--muted); flex: none; }
.sub-list { display: grid; gap: .6rem; margin-top: 1rem; }
.sub { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: .7rem .85rem; }
.sub-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem .75rem; }
.sub-file { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; font-size: .9375rem; min-width: 0; overflow-wrap: anywhere; }
.sub-file .ic { width: 16px; height: 16px; flex: none; color: var(--muted); }
.sub-date { font-size: .8125rem; color: var(--muted); margin-top: .25rem; }
.sub-fb { margin-top: .45rem; font-size: .9375rem; color: var(--text-2); white-space: pre-line; }
.cert-reqs { display: grid; gap: .5rem; margin: 1rem 0 1.25rem; }
.cert-reqs li { display: flex; gap: .6rem; align-items: flex-start; font-size: .9688rem; color: var(--text-2); }
.cert-reqs li .ic { width: 18px; height: 18px; color: var(--teal); flex: none; margin-top: .15rem; }
.cert-reqs li .ol-dot { margin-top: .35rem; flex: none; }
.cert-reqs li.is-done { color: var(--text); }
.cert-done { display: flex; gap: 1rem; align-items: flex-start; background: var(--ink); color: var(--ink-text); border-radius: var(--r-lg); padding: 1.5rem; }
.cert-done strong { color: #fff; }
.cert-ic { width: 40px !important; height: 40px !important; color: var(--red-on-ink); flex: none; }
.cert-award { font-size: 1.25rem; font-weight: 800; color: #fff; margin-bottom: .35rem; }
.cert-id { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .02em; }
.cert-done .cta-row { margin-top: 1rem; }
.cert-done .btn-outline { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .35); }
@media (max-width: 479.98px) { .cert-done { flex-direction: column; } }
.login-form .dialog-body > .muted { margin-bottom: 1rem; }
.prose .sub-list, .prose .cert-reqs, .prose .locked-list { padding-left: 0; }
.prose .sub-list, .prose .cert-reqs { list-style: none; }
.prose .sub-list li + li, .prose .cert-reqs li + li { margin-top: 0; }
.prose a.btn { text-decoration: none; }
.prose a.btn-red, .prose a.btn-ink, .prose a.btn-teal { color: #fff; }
.prose a.btn-outline { color: var(--text); }
