* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* The `hidden` attribute only sets `display: none` at the UA-stylesheet level,
   which any author rule setting `display` outranks. An element hidden from
   JavaScript therefore stays visible whenever it also has a class with a
   `display` in this file, which is how an answered question kept showing a
   disabled Submit button. Restored here so `el.hidden = true` means hidden
   whatever else is set on the element. */
[hidden] {
    display: none !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    color: #e8e8e8;
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #00d9ff;
}

.description {
    font-size: 1.2rem;
    color: #a0a0a0;
    margin-bottom: 2rem;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, #00d9ff 0%, #00a8cc 100%);
    color: #1a1a2e;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 217, 255, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #e8e8e8;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.challenges-grid {
    display: grid;
    gap: 1rem;
    margin-top: 1.5rem;
}

.challenge-card.is-disabled {
    opacity: 0.55;
}

.challenge-card.is-disabled:hover {
    border-color: rgba(255, 255, 255, 0.1);
    transform: none;
}

.btn-disabled {
    background: rgba(255, 255, 255, 0.08);
    color: #a0a0a0;
    cursor: not-allowed;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.notice {
    background: rgba(0, 217, 255, 0.08);
    border: 1px dashed rgba(0, 217, 255, 0.4);
    border-radius: 8px;
    color: #a0a0a0;
    padding: 1.25rem;
    text-align: center;
}

.solution {
    margin-top: 0.75rem;
    padding: 1rem;
    border-radius: 8px;
    background: rgba(0, 217, 255, 0.08);
    border-left: 3px solid #00d9ff;
    color: #cfd8dc;
    /* A numeric working arrives as several lines, one per step. HTML collapses
       the newlines into a single run, which turns the mean, every deviation and
       every square into one paragraph and hides the structure that makes the
       working worth reading. `pre-line` keeps the line breaks and still wraps. */
    white-space: pre-line;
    font-variant-numeric: tabular-nums;
}

.challenge-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.challenge-card:hover {
    border-color: #00d9ff;
    transform: translateY(-2px);
}

.challenge-card h3 {
    color: #00d9ff;
    margin-bottom: 0.5rem;
}

.challenge-card p {
    color: #a0a0a0;
    margin-bottom: 1rem;
}

.difficulty {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: rgba(0, 217, 255, 0.15);
    color: #00d9ff;
    border-radius: 20px;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.back-link {
    display: inline-block;
    color: #00d9ff;
    text-decoration: none;
    margin-bottom: 1.5rem;
}

.back-link:hover {
    text-decoration: underline;
}

.challenge-detail {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 2rem;
}

.challenge-detail h2 {
    color: #00d9ff;
    margin-bottom: 1rem;
}

.objective {
    background: rgba(0, 217, 255, 0.1);
    border-left: 3px solid #00d9ff;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 0 8px 8px 0;
}

.explanation {
    color: #a0a0a0;
    margin: 1rem 0;
}

.dataset {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    margin: 1rem 0;
    /* Wraps rather than scrolls: hiding half the data defeats the point. */
    overflow-wrap: anywhere;
}

.question {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 1.5rem 0 1rem;
}

/* Calculator */
.calculator {
    margin: 1.5rem 0;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
}

.calculator-summary {
    padding: 0.75rem 1rem;
    cursor: pointer;
    color: #00d9ff;
    font-weight: 600;
    user-select: none;
}

.calculator-body {
    padding: 0 1rem 1rem;
}

.calculator-shortcuts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.calc-chip {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 2px solid rgba(0, 217, 255, 0.5);
    background: rgba(0, 217, 255, 0.15);
    color: #00d9ff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.calc-chip:hover {
    background: rgba(0, 217, 255, 0.3);
    border-color: rgba(0, 217, 255, 0.8);
}

.calculator-display {
    display: block;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    font-family: 'Courier New', monospace;
    font-size: 1.5rem;
    text-align: right;
    min-height: 1.8em;
    overflow-x: auto;
    white-space: nowrap;
}

.calculator-error {
    min-height: 1.2em;
    margin-bottom: 0.5rem;
    color: #ff6b6b;
    font-size: 0.9rem;
}

/* Register: keep one value and reuse it while working a formula. */

.calculator-register {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding: 0.4rem 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.calculator-register .calc-chip {
    flex-shrink: 0;
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
}

.calculator-register .calc-chip:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* The kept value is the point of the row, so it is set apart from the labels
   either side of it rather than reading as one more chip. */
.calc-register-value {
    flex: 1;
    text-align: center;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
    color: #8b969c;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calc-register-value.is-set {
    color: #00d9ff;
    font-weight: 600;
}

.calculator-keypad {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}

.calc-key {
    padding: 0.85rem 0;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: #e8e8e8;
    font-size: 1.15rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.calc-key:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.3);
}

.calc-key:active {
    background: rgba(0, 217, 255, 0.3);
    border-color: rgba(0, 217, 255, 0.5);
    transform: scale(0.98);
}

.calc-key--insert {
    font-family: 'Courier New', monospace;
}

.calc-key--action {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
    color: #8b969c;
    font-weight: 400;
}

.calc-key--action:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.calc-key--wide {
    grid-column: span 2;
}

/* Operation symbols: the most used buttons, make them obvious */
.calc-key--insert[data-value="/"],
.calc-key--insert[data-value="*"],
.calc-key--insert[data-value="-"],
.calc-key--insert[data-value="+"] {
    font-size: 1.5rem;
    font-weight: 700;
    color: #00d9ff;
    background: rgba(0, 217, 255, 0.18);
    border-color: rgba(0, 217, 255, 0.45);
    box-shadow: 0 0 8px rgba(0, 217, 255, 0.15);
}

.calc-key--insert[data-value="/"]:hover,
.calc-key--insert[data-value="*"]:hover,
.calc-key--insert[data-value="-"]:hover,
.calc-key--insert[data-value="+"]:hover {
    background: rgba(0, 217, 255, 0.35);
    border-color: rgba(0, 217, 255, 0.7);
    box-shadow: 0 0 12px rgba(0, 217, 255, 0.25);
}

/* Sign toggle is a minor action, keep it discreet */
.calc-key--action[data-action="sign"] {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
    color: #8b969c;
    font-weight: 400;
}

.answer-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.answer-input {
    flex: 1 1 12rem;
    min-width: 0;
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: #e8e8e8;
    font-size: 1rem;
}

.answer-input:focus {
    outline: none;
    border-color: #00d9ff;
}

.feedback {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    font-weight: 600;
}

.feedback.correct {
    background: rgba(0, 255, 136, 0.15);
    color: #00ff88;
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.feedback.incorrect {
    background: rgba(255, 68, 68, 0.15);
    color: #ff4444;
    border: 1px solid rgba(255, 68, 68, 0.3);
}

.loading {
    text-align: center;
    color: #a0a0a0;
    padding: 2rem;
}

.error {
    background: rgba(255, 68, 68, 0.15);
    color: #ff4444;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
}

/* Mobile */
@media (max-width: 600px) {
    .container {
        padding: 1.25rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    .description {
        font-size: 1rem;
    }

    .challenge-card,
    .challenge-detail {
        padding: 1.25rem;
    }

    .answer-form {
        flex-direction: column;
    }

    .answer-form .btn {
        width: 100%;
        text-align: center;
    }
}

/* Lesson content */

/* A lesson runs to thousands of words before its first question, so the stage
   a reader is in has to be reachable without scrolling back up. The bar is
   sticky and every stage is an anchor target. */
.lesson-nav {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1.25rem 0 0.5rem;
    padding: 0.6rem 0.75rem;
    background: rgba(15, 18, 22, 0.92);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.lesson-nav-link {
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    color: #00d9ff;
    font-size: 0.9rem;
    text-decoration: none;
}

.lesson-nav-link:hover,
.lesson-nav-link:focus-visible {
    background: rgba(0, 217, 255, 0.12);
}

/* Leaves room for the sticky bar, so an anchor does not land under it. */
#theory,
#examples,
#uses,
#challenge {
    scroll-margin-top: 5rem;
}

.section-title {
    margin: 2.5rem 0 1rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    color: #00d9ff;
    font-size: 1.35rem;
}

.lesson-block {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
}

/* Theory blocks are <details>, so the title is the summary. It is the thing a
   reader clicks to fold a concept away once it has been read. */
.lesson-block h3,
.theory-title {
    margin-bottom: 0.5rem;
    color: #00d9ff;
    font-size: 1.1rem;
    cursor: pointer;
}

.lesson-block p {
    color: #c8d0d4;
}

.lesson-block--theory .problem {
    margin-bottom: 0.85rem;
    padding-left: 0.85rem;
    border-left: 3px solid rgba(0, 217, 255, 0.45);
    color: #8b969c;
    font-style: italic;
}

.steps {
    margin: 0.75rem 0 0 1.25rem;
    color: #c8d0d4;
}

.steps li {
    margin-bottom: 0.35rem;
}

.example-result {
    margin-top: 0.75rem;
    color: #00d9ff;
    font-weight: 600;
}

.meta {
    color: #8b969c;
    font-size: 0.9rem;
}

/* Notes: the theory a learner may consult while being assessed. It sits next to
   the challenge rather than up in the reading, so consulting it costs neither
   scrolling nor grade credit. Each concept starts folded, because the panel is a
   crib sheet and not the reading. */
.notes {
    margin: 1.25rem 0;
    background: rgba(0, 217, 255, 0.05);
    border: 1px solid rgba(0, 217, 255, 0.22);
    border-radius: 10px;
}

.notes-summary {
    padding: 0.85rem 1rem;
    color: #00d9ff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.notes-body {
    padding: 0 1rem 1rem;
}

.notes-body .hint {
    color: #8b969c;
    font-style: italic;
}

.notes-theory {
    margin-bottom: 0.75rem;
    padding: 0.75rem 0.9rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 8px;
}

.notes-theory .theory-title {
    font-size: 1rem;
}

/* Formulas: real typeset maths, never plain text, and never a scrollbar.
   A horizontal scroll hides part of the maths and reads as broken, so the
   type scales down on narrow screens and wraps between terms instead. */
.formula {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1rem;
    padding: 1.25rem 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 217, 255, 0.18);
    border-radius: 8px;
}

.fx {
    color: #e8e8e8;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: clamp(0.95rem, 3.6vw, 1.35rem);
    line-height: 1.25;
    text-align: center;
}

.fx-var {
    font-style: italic;
}

.fx-frac {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    vertical-align: middle;
    margin: 0 0.3em;
    /* A fraction is one unit: it never breaks across lines. */
    break-inside: avoid;
}

.fx-num {
    display: flex;
    align-items: center;
    padding: 0 0.4em 0.15em;
    border-bottom: 1px solid currentColor;
}

.fx-den {
    display: flex;
    align-items: center;
    padding: 0.15em 0.4em 0;
}

.fx-pow {
    display: inline-flex;
    align-items: flex-start;
    vertical-align: baseline;
}

.fx-pow-exp {
    font-size: 0.7em;
    transform: translateY(-0.5em);
}

.fx-sum {
    display: inline-block;
    margin-right: 0.15em;
    font-size: 1.5em;
    line-height: 1;
    vertical-align: -0.15em;
}

.fx-sqrt {
    display: inline-flex;
    align-items: center;
}

.fx-sqrt-sign {
    width: 0.75em;
    height: 1.1em;
    margin-right: 0.05em;
    color: inherit;
    overflow: visible;
}

.fx-sqrt-body {
    display: inline-flex;
    align-items: center;
    padding: 0.12em 0.2em 0;
    border-top: 1px solid currentColor;
}

/* Assessment */
#challenge:empty {
    display: none;
}

.challenge-actions {
    margin-top: 1.5rem;
}

.progress {
    margin-bottom: 1.25rem;
}

.progress-label {
    display: block;
    margin-bottom: 0.4rem;
    color: #00d9ff;
    font-size: 0.9rem;
    font-weight: 600;
}

.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00d9ff, #00a8cc);
    transition: width 0.3s ease;
}

.question-box {
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
}

.hint {
    margin: 0.5rem 0;
    color: #8b969c;
    font-size: 0.88rem;
    font-style: italic;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 1rem 0;
}

.option {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 0.9rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    cursor: pointer;
}

.option:hover {
    background: rgba(255, 255, 255, 0.09);
}

.feedback-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

/* Result */
.result-box {
    padding: 1.75rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(0, 217, 255, 0.25);
    border-radius: 12px;
}

.result-box h2 {
    margin-bottom: 0.75rem;
    color: #00d9ff;
}

.score {
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
}

.verdict {
    color: #c8d0d4;
    margin-bottom: 1.25rem;
}

.result-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.result-row {
    display: flex;
    gap: 0.6rem;
    padding: 0.75rem 0.9rem;
    border-radius: 8px;
    border-left: 3px solid transparent;
    font-size: 0.92rem;
}

.result-row.ok {
    background: rgba(0, 255, 136, 0.08);
    border-left-color: #00ff88;
}

.result-row.ko {
    background: rgba(255, 68, 68, 0.08);
    border-left-color: #ff4444;
}

.result-mark {
    font-weight: 700;
}

.result-row.ok .result-mark {
    color: #00ff88;
}

.result-row.ko .result-mark {
    color: #ff4444;
}

/* Generated questions: set number and the retry actions */
.attempt-label {
    display: block;
    margin-bottom: 0.4rem;
    color: #00d9ff;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.btn-ghost {
    background: transparent;
    color: #8b969c;
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #e8e8e8;
}

/* The account bar. Sits above the lessons and states plainly where progress is
   kept, because "is my work safe" is the first question a new learner has and an
   answer nobody gives is worse than a slow answer. */
.account-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 1.5rem 0;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
}

.account-bar--signed-in {
    border-color: rgba(0, 217, 255, 0.25);
}

.account-bar-text {
    margin: 0;
    color: #8b969c;
    font-size: 0.9rem;
}

.account-bar--signed-in .account-bar-text strong {
    color: #00d9ff;
}

/* The sign-in form. Deliberately narrow: it is a two-field form, not a page. */
.auth {
    margin: 1.5rem 0;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    max-width: 26rem;
}

.auth h2 {
    margin-top: 0;
    font-size: 1.15rem;
}

.auth-hint {
    color: #8b969c;
    font-size: 0.85rem;
}

/* What an account gets you. A list rather than a sentence: three concrete things
   are worth more than "save your progress", and this is the moment a learner
   decides whether to type a password. */
.auth-benefits {
    list-style: none;
    margin: 0 0 0.75rem;
    padding: 0;
}

.auth-benefits li {
    position: relative;
    padding-left: 1.4rem;
    margin-bottom: 0.35rem;
    color: #e8e8e8;
    font-size: 0.9rem;
}

.auth-benefits li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #00d9ff;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.auth-form label {
    font-size: 0.85rem;
    color: #8b969c;
    margin-top: 0.4rem;
}

.auth-form input {
    padding: 0.5rem 0.6rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: #e8e8e8;
    font-size: 1rem;
}

.auth-form input:focus {
    outline: 2px solid #00d9ff;
    outline-offset: 1px;
}

.auth-form button {
    margin-top: 1rem;
}

/* The mode switch. Reads as two tabs so "there is another way in here" is
   visible before either is tried. */
.auth-tabs {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-tab {
    flex: 1;
    padding: 0.4rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: #8b969c;
    font-size: 0.85rem;
    cursor: pointer;
}

.auth-tab:hover {
    color: #e8e8e8;
}

.auth-tab.is-active {
    color: #00d9ff;
    border-color: rgba(0, 217, 255, 0.4);
    background: rgba(0, 217, 255, 0.08);
}

/* Restarting a lesson. Deliberately quiet: it discards a grade, so it reads as
   an available action rather than a prominent one. */
.btn-danger {
    background: rgba(255, 68, 68, 0.15);
    color: #ff8080;
    border: 1px solid rgba(255, 68, 68, 0.4);
}

.btn-danger:hover {
    background: rgba(255, 68, 68, 0.28);
    color: #ffa0a0;
    border-color: rgba(255, 68, 68, 0.6);
}

.restart {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0;
    padding: 0.75rem 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
}

.restart-hint {
    color: #8b969c;
    font-size: 0.85rem;
}

.restart--confirm {
    display: block;
    border-color: rgba(255, 68, 68, 0.35);
}

.restart--confirm .restart-hint {
    display: block;
    margin-bottom: 0.6rem;
    color: #ffb0b0;
}

.restart-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

/* Landing page: overall progress, grade and the lesson cards */
.summary {
    margin: 1.5rem 0 2.5rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(0, 217, 255, 0.2);
    border-radius: 12px;
}

.tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
}

.tile {
    display: flex;
    flex-direction: column;
    min-width: 9rem;
}

.tile-label {
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8b969c;
}

.tile-value {
    font-size: 2rem;
    line-height: 1.2;
    color: #00d9ff;
}

.tile-hint {
    font-size: 0.8rem;
    color: #8b969c;
}

.level {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #c8d0d4;
}

.challenge-card .progress-bar {
    margin: 0.75rem 0 0.5rem;
}

.challenge-card.is-complete {
    border-color: rgba(0, 255, 136, 0.35);
}

.card-stats {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

.card-level {
    color: #c8d0d4;
}

.card-grade {
    color: #00ff88;
    font-weight: 600;
}

.final-grade {
    margin-bottom: 1.25rem;
    padding: 0.75rem 1rem;
    background: rgba(0, 217, 255, 0.08);
    border-radius: 8px;
}

.final-grade strong {
    color: #00d9ff;
    font-size: 1.3rem;
}



/* Review section: the questions the learner has not yet solved. */

.review {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
}

.review-title {
    font-size: 1.25rem;
    color: #00d9ff;
    margin-bottom: 0.5rem;
}

.review-hint {
    color: #8b969c;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.review-list {
    list-style: none;
    padding: 0;
}

.review-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
}

.review-prompt {
    flex: 1;
    color: #e8e8e8;
    font-size: 0.95rem;
}

.review-retry {
    flex-shrink: 0;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

/* Paired data: a plot of two series, and the numbers behind it. */
.scatter {
    margin: 1rem 0;
}

.scatter-frame {
    fill: none;
    stroke: var(--line, #d7d7dd);
    stroke-width: 1;
}

.scatter-point {
    fill: var(--accent, #3b5bdb);
    fill-opacity: 0.75;
}

.scatter-axis {
    fill: var(--muted, #6b7280);
    font-size: 11px;
}

.scatter-caption {
    color: var(--muted, #6b7280);
    font-size: 0.85rem;
}

.scatter-empty {
    color: var(--muted, #6b7280);
    font-style: italic;
}

.series-table {
    border-collapse: collapse;
    margin: 0.5rem 0 1rem;
}

.series-table caption {
    color: var(--muted, #6b7280);
    font-size: 0.85rem;
    text-align: left;
    padding-bottom: 0.25rem;
}

.series-table th,
.series-table td {
    border: 1px solid var(--line, #d7d7dd);
    padding: 0.2rem 0.6rem;
    text-align: right;
}

/* The administrator tab. Deliberately plain: it is a maintenance screen, and a
   learner should never be curious enough to read it. The destructive colour is
   reserved for the button that needs the name typed, not for the row itself, so
   a list of accounts does not read as a list of warnings. */
.admin {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    border: 1px solid var(--line, #d7d7dd);
    border-radius: 6px;
}

.admin-intro,
.admin-count {
    color: var(--muted, #6b7280);
    font-size: 0.9rem;
    max-width: 60ch;
}

.admin-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin: 1rem 0;
}

.admin-search {
    padding: 0.35rem 0.5rem;
    min-width: 12rem;
}

.admin-filters {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.chip {
    border: 1px solid var(--line, #d7d7dd);
    background: transparent;
    border-radius: 999px;
    padding: 0.2rem 0.7rem;
    font-size: 0.85rem;
    cursor: pointer;
}

.chip--on {
    background: var(--accent, #3d5afe);
    color: #fff;
    border-color: transparent;
}

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

.account-row {
    border-top: 1px solid var(--line, #d7d7dd);
    padding: 0.6rem 0;
}

.account-row-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.account-meta {
    color: var(--muted, #6b7280);
    font-size: 0.85rem;
}

.account-badge {
    font-size: 0.75rem;
    border: 1px solid var(--line, #d7d7dd);
    border-radius: 999px;
    padding: 0.05rem 0.5rem;
    margin-left: 0.4rem;
    color: var(--muted, #6b7280);
}

/* The confirmation sits under its own row rather than over the list, so the
   reader is looking at the name they are about to erase while they type it. */
.account-confirm {
    margin-top: 0.6rem;
    padding: 0.75rem;
    border-left: 3px solid var(--danger, #c62828);
    background: rgba(0, 0, 0, 0.03);
}

.account-confirm-text {
    margin: 0 0 0.5rem;
    max-width: 60ch;
}

.account-confirm-label,
.admin-search-label {
    display: block;
    font-size: 0.85rem;
    color: var(--muted, #6b7280);
    margin-bottom: 0.2rem;
}

.account-confirm-input {
    padding: 0.35rem 0.5rem;
    margin-right: 0.5rem;
    min-width: 14rem;
}

.account-message {
    margin: 0.5rem 0;
    padding: 0.5rem 0.75rem;
    border-left: 3px solid var(--accent, #3d5afe);
    background: rgba(0, 0, 0, 0.03);
}

.account-message--error {
    border-left-color: var(--danger, #c62828);
}

.account-empty {
    color: var(--muted, #6b7280);
    padding: 0.75rem 0;
    list-style: none;
}

/* The erasure-request queue, surfaced on the accounts page. */
.admin-waiting {
    margin: 0.75rem 0;
    padding: 0.6rem 0.9rem;
    border-left: 3px solid var(--warning, #b26a00);
    background: rgba(178, 106, 0, 0.08);
    max-width: 60ch;
}

.account-badge--waiting {
    border-color: var(--warning, #b26a00);
    color: var(--warning, #b26a00);
}

/* The gate the accounts page shows to someone who is not an administrator. */
.admin-gate {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    border: 1px solid var(--line, #d7d7dd);
    border-radius: 6px;
    max-width: 60ch;
}

.admin-gate-text {
    margin: 0;
    color: var(--muted, #6b7280);
}

.admin-back {
    color: var(--muted, #6b7280);
    font-size: 0.9rem;
}

/* The learner's own panel for asking for an erasure, at the foot of the page.
   An erasure is the one irreversible-adjacent thing a learner can do, so it is
   reachable but not prominent: smaller type, muted colour, and a quiet border,
   sitting after the lessons rather than competing with them on arrival. */
.erasure {
    margin: 2.5rem 0 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    max-width: 40rem;
    font-size: 0.85rem;
}

.erasure h2 {
    margin: 0 0 0.35rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--muted, #6b7280);
}

.erasure--requested {
    border-color: rgba(178, 106, 0, 0.35);
}

.erasure-text {
    margin: 0 0 0.6rem;
    color: var(--muted, #6b7280);
    max-width: 60ch;
    line-height: 1.45;
}

/* The ask button is deliberately understated: it is a request, not the page's
   call to action, so it reads as a quiet option rather than an invitation. */
.erasure .btn {
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
}

/* The sign-out button and the accounts link sit together, right-aligned. */
.account-bar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
