#mtp-exam-app {
    font-family: Arial, Helvetica, sans-serif;
    max-width: 1100px;
    margin: 0 auto;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}

.mtp-exam-loading, .mtp-exam-error {
    padding: 40px;
    text-align: center;
    font-size: 16px;
}

/* Header */
.mtp-exam-header {
    background: #1e3a5f;
    color: #fff;
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.mtp-exam-title {
    font-size: 17px;
    font-weight: 700;
}

.mtp-exam-candidate {
    font-size: 13px;
    opacity: 0.85;
}

.mtp-exam-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mtp-lang-toggle button {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.4);
    padding: 5px 10px;
    cursor: pointer;
    font-size: 12px;
    border-radius: 4px;
    margin-left: 4px;
}

.mtp-lang-toggle button.mtp-lang-active {
    background: #fff;
    color: #1e3a5f;
    font-weight: 700;
}

.mtp-timer {
    background: #0f2440;
    padding: 6px 14px;
    border-radius: 6px;
    text-align: center;
}

.mtp-timer-label {
    display: block;
    font-size: 10px;
    opacity: 0.8;
    text-transform: uppercase;
}

.mtp-timer-value {
    font-size: 20px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.mtp-timer-value.mtp-timer-warning {
    color: #ff6b6b;
    animation: mtp-blink 1s infinite;
}

@keyframes mtp-blink {
    50% { opacity: 0.3; }
}

/* Body layout */
.mtp-exam-body {
    display: flex;
    flex-wrap: wrap;
}

.mtp-exam-main {
    flex: 1 1 640px;
    padding: 20px;
    border-right: 1px solid #e5e5e5;
}

.mtp-exam-sidebar {
    flex: 0 0 260px;
    padding: 16px;
    background: #fafafa;
}

/* Question box */
.mtp-q-number {
    font-weight: 700;
    color: #1e3a5f;
    margin-bottom: 10px;
    font-size: 14px;
}

.mtp-q-text {
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 16px;
}

.mtp-q-option {
    display: block;
    padding: 10px 12px;
    margin-bottom: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}

.mtp-q-option:hover {
    background: #f5f8fc;
}

.mtp-q-option input {
    margin-right: 8px;
}

.mtp-q-option-letter {
    font-weight: 700;
}

/* Action buttons */
.mtp-exam-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
    border-top: 1px solid #eee;
    padding-top: 16px;
}

.mtp-exam-btn {
    padding: 9px 16px;
    border: none;
    border-radius: 5px;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
}

.mtp-exam-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.mtp-btn-mark { background: #a855f7; color: #fff; }
.mtp-btn-clear { background: #f1f3f5; color: #333; }
.mtp-btn-prev { background: #e5e7eb; color: #333; }
.mtp-btn-save { background: #16a34a; color: #fff; }
.mtp-btn-submit { background: #dc2626; color: #fff; margin-left: auto; }

/* Palette */
.mtp-palette-legend {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
    font-size: 12px;
}

.mtp-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mtp-legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    display: inline-block;
}

.mtp-palette-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.mtp-palette-cell {
    width: 100%;
    aspect-ratio: 1 / 1;
    border: none;
    border-radius: 5px;
    font-weight: 700;
    cursor: pointer;
    color: #fff;
    font-size: 13px;
}

.mtp-palette-cell.mtp-palette-current {
    outline: 3px solid #1e3a5f;
    outline-offset: 1px;
}

/* Status colors (shared by legend dots + palette cells) */
.mtp-status-not_visited { background: #9ca3af; }
.mtp-status-not_answered { background: #ef4444; }
.mtp-status-answered { background: #16a34a; }
.mtp-status-marked { background: #a855f7; }
.mtp-status-answered_marked { background: #7c3aed; }

/* Result screen */
.mtp-result-wrap {
    padding: 20px;
}

.mtp-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.mtp-result-header .mtp-lang-toggle button {
    background: #f1f3f5;
    color: #333;
    border: 1px solid #ddd;
}

.mtp-result-header .mtp-lang-toggle button.mtp-lang-active {
    background: #1e3a5f;
    color: #fff;
}

.mtp-result-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 24px;
}

.mtp-result-stat {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px 18px;
    min-width: 110px;
    text-align: center;
}

.mtp-result-stat span {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    color: #666;
    margin-bottom: 4px;
}

.mtp-result-stat strong {
    font-size: 20px;
}

.mtp-result-score strong {
    color: #1e3a5f;
}

.mtp-stat-correct { color: #16a34a; }
.mtp-stat-wrong { color: #dc2626; }

.mtp-review-item {
    border: 1px solid #e5e7eb;
    border-left: 5px solid #9ca3af;
    border-radius: 6px;
    padding: 14px 16px;
    margin-bottom: 12px;
}

.mtp-review-correct { border-left-color: #16a34a; }
.mtp-review-wrong { border-left-color: #dc2626; }
.mtp-review-skipped { border-left-color: #9ca3af; }

.mtp-review-q {
    margin-bottom: 8px;
}

.mtp-opt-correct {
    color: #16a34a;
    font-weight: 700;
}

.mtp-opt-wrong {
    color: #dc2626;
    font-weight: 700;
    text-decoration: line-through;
}

.mtp-review-meta {
    margin-top: 8px;
    font-size: 13px;
    color: #444;
}

.mtp-review-explanation {
    margin-top: 8px;
    padding: 8px 10px;
    background: #fffbeb;
    border-radius: 5px;
    font-size: 13px;
}

@media (max-width: 780px) {
    .mtp-exam-body {
        flex-direction: column;
    }
    .mtp-exam-main {
        border-right: none;
        border-bottom: 1px solid #e5e5e5;
    }
    .mtp-palette-grid {
        grid-template-columns: repeat(8, 1fr);
    }
    .mtp-btn-submit {
        margin-left: 0;
    }
}
