:root {
  --bg: #08080b; --bg2: #0e0e13; --panel: #121218; --panel2: #18181f; --line: #24242e; --line2: #30303c;
  --text: #f1f1f5; --muted: #8d8d9e; --faint: #5d5d6c;
  --accent: #8b6cff; --accent2: #c26bff; --ok: #34d399; --warn: #fbbf24; --bad: #f87171;
  --grad: linear-gradient(120deg, #8b6cff, #c26bff 55%, #ff7ab6);
  --r: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14.5px/1.55 Inter, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button { font: inherit; }
.boot { height: 100vh; display: grid; place-items: center; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line2); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* layout */
.top { display: flex; align-items: center; gap: 14px; padding: 14px 28px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: rgba(8,8,11,0.85); backdrop-filter: blur(12px); z-index: 10; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; letter-spacing: -0.02em; font-size: 16px; text-decoration: none; }
.brand i { width: 26px; height: 26px; border-radius: 7px; background: url(/mark.svg) center/cover; box-shadow: 0 0 22px rgba(139,108,255,0.45); display: block; }
.brand .beta { font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; color: var(--accent2); border: 1px solid rgba(194,107,255,0.35); padding: 2px 7px; border-radius: 99px; }
.spacer { flex: 1; }
.meter { font-size: 12.5px; color: var(--muted); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--panel2); border: 1px solid var(--line2); display: grid; place-items: center; font-size: 12px; font-weight: 700; cursor: pointer; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 36px 28px 80px; }

/* type */
h1 { font-size: 34px; letter-spacing: -0.035em; margin: 0 0 6px; font-weight: 780; line-height: 1.1; }
h2 { font-size: 20px; letter-spacing: -0.02em; margin: 0 0 4px; font-weight: 720; }
.sub { color: var(--muted); margin: 0 0 26px; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; font-style: italic; padding-right: 3px; }
.label { font-size: 12px; font-weight: 600; color: var(--muted); margin: 16px 0 6px; display: block; }
.hint { font-size: 12.5px; color: var(--faint); margin-top: 6px; }

/* controls */
input[type=text], input[type=email], input[type=password], input[type=url], textarea, select {
  width: 100%; background: var(--bg2); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 11px 13px; font: inherit; outline: none; transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 76px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 11px; padding: 11px 18px; font-weight: 650; cursor: pointer; background: var(--grad); color: #fff; box-shadow: 0 8px 28px rgba(139,108,255,0.28); transition: transform 0.1s, filter 0.15s; text-decoration: none; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(0.98); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line2); box-shadow: none; }
.btn.ghost:hover { background: var(--panel2); }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn.big { padding: 14px 24px; font-size: 15.5px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.row { display: flex; gap: 12px; } .row > * { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line2); background: var(--bg2); color: var(--muted); border-radius: 99px; padding: 7px 13px; cursor: pointer; font-size: 13px; user-select: none; }
.chip.on { border-color: var(--accent); color: var(--text); background: rgba(139,108,255,0.12); }
.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; margin-top: 12px; }
.toggle input { display: none; }
.toggle .sw { width: 38px; height: 22px; border-radius: 99px; background: var(--line2); position: relative; transition: background 0.15s; flex: none; }
.toggle .sw::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left 0.15s; }
.toggle input:checked + .sw { background: var(--accent); }
.toggle input:checked + .sw::after { left: 19px; }
input[type=range] { width: 100%; accent-color: var(--accent); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; }
.card + .card { margin-top: 16px; }

/* auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth .hero { position: relative; overflow: hidden; padding: 56px; display: flex; flex-direction: column; justify-content: flex-end; background: radial-gradient(ellipse 70% 60% at 30% 20%, rgba(139,108,255,0.35), transparent 70%), radial-gradient(ellipse 60% 50% at 80% 90%, rgba(255,122,182,0.28), transparent 70%), var(--bg2); }
.auth .hero h1 { font-size: 52px; max-width: 560px; }
.auth .hero p { color: var(--muted); font-size: 17px; max-width: 480px; }
.auth .form { display: grid; place-items: center; padding: 40px; }
.auth .form > div { width: 100%; max-width: 380px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 12px; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth .hero { min-height: 280px; padding: 32px; } .auth .hero h1 { font-size: 36px; } }

/* projects */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.proj { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; cursor: pointer; transition: border-color 0.15s, transform 0.15s; min-height: 150px; display: flex; flex-direction: column; text-decoration: none; }
.proj:hover { border-color: var(--line2); transform: translateY(-2px); }
.proj .thumb { height: 74px; border-radius: 10px; margin-bottom: 14px; background: radial-gradient(ellipse at 30% 30%, rgba(139,108,255,0.45), transparent 70%), radial-gradient(ellipse at 80% 80%, rgba(255,122,182,0.35), transparent 70%), var(--bg2); }
.proj b { font-size: 15px; }
.proj span { color: var(--muted); font-size: 12.5px; }
.proj.new { border-style: dashed; align-items: center; justify-content: center; color: var(--muted); gap: 8px; }
.proj.new .plus { width: 42px; height: 42px; border-radius: 12px; background: var(--grad); display: grid; place-items: center; color: #fff; font-size: 24px; }

/* wizard */
.steps { display: flex; gap: 8px; margin-bottom: 26px; }
.steps div { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.steps div.on { background: var(--grad); }
.screen-item { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 10px; display: flex; gap: 14px; align-items: flex-start; }
.screen-item .ico { width: 34px; height: 34px; border-radius: 9px; background: var(--panel2); display: grid; place-items: center; flex: none; font-size: 15px; }
.screen-item img { width: 92px; height: 60px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); flex: none; }
.screen-item .grow { flex: 1; min-width: 0; }
.screen-item .x { background: none; border: 0; color: var(--faint); cursor: pointer; font-size: 16px; }
.drop { border: 1.5px dashed var(--line2); border-radius: 12px; padding: 22px; text-align: center; color: var(--muted); cursor: pointer; transition: border-color 0.15s; }
.drop:hover, .drop.over { border-color: var(--accent); color: var(--text); }
.nav { display: flex; justify-content: space-between; margin-top: 26px; }

/* studio */
.studio { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
@media (max-width: 1000px) { .studio { grid-template-columns: 1fr; } }
.player { background: #000; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); aspect-ratio: 16/9; display: grid; place-items: center; position: relative; }
.player video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.player .placeholder { text-align: center; color: var(--muted); padding: 30px; }
.tabs { display: flex; gap: 6px; }
.tab { border: 1px solid var(--line2); background: transparent; color: var(--muted); border-radius: 9px; padding: 6px 12px; cursor: pointer; font-size: 13px; }
.tab.on { color: var(--text); border-color: var(--accent); background: rgba(139,108,255,0.1); }
.bar { display: flex; align-items: center; gap: 10px; margin: 14px 0; flex-wrap: wrap; }
.progress { margin-top: 18px; }
.pipeline { display: flex; gap: 8px; }
.pipeline div { flex: 1; padding: 10px 12px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); font-size: 12.5px; color: var(--faint); }
.pipeline div.on { color: var(--text); border-color: var(--accent); }
.pipeline div.done { color: var(--ok); }
.pbar { height: 5px; border-radius: 3px; background: var(--line); margin-top: 10px; overflow: hidden; }
.pbar div { height: 100%; background: var(--grad); width: 0; transition: width 0.4s; }
.log { font: 12px/1.6 ui-monospace, Menlo, monospace; color: var(--muted); max-height: 150px; overflow: auto; margin-top: 10px; white-space: pre-wrap; }
.log .step { color: var(--text); } .log .warn { color: var(--warn); } .log .err { color: var(--bad); }

.chat { position: sticky; top: 76px; display: flex; flex-direction: column; height: calc(100vh - 100px); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.chat header { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.chat .msgs { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 88%; padding: 10px 13px; border-radius: 14px; font-size: 13.5px; white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--panel2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.thinking { color: var(--muted); font-style: italic; }
.chat footer { padding: 12px; border-top: 1px solid var(--line); }
.chat footer .chips { margin-bottom: 10px; }
.chat footer .chip { font-size: 12px; padding: 5px 10px; }
.chat .compose { display: flex; gap: 8px; } .chat .compose textarea { min-height: 44px; height: 44px; }

.shots { margin-top: 22px; }
.scene { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; }
.scene .head { display: flex; justify-content: space-between; font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent2); margin-bottom: 8px; }
.shot { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.shot .k { font-size: 11.5px; color: var(--muted); width: 88px; flex: none; }
.shot input { padding: 7px 10px; font-size: 13px; }
.vo { font-size: 13px; }

.drawer { position: fixed; inset: 0 0 0 auto; width: min(560px, 100%); background: var(--bg2); border-left: 1px solid var(--line); z-index: 50; overflow: auto; padding: 26px; transform: translateX(100%); transition: transform 0.25s; }
.drawer.open { transform: none; }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 40; display: none; }
.scrim.open { display: block; }

#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--line2); padding: 11px 18px; border-radius: 12px; display: none; z-index: 99; box-shadow: 0 20px 50px rgba(0,0,0,0.5); }
.empty { text-align: center; color: var(--muted); padding: 50px 20px; }
.pill { font-size: 11.5px; padding: 3px 9px; border-radius: 99px; border: 1px solid var(--line2); color: var(--muted); }
.pill.ok { color: var(--ok); border-color: rgba(52,211,153,0.35); } .pill.bad { color: var(--bad); border-color: rgba(248,113,113,0.35); } .pill.run { color: var(--accent2); border-color: rgba(194,107,255,0.4); }
