body.exam-toan-room {
    margin: 0;
    min-height: 100vh;
    height: 100vh;
    overflow: hidden;
    background: #ffffff;
    color: #1f2937;
    font-family: "Segoe UI", Arial, sans-serif;
}

body.exam-toan-room .tsa-header {
    display: flex;
    align-items: center;
    gap: 16px;
    height: 88px;
    padding: 0 24px;
    background: #ffffff;
    border-bottom: 1px solid #eef2f5;
}

body.exam-toan-room .logo-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    line-height: 1;
}

body.exam-toan-room .logo-area img {
    display: block;
    height: 48px;
    width: auto;
}

body.exam-toan-room .title-area {
    min-width: 0;
}

body.exam-toan-room .subject-name {
    display: block;
    color: #111827;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.25;
}

body.exam-toan-room .tsa-main-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(544px, 26.4vw, 620px);
    gap: 0;
    height: calc(100vh - 88px);
    min-height: 0;
}

body.exam-toan-room .tsa-left-wrapper {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 6px 10px 4px 16px;
}

body.exam-toan-room .tsa-left-pane {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-right: 6px;
}

body.exam-toan-room .tsa-left-pane::-webkit-scrollbar,
body.exam-toan-room .tsa-right-pane::-webkit-scrollbar {
    width: 6px;
}

body.exam-toan-room .tsa-left-pane::-webkit-scrollbar-thumb,
body.exam-toan-room .tsa-right-pane::-webkit-scrollbar-thumb {
    background: #d3dbe7;
    border-radius: 999px;
}

body.exam-toan-room .tsa-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 68px;
    padding: 0 8px 2px 0;
    flex-shrink: 0;
}

body.exam-toan-room .nav-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

body.exam-toan-room #giao-dien-thi .btn-nav {
    border: none;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
}

body.exam-toan-room #giao-dien-thi .btn-nav:hover:not(:disabled) {
    transform: translateY(-1px);
}

body.exam-toan-room #giao-dien-thi .btn-nav:disabled {
    opacity: 0.48;
    cursor: not-allowed;
    transform: none;
}

body.exam-toan-room #giao-dien-thi .btn-prev {
    width: 52px;
    min-width: 52px;
    height: 52px;
    background: #f3f4f6;
    color: #748093;
}

body.exam-toan-room #giao-dien-thi .btn-next {
    min-width: 126px;
    height: 52px;
    padding: 0 20px;
    background: #16386e;
    color: #ffffff;
}

body.exam-toan-room #giao-dien-thi .btn-next:hover:not(:disabled) {
    background: #102b55;
}

body.exam-toan-room .current-time {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    margin-left: auto;
    color: #6b7280;
    font-size: 15px;
    white-space: nowrap;
}

body.exam-toan-room .current-timer-text {
    color: #173c77;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.03em;
}

body.exam-toan-room .tsa-right-pane {
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 16px 10px 16px;
    background: #ffffff;
    border-left: 1px solid #eef2f5;
    display: flex;
    flex-direction: column;
}

body.exam-toan-room .info-box,
body.exam-toan-room .timer-box {
    margin-bottom: 16px;
}

body.exam-toan-room .info-heading {
    margin-bottom: 16px;
    color: #111827;
    font-size: 16px;
    font-weight: 700;
}

body.exam-toan-room .info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    color: #4b5563;
    font-size: 14px;
}

body.exam-toan-room .info-value {
    color: #111827;
    font-weight: 500;
    text-align: right;
}

body.exam-toan-room .timer-box {
    display: flex;
    align-items: stretch;
    gap: 10px;
}

body.exam-toan-room .timer-meta {
    flex: 1 1 auto;
    min-height: 54px;
    padding: 0 16px 0 18px;
    border: 1px solid #eceff3;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

body.exam-toan-room .timer-label {
    color: #445164;
    font-size: 14px;
}

body.exam-toan-room .timer-countdown {
    color: #173c77;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.03em;
}

body.exam-toan-room .btn-nop-bai {
    min-width: 94px;
    border: none;
    border-radius: 14px;
    background: #d51b29;
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.18s ease, transform 0.18s ease;
}

body.exam-toan-room .btn-nop-bai:hover {
    background: #b91621;
    transform: translateY(-1px);
}

body.exam-toan-room .legend-box {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    color: #465365;
    font-size: 14px;
}

body.exam-toan-room .legend-label {
    margin-right: 2px;
    font-weight: 600;
}

body.exam-toan-room .legend-item {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

body.exam-toan-room .dot-gray {
    background: #f1f3f6;
    color: #6e7a8c;
}

body.exam-toan-room .dot-blue {
    background: #2d8cff;
    color: #ffffff;
}

body.exam-toan-room .dot-orange {
    background: #ffffff;
    border: 2px solid #f39a18;
    color: #7b4a00;
}

body.exam-toan-room .grid-box {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

body.exam-toan-room .o-cau-hoi {
    width: 100%;
    aspect-ratio: 1 / 1;
    border: 1px solid transparent;
    border-radius: 999px;
    background: #f1f3f6;
    color: #7c8797;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.16s ease, background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

body.exam-toan-room .o-cau-hoi:hover {
    transform: translateY(-1px);
}

body.exam-toan-room .o-cau-hoi.da-lam {
    background: #2d8cff;
    color: #ffffff;
}

body.exam-toan-room .o-cau-hoi.danh-dau {
    border-color: #f39a18;
    border-width: 2px;
}

body.exam-toan-room .o-cau-hoi.hien-tai {
    background: #112d59;
    color: #ffffff;
    border: 2px solid #f39a18;
}

body.exam-toan-room .progress-box {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid #eef2f5;
}

body.exam-toan-room .progress-text {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    color: #374151;
    font-size: 15px;
}

body.exam-toan-room .progress-text strong {
    color: #17314f;
    font-size: 19px;
    font-weight: 600;
}

body.exam-toan-room .progress-unit {
    color: #4b5563;
    font-size: 15px;
}

body.exam-toan-room .progress-bar-bg {
    height: 7px;
    margin-bottom: 6px;
    background: #edf1f6;
    border-radius: 999px;
    overflow: hidden;
}

body.exam-toan-room .progress-bar-fill {
    height: 100%;
    background: #d71b2b;
    transition: width 0.24s ease;
}

body.exam-toan-room .progress-percent {
    margin-bottom: 12px;
    color: #667085;
    font-size: 14px;
    text-align: right;
}

body.exam-toan-room .connection-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #37a55e;
    font-size: 14px;
    font-weight: 600;
}

body.exam-toan-room .connection-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #43c46d;
    box-shadow: 0 0 0 4px rgba(67, 196, 109, 0.14);
}

body.exam-toan-room .question-container {
    position: relative;
    background: #ffffff;
    border: 1px solid #eef2f5;
    border-radius: 18px;
    padding: 14px 18px 18px;
    box-shadow: 0 5px 16px rgba(15, 23, 42, 0.03);
}

body.exam-toan-room .question-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 8px;
}

body.exam-toan-room .question-number {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 999px;
    background: #f1f3f6;
    color: #485566;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
}

body.exam-toan-room .question-text {
    flex: 1 1 auto;
    color: #212b38;
    font-size: 16px;
    line-height: 1.58;
    margin-top: 3px;
}

body.exam-toan-room .question-text img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
}

body.exam-toan-room .bookmark-btn {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #eef2f6;
    border-radius: 999px;
    background: #ffffff;
    color: #dde3eb;
    cursor: pointer;
    font-size: 18px;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

body.exam-toan-room .bookmark-btn:hover {
    border-color: #e5ebf2;
    background: #fbfcfe;
    color: #cfd7e2;
    transform: translateY(-1px);
}

body.exam-toan-room .bookmark-btn.active {
    border-color: #f7d59b;
    background: #fff6eb;
    color: #f39a18;
    box-shadow: 0 8px 18px rgba(243, 154, 24, 0.18);
}

body.exam-toan-room .bookmark-btn i {
    color: inherit;
}

body.exam-toan-room .answers-grid {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding-left: 56px;
    margin-top: 8px;
}

body.exam-toan-room .answer-option {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 0;
    border: none;
    background: transparent;
    color: #2b3341;
    font-size: 17px;
    line-height: 1.6;
    cursor: pointer;
}

body.exam-toan-room .answer-option input {
    display: none;
}

body.exam-toan-room .btn-gia {
    width: 38px;
    height: 38px;
    margin-top: 1px;
    flex-shrink: 0;
    border-radius: 999px;
    background: #eef1f5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

body.exam-toan-room .btn-vuong {
    border-radius: 12px;
}

body.exam-toan-room .answer-option input:checked + .btn-gia {
    background: #2d8cff;
    box-shadow: inset 0 0 0 8px #2d8cff, 0 0 0 6px rgba(45, 140, 255, 0.12);
}

body.exam-toan-room .answer-option:has(input:checked) {
    color: #18324f;
    font-weight: 600;
}

body.exam-toan-room .table-dung-sai {
    width: calc(100% - 56px);
    margin: 6px 0 0 56px;
    border-collapse: collapse;
    border: 1px solid #eef2f5;
    border-radius: 18px;
    overflow: hidden;
    background: #ffffff;
}

body.exam-toan-room .table-dung-sai th,
body.exam-toan-room .table-dung-sai td {
    border: 1px solid #eef2f5;
    padding: 12px 10px;
    text-align: center;
    font-size: 15px;
}

body.exam-toan-room .table-dung-sai th {
    background: #fbfcfe;
    color: #334155;
    font-weight: 600;
}

body.exam-toan-room .table-dung-sai td.text-left {
    color: #2b3341;
    text-align: left;
    font-size: 16px;
    line-height: 1.48;
}

body.exam-toan-room .table-dung-sai input {
    width: 20px;
    height: 20px;
    margin: 0 auto;
    display: inline-block !important;
    accent-color: #2d8cff;
    cursor: pointer;
}

body.exam-toan-room .table-dung-sai td:has(input:checked) {
    background: #eef6ff;
}

body.exam-toan-room .input-dien-khuyet {
    width: min(var(--blank-width, 120px), 100%);
    min-width: 96px;
    max-width: min(360px, 100%);
    padding: 4px 10px 5px;
    margin: 0 5px 3px;
    border: none;
    border-bottom: 2px solid #9fc8ff;
    outline: none;
    background: transparent;
    color: #163b74;
    font-size: 18px;
    font-weight: 600;
    font-family: inherit;
    text-align: center;
    vertical-align: baseline;
    transition: width 0.12s ease, border-color 0.2s ease, background-color 0.2s ease;
}

body.exam-toan-room .input-dien-khuyet:focus {
    border-bottom-color: #2d8cff;
}

body.exam-toan-room .input-dien-khuyet.input-dung {
    border: 1px solid #34a853 !important;
    border-bottom-width: 2px !important;
    border-radius: 8px;
    background: #e6f4ea !important;
}

body.exam-toan-room .input-dien-khuyet.input-sai {
    border: 1px solid #ea4335 !important;
    border-bottom-width: 2px !important;
    border-radius: 8px;
    background: #fce8e6 !important;
}

body.exam-toan-room .feedback-dien-khuyet {
    margin-top: 12px;
    padding-left: 56px;
    font-size: 14px;
    line-height: 1.6;
}

body.exam-toan-room .feedback-dien-khuyet .dung {
    color: #34a853;
    font-weight: 700;
}

body.exam-toan-room .feedback-dien-khuyet .sai {
    color: #ea4335;
    font-weight: 700;
}

body.exam-toan-room .drag-container {
    padding: 16px;
    border: 1px dashed #bfd4f4;
    border-radius: 18px;
    background: #f8fbff;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 66px;
}

body.exam-toan-room .drag-item {
    padding: 10px 16px;
    border: 1px solid #b4c9e6;
    border-radius: 12px;
    background: #ffffff;
    color: #183b74;
    font-size: 15px;
    font-weight: 600;
    user-select: none;
    cursor: grab;
}

body.exam-toan-room .drop-zone {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 88px;
    height: 42px;
    margin: 0 5px;
    padding: 0 10px;
    border: 2px dashed #b9d0ee;
    border-radius: 12px;
    background: #ffffff;
    color: #15397f;
    font-weight: 600;
    vertical-align: middle;
}

body.exam-toan-room .drop-zone.filled {
    border: 1px solid #15397f;
    border-style: solid;
    background: #eef4ff;
}

body.exam-toan-room .o-cau-hoi.cau-dung {
    background: #4caf50 !important;
    color: #ffffff !important;
    border: none !important;
}

body.exam-toan-room .o-cau-hoi.cau-sai {
    background: #f44336 !important;
    color: #ffffff !important;
    border: none !important;
}

@media (max-width: 1365px) {
    body.exam-toan-room .tsa-main-layout {
        grid-template-columns: minmax(0, 1fr) 500px;
    }

    body.exam-toan-room .grid-box {
        grid-template-columns: repeat(8, minmax(0, 1fr));
    }
}

@media (max-width: 1100px) {
    body.exam-toan-room {
        height: auto;
        overflow: auto;
    }

    body.exam-toan-room .tsa-header {
        min-height: 78px;
        padding: 14px 18px;
    }

    body.exam-toan-room .logo-area img {
        height: 48px;
    }

    body.exam-toan-room .subject-name {
        font-size: 16px;
    }

    body.exam-toan-room .tsa-main-layout {
        grid-template-columns: 1fr;
        height: auto;
        padding: 18px;
    }

    body.exam-toan-room .tsa-left-wrapper {
        order: 2;
        padding: 0;
    }

    body.exam-toan-room .tsa-right-pane {
        order: 1;
        border-left: none;
        border-bottom: 1px solid #edf1f6;
        padding: 0 0 18px;
        margin-bottom: 18px;
    }

    body.exam-toan-room .tsa-footer {
        flex-direction: column;
        align-items: flex-start;
        padding-right: 0;
    }

    body.exam-toan-room .current-time {
        margin-left: 0;
    }

    body.exam-toan-room .grid-box {
        grid-template-columns: repeat(10, minmax(0, 1fr));
    }

    body.exam-toan-room .table-dung-sai,
    body.exam-toan-room .answers-grid,
    body.exam-toan-room .feedback-dien-khuyet {
        width: 100%;
        padding-left: 0;
        margin-left: 0;
    }
}

@media (max-width: 640px) {
    body.exam-toan-room .grid-box {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    body.exam-toan-room .question-container {
        padding: 18px 16px 22px;
    }

    body.exam-toan-room .question-header {
        flex-wrap: wrap;
    }

    body.exam-toan-room .timer-box {
        flex-direction: column;
    }

    body.exam-toan-room .btn-nop-bai {
        min-height: 48px;
    }
}
