:root {
    color-scheme: dark;
    --bg: #070911;
    --panel: rgba(18, 24, 42, 0.76);
    --panel-strong: rgba(24, 32, 54, 0.92);
    --text: #eef4ff;
    --muted: #97a3b8;
    --line: rgba(255, 255, 255, 0.12);
    --accent: #35e4c8;
    --accent-2: #8a7dff;
    --danger: #ff6584;
    --ok: #47d18c;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

[data-theme="light"] {
    color-scheme: light;
    --bg: #f5f7fb;
    --panel: rgba(255, 255, 255, 0.78);
    --panel-strong: rgba(255, 255, 255, 0.96);
    --text: #141824;
    --muted: #667085;
    --line: rgba(20, 24, 36, 0.12);
    --shadow: 0 22px 55px rgba(65, 74, 101, 0.18);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(53, 228, 200, 0.18), transparent 34rem),
        radial-gradient(circle at 90% 12%, rgba(138, 125, 255, 0.22), transparent 32rem),
        var(--bg);
    color: var(--text);
}

button,
input {
    font: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    width: min(1480px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 42px;
}

.topbar,
.workspace,
.panel-card,
.dropzone,
.image-card,
.progress-wrap,
.empty-state {
    border: 1px solid var(--line);
    background: var(--panel);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow);
}

.topbar {
    position: sticky;
    top: 14px;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px;
    border-radius: 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #071018;
    font-weight: 800;
}

.brand strong,
.brand small {
    display: block;
}

.brand small {
    color: var(--muted);
    font-size: 12px;
    margin-top: 2px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 18px;
    margin-top: 18px;
    padding: 18px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.04);
}

.main-panel {
    min-width: 0;
}

.hero-band {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    padding: 18px 4px 22px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    max-width: 780px;
    margin-bottom: 0;
    font-size: clamp(34px, 5vw, 64px);
    line-height: 1;
    letter-spacing: 0;
}

.status-pill,
.file-badge {
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 9px 13px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.06);
    font-size: 13px;
    white-space: nowrap;
}

.dropzone {
    position: relative;
    overflow: hidden;
    display: grid;
    min-height: 290px;
    place-items: center;
    border-radius: 24px;
    border-style: dashed;
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.dropzone.is-dragging {
    transform: translateY(-2px);
    border-color: var(--accent);
    background: rgba(53, 228, 200, 0.12);
}

.dropzone-orbit {
    position: absolute;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(53, 228, 200, 0.34), rgba(138, 125, 255, 0.28));
    filter: blur(40px);
    opacity: 0.72;
    animation: pulse 3.5s ease-in-out infinite;
}

.dropzone-content {
    position: relative;
    width: min(560px, 92%);
    text-align: center;
}

.upload-icon {
    display: inline-grid;
    width: 64px;
    height: 64px;
    place-items: center;
    margin-bottom: 16px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #061018;
    font-size: 34px;
    font-weight: 600;
}

.dropzone h2,
.section-heading h2 {
    margin-bottom: 8px;
    font-size: 24px;
}

.dropzone p,
.section-heading p,
.card-status,
.history-list p {
    color: var(--muted);
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button,
.remove-button {
    border: 0;
    cursor: pointer;
    transition: transform 160ms ease, opacity 160ms ease, box-shadow 160ms ease;
}

.primary-button,
.secondary-button,
.ghost-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border-radius: 13px;
    padding: 0 16px;
    font-weight: 800;
}

.primary-button {
    color: #061018;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 14px 32px rgba(53, 228, 200, 0.18);
}

.secondary-button {
    color: var(--text);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--line);
}

.ghost-button {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--line);
}

.icon-button,
.remove-button {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 13px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--line);
}

.remove-button {
    width: 34px;
    height: 34px;
    color: var(--danger);
    font-size: 22px;
}

button:hover,
a.primary-button:hover,
a.ghost-button:hover {
    transform: translateY(-1px);
}

button:disabled,
.disabled {
    pointer-events: none;
    opacity: 0.45;
}

.progress-wrap {
    margin-top: 18px;
    padding: 14px;
    border-radius: 18px;
}

.progress-meta,
.section-heading,
.panel-title,
.switch-row,
.range-field span,
.card-toolbar,
.card-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.progress-meta {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 10px;
}

.progress-track {
    overflow: hidden;
    height: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
}

#progressBar {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    transition: width 220ms ease;
}

.section-heading {
    margin: 24px 0 14px;
}

.section-heading p {
    margin-bottom: 0;
}

.empty-state {
    display: grid;
    min-height: 150px;
    place-items: center;
    border-radius: 20px;
    text-align: center;
}

.empty-state span {
    display: block;
    margin-top: 6px;
    color: var(--muted);
}

.hidden {
    display: none;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.image-card {
    overflow: hidden;
    border-radius: 20px;
    background: var(--panel-strong);
    transition: transform 180ms ease, border-color 180ms ease;
}

.image-card:hover {
    transform: translateY(-3px);
}

.image-card.is-processing {
    border-color: var(--accent);
}

.image-card.is-done {
    border-color: rgba(71, 209, 140, 0.7);
}

.image-card.has-error {
    border-color: rgba(255, 101, 132, 0.8);
}

.card-toolbar {
    padding: 12px;
}

.preview-slider {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background:
        linear-gradient(45deg, rgba(255, 255, 255, 0.06) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(255, 255, 255, 0.06) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.06) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.06) 75%);
    background-size: 22px 22px;
    background-position: 0 0, 0 11px, 11px -11px, -11px 0;
}

.before-preview,
.after-layer,
.svg-preview {
    position: absolute;
    inset: 0;
}

.before-preview {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.after-layer {
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.88);
}

.svg-preview {
    display: grid;
    place-items: center;
}

.svg-preview svg {
    width: 92%;
    height: 92%;
    max-width: 100%;
    max-height: 100%;
}

.slider-control {
    position: absolute;
    inset: 0;
    z-index: 4;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: ew-resize;
}

.slider-line {
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 3;
    width: 2px;
    background: var(--accent);
    box-shadow: 0 0 20px rgba(53, 228, 200, 0.8);
}

.slider-line::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent);
    transform: translate(-50%, -50%);
    box-shadow: 0 0 0 6px rgba(53, 228, 200, 0.18);
}

.card-body {
    padding: 14px;
}

.file-name {
    overflow: hidden;
    margin-bottom: 6px;
    font-size: 16px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-status {
    min-height: 42px;
    margin-bottom: 14px;
    font-size: 13px;
}

.settings-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.panel-card {
    padding: 18px;
    border-radius: 22px;
}

.panel-title {
    margin-bottom: 18px;
}

.panel-title span {
    font-weight: 900;
}

.panel-title small {
    color: var(--muted);
}

.range-field {
    display: grid;
    gap: 10px;
    margin-bottom: 20px;
}

.range-field output {
    color: var(--accent);
    font-weight: 900;
}

input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
}

.toggle-list {
    display: grid;
    gap: 12px;
    margin-top: 8px;
}

.switch-row {
    padding: 12px 0;
    border-top: 1px solid var(--line);
}

.switch-row input {
    width: 44px;
    height: 24px;
    accent-color: var(--accent);
}

.history-list {
    display: grid;
    gap: 10px;
}

.history-list a {
    overflow: hidden;
    border-radius: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.07);
    color: var(--text);
    text-overflow: ellipsis;
    white-space: nowrap;
}

@keyframes pulse {
    0%,
    100% {
        transform: scale(0.95);
    }
    50% {
        transform: scale(1.08);
    }
}

@media (max-width: 1040px) {
    .workspace {
        grid-template-columns: 1fr;
    }

    .settings-panel {
        grid-row: 1;
    }
}

@media (max-width: 720px) {
    .app-shell {
        width: min(100% - 18px, 1480px);
        padding-top: 10px;
    }

    .topbar,
    .hero-band,
    .section-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar-actions,
    .card-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }

    .icon-button {
        width: 100%;
    }

    .workspace {
        padding: 10px;
        border-radius: 18px;
    }

    h1 {
        font-size: 38px;
    }

    .dropzone {
        min-height: 250px;
    }

    .image-grid {
        grid-template-columns: 1fr;
    }
}

