/* ==========================================================================
   testmode.css — Test Mode styling
   Uses existing CSS custom properties from style.css.
   ========================================================================== */

/* ===== Mode toggle: show/hide practice vs test UI ===== */

/* Default body is mode-practice (set by JS). */
.mode-test .practice-ui,
.mode-test #control-panel,
.mode-test #post-actions,
.mode-test .fab,
.mode-test #panel-backdrop {
    display: none !important;
}

.mode-practice #test-mode-container {
    display: none !important;
}

.mode-test #test-mode-container {
    display: block;
}

/* Hide the existing content-area in test mode */
.mode-test .content-area {
    display: none !important;
}

/* ===== Mode switcher tabs in header ===== */

.mode-switcher {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 0.75rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 99px;
    padding: 0.25rem;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.mode-tab {
    padding: 0.45rem 1.4rem;
    border: none;
    background: transparent;
    color: #94A3B8;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 99px;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.mode-tab:hover {
    color: #CBD5E1;
}

.mode-tab.active {
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

/* ===== Test Mode container layout ===== */

#test-mode-container {
    max-width: 860px;
    margin: 0 auto;
}

/* ===== SECTION_SELECT ===== */

.tm-section-select {
    animation: tmFadeIn 0.35s ease;
}

.tm-exam-tabs {
    display: flex;
    gap: 0.25rem;
    background: var(--surface-color);
    border-radius: 99px;
    padding: 0.25rem;
    border: 1px solid var(--border-color);
    width: fit-content;
    margin: 0 auto 1.75rem;
}

.tm-exam-tab {
    padding: 0.5rem 2rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 99px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tm-exam-tab:hover {
    color: var(--text-dark);
}

.tm-exam-tab.active {
    background: var(--text-dark);
    color: #fff;
}

.tm-language-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.75rem;
}

.tm-language-row label {
    margin-bottom: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.tm-language-row select {
    width: auto;
    min-width: 130px;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

.tm-sections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.tm-section-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.tm-section-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    opacity: 0;
    transition: opacity 0.25s ease;
}

.tm-section-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.1);
    transform: translateY(-2px);
}

.tm-section-card:hover::before {
    opacity: 1;
}

.tm-section-card h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.75rem;
}

.tm-section-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tm-meta-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 99px;
    padding: 0.25rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
}

.tm-meta-badge svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.tm-adaptive-tag {
    background: #EFF6FF;
    border-color: #BFDBFE;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.tm-section-card .tm-start-btn {
    width: 100%;
    padding: 0.6rem;
    border: none;
    border-radius: var(--radius);
    background: var(--primary-color);
    color: #fff;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.tm-section-card .tm-start-btn:hover {
    background: var(--primary-hover);
}

/* ===== Resume banner ===== */

.tm-resume-banner {
    background: #FFFBEB;
    border: 1px solid #FDE68A;
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    animation: tmFadeIn 0.3s ease;
}

.tm-resume-banner p {
    font-size: 0.9rem;
    color: #92400E;
    font-weight: 500;
    margin: 0;
}

.tm-resume-banner .tm-resume-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.tm-resume-btn {
    padding: 0.45rem 1rem;
    border-radius: var(--radius);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.tm-resume-btn.primary {
    background: #D97706;
    color: #fff;
}

.tm-resume-btn.primary:hover {
    background: #B45309;
}

.tm-resume-btn.secondary {
    background: transparent;
    color: #92400E;
    border: 1px solid #FDE68A;
}

.tm-resume-btn.secondary:hover {
    background: #FEF3C7;
}

/* ===== PREGENERATING ===== */

.tm-pregenerating {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--surface-color);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    animation: tmFadeIn 0.35s ease;
}

.tm-pregen-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    animation: spin 1s linear infinite;
}

.tm-pregenerating h3 {
    font-size: 1.1rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.tm-pregenerating p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

/* Rotating fun facts / study tips during pre-generation */
.tm-pregen-tip {
    max-width: 460px;
    margin: 1.25rem auto 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.tm-pregen-tip.visible {
    opacity: 1;
}

.tm-progress-bar-track {
    width: 280px;
    height: 6px;
    background: var(--border-color);
    border-radius: 99px;
    margin: 0 auto;
    overflow: hidden;
}

.tm-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 99px;
    transition: width 0.4s ease;
    width: 0%;
}

.tm-pregen-retry-btn {
    margin-top: 1.5rem;
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    background: var(--primary-color);
    color: #fff;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.tm-pregen-retry-btn:hover {
    background: var(--primary-hover);
}

/* ===== IN_PROGRESS ===== */

.tm-in-progress {
    animation: tmFadeIn 0.3s ease;
}

/* Timer bar */
.tm-timer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0.5rem;
    z-index: 100;
}

.tm-timer-section-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dark);
}

.tm-timer-module-tag {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--primary-color);
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    border-radius: 99px;
    padding: 0.15rem 0.6rem;
    margin-left: 0.5rem;
}

.tm-timer-clock {
    font-size: 1.2rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-dark);
    transition: color 0.3s ease;
}

.tm-timer-clock.warning {
    color: #DC2626;
    animation: tmTimerPulse 1.5s ease-in-out infinite;
}

@keyframes tmTimerPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Question number strip */
.tm-question-strip {
    display: flex;
    gap: 0.35rem;
    padding: 0.75rem 0;
    margin-bottom: 1rem;
    overflow-x: auto;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.tm-question-strip::-webkit-scrollbar {
    height: 4px;
}

.tm-question-strip::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 99px;
}

.tm-qnum {
    min-width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    position: relative;
}

.tm-qnum:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.tm-qnum.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.tm-qnum.answered {
    background: #DBEAFE;
    border-color: #93C5FD;
    color: var(--primary-color);
}

.tm-qnum.answered.active {
    background: var(--primary-color);
    color: #fff;
}

.tm-qnum.flagged::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    background: #F59E0B;
    border-radius: 50%;
    border: 2px solid var(--surface-color);
}

/* Question display card */
.tm-question-display {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.75rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
    min-height: 200px;
}

.tm-question-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.tm-question-number {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.tm-flag-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 99px;
    background: var(--surface-color);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 500;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all 0.2s;
}

.tm-flag-btn:hover {
    border-color: #F59E0B;
    color: #D97706;
}

.tm-flag-btn.flagged {
    background: #FFFBEB;
    border-color: #F59E0B;
    color: #D97706;
}

.tm-flag-btn svg {
    width: 14px;
    height: 14px;
}

.tm-question-body {
    font-size: 1.02rem;
    line-height: 1.7;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
    overflow-wrap: break-word;
}

/* Options in test mode (no correct/incorrect feedback) */
.tm-options-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0;
    margin: 0;
}

.tm-option-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-color);
    transition: all 0.2s ease;
    overflow: hidden;
}

.tm-option-item:hover {
    background: #F1F5F9;
}

.tm-option-item.selected {
    background: #EFF6FF;
    border-color: var(--primary-color);
}

.tm-option-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    width: 100%;
}

.tm-option-label input[type="radio"] {
    width: 1.2rem;
    height: 1.2rem;
    margin: 0;
    flex-shrink: 0;
    cursor: pointer;
}

.tm-option-text {
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Navigation */
.tm-nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.tm-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--surface-color);
    color: var(--text-dark);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.tm-nav-btn:hover {
    background: var(--bg-color);
    border-color: #CBD5E1;
}

.tm-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.tm-nav-btn svg {
    width: 16px;
    height: 16px;
}

.tm-nav-center {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.tm-submit-test-btn {
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    background: var(--accent-color);
    color: #fff;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.tm-submit-test-btn:hover {
    background: var(--accent-hover);
}

.tm-answered-count {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===== RESULTS ===== */

.tm-results {
    animation: tmFadeIn 0.35s ease;
}

.tm-results-header {
    text-align: center;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.tm-results-header h2 {
    font-size: 1.3rem;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.tm-results-header .tm-section-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.tm-score-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.tm-score-box {
    text-align: center;
}

.tm-score-box .tm-score-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.tm-score-box .tm-score-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    font-weight: 500;
}

.tm-score-box .tm-score-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.tm-results-disclaimer {
    display: inline-block;
    background: #FFFBEB;
    border: 1px solid #FDE68A;
    border-radius: var(--radius);
    padding: 0.6rem 1rem;
    font-size: 0.78rem;
    color: #92400E;
    max-width: 500px;
    line-height: 1.5;
}

/* Results stats row */
.tm-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.tm-stat-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
}

.tm-stat-card .tm-stat-num {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
}

.tm-stat-card .tm-stat-num.correct { color: #16A34A; }
.tm-stat-card .tm-stat-num.incorrect { color: #DC2626; }
.tm-stat-card .tm-stat-num.unanswered { color: #D97706; }

.tm-stat-card .tm-stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    font-weight: 500;
}

/* Review questions */
.tm-review-section {
    margin-top: 0.5rem;
}

.tm-review-section h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.tm-review-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.tm-review-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: background 0.15s;
    gap: 0.75rem;
}

.tm-review-card-header:hover {
    background: var(--bg-color);
}

.tm-review-q-num {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dark);
    white-space: nowrap;
}

.tm-review-status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 99px;
    white-space: nowrap;
}

.tm-review-status.correct {
    background: #F0FDF4;
    color: #16A34A;
    border: 1px solid #BBF7D0;
}

.tm-review-status.incorrect {
    background: #FEF2F2;
    color: #DC2626;
    border: 1px solid #FECACA;
}

.tm-review-status.unanswered {
    background: #FFFBEB;
    color: #D97706;
    border: 1px solid #FDE68A;
}

.tm-review-expand-icon {
    color: var(--text-muted);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.tm-review-card.expanded .tm-review-expand-icon {
    transform: rotate(180deg);
}

.tm-review-card-body {
    display: none;
    padding: 0 1.25rem 1.25rem;
    border-top: 1px solid var(--border-color);
}

.tm-review-card.expanded .tm-review-card-body {
    display: block;
    animation: tmSlideDown 0.25s ease;
}

.tm-review-question-text {
    font-size: 0.95rem;
    margin: 1rem 0;
    line-height: 1.6;
    overflow-wrap: break-word;
}

.tm-review-option {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.88rem;
    margin-bottom: 0.35rem;
    line-height: 1.5;
}

.tm-review-option .tm-ro-letter {
    font-weight: 600;
    flex-shrink: 0;
    min-width: 1.2rem;
}

.tm-review-option.is-correct {
    background: #F0FDF4;
    border: 1px solid #BBF7D0;
}

.tm-review-option.is-user-wrong {
    background: #FEF2F2;
    border: 1px solid #FECACA;
}

.tm-review-option.is-user-correct {
    background: #F0FDF4;
    border: 1px solid #BBF7D0;
}

.tm-review-solution {
    margin-top: 1rem;
    padding: 1rem;
    background: #F0FDFA;
    border: 1px solid #CCFBF1;
    border-radius: var(--radius);
    font-size: 0.9rem;
    line-height: 1.6;
}

.tm-review-solution h4 {
    font-size: 0.85rem;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

/* Distractor analysis in review (reuses existing da-* classes from style.css) */

/* Results action buttons */
.tm-results-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.tm-action-btn {
    padding: 0.65rem 1.4rem;
    border-radius: var(--radius);
    font-family: var(--font-sans);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.tm-action-btn.primary {
    background: var(--primary-color);
    color: #fff;
}

.tm-action-btn.primary:hover {
    background: var(--primary-hover);
}

.tm-action-btn.outline {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.tm-action-btn.outline:hover {
    background: rgba(37, 99, 235, 0.05);
}

.tm-action-btn.secondary {
    background: var(--bg-color);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}

.tm-action-btn.secondary:hover {
    background: var(--border-color);
}

/* ===== INTERMODULE ===== */
.tm-intermodule {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--surface-color);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    animation: tmFadeIn 0.35s ease;
}

.tm-intermodule h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.tm-intermodule p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

/* ===== Error state ===== */
.tm-error-msg {
    background: var(--error-bg);
    color: var(--error-text);
    border: 1px solid #FCA5A5;
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    animation: tmFadeIn 0.2s ease;
}

/* ===== Animations ===== */
@keyframes tmFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes tmSlideDown {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ===== Time-expired overlay ===== */
.tm-time-expired-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: tmFadeIn 0.3s ease;
}

.tm-time-expired-modal {
    background: var(--surface-color);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
}

.tm-time-expired-modal h3 {
    font-size: 1.15rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.tm-time-expired-modal p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.tm-time-expired-modal .tm-action-btn {
    min-width: 180px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    #test-mode-container {
        padding: 0 0.25rem;
    }

    .tm-sections-grid {
        grid-template-columns: 1fr;
    }

    .tm-score-display {
        gap: 1.5rem;
    }

    .tm-timer-bar {
        position: sticky;
        top: 0;
        border-radius: 0;
        margin-left: -0.25rem;
        margin-right: -0.25rem;
        padding: 0.6rem 1rem;
    }

    .tm-question-display {
        padding: 1.25rem;
    }

    .tm-results-header {
        padding: 2rem 1.25rem;
    }

    .tm-resume-banner {
        flex-direction: column;
        text-align: center;
    }

    .tm-nav-bar {
        flex-wrap: wrap;
    }

    .tm-nav-center {
        order: -1;
        width: 100%;
        justify-content: center;
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 480px) {
    .mode-switcher {
        margin-top: 0.5rem;
    }

    .tm-exam-tabs {
        width: 100%;
    }

    .tm-exam-tab {
        flex: 1;
        text-align: center;
        padding: 0.5rem 0.75rem;
    }

    .tm-qnum {
        min-width: 30px;
        height: 30px;
        font-size: 0.7rem;
    }

    .tm-score-box .tm-score-value {
        font-size: 2rem;
    }

    .tm-results-actions {
        flex-direction: column;
    }

    .tm-action-btn {
        width: 100%;
    }
}

/* Touch-friendly controls */
@media (pointer: coarse) {
    .tm-qnum {
        min-width: 38px;
        height: 38px;
    }

    .tm-nav-btn,
    .tm-submit-test-btn,
    .tm-action-btn {
        min-height: 48px;
        font-size: 0.9rem;
    }

    .tm-option-label {
        padding: 0.85rem 1rem;
    }

    .tm-option-label input[type="radio"] {
        width: 1.4rem;
        height: 1.4rem;
    }
}
