:root {
    --ink: #111827;
    --muted: #5c6778;
    --paper: #ffffff;
    --canvas: #e9eef4;
    --primary: #123a63;
    --primary-hover: #0b2c4d;
    --border: #1f2937;
    --focus: #0b6fc2;
    --danger: #b42318;
    --shadow: 0 12px 35px rgb(20 40 65 / 12%);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    font-size: 16px;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--canvas);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

button,
input {
    font: inherit;
}

button {
    touch-action: manipulation;
}

.skip-link {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 1000;
    padding: 10px 14px;
    color: #fff;
    background: var(--primary);
    border-radius: 6px;
    transform: translateY(-150%);
}

.skip-link:focus {
    transform: translateY(0);
}

:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.assessment-shell {
    width: min(100%, 1120px);
    margin: 0 auto;
    padding: 20px 16px 56px;
}

.form-notice {
    position: sticky;
    top: 12px;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    width: min(100%, 1046px);
    margin: 0 auto 16px;
    padding: 12px 16px;
    color: #fff;
    background: rgb(18 58 99 / 96%);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgb(18 58 99 / 20%);
    backdrop-filter: blur(8px);
}

.form-notice > div:first-child {
    display: grid;
    gap: 2px;
}

.form-notice strong {
    font-size: 1rem;
}

.form-notice span {
    color: #e0eaf4;
    font-size: .84rem;
}

.form-notice span[data-state="success"] {
    color: #c9f7d6;
}

.form-notice span[data-state="error"] {
    color: #ffd2cc;
    font-weight: 700;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.score-summary {
    min-width: 178px;
    color: #fff;
    font-weight: 700;
    text-align: right;
}

.button {
    min-height: 44px;
    padding: 9px 14px;
    border: 1px solid transparent;
    border-radius: 7px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease;
}

.button-primary {
    color: var(--primary);
    background: #fff;
}

.button-primary:hover {
    background: #e8f1fa;
}

.button-secondary {
    color: #fff;
    background: transparent;
    border-color: #a9c0d7;
}

.button-secondary:hover {
    background: rgb(255 255 255 / 12%);
}

.button:disabled {
    cursor: wait;
    opacity: .55;
}

.paper {
    position: relative;
    width: min(100%, 1046px);
    min-height: 1478px;
    margin: 0 auto 24px;
    padding: 74px 68px 64px;
    color: #000;
    background: var(--paper);
    box-shadow: var(--shadow);
    font-family: "Times New Roman", Times, serif;
    font-size: 18px;
    line-height: 1.28;
}

.document-header {
    display: grid;
    grid-template-columns: 172px 1fr 315px;
    min-height: 163px;
    border: 1px solid #000;
}

.logo-cell,
.document-identity,
.document-meta {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-cell {
    border-right: 1px solid #000;
}

.logo-cell img {
    display: block;
    width: 150px;
    height: auto;
}

.document-identity {
    display: grid;
    grid-template-rows: 56px 1fr;
    text-align: center;
}

.document-identity strong {
    align-self: center;
    font-size: 21px;
}

.document-identity span {
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-top: 1px solid #000;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.15;
}

.document-meta {
    align-content: center;
    display: grid;
    gap: 2px;
    padding: 14px 10px;
    border-left: 1px solid #000;
    font-size: 17px;
}

.document-meta div {
    display: flex;
    gap: 5px;
}

.document-meta dt,
.document-meta dd {
    margin: 0;
}

.form-code {
    margin: 52px 0 28px;
    font-size: 20px;
    font-weight: 700;
    text-align: center;
}

.national-heading {
    display: grid;
    grid-template-columns: 1fr 1.35fr;
    gap: 40px;
    margin-bottom: 34px;
    text-align: center;
}

.national-heading p {
    margin: 0;
    font-size: 18px;
}

.national-heading strong {
    font-size: 19px;
}

.national-heading .independence {
    display: inline-block;
    padding: 0 6px 5px;
    border-bottom: 1px solid #000;
    font-weight: 700;
}

.faculty-heading {
    display: inline-block;
    margin-top: 2px;
    font-weight: 700;
}

.faculty-heading span,
.student-fields label span {
    color: var(--danger);
    font-family: Arial, sans-serif;
}

.national-heading input {
    width: 185px;
    min-height: 34px;
    padding: 2px 5px;
    border: 0;
    border-bottom: 1px solid #000;
    border-radius: 0;
    background: transparent;
}

.field-error {
    display: block;
    color: var(--danger);
    font-family: Arial, sans-serif;
    font-size: 12px;
}

.paper h1 {
    margin: 0 0 14px;
    font-size: 23px;
    text-align: center;
}

.student-fields {
    display: grid;
    grid-template-columns: auto minmax(150px, 2.3fr) auto minmax(105px, 1fr) auto minmax(70px, .7fr) auto minmax(120px, 1.4fr);
    align-items: end;
    gap: 5px 6px;
    margin: 0 0 42px;
    padding: 0;
    border: 0;
    font-style: italic;
}

.student-fields input,
.faculty-copy {
    width: 100%;
    min-width: 0;
    min-height: 36px;
    padding: 3px 4px;
    border: 0;
    border-bottom: 2px dotted #111;
    border-radius: 0;
    background: transparent;
}

.faculty-copy {
    display: block;
    font-style: normal;
    overflow-wrap: anywhere;
}

.table-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 100px 127px 116px;
    grid-template-rows: 37px 60px;
    border: 1px solid var(--border);
    text-align: center;
}

.table-heading > span {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    border-left: 1px solid var(--border);
}

.table-heading > span:first-child {
    grid-row: 1 / 3;
    border-left: 0;
}

.table-heading .points-title {
    grid-column: 2 / 5;
    border-bottom: 1px solid var(--border);
}

.table-heading > span:nth-child(3) {
    grid-column: 2;
}

.assessment-section h2 {
    margin: 13px 9px 9px;
    font-size: 17px;
    font-weight: 400;
    line-height: 1.25;
}

.assessment-section h2 strong {
    font-weight: 700;
}

.criteria-table {
    border: 1px solid var(--border);
    border-bottom: 0;
}

.criterion-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 100px 127px 116px;
    min-height: 52px;
    border-bottom: 1px dotted #555;
}

.criterion-row:last-child {
    border-bottom-style: solid;
}

.criterion-content,
.standard-score,
.self-score,
.class-score {
    padding: 8px 10px;
}

.criterion-content {
    overflow-wrap: anywhere;
}

.criterion-content em {
    display: block;
    margin-top: 6px;
}

.standard-score,
.self-score,
.class-score {
    display: flex;
    align-items: center;
    justify-content: center;
    border-left: 1px solid var(--border);
    text-align: center;
}

.standard-score > span,
.self-score label,
.class-score > span {
    display: none;
}

.standard-score b,
.class-score b {
    font-weight: 400;
}

.standard-score-list {
    line-height: 2.2;
}

.self-score input {
    width: 78px;
    min-height: 44px;
    padding: 5px;
    border: 1px solid #64748b;
    border-radius: 4px;
    color: #000;
    background: #fff;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
}

.self-score input:hover {
    border-color: #000;
}

.self-score input[aria-invalid="true"] {
    border: 2px solid var(--danger);
    background: #fff1f0;
}

.criterion-row-tall {
    min-height: 118px;
}

.score-options {
    display: grid;
    gap: 4px;
    margin: 7px 0 0 56px;
    padding: 0;
    list-style: "- ";
}

.score-options b {
    display: none;
}

.criterion-note {
    display: block;
    margin: 7px 0 0 8px;
}

.page-number {
    position: absolute;
    bottom: 18px;
    left: 0;
    width: 100%;
    margin: 0;
    text-align: center;
}

.paper-second {
    padding-top: 74px;
}

.table-heading-repeated {
    margin-bottom: 30px;
}

.document-note {
    margin: 12px 10px 54px;
    font-size: 17px;
    font-style: italic;
    font-weight: 700;
}

.conclusion {
    width: 72%;
    margin: 0 auto 18px;
    font-size: 18px;
}

.conclusion p {
    display: flex;
    align-items: end;
    gap: 6px;
    margin: 8px 0;
}

.conclusion span {
    flex: 1;
    min-width: 80px;
    border-bottom: 2px dotted #111;
}

#totalScore {
    min-width: 84px;
    padding: 0 10px;
    border-bottom: 2px dotted #111;
    font-weight: 700;
    text-align: center;
}

.signatures {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    text-align: center;
}

.signatures div {
    display: grid;
}

.signatures strong {
    font-size: 19px;
}

.signatures em {
    font-size: 17px;
}

@media (max-width: 820px) {
    body {
        background: #d8dde3;
    }

    .assessment-shell {
        padding: 0 0 32px;
    }

    .form-notice {
        position: static;
        display: grid;
        gap: 8px;
        width: calc(100% - 16px);
        margin: 8px auto;
        padding: 9px 10px;
        color: #111;
        background: #fff;
        border: 1px solid #6b7280;
        border-radius: 0;
        box-shadow: none;
        backdrop-filter: none;
    }

    .form-notice span {
        color: #4b5563;
    }

    .form-notice span[data-state="success"] {
        color: #176b36;
    }

    .form-notice span[data-state="error"] {
        color: var(--danger);
    }

    .form-actions {
        display: grid;
        grid-template-columns: 1fr auto auto auto;
        width: 100%;
    }

    .score-summary {
        min-width: 0;
        color: #111;
        text-align: left;
    }

    .button {
        border-radius: 2px;
    }

    .button-primary {
        color: #fff;
        background: var(--primary);
    }

    .button-secondary {
        color: var(--primary);
        background: #fff;
        border-color: var(--primary);
    }

    .paper {
        width: calc(100% - 16px);
        min-height: 0;
        margin: 0 auto 8px;
        padding: 14px 8px 28px;
        border: 1px solid #9ca3af;
        box-shadow: 0 2px 8px rgb(15 23 42 / 12%);
        font-family: "Times New Roman", Times, serif;
        font-size: 16px;
        line-height: 1.38;
    }

    .paper-second {
        margin-top: 8px;
        border-top: 1px solid #9ca3af;
    }

    .document-header {
        grid-template-columns: 68px minmax(0, 1fr) 104px;
        min-height: 118px;
    }

    .logo-cell img {
        width: 64px;
    }

    .document-identity {
        grid-template-rows: auto auto;
    }

    .document-identity strong {
        padding: 6px 3px;
        font-size: 11px;
        line-height: 1.2;
    }

    .document-identity span {
        padding: 6px 3px;
        font-size: 10px;
        line-height: 1.18;
    }

    .document-meta {
        grid-column: auto;
        gap: 1px;
        padding: 5px;
        border-top: 0;
        border-left: 1px solid #000;
        font-size: 9.5px;
        line-height: 1.25;
    }

    .document-meta div {
        display: block;
    }

    .form-code {
        margin: 24px 0 18px;
        font-size: 16px;
    }

    .national-heading {
        grid-template-columns: 1fr 1.22fr;
        gap: 8px;
        margin-bottom: 22px;
    }

    .national-heading p,
    .national-heading strong {
        font-size: 12px;
        line-height: 1.25;
    }

    .national-heading input {
        width: min(72%, 180px);
        min-height: 44px;
        font-family: "Times New Roman", Times, serif;
    }

    .paper h1 {
        margin-bottom: 12px;
        font-size: 18px;
        line-height: 1.25;
    }

    .student-fields {
        grid-template-columns: 76px 1fr;
        gap: 4px 8px;
        margin-bottom: 22px;
        font-family: "Times New Roman", Times, serif;
        font-style: italic;
    }

    .student-fields input,
    .faculty-copy {
        min-height: 44px;
        padding: 5px 3px;
        border: 0;
        border-bottom: 2px dotted #111;
        border-radius: 0;
    }

    .faculty-copy {
        background: transparent;
    }

    .table-heading {
        display: none;
    }

    .assessment-section h2 {
        margin: 15px 2px 6px;
        padding: 0;
        color: #000;
        background: transparent;
        border-radius: 0;
        font-family: "Times New Roman", Times, serif;
        font-size: 14px;
        line-height: 1.3;
    }

    .criteria-table {
        display: block;
        border: 1px solid #000;
        border-bottom: 0;
    }

    .criterion-row,
    .criterion-row-tall {
        display: grid;
        grid-template-columns: .72fr 1fr 1fr;
        min-height: 0;
        overflow: visible;
        border: 0;
        border-bottom: 1px dotted #555;
        border-radius: 0;
        box-shadow: none;
    }

    .criterion-row:last-child {
        border-bottom: 1px solid #000;
    }

    .criterion-content {
        grid-column: 1 / -1;
        padding: 9px 8px;
        border-bottom: 1px dotted #555;
        line-height: 1.4;
    }

    .score-options {
        gap: 2px;
        margin-left: 20px;
    }

    .score-options b {
        display: inline;
        white-space: nowrap;
    }

    .standard-score,
    .self-score,
    .class-score {
        display: grid;
        gap: 4px;
        align-content: center;
        min-height: 72px;
        padding: 6px;
        background: #fff;
        font-family: "Times New Roman", Times, serif;
    }

    .standard-score {
        border-left: 0;
        justify-content: start;
        text-align: left;
    }

    .self-score,
    .class-score {
        border-left: 1px solid #000;
    }

    .standard-score > span,
    .self-score label,
    .class-score > span {
        display: block;
        color: #000;
        font-size: 11px;
        font-weight: 400;
        line-height: 1.1;
        text-transform: none;
    }

    .self-score label::after {
        content: " *";
        color: var(--danger);
        font-family: Arial, sans-serif;
        font-weight: 700;
    }

    .standard-score-list {
        line-height: 1.2;
    }

    .standard-score-list b {
        font-size: 0;
    }

    .standard-score-list b::after {
        content: "2 - 5";
        font-size: 16px;
    }

    .self-score input {
        width: 100%;
        max-width: 78px;
        min-height: 44px;
        margin: 0 auto;
        padding: 2px;
        border: 0;
        border-bottom: 1px dotted #000;
        border-radius: 0;
        background: transparent;
        font-family: "Times New Roman", Times, serif;
    }

    .class-score b {
        min-height: 44px;
        font-size: 16px;
    }

    .page-number {
        position: static;
        display: block;
        margin-top: 24px;
    }

    .table-heading-repeated {
        margin: 0;
    }

    .document-note {
        margin: 18px 2px 34px;
        font-size: 14px;
        line-height: 1.4;
    }

    .conclusion {
        width: 94%;
        margin-bottom: 24px;
        font-size: 15px;
    }

    .conclusion p {
        flex-wrap: wrap;
    }

    .signatures {
        grid-template-columns: repeat(3, 1fr);
        gap: 4px;
    }

    .signatures strong {
        font-size: 12px;
    }

    .signatures em {
        font-size: 11px;
    }
}

@media (max-width: 470px) {
    .form-notice > div:first-child span {
        display: none;
    }

    .form-actions {
        grid-template-columns: repeat(3, 1fr);
    }

    .form-actions .score-summary {
        grid-column: 1 / -1;
    }

    .button {
        width: 100%;
        min-width: 0;
        padding: 8px;
        font-size: 13px;
    }

    .score-summary {
        font-size: 13px;
    }

    .document-header {
        grid-template-columns: 62px minmax(0, 1fr) 92px;
    }

    .logo-cell img {
        width: 58px;
    }

    .document-identity strong {
        font-size: 10px;
    }

    .document-identity span {
        font-size: 9px;
    }

    .document-meta {
        font-size: 8.5px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}

@media print {
    @page {
        size: A4 portrait;
        margin: 0;
    }

    html,
    body {
        width: 210mm;
        background: #fff;
    }

    .assessment-shell {
        width: 100%;
        padding: 0;
    }

    .form-notice {
        display: none;
    }

    .paper {
        width: 210mm;
        min-height: 297mm;
        margin: 0;
        padding: 13mm 14mm 12mm;
        box-shadow: none;
        break-after: page;
        font-size: 10pt;
    }

    .paper:last-child {
        break-after: auto;
    }

    .document-header {
        grid-template-columns: 32mm 1fr 51mm;
        min-height: 30mm;
    }

    .logo-cell img {
        width: 28mm;
    }

    .document-identity strong,
    .document-identity span {
        font-size: 10pt;
    }

    .document-meta {
        font-size: 8.5pt;
    }

    .form-code {
        margin: 9mm 0 5mm;
        font-size: 11pt;
    }

    .national-heading {
        margin-bottom: 5mm;
    }

    .national-heading p,
    .national-heading strong {
        font-size: 9.5pt;
    }

    .paper h1 {
        margin-bottom: 3mm;
        font-size: 12pt;
    }

    .student-fields {
        margin-bottom: 8mm;
    }

    .table-heading {
        grid-template-columns: minmax(0, 1fr) 18mm 24mm 23mm;
        grid-template-rows: 7mm 11mm;
    }

    .criterion-row {
        grid-template-columns: minmax(0, 1fr) 18mm 24mm 23mm;
        min-height: 8mm;
    }

    .criterion-content,
    .standard-score,
    .self-score,
    .class-score {
        padding: 1.5mm 2mm;
    }

    .self-score input {
        width: 15mm;
        min-height: 7mm;
        padding: 0;
        border: 0;
        font-family: "Times New Roman", Times, serif;
        font-size: 10pt;
    }

    .assessment-section h2 {
        margin: 2.2mm 1mm 1.5mm;
        font-size: 9pt;
    }

    .criterion-row-tall {
        min-height: 19mm;
    }

    .score-options {
        gap: 1mm;
        margin: 1mm 0 0 11mm;
    }

    .paper-second {
        padding-top: 13mm;
    }

    .table-heading-repeated {
        margin-bottom: 7mm;
    }

    .document-note {
        margin: 3mm 1mm 11mm;
        font-size: 9pt;
    }

    .conclusion {
        margin-bottom: 4mm;
        font-size: 10pt;
    }

    .signatures strong {
        font-size: 10pt;
    }

    .signatures em {
        font-size: 9pt;
    }
}
