/* ════════════════════════════════════════════════════
   ImageTools v7 — Clean Light Mode

   Design: Vercel-inspired clean white UI
   Base: Pure white #ffffff
   Surface: Soft gray #f9fafb
   Accent: Violet #7c3aed with soft glows
   Font: Nunito (rounded, warm)
   Mobile: Bottom-sheet pattern for settings
   ════════════════════════════════════════════════════ */

:root {
    --bg: #ffffff;
    --bg-surface: #f9fafb;
    --bg-hover: #f3f4f6;
    --bg-active: #fce7f3;

    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --border-accent: #f0abfc;

    --text: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;

    --accent: #d946ef;
    --accent-hover: #c026d3;
    --accent-light: #fae8ff;
    --accent-glow: rgba(217, 70, 239, 0.15);
    --accent-glow-strong: rgba(217, 70, 239, 0.25);

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
    --shadow-accent: 0 4px 14px var(--accent-glow);
}

*, *::before, *::after { box-sizing: border-box; }
body { background: var(--bg); }

/* ── Editor layout ────────────────────────────────── */
.editor-view {
    display: none; flex-direction: column;
    height: 100dvh; padding-top: 48px;
    overflow: hidden; position: relative;
}
.editor-view.active-view { display: flex; }

/* ── Header ───────────────────────────────────────── */
.neu-header {
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.neu-icon-logo {
    width: 32px; height: 32px; border-radius: 10px;
    background: var(--accent); display: flex;
    align-items: center; justify-content: center;
    box-shadow: var(--shadow-accent);
}
.neu-logo-big {
    width: 64px; height: 64px; border-radius: 18px;
    background: var(--accent-light); border: 1px solid var(--border-accent);
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-md);
}

/* ── Tab group ────────────────────────────────────── */
.neu-tab-group {
    display: flex; position: relative;
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: 12px; padding: 3px;
}
.tab-slider {
    position: absolute; top: 3px; height: calc(100% - 6px);
    border-radius: 9px; background: var(--accent);
    box-shadow: var(--shadow-accent);
    transition: left .35s cubic-bezier(.4,0,.2,1), width .3s cubic-bezier(.4,0,.2,1);
    z-index: 0;
}
.tool-tab {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 7px 16px; font-size: 14px; font-weight: 700;
    color: var(--text-secondary); background: transparent; border: none;
    border-radius: 9px; cursor: pointer;
    transition: color .2s; white-space: nowrap;
    position: relative; z-index: 1;
}
.tool-tab:hover { color: var(--text); }
.tool-tab.active { color: #fff; }

/* ── Toolbar ──────────────────────────────────────── */
.neu-toolbar {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
.tool-icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; color: var(--text-secondary);
    background: transparent; border: 1px solid transparent;
    border-radius: 8px; cursor: pointer; transition: all .15s;
}
.tool-icon-btn:hover { color: var(--text); background: var(--bg-hover); border-color: var(--border); }
.tool-icon-btn:active { background: var(--bg-surface); }
.tool-icon-btn.active { color: var(--accent); background: var(--accent-light); border-color: var(--border-accent); }

.ratio-btn {
    display: inline-flex; align-items: center;
    padding: 7px 12px; font-size: 14px; font-weight: 600;
    color: var(--text-secondary); background: transparent;
    border: 1px solid var(--border); border-radius: 8px;
    cursor: pointer; transition: all .15s; white-space: nowrap;
}
.ratio-btn:hover { color: var(--text); background: var(--bg-hover); }
.ratio-btn.active {
    color: #fff; background: var(--accent); border-color: var(--accent);
    box-shadow: var(--shadow-accent);
}
.sep { width: 1px; height: 20px; background: var(--border-light); flex-shrink: 0; margin: 0 3px; }

.add-layer-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 8px 16px; font-size: 14px; font-weight: 700;
    color: #fff; background: var(--accent); border: none;
    border-radius: 8px; cursor: pointer;
    box-shadow: var(--shadow-accent);
    transition: all .15s;
}
.add-layer-btn:hover { background: var(--accent-hover); transform: translateY(-1px); }
.add-layer-btn:active { transform: translateY(0); }

.auto-detect-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 8px 16px; font-size: 14px; font-weight: 600;
    color: var(--text); background: var(--bg);
    border: 1px solid var(--border); border-radius: 8px;
    cursor: pointer; transition: all .15s;
}
.auto-detect-btn:hover { background: var(--bg-hover); }
.auto-detect-btn:active { background: var(--bg-surface); }
.auto-detect-btn:disabled { opacity: .4; cursor: wait; }

/* ── Sidebar ──────────────────────────────────────── */
.neu-sidebar {
    background: var(--bg);
    border-left: 1px solid var(--border);
}
@media (max-width: 1023px) {
    .neu-sidebar { border-left: none; border-top: 1px solid var(--border); }
}
.neu-divider { height: 1px; background: var(--border-light); }

/* ── Panel elements ───────────────────────────────── */
.panel-label {
    display: block; font-size: 13px; font-weight: 700;
    color: var(--text-secondary); text-transform: uppercase;
    letter-spacing: .04em; margin-bottom: 8px;
}
.seg-btn {
    padding: 10px 8px; font-size: 14px; font-weight: 600;
    color: var(--text-secondary); background: var(--bg);
    border: 1px solid var(--border); border-radius: 8px;
    cursor: pointer; transition: all .2s; text-align: center;
}
.seg-btn:hover { color: var(--text); background: var(--bg-hover); border-color: #d1d5db; }
.seg-btn:active { transform: scale(.97); }
.seg-btn.active {
    color: #fff; background: var(--accent); border-color: var(--accent);
    box-shadow: 0 2px 8px var(--accent-glow);
}
.input-field {
    padding: 10px 12px; font-size: 15px; font-weight: 500;
    color: var(--text); background: var(--bg);
    border: 1px solid var(--border); border-radius: 8px;
    outline: none; transition: all .15s; font-family: inherit;
}
.input-field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.input-field::placeholder { color: var(--text-muted); }

/* ── Buttons ──────────────────────────────────────── */
.btn-primary {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 13px 20px; font-size: 15px; font-weight: 700;
    color: #fff; background: var(--accent); border: none;
    border-radius: 10px; cursor: pointer;
    box-shadow: var(--shadow-accent);
    transition: all .2s;
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 6px 20px var(--accent-glow-strong); }
.btn-primary:active { transform: translateY(0) scale(.98); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.btn-secondary {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 20px; font-size: 15px; font-weight: 600;
    color: var(--text); background: var(--bg);
    border: 1px solid var(--border); border-radius: 10px;
    cursor: pointer; transition: all .2s;
}
.btn-secondary:hover { background: var(--bg-hover); }
.btn-secondary:active { transform: scale(.98); }
.btn-secondary:disabled { opacity: .4; cursor: not-allowed; }

.neu-btn-accent {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 12px 28px; font-size: 14px; font-weight: 700;
    color: #fff; background: var(--accent); border: none; border-radius: 12px;
    box-shadow: var(--shadow-accent);
    transition: all .2s;
}
.neu-btn-accent:hover { background: var(--accent-hover); transform: translateY(-2px); box-shadow: 0 8px 25px var(--accent-glow-strong); }
.neu-btn-accent:active { transform: translateY(0); }

/* ── Toggle ───────────────────────────────────────── */
.toggle { position: relative; display: inline-flex; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track {
    width: 44px; height: 24px; background: var(--border);
    border-radius: 999px; position: relative;
    transition: background .3s cubic-bezier(.4,0,.2,1);
}
.toggle-thumb {
    position: absolute; top: 2px; left: 2px;
    width: 20px; height: 20px; background: #fff;
    border-radius: 50%; box-shadow: var(--shadow-sm);
    transition: transform .3s cubic-bezier(.34,1.56,.64,1), width .15s;
}
.toggle input:active + .toggle-track .toggle-thumb { width: 24px; }
.toggle input:checked + .toggle-track { background: var(--accent); }
.toggle input:checked + .toggle-track .toggle-thumb {
    transform: translateX(20px);
    box-shadow: 0 0 8px var(--accent-glow);
}
.toggle input:checked:active + .toggle-track .toggle-thumb { transform: translateX(16px); width: 24px; }

/* ── Slider ───────────────────────────────────────── */
.slider {
    -webkit-appearance: none; appearance: none;
    height: 6px; background: var(--border);
    border-radius: 999px; outline: none; cursor: pointer; display: block;
}
.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px; height: 20px; background: var(--accent);
    border: 3px solid #fff; border-radius: 50%; cursor: pointer;
    box-shadow: 0 2px 6px var(--accent-glow), var(--shadow-sm);
    transition: transform .2s cubic-bezier(.34,1.56,.64,1);
}
.slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
.slider::-moz-range-thumb {
    width: 20px; height: 20px; background: var(--accent);
    border: 3px solid #fff; border-radius: 50%; cursor: pointer;
}

/* ── Kbd ──────────────────────────────────────────── */
.neu-kbd {
    display: inline-block; padding: 2px 6px;
    font-size: 9px; font-weight: 700; font-family: monospace;
    color: var(--text-secondary); background: var(--bg-surface);
    border: 1px solid var(--border); border-radius: 4px;
}

/* ── Cards ────────────────────────────────────────── */
.neu-card-inset {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 16px;
}
.neu-icon-circle {
    width: 48px; height: 48px; border-radius: 14px;
    background: var(--bg-surface); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
}

/* ── Layer items ──────────────────────────────────── */
.layer-item {
    border-radius: 10px; background: var(--bg);
    border: 1px solid var(--border);
    transition: all .2s; overflow: hidden;
    border-left: 3px solid var(--lc, var(--border));
    margin-bottom: 6px;
}
.layer-item:hover { background: var(--bg-hover); }
.layer-item.active {
    background: var(--accent-light);
    border-color: var(--border-accent);
    border-left-color: var(--lc);
}
.layer-settings { animation: layerSlideIn .25s ease-out; }
@keyframes layerSlideIn { from { opacity: 0; max-height: 0; } to { opacity: 1; max-height: 500px; } }

.layer-header {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; cursor: pointer;
}
.layer-thumb {
    width: 44px; height: 44px; border-radius: 8px;
    object-fit: cover; flex-shrink: 0;
    border: 1px solid var(--border); background: var(--bg-surface);
}
.layer-badge {
    display: inline-block; padding: 2px 6px; margin-left: 4px;
    font-size: 10px; font-weight: 700;
    background: var(--accent); color: #fff;
    border-radius: 4px; vertical-align: middle;
}
.layer-del {
    width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 800;
    color: var(--text-muted); background: transparent; border: none;
    border-radius: 6px; cursor: pointer;
    opacity: 0; transition: all .15s; flex-shrink: 0;
}
.layer-item:hover .layer-del { opacity: 1; }
.layer-del:hover { color: #ef4444; background: #fef2f2; }

.layer-settings {
    padding: 12px 14px 14px;
    border-top: 1px solid var(--border-light);
    overflow: hidden;
}

/* Layer settings layout */
.ls-row { margin-bottom: 10px; }
.ls-row:last-child { margin-bottom: 0; }
.ls-label {
    display: block; font-size: 12px; font-weight: 700;
    color: var(--text-secondary); text-transform: uppercase;
    letter-spacing: .04em; margin-bottom: 6px;
}
.ls-flex { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ls-flex .input-field { flex: 1 1 0; min-width: 0; width: 0; }
.ls-x { color: var(--text-muted); font-weight: 700; font-size: 13px; flex-shrink: 0; }
.ls-toggle-row {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 15px; font-weight: 600; color: var(--text);
}
.ls-hint { font-size: 12px; font-weight: 500; color: var(--text-muted); margin-top: 3px; }

/* ── Canvas overlays ──────────────────────────────── */
.crop-overlay {
    position: absolute; border-radius: 2px;
    pointer-events: none; transition: opacity .2s, border-width .15s;
}
.crop-overlay[style*="pointer-events:auto"]:hover {
    opacity: 1 !important; border-width: 2.5px !important;
    box-shadow: 0 0 12px rgba(124,58,237,0.2);
}
.crop-overlay-label {
    position: absolute; top: -1px; left: -1px;
    padding: 2px 8px; font-size: 9px; font-weight: 800;
    font-family: 'Nunito', sans-serif; color: #fff;
    border-radius: 0 0 6px 0; white-space: nowrap;
    max-width: 140px; overflow: hidden; text-overflow: ellipsis; line-height: 1.4;
}

/* ── Checkerboard ─────────────────────────────────── */
.checkerboard {
    background-image:
        linear-gradient(45deg, #f3f4f6 25%, transparent 25%),
        linear-gradient(-45deg, #f3f4f6 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f3f4f6 75%),
        linear-gradient(-45deg, transparent 75%, #f3f4f6 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    opacity: .5;
}

/* ── Cropper.js theme ─────────────────────────────── */
.cropper-modal { background: rgba(0,0,0,0.4); }
.cropper-view-box { outline: 2px solid rgba(255,255,255,0.8); border-radius: 1px; }
.cropper-dashed { border-color: rgba(255,255,255,0.5) !important; border-width: 1px !important; }
.cropper-line { background-color: rgba(255,255,255,0.4) !important; }
.cropper-point {
    width: 12px !important; height: 12px !important;
    background: #fff; border: 2px solid var(--accent);
    border-radius: 50%; opacity: 1;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2), 0 0 6px var(--accent-glow);
}
.cropper-point.point-n, .cropper-point.point-s { width: 22px !important; height: 5px !important; border-radius: 3px; margin-left: -11px; }
.cropper-point.point-e, .cropper-point.point-w { width: 5px !important; height: 22px !important; border-radius: 3px; margin-top: -11px; }
.cropper-point.point-ne, .cropper-point.point-nw, .cropper-point.point-se, .cropper-point.point-sw { width: 12px !important; height: 12px !important; }
.cropper-center::before, .cropper-center::after { background-color: rgba(255,255,255,0.5); }
.cropper-face { background: transparent; }

/* ── Toast ────────────────────────────────────────── */
.neu-toast {
    background: var(--text); color: #fff;
    box-shadow: var(--shadow-lg);
}
#toast { font-family: inherit; max-width: 90vw; }

/* ── Drop zone ────────────────────────────────────── */
.drop-zone-inner {
    transition: all .2s;
    border: 1px dashed var(--border) !important;
    background: var(--bg-surface);
}
.drop-zone-inner:hover {
    background: var(--accent-light);
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 4px var(--accent-glow);
}

/* ── Custom ratio inputs ──────────────────────────── */
.custom-ratio-wrap { display: inline-flex; align-items: center; gap: 5px; animation: customIn .2s ease-out; }
.custom-ratio-wrap.hidden { display: none; }
@keyframes customIn { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: translateX(0); } }
.custom-ratio-input {
    width: 56px; padding: 6px; font-size: 13px; font-weight: 700; text-align: center;
    color: var(--text); background: var(--bg);
    border: 1px solid var(--border); border-radius: 8px;
    outline: none; font-family: inherit; -moz-appearance: textfield;
}
.custom-ratio-input::-webkit-inner-spin-button, .custom-ratio-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.custom-ratio-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.custom-ratio-x { font-size: 14px; font-weight: 700; color: var(--text-muted); }
.custom-ratio-apply {
    padding: 6px 14px; font-size: 12px; font-weight: 700;
    color: #fff; background: var(--accent); border: none; border-radius: 8px;
    cursor: pointer; transition: all .15s;
}
.custom-ratio-apply:hover { background: var(--accent-hover); }

/* ── Ad slots ─────────────────────────────────────── */
.ad-slot { display: flex; align-items: center; justify-content: center; overflow: hidden; }
.ad-slot-sticky { position: sticky; top: 60px; width: 300px; min-height: 600px; }
.ad-slot-mobile { width: 320px; height: 100px; margin: 0 auto; }
.ad-placeholder {
    width: 100%; height: 100%; min-height: inherit;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 600; color: var(--text-muted);
    background: var(--bg-surface); border: 1px dashed var(--border);
    border-radius: 8px;
}

/* ── Batch optimizer ──────────────────────────────── */
.batch-progress-bar {
    width: 100%; height: 8px;
    background: var(--border); border-radius: 999px;
    overflow: hidden;
}
.batch-progress-fill {
    height: 100%; background: var(--accent);
    border-radius: 999px;
    transition: width .3s ease;
    background-image: linear-gradient(
        -45deg,
        rgba(255,255,255,0.15) 25%, transparent 25%,
        transparent 50%, rgba(255,255,255,0.15) 50%,
        rgba(255,255,255,0.15) 75%, transparent 75%
    );
    background-size: 20px 20px;
}
.batch-progress-fill.active {
    animation: batchStripes .8s linear infinite;
}
@keyframes batchStripes {
    from { background-position: 0 0; }
    to { background-position: 20px 0; }
}

.batch-thumb-card {
    position: relative; border-radius: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    overflow: hidden; aspect-ratio: 1;
    transition: all .15s;
}
.batch-thumb-card:hover { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }
.batch-thumb-card img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
}
.batch-thumb-card .batch-thumb-name {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 2px 4px; font-size: 8px; font-weight: 700;
    color: #fff; background: rgba(0,0,0,0.6);
    text-align: center; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
    line-height: 1.4;
}
.batch-thumb-card .batch-thumb-size {
    position: absolute; top: 3px; right: 3px;
    padding: 1px 4px; font-size: 7px; font-weight: 800;
    color: #fff; background: rgba(0,0,0,0.5);
    border-radius: 3px;
}
.batch-thumb-card .batch-thumb-status {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; pointer-events: none;
}
.batch-thumb-card .batch-thumb-remove {
    position: absolute; top: 2px; left: 2px;
    width: 18px; height: 18px;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 800; color: #fff;
    background: rgba(0,0,0,0.5); border: none;
    border-radius: 4px; cursor: pointer;
    opacity: 0; transition: opacity .15s;
}
.batch-thumb-card:hover .batch-thumb-remove { opacity: 1; }
.batch-thumb-card.processing {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}
.batch-thumb-card.done { opacity: .7; }
.batch-thumb-card.error { border-color: #ef4444; }

/* ── Scrollbar ────────────────────────────────────── */
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }
.scrollbar-hide::-webkit-scrollbar { display: none; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Focus ────────────────────────────────────────── */
button:focus-visible, input:focus-visible, a:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ══════════════════════════════════════════════════
   MOBILE-FIRST RESPONSIVE
   Pattern: Bottom drawer + maximized canvas
   ══════════════════════════════════════════════════ */

/* Mobile < 1024px: sidebar becomes bottom drawer */
@media (max-width: 1023px) {
    /* Toolbar: compact, scrollable */
    .neu-toolbar .px-3 {
        padding: 6px 8px;
        gap: 4px;
    }

    /* Canvas: maximize space */
    #cropCanvas, .editor-view .flex-1.relative {
        min-height: 45vh;
    }

    /* Sidebar → Bottom drawer */
    .neu-sidebar {
        max-height: 45vh;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
        border-top: 1px solid var(--border);
        border-left: none !important;
    }

    /* Drag handle visual hint */
    .neu-sidebar::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        background: var(--border);
        border-radius: 2px;
        margin: 8px auto 4px;
    }

    /* Download buttons at bottom of drawer — safe area for browser chrome */
    .neu-sidebar > div:last-child {
        position: sticky;
        bottom: 0;
        background: var(--bg);
        box-shadow: 0 -2px 8px rgba(0,0,0,0.04);
        z-index: 2;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }

    /* Sidebar needs extra scroll room so content isn't hidden behind bottom bar */
    .neu-sidebar {
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    /* Ad slot hide on editor mobile (too intrusive) */
    .editor-view .ad-slot-sticky { display: none; }
}

/* Tablets / large phones < 768px: compact header tabs */
@media (max-width: 768px) {
    .tool-tab { padding: 6px 10px; font-size: 12px; gap: 4px; }
    .tool-tab svg { width: 12px; height: 12px; }
    .neu-tab-group { border-radius: 10px; padding: 2px; }
    .tab-slider { top: 2px; height: calc(100% - 4px); border-radius: 8px; }
}

/* Small mobile < 640px */
@media (max-width: 640px) {
    /* Header tabs: hide icons, text only */
    .tool-tab svg { display: none; }
    .tool-tab { padding: 6px 12px; font-size: 12px; gap: 0; }

    /* Toolbar: even more compact */
    .ratio-btn { padding: 4px 7px; font-size: 10px; }
    .tool-icon-btn { width: 28px; height: 28px; }
    .tool-icon-btn svg { width: 14px; height: 14px; }
    .add-layer-btn, .auto-detect-btn { padding: 4px 8px; font-size: 10px; }
    .sep { height: 16px; margin: 0 1px; }

    /* Sidebar drawer: larger on small screens */
    .neu-sidebar { max-height: 50vh; }

    /* Layer items: more compact */
    .layer-header { padding: 8px 10px; gap: 8px; }
    .layer-thumb { width: 36px; height: 36px; border-radius: 6px; }
    .layer-settings { padding: 10px 12px 12px; }

    /* Inputs: ensure touch targets 44px min */
    .input-field { padding: 10px 12px; min-height: 44px; }
    .seg-btn { padding: 10px 6px; min-height: 44px; }
    .toggle-track { width: 48px; height: 28px; }
    .toggle-thumb { width: 22px; height: 22px; top: 3px; left: 3px; }
    .toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(20px); }
    .toggle input:checked:active + .toggle-track .toggle-thumb { transform: translateX(16px); }

    /* Buttons: full touch-friendly */
    .btn-primary, .btn-secondary { min-height: 48px; font-size: 14px; border-radius: 12px; }

    /* Slider: bigger thumb for touch */
    .slider { height: 8px; }
    .slider::-webkit-slider-thumb { width: 24px; height: 24px; }
}
