/* ============================================================
   CHARACTER STUDIO 2.1 — lesse-style monochrome theme
   Референс: lessestudio.com (#ebebeb, чёрный, hairlines,
   вес 400, uppercase-микролейблы, чёрные инверсии).
   Селекторы 1:1 со старой темой — JS/разметка не тронуты.
   ============================================================ */
:root {
  --bg: #ebebeb;
  --bg-deep: #ffffff;
  --panel: #f5f5f5;
  --panel-2: #ededed;
  --panel-3: #e2e2e2;
  --line: rgba(0,0,0,.14);
  --line-soft: rgba(0,0,0,.09);
  --ink: #000;
  --ink-dim: #555;
  --ink-faint: #909090;
  --accent: #000;
  --accent-dim: rgba(0,0,0,.05);
  --accent-line: rgba(0,0,0,.32);
  --success: #55704a;
  --warning: #96762a;
  --danger: #a4483c;
  --info: #3d5a80;

  --cream:#efe8d8; --mint:#cfe0da; --coral:#e7b3ab; --lavender:#d4c8e4;
  --lemon:#e8d9a8; --sage:#c6d2b2; --sky:#bccddc; --rose:#e0bcc2;
  --paper:#f5f5f5; --shadow:#d8d8d8;

  --r-xs:4px; --r-sm:8px; --r-md:10px; --r-lg:14px; --r-xl:18px; --r-pill:999px;
  --m-instant:80ms; --m-fast:200ms; --m-smooth:350ms; --m-slow:500ms;
  --ease: cubic-bezier(.65,.05,.1,1);
  --e2: none;
  --e3: 0 10px 30px rgba(0,0,0,.10);
  --e4: 0 24px 70px rgba(0,0,0,.22);

  --serif: 'Inter Tight', 'Inter', system-ui, sans-serif;
  --sans: 'Inter Tight', 'Inter', system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: 'Inter Tight', 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 14px; line-height: 1.5; font-weight: 400;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
::selection { background: #000; color: #fff; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--ink); }
input, textarea {
  background: transparent; border: none; border-bottom: 1px solid var(--line);
  border-radius: 0; padding: 7px 2px; width: 100%;
  transition: border-color var(--m-fast) var(--ease);
}
input:focus, textarea:focus { outline: none; border-bottom-color: var(--ink); }
textarea { resize: vertical; min-height: 64px; background: var(--bg-deep); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; }
textarea:focus { border-color: var(--ink); }
select {
  background: var(--bg-deep); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 7px 12px;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cfcfcf; border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- App layout ---------- */
#app { display: flex; flex-direction: column; height: 100vh; }
.topbar {
  display: flex; align-items: center; gap: 14px;
  height: 58px; padding: 0 18px;
  background: var(--bg); border-bottom: 1px solid var(--line-soft);
  flex-shrink: 0; z-index: 40;
}
.brand { font-family: var(--sans); font-style: normal; font-size: 17px; font-weight: 500; letter-spacing: -.01em; color: var(--ink); white-space: nowrap; }
.brand small { color: var(--ink-faint); font-style: normal; font-size: 11px; margin-left: 6px; letter-spacing: .12em; text-transform: uppercase; }
.proj-name {
  background: transparent; border: none; border-bottom: 1px solid transparent; color: var(--ink);
  font-size: 14px; font-weight: 500; width: 200px; padding: 5px 2px;
}
.proj-name:hover { border-bottom-color: var(--line); }
.proj-name:focus { border-bottom-color: var(--ink); outline: none; }
.spacer { flex: 1; }
.save-dot { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.save-dot i { width: 7px; height: 7px; border-radius: 50%; background: var(--success); display: inline-block; transition: background var(--m-fast); }
.save-dot.dirty i { background: var(--warning); }

/* stage stepper */
.stepper { display: flex; gap: 2px; background: transparent; border: 1px solid var(--line); border-radius: var(--r-pill); padding: 3px; }
.step {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 14px; border-radius: var(--r-pill);
  color: var(--ink-dim); font-size: 12px; white-space: nowrap;
  transition: background var(--m-fast) var(--ease), color var(--m-fast) var(--ease);
}
.step b { font-size: 11px; opacity: .6; font-weight: 500; }
.step:hover { color: var(--ink); }
.step.active { background: var(--ink); color: #fff; font-weight: 500; }
.step.done b { color: var(--success); }
.step.active b { color: #fff; opacity: .7; }

/* ---------- main areas ---------- */
.main { display: flex; flex: 1; min-height: 0; }
.side {
  width: 292px; flex-shrink: 0; background: var(--panel);
  border-right: 1px solid var(--line-soft); display: flex; flex-direction: column;
  transition: margin var(--m-smooth) var(--ease);
}
.side.collapsed { margin-left: -292px; }
.center { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }
.drawer {
  width: 384px; flex-shrink: 0; background: var(--panel);
  border-left: 1px solid var(--line-soft); display: flex; flex-direction: column;
  transition: margin var(--m-smooth) var(--ease);
}
.drawer.collapsed { margin-right: -384px; }

.panel-head {
  display: flex; align-items: center; gap: 8px; padding: 16px 16px 10px;
  font-family: var(--sans); font-style: normal; font-size: .72rem; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink);
  flex-shrink: 0;
}
.panel-head .sub { font-style: normal; font-size: 11px; color: var(--ink-faint); letter-spacing: .08em; }
.panel-body { flex: 1; overflow-y: auto; padding: 0 16px 20px; }

/* ---------- stage guide (left) ---------- */
.next-action {
  margin: 8px 0 14px; padding: 13px 15px;
  background: var(--ink); border: none;
  border-radius: var(--r-md); font-size: 13px; color: #fff;
}
.next-action b { display:block; font-size: 11px; letter-spacing: .16em; color: rgba(255,255,255,.5); margin-bottom: 5px; font-weight: 500; text-transform: uppercase; }
.stage-desc { color: var(--ink-dim); font-size: 12.5px; margin-bottom: 14px; }
.check { display: flex; gap: 9px; align-items: flex-start; padding: 7px 8px; border-radius: var(--r-sm); margin-bottom: 2px; transition: background var(--m-fast); }
.check:hover { background: var(--panel-2); }
.check .box {
  width: 15px; height: 15px; margin-top: 1px; border-radius: 50%; flex-shrink: 0;
  border: 1px solid var(--ink-faint); display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: #fff; transition: all var(--m-fast) var(--ease);
}
.check.done .box { background: var(--ink); border-color: var(--ink); }
.check.done .label { color: var(--ink-faint); text-decoration: line-through; }
.check .label { font-size: 12.5px; color: var(--ink-dim); }
.check.auto .label::after { content: " ·авто"; font-size: 11px; color: var(--ink-faint); }

.concept-form label { display: block; font-size: 11px; letter-spacing: .12em; color: var(--ink-faint); margin: 12px 0 4px; text-transform: uppercase; font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.chip {
  padding: 4px 13px; border-radius: var(--r-pill); font-size: 11.5px;
  background: transparent; border: 1px solid var(--line); color: var(--ink-dim);
  transition: all var(--m-fast) var(--ease); cursor: pointer;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip.more { border-style: dashed; }

/* ---------- toolbar ---------- */
.tl-toolbar {
  display: flex; align-items: center; gap: 8px; padding: 10px 18px;
  border-bottom: 1px solid var(--line-soft); background: var(--bg); flex-shrink: 0;
  flex-wrap: wrap;
}
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 15px; border-radius: var(--r-pill);
  background: transparent; border: 1px solid var(--line);
  color: var(--ink); font-size: 12.5px; font-weight: 500; white-space: nowrap;
  transition: all var(--m-fast) var(--ease);
}
.btn:hover { border-color: var(--ink); background: transparent; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 500; }
.btn.primary:hover { opacity: .85; filter: none; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-dim); }
.btn.ghost:hover { color: var(--ink); background: var(--panel-2); border-color: transparent; }
.btn.on { border-color: var(--ink); color: #fff; background: var(--ink); }
.btn:disabled { opacity: .35; cursor: default; }
.tool-sep { width: 1px; height: 20px; background: var(--line); margin: 0 2px; }
.zoom-lbl { font-size: 11px; color: var(--ink-faint); min-width: 52px; text-align: center; }

/* lane toggles (legacy) */
.lane-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: var(--r-pill); font-size: 11.5px; color: var(--ink-dim); border: 1px solid var(--line); transition: all var(--m-fast) var(--ease); }
.lane-toggle i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.lane-toggle.on { color: var(--ink); background: var(--panel-2); }
.lane-toggle:not(.on) { opacity: .5; }

/* ---------- timeline (legacy SS styles, restyled) ---------- */
.tl-scroll { flex: 1; overflow: auto; position: relative; background: var(--bg); }
.tl-canvas { position: relative; min-height: 100%; }
.ruler { position: sticky; top: 0; height: 26px; background: var(--bg); border-bottom: 1px solid var(--line-soft); z-index: 10; }
.ruler .tick { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line-soft); padding: 5px 0 0 5px; font-size: 11px; color: var(--ink-faint); }
.gridline { position: absolute; top: 26px; bottom: 0; border-left: 1px solid rgba(0,0,0,.03); pointer-events: none; }

.blocks-row { position: relative; height: 112px; margin-top: 10px; }
.blocks-row .row-label, .lane .row-label {
  position: sticky; left: 0; float: left; z-index: 9;
  font-size: 11px; letter-spacing: .12em; color: var(--ink-faint);
  padding: 3px 8px; background: var(--bg); border-radius: 0 var(--r-sm) var(--r-sm) 0;
  text-transform: uppercase; pointer-events: none;
}
.block {
  position: absolute; top: 18px; height: 86px;
  border-radius: var(--r-md); padding: 8px 10px 6px; overflow: hidden;
  box-shadow: none; border: 1px solid var(--line); cursor: grab; user-select: none;
  transition: box-shadow var(--m-fast) var(--ease), opacity var(--m-smooth) var(--ease);
}
.block:hover { box-shadow: var(--e3); }
.block.selected { outline: 2px solid var(--ink); outline-offset: 1px; }
.block.dragging { cursor: grabbing; opacity: .85; z-index: 30; }
.block.dimmed { opacity: .18; pointer-events: none; }
.block .fn { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; opacity: .7; display: flex; align-items: center; gap: 5px; }
.block .ttl { font-weight: 600; font-size: 12.5px; margin-top: 2px; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.block .meta { position: absolute; bottom: 5px; left: 10px; right: 10px; display: flex; gap: 6px; align-items: center; font-size: 11px; opacity: .7; }
.block .lockicon { position: absolute; top: 6px; right: 7px; font-size: 11px; opacity: .8; }
.block .grip { position: absolute; right: 0; top: 0; bottom: 0; width: 9px; cursor: ew-resize; border-radius: 0 var(--r-md) var(--r-md) 0; }
.block .grip:hover { background: rgba(0,0,0,.12); }
.block .refdot { min-width: 14px; height: 14px; padding: 0 3px; border-radius: 7px; background: rgba(0,0,0,.12); display:inline-flex; align-items:center; justify-content:center; font-size: 11px; }

.lane { position: relative; height: 46px; border-top: 1px dashed var(--line-soft); }
.lane.hidden { display: none; }
.lane-bg { position: absolute; inset: 0; }
.lane:hover .lane-bg { background: rgba(0,0,0,.02); cursor: copy; }
.anchor { position: absolute; top: 8px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; z-index: 5; user-select: none; }
.anchor .pin { width: 22px; height: 22px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 11px; border: 1px solid var(--line); transition: transform var(--m-fast) var(--ease); }
.anchor:hover .pin { transform: scale(1.18); }
.anchor.selected .pin { outline: 2px solid var(--ink); }
.anchor .alabel { font-size: 11px; color: var(--ink-dim); max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: rgba(255,255,255,.85); padding: 0 4px; border-radius: 3px; }

.ghost-line { position: absolute; top: 26px; bottom: 0; width: 1px; background: var(--accent-line); pointer-events: none; z-index: 8; display: none; }

/* empty state */
.empty {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px; color: var(--ink-faint);
  text-align: center; padding: 30px;
}
.empty h3 { font-family: var(--sans); font-style: normal; font-size: 24px; letter-spacing: -.02em; color: var(--ink); font-weight: 400; }

/* ---------- inspector (bottom sheet, legacy) ---------- */
.inspector { height: 0; overflow: hidden; flex-shrink: 0; background: var(--panel); border-top: 1px solid var(--line); transition: height var(--m-smooth) var(--ease); display: flex; flex-direction: column; }
.inspector.open { height: 302px; }
.insp-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px 6px; flex-shrink: 0; }
.insp-head .fn-pick { display: flex; align-items: center; gap: 8px; }
.insp-title { flex: 1; font-weight: 600; font-size: 14px; background: transparent; border: 1px solid transparent; }
.insp-title:hover { border-color: var(--line); }
.insp-body { flex: 1; display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 16px; padding: 4px 16px 14px; min-height: 0; }
.insp-col { overflow-y: auto; min-height: 0; }
.insp-col h5 { font-size: 11px; letter-spacing: .14em; color: var(--ink-faint); text-transform: uppercase; margin: 8px 0 6px; font-weight: 500; }
.insp-col textarea { min-height: 120px; font-size: 13px; }
.ref-pill {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  background: transparent; border: 1px solid var(--line); border-radius: var(--r-pill);
  margin-bottom: 5px; font-size: 12px; cursor: pointer;
  transition: all var(--m-fast) var(--ease);
}
.ref-pill:hover { background: var(--ink); border-color: var(--ink); color: #fff; }
.ref-pill:hover [style*="color"] { color: inherit !important; }
.ref-pill .x { margin-left: auto; color: var(--ink-faint); padding: 0 3px; }
.ref-pill .x:hover { color: var(--danger); }
.anchor-line { display: flex; align-items: center; gap: 7px; padding: 4px 6px; border-radius: var(--r-sm); font-size: 12px; margin-bottom: 3px; cursor: pointer; }
.anchor-line:hover { background: var(--panel-2); }
.anchor-line .t { font-size: 11px; color: var(--ink-faint); min-width: 42px; }

/* ---------- tabs / cards ---------- */
.tabs { display: flex; gap: 18px; padding: 0 16px; border-bottom: 1px solid var(--line-soft); flex-shrink: 0; }
.tab { padding: 9px 0 10px; font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); border-bottom: 1px solid transparent; margin-bottom: -1px; transition: color var(--m-fast); }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--ink); }
.search-row { padding: 10px 14px 6px; display: flex; gap: 6px; flex-shrink: 0; }
.cat-row { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 14px 8px; flex-shrink: 0; }

.g-card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 12px 13px; margin-bottom: 7px; cursor: pointer; transition: all var(--m-fast) var(--ease); }
.g-card:hover { background: var(--ink); border-color: var(--ink); color: #fff; }
.g-card .nm { font-weight: 500; font-size: 12.5px; display: flex; align-items: center; gap: 7px; }
.g-card .nm .abbr { font-size: 11px; color: #fff; padding: 1px 5px; border-radius: 3px; font-weight: 600; }
.g-card .one { color: inherit; opacity: .65; font-size: 11.5px; margin-top: 3px; }
.g-card .tagrow { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.mini-tag { font-size: 11px; letter-spacing: .04em; padding: 2px 8px; border-radius: var(--r-pill); border: 1px solid var(--line); background: transparent; color: var(--ink-faint); }
.count-note { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); padding: 2px 14px 8px; }

/* ---------- modal ---------- */
.modal-veil {
  position: fixed; inset: 0; background: rgba(10,10,10,.45);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  opacity: 0; pointer-events: none; transition: opacity var(--m-smooth) var(--ease);
}
.modal-veil.open { opacity: 1; pointer-events: auto; }
.modal {
  width: min(700px, 92vw); max-height: 86vh; overflow-y: auto;
  background: var(--bg); border: none; border-radius: 20px;
  box-shadow: var(--e4); padding: 28px 30px;
  transform: translateY(12px); transition: transform var(--m-smooth) var(--ease);
}
.modal-veil.open .modal { transform: none; }
.modal h3 { font-family: var(--sans); font-style: normal; font-weight: 400; letter-spacing: -.02em; font-size: 24px; margin-bottom: 4px; }
.modal .subline { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 16px; }
.modal .close { position: sticky; float: right; top: 0; color: var(--ink-faint); font-size: 17px; padding: 2px 8px; border-radius: 50%; }
.modal .close:hover { color: var(--ink); }
.kv { margin-bottom: 14px; }
.kv h5 { font-size: 11px; letter-spacing: .16em; color: var(--ink-faint); text-transform: uppercase; margin-bottom: 5px; font-weight: 500; }
.kv p, .kv li { font-size: 13.5px; color: #333; }
.kv ul { padding-left: 18px; }
.kv .warn { color: var(--danger); }
.kv code { display: block; font-family: var(--mono); font-size: 12px; background: var(--bg-deep); border: 1px solid var(--line-soft); padding: 9px 11px; border-radius: var(--r-sm); color: var(--ink-dim); white-space: pre-wrap; }
.modal .actions { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }

/* export textarea */
.export-pre { width: 100%; height: 46vh; font-family: "Cascadia Mono", Consolas, monospace; font-size: 11.5px; background: var(--bg-deep); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; white-space: pre; overflow: auto; }

/* toast */
#toast {
  position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 60px);
  background: var(--ink); border: none; color: #fff;
  padding: 10px 22px; border-radius: var(--r-pill); font-size: 12.5px; z-index: 200;
  box-shadow: var(--e3); transition: transform var(--m-smooth) var(--ease), opacity var(--m-smooth);
  opacity: 0; pointer-events: none;
}
#toast.show { transform: translate(-50%, 0); opacity: 1; }

body.focus-mode .lane:not(.has-selection) { opacity: .35; }

kbd { font-size: 11px; background: var(--bg-deep); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; color: var(--ink-dim); }
.hint-row { color: var(--ink-faint); font-size: 11px; display: flex; gap: 12px; padding: 6px 14px; border-top: 1px solid var(--line-soft); flex-shrink: 0; flex-wrap: wrap; }

/* ============================================================
   CHARACTER STUDIO — app-specific
   ============================================================ */
.tabs-top { display:flex; gap:2px; background:transparent; border: 1px solid var(--line); border-radius:var(--r-pill); padding:3px; }
.tab-top { padding:6px 16px; border-radius:var(--r-pill); color:var(--ink-dim); font-size:12.5px; font-weight: 500; transition:all var(--m-fast) var(--ease); }
.tab-top:hover { color:var(--ink); }
.tab-top.active { background:var(--ink); color:#fff; font-weight:500; }

.filters-bar { display:flex; gap:8px; padding:12px 18px; border-bottom:1px solid var(--line-soft); flex-wrap:wrap; align-items:center; flex-shrink:0; background:var(--bg); }
.filters-bar select { max-width: 170px; }
.filters-bar input[type=search] { width: 220px; }

.grid-scroll { flex:1; overflow-y:auto; padding:18px; }
.char-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(232px,1fr)); gap:12px; }
.char-card {
  background:var(--panel); border:1px solid var(--line-soft); border-radius:var(--r-xl);
  padding:14px 16px; cursor:pointer; position:relative;
  transition: background var(--m-smooth) var(--ease), color var(--m-smooth) var(--ease), border-color var(--m-smooth) var(--ease), transform var(--m-fast) var(--ease);
}
.char-card:hover { background:var(--ink); border-color:var(--ink); color:#fff; transform:translateY(-2px); box-shadow:none; }
.char-card .cname { font-family:var(--sans); font-style:normal; font-size:17px; font-weight:400; letter-spacing:-.015em; }
.char-card .cwork { font-size: 11px; letter-spacing:.08em; text-transform:uppercase; color:var(--ink-faint); margin-top:2px; transition: color var(--m-smooth); }
.char-card:hover .cwork { color: rgba(255,255,255,.5); }
.char-card .cphil { font-size:11.5px; color:var(--ink-dim); margin-top:7px; display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; transition: color var(--m-smooth); }
.char-card:hover .cphil { color: rgba(255,255,255,.72); }
.char-card:hover .mini-tag { color: rgba(255,255,255,.7); border-color: rgba(255,255,255,.25); }
.char-card:hover .arch-badge { color: #fff; border-color: rgba(255,255,255,.4); }
.char-card .tagrow { display:flex; flex-wrap:wrap; gap:4px; margin-top:9px; }
.char-card .bkm { position:absolute; top:9px; right:12px; font-size:13px; opacity:.3; transition:opacity var(--m-fast); }
.char-card .bkm:hover, .char-card .bkm.on { opacity:1; color:inherit; }
.arch-badge { font-size: 11px; letter-spacing:.08em; padding:2px 9px; border-radius:var(--r-pill); background:transparent; border: 1px solid var(--accent-line); color:var(--ink); text-transform:uppercase; font-weight: 500; transition: all var(--m-smooth); }

/* builder layout */
.builder { display:flex; flex:1; min-height:0; }
.roster { width:250px; flex-shrink:0; background:var(--panel); border-right:1px solid var(--line-soft); display:flex; flex-direction:column; }
.roster-list { flex:1; overflow-y:auto; padding:8px; }
.roster-add {
  display:block; width:100%; min-height:42px; margin-top:6px; padding:10px;
  border:1px dashed var(--accent-line); border-radius:var(--r-md);
  color:var(--ink-dim); font-size:12.5px; text-align:center; cursor:pointer;
  transition: all var(--m-fast) var(--ease);
}
.roster-add:hover { border-color:var(--ink); color:var(--ink); border-style:solid; }
/* архетипные заготовки под полями конструктора */
.hint-chips { display:flex; flex-wrap:wrap; gap:5px; margin:7px 0 4px; }
.chip.mini { font-size:11px; padding:4px 10px; min-height:28px; border-style:dashed; }
.chip.mini.on { border-style:solid; }
.roster-item { padding:10px 12px; border-radius:var(--r-md); cursor:pointer; margin-bottom:3px; border:1px solid transparent; transition:all var(--m-fast) var(--ease); }
.roster-item:hover { background:var(--panel-2); }
.roster-item.active { background:var(--ink); color:#fff; border-color:var(--ink); }
.roster-item.active .rr { color: rgba(255,255,255,.55); }
.roster-item .rn { font-weight:500; font-size:13px; }
.roster-item .rr { font-size: 11px; letter-spacing:.06em; text-transform:uppercase; color:var(--ink-faint); }
.roster-item .prog { height:3px; background:rgba(0,0,0,.12); border-radius:2px; margin-top:7px; overflow:hidden; }
.roster-item.active .prog { background:rgba(255,255,255,.25); }
.roster-item .prog i { display:block; height:100%; background:var(--success); border-radius:2px; transition:width var(--m-smooth); }
.roster-item.active .prog i { background:#fff; }

.editor-wrap { flex:1; display:flex; flex-direction:column; min-width:0; }
.editor-scroll { flex:1; overflow-y:auto; padding:20px 28px 60px; }
.ed-section { max-width:820px; margin:0 auto 8px; }
.ed-grid2 { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.ed-grid3 { display:grid; grid-template-columns:1fr 1fr 1fr; gap:14px; }
label.f { display:block; font-size: 11px; letter-spacing:.14em; color:var(--ink-faint); margin:16px 0 5px; text-transform:uppercase; font-weight:500; }
label.f b { color:var(--ink); }
.fhint { font-size:11px; color:var(--ink-faint); margin-top:3px; }

/* arc editor */
.arc-type-row { display:flex; gap:6px; flex-wrap:wrap; margin:8px 0 4px; }
.arc-beats { margin-top:12px; }
.beat { display:flex; gap:12px; padding:14px 16px; background:var(--panel); border:1px solid var(--line-soft); border-radius:var(--r-lg); margin-bottom:8px; align-items:flex-start; transition:border-color var(--m-fast); }
.beat:focus-within { border-color:var(--ink); }
.beat .bnum { font-size: 11px; color:#fff; background:var(--ink); min-width:22px; height:22px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-weight:600; margin-top:2px; }
.beat .bmain { flex:1; }
.beat .bt { font-weight:500; font-size:13px; }
.beat .bq { font-size:11px; color:var(--ink-faint); margin:2px 0 6px; }
.beat textarea { min-height:44px; font-size:12.5px; }
.beat.done-b { border-color:rgba(85,112,74,.5); }

/* inspiration drawer */
.insp-drawer { width:330px; flex-shrink:0; background:var(--panel); border-left:1px solid var(--line-soft); display:flex; flex-direction:column; }
.icon-slot { border:1px dashed var(--line); border-radius:var(--r-lg); padding:11px 13px; margin-bottom:8px; transition:border-color var(--m-fast); }
.icon-slot:hover { border-color:var(--ink); }
.icon-slot .isn { font-weight:500; font-size:13px; display:flex; align-items:center; gap:8px; }
.icon-slot .isw { font-size: 11px; letter-spacing:.08em; text-transform:uppercase; color:var(--ink-faint); }
.icon-slot .adapt { font-size:11px; color:var(--warning); margin-top:5px; }
.scene-card { background:var(--bg-deep); border:1px solid var(--line-soft); border-radius:var(--r-sm); padding:9px 11px; margin-top:6px; font-size:11.5px; }
.scene-card .sw { color:var(--ink-dim); }
.scene-card .st { font-size: 11px; color:var(--ink-faint); text-transform:uppercase; letter-spacing:.1em; font-weight:500; }

/* ensemble */
.cast-board { flex:1; overflow-y:auto; padding:22px 28px; }
.pair-row { display:flex; gap:12px; align-items:stretch; flex-wrap:wrap; }
.pair-select { flex:1; min-width:230px; }
.dyn-card { background:var(--panel); border:1px solid var(--line-soft); border-radius:var(--r-xl); padding:18px 20px; margin-top:14px; }
.dyn-card h4 { font-family:var(--sans); font-style:normal; font-weight:400; letter-spacing:-.015em; font-size:19px; margin-bottom:8px; }
.axis { display:flex; align-items:center; gap:10px; margin:8px 0; font-size:12px; }
.axis .bar { flex:1; height:6px; background:rgba(0,0,0,.08); border-radius:3px; position:relative; }
.axis .bar i { position:absolute; top:-3px; width:12px; height:12px; border-radius:50%; background:var(--ink); }
.rel-tag { display:inline-block; padding:3px 11px; margin:2px 3px 2px 0; border-radius:var(--r-pill); font-size:11px; background:transparent; border:1px solid var(--line); }

/* v2.0 additions */
.welcome-veil { position: fixed; inset: 0; background: rgba(10,10,10,.5); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); z-index: 300; display: flex; align-items: center; justify-content: center; }
.welcome { width: min(560px,92vw); background: var(--ink); color: #fff; border: none; border-radius: 22px; padding: 32px 34px; box-shadow: var(--e4); }
.welcome h2 { font-family: var(--sans); font-style: normal; font-weight: 400; letter-spacing: -.02em; font-size: 28px; color: #fff; margin-bottom: 4px; }
.welcome .wsub { color: rgba(255,255,255,.6); font-size: 13px; margin-bottom: 20px; }
.welcome .btn { border-color: rgba(255,255,255,.25); color: rgba(255,255,255,.85); }
.welcome .btn:hover { border-color: #fff; color: #fff; }
.welcome .btn.primary { background: #fff; color: #000; border-color: #fff; }
.wstep { display: flex; gap: 13px; margin-bottom: 14px; align-items: flex-start; }
.wstep .wn { font-size: 11px; background: #fff; color: #000; min-width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; }
.wstep .wt { font-weight: 500; font-size: 14px; }
.wstep .wd { font-size: 12.5px; color: rgba(255,255,255,.6); }
.hk-row { display: flex; justify-content: space-between; gap: 14px; padding: 6px 0; border-bottom: 1px dashed var(--line-soft); font-size: 13px; }
.hk-row:last-child { border-bottom: none; }

/* active filters */
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 18px 8px; align-items: center; background: var(--bg); }
.af-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px 3px 13px; border-radius: var(--r-pill); font-size: 11.5px; background: var(--ink); border: 1px solid var(--ink); color: #fff; }
.af-chip button { color: #fff; opacity: .7; padding: 0 4px; font-size: 13px; }
.af-chip button:hover { opacity: 1; }

/* source badge */
.src-badge { position: absolute; top: 11px; left: 14px; font-size: 13px; opacity: .8; }
.char-card { padding-top: 32px; }
.char-card .bkm { top: 9px; }

/* compare */
.char-card.cmp-on { outline: 2px solid var(--ink); outline-offset: 1px; }
.cmp-bar { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 90; background: var(--ink); color: #fff; border: none; border-radius: var(--r-pill); padding: 9px 18px; display: flex; gap: 10px; align-items: center; box-shadow: var(--e4); font-size: 13px; }
.cmp-bar .btn { border-color: rgba(255,255,255,.3); color: rgba(255,255,255,.85); }
.cmp-bar .btn.primary { background: #fff; color: #000; border-color: #fff; }
.cmp-grid { display: grid; grid-template-columns: 130px 1fr 1fr; gap: 0; font-size: 12.5px; }
.cmp-grid > div { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
.cmp-grid .cmp-h { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint); font-weight: 500; }
.cmp-grid .cmp-name { font-family: var(--sans); font-style: normal; font-size: 17px; font-weight: 500; color: var(--ink); }

/* arc curve */
.arc-curve-wrap { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 14px 16px 6px; margin: 12px 0; }
.arc-curve-wrap svg { width: 100%; height: 110px; display: block; }
.arc-dot { cursor: pointer; }
.arc-lbl { font-size: 11px; fill: var(--ink-faint); }

/* inspiration in beats */
.beat .insp-btn { flex-shrink: 0; align-self: center; font-size: 15px; opacity: .45; padding: 4px 7px; border-radius: var(--r-sm); transition: opacity var(--m-fast); }
.beat .insp-btn:hover { opacity: 1; background: var(--panel-2); }

/* ensemble map */
.ens-map-wrap { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--r-xl); padding: 10px; margin-top: 16px; }
.ens-map-wrap svg { width: 100%; height: auto; display: block; }
.node-circ { cursor: pointer; transition: opacity .15s; }
.node-circ:hover { opacity: .75; }
.map-lbl { font-size: 11px; fill: var(--ink); font-family: var(--sans); pointer-events: none; }
.map-rel { font-size: 11px; fill: var(--ink-faint); }

/* mobile onboarding */
.welcome-veil { padding: 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.welcome { margin: auto; max-width: 100%; }
@media (max-width: 620px){
  .welcome { padding: 22px 18px; }
  .welcome h2 { font-size: 22px; }
  .welcome .actions { flex-wrap: wrap; }
  .welcome .actions .btn { width: 100%; justify-content: center; }
}

/* ============================================================
   CS v3 additions — портреты, формы архетипов, SVG-иконки,
   контейнер базы, вкладки модалки
   ============================================================ */
.svgi { display: inline-flex; width: 16px; height: 16px; vertical-align: -3px; }
.svgi svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }

/* контейнер базы + statement-шапка */
.grid-scroll { padding: 0 18px 40px; }
.char-grid { max-width: 1200px; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.base-head { max-width: 1200px; margin: 26px auto 6px; padding: 0 18px; }
.bh-kicker { font-size: .7rem; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 10px; }
.bh-title { font-size: clamp(1.4rem, 3vw, 2.1rem); font-weight: 400; letter-spacing: -.02em; line-height: 1.2; max-width: 30em; }
.bh-title .dim { color: var(--ink-faint); }
.filters-bar, .active-filters { max-width: 1236px; margin: 0 auto; border-bottom: none; }
.filters-bar { padding-top: 16px; }

/* портрет в маске архетипа */
.portrait {
  width: 84px; height: 84px; flex-shrink: 0;
  background: var(--arch, #555);
  overflow: hidden; position: relative;
  display: flex; align-items: center; justify-content: center;
}
.portrait img { width: 100%; height: 100%; object-fit: cover; object-position: center 18%; display: block; filter: grayscale(28%) contrast(1.02); }
.portrait .p-init { display: none; font-size: 30px; font-weight: 500; color: #fff; }
.portrait.noimg img { display: none; }
.portrait.noimg .p-init { display: block; }
.portrait.lg { width: 108px; height: 108px; }
.shape-circle { border-radius: 50%; }
.shape-squircle { border-radius: 30%; }
.shape-arch { border-radius: 50% 50% 10px 10px; }
.shape-diamond { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.shape-hex { clip-path: polygon(25% 3%, 75% 3%, 100% 50%, 75% 97%, 25% 97%, 0 50%); }
.shape-shard { clip-path: polygon(0 0, 100% 10%, 90% 100%, 6% 90%); }

/* карточка иконы v3 */
.char-card { display: flex; gap: 14px; align-items: flex-start; padding: 18px 16px 16px !important; border-top: 2px solid var(--arch, transparent); }
.char-card .cbody { min-width: 0; }
.char-card .cname { color: inherit; }
.char-card .arch-badge { border-color: var(--arch, var(--accent-line)); color: var(--arch, var(--ink)); }
.char-card:hover .arch-badge { border-color: rgba(255,255,255,.5); color: #fff; }
.char-card:hover .portrait { background: var(--arch); }
.char-card .src-badge { top: 12px; left: auto; right: 36px; opacity: .55; }
.char-card:hover .src-badge, .char-card:hover .bkm { color: #fff; }
.char-card { padding-top: 18px; }

/* модалка иконы: шапка + вкладки */
.icon-head { display: flex; gap: 18px; align-items: center; margin-bottom: 6px; }
.icon-head h3 { margin-bottom: 2px; }
.icon-head .actor { font-size: 13px; color: var(--ink-faint); }
.phil-lead { font-size: 1.05rem; line-height: 1.5; letter-spacing: -.01em; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); padding: 12px 0; }
.mtabs { display: flex; gap: 20px; border-bottom: 1px solid var(--line-soft); margin: 14px 0 16px; overflow-x: auto; }
.mtab { padding: 8px 0 10px; font-size: .74rem; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); border-bottom: 1px solid transparent; margin-bottom: -1px; white-space: nowrap; transition: color .2s var(--ease); }
.mtab:hover { color: var(--ink); }
.mtab.active { color: var(--ink); border-bottom-color: var(--ink); }
.mpane { display: none; }
.mpane.on { display: block; }
.jump-sim { color: var(--info); text-decoration: none; border-bottom: 1px solid rgba(61,90,128,.35); }
.jump-con { color: var(--danger); text-decoration: none; border-bottom: 1px solid rgba(164,72,60,.35); }
.pill-ico { display: inline-flex; }

@media (max-width: 640px) {
  .char-grid { grid-template-columns: 1fr; }
  .icon-head { gap: 14px; }
  .portrait.lg { width: 84px; height: 84px; }
}

/* ============================================================
   CHARACTER STUDIO — мобильный слой (375px как рабочая ширина)
   Шапка в одну строку не помещалась: бренд, переключатель баз и
   кнопка помощи наезжали друг на друга. Разводим в два ряда.
   ============================================================ */
@media (max-width: 720px){
  body {
    height: auto; min-height: 100%;
    overflow-x: hidden; overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  #app { height: auto; min-height: 100vh; }
  .topbar {
    height: auto; flex-wrap: wrap; align-items: center;
    padding: 10px 16px 0; gap: 8px 10px; position: sticky; top: 0;
  }
  .topbar .spacer { display: none; }
  .brand { font-size: 15px; }
  .brand small { display: block; margin: 2px 0 0; }
  #btnHelp { margin-left: auto; min-width: 40px; min-height: 40px; }
  .save-dot { display: none; }
  .tabs-top { order: 3; flex-basis: 100%; margin-bottom: 8px; overflow-x: auto; }
  .tab-top { flex: 1; justify-content: center; text-align: center; min-height: 42px; display: inline-flex; align-items: center; gap: 6px; }

  /* фильтры и управление базой */
  .filters-bar { gap: 8px; padding: 12px 14px; }
  .filters-bar input[type=search] { flex: 1 1 100%; width: auto; max-width: none; min-height: 44px; }
  .filters-bar select { flex: 1 1 calc(50% - 4px); max-width: none; min-height: 44px; }
  .filters-bar .btn { flex: 0 0 auto; }
  .grid-scroll { padding: 0 14px 40px; }
  .base-head { padding: 0 14px; }
  .btn, .chip, .pill, .icon-card .ic-act { min-height: 42px; }
  .tabs { gap: 12px; padding: 0 14px; overflow-x: auto; }
  .tab { min-height: 44px; display: inline-flex; align-items: center; white-space: nowrap; }

  /* Редактор персонажа: три десктопные колонки складываются вертикально.
     Иначе drawer референсов перекрывает toolbar на ширине 375 px. */
  .builder { display: block; overflow-y: auto; }
  .roster {
    width: 100%; max-height: 190px;
    border-right: 0; border-bottom: 1px solid var(--line-soft);
  }
  .editor-wrap { width: 100%; }
  .tl-toolbar { position: relative; z-index: 2; padding: 10px 14px; }
  .editor-scroll { overflow: visible; padding: 16px 14px 40px; }
  .ed-grid2, .ed-grid3 { grid-template-columns: 1fr; }
  .insp-drawer {
    width: 100%; min-height: 340px;
    border-left: 0; border-top: 1px solid var(--line-soft);
  }

  /* сравнение и ансамбль — вертикальным стеком, а не двумя колонками */
  .cmp-grid, .ens-grid, .duo, .two-col { grid-template-columns: 1fr !important; }
  .bh-title { font-size: 1.35rem; }
}

/* ============================================================
   CHARACTER STUDIO — раздел «Обзор» (landing-прослойка)
   Редакционно-комиксовая тема по референсу comic-portfolio:
   бумага + один глубокий красный, серифная гарнитура, тонкие
   линейки, ромбы-разделители, красная финальная плашка.
   ============================================================ */
/* вкладка «Обзор» — единственная, где скроллится сам #view:
   body заперт overflow:hidden, остальные вкладки скроллят внутренние панели */
#view.view-scroll { overflow-y: auto; }

.cs-start {
  --pp: #f4f0e7;          /* бумага */
  --pk: #1d1712;          /* чернила */
  --pk-dim: #5c554c;
  --red: #93251f;         /* единственный акцент */
  --hair: rgba(29,23,18,.22);
  --hair-soft: rgba(29,23,18,.12);
  --serif-d: Georgia, 'Times New Roman', serif;
  max-width: 1060px; margin: 14px auto 40px; padding: 30px clamp(16px, 4vw, 44px) 0;
  background: var(--pp); color: var(--pk);
  border: 1px solid var(--hair); outline: 1px solid var(--hair-soft); outline-offset: 4px;
}
.cs-start .cs-dia {
  display: inline-block; width: 6px; height: 6px; background: var(--red);
  transform: rotate(45deg); flex: none; align-self: center;
}

/* hero */
.cs-hero {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  gap: 26px; align-items: center; padding: 18px 0 30px; border-bottom: 1px solid var(--hair);
}
.cs-kicker {
  font-size: 11px; letter-spacing: .3em; text-transform: uppercase; font-weight: 600;
  color: var(--pk-dim); margin-bottom: 18px;
}
.cs-t {
  font-family: var(--serif-d); font-weight: 400; letter-spacing: .01em; line-height: 1.04;
  font-size: clamp(32px, 5.4vw, 56px); margin: 0 0 14px; text-transform: none;
}
.cs-t em { font-style: italic; color: var(--red); }
.cs-tag { font-family: var(--serif-d); font-style: italic; font-size: 17px; color: var(--red); margin: 0 0 12px; }
.cs-p { font-size: 14px; line-height: 1.6; max-width: 46ch; color: var(--pk-dim); margin: 0; }
.cs-hero-act { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 24px; }
.cs-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 22px;
  background: var(--red); color: #f6f1e6; border: 1px solid var(--red); border-radius: 0;
  font-size: 11px; letter-spacing: .18em; text-transform: uppercase; font-weight: 600; cursor: pointer;
  transition: background var(--m-fast) var(--ease), color var(--m-fast) var(--ease);
}
.cs-btn:hover { background: #741c17; border-color: #741c17; }
.cs-btn .svgi svg { stroke: currentColor; }
.cs-note { font-size: 11px; letter-spacing: .06em; color: var(--pk-dim); }

.cs-hero-art { position: relative; min-height: 300px; display: flex; align-items: center; justify-content: center; }
.cs-hero-circle {
  position: absolute; width: min(78%, 300px); aspect-ratio: 1; border-radius: 50%;
  background: var(--red); inset: 0; margin: auto;
}
.cs-hero-img {
  position: relative; width: min(62%, 235px); aspect-ratio: 3/4; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--hair); background: #e9e2d3;
  box-shadow: 0 18px 40px rgba(29,23,18,.28);
}
.cs-hero-img img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.06); }
.cs-hero-img.noimg i, .cw-img.noimg i, .cm-img.noimg i {
  font-style: normal; font-family: var(--serif-d); font-size: 34px; color: var(--pk);
}
.cs-hero-img.noimg, .cw-img.noimg, .cm-img.noimg { background: var(--arch, #e9e2d3); }

/* строка фактов */
.cs-proof {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px 16px;
  padding: 16px 0; border-bottom: 1px solid var(--hair);
  font-size: 11px; letter-spacing: .2em; text-transform: uppercase; font-weight: 600; color: var(--pk-dim);
}

/* секции */
.cs-sec { padding: 40px 0 44px; border-bottom: 1px solid var(--hair); }
.cs-sec-head {
  display: flex; justify-content: center; margin-bottom: 10px;
  font-size: 11px; letter-spacing: .3em; text-transform: uppercase; font-weight: 600; color: var(--red);
}
.cs-sec-t {
  display: flex; align-items: center; justify-content: center; gap: 14px; text-align: center;
  font-family: var(--serif-d); font-weight: 400; letter-spacing: .01em; line-height: 1.1;
  font-size: clamp(22px, 3.6vw, 32px); margin: 0 0 10px;
}
.cs-sec-t.cs-left { justify-content: flex-start; text-align: left; }
.cs-sec-p { font-size: 13.5px; line-height: 1.6; color: var(--pk-dim); text-align: center; max-width: 62ch; margin: 0 auto 26px; }

/* (01) три ситуации — колонки с иконками и нумерацией */
.cs-flow { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 26px; }
.cs-step {
  position: relative; display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 0; padding: 8px 22px; background: transparent; border: none; cursor: pointer;
}
.cs-step + .cs-step { border-left: 1px solid var(--hair); }
.cs-step + .cs-step::before {
  content: ''; position: absolute; left: -3.5px; top: 50%; width: 6px; height: 6px;
  background: var(--red); transform: translateY(-50%) rotate(45deg);
}
.st-ico { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px;
  border: 1px solid var(--pk); border-radius: 50%; margin-bottom: 14px;
  transition: background var(--m-fast) var(--ease); }
.st-ico .svgi svg { width: 22px; height: 22px; stroke: currentColor; }
.cs-step:hover .st-ico { background: var(--red); border-color: var(--red); color: #f6f1e6; }
.st-n { font-family: var(--serif-d); font-size: 26px; color: var(--red); margin-bottom: 4px; }
.st-t { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; line-height: 1.4; }
.st-d { font-size: 12.5px; line-height: 1.55; color: var(--pk-dim); margin-top: 8px; max-width: 30ch; }

/* (02) архетипы — крупные портретные карточки */
.cs-works { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.cs-work {
  display: flex; flex-direction: column; text-align: left; background: transparent; cursor: pointer;
  border: 1px solid var(--red); padding: 7px; gap: 0;
  transition: box-shadow var(--m-fast) var(--ease), transform var(--m-fast) var(--ease);
}
.cs-work:hover { box-shadow: 0 12px 28px rgba(29,23,18,.2); transform: translateY(-2px); }
.cw-img {
  display: flex; align-items: center; justify-content: center; aspect-ratio: 3/4; overflow: hidden;
  border: 1px solid var(--hair-soft); background: #e9e2d3;
}
.cw-img img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--m-smooth) var(--ease); }
.cs-work:hover .cw-img img { transform: scale(1.04); }
.cw-name { font-family: var(--serif-d); font-size: 19px; margin: 12px 6px 2px; }
.cw-meta { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--red); margin: 0 6px 8px; }
.cs-allrow { display: flex; justify-content: center; margin-top: 24px; }
.cs-more {
  display: inline-flex; align-items: center; gap: 8px; background: transparent; border: none;
  border-bottom: 1px solid var(--red); padding: 8px 2px; min-height: 40px; cursor: pointer;
  font-size: 11px; letter-spacing: .18em; text-transform: uppercase; font-weight: 600; color: var(--pk);
}
.cs-more:hover { color: var(--red); }
.cs-more .svgi svg { stroke: currentColor; }

/* (03) свита — пример пати + свободный слот */
.cs-crew { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.6fr); gap: 30px; align-items: center; }
.cs-crew .cs-sec-head { justify-content: flex-start; }
.cs-crew .cs-sec-p { text-align: left; margin: 0 0 20px; }
.cs-crew-strip { display: flex; align-items: stretch; gap: 10px; }
.cs-crew-strip > .cs-dia { align-self: center; }
.cs-mate { flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: center; background: transparent; border: none; padding: 0; }
.cm-img {
  display: flex; align-items: center; justify-content: center; aspect-ratio: 3/4; overflow: hidden;
  border: 1px solid var(--hair); background: #e9e2d3; margin-bottom: 10px;
}
.cm-img img { width: 100%; height: 100%; object-fit: cover; }
.cm-role { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; font-weight: 600; color: var(--red); }
.cm-name { font-family: var(--serif-d); font-size: 14.5px; margin-top: 2px; line-height: 1.2; }
.cm-why { font-size: 11px; line-height: 1.45; color: var(--pk-dim); margin-top: 4px; }
.cs-mate-add { cursor: pointer; }
.cs-mate-add .cm-plus {
  border: 1px dashed var(--red); background: transparent; color: var(--red);
  font-family: var(--serif-d); font-size: 44px; font-weight: 400;
  transition: background var(--m-fast) var(--ease), color var(--m-fast) var(--ease);
}
.cs-mate-add:hover .cm-plus { background: var(--red); color: #f6f1e6; }

/* живое демо */
.cs-demo { max-width: 760px; margin: 18px auto 0; border: 1px solid var(--hair); padding: 22px; }
.cs-demo-q { font-family: var(--serif-d); font-size: 17px; margin: 0 0 14px; text-align: center; }
.cs-demo-fns { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 18px; }
.cs-fn {
  padding: 9px 15px; min-height: 40px; font-size: 12px; letter-spacing: .04em; cursor: pointer;
  background: transparent; color: var(--pk); border: 1px solid var(--hair); border-radius: 0;
  transition: all var(--m-fast) var(--ease);
}
.cs-fn:hover { border-color: var(--red); color: var(--red); }
.cs-fn.on { background: var(--red); color: #f6f1e6; border-color: var(--red); }
.cs-demo-out { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--hair); border: 1px solid var(--hair); }
.cs-demo-card { background: var(--pp); padding: 16px 18px; }
.cd-name { font-family: var(--serif-d); font-size: 19px; }
.cd-work { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--red); margin-top: 4px; }
.cd-phil { font-size: 13px; line-height: 1.5; color: var(--pk-dim); margin-top: 10px; }
.cd-take { font-size: 12.5px; line-height: 1.5; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--hair-soft); }
.cd-take span { display: block; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--red); margin-bottom: 4px; }
.cd-empty { background: var(--pp); padding: 16px 18px; color: var(--pk-dim); font-size: 13px; grid-column: 1/-1; }

/* поля карточки */
.cs-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1px; background: var(--hair-soft); border: 1px solid var(--hair-soft); margin-top: 22px; }
.cs-field { background: var(--pp); padding: 18px 20px; }
.cs-field .cf-n { display: block; font-family: var(--serif-d); font-size: 15px; color: var(--red); margin-bottom: 8px; }
.cs-field b { display: block; font-family: var(--serif-d); font-weight: 400; font-size: 17px; }
.cs-field span:last-child { display: block; font-size: 12.5px; line-height: 1.5; color: var(--pk-dim); margin-top: 6px; }

/* FAQ */
.cs-rows { border-top: 1px solid var(--hair-soft); margin-top: 22px; }
.cs-row {
  display: flex; align-items: flex-start; gap: 16px; width: 100%; text-align: left; cursor: pointer;
  background: transparent; border: none; border-bottom: 1px solid var(--hair-soft);
  padding: 18px 4px; min-height: 56px; color: inherit;
}
.cr-n { font-family: var(--serif-d); font-size: 15px; color: var(--red); min-width: 26px; padding-top: 2px; }
.cr-body { flex: 1; min-width: 0; }
.cr-t { display: block; font-family: var(--serif-d); font-size: clamp(16px, 2.2vw, 19px); }
.cr-d { display: block; font-size: 13px; line-height: 1.55; color: var(--pk-dim); margin-top: 5px; max-width: 72ch; }
.cr-a { display: inline-flex; padding-top: 4px; color: var(--red); }
.cr-a svg { stroke: currentColor; }
.cs-faq .cs-faq-a { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.cs-faq .cs-faq-row.open .cs-faq-a { display: block; overflow: visible; }
.cs-faq .cs-faq-x { opacity: .55; transition: transform var(--m-fast) var(--ease), opacity var(--m-fast); }
.cs-faq .cs-faq-row.open .cs-faq-x { transform: rotate(180deg); opacity: 1; }

/* финальная красная плашка */
.cs-band {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px 34px; align-items: center;
  background: var(--red); color: #f6f1e6; padding: 34px 36px;
  margin: 40px calc(clamp(16px, 4vw, 44px) * -1) 0;
}
.cs-band h2 { font-family: var(--serif-d); font-weight: 400; font-size: clamp(24px, 4vw, 36px); line-height: 1.08; margin: 0 0 10px; }
.cs-band p { font-size: 13.5px; line-height: 1.55; color: rgba(246,241,230,.85); margin: 0; max-width: 46ch; }
.cs-band-act { display: flex; flex-direction: column; gap: 12px; }
.cs-btn-inv { background: #f6f1e6; color: var(--red); border-color: #f6f1e6; }
.cs-btn-inv:hover { background: #fff; border-color: #fff; }
.cs-btn-ghost { background: transparent; color: #f6f1e6; border-color: rgba(246,241,230,.6); }
.cs-btn-ghost:hover { background: rgba(246,241,230,.12); border-color: #f6f1e6; }
.cs-after { text-align: center; font-size: 11.5px; letter-spacing: .05em; color: var(--pk-dim); padding: 18px 0 22px; }

@media (max-width: 860px){
  .cs-works { grid-template-columns: repeat(2, 1fr); }
  .cs-crew { grid-template-columns: 1fr; }
  .cs-crew-strip { flex-wrap: wrap; }
  .cs-crew-strip > .cs-dia { display: none; }
  .cs-mate { flex: 1 1 calc(33% - 10px); }
}
@media (max-width: 720px){
  .cs-start { margin: 8px auto 30px; outline: none; }
  .cs-hero { grid-template-columns: 1fr; padding-top: 8px; }
  .cs-hero-art { order: -1; min-height: 240px; }
  .cs-hero-circle { width: min(64%, 230px); }
  .cs-hero-img { width: min(50%, 180px); }
  .cs-flow { grid-template-columns: 1fr; }
  .cs-step { padding: 22px 6px; }
  .cs-step + .cs-step { border-left: none; border-top: 1px solid var(--hair); }
  .cs-step + .cs-step::before { left: 50%; top: -3.5px; transform: translateX(-50%) rotate(45deg); }
  .cs-works { grid-template-columns: 1fr 1fr; gap: 12px; }
  .cs-mate { flex: 1 1 calc(50% - 10px); }
  .cs-demo { padding: 16px; }
  .cs-demo-out, .cs-fields { grid-template-columns: 1fr; }
  .cs-fn { flex: 1 1 calc(50% - 8px); }
  .cs-band { grid-template-columns: 1fr; padding: 26px 20px; }
  .cs-band-act { flex-direction: column; }
  .cs-btn { width: 100%; justify-content: center; }
}

