/* ========== Quiz/Test Mode Styles ========== */

/* ---- Shared quiz layout ---- */
.quiz-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--bg-card), var(--bg-card-light));
    border-radius: 14px;
    margin-bottom: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    flex-wrap: wrap;
    gap: 10px;
}

.quiz-header h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 800;
}

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

/* ---- Quiz Builder 3-Panel Layout ---- */
.qb-view {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 80px);
    max-height: calc(100vh - 80px);
    overflow: hidden;
}

/* Builder header */
.qb-builder-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 2px solid var(--bg-card-light);
    background: var(--bg-card);
    border-radius: 12px 12px 0 0;
    flex-shrink: 0;
}

.qb-builder-title {
    font-size: 1.3rem;
    font-weight: 800;
    background: linear-gradient(135deg, #ec4899, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.qb-header-count {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: #ec4899;
    font-size: 0.95rem;
}

.qb-header-count-badge {
    background: #ec4899;
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    min-width: 24px;
    text-align: center;
}

/* Filter bar */
.qb-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--bg-card-light);
    align-items: center;
    flex-shrink: 0;
}

.qb-filter-group {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-wrap: wrap;
}

.qb-filter-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 4px;
}

.qb-domain-pill {
    padding: 4px 12px;
    border-radius: 20px;
    border: 2px solid var(--bg-card-light);
    background: var(--bg-card);
    color: var(--text-bright);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.qb-domain-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.qb-domain-pill.active {
    color: white;
    border-color: transparent;
}

.qb-grade-pill {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid var(--bg-card-light);
    background: var(--bg-card);
    color: var(--text-bright);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.qb-grade-pill:hover { transform: scale(1.1); }
.qb-grade-pill.active { color: white; border-color: transparent; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }

.qb-category-select {
    padding: 4px 10px;
    border-radius: 8px;
    border: 2px solid var(--bg-card-light);
    background: var(--bg-card);
    color: var(--text-bright);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    max-width: 200px;
}

.qb-search-filter {
    padding: 5px 12px;
    border-radius: 8px;
    border: 2px solid #ec4899;
    background: var(--bg-card);
    color: var(--text-bright);
    font-size: 0.85rem;
    width: 200px;
    min-width: 120px;
    outline: none;
    transition: border-color 0.2s;
}

.qb-search-filter:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.15);
}

/* 3-panel content */
.qb-content {
    display: grid;
    grid-template-columns: 1fr 320px 2fr;
    flex: 1;
    overflow: hidden;
    gap: 0;
    min-width: 0;
}

/* Skill grid panel (left) */
.qb-grid-panel {
    overflow-y: auto;
    padding: 12px 16px;
    border-right: 1px solid var(--bg-card-light);
}

.qb-domain-section { margin-bottom: 16px; }

.qb-domain-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    margin-bottom: 6px;
    border-bottom: 2px solid;
    font-weight: 800;
    font-size: 0.95rem;
}

.qb-domain-icon { font-size: 1.1rem; }

.qb-category-group { margin-bottom: 10px; margin-left: 8px; }

.qb-category-header {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-dim);
    padding: 3px 0;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.qb-skills-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* Skill cards */
.qb-skill-card {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 8px;
    border: 1.5px solid rgba(0,0,0,0.18);
    background: var(--bg-card);
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.8rem;
    position: relative;
}
.dark .qb-skill-card, .dark-theme .qb-skill-card {
    border-color: rgba(255,255,255,0.15);
}

.qb-skill-card:hover {
    border-color: #ec4899;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

.qb-skill-card.previewing {
    border-color: #ec4899;
    background: rgba(236, 72, 153, 0.08);
    box-shadow: 0 0 0 2px rgba(236, 72, 153, 0.2);
}

.qb-skill-grade {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.qb-skill-name {
    font-weight: 600;
    color: var(--text-bright);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.qb-no-results {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-dim);
    font-size: 0.95rem;
}

/* Preview panel (middle) */
.qb-preview-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid var(--bg-card-light);
    background: var(--bg-card);
}

#qbPreviewContent {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    min-height: 0;
}

#qbPreviewAddBar {
    flex-shrink: 0;
    padding: 0 12px 12px;
}

#qbPreviewAddBar:empty {
    display: none;
}

.qb-preview-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-dim);
    padding: 12px 12px 0;
    margin-bottom: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.qb-preview-empty {
    text-align: center;
    padding: 40px 12px;
    color: var(--text-dim);
    font-size: 0.85rem;
    line-height: 1.5;
}

.qb-preview-section {
    margin-bottom: 12px;
    padding: 10px;
    background: var(--bg-card-light);
    border-radius: 10px;
}

.qb-preview-skill-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-bright);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.qb-preview-question {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-bright);
    margin-bottom: 8px;
    line-height: 1.4;
}

.qb-preview-visual {
    margin: 8px 0;
    text-align: center;
    overflow: auto;
    max-height: 200px;
}

.qb-preview-visual svg { max-width: 100%; height: auto; }

.qb-preview-options { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }

.qb-preview-option {
    padding: 3px 10px;
    border-radius: 6px;
    background: var(--bg-card);
    border: 1px solid var(--bg-card-light);
    font-size: 0.8rem;
    color: var(--text-bright);
}

.qb-preview-option.correct {
    background: rgba(5, 150, 105, 0.15);
    border-color: var(--accent-green);
    color: var(--accent-green);
    font-weight: 700;
}

.qb-preview-answer {
    font-size: 0.85rem;
    color: var(--accent-green);
    font-weight: 700;
    margin-top: 6px;
}

.qb-preview-refresh {
    padding: 4px 10px;
    border-radius: 6px;
    background: #ec4899;
    color: white;
    border: none;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: opacity 0.2s;
}

.qb-preview-refresh:hover { opacity: 0.85; }

/* Add widget in preview panel */
.qb-add-widget {
    padding: 10px 12px;
    background: linear-gradient(135deg, rgba(236,72,153,0.08), rgba(168,85,247,0.08));
    border: 2px solid #ec4899;
    border-radius: 10px;
}

.qb-add-widget-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #ec4899;
    display: block;
    margin-bottom: 6px;
}

.qb-add-widget-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.qb-add-num-input {
    width: 50px;
    padding: 5px 8px;
    border: 2px solid #ec4899;
    border-radius: 6px;
    background: var(--bg-world);
    color: var(--text-bright);
    font-size: 0.9rem;
    text-align: center;
}

.qb-add-widget-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #ec4899, #a855f7);
    color: white;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.qb-add-widget-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(236,72,153,0.3);
}

/* Question panel (right) */
.qb-question-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-card);
}

.qb-questions-title {
    padding: 10px 12px;
    font-weight: 700;
    font-size: 0.85rem;
    color: #ec4899;
    border-bottom: 1px solid var(--bg-card-light);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.qb-question-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.qb-empty {
    text-align: center;
    color: var(--text-dim);
    padding: 40px 20px;
    font-size: 0.95rem;
}

.qb-question-card {
    background: var(--bg-world);
    border: 2px solid var(--bg-card-light);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    position: relative;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.qb-question-card:hover {
    border-color: #ec4899;
    box-shadow: 0 2px 8px rgba(236,72,153,0.15);
}

.qb-q-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.qb-q-num {
    font-weight: 800;
    font-size: 0.8rem;
    color: #ec4899;
    min-width: 24px;
}

.qb-q-skill {
    font-size: 0.65rem;
    background: linear-gradient(135deg, #ec4899, #a855f7);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.qb-q-points {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--text-dim);
}

.qb-q-points input {
    width: 36px;
    padding: 2px 4px;
    border: 1px solid var(--bg-card-light);
    border-radius: 4px;
    text-align: center;
    font-size: 0.75rem;
    background: var(--bg-card);
    color: var(--text-bright);
}

/* Visual question preview in cards */
.qb-q-preview {
    margin-bottom: 6px;
}

.qb-q-text {
    font-size: 0.82rem;
    color: var(--text-bright);
    margin-bottom: 4px;
    line-height: 1.3;
}

.qb-q-visual {
    margin: 4px 0;
    text-align: center;
    max-height: 120px;
    overflow: hidden;
    border-radius: 6px;
    background: var(--bg-card-light);
    padding: 4px;
}

.qb-q-visual svg { max-width: 100%; height: auto; max-height: 110px; }

.qb-q-options {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin: 4px 0;
}

.qb-q-option {
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--bg-card);
    border: 1px solid var(--bg-card-light);
    font-size: 0.72rem;
    color: var(--text-dim);
}

.qb-q-option.correct {
    background: rgba(5, 150, 105, 0.12);
    border-color: var(--accent-green);
    color: var(--accent-green);
    font-weight: 700;
}

.qb-q-answer {
    font-size: 0.75rem;
    color: var(--accent-green);
    font-weight: 700;
    margin-top: 3px;
}

.qb-q-actions {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
    margin-top: 4px;
}

.qb-q-btn {
    padding: 4px 10px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    transition: opacity 0.15s;
    background: var(--bg-card-light);
    color: var(--text-bright);
}

.qb-q-btn:hover { opacity: 0.8; }
.qb-q-btn.danger { background: #ef4444; color: white; }
.qb-q-btn.regen { background: var(--accent-cyan); color: white; }
.qb-q-btn.duplicate { background: var(--accent-green, #22c55e); color: white; }

/* Bottom toolbar */
.qb-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--bg-card), var(--bg-card-light));
    border-radius: 14px;
    margin-top: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    flex-wrap: wrap;
    gap: 10px;
    flex-shrink: 0;
}

.qb-toolbar-info {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-bright);
}

.qb-toolbar-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.qb-toolbar-btn {
    padding: 8px 14px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
    color: white;
}

.qb-toolbar-btn:hover { transform: translateY(-1px); box-shadow: 0 3px 10px rgba(0,0,0,0.15); }

.qb-toolbar-btn.primary { background: linear-gradient(135deg, #06D6A0, #00B894); }
.qb-toolbar-btn.share { background: linear-gradient(135deg, #8b5cf6, #a78bfa); }
.qb-toolbar-btn.print { background: linear-gradient(135deg, #0891b2, #06b6d4); }
.qb-toolbar-btn.export { background: linear-gradient(135deg, #f97316, #ea580c); }
.qb-toolbar-btn.import { background: linear-gradient(135deg, #64748b, #94a3b8); }
.qb-toolbar-btn.settings { background: linear-gradient(135deg, #667eea, #764ba2); }
.qb-toolbar-btn.results { background: linear-gradient(135deg, #ec4899, #f472b6); }

/* Settings panel overlay */
.qb-settings-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1050;
    align-items: center;
    justify-content: center;
}

.qb-settings-overlay.active { display: flex; }

.qb-settings-panel {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}

.qb-settings-panel h3 {
    margin: 0 0 16px;
    font-size: 1.1rem;
}

.qb-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--bg-card-light);
    gap: 10px;
}

.qb-setting-row:last-child { border-bottom: none; }

.qb-setting-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-bright);
}

.qb-setting-input {
    padding: 6px 10px;
    border: 2px solid var(--bg-card-light);
    border-radius: 8px;
    background: var(--bg-world);
    color: var(--text-bright);
    font-size: 0.9rem;
    min-width: 120px;
}

/* My Quizzes list */
.qb-quiz-list {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.qb-quiz-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 2px solid var(--bg-card-light);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.2s;
    gap: 10px;
}

.qb-quiz-item:hover {
    border-color: var(--accent-purple);
}

.qb-quiz-item-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-bright);
}

.qb-quiz-item-meta {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.qb-quiz-item-actions {
    display: flex;
    gap: 6px;
}

/* ---- QB Responsive ---- */
@media (max-width: 1024px) {
    .qb-content { grid-template-columns: 1fr 2fr; }
    .qb-preview-panel { display: none; }
}

@media (max-width: 768px) {
    .qb-content { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
    .qb-question-panel { max-height: 250px; border-top: 2px solid var(--bg-card-light); }
    .qb-grid-panel { border-right: none; }
    .qb-filters { gap: 6px; padding: 8px 12px; }
    .qb-search-filter { width: 150px; }
    .qb-skill-name { max-width: 150px; }
}

/* QB Scrollbar styling */
.qb-grid-panel::-webkit-scrollbar,
#qbPreviewContent::-webkit-scrollbar,
.qb-question-list::-webkit-scrollbar {
    width: 6px;
}

.qb-grid-panel::-webkit-scrollbar-track,
#qbPreviewContent::-webkit-scrollbar-track,
.qb-question-list::-webkit-scrollbar-track {
    background: transparent;
}

.qb-grid-panel::-webkit-scrollbar-thumb,
#qbPreviewContent::-webkit-scrollbar-thumb,
.qb-question-list::-webkit-scrollbar-thumb {
    background: var(--bg-card-light);
    border-radius: 3px;
}

/* ---- Quiz Take (Student) ---- */
.qt-landing {
    max-width: 500px;
    margin: 40px auto;
    text-align: center;
    background: var(--bg-card);
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.qt-landing h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.qt-landing-info {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin: 16px 0;
    flex-wrap: wrap;
}

.qt-landing-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    background: var(--bg-card-light);
    color: var(--text-bright);
}

.qt-name-input {
    width: 100%;
    max-width: 300px;
    padding: 12px 16px;
    border: 2px solid var(--accent-purple);
    border-radius: 12px;
    font-size: 1.1rem;
    text-align: center;
    background: var(--bg-world);
    color: var(--text-bright);
    margin: 16px auto;
    display: block;
    box-sizing: border-box;
}

.qt-name-input:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(6,182,212,0.15);
}

.qt-start-btn {
    padding: 14px 40px;
    font-size: 1.15rem;
    font-weight: 800;
    background: linear-gradient(135deg, #06D6A0, #00B894);
    color: white;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    margin-top: 12px;
    box-shadow: 0 4px 15px rgba(6,214,160,0.35);
    transition: all 0.3s;
}

.qt-start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(6,214,160,0.45);
}

.qt-start-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Test-taking interface */
.qt-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--bg-card), var(--bg-card-light));
    border-radius: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.qt-topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 0.9rem;
}

.qt-topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.qt-timer {
    font-weight: 800;
    font-size: 1rem;
    color: var(--accent-cyan);
    padding: 4px 12px;
    background: var(--bg-world);
    border-radius: 8px;
}

.qt-timer.warning { color: #f97316; }
.qt-timer.danger { color: #ef4444; animation: qt-blink 1s infinite; }

@keyframes qt-blink {
    50% { opacity: 0.5; }
}

.qt-progress {
    width: 100%;
    height: 6px;
    background: var(--bg-card-light);
    border-radius: 3px;
    margin-bottom: 14px;
    overflow: hidden;
}

.qt-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-purple), var(--accent-cyan));
    border-radius: 3px;
    transition: width 0.3s;
}

/* Question card in test mode */
.qt-question-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    margin-bottom: 14px;
}

.qt-q-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.qt-q-num {
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--accent-purple);
}

.qt-q-skill {
    font-size: 0.72rem;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.qt-flag-btn {
    margin-left: auto;
    padding: 4px 10px;
    border: 2px solid var(--bg-card-light);
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    color: var(--text-dim);
}

.qt-flag-btn.flagged {
    border-color: #f97316;
    background: rgba(249,115,22,0.1);
    color: #f97316;
}

.qt-visual-aid {
    margin: 10px 0;
}

.qt-question-text {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-bright);
    margin-bottom: 14px;
    line-height: 1.5;
}

.qt-answer-area {
    margin-top: 12px;
}

.qt-answer-input {
    width: 100%;
    max-width: 350px;
    padding: 12px 16px;
    border: 2px solid var(--bg-card-light);
    border-radius: 10px;
    font-size: 1.1rem;
    background: var(--bg-world);
    color: var(--text-bright);
    box-sizing: border-box;
}

.qt-answer-input:focus {
    outline: none;
    border-color: var(--accent-purple);
}

.qt-mc-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    max-width: 500px;
}

@media (max-width: 500px) {
    .qt-mc-options { grid-template-columns: 1fr; }
}

.qt-mc-option {
    padding: 12px 16px;
    border: 2px solid var(--bg-card-light);
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    background: var(--bg-world);
    color: var(--text-bright);
    transition: all 0.2s;
    text-align: center;
}

.qt-mc-option:hover {
    border-color: var(--accent-purple);
    background: rgba(139,92,246,0.08);
}

.qt-mc-option.selected {
    border-color: var(--accent-purple);
    background: linear-gradient(135deg, rgba(139,92,246,0.15), rgba(6,182,212,0.1));
    box-shadow: 0 0 0 2px var(--accent-purple);
}

.qt-feedback {
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
}

.qt-feedback.correct {
    background: rgba(6,214,160,0.15);
    color: #059669;
    border: 1px solid #06D6A0;
}

.qt-feedback.incorrect {
    background: rgba(239,68,68,0.12);
    color: #dc2626;
    border: 1px solid #ef4444;
}

/* Navigation */
.qt-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
}

.qt-nav-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 700;
    transition: all 0.2s;
    color: white;
}

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

.qt-nav-btn.prev { background: var(--bg-card-light); color: var(--text-bright); }
.qt-nav-btn.next { background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan)); }
.qt-nav-btn.submit { background: linear-gradient(135deg, #06D6A0, #00B894); }

/* Question number grid */
.qt-q-grid {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.qt-q-dot {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 2px solid var(--bg-card-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-world);
    color: var(--text-dim);
}

.qt-q-dot:hover { border-color: var(--accent-purple); }
.qt-q-dot.current { border-color: var(--accent-purple); background: var(--accent-purple); color: white; }
.qt-q-dot.answered { background: rgba(6,214,160,0.2); border-color: #06D6A0; color: #059669; }
.qt-q-dot.flagged { border-color: #f97316; color: #f97316; }
.qt-q-dot.flagged.answered { background: rgba(249,115,22,0.15); }

/* ---- Review Screen ---- */
.qt-review {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    max-width: 600px;
    margin: 0 auto;
}

.qt-review h3 {
    margin: 0 0 16px;
    text-align: center;
}

.qt-review-list {
    max-height: 400px;
    overflow-y: auto;
}

.qt-review-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--bg-card-light);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s;
}

.qt-review-item:hover { background: var(--bg-card-light); }

.qt-review-status {
    font-size: 1rem;
}

.qt-review-summary {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin: 16px 0;
    flex-wrap: wrap;
}

.qt-review-stat {
    text-align: center;
}

.qt-review-stat-val {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--accent-purple);
}

.qt-review-stat-label {
    font-size: 0.8rem;
    color: var(--text-dim);
}

/* ---- Results Screen ---- */
.qt-results {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    background: var(--bg-card);
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.qt-score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 900;
    color: white;
}

.qt-score-circle.pass { background: linear-gradient(135deg, #06D6A0, #00B894); }
.qt-score-circle.fail { background: linear-gradient(135deg, #ef4444, #dc2626); }

.qt-result-details {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    margin: 20px 0;
}

.qt-result-stat {
    padding: 12px;
    background: var(--bg-card-light);
    border-radius: 10px;
}

.qt-result-stat-val {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-bright);
}

.qt-result-stat-label {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 4px;
}

.qt-result-breakdown {
    text-align: left;
    margin-top: 20px;
    max-height: 300px;
    overflow-y: auto;
}

.qt-result-q {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--bg-card-light);
    font-size: 0.88rem;
}

.qt-result-q .correct-icon { color: #06D6A0; }
.qt-result-q .incorrect-icon { color: #ef4444; }

.qt-result-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* ---- Quiz Results (Teacher Analytics) ---- */
.qr-container {
    max-width: 800px;
    margin: 0 auto;
}

.qr-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

@media (max-width: 600px) {
    .qr-summary { grid-template-columns: 1fr 1fr; }
}

.qr-stat-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.qr-stat-val {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-bright);
}

.qr-stat-label {
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-top: 4px;
}

.qr-table-wrap {
    background: var(--bg-card);
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    overflow-x: auto;
    margin-bottom: 16px;
}

.qr-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.qr-table th {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 2px solid var(--bg-card-light);
    font-weight: 700;
    color: var(--text-bright);
    white-space: nowrap;
}

.qr-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--bg-card-light);
    color: var(--text-bright);
}

.qr-table tr:hover td { background: rgba(139,92,246,0.05); }

.qr-pass { color: #059669; font-weight: 700; }
.qr-fail { color: #dc2626; font-weight: 700; }

.qr-q-analysis {
    background: var(--bg-card);
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.qr-q-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
}

.qr-q-bar-label {
    min-width: 30px;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-dim);
}

.qr-q-bar-bg {
    flex: 1;
    height: 20px;
    background: var(--bg-card-light);
    border-radius: 10px;
    overflow: hidden;
}

.qr-q-bar-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s;
    background: linear-gradient(90deg, var(--accent-purple), var(--accent-cyan));
}

.qr-q-bar-fill.low { background: linear-gradient(90deg, #ef4444, #f97316); }

.qr-q-bar-pct {
    min-width: 40px;
    text-align: right;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-bright);
}

/* ---- Print hidden ---- */
@media print {
    .quiz-header,
    .qb-toolbar,
    .qt-topbar,
    .qt-nav,
    .qt-q-grid,
    .qt-result-actions { display: none !important; }
}

/* ---- Section Group Styles ---- */
.qb-section-group {
    border: 2px solid var(--bg-card-light);
    border-radius: 10px;
    margin-bottom: 8px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.qb-section-group.active {
    border-color: var(--section-color, #ec4899);
    box-shadow: 0 0 0 1px var(--section-color, #ec4899);
}

.qb-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: var(--bg-card-light);
    cursor: pointer;
    gap: 6px;
    border-left: 3px solid transparent;
    transition: all 0.15s;
    flex-wrap: wrap;
}

.qb-section-header.active {
    border-left-color: var(--section-color, #ec4899);
    background: linear-gradient(90deg, rgba(236,72,153,0.06), var(--bg-card-light));
}

.qb-section-header-left {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.qb-section-collapse {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 0.7rem;
    padding: 2px 4px;
    line-height: 1;
}

.qb-section-label-input {
    font-size: 0.82rem;
    font-weight: 700;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--text-bright);
    padding: 2px 6px;
    min-width: 80px;
    max-width: 140px;
    transition: border-color 0.2s;
}

.qb-section-label-input:focus {
    outline: none;
    border-color: var(--section-color, #ec4899);
    background: var(--bg-world);
}

.qb-section-count {
    font-size: 0.7rem;
    color: var(--text-dim);
    font-weight: 600;
    white-space: nowrap;
}

.qb-section-layout-badge {
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-dim);
    font-weight: 600;
    white-space: nowrap;
}

.qb-section-actions {
    display: flex;
    align-items: center;
    gap: 3px;
}

.qb-section-layout-select {
    font-size: 0.72rem;
    padding: 2px 4px;
    border: 1px solid var(--bg-card-light);
    border-radius: 4px;
    background: var(--bg-card);
    color: var(--text-bright);
    cursor: pointer;
    max-width: 110px;
}

.qb-section-body {
    padding: 4px 6px;
}

.qb-section-empty {
    text-align: center;
    padding: 16px;
    color: var(--text-dim);
    font-size: 0.82rem;
}

.qb-section-instructions {
    font-size: 0.78rem;
    color: var(--text-dim);
    padding: 4px 8px;
    margin-bottom: 4px;
    font-style: italic;
}

.qb-add-section-btn {
    display: block;
    width: 100%;
    padding: 10px;
    margin-top: 8px;
    border: 2px dashed var(--bg-card-light);
    border-radius: 10px;
    background: transparent;
    color: var(--text-dim);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.qb-add-section-btn:hover {
    border-color: #ec4899;
    color: #ec4899;
    background: rgba(236,72,153,0.04);
}

/* ---- Preview Modal Styles ---- */
.qb-preview-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1060;
    align-items: center;
    justify-content: center;
}

.qb-preview-overlay.active { display: flex; }

.qb-preview-modal {
    background: var(--bg-card);
    border-radius: 16px;
    max-width: 90vw;
    max-height: 85vh;
    width: 900px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 40px rgba(0,0,0,0.3);
    overflow: hidden;
}

.qb-preview-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 2px solid var(--bg-card-light);
    flex-shrink: 0;
}

.qb-preview-tabs {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.qb-preview-tab {
    padding: 6px 16px;
    border: 2px solid var(--bg-card-light);
    border-radius: 8px;
    background: transparent;
    color: var(--text-dim);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.qb-preview-tab.active {
    background: var(--accent-purple);
    border-color: var(--accent-purple);
    color: white;
}

.qb-preview-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-dim);
    cursor: pointer;
    padding: 4px 8px;
    margin-left: 8px;
}

.qb-preview-close:hover { color: #ef4444; }

.qb-preview-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.qb-preview-modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--bg-card-light);
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-shrink: 0;
}

.qb-preview-modal-footer:empty { display: none; }

/* Preview button in toolbar */
.qb-toolbar-btn.preview { background: linear-gradient(135deg, #7c3aed, #a855f7); }

/* Screen Preview Simulation */
.qb-screen-preview {
    max-width: 700px;
    margin: 0 auto;
}

.qb-screen-section {
    margin-bottom: 20px;
}

.qb-screen-section-header {
    font-size: 1rem;
    font-weight: 800;
    color: var(--accent-purple);
    padding: 6px 0;
    border-bottom: 2px solid var(--accent-purple);
    margin-bottom: 10px;
}

.qb-screen-section-instructions {
    font-size: 0.85rem;
    color: var(--text-dim);
    font-style: italic;
    margin-bottom: 8px;
}

.qb-screen-question {
    padding: 8px 12px;
    margin-bottom: 6px;
    background: var(--bg-card-light);
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.qb-screen-q-num {
    font-weight: 800;
    color: var(--accent-purple);
}

.qb-screen-q-visual {
    margin: 6px 0;
    text-align: center;
}

.qb-screen-q-visual svg { max-width: 100%; height: auto; max-height: 100px; }

.qb-screen-q-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.qb-screen-q-option {
    padding: 4px 10px;
    border: 1px solid var(--bg-card-light);
    border-radius: 6px;
    font-size: 0.82rem;
    background: var(--bg-card);
}

.qb-screen-q-answer-line {
    color: var(--text-dim);
    margin-top: 4px;
    font-size: 0.85rem;
}

/* Print Preview (Paper Simulation) */
.qb-print-page {
    background: white;
    color: #1a1a2e;
    border-radius: 4px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.15);
    padding: 30px 40px;
    max-width: 800px;
    margin: 0 auto;
    font-family: 'Nunito', sans-serif;
}

.qb-print-header {
    border-bottom: 2px solid #333;
    padding-bottom: 10px;
    margin-bottom: 16px;
}

.qb-print-section {
    margin-bottom: 18px;
}

.qb-print-section-header {
    font-size: 1rem;
    font-weight: 800;
    color: #1a1a2e;
    border-bottom: 1px solid #ccc;
    padding-bottom: 4px;
    margin-bottom: 10px;
}

.qb-print-section-grid {
    display: grid;
}

.qb-print-question {
    font-size: 0.85rem;
    line-height: 1.4;
    page-break-inside: avoid;
}

.qb-print-question svg { max-width: 100%; height: auto; }

/* ---- Quiz Take Section Styles ---- */
.qt-section-header {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--accent-purple);
    padding: 8px 16px;
    background: linear-gradient(90deg, rgba(139,92,246,0.08), transparent);
    border-left: 3px solid var(--accent-purple);
    border-radius: 0 8px 8px 0;
    margin-bottom: 10px;
}

.qt-section-transition {
    max-width: 500px;
    margin: 40px auto;
    text-align: center;
    background: var(--bg-card);
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.qt-section-transition h3 { margin: 0 0 12px; }

.qt-q-grid-separator {
    width: 2px;
    height: 32px;
    background: var(--bg-card-light);
    margin: 0 4px;
    flex-shrink: 0;
}

/* ---- Dark mode adjustments ---- */
.dark .qb-search { background: var(--bg-world); }
.dark .qt-name-input { background: var(--bg-world); }
.dark .qt-answer-input { background: var(--bg-world); }
.dark .qt-mc-option { background: var(--bg-world); }
.dark .qb-settings-panel { background: var(--bg-card); }
.dark .qb-print-page { background: #f8f8f8; }

/* ===================================================
   Quiz Monitor — Socrative-style Live Dashboard
   =================================================== */

/* ---- Selector Screen ---- */
.qm-selector {
    max-width: 700px;
    margin: 40px auto;
    padding: 20px;
}
.qm-selector-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.qm-selector-header h2 {
    margin: 0;
    font-size: 1.4rem;
    color: var(--text-bright);
}
.qm-selector-desc {
    color: var(--text-dim);
    font-size: 0.92rem;
    margin: 0 0 20px;
}
.qm-quiz-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.qm-quiz-card {
    padding: 16px 20px;
    background: var(--bg-card);
    border-radius: 12px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.qm-quiz-card:hover {
    border-color: var(--accent-purple);
    box-shadow: 0 2px 12px rgba(139, 92, 246, 0.15);
}
.qm-quiz-card-name {
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--text-bright);
}
.qm-quiz-card-meta {
    font-size: 0.82rem;
    color: var(--text-dim);
    margin-top: 4px;
}

/* ---- Dashboard Container ---- */
.qm-dashboard {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: calc(100vh - 40px);
    background: var(--bg-world);
}

/* ---- Top Bar ---- */
.qm-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--bg-card);
    border-bottom: 2px solid var(--bg-card-light);
    flex-wrap: wrap;
    gap: 10px;
}
.qm-topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.qm-topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.qm-back-btn {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text-dim);
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s;
}
.qm-back-btn:hover {
    background: var(--bg-card-light);
}
.qm-quiz-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-bright);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}
.qm-quiz-badge {
    font-size: 0.78rem;
    font-weight: 700;
    background: var(--accent-purple);
    color: white;
    padding: 2px 10px;
    border-radius: 20px;
}

/* ---- Action Buttons ---- */
.qm-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    white-space: nowrap;
    font-family: inherit;
}
.qm-action-btn:active { transform: scale(0.97); }
.qm-btn-pause {
    background: #f3f4f6;
    color: #374151;
}
.qm-btn-pause:hover { background: #e5e7eb; }
.qm-btn-finish {
    background: #fee2e2;
    color: #dc2626;
}
.qm-btn-finish:hover { background: #fecaca; }
.qm-btn-invite {
    background: #8b5cf6;
    color: white;
}
.qm-btn-invite:hover { background: #7c3aed; }

/* ---- Toggle Bar ---- */
.qm-toggle-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 10px 20px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--bg-card-light);
    flex-wrap: wrap;
}
.qm-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-bright);
    cursor: pointer;
    user-select: none;
}
.qm-toggle input[type="checkbox"] {
    display: none;
}
.qm-toggle-slider {
    position: relative;
    width: 36px;
    height: 20px;
    background: #d1d5db;
    border-radius: 20px;
    transition: background 0.2s;
}
.qm-toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.qm-toggle input:checked + .qm-toggle-slider {
    background: #8b5cf6;
}
.qm-toggle input:checked + .qm-toggle-slider::after {
    transform: translateX(16px);
}
.qm-toggle-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}
.qm-stat-pill {
    font-size: 0.78rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
}
.qm-stat-pill.online {
    background: #dcfce7;
    color: #16a34a;
}
.qm-stat-pill.completed {
    background: #dbeafe;
    color: #2563eb;
}
.qm-stat-pill.total {
    background: #f3f4f6;
    color: #6b7280;
}

/* ---- Grid Table ---- */
.qm-grid-wrap {
    flex: 1;
    overflow: auto;
    padding: 16px 20px;
}
.qm-grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.85rem;
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}
.qm-grid thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg-card);
    border-bottom: 2px solid var(--bg-card-light);
    padding: 0;
    text-align: center;
    font-weight: 700;
}
.qm-header-name {
    text-align: left !important;
    padding: 10px 14px !important;
    min-width: 160px;
    color: var(--text-dim);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.qm-header-score {
    min-width: 65px;
    padding: 10px 8px !important;
    color: var(--text-dim);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.qm-q-header {
    min-width: 42px;
    max-width: 52px;
    padding: 0 !important;
}
.qm-q-num {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 4px;
    margin: 4px 2px;
    border-radius: 6px;
    background: var(--q-color, #8b5cf6);
    color: white;
    font-size: 0.78rem;
    font-weight: 800;
    min-height: 28px;
}

/* ---- Student Rows ---- */
.qm-student-row {
    transition: background 0.15s;
}
.qm-student-row:hover {
    background: rgba(139, 92, 246, 0.04);
}
.qm-student-row td {
    border-bottom: 1px solid var(--bg-card-light);
    padding: 6px 4px;
}
.qm-name-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px !important;
    white-space: nowrap;
}
.qm-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.qm-status-dot.online { background: #22c55e; }
.qm-status-dot.completed { background: #3b82f6; }
.qm-status-dot.offline { background: #d1d5db; }
.qm-student-name {
    font-weight: 600;
    color: var(--text-bright);
    overflow: hidden;
    text-overflow: ellipsis;
}
.qm-score-cell {
    text-align: center;
    font-weight: 700;
    color: var(--text-bright);
    padding: 6px 8px !important;
}

/* ---- Answer Cells ---- */
.qm-cell {
    text-align: center;
    min-width: 42px;
    max-width: 52px;
    height: 36px;
    padding: 2px !important;
    transition: background 0.2s;
}
.qm-cell-empty {
    background: var(--bg-card);
}
.qm-cell-correct {
    background: #dcfce7;
}
.qm-cell-incorrect {
    background: #fee2e2;
}
.qm-cell-answered {
    background: #e0e7ff;
}
.qm-cell-hidden {
    background: var(--bg-card-light);
}
.qm-check {
    color: #16a34a;
    font-size: 1rem;
    font-weight: 800;
}
.qm-cross {
    color: #dc2626;
    font-size: 1rem;
    font-weight: 800;
}
.qm-dot-filled {
    color: #6366f1;
    font-size: 0.7rem;
}

/* ---- Class Total Footer ---- */
.qm-class-total {
    background: var(--bg-card-light);
    font-weight: 700;
}
.qm-class-total td {
    border-top: 2px solid var(--bg-card-light);
    padding: 8px 4px;
}
.qm-total-label {
    padding: 8px 14px !important;
    color: var(--text-bright);
    font-size: 0.85rem;
}
.qm-total-avg {
    text-align: center;
    color: var(--text-bright);
    padding: 8px !important;
}
.qm-total-cell {
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-dim);
}
.qm-total-high { color: #16a34a; font-weight: 800; }
.qm-total-mid { color: #f59e0b; font-weight: 800; }
.qm-total-low { color: #dc2626; font-weight: 800; }

/* ---- Empty State ---- */
.qm-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    text-align: center;
    padding: 40px;
    color: var(--text-dim);
}
.qm-empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.4;
}
.qm-empty-state h3 {
    margin: 0 0 8px;
    color: var(--text-bright);
    font-size: 1.2rem;
}
.qm-empty-state p {
    margin: 0;
    font-size: 0.92rem;
    max-width: 400px;
}

/* ---- Footer ---- */
.qm-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--bg-card);
    border-top: 1px solid var(--bg-card-light);
    font-size: 0.82rem;
    color: var(--text-dim);
}
.qm-footer-dot {
    color: var(--text-dim);
    opacity: 0.5;
}

/* ---- Dark Mode Adjustments ---- */
.dark .qm-btn-pause { background: #374151; color: #e5e7eb; }
.dark .qm-btn-pause:hover { background: #4b5563; }
.dark .qm-btn-finish { background: #450a0a; color: #fca5a5; }
.dark .qm-btn-finish:hover { background: #7f1d1d; }
.dark .qm-toggle-slider { background: #4b5563; }
.dark .qm-stat-pill.online { background: #052e16; color: #86efac; }
.dark .qm-stat-pill.completed { background: #172554; color: #93c5fd; }
.dark .qm-stat-pill.total { background: #374151; color: #9ca3af; }
.dark .qm-cell-correct { background: #052e16; }
.dark .qm-cell-incorrect { background: #450a0a; }
.dark .qm-cell-answered { background: #1e1b4b; }
.dark .qm-cell-hidden { background: var(--bg-world); }
.dark .qm-status-dot.offline { background: #4b5563; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .qm-topbar { padding: 10px 12px; }
    .qm-toggle-bar { padding: 8px 12px; gap: 12px; }
    .qm-grid-wrap { padding: 10px; }
    .qm-quiz-title { max-width: 180px; font-size: 1rem; }
    .qm-toggle-stats { margin-left: 0; width: 100%; justify-content: flex-start; }
    .qm-header-name { min-width: 110px; }
    .qm-cell { min-width: 34px; max-width: 42px; }
    .qm-q-num { font-size: 0.7rem; padding: 4px 2px; }
}

@media print {
    .qm-topbar, .qm-toggle-bar, .qm-footer { display: none; }
    .qm-dashboard { min-height: auto; }
}
