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

/* ── DARK THEME (default) ── */
:root {
    --bg: #0a0a0f;
    --surface: rgba(20, 20, 30, 0.75);
    --surface2: rgba(30, 30, 45, 0.6);
    --surface-solid: #16161e;
    --border: rgba(255,255,255,0.08);
    --accent: #8b7cf7;
    --accent-hover: #a396ff;
    --accent-glow: rgba(139, 124, 247, 0.25);
    --text: #f0f0f5;
    --text-muted: #8a8aa3;
    --success: #5ee7a0;
    --error: #ff7b7b;
    --warning: #ffd166;
    --radius: 14px;
    --radius-lg: 22px;
    --glass-blur: 16px;
    --glass-saturation: 120%;
}

/* ── LIGHT THEME ── */
body[data-theme="light"] {
    --bg: #f5f5fa;
    --surface: rgba(255, 255, 255, 0.72);
    --surface2: rgba(240, 240, 250, 0.6);
    --surface-solid: #ffffff;
    --border: rgba(0,0,0,0.08);
    --accent: #6c5ce7;
    --accent-hover: #5a4bd4;
    --accent-glow: rgba(108, 92, 231, 0.2);
    --text: #1a1a2e;
    --text-muted: #6b6b8a;
    --success: #2ecc71;
    --error: #e74c3c;
    --warning: #f39c12;
}

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

/* Theme toggle button */
.theme-toggle {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 100;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.theme-toggle:hover {
    transform: scale(1.08);
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}

.bg-gradient {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(139,124,247,0.12) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 20%, rgba(118,75,162,0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 100%, rgba(139,124,247,0.06) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
    transition: opacity 0.4s;
}
body[data-theme="light"] .bg-gradient {
    background:
        radial-gradient(ellipse at 20% 0%, rgba(108,92,231,0.07) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 20%, rgba(90,75,180,0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 100%, rgba(108,92,231,0.03) 0%, transparent 60%);
}

.header {
    text-align: center;
    padding: 60px 24px 32px;
    position: relative;
    z-index: 1;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.logo-icon { font-size: 40px; }

.logo-text {
    font-size: 36px;
    font-weight: 800;
    background: linear-gradient(135deg, #c4b5fd, #8b7cf7, #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.tagline {
    color: var(--text-muted);
    font-size: 15px;
    max-width: 480px;
    margin: 0 auto;
}

.container {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 20px 80px;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Glassmorphism cards */
.card {
    background: var(--surface);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    transition: box-shadow 0.3s, transform 0.3s;
}
body[data-theme="light"] .card {
    box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}

/* Settings card (shared below tabs) */
.settings-card {
    margin-top: 16px;
}

/* ── Stored Clips Button ── */
.btn-stored-clips {
    margin-top: 16px;
    padding: 10px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.btn-stored-clips:hover {
    background: var(--surface2);
    border-color: var(--accent);
}

.btn-stored-clips .badge {
    background: var(--accent);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 99px;
    min-width: 18px;
    text-align: center;
}

/* ── Stored Clips Panel ── */
.stored-clips-card {
    position: relative;
    z-index: 1;
    margin-bottom: 20px;
}

.stored-clips-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    transition: color 0.2s;
}

.btn-close:hover { color: var(--error); }

.stored-clips-desc {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 16px;
}

.stored-clips-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 480px;
    overflow-y: auto;
    padding-right: 4px;
}

.stored-clip-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    transition: border-color 0.2s;
}

.stored-clip-row:hover {
    border-color: var(--accent);
}

.stored-clip-row .clip-thumb {
    width: 72px;
    height: 48px;
    background: #000;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

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

.stored-clip-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stored-clip-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.stored-clip-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.stored-btn {
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}

.stored-btn-download {
    background: var(--accent);
    color: white;
}

.stored-btn-download:hover { background: var(--accent-hover); }

.stored-btn-share {
    background: #1da1f2;
    color: white;
    border: none;
}

.stored-btn-share:hover { background: #0d8bd9; }

.stored-btn-delete {
    background: transparent;
    color: var(--error);
    border: 1px solid var(--error);
}

.stored-btn-delete:hover { background: rgba(248,113,113,0.1); }

/* ── Stored Clip Thumbnail Play ── */
.stored-thumb-wrap {
    position: relative;
    width: 72px;
    height: 48px;
    flex-shrink: 0;
    cursor: pointer;
    border-radius: 6px;
    overflow: hidden;
    background: #000;
}

.stored-thumb-wrap .clip-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.stored-play-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: rgba(0,0,0,0.4);
    transition: opacity 0.2s;
    pointer-events: none;
}

.stored-thumb-wrap:hover .stored-play-icon {
    background: rgba(0,0,0,0.25);
}

.stored-thumb-wrap.playing .stored-play-icon {
    opacity: 0;
}

.stored-clips-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.btn-danger {
    padding: 10px 18px;
    background: transparent;
    color: var(--error);
    border: 1px solid var(--error);
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-danger:hover { background: rgba(248,113,113,0.15); }

.stored-total {
    font-size: 13px;
    color: var(--text-muted);
}

/* Input card */
.section-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 6px;
}

.section-desc {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 22px;
}

.form-group { margin-bottom: 18px; }

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hint {
    font-weight: 400;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: 0;
    margin-left: 6px;
}

.input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

input[type="url"], input[type="text"] {
    flex: 1;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
}

input[type="url"]:focus, input[type="text"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

input[type="url"]::placeholder { color: var(--text-muted); }

.btn-icon {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.btn-icon:hover { background: var(--border); }

/* Range inputs */
.range-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    height: 4px;
    background: var(--border);
    border-radius: 99px;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.range-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    min-width: 30px;
    text-align: right;
}

/* Cookies card */
.cookies-card {
    border-color: #fbbf24;
    background: linear-gradient(135deg, var(--surface), rgba(251,191,36,0.04));
}

.cookies-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    flex-wrap: wrap;
}

.cookies-icon { font-size: 28px; flex-shrink: 0; margin-top: 2px; }

.cookies-info { flex: 1; min-width: 180px; }

.cookies-info h3 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.cookies-info p { font-size: 13px; color: var(--text-muted); }

.cookies-status {
    font-size: 12px;
    font-weight: 600;
    background: var(--surface2);
    padding: 2px 10px;
    border-radius: 99px;
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.cookies-status.active {
    background: rgba(74, 222, 128, 0.1);
    border-color: var(--success);
    color: var(--success);
}

.cookies-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.btn-upload {
    padding: 8px 16px;
    background: var(--warning);
    color: #000;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.btn-upload:hover { opacity: 0.85; }

.btn-ghost-sm {
    padding: 8px 12px;
    background: transparent;
    color: var(--error);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.btn-ghost-sm:hover { background: rgba(248,113,113,0.1); border-color: var(--error); }

.how-to {
    margin-top: 16px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.how-to summary {
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
    font-weight: 600;
}

.how-to summary::before {
    content: '▶';
    font-size: 9px;
    transition: transform 0.2s;
}

.how-to[open] summary::before { transform: rotate(90deg); }
.how-to summary:hover { color: var(--text); }

.how-to-steps {
    margin-top: 12px;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.how-to-steps li { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.how-to-steps strong { color: var(--text); }
.how-to-steps code {
    background: var(--surface2);
    border: 1px solid var(--border);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--accent);
}

/* Duration input */
.duration-group { margin-bottom: 18px; }

.duration-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.duration-input-wrap input[type="number"] {
    width: 100px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    color: var(--text);
    font-size: 22px;
    font-weight: 700;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    text-align: center;
}

.duration-input-wrap input[type="number"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.duration-input-wrap input[type="number"]::-webkit-inner-spin-button,
.duration-input-wrap input[type="number"]::-webkit-outer-spin-button { opacity: 1; }

.duration-unit {
    font-size: 15px;
    color: var(--text-muted);
    font-weight: 500;
}

.duration-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.preset-btn {
    padding: 6px 14px;
    border-radius: 99px;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.preset-btn:hover { background: var(--border); color: var(--text); }
.preset-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Advanced toggle */
.advanced-toggle {
    margin-bottom: 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.advanced-toggle summary {
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}

.advanced-toggle summary::before {
    content: '▶';
    font-size: 10px;
    transition: transform 0.2s;
}

.advanced-toggle[open] summary::before { transform: rotate(90deg); }
.advanced-toggle summary:hover { color: var(--text); }

.advanced-grid {
    padding: 16px;
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 560px) { .advanced-grid { grid-template-columns: 1fr; } }

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.btn-primary::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 50%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}
.btn-primary:hover::after { opacity: 1; }

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    box-shadow: 0 4px 24px var(--accent-glow), 0 0 0 1px rgba(255,255,255,0.08) inset;
    transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) { transform: scale(0.98) translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
    padding: 8px 16px;
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary:hover { background: var(--accent-glow); }

.btn-ghost {
    padding: 8px 16px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.btn-ghost:hover { background: var(--surface2); color: var(--error); border-color: var(--error); }

.btn-icon-left { font-size: 16px; }

/* ── Tabs ── */
.tab-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

.tab-btn {
    flex: 1;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.tab-btn:hover:not(.active) {
    background: var(--surface2);
    color: var(--text);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── File Drop Zone ── */
.file-drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    margin-bottom: 18px;
}

.file-drop-zone:hover,
.file-drop-zone.dragover {
    border-color: var(--accent);
    background: rgba(124, 106, 247, 0.05);
}

.file-drop-icon { font-size: 48px; margin-bottom: 12px; }
.file-drop-text { color: var(--text); font-size: 15px; margin-bottom: 4px; }
.file-drop-hint { color: var(--text-muted); font-size: 13px; }
.file-name { color: var(--accent); font-size: 14px; margin-top: 8px; font-weight: 600; }

/* Progress card */
.progress-card {
    border-color: var(--accent);
    background: linear-gradient(135deg, var(--surface), rgba(124,106,247,0.05));
}

.progress-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

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

.progress-message {
    color: var(--text-muted);
    font-size: 14px;
}

.progress-bar-wrap {
    background: var(--surface2);
    border-radius: 99px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #7c6af7, #60a5fa);
    border-radius: 99px;
    transition: width 0.4s ease;
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-muted);
}

/* Results */
.results-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}

.results-header .section-title { margin-bottom: 0; flex: 1; }

.results-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.clip-count {
    font-size: 13px;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 4px 12px;
    border-radius: 99px;
}

.clips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.clip-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.2s, transform 0.2s;
}

.clip-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.clip-video-wrap {
    position: relative;
    aspect-ratio: 16/9;
    background: #000;
}

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

.clip-info {
    padding: 12px;
}

.clip-title {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 4px;
}

.clip-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.clip-meta span { margin-right: 10px; }

.clip-actions {
    display: flex;
    gap: 8px;
}

.clip-btn {
    flex: 1;
    padding: 7px;
    border-radius: 8px;
    border: none;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    text-align: center;
    text-decoration: none;
    display: block;
}

.clip-btn:hover { opacity: 0.85; }

.clip-btn-download {
    background: var(--accent);
    color: white;
}

.clip-btn-delete {
    background: var(--surface2);
    color: var(--error);
    border: 1px solid var(--border);
}

.clip-btn-share {
    background: #1da1f2;
    color: white;
    border: none;
}

.clip-btn-upload {
    background: linear-gradient(135deg, #ff0050, #00f2ea);
    color: white;
    border: none;
    width: 100%;
    margin-top: 8px;
}

.upload-section { margin-top: 8px; }

/* ── Play Overlay ── */
.play-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.35);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.25s;
    z-index: 2;
}

.play-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.play-icon {
    font-size: 36px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
    transition: transform 0.15s;
}

.play-overlay:hover .play-icon {
    transform: scale(1.15);
}

.clip-video-wrap:hover .play-overlay:not(.hidden) {
    background: rgba(0,0,0,0.2);
}

.upload-toggle {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    cursor: pointer;
    padding: 6px 0;
    user-select: none;
    transition: color 0.2s;
}

.upload-toggle:hover { color: #a78bfa; }

.upload-form {
    padding: 10px;
    background: var(--surface2);
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-top: 4px;
}

.upload-caption {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px;
    color: var(--text);
    font-size: 12px;
    margin-bottom: 10px;
    outline: none;
}

.upload-caption:focus { border-color: var(--accent); }

.upload-platforms {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.upload-platforms label {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    background: var(--surface);
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
    transition: border-color 0.2s;
}

.upload-platforms label:hover { border-color: var(--accent); }

.upload-platforms input[type="checkbox"] {
    accent-color: var(--accent);
    cursor: pointer;
}

.upload-result {
    margin-top: 8px;
    font-size: 11px;
    line-height: 1.5;
}

.upload-result .ok { color: var(--success); }
.upload-result .fail { color: var(--error); }
.upload-result .pending { color: var(--warning); }

/* Upload panel section */
.upload-panel-section {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.upload-panel-section.upload-fade-in {
    opacity: 1;
    transform: translateY(0);
}

.upload-panel-card {
    border-color: var(--success);
    background: linear-gradient(135deg, var(--surface), rgba(74,222,128,0.04));
}

.upload-clip-select {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    cursor: pointer;
}

.upload-clip-select:focus { border-color: var(--accent); }

.upload-caption {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    color: var(--text);
    font-size: 14px;
    outline: none;
}

.upload-caption:focus { border-color: var(--accent); }

.upload-schedule {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    color: var(--text);
    font-size: 14px;
    outline: none;
}

.upload-schedule:focus { border-color: var(--accent); }

.upload-platform-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.up-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface2);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    user-select: none;
}

.up-tag:hover { border-color: var(--accent); }

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

.up-tag.up-tiktok:has(input:checked) { border-color: #ff0050; background: rgba(255,0,80,0.08); color: #ff4d8a; }
.up-tag.up-facebook:has(input:checked) { border-color: #1877f2; background: rgba(24,119,242,0.08); color: #4a9af5; }
.up-tag.up-youtube:has(input:checked) { border-color: #ff0000; background: rgba(255,0,0,0.08); color: #ff4d4d; }
.up-tag.up-instagram:has(input:checked) { border-color: #e1306c; background: rgba(225,48,108,0.08); color: #e85d8a; }

.btn-upload-green {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

.btn-upload-green:hover:not(:disabled) { opacity: 0.9; transform: scale(0.99); }
.btn-upload-green:disabled { opacity: 0.5; cursor: not-allowed; }

.upload-progress-area { margin-top: 16px; }

.upload-progress-bar { background: linear-gradient(90deg, #22c55e, #4ade80) !important; }

.upload-results-area {
    margin-top: 14px;
    padding: 12px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.up-results-title {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}

.up-result-row {
    font-size: 12px;
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.up-result-row.ok { color: var(--success); }
.up-result-row.fail { color: var(--error); }

.up-result-row strong {
    font-weight: 600;
    color: var(--text);
    min-width: 120px;
}

/* Error */
.error-card {
    text-align: center;
    border-color: var(--error);
    background: rgba(248, 113, 113, 0.05);
}

.error-icon { font-size: 40px; margin-bottom: 12px; }
.error-card h3 { margin-bottom: 8px; }
.error-card p { color: var(--text-muted); font-size: 14px; margin-bottom: 20px; }
.error-card .btn-primary { width: auto; display: inline-flex; }

/* ── Toast Notification ── */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    pointer-events: all;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    min-width: 280px;
    max-width: 360px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(.22,1,.36,1), opacity 0.3s ease;
    cursor: pointer;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-icon { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--error); }
.toast.warning .toast-icon { color: var(--warning); }

.toast-body { flex: 1; }
.toast-title { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.toast-msg { font-size: 12px; color: var(--text-muted); }

.toast-close {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; font-size: 16px; padding: 0; line-height: 1;
    transition: color 0.2s;
}
.toast-close:hover { color: var(--text); }

.toast-progress {
    position: absolute; bottom: 0; left: 0; height: 3px;
    background: var(--accent); border-radius: 0 0 0 var(--radius);
    transition: width 0.3s linear;
}
.toast { position: relative; overflow: hidden; }


/* ── Upload Tabs ── */
.upload-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.upload-tab-btn {
    background: none; border: none; color: var(--text-muted);
    font-size: 13px; font-weight: 500; padding: 8px 14px;
    cursor: pointer; position: relative;
    transition: color 0.2s;
}

.upload-tab-btn:hover { color: var(--text); }
.upload-tab-btn.active {
    color: var(--accent);
}
.upload-tab-btn.active::after {
    content: '';
    position: absolute; bottom: -1px; left: 0; right: 0;
    height: 2px; background: var(--accent);
    border-radius: 2px 2px 0 0;
}

.upload-tab-badge {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 5px;
}


/* ── Video Preview ── */
.up-preview-card {
    display: flex;
    gap: 14px;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 16px;
    transition: border-color 0.2s;
}

.up-preview-card:hover { border-color: var(--accent); }

.up-preview-thumb {
    width: 120px; height: 68px;
    border-radius: 8px;
    background: var(--bg);
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.up-preview-thumb.playable { cursor: pointer; }

.up-preview-info { flex: 1; min-width: 0; }
.up-preview-title {
    font-size: 14px; font-weight: 600;
    margin-bottom: 4px; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}

.up-preview-meta {
    display: flex; gap: 12px; flex-wrap: wrap;
    font-size: 12px; color: var(--text-muted);
}

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


/* ── Per-Platform Progress ── */
.up-platform-progress {
    display: flex; flex-direction: column; gap: 8px;
    margin: 12px 0;
}

.up-platform-row {
    display: flex; align-items: center; gap: 10px;
    font-size: 12px;
    padding: 8px 10px;
    background: var(--surface);
    border-radius: 8px;
    border: 1px solid transparent;
    transition: border-color 0.2s, background 0.2s;
}

.up-platform-row:hover { border-color: var(--border); }
.up-platform-row.done { border-color: var(--success); background: rgba(74,222,128,0.05); }
.up-platform-row.fail { border-color: var(--error); background: rgba(248,113,113,0.05); }

.up-platform-icon { font-size: 16px; flex-shrink: 0; width: 20px; text-align: center; }
.up-platform-name { flex: 1; font-weight: 500; }
.up-platform-status { font-size: 11px; color: var(--text-muted); }
.up-platform-status.success { color: var(--success); }
.up-platform-status.fail { color: var(--error); }

.up-platform-mini-bar {
    width: 60px; height: 4px; background: var(--border);
    border-radius: 2px; overflow: hidden; flex-shrink: 0;
}
.up-platform-mini-fill {
    height: 100%; background: var(--accent);
    border-radius: 2px;
    transition: width 0.3s ease;
}
.up-platform-mini-fill.done { background: var(--success); }
.up-platform-mini-fill.fail { background: var(--error); }


/* ── Action Buttons ── */
.up-action-bar {
    display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px;
}

.btn-upload-green {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff; border: none; border-radius: var(--radius);
    padding: 12px 22px; font-size: 14px; font-weight: 600;
    cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
    transition: transform 0.15s, box-shadow 0.2s, filter 0.2s;
}
.btn-upload-green:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(16,185,129,0.3); }
.btn-upload-green:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-up-secondary {
    background: var(--surface2); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 10px 16px; font-size: 13px; font-weight: 500;
    cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
    transition: background 0.2s, border-color 0.2s;
}
.btn-up-secondary:hover { background: var(--border); border-color: var(--accent); }

.btn-up-danger {
    background: rgba(248,113,113,0.1); color: var(--error);
    border: 1px solid rgba(248,113,113,0.2); border-radius: var(--radius);
    padding: 10px 16px; font-size: 13px; font-weight: 500;
    cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
    transition: background 0.2s;
}
.btn-up-danger:hover { background: rgba(248,113,113,0.2); }


/* ── Draft / History Lists ── */
.up-list {
    display: flex; flex-direction: column; gap: 8px;
    max-height: 320px; overflow-y: auto;
    padding-right: 4px;
}
.up-list::-webkit-scrollbar { width: 4px; }
.up-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.up-list-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; background: var(--surface);
    border-radius: var(--radius); border: 1px solid transparent;
    transition: border-color 0.2s, background 0.2s;
}
.up-list-item:hover { border-color: var(--border); }

.up-list-thumb {
    width: 40px; height: 24px; border-radius: 4px;
    background: var(--bg); object-fit: cover; flex-shrink: 0;
    border: 1px solid var(--border);
}

.up-list-info { flex: 1; min-width: 0; }
.up-list-name { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-list-date { font-size: 11px; color: var(--text-muted); }

.up-list-actions {
    display: flex; gap: 6px;
}

.up-list-actions button {
    background: none; border: none; color: var(--text-muted);
    font-size: 12px; cursor: pointer; padding: 4px 8px;
    border-radius: 4px; transition: color 0.2s, background 0.2s;
}
.up-list-actions button:hover { color: var(--text); background: var(--border); }

.up-list-empty {
    text-align: center; padding: 32px 20px; color: var(--text-muted); font-size: 13px;
}


/* ── Preferences Panel ── */
.up-prefs-bar {
    display: flex; gap: 8px; flex-wrap: wrap;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.up-pref-chip {
    background: var(--surface); color: var(--text-muted);
    border: 1px solid var(--border); border-radius: 20px;
    padding: 4px 12px; font-size: 12px; cursor: pointer;
    display: inline-flex; align-items: center; gap: 5px;
    transition: all 0.2s;
}
.up-pref-chip:hover { border-color: var(--accent); color: var(--text); }
.up-pref-chip.active {
    background: var(--accent); color: #fff; border-color: var(--accent);
}


/* ── Hashtag Tags ── */
.up-hashtag-row {
    display: flex; gap: 6px; flex-wrap: wrap;
    margin-top: 6px;
}

.up-hashtag {
    background: rgba(124,106,247,0.1); color: var(--accent);
    border: 1px solid rgba(124,106,247,0.2);
    border-radius: 12px; padding: 2px 10px;
    font-size: 11px; font-weight: 500;
    cursor: pointer; user-select: none;
    transition: all 0.2s;
}
.up-hashtag:hover { background: var(--accent); color: #fff; }
.up-hashtag.added { background: var(--success); color: #fff; border-color: var(--success); }


/* ── Smooth reveal ── */
.upload-panel-section {
    opacity: 0; transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.upload-panel-section.upload-fade-in {
    opacity: 1; transform: translateY(0);
}


/* ── Cancel overlay ── */
.up-cancel-overlay {
    position: absolute; inset: 0;
    background: rgba(15,15,19,0.7);
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius);
    backdrop-filter: blur(2px);
}


/* ── Template Selector ── */
.template-group {
    margin-bottom: 18px;
}
.template-group .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.template-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.template-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface2);
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.template-chip:hover {
    border-color: var(--accent);
    background: rgba(139,124,247,0.08);
    transform: translateY(-1px);
}

.template-chip.active {
    border-color: var(--accent);
    background: rgba(139,124,247,0.12);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.template-chip .ratio-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 30px;
    border: 2px solid currentColor;
    border-radius: 3px;
    position: relative;
    flex-shrink: 0;
}

.template-chip .ratio-icon.v-9-16 {
    width: 22px;
    height: 34px;
    border-radius: 3px;
}

.template-chip .ratio-icon.v-4-5 {
    width: 28px;
    height: 34px;
    border-radius: 3px;
}

.template-chip .ratio-icon.v-16-9 {
    width: 38px;
    height: 24px;
    border-radius: 3px;
}

.template-chip .chip-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.template-chip .chip-meta {
    font-size: 11px;
    color: var(--text-muted);
}

.template-chip.active .chip-label { color: var(--accent); }

/* ── Responsive ── */
@media (max-width: 640px) {
    .header { padding: 48px 16px 24px; }
    .logo-text { font-size: 28px; }
    .container { padding: 0 14px 60px; gap: 16px; }
    .card { padding: 20px; border-radius: var(--radius); }
    .template-presets { gap: 8px; }
    .template-chip { padding: 8px 12px; }
    .clips-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
    .results-actions { gap: 8px; }
    .progress-card { padding: 20px; }
    .input-row { flex-direction: column; }
    .input-row input { width: 100%; }
    .btn-icon { width: 100%; height: 48px; }
    .duration-presets { gap: 6px; }
    .preset-btn { padding: 5px 10px; font-size: 12px; }
    .tab-bar { gap: 6px; }
    .tab-btn { font-size: 13px; padding: 10px 12px; }
    .theme-toggle { top: 10px; right: 10px; width: 36px; height: 36px; font-size: 16px; }
}

@media (max-width: 480px) {
    .logo-text { font-size: 24px; }
    .logo-icon { font-size: 32px; }
    .tagline { font-size: 13px; }
    .section-title { font-size: 16px; }
    .duration-input-wrap input[type="number"] { font-size: 18px; width: 80px; padding: 8px 10px; }
    .clip-card .clip-meta { font-size: 11px; }
    .clip-actions { flex-wrap: wrap; }
    .clip-btn { font-size: 11px; padding: 6px; }
    .results-header { flex-direction: column; align-items: stretch; gap: 8px; }
    .results-actions { justify-content: space-between; }
    .share-modal-content { padding: 20px; border-radius: var(--radius); }
    .template-chip .chip-label { font-size: 12px; }
    .template-chip .chip-meta { font-size: 10px; }
}

/* Footer */
.footer {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 12px;
    border-top: 1px solid var(--border);
    background: var(--surface);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
}

/* ── Share Modal ── */
.share-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.share-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}

.share-modal-content {
    position: relative;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: modalIn 0.25s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

.share-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
}
.share-modal-close:hover { background: rgba(255,255,255,0.05); color: var(--text); }

.share-modal-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text);
}

.share-modal-filename {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 16px;
    word-break: break-all;
}

.share-modal-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.share-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    text-align: left;
}
.share-option:hover {
    background: rgba(124,106,247,0.08);
    border-color: var(--accent);
}

.share-option-icon { font-size: 22px; flex-shrink: 0; }
.share-option-label { font-weight: 500; display: block; }
.share-option-sub  { font-size: 11px; color: var(--text-muted); display: block; }

.share-option-file { border-color: rgba(124,106,247,0.3); }
.share-option-file:hover { background: rgba(124,106,247,0.12); }

.share-modal-note {
    margin-top: 14px;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.5;
    text-align: center;
}
