:root {
  --brand-deep: #200011;
  --brand: #a34580;
  --brand-bright: #da68ad;
  --brand-pale: #f2a7d2;
  --ink: #fffafd;
  --muted: #a99aa3;
  --surface: #1a1117;
  --surface-raised: #241720;
  --surface-soft: #160d13;
  --line: rgba(255, 245, 251, .1);
  --line-strong: rgba(227, 113, 179, .28);
  --black: #0d070b;
  --danger: #ff6f89;
  --success: #73d6a0;
}

* { box-sizing: border-box; }
html { background: var(--black); }
body {
  margin: 0; min-height: 100vh; color: var(--ink);
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    radial-gradient(ellipse at 50% -14%, rgba(163,69,128,.2), transparent 38%),
    linear-gradient(180deg, #16020d 0, var(--black) 26%, #0a0608 100%);
  background-size: 100% 52px, auto, auto;
  font-family: "Avenir Next", "Manrope", "Montserrat", sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:active { transform: translateY(1px); }
.ambient { position: fixed; z-index: 0; pointer-events: none; }
.ambient-one { width: 2px; height: 42vh; top: 8%; left: 7%; background: linear-gradient(transparent, rgba(218,104,173,.5), transparent); box-shadow: 0 0 32px rgba(218,104,173,.16); }
.ambient-two { width: 34vw; height: 1px; right: 0; bottom: 27%; background: linear-gradient(90deg, transparent, rgba(163,69,128,.45)); }
.shell { position: relative; z-index: 1; width: min(100%, 620px); margin: 0 auto; padding: max(22px, env(safe-area-inset-top)) 18px calc(104px + env(safe-area-inset-bottom)); }
.topbar, .section-head, .job-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.topbar { margin-bottom: 34px; animation: rise .4s ease both; }
.eyebrow, .section-kicker { display: block; margin: 0 0 8px; color: var(--brand-bright); font-size: 9px; font-weight: 800; letter-spacing: .22em; text-transform: uppercase; }
.topbar h1 { max-width: 390px; margin: 0; font-size: clamp(25px, 7vw, 35px); line-height: 1.02; letter-spacing: -.055em; }
.avatar { position: relative; display: grid; width: 48px; height: 48px; flex: 0 0 auto; place-items: center; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 10px; color: white; background: var(--brand-deep); box-shadow: inset 0 -3px 0 var(--brand); font-weight: 800; }
.ui-icon { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.view { display: none; }
.view.active { display: block; animation: rise .3s ease both; }
.hidden { display: none !important; }
.section-head { margin: 0 0 16px; }
.section-head.compact { margin: 0 0 16px; }
.section-head h2, .section-head h3, .plan-card h2, .project-hero h2 { margin: 0; }
.section-head h2 { font-size: 25px; letter-spacing: -.04em; }
.section-head h3 { font-size: 16px; letter-spacing: -.025em; }
.root-head { margin-bottom: 24px; }
.muted { color: var(--muted); font-size: 12px; }
.text-button, .back-button { border: 0; color: var(--brand-pale); background: transparent; cursor: pointer; font-size: 13px; font-weight: 700; }
.back-button { margin: 0 0 24px; padding: 0; }

.creation-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 9px; margin-bottom: 26px; }
.creation-card, .tool-card { position: relative; overflow: hidden; border: 1px solid var(--line); color: var(--ink); background: var(--surface); cursor: pointer; text-align: left; }
.creation-card { min-height: 138px; padding: 18px; border-radius: 15px; }
.creation-card::after { content: ""; position: absolute; right: -22px; bottom: -34px; width: 100px; height: 100px; border: 1px solid rgba(255,255,255,.07); border-radius: 50%; }
.creation-track { grid-column: 1 / -1; min-height: 152px; border-color: rgba(218,104,173,.25); background: linear-gradient(90deg, rgba(32,0,17,.12), transparent), linear-gradient(135deg, #4c1638, #1c1017 72%); }
.creation-track::before { content: ""; position: absolute; right: 20px; top: 22px; width: 72px; height: 72px; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; box-shadow: inset 0 0 0 15px rgba(0,0,0,.15), inset 0 0 0 17px rgba(255,255,255,.08); }
.creation-card strong, .creation-card small { position: relative; z-index: 1; display: block; }
.creation-card strong { margin: 24px 0 5px; font-size: 18px; letter-spacing: -.025em; }
.creation-track strong { margin-top: 25px; font-size: 24px; }
.creation-card small { color: #b9abb3; font-size: 12px; }
.creation-icon { position: relative; z-index: 1; display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid rgba(255,255,255,.12); border-radius: 9px; color: var(--brand-pale); background: rgba(255,255,255,.04); }
.creation-icon .ui-icon { width: 19px; height: 19px; }
.creation-text .creation-icon { color: #f4c3df; }
.availability-note { position: relative; margin-top: 8px; padding: 17px 18px 17px 21px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.availability-note::before { content: ""; position: absolute; inset: 14px auto 14px 0; width: 3px; background: var(--brand); }
.availability-note strong { font-size: 13px; }
.availability-note p { margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }

.balance-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 8px; }
.metric, .plan-card, .panel, .project-card, .profile-card { border: 1px solid var(--line); background: var(--surface); }
.metric { min-height: 122px; padding: 18px; border-radius: 14px; }
.metric-primary { border-color: rgba(218,104,173,.28); background: linear-gradient(145deg, #56203f, #24131e 82%); }
.metric span, .metric small { display: block; color: #b6a5af; font-size: 11px; }
.metric strong { display: block; margin: 14px 0 6px; font-size: 34px; line-height: 1; letter-spacing: -.06em; }
.plan-card { display: flex; align-items: center; justify-content: space-between; margin: 9px 0 28px; padding: 18px; border-radius: 14px; }
.plan-card h2, .project-hero h2 { letter-spacing: -.04em; }
.plan-card p, .project-hero p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.plan-mark { display: grid; width: 42px; height: 42px; place-items: center; color: var(--brand-pale); border: 1px solid var(--line-strong); border-radius: 10px; background: rgba(163,69,128,.1); }
.tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 30px; }
.tool-card { display: flex; align-items: center; min-height: 58px; padding: 11px 13px; border-radius: 11px; }
.tool-card > span { display: grid; width: 31px; height: 31px; margin-right: 10px; place-items: center; color: var(--brand-bright); }
.tool-card .ui-icon { width: 18px; height: 18px; }
.tool-card strong { font-size: 12px; }

.project-list { display: grid; gap: 8px; }
.project-card { position: relative; width: 100%; padding: 17px 44px 17px 17px; overflow: hidden; border-radius: 12px; color: var(--ink); text-align: left; cursor: pointer; animation: rise .3s ease both; }
.project-card::after { content: "↗"; position: absolute; right: 17px; top: 18px; color: var(--brand-bright); }
.project-card strong { display: block; margin: 7px 0; font-size: 16px; }
.project-card small { color: var(--muted); font-size: 11px; }
.project-card .favorite { color: var(--brand-pale); }
.project-search { margin: 0 0 13px; }
.empty { padding: 30px 20px; border: 1px dashed var(--line-strong); border-radius: 12px; color: var(--muted); text-align: center; }
.pager { display: flex; justify-content: center; align-items: center; gap: 18px; margin-top: 17px; color: var(--muted); font-size: 11px; letter-spacing: .15em; }
.icon-button { display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--surface); cursor: pointer; }
.icon-button:disabled { opacity: .28; }

.project-hero { margin-bottom: 18px; padding: 3px 2px 10px; }
.project-hero h2 { margin-top: 13px; font-size: clamp(29px, 8vw, 42px); line-height: 1; }
.pill { display: inline-flex; padding: 6px 9px; border: 1px solid var(--line-strong); border-radius: 5px; color: var(--brand-pale); background: rgba(163,69,128,.08); font-size: 8px; font-weight: 800; letter-spacing: .16em; }
.panel { margin-bottom: 9px; padding: 18px; border-radius: 13px; }
.settings-list { display: grid; }
.setting, .result-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.setting:first-child, .result-item:first-child { border-top: 0; }
.setting span { color: var(--muted); font-size: 12px; }
.setting strong { font-size: 12px; text-align: right; }
.setting > div p, .caption-group p { margin: 6px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; white-space: pre-wrap; }
.result-item { flex-wrap: wrap; }
.result-video { width: 100%; max-height: 62vh; border-radius: 9px; background: #000; }
.action-stack { display: grid; gap: 7px; margin: 16px 0 10px; }

.studio-hero { margin-bottom: 11px; }
.studio-form { display: grid; gap: 9px; }
.studio-form .panel { margin-bottom: 0; }
.form-panel { display: grid; gap: 14px; }
.field-grid, .effects-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.field { display: grid; gap: 7px; }
.field > span, .upload-field > span { color: #d8cbd3; font-size: 11px; font-weight: 700; }
.field input, .field select, .field textarea { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 9px; outline: 0; color: var(--ink); background: #100a0e; }
.field input, .field select { min-height: 47px; padding: 0 12px; }
.field textarea { padding: 12px; resize: vertical; line-height: 1.45; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(163,69,128,.13); }
.upload-field { position: relative; display: grid; gap: 7px; min-height: 82px; padding: 14px; overflow: hidden; border: 1px dashed rgba(218,104,173,.32); border-radius: 10px; background: rgba(163,69,128,.045); }
.upload-field > span { display: flex; align-items: center; gap: 7px; }
.upload-field .ui-icon { width: 16px; height: 16px; color: var(--brand-bright); }
.upload-field input { width: 100%; color: var(--muted); font-size: 11px; }
.upload-field small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 47px; padding: 0 3px; color: #d8cbd3; font-size: 12px; }
.toggle-row input { width: 21px; height: 21px; accent-color: var(--brand); }
.movie-fields { display: grid; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.movie-fields > div:first-child strong, .movie-fields > div:first-child small { display: block; }
.movie-fields > div:first-child strong { font-size: 12px; }
.movie-fields > div:first-child small { margin-top: 5px; color: var(--muted); font-size: 10px; }
.movie-choice-list { display: grid; gap: 8px; }
.movie-choice { padding: 11px; border: 1px solid var(--line-strong); border-radius: 9px; background: rgba(163,69,128,.035); }
.studio-submit { width: 100%; margin-top: 5px; }
.studio-submit:disabled { opacity: .55; }
.form-note { margin: 1px 12px 8px; color: var(--muted); font-size: 10px; line-height: 1.5; text-align: center; }

.primary-button, .secondary-button, .send-button, .danger-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 50px; border-radius: 10px; font-weight: 800; cursor: pointer; }
.primary-button { border: 1px solid #e47ab8; color: #18030f; background: var(--brand-bright); box-shadow: 0 10px 28px rgba(163,69,128,.18); }
.secondary-button { border: 1px solid var(--line); color: var(--ink); background: var(--surface-raised); }
.send-button { min-height: 38px; padding: 0 13px; border: 1px solid var(--brand); color: white; background: var(--brand); font-size: 11px; }
.danger-button { padding: 0 15px; border: 1px solid rgba(255,111,137,.3); color: #ff9daf; background: rgba(255,111,137,.07); }
.primary-button .ui-icon, .secondary-button .ui-icon, .danger-button .ui-icon { width: 17px; height: 17px; }

.profile-content { display: grid; gap: 9px; }
.profile-card { padding: 17px; border-radius: 12px; }
.profile-card h3, .profile-card p { margin: 0; }
.profile-card h3 { margin-bottom: 8px; font-size: 16px; }
.profile-card p { color: var(--muted); font-size: 12px; line-height: 1.55; }
.profile-card .action-stack { margin-bottom: 0; }
.profile-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.profile-stat { padding: 14px; border-left: 2px solid var(--brand); background: var(--surface-soft); }
.profile-stat strong, .profile-stat span { display: block; }
.profile-stat strong { margin-bottom: 5px; font-size: 21px; }
.profile-stat span { color: var(--muted); font-size: 10px; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.inline-actions button, .inline-actions a { min-height: 38px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--surface-raised); font: inherit; font-size: 11px; font-weight: 800; text-decoration: none; }
.error-text { margin: 12px 0 0; color: var(--danger); font-size: 12px; }
.error-view { padding: 60px 12px; text-align: center; }
.error-view.active { display: grid; justify-items: center; gap: 14px; }
.error-view h2, .error-view p { margin: 0; }
.error-view p { color: var(--muted); line-height: 1.5; }
.error-view .primary-button { width: 100%; margin-top: 12px; }
.error-orbit { display: grid; width: 64px; height: 64px; place-items: center; border: 1px solid rgba(255,111,137,.35); border-radius: 12px; color: var(--danger); background: rgba(255,111,137,.07); font-size: 26px; }

.bottom-nav { position: fixed; z-index: 8; left: 50%; bottom: max(9px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(3, 1fr); width: min(calc(100% - 24px), 596px); min-height: 65px; padding: 6px; transform: translateX(-50%); border: 1px solid rgba(255,255,255,.11); border-radius: 14px; background: rgba(21,13,18,.97); box-shadow: 0 18px 50px rgba(0,0,0,.48); }
.nav-item { display: grid; place-items: center; gap: 3px; border: 0; border-radius: 9px; color: #81747c; background: transparent; cursor: pointer; }
.nav-item > span { display: grid; place-items: center; }
.nav-item .ui-icon { width: 20px; height: 20px; }
.nav-item small { font-size: 9px; font-weight: 800; }
.nav-item.active { color: var(--ink); background: rgba(163,69,128,.15); }
.nav-item.active span { color: var(--brand-bright); }
.toast { position: fixed; z-index: 10; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); width: calc(100% - 36px); max-width: 520px; padding: 14px 16px; transform: translate(-50%, 120px); border: 1px solid var(--line-strong); border-radius: 10px; color: var(--ink); background: #2a1823; opacity: 0; transition: .22s ease; }
.toast.visible { transform: translate(-50%, 0); opacity: 1; }
.loader { position: fixed; z-index: 20; inset: 0; display: flex; align-items: center; justify-content: center; gap: 7px; background: rgba(13,7,11,.86); }
.loader.hidden { display: none; }
.loader span { width: 24px; height: 3px; background: var(--brand-bright); animation: level .75s ease-in-out infinite alternate; }
.loader span:nth-child(2) { width: 38px; animation-delay: .15s; }
.loader span:nth-child(3) { animation-delay: .3s; }

@keyframes rise { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
@keyframes level { to { transform: scaleX(.35); opacity: .35; } }
@media (max-width: 360px) {
  .balance-grid { grid-template-columns: 1fr; }
  .metric { min-height: 104px; }
  .tool-grid, .field-grid, .effects-grid { grid-template-columns: 1fr; }
  .creation-grid { grid-template-columns: 1fr; }
  .creation-track { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
