/* ===== TOKENS ===== */
:root {
    --bg: #0a0a0f;
    --surface: #13131a;
    --surface-2: #1c1c27;
    --surface-3: #252535;
    --border: rgba(255,255,255,0.07);
    --border-hover: rgba(255,255,255,0.14);
    --text: #f0f0f8;
    --text-2: #8888aa;
    --text-3: #5555770;
    --accent: #7c6fff;
    --accent-2: #a594ff;
    --accent-glow: rgba(124,111,255,0.25);
    --green: #22d47b;
    --green-glow: rgba(34,212,123,0.2);
    --red: #ff5c6e;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 24px 60px rgba(0,0,0,0.5);
    --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg: #f0f0f7;
    --surface: #ffffff;
    --surface-2: #f5f5fc;
    --surface-3: #ebebf5;
    --border: rgba(0,0,0,0.07);
    --border-hover: rgba(0,0,0,0.14);
    --text: #1a1a2e;
    --text-2: #666688;
    --accent: #5b4fe8;
    --accent-2: #7c6fff;
    --accent-glow: rgba(91,79,232,0.15);
    --shadow: 0 24px 60px rgba(0,0,0,0.1);
}

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

/* ===== BASE ===== */
body {
    font-family: 'DM Sans', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background var(--transition), color var(--transition);
    overflow-x: hidden;
}

/* ===== BACKGROUND ===== */
.bg-grid {
    position: fixed; inset: 0; z-index: 0;
    background-image:
        linear-gradient(rgba(124,111,255,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(124,111,255,0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}

[data-theme="light"] .bg-grid {
    background-image:
        linear-gradient(rgba(91,79,232,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(91,79,232,0.05) 1px, transparent 1px);
}

.bg-glow {
    position: fixed; top: -200px; left: 50%; transform: translateX(-50%);
    width: 700px; height: 500px;
    background: radial-gradient(ellipse, rgba(124,111,255,0.12) 0%, transparent 70%);
    pointer-events: none; z-index: 0;
}

/* ===== WRAPPER ===== */
.wrapper {
    position: relative; z-index: 1;
    width: 100%; max-width: 460px;
    padding: 32px 16px 48px;
}

/* ===== HEADER ===== */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    animation: fadeDown 0.5s ease both;
}

.logo {
    display: flex; align-items: center; gap: 10px;
    font-family: 'Syne', sans-serif;
    font-weight: 800; font-size: 18px; letter-spacing: -0.3px;
    cursor: pointer;
    transition: opacity var(--transition);
}
.logo:hover { opacity: 0.75; }

.logo-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: white;
    box-shadow: 0 4px 16px var(--accent-glow);
}

.logo-accent { color: var(--accent-2); }

.theme-btn {
    width: 38px; height: 38px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    color: var(--text-2);
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition);
}
.theme-btn:hover {
    border-color: var(--border-hover);
    color: var(--text);
    background: var(--surface-2);
}

[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }

/* ===== CARD ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 32px 28px;
    box-shadow: var(--shadow);
    transition: background var(--transition);
    animation: fadeUp 0.5s 0.1s ease both;
    overflow: hidden;
    min-height: 320px;
}

/* ===== STEPS ===== */
.step { display: none; animation: stepIn 0.35s ease both; }
.step.active { display: block; }

@keyframes stepIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===== STEP 1 ===== */
.step-hero {
    text-align: center;
    margin-bottom: 28px;
}

.hero-icon {
    width: 64px; height: 64px;
    background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
    border: 1px solid var(--border);
    border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 18px;
    color: var(--accent-2);
}

h2 {
    font-family: 'Syne', sans-serif;
    font-weight: 800; font-size: 22px;
    letter-spacing: -0.5px;
    color: var(--text);
    margin-bottom: 6px;
}

.hero-sub {
    color: var(--text-2);
    font-size: 14px;
    line-height: 1.5;
}

/* INPUT */
.input-wrap {
    position: relative;
    display: flex; align-items: center;
    margin-bottom: 16px;
}

.input-icon {
    position: absolute; left: 14px;
    color: var(--text-2); pointer-events: none;
    flex-shrink: 0;
}

input[type="text"] {
    width: 100%;
    padding: 14px 48px 14px 42px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    color: var(--text);
    transition: all var(--transition);
    outline: none;
}
input[type="text"]::placeholder { color: var(--text-2); }
input[type="text"]:focus {
    border-color: var(--accent);
    background: var(--surface-3);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.paste-btn {
    position: absolute; right: 10px;
    width: 30px; height: 30px;
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: 7px;
    cursor: pointer; color: var(--text-2);
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition);
}
.paste-btn:hover { background: var(--accent); color: white; border-color: var(--accent); }

/* MAIN BUTTON */
.main-btn {
    width: 100%;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    background: linear-gradient(135deg, var(--accent), #9d8fff);
    color: white;
    border: none;
    padding: 15px 20px;
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 15px; font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 4px 20px var(--accent-glow);
    letter-spacing: 0.1px;
}
.main-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 30px var(--accent-glow);
    filter: brightness(1.08);
}
.main-btn:active { transform: translateY(0); }

/* ===== STEP 2 ===== */
/* ===== STEP 2 ===== */
.step2-header {
    margin-bottom: 16px;
}

.back-btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-2);
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 13px; font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}
.back-btn:hover {
    border-color: var(--border-hover);
    color: var(--text);
    background: var(--surface-2);
}

.preview-box {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--surface-3);
    display: none;
    margin-bottom: 16px;
    aspect-ratio: 16/9;
}
.preview-box img { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.5) 0%, transparent 50%);
}

.video-meta { margin-bottom: 4px; }
.video-title {
    font-weight: 600; font-size: 15px;
    line-height: 1.45; color: var(--text);
    margin-bottom: 14px;
}
.quality-label {
    font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 1px;
    color: var(--text-2);
    margin-bottom: 12px;
}

.quality-grid {
    display: flex; flex-wrap: wrap;
    gap: 8px; justify-content: flex-start;
    padding: 0;
}

.btn-quality {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 13px; font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}
.btn-quality:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px var(--accent-glow);
}

/* ===== STEP 3 ===== */
.status-icon {
    width: 64px; height: 64px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 18px;
    color: var(--accent-2);
}

.status-icon.done {
    background: linear-gradient(135deg, rgba(34,212,123,0.15), rgba(34,212,123,0.05));
    border-color: rgba(34,212,123,0.25);
    color: var(--green);
}

#step3 { text-align: center; }
#step3 h2 { margin-bottom: 20px; }

@keyframes spin {
    to { transform: rotate(360deg); }
}
.spin { animation: spin 1.2s linear infinite; }

/* PROGRESS */
.progress-info {
    display: none;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 13px;
}
.current-task { color: var(--text-2); text-align: left; flex: 1; padding-right: 10px; line-height: 1.4; }
.percent-text { color: var(--accent-2); font-weight: 700; font-variant-numeric: tabular-nums; font-size: 14px; }

.progress-track {
    display: none;
    width: 100%; height: 6px;
    background: var(--surface-3);
    border-radius: 100px;
    overflow: hidden;
    margin-bottom: 0;
}
.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    border-radius: 100px;
    transition: width 0.15s ease-out;
    position: relative; overflow: hidden;
}
.progress-shine {
    position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.3) 50%, transparent 100%);
    animation: shine 1.8s linear infinite;
}

@keyframes shine {
    from { transform: translateX(-100%); }
    to   { transform: translateX(200%); }
}

/* DOWNLOAD BUTTON */
.btn-success {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    background: linear-gradient(135deg, var(--green), #1ab866);
    color: white;
    border: none;
    padding: 15px 20px;
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 15px; font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    margin-top: 24px;
    transition: all var(--transition);
    box-shadow: 0 4px 20px var(--green-glow);
    letter-spacing: 0.1px;
}
.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 30px var(--green-glow);
    filter: brightness(1.06);
}

.btn-ghost {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-2);
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px; font-weight: 500;
    cursor: pointer;
    margin-top: 12px;
    width: 100%;
    transition: all var(--transition);
}
.btn-ghost:hover {
    border-color: var(--border-hover);
    color: var(--text);
    background: var(--surface-2);
}

/* ===== AD SLOTS ===== */
.ad-slot {
    width: 468px;
    height: 60px;
    max-width: 100%;           /* не вылезает за экран на мобиле */
    margin-left: auto;
    margin-right: auto;
    border-radius: var(--radius-sm);
    border: 1.5px dashed var(--border-hover);
    background: var(--surface);
    display: flex; align-items: center; justify-content: center;
    animation: fadeUp 0.5s 0.15s ease both;
    transition: background var(--transition);
    overflow: hidden;
}

.ad-slot--bottom { margin-top: 16px; }

.ad-label {
    font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 1.2px;
    color: var(--text-2);
    opacity: 0.4;
    pointer-events: none;
    user-select: none;
}

/* Когда внутри будет реальный рекламный блок — убираем заглушку */
.ad-slot:has(> :not(.ad-label)) .ad-label { display: none; }

/* ===== FOOTER ===== */
footer {
    text-align: center;
    margin-top: 20px;
    font-size: 12px;
    color: var(--text-2);
    opacity: 0.6;
    animation: fadeUp 0.5s 0.2s ease both;
}

footer a {
    color: var(--accent-2);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid transparent;
    transition: border-color var(--transition), opacity var(--transition);
}
footer a:hover {
    border-bottom-color: var(--accent-2);
    opacity: 0.8;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }