* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
:root {
  --bg:#FFFFFF; --surface:#F4F4F6; --surface2:#ECECF0;
  --text:#0A0A0B; --muted:#71717A; --faint:#A1A1AA;
  --border:rgba(0,0,0,.08); --ink:#0A0A0B;
  --danger:#dc2626; --ok:#16a34a;
}
html, body { height:100%; }
body {
  font-family:'Inter',-apple-system,BlinkMacSystemFont,sans-serif;
  background:var(--bg); color:var(--text);
  overscroll-behavior-y:none;
}
button { font-family:inherit; }

/* ---------- demo banner ---------- */
#demo-banner {
  position:sticky; top:0; z-index:60;
  background:#0A0A0B; color:#fff; font-size:12px; text-align:center;
  padding:9px 36px 9px 12px; line-height:1.5;
}
#demo-banner-close { position:absolute; right:12px; top:50%; transform:translateY(-50%); cursor:pointer; opacity:.7; }

/* ---------- app frame ---------- */
#app { max-width:480px; margin:0 auto; min-height:100dvh; display:flex; flex-direction:column; background:#fff; position:relative; }
#topbar { position:sticky; top:0; z-index:20; background:rgba(255,255,255,.96); backdrop-filter:blur(8px); }
.topbar-inner { display:flex; align-items:center; justify-content:space-between; padding:14px 18px 12px; }
.wordmark { font-family:'Space Grotesk'; font-weight:700; font-size:15px; letter-spacing:3px; }
.wordmark.small { font-size:12px; display:flex; align-items:center; gap:8px; }
.wordmark.small .back { font-size:18px; cursor:pointer; color:var(--muted); }
.credits-pill { font-size:12px; font-weight:600; background:var(--ink); color:#fff; padding:7px 13px; border-radius:20px; display:flex; align-items:center; gap:6px; cursor:pointer; }

#screens { flex:1; display:flex; flex-direction:column; }
.screen { flex:1; display:flex; flex-direction:column; padding-bottom:8px; animation:fadein .22s ease; }
@keyframes fadein { from { opacity:0; transform:translateY(6px);} to { opacity:1; transform:none;} }

/* ---------- bottom nav ---------- */
#bottomnav {
  position:sticky; bottom:0; z-index:20;
  display:flex; align-items:flex-end; padding:10px 18px calc(14px + env(safe-area-inset-bottom));
  background:linear-gradient(transparent, rgba(255,255,255,.97) 45%);
  border-top:1px solid var(--border);
}
.navitem { flex:1; text-align:center; font-size:10px; color:var(--muted); font-weight:500; letter-spacing:.4px; cursor:pointer; padding:4px 0; }
.navitem .ni { font-size:19px; display:block; margin-bottom:3px; opacity:.5; }
.navitem.active { color:#000; font-weight:700; }
.navitem.active .ni { opacity:1; }
[hidden] { display:none !important; }

/* ---------- shared bits ---------- */
.sec-h { font-family:'Space Grotesk'; font-size:12px; font-weight:600; letter-spacing:1.5px; padding:4px 18px 10px; color:#3f3f46; }
.chips { display:flex; gap:8px; padding:0 18px 14px; overflow-x:auto; scrollbar-width:none; }
.chips::-webkit-scrollbar { display:none; }
.chip { flex-shrink:0; font-size:11.5px; font-weight:600; padding:8px 14px; border-radius:20px; background:var(--surface); border:1px solid var(--border); color:var(--muted); cursor:pointer; }
.chip.sel { background:var(--ink); border-color:var(--ink); color:#fff; }
.spinner { width:34px; height:34px; border-radius:50%; border:3px solid rgba(0,0,0,.1); border-top-color:var(--ink); animation:spin 1s linear infinite; margin:30px auto; }
@keyframes spin { to { transform:rotate(360deg); } }
.empty { text-align:center; padding:38px 30px; color:var(--muted); }
.empty .big { font-size:34px; margin-bottom:10px; }
.empty .t { font-weight:700; color:var(--text); font-size:14px; margin-bottom:6px; }
.empty .s { font-size:12.5px; line-height:1.6; margin-bottom:16px; }
.btn { border:none; border-radius:14px; padding:13px 22px; background:var(--ink); color:#fff; font-weight:700; font-size:13px; cursor:pointer; }
.btn.ghost { background:var(--surface); color:var(--text); border:1px solid var(--border); }
.btn:disabled { opacity:.45; }
.errbox { margin:16px 18px; background:#fef2f2; border:1px solid #fecaca; color:#991b1b; border-radius:14px; padding:14px 15px; font-size:12.5px; line-height:1.6; text-align:center; }
.errbox .btn { margin-top:10px; }

/* ---------- discover ---------- */
.hero { margin:0 18px 14px; border-radius:18px; overflow:hidden; position:relative; aspect-ratio:16/10.5; border:1px solid var(--border); box-shadow:0 10px 30px rgba(0,0,0,.1); cursor:pointer; background:var(--surface); }
.hero .art { position:absolute; inset:0; background-size:cover; background-position:center; }
.hero .art.fallback { background:radial-gradient(circle at 30% 20%, #d4d4d8, transparent 55%), radial-gradient(circle at 78% 85%, #a1a1aa, transparent 55%), linear-gradient(155deg,#e4e4e7,#fafafa); }
.hero .meta { position:absolute; left:0; right:0; bottom:0; padding:30px 14px 12px; background:linear-gradient(transparent,rgba(0,0,0,.72)); }
.hero .mt { font-family:'Space Grotesk'; font-size:14px; font-weight:600; color:#fff; }
.hero .mm { font-size:10.5px; color:rgba(255,255,255,.75); margin-top:4px; }
.hero video.bg { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.ftag { position:absolute; top:10px; left:10px; font-size:9px; font-weight:700; letter-spacing:1.5px; color:#fff; background:var(--ink); padding:4px 10px; border-radius:8px; z-index:2; }
.playov { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; z-index:2; }
.playov div { width:42px; height:42px; border-radius:50%; background:var(--ink); display:flex; align-items:center; justify-content:center; font-size:14px; color:#fff; box-shadow:0 6px 18px rgba(0,0,0,.35); }
.feed { display:grid; grid-template-columns:1fr 1fr; gap:10px; padding:0 18px 18px; }
.vcard { border-radius:14px; overflow:hidden; position:relative; aspect-ratio:3/4.1; background:var(--surface); border:1px solid var(--border); cursor:pointer; }
.vcard .art { position:absolute; inset:0; background-size:cover; background-position:center; }
.vcard .art.fallback { background:radial-gradient(circle at 50% 30%, #d4d4d8, transparent 55%), linear-gradient(160deg,#e4e4e7,#fafafa); }
.vcard video.bg { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.vcard .meta { position:absolute; left:0; right:0; bottom:0; padding:22px 10px 9px; background:linear-gradient(transparent,rgba(0,0,0,.72)); z-index:2; }
.vcard .mt { font-size:10.5px; font-weight:600; color:#fff; line-height:1.35; }
.vcard .mm { font-size:9px; color:rgba(255,255,255,.7); margin-top:3px; }
.dur { position:absolute; bottom:8px; right:8px; font-size:9.5px; font-weight:700; background:rgba(0,0,0,.6); color:#fff; padding:3px 8px; border-radius:8px; z-index:2; }
.modeltag { position:absolute; top:8px; left:8px; font-size:8.5px; font-weight:700; letter-spacing:1px; color:#fff; background:rgba(0,0,0,.45); border:1px solid rgba(255,255,255,.3); padding:3px 8px; border-radius:8px; z-index:2; }

/* ---------- create ---------- */
.create-scroll { padding:2px 18px 0; overflow-y:auto; }
.modelrow { display:flex; align-items:center; justify-content:space-between; background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:13px 15px; margin-bottom:16px; cursor:pointer; }
.modelrow .ml { font-size:10px; font-weight:700; letter-spacing:1.5px; color:var(--muted); font-family:'Space Grotesk'; }
.modelrow .mv { font-size:14px; font-weight:700; margin-top:3px; display:flex; align-items:center; gap:8px; }
.modelrow .mv .on { width:8px; height:8px; border-radius:50%; background:var(--ok); display:inline-block; }
.modelrow .chev { font-size:18px; color:var(--muted); }
.framelabel, .desclabel { font-size:12.5px; font-weight:700; margin-bottom:10px; }
.frames { display:flex; gap:10px; margin-bottom:16px; }
.fcard { flex:1; border:1.5px dashed rgba(0,0,0,.22); border-radius:16px; background:var(--surface); min-height:118px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:5px; position:relative; cursor:pointer; overflow:hidden; padding:10px; }
.fcard img.thumb { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.fcard .x { position:absolute; top:6px; right:6px; width:22px; height:22px; border-radius:50%; background:rgba(0,0,0,.65); color:#fff; font-size:12px; display:flex; align-items:center; justify-content:center; z-index:2; }
.fcard .fi { font-size:22px; } .fcard .ft { font-size:11.5px; font-weight:600; text-align:center; } .fcard .fh { font-size:10px; color:var(--muted); }
.fcard.disabled { opacity:.5; cursor:default; }
.fcard .soon { position:absolute; bottom:8px; font-size:9px; font-weight:700; letter-spacing:1px; background:var(--ink); color:#fff; padding:3px 9px; border-radius:8px; }
.prompt { width:100%; min-height:104px; background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:13px 14px; font-size:13px; font-family:'Inter'; color:var(--text); resize:vertical; line-height:1.6; }
.prompt::placeholder { color:var(--faint); }
.prompt:focus { outline:none; border-color:rgba(0,0,0,.35); background:#fff; }
.opt-label { font-size:10px; font-weight:700; letter-spacing:2px; color:var(--muted); margin:15px 0 8px; font-family:'Space Grotesk'; }
.seg { display:flex; background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:4px; gap:4px; }
.seg div { flex:1; text-align:center; font-size:11.5px; font-weight:600; padding:9px 0; border-radius:9px; color:var(--muted); cursor:pointer; }
.seg div.sel { background:var(--ink); color:#fff; }
.gen-btn { margin:16px 18px calc(18px + env(safe-area-inset-bottom)); border:none; border-radius:16px; padding:17px; background:var(--ink); color:#fff; font-family:'Space Grotesk'; font-size:15px; font-weight:700; letter-spacing:1.5px; display:flex; align-items:center; justify-content:center; gap:10px; box-shadow:0 10px 28px rgba(0,0,0,.25); cursor:pointer; width:calc(100% - 36px); }
.gen-btn .cost { font-size:11.5px; font-weight:700; background:rgba(255,255,255,.15); padding:4px 10px; border-radius:10px; }
.gen-btn:disabled { opacity:.55; }
.hint { font-size:11px; color:var(--muted); margin:8px 18px 0; line-height:1.6; }

/* ---------- model sheet ---------- */
#sheet-bg { position:fixed; inset:0; background:rgba(0,0,0,.35); z-index:40; }
#model-sheet { position:fixed; left:50%; transform:translateX(-50%); bottom:0; width:100%; max-width:480px; max-height:82dvh; background:#fff; border-radius:26px 26px 0 0; z-index:41; display:flex; flex-direction:column; overflow:hidden; animation:sheetup .25s ease; }
@keyframes sheetup { from { transform:translate(-50%,40px); opacity:.6;} to { transform:translate(-50%,0); opacity:1;} }
.handle { width:44px; height:5px; border-radius:4px; background:rgba(0,0,0,.15); margin:12px auto 6px; flex-shrink:0; }
.sheet-head { display:flex; align-items:center; justify-content:space-between; padding:6px 20px 12px; }
.sheet-head .t { font-family:'Space Grotesk'; font-size:17px; font-weight:700; }
.sheet-head .x { font-size:18px; color:var(--muted); cursor:pointer; padding:4px 8px; }
.sheet-filters { display:flex; gap:8px; padding:0 20px 12px; }
.sf { font-size:11px; font-weight:600; padding:7px 13px; border-radius:18px; background:var(--surface); border:1px solid var(--border); color:var(--muted); cursor:pointer; }
.sf.sel { background:var(--ink); color:#fff; border-color:var(--ink); }
.mlist { overflow-y:auto; padding:0 12px 20px; }
.mrow { display:flex; align-items:center; gap:12px; padding:11px 10px; border-radius:14px; cursor:pointer; }
.mgroup { font-family:'Space Grotesk'; font-size:10.5px; font-weight:700; letter-spacing:2px; color:var(--muted); padding:14px 10px 6px; }
.mgroup:first-child { padding-top:2px; }
.mrow.sel { background:var(--surface); box-shadow:inset 0 0 0 1.5px var(--ink); }
.mrow.off { opacity:.45; cursor:default; }
.mrow .mi { width:38px; height:38px; border-radius:11px; background:var(--surface2); display:flex; align-items:center; justify-content:center; font-size:18px; flex-shrink:0; }
.mrow .mn { font-size:13px; font-weight:700; }
.mrow .md { font-size:10.5px; color:var(--muted); margin-top:2px; line-height:1.45; }
.mrow .check { margin-left:auto; width:22px; height:22px; border-radius:50%; background:var(--ink); color:#fff; font-size:12px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.tag { display:inline-block; font-size:8.5px; font-weight:700; padding:2px 7px; border-radius:6px; margin-left:6px; vertical-align:1px; letter-spacing:.5px; }
.tag.off { background:#fee2e2; color:#b91c1c; }

/* ---------- render ---------- */
.render-hero { margin:4px 18px 0; border-radius:18px; overflow:hidden; position:relative; height:300px; border:1px solid var(--border); background:var(--surface); }
.shimmer { position:absolute; inset:0; background:radial-gradient(circle at 25% 20%, rgba(0,0,0,.05), transparent 50%), linear-gradient(135deg,#f4f4f6,#e4e4e7); }
.shimmer::after { content:""; position:absolute; inset:0; background:linear-gradient(100deg, transparent 30%, rgba(255,255,255,.7) 50%, transparent 70%); animation:sheen 2.2s infinite; }
@keyframes sheen { 0%{transform:translateX(-100%);} 100%{transform:translateX(100%);} }
.render-center { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px; z-index:2; }
.ring { width:86px; height:86px; border-radius:50%; border:3px solid rgba(0,0,0,.1); border-top-color:var(--ink); animation:spin 1.4s linear infinite; }
.pct { font-family:'Space Grotesk'; font-size:40px; font-weight:700; margin-top:6px; }
.rstatus { font-size:11px; color:var(--muted); letter-spacing:2px; font-weight:600; }
.pbar-wrap { position:absolute; left:18px; right:18px; bottom:20px; z-index:2; }
.pbar { height:5px; background:rgba(0,0,0,.1); border-radius:5px; overflow:hidden; }
.pbar > div { height:100%; width:0%; border-radius:5px; background:var(--ink); transition:width .5s ease; }
.steps { margin:16px 18px 0; display:flex; flex-direction:column; gap:11px; }
.step { display:flex; align-items:center; gap:11px; font-size:12.5px; font-weight:500; }
.step .ic { width:26px; height:26px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:12px; flex-shrink:0; font-weight:700; }
.step.done .ic { background:var(--ink); color:#fff; }
.step.doing .ic { border:1.5px solid var(--ink); color:var(--ink); }
.step.todo { color:var(--faint); }
.step.todo .ic { background:var(--surface2); color:var(--faint); border:1px solid var(--border); }
.render-note { margin:16px 18px 0; font-size:11.5px; color:var(--muted); text-align:center; line-height:1.7; }
.result-media { margin:4px 18px 0; border-radius:18px; overflow:hidden; border:1px solid var(--border); background:#000; }
.result-media video, .result-media img { width:100%; display:block; max-height:420px; object-fit:contain; background:#000; }
.prompt-card { margin:12px 18px 0; background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:14px 15px; }
.prompt-card .pl { font-size:10px; font-weight:800; color:var(--muted); letter-spacing:1.5px; margin-bottom:6px; font-family:'Space Grotesk'; }
.prompt-card .pt { font-size:13px; line-height:1.6; }
.action-row { display:flex; gap:10px; margin:14px 18px 0; }
.abtn { flex:1; border:none; border-radius:14px; padding:13px 0; font-size:13px; font-weight:700; cursor:pointer; text-decoration:none; text-align:center; display:block; }
.abtn.primary { background:var(--ink); color:#fff; }
.abtn.ghost { background:var(--surface); color:var(--text); border:1px solid var(--border); }
.recreate-link { margin:14px 18px 0; text-align:center; font-size:12.5px; color:var(--muted); font-weight:600; cursor:pointer; }

/* ---------- library ---------- */
.profrow { display:flex; align-items:center; gap:12px; padding:4px 18px 14px; }
.avatar { width:48px; height:48px; border-radius:50%; background:var(--ink); color:#fff; display:flex; align-items:center; justify-content:center; font-family:'Space Grotesk'; font-weight:700; font-size:18px; flex-shrink:0; }
.pname { font-size:14.5px; font-weight:700; }
.vip { font-size:9px; font-weight:700; letter-spacing:2px; color:var(--ink); margin-top:4px; border:1.5px solid var(--ink); display:inline-block; padding:3px 9px; border-radius:8px; }
.credcard { margin:0 18px 6px; background:var(--ink); color:#fff; border-radius:18px; padding:15px 16px; display:flex; align-items:center; justify-content:space-between; box-shadow:0 12px 28px rgba(0,0,0,.22); }
.credcard .n { font-family:'Space Grotesk'; font-size:26px; font-weight:700; }
.credcard .l { font-size:9.5px; color:rgba(255,255,255,.6); letter-spacing:2px; margin-top:3px; }
.topup { border:none; border-radius:12px; padding:11px 20px; font-weight:700; font-size:12.5px; color:var(--ink); background:#fff; cursor:pointer; }
.tabs { display:flex; gap:22px; padding:12px 18px 10px; font-size:12.5px; font-weight:600; color:var(--muted); }
.tabs .tab { cursor:pointer; padding-bottom:6px; }
.tabs .sel { color:#000; border-bottom:2px solid #000; }
.lib-grid { display:grid; grid-template-columns:1fr 1fr 1fr; gap:8px; padding:2px 18px 18px; }
.lib-grid .vcard { aspect-ratio:3/4.2; border-radius:10px; }
.lib-grid .vcard .playov div { width:30px; height:30px; font-size:11px; }

/* ---------- topup ---------- */
.ratecard { margin:4px 18px 16px; background:var(--ink); color:#fff; border-radius:18px; padding:18px; text-align:center; box-shadow:0 12px 28px rgba(0,0,0,.22); }
.ratecard .r { font-family:'Space Grotesk'; font-size:24px; font-weight:700; }
.ratecard .rs { font-size:11px; color:rgba(255,255,255,.6); letter-spacing:1.5px; margin-top:4px; }
.pkgs { display:flex; flex-direction:column; gap:10px; padding:0 18px; }
.pkg { display:flex; align-items:center; gap:12px; background:var(--surface); border:1.5px solid var(--border); border-radius:16px; padding:14px 15px; cursor:pointer; }
.pkg.sel { border-color:var(--ink); background:#fff; box-shadow:0 0 0 1px var(--ink) inset; }
.pkg .radio { width:20px; height:20px; border-radius:50%; border:2px solid rgba(0,0,0,.25); flex-shrink:0; }
.pkg.sel .radio { border-color:var(--ink); background:var(--ink); box-shadow:inset 0 0 0 4px #fff; }
.pkg .pa { font-size:15px; font-weight:800; font-family:'Space Grotesk'; }
.pkg .pp { font-size:12.5px; color:var(--muted); margin-top:2px; }
.pkg .best { margin-left:auto; font-size:9px; font-weight:800; letter-spacing:1px; background:var(--ink); color:#fff; padding:4px 9px; border-radius:8px; }
.conv { margin:16px 18px 0; background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:14px 15px; }
.conv .ct { font-family:'Space Grotesk'; font-size:10px; font-weight:700; letter-spacing:2px; color:var(--muted); margin-bottom:10px; }
.conv .cr { display:flex; justify-content:space-between; font-size:12.5px; font-weight:600; padding:5px 0; }
.conv .cr span:last-child { color:var(--muted); }
.paybtn { margin:16px 18px 0; border:none; border-radius:16px; padding:16px; background:var(--ink); color:#fff; font-family:'Space Grotesk'; font-size:14px; font-weight:700; letter-spacing:1.5px; box-shadow:0 10px 28px rgba(0,0,0,.25); cursor:pointer; width:calc(100% - 36px); }
.paybtn:disabled { opacity:.55; }
.paynote { margin:10px 18px 0; font-size:11px; color:var(--muted); text-align:center; line-height:1.7; }
.qrbox { margin:16px 18px 0; background:var(--surface); border:1px solid var(--border); border-radius:18px; padding:20px; text-align:center; }
.qrbox .qt { font-family:'Space Grotesk'; font-weight:700; font-size:14px; margin-bottom:4px; }
.qrbox .qs { font-size:12px; color:var(--muted); margin-bottom:14px; }
#qr-canvas { display:inline-block; background:#fff; padding:12px; border-radius:12px; border:1px solid var(--border); }
#qr-canvas img, #qr-canvas canvas { display:block; }
.proof-ok { margin:16px 18px 0; background:#f0fdf4; border:1px solid #bbf7d0; border-radius:16px; padding:18px; text-align:center; }
.proof-ok .big { font-size:34px; margin-bottom:8px; }
.proof-ok .t { font-weight:700; font-size:14px; margin-bottom:6px; }
.proof-ok .s { font-size:12px; color:var(--muted); line-height:1.6; }

/* ---------- modal ---------- */
#modal-bg { position:fixed; inset:0; background:rgba(0,0,0,.5); z-index:50; }
#modal { position:fixed; inset:0; z-index:51; display:flex; align-items:flex-end; justify-content:center; }
#modal-card { width:100%; max-width:480px; max-height:88dvh; overflow-y:auto; background:#fff; border-radius:22px 22px 0 0; padding:14px 18px calc(20px + env(safe-area-inset-bottom)); animation:sheetup .25s ease; }
#modal-card video, #modal-card img.preview { width:100%; border-radius:14px; background:#000; max-height:52dvh; object-fit:contain; display:block; }
.modal-title { font-family:'Space Grotesk'; font-weight:700; font-size:15px; margin:12px 0 4px; }
.modal-sub { font-size:12px; color:var(--muted); margin-bottom:12px; }

/* ---------- toast ---------- */
#toast {
  position:fixed; left:50%; transform:translateX(-50%); bottom:calc(96px + env(safe-area-inset-bottom));
  max-width:440px; width:calc(100% - 36px); z-index:70;
  background:#0A0A0B; color:#fff; font-size:13px; font-weight:500; line-height:1.5;
  padding:13px 16px; border-radius:14px; box-shadow:0 12px 30px rgba(0,0,0,.3);
  animation:fadein .2s ease; text-align:center;
}
#toast.err { background:#7f1d1d; }
