/* ============================================================
   Darksteady Normal Map Gen — Style Sheet
   Design System: Neon Dark (matches DarksteadyHub suite)
   ============================================================ */

/* --- CSS Variables --- */
:root {
    --bg-color:       #0a0a0a;
    --surface-color:  #141414;
    --surface-light:  #1e1e1e;
    --surface-mid:    #222;
    --primary-color:  #a3ff00;
    --primary-glow:   rgba(163, 255, 0, 0.35);
    --primary-dim:    rgba(163, 255, 0, 0.12);
    --primary-dark:   rgba(163, 255, 0, 0.06);
    --danger-color:   #ff4444;
    --danger-glow:    rgba(255, 68, 68, 0.3);
    --info-color:     #00c8ff;
    --info-glow:      rgba(0, 200, 255, 0.25);
    --text-color:     #ffffff;
    --text-muted:     #888899;
    --text-dim:       #555566;
    --border-color:   #2a2a2a;
    --border-light:   #333;
    --transition:     all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
    --radius-sm:      8px;
    --radius-md:      12px;
    --radius-lg:      20px;
    --radius-xl:      28px;

    --topbar-h:   52px;
    --status-h:   28px;
    --left-w:     272px;
    --right-w:    284px;
    --font:       'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono:  'JetBrains Mono', 'Fira Code', monospace;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 13px; }

body {
    font-family: var(--font);
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-image: radial-gradient(
        circle at 50% 0%,
        rgba(163, 255, 0, 0.06) 0%,
        transparent 60%
    );
}

/* ============================================================
   ONBOARDING OVERLAY
   ============================================================ */
.onboarding-overlay {
    position: fixed; inset: 0;
    background: rgba(5, 5, 5, 0.95);
    backdrop-filter: blur(16px);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.4s ease;
}

.onboarding-card {
    background: rgba(20, 20, 20, 0.9);
    border: 1px solid rgba(163, 255, 0, 0.2);
    border-radius: var(--radius-xl);
    padding: 44px 52px;
    max-width: 580px;
    width: calc(100% - 40px);
    text-align: center;
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.9),
        inset 0 0 0 1px rgba(163, 255, 0, 0.08),
        0 0 60px rgba(163, 255, 0, 0.06);
    animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.onboarding-logo {
    display: flex; align-items: center; justify-content: center; gap: 14px;
    margin-bottom: 20px;
}

.onboarding-logo h1 {
    font-size: 1.6rem; font-weight: 800; letter-spacing: -0.5px;
    color: var(--text-color);
}
.onboarding-logo h1 span { color: var(--primary-color); text-shadow: 0 0 20px var(--primary-glow); }

.onboarding-card > p {
    color: var(--text-muted); font-size: 0.95rem;
    line-height: 1.6; margin-bottom: 28px;
}

.onboarding-features {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 10px; margin-bottom: 32px;
}

.ob-feat {
    display: flex; align-items: center; gap: 8px;
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.82rem; color: var(--text-muted);
    text-align: left;
    transition: var(--transition);
}
.ob-feat:hover { border-color: rgba(163, 255, 0, 0.3); color: var(--text-color); }
.ob-icon { font-size: 1rem; }

.ob-skip {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    margin-top: 14px; font-size: 0.78rem; color: var(--text-dim);
    cursor: pointer;
}
.ob-skip input { accent-color: var(--primary-color); }

/* ============================================================
   APP WRAPPER
   ============================================================ */
.app {
    display: flex; flex-direction: column;
    height: 100vh; overflow: hidden;
}
.app.hidden { display: none; }

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
    height: var(--topbar-h);
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center;
    padding: 0 16px; gap: 0;
    flex-shrink: 0; z-index: 100;
}

.topbar-logo {
    display: flex; align-items: center; gap: 10px;
    margin-right: 24px; min-width: 200px;
}
.app-name {
    font-size: 0.95rem; font-weight: 700; color: var(--text-color);
    white-space: nowrap; letter-spacing: -0.3px;
}
.app-name .accent {
    color: var(--primary-color);
    text-shadow: 0 0 12px var(--primary-glow);
}

.topbar-nav {
    display: flex; align-items: center; gap: 4px; flex: 1;
}

.nav-btn {
    padding: 5px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: var(--font); font-size: 0.8rem; font-weight: 500;
    cursor: pointer; transition: var(--transition); white-space: nowrap;
}
.nav-btn:hover {
    background: var(--surface-light);
    border-color: var(--border-light);
    color: var(--text-color);
}
.nav-btn-primary {
    background: var(--primary-dim) !important;
    border-color: rgba(163, 255, 0, 0.4) !important;
    color: var(--primary-color) !important;
    font-weight: 700 !important;
}
.nav-btn-primary:hover {
    background: var(--primary-color) !important;
    color: var(--bg-color) !important;
    box-shadow: 0 0 18px var(--primary-glow) !important;
}

.nav-separator {
    width: 1px; height: 20px;
    background: var(--border-color); margin: 0 8px;
}

.topbar-right {
    display: flex; align-items: center; gap: 8px; margin-left: auto;
}

.icon-btn {
    width: 32px; height: 32px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem; transition: var(--transition);
}
.icon-btn:hover {
    background: var(--surface-light);
    border-color: rgba(163, 255, 0, 0.3);
    color: var(--primary-color);
}

.gpu-badge {
    display: flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    background: rgba(163, 255, 0, 0.08);
    border: 1px solid rgba(163, 255, 0, 0.25);
    border-radius: 20px;
    font-size: 0.72rem; color: var(--primary-color);
    font-family: var(--font-mono);
}
.gpu-dot {
    width: 6px; height: 6px;
    border-radius: 50%; background: var(--primary-color);
    box-shadow: 0 0 8px var(--primary-glow);
    animation: pulse 2s infinite;
}

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
.main-layout {
    flex: 1;
    display: grid;
    grid-template-columns: var(--left-w) 1fr var(--right-w);
    min-height: 0; overflow: hidden;
}

/* ============================================================
   PANELS (Left & Right)
   ============================================================ */
.left-panel, .right-panel {
    background: var(--surface-color);
    border-right: 1px solid var(--border-color);
    overflow-y: auto; overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--border-light) transparent;
}
.right-panel { border-right: none; border-left: 1px solid var(--border-color); }

.left-panel::-webkit-scrollbar,
.right-panel::-webkit-scrollbar { width: 4px; }
.left-panel::-webkit-scrollbar-thumb,
.right-panel::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

.panel-section {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
}

.section-title {
    font-size: 0.68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--text-dim); margin-bottom: 10px;
}

.section-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px;
}
.section-header .section-title { margin-bottom: 0; }

/* ── Drop Zone ── */
.dropzone {
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-lg);
    padding: 20px 14px;
    text-align: center; cursor: pointer;
    transition: var(--transition);
    background: rgba(0, 0, 0, 0.3);
    position: relative;
}
.dropzone:hover, .dropzone.drag-over {
    border-color: var(--primary-color);
    background: var(--primary-dark);
    box-shadow: 0 0 30px rgba(163, 255, 0, 0.08) inset;
}
.dropzone.drag-over { transform: scale(1.01); }

.dz-icon { color: var(--primary-color); margin-bottom: 8px; filter: drop-shadow(0 0 10px var(--primary-glow)); transition: var(--transition); }
.dropzone:hover .dz-icon { transform: translateY(-4px) scale(1.05); }
.dz-text { font-size: 0.85rem; font-weight: 600; color: var(--text-color); }
.dz-sub { font-size: 0.72rem; color: var(--text-muted); margin: 4px 0 12px; }
.dz-hint { font-size: 0.68rem; color: var(--text-dim); margin-top: 8px; }
.dz-actions { display: flex; gap: 6px; justify-content: center; }

/* ── File Info ── */
.file-info {
    margin-top: 10px;
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px;
    display: flex; gap: 10px; align-items: flex-start;
}
.file-thumb-wrap { position: relative; flex-shrink: 0; }
.file-thumb {
    width: 56px; height: 56px;
    object-fit: cover; border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}
.file-clear-btn {
    position: absolute; top: -5px; right: -5px;
    width: 18px; height: 18px;
    background: var(--danger-color); border: none; border-radius: 50%;
    color: white; font-size: 0.6rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.file-meta { display: flex; flex-direction: column; gap: 2px; }
.file-name { font-size: 0.75rem; font-weight: 600; color: var(--text-color); word-break: break-all; }
.file-dims, .file-size { font-size: 0.68rem; color: var(--text-muted); font-family: var(--font-mono); }

/* ── Batch ── */
.batch-panel { margin-top: 10px; }
.batch-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.batch-title { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); }
.batch-count {
    font-size: 0.68rem; font-family: var(--font-mono);
    background: var(--primary-dim); color: var(--primary-color);
    padding: 2px 7px; border-radius: 20px; font-weight: 700;
}
.batch-list {
    max-height: 110px; overflow-y: auto;
    border: 1px solid var(--border-color); border-radius: var(--radius-sm); margin-bottom: 8px;
}
.batch-item {
    display: flex; align-items: center; gap: 6px;
    padding: 4px 8px; font-size: 0.72rem;
    border-bottom: 1px solid var(--border-color);
}
.batch-item:last-child { border-bottom: none; }
.batch-item-name { flex: 1; color: var(--text-muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.batch-item-status { font-size: 0.65rem; color: var(--text-dim); }

/* ── Layers ── */
.layers-list { display: flex; flex-direction: column; gap: 4px; min-height: 36px; }
.layer-item {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 8px;
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer; transition: var(--transition);
}
.layer-item:hover { border-color: rgba(163, 255, 0, 0.3); }
.layer-item.active { border-color: var(--primary-color); background: var(--primary-dark); box-shadow: 0 0 10px rgba(163, 255, 0, 0.08); }
.layer-thumb { width: 24px; height: 24px; border-radius: 3px; object-fit: cover; flex-shrink: 0; background: var(--surface-mid); }
.layer-name { flex: 1; font-size: 0.75rem; color: var(--text-muted); }
.layer-opacity { font-size: 0.68rem; color: var(--text-dim); font-family: var(--font-mono); }

/* ── History ── */
.history-list { max-height: 130px; overflow-y: auto; }
.history-item {
    display: flex; align-items: center; gap: 6px;
    padding: 4px 6px; border-radius: var(--radius-sm);
    cursor: pointer; font-size: 0.72rem; color: var(--text-muted);
    transition: var(--transition);
}
.history-item:hover { background: var(--surface-light); }
.history-item.current { background: var(--primary-dark); color: var(--primary-color); }
.history-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border-light); flex-shrink: 0; }
.history-item.current .history-dot { background: var(--primary-color); box-shadow: 0 0 6px var(--primary-glow); }
.history-empty { font-size: 0.72rem; color: var(--text-dim); text-align: center; padding: 8px; }
.history-actions { display: flex; gap: 4px; }

/* ============================================================
   CENTER — PREVIEW
   ============================================================ */
.center-panel {
    display: flex; flex-direction: column;
    background: #060606; min-height: 0; overflow: hidden;
}

.preview-tabs {
    display: flex; align-items: center;
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    padding: 0 12px; flex-shrink: 0;
    height: 38px; gap: 2px; overflow-x: auto;
}
.preview-tab {
    padding: 5px 14px;
    background: transparent; border: none; border-radius: var(--radius-sm);
    color: var(--text-muted); font-family: var(--font);
    font-size: 0.8rem; font-weight: 500; cursor: pointer;
    transition: var(--transition); white-space: nowrap;
}
.preview-tab:hover { color: var(--text-color); background: var(--surface-light); }
.preview-tab.active {
    color: var(--primary-color);
    background: var(--primary-dark);
    border-bottom: 2px solid var(--primary-color);
}
.preview-tab-spacer { flex: 1; }

.preview-controls-3d,
.preview-controls-2d,
.preview-controls-tiled {
    display: flex; align-items: center; gap: 4px;
}

/* ── Viewports ── */
.viewport {
    flex: 1; position: relative;
    background: #050505; min-height: 0; overflow: hidden;
}
.viewport.hidden { display: none; }
.viewport.active { display: flex; align-items: center; justify-content: center; }

#three-canvas { width: 100%; height: 100%; display: block; }

.viewport-hint {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    text-align: center; color: var(--text-dim); font-size: 0.85rem;
    pointer-events: none;
}

.viewport-overlay-info {
    position: absolute; top: 10px; left: 10px;
    font-family: var(--font-mono); font-size: 0.68rem;
    color: rgba(163, 255, 0, 0.25);
}

/* ── Light Controls ── */
.light-control {
    position: absolute; bottom: 12px; left: 12px;
    display: flex; align-items: center; gap: 8px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md); padding: 6px 12px;
}
.light-label { font-size: 0.68rem; color: rgba(255, 255, 255, 0.35); }

/* ── 2D Viewport ── */
#canvas-2d { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }

.map-selector-2d {
    position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 3px;
    background: rgba(10, 10, 10, 0.85); backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px; padding: 4px 8px;
}
.map-sel-btn {
    padding: 3px 10px; border: none;
    border-radius: 16px; background: transparent;
    color: rgba(255, 255, 255, 0.4); font-size: 0.72rem; font-family: var(--font);
    cursor: pointer; transition: var(--transition);
}
.map-sel-btn.active, .map-sel-btn:hover {
    background: var(--primary-color); color: var(--bg-color); font-weight: 700;
}

.channel-viewer {
    position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 3px;
    background: rgba(10, 10, 10, 0.8); backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md); padding: 4px;
}
.ch-btn {
    width: 28px; height: 22px;
    border: none; border-radius: var(--radius-sm);
    background: transparent; color: rgba(255, 255, 255, 0.35);
    font-size: 0.68rem; font-weight: 700; cursor: pointer; font-family: var(--font);
    transition: var(--transition);
}
.ch-btn.active { background: var(--primary-color); color: var(--bg-color); }

/* ── Compare Viewport ── */
.compare-container { position: relative; width: 100%; height: 100%; display: flex; }
.compare-canvas { flex: 1; object-fit: contain; }
.compare-divider {
    position: absolute; top: 0; left: 50%;
    width: 3px; height: 100%;
    background: var(--primary-color);
    box-shadow: 0 0 12px var(--primary-glow);
    cursor: ew-resize;
    display: flex; align-items: center; justify-content: center;
}
.compare-handle {
    width: 28px; height: 28px;
    background: var(--primary-color); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--bg-color); font-size: 0.8rem;
    box-shadow: 0 0 20px var(--primary-glow);
}
.compare-labels {
    position: absolute; bottom: 12px; width: 100%;
    display: flex; justify-content: space-around; pointer-events: none;
}
.compare-label-left, .compare-label-right {
    font-size: 0.72rem; color: rgba(255, 255, 255, 0.5);
    background: rgba(0, 0, 0, 0.6); padding: 2px 10px; border-radius: 20px;
}
.compare-mode-btns { position: absolute; top: 10px; right: 12px; display: flex; gap: 4px; }

/* ============================================================
   OUTPUT MAPS STRIP
   ============================================================ */
.output-strip {
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.output-strip-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 7px 14px 4px;
}
.strip-title {
    font-size: 0.68rem; font-weight: 700; color: var(--text-dim);
    text-transform: uppercase; letter-spacing: 0.08em;
}
.strip-actions { display: flex; gap: 6px; }

.output-maps-row {
    display: flex; gap: 8px; padding: 8px 14px 12px;
    overflow-x: auto;
    scrollbar-width: thin; scrollbar-color: var(--border-color) transparent;
}
.output-maps-row::-webkit-scrollbar { height: 3px; }
.output-maps-row::-webkit-scrollbar-thumb { background: var(--border-light); }

/* ── Map Cards ── */
.map-card {
    display: flex; flex-direction: column;
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    min-width: 90px; max-width: 90px;
    transition: var(--transition); cursor: pointer; flex-shrink: 0;
}
.map-card:hover {
    border-color: rgba(163, 255, 0, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(163, 255, 0, 0.12);
}
.map-card.active { border-color: var(--primary-color); box-shadow: 0 0 0 2px var(--primary-dim); }
.map-card-special { border-style: dashed; border-color: rgba(163, 255, 0, 0.3); }
.map-card-special:hover { border-color: var(--primary-color); box-shadow: 0 6px 18px rgba(163, 255, 0, 0.15); }

.map-thumb-canvas {
    width: 88px; height: 88px; display: block;
    background: linear-gradient(135deg, #111, #0a0a0a);
    image-rendering: pixelated;
}

.map-card-label {
    font-size: 0.62rem; font-weight: 700;
    color: var(--text-dim); text-align: center;
    padding: 3px 4px 0; text-transform: uppercase; letter-spacing: 0.06em;
}

.map-card-actions {
    display: flex; justify-content: center; gap: 4px; padding: 3px 4px;
}
.map-dl-btn, .map-eye-btn {
    width: 22px; height: 18px;
    background: transparent; border: none;
    border-radius: var(--radius-sm); cursor: pointer;
    font-size: 0.7rem; color: var(--text-dim); transition: var(--transition);
}
.map-dl-btn:hover { background: var(--primary-dim); color: var(--primary-color); }
.map-eye-btn.active { color: var(--primary-color); }
.map-eye-btn:hover { color: var(--primary-color); }

.map-card-format { padding: 0 4px 4px; }
.format-select {
    width: 100%;
    background: var(--surface-mid); border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); color: var(--text-muted);
    font-size: 0.62rem; padding: 2px 4px; font-family: var(--font); cursor: pointer;
}
.format-select:focus { outline: none; border-color: rgba(163, 255, 0, 0.4); }

/* ============================================================
   RIGHT PANEL — CONTROLS
   ============================================================ */

/* ── Engine Info ── */
.engine-info {
    margin-top: 8px; font-size: 0.72rem; color: var(--text-dim); line-height: 1.5;
    padding: 6px 8px; background: var(--surface-light);
    border-radius: var(--radius-sm); border: 1px solid var(--border-color);
    border-left: 2px solid rgba(163, 255, 0, 0.4);
}

/* ── Algorithm Grid ── */
.algo-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 4px; margin-bottom: 12px;
}
.algo-btn {
    padding: 8px 7px;
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer; text-align: left; transition: var(--transition);
}
.algo-btn:hover { border-color: rgba(163, 255, 0, 0.3); background: var(--surface-mid); }
.algo-btn.active {
    border-color: var(--primary-color);
    background: var(--primary-dark);
    box-shadow: 0 0 12px rgba(163, 255, 0, 0.08);
}
.algo-name { display: block; font-size: 0.75rem; font-weight: 700; color: var(--text-color); }
.algo-desc { display: block; font-size: 0.62rem; color: var(--text-dim); margin-top: 1px; }
.algo-btn.active .algo-name { color: var(--primary-color); }

/* ── Control Rows ── */
.control-row { margin-bottom: 10px; }
.control-label {
    display: flex; align-items: center; gap: 4px;
    font-size: 0.72rem; color: var(--text-muted); margin-bottom: 4px; font-weight: 500;
}
.control-input-row { display: flex; align-items: center; gap: 8px; }
.dual-slider-row { display: flex; flex-direction: column; gap: 4px; }

/* ── Sliders ── */
.slider {
    -webkit-appearance: none; flex: 1;
    height: 4px; background: var(--surface-mid);
    border-radius: 2px; cursor: pointer; outline: none;
}
.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--primary-color);
    border: 2px solid var(--bg-color);
    box-shadow: 0 0 8px var(--primary-glow);
    cursor: pointer; transition: var(--transition);
}
.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 16px var(--primary-glow);
}
.slider::-moz-range-thumb {
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--primary-color);
    border: 2px solid var(--bg-color);
    box-shadow: 0 0 8px var(--primary-glow);
    cursor: pointer;
}
.slider.slider-sm { height: 3px; }

/* ── Number Inputs ── */
.num-input {
    width: 54px; padding: 3px 6px;
    background: var(--surface-light); border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); color: var(--text-color);
    font-family: var(--font-mono); font-size: 0.72rem; text-align: right; flex-shrink: 0;
}
.num-input:focus { outline: none; border-color: rgba(163, 255, 0, 0.4); }

.value-display {
    min-width: 36px; text-align: right;
    font-family: var(--font-mono); font-size: 0.72rem; color: var(--primary-color);
    flex-shrink: 0; text-shadow: 0 0 8px var(--primary-glow);
}

/* ── Toggles ── */
.toggle-group { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; }
.toggle-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 3px 0;
    font-size: 0.75rem; color: var(--text-muted);
}

.toggle-switch {
    position: relative; display: inline-block;
    width: 32px; height: 18px; cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-thumb {
    position: absolute; inset: 0;
    background: var(--surface-mid); border-radius: 9px;
    transition: background var(--transition);
}
.toggle-thumb::before {
    content: '';
    position: absolute; left: 2px; bottom: 2px;
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--text-dim);
    transition: transform 0.25s ease, background 0.25s ease;
}
.toggle-switch input:checked + .toggle-thumb {
    background: var(--primary-dim);
    border: 1px solid rgba(163, 255, 0, 0.4);
}
.toggle-switch input:checked + .toggle-thumb::before {
    transform: translateX(14px);
    background: var(--primary-color);
    box-shadow: 0 0 8px var(--primary-glow);
}
.toggle-switch.mini { width: 26px; height: 14px; }
.toggle-switch.mini .toggle-thumb::before { width: 10px; height: 10px; }
.toggle-switch.mini input:checked + .toggle-thumb::before { transform: translateX(12px); }

/* ── Collapsible ── */
.collapsible-header { cursor: pointer; user-select: none; }
.collapsible-header:hover .section-title { color: var(--text-muted); }
.collapse-icon { font-size: 0.75rem; color: var(--text-dim); transition: transform var(--transition); }
.collapsible.collapsed .collapse-icon { transform: rotate(-90deg); }
.collapsible.collapsed .collapsible-content { display: none; }

/* ── Filter Stack ── */
.filter-stack { display: flex; flex-direction: column; gap: 6px; }
.filter-item {
    background: var(--surface-light); border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); overflow: hidden;
}
.filter-item-header {
    display: flex; align-items: center; gap: 6px; padding: 6px 8px;
}
.filter-name { flex: 1; font-size: 0.72rem; color: var(--text-muted); font-weight: 500; }
.filter-drag-handle { color: var(--text-dim); font-size: 0.85rem; cursor: grab; opacity: 0.4; }
.filter-drag-handle:hover { opacity: 1; }
.filter-controls { display: flex; align-items: center; gap: 6px; padding: 4px 8px 8px; }

/* ── Preset Grid ── */
.preset-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 4px; margin-bottom: 10px;
}
.preset-btn {
    padding: 6px 8px;
    background: var(--surface-light); border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); color: var(--text-muted);
    font-family: var(--font); font-size: 0.72rem;
    cursor: pointer; transition: var(--transition); text-align: left;
}
.preset-btn:hover {
    border-color: rgba(163, 255, 0, 0.4); color: var(--primary-color);
    background: var(--primary-dark); box-shadow: 0 0 12px rgba(163, 255, 0, 0.06);
}

.preset-save-row { display: flex; gap: 4px; margin-bottom: 8px; }
.user-presets { display: flex; flex-wrap: wrap; gap: 4px; }
.user-preset-btn {
    padding: 3px 8px;
    background: var(--primary-dark); border: 1px solid rgba(163, 255, 0, 0.3);
    border-radius: 12px; color: var(--primary-color);
    font-size: 0.68rem; cursor: pointer; font-family: var(--font);
    transition: var(--transition);
}
.user-preset-btn:hover { background: var(--primary-color); color: var(--bg-color); font-weight: 700; }

/* ── Validator ── */
.validator-results { margin-top: 8px; font-size: 0.72rem; }
.validator-empty { color: var(--text-dim); text-align: center; padding: 8px; }
.validator-ok { color: var(--primary-color); }
.validator-warn { color: #f59e0b; }
.validator-err { color: var(--danger-color); }

/* ============================================================
   SHARED CONTROL ELEMENTS
   ============================================================ */
.full-select {
    width: 100%; padding: 6px 8px;
    background: var(--surface-light); border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); color: var(--text-color);
    font-family: var(--font); font-size: 0.78rem; cursor: pointer; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none' viewBox='0 0 10 6'%3E%3Cpath stroke='%23888899' stroke-linecap='round' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 8px center; padding-right: 24px;
    transition: var(--transition);
}
.full-select:focus { outline: none; border-color: rgba(163, 255, 0, 0.4); box-shadow: 0 0 10px rgba(163, 255, 0, 0.08); }
.full-select option { background: var(--surface-color); color: var(--text-color); }

.mini-select {
    padding: 3px 22px 3px 8px;
    background: var(--surface-light); border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); color: var(--text-muted);
    font-family: var(--font); font-size: 0.72rem; cursor: pointer; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' fill='none' viewBox='0 0 8 5'%3E%3Cpath stroke='%23888899' stroke-linecap='round' d='M1 1l3 3 3-3'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 6px center;
    transition: var(--transition);
}
.mini-select:focus { outline: none; }
.mini-select option { background: var(--surface-color); }

.mini-btn {
    padding: 3px 10px;
    background: var(--surface-light); border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); color: var(--text-muted);
    font-family: var(--font); font-size: 0.72rem; cursor: pointer; white-space: nowrap;
    transition: var(--transition);
}
.mini-btn:hover { border-color: rgba(163, 255, 0, 0.3); color: var(--text-color); background: var(--surface-mid); }
.mini-btn.active { background: var(--primary-dim); border-color: var(--primary-color); color: var(--primary-color); }

.mini-slider {
    -webkit-appearance: none; width: 70px; height: 3px;
    background: var(--surface-mid); border-radius: 2px; cursor: pointer;
}
.mini-slider::-webkit-slider-thumb {
    -webkit-appearance: none; width: 10px; height: 10px;
    border-radius: 50%; background: rgba(255, 255, 255, 0.5);
}

.text-input {
    flex: 1; padding: 6px 8px;
    background: var(--surface-light); border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); color: var(--text-color);
    font-family: var(--font); font-size: 0.78rem; transition: var(--transition);
}
.text-input:focus { outline: none; border-color: rgba(163, 255, 0, 0.4); }

.control-group { margin-bottom: 4px; }

/* ── Buttons ── */
.btn-primary {
    padding: 8px 16px;
    background: var(--primary-color); border: none;
    border-radius: var(--radius-sm); color: var(--bg-color);
    font-family: var(--font); font-size: 0.8rem; font-weight: 800;
    cursor: pointer; transition: var(--transition);
    box-shadow: 0 0 18px var(--primary-glow);
    text-transform: uppercase; letter-spacing: 0.4px;
}
.btn-primary:hover {
    box-shadow: 0 0 30px var(--primary-glow);
    transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
    padding: 8px 16px;
    background: var(--surface-light); border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); color: var(--text-muted);
    font-family: var(--font); font-size: 0.8rem; font-weight: 500;
    cursor: pointer; transition: var(--transition);
}
.btn-secondary:hover {
    border-color: rgba(163, 255, 0, 0.3);
    color: var(--primary-color);
    box-shadow: 0 0 12px rgba(163, 255, 0, 0.08);
}

.btn-sm { padding: 5px 10px; font-size: 0.72rem; }
.btn-lg { padding: 12px 28px; font-size: 0.9rem; }
.btn-full { width: 100%; margin-top: 4px; }

.icon-btn-sm {
    width: 22px; height: 22px;
    background: var(--surface-light); border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); color: var(--text-dim);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; transition: var(--transition);
}
.icon-btn-sm:hover { background: var(--surface-mid); color: var(--primary-color); border-color: rgba(163, 255, 0, 0.3); }

.strip-btn {
    padding: 3px 10px;
    background: transparent; border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); color: var(--text-muted);
    font-size: 0.7rem; cursor: pointer; font-family: var(--font);
    transition: var(--transition);
}
.strip-btn:hover { border-color: rgba(163, 255, 0, 0.3); color: var(--primary-color); }

.tooltip-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 14px; height: 14px;
    background: var(--surface-mid); border-radius: 50%;
    font-size: 0.6rem; color: var(--text-dim); cursor: help;
    border: 1px solid var(--border-light);
}

/* ============================================================
   STATUS BAR
   ============================================================ */
.status-bar {
    height: var(--status-h);
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    display: flex; align-items: center; gap: 0;
    padding: 0 14px;
    font-size: 0.7rem; font-family: var(--font-mono);
    color: var(--text-dim); flex-shrink: 0; overflow: hidden;
}
.status-sep { margin: 0 10px; color: var(--border-light); }
.status-right { margin-left: auto; display: flex; gap: 10px; }
.status-processing { color: var(--primary-color); text-shadow: 0 0 8px var(--primary-glow); animation: blink 1s infinite; }
.status-ready { color: var(--primary-color); opacity: 0.7; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(5, 5, 5, 0.85); backdrop-filter: blur(10px);
    display: flex; align-items: center; justify-content: center;
    z-index: 9000; animation: fadeIn 0.2s ease;
}
.modal-overlay.hidden { display: none; }

.modal-card {
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid rgba(163, 255, 0, 0.15);
    border-radius: var(--radius-xl);
    padding: 28px; min-width: 360px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.9), 0 0 40px rgba(163, 255, 0, 0.05);
    animation: slideUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; }
.modal-close { margin-top: 16px; }
.modal-wide { min-width: 480px; }

.shortcuts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.shortcut-item {
    display: flex; align-items: center; gap: 10px;
    font-size: 0.78rem; color: var(--text-muted);
}
kbd {
    display: inline-block; padding: 2px 7px;
    background: var(--surface-light); border: 1px solid var(--border-light);
    border-bottom-width: 2px; border-radius: var(--radius-sm);
    font-family: var(--font-mono); font-size: 0.68rem; color: var(--primary-color);
    min-width: 60px; text-align: center;
    text-shadow: 0 0 8px var(--primary-glow);
}

/* ── Processing Overlay ── */
.processing-overlay {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    z-index: 8000;
}
.processing-overlay.hidden { display: none; }
.processing-card {
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid rgba(163, 255, 0, 0.2);
    border-radius: var(--radius-xl);
    padding: 36px 48px; text-align: center;
    display: flex; flex-direction: column; align-items: center; gap: 14px;
    min-width: 280px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.9), 0 0 40px rgba(163, 255, 0, 0.06);
}
.processing-spinner {
    width: 44px; height: 44px;
    border: 3px solid var(--border-light);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    box-shadow: 0 0 20px var(--primary-glow);
}
.processing-progress { width: 200px; margin-top: 4px; }

/* ── Progress Bar ── */
.progress-bar {
    background: var(--surface-mid);
    border-radius: 4px; height: 5px; overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #c8ff50);
    border-radius: 4px; transition: width 0.3s ease;
    box-shadow: 0 0 10px var(--primary-glow);
}

/* ── Tooltip ── */
.tooltip {
    position: fixed; z-index: 9999;
    background: var(--surface-color);
    border: 1px solid rgba(163, 255, 0, 0.2);
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    font-size: 0.72rem; color: var(--text-muted);
    max-width: 200px; line-height: 1.4;
    pointer-events: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
    transition: opacity 0.12s ease;
}
.tooltip.hidden { opacity: 0; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--primary-glow); }
    50% { opacity: 0.5; box-shadow: 0 0 4px var(--primary-glow); }
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
@keyframes borderGlow {
    0%, 100% { border-color: var(--primary-color); box-shadow: 0 0 20px rgba(163, 255, 0, 0.15) inset; }
    50% { border-color: #c8ff50; box-shadow: 0 0 35px rgba(163, 255, 0, 0.2) inset; }
}

.map-thumb-canvas.loading {
    background: linear-gradient(90deg, var(--surface-light) 25%, var(--surface-mid) 50%, var(--surface-light) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite;
}
@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position:  200% 0; }
}
.dropzone.drag-over { animation: borderGlow 1s infinite; }

/* ============================================================
   SCROLLBARS
   ============================================================ */
* { scrollbar-width: thin; scrollbar-color: var(--border-light) transparent; }
*::-webkit-scrollbar { width: 4px; height: 4px; }
*::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   UTILITY
   ============================================================ */
.hidden { display: none !important; }
.invisible { visibility: hidden; }
