/* Text Boxes - Modern Markdown Editor */

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

:root {
    /* Colors - Inspired by modern editors */
    --primary: #65a30d;
    --primary-hover: #4d7c0f;
    --primary-light: #ecfccb;
    --primary-subtle: #f6f8f4;
    
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --surface-3: #f1f5f9;
    --surface-editor: #fcfcfd;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --text-inverse: #ffffff;
    
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    
    /* Typography */
    --font-sans: basic-sans, 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-mono: source-code-pro, 'JetBrains Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
    
    /* Font options for user selection */
    --font-ui-basic-sans: basic-sans, -apple-system, BlinkMacSystemFont, sans-serif;
    --font-ui-inter: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-ui-source-sans: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-ui-system: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    --font-preview-basic-sans: basic-sans, Georgia, serif;
    --font-preview-merriweather: 'Merriweather', Georgia, serif;
    --font-preview-playfair: 'Playfair Display', Georgia, serif;
    --font-preview-lora: 'Lora', Georgia, serif;
    --font-preview-crimson: 'Crimson Text', Georgia, serif;
    --font-preview-georgia: Georgia, serif;
    --font-preview-times: Times, 'Times New Roman', serif;
    --font-preview-inter: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-preview-source-sans: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-preview-system: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    --font-code-source-code: source-code-pro, 'Courier New', monospace;
    --font-code-jetbrains: 'JetBrains Mono', 'Courier New', monospace;
    --font-code-source-code-pro: 'Source Code Pro', 'Courier New', monospace;
    --font-code-monaco: Monaco, 'Courier New', monospace;
    --font-code-consolas: Consolas, 'Courier New', monospace;
    --font-code-courier: 'Courier New', monospace;
    
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    
    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-12: 3rem;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    /* Border radius */
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    /* Transitions */
    --transition: all 0.15s ease;
    --transition-slow: all 0.3s ease;

    /* Layout */
    --editor-top-gap: var(--space-6); /* Keep consistent top spacing across modes */
    --editor-inner-padding-source: 1rem;   /* Inside padding for source editor */
    --editor-inner-padding-preview: 1rem;  /* Inside padding for preview */


    /* Settings sizing */
    --settings-sheet-w: 680px;
    --settings-nav-w: 180px;
    --settings-label-w: 220px;
    --settings-row-h: 44px;
}

/* Dark theme */
[data-theme="dark"] {
    --surface: #0f172a;
    --surface-2: #1e293b;
    --surface-3: #334155;
    --surface-editor: #141b26;
    --border: #475569;
    --border-light: #334155;
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
}

/* Base styles */
html {
    font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Visually hidden (accessible) labels */
.sr-only {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0);
    white-space: nowrap; border: 0;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--surface-2);
    overflow-x: hidden;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    min-height: auto;
    display: flex;
    flex-direction: column;
}

/* Prevent header flash on load - assume focus mode by default */
body:not(.fonts-loaded) .app-header > *:not(.view-toggle) {
    opacity: 0;
}

body:not(.fonts-loaded) .app-header .view-toggle {
    opacity: 0.4;
}

body:not(.fonts-loaded) .app-header {
    border-bottom: none;
    background: transparent;
}

body.fonts-loaded {
    opacity: 1;
}

/* App Layout */
.app-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    max-width: 1600px; /* Wider than before for better split view */
    width: 100%;
    margin: 0 auto;
    box-shadow: var(--shadow-md); /* Softer container shadow to avoid heavy bottom cast */
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
}

/* ===== POMODORO TIMER EASTER EGG ===== */
.pomodoro-timer {
    background: linear-gradient(135deg, var(--primary) 0%, #7cb342 100%);
    border-bottom: 1px solid var(--border);
    padding: var(--space-3) var(--space-4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: top;
    position: sticky;
    top: 82px;
    z-index: 99;
}

.pomodoro-timer.hidden {
    display: none;
}

.pomodoro-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 800px;
    margin: 0 auto;
}

.timer-display {
    display: flex;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-inverse);
}

.timer-input {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    color: var(--text-inverse);
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    padding: var(--space-1) var(--space-2);
    text-align: center;
    width: 3rem;
}

.timer-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.timer-separator {
    margin: 0 var(--space-1);
    font-size: 1.2em;
}

.timer-seconds {
    min-width: 2ch;
}

.timer-controls {
    display: flex;
    gap: var(--space-2);
}

.timer-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    color: var(--text-inverse);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2);
    transition: all 0.2s ease;
}

.timer-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

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

.timer-btn.hidden {
    display: none;
}

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

/* Timer running state */
.pomodoro-timer.running {
    background: linear-gradient(135deg, var(--error) 0%, #c53030 100%);
}

.pomodoro-timer.running .timer-input {
    pointer-events: none;
    opacity: 0.8;
}

/* Export buttons */
.setting-section {
    margin-top: var(--space-6);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-light);
}

.setting-section h4 {
    margin-bottom: var(--space-3);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.export-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.export-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text-primary);
    cursor: pointer;
    font-size: var(--text-sm);
    font-weight: 500;
    transition: all 0.2s ease;
    width: 100%;
    justify-content: flex-start;
}

.export-btn:hover {
    background: var(--surface-2);
    border-color: var(--primary);
    color: var(--primary);
}

.export-btn:active {
    transform: translateY(1px);
}

.export-btn svg {
    flex-shrink: 0;
}

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

.app-title {
    font-size: var(--text-xl); /* Slightly larger */
    font-weight: 700; /* Stronger font weight */
    color: var(--text-primary);
    letter-spacing: -0.025em; /* Slightly tighter letter spacing */
}

.app-subtitle {
    font-size: var(--text-xl); /* Match larger title size */
    color: #a1afbe; /* Lightened by 2 iotas */
    font-family: inherit; /* Use same font as app-title */
    font-weight: 700; /* Match stronger title weight */
    opacity: 0;
    transition: opacity 0.3s ease;
}

.app-subtitle.first-visit {
    opacity: 1;
}

.app-title:hover .app-subtitle {
    opacity: 1;
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    max-width: 400px;
}

.document-title {
    width: 100%;
}

.doc-title-input {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: transparent;
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--text-primary);
    text-align: center;
    transition: var(--transition);
}

.doc-title-input:hover {
    background: var(--surface-2);
    border-color: var(--border);
}

.doc-title-input:focus {
    outline: none;
    background: var(--surface);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Universal form styling */
input[type="text"],
input[type="email"], 
input[type="password"],
input[type="search"],
textarea {
    appearance: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    padding: var(--space-2) var(--space-3);
    transition: var(--transition);
}

input[type="text"]:hover,
input[type="email"]:hover,
input[type="password"]:hover, 
input[type="search"]:hover,
textarea:hover {
    border-color: var(--primary);
    background-color: var(--primary-subtle);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    background-color: var(--surface);
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder,
input[type="search"]::placeholder,
textarea::placeholder {
    color: var(--text-tertiary);
    opacity: 1;
}

.header-right {
    display: flex;
    align-items: center;
}

/* Toolbar */
.toolbar-group {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.view-toggle {
    display: flex;
    background: var(--surface-2);
    border-radius: var(--radius);
    padding: var(--space-1);
    border: 1px solid var(--border);
}

.view-btn {
    padding: var(--space-2) var(--space-3);
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    font-size: var(--text-sm);
}

.view-btn:hover {
    background: var(--primary-subtle);
    color: var(--primary-hover);
}

.view-btn.active {
    background: var(--primary);
    color: var(--text-inverse);
    box-shadow: var(--shadow-sm);
}

.action-btn {
    padding: var(--space-2);
    border: none;
    background: transparent;
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.action-btn.active {
    background: var(--primary);
    color: var(--text-inverse);
    box-shadow: var(--shadow-sm);
}

.action-btn.active:hover {
    background: var(--primary-hover);
}

/* Editor */
.editor-main {
    flex: 1;
    position: relative;
    overflow: visible; /* Allow content + margins to define height gracefully */
}

.editor-container {
    height: 100%;
    padding: var(--space-8) var(--space-12);
    max-width: 800px;
    margin: 0 auto;
    border-radius: 0 0 12px 12px; /* Bottom corner curves */
    border-bottom: 1px solid var(--border); /* Bottom border */
    box-shadow: none; /* Remove heavy bottom shadow near footer */
}

/* Remove container styling for single-pane modes to match split pane simplicity */
.source-mode .editor-container,
.preview-mode .editor-container {
    border-radius: 0;
    border-bottom: none;
    box-shadow: none;
    padding: 0;
}

.editor-content {
    min-height: calc(100vh - 200px);
    outline: none;
    font-size: var(--text-lg);
    line-height: 1.7;
    color: var(--text-primary);
    font-family: var(--font-sans);
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.editor-content:empty:before {
    content: attr(data-placeholder);
    color: var(--text-tertiary);
    pointer-events: none;
}

/* Typography styles in editor */
.editor-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 2rem 0 1rem 0;
    color: var(--text-primary);
    line-height: 1.2;
}

.editor-content h2 {
    font-size: 2rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem 0;
    color: var(--text-primary);
    line-height: 1.3;
}

.editor-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 1.25rem 0 0.5rem 0;
    color: var(--text-primary);
    line-height: 1.4;
}

.editor-content p {
    margin: 0.75rem 0;
    line-height: 1.7;
}

.editor-content strong {
    font-weight: 600;
    color: var(--text-primary);
}

.editor-content em {
    font-style: italic;
}

.editor-content code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--surface-2);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.editor-content blockquote {
    margin: 1rem 0;
    padding: 1rem 1.5rem;
    border-left: 4px solid var(--primary);
    background: var(--surface-2);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic;
}

/* Floating Toolbar - Hidden for now due to icon issues */
.floating-toolbar {
    display: none !important;
}

.floating-toolbar button {
    padding: var(--space-2);
    border: none;
    background: transparent;
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.floating-toolbar button:hover {
    background: var(--primary-subtle);
    color: var(--primary-hover);
}

.floating-toolbar button.active {
    background: var(--primary-light);
    color: var(--primary);
}

/* Slash Menu */
.slash-menu {
    position: absolute;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 300px;
    z-index: 150;
    overflow: hidden;
}

.slash-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--border-light);
}

.slash-item:last-child {
    border-bottom: none;
}

.slash-item:hover {
    background: var(--surface-2);
}

.slash-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--surface-2);
    border-radius: var(--radius);
    color: var(--text-secondary);
}

.slash-text {
    flex: 1;
}

.slash-title {
    font-weight: 500;
    color: var(--text-primary);
    font-size: var(--text-sm);
}

.slash-desc {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

/* Command Palette */
.command-palette {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 20vh;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-slow);
}

.command-palette[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
}

.command-search {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 var(--space-4);
}

.command-search input {
    width: 100%;
    padding: var(--space-4) var(--space-4) var(--space-4) 48px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    font-size: var(--text-lg);
    color: var(--text-primary);
    outline: none;
    box-shadow: var(--shadow-lg);
}

.search-icon {
    position: absolute;
    left: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
}

.shortcut {
    position: absolute;
    right: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    background: var(--surface-2);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.command-results {
    margin-top: var(--space-2);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-height: 400px;
    overflow-y: auto;
}

/* Focus Mode */
.focus-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--surface-2);
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-slow);
    pointer-events: none;
    cursor: pointer;
}

.focus-mode .focus-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.focus-mode .app-header {
    position: relative;
    transition: var(--transition-slow);
    border-bottom: none !important;
    background: transparent;
    /* Remove width constraints to match normal header */
}

.focus-mode .app-header::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 120px; /* Expanded hover area across full width */
    background: transparent;
    z-index: 10;
    opacity: 0;
    transition: var(--transition-slow);
}

.focus-mode .app-header:hover {
    background: transparent; /* Keep header background transparent */
    border-radius: 0;
    border-bottom: none; /* Remove border */
}

.focus-mode .view-toggle {
    position: relative;
    z-index: 15;
    opacity: 0.4;
    transition: var(--transition-slow);
}

.focus-mode .app-header > *:not(.view-toggle) {
    position: relative;
    z-index: 15;
    opacity: 0;
    transition: var(--transition-slow);
}

.focus-mode .app-header:hover .view-toggle {
    opacity: 1;
}

.focus-mode .app-header:hover > * {
    opacity: 1;
}

.focus-mode .editor-main {that didn't
    position: relative;
    z-index: 60;
    background: var(--surface-2);
    margin: 0;
    box-shadow: var(--shadow-xl);
    border-radius: 5px;
}

/* Remove editor-container shadow in focus mode to prevent double shadow */
.focus-mode .editor-container {
    box-shadow: none;
    border-bottom: none;
}

/* Drag & Drop */
.drag-over {
    position: relative;
}

.drag-over::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(59, 130, 246, 0.1);
    border: 3px dashed var(--accent);
    z-index: 1000;
    pointer-events: none;
    animation: dragPulse 1s infinite ease-in-out;
}

.drag-over::after {
    content: 'Drop your .md or .txt file here';
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--accent);
    color: white;
    padding: 1rem 2rem;
    border-radius: var(--radius-lg);
    font-size: 1.125rem;
    font-weight: 500;
    z-index: 1001;
    pointer-events: none;
    box-shadow: var(--shadow-lg);
}

@keyframes dragPulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-slow);
}

.modal[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
}

.modal[aria-hidden="false"] .modal-content {
    display: block;
}

.modal-content { display: none; }

/* New Settings Sheet */
.settings-sheet {
    background: linear-gradient(180deg, rgba(255,255,255,0.94), rgba(255,255,255,0.98));
    border: 1px solid rgba(226,232,240,0.8);
    border-radius: 16px;
    box-shadow: 0 24px 48px rgba(2,6,23,0.18), 0 2px 6px rgba(2,6,23,0.08);
    width: min(720px, 92vw);
    max-height: 82vh;
    overflow: visible; /* Allow dropdowns to render above sheet bounds */
    display: flex;
    flex-direction: column;
}
.settings-header { display:flex; align-items:center; justify-content:space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.settings-header h2 { font-size: 1.1rem; letter-spacing: -0.01em; }
.settings-close { border: 0; background: transparent; cursor: pointer; color: var(--text-secondary); }
.settings-close:hover { color: var(--text-primary); }
.settings-body { display:grid; grid-template-columns: 200px 1fr; min-height: 420px; }
.settings-nav { border-right: 1px solid var(--border); background: var(--surface-2); padding: 12px; }
.settings-nav .nav-item { width:100%; text-align:left; padding:10px 12px; border-radius:10px; border:1px solid transparent; background: transparent; color: var(--text-secondary); cursor:pointer; font-size: 0.98rem; font-weight: 500; }
.settings-nav .nav-item:hover { background: var(--surface-3); color: var(--text-primary); }
.settings-nav .nav-item.active { background: var(--surface); border-color: var(--border); color: var(--text-primary); }
.settings-panels { padding: 14px 18px; overflow: visible; }
.settings-panel { display:none; }
.settings-panel.active { display:block; }
.settings-panel h3 { font-size: 0.95rem; margin: 0 0 8px 0; letter-spacing: -0.01em; color: var(--text-primary); font-weight: 600; }

/* Settings links */
.settings-panels a.text-link, .settings-panels a { color: var(--text-secondary); text-decoration: none; border: 1px solid transparent; border-radius: 8px; padding: 2px 6px; transition: background .15s ease, border-color .15s ease, box-shadow .15s ease; }
.settings-panels a.text-link:hover { background: var(--surface-2); border-color: var(--border); box-shadow: var(--shadow-sm); }

/* Imported from organizethoughts.co (glow highlight + hover emoji) */
.settings-panels .coffee-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    padding: 1px 7px 2px 7px;
    border-radius: 6px;
    margin: 0 -6px;
    box-shadow: 0 0 0 0 rgba(255, 221, 68, 0);
}
.settings-panels .coffee-link:hover {
    background: rgba(255, 221, 68, 0.4);
    color: #000;
    box-shadow: 0 0 8px 4px rgba(255, 221, 68, 0.4), 0 0 16px 8px rgba(255, 221, 68, 0.2);
}
.settings-panels .party-emoji { opacity: 0; transition: opacity 0.2s ease; font-size: 18px; }
.settings-panels .coffee-link:hover .party-emoji { opacity: 1; }

.settings-panels .tevan-link { position: relative; display: inline; }
.settings-panels .cat-emoji { opacity: 0; transition: opacity 0.2s ease; position: absolute; top: -16px; left: 50%; transform: translateX(-50%) rotate(0deg); font-size: 18px; animation: none; }
.settings-panels .tevan-link:hover .cat-emoji { opacity: 1; animation: catStart 3s ease-in-out forwards, catRockInfinite 2s infinite ease-in-out 3s; }
.settings-panels .clarity-highlight { background: rgba(255, 221, 68, 0.4); padding: 0px 3px; border-radius: 3px; box-shadow: 0 0 8px 4px rgba(255, 221, 68, 0.4), 0 0 16px 8px rgba(255, 221, 68, 0.2); }

@keyframes catStart {
    0%, 66.67% { transform: translateX(-50%) rotate(0deg); }
    100%       { transform: translateX(-50%) rotate(25deg); }
}
@keyframes catRockInfinite {
    0%   { transform: translateX(-50%) rotate(25deg); }
    50%  { transform: translateX(-50%) rotate(-18deg); }
    100% { transform: translateX(-50%) rotate(25deg); }
}

/* About/Projects layout */
.about-grid { display:grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.projects-plain { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.25rem; }
.projects-plain li { position: relative; padding-left: 0.9em; }
.projects-plain li::before { content: '•'; position: absolute; left: 0; color: var(--text-primary); }
.projects-plain a { color: var(--text-secondary); text-decoration: none; }
.projects-plain a:hover { color: var(--text-primary); }
.focus-label { font-size: 0.85rem; color: var(--text-tertiary); font-style: italic; margin-left: 6px; }

/* Inline contact form in Settings > About */
.contact-inline { margin-top: 8px; border: 1px solid var(--border); border-radius: 8px; padding: 10px; background: var(--surface); box-shadow: var(--shadow-sm); }
.contact-inline .row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.contact-inline input, .contact-inline textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.9rem; background: var(--surface-2); color: var(--text-primary); }
.contact-inline .actions { display: flex; gap: 8px; margin-top: 8px; }
.contact-inline .btn-send { background: var(--primary); color: var(--text-inverse); border: none; border-radius: 6px; padding: 6px 10px; cursor: pointer; }
.contact-inline .btn-send:hover { background: var(--primary-hover); }
.contact-inline .btn-cancel { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; cursor: pointer; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-4) var(--space-3) var(--space-4); /* Reduced by ~50% */
    border-bottom: 1px solid var(--border-light);
    background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
}

.modal-header h2 {
    font-size: var(--text-2xl);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

.modal-close {
    padding: var(--space-2);
    border: none;
    background: transparent;
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--primary-subtle);
    color: var(--primary-hover);
}

.modal-body {
    padding: var(--space-4); /* Reduced by 50% */
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* Settings */
.settings-group {
    margin-bottom: var(--space-3); /* Further reduced */
    padding: var(--space-3); /* Further reduced */
    background: linear-gradient(135deg, 
        rgba(248, 250, 252, 0.5) 0%, 
        rgba(255, 255, 255, 0.8) 100%);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(226, 232, 240, 0.5);
    backdrop-filter: blur(10px);
}

.settings-group:last-child {
    margin-bottom: 0;
}

.settings-group h3 {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2); /* Further reduced */
    padding-bottom: var(--space-1); /* Further reduced */
    border-bottom: 2px solid var(--primary-subtle);
}

.setting-row { display:grid; grid-template-columns: minmax(160px, 320px) auto; align-items:center; column-gap:24px; row-gap:0; padding: 10px 0; min-height: 44px; border-radius: var(--radius); transition: background 0.2s ease; }

.setting-row:hover {
    background: rgba(101, 163, 13, 0.03);
}

.setting-row label { font-weight: 500; color: var(--text-primary); font-size: 0.95rem; }

.select-input {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-primary);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path fill="%23475569" d="M4.427 6.427L3.013 8.013L8 13L12.987 8.013L11.573 6.427L8 10z"/></svg>');
    background-repeat: no-repeat;
    background-position: right var(--space-2) center;
    padding-right: var(--space-8);
}

.select-input:hover {
    border-color: var(--primary);
    background-color: var(--primary-subtle);
}

.select-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    background-color: var(--surface);
}

/* Custom Dropdown */
.custom-dropdown {
    position: relative;
    display: inline-block;
    min-width: 150px;
    width: 150px; /* Narrower selections to reduce horizontal gap */
    z-index: 10000; /* Ensure dropdown container is above everything */
}

.dropdown-selected {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-primary);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: var(--transition);
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path fill="%23475569" d="M4.427 6.427L3.013 8.013L8 13L12.987 8.013L11.573 6.427L8 10z"/></svg>');
    background-repeat: no-repeat;
    background-position: right var(--space-2) center;
    padding-right: var(--space-8);
    user-select: none;
}

.dropdown-selected:hover {
    border-color: var(--primary);
    background-color: var(--primary-subtle);
}

.dropdown-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    z-index: 100000; /* Ensure on top of sheet and neighbors */
    box-shadow: var(--shadow-lg);
    max-height: 200px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.custom-dropdown.open .dropdown-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-dropdown.open .dropdown-selected {
    border-color: var(--primary);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.dropdown-option {
    padding: var(--space-2) var(--space-3);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    font-size: var(--text-sm);
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-option:last-child {
    border-bottom: none;
}

.dropdown-option:hover {
    background: var(--primary-subtle);
    color: var(--primary-hover);
}

.dropdown-option.selected {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 500;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    display: inline-block;
}

.toggle-switch input {
    opacity: 0;
    width: 100%;
    height: 100%;
    position: absolute;
    z-index: 2;
    cursor: pointer;
    margin: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--surface-2);
    border: 2px solid var(--border);
    border-radius: 24px;
    transition: var(--transition);
    z-index: 1;
}

.toggle-slider:hover {
    border-color: var(--primary);
    background-color: var(--primary-subtle);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    top: 2px;
    background: var(--text-tertiary);
    border-radius: 50%;
    transition: var(--transition);
}

input:checked + .toggle-slider {
    background: var(--primary);
    border-color: var(--primary);
}

input:checked + .toggle-slider:before {
    transform: translateX(20px);
    background: white;
}

input:focus + .toggle-slider {
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Responsive */
@media (max-width: 768px) {
    .app-header {
        padding: var(--space-3) var(--space-4);
    }
    
    .header-center {
        display: none;
    }
    
    .app-title {
        font-size: var(--text-base);
    }
    
    .app-subtitle {
        display: none;
    }
    
    .editor-container {
        padding: var(--space-6) var(--space-4);
    }
    
    .editor-content {
        font-size: var(--text-base);
    }
    
    .view-toggle {
        gap: 0;
    }
    
    .view-btn {
        padding: var(--space-2);
    }
}

/* Tooltips */
[data-tooltip] {
    position: relative;
}

[data-tooltip]:before {
    content: attr(data-tooltip);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #ffffff;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius);
    font-size: var(--text-xs);
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.15s ease;
    z-index: 1000;
    margin-top: var(--space-2);
    box-shadow: var(--shadow-md);
}

[data-tooltip]:after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-bottom-color: #1e293b;
    opacity: 0;
    visibility: hidden;
    transition: all 0.15s ease;
    z-index: 1000;
    margin-top: 2px;
}

[data-tooltip]:hover:before,
[data-tooltip]:hover:after {
    opacity: 1;
    visibility: visible;
}

/* Animation for smooth interactions */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.floating-toolbar,
.slash-menu {
    animation: fadeIn 0.2s ease;
}
/* Split Pane View */
.split-pane {
    display: flex;
    min-height: calc(100vh - 200px); /* Fill tall screens without forcing extra slack */
    height: auto;
    gap: 2rem;
    margin: 0;
    overflow: hidden; /* Prevent container scrolling */
}

.source-pane {
    flex: 1;
    min-width: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.line-numbers-container {
    display: none; /* Hidden by default */
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3rem;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius) 0 0 var(--radius);
    z-index: 1;
    overflow-y: hidden; /* Hide scrollbar but allow scrolling */
    overflow-x: hidden;
}

.line-numbers-container.right {
    left: auto;
    right: 0;
    border-radius: 0 var(--radius) var(--radius) 0;
    border-left: none;
    border-right: 1px solid var(--border);
}

.line-numbers {
    font-family: var(--font-mono);
    font-size: var(--text-base);
    line-height: 1.6;
    padding: 1rem 0.5rem 1rem 0.25rem;
    text-align: right;
    color: var(--text-muted);
    user-select: none;
    pointer-events: none;
    overflow: hidden;
    /* Ensure exact alignment with source editor */
    border-top: 1px solid transparent;
}

.line-number {
    height: 1.6em;
    line-height: 1.6;
    display: block;
}

body.show-line-numbers .line-numbers-container {
    display: block;
}

/* Reset margins first */
body.show-line-numbers .source-editor {
    margin-left: 0;
    margin-right: 0;
}

/* Left side line numbers only */
body.show-line-numbers .line-numbers-container:first-of-type:not(.right) {
    display: block;
}

body.show-line-numbers .line-numbers-container:first-of-type:not(.right) ~ .source-editor {
    margin-left: 3rem;
}

/* Right side line numbers only */  
body.show-line-numbers .line-numbers-container.right:last-of-type {
    display: block;
}

body.show-line-numbers .line-numbers-container.right ~ .source-editor {
    margin-right: 3rem;
}

.preview-pane {
    flex: 1;
    min-width: 0;
    padding-left: 2rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.source-editor {
    flex: 1;
    font-family: var(--font-mono);
    font-size: var(--text-base);
    line-height: 1.6;
    background: var(--surface-editor);
    padding: var(--editor-inner-padding-source);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    white-space: pre-wrap;
    overflow-wrap: break-word;
    overflow-y: auto;
    overflow-x: hidden;
    resize: none;
}

.preview-content {
    flex: 1;
    padding: var(--editor-inner-padding-preview);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-y: auto;
    overflow-x: hidden;
    font-size: var(--text-base);
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    /* Ensure tabs are displayed with proper spacing */
    tab-size: 4;
    -moz-tab-size: 4;
    white-space: pre-wrap;
}

/* Ensure preview content elements also use consistent line-height and wrapping */
.preview-content p,
.preview-content div,
.preview-content li,
.preview-content span,
.preview-content blockquote,
.preview-content pre,
.preview-content code {
    line-height: 1.6;
    margin: 0;
    margin-bottom: 1em;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.preview-content br {
    line-height: 1.6;
}

/* Headings in preview maintain their own line-height for hierarchy */
.preview-content h1,
.preview-content h2,
.preview-content h3,
.preview-content h4,
.preview-content h5,
.preview-content h6 {
    margin: 1.5em 0 0.5em 0;
}

/* Remove excessive top margin for first heading in preview */
.preview-content h1:first-child,
.preview-content h2:first-child,
.preview-content h3:first-child,
.preview-content h4:first-child,
.preview-content h5:first-child,
.preview-content h6:first-child,
.preview-content p:first-child h1,
.preview-content p:first-child h2,
.preview-content p:first-child h3,
.preview-content p:first-child h4,
.preview-content p:first-child h5,
.preview-content p:first-child h6 {
    margin-top: 0;
}

.preview-content h1 { line-height: 1.6; font-size: 2rem; font-weight: 700; }
.preview-content h2 { line-height: 1.6; font-size: 1.75rem; font-weight: 600; }
.preview-content h3 { line-height: 1.6; font-size: 1.5rem; font-weight: 600; }

/* Split Pane Mode Adjustments */
.split-mode .editor-container {
    max-width: none;
    padding: 0 var(--space-8); /* Remove top padding; use external margin on split pane */
    margin-bottom: 0; /* Spacing now handled by .editor-main padding */
    border-radius: 0; /* Option A: match single-pane corners */
    border-bottom: none; /* Remove bottom divider to avoid curved caps */
}

.split-mode .split-pane {
    display: flex;
    margin-top: var(--editor-top-gap); /* Top spacing */
    margin-bottom: calc(var(--editor-top-gap) * 2); /* Bottom spacing = 2x top */
}

.split-mode .single-pane {
    display: none;
}

/* Source/Preview Mode Adjustments */
.source-mode .split-pane,
.preview-mode .split-pane {
    display: none;
}

.source-mode .single-pane,
.preview-mode .single-pane {
    display: block;
}

/* Settings About list inline styling */
.projects-inline {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding: 0;
    margin: 0;
}
.projects-inline a {
    color: var(--text-secondary);
    text-decoration: none;
}
.projects-inline a:hover { color: var(--text-primary); }

.release-note {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0.5rem 0 0.75rem 0; /* Reduced margins */
    font-style: italic;
    opacity: 0.8;
}

.projects-list a:hover {
    color: var(--primary-hover);
    background: rgba(101, 163, 13, 0.08);
    transform: translateX(2px);
}

/* Bottom links section */
.bottom-links {
    border-top: 1px solid rgba(226, 232, 240, 0.6);
    padding-top: 0.75rem; /* Reduced padding */
    margin-top: 0.75rem; /* Reduced margin */
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.coffee-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    font-family: inherit;
}

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

.link-separator {
    color: var(--text-tertiary);
    font-size: 0.875rem;
    font-weight: 400;
}

.feedback-link {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

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

.projects-view, .contact-view {
    transition: transform 0.3s ease, opacity 0.3s ease;
    height: auto !important;
}

.projects-view.slide-out {
    transform: translateX(-100%);
    opacity: 0;
}

.contact-view.slide-in {
    transform: translateX(0);
    opacity: 1;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group input,
.form-group textarea {
    padding: 0.75rem;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.2s ease;
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(101, 163, 13, 0.1);
    background: rgba(255, 255, 255, 0.95);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-tertiary);
    opacity: 0.8;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
}

.btn-back {
    background: none;
    border: 1px solid rgba(226, 232, 240, 0.8);
    color: var(--text-secondary);
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-back:hover {
    color: var(--text-primary);
    border-color: var(--border);
    background: rgba(248, 250, 252, 0.5);
}

.btn-submit {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-submit:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(101, 163, 13, 0.25);
}

.btn-submit:disabled {
    background: var(--text-tertiary);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.form-message {
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
    margin-bottom: 0.5rem;
    animation: slideDown 0.3s ease;
}

.form-message-success {
    background: rgba(34, 197, 94, 0.1);
    color: #059669;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.form-message-error {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

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

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

/* Mobile responsiveness for projects popup */
@media (max-width: 480px) {
    .projects-popup {
        left: 1rem;
        right: 1rem;
        transform: none;
        bottom: 60px;
    }
    
    .projects-content {
        min-width: unset;
        max-width: unset;
        padding: 1.5rem;
    }
    
    .projects-content h3 {
        font-size: 1.125rem;
    }
    
    .projects-list a {
        padding: 0.4rem 0.6rem;
        font-size: 0.9rem;
    }
    
    .focus-label {
        font-size: 0.7rem;
    }
}

/* Preview Mode Reminder */
.preview-mode-reminder {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    z-index: 10001;
    animation: fadeInOut 3s ease;
    pointer-events: none;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0; }
    20%, 80% { opacity: 1; }
}

/* Hide footer in focus mode, show on hover */
.focus-mode .projects-footer {
    opacity: 0;
    pointer-events: auto; /* Allow pointer events so it can be hovered */
    transition: opacity 0.3s ease;
    position: relative;
    z-index: 100; /* Higher than focus overlay */
}

/* Show footer when hovering anywhere in focus mode */
body.focus-mode:hover .projects-footer,
.focus-mode:hover .projects-footer {
    opacity: 1 !important;
}

/* ===== SECRET JOURNAL MODE STYLES ===== */

.journal-mode {
    overflow: hidden;
}

.journal-mode::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        -45deg,
        rgba(248, 250, 252, 0.9),
        rgba(236, 252, 203, 0.8),
        rgba(241, 245, 249, 0.9),
        rgba(220, 252, 231, 0.85)
    );
    background-size: 400% 400%;
    backdrop-filter: blur(8px);
    animation: journalBackgroundFloat 15s ease-in-out infinite;
    z-index: -1;
}

@keyframes journalBackgroundFloat {
    0% {
        background-position: 0% 50%;
        filter: blur(8px) brightness(1);
    }
    25% {
        background-position: 100% 50%;
        filter: blur(10px) brightness(1.05);
    }
    50% {
        background-position: 100% 100%;
        filter: blur(6px) brightness(0.98);
    }
    75% {
        background-position: 0% 100%;
        filter: blur(12px) brightness(1.02);
    }
    100% {
        background-position: 0% 50%;
        filter: blur(8px) brightness(1);
    }
}

.journal-mode .header {
    opacity: 0.3;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.journal-mode .editor-main {
    background: transparent;
    padding: 2rem;
}

.journal-mode .editor-left,
.journal-mode .editor-right {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(226, 232, 240, 0.5);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(12px);
    padding: 2rem;
    box-shadow: 
        0 10px 25px rgba(0, 0, 0, 0.1),
        0 4px 10px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.journal-mode .editor-left:hover,
.journal-mode .editor-right:hover {
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 
        0 15px 35px rgba(0, 0, 0, 0.12),
        0 6px 15px rgba(0, 0, 0, 0.08);
}

.journal-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(101, 163, 13, 0.2);
}

.journal-date {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.journal-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.journal-info {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    font-style: italic;
}

.journal-content {
    min-height: 300px;
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text-primary);
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    font-family: inherit;
    overflow-y: auto;
}

.journal-content[contenteditable="true"] {
    cursor: text;
    padding: 1rem;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(101, 163, 13, 0.2);
    transition: all 0.3s ease;
}

.journal-content[contenteditable="true"]:focus {
    background: rgba(255, 255, 255, 0.5);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(101, 163, 13, 0.1);
}

.journal-content[contenteditable="true"]:empty::before {
    content: attr(placeholder);
    color: var(--text-tertiary);
    font-style: italic;
}

/* Journal mode escape hint */
.journal-mode .editor-main::after {
    content: 'Press ESC to return to editor • Use ← → arrows to navigate days';
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.8);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 500;
    z-index: 1000;
    backdrop-filter: blur(12px);
    animation: fadeInUp 0.5s ease 1s both;
}

/* ===== ENHANCED MARKDOWN STYLES ===== */

/* Headers */
.editor-content h1, .editor-content h2, .editor-content h3,
.editor-content h4, .editor-content h5, .editor-content h6 {
    margin: 1.5rem 0 1rem 0;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-primary);
}

.editor-content h1 { font-size: 2rem; }
.editor-content h2 { font-size: 1.75rem; }
.editor-content h3 { font-size: 1.5rem; }
.editor-content h4 { font-size: 1.25rem; }
.editor-content h5 { font-size: 1.1rem; }
.editor-content h6 { font-size: 1rem; }

/* Horizontal rules */
.editor-content hr {
    border: none;
    border-top: 2px solid var(--border);
    margin: 2rem 0;
    opacity: 0.6;
}

/* Tables */
.editor-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
}

.editor-content td {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-light);
    vertical-align: top;
}

.editor-content tr:nth-child(even) {
    background: var(--surface-2);
}

/* Task lists */
.editor-content .task-list {
    list-style: none;
    padding-left: 0;
}

.editor-content .task-list li {
    padding: 0.25rem 0;
    margin-left: 1.5rem;
    text-indent: -1.5rem;
}

.editor-content .task-done {
    color: var(--text-secondary);
    text-decoration: line-through;
}

.editor-content .task-todo {
    color: var(--text-primary);
}

/* Code blocks with language support */
.editor-content pre {
    background: var(--surface-2);
    padding: 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    margin: 1rem 0;
    overflow-x: auto;
}

.editor-content code {
    background: var(--surface-2);
    padding: 0.2rem 0.4rem;
    border-radius: var(--radius-sm);
    font-size: 0.9em;
    color: var(--primary);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.editor-content pre code {
    background: transparent;
    padding: 0;
    color: var(--text-primary);
}

/* Blockquotes */
.editor-content blockquote {
    border-left: 4px solid var(--primary);
    margin: 1rem 0;
    padding: 1rem 1.5rem;
    background: var(--primary-subtle);
    font-style: italic;
    color: var(--text-secondary);
}

/* Images */
.editor-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin: 1rem 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Links */
.editor-content a {
    color: var(--primary);
    text-decoration: underline;
    transition: color 0.2s ease;
}

.editor-content a:hover {
    color: var(--primary-hover);
}

/* Lists */
.editor-content ul, .editor-content ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

.editor-content li {
    margin: 0.5rem 0;
    line-height: 1.6;
}

/* ===== HELP MODAL STYLES ===== */

.help-modal-content {
    max-width: 900px;
    max-height: 90vh;
}

.help-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
}

.help-column h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary-subtle);
}

.help-section {
    margin-bottom: 2rem;
}

.help-section h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.help-section code {
    display: block;
    background: var(--surface-2);
    padding: 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    white-space: pre-line;
}

.help-section p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-style: italic;
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-light);
}

.shortcut-item:last-child {
    border-bottom: none;
}

.shortcut-item kbd {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.5rem;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.shortcut-item span {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

@media (max-width: 768px) {
    .help-columns {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .help-modal-content {
        max-width: 95vw;
        margin: 1rem;
    }
}

/* Special Characters Modal */
.special-chars-modal-content {
    max-width: 600px;
    max-height: 80vh;
    background: var(--surface);
    border-radius: 16px;
    box-shadow: 0 24px 48px rgba(2,6,23,0.18), 0 2px 6px rgba(2,6,23,0.08);
    border: 1px solid var(--border);
}

.special-chars-hint {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--primary-subtle);
    border-radius: var(--radius);
    border: 1px solid var(--primary-light);
}

.special-chars-hint p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

.special-chars-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 8px;
    padding: 1rem 0;
    max-height: 50vh;
    overflow-y: auto;
}

.special-char-item {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 60px;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1.5rem;
    font-family: var(--font-mono);
    transition: all 0.15s ease;
    user-select: none;
    position: relative;
}

.special-char-item:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.special-char-item:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.special-char-item.copied {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.special-char-item.copied::after {
    content: '✓';
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 0.75rem;
    opacity: 0.8;
}

@media (max-width: 640px) {
    .special-chars-modal-content {
        max-width: 95vw;
        margin: 1rem;
    }
    
    .special-chars-grid {
        grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
        gap: 6px;
    }
    
    .special-char-item {
        height: 50px;
        font-size: 1.25rem;
    }
}

/* ===== SINGLE-COLUMN MODES ===== */

.source-mode .editor-container,
.preview-mode .editor-container {
    display: block;
}

.source-mode .split-pane,
.preview-mode .split-pane {
    display: none;
}

.source-mode .editor-content,
.preview-mode .editor-content {
    display: block;
    max-width: 1200px; /* Wider like split pane */
    margin: 0 auto;
    margin-top: var(--editor-top-gap);
    margin-bottom: calc(var(--editor-top-gap) * 2);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: none;
    min-height: calc(100vh - 200px); /* Match split pane height */
    height: calc(100vh - 200px); /* Ensure it reaches bottom */
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    overflow-y: auto;
}

.source-mode .editor-content {
    font-family: var(--font-mono);
    white-space: pre-wrap;
    line-height: 1.6;
    background: var(--surface-editor); /* Same gray as split pane source editor */
    padding: var(--editor-inner-padding-source); /* Consistent inside padding */
}

/* Force divs in source mode to display as block elements (fix line break issue) */
.source-mode .editor-content div {
    display: block !important;
    width: 100%;
}

.preview-mode .editor-content {
    font-family: var(--font-sans);
    white-space: normal;
    line-height: 1.7;
    padding: var(--editor-inner-padding-preview); /* Consistent inside padding */
}

/* Show line numbers in source mode */
.source-mode.show-line-numbers .editor-content {
    margin-left: auto;
    margin-right: auto;
    position: relative;
}

@media (max-width: 768px) {
    .source-mode .editor-content,
    .preview-mode .editor-content {
        max-width: 100%;
        margin: 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}

/* ===== MARKDOWN SYNTAX HIGHLIGHTING ===== */
/* VS Code Default Theme colors - the gold standard for syntax highlighting */

/* When syntax highlighting is enabled */
.syntax-highlighting .md-header {
    color: #0070f3;
    font-weight: 600;
}

.syntax-highlighting .md-header-marker {
    color: #8a8a8a;
    opacity: 0.8;
    font-weight: 400;
}

.syntax-highlighting .md-bold {
    color: #000000;
    font-weight: 700;
}

.syntax-highlighting .md-italic {
    color: #000000;
    font-style: italic;
}

.syntax-highlighting .md-code-inline {
    color: #d73a49;
    background: #f8f8f8;
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.9em;
}

.syntax-highlighting .md-code-block {
    color: #d73a49;
    background: #f8f8f8;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 0.9em;
    border: 1px solid #e0e0e0;
}

.syntax-highlighting .md-code-fence {
    color: #8a8a8a;
    font-family: var(--font-mono);
    opacity: 0.8;
}

.syntax-highlighting .md-link {
    color: #0070f3;
    text-decoration: underline;
}

.syntax-highlighting .md-link-text {
    color: #0070f3;
}

.syntax-highlighting .md-link-url {
    color: #008000;
    opacity: 0.9;
}

.syntax-highlighting .md-image {
    color: #af00db;
}

.syntax-highlighting .md-list-marker {
    color: #000000;
    font-weight: 600;
}

.syntax-highlighting .md-blockquote {
    color: #6a9955;
    font-style: italic;
    border-left: 4px solid #6a9955;
    padding-left: 1rem;
    margin-left: 0;
    opacity: 0.9;
}

.syntax-highlighting .md-blockquote-marker {
    color: #6a9955;
    opacity: 0.8;
}

.syntax-highlighting .md-strikethrough {
    color: #8a8a8a;
    text-decoration: line-through;
}

.syntax-highlighting .md-table-delimiter {
    color: #8a8a8a;
}

.syntax-highlighting .md-hr {
    color: #8a8a8a;
    opacity: 0.8;
}

.syntax-highlighting .md-task-marker {
    color: #0070f3;
    font-weight: 600;
}

.syntax-highlighting .md-task-marker.incomplete {
    color: #8a8a8a;
}

/* Dark theme colors - VS Code Dark Theme */
[data-theme="dark"] .syntax-highlighting .md-header {
    color: #4FC1FF;
    font-weight: 600;
}

[data-theme="dark"] .syntax-highlighting .md-header-marker {
    color: #808080;
    opacity: 0.8;
    font-weight: 400;
}

[data-theme="dark"] .syntax-highlighting .md-bold {
    color: #D4D4D4;
    font-weight: 700;
}

[data-theme="dark"] .syntax-highlighting .md-italic {
    color: #D4D4D4;
    font-style: italic;
}

[data-theme="dark"] .syntax-highlighting .md-code-inline {
    color: #CE9178;
    background: #0D1117;
    border: 1px solid #30363D;
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.9em;
}

[data-theme="dark"] .syntax-highlighting .md-code-block {
    color: #CE9178;
    background: #0D1117;
    border: 1px solid #30363D;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 0.9em;
}

[data-theme="dark"] .syntax-highlighting .md-code-fence {
    color: #808080;
    font-family: var(--font-mono);
    opacity: 0.8;
}

[data-theme="dark"] .syntax-highlighting .md-link {
    color: #4FC1FF;
    text-decoration: underline;
}

[data-theme="dark"] .syntax-highlighting .md-link-text {
    color: #4FC1FF;
}

[data-theme="dark"] .syntax-highlighting .md-link-url {
    color: #B5CEA8;
    opacity: 0.9;
}

[data-theme="dark"] .syntax-highlighting .md-image {
    color: #C586C0;
}

[data-theme="dark"] .syntax-highlighting .md-list-marker {
    color: #D4D4D4;
    font-weight: 600;
}

[data-theme="dark"] .syntax-highlighting .md-blockquote {
    color: #6A9955;
    font-style: italic;
    border-left: 4px solid #6A9955;
    padding-left: 1rem;
    margin-left: 0;
    opacity: 0.9;
}

[data-theme="dark"] .syntax-highlighting .md-blockquote-marker {
    color: #6A9955;
    opacity: 0.8;
}

[data-theme="dark"] .syntax-highlighting .md-strikethrough {
    color: #808080;
    text-decoration: line-through;
}

[data-theme="dark"] .syntax-highlighting .md-table-delimiter {
    color: #808080;
}

[data-theme="dark"] .syntax-highlighting .md-hr {
    color: #808080;
    opacity: 0.8;
}

[data-theme="dark"] .syntax-highlighting .md-task-marker {
    color: #4FC1FF;
    font-weight: 600;
}

[data-theme="dark"] .syntax-highlighting .md-task-marker.incomplete {
    color: #808080;
}
.settings-nav .nav-item { display:flex; align-items:center; gap:8px; transition: background .15s ease, color .15s ease, border-color .15s ease; }
.settings-nav .nav-ico { width: 18px; display:inline-flex; align-items:center; justify-content:center; }
.about-grid { display:grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.about-sub { margin: 0 0 0.5rem 0; font-size: 0.9rem; color: var(--text-secondary); }
.projects-plain { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.25rem; }
