/* Контент-фабрика. Основа — белое полотно, чёрные границы без теней, чёрные кнопки, пилюли (Gumroad).
   Тёмная «сцена» только вокруг видео (Frame.io). Розовый — только декор (жетон), не для интерактива. */
:root {
  --canvas: #ffffff; --ink: #000000; --soft: #f4f4f0; --line: #d1d5dc; --strong: #000000; --muted: #5c5c57;
  --pink: #ff90e8; --yellow: #ffc900; --red: #d92d20; --green: #12805c;
  --stage: #0a0a13; --stage-ink: #fcfcfc; --stage-dim: #a3a3b3;
  --font: "Inter", -apple-system, "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --canvas: #0c0c0c; --ink: #f4f4f0; --soft: #181818; --line: #34343a; --strong: #f4f4f0; --muted: #a0a09a;
          --red: #ff6b5e; --green: #4cd49b; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 15px/1.5 var(--font); letter-spacing: -0.01em; }
a { color: var(--ink); text-decoration-color: var(--line); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--ink); }
h1, h2, h3 { text-wrap: balance; margin: 0; }
h1 { font-size: clamp(28px, 4vw, 40px); line-height: 1.1; letter-spacing: -0.035em; font-weight: 700; }
h2 { font-size: 20px; letter-spacing: -0.02em; font-weight: 700; margin: 36px 0 12px; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0; text-wrap: pretty; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

/* --- каркас --- */
.top { position: sticky; top: 0; z-index: 20; display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
       padding: 10px 24px; background: var(--canvas); border-bottom: 1px solid var(--strong); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.03em; text-decoration: none; font-size: 17px; }
.coin { width: 30px; height: 30px; flex: none; }
.me { color: var(--muted); font-size: 13px; display: flex; gap: 10px; align-items: center; }
.switcher select { border-radius: 999px; padding: 6px 30px 6px 14px; font-weight: 600; background-color: var(--canvas); border: 1px solid var(--strong); }
.page { max-width: 1120px; margin: 0 auto; padding: 36px 24px 80px; }
.page.wide { max-width: 1480px; }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--soft); }
.head { display: flex; justify-content: space-between; align-items: end; gap: 20px; flex-wrap: wrap; margin-bottom: 8px; }
.lede { color: var(--muted); max-width: 62ch; margin-top: 8px; }

/* --- карточки, формы, кнопки --- */
.card { background: var(--canvas); border: 1px solid var(--strong); border-radius: 16px; padding: 20px; margin: 14px 0; display: flex; flex-direction: column; gap: 14px; }
.card.soft { background: var(--soft); border-color: var(--line); }
.narrow { width: 100%; max-width: 400px; }
.auth .card { padding: 28px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
input, textarea, select { font: inherit; color: var(--ink); background: var(--soft); border: 1px solid var(--line); border-radius: 4px; padding: 11px 12px; width: 100%; letter-spacing: -0.01em; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--strong); box-shadow: 0 0 0 1px var(--strong); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--ink); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
         background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
button, .btn { font: inherit; font-weight: 600; letter-spacing: -0.01em; background: var(--ink); color: var(--canvas); border: 1px solid var(--ink);
               border-radius: 4px; height: 44px; padding: 0 22px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; white-space: nowrap; }
button:hover, .btn:hover { opacity: .86; }
button.secondary, .btn.secondary { background: transparent; color: var(--ink); border-color: var(--line); border-radius: 999px; height: 38px; padding: 0 16px; font-weight: 500; }
button.secondary:hover, .btn.secondary:hover { border-color: var(--strong); opacity: 1; }
button.danger { background: transparent; color: var(--red); border: 1px solid var(--line); border-radius: 999px; height: 38px; padding: 0 16px; font-weight: 500; }
button.danger:hover { border-color: var(--red); opacity: 1; }
button.big { height: 56px; font-size: 17px; padding: 0 30px; width: 100%; }
button:disabled { opacity: .35; cursor: not-allowed; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row form, form.inline { margin: 0; display: inline-flex; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.muted { color: var(--muted); font-size: 13px; }
.error { color: var(--red); font-weight: 500; }
.notice { background: var(--yellow); color: #000; padding: 10px 14px; border-radius: 8px; font-weight: 500; }
.empty { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 40px 20px; border: 1px dashed var(--line); border-radius: 16px; color: var(--muted); }
.empty .coin { width: 64px; height: 64px; }
.count { color: var(--muted); font-weight: 500; margin-left: 4px; }
.badge { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; }
.badge.warn { background: var(--yellow); border-color: var(--yellow); color: #000; }
.badge.ok { background: var(--ink); color: var(--canvas); border-color: var(--ink); }
.pre { white-space: pre-wrap; }
code, .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; background: var(--soft); border: 1px solid var(--line); padding: 2px 7px; border-radius: 4px; }
table { width: 100%; border-collapse: collapse; border: 1px solid var(--strong); border-radius: 16px; overflow: hidden; border-spacing: 0; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--soft); }

/* --- дашборд --- */
.dash { display: grid; grid-template-columns: 360px 1fr; gap: 28px; align-items: start; margin-top: 24px; }
.panel { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 16px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--strong); border-radius: 999px; padding: 3px; gap: 3px; }
.seg label { flex-direction: row; justify-content: center; align-items: center; padding: 9px 8px; border-radius: 999px; color: var(--ink); cursor: pointer; font-weight: 600; font-size: 14px; }
.seg input { display: none; }
.seg label:has(input:checked) { background: var(--ink); color: var(--canvas); }
.seg-note { font-size: 13px; color: var(--muted); min-height: 3.2em; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.steps li { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.steps li:last-child { border: 0; }
.dot { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.steps li.done .dot { background: var(--ink); border-color: var(--ink); color: var(--canvas); }
.steps li.now .dot { border-color: var(--ink); background: var(--yellow); color: #000; animation: pulse 1.4s ease-in-out infinite; }
.steps li.off { color: var(--muted); }
@keyframes pulse { 50% { transform: scale(1.14); } }
@media (prefers-reduced-motion: reduce) { .steps li.now .dot { animation: none; } }
.chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.chip { border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.chip b { display: block; font-size: 24px; letter-spacing: -0.03em; line-height: 1.1; }
.chip span { font-size: 12px; color: var(--muted); }
.checklist { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.checklist .no { color: var(--red); font-weight: 600; }

/* --- журнал запуска --- */
.feed-wrap { min-height: 420px; }
.feed-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.feed { display: flex; flex-direction: column; gap: 10px; }
.ev { display: grid; grid-template-columns: 56px 1fr; gap: 12px; animation: rise .25s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .ev { animation: none; } }
.ev time { font: 12px ui-monospace, Menlo, monospace; color: var(--muted); padding-top: 12px; }
.ev .body { border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; }
.ev .body strong { display: block; }
.ev .body p { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.ev.ok .body { border-color: var(--strong); }
.ev.warn .body { background: var(--yellow); border-color: var(--yellow); color: #000; }
.ev.warn .body p { color: #000; }
.ev.error .body { border-color: var(--red); }
.ev.error strong { color: var(--red); }
.ev img { width: 100%; max-width: 360px; border-radius: 12px; margin-top: 8px; display: block; }
.stagehead { display: flex; align-items: center; gap: 10px; margin: 18px 0 2px; font-weight: 700; letter-spacing: -0.02em; }
.stagehead::after { content: ""; flex: 1; border-top: 1px solid var(--strong); }
/* сценарий как кадр вертикального видео */
.ev.card .body { padding: 0; border: 0; display: grid; grid-template-columns: 150px 1fr; gap: 16px; align-items: start; }
.frame { aspect-ratio: 9/16; background: var(--stage); border-radius: 18px; color: var(--stage-ink); padding: 14px 12px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.frame::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 80% 0%, #4e55a8 0, transparent 55%); opacity: .55; }
.frame > * { position: relative; }
.frame .t { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--stage-dim); }
.frame .h { font-weight: 700; font-size: 15px; line-height: 1.12; letter-spacing: -0.03em; text-wrap: balance; }
.frame .w { font-size: 9px; color: var(--stage-dim); }
.ev.card .txt { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.ev.card .txt .q { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.ev.card .txt p { color: var(--ink); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.ev.card .txt p.open { -webkit-line-clamp: unset; }
.ev.card .txt button { height: 28px; padding: 0 10px; margin-top: 8px; }
.waitbar { position: sticky; bottom: 16px; margin-top: 14px; background: var(--ink); color: var(--canvas); border-radius: 16px; padding: 14px 16px; display: flex; gap: 12px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.waitbar button { background: var(--canvas); color: var(--ink); border-color: var(--canvas); }
.waitbar button.secondary { background: transparent; color: var(--canvas); border-color: #666; }

/* --- превью и видео --- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.tile { display: flex; flex-direction: column; gap: 8px; text-decoration: none; }
.tile video, .tile .ph { width: 100%; aspect-ratio: 9/16; object-fit: cover; border-radius: 18px; background: var(--stage); }
.ph { display: grid; place-items: center; color: var(--stage-dim); font-size: 13px; }
.preview { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 32px; align-items: start; }
.stage { background: var(--stage); border-radius: 24px; padding: 20px; display: grid; place-items: center; position: sticky; top: 76px; }
.stage video, .stage .ph { width: 100%; max-width: 340px; aspect-ratio: 9/16; border-radius: 18px; background: #000; }

/* --- ключи, семантика, лиды --- */
.provider { display: grid; grid-template-columns: 220px 1fr; gap: 20px; }
.provider .fields { display: grid; gap: 10px; }
.field { display: grid; grid-template-columns: 150px 1fr auto; gap: 10px; align-items: center; }
.field .mask { font: 13px ui-monospace, Menlo, monospace; color: var(--muted); white-space: nowrap; min-width: 120px; text-align: right; }
.pill { flex-direction: row; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px; color: var(--ink); cursor: pointer; font-weight: 600; }
.pill:has(input:checked) { background: var(--ink); color: var(--canvas); border-color: var(--ink); }
.pill input { display: none; }
.scopes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 12px; }
.col { background: var(--canvas); border: 1px solid var(--strong); border-radius: 16px; padding: 14px; min-height: 160px; }
.col.off { opacity: .4; }
.col h3 { margin: 0 0 10px; }
ul.kw { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
ul.kw label { flex-direction: row; align-items: baseline; gap: 8px; color: var(--ink); font-size: 14px; font-weight: 400; }
.sticky { position: sticky; top: 60px; background: var(--canvas); padding: 10px 0; z-index: 2; border-bottom: 1px solid var(--line); }
.kanban { display: grid; grid-template-columns: repeat(6, minmax(190px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.lead { display: flex; flex-direction: column; gap: 2px; padding: 11px 12px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; background: var(--canvas); }
.lead:hover { border-color: var(--strong); }
.link-box { display: flex; gap: 8px; }
.link-box input { font: 13px ui-monospace, Menlo, monospace; }
details > summary { cursor: pointer; font-weight: 600; }

@media (max-width: 900px) {
  .dash, .preview, .provider { grid-template-columns: 1fr; }
  .panel, .stage { position: static; }
  .scopes { grid-template-columns: 1fr; }
  .field { grid-template-columns: 1fr; }
  .top { padding: 10px 16px; }
  .page { padding: 24px 16px 60px; }
  .ev { grid-template-columns: 1fr; }
  .ev time { padding: 0; }
  .ev.card .body { grid-template-columns: 110px 1fr; }
}

.next { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; margin-top: 22px; padding: 18px 22px; border: 1px solid var(--strong); border-radius: 16px; background: var(--soft); }
.next .btn { height: 48px; }
img.thumb { width: 100%; aspect-ratio: 9/16; object-fit: cover; border-radius: 18px; background: var(--stage); display: block; }
.grid.wideg { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.ref { display: grid; grid-template-columns: 110px 1fr; gap: 14px; align-items: start; border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
.ref img.thumb { border-radius: 12px; }
.swatch { aspect-ratio: 16/10; border-radius: 14px; display: flex; flex-direction: column; justify-content: space-between; align-items: center; padding: 14px 10px; overflow: hidden; }
.swatch .hk { padding: 5px 10px; font-weight: 700; font-size: 15px; letter-spacing: -0.02em; border-radius: 3px; }
.swatch .hk.outline { text-shadow: 0 0 3px #000, 0 0 3px #000, 0 1px 6px #000; }
.swatch .sb { font-weight: 700; font-size: 13px; }
.swatch .sb i { font-style: normal; text-shadow: 0 0 3px #000; }
.covers { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.covers li { display: flex; align-items: center; gap: 8px; }
.cbox { width: 18px; height: 18px; border: 1.5px solid var(--line); border-radius: 4px; display: grid; place-items: center; flex: none; }
.covers li.on .cbox { background: var(--ink); border-color: var(--ink); color: var(--canvas); }
.covers li.off { color: var(--muted); }
.provider.kie { border-width: 2px; }
.field .mask svg { vertical-align: -2px; }
.pcard { gap: 12px; }
.newp summary { cursor: pointer; font-weight: 700; font-size: 18px; list-style: none; display: flex; align-items: center; gap: 10px; }
.newp summary::-webkit-details-marker { display: none; }
.plus { width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--strong); display: grid; place-items: center; }

.guide { margin: 10px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }

.avcard { display: grid; grid-template-columns: 180px 1fr; gap: 24px; align-items: start; }
.avatar-img { width: 160px; height: 160px; border-radius: 50%; object-fit: cover; border: 3px solid var(--strong); background: var(--stage); display: grid; place-items: center; color: var(--stage-dim); }
@media (max-width: 900px) { .avcard { grid-template-columns: 1fr; } }

/* --- навигация: выпадающие группы на компьютере, нижняя панель на телефоне --- */
.top nav.main { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; align-items: center; }
.top nav.main > a, .dd > summary { text-decoration: none; padding: 6px 14px; border-radius: 999px; font-weight: 500; cursor: pointer; list-style: none; }
.dd > summary::-webkit-details-marker { display: none; }
.dd > summary::after { content: "▾"; margin-left: 6px; font-size: 11px; }
.top nav.main > a:hover, .dd > summary:hover { background: var(--soft); }
.top nav.main > a.on, .dd > summary.on { background: var(--ink); color: var(--canvas); }
.dd { position: relative; }
.dd .menu { position: absolute; top: calc(100% + 8px); left: 0; min-width: 220px; background: var(--canvas); border: 1px solid var(--strong); border-radius: 16px; padding: 8px; display: flex; flex-direction: column; z-index: 30; }
.dd .menu a { padding: 9px 12px; border-radius: 10px; text-decoration: none; }
.dd .menu a:hover { background: var(--soft); }
.me a, .me .uname { white-space: nowrap; }
.me .uname { color: var(--ink); font-weight: 600; }
.tabbar { display: none; }
@media (max-width: 1000px) {
  .top nav.main, .top .me a, .top .me .uname { display: none; }
  .top { padding: 8px 16px; gap: 10px; }
  .brand span { display: none; }
  .switcher { flex: 1; } .switcher select { width: 100%; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--canvas);
            border-top: 1px solid var(--strong); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar > a, .more > summary { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; text-decoration: none; padding: 4px 0; border-radius: 10px; list-style: none; cursor: pointer; }
  .more > summary::-webkit-details-marker { display: none; }
  .tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar .more svg circle { fill: currentColor; stroke: none; }
  .tabbar a.on { background: var(--ink); color: var(--canvas); }
  .more { position: static; }
  .sheet { position: fixed; left: 8px; right: 8px; bottom: calc(66px + env(safe-area-inset-bottom)); background: var(--canvas); border: 1px solid var(--strong); border-radius: 18px; padding: 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
  .sheet a { padding: 12px; border-radius: 10px; text-decoration: none; font-size: 15px; }
  .sheet a:active { background: var(--soft); }
  body { padding-bottom: 76px; }
  .waitbar, .sticky { bottom: 84px; }
  .waitbar { position: sticky; }
  h1 { font-size: 28px; }
  table { display: block; overflow-x: auto; }
  .head { align-items: start; }
}

/* --- подготовка проекта --- */
.setup { display: flex; flex-direction: column; gap: 10px; }
.progress { height: 8px; border: 1px solid var(--strong); border-radius: 999px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--ink); }
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.checks li { display: grid; grid-template-columns: 24px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.checks li:last-child { border: 0; }
.checks .dot { width: 20px; height: 20px; }
.checks li.ok .dot { background: var(--ink); border-color: var(--ink); color: var(--canvas); }
.checks li.opt .dot { border-style: dashed; }
.checks a { font-size: 13px; }
.checks .tag { font-size: 11px; color: var(--muted); }

.board td { font-size: 13px; vertical-align: top; }
.board { margin-top: 8px; }

@media (min-width: 1001px) and (max-width: 1240px) { .top nav.main > a, .dd > summary { padding: 6px 10px; font-size: 14px; } .me a { display: none; } .top { padding: 10px 16px; } }

.gencard { cursor: pointer; gap: 10px; }
.gencard.on { border-width: 2px; }
.gencard input[type=checkbox] { width: 20px; height: 20px; }
.madeby dl { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; margin: 0; font-size: 14px; }
.madeby dt { color: var(--muted); } .madeby dd { margin: 0; }

.card.row { flex-direction: row; }
.tile img.thumb { border: 1px solid var(--line); }
