/* Светлый минимализм: много воздуха, тонкие линии, ничего лишнего. */
:root {
  --bg: #ffffff;
  --surface: #f7f7f8;
  --line: #ececec;
  --line-strong: #d9d9de;
  --text: #0d0d0d;
  --muted: #6b6b70;
  --faint: #a1a1a6;
  --accent: #0d0d0d;
  --accent-text: #ffffff;
  --focus: #2f6fed;
  --danger: #b42318;
  /* Стили 1–5: одна шкала от «влияния лидера» к «свободе группы». */
  --s1: #e9eef7;
  --s2: #c9d6ec;
  --s3: #9db4dc;
  --s4: #6588c4;
  --s5: #2f5596;
  --radius: 14px;
  --radius-lg: 22px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
a:hover { text-decoration-color: currentColor; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.01em; margin: 0; }
p { margin: 0 0 1em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
[hidden] { display: none !important; }

/* ── Каркас ─────────────────────────────────────────────── */
.topbar {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  max-width: 760px; margin: 0 auto; padding: 20px 16px 0;
  font-size: 13px; color: var(--muted);
}
.topbar a { text-decoration: none; }
.topbar--wide { max-width: none; padding: 18px 28px 0; }
.page { max-width: 760px; margin: 0 auto; padding: 40px 16px 64px; }
.page--narrow { max-width: 440px; }
.page--wide { max-width: none; padding: 28px 28px 64px; }

/* ── Кнопки и поля ──────────────────────────────────────── */
.btn {
  appearance: none; border: 1px solid var(--line-strong); background: var(--bg); color: var(--text);
  font: inherit; font-size: 15px; font-weight: 500; line-height: 1;
  padding: 12px 20px; border-radius: 999px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px; transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: var(--surface); }
.btn--primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn--primary:hover { background: #2a2a2e; }
.btn--ghost { border-color: transparent; }
.btn--small { font-size: 13px; padding: 7px 12px; }
.btn--danger { color: var(--danger); }
.btn:disabled { opacity: .35; cursor: default; background: inherit; }
.btn--primary:disabled { background: var(--accent); }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=search], select, textarea {
  width: 100%; font: inherit; font-size: 15px; color: var(--text);
  background: var(--bg); border: 1px solid var(--line-strong); border-radius: 12px; padding: 10px 12px;
}
textarea { min-height: 140px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(47,111,237,.12); }

.notice {
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 24px; font-size: 14px;
}
.notice--error { border-color: #f3c4bf; background: #fdf3f2; color: var(--danger); }

/* ── Экран участника ────────────────────────────────────── */
.eyebrow { font-size: 13px; color: var(--muted); margin-bottom: 10px; font-variant-numeric: tabular-nums; }
.case-title { font-size: 28px; line-height: 1.2; margin-bottom: 10px; }
.case-meta { color: var(--muted); font-size: 14px; margin-bottom: 28px; }
.case-meta b { font-weight: 500; color: var(--text); }
.case-text { font-size: 17px; line-height: 1.65; }
.case-text p { margin-bottom: 1.05em; }

.choice { margin-top: 36px; border-top: 1px solid var(--line); padding-top: 24px; }
.choice-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.choice-head h2 { font-size: 15px; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
.link-btn:hover { color: var(--text); }

.styles { display: grid; gap: 8px; }
.style-opt {
  display: grid; grid-template-columns: 32px 1fr; align-items: center; gap: 2px 14px;
  width: 100%; text-align: left; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 12px 14px; cursor: pointer; transition: border-color .15s, background .15s;
}
.style-opt:hover { background: var(--surface); }
.style-opt .num {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  font-size: 14px; font-weight: 600; background: var(--surface); font-variant-numeric: tabular-nums;
  grid-row: span 2;
}
.style-opt .name { font-size: 15px; font-weight: 500; }
.style-opt .desc { grid-column: 2; font-size: 13px; color: var(--muted); line-height: 1.45; }
.style-opt[aria-checked=true] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.style-opt[aria-checked=true] .num { background: var(--accent); color: var(--accent-text); }

.scale { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 12px; color: var(--faint); }
.scale::before, .scale::after { content: none; }
.scale .bar { flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-strong), var(--s5)); }

.save-state { font-size: 13px; color: var(--faint); min-height: 20px; margin-top: 10px; }
.save-state.error { color: var(--danger); }

.nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 28px; }

.progress { margin-top: 44px; border-top: 1px solid var(--line); padding-top: 20px; }
.progress-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 10px; font-variant-numeric: tabular-nums; }
.cells { display: grid; grid-template-columns: repeat(15, 1fr); gap: 4px; }
@media (min-width: 640px) { .cells { grid-template-columns: repeat(30, 1fr); } }
.cell {
  aspect-ratio: 1; border: 0; padding: 0; border-radius: 4px; cursor: pointer;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong);
  font: inherit; font-size: 10px; color: var(--faint); font-variant-numeric: tabular-nums;
}
.cell.done { background: var(--text); box-shadow: none; color: transparent; }
.cell.current { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--focus); }
.cell:hover { color: var(--muted); }
.cell.done:hover { color: #fff; }

.finish-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-top: 16px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface);
  font-size: 14px;
}

.lead { font-size: 18px; line-height: 1.6; }
.intro-list { padding-left: 1.1em; margin: 0 0 24px; }
.intro-list li { margin-bottom: 8px; }
.style-table { border-top: 1px solid var(--line); margin: 8px 0 28px; }
.style-row { display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.style-row .n { font-weight: 600; font-variant-numeric: tabular-nums; }
.style-row .t { font-weight: 500; }
.style-row .d { font-size: 14px; color: var(--muted); }
.consent { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; margin: 28px 0 20px; cursor: pointer; }
.consent input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }

dialog {
  border: 0; border-radius: var(--radius-lg); padding: 28px; max-width: 460px; width: calc(100% - 32px);
  box-shadow: 0 24px 60px rgba(0,0,0,.18); color: var(--text);
}
dialog::backdrop { background: rgba(13,13,13,.28); }
dialog h2 { font-size: 20px; margin-bottom: 10px; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; flex-wrap: wrap; }
dialog.styles-dialog { max-width: 640px; max-height: 85vh; }

.done-screen { text-align: center; padding-top: 12vh; }
.done-mark { width: 48px; height: 48px; border-radius: 50%; background: var(--text); color: #fff; display: grid; place-items: center; margin: 0 auto 24px; font-size: 22px; }
.done-screen h1 { font-size: 28px; margin-bottom: 12px; }

.prose h1 { font-size: 28px; margin-bottom: 8px; }
.prose h2 { font-size: 17px; margin: 28px 0 8px; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: 6px; }

@media (max-width: 520px) {
  .hide-sm { display: none; }
  .page { padding-top: 28px; }
  .case-title { font-size: 23px; }
  .case-text { font-size: 16px; }
  .nav .btn { padding: 12px 16px; }
}

/* ── Админка ────────────────────────────────────────────── */
.admin-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.admin-head h1 { font-size: 24px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 28px; }
.chip { font-size: 13px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-strong); text-decoration: none; color: var(--muted); }
.chip:hover { color: var(--text); }
.chip.on { background: var(--text); color: #fff; border-color: var(--text); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.summary { display: grid; grid-template-columns: minmax(220px, 300px) minmax(320px, 600px); gap: 48px; margin-bottom: 36px; }
@media (max-width: 760px) { .summary { grid-template-columns: 1fr; gap: 24px; } }
.kpis { display: grid; grid-template-columns: repeat(2, auto); gap: 14px 28px; align-content: start; justify-content: start; }
.kpi .v { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .l { font-size: 12px; color: var(--muted); }
.dist-title { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.dist-row { display: grid; grid-template-columns: 250px 1fr 72px; align-items: center; gap: 12px; font-size: 13px; padding: 3px 0; }
.dist-row .bar { height: 10px; background: var(--surface); border-radius: 2px; overflow: hidden; }
.dist-row .bar i { display: block; height: 100%; }
.dist-row .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.dist-row .val b { color: var(--text); font-weight: 600; }
@media (max-width: 520px) { .dist-row { grid-template-columns: 1fr 1fr 64px; } }

.panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; max-width: 760px; }
details.panel > summary { cursor: pointer; font-weight: 500; list-style: none; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::before { content: "+ "; color: var(--muted); }
details.panel[open] > summary::before { content: "− "; }
details.panel[open] > summary { margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }

.table-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
table.data { border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.data th { font-weight: 500; color: var(--muted); text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
table.data tr:hover td { background: #fbfbfc; }
table.data th.c, table.data td.c { padding: 8px 0; width: 24px; min-width: 24px; text-align: center; }
table.data td.a { font-size: 12px; font-weight: 600; }
table.data .sep { border-left: 1px solid var(--line); }
table.data .name a { font-weight: 500; text-decoration: none; }
table.data .name a:hover { text-decoration: underline; }
table.data tfoot td { color: var(--muted); border-bottom: 0; }
.s1 { background: var(--s1); } .s2 { background: var(--s2); } .s3 { background: var(--s3); }
.s4 { background: var(--s4); color: #fff; } .s5 { background: var(--s5); color: #fff; }
.status { font-size: 12px; color: var(--muted); }
.status.finished { color: var(--text); font-weight: 500; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin: 12px 0; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 2px; display: inline-block; }
.copy.ok { color: var(--focus); border-color: var(--focus); }

.answers-list { border-top: 1px solid var(--line); }
.answers-list .row { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; align-items: center; }
.answers-list .badge { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.answers-list .badge i { width: 22px; height: 22px; border-radius: 4px; display: inline-grid; place-items: center; font-style: normal; font-weight: 600; font-size: 12px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; font-size: 14px; margin-bottom: 24px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.link-box { display: flex; gap: 8px; align-items: center; margin-bottom: 28px; max-width: 760px; }
.link-box input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: var(--surface); }
.danger-zone { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 36px; }
.danger-zone form { margin: 0; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; max-width: 1100px; }
@media (max-width: 860px) { .cols { grid-template-columns: 1fr; gap: 24px; } }
.section-title { font-size: 15px; margin: 0 0 12px; }
