:root {
  --bg: #0A0A0A; --surface: #16131B; --raised: #211C28; --border: #2E2836;
  --accent-a: #D61C8C; --accent-b: #FF6AAE; --gradient: linear-gradient(135deg, #D61C8C, #FF6AAE);
  --gold: #F2B630; --text: #F6EFFA; --text-2: #A79BB3; --error: #FF5A6A; --success: #3DDC97;
  --r-s: 12px; --r-m: 16px; --r-l: 24px; --r-pill: 999px;
  --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #050505; color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
a { color: var(--accent-b); text-decoration: none; }
.hidden { display: none !important; }

.phone { position: relative; max-width: 430px; height: 100%; margin: 0 auto; background: var(--bg);
  display: flex; flex-direction: column; overflow: hidden; }
@media (min-width: 600px) {
  body { display: flex; align-items: center; justify-content: center; padding: 24px 0; }
  .phone { width: 390px; height: min(844px, calc(100vh - 48px)); border-radius: 40px;
    border: 1px solid var(--border); box-shadow: 0 30px 80px rgba(214,28,140,.12), 0 0 0 10px #111; }
}

header { padding: calc(14px + var(--safe-top)) 20px 10px; display: flex; align-items: center; gap: 10px; flex: none; }
.logo { width: 30px; height: 30px; border-radius: 10px; background: var(--gradient); display: grid; place-items: center; font-weight: 800; font-size: 15px; color: #fff; }
.brand { font-size: 20px; font-weight: 800; letter-spacing: .3px; color: var(--text); }
.chip { font-size: 12px; padding: 5px 11px; border-radius: var(--r-pill); white-space: nowrap; }
.chip.mode { margin-left: auto; font-size: 10px; color: var(--text-2); border: 1px solid var(--border); padding: 3px 8px; }
.chip.coins, .chip.login { margin-left: auto; }
.chip.mode:not(.hidden) ~ .chip { margin-left: 0; }
.chip.coins { color: var(--gold); border: 1px solid rgba(242,182,48,.4); background: rgba(242,182,48,.08); font-weight: 700; }
.chip.login { color: #fff; background: var(--gradient); font-weight: 700; }

main { flex: 1; overflow-y: auto; padding: 4px 20px 16px; scrollbar-width: none; }
main::-webkit-scrollbar { display: none; }
.view { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

h1 { font-size: 25px; line-height: 1.25; margin: 6px 0 4px; font-weight: 800; }
h2 { font-size: 15px; margin: 22px 0 10px; display: flex; justify-content: space-between; align-items: baseline; }
h2 small { color: var(--text-2); font-weight: 400; font-size: 12px; }
.sub { color: var(--text-2); font-size: 13px; margin: 0 0 14px; line-height: 1.5; }
.muted { color: var(--text-2); font-size: 12px; }

/* hero */
.hero { border-radius: var(--r-l); padding: 18px; margin-top: 4px;
  background: radial-gradient(120% 120% at 100% 0%, rgba(255,106,174,.28), rgba(214,28,140,.06) 55%, transparent), var(--surface);
  border: 1px solid var(--border); }
.hero h1 { font-size: 23px; }
.steps { display: flex; gap: 8px; margin-top: 12px; }
.steps div { flex: 1; font-size: 11px; color: var(--text-2); background: var(--raised); border-radius: var(--r-s); padding: 8px; line-height: 1.35; }
.steps b { display: block; color: var(--accent-b); font-size: 13px; }

/* template grid */
.tgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tcard { position: relative; border-radius: var(--r-m); overflow: hidden; background: var(--surface); border: 2px solid transparent;
  text-align: left; padding: 0; display: block; width: 100%; }
.tcard.selected { border-color: transparent; background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--gradient) border-box; }
.tmedia { position: relative; aspect-ratio: 9 / 16; background: linear-gradient(160deg, #3A0F2A, #16131B); overflow: hidden; }
.tmedia video, .tmedia img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tmedia .fallback { position: absolute; inset: 0; display: grid; place-items: center; font-size: 40px; font-weight: 800; color: rgba(255,255,255,.25); }
.tbadges { position: absolute; left: 8px; right: 8px; top: 8px; display: flex; justify-content: space-between; gap: 6px; }
.badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: var(--r-pill); background: rgba(10,10,10,.65); backdrop-filter: blur(6px); }
.badge.cost { color: var(--gold); }
.tcard .tinfo { position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 10px 10px; background: linear-gradient(to top, rgba(0,0,0,.85), transparent); }
.tcard .ttitle { font-size: 14px; font-weight: 700; }
.tcard .tdesc { font-size: 11px; color: #D9CEE3; margin-top: 2px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tcard .check { position: absolute; right: 8px; bottom: 8px; width: 24px; height: 24px; border-radius: 50%; background: var(--gradient); display: none; place-items: center; font-size: 13px; color: #fff; }
.tcard.selected .check { display: grid; }
.trow { display: grid; grid-auto-flow: column; grid-auto-columns: 34%; gap: 10px; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
.trow::-webkit-scrollbar { display: none; }
.trow .tdesc { display: none; }

/* photo */
.photo-card { position: relative; border-radius: var(--r-l); background: var(--surface); border: 1px dashed var(--border);
  min-height: 200px; width: 100%; overflow: hidden; display: grid; place-items: center; }
.photo-card.filled { border-style: solid; background: #000; min-height: 0; }
.photo-card img { display: block; width: 100%; height: auto; max-height: 340px; object-fit: contain; }
.photo-empty { text-align: center; color: var(--text-2); font-size: 13px; padding: 20px; }
.photo-empty .plus { width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 12px; background: var(--raised); display: grid; place-items: center; font-size: 28px; color: var(--accent-b); }
.photo-info { font-size: 12px; color: var(--text-2); margin-top: 6px; }
.row { display: flex; gap: 10px; margin-top: 10px; }
.pill { flex: 1; height: 42px; border-radius: var(--r-pill); background: var(--raised); border: 1px solid var(--border); font-size: 14px; font-weight: 600; }
.pill:active { transform: scale(.98); }
.tip { font-size: 12px; color: var(--text-2); margin-top: 8px; line-height: 1.5; }
.specs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.spec { font-size: 12px; padding: 6px 12px; border-radius: var(--r-pill); background: var(--raised); color: var(--text-2); border: 1px solid var(--border); }

/* dock */
.dock { padding: 10px 20px calc(12px + var(--safe-bottom)); flex: none; background: var(--bg); border-top: 1px solid rgba(46,40,54,.6); }
.dock .meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
.dock .meta b { color: var(--gold); }
.cta { width: 100%; height: 52px; border-radius: var(--r-pill); background: var(--gradient); color: #fff; font-size: 16px; font-weight: 800; letter-spacing: .3px; box-shadow: 0 10px 30px rgba(214,28,140,.35); display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.cta:active { transform: translateY(1px); }
.cta.secondary { background: var(--raised); color: var(--text); box-shadow: none; border: 1px solid var(--border); }
.cta.warn { background: var(--raised); color: var(--gold); border: 1px solid rgba(242,182,48,.45); box-shadow: none; }
.cta.small { height: 44px; font-size: 14px; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* forms */
.form { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field .hint { font-size: 11px; color: var(--text-2); margin-top: 4px; }
.field .ferr { font-size: 12px; color: var(--error); margin-top: 4px; }
.input { width: 100%; height: 48px; border-radius: var(--r-s); background: var(--surface); border: 1px solid var(--border); color: var(--text); padding: 0 14px; font: inherit; font-size: 16px; outline: none; }
.input:focus { border-color: var(--accent-b); }
.input.bad { border-color: var(--error); }
.phone-row { display: flex; gap: 8px; }
.phone-row select { width: 108px; flex: none; appearance: none; padding-right: 8px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 64px; }
.pw-toggle { position: absolute; right: 6px; top: 6px; height: 36px; padding: 0 10px; border-radius: 8px; font-size: 12px; color: var(--text-2); }
.switch-link { text-align: center; font-size: 13px; margin-top: 4px; }
.gate-note { font-size: 12px; color: var(--gold); background: rgba(242,182,48,.08); border: 1px solid rgba(242,182,48,.3); border-radius: var(--r-s); padding: 10px 12px; margin-bottom: 4px; }

/* generating */
.ring { width: 120px; height: 120px; margin: 20px auto 16px; position: relative; }
.ring svg { transform: rotate(-90deg); }
.ring .pct { position: absolute; inset: 0; display: grid; place-items: center; font-size: 26px; font-weight: 800; }
.stages { margin: 16px 0; }
.stage { display: flex; align-items: center; gap: 12px; padding: 10px 0; color: var(--text-2); font-size: 14px; }
.stage .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); display: grid; place-items: center; font-size: 12px; flex: none; }
.stage.active { color: var(--text); font-weight: 600; }
.stage.active .dot { border-color: transparent; background: var(--gradient); color: #fff; }
.stage.done .dot { border-color: var(--success); color: var(--success); }
.note { font-size: 12px; color: var(--text-2); text-align: center; line-height: 1.6; margin-top: 8px; }

/* result */
.player { width: 100%; aspect-ratio: 9 / 16; max-height: 60vh; margin: 0 auto; border-radius: var(--r-l); overflow: hidden; background: #000; border: 1px solid var(--border); }
.player video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.actions .full { grid-column: 1 / -1; }

.banner { border-radius: var(--r-m); padding: 12px 14px; font-size: 13px; line-height: 1.5; margin-top: 12px; word-break: break-word; }
.banner.err { background: rgba(255,90,106,.1); border: 1px solid rgba(255,90,106,.4); color: #FFB3BA; }
.banner.ok { background: rgba(61,220,151,.08); border: 1px solid rgba(61,220,151,.3); color: var(--success); }
.banner.info { background: var(--surface); border: 1px solid var(--border); color: var(--text-2); }
.banner.gold { background: rgba(242,182,48,.08); border: 1px solid rgba(242,182,48,.35); color: var(--gold); }
.banner button, .banner a { color: var(--accent-b); font-weight: 700; margin-left: 6px; }

/* library */
.hist { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-m); overflow: hidden; text-align: left; padding: 0; }
.hcard .thumb { position: relative; aspect-ratio: 9/16; background: #000 center/cover no-repeat; display: grid; place-items: center; color: rgba(255,255,255,.85); font-size: 13px; }
.hcard .thumb .st { position: absolute; left: 8px; top: 8px; }
.hcard .meta { padding: 8px 10px; font-size: 11px; color: var(--text-2); }
.hcard .meta b { display: block; color: var(--text); font-size: 13px; margin-bottom: 2px; }
.st { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: var(--r-pill); background: rgba(10,10,10,.7); }
.st.completed { color: var(--success); } .st.failed { color: var(--error); } .st.queued, .st.in_progress, .st.submitting { color: var(--accent-b); }
.empty { text-align: center; color: var(--text-2); font-size: 13px; padding: 36px 16px; line-height: 1.6; }
.empty .cta { margin-top: 16px; }
.skeleton { background: linear-gradient(90deg, var(--surface), var(--raised), var(--surface)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--r-m); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* me / store */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-m); padding: 14px; margin-top: 12px; }
.kv { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; font-size: 14px; }
.kv span { color: var(--text-2); font-size: 13px; }
.big-coins { font-size: 30px; font-weight: 800; color: var(--gold); }
.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.list li:last-child { border-bottom: 0; }
.list .r { color: var(--text-2); font-size: 11px; margin-top: 2px; }
.list .order-pay { margin-left: auto; align-self: center; font-weight: 700; white-space: nowrap; }
.list .order-pay + .st { align-self: center; }
.plus-d { color: var(--success); font-weight: 700; white-space: nowrap; } .minus-d { color: var(--error); font-weight: 700; white-space: nowrap; }
.tiers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tier { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-m); padding: 18px 12px 12px; text-align: center; }
.tier.pop { background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--gradient) border-box; border: 2px solid transparent; }
.tier .tb { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); font-size: 10px; font-weight: 800; padding: 3px 9px; border-radius: var(--r-pill); background: var(--gradient); color: #fff; white-space: nowrap; }
.tier .tc { font-size: 26px; font-weight: 800; color: var(--gold); }
.tier .tbn { font-size: 12px; color: var(--success); min-height: 16px; }
.tier .tp { font-size: 14px; margin: 6px 0 10px; color: var(--text); }
.tier .cta { height: 38px; font-size: 13px; }
.danger { color: var(--error) !important; }

nav { display: flex; flex: none; border-top: 1px solid var(--border); background: var(--surface); padding-bottom: var(--safe-bottom); }
nav button { flex: 1; padding: 9px 0; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; color: var(--text-2); }
nav button.active { color: var(--accent-b); }
nav .ico { font-size: 18px; line-height: 1; }

.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: #2A2430; color: var(--text); padding: 10px 18px; border-radius: var(--r-pill); font-size: 13px; border: 1px solid var(--border); z-index: 50; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; max-width: 86%; text-align: center; line-height: 1.4; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-6px); }
.toast.err { border-color: rgba(255,90,106,.5); color: #FFB3BA; }

/* invite */
.invite-link { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; color: inherit; font: inherit; cursor: pointer; margin-top: 12px; }
.invite-link .il-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--gradient); display: grid; place-items: center; color: #fff; font-size: 18px; flex: none; }
.invite-link .il-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.invite-link .il-text .muted { font-size: 12px; }
.invite-link .il-arrow { font-size: 22px; color: var(--text-2); }
.invite-note { color: var(--accent-b); background: rgba(214,28,140,.10); border-color: rgba(255,106,174,.35); }
.invite-url { margin-top: 6px; font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.stat { background: var(--raised); border-radius: var(--r-s); padding: 12px 8px; text-align: center; }
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 11px; color: var(--text-2); }
.empty.small { padding: 16px 8px; }
.share-card { margin-top: 14px; }
.share-img { display: block; width: 100%; max-width: 280px; margin: 8px auto; border-radius: 14px; aspect-ratio: 9 / 16; }
.how { color: var(--text-2); font-size: 13px; line-height: 1.8; padding-left: 20px; }

/* store pricing */
.gst-note { font-size: 12px; color: var(--text-2); margin: 4px 0 10px; }
.breakdown { margin-top: 8px; }
.breakdown .kv.total { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 8px; }
.breakdown .kv.total b { font-size: 16px; }

/* legal links, consent, account deletion */
.legal-a { color: var(--accent-b); text-decoration: underline; text-underline-offset: 2px; }
.legal-foot { margin: 28px 0 8px; padding-top: 16px; border-top: 1px solid var(--border); text-align: center; }
.legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; font-size: 12px; }
.legal-links .legal-a { color: var(--text-2); text-decoration: none; }
.legal-foot .copy { color: var(--text-2); font-size: 11px; margin-top: 10px; }
.legal-inline { font-size: 12px; color: var(--text-2); margin: 12px 0 0; line-height: 1.5; }
.agree-field { margin-top: 2px; }
.agree { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.45; color: var(--text); cursor: pointer; }
.agree input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--accent-a); }
.legal-group + .legal-group { margin-top: 12px; }
.legal-list { list-style: none; margin: 4px 0 0; padding: 0; }
.legal-list li { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14px; color: var(--text-2); }
.legal-list li:last-child { border-bottom: 0; }
.legal-list .legal-a { color: var(--text); text-decoration: none; flex: 1; }
.del-list { margin: 10px 0; padding-left: 20px; font-size: 13px; color: var(--text-2); }
.del-list li { margin: 4px 0; }
.cta.danger-solid { background: var(--error); color: #fff; }
.small-note { margin: 8px 2px 0; }