/**
 * LOOKITSGRAPHIC ASCII Studio — styles
 * Layout studio (sidebar, canvas, rail), contrôles, éditeur ASCII, export.
 */

:root {
    --primary: #2563eb;
    --primary-light: #3b82f6;
    --primary-dark: #1d4ed8;
    --primary-subtle: rgba(37, 99, 235, 0.08);
    --primary-subtle2: rgba(37, 99, 235, 0.15);
    --bg: #f0f2f5;
    --sidebar-bg: #ffffff;
    --card-bg: #ffffff;
    --card-bg2: #f8fafc;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: rgba(0, 0, 0, 0.07);
    --border-accent: rgba(37, 99, 235, 0.25);
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.06);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
    --transition: 0.18s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    overflow: hidden;
    color: var(--text);
}

/* ========== LAYOUT ========== */
.container {
    flex: 1;
    display: flex;
    padding: 12px;
    gap: 12px;
    height: 100vh;
}

.sidebar {
    width: 310px;
    min-width: 260px;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 24px);
}

.controls {
    display: flex;
    flex-direction: column;
    background: var(--sidebar-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    height: 100%;
    overflow: hidden;
    border: 1px solid var(--border);
}

/* ========== UPLOAD SECTION ========== */
.upload-section {
    padding: 10px;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.drop-zone {
    height: 180px;
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 8px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    background: var(--card-bg2);
}

.drop-zone:hover {
    border-color: var(--primary-light);
    background: var(--primary-subtle);
}

.drop-zone.drag-over {
    border-color: var(--primary);
    background: var(--primary-subtle);
    box-shadow: 0 0 0 3px var(--primary-subtle2);
}

.drop-zone input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

.drop-text {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: center;
    pointer-events: none;
    line-height: 1.5;
}

.drop-zone.has-image .drop-text {
    display: none;
}

.preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 4px;
    overflow: visible;
    cursor: crosshair;
    z-index: 2;
}

.preview-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.2s ease;
    user-select: none;
    pointer-events: none;
}

.drop-zone.has-image .preview {
    display: flex;
}

/* ========== SECTIONS CONTAINER ========== */
.sections-container {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.sections-container::-webkit-scrollbar {
    width: 4px;
}

.sections-container::-webkit-scrollbar-track {
    background: transparent;
}

.sections-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

.sections-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ========== SECTION HEADERS ========== */
.section-wrapper {
    border-bottom: 1px solid var(--border);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--card-bg2);
    cursor: pointer;
    user-select: none;
    transition: background var(--transition);
    position: sticky;
    top: 0;
    z-index: 2;
}

.section-header:hover {
    background: var(--primary-subtle);
}

.section-header:not(.collapsed) {
    background: var(--primary-subtle);
    border-bottom: 1px solid var(--border-accent);
}

.section-header h3 {
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text);
    text-transform: uppercase;
}

.section-header:not(.collapsed) h3 {
    color: var(--primary);
}

.section-header .toggle-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--primary-subtle2);
    transition: transform 0.25s ease, background var(--transition);
    flex-shrink: 0;
}

.section-header .toggle-icon::before {
    content: '▾';
    font-size: 11px;
    color: var(--primary);
    transition: transform 0.25s ease;
    line-height: 1;
}

.section-header.collapsed .toggle-icon::before {
    transform: rotate(-90deg);
}

/* ========== CONTROLS SECTION (COLLAPSE ANIMATION) ========== */
.controls-section {
    overflow: hidden;
    transition: max-height 0.35s ease, padding 0.25s ease;
    max-height: 2000px;
    padding: 6px;
}

.controls-section.collapsed {
    max-height: 0 !important;
    padding-top: 0;
    padding-bottom: 0;
}

/* ========== CONTROLS GRID ========== */
.controls-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    align-items: start;
}

@media (min-width: 600px) {
    .controls-grid {
        grid-template-columns: repeat(2, 1fr);
        align-items: start;
    }
}

/* ========== CONTROL PANEL ========== */
.control-panel {
    background: var(--card-bg2);
    border-radius: var(--radius-sm);
    padding: 8px;
    border: 1px solid var(--border);
    transition: border-color var(--transition);
}

.control-panel:hover {
    border-color: var(--border-accent);
}

.control-panel h4 {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--primary);
    margin-bottom: 7px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--border-accent);
}

/* ========== CONTROL GROUP ========== */
.control-group {
    margin-bottom: 5px;
    padding: 5px 6px;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    transition: border-color var(--transition);
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-group:hover {
    border-color: var(--border-accent);
}

.control-group label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
    letter-spacing: 0.01em;
}

/* ========== RANGE INPUTS ========== */
.control-group input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 3px;
    background: #e2e8f0;
    border-radius: 2px;
    margin: 2px 0;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 13px;
    height: 13px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 0 0 2px rgba(37,99,235,0.15);
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 0 4px rgba(37,99,235,0.2);
}

/* ========== SELECT & NUMBER INPUTS ========== */
.control-group select,
.control-group input[type="number"],
.control-group input[type="text"] {
    width: 100%;
    padding: 4px 7px;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    background: #fff;
    color: var(--text);
    transition: all var(--transition);
    font-weight: 500;
}

.control-group select:focus,
.control-group input[type="number"]:focus,
.control-group input[type="text"]:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(37,99,235,0.12);
}

/* ========== VALUE DISPLAY ========== */
.value-display {
    font-size: 0.82rem;
    color: var(--primary);
    font-weight: 600;
    margin-left: 6px;
}

/* ========== BUTTONS ========== */
button {
    padding: 4px 10px;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-size: 0.78rem;
    font-family: inherit;
}

button:hover {
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

.toggle-button {
    background: var(--primary);
    color: #fff;
    border: 2px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-size: 0.85rem;
    width: 100%;
}

.toggle-button:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.toggle-button.active {
    background: #fff;
    color: var(--primary);
}

.control-button {
    padding: 5px 10px;
    border: 1.5px solid var(--primary);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
}

.control-button:hover {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 6px rgba(37,99,235,0.25);
}

.control-button:active {
    transform: translateY(0);
}

/* ========== EXPORT BUTTON CONTAINER ========== */
.export-button-container {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    background: var(--card-bg2);
}

.control-buttons-row {
    display: flex;
    gap: 6px;
}

.control-buttons-row .control-button {
    flex: 1;
}

.editor-button {
    background: #10b981;
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 6px;
    width: 100%;
    font-size: 0.78rem;
    font-weight: 600;
}

.editor-button:hover {
    background: #059669;
    box-shadow: 0 2px 6px rgba(16,185,129,0.3);
}

.export-button {
    width: 100%;
    padding: 7px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.82rem;
    letter-spacing: 0.02em;
}

.export-button:hover {
    background: var(--primary-dark);
    box-shadow: 0 3px 8px rgba(37,99,235,0.3);
}

#resetBtn {
    background: #fff;
    color: #64748b;
    border: 1.5px solid #e2e8f0;
}

#resetBtn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

/* ========== ZOOM CONTROLS ========== */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px;
    background: var(--primary-subtle);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-accent);
}

.zoom-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.zoom-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.zoom-controls input[type="range"] {
    flex: 1;
    margin: 0;
}

/* ========== RATIO CONTROLS ========== */
.ratio-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin-top: 4px;
}

/* ========== EXPORT SETTINGS ========== */
.export-settings {
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid var(--border);
}

/* ========== AUTOMATION PANEL ========== */
.automation-panel {
    border: 1.5px dashed var(--primary-light) !important;
    background: linear-gradient(135deg, #eff6ff, #f0f9ff) !important;
}

.automation-panel h4 {
    color: var(--primary) !important;
}

.info-value {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-subtle);
    border-radius: 4px;
    padding: 2px 6px;
    margin-top: 2px;
}

.automation-nav {
    display: flex;
    align-items: center;
    gap: 5px;
}

.automation-nav .control-button {
    padding: 3px 8px;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.nav-info {
    flex: 1;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
}

.progress-wrap {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    margin: 4px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

/* ========== SELECTION OVERLAY ========== */
.selection-overlay {
    position: absolute;
    border: 2px solid #ef4444;
    background: rgba(239, 68, 68, 0.12);
    pointer-events: auto;
    display: none;
    z-index: 20;
    border-radius: 2px;
    cursor: move;
    box-sizing: border-box;
    min-width: 10px;
    min-height: 10px;
}

.selection-overlay.active { display: block; }

.selection-overlay.dragging {
    border-color: #dc2626;
    background: rgba(239, 68, 68, 0.2);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.3);
}

.selection-overlay.resizing { border-color: #f87171; }

.resize-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--primary);
    border: 2px solid #fff;
    border-radius: 2px;
    z-index: 21;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.resize-handle-nw { top: -5px; left: -5px; cursor: nw-resize; }
.resize-handle-ne { top: -5px; right: -5px; cursor: ne-resize; }
.resize-handle-sw { bottom: -5px; left: -5px; cursor: sw-resize; }
.resize-handle-se { bottom: -5px; right: -5px; cursor: se-resize; }

.resize-handle:hover {
    background: var(--primary-dark);
    transform: scale(1.2);
}

.preview.selection-mode { cursor: crosshair; }

/* ========== OUTPUT SECTION ========== */
.output-section {
    flex: 1;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    padding: 12px;
    display: flex;
    flex-direction: column;
    position: relative;
    min-width: 0;
    min-height: 0;
    width: 100%;
    height: 100%;
}

.output-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    padding: 6px 8px;
    background: var(--card-bg2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.zoom-control-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.zoom-control-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.zoom-value {
    margin-left: auto;
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 600;
}

#asciiOutput {
    font-family: 'Fira Code', 'Cascadia Code', 'Courier New', monospace;
    background-color: #1e1e1e;
    color: #fff;
    padding: 12px;
    border-radius: var(--radius-sm);
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 0;
}

#asciiOutput .ascii-content {
    white-space: pre;
    font-family: inherit;
    color: inherit;
    transform-origin: center center;
    transition: transform 0.2s ease;
}

/* ========== COLOR PICKERS ========== */
.color-pickers {
    position: absolute;
    bottom: 28px;
    right: 20px;
    display: flex;
    gap: 10px;
}

.color-picker {
    width: 28px;
    height: 28px;
    position: absolute;
    cursor: pointer;
    --picker-color: #ffffff;
    background-color: var(--picker-color);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 4px;
    transition: transform 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.bg-color-picker {
    bottom: -10px;
    right: 4px;
}

.text-color-picker {
    bottom: 6px;
    right: 18px;
}

.text-color-picker::after {
    content: 'T';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(0,0,0,0.5);
    font-weight: 700;
    font-size: 11px;
    text-shadow: 1px 1px 1px rgba(255,255,255,0.5);
    pointer-events: none;
}

.color-picker:hover { transform: scale(1.1); }

.color-picker input[type="color"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    opacity: 0;
    cursor: pointer;
}

.color-picker::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: -1;
}

.color-picker:focus-within::before {
    opacity: 1;
    pointer-events: auto;
}

/* ========== ASCII STYLE SELECT ========== */
#asciiStyle {
    font-family: 'Inter', monospace;
    padding: 6px;
    width: 100%;
    border-radius: var(--radius-sm);
    border: 1px solid #e2e8f0;
    background-color: #fff;
}

/* ========== CLEAN BUTTONS ========== */
#removeGhostChars, #deepCleanChars {
    background: var(--primary);
    color: #fff;
    border: 1.5px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    font-size: 0.72rem;
    width: 100%;
    margin-top: 2px;
}

#removeGhostChars:hover, #deepCleanChars:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

#removeGhostChars.active, #deepCleanChars.active {
    background: #fff;
    color: var(--primary);
}

/* ========== CUSTOM CHARS GROUP ========== */
#customCharsGroup {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border);
}

/* ========== EFFECT SETTINGS ========== */
#effectIntensityGroup {
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid var(--border);
}

/* ========== ASCII EDITOR WINDOW ========== */
.ascii-editor-window {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 1200px;
    height: 90vh;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
}

.ascii-menu-bar {
    display: flex;
    gap: 2px;
    padding: 4px 8px;
    background: var(--card-bg2);
    border-bottom: 1px solid var(--border);
}

.ascii-menu-dropdown {
    position: relative;
    display: inline-block;
}

.ascii-menu-button {
    background: none;
    border: none;
    padding: 4px 10px;
    cursor: pointer;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--text);
}

.ascii-menu-button:hover { background: var(--primary-subtle); }

.ascii-dropdown-content {
    display: none;
    position: absolute;
    background: var(--card-bg);
    min-width: 200px;
    box-shadow: var(--shadow);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    padding: 4px;
    z-index: 1001;
}

.ascii-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 8px;
    border: none;
    background: none;
    cursor: pointer;
    text-align: left;
    border-radius: 4px;
    font-size: 0.78rem;
    color: var(--text);
}

.ascii-menu-item:hover { background: var(--primary-subtle); }

.ascii-menu-separator {
    margin: 3px 0;
    border: none;
    border-top: 1px solid var(--border);
}

.ascii-editor-toolbar {
    display: flex;
    gap: 2px;
    padding: 6px 8px;
    background: var(--card-bg2);
    border-bottom: 1px solid var(--border);
    cursor: move;
}

.ascii-toolbar-btn {
    padding: 6px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
    color: var(--text);
}

.ascii-toolbar-btn:hover { background: var(--primary-subtle); }
.ascii-toolbar-btn.active { background: var(--primary); color: #fff; }

.ascii-toolbar-separator {
    width: 1px;
    background: var(--border);
    margin: 2px 4px;
}

.ascii-editor-area {
    flex: 1;
    overflow: auto;
    padding: 12px;
    background: var(--bg);
}

.ascii-edit-area {
    width: 100%;
    height: 100%;
    padding: 12px;
    font-family: 'Fira Code', 'Cascadia Code', monospace;
    font-size: 13px;
    line-height: 1.2;
    border: 1px solid var(--border);
    resize: none;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    color: var(--text);
}

.ascii-edit-area:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37,99,235,0.12);
}

/* ========== LOADING INDICATOR ========== */
.loading-indicator {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    color: #fff;
    backdrop-filter: blur(2px);
}

.loading-indicator p {
    margin-top: 16px;
    font-weight: 600;
    font-size: 0.95rem;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top: 3px solid #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========== ASCII EDITOR ADVANCED ========== */
.ae-header {
    display: flex;
    align-items: stretch;
    background: var(--card-bg2);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.ae-menu-bar {
    display: flex;
    flex: 1;
    gap: 2px;
    padding: 4px 8px;
    cursor: move;
    user-select: none;
}

.ae-close-btn {
    width: 36px;
    background: transparent;
    border: none;
    border-left: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background var(--transition), color var(--transition);
}

.ae-close-btn:hover {
    background: #ef4444;
    color: #fff;
    transform: none;
    box-shadow: none;
}

.ae-toolbar {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 5px 8px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    flex-shrink: 0;
}

.ae-tool-btn, .ae-action-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    flex-shrink: 0;
}

.ae-tool-btn:hover, .ae-action-btn:hover {
    background: var(--primary-subtle);
    border-color: var(--border-accent);
    transform: none;
    box-shadow: none;
}

.ae-tool-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.ae-tool-separator {
    width: 1px;
    height: 22px;
    background: var(--border);
    margin: 0 3px;
    flex-shrink: 0;
}

.ae-draw-char {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--primary-subtle);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-sm);
    padding: 2px 6px;
}

.ae-draw-char label {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
}

.ae-draw-char input {
    width: 30px;
    height: 24px;
    text-align: center;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: 700;
    border: 1px solid var(--border-accent);
    border-radius: 4px;
    background: #fff;
    color: var(--primary);
    padding: 0;
}

.ae-editor-body {
    flex: 1;
    overflow: hidden;
    padding: 8px;
    background: var(--bg);
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.ae-status-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 10px;
    background: var(--card-bg2);
    border-top: 1px solid var(--border);
    font-size: 0.65rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.ae-status-bar span {
    font-weight: 600;
}

.ae-status-bar span + span::before {
    content: '|';
    margin-right: 12px;
    color: var(--border);
}

.ae-mi-label { flex: 1; }

.ae-mi-shortcut {
    font-size: 0.65rem;
    color: var(--text-muted);
    background: var(--card-bg2);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 1px 4px;
    margin-left: 8px;
}

/* Thèmes aperçu ASCII */
#asciiOutput[data-theme="terminal"] {
    background: #0a0a0a !important;
    color: #33ff66 !important;
}
#asciiOutput[data-theme="neon"] {
    background: #120018 !important;
    color: #ff66ee !important;
}
#asciiOutput[data-theme="paper"] {
    background: #f4e9d8 !important;
    color: #2a1810 !important;
}
#asciiOutput[data-theme="contrast"] {
    background: #000 !important;
    color: #fff !important;
}
#asciiOutput pre.ascii-html-export {
    margin: 0;
    font-family: 'Consolas', 'Courier New', monospace;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1100px) {
    .sidebar { width: 280px; }
}

@media (max-width: 768px) {
    .container { flex-direction: column; padding: 8px; }
    .sidebar { width: 100%; min-width: 0; height: auto; }
    .controls { height: 50vh; }
}

@media (max-height: 700px) {
    .drop-zone { height: 140px; }
}

/* ================================================================
   LOOKITSGRAPHIC · ASCII STUDIO / 2026 INTERFACE
   The original engine styles stay above; this layer only reshapes the UI.
   ================================================================ */
:root {
    --paper: #f3f0e8;
    --paper-2: #e8e3d7;
    --ink: #11110f;
    --acid: #d9ff32;
    --purple: #7357ff;
    --orange: #ff6038;
    --sky: #62bfff;
    --pink: #ff75a8;
    --cyan: #45d9df;
    --yellow: #ffd94f;
    --line: 2px solid var(--ink);
    --hard-shadow: 5px 5px 0 var(--ink);
    --primary: var(--purple);
    --primary-light: #8d76ff;
    --primary-dark: #5839f4;
    --primary-subtle: rgba(115, 87, 255, .12);
    --primary-subtle2: rgba(115, 87, 255, .2);
    --bg: var(--paper);
    --sidebar-bg: #fffdf7;
    --card-bg: #fffdf7;
    --card-bg2: #eee9de;
    --text: var(--ink);
    --text-muted: #5d5b55;
    --border: rgba(17, 17, 15, .22);
    --border-accent: var(--ink);
    --radius: 0;
    --radius-sm: 0;
    --shadow: none;
    --shadow-sm: none;
    --transition: .16s ease;
}

html,
body {
    width: 100%;
    height: 100%;
}

body {
    display: block;
    min-width: 1024px;
    min-height: 620px;
    overflow: hidden;
    background: var(--paper);
    color: var(--ink);
    font-family: "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
}

button,
input,
select {
    font: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 3px solid var(--sky);
    outline-offset: 2px;
}

.studio-header {
    position: fixed;
    z-index: 200;
    inset: 0 0 auto 0;
    height: 80px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 28px;
    border-bottom: 2px solid var(--ink);
    background: rgba(243, 240, 232, .97);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    width: max-content;
    color: var(--ink);
    text-decoration: none;
}

.logo-box {
    width: 53px;
    height: 53px;
    flex: 0 0 53px;
    display: grid;
    place-items: center;
    border: 2px solid var(--ink);
    background: var(--ink);
    box-shadow: 5px 5px 0 var(--acid);
    overflow: hidden;
}

.logo-box img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.brand > b {
    font-size: 18px;
    line-height: 1;
    letter-spacing: -.045em;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 166px;
}

.brand small {
    font: 700 10px/1.6 "Courier New", monospace;
    letter-spacing: .19em;
    text-align: center;
}

.tool-id {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    font: 700 10px/1 "Courier New", monospace;
    letter-spacing: .12em;
}

.tool-id i {
    width: 8px;
    height: 8px;
    border: 1px solid var(--ink);
    border-radius: 50%;
    background: var(--acid);
    flex: none;
}

.tool-id em {
    opacity: .3;
    font-style: normal;
}

.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
}

.privacy-note {
    max-width: 130px;
    font-family: "Courier New", monospace;
    font-size: 8px;
    font-weight: 800;
    line-height: 1.25;
    text-align: right;
}

.header-btn {
    min-height: 37px;
    padding: 0 13px;
    border: var(--line);
    border-radius: 0;
    color: var(--ink);
    font-family: "Courier New", monospace;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .06em;
    cursor: pointer;
    box-shadow: 3px 3px 0 var(--ink);
    transition: transform .12s ease, box-shadow .12s ease;
}

.header-btn:hover,
.welcome-import:hover,
.rail-tool:hover {
    transform: translate(-1px, -1px);
}

.header-btn:active,
.welcome-import:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0 var(--ink);
}

.header-btn-light { background: white; }
.header-btn-acid { background: var(--acid); }

.container {
    position: fixed;
    inset: 80px 0 0;
    display: grid;
    grid-template-columns: 370px minmax(0, 1fr) 98px;
    grid-template-rows: minmax(0, 1fr);
    gap: 0;
    width: 100%;
    height: auto;
    padding: 0;
    background-color: var(--paper);
    background-image:
        linear-gradient(rgba(17, 17, 15, .06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(17, 17, 15, .06) 1px, transparent 1px);
    background-size: 24px 24px;
}

.sidebar {
    width: auto;
    min-width: 0;
    max-width: none;
    height: 100%;
    border-right: var(--line);
    background: #fffdf7;
}

.controls {
    height: 100%;
    border: 0;
    border-radius: 0;
    background: #fffdf7;
    box-shadow: none;
}

.upload-section {
    flex: 0 0 178px;
    padding: 14px;
    border: 0;
    border-bottom: var(--line);
    background: var(--acid);
}

.drop-zone {
    height: 149px;
    padding: 8px;
    overflow: hidden;
    border: var(--line);
    border-radius: 0;
    background: #fffdf7;
    box-shadow: 4px 4px 0 var(--ink);
}

.drop-zone::before,
.drop-zone::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.drop-zone::before {
    top: 8px;
    left: 8px;
    border-top: 2px solid var(--purple);
    border-left: 2px solid var(--purple);
}

.drop-zone::after {
    right: 8px;
    bottom: 8px;
    border-right: 2px solid var(--orange);
    border-bottom: 2px solid var(--orange);
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--ink);
    background: white;
    box-shadow: 6px 6px 0 var(--purple);
}

.drop-text {
    width: 210px;
    color: var(--ink);
    font-family: "Courier New", monospace;
    font-size: 10px;
    font-weight: 900;
    line-height: 1.45;
    text-transform: uppercase;
}

.drop-text::before {
    content: "+";
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    margin: 0 auto 9px;
    border: var(--line);
    background: var(--purple);
    color: white;
    font-size: 22px;
    box-shadow: 3px 3px 0 var(--ink);
}

.drop-badge {
    position: absolute;
    left: 9px;
    bottom: 8px;
    z-index: 11;
    padding: 3px 5px;
    background: var(--ink);
    color: white;
    font-family: "Courier New", monospace;
    font-size: 7px;
    font-weight: 900;
    letter-spacing: .12em;
    pointer-events: none;
}

.drop-zone.has-image .drop-badge { background: var(--orange); color: var(--ink); }

.preview,
.preview-wrapper {
    border-radius: 0;
}

.sections-container {
    flex: 1 1 auto;
    min-height: 0;
    padding: 0;
    overflow-y: auto;
    scrollbar-color: var(--purple) var(--paper-2);
    scrollbar-width: thin;
}

.sections-container::-webkit-scrollbar { width: 10px; }
.sections-container::-webkit-scrollbar-track { background: var(--paper-2); border-left: 1px solid var(--ink); }
.sections-container::-webkit-scrollbar-thumb { background: var(--purple); border: 1px solid var(--ink); }

.section-wrapper {
    margin: 0;
    border: 0;
    border-bottom: var(--line);
    border-radius: 0;
    background: white;
    box-shadow: none;
}

.section-header {
    min-height: 50px;
    padding: 0 15px;
    border: 0;
    border-radius: 0;
    background: white;
}

.section-header::before {
    counter-increment: panel;
    content: "0" counter(panel);
    margin-right: 10px;
    color: var(--purple);
    font-family: "Courier New", monospace;
    font-size: 9px;
    font-weight: 900;
}

.sections-container { counter-reset: panel; }

.section-header:hover { background: var(--paper); }
.section-header:not(.collapsed) { background: var(--purple); color: white; }
.section-header:not(.collapsed)::before { color: var(--acid); }

.section-header h3,
.section-header:not(.collapsed) h3 {
    color: inherit;
    font-size: 12px;
    font-weight: 950;
    letter-spacing: -.01em;
    text-transform: uppercase;
}

.section-header .toggle-icon {
    width: 24px;
    height: 24px;
    border: 1px solid currentColor;
    border-radius: 50%;
}

.section-header .toggle-icon::before {
    color: inherit;
    font-size: 17px;
}

.controls-section {
    max-height: none;
    padding: 13px;
    overflow: visible;
    border-top: var(--line);
    background: var(--paper);
}

.controls-section.collapsed {
    display: none;
    padding: 0;
}

.controls-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.control-panel {
    padding: 11px;
    border: 1px solid var(--ink);
    border-radius: 0;
    background: white;
    box-shadow: 3px 3px 0 var(--paper-2);
}

.control-panel h4 {
    margin: -11px -11px 11px;
    padding: 7px 9px;
    border-bottom: 1px solid var(--ink);
    background: var(--yellow);
    color: var(--ink);
    font-family: "Courier New", monospace;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.control-panel:nth-child(2n) h4 { background: var(--sky); }
.control-panel:nth-child(3n) h4 { background: var(--pink); }
.control-panel:nth-child(4n) h4 { background: var(--cyan); }

.control-group {
    margin-bottom: 10px;
}

.control-group:last-child { margin-bottom: 0; }

.control-group > label {
    color: var(--ink);
    font-family: "Courier New", monospace;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.control-group select,
.control-group input[type="text"],
.control-group input[type="number"] {
    min-height: 38px;
    border: 1px solid var(--ink);
    border-radius: 0;
    background: white;
    color: var(--ink);
    font-family: "Courier New", monospace;
    font-size: 12px;
}

input[type="range"] {
    accent-color: var(--purple);
}

input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--purple);
}

.value-display,
.info-value {
    color: var(--purple);
    font-family: "Courier New", monospace;
    font-size: 10px;
    font-weight: 900;
}

.preset-transfer-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    margin-top: 6px;
}

.preset-transfer-row .control-button {
    min-height: 39px;
    padding: 5px 7px;
    white-space: normal;
    line-height: 1.15;
}

#presetDownloadBtn { background: var(--sky); }
#presetImportBtn { background: var(--acid); }

.preset-transfer-status {
    display: block;
    margin-top: 9px;
    color: var(--text-muted);
    font-family: "Courier New", monospace;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.4;
}

.preset-transfer-status.is-success { color: #18763b; }
.preset-transfer-status.is-error { color: #b42318; }

.control-button,
.toggle-button,
#removeGhostChars,
#deepCleanChars,
.zoom-btn,
.automation-nav button {
    min-height: 36px;
    border: 1px solid var(--ink);
    border-radius: 0;
    background: white;
    color: var(--ink);
    font-family: "Courier New", monospace;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    box-shadow: 2px 2px 0 var(--ink);
}

.toggle-button.active,
.control-button.active {
    background: var(--acid);
    color: var(--ink);
}

.export-button-container {
    flex: 0 0 auto;
    padding: 10px;
    gap: 8px;
    border-top: var(--line);
    background: var(--paper);
}

.export-button-container .control-button,
.editor-button,
.export-button {
    min-height: 37px;
    border: var(--line);
    border-radius: 0;
    font-family: "Courier New", monospace;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
    box-shadow: 3px 3px 0 var(--ink);
}

.editor-button { background: var(--purple); color: white; }
.export-button { background: var(--acid); color: var(--ink); }

.output-section {
    position: relative;
    display: block;
    min-width: 0;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    margin: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: #171713;
    box-shadow: none;
}

.canvas-head {
    position: absolute;
    z-index: 16;
    inset: 0 0 auto 0;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 0 18px;
    border-bottom: var(--line);
    background: var(--paper);
    color: var(--ink);
}

.canvas-head > div:first-child { display: grid; gap: 3px; }
.canvas-head strong { font-size: 12px; font-weight: 950; text-transform: uppercase; }
.eyebrow { color: var(--purple); font-family: "Courier New", monospace; font-size: 8px; font-weight: 900; letter-spacing: .11em; }

.canvas-stats {
    display: flex;
    gap: 7px;
}

.canvas-stats span {
    padding: 5px 7px;
    border: 1px solid var(--ink);
    background: white;
    font-family: "Courier New", monospace;
    font-size: 8px;
    font-weight: 900;
}

.canvas-stats span:last-child { background: var(--cyan); }

.output-controls {
    position: absolute;
    z-index: 18;
    top: 70px;
    right: 12px;
    padding: 5px;
    border: 1px solid rgba(255,255,255,.65);
    border-radius: 0;
    background: var(--ink);
}

.zoom-control-btn {
    width: 31px;
    height: 31px;
    border: 1px solid white;
    border-radius: 0;
    background: transparent;
    color: white;
    font-family: "Courier New", monospace;
}

.zoom-control-btn:hover { background: var(--acid); color: var(--ink); }
.zoom-value { color: var(--acid); font-family: "Courier New", monospace; font-size: 9px; }

#asciiOutput {
    position: absolute;
    inset: 58px 0 0;
    width: auto;
    height: auto;
    display: block;
    padding: 66px 42px 50px;
    overflow: auto;
    background:
        radial-gradient(circle at 50% 50%, rgba(115, 87, 255, .16), transparent 40%),
        #171713;
    color: #f7f4eb;
    font-family: "Courier New", Courier, monospace;
    scrollbar-color: var(--purple) #262620;
}

#asciiOutput::-webkit-scrollbar { width: 11px; height: 11px; }
#asciiOutput::-webkit-scrollbar-track { background: #262620; }
#asciiOutput::-webkit-scrollbar-thumb { background: var(--purple); border: 2px solid #262620; }

.welcome-state {
    position: absolute;
    z-index: 10;
    inset: 58px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 28px;
    overflow: hidden;
    background:
        linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px),
        #171713;
    background-size: 24px 24px;
    color: white;
    text-align: center;
}

body.has-source .welcome-state { display: none; }

.welcome-state::before,
.welcome-state::after {
    content: "";
    position: absolute;
    z-index: 2;
    width: 82px;
    height: 82px;
    pointer-events: none;
}

.welcome-state::before {
    top: 28px;
    left: 30px;
    border-top: 5px solid var(--purple);
    border-left: 5px solid var(--purple);
}

.welcome-state::after {
    right: 30px;
    bottom: 28px;
    border-right: 5px solid var(--acid);
    border-bottom: 5px solid var(--acid);
}

.welcome-ascii-field {
    position: absolute;
    inset: 0;
    z-index: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    color: var(--acid);
    opacity: 0.4;
    font: 700 clamp(10px, 1vw, 13px)/1.02 "Courier New", monospace;
    letter-spacing: 1.5px;
    white-space: pre;
    user-select: none;
    pointer-events: none;
}

.welcome-state > :not(.welcome-ascii-field) {
    position: relative;
    z-index: 1;
}

.welcome-kicker {
    margin-bottom: 12px;
    padding: 5px 8px;
    border: 1px solid white;
    background: var(--purple);
    font-family: "Courier New", monospace;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .16em;
}

.welcome-state h1 {
    max-width: 740px;
    font-size: clamp(37px, 5vw, 76px);
    font-weight: 950;
    letter-spacing: -.075em;
    line-height: .82;
}

.welcome-state h1 em {
    color: var(--acid);
    font-style: normal;
}

.welcome-state p {
    margin: 18px 0;
    color: #c9c6bc;
    font-family: "Courier New", monospace;
    font-size: clamp(9px, .8vw, 12px);
    line-height: 1.5;
}

.welcome-import {
    min-height: 44px;
    padding: 0 16px;
    border: var(--line);
    border-radius: 0;
    background: var(--acid);
    color: var(--ink);
    font-family: "Courier New", monospace;
    font-size: 10px;
    font-weight: 900;
    box-shadow: 5px 5px 0 var(--purple);
    cursor: pointer;
}

.welcome-import span { margin-left: 14px; font-size: 16px; }

.format-list {
    display: flex;
    gap: 6px;
    margin-top: 18px;
}

.format-list span {
    padding: 4px 6px;
    border: 1px solid #77756d;
    color: #b8b5ad;
    font-family: "Courier New", monospace;
    font-size: 7px;
    font-weight: 900;
}

.color-pickers {
    z-index: 18;
    left: 14px;
    bottom: 14px;
    gap: 7px;
}

.color-picker {
    width: 34px;
    height: 34px;
    border: 2px solid white;
    border-radius: 0;
    box-shadow: 3px 3px 0 var(--purple);
}

.tool-rail {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 12px 9px;
    gap: 8px;
    border-left: var(--line);
    background: var(--paper);
}

.rail-tool {
    width: 78px;
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 6px;
    border: 1px solid var(--ink);
    border-radius: 0;
    background: white;
    color: var(--ink);
    box-shadow: 3px 3px 0 var(--ink);
    cursor: pointer;
}

.rail-tool b {
    font-family: "Courier New", monospace;
    font-size: 22px;
    line-height: 1;
}

.rail-tool span {
    font-family: "Courier New", monospace;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .08em;
}

.rail-tool.active { background: var(--purple); color: white; }
.rail-tool:nth-child(3) { background: var(--acid); color: var(--ink); }
.rail-tool:nth-child(4) { background: var(--pink); color: var(--ink); }
.rail-tool:nth-child(5) { background: var(--sky); color: var(--ink); }
.rail-spacer { flex: 1; }
.rail-editor { background: var(--orange); }

.ascii-editor-window {
    border: var(--line);
    border-radius: 0;
    box-shadow: 10px 10px 0 var(--purple);
}

.ascii-editor-titlebar,
.ascii-editor-menubar,
.ascii-editor-toolbar,
.ascii-editor-statusbar {
    border-radius: 0;
}

.loading-indicator {
    z-index: 9999;
    background: rgba(17,17,15,.82);
}

.loading-indicator .spinner {
    border-color: rgba(255,255,255,.25);
    border-top-color: var(--acid);
}

.shortcut-modal {
    position: fixed;
    z-index: 5000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(17,17,15,.76);
}

.shortcut-card {
    width: min(480px, 90vw);
    border: var(--line);
    background: #fffdf7;
    box-shadow: 10px 10px 0 var(--purple);
}

.shortcut-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: var(--line);
    background: var(--acid);
}

.shortcut-head strong { font-size: 16px; font-weight: 950; }
.shortcut-head button { border: 1px solid var(--ink); background: white; width: 28px; height: 28px; cursor: pointer; }
.shortcut-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.shortcut-grid div { display: flex; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--ink); }
.shortcut-grid div:nth-child(odd) { border-right: 1px solid var(--ink); }
.shortcut-grid span { font-size: 11px; font-weight: 800; }
.shortcut-grid kbd { padding: 3px 6px; border: 1px solid var(--ink); background: white; box-shadow: 2px 2px 0 var(--ink); font-family: "Courier New", monospace; font-size: 9px; }

@media (max-width: 1220px) {
    .studio-header { grid-template-columns: minmax(290px, 1fr) auto minmax(250px, 1fr); }
    .privacy-note { display: none; }
    .container { grid-template-columns: 330px minmax(0, 1fr) 90px; }
    .rail-tool { width: 70px; }
}

@media (max-height: 760px) {
    .upload-section { flex-basis: 142px; padding: 10px; }
    .drop-zone { height: 120px; }
    .drop-text::before { width: 26px; height: 26px; margin-bottom: 6px; }
    .rail-tool { min-height: 58px; }
    .welcome-state p { margin: 12px 0; }
    .format-list { margin-top: 11px; }
}

@media (max-width: 900px), (max-height: 560px) {
    body {
        min-width: 0;
        min-height: 0;
        overflow: auto;
    }
    .studio-header {
        position: sticky;
        grid-template-columns: 1fr auto;
        height: 68px;
        padding: 0 12px;
    }
    .logo-box { width: 43px; height: 43px; flex-basis: 43px; }
    .brand > b { font-size: 18px; }
    .tool-id, .header-btn-light, .privacy-note { display: none; }
    .container {
        position: relative;
        inset: auto;
        grid-template-columns: 1fr;
        min-height: calc(100dvh - 68px);
        height: auto;
    }
    .sidebar { height: auto; border-right: 0; border-bottom: var(--line); }
    .controls { height: auto; overflow: visible; }
    .sections-container { max-height: 52dvh; }
    .output-section { min-height: 68dvh; }
    .tool-rail { display: none; }
    .welcome-state h1 { font-size: clamp(34px, 11vw, 58px); }
}
