/* ═══════════════════════════════════════════════════════════════════════════
   NEETPro — Scientific Precision Design System
   Dark · Premium · Medical-Grade
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── 1. Design Tokens ─────────────────────────────────────────────────── */
:root {
    --bg-root: #080d1a;
    --bg-surface: #0f1628;
    --bg-elevated: #141d33;
    --border: #1e2d4a;

    --primary: #00c8a8;
    --primary-dim: rgba(0, 200, 168, 0.12);
    --primary-glow: rgba(0, 200, 168, 0.3);
    --secondary: #f5a623;
    --secondary-dim: rgba(245, 166, 35, 0.12);
    --secondary-glow: rgba(245, 166, 35, 0.3);
    --danger: #ff4d6d;
    --danger-dim: rgba(255, 77, 109, 0.12);
    --success: #00e5a0;
    --success-dim: rgba(0, 229, 160, 0.12);

    --text-primary: #e8eef8;
    --text-secondary: #6b80a0;
    --text-muted: #3d5275;

    --radius: 6px;
    --radius-sm: 4px;
    --transition: 200ms ease;

    --font-heading: 'Instrument Serif', serif;
    --font-body: 'DM Sans', sans-serif;
    --font-mono: 'DM Mono', monospace;
}

/* ─── 2. Global Reset ──────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-root);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
}

::selection {
    background: var(--primary-dim);
    color: var(--primary);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: #00dbb7;
}

/* ─── 3. Hexagonal Cell Background ─────────────────────────────────────── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='49' viewBox='0 0 28 49'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%23e8eef8' fill-opacity='1'%3E%3Cpath d='M13.99 9.25l13 7.5v15l-13 7.5L1 31.75v-15l12.99-7.5zM3 17.9v12.7l10.99 6.34 11-6.35V17.9l-11-6.34L3 17.9zM0 15l12.98-7.5V0h-2v6.35L0 12.69v2.3zm0 18.5L12.98 41v8h-2v-6.85L0 35.81v-2.3zM15 0v7.5L27.99 15H28v-2.31h-.01L17 6.35V0h-2zm0 49v-8l12.99-7.5H28v2.31h-.01L17 42.15V49h-2z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
    z-index: 0;
}

/* ─── 4. App Container ─────────────────────────────────────────────────── */
.app-container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.workspace {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

/* ─── 5. Header & Navigation ──────────────────────────────────────────── */
.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 2rem;
    background: var(--bg-root);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.logo-dna-icon {
    color: var(--primary);
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

/* Legacy logo icon (emoji) — hidden in new design */
.logo-icon {
    display: none;
}

.brand h1 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    color: var(--primary);
    font-weight: 400;
    letter-spacing: 0.3px;
}

.tagline {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
    font-weight: 400;
}

.main-nav {
    display: flex;
    gap: 2.5rem;
}

.nav-link {
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 0;
    position: relative;
    transition: color var(--transition);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.nav-link i {
    display: none;
}

.nav-link:hover {
    color: var(--text-primary);
}

.nav-link.active {
    color: var(--primary);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 8px var(--primary-glow);
}

.system-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}

.status-dot.online {
    background: var(--primary);
    box-shadow: 0 0 8px var(--primary-glow);
}

.status-text {
    white-space: nowrap;
}

/* ─── 6. Search Section (Hero) ─────────────────────────────────────────── */
.search-section {
    margin-bottom: 2rem;
    animation: fadeInUp 0.5s ease both;
}

.search-card {
    text-align: center;
    padding: 3.5rem 2rem 2.5rem;
}

.search-title {
    font-family: var(--font-heading);
    font-size: 2.25rem;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.search-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.search-form {
    max-width: 680px;
    margin: 0 auto;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.25rem;
    transition: border-color var(--transition);
}

.input-wrapper:focus-within {
    border-color: var(--primary);
}

.search-icon {
    color: var(--text-muted);
    width: 18px;
    height: 18px;
    margin-left: 1rem;
    flex-shrink: 0;
}

#query-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    padding: 0.875rem 1rem;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text-primary);
}

#query-input::placeholder {
    color: var(--text-muted);
}

/* ─── 7. Suggestion Chips ──────────────────────────────────────────────── */
.suggestions {
    margin-top: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.suggest-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 500;
}

.suggest-chips {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.chip {
    padding: 0.4rem 1rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.78rem;
    cursor: pointer;
    transition: all var(--transition);
}

.chip:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-dim);
}

/* ─── 8. Buttons ───────────────────────────────────────────────────────── */
.submit-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: var(--bg-root);
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 0 20px var(--primary-glow);
    letter-spacing: 0.2px;
}

.submit-btn:hover {
    background: #00dbb7;
    box-shadow: 0 0 30px var(--primary-glow);
}

.submit-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
}

.submit-btn i {
    width: 16px;
    height: 16px;
}

.btn-icon {
    width: 16px;
    height: 16px;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

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

.action-btn i {
    width: 14px;
    height: 14px;
}

.btn-action-icon {
    width: 14px;
    height: 14px;
}

.action-btn-close {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.action-btn-close:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.action-btn-close i {
    width: 16px;
    height: 16px;
}

/* ─── 9. Results Section ───────────────────────────────────────────────── */
.results-section {
    margin-top: 1.5rem;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1.5rem;
    align-items: start;
}

.answer-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sources-column {}

/* ─── 10. Loading State (Cyan Line Sweep) ──────────────────────────────── */
.loading-state {
    display: flex;
    justify-content: center;
    padding: 3rem 0;
    animation: fadeInUp 0.4s ease both;
}

.loader-card {
    text-align: center;
    padding: 2rem;
}

.loader-card h3 {
    font-family: var(--font-heading);
    font-weight: 400;
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* Line sweep replaces circular spinner */
.spinner {
    width: 200px;
    height: 2px;
    background: var(--border);
    position: relative;
    overflow: hidden;
    border-radius: 1px;
    margin: 0 auto 1.5rem;
}

.spinner::after {
    content: '';
    position: absolute;
    left: -40%;
    width: 40%;
    height: 100%;
    background: var(--primary);
    border-radius: 1px;
    animation: lineSweep 1.2s ease infinite;
}

.loading-message {
    color: var(--text-secondary);
    font-size: 0.85rem;
    max-width: 400px;
    margin: 0 auto;
    line-height: 1.5;
}

/* ─── 11. Error State ──────────────────────────────────────────────────── */
.error-state {
    display: flex;
    justify-content: center;
    padding: 2rem 0;
}

.error-card {
    background: var(--bg-surface);
    border: 1px solid var(--danger);
    border-top: 2px solid var(--danger);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    max-width: 500px;
}

.error-icon {
    color: var(--danger);
    width: 28px;
    height: 28px;
    margin-bottom: 0.75rem;
}

.error-card h3 {
    font-family: var(--font-heading);
    color: var(--danger);
    font-weight: 400;
    margin-bottom: 0.5rem;
}

.error-card p {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ─── 12. Card System ──────────────────────────────────────────────────── */
.result-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-top: 2px solid var(--primary);
    border-radius: var(--radius);
    overflow: hidden;
    animation: fadeInUp 0.5s ease both;
}

.result-card:nth-child(2) {
    animation-delay: 80ms;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.title-with-icon {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.title-with-icon h3 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 400;
    color: var(--text-primary);
}

.accent-icon {
    color: var(--primary);
    width: 18px;
    height: 18px;
}

.sources-icon {
    color: var(--secondary);
    width: 18px;
    height: 18px;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
}

/* Answer Card — Cyan Left Border Override */
.answer-card {
    border-top: 1px solid var(--border);
    border-left: 3px solid var(--primary);
}

/* Sources Card — Amber Top Accent */
.sources-card {
    border-top: 2px solid var(--secondary);
}

/* ─── 13. Markdown Body ────────────────────────────────────────────────── */
.markdown-body {
    font-size: 0.92rem;
    line-height: 1.8;
    color: var(--text-primary);
}

.markdown-body h1, .markdown-body h2, .markdown-body h3,
.markdown-body h4, .markdown-body h5, .markdown-body h6 {
    font-family: var(--font-heading);
    margin: 1.25rem 0 0.625rem;
    font-weight: 400;
    color: var(--text-primary);
}

.markdown-body h1 { font-size: 1.5rem; }
.markdown-body h2 { font-size: 1.25rem; }
.markdown-body h3 { font-size: 1.1rem; }
.markdown-body h4 { font-size: 1rem; }

.markdown-body p { margin-bottom: 0.75rem; }

.markdown-body ul, .markdown-body ol {
    padding-left: 1.5rem;
    margin-bottom: 0.75rem;
}

.markdown-body li { margin-bottom: 0.25rem; }

.markdown-body strong {
    color: var(--primary);
    font-weight: 600;
}

.markdown-body em {
    color: var(--text-secondary);
    font-style: italic;
}

.markdown-body code {
    font-family: var(--font-mono);
    background: var(--bg-elevated);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
    font-size: 0.84em;
    color: var(--secondary);
}

.markdown-body pre {
    background: var(--bg-elevated);
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
}

.markdown-body pre code {
    background: none;
    padding: 0;
}

.markdown-body blockquote {
    border-left: 3px solid var(--primary);
    padding: 0.5rem 1rem;
    margin: 1rem 0;
    color: var(--text-secondary);
    background: var(--primary-dim);
    border-radius: 0 var(--radius) var(--radius) 0;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.markdown-body th, .markdown-body td {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    text-align: left;
    font-size: 0.84rem;
}

.markdown-body th {
    background: var(--bg-elevated);
    font-weight: 600;
    color: var(--primary);
}

/* ─── 14. Source Citations (Compact Collapsible) ───────────────────────── */
.sources-intro-text {
    font-size: 0.72rem;
    color: var(--text-muted);
    padding: 0 1.25rem 0.75rem;
    line-height: 1.5;
}

.sources-list {
    padding: 0 1.25rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.source-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: border-color var(--transition);
}

.source-item:hover {
    border-color: var(--text-muted);
}

.source-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: background var(--transition);
}

.source-item-header:hover {
    background: var(--bg-elevated);
}

.source-meta {
    flex: 1;
    min-width: 0;
}

.source-ref {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-primary);
    display: block;
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.source-badges {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
}

.badge-class, .badge-scores {
    font-size: 0.62rem;
    font-family: var(--font-mono);
    padding: 0.1rem 0.4rem;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
}

.expand-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.25rem;
    transition: transform var(--transition);
    display: flex;
    align-items: center;
}

.source-item.expanded .expand-toggle {
    transform: rotate(180deg);
}

.expand-icon {
    width: 14px;
    height: 14px;
}

.source-text-container {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.source-item.expanded .source-text-container {
    max-height: 500px;
}

.source-text-excerpt {
    padding: 0.75rem;
    font-size: 0.8rem;
    line-height: 1.7;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
}

.source-text-excerpt mark {
    background: var(--primary-dim);
    color: var(--primary);
    border-radius: 2px;
    padding: 0 2px;
}

.no-sources {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
}

/* ─── 15. Badge System ─────────────────────────────────────────────────── */
.badge {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    padding: 0.2rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    background: var(--bg-elevated);
}

.badge-difficulty {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.badge-difficulty.easy {
    background: var(--success-dim);
    color: var(--success);
    border: 1px solid rgba(0, 229, 160, 0.3);
}

.badge-difficulty.medium {
    background: var(--secondary-dim);
    color: var(--secondary);
    border: 1px solid rgba(245, 166, 35, 0.3);
}

.badge-difficulty.hard {
    background: var(--danger-dim);
    color: var(--danger);
    border: 1px solid rgba(255, 77, 109, 0.3);
}

/* ─── 16. Test Yourself Button (Amber, Full-Width) ─────────────────────── */
.quiz-trigger-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
}

.test-yourself-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem;
    background: var(--secondary);
    color: var(--bg-root);
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 0 20px var(--secondary-glow);
    letter-spacing: 0.2px;
}

.test-yourself-btn:hover {
    background: #ffb940;
    box-shadow: 0 0 30px var(--secondary-glow);
}

.test-yourself-btn i {
    width: 16px;
    height: 16px;
}

/* ─── 17. Inline Quiz Container ────────────────────────────────────────── */
.quiz-card {
    border-top: 2px solid var(--primary);
}

.quiz-loading-overlay {
    text-align: center;
    padding: 2.5rem 1.5rem;
}

.quiz-loading-overlay p {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.quiz-body {}

.quiz-progress-bar {
    width: 100%;
    height: 2px;
    background: var(--border);
    border-radius: 1px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.quiz-progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 1px;
    transition: width 0.3s ease;
}

.quiz-questions {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.quiz-actions {
    display: flex;
    justify-content: flex-end;
}

.quiz-submit-btn {}

.quiz-actions-footer {
    display: flex;
    justify-content: center;
    padding: 1rem 0;
    gap: 0.75rem;
}

/* ─── 18. Quiz Question Cards ──────────────────────────────────────────── */
.question-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.875rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.question-number {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.question-text {
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.quiz-question-card {
    padding: 1.25rem;
    background: var(--bg-root);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    animation: slideInRight 0.4s ease both;
}

.quiz-question-card:nth-child(1) { animation-delay: 0ms; }
.quiz-question-card:nth-child(2) { animation-delay: 80ms; }
.quiz-question-card:nth-child(3) { animation-delay: 160ms; }
.quiz-question-card:nth-child(4) { animation-delay: 240ms; }
.quiz-question-card:nth-child(5) { animation-delay: 320ms; }

/* ─── 19. Quiz Options (Indicator Square Fills Cyan) ───────────────────── */
.options-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.quiz-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
}

.quiz-option:hover {
    border-color: var(--primary);
    background: var(--primary-dim);
}

.quiz-option input[type="radio"] {
    display: none;
}

.option-indicator {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: all var(--transition);
}

.quiz-option input[type="radio"]:checked + .option-indicator {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--bg-root);
}

.quiz-option:has(input[type="radio"]:checked) {
    border-color: var(--primary);
    background: var(--primary-dim);
}

.option-text {
    font-size: 0.88rem;
    color: var(--text-primary);
    line-height: 1.5;
}

/* ─── 20. Score Display ────────────────────────────────────────────────── */
.results-dashboard {
    margin-bottom: 1.5rem;
}

.results-score-wrapper {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 2rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-top: 2px solid var(--primary);
    border-radius: var(--radius);
}

.score-circle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 120px;
}

#score-text,
#results-score-text {
    font-family: var(--font-mono);
    font-size: 3rem;
    font-weight: 500;
    color: var(--primary);
    line-height: 1;
}

/* Mock test results — larger score (64px) */
#results-score-text {
    font-size: 4rem;
}

.score-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 0.375rem;
    font-family: var(--font-mono);
}

.score-summary {
    flex: 1;
}

.score-summary h4 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 400;
    margin-bottom: 0.375rem;
    color: var(--text-primary);
}

.score-summary p {
    color: var(--text-secondary);
    font-size: 0.84rem;
    line-height: 1.5;
}

/* Score Distribution Bar */
.score-distribution-bar {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: var(--text-muted);
    overflow: hidden;
    display: flex;
    margin-top: 1rem;
}

.score-bar-correct { background: var(--success); height: 100%; }
.score-bar-wrong { background: var(--danger); height: 100%; }
.score-bar-unattempted { background: var(--text-muted); height: 100%; }

/* ─── 21. Quiz Results ─────────────────────────────────────────────────── */
.quiz-questions-results {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.quiz-result-question-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    animation: slideInRight 0.4s ease both;
}

.quiz-result-question-card.correct {
    border-left-color: var(--primary);
}

.quiz-result-question-card.wrong {
    border-left-color: var(--danger);
}

.result-question-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.badge-status-icon {
    font-size: 0.78rem;
    font-weight: 600;
    font-family: var(--font-mono);
}

.quiz-result-question-card.correct .badge-status-icon {
    color: var(--success);
}

.quiz-result-question-card.wrong .badge-status-icon {
    color: var(--danger);
}

/* Result Options */
.options-grid-results {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin-bottom: 0.875rem;
}

.result-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-root);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.84rem;
}

.result-option .option-indicator {
    width: 24px;
    height: 24px;
    font-size: 0.68rem;
}

.result-option .option-text {
    font-size: 0.84rem;
}

.result-option.correct-option {
    border-color: rgba(0, 229, 160, 0.4);
    background: var(--success-dim);
}

.result-option.correct-option .option-indicator {
    background: var(--success);
    border-color: var(--success);
    color: var(--bg-root);
}

.result-option.wrong-option {
    border-color: rgba(255, 77, 109, 0.4);
    background: var(--danger-dim);
}

.result-option.wrong-option .option-indicator {
    background: var(--danger);
    border-color: var(--danger);
    color: var(--bg-root);
}

.status-badge-inline {
    margin-left: auto;
    font-size: 0.68rem;
    font-weight: 600;
    font-family: var(--font-mono);
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.correct-badge {
    background: var(--success-dim);
    color: var(--success);
}

.wrong-badge {
    background: var(--danger-dim);
    color: var(--danger);
}

/* ─── 22. Explanation Box ──────────────────────────────────────────────── */
.explanation-box {
    padding: 0.75rem 1rem;
    background: var(--bg-elevated);
    border-radius: var(--radius);
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0.75rem;
    border-left: 2px solid var(--primary);
}

.explanation-box strong {
    color: var(--primary);
    font-weight: 600;
}

/* ─── 23. Deep Dive Button & Trigger ───────────────────────────────────── */
.deep-dive-trigger-row {
    display: flex;
    justify-content: flex-end;
}

.deep-dive-btn {
    border-color: var(--secondary) !important;
    color: var(--secondary) !important;
    font-size: 0.75rem !important;
}

.deep-dive-btn:hover {
    background: var(--secondary-dim) !important;
}

/* ─── 24. Deep Dive Modal ──────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 13, 26, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 2rem;
    animation: fadeInUp 0.25s ease both;
}

.modal-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-top: 2px solid var(--primary);
    border-radius: var(--radius);
    width: 100%;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-surface);
    z-index: 1;
}

.modal-body {
    padding: 1.25rem;
}

.deep-dive-loading {
    text-align: center;
    padding: 2rem;
}

.deep-dive-loading p {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.deep-dive-content {}

.deep-dive-answer-section {
    margin-bottom: 1.5rem;
}

.deep-dive-answer-section h4,
.deep-dive-sources-section h4 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 400;
    margin-bottom: 0.75rem;
    color: var(--primary);
}

.deep-dive-sources-section {
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}

/* ─── 25. Mock Test — Setup Container ──────────────────────────────────── */
.mock-setup-container {
    animation: fadeInUp 0.5s ease both;
}

.setup-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-top: 2px solid var(--primary);
    border-radius: var(--radius);
    padding: 2rem;
}

.setup-card-header {
    margin-bottom: 2rem;
}

.setup-card-header h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.setup-card-header p {
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.5;
}

.class-group {
    margin-bottom: 2rem;
}

.setup-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.875rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    font-weight: 500;
}

.select-all-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.68rem;
    padding: 0.25rem 0.75rem;
    cursor: pointer;
    transition: all var(--transition);
}

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

/* ─── 26. Chapter Grid & Cards ─────────────────────────────────────────── */
.chapters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 0.5rem;
}

.chapter-card {
    background: var(--bg-root);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chapter-card:hover {
    border-color: var(--text-muted);
    background: var(--bg-elevated);
}

.chapter-card.selected {
    border-color: var(--primary);
    border-top: 2px solid var(--primary);
    background: var(--primary-dim);
}

.chapter-card input[type="checkbox"] {
    display: none;
}

.chapter-card-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    line-height: 1.4;
}

.chapter-card.selected .chapter-card-label {
    color: var(--text-primary);
}

/* ─── 27. Question Count Selector ──────────────────────────────────────── */
.count-options {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.count-option {
    cursor: pointer;
}

.count-option input[type="radio"] {
    display: none;
}

.count-option span {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    background: var(--bg-root);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.count-option input[type="radio"]:checked + span {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--bg-root);
    box-shadow: 0 0 15px var(--primary-glow);
}

.count-option:hover span {
    border-color: var(--primary);
}

/* ─── 28. Generate Test Button ─────────────────────────────────────────── */
.generate-test-btn {
    width: 100%;
    margin-top: 0.5rem;
    justify-content: center;
}

/* ─── 29. Mock Test — Active Layout ────────────────────────────────────── */
.mock-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 1.5rem;
    align-items: start;
    animation: fadeInUp 0.4s ease both;
}

.mock-sidebar {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    position: sticky;
    top: 80px;
}

.sidebar-title {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin-bottom: 0.625rem;
    font-weight: 500;
    font-family: var(--font-mono);
}

/* ─── 30. Timer Panel ──────────────────────────────────────────────────── */
.mock-timer-panel {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}

.mock-timer-panel i {
    color: var(--primary);
    width: 16px;
    height: 16px;
}

#timer-display {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    color: var(--primary);
    font-weight: 500;
    letter-spacing: 1px;
}

/* ─── 31. Question Palette ─────────────────────────────────────────────── */
.question-palette {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.375rem;
    margin-bottom: 0.875rem;
}

.palette-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    padding: 0;
}

.palette-btn:hover {
    border-color: var(--text-muted);
}

.palette-btn.active {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 8px var(--primary-glow);
}

.palette-btn.answered {
    background: var(--success-dim);
    border-color: rgba(0, 229, 160, 0.4);
    color: var(--success);
}

.palette-btn.marked {
    background: var(--secondary-dim);
    border-color: rgba(245, 166, 35, 0.4);
    color: var(--secondary);
}

/* ─── 32. Palette Legend ───────────────────────────────────────────────── */
.legend-palette {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin: 0.875rem 0;
    padding: 0.625rem;
    background: var(--bg-elevated);
    border-radius: var(--radius);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.68rem;
    color: var(--text-muted);
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.legend-color.unanswered {
    background: var(--bg-elevated);
}

.legend-color.answered {
    background: var(--success-dim);
    border-color: rgba(0, 229, 160, 0.4);
}

.legend-color.marked {
    background: var(--secondary-dim);
    border-color: rgba(245, 166, 35, 0.4);
}

/* ─── 33. Active Question Card ─────────────────────────────────────────── */
.mock-main {}

.active-question-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-top: 2px solid var(--primary);
    border-radius: var(--radius);
    padding: 1.5rem;
}

/* ─── 34. Mock Navigation Controls ─────────────────────────────────────── */
.mock-nav-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.nav-buttons-left {
    display: flex;
    gap: 0.5rem;
}

/* ─── 35. Mark for Review Button ───────────────────────────────────────── */
.mark-review-btn {
    border-color: var(--secondary) !important;
    color: var(--secondary) !important;
}

.mark-review-btn:hover {
    background: var(--secondary-dim) !important;
}

.mark-review-btn.active {
    background: var(--secondary) !important;
    color: var(--bg-root) !important;
    box-shadow: 0 0 12px var(--secondary-glow);
}

/* ─── 36. Submit Test Sidebar Button ───────────────────────────────────── */
.submit-test-btn-sidebar {
    width: 100%;
    margin-top: 0.875rem;
    justify-content: center;
}

/* ─── 37. Footer ───────────────────────────────────────────────────────── */
.app-footer {
    text-align: center;
    padding: 2rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.72rem;
    letter-spacing: 0.2px;
}

/* ─── 38. Animations ───────────────────────────────────────────────────── */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes lineSweep {
    0% { left: -40%; }
    100% { left: 100%; }
}

/* ─── 39. Scrollbar ────────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: var(--bg-root);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ─── 40. Utility ──────────────────────────────────────────────────────── */
.hidden {
    display: none !important;
}

/* ─── 41. Responsive ───────────────────────────────────────────────────── */
@media (max-width: 960px) {
    .results-grid {
        grid-template-columns: 1fr;
    }

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

    .mock-sidebar {
        position: static;
        display: grid;
        grid-template-columns: auto 1fr auto;
        gap: 1rem;
        align-items: start;
    }

    .mock-sidebar .sidebar-title { display: none; }

    .mock-timer-panel { margin-bottom: 0; }

    .question-palette {
        grid-template-columns: repeat(auto-fill, 28px);
    }

    .legend-palette { display: none; }
}

@media (max-width: 640px) {
    .main-header {
        flex-wrap: wrap;
        gap: 0.625rem;
        padding: 0.75rem 1rem;
    }

    .main-nav { gap: 1.5rem; }

    .system-status { display: none; }

    .workspace {
        padding: 1rem;
    }

    .search-card {
        padding: 2rem 1rem 1.5rem;
    }

    .search-title {
        font-size: 1.6rem;
    }

    .chapters-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .results-score-wrapper {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    #results-score-text {
        font-size: 3rem;
    }

    .setup-card { padding: 1.25rem; }

    .mock-sidebar {
        grid-template-columns: 1fr;
    }
}

/* Header Auth Section */
.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-auth {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-family: var(--font-body);
}

.auth-btn-login {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: color var(--transition);
}

.auth-btn-login:hover {
    color: var(--text-primary);
}

.auth-btn-signup {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--border);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition);
}

.auth-btn-signup:hover {
    border-color: var(--primary);
    box-shadow: 0 0 8px var(--primary-glow);
}

.user-profile-menu {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
}

.user-icon-wrapper {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
}

.premium-badge {
    background: rgba(245, 166, 35, 0.15);
    color: var(--secondary);
    border: 1px solid rgba(245, 166, 35, 0.3);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.free-badge {
    background: rgba(107, 128, 160, 0.1);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auth-btn-logout {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0.2rem;
    display: flex;
    align-items: center;
    transition: color var(--transition);
}

.auth-btn-logout:hover {
    color: var(--danger);
}

.spinner-tiny {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(0, 200, 168, 0.1);
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

