html, body {
    height: 100%;
}

h1:focus {
    outline: none;
}

/* Introductions and running text keep a readable measure (docs/lab-design-standards.md, section 3). */
.intro {
    max-width: 760px;
}

/* Theory pages and lessons: the standard theory pattern, with callouts for the one thing to remember. */
.lesson {
    max-width: 860px;
}

.lesson p, .lesson li {
    line-height: 1.65;
    margin-bottom: 0.75rem;
}

.lesson ul {
    padding-left: 1.25rem;
}

.lesson .callout {
    border-left: 4px solid var(--mud-palette-primary);
    background: var(--mud-palette-background);
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    border-radius: 4px;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: #222;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

/* Reconnect overlay. Blazor toggles the components-reconnect-* classes on #components-reconnect-modal. */
#components-reconnect-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    font-family: Roboto, "Segoe UI", sans-serif;
}

#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
    display: flex;
}

.reconnect-card {
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    border-radius: 12px;
    padding: 2rem 2.25rem;
    max-width: 26rem;
    margin: 1rem;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

.reconnect-title {
    font-size: 1.35rem;
    font-weight: 500;
    margin: 0.75rem 0 0.5rem;
}

.reconnect-text, .reconnect-failed-text {
    line-height: 1.55;
    margin: 0 0 1rem;
    color: var(--mud-palette-text-secondary);
}

.reconnect-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto;
    border: 4px solid var(--mud-palette-lines-default);
    border-top-color: var(--mud-palette-primary);
    border-radius: 50%;
    animation: reconnect-spin 0.9s linear infinite;
}

@keyframes reconnect-spin {
    to { transform: rotate(360deg); }
}

.reconnect-button {
    display: none;
    background: var(--mud-palette-primary);
    color: var(--mud-palette-primary-text);
    border: 0;
    border-radius: 6px;
    padding: 0.6rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
}

.reconnect-failed-text { display: none; }

#components-reconnect-modal.components-reconnect-failed .reconnect-text,
#components-reconnect-modal.components-reconnect-rejected .reconnect-text,
#components-reconnect-modal.components-reconnect-failed .reconnect-spinner,
#components-reconnect-modal.components-reconnect-rejected .reconnect-spinner {
    display: none;
}

#components-reconnect-modal.components-reconnect-failed .reconnect-failed-text,
#components-reconnect-modal.components-reconnect-rejected .reconnect-failed-text,
#components-reconnect-modal.components-reconnect-failed .reconnect-button,
#components-reconnect-modal.components-reconnect-rejected .reconnect-button {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* Accessibility helpers. */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: 8px;
    top: -60px;
    z-index: 3000;
    padding: 8px 14px;
    background: var(--mud-palette-primary);
    color: var(--mud-palette-primary-text);
    border-radius: 6px;
    font-weight: 500;
    text-decoration: none;
    transition: top 0.15s;
}

.skip-link:focus {
    top: 8px;
}

:focus-visible {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: 2px;
}

#main-content:focus {
    outline: none;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print: drop the chrome, widen the content, open collapsed panels. */
@media print {
    .mud-appbar, .mud-drawer, .mud-overlay, .no-print, #components-reconnect-modal,
    .mud-snackbar, .mud-popover, .skip-link, #blazor-error-ui {
        display: none !important;
    }

    .mud-main-content {
        padding-left: 0 !important;
        padding-top: 0 !important;
        margin-left: 0 !important;
    }

    .mud-container {
        max-width: none !important;
        padding: 0 !important;
    }

    .mud-paper {
        box-shadow: none !important;
        border: 1px solid #ccc;
        break-inside: avoid;
    }

    .mud-expand-panel .mud-collapse-container {
        height: auto !important;
        visibility: visible !important;
        overflow: visible !important;
    }

    html, body {
        background: #fff !important;
        color: #000 !important;
    }
}

/* Small screens: keep everything reachable on a phone without horizontal scrolling. */
.mud-table-container, .mud-simple-table {
    overflow-x: auto;
}

@media (max-width: 600px) {
    .appbar-github, .appbar-icon {
        display: none;
    }

    .appbar-title {
        font-size: 1rem;
    }

    #main-content {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .reconnect-card {
        padding: 1.25rem 1rem;
    }
}

/* Radio options stacked one per line, for answers that are full sentences. */
/* MudBlazor lays the group out as a row with a more specific rule, hence !important. */
.radio-stack .mud-radio-group, .mud-radio-group.radio-stack {
    flex-direction: column !important;
    align-items: flex-start !important;
}

/* The footer that ties the lab to the CloudWorrior blog. */
.lab-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
    padding: 1.25rem 1rem 1.75rem;
    border-top: 1px solid var(--mud-palette-lines-default);
    font-size: 0.85rem;
    color: var(--mud-palette-text-secondary);
}

.lab-footer a {
    color: var(--mud-palette-text-primary);
    text-decoration: underline;
}

/* Language menu: a flag beside each language's name. */
.language-option {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.language-option .flag {
    width: 20px;
    height: 14px;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

/* The language button: the current language's flag before its code. */
.language-menu .mud-button-label::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 14px;
    margin-right: 8px;
    background-size: cover;
    background-position: center;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.language-menu.flag-en .mud-button-label::before { background-image: url("images/flags/en.svg"); }
.language-menu.flag-nl .mud-button-label::before { background-image: url("images/flags/nl.svg"); }
.language-menu.flag-pl .mud-button-label::before { background-image: url("images/flags/pl.svg"); }
.language-menu.flag-de .mud-button-label::before { background-image: url("images/flags/de.svg"); }

/* Explorers: the live chart, its readout and the code that gives the same number. */
.live-chart {
    min-height: 340px;
}

.readout {
    margin-top: 0.5rem;
}

.readout-main {
    font-variant-numeric: tabular-nums;
}

.code-equivalents {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.35rem 1rem;
    margin: 0;
    font-size: 0.9rem;
}

.code-equivalents dt {
    color: var(--mud-palette-text-secondary);
}

.code-equivalents dd {
    margin: 0;
    min-width: 0;
}

/* Long calls wrap rather than scroll, so there is no scrolling box a keyboard could not reach. */
.code-equivalents code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

@media (max-width: 600px) {
    .code-equivalents {
        grid-template-columns: 1fr;
    }
}

/* The explorers' controls, readout, summary and formulas. */
.explorer-controls .mud-slider {
    margin-top: 0.25rem;
}

.question-kinds {
    display: flex;
    flex-direction: column;
}

.question-kinds .mud-radio {
    margin: 0;
}

.expression {
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.compare-answer {
    overflow-wrap: anywhere;
}

.compare-swatch {
    display: inline-block;
    width: 14px;
    height: 3px;
    margin-right: 6px;
    vertical-align: middle;
    background: var(--mud-palette-warning);
}

.table-scroll {
    overflow-x: auto;
    /* Visually hidden text in a wide table (.sr-only is absolutely positioned) stays inside the scroller rather than
       widening the page on a phone. */
    position: relative;
}

.stats {
    border-collapse: collapse;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

.stats th, .stats td {
    padding: 0.25rem 0.75rem 0.25rem 0;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.stats thead th {
    font-weight: 500;
}

.stats tbody th {
    font-weight: 400;
    color: var(--mud-palette-text-secondary);
}

.preset {
    display: flex;
    flex-direction: column;
    max-width: 22rem;
    white-space: normal;
}

.preset-name {
    font-weight: 500;
}

.preset-text {
    font-size: 0.8rem;
    color: var(--mud-palette-text-secondary);
}

.formula {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.25rem 0;
}

.try-this {
    margin: 0;
    padding-left: 1.25rem;
}

.try-this li {
    margin-bottom: 1rem;
}

.try-this li:last-child {
    margin-bottom: 0;
}

/* ---- M3: chapters, quizzes, exercises ---- */

.lesson-paper {
    max-width: 920px;
}

.lesson .lesson-heading {
    margin: 1.75rem 0 0.5rem;
}

.lesson .lesson-heading:first-child {
    margin-top: 0;
}

.lesson ol {
    padding-left: 1.5rem;
}

.lesson a, .exercise a, .quiz a {
    color: var(--mud-palette-primary);
    text-decoration: underline;
}

.lesson code, .exercise code, .quiz code, .expression code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9em;
    background: var(--mud-palette-background);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 4px;
    padding: 0 4px;
    overflow-wrap: anywhere;
}

.callout-label {
    margin-right: 0.25rem;
}

.lesson .formula {
    margin: 0.75rem 0 1rem;
}

.code-block, .lesson .table-scroll {
    margin: 0.75rem 0 1rem;
}

.code-table td code {
    white-space: pre-wrap;
    word-break: break-word;
}

.code-table th[scope="row"] {
    font-weight: 400;
    min-width: 10rem;
}

.lesson-table caption {
    caption-side: bottom;
    text-align: left;
    padding-top: 0.35rem;
    font-size: 0.8rem;
    color: var(--mud-palette-text-secondary);
}

.code-note {
    margin-top: -0.25rem;
}

.try-it {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    border-left: 4px solid var(--mud-palette-secondary);
    background: var(--mud-palette-background);
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    border-radius: 4px;
}

.try-it-label {
    display: block;
}

.chapter-chart {
    margin: 1rem 0 1.25rem;
}

.chapter-chart figcaption {
    display: block;
    margin-top: 0.25rem;
}

.chapter-chart-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1.25rem;
}

.chapter-chart-slider {
    max-width: 320px;
    flex: 1 1 220px;
}

.chapter-chart-answer {
    margin: 0;
}

.chapter-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.quiz-question, .drill-group {
    border: none;
    margin: 0 0 1rem;
    padding: 0;
    min-width: 0;
}

.quiz-question legend {
    margin-bottom: 0.25rem;
}

.exercise-list {
    display: grid;
    gap: 1rem;
    max-width: 920px;
}

.exercise-input {
    max-width: 240px;
}

.exercise-hints li, .exercise-solution li {
    margin-bottom: 0.4rem;
    line-height: 1.6;
}

.exercise-solution {
    border-left: 4px solid var(--mud-palette-success);
    padding-left: 1rem;
}

.radio-row .mud-radio-group, .mud-radio-group.radio-row {
    flex-wrap: wrap;
}

.drill-sentence {
    margin: 0.75rem 0 1rem;
}

/* ---- M3: animations (the shared player in js/animation-player.js, renderers in js/*-animation.js) ---- */

.anim-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.anim-speed {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
}

.anim-speed > span {
    margin-right: 4px;
    color: var(--mud-palette-text-secondary);
}

.anim-speed-button {
    min-width: 44px !important;
}

.anim-speed-button[aria-pressed="true"] {
    background: var(--mud-palette-primary-hover);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.anim-chart {
    width: 100%;
    overflow: hidden;
}

.anim svg {
    display: block;
    max-width: 100%;
    font-family: inherit;
}

.anim-readout {
    margin: 0.5rem 0 0;
    font-variant-numeric: tabular-nums;
    min-height: 1.5em;
}

.anim .anim-tick, .anim .anim-label {
    font-size: 11px;
    fill: var(--mud-palette-text-secondary);
}

.anim .anim-label {
    fill: var(--mud-palette-text-primary);
    paint-order: stroke;
    stroke: var(--mud-palette-surface);
    stroke-width: 3px;
    stroke-linejoin: round;
}

.anim .anim-title {
    font-size: 12px;
    fill: var(--mud-palette-text-primary);
}

.anim .anim-grid line {
    stroke: var(--mud-palette-lines-default);
    stroke-width: 1;
}

.anim .anim-axis {
    stroke: var(--mud-palette-text-secondary);
    stroke-width: 1;
}

.anim .anim-line {
    fill: none;
    stroke: var(--mud-palette-primary);
    stroke-width: 2;
    stroke-linejoin: round;
}

.anim .anim-target {
    stroke: var(--mud-palette-warning);
    stroke-width: 2;
    stroke-dasharray: 6 4;
}

.anim .anim-dot {
    fill: var(--mud-palette-primary);
}

/* Law of large numbers: the latest outcome, and the last few. */
.lln-stage {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    margin-bottom: 8px;
}

.lln-token-box {
    flex: 0 0 auto;
}

.lln-token {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    height: 48px;
    padding: 0 8px;
    border-radius: 10px;
    border: 2px solid var(--mud-palette-lines-default);
    font-weight: 700;
    font-size: 1.1rem;
}

.lln-token.is-success {
    border-color: var(--mud-palette-secondary);
    color: var(--mud-palette-secondary);
}

.lln-recent-box {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}

.lln-recent {
    font-size: 0.7rem;
    min-width: 20px;
    text-align: center;
    padding: 1px 3px;
    border-radius: 4px;
    border: 1px solid var(--mud-palette-lines-default);
    color: var(--mud-palette-text-secondary);
}

.lln-recent.is-success {
    border-color: var(--mud-palette-secondary);
    color: var(--mud-palette-text-primary);
}

/* Probability rules: the formula, the Venn diagram and the tree. */
.rules-formula {
    font-size: 1.05rem;
    line-height: 2;
    margin-bottom: 8px;
    overflow-wrap: anywhere;
}

.rules-term {
    padding: 2px 4px;
    border-radius: 4px;
}

.rules-term.is-read {
    text-decoration: underline;
    text-decoration-color: var(--mud-palette-secondary);
    text-underline-offset: 4px;
}

.rules-term.is-on {
    background: var(--mud-palette-secondary);
    color: var(--mud-palette-secondary-text);
}

.rules-figures {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

.anim .rules-region {
    fill: var(--mud-palette-primary);
    fill-opacity: 0.08;
    transition: fill-opacity 0.3s, fill 0.3s;
}

.anim .rules-region[data-region="Neither"] {
    fill: var(--mud-palette-text-secondary);
    fill-opacity: 0.04;
}

.anim .rules-region.is-on {
    fill: var(--mud-palette-secondary);
    fill-opacity: 0.55;
}

.anim .rules-outline {
    fill: none;
    stroke: var(--mud-palette-primary);
    stroke-width: 1.5;
}

.anim .rules-name {
    font-size: 14px;
    font-weight: 700;
    fill: var(--mud-palette-text-primary);
}

.anim .rules-branch line {
    stroke: var(--mud-palette-text-secondary);
    stroke-width: 1.5;
    transition: stroke 0.3s, stroke-width 0.3s;
}

.anim .rules-branch.is-on line {
    stroke: var(--mud-palette-secondary);
    stroke-width: 4;
}

.anim .rules-leaf rect {
    fill: var(--mud-palette-surface);
    stroke: var(--mud-palette-lines-default);
    transition: fill 0.3s, stroke 0.3s;
}

.anim .rules-leaf.is-on rect {
    stroke: var(--mud-palette-secondary);
    stroke-width: 2;
}

.rules-steps li {
    margin-bottom: 0.25rem;
}

/* Bayes with natural frequencies: the grid and its legend. */
.bayes-grid {
    display: flex;
    justify-content: center;
}

.bayes-grid canvas {
    display: block;
    max-width: 100%;
}

.bayes-legend {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
}

.bayes-legend li {
    display: flex;
    align-items: center;
    gap: 6px;
}

.bayes-swatch, .galton-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

.bayes-swatch--truepositive { background: var(--mud-palette-secondary); }
.bayes-swatch--falsepositive { background: var(--mud-palette-warning); }
.bayes-swatch--falsenegative { background: var(--mud-palette-error); }
.bayes-swatch--truenegative { background: var(--mud-palette-text-disabled); }

/* Galton board. */
.anim .galton-pegs circle {
    fill: var(--mud-palette-text-secondary);
}

.anim .galton-bar {
    fill: var(--mud-palette-primary);
    fill-opacity: 0.75;
}

.anim .galton-expected {
    fill: none;
    stroke: var(--mud-palette-warning);
    stroke-width: 2;
    stroke-dasharray: 5 3;
}

.anim .galton-expected-dot {
    fill: var(--mud-palette-warning);
}

.anim .galton-ball {
    fill: var(--mud-palette-secondary);
}

.galton-swatch--bar { background: var(--mud-palette-primary); }
.galton-swatch--expected { background: var(--mud-palette-warning); border-radius: 50%; }

.galton-table summary {
    cursor: pointer;
    color: var(--mud-palette-primary);
}

.try-this-done {
    margin-left: -6px;
}

@media print {
    .anim-controls, .chapter-chart-controls .mud-slider {
        display: none !important;
    }
}

/* ---- M4: binomial to normal, the z-score comparator, the data-fit lab ---- */

.anim .b2n-bar {
    fill: var(--mud-palette-primary);
    opacity: 0.45;
}

.anim .b2n-bar.is-counted {
    fill: var(--mud-palette-secondary);
    opacity: 0.8;
}

.anim .b2n-area {
    fill: var(--mud-palette-secondary);
    opacity: 0.16;
}

.anim .b2n-curve {
    fill: none;
    stroke: var(--mud-palette-warning);
    stroke-width: 2.5;
}

.anim .b2n-cut {
    stroke: var(--mud-palette-text-secondary);
    stroke-width: 1.5;
    stroke-dasharray: 4 3;
}

.anim .b2n-n {
    font-size: 14px;
}

.b2n-swatch, .z-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 6px;
    vertical-align: -2px;
    border-radius: 2px;
}

.b2n-swatch--counted { background: var(--mud-palette-secondary); }
.b2n-swatch--bar { background: var(--mud-palette-primary); opacity: 0.6; }
.b2n-swatch--curve { background: var(--mud-palette-warning); height: 4px; vertical-align: 3px; }
.z-swatch--a { background: var(--mud-palette-secondary); }
.z-swatch--b { background: var(--mud-palette-warning); }

.data-chart-note {
    margin: 0;
}

/* ---- M5: the CLT simulator, the confidence interval builder, case studies ---- */

.anim .clt-population {
    fill: var(--mud-palette-primary);
    fill-opacity: 0.18;
    stroke: var(--mud-palette-primary);
    stroke-width: 1.5;
}

.anim .clt-sample-row {
    stroke: var(--mud-palette-lines-default);
    stroke-width: 1;
    stroke-dasharray: 2 3;
}

.anim .clt-mu {
    stroke: var(--mud-palette-text-secondary);
    stroke-width: 1;
    stroke-dasharray: 4 3;
}

.anim .clt-point {
    fill: var(--mud-palette-secondary);
    fill-opacity: 0.85;
}

.anim .clt-marker {
    fill: var(--mud-palette-secondary);
    stroke: var(--mud-palette-surface);
    stroke-width: 1.5;
}

.anim .clt-bar {
    fill: var(--mud-palette-primary);
    opacity: 0.5;
}

.anim .clt-bar.is-latest {
    fill: var(--mud-palette-secondary);
    opacity: 0.9;
}

.anim .clt-curve {
    fill: none;
    stroke: var(--mud-palette-warning);
    stroke-width: 2.5;
}

.clt-swatch, .ci-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 6px;
    vertical-align: -2px;
    border-radius: 2px;
}

.clt-swatch--population { background: var(--mud-palette-primary); opacity: 0.35; }
.clt-swatch--point { background: var(--mud-palette-secondary); border-radius: 50%; width: 8px; height: 8px; vertical-align: 1px; }
.clt-swatch--mean { background: var(--mud-palette-secondary); transform: rotate(45deg) scale(0.8); }
.clt-swatch--bar { background: var(--mud-palette-primary); opacity: 0.6; }
.clt-swatch--curve { background: var(--mud-palette-warning); height: 4px; vertical-align: 3px; }

.anim .ci-mu {
    stroke: var(--mud-palette-text-primary);
    stroke-width: 1.5;
}

.anim .ci-line {
    stroke: var(--mud-palette-primary);
    stroke-width: 1.6;
}

.anim .ci-centre {
    fill: var(--mud-palette-primary);
}

.anim .ci-row.is-miss .ci-line {
    stroke: var(--mud-palette-error);
    stroke-width: 2.2;
    stroke-dasharray: 3 2;
}

.anim .ci-row.is-miss .ci-centre {
    fill: var(--mud-palette-error);
}

.anim .ci-cross {
    font-size: 10px;
    font-weight: 700;
    fill: var(--mud-palette-error);
}

.ci-swatch--hit { background: var(--mud-palette-primary); height: 3px; vertical-align: 4px; }
.ci-swatch--miss {
    width: auto;
    height: auto;
    background: none;
    color: var(--mud-palette-error);
    font-weight: 700;
    border-bottom: 2px dashed var(--mud-palette-error);
    line-height: 1;
    padding: 0 2px;
}
.ci-swatch--mu { background: var(--mud-palette-text-primary); width: 3px; }

.lesson-step {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
}

.lesson-check {
    margin: 1rem 0 1.5rem;
}

.case-steps {
    margin: 0.5rem 0 0.75rem;
    padding-left: 1.5rem;
}

.case-steps li {
    margin-bottom: 0.2rem;
}

/* ---- M6: the lecture bar, the glossary and the cheat sheet ---- */

/* The lecture bar sits at the bottom of the screen above everything but dialogs; the spacer keeps the page's end
   reachable above it. Long notes scroll inside the bar. */
.lecture-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1250;
    border-top: 1px solid var(--mud-palette-lines-default);
}

.lecture-spacer {
    height: 110px;
}

.lecture-spacer.with-notes {
    height: 240px;
}

.lecture-text {
    flex: 1 1 320px;
    min-width: 0;
}

.lecture-notes {
    max-height: 22vh;
    overflow-y: auto;
    max-width: 860px;
}

.lecture-steps {
    padding-left: 1.4rem;
    margin: 0;
}

.lecture-steps li {
    margin-bottom: 4px;
}

.lecture-minutes {
    margin-left: 6px;
    font-size: 0.8rem;
}

@media (max-width: 600px) {
    .lecture-bar .mud-button {
        min-width: 0;
        padding: 4px 8px;
    }

    .lecture-controls {
        width: 100%;
    }

    .lecture-icon {
        display: none;
    }

    .lecture-notes {
        max-height: 18vh;
    }
}

.glossary-filter {
    max-width: 420px;
}

.glossary-letters {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
}

.glossary-letters a {
    color: var(--mud-palette-primary);
    font-weight: 500;
    text-decoration: underline;
    padding: 2px;
}

.glossary {
    max-width: 860px;
    margin: 0;
}

.glossary-entry {
    padding: 10px 0;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    scroll-margin-top: 80px;
}

.glossary-entry[hidden] {
    display: none;
}

.glossary-entry dt {
    font-weight: 500;
    font-size: 1.05rem;
}

.glossary-english {
    font-weight: 400;
    font-size: 0.85rem;
    margin-left: 8px;
}

.glossary-entry dd {
    margin: 4px 0 0 0;
}

.glossary-where {
    display: block;
    margin-top: 2px;
}

.cheat-contents ul {
    padding-left: 1.2rem;
    margin: 4px 0 0 0;
}

.cheat-contents a, .cheat-where {
    color: var(--mud-palette-primary);
    text-decoration: underline;
}

.cheat-entry {
    scroll-margin-top: 80px;
}

.cheat-formulas {
    margin: 8px 0;
}

.cheat-code {
    overflow-x: auto;
    max-width: 100%;
    background: var(--mud-palette-background-gray);
    border-radius: 4px;
    padding: 8px 12px;
}

.cheat-code pre {
    margin: 0;
    font-size: 0.85rem;
}

.cheat-table td code {
    white-space: nowrap;
}

.cheat-value {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    font-weight: 500;
}

@media print {
    .cheat-entry {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #999;
    }

    .cheat-table td code {
        white-space: normal;
        word-break: break-all;
    }
}

/* ---- Explorer embeds (/embed/explore/{slug}) and "Embed this" ----
   The embed sits in another site's iframe: no app bar or drawer, 12 px of padding, the parameters and question beside
   the chart from 600 px, stacked below that, down to 320 px without sideways scrolling. */
.embed-main {
    padding: 12px;
    min-height: 100vh;
    background: var(--mud-palette-background);
    overflow-x: hidden;
}

.embed-main:focus {
    outline: none;
}

.embed-explorer {
    background: var(--mud-palette-surface);
}

.embed-title {
    margin-bottom: 4px;
    line-height: 1.3;
}

/* The embed's chart is 250 px high (DistributionExplorer's ChartHeight), not the full page's 340. */
.embed-explorer .live-chart {
    min-height: 250px;
}

.embed-explorer .readout-main {
    font-size: 1.25rem;
}

.embed-attribution {
    margin: 8px 0 0;
    font-size: 0.8125rem;
    text-align: right;
}

.embed-attribution a {
    color: var(--mud-palette-primary);
    text-decoration: underline;
}

.embed-dialog a {
    text-decoration: underline;
}

.embed-label {
    display: block;
    font-size: 0.875rem;
    margin-bottom: 4px;
    color: var(--mud-palette-text-secondary);
}

.embed-snippet {
    display: block;
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
    padding: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: var(--mud-palette-text-primary);
    background: var(--mud-palette-background);
    border: 1px solid var(--mud-palette-lines-inputs);
    border-radius: 4px;
    word-break: break-all;
}

.embed-options {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
}

.embed-options .embed-lang {
    min-width: 180px;
    max-width: 240px;
}

.embed-preview {
    display: block;
    border: 1px solid var(--mud-palette-lines-default) !important;
    border-radius: 4px;
    background: var(--mud-palette-background);
}

.embed-steps {
    padding-left: 1.5rem;
}

.embed-steps li {
    margin-bottom: 6px;
}

/* "Ask the lab" (AG2): the button in the app bar, and its panel as a sheet on the right, full height. */
.ask-the-lab-button {
    text-transform: none;
    white-space: nowrap;
    min-width: 0;
}

@media (max-width: 900px) {
    /* Icon only on narrow screens; the button keeps its name (aria-label). */
    .ask-the-lab-label {
        display: none;
    }

    .ask-the-lab-button .mud-button-icon-start {
        margin: 0;
    }
}

.mud-dialog.tutor-dialog {
    margin: 0;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    width: min(480px, 100vw);
    max-width: 100vw;
    border-radius: 0;
    display: flex;
    flex-direction: column;
}

.tutor-dialog .tutor-content {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.tutor-thread {
    flex: 1 1 auto;
    margin-top: 12px;
}

.tutor-exchange {
    margin-bottom: 16px;
}

.tutor-question {
    margin: 0 0 6px auto;
    padding: 8px 12px;
    max-width: 90%;
    width: fit-content;
    border-radius: 12px 12px 2px 12px;
    background: var(--mud-palette-primary);
    color: var(--mud-palette-primary-text);
    overflow-wrap: anywhere;
}

.tutor-answer {
    padding: 8px 12px;
    border-radius: 12px 12px 12px 2px;
    background: var(--mud-palette-background-gray);
    overflow-wrap: anywhere;
}

.tutor-answer p {
    margin: 0 0 8px;
}

.tutor-answer a {
    color: var(--mud-palette-primary);
    text-decoration: underline;
}

.tutor-answer code {
    font-size: 0.875em;
}

.tutor-setups {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 4px 0 8px;
}

.tutor-setups .mud-button-root {
    text-transform: none;
    white-space: normal;
    text-align: left;
}

.tutor-sources-title {
    margin: 8px 0 2px;
    font-size: 0.8125rem;
}

.tutor-sources {
    margin: 0 0 4px;
    padding-left: 20px;
}

.tutor-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}

.tutor-thanks {
    font-size: 0.8125rem;
}

.tutor-form {
    margin-top: 12px;
    position: sticky;
    bottom: 0;
    background: var(--mud-palette-surface);
    padding-top: 8px;
}

.tutor-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

@media print {
    .tutor-dialog, .mud-dialog-container:has(.tutor-dialog) {
        display: none !important;
    }
}

/* ---- The Legal page, and the tutor's notice at the top of its panel ---- */

.legal section + section {
    margin-top: 1.75rem;
}

.legal .legal-part {
    font-weight: 500;
}

/* One line, set apart from the panel's text by the primary rule, so the notice is clear and distinguishable. */
.tutor-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    border-left: 4px solid var(--mud-palette-primary);
    background: var(--mud-palette-background);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
}

.tutor-notice a {
    color: var(--mud-palette-primary);
    text-decoration: underline;
}

/* The provider's details on the Legal page, and each processing item of the privacy notice: label, then value. */
.legal dl {
    display: grid;
    grid-template-columns: minmax(7rem, max-content) 1fr;
    gap: 0.25rem 1rem;
    margin: 0.5rem 0 0;
}

.legal dt {
    font-weight: 500;
}

.legal dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.legal h3 {
    margin-top: 1.25rem;
}

@media (max-width: 600px) {
    .legal dl {
        grid-template-columns: 1fr;
    }

    .legal dd {
        margin-bottom: 0.5rem;
    }
}
