:root {
    color-scheme: dark;
    --bg: #08070d;
    --panel: #12101c;
    --panel-2: #1a1728;
    --line: rgba(200, 180, 255, 0.07);
    --line-strong: rgba(200, 180, 255, 0.14);
    --ink: #ece8f7;
    --ink-2: #bdb5d4;
    --ink-3: #7c749a;
    --accent: #a78bfa;
    --accent-2: #c4b1ff;
    --good: #a78bfa;
    --bad: #d8b4fe;
    --accent-soft: rgba(167, 139, 250, 0.16);
    --accent-softer: rgba(167, 139, 250, 0.06);
    --shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.6), 0 8px 20px -8px rgba(0, 0, 0, 0.5);
    --radius: 8px;
    --font: "DM Sans", Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

[data-theme="light"] {
    color-scheme: light;
    --bg: #f5f3fb;
    --panel: #ffffff;
    --panel-2: #f3efff;
    --line: rgba(45, 25, 90, 0.08);
    --line-strong: rgba(45, 25, 90, 0.16);
    --ink: #160d2e;
    --ink-2: #433764;
    --ink-3: #746a8f;
    --accent: #6d4fd8;
    --accent-2: #8a6df0;
    --good: #6d4fd8;
    --bad: #7e3fb5;
    --accent-soft: rgba(109, 79, 216, 0.12);
    --accent-softer: rgba(109, 79, 216, 0.05);
    --shadow: 0 24px 60px -24px rgba(45, 25, 90, 0.22), 0 8px 20px -10px rgba(45, 25, 90, 0.15);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    background:
        radial-gradient(circle at top left, var(--accent-softer), transparent 34vw),
        var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 14px;
    letter-spacing: 0;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.shell {
    width: min(960px, calc(100vw - 28px));
    margin: 0 auto;
    padding: 24px 0 40px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}

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

.brand-lockup img {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    padding: 4px;
    box-shadow: 0 0 20px var(--accent-softer);
}

.brand-name {
    font-weight: 700;
    font-size: 18px;
    line-height: 1;
}

.brand-name span {
    color: var(--accent);
}

.brand-sub,
.drop-sub,
.status-line,
.queue-head p,
.file-meta {
    color: var(--ink-3);
}

.brand-sub {
    margin-top: 4px;
    font-size: 12px;
}

.converter {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow);
    padding: clamp(14px, 2.4vw, 24px);
    display: grid;
    gap: 14px;
}

.drop-zone {
    min-height: 220px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--panel-2) 64%, var(--bg));
    display: grid;
    place-items: center;
    align-content: center;
    gap: 10px;
    text-align: center;
    outline: none;
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.drop-zone:hover,
.drop-zone.dragging,
.drop-zone:focus-visible {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--accent) 80%, var(--line));
    background: color-mix(in srgb, var(--panel-2) 86%, var(--accent-soft));
}

.drop-title {
    font-size: clamp(28px, 5vw, 48px);
    font-weight: 700;
    line-height: 1;
}

.format-row {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.format-row span {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    color: var(--ink-2);
    font-family: var(--mono);
    font-size: 11px;
    padding: 5px 8px;
}

.controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto auto;
    gap: 9px;
    align-items: center;
}

.toggle {
    min-height: 40px;
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel-2);
    padding: 8px 10px;
    color: var(--ink-2);
    user-select: none;
}

.toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.track {
    width: 34px;
    height: 19px;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    background: var(--bg);
    position: relative;
    flex: 0 0 auto;
}

.track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--ink-3);
    transition: transform 140ms ease, background 140ms ease;
}

.toggle input:checked + .track::after {
    transform: translateX(15px);
    background: var(--accent);
}

.theme-toggle,
.ghost-btn,
.secondary,
.primary,
.remove-file {
    min-height: 38px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--panel-2);
    color: var(--ink);
    padding: 0 13px;
}

.primary {
    background: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 70%, white);
    color: var(--bg);
    font-weight: 700;
}

.primary:disabled,
.secondary:disabled,
.ghost-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.queue-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-top: 2px;
}

h1 {
    margin: 0;
    font-size: 22px;
    line-height: 1.15;
}

.queue-head p {
    margin: 5px 0 0;
}

.progress-track {
    height: 7px;
    overflow: hidden;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--panel-2);
}

.progress-track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    transition: width 180ms ease;
}

body.is-busy .progress-track span {
    animation: active-progress 1.2s ease-in-out infinite;
}

.status-line {
    min-height: 20px;
    font-size: 13px;
}

.status-line.error {
    color: var(--bad);
}

.file-list {
    display: grid;
    gap: 9px;
}

.file-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel-2);
    padding: 10px;
    animation: row-in 160ms ease both;
}

.file-badge {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: var(--radius);
    background: var(--accent-soft);
    color: var(--accent);
    font-family: var(--mono);
    font-size: 12px;
}

.file-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
}

.file-meta {
    display: block;
    margin-top: 3px;
    font-size: 12px;
}

.theme-toggle {
    width: 38px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    font-size: 18px;
    line-height: 1;
}

.theme-icon {
    display: none;
}

[data-theme="dark"] .theme-icon-moon,
[data-theme="light"] .theme-icon-sun {
    display: block;
}

.empty-state {
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    color: var(--ink-3);
    text-align: center;
    padding: 18px 8px;
}

@keyframes active-progress {
    0% {
        transform: translateX(-85%);
    }
    100% {
        transform: translateX(185%);
    }
}

@keyframes row-in {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 1ms !important;
    }
}

@media (max-width: 760px) {
    .shell {
        width: min(100vw - 20px, 960px);
        padding-top: 14px;
    }

    .topbar,
    .queue-head {
        align-items: stretch;
        flex-direction: column;
    }

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

    .file-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .file-badge {
        display: none;
    }
}
