/* ===================== CSS VARIABLES ===================== */
:root {
    --accent: #8A2BE2;
    --accent-bright: #6DFFD4;
    --accent-glow: rgba(109, 255, 212, 0.25);
    --accent-soft: rgba(138, 43, 226, 0.08);
    --accent-purple-glow: rgba(138, 43, 226, 0.3);
    --transition-speed: 0.4s;
}

[data-theme="dark"] {
    --bg-gradient-1: #0A0A0F;
    --bg-gradient-2: #0F0F18;
    --bg-gradient-3: #151522;
    --bg-surface: #0f0f18;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-input: #07070d;
    --border: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(109, 255, 212, 0.4);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.65);
    --text-muted: rgba(255, 255, 255, 0.3);
    --nav-bg: rgba(10, 10, 15, 0.85);
    --shadow-card: 0 24px 64px rgba(0, 0, 0, 0.6);
    --sidebar-bg: rgba(19, 19, 26, 0.98);
    --orb-opacity: 0.25;
}

[data-theme="light"] {
    --bg-gradient-1: #F4F6F9;
    --bg-gradient-2: #EAEFF5;
    --bg-gradient-3: #E2E8F0;
    --bg-surface: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.75);
    --bg-input: #f1f5f9;
    --border: rgba(15, 23, 42, 0.08);
    --border-focus: #8A2BE2;
    --text-primary: #1E293B;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    --nav-bg: rgba(244, 246, 249, 0.85);
    --shadow-card: 0 24px 64px rgba(15, 23, 42, 0.08);
    --sidebar-bg: rgba(255, 255, 255, 0.98);
    --orb-opacity: 0.18;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    transition: background-color var(--transition-speed) ease, border-color var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', 'DM Sans', sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-1) 0%, var(--bg-gradient-2) 50%, var(--bg-gradient-3) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.bg-orbs {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-orbs span {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: var(--orb-opacity);
    transition: opacity var(--transition-speed) ease;
}

.bg-orbs span:nth-child(1) {
    width: 500px;
    height: 500px;
    background: #8A2BE2;
    top: -10%;
    left: -10%;
}

.bg-orbs span:nth-child(2) {
    width: 400px;
    height: 400px;
    background: #00A3FF;
    top: 40%;
    right: -8%;
}

.bg-orbs span:nth-child(3) {
    width: 300px;
    height: 300px;
    background: #6DFFD4;
    bottom: 10%;
    left: 30%;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 1;
    opacity: 0.5;
}

[data-theme="light"] body::after {
    opacity: 0.15;
}

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 24px;
}

.navbar-inner {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #8A2BE2, #6DFFD4);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px var(--accent-purple-glow);
}

.logo-icon svg {
    width: 20px;
    height: 20px;
    fill: white;
}

.logo-text {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    display: flex;
    align-items: baseline;
}

.logo-text .logo-save {
    color: #8A2BE2;
}

[data-theme="dark"] .logo-text .logo-save {
    color: var(--accent-bright);
}

.logo-text .logo-plus {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.78rem;
    color: #8A2BE2;
    margin-left: 1px;
    position: relative;
    top: -3px;
    opacity: 0.9;
}

[data-theme="dark"] .logo-text .logo-plus {
    color: var(--accent-bright);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link {
    font-family: 'Poppins', sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    border: none;
    background: transparent;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--accent-soft);
}

.nav-link.active {
    color: #8A2BE2;
    background: var(--accent-soft);
    font-weight: 600;
}

[data-theme="dark"] .nav-link.active {
    color: var(--accent-bright);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
}

.hamburger {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

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

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    z-index: 201;
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    height: 64px;
}

.sidebar-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.sidebar-close:hover {
    color: var(--text-primary);
}

.sidebar-nav {
    padding: 16px 12px;
    flex: 1;
}

.sidebar-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0 8px;
    margin-bottom: 8px;
    margin-top: 16px;
}

.sidebar-label:first-child {
    margin-top: 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 2px;
    border: 1px solid transparent;
}

.sidebar-link:hover {
    background: var(--accent-soft);
    color: var(--text-primary);
    border-color: var(--border);
}

.sidebar-link.active {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: rgba(124, 58, 237, 0.1);
    font-weight: 600;
}

.sidebar-link .icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    background: var(--bg-input);
    flex-shrink: 0;
    transition: background 0.2s;
}

.sidebar-link.active .icon {
    background: var(--accent);
    color: white;
}

.sidebar-link .cs-tag {
    margin-left: auto;
    font-size: 0.6rem;
    font-weight: 600;
    background: rgba(138, 43, 226, 0.1);
    color: var(--accent);
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.sidebar-footer p {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.cs-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 500;
    padding: 12px 24px;
    border-radius: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cs-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.cs-toast i {
    color: var(--accent);
}

.page-wrap {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    padding-top: 64px;
}

.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px 40px;
    text-align: center;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid rgba(138, 43, 226, 0.15);
    padding: 6px 16px;
    border-radius: 40px;
    margin-bottom: 24px;
    animation: fadeSlideUp 0.6s ease both;
}

.hero-badge span.dot {
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    animation: pulse 2s ease infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

.hero-title {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: clamp(2.2rem, 6vw, 3.5rem);
    line-height: 1.15;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    max-width: 680px;
    margin-bottom: 20px;
    animation: fadeSlideUp 0.6s 0.1s ease both;
}

.hero-title .gradient-text {
    background: linear-gradient(135deg, #8A2BE2, #00A3FF, #22c55e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-sub {
    font-size: 0.98rem;
    color: var(--text-secondary);
    max-width: 460px;
    line-height: 1.6;
    margin-bottom: 36px;
    font-weight: 400;
    animation: fadeSlideUp 0.6s 0.2s ease both;
}

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.main-card {
    width: 100%;
    max-width: 520px;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 32px;
    box-shadow: var(--shadow-card);
    animation: fadeSlideUp 0.6s 0.3s ease both;
    position: relative;
    overflow: hidden;
}

.main-card::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 20px;
    right: 20px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.4;
}

.platform-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid rgba(138, 43, 226, 0.1);
    padding: 6px 14px;
    border-radius: 8px;
    margin-bottom: 24px;
}

.input-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 6px 6px 6px 16px;
}

.input-bar:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(138, 43, 226, 0.15);
}

.input-bar input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-family: 'Poppins', sans-serif;
    font-size: 0.875rem;
    color: var(--text-primary);
    min-width: 0;
}

.input-bar input::placeholder {
    color: var(--text-muted);
}

.btn-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

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

.btn-get {
    height: 38px;
    padding: 0 18px;
    border-radius: 10px;
    border: none;
    background: var(--accent);
    color: white;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-get:hover {
    transform: translateY(-1px);
    background-color: #7522c0;
}

.btn-get:active {
    transform: translateY(0);
}

.btn-get:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.error-box {
    display: none;
    margin-top: 16px;
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.15);
    color: #dc2626;
    font-size: 0.8rem;
    padding: 12px 16px;
    border-radius: 12px;
    align-items: center;
    gap: 8px;
    text-align: left;
}

[data-theme="dark"] .error-box {
    color: #f87171;
    background: rgba(239, 68, 68, 0.08);
}

.loader {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 0 20px;
    gap: 12px;
}

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

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

.loader p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.result-section {
    display: none;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    animation: fadeSlideUp 0.4s ease both;
}

.thumb-wrap {
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    background: var(--bg-input);
    aspect-ratio: 16/9;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

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

.video-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 20px;
    text-align: left;
    word-break: break-word;
}

.dl-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-dl-primary {
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    border: none;
    background: var(--accent);
    color: white;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-dl-primary:hover {
    transform: translateY(-1px);
    background-color: #7522c0;
}

.btn-dl-secondary {
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-dl-secondary:hover {
    color: var(--text-primary);
    border-color: var(--accent);
}

.tiktok-img-grid {
    display: none;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.tiktok-img-grid.active {
    display: grid;
}

.tiktok-img-item {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-input);
    cursor: pointer;
    position: relative;
}

.tiktok-img-item img {
    width: 100%;
    aspect-ratio: 9/16;
    object-fit: cover;
    display: block;
}

.tiktok-img-item .dl-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.tiktok-img-item:hover .dl-overlay {
    opacity: 1;
}

.tiktok-img-item .dl-overlay i {
    color: white;
    font-size: 1.4rem;
}

.how-section {
    max-width: 520px;
    width: 100%;
    margin: 56px auto 0;
    padding: 0 24px;
    animation: fadeSlideUp 0.6s 0.4s ease both;
}

.section-label {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 24px;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.step-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 20px 14px;
    text-align: center;
    transition: border-color 0.2s, transform 0.2s;
}

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

.step-num {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--accent-soft);
    border: 1px solid rgba(138, 43, 226, 0.2);
    color: var(--accent);
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}

.step-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.step-desc {
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.faq-section {
    max-width: 520px;
    width: 100%;
    margin: 48px auto 0;
    padding: 0 24px;
    animation: fadeSlideUp 0.6s 0.5s ease both;
}

.faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    margin-bottom: 10px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.faq-item:hover {
    border-color: var(--accent);
}

.faq-q {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    gap: 12px;
    text-align: left;
}

.faq-q i {
    color: var(--text-muted);
    font-size: 0.75rem;
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

.faq-item.open .faq-q i {
    transform: rotate(180deg);
}

.faq-a {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-item.open .faq-a {
    max-height: 200px;
}

.faq-a p {
    padding: 0 20px 16px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.6;
    border-top: 1px solid var(--border);
    padding-top: 12px;
    text-align: left;
}

footer {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 56px 24px 32px;
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

footer a:hover {
    text-decoration: underline;
}

@media(max-width:640px) {
    .nav-links {
        display: none;
    }

    .hamburger {
        display: flex;
    }

    .hero {
        padding: 40px 16px 32px;
    }

    .hero-title {
        margin-bottom: 14px;
    }

    .main-card {
        padding: 24px 20px;
        border-radius: 20px;
    }

    .steps-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .btn-get span {
        display: none;
    }

    .btn-get {
        padding: 0 14px;
    }
}