.level-diagnosis-page {
    width: min(1180px, calc(100% - 32px));
    margin: 24px auto 80px;
    color: #20252b;
}

.ld-hero,
.ld-result-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    padding: 34px 38px;
    border: 1px solid #ffd28a;
    border-radius: 18px;
    background: linear-gradient(135deg, #fffaf0 0%, #fff 70%);
}

.ld-eyebrow,
.ld-card-kicker {
    display: block;
    margin-bottom: 8px;
    color: #f37000;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
}

.ld-hero h1,
.ld-result-heading h1 {
    margin: 0 0 10px;
    font-size: 30px;
    line-height: 1.25;
}

.ld-hero p,
.ld-result-heading p {
    margin: 0;
    color: #626b76;
    font-size: 15px;
    line-height: 1.7;
}

.ld-hero-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    max-width: 360px;
}

.ld-hero-meta span {
    padding: 9px 12px;
    border-radius: 20px;
    background: #fff1d7;
    color: #7b4a00;
    font-size: 13px;
    font-weight: 700;
}

.ld-test-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 20px;
    margin-top: 20px;
}

.ld-test-main,
.ld-omr,
.ld-report-card {
    border: 1px solid #dfe3e8;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 5px 18px rgba(30, 41, 59, .06);
}

.ld-test-main {
    min-height: 610px;
    padding: 28px 32px 24px;
}

.ld-progress-head,
.ld-omr-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
}

.ld-progress-head span,
.ld-omr-title span {
    color: #667085;
}

.ld-omr-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.ld-omr-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 70px;
    min-height: 36px;
    margin-left: 12px;
    padding: 7px 11px;
    border: 1px solid #d8dde3;
    border-radius: 8px;
    background: #fff;
    color: #343a40;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.ld-omr-toggle-icon {
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(225deg) translate(-1px, -1px);
    transition: transform .2s ease;
}

.ld-omr.is-collapsed .ld-omr-toggle-icon {
    transform: rotate(45deg) translate(-1px, -1px);
}

.ld-omr.is-collapsed .ld-omr-content {
    display: none;
}

.ld-progress-track,
.ld-mini-progress,
.ld-bar-track {
    overflow: hidden;
    border-radius: 999px;
    background: #edf0f3;
}

.ld-progress-track {
    height: 8px;
    margin-bottom: 30px;
}

.ld-progress-track span,
.ld-mini-progress span,
.ld-bar-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #ff7a00, #ffb000);
    transition: width .2s ease;
}

.ld-question-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    margin-bottom: 22px;
}

.ld-question-meta span {
    padding: 5px 9px;
    border-radius: 6px;
    background: #f2f5f8;
    color: #5d6671;
    font-size: 12px;
    font-weight: 700;
}

.ld-question-meta .ld-question-no {
    background: #1f252b;
    color: #fff;
    font-size: 14px;
}

.ld-question-text {
    min-height: 78px;
    margin-bottom: 16px;
    font-size: 21px;
    font-weight: 700;
    line-height: 1.65;
}

.ld-question-text img,
.ld-question-supplement img,
.ld-choice-text img,
.ld-review-item img {
    max-width: 100%;
    height: auto;
}

.ld-question-supplement {
    margin: 0 0 18px;
    padding: 14px;
    border-radius: 10px;
    background: #f8fafc;
}

.ld-choice-list {
    display: grid;
    gap: 10px;
}

.ld-choice {
    display: flex;
    align-items: center;
    gap: 13px;
    min-height: 58px;
    padding: 12px 15px;
    border: 1px solid #dfe3e8;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.ld-choice:hover {
    border-color: #ff9b37;
    transform: translateY(-1px);
}

.ld-choice:has(input:checked) {
    border-color: #ff7a00;
    background: #fff7eb;
    box-shadow: inset 0 0 0 1px #ff7a00;
}

.ld-choice input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.ld-choice-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #eef1f4;
    font-weight: 800;
}

.ld-choice:has(input:checked) .ld-choice-number {
    background: #ff7a00;
    color: #fff;
}

.ld-choice-text {
    font-size: 16px;
    line-height: 1.55;
}

.ld-test-actions,
.ld-result-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 30px;
}

.ld-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 130px;
    min-height: 48px;
    padding: 12px 20px;
    border: 0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

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

.ld-btn-primary,
.ld-btn-submit {
    margin-left: auto;
    background: #20252b;
    color: #fff;
}

.ld-btn-secondary {
    border: 1px solid #ccd2d9;
    background: #fff;
    color: #343a40;
}

.ld-omr {
    align-self: start;
    position: sticky;
    top: 18px;
    padding: 20px;
}

.ld-omr-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
}

.ld-omr-grid button {
    aspect-ratio: 1;
    border: 1px solid #dce1e6;
    border-radius: 7px;
    background: #fff;
    color: #69727d;
    font-weight: 800;
    cursor: pointer;
}

.ld-omr-grid button.is-answered {
    border-color: #ff9a31;
    background: #fff2de;
    color: #d96200;
}

.ld-omr-grid button.is-current {
    box-shadow: inset 0 0 0 2px #20252b;
}

.ld-omr-content > p {
    margin: 14px 0 0;
    color: #8a929c;
    font-size: 11px;
    line-height: 1.5;
}

.ld-result-hero {
    justify-content: flex-start;
}

.ld-result-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 0 0 170px;
    min-height: 145px;
    border-radius: 14px;
    background: #ff7a00;
    color: #fff;
}

.ld-result-score > span {
    font-size: 13px;
    font-weight: 700;
}

.ld-result-score > strong {
    font-size: 54px;
    line-height: 1.15;
}

.ld-result-score small {
    font-size: 18px;
}

.ld-result-heading {
    flex: 1;
}

.ld-report-grid {
    display: grid;
    grid-template-columns: 1fr 1.35fr;
    gap: 20px;
    margin-top: 20px;
}

.ld-report-card {
    padding: 28px 30px;
}

/*
 * sh-css-studyroom.css resets body section padding with a more specific
 * selector. Restore card spacing only for the two section-based report cards.
 */
.level-diagnosis-result > section.ld-report-card {
    padding: 28px 30px;
}

.ld-report-card h2 {
    margin: 0 0 12px;
    font-size: 21px;
}

.ld-type-card > strong {
    display: block;
    margin-bottom: 9px;
    color: #ff6d00;
}

.ld-type-card > p {
    margin: 0;
    color: #5e6873;
    line-height: 1.7;
}

.ld-subject-results,
.ld-type-bars {
    display: grid;
    gap: 15px;
}

.ld-result-row,
.ld-type-bar {
    display: grid;
    grid-template-columns: 145px minmax(120px, 1fr) 50px;
    align-items: center;
    gap: 12px;
}

.ld-result-row > div:first-child,
.ld-type-bar > div:first-child {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ld-result-row span,
.ld-type-bar span {
    color: #87909a;
    font-size: 12px;
}

.ld-result-row > b,
.ld-type-bar > b {
    text-align: right;
}

.ld-mini-progress,
.ld-bar-track {
    height: 9px;
}

.ld-section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.ld-section-heading p {
    margin: 0;
    color: #87909a;
    font-size: 13px;
}

.ld-type-analysis,
.ld-answer-review {
    margin-top: 20px;
}

.ld-type-bar.is-primary {
    padding: 10px 12px;
    border-radius: 9px;
    background: #fff7eb;
}

.ld-review-list {
    display: grid;
    gap: 10px;
}

.ld-review-item {
    display: grid;
    grid-template-columns: 38px 1fr;
    gap: 12px;
    padding: 15px 17px;
    border: 1px solid #e2e6ea;
    border-radius: 10px;
}

.ld-review-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-weight: 900;
}

.ld-review-item.is-correct .ld-review-status {
    background: #e7f8ef;
    color: #07814c;
}

.ld-review-item.is-wrong .ld-review-status {
    background: #fff0f0;
    color: #d7353d;
}

.ld-review-item > div > span,
.ld-review-item p {
    color: #7b8490;
    font-size: 12px;
}

.ld-review-item h3 {
    margin: 5px 0;
    font-size: 15px;
    line-height: 1.55;
}

.ld-review-item p {
    margin: 0;
}

.ld-result-actions {
    justify-content: center;
}

@media (max-width: 900px) {
    html.level-diagnosis-screen,
    html.level-diagnosis-screen body {
        min-width: 0 !important;
        overflow-x: hidden;
    }

    html.level-diagnosis-screen .body-wrap {
        display: block !important;
        width: 100%;
        min-width: 0 !important;
        min-height: 0;
    }

    html.level-diagnosis-screen .body-wrap > .sidebar {
        display: none !important;
    }

    .level-diagnosis-page {
        width: min(100% - 20px, 720px);
        margin-top: 12px;
    }

    .ld-hero,
    .ld-result-hero {
        align-items: flex-start;
        flex-direction: column;
        padding: 25px 22px;
    }

    .ld-hero h1,
    .ld-result-heading h1 {
        font-size: 24px;
    }

    .ld-hero-meta {
        justify-content: flex-start;
        max-width: none;
    }

    .ld-test-shell,
    .ld-report-grid {
        grid-template-columns: 1fr;
    }

    .ld-omr {
        position: sticky !important;
        top: 0;
        z-index: 30;
        grid-row: 1;
        width: calc(100% + 20px);
        max-width: none;
        margin-left: -10px;
        box-sizing: border-box;
        border-right: 0;
        border-left: 0;
        border-radius: 0 0 16px 16px;
        box-shadow: 0 8px 24px rgba(30, 41, 59, .14);
    }

    .ld-omr-title {
        margin-bottom: 12px;
    }

    .ld-omr.is-collapsed .ld-omr-title {
        margin-bottom: 0;
    }

    .ld-omr-summary {
        width: auto;
        flex: 1;
        gap: 14px;
        justify-content: flex-start;
    }

    .ld-omr-toggle {
        display: inline-flex;
    }

    .ld-omr-grid {
        grid-template-columns: repeat(8, 1fr);
    }

    .ld-test-main,
    .ld-report-card {
        padding: 22px 18px;
    }

    .level-diagnosis-result > section.ld-report-card {
        padding: 22px 18px;
    }

    .ld-question-text {
        font-size: 18px;
    }

    .ld-result-score {
        flex-basis: auto;
        width: 150px;
        min-height: 120px;
    }

    .ld-section-heading {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 560px) {
    .level-diagnosis-page {
        width: calc(100% - 24px);
        margin: 10px auto 44px;
    }

    .ld-hero,
    .ld-result-hero {
        gap: 18px;
        padding: 20px 16px;
        border-radius: 14px;
    }

    .ld-hero h1,
    .ld-result-heading h1 {
        margin-bottom: 8px;
        font-size: 21px;
    }

    .ld-hero p,
    .ld-result-heading p {
        font-size: 13px;
        line-height: 1.6;
    }

    .ld-hero-meta {
        gap: 6px;
    }

    .ld-hero-meta span {
        padding: 8px 10px;
        font-size: 12px;
    }

    .ld-test-shell,
    .ld-report-grid {
        gap: 12px;
        margin-top: 12px;
    }

    .ld-test-main {
        min-height: 0;
        padding: 20px 16px 18px;
    }

    .ld-omr,
    .ld-report-card,
    .level-diagnosis-result > section.ld-report-card {
        padding: 18px 16px;
    }

    .ld-omr {
        width: calc(100% + 24px);
        margin-left: -12px;
    }

    .ld-omr.is-collapsed {
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .ld-omr-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    .ld-omr-grid button {
        min-height: 42px;
        aspect-ratio: auto;
    }

    .ld-progress-track {
        margin-bottom: 22px;
    }

    .ld-question-meta {
        gap: 5px;
        margin-bottom: 16px;
    }

    .ld-question-meta span {
        padding: 4px 7px;
        font-size: 11px;
    }

    .ld-question-text {
        min-height: 0;
        margin-bottom: 14px;
        overflow-wrap: anywhere;
        font-size: 17px;
        line-height: 1.55;
    }

    .ld-question-text mjx-container,
    .ld-question-supplement mjx-container,
    .ld-choice-text mjx-container {
        max-width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .ld-choice-list {
        gap: 8px;
    }

    .ld-choice {
        min-height: 52px;
        padding: 10px 12px;
    }

    .ld-choice-number {
        flex-basis: 28px;
        width: 28px;
        height: 28px;
    }

    .ld-choice-text {
        min-width: 0;
        overflow-wrap: anywhere;
        font-size: 14px;
    }

    .ld-test-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        margin-top: 22px;
    }

    .ld-test-actions .ld-btn {
        width: 100%;
        min-width: 0;
        margin-left: 0;
        padding-right: 10px;
        padding-left: 10px;
    }

    .ld-test-actions .ld-btn-submit {
        grid-column: 1 / -1;
    }

    .ld-result-score {
        width: 132px;
        min-height: 108px;
    }

    .ld-result-score > strong {
        font-size: 44px;
    }

    .ld-result-row,
    .ld-type-bar {
        grid-template-columns: 92px minmax(70px, 1fr) 38px;
        gap: 8px;
    }

    .ld-report-card h2 {
        font-size: 18px;
    }

    .ld-review-item {
        grid-template-columns: 34px minmax(0, 1fr);
        gap: 10px;
        padding: 13px;
    }

    .ld-choice {
        align-items: flex-start;
    }
}
