/* ============ TOKENS ============ */
:root {
  --bg: #0a0a12;
  --bg-glow: radial-gradient(1200px 500px at 70% -10%, rgba(124, 92, 255, 0.14), transparent 60%),
             radial-gradient(900px 400px at 10% 110%, rgba(255, 77, 143, 0.08), transparent 60%);
  --surface: #13131f;
  --surface-2: #1a1a2b;
  --border: #272740;
  --text: #eceaf6;
  --muted: #9a97b8;
  --accent: #7c5cff;
  --accent-2: #ff4d8f;
  --cyan: #38e1ff;
  --lime: #b6f24a;
  --gold: #ffc24b;
  --danger: #ff5c5c;
  --radius: 16px;
  --font-display: "Clash Display", "Space Grotesk", sans-serif;
  --font-body: "Satoshi", "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html { -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }

body {
  min-height: 100dvh;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-glow);
  background-attachment: fixed;
  font-size: 15px;
  line-height: 1.55;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; }
h1 { font-size: clamp(26px, 4vw, 38px); }
h2 { font-size: 19px; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select { font: inherit; }
canvas { display: block; }

/* ============ TOPBAR ============ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 20px;
  padding: 14px 28px;
  background: rgba(10, 10, 18, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; margin-right: 8px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 18px rgba(124, 92, 255, 0.45);
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; left: 7px; top: 9px;
  width: 12px; height: 9px;
  border: 2.5px solid #fff; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  border-top: none;
}
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 19px; letter-spacing: 0.01em; }
.topnav { display: flex; gap: 4px; flex: 1; }
.topnav a {
  padding: 7px 14px; border-radius: 999px; color: var(--muted);
  font-weight: 500; font-size: 14px; transition: all 0.18s;
}
.topnav a:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.topnav a.is-active { color: #fff; background: linear-gradient(135deg, rgba(124,92,255,0.25), rgba(255,77,143,0.25)); border: 1px solid rgba(124,92,255,0.5); }
.plan-pill {
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 6px 12px; border-radius: 999px;
  color: var(--muted); border: 1px solid var(--border); background: var(--surface);
}
.plan-pill.is-premium {
  color: #fff; border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 14px rgba(255, 77, 143, 0.35);
}

/* ============ LAYOUT ============ */
main { max-width: 1280px; margin: 0 auto; padding: 34px 28px 60px; }
.view { animation: viewIn 0.28s ease; }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.view-head { margin-bottom: 26px; }
.view-sub { color: var(--muted); margin-top: 6px; max-width: 640px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.badge {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 5px 10px; border-radius: 999px;
  color: var(--accent); background: rgba(124, 92, 255, 0.12); border: 1px solid rgba(124, 92, 255, 0.35);
}
.badge-dim { color: var(--muted); background: var(--surface-2); border-color: var(--border); }
.mini-badge {
  font-size: 9px; font-weight: 800; vertical-align: super; color: var(--gold);
  letter-spacing: 0.08em;
}

.studio-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.art-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 20px; align-items: start; }
.video-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; align-items: start; }

/* ============ FORMS ============ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.field > span output { color: var(--accent); font-family: var(--font-display); }
input[type="text"], select {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 10px 12px; width: 100%;
  transition: border-color 0.18s;
}
input[type="text"]:focus, select:focus { outline: none; border-color: var(--accent); }
input[type="range"] { width: 100%; accent-color: var(--accent); margin-top: 4px; }
select option[data-premium] { color: var(--gold); }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  padding: 11px 18px; border-radius: 12px; font-weight: 700; font-size: 14px;
  transition: all 0.18s; display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid transparent;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; box-shadow: 0 6px 22px rgba(124, 92, 255, 0.35);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 26px rgba(124, 92, 255, 0.5); }
.btn-ghost { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.btn-ghost:hover:not(:disabled) { border-color: var(--accent); }
.hint { color: var(--muted); font-size: 13px; margin-top: 12px; min-height: 18px; }

/* ============ STUDIO ============ */
.waveform {
  width: 100%; height: 90px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  margin-bottom: 14px;
}
.divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
  margin: 18px 0;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.upload-zone {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  border: 1.5px dashed var(--border); border-radius: var(--radius);
  padding: 22px 16px; text-align: center; cursor: pointer;
  transition: all 0.18s; background: rgba(255,255,255,0.015);
}
.upload-zone:hover { border-color: var(--accent); background: rgba(124,92,255,0.06); }
.upload-zone.compact { padding: 14px; }
.uz-icon { font-size: 26px; }
.uz-title { font-weight: 700; font-size: 14px; }
.uz-sub { color: var(--muted); font-size: 12px; }

.voice-box { display: flex; flex-direction: column; gap: 10px; }
.voice-copy { color: var(--muted); font-size: 13px; }

/* ============ ART ============ */
.art-stage {
  border-radius: 12px; overflow: hidden; border: 1px solid var(--border);
  background: #000; margin-bottom: 16px;
}
.art-stage canvas { width: 100%; height: auto; }
.style-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 8px; }
.style-chip {
  padding: 10px 12px; border-radius: 10px; font-size: 13px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border); text-align: left;
  transition: all 0.15s;
}
.style-chip:hover { border-color: var(--accent); }
.style-chip.is-active { border-color: var(--accent); background: rgba(124,92,255,0.14); color: #fff; }
.style-chip.locked { color: var(--muted); }
.style-chip.locked.is-active { color: var(--gold); }

/* ============ VIDEO ============ */
.video-stage {
  position: relative; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--border); background: #000; margin-bottom: 16px;
}
.video-stage canvas { width: 100%; height: auto; }
.video-hud {
  position: absolute; top: 12px; right: 14px;
  display: flex; align-items: center; gap: 7px;
  font-family: var(--font-display); font-weight: 700; font-size: 14px; color: #fff;
  background: rgba(0,0,0,0.5); padding: 5px 12px; border-radius: 999px;
  letter-spacing: 0.1em;
}
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.img-thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.img-thumb { position: relative; }
.img-thumb img { width: 64px; height: 40px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.img-thumb button {
  position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--danger); color: #fff; font-size: 10px; line-height: 1;
}

/* ============ PRICING ============ */
.pricing-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; align-items: stretch; }
.price-card { display: flex; flex-direction: column; gap: 14px; position: relative; }
.price-card.featured {
  border-color: var(--accent);
  box-shadow: 0 10px 40px rgba(124, 92, 255, 0.25);
}
.price-tier { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.price-num { font-family: var(--font-display); font-size: 40px; font-weight: 600; }
.price-num .per { font-size: 15px; color: var(--muted); font-family: var(--font-body); font-weight: 500; }
.price-features { list-style: none; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.price-features li { font-size: 13.5px; color: var(--muted); padding-left: 22px; position: relative; }
.price-features li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
.price-card .btn { justify-content: center; }
.price-card .btn:disabled {
  opacity: 1;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  box-shadow: none;
}
.price-card .btn[data-current-plan="true"] {
  color: var(--text);
  border-color: var(--accent);
}
.demo-note { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 22px; }

/* ============ MODALS ============ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(5, 5, 10, 0.72); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal { width: min(480px, 100%); position: relative; animation: viewIn 0.2s ease; }
.modal-close {
  position: absolute; top: 14px; right: 14px; width: 30px; height: 30px;
  border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 13px;
}
.modal-close:hover { border-color: var(--danger); color: var(--danger); }
.modal-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 18px; }

/* ============ TOASTS ============ */
.toast-stack { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--surface-2); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 12px 16px; border-radius: 12px; font-size: 13.5px; font-weight: 500;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4); animation: viewIn 0.25s ease;
  max-width: 320px;
}
.toast.is-premium { border-left-color: var(--accent-2); }

/* ============ FOOTER ============ */
.footer { max-width: 1280px; margin: 0 auto; padding: 0 28px 34px; color: var(--muted); font-size: 12.5px; }

/* ============ RESPONSIVE ============ */
@media (max-width: 1020px) {
  .studio-grid, .art-grid, .video-grid { grid-template-columns: 1fr; }
  .pricing-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
  .topnav { order: 3; flex: 1 1 100%; width: 100%; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav a { flex-shrink: 0; white-space: nowrap; }
  .brand { flex-shrink: 0; }
  .top-status { margin-left: auto; }
  main { padding: 22px 16px 40px; }
  .form-grid { grid-template-columns: 1fr; }
  .pricing-grid { grid-template-columns: 1fr; }
  .style-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Development v3 account UI */
.top-status { display:flex; align-items:center; gap:10px; }
.account-actions { margin-top:16px; }
#account-form .field { margin-bottom:12px; }
#account-message { overflow-wrap:anywhere; }
@media(max-width:640px) { #account-open { padding:7px 10px; font-size:12px; } }

/* ============ LEGAL PAGES & FOOTER LINKS ============ */
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 8px; }
.footer-links a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.footer-links a:hover { color: var(--text); }
.legal-body { min-height: 100vh; }
.legal { max-width: 820px; margin: 32px auto 24px; padding: 28px 32px 36px; line-height: 1.65; }
.legal h1 { font-size: clamp(28px, 4vw, 38px); margin: 18px 0 6px; }
.legal h2 { font-size: 19px; margin: 28px 0 8px; }
.legal p, .legal li { color: var(--text); font-size: 15.5px; }
.legal p { margin: 10px 0; }
.legal ul { padding-left: 22px; margin: 8px 0; }
.legal li { margin: 5px 0; }
.legal a { color: var(--cyan); overflow-wrap: anywhere; }
.legal strong { color: #fff; }
.legal-nav { display: flex; flex-wrap: wrap; gap: 8px 16px; padding-bottom: 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
.legal-nav a { color: var(--muted); text-decoration: none; }
.legal-nav a:hover { color: var(--text); }
.legal-nav a:first-child { color: var(--text); font-weight: 700; margin-right: auto; }
@media (max-width: 600px) { .legal { margin: 0; border-radius: 0; padding: 20px 18px 28px; } .legal-nav a:first-child { width: 100%; } }
.nowrap { white-space: nowrap; }

/* Account self-service: billing and deletion */
.account-billing-panel { margin-top: 14px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.account-billing-panel .hint { margin-top: 0; }
.account-links { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 4px; }
.account-links a { color: var(--cyan); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.account-note { font-size: 12px; margin-top: 10px !important; }
.account-danger { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.btn-link-danger { background: none; border: 0; padding: 0; color: var(--danger); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.btn-link-danger:focus-visible { outline: 2px solid var(--danger); outline-offset: 3px; border-radius: 4px; }
#account-delete-panel .field { margin-top: 12px; }
.btn-danger { background: var(--danger); color: #fff; border: 1px solid var(--danger); }
.btn-danger:disabled { opacity: 0.45; cursor: not-allowed; }
.modal { max-height: calc(100vh - 32px); overflow-y: auto; }

.btn-link { background: none; border: 0; padding: 0; margin-top: 12px; color: var(--muted, inherit); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.btn-link:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; border-radius: 4px; }
#account-recovery .field { margin-top: 8px; }

.checkout-agree a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
