/* Палитра снята с самой Марьи: чёрный корсет, багрянец юбки, золото канта.
   Фон бумажный: персонаж почти весь тёмный, на тёмном фоне он бы пропал. */
:root {
  --paper:   #F4F1EA;
  --paper-2: #EBE6DC;
  --ink:     #17161A;
  --ink-2:   #4A4640;
  --muted:   #7C766D;
  --rule:    #D8D1C4;
  --crimson: #9B1B30;
  --gold:    #B0872F;
  --stage:   #201E22;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "IBM Plex Serif", Georgia, "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.62;
  text-rendering: optimizeLegibility;
}

.mono, .mono * {
  font-family: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.9em;
  letter-spacing: -0.01em;
}

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 28px;
}

b { font-weight: 600; }

/* ── шапка ─────────────────────────────────────────────────────────── */

.masthead {
  padding: 68px 0 44px;
  border-bottom: 1px solid var(--rule);
  background:
    radial-gradient(120% 90% at 82% -10%, rgba(155,27,48,.07), transparent 60%),
    var(--paper);
}

.kicker {
  margin: 0 0 22px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

h1 {
  margin: 0 0 26px;
  font-size: clamp(42px, 7vw, 78px);
  line-height: 1.02;
  font-weight: 600;
  letter-spacing: -0.025em;
}

h1::after {
  content: "";
  display: block;
  width: 84px;
  height: 3px;
  margin-top: 26px;
  background: var(--crimson);
}

.lead {
  max-width: 62ch;
  margin: 0;
  font-size: 19px;
  color: var(--ink-2);
}

/* ── сцена ─────────────────────────────────────────────────────────── */

.stage-section { padding: 44px 0 8px; }

.stage-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

.stage {
  margin: 0;
  position: relative;
  background:
    linear-gradient(180deg, #2A272C 0%, var(--stage) 58%, #171519 100%);
  border-radius: 3px;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(0,0,0,.18), 0 24px 48px -28px rgba(23,22,26,.55);
}

/* Пол под персонажем: одна мягкая тень, чтобы ходьба читалась как ходьба. */
.stage::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 11%;
  width: 46%;
  height: 26px;
  transform: translateX(-50%);
  background: radial-gradient(50% 50% at 50% 50%, rgba(0,0,0,.5), transparent 70%);
  pointer-events: none;
}

#stage {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  position: relative;
  z-index: 1;
}

.stage-status {
  position: absolute;
  z-index: 2;
  left: 0; right: 0; bottom: 0;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11.5px;
  letter-spacing: .02em;
  color: rgba(244,241,234,.62);
  background: linear-gradient(0deg, rgba(0,0,0,.42), transparent);
}

.stage-status .dot { opacity: .4; }
#status[data-state="ok"]   { color: #8FCF9B; }
#status[data-state="fail"] { color: #E8798C; }

/* ── пульт ─────────────────────────────────────────────────────────── */

.deck { padding-top: 2px; }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.tab {
  font: inherit;
  font-size: 14px;
  padding: 7px 14px;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 2px;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}

.tab:hover { background: var(--paper-2); }

.tab.is-on {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.tab-note {
  min-height: 4.6em;
  margin: 0 0 22px;
  font-size: 15.5px;
  color: var(--ink-2);
  border-left: 2px solid var(--gold);
  padding-left: 14px;
}

.transport {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.btn-play {
  flex: none;
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 0;
}

.btn-play:hover { background: var(--crimson); border-color: var(--crimson); }
.btn-play .glyph { transform: translateY(0); }

.scrub {
  flex: 1 1 auto;
  min-width: 60px;
  appearance: none;
  height: 3px;
  background: var(--rule);
  border-radius: 2px;
  outline-offset: 6px;
}

.scrub::-webkit-slider-thumb {
  appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--crimson);
  cursor: pointer;
}

.scrub::-moz-range-thumb {
  width: 14px; height: 14px;
  border: none;
  border-radius: 50%;
  background: var(--crimson);
  cursor: pointer;
}

.speeds { display: flex; gap: 4px; flex: none; }

.chip {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  padding: 5px 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 2px;
  cursor: pointer;
}

.chip:hover { color: var(--ink); }
.chip.is-on { color: var(--crimson); border-color: var(--rule); background: var(--paper-2); }

.readout {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px 12px;
  margin: 18px 0 20px;
}

.readout dt {
  font-size: 10.5px;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--muted);
}

.readout dd {
  margin: 2px 0 0;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.fineprint {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
}

/* ── плитки чисел ──────────────────────────────────────────────────── */

.tiles-section { padding: 40px 0 12px; }

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}

.tile {
  background: var(--paper);
  padding: 20px 18px 18px;
}

.tile .v {
  font-family: "IBM Plex Mono", monospace;
  font-size: clamp(18px, 1.6vw, 22px);
  white-space: nowrap;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.tile .v .u { font-size: 13px; color: var(--muted); letter-spacing: 0; }
.tile.accent .v { color: var(--crimson); }

.tile .k {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

/* ── проза ─────────────────────────────────────────────────────────── */

.prose-section { padding: 62px 0; border-top: 1px solid var(--rule); margin-top: 44px; }
.prose-section:first-of-type { margin-top: 0; }

h2 {
  margin: 0 0 14px;
  font-size: clamp(28px, 3.4vw, 38px);
  line-height: 1.12;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.section-lead {
  max-width: 66ch;
  margin: 0 0 38px;
  color: var(--ink-2);
}

.steps {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px 44px;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding-top: 30px;
  border-top: 1px solid var(--rule);
}

.steps li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  top: 8px;
  left: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--crimson);
  letter-spacing: .08em;
}

.steps h3 {
  margin: 0 0 8px;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.steps p { margin: 0; font-size: 15.5px; color: var(--ink-2); }

/* ── таблицы ───────────────────────────────────────────────────────── */

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 15px;
}

th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 16px 10px 0;
  border-bottom: 1px solid var(--ink);
}

td {
  padding: 11px 16px 11px 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

td:first-child { width: 34%; }

.numbers td:nth-child(2) {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.numbers td:last-child,
.proof-table td:last-child {
  color: var(--muted);
  font-size: 14px;
}

.numbers tr.hi td:nth-child(2) { color: var(--crimson); }

.proof-table td:nth-child(2) { color: var(--ink-2); }

/* ── опровергнутое ─────────────────────────────────────────────────── */

.wrong details {
  border-top: 1px solid var(--rule);
  padding: 0;
}

.wrong details:last-of-type { border-bottom: 1px solid var(--rule); }

.wrong summary {
  cursor: pointer;
  list-style: none;
  padding: 18px 34px 18px 0;
  position: relative;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.wrong summary::-webkit-details-marker { display: none; }

.wrong summary::after {
  content: "+";
  position: absolute;
  right: 4px;
  top: 16px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 20px;
  color: var(--crimson);
}

.wrong details[open] summary::after { content: "–"; }
.wrong summary:hover { color: var(--crimson); }

.wrong details p {
  margin: 0 0 22px;
  max-width: 74ch;
  color: var(--ink-2);
  font-size: 16px;
}

/* ── вердикт ───────────────────────────────────────────────────────── */

.verdict-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 34px;
  margin-bottom: 36px;
}

.verdict-grid h3 {
  margin: 0 0 14px;
  font-size: 13px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.verdict-grid ul { margin: 0; padding-left: 20px; }
.verdict-grid li { margin-bottom: 9px; color: var(--ink-2); font-size: 16px; }
.verdict-yes li::marker { color: var(--gold); }
.verdict-no  li::marker { color: var(--crimson); }

.verdict-bottom {
  max-width: 74ch;
  margin: 0;
  padding-top: 28px;
  border-top: 1px solid var(--rule);
  font-size: 17.5px;
}

/* ── подвал ────────────────────────────────────────────────────────── */

.foot {
  margin-top: 56px;
  padding: 34px 0 60px;
  border-top: 1px solid var(--ink);
  background: var(--paper-2);
}

.foot-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 24px 48px;
  justify-content: space-between;
  align-items: flex-start;
}

.foot-line { margin: 0 0 6px; color: var(--ink-2); }
.foot-note { margin: 0; max-width: 46ch; font-size: 14px; color: var(--muted); }

/* ── узкий экран ───────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .stage-grid { grid-template-columns: 1fr; gap: 26px; }
  .tab-note { min-height: 0; }
  .masthead { padding: 46px 0 32px; }
  .prose-section { padding: 46px 0; margin-top: 30px; }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  .wrap { padding: 0 18px; }
  .readout { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}

/* ── витрина заготовок походки ─────────────────────────────────────── */

.gaits {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}

.gait-card {
  background: var(--paper);
  display: flex;
  flex-direction: column;
}

.gait-canvas {
  display: block;
  width: 100%;
  height: 340px;
  background:
    linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%);
}

.gait-body { padding: 18px 18px 22px; border-top: 1px solid var(--rule); }

.gait-body h3 {
  margin: 0 0 12px;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.gait-nums {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 10px;
  margin: 0 0 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}

.gait-nums dt {
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.gait-nums dd { margin: 1px 0 0; font-size: 14px; font-variant-numeric: tabular-nums; }

.gait-note { margin: 0 0 10px; font-size: 14.5px; color: var(--ink-2); line-height: 1.5; }
.gait-source { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.45; }

.foot-grid a { color: var(--crimson); text-decoration: none; }
.foot-grid a:hover { text-decoration: underline; }

/* ── библиотека движений ───────────────────────────────────────────── */

.lib-head { margin: 38px 0 20px; }
.lib-head:first-child { margin-top: 0; }
.lib-head h2 { margin-bottom: 10px; }
.lib-head .section-lead { margin-bottom: 0; }

.flag {
  display: inline-block;
  vertical-align: middle;
  margin-left: 6px;
  padding: 2px 7px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  letter-spacing: .02em;
  border-radius: 2px;
  border: 1px solid var(--rule);
  color: var(--muted);
  font-weight: 400;
}

.flag.ok   { color: #2F6B3A; border-color: #B9CDBD; background: #EDF3EE; }
.flag.warn { color: #8A5A12; border-color: #DCC79C; background: #F6EFE2; }
.flag.bad  { color: var(--crimson); border-color: #DFB6BE; background: #F7EAEC; }
