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

:root {
    --purple: #7C3AED;
    --purple-dark: #6D28D9;
    --indigo: #4F46E5;
    --purple-light: #EDE9FE;
    --purple-xlight: #F5F3FF;
    --text: #1E1B4B;
    --text-secondary: #6B7280;
    --border: #E5E7EB;
    --surface: #FFFFFF;
    --bg: #F9F8FF;
    --success: #059669;
    --success-bg: #ECFDF5;
    --error: #DC2626;
    --error-bg: #FEF2F2;
    --info: #2563EB;
    --info-bg: #EFF6FF;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.07), 0 4px 16px rgba(124,58,237,0.06);
    --shadow-hover: 0 2px 8px rgba(0,0,0,0.10), 0 8px 24px rgba(124,58,237,0.12);
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ─── HERO ─────────────────────────────────── */

.hero {
    background: linear-gradient(135deg, #7C3AED 0%, #4F46E5 100%);
    color: white;
    padding: 0 0 48px;
}

.hero-inner {
    max-width: 720px;
    margin: 0 auto;
    padding: 20px 24px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.1rem;
    color: white;
    text-decoration: none;
}

.badge-private {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 0.78rem;
    font-weight: 500;
    color: rgba(255,255,255,0.9);
    backdrop-filter: blur(4px);
}

.hero-content {
    max-width: 720px;
    margin: 0 auto;
    padding: 40px 24px 0;
    text-align: center;
}

.hero-content h1 {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
    color: white;
}

.hero-content p {
    font-size: 1.05rem;
    color: rgba(255,255,255,0.82);
    max-width: 520px;
    margin: 0 auto;
}

/* ─── MAIN ─────────────────────────────────── */

.main {
    padding: 32px 16px 48px;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ─── CARDS ────────────────────────────────── */

.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
}

/* ─── UPLOAD ───────────────────────────────── */

.upload-card {
    padding: 24px;
}

.drop-zone {
    border: 2px dashed #C4B5FD;
    border-radius: var(--radius);
    padding: 40px 24px;
    text-align: center;
    background: var(--purple-xlight);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--purple);
    background: var(--purple-light);
}

.drop-zone-icon {
    width: 64px;
    height: 64px;
    background: white;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--purple);
    box-shadow: 0 2px 8px rgba(124,58,237,0.15);
    margin-bottom: 4px;
}

.drop-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.drop-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

/* ─── FILE LIST ────────────────────────────── */

.file-list {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--purple-xlight);
    border: 1px solid #DDD6FE;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.875rem;
    color: var(--text);
}

.file-info-icon {
    min-width: 44px;
    height: 26px;
    padding: 0 6px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.file-info-icon.flac {
    background: #7C3AED;
    color: white;
}

.file-info-icon.cue {
    background: #4F46E5;
    color: white;
}

.file-info-icon.cover {
    background: #059669;
    color: white;
}

.file-info-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.file-info-meta {
    color: var(--text-secondary);
    font-size: 0.8rem;
    white-space: nowrap;
}

/* ─── COVER ────────────────────────────────── */

.cover-area {
    margin-top: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.cover-placeholder {
    width: 140px;
    height: 90px;
    border: 2px dashed #C4B5FD;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--purple);
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--purple-xlight);
    white-space: nowrap;
}

.cover-placeholder:hover {
    background: var(--purple-light);
    border-color: var(--purple);
}

.cover-preview {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: var(--radius-sm);
    overflow: visible;
}

.cover-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-sm);
    display: block;
}

.cover-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: #EF4444;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 10;
    transition: all 0.2s;
    padding: 0;
}

.cover-remove:hover {
    background: #DC2626;
    transform: scale(1.1);
}

/* ─── TRACKS ───────────────────────────────── */

.tracks-card {
    padding-bottom: 24px;
}

.col-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--purple);
    cursor: pointer;
    display: block;
    margin: 0 auto;
}

.table-wrap {
    overflow-x: auto;
}

.tracks-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.tracks-table thead th {
    padding: 10px 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    background: #FAFAFA;
    border-bottom: 1px solid var(--border);
}

.tracks-table tbody tr {
    border-bottom: 1px solid #F3F4F6;
    transition: background 0.1s;
}

.tracks-table tbody tr:last-child {
    border-bottom: none;
}

.tracks-table tbody tr:hover {
    background: var(--purple-xlight);
}

.tracks-table td {
    padding: 10px 16px;
    vertical-align: middle;
}

.col-check { width: 40px; }
.col-num { width: 44px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.col-time { width: 100px; color: var(--text-secondary); font-variant-numeric: tabular-nums; font-size: 0.8rem; }
.col-dur { width: 110px; }

.tracks-table input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--purple);
    cursor: pointer;
}

.tracks-table input[type="text"] {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--text);
    background: transparent;
    transition: all 0.15s;
}

.tracks-table input[type="text"]:hover {
    border-color: #DDD6FE;
    background: var(--purple-xlight);
}

.tracks-table input[type="text"]:focus {
    outline: none;
    border-color: var(--purple);
    background: white;
    box-shadow: 0 0 0 3px rgba(124,58,237,0.1);
}

/* ─── ACTIONS ──────────────────────────────── */

.actions {
    display: flex;
    gap: 12px;
    padding: 0 24px 24px;
    flex-wrap: wrap;
    align-items: center;
}

.quality-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 20px 24px 14px;
    flex-wrap: wrap;
}

.quality-row label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.quality-select {
    appearance: none;
    -webkit-appearance: none;
    background-color: white;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    padding: 7px 30px 7px 11px;
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--text);
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 7px center;
    background-size: 16px;
    transition: border-color 0.15s;
}

.quality-select:hover {
    border-color: #A78BFA;
}

.quality-select:focus {
    outline: none;
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(124,58,237,0.1);
}

/* ─── FFMPEG STATUS ────────────────────────── */

.ffmpeg-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-left: 4px;
    transition: opacity 0.4s ease;
}

.ffmpeg-status.hidden {
    opacity: 0;
    pointer-events: none;
}

.ffmpeg-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ffmpeg-dot.loading {
    background: #F59E0B;
    animation: ffmpeg-pulse 1.4s ease-in-out infinite;
}

.ffmpeg-dot.ready {
    background: #10B981;
}

@keyframes ffmpeg-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

/* ─── BUTTONS ──────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--purple) 0%, var(--indigo) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(124,58,237,0.35);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(124,58,237,0.45);
}

.btn-primary:disabled {
    background: #D1D5DB;
    box-shadow: none;
    cursor: not-allowed;
}

.btn-outline {
    background: white;
    color: var(--purple);
    border: 1.5px solid var(--purple);
    padding: 8px 18px;
    font-size: 0.875rem;
}

.btn-outline:hover {
    background: var(--purple-light);
}

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

.btn-ghost:hover {
    background: #F3F4F6;
    color: var(--text);
}

.btn-stop {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: #FEE2E2;
    color: #DC2626;
    transition: all 0.2s;
}

.btn-stop:hover {
    background: #FECACA;
}

/* ─── PROGRESS ─────────────────────────────── */

.progress-card {
    padding: 24px;
}

.progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.progress-group {
    margin-bottom: 16px;
}

.progress-group:last-child {
    margin-bottom: 0;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}

.progress-bar-wrap {
    width: 100%;
}

progress {
    width: 100%;
    height: 8px;
    border-radius: 99px;
    border: none;
    overflow: hidden;
    appearance: none;
    -webkit-appearance: none;
}

progress::-webkit-progress-bar {
    background: #E5E7EB;
    border-radius: 99px;
}

progress::-webkit-progress-value {
    border-radius: 99px;
    transition: width 0.3s ease;
}

#trackProgressBar::-webkit-progress-value {
    background: linear-gradient(90deg, var(--purple) 0%, var(--indigo) 100%);
}

#totalProgressBar::-webkit-progress-value {
    background: linear-gradient(90deg, #059669 0%, #10B981 100%);
}

progress::-moz-progress-bar {
    background: linear-gradient(90deg, var(--purple) 0%, var(--indigo) 100%);
    border-radius: 99px;
}

/* ─── STATUS ───────────────────────────────── */

.status-box {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    border-left: 4px solid;
}

.status-box.success {
    background: var(--success-bg);
    color: var(--success);
    border-color: var(--success);
}

.status-box.error {
    background: var(--error-bg);
    color: var(--error);
    border-color: var(--error);
}

.status-box.info {
    background: var(--info-bg);
    color: var(--info);
    border-color: var(--info);
}

/* ─── HOW IT WORKS ─────────────────────────── */

.how-it-works {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px 24px;
}

.how-it-works h2,
.faq h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 20px;
}

.steps {
    display: flex;
    align-items: stretch;
    gap: 12px;
    flex-wrap: wrap;
}

.step {
    flex: 1;
    min-width: 140px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--purple-xlight);
    border-radius: var(--radius-sm);
    padding: 14px;
}

.step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--purple) 0%, var(--indigo) 100%);
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.step-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.step-text strong {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
}

.step-text span {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.step-arrow {
    color: #C4B5FD;
    font-size: 1.2rem;
    font-weight: 300;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

/* ─── FAQ ──────────────────────────────────── */

.faq {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px 24px;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.faq-item {
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.faq-item summary {
    padding: 14px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--text);
    border-radius: var(--radius-sm);
    transition: background 0.15s;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.faq-item summary::after {
    content: '+';
    font-size: 1.2rem;
    font-weight: 400;
    color: var(--purple);
    transition: transform 0.2s;
    margin-left: 12px;
    flex-shrink: 0;
}

.faq-item[open] summary::after {
    content: '−';
}

.faq-item summary:hover {
    background: var(--purple-xlight);
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item p {
    padding: 0 16px 14px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ─── FOOTER ───────────────────────────────── */

.footer {
    background: white;
    border-top: 1px solid var(--border);
    padding: 20px 16px;
}

.footer-inner {
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
    text-align: center;
}

.footer-dot {
    color: #D1D5DB;
}

/* ─── RESPONSIVE ───────────────────────────── */

@media (max-width: 600px) {
    .hero-inner {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .hero-content {
        padding-top: 28px;
    }

    .hero-content h1 {
        font-size: 1.5rem;
    }

    .upload-card {
        padding: 16px;
    }

    .drop-zone {
        padding: 28px 16px;
    }

    .actions {
        flex-direction: column;
        padding: 0 16px;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .steps {
        flex-direction: column;
        gap: 8px;
    }

    .step-arrow {
        transform: rotate(90deg);
        align-self: center;
    }

    .col-time,
    .col-dur {
        display: none;
    }

    .col-title {
        max-width: 160px;
    }

    .footer-inner {
        flex-direction: column;
        gap: 4px;
    }

    .footer-dot {
        display: none;
    }
}
