:root {
  --bg: #2b2b2b;
  --bg-deep: #1e1e1e;
  --surface: #383838;
  --surface-2: #323232;
  --surface-3: #404040;
  --text: #e8e8e8;
  --muted: #a8a8a8;
  --border: #555555;
  --accent: #3d7eff;
  --accent-hover: #5a92ff;
  --accent-soft: #2c5aa0;
  --danger: #ff6b6b;
  --danger-bg: #4a2222;
  --ok: #6bcf7a;
  --ok-bg: #243528;
  --warn-bg: #3d3520;
  --warn-border: #6a5a30;
  --radius: 4px;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  --ctrl-pad-y: 0.28rem;
  --ctrl-pad-x: 0.5rem;
  --ctrl-h: 1.75rem;
  --ctrl-fs: 0.84rem;
  font-family: "Segoe UI", "Candara", "Trebuchet MS", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  /* Волны колокольчика не должны раздувать ширину документа / горизонтальный скролл. */
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg-deep);
  overflow-x: hidden;
  max-width: 100%;
}

.app {
  max-width: 100%;
  width: 100%;
  margin: 0;
  padding: 0.75rem clamp(0.75rem, 2vw, 1.5rem) 2rem;
  box-sizing: border-box;
  overflow-x: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 40;
  overflow: visible;
}

.brand {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar-actions[hidden] {
  display: none !important;
}

.view {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.15rem 1.25rem;
}

h1 {
  margin: 0 0 0.3rem;
  font-size: 1.35rem;
}

.lead {
  margin: 0 0 0.85rem;
  color: var(--muted);
  line-height: 1.4;
  font-size: 0.9rem;
}

.form {
  display: grid;
  gap: 0.65rem;
  max-width: 420px;
}

label {
  display: grid;
  gap: 0.2rem;
  font-size: 0.84rem;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="url"],
input[type="number"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: var(--ctrl-pad-y) var(--ctrl-pad-x);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-size: var(--ctrl-fs);
  line-height: 1.3;
  min-height: var(--ctrl-h);
  background: var(--bg-deep);
  color: var(--text);
  box-sizing: border-box;
}

textarea {
  min-height: 3.4rem;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 1px solid var(--accent);
  border-color: var(--accent);
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: var(--ctrl-pad-y) 0.7rem;
  font: inherit;
  font-size: var(--ctrl-fs);
  font-weight: 600;
  line-height: 1.25;
  min-height: var(--ctrl-h);
  cursor: pointer;
  background: var(--accent);
  color: #fff;
}

.btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-ghost:hover:not(:disabled) {
  background: #eef3f1;
}

.btn-small,
.btn-sm {
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
  min-height: 1.65rem;
  border-radius: var(--radius);
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.error {
  margin: 0 0 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 8px;
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #f0c4c4;
}

.create-story-panel {
  margin: 1rem 0 1.5rem;
}

.create-story-panel select {
  width: 100%;
  max-width: 28rem;
  padding: var(--ctrl-pad-y) var(--ctrl-pad-x);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-size: var(--ctrl-fs);
  min-height: var(--ctrl-h);
  background: var(--bg-deep);
  color: var(--text);
}

.empty {
  padding: 1.25rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.editor-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0 0 0.55rem;
  padding: 0.25rem;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-sizing: border-box;
}

.editor-subnav-nested {
  margin-top: 0.25rem;
  background: var(--surface-2);
}

.content-stub {
  margin-top: 0.75rem;
}

/* —— Контент: общие компактные стили (Фоны / Арты / Аудио) —— */
.cx-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.cx-sub {
  margin: 0 0 0.3rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.cx-note {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}

.cx-muted {
  margin: 0 0 0.25rem;
  font-size: 0.76rem;
  color: var(--muted);
}

.cx-empty {
  margin: 0.35rem 0;
  padding: 0.4rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
}

.cx-prev {
  display: grid;
  gap: 0.2rem;
  justify-items: start;
  margin: 0 0 0.55rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.cx-prev-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  min-width: 0;
}

.cx-prev-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.8rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cx-prev-frame {
  position: relative;
  border-radius: 4px;
  background: var(--bg-deep);
  overflow: hidden;
}

.cx-prev-frame.is-bg {
  width: min(220px, 100%);
  height: 140px;
  background: transparent;
}

.cx-prev-frame.is-art {
  width: 146px;
  height: 260px;
  background: transparent;
}

.cx-prev-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cx-prev-note {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0.4rem;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.3;
}

.cx-prev-note[hidden],
.cx-prev-frame img[hidden] {
  display: none;
}

.bg-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin: 0 0 0.35rem;
}

.bg-file-label {
  cursor: pointer;
  margin: 0;
}

.bg-drop {
  margin: 0 0 0.5rem;
  padding: 0.45rem 0.5rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
  background: var(--bg-deep);
  font-size: 0.78rem;
}

.bg-drop.is-dragover {
  border-color: var(--accent);
  color: var(--text);
}

/* Совместимость со старыми id/классами превью в Редакторе */
.bg-preview {
  margin: 0 0 0.55rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.bg-preview-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.bg-preview-frame {
  margin-top: 0.35rem;
  display: inline-block;
  width: fit-content;
  max-width: min(320px, 100%);
  vertical-align: top;
  background: transparent;
  border-radius: 4px;
  overflow: hidden;
  line-height: 0;
}

.bg-preview-frame img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
}

.media-preview {
  margin: 0 0 0.55rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.cx-prev-frame.is-cut {
  width: min(360px, 100%);
  height: 220px;
}

.cx-prev-frame.is-item {
  width: 128px;
  height: 128px;
}

.cx-prev-frame.is-pc-sticker {
  width: 96px;
  height: 96px;
}

.cx-prev-frame.is-pc-image {
  width: 72px;
  height: 96px;
}

.cut-preview-video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
  border-radius: 0;
}

.media-preview-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}


.ed-step-art-preview {
  margin: 0 0 0.5rem;
}

.ed-step-art-frame {
  max-width: min(160px, 100%);
}

.ed-step-art-frame img {
  max-height: 240px;
}

.item-edit {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
}

.item-edit .item-field-hint {
  margin: 0;
  line-height: 1.25;
}

.item-edit .chx-kv + .item-field-hint {
  margin-top: -0.2rem;
}

.item-desc-count {
  margin: 0.1rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.item-desc-count.is-over {
  color: #e8a0a0;
}

.item-key-block {
  display: grid;
  gap: 0.12rem;
  margin: 0.15rem 0 0;
}

.item-key-block .cx-muted {
  margin: 0;
  line-height: 1.25;
}

.item-key-block code {
  font-weight: 600;
  color: var(--text, #e8eef6);
}

.item-edit-actions {
  margin-top: 0.25rem;
}

.item-rename-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.75rem;
}

.mech-new {
  margin: 0 0 0.5rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.mech-new-title {
  font-weight: 600;
  font-size: 0.8rem;
  margin-bottom: 0.3rem;
}

.mech-new-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: end;
}

.mech-new-name {
  flex: 1 1 180px;
  margin: 0;
}

.mech-split {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 0.55rem;
  align-items: start;
}

@media (max-width: 720px) {
  .mech-split {
    grid-template-columns: 1fr;
  }
}

.mech-list-col,
.mech-detail-col {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 0.4rem 0.5rem;
  min-height: 6rem;
  min-width: 0;
}

.mech-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.1rem;
  max-height: min(360px, 50vh);
  overflow: auto;
}

.mech-list-btn {
  width: 100%;
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  border-radius: 3px;
  padding: 0.2rem 0.4rem;
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.25;
  min-height: 1.7rem;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mech-list-btn:hover {
  background: var(--bg-deep);
}

.mech-list-item.is-active .mech-list-btn {
  background: #2c4a6e;
  border-color: transparent;
}

.mech-detail-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.mech-detail-empty {
  margin: 0.75rem 0;
}

.mech-detail-col .chx-kv {
  margin: 0.35rem 0;
}

.mech-detail-col .chx-footer {
  margin-top: 0.5rem;
}

.bg-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
  max-height: min(420px, 55vh);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.bg-row {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  padding: 0.1rem 0.25rem 0.1rem 0.15rem;
  background: var(--surface-2);
}

.bg-row.is-alt {
  background: color-mix(in srgb, var(--surface-2) 70%, #000 30%);
}

.bg-name-btn {
  flex: 1 1 auto;
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  border-radius: 3px;
  padding: 0.2rem 0.4rem;
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.25;
  min-height: 1.7rem;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bg-name-btn:hover {
  background: var(--bg-deep);
}

.bg-row.is-active {
  background: #2c4a6e;
}

.bg-row.is-active .bg-name-btn {
  border-color: transparent;
  background: transparent;
}

.audio-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.5rem 0.75rem;
  margin: 0 0 0.4rem;
}

.audio-search-field {
  flex: 1 1 200px;
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.audio-search-field input {
  margin-top: 0.15rem;
}

.audio-loop-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--muted);
  padding-bottom: 0.3rem;
  white-space: nowrap;
}

.audio-panels {
  display: grid;
  grid-template-rows: minmax(140px, 1fr) minmax(120px, 1fr);
  gap: 0.55rem;
  min-height: 0;
}

.audio-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.audio-scroll {
  min-height: 0;
  max-height: min(240px, 32vh);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-deep);
}

.audio-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
}

.audio-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.4rem;
  padding: 0.18rem 0.4rem;
  background: var(--surface-2);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}

.audio-row:last-child {
  border-bottom: none;
}

.audio-row.is-alt {
  background: color-mix(in srgb, var(--surface-2) 72%, #000 28%);
}

.audio-row.is-playing {
  background: color-mix(in srgb, #1a4558 85%, var(--surface-2));
}

.audio-name {
  flex: 1 1 10rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
}

.audio-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem;
}

.audio-ico {
  display: inline-block;
  min-width: 0.85em;
  text-align: center;
  font-size: 0.85em;
  line-height: 1;
  opacity: 0.95;
}

.audio-btn-lbl {
  margin-left: 0.2rem;
}

.audio-row .btn {
  padding: 0.12rem 0.4rem;
  min-height: 1.55rem;
  font-size: 0.78rem;
}

.audio-row .btn.is-playing {
  border-color: var(--accent);
  color: #dff0ff;
}

@media (max-width: 720px) {
  .audio-panels {
    grid-template-rows: auto auto;
  }

  .audio-scroll {
    max-height: 200px;
  }
}

/* —— Контент → Персонажи (≈ Unity: список слева, одна карточка справа) —— */
.chx-block {
  margin: 0 0 0.6rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.chx-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
  margin: 0 0 0.4rem;
}

.chx-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.chx-note,
.chx-muted,
.chx-muted-inline {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.3;
}

.chx-muted {
  margin: 0.2rem 0;
}

.chx-muted-inline {
  font-weight: 400;
}

.chx-sub {
  margin: 0.55rem 0 0.25rem;
  font-size: 0.82rem;
  font-weight: 600;
}

.chx-grid2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.3rem 0.9rem;
}

/* Подпись слева, поле справа — как EditorGUILayout.TextField в Unity. */
.chx-kv {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr);
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.15rem 0;
}

.chx-kv input,
.chx-kv select,
.chx-kv textarea {
  width: 100%;
  min-width: 0;
  font: inherit;
  font-size: var(--ctrl-fs);
  color: var(--text);
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--ctrl-pad-y) var(--ctrl-pad-x);
  min-height: var(--ctrl-h);
  box-sizing: border-box;
}

.chx-kv textarea {
  min-height: 4.5rem;
  resize: vertical;
  align-self: start;
}

.chx-kv:has(textarea) {
  align-items: start;
}

.chx-create {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.6rem;
  margin: 0 0 0.5rem;
}

.chx-create .chx-kv {
  margin: 0;
  grid-template-columns: auto minmax(10rem, 16rem);
}

.chx-partner-block {
  margin: 0 0 0.55rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-deep);
  display: grid;
  gap: 0.2rem;
}

.chx-partner-block .chx-kv {
  grid-template-columns: 9.5rem minmax(0, 1fr);
  margin: 0;
}

.card-foldout .chx-partner-block {
  margin-top: 0.55rem;
}

.chx-split {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 0.6rem;
  align-items: start;
}

.chx-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-deep);
  padding: 0.35rem;
  max-height: 70vh;
  overflow: auto;
}

.chx-list .chx-sub {
  margin: 0 0 0.3rem;
  color: var(--muted);
  font-weight: 400;
}

.chx-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.2rem;
}

.chx-list-btn {
  width: 100%;
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.18rem 0.45rem;
  font: inherit;
  font-size: var(--ctrl-fs);
  min-height: var(--ctrl-h);
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chx-list-btn:hover {
  border-color: var(--accent);
}

.chx-list-btn.is-active {
  background: #2c4a6e;
  border-color: var(--accent);
  font-weight: 600;
}

.chx-detail {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0.5rem 0.65rem;
}

.chx-detail > .chx-title {
  margin-bottom: 0.3rem;
}

.chx-tabs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 0.2rem;
  padding: 0.2rem;
  margin: 0.25rem 0 0.45rem;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.chx-tabs .editor-tab-btn {
  padding: 0.2rem 0.4rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chx-tabs-nested {
  background: var(--surface-2);
}

.chx-count {
  display: inline-block;
  min-width: 1.2em;
  margin-left: 0.2rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.72rem;
  font-weight: 400;
}

.chx-split2 {
  display: grid;
  grid-template-columns: minmax(220px, 360px) minmax(0, 1fr);
  gap: 0.6rem;
  align-items: start;
}

.chx-keys {
  display: grid;
  gap: 0.3rem;
  align-content: start;
  min-width: 0;
}

.chx-key-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.2rem;
  max-height: 280px;
  overflow: auto;
}

.chx-key {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.chx-key-btn {
  flex: 1 1 auto;
  min-width: 0;
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.12rem 0.45rem;
  font: inherit;
  font-size: 0.8rem;
  min-height: 1.65rem;
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chx-key-btn:hover {
  border-color: var(--accent);
}

.chx-key.is-active .chx-key-btn {
  background: #2c4a6e;
  border-color: var(--accent);
}

.chx-file {
  cursor: pointer;
  margin: 0;
  text-align: center;
}

.chx-drop {
  margin: 0;
  padding: 0.45rem 0.5rem;
  font-size: 0.78rem;
}

.chx-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.chx-prev {
  display: grid;
  gap: 0.2rem;
  justify-items: start;
  align-content: start;
  min-width: 0;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.chx-prev-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  min-width: 0;
}

.chx-prev-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.8rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chx-prev-head .is-off {
  visibility: hidden;
}

/* Фиксированная рамка 9:16 (квадрат для иконок): размер не зависит от того, есть ли картинка. */
.chx-prev-frame {
  position: relative;
  width: 146px;
  height: 260px;
  flex: none;
  border-radius: 4px;
  background: var(--bg-deep);
  overflow: hidden;
}

.chx-prev.is-square .chx-prev-frame {
  width: 128px;
  height: 128px;
}

.chx-prev-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.chx-prev-note {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0.4rem;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.3;
}

.chx-prev-note[hidden],
.chx-prev-frame img[hidden] {
  display: none;
}

.chx-status-miss {
  margin: 0;
  padding: 0.3rem 0.45rem;
  border-radius: var(--radius);
  background: var(--warn-bg, #3a3220);
  color: var(--text);
  font-size: 0.78rem;
}

.chx-warn {
  margin: 0 0 0.45rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--warn-border, #6a5a30);
  border-radius: var(--radius);
  background: var(--warn-bg, #3a3220);
  font-size: 0.78rem;
  line-height: 1.35;
  display: grid;
  gap: 0.2rem;
}

.chx-footer {
  margin-top: 0.6rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--border);
}

.chx-danger {
  border-color: #6a3030 !important;
  color: var(--danger) !important;
}

@media (max-width: 860px) {
  .chx-split,
  .chx-split2,
  .chx-grid2 {
    grid-template-columns: 1fr;
  }
}

.story-mainnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.3rem;
  padding: 0.3rem;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-sizing: border-box;
  position: sticky;
  top: 0;
  z-index: 20;
}

.story-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  margin: 0 0 0.45rem;
}

.story-section-head h2,
.story-section-head .editor-scenes-heading {
  margin: 0;
}

.story-section-head-sm {
  margin-bottom: 0.35rem;
}

.story-section-note {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.3;
  min-width: 0;
}

.story-mainnav-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.4rem 1.1rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  min-height: 2.2rem;
  line-height: 1.25;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.story-mainnav-count {
  display: inline-block;
  min-width: 1.3rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--warn-bg);
  color: #f0c674;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.3rem;
  text-align: center;
}

.story-mainnav-count[hidden] {
  display: none;
}

.story-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin: 0 0 0.45rem;
}

.story-id-fold summary {
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--muted);
}

.story-id-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.story-id-note {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
}

.story-mainnav-btn:hover:not(:disabled) {
  background: var(--surface-3);
  border-color: var(--border);
}

.story-mainnav-btn.is-active {
  background: var(--accent-soft);
  border-color: var(--accent-soft);
  color: #fff;
  font-weight: 600;
}

.story-mainnav-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.home-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1rem;
}

.nested-panel {
  margin: 1rem 0;
  box-shadow: none;
}

.editor-scenes-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

/* —— Редактор: 3 колонки + разделители —— */
.ed-layout {
  display: grid;
  grid-template-columns: var(--ed-w-scenes, 220px) 8px var(--ed-w-steps, 280px) 8px minmax(260px, 1fr);
  gap: 0;
  align-items: stretch;
  min-height: min(72vh, 820px);
  font-size: 0.9rem;
}

.ed-split {
  width: 8px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: col-resize;
  touch-action: none;
  position: relative;
  z-index: 2;
  align-self: stretch;
}

.ed-split::before {
  content: "";
  position: absolute;
  top: 0.35rem;
  bottom: 0.35rem;
  left: 3px;
  width: 2px;
  border-radius: 1px;
  background: var(--border);
  opacity: 0.85;
}

.ed-split:hover::before,
.ed-split:focus-visible::before,
body.ed-col-resizing .ed-split:hover::before {
  background: var(--accent);
  opacity: 1;
}

body.ed-col-resizing {
  cursor: col-resize;
  user-select: none;
}

body.ed-col-resizing iframe {
  pointer-events: none;
}

@media (max-width: 1100px) {
  .ed-layout {
    grid-template-columns: 1fr;
    min-height: 0;
    gap: 0.55rem;
  }
  .ed-split {
    display: none;
  }
}

/* тонкий скролл под тёмную тему */
.ed-scroll,
.ed-scene-list,
.ed-step-list,
.ed-scene-params,
.ed-step-scroll,
.ed-detail-scroll,
.editor-warnings-body,
.save-result-list,
.validate-results,
.validate-list {
  scrollbar-width: thin;
  scrollbar-color: #5a5a5a #252525;
}

.ed-scroll::-webkit-scrollbar,
.ed-scene-list::-webkit-scrollbar,
.ed-step-list::-webkit-scrollbar,
.ed-scene-params::-webkit-scrollbar,
.ed-step-scroll::-webkit-scrollbar,
.ed-detail-scroll::-webkit-scrollbar,
.editor-warnings-body::-webkit-scrollbar,
.save-result-list::-webkit-scrollbar,
.validate-results::-webkit-scrollbar,
.validate-list::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

.ed-scroll::-webkit-scrollbar-track,
.ed-scene-list::-webkit-scrollbar-track,
.ed-step-list::-webkit-scrollbar-track,
.ed-scene-params::-webkit-scrollbar-track,
.ed-step-scroll::-webkit-scrollbar-track,
.ed-detail-scroll::-webkit-scrollbar-track,
.editor-warnings-body::-webkit-scrollbar-track,
.save-result-list::-webkit-scrollbar-track,
.validate-results::-webkit-scrollbar-track,
.validate-list::-webkit-scrollbar-track {
  background: #252525;
  border-radius: 6px;
}

.ed-scroll::-webkit-scrollbar-thumb,
.ed-scene-list::-webkit-scrollbar-thumb,
.ed-step-list::-webkit-scrollbar-thumb,
.ed-scene-params::-webkit-scrollbar-thumb,
.ed-step-scroll::-webkit-scrollbar-thumb,
.ed-detail-scroll::-webkit-scrollbar-thumb,
.editor-warnings-body::-webkit-scrollbar-thumb,
.save-result-list::-webkit-scrollbar-thumb,
.validate-results::-webkit-scrollbar-thumb,
.validate-list::-webkit-scrollbar-thumb {
  background: #5a5a5a;
  border-radius: 6px;
  border: 1px solid #252525;
}

.ed-scroll::-webkit-scrollbar-thumb:hover,
.ed-scene-list::-webkit-scrollbar-thumb:hover,
.ed-step-list::-webkit-scrollbar-thumb:hover,
.ed-scene-params::-webkit-scrollbar-thumb:hover,
.ed-step-scroll::-webkit-scrollbar-thumb:hover,
.ed-detail-scroll::-webkit-scrollbar-thumb:hover,
.editor-warnings-body::-webkit-scrollbar-thumb:hover,
.save-result-list::-webkit-scrollbar-thumb:hover,
.validate-results::-webkit-scrollbar-thumb:hover,
.validate-list::-webkit-scrollbar-thumb:hover {
  background: #6e6e6e;
}

.ed-col {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 0.55rem 0.65rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: min(72vh, 820px);
  min-width: 0;
}

.ed-col-title {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
}

.ed-col-sub {
  margin: 0.55rem 0 0.35rem;
  font-size: 0.88rem;
}

.ed-scene-list {
  list-style: none;
  margin: 0;
  padding: 2px 4px 2px 2px;
  display: grid;
  /* Как колонка «Шаги»: список растёт, скролл внутри, строки не сжимаются в стопку. */
  gap: 0.5rem;
  overflow: auto;
  flex: 1 1 auto;
  min-height: 6rem;
  max-height: none;
  align-content: start;
  align-items: stretch;
  grid-auto-rows: min-content;
  box-sizing: border-box;
}

.ed-step-list {
  list-style: none;
  margin: 0;
  padding: 0 2px 0 0;
  display: grid;
  gap: 0.18rem;
  overflow: visible;
  align-content: start;
  grid-auto-rows: min-content;
}

.ed-scene-row,
.ed-step-row {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  min-width: 0;
}

.ed-scene-row {
  flex-shrink: 0;
  /* Не даём grid сжать строку при длинном списке (иначе кнопки наслаиваются). */
  min-height: 1.7rem;
  height: auto;
}

.ed-step-row {
  min-height: 0;
}

.ed-scene-btn,
.ed-step-btn {
  flex: 1 1 auto;
  min-width: 0;
  appearance: none;
  border: 1px solid #4a4a4a;
  background: var(--bg-deep);
  color: var(--text);
  border-radius: 4px;
  padding: 0.28rem 0.45rem;
  font: inherit;
  font-size: 0.8rem;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
  min-height: 1.7rem;
  box-sizing: border-box;
}

.ed-scene-btn {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  height: 1.7rem;
  max-height: 1.7rem;
  flex: 1 1 auto;
  flex-shrink: 1;
  padding-top: 0.22rem;
  padding-bottom: 0.22rem;
}

.ed-step-btn {
  display: block;
  height: auto;
  overflow: hidden;
  border-left-width: 5px;
  border-left-color: var(--ed-type, #6b7280);
  background: color-mix(in srgb, var(--ed-type, #6b7280) 28%, var(--bg-deep));
}

.ed-scene-btn:hover,
.ed-step-btn:hover {
  border-color: var(--accent);
}

.ed-scene-row.is-active .ed-scene-btn {
  background: #2c4a6e;
  border-color: var(--accent);
}

.ed-step-row.is-active .ed-step-btn {
  background: color-mix(in srgb, var(--ed-type, #6b7280) 46%, #1a2433);
  border-color: var(--accent);
  border-left-color: var(--ed-type, #6b7280);
}

.ed-scene-idx {
  color: var(--muted);
  margin-right: 0.2rem;
  font-size: 0.82rem;
}

.ed-scene-name {
  font-weight: 600;
  font-size: 0.86rem;
}

.ed-scene-meta {
  display: inline;
  margin: 0;
  font-size: 0.78rem;
}

.ed-scene-meta::before {
  content: " · ";
  font-weight: 400;
}

.ed-x {
  flex: 0 0 auto;
  align-self: center;
  min-width: 1.7rem;
  height: 1.7rem;
  padding: 0.1rem 0.3rem;
  font-size: 0.85rem;
  line-height: 1;
  border-radius: 4px;
}

.ed-add-scene {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  margin-top: 0.4rem;
  flex: 0 0 auto;
}

.ed-add-scene .editor-field {
  flex: 1 1 auto;
  margin: 0;
  gap: 0.15rem;
  font-size: 0.8rem;
}

/* Как у параметров сцены: подпись вплотную к полю. */
.ed-layout .ed-add-scene .editor-field {
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: 0.4rem;
}

.ed-add-scene .btn {
  padding: 0.22rem 0.5rem;
  font-size: 0.8rem;
  min-height: 1.85rem;
  height: 1.85rem;
  border-radius: 4px;
  flex: 0 0 auto;
  align-self: center;
}

.ed-scene-params {
  margin-top: 0.35rem;
  overflow: auto;
  padding-right: 2px;
  /* Параметры не отжимают список сцен в крошечный блок. */
  flex: 0 1 auto;
  max-height: min(38vh, 360px);
  min-height: 0;
}

.ed-scene-params .editor-field {
  gap: 0.15rem;
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
}

.ed-scene-params .hint,
.ed-scene-params .muted {
  font-size: 0.78rem;
  margin: 0.2rem 0 0.35rem;
}

/* Как Unity HelpBox Error под пикерами фона/музыки. */
.ed-scene-media-warn {
  margin: 0.35rem 0 0.45rem;
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
  border: 1px solid #a94442;
  background: rgba(169, 68, 66, 0.18);
  color: #f0c0be;
  font-size: 0.78rem;
  line-height: 1.35;
}

.ed-bg-frame {
  max-width: min(120px, 100%);
}

.ed-bg-frame img {
  max-height: 140px;
}

.ed-bg-preview .bg-preview-frame {
  background: transparent;
}

.ed-music-row {
  display: flex;
  gap: 0.3rem;
  align-items: center;
}

.ed-music-field {
  flex: 1 1 auto;
  margin: 0;
}

.ed-music-row .btn {
  padding: 0.28rem 0.45rem;
  min-height: 1.85rem;
}

.ed-music-row .btn.is-playing {
  border-color: var(--accent);
  color: #dff0ff;
}

/* компактные поля внутри редактора */
.ed-layout .editor-field input,
.ed-layout .editor-field select,
.ed-layout .editor-field textarea {
  padding: 0.28rem 0.45rem !important;
  border-radius: 4px !important;
  font-size: 0.86rem !important;
  line-height: 1.3;
  min-height: 1.85rem;
}

.ed-layout .editor-field textarea {
  min-height: 3.2rem;
  padding: 0.35rem 0.45rem !important;
}

/* Как Unity Inspector: подпись слева, контрол справа. Textarea — подпись сверху. */
.ed-layout .editor-field {
  display: grid;
  grid-template-columns: minmax(6.2rem, 9.2rem) minmax(0, 1fr);
  align-items: center;
  column-gap: 0.45rem;
  row-gap: 0.18rem;
  font-size: 0.8rem;
}

.ed-layout .editor-field:has(textarea) {
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
}

/* Параметры сцены: короткие подписи, контрол сразу рядом. Общее правило выше не должно это перекрывать. */
.ed-layout .ed-scene-params .editor-field {
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: 0.4rem;
}

.ed-layout .editor-field > input,
.ed-layout .editor-field > select {
  width: 100%;
  min-width: 0;
}

.ed-layout .editor-field input.ed-field-locked,
.editor-field input.ed-field-locked[readonly] {
  color: #8a8a8a !important;
  background: #262626 !important;
  border-color: #3a3a3a !important;
  cursor: default;
  opacity: 0.85;
}

.ed-layout .btn,
.ed-layout .btn-small,
.ed-layout .ed-quick-btn {
  padding: 0.22rem 0.45rem;
  font-size: 0.8rem;
  border-radius: 4px;
  min-height: 1.7rem;
  line-height: 1.25;
}

.ed-layout .btn-ghost {
  background: var(--surface-3);
}

.ed-layout .hint {
  font-size: 0.78rem;
  margin: 0.25rem 0;
}

.ed-step-scroll {
  overflow: auto;
  flex: 1 1 auto;
  min-height: 6rem;
  margin-bottom: 0.4rem;
  padding-right: 2px;
}

.ed-step-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  align-items: baseline;
}

.ed-step-num {
  font-weight: 700;
  color: #e6c07b;
  font-size: 0.84rem;
}

.ed-step-type {
  color: var(--accent);
  font-size: 0.82rem;
}

.ed-step-next {
  color: var(--muted);
  font-size: 0.78rem;
}

.ed-step-snippet {
  margin-top: 0.12rem;
  font-size: 0.8rem;
  color: var(--text);
  opacity: 0.9;
}

.ed-add-block {
  border-top: 1px solid var(--border);
  padding-top: 0.4rem;
  flex: 0 0 auto;
}

.ed-add-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
  font-size: 0.88rem;
}

.ed-quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.28rem;
  margin-bottom: 0.35rem;
}

.ed-quick-btn {
  width: 100%;
  justify-content: center;
}

.ed-other-row {
  display: flex;
  gap: 0.3rem;
  align-items: end;
}

.ed-other-field {
  flex: 1 1 auto;
  margin: 0;
}

.ed-other-sub {
  margin-top: 0.35rem;
}

.ed-insert-status {
  margin: 0 0 0.3rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}

.ed-insert-status.ed-insert-warn {
  color: #e8c07a;
}

/* Disabled-элементы не ловят hover — подсказку показывает title контейнера */
.ed-add-block.is-no-scene {
  cursor: not-allowed;
}

.ed-add-block.is-no-scene [disabled] {
  pointer-events: none;
}

.ed-branch-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.28rem;
  margin: 0 0 0.4rem;
}

.ed-branch-label {
  font-size: 0.78rem;
  color: var(--muted);
  margin-right: 0.15rem;
}

.ed-branch-btn.is-active {
  background: var(--accent-soft) !important;
  border-color: var(--accent) !important;
  color: var(--text) !important;
}

.ed-choice-branch-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.ed-instr-block {
  display: grid;
  gap: 0.4rem;
  margin: 0 0 0.5rem;
}

.ed-instr-fx {
  display: grid;
  gap: 0.3rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-deep);
}

.ed-instr-fx-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
}

.ed-instr-fx-title {
  font-size: 0.8rem;
  font-weight: 600;
}

.ed-rename-fallback {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.4rem;
}

.ed-rename-fallback .editor-field {
  flex: 1 1 12rem;
  margin: 0;
}

.ed-step-item-preview {
  margin: 0.35rem 0;
}

.ed-appear-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.ed-appear-row .editor-field {
  flex: 1 1 12rem;
  margin: 0;
  min-width: 0;
}

.ed-media-pick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  flex: 1 1 10rem;
}

.ed-media-pick-btn {
  flex: 1 1 8rem;
  min-width: 0;
  text-align: left;
  background: var(--bg-deep);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.28rem 0.45rem;
  font: inherit;
  font-size: 0.84rem;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ed-media-pick-btn:hover {
  border-color: #7a7a7a;
}

.ed-appear-thumb {
  position: relative;
  width: 54px;
  height: 96px;
  flex: none;
  border-radius: 4px;
  background: var(--bg-deep);
  overflow: hidden;
  border: 1px solid var(--border);
}

/* Окно выбора ключа (поиск + превью справа) */
.ed-keypick-back {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.55);
}

.ed-keypick-back[hidden] {
  display: none;
}

.ed-keypick {
  width: min(560px, 96vw);
  max-height: min(420px, 92vh);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.65rem 0.75rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
}

.ed-keypick-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.ed-keypick-hint {
  margin: 0;
  font-size: 0.78rem;
}

.ed-keypick-search {
  width: 100%;
  box-sizing: border-box;
}

.ed-keypick-clear {
  align-self: flex-start;
}

.ed-keypick-body {
  display: flex;
  gap: 0.55rem;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.ed-keypick-list {
  flex: 1 1 auto;
  min-width: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  max-height: 260px;
  padding-right: 0.15rem;
}

.ed-keypick-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.84rem;
  padding: 0.28rem 0.4rem;
  cursor: pointer;
}

.ed-keypick-item:hover,
.ed-keypick-item.is-hover,
.ed-keypick-item:focus-visible {
  background: var(--surface-3);
  outline: none;
}

.ed-keypick-item.is-current {
  background: #3a4a5c;
}

.ed-keypick.is-audio {
  width: min(480px, 96vw);
}

.ed-keypick.is-audio .ed-keypick-list {
  max-height: 280px;
}

.ed-keypick-audio-row {
  display: flex;
  gap: 0.25rem;
  align-items: stretch;
}

.ed-keypick-audio-row .ed-keypick-item {
  flex: 1 1 auto;
  min-width: 0;
}

.ed-keypick-audio-row.is-current .ed-keypick-item {
  background: #3a4a5c;
}

.ed-keypick-play {
  flex: none;
  min-width: 2.1rem;
  padding: 0.2rem 0.35rem;
  font-size: 0.85rem;
  line-height: 1;
}

.ed-keypick-play.is-playing {
  color: #f0d2a8;
}

.ed-keypick-empty {
  margin: 0.4rem 0;
  font-size: 0.82rem;
}

.ed-keypick-side {
  flex: none;
  width: 140px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.ed-keypick-side-cap {
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted);
}

.ed-keypick-frame {
  position: relative;
  width: 140px;
  height: 168px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  overflow: hidden;
}

.ed-keypick-frame img,
.ed-keypick-frame video {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
}

.ed-keypick-miss {
  position: absolute;
  inset: 0;
  z-index: 0;
  margin: 0;
  display: grid;
  place-items: center;
  padding: 0.35rem;
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
}

.ed-keypick-miss[hidden] {
  display: none;
}

.ed-keypick-name {
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ed-appear-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ed-appear-miss {
  position: absolute;
  inset: 0;
  margin: 0;
  display: grid;
  place-items: center;
  font-size: 0.65rem;
  color: var(--muted);
  text-align: center;
  padding: 0.2rem;
}

.ed-appear-miss[hidden],
.ed-appear-thumb img[hidden] {
  display: none;
}

.ed-step-cut-preview {
  margin: 0.35rem 0;
}

.ed-branch-hint {
  font-size: 0.75rem;
  color: var(--muted);
}

.editor-choice-row.is-branch-active,
.ed-cond-branch.is-branch-active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(61, 126, 255, 0.25);
}

.ed-cond-branch {
  display: grid;
  gap: 0.35rem;
  padding: 0.45rem 0.5rem;
  border-radius: 6px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  margin-bottom: 0.35rem;
}

.ed-detail-scroll {
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
  padding-right: 2px;
}

.ed-step-detail-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.45rem;
  font-size: 0.9rem;
}

/* Откуда / Куда — как Unity (кликабельные чипы вверху деталей) */
.ed-step-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0 0 0.65rem;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.ed-nav-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  align-items: flex-start;
}

.ed-nav-label {
  flex: 0 0 3.6rem;
  font-size: 0.8rem;
  color: var(--muted);
  padding-top: 0.2rem;
}

.ed-nav-chips,
.ed-nav-to {
  flex: 1 1 12rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
  min-width: 0;
}

.ed-nav-chip {
  max-width: 100%;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.ed-nav-chip.is-active,
.ed-nav-chip.ed-branch-btn.is-active {
  border-color: #3d6ea8;
  background: #243a52;
  color: #e8f0ff;
}

.ed-step-nav.is-flash,
.ed-nav-row[data-ed-nav-kuda].is-flash,
.ed-nav-to.is-flash,
.ed-nav-chip.is-flash {
  animation: ed-kuda-flash 0.4s ease-in-out 4 alternate;
}

@keyframes ed-kuda-flash {
  from {
    box-shadow: inset 0 0 0 2px rgba(245, 196, 0, 0.95);
    background-color: rgba(245, 196, 0, 0.22);
  }
  to {
    box-shadow: inset 0 0 0 2px rgba(245, 196, 0, 0.2);
    background-color: transparent;
  }
}

.ed-nav-linear {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  width: 100%;
}

.ed-nav-linear .ed-nav-next-select,
.ed-nav-linear select,
.ed-nav-linear .ed-target-pick {
  flex: 1 1 12rem;
  min-width: 8rem;
  max-width: 100%;
}

.ed-art-dur {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.ed-art-dur input[type="range"] {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  accent-color: var(--accent, #3d7eff);
}

.ed-art-dur-val {
  flex: 0 0 1.6rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ed-target-pick {
  position: relative;
  min-width: 0;
}

.ed-target-pick-btn {
  width: 100%;
  text-align: left;
  background: var(--bg, #1c1c1c);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.28rem 0.45rem;
  font: inherit;
  font-size: 0.84rem;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ed-target-pop {
  position: fixed;
  z-index: 80;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  width: min(420px, 92vw);
  max-height: 280px;
  overflow: auto;
  padding: 0.4rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.ed-target-pop[hidden] {
  display: none;
}

.ed-target-search {
  width: 100%;
  box-sizing: border-box;
}

.ed-target-unbound,
.ed-target-item {
  width: 100%;
  text-align: left;
}

.ed-target-item {
  display: block;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  padding: 0.28rem 0.35rem;
  font: inherit;
  font-size: 0.8rem;
  line-height: 1.3;
  cursor: pointer;
}

.ed-target-item:hover,
.ed-target-item.is-current {
  background: var(--bg-deep, rgba(255, 255, 255, 0.06));
}

.ed-target-empty,
.ed-target-more {
  margin: 0;
  font-size: 0.78rem;
}

.ed-nav-goto-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  width: 100%;
  margin-top: 0.15rem;
}

.ed-nav-empty {
  font-size: 0.8rem;
}

.ed-nav-scene-exit {
  margin: 0.25rem 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.ed-nav-scene-exit.is-broken {
  color: #c44;
}

.ed-speaker-block,
.ed-appearance-block {
  margin: 0.35rem 0 0.4rem;
  padding-top: 0.25rem;
  border-top: 1px solid var(--border);
}

.ed-speaker-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.25rem 0 0.35rem;
}

.ed-speaker-usual {
  margin: 0.15rem 0;
  font-size: 0.8rem;
}

.ed-speaker-warn {
  margin: 0.35rem 0 0;
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
  border: 1px solid #8a6d2b;
  background: #2a2416;
  color: #f0d9a0;
  font-size: 0.82rem;
  line-height: 1.35;
}

.ed-nav-markers {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.15rem;
}

.ed-nav-badge {
  font-size: 0.72rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}

.ed-nav-badge-start {
  border-color: #3d7a4a;
  color: #b7e0c0;
  background: #1e3324;
}

.ed-nav-badge-end {
  border-color: #8a5a2b;
  color: #f0d2a8;
  background: #332418;
}

.ed-wardrobe-keys {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
}

.ed-wardrobe-key-row {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.ed-wardrobe-key-row .ed-media-pick {
  flex: 1 1 auto;
  min-width: 0;
}

.ed-wardrobe-key-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.ed-wardrobe-empty {
  font-size: 0.8rem;
  margin: 0;
}

.ed-detail-empty {
  display: grid;
  place-items: center;
  min-height: 8rem;
}

.ed-col-detail .editor-field {
  margin-bottom: 0.22rem;
}

.ed-quota {
  margin: 0 0 0.55rem;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  display: grid;
  gap: 0.15rem;
  font-size: 0.82rem;
}

.ed-quota.is-warn {
  background: var(--warn-bg);
  border-color: var(--warn-border);
}

.ed-quota.is-ok {
  border-color: #355a3c;
  background: var(--ok-bg);
}

.ed-quota-note {
  color: var(--muted);
  font-size: 0.78rem;
}

.ed-fold {
  margin: 0.18rem 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-deep);
}

.ed-fold > summary {
  cursor: pointer;
  padding: 0.16rem 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.3;
  list-style: none;
  user-select: none;
}

.ed-fold > summary::-webkit-details-marker {
  display: none;
}

.ed-fold > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.35rem;
  color: var(--muted);
  transition: transform 0.12s ease;
}

.ed-fold[open] > summary::before {
  transform: rotate(90deg);
}

.ed-fold-body {
  padding: 0.22rem 0.4rem 0.28rem;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 0.16rem;
}

.ed-fold .hint {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.25;
}

/* Детали шага: плотнее все строки (Откуда/Куда, тип, имя, эмоции, развилки…) */
.ed-col-detail {
  font-size: 0.84rem;
  line-height: 1.3;
}

.ed-col-detail .ed-step-detail-head {
  margin-bottom: 0.28rem;
  font-size: 0.84rem;
}

.ed-col-detail .ed-step-nav {
  gap: 0.18rem;
  margin: 0 0 0.35rem;
  padding: 0.28rem 0.4rem;
}

.ed-col-detail .ed-nav-row {
  gap: 0.2rem 0.35rem;
}

.ed-col-detail .ed-nav-label {
  flex-basis: 3.2rem;
  font-size: 0.74rem;
  padding-top: 0.12rem;
}

.ed-col-detail .ed-nav-chips,
.ed-col-detail .ed-nav-to {
  gap: 0.2rem;
}

.ed-col-detail .ed-nav-linear {
  gap: 0.2rem;
}

.ed-col-detail .ed-nav-goto-row {
  gap: 0.2rem;
  margin-top: 0.05rem;
}

.ed-col-detail .ed-nav-empty,
.ed-col-detail .ed-nav-scene-exit {
  font-size: 0.74rem;
  margin-top: 0.1rem;
}

.ed-col-detail .editor-field {
  margin-bottom: 0.12rem;
  row-gap: 0.08rem;
  column-gap: 0.35rem;
  font-size: 0.76rem;
  grid-template-columns: minmax(5.4rem, 7.6rem) minmax(0, 1fr);
}

.ed-col-detail .editor-field:has(textarea) {
  grid-template-columns: minmax(0, 1fr);
}

.ed-col-detail .editor-field input,
.ed-col-detail .editor-field select,
.ed-col-detail .editor-field textarea {
  padding: 0.18rem 0.35rem !important;
  font-size: 0.82rem !important;
  line-height: 1.25;
  min-height: 1.55rem;
}

.ed-col-detail .editor-field textarea {
  min-height: 2.6rem;
  padding: 0.28rem 0.35rem !important;
}

.ed-col-detail .hint {
  margin: 0.08rem 0 0.12rem;
  font-size: 0.72rem;
  line-height: 1.25;
}

.ed-col-detail .editor-check {
  margin-top: 0.05rem;
  margin-bottom: 0;
  gap: 0.3rem;
  font-size: 0.82rem;
  line-height: 1.25;
}

.ed-col-detail .ed-check-with-hint {
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 0.35rem;
  row-gap: 0.05rem;
}

.ed-col-detail .ed-check-main {
  font-weight: 500;
}

.ed-col-detail .ed-check-sidehint {
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.25;
}

.ed-col-detail .ed-speaker-block,
.ed-col-detail .ed-appearance-block {
  margin: 0.22rem 0 0.25rem;
  padding-top: 0.18rem;
}

.ed-col-detail .ed-speaker-btns {
  gap: 0.22rem;
  margin: 0.1rem 0 0.15rem;
}

.ed-col-detail .ed-speaker-usual {
  margin: 0.05rem 0;
  font-size: 0.74rem;
}

.ed-col-detail .ed-speaker-warn {
  margin: 0.2rem 0 0;
  padding: 0.28rem 0.4rem;
}

.ed-col-detail .ed-appear-row {
  gap: 0.28rem;
}

.ed-col-detail .ed-appear-row .editor-field {
  flex: 1 1 10rem;
}

.ed-col-detail .ed-appear-thumb {
  width: 56px;
  height: 100px;
}

.ed-col-detail .ed-media-pick-btn {
  font-size: 0.8rem;
  padding: 0.24rem 0.4rem;
}

.ed-col-detail .ed-char-count {
  margin: -0.05rem 0 0.15rem;
  font-size: 0.72rem;
}

.ed-col-detail .ed-fold {
  margin: 0.1rem 0;
}

.ed-col-detail .ed-fold > summary {
  padding: 0.12rem 0.4rem;
  font-size: 0.76rem;
}

.ed-col-detail .ed-instr-block {
  gap: 0.22rem;
  margin: 0 0 0.28rem;
}

.ed-col-detail .ed-instr-fx {
  gap: 0.18rem;
  padding: 0.28rem 0.35rem;
}

.ed-col-detail .ed-cond-branch {
  gap: 0.18rem;
  padding: 0.28rem 0.35rem;
  margin-bottom: 0.2rem;
}

.ed-col-detail .ed-choice-branch-head {
  gap: 0.22rem;
}

.ed-col-detail .ed-phone-zone,
.ed-col-detail .ed-phone-opt,
.ed-col-detail .ed-phone-fu {
  gap: 0.18rem;
}

.ed-col-detail .ed-phone-msg-head {
  margin-bottom: 0.15rem;
}

.ed-col-detail .btn,
.ed-col-detail .btn-small {
  padding: 0.14rem 0.35rem;
  font-size: 0.76rem;
  min-height: 1.45rem;
  line-height: 1.2;
}

.ed-char-count {
  margin: -0.15rem 0 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.ed-char-count.is-over {
  color: #e8a0a0;
}

.integrator-modal {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0;
  max-width: min(560px, 94vw);
  width: 100%;
  background: #fff;
  color: var(--text);
  box-shadow: 0 12px 40px rgba(20, 40, 60, 0.22);
}

.integrator-modal::backdrop {
  background: rgba(20, 30, 40, 0.45);
}

.integrator-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  background: #f6f8fa;
}

.integrator-modal-title {
  margin: 0;
  font-size: 1.15rem;
}

.integrator-modal-body {
  padding: 1rem;
  max-height: min(70vh, 640px);
  overflow: auto;
}

.editor-tab-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.28rem 0.7rem;
  font: inherit;
  font-size: var(--ctrl-fs);
  min-height: var(--ctrl-h);
  line-height: 1.25;
  cursor: pointer;
}

.editor-tab-btn:hover:not(:disabled) {
  background: var(--surface-3);
  border-color: var(--border);
}

.editor-tab-btn.is-active {
  background: var(--accent-soft);
  border-color: var(--accent-soft);
  color: #fff;
  font-weight: 600;
}

.editor-tab-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.editor-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1.1rem;
  margin-bottom: 0.5rem;
}
.title-apply-box {
  grid-column: 1 / -1;
  margin-top: -0.35rem;
}
.title-apply-box .hint {
  margin-top: 0.15rem;
  margin-bottom: 0.35rem;
}
.title-apply-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.editor-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.95rem;
  margin-top: 1.4rem;
}

.editor-total-seasons {
  max-width: 8.5rem;
  margin: 0;
}

/* Карточка: «Сезоны» — отдельная панель, как card-foldout (не сливается с жанрами) */
.card-seasons-block {
  margin: 0.55rem 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-deep);
  padding: 0;
  overflow: hidden;
  box-sizing: border-box;
}

.card-seasons-block > .editor-scenes-heading {
  margin: 0;
  padding: 0.45rem 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.card-seasons-block > .hint {
  margin: 0.4rem 0.75rem 0.25rem;
}

.card-seasons-block > .season-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.4rem 0.65rem;
  margin: 0 0.75rem 0.35rem;
}

.card-seasons-block > .season-open-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.4rem 0.65rem;
  margin: 0 0.75rem 0.55rem;
}

.season-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.season-open-bar {
  display: grid;
  gap: 0.25rem;
  margin: 0.35rem 0 0.65rem;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

.season-open-field {
  max-width: 18rem;
  margin: 0;
}

.season-open-label {
  font-size: 0.92rem;
  font-weight: 650;
  color: var(--text);
}

.season-open-select {
  font-weight: 600;
  min-height: 2rem !important;
}

.season-open-hint {
  margin: 0;
  font-size: 0.78rem;
}

.editor-season-row {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.5rem;
  margin-bottom: 0.3rem;
  background: var(--surface-2);
  display: grid;
  gap: 0.28rem;
}

.editor-season-title {
  margin: 0;
  font-size: 0.92rem;
}

.season-block {
  margin: 0;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  display: grid;
  gap: 0.28rem;
}

.season-block-series {
  margin: 0;
}

.season-series-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.28rem 0.55rem;
  align-items: end;
}

.season-ep-actions {
  margin-top: 0.05rem;
}

.season-block .home-quick-actions {
  margin: 0;
  gap: 0.35rem;
}

.season-block-title {
  margin: 0;
  font-size: 0.88rem;
}

.season-block-muted {
  background: var(--bg-deep);
}

.season-fold {
  margin: 0.2rem 0;
}

.season-fold > summary {
  font-size: 0.88rem;
  font-weight: 600;
}

.season-fold-body {
  display: grid;
  gap: 0.22rem;
  padding: 0.25rem 0.4rem 0.35rem;
}

/* Вкладка «Сезон»: подсказка сверху без глобального margin-top .hint */
.editor-tab-panel[data-history-panel="seasons"] > .hint {
  margin-top: 0.15rem;
  margin-bottom: 0.3rem;
}

.season-fold .hint,
.season-block .hint {
  margin-top: 0.15rem;
  margin-bottom: 0.2rem;
}

.season-media-slot {
  display: grid;
  gap: 0.22rem;
  margin-top: 0.28rem;
  padding-top: 0.28rem;
  border-top: 1px solid var(--border);
}

.card-foldout {
  margin: 0.55rem 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-deep);
  padding: 0;
  overflow: hidden;
  box-sizing: border-box;
}

.card-foldout > summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.45rem 0.75rem;
  margin: 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface-2);
  border-bottom: 1px solid transparent;
  user-select: none;
  box-sizing: border-box;
}

.card-foldout > summary::-webkit-details-marker {
  display: none;
}

.card-foldout > summary::marker {
  content: "";
  display: none;
}

.card-foldout > summary::before {
  content: "";
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5px 0 5px 7px;
  border-color: transparent transparent transparent var(--muted);
  flex-shrink: 0;
  transform: rotate(0deg);
  transition: transform 0.12s ease;
}

.card-foldout[open] > summary::before {
  transform: rotate(90deg);
}

.card-foldout[open] > summary {
  border-bottom-color: var(--border);
}

.card-foldout > :not(summary) {
  margin-left: 0.75rem;
  margin-right: 0.75rem;
}

.card-foldout[open] > summary + * {
  margin-top: 0.4rem;
}

.card-foldout > :not(summary):last-child {
  margin-bottom: 0.55rem;
}

/* Карточка: плотнее подсказки/поля (глобальный .hint иначе margin-top 1.25rem) */
.card-foldout .hint,
.card-seasons-block .hint {
  margin-top: 0.2rem;
  margin-bottom: 0.35rem;
}

.card-foldout .editor-field {
  margin-bottom: 0.25rem;
}

.card-foldout .pkg-media {
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}

.card-foldout .pkg-media-row {
  gap: 0.5rem;
}

.card-foldout .pkg-media-drop {
  min-height: 1.85rem;
  padding: 0.3rem 0.5rem;
  font-size: 0.82rem;
}

.card-foldout .season-block-title {
  margin-top: 0.15rem;
}

.genre-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.35rem 0.75rem;
  margin-top: 0.35rem;
}

.genre-check {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.84rem;
}

.editor-field select {
  width: 100%;
  font: inherit;
  font-size: var(--ctrl-fs);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--ctrl-pad-y) var(--ctrl-pad-x);
  min-height: var(--ctrl-h);
  line-height: 1.3;
  background: var(--bg-deep);
}

.editor-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem 1.25rem;
  margin: 0 0 1.15rem;
  padding: 0;
}

.editor-card-form {
  align-items: start;
}

.editor-card > div {
  margin: 0;
}

.editor-card-wide {
  grid-column: 1 / -1;
}

.editor-card dt {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.editor-card dd {
  margin: 0.15rem 0 0;
  font-weight: 600;
}

.editor-readonly {
  display: grid;
  gap: 0.15rem;
}

.editor-readonly-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.editor-field {
  display: grid;
  gap: 0.18rem;
  font-size: 0.8rem;
  color: var(--muted);
}

/* display:grid у .editor-field иначе перекрывает HTML-атрибут hidden */
.editor-field[hidden],
.ed-other-sub[hidden] {
  display: none !important;
}

.editor-field input,
.editor-field select,
.editor-field textarea {
  width: 100%;
  font: inherit;
  font-size: var(--ctrl-fs);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--ctrl-pad-y) var(--ctrl-pad-x);
  min-height: var(--ctrl-h);
  line-height: 1.3;
  background: var(--bg-deep);
}

.editor-field textarea {
  resize: vertical;
  min-height: 3.2rem;
}

.editor-scene-body {
  padding: 0 0.85rem 0.85rem;
  display: grid;
  gap: 0.65rem;
}

.editor-step-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  align-items: baseline;
  margin-bottom: 0.35rem;
}

.editor-actions {
  margin-top: 1rem;
  display: grid;
  gap: 0.5rem;
  justify-items: start;
}

.editor-scenes-heading {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

.editor-scene-list,
.editor-step-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.editor-scene {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.55rem;
  background: var(--bg-deep);
  overflow: hidden;
  padding: 0;
}

.editor-scene summary {
  cursor: pointer;
  padding: 0.7rem 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  align-items: center;
  list-style: none;
  background: var(--surface-2);
  border-bottom: 1px solid transparent;
}

.editor-scene summary::-webkit-details-marker {
  display: none;
}

.editor-scene summary::marker {
  content: "";
  display: none;
}

.editor-scene summary::before {
  content: "";
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5px 0 5px 7px;
  border-color: transparent transparent transparent var(--muted);
  flex-shrink: 0;
  transition: transform 0.12s ease;
}

.editor-scene[open] > summary::before {
  transform: rotate(90deg);
}

.editor-scene[open] > summary {
  border-bottom-color: var(--border);
}

.editor-scene-title {
  font-weight: 600;
}

.editor-step-list {
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.editor-step {
  padding: 0.55rem 0.65rem;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid;
  gap: 0.45rem;
  font-size: 0.92rem;
  line-height: 1.35;
}

.editor-step-num {
  font-weight: 600;
}

.editor-step-type {
  color: var(--accent);
}

.editor-step-speaker {
  color: var(--muted);
}

.editor-step-text {
  color: var(--text);
}

.btn-small {
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
  min-height: 1.65rem;
  border-radius: var(--radius);
}

.editor-step-subhead {
  font-weight: 600;
  font-size: 0.9rem;
  margin: 0.25rem 0;
}

.editor-choice-block,
.editor-phone-block {
  display: grid;
  gap: 0.55rem;
  padding: 0.55rem 0.65rem;
  border: 1px dashed var(--border);
  border-radius: 6px;
  background: var(--surface-2);
}

.editor-choice-row,
.editor-phone-msg {
  display: grid;
  gap: 0.4rem;
  padding: 0.45rem 0.5rem;
  border-radius: 6px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
}

.ed-phone-zone {
  display: grid;
  gap: 0.45rem;
  padding: 0.45rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.ed-phone-zone-choice {
  border-color: #3d6ea8;
  background: rgba(61, 110, 168, 0.1);
}

.ed-phone-msg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.ed-phone-msg-title {
  font-weight: 600;
  font-size: 0.85rem;
}

.ed-phone-opts {
  display: grid;
  gap: 0.45rem;
}

.ed-phone-opt {
  display: grid;
  gap: 0.4rem;
  padding: 0.45rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.ed-phone-opt.tone-0 {
  border-color: #4a6d92;
  background: rgba(70, 120, 180, 0.14);
}

.ed-phone-opt.tone-1 {
  border-color: #4a7a55;
  background: rgba(70, 140, 90, 0.14);
}

.ed-phone-opt.tone-2 {
  border-color: #8a6a40;
  background: rgba(180, 130, 70, 0.14);
}

.ed-phone-opt.tone-3 {
  border-color: #6a4a82;
  background: rgba(130, 90, 170, 0.14);
}

.ed-phone-opt.is-active {
  border-color: #5a9ad8;
  box-shadow: inset 0 0 0 1px rgba(90, 154, 216, 0.45);
}

.ed-phone-exit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
  margin: 0.35rem 0 0;
}

.ed-phone-goto-kuda {
  flex: 0 0 auto;
}

.ed-phone-fu {
  background: rgba(0, 0, 0, 0.18);
  border-color: rgba(255, 255, 255, 0.08);
}

.ed-phone-name-row {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
}

.ed-phone-name-row .editor-field {
  flex: 1 1 auto;
  min-width: 0;
}

.ed-phone-icon-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
  margin: 0.25rem 0 0.15rem;
}

.ed-phone-icon-label {
  font-size: 0.85rem;
  color: var(--muted, #9ab);
}

.ed-phone-icon-status {
  font-size: 0.85rem;
}

.ed-phone-icon-status.is-miss {
  color: #f0e0a8;
  font-weight: 650;
}

.ed-phone-icon-preview {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-deep);
  flex: 0 0 32px;
}

.ed-phone-icon-miss {
  flex: 1 1 100%;
  margin: 0.25rem 0 0;
}

.ed-phone-err {
  color: #f0a0a0;
}

.ed-phone-warn {
  color: #e0c070;
}

.ed-phone-alert {
  margin: 0.35rem 0 0;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 0.82rem;
  line-height: 1.35;
  font-weight: 550;
}

.ed-phone-alert.is-error {
  border-color: #8a3030;
  background: #4a1e1e;
  color: #ffc8c8;
}

.ed-phone-alert.is-warn {
  border-color: var(--warn-border, #6a5a30);
  background: var(--warn-bg, #3a3220);
  color: #f0e0a8;
}

.ed-phone-media-thumb {
  width: 64px;
  height: 64px;
}

.editor-warnings {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.7rem;
  border-radius: 6px;
  border: 1px solid var(--warn-border);
  background: var(--warn-bg);
  color: var(--text);
  font-size: 0.85rem;
}

.editor-warnings-title {
  font-weight: 650;
  margin-bottom: 0.3rem;
  font-size: 0.88rem;
}

.editor-warnings-body {
  max-height: 5.6rem; /* ~3–4 строки */
  overflow: auto;
  padding-right: 0.2rem;
}

.editor-warnings ul {
  margin: 0;
  padding-left: 1.1rem;
}

.editor-warnings li {
  margin: 0.1rem 0;
  line-height: 1.3;
}

.editor-step.is-flow-focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(31, 111, 91, 0.15);
}

.flow-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  align-items: center;
  margin-bottom: 0.4rem;
}

.flow-hint {
  font-size: 0.85rem;
  margin: 0 0 0.5rem;
}

.flow-filters {
  margin-bottom: 0.35rem;
}

.flow-zoom {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
}

.flow-zoom-label {
  min-width: 3.6rem;
  font-variant-numeric: tabular-nums;
}

.flow-check {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}

.flow-select {
  max-width: 13rem;
}

.flow-search {
  flex: 0 1 14rem;
  min-width: 9rem;
}

.flow-count,
.flow-status {
  font-size: 0.85rem;
}

.flow-status:empty {
  display: none;
}

/* Фиксированная рамка: зум меняет SVG, а не высоту страницы (без второго скролла браузера). */
.story-section[data-story-panel="schema"],
#editor-flow-root,
#editor-flow-canvas {
  min-width: 0;
  max-width: 100%;
}

#editor-flow-root {
  display: flex;
  flex-direction: column;
  gap: 0;
}

#editor-flow-canvas {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.flow-wrap {
  overflow: auto;
  width: 100%;
  min-width: 0;
  height: min(72vh, calc(100dvh - 14rem));
  max-height: min(72vh, calc(100dvh - 14rem));
  min-height: 280px;
  border: 1px solid var(--border);
  border-radius: 8px;
  /* Тёмный холст как у кабинета — без белой «вспышки»; сетка едва заметная. */
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px) 0 0 / 28px 28px,
    #1a1f26;
  padding: 0.35rem;
  cursor: grab;
  user-select: none;
  overscroll-behavior: contain;
  box-sizing: border-box;
  color-scheme: dark;
}

.flow-wrap.is-panning,
.flow-wrap.is-panning .flow-node {
  cursor: grabbing;
}

.flow-svg {
  display: block;
  max-width: none;
}

.flow-node {
  cursor: pointer;
}

.flow-node:focus {
  outline: none;
}

.flow-node:focus rect {
  stroke: #e8eef5;
  stroke-width: 2.5;
}

.flow-node-title {
  font-size: 12px;
  font-weight: 700;
  font-family: "Segoe UI", "Candara", sans-serif;
}

.flow-node-body {
  font-size: 11px;
  font-family: "Segoe UI", "Candara", sans-serif;
}

.flow-node-meta {
  font-size: 10px;
  font-family: "Segoe UI", "Candara", sans-serif;
}

.flow-edge-label {
  font-size: 10px;
  font-family: "Segoe UI", "Candara", sans-serif;
  font-weight: 600;
  paint-order: normal;
  stroke: none;
  pointer-events: none;
}

/* Как Unity: полупрозрачная плашка + цветной акцент слева. */
.flow-edge-label-badge .flow-edge-label-bg {
  fill: rgba(14, 18, 24, 0.72);
  stroke: rgba(255, 255, 255, 0.14);
  stroke-width: 1;
}

.flow-edge-label-badge.flow-edge-scene-badge .flow-edge-label-bg {
  fill: rgba(20, 36, 40, 0.7);
  stroke: rgba(89, 184, 199, 0.45);
}

.flow-edge-label-badge .flow-edge-label-accent {
  opacity: 0.95;
  pointer-events: none;
}

.flow-edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 12;
  pointer-events: stroke;
  cursor: pointer;
}

.flow-edge-line {
  pointer-events: none;
  transition: stroke-width 0.12s ease, filter 0.12s ease, opacity 0.12s ease;
}

.flow-edge:hover .flow-edge-line {
  stroke-width: 3.4;
  filter: brightness(1.35);
}

.flow-edge:hover .flow-edge-label-bg {
  fill: rgba(18, 24, 32, 0.88);
  stroke: rgba(255, 255, 255, 0.28);
}

.flow-edge.is-dim:hover .flow-edge-line {
  filter: none;
}

.flow-node-lod {
  display: none;
  font-size: 30px;
  font-weight: 700;
  font-family: "Segoe UI", "Candara", sans-serif;
}

.flow-wrap.is-lod .flow-node-title,
.flow-wrap.is-lod .flow-node-body,
.flow-wrap.is-lod .flow-node-meta,
.flow-wrap.is-lod .flow-edge-label,
.flow-wrap.is-lod .flow-edge-label-badge {
  display: none;
}

.flow-wrap.is-lod .flow-node-lod {
  display: inline;
}

.flow-node.is-dim,
.flow-edge.is-dim {
  opacity: 0.18;
}

.flow-node-problem {
  fill: #eb3838;
  pointer-events: none;
}
.flow-node.is-flash .flow-node-fill {
  stroke: #f5c400;
  stroke-width: 5;
  animation: flow-flash 0.4s ease-in-out 4 alternate;
}
.flow-edge.is-flash .flow-edge-line {
  stroke: #f5c400;
  stroke-width: 4.4;
  animation: flow-flash 0.4s ease-in-out 4 alternate;
}

@keyframes flow-flash {
  from {
    stroke-opacity: 1;
  }
  to {
    stroke-opacity: 0.25;
  }
}

.integrator-cheat {
  margin: 0 0 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0;
  background: var(--bg-deep);
  overflow: hidden;
}

.integrator-cheat summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.7rem;
  background: var(--surface-2);
}

.integrator-cheat summary::-webkit-details-marker {
  display: none;
}

.integrator-cheat summary::marker {
  content: "";
  display: none;
}

.integrator-cheat summary::before {
  content: "";
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5px 0 5px 7px;
  border-color: transparent transparent transparent var(--muted);
  flex-shrink: 0;
  transition: transform 0.12s ease;
}

.integrator-cheat[open] > summary::before {
  transform: rotate(90deg);
}

.integrator-cheat-pre {
  margin: 0;
  padding: 0.5rem 0.7rem 0.65rem;
  white-space: pre-wrap;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--muted);
  font-family: "Segoe UI", "Candara", sans-serif;
}

.integrator-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 0 0.75rem;
}

.integrator-preview,
.integrator-report {
  margin-top: 0.65rem;
  padding: 0.7rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fafbfc;
  font-size: 0.9rem;
  white-space: pre-wrap;
}

.integrator-report.ok {
  border-color: #b7ddd0;
  background: #e8f6f1;
}

.integrator-report.error {
  border-color: #e5b6b6;
  background: var(--danger-bg);
  color: var(--danger);
}

.integrator-errors {
  margin-bottom: 0.65rem;
  color: var(--danger);
}

.integrator-warnings {
  margin-bottom: 0.65rem;
  color: #5c4b12;
}

.integrator-preview-list ol {
  margin: 0.35rem 0 0;
  padding-left: 1.2rem;
}

@media (max-width: 560px) {
  .editor-card,
  .editor-meta-grid {
    grid-template-columns: 1fr;
  }
  .editor-check {
    margin-top: 0;
  }
}

.story-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.story-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0;
  display: grid;
  gap: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.story-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(31, 111, 91, 0.12);
}

.story-title {
  font-size: 1.1rem;
  font-weight: 650;
}

.story-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  background: #f7faf9;
  color: var(--muted);
}

.badge-ok {
  background: #e8f6f1;
  border-color: #b7ddd0;
  color: var(--accent);
}

.story-id {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.78rem;
  color: var(--muted);
  word-break: break-all;
}

.story-author {
  font-size: 0.8rem;
  color: var(--muted);
}

.review-note-banner {
  margin: 0 0 0.85rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid #c45c26;
  border-radius: 8px;
  background: #fff6f0;
  color: #4a2a18;
}

.review-note-banner strong {
  display: block;
  margin-bottom: 0.35rem;
}

.review-note-banner p {
  margin: 0;
  white-space: pre-wrap;
}

.admin-release-form,
.admin-release-actions,
.admin-paywall-form,
.admin-paywall-access {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.5rem;
}

.admin-paywall-sep {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1rem 0 0.75rem;
}

.admin-paywall-tips {
  margin: 0.35rem 0 0.5rem;
  padding-left: 1.15rem;
  display: grid;
  gap: 0.25rem;
}

.admin-release-actions {
  grid-auto-flow: column;
  justify-content: start;
  gap: 0.5rem;
}

.episode-schedule-table {
  display: grid;
  gap: 0.45rem;
  margin: 0.5rem 0;
}

.episode-schedule-row {
  display: grid;
  grid-template-columns: minmax(8rem, 1.2fr) minmax(11rem, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
}

.episode-schedule-head {
  font-size: 0.8rem;
  color: var(--muted);
}

.episode-schedule-label {
  font-size: 0.92rem;
}

@media (max-width: 720px) {
  .episode-schedule-row {
    grid-template-columns: 1fr;
  }

  .admin-release-actions {
    grid-auto-flow: row;
  }
}

.authors-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

.authors-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: center;
  justify-content: space-between;
}

.authors-item-main {
  min-width: 0;
  flex: 1 1 12rem;
}

.authors-open-catalog {
  flex: 0 0 auto;
}

.authors-email {
  font-weight: 600;
}

.authors-meta {
  margin-top: 0.25rem;
  font-size: 0.85rem;
}

.authors-password {
  margin: 0.75rem 0 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid #b7ddd0;
  border-radius: 8px;
  background: #e8f6f1;
}

.authors-password-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin-top: 0.5rem;
}

.authors-password-row code {
  font-size: 1rem;
  word-break: break-all;
}

.hint {
  margin-top: 1.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.story-link {
  display: flex;
  gap: 0.85rem;
  align-items: stretch;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  border-radius: 8px;
}

.story-cover-wrap {
  flex: 0 0 72px;
  width: 72px;
  min-height: 72px;
  border-radius: 6px;
  overflow: hidden;
  background: #e8eef5;
  border: 1px solid var(--border);
}

.story-cover {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.story-cover-empty {
  background:
    linear-gradient(135deg, #e8eef5 0%, #d9efe8 100%);
}

.story-card-body {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 0.35rem;
}

.pkg-media {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
}

.pkg-media-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-start;
}

.pkg-media-preview-wrap {
  display: grid;
  place-items: center;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.pkg-media-preview-cover {
  width: 180px;
  height: 320px;
  flex: 0 0 180px;
}

.pkg-media-preview-stats {
  width: 96px;
  height: 170px;
  flex: 0 0 96px;
}

.pkg-media-preview {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.pkg-media-miss {
  margin: 0;
  padding: 0.4rem;
  text-align: center;
  font-size: 0.8rem;
}

.pkg-media-actions {
  display: grid;
  gap: 0.35rem;
  align-content: start;
}

.pkg-media-status {
  margin: 0;
}

.pkg-media-drop {
  min-height: 2.2rem;
  padding: 0.45rem 0.6rem;
  font-size: 0.85rem;
}

/* Сезон: зона «Перетащите PNG» заметнее (не сливается с фоном foldout). */
.season-media-slot .bg-drop.pkg-media-drop {
  min-height: 2.75rem;
  padding: 0.65rem 0.75rem;
  margin-top: 0.15rem;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text);
  background: var(--surface);
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
  cursor: copy;
}

.season-media-slot .bg-drop.pkg-media-drop.is-dragover {
  background: var(--surface-2);
  border-style: solid;
  color: var(--text);
}

.card-foldout .season-media-slot .pkg-media-drop {
  min-height: 2.75rem;
  padding: 0.65rem 0.75rem;
  font-size: 0.9rem;
}

.season-media-slot:first-of-type {
  border-top: none;
  padding-top: 0;
}

.season-media-slot-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.season-media-status {
  margin: 0;
}

.cover-edit-row {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.cover-preview-wrap {
  max-width: 180px;
}

.story-cover-preview {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #f7faf9;
}

@media (max-width: 640px) {
  .story-link {
    flex-direction: column;
  }
  .story-cover-wrap {
    width: 100%;
    height: 120px;
    flex-basis: auto;
  }
}

.story-link:hover .story-title {
  color: var(--accent);
}

.story-open {
  margin-top: 0.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
}

.back-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.95rem;
}

.back-link:hover {
  text-decoration: underline;
}

.panel {
  margin-top: 1.25rem;
  padding: 1rem 1.05rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  box-sizing: border-box;
}

.panel h2 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
}

.story-section.panel {
  margin-top: 0;
  padding: 0.65rem 0.85rem 0.85rem;
}

.story-section.panel > .story-section-head + .editor-subnav,
.story-section.panel > .story-section-head + #editor-scenes-root,
.story-section.panel > .story-section-head + #editor-flow-root {
  margin-top: 0;
}

.form-wide {
  max-width: 560px;
}

.form-inline {
  max-width: 560px;
  margin-top: 0.85rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: end;
}

.check-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.check-row input {
  margin-top: 0.2rem;
}

input[type="text"],
input[type="file"] {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: #fff;
}

input[type="file"] {
  padding: 0.45rem;
}

.msg {
  margin: 0 0 0.85rem;
  padding: 0.75rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.msg-ok {
  background: #e8f6f1;
  border-color: #b7ddd0;
  color: var(--accent);
}

.msg-error {
  background: var(--danger-bg);
  border-color: #f0c4c4;
  color: var(--danger);
}

.msg-warn {
  background: #fff8e8;
  border-color: #e8d4a8;
  color: #6a5500;
}

.home-actions {
  margin: 0.75rem 0 1rem;
}

.tester-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.tester-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.tester-id {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.9rem;
}

.btn-sm {
  padding: 0.4rem 0.7rem;
  font-size: 0.85rem;
}

code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.9em;
}

.legal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(26, 35, 48, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.legal-dialog {
  width: min(520px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.35rem 1.4rem 1.25rem;
  display: grid;
  gap: 0.85rem;
  max-height: min(92vh, 900px);
}

.legal-dialog-wide {
  width: min(720px, 100%);
}

.legal-dialog h2 {
  margin: 0;
  font-size: 1.2rem;
}

.legal-dialog > p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.legal-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.legal-tab {
  appearance: none;
  border: 1px solid var(--border);
  background: #f7faf9;
  color: var(--muted);
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.legal-tab.is-active {
  background: #e8f6f1;
  border-color: #b7ddd0;
  color: var(--accent);
}

.legal-scroll {
  max-height: min(48vh, 420px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  /* Тёмная тема кабинета: не светлый фон + var(--text) — иначе буквы не видны. */
  background: var(--bg-deep);
  color: var(--text);
  line-height: 1.5;
  -webkit-overflow-scrolling: touch;
}

.legal-scroll h3 {
  margin: 0.85rem 0 0.4rem;
  font-size: 1rem;
  color: var(--text);
}

.legal-scroll h3:first-child {
  margin-top: 0;
}

.legal-scroll p {
  margin: 0 0 0.65rem;
  color: var(--text);
  font-size: 0.92rem;
}

.legal-scroll .legal-note {
  color: var(--muted);
  background: var(--surface-3);
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
}

.legal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.25rem;
}

@media (max-width: 640px) {
  .form-inline {
    grid-template-columns: 1fr;
  }
}



/* unity-dark-overrides */
.app {
  max-width: 100%;
  width: 100%;
}
.topbar {
  margin-bottom: 1rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.brand { font-size: 1.05rem; font-weight: 600; }
.story-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0 0 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
}
.story-toolbar-left, .story-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.editor-autosave-status {
  font-size: 0.78rem;
  line-height: 1.2;
  max-width: 11rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.editor-autosave-status.is-ok {
  color: var(--ok, #2f7a3e);
}
.editor-autosave-status.is-busy {
  color: var(--muted);
}
.editor-autosave-status.is-error {
  color: var(--danger, #b33);
}
.story-toolbar-left {
  flex-wrap: nowrap;
  min-width: 0;
  flex: 1 1 auto;
}
.story-toolbar-sep {
  color: var(--muted);
}
.story-toolbar-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 650;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.story-toolbar .back-link {
  white-space: nowrap;
  margin: 0;
}
.toolbar-release {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.4rem 0.15rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
}
.toolbar-release[hidden] {
  display: none !important;
}
.toolbar-release-season {
  font-size: 0.8rem;
  font-weight: 650;
  white-space: nowrap;
}
.toolbar-release-field {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}
.toolbar-release-field[hidden] {
  display: none !important;
}
.toolbar-release-season[hidden] {
  display: none !important;
}
.toolbar-release-field select {
  width: auto;
  min-height: 1.65rem;
  padding: 0.15rem 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
}
.btn-sm { padding: 0.2rem 0.55rem; font-size: 0.8rem; border-radius: var(--radius); min-height: 1.65rem; }
input[type="email"], input[type="password"], input[type="text"], input[type="url"],
input[type="number"], input[type="search"], select, textarea, .create-story-panel select,
.editor-field select, .editor-field input, .editor-field textarea {
  background: var(--bg-deep) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
  border-radius: var(--radius) !important;
  padding: var(--ctrl-pad-y) var(--ctrl-pad-x) !important;
  font-size: var(--ctrl-fs) !important;
  line-height: 1.3 !important;
  min-height: var(--ctrl-h) !important;
}
textarea,
.editor-field textarea {
  min-height: 3.2rem !important;
}
input:focus, select:focus, textarea:focus {
  outline: 1px solid var(--accent);
  border-color: var(--accent);
}
.btn {
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: var(--ctrl-pad-y) 0.7rem;
  font-size: var(--ctrl-fs);
  min-height: var(--ctrl-h);
  line-height: 1.25;
}
.btn:hover:not(:disabled) { background: var(--accent); }
.btn-ghost { background: var(--surface-3); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: #4a4a4a; }
.btn-small, .btn-sm {
  padding: 0.2rem 0.5rem !important;
  font-size: 0.8rem !important;
  min-height: 1.65rem !important;
}
.editor-season-row, .season-block, .nested-panel, .card-seasons-block,
.story-card, .empty, .cover-preview-wrap, .story-cover-wrap {
  background: var(--surface-2) !important;
  border-color: var(--border) !important;
  color: var(--text);
}
.card-seasons-block {
  background: var(--bg-deep) !important;
}
.season-block-muted { background: var(--bg-deep) !important; }
.nested-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 0.75rem;
  box-shadow: none;
}
.badge { background: var(--surface-3); color: var(--muted); border-color: var(--border); }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.hint, .lead, .muted { color: var(--muted); }
.error { background: var(--danger-bg); color: var(--danger); border-color: #6a3030; }
.msg-ok { background: var(--ok-bg); color: var(--ok); border-color: #355a3c; }
.msg-error { background: var(--danger-bg); color: var(--danger); border-color: #6a3030; }
.msg-warn { background: #3a3420; color: #e8d48a; border-color: #5a4e28; }
.editor-warnings { background: var(--warn-bg); border-color: var(--warn-border); color: var(--text); }
.editor-warnings-body,
.save-result-list,
.validate-list { scrollbar-color: #6a5a30 #2a2418; }
.editor-warnings-body::-webkit-scrollbar-track,
.save-result-list::-webkit-scrollbar-track,
.validate-list::-webkit-scrollbar-track { background: #2a2418; }
.editor-warnings-body::-webkit-scrollbar-thumb,
.save-result-list::-webkit-scrollbar-thumb,
.validate-list::-webkit-scrollbar-thumb { background: #6a5a30; border-color: #2a2418; }
.editor-warnings-body::-webkit-scrollbar-thumb:hover,
.save-result-list::-webkit-scrollbar-thumb:hover,
.validate-list::-webkit-scrollbar-thumb:hover { background: #857040; }
.back-link { color: var(--accent); }
.integrator-modal { background: var(--surface); color: var(--text); border-color: var(--border); }
.integrator-modal-head { background: var(--bg-deep); border-color: var(--border); }
.integrator-modal::backdrop { background: rgba(0,0,0,0.55); }
.integrator-cheat-pre { background: var(--bg-deep); color: var(--text); }
.integrator-preview, .integrator-report {
  background: var(--bg-deep) !important;
  border-color: var(--border) !important;
  color: var(--text);
}
.related-stories-list {
  list-style: none;
  margin: 0.35rem 0 0.65rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.related-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.35rem 0.25rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 0.9rem;
}
.related-add-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.related-add-field {
  flex: 1 1 14rem;
  min-width: 12rem;
}
.build-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 0;
}
.build-validate-btn {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
}
.build-modal {
  max-width: min(640px, 96vw);
}

.bake-wait-modal {
  max-width: min(420px, 94vw);
}

.bake-wait-body {
  display: grid;
  gap: 0.55rem;
}

.bake-wait-status {
  margin: 0;
  font-size: 1rem;
}

.bake-wait-timer {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.bake-wait-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.35rem;
}
#save-result-modal.integrator-modal {
  max-height: min(92vh, 760px);
  overflow: hidden;
}
#save-result-modal.integrator-modal[open] {
  display: flex;
  flex-direction: column;
}
#save-result-modal .integrator-modal-head {
  flex: 0 0 auto;
}
#save-result-modal .integrator-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  max-height: none;
}
.save-result-x {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}
.save-result-x:hover {
  background: rgba(255, 255, 255, 0.08);
}
/* Выгрузка: плотность как Карточка/Сезон, остальной кабинет не трогаем */
#export-modal .integrator-modal-body {
  padding: 0.5rem 0.65rem 0.6rem;
}
#export-modal .nested-panel {
  margin: 0.3rem 0;
  padding: 0.35rem 0.45rem;
}
#export-modal .hint,
#export-modal .muted {
  margin-top: 0.15rem;
  margin-bottom: 0.2rem;
}
#export-modal .lead {
  margin: 0 0 0.28rem;
  line-height: 1.3;
}
#export-modal .editor-field {
  margin-bottom: 0.2rem;
  gap: 0.1rem;
}
#export-modal .editor-scenes-heading {
  margin: 0 0 0.15rem;
  font-size: 0.95rem;
}
#export-modal .form {
  gap: 0.3rem;
}
.save-result-summary {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.65rem;
  border-radius: 6px;
  border: 1px solid #a8882a;
  background: rgba(168, 136, 42, 0.16);
  color: #f3e2b0;
  font-size: 0.86rem;
  line-height: 1.4;
}
.save-result-list {
  max-height: min(56vh, 480px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  margin-bottom: 0.65rem;
}
.save-result-item {
  margin: 0;
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  border: 1px solid #a8882a;
  background: rgba(168, 136, 42, 0.12);
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.4;
}
.save-result-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  flex: 0 0 auto;
  margin-top: 0;
  padding: 0.65rem 1rem 0.85rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
/* Проверка ошибок: плотные подсказки + карточки как у «Сохранение» */
#validate-modal .integrator-modal-body {
  padding: 0.5rem 0.65rem 0.65rem;
}
#validate-modal .hint,
#validate-modal .muted {
  margin-top: 0.12rem;
  margin-bottom: 0.18rem;
}
#validate-modal .editor-field {
  margin: 0.2rem 0 0.15rem;
  gap: 0.1rem;
}
#validate-modal #validate-run-btn {
  margin-top: 0.35rem;
}
.validate-results {
  margin-top: 0.55rem;
  padding: 0;
  border: 0;
  background: transparent;
  max-height: none;
  overflow: visible;
}
.validate-results-ok {
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid #355a3c;
  background: var(--ok-bg);
}
.validate-results-split {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.validate-section-title {
  margin: 0 0 0.1rem;
  font-size: 0.95rem;
}
.validate-section-err .validate-section-title {
  color: #f0b4b4;
}
.validate-section-warn .validate-section-title {
  color: #f3e2b0;
}
.validate-section-note {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.3;
}
.validate-list {
  max-height: min(38vh, 340px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  padding-right: 0.15rem;
}
.validate-item {
  margin: 0;
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  font-size: 0.84rem;
  line-height: 1.4;
  color: var(--text);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.35rem 0.5rem;
}
.validate-item-text {
  flex: 1 1 12rem;
  min-width: 0;
}
.validate-item-err {
  border: 1px solid #8a3a3a;
  background: rgba(120, 40, 40, 0.22);
}
.validate-item-warn {
  border: 1px solid #a8882a;
  background: rgba(168, 136, 42, 0.12);
}
.validate-copy-row {
  margin-top: 0.15rem;
}
.validate-item .btn {
  flex: 0 0 auto;
}
.story-cover-empty {
  background: linear-gradient(135deg, #3a3a3a 0%, #2a2a2a 100%) !important;
}
a { color: var(--accent); }
.story-link { color: inherit; }
.story-open { color: var(--accent); }

/* Колокольчик уведомлений + тост сессии */
.notices-wrap {
  position: relative;
  display: flex;
  align-items: center;
  z-index: 2;
  overflow: visible;
}
.btn-notices {
  position: relative;
  padding: 0.35rem 0.5rem;
  min-width: 2.25rem;
  line-height: 1;
  isolation: isolate;
}
.notices-bell-icon {
  display: block;
  opacity: 0.9;
  position: relative;
  z-index: 1;
}
.notices-badge {
  position: absolute;
  top: -0.15rem;
  right: -0.15rem;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: #b54a4a;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.05rem;
  text-align: center;
  pointer-events: none;
  z-index: 2;
}

/* Непрочитанное предупреждение сессии — волны от колокольчика (не мешает модалкам). */
.btn-notices.is-session-pulse::before,
.btn-notices.is-session-pulse::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4.8rem;
  height: 4.8rem;
  margin: -2.4rem 0 0 -2.4rem;
  border-radius: 50%;
  border: 4px solid rgba(255, 176, 64, 0.95);
  pointer-events: none;
  z-index: 0;
  /* Только transform — не влияет на layout; обрезка по html/body overflow-x. */
  will-change: transform, opacity;
  animation: notices-bell-wave 1.8s ease-out infinite;
}
.btn-notices.is-session-pulse::after {
  animation-delay: 0.8s;
  border-color: rgba(232, 72, 48, 0.9);
}
.btn-notices.is-session-pulse .notices-bell-icon {
  opacity: 1;
  color: #ffb040;
  animation: notices-bell-nudge 1.6s ease-in-out infinite;
}
.btn-notices.is-session-pulse .notices-badge {
  background: #e24a32;
  box-shadow: 0 0 0 3px rgba(226, 74, 50, 0.55);
}

@keyframes notices-bell-wave {
  0% {
    transform: scale(0.45);
    opacity: 1;
  }
  70% {
    opacity: 0.45;
  }
  100% {
    transform: scale(16);
    opacity: 0;
  }
}

@keyframes notices-bell-nudge {
  0%,
  100% {
    transform: rotate(0deg);
  }
  15% {
    transform: rotate(-28deg);
  }
  30% {
    transform: rotate(24deg);
  }
  45% {
    transform: rotate(-14deg);
  }
  60% {
    transform: rotate(0deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn-notices.is-session-pulse::before,
  .btn-notices.is-session-pulse::after,
  .btn-notices.is-session-pulse .notices-bell-icon {
    animation: none;
  }
  .btn-notices.is-session-pulse .notices-bell-icon {
    color: #e8a848;
  }
}
.notices-panel {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  z-index: 80;
  width: min(22rem, calc(100vw - 1.5rem));
  max-height: min(24rem, 70vh);
  overflow: auto;
  padding: 0.5rem;
  background: var(--surface, #2c2c2c);
  border: 1px solid var(--border, #4a4a4a);
  border-radius: var(--radius, 8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.notices-section-title {
  margin: 0.35rem 0.25rem 0.25rem;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted, #9a9a9a);
}
.notices-empty {
  padding: 0.75rem 0.5rem;
  font-size: 0.9rem;
}
.notices-row {
  display: flex;
  align-items: stretch;
  gap: 0.2rem;
  margin: 0 0 0.25rem;
}
.notices-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0.55rem 0.6rem;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text, #eee);
  cursor: pointer;
}
.notices-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border, #4a4a4a);
}
.notices-item.is-unread {
  background: rgba(120, 90, 40, 0.18);
  border-color: rgba(168, 136, 42, 0.35);
}
.notices-item-title {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.25;
}
.notices-item-meta {
  font-size: 0.75rem;
}
.notices-trash-btn {
  flex: 0 0 auto;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #e07070;
  cursor: pointer;
}
.notices-trash-btn:hover {
  background: rgba(224, 112, 112, 0.16);
  color: #ff8a8a;
}
.notices-trash-icon {
  display: block;
}
.notices-detail-actions {
  display: flex;
  justify-content: flex-end;
  padding: 0 0.9rem 0.85rem;
}
.session-toast-host {
  position: fixed;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: min(22rem, calc(100vw - 1.5rem));
  pointer-events: none;
}
.session-toast {
  pointer-events: auto;
  padding: 0.75rem 0.85rem;
  background: var(--surface, #2c2c2c);
  border: 1px solid #a8882a;
  border-radius: var(--radius, 8px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
}
.session-toast-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.session-toast-body,
.session-toast-extra {
  margin: 0 0 0.45rem;
  font-size: 0.88rem;
  line-height: 1.35;
  color: var(--text, #eee);
}
.session-toast-extra {
  color: var(--muted, #b0b0b0);
}
.session-toast-actions {
  display: flex;
  justify-content: flex-end;
}
.notices-detail-dialog {
  border: 1px solid var(--border, #4a4a4a);
  border-radius: var(--radius, 8px);
  padding: 0;
  background: var(--surface, #2c2c2c);
  color: var(--text, #eee);
  max-width: min(28rem, calc(100vw - 1.5rem));
}
.notices-detail-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}
.notices-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border, #4a4a4a);
}
.notices-detail-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
}
.notices-detail-meta {
  margin: 0.5rem 0.9rem 0;
  font-size: 0.8rem;
}
.notices-detail-body {
  padding: 0.65rem 0.9rem 1rem;
  font-size: 0.92rem;
  line-height: 1.4;
  white-space: pre-wrap;
}

.editor-version-snap-row {
  display: grid;
  grid-template-columns: minmax(6rem, auto) minmax(0, 1fr);
  gap: 0.65rem 1.25rem;
  align-items: start;
}
@media (max-width: 640px) {
  .editor-version-snap-row {
    grid-template-columns: 1fr;
  }
}
.editor-snapshots-block {
  min-width: 0;
}
.editor-snapshots-head {
  margin-bottom: 0.1rem;
}
.editor-snapshots-hint {
  margin: 0 0 0.25rem;
  font-size: 0.75rem;
  line-height: 1.3;
  max-width: 28rem;
}
.editor-snapshots-list {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-size: 0.82rem;
  line-height: 1.35;
}
.editor-snapshot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  min-height: 1.5rem;
}
.editor-snapshot-meta {
  min-width: 0;
  color: var(--text, #eee);
}
.btn-link-restore {
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent, #7db4ff);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.12em;
}
.btn-link-restore:hover {
  color: #a8ccff;
}

/* W-Ad4: вкладка Премиум (как слои персонажа) */
.premium-npc-pick {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: 0.5rem;
  font-size: 0.9rem;
}
.premium-npc-pick select {
  min-width: 10rem;
}
.premium-layers {
  display: grid;
  gap: 1.25rem;
  margin-top: 0.75rem;
}
.premium-layer-host {
  margin-top: 0.35rem;
}
.premium-meta {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.65rem;
}
.premium-meta .editor-field {
  margin: 0;
}

/* W-Ad7: вкладка Рамки */
.ui-frames-list {
  display: grid;
  gap: 1.35rem;
  margin-top: 0.75rem;
}
.ui-frames-group-list {
  display: grid;
  gap: 0.75rem;
}
.ui-frames-group-title {
  margin: 0 0 0.55rem;
}
.ui-frames-row {
  display: grid;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
}
.ui-frames-row-main {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
}
.ui-frames-meta {
  min-width: 12rem;
  flex: 1 1 14rem;
}
.ui-frames-meta .editor-scenes-heading {
  margin: 0 0 0.2rem;
}
.ui-frames-hint {
  margin: 0.15rem 0 0.35rem;
  font-size: 0.9rem;
  line-height: 1.35;
  opacity: 0.92;
}
.ui-frames-key {
  margin: 0;
  font-size: 0.78rem;
  word-break: break-all;
}
.ui-frames-preview {
  width: 7.5rem;
  min-height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.18);
  border-radius: 0.35rem;
  overflow: hidden;
}
.ui-frames-thumb {
  max-width: 100%;
  max-height: 4.5rem;
  display: block;
  object-fit: contain;
}
.ui-frames-drop {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  min-height: 2.75rem;
  padding: 0.55rem 0.75rem;
  cursor: copy;
}
.ui-frames-drop.is-dragover {
  outline: 2px solid var(--accent, #7db4ff);
  outline-offset: 1px;
}
.ui-frames-drop-label {
  font-size: 0.9rem;
}
.ui-frames-drop-or {
  font-size: 0.85rem;
}
