/* Design system ported from the ClearCut/ClearUp/ClearPix sibling family so
   this product shares the same visual language, extended with Studio
   tab/chat/library/video components this app needs that siblings didn't. */
:root {
  --bg: #0a0c12;
  --surface: rgba(20, 24, 38, 0.8);
  --card: rgba(28, 34, 52, 0.7);
  --yellow: #ffe050;
  --cyan: #06b6d4;
  --violet: #8b5cf6;
  --border: rgba(6, 182, 212, 0.3);
  --text: #ffffff;
  --text2: #94a3b8;
  --radius: 20px;
}
body.light {
  --bg: #f0f4f8;
  --surface: rgba(255,255,255,0.9);
  --card: rgba(255,255,255,0.95);
  --border: rgba(59,130,246,0.2);
  --text: #0f172a;
  --text2: #475569;
  --yellow: #f5cc00;
}
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.3s, color 0.3s;
}

/* HEADER */
header {
  position: sticky; top: 0; z-index: 999;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; height: 70px;
  background: rgba(10,12,18,0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
body.light header { background: rgba(255,255,255,0.92); }
.logo { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.logo-m {
  width: 38px; height: 38px; background: linear-gradient(135deg,#ffe050,#f59e0b);
  color: #000; border-radius: 10px; display: grid; place-items: center;
  font-weight: 900; font-size: 1.3rem; box-shadow: 0 4px 16px rgba(255,224,80,0.4);
}
.logo-name {
  font-size: 1.3rem; font-weight: 900;
  background: linear-gradient(135deg,#fff,#a5b4fc);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
body.light .logo-name { background: linear-gradient(135deg,#0f172a,#2563eb); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.nav-links { display: flex; gap: 28px; list-style: none; }
.nav-links a { color: var(--text2); text-decoration: none; font-weight: 600; font-size: 0.9rem; transition: color 0.2s; }
.nav-links a:hover { color: var(--text); }
.header-right { display: flex; align-items: center; gap: 10px; }
select.lang-sel, button.theme-btn {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 30px;
  padding: 7px 14px; font-size: 0.82rem; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: all 0.2s;
}
select.lang-sel:hover, button.theme-btn:hover { border-color: var(--yellow); box-shadow: 0 0 12px rgba(255,224,80,0.3); }
.btn-gold {
  background: linear-gradient(135deg,#ffe050,#f59e0b);
  color: #000; border: none; border-radius: 30px;
  padding: 10px 22px; font-weight: 800; font-size: 0.9rem;
  cursor: pointer; text-decoration: none; display: inline-block;
  transition: all 0.2s; box-shadow: 0 4px 18px rgba(255,224,80,0.35);
}
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(255,224,80,0.55); }
.btn-gold:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

/* HERO */
.hero { padding: 70px 32px 50px; text-align: center; max-width: 1200px; margin: 0 auto; }
h1.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.8rem); font-weight: 900;
  letter-spacing: -1.5px; margin-bottom: 18px; line-height: 1.15;
  background: linear-gradient(135deg,#fff 0%,#60a5fa 50%,#c084fc 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
body.light h1.hero-title { background: linear-gradient(135deg,#0f172a,#2563eb,#7c3aed); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero-sub { font-size: 1.15rem; color: var(--text2); margin-bottom: 32px; max-width: 760px; margin-left: auto; margin-right: auto; }
.hero-cta { margin-bottom: 52px; }

/* SECTIONS */
section { padding: 60px 32px; }
.container { max-width: 1200px; margin: 0 auto; }
.section-title {
  font-size: clamp(1.6rem,3vw,2.2rem); font-weight: 900;
  text-align: center; margin-bottom: 36px; letter-spacing: -0.5px;
}

/* CARD (shared primitive) */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px;
  backdrop-filter: blur(16px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}
.card-title { font-size: 1.1rem; font-weight: 800; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }

/* ══════════════════════ ACCOUNT / AUTH ══════════════════════ */
.account-area { display: flex; align-items: center; gap: 8px; }
.account-area .acc-email {
  font-size: 0.8rem; font-weight: 700; color: var(--text2);
  max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.account-area .acc-btn {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 30px; padding: 7px 14px; font-size: 0.78rem; font-weight: 700;
  cursor: pointer; font-family: inherit;
}
.account-area .acc-btn:hover { border-color: var(--yellow); }
.account-area a.acc-btn { text-decoration: none; display: inline-block; }

.auth-gate-card { max-width: 560px; margin: 0 auto 28px; text-align: center; }
.auth-gate-card p { color: var(--text2); margin-bottom: 18px; line-height: 1.6; }
.auth-gate-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.auth-page-wrap { min-height: calc(100vh - 70px); display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 1.5rem; font-weight: 900; text-align: center; margin-bottom: 6px; }
.auth-card .auth-sub { text-align: center; color: var(--text2); font-size: 0.85rem; margin-bottom: 24px; }
.auth-field { margin-bottom: 16px; }
.auth-field label { display: block; font-size: 0.8rem; font-weight: 700; margin-bottom: 6px; color: var(--text2); }
.auth-field input {
  width: 100%; background: var(--card); color: var(--text); border: 1px solid var(--border);
  border-radius: 12px; padding: 11px 14px; font-family: inherit; font-size: 0.9rem;
}
.auth-field input:focus { outline: none; border-color: var(--yellow); }
.auth-submit { width: 100%; margin-top: 6px; padding: 13px; font-size: 0.95rem; }
.auth-error { color: #ef4444; font-size: 0.82rem; margin-top: 12px; text-align: center; display: none; }
.auth-error.show { display: block; }
.auth-switch { text-align: center; margin-top: 20px; font-size: 0.85rem; color: var(--text2); }
.auth-switch a { color: var(--cyan); text-decoration: none; font-weight: 700; }

.account-modal { max-width: 420px; text-align: left; }
.account-modal h2 { text-align: center; }
.acc-modal-email { text-align: center; font-weight: 700; margin-bottom: 20px; word-break: break-all; }
.acc-delete-details { border-top: 1px solid var(--border); padding-top: 14px; }
.acc-delete-details summary { cursor: pointer; font-weight: 700; font-size: 0.85rem; color: #ef4444; }
.acc-delete-msg { font-size: 0.8rem; color: var(--text2); margin: 10px 0; line-height: 1.5; }
.acc-delete-input {
  width: 100%; background: var(--card); color: var(--text); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 14px; font-family: inherit; font-size: 0.88rem; margin-bottom: 10px;
}
.acc-delete-btn { width: 100%; border-color: #ef4444; color: #ef4444; }

/* ══════════════════════ STUDIO TABS ══════════════════════ */
#studio { background: transparent; }
.studio-tabs {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
  margin-bottom: 28px;
}
.studio-tab {
  background: var(--surface); color: var(--text2);
  border: 1px solid var(--border); border-radius: 30px;
  padding: 10px 20px; font-size: 0.9rem; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: all 0.2s;
}
.studio-tab:hover { color: var(--text); border-color: var(--yellow); }
.studio-tab.active {
  background: linear-gradient(135deg,#ffe050,#f59e0b);
  color: #000; border-color: transparent;
  box-shadow: 0 4px 18px rgba(255,224,80,0.35);
}
.studio-panel { display: none; }
.studio-panel.active { display: block; }

/* ══════════════════════ CHAT ══════════════════════ */
.chat-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.chat-window {
  height: 460px; overflow-y: auto; padding: 24px;
  display: flex; flex-direction: column; gap: 16px;
}
.chat-bubble { display: flex; }
.chat-bubble-user { justify-content: flex-end; }
.chat-bubble-content {
  max-width: 78%; padding: 12px 16px; border-radius: 16px;
  font-size: 0.92rem; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
}
.chat-bubble-assistant .chat-bubble-content {
  background: var(--card); border: 1px solid var(--border); border-bottom-left-radius: 4px;
}
.chat-bubble-user .chat-bubble-content {
  background: linear-gradient(135deg,#ffe050,#f59e0b); color: #000; border-bottom-right-radius: 4px;
}
.chat-bubble-content p { margin: 0 0 8px; }
.chat-bubble-content p:last-child { margin-bottom: 0; }
.chat-bubble-content code { background: rgba(6,182,212,0.12); padding: 1px 5px; border-radius: 4px; font-size: 0.85em; }
.chat-input-row { display: flex; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--border); }
.chat-input {
  flex: 1; resize: none; font-family: inherit; font-size: 0.92rem;
  background: var(--card); color: var(--text); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px 14px;
}
.chat-input:focus { outline: none; border-color: var(--yellow); }
.chat-send { align-self: flex-end; white-space: nowrap; }
.chat-hint { font-size: 0.75rem; color: var(--text2); padding: 0 20px 16px; }

/* Proposal card (character/scene/prop suggestion inside a chat bubble) */
.proposal-card {
  margin-top: 10px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px; max-width: 320px;
}
.proposal-card-kind { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; color: var(--cyan); margin-bottom: 4px; }
.proposal-card-name { font-weight: 800; font-size: 1rem; margin-bottom: 4px; }
.proposal-card-desc { font-size: 0.82rem; color: var(--text2); margin-bottom: 10px; line-height: 1.5; }
.proposal-card-img { width: 100%; border-radius: 10px; margin-bottom: 10px; display: none; }
.proposal-card-img.show { display: block; }
.proposal-card-btn {
  width: 100%; padding: 9px; border-radius: 30px; border: none;
  background: linear-gradient(135deg,#ffe050,#f59e0b); color: #000;
  font-weight: 800; font-size: 0.85rem; cursor: pointer; font-family: inherit;
}
.proposal-card-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.proposal-card-status { font-size: 0.78rem; margin-top: 8px; color: var(--text2); }
.proposal-card-status.error { color: #ef4444; }
.proposal-card-status.ok { color: #10b981; }

/* ══════════════════════ QUICK-ADD ══════════════════════ */
.quick-add-card { margin-bottom: 24px; }
.quick-add-row { display: flex; gap: 10px; flex-wrap: wrap; }
.quick-add-row input {
  background: var(--card); color: var(--text); border: 1px solid var(--border);
  border-radius: 12px; padding: 11px 14px; font-family: inherit; font-size: 0.9rem;
}
.qa-name { flex: 0 0 180px; }
.qa-desc { flex: 1 1 260px; }
.quick-add-row input:focus { outline: none; border-color: var(--yellow); }
@media(max-width:700px) { .qa-name, .qa-desc { flex: 1 1 100%; } }

/* ══════════════════════ ASSET GRID ══════════════════════ */
.asset-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px;
}
.asset-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; overflow: hidden; backdrop-filter: blur(12px);
  display: flex; flex-direction: column;
  transition: transform 0.2s, border-color 0.2s;
}
.asset-card:hover { transform: translateY(-3px); border-color: var(--yellow); }
.asset-card-media {
  width: 100%; aspect-ratio: 1/1; background: var(--card);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.asset-card-media img, .asset-card-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.asset-card-body { padding: 14px; flex: 1; display: flex; flex-direction: column; }
.asset-card-name { font-weight: 800; font-size: 0.95rem; margin-bottom: 4px; }
.asset-card-desc { font-size: 0.78rem; color: var(--text2); line-height: 1.5; flex: 1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.asset-card-expiry { font-size: 0.7rem; color: var(--text2); opacity: 0.75; margin-top: 4px; }
.asset-card-actions { display: flex; gap: 8px; margin-top: 12px; }
.asset-card-actions button {
  flex: 1; padding: 7px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); font-size: 0.75rem; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: all 0.2s;
}
.asset-card-actions button:hover { border-color: var(--cyan); }
.asset-card-actions .danger:hover { border-color: #ef4444; color: #ef4444; }
.asset-empty { grid-column: 1 / -1; text-align: center; color: var(--text2); padding: 40px 20px; font-size: 0.9rem; }

/* Video card status badge + progress */
.asset-card-status {
  position: absolute; top: 8px; right: 8px; padding: 3px 10px; border-radius: 20px;
  font-size: 0.68rem; font-weight: 800; text-transform: uppercase;
  background: rgba(0,0,0,0.65); color: #fff;
}
.asset-card-media { position: relative; }
.video-grid { margin-top: 24px; }

/* ══════════════════════ VIDEO STUDIO FORM ══════════════════════ */
.video-form-card { margin-bottom: 24px; }
.video-mode-switch { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.mode-btn {
  background: var(--card); color: var(--text2); border: 1px solid var(--border);
  border-radius: 30px; padding: 8px 16px; font-size: 0.82rem; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: all 0.2s;
}
.mode-btn.active { background: linear-gradient(135deg,#06b6d4,#3b82f6); color: #fff; border-color: transparent; }
.picker-slots { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.picker-slot {
  width: 110px; height: 110px; border: 2px dashed var(--border); border-radius: 14px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  background: var(--card); font-size: 0.75rem; color: var(--text2); text-align: center;
  overflow: hidden; position: relative; transition: all 0.2s;
}
.picker-slot:hover { border-color: var(--yellow); }
.picker-slot img { width: 100%; height: 100%; object-fit: cover; }
.picker-slot .slot-clear {
  position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(0,0,0,0.7); color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; cursor: pointer;
}
.video-prompt {
  width: 100%; resize: vertical; font-family: inherit; font-size: 0.9rem;
  background: var(--card); color: var(--text); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px 14px; margin-bottom: 16px;
}
.video-prompt:focus { outline: none; border-color: var(--yellow); }
.video-options-row { display: flex; gap: 24px; margin-bottom: 20px; flex-wrap: wrap; }
.video-options-row label { font-size: 0.82rem; font-weight: 700; color: var(--text2); display: flex; flex-direction: column; gap: 6px; }
.video-options-row select {
  background: var(--card); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 10px; font-family: inherit; font-size: 0.85rem;
}

/* ══════════════════════ ASSET PICKER MODAL ══════════════════════ */
.picker-modal { text-align: left; }
.picker-modal h2 { text-align: center; margin-bottom: 18px; }
.picker-tabs { display: flex; gap: 8px; justify-content: center; margin-bottom: 18px; }
.picker-subtab {
  background: var(--card); color: var(--text2); border: 1px solid var(--border);
  border-radius: 30px; padding: 7px 16px; font-size: 0.8rem; font-weight: 700;
  cursor: pointer; font-family: inherit;
}
.picker-subtab.active { background: linear-gradient(135deg,#ffe050,#f59e0b); color: #000; border-color: transparent; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px,1fr)); gap: 12px; max-height: 50vh; overflow-y: auto; }
.picker-grid-item { cursor: pointer; border-radius: 12px; overflow: hidden; border: 2px solid transparent; aspect-ratio: 1/1; background: var(--card); }
.picker-grid-item:hover { border-color: var(--yellow); }
.picker-grid-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.picker-grid-empty { grid-column: 1/-1; text-align: center; color: var(--text2); padding: 30px; font-size: 0.85rem; }

/* ══════════════════════ TOASTS ══════════════════════ */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 3000; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  border-radius: 12px; padding: 12px 18px; font-size: 0.85rem; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4); backdrop-filter: blur(12px);
  max-width: 320px; animation: toast-in 0.25s ease-out;
}
.toast.error { border-color: #ef4444; }
.toast.success { border-color: #10b981; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* FEATURES */
.feats-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }
@media(max-width:800px) { .feats-grid { grid-template-columns: 1fr; } }
.feat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  backdrop-filter: blur(12px);
}
.feat h3 { font-size: 1rem; font-weight: 800; margin-bottom: 8px; }
.feat p { font-size: 0.85rem; color: var(--text2); line-height: 1.6; }

/* FAQ */
.faq-list { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.faq-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden; backdrop-filter: blur(12px);
}
.faq-q {
  padding: 18px 22px; font-weight: 700; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  user-select: none;
}
.faq-a { display: none; padding: 0 22px 18px; color: var(--text2); font-size: 0.9rem; line-height: 1.6; }
.faq-item.open .faq-a { display: block; }
.faq-item.open { border-color: var(--cyan); }
.faq-icon { transition: transform 0.25s; flex-shrink: 0; }
.faq-item.open .faq-icon { transform: rotate(45deg); }

/* DONATE / PICKER MODAL SHELL */
.donate-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(5px);
  z-index: 2000; display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.donate-overlay.show { opacity: 1; pointer-events: all; }
.donate-modal {
  background: var(--surface); border: 1px solid var(--border);
  padding: 30px; border-radius: 20px; width: 95%; max-width: 750px;
  max-height: 85vh; overflow-y: auto;
  text-align: center; position: relative; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  transform: translateY(20px); transition: transform 0.3s;
}
.donate-overlay.show .donate-modal { transform: translateY(0); }
.donate-close {
  position: absolute; top: 15px; right: 20px;
  font-size: 1.5rem; cursor: pointer; color: var(--text2);
  z-index: 10;
}
.donate-modal h2 { margin-bottom: 10px; font-weight: 800; }
.donate-modal p { margin-bottom: 20px; color: var(--text2); font-size: 0.9rem; }
.donate-flex { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; }
.qr-box { flex: 1; min-width: 260px; background: rgba(255,255,255,0.05); padding: 20px; border-radius: 12px; border: 1px solid var(--border); }
.qr-box img {
  width: 100%; border-radius: 8px; background: #fff; margin-bottom: 10px; object-fit: contain;
}
.qr-box h4 { font-size: 1rem; margin-top: 10px; }

/* FOOTER */
footer {
  border-top: 1px solid var(--border); padding: 40px 32px 24px;
  background: var(--surface); backdrop-filter: blur(16px);
}
.footer-inner { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; margin-bottom: 28px; }
@media(max-width:700px) { .footer-inner { grid-template-columns: 1fr; } }
.footer-brand h4 { font-size: 1.2rem; margin-bottom: 10px; }
.footer-brand p { font-size: 0.85rem; color: var(--text2); }
.footer-col h5 { font-weight: 700; margin-bottom: 12px; }
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer-col a { color: var(--text2); text-decoration: none; font-size: 0.85rem; transition: color 0.2s; }
.footer-col a:hover { color: var(--text); }
.footer-bottom { text-align: center; color: var(--text2); font-size: 0.8rem; border-top: 1px solid rgba(255,255,255,0.05); padding-top: 20px; }

/* MOBILE OVERRIDES (kept last so they win the cascade at equal specificity) */
@media (max-width: 850px) {
  header { padding: 0 12px; height: 60px; }
  .nav-links { display: none; }
  .logo-name { display: none; }
  .header-right { gap: 6px; }
  select.lang-sel { padding: 4px 6px; font-size: 0.8rem; max-width: 90px; }
  button.theme-btn { padding: 4px 8px; font-size: 1.05rem; min-width: 40px; min-height: 40px; }
  .header-right .btn-gold { display: none; }
  .hero { padding: 40px 16px 30px; }
  section { padding: 40px 16px; }
  .feats-grid { gap: 16px; }
  .studio-tab { padding: 8px 14px; font-size: 0.8rem; }
  .chat-window { height: 380px; }
  .chat-bubble-content { max-width: 88%; }
}

@media (max-width: 600px) {
  .hero-title { font-size: 1.8rem; }
  .hero-sub { font-size: 0.95rem; }
  .card { padding: 20px; }
  .btn-gold { width: 100%; text-align: center; }
  .feats-grid { gap: 12px; }
  .footer-inner { gap: 20px; }
  .asset-grid { grid-template-columns: repeat(auto-fill, minmax(140px,1fr)); gap: 12px; }
  .toast-container { left: 12px; right: 12px; bottom: 12px; }
  .toast { max-width: none; }
}
