/* ============================================================
   HUITQUIZ – Trắc Nghiệm Online — Redesigned UI
   Inspired by tracnghiemhuit.onrender.com
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* === HIDE ALL SCROLLBARS GLOBALLY === */
html,
body,
*,
*::before,
*::after {
    -ms-overflow-style: none !important;
    scrollbar-width: none !important;
}

::-webkit-scrollbar,
*::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    background: transparent !important;
}

/* Ẩn navbar HUITQuiz và footer khi vào chế độ làm bài kiểm tra */
body.quiz-mode-active .navbar,
body.quiz-mode-active .footer,
body.quiz-mode-active footer,
body.quiz-body .navbar,
body.quiz-body .footer,
body.quiz-body footer {
    display: none !important;
}

/* ===================== CSS VARIABLES ===================== */
:root {
    --primary: #2563eb;
    --primary-light: #dbeafe;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --success-light: #dcfce7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --warning: #d97706;
    --warning-light: #fef3c7;

    --bg: #f1f5f9;
    --surface: #ffffff;
    --surface2: #f8fafc;
    --border: #e2e8f0;
    --border-light: #f1f5f9;

    --text: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    --radius-sm: 6px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04);
    --shadow: 0 4px 12px rgba(0, 0, 0, .06), 0 2px 4px rgba(0, 0, 0, .04);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, .08), 0 4px 8px rgba(0, 0, 0, .04);
    --shadow-lg: 0 20px 48px rgba(0, 0, 0, .12), 0 8px 16px rgba(0, 0, 0, .06);

    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition: 0.2s ease;
}

/* Dark Mode */
body.dark-mode {
    --bg: #0f172a;
    --surface: #1e293b;
    --surface2: #162032;
    --border: #334155;
    --border-light: #1e293b;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --text-light: #64748b;
    --primary-light: rgba(37, 99, 235, .15);
    --success-light: rgba(22, 163, 74, .15);
    --danger-light: rgba(220, 38, 38, .15);
    --warning-light: rgba(217, 119, 6, .15);
}

/* ===================== BASE RESET ===================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body.tn-body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
    transition: background var(--transition), color var(--transition);
}

/* ===================== APP CONTAINER ===================== */
.tn-app-container {
    max-width: 1380px;
    margin: 0 auto;
    padding: 0 20px 48px;
}

#tnViewHome .tn-main-content,
#tnViewHome .tn-hero {
    max-width: 1120px;
    margin-left: auto;
    margin-right: auto;
}

.tn-view {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===================== HERO SECTION ===================== */
.tn-hero {
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 50%, #3b82f6 100%);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    margin: 24px 0 28px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.tn-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 70% 50%, rgba(255, 255, 255, .1) 0%, transparent 60%);
}

.tn-hero h1 {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 10px;
    letter-spacing: -0.3px;
}

.tn-hero p {
    color: rgba(255, 255, 255, .85);
    font-size: 15px;
    max-width: 500px;
    margin: 0 auto 24px;
}

/* Search Box */
.tn-search-wrapper {
    max-width: 480px;
    margin: 0 auto;
    position: relative;
}

.tn-search-wrapper .search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: var(--text-muted);
}

.tn-search-wrapper input {
    width: 100%;
    padding: 13px 16px 13px 44px;
    border: none;
    border-radius: 50px;
    font-size: 14px;
    font-family: var(--font);
    background: #fff;
    color: var(--text);
    box-shadow: 0 4px 16px rgba(0, 0, 0, .15);
    outline: none;
    transition: box-shadow var(--transition);
}

.tn-search-wrapper input:focus {
    box-shadow: 0 4px 24px rgba(0, 0, 0, .2);
}

/* ===================== SECTION HEADER ===================== */
.tn-section {
    margin-bottom: 28px;
}

.tn-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.tn-section-header h2 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
}

.tn-subj-count {
    font-size: 13px;
    color: var(--text-muted);
    background: var(--border-light);
    padding: 4px 12px;
    border-radius: 50px;
    font-weight: 500;
}

/* ===================== SUBJECT CARDS GRID ===================== */
.tn-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}

.tn-subj-card {
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: var(--radius);
    padding: 18px 16px;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}

.tn-subj-card:hover {
    border-color: #2563eb;
    box-shadow: 0 8px 22px rgba(37, 99, 235, 0.12);
    transform: translateY(-4px);
}

.tn-card-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tn-card-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.tn-card-icon.triet {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

.tn-card-icon.ktct {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #c2410c;
}

.tn-card-icon.cnxh {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #be123c;
}

.tn-card-icon.tthcm {
    background: #fefce8;
    border: 1px solid #fef08a;
    color: #a16207;
}

.tn-card-icon.lsd {
    background: #faf5ff;
    border: 1px solid #e9d5ff;
    color: #7e22ce;
}

.tn-card-icon.qpan1 {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
}

.tn-card-icon.qpan2 {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #047857;
}

.tn-card-icon.kngt {
    background: #fdf4ff;
    border: 1px solid #f5d0fe;
    color: #a21caf;
}

.tn-card-icon.mkt {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #ea580c;
}

.tn-card-icon.qtcl {
    background: #fefce8;
    border: 1px solid #fef08a;
    color: #b45309;
}

.tn-card-icon.qtccu {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    color: #0369a1;
}

.tn-card-icon.qth {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    color: #334155;
}

.tn-card-icon.default {
    background: var(--primary-light);
}

.tn-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}

.tn-card-meta {
    font-size: 13px;
    color: var(--text-muted);
}

.tn-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tn-card-link {
    font-size: 13px;
    color: var(--primary);
    font-weight: 500;
}

/* Dark Mode Enhancements for Subject Cards in Trắc Nghiệm App */
body.dark-mode .tn-subj-card {
    background: linear-gradient(150deg, #24324d 0%, #1e2c48 100%);
    border: 2px solid #3b82f6;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

body.dark-mode .tn-subj-card:hover {
    background: linear-gradient(150deg, #283959 0%, #1d4ed8 100%);
    border-color: #60a5fa;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
    transform: translateY(-4px);
}

body.dark-mode .tn-card-title {
    color: #ffffff;
    font-weight: 700;
}

body.dark-mode .tn-card-meta {
    color: #cbd5e1;
}

body.dark-mode .tn-card-link {
    color: #38bdf8;
    font-weight: 700;
    font-size: 0.95rem;
}

body.dark-mode .tn-subj-card:hover .tn-card-link {
    color: #7dd3fc;
}

body.dark-mode .tn-card-icon.triet {
    background: rgba(37, 99, 235, 0.25) !important;
    border: 1px solid rgba(59, 130, 246, 0.4);
}

body.dark-mode .tn-card-icon.ktct {
    background: rgba(234, 88, 12, 0.25) !important;
    border: 1px solid rgba(249, 115, 22, 0.4);
}

body.dark-mode .tn-card-icon.cnxh {
    background: rgba(225, 29, 72, 0.25) !important;
    border: 1px solid rgba(244, 63, 94, 0.4);
}

body.dark-mode .tn-card-icon.tthcm {
    background: rgba(202, 138, 4, 0.25) !important;
    border: 1px solid rgba(234, 179, 8, 0.4);
}

body.dark-mode .tn-card-icon.lsd {
    background: rgba(147, 51, 234, 0.25) !important;
    border: 1px solid rgba(168, 85, 247, 0.4);
}

body.dark-mode .tn-card-icon.qpan1 {
    background: rgba(22, 163, 74, 0.25) !important;
    border: 1px solid rgba(34, 197, 94, 0.4);
}

body.dark-mode .tn-card-icon.qpan2 {
    background: rgba(16, 185, 129, 0.25) !important;
    border: 1px solid rgba(52, 211, 153, 0.4);
}

body.dark-mode .tn-card-icon.kngt {
    background: rgba(192, 38, 211, 0.25) !important;
    border: 1px solid rgba(217, 70, 239, 0.4);
}

body.dark-mode .tn-card-icon.mkt {
    background: rgba(234, 88, 12, 0.25) !important;
    border: 1px solid rgba(249, 115, 22, 0.4);
}

body.dark-mode .tn-card-icon.qtcl {
    background: rgba(217, 119, 6, 0.25) !important;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

body.dark-mode .tn-card-icon.qtccu {
    background: rgba(2, 132, 199, 0.25) !important;
    border: 1px solid rgba(56, 189, 248, 0.4);
}

body.dark-mode .tn-card-icon.qth {
    background: rgba(71, 85, 105, 0.25) !important;
    border: 1px solid rgba(148, 163, 184, 0.4);
}

.tn-pin-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1.5px solid var(--border, #cbd5e1);
    background: var(--surface, #ffffff);
    color: var(--primary, #2563eb);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
    line-height: 1;
}

.tn-pin-btn:hover {
    border-color: var(--primary, #2563eb);
    color: var(--primary, #2563eb);
    background: #eff6ff;
}

.tn-pin-btn.pinned {
    border: 1.5px solid #1d4ed8;
    background: var(--primary, #2563eb);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.tn-pin-btn.pinned:hover {
    background: #1d4ed8;
    border-color: #1e40af;
}

body.dark-mode .tn-pin-btn {
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
    color: #60a5fa;
}

body.dark-mode .tn-pin-btn:hover {
    border-color: #60a5fa;
    background: rgba(96, 165, 250, 0.2);
    color: #60a5fa;
}

body.dark-mode .tn-pin-btn.pinned {
    border-color: #60a5fa;
    background: #2563eb;
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(96, 165, 250, 0.4);
}

body.dark-mode .tn-pin-btn.pinned:hover {
    background: #1d4ed8;
}

.tn-pinned-tag {
    font-size: 11px;
    font-weight: 600;
    color: var(--primary, #2563eb);
    background: transparent;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

body.dark-mode .tn-pinned-tag {
    color: #60a5fa;
}

.tn-section-header h2 svg {
    color: var(--primary, #2563eb) !important;
}

body.dark-mode .tn-section-header h2 svg {
    color: #60a5fa !important;
}

.tn-subj-card.is-pinned-card {
    border-color: var(--border, #e2e8f0);
}

body.dark-mode .tn-subj-card.is-pinned-card {
    border-color: rgba(255, 255, 255, 0.15);
}

/* Modal overlay handled by style.css (.modal-overlay + .modal-overlay.active) */
/* Subject Modal Card */
.tn-subject-modal-card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    position: relative;
    padding: 28px 24px 24px;
}

.tn-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--border-light);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.tn-modal-close:hover {
    background: var(--border);
    color: var(--text);
}

.tn-modal-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.tn-modal-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius);
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
}

.tn-modal-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}

.tn-modal-header p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Mode Cards */
.tn-mode-choices {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tn-mode-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    background: var(--surface);
}

.tn-mode-card:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.mode-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--surface2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.mode-info h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.mode-info p {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    line-height: 1.4;
}

.mode-arrow {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 18px;
    flex-shrink: 0;
}

/* Chapter Select Box */
.tn-chapter-select-box {
    margin-top: 16px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.ch-select-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.ch-select-header h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.btn-back-modes {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: var(--primary);
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-family: var(--font);
    padding: 4px 8px;
    border-radius: 6px;
    transition: all var(--transition);
}

.btn-back-modes:hover {
    background: var(--primary-light);
    transform: translateX(-2px);
}

.ch-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 320px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    padding-right: 4px;
}

.ch-list::-webkit-scrollbar {
    width: 5px;
}

.ch-list::-webkit-scrollbar-track {
    background: transparent;
}

.ch-list::-webkit-scrollbar-thumb {
    background: var(--border, #cbd5e1);
    border-radius: 4px;
}

.ch-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted, #94a3b8);
}

.ch-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    background: var(--surface);
}

.ch-list-item:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

.ch-list-name {
    font-size: 13px;
    font-weight: 500;
    color: inherit;
    line-height: 1.3;
}

.ch-list-count {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    margin-left: 8px;
    flex-shrink: 0;
}

/* ===================== QUIZ PLAYER (ENLARGED COMFORTABLE UI) ===================== */

/* Quiz Header Bar */
.quiz-header-bar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    margin-bottom: 20px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg, 16px);
    box-shadow: var(--shadow-sm);
}

.quiz-header-left {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.tn-btn-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 38px;
    padding: 0 16px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    background: var(--surface2);
    color: var(--text);
    font-size: 13.5px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.tn-btn-back svg {
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.tn-btn-back:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.15);
}

.tn-btn-back:hover svg {
    transform: translateX(-2px);
}

.tn-btn-back:active {
    transform: translateY(0);
    box-shadow: none;
}

body.dark-mode .tn-btn-back {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border);
    color: #cbd5e1;
}

body.dark-mode .tn-btn-back:hover {
    background: rgba(37, 99, 235, 0.18);
    border-color: #3b82f6;
    color: #93c5fd;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
}

.quiz-header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.btn-submit-top {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 38px;
    padding: 0 18px;
    border: 1.5px solid #fecdd3;
    border-radius: 10px;
    background: #fff1f2;
    color: #e11d48;
    font-size: 13.5px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(225, 29, 72, 0.05);
}

.btn-submit-top svg {
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.btn-submit-top:hover {
    background: #e11d48;
    color: #ffffff;
    border-color: #e11d48;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(225, 29, 72, 0.28);
}

.btn-submit-top:hover svg {
    transform: scale(1.08);
}

.btn-submit-top:active {
    transform: translateY(0);
    box-shadow: none;
}

body.dark-mode .btn-submit-top {
    background: rgba(225, 29, 72, 0.12);
    border-color: rgba(225, 29, 72, 0.35);
    color: #fb7185;
}

body.dark-mode .btn-submit-top:hover {
    background: #e11d48;
    color: #ffffff;
    border-color: #e11d48;
    box-shadow: 0 4px 14px rgba(225, 29, 72, 0.38);
}

/* Keyboard Shortcuts Hint Bar */
.quiz-shortcuts-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    margin-bottom: 20px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius, 12px);
    box-shadow: var(--shadow-sm);
    position: relative;
}

.shortcuts-content {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.shortcuts-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    color: var(--text-muted);
}

.shortcut-item kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    padding: 0 7px;
    font-family: var(--font);
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    color: var(--text);
    background-color: var(--surface2);
    border: 1.5px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.sc-arr {
    color: var(--text-light);
    font-size: 12px;
}

.shortcuts-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 6px;
    background: #fee2e2;
    color: #dc2626;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
    margin-left: 12px;
}

.shortcuts-close-btn:hover {
    background: #fca5a5;
    color: #991b1b;
    transform: scale(1.08);
}

body.dark-mode .shortcuts-close-btn {
    background: rgba(220, 38, 38, 0.2);
    color: #fca5a5;
}

body.dark-mode .shortcuts-close-btn:hover {
    background: rgba(220, 38, 38, 0.35);
    color: #ffffff;
}

.quiz-info-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
}

.quiz-subj-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}

.quiz-mode-tag {
    font-size: 12.5px;
    background: var(--primary-light);
    color: var(--primary);
    padding: 3px 12px;
    border-radius: 50px;
    font-weight: 600;
    line-height: 1.4;
}

.quiz-timer-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 14px;
    background: var(--surface2);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

body.dark-mode .quiz-timer-pill {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border);
    color: #38bdf8;
}

.quiz-timer-pill.warning {
    border-color: var(--warning);
    color: var(--warning);
    background: var(--warning-light);
}

.quiz-timer-pill.danger {
    border-color: var(--danger);
    color: var(--danger);
    background: var(--danger-light);
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* Quiz 2-Column Layout */
.quiz-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 20px;
    align-items: start;
}

/* Quiz Card */
.quiz-card-wrapper {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.quiz-card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg, 16px);
    padding: 28px 34px;
    box-shadow: var(--shadow-sm);
}

.quiz-card-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.q-badge {
    background: var(--primary);
    color: #fff;
    font-size: 13.5px;
    font-weight: 700;
    padding: 6px 16px;
    border-radius: 50px;
}

.ch-badge-tag {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 13.5px;
    padding: 6px 14px;
    border-radius: 50px;
    font-weight: 500;
}

.flag-toggle-btn {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm, 8px);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--transition);
    outline: none;
}

.flag-toggle-btn:hover {
    border-color: var(--text-muted);
    color: var(--text);
    background: var(--surface2);
}

.flag-toggle-btn.flagged {
    border-color: var(--warning);
    color: var(--warning);
    background: var(--warning-light);
}

.flag-toggle-btn.flagged:hover {
    border-color: #b45309;
    color: #b45309;
    background: #fde68a;
}

body.dark-mode .flag-toggle-btn {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text-muted);
}

body.dark-mode .flag-toggle-btn:hover {
    background: var(--surface2);
    border-color: #475569;
    color: var(--text);
}

body.dark-mode .flag-toggle-btn.flagged {
    border-color: #f59e0b;
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.15);
}

body.dark-mode .flag-toggle-btn.flagged:hover {
    border-color: #fbbf24;
    color: #fde68a;
    background: rgba(245, 158, 11, 0.25);
}

/* Question Text */
.q-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.7;
    margin-bottom: 24px;
}

/* Options */
.q-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.q-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius, 12px);
    cursor: pointer;
    transition: all var(--transition);
    background: var(--surface);
    text-align: left;
    font-family: var(--font);
    font-size: 16px;
    color: var(--text);
    line-height: 1.55;
}

.q-option:hover:not(.disabled) {
    border-color: #93c5fd;
    background: #f0f7ff;
}

body.dark-mode .q-option:hover:not(.disabled) {
    border-color: rgba(59, 130, 246, 0.4);
    background: rgba(37, 99, 235, 0.08);
}

/* Radio circle */
.q-option-radio {
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.q-option.selected .q-option-radio {
    border-color: var(--primary);
    background: var(--primary);
}

.q-option.selected .q-option-radio::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
}

.q-option.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.q-option.selected:hover:not(.disabled) {
    border-color: #1d4ed8;
    background: #bfdbfe;
}

/* Correct / Wrong states (practice mode) */
.q-option.correct {
    border-color: var(--success);
    background: var(--success-light);
    color: var(--success);
    font-weight: 600;
}

.q-option.correct .q-option-radio {
    border-color: var(--success);
    background: var(--success);
}

.q-option.wrong {
    border-color: var(--danger);
    background: var(--danger-light);
    color: var(--danger);
}

.q-option.wrong .q-option-radio {
    border-color: var(--danger);
    background: var(--danger);
}

.q-option.disabled,
.q-option:disabled {
    cursor: default !important;
    pointer-events: none !important;
}

.q-option.disabled:hover,
.q-option:disabled:hover {
    transform: none !important;
}

/* Explanation Box */
.q-explanation-box {
    margin-top: 20px;
    padding: 18px 22px;
    background: #fffbeb;
    border: 1.5px solid #fde68a;
    border-radius: var(--radius-sm, 10px);
}

.exp-head {
    font-size: 15px;
    font-weight: 700;
    color: var(--warning);
    margin-bottom: 8px;
}

.exp-body {
    font-size: 15px;
    color: #78350f;
    line-height: 1.65;
}

/* Quiz Action Buttons */
.quiz-action-buttons {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 4px;
}

.quiz-btn {
    padding: 13px 26px;
    border-radius: var(--radius-sm, 8px);
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-secondary {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

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

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

.btn-danger {
    background: var(--danger);
    color: #fff;
    margin-left: auto;
}

.btn-danger:hover {
    background: #b91c1c;
}


/* Nut Kiem tra - Màu sắc dịu mắt, sang trọng */
.btn-check {
    padding: 13px 28px;
    border: 1.5px solid #bbf7d0;
    border-radius: var(--radius-sm, 8px);
    background: #f0fdf4;
    color: #16a34a;
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    animation: none !important;
    box-shadow: none !important;
}

.btn-check:hover {
    background: #16a34a;
    color: #ffffff;
    border-color: #16a34a;
    box-shadow: none !important;
}

body.dark-mode .btn-check {
    background: rgba(22, 163, 74, 0.15);
    border-color: rgba(22, 163, 74, 0.35);
    color: #86efac;
}

body.dark-mode .btn-check:hover {
    background: #16a34a;
    color: #ffffff;
    border-color: #16a34a;
}

/* ===================== SIDEBAR ===================== */
.quiz-sidebar {
    position: sticky;
    top: 80px;
}

.sidebar-card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg, 16px);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.sidebar-head h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.progress-lbl {
    font-size: 14px;
    color: var(--primary);
    font-weight: 700;
}

.sidebar-legend {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.sidebar-legend>div {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--text-muted);
}

.leg {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: 1.5px solid;
    display: inline-block;
}

.leg.un {
    border-color: var(--border);
    background: var(--surface);
}

.leg.done {
    border-color: var(--primary);
    background: var(--primary);
}

.leg.flg {
    border-color: var(--warning);
    background: var(--warning);
}

/* Question Grid */
.q-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    max-height: 360px;
    overflow-y: auto;
    background: var(--bg-alt, rgba(241, 245, 249, 0.6));
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 12px;
}

body.dark-mode .q-grid {
    background: rgba(15, 23, 42, 0.4);
    border-color: rgba(255, 255, 255, 0.1);
}

.q-grid::-webkit-scrollbar {
    width: 4px;
}

.q-grid::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.q-grid-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--surface);
    color: var(--text-muted);
}

.q-grid-cell:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.q-grid-cell.active {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.q-grid-cell.done {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

.q-grid-cell.flagged {
    border-color: var(--warning);
    background: var(--warning-light);
    color: var(--warning);
}

/* ===================== RESULT SCREEN ===================== */
.result-card {
    max-width: 580px;
    margin: 32px auto 24px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 36px 32px;
    box-shadow: var(--shadow);
    text-align: center;
}

.result-title h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.result-title p {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 28px;
}

.score-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

/* ── SVG Ring ── */
.score-ring-wrap {
    position: relative;
    width: 148px;
    height: 148px;
}

.score-svg {
    width: 148px;
    height: 148px;
    transform: rotate(-90deg);
}

.ring-track {
    fill: none;
    stroke: var(--border);
    stroke-width: 10;
}

.ring-fill {
    fill: none;
    stroke: var(--primary);
    stroke-width: 10;
    stroke-linecap: round;
    stroke-dasharray: 314.16;
    /* 2π × 50 */
    stroke-dashoffset: 314.16;
    /* starts empty */
    transition: stroke-dashoffset 0.9s cubic-bezier(.4, 0, .2, 1), stroke 0.4s ease;
}

.score-ring-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.big-score {
    font-size: 36px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    transition: color 0.4s ease;
}

.max-score {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Dark mode ring track */
body.dark-mode .ring-track {
    stroke: var(--border);
}

/* ── Stats Row ── */
.stats-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.st-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--surface2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    min-width: 78px;
    gap: 4px;
    transition: background var(--transition), border-color var(--transition);
}

.st-item strong {
    font-size: 24px;
    font-weight: 800;
    line-height: 1;
}

.st-item span {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.st-item.green {
    border-color: rgba(22, 163, 74, .3);
    background: var(--success-light);
}

.st-item.red {
    border-color: rgba(220, 38, 38, .3);
    background: var(--danger-light);
}

.st-item.orange {
    border-color: rgba(217, 119, 6, .3);
    background: var(--warning-light);
}

.st-item.blue {
    border-color: rgba(37, 99, 235, .3);
    background: var(--primary-light);
}

.st-item.green strong {
    color: var(--success);
}

.st-item.red strong {
    color: var(--danger);
}

.st-item.orange strong {
    color: var(--warning);
}

.st-item.blue strong {
    color: var(--primary);
}

.result-btn-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 24px;
    flex-wrap: wrap;
}

/* Nút Làm lại những câu sai */
.btn-retry-wrong {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 14px rgba(217, 119, 6, 0.35);
    font-weight: 700;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-retry-wrong:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
    box-shadow: 0 6px 20px rgba(217, 119, 6, 0.45);
    transform: translateY(-1px);
    color: #ffffff;
}

.btn-retry-wrong:active {
    transform: translateY(0);
}

.btn-retry-wrong svg {
    transition: transform 0.3s ease;
}

.btn-retry-wrong:hover svg {
    transform: rotate(-45deg);
}

body.dark-mode .btn-retry-wrong {
    background: linear-gradient(135deg, #d97706, #b45309);
    box-shadow: 0 4px 16px rgba(217, 119, 6, 0.4);
}

body.dark-mode .btn-retry-wrong:hover {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

/* Banner chúc mừng khi hoàn thành hết câu sai */
.res-completion-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    background: linear-gradient(135deg, rgba(22, 163, 74, 0.08), rgba(34, 197, 94, 0.14));
    border: 1.5px solid rgba(22, 163, 74, 0.3);
    border-radius: var(--radius-lg, 12px);
    padding: 14px 18px;
    margin: 20px auto 4px;
    max-width: 520px;
    text-align: left;
    animation: resBannerPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes resBannerPop {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.res-completion-banner .res-banner-icon {
    font-size: 32px;
    line-height: 1;
    flex-shrink: 0;
}

.res-completion-banner .res-banner-text h4 {
    font-size: 15px;
    font-weight: 700;
    color: #15803d;
    margin-bottom: 2px;
}

.res-completion-banner .res-banner-text p {
    font-size: 13px;
    color: var(--text-muted, #4b5563);
    margin: 0;
    line-height: 1.4;
}

body.dark-mode .res-completion-banner {
    background: linear-gradient(135deg, rgba(22, 163, 74, 0.16), rgba(34, 197, 94, 0.22));
    border-color: rgba(34, 197, 94, 0.4);
}

body.dark-mode .res-completion-banner .res-banner-text h4 {
    color: #86efac;
}

body.dark-mode .res-completion-banner .res-banner-text p {
    color: #cbd5e1;
}

/* Review Box */
.review-box {
    max-width: 760px;
    margin: 0 auto 40px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.review-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 12px;
}

.review-top-bar h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.review-filter-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 6px 14px;
    border: 1.5px solid var(--border);
    border-radius: 50px;
    background: var(--surface);
    font-size: 12px;
    font-weight: 500;
    font-family: var(--font);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}

.filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.review-items-container {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Review Item */
.review-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition);
}

.review-item:last-child {
    border-bottom: none;
}

.review-item.wrong-review {
    background: #fff8f8;
}

.review-item.wrong-review:hover {
    background: #fff1f1;
}

body.dark-mode .review-item.wrong-review {
    background: rgba(220, 38, 38, .07);
}

.review-q-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}

.review-q-num {
    background: var(--success);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 50px;
    flex-shrink: 0;
    margin-top: 2px;
}

.review-item.wrong-review .review-q-num {
    background: var(--danger);
}

.review-q-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.5;
}

.review-opts {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-left: 4px;
}

.review-opt {
    font-size: 13px;
    color: var(--text-muted);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.review-opt.correct-opt {
    background: var(--success-light);
    color: var(--success);
    font-weight: 600;
}

.review-opt.user-wrong {
    background: var(--danger-light);
    color: var(--danger);
    text-decoration: line-through;
}

/* ===================== OUTLINE VIEW ===================== */
.outline-top-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    margin-bottom: 20px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg, 16px);
    box-shadow: var(--shadow-sm);
}

.outline-top-header .tn-btn-back {
    justify-self: start;
}

.outline-title-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
}

.outline-title-meta h2 {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
    margin: 0;
}

.out-count-tag {
    font-size: 12.5px;
    color: var(--primary);
    background: var(--primary-light);
    padding: 3px 12px;
    border-radius: 50px;
    font-weight: 600;
    line-height: 1.4;
}

.toggle-ans-btn {
    justify-self: end;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 38px;
    padding: 0 16px;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    background: var(--surface2);
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.toggle-ans-btn svg {
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.toggle-ans-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.15);
}

.toggle-ans-btn.active {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #2563eb;
}

.toggle-ans-btn.active:hover {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.28);
}

.toggle-ans-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

body.dark-mode .outline-top-header {
    background: var(--surface);
    border-color: var(--border);
}

body.dark-mode .toggle-ans-btn {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border);
    color: #cbd5e1;
}

body.dark-mode .toggle-ans-btn:hover {
    background: rgba(37, 99, 235, 0.18);
    border-color: #3b82f6;
    color: #93c5fd;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
}

body.dark-mode .toggle-ans-btn.active {
    background: rgba(37, 99, 235, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
    color: #60a5fa;
}

body.dark-mode .toggle-ans-btn.active:hover {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

/* Outline Toolbar */
.outline-toolbar {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.outline-search-box {
    position: relative;
}

.outline-search-box .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 15px;
}

.outline-search-box input {
    width: 100%;
    padding: 11px 36px 11px 38px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 14px;
    font-family: var(--font);
    color: var(--text);
    outline: none;
    transition: border-color var(--transition);
}

.outline-search-box input:focus {
    border-color: var(--primary);
}

.search-clear-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(140, 150, 170, 0.2);
    color: var(--text-muted, #64748b);
    font-size: 11px;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
    z-index: 2;
}

.search-clear-btn:hover {
    background: #ef4444;
    color: #ffffff;
}

mark.search-highlight {
    background-color: rgba(254, 240, 138, 0.85);
    color: #0f172a;
    padding: 1px 3px;
    border-radius: 3px;
    font-weight: 600;
}

body.dark-mode mark.search-highlight,
.dark-mode mark.search-highlight {
    background-color: rgba(234, 179, 8, 0.4);
    color: #fef08a;
}

/* Chapter Filter Pills */
.outline-ch-filter {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ch-filter-btn {
    padding: 7px 14px;
    border: 1.5px solid var(--border);
    border-radius: 50px;
    background: var(--surface);
    font-size: 12px;
    font-weight: 500;
    font-family: var(--font);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}

.ch-filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.ch-filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* Outline Question List */
.outline-q-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 40px;
}

.outline-q-item,
.review-q-item {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition);
    content-visibility: auto;
    contain-intrinsic-size: 0 140px;
}

.outline-q-item:hover {
    border-color: var(--primary);
}

.outline-q-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 8px;
}

.out-ch-tag {
    font-size: 11px;
    background: var(--primary-light);
    color: var(--primary);
    padding: 3px 10px;
    border-radius: 50px;
    font-weight: 600;
}

.out-copy-btn {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--surface2);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font);
    transition: all var(--transition);
}

.out-copy-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.outline-q-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
    line-height: 1.6;
}

.outline-opts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.outline-opt {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: flex-start;
    gap: 6px;
    line-height: 1.4;
}

.outline-opt.correct-ans {
    border-color: var(--success);
    background: var(--success-light);
    color: var(--success);
    font-weight: 600;
}

.check-mark {
    flex-shrink: 0;
    font-size: 14px;
}

/* Hidden answers */
.outline-ans-hidden .outline-opt.correct-ans {
    border-color: var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-weight: 400;
}

.outline-ans-hidden .outline-opt.correct-ans .check-mark {
    display: none;
}

/* ===================== CONFIRM MODAL ===================== */
.modal-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.modal-header {
    padding: 18px 20px 0;
}

.modal-header h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
}

.modal-body {
    padding: 14px 20px;
}

.modal-body p {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
}

.unanswered-warning {
    margin-top: 10px;
    padding: 10px 14px;
    background: var(--warning-light);
    border: 1px solid #fde68a;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: #92400e;
}

.modal-footer {
    display: flex;
    gap: 10px;
    padding: 0 20px 20px;
    justify-content: flex-end;
}

/* ===================== TOAST NOTIFICATIONS ===================== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 12px 18px;
    background: var(--text);
    color: var(--surface);
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    animation: slideInRight 0.25s ease;
    pointer-events: auto;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===================== RESPONSIVE (MOBILE PHONE ORIGINAL SIZES) ===================== */
@media (max-width: 768px) {
    .tn-app-container {
        padding: 0 12px 36px;
    }

    .tn-hero {
        padding: 28px 18px;
    }

    .tn-hero h1 {
        font-size: 20px;
    }

    .tn-grid {
        grid-template-columns: 1fr;
    }

    /* Quiz Player on Mobile: Keep clean compact sizing */
    .quiz-header-bar {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px 14px;
        margin-bottom: 14px;
    }

    .quiz-info-center {
        flex: 1 0 100%;
        order: -1;
        text-align: center;
        gap: 2px;
    }

    .quiz-subj-name {
        font-size: 15px;
    }

    .quiz-mode-tag {
        font-size: 11.5px;
        padding: 3px 10px;
    }

    .quiz-header-left {
        flex: 1;
        justify-content: flex-start;
    }

    .quiz-header-right {
        flex: 1;
        justify-content: flex-end;
    }

    .tn-btn-back {
        height: 34px;
        padding: 0 12px;
        font-size: 12.5px;
        gap: 5px;
    }

    .btn-submit-top {
        height: 34px;
        padding: 0 14px;
        font-size: 12.5px;
        gap: 5px;
    }

    .quiz-timer-pill {
        height: 34px;
        padding: 0 10px;
        font-size: 13px;
        gap: 4px;
    }

    .quiz-shortcuts-bar {
        display: none !important; /* Touch screens don't use physical keys 1-4 */
    }

    .quiz-layout {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .quiz-sidebar {
        position: static;
        order: -1;
    }

    .sidebar-card {
        padding: 12px;
        border-radius: 12px;
    }

    .sidebar-head {
        margin-bottom: 8px;
    }

    .sidebar-head h3 {
        font-size: 13px;
    }

    .progress-lbl {
        font-size: 12px;
    }

    .sidebar-legend {
        gap: 8px;
        margin-bottom: 8px;
        padding-bottom: 8px;
        font-size: 11px;
    }

    .sidebar-legend > div {
        font-size: 11px;
        gap: 4px;
    }

    .leg {
        width: 10px;
        height: 10px;
    }

    .q-grid {
        grid-template-columns: repeat(8, 1fr);
        gap: 5px;
        max-height: 120px;
        padding: 8px;
        border-radius: 8px;
    }

    .q-grid-cell {
        min-height: 28px;
        font-size: 11px;
        border-radius: 5px;
    }

    .quiz-card {
        padding: 18px 16px;
        border-radius: 12px;
    }

    .quiz-card-top {
        gap: 8px;
        margin-bottom: 14px;
    }

    .q-badge {
        font-size: 12px;
        padding: 4px 10px;
    }

    .ch-badge-tag {
        font-size: 11.5px;
        padding: 4px 8px;
    }

    .flag-toggle-btn {
        font-size: 12px;
        padding: 5px 10px;
    }

    .q-text {
        font-size: 15px;
        font-weight: 600;
        line-height: 1.6;
        margin-bottom: 16px;
    }

    .q-options {
        gap: 8px;
    }

    .q-option {
        padding: 12px 14px;
        font-size: 14px;
        line-height: 1.5;
        gap: 10px;
        border-radius: 8px;
    }

    .q-option-radio {
        width: 18px;
        height: 18px;
    }

    .q-option.selected .q-option-radio::after {
        width: 6px;
        height: 6px;
    }

    .q-explanation-box {
        margin-top: 14px;
        padding: 12px 14px;
        border-radius: 8px;
    }

    .exp-head {
        font-size: 13px;
        margin-bottom: 4px;
    }

    .exp-body {
        font-size: 13px;
        line-height: 1.55;
    }

    .quiz-action-buttons {
        gap: 8px;
        flex-wrap: wrap;
    }

    .quiz-btn {
        padding: 10px 18px;
        font-size: 13px;
        border-radius: 6px;
        gap: 5px;
    }

    .btn-check {
        padding: 10px 18px;
        font-size: 13px;
        border-radius: 6px;
    }

    .btn-danger {
        margin-left: 0;
        flex: 1;
    }

    .result-btn-row {
        flex-direction: column;
    }

    .outline-opts {
        grid-template-columns: 1fr;
    }

    .stats-row {
        gap: 8px;
    }

    .st-item {
        padding: 10px 12px;
    }

    .review-top-bar {
        flex-direction: column;
        align-items: flex-start;
    }
}

.review-item:last-child {
    border-bottom: none;
}

.review-item.wrong-review {
    background: #fff8f8;
}

.review-item.wrong-review:hover {
    background: #fff1f1;
}

body.dark-mode .review-item.wrong-review {
    background: rgba(220, 38, 38, .07);
}

.review-q-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}

.review-q-num {
    background: var(--success);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 50px;
    flex-shrink: 0;
    margin-top: 2px;
}

.review-item.wrong-review .review-q-num {
    background: var(--danger);
}

.review-q-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.5;
}

.review-opts {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-left: 4px;
}

.review-opt {
    font-size: 13px;
    color: var(--text-muted);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.review-opt.correct-opt {
    background: var(--success-light);
    color: var(--success);
    font-weight: 600;
}

.review-opt.user-wrong {
    background: var(--danger-light);
    color: var(--danger);
    text-decoration: line-through;
}

/* Outline Toolbar */
.outline-toolbar {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.outline-search-box {
    position: relative;
}

.outline-search-box .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 15px;
}

.outline-search-box input {
    width: 100%;
    padding: 11px 14px 11px 38px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 14px;
    font-family: var(--font);
    color: var(--text);
    outline: none;
    transition: border-color var(--transition);
}

.outline-search-box input:focus {
    border-color: var(--primary);
}

/* Chapter Filter Pills */
.outline-ch-filter {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ch-filter-btn {
    padding: 7px 14px;
    border: 1.5px solid var(--border);
    border-radius: 50px;
    background: var(--surface);
    font-size: 12px;
    font-weight: 500;
    font-family: var(--font);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}

.ch-filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.ch-filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* Outline Question List */
.outline-q-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 40px;
}

.outline-q-item {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition);
}

.outline-q-item:hover {
    border-color: var(--primary);
}

.outline-q-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 8px;
}

.out-ch-tag {
    font-size: 11px;
    background: var(--primary-light);
    color: var(--primary);
    padding: 3px 10px;
    border-radius: 50px;
    font-weight: 600;
}

.out-copy-btn {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--surface2);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font);
    transition: all var(--transition);
}

.out-copy-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.outline-q-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
    line-height: 1.6;
}

.outline-opts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.outline-opt {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: flex-start;
    gap: 6px;
    line-height: 1.4;
}

.outline-opt.correct-ans {
    border-color: var(--success);
    background: var(--success-light);
    color: var(--success);
    font-weight: 600;
}

.check-mark {
    flex-shrink: 0;
    font-size: 14px;
}

/* Hidden answers */
.outline-ans-hidden .outline-opt.correct-ans {
    border-color: var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-weight: 400;
}

.outline-ans-hidden .outline-opt.correct-ans .check-mark {
    display: none;
}

/* ===================== CONFIRM MODAL ===================== */
.modal-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.modal-header {
    padding: 18px 20px 0;
}

.modal-header h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
}

.modal-body {
    padding: 14px 20px;
}

.modal-body p {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
}

.unanswered-warning {
    margin-top: 10px;
    padding: 10px 14px;
    background: var(--warning-light);
    border: 1px solid #fde68a;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: #92400e;
}

.modal-footer {
    display: flex;
    gap: 10px;
    padding: 0 20px 20px;
    justify-content: flex-end;
}

/* ===================== TOAST NOTIFICATIONS ===================== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 12px 18px;
    background: var(--text);
    color: var(--surface);
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    animation: slideInRight 0.25s ease;
    pointer-events: auto;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 720px) {
    .tn-hero {
        padding: 32px 20px;
    }

    .tn-hero h1 {
        font-size: 22px;
    }

    .tn-grid {
        grid-template-columns: 1fr;
    }

    .quiz-layout {
        grid-template-columns: 1fr;
    }

    .quiz-sidebar {
        position: static;
        order: -1;
    }

    .sidebar-card {
        padding: 12px;
    }

    .q-grid {
        grid-template-columns: repeat(8, 1fr);
        max-height: 120px;
    }

    .outline-opts {
        grid-template-columns: 1fr;
    }

    .stats-row {
        gap: 8px;
    }

    .st-item {
        padding: 10px 12px;
    }

    .quiz-header-bar {
        flex-wrap: wrap;
        gap: 8px;
    }

    .quiz-info-center {
        flex: 1 0 100%;
        order: -1;
        text-align: center;
    }

    .review-top-bar {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .quiz-action-buttons {
        flex-wrap: wrap;
    }

    .btn-danger {
        margin-left: 0;
        flex: 1;
    }

    .result-btn-row {
        flex-direction: column;
    }
}

/* ==========================================================================
   MOBILE-ONLY NAVIGATION & OPTIMIZED ERGONOMIC LAYOUT (screens <= 768px)
   (Desktop layout remains 100% UNCHANGED for screens > 768px)
   ========================================================================== */

/* Hide mobile bottom bar & mobile drawer on desktop */
.mobile-bottom-bar,
.mobile-drawer-overlay {
    display: none !important;
}

@media (max-width: 768px) {

    /* Hide top submit button on mobile screens */
    .btn-submit-top {
        display: none !important;
    }

    /* Show mobile bottom bar fixed at bottom */
    .mobile-bottom-bar {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 64px;
        background: var(--surface);
        border-top: 1px solid var(--border);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
        padding: 8px 12px;
        gap: 8px;
        z-index: 990;
        align-items: center;
        backdrop-filter: blur(10px);
    }

    /* Add bottom padding to quiz container on mobile so content isn't covered */
    .quiz-card-wrapper {
        padding-bottom: 76px !important;
    }

    .m-bar-btn {
        height: 48px;
        border-radius: 12px;
        font-family: var(--font);
        font-size: 14px;
        font-weight: 600;
        border: none;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.15s ease;
    }

    .m-btn-nav {
        width: 48px;
        flex-shrink: 0;
        background: var(--surface2);
        color: var(--text);
        border: 1px solid var(--border);
        font-size: 18px;
    }

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

    .m-btn-grid {
        flex: 1;
        background: var(--primary-light);
        color: var(--primary);
        border: 1px solid rgba(37, 99, 235, 0.2);
    }

    .m-btn-action {
        flex: 1.2;
        background: var(--primary);
        color: #ffffff;
        box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    }

    /* Mobile Drawer Overlay */
    .mobile-drawer-overlay {
        display: block !important;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
        z-index: 1000;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }

    .mobile-drawer-overlay.open {
        opacity: 1;
        pointer-events: auto;
    }

    .mobile-drawer-card {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--surface);
        border-radius: 24px 24px 0 0;
        padding: 20px;
        max-height: 80vh;
        overflow-y: auto;
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
    }

    .mobile-drawer-overlay.open .mobile-drawer-card {
        transform: translateY(0);
    }

    .mobile-drawer-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 14px;
        padding-bottom: 12px;
        border-bottom: 1px solid var(--border);
    }

    .drawer-title-group {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .drawer-title-group h3 {
        font-size: 16px;
        font-weight: 700;
        color: var(--text);
        margin: 0;
    }

    .drawer-progress-lbl {
        font-size: 12px;
        color: var(--primary);
        background: var(--primary-light);
        padding: 2px 8px;
        border-radius: 50px;
        font-weight: 600;
    }

    .mobile-drawer-close {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        border: 1px solid var(--border);
        background: var(--surface2);
        color: var(--text-muted);
        font-size: 16px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .m-q-grid {
        grid-template-columns: repeat(6, 1fr) !important;
        gap: 8px !important;
        max-height: none !important;
    }

    /* Hide desktop sidebar on mobile when drawer is active */
    .quiz-sidebar {
        display: none !important;
    }

    /* Hide desktop bottom buttons wrap on mobile */
    #quiz-action-buttons-wrap {
        display: none !important;
    }

    /* Touch-friendly option cards on mobile */
    .q-option {
        padding: 14px 16px;
        min-height: 52px;
        font-size: 15px;
    }

    /* Hide shortcuts bar on mobile */
    #quizShortcutsBar {
        display: none !important;
    }

    /* Clean header bar for mobile */
}

.hero-hist-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #ffffff;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: all 0.2s ease;
}

.hero-hist-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: translateY(-1px);
}

/* ─── HISTORY SECTION STYLES ─── */
.tn-history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    margin-top: 14px;
}

.tn-history-card {
    background: var(--surface, #ffffff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 14px;
    padding: 16px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.tn-history-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
    border-color: #cbd5e1;
}

.hist-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.hist-subj-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hist-subj-icon {
    font-size: 22px;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-body, #f8fafc);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.hist-subj-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text, #0f172a);
    margin: 0;
    line-height: 1.25;
}

.hist-mode-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    background: #e0f2fe;
    color: #0284c7;
    font-weight: 600;
    display: inline-block;
    margin-top: 3px;
}

.hist-score-tag {
    font-size: 15px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 10px;
    flex-shrink: 0;
}

.hist-score-tag.score-high {
    background: #dcfce7;
    color: #15803d;
}

.hist-score-tag.score-mid {
    background: #e0f2fe;
    color: #0369a1;
}

.hist-score-tag.score-low {
    background: #fee2e2;
    color: #b91c1c;
}

.hist-card-stats {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text-muted, #64748b);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--border, #e2e8f0);
    flex-wrap: wrap;
}

.hist-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hist-review-btn {
    flex: 1;
    padding: 8px 12px;
    border-radius: 8px;
    border: none;
    background: #2563eb;
    color: #ffffff;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.hist-review-btn:hover {
    background: #1d4ed8;
}

.hist-del-btn {
    padding: 8px 14px;
    border-radius: 8px;
    border: 1.5px solid #fecdd3;
    background: #fff1f2;
    color: #e11d48;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.hist-del-btn:hover {
    background: #dc2626;
    color: #ffffff;
    border-color: #dc2626;
}

.tn-clear-hist-btn {
    background: transparent;
    border: 1.5px solid var(--border, #cbd5e1);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted, #64748b);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tn-clear-hist-btn:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fca5a5;
}

body.dark-mode .tn-history-card {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .hist-subj-icon {
    background: #0f172a;
}

body.dark-mode .hist-card-stats {
    border-bottom-color: #334155;
}

body.dark-mode .hist-subj-name {
    color: #f8fafc;
}

body.dark-mode .hist-del-btn {
    background: rgba(225, 29, 72, 0.15);
    border-color: rgba(225, 29, 72, 0.4);
    color: #fda4af;
}

body.dark-mode .hist-del-btn:hover {
    background: #e11d48;
    color: #ffffff;
    border-color: #e11d48;
}

/* ─── LỊCH SỬ STANDALONE PAGE STYLES ─── */
.ls-stats-summary-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.ls-stat-box {
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 14px;
    padding: 12px 20px;
    text-align: center;
    min-width: 120px;
}

.ls-stat-num {
    display: block;
    font-size: 22px;
    font-weight: 800;
    color: #ffffff;
}

.ls-stat-lbl {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
}

.ls-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    background: var(--surface, #ffffff);
    padding: 14px 18px;
    border-radius: 14px;
    border: 1px solid var(--border, #e2e8f0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.ls-filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ls-select {
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid var(--border, #cbd5e1);
    background: var(--surface, #ffffff);
    color: var(--text, #0f172a);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    outline: none;
}

body.dark-mode .ls-toolbar {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .ls-select {
    background: #0f172a;
    border-color: #334155;
    color: #f8fafc;
}