/* === Klipa AI — Design System === */
:root {
    --primary: #2563EB;
    --primary-hover: #1D4ED8;
    --accent: #7C3AED;
    --bg: #0F172A;
    --bg-card: #1E293B;
    --bg-input: #334155;
    --bg-main: #0F172A;
    --bg-secondary: #1E293B;
    --bg-primary: #0F172A;
    --text: #F1F5F9;
    --text-muted: #94A3B8;
    --text-primary: #F1F5F9;
    --text-main: #F1F5F9;
    --border: #334155;
    --success: #10B981;
    --error: #EF4444;
    --warning: #F59E0B;
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 200ms ease;
    --max-w: 1200px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main { flex: 1; }

.container { max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }

/* === Navbar === */
.navbar {
    position: sticky; top: 0; z-index: 100;
    background: rgba(15, 23, 42, 0.9); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.nav-container {
    max-width: var(--max-w); margin: 0 auto; padding: 0 24px;
    display: flex; align-items: center; justify-content: space-between; height: 64px;
}
.nav-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.logo-icon {
    width: 36px; height: 36px; border-radius: 8px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 14px; color: white;
}
.logo-text { font-weight: 700; font-size: 18px; }
.logo-ai { color: var(--primary); }
.nav-links { display: flex; align-items: center; gap: 16px; }
.nav-links a { color: var(--text-muted); text-decoration: none; font-size: 14px; transition: color var(--transition); }
.nav-links a:hover { color: var(--text); }
.nav-auth { display: flex; gap: 8px; align-items: center; }
.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 8px; }
.nav-toggle span { display: block; width: 24px; height: 2px; background: var(--text); margin: 5px 0; transition: var(--transition); }

/* === Buttons === */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 10px 20px; border-radius: var(--radius-sm); border: none;
    font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none;
    transition: all var(--transition); line-height: 1.4;
}
.btn-primary { background: var(--primary); color: white; box-shadow: 0 2px 8px rgba(37,99,235,0.3); }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,0.4); }
.btn-primary:active { transform: translateY(0); box-shadow: 0 1px 4px rgba(37,99,235,0.3); }
.btn-primary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); background: rgba(255,255,255,0.03); }
.btn-ghost:active { background: rgba(255,255,255,0.06); }
.btn-ghost:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn-accent { background: linear-gradient(135deg, var(--primary), var(--accent)); color: white; box-shadow: 0 2px 8px rgba(124,58,237,0.3); }
.btn-accent:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(124,58,237,0.4); }
.btn-accent:active { transform: translateY(0); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; transform: translateY(-1px); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* === Hero === */
.hero {
    padding: 100px 0 80px; text-align: center;
    background: radial-gradient(ellipse at top, rgba(37,99,235,0.15) 0%, transparent 60%);
}
.hero h1 { font-size: 56px; font-weight: 800; line-height: 1.1; margin-bottom: 20px; }
.gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-sub { font-size: 20px; color: var(--text-muted); max-width: 600px; margin: 0 auto 32px; }
.hero-cta { display: flex; gap: 12px; justify-content: center; margin-bottom: 48px; }
.hero-stats { display: flex; gap: 48px; justify-content: center; }
.stat { text-align: center; }
.stat strong { display: block; font-size: 18px; }
.stat span { font-size: 13px; color: var(--text-muted); }

/* === Features === */
.features, .tools-section { padding: 80px 0; }
.features h2, .tools-section h2 { text-align: center; font-size: 36px; margin-bottom: 48px; }
.features-grid, .tools-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.feature-card, .tool-card {
    background: var(--bg-card); border-radius: var(--radius); padding: 32px;
    border: 1px solid var(--border); transition: border-color var(--transition);
}
.feature-card:hover, .tool-card:hover { border-color: var(--primary); }
.feature-icon {
    width: 48px; height: 48px; border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 20px; color: white; margin-bottom: 16px;
}
.tool-icon { font-size: 36px; margin-bottom: 12px; }
.feature-card h3, .tool-card h3 { font-size: 20px; margin-bottom: 8px; }
.feature-card p, .tool-card p { color: var(--text-muted); font-size: 14px; }

/* === Auth === */
.auth-section { padding: 80px 0; display: flex; justify-content: center; }
.auth-card {
    background: var(--bg-card); border-radius: var(--radius); padding: 40px;
    border: 1px solid var(--border); width: 100%; max-width: 440px;
}
.auth-card h2 { margin-bottom: 8px; }
.auth-sub { color: var(--text-muted); margin-bottom: 24px; font-size: 14px; }
.forgot-link { display: block; text-align: right; margin-top: 6px; font-size: 13px; color: var(--text-muted); text-decoration: none; }
.forgot-link:hover { color: var(--primary); }
.auth-alt { text-align: center; margin-top: 20px; color: var(--text-muted); font-size: 14px; }
.auth-alt a { color: var(--primary); text-decoration: none; }

/* === Forms === */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 10px 14px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--bg-input); color: var(--text);
    font-size: 14px; transition: border-color var(--transition);
}
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--primary); }
.form-group input[type="range"] {
    padding: 0; background: none; border: none;
    -webkit-appearance: none; appearance: none;
    height: 6px; border-radius: 3px; cursor: pointer;
    background: var(--bg-input) !important;
}
.form-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--primary); border: 2px solid var(--bg);
    box-shadow: 0 2px 6px rgba(37,99,235,0.4);
    cursor: pointer; transition: transform 0.15s, box-shadow 0.15s;
}
.form-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 2px 10px rgba(37,99,235,0.6);
}
.form-group input[type="range"]::-moz-range-thumb {
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--primary); border: 2px solid var(--bg);
    box-shadow: 0 2px 6px rgba(37,99,235,0.4);
    cursor: pointer;
}
.form-group input[type="range"]::-moz-range-track {
    height: 6px; border-radius: 3px; background: var(--bg-input);
}
.hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-error { color: var(--error); font-size: 14px; margin-bottom: 12px; padding: 8px 12px; background: rgba(239,68,68,0.1); border-radius: var(--radius-sm); }
.form-success { color: var(--success); font-size: 14px; margin-bottom: 12px; padding: 8px 12px; background: rgba(16,185,129,0.1); border-radius: var(--radius-sm); }

/* === Dashboard === */
.dashboard-section { padding: 40px 0; }
.dash-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 32px; }
.dash-header h1 { font-size: 28px; }
.badge {
    display: inline-block; padding: 2px 10px; border-radius: 20px;
    font-size: 12px; font-weight: 600; text-transform: uppercase;
    background: var(--primary); color: white;
}
.dash-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-card {
    background: var(--bg-card); border-radius: var(--radius); padding: 24px;
    border: 1px solid var(--border); text-align: center;
}
.stat-card.highlight { border-color: var(--primary); background: rgba(37,99,235,0.1); }
.stat-value { display: block; font-size: 28px; font-weight: 800; }
.stat-label { font-size: 13px; color: var(--text-muted); }

/* === Jobs List === */
.jobs-list h2 { font-size: 20px; margin-bottom: 16px; }
.job-card {
    background: var(--bg-card); border-radius: var(--radius-sm); padding: 16px 20px;
    border: 1px solid var(--border); margin-bottom: 8px; cursor: pointer;
    display: flex; justify-content: space-between; align-items: center;
    transition: border-color var(--transition);
}
.job-card:hover { border-color: var(--primary); }
.job-name { font-weight: 600; display: block; }
.job-meta { font-size: 13px; color: var(--text-muted); }
.job-status { text-align: right; }
.job-date { font-size: 12px; color: var(--text-muted); display: block; margin-top: 4px; }
.status-badge {
    display: inline-block; padding: 2px 10px; border-radius: 20px;
    font-size: 12px; font-weight: 600;
}
.status-pending { background: rgba(245,158,11,0.2); color: var(--warning); }
.status-uploaded { background: rgba(245,158,11,0.2); color: var(--warning); }
.status-processing { background: rgba(37,99,235,0.2); color: var(--primary); }
.status-completed { background: rgba(16,185,129,0.2); color: var(--success); }
.status-failed { background: rgba(239,68,68,0.2); color: var(--error); }

.empty-state { text-align: center; padding: 60px 0; color: var(--text-muted); }
.empty-state .btn { margin-top: 16px; }

/* === Upload === */
.upload-section { padding: 40px 0; }
.upload-zone {
    background: var(--bg-card); border: 2px dashed var(--border);
    border-radius: var(--radius); padding: 60px 40px; text-align: center;
    transition: border-color var(--transition);
}
.upload-zone.drag-active { border-color: var(--primary); background: rgba(37,99,235,0.05); }
.upload-icon { font-size: 64px; margin-bottom: 16px; }
.upload-prompt h3 { margin-bottom: 8px; }
.upload-browse { color: var(--primary); cursor: pointer; text-decoration: underline; }
.upload-hint { font-size: 13px; color: var(--text-muted); margin-top: 8px; }
.upload-filename { font-size: 14px; color: var(--text-muted); margin-top: 8px; }

.progress-bar, .progress-bar-lg {
    width: 100%; height: 8px; background: var(--bg-input);
    border-radius: 4px; overflow: hidden; margin-bottom: 12px;
}
.progress-bar-lg { height: 12px; }
.progress-fill {
    height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 4px; transition: width 0.5s ease;
}
.progress-fill.progress-error { background: var(--error); }

/* === Options === */
.options-panel { margin-top: 24px; }
.options-card {
    background: var(--bg-card); border-radius: var(--radius); padding: 24px;
    border: 1px solid var(--border); margin-bottom: 16px;
}
.options-card h3 { margin-bottom: 16px; font-size: 18px; }
.option-group { display: flex; flex-direction: column; gap: 8px; }
.option-radio {
    display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    cursor: pointer; transition: border-color var(--transition);
}
.option-radio.selected { border-color: var(--primary); background: rgba(37,99,235,0.05); }
.option-radio input { margin-top: 4px; }
.option-radio strong { display: block; margin-bottom: 2px; }
.option-radio p { font-size: 13px; color: var(--text-muted); }

.file-info {
    display: flex; gap: 12px; align-items: center; margin-bottom: 20px;
    padding: 12px 16px; background: var(--bg-card); border-radius: var(--radius-sm);
    border: 1px solid var(--border); font-size: 14px;
}
.file-badge { font-weight: 600; color: var(--primary); }

/* === Job tracking === */
.job-section { padding: 60px 0; }
.progress-card {
    background: var(--bg-card); border-radius: var(--radius); padding: 40px;
    border: 1px solid var(--border); text-align: center;
}
.progress-status { margin-bottom: 24px; display: flex; justify-content: center; align-items: center; gap: 12px; }
.progress-message { color: var(--text-muted); font-size: 16px; margin-top: 12px; }
.progress-info { display: flex; align-items: baseline; justify-content: center; gap: 16px; margin-top: 8px; }
.progress-percent { font-size: 24px; font-weight: 800; }
.progress-estimate { font-size: 14px; color: var(--text-muted); }
.error-block, .success-block { margin-top: 24px; }
.error-block p { color: var(--error); margin-bottom: 12px; }
.success-block p { color: var(--success); font-size: 18px; font-weight: 600; margin-bottom: 16px; }

/* === Result === */
.result-section { padding: 40px 0; }
.back-link { color: var(--text-muted); text-decoration: none; font-size: 14px; display: inline-block; margin-bottom: 16px; }
.back-link:hover { color: var(--text); }
.result-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.video-player { margin-bottom: 24px; border-radius: var(--radius); overflow: hidden; background: #000; }
.video-el { width: 100%; max-height: 500px; display: block; }
.result-actions { display: flex; gap: 12px; margin-bottom: 32px; }
.result-extra { background: var(--bg-card); border-radius: var(--radius); padding: 24px; border: 1px solid var(--border); }
.result-extra h3 { margin-bottom: 12px; }
.preview-section { margin-bottom: 28px; }
.preview-player-wrap { border-radius: 10px; overflow: hidden; background: #000; border: 1px solid var(--border); margin-bottom: 16px; }
.style-selector { margin-bottom: 16px; }
.style-grid {
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px;
}
@media (max-width: 640px) { .style-grid { grid-template-columns: repeat(3, 1fr); } }
.style-chip {
    padding: 10px 6px; border: 2px solid var(--border); border-radius: 8px;
    background: var(--bg-card); color: var(--text-secondary); cursor: pointer;
    font-size: 13px; font-weight: 500; text-align: center; transition: all 0.15s;
}
.style-chip:hover { border-color: var(--primary); color: var(--primary); }
.style-chip.active {
    border-color: var(--primary); background: rgba(99,102,241,0.1);
    color: var(--primary); font-weight: 700;
}
.preview-customize { margin-bottom: 16px; }
.customize-row {
    display: flex; gap: 12px; margin-bottom: 10px; flex-wrap: wrap;
}
.preview-customize .control-group {
    display: flex; align-items: center; gap: 8px; flex: 1; min-width: 140px;
}
.preview-customize .control-group label {
    font-size: 13px; color: var(--text-muted); white-space: nowrap;
}
.preview-customize .control-group select {
    flex: 1; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--bg-card); color: var(--text-primary); font-size: 13px;
}
.preview-customize .control-color {
    flex: 0 0 auto; min-width: auto;
}
.preview-customize .control-color input[type="color"] {
    width: 36px; height: 36px; border: 2px solid var(--border); border-radius: 8px;
    cursor: pointer; background: none; padding: 2px;
}
.preview-apply { margin-bottom: 16px; }
.template-section { margin-bottom: 16px; padding: 16px; background: var(--bg-card); border-radius: var(--radius); border: 1px solid var(--border); }
.template-saved label { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; display: block; }
.template-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.template-chip { display: inline-flex; align-items: center; background: var(--bg-input); border-radius: 20px; overflow: hidden; border: 1px solid var(--border); transition: border-color .2s; }
.template-chip.active { border-color: var(--primary); }
.template-chip-btn { padding: 6px 12px; background: none; border: none; color: var(--text); font-size: 13px; cursor: pointer; }
.template-chip-btn:hover { color: var(--primary); }
.template-chip-del { padding: 4px 8px; background: none; border: none; border-left: 1px solid var(--border); color: var(--text-muted); font-size: 14px; cursor: pointer; line-height: 1; }
.template-chip-del:hover { color: var(--error); }
.template-save-row { display: flex; gap: 8px; align-items: center; }
.template-save-row .input-sm { flex: 1; padding: 8px 12px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 14px; }
.template-save-row .input-sm:focus { outline: none; border-color: var(--primary); }
.template-save-row .input-sm::placeholder { color: var(--text-muted); }
.download-links { display: flex; gap: 8px; flex-wrap: wrap; }
.transcription-meta { display: flex; gap: 8px; margin-bottom: 12px; }
.transcription-meta .badge {
    background: var(--bg-main); padding: 4px 12px; border-radius: 20px;
    font-size: 13px; color: var(--text-muted); border: 1px solid var(--border);
}
.transcription-text {
    background: var(--bg-main); border-radius: var(--radius); padding: 16px;
    font-size: 14px; line-height: 1.7; max-height: 300px; overflow-y: auto;
    margin-bottom: 16px; border: 1px solid var(--border); white-space: pre-wrap;
}
.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox-label input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); }
.clips-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; margin-bottom: 24px; }
.clip-card, .clip-card-wide {
    background: var(--bg-card); border-radius: var(--radius); padding: 16px;
    border: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px;
}
.clip-header { display: flex; justify-content: space-between; align-items: center; }
.clip-number { font-weight: 700; font-size: 14px; }
.clip-score { background: var(--primary); color: white; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.clip-scores-breakdown { display: flex; flex-direction: column; gap: 3px; margin: 8px 0; }
.score-bar { display: flex; align-items: center; gap: 6px; }
.score-label { font-size: 10px; color: var(--text-muted); width: 46px; text-align: right; flex-shrink: 0; }
.score-track { flex: 1; height: 5px; background: var(--bg-secondary); border-radius: 3px; overflow: hidden; }
.score-fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width 0.4s ease; }
.score-fill-audio { background: var(--accent); }
.clip-player .video-el { max-height: 240px; border-radius: 8px; }
.clip-title { font-size: 14px; line-height: 1.4; color: var(--text-main); }
.clip-meta { font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.clip-description { font-size: 0.85em; color: var(--text-muted); margin: 4px 0 8px; line-height: 1.4; }
.clip-improvement { font-size: 0.82em; color: var(--accent); margin: 4px 0 8px; line-height: 1.4; font-style: italic; }
.clip-versions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.btn-format { font-size: 12px !important; padding: 4px 12px !important; border: 1px solid var(--primary) !important; }

/* Clips list (wide cards, stacked) */
.clips-list { display: flex; flex-direction: column; gap: 20px; margin-bottom: 24px; }
.clip-card-wide {
    background: var(--bg-card); border-radius: var(--radius); padding: 20px;
    border: 1px solid var(--border); transition: border-color var(--transition), box-shadow var(--transition);
}
.clip-card-wide:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }

/* Format previews — equal-width grid columns */
.clip-formats-row {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px; margin-top: 12px;
}
.clip-fmt-card {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.fmt-badge {
    font-size: 11px; font-weight: 700; color: var(--text-muted);
    background: var(--bg-input); padding: 2px 10px; border-radius: 10px;
}

/* Preview container — sized to match video aspect ratio, centered */
.fmt-preview {
    position: relative; background: #000; border-radius: 8px;
    overflow: hidden; cursor: pointer; margin: 0 auto;
}
.fmt-preview:hover { box-shadow: 0 0 0 2px var(--primary); }
.clip-fmt-card.fmt-16-9 .fmt-preview { width: 100%; aspect-ratio: 16/9; }
.clip-fmt-card.fmt-9-16 .fmt-preview { height: 340px; aspect-ratio: 9/16; }
.clip-fmt-card.fmt-4-5  .fmt-preview { height: 320px; aspect-ratio: 4/5; }
.clip-fmt-card.fmt-1-1  .fmt-preview { width: 100%; aspect-ratio: 1/1; max-height: 340px; }
.clip-fmt-card.fmt-2-3  .fmt-preview { height: 340px; aspect-ratio: 2/3; }

.fmt-video {
    width: 100%; height: 100%; display: block; object-fit: cover;
}

/* Play button overlay */
.fmt-play-btn {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 52px; height: 52px; border-radius: 50%;
    background: rgba(0,0,0,0.55); backdrop-filter: blur(4px);
    border: 2px solid rgba(255,255,255,0.3);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.2s; z-index: 2;
}
.fmt-play-btn:hover {
    background: rgba(37,99,235,0.7); border-color: rgba(255,255,255,0.5);
    transform: translate(-50%, -50%) scale(1.1);
}
.fmt-play-btn svg { margin-left: 3px; }

/* Download link per format */
.fmt-download {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 12px; color: var(--text-muted); text-decoration: none;
    padding: 4px 10px; border-radius: 6px; border: 1px solid var(--border);
    transition: all 0.15s;
}
.fmt-download:hover { color: var(--primary); border-color: var(--primary); }

/* Mobile swipe dots */
.fmt-dots {
    display: none; justify-content: center; gap: 8px; margin-top: 8px;
}
.fmt-dot {
    font-size: 11px; color: var(--text-muted); padding: 3px 10px;
    border-radius: 12px; background: var(--bg-input); cursor: pointer;
    border: 1px solid transparent; transition: all 0.2s;
}
.fmt-dot.active { color: var(--primary); border-color: var(--primary); background: rgba(37,99,235,0.1); }

/* Mobile: horizontal snap carousel */
@media (max-width: 640px) {
    .clip-formats-row {
        display: flex; overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        gap: 10px; padding-bottom: 8px;
    }
    .clip-fmt-card {
        scroll-snap-align: center;
        min-width: 80vw; flex-shrink: 0;
    }
    .clip-fmt-card.fmt-9-16 .fmt-preview,
    .clip-fmt-card.fmt-4-5 .fmt-preview,
    .clip-fmt-card.fmt-2-3 .fmt-preview { height: 55vh; }
    .clip-fmt-card.fmt-16-9 .fmt-preview { width: 100%; height: auto; }
    .clip-fmt-card.fmt-1-1 .fmt-preview { max-height: 70vw; }
    .fmt-play-btn { width: 44px; height: 44px; }
    .fmt-play-btn svg { width: 26px; height: 26px; }
    .fmt-dots { display: flex; }
}

/* Tablet: 2 columns */
@media (min-width: 641px) and (max-width: 900px) {
    .clip-formats-row { grid-template-columns: repeat(2, 1fr); }
}
.badge-montage { background: var(--accent); color: #fff; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge-narrative { background: var(--bg-secondary); color: var(--text-muted); padding: 2px 8px; border-radius: 10px; font-size: 11px; text-transform: capitalize; }
/* Format selection grid */
.format-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
@media (max-width: 640px) { .format-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 400px) { .format-grid { grid-template-columns: repeat(2, 1fr); } }
.format-option { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 14px 8px; border: 2px solid var(--border); border-radius: 10px; cursor: pointer; transition: all 0.2s; text-align: center; position: relative; }
.format-option:hover { border-color: var(--primary); background: var(--bg-secondary); }
.format-option.selected { border-color: var(--primary); background: rgba(99,102,241,0.08); }
.format-option.selected::after { content: '\2713'; position: absolute; top: 6px; right: 8px; font-size: 12px; color: var(--primary); font-weight: 700; }
.format-option.disabled { opacity: 0.4; cursor: not-allowed; }
.format-option input[type="checkbox"] { display: none; }
.format-preview { background: var(--text-muted); border-radius: 3px; opacity: 0.3; }
.format-option.selected .format-preview { background: var(--primary); opacity: 0.7; }
.ratio-9-16 { width: 22px; height: 40px; }
.ratio-4-5 { width: 28px; height: 35px; }
.ratio-1-1 { width: 32px; height: 32px; }
.ratio-2-3 { width: 24px; height: 36px; }
.ratio-16-9 { width: 40px; height: 22px; }
.format-label { font-size: 13px; font-weight: 700; color: var(--text-main); }
.format-platforms { font-size: 10px; color: var(--text-muted); line-height: 1.2; }
/* Clip subtitle toggle & styles */
.clip-sub-toggle { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.clip-sub-toggle strong { font-size: 14px; }
.warning-hint {
    margin-top: 6px; padding: 8px 12px; border-left: 3px solid var(--warning);
    background: rgba(245, 158, 11, 0.08); border-radius: 0 6px 6px 0;
    font-size: 12px; color: var(--warning); line-height: 1.5;
}
.clip-style-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 8px; }
@media (max-width: 640px) { .clip-style-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 480px) { .clip-style-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 360px) { .clip-style-grid { grid-template-columns: repeat(2, 1fr); } }
.clip-style-card {
    display: flex; flex-direction: column; align-items: center;
    padding: 0; border: 2px solid var(--border); border-radius: 8px;
    background: #0F172A; cursor: pointer; transition: all 0.2s;
    overflow: hidden; text-align: center;
}
.clip-style-card:hover { border-color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.clip-style-card.active { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary), var(--shadow-md); }
.clip-style-preview {
    width: 100%; height: 44px; display: flex; align-items: center; justify-content: center;
    padding: 2px 4px; box-sizing: border-box;
}
.clip-style-img { max-width: 100%; max-height: 40px; display: block; pointer-events: none; object-fit: contain; }
.clip-style-label {
    font-size: 10px; font-weight: 600; color: var(--text-muted); padding: 3px 0 5px;
    transition: color 0.2s; width: 100%; background: var(--bg);
}
.clip-style-card.active .clip-style-label { color: var(--primary); }
.clip-style-card:hover .clip-style-label { color: var(--text); }
.btn-link-toggle {
    background: none; border: none; color: var(--text-muted); font-size: 13px;
    cursor: pointer; padding: 4px 0; transition: color 0.2s;
}
.btn-link-toggle:hover { color: var(--text); }
.clip-sub-advanced { margin-top: 12px; }
.advanced-row { display: flex; gap: 12px; margin-bottom: 12px; }
.advanced-field { flex: 1; }
.advanced-field label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.advanced-field select, .advanced-field input[type="color"] {
    width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px;
    background: var(--bg-input); color: var(--text); font-size: 13px;
}
.advanced-field input[type="color"] { height: 36px; padding: 2px; cursor: pointer; }
@media (max-width: 640px) { .advanced-row { flex-wrap: wrap; } .advanced-field { min-width: 45%; } }

.option-radio.disabled { opacity: 0.5; cursor: not-allowed; }
.option-radio.disabled input { pointer-events: none; }
.plan-badge {
    display: inline-block; background: var(--primary); color: white;
    font-size: 11px; padding: 2px 8px; border-radius: 10px; margin-top: 4px; font-weight: 600;
}

/* === Pricing === */
.pricing-section { padding: 80px 0; text-align: center; }
.pricing-sub { color: var(--text-muted); font-size: 18px; margin-bottom: 32px; }
.billing-toggle { display: flex; justify-content: center; gap: 4px; margin-bottom: 40px; background: var(--bg-card); border-radius: var(--radius); padding: 4px; display: inline-flex; border: 1px solid var(--border); }
.toggle-btn { padding: 10px 24px; border-radius: calc(var(--radius) - 2px); border: none; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 14px; font-weight: 500; transition: all var(--transition); display: flex; align-items: center; gap: 8px; }
.toggle-btn.active { background: var(--primary); color: white; }
.toggle-badge { background: var(--success); color: white; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.billing-note { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.pricing-grid-2 { grid-template-columns: repeat(2, 1fr); max-width: 800px; margin: 0 auto; }
.pricing-card {
    background: var(--bg-card); border-radius: var(--radius); padding: 32px;
    border: 1px solid var(--border); text-align: left; position: relative;
    transition: border-color var(--transition);
}
.pricing-card.featured { border-color: var(--primary); }
.pricing-badge {
    position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
    background: var(--primary); color: white; padding: 4px 16px;
    border-radius: 20px; font-size: 12px; font-weight: 600;
}
.pricing-header { margin-bottom: 24px; }
.pricing-header h3 { font-size: 22px; margin-bottom: 8px; }
.price { font-size: 40px; font-weight: 800; }
.period { font-size: 16px; color: var(--text-muted); }
.pricing-features { list-style: none; margin-bottom: 24px; }
.pricing-features li {
    padding: 8px 0; border-bottom: 1px solid var(--border);
    font-size: 14px; display: flex; align-items: center; gap: 8px;
}
.pricing-features li::before { content: '\2713'; color: var(--success); font-weight: 700; }
.pricing-features li.disabled { color: var(--text-muted); }
.pricing-features li.disabled::before { content: '\2717'; color: var(--error); }
.pricing-card.current-plan { border-color: var(--success); }
.upgrade-link { display: block; margin-top: 6px; font-size: 12px; color: var(--primary); text-decoration: underline; }

/* === Settings === */
.settings-section { padding: 40px 0; }
.settings-card {
    background: var(--bg-card); border-radius: var(--radius); padding: 24px;
    border: 1px solid var(--border); margin-bottom: 16px; max-width: 600px;
}
.settings-card h3 { margin-bottom: 16px; }

/* === Footer === */
.footer { border-top: 1px solid var(--border); padding: 32px 0; margin-top: auto; }
.footer-content { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }
.footer-brand { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.footer-links { display: flex; gap: 16px; }
.footer-links a { color: var(--text-muted); text-decoration: none; font-size: 14px; }
.footer-links a:hover { color: var(--text); }
.footer-copy { color: var(--text-muted); font-size: 12px; }

/* === Loading === */
.loading { text-align: center; padding: 60px 0; color: var(--text-muted); }

/* === Video Tabs (before/after comparison) === */
.video-tabs { margin-bottom: 24px; }
.tab-buttons { display: flex; gap: 4px; margin-bottom: 16px; background: var(--bg-input); border-radius: var(--radius-sm); padding: 4px; width: fit-content; }
.tab-btn {
    padding: 8px 20px; border: none; background: transparent; color: var(--text-muted);
    font-size: 14px; font-weight: 500; cursor: pointer; border-radius: 6px;
    transition: all var(--transition);
}
.tab-btn.active { background: var(--primary); color: white; }
.tab-btn:hover:not(.active) { color: var(--text); }

/* === Responsive === */
@media (max-width: 640px) {
    .container { padding: 0 16px; }
    h1 { font-size: 28px; }
    h2 { font-size: 22px; }
    .result-stats { grid-template-columns: 1fr; }
    .clips-grid { grid-template-columns: 1fr; }
    .tab-buttons { width: 100%; }
    .tab-btn { flex: 1; text-align: center; }
    .download-links { flex-direction: column; }
}

@media (max-width: 768px) {
    .hero h1 { font-size: 36px; }
    .hero-sub { font-size: 16px; }
    .hero-stats { flex-direction: column; gap: 16px; }
    .hero-cta { flex-direction: column; }
    .features-grid, .tools-grid, .pricing-grid { grid-template-columns: 1fr; }
    .nav-toggle { display: block; }
    .nav-links { display: none; flex-direction: column; position: absolute; top: 64px; left: 0; right: 0; background: var(--bg); padding: 16px 24px; border-bottom: 1px solid var(--border); }
    .nav-links.active { display: flex; }
    .nav-auth { flex-direction: column; width: 100%; }
    .nav-auth .btn { width: 100%; }
    .dash-header { flex-direction: column; gap: 12px; align-items: flex-start; }
    .result-actions { flex-direction: column; }
    .footer-content { flex-direction: column; text-align: center; }
    .upload-zone { padding: 40px 20px; }
    .file-info { flex-direction: column; }
    .faq-question { font-size: 15px; padding: 14px 16px; }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .features-grid, .tools-grid { grid-template-columns: repeat(2, 1fr); }
    .pricing-grid { grid-template-columns: repeat(2, 1fr); }
    .clips-grid { grid-template-columns: repeat(2, 1fr); }
}

/* === FAQ Section === */
.faq-section { padding: 80px 0; }
.faq-section h2 { text-align: center; margin-bottom: 40px; }
.faq-list { max-width: 720px; margin: 0 auto; }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-question {
    width: 100%; display: flex; justify-content: space-between; align-items: center;
    padding: 18px 20px; background: none; border: none; color: var(--text);
    font-size: 16px; font-weight: 500; cursor: pointer; text-align: left;
    transition: color var(--transition);
}
.faq-question:hover, .faq-question.active { color: var(--primary); }
.faq-arrow { font-size: 12px; transition: transform var(--transition); }
.faq-question.active .faq-arrow { transform: rotate(180deg); }
.faq-answer { padding: 0 20px 18px; }
.faq-answer p { color: var(--text-muted); line-height: 1.7; }


.progress-indeterminate {
    width: 40% !important;
    animation: indeterminate 1.5s ease-in-out infinite;
}
@keyframes indeterminate {
    0% { margin-left: 0; }
    50% { margin-left: 60%; }
    100% { margin-left: 0; }
}

/* === Demo Page === */
.demo-section { padding: 60px 0; }
.demo-subtitle { color: var(--text-muted); text-align: center; margin-bottom: 32px; font-size: 16px; }
.demo-limits { text-align: center; margin-top: 12px; font-size: 13px; color: var(--text-muted); }
.demo-processing { text-align: center; padding: 60px 0; }
.progress-bar-lg { max-width: 500px; margin: 0 auto 20px; height: 12px; }
.progress-msg { font-size: 16px; color: var(--text-primary); margin-bottom: 4px; }
.progress-pct { font-size: 24px; font-weight: 700; color: var(--primary); }
.demo-result { max-width: 700px; margin: 0 auto; }
.demo-cta {
    margin-top: 40px;
    padding: 32px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    text-align: center;
    border: 1px solid var(--border);
}
.demo-cta h3 { margin-bottom: 8px; }
.demo-cta p { color: var(--text-muted); margin-bottom: 20px; }
.demo-cta-buttons { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* === Homepage Hero Upload === */
.hero-upload { padding: 80px 0 40px; text-align: center; }
.hero-upload h1 { font-size: 42px; line-height: 1.2; margin-bottom: 16px; }
.hero-upload .hero-sub { font-size: 18px; color: var(--text-muted); margin-bottom: 40px; max-width: 600px; margin-left: auto; margin-right: auto; }
.hero-upload .gradient-text { background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

.upload-hero { max-width: 600px; margin: 0 auto 32px; }
.drop-zone-hero {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 48px 32px;
    cursor: pointer;
    transition: all var(--transition);
    background: rgba(37, 99, 235, 0.03);
}
.drop-zone-hero:hover { border-color: var(--primary); background: rgba(37, 99, 235, 0.06); }
.drop-zone-hero.drag-active { border-color: var(--primary); background: rgba(37, 99, 235, 0.1); transform: scale(1.01); }
.drop-zone-hero.uploading { pointer-events: none; opacity: 0.8; }
.drop-icon { font-size: 48px; margin-bottom: 12px; }
.drop-title { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.drop-hint { font-size: 14px; color: var(--primary); cursor: pointer; margin-bottom: 8px; }
.drop-formats { font-size: 13px; color: var(--text-muted); }
.progress-bar-mini { height: 8px; background: var(--bg-input); border-radius: 4px; overflow: hidden; margin: 12px auto; max-width: 300px; }
.progress-bar-mini .progress-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width 0.3s; }
.upload-percent { font-size: 14px; color: var(--primary); font-weight: 600; }

/* Processing options (step 2) */
.processing-options { max-width: 600px; margin: 0 auto 32px; text-align: center; }
.processing-options h3 { margin-bottom: 20px; font-size: 20px; }
.process-types { display: flex; gap: 12px; justify-content: center; margin-bottom: 24px; flex-wrap: wrap; }
.process-option {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 20px 24px; border-radius: var(--radius); cursor: pointer;
    background: var(--bg-card); border: 2px solid var(--border);
    transition: all var(--transition); min-width: 140px;
    font-size: 14px; font-weight: 500; color: var(--text);
}
.process-option:hover { border-color: rgba(37, 99, 235, 0.5); }
.process-option.active { border-color: var(--primary); background: rgba(37, 99, 235, 0.1); }
.option-icon { font-size: 28px; }

/* Processing progress (step 3) */
.processing-progress { text-align: center; padding: 40px 0; max-width: 500px; margin: 0 auto; }
.processing-progress .progress-msg { font-size: 16px; margin-bottom: 16px; }
.processing-progress .progress-bar { height: 10px; background: var(--bg-input); border-radius: 5px; overflow: hidden; margin-bottom: 12px; }
.processing-progress .progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 5px; transition: width 0.3s; }
.processing-progress .progress-pct { font-size: 24px; font-weight: 700; color: var(--primary); }

/* Result inline (step 4) */
.result-inline { text-align: center; max-width: 600px; margin: 0 auto; }
.result-inline h3 { font-size: 24px; margin-bottom: 20px; color: var(--success); }
.result-inline .result-stats { display: flex; justify-content: center; gap: 40px; margin-bottom: 24px; }
.result-inline .stat strong { display: block; font-size: 28px; color: var(--text); }
.result-inline .stat span { font-size: 13px; color: var(--text-muted); }
.result-clips { margin-bottom: 24px; }
.clip-card-mini {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; background: var(--bg-card); border-radius: var(--radius-sm);
    border: 1px solid var(--border); margin-bottom: 8px;
}
.clip-card-mini strong { font-size: 14px; }
.clip-score { font-size: 13px; color: var(--primary); font-weight: 600; }
.result-hint { font-size: 13px; color: var(--text-muted); margin-top: 12px; }

/* Hero stats */
.hero-stats { display: flex; justify-content: center; gap: 48px; margin-top: 40px; }
.hero-stats .stat strong { display: block; font-size: 20px; color: var(--primary); font-weight: 700; }
.hero-stats .stat span { font-size: 13px; color: var(--text-muted); }

/* Signup Modal */
.modal-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.modal-card {
    background: var(--bg-card); border-radius: var(--radius); padding: 32px;
    max-width: 440px; width: 100%; position: relative;
    border: 1px solid var(--border); max-height: 90vh; overflow-y: auto;
}
.modal-close {
    position: absolute; top: 12px; right: 16px;
    background: none; border: none; color: var(--text-muted);
    font-size: 24px; cursor: pointer; padding: 4px;
}
.modal-close:hover { color: var(--text); }
.modal-card h2 { font-size: 22px; margin-bottom: 8px; }
.modal-sub { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }
.modal-switch { text-align: center; margin-top: 16px; color: var(--primary); cursor: pointer; font-size: 14px; }
.modal-switch:hover { text-decoration: underline; }

/* Homepage feature cards — center text */
.features .feature-card, .tools-section .tool-card { text-align: center; }
.tools-grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Mini pricing on homepage */
.mini-pricing { padding: 60px 0; text-align: center; }
.mini-pricing h2 { margin-bottom: 40px; font-size: 28px; }

/* Homepage responsive */
@media (max-width: 768px) {
    .hero-upload h1 { font-size: 28px; }
    .hero-upload .hero-sub { font-size: 15px; }
    .drop-zone-hero { padding: 32px 20px; }
    .process-types { flex-direction: column; align-items: center; }
    .process-option { width: 100%; max-width: 280px; flex-direction: row; justify-content: center; }
    .features-grid { grid-template-columns: 1fr; }
    .tools-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .hero-stats { flex-direction: column; gap: 16px; }
    .result-inline .result-stats { flex-direction: column; gap: 16px; }
    .modal-card { padding: 24px; margin: 10px; }
    .faq-question { font-size: 14px; }
}

/* === Legal Pages === */
.legal-page { padding: 60px 0; }
.legal-page h1 { margin-bottom: 8px; }
.legal-date { color: var(--text-muted); font-size: 14px; margin-bottom: 40px; }
.legal-page h2 { font-size: 18px; margin: 32px 0 12px; color: var(--primary); }
.legal-page p, .legal-page li { color: var(--text-muted); line-height: 1.8; margin-bottom: 8px; }
.legal-page ul { padding-left: 24px; margin-bottom: 12px; }
.legal-page a { color: var(--primary); text-decoration: underline; }

/* === Subtitle Templates === */
.template-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.template-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 20px; padding: 6px 14px; font-size: 13px;
    cursor: pointer; transition: var(--transition);
}
.template-chip:hover { border-color: var(--primary); background: rgba(37,99,235,.15); }
.chip-delete {
    background: none; border: none; color: var(--text-muted);
    font-size: 16px; cursor: pointer; padding: 0; line-height: 1;
}
.chip-delete:hover { color: var(--error); }

.subtitle-custom-panel {
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 16px; margin-top: 8px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.color-input {
    width: 50px; height: 36px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: var(--bg-input);
    cursor: pointer; padding: 2px;
}
.save-template-row { display: flex; gap: 8px; align-items: center; }
.template-name-input {
    flex: 1; background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 8px 12px; color: var(--text);
    font-size: 14px;
}
.template-name-input::placeholder { color: var(--text-muted); }

/* === Text Editor (Descript-like) === */
.text-editor-section { margin-top: 16px; }
.editor-hint { color: var(--text-muted); font-size: 14px; margin-bottom: 12px; }
.editor-toolbar {
    display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
    margin-bottom: 12px; padding: 8px 12px;
    background: var(--bg-card); border-radius: var(--radius-sm);
}
.editor-stats { margin-left: auto; color: var(--text-muted); font-size: 13px; }
.text-editor-area {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px;
    line-height: 2.2; font-size: 16px; max-height: 500px; overflow-y: auto;
}
.editor-segment { display: inline; }
.editor-word {
    display: inline; cursor: pointer; padding: 2px 1px;
    border-radius: 3px; transition: all 0.15s;
}
.editor-word:hover { background: rgba(37, 99, 235, 0.15); }
.editor-word.removed {
    text-decoration: line-through; opacity: 0.35;
    background: rgba(239, 68, 68, 0.1); color: var(--text-muted);
}
.editor-word.filler:not(.removed) {
    color: #F59E0B; font-style: italic;
}
.editor-actions { margin-top: 16px; display: flex; gap: 12px; }
.result-tabs .tab-buttons { margin-bottom: 16px; }

/* === Subtitle Line Editor === */
.subtitle-editor-section { margin-top: 16px; }
.subtitle-editor-toolbar {
    display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
    margin-bottom: 12px; padding: 8px 12px;
    background: var(--bg-card); border-radius: var(--radius-sm);
}
.se-toolbar-save { margin-left: auto; }
.subtitle-editor-lines {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 4px 8px;
    max-height: 500px; overflow: auto;
}
.se-line {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    grid-template-rows: auto auto;
    gap: 2px 8px; align-items: start;
    padding: 6px 4px; border-radius: var(--radius-sm);
    transition: background 0.15s;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    cursor: pointer;
}
.se-line-num { grid-row: 1 / 3; align-self: center; }
.se-timing { grid-column: 2; grid-row: 1; }
.se-text-wrap { grid-column: 2; grid-row: 2; }
.se-actions { grid-column: 3; grid-row: 1 / 3; align-self: center; }
.se-line:last-child { border-bottom: none; }
.se-line:hover { background: rgba(37, 99, 235, 0.05); }
.se-line-active { background: rgba(37, 99, 235, 0.1) !important; }
.se-line-num {
    color: var(--text-muted); font-size: 12px; font-weight: 600;
    text-align: center; padding-top: 5px;
    font-variant-numeric: tabular-nums;
}
.se-timing { display: flex; align-items: center; gap: 3px; opacity: 0.5; }
.se-line:hover .se-timing,
.se-line-active .se-timing { opacity: 0.75; }
.se-time-input {
    width: 64px; padding: 3px 4px;
    background: #1f2f4d; border: 1px solid var(--border);
    border-radius: 4px; color: #838587;
    font-size: 11px; font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-variant-numeric: tabular-nums; text-align: center;
}
.se-time-input:focus {
    outline: none; border-color: var(--primary); background: var(--bg-input, var(--bg));
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.2); color: var(--text);
}
.se-time-sep { color: var(--text-muted); font-size: 10px; opacity: 0.6; }
.se-text-wrap { flex: 1; min-width: 0; }
.se-text-input {
    width: 100%; padding: 3px 6px;
    background: transparent; border: 1px solid transparent;
    border-radius: 4px; color: var(--text);
    font-size: 14px; line-height: 1.5;
    resize: none; overflow: hidden;
    white-space: nowrap; font-family: inherit;
    height: auto !important;
}
.se-text-input:focus {
    outline: none; background: var(--bg-input, var(--bg));
    border-color: var(--primary);
}
.se-text-input:hover:not(:focus) { border-color: var(--border); }
.se-actions { display: flex; gap: 2px; opacity: 0; transition: opacity 0.15s; }
.se-line:hover .se-actions { opacity: 1; }
.se-action-btn {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; padding: 4px; border-radius: 4px;
    font-size: 14px; transition: all 0.15s; line-height: 1;
}
.se-action-btn:hover { color: var(--text); background: rgba(255,255,255,0.08); }
.se-action-delete:hover { color: #EF4444; }
.se-save-bar {
    display: flex; align-items: center; gap: 8px;
    margin-top: 12px; padding: 8px 12px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-sm);
    font-size: 13px; color: #F59E0B;
}
.se-unsaved-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #F59E0B; flex-shrink: 0;
}
.se-save-bar .btn { margin-left: auto; }

/* Left panel tabs */
.left-tabs {
    display: flex; gap: 0; margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.left-tabs .tab-btn {
    flex: 1; padding: 8px 0; font-size: 13px; font-weight: 600;
    background: none; border: none; border-bottom: 2px solid transparent;
    color: var(--text-muted); cursor: pointer; transition: all 0.15s;
}
.left-tabs .tab-btn.active {
    color: var(--primary); border-bottom-color: var(--primary);
}
.left-tabs .tab-btn:hover:not(.active) { color: var(--text); }

/* Style gallery (vertical list with images) */
.style-gallery {
    display: flex; flex-direction: column; gap: 8px;
    max-height: calc(100vh - 300px); overflow-y: auto;
}
.style-gallery-item {
    cursor: pointer; border-radius: var(--radius-sm);
    border: 2px solid transparent;
    transition: border-color 0.15s;
    flex-shrink: 0;
}
.style-gallery-item:hover { border-color: rgba(37, 99, 235, 0.4); }
.style-gallery-item.active { border-color: var(--primary); }
.style-gallery-img {
    display: flex; align-items: center; justify-content: center;
    width: 100%; background: #1E293B;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    overflow: hidden;
}
.style-gallery-img img {
    display: block; max-width: 100%; height: auto;
}
.style-gallery-label {
    display: block; text-align: center; padding: 5px 0;
    font-size: 12px; color: var(--text-muted); font-weight: 600;
    background: var(--bg-card);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}
.style-gallery-item.active .style-gallery-label { color: var(--primary); }

/* Pro badge overlays */
.style-gallery-item.locked, .style-card-m.locked { opacity: 0.5; cursor: not-allowed; }
.style-gallery-item.locked:hover { border-color: var(--border); }
.style-gallery-img { position: relative; }
.style-card-m-img { position: relative; }
.pro-badge-overlay {
    position: absolute; top: 6px; right: 6px;
    background: var(--accent); color: white; font-size: 10px; font-weight: 700;
    padding: 2px 8px; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.5px;
}
.format-option-sm.locked { opacity: 0.5; cursor: not-allowed; }
.pro-badge-sm {
    display: inline-block; background: var(--accent); color: white;
    font-size: 9px; font-weight: 700; padding: 1px 6px; border-radius: 3px;
    text-transform: uppercase; margin-left: 4px;
}

/* Clip preview list (Phase 1 clipping) */
.clip-preview-list {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 4px 0;
}
.clip-preview-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    transition: border-color 0.15s, opacity 0.2s;
}
.clip-preview-item:hover { border-color: rgba(37, 99, 235, 0.4); }
.clip-preview-item.active { border-color: var(--primary); background: rgba(37, 99, 235, 0.06); }
.clip-preview-item.unselected { opacity: 0.45; }
.clip-preview-check { flex-shrink: 0; margin-top: 2px; }
.clip-preview-check input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.clip-preview-info { flex: 1; min-width: 0; }
.clip-preview-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.clip-preview-title { font-weight: 600; font-size: 0.85rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clip-preview-score { flex-shrink: 0; background: var(--primary); color: #fff; font-size: 0.7rem; font-weight: 700; padding: 2px 7px; border-radius: 8px; }
.clip-preview-meta { font-size: 0.75rem; color: var(--text-secondary); margin-top: 3px; display: flex; gap: 8px; }
.clip-preview-tc { opacity: 0.7; }
.clip-mini-scores { display: flex; gap: 3px; margin-top: 5px; }
.mini-score { flex: 1; }
.mini-bar { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.mini-fill { height: 100%; background: var(--primary); border-radius: 2px; transition: width 0.3s; }

/* Format grid compact (result page) */
.preview-formats { margin-bottom: 16px; }
.preview-formats > label { font-weight: 700; font-size: 0.9rem; color: var(--text); margin-bottom: 4px; display: block; }
.preview-formats .fmt-pedagogy { font-size: 0.75rem; color: var(--text-secondary); line-height: 1.5; margin-bottom: 12px; }
.format-grid-compact { display: flex; flex-wrap: wrap; gap: 10px; }
.format-option-sm {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 10px 14px; border-radius: 12px;
    border: 2px solid var(--border); background: var(--bg-card);
    cursor: pointer; transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    min-width: 80px; text-align: center; position: relative;
}
.format-option-sm:hover { border-color: rgba(37, 99, 235, 0.5); box-shadow: 0 0 12px rgba(37, 99, 235, 0.15); }
.format-option-sm.selected { border-color: var(--primary); background: rgba(37, 99, 235, 0.1); box-shadow: 0 0 16px rgba(37, 99, 235, 0.2); }
.format-option-sm input { position: absolute; top: 6px; right: 6px; width: 14px; height: 14px; accent-color: var(--primary); }
.fmt-ratio-box {
    width: 40px; border: 2.5px solid var(--text-muted); border-radius: 4px;
    background: rgba(37, 99, 235, 0.1); flex-shrink: 0;
}
.format-option-sm.selected .fmt-ratio-box { border-color: var(--primary); background: rgba(37, 99, 235, 0.2); }
.format-option-sm:hover .fmt-ratio-box { border-color: rgba(37, 99, 235, 0.6); }
.fmt-label-wrap { display: flex; flex-direction: column; line-height: 1.2; align-items: center; }
.fmt-label-main { font-weight: 700; font-size: 0.85rem; color: var(--text); }
.fmt-label-sub { font-size: 0.65rem; color: var(--text-secondary); font-weight: 400; }

/* Mobile style cards (hidden on desktop) */
.style-cards-mobile { display: none; }

@media (max-width: 640px) {
    .se-line { grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 4px; }
    .se-line-num { display: none; }
    .se-timing { grid-column: 1; grid-row: 1; justify-content: flex-start; }
    .se-text-wrap { grid-column: 1 / -1; grid-row: 2; }
    .se-actions { grid-column: 2; grid-row: 1; opacity: 1; }
}

/* === Language Switcher === */
.lang-switcher { display: flex; gap: 2px; margin-left: 8px; }
.lang-btn {
    background: transparent; border: 1px solid var(--border); color: var(--text-muted);
    padding: 4px 8px; font-size: 12px; font-weight: 600; cursor: pointer;
    border-radius: var(--radius-sm); transition: all 0.15s;
}
.lang-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.lang-btn:hover:not(.active) { color: var(--text); border-color: var(--text-muted); }

/* === Speaker Diarization === */
.transcription-speakers .speaker-segment { margin-bottom: 8px; line-height: 1.6; }
.speaker-label { font-weight: 700; font-size: 13px; margin-right: 4px; display: inline-block; }
.checkbox-label.disabled { opacity: 0.5; cursor: not-allowed; }

/* === API Keys === */
.api-keys-list { display: flex; flex-direction: column; gap: 8px; }
.api-key-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 12px; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

/* === Loading Spinner === */
.spinner {
    display: inline-block; width: 20px; height: 20px;
    border: 2px solid rgba(255,255,255,0.3); border-top-color: white;
    border-radius: 50%; animation: spin 0.6s linear infinite;
}
.spinner-lg { width: 40px; height: 40px; border-width: 3px; }
.spinner-primary { border-color: rgba(37,99,235,0.2); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }

/* === Card hover polish === */
.feature-card, .tool-card, .pricing-card, .clip-card {
    transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.feature-card:hover, .tool-card:hover, .clip-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.pricing-card:hover { box-shadow: var(--shadow-md); }
.pricing-card.featured:hover { box-shadow: 0 4px 20px rgba(37,99,235,0.25); }

/* === Job card polish === */
.job-card {
    transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.job-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* === Stat cards polish === */
.stat-card {
    transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* === Upload zone polish === */
.upload-zone {
    transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.upload-zone:hover { border-color: var(--text-muted); }
.upload-zone.drag-active {
    border-color: var(--primary);
    background: rgba(37,99,235,0.08);
    box-shadow: 0 0 0 4px rgba(37,99,235,0.1);
}

/* === Option radio polish === */
.option-radio {
    transition: border-color var(--transition), background var(--transition), transform var(--transition);
}
.option-radio:hover:not(.disabled) { transform: translateX(4px); }
.option-radio.selected {
    border-color: var(--primary);
    background: rgba(37,99,235,0.08);
    box-shadow: inset 3px 0 0 var(--primary);
}

/* === Tab buttons polish === */
.tab-btn { transition: all var(--transition); }
.tab-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

/* === Video player polish === */
.video-player {
    position: relative;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
}
.video-el { background: #000; }

/* === Progress bar animation === */
.progress-fill { position: relative; overflow: hidden; }
.progress-fill::after {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.15) 50%, transparent 100%);
    animation: shimmer 2s infinite;
}
@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* === Delete button for jobs === */
.btn-danger { background: transparent; color: var(--error); border: 1px solid var(--error); }
.btn-danger:hover { background: rgba(239,68,68,0.1); }
.btn-icon {
    width: 36px; height: 36px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; font-size: 16px;
}

/* === Usage bar on dashboard === */
.usage-bar {
    height: 8px; background: var(--bg-input); border-radius: 4px;
    overflow: hidden; margin-top: 8px;
}
.usage-fill {
    height: 100%; border-radius: 4px; transition: width 0.5s ease;
    background: linear-gradient(90deg, var(--success), var(--primary));
}
.usage-fill.high { background: linear-gradient(90deg, var(--warning), var(--error)); }

/* === Plan badge on dashboard === */
.plan-tag {
    display: inline-block; padding: 4px 14px; border-radius: 20px;
    font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
}
.plan-tag.free { background: rgba(148,163,184,0.15); color: var(--text-muted); }
.plan-tag.starter { background: rgba(37,99,235,0.15); color: var(--primary); }
.plan-tag.pro { background: linear-gradient(135deg, rgba(37,99,235,0.2), rgba(124,58,237,0.2)); color: var(--accent); }

/* === Empty state polish === */
.empty-state {
    padding: 80px 20px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px dashed var(--border);
}
.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }

/* === Smooth page transitions === */
.upload-section, .dashboard-section, .result-section, .settings-section {
    animation: fadeIn 0.3s ease-out;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === Info block (not processed / processing messages) === */
.info-block {
    background: var(--bg-card); border-radius: var(--radius); padding: 40px;
    border: 1px solid var(--border); text-align: center;
}
.info-block p { color: var(--text-muted); margin-bottom: 20px; font-size: 16px; }

/* === Navbar mobile polish === */
@media (max-width: 768px) {
    .nav-links { gap: 8px; }
    .nav-links a { padding: 8px 0; font-size: 15px; }
}

/* === Select dropdown polish === */
.form-group select {
    -webkit-appearance: none; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394A3B8' stroke-width='2' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
    padding-right: 36px;
}

/* === Checkbox toggle style === */
.checkbox-label input[type="checkbox"] {
    position: relative; width: 44px; height: 24px;
    -webkit-appearance: none; appearance: none;
    background: var(--bg-input); border-radius: 12px;
    border: 1px solid var(--border); cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.checkbox-label input[type="checkbox"]::after {
    content: ''; position: absolute; top: 2px; left: 2px;
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--text-muted); transition: transform 0.2s, background 0.2s;
}
.checkbox-label input[type="checkbox"]:checked {
    background: var(--primary); border-color: var(--primary);
}
.checkbox-label input[type="checkbox"]:checked::after {
    transform: translateX(20px); background: white;
}

/* === Customize Panel (collapsible re-style section) === */
.customize-panel {
    margin-top: 32px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.customize-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: none;
    border: none;
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition);
}
.customize-toggle:hover {
    background: rgba(255,255,255,0.03);
}
.customize-toggle svg {
    flex-shrink: 0;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}
.customize-toggle svg.rotate-180 {
    transform: rotate(180deg);
}
.customize-inner {
    padding: 0 24px 24px;
}
.customize-inner .style-selector {
    margin-bottom: 20px;
}
.customize-inner .preview-player-wrap {
    max-height: 300px;
    margin-bottom: 20px;
}
.customize-inner .preview-apply {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* === Result Split Layout (2 panels) === */
.result-split {
    display: grid;
    grid-template-columns: 2fr 3fr;
    gap: 24px;
    align-items: start;
}
.result-left {
    min-width: 0;
}
.result-right {
    /* No sticky/scroll — flows naturally with the page */
}

/* Compact stats (1 line) */
.result-stats-compact {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
}
.result-stats-compact .highlight { color: var(--success); }
.stat-arrow { color: var(--text-muted); }
.stat-saved {
    margin-left: auto;
    color: var(--success);
    font-weight: 600;
}

/* Compact actions row */
.result-actions-compact {
    display: flex;
    gap: 8px;
    margin: 12px 0 16px;
}
.result-actions-compact .btn { font-size: 13px; padding: 6px 14px; }

/* Small SRT/VTT links */
.download-links-small {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.download-links-small a {
    font-size: 12px;
    color: var(--text-muted);
    text-decoration: none;
}
.download-links-small a:hover { color: var(--primary); }

/* In split layout: taller editor */
.result-split .subtitle-editor-lines {
    max-height: calc(100vh - 300px);
}
/* In split layout: stats cards stack */
.result-split .result-stats {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 16px;
}
.result-split .stat-card { padding: 12px 16px; text-align: left; display: flex; justify-content: space-between; align-items: center; }
.result-split .stat-card .stat-value { font-size: 18px; }

/* Mobile: stack vertically */
@media (max-width: 768px) {
    .result-split {
        grid-template-columns: 1fr;
    }
    .result-right {
        position: static;
        max-height: none;
        order: -1;
    }
    .result-split .subtitle-editor-lines {
        max-height: 400px;
    }
    .result-split .result-stats {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
    .result-split .stat-card { display: block; text-align: center; padding: 24px; }
    .result-split .stat-card .stat-value { font-size: 28px; }

    /* Hide left gallery on mobile, show cards in right panel */
    .style-gallery { display: none; }
    .left-tabs { display: none; }
    .style-cards-mobile {
        display: flex; flex-wrap: wrap; gap: 8px;
        justify-content: center;
        margin-bottom: 16px;
    }
    .style-card-m {
        cursor: pointer; border-radius: var(--radius-sm);
        border: 2px solid transparent;
        transition: border-color 0.15s;
        width: calc(50% - 4px);
        overflow: hidden;
    }
    .style-card-m:hover { border-color: rgba(37, 99, 235, 0.4); }
    .style-card-m.active { border-color: var(--primary); }
    .style-card-m-img {
        display: flex; align-items: center; justify-content: center;
        width: 100%; background: #1E293B;
        border-radius: var(--radius-sm) var(--radius-sm) 0 0;
        overflow: hidden; padding: 8px 4px;
    }
    .style-card-m-img img {
        display: block; max-width: 100%; height: auto;
    }
    .style-card-m-label {
        display: block; text-align: center; padding: 4px 0;
        font-size: 11px; font-weight: 600; color: var(--text-muted);
        background: var(--bg-card);
        border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    }
    .style-card-m.active .style-card-m-label { color: var(--primary); }
}
