:root {
  --bg: #fbf9f6; --surface: #ffffff; --surface-2: #f4f1ec; --border: #e8e2d9;
  --text: #16130f; --muted: #6a6358; --accent: #e8491b; --accent-2: #ff6a2b; --accent-text: #ffffff;
  --ok: #12865a; --warn: #b26a00; --err: #c62828; --gold: #ffd60a;
  --radius: 12px; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 4px 16px rgba(16,24,40,.06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #100e0c; --surface: #1a1714; --surface-2: #231f1b; --border: #332d27;
    --text: #f3eee8; --muted: #a89e92; --accent: #ff6a2b; --accent-2: #ff8a55; --accent-text: #140f0b;
    --ok: #3ecf8e; --warn: #f0b429; --err: #ff6b6b; --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* layout */
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
main { flex: 1; padding: 32px 0 56px; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.site-header .wrap { display: flex; align-items: center; gap: 20px; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; color: var(--text); letter-spacing: -.02em; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 18px; flex: 1; }
.nav a { color: var(--muted); font-weight: 500; }
.nav a:hover, .nav a.active { color: var(--text); text-decoration: none; }
.user-chip { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 500; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-text); display: inline-grid; place-items: center; font-size: 13px; font-weight: 700; object-fit: cover; }
.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; padding: 20px 0; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
@media (max-width: 640px) { .nav { gap: 12px; } .nav .hide-sm, .user-chip .name { display: none; } }

/* type */
h1 { font-size: 30px; line-height: 1.2; letter-spacing: -.02em; margin: 0 0 8px; }
h2 { font-size: 20px; margin: 0 0 12px; letter-spacing: -.01em; }
h3 { font-size: 15px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }

/* components */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.stack > * + * { margin-top: 16px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; padding: 9px 16px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { text-decoration: none; filter: brightness(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.lg { padding: 12px 22px; font-size: 16px; }
.btn.danger { color: var(--err); }
.btn.link { background: none; border: none; color: var(--accent); padding: 4px 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
input[type=text], input[type=email], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); font: inherit; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.badge.ok { color: var(--ok); } .badge.warn { color: var(--warn); } .badge.err { color: var(--err); } .badge.accent { color: var(--accent); }
.lock { font-size: 11px; font-weight: 700; color: var(--accent); margin-left: 6px; text-transform: uppercase; letter-spacing: .03em; }
.err-text { color: var(--err); white-space: pre-wrap; }
.notice { border: 1px solid var(--border); border-left: 3px solid var(--accent); background: var(--surface-2); padding: 10px 14px; border-radius: 8px; }
#notices { margin-bottom: 20px; }
#notices div + div { margin-top: 6px; }
.meter { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--border); }
.meter > span { display: block; height: 100%; background: var(--accent); }
progress { width: 100%; height: 8px; accent-color: var(--accent); }
.log { font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px; max-height: 200px; overflow: auto; white-space: pre-wrap; }
.log:empty { display: none; }
details summary { cursor: pointer; color: var(--muted); font-size: 13px; }

/* landing */
.hero { text-align: center; padding: 48px 0 32px; }
.hero h1 { font-size: 46px; max-width: 820px; margin: 0 auto 14px; }
.hero p { font-size: 18px; color: var(--muted); max-width: 640px; margin: 0 auto 26px; }
.hero .row { justify-content: center; }
.steps { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-top: 32px; }
.step .n { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-weight: 700; margin-bottom: 10px; }
@media (max-width: 640px) { .hero h1 { font-size: 32px; } }

/* pricing */
.plans { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.plan { display: flex; flex-direction: column; gap: 10px; }
.plan.current { outline: 2px solid var(--accent); }
.plan .price { font-size: 26px; font-weight: 800; }
.plan ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 14px; }
.plan .btn { margin-top: auto; }
.table-wrap { overflow-x: auto; }
table.compare { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
table.compare th, table.compare td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
table.compare th { font-size: 13px; color: var(--muted); }

/* dashboard */
.projects { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.project { padding: 0; overflow: hidden; display: flex; flex-direction: column; color: var(--text); }
.project:hover { text-decoration: none; border-color: var(--accent); }
.project .thumb { aspect-ratio: 16 / 10; background: var(--surface-2) center / cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.project .meta { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.project .title { font-weight: 600; line-height: 1.3; }
.empty { text-align: center; padding: 48px 20px; }

/* editor: modes and settings */
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.mode { text-align: left; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.mode strong { display: block; font-size: 15px; }
.mode span { color: var(--muted); font-size: 13px; }
.mode:hover { border-color: var(--accent); }
.mode[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.mode[aria-pressed="true"] strong { color: var(--accent); }
@media (max-width: 640px) { .modes { grid-template-columns: 1fr; } }
details.card > summary { cursor: pointer; font-weight: 700; font-size: 17px; color: var(--text); list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: " +"; color: var(--muted); font-weight: 400; }
details.card[open] > summary::after { content: " –"; }

/* editor */
.editor { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
@media (max-width: 900px) { .editor { grid-template-columns: 1fr; } }
.step-card h2 { display: flex; align-items: center; gap: 10px; }
.step-card h2 .n { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-size: 13px; }
.step-card.disabled { opacity: .5; pointer-events: none; }
.fields { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.hooks label { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; color: var(--text); font-size: 14px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; margin-bottom: 8px; cursor: pointer; }
.hooks input { margin-top: 4px; }
.scene { border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: var(--surface-2); }
.scene + .scene { margin-top: 10px; }
.scene-head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.preview video { width: 100%; max-height: 70vh; background: #000; border-radius: 10px; display: block; }
.sticky { position: sticky; top: 80px; }

/* idea studio */
.studio { display: grid; gap: 20px; grid-template-columns: 250px minmax(0, 1fr); align-items: start; }
@media (max-width: 800px) { .studio { grid-template-columns: 1fr; } }
.subjects { display: flex; flex-direction: column; gap: 4px; }
.subject { display: flex; align-items: center; gap: 4px; }
.subject .pick { flex: 1; text-align: left; font: inherit; font-weight: 500; padding: 8px 10px; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--text); cursor: pointer; }
.subject .pick:hover { background: var(--surface-2); }
.subject.active .pick { background: var(--surface-2); border-color: var(--border); color: var(--accent); font-weight: 600; }
.subject [data-remove] { color: var(--muted); font-size: 16px; line-height: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: inherit; font-size: 13px; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.headlines { display: flex; flex-direction: column; }
.headline { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--border); }
.headline:first-child { border-top: none; }
.headline .story { flex: 1; display: flex; flex-direction: column; gap: 2px; text-align: left; font: inherit; padding: 10px 8px; border: none; background: none; color: var(--text); cursor: pointer; border-radius: 8px; min-width: 0; }
.headline .story:hover { background: var(--surface-2); }
.headline .story:hover .t { color: var(--accent); }
.headline .t { font-weight: 500; line-height: 1.35; }
.ideas { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.idea { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--border); border-radius: 10px; padding: 14px; background: var(--surface-2); }
.idea .title { font-weight: 700; font-size: 16px; line-height: 1.3; }
.idea .hook { font-style: italic; color: var(--muted); }
.idea.used { opacity: .75; }
.idea .row { padding-top: 6px; }
