/* Schema — the course list, the lesson frame and the lesson check. */

.course { max-width: 760px; margin: 0 auto; }

/* What to do now. */
.up-next { padding: 20px 18px 16px; border-radius: 20px; box-shadow: none; }
@media (min-width: 600px) { .up-next { padding: 24px 24px 18px; } }
.un-eyebrow { font-size: .82rem; font-weight: 700; color: var(--red); }
.un-eyebrow span { color: var(--ink-soft); font-weight: 600; }
.un-title { font-size: clamp(1.5rem, 6vw, 1.9rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.2; margin-top: 4px; }
.up-next.is-link { display: block; text-decoration: none; color: var(--ink); transition: border-color .15s; }
.up-next.is-link:hover { border-color: var(--red-ln); }
.up-next.is-link:active { background: var(--sunken); }
.un-top { display: flex; align-items: center; gap: 14px; }
.un-main { flex: 1; min-width: 0; }
.un-go { width: 48px; height: 48px; flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--red); color: var(--on-red); }
.un-go svg { width: 22px; height: 22px; stroke-width: 2.4; }
.up-next.is-link:hover .un-go { background: var(--red-dark); }
.un-foot { display: flex; align-items: center; gap: 14px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.un-prog { flex: 1; min-width: 0; }
.un-n { display: block; font-size: .8rem; font-weight: 650; color: var(--ink-soft); margin-bottom: 6px; }
.un-bar { height: 6px; border-radius: 999px; background: var(--paper); overflow: hidden; }
.un-bar i { display: block; height: 100%; border-radius: inherit; background: var(--ink); }
.un-week { flex: none; display: inline-flex; align-items: center; gap: 5px; font-size: .78rem; font-weight: 700; color: var(--ink-mid); background: var(--paper); border-radius: 999px; padding: 5px 10px; }
.un-week.is-hit { color: var(--green); background: var(--green-bg); }
.un-week svg { width: 13px; height: 13px; stroke-width: 3; }

/* The four tiers, each a fold: the one you're in open. */
.tiers { margin-top: 22px; display: flex; flex-direction: column; gap: 10px; }
.tier-head {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 10px;
  padding: 12px 4px 10px; cursor: pointer; list-style: none; border-radius: 12px;
}
.tier-head::-webkit-details-marker { display: none; }
.tier-text { display: flex; align-items: baseline; gap: 10px; min-width: 0; flex-wrap: wrap; }
.tier-name { font-size: 1.1rem; font-weight: 800; letter-spacing: -.01em; }
.tier-sub { font-size: .8rem; color: var(--ink-soft); }
.tier-side { display: inline-flex; align-items: center; gap: 8px; }
.tier-count { font-size: .82rem; font-weight: 700; color: var(--ink-mid); font-variant-numeric: tabular-nums; }
.tier-done { display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; font-weight: 700; color: var(--green); }
.tier-done svg { width: 15px; height: 15px; stroke-width: 2.6; }
.tier-chev { display: inline-flex; color: var(--ink-soft); transition: transform .2s var(--ease); }
.tier-chev svg { width: 18px; height: 18px; }
.tier[open] .tier-chev { transform: rotate(90deg); }
.tier-head:hover .tier-chev { color: var(--ink); }
.tier-bar { grid-column: 1 / -1; height: 4px; border-radius: 999px; background: var(--border); overflow: hidden; }
.tier-bar i { display: block; height: 100%; border-radius: inherit; background: var(--ink); }
.tier.is-complete .tier-bar i { background: var(--green); }
.tier[open] .tier-bar { display: none; }
.tier .lesson-list { margin-top: 2px; }

.lesson-list { overflow: hidden; box-shadow: none; }
.lesson-row {
  display: grid; grid-template-columns: 3rem 1fr 24px; align-items: center; gap: 6px;
  min-height: 54px; padding: 8px 14px 8px 16px; text-decoration: none; color: var(--ink);
  border-top: 1px solid var(--border); transition: background .12s;
}
.lesson-row:first-child { border-top: 0; }
.lesson-row:hover { background: var(--sunken); }
.lr-num { font-size: .76rem; font-weight: 800; color: var(--ink-soft); letter-spacing: .03em; font-variant-numeric: tabular-nums; }
.lr-text { display: flex; flex-direction: column; min-width: 0; }
.lr-name { font-weight: 650; font-size: .96rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lr-next { font-size: .74rem; font-weight: 700; color: var(--red); }
.lr-state { display: inline-flex; justify-content: flex-end; color: var(--ink-soft); }
.lr-state svg { width: 17px; height: 17px; }
.lesson-row.is-done .lr-name { color: var(--ink-mid); font-weight: 600; }
.lesson-row.is-done .lr-state { color: var(--green); }
.lesson-row.is-locked { color: var(--ink-soft); }
.lesson-row.is-locked .lr-name { font-weight: 550; }
.lesson-row.is-locked .lr-state svg { width: 15px; height: 15px; opacity: .7; }
.lesson-row.is-next { background: var(--red-bg); box-shadow: inset 3px 0 0 var(--red); }
.lesson-row.is-next .lr-state, .lesson-row.is-next .lr-num { color: var(--red); }

/* The lesson frame fills the screen under the header. */
.view.is-flush { max-width: none; padding: 0; }
.frame-wrap { position: relative; height: calc(100vh - var(--top-h) - var(--safe-t)); height: calc(100dvh - var(--top-h) - var(--safe-t)); }
.lesson-frame { display: block; width: 100%; height: 100%; border: 0; background: var(--paper); }
.frame-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--paper); }
.wide-only { display: none !important; }
@media (min-width: 900px) { .wide-only { display: inline-flex !important; } }
.view.is-flush .locked-card { margin: 8vh 16px; }
@media (min-width: 520px) { .view.is-flush .locked-card { margin: 8vh auto; } }

/* ── The lesson check ── */
.quiz { max-width: 620px; margin: 0 auto; padding-bottom: calc(24px + var(--safe-b)); }
.quiz-intro { padding: 26px 22px 22px; }
.quiz-kicker { font-size: .7rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--red); }
.quiz-title { font-family: var(--display); font-weight: var(--display-weight); font-size: 1.9rem; letter-spacing: -.025em; margin: 6px 0 10px; }
.quiz-lead { color: var(--ink-mid); line-height: 1.6; }
.quiz-note { margin-top: 10px; font-size: .88rem; color: var(--green); font-weight: 650; }
.quiz-rules { margin: 16px 0 22px; padding-left: 1.1rem; color: var(--ink-soft); font-size: .9rem; line-height: 1.6; }
.quiz-rules li + li { margin-top: 4px; }

.quiz-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 2px 12px; }
.quiz-count { font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.quiz-dots { display: flex; gap: 6px; }
.quiz-dots span { width: 22px; height: 6px; border-radius: 999px; background: var(--border); }
.quiz-dots .now { background: var(--ink-soft); }
.quiz-dots .ok { background: var(--green); }
.quiz-dots .no { background: var(--red); }
.quiz-card { padding: 20px 18px 18px; margin-bottom: 14px; }
.quiz-prompt { font-weight: 750; font-size: 1.05rem; line-height: 1.45; color: var(--ink); }
/* Focused by the screen (so a screen reader starts there), not by the student: no ring. */
.quiz-prompt:focus, .qr-title:focus { outline: none; }
.quiz-ja { margin-top: 14px; padding: 14px 16px; border-radius: 12px; background: var(--sunken); border: 1px solid var(--border); font-size: 1.45rem; line-height: 2; color: var(--ink); text-align: center; }
.quiz-ja .blank { color: var(--red); letter-spacing: .05em; }
.quiz-choices { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.quiz-choice {
  appearance: none; width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
  min-height: 56px; padding: 10px 14px; border-radius: 14px;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--ink);
  font-size: 1.12rem; line-height: 1.7; transition: border-color .12s, background .12s, transform .1s;
}
.quiz-choice:hover:not(:disabled) { border-color: var(--line-2); background: var(--sunken); }
.quiz-choice:active:not(:disabled) { transform: scale(.99); }
.qc-letter { flex: none; width: 28px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 800; color: var(--ink-soft); background: var(--sunken); border: 1px solid var(--border); font-family: var(--font); }
.qc-text { flex: 1; font-family: var(--jp); }
.quiz-choice.is-picked { border-color: var(--ink-soft); }
.quiz-hint { margin-top: 8px; font-size: .88rem; color: var(--ink-soft); }
/* choose all that apply: a picked choice stays marked until Check */
.quiz-choices.is-multi .quiz-choice.is-picked:not(.is-right):not(.is-wrong) { border-color: var(--ink); background: var(--sunken); }
.quiz-choices.is-multi .quiz-choice.is-picked:not(.is-right):not(.is-wrong) .qc-letter { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.quiz-choice.is-right { border-color: var(--green); background: var(--green-bg); }
.quiz-choice.is-right .qc-letter { background: var(--green); border-color: var(--green); color: #fff; }
html[data-theme="dark"] .quiz-choice.is-right .qc-letter { color: #0b1f18; }
.quiz-choice.is-wrong { border-color: var(--red); background: var(--red-bg); }
.quiz-choice.is-wrong .qc-letter { background: var(--red); border-color: var(--red); color: var(--on-red); }
.quiz-choice:disabled { cursor: default; }
.quiz-choices.answered .quiz-choice:not(.is-right):not(.is-wrong) { opacity: .55; }
.quiz-feedback { margin-top: 14px; padding: 12px 14px; border-radius: 12px; font-size: .93rem; line-height: 1.6; color: var(--ink-mid); }
.quiz-feedback b { display: block; margin-bottom: 2px; }
.quiz-feedback.is-right { background: var(--green-bg); border: 1px solid var(--green-ln); }
.quiz-feedback.is-right b { color: var(--green); }
.quiz-feedback.is-wrong { background: var(--red-bg); border: 1px solid var(--red-ln); }
.quiz-feedback.is-wrong b { color: var(--red); }

.quiz-result { padding: 30px 22px 22px; text-align: center; }
.qr-badge {
  position: relative; width: 74px; height: 74px; margin: 0 auto 14px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 1.3rem;
}
.qr-badge svg { width: 36px; height: 36px; stroke-width: 2.6; }
.is-pass .qr-badge { color: #fff; background: var(--green); box-shadow: 0 0 0 8px var(--green-bg); animation: pop .4s var(--ease); }
html[data-theme="dark"] .is-pass .qr-badge { color: #0b1f18; }
.is-fail .qr-badge { color: var(--ink-mid); background: var(--sunken); border: 1.5px solid var(--line-2); }
.is-paused .qr-badge { color: var(--ink-soft); background: var(--sunken); border: 1.5px solid var(--border); }
.is-paused .qr-badge svg { stroke-width: 2; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.qr-dot { position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px; border-radius: 50%; animation: burst .85s var(--ease) forwards; }
@keyframes burst { from { transform: rotate(var(--a)) translateY(0); opacity: 1; } to { transform: rotate(var(--a)) translateY(-70px); opacity: 0; } }
.qr-title { font-family: var(--display); font-weight: var(--display-weight); font-size: 1.8rem; letter-spacing: -.025em; }
.qr-score { margin-top: 6px; color: var(--ink-mid); font-size: 1.02rem; }
.qr-next { margin-top: 10px; color: var(--green); font-weight: 650; }
.qr-next b { color: var(--ink); }
.qr-hint { margin: 10px auto 0; color: var(--ink-soft); max-width: 26rem; line-height: 1.6; font-size: .92rem; }
.qr-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }

/* The lesson's Check button in the top bar: quiet — the lesson ends with its own call to take it. */
.top-check { min-height: 36px; }
.top-check.is-passed { color: var(--green); border-color: var(--green-ln); }
