/* A lesson alternates a small theory section with enough practice to use it. */
.course-page { background: var(--paper); }
.course-page .lesson-top { flex-wrap: wrap; }
.course-page .lesson-brand img { mix-blend-mode: multiply; }
.course-page .lesson-step-label { margin-left: auto; }
.course-page .lesson-progress { height: 5px; background: var(--surface-soft); }
.course-page .lesson-progress-row > span { flex-shrink: 0; }
.course-main { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 44px; max-width: 1024px; padding: 38px 32px 48px; }
.course-content, .course-outline { min-width: 0; }
.course-outline { align-self: start; position: sticky; top: 25px; }
.course-outline > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; font-size: 13px; font-weight: 700; cursor: pointer; list-style: none; }
.course-outline > summary::-webkit-details-marker { display: none; }
.course-outline > summary .icon { width: 17px; height: 17px; color: var(--muted); transition: transform .2s ease; }
.course-outline[open] > summary .icon { transform: rotate(180deg); }
.course-outline ol { list-style: none; padding: 0; margin: 12px 0 0; }
.course-outline li { display: flex; align-items: flex-start; gap: 12px; padding: 17px 0; color: var(--muted); border-bottom: 1px solid var(--line); }
.course-outline li:last-child { border-bottom: 0; }
.course-block-number { display: grid; place-items: center; flex: 0 0 28px; width: 28px; height: 28px; margin-top: 1px; border: 1px solid var(--line-strong); border-radius: 50%; font-size: 11px; }
.course-block-number .icon { width: 15px; height: 15px; }
.course-outline li > div { min-width: 0; }
.course-outline li strong { display: block; font-size: 12px; font-weight: 650; line-height: 1.65; overflow-wrap: anywhere; }
.course-outline li small { display: block; margin-top: 4px; font-size: 10px; line-height: 1.65; }
.course-outline li.is-current { color: var(--ink); }
.course-outline li.is-current .course-block-number { border-color: var(--ink); background: var(--ink); color: var(--cream); }
.course-outline li.is-done .course-block-number { background: var(--cream); border-color: var(--cream); color: var(--ink); }
.course-outline-note { padding-top: 18px; color: var(--muted); font-size: 11px; line-height: 1.85; }
.course-context { margin-bottom: 19px; color: var(--muted); font-size: 12px; line-height: 1.85; overflow-wrap: anywhere; }
.course-context span { display: block; }
.course-page .eyebrow { color: var(--muted); font-size: 10px; line-height: 1.8; letter-spacing: 1.5px; font-weight: 650; }
.course-main h1 { margin: 10px 0 0; font-size: clamp(27px, 3.2vw, 35px); line-height: 1.3; letter-spacing: -1px; overflow-wrap: anywhere; }
.course-lead { margin-top: 16px; color: var(--muted); font-size: 14px; line-height: 1.9; }
.course-pace-note { margin: 16px 0 0; color: var(--muted); font-size: 13px; line-height: 1.85; }
.course-theory-sections { margin: 27px 0 0; }
.course-theory-section + .course-theory-section { margin-top: 25px; padding-top: 24px; border-top: 1px solid var(--line); }
.course-theory-section h2 { margin-bottom: 10px; font-size: 19px; line-height: 1.5; letter-spacing: -.4px; }
.course-theory-section p { color: var(--ink-soft); font-size: 15px; line-height: 1.95; white-space: pre-line; overflow-wrap: anywhere; }
.course-page .formula { padding: 18px 21px; margin-top: 22px; border-radius: 15px; font-size: 19px; font-weight: 650; white-space: pre-line; }
.course-example { margin: 25px 0; padding: 23px; border: 1px solid var(--line); background: var(--white); border-radius: 18px; }
.course-example h2 { display: flex; align-items: center; gap: 8px; margin-bottom: 13px; font-size: 13px; font-weight: 700; }
.course-example h2 .icon { width: 17px; height: 17px; }
.course-example p { font-size: 14px; line-height: 1.95; color: var(--ink-soft); white-space: pre-line; overflow-wrap: anywhere; }
.course-proof { margin-top: 13px; padding: 12px 0; border-top: 1px solid var(--line); }
.course-proof summary { min-height: 34px; cursor: pointer; color: var(--muted); font-size: 13px; }
.course-proof p { margin-top: 8px; }
.course-notes { margin: 25px 0; padding: 19px 21px; background: var(--cream); border-radius: 15px; }
.course-notes h2 { font-size: 13px; font-weight: 700; }
.course-notes ul { padding-left: 17px; margin-top: 10px; }
.course-notes li { font-size: 13px; line-height: 1.9; color: var(--ink-soft); }
.course-notes li + li { margin-top: 6px; }
.course-page .button-primary { min-height: 54px; border-radius: 15px; box-shadow: none; font-size: 14px; }
.course-page .button-primary:hover:not(:disabled) { background: var(--ink-soft); box-shadow: none; }
.course-page .button-primary:disabled { background: var(--surface-soft); }
.course-continue { margin-top: 26px; }
.course-pause { display: flex; align-items: center; justify-content: center; margin: 12px auto 0; min-height: 44px; color: var(--muted); font-size: 12px; }
.course-question-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.course-question-heading > span:last-child { color: var(--muted); font-size: 12px; white-space: nowrap; }
.course-question h1 { font-size: clamp(24px, 2.6vw, 30px); line-height: 1.45; white-space: pre-line; }
.course-question .question-instruction { margin: 16px 0 25px; color: var(--muted); font-size: 13px; }
.course-options { grid-template-columns: minmax(0, 1fr); }
.course-options .answer-option { min-height: 65px; padding: 16px 18px; border-radius: 15px; font-size: 16px; font-weight: 550; box-shadow: none; }
.course-options .answer-option:hover:not(:disabled) { background: var(--surface-soft); box-shadow: none; transform: none; }
.course-options .answer-option.is-selected { background: var(--cream); border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.course-options .answer-option.is-correct { background: var(--success-soft); border-color: var(--success); box-shadow: none; }
.course-options .answer-option.is-wrong { background: var(--error-soft); border-color: var(--error); box-shadow: none; }
.course-options .answer-letter { border-radius: 50%; width: 27px; height: 27px; flex-basis: 27px; }
.course-feedback { display: flex; gap: 12px; align-items: flex-start; margin: 22px 0; padding: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.course-feedback > .icon { flex: 0 0 21px; margin-top: 3px; color: var(--success); }
.course-feedback > div { min-width: 0; }
.course-feedback h2 { font-size: 15px; line-height: 1.6; }
.course-feedback p { margin-top: 8px; font-size: 14px; line-height: 1.9; color: var(--ink-soft); white-space: pre-line; overflow-wrap: anywhere; }
.course-feedback .question-source { font-size: 11px; color: var(--muted); }
.course-help { display: flex; justify-content: center; align-items: center; gap: 8px; margin: 12px auto 0; min-height: 44px; color: var(--muted); font-size: 12px; }
.course-help .icon { width: 16px; height: 16px; }
.course-repair .course-feedback > .icon { color: var(--ink); }
.course-repair-question { margin-top: 22px; color: var(--ink-soft); font-size: 14px; line-height: 1.9; white-space: pre-line; }
.course-repair .course-theory-sections { padding-top: 5px; }
.course-repeat-note { margin-top: 17px; color: var(--muted); font-size: 12px; line-height: 1.9; }
.course-result-icon { display: grid; place-items: center; width: 51px; height: 51px; margin-bottom: 22px; border-radius: 50%; background: var(--cream); }
.course-result-icon .icon { width: 25px; height: 25px; }
.course-result-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 25px 0; }
.course-result-details > div { padding: 21px; border: 1px solid var(--line); border-radius: 17px; }
.course-result-details strong { display: block; font-size: 26px; font-weight: 700; letter-spacing: -.6px; }
.course-result-details span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.course-page .lesson-footer { border-top: 1px solid var(--line); }
.course-page .lesson-source { margin-top: 26px; }

/* The learning stages share the tactile language of the path. */
.course-outline { padding: 15px 17px 18px; border: 2px solid var(--play-edge, #ddd7c9); border-radius: 22px; background: var(--white); }
.course-outline > summary { font-weight: 800; }
.course-outline-position { margin-left: auto; color: var(--muted); font-size: 11px; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.course-outline:not([open]) { padding-bottom: 15px; }
.course-outline li { gap: 11px; }
.course-block-number { width: 32px; height: 32px; flex-basis: 32px; border-width: 2px; border-color: var(--play-edge, #ddd7c9); border-radius: 12px; font-size: 12px; font-weight: 800; background: var(--paper); box-shadow: 0 2px 0 var(--play-edge, #ddd7c9); }
.course-outline li.is-current .course-block-number { box-shadow: 0 3px 0 #151c34; }
.course-outline li.is-done .course-block-number { border-color: #bdc9b8; background: #edf5e9; color: #38624b; box-shadow: 0 2px 0 #bdc9b8; }
.course-outline li strong { font-weight: 800; }
.course-outline li small { font-weight: 600; }
.course-context { font-weight: 750; font-size: 13px; }
.course-context > span { margin-top: 3px; font-weight: 500; font-size: 11px; }
.course-stage-label { display: flex; align-items: center; gap: 12px; }
.course-stage-symbol { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 36px; border: 2px solid #e2d6bd; border-radius: 12px; background: var(--cream); color: var(--ink); box-shadow: 0 2px 0 #e2d6bd; }
.course-stage-symbol > .icon { width: 19px; height: 19px; stroke-width: 2; }
.course-theory > h1 { margin-top: 16px; }
.course-theory-sections { padding: 22px; border: 2px solid var(--line); border-radius: 22px; background: var(--white); }
.course-theory-sections:empty { display: none; }
.course-theory-section h2 { font-weight: 800; }
.course-theory-section + .course-theory-section { margin-top: 21px; padding-top: 21px; border-top-width: 2px; }
.course-example { border-width: 2px; border-color: #d4dced; border-radius: 21px; background: #f3f5fb; }
.course-example h2 { font-weight: 800; }
.course-example h2 .icon { width: 20px; height: 20px; stroke-width: 2; }
.course-notes { border: 2px solid #e6dcc6; border-radius: 20px; }
.course-notes h2 { font-weight: 800; }
.course-practice-counter { padding: 5px 10px; border: 2px solid var(--line); border-radius: 10px; color: var(--ink-soft); background: var(--white); font-weight: 800; font-variant-numeric: tabular-nums; }
.course-question-heading .eyebrow { font-weight: 800; }
.course-repair-question { padding: 17px 19px; border: 2px solid var(--line); border-radius: 18px; background: var(--white); font-weight: 650; }
.course-repair .course-theory-sections { padding-top: 22px; }
.course-result { text-align: center; }
.course-result .course-lead { margin-left: auto; margin-right: auto; max-width: 490px; }
.course-result .course-notes { text-align: left; }
.course-result .course-result-details { text-align: center; }
.course-result .course-result-details span { font-size: 12px; font-weight: 600; }
.course-subject-reminder { margin-top: 30px; padding: 22px 0 0; border-top: 1px solid var(--line); text-align: left; }
.course-subject-reminder h2 { margin: 0; font-size: 17px; line-height: 1.5; }
.course-subject-reminder p { margin: 9px 0 12px; color: var(--muted); font-size: 13px; line-height: 1.85; }
.course-subject-reminder .text-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; max-width: 100%; text-align: left; font-size: 13px; }
.course-subject-reminder .text-link .icon { flex: 0 0 17px; width: 17px; height: 17px; }
.course-achievement-art { display: block; width: 172px; height: 121px; margin: 0 auto 20px; color: #b59a65; overflow: visible; }
.course-art-medal { transform-box: fill-box; transform-origin: center; animation: course-medal-pop .55s cubic-bezier(.2,.8,.3,1.15) both; }
.course-art-spark { transform-box: fill-box; transform-origin: center; animation: course-spark-open .55s ease-out both; }
.course-reinforcement .course-result-icon { width: 61px; height: 61px; border: 2px solid #c8d0e4; border-radius: 20px; background: #edf0fa; box-shadow: 0 3px 0 #c8d0e4; }
.course-reinforcement .course-result-icon .icon { width: 29px; height: 29px; stroke-width: 2; }
[data-course-phase="ready"] .course-context, [data-course-phase="complete"] .course-context { text-align: center; }

@keyframes course-medal-pop { from { opacity: 0; transform: scale(.85) rotate(-5deg); } 65% { opacity: 1; transform: scale(1.03) rotate(1deg); } to { opacity: 1; transform: scale(1) rotate(0); } }
@keyframes course-spark-open { from { opacity: 0; transform: scale(.75); } 55% { opacity: .9; } to { opacity: 1; transform: scale(1); } }

@media (max-width: 760px) {
  .course-main { grid-template-columns: minmax(0, 1fr); gap: 28px; max-width: 680px; padding: 22px 23px 38px; }
  .course-outline { position: static; border: 0; border-bottom: 2px solid var(--line); border-radius: 0; background: transparent; padding: 0 0 17px; }
  .course-outline:not([open]) { padding-bottom: 12px; }
  .course-outline > summary { min-height: 30px; font-size: 12px; }
  .course-outline ol { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
  .course-outline li { display: block; padding: 0; border-bottom: 0; }
  .course-outline li strong { margin-top: 11px; font-size: 11px; line-height: 1.7; }
  .course-outline li small { font-size: 10px; line-height: 1.7; }
  .course-outline-note { display: none; }
  .course-context { font-size: 11px; margin-bottom: 18px; }
  .course-main h1 { font-size: 28px; letter-spacing: -.8px; }
  .course-question h1 { font-size: 24px; letter-spacing: -.45px; }
  .course-theory-section h2 { font-size: 18px; }
  .course-theory-section p { font-size: 14px; }
  .course-theory-sections { padding: 19px; border-radius: 20px; }
  .course-page .formula { padding: 17px; font-size: 18px; }
  .course-example { padding: 19px; }
  .course-stage-label { gap: 10px; }
  .course-stage-symbol { width: 33px; height: 33px; flex-basis: 33px; border-radius: 11px; }
  .course-stage-symbol > .icon { width: 17px; height: 17px; }
  .course-practice-counter { padding: 4px 8px; }
  .course-repair .course-theory-sections { padding-top: 19px; }
  .course-achievement-art { width: 150px; height: 106px; margin-bottom: 17px; }
  .course-options .answer-option { padding: 15px; font-size: 15px; }
  .course-page .lesson-footer { padding: 20px 23px calc(20px + env(safe-area-inset-bottom)); }
  .course-page .lesson-footer > span:last-child { display: none; }
}

@media (max-width: 360px) {
  .course-page .lesson-brand { font-size: 22px; margin-left: 0; gap: 5px; }
  .course-page .lesson-brand img { width: 32px; height: 32px; }
  .course-page .lesson-step-label { font-size: 10px; }
  .course-main { padding-left: 18px; padding-right: 18px; }
  .course-main h1 { font-size: 26px; }
  .course-question h1 { font-size: 23px; }
  .course-outline ol { gap: 10px; }
  .course-result-details > div { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .course-page *, .course-page *::before, .course-page *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Writing and independent-answer stages share the calm indigo / cream palette. */
.course-notebook { padding: 22px; margin: 28px 0; border: 1px solid var(--line); border-radius: 18px; background: var(--white); }
.course-notebook h2 { display: flex; align-items: center; gap: 9px; font-size: 18px; }
.course-notebook p, .course-notation p { color: var(--ink-soft); font-size: 14px; line-height: 1.85; }
.course-notebook details { margin-top: 14px; }
.course-notebook summary, .course-notation summary, .course-repair-theory > summary { cursor: pointer; padding: 12px 0; min-height: 44px; font-size: 14px; font-weight: 650; }
.course-notebook-sample { padding: 18px; border-left: 3px solid var(--ink); background: var(--surface-soft); border-radius: 0 12px 12px 0; }
.course-notebook-sample > span { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.course-notebook-sample p { white-space: pre-line; margin: 7px 0 17px; overflow-wrap: anywhere; }
.course-notebook-sample p:last-child { margin-bottom: 0; }
.course-notation { margin: 16px 0 23px; border-bottom: 1px solid var(--line); }
.course-notation dl { margin: 8px 0 16px; }
.course-notation dl > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.course-notation dd { margin: 0; }
.course-notation code { font-family: ui-monospace, monospace; background: var(--surface-soft); padding: 3px 6px; border-radius: 5px; }
.course-answer-field label, .course-writing label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.course-answer-field input, .course-writing textarea { display: block; width: 100%; min-width: 0; box-sizing: border-box; border: 2px solid var(--line-strong); border-radius: 14px; background: var(--white); color: var(--ink); padding: 16px 18px; font: inherit; font-size: 20px; outline-offset: 3px; }
.course-answer-field input:focus, .course-writing textarea:focus { border-color: var(--ink); }
.course-answer-field input[readonly], .course-writing textarea[readonly] { background: var(--surface-soft); }
.course-answer-field > p, .course-writing > p { font-size: 12px; line-height: 1.7; margin: 9px 0; color: var(--muted); }
.course-math-keys { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.course-math-keys button { min-width: 44px; min-height: 44px; border: 1px solid var(--line-strong); border-radius: 10px; font: inherit; font-size: 18px; background: var(--surface-soft); color: var(--ink); cursor: pointer; }
.course-math-keys button:hover { border-color: var(--ink); }
.course-writing { margin: 24px 0; }
.course-writing textarea { resize: vertical; font-size: 16px; line-height: 1.7; min-height: 140px; }
.course-input-error:empty { display: none; }
.course-input-error:not(:empty) { color: #8a4d24; }
.course-own-answer { font-size: 15px; overflow-wrap: anywhere; }
.course-repair-theory { margin: 20px 0; }
@media (max-width: 600px) {
  .course-notebook { padding: 17px; }
  .course-notebook h2 { font-size: 17px; }
  .course-notebook-sample { padding: 14px; }
  .course-answer-field input { font-size: 20px; min-height: 58px; }
}
.course-proof-explanation { margin:18px 0; padding:16px 18px; border-left:3px solid var(--indigo,#242b47); background:rgba(36,43,71,.035); border-radius:0 12px 12px 0; }
.course-proof-explanation h3 { margin:0 0 8px; font-size:16px; }
