:root {
    --bg: #0f1419;
    --bg-elevated: #171d25;
    --surface: #1c2430;
    --border: rgba(255, 255, 255, 0.08);
    --text: #e8eef4;
    --text-muted: #8b9aab;
    --accent: #3dd6c6;
    --accent-dim: rgba(61, 214, 198, 0.15);
    --accent-hot: #ff7a45;
    --success: #5ce0a0;
    --danger: #ff6b7a;
    --radius: 16px;
    --font: "Outfit", system-ui, sans-serif;
    --display: "Syne", "Outfit", sans-serif;
}

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

body {
    min-height: 100vh;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
    overflow-x: hidden;
}

.bg-glow {
    position: fixed;
    inset: -20% auto auto -10%;
    width: 60vw;
    height: 50vh;
    background: radial-gradient(ellipse, rgba(61, 214, 198, 0.18), transparent 65%);
    pointer-events: none;
    z-index: 0;
    animation: drift 14s ease-in-out infinite alternate;
}

.bg-glow::after {
    content: "";
    position: absolute;
    right: -40vw;
    top: 30vh;
    width: 45vw;
    height: 40vh;
    background: radial-gradient(ellipse, rgba(255, 122, 69, 0.12), transparent 70%);
}

.bg-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black, transparent);
    pointer-events: none;
    z-index: 0;
}

@keyframes drift {
    from { transform: translate(0, 0); }
    to { transform: translate(4%, 6%); }
}

.site-header,
.app,
.site-footer {
    position: relative;
    z-index: 1;
}

.site-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    max-width: 920px;
    margin: 0 auto;
    padding: 2rem 1.5rem 1rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text);
}

.brand-mark {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), #2a9d8f 50%, var(--accent-hot));
    box-shadow: 0 0 24px rgba(61, 214, 198, 0.35);
    animation: pulse-mark 3s ease-in-out infinite;
}

@keyframes pulse-mark {
    0%, 100% { box-shadow: 0 0 20px rgba(61, 214, 198, 0.3); }
    50% { box-shadow: 0 0 32px rgba(61, 214, 198, 0.55); }
}

.brand-name {
    font-family: var(--display);
    font-weight: 800;
    font-size: 1.35rem;
    letter-spacing: -0.03em;
}

.tagline {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.app {
    max-width: 920px;
    margin: 0 auto;
    padding: 0 1.5rem 3rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.hero-panel {
    border: 2px dashed rgba(61, 214, 198, 0.35);
    border-radius: calc(var(--radius) + 4px);
    background: linear-gradient(160deg, rgba(28, 36, 48, 0.9), rgba(15, 20, 25, 0.6));
    padding: 3.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s ease;
    outline: none;
}

.hero-panel:hover,
.hero-panel:focus-visible {
    border-color: var(--accent);
    background: linear-gradient(160deg, rgba(61, 214, 198, 0.08), rgba(15, 20, 25, 0.7));
}

.hero-panel.dragover {
    border-color: var(--accent);
    border-style: solid;
    background: var(--accent-dim);
    transform: scale(1.01);
}

.drop-icon {
    color: var(--accent);
    margin-bottom: 1rem;
    display: inline-flex;
    animation: float 4s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.drop-content h1 {
    font-family: var(--display);
    font-weight: 800;
    font-size: clamp(1.75rem, 4vw, 2.4rem);
    letter-spacing: -0.04em;
    margin-bottom: 0.5rem;
}

.drop-content p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    max-width: 28rem;
    margin-inline: auto;
}

.btn {
    font-family: var(--font);
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    border-radius: 10px;
    padding: 0.7rem 1.25rem;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.2s ease, opacity 0.2s ease;
}

.btn:active {
    transform: scale(0.97);
}

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

.btn-primary {
    background: var(--accent);
    color: #062520;
}

.btn-primary:hover:not(:disabled) {
    background: #55e4d4;
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.btn-ghost:hover:not(:disabled) {
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-sm {
    padding: 0.45rem 0.85rem;
    font-size: 0.85rem;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.control-row {
    flex: 1;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-row label {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.control-row label span {
    color: var(--accent);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.quality-input-group {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.quality-input-group input,
.quality-input-group select {
    width: 100%;
    min-width: 0;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 0.85rem;
    background: var(--bg-elevated);
    color: var(--text);
    font-size: 0.95rem;
}

.quality-input-group input {
    flex: 1;
}

.quality-input-group select {
    width: auto;
    flex: none;
}

.control-row input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

.control-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 12px rgba(61, 214, 198, 0.5);
}

.control-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.stat {
    padding: 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-align: center;
}

.stat.highlight {
    border-color: rgba(61, 214, 198, 0.35);
    background: var(--accent-dim);
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-family: var(--display);
    font-weight: 700;
    font-size: 1.15rem;
    font-variant-numeric: tabular-nums;
}

.status-msg {
    padding: 0.85rem 1rem;
    border-radius: 12px;
    background: var(--accent-dim);
    border: 1px solid rgba(61, 214, 198, 0.3);
    color: var(--accent);
    font-size: 0.9rem;
}

.status-msg.error {
    background: rgba(255, 107, 122, 0.12);
    border-color: rgba(255, 107, 122, 0.35);
    color: var(--danger);
}

.file-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.file-item {
    display: grid;
    grid-template-columns: 64px 1fr auto;
    gap: 1rem;
    align-items: center;
    padding: 0.85rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    animation: slide-in 0.35s ease both;
}

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

.file-thumb {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--bg);
}

.file-meta {
    min-width: 0;
}

.file-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-sizes {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.file-sizes .saved {
    color: var(--success);
    font-weight: 600;
}

.file-actions {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.site-footer {
    max-width: 920px;
    margin: 0 auto;
    padding: 0 1.5rem 2.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

[hidden] {
    display: none !important;
}

@media (max-width: 640px) {
    .stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .file-item {
        grid-template-columns: 52px 1fr;
    }

    .file-actions {
        grid-column: 1 / -1;
        justify-content: stretch;
    }

    .file-actions .btn {
        flex: 1;
    }

    .hero-panel {
        padding: 2.5rem 1rem;
    }

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

    .control-actions {
        justify-content: stretch;
    }

    .control-actions .btn {
        flex: 1;
    }
}
