:root {
    /* Light Mode (Default) */
    --primary: #6200ee;
    --primary-variant: #3700b3;
    --secondary: #018786;
    --background: #f8f9fa;
    --surface: #ffffff;
    --error: #b00020;
    --on-primary: #ffffff;
    --on-secondary: #ffffff;
    --on-background: #121212;
    --on-surface: #121212;
    --on-error: #ffffff;
    --glass: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(0, 0, 0, 0.08);
    --nav-bg: rgba(255, 255, 255, 0.6);
    --text-muted: rgba(0, 0, 0, 0.55);
    --text-dim: rgba(0, 0, 0, 0.7);
    --text-hint: rgba(0, 0, 0, 0.45);
    --grad-1: #eef2f3;
    --grad-2: #e0e0e0;
    --grad-3: #ffffff;
}

@media (prefers-color-scheme: dark) {
    :root {
        /* Darker Dark Mode */
        --primary: #bb86fc;
        --primary-variant: #3700b3;
        --secondary: #03dac6;
        --background: #000000;
        --surface: #0a0a0a;
        --error: #cf6679;
        --on-primary: #000000;
        --on-secondary: #000000;
        --on-background: #ffffff;
        --on-surface: #ffffff;
        --on-error: #000000;
        --glass: rgba(0, 0, 0, 0.4);
        --glass-border: rgba(255, 255, 255, 0.08);
        --nav-bg: rgba(0, 0, 0, 0.3);
        --text-muted: rgba(255, 255, 255, 0.5);
        --text-dim: rgba(255, 255, 255, 0.7);
        --text-hint: rgba(255, 255, 255, 0.4);
        --grad-1: #050505;
        --grad-2: #0a0a0a;
        --grad-3: #000000;
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--background);
    color: var(--on-background);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at top left, var(--grad-1), var(--grad-2), var(--grad-3), var(--background));
    overflow-x: hidden;
}

.container {
    width: 90%;
    max-width: 1100px;
    margin: 1rem auto;
    padding: 2rem;
    background: var(--glass);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    gap: 2rem;
}


header {
    text-align: center;
}

header h1 {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-dim);
    font-size: 1.1rem;
}

.upload-area {
    border: 2px dashed var(--glass-border);
    border-radius: 16px;
    padding: 3rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    background: var(--nav-bg);
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--primary);
    background: rgba(187, 134, 252, 0.05);
    transform: scale(1.01);
}

.upload-area i {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
    display: block;
}

.upload-area p {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--on-background);
}

.upload-area input {
    display: none;
}

.settings-panel {
    background: var(--nav-bg);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--glass-border);
}

.setting {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.setting-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: var(--primary);
}

#quality-display {
    background: var(--primary);
    color: var(--on-primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.setting-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

input[type="range"] {
    flex: 1;
    accent-color: var(--primary);
    cursor: pointer;
}

input[type="number"] {
    width: 60px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    color: var(--on-surface);
    padding: 0.5rem;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    opacity: 1;
}

.main-nav {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem;
    top: 1rem;
    z-index: 100;
    background: var(--nav-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    margin: 1.5rem auto 2.5rem;
    border-radius: 20px;
    width: fit-content;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 700;
    padding: 0.8rem 1.8rem;
    border-radius: 14px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid transparent;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-link:hover {
    color: var(--on-background);
    background: rgba(var(--primary-rgb, 187, 134, 252), 0.1);
}

.nav-link.active {
    color: var(--on-primary);
    background: var(--primary);
    box-shadow: 0 4px 15px rgba(var(--primary-rgb, 187, 134, 252), 0.4);
    transform: scale(1.02);
}

.results-actions {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
    animation: fadeIn 0.5s ease-out;
}

.download-all-btn {
    background: linear-gradient(45deg, var(--secondary), #018786);
    color: var(--on-secondary);
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(3, 218, 198, 0.2);
}

.download-all-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(3, 218, 198, 0.4);
    filter: brightness(1.1);
}

.download-all-btn:active {
    transform: translateY(0);
}

.download-all-btn i {
    font-size: 1.3rem;
}

.file-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.file-item {
    background: var(--surface);
    border-radius: 16px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border: 1px solid var(--glass-border);
    transition: transform 0.3s ease;
}

.file-item:hover {
    transform: translateY(-5px);
}

.file-preview {
    width: 100%;
    height: 150px;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.file-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

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

.file-size {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.status {
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status.pending {
    color: #ffb74d;
}

.status.working {
    color: #64b5f6;
}

.status.done {
    color: #81c784;
}

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

.download-btn {
    background: linear-gradient(45deg, var(--primary), var(--primary-variant));
    color: var(--on-primary);
    border: none;
    padding: 0.8rem;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: filter 0.3s ease;
}

.download-btn:hover {
    filter: brightness(1.2);
}

.download-btn.disabled {
    opacity: 0.5;
    pointer-events: none;
    background: #444;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #333;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s ease;
}

/* Spinner */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, .3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.info-section {
    background: var(--nav-bg);
    border-radius: 24px;
    padding: 2.5rem;
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    line-height: 1.6;
    color: var(--text-dim);
}

.info-section h2 {
    color: var(--on-background);
    font-size: 1.8rem;
    margin-bottom: 1.2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.info-section h2 i {
    color: var(--primary);
    font-size: 1.5rem;
}

.benefits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.two-cols {
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
}

.benefit {
    background: var(--nav-bg);
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    transition: transform 0.3s ease;
}

.benefit:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.05);
}

.benefit h3 {
    color: var(--secondary);
    margin-bottom: 0.8rem;
    font-size: 1.2rem;
}


.usage-list li strong {
    color: var(--on-background);
}

.benefit p {
    font-size: 0.95rem;
    line-height: 1.5;
    margin-top: 0.5rem;
}

.table-container {
    overflow-x: auto;
    margin-top: 1rem;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
}

.support-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--nav-bg);
    text-align: left;
}

.support-table th,
.support-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.support-table th {
    background: var(--nav-bg);
    color: var(--primary);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
}

.support-table tr:last-child td {
    border-bottom: none;
}

.support-table td i {
    width: 20px;
    margin-right: 0.5rem;
    font-size: 1.1rem;
}

.status-supported {
    color: var(--secondary);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-supported::before {
    content: '●';
    font-size: 0.8rem;
}

@media (max-width: 768px) {
    .container {
        padding: 1.5rem;
    }

    header h1 {
        font-size: 2.2rem;
    }

    .info-section {
        padding: 1.5rem;
    }
}

footer {
    text-align: center;
    color: var(--text-hint);
    font-size: 0.9rem;
}

@media all and (max-width: 800px) {

    .container {
        width: 96%;
        padding: 1rem;
        margin: 1rem;
    }

    .main-nav {
        margin: 0;
        padding: 0.4rem;
    }

    .main-nav a {
        padding: 0.5rem 1rem;
    }

}