/* ==========================================================================
   1. FONTS & THEME VARIABLES (Deep Slate Glassmorphism)
   ========================================================================== */

@font-face { font-family: 'Inter'; src: url('/fonts/inter-regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('/fonts/jetbrains-mono-latin-regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('/fonts/jetbrains-mono-latin-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Playfair Display'; src: url('/fonts/playfair-regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Oswald'; src: url('/fonts/oswald-regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }

/* Strict Theme Variables (Deep Slate Glassmorphism Base) */
:root {
    --bg-base: #0b0d10;
    --bg-surface: rgba(20, 23, 29, 0.7);
    --bg-surface-hover: rgba(31, 35, 43, 0.8);
    --border-color: rgba(255, 255, 255, 0.08);
    --accent-primary: #3b82f6;
    --accent-hover: #2563eb;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --danger: #ef4444;
    --warning: #f59e0b;
    --font-ui: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

html.light-theme {
    --bg-base: #f8fafc;
    --bg-surface: rgba(255, 255, 255, 0.7);
    --bg-surface-hover: rgba(241, 245, 249, 0.8);
    --border-color: rgba(0, 0, 0, 0.08);
    --accent-primary: #2563eb;
    --accent-hover: #1d4ed8;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --danger: #dc2626;
    --warning: #d97706;
}

/* ==========================================================================
   2. GLOBAL RESET & UTILITIES
   ========================================================================== */

* { box-sizing: border-box; margin: 0; padding: 0; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

html, body {
    width: 100%;
    max-width: 100vw;
    transition: background-color 0.2s ease;
}

body { 
    background-color: var(--bg-base); 
    color: var(--text-primary); 
    font-family: var(--font-ui); 
    line-height: 1.6; 
}

/* THE "AMBIENT LIGHT" BLOB */
.ambient-glow {
    position: fixed;
    inset: -50%;
    background: radial-gradient(circle at 50% 30%, rgba(59, 130, 246, 0.15) 0%, transparent 60%);
    z-index: -1;
    pointer-events: none;
}
html.light-theme .ambient-glow { background: radial-gradient(circle at 50% 30%, rgba(37, 99, 235, 0.1) 0%, transparent 60%); }

h1, h2, h3 { font-weight: 600; letter-spacing: -0.02em; }
.hidden { display: none !important; }
.hide-desktop { display: none !important; } 
body[data-shape="freeform"] .hide-on-freeform { display: none !important; } 
body:not([data-shape="freeform"]) .show-on-freeform { display: none !important; } 

.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.w-full { width: 100%; }
.w-auto { width: auto; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.text-muted { color: var(--text-secondary); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); font-size: 0.8rem; line-height: 1.4; }
.text-accent { color: var(--accent-primary); }
.divider { height: 1px; background: var(--border-color); margin: 1.5rem 0; }
.divider-v { width: 1px; height: 24px; background: var(--border-color); margin: 0 4px; }
.align-center { align-items: center; }

/* ==========================================================================
   3. STUDIO LAYOUT & HEADER (Glassmorphism)
   ========================================================================== */

.studio-wrapper { 
    display: flex; 
    flex-direction: column; 
    height: 100vh; 
    min-height: 100dvh; 
    border-bottom: 1px solid var(--border-color); 
    transition: opacity 0.3s ease; 
    overflow-x: clip; 
}

body.theater-mode .studio-header,
body.theater-mode .panel,
body.theater-mode .filmstrip,
body.theater-mode .mobile-bottom-nav { opacity: 0.05; pointer-events: none; }
body.theater-mode .canvas-area { z-index: 999; }

.studio-header { 
    height: 60px; display: flex; justify-content: space-between; align-items: center; 
    padding: 0 1.5rem; flex-shrink: 0; transition: opacity 0.3s;
    background: var(--bg-surface); 
    border-bottom: 1px solid var(--border-color); 
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.back-link { color: var(--text-secondary); font-size: 1.2rem; transition: color 0.2s; min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 6px; }
.back-link:hover { color: var(--text-primary); background: var(--bg-surface-hover); }
.logo { font-size: 1.2rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.logo i { color: var(--accent-primary); }
.logo span { color: var(--text-secondary); font-weight: 400; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.history-actions { display: flex; gap: 2px; }
.badge { font-size: 0.75rem; padding: 4px 8px; border-radius: 4px; background: rgba(59,130,246,0.1); color: var(--accent-primary); font-family: var(--font-mono); }

.studio-layout { display: flex; flex: 1; overflow: hidden; }

/* ==========================================================================
   4. PANELS, ACCORDIONS & CONTROLS (Glassmorphism)
   ========================================================================== */

.panel { 
    background: var(--bg-surface); flex-shrink: 0; transition: opacity 0.3s; 
    display: flex; flex-direction: column; position: relative; padding: 0;
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.tools-panel { width: 320px; border-right: 1px solid var(--border-color); }
.export-panel { width: 320px; border-left: 1px solid var(--border-color); }
.panel-scroll-content { padding: 1.5rem; overflow-y: auto; flex: 1; }
.panel-section { margin-bottom: 1.5rem; }

details.panel-accordion { border-bottom: 1px solid var(--border-color); padding-bottom: 1rem; margin-bottom: 1rem; }
details.panel-accordion:last-child { border-bottom: none; }
details.panel-accordion summary { display: flex; justify-content: space-between; align-items: center; cursor: pointer; list-style: none; user-select: none; }
details.panel-accordion summary::-webkit-details-marker { display: none; }
details.panel-accordion summary h3 { font-size: 0.85rem; text-transform: uppercase; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; margin: 0; }
details.panel-accordion summary .caret { color: var(--text-secondary); transition: transform 0.2s; }
details.panel-accordion[open] summary .caret { transform: rotate(180deg); }
.accordion-content { margin-top: 1.5rem; animation: slideDown 0.2s ease-out forwards; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }

.preset-actions { display: flex; gap: 8px; }

.desktop-action-area { 
    position: sticky; bottom: 0; background: transparent; 
    padding: 1.5rem; border-top: 1px solid var(--border-color); 
    z-index: 10; margin-top: auto; 
}

/* ==========================================================================
   5. UI COMPONENTS (Buttons, Inputs, Sliders, Tabs)
   ========================================================================== */

/* Neon Shadow Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0.6rem 1.4rem; border-radius: 9999px; font-weight: 500; cursor: pointer; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); border: none; font-family: var(--font-ui); min-height: 44px; }
.btn i { font-size: 0.85em; display: inline-flex; align-items: center; justify-content: center; }
.btn-primary { 
    background: linear-gradient(180deg, var(--accent-primary) 0%, #1d4ed8 100%); 
    color: #ffffff; border: 1px solid rgba(255, 255, 255, 0.12); 
    /* NEW: Neon Glowing Shadow */
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 -1px 0 rgba(0, 0, 0, 0.1); 
    text-shadow: 0 1px 2px rgba(0,0,0,0.3); 
}
.btn-primary:hover:not(:disabled) { 
    background: linear-gradient(180deg, #5b9af8 0%, var(--accent-hover) 100%); 
    /* Intensify glow on hover */
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -1px 0 rgba(0, 0, 0, 0.1); 
    transform: translateY(-1px); border-color: rgba(255,255,255,0.25); 
}
.btn-primary:active:not(:disabled) { transform: translateY(1px); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(1); box-shadow: none; }
.btn-primary i { color: #ffffff !important; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3)); }

.btn-ghost { background: transparent; color: var(--text-primary); border: 1px solid var(--border-color); }
.btn-ghost:hover { background: var(--bg-surface-hover); }
.btn-sm { min-height: 32px; padding: 0.3rem 0.85rem; font-size: 0.85rem; }
.btn-lg { min-height: 52px; font-size: 1.05rem; padding: 0.7rem 1.8rem; }
.icon-btn { background: rgba(0,0,0,0.5); border: 1px solid var(--border-color); color: white; width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; backdrop-filter: blur(4px); }
.icon-btn:hover { background: var(--accent-primary); border-color: var(--accent-primary); }

.input-dark, .select-dark { width: 100%; background: var(--bg-base); border: 1px solid var(--border-color); color: var(--text-primary); padding: 0.6rem; border-radius: 6px; font-family: var(--font-ui); outline: none; transition: border 0.2s; min-height: 44px; }
.input-dark:focus, .select-dark:focus { border-color: var(--accent-primary); }
.input-row { display: flex; gap: 10px; align-items: center; }

.disabled { opacity: 0.4; pointer-events: none; }
.color-picker { -webkit-appearance: none; -moz-appearance: none; appearance: none; background: transparent; border: 1px solid var(--border-color); width: 44px; height: 44px; padding: 2px; border-radius: 6px; cursor: pointer; }
.color-picker::-webkit-color-swatch-wrapper { padding: 0; }
.color-picker::-webkit-color-swatch { border: none; border-radius: 4px; }
.color-picker[aria-disabled="true"] { opacity: 0.3; cursor: not-allowed; }

.tabs { display: flex; background: var(--bg-base); border-radius: 8px; padding: 4px; border: 1px solid var(--border-color); }
.tab { flex: 1; background: transparent; border: none; color: var(--text-secondary); padding: 8px; border-radius: 6px; cursor: pointer; font-family: var(--font-ui); font-size: 0.85rem; min-height: 40px; font-weight: 500; }
.tab.active { background: var(--bg-surface-hover); color: var(--text-primary); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

.slider-group { margin-bottom: 1rem; }
.slider-group label { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.5rem; }
.slider-group label span { font-family: var(--font-mono); color: var(--text-primary); }
input[type="range"] { width: 100%; accent-color: var(--accent-primary); cursor: pointer; height: 6px; background: var(--border-color); border-radius: 3px; appearance: none; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 16px; height: 16px; background: var(--accent-primary); border-radius: 50%; }

.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; cursor: pointer; min-height: 44px; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent-primary); cursor: pointer; }

.quick-filters { display: flex; gap: 8px; flex-wrap: wrap; padding-bottom: 8px; }
.filter-btn { flex-shrink: 0; background: var(--bg-base); border: 1px solid var(--border-color); color: var(--text-secondary); border-radius: 6px; padding: 0.4rem 0.8rem; font-size: 0.8rem; font-weight: 500; cursor: pointer; transition: all 0.2s; }
.filter-btn:hover { border-color: var(--text-primary); color: var(--text-primary); }
.filter-btn.active { background: rgba(59,130,246,0.1); border-color: var(--accent-primary); color: var(--accent-primary); }

.ratio-row { display: flex; gap: 6px; flex-wrap: wrap; }
.ratio-btn { flex: 1; min-width: 45px; background: var(--bg-base); border: 1px solid var(--border-color); color: var(--text-secondary); padding: 4px; border-radius: 4px; font-size: 0.75rem; font-family: var(--font-mono); cursor: pointer; transition: all 0.2s; }
.ratio-btn:hover { border-color: var(--text-primary); color: var(--text-primary); }
.ratio-btn.active { background: var(--accent-primary); color: white; border-color: var(--accent-primary); }

.shape-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.shape-btn { aspect-ratio: 1; background: var(--bg-base); border: 1px solid var(--border-color); border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; min-height: 44px; }
.shape-btn:hover { border-color: var(--text-secondary); }
.shape-btn.active { border-color: var(--accent-primary); background: rgba(59,130,246,0.1); }
.shape-icon { width: 22px; height: 22px; background: var(--text-secondary); }
.shape-btn.active .shape-icon { background: var(--accent-primary); }
.shape-icon.rect { border-radius: 2px; }
.shape-icon.circle { border-radius: 50%; }
.shape-icon.squircle { clip-path: path('M 11 0 C 3.1 0 0 3.1 0 11 C 0 18.9 3.1 22 11 22 C 18.9 22 22 18.9 22 11 C 22 3.1 18.9 0 11 0 Z'); border-radius: 0; }
.shape-icon.hexagon { clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%); }
.shape-icon.triangle { clip-path: polygon(50% 0%, 0% 100%, 100% 100%); }
.shape-icon.freeform { background: transparent !important; color: var(--text-secondary); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.shape-btn.active .shape-icon.freeform { color: var(--accent-primary); }

.geometry-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.geometry-grid .btn { border-radius: 8px; min-height: 40px; font-size: 1.1rem; padding: 0.5rem; }
.geometry-grid .btn i { font-size: 1em; }

.histogram-box { background: #000; border: 1px solid var(--border-color); border-radius: 6px; overflow: hidden; height: 60px; display: flex; align-items: flex-end; }
#histogramCanvas { width: 100%; height: 100%; display: block; }

/* ==========================================================================
   6. CANVAS WORKSPACE & PREVIEW
   ========================================================================== */

.canvas-area { flex: 1; display: flex; align-items: center; justify-content: center; background: transparent; overflow: hidden; min-height: 0; min-width: 0; padding: 1.5rem; position: relative; }
.drop-zone-layer { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; cursor: pointer; outline: none; }
.drop-zone-layer:focus-visible .empty-state { border-color: var(--accent-primary); box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2); }

.empty-state { text-align: center; color: var(--text-secondary); padding: 3.5rem 2rem; border: 2px dashed var(--border-color); border-radius: 20px; background: var(--bg-surface); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); transition: all 0.3s ease; width: 100%; max-width: 450px; }
.empty-state h2 { color: var(--text-primary); margin-bottom: 0.5rem; font-size: 1.3rem; }
.empty-state:hover, .dropZone.dragover .empty-state, .drop-zone-layer.dragover .empty-state { border-color: var(--accent-primary); background: rgba(59, 130, 246, 0.08); }
.empty-state i { font-size: 3.5rem; margin-bottom: 1rem; color: var(--accent-primary); opacity: 0.9; }

.preview-container { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; position: absolute; inset: 0; padding: 1.5rem; }

.quick-toggles { position: absolute; left: 10px; top: 10px; display: flex; flex-direction: column; gap: 8px; z-index: 10; }

.checkerboard {
    background-image: linear-gradient(45deg, rgba(255,255,255,0.05) 25%, transparent 25%), linear-gradient(-45deg, rgba(255,255,255,0.05) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.05) 75%), linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.05) 75%);
    background-color: var(--bg-surface);
    background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); border: 1px solid var(--border-color);
    display: inline-flex; align-items: center; justify-content: center; overflow: hidden;
    max-width: 100%; max-height: calc(100% - 40px); position: relative;
    touch-action: none;
}
html.light-theme .checkerboard {
    background-image: linear-gradient(45deg, rgba(0,0,0,0.05) 25%, transparent 25%), linear-gradient(-45deg, rgba(0,0,0,0.05) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, rgba(0,0,0,0.05) 75%), linear-gradient(-45deg, transparent 75%, rgba(0,0,0,0.05) 75%);
}
canvas { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; display: block; }
.checkerboard.can-drag { cursor: grab; }
.checkerboard.is-dragging { cursor: grabbing !important; }

.compare-btn { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); color: white; border: 1px solid rgba(255,255,255,0.2); padding: 6px 12px; border-radius: 9999px; font-size: 0.8rem; font-family: var(--font-ui); cursor: pointer; display: flex; align-items: center; gap: 6px; z-index: 10; opacity: 0; transition: opacity 0.2s; user-select: none; }
.checkerboard:hover .compare-btn { opacity: 1; }
.compare-btn:active { background: var(--accent-primary); border-color: var(--accent-primary); }

.preview-toolbar { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.8); backdrop-filter: blur(8px); padding: 8px 20px; border-radius: 20px; font-size: 0.85rem; font-family: var(--font-mono); color: #fff; pointer-events: none; display: flex; align-items: center; gap: 12px; white-space: nowrap; box-shadow: 0 4px 12px rgba(0,0,0,0.3);}
.toolbar-sep { color: rgba(255,255,255,0.3); }

/* ==========================================================================
   7. FILMSTRIP (Asset Queue - Glassmorphism)
   ========================================================================== */

.filmstrip { 
    height: 130px; display: flex; flex-direction: column; flex-shrink: 0; transition: opacity 0.3s; 
    background: var(--bg-surface); 
    border-top: 1px solid var(--border-color); 
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.filmstrip-header { padding: 0.5rem 1.5rem; font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.filmstrip-actions { display: flex; gap: 10px; }
.filmstrip-track { display: flex; gap: 12px; padding: 12px 1.5rem; overflow-x: auto; flex: 1; align-items: center; scrollbar-width: thin; scrollbar-color: var(--border-color) transparent; }

.thumb-card { width: 70px; height: 95px; border-radius: 8px; border: 2px solid transparent; background: #000; overflow: hidden; position: relative; cursor: pointer; flex-shrink: 0; transition: border-color 0.2s; display: flex; flex-direction: column; }
.thumb-card.active { border-color: var(--accent-primary); }
.thumb-img-box { height: 70px; width: 100%; position: relative; }
.thumb-img-box img { width: 100%; height: 100%; object-fit: cover; opacity: 0.6; transition: opacity 0.2s; display: block;}
.thumb-card:hover img, .thumb-card.active img { opacity: 1; }
.thumb-format-select { width: 100%; height: 25px; background: rgba(255,255,255,0.1); color: var(--text-primary); border: none; font-size: 0.65rem; padding: 0 4px; outline: none; border-top: 1px solid var(--border-color); cursor: pointer; font-family: var(--font-mono); text-transform: uppercase;}
.thumb-card .remove-btn { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,0.8); color: white; border: none; width: 20px; height: 20px; border-radius: 50%; font-size: 10px; cursor: pointer; display: none; align-items: center; justify-content: center; }
.thumb-card:hover .remove-btn { display: flex; }
.thumb-card .remove-btn:hover { background: var(--danger); }

/* ==========================================================================
   8. OVERLAYS, MODALS & TOASTS
   ========================================================================== */

.processing-overlay { position: absolute; inset: 0; background: rgba(11, 13, 16, 0.9); z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; backdrop-filter: blur(5px); }
html.light-theme .processing-overlay { background: rgba(255,255,255, 0.9); }
html.light-theme .processing-overlay h3 { color: var(--text-primary); }
.spinner { width: 44px; height: 44px; border: 4px solid var(--border-color); border-top-color: var(--accent-primary); border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 1rem; }
.progress-track { width: 80%; max-width: 300px; height: 6px; background: var(--border-color); border-radius: 3px; margin-top: 1rem; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: var(--accent-primary); transition: width 0.2s; }
@keyframes spin { to { transform: rotate(360deg); } }

.mobile-bottom-nav { display: none; }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 2000; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(5px); opacity: 0; transition: opacity 0.2s; }
.modal-overlay:not(.hidden) { opacity: 1; }
.modal-box { background: var(--bg-surface); backdrop-filter: blur(16px); width: 90%; max-width: 400px; border-radius: 12px; border: 1px solid var(--border-color); overflow: hidden; transform: translateY(20px); transition: transform 0.2s; box-shadow: 0 25px 50px rgba(0,0,0,0.5); }
.modal-overlay:not(.hidden) .modal-box { transform: translateY(0); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; border-bottom: 1px solid var(--border-color); font-weight: 600; }
.close-modal-btn { background: transparent; border: none; color: var(--text-secondary); font-size: 1.2rem; cursor: pointer; }
.close-modal-btn:hover { color: var(--danger); }
.modal-body { padding: 1.5rem; }
.hotkey-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--border-color); font-size: 0.9rem; }
.hotkey-row:last-child { border-bottom: none; }
.hotkey-row kbd { background: var(--bg-base); border: 1px solid var(--border-color); padding: 2px 6px; border-radius: 4px; font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent-primary); }

.toast { 
    position: fixed; bottom: 30px; left: 50%; transform: translate(-50%, 100px); 
    background: var(--accent-primary); color: #ffffff; 
    padding: 14px 28px; border-radius: 8px; font-weight: 600; font-size: 0.95rem; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.1); 
    opacity: 0; transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55); 
    z-index: 1000; pointer-events: none; text-align: center; white-space: nowrap; 
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.toast-shake { animation: shake 0.4s ease-in-out forwards; }
@keyframes shake {
    0%, 100% { transform: translate(-50%, 0); }
    20% { transform: translate(calc(-50% - 5px), 0); }
    40% { transform: translate(calc(-50% + 5px), 0); }
    60% { transform: translate(calc(-50% - 5px), 0); }
    80% { transform: translate(calc(-50% + 5px), 0); }
}

/* ==========================================================================
   9. SEO ARTICLE (BELOW THE FOLD) & VISUAL FAQS
   ========================================================================== */

.seo-content { background: var(--bg-surface); backdrop-filter: blur(16px); border-top: 1px solid var(--border-color); padding: 4rem 1.5rem; color: var(--text-secondary); }
.seo-container { max-width: 1200px; margin: 0 auto; }
.seo-container h2 { color: var(--text-primary); font-size: 2rem; margin-bottom: 1rem; font-family: var(--font-ui); font-weight: 700; }
.seo-container p { font-size: 1.05rem; line-height: 1.8; max-width: 900px; margin-bottom: 3rem; }
.seo-container p strong { color: var(--text-primary); }

.seo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; }
.seo-card { background: var(--bg-base); border: 1px solid var(--border-color); padding: 2rem; border-radius: 12px; transition: transform 0.3s, border-color 0.3s; }
.seo-card:hover { border-color: var(--accent-primary); transform: translateY(-5px); }
.seo-card h3 { color: var(--text-primary); font-size: 1.25rem; margin-bottom: 1rem; display: flex; align-items: center; gap: 10px; }
.seo-card h3 i { color: var(--accent-primary); font-size: 1.4rem; }
.seo-card p { font-size: 0.95rem; line-height: 1.6; margin-bottom: 0; }

.seo-faq-item { background: var(--bg-base); border: 1px solid var(--border-color); border-radius: 8px; margin-bottom: 1rem; overflow: hidden; }
.seo-faq-item details { padding: 1.25rem; cursor: pointer; }
.seo-faq-item summary { font-weight: 600; color: var(--text-primary); display: flex; justify-content: space-between; align-items: center; font-size: 1.1rem; list-style: none; outline: none; }
.seo-faq-item summary::-webkit-details-marker { display: none; }
.seo-faq-item summary::after { content: '+'; font-size: 1.5rem; font-weight: normal; color: var(--accent-primary); transition: transform 0.3s; }
.seo-faq-item details[open] summary::after { content: '−'; transform: rotate(180deg); }
.seo-faq-item p { margin: 1rem 0 0 0; font-size: 0.95rem; color: var(--text-secondary); line-height: 1.6; }

/* ==========================================================================
   10. MEDIA QUERIES & RESPONSIVE ARCHITECTURE
   ========================================================================== */

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }
@media (max-width: 1024px) { .tools-panel, .export-panel { width: 280px; } }

@media (max-width: 900px) {
    body.theater-mode { background: #000; }
    
    .studio-wrapper { height: auto; min-height: 100dvh; }
    .studio-layout { flex: none; overflow: visible; flex-direction: column; }
    
    .canvas-area { 
        order: -1; position: sticky; top: 0; z-index: 40; height: 50vh; min-height: 300px; 
        flex: none; border-bottom: 1px solid var(--border-color); background: transparent; transition: all 0.3s ease;
    }

    body.theater-mode .canvas-area { height: 100vh; height: 100dvh; border-bottom: none; }
    
    .hide-mobile { display: none !important; }
    .hide-desktop { display: block !important; } 
    
    .filmstrip { padding-bottom: 80px; } 
    .thumb-card .remove-btn { display: flex; width: 32px; height: 32px; font-size: 14px; top: -5px; right: -5px; }
    .compare-btn { opacity: 1; bottom: 60px; top: auto; right: 10px; } 

    .mobile-bottom-nav { 
        position: fixed; bottom: 0; left: 0; right: 0;
        background: var(--bg-surface); opacity: 0.95; backdrop-filter: blur(16px);
        display: flex; border-top: 1px solid var(--border-color); z-index: 900; 
        padding-bottom: env(safe-area-inset-bottom); transition: opacity 0.3s;
    }
    .nav-btn {
        flex: 1; background: transparent; border: none; color: var(--text-secondary);
        display: flex; flex-direction: column; align-items: center; justify-content: center;
        padding: 12px 0; font-size: 0.7rem; font-family: var(--font-ui); cursor: pointer; gap: 4px; transition: color 0.2s;
    }
    .nav-btn.active { color: var(--accent-primary); }
    .nav-btn i { font-size: 1.2rem; }
    
    .panel { 
        position: fixed; bottom: 0; left: 0; right: 0; width: 100%; height: 65vh; 
        background: var(--bg-surface); z-index: 1000; border-top-left-radius: 20px; 
        border-top-right-radius: 20px; padding: 0; box-shadow: 0 -10px 40px rgba(0,0,0,0.8);
        transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
        display: flex; flex-direction: column; border: none;
    }
    .panel.sheet-open { transform: translateY(0); }
    
    .mobile-sheet-header {
        display: flex; justify-content: space-between; align-items: center;
        padding: 1rem 1.5rem; border-bottom: 1px solid var(--border-color);
        font-weight: 600; flex-shrink: 0;
    }
    .close-sheet-btn { background: var(--bg-surface-hover); border: none; color: var(--text-primary); width: 32px; height: 32px; border-radius: 50%; cursor: pointer; }
    
    .panel-scroll-content { padding: 1.5rem; overflow-y: auto; flex: 1; }
    
    details.panel-accordion summary { display: none; }
    details.panel-accordion { border: none; margin: 0; padding: 0; display: none; }
    details.panel-accordion.active-sheet-section { display: block; }
    
    .seo-content { padding: 3rem 1.5rem; }
    .seo-container h2 { font-size: 1.75rem; }
}