:root {
    --brand: #146c43;
    --brand-dark: #0f5132;
    --accent: #2454c6;
    --bg: #f4f7fb;
    --panel: #ffffff;
    --ink: #111827;
    --muted: #5d6878;
    --line: #d8deea;
    --danger: #b42318;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: "Segoe UI", Arial, sans-serif;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    background: var(--brand);
    color: #ffffff;
    font-weight: 900;
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
}

textarea {
    min-height: 96px;
    padding-top: 10px;
    resize: vertical;
}

.portal-shell {
    width: min(1180px, calc(100% - 28px));
    margin: 0 auto;
    padding: clamp(18px, 4vw, 46px) 0;
}

.portal-home,
.portal-view,
.dashboard {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 18px 40px rgba(17, 24, 39, 0.08);
}

.portal-home {
    display: grid;
    min-height: calc(100vh - 92px);
    place-items: center;
    align-content: center;
    gap: 16px;
    padding: clamp(28px, 8vw, 76px);
    text-align: center;
}

.school-logo {
    display: grid;
    width: 112px;
    height: 112px;
    place-items: center;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #eefbf4;
    color: var(--brand);
    font-weight: 900;
}

.school-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.school-logo.small {
    width: 70px;
    height: 70px;
    margin-bottom: 18px;
}

.eyebrow {
    margin: 0;
    color: var(--brand);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: clamp(2.2rem, 7vw, 5.2rem);
    line-height: 1;
}

h2 {
    margin-bottom: 4px;
    font-size: clamp(1.4rem, 3vw, 2.4rem);
}

.powered,
.status-line,
.muted {
    color: var(--muted);
}

.home-actions {
    display: grid;
    width: min(420px, 100%);
    gap: 12px;
}

.home-actions button {
    font-size: 1rem;
}

.portal-view {
    padding: clamp(18px, 4vw, 34px);
}

.portal-view.compact {
    width: min(680px, 100%);
    margin: 0 auto;
}

.view-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}

.icon-btn,
.secondary {
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--brand);
}

.primary {
    background: var(--brand);
    color: #ffffff;
}

.portal-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.portal-form.single {
    grid-template-columns: 1fr;
}

label {
    display: grid;
    gap: 7px;
    color: #344054;
    font-size: 0.88rem;
    font-weight: 900;
}

.wide {
    grid-column: 1 / -1;
}

.inline-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.school-strip,
.result-panel,
.tab-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f9fbff;
}

.school-strip {
    grid-column: 1 / -1;
    padding: 12px;
}

.check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 8px;
}

.check-grid label {
    display: flex;
    min-height: 42px;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    font-weight: 700;
}

.check-grid input {
    width: 18px;
    min-height: 18px;
}

.passport-preview {
    width: 112px;
    height: 112px;
    border: 1px solid var(--line);
    border-radius: 8px;
    object-fit: cover;
}

.result-panel {
    margin-top: 18px;
    padding: 16px;
}

.dashboard {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: calc(100vh - 92px);
    overflow: hidden;
}

.student-card {
    padding: 22px;
    border-right: 1px solid var(--line);
    background: #ffffff;
}

.passport-large {
    width: 132px;
    height: 132px;
    border: 1px solid var(--line);
    border-radius: 8px;
    object-fit: cover;
}

.dashboard-main {
    min-width: 0;
    padding: 22px;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.tabs button {
    min-height: 38px;
    padding: 0 12px;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--ink);
    font-size: 0.9rem;
}

.tabs button.active {
    background: var(--brand);
    color: #ffffff;
}

.tab-panel {
    padding: 18px;
}

.profile-grid,
.result-grid,
.announcement-list {
    display: grid;
    gap: 10px;
}

.profile-grid {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.fact,
.result-card,
.announcement {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.fact strong {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
}

.pass-card {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr) 132px;
    gap: 16px;
    align-items: center;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.qr {
    display: grid;
    width: 120px;
    height: 120px;
    place-items: center;
    border: 1px solid var(--line);
    background:
        linear-gradient(90deg, #111 10px, transparent 10px) 0 0 / 20px 20px,
        linear-gradient(#111 10px, transparent 10px) 0 0 / 20px 20px,
        #fff;
    color: transparent;
}

.empty {
    margin: 0;
    padding: 18px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    color: var(--muted);
    background: #ffffff;
}

.danger-text {
    color: var(--danger);
}

@media (max-width: 860px) {
    .portal-form,
    .dashboard,
    .pass-card {
        grid-template-columns: 1fr;
    }

    .student-card {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
}

@media (max-width: 520px) {
    .portal-shell {
        width: min(100% - 16px, 1180px);
        padding: 8px 0;
    }

    .portal-home,
    .portal-view,
    .dashboard-main,
    .student-card {
        padding: 16px;
    }

    .inline-field {
        grid-template-columns: 1fr;
    }
}

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

    .tabs,
    .student-card button,
    .view-head,
    .home-actions {
        display: none !important;
    }

    .portal-shell,
    .dashboard {
        width: 100%;
        padding: 0;
        border: 0;
        box-shadow: none;
    }
}

/* Student Portal Exam page */
.exam-page-wrap {
    display: grid;
    gap: 18px;
}

.exam-title-row,
.exam-card-head,
.runner-head,
.runner-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.exam-title-row h2,
.exam-card h3,
.runner-head h2 {
    margin: 0;
    color: #0b1f44;
}

.exam-profile-strip,
.exam-card,
.submit-success,
.exam-runner {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 14px 30px rgba(17, 24, 39, 0.07);
}

.exam-profile-strip {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr);
    gap: 22px;
    align-items: center;
    padding: 18px 22px;
}

.exam-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    border: 1px solid var(--line);
    object-fit: cover;
    background: #eef4ff;
}

.exam-facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px 28px;
}

.exam-facts div {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
}

.exam-facts span {
    color: #3b4b6b;
    font-size: 0.88rem;
}

.exam-facts strong {
    color: #061737;
}

.exam-card,
.exam-runner,
.submit-success {
    padding: 20px;
}

.exam-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    color: #26395f;
    font-size: 0.82rem;
}

.dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 6px;
    border-radius: 50%;
    vertical-align: middle;
}

.dot.upcoming { background: #55c271; }
.dot.now { background: #1d6df2; }
.dot.completed { background: #ff7900; }
.dot.absent { background: #e11d2e; }

.table-scroll {
    width: 100%;
    overflow-x: auto;
}

.exam-table {
    width: 100%;
    min-width: 820px;
    border-collapse: collapse;
}

.exam-table th,
.exam-table td {
    padding: 14px 12px;
    border-bottom: 1px solid #e6ebf4;
    text-align: left;
    vertical-align: middle;
}

.exam-table th {
    color: #405276;
    font-size: 0.74rem;
    text-transform: uppercase;
}

.exam-table td:first-child {
    display: flex;
    align-items: center;
    gap: 10px;
}

.subject-dot {
    display: inline-grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 50%;
    background: #1267e6;
    color: #ffffff;
    font-weight: 900;
}

.status-pill {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    padding: 0 10px;
    border: 1px solid #b8dbca;
    border-radius: 8px;
    background: #eefbf3;
    color: #057533;
    font-size: 0.8rem;
    font-weight: 900;
}

.status-pill.available-now {
    border-color: #9dc0ff;
    background: #eef5ff;
    color: #075bd7;
}

.status-pill.completed {
    border-color: #ffd0af;
    background: #fff4eb;
    color: #bf4c00;
}

.status-pill.absent {
    border-color: #ffc0c7;
    background: #fff0f2;
    color: #b42318;
}

.start-exam-btn,
.compact-btn {
    min-height: 40px;
    padding: 0 14px;
    border-radius: 6px;
    background: #0b63d8;
}

.system-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
    margin-top: 14px;
}

.system-check {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 10px;
    align-items: center;
    min-height: 48px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
}

.system-check span {
    color: #30425f;
}

.system-check strong,
.system-check b {
    color: #078536;
    font-size: 0.82rem;
}

.ready-box {
    display: grid;
    gap: 4px;
    margin-top: 16px;
    padding: 14px 16px;
    border: 1px solid #b9e7ca;
    border-radius: 8px;
    background: #effbf3;
    color: #087233;
}

.instructions-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 18px;
    align-items: center;
}

.instructions-card ul {
    margin: 10px 0 0;
    padding-left: 18px;
    color: #293d61;
}

.instructions-card li {
    margin: 6px 0;
}

.monitor-box {
    display: grid;
    min-height: 130px;
    place-items: center;
    padding: 18px;
    border-radius: 8px;
    background: #eef5ff;
    color: #0b1f44;
    text-align: center;
}

.question-shell {
    display: grid;
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 16px;
    margin-top: 18px;
}

.question-nav {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    align-content: start;
    gap: 8px;
}

.question-nav button {
    min-height: 38px;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--ink);
}

.question-nav button.active {
    background: #0b63d8;
    color: #ffffff;
}

.question-nav button.answered {
    border-color: #1ca14a;
}

.question-card {
    min-height: 320px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
}

.answer-list {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.answer-list label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    font-weight: 700;
}

.answer-list input {
    width: 18px;
    min-height: 18px;
}

.timer-pill {
    padding: 10px 14px;
    border-radius: 8px;
    background: #061737;
    color: #ffffff;
    font-weight: 900;
}

.danger-btn {
    background: #b42318;
}

.submit-success {
    display: grid;
    place-items: center;
    gap: 12px;
    min-height: 320px;
    text-align: center;
}

@media (max-width: 980px) {
    .exam-facts,
    .system-grid,
    .instructions-card {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .exam-profile-strip,
    .question-shell,
    .runner-head,
    .runner-actions,
    .exam-title-row,
    .exam-card-head {
        grid-template-columns: 1fr;
        display: grid;
    }

    .exam-facts div {
        grid-template-columns: 1fr;
    }
}


/* v2.1.2 responsive internet exam fixes */
body.exam-active-mode {
    overflow: hidden;
}

body.exam-active-mode .portal-shell,
body.exam-active-mode .dashboard {
    width: 100%;
    max-width: none;
    min-height: 100vh;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

body.exam-active-mode .student-card,
body.exam-active-mode .tabs {
    display: none;
}

body.exam-active-mode .dashboard-main,
body.exam-active-mode .tab-panel {
    height: 100vh;
    min-height: 0;
    padding: 0;
    overflow: hidden;
}

.exam-instruction-view {
    display: grid;
    min-height: min(720px, 100vh);
    place-items: center;
    padding: 20px;
}

.instruction-facts {
    margin-top: 16px;
}

.exam-runner {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto auto;
    height: 100vh;
    min-height: 0;
    padding: clamp(12px, 2vw, 20px);
    overflow: hidden;
}

.exam-progress {
    height: 8px;
    margin-top: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: #e5ecf7;
}

.exam-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #0b63d8;
}

.exam-runner .question-shell {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(76px, 120px) minmax(0, 1fr) minmax(220px, 280px);
    gap: 14px;
    overflow: hidden;
}

.exam-runner .question-nav {
    min-height: 0;
    overflow: auto;
    padding-right: 4px;
}

.exam-runner .question-card {
    min-height: 0;
    overflow: auto;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.question-card img,
.question-image {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 14px 0;
    border-radius: 8px;
}

.question-card table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
}

.question-card th,
.question-card td {
    padding: 8px;
    border: 1px solid var(--line);
}

.question-nav button.flagged {
    border-color: #f59e0b;
    background: #fff7ed;
    color: #92400e;
}

.question-nav button.active.flagged {
    background: #f59e0b;
    color: #ffffff;
}

.exam-runner .runner-actions {
    flex-wrap: wrap;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    background: #ffffff;
}

.runner-tools {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.exam-calculator {
    min-height: 0;
    align-self: start;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fbff;
}

.calculator-display {
    min-height: 42px;
    padding: 10px;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #ffffff;
    color: #061737;
    text-align: right;
    font-size: 1.18rem;
    font-weight: 900;
}

.calculator-keys {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin-top: 10px;
}

.calculator-keys button {
    min-height: 40px;
    padding: 6px;
    border-radius: 6px;
}

@media (max-width: 760px) {
    .exam-page-wrap {
        gap: 14px;
    }

    .table-scroll {
        overflow-x: visible;
    }

    .exam-table {
        min-width: 0;
        border-collapse: separate;
        border-spacing: 0 10px;
    }

    .exam-table thead {
        display: none;
    }

    .exam-table,
    .exam-table tbody,
    .exam-table tr,
    .exam-table td {
        display: block;
        width: 100%;
    }

    .exam-table tr {
        padding: 12px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: #ffffff;
    }

    .exam-table td {
        display: grid;
        grid-template-columns: minmax(92px, 34%) minmax(0, 1fr);
        gap: 10px;
        align-items: center;
        padding: 8px 0;
        border-bottom: 0;
    }

    .exam-table td::before {
        content: attr(data-label);
        color: #52617b;
        font-size: 0.68rem;
        font-weight: 800;
        text-transform: uppercase;
    }

    .exam-table td:first-child {
        display: grid;
        grid-template-columns: minmax(92px, 34%) minmax(0, 1fr);
    }

    .exam-table td:first-child::after {
        content: none;
    }

    .exam-table td:first-child .subject-dot {
        display: none;
    }

    .exam-runner {
        grid-template-rows: auto auto minmax(0, 1fr) auto auto;
        padding: 10px;
    }

    .exam-runner .runner-head {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 10px;
    }

    .exam-runner .runner-head h2 {
        font-size: 1.05rem;
    }

    .exam-runner .question-shell {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-top: 10px;
    }

    .exam-runner .question-nav {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .exam-runner .question-nav button {
        min-width: 42px;
        min-height: 40px;
    }

    .exam-runner .question-card {
        padding: 14px;
    }

    .answer-list label {
        align-items: flex-start;
        font-size: 0.95rem;
    }

    .exam-runner .runner-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .exam-runner .runner-actions button {
        width: 100%;
        padding-inline: 8px;
    }

    .exam-calculator {
        position: fixed;
        right: 10px;
        bottom: 78px;
        z-index: 20;
        width: min(310px, calc(100vw - 20px));
        box-shadow: 0 18px 45px rgba(15, 23, 42, 0.2);
    }
}

@media (max-width: 420px) {
    .exam-profile-strip,
    .exam-card,
    .submit-success {
        padding: 14px;
    }

    .timer-pill {
        padding: 8px 10px;
        font-size: 0.88rem;
    }

    .exam-runner .runner-actions {
        grid-template-columns: 1fr;
    }
}


/* v2.1.7 online exam reliability and full-screen runner */
body.exam-active-mode .dashboard-main,
body.exam-active-mode .tab-panel {
    height: var(--exam-vh, 100dvh);
}

.exam-runner {
    height: var(--exam-vh, 100dvh);
    max-height: var(--exam-vh, 100dvh);
    width: 100vw;
    max-width: 100vw;
    border: 0;
    border-radius: 0;
}

.exam-runner .runner-head,
.exam-runner .runner-actions {
    flex: 0 0 auto;
}

.exam-runner .question-shell {
    min-height: 0;
}

.exam-runner .question-card h3 {
    overflow-wrap: anywhere;
}

.question-image {
    max-height: min(46vh, 420px);
    object-fit: contain;
}

.exam-runner button:disabled {
    cursor: wait;
    opacity: 0.68;
}

.compact-result-card h3,
.compact-result-card p {
    margin: 0 0 6px;
}

@media (orientation: landscape) and (max-height: 520px) {
    .exam-runner {
        padding: 8px;
    }

    .exam-runner .runner-head h2 {
        font-size: 1rem;
    }

    .exam-runner .question-card {
        padding: 10px;
    }

    .answer-list {
        gap: 6px;
        margin-top: 10px;
    }

    .answer-list label {
        padding: 9px;
    }
}


.exam-pass-card {
    display: grid;
    gap: 12px;
    padding: 18px;
    border: 2px solid var(--brand);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
    max-width: 194mm;
    min-height: 276mm;
    margin: 0 auto;
    box-sizing: border-box;
}

.exam-pass-head {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 3px solid var(--brand);
}

.exam-pass-head h3,
.exam-pass-head p {
    margin: 0;
}

.exam-pass-head .school-logo {
    width: 74px;
    height: 74px;
}

.exam-pass-identity {
    display: grid;
    grid-template-columns: 120px repeat(2, minmax(0, 1fr));
    gap: 10px;
    align-items: stretch;
}

.exam-pass-photo {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
    grid-row: span 2;
}

.exam-pass-card .table-wrap {
    overflow: visible;
}

.exam-pass-card table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.exam-pass-card th,
.exam-pass-card td {
    padding: 5px 6px;
    border: 1px solid #9fb0ca;
    text-align: left;
}

.exam-pass-card th {
    color: #405276;
    text-transform: uppercase;
    font-size: 0.68rem;
}

.exam-pass-foot {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

@media print {
    @page {
        size: A4;
        margin: 8mm;
    }

    body {
        background: #ffffff;
    }

    .pass-actions {
        display: none !important;
    }

    .exam-pass-card {
        width: 194mm;
        min-height: 276mm;
        box-shadow: none;
        page-break-inside: avoid;
    }
}


/* v2.1.8 student exam app-style full-screen runner */
html:has(body.exam-active-mode),
body.exam-active-mode {
    width: 100%;
    height: 100%;
    min-height: 100%;
    margin: 0;
    overflow: hidden;
    background: #ffffff;
}

body.exam-active-mode .portal-shell,
body.exam-active-mode .dashboard,
body.exam-active-mode .dashboard-main,
body.exam-active-mode .tab-panel {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: var(--exam-vh, 100dvh);
    max-width: none;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: #ffffff;
    box-shadow: none;
}

body.exam-active-mode .student-card,
body.exam-active-mode .tabs {
    display: none !important;
}

.student-exam-screen {
    position: fixed;
    inset: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: 100vw;
    height: var(--exam-vh, 100dvh);
    overflow: hidden;
    background: #ffffff;
    color: #0b1220;
}

.student-exam-topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: clamp(10px, 2vw, 20px);
    padding: max(12px, env(safe-area-inset-top)) clamp(16px, 4vw, 48px) 12px;
    border-bottom: 1px solid #edf1f7;
    background: #ffffff;
}

.exam-back,
.exam-icon-action {
    display: inline-grid;
    min-width: 44px;
    min-height: 44px;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #0b1220;
    font-size: 1.85rem;
    font-weight: 800;
}

.student-exam-title h2 {
    margin: 0;
    color: #101828;
    font-size: clamp(1.2rem, 2vw, 1.85rem);
}

.student-exam-title p,
.exam-icon-action span {
    display: block;
    margin: 2px 0 0;
    color: #667085;
    font-size: clamp(0.72rem, 1.4vw, 0.9rem);
    font-weight: 600;
}

.student-exam-tools {
    display: flex;
    align-items: center;
    gap: clamp(8px, 1.8vw, 18px);
}

.exam-icon-action {
    gap: 2px;
    font-size: 1.5rem;
}

.student-exam-scroll {
    min-height: 0;
    overflow: auto;
    padding: clamp(10px, 2vw, 18px) clamp(16px, 4vw, 48px) 96px;
    background: #ffffff;
}

.exam-candidate-card,
.exam-stat-strip,
.student-question-card {
    width: min(100%, 1120px);
    margin: 0 auto clamp(12px, 2vw, 18px);
    border: 1px solid #d9dee8;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: none;
}

.exam-candidate-card {
    display: grid;
    justify-items: center;
    gap: 6px;
    padding: clamp(14px, 2.4vw, 24px);
    text-align: center;
}

.exam-candidate-photo {
    width: clamp(86px, 13vw, 132px);
    height: clamp(86px, 13vw, 132px);
    border: 2px solid #cfd6e3;
    border-radius: 10px;
    object-fit: cover;
    background: #f6f8fb;
}

.exam-candidate-card h3 {
    margin: 6px 0 0;
    color: #101828;
    font-size: clamp(1.2rem, 2.2vw, 1.7rem);
}

.exam-candidate-card p {
    margin: 0;
    color: #1f2937;
    font-size: clamp(0.9rem, 1.7vw, 1.05rem);
}

.exam-candidate-card span {
    color: #98a2b3;
    padding: 0 8px;
}

.exam-stat-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: clamp(12px, 2vw, 18px);
}

.exam-stat-strip div {
    display: grid;
    grid-template-columns: auto minmax(0, auto);
    grid-template-rows: auto auto;
    justify-content: center;
    align-items: center;
    gap: 0 12px;
    padding: 0 clamp(8px, 2vw, 22px);
    border-right: 1px solid #e5e7ef;
}

.exam-stat-strip div:last-child {
    border-right: 0;
}

.stat-icon {
    grid-row: span 2;
    display: inline-grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 3px solid currentColor;
    border-radius: 50%;
    font-size: 1.35rem;
    line-height: 1;
}

.stat-icon.time { color: #12a150; }
.stat-icon.questions { color: #0b63d8; border-radius: 8px; }
.stat-icon.flagged { color: #f97316; border: 0; }

.exam-stat-strip strong {
    color: #111827;
    font-size: clamp(1rem, 2vw, 1.3rem);
}

.exam-stat-strip span {
    color: #667085;
    font-size: clamp(0.78rem, 1.5vw, 0.95rem);
}

.student-exam-screen .exam-progress {
    width: min(100%, 1120px);
    height: 6px;
    margin: -4px auto 12px;
    background: #eef2f7;
}

.student-question-card {
    padding: clamp(16px, 3vw, 28px);
}

.student-question-card h3 {
    margin: 0 0 clamp(18px, 3vw, 28px);
    color: #075bd7;
    font-size: clamp(1rem, 1.8vw, 1.18rem);
}

.question-text {
    margin-bottom: clamp(18px, 3vw, 30px);
    color: #0b1220;
    font-size: clamp(1.15rem, 2.3vw, 1.75rem);
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.student-answer-list {
    display: grid;
    gap: clamp(10px, 1.8vw, 16px);
}

.student-answer-option {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 18px;
    min-height: clamp(60px, 8vw, 78px);
    padding: 12px clamp(14px, 2.2vw, 22px);
    border: 1px solid #cfd6e3;
    border-radius: 12px;
    background: #ffffff;
    cursor: pointer;
}

.student-answer-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.student-answer-option span {
    display: inline-grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 2px solid #b7bfcc;
    border-radius: 50%;
    color: #111827;
    font-size: 1.15rem;
    font-weight: 900;
}

.student-answer-option strong {
    color: #111827;
    font-size: clamp(1rem, 1.8vw, 1.18rem);
    font-weight: 600;
}

.student-answer-option:has(input:checked) {
    border-color: #0b63d8;
    background: #eff6ff;
}

.student-answer-option:has(input:checked) span {
    border-color: #0b63d8;
    background: #0b63d8;
    color: #ffffff;
}

.student-runner-actions,
.student-question-palette,
.question-legend {
    width: min(100%, 1120px);
    margin: 0 auto clamp(12px, 2vw, 18px);
}

.student-runner-actions {
    display: grid;
    grid-template-columns: 1fr 1.08fr 1.16fr;
    gap: clamp(10px, 2vw, 22px);
}

.student-runner-actions button,
.floating-submit {
    min-height: 58px;
    border-radius: 10px;
    font-size: clamp(0.95rem, 1.7vw, 1.1rem);
    font-weight: 900;
}

.student-question-palette {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
    gap: 10px;
}

.student-question-palette button {
    min-height: 48px;
    border: 1px solid #cfd6e3;
    border-radius: 9px;
    background: #ffffff;
    color: #111827;
    font-size: 1rem;
    font-weight: 800;
}

.student-question-palette button.answered {
    border-color: #16a34a;
    background: #ecfdf3;
    color: #15803d;
}

.student-question-palette button.flagged {
    border-color: #f97316;
    background: #fff7ed;
    color: #ea580c;
}

.student-question-palette button.current {
    border-color: #0b63d8;
    background: #0b63d8;
    color: #ffffff;
}

.question-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px 28px;
    color: #475467;
}

.question-legend span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.question-legend i {
    width: 20px;
    height: 20px;
    border: 1px solid #cfd6e3;
    border-radius: 5px;
    background: #ffffff;
}

.question-legend i.answered { border-color: #16a34a; background: #ecfdf3; }
.question-legend i.flagged { border-color: #f97316; background: #fff7ed; }
.question-legend i.current { border-color: #0b63d8; background: #0b63d8; }

.student-exam-screen .status-line {
    width: min(100%, 1120px);
    margin: 0 auto;
}

.student-exam-screen .exam-calculator {
    position: fixed;
    top: clamp(76px, 11vh, 110px);
    right: clamp(12px, 4vw, 46px);
    z-index: 50;
    width: min(320px, calc(100vw - 24px));
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.22);
}

.floating-submit {
    position: fixed;
    right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
    z-index: 40;
    min-width: 120px;
    padding-inline: 22px;
}

@media (min-width: 900px) {
    .student-exam-scroll {
        display: grid;
        grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
        grid-template-areas:
            "profile stats"
            "profile progress"
            "profile question"
            "palette actions"
            "legend status";
        align-content: start;
        gap: 16px 20px;
        padding-bottom: 86px;
    }

    .exam-candidate-card { grid-area: profile; align-self: start; }
    .exam-stat-strip { grid-area: stats; }
    .student-exam-screen .exam-progress { grid-area: progress; }
    .student-question-card { grid-area: question; }
    .student-question-palette { grid-area: palette; }
    .student-runner-actions { grid-area: actions; }
    .question-legend { grid-area: legend; }
    .student-exam-screen .status-line { grid-area: status; }

    .exam-candidate-card,
    .exam-stat-strip,
    .student-exam-screen .exam-progress,
    .student-question-card,
    .student-runner-actions,
    .student-question-palette,
    .question-legend,
    .student-exam-screen .status-line {
        width: 100%;
        margin: 0;
    }
}

@media (max-width: 620px) {
    .student-exam-topbar {
        grid-template-columns: auto minmax(0, 1fr) auto;
        padding-inline: 14px;
    }

    .exam-icon-action {
        min-width: 40px;
        min-height: 40px;
        font-size: 1.25rem;
    }

    .exam-icon-action span {
        font-size: 0.68rem;
    }

    .student-exam-tools {
        gap: 4px;
    }

    .student-exam-scroll {
        padding-inline: 14px;
        padding-bottom: 92px;
    }

    .exam-stat-strip {
        padding: 12px 8px;
    }

    .exam-stat-strip div {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
        gap: 3px;
        padding: 0 4px;
    }

    .stat-icon {
        width: 34px;
        height: 34px;
        font-size: 1rem;
        border-width: 2px;
    }

    .student-runner-actions {
        grid-template-columns: 1fr;
    }

    .student-runner-actions button {
        min-height: 52px;
    }

    .student-question-palette {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 8px;
    }

    .student-question-palette button {
        min-height: 44px;
    }

    .floating-submit {
        left: max(14px, env(safe-area-inset-left));
        right: max(14px, env(safe-area-inset-right));
        width: auto;
    }
}

/* v2.1.9 keep the tablet-style exam layout consistent on every device */
.student-exam-scroll {
    display: block !important;
    grid-template-columns: none !important;
    grid-template-areas: none !important;
    max-width: 940px;
    margin: 0 auto;
}

.exam-candidate-card,
.exam-stat-strip,
.student-exam-screen .exam-progress,
.student-question-card,
.student-runner-actions,
.student-question-palette,
.question-legend,
.student-exam-screen .status-line {
    width: min(100%, 900px) !important;
    margin: 0 auto clamp(12px, 2vw, 18px) !important;
}

.student-exam-topbar {
    max-width: 980px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.student-question-palette {
    grid-template-columns: repeat(10, minmax(0, 1fr));
}

.student-runner-actions {
    grid-template-columns: 1fr 1.08fr 1.16fr !important;
}

@media (min-width: 1200px) {
    .student-exam-scroll {
        max-width: 980px;
        padding-top: 14px;
    }

    .exam-candidate-card,
    .exam-stat-strip,
    .student-exam-screen .exam-progress,
    .student-question-card,
    .student-runner-actions,
    .student-question-palette,
    .question-legend,
    .student-exam-screen .status-line {
        width: min(100%, 920px) !important;
    }
}

@media (max-width: 620px) {
    .student-exam-topbar {
        gap: 8px;
        padding: max(8px, env(safe-area-inset-top)) 12px 8px;
    }

    .exam-back,
    .exam-icon-action {
        min-width: 34px;
        min-height: 34px;
        font-size: 1.18rem;
    }

    .student-exam-title h2 {
        font-size: 1.08rem;
    }

    .student-exam-title p,
    .exam-icon-action span {
        font-size: 0.64rem;
    }

    .student-exam-scroll {
        padding: 8px 12px 76px;
    }

    .exam-candidate-card,
    .exam-stat-strip,
    .student-question-card {
        border-radius: 10px;
        margin-bottom: 10px !important;
    }

    .exam-candidate-card {
        gap: 3px;
        padding: 10px;
    }

    .exam-candidate-photo {
        width: 72px;
        height: 72px;
        border-radius: 8px;
    }

    .exam-candidate-card h3 {
        margin-top: 3px;
        font-size: 1.05rem;
    }

    .exam-candidate-card p {
        font-size: 0.78rem;
    }

    .exam-stat-strip {
        padding: 9px 5px;
    }

    .exam-stat-strip div {
        grid-template-columns: auto minmax(0, auto);
        grid-template-rows: auto auto;
        gap: 0 6px;
        justify-items: start;
        text-align: left;
        padding: 0 4px;
    }

    .stat-icon {
        grid-row: span 2;
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }

    .exam-stat-strip strong {
        font-size: 0.86rem;
    }

    .exam-stat-strip span {
        font-size: 0.68rem;
    }

    .student-exam-screen .exam-progress {
        height: 4px;
        margin-bottom: 8px !important;
    }

    .student-question-card {
        padding: 12px;
    }

    .student-question-card h3 {
        margin-bottom: 12px;
        font-size: 0.95rem;
    }

    .question-text {
        margin-bottom: 12px;
        font-size: 1rem;
        line-height: 1.38;
    }

    .student-answer-list {
        gap: 8px;
    }

    .student-answer-option {
        min-height: 44px;
        gap: 10px;
        padding: 8px 10px;
        border-radius: 9px;
    }

    .student-answer-option span {
        width: 32px;
        height: 32px;
        font-size: 0.92rem;
    }

    .student-answer-option strong {
        font-size: 0.9rem;
    }

    .student-runner-actions {
        grid-template-columns: 1fr 1.08fr 1.16fr !important;
        gap: 8px;
        margin-bottom: 10px !important;
    }

    .student-runner-actions button {
        min-height: 42px;
        padding: 6px 5px;
        border-radius: 8px;
        font-size: 0.72rem;
        line-height: 1.15;
    }

    .student-question-palette {
        grid-template-columns: repeat(10, minmax(0, 1fr));
        gap: 6px;
        margin-bottom: 10px !important;
    }

    .student-question-palette button {
        min-height: 34px;
        border-radius: 7px;
        font-size: 0.82rem;
        padding: 3px;
    }

    .question-legend {
        gap: 8px 12px;
        justify-content: space-between;
        font-size: 0.7rem;
        margin-bottom: 6px !important;
    }

    .question-legend i {
        width: 14px;
        height: 14px;
        border-radius: 4px;
    }

    .student-exam-screen .status-line {
        font-size: 0.68rem;
        margin-bottom: 0 !important;
    }

    .floating-submit {
        min-height: 42px;
        left: auto;
        right: max(12px, env(safe-area-inset-right));
        bottom: max(10px, env(safe-area-inset-bottom));
        width: auto;
        min-width: 92px;
        padding: 6px 12px;
        border-radius: 9px;
        font-size: 0.8rem;
    }
}

/* v2.1.10 final device-fit tuning for student exam runner */
.student-exam-scroll {
    width: 100%;
    box-sizing: border-box;
}

@media (min-width: 900px) {
    .student-exam-scroll {
        max-width: min(1180px, 100vw);
        padding-top: 10px;
        padding-bottom: 70px;
    }

    .exam-candidate-card,
    .exam-stat-strip,
    .student-exam-screen .exam-progress,
    .student-question-card,
    .student-runner-actions,
    .student-question-palette,
    .question-legend,
    .student-exam-screen .status-line {
        width: min(100%, 1120px) !important;
        margin-bottom: 10px !important;
    }

    .exam-candidate-card {
        grid-template-columns: auto minmax(0, 1fr);
        justify-items: start;
        align-items: center;
        text-align: left;
        gap: 8px 18px;
        padding: 12px 18px;
    }

    .exam-candidate-photo {
        grid-row: span 3;
        width: 74px;
        height: 74px;
    }

    .exam-candidate-card h3 {
        margin: 0;
        font-size: 1.18rem;
    }

    .exam-candidate-card p {
        font-size: 0.88rem;
    }

    .exam-stat-strip {
        padding: 10px 12px;
    }

    .stat-icon {
        width: 34px;
        height: 34px;
        font-size: 1rem;
        border-width: 2px;
    }

    .exam-stat-strip strong {
        font-size: 1rem;
    }

    .exam-stat-strip span {
        font-size: 0.78rem;
    }

    .student-question-card {
        padding: 14px 18px;
    }

    .student-question-card h3 {
        margin-bottom: 10px;
        font-size: 1rem;
    }

    .question-text {
        margin-bottom: 12px;
        font-size: 1.16rem;
        line-height: 1.38;
    }

    .student-answer-list {
        gap: 8px;
    }

    .student-answer-option {
        min-height: 44px;
        padding: 8px 12px;
    }

    .student-answer-option span {
        width: 32px;
        height: 32px;
        font-size: 0.95rem;
    }

    .student-answer-option strong {
        font-size: 0.94rem;
    }

    .student-runner-actions button,
    .floating-submit {
        min-height: 44px;
        font-size: 0.9rem;
    }

    .student-question-palette {
        grid-template-columns: repeat(20, minmax(0, 1fr));
        gap: 6px;
    }

    .student-question-palette button {
        min-height: 34px;
        border-radius: 7px;
        font-size: 0.86rem;
        padding: 3px;
    }

    .question-legend {
        font-size: 0.78rem;
        margin-bottom: 4px !important;
    }

    .question-legend i {
        width: 15px;
        height: 15px;
    }
}

@media (max-width: 620px) {
    .student-exam-screen {
        width: 100vw;
        min-width: 100vw;
    }

    .student-exam-topbar {
        width: 100vw;
        max-width: 100vw;
        padding-left: 6px;
        padding-right: 6px;
        gap: 4px;
    }

    .student-exam-title {
        min-width: 0;
    }

    .student-exam-title h2,
    .student-exam-title p {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .student-exam-tools {
        flex-shrink: 0;
        gap: 2px;
    }

    .exam-back,
    .exam-icon-action {
        min-width: 30px;
        min-height: 30px;
        padding: 0;
        font-size: 1rem;
    }

    .exam-icon-action span {
        font-size: 0.56rem;
        line-height: 1;
    }

    .student-exam-scroll {
        width: 100vw;
        max-width: 100vw;
        padding-left: 6px;
        padding-right: 6px;
        padding-bottom: 66px;
    }

    .exam-candidate-card,
    .exam-stat-strip,
    .student-exam-screen .exam-progress,
    .student-question-card,
    .student-runner-actions,
    .student-question-palette,
    .question-legend,
    .student-exam-screen .status-line {
        width: 100% !important;
        max-width: none !important;
    }

    .exam-stat-strip div {
        gap: 0 4px;
        padding: 0 2px;
    }

    .stat-icon {
        width: 26px;
        height: 26px;
        font-size: 0.78rem;
    }

    .exam-stat-strip strong {
        font-size: 0.68rem;
    }

    .exam-stat-strip span {
        font-size: 0.58rem;
    }

    .student-runner-actions {
        gap: 5px;
    }

    .student-runner-actions button {
        min-height: 38px;
        font-size: 0.64rem;
        padding: 4px 3px;
    }

    .student-question-palette {
        gap: 4px;
    }

    .student-question-palette button {
        min-height: 30px;
        font-size: 0.72rem;
    }

    .question-legend {
        gap: 6px;
        font-size: 0.62rem;
    }

    .floating-submit {
        min-width: 78px;
        min-height: 40px;
        right: 6px;
        bottom: 6px;
        font-size: 0.72rem;
    }
}

/* v2.1.11 phone width polish for full exam visibility */
@media (max-width: 620px) {
    body.exam-active-mode,
    body.exam-active-mode .portal-shell,
    body.exam-active-mode .dashboard,
    body.exam-active-mode .dashboard-main,
    body.exam-active-mode .tab-panel,
    .student-exam-screen,
    .student-exam-topbar,
    .student-exam-scroll {
        width: 100vw !important;
        max-width: 100vw !important;
        min-width: 100vw !important;
        box-sizing: border-box;
    }

    .student-exam-topbar {
        padding-left: 2px;
        padding-right: 2px;
        gap: 2px;
    }

    .student-exam-scroll {
        padding-left: 2px;
        padding-right: 2px;
    }

    .exam-candidate-card,
    .exam-stat-strip,
    .student-question-card,
    .student-runner-actions,
    .student-question-palette,
    .question-legend,
    .student-exam-screen .exam-progress,
    .student-exam-screen .status-line {
        width: calc(100vw - 4px) !important;
        max-width: calc(100vw - 4px) !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .exam-back,
    .exam-icon-action {
        min-width: 28px;
        min-height: 28px;
    }

    .student-exam-tools {
        gap: 1px;
    }

    .student-answer-option {
        padding-left: 8px;
        padding-right: 8px;
    }

    .student-question-palette {
        gap: 3px;
    }

    .student-runner-actions {
        gap: 4px;
    }
}

/* v2.1.12 strict small-phone width fit: no horizontal clipping */
@media (max-width: 620px) {
    body.exam-active-mode {
        overflow-x: hidden !important;
    }

    .student-exam-screen,
    .student-exam-screen * {
        box-sizing: border-box;
        max-width: 100%;
        min-width: 0;
    }

    body.exam-active-mode .portal-shell,
    body.exam-active-mode .dashboard,
    body.exam-active-mode .dashboard-main,
    body.exam-active-mode .tab-panel,
    .student-exam-screen {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    .student-exam-topbar,
    .student-exam-scroll {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        padding-left: 1px !important;
        padding-right: 1px !important;
        overflow-x: hidden !important;
    }

    .student-exam-topbar {
        grid-template-columns: 26px minmax(0, 1fr) auto;
        gap: 1px;
    }

    .student-exam-title h2 {
        font-size: 0.98rem;
    }

    .student-exam-title p {
        font-size: 0.58rem;
    }

    .student-exam-tools {
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: 27px;
        gap: 1px;
        flex-shrink: 0;
    }

    .exam-back,
    .exam-icon-action {
        width: 26px;
        min-width: 26px;
        height: 28px;
        min-height: 28px;
        font-size: 0.95rem;
    }

    .exam-icon-action span {
        display: none;
    }

    .exam-candidate-card,
    .exam-stat-strip,
    .student-question-card,
    .student-runner-actions,
    .student-question-palette,
    .question-legend,
    .student-exam-screen .exam-progress,
    .student-exam-screen .status-line {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .exam-stat-strip {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        padding: 7px 2px;
    }

    .exam-stat-strip div {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        justify-items: center;
        text-align: center;
        gap: 1px;
        padding: 0 1px;
    }

    .stat-icon {
        grid-row: auto;
        width: 22px;
        height: 22px;
        font-size: 0.68rem;
        border-width: 2px;
    }

    .exam-stat-strip strong {
        font-size: 0.68rem;
        line-height: 1.05;
        white-space: nowrap;
    }

    .exam-stat-strip span {
        font-size: 0.52rem;
        line-height: 1.05;
        white-space: nowrap;
    }

    .student-question-card {
        padding: 9px 7px;
    }

    .question-text {
        font-size: 0.92rem;
        line-height: 1.32;
    }

    .student-answer-option {
        grid-template-columns: 28px minmax(0, 1fr);
        min-height: 40px;
        gap: 7px;
        padding: 6px 7px;
    }

    .student-answer-option span {
        width: 28px;
        height: 28px;
        font-size: 0.82rem;
    }

    .student-answer-option strong {
        font-size: 0.9rem;
        overflow-wrap: anywhere;
    }

    .student-runner-actions {
        grid-template-columns: 0.92fr 1.06fr 0.92fr !important;
        gap: 3px;
    }

    .student-runner-actions button {
        min-height: 40px;
        padding: 3px 2px;
        font-size: 0.58rem;
        border-radius: 7px;
        white-space: normal;
    }

    .student-question-palette {
        grid-template-columns: repeat(10, minmax(0, 1fr));
        gap: 3px;
    }

    .student-question-palette button {
        min-height: 28px;
        padding: 2px;
        font-size: 0.68rem;
        border-radius: 6px;
    }

    .question-legend {
        gap: 4px;
        justify-content: space-around;
        font-size: 0.56rem;
    }

    .question-legend span {
        gap: 3px;
    }

    .question-legend i {
        width: 11px;
        height: 11px;
        border-radius: 3px;
    }

    .floating-submit {
        min-width: 68px;
        min-height: 40px;
        right: 3px;
        bottom: 4px;
        padding: 4px 8px;
        font-size: 0.66rem;
    }
}

/* v2.1.13 phone typography compression for clean full-width exam fit */
@media (max-width: 620px) {
    .student-exam-title h2 {
        font-size: 0.86rem !important;
        line-height: 1.05;
    }

    .student-exam-title p {
        font-size: 0.5rem !important;
        line-height: 1;
    }

    .exam-back,
    .exam-icon-action {
        width: 24px !important;
        min-width: 24px !important;
        height: 25px !important;
        min-height: 25px !important;
        font-size: 0.82rem !important;
    }

    .student-exam-topbar {
        grid-template-columns: 24px minmax(0, 1fr) 52px !important;
        min-height: 40px;
        padding-top: 3px !important;
        padding-bottom: 3px !important;
    }

    .student-exam-tools {
        grid-auto-columns: 25px !important;
    }

    .exam-candidate-card {
        padding: 6px 5px !important;
        gap: 1px !important;
    }

    .exam-candidate-photo {
        width: 52px !important;
        height: 52px !important;
        border-radius: 7px;
    }

    .exam-candidate-card h3 {
        font-size: 0.86rem !important;
        line-height: 1.05;
    }

    .exam-candidate-card p {
        font-size: 0.62rem !important;
        line-height: 1.08;
    }

    .exam-stat-strip {
        padding: 5px 1px !important;
    }

    .stat-icon {
        width: 18px !important;
        height: 18px !important;
        font-size: 0.56rem !important;
        border-width: 1px !important;
    }

    .exam-stat-strip strong {
        font-size: 0.58rem !important;
        line-height: 1;
    }

    .exam-stat-strip span {
        font-size: 0.45rem !important;
        line-height: 1;
    }

    .student-question-card {
        padding: 7px 5px !important;
    }

    .student-question-card h3 {
        margin-bottom: 7px !important;
        font-size: 0.76rem !important;
        line-height: 1;
    }

    .question-text {
        margin-bottom: 8px !important;
        font-size: 0.78rem !important;
        line-height: 1.24 !important;
    }

    .student-answer-list {
        gap: 5px !important;
    }

    .student-answer-option {
        grid-template-columns: 24px minmax(0, 1fr) !important;
        min-height: 32px !important;
        gap: 5px !important;
        padding: 4px 5px !important;
        border-radius: 7px !important;
    }

    .student-answer-option span {
        width: 23px !important;
        height: 23px !important;
        font-size: 0.66rem !important;
        border-width: 1px !important;
    }

    .student-answer-option strong {
        font-size: 0.68rem !important;
        line-height: 1.12;
    }

    .student-runner-actions {
        gap: 2px !important;
    }

    .student-runner-actions button {
        min-height: 31px !important;
        padding: 2px 1px !important;
        font-size: 0.5rem !important;
        line-height: 1.05 !important;
        border-radius: 6px !important;
    }

    .student-question-palette {
        gap: 2px !important;
    }

    .student-question-palette button {
        min-height: 24px !important;
        font-size: 0.58rem !important;
        padding: 1px !important;
        border-radius: 5px !important;
    }

    .question-legend {
        font-size: 0.48rem !important;
        gap: 3px !important;
    }

    .question-legend span {
        gap: 2px !important;
    }

    .question-legend i {
        width: 9px !important;
        height: 9px !important;
    }

    .student-exam-screen .status-line {
        font-size: 0.5rem !important;
        line-height: 1.05;
    }

    .floating-submit {
        min-width: 58px !important;
        min-height: 29px !important;
        padding: 3px 6px !important;
        font-size: 0.56rem !important;
        border-radius: 7px !important;
    }
}

/* v2.1.14 phone horizontal fit: scale exam surface to reveal full width */
@media (max-width: 620px) {
    .student-exam-screen {
        overflow: hidden !important;
    }

    .student-exam-topbar,
    .student-exam-scroll {
        transform: scaleX(0.92);
        transform-origin: top left;
        width: 108.6957% !important;
        max-width: 108.6957% !important;
    }

    .student-exam-scroll {
        padding-bottom: 66px;
    }

    .floating-submit {
        transform: scale(0.92);
        transform-origin: bottom right;
        right: 2px !important;
    }

    .student-exam-screen .exam-calculator {
        transform: scale(0.92);
        transform-origin: top right;
        right: 2px !important;
    }
}

@media (max-width: 380px) {
    .student-exam-topbar,
    .student-exam-scroll {
        transform: scaleX(0.88);
        width: 113.6364% !important;
        max-width: 113.6364% !important;
    }

    .floating-submit,
    .student-exam-screen .exam-calculator {
        transform: scale(0.88);
    }
}

/* v2.1.15 phone uses the same tablet-style layout, uniformly scaled to fit width */
@media (max-width: 620px) {
    body.exam-active-mode {
        overflow: hidden !important;
        background: #ffffff;
    }

    .student-exam-screen {
        overflow: hidden !important;
        background: #ffffff;
    }

    .student-exam-topbar,
    .student-exam-scroll {
        width: 111.111vw !important;
        max-width: none !important;
        min-width: 0 !important;
        transform: scale(0.9) !important;
        transform-origin: top left !important;
        box-sizing: border-box !important;
    }

    .student-exam-topbar {
        grid-template-columns: auto minmax(0, 1fr) auto !important;
        gap: 6px !important;
        padding: 8px 12px !important;
        min-height: auto !important;
    }

    .student-exam-scroll {
        padding: 10px 12px 96px !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        height: calc((var(--exam-vh, 100dvh) - 48px) / 0.9) !important;
    }

    .student-exam-title h2 {
        font-size: 1.08rem !important;
        line-height: 1.12 !important;
    }

    .student-exam-title p,
    .exam-icon-action span {
        display: block !important;
        font-size: 0.68rem !important;
        line-height: 1.05 !important;
    }

    .student-exam-tools {
        display: flex !important;
        gap: 4px !important;
    }

    .exam-back,
    .exam-icon-action {
        width: auto !important;
        min-width: 40px !important;
        height: auto !important;
        min-height: 40px !important;
        padding: 0 2px !important;
        font-size: 1.22rem !important;
    }

    .exam-candidate-card,
    .exam-stat-strip,
    .student-question-card,
    .student-runner-actions,
    .student-question-palette,
    .question-legend,
    .student-exam-screen .exam-progress,
    .student-exam-screen .status-line {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: auto !important;
        margin-right: auto !important;
        margin-bottom: 10px !important;
    }

    .exam-candidate-card {
        display: grid !important;
        justify-items: center !important;
        text-align: center !important;
        gap: 3px !important;
        padding: 10px !important;
    }

    .exam-candidate-photo {
        width: 72px !important;
        height: 72px !important;
        border-radius: 8px !important;
    }

    .exam-candidate-card h3 {
        font-size: 1.05rem !important;
        line-height: 1.1 !important;
    }

    .exam-candidate-card p {
        font-size: 0.78rem !important;
        line-height: 1.12 !important;
    }

    .exam-stat-strip {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        padding: 12px 8px !important;
    }

    .exam-stat-strip div {
        display: grid !important;
        grid-template-columns: 1fr !important;
        grid-template-rows: auto auto auto !important;
        justify-items: center !important;
        text-align: center !important;
        gap: 3px !important;
        padding: 0 4px !important;
    }

    .stat-icon {
        grid-row: auto !important;
        width: 34px !important;
        height: 34px !important;
        font-size: 1rem !important;
        border-width: 2px !important;
    }

    .exam-stat-strip strong {
        font-size: 0.86rem !important;
        line-height: 1.05 !important;
    }

    .exam-stat-strip span {
        font-size: 0.68rem !important;
        line-height: 1.05 !important;
    }

    .student-question-card {
        padding: 12px !important;
    }

    .student-question-card h3 {
        margin-bottom: 12px !important;
        font-size: 0.95rem !important;
    }

    .question-text {
        margin-bottom: 12px !important;
        font-size: 1rem !important;
        line-height: 1.38 !important;
    }

    .student-answer-list {
        gap: 8px !important;
    }

    .student-answer-option {
        grid-template-columns: auto minmax(0, 1fr) !important;
        min-height: 44px !important;
        gap: 10px !important;
        padding: 8px 10px !important;
        border-radius: 9px !important;
    }

    .student-answer-option span {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.92rem !important;
        border-width: 2px !important;
    }

    .student-answer-option strong {
        font-size: 0.9rem !important;
        line-height: 1.15 !important;
    }

    .student-runner-actions {
        grid-template-columns: 1fr 1.08fr 1.16fr !important;
        gap: 8px !important;
    }

    .student-runner-actions button {
        min-height: 42px !important;
        padding: 6px 5px !important;
        font-size: 0.72rem !important;
        line-height: 1.15 !important;
        border-radius: 8px !important;
    }

    .student-question-palette {
        grid-template-columns: repeat(10, minmax(0, 1fr)) !important;
        gap: 6px !important;
    }

    .student-question-palette button {
        min-height: 34px !important;
        padding: 3px !important;
        font-size: 0.82rem !important;
        border-radius: 7px !important;
    }

    .question-legend {
        justify-content: space-between !important;
        gap: 8px 12px !important;
        font-size: 0.7rem !important;
    }

    .question-legend span {
        gap: 8px !important;
    }

    .question-legend i {
        width: 14px !important;
        height: 14px !important;
        border-radius: 4px !important;
    }

    .student-exam-screen .status-line {
        font-size: 0.68rem !important;
        line-height: 1.15 !important;
    }

    .floating-submit {
        transform: scale(0.9) !important;
        transform-origin: bottom right !important;
        min-width: 92px !important;
        min-height: 42px !important;
        right: 8px !important;
        bottom: 8px !important;
        padding: 6px 12px !important;
        font-size: 0.8rem !important;
        border-radius: 9px !important;
    }
}

@media (max-width: 380px) {
    .student-exam-topbar,
    .student-exam-scroll {
        width: 117.647vw !important;
        transform: scale(0.85) !important;
    }

    .student-exam-scroll {
        height: calc((var(--exam-vh, 100dvh) - 46px) / 0.85) !important;
    }

    .floating-submit {
        transform: scale(0.85) !important;
    }
}

/* v2.1.16 proper phone layout: full-width, no scaling, tablet-style structure */
@media (max-width: 620px) {
    body.exam-active-mode,
    body.exam-active-mode .portal-shell,
    body.exam-active-mode .dashboard,
    body.exam-active-mode .dashboard-main,
    body.exam-active-mode .tab-panel,
    .student-exam-screen {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        overflow-x: hidden !important;
    }

    .student-exam-topbar,
    .student-exam-scroll,
    .floating-submit,
    .student-exam-screen .exam-calculator {
        transform: none !important;
    }

    .student-exam-topbar {
        display: grid !important;
        grid-template-columns: 34px minmax(0, 1fr) 84px !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 8px 6px !important;
        gap: 4px !important;
    }

    .student-exam-title {
        min-width: 0 !important;
    }

    .student-exam-title h2 {
        font-size: 1rem !important;
        line-height: 1.1 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .student-exam-title p {
        font-size: 0.66rem !important;
        line-height: 1.1 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .student-exam-tools {
        display: grid !important;
        grid-template-columns: repeat(2, 40px) !important;
        gap: 2px !important;
        justify-content: end !important;
        min-width: 0 !important;
    }

    .exam-back,
    .exam-icon-action {
        width: 34px !important;
        min-width: 34px !important;
        height: 40px !important;
        min-height: 40px !important;
        padding: 0 !important;
        font-size: 1.14rem !important;
    }

    .exam-icon-action {
        width: 40px !important;
        min-width: 40px !important;
    }

    .exam-icon-action span {
        display: block !important;
        font-size: 0.56rem !important;
        line-height: 1 !important;
        margin-top: 1px !important;
    }

    .student-exam-scroll {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        padding: 8px 6px 72px !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
    }

    .exam-candidate-card,
    .exam-stat-strip,
    .student-question-card,
    .student-runner-actions,
    .student-question-palette,
    .question-legend,
    .student-exam-screen .exam-progress,
    .student-exam-screen .status-line {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        margin-bottom: 9px !important;
        box-sizing: border-box !important;
    }

    .exam-candidate-card {
        display: grid !important;
        justify-items: center !important;
        text-align: center !important;
        padding: 9px !important;
        gap: 2px !important;
    }

    .exam-candidate-photo {
        width: 66px !important;
        height: 66px !important;
        border-radius: 8px !important;
    }

    .exam-candidate-card h3 {
        font-size: 1rem !important;
        line-height: 1.08 !important;
        margin: 3px 0 0 !important;
    }

    .exam-candidate-card p {
        font-size: 0.72rem !important;
        line-height: 1.12 !important;
        margin: 0 !important;
    }

    .exam-stat-strip {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        padding: 9px 4px !important;
    }

    .exam-stat-strip div {
        display: grid !important;
        grid-template-columns: auto minmax(0, 1fr) !important;
        grid-template-rows: auto auto !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 0 5px !important;
        padding: 0 2px !important;
        text-align: left !important;
    }

    .stat-icon {
        grid-row: span 2 !important;
        width: 28px !important;
        height: 28px !important;
        font-size: 0.82rem !important;
        border-width: 2px !important;
    }

    .exam-stat-strip strong {
        font-size: 0.72rem !important;
        line-height: 1.05 !important;
        white-space: nowrap !important;
    }

    .exam-stat-strip span {
        font-size: 0.56rem !important;
        line-height: 1.05 !important;
        white-space: nowrap !important;
    }

    .student-question-card {
        padding: 10px 8px !important;
    }

    .student-question-card h3 {
        margin-bottom: 9px !important;
        font-size: 0.88rem !important;
    }

    .question-text {
        margin-bottom: 10px !important;
        font-size: 0.9rem !important;
        line-height: 1.32 !important;
    }

    .student-answer-list {
        gap: 7px !important;
    }

    .student-answer-option {
        display: grid !important;
        grid-template-columns: 30px minmax(0, 1fr) !important;
        min-height: 40px !important;
        gap: 8px !important;
        padding: 6px 8px !important;
        border-radius: 8px !important;
    }

    .student-answer-option span {
        width: 29px !important;
        height: 29px !important;
        font-size: 0.82rem !important;
    }

    .student-answer-option strong {
        font-size: 0.82rem !important;
        line-height: 1.14 !important;
        overflow-wrap: anywhere !important;
    }

    .student-runner-actions {
        display: grid !important;
        grid-template-columns: 1fr 1.05fr 1fr !important;
        gap: 5px !important;
    }

    .student-runner-actions button {
        min-height: 38px !important;
        padding: 4px 3px !important;
        border-radius: 8px !important;
        font-size: 0.62rem !important;
        line-height: 1.08 !important;
    }

    .student-question-palette {
        display: grid !important;
        grid-template-columns: repeat(10, minmax(0, 1fr)) !important;
        gap: 4px !important;
    }

    .student-question-palette button {
        min-height: 30px !important;
        padding: 2px !important;
        border-radius: 6px !important;
        font-size: 0.72rem !important;
    }

    .question-legend {
        display: grid !important;
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 4px !important;
        font-size: 0.56rem !important;
        align-items: center !important;
    }

    .question-legend span {
        gap: 3px !important;
        justify-content: center !important;
        white-space: nowrap !important;
    }

    .question-legend i {
        width: 10px !important;
        height: 10px !important;
        border-radius: 3px !important;
        flex: 0 0 auto !important;
    }

    .student-exam-screen .status-line {
        font-size: 0.56rem !important;
        line-height: 1.1 !important;
    }

    .floating-submit {
        min-width: 76px !important;
        min-height: 34px !important;
        right: 6px !important;
        bottom: 6px !important;
        padding: 4px 8px !important;
        border-radius: 8px !important;
        font-size: 0.68rem !important;
    }
}

/* v2.1.17 phone top-bar width fix: keep Calculator visible like tablet */
@media (max-width: 620px) {
    .student-exam-topbar {
        grid-template-columns: 32px minmax(0, 1fr) 118px !important;
        gap: 4px !important;
        padding-left: 4px !important;
        padding-right: 4px !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow: visible !important;
    }

    .student-exam-title h2 {
        font-size: 0.92rem !important;
        max-width: 100% !important;
    }

    .student-exam-title p {
        font-size: 0.6rem !important;
        max-width: 100% !important;
    }

    .student-exam-tools {
        display: grid !important;
        grid-template-columns: 66px 44px !important;
        gap: 4px !important;
        width: 118px !important;
        min-width: 118px !important;
        justify-content: end !important;
        align-items: center !important;
    }

    .exam-icon-action {
        width: 100% !important;
        min-width: 0 !important;
        height: 42px !important;
        min-height: 42px !important;
        padding: 0 !important;
        font-size: 1.1rem !important;
        line-height: 1 !important;
        overflow: visible !important;
    }

    .exam-icon-action span {
        display: block !important;
        font-size: 0.56rem !important;
        line-height: 1 !important;
        white-space: nowrap !important;
        overflow: visible !important;
        text-overflow: clip !important;
        margin-top: 2px !important;
    }

    .exam-back {
        width: 32px !important;
        min-width: 32px !important;
        height: 42px !important;
        min-height: 42px !important;
    }

    .student-exam-scroll {
        padding-left: 4px !important;
        padding-right: 4px !important;
    }
}

/* v2.1.18 final phone match-to-tablet layout */
@media (max-width: 620px) {
    body.exam-active-mode,
    body.exam-active-mode .portal-shell,
    body.exam-active-mode .dashboard,
    body.exam-active-mode .dashboard-main,
    body.exam-active-mode .tab-panel,
    .student-exam-screen {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        overflow-x: hidden !important;
        background: #ffffff !important;
    }

    .student-exam-screen * {
        box-sizing: border-box !important;
    }

    .student-exam-topbar,
    .student-exam-scroll,
    .floating-submit,
    .student-exam-screen .exam-calculator {
        transform: none !important;
    }

    .student-exam-topbar {
        display: grid !important;
        grid-template-columns: 34px minmax(0, 1fr) 122px !important;
        align-items: center !important;
        gap: 6px !important;
        width: 100% !important;
        max-width: 100% !important;
        min-height: 56px !important;
        padding: 7px 6px !important;
        overflow: hidden !important;
        border-bottom: 1px solid #edf1f7 !important;
    }

    .exam-back {
        width: 34px !important;
        min-width: 34px !important;
        height: 42px !important;
        min-height: 42px !important;
        padding: 0 !important;
        font-size: 1.25rem !important;
    }

    .student-exam-title {
        min-width: 0 !important;
        overflow: hidden !important;
    }

    .student-exam-title h2 {
        margin: 0 !important;
        font-size: 1rem !important;
        line-height: 1.08 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .student-exam-title p {
        margin: 2px 0 0 !important;
        font-size: 0.66rem !important;
        line-height: 1.05 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .student-exam-tools {
        display: grid !important;
        grid-template-columns: 72px 44px !important;
        gap: 6px !important;
        width: 122px !important;
        min-width: 122px !important;
        justify-content: end !important;
        align-items: center !important;
        overflow: visible !important;
    }

    .exam-icon-action {
        display: grid !important;
        place-items: center !important;
        width: 100% !important;
        min-width: 0 !important;
        height: 42px !important;
        min-height: 42px !important;
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
        font-size: 1.15rem !important;
        line-height: 1 !important;
        overflow: visible !important;
    }

    .exam-icon-action span {
        display: block !important;
        width: 100% !important;
        margin-top: 2px !important;
        font-size: 0.58rem !important;
        line-height: 1 !important;
        text-align: center !important;
        white-space: nowrap !important;
        overflow: visible !important;
        text-overflow: clip !important;
    }

    .student-exam-scroll {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        padding: 8px 4px 72px !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
    }

    .exam-candidate-card,
    .exam-stat-strip,
    .student-question-card,
    .student-runner-actions,
    .student-question-palette,
    .question-legend,
    .student-exam-screen .exam-progress,
    .student-exam-screen .status-line {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin: 0 0 9px 0 !important;
    }

    .exam-candidate-card {
        display: grid !important;
        justify-items: center !important;
        text-align: center !important;
        padding: 10px 8px !important;
        gap: 3px !important;
        border-radius: 10px !important;
    }

    .exam-candidate-photo {
        width: 68px !important;
        height: 68px !important;
        border-radius: 8px !important;
    }

    .exam-candidate-card h3 {
        margin: 3px 0 0 !important;
        font-size: 1rem !important;
        line-height: 1.1 !important;
    }

    .exam-candidate-card p {
        margin: 0 !important;
        font-size: 0.72rem !important;
        line-height: 1.12 !important;
    }

    .exam-stat-strip {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        padding: 10px 4px !important;
        border-radius: 10px !important;
    }

    .exam-stat-strip div {
        display: grid !important;
        grid-template-columns: auto minmax(0, auto) !important;
        grid-template-rows: auto auto !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 0 5px !important;
        padding: 0 2px !important;
        text-align: left !important;
    }

    .stat-icon {
        grid-row: span 2 !important;
        width: 27px !important;
        height: 27px !important;
        font-size: 0.82rem !important;
        border-width: 2px !important;
    }

    .exam-stat-strip strong {
        font-size: 0.72rem !important;
        line-height: 1.05 !important;
        white-space: nowrap !important;
    }

    .exam-stat-strip span {
        font-size: 0.56rem !important;
        line-height: 1.05 !important;
        white-space: nowrap !important;
    }

    .student-exam-screen .exam-progress {
        height: 5px !important;
    }

    .student-question-card {
        padding: 10px 8px !important;
        border-radius: 10px !important;
    }

    .student-question-card h3 {
        margin-bottom: 9px !important;
        font-size: 0.88rem !important;
    }

    .question-text {
        margin-bottom: 10px !important;
        font-size: 0.9rem !important;
        line-height: 1.32 !important;
    }

    .student-answer-list {
        gap: 7px !important;
    }

    .student-answer-option {
        display: grid !important;
        grid-template-columns: 30px minmax(0, 1fr) !important;
        align-items: center !important;
        min-height: 40px !important;
        gap: 8px !important;
        padding: 6px 8px !important;
        border-radius: 8px !important;
    }

    .student-answer-option span {
        width: 29px !important;
        height: 29px !important;
        font-size: 0.82rem !important;
    }

    .student-answer-option strong {
        font-size: 0.82rem !important;
        line-height: 1.14 !important;
        overflow-wrap: anywhere !important;
    }

    .student-runner-actions {
        display: grid !important;
        grid-template-columns: 1fr 1.05fr 1fr !important;
        gap: 5px !important;
    }

    .student-runner-actions button {
        min-height: 38px !important;
        padding: 4px 3px !important;
        border-radius: 8px !important;
        font-size: 0.62rem !important;
        line-height: 1.08 !important;
        white-space: normal !important;
    }

    .student-question-palette {
        display: grid !important;
        grid-template-columns: repeat(10, minmax(0, 1fr)) !important;
        gap: 4px !important;
    }

    .student-question-palette button {
        min-height: 30px !important;
        padding: 2px !important;
        border-radius: 6px !important;
        font-size: 0.72rem !important;
    }

    .question-legend {
        display: grid !important;
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 3px !important;
        font-size: 0.54rem !important;
        align-items: center !important;
    }

    .question-legend span {
        display: inline-flex !important;
        justify-content: center !important;
        gap: 2px !important;
        white-space: nowrap !important;
    }

    .question-legend i {
        width: 9px !important;
        height: 9px !important;
        border-radius: 3px !important;
        flex: 0 0 auto !important;
    }

    .student-exam-screen .status-line {
        font-size: 0.56rem !important;
        line-height: 1.1 !important;
    }

    .floating-submit {
        transform: none !important;
        min-width: 76px !important;
        min-height: 34px !important;
        right: 6px !important;
        bottom: 6px !important;
        padding: 4px 8px !important;
        border-radius: 8px !important;
        font-size: 0.68rem !important;
    }
}

/* v2.1.19 strict phone canvas layout based on 1080x2400 class phones */
@media (max-width: 620px) {
    body.exam-active-mode {
        --phone-pad: 8px;
        --phone-header: 54px;
        --phone-footer: 42px;
        overflow: hidden !important;
        background: #ffffff !important;
    }

    .student-exam-screen {
        width: 100vw !important;
        height: var(--exam-vh, 100dvh) !important;
        max-width: 100vw !important;
        overflow: hidden !important;
        display: grid !important;
        grid-template-rows: var(--phone-header) minmax(0, 1fr) !important;
        background: #ffffff !important;
    }

    .student-exam-topbar {
        width: 100vw !important;
        height: var(--phone-header) !important;
        min-height: var(--phone-header) !important;
        display: grid !important;
        grid-template-columns: 32px minmax(0, 1fr) 126px !important;
        align-items: center !important;
        gap: 5px !important;
        padding: 5px var(--phone-pad) !important;
        margin: 0 !important;
        overflow: hidden !important;
        border-bottom: 1px solid #edf1f7 !important;
    }

    .exam-back {
        width: 32px !important;
        min-width: 32px !important;
        height: 40px !important;
        min-height: 40px !important;
        padding: 0 !important;
        font-size: 1.15rem !important;
    }

    .student-exam-title {
        min-width: 0 !important;
        overflow: hidden !important;
    }

    .student-exam-title h2 {
        margin: 0 !important;
        font-size: 1rem !important;
        line-height: 1.05 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .student-exam-title p {
        margin: 2px 0 0 !important;
        font-size: 0.64rem !important;
        line-height: 1 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .student-exam-tools {
        width: 126px !important;
        min-width: 126px !important;
        display: grid !important;
        grid-template-columns: 74px 46px !important;
        gap: 6px !important;
        align-items: center !important;
        justify-content: end !important;
        overflow: visible !important;
    }

    .exam-icon-action {
        width: 100% !important;
        min-width: 0 !important;
        height: 42px !important;
        min-height: 42px !important;
        padding: 0 !important;
        display: grid !important;
        place-items: center !important;
        border: 0 !important;
        background: transparent !important;
        font-size: 1.08rem !important;
        line-height: 1 !important;
        color: #0b1220 !important;
        overflow: visible !important;
    }

    .exam-icon-action span {
        display: block !important;
        width: 100% !important;
        margin-top: 2px !important;
        font-size: 0.56rem !important;
        line-height: 1 !important;
        text-align: center !important;
        white-space: nowrap !important;
        overflow: visible !important;
    }

    .student-exam-scroll {
        width: 100vw !important;
        height: calc(var(--exam-vh, 100dvh) - var(--phone-header)) !important;
        padding: 7px var(--phone-pad) calc(var(--phone-footer) + 8px) !important;
        margin: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        display: grid !important;
        grid-template-rows: auto auto auto minmax(0, auto) auto auto auto auto !important;
        align-content: start !important;
        gap: 7px !important;
    }

    .exam-candidate-card,
    .exam-stat-strip,
    .student-question-card,
    .student-runner-actions,
    .student-question-palette,
    .question-legend,
    .student-exam-screen .exam-progress,
    .student-exam-screen .status-line {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }

    .exam-candidate-card {
        padding: 7px !important;
        border-radius: 10px !important;
        display: grid !important;
        justify-items: center !important;
        text-align: center !important;
        gap: 2px !important;
    }

    .exam-candidate-photo {
        width: 58px !important;
        height: 58px !important;
        border-radius: 8px !important;
    }

    .exam-candidate-card h3 {
        margin: 2px 0 0 !important;
        font-size: 0.92rem !important;
        line-height: 1.05 !important;
    }

    .exam-candidate-card p {
        margin: 0 !important;
        font-size: 0.66rem !important;
        line-height: 1.08 !important;
    }

    .exam-stat-strip {
        height: 58px !important;
        padding: 7px 3px !important;
        border-radius: 10px !important;
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }

    .exam-stat-strip div {
        display: grid !important;
        grid-template-columns: auto minmax(0, auto) !important;
        grid-template-rows: auto auto !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 0 4px !important;
        padding: 0 1px !important;
        text-align: left !important;
    }

    .stat-icon {
        grid-row: span 2 !important;
        width: 25px !important;
        height: 25px !important;
        font-size: 0.76rem !important;
        border-width: 2px !important;
    }

    .exam-stat-strip strong {
        font-size: 0.68rem !important;
        line-height: 1 !important;
        white-space: nowrap !important;
    }

    .exam-stat-strip span {
        font-size: 0.52rem !important;
        line-height: 1 !important;
        white-space: nowrap !important;
    }

    .student-exam-screen .exam-progress {
        height: 5px !important;
    }

    .student-question-card {
        padding: 9px 7px !important;
        border-radius: 10px !important;
    }

    .student-question-card h3 {
        margin: 0 0 8px !important;
        font-size: 0.82rem !important;
        line-height: 1.05 !important;
    }

    .question-text {
        margin-bottom: 9px !important;
        font-size: 0.84rem !important;
        line-height: 1.26 !important;
        overflow-wrap: anywhere !important;
    }

    .student-answer-list {
        gap: 6px !important;
    }

    .student-answer-option {
        min-height: 36px !important;
        display: grid !important;
        grid-template-columns: 27px minmax(0, 1fr) !important;
        gap: 7px !important;
        padding: 5px 7px !important;
        border-radius: 8px !important;
        align-items: center !important;
    }

    .student-answer-option span {
        width: 26px !important;
        height: 26px !important;
        font-size: 0.74rem !important;
    }

    .student-answer-option strong {
        font-size: 0.76rem !important;
        line-height: 1.12 !important;
        overflow-wrap: anywhere !important;
    }

    .student-runner-actions {
        display: grid !important;
        grid-template-columns: 1fr 1.08fr 1fr !important;
        gap: 5px !important;
    }

    .student-runner-actions button {
        min-height: 36px !important;
        padding: 3px !important;
        border-radius: 8px !important;
        font-size: 0.58rem !important;
        line-height: 1.05 !important;
        white-space: normal !important;
    }

    .student-question-palette {
        display: grid !important;
        grid-template-columns: repeat(10, minmax(0, 1fr)) !important;
        gap: 3px !important;
    }

    .student-question-palette button {
        min-height: 27px !important;
        padding: 1px !important;
        border-radius: 6px !important;
        font-size: 0.66rem !important;
    }

    .question-legend {
        display: grid !important;
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 2px !important;
        font-size: 0.5rem !important;
        align-items: center !important;
    }

    .question-legend span {
        justify-content: center !important;
        gap: 2px !important;
        white-space: nowrap !important;
    }

    .question-legend i {
        width: 8px !important;
        height: 8px !important;
        border-radius: 2px !important;
        flex: 0 0 auto !important;
    }

    .student-exam-screen .status-line {
        font-size: 0.5rem !important;
        line-height: 1.05 !important;
    }

    .floating-submit {
        transform: none !important;
        min-width: 70px !important;
        min-height: 32px !important;
        right: var(--phone-pad) !important;
        bottom: 6px !important;
        padding: 4px 8px !important;
        border-radius: 8px !important;
        font-size: 0.64rem !important;
    }
}

@media (max-width: 380px) and (min-height: 760px) {
    body.exam-active-mode {
        --phone-pad: 6px;
    }
}

/* v2.1.20 preview-only phone exam layout: strict 360x800 fit */
@media (max-width: 620px) {
    body.exam-active-mode,
    body.exam-active-mode .portal-shell,
    body.exam-active-mode .dashboard,
    body.exam-active-mode .dashboard-main,
    body.exam-active-mode .tab-panel {
        width: 100% !important;
        height: var(--exam-vh, 100dvh) !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
        background: #fff !important;
    }

    .student-exam-screen {
        position: fixed !important;
        inset: 0 !important;
        display: grid !important;
        grid-template-rows: 52px minmax(0, 1fr) !important;
        width: 100% !important;
        height: var(--exam-vh, 100dvh) !important;
        overflow: hidden !important;
        background: #fff !important;
        color: #0b1220 !important;
    }

    .student-exam-topbar {
        display: grid !important;
        grid-template-columns: 30px minmax(0, 1fr) 124px !important;
        align-items: center !important;
        gap: 4px !important;
        width: 100% !important;
        height: 52px !important;
        min-height: 52px !important;
        padding: 5px 7px !important;
        border-bottom: 1px solid #edf1f7 !important;
        overflow: hidden !important;
        transform: none !important;
    }

    .exam-back {
        width: 30px !important;
        min-width: 30px !important;
        height: 38px !important;
        min-height: 38px !important;
        padding: 0 !important;
        font-size: 1.12rem !important;
        border-radius: 7px !important;
    }

    .student-exam-title {
        min-width: 0 !important;
        overflow: hidden !important;
    }

    .student-exam-title h2 {
        margin: 0 !important;
        font-size: 1rem !important;
        line-height: 1.05 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .student-exam-title p {
        margin: 2px 0 0 !important;
        font-size: 0.64rem !important;
        line-height: 1 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .student-exam-tools {
        display: grid !important;
        grid-template-columns: 74px 44px !important;
        gap: 6px !important;
        width: 124px !important;
        min-width: 124px !important;
        align-items: center !important;
        justify-content: end !important;
    }

    .exam-icon-action {
        display: grid !important;
        place-items: center !important;
        width: 100% !important;
        height: 40px !important;
        min-height: 40px !important;
        padding: 0 !important;
        background: transparent !important;
        border: 0 !important;
        color: #0b1220 !important;
        font-size: 1.05rem !important;
        line-height: 1 !important;
    }

    .exam-icon-action span {
        display: block !important;
        width: 100% !important;
        margin-top: 2px !important;
        font-size: 0.56rem !important;
        line-height: 1 !important;
        text-align: center !important;
        white-space: nowrap !important;
        overflow: visible !important;
    }

    .student-exam-scroll {
        display: grid !important;
        grid-template-rows: 94px 54px 5px minmax(248px, 1fr) 36px 58px 20px 10px !important;
        gap: 6px !important;
        align-content: stretch !important;
        width: 100% !important;
        height: 100% !important;
        padding: 7px 8px 44px !important;
        overflow: hidden !important;
        transform: none !important;
    }

    .exam-candidate-card,
    .exam-stat-strip,
    .student-question-card,
    .student-runner-actions,
    .student-question-palette,
    .question-legend,
    .student-exam-screen .exam-progress,
    .student-exam-screen .status-line {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }

    .exam-candidate-card {
        display: grid !important;
        justify-items: center !important;
        align-content: center !important;
        gap: 1px !important;
        padding: 6px !important;
        border: 1px solid #d9dee8 !important;
        border-radius: 10px !important;
        background: #fff !important;
        text-align: center !important;
    }

    .exam-candidate-photo {
        width: 48px !important;
        height: 48px !important;
        border-radius: 7px !important;
        object-fit: cover !important;
    }

    .exam-candidate-card h3 {
        margin: 2px 0 0 !important;
        font-size: 0.88rem !important;
        line-height: 1.05 !important;
    }

    .exam-candidate-card p {
        margin: 0 !important;
        font-size: 0.62rem !important;
        line-height: 1.05 !important;
    }

    .exam-stat-strip {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        align-items: center !important;
        padding: 6px 4px !important;
        border: 1px solid #d9dee8 !important;
        border-radius: 10px !important;
        background: #fff !important;
    }

    .exam-stat-strip div {
        display: grid !important;
        grid-template-columns: 24px minmax(0, auto) !important;
        grid-template-rows: auto auto !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 0 4px !important;
        padding: 0 1px !important;
        text-align: left !important;
    }

    .stat-icon {
        grid-row: span 2 !important;
        width: 23px !important;
        height: 23px !important;
        font-size: 0.7rem !important;
        border-width: 2px !important;
    }

    .exam-stat-strip strong {
        font-size: 0.65rem !important;
        line-height: 1 !important;
        white-space: nowrap !important;
    }

    .exam-stat-strip span {
        font-size: 0.5rem !important;
        line-height: 1 !important;
        white-space: nowrap !important;
    }

    .student-exam-screen .exam-progress {
        height: 5px !important;
        border-radius: 99px !important;
    }

    .student-question-card {
        display: grid !important;
        grid-template-rows: auto auto minmax(0, 1fr) !important;
        padding: 8px 7px !important;
        border: 1px solid #d9dee8 !important;
        border-radius: 10px !important;
        overflow: hidden !important;
        background: #fff !important;
    }

    .student-question-card h3 {
        margin: 0 0 7px !important;
        color: #075bd7 !important;
        font-size: 0.78rem !important;
        line-height: 1 !important;
    }

    .question-text {
        margin: 0 0 8px !important;
        font-size: 0.82rem !important;
        line-height: 1.25 !important;
        overflow-wrap: anywhere !important;
    }

    .student-answer-list {
        display: grid !important;
        gap: 6px !important;
        min-height: 0 !important;
        align-content: stretch !important;
    }

    .student-answer-option {
        display: grid !important;
        grid-template-columns: 26px minmax(0, 1fr) !important;
        align-items: center !important;
        min-height: 36px !important;
        gap: 7px !important;
        padding: 5px 7px !important;
        border: 1px solid #cfd6e3 !important;
        border-radius: 8px !important;
        background: #fff !important;
    }

    .student-answer-option span {
        width: 25px !important;
        height: 25px !important;
        font-size: 0.72rem !important;
        border-width: 1px !important;
    }

    .student-answer-option strong {
        font-size: 0.74rem !important;
        line-height: 1.1 !important;
        overflow-wrap: anywhere !important;
    }

    .student-runner-actions {
        display: grid !important;
        grid-template-columns: 1fr 1.08fr 1fr !important;
        gap: 5px !important;
    }

    .student-runner-actions button {
        min-height: 36px !important;
        padding: 3px 2px !important;
        border-radius: 8px !important;
        font-size: 0.58rem !important;
        line-height: 1.05 !important;
        white-space: normal !important;
    }

    .student-question-palette {
        display: grid !important;
        grid-template-columns: repeat(10, minmax(0, 1fr)) !important;
        grid-template-rows: repeat(2, 27px) !important;
        gap: 4px !important;
    }

    .student-question-palette button {
        min-height: 0 !important;
        height: 27px !important;
        padding: 1px !important;
        border-radius: 6px !important;
        font-size: 0.66rem !important;
    }

    .question-legend {
        display: grid !important;
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        align-items: center !important;
        gap: 2px !important;
        font-size: 0.5rem !important;
        line-height: 1 !important;
    }

    .question-legend span {
        justify-content: center !important;
        gap: 2px !important;
        white-space: nowrap !important;
    }

    .question-legend i {
        width: 8px !important;
        height: 8px !important;
        border-radius: 2px !important;
        flex: 0 0 auto !important;
    }

    .student-exam-screen .status-line {
        font-size: 0.48rem !important;
        line-height: 1 !important;
        overflow: hidden !important;
    }

    .floating-submit {
        position: fixed !important;
        right: 8px !important;
        bottom: 6px !important;
        min-width: 68px !important;
        min-height: 32px !important;
        padding: 4px 8px !important;
        border-radius: 8px !important;
        font-size: 0.62rem !important;
        transform: none !important;
        z-index: 40 !important;
    }
}

/* v2.1.21 phone exact tablet-style canvas scaled to fit */
@media (max-width: 620px) {
    body.exam-active-mode {
        --phone-canvas-width: 820px;
        --phone-scale: calc(100vw / 820);
        overflow: hidden !important;
        background: #ffffff !important;
    }

    .student-exam-screen {
        position: fixed !important;
        inset: 0 !important;
        width: 100vw !important;
        height: var(--exam-vh, 100dvh) !important;
        overflow: auto !important;
        background: #ffffff !important;
    }

    .student-exam-topbar,
    .student-exam-scroll {
        width: var(--phone-canvas-width) !important;
        max-width: var(--phone-canvas-width) !important;
        min-width: var(--phone-canvas-width) !important;
        margin: 0 !important;
        transform: scale(var(--phone-scale)) !important;
        transform-origin: top left !important;
        box-sizing: border-box !important;
    }

    .student-exam-topbar {
        display: grid !important;
        grid-template-columns: 44px minmax(0, 1fr) 156px !important;
        align-items: center !important;
        gap: 18px !important;
        height: 78px !important;
        min-height: 78px !important;
        padding: 18px 32px 14px !important;
        border-bottom: 1px solid #edf1f7 !important;
        overflow: visible !important;
    }

    .exam-back {
        width: 44px !important;
        min-width: 44px !important;
        height: 44px !important;
        min-height: 44px !important;
        padding: 0 !important;
        font-size: 1.85rem !important;
    }

    .student-exam-title h2 {
        margin: 0 !important;
        font-size: 1.35rem !important;
        line-height: 1.1 !important;
        color: #0b1220 !important;
    }

    .student-exam-title p {
        margin: 3px 0 0 !important;
        font-size: 0.86rem !important;
        line-height: 1.1 !important;
        color: #344054 !important;
    }

    .student-exam-tools {
        display: grid !important;
        grid-template-columns: 86px 58px !important;
        gap: 12px !important;
        width: 156px !important;
        min-width: 156px !important;
        justify-content: end !important;
        align-items: center !important;
    }

    .exam-icon-action {
        display: grid !important;
        place-items: center !important;
        width: 100% !important;
        min-width: 0 !important;
        height: 48px !important;
        min-height: 48px !important;
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
        color: #0b1220 !important;
        font-size: 1.35rem !important;
        line-height: 1 !important;
        overflow: visible !important;
    }

    .exam-icon-action span {
        display: block !important;
        width: 100% !important;
        margin-top: 4px !important;
        font-size: 0.8rem !important;
        line-height: 1 !important;
        text-align: center !important;
        white-space: nowrap !important;
        overflow: visible !important;
    }

    .student-exam-scroll {
        display: block !important;
        height: auto !important;
        min-height: calc(var(--exam-vh, 100dvh) / var(--phone-scale) - 78px) !important;
        padding: 18px 33px 94px !important;
        overflow: visible !important;
    }

    .exam-candidate-card,
    .exam-stat-strip,
    .student-question-card,
    .student-runner-actions,
    .student-question-palette,
    .question-legend,
    .student-exam-screen .exam-progress,
    .student-exam-screen .status-line {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        margin-bottom: 16px !important;
        box-sizing: border-box !important;
    }

    .exam-candidate-card {
        display: grid !important;
        justify-items: center !important;
        text-align: center !important;
        gap: 6px !important;
        padding: 22px !important;
        border: 1px solid #d9dee8 !important;
        border-radius: 12px !important;
        background: #ffffff !important;
    }

    .exam-candidate-photo {
        width: 104px !important;
        height: 104px !important;
        border-radius: 10px !important;
        object-fit: cover !important;
    }

    .exam-candidate-card h3 {
        margin: 8px 0 0 !important;
        font-size: 1.45rem !important;
        line-height: 1.12 !important;
    }

    .exam-candidate-card p {
        margin: 0 !important;
        font-size: 0.96rem !important;
        line-height: 1.18 !important;
    }

    .exam-stat-strip {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        padding: 18px 24px !important;
        border: 1px solid #d9dee8 !important;
        border-radius: 12px !important;
        background: #ffffff !important;
    }

    .exam-stat-strip div {
        display: grid !important;
        grid-template-columns: auto minmax(0, auto) !important;
        grid-template-rows: auto auto !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 0 12px !important;
        padding: 0 14px !important;
        text-align: left !important;
    }

    .stat-icon {
        grid-row: span 2 !important;
        width: 42px !important;
        height: 42px !important;
        font-size: 1.2rem !important;
        border-width: 3px !important;
    }

    .exam-stat-strip strong {
        font-size: 1.05rem !important;
        line-height: 1.1 !important;
        white-space: nowrap !important;
    }

    .exam-stat-strip span {
        font-size: 0.82rem !important;
        line-height: 1.1 !important;
        white-space: nowrap !important;
    }

    .student-exam-screen .exam-progress {
        height: 6px !important;
        border-radius: 999px !important;
    }

    .student-question-card {
        padding: 28px 24px !important;
        border: 1px solid #d9dee8 !important;
        border-radius: 12px !important;
        background: #ffffff !important;
    }

    .student-question-card h3 {
        margin: 0 0 30px !important;
        color: #075bd7 !important;
        font-size: 1.08rem !important;
        line-height: 1 !important;
    }

    .question-text {
        margin: 0 0 28px !important;
        font-size: 1.15rem !important;
        line-height: 1.48 !important;
        overflow-wrap: anywhere !important;
    }

    .student-answer-list {
        display: grid !important;
        gap: 16px !important;
    }

    .student-answer-option {
        display: grid !important;
        grid-template-columns: 44px minmax(0, 1fr) !important;
        align-items: center !important;
        min-height: 68px !important;
        gap: 18px !important;
        padding: 12px 18px !important;
        border: 1px solid #cfd6e3 !important;
        border-radius: 12px !important;
        background: #ffffff !important;
    }

    .student-answer-option span {
        width: 42px !important;
        height: 42px !important;
        font-size: 1.1rem !important;
        border-width: 2px !important;
    }

    .student-answer-option strong {
        font-size: 1rem !important;
        line-height: 1.2 !important;
        overflow-wrap: anywhere !important;
    }

    .student-runner-actions {
        display: grid !important;
        grid-template-columns: 1fr 1.08fr 1.16fr !important;
        gap: 16px !important;
    }

    .student-runner-actions button {
        min-height: 58px !important;
        padding: 10px !important;
        border-radius: 10px !important;
        font-size: 1rem !important;
        line-height: 1.1 !important;
        white-space: normal !important;
    }

    .student-question-palette {
        display: grid !important;
        grid-template-columns: repeat(10, minmax(0, 1fr)) !important;
        gap: 10px !important;
    }

    .student-question-palette button {
        min-height: 48px !important;
        padding: 4px !important;
        border-radius: 9px !important;
        font-size: 1rem !important;
    }

    .question-legend {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 16px 28px !important;
        font-size: 0.95rem !important;
        line-height: 1 !important;
    }

    .question-legend span {
        justify-content: center !important;
        gap: 8px !important;
        white-space: nowrap !important;
    }

    .question-legend i {
        width: 20px !important;
        height: 20px !important;
        border-radius: 5px !important;
        flex: 0 0 auto !important;
    }

    .student-exam-screen .status-line {
        font-size: 0.82rem !important;
        line-height: 1.1 !important;
    }

    .floating-submit {
        position: fixed !important;
        right: 14px !important;
        bottom: 14px !important;
        min-width: 120px !important;
        min-height: 58px !important;
        padding: 10px 18px !important;
        border-radius: 10px !important;
        font-size: 1rem !important;
        transform: scale(var(--phone-scale)) !important;
        transform-origin: bottom right !important;
        z-index: 40 !important;
    }
}

/* v2.1.22 sane phone-first exam layout: usable, full-width, no tablet shrinking */
@media (max-width: 620px) {
    body.exam-active-mode,
    body.exam-active-mode .portal-shell,
    body.exam-active-mode .dashboard,
    body.exam-active-mode .dashboard-main,
    body.exam-active-mode .tab-panel {
        width: 100% !important;
        height: var(--exam-vh, 100dvh) !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
        background: #f8fafc !important;
    }

    .student-exam-screen {
        position: fixed !important;
        inset: 0 !important;
        display: grid !important;
        grid-template-rows: 54px 1fr 62px !important;
        width: 100% !important;
        height: var(--exam-vh, 100dvh) !important;
        overflow: hidden !important;
        background: #f8fafc !important;
        color: #0b1220 !important;
    }

    .student-exam-screen * {
        box-sizing: border-box !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    .student-exam-topbar,
    .student-exam-scroll,
    .floating-submit,
    .student-exam-screen .exam-calculator {
        transform: none !important;
    }

    .student-exam-topbar {
        display: grid !important;
        grid-template-columns: 34px minmax(0, 1fr) 126px !important;
        align-items: center !important;
        gap: 5px !important;
        width: 100% !important;
        height: 54px !important;
        padding: 6px 8px !important;
        border-bottom: 1px solid #e5e7ef !important;
        background: #ffffff !important;
        overflow: hidden !important;
    }

    .exam-back {
        width: 34px !important;
        height: 40px !important;
        min-width: 34px !important;
        min-height: 40px !important;
        padding: 0 !important;
        font-size: 1.18rem !important;
        border-radius: 8px !important;
    }

    .student-exam-title h2 {
        margin: 0 !important;
        font-size: 1rem !important;
        line-height: 1.08 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .student-exam-title p {
        margin: 2px 0 0 !important;
        font-size: 0.66rem !important;
        line-height: 1 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .student-exam-tools {
        display: grid !important;
        grid-template-columns: 76px 44px !important;
        gap: 6px !important;
        width: 126px !important;
        align-items: center !important;
    }

    .exam-icon-action {
        display: grid !important;
        place-items: center !important;
        width: 100% !important;
        height: 42px !important;
        min-height: 42px !important;
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
        color: #0b1220 !important;
        font-size: 1.08rem !important;
        line-height: 1 !important;
    }

    .exam-icon-action span {
        display: block !important;
        width: 100% !important;
        margin-top: 2px !important;
        font-size: 0.58rem !important;
        line-height: 1 !important;
        text-align: center !important;
        white-space: nowrap !important;
        overflow: visible !important;
    }

    .student-exam-scroll {
        display: grid !important;
        grid-template-rows: auto auto 4px minmax(0, 1fr) auto !important;
        gap: 7px !important;
        width: 100% !important;
        height: 100% !important;
        padding: 7px 8px !important;
        overflow: hidden !important;
        background: #f8fafc !important;
    }

    .exam-candidate-card,
    .exam-stat-strip,
    .student-exam-screen .exam-progress,
    .student-question-card,
    .student-question-palette,
    .question-legend,
    .student-exam-screen .status-line {
        width: 100% !important;
        margin: 0 !important;
    }

    .exam-candidate-card {
        display: grid !important;
        grid-template-columns: 46px minmax(0, 1fr) !important;
        grid-template-rows: auto auto auto !important;
        align-items: center !important;
        justify-items: start !important;
        gap: 1px 8px !important;
        min-height: 64px !important;
        padding: 7px !important;
        border: 1px solid #d9dee8 !important;
        border-radius: 10px !important;
        background: #ffffff !important;
        text-align: left !important;
    }

    .exam-candidate-photo {
        grid-row: 1 / 4 !important;
        width: 44px !important;
        height: 44px !important;
        border-radius: 8px !important;
        object-fit: cover !important;
    }

    .exam-candidate-card h3 {
        margin: 0 !important;
        font-size: 0.86rem !important;
        line-height: 1.05 !important;
    }

    .exam-candidate-card p {
        margin: 0 !important;
        font-size: 0.6rem !important;
        line-height: 1.05 !important;
    }

    .exam-stat-strip {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        min-height: 52px !important;
        padding: 6px 4px !important;
        border: 1px solid #d9dee8 !important;
        border-radius: 10px !important;
        background: #ffffff !important;
    }

    .exam-stat-strip div {
        display: grid !important;
        grid-template-columns: 22px minmax(0, auto) !important;
        grid-template-rows: auto auto !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0 4px !important;
        padding: 0 2px !important;
        text-align: left !important;
    }

    .stat-icon {
        grid-row: span 2 !important;
        width: 21px !important;
        height: 21px !important;
        font-size: 0.65rem !important;
        border-width: 2px !important;
    }

    .exam-stat-strip strong {
        font-size: 0.64rem !important;
        line-height: 1 !important;
        white-space: nowrap !important;
    }

    .exam-stat-strip span {
        font-size: 0.49rem !important;
        line-height: 1 !important;
        white-space: nowrap !important;
    }

    .student-exam-screen .exam-progress {
        height: 4px !important;
        border-radius: 999px !important;
    }

    .student-question-card {
        display: grid !important;
        grid-template-rows: auto auto minmax(0, 1fr) !important;
        min-height: 0 !important;
        overflow: hidden !important;
        padding: 9px 8px !important;
        border: 1px solid #d9dee8 !important;
        border-radius: 10px !important;
        background: #ffffff !important;
    }

    .student-question-card h3 {
        margin: 0 0 8px !important;
        color: #075bd7 !important;
        font-size: 0.78rem !important;
        line-height: 1 !important;
    }

    .question-text {
        margin: 0 0 8px !important;
        font-size: 0.82rem !important;
        line-height: 1.25 !important;
        overflow-wrap: anywhere !important;
    }

    .student-answer-list {
        display: grid !important;
        gap: 6px !important;
        min-height: 0 !important;
        overflow: auto !important;
        padding-bottom: 1px !important;
    }

    .student-answer-option {
        display: grid !important;
        grid-template-columns: 26px minmax(0, 1fr) !important;
        align-items: center !important;
        min-height: 36px !important;
        gap: 7px !important;
        padding: 5px 7px !important;
        border: 1px solid #cfd6e3 !important;
        border-radius: 8px !important;
        background: #ffffff !important;
    }

    .student-answer-option span {
        width: 25px !important;
        height: 25px !important;
        font-size: 0.72rem !important;
        border-width: 1px !important;
    }

    .student-answer-option strong {
        font-size: 0.74rem !important;
        line-height: 1.1 !important;
        overflow-wrap: anywhere !important;
    }

    .student-runner-actions {
        position: fixed !important;
        left: 8px !important;
        right: 84px !important;
        bottom: 7px !important;
        display: grid !important;
        grid-template-columns: 1fr 1.12fr 1fr !important;
        gap: 5px !important;
        z-index: 42 !important;
        width: auto !important;
        margin: 0 !important;
    }

    .student-runner-actions button {
        min-height: 36px !important;
        padding: 3px 2px !important;
        border-radius: 8px !important;
        font-size: 0.58rem !important;
        line-height: 1.05 !important;
        white-space: normal !important;
    }

    .student-question-palette {
        display: grid !important;
        grid-template-columns: repeat(10, minmax(0, 1fr)) !important;
        grid-template-rows: repeat(2, 26px) !important;
        gap: 3px !important;
    }

    .student-question-palette button {
        min-height: 0 !important;
        height: 26px !important;
        padding: 1px !important;
        border-radius: 6px !important;
        font-size: 0.64rem !important;
    }

    .question-legend,
    .student-exam-screen .status-line {
        display: none !important;
    }

    .floating-submit {
        position: fixed !important;
        right: 8px !important;
        bottom: 7px !important;
        min-width: 70px !important;
        min-height: 36px !important;
        padding: 4px 8px !important;
        border-radius: 8px !important;
        font-size: 0.64rem !important;
        transform: none !important;
        z-index: 44 !important;
    }
}

/* v2.1.23 native phone fit-to-screen exam layout: no zoom, no scale */
@media (max-width: 620px) {
    body.exam-active-mode,
    body.exam-active-mode .portal-shell,
    body.exam-active-mode .dashboard,
    body.exam-active-mode .dashboard-main,
    body.exam-active-mode .tab-panel {
        width: 100% !important;
        height: var(--exam-vh, 100dvh) !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
        background: #f8fafc !important;
    }

    .student-exam-screen,
    .student-exam-screen * {
        box-sizing: border-box !important;
    }

    .student-exam-screen {
        position: fixed !important;
        inset: 0 !important;
        display: grid !important;
        grid-template-rows: 54px minmax(0, 1fr) 48px !important;
        width: 100% !important;
        height: var(--exam-vh, 100dvh) !important;
        overflow: hidden !important;
        background: #f8fafc !important;
        transform: none !important;
    }

    .student-exam-topbar,
    .student-exam-scroll,
    .floating-submit,
    .student-exam-screen .exam-calculator {
        transform: none !important;
    }

    .student-exam-topbar {
        display: grid !important;
        grid-template-columns: 34px minmax(0, 1fr) 126px !important;
        align-items: center !important;
        gap: 6px !important;
        width: 100% !important;
        height: 54px !important;
        padding: 6px 8px !important;
        border-bottom: 1px solid #e5e7ef !important;
        background: #ffffff !important;
        overflow: hidden !important;
    }

    .exam-back {
        width: 34px !important;
        height: 40px !important;
        min-width: 34px !important;
        min-height: 40px !important;
        padding: 0 !important;
        font-size: 1.1rem !important;
        border-radius: 8px !important;
    }

    .student-exam-title {
        min-width: 0 !important;
        overflow: hidden !important;
    }

    .student-exam-title h2 {
        margin: 0 !important;
        font-size: 1rem !important;
        line-height: 1.05 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .student-exam-title p {
        margin: 2px 0 0 !important;
        font-size: 0.66rem !important;
        line-height: 1 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .student-exam-tools {
        display: grid !important;
        grid-template-columns: 76px 44px !important;
        gap: 6px !important;
        width: 126px !important;
        min-width: 126px !important;
        align-items: center !important;
    }

    .exam-icon-action {
        display: grid !important;
        place-items: center !important;
        width: 100% !important;
        height: 42px !important;
        min-height: 42px !important;
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
        color: #0b1220 !important;
        font-size: 1.05rem !important;
        line-height: 1 !important;
    }

    .exam-icon-action span {
        display: block !important;
        width: 100% !important;
        margin-top: 2px !important;
        font-size: 0.58rem !important;
        line-height: 1 !important;
        text-align: center !important;
        white-space: nowrap !important;
        overflow: visible !important;
    }

    .student-exam-scroll {
        display: grid !important;
        grid-template-rows: 54px 50px 4px minmax(0, 1fr) 58px !important;
        gap: 6px !important;
        width: 100% !important;
        height: 100% !important;
        padding: 6px 8px !important;
        overflow: hidden !important;
        background: #f8fafc !important;
    }

    .exam-candidate-card,
    .exam-stat-strip,
    .student-exam-screen .exam-progress,
    .student-question-card,
    .student-question-palette {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
    }

    .exam-candidate-card {
        display: grid !important;
        grid-template-columns: 42px minmax(0, 1fr) !important;
        grid-template-rows: auto auto auto !important;
        align-items: center !important;
        gap: 0 8px !important;
        padding: 6px 7px !important;
        border: 1px solid #d9dee8 !important;
        border-radius: 10px !important;
        background: #ffffff !important;
        text-align: left !important;
    }

    .exam-candidate-photo {
        grid-row: 1 / 4 !important;
        width: 40px !important;
        height: 40px !important;
        border-radius: 8px !important;
        object-fit: cover !important;
    }

    .exam-candidate-card h3 {
        margin: 0 !important;
        font-size: 0.82rem !important;
        line-height: 1 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .exam-candidate-card p {
        margin: 0 !important;
        font-size: 0.58rem !important;
        line-height: 1.05 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .exam-stat-strip {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        padding: 5px 3px !important;
        border: 1px solid #d9dee8 !important;
        border-radius: 10px !important;
        background: #ffffff !important;
    }

    .exam-stat-strip div {
        display: grid !important;
        grid-template-columns: 20px minmax(0, auto) !important;
        grid-template-rows: auto auto !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0 4px !important;
        padding: 0 1px !important;
        text-align: left !important;
    }

    .stat-icon {
        grid-row: span 2 !important;
        width: 20px !important;
        height: 20px !important;
        font-size: 0.6rem !important;
        border-width: 2px !important;
    }

    .exam-stat-strip strong {
        font-size: 0.6rem !important;
        line-height: 1 !important;
        white-space: nowrap !important;
    }

    .exam-stat-strip span {
        font-size: 0.46rem !important;
        line-height: 1 !important;
        white-space: nowrap !important;
    }

    .student-exam-screen .exam-progress {
        height: 4px !important;
        border-radius: 999px !important;
    }

    .student-question-card {
        display: grid !important;
        grid-template-rows: auto auto minmax(0, 1fr) !important;
        min-height: 0 !important;
        overflow: hidden !important;
        padding: 8px 7px !important;
        border: 1px solid #d9dee8 !important;
        border-radius: 10px !important;
        background: #ffffff !important;
    }

    .student-question-card h3 {
        margin: 0 0 7px !important;
        color: #075bd7 !important;
        font-size: 0.76rem !important;
        line-height: 1 !important;
    }

    .question-text {
        margin: 0 0 8px !important;
        font-size: 0.82rem !important;
        line-height: 1.24 !important;
        overflow-wrap: anywhere !important;
    }

    .student-answer-list {
        display: grid !important;
        gap: 6px !important;
        min-height: 0 !important;
        overflow: auto !important;
        align-content: start !important;
    }

    .student-answer-option {
        display: grid !important;
        grid-template-columns: 25px minmax(0, 1fr) !important;
        align-items: center !important;
        min-height: 34px !important;
        gap: 7px !important;
        padding: 5px 7px !important;
        border: 1px solid #cfd6e3 !important;
        border-radius: 8px !important;
        background: #ffffff !important;
    }

    .student-answer-option span {
        width: 24px !important;
        height: 24px !important;
        font-size: 0.68rem !important;
        border-width: 1px !important;
    }

    .student-answer-option strong {
        font-size: 0.72rem !important;
        line-height: 1.1 !important;
        overflow-wrap: anywhere !important;
    }

    .student-question-palette {
        display: grid !important;
        grid-template-columns: repeat(10, minmax(0, 1fr)) !important;
        grid-template-rows: repeat(2, 26px) !important;
        gap: 3px !important;
    }

    .student-question-palette button {
        min-height: 0 !important;
        height: 26px !important;
        padding: 1px !important;
        border-radius: 6px !important;
        font-size: 0.64rem !important;
    }

    .student-runner-actions {
        position: fixed !important;
        left: 8px !important;
        right: 84px !important;
        bottom: 6px !important;
        display: grid !important;
        grid-template-columns: 1fr 1.12fr 1fr !important;
        gap: 5px !important;
        width: auto !important;
        margin: 0 !important;
        z-index: 42 !important;
    }

    .student-runner-actions button {
        min-height: 36px !important;
        padding: 3px 2px !important;
        border-radius: 8px !important;
        font-size: 0.56rem !important;
        line-height: 1.05 !important;
        white-space: normal !important;
    }

    .floating-submit {
        position: fixed !important;
        right: 8px !important;
        bottom: 6px !important;
        min-width: 70px !important;
        min-height: 36px !important;
        padding: 4px 8px !important;
        border-radius: 8px !important;
        font-size: 0.62rem !important;
        transform: none !important;
        z-index: 44 !important;
    }

    .question-legend,
    .student-exam-screen .status-line {
        display: none !important;
    }
}

/* v2.1.24 phone visible Calculator, Flag, and Submit controls */
@media (max-width: 620px) {
    .student-exam-topbar {
        grid-template-columns: 32px minmax(0, 1fr) 132px !important;
        gap: 5px !important;
        padding-left: 6px !important;
        padding-right: 6px !important;
    }

    .student-exam-tools {
        display: grid !important;
        grid-template-columns: 78px 48px !important;
        width: 132px !important;
        min-width: 132px !important;
        gap: 6px !important;
    }

    .exam-icon-action {
        height: 42px !important;
        min-height: 42px !important;
        overflow: visible !important;
    }

    .exam-icon-action span {
        display: block !important;
        font-size: 0.58rem !important;
        white-space: nowrap !important;
        overflow: visible !important;
    }

    #toggleCalculator span,
    #moreExamActions span {
        visibility: visible !important;
    }

    #moreExamActions {
        color: #f97316 !important;
    }

    .student-exam-scroll {
        padding-bottom: 54px !important;
    }

    .student-runner-actions {
        left: 8px !important;
        right: 84px !important;
        bottom: 7px !important;
        z-index: 42 !important;
    }

    .floating-submit {
        display: inline-grid !important;
        place-items: center !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: fixed !important;
        right: 8px !important;
        bottom: 7px !important;
        z-index: 60 !important;
        min-width: 70px !important;
        width: 70px !important;
        min-height: 36px !important;
        height: 36px !important;
        padding: 0 6px !important;
        border-radius: 8px !important;
        font-size: 0.62rem !important;
        line-height: 1 !important;
    }
}

/* v2.1.26 reference-style native phone exam renderer */
@media (max-width: 620px) {
    .phone-exam-screen {
        position: fixed;
        inset: 0;
        box-sizing: border-box;
        display: grid;
        grid-template-rows: 76px 166px 86px 5px minmax(0, 1fr) 74px 104px 38px;
        gap: 8px;
        width: 100vw;
        height: var(--exam-vh, 100dvh);
        padding: 8px 14px calc(8px + env(safe-area-inset-bottom));
        overflow: hidden;
        background: #ffffff;
        color: #111827;
        font-family: Arial, Helvetica, sans-serif;
    }

    .phone-exam-top {
        display: grid;
        grid-template-columns: 34px minmax(0, 1fr) 76px 52px;
        gap: 10px;
        align-items: center;
        min-width: 0;
    }

    .phone-icon,
    .phone-tool,
    .phone-bottom button {
        appearance: none;
        border: 0;
        background: transparent;
        color: #111827;
        font-weight: 800;
    }

    .phone-icon {
        width: 34px;
        height: 42px;
        padding: 0;
        font-size: 1.7rem;
        line-height: 1;
    }

    .phone-exam-title { min-width: 0; display: grid; gap: 4px; }
    .phone-exam-title strong,
    .phone-exam-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .phone-exam-title strong { font-size: 1.1rem; line-height: 1.05; }
    .phone-exam-title span { color: #667085; font-size: 0.82rem; line-height: 1; font-weight: 500; }

    .phone-tool {
        display: grid;
        place-items: center;
        gap: 3px;
        min-width: 0;
        height: 48px;
        padding: 0;
        font-size: 1.35rem;
        line-height: 1;
    }

    .phone-tool span {
        display: block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.72rem;
        line-height: 1;
        font-weight: 500;
    }

    .phone-candidate,
    .phone-exam-stats,
    .phone-question article {
        border: 1px solid #d7dce6;
        border-radius: 8px;
        background: #ffffff;
    }

    .phone-candidate {
        display: grid;
        justify-items: center;
        align-content: center;
        gap: 6px;
        padding: 10px;
        text-align: center;
        min-width: 0;
    }

    .phone-candidate img {
        width: 72px;
        height: 72px;
        border-radius: 8px;
        object-fit: cover;
        border: 1px solid #9ca3af;
        background: #eef2f7;
    }

    .phone-candidate strong { display: block; font-size: 1.02rem; line-height: 1.05; }
    .phone-candidate span { display: block; color: #1f2937; font-size: 0.74rem; line-height: 1.45; }

    .phone-exam-stats {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        align-items: center;
        overflow: hidden;
    }

    .phone-exam-stats div {
        position: relative;
        display: grid;
        grid-template-columns: 32px minmax(0, auto);
        grid-template-rows: auto auto;
        column-gap: 8px;
        align-items: center;
        justify-content: center;
        min-width: 0;
        height: 100%;
        padding: 0 6px;
    }

    .phone-exam-stats div:not(:last-child)::after {
        content: "";
        position: absolute;
        right: 0;
        top: 22%;
        bottom: 22%;
        width: 1px;
        background: #e5e7ef;
    }

    .phone-exam-stats i {
        grid-row: 1 / span 2;
        display: grid;
        place-items: center;
        width: 28px;
        height: 28px;
        border-radius: 999px;
        color: #16a34a;
        font-style: normal;
        font-size: 1rem;
    }
    .phone-exam-stats .count i { color: #0b63d8; }
    .phone-exam-stats .flag i { color: #f97316; }
    .phone-exam-stats b { min-width: 0; font-size: 0.78rem; line-height: 1; white-space: nowrap; }
    .phone-exam-stats span { min-width: 0; color: #667085; font-size: 0.62rem; line-height: 1; white-space: nowrap; }

    .phone-exam-progress { height: 5px; border-radius: 999px; overflow: hidden; background: #e5ecf7; }
    .phone-exam-progress span { display: block; height: 100%; background: #0b63d8; border-radius: inherit; }

    .phone-question {
        min-height: 0;
        overflow: hidden;
        display: grid;
    }

    .phone-question article {
        min-width: 0;
        min-height: 0;
        overflow: hidden;
        display: grid;
        grid-template-rows: auto auto minmax(0, 1fr);
        padding: 14px 12px;
    }

    .phone-question h3 {
        margin: 0 0 16px;
        color: #075bd7;
        font-size: 0.88rem;
        line-height: 1;
    }

    .phone-question-text {
        margin-bottom: 16px;
        color: #111827;
        font-size: 0.92rem;
        line-height: 1.35;
        overflow-wrap: anywhere;
    }

    .phone-answers {
        min-height: 0;
        overflow: hidden;
        display: grid;
        gap: 10px;
        align-content: start;
    }

    .phone-answers .student-answer-option {
        display: grid;
        grid-template-columns: 36px minmax(0, 1fr);
        align-items: center;
        min-height: 48px;
        gap: 10px;
        padding: 7px 10px;
        border: 1px solid #cfd6e3;
        border-radius: 8px;
        background: #ffffff;
    }

    .phone-answers .student-answer-option input { display: none; }
    .phone-answers .student-answer-option span {
        display: grid;
        place-items: center;
        width: 28px;
        height: 28px;
        border: 1px solid #aeb8c8;
        border-radius: 999px;
        color: #111827;
        font-size: 0.86rem;
        font-weight: 800;
    }
    .phone-answers .student-answer-option strong {
        min-width: 0;
        color: #111827;
        font-size: 0.88rem;
        line-height: 1.1;
        overflow-wrap: anywhere;
    }

    .phone-bottom {
        display: grid;
        grid-template-columns: 0.92fr 1fr 1.08fr;
        gap: 12px;
        align-items: stretch;
    }

    .phone-bottom button {
        display: grid;
        place-items: center;
        min-width: 0;
        min-height: 54px;
        padding: 0 6px;
        border: 1px solid #cfd6e3;
        border-radius: 8px;
        background: #ffffff;
        color: #111827;
        font-size: 0.78rem;
        line-height: 1;
        white-space: nowrap;
    }
    .phone-bottom button:last-child { background: #0b63d8; border-color: #0b63d8; color: #ffffff; }
    .phone-bottom button span { white-space: nowrap; }

    .phone-palette {
        display: grid;
        grid-template-columns: repeat(10, minmax(0, 1fr));
        grid-template-rows: repeat(2, 42px);
        gap: 8px;
        min-width: 0;
    }

    .phone-palette button {
        min-width: 0;
        min-height: 0;
        padding: 0;
        border: 1px solid #cfd6e3;
        border-radius: 8px;
        background: #ffffff;
        color: #111827;
        font-size: 0.8rem;
        font-weight: 800;
    }
    .phone-palette button.answered { border-color: #16a34a; background: #ecfdf3; color: #15803d; }
    .phone-palette button.flagged { border-color: #f97316; background: #fff7ed; color: #ea580c; }
    .phone-palette button.current { border-color: #0b63d8; background: #0b63d8; color: #ffffff; }

    .phone-legend {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, auto));
        justify-content: center;
        align-items: center;
        gap: 12px;
        min-width: 0;
        overflow: hidden;
        color: #4b5563;
        font-size: 0.66rem;
        white-space: nowrap;
    }
    .phone-legend span { display: inline-grid; grid-auto-flow: column; align-items: center; gap: 5px; min-width: 0; }
    .phone-legend i { display: inline-block; width: 12px; height: 12px; border: 1px solid #cfd6e3; border-radius: 3px; background: #ffffff; }
    .phone-legend i.answered { border-color: #16a34a; background: #ecfdf3; }
    .phone-legend i.flagged { border-color: #f97316; background: #fff7ed; }
    .phone-legend i.current { border-color: #0b63d8; background: #0b63d8; }

    .phone-exam-screen .exam-calculator {
        position: fixed;
        right: 14px;
        top: 82px;
        z-index: 80;
        width: min(300px, calc(100vw - 28px));
        box-shadow: 0 18px 45px rgba(15, 23, 42, 0.22);
    }
}





.result-period { grid-column: 1 / -1; border: 1px solid #d9e2ef; padding: 16px; background: #fff; }
.result-period header { margin-bottom: 12px; }
.result-period h3, .result-period h4 { margin: 0; }
.result-subjects { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.result-card span { color: #64748b; font-size: .85rem; }

/* Unified navy-and-gold examination pass */
.admission-pass { --pass-navy:#082b4c; --pass-gold:#c9a227; display:flex; flex-direction:column; gap:12px; border:1px solid #d5b95a; border-radius:0; padding:14px; color:#0a2440; font-family:Arial,sans-serif; }
.admission-pass-brand { display:grid; grid-template-columns:90px 1fr 170px; gap:14px; align-items:center; padding:4px 8px 10px; }
.admission-pass-brand .school-logo { width:84px; height:84px; border:0; background:#fff; }
.admission-pass-brand h2 { margin:0; color:var(--pass-navy); font-size:28px; line-height:1.05; text-transform:uppercase; }
.admission-pass-brand p { margin:5px 0 0; color:#9a7713; font-size:11px; font-weight:800; text-transform:uppercase; }
.admission-pass-brand em { text-align:right; color:var(--pass-navy); font:italic 18px Georgia,serif; }
.admission-pass-title { background:var(--pass-navy); color:#fff; padding:9px 18px; text-align:center; border-radius:8px; }
.admission-pass-title strong { display:block; font:700 28px Georgia,serif; }
.admission-pass-title span { display:block; margin-top:2px; color:#f0d476; font-size:11px; font-weight:800; letter-spacing:4px; }
.admission-pass-candidate { display:grid; grid-template-columns:150px 1fr; gap:22px; align-items:center; border-bottom:2px solid var(--pass-gold); padding:2px 0 12px; }
.admission-pass .exam-pass-photo { width:150px; height:175px; object-fit:cover; border:2px solid var(--pass-gold); border-radius:8px; background:#f6f8fb; }
.admission-pass-candidate dl { display:grid; grid-template-columns:155px 1fr; gap:8px 12px; margin:0; align-items:start; }
.admission-pass-candidate dt { color:var(--pass-navy); font-size:12px; font-weight:900; text-transform:uppercase; }
.admission-pass-candidate dd { margin:0; font-size:14px; font-weight:700; overflow-wrap:anywhere; }
.admission-pass-candidate .pass-password { color:#9a1f16; font-size:18px; letter-spacing:.5px; }
.admission-pass-timetable h3 { margin:2px 0 8px; text-align:center; color:var(--pass-navy); font:700 22px Georgia,serif; }
.admission-pass table { width:100%; border-collapse:collapse; }
.admission-pass th,.admission-pass td { border:1px solid #8695a7; padding:6px; font-size:11px; }
.admission-pass-timetable th,.admission-pass-timetable td { padding:4px; font-size:9px; overflow-wrap:anywhere; }
.admission-pass th { background:var(--pass-navy); color:#fff; text-align:center; text-transform:uppercase; }
.admission-pass-bottom { display:grid; grid-template-columns:1.25fr .85fr; gap:22px; margin-top:auto; align-items:end; }
.pass-instructions { border:1px solid var(--pass-gold); border-radius:8px; overflow:hidden; }
.pass-instructions h3 { margin:0; background:var(--pass-navy); color:#fff; padding:7px 12px; font:700 14px Georgia,serif; }
.pass-instructions ol { margin:8px 12px 8px 30px; padding:0; font-size:11px; line-height:1.45; }
.pass-instructions li::marker { color:#ae8515; font-weight:800; }
.pass-approval { text-align:center; color:var(--pass-navy); }
.pass-approval>strong { display:block; border-block:1px solid var(--pass-gold); padding:7px; font:italic 23px Georgia,serif; }
.pass-approval .signature-rule { margin:38px 15px 8px; border-top:1px solid var(--pass-navy); padding-top:5px; font-size:11px; font-weight:700; }
.pass-approval small { font-size:10px; }
.admission-pass>footer { border-top:2px solid var(--pass-gold); padding-top:8px; color:#a17e1b; text-align:center; font-size:10px; font-weight:800; letter-spacing:3px; text-transform:uppercase; }
@media(max-width:720px){.admission-pass-brand{grid-template-columns:64px 1fr}.admission-pass-brand em{display:none}.admission-pass-brand h2{font-size:20px}.admission-pass-candidate{grid-template-columns:100px 1fr;gap:12px}.admission-pass .exam-pass-photo{width:100px;height:125px}.admission-pass-candidate dl{grid-template-columns:110px 1fr}.admission-pass-bottom{grid-template-columns:1fr}}
@media print{.admission-pass{width:194mm;min-height:276mm;margin:0 auto;box-shadow:none;page-break-inside:avoid}}
