/* ====================================================================================================
   RESOURCES: LESSONS AND QUIZZES (/resources/)
   ==================================================================================================== */

/* Hand-written, not Tailwind: output.css is a committed build with no typography plugin, and its
   preflight (in @layer base) strips margins, list markers and heading sizes. These rules are
   unlayered, so they win over preflight; set spacing and list styles explicitly.
   Logical properties only (inline-start/end), because right-to-left languages are served.
   Colours come from the theme variables, so dark mode follows html[data-theme="dark"]. */

.rs-page {
    --rs-ok: #166534;
    --rs-ok-bg: #f0fdf4;
    --rs-bad: #991b1b;
    --rs-bad-bg: #fef2f2;
    --rs-warn: #92400e;
    --rs-warn-bg: #fffbeb;
    --rs-tip-bg: #f0fdfa;
    --rs-example-bg: #f8fafc;
    --rs-example-rule: #64748b;
    --rs-control: #7a8394;      /* 3:1 or better against the page, for answer boxes */
    --rs-button: #0e7490;
    --rs-button-hover: #155e75;
    --rs-button-text: #fff;
    background: var(--bg);
}

html[data-theme="dark"] .rs-page {
    --rs-ok: #86efac;
    --rs-ok-bg: #12261a;
    --rs-bad: #fca5a5;
    --rs-bad-bg: #2a1515;
    --rs-warn: #fcd34d;
    --rs-warn-bg: #2a2212;
    --rs-tip-bg: #16282a;
    --rs-example-bg: var(--ds-raised);
    --rs-example-rule: #8b95a7;
    --rs-control: #6b7686;
    --rs-button: #176342;
    --rs-button-hover: #1d7751;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* Preflight's [hidden] rule already uses !important; this keeps it true for the rs- display rules. */
.rs-page [hidden] {
    display: none !important;
}

/* The sticky header must never cover a heading reached from a link. */
.rs-page :is(#quiz, #quiz-results, [id^="section-"], #objectives, #words, #takeaways, #go-further,
    [id^="topic-"]) {
    scroll-margin-top: 96px;
}

/* Base headings for these pages. :where() keeps them weaker than component rules such as
   site.css .panel h2. */
:where(.rs-page) h2 {
    margin: 0 0 12px;
    color: var(--ink);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

:where(.rs-page) h3 {
    margin: 0 0 8px;
    color: var(--ink);
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.35;
}

.rs-page :is(h1, h2, h3) {
    overflow-wrap: break-word;
}

/* ---------- Page shell and hero ---------- */

.rs-wrap {
    max-width: 1120px;          /* lines up with .page-hero-inner */
    margin-inline: auto;
    padding: 40px 16px 96px;
}

.rs-wrap--notices {
    padding-bottom: 0;
}

.rs-wrap--notices + .rs-wrap {
    padding-top: 24px;
}

.rs-reading {
    max-width: 44rem;
    min-width: 0;
}

.rs-page .page-hero {
    padding: 44px 0 52px;
}

.rs-page .page-hero-inner {
    padding-inline: 16px;
}

.rs-page .page-hero h1 {
    font-size: clamp(1.875rem, 6vw, 3.2rem);
    line-height: 1.1;
}

/* The site's teal focus ring is too dark to see on the hero. */
.rs-page .page-hero :focus-visible {
    outline-color: #ffffff;
}

@media (min-width: 640px) {
    .rs-wrap {
        padding-inline: 24px;
    }

    .rs-page .page-hero {
        padding: 64px 0 72px;
    }

    .rs-page .page-hero-inner {
        padding-inline: 24px;
    }
}

.rs-block {
    margin-top: 48px;
}

.rs-block:first-child,
.rs-continue + .rs-block {
    margin-top: 0;
}

.rs-lede {
    margin: 0 0 20px;
    color: var(--muted);
}

.rs-actions {
    margin: 32px 0 0;
}

.rs-hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 24px;
    margin: 28px 0 0;
}

/* ---------- Buttons and links ---------- */

.rs-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 12px 22px;
    border: 2px solid transparent;
    border-radius: 999px;
    background: var(--rs-button);
    color: var(--rs-button-text);
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.rs-button:hover {
    background: var(--rs-button-hover);
    color: var(--rs-button-text);
}

.rs-button--secondary,
.rs-button--secondary:hover {
    border-color: currentColor;
    color: var(--ink);
}

.rs-button--secondary {
    background: transparent;
}

.rs-button--secondary:hover {
    background: var(--teal-light);
}

.rs-button--on-dark,
.rs-button--on-dark:hover {
    color: #0b3b46;
}

.rs-button--on-dark {
    background: #ffffff;
}

.rs-button--on-dark:hover {
    background: #e0f2f1;
}

.rs-text-link {
    color: var(--teal);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.rs-text-link:hover {
    color: var(--teal-dark);
}

.rs-text-link--on-dark,
.rs-text-link--on-dark:hover {
    color: #ffffff;
}

/* In a row of actions, a text link is a full-size target too. */
:is(.rs-hero-actions, .rs-results-actions) .rs-text-link {
    display: inline-flex;
    align-items: center;
    min-height: 48px;
}

/* site.css .panel .button-pill is white on --teal, which is too light in dark mode. */
html[data-theme="dark"] .rs-page .panel .button-pill {
    background: var(--rs-button);
}

html[data-theme="dark"] .rs-page .panel .button-pill:hover {
    background: var(--rs-button-hover);
}

.rs-page .panel .button-pill {
    min-height: 48px;
}

/* ---------- Breadcrumb, meta lines, tags, notices ---------- */

.rs-breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin: 0 0 8px;
    padding: 0;
    list-style: none;
    color: var(--muted);
    font-size: 0.875rem;
}

/* "›" is a mirrored character: in a right-to-left page it is drawn as "‹" on its own. */
.rs-breadcrumb li + li::before {
    content: "›";
    content: "›" / "";
    margin-inline: 0.5rem;
}

.rs-breadcrumb a {
    display: inline-flex;
    align-items: center;
    min-height: 48px;
    color: var(--teal);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.rs-breadcrumb a[aria-current="page"] {
    text-decoration: none;
}

.rs-breadcrumb--on-dark ol {
    color: #b9d9e2;
}

.rs-breadcrumb--on-dark a {
    color: #ffffff;
}

.rs-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    row-gap: 4px;
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
    color: var(--muted);
    font-size: 0.875rem;
}

.rs-meta > li + li::before,
.rs-meta > span:not(.rs-tag) + span:not(.rs-tag)::before {
    content: "·";
    content: "·" / "";
    margin-inline: 0.5em;
}

.rs-meta .rs-tag {
    margin-inline-start: 0.75em;
}

.rs-meta a {
    display: inline-block;
    padding-block: 12px;
    color: var(--teal);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.rs-meta--on-dark {
    margin-top: 18px;
    color: #9dc4cf;
}

.rs-meta--on-dark a {
    margin-block: -12px;
    color: #ffffff;
}

.rs-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}

.rs-tag--draft {
    background: var(--rs-warn-bg);
    color: var(--rs-warn);
}

.rs-tag--yours {
    border-color: var(--ink);
    color: var(--ink);
}

.rs-tag--correct {
    background: var(--rs-ok-bg);
    color: var(--rs-ok);
}

.rs-notice {
    margin: 0 0 16px;
    padding: 14px 18px;
    border-inline-start: 4px solid;
    border-radius: 8px;
    font-weight: 500;
}

.rs-notice--draft {
    border-color: var(--rs-warn);
    background: var(--rs-warn-bg);
    color: var(--rs-warn);
}

.rs-notice--language {
    border-color: var(--teal);
    background: var(--rs-tip-bg);
    color: var(--ink);
}

/* ---------- Icons ---------- */

.rs-icon {
    display: block;
    flex: none;
    width: 32px;
    height: 32px;
    color: var(--teal);
}

.rs-icon-inline {
    display: inline-block;
    flex: none;
    width: 1.1em;
    height: 1.1em;
    vertical-align: -0.15em;
}

/* ---------- Resources page ---------- */

.rs-continue {
    margin-bottom: 48px;
}

.rs-continue p + p {
    margin-top: 8px;
}

.rs-continue a,
.rs-panel-note a {
    color: var(--teal);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.rs-page .panel .rs-panel-note {
    margin-top: 20px;
}

.rs-how,
.rs-path {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.rs-how {
    counter-reset: rs-how;
}

.rs-how li {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--ds-surface, #fff);
    counter-increment: rs-how;
}

.rs-how li::before {
    content: counter(rs-how);
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    margin-bottom: 8px;
    border-radius: 50%;
    background: var(--teal-light);
    color: var(--teal);
    font-weight: 700;
}

.rs-how strong {
    color: var(--ink);
    font-size: 1.05rem;
}

.rs-how span {
    color: var(--muted);
}

@media (min-width: 720px) {
    .rs-how {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 900px) {
    .rs-path {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 24px;
    }
}

.rs-topic {
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--ds-surface, #fff);
    box-shadow: var(--shadow-sm);
}

.rs-topic-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rs-topic-number {
    margin: 0;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
}

.rs-topic h3 {
    margin: 12px 0 6px;
    font-size: 1.25rem;
}

.rs-topic h3 a {
    display: inline-block;
    padding-block: 6px;
    color: var(--ink);
}

.rs-topic h3 a:hover {
    color: var(--teal);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.rs-topic-summary {
    margin: 0;
    color: var(--muted);
}

/* ---------- Lesson lists ---------- */

.rs-lessons {
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
    counter-reset: rs-lesson;
}

.rs-lesson-row {
    position: relative;
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr);
    align-items: start;
    gap: 12px;
    min-height: 48px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
    counter-increment: rs-lesson;
}

.rs-lesson-row::before {
    content: counter(rs-lesson);
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--teal-light);
    color: var(--teal);
    font-size: 0.875rem;
    font-weight: 700;
}

.rs-lesson-row.is-done::before {
    background: var(--rs-ok-bg);
    color: var(--rs-ok);
    box-shadow: inset 0 0 0 2px var(--rs-ok);
}

.rs-lesson-link {
    color: var(--ink);
    font-weight: 600;
}

/* The whole row is the tap target. */
.rs-lesson-link::after {
    content: "";
    position: absolute;
    inset: 0;
}

.rs-lesson-row:hover .rs-lesson-link {
    color: var(--teal);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.rs-lesson-row h3 {
    margin: 0;
    font-size: 1.125rem;
}

.rs-lesson-summary {
    margin: 4px 0 0;
    color: var(--muted);
}

.rs-lessons--compact .rs-meta {
    margin-top: 2px;
}

.rs-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    color: var(--rs-ok);
    font-size: 0.875rem;
    font-weight: 600;
}

.rs-done-note {
    margin: 16px 0 0;
}

.rs-done-note:not(.is-done) {
    display: none;
}

.page-hero .rs-status {
    color: #86efac;
}

/* ---------- Topic page ---------- */

.rs-intro {
    margin-bottom: 32px;
}

.rs-modules {
    margin-bottom: 32px;
}

.rs-modules h2 {
    font-size: 1.125rem;
}

.rs-modules ul {
    margin: 0;
    padding-inline-start: 1.25rem;
    list-style: disc;
    color: var(--muted);
}

.rs-reading > .rs-actions:first-child {
    margin-top: 0;
}

.rs-actions + .rs-block {
    margin-top: 40px;
}

/* ---------- Lesson page: contents rail ---------- */

.rs-toc {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0 16px;
}

.rs-toc > summary {
    min-height: 48px;
    padding-block: 12px;
    color: var(--ink);
    font-weight: 700;
    cursor: pointer;
}

.rs-toc .toc {
    padding-bottom: 12px;
}

.rs-toc .toc a {
    display: flex;
    align-items: center;
    min-height: 48px;
}

.rs-toc-label {
    display: none;
}

@media (min-width: 901px) {
    .rs-toc {
        position: sticky;
        top: 96px;
        max-height: calc(100vh - 120px);
        overflow-y: auto;
        padding: 0;
        border: 0;
    }

    .rs-toc > summary {
        display: none;
    }

    .rs-toc .toc {
        position: static;
        padding-bottom: 0;
    }

    .rs-toc .toc a {
        min-height: 0;
    }

    .rs-toc-label {
        display: block;
    }
}

/* ---------- Lesson page: reading column ---------- */

.rs-objectives ul {
    margin: 8px 0 0;
    padding-inline-start: 1.25rem;
    list-style: disc;
    color: var(--muted);
    font-size: 0.95rem;
}

.rs-objectives li + li {
    margin-top: 6px;
}

.rs-page .rs-objectives .rs-connection {
    margin-top: 16px;
    color: var(--muted);
    font-size: 0.95rem;
}

.rs-connection strong {
    color: var(--ink);
}

.rs-glossary {
    margin-top: 2.5rem;
}

.rs-glossary dl {
    margin: 0;
}

.rs-glossary dt {
    color: var(--ink);
    font-weight: 700;
}

.rs-glossary dd {
    margin: 2px 0 12px;
    margin-inline-start: 0;
    color: var(--muted);
}

.rs-section {
    margin-top: 2.5rem;
}

.rs-section--example,
.rs-section--tip,
.rs-section--warning {
    padding: 20px;
    border-inline-start: 4px solid;
    border-radius: 12px;
}

.rs-section--example {
    border-color: var(--rs-example-rule);
    background: var(--rs-example-bg);
}

.rs-section--tip {
    border-color: var(--teal);
    background: var(--rs-tip-bg);
}

.rs-section--warning {
    border-color: var(--rs-warn);
    background: var(--rs-warn-bg);
}

.rs-callout-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
}

.rs-section--tip .rs-callout-label {
    color: var(--teal);
}

.rs-section--warning .rs-callout-label {
    color: var(--rs-warn);
}

.rs-figure {
    margin: 24px 0 0;
}

.rs-figure img {
    width: 100%;
    height: auto;
    border-radius: 12px;
}

/* Lesson text written by staff (see the HTML allow-list in resources/validators.py). */
.rs-body {
    color: var(--ink);
    font-size: 1.0625rem;
    line-height: 1.75;
}

.rs-body > * + * {
    margin-top: 1rem;
}

.rs-body h3 {
    margin: 1.75rem 0 0;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.4;
}

.rs-body h4 {
    margin: 1.25rem 0 0;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.4;
}

.rs-body > :first-child {
    margin-top: 0;
}

.rs-body :is(h3, h4) + * {
    margin-top: 0.5rem;
}

.rs-body ul,
.rs-body ol {
    padding-inline-start: 1.5rem;
}

.rs-body ul {
    list-style: disc;
}

.rs-body ol {
    list-style: decimal;
}

.rs-body li + li {
    margin-top: 0.375rem;
}

.rs-body strong {
    font-weight: 700;
}

.rs-body a {
    color: var(--teal);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.rs-body a:hover {
    color: var(--teal-dark);
}

.rs-body blockquote {
    padding-inline-start: 16px;
    border-inline-start: 4px solid var(--line);
}

.rs-body dt {
    font-weight: 700;
}

.rs-body dd {
    margin: 0 0 0.75rem;
}

.rs-table-wrap {
    max-width: 100%;
    overflow-x: auto;
}

.rs-body table {
    border-collapse: collapse;
    font-size: 1rem;
    line-height: 1.5;
}

.rs-body caption {
    padding-bottom: 8px;
    font-weight: 600;
    text-align: start;
}

.rs-body th,
.rs-body td {
    padding: 8px 12px;
    border: 1px solid var(--line);
    text-align: start;
    vertical-align: top;
}

.rs-body th {
    background: var(--ds-raised, #f9fafb);
    font-weight: 600;
}

/* Numbered how-to steps. */
.rs-body ol.rs-steps {
    padding-inline-start: 0;
    list-style: none;
    counter-reset: rs-step;
}

.rs-steps > li {
    position: relative;
    min-height: 1.75rem;
    padding-inline-start: 2.5rem;
    counter-increment: rs-step;
}

.rs-steps > li + li {
    margin-top: 0.75rem;
}

.rs-steps > li::before {
    content: counter(rs-step);
    position: absolute;
    inset-inline-start: 0;
    top: 0.1rem;
    display: grid;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: var(--teal);
    color: var(--bg);
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1;
}

/* A CSS counter cannot start at ol[start], so such a list keeps plain numbers. */
.rs-body ol.rs-steps[start] {
    padding-inline-start: 1.5rem;
    list-style: decimal;
}

.rs-steps[start] > li {
    padding-inline-start: 0;
}

.rs-steps[start] > li::before {
    content: none;
}

/* Tick-box list: empty squares, so a printed copy can be ticked by hand. */
.rs-body ul.rs-checklist {
    padding-inline-start: 0;
    list-style: none;
}

.rs-checklist > li {
    display: flex;
    gap: 0.75rem;
}

.rs-checklist > li::before {
    content: "";
    flex: none;
    width: 1em;
    height: 1em;
    margin-top: 0.4em;
    border: 2px solid currentColor;
    border-radius: 3px;
}

.rs-calc {
    width: 100%;
}

.rs-body .rs-num {
    text-align: end;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.rs-total td {
    border-top: 2px solid var(--ink);
    font-weight: 700;
}

.rs-formula {
    padding: 12px 16px;
    border-radius: 8px;
    background: var(--ds-raised, #f2f4f7);
    font-weight: 600;
}

.rs-body blockquote.rs-sample {
    padding: 16px;
    border: 2px dashed var(--line);
    border-radius: 8px;
    background: var(--ds-surface, #fff);
}

.rs-takeaways {
    margin-top: 2.5rem;
    padding: 24px 28px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--ds-raised, #f9fafb);
}

.rs-checks {
    margin: 0;
    padding: 0;
    list-style: none;
}

.rs-checks li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.rs-checks li + li {
    margin-top: 10px;
}

.rs-checks .rs-icon-inline {
    margin-top: 0.3em;
    color: var(--teal);
}

/* ---------- Quiz ---------- */

.rs-quiz {
    margin-top: 3rem;
    padding-bottom: 96px;       /* keeps the fixed "Return to quiz" pill off the submit button */
}

.rs-quiz-intro {
    margin: 0;
    color: var(--muted);
}

.rs-results {
    margin-top: 20px;
    padding: 20px;
    border: 2px solid;
    border-radius: 14px;
}

.rs-results--passed {
    border-color: var(--rs-ok);
    background: var(--rs-ok-bg);
}

.rs-results--not-passed {
    border-color: var(--rs-warn);
    background: var(--rs-warn-bg);
}

.rs-results h3 {
    font-size: 1.25rem;
}

.rs-results p {
    margin: 8px 0 0;
}

.rs-page .rs-results .rs-results-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 20px;
    margin-top: 16px;
}

.rs-question {
    min-inline-size: 0;
    margin: 20px 0 0;
    padding: 16px 20px;
    border: 1px solid var(--line);
    border-radius: 14px;
}

/* A floated legend sits inside the box instead of on its border. */
.rs-question legend {
    float: left;                /* fallback; full width, so the side does not matter */
    float: inline-start;
    width: 100%;
    padding: 0;
}

.rs-question-number {
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.rs-question-prompt {
    display: block;
    margin-top: 4px;
    color: var(--ink);
    font-size: 1.0625rem;
    font-weight: 600;
    line-height: 1.5;
}

.rs-choices {
    clear: both;
    margin: 0;
    padding: 4px 0 0;
    list-style: none;
}

.rs-choice {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px 12px;
    min-height: 48px;
    margin-top: 8px;
    padding: 12px 14px;
    border: 1px solid var(--rs-control);
    border-radius: 10px;
    color: var(--ink);
    cursor: pointer;
}

.rs-choice:hover {
    border-color: var(--teal);
}

.rs-choice:not(.is-correct, .is-wrong):has(input:checked) {
    background: var(--teal-light);
}

.rs-choice:focus-within {
    outline: 3px solid var(--teal);
    outline-offset: 2px;
}

.rs-choice input {
    flex: none;
    width: 1.25rem;
    height: 1.25rem;
    margin: 0.15em 0 0;
    accent-color: var(--teal);
}

/* The label shows the focus ring instead. */
.rs-choice input:focus-visible {
    outline: none;
}

.rs-choice-text {
    flex: 1 1 12rem;
    min-width: 0;
}

.rs-choice.is-correct,
.rs-choice.is-chosen.is-wrong {
    padding: 11px 13px;
    border-width: 2px;
}

.rs-choice.is-correct {
    border-color: var(--rs-ok);
    background: var(--rs-ok-bg);
}

.rs-choice.is-chosen.is-wrong {
    border-color: var(--rs-bad);
    background: var(--rs-bad-bg);
}

.rs-feedback {
    margin-top: 12px;
    padding: 12px 16px;
    border-inline-start: 4px solid;
    border-radius: 10px;
    color: var(--ink);
}

.rs-feedback p + p {
    margin-top: 6px;
}

.rs-feedback--correct {
    border-color: var(--rs-ok);
    background: var(--rs-ok-bg);
}

.rs-feedback--wrong {
    border-color: var(--rs-bad);
    background: var(--rs-bad-bg);
}

.rs-feedback--unanswered {
    border-color: var(--rs-control);
    background: var(--ds-raised, #f2f4f7);
}

.rs-verdict {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-weight: 700;
}

.rs-feedback--correct .rs-verdict {
    color: var(--rs-ok);
}

.rs-feedback--wrong .rs-verdict {
    color: var(--rs-bad);
}

.rs-quiz-submit {
    margin-top: 24px;
}

/* ---------- Go further, pager, closing notes ---------- */

.rs-go-further {
    margin-top: 2.5rem;
}

.rs-go-further > p {
    margin: 0;
    color: var(--muted);
}

.rs-links {
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
}

.rs-links li {
    padding: 14px 0;
    border-top: 1px solid var(--line);
}

.rs-links a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    color: var(--teal);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.rs-links a:hover {
    color: var(--teal-dark);
}

.rs-link-meta {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 0.875rem;
}

.rs-link-description {
    margin: 4px 0 0;
}

.rs-path-end {
    margin: 2.5rem 0 0;
    padding: 16px 20px;
    border-radius: 12px;
    background: var(--rs-ok-bg);
    color: var(--ink);
    font-weight: 600;
}

.rs-pager {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 3rem;
    padding-top: 24px;
    border-top: 1px solid var(--line);
}

.rs-pager a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 10px 18px;
    border: 1px solid var(--rs-control);
    border-radius: 999px;
    color: var(--ink);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.35;
}

.rs-pager a:hover {
    border-color: var(--teal);
    color: var(--teal);
}

.rs-pager a[rel="next"],
.rs-pager a[rel="next"]:hover {
    border-color: transparent;
    color: var(--rs-button-text);
}

.rs-pager a[rel="next"] {
    background: var(--rs-button);
}

.rs-pager a[rel="next"]:hover {
    background: var(--rs-button-hover);
}

.rs-cta {
    margin-top: 2.5rem;
}

.rs-disclaimer,
.rs-smallprint {
    color: var(--muted);
    font-size: 0.875rem;
}

.rs-disclaimer {
    margin: 2rem 0 0;
}

.rs-smallprint {
    max-width: 44rem;
    margin-top: 48px;
}

.rs-smallprint h2 {
    font-size: 1rem;
}

.rs-smallprint p + p {
    margin-top: 8px;
}

.rs-progress-controls {
    max-width: 44rem;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.875rem;
}

.rs-progress-controls .rs-button {
    margin-top: 12px;
}

.rs-progress-controls [role="status"] {
    margin-top: 12px;
    color: var(--ink);
    font-weight: 600;
}

/* ---------- Print ---------- */

@media print {
    /* Paper is white and browsers leave out backgrounds by default, so a dark-mode reader
       prints the light theme. :root outranks dark-mode.css; !important beats the inline
       color-scheme that the theme script sets on <html>. */
    :root[data-theme="dark"] {
        color-scheme: light !important;
        --bg: #ffffff;
        --ink: #101828;
        --muted: #475467;
        --line: #eaecf0;
        --teal: #0e7490;
        --teal-dark: #0f766e;
        --teal-light: #f0fdfa;
        --ds-surface: initial;
        --ds-raised: initial;
    }

    html[data-theme="dark"] .rs-page {
        --rs-ok: #166534;
        --rs-ok-bg: #f0fdf4;
        --rs-bad: #991b1b;
        --rs-bad-bg: #fef2f2;
        --rs-warn: #92400e;
        --rs-warn-bg: #fffbeb;
        --rs-tip-bg: #f0fdfa;
        --rs-example-bg: #f8fafc;
        --rs-example-rule: #64748b;
        --rs-control: #7a8394;
        --rs-button: #0e7490;
        --rs-button-hover: #155e75;
    }

    .site-header,
    .ds-footer,
    .rs-toc,
    .rs-pager,
    .rs-quiz button,
    .rs-results-actions,
    #ds-return-to-quiz,
    #rs-progress-controls,
    #rs-continue,
    .rs-hero-actions,
    .rs-cta {
        display: none !important;
    }

    .rs-page,
    .rs-page .page-hero {
        background: none;
    }

    .rs-page .page-hero {
        padding: 0 0 16px;
    }

    .rs-page .page-hero :is(h1, p, a, li, .eyebrow, .hero-lede, .hero-meta, ol, .rs-status) {
        color: #000000;
    }

    /* Without background graphics the teal circle is dropped, so print the number in an outline. */
    .rs-steps > li::before {
        border: 1px solid #000000;
        background: none;
        color: #000000;
    }

    .rs-wrap.with-toc {
        display: block;
    }

    .rs-wrap {
        padding: 16px 0 0;
    }

    .rs-section,
    .rs-question,
    .rs-topic {
        break-inside: avoid;
    }

    .rs-links a::after {
        content: " (" attr(href) ")";
        font-weight: 400;
        text-decoration: none;
    }
}
