body {
    background: #f6f8fb;
}

.app-panel {
    background: #fff;
    border: 1px solid #dfe5ee;
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(20, 40, 80, 0.05);
}

.answer-box {
    min-height: 170px;
    font-family: Consolas, "Courier New", monospace;
    border: 0;
    border-radius: 0;
    resize: vertical;
}

.response-box {
    border: 1px solid #cfd8e6;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.response-box:focus-within {
    border-color: #86b7fe;
    box-shadow: 0 0 0 .2rem rgba(13, 110, 253, .12);
}

.response-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .75rem;
    border-top: 1px solid #e5ebf3;
    background: #f8fafc;
}

.hidden-file-input {
    max-width: 280px;
}

.inline-preview {
    padding: .75rem;
    border-top: 1px solid #e5ebf3;
    background: #fbfdff;
}

.exam-section {
    border-top: 1px solid #dfe5ee;
    padding-top: 1.5rem;
}

.exam-section-header {
    margin-bottom: 1rem;
}

.exam-statement {
    white-space: pre-wrap;
    background: #f8fafc;
    border: 1px solid #dfe5ee;
    border-radius: 8px;
    padding: 1rem;
    font-size: .92rem;
}

.question-card,
.answer-review {
    background: #fff;
    border: 1px solid #dfe5ee;
    border-radius: 8px;
    padding: 1rem;
}

.question-card:focus-within {
    border-color: #86b7fe;
    box-shadow: 0 0 0 .2rem rgba(13, 110, 253, .12);
}

.home-shell {
    max-width: 980px;
    margin: 4rem auto;
}

.home-intro {
    max-width: 720px;
    margin-bottom: 2rem;
}

.home-intro h1 {
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 1;
    margin-bottom: 1rem;
}

.home-intro p {
    color: #526070;
    font-size: 1.15rem;
}

.role-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 160px;
    padding: 1.5rem;
    color: #172033;
    text-decoration: none;
    background: #fff;
    border: 1px solid #dfe5ee;
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(20, 40, 80, 0.06);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.role-card:hover {
    color: #172033;
    border-color: #8fb2e8;
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(20, 40, 80, 0.1);
}

.role-card strong {
    display: block;
    font-size: 1.35rem;
    margin-bottom: .25rem;
}

.role-card small {
    color: #5c6878;
    font-size: 1rem;
}

.role-icon {
    display: grid;
    place-items: center;
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
    color: #fff;
    background: #0d6efd;
    border-radius: 8px;
    font-size: 1.7rem;
    font-weight: 700;
}

.role-teacher .role-icon {
    background: #198754;
}

.paste-zone {
    border: 2px dashed #aab7ca;
    border-radius: 8px;
    background: #f9fbfe;
    padding: 1rem;
}

.paste-zone.is-pasted {
    border-color: #198754;
    background: #f3fbf7;
}

.preview-grid {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    align-items: stretch;
}

.preview-item {
    resize: both;
    overflow: auto;
    width: min(100%, 520px);
    min-width: 120px;
    max-width: 100%;
    min-height: 100px;
    max-height: 720px;
    border: 1px solid #d8e0ec;
    border-radius: 6px;
    background: #fff;
    padding: .35rem;
}

.preview-item img {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 90px;
    object-fit: contain;
    user-select: none;
}

.submitted-image-grid {
    display: grid;
    gap: .75rem;
    grid-template-columns: 1fr;
}

.submitted-image {
    width: 100%;
    max-height: none;
    object-fit: contain;
    border: 1px solid #d8e0ec;
    border-radius: 6px;
    background: #fff;
}

.correction-layout .answer-review pre {
    min-height: 160px;
    font-size: .96rem;
}

.correction-layout .rubric-table {
    font-size: .9rem;
}

.correction-layout .rubric-level {
    padding: .65rem !important;
}

.correction-layout .rubric-feedback {
    min-height: 56px;
}

.rubric-feedback {
    min-height: 72px;
}

.rubric-table th,
.rubric-table td {
    vertical-align: top;
}

.rubric-level {
    cursor: pointer;
    transition: background-color .15s ease, box-shadow .15s ease;
}

.rubric-level input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.rubric-level.selected {
    background: #d1e7dd !important;
    box-shadow: inset 0 0 0 3px #198754;
}

.rubric-level-print.selected {
    background: #d1e7dd !important;
    box-shadow: inset 0 0 0 3px #198754;
}

.print-level-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
    padding: .75rem;
}

.rubric-level-print {
    min-height: 96px;
    padding: .85rem;
    border: 1px solid #b9c5d6;
    border-radius: 8px;
    background: #fff;
}

.rubric-level:hover {
    background: #eef4ff;
}

.score-pill {
    min-width: 5rem;
}

.final-grade-box {
    display: inline-block;
    min-width: 180px;
    padding: 1rem 1.25rem;
    border: 2px solid #198754;
    border-radius: 8px;
    background: #f3fbf7;
    text-align: center;
}

.final-grade-box.compact {
    flex: 0 0 auto;
}

.final-grade-number {
    color: #0f5132;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
}

@media print {
    body {
        background: #fff;
    }

    .no-print,
    .navbar {
        display: none !important;
    }

    main.container {
        max-width: none;
        width: 100%;
        padding: 0 !important;
    }

    .app-panel {
        border: 0;
        box-shadow: none;
    }

    .answer-review,
    .question-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .submitted-image {
        max-height: none;
    }

    .print-rubric {
        font-size: .78rem;
    }

    .print-rubric th,
    .print-rubric td {
        padding: .35rem;
    }

    .rubric-level-print.selected,
    .rubric-level.selected {
        background: #d1e7dd !important;
        box-shadow: inset 0 0 0 2px #198754 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .print-level-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: .35rem !important;
        padding: .5rem !important;
    }

    .rubric-level-print {
        border: 1px solid #7f8da0 !important;
        border-radius: 6px !important;
        min-height: 64px;
        padding: .4rem !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .final-grade-box {
        background: #f3fbf7 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
