/* Editorial Typewriter - A refined markdown editor */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700&family=JetBrains+Mono:wght@400;500&family=Source+Serif+4:opsz,wght@8..60,400;8..60,600&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Warm paper tones */
    --cream: #faf8f5;
    --cream-dark: #f0ebe3;
    --parchment: #e8e0d5;
    
    /* Deep ink colors */
    --ink: #1a1816;
    --ink-light: #2d2926;
    --ink-faded: #5c5652;
    --ink-ghost: #9a938c;
    
    /* Accent - aged copper/rust */
    --accent: #b85c38;
    --accent-light: #d4856a;
    --accent-glow: rgba(184, 92, 56, 0.15);
    
    /* Editor dark theme */
    --editor-bg: #1e1c1a;
    --editor-surface: #262421;
    --editor-text: #e8e0d5;
    --editor-muted: #7a746d;
    
    /* Typography */
    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Source Serif 4', Georgia, serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
}

html, body {
    height: 100%;
    font-family: var(--font-body);
    background: var(--ink);
}

/* Light Theme */
[data-theme="light"] {
    --cream: #ffffff;
    --cream-dark: #f8f6f3;
    --parchment: #ebe6de;
    
    --ink: #f5f3f0;
    --ink-light: #e8e4df;
    --ink-faded: #8a8580;
    --ink-ghost: #b5b0a8;
    
    --editor-bg: #fdfcfb;
    --editor-surface: #f8f6f3;
    --editor-text: #2d2926;
    --editor-muted: #9a938c;
}

[data-theme="light"] header {
    background: var(--cream);
    border-bottom-color: var(--parchment);
}

[data-theme="light"] header::after {
    background: linear-gradient(90deg, transparent, var(--parchment), transparent);
}

[data-theme="light"] .header-left h1 {
    color: var(--accent);
}

[data-theme="light"] .header-left .subtitle {
    color: var(--ink-faded);
}

[data-theme="light"] .theme-toggle,
[data-theme="light"] .menu-btn {
    border-color: var(--parchment);
    color: var(--ink-faded);
}

[data-theme="light"] .menu-btn span {
    background: var(--ink-faded);
}

[data-theme="light"] .editor-panel {
    background: var(--editor-bg);
    border-right-color: var(--parchment);
}

[data-theme="light"] .editor-panel::before {
    opacity: 0.02;
}



[data-theme="light"] .editor-panel .panel-header {
    background: var(--editor-surface);
    border-bottom-color: var(--parchment);
}

[data-theme="light"] .editor-panel .panel-footer {
    background: var(--editor-surface);
    border-top-color: var(--parchment);
}

[data-theme="light"] #editor {
    color: var(--editor-text);
}

[data-theme="light"] #editor::selection {
    background: var(--accent-glow);
}

[data-theme="light"] footer {
    background: var(--cream);
    border-top-color: var(--parchment);
}

[data-theme="light"] .footer-links a,
[data-theme="light"] .footer-credit {
    color: var(--ink-faded);
}

[data-theme="light"] .markdown-body h1,
[data-theme="light"] .markdown-body h2,
[data-theme="light"] .markdown-body h3,
[data-theme="light"] .markdown-body h4,
[data-theme="light"] .markdown-body h5,
[data-theme="light"] .markdown-body h6 {
    color: #2d2926;
}

[data-theme="light"] .markdown-body p,
[data-theme="light"] .markdown-body li,
[data-theme="light"] .markdown-body td {
    color: #3d3936;
}

[data-theme="light"] .markdown-body strong {
    color: #1a1816;
}

[data-theme="light"] .markdown-body em {
    color: #2d2926;
}

[data-theme="light"] .markdown-body h2 {
    color: #3d3936;
}

[data-theme="light"] .markdown-body h3 {
    color: #9a4a2c;
}

[data-theme="light"] .markdown-body pre {
    background: #2d2926;
    color: #e8e0d5;
}

[data-theme="light"] .markdown-body code {
    background: #2d2926;
    color: #e8d5b5;
}

[data-theme="light"] .markdown-body pre code {
    background: none;
    color: inherit;
}

[data-theme="light"] .markdown-body blockquote {
    color: #4a4540;
}

[data-theme="light"] .markdown-body a {
    color: #9a4a2c;
}

[data-theme="light"] .markdown-body a:hover {
    color: #1a1816;
}

[data-theme="light"] .toast {
    background: #2d2926;
    color: var(--cream);
    border-color: #3d3936;
}

body {
    display: flex;
    flex-direction: column;
}

/* Header - Editorial masthead style */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-xl);
    background: var(--ink);
    border-bottom: 1px solid var(--ink-light);
    position: relative;
}

header::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: var(--space-xl);
    right: var(--space-xl);
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--ink-faded), transparent);
}

.logo-link {
    text-decoration: none;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: opacity 0.2s;
}

.logo-link:hover {
    opacity: 0.8;
}

.header-left h1 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--cream);
    letter-spacing: -0.02em;
    position: relative;
    display: inline-block;
}

.header-left h1::after {
    content: '·';
    color: var(--accent);
    margin-left: 0.3em;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.header-left .subtitle {
    color: var(--ink-ghost);
    font-size: 0.8rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-left: var(--space-md);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: 1px solid var(--ink-light);
    border-radius: 50%;
    cursor: pointer;
    color: var(--ink-ghost);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.header-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}

[data-theme="light"] .header-btn {
    border-color: var(--parchment);
    color: var(--ink-faded);
}

[data-theme="light"] .header-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: 1px solid var(--ink-light);
    border-radius: 50%;
    cursor: pointer;
    color: var(--ink-ghost);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}

.theme-toggle .sun-icon {
    display: none;
}

.theme-toggle .moon-icon {
    display: block;
}

[data-theme="light"] .theme-toggle .sun-icon {
    display: block;
}

[data-theme="light"] .theme-toggle .moon-icon {
    display: none;
}

.menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: 1px solid var(--ink-light);
    cursor: pointer;
    padding: 10px;
    border-radius: 4px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 768px) {
    .menu-btn {
        display: flex;
    }
}

.menu-btn:hover {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.menu-btn span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--ink-ghost);
    border-radius: 1px;
    transition: background 0.3s;
}

.menu-btn:hover span {
    background: var(--accent);
}

/* Main Container */
.container {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

/* Panels */
.panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) var(--space-lg);
    border-bottom: 1px solid transparent;
}

.editor-panel .panel-header {
    background: var(--editor-surface);
    border-bottom-color: var(--ink-light);
}

.preview-panel .panel-header {
    background: var(--cream);
    border-bottom-color: var(--parchment);
}

.panel-title {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.2em;
}

.editor-panel .panel-title {
    color: var(--editor-muted);
}

.preview-panel .panel-title {
    color: var(--ink-faded);
}

.panel-actions {
    display: flex;
    gap: var(--space-xs);
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.editor-panel .action-btn {
    color: var(--editor-muted);
}

.editor-panel .action-btn:hover {
    color: var(--accent-light);
    border-color: var(--ink-light);
    background: rgba(184, 92, 56, 0.1);
}

.preview-panel .action-btn {
    color: var(--ink-ghost);
}

.preview-panel .action-btn:hover {
    color: var(--accent);
    border-color: var(--parchment);
    background: var(--accent-glow);
}

/* Editor Panel */
.editor-panel {
    background: var(--editor-bg);
    position: relative;
}

/* Subtle texture overlay */
.editor-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
    z-index: 1;
}

.editor-wrapper {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
}

.line-numbers {
    display: none;
    padding: var(--space-lg) var(--space-sm);
    padding-right: var(--space-md);
    background: var(--editor-surface);
    color: var(--editor-muted);
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.8;
    text-align: right;
    user-select: none;
    overflow: hidden;
    border-right: 1px solid var(--ink-light);
    min-width: 3em;
}

.line-numbers.visible {
    display: block;
}

.line-numbers span {
    display: block;
}

[data-theme="light"] .line-numbers {
    background: var(--cream-dark);
    color: var(--ink-ghost);
    border-right-color: var(--parchment);
}

#editor {
    flex: 1;
    width: 100%;
    padding: var(--space-lg) var(--space-lg);
    background: transparent;
    color: var(--editor-text);
    border: none;
    outline: none;
    resize: none;
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.8;
    position: relative;
    z-index: 2;
    caret-color: var(--accent);
}

#editor::placeholder {
    color: var(--editor-muted);
}

#editor::selection {
    background: var(--accent-glow);
}

/* Preview Panel */
.preview-panel {
    background: var(--cream);
    position: relative;
}

/* Paper texture */
.preview-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.04;
    pointer-events: none;
}

/* Resize handle between panels */
.resize-handle {
    position: absolute;
    right: -4px;
    top: 0;
    bottom: 0;
    width: 8px;
    cursor: col-resize;
    z-index: 100;
    background: transparent;
    transition: background 0.2s;
}

.resize-handle::before {
    content: '';
    position: absolute;
    left: 3px;
    top: 10%;
    bottom: 10%;
    width: 2px;
    background: linear-gradient(
        to bottom,
        transparent,
        var(--ink-light) 20%,
        var(--ink-light) 80%,
        transparent
    );
    transition: background 0.2s;
}

.resize-handle:hover::before,
.resize-handle.dragging::before {
    background: var(--accent);
}

.resize-handle:hover,
.resize-handle.dragging {
    background: var(--accent-glow);
}

.reset-split {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid var(--ink-light);
    background: var(--editor-bg);
    color: var(--ink-ghost);
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.resize-handle:hover .reset-split {
    opacity: 1;
}

.reset-split:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

[data-theme="light"] .reset-split {
    background: var(--cream);
    border-color: var(--parchment);
    color: var(--ink-faded);
}

[data-theme="light"] .reset-split:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

[data-theme="light"] .resize-handle::before {
    background: linear-gradient(
        to bottom,
        transparent,
        var(--parchment) 20%,
        var(--parchment) 80%,
        transparent
    );
}

[data-theme="light"] .resize-handle:hover::before,
[data-theme="light"] .resize-handle.dragging::before {
    background: var(--accent);
}

#preview {
    flex: 1;
    padding: var(--space-xl) var(--space-2xl);
    overflow-y: auto;
    color: var(--ink);
    position: relative;
    z-index: 2;
}

/* Markdown Styling - Editorial */
.markdown-body h1, .markdown-body h2, .markdown-body h3,
.markdown-body h4, .markdown-body h5, .markdown-body h6 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.2;
    margin-top: var(--space-xl);
    margin-bottom: var(--space-md);
    color: var(--ink);
}

.markdown-body h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    position: relative;
    padding-bottom: var(--space-md);
}

.markdown-body h1::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 3px;
    background: var(--accent);
}

.markdown-body h2 {
    font-size: 1.75rem;
    letter-spacing: -0.02em;
    color: var(--ink-light);
    border-bottom: 1px solid var(--parchment);
    padding-bottom: var(--space-sm);
}

.markdown-body h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--accent);
}

.markdown-body p {
    margin-bottom: var(--space-md);
    line-height: 1.8;
    font-size: 1.05rem;
}

.markdown-body a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid var(--accent-light);
    transition: all 0.2s;
}

.markdown-body a:hover {
    color: var(--ink);
    border-bottom-color: var(--ink);
}

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

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

.markdown-body code {
    font-family: var(--font-mono);
    background: var(--cream-dark);
    padding: 0.15em 0.4em;
    border-radius: 3px;
    font-size: 0.9em;
    color: var(--accent);
}

.markdown-body pre {
    background: var(--editor-bg);
    color: var(--editor-text);
    padding: var(--space-lg);
    border-radius: 8px;
    overflow-x: auto;
    margin: var(--space-lg) 0;
    border-left: 3px solid var(--accent);
    position: relative;
}

.markdown-body pre::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
    border-radius: 8px;
}

.markdown-body pre code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: 0.875rem;
    line-height: 1.7;
}

.markdown-body blockquote {
    border-left: 3px solid var(--accent);
    padding: var(--space-md) var(--space-lg);
    margin: var(--space-lg) 0;
    background: var(--accent-glow);
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: var(--ink-light);
}

.markdown-body blockquote p:last-child {
    margin-bottom: 0;
}

.markdown-body ul, .markdown-body ol {
    margin-bottom: var(--space-md);
    padding-left: var(--space-xl);
}

.markdown-body li {
    margin-bottom: var(--space-sm);
    line-height: 1.7;
}

.markdown-body li::marker {
    color: var(--accent);
}

.markdown-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: var(--space-lg) 0;
    box-shadow: 0 4px 20px rgba(26, 24, 22, 0.1);
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-lg) 0;
    font-size: 0.95rem;
}

.markdown-body th, .markdown-body td {
    padding: var(--space-sm) var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--parchment);
}

.markdown-body th {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-faded);
    background: var(--cream-dark);
}

.markdown-body tr:hover td {
    background: var(--accent-glow);
}

.markdown-body hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--parchment) 20%, var(--parchment) 80%, transparent);
    margin: var(--space-2xl) 0;
}

.markdown-body input[type="checkbox"] {
    margin-right: var(--space-sm);
    accent-color: var(--accent);
}

/* Panel Footer */
.panel-footer {
    padding: var(--space-sm) var(--space-lg);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.05em;
}

.editor-panel .panel-footer {
    background: var(--editor-surface);
    color: var(--editor-muted);
    border-top: 1px solid var(--ink-light);
}

.preview-panel .panel-footer {
    background: var(--cream);
    color: var(--ink-ghost);
    border-top: 1px solid var(--parchment);
}

/* Footer */
footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-xl);
    background: var(--ink);
    border-top: 1px solid var(--ink-light);
}

.footer-links {
    display: flex;
    gap: var(--space-xl);
}

.footer-links a {
    color: var(--ink-ghost);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--accent);
}

.footer-credit {
    color: var(--ink-ghost);
    font-size: 0.85rem;
}

.footer-credit a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-credit a:hover {
    color: var(--accent-light);
    text-decoration: underline;
}

/* Toggle button icon switching - show the layout you'll switch TO */
#toggleSplitBtn .icon-vertical {
    display: none;
}

body.horizontal-layout #toggleSplitBtn .icon-horizontal {
    display: none;
}

body.horizontal-layout #toggleSplitBtn .icon-vertical {
    display: block;
}

/* TOC Sidebar */
.toc-sidebar {
    width: 0;
    min-width: 0;
    background: var(--editor-bg);
    border-right: 1px solid var(--ink-light);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.25s ease, min-width 0.25s ease;
}

.toc-sidebar.visible {
    width: 240px;
    min-width: 240px;
}

.toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) var(--space-lg);
    border-bottom: 1px solid var(--ink-light);
    background: var(--editor-surface);
    min-height: 49px;
    box-sizing: border-box;
}

.toc-title {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--editor-muted);
}

.toc-close {
    background: none;
    border: none;
    color: var(--editor-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.toc-close:hover {
    color: var(--accent);
    background: var(--accent-glow);
}

.toc-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-sm) 0;
}

.toc-empty {
    padding: var(--space-lg);
    color: var(--editor-muted);
    font-size: 0.85rem;
    text-align: center;
    font-style: italic;
}

.toc-item {
    display: flex;
    align-items: flex-start;
    padding: var(--space-xs) var(--space-md);
    cursor: pointer;
    color: var(--editor-text);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.5;
    transition: all 0.15s;
    border-left: 2px solid transparent;
}

.toc-item:hover {
    background: var(--accent-glow);
    color: var(--accent-light);
}

.toc-item.active {
    background: var(--accent-glow);
    border-left-color: var(--accent);
    color: var(--accent-light);
}

.toc-item.h1 { padding-left: var(--space-md); font-weight: 600; }
.toc-item.h2 { padding-left: calc(var(--space-md) + 12px); }
.toc-item.h3 { padding-left: calc(var(--space-md) + 24px); font-size: 0.8rem; }
.toc-item.h4 { padding-left: calc(var(--space-md) + 36px); font-size: 0.8rem; }
.toc-item.h5 { padding-left: calc(var(--space-md) + 48px); font-size: 0.75rem; }
.toc-item.h6 { padding-left: calc(var(--space-md) + 60px); font-size: 0.75rem; }

.toc-item-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.toc-item-level {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--editor-muted);
    margin-right: var(--space-sm);
    opacity: 0.6;
}

.toc-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--accent);
    color: white;
    font-size: 0.55rem;
    font-family: var(--font-mono);
    min-width: 14px;
    height: 14px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}

.toc-badge:empty {
    display: none;
}

.panel-title-group {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.outline-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: none;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    color: var(--editor-muted);
    position: relative;
    transition: all 0.2s;
}

.outline-toggle:hover {
    color: var(--accent-light);
    border-color: var(--ink-light);
    background: rgba(184, 92, 56, 0.1);
}

.toc-sidebar.visible ~ .editor-panel .outline-toggle {
    color: var(--accent);
    background: var(--accent-glow);
}

[data-theme="light"] .outline-toggle {
    color: var(--ink-ghost);
}

[data-theme="light"] .outline-toggle:hover {
    color: var(--accent);
    border-color: var(--parchment);
    background: var(--accent-glow);
}

/* Light theme TOC */
[data-theme="light"] .toc-sidebar {
    background: var(--cream);
    border-right-color: var(--parchment);
}

[data-theme="light"] .toc-header {
    background: var(--cream-dark);
    border-bottom-color: var(--parchment);
}

[data-theme="light"] .toc-title {
    color: var(--ink-faded);
}

[data-theme="light"] .toc-close {
    color: var(--ink-faded);
}

[data-theme="light"] .toc-item {
    color: #2a2725;
}

[data-theme="light"] .toc-item:hover,
[data-theme="light"] .toc-item.active {
    color: var(--accent);
}

/* Horizontal split layout */
.container.horizontal {
    flex-direction: column;
}

.container.horizontal .toc-sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    height: 100%;
    z-index: 10;
}

.container.horizontal .toc-sidebar.visible ~ .editor-panel,
.container.horizontal .toc-sidebar.visible ~ .preview-panel {
    margin-left: 240px;
}

.container.horizontal .editor-panel,
.container.horizontal .preview-panel {
    min-height: 0;
    width: auto !important;
    flex: 1;
}

.container.horizontal .editor-panel {
    border-right: none;
    border-bottom: 1px solid var(--ink-light);
}

.container.horizontal .resize-handle {
    right: auto;
    bottom: -4px;
    left: 0;
    right: 0;
    top: auto;
    width: auto;
    height: 8px;
    cursor: row-resize;
}

.container.horizontal .resize-handle::before {
    left: 10%;
    right: 10%;
    top: 3px;
    bottom: auto;
    width: auto;
    height: 2px;
    background: linear-gradient(
        to right,
        transparent,
        var(--ink-light) 20%,
        var(--ink-light) 80%,
        transparent
    );
}

.container.horizontal .resize-handle:hover::before,
.container.horizontal .resize-handle.dragging::before {
    background: var(--accent);
}

[data-theme="light"] .container.horizontal .resize-handle::before {
    background: linear-gradient(
        to right,
        transparent,
        var(--parchment) 20%,
        var(--parchment) 80%,
        transparent
    );
}

[data-theme="light"] .container.horizontal .resize-handle:hover::before,
[data-theme="light"] .container.horizontal .resize-handle.dragging::before {
    background: var(--accent);
}

[data-theme="light"] .container.horizontal .editor-panel {
    border-bottom-color: var(--parchment);
}

/* Fullscreen Mode */
.panel.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    border-radius: 0;
}

.panel.fullscreen::after {
    display: none;
}

/* TOC in fullscreen mode */
.toc-sidebar.fullscreen-toc {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1001;
    width: 260px;
    min-width: 260px;
}

.panel.fullscreen.with-toc {
    left: 260px;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    .editor-panel::after {
        display: none;
    }

    .editor-panel {
        border-bottom: 1px solid var(--ink-light);
    }

    .panel {
        min-height: 40vh;
    }

    .header-left .subtitle {
        display: none;
    }
    
    #preview {
        padding: var(--space-lg);
    }
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--ink);
    color: var(--cream);
    padding: var(--space-sm) var(--space-lg);
    border-radius: 100px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    z-index: 1001;
    border: 1px solid var(--ink-light);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 1.7s forwards;
}

.toast::before {
    content: '✓';
    margin-right: var(--space-sm);
    color: var(--accent);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

.editor-panel ::-webkit-scrollbar-thumb {
    background: var(--ink-light);
    border-radius: 4px;
}

.editor-panel ::-webkit-scrollbar-thumb:hover {
    background: var(--ink-faded);
}

.preview-panel ::-webkit-scrollbar-thumb {
    background: var(--parchment);
    border-radius: 4px;
}

.preview-panel ::-webkit-scrollbar-thumb:hover {
    background: var(--ink-ghost);
}

/* Focus states */
#editor:focus {
    outline: none;
}

/* Initial load animation */
@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.panel {
    animation: fadeSlideIn 0.5s ease;
}

.editor-panel {
    animation-delay: 0.1s;
    animation-fill-mode: both;
}

.preview-panel {
    animation-delay: 0.2s;
    animation-fill-mode: both;
}

/* Mermaid Diagrams */
.mermaid {
    background: var(--paper-light);
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1.5rem 0;
    text-align: center;
    overflow-x: auto;
}

.mermaid svg {
    max-width: 100%;
    height: auto;
}

[data-theme="light"] .mermaid {
    background: var(--paper-light);
}

/* ASCII Tables - Enhanced Styling */
.ascii-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    border: 1px solid var(--accent);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.ascii-table th {
    background: var(--accent);
    color: var(--paper);
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

.ascii-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--ink-light);
}

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

.ascii-table tr:nth-child(even) {
    background: var(--paper-light);
}

.ascii-table tr:hover {
    background: rgba(201, 168, 124, 0.1);
}

[data-theme="light"] .ascii-table th {
    background: var(--accent);
    color: white;
}

[data-theme="light"] .ascii-table td {
    border-bottom-color: var(--ink-light);
}

/* Reading Time Display */
.reading-time {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--ink-faded);
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 0 12px;
}

.reading-time svg {
    opacity: 0.7;
}

/* Focus Mode */
body.focus-mode header,
body.focus-mode footer,
body.focus-mode .toc-sidebar,
body.focus-mode .preview-panel,
body.focus-mode .resize-handle,
body.focus-mode .panel-header,
body.focus-mode .panel-footer,
body.focus-mode .markdown-toolbar {
    display: none !important;
}

body.focus-mode .container {
    padding: 0;
}

body.focus-mode .editor-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    max-width: 800px;
    margin: 0 auto;
    border: none;
    border-radius: 0;
}

body.focus-mode .editor-wrapper {
    height: 100vh;
    padding: 3rem;
}

body.focus-mode #editor {
    font-size: 1.1rem;
    line-height: 1.9;
}

body.focus-mode .line-numbers {
    display: none;
}

/* Focus mode exit hint */
body.focus-mode::after {
    content: 'Press Esc to exit focus mode';
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--paper-light);
    color: var(--ink-faded);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-family: var(--font-mono);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

body.focus-mode:hover::after {
    opacity: 1;
}

/* Markdown Toolbar */
.markdown-toolbar {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: var(--paper-light);
    border-bottom: 1px solid var(--ink-light);
    flex-wrap: wrap;
}

.markdown-toolbar.visible {
    display: flex;
}

.md-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--ink-faded);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 13px;
    transition: all 0.15s;
}

.md-btn:hover {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--accent);
}

.md-btn:active {
    transform: scale(0.95);
}

.md-btn svg {
    width: 16px;
    height: 16px;
}

.md-separator {
    width: 1px;
    height: 20px;
    background: var(--ink-light);
    margin: 0 4px;
}

/* Light theme adjustments */
[data-theme="light"] .markdown-toolbar {
    background: var(--paper-light);
    border-bottom-color: var(--ink-light);
}

[data-theme="light"] .md-btn:hover {
    background: var(--accent-glow);
}

[data-theme="light"] .reading-time {
    color: var(--ink-faded);
}

[data-theme="light"] body.focus-mode::after {
    background: var(--paper-light);
}

/* File Browser Sidebar */
.file-sidebar {
    position: fixed;
    left: 0;
    top: 60px;
    bottom: 40px;
    width: 280px;
    background: var(--editor-surface);
    border-right: 1px solid var(--ink-light);
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 100;
}

.file-sidebar.visible {
    transform: translateX(0);
}

.file-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-md);
    height: 41px;
    border-bottom: 1px solid var(--ink-light);
    background: var(--editor-bg);
    box-sizing: border-box;
}

.file-sidebar-title {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    color: var(--ink-ghost);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.file-sidebar-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.file-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: none;
    border: none;
    border-radius: 4px;
    color: var(--ink-ghost);
    cursor: pointer;
    transition: all 0.15s;
}

.file-action-btn:hover {
    color: var(--accent);
    background: var(--accent-glow);
}

.file-tree {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.file-tree-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--ink-ghost);
    text-align: center;
    padding: 20px;
    gap: 12px;
}

.file-tree-empty svg {
    opacity: 0.5;
}

.file-tree-empty p {
    font-size: 14px;
    margin: 0;
}

.open-folder-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-family: var(--font-body);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
}

.open-folder-btn:hover {
    background: var(--accent-light);
    transform: translateY(-1px);
}

.browser-note {
    font-size: 11px;
    color: var(--ink-ghost);
    opacity: 0.7;
}

/* File tree items */
.file-tree-folder,
.file-tree-file {
    display: flex;
    align-items: center;
    padding: 6px 12px 6px 16px;
    cursor: pointer;
    transition: background 0.1s;
    gap: 8px;
    font-size: 13px;
    color: var(--editor-text);
    user-select: none;
}

.file-tree-folder:hover,
.file-tree-file:hover {
    background: var(--ink-light);
}

.file-tree-file.active {
    background: var(--accent-glow);
    color: var(--accent);
}

.file-tree-file.modified::after {
    content: '●';
    color: var(--accent);
    margin-left: auto;
    font-size: 10px;
}

.file-tree-folder svg,
.file-tree-file svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.7;
}

.file-tree-file svg {
    color: var(--accent);
}

.file-tree-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-tree-folder.collapsed > .folder-children {
    display: none;
}

.folder-children {
    padding-left: 16px;
}

.file-tree-folder .folder-icon {
    transition: transform 0.15s;
}

.file-tree-folder.collapsed .folder-icon {
    transform: rotate(-90deg);
}

.file-sidebar-footer {
    padding: 10px 12px;
    border-top: 1px solid var(--ink-light);
    background: var(--editor-bg);
    font-size: 12px;
}

.current-file {
    color: var(--cream);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-status {
    color: var(--ink-ghost);
    font-size: 11px;
}

.file-status.modified {
    color: var(--accent);
}

.file-status.saved {
    color: #4ade80;
}

/* Adjust main container when sidebar is open */
body.file-sidebar-open .container {
    margin-left: 280px;
}

body.file-sidebar-open .toc-sidebar {
    left: 280px;
}

/* Light theme adjustments for file sidebar */
[data-theme="light"] .file-sidebar {
    background: var(--cream-dark);
    border-right-color: var(--parchment);
}

[data-theme="light"] .file-sidebar-header {
    background: var(--cream);
    border-bottom-color: var(--parchment);
}

[data-theme="light"] .file-sidebar-title {
    color: var(--accent);
}

[data-theme="light"] .file-sidebar-actions {
    border-bottom-color: var(--parchment);
}

[data-theme="light"] .file-action-btn {
    border-color: var(--parchment);
}

[data-theme="light"] .file-tree-folder:hover,
[data-theme="light"] .file-tree-file:hover {
    background: var(--parchment);
}

[data-theme="light"] .file-tree-file.active {
    background: var(--accent-glow);
}

[data-theme="light"] .file-sidebar-footer {
    background: var(--cream);
    border-top-color: var(--parchment);
}

[data-theme="light"] .current-file {
    color: var(--ink-faded);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .file-sidebar {
        width: 100%;
        max-width: 300px;
    }
    
    body.file-sidebar-open .container {
        margin-left: 0;
    }
}

/* New file modal */
.new-file-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.new-file-modal.visible {
    opacity: 1;
    visibility: visible;
}

.new-file-modal-content {
    background: var(--editor-surface);
    border: 1px solid var(--ink-light);
    border-radius: 8px;
    padding: 24px;
    width: 90%;
    max-width: 400px;
}

.new-file-modal h3 {
    font-family: var(--font-display);
    color: var(--cream);
    margin-bottom: 16px;
    font-size: 18px;
}

.new-file-modal input {
    width: 100%;
    padding: 10px 12px;
    background: var(--editor-bg);
    border: 1px solid var(--ink-light);
    border-radius: 6px;
    color: var(--editor-text);
    font-family: var(--font-mono);
    font-size: 14px;
    margin-bottom: 16px;
}

.new-file-modal input:focus {
    outline: none;
    border-color: var(--accent);
}

.new-file-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.new-file-modal-actions button {
    padding: 8px 16px;
    border-radius: 6px;
    font-family: var(--font-body);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
}

.new-file-modal-actions .cancel-btn {
    background: none;
    border: 1px solid var(--ink-light);
    color: var(--ink-ghost);
}

.new-file-modal-actions .cancel-btn:hover {
    border-color: var(--ink-ghost);
    color: var(--editor-text);
}

.new-file-modal-actions .create-btn {
    background: var(--accent);
    border: none;
    color: white;
}

.new-file-modal-actions .create-btn:hover {
    background: var(--accent-light);
}

[data-theme="light"] .new-file-modal-content {
    background: var(--cream);
    border-color: var(--parchment);
}

[data-theme="light"] .new-file-modal h3 {
    color: var(--accent);
}

[data-theme="light"] .new-file-modal input {
    background: var(--cream-dark);
    border-color: var(--parchment);
    color: var(--editor-text);
}

/* Find/Replace Bar */
.find-replace-bar {
    display: none;
    flex-direction: column;
    gap: 6px;
    padding: 8px 12px;
    background: var(--editor-bg);
    border-bottom: 1px solid var(--ink-light);
}

.find-replace-bar.visible {
    display: flex;
}

.find-row,
.replace-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.replace-row {
    display: none;
}

.replace-row.visible {
    display: flex;
}

.find-replace-bar input {
    flex: 1;
    padding: 6px 10px;
    background: var(--editor-surface);
    border: 1px solid var(--ink-light);
    border-radius: 4px;
    color: var(--editor-text);
    font-family: var(--font-mono);
    font-size: 13px;
    min-width: 0;
}

.find-replace-bar input:focus {
    outline: none;
    border-color: var(--accent);
}

.find-replace-bar input::placeholder {
    color: var(--ink-ghost);
}

.find-count {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-ghost);
    min-width: 60px;
    text-align: center;
}

.find-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    background: none;
    border: 1px solid var(--ink-light);
    border-radius: 4px;
    color: var(--ink-ghost);
    cursor: pointer;
    transition: all 0.15s;
}

.find-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}

.find-btn.find-close:hover {
    border-color: #e74c3c;
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

.replace-btn {
    padding: 6px 12px;
    font-family: var(--font-mono);
    font-size: 11px;
}

/* Light theme */
[data-theme="light"] .find-replace-bar {
    background: var(--cream-dark);
    border-bottom-color: var(--parchment);
}

[data-theme="light"] .find-replace-bar input {
    background: var(--cream);
    border-color: var(--parchment);
    color: var(--editor-text);
}

/* Mobile Menu */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 998;
}

.mobile-menu-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 280px;
    max-width: 85vw;
    background: var(--editor-surface);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 999;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.mobile-menu.visible {
    transform: translateX(0);
}

.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--ink-light);
    background: var(--editor-bg);
}

.mobile-menu-header span {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--cream);
}

.mobile-menu-close {
    background: none;
    border: none;
    color: var(--ink-ghost);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.15s;
}

.mobile-menu-close:hover {
    color: var(--accent);
}

.mobile-menu-items {
    padding: 12px 0;
}

.mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 20px;
    background: none;
    border: none;
    color: var(--editor-text);
    font-family: var(--font-body);
    font-size: 15px;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
}

.mobile-menu-item:hover {
    background: var(--ink-light);
}

.mobile-menu-item svg {
    color: var(--ink-ghost);
    flex-shrink: 0;
}

.mobile-menu-item:hover svg {
    color: var(--accent);
}

.mobile-menu-divider {
    height: 1px;
    background: var(--ink-light);
    margin: 8px 20px;
}

@media (max-width: 768px) {
    /* Hide some header buttons on mobile */
    .header-btn:not(#themeToggle),
    .reading-time {
        display: none;
    }
}

/* Light theme */
[data-theme="light"] .mobile-menu {
    background: var(--cream);
}

[data-theme="light"] .mobile-menu-header {
    background: var(--cream-dark);
    border-bottom-color: var(--parchment);
}

[data-theme="light"] .mobile-menu-header span {
    color: var(--accent);
}

[data-theme="light"] .mobile-menu-item {
    color: var(--editor-text);
}

[data-theme="light"] .mobile-menu-item:hover {
    background: var(--parchment);
}

[data-theme="light"] .mobile-menu-divider {
    background: var(--parchment);
}

/* Log Viewer */
.log-viewer {
    display: none;
    position: absolute;
    top: 41px;
    left: 0;
    right: 0;
    bottom: 33px;
    background: var(--editor-bg);
    flex-direction: column;
    z-index: 10;
}

.log-viewer.visible {
    display: flex;
}

.preview-panel.log-mode #preview {
    display: none;
}

#logModeToggle.active {
    color: var(--accent);
    background: var(--accent-glow);
}

.log-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--editor-surface);
    border-bottom: 1px solid var(--ink-light);
    flex-wrap: wrap;
}

.log-filters {
    display: flex;
    gap: 4px;
}

.log-filter-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.log-filter-btn.inactive {
    opacity: 0.3;
}

.log-filter-error {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.log-filter-warn {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.log-filter-info {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.log-filter-debug {
    background: rgba(107, 114, 128, 0.2);
    color: #6b7280;
}

.log-filter-count {
    background: rgba(0,0,0,0.2);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 9px;
}

.log-search-wrap {
    flex: 1;
    min-width: 120px;
}

.log-search-wrap input {
    width: 100%;
    padding: 6px 10px;
    background: var(--editor-bg);
    border: 1px solid var(--ink-light);
    border-radius: 4px;
    color: var(--editor-text);
    font-family: var(--font-mono);
    font-size: 12px;
}

.log-search-wrap input:focus {
    outline: none;
    border-color: var(--accent);
}

.log-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.log-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: none;
    border: 1px solid var(--ink-light);
    border-radius: 4px;
    color: var(--ink-ghost);
    cursor: pointer;
    transition: all 0.15s;
}

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

.log-action-btn.active {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--accent);
}

.log-count {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-ghost);
    white-space: nowrap;
}

.log-viewer-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.5;
}

.log-entry {
    padding: 2px 12px;
    border-left: 3px solid transparent;
}

.log-entry:hover {
    background: var(--ink-light);
}

.log-entry.log-error {
    border-left-color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
}

.log-entry.log-warn {
    border-left-color: #f59e0b;
    background: rgba(245, 158, 11, 0.05);
}

.log-entry.log-info {
    border-left-color: #3b82f6;
}

.log-entry.log-debug {
    border-left-color: #6b7280;
    opacity: 0.7;
}

.log-entry.log-trace {
    border-left-color: #9ca3af;
    opacity: 0.5;
}

.log-line {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.log-expand {
    cursor: pointer;
    color: var(--ink-ghost);
    transition: transform 0.15s;
    font-size: 10px;
    width: 12px;
    flex-shrink: 0;
}

.log-expand.expanded {
    transform: rotate(90deg);
}

.log-expand-placeholder {
    width: 12px;
    flex-shrink: 0;
}

.log-level-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 2px;
    flex-shrink: 0;
    min-width: 40px;
    text-align: center;
}

.log-error .log-level-badge {
    background: #ef4444;
    color: white;
}

.log-warn .log-level-badge {
    background: #f59e0b;
    color: white;
}

.log-info .log-level-badge {
    background: #3b82f6;
    color: white;
}

.log-debug .log-level-badge {
    background: #6b7280;
    color: white;
}

.log-trace .log-level-badge {
    background: #9ca3af;
    color: white;
}

.log-other .log-level-badge {
    background: var(--ink-light);
    color: var(--ink-ghost);
}

.log-timestamp {
    color: var(--ink-ghost);
    flex-shrink: 0;
}

.log-text {
    color: var(--editor-text);
    word-break: break-all;
}

.log-stack {
    display: none;
    margin-left: 60px;
    margin-top: 4px;
    padding: 8px;
    background: var(--editor-bg);
    border-radius: 4px;
    white-space: pre;
    overflow-x: auto;
    color: var(--ink-ghost);
    font-size: 11px;
}

.log-stack.expanded {
    display: block;
}

.log-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--ink-ghost);
    font-family: var(--font-body);
}

/* Light theme */
[data-theme="light"] .log-viewer {
    background: var(--cream);
}

[data-theme="light"] .log-toolbar {
    background: var(--cream-dark);
    border-bottom-color: var(--parchment);
}

[data-theme="light"] .log-search-wrap input {
    background: var(--cream);
    border-color: var(--parchment);
}

[data-theme="light"] .log-entry:hover {
    background: var(--parchment);
}

[data-theme="light"] .log-stack {
    background: var(--cream-dark);
}
