/* ========================================================
   SMP - LaTeX-OCR (Math Vision) Styles - v2
   Responsive, Dark/Light Mode, Embed-Friendly
   ======================================================== */

body {
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    font-family: 'JetBrains Mono', monospace;
    background-color: var(--body-bg);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

button, input, textarea, select {
    font-family: 'JetBrains Mono', monospace;
}

/* ── Light Mode (Default) ── */
:root, body:not(.dark-mode) {
    --body-bg: #f8fafc;
    --panel-bg: #ffffff;
    --panel-border: #e2e8f0;
    --panel-header-bg: #f1f5f9;
    --title-color: #0f172a;
    --text-color: #334155;
    --text-muted: #64748b;
    --accent-cyan: #009eb3;
    --accent-purple: #7c3aed;
    --pane-btn-bg: rgba(0, 158, 179, 0.08);
    --pane-btn-border: rgba(0, 158, 179, 0.25);
    --pane-btn-color: #008194;
    --drop-bg: rgba(0, 158, 179, 0.02);
    --drop-border: rgba(0, 158, 179, 0.3);
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
    --divider-color: #e2e8f0;
    --badge-bg: #f1f5f9;
    --badge-border: #cbd5e1;
    --badge-text: #475569;
    --widget-title-color: #1e293b;
    --widget-link-color: #64748b;
    --widget-badge-bg: rgba(0, 0, 0, 0.05);
    --widget-badge-color: #475569;
    --border-light: rgba(15, 23, 42, 0.08);
    --exam-title-color: #1e293b;
    --exam-text-color: #334155;
    --exam-divider-color: rgba(15, 23, 42, 0.08);
}

/* ── Dark Mode ── */
body.dark-mode {
    --body-bg: #0b1111;
    --panel-bg: rgba(255, 255, 255, 0.025);
    --panel-border: rgba(92, 225, 230, 0.12);
    --panel-header-bg: rgba(255, 255, 255, 0.035);
    --title-color: #f0f0f0;
    --text-color: #ddd;
    --text-muted: #888;
    --accent-cyan: #5ce1e6;
    --accent-purple: #a78bfa;
    --pane-btn-bg: rgba(92, 225, 230, 0.09);
    --pane-btn-border: rgba(92, 225, 230, 0.22);
    --pane-btn-color: #5ce1e6;
    --drop-bg: rgba(92, 225, 230, 0.02);
    --drop-border: rgba(92, 225, 230, 0.25);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --divider-color: rgba(92, 225, 230, 0.1);
    --badge-bg: rgba(255, 255, 255, 0.04);
    --badge-border: rgba(255, 255, 255, 0.1);
    --badge-text: #aaa;
    --widget-title-color: #fff;
    --widget-link-color: #888;
    --widget-badge-bg: rgba(255, 255, 255, 0.05);
    --widget-badge-color: #aaa;
    --border-light: rgba(255, 255, 255, 0.1);
    --exam-title-color: #f0f0f0;
    --exam-text-color: #ddd;
    --exam-divider-color: rgba(92, 225, 230, 0.1);
}

/* ── Base Layout ── */
.main-wrapper {
    position: relative;
    max-width: 2000px !important;
    width: 100% !important;
    margin: 0 auto !important;
    transform: none !important;
    left: 0 !important;
    transition: transform 0s !important;
}

.main-content-layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 36px;
    margin-top: 20px;
    min-width: 0;
}

.tags-comment-sidebar {
    display: flex;
    flex-direction: column;
    gap: 36px;
    position: sticky;
    top: 100px;
    height: fit-content;
    z-index: 1;
}

.side-widget-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    color: var(--widget-title-color);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: color 0.3s ease;
}

body.light-mode .side-widget-title,
body:not(.dark-mode) .side-widget-title {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.side-widget-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.side-widget-list a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--widget-link-color);
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.side-widget-list a:hover {
    color: var(--accent-cyan);
    transform: translateX(4px);
}

.side-widget-list a span {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    background: var(--widget-badge-bg);
    padding: 2px 8px;
    border-radius: 12px;
    color: var(--widget-badge-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

@media (max-width: 1100px) {
    .main-content-layout {
        grid-template-columns: 1fr;
    }
    .tags-comment-sidebar {
        display: none;
    }
}

.main-articles-body {
    min-width: 0;
    width: 100%;
    overflow: hidden;
}

/* ── Breadcrumb & Back button ── */
.exam-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--accent-cyan, #5ce1e6);
    text-decoration: none;
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 22px;
    opacity: 0.65;
    transition: opacity 0.2s;
}
.exam-back-btn:hover {
    opacity: 1;
}

.exam-meta {
    display: flex;
    gap: 10px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}
.exam-tag {
    font-size: 0.7rem;
    font-family: 'JetBrains Mono', monospace;
    padding: 4px 13px;
    border-radius: 20px;
    border: 1px solid rgba(92, 225, 230, 0.35);
    color: var(--accent-cyan, #5ce1e6);
    background: rgba(92, 225, 230, 0.06);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ── Hero Header ── */
.latex-hero {
    margin-bottom: 22px;
}
.latex-hero h1 {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    color: var(--exam-title-color, var(--title-color));
    margin: 0 0 5px 0;
    line-height: 1.3;
}
.latex-hero p {
    font-size: 0.85rem;
    color: var(--exam-text-color, var(--text-muted));
    opacity: 0.7;
    margin: 0;
    line-height: 1.6;
    font-family: 'JetBrains Mono', monospace;
}
.latex-hero kbd {
    background: var(--badge-bg);
    border: 1px solid var(--badge-border);
    color: var(--accent-cyan);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
}

/* ── OCR Workspace Layout (2 Cột Đều) ── */
.ocr-workspace {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    width: 100%;
    margin-bottom: 20px;
    box-sizing: border-box;
}

@media (max-width: 820px) {
    .ocr-workspace {
        grid-template-columns: 1fr;
    }
}

.ocr-pane {
    display: flex;
    flex-direction: column;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    overflow: hidden;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

/* ── Pane Header ── */
.pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--panel-header-bg);
    border-bottom: 1px solid var(--panel-border);
    padding: 10px 16px;
    box-sizing: border-box;
}

.pane-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.74rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--accent-cyan);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
}

.pane-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.pane-btn {
    background: var(--pane-btn-bg);
    border: 1px solid var(--pane-btn-border);
    border-radius: 5px;
    padding: 5px 12px;
    color: var(--pane-btn-color);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.70rem;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.pane-btn:hover {
    background: var(--accent-cyan);
    color: #fff;
    border-color: var(--accent-cyan);
}
.pane-btn.active {
    background: var(--accent-cyan);
    color: #fff;
    font-weight: 600;
    border-color: var(--accent-cyan);
}
.pane-btn.danger {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.25);
    color: #ef4444;
}
.pane-btn.danger:hover {
    background: #ef4444;
    color: #fff;
}

/* ── Pane Body ── */
.ocr-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 380px;
    position: relative;
    box-sizing: border-box;
}

/* ── Drop Zone ── */
.drop-zone {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    border: 2px dashed var(--drop-border);
    margin: 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
    background: var(--drop-bg);
    text-align: center;
    position: relative;
    min-height: 250px;
    box-sizing: border-box;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--accent-cyan);
    background: rgba(0, 158, 179, 0.06);
}

.drop-zone-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    text-align: center;
    margin: auto;
}

.upload-icon-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--pane-btn-bg);
    border: 1px solid var(--pane-btn-border);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px auto;
    transition: transform 0.25s;
    flex-shrink: 0;
}
.drop-zone:hover .upload-icon-circle {
    transform: scale(1.08);
}

.drop-text-main {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.90rem;
    font-weight: 600;
    color: var(--title-color);
    margin: 0 0 6px 0;
    letter-spacing: 0.2px;
    text-align: center;
    width: 100%;
}
.highlight-link {
    color: var(--accent-cyan);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.drop-text-sub {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.76rem;
    color: var(--text-muted);
    margin: 0 0 14px 0;
    text-align: center;
    width: 100%;
}
.drop-text-sub kbd {
    background: var(--badge-bg);
    border: 1px solid var(--badge-border);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.74rem;
    color: var(--accent-cyan);
}

.drop-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
}
.drop-badges .badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    background: var(--badge-bg);
    border: 1px solid var(--badge-border);
    color: var(--badge-text);
    padding: 2px 7px;
    border-radius: 4px;
}

/* ── Preview Image ── */
.preview-img-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    box-sizing: border-box;
}
.preview-img-container img {
    max-width: 100%;
    max-height: 250px;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--panel-border);
}

/* ── Action Scan Button ── */
.ocr-scan-action-row {
    padding: 0 14px 14px 14px;
    display: flex;
    box-sizing: border-box;
}
.btn-scan {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(0, 158, 179, 0.15), rgba(124, 58, 237, 0.15));
    border: 1px solid var(--accent-cyan);
    border-radius: 7px;
    padding: 11px;
    color: var(--accent-cyan);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    letter-spacing: 0.8px;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.25s ease;
}
body.dark-mode .btn-scan {
    background: linear-gradient(135deg, rgba(92, 225, 230, 0.2), rgba(167, 139, 250, 0.2));
}
.btn-scan:hover:not(:disabled) {
    background: var(--accent-cyan);
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 158, 179, 0.25);
    transform: translateY(-1px);
}
.btn-scan:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: var(--panel-border);
}
.scan-enter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 7px;
    margin-left: 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    font-size: 0.70rem;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: none;
    color: currentColor;
    vertical-align: middle;
    transition: all 0.2s ease;
}
.btn-scan:hover:not(:disabled) .scan-enter-badge {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
}
.btn-scan:disabled .scan-enter-badge {
    opacity: 0.45;
}

/* ── Result Views ── */
.result-view-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 380px;
    height: 100%;
    box-sizing: border-box;
}

#math-preview {
    flex: 1;
    width: 100%;
    padding: 22px 24px;
    font-family: "Times New Roman", Times, serif;
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--text-color);
    overflow-y: auto;
    white-space: pre-wrap;
    box-sizing: border-box;
}

.latex-center { text-align: center; margin: 10px 0; width: 100%; }
.latex-flushleft { text-align: left; margin: 10px 0; }
.latex-flushright { text-align: right; margin: 10px 0; }
.latex-fbox {
    display: inline-block;
    border: 1px solid currentColor;
    padding: 3px 8px;
    margin: 2px 4px;
    border-radius: 2px;
    line-height: normal;
    vertical-align: middle;
}

/* ── LaTeX Tabular / Table Styles ── */
.latex-table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin: 14px 0;
    display: flex;
    justify-content: center;
}
.latex-table {
    border-collapse: collapse;
    margin: 0 auto;
    font-family: inherit;
    font-size: 0.95em;
    color: var(--text-color, inherit);
}
.latex-table td, 
.latex-table th {
    padding: 6px 14px;
    vertical-align: middle;
    line-height: 1.5;
}
.latex-table td.border-top,
.latex-table tr.border-top td { border-top: 1px solid currentColor; }
.latex-table td.border-bottom,
.latex-table tr.border-bottom td { border-bottom: 1px solid currentColor; }
.latex-table td.border-left { border-left: 1px solid currentColor; }
.latex-table td.border-right { border-right: 1px solid currentColor; }
.latex-table-container { margin: 16px 0; text-align: center; width: 100%; }
.latex-table-caption {
    font-weight: 600;
    margin-top: 8px;
    font-size: 0.9em;
    text-align: center;
    color: var(--text-muted, #888);
}

/* ── LaTeX Spacing & Alignment (\vspace, \hspace, \hfill) ── */
.latex-vspace {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    clear: both;
}
.latex-vspace.negative {
    margin-bottom: 0;
}
.latex-hspace {
    display: inline-block;
    vertical-align: baseline;
}
.latex-line-hfill {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    width: 100%;
    margin: 4px 0;
    box-sizing: border-box;
    clear: both;
}
.latex-line-hfill .hfill-part {
    flex: 0 1 auto;
}
.latex-line-hfill .hfill-part.empty {
    flex: 0 0 0;
}
.latex-line-hfill .hfill-part:first-child.empty + .hfill-part {
    margin-left: auto;
}

/* ── LaTeX TikZ Diagram Card & Viewport ── */
.latex-tikz-card {
    margin: 16px auto;
    border: 1px solid rgba(92, 225, 230, 0.28);
    background: rgba(18, 26, 26, 0.7);
    border-radius: 10px;
    overflow: hidden;
    max-width: 100%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    transition: border-color 0.2s, box-shadow 0.2s;
    clear: both;
}
.latex-tikz-card:hover {
    border-color: rgba(92, 225, 230, 0.5);
    box-shadow: 0 6px 24px rgba(92, 225, 230, 0.12);
}
.latex-tikz-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: rgba(11, 17, 17, 0.85);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.latex-tikz-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.76rem;
    font-weight: 600;
    color: #5ce1e6;
    letter-spacing: 0.5px;
    font-family: 'JetBrains Mono', monospace;
}
.latex-tikz-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.latex-tikz-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
    font-size: 0.72rem;
    padding: 3px 9px;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    font-family: 'JetBrains Mono', monospace;
    display: inline-flex;
    align-items: center;
}
.latex-tikz-btn:hover {
    background: rgba(92, 225, 230, 0.18);
    color: #5ce1e6;
    border-color: rgba(92, 225, 230, 0.4);
}
.latex-tikz-viewport {
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    min-height: 100px;
    position: relative;
}
.latex-tikz-iframe {
    width: 100%;
    min-height: 120px;
    border: none;
    background: transparent;
    display: block;
}
.latex-tikz-raw {
    margin: 10px 0 0 0;
    padding: 12px;
    width: 100%;
    box-sizing: border-box;
    background: #0d1117;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-size: 0.78rem;
    color: #a5d6ff;
    font-family: 'JetBrains Mono', monospace;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Light mode overrides for TikZ Card */
body.light-mode .latex-tikz-card,
body:not(.dark-mode) .latex-tikz-card {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.15);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
body.light-mode .latex-tikz-header,
body:not(.dark-mode) .latex-tikz-header {
    background: #f8fafc;
    border-bottom-color: rgba(0, 0, 0, 0.08);
}
body.light-mode .latex-tikz-badge,
body:not(.dark-mode) .latex-tikz-badge {
    color: #0284c7;
}
body.light-mode .latex-tikz-btn,
body:not(.dark-mode) .latex-tikz-btn {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #334155;
}
body.light-mode .latex-tikz-btn:hover,
body:not(.dark-mode) .latex-tikz-btn:hover {
    background: #e0f2fe;
    border-color: #0284c7;
    color: #0284c7;
}

#math-preview.empty-state,
#math-preview.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: normal !important;
    height: 100%;
    min-height: 280px;
    padding: 30px 24px;
    box-sizing: border-box;
}

#math-preview.empty-state {
    color: var(--text-muted);
    opacity: 0.6;
    font-family: 'JetBrains Mono', monospace;
    font-style: normal;
    font-size: 0.82rem;
    line-height: 1.6;
}

.ocr-error-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    margin: auto;
}

.ocr-error-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px auto;
    color: #f87171;
}

.ocr-error-icon svg {
    display: block;
    margin: 0 auto;
}

.ocr-error-title {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    margin: 0 0 6px 0;
    font-size: 0.90rem;
    color: #f87171;
    text-align: center;
    width: 100%;
}

.ocr-error-desc {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    opacity: 0.85;
    margin: 0;
    color: #f87171;
    text-align: center;
    width: 100%;
}

#latex-output {
    flex: 1;
    width: 100%;
    box-sizing: border-box;
    background: transparent;
    border: none;
    outline: none;
    padding: 16px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.86rem;
    line-height: 1.65;
    color: var(--text-color);
    resize: none;
}

/* ── Status Bar ── */
.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: var(--panel-header-bg);
    border-top: 1px solid var(--panel-border);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.70rem;
    color: var(--text-muted);
    box-sizing: border-box;
}
.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #eab308;
    display: inline-block;
    margin-right: 6px;
    vertical-align: middle;
}
.status-dot.green { background: #16a34a; }
.status-dot.red { background: #ef4444; }

/* ── Export Bar ── */
.export-bar {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
    box-sizing: border-box;
}
.export-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--panel-bg);
    border: 1px solid var(--pane-btn-border);
    border-radius: 8px;
    padding: 10px 18px;
    color: var(--accent-cyan);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.76rem;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
}
.export-btn:hover:not(:disabled) {
    background: var(--accent-cyan);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 158, 179, 0.2);
}
.export-btn.purple {
    border-color: rgba(124, 58, 237, 0.35);
    color: var(--accent-purple);
}
.export-btn.purple:hover:not(:disabled) {
    background: var(--accent-purple);
    color: #fff;
}
.export-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none !important;
}

.exam-end {
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 2px;
    color: var(--text-muted);
    opacity: 0.4;
    margin: 30px 0 10px 0;
}

/* ── Toast Notification ── */
.ocr-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--panel-header-bg);
    border: 1px solid var(--accent-cyan);
    color: var(--title-color);
    padding: 11px 18px;
    border-radius: 7px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.80rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    transform: translateY(80px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10000;
}
.ocr-toast.show {
    transform: translateY(0);
    opacity: 1;
}

.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(0, 158, 179, 0.25);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========================================================
   EMBED MODE (Modal popup / iframe via shared.js)
   ======================================================== */
body.embed-mode {
    background-color: var(--body-bg) !important;
}

body.embed-mode .sidebar,
body.embed-mode .topbar,
body.embed-mode .tags-comment-sidebar,
body.embed-mode .stats-strip,
body.embed-mode .site-footer,
body.embed-mode .exam-back-btn,
body.embed-mode .exam-meta {
    display: none !important;
}

body.embed-mode .main-wrapper {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}

body.embed-mode main {
    padding: 12px 18px !important;
    margin: 0 !important;
}

body.embed-mode .main-content-layout {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    display: block !important;
    grid-template-columns: 1fr !important;
    gap: 0 !important;
}

body.embed-mode .main-articles-body {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

body.embed-mode .latex-hero {
    margin-bottom: 12px;
    padding-bottom: 8px;
}
body.embed-mode .latex-hero h1 {
    font-size: 1.25rem !important;
}
body.embed-mode .latex-hero p {
    font-size: 0.80rem !important;
}

body.embed-mode .ocr-workspace {
    gap: 14px;
    margin-bottom: 14px;
}
body.embed-mode .ocr-body {
    min-height: 280px;
}
body.embed-mode .drop-zone {
    min-height: 200px;
    padding: 16px;
    margin: 10px;
}
body.embed-mode .result-view-panel {
    min-height: 260px;
}
body.embed-mode .export-bar {
    margin-top: 12px;
    gap: 8px;
}
body.embed-mode .export-btn {
    padding: 8px 14px;
    font-size: 0.72rem;
}
body.embed-mode .exam-end {
    margin: 16px 0 6px 0;
}
