:root {
    color-scheme: light dark;
    --bg: #f5f6f8;
    --card: #ffffff;
    --text: #0d1014;
    --muted: #6b7280;
    --primary: #4680c2;
    --primary-hover: #3d72ae;
    --error-bg: #fdecec;
    --error-text: #b00020;
    --border: #e5e7eb;
    --bar-bg: #e5e7eb;
    --bar-fill: #4680c2;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0e1014;
        --card: #1a1d22;
        --text: #f3f4f6;
        --muted: #9ca3af;
        --border: #2a2e34;
        --bar-bg: #2a2e34;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

header h1 {
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 600;
}

.subtitle { margin: 0; color: var(--muted); font-size: 14px; }

.card {
    background: var(--card);
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.hidden { display: none !important; }

.file-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 32px 16px;
    border: 2px dashed var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color .15s;
}

.file-drop:hover { border-color: var(--primary); }

.drop-icon { font-size: 36px; line-height: 1; }
.drop-title { font-weight: 600; }
.drop-hint { color: var(--muted); font-size: 13px; }

.file-meta {
    margin-top: 12px;
    padding: 10px 12px;
    background: var(--bg);
    border-radius: 10px;
    font-size: 13px;
    color: var(--muted);
}

button, a.primary {
    appearance: none;
    border: 0;
    border-radius: 10px;
    font: inherit;
    font-weight: 600;
    padding: 12px 16px;
    cursor: pointer;
    width: 100%;
    margin-top: 16px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
}

.primary {
    background: var(--primary);
    color: #fff;
}
.primary:hover:not(:disabled) { background: var(--primary-hover); }
.primary:disabled { background: var(--muted); cursor: not-allowed; opacity: .7; }

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

.status-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.bar {
    height: 6px;
    border-radius: 4px;
    background: var(--bar-bg);
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    width: 0;
    background: var(--bar-fill);
    transition: width .35s ease;
}

.status-hint { margin-top: 8px; color: var(--muted); font-size: 13px; }

.result-title, .error-title { font-weight: 600; margin-bottom: 12px; }

#resultVideo {
    width: 100%;
    border-radius: 10px;
    background: #000;
}

.result-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.result-actions > * { flex: 1; margin-top: 0; }

.error { border: 1px solid var(--error-text); background: var(--error-bg); color: var(--error-text); }
.error .error-title { color: var(--error-text); }
.error .secondary { color: var(--error-text); border-color: var(--error-text); margin-top: 16px; }
