import React, { useState, useEffect, useRef, useMemo } from "react";
import { motion, AnimatePresence } from "framer-motion";
import {
ResponsiveContainer, AreaChart, Area, BarChart, Bar, PieChart, Pie, Cell,
XAxis, YAxis, Tooltip, CartesianGrid
} from "recharts";
/* ============================== STYLES ============================== */
const CSS = `
@import url('https://cdn.jsdelivr.net/fontsource/fonts/inter@latest/latin-400-normal.css');
@import url('https://cdn.jsdelivr.net/fontsource/fonts/inter@latest/latin-500-normal.css');
@import url('https://cdn.jsdelivr.net/fontsource/fonts/inter@latest/latin-600-normal.css');
@import url('https://cdn.jsdelivr.net/fontsource/fonts/inter@latest/latin-700-normal.css');
@import url('https://cdn.jsdelivr.net/fontsource/fonts/space-grotesk@latest/latin-500-normal.css');
@import url('https://cdn.jsdelivr.net/fontsource/fonts/space-grotesk@latest/latin-700-normal.css');
*{box-sizing:border-box;margin:0;padding:0}
html{scroll-behavior:smooth}
body{background:#050816;color:#e6eaf5;font-family:'Inter',system-ui,sans-serif;-webkit-font-smoothing:antialiased;overflow-x:hidden}
.display{font-family:'Space Grotesk','Inter',sans-serif}
::selection{background:rgba(139,92,246,.45)}
::-webkit-scrollbar{width:9px;height:9px}
::-webkit-scrollbar-thumb{background:rgba(255,255,255,.13);border-radius:99px}
::-webkit-scrollbar-track{background:transparent}
a{color:inherit;text-decoration:none}
button{font-family:inherit;cursor:pointer;border:none;background:none;color:inherit}
input,select,textarea{font-family:inherit;color:inherit}
:focus-visible{outline:2px solid #38bdf8;outline-offset:2px;border-radius:8px}
img{user-select:none}
.wrap{max-width:1180px;margin:0 auto;padding:0 24px}
.muted{color:#9aa3c2}.small{font-size:12.5px}
.grad-text{background:linear-gradient(90deg,#38bdf8,#8b5cf6,#d946ef,#38bdf8);background-size:250% 100%;-webkit-background-clip:text;background-clip:text;color:transparent;animation:gradMove 7s linear infinite}
@keyframes gradMove{0%{background-position:0% 50%}100%{background-position:250% 50%}}
.glass{background:rgba(255,255,255,.035);border:1px solid rgba(255,255,255,.09);backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px);border-radius:22px}
.cardPad{padding:24px}
.btn{position:relative;overflow:hidden;display:inline-flex;align-items:center;justify-content:center;gap:9px;border-radius:16px;font-weight:600;font-size:15px;padding:13px 26px;transition:transform .25s cubic-bezier(.2,.7,.3,1.3),box-shadow .25s,background .25s,border-color .25s;white-space:nowrap}
.btn:active{transform:scale(.97)}
.btn-primary{background:linear-gradient(135deg,#38bdf8,#6366f1 50%,#a855f7);color:#fff;box-shadow:0 10px 34px -8px rgba(99,102,241,.65),inset 0 1px 0 rgba(255,255,255,.25)}
.btn-primary:hover{transform:translateY(-2px);box-shadow:0 16px 46px -8px rgba(124,92,246,.8)}
.btn-ghost{background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.14);color:#e6eaf5;backdrop-filter:blur(10px)}
.btn-ghost:hover{background:rgba(255,255,255,.1);border-color:rgba(255,255,255,.28);transform:translateY(-2px)}
.btn-danger{background:rgba(244,63,94,.1);border:1px solid rgba(244,63,94,.4);color:#fb7185}
.btn-danger:hover{background:rgba(244,63,94,.22)}
.btn-sm{padding:9px 16px;font-size:13.5px;border-radius:12px}
.btn-lg{padding:17px 34px;font-size:16.5px;border-radius:18px}
.btn-block{width:100%}
.iconBtn{width:38px;height:38px;border-radius:12px;display:inline-flex;align-items:center;justify-content:center;background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.09);transition:.2s;flex:none}
.iconBtn:hover{background:rgba(255,255,255,.12);transform:translateY(-1px)}
.ripple{position:absolute;border-radius:50%;background:rgba(255,255,255,.35);transform:scale(0);animation:rip .65s ease-out;pointer-events:none}
@keyframes rip{to{transform:scale(2.6);opacity:0}}
.field{display:flex;flex-direction:column;gap:7px;margin-bottom:16px}
.label{font-size:13px;font-weight:600;color:#aab2cf;letter-spacing:.02em}
.input,.textarea,select.input{width:100%;background:rgba(255,255,255,.045);border:1px solid rgba(255,255,255,.1);border-radius:14px;padding:13px 15px;font-size:14.5px;color:#eef1fb;transition:.2s;outline:none}
.input:focus,.textarea:focus{border-color:rgba(110,130,246,.7);box-shadow:0 0 0 3px rgba(99,120,246,.18);background:rgba(255,255,255,.06)}
.textarea{resize:vertical;min-height:130px;line-height:1.65}
.selectWrap{position:relative;display:block}
.selectWrap select{appearance:none;-webkit-appearance:none;padding-right:40px;cursor:pointer}
.selectWrap select option{background:#0a0f24;color:#e6eaf5}
.selectWrap>svg{position:absolute;right:14px;top:50%;transform:translateY(-50%);pointer-events:none;color:#8b93b0}
.switch{position:relative;width:46px;height:26px;flex:none}
.switch input{opacity:0;width:100%;height:100%;position:absolute;margin:0;cursor:pointer;z-index:2}
.switch .track{position:absolute;inset:0;border-radius:99px;background:rgba(255,255,255,.12);border:1px solid rgba(255,255,255,.12);transition:.25s}
.switch .thumb{position:absolute;top:3px;left:3px;width:20px;height:20px;border-radius:50%;background:#fff;transition:.25s;box-shadow:0 2px 6px rgba(0,0,0,.4)}
.switch input:checked~.track{background:linear-gradient(135deg,#38bdf8,#8b5cf6);border-color:transparent}
.switch input:checked~.thumb{left:23px}
input[type=range].range{-webkit-appearance:none;appearance:none;width:100%;height:6px;border-radius:99px;background:linear-gradient(90deg,#38bdf8,#8b5cf6) 0/var(--fill,50%) 100% no-repeat,rgba(255,255,255,.1);outline:none;cursor:pointer}
input[type=range].range::-webkit-slider-thumb{-webkit-appearance:none;width:18px;height:18px;border-radius:50%;background:#fff;box-shadow:0 0 0 4px rgba(99,102,246,.35),0 2px 8px rgba(0,0,0,.5);transition:.15s;cursor:grab}
.chip{padding:8px 15px;border-radius:99px;font-size:13px;font-weight:600;background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.11);color:#aab2cf;transition:.2s;cursor:pointer;display:inline-flex;align-items:center;gap:7px}
.chip:hover{border-color:rgba(255,255,255,.3);color:#fff}
.chip.on{background:linear-gradient(135deg,rgba(56,189,248,.2),rgba(168,85,247,.22));border-color:rgba(139,120,246,.6);color:#fff}
.tRow{display:flex;justify-content:space-between;align-items:center;gap:14px;padding:14px 0;border-bottom:1px solid rgba(255,255,255,.06)}
.tLab{font-size:14.5px;font-weight:600}
.tSub{font-size:12.5px;color:#78829f;margin-top:2px}
.meter{height:8px;border-radius:99px;background:rgba(255,255,255,.08);overflow:hidden}
.meterFill{height:100%;border-radius:99px;background:linear-gradient(90deg,#38bdf8,#8b5cf6)}
.nav{position:fixed;top:0;left:0;right:0;z-index:60;transition:.3s;padding:18px 0}
.nav.scrolled{background:rgba(5,8,22,.75);backdrop-filter:blur(20px);border-bottom:1px solid rgba(255,255,255,.07);padding:12px 0}
.navInner{display:flex;align-items:center;justify-content:space-between;gap:20px}
.navLinks{display:flex;gap:28px;align-items:center}
.navLinks a{font-size:14.5px;color:#aab2cf;font-weight:500;transition:.2s}
.navLinks a:hover{color:#fff}
.hero{position:relative;min-height:100vh;display:flex;align-items:center;padding:150px 0 100px;overflow:hidden}
.blob{position:absolute;border-radius:50%;filter:blur(90px);opacity:.5;animation:drift 14s ease-in-out infinite}
.b1{width:560px;height:560px;background:radial-gradient(circle,#2043c7,transparent 65%);top:-140px;left:-120px}
.b2{width:520px;height:520px;background:radial-gradient(circle,#7c3aed,transparent 65%);top:8%;right:-140px;animation-delay:-5s}
.b3{width:480px;height:480px;background:radial-gradient(circle,#0891b2,transparent 60%);bottom:-160px;left:30%;animation-delay:-9s}
@keyframes drift{0%,100%{transform:translate(0,0) scale(1)}50%{transform:translate(34px,-24px) scale(1.08)}}
.beam{position:absolute;width:2px;height:70vh;background:linear-gradient(to bottom,transparent,rgba(120,160,255,.55),transparent);top:-5%;filter:blur(1px);animation:beamSweep 8s ease-in-out infinite}
@keyframes beamSweep{0%,100%{opacity:0;transform:translateX(-34px) rotate(8deg)}50%{opacity:.75;transform:translateX(34px) rotate(8deg)}}
.particle{position:absolute;border-radius:50%;background:rgba(160,190,255,.85);animation:floatY var(--dur,6s) ease-in-out infinite;box-shadow:0 0 8px rgba(150,180,255,.8)}
@keyframes floatY{0%,100%{transform:translateY(0)}50%{transform:translateY(-16px)}}
.heroGrid{display:grid;grid-template-columns:1.05fr .95fr;gap:60px;align-items:center;position:relative}
.heroBadge{display:inline-flex;align-items:center;gap:9px;font-size:13px;font-weight:600;color:#c4b5fd;background:rgba(139,92,246,.1);border:1px solid rgba(139,92,246,.35);padding:8px 16px;border-radius:99px}
.pulseDot{width:8px;height:8px;border-radius:50%;background:#34d399;box-shadow:0 0 0 0 rgba(52,211,153,.6);animation:ping 1.8s infinite}
@keyframes ping{70%{box-shadow:0 0 0 9px rgba(52,211,153,0)}100%{box-shadow:0 0 0 0 rgba(52,211,153,0)}}
.h1{font-size:clamp(38px,5vw,62px);line-height:1.06;letter-spacing:-.02em;font-weight:700;margin:22px 0}
.sub{font-size:18px;color:#9aa3c2;line-height:1.7;max-width:560px}
.ctaRow{display:flex;gap:16px;margin-top:36px;flex-wrap:wrap}
.heroStats{display:flex;gap:38px;margin-top:44px;flex-wrap:wrap}
.hStat b{font-size:22px;font-weight:700}
.hStat span{display:block;font-size:12.5px;color:#78829f;margin-top:3px}
.mockWrap{position:relative;perspective:1200px}
.mock{border-radius:24px;padding:18px;transform:rotateY(-8deg) rotateX(4deg);transition:transform .6s;box-shadow:0 40px 90px -20px rgba(70,90,255,.35)}
.mockWrap:hover .mock{transform:rotateY(-3deg) rotateX(1deg)}
.mockBar{display:flex;gap:6px;margin-bottom:14px}
.mockBar i{width:10px;height:10px;border-radius:50%;display:block}
.mockPrompt{display:flex;align-items:center;gap:10px;padding:12px 14px;border-radius:14px;margin-bottom:14px;font-size:12.5px;color:#c3c9e2}
.mockPreview{position:relative;border-radius:16px;overflow:hidden;aspect-ratio:16/9}
.mockPreview img{width:100%;height:100%;object-fit:cover;display:block}
.playOrb{position:absolute;inset:0;margin:auto;width:64px;height:64px;border-radius:50%;background:rgba(255,255,255,.16);backdrop-filter:blur(8px);border:1px solid rgba(255,255,255,.35);display:flex;align-items:center;justify-content:center;animation:ringPulse 2.4s infinite;color:#fff;cursor:pointer}
@keyframes ringPulse{0%{box-shadow:0 0 0 0 rgba(139,92,246,.5)}100%{box-shadow:0 0 0 26px rgba(139,92,246,0)}}
.floatCard{position:absolute;display:flex;gap:10px;align-items:center;padding:12px 16px;border-radius:16px;font-size:13px;font-weight:600;animation:floatY 6s ease-in-out infinite;box-shadow:0 20px 50px -12px rgba(0,0,0,.6);z-index:3}
.fc1{top:-24px;right:-14px}.fc2{bottom:40px;left:-40px;animation-delay:-2s}.fc3{bottom:-26px;right:12%;animation-delay:-4s}
.marquee{overflow:hidden;mask-image:linear-gradient(90deg,transparent,#000 12%,#000 88%,transparent)}
.mTrack{display:flex;gap:70px;width:max-content;animation:marqueeX 30s linear infinite;padding:6px 0}
@keyframes marqueeX{to{transform:translateX(-50%)}}
.logoItem{display:flex;align-items:center;gap:9px;color:#67719a;font-weight:700;font-size:17px;letter-spacing:.02em;white-space:nowrap}
.section{padding:110px 0;position:relative}
.kicker{display:inline-flex;align-items:center;gap:8px;font-size:12.5px;font-weight:700;letter-spacing:.14em;text-transform:uppercase;color:#7dd3fc;background:rgba(56,189,248,.08);border:1px solid rgba(56,189,248,.25);padding:7px 15px;border-radius:99px;margin-bottom:18px}
.h2{font-size:clamp(28px,3.6vw,42px);letter-spacing:-.02em;line-height:1.15;font-weight:700}
.sectionSub{color:#9aa3c2;font-size:16.5px;max-width:640px;margin:14px auto 0;line-height:1.7}
.grid2{display:grid;grid-template-columns:repeat(2,1fr);gap:22px}
.grid3{display:grid;grid-template-columns:repeat(3,1fr);gap:22px}
.grid4{display:grid;grid-template-columns:repeat(4,1fr);gap:20px}
.stylesGrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(215px,1fr));gap:20px}
.featureCard{padding:26px;transition:transform .35s,border-color .35s,box-shadow .35s;position:relative;overflow:hidden}
.featureCard:hover{transform:translateY(-6px);border-color:rgba(139,92,246,.45);box-shadow:0 24px 60px -18px rgba(99,102,241,.4)}
.fIcon{width:48px;height:48px;border-radius:14px;display:flex;align-items:center;justify-content:center;background:linear-gradient(135deg,rgba(56,189,248,.16),rgba(168,85,247,.16));border:1px solid rgba(139,92,246,.3);color:#a5b4fc;margin-bottom:16px}
.styleCard{overflow:hidden;padding:0;cursor:pointer;position:relative}
.styleCard img{width:100%;aspect-ratio:16/10;object-fit:cover;display:block;transition:transform .6s}
.styleCard:hover img{transform:scale(1.07)}
.styleInfo{padding:15px 17px;display:flex;justify-content:space-between;align-items:center;gap:10px}
.stepCard{padding:28px;text-align:center;position:relative}
.stepNum{width:44px;height:44px;border-radius:14px;display:flex;align-items:center;justify-content:center;margin:0 auto 16px;background:linear-gradient(135deg,#38bdf8,#a855f7);font-weight:700;font-size:17px;color:#fff;box-shadow:0 10px 26px -8px rgba(124,58,237,.7)}
.priceCard{padding:32px;display:flex;flex-direction:column;position:relative}
.priceCard.premium{border:1px solid rgba(139,92,246,.55);box-shadow:0 30px 80px -20px rgba(124,58,237,.5);background:linear-gradient(180deg,rgba(99,102,241,.13),rgba(255,255,255,.03))}
.popBadge{position:absolute;top:-14px;left:50%;transform:translateX(-50%);background:linear-gradient(135deg,#38bdf8,#a855f7);font-size:12px;font-weight:700;padding:6px 16px;border-radius:99px;letter-spacing:.06em;color:#fff}
.priceRow{display:flex;align-items:baseline;gap:6px;margin:16px 0 4px}
.priceRow b{font-size:44px;font-weight:700;letter-spacing:-.02em}
.checkList{list-style:none;display:flex;flex-direction:column;gap:11px;margin:22px 0;flex:1}
.checkList li{display:flex;gap:10px;align-items:flex-start;font-size:14.5px;color:#c3c9e2}
.checkList svg{color:#34d399;flex:none;margin-top:2px}
.testCard{padding:26px}
.avatarG{display:flex;align-items:center;justify-content:center;border-radius:50%;font-weight:700;color:#fff;flex:none}
.faqItem{border:1px solid rgba(255,255,255,.09);border-radius:18px;margin-bottom:12px;overflow:hidden;background:rgba(255,255,255,.028)}
.faqQ{width:100%;display:flex;justify-content:space-between;align-items:center;gap:16px;padding:20px 24px;font-size:16px;font-weight:600;text-align:left;color:#e6eaf5}
.faqA{padding:0 24px 20px;color:#9aa3c2;font-size:14.8px;line-height:1.75}
.footer{border-top:1px solid rgba(255,255,255,.07);padding:70px 0 34px;background:rgba(255,255,255,.012)}
.fGrid{display:grid;grid-template-columns:2fr 1fr 1fr 1fr 1fr;gap:34px}
.fCol h4{font-size:13px;letter-spacing:.1em;text-transform:uppercase;color:#78829f;margin-bottom:16px}
.fCol a{display:block;color:#aab2cf;font-size:14px;margin-bottom:11px;transition:.2s;cursor:pointer}
.fCol a:hover{color:#7dd3fc}
.authPage{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:60px 20px;position:relative;overflow:hidden}
.authCard{width:100%;max-width:450px;padding:38px;position:relative;z-index:2}
.orDiv{display:flex;align-items:center;gap:14px;margin:20px 0;color:#67719a;font-size:12.5px}
.orDiv:before,.orDiv:after{content:'';height:1px;flex:1;background:rgba(255,255,255,.1)}
.socialBtn{display:flex;align-items:center;justify-content:center;gap:10px;width:100%;padding:12px;border-radius:14px;background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.12);font-weight:600;font-size:14px;transition:.2s}
.socialBtn:hover{background:rgba(255,255,255,.1);transform:translateY(-1px)}
.otpRow{display:flex;gap:10px;justify-content:center;margin:22px 0}
.otpRow input{width:48px;height:56px;text-align:center;font-size:22px;font-weight:700;border-radius:14px;background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.14);outline:none;color:#fff}
.otpRow input:focus{border-color:#8b5cf6;box-shadow:0 0 0 3px rgba(139,92,246,.2)}
.shell{display:flex;min-height:100vh;background:radial-gradient(1100px 600px at 85% -10%,rgba(76,29,149,.28),transparent),#050816}
.sidebar{width:264px;flex:none;position:fixed;top:0;bottom:0;left:0;z-index:50;display:flex;flex-direction:column;background:rgba(8,12,30,.88);backdrop-filter:blur(22px);border-right:1px solid rgba(255,255,255,.07);padding:22px 16px;transition:transform .35s;overflow-y:auto}
.sideSec{font-size:11px;letter-spacing:.14em;text-transform:uppercase;color:#5d6787;font-weight:700;margin:18px 12px 8px}
.sideLink{display:flex;align-items:center;gap:12px;width:100%;padding:11px 13px;border-radius:13px;color:#9aa3c2;font-size:14.2px;font-weight:500;transition:.2s;margin-bottom:2px;text-align:left}
.sideLink:hover{background:rgba(255,255,255,.05);color:#fff}
.sideLink.active{background:linear-gradient(135deg,rgba(56,189,248,.16),rgba(139,92,246,.18));color:#fff;border:1px solid rgba(124,140,246,.35);box-shadow:0 6px 20px -6px rgba(99,102,241,.4)}
.sideLink.active svg{color:#7dd3fc}
.sideDim{position:fixed;inset:0;background:rgba(0,0,0,.5);z-index:45;opacity:0;pointer-events:none;transition:.3s}
.sideDim.show{opacity:1;pointer-events:auto}
.main{flex:1;margin-left:264px;min-width:0}
.topbar{position:sticky;top:0;z-index:40;display:flex;align-items:center;gap:16px;padding:16px 30px;background:rgba(5,8,22,.66);backdrop-filter:blur(18px);border-bottom:1px solid rgba(255,255,255,.06)}
.content{padding:30px;max-width:1340px}
.searchBox{display:flex;align-items:center;gap:10px;background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.09);border-radius:13px;padding:10px 15px;flex:1;max-width:380px;color:#8b93b0}
.searchBox input{background:none;border:none;outline:none;width:100%;font-size:14px;color:#e6eaf5}
.statCard{padding:22px;display:flex;flex-direction:column;gap:6px}
.statIcon{width:42px;height:42px;border-radius:12px;display:flex;align-items:center;justify-content:center;margin-bottom:8px}
.badge{display:inline-flex;align-items:center;gap:6px;font-size:12px;font-weight:600;padding:4px 11px;border-radius:99px;border:1px solid}
.pill-free{color:#94a3b8;background:rgba(148,163,184,.08);border-color:rgba(148,163,184,.25)}
.pill-pro{color:#c4b5fd;background:rgba(139,92,246,.12);border-color:rgba(139,92,246,.4)}
.pill-green{color:#6ee7b7;background:rgba(16,185,129,.1);border-color:rgba(16,185,129,.3)}
.pill-red{color:#fda4af;background:rgba(244,63,94,.1);border-color:rgba(244,63,94,.3)}
.pill-blue{color:#7dd3fc;background:rgba(56,189,248,.1);border-color:rgba(56,189,248,.3)}
.table{width:100%;border-collapse:collapse;font-size:14px}
.table th{text-align:left;padding:12px 14px;color:#78829f;font-size:12px;letter-spacing:.08em;text-transform:uppercase;border-bottom:1px solid rgba(255,255,255,.08)}
.table td{padding:13px 14px;border-bottom:1px solid rgba(255,255,255,.05);color:#c3c9e2}
.table tr:hover td{background:rgba(255,255,255,.02)}
.videoCard{overflow:hidden;padding:0;position:relative}
.thumb{position:relative;aspect-ratio:16/9;overflow:hidden;background:linear-gradient(90deg,rgba(255,255,255,.04) 25%,rgba(255,255,255,.1) 50%,rgba(255,255,255,.04) 75%);background-size:200% 100%;animation:shimmer 1.6s infinite}
@keyframes shimmer{to{background-position:-200% 0}}
.thumb img{width:100%;height:100%;object-fit:cover;display:block;transition:transform .5s}
.videoCard:hover .thumb img{transform:scale(1.05)}
.thumbOverlay{position:absolute;inset:0;background:linear-gradient(to top,rgba(5,8,22,.7),transparent 60%);display:flex;align-items:center;justify-content:center;opacity:0;transition:.3s}
.videoCard:hover .thumbOverlay{opacity:1}
.vMeta{padding:14px 16px}
.vTag{position:absolute;top:10px;left:10px}
.vDur{position:absolute;bottom:10px;right:10px;background:rgba(0,0,0,.62);padding:3px 9px;border-radius:7px;font-size:11.5px;font-weight:600;backdrop-filter:blur(4px)}
.playerBox{position:relative;border-radius:22px;overflow:hidden;background:#000;border:1px solid rgba(255,255,255,.1);box-shadow:0 40px 90px -30px rgba(76,29,149,.55)}
.playerBox img{width:100%;aspect-ratio:16/9;object-fit:cover;display:block}
.kb img{animation:kenburns 12s ease-in-out infinite alternate}
@keyframes kenburns{from{transform:scale(1)}to{transform:scale(1.14) translate(1.5%,-1.5%)}}
.playerBar{position:absolute;left:0;right:0;bottom:0;padding:40px 18px 14px;background:linear-gradient(to top,rgba(0,0,0,.88),transparent);display:flex;flex-direction:column;gap:10px}
.timeline{height:5px;border-radius:99px;background:rgba(255,255,255,.22);cursor:pointer;position:relative}
.timelineFill{height:100%;border-radius:99px;background:linear-gradient(90deg,#38bdf8,#a855f7);position:relative}
.timelineFill:after{content:'';position:absolute;right:-6px;top:50%;transform:translateY(-50%);width:13px;height:13px;border-radius:50%;background:#fff;box-shadow:0 0 10px rgba(139,92,246,.9)}
.renderPanel{padding:46px 30px;text-align:center}
.renderOrb{width:130px;height:130px;margin:0 auto 26px;border-radius:50%;position:relative;display:flex;align-items:center;justify-content:center}
.renderOrb:before{content:'';position:absolute;inset:0;border-radius:50%;background:conic-gradient(from 0deg,#38bdf8,#8b5cf6,#d946ef,#38bdf8);animation:spin 2.6s linear infinite}
.renderOrb:after{content:'';position:absolute;inset:7px;border-radius:50%;background:#0a0f24}
.renderOrb>div{position:relative;z-index:2}
@keyframes spin{to{transform:rotate(360deg)}}
.progOuter{height:10px;border-radius:99px;background:rgba(255,255,255,.08);overflow:hidden;margin:20px 0 8px}
.progFill{height:100%;border-radius:99px;background:linear-gradient(90deg,#38bdf8,#8b5cf6,#d946ef);background-size:200% 100%;animation:gradMove 2s linear infinite;transition:width .2s}
.stepsList{display:flex;flex-direction:column;gap:10px;max-width:400px;margin:26px auto 0;text-align:left}
.stepItem{display:flex;gap:11px;align-items:center;font-size:14px;color:#67719a;transition:.3s}
.stepItem.done{color:#c3c9e2}
.stepItem.now{color:#fff}
.stepDot{width:22px;height:22px;border-radius:50%;flex:none;display:flex;align-items:center;justify-content:center;border:1.5px solid rgba(255,255,255,.2);font-size:11px}
.stepItem.done .stepDot{background:linear-gradient(135deg,#38bdf8,#8b5cf6);border-color:transparent;color:#fff}
.stepItem.now .stepDot{border-color:#8b5cf6;color:#8b5cf6;animation:pulseDot 1.4s infinite}
@keyframes pulseDot{50%{box-shadow:0 0 0 6px rgba(139,92,246,.15)}}
.successCheck{width:110px;height:110px;border-radius:50%;margin:0 auto 22px;display:flex;align-items:center;justify-content:center;background:linear-gradient(135deg,rgba(52,211,153,.16),rgba(16,185,129,.05));border:1px solid rgba(52,211,153,.5);color:#34d399;animation:ringPulseG 1.8s infinite}
@keyframes ringPulseG{0%{box-shadow:0 0 0 0 rgba(52,211,153,.4)}100%{box-shadow:0 0 0 28px rgba(52,211,153,0)}}
.dropzone{border:2px dashed rgba(139,120,246,.4);border-radius:20px;padding:46px 24px;text-align:center;transition:.25s;cursor:pointer;background:rgba(139,92,246,.04)}
.dropzone.over{border-color:#38bdf8;background:rgba(56,189,248,.08);transform:scale(1.01)}
.toastWrap{position:fixed;bottom:24px;right:24px;z-index:300;display:flex;flex-direction:column;gap:10px}
.toastItem{display:flex;gap:11px;align-items:center;padding:14px 18px;border-radius:15px;background:rgba(12,17,40,.92);border:1px solid rgba(255,255,255,.12);backdrop-filter:blur(16px);font-size:14px;font-weight:500;box-shadow:0 16px 40px -10px rgba(0,0,0,.6);min-width:260px}
.modalBack{position:fixed;inset:0;background:rgba(3,5,14,.72);backdrop-filter:blur(8px);z-index:120;display:flex;align-items:center;justify-content:center;padding:20px}
.modalCard{width:100%;max-width:480px;padding:30px;position:relative;max-height:88vh;overflow:auto}
.pager{display:flex;gap:8px;justify-content:center;margin-top:26px}
.pager button{min-width:38px;height:38px;border-radius:11px;display:flex;align-items:center;justify-content:center;background:rgba(255,255,255,.04);border:1px solid rgba(255,255,255,.1);font-size:14px;font-weight:600;color:#aab2cf;transition:.2s;padding:0 8px}
.pager button.on{background:linear-gradient(135deg,#38bdf8,#8b5cf6);color:#fff;border-color:transparent}
.pager button:hover:not(:disabled):not(.on){background:rgba(255,255,255,.1)}
.pager button:disabled{opacity:.35;cursor:default}
.notif{position:absolute;right:0;top:48px;width:330px;border-radius:18px;padding:8px;z-index:60}
.notifItem{display:flex;gap:12px;padding:13px 14px;border-radius:13px;transition:.2s;cursor:pointer}
.notifItem:hover{background:rgba(255,255,255,.05)}
@media(max-width:1080px){.heroGrid{grid-template-columns:1fr;gap:70px}.grid4{grid-template-columns:repeat(2,1fr)}.grid3{grid-template-columns:repeat(2,1fr)}.fGrid{grid-template-columns:1fr 1fr}.sidebar{transform:translateX(-100%)}.sidebar.open{transform:none}.main{margin-left:0}.hide-md{display:none!important}}
@media(max-width:640px){.grid2,.grid3,.grid4{grid-template-columns:1fr}.content{padding:18px}.topbar{padding:12px 16px}.hide-sm{display:none!important}.navLinks{display:none}.fGrid{grid-template-columns:1fr}.floatCard{display:none}.h1{font-size:38px}}
`;
/* ============================== IMAGES ============================== */
const IMG = {
realistic: "https://image.qwenlm.ai/public_source/ac5c8b22-c6cf-487f-8cfa-a6d86f1904f6/12052c633-a9b9-476d-8e8b-e56ed698ec67.png",
cinematic: "https://image.qwenlm.ai/public_source/ac5c8b22-c6cf-487f-8cfa-a6d86f1904f6/1ad6064b3-5b0b-4cc8-be7b-d7a9f44441cc.png",
anime: "https://image.qwenlm.ai/public_source/ac5c8b22-c6cf-487f-8cfa-a6d86f1904f6/1f08a129a-f4fd-4100-ba29-5ba037538d02.png",
cartoon: "https://image.qwenlm.ai/public_source/ac5c8b22-c6cf-487f-8cfa-a6d86f1904f6/10a337546-9ff5-4477-9c17-a5b9007c960e.png",
pixar: "https://image.qwenlm.ai/public_source/ac5c8b22-c6cf-487f-8cfa-a6d86f1904f6/184179596-b50f-4f1c-9149-82eca803a3f3.png",
ghibli: "https://image.qwenlm.ai/public_source/ac5c8b22-c6cf-487f-8cfa-a6d86f1904f6/144a1866a-770b-4418-a906-32677fea0561.png",
anim3d: "https://image.qwenlm.ai/public_source/ac5c8b22-c6cf-487f-8cfa-a6d86f1904f6/13a624027-cdee-4c33-93ff-e54de110be8e.png",
cyberpunk: "https://image.qwenlm.ai/public_source/ac5c8b22-c6cf-487f-8cfa-a6d86f1904f6/11e4f9802-8fd9-4697-89b2-2073ad5af9de.png",
fantasy: "https://image.qwenlm.ai/public_source/ac5c8b22-c6cf-487f-8cfa-a6d86f1904f6/1b3846830-6024-4586-a34f-86328cb8ccf2.png",
photoreal: "https://image.qwenlm.ai/public_source/ac5c8b22-c6cf-487f-8cfa-a6d86f1904f6/116f4576e-59ae-4f69-aa83-ebde7bfa602c.png"
};
/* ============================== HELPERS ============================== */
const uid = () => Math.random().toString(36).slice(2, 10);
const fmt = (s) => `${Math.floor(s / 60)}:${String(Math.floor(s % 60)).padStart(2, "0")}`;
const ripple = (e) => {
const el = e.currentTarget; const d = Math.max(el.clientWidth, el.clientHeight); const r = el.getBoundingClientRect();
const sp = document.createElement("span"); sp.className = "ripple";
sp.style.width = sp.style.height = d + "px";
sp.style.left = e.clientX - r.left - d / 2 + "px"; sp.style.top = e.clientY - r.top - d / 2 + "px";
el.appendChild(sp); setTimeout(() => sp.remove(), 700);
};
/* ============================== ICONS ============================== */
const FICONS = {
play: ,
pause: ,
star: ,
google: ,
github: ,
xlogo: ,
youtube: <> >
};
const ICONS = {
sparkles: <> >,
film: <> >,
image: <> >,
mic: <> >,
subs: <> >,
music: <> >,
layers: <> >,
clock: <> >,
cloud: ,
zap: ,
shield: <> >,
download: <> >,
share: <> >,
wand: <> >,
sliders: <> >,
user: <> >,
users: <> >,
grid: <> >,
logout: <> >,
chevD: ,
chevR: ,
chevL: ,
arrowR: <> >,
search: <> >,
bell: <> >,
x: ,
check: ,
plus: ,
trash: <> >,
copy: <> >,
pencil: ,
refresh: <> >,
upload: <> >,
camera: <> >,
globe: <> >,
card: <> >,
key: <> >,
chart: ,
pie: <> >,
server: <> >,
flag: ,
eye: <> >,
menu: ,
lock: <> >,
mail: <> >,
trend: <> >,
instagram: <> >,
alert: <> >,
info: <> >
};
function Icon({ name, size = 18, sw = 1.8, className = "" }) {
const f = FICONS[name];
if (f) return {f} ;
return {ICONS[name] || null} ;
}
function Logo({ size = 34, withText = true }) {
return (
{withText && Text2Motion }
);
}
/* ============================== DATA ============================== */
const STYLES = [
{ id: "realistic", name: "Realistic", img: IMG.realistic, desc: "True-to-life physics & light" },
{ id: "cinematic", name: "Cinematic", img: IMG.cinematic, desc: "Film-grade anamorphic look" },
{ id: "anime", name: "Anime", img: IMG.anime, desc: "Hand-drawn Japanese style" },
{ id: "cartoon", name: "Cartoon", img: IMG.cartoon, desc: "Bold playful 2D toons" },
{ id: "pixar", name: "Pixar", img: IMG.pixar, desc: "Heart-warming 3D characters" },
{ id: "ghibli", name: "Studio Ghibli", img: IMG.ghibli, desc: "Painterly pastoral warmth" },
{ id: "anim3d", name: "3D Animation", img: IMG.anim3d, desc: "Stylized renders & worlds" },
{ id: "cyberpunk", name: "Cyberpunk", img: IMG.cyberpunk, desc: "Neon-soaked future noir" },
{ id: "fantasy", name: "Fantasy", img: IMG.fantasy, desc: "Epic magical matte painting" },
{ id: "photoreal", name: "Photorealistic", img: IMG.photoreal, desc: "Indistinguishable from camera" }
];
const FEATURES = [
{ i: "film", t: "AI Text to Video", d: "Turn any prompt into a cinematic video with coherent motion and storytelling." },
{ i: "image", t: "Image to Video", d: "Bring still images to life with natural motion, depth and parallax." },
{ i: "mic", t: "AI Voice Generation", d: "12 studio-grade neural voices across 9 languages, synced to your scenes." },
{ i: "subs", t: "Automatic Subtitles", d: "Frame-accurate captions in every language, styled to match your brand." },
{ i: "music", t: "Background Music", d: "Royalty-free adaptive soundtracks scored to the emotion of each scene." },
{ i: "layers", t: "Multiple AI Styles", d: "10 curated visual engines from photoreal to Ghibli — one click to switch." },
{ i: "clock", t: "Video History", d: "Every render saved automatically with full prompt lineage and versions." },
{ i: "cloud", t: "Cloud Storage", d: "Unlimited encrypted cloud library, synced across all your devices." },
{ i: "zap", t: "Fast Rendering", d: "Priority GPU queue renders a 60s clip in under two minutes." },
{ i: "shield", t: "Commercial License", d: "Full ownership of every frame. Use in ads, films and client work." },
{ i: "download", t: "1080p HD Export", d: "Crisp MP4 exports up to 60fps with clean, watermark-free output." },
{ i: "share", t: "Social Media Export", d: "One-click presets for YouTube, TikTok, Instagram, Facebook and X." }
];
const HOW = [
{ i: "pencil", t: "Write your prompt", d: "Describe your scene in plain language — mood, camera, lighting included." },
{ i: "layers", t: "Choose style", d: "Pick from 10 AI visual engines and fine-tune every generation parameter." },
{ i: "sparkles", t: "Generate AI Video", d: "Our diffusion engine renders cinematic frames with voice, music & captions." },
{ i: "share", t: "Download & Share", d: "Export 1080p MP4 and publish everywhere with one-click social presets." }
];
const TESTIMONIALS = [
{ n: "Maya Chen", r: "Film Director, Lumen Studio", g: "linear-gradient(135deg,#38bdf8,#6366f1)", q: "Text2Motion replaced our three-week pre-visualization pipeline. I storyboard, generate and pitch to clients in a single afternoon. The cinematic engine is scary good." },
{ n: "Derek Okafor", r: "Content Creator · 1.2M subs", g: "linear-gradient(135deg,#a855f7,#d946ef)", q: "I went from 2 videos a week to 2 videos a day. The AI voices and auto-subtitles alone save me six hours per upload. My channel grew 4x in four months." },
{ n: "Sofia Marin", r: "Creative Director, Pixelray", g: "linear-gradient(135deg,#f59e0b,#ef4444)", q: "We shipped an entire animated brand campaign in the Ghibli style without touching a render farm. Clients thought we hired a studio in Tokyo." },
{ n: "James Park", r: "Founder, Orbit Labs", g: "linear-gradient(135deg,#10b981,#0ea5e9)", q: "The API-first workflow and consistent characters make this the only AI video tool we trust in production. Fast rendering is not a marketing line — it's real." },
{ n: "Amara Diallo", r: "Marketing Lead, Novabyte", g: "linear-gradient(135deg,#8b5cf6,#38bdf8)", q: "Our ad CTR doubled after switching to Text2Motion creatives. Social export presets mean zero time wasted on reformatting for each platform." },
{ n: "Lucas Weber", r: "Indie Game Developer", g: "linear-gradient(135deg,#ef4444,#a855f7)", q: "I made my game's entire cinematic trailer from text prompts on the Free plan, then upgraded the same night. Best $29 I spend each month, period." }
];
const FAQS = [
{ q: "How long does it take to generate a video?", a: "A 30-second clip typically renders in 60–120 seconds on the priority queue. Premium members get up to 2.4x faster rendering with dedicated H100 GPU pools, while Free plan renders run on the standard queue." },
{ q: "Can I use my videos commercially?", a: "Yes. Premium includes a full commercial license — you own every frame and can use videos in ads, client work, films, games and social media. Free plan videos are for personal use and carry a small watermark." },
{ q: "What video lengths and resolutions are supported?", a: "You can generate 30s, 45s or 60s videos in 16:9, 9:16, 1:1, 4:3 and 21:9 aspect ratios. Free exports at 720p; Premium exports crisp 1080p Full HD at up to 60fps." },
{ q: "Can I animate my own images?", a: "Absolutely. The Image-to-Video mode lets you upload any image and animate it with adjustable motion intensity and animation strength — perfect for product shots, portraits and artwork." },
{ q: "Which languages do the AI voices support?", a: "Our neural voice engine supports English, Spanish, French, German, Hindi, Japanese, Korean, Arabic and Portuguese with 12 distinct voice personalities, plus automatic lip-sync and subtitles." },
{ q: "Is there an API for developers?", a: "Yes — Premium includes REST API access with API keys generated from Settings. Render videos programmatically, webhook callbacks on completion, and SDKs for Node.js and Python are available." },
{ q: "What is your refund policy?", a: "We offer a no-questions-asked 7-day money-back guarantee on all Premium subscriptions. Cancel anytime from your Subscription page; your videos remain yours forever." }
];
const LOGOS = ["VERTEX", "Novabyte", "PIXELRAY", "Orbit Labs", "Lumina", "FRAMEHAUS", "Skyline", "Arcadia"];
const TEMPLATES = [
{ t: "Neon City Flythrough", tag: "Trending", styleId: "cyberpunk", p: "FPV drone flight through rain-soaked neon streets, holograms flickering, cinematic cyberpunk, reflections on wet asphalt" },
{ t: "Ghibli Morning", tag: "Community", styleId: "ghibli", p: "A quiet countryside morning, wind in the grass, a small cottage with smoke rising from the chimney, painterly light" },
{ t: "Product Hero Reveal", tag: "Marketing", styleId: "cinematic", p: "Luxury product on a black stage, dramatic rim lighting, slow orbit camera, floating dust particles, anamorphic flare" },
{ t: "Mascot Dance Promo", tag: "Social", styleId: "cartoon", p: "A cheerful fox mascot dancing through a candy-colored city, playful energy, bold outlines, confetti bursts" },
{ t: "Dragon Reveal", tag: "Epic", styleId: "fantasy", p: "Camera pushes through golden clouds to reveal a dragon circling a glowing crystal castle at dusk" },
{ t: "Anime Sunset Ride", tag: "Trending", styleId: "anime", p: "Two friends on a coastal train at sunset, lens flare, emotional anime scene, petals drifting past the window" }
];
const SEED_VIDEOS = [
{ id: "v1", prompt: "A cinematic drone shot over a bioluminescent bay at midnight, gentle waves glowing electric blue", styleId: "cinematic", duration: 45, ratio: "16:9", res: "1080p", fps: 30, date: "Aug 6, 2026", size: "84.2", thumb: IMG.cinematic },
{ id: "v2", prompt: "A golden retriever puppy running through a sunlit meadow in slow motion, dandelions floating", styleId: "realistic", duration: 30, ratio: "16:9", res: "1080p", fps: 60, date: "Aug 4, 2026", size: "61.7", thumb: IMG.realistic },
{ id: "v3", prompt: "Anime girl on a rooftop watching fireworks bloom over the Tokyo skyline at sunset", styleId: "anime", duration: 30, ratio: "9:16", res: "1080p", fps: 30, date: "Aug 1, 2026", size: "55.3", thumb: IMG.anime },
{ id: "v4", prompt: "A cute round robot discovering a glowing flower in a post-apocalyptic city", styleId: "pixar", duration: 60, ratio: "16:9", res: "1080p", fps: 24, date: "Jul 28, 2026", size: "112.9", thumb: IMG.pixar },
{ id: "v5", prompt: "Cozy countryside bakery at dawn, steam rising from fresh bread, curtains in the breeze", styleId: "ghibli", duration: 30, ratio: "16:9", res: "720p", fps: 24, date: "Jul 24, 2026", size: "48.1", thumb: IMG.ghibli },
{ id: "v6", prompt: "FPV flight through a neon-lit cyberpunk alley in the rain, flying cars overhead", styleId: "cyberpunk", duration: 45, ratio: "21:9", res: "1080p", fps: 30, date: "Jul 19, 2026", size: "92.4", thumb: IMG.cyberpunk },
{ id: "v7", prompt: "A majestic dragon circling a floating crystal castle as golden particles fill the sky", styleId: "fantasy", duration: 60, ratio: "16:9", res: "1080p", fps: 30, date: "Jul 12, 2026", size: "126.0", thumb: IMG.fantasy },
{ id: "v8", prompt: "Female pilot in a cockpit during golden hour, photoreal close-up, clouds below", styleId: "photoreal", duration: 30, ratio: "4:3", res: "1080p", fps: 30, date: "Jul 6, 2026", size: "58.8", thumb: IMG.photoreal }
];
const GEN_STEPS = ["Analyzing prompt", "Storyboarding scenes", "Generating frames", "Styling & lighting", "Voice, music & subtitles", "Upscale & encode"];
const STEP_STARTS = [0, 14, 32, 55, 75, 92];
const DEFAULT_CFG = { prompt: "", style: "cinematic", duration: 30, ratio: "16:9", res: "1080p", fps: 30, lang: "English", voice: "Aria (Female)", subs: true, music: true, camera: "Smooth Dolly", creativity: 70, negative: "" };
const OPT_LANGS = ["English", "Spanish", "French", "German", "Hindi", "Japanese", "Korean", "Arabic", "Portuguese"];
const OPT_VOICES = ["Aria (Female)", "Nova (Female)", "Luna (Soft F)", "Atlas (Male)", "Orion (Male)", "Max (Deep M)"];
const OPT_CAMS = ["Static", "Smooth Dolly", "Orbit 360°", "Crane Up", "Handheld", "FPV Drone", "Slow Push In"];
const TITLES = { dashboard: "Dashboard", create: "Create Video", i2v: "Image to Video", videos: "My Videos", templates: "Templates", history: "History", downloads: "Downloads", subscription: "Subscription", profile: "Profile", settings: "Settings", admin: "Admin Panel", video: "Generated Video" };
const WEEK = [{ d: "Mon", v: 14 }, { d: "Tue", v: 22 }, { d: "Wed", v: 18 }, { d: "Thu", v: 31 }, { d: "Fri", v: 27 }, { d: "Sat", v: 38 }, { d: "Sun", v: 45 }];
const REV = [{ m: "Feb", v: 9.2 }, { m: "Mar", v: 11.8 }, { m: "Apr", v: 14.1 }, { m: "May", v: 16.9 }, { m: "Jun", v: 19.4 }, { m: "Jul", v: 22.2 }, { m: "Aug", v: 24.6 }];
const USAGE = [{ d: "W1", v: 2100 }, { d: "W2", v: 2650 }, { d: "W3", v: 2400 }, { d: "W4", v: 3200 }, { d: "W5", v: 3800 }, { d: "W6", v: 4600 }];
const SUBPIE = [{ name: "Free", value: 5214, c: "#64748b" }, { name: "Monthly", value: 2140, c: "#38bdf8" }, { name: "Yearly", value: 860, c: "#a855f7" }];
const ADMIN_USERS = [
{ n: "Maya Chen", e: "maya@lumen.studio", plan: "Premium", st: "Active", j: "Jan 2026" },
{ n: "Derek Okafor", e: "derek@gmail.com", plan: "Free", st: "Active", j: "Mar 2026" },
{ n: "Sofia Marin", e: "sofia@pixelray.co", plan: "Premium", st: "Active", j: "Feb 2026" },
{ n: "Tom Alvarez", e: "tom.a@outlook.com", plan: "Free", st: "Suspended", j: "May 2026" },
{ n: "Aiko Tanaka", e: "aiko@novaframe.jp", plan: "Premium", st: "Active", j: "Jun 2026" },
{ n: "Liam O'Brien", e: "liam@arcadia.dev", plan: "Premium", st: "Active", j: "Apr 2026" }
];
const SERVERS = [
{ n: "Render Cluster A", r: "us-east-1", load: "62%", s: "Operational" },
{ n: "Render Cluster B", r: "eu-west-2", load: "48%", s: "Operational" },
{ n: "GPU Pool — H100", r: "global", load: "81%", s: "High load" },
{ n: "Storage CDN", r: "edge", load: "23%", s: "Operational" },
{ n: "Voice Synth API", r: "us-east-1", load: "34%", s: "Operational" }
];
const REPORTS = [
{ t: "Q2 2026 Revenue Report", d: "Jul 4, 2026", s: "PDF · 2.1 MB" },
{ t: "AI Usage & Compute Audit", d: "Jul 18, 2026", s: "PDF · 4.8 MB" },
{ t: "Content Moderation Summary", d: "Aug 1, 2026", s: "PDF · 1.2 MB" },
{ t: "Infrastructure Cost Breakdown", d: "Aug 5, 2026", s: "XLSX · 640 KB" }
];
const NOTIFS = [
{ i: "sparkles", t: "Render finished: “Bioluminescent bay…”", time: "2m ago" },
{ i: "zap", t: "Priority queue unlocked for your plan", time: "1h ago" },
{ i: "gift", t: "New style engine: Studio Ghibli v2", time: "1d ago" }
];
/* ============================== UI PRIMITIVES ============================== */
function Particles({ n = 26 }) {
const ps = useMemo(() => Array.from({ length: n }, () => ({ l: Math.random() * 100, t: Math.random() * 100, s: 2 + Math.random() * 3.5, d: 4 + Math.random() * 6, de: Math.random() * 5, o: 0.2 + Math.random() * 0.55 })), [n]);
return
{ps.map((p, i) => )}
;
}
const fadeUp = { hidden: { opacity: 0, y: 28 }, show: (i = 0) => ({ opacity: 1, y: 0, transition: { delay: i * 0.07, duration: 0.55, ease: "easeOut" } }) };
function SectionHead({ kicker, title, sub }) {
return (
{kicker}
{title}
{sub && {sub} }
);
}
function Toggle({ on, onChange }) {
return onChange(e.target.checked)} /> ;
}
function ToggleRow({ label, sub, on, onChange }) {
return ;
}
function Sel({ label, value, onChange, options }) {
return (
{label}
onChange(e.target.value)}>{options.map((o) => {o} )}
);
}
function Chips({ label, value, onChange, items }) {
return (
{label}
{items.map((it) => onChange(it)}>{it} )}
);
}
function RangeField({ label, value, onChange, min = 0, max = 100, suffix = "%" }) {
return (
);
}
function Meter({ value, max }) {
return ;
}
function Avatar({ name, size = 40, grad }) {
const initials = (name || "U U").split(" ").map((w) => w[0]).slice(0, 2).join("").toUpperCase();
return {initials} ;
}
function Modal({ open, onClose, title, children, width = 480 }) {
return (
{open && (
e.stopPropagation()}>
{title}
{children}
)}
);
}
function Toasts({ list }) {
return (
{list.map((t) => (
{t.msg}
))}
);
}
function EmptyState({ icon = "film", title, sub, action }) {
return (
);
}
function FakePlayer({ src, duration = 30, res = "1080p" }) {
const [playing, setPlaying] = useState(false);
const [t, setT] = useState(0);
useEffect(() => {
if (!playing) return;
const iv = setInterval(() => setT((x) => (x + 0.1 >= duration ? 0 : x + 0.1)), 100);
return () => clearInterval(iv);
}, [playing, duration]);
const seek = (e) => { const r = e.currentTarget.getBoundingClientRect(); setT(Math.max(0, Math.min(1, (e.clientX - r.left) / r.width)) * duration); };
return (
{!playing &&
setPlaying(true)} aria-label="Play"> }
setPlaying((p) => !p)} aria-label="Play/Pause">
{fmt(t)} / {fmt(duration)}
AI · {res}
);
}
function ChartTip({ active, payload, label }) {
if (!active || !payload || !payload.length) return null;
return {label} · {payload[0].value}
;
}
/* ============================== LANDING ============================== */
function Navbar({ onSignIn, onStart }) {
const [sc, setSc] = useState(false);
useEffect(() => { const f = () => setSc(window.scrollY > 30); f(); window.addEventListener("scroll", f); return () => window.removeEventListener("scroll", f); }, []);
return (
);
}
function Hero({ onStart, onDemo }) {
return (
v3.0 — Veo-class diffusion engine is live
Transform Text Into Stunning AI Videos
Create cinematic, realistic, anime, cartoon, and Pixar-quality videos from simple text prompts in minutes using advanced AI.
Start Creating Free
Watch Demo
2.4M+ Videos generated
120k Active creators
4.9/5 Average rating
Render complete · 1080p
AI voice synced
2.4x priority queue
A neon fox running through a rainy cyberpunk city, cinematic… Generate
{["Cinematic", "Anime", "Pixar", "Ghibli"].map((s, i) => {s} )}
00:45 · 16:9 · 60fps
);
}
function TrustedBy() {
const row = LOGOS.map((l, i) => {l} );
return (
Trusted by 120,000+ creators & teams at
);
}
function Features() {
return (
Everything you need to go viral >} sub="A complete AI video studio in your browser — generation, voice, music, captions, storage and export." />
{FEATURES.map((f, i) => (
{f.t}
{f.d}
))}
);
}
function StylesSection({ onUse }) {
return (
Ten visual engines. Infinite worlds. >} sub="Switch between hand-tuned diffusion engines — every style keeps characters consistent across scenes." />
{STYLES.map((s, i) => (
onUse(s.id)} whileHover={{ y: -6 }}>
{s.name}
{s.desc}
))}
);
}
function HowItWorks() {
return (
From idea to film in 4 steps >} />
{HOW.map((h, i) => (
{i + 1}
Step {i + 1} · {h.t}
{h.d}
))}
);
}
function Pricing({ onChoose }) {
const [yearly, setYearly] = useState(false);
return (
Simple pricing, cinematic value >} sub="Start free forever. Upgrade when you're ready to go unlimited." />
setYearly(false)}>Monthly
setYearly(true)}>Yearly −35%
Free
$0 /month
For curious creators exploring AI video.
{["3 videos per day", "720p export", "Watermark on videos", "Limited styles", "Community support"].map((x) => {x} )}
onChoose("Free")}>Start Free
MOST POPULAR
Premium
${yearly ? 19 : 29} /month{yearly && ", billed yearly"}
For professionals & teams shipping real work.
{["Unlimited videos", "1080p HD export · 60fps", "2.4x faster generation", "No watermark", "All premium styles", "Full commercial license", "12 AI voices · 9 languages", "Priority GPU queue"].map((x) => {x} )}
onChoose("Premium")}>Upgrade Now
);
}
function Testimonials() {
return (
Loved by 120,000+ creators >} />
{TESTIMONIALS.map((t, i) => (
{[0, 1, 2, 3, 4].map((s) => )}
“{t.q}”
))}
);
}
function FaqSection() {
const [open, setOpen] = useState(0);
return (
Questions, answered >} />
{FAQS.map((f, i) => (
setOpen(open === i ? -1 : i)}>{f.q}
{open === i && {f.a}
}
))}
);
}
function CtaBand({ onStart }) {
return (
Your first AI film is 60 seconds away
Join 120,000+ creators generating cinematic video from text. No credit card required.
Start Creating Free
);
}
function Footer({ onSignIn, onStart }) {
const cols = [
{ h: "Product", l: ["Features", "AI Styles", "Pricing", "Templates", "Changelog"] },
{ h: "Company", l: ["About", "Careers", "Blog", "Press Kit", "Contact"] },
{ h: "Resources", l: ["Documentation", "API Reference", "Tutorials", "Community", "Status"] },
{ h: "Legal", l: ["Privacy", "Terms", "Cookies", "Licenses"] }
];
return (
);
}
function Landing({ onSignIn, onStart, onDemo, onUseStyle }) {
return (
);
}
/* ============================== AUTH ============================== */
function OtpInputs({ onChange }) {
const [vals, setVals] = useState(Array(6).fill(""));
const refs = useRef([]);
const set = (i, v) => {
v = v.replace(/\D/g, "").slice(-1);
const nv = [...vals]; nv[i] = v; setVals(nv);
if (v && i < 5) refs.current[i + 1] && refs.current[i + 1].focus();
onChange(nv.join(""));
};
const kd = (i, e) => { if (e.key === "Backspace" && !vals[i] && i > 0) refs.current[i - 1].focus(); };
return {vals.map((v, i) => (refs.current[i] = el)} value={v} onChange={(e) => set(i, e.target.value)} onKeyDown={(e) => kd(i, e)} maxLength={2} inputMode="numeric" aria-label={"Digit " + (i + 1)} />)}
;
}
function AuthScreen({ mode, setMode, onDone, onBack, toast }) {
const [name, setName] = useState(""); const [email, setEmail] = useState(""); const [pass, setPass] = useState("");
const [code, setCode] = useState(""); const [err, setErr] = useState(""); const [sent, setSent] = useState(false);
const cap = (s) => s.charAt(0).toUpperCase() + s.slice(1);
const submit = (e) => {
e.preventDefault(); setErr("");
if (mode !== "forgot" && pass.length < 6) { setErr("Password must be at least 6 characters."); return; }
if (!/^\S+@\S+\.\S+$/.test(email)) { setErr("Please enter a valid email address."); return; }
if (mode === "signup") { setMode("verify"); toast("Verification code sent to " + email, "mail"); return; }
if (mode === "forgot") { setSent(true); return; }
onDone(cap(email.split("@")[0].replace(/[._]/g, " ")) + " Creator", email, "Email");
};
const verify = () => {
if (code.length !== 6) { setErr("Enter the 6-digit code (demo: any 6 digits)."); return; }
onDone(name ? name : cap(email.split("@")[0].replace(/[._]/g, " ")), email, "Email");
};
const head = { login: "Welcome back", signup: "Create your studio", forgot: "Reset password", verify: "Verify your email" }[mode];
return (
Back to home
{head}
{mode === "login" && "Sign in to continue creating cinematic AI videos."}
{mode === "signup" && "Free forever · 3 videos/day · no credit card."}
{mode === "forgot" && "We'll email you a secure reset link."}
{mode === "verify" && <>We sent a 6-digit code to {email || "your email"} . (Demo: any 6 digits) >}
{(mode === "login" || mode === "signup") && (
<>
onDone("Alex Morgan", "alex.morgan@gmail.com", "Google")}> Continue with Google
onDone("Sam Carter", "sam@github.dev", "GitHub")}> Continue with GitHub
OR WITH EMAIL
>
)}
{mode === "verify" ? (
<>
{err && {err}
}
Verify & Continue
Didn't get it? toast("Code re-sent", "mail")}>Resend code
>
) : (
)}
{(mode === "login" || mode === "signup") && (
{mode === "login" ? <>New to Text2Motion? setMode("signup")}>Create account > : <>Already have an account? setMode("login")}>Sign in >}
)}
Supabase Auth · OAuth 2.0 · 256-bit encryption
);
}
/* ============================== GENERATION ============================== */
function RenderPanel({ gen, onCancel }) {
const p = gen.p;
const cur = STEP_STARTS.reduce((a, s, i) => (p >= s ? i : a), 0);
const eta = Math.max(2, Math.round((100 - p) * 0.55));
const style = STYLES.find((s) => s.id === gen.config.style) || STYLES[1];
if (gen.phase === "success") {
return (
Video rendered!
Encoding final MP4 · opening your player…
);
}
return (
Rendering your masterpiece
{GEN_STEPS[cur]}… · est. {eta}s remaining
{style.name} {gen.config.duration}s {gen.config.res}
{GEN_STEPS.map((s, i) => (
= 100 ? "done" : i === cur ? "now" : "")}>
{i < cur || p >= 100 ? : i + 1} {s}
))}
Cancel generation
);
}
/* ============================== APP PAGES ============================== */
function StatCard({ icon, tint, label, value, delta }) {
return (
{label}
{value} {delta && {delta} }
);
}
function VideoCard({ v, ctx }) {
const st = STYLES.find((s) => s.id === v.styleId) || STYLES[0];
return (
{ ctx.setActiveId(v.id); ctx.setTab("video"); }}>
{st.name}
{fmt(v.duration)}
{v.prompt}
{v.date} · {v.res}
ctx.downloadVideo(v.id)}>
ctx.duplicateVideo(v.id)}>
ctx.setDelTarget(v.id)}>
);
}
function VideosGrid({ ctx, list, title, sub }) {
const [q, setQ] = useState(""); const [fs, setFs] = useState("All styles"); const [page, setPage] = useState(1);
useEffect(() => { setPage(1); }, [q, fs]);
const filtered = list.filter((v) => (fs === "All styles" || v.styleId === fs) && v.prompt.toLowerCase().includes(q.toLowerCase()));
const pages = Math.max(1, Math.ceil(filtered.length / 6));
const shown = filtered.slice((page - 1) * 6, page * 6);
return (
{title} {sub || filtered.length + " videos"}
{shown.length === 0 ? (
ctx.setTab("create")}> Create Video} />
) : (
{shown.map((v) => )}
)}
{pages > 1 && (
setPage(page - 1)}>
{Array.from({ length: pages }, (_, i) => setPage(i + 1)}>{i + 1} )}
setPage(page + 1)}>
)}
);
}
function DashboardHome({ ctx }) {
const storage = (ctx.videos.reduce((a, v) => a + parseFloat(v.size || 60), 0) / 1024).toFixed(1);
return (
Welcome back, {ctx.user.name.split(" ")[0]} 👋
Here's what's happening in your studio today.
ctx.setTab("create")}> New Video
Rendering activity
+18% vs last week
{[{ i: "sparkles", t: "Create Video", d: "Text → cinematic video", tab: "create" }, { i: "image", t: "Image to Video", d: "Animate any still", tab: "i2v" }, { i: "layers", t: "Templates", d: "Start from a proven prompt", tab: "templates" }].map((a, i) => (
ctx.setTab(a.tab)}>
{a.t} {a.d}
))}
Recent videos
{ctx.videos.slice(0, 3).map((v) => )}
);
}
function CreatePage({ ctx }) {
const c = ctx.cfg; const set = (k, v) => ctx.setCfg((p) => ({ ...p, [k]: v }));
if (ctx.gen) return ;
const styleName = (STYLES.find((s) => s.id === c.style) || STYLES[1]).name;
return (
Create Video
Describe anything. Our diffusion engine films it.
Prompt {c.prompt.length}/600
{["A neon fox running through a rainy cyberpunk city", "A dragon circling a crystal castle at dusk", "Cozy Ghibli bakery at dawn, steam rising"].map((p) => set("prompt", p)}> {p.slice(0, 34)}… )}
Negative prompt (what to avoid) set("negative", e.target.value)} />
set("lang", v)} options={OPT_LANGS} />
set("voice", v)} options={OPT_VOICES} />
set("camera", v)} options={OPT_CAMS} />
set("creativity", v)} />
set("subs", v)} />
set("music", v)} />
{ if (!c.prompt.trim()) { ctx.toast("Write a prompt first ✍️", "info"); return; } ctx.startGen({ ...c }, "text"); }}>
Generate Video
~{Math.round(c.duration * 2.1)}s render on your {ctx.user.plan} queue
set("style", (STYLES.find((s) => s.name === v) || STYLES[0]).id)} options={STYLES.map((s) => s.name)} />
s.id === c.style) || STYLES[0]).img} alt="style preview" style={{ width: "100%", aspectRatio: "16/9", objectFit: "cover", display: "block" }} />
set("duration", Number(v))} items={[30, 45, 60]} />
set("ratio", v)} items={["16:9", "9:16", "1:1", "4:3", "21:9"]} />
set("res", v)} items={["720p", "1080p"]} />
set("fps", Number(v))} items={[24, 30, 60]} />
Premium unlocks 4K, longer clips and the priority H100 queue.
);
}
function I2VPage({ ctx }) {
const [img, setImg] = useState(null); const [over, setOver] = useState(false);
const [strength, setStrength] = useState(65); const [motion, setMotion] = useState(50);
const [cam, setCam] = useState("Slow Push In"); const [dur, setDur] = useState(30);
const fileRef = useRef(null);
const readFile = (f) => { if (!f || !f.type.startsWith("image/")) return; const r = new FileReader(); r.onload = (e) => setImg(e.target.result); r.readAsDataURL(f); };
if (ctx.gen) return ;
return (
Image to Video
Upload a still — our engine adds depth, motion and life.
{img ? (
setImg(null)}>
) : (
fileRef.current.click()} onDragOver={(e) => { e.preventDefault(); setOver(true); }} onDragLeave={() => setOver(false)} onDrop={(e) => { e.preventDefault(); setOver(false); readFile(e.dataTransfer.files[0]); }}>
Drag & drop your image
PNG, JPG or WebP · up to 20 MB
{ e.stopPropagation(); fileRef.current.click(); }}> Browse files
readFile(e.target.files[0])} />
)}
setDur(Number(v))} items={[30, 45, 60]} />
{ if (!img) { ctx.toast("Upload an image first 🖼️", "info"); return; } ctx.startGen({ ...ctx.cfg, prompt: "Animated image · " + cam + " · strength " + strength + "%", style: "realistic", duration: dur, camera: cam, srcImg: img }, "image"); }}>
Animate Image
);
}
function VideoPage({ ctx }) {
const v = ctx.activeVideo;
const [share, setShare] = useState(false);
if (!v) return ctx.setTab("videos")}>Open My Videos} />;
const st = STYLES.find((s) => s.id === v.styleId) || STYLES[0];
return (
ctx.setTab("videos")}> Back to library
Prompt
ctx.copyText(v.prompt)}> Copy Prompt
{v.prompt}
{v.prompt.slice(0, 64)}…
{st.name} {v.res} · {v.fps}fps {v.duration}s · {v.ratio} {v.size} MB
ctx.downloadVideo(v.id)}> Download MP4
setShare(true)}> Share
ctx.duplicateVideo(v.id)}> Duplicate
ctx.editVideo(v.id)}> Edit
ctx.startGen({ ...DEFAULT_CFG, prompt: v.prompt, style: v.styleId, duration: v.duration }, "text")}> Generate Again
ctx.setDelTarget(v.id)}> Delete
Generation details
{[["Created", v.date], ["Voice", ctx.cfg.voice], ["Camera", ctx.cfg.camera], ["Storage", "Supabase · encrypted"]].map((r) =>
{r[0]} {r[1]}
)}
setShare(false)} title="Share your video">
{[["youtube", "#ff0033"], ["xlogo", "#e6eaf5"], ["instagram", "#d946ef"], ["share", "#38bdf8"], ["globe", "#34d399"]].map((s, i) => (
{ ctx.toast("Shared successfully 🎉", "share"); setShare(false); }}>
))}
YouTube · TikTok · Instagram · Facebook · X
ctx.copyText("https://t2m.ai/v/" + v.id)}>Copy
);
}
function TemplatesPage({ ctx }) {
return (
Templates
Battle-tested prompts from the community. One click to remix.
{TEMPLATES.map((t, i) => {
const st = STYLES.find((s) => s.id === t.styleId);
return (
{t.tag}
{t.t}
{t.p}
{ ctx.setCfg((c) => ({ ...c, prompt: t.p, style: t.styleId })); ctx.setTab("create"); ctx.toast("Template loaded into editor", "wand"); }}>
Use Template
);
})}
);
}
function SubscriptionPage({ ctx }) {
const [pay, setPay] = useState(null); const [phase, setPhase] = useState("choose");
const open = (plan) => { setPay(plan); setPhase("choose"); };
const payWith = (gw) => { setPhase("processing"); setTimeout(() => { setPhase("done"); setTimeout(() => { ctx.upgradePlan("Premium " + pay); setPay(null); }, 1400); }, 1600); };
return (
Subscription
Current plan: {ctx.user.plan}
{ctx.user.plan.startsWith("Premium") ? "Unlimited renders · 1080p · priority queue" : "3 videos/day · 720p · watermark"}
Active
{[{ n: "Free", p: "$0", f: ["3 videos/day", "720p", "Watermark", "Limited styles"] }, { n: "Monthly", p: "$29", f: ["Unlimited videos", "1080p HD · 60fps", "No watermark", "Priority queue", "Commercial license"] }, { n: "Yearly", p: "$19", f: ["Everything in Monthly", "2 months free", "Early access engines", "Dedicated support"] }].map((pl, i) => (
{pl.n === "Yearly" && BEST VALUE }
{pl.n === "Free" ? "Free" : "Premium " + pl.n}
{pl.p} /mo
{pl.n === "Free" ? ctx.toast("You can manage downgrades from billing", "info")}>Current tier logic :
open(pl.n)}>{ctx.user.plan.includes(pl.n) ? "Current plan" : "Upgrade Now"} }
))}
setPay(null)} title={"Checkout — Premium " + (pay || "")}>
{phase === "choose" && (
{[["card", "Stripe", "Credit / debit card · Apple Pay"], ["globe", "Flutterwave", "Cards · M-Pesa · mobile money"], ["key", "Paystack", "Cards · bank transfer · USSD"]].map((g) => (
payWith(g[1])}>{g[1]} {g[2]}
))}
PCI-DSS compliant · 3-D Secure · 7-day guarantee
)}
{phase === "processing" && Processing secure payment…
}
{phase === "done" &&
Payment successful!
Welcome to Premium 🎉
}
);
}
function ProfilePage({ ctx }) {
const [name, setName] = useState(ctx.user.name);
const [del, setDel] = useState(false);
const usage = 342; const storage = ctx.videos.reduce((a, v) => a + parseFloat(v.size || 60), 0) / 1024;
return (
Profile
API usage
Renders this month {usage} / {ctx.user.plan === "Free" ? 1000 : "∞"}
Cloud storage {storage.toFixed(1)} / 10 GB
Subscription
Manage plans, billing and payment methods.
ctx.setTab("subscription")}> Manage subscription
Danger zone
Deleting your account removes all videos, history and data permanently.
setDel(true)}> Delete Account
setDel(false)} title="Delete account?">
This action is permanent . All {ctx.videos.length} videos, prompts and settings will be erased from our servers within 24 hours.
setDel(false)}>Keep my account
{ setDel(false); ctx.logout(true); }}> Delete forever
);
}
function SettingsPage({ ctx }) {
const [s, setS] = useState({ theme: "Dark", lang: "English", nR: true, nP: true, nT: false, pub: false, analytics: true, g: true, gh: false });
const [keys, setKeys] = useState([{ id: "k1", k: "sk_live_t2m_Xf92hKpQ7wLm3nR8vB21", c: "Created Jul 12, 2026" }]);
const set = (k, v) => setS((p) => ({ ...p, [k]: v }));
return (
Settings
Appearance & language
set("theme", v)} options={["Dark", "Midnight OLED", "System"]} />
set("lang", v)} options={OPT_LANGS} />
Accent {["#38bdf8", "#8b5cf6", "#d946ef", "#34d399", "#fbbf24"].map((c, i) => ctx.toast("Accent updated", "sliders")} aria-label={c} />)}
Notifications
set("nR", v)} />
set("nP", v)} />
set("nT", v)} />
Privacy
set("pub", v)} />
set("analytics", v)} />
Billing
Visa •••• 4242
Expires 08/28 · Default
Active
ctx.setTab("subscription")}> Manage billing
Connected accounts
{ set("g", v); ctx.toast(v ? "Google connected" : "Google disconnected", "globe"); }} />
{ set("gh", v); ctx.toast(v ? "GitHub connected" : "GitHub disconnected", "github"); }} />
API keys
{ setKeys((k) => [{ id: uid(), k: "sk_live_t2m_" + uid() + uid(), c: "Created Aug 8, 2026" }, ...k]); ctx.toast("New API key generated", "key"); }}> New key
{keys.map((k) => (
{k.k.slice(0, 18)}••••
{k.c}
ctx.copyText(k.k)}>
{ setKeys((ks) => ks.filter((x) => x.id !== k.id)); ctx.toast("Key revoked", "trash"); }}>
))}
);
}
function AdminPage({ ctx }) {
const [tab, setTab] = useState("overview");
const [users, setUsers] = useState(ADMIN_USERS);
const [queue, setQueue] = useState([
{ id: 1, u: "@neon_dreamer", p: "Replica of a trademarked superhero character fighting…", r: "IP concern", img: IMG.cyberpunk },
{ id: 2, u: "@fastcash22", p: "Misleading financial-ad video with fake celebrity voice", r: "Misinformation", img: IMG.photoreal },
{ id: 3, u: "@studio_k", p: "Dark fantasy battle scene with stylized combat", r: "Violence (auto-flag)", img: IMG.fantasy }
]);
const tabs = [["overview", "chart"], ["users", "users"], ["revenue", "trend"], ["subs", "pie"], ["usage", "zap"], ["servers", "server"], ["reports", "flag"], ["moderation", "shield"]];
return (
Admin Panel
{tabs.map((t) => setTab(t[0])}> {t[0][0].toUpperCase() + t[0].slice(1)} )}
{tab === "overview" && (
)}
{tab === "users" && (
User Plan Status Joined Actions
{users.map((u, i) => (
{u.plan}
{u.st}
{u.j}
setUsers((us) => us.map((x, j) => (j === i ? { ...x, plan: x.plan === "Free" ? "Premium" : "Free" } : x)))}>Toggle plan
setUsers((us) => us.map((x, j) => (j === i ? { ...x, st: x.st === "Active" ? "Suspended" : "Active" } : x)))}>{u.st === "Active" ? "Suspend" : "Restore"}
))}
)}
{tab === "revenue" && (
Monthly recurring revenue } />
)}
{tab === "subs" && (
Plan distribution {SUBPIE.map((s) => | )} } />
{SUBPIE.map((s) =>
{s.name} {s.value.toLocaleString()} users
)}
)}
{tab === "usage" && (
)}
{tab === "servers" && (
{SERVERS.map((s) =>
{s.n}
{s.r} · load {s.load}
{s.s})}
)}
{tab === "reports" && (
{REPORTS.map((r) =>
ctx.toast("Report download started", "download")}> Download )}
)}
{tab === "moderation" && (
queue.length === 0 ?
:
{queue.map((m) => (
{m.r}
{m.u}
{m.p}
{ setQueue((q) => q.filter((x) => x.id !== m.id)); ctx.toast("Approved", "check"); }}> Approve { setQueue((q) => q.filter((x) => x.id !== m.id)); ctx.toast("Removed & user warned", "trash"); }}> Remove
))}
)}
);
}
/* ============================== SHELL ============================== */
const NAVI = [
{ sec: "Studio", items: [["dashboard", "Dashboard", "grid"], ["create", "Create Video", "sparkles"], ["i2v", "Image to Video", "image"], ["videos", "My Videos", "film"], ["templates", "Templates", "layers"], ["history", "History", "clock"], ["downloads", "Downloads", "download"]] },
{ sec: "Account", items: [["subscription", "Subscription", "card"], ["profile", "Profile", "user"], ["settings", "Settings", "sliders"], ["admin", "Admin Panel", "shield"]] }
];
function Sidebar({ tab, setTab, user, open, setOpen, logout }) {
return (
{NAVI.map((g) => (
{g.sec}
{g.items.map((it) => (
{ setTab(it[0]); setOpen(false); }}>
{it[1]}
))}
))}
);
}
function Topbar({ title, user, setSideOpen, setTab, toast, logout }) {
const [bell, setBell] = useState(false); const [menu, setMenu] = useState(false);
return (
setSideOpen(true)} aria-label="Open menu">
{title}
{ if (e.key === "Enter") toast("Library search activated", "search"); }} />
{ setBell(!bell); setMenu(false); }} aria-label="Notifications">
{bell && (
Notifications
{NOTIFS.map((n, i) => )}
)}
{user.plan === "Free" &&
setTab("subscription")}> Upgrade }
{ setMenu(!menu); setBell(false); }} aria-label="Account menu">
{menu && (
{[["profile", "user", "Profile"], ["settings", "sliders", "Settings"], ["logout", "logout", "Logout"]].map((m) => { setMenu(false); m[0] === "logout" ? logout() : setTab(m[0]); }}> {m[2]} )}
)}
);
}
/* ============================== ROOT ============================== */
export default function App() {
const [view, setView] = useState("landing");
const [authMode, setAuthMode] = useState("login");
const [user, setUser] = useState(null);
const [tab, setTab] = useState("dashboard");
const [videos, setVideos] = useState(SEED_VIDEOS);
const [downloads, setDownloads] = useState(["v2", "v5"]);
const [gen, setGen] = useState(null);
const [activeId, setActiveId] = useState(null);
const [toasts, setToasts] = useState([]);
const [demoOpen, setDemoOpen] = useState(false);
const [cfg, setCfg] = useState({ ...DEFAULT_CFG });
const [sideOpen, setSideOpen] = useState(false);
const [delTarget, setDelTarget] = useState(null);
const genTimer = useRef(null);
const styleIntent = useRef(false);
const toast = (msg, icon = "check") => { const id = uid(); setToasts((t) => [...t, { id, msg, icon }]); setTimeout(() => setToasts((t) => t.filter((x) => x.id !== id)), 3400); };
const startGen = (config, src) => {
clearInterval(genTimer.current);
setGen({ p: 0, phase: "rendering", config, src });
genTimer.current = setInterval(() => {
setGen((g) => {
if (!g || g.phase !== "rendering") return g;
const np = Math.min(100, g.p + 0.9 + Math.random() * 2.4);
if (np >= 100) { clearInterval(genTimer.current); return { ...g, p: 100, phase: "success" }; }
return { ...g, p: np };
});
}, 130);
};
const cancelGen = () => { clearInterval(genTimer.current); setGen(null); toast("Generation cancelled", "x"); };
useEffect(() => {
if (gen && gen.phase === "success") {
const t = setTimeout(() => {
const c = gen.config; const st = STYLES.find((s) => s.id === c.style) || STYLES[1];
const nv = { id: uid(), prompt: c.prompt || "Untitled masterpiece", styleId: c.style, duration: c.duration || 30, ratio: c.ratio || "16:9", res: c.res || "1080p", fps: c.fps || 30, date: "Just now", size: (40 + Math.random() * 80).toFixed(1), thumb: c.srcImg || st.img };
setVideos((v) => [nv, ...v]); setActiveId(nv.id); setGen(null); setTab("video");
toast("Your AI video is ready 🎬", "sparkles");
}, 1900);
return () => clearTimeout(t);
}
}, [gen && gen.phase]);
useEffect(() => () => clearInterval(genTimer.current), []);
const authDone = (name, email, provider) => {
setUser({ name, email, plan: "Free", joined: "Aug 2026", provider });
setView("app"); setTab(styleIntent.current ? "create" : "dashboard"); styleIntent.current = false;
window.scrollTo(0, 0); toast("Welcome, " + name.split(" ")[0] + "! ✨");
};
const logout = (silent) => { setUser(null); setView("landing"); setGen(null); clearInterval(genTimer.current); window.scrollTo(0, 0); if (!silent) toast("Signed out. See you soon 👋"); };
const deleteVideo = (id) => { setVideos((v) => v.filter((x) => x.id !== id)); if (activeId === id) { setActiveId(null); setTab("videos"); } setDelTarget(null); toast("Video deleted", "trash"); };
const duplicateVideo = (id) => { const v = videos.find((x) => x.id === id); if (!v) return; setVideos((x) => [{ ...v, id: uid(), date: "Just now" }, ...x]); toast("Video duplicated", "copy"); };
const downloadVideo = (id) => { setDownloads((d) => d.includes(id) ? d : [id, ...d]); toast("Export started — MP4 downloading", "download"); };
const editVideo = (id) => { const v = videos.find((x) => x.id === id); if (!v) return; setCfg((c) => ({ ...c, prompt: v.prompt, style: v.styleId })); setTab("create"); toast("Loaded into editor", "pencil"); };
const copyText = (t) => { try { navigator.clipboard && navigator.clipboard.writeText(t); } catch (e) { } toast("Copied to clipboard", "copy"); };
const upgradePlan = (plan) => { setUser((u) => ({ ...u, plan })); toast("Upgraded to " + plan + " 🎉", "zap"); };
const ctx = { user, setUser, tab, setTab, videos, downloads, toast, cfg, setCfg, gen, startGen, cancelGen, activeId, setActiveId, activeVideo: videos.find((v) => v.id === activeId), deleteVideo, duplicateVideo, downloadVideo, editVideo, copyText, upgradePlan, logout, setDelTarget };
const goStart = () => { if (user) { setView("app"); setTab("create"); } else { setAuthMode("signup"); setView("auth"); } };
return (
<>
{view === "landing" && (
{ setAuthMode("login"); setView("auth"); }} onStart={goStart} onDemo={() => setDemoOpen(true)} onUseStyle={(id) => { setCfg((c) => ({ ...c, style: id })); styleIntent.current = true; if (user) { setView("app"); setTab("create"); } else { setAuthMode("signup"); setView("auth"); } }} />
)}
{view === "auth" && (
setView("landing")} toast={toast} />
)}
{view === "app" && user && (
setSideOpen(false)} />
{tab === "dashboard" && }
{tab === "create" && }
{tab === "i2v" && }
{tab === "videos" && }
{tab === "templates" && }
{tab === "history" && }
{tab === "downloads" && downloads.includes(v.id))} title="Downloads" sub={downloads.length + " exported MP4 files"} />}
{tab === "subscription" && }
{tab === "profile" && }
{tab === "settings" && }
{tab === "admin" && }
{tab === "video" && }
)}
setDemoOpen(false)} title="Text2Motion in action" width={760}>
{["Prompt: “Dragon circling a crystal castle”", "Style: Fantasy", "45s · 1080p · 60fps"].map((b) => {b} )}
setDelTarget(null)} title="Delete this video?">
The video and its render history will be permanently removed from your cloud storage.
setDelTarget(null)}>Cancel
deleteVideo(delTarget)}> Delete
>
);
}