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

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #16a34a;
    --success-hover: #15803d;
    --success-light: #dcfce7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --border-focus: #93c5fd;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.app {
    max-width: 680px;
    margin: 0 auto;
    padding: 40px 20px 60px;
}

/* ── Header ── */
.header {
    text-align: center;
    margin-bottom: 36px;
}

.header-icon {
    font-size: 40px;
    margin-bottom: 12px;
    display: block;
}

.header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.025em;
    line-height: 1.3;
}

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

.header p {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-top: 8px;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

/* ── Card ── */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

/* ── Drop Zone ── */
.dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg);
    position: relative;
}

.dropzone:hover,
.dropzone.drag-over {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.dropzone.drag-over {
    transform: scale(1.01);
}

.dropzone-icon {
    font-size: 40px;
    display: block;
    margin-bottom: 12px;
}

.dropzone-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.dropzone-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.dropzone-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    padding: 8px 20px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--card);
    border: 1px solid var(--primary);
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all 0.15s ease;
}

.dropzone-btn:hover {
    background: var(--primary);
    color: #fff;
}

.dropzone input[type="file"] {
    display: none;
}

/* ── File List ── */
.file-list {
    margin-top: 20px;
}

.file-list-header {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    gap: 12px;
    transition: all 0.15s ease;
    animation: slideIn 0.25s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.file-item:hover {
    border-color: var(--border-focus);
}

.file-status {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    opacity: 0.5;
}

.status-done .status-dot {
    background: var(--success);
    opacity: 1;
}

.status-done .status-dot::after {
    content: '✓';
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--success);
}

.status-done .status-dot {
    background: transparent;
    opacity: 1;
}

.status-done .status-dot::before {
    content: '';
    display: block;
}

.spinner-icon {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.file-remove {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-xs);
    font-size: 14px;
    transition: all 0.15s ease;
}

.file-remove:hover {
    background: var(--danger-light);
    color: var(--danger);
}

/* ── Progress Bar ── */
.file-progress {
    margin-top: 8px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.file-progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.15s ease;
    width: 0%;
}

.file-progress-bar.done {
    background: var(--success);
}

.file-progress-bar.error {
    background: var(--danger);
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    line-height: 1.4;
}

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

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 1px 2px rgba(37,99,235,0.3);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(37,99,235,0.35);
}

.btn-primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-success {
    background: var(--success);
    color: #fff;
    box-shadow: 0 1px 2px rgba(22,163,74,0.3);
}

.btn-success:hover {
    background: var(--success-hover);
    box-shadow: 0 4px 12px rgba(22,163,74,0.35);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.btn-sm {
    padding: 7px 16px;
    font-size: 0.825rem;
}

.convert-area {
    text-align: center;
    margin-top: 24px;
}

/* ── Results ── */
.results-area {
    margin-top: 20px;
}

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

.results-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.result-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    gap: 14px;
    animation: slideIn 0.25s ease-out;
}

.result-info {
    flex: 1;
    min-width: 0;
}

.result-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    gap: 12px;
    margin-top: 2px;
}

.result-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.lang-badge {
    display: inline-block;
    padding: 1px 6px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.results-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
}

/* ── Error ── */
.error-box {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    background: var(--danger-light);
    border: 1px solid #fecaca;
    border-radius: var(--radius-sm);
    margin-top: 16px;
    animation: slideIn 0.25s ease-out;
}

.error-icon {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

.error-content {
    flex: 1;
}

.error-message {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--danger);
}

.error-detail {
    font-size: 0.8rem;
    color: #991b1b;
    margin-top: 2px;
}

.error-retry {
    margin-top: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--danger);
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

.error-retry:hover {
    color: #991b1b;
}

/* ── Status Message ── */
.status-message {
    text-align: center;
    padding: 16px;
    font-size: 0.9rem;
    color: var(--text-muted);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.status-message strong {
    color: var(--text);
}

/* ── Hidden ── */
.hidden {
    display: none !important;
}

/* ── Responsive ── */
@media (max-width: 640px) {
    .app {
        padding: 24px 16px 40px;
    }

    .card {
        padding: 20px;
    }

    .header h1 {
        font-size: 1.4rem;
    }

    .dropzone {
        padding: 36px 16px;
    }

    .result-item {
        flex-wrap: wrap;
    }

    .results-actions {
        flex-direction: column;
        width: 100%;
    }

    .results-actions .btn {
        width: 100%;
    }
}

/* ── Inline spinner for button ── */
.btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}

/* ── File count badge ── */
.file-count {
    font-size: 0.75rem;
    background: var(--primary);
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    margin-left: 8px;
}
