:root {
    --bg: #09090b;
    --surface: #121214;
    --card: #18181b;
    --card2: #27272a;
    --border: rgba(255, 255, 255, 0.06);
    --border2: rgba(255, 255, 255, 0.12);
    --accent: #6366f1;
    --accent2: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.18);
    --muted: #8b8b9a;
    --text: #f4f4f5;
    --text2: #d4d4d8;
    --radius: 14px;
    --radius-sm: 9px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0
}

html,
body {
    min-height: 100vh;
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px
}

::-webkit-scrollbar {
    width: 5px;
    height: 5px
}

::-webkit-scrollbar-track {
    background: transparent
}

::-webkit-scrollbar-thumb {
    background: #2e2e38;
    border-radius: 99px
}

/* ================= TOP NAVIGATION BAR (STANDARD SPAC2 BRAND) ================= */
.app-header,
header {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: #09090b;
    border-bottom: 1px solid #27272a;
    box-sizing: border-box;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

@media (min-width: 768px) {
    .app-header,
    header {
        height: 60px;
        padding: 0 24px;
    }
}

.header-brand-group,
.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.btn-back {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: #18181b;
    border: 1px solid #27272a;
    color: #f4f4f5;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 16px;
    padding: 0;
}

.btn-back i,
.btn-back svg {
    color: #f4f4f5 !important;
    font-size: 16px;
    line-height: 1;
}

.btn-back:hover {
    background: #27272a;
    color: #ffffff;
    transform: translateX(-2px);
    border-color: #3f3f46;
}

.btn-back:active {
    transform: scale(0.92);
}

.brand-link {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.15s ease;
    flex-shrink: 0;
}

.brand-link:hover {
    opacity: 0.9;
}

.brand-logo-card {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: #18181b;
    border: 1px solid #27272a;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
    padding: 4px;
    box-sizing: border-box;
    transition: transform 0.2s ease;
}

.brand-link:hover .brand-logo-card {
    transform: scale(1.05);
}

.brand-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 5px;
    display: block;
}

.brand-text {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    line-height: 1;
    white-space: nowrap;
}

.brand-name {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-weight: 800;
    font-size: 18px;
    color: #ffffff;
    letter-spacing: -0.02em;
    line-height: 1;
}

.brand-divider {
    font-size: 13px;
    font-weight: 300;
    color: #52525b;
    user-select: none;
}

.brand-app {
    font-size: 13px;
    font-weight: 600;
    color: #a1a1aa;
    letter-spacing: -0.01em;
    line-height: 1;
}

.header-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #a1a1aa;
    background: #18181b;
    padding: 5px 12px;
    border-radius: 99px;
    border: 1px solid #27272a;
}

@media (max-width: 640px) {
    .app-header,
    header {
        padding: 0 12px;
        height: 52px;
    }
    .header-brand-group,
    .header-left {
        gap: 8px;
    }
    .btn-back {
        width: 32px;
        height: 32px;
        border-radius: 9px;
        font-size: 14px;
    }
    .btn-back i,
    .btn-back svg {
        font-size: 14px;
    }
    .brand-logo-card {
        width: 30px;
        height: 30px;
        border-radius: 8px;
        padding: 3px;
    }
    .brand-name {
        font-size: 16px;
    }
    .brand-divider {
        font-size: 12px;
    }
    .brand-app {
        font-size: 12px;
    }
    .header-badge {
        display: none;
    }
}

/* MAIN */
main {
    max-width: 1440px;
    margin: 0 auto;
    padding: 16px 20px 60px
}

.page-head {
    margin-bottom: 22px
}

.page-head h1 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 5px
}

.page-head p {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6
}

/* LAYOUT */
.layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 16px;
    align-items: start
}

@media(max-width:860px) {
    .layout {
        grid-template-columns: 1fr
    }
}

/* PANEL */
.panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
}

.panel:last-child {
    margin-bottom: 0
}

.panel-head {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px
}

.panel-head svg {
    opacity: .65;
    flex-shrink: 0
}

.panel-head h2 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text2);
    letter-spacing: .4px;
    text-transform: uppercase
}

.panel-body {
    padding: 14px
}

/* DROPZONE */
.dropzone {
    border: 1.5px dashed var(--border2);
    border-radius: var(--radius-sm);
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    background: rgba(255, 255, 255, 0.01);
    position: relative;
    overflow: hidden
}

.dropzone:hover,
.dropzone.drag-over {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.04);
    box-shadow: 0 0 16px var(--accent-glow);
}

.dropzone input[type=file] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%
}

.dropzone-icon {
    margin-bottom: 7px;
    color: var(--muted)
}

.dropzone-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text2);
    margin-bottom: 3px
}

.dropzone-sub {
    font-size: 11px;
    color: var(--muted)
}

/* LUT SELECT */
.lut-select-wrap {
    position: relative;
    margin-top: 10px
}

.lut-select-wrap select {
    width: 100%;
    padding: 9px 32px 9px 11px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    background: var(--card2);
    color: var(--text);
    font-size: 13px;
    appearance: none;
    cursor: pointer;
    outline: none;
    transition: .2s;
    font-family: inherit
}

.lut-select-wrap select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow)
}

.lut-select-wrap::after {
    content: '';
    position: absolute;
    right: 11px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--muted);
    pointer-events: none
}

.lut-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    background: rgba(124, 106, 247, 0.14);
    border: 1px solid rgba(124, 106, 247, 0.25);
    border-radius: 99px;
    font-size: 11px;
    color: var(--accent2);
    margin-top: 8px
}

/* INTENSITY */
.intensity-wrap {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border)
}

.intensity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 9px
}

.intensity-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text2);
    display: flex;
    align-items: center;
    gap: 5px
}

.intensity-value {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent2);
    background: rgba(124, 106, 247, 0.12);
    border-radius: 6px;
    padding: 2px 8px;
    min-width: 44px;
    text-align: center
}

input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 99px;
    outline: none;
    cursor: pointer;
    background: linear-gradient(to right, var(--accent) 0%, var(--accent) var(--val, 100%), rgba(255, 255, 255, 0.1) var(--val, 100%), rgba(255, 255, 255, 0.1) 100%);
    transition: background .04s
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .5), 0 0 0 2.5px var(--accent);
    transition: .15s;
    cursor: pointer
}

input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.15)
}

input[type=range]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: none;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .5), 0 0 0 2.5px var(--accent);
    cursor: pointer
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border2);
    background: var(--card2);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: .2s;
    font-family: inherit;
    white-space: nowrap
}

.btn:hover {
    background: rgba(255, 255, 255, 0.07);
    transform: translateY(-1px)
}

.btn:active {
    transform: translateY(0)
}

.btn:disabled {
    opacity: .4;
    cursor: not-allowed;
    transform: none
}

.btn-primary {
    background: var(--accent);
    border-color: rgba(124, 106, 247, 0.5);
    color: #fff
}

.btn-primary:hover {
    background: #8f7dff;
    box-shadow: 0 4px 18px var(--accent-glow)
}

.btn-primary:disabled {
    background: var(--accent)
}

.btn-danger {
    background: rgba(239, 68, 68, 0.13);
    border-color: rgba(239, 68, 68, 0.28);
    color: #f87171
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.22)
}

.btn-success {
    background: rgba(34, 197, 94, 0.14);
    border-color: rgba(34, 197, 94, 0.3);
    color: #4ade80
}

.btn-success:hover {
    background: rgba(34, 197, 94, 0.24)
}

.btn-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap
}

.icon-btn {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: .15s;
    padding: 0;
    flex-shrink: 0
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    border-color: var(--border2)
}

.icon-btn.d:hover {
    background: rgba(124, 106, 247, 0.15);
    color: var(--accent2);
    border-color: rgba(124, 106, 247, 0.3)
}

.icon-btn.x:hover {
    background: rgba(239, 68, 68, 0.14);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3)
}

/* PROGRESS */
.prog-wrap {
    display: none;
    margin-bottom: 10px
}

.prog-wrap.show {
    display: block
}

.prog-bar {
    height: 3px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.07);
    overflow: hidden;
    margin-bottom: 5px
}

.prog-fill {
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    width: 0%;
    transition: width .25s
}

.prog-text {
    font-size: 11px;
    color: var(--muted);
    text-align: center
}

/* IMAGES GRID (left thumbs) */
.img-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 320px;
    overflow-y: auto
}

.img-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 9px;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: .18s;
    background: rgba(255, 255, 255, 0.02)
}

.img-row:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border)
}

.img-row.active {
    background: rgba(124, 106, 247, 0.1);
    border-color: rgba(124, 106, 247, 0.3)
}

.img-row-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    background: #111
}

.img-row-name {
    font-size: 12px;
    color: var(--text2);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.img-row-actions {
    display: flex;
    gap: 4px
}

/* PREVIEW AREA */
.preview-area {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

/* COMPARE CONTAINER */
.compare-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden
}

.compare-head {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap
}

.compare-head h2 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text2);
    letter-spacing: .4px;
    text-transform: uppercase
}

.compare-tabs {
    display: flex;
    gap: 4px;
    margin-left: auto
}

.tab-btn {
    padding: 4px 11px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    transition: .15s;
    background: transparent;
    color: var(--muted);
    font-family: inherit
}

.tab-btn.active {
    background: var(--accent-glow);
    border-color: rgba(99, 102, 241, 0.35);
    color: var(--accent2)
}

.tab-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.06)
}

.compare-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 14px
}

/* SIDE BY SIDE */
.sbs-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px
}

.sbs-frame {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #0a0a0c;
    position: relative
}

.sbs-label {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    letter-spacing: .3px
}

.sbs-img {
    width: 100%;
    display: block;
    max-height: 420px;
    object-fit: contain
}

/* SLIDER SPLIT VIEW */
.split-wrap {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #0a0a0c;
    cursor: col-resize;
    user-select: none;
    line-height: 0;
    max-width: 100%;
    max-height: min(560px, 65vh);
    width: fit-content;
    margin: 0 auto;
}

.split-after {
    position: relative;
    z-index: 1;
}

.split-before {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 2;
    overflow: hidden;
    width: 50%;
}

.split-img {
    max-width: 100%;
    max-height: min(560px, 65vh);
    width: auto;
    height: auto;
    display: block;
}

.split-before .split-img {
    position: absolute;
    top: 0;
    left: 0;
    width: var(--split-full-w, 100%);
    height: 100%;
    object-fit: cover;
    max-width: none;
    max-height: none;
}

.split-divider {
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 3;
    width: 2px;
    background: white;
    transform: translateX(-50%);
    left: 50%;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .4)
}

.split-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 4;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: col-resize;
    transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.split-handle:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

.split-handle svg {
    color: #fff;
    pointer-events: none;
}

/* Butter-smooth transition on split drag slider items */
.split-divider, .split-handle {
    transition: left 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.split-before {
    transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.split-wrap.dragging .split-divider,
.split-wrap.dragging .split-handle,
.split-wrap.dragging .split-before {
    transition: none; /* remove transition when actively dragging for zero lag */
}

.split-label-before {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 5
}

.split-label-after {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 5
}

.split-tag {
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #fff
}

/* INTENSITY IN PREVIEW */
.preview-controls {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px
}

.ctrl-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap
}

.ctrl-slider {
    flex: 1;
    min-width: 160px
}

.ctrl-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text2);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px
}

.ctrl-val {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent2);
    background: rgba(124, 106, 247, 0.12);
    border-radius: 6px;
    padding: 3px 10px;
    min-width: 48px;
    text-align: center
}

/* EMPTY PREVIEW */
.preview-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--muted);
    gap: 10px;
    text-align: center;
    min-height: 200px
}

.preview-empty svg {
    opacity: .25
}

.preview-empty p {
    font-size: 13px
}

/* TOAST */
.toast {
    position: fixed;
    bottom: 18px;
    right: 18px;
    padding: 10px 16px;
    background: #1d1d26;
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
    transform: translateY(16px);
    opacity: 0;
    transition: .28s;
    z-index: 999
}

.toast.show {
    transform: translateY(0);
    opacity: 1
}

footer {
    text-align: center;
    padding: 18px;
    font-size: 12px;
    color: var(--muted);
    border-top: 1px solid var(--border)
}

footer a {
    color: var(--accent2);
    text-decoration: none
}

footer a:hover {
    text-decoration: underline
}

.lut-gallery-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 8px 4px 12px 4px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

.lut-gallery-scroll::-webkit-scrollbar {
    height: 5px;
}

.lut-gallery-scroll::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 99px;
}

.lut-gallery-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 99px;
    transition: background 0.2s ease;
}

.lut-gallery-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.lut-thumb-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    flex-shrink: 0;
    width: 80px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.lut-thumb-item:hover {
    transform: translateY(-2px);
}

.lut-thumb-img-wrap {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 2px solid transparent;
    background: #111;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lut-thumb-item:hover .lut-thumb-img-wrap {
    border-color: var(--border2);
}

.lut-thumb-item.active .lut-thumb-img-wrap {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.lut-thumb-canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.lut-thumb-name {
    font-size: 11px;
    font-weight: 500;
    color: var(--text2);
    text-align: center;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lut-thumb-item.active .lut-thumb-name {
    color: var(--accent2);
    font-weight: 600;
}

/* Premium micro-interactions & animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.lut-thumb-item {
    animation: fadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.img-row {
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn {
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.tab-btn {
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@media(max-width:600px) {
    .sbs-wrap {
        grid-template-columns: 1fr
    }

    .ctrl-row {
        flex-direction: column;
        align-items: stretch
    }
}

/* FULL-SCREEN PROCESSING MODAL */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(9, 9, 11, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 28px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.show .modal-card {
    transform: scale(1);
    animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.modal-icon {
    margin-bottom: 4px;
}

.spinner {
    animation: rotate 1.5s linear infinite;
}

.spinner .path {
    stroke: var(--accent);
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

@keyframes rotate {
    100% { transform: rotate(360deg); }
}

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.modal-subtitle {
    font-size: 13px;
    color: var(--muted);
    margin: 0;
    line-height: 1.4;
}

.modal-card .prog-wrap {
    width: 100%;
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-card .prog-bar {
    width: 100%;
    height: 6px;
    background: var(--card2);
    border-radius: 99px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.modal-card .prog-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    border-radius: 99px;
    transition: width 0.1s linear;
}

.prog-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    font-weight: 500;
    color: var(--text2);
}

.prog-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 75%;
    text-align: left;
}

.prog-pct {
    color: var(--accent2);
    font-weight: 600;
}

/* SAVED LUTS LIBRARY */
.saved-lut-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--card2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-size: 12px;
    color: var(--text2);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.saved-lut-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--accent);
    color: var(--text);
}

.saved-lut-item.active {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--accent);
    color: var(--text);
    font-weight: 500;
}

.saved-lut-item .lut-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 80%;
}

.delete-saved-btn {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.delete-saved-btn:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

#saveLutBtn.saved {
    background: rgba(234, 179, 8, 0.1) !important;
    border-color: rgb(234, 179, 8) !important;
    color: rgb(234, 179, 8) !important;
}

#saveLutBtn.saved svg {
    fill: currentColor;
}

/* MOBILE OPTIMIZATIONS */
@media(max-width:600px) {
    .sbs-wrap {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .ctrl-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    header {
        flex-direction: column;
        height: auto;
        padding: 12px;
        gap: 8px;
        text-align: center;
    }
    
    .header-title {
        display: none; /* Hide middle title on small mobile screens */
    }
    
    .page-head {
        margin-bottom: 16px;
        text-align: center;
    }
    
    .page-head h1 {
        font-size: 20px;
    }
    
    .panel-body {
        padding: 12px;
    }
    
    /* Make buttons and inputs easy to tap on touch devices */
    .btn, .tab-btn, select, input {
        min-height: 42px !important;
    }

    .btn-row {
        flex-wrap: wrap;
        gap: 8px;
    }

    .btn {
        flex: 1 1 auto;
    }
    
    .split-wrap {
        max-height: 45vh; /* Limit vertical size on smaller screens to ensure visibility of options */
    }

    .lut-gallery-scroll {
        padding-bottom: 16px;
    }
}