.math-learning-page {
    padding: 56px 0 72px;
}

.math-learning-stack {
    display: grid;
    gap: 28px;
}

.math-assessment-card,
.math-explanation-card,
.math-practice-card,
.math-result-card {
    background: #fff;
    border: 1px solid rgba(17, 24, 39, .1);
    border-radius: 18px;
    padding: clamp(22px, 4vw, 38px);
    box-shadow: 0 12px 32px rgba(17, 24, 39, .06);
}

.math-question-card {
    border: 0;
    border-bottom: 1px solid rgba(17, 24, 39, .09);
    margin: 0 0 24px;
    padding: 0 0 24px;
}

.math-question-card:last-of-type {
    border-bottom: 0;
}

.math-question-card legend,
.math-binary-choice legend {
    color: #172033;
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 14px;
}

.math-choice-grid,
.math-binary-choice {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.math-binary-choice {
    border: 0;
    margin: 22px 0;
    padding: 0;
}

.math-choice {
    cursor: pointer;
    position: relative;
}

.math-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.math-choice span {
    align-items: center;
    background: #f7f8fb;
    border: 1px solid rgba(17, 24, 39, .13);
    border-radius: 12px;
    display: inline-flex;
    min-height: 44px;
    padding: 9px 16px;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.math-choice input:checked + span {
    background: #eef2ff;
    border-color: #5968d8;
    box-shadow: 0 0 0 2px rgba(89, 104, 216, .13);
}

.math-choice input:focus-visible + span {
    outline: 3px solid rgba(89, 104, 216, .25);
    outline-offset: 2px;
}

.math-recovery-grid,
.math-formula-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 24px 0;
}

.math-recovery-card,
.math-example-box,
.math-rule-box,
.math-guidance-box {
    background: #f7f8fb;
    border: 1px solid rgba(17, 24, 39, .09);
    border-radius: 14px;
    padding: 20px;
}

.math-recovery-card h3 {
    margin-top: 0;
}

.math-result-card--success {
    border-left: 5px solid #2f855a;
}

.math-result-card--review {
    border-left: 5px solid #b7791f;
}

.math-secondary-link {
    display: inline-block;
    margin-top: 18px;
}

.math-practice-head {
    align-items: flex-start;
    display: flex;
    gap: 18px;
    justify-content: space-between;
}

.math-stage-badge {
    background: #eef2ff;
    border-radius: 999px;
    color: #33409c;
    font-size: .88rem;
    font-weight: 700;
    padding: 8px 12px;
    white-space: nowrap;
}

.math-progress-copy {
    margin-bottom: 8px;
}

.math-feedback,
.math-hint-line {
    border-radius: 12px;
    margin: 20px 0;
    padding: 14px 16px;
}

.math-feedback--success {
    background: #edf8f1;
    border: 1px solid rgba(47, 133, 90, .22);
}

.math-feedback--error {
    background: #fff6ed;
    border: 1px solid rgba(183, 121, 31, .24);
}

.math-hint-line {
    background: #f7f8fb;
}

.math-exercise-expression {
    align-items: center;
    background: #fbfbfd;
    border: 1px solid rgba(17, 24, 39, .09);
    border-radius: 16px;
    display: flex;
    justify-content: center;
    margin: 22px 0;
    min-height: 120px;
    overflow-x: auto;
    padding: 20px;
}

.math-exercise-expression .conceptstep-math {
    font-size: 1.45rem;
}

.math-rule-box ol,
.math-guidance-box ol {
    margin-bottom: 0;
    padding-left: 22px;
}

.math-answer-form {
    display: grid;
    gap: 16px;
}

.math-field {
    display: grid;
    gap: 7px;
    max-width: 620px;
}

.math-field > span {
    color: #172033;
    font-weight: 700;
}

.math-field input,
.math-field select {
    background: #fff;
    border: 1px solid rgba(17, 24, 39, .18);
    border-radius: 12px;
    font-size: 1rem;
    min-height: 48px;
    padding: 10px 13px;
    width: 100%;
}

.math-field input {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.math-field input:focus,
.math-field select:focus {
    border-color: #5968d8;
    box-shadow: 0 0 0 3px rgba(89, 104, 216, .12);
    outline: none;
}

.math-field--error input,
.math-field--error select,
.math-field--error .conceptstep-math-field {
    border-color: #c62828;
    box-shadow: 0 0 0 3px rgba(198, 40, 40, .12);
}

.math-binary-choice--error {
    border-radius: 12px;
    box-shadow: 0 0 0 2px #c62828, 0 0 0 5px rgba(198, 40, 40, .10);
    padding: 12px;
}

.math-input-note {
    color: #596174;
    font-size: .92rem;
    margin: 0 0 4px;
}

.conceptstep-math--display {
    display: block;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 6px 0;
    width: 100%;
}

.math-progressive-hint {
    background: #fffaf1;
    border: 1px solid rgba(183, 121, 31, .28);
    border-radius: 14px;
    margin: 18px 0;
    padding: 18px;
}

.math-progressive-hint__grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 14px;
}

.math-progressive-hint__grid > div {
    background: rgba(255, 255, 255, .72);
    border-radius: 10px;
    min-width: 0;
    overflow: hidden;
    padding: 12px;
}

.math-progressive-hint__grid .conceptstep-math--display,
.math-error-analysis-panel .conceptstep-math--display {
    box-sizing: border-box;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
}

.math-progressive-hint__grid .katex-display,
.math-error-analysis-panel .katex-display {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

.math-answer-form--with-analysis {
    align-items: start;
    column-gap: 24px;
    grid-template-columns: minmax(0, 1fr) minmax(280px, .82fr);
}

.math-answer-form--with-analysis > :not(.math-error-analysis-panel) {
    grid-column: 1;
}

.math-error-analysis-panel {
    align-self: start;
    background: #fff8f8;
    border: 1px solid rgba(198, 40, 40, .28);
    border-left: 5px solid #c62828;
    border-radius: 14px;
    grid-column: 2;
    grid-row: 1 / span 30;
    min-width: 0;
    overflow: hidden;
    padding: 18px;
}

.math-error-analysis-panel h3 {
    color: #7f1d1d;
    margin: 6px 0 14px;
}

.math-error-analysis-answer {
    background: #fff;
    border: 1px solid rgba(198, 40, 40, .16);
    border-radius: 10px;
    margin-bottom: 14px;
    min-width: 0;
    overflow: hidden;
    padding: 12px;
}

.math-error-analysis-answer p,
.math-error-analysis-support p {
    color: #6b4650;
    font-size: .9rem;
    margin-bottom: 0;
}

.math-error-analysis-list {
    margin: 10px 0 16px;
    padding-left: 20px;
}

.math-error-analysis-list li {
    margin-bottom: 7px;
}

.math-error-analysis-support {
    border-top: 1px solid rgba(198, 40, 40, .15);
    display: grid;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
    padding-top: 14px;
}

.function-graph-card {
    background: #fff;
    border: 1px solid rgba(17, 24, 39, .1);
    border-radius: 18px;
    box-shadow: 0 12px 32px rgba(17, 24, 39, .06);
    padding: clamp(20px, 3.5vw, 32px);
}

.function-graph-card__head {
    align-items: flex-start;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 18px;
}

.function-graph-card__head h3 {
    margin: 4px 0 0;
}

.function-graph-card__badge {
    background: #eef2ff;
    border-radius: 999px;
    color: #33409c;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .04em;
    padding: 6px 10px;
}

.function-graph-frame {
    background: #fbfcff;
    border: 1px solid rgba(17, 24, 39, .1);
    border-radius: 16px;
    overflow: hidden;
    width: 100%;
}

.function-graph,
.geometry-diagram {
    display: block;
    height: auto;
    max-height: 520px;
    width: 100%;
}

.function-graph__background {
    fill: #fbfcff;
}

.function-graph__grid {
    stroke: rgba(89, 104, 216, .12);
    stroke-width: 1;
}

.function-graph__axis {
    stroke: #4b5563;
    stroke-width: 1.6;
}

.function-graph__asymptote {
    stroke: #b7791f;
    stroke-dasharray: 7 6;
    stroke-width: 1.7;
}

.function-graph__curve {
    fill: none;
    stroke: #5968d8;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 3;
    vector-effect: non-scaling-stroke;
}

.function-graph__curve--secondary {
    stroke: #b7791f;
    stroke-dasharray: 9 5;
}

.function-graph__tick-label,
.function-graph__axis-label,
.function-graph__marker text {
    fill: #596174;
    font-family: ui-sans-serif, system-ui, sans-serif;
    font-size: 12px;
}

.function-graph__axis-label {
    fill: #172033;
    font-size: 14px;
    font-weight: 800;
}

.function-graph__marker circle {
    fill: #fff;
    stroke: #5968d8;
    stroke-width: 3;
    vector-effect: non-scaling-stroke;
}

.function-graph__marker--vertex circle {
    stroke: #b7791f;
}

.function-graph__marker--root circle {
    stroke: #2f855a;
}

.function-graph__marker--intersection circle {
    stroke: #c2410c;
}

.function-graph__marker--fixed circle {
    stroke: #7c3aed;
}

.function-graph__marker text {
    fill: #172033;
    font-weight: 700;
}

.function-graph-card__caption {
    color: #596174;
    margin: 14px 0 0;
}

.geometry-diagram-frame {
    background: #fcfcff;
}

.geometry-diagram__circle {
    fill: none;
    stroke: #5968d8;
    stroke-width: 2.4;
    vector-effect: non-scaling-stroke;
}

.geometry-diagram__circle--construction-arc {
    stroke: rgba(89, 104, 216, .48);
    stroke-dasharray: 7 6;
    stroke-width: 1.6;
}

.geometry-diagram__line,
.geometry-diagram__path {
    fill: none;
    stroke: #374151;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.2;
    vector-effect: non-scaling-stroke;
}

.geometry-diagram__line--altitude,
.geometry-diagram__line--perpendicular,
.geometry-diagram__line--radius,
.geometry-diagram__line--tangent-radius {
    stroke: #5968d8;
}

.geometry-diagram__line--tangent,
.geometry-diagram__line--construction-result {
    stroke: #b7791f;
    stroke-width: 2.8;
}

.geometry-diagram__line--chord,
.geometry-diagram__line--diameter,
.geometry-diagram__line--hypotenuse {
    stroke: #2f855a;
}

.geometry-diagram__path--right-angle {
    stroke: #c2410c;
    stroke-width: 1.8;
}

.geometry-diagram__path--angle-arc,
.geometry-diagram__path--highlight-arc {
    stroke: #c2410c;
    stroke-width: 2.8;
}

.geometry-diagram__point circle {
    fill: #fff;
    stroke: #172033;
    stroke-width: 2.2;
    vector-effect: non-scaling-stroke;
}

.geometry-diagram__point--center circle,
.geometry-diagram__point--foot circle,
.geometry-diagram__point--construction-point circle {
    stroke: #5968d8;
}

.geometry-diagram__point-label,
.geometry-diagram__label {
    fill: #172033;
    font-family: ui-sans-serif, system-ui, sans-serif;
    font-size: 13px;
    font-weight: 700;
}

.geometry-diagram__label--measure {
    fill: #596174;
    font-size: 12px;
}

.geometry-diagram__label--construction-label,
.geometry-diagram__label--line-name {
    fill: #b7791f;
}

@media (max-width: 900px) {
    .math-answer-form--with-analysis {
        grid-template-columns: 1fr;
    }

    .math-answer-form--with-analysis > :not(.math-error-analysis-panel),
    .math-error-analysis-panel {
        grid-column: 1;
        grid-row: auto;
    }

    .math-error-analysis-panel {
        margin-top: 6px;
    }
}

@media (max-width: 760px) {
    .math-learning-page {
        padding-top: 34px;
    }

    .math-recovery-grid,
    .math-formula-grid,
    .math-progressive-hint__grid {
        grid-template-columns: 1fr;
    }

    .math-practice-head {
        display: block;
    }

    .math-stage-badge {
        display: inline-block;
        margin-top: 10px;
    }

    .math-choice-grid,
    .math-binary-choice {
        display: grid;
        grid-template-columns: 1fr;
    }

    .math-choice span {
        width: 100%;
    }

    .function-graph-card {
        padding: 16px;
    }

    .function-graph-card__head {
        margin-bottom: 12px;
    }

    .function-graph__tick-label,
    .function-graph__marker text,
    .geometry-diagram__point-label,
    .geometry-diagram__label {
        font-size: 11px;
    }
}
