
:root {
    --bg-body: #0f172a;
    --bg-surface: #1e293b;
    --bg-card: #263345;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-primary: #38bdf8;
    --accent-hover: #0ea5e9;
    --accent-glow: rgba(56, 189, 248, 0.5);
    --border-color: #334155;
    
    --offset-color: #64748b;
    --hex-text: #e2e8f0;
    --ascii-text: #cbd5e1;
    --selection-bg: rgba(56, 189, 248, 0.25);
    
    --font-sans: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --container-width: 1200px;
}

[data-theme="light"] {
    --bg-body: #f8fafc;
    --bg-surface: #ffffff;
    --bg-card: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --accent-primary: #0284c7;
    --accent-hover: #0369a1;
    --accent-glow: rgba(2, 132, 199, 0.3);
    --border-color: #e2e8f0;
    
    --offset-color: #0284c7;
    --hex-text: #334155;
    --ascii-text: #475569;
    --selection-bg: rgba(2, 132, 199, 0.2);
}

/* =========================================
   RESET & BASE
   ========================================= */
* { box-sizing: border-box; margin: 0; padding: 0; }

body { 
    font-family: var(--font-sans); 
    background: var(--bg-body); 
    color: var(--text-primary); 
    min-height: 100vh; 
    display: flex; 
    flex-direction: column; 
    line-height: 1.6;
    overflow-x: hidden;
}

/* Editor Body Override: Prevents window scroll bars, manages its own layout */
body.editor-body { 
    overflow: hidden; 
    height: 100vh; 
}

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-body); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 5px; border: 2px solid var(--bg-body); }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

a { text-decoration: none; color: inherit; transition: color 0.2s; }
button { font-family: inherit; border: none; background: none; cursor: pointer; }
input, select, textarea { font-family: inherit; }

.container { 
    max-width: var(--container-width); 
    margin: 0 auto; 
    padding: 0 1.5rem; 
    width: 100%;
}

/* =========================================
   GLOBAL COMPONENTS
   ========================================= */
.btn-primary {
    background: var(--accent-primary);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    display: inline-block;
    transition: background 0.2s;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-outline {
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    display: inline-block;
    transition: all 0.2s;
}
.btn-outline:hover { border-color: var(--accent-primary); color: var(--accent-primary); }

.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; }

/* =========================================
   HEADER & NAV
   ========================================= */
.app-header { 
    height: 60px; 
    background: var(--bg-surface); 
    border-bottom: 1px solid var(--border-color); 
    display: flex; 
    align-items: center; 
    position: sticky; 
    top: 0; 
    z-index: 50; 
    flex-shrink: 0;
}
.app-header .container { display: flex; justify-content: space-between; align-items: center; }

.logo { font-weight: 800; font-size: 1.25rem; display: flex; align-items: center; gap: 0.5rem; color: var(--text-primary); }
.logo-icon { color: var(--accent-primary); font-family: var(--font-mono); }

.main-nav { display: flex; gap: 1.5rem; align-items: center; }
.nav-link { color: var(--text-secondary); font-weight: 500; font-size: 0.95rem; }
.nav-link:hover, .nav-link.active { color: var(--accent-primary); }
.nav-cta { color: var(--accent-primary); font-weight: 600; }

.icon-btn { color: var(--text-secondary); padding: 0.5rem; border-radius: 4px; display: flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.mobile-menu-btn { display: none; font-size: 1.5rem; color: var(--text-primary); }

/* =========================================
   LANDING PAGES (Hero, Features, Content)
   ========================================= */
.hero-section {
    padding: 6rem 0 4rem;
    text-align: center;
    background: radial-gradient(circle at top, rgba(56, 189, 248, 0.1) 0%, transparent 70%);
}
.hero-title { font-size: 3.5rem; line-height: 1.1; margin-bottom: 1.5rem; letter-spacing: -1px; }
.hero-title span { color: var(--accent-primary); background: linear-gradient(135deg, var(--accent-primary), #a855f7); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero-subtitle { font-size: 1.25rem; color: var(--text-secondary); max-width: 700px; margin: 0 auto 2.5rem; }
.hero-actions { display: flex; gap: 1rem; justify-content: center; }

.features-section, .content-section, .tech-section, .faq-section { padding: 4rem 0; }
.features-section { background: var(--bg-surface); }
.section-header { text-align: center; margin-bottom: 3rem; }
.section-header h2 { font-size: 2rem; margin-bottom: 0.5rem; }

.feature-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: transform 0.2s;
}
.feature-card:hover { transform: translateY(-5px); border-color: var(--accent-primary); }
.feature-icon { font-size: 2rem; margin-bottom: 1rem; display: block; }
.feature-card h2 { font-size: 1.5rem; margin-bottom: 1rem; display: flex; align-items: center; gap: 10px; }
.feature-card ul { padding-left: 1.5rem; color: var(--text-secondary); margin-bottom: 0; }
.feature-card li { margin-bottom: 0.5rem; }

/* Standard Content Pages (About, Privacy, etc) */
.content-wrapper { padding-top: 4rem; padding-bottom: 4rem; }
.content-wrapper h1 { font-size: 2.5rem; margin-bottom: 1.5rem; color: var(--text-primary); }
.content-wrapper h2 { font-size: 1.75rem; margin-top: 2.5rem; margin-bottom: 1rem; color: var(--text-primary); }
.content-wrapper p { margin-bottom: 1.5rem; color: var(--text-secondary); font-size: 1.05rem; }
.content-wrapper ul { margin-bottom: 1.5rem; padding-left: 1.5rem; color: var(--text-secondary); }
.content-wrapper li { margin-bottom: 0.5rem; }

.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; align-items: center; }
.steps-list { padding-left: 1.5rem; color: var(--text-secondary); margin-top: 1rem; }
.steps-list li { margin-bottom: 0.5rem; }
.steps-list strong { color: var(--text-primary); }

.code-preview {
    background: #000;
    padding: 1.5rem;
    border-radius: 8px;
    font-family: var(--font-mono);
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
.code-line { display: flex; gap: 1rem; color: #555; margin-bottom: 0.2rem; font-size: 0.9rem; }
.c-off { color: var(--accent-primary); }
.c-hex { color: #e2e8f0; }
.c-asc { color: #4ade80; border-left: 1px solid #333; padding-left: 1rem; }

.tags-container { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.5rem 0 2rem; }
.tech-tag { background: var(--bg-surface); border: 1px solid var(--border-color); padding: 0.25rem 0.75rem; border-radius: 100px; font-size: 0.85rem; color: var(--text-secondary); }

.check-list { list-style: none; }
.check-list li { margin-bottom: 0.5rem; padding-left: 1.5rem; position: relative; color: var(--text-secondary); }
.check-list li::before { content: "✓"; color: var(--accent-primary); position: absolute; left: 0; font-weight: bold; }

.faq-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.faq-item { background: var(--bg-surface); padding: 1.5rem; border-radius: 8px; border: 1px solid var(--border-color); }
.faq-item h3 { margin-bottom: 0.5rem; font-size: 1.1rem; }
.faq-item p { color: var(--text-secondary); font-size: 0.95rem; }

/* Footer */
.app-footer { background: var(--bg-surface); border-top: 1px solid var(--border-color); padding: 4rem 0 2rem; margin-top: auto; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 4rem; margin-bottom: 3rem; }
.footer-col h4 { margin-bottom: 1.25rem; font-size: 0.9rem; text-transform: uppercase; color: var(--text-muted); letter-spacing: 1px; }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 0.75rem; }
.footer-col a { color: var(--text-secondary); }
.footer-col a:hover { color: var(--accent-primary); }
.footer-bottom { text-align: center; color: var(--text-muted); font-size: 0.85rem; border-top: 1px solid var(--border-color); padding-top: 2rem; }


/* =========================================
   EDITOR SPECIFIC LAYOUT
   ========================================= */
.editor-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; }

/* Editor Toolbar */
.toolbar {
    height: 46px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    gap: 0.5rem;
    flex-shrink: 0;
}
.toolbar-group { display: flex; align-items: center; gap: 0.5rem; padding-right: 0.75rem; margin-right: 0.75rem; border-right: 1px solid var(--border-color); }
.toolbar-group:last-child { border-right: none; margin-right: 0; }

.file-upload-btn, .btn-secondary {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.35rem 0.8rem;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s;
}
.file-upload-btn:hover, .btn-secondary:hover { border-color: var(--accent-primary); color: var(--accent-primary); }

/* Main Editor Area (3 Columns) */
.main-editor-area { display: flex; flex: 1; overflow: hidden; background: var(--bg-body); position: relative; }

/* Sidebars */
.sidebar {
    width: 280px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
}
.sidebar-right { border-right: none; border-left: 1px solid var(--border-color); }

.sidebar-section { padding: 1rem; border-bottom: 1px solid var(--border-color); }
.sidebar-header {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Inspector Form */
.insp-row { display: grid; grid-template-columns: 80px 1fr; gap: 0.5rem; margin-bottom: 0.5rem; align-items: center; font-size: 0.85rem; }
.insp-row label { color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.insp-input {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    color: var(--accent-primary);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    width: 100%;
}
.insp-input:focus { outline: none; border-color: var(--accent-primary); }
.insp-input[readonly] { color: var(--text-secondary); background: rgba(0,0,0,0.1); border-color: transparent; }

/* File Preview */
.preview-box {
    width: 100%;
    height: 160px;
    background: #000;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    margin-bottom: 0.5rem;
}
.preview-image { max-width: 100%; max-height: 100%; object-fit: contain; }
.preview-text { width: 100%; height: 100%; padding: 0.5rem; font-family: var(--font-mono); font-size: 0.75rem; color: #cbd5e1; overflow: auto; white-space: pre-wrap; word-break: break-all; }

/* Search & GoTo Forms */
.sidebar-form { display: flex; flex-direction: column; gap: 1rem; }
.form-group label { display: block; font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 0.3rem; }
.sidebar-input {
    width: 100%;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: var(--font-mono);
}
.sidebar-input:focus { outline: none; border-color: var(--accent-primary); }
.btn-block {
    width: 100%;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: all 0.2s;
    text-align: center;
}
.btn-block:hover { border-color: var(--accent-primary); color: var(--accent-primary); }
.checkbox-group { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--text-secondary); }
.checkbox-label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }

/* Hex Grid Center */
.hex-view-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background: var(--bg-body);
}

.tab-bar {
    display: flex;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    height: 36px;
    overflow-x: auto;
    flex-shrink: 0;
}
.tab {
    padding: 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-right: 1px solid var(--border-color);
    cursor: pointer;
    min-width: 100px;
    max-width: 200px;
    user-select: none;
    height: 100%;
}
.tab.active { background: var(--bg-body); color: var(--accent-primary); border-bottom: 2px solid var(--accent-primary); }
.tab-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tab-close { font-size: 1.1rem; opacity: 0.5; }
.tab-close:hover { opacity: 1; color: #ef4444; }

/* Sticky Header Row */
.hex-header-row {
    display: grid;
    grid-template-columns: 80px minmax(380px, 1fr) minmax(160px, 0.5fr);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    height: 26px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    /* Sticky Positioning */
    position: sticky;
    top: 0;
    z-index: 10;
    align-items: center;
}
.header-offset { text-align: right; padding-right: 10px; border-right: 1px solid var(--border-color); }

/* ALIGNMENT FIX: Use Flex, remove space-between, match .byte sizing */
.header-data { 
    display: flex; 
    padding: 0 0.5rem; 
    /* removed justify-content: space-between */
}
.header-data span { 
    width: 2.5ch; 
    text-align: center; 
    margin-right: 0.5rem; /* Match byte spacing */
}
.header-data span:last-child { margin-right: 0; }

.header-ascii { padding-left: 0.5rem; border-left: 1px solid var(--border-color); }


.hex-scroll-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    outline: none; /* remove focus ring */
}

.hex-grid {
    /* Height is set dynamically in JS */
    display: grid;
    grid-template-columns: 80px minmax(380px, 1fr) minmax(160px, 0.5fr);
    position: relative;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 22px;
}
.hex-col-offset { background: var(--bg-surface); color: var(--offset-color); border-right: 1px solid var(--border-color); position: relative; }
.hex-col-data { background: var(--bg-body); color: var(--hex-text); position: relative; }
.hex-col-ascii { background: var(--bg-surface); color: var(--ascii-text); border-left: 1px solid var(--border-color); position: relative; }

/* Alignment fix: ensure line-height is enforced and padding is managed via CSS */
.pool-row { position: absolute; width: 100%; display: flex; height: 22px; line-height: 22px; }

/* Column-specific alignment for pool-rows */
.hex-col-offset .pool-row { justify-content: flex-end; padding-right: 10px; }
.hex-col-data .pool-row { padding-left: 0.5rem; }
.hex-col-ascii .pool-row { padding-left: 0.5rem; }


.byte { 
    width: 2.5ch; 
    text-align: center; 
    cursor: pointer; 
    border-radius: 2px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    margin-right: 0.5rem; /* Explicit spacing to match header */
}
.byte:last-child { margin-right: 0; }

.byte[data-type="ascii"] { width: 1.5ch; margin-right: 0; letter-spacing: 0.1em; } /* ASCII doesn't need big margins */

.byte:hover { background: rgba(255,255,255,0.1); }
.byte.selected { background: var(--selection-bg); }
.byte.cursor { background: var(--accent-primary); color: #000; font-weight: bold; }
.byte.cursor.insert-mode { border-left: 2px solid #fff; width: 2.5ch; background: var(--selection-bg); color: inherit; }

/* Nibble Highlighting */
.n-active {
    font-weight: 900;
    text-decoration: underline;
    text-decoration-color: #fff;
    text-decoration-thickness: 2px;
}

/* Coloring Rules UI */
.color-rule-list {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 1rem;
    background: var(--bg-body);
}
.color-rule-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}
.color-rule-item:last-child { border-bottom: none; }
.color-preview {
    width: 16px; height: 16px; border-radius: 4px; display: inline-block; margin-right: 8px;
    border: 1px solid rgba(255,255,255,0.2);
}
.rule-remove { color: #ef4444; font-weight: bold; font-size: 1.1rem; padding: 0 0.5rem; }
.rule-remove:hover { color: #f87171; }

.color-form {
    display: grid;
    grid-template-columns: 1fr 60px auto;
    gap: 10px;
    align-items: center;
    background: var(--bg-surface);
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}
.color-input {
    height: 34px;
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-body);
    padding: 0 2px;
}

/* Export Tab UI */
.export-preview {
    width: 100%;
    height: 150px;
    background: var(--bg-body);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    resize: vertical;
    margin-bottom: 1rem;
}
.export-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

/* =========================================
   MODALS & OVERLAYS
   ========================================= */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 100;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(2px);
}
.modal-overlay.hidden { display: none; }

.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    width: 600px;
    max-width: 90vw;
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    display: flex; flex-direction: column;
    max-height: 80vh;
}
.modal-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex; justify-content: space-between; align-items: center;
}
.modal-header h3 { font-size: 1.1rem; }
.modal-tabs { display: flex; border-bottom: 1px solid var(--border-color); background: var(--bg-body); }
.modal-tab {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-right: 1px solid var(--border-color);
}
.modal-tab.active { background: var(--bg-surface); color: var(--accent-primary); border-bottom: 2px solid var(--bg-surface); margin-bottom: -1px; }

.modal-body { padding: 1.5rem; overflow-y: auto; }
.modal-view { display: none; }
.modal-view.active { display: block; }

.tool-section { margin-bottom: 2rem; }
.tool-section h4 { margin-bottom: 0.5rem; color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase; }
.data-row { display: flex; justify-content: space-between; padding: 0.5rem 0; border-bottom: 1px solid var(--border-color); font-size: 0.9rem; }
.data-value { font-family: var(--font-mono); color: var(--accent-primary); }
.histogram-container { height: 100px; background: var(--bg-body); border: 1px solid var(--border-color); width: 100%; }
.histogram-canvas { width: 100%; height: 100%; }

/* Compare Tools */
.compare-controls { display: flex; gap: 1rem; align-items: center; padding-bottom: 1rem; border-bottom: 1px solid var(--border-color); margin-bottom: 1rem; }
.diff-table-container { max-height: 300px; overflow-y: auto; border: 1px solid var(--border-color); }
.diff-table { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 0.85rem; }
.diff-table th { background: var(--bg-body); padding: 0.5rem; text-align: left; position: sticky; top: 0; }
.diff-table td { padding: 0.2rem 0.5rem; border-bottom: 1px solid var(--border-color); }
.diff-mismatch { background: rgba(239, 68, 68, 0.1); }
.diff-val-a { color: #f87171; }
.diff-val-b { color: #4ade80; }

/* Toast Notification (Small & Centered) */
.toast-container { 
    position: fixed; 
    top: 50%; 
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 200; 
    display: flex; 
    flex-direction: column; 
    align-items: center;
    gap: 10px;
    pointer-events: none; /* Let clicks pass through if toast is transparent */
}
.toast {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 6px 12px; /* Smaller padding */
    border-radius: 20px; /* Pill shape */
    box-shadow: 0 5px 20px rgba(0,0,0,0.4);
    display: flex; align-items: center; gap: 8px;
    font-size: 0.8rem;
    color: var(--text-primary);
    /* removed min-width */
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform: translateY(10px);
    white-space: nowrap;
}
.toast.show { 
    opacity: 1; 
    transform: translateY(0);
}
.toast.error { border-color: #ef4444; color: #fca5a5; }
.toast.success { border-color: #4ade80; color: #86efac; }
.toast.info { border-color: #38bdf8; color: #bae6fd; }

/* Drop Overlay */
.drop-overlay {
    position: absolute; top:0; left:0; right:0; bottom:0;
    background: rgba(15, 23, 42, 0.9);
    z-index: 50;
    display: none;
    align-items: center; justify-content: center;
}
.drop-overlay.active { display: flex; }
.drop-content { text-align: center; color: var(--accent-primary); }
.drop-icon { font-size: 4rem; display: block; margin-bottom: 1rem; }

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 1024px) {
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .sidebar { width: 240px; }
}

@media (max-width: 768px) {
    .app-header { padding: 0 1rem; }
    .main-nav { 
        display: none; 
        position: absolute; top: 60px; left: 0; right: 0; 
        background: var(--bg-surface); border-bottom: 1px solid var(--border-color);
        flex-direction: column; padding: 1rem;
        z-index: 49;
    }
    .main-nav.active { display: flex; }
    .mobile-menu-btn { display: block; }
    
    .grid-3, .grid-2, .info-grid, .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
    .hero-title { font-size: 2.5rem; }
    
    /* Editor Mobile */
    .editor-main { height: 100vh; }
    .main-editor-area { flex-direction: column; }
    .sidebar { width: 100%; height: auto; max-height: 25vh; border-right: none; border-bottom: 1px solid var(--border-color); }
    .sidebar-right { border-left: none; }
    .hex-view-container { min-height: 40vh; }
    .hex-col-ascii { display: none; }
    .hex-header-row { display: none; } /* Hide complicated header on mobile */
    .hex-grid { grid-template-columns: 70px 1fr 0px; }
    
    .toolbar { overflow-x: auto; }
}
