/* Gaya layar ujian siswa. Dipakai index.php (ujian sungguhan) dan preview.php (pratinjau guru),
   supaya pratinjau selalu sama dengan yang dilihat siswa. Dipindah dari CSS inline index.php (2026-10-25). */

/* Dipakai juga oleh header layar ujian */
.lg-logo { height: 75px; width: auto; object-fit: contain; flex-shrink: 0; }
.lg-logo-icon { font-size: 64px; line-height: 75px; color: #f8f9fa; flex-shrink: 0; }
.lg-title { font-size: 32px; font-weight: 700; line-height: 1.2; margin: 0; }
.lg-subtitle { font-size: 16px; font-weight: 500; line-height: 1.2; margin: 0 0 8px; }

/* ===== Layar Ujian ===== */
body:has(#exam-screen:not(.hidden)) { background-color: #ffffff; }
#exam-screen {
    font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #212529;
}
#exam-screen *:not(.katex):not(.katex *):not(mjx-container):not(mjx-container *) {
    font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
}
.ex-header {
    background-color: #1965a0;
    background-image: radial-gradient(circle, #1965a0, #0b2d48);
    color: #f8f9fa;
    min-height: 200px;
    padding: 24px 15px;
}
.ex-header-inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    max-width: 1110px;
    margin: 0 auto;
}
.ex-brand { display: flex; align-items: flex-start; gap: 16px; min-width: 0; }
.ex-brand-text { min-width: 0; text-align: left; }
.ex-body {
    max-width: 1140px;
    margin: -70px auto 0;
    padding: 0 15px 24px;
}
.ex-card {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, .125);
    border-radius: 4px;
}
.ex-card-body { padding: 20px; }
.ex-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e9ecef;
}
/* Identitas peserta */
.ex-info { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 260px; }
.ex-user { position: relative; flex-shrink: 0; }
.ex-info-avatar {
    position: relative;
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #e8f1f9;
    color: #1965a0;
    font-size: 22px;
    cursor: pointer;
    transition: box-shadow .15s, background-color .15s;
}
.ex-info-avatar:hover, .ex-info-avatar[aria-expanded="true"] {
    background: #d6e7f5;
    box-shadow: 0 0 0 3px rgba(25, 101, 160, .2);
}
.ex-info-avatar:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(25, 101, 160, .45); }
.ex-avatar-caret {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 17px; height: 17px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: #1965a0;
    border: 2px solid #ffffff;
    color: #ffffff;
    font-size: 8px;
}
.ex-avatar-caret i { line-height: 1; }
.ex-user-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 50;
    min-width: 160px;
    padding: 6px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, .15);
    border-radius: 6px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .12);
}
.ex-user-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    font-size: 15px;
    font-weight: 500;
    color: #dc3545;
    background: none;
    border: 0;
    border-radius: 4px;
    text-align: left;
    cursor: pointer;
}
.ex-user-menu-item:hover, .ex-user-menu-item:focus-visible { background: #fdecee; outline: none; }
.ex-info-text { min-width: 0; }
#exam-screen .ex-info-name {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    color: #212529;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ex-info-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; min-width: 0; }
.ex-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    padding: 1px 8px;
    font-size: 13px;
    line-height: 20px;
    color: #495057;
    background: #f1f3f5;
    border: 1px solid #e2e6ea;
    border-radius: 4px;
}
.ex-chip i { color: #1965a0; font-size: 12px; }
.ex-chip > span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-chip-exam { font-weight: 500; }
/* Tombol & status */
.ex-controls { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.ex-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 44px;
    padding: 0 14px;
    font-size: 15px;
    font-weight: 500;
    line-height: 1;
    border: 1px solid transparent;
    border-radius: 4px;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .15s, color .15s, filter .15s;
}
.ex-btn-primary {
    background: linear-gradient(#2081cc, #1965a0);
    border-color: #1965a0;
    color: #ffffff;
}
.ex-btn-primary:hover { filter: brightness(.93); }
#exam-screen .ex-status-no, #exam-screen .ex-status-time, #exam-screen .ex-status-time * {
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;
}
#exam-screen .ex-status-time i.bi::before { font-family: bootstrap-icons !important; }
.ex-status-no {
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(#2081cc, #1965a0);
    height: 38px;
    border: 1px solid #1965a0;
    border-radius: 4px;
    white-space: nowrap;
}
.ex-status-time {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 12px;
    font-size: 15px;
    font-weight: 700;
    color: #212529;
    background: #ffc759;
    border: 1px solid #e5b350;
    border-radius: 4px;
    white-space: nowrap;
}
.ex-question-card {
    margin: 16px 0;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, .125);
    border-radius: 4px;
}
#exam-screen #single-question-container { padding: 20px; }
#exam-screen .question-card { margin: 0; padding: 0; border-radius: 0; }
#exam-screen .q-header { display: none; }
#exam-screen .q-text {
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    margin: 0;
}
#exam-screen .q-text p { margin: 0 0 16px; }
#exam-screen .options-container { counter-reset: opt; margin-top: 40px; }
#exam-screen .option-label {
    counter-increment: opt;
    display: block;
    position: relative;
    min-height: 26px;
    margin: 20px 0;
    padding: 0 0 0 35px;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    cursor: pointer;
}
/* Layar sentuh: pilihan jawaban pendek (mis. "12") tetap setinggi minimal 44px (audit 004 no. 4). */
@media (pointer: coarse) { #exam-screen .option-label { min-height: 44px; } }
#exam-screen .option-label::before {
    content: counter(opt, upper-alpha);
    position: absolute;
    left: 0;
    top: -1px;
    width: 26px;
    height: 26px;
    box-sizing: border-box;
    border: 3px solid #bdbdbd;
    border-radius: 90px;
    color: #bdbdbd;
    font-size: 17px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
}
#exam-screen .complex-option-label::before { border-radius: 0; }
#exam-screen .option-label:has(> .option-input:checked)::before {
    background: #1965a0;
    border-color: #1965a0;
    color: #ffffff;
}
#exam-screen .option-label:has(> .option-input:focus-visible)::before {
    box-shadow: 0 0 0 3px rgba(25, 101, 160, .35);
}
#exam-screen .option-input {
    position: absolute;
    left: 0;
    top: -1px;
    width: 26px;
    height: 26px;
    margin: 0;
    opacity: 0;
}
#exam-screen .option-text,
#exam-screen .option-input:checked + .option-text {
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    max-width: 90%;
}
#exam-screen .option-text p { margin: 0 0 16px; }
#exam-screen .option-text p:last-child { margin-bottom: 0; }
#exam-screen .ex-nav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    position: sticky;
    bottom: 0;
    z-index: 20;
    width: auto; /* style.css memberi width:100%, yang membuat margin kanan negatif diabaikan dan latar bergeser ke kiri */
    margin: 8px -20px -20px;
    padding: 10px 20px;
    background: #ffffff;
    border: 0;
    border-top: 1px solid #e9ecef;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, .06);
}
#exam-screen .btn-nav,
#exam-screen .btn-nav-refresh {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px; /* target sentuh, audit 004 no. 4 */
    padding: 6px 12px;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
    border: 1px solid transparent;
    border-radius: 4px;
    box-shadow: none;
    transform: none;
    transition: filter .15s ease-in-out;
}
#exam-screen .btn-nav i, #exam-screen .btn-nav-refresh i { font-size: 16px; line-height: 24px; }
#exam-screen .nav-text, #exam-screen .refresh-text, #exam-screen .finish-text {
    font-weight: 700;
}
#exam-screen #btn-prev, #exam-screen #btn-next,
#exam-screen #btn-prev:hover:not(:disabled), #exam-screen #btn-next:hover:not(:disabled) {
    background: linear-gradient(#2081cc, #1965a0);
    border-color: #1965a0;
    color: #ffffff;
}
#exam-screen .btn-nav-refresh, #exam-screen .btn-nav-refresh:hover {
    background: #ffc759;
    border-color: #e5b350;
    color: #212529;
}
#exam-screen .btn-nav-finish, #exam-screen .btn-nav-finish:hover:not(:disabled) {
    background: linear-gradient(#3391d5, #2476b1) !important;
    border-color: #2476b1;
    color: #ffffff;
    box-shadow: none !important;
}
#exam-screen .btn-nav:hover:not(:disabled),
#exam-screen .btn-nav-refresh:hover {
    filter: brightness(.94);
    transform: none;
    box-shadow: none;
}
#exam-screen .btn-nav:disabled {
    background: #6c757d !important;
    border-color: #6c757d;
    color: #ffffff !important;
    opacity: .65;
}
.ex-credit { margin: 12px 0 0; text-align: center; font-size: 12.8px; color: #6c757d; }
.ex-credit-brand { font-weight: 600; color: #155f86; }
/* Modal Daftar Soal */
#exam-screen #question-map-modal { align-items: flex-start; padding: 28px 8px; overflow-y: auto; }
#exam-screen .map-overlay { background: rgba(0, 0, 0, .5); backdrop-filter: none; }
#exam-screen .map-content {
    width: 100%;
    max-width: 500px;
    max-height: none;
    padding: 0;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, .2);
    border-radius: 4.8px;
    box-shadow: none;
}
#exam-screen .map-content h3 {
    margin: 0;
    padding: 16px;
    border-bottom: 1px solid #dee2e6;
    font-size: 20px;
    font-weight: 500;
    line-height: 1.5;
    color: #212529;
}
#exam-screen .close-icon {
    top: 0;
    right: 0;
    padding: 16px;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.5;
    color: #000000;
    opacity: .5;
}
#exam-screen .close-icon:hover { color: #000000; opacity: .75; }
#exam-screen .map-grid { display: block; margin: 0; padding: 16px; text-align: center; }
#exam-screen .map-btn {
    display: inline-block;
    width: 45px;
    min-height: 44px;
    aspect-ratio: auto;
    margin: 4px;
    padding: 6px 0;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    background: transparent;
    border: 1px solid #6c757d;
    border-radius: 4px;
    box-shadow: none;
}
#exam-screen .map-btn.answered {
    background: linear-gradient(#2081cc, #1965a0);
    border-color: #1965a0;
    color: #ffffff;
}
/* Soal yang sedang dibuka ditandai cincin tebal, bukan warna lain, supaya "dijawab/belum" tetap terbaca (audit 004 no. 11). */
#exam-screen .map-btn.active {
    outline: 3px solid #0f2a44;
    outline-offset: 2px;
    font-weight: 700;
    box-shadow: none;
}
#exam-screen .map-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; margin: 0; padding: 0 16px 16px; list-style: none; font-size: 14px; color: #3d5470; }
#exam-screen .map-legend li { display: inline-flex; align-items: center; gap: 8px; }
#exam-screen .map-swatch { width: 20px; height: 20px; border: 1px solid #6c757d; border-radius: 4px; background: #ffffff; }
#exam-screen .map-swatch-answered { background: #1965a0; border-color: #1965a0; }
#exam-screen .map-swatch-active { outline: 3px solid #0f2a44; outline-offset: 1px; }
@media (max-width: 991.98px) {
    #exam-screen .nav-text, #exam-screen .refresh-text, #exam-screen .finish-text { display: none !important; }
}
@media (max-width: 767.98px) {
    .ex-header-inner { justify-content: center; }
}
@media (max-width: 575.98px) {
    .ex-header { min-height: 0; }
    .ex-brand { align-items: center; gap: 12px; }
    .ex-body { margin-top: 24px; }
    .ex-info { flex-basis: 100%; }
    #exam-screen .ex-info-name, .ex-chip > span { white-space: normal; }
    .ex-card-body { padding: 14px 12px; }
    .ex-toolbar { gap: 10px; padding-bottom: 12px; }
    .ex-info-avatar { width: 44px; height: 44px; font-size: 20px; }
    .ex-controls { width: 100%; gap: 6px; }
    .ex-btn { height: 44px; padding: 0 12px; font-size: 13px; gap: 5px; }
    .ex-status-no, .ex-status-time { height: 34px; }
    /* Daftar Soal tepat di tengah: NO. kiri, waktu kanan */
    .ex-controls {
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        align-items: center;
    }
    .ex-status-no { justify-self: start; }
    .ex-btn-map { justify-self: center; }
    .ex-status-time { justify-self: end; }
    .ex-status-no, .ex-status-time { padding: 0 8px; font-size: 13px; }
    .ex-status-time i { display: none; }
    .ex-question-card { margin: 12px 0; }
    #exam-screen #single-question-container { padding: 14px; }
    /* Header menempel tetap di atas layar */
    .ex-header {
        position: sticky;
        top: 0;
        z-index: 40;
        padding: 12px 15px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
    }
    .ex-body { margin-top: 16px; }
    /* Navigasi & footer menempel tetap di bawah layar */
    .ex-body { padding-bottom: 96px; }
    #exam-screen .ex-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: calc(26px + env(safe-area-inset-bottom));
        gap: 8px;
        margin: 0;
        padding: 8px 12px;
        border-radius: 0;
        z-index: 40;
    }
    .ex-credit {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 40;
        margin: 0;
        padding: 4px 0 calc(4px + env(safe-area-inset-bottom));
        line-height: 18px;
        background: #ffffff;
    }
    #exam-screen .btn-nav, #exam-screen .btn-nav-refresh { padding: 5px 8px; }
}
@media (max-width: 575.98px) {
    .lg-logo { height: 60px; }
    .lg-logo-icon { font-size: 52px; line-height: 60px; }
    .lg-title { font-size: 22px; }
    .lg-subtitle { font-size: 14px; margin-bottom: 0; }
}

/* Tabel Benar/Salah: lebar kolom lewat kelas (dulu inline 85px) agar di HP 390px tabel tidak melewati tepi kartu. */
#exam-screen .tf-col-no { width: 45px; }
#exam-screen .tf-col-pilih { width: 85px; }
#exam-screen .tf-statement-table th { text-transform: none; letter-spacing: 0; }
@media (max-width: 575.98px) {
    #exam-screen .tf-statement-table { display: table; table-layout: fixed; }
    #exam-screen .tf-col-no { width: 36px; }
    #exam-screen .tf-col-pilih { width: 58px; }
    #exam-screen .tf-statement-table th, #exam-screen .tf-statement-table td { padding: 10px 6px; }
}
