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

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-glow: rgba(59, 130, 246, 0.15);
    --accent: #06b6d4;
    --background: #0f172a;
    --background-subtle: #1e293b;
    --surface: #1e293b;
    --surface-hover: #334155;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-light: #64748b;
    --border: #334155;
    --border-light: rgba(148, 163, 184, 0.12);
    --success: #22c55e;
    --success-glow: rgba(34, 197, 94, 0.15);
    --error: #ef4444;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3);
    --radius: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--background);
    color: var(--text);
    min-height: 100vh;
    padding: 2rem 1rem;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}



header {
    text-align: center;
    color: var(--text);
    margin-bottom: 2.5rem;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    letter-spacing: -0.02em;
}

header h1 svg {
    color: var(--primary);
}

footer {
    text-align: center;
    margin-top: 2.5rem;
    padding-bottom: 1rem;
}

footer a {
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s;
}

footer a:hover {
    color: var(--text-secondary);
}

main {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
}

.dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 3.5rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    background: var(--background);
}

.dropzone:hover,
.dropzone.drag-over {
    border-color: var(--primary);
    background: var(--primary-glow);
}

.dropzone svg {
    color: var(--text-light);
    margin-bottom: 1.25rem;
    transition: color 0.25s;
}

.dropzone:hover svg {
    color: var(--primary);
}

.dropzone h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.35rem;
}

.dropzone p {
    color: var(--text-light);
    font-size: 0.9rem;
}

.hidden {
    display: none !important;
}

.files-section,
.settings-section,
.progress-section,
.results-section {
    margin-top: 2rem;
}

h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.files-list,
.progress-list,
.results-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.file-item,
.progress-item,
.result-item {
    background: var(--background);
    padding: 1rem 1.25rem;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: background 0.15s;
}

.file-item:hover {
    background: var(--surface-hover);
}

.file-item svg,
.progress-item svg,
.result-item svg {
    flex-shrink: 0;
    color: var(--primary);
}

.file-info,
.progress-info,
.result-info {
    flex: 1;
}

.file-name,
.progress-name,
.result-name {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.15rem;
    font-size: 0.95rem;
}

.file-size,
.progress-status,
.result-status {
    font-size: 0.85rem;
    color: var(--text-light);
}

.remove-btn {
    background: none;
    border: none;
    color: var(--error);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background 0.2s;
}

.remove-btn:hover {
    background: rgba(245, 101, 101, 0.1);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

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

.setting-group label {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.setting-group select {
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    background: var(--background);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

.setting-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.convert-btn,
.download-btn {
    width: 100%;
    padding: 0.85rem 2rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    transition: background 0.2s, box-shadow 0.2s;
}

.convert-btn:hover,
.download-btn:hover {
    background: var(--primary-dark);
    box-shadow: 0 0 20px var(--primary-glow);
}

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

.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.5rem;
}

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

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    color: var(--text);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-overlay p {
    margin-top: 1.5rem;
    font-size: 1.1rem;
}

.download-btn {
    background: var(--success);
}

.download-btn:hover {
    background: #16a34a;
    box-shadow: 0 0 20px var(--success-glow);
}

@media (max-width: 640px) {
    body {
        padding: 1rem 0.5rem;
    }

    header h1 {
        font-size: 1.6rem;
    }

    main {
        padding: 1.25rem;
        border-radius: 10px;
    }

    .dropzone {
        padding: 2.5rem 1rem;
    }

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

/* Small height viewports */
@media (max-height: 700px) {
    body {
        padding: 1rem 1rem;
    }

    header {
        margin-bottom: 1rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    header h1 svg {
        width: 24px;
        height: 24px;
    }

    main {
        padding: 1.25rem;
    }

    .dropzone {
        padding: 2rem 1.5rem;
    }

    .dropzone svg {
        width: 40px;
        height: 40px;
        margin-bottom: 0.75rem;
    }

    .dropzone h2 {
        font-size: 1.1rem;
    }

    .files-section,
    .settings-section,
    .progress-section,
    .results-section {
        margin-top: 1.25rem;
    }

    h3 {
        margin-bottom: 0.75rem;
        font-size: 1rem;
    }

    .settings-grid {
        gap: 1rem;
        margin-bottom: 1.25rem;
    }

    footer {
        margin-top: 1.25rem;
    }
}

@media (max-height: 500px) {
    body {
        padding: 0.5rem 0.75rem;
    }

    header {
        margin-bottom: 0.5rem;
    }

    header h1 {
        font-size: 1.25rem;
    }

    main {
        padding: 0.75rem;
    }

    .dropzone {
        padding: 1rem 1rem;
    }

    .dropzone svg {
        width: 32px;
        height: 32px;
        margin-bottom: 0.5rem;
    }

    .dropzone h2 {
        font-size: 1rem;
        margin-bottom: 0.15rem;
    }

    .dropzone p {
        font-size: 0.8rem;
    }

    .files-section,
    .settings-section,
    .progress-section,
    .results-section {
        margin-top: 0.75rem;
    }

    h3 {
        margin-bottom: 0.5rem;
        font-size: 0.9rem;
    }

    .file-item,
    .progress-item,
    .result-item {
        padding: 0.65rem 0.85rem;
        gap: 0.65rem;
    }

    .files-list,
    .progress-list,
    .results-list {
        gap: 0.5rem;
    }

    .settings-grid {
        gap: 0.75rem;
        margin-bottom: 0.75rem;
    }

    .setting-group select {
        padding: 0.45rem 0.6rem;
        font-size: 0.85rem;
    }

    .convert-btn,
    .download-btn {
        padding: 0.6rem 1.5rem;
        font-size: 0.9rem;
    }

    footer {
        margin-top: 0.75rem;
        padding-bottom: 0.5rem;
    }
}

/* Combined small width + small height */
@media (max-width: 640px) and (max-height: 500px) {
    .settings-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
