.sah-page-shell {
    width: min(100% - 32px, 1366px);
    margin: 0 auto;
    padding: 24px 0 60px;
}

.sah-lesson-grid {
    display: grid;
    grid-template-columns: var(--sah-sidebar-width) minmax(0, 1fr) var(--sah-right-rail-width);
    gap: var(--sah-layout-gap);
    align-items: start;
}

.sah-lesson-main {
    min-width: 0;
}

.sah-test-card {
    background: #fff;
    border: 1px solid var(--sah-border);
    border-radius: 8px;
    padding: 34px;
}

.sah-test-card__eyebrow {
    color: var(--sah-purple);
    font-size: 14px;
    font-weight: 800;
    letter-spacing: .08em;
}

.sah-test-card h1 {
    margin: 8px 0 12px;
    font-size: clamp(32px, 4vw, 48px);
    line-height: 1.08;
    letter-spacing: -.04em;
}

.sah-test-card p {
    max-width: 720px;
    margin: 0 0 18px;
    color: #514b5c;
    font-size: 17px;
}

.sah-test-check {
    margin-top: 24px;
    padding: 18px;
    border: 1px solid #e8d8f2;
    border-radius: 8px;
    background: #fcf7ff;
}

.sah-test-check strong {
    color: #5f00dc;
}

@media (max-width: 1000px) {
    .sah-lesson-grid {
        grid-template-columns: var(--sah-sidebar-width) minmax(0, 1fr);
    }
}

@media (max-width: 760px) {
    .sah-page-shell {
        width: calc(100% - 20px);
        padding: 18px 0 40px;
    }

    .sah-lesson-grid {
        display: block;
    }

    .sah-lesson-main {
        width: 100%;
    }

    .sah-test-card {
        padding: 24px 18px;
    }

    .sah-test-card h1 {
        font-size: 34px;
    }

    .sah-test-card p {
        font-size: 16px;
    }
}

/* Final responsive hardening: lesson pages must never create document-wide horizontal overflow. */
html, body {
    max-width: 100%;
    overflow-x: clip;
}

.sah-page-shell,
.sah-lesson-grid,
.sah-lesson-main {
    max-width: 100%;
    min-width: 0;
}

@media (max-width: 760px) {
    .sah-page-shell {
        width: calc(100% - 20px);
        max-width: calc(100vw - 20px);
        overflow: visible;
    }

    .sah-lesson-grid {
        width: 100%;
        display: block;
    }

    .sah-lesson-main {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }
}


/* Global intrinsic-width protection for lesson content.
   Prevent any grid/flex child from widening the shared 3-column lesson layout. */
.sah-lesson-main,
.sah-lesson-main * {
    min-width: 0;
    box-sizing: border-box;
}

.sah-lesson-main pre,
.sah-lesson-main img,
.sah-lesson-main svg,
.sah-lesson-main video,
.sah-lesson-main iframe {
    max-width: 100%;
}

.sah-lesson-main pre {
    overflow-x: auto;
}

@media (max-width: 760px) {
    .sah-lesson-main {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .sah-lesson-main pre {
        white-space: pre-wrap;
        overflow-wrap: anywhere;
        word-break: break-word;
    }
}
