/**
 * PUMKIN.DEV Academic Design System - Features Stylesheet
 * Layer: 4 - Features (Knowledge Hub, QBank, Obsidian Dark Mode, Diagnostics, DNA Pills, Toasts)
 */

/* Knowledge Hub Styles */
.knowledge-stream-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.stream-tab-btn {
    padding: 8px 18px;
    border-radius: 20px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.stream-tab-btn.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(30, 58, 138, 0.25);
}

.knowledge-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    margin-bottom: 40px;
}

.knowledge-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.knowledge-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(0,0,0,0.08);
    border-color: var(--primary-light);
}

.knowledge-card-chapter {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary-light);
    margin-bottom: 6px;
}

.knowledge-card-title {
    font-size: 16.5px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.4;
    margin-bottom: 8px;
}

.knowledge-card-overview {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.55;
    margin-bottom: 16px;
    flex-grow: 1;
}

.knowledge-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 14px;
    border-top: 1px dashed #e2e8f0;
    font-size: 12px;
    color: var(--text-muted);
}

/* Knowledge Article Reader Layout */
.article-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 30px;
    align-items: start;
    margin-top: 20px;
}

@media (max-width: 900px) {
    .article-layout {
        grid-template-columns: 1fr;
    }
    .article-toc {
        position: static;
        max-height: none;
        margin-bottom: 20px;
        z-index: 1;
    }
}

.article-toc {
    position: sticky;
    top: 85px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 18px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.article-toc h4 {
    font-size: 13.5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary);
    margin-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 6px;
}

.article-toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.article-toc li {
    margin-bottom: 8px;
}

.article-toc a {
    text-decoration: none;
    font-size: 13px;
    color: var(--text-muted);
    transition: color 0.15s ease;
    display: block;
    line-height: 1.4;
}

.article-toc a:hover {
    color: var(--primary);
    font-weight: 600;
}

.article-body {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
    overflow-x: auto;
    min-width: 0;
}

.article-section {
    margin-bottom: 35px;
}

.article-section-title {
    font-size: 19px;
    font-weight: 700;
    color: var(--primary);
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.formula-card-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    margin-top: 14px;
}

.formula-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 18px 22px;
    position: relative;
    width: 100%;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
}

.formula-card:hover {
    border-color: var(--primary-light);
    box-shadow: 0 4px 14px rgba(0,0,0,0.06);
}

.formula-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.formula-name {
    font-weight: 700;
    font-size: 15px;
    color: var(--primary);
}

.formula-math-box,
.formula-latex-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px 18px;
    margin: 10px 0;
    text-align: center;
    overflow-x: auto;
    max-width: 100%;
    font-size: 16px;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
    -webkit-overflow-scrolling: touch;
}

.formula-math-box::-webkit-scrollbar,
.formula-latex-box::-webkit-scrollbar {
    height: 6px;
}

.formula-math-box::-webkit-scrollbar-thumb,
.formula-latex-box::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.formula-math-box::-webkit-scrollbar-track,
.formula-latex-box::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.formula-math-box mjx-container,
.formula-latex-box mjx-container {
    max-width: 100%;
    overflow-x: visible !important;
}

.formula-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Worked Examples Accordion */
.example-box {
    background: #fcfcfd;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 18px;
    overflow: hidden;
}

.example-header {
    background: #f1f5f9;
    padding: 14px 18px;
    font-weight: 700;
    font-size: 14.5px;
    color: var(--primary);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.example-content {
    padding: 18px;
    font-size: 14px;
    line-height: 1.6;
}

.example-step {
    padding: 8px 12px;
    background: #ffffff;
    border-left: 3px solid var(--primary-light);
    margin-bottom: 8px;
    border-radius: 0 6px 6px 0;
}

.example-takeaway {
    background: #ecfdf5;
    border-left: 4px solid #10b981;
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 13px;
    color: #065f46;
    margin-top: 12px;
}

/* QBank Explorer Styles */
.qbank-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 18px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
}

.qbank-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 6px 16px rgba(0,0,0,0.06);
}

.qbank-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.qbank-question-text {
    font-size: 15px;
    line-height: 1.65;
    color: var(--text-main);
    margin-bottom: 14px;
}

.qbank-actions-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f1f5f9;
    padding-top: 12px;
    margin-top: 12px;
}

/* Readiness Gauges & Learning Path Dashboard */
.readiness-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.readiness-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.readiness-circle {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: conic-gradient(var(--primary) 0%, #e2e8f0 0%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.readiness-circle::before {
    content: "";
    width: 60px;
    height: 60px;
    background: #ffffff;
    border-radius: 50%;
    position: absolute;
}

.readiness-score-text {
    position: relative;
    font-size: 17px;
    font-weight: 800;
    color: var(--primary);
}

.learning-path-box {
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border: 1px solid #bae6fd;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 30px;
}

.learning-path-step-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.learning-step-card {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.learning-step-num {
    font-size: 11px;
    font-weight: 800;
    color: var(--primary-light);
    text-transform: uppercase;
    margin-bottom: 6px;
}

.learning-step-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
}

/* ==========================================================================
   THEME TRANSITIONS & DARK MODE (CHẾ ĐỘ SÁNG / TỐI)
   ========================================================================== */
body {
    transition: background-color 0.25s ease, color 0.25s ease;
}

.wrapper, .formula-card, .knowledge-card, .qbank-card, .modal-content, .exam-player-container, .pumkin-nav-container {
    transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, color 0.25s ease;
}

[data-theme="dark"],
body.dark-mode {
    /* Hand-crafted Dark Mode System (Obsidian Slate & Warm Highlights) */
    --color-bg: #0b0f17;
    --color-surface: #121824;
    --color-surface-subtle: #1a2233;
    --color-text: #f1f5f9;
    --color-text-muted: #94a3b8;
    --color-text-inverse: #0b0f17;
    --color-border: #232d3f;
    --color-border-strong: #334155;
    
    --color-primary: #f8fafc;
    --color-primary-hover: #e2e8f0;
    --color-primary-light: #94a3b8;
    --color-primary-bg: #1a2233;
    --color-accent: #fb923c;        /* Warm Amber/Pumkin Glow */
    --color-accent-hover: #f97316;
    --color-accent-bg: #431407;

    --color-success: #34d399;
    --color-success-bg: #064e3b;
    --color-warning: #fbbf24;
    --color-warning-bg: #78350f;
    --color-danger: #f87171;
    --color-danger-bg: #7f1d1d;

    --primary: var(--color-primary);
    --primary-light: var(--color-primary-light);
    --primary-bg: var(--color-primary-bg);
    --accent: var(--color-accent);
    --success: var(--color-success);
    --success-bg: var(--color-success-bg);
    --warning: var(--color-warning);
    --warning-bg: var(--color-warning-bg);
    --danger: var(--color-danger);
    --danger-bg: var(--color-danger-bg);
    --text-main: var(--color-text);
    --text-muted: var(--color-text-muted);
    --border-color: var(--color-border);
    --card-bg: var(--color-surface);
    --bg-card: var(--card-bg);
    --card-bg-subtle: var(--color-surface-subtle);
    --code-bg: #0d121d;
    --bg-color: var(--color-bg);
    --text-color: var(--color-text);

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.7);

    --input-bg: #161f2e;
    --input-border: #2b384e;
    --input-focus-ring: rgba(251, 146, 60, 0.2);

    --nav-bg: rgba(18, 24, 36, 0.94);
    --nav-border: #232d3f;
    --modal-overlay: rgba(0, 0, 0, 0.75);
    --scrollbar-thumb: #334155;
    --icon-muted: #64748b;
}

body.dark-mode .wrapper {
    background: #0f172a;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.7);
}

body.dark-mode .pumkin-nav-container {
    background: #0b0f19 !important;
    border-bottom-color: #1e293b !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7) !important;
}

body.dark-mode .nav-tab {
    color: #94a3b8;
}

body.dark-mode .nav-tab:hover {
    background: #1e293b;
    color: #60a5fa;
}

body.dark-mode .nav-tab.active {
    background: #2563eb;
    color: #ffffff;
}

body.dark-mode .nav-scroll-arrow,
body.dark-mode .btn-theme-toggle {
    background: #1e293b;
    border-color: #334155;
    color: #f8fafc;
}

body.dark-mode .nav-scroll-arrow:hover {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

/* CARDS & CONTAINERS (DARK SLATE THEME HARMONIZED WITH FORMULAS) */
body.dark-mode .formula-card,
body.dark-mode .knowledge-card,
body.dark-mode .qbank-card,
body.dark-mode .example-box,
body.dark-mode .stat-box,
body.dark-mode .exam-card,
body.dark-mode .readiness-card,
body.dark-mode .learning-step-card,
body.dark-mode .filter-panel,
body.dark-mode .search-box-wrapper,
body.dark-mode .review-card,
body.dark-mode .analytics-section,
body.dark-mode .admin-card {
    background: #131b2e !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

/* FORMULA DISPLAY & MATH BOXES (THE GOLD STANDARD DARK PALETTE) */
body.dark-mode .formula-math-box,
body.dark-mode .formula-latex-box,
body.dark-mode .formula-display {
    background: #0f172a !important;
    border: 1px solid #334155 !important;
    color: #93c5fd !important;
}

/* EXAM GENERATOR FORM (ELIMINATING WHITE CARDS & RESTORING VISIBLE TEXT) */
body.dark-mode .generator-card {
    background: #131b2e !important;
    border: 1px solid #334155 !important;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5) !important;
    color: #f8fafc !important;
}

body.dark-mode .generator-card .form-group {
    border-bottom-color: #1e293b !important;
}

body.dark-mode .generator-card .form-label,
body.dark-mode .form-label {
    color: #93c5fd !important;
    font-weight: 700 !important;
}

body.dark-mode .form-help {
    color: #94a3b8 !important;
}

body.dark-mode .radio-pill-card {
    background: #0f172a !important;
    border: 1.5px solid #334155 !important;
    color: #cbd5e1 !important;
    transition: all 0.2s ease !important;
}

body.dark-mode .radio-pill-card:hover {
    background: #1e293b !important;
    border-color: #60a5fa !important;
    color: #93c5fd !important;
}

body.dark-mode .radio-pill-card.selected {
    background: #1e3a8a !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
    box-shadow: 0 0 0 1px #60a5fa, 0 2px 10px rgba(37, 99, 235, 0.4) !important;
}

body.dark-mode .checkbox-card {
    background: #0f172a !important;
    border: 1.5px solid #334155 !important;
    color: #cbd5e1 !important;
    transition: all 0.2s ease !important;
}

body.dark-mode .checkbox-card:hover {
    background: #1e293b !important;
    border-color: #60a5fa !important;
    color: #93c5fd !important;
}

body.dark-mode .checkbox-card.checked {
    background: #1e3a8a !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
    box-shadow: 0 0 0 1px #60a5fa !important;
}

body.dark-mode .matrix-preview-card {
    background: #0f172a !important;
    border: 1px solid #334155 !important;
    color: #93c5fd !important;
}

/* TABLES (ELIMINATING WHITE CELLS & INVISIBLE FORMULAS IN COMPARISON/TRACE TABLES) */
body.dark-mode table {
    background: #0f172a !important;
    border: 1px solid #334155 !important;
    color: #f8fafc !important;
}

body.dark-mode thead th,
body.dark-mode th {
    background: #1e293b !important;
    color: #93c5fd !important;
    border: 1px solid #334155 !important;
    font-weight: 700 !important;
}

body.dark-mode tbody td,
body.dark-mode td {
    background: #0f172a !important;
    color: #f8fafc !important;
    border: 1px solid #334155 !important;
}

body.dark-mode tbody tr:nth-child(even) td,
body.dark-mode tr:nth-child(even) td,
body.dark-mode tr:nth-child(even) {
    background: #131c31 !important;
}

body.dark-mode tbody tr:hover td,
body.dark-mode tr:hover td,
body.dark-mode tr:hover {
    background: #1e293b !important;
}

body.dark-mode table mjx-container,
body.dark-mode table .katex,
body.dark-mode table span {
    color: inherit !important;
}

/* CẨM NANG & GUIDE ELEMENTS */
body.dark-mode .formula-card {
    background: #131b2e !important;
    border: 1px solid #334155 !important;
    border-left: 4px solid #38bdf8 !important;
    color: #f8fafc !important;
}

body.dark-mode .formula-card-title {
    color: #93c5fd !important;
}

body.dark-mode .formula-condition {
    background: #1e293b !important;
    color: #94a3b8 !important;
}

body.dark-mode .formula-note {
    color: #94a3b8 !important;
}

body.dark-mode .callout {
    background: #131b2e !important;
    border: 1px solid #334155 !important;
    border-left: 4px solid #60a5fa !important;
    color: #f8fafc !important;
}

body.dark-mode .callout-title {
    color: #60a5fa !important;
}

body.dark-mode .example-header {
    background: #1e293b !important;
    border-bottom: 1px solid #334155 !important;
    color: #34d399 !important;
}

body.dark-mode .example-content {
    background: #131b2e !important;
    color: #f8fafc !important;
}

body.dark-mode .example-problem {
    background: #0f172a !important;
    border: 1px solid #334155 !important;
    color: #f8fafc !important;
}

body.dark-mode .example-solution {
    color: #cbd5e1 !important;
}

body.dark-mode .example-step {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

body.dark-mode .example-takeaway {
    background: #1e293b !important;
    border-left: 3px solid #fbbf24 !important;
    color: #fbbf24 !important;
}

body.dark-mode .solution-result {
    background: rgba(16, 185, 129, 0.15) !important;
    border: 1px solid rgba(16, 185, 129, 0.4) !important;
    color: #6ee7b7 !important;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.1) !important;
}

body.dark-mode .solution-step {
    color: #f8fafc !important;
}

body.dark-mode .solution-step-title {
    color: #93c5fd !important;
}

body.dark-mode .casio-shortcut {
    background: #1e293b !important;
    color: #38bdf8 !important;
    border: 1px solid #334155 !important;
}

body.dark-mode .badge-winner {
    background: rgba(16, 185, 129, 0.2) !important;
    color: #34d399 !important;
    border: 1px solid rgba(16, 185, 129, 0.4) !important;
}

body.dark-mode .badge-thpt {
    background: rgba(59, 130, 246, 0.2) !important;
    color: #93c5fd !important;
    border: 1px solid rgba(59, 130, 246, 0.4) !important;
}

body.dark-mode .highlight-keyword {
    color: #60a5fa !important;
}

body.dark-mode .article-toc {
    background: #0f172a !important;
    border-color: #334155 !important;
}

body.dark-mode .article-toc li a {
    color: #94a3b8 !important;
}

body.dark-mode .article-toc li a:hover {
    color: #60a5fa !important;
}

/* KNOWLEDGE ARTICLE READER DARK MODE */
body.dark-mode .article-body {
    background: #131b2e !important;
    border: 1px solid #334155 !important;
    color: #f8fafc !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35) !important;
}

body.dark-mode .article-section-title {
    color: #60a5fa !important;
    border-bottom: 2px solid #334155 !important;
}

body.dark-mode #detail-theory-content {
    color: #e2e8f0 !important;
}

body.dark-mode #detail-theory-content p,
body.dark-mode #detail-theory-content div,
body.dark-mode #detail-theory-content li,
body.dark-mode #detail-theory-content span {
    color: #e2e8f0 !important;
}

body.dark-mode #detail-theory-content strong {
    color: #ffffff !important;
}

body.dark-mode #detail-theory-content h3,
body.dark-mode #detail-theory-content h4 {
    color: #93c5fd !important;
}

body.dark-mode #detail-prerequisites-container {
    color: #93c5fd !important;
}

body.dark-mode #detail-prerequisites-chips button {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #93c5fd !important;
}

body.dark-mode #detail-prerequisites-chips button:hover {
    background: #2563eb !important;
    color: #ffffff !important;
    border-color: #2563eb !important;
}

body.dark-mode .example-solution-accordion summary {
    color: #60a5fa !important;
}

body.dark-mode .example-solution-body {
    border-top: 1px dashed #334155 !important;
    color: #e2e8f0 !important;
}

/* EXAM PLAYER & QUESTIONS - HIGH CONTRAST & ACCESSIBLE DARK MODE */
body.dark-mode .exam-player-container {
    background: #0b0f19 !important;
    border-color: #334155 !important;
}

body.dark-mode .exam-player-topbar {
    background: #0f172a !important;
    border-bottom: 1px solid #334155 !important;
}

body.dark-mode .exam-info-group h3,
body.dark-mode #player-exam-title {
    color: #f8fafc !important;
    font-weight: 700 !important;
}

body.dark-mode .exam-progress-text,
body.dark-mode #player-progress-text {
    color: #94a3b8 !important;
}

/* Timer styles in dark mode */
body.dark-mode .timer-normal {
    background: #1e293b !important;
    color: #93c5fd !important;
    border: 1.5px solid #3b82f6 !important;
}

body.dark-mode .timer-warning {
    background: rgba(245, 158, 11, 0.2) !important;
    color: #fcd34d !important;
    border: 1.5px solid #f59e0b !important;
}

body.dark-mode .timer-critical {
    background: rgba(239, 68, 68, 0.2) !important;
    color: #fca5a5 !important;
    border: 1.5px solid #ef4444 !important;
}

body.dark-mode .player-main-layout {
    background: #0b0f19 !important;
}

body.dark-mode .player-question-section {
    background: #131b2e !important;
    border: 1px solid #334155 !important;
    color: #f8fafc !important;
}


body.dark-mode .question-top-meta {
    border-bottom: 1px solid #334155 !important;
}

body.dark-mode .q-topic-title {
    color: #cbd5e1 !important;
}

body.dark-mode .q-type-single {
    background: rgba(37, 99, 235, 0.22) !important;
    color: #93c5fd !important;
    border: 1px solid rgba(59, 130, 246, 0.45) !important;
}
body.dark-mode .q-type-tf {
    background: rgba(147, 51, 234, 0.22) !important;
    color: #c084fc !important;
    border: 1px solid rgba(168, 85, 247, 0.45) !important;
}
body.dark-mode .q-type-short {
    background: rgba(16, 185, 129, 0.22) !important;
    color: #6ee7b7 !important;
    border: 1px solid rgba(16, 185, 129, 0.45) !important;
}
body.dark-mode .q-type-drag {
    background: rgba(249, 115, 22, 0.22) !important;
    color: #fdba74 !important;
    border: 1px solid rgba(249, 115, 22, 0.45) !important;
}
body.dark-mode .q-type-step {
    background: rgba(236, 72, 153, 0.22) !important;
    color: #f472b6 !important;
    border: 1px solid rgba(236, 72, 153, 0.45) !important;
}
body.dark-mode .question-top-meta {
    border-bottom: 1px solid #334155 !important;
}

/* Question Number Badge in dark mode */
body.dark-mode .question-number-badge {
    background: rgba(59, 130, 246, 0.18) !important;
    color: #93c5fd !important;
    border: 1px solid rgba(59, 130, 246, 0.35) !important;
    border-left: 3.5px solid #60a5fa !important;
    font-weight: 800 !important;
}

body.dark-mode .question-body-text,
body.dark-mode #player-question-text {
    color: #f8fafc !important;
    line-height: 1.75 !important;
}

body.dark-mode .question-box {
    background: #0f172a !important;
    border: 1px solid #334155 !important;
    color: #f8fafc !important;
}

/* Options */
body.dark-mode .option-card {
    background: #0f172a !important;
    border: 1.5px solid #334155 !important;
    color: #f8fafc !important;
}

body.dark-mode .option-card:hover {
    background: #1e293b !important;
    border-color: #60a5fa !important;
}

body.dark-mode .option-card.selected {
    background: #1e3a8a !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(96, 165, 250, 0.25) !important;
}

body.dark-mode .option-circle {
    background: #1e293b !important;
    border: 1.5px solid #475569 !important;
    color: #cbd5e1 !important;
}

body.dark-mode .option-card:hover .option-circle {
    border-color: #60a5fa !important;
    color: #60a5fa !important;
}

body.dark-mode .option-card.selected .option-circle {
    background: #2563eb !important;
    border-color: #93c5fd !important;
    color: #ffffff !important;
    font-weight: 800 !important;
}

/* Sidebar & Question Number Cells */
body.dark-mode .player-nav-sidebar {
    background: #131b2e !important;
    border: 1px solid #334155 !important;
}

body.dark-mode .player-nav-sidebar h4 {
    color: #f8fafc !important;
}

body.dark-mode #player-answered-count {
    color: #60a5fa !important;
    font-weight: 700 !important;
}

body.dark-mode .nav-legend {
    background: #0f172a !important;
    border: 1px solid #334155 !important;
    color: #94a3b8 !important;
}

body.dark-mode .nav-legend-item {
    color: #cbd5e1 !important;
}

/* High contrast Question Number cells */
body.dark-mode .nav-cell-btn {
    background: #1e293b !important;
    border: 1.5px solid #475569 !important;
    color: #f1f5f9 !important;
    font-size: 13px !important;
    font-weight: 700 !important;
}

body.dark-mode .nav-cell-btn:hover {
    border-color: #60a5fa !important;
    background: #334155 !important;
    color: #ffffff !important;
}

body.dark-mode .nav-cell-btn.answered,
body.dark-mode .nav-cell-btn.status-answered {
    background: rgba(16, 185, 129, 0.22) !important;
    border: 1.5px solid #10b981 !important;
    color: #34d399 !important;
    font-weight: 800 !important;
}

body.dark-mode .nav-cell-btn.status-flagged {
    background: rgba(245, 158, 11, 0.22) !important;
    border: 1.5px solid #f59e0b !important;
    color: #fbbf24 !important;
    font-weight: 800 !important;
}

body.dark-mode .nav-cell-btn.current,
body.dark-mode .nav-cell-btn.status-current {
    background: #2563eb !important;
    border: 2px solid #93c5fd !important;
    color: #ffffff !important;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.7) !important;
    font-weight: 800 !important;
}

body.dark-mode .question-flag-btn {
    background: #1e293b !important;
    border: 1px solid #475569 !important;
    color: #cbd5e1 !important;
}

body.dark-mode .question-flag-btn:hover {
    background: rgba(245, 158, 11, 0.2) !important;
    border-color: #f59e0b !important;
    color: #fbbf24 !important;
}

body.dark-mode .question-flag-btn.flagged {
    background: rgba(245, 158, 11, 0.28) !important;
    border-color: #f59e0b !important;
    color: #fbbf24 !important;
    font-weight: 700 !important;
}

body.dark-mode .player-bottom-controls .btn-outline {
    background: #1e293b !important;
    border: 1px solid #475569 !important;
    color: #e2e8f0 !important;
}

body.dark-mode .player-bottom-controls .btn-outline:hover:not(:disabled) {
    border-color: #60a5fa !important;
    background: #334155 !important;
    color: #60a5fa !important;
}

body.dark-mode .player-bottom-controls .btn-outline:disabled {
    opacity: 0.4 !important;
    cursor: not-allowed !important;
}

body.dark-mode .player-keyboard-guide {
    background: #0f172a !important;
    border: 1px solid #334155 !important;
    color: #94a3b8 !important;
}

body.dark-mode .kb-chip {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    color: #93c5fd !important;
}

/* QBANK & QUESTION INTERACTIVE CARDS */
body.dark-mode .tf-item-card {
    background: #0f172a !important;
    border: 1.5px solid #334155 !important;
    color: #f8fafc !important;
}

body.dark-mode .tf-item-card:hover {
    border-color: #475569 !important;
    background: #141f36 !important;
}

body.dark-mode .tf-item-card.tf-item-answered {
    border-color: #3b82f6 !important;
    border-left: 4px solid #3b82f6 !important;
    background: #111d35 !important;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.15);
}

body.dark-mode .tf-item-label {
    background: #1e293b !important;
    color: #60a5fa !important;
    border: 1px solid #3b82f6 !important;
}

body.dark-mode .tf-item-text {
    color: #f1f5f9 !important;
}

body.dark-mode .tf-item-status-pill.status-empty {
    color: #94a3b8 !important;
    background: #1e293b !important;
    border: 1px solid #475569 !important;
}

body.dark-mode .tf-item-status-pill.status-true {
    color: #34d399 !important;
    background: rgba(16, 185, 129, 0.2) !important;
    border: 1px solid rgba(16, 185, 129, 0.45) !important;
}

body.dark-mode .tf-item-status-pill.status-false {
    color: #f87171 !important;
    background: rgba(239, 68, 68, 0.2) !important;
    border: 1px solid rgba(239, 68, 68, 0.45) !important;
}

body.dark-mode .tf-btn {
    background: #1e293b;
    border: 1.5px solid #475569;
    color: #cbd5e1;
}

body.dark-mode .tf-btn:hover {
    border-color: #94a3b8 !important;
    background: #334155 !important;
    color: #ffffff !important;
}

body.dark-mode .tf-btn.active-true {
    background: #059669 !important;
    border: 2px solid #34d399 !important;
    color: #ffffff !important;
    font-weight: 800 !important;
    box-shadow: 0 0 14px rgba(16, 185, 129, 0.55) !important;
}

body.dark-mode .tf-btn.active-false {
    background: #dc2626 !important;
    border: 2px solid #f87171 !important;
    color: #ffffff !important;
    font-weight: 800 !important;
    box-shadow: 0 0 14px rgba(239, 68, 68, 0.55) !important;
}

body.dark-mode .short-answer-wrapper {
    background: #0f172a !important;
    border: 1px solid #334155 !important;
}

body.dark-mode .short-answer-input {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #93c5fd !important;
}

body.dark-mode .math-pad-btn {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    color: #93c5fd !important;
}

body.dark-mode .math-pad-btn:hover {
    background: #2563eb !important;
    color: #ffffff !important;
}

body.dark-mode .step-item-block {
    background: #0f172a !important;
    border: 1px solid #334155 !important;
    color: #f8fafc !important;
}

body.dark-mode .explanation-card {
    background: #0f172a !important;
    border: 1px solid #334155 !important;
    color: #f8fafc !important;
}

/* FILTER PILLS, TABS, INPUTS & MODALS */
body.dark-mode .search-input,
body.dark-mode .filter-select,
body.dark-mode .auth-form-input {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

body.dark-mode .search-input:focus,
body.dark-mode .filter-select:focus,
body.dark-mode .auth-form-input:focus {
    border-color: #60a5fa !important;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2) !important;
}

body.dark-mode .filter-pill {
    background: #0f172a !important;
    border: 1px solid #334155 !important;
    color: #94a3b8 !important;
}

body.dark-mode .filter-pill:hover {
    background: #1e293b !important;
    border-color: #60a5fa !important;
    color: #60a5fa !important;
}

body.dark-mode .filter-pill.active {
    background: #2563eb !important;
    border-color: #2563eb !important;
    color: #ffffff !important;
}

body.dark-mode .stream-tab-btn {
    background: #0f172a !important;
    border: 1px solid #334155 !important;
    color: #94a3b8 !important;
}

body.dark-mode .stream-tab-btn:hover {
    background: #1e293b !important;
    color: #60a5fa !important;
}

body.dark-mode .stream-tab-btn.active {
    background: #2563eb !important;
    border-color: #2563eb !important;
    color: #ffffff !important;
}

body.dark-mode .modal-content,
body.dark-mode .auth-card,
body.dark-mode .admin-modal-card {
    background: #131b2e !important;
    border-color: #475569 !important;
    color: #f8fafc !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8) !important;
}

body.dark-mode .user-sync-status-badge {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #94a3b8 !important;
}

body.dark-mode .readiness-circle::before {
    background: #131b2e !important;
}

body.dark-mode .learning-path-box {
    background: linear-gradient(135deg, #131b2e, #0f172a) !important;
    border-color: #334155 !important;
}

/* SMART PRACTICE & ADAPTIVE ENGINE DARK THEME POLISH */
body.dark-mode .adaptive-engine-card,
body.dark-mode .smart-drill-card,
body.dark-mode .error-breakdown-card,
body.dark-mode .learning-path-step,
body.dark-mode .learning-step-card {
    background: #131b2e !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

.adaptive-feedback-correct {
    background: #ecfdf5;
    border: 1px solid #10b981;
    color: #065f46;
}

.adaptive-feedback-wrong {
    background: #fef2f2;
    border: 1px solid #ef4444;
    color: #991b1b;
}

body.dark-mode .adaptive-feedback-correct {
    background: rgba(16, 185, 129, 0.15) !important;
    border: 1px solid #10b981 !important;
    color: #34d399 !important;
}

body.dark-mode .adaptive-feedback-wrong {
    background: rgba(239, 68, 68, 0.15) !important;
    border: 1px solid #ef4444 !important;
    color: #f87171 !important;
}

body.dark-mode .smart-topic-row {
    border-bottom-color: #1e293b !important;
    color: #f8fafc !important;
}

body.dark-mode .smart-topic-row span,
body.dark-mode .smart-topic-row strong {
    color: #f8fafc !important;
}

body.dark-mode .learning-step-title {
    color: #93c5fd !important;
}

body.dark-mode .learning-step-desc {
    color: #94a3b8 !important;
}

body.dark-mode .learning-step-badge {
    background: #2563eb !important;
    color: #ffffff !important;
}

/* EXAM REVIEW ANSWER CONTAINERS */
body.dark-mode .review-answer-box {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

body.dark-mode .review-answer-box table {
    background: #0f172a !important;
    border-color: #334155 !important;
}

body.dark-mode .review-answer-box th {
    background: #1e293b !important;
    color: #93c5fd !important;
    border-bottom-color: #334155 !important;
}

body.dark-mode .review-answer-box td {
    border-bottom-color: #1e293b !important;
    color: #f8fafc !important;
}

body.dark-mode .review-ans-correct,
body.dark-mode .review-opt-correct {
    background: rgba(16, 185, 129, 0.15) !important;
    border-color: #10b981 !important;
    color: #34d399 !important;
}

body.dark-mode .review-ans-wrong,
body.dark-mode .review-opt-wrong {
    background: rgba(239, 68, 68, 0.15) !important;
    border-color: #ef4444 !important;
    color: #f87171 !important;
}

body.dark-mode .review-opt-card {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

body.dark-mode .review-student-note {
    background: #0f172a !important;
    border: 1px solid #334155 !important;
    color: #cbd5e1 !important;
}

/* COMMON TRAPS, APPLICATIONS & MODALS */
body.dark-mode .common-traps-box {
    background: rgba(245, 158, 11, 0.12) !important;
    border: 1px solid rgba(245, 158, 11, 0.35) !important;
    border-radius: 8px !important;
    padding: 14px 18px !important;
    color: #fef08a !important;
}

body.dark-mode .common-traps-box h4,
body.dark-mode .common-traps-box strong {
    color: #fbbf24 !important;
}

body.dark-mode .common-traps-box ul,
body.dark-mode .common-traps-box li {
    color: #fde047 !important;
}

body.dark-mode #detail-applications-content {
    background: #0f172a !important;
    border-color: #1e3a8a !important;
    color: #93c5fd !important;
}

body.dark-mode #detail-article-overview {
    background: #0f172a !important;
    border-left-color: #38bdf8 !important;
    color: #cbd5e1 !important;
}

body.dark-mode #sec-practice {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

body.dark-mode .modal-info-box,
body.dark-mode #submit-stat-preview {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

.step-solution-helper {
    background: #eff6ff;
    border-left: 3px solid var(--primary, #2563eb);
    color: var(--text-muted, #64748b);
}

body.dark-mode .step-solution-helper {
    background: #0f172a !important;
    border-left-color: #38bdf8 !important;
    color: #94a3b8 !important;
}

.qbank-pagination-bar {
    background: #ffffff;
    border: 1px solid #e2e8f0;
}

body.dark-mode .qbank-pagination-bar {
    background: #131b2e !important;
    border-color: #334155 !important;
}

.qbank-pagination-bar span {
    color: #475569;
}

body.dark-mode .qbank-pagination-bar span {
    color: #93c5fd !important;
}

.qbank-empty-state {
    background: #ffffff;
    border: 1px dashed #cbd5e1;
    color: var(--text-muted);
}

body.dark-mode .qbank-empty-state {
    background: #131b2e !important;
    border: 1px dashed #334155 !important;
    color: #94a3b8 !important;
}

.btn-tutor-ask {
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffcc80;
    font-weight: 700;
}

body.dark-mode .btn-tutor-ask {
    background: #3b1d11 !important;
    color: #fdba74 !important;
    border-color: #9a3412 !important;
}

.formula-takeaway {
    margin-top: 10px;
    padding: 8px 12px;
    background: #f0fdf4;
    border-left: 3px solid #16a34a;
    border-radius: 4px;
    font-size: 13px;
    color: #166534;
}

body.dark-mode .formula-takeaway {
    background: rgba(16, 185, 129, 0.15) !important;
    border-left-color: #10b981 !important;
    color: #6ee7b7 !important;
}

.qbank-drag-pill {
    border-radius: 6px;
    background: #fdf4ff;
    border: 1px solid #f0abfc;
    color: #a21caf;
}

body.dark-mode .qbank-drag-pill {
    background: rgba(168, 85, 247, 0.15) !important;
    border-color: rgba(168, 85, 247, 0.35) !important;
    color: #d8b4fe !important;
}

.badge-type-label {
    background: #f1f5f9;
    color: #475569;
}

body.dark-mode .badge-type-label {
    background: #1e293b !important;
    color: #94a3b8 !important;
}

.badge-warning {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
}

body.dark-mode .badge-warning {
    background: rgba(245, 158, 11, 0.15) !important;
    color: #fbbf24 !important;
    border-color: rgba(245, 158, 11, 0.3) !important;
}

body.dark-mode .badge-skipped {
    background: #1e293b !important;
    color: #94a3b8 !important;
}

body.dark-mode #skill-trend-badge {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #93c5fd !important;
}

/* ADMIN PANEL */
body.dark-mode .admin-card {
    background: #131b2e !important;
    border: 1px solid #334155 !important;
    color: #f8fafc !important;
}

body.dark-mode .admin-table {
    background: #0f172a !important;
    border-color: #334155 !important;
}

body.dark-mode .admin-input,
body.dark-mode .admin-textarea {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

/* UNIVERSAL FORMULA AND KATEX HARMONY */
body.dark-mode .katex,
body.dark-mode .katex-display {
    color: inherit !important;
}

body.dark-mode .formula-math-box mjx-container,
body.dark-mode .formula-latex-box mjx-container,
body.dark-mode .formula-display mjx-container {
    color: #93c5fd !important;
}

/* ==========================================================================
   PUBLIC DATA REPOSITORY & OPEN DATA HUB STYLES
   ========================================================================== */
.data-stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.data-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.data-stat-card .stat-icon {
    font-size: 26px;
}

.data-stat-card .stat-info {
    flex: 1;
}

.data-stat-card .stat-label {
    font-size: 11.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
}

.data-stat-card .stat-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.badge-status-ok {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    background: #dcfce7;
    color: #15803d;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 700;
}

body.dark-mode .badge-status-ok {
    background: #064e3b !important;
    color: #6ee7b7 !important;
}

.data-privacy-notice {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 28px;
}

body.dark-mode .data-privacy-notice {
    background: #06281e !important;
    border-color: #047857 !important;
}

.notice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-weight: 700;
    font-size: 14px;
    color: #166534;
}

body.dark-mode .notice-header {
    color: #6ee7b7 !important;
}

.notice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-main);
}

.data-section {
    margin-bottom: 36px;
}

.section-title-wrap {
    margin-bottom: 16px;
}

.section-title-wrap h3 {
    color: var(--primary);
    font-size: 19px;
    margin: 0 0 4px 0;
}

.section-title-wrap p {
    font-size: 13.5px;
    color: var(--text-muted);
    margin: 0;
}

.data-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 18px;
}

.dataset-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
    transition: transform 0.2s, box-shadow 0.2s;
}

.dataset-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}

.dataset-card-highlight {
    border: 2px solid var(--primary);
    background: linear-gradient(180deg, rgba(234, 88, 12, 0.04) 0%, var(--bg-card) 100%);
}

body.dark-mode .dataset-card-highlight {
    background: linear-gradient(180deg, rgba(234, 88, 12, 0.12) 0%, #131b2e 100%) !important;
}

.dataset-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.dataset-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 700;
}

.badge-bundle { background: #ffedd5; color: #c2410c; }
.badge-q { background: #dbeafe; color: #1e40af; }
.badge-e { background: #fef3c7; color: #b45309; }
.badge-k { background: #e0e7ff; color: #4338ca; }
.badge-f { background: #fce7f3; color: #be185d; }
.badge-t { background: #ede9fe; color: #6d28d9; }

body.dark-mode .badge-bundle { background: #431407 !important; color: #fdba74 !important; }
body.dark-mode .badge-q { background: #1e293b !important; color: #93c5fd !important; }
body.dark-mode .badge-e { background: #451a03 !important; color: #fcd34d !important; }
body.dark-mode .badge-k { background: #1e1b4b !important; color: #c7d2fe !important; }
body.dark-mode .badge-f { background: #500724 !important; color: #fbcfe8 !important; }
body.dark-mode .badge-t { background: #2e1065 !important; color: #ddd6fe !important; }

.dataset-format {
    font-size: 12px;
    color: var(--text-muted);
    font-family: monospace;
}

.dataset-title {
    color: var(--primary);
    font-size: 16px;
    margin: 0 0 8px 0;
    line-height: 1.35;
}

.dataset-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.55;
    margin: 0 0 16px 0;
    flex: 1;
}

.dataset-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.sub-downloads {
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px dashed var(--border-color);
    padding-top: 8px;
    margin-top: 4px;
}

.sub-downloads a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.sub-downloads a:hover {
    text-decoration: underline;
}

/* Endpoint Table */
.endpoint-source-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.source-tab-btn {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.source-tab-btn.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.endpoint-table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow-x: auto;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.endpoint-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.endpoint-table th {
    background: rgba(0,0,0,0.02);
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

body.dark-mode .endpoint-table th {
    background: rgba(255,255,255,0.03) !important;
}

.endpoint-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

body.dark-mode .endpoint-table td {
    border-bottom-color: #334155 !important;
}

.endpoint-table tr:last-child td {
    border-bottom: none;
}

.endpoint-table code {
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', monospace;
    font-size: 12px;
    color: var(--primary);
}

/* Code Snippets */
.code-snippets-wrapper {
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

.code-lang-tabs {
    display: flex;
    background: rgba(0,0,0,0.04);
    border-bottom: 1px solid var(--border-color);
    padding: 4px 8px;
    gap: 4px;
    overflow-x: auto;
}

body.dark-mode .code-lang-tabs {
    background: rgba(0,0,0,0.3) !important;
}

.code-lang-tab {
    padding: 6px 14px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
}

.code-lang-tab.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.code-snippet-body {
    position: relative;
    padding: 16px;
}

.code-snippet-body pre {
    margin: 0;
    font-family: 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-main);
    overflow-x: auto;
}

.btn-copy-code {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 12px;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.btn-copy-code:hover {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.schema-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.schema-card h5 {
    color: var(--primary);
    font-size: 14.5px;
    margin: 0 0 6px 0;
}

.schema-card p {
    font-size: 12.5px;
    color: var(--text-muted);
    margin: 0 0 12px 0;
    line-height: 1.45;
}

/* V2 Skill Profile, Question DNA, & Error Engine Styles */
.dashboard-skill-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}

.skill-card {
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    padding: 14px 16px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.skill-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.dna-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11.5px;
    padding: 2px 7px;
    border-radius: 4px;
    background: #f1f5f9;
    color: #334155;
    font-weight: 500;
}

.dna-pill-cognitive {
    background: #eef2ff;
    color: #4338ca;
    font-weight: 600;
}

.error-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--card-bg, #f8fafc);
    border: 1px solid var(--border-color, #e2e8f0);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12.5px;
    color: var(--text-main, #1e293b);
}

body.dark-mode .skill-card,
body.dark-mode .skill-analysis-card,
body.dark-mode .error-pill {
    background: var(--card-bg, #131b2e) !important;
    border-color: var(--border-color, #334155) !important;
    color: var(--text-main, #f8fafc) !important;
}

body.dark-mode .dna-pill {
    background: #1e293b;
    color: #cbd5e1;
}

body.dark-mode .dna-pill-cognitive {
    background: #312e81;
    color: #c7d2fe;
}

    
/* ==========================================================================
   PUMKIN TOAST & NOTIFICATION SYSTEM
   ========================================================================== */
.pumkin-toast-container {
    position: fixed;
    top: 76px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: 380px;
    width: calc(100% - 40px);
}

.pumkin-toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 13px 16px;
    border-radius: 10px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    font-size: 13.5px;
    color: var(--text-main);
    pointer-events: auto;
    animation: pumkinToastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    transition: opacity 0.25s ease, transform 0.25s ease;
    word-break: break-word;
}

.pumkin-toast.toast-exit {
    opacity: 0;
    transform: translateX(40px) scale(0.95);
}

.pumkin-toast-icon {
    font-size: 18px;
    line-height: 1.2;
    flex-shrink: 0;
}

.pumkin-toast-body {
    flex: 1;
    line-height: 1.45;
    font-weight: 500;
}

.pumkin-toast-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
    padding: 2px;
    border-radius: 4px;
    opacity: 0.7;
    transition: opacity 0.15s, background 0.15s;
}

.pumkin-toast-close:hover {
    opacity: 1;
    background: var(--card-bg-subtle);
}

.pumkin-toast.toast-success {
    border-left: 4px solid var(--success);
    background: var(--success-bg);
}

.pumkin-toast.toast-error {
    border-left: 4px solid var(--danger);
    background: var(--danger-bg);
}

.pumkin-toast.toast-warning {
    border-left: 4px solid var(--warning);
    background: var(--warning-bg);
}

.pumkin-toast.toast-info {
    border-left: 4px solid var(--primary-light);
    background: var(--primary-bg);
}

body.dark-mode .pumkin-toast {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

body.dark-mode .pumkin-toast.toast-success {
    background: rgba(5, 150, 105, 0.18);
    border-color: rgba(5, 150, 105, 0.4);
    color: #a7f3d0;
}

body.dark-mode .pumkin-toast.toast-error {
    background: rgba(220, 38, 38, 0.18);
    border-color: rgba(220, 38, 38, 0.4);
    color: #fecaca;
}

body.dark-mode .pumkin-toast.toast-warning {
    background: rgba(217, 119, 6, 0.18);
    border-color: rgba(217, 119, 6, 0.4);
    color: #fde68a;
}

body.dark-mode .pumkin-toast.toast-info {
    background: rgba(59, 130, 246, 0.18);
    border-color: rgba(59, 130, 246, 0.4);
    color: #bfdbfe;
}

@keyframes pumkinToastIn {
    from { opacity: 0; transform: translateY(-10px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==========================================================================
   PUMKIN CUSTOM CONFIRM MODAL (WCAG 2.1 Accessible Replacement)
   ========================================================================== */
.pumkin-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 10005;
    background: var(--modal-overlay);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: fadeIn 0.15s ease;
}

.pumkin-confirm-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px 28px;
    max-width: 440px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    text-align: center;
    animation: pumkinModalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pumkinModalPop {
    from { opacity: 0; transform: scale(0.94); }
    to { opacity: 1; transform: scale(1); }
}

.pumkin-confirm-icon {
    font-size: 38px;
    margin-bottom: 12px;
    line-height: 1;
}

.pumkin-confirm-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
}

.pumkin-confirm-msg {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 22px;
    line-height: 1.55;
}

.pumkin-confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.pumkin-confirm-actions button {
    padding: 9px 20px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.18s ease;
}

.pumkin-confirm-cancel {
    background: var(--card-bg-subtle);
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.pumkin-confirm-cancel:hover {
    background: var(--border-color);
}

.pumkin-confirm-ok {
    background: var(--primary);
    border: 1px solid var(--primary);
    color: #ffffff;
}

.pumkin-confirm-ok:hover {
    opacity: 0.92;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.pumkin-confirm-ok.danger {
    background: var(--danger);
    border-color: var(--danger);
}

.pumkin-confirm-ok.danger:hover {
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.35);
}

/* ==========================================================================
   ACCESSIBILITY (a11y): Skip to Content & Focus-Visible Rings
   ========================================================================== */
.skip-to-content {
    position: absolute;
    top: -120px;
    left: 12px;
    background: var(--primary);
    color: #ffffff;
    padding: 10px 18px;
    border-radius: 0 0 8px 8px;
    font-weight: 700;
    font-size: 13.5px;
    z-index: 10010;
    text-decoration: none;
    box-shadow: var(--shadow-md);
    transition: top 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.skip-to-content:focus {
    top: 0;
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
}

/* Accessible focus visible rings for all interactive elements */
:focus-visible {
    outline: 2px solid var(--primary-light) !important;
    outline-offset: 2px !important;
}

/* ==========================================================================
   RESPONSIVE POLISH & MOBILE UX OPTIMIZATION (PUMKIN.DEV MOBILE ENGINE)
   ========================================================================== */

/* ==========================================================================
   3-STEP JOURNEY FLOW & FOCUSED 1-CTA DASHBOARD HERO CARD
   ========================================================================== */
.journey-hero-card {
    background: var(--bg-card, #ffffff);
    border: 1.5px solid var(--border-color, #e2e8f0);
    border-radius: 16px;
    padding: 28px 24px;
    margin: 18px 0 20px 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.journey-hero-card.state-new {
    border-left: 6px solid var(--primary, #1e3a8a);
    background: linear-gradient(180deg, rgba(239, 246, 255, 0.5) 0%, var(--bg-card, #ffffff) 100%);
}

.journey-hero-card.state-daily-focus {
    border-left: 6px solid #f59e0b;
    background: linear-gradient(180deg, rgba(254, 243, 199, 0.35) 0%, var(--bg-card, #ffffff) 100%);
}

.journey-hero-card.state-free-explore {
    border-left: 6px solid var(--success, #10b981);
    background: linear-gradient(180deg, rgba(209, 250, 229, 0.35) 0%, var(--bg-card, #ffffff) 100%);
}

.journey-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 5px 12px;
    border-radius: 20px;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    margin-bottom: 8px;
}

.journey-badge-pill.active {
    background: #fffbeb;
    color: #b45309;
    border-color: #fde68a;
}

.journey-badge-pill.completed {
    background: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
}

.journey-est-time {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-muted, #64748b);
}

.journey-title {
    font-size: 21px;
    font-weight: 800;
    color: var(--text-color, #0f172a);
    margin: 10px 0 8px 0;
    line-height: 1.35;
}

.journey-desc {
    font-size: 14.5px;
    color: var(--text-muted, #475569);
    line-height: 1.6;
    margin: 0 0 16px 0;
}

.journey-benefits-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 16px 0 20px 0;
}

.benefit-item {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-color, #334155);
    background: var(--bg-hover, #f8fafc);
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color, #e2e8f0);
}

.journey-reason-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #fffbeb;
    border: 1px solid #fef3c7;
    border-radius: 10px;
    padding: 12px 16px;
    margin: 14px 0 18px 0;
}

.reason-icon {
    font-size: 20px;
    line-height: 1.2;
}

.reason-text {
    font-size: 13.5px;
    color: #92400e;
    line-height: 1.55;
    font-weight: 600;
}

.journey-progress-container {
    margin: 16px 0 20px 0;
}

.journey-cta-wrapper {
    margin: 20px 0 12px 0;
}

/* THE SACRED SINGLE PRIMARY CTA BUTTON */
.btn-cta-primary {
    width: 100%;
    min-height: 52px;
    padding: 14px 24px;
    font-size: 15.5px;
    font-weight: 800;
    letter-spacing: 0.3px;
    color: #ffffff !important;
    background: linear-gradient(135deg, var(--primary, #1e3a8a) 0%, #2563eb 100%) !important;
    border: none !important;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: inline-flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    text-decoration: none;
}

.btn-cta-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
    filter: brightness(1.05);
}

.btn-cta-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.journey-escape-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.btn-text-link {
    background: none;
    border: none;
    color: var(--text-muted, #64748b);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    padding: 8px 12px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    transition: color 0.2s;
}

.btn-text-link:hover {
    color: var(--primary, #1e3a8a);
}

.quick-doors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin: 20px 0 12px 0;
}

.quick-door-card {
    background: var(--bg-hover, #f8fafc);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 12px;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    min-height: 80px;
}

.quick-door-card:hover {
    border-color: var(--primary-light, #3b82f6);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
    background: #ffffff;
}

.door-icon {
    font-size: 24px;
    margin-bottom: 6px;
    line-height: 1;
}

.door-title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-color, #0f172a);
    margin-bottom: 2px;
}

.door-sub {
    font-size: 11.5px;
    color: var(--text-muted, #64748b);
    line-height: 1.35;
}

/* Dark Mode Harmonization */
[data-theme="dark"] .journey-hero-card {
    background: var(--bg-card, #1e293b);
    border-color: #334155;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .journey-hero-card.state-new {
    background: linear-gradient(180deg, rgba(30, 58, 138, 0.25) 0%, var(--bg-card, #1e293b) 100%);
}

[data-theme="dark"] .journey-hero-card.state-daily-focus {
    background: linear-gradient(180deg, rgba(217, 119, 6, 0.15) 0%, var(--bg-card, #1e293b) 100%);
}

[data-theme="dark"] .journey-hero-card.state-free-explore {
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.15) 0%, var(--bg-card, #1e293b) 100%);
}

[data-theme="dark"] .journey-reason-box {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.3);
}

[data-theme="dark"] .journey-reason-box .reason-text {
    color: #fde68a;
}

[data-theme="dark"] .benefit-item {
    background: rgba(30, 41, 59, 0.7);
    border-color: #334155;
    color: #cbd5e1;
}

[data-theme="dark"] .quick-door-card {
    background: rgba(30, 41, 59, 0.7);
    border-color: #334155;
}

[data-theme="dark"] .quick-door-card:hover {
    background: #1e293b;
    border-color: var(--primary-light, #60a5fa);
}

[data-theme="dark"] .door-title {
    color: #f8fafc;
}

/* Mobile Polish */
@media (max-width: 640px) {
    .journey-hero-card {
        padding: 20px 16px;
        margin: 12px 0 16px 0;
        border-radius: 12px;
    }

    .journey-title {
        font-size: 18px;
    }

    .journey-desc {
        font-size: 13.5px;
    }

    .btn-cta-primary {
        font-size: 14.5px;
        min-height: 50px;
        padding: 12px 18px;
    }

    .quick-doors-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .quick-door-card {
        padding: 12px 10px;
    }
}

/* ==========================================================================
   Quick Utility Strip (Option 1 - Dashboard Shortcuts)
   ========================================================================== */
.dashboard-quick-shortcuts {
    margin: 18px 0 20px 0;
    width: 100%;
}

.quick-shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    width: 100%;
}

.quick-shortcut-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    min-height: 52px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    font-family: inherit;
    width: 100%;
}

.quick-shortcut-btn:hover {
    border-color: var(--primary, #1e3a8a);
    background: #f8fafc;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.08);
}

.quick-shortcut-btn:focus-visible {
    outline: 2px solid var(--primary, #1e3a8a);
    outline-offset: 2px;
}

.quick-shortcut-btn:active {
    transform: translateY(0);
}

.shortcut-icon {
    font-size: 24px;
    line-height: 1;
    flex-shrink: 0;
}

.shortcut-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.shortcut-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
}

.shortcut-title strong {
    color: var(--primary, #1e3a8a);
}

.shortcut-desc {
    font-size: 11.5px;
    color: #475569;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Dark mode */
[data-theme="dark"] .quick-shortcut-btn {
    background: rgba(30, 41, 59, 0.7);
    border-color: #334155;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .quick-shortcut-btn:hover {
    background: #1e293b;
    border-color: var(--primary-light, #60a5fa);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .shortcut-title {
    color: #f8fafc;
}

[data-theme="dark"] .shortcut-title strong {
    color: var(--primary-light, #60a5fa);
}

[data-theme="dark"] .shortcut-desc {
    color: #94a3b8;
}

@media (max-width: 768px) {
    .quick-shortcuts-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .quick-shortcut-btn {
        min-height: 48px;
        padding: 10px 14px;
    }
}


