/* Редактор кампаний — тёмная тема, без внешних зависимостей. */

:root {
  color-scheme: dark;
  --bg: #0e1117;
  --bg-soft: #141924;
  --panel: #171d28;
  --panel-soft: #1c2330;
  --panel-hover: #222b3a;
  --line: #2a3341;
  --line-strong: #3a4759;
  --text: #e8e4da;
  --text-dim: #c3bdb0;
  --muted: #96a0b1;
  --gold: #d9a85c;
  --gold-bright: #f2cd8b;
  --accent: #7fa8c9;
  --danger: #e2796d;
  --danger-soft: #3a2224;
  --warning: #d9b35c;
  --warning-soft: #352f1f;
  --success: #7ec79a;
  --success-soft: #1c2f24;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.45);
  --font: "Segoe UI", system-ui, -apple-system, "Noto Sans", Roboto, Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Georgia, "Times New Roman", serif;
  --mono: "Cascadia Code", "JetBrains Mono", Consolas, "SFMono-Regular", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(217, 168, 92, 0.09), transparent 60%),
    radial-gradient(900px 500px at 110% 0%, rgba(127, 168, 201, 0.08), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 600;
  line-height: 1.25;
}

p {
  margin: 0;
}

a {
  color: var(--accent);
}

code,
pre {
  font-family: var(--mono);
  font-size: 0.88em;
}

.boot {
  padding: 80px 24px;
  text-align: center;
  color: var(--muted);
}

.noscript {
  padding: 24px;
  background: var(--danger-soft);
  color: var(--text);
  text-align: center;
}

/* --- Каркас ------------------------------------------------------------- */

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 20px;
  background: rgba(14, 17, 23, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  white-space: nowrap;
}

.brand__mark {
  color: var(--gold);
  font-size: 18px;
}

.brand__name {
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: 0.3px;
  color: var(--text);
}

.brand__hint {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
}

.topbar__campaign {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.topbar__title {
  max-width: 380px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: none;
  border: 0;
  padding: 2px 4px;
  border-radius: 6px;
  color: var(--text);
  font-family: var(--serif);
  font-size: 16px;
  cursor: pointer;
}

.topbar__title:hover {
  background: var(--panel-soft);
}

.topbar__id {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.7;
  cursor: pointer;
  background: var(--panel-soft);
  color: var(--text);
  white-space: nowrap;
}

.pill--danger {
  background: var(--danger-soft);
  border-color: rgba(226, 121, 109, 0.45);
  color: #f3aaa2;
}

.pill--success {
  background: var(--success-soft);
  border-color: rgba(126, 199, 154, 0.4);
  color: #a5ddb9;
}

.pill--warning {
  background: var(--warning-soft);
  border-color: rgba(217, 179, 92, 0.4);
  color: #eed08d;
}

.shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  flex: 1;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 57px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: calc(100vh - 57px);
  overflow-y: auto;
  padding: 16px 12px;
  border-right: 1px solid var(--line);
  background: rgba(20, 25, 36, 0.55);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
}

.nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-dim);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.nav__item:hover {
  background: var(--panel-soft);
  color: var(--text);
}

.nav__item--active {
  background: linear-gradient(90deg, rgba(217, 168, 92, 0.16), rgba(217, 168, 92, 0.04));
  border-color: rgba(217, 168, 92, 0.35);
  color: var(--gold-bright);
}

.nav__item--library {
  font-weight: 600;
  color: var(--text);
}

.nav__icon {
  width: 20px;
  text-align: center;
  font-size: 14px;
}

.nav__title {
  flex: 1;
}

.nav__badge {
  min-width: 20px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  line-height: 18px;
}

.nav__badge--danger {
  background: var(--danger);
  color: #1a0f10;
}

.nav__badge--success {
  background: rgba(126, 199, 154, 0.18);
  color: var(--success);
}

.nav__empty {
  padding: 12px 4px;
  font-size: 13px;
}

.sidebar__footer {
  margin-top: auto;
  padding: 12px 4px 4px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar__hint {
  font-size: 12px;
  color: var(--muted);
}

.sidebar__buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.sidebar__version {
  font-size: 11px;
  color: rgba(150, 160, 177, 0.65);
  font-family: var(--mono);
}

.main {
  width: 100%;
  max-width: 1180px;
  padding: 24px 28px 64px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.main--wide {
  max-width: 1440px;
}

/* --- Типографика страниц ------------------------------------------------ */

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 4px 0 2px;
}

.page-title {
  font-family: var(--serif);
  font-size: 27px;
  letter-spacing: 0.2px;
}

.page-subtitle {
  margin-top: 4px;
  color: var(--muted);
  max-width: 760px;
}

.page-head__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.subhead {
  margin: 16px 0 8px;
  font-size: 12px;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--muted);
}

.subhead:first-child {
  margin-top: 0;
}

.muted {
  color: var(--muted);
}

.footnote {
  font-size: 12.5px;
  padding: 0 4px;
}

.bullets {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-dim);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stack--tight {
  gap: 10px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.row--between {
  justify-content: space-between;
}

.row--end {
  justify-content: flex-end;
}

.row--wrap {
  flex-wrap: wrap;
}

/* --- Кнопки ------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.2;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 60ms ease;
  white-space: nowrap;
}

.btn:hover {
  background: var(--panel-hover);
  border-color: #48576d;
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible,
.input:focus-visible,
.nav__item:focus-visible,
.pill:focus-visible,
.map__node:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn--primary {
  background: linear-gradient(180deg, #e3b469, #c9963f);
  border-color: #a87a2c;
  color: #201404;
  font-weight: 600;
}

.btn--primary:hover {
  background: linear-gradient(180deg, #f0c47d, #d3a04a);
  border-color: #b9892f;
}

.btn--danger {
  background: rgba(226, 121, 109, 0.14);
  border-color: rgba(226, 121, 109, 0.5);
  color: #f0a9a0;
}

.btn--danger:hover {
  background: rgba(226, 121, 109, 0.24);
}

.btn--success {
  background: rgba(126, 199, 154, 0.14);
  border-color: rgba(126, 199, 154, 0.45);
  color: #a9e0bd;
}

.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.btn--ghost:hover {
  background: var(--panel-soft);
  border-color: var(--line);
  color: var(--text);
}

.btn--small {
  padding: 5px 9px;
  font-size: 12.5px;
}

.btn__icon {
  font-size: 0.95em;
}

/* --- Поля --------------------------------------------------------------- */

.input {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #0c1016;
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.input:hover {
  border-color: var(--line-strong);
}

.input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(217, 168, 92, 0.13);
  outline: none;
}

.input--area {
  resize: vertical;
  min-height: 72px;
  line-height: 1.5;
}

.input--area-large {
  min-height: 110px;
}

.input--mono {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.2px;
}

.input--number {
  max-width: 130px;
}

.input--small {
  max-width: 90px;
}

.input--select {
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 16px, calc(100% - 11px) 16px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}

.input--readonly {
  background: var(--bg-soft);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
  display: flex;
  align-items: center;
}

.input--adder {
  max-width: 260px;
  margin-top: 4px;
}

textarea.input {
  min-height: 62px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.field--wide {
  grid-column: 1 / -1;
}

.field__label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.2px;
}

.field__required {
  color: var(--danger);
}

.field__hint {
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}

.checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--gold);
  cursor: pointer;
  flex: none;
}

.grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

.grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* --- Карточки ----------------------------------------------------------- */

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent), var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}

.card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 18px 0;
  flex-wrap: wrap;
}

.card__titles {
  min-width: 0;
}

.card__title {
  font-family: var(--serif);
  font-size: 18px;
  letter-spacing: 0.2px;
}

.card__title--node > * {
  margin: 0;
  font-family: var(--serif);
  font-size: 18px;
}

.card__subtitle {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--muted);
}

.card__actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.card__body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 18px 18px;
}

.card--intro {
  border-color: rgba(127, 168, 201, 0.28);
  background: linear-gradient(180deg, rgba(127, 168, 201, 0.06), transparent 55%), var(--panel);
}

.card--danger {
  border-color: rgba(226, 121, 109, 0.42);
  background: linear-gradient(180deg, rgba(226, 121, 109, 0.07), transparent 55%), var(--panel);
}

.card--warning {
  border-color: rgba(217, 179, 92, 0.4);
  background: linear-gradient(180deg, rgba(217, 179, 92, 0.06), transparent 55%), var(--panel);
}

.card--success {
  border-color: rgba(126, 199, 154, 0.38);
  background: linear-gradient(180deg, rgba(126, 199, 154, 0.06), transparent 55%), var(--panel);
}

/* --- Бейджи, статистика ------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--bg-soft);
  color: var(--text-dim);
  font-size: 11.5px;
  line-height: 1.7;
  white-space: nowrap;
}

.badge--danger {
  border-color: rgba(226, 121, 109, 0.45);
  background: var(--danger-soft);
  color: #f0aaa2;
}

.badge--warning {
  border-color: rgba(217, 179, 92, 0.42);
  background: var(--warning-soft);
  color: #ecd08f;
}

.badge--success {
  border-color: rgba(126, 199, 154, 0.4);
  background: var(--success-soft);
  color: #a9e0bd;
}

.badge--info {
  border-color: rgba(127, 168, 201, 0.4);
  background: rgba(127, 168, 201, 0.1);
  color: #a7c6de;
}

.badge--muted {
  color: var(--muted);
}

.stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.stat {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.stat__value {
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1.1;
}

.stat__label {
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
}

.stat--danger .stat__value {
  color: var(--danger);
}

.stat--warning .stat__value {
  color: var(--warning);
}

.stat--success .stat__value {
  color: var(--success);
}

/* --- Списки и сплит ----------------------------------------------------- */

.split {
  display: grid;
  grid-template-columns: 262px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.split__side {
  position: sticky;
  top: 76px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.side {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.list-item:hover {
  background: var(--panel-soft);
  border-color: var(--line-strong);
}

.list-item--selected {
  border-color: rgba(217, 168, 92, 0.55);
  background: linear-gradient(90deg, rgba(217, 168, 92, 0.12), rgba(217, 168, 92, 0.02));
}

.list-item__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  gap: 1px;
}

.list-item__label {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item__subtitle {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item__badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.empty {
  padding: 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13.5px;
}

.empty__text {
  margin: 0;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* --- Проблемы ----------------------------------------------------------- */

.issue {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: baseline;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--danger);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text-dim);
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
}

.issue:hover {
  background: var(--panel-soft);
}

.issue--warning {
  border-left-color: var(--warning);
}

.issue__level {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--danger);
}

.issue--warning .issue__level {
  color: var(--warning);
}

.issue__message {
  min-width: 0;
}

.issue__path {
  font-size: 11.5px;
  color: var(--muted);
  font-family: var(--mono);
  white-space: nowrap;
}

.issue-box {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid rgba(226, 121, 109, 0.35);
  border-radius: var(--radius-sm);
  background: rgba(226, 121, 109, 0.05);
}

.issue-box__row {
  display: flex;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dim);
}

.issue-box__mark {
  color: var(--danger);
  font-weight: 700;
}

.issue-box__row--warning .issue-box__mark {
  color: var(--warning);
}

/* --- Выходы, эффекты, условия ------------------------------------------- */

.exit {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
}

.exit__head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.exit__index {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

.exit__arrow {
  color: var(--gold);
}

.exit__to {
  font-weight: 600;
  font-size: 14.5px;
}

.subsection {
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.effects {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.effect {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(12, 16, 22, 0.55);
}

.effect__controls {
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.effect__controls > .btn {
  justify-self: end;
}

.effect__hint {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--muted);
}

.check-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  gap: 12px;
}

.picks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.pick {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(12, 16, 22, 0.4);
  cursor: pointer;
  font-size: 13.5px;
  min-width: 0;
}

.pick:hover {
  border-color: var(--line-strong);
}

.pick__label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.checks {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.check-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px auto;
  gap: 10px;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(12, 16, 22, 0.4);
}

.check-row__name {
  font-family: var(--mono);
  font-size: 13px;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 620px;
  overflow-y: auto;
  padding-right: 4px;
}

.message-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(12, 16, 22, 0.4);
}

.message-row__head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.message-row__title {
  font-weight: 600;
  font-size: 13.5px;
}

.message-row__key {
  font-size: 11px;
  color: var(--muted);
}

/* --- Карта -------------------------------------------------------------- */

.map-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: radial-gradient(700px 400px at 30% 10%, rgba(127, 168, 201, 0.06), transparent 60%), #0b0f15;
}

.map {
  display: block;
  width: 100%;
  min-width: 640px;
  height: auto;
  min-height: 300px;
}

.map__edge {
  fill: none;
  stroke: #5b6b83;
  stroke-width: 1.6;
}

.map__edge--locked {
  stroke-dasharray: 6 5;
  stroke: #8a7a4f;
}

.map__edge--effect {
  stroke: #7f9db8;
}

.map__arrowhead {
  fill: #5b6b83;
}

.map__arrowhead--open {
  fill: #8a7a4f;
}

.map__edge-label {
  fill: var(--muted);
  font-size: 11px;
  font-family: var(--font);
  pointer-events: none;
}

.map__node {
  cursor: grab;
}

.map__node--dragging {
  cursor: grabbing;
}

.map__node-box {
  fill: #1a212d;
  stroke: #46556b;
  stroke-width: 1.4;
}

.map__node:hover .map__node-box {
  stroke: var(--gold);
}

.map__node--selected .map__node-box {
  stroke: var(--gold);
  stroke-width: 2.2;
  fill: #232b38;
}

.map__node--error .map__node-box {
  stroke: var(--danger);
}

.map__node--warning .map__node-box {
  stroke: var(--warning);
}

.map__node--start .map__node-box {
  fill: #1c2a22;
}

.map__node-name {
  fill: var(--text);
  font-size: 13.5px;
  font-family: var(--font);
}

.map__node-id {
  fill: var(--muted);
  font-size: 10.5px;
  font-family: var(--mono);
}

.map__node-flag {
  fill: var(--gold);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.map__node-badge {
  fill: var(--warning);
  font-size: 10.5px;
  font-weight: 600;
}

.map__node--error .map__node-badge {
  fill: var(--danger);
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  color: var(--muted);
}

.map-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.map-legend__line {
  width: 22px;
  height: 2px;
  background: #5b6b83;
  display: inline-block;
}

.map-legend__line--locked {
  background: repeating-linear-gradient(90deg, #8a7a4f 0 5px, transparent 5px 9px);
}

.map-legend__dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
  border: 1px solid var(--line-strong);
}

.map-legend__dot--start {
  background: #1c2a22;
  border-color: var(--gold);
}

.map-legend__dot--error {
  background: rgba(226, 121, 109, 0.15);
  border-color: var(--danger);
}

.map-summary {
  padding: 0 4px;
}

/* --- Тест-игра ---------------------------------------------------------- */

.test-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 16px;
  align-items: start;
}

.test-layout > :last-child {
  grid-column: 1 / -1;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.log {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}

.log__entry {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: rgba(12, 16, 22, 0.5);
}

.log__entry--roll {
  border-left-color: var(--gold);
}

.log__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.log__label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
}

.log__roll {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--gold);
}

.log__text {
  font-size: 14px;
  color: var(--text-dim);
  white-space: pre-wrap;
}

.status-line {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: #0b0f15;
  border: 1px solid var(--line);
  font-size: 12.5px;
  white-space: pre-wrap;
  color: var(--text-dim);
}

.kv {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  font-size: 13.5px;
  padding: 4px 0;
  border-bottom: 1px dashed rgba(42, 51, 65, 0.7);
}

.kv:last-of-type {
  border-bottom: 0;
}

.kv__key {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.kv__value {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.entity-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 1px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-soft);
  font-size: 12.5px;
}

.entity-line--dead {
  opacity: 0.55;
  text-decoration: line-through;
}

.details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12.5px;
  padding: 4px 0;
}

.code {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: #0b0f15;
  border: 1px solid var(--line);
  overflow-x: auto;
  font-size: 12px;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-word;
}

/* --- Таблицы ------------------------------------------------------------ */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}

.table td {
  padding: 7px 10px;
  border-bottom: 1px solid rgba(42, 51, 65, 0.6);
}

.table tr:last-child td {
  border-bottom: 0;
}

/* --- Кампании ----------------------------------------------------------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.campaign-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent), var(--panel);
}

.campaign-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.campaign-card__title {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.25;
}

.campaign-card__id {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
}

.campaign-card__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 12.5px;
  color: var(--text-dim);
}

.campaign-card__meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.campaign-card__date {
  font-size: 11.5px;
  color: var(--muted);
}

.campaign-card__actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

/* --- Модальные окна и уведомления --------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(5, 7, 10, 0.72);
  backdrop-filter: blur(3px);
}

.modal__box {
  width: min(760px, 100%);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.modal__title {
  font-family: var(--serif);
  font-size: 19px;
}

.modal__body {
  padding: 16px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--text-dim);
  font-size: 14px;
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--line);
}

.modal__issues {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(420px, calc(100vw - 36px));
}

.toast {
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: #1a212d;
  color: var(--text);
  font-size: 13.5px;
  box-shadow: var(--shadow);
  animation: toast-in 160ms ease-out;
}

.toast--success {
  border-left-color: var(--success);
}

.toast--warning {
  border-left-color: var(--warning);
}

.toast--danger {
  border-left-color: var(--danger);
}

.toast--leaving {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 200ms ease, transform 200ms ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.drop-hint {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(8, 11, 16, 0.8);
  border: 2px dashed rgba(217, 168, 92, 0.6);
}

body.dragging .drop-hint {
  display: flex;
}

.drop-hint__box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 28px 36px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  text-align: center;
}

.drop-hint__box strong {
  font-family: var(--serif);
  font-size: 20px;
}

.drop-hint__box span {
  color: var(--muted);
  font-size: 13px;
}

/* --- Адаптивность ------------------------------------------------------- */

@media (max-width: 1180px) {
  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1080px) {
  .test-layout {
    grid-template-columns: 1fr;
  }
  .split {
    grid-template-columns: 1fr;
  }
  .split__side {
    position: static;
  }
  .grid--3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    padding: 8px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .nav {
    flex-direction: row;
    margin: 0;
    gap: 4px;
  }
  .nav__item {
    white-space: nowrap;
  }
  .nav__empty {
    display: none;
  }
  .sidebar__footer {
    display: none;
  }
  .main {
    padding: 16px;
  }
  .grid--2 {
    grid-template-columns: 1fr;
  }
  .check-editor {
    grid-template-columns: 1fr;
  }
  .effect__controls {
    grid-template-columns: 1fr;
  }
  .picks {
    grid-template-columns: 1fr;
  }
  .topbar {
    flex-wrap: wrap;
    gap: 8px 14px;
  }
  .topbar__campaign {
    order: 3;
    flex-basis: 100%;
  }
  .brand__hint {
    display: none;
  }
}

@media (max-width: 560px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .issue {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .issue__path {
    white-space: normal;
  }
  .page-title {
    font-size: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
