/* ==================== TOKENS ==================== */
:root {
  --bg: #070b16;
  --bg-2: #0c1224;
  --surface: #0f1729;
  --surface-2: #131c33;
  --border: #1f2a44;
  --border-strong: #2a3756;
  --text: #e6edf6;
  --text-soft: #b6c2d4;
  --muted: #7c89a3;
  --primary: #06b6d4;
  --primary-soft: #22d3ee;
  --accent: #8b5cf6;
  --accent-soft: #a78bfa;
  --warn: #f59e0b;
  --ok: #10b981;
  --err: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 12px 36px -16px rgba(6, 182, 212, 0.18), 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-strong: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "PT Sans", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, "SF Mono", Consolas, monospace;
}

/* ==================== BASE ==================== */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: radial-gradient(1200px 600px at 20% -10%, rgba(6, 182, 212, 0.08), transparent 60%),
              radial-gradient(900px 500px at 110% 0%, rgba(139, 92, 246, 0.07), transparent 60%),
              var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; }
a { color: var(--primary-soft); text-decoration: none; transition: color .15s; }
a:hover { color: var(--primary); }
button { font-family: inherit; cursor: pointer; }

.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* ==================== HEADER ==================== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(7, 11, 22, 0.75);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; letter-spacing: .2px; }
.logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #070b16; border-radius: 8px; font-weight: 800; font-size: 18px;
}
.logo-text { font-size: 18px; }
.nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav a {
  color: var(--text-soft);
  padding: 8px 12px; border-radius: 8px; font-size: 14px; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }

/* ==================== HERO ==================== */
.hero { padding: 56px 0 64px; }
.hero-inner { display: grid; grid-template-columns: 1.4fr 1fr; gap: 48px; align-items: center; }
.eyebrow {
  display: inline-block;
  font-size: 12px; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--primary); font-weight: 600;
  padding: 4px 10px; border: 1px solid rgba(6, 182, 212, .35); border-radius: 999px;
  background: rgba(6, 182, 212, .07);
  margin: 0 0 18px;
}
.hero h1 {
  font-size: clamp(28px, 4.2vw, 48px);
  line-height: 1.12; margin: 0 0 16px; font-weight: 800; letter-spacing: -.5px;
}
.hero h1 .accent {
  background: linear-gradient(90deg, var(--primary-soft), var(--accent-soft));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lead { color: var(--text-soft); font-size: 17px; max-width: 56ch; margin: 0 0 28px; }
.lead em { color: var(--primary-soft); font-style: normal; font-weight: 600; }
.lead strong { color: var(--text); }

.hero-stats { display: flex; gap: 18px; flex-wrap: wrap; }
.stat {
  display: flex; flex-direction: column;
  padding: 14px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  min-width: 96px;
}
.stat-num { font-size: 24px; font-weight: 800; color: var(--text); font-family: var(--font-mono); }
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }

.hero-art {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.hero-art svg { display: block; margin: 0 auto; color: var(--primary-soft); }

/* ==================== SECTIONS ==================== */
.section { padding: 72px 0; }
.section-alt { background: linear-gradient(180deg, transparent, rgba(15, 23, 41, .6)); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-title { font-size: clamp(24px, 3.2vw, 34px); margin: 0 0 8px; font-weight: 800; letter-spacing: -.3px; }
.section-sub { color: var(--text-soft); margin: 0 0 32px; max-width: 70ch; }

/* ==================== EQUATION GRID ==================== */
.eq-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 32px;
}
@media (max-width: 720px) {
  .eq-grid { grid-template-columns: 1fr; }
}
.eq-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  position: relative;
  overflow: hidden;
}
.eq-card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: linear-gradient(180deg, var(--primary), var(--accent));
}
.eq-tag {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--primary-soft); font-weight: 700; margin-bottom: 8px;
}
.eq-card .katex { font-size: 1.05em; color: var(--text); }

.bc-block {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px 26px;
}
.bc-block h3 { margin: 0 0 12px; font-size: 16px; color: var(--text); }
.bc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bc-list li {
  display: grid; grid-template-columns: 220px 1fr; gap: 14px; align-items: center;
  padding: 8px 12px; background: rgba(255,255,255,0.02);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14.5px;
}
.bc-edge { color: var(--text); font-family: var(--font-mono); font-size: 13.5px; }
.bc-list .katex { color: var(--text); }

/* ==================== WORKFLOW BUTTONS ==================== */
.workflow {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.workflow-card {
  position: relative;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 24px;
  color: inherit;
  transition: transform .15s, border-color .15s, box-shadow .15s, background .15s;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 10px;
}
.workflow-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: var(--shadow);
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
}
.workflow-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.workflow-icon {
  font-size: 28px; font-weight: 800;
  width: 48px; height: 48px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #070b16; border-radius: 10px;
  font-family: var(--font-mono);
}
.workflow-card h3 { margin: 6px 0 2px; font-size: 22px; }
.workflow-desc { color: var(--text-soft); margin: 0; font-size: 14.5px; }
.workflow-mini {
  list-style: none; padding: 0; margin: 8px 0 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px;
  font-size: 13px; color: var(--text-soft);
}
.workflow-mini li::before { content: "▸"; color: var(--primary); margin-right: 6px; }
.workflow-cta {
  margin-top: 14px;
  display: inline-block; align-self: flex-start;
  color: var(--primary-soft); font-weight: 600; font-size: 14px;
}
.workflow-badge {
  position: absolute; top: 18px; right: 18px;
  font-size: 11px; padding: 3px 8px; border-radius: 999px;
  background: rgba(245, 158, 11, 0.12); color: var(--warn);
  border: 1px solid rgba(245, 158, 11, 0.3);
  font-weight: 600; letter-spacing: .4px;
}

/* ==================== METHODS GRID ==================== */
.methods-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.method-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 20px 18px;
  display: flex; flex-direction: column; gap: 8px;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.method-card:hover {
  transform: translateY(-2px); border-color: var(--border-strong);
  box-shadow: var(--shadow);
}
.method-card-head { display: flex; align-items: center; gap: 12px; }
.method-num-badge {
  width: 36px; height: 36px; flex: 0 0 36px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(6, 182, 212, .12); color: var(--primary-soft);
  border: 1px solid rgba(6, 182, 212, .3);
  border-radius: 8px; font-family: var(--font-mono); font-weight: 700;
}
.method-name { font-size: 17px; font-weight: 700; margin: 0; line-height: 1.25; }
.method-year { color: var(--muted); font-size: 12.5px; font-family: var(--font-mono); }
.method-tag { color: var(--text-soft); font-size: 14px; margin: 0 0 4px; }
.method-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.chip {
  font-size: 11.5px; padding: 3px 8px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-soft);
  font-family: var(--font-mono);
}
.chip-accent { color: var(--accent-soft); border-color: rgba(139,92,246,.35); background: rgba(139,92,246,.08); }
.method-open {
  margin-top: 8px; align-self: flex-start;
  background: transparent; color: var(--primary-soft);
  border: 1px solid rgba(6,182,212,.4); border-radius: 8px;
  padding: 6px 12px; font-size: 13px; font-weight: 600;
  transition: background .15s, color .15s;
}
.method-open:hover { background: rgba(6,182,212,.12); color: var(--primary); }

/* ==================== MODAL ==================== */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(3, 6, 16, 0.7);
  backdrop-filter: blur(6px);
}
.modal-panel {
  position: relative;
  max-width: 560px; width: 100%;
  max-height: 90vh; overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 32px 28px 28px;
  box-shadow: var(--shadow-strong);
}
.modal-panel-wide { max-width: 820px; }
.modal-close {
  position: absolute; top: 12px; right: 12px;
  width: 36px; height: 36px;
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 22px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-stage-icon {
  width: 56px; height: 56px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #070b16; border-radius: 12px;
  font-size: 28px; font-weight: 800; font-family: var(--font-mono);
  margin-bottom: 14px;
}
.modal-panel h2 { margin: 0 0 6px; font-size: 24px; }
.modal-lead { color: var(--text-soft); margin: 0 0 18px; }
.modal-body { color: var(--text-soft); font-size: 15px; }
.modal-body p { margin: 0 0 12px; }
.modal-body h3 { color: var(--text); margin: 18px 0 8px; font-size: 16px; }
.modal-body ul { margin: 0 0 12px; padding-left: 20px; }
.modal-body li { margin-bottom: 4px; }
.modal-stub {
  margin-top: 18px;
  padding: 14px 16px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: 14px;
}
.modal-stub strong { color: var(--warn); display: block; margin-bottom: 4px; }
.modal-stub p { margin: 0; }

/* method modal specifics */
.method-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.method-num {
  width: 56px; height: 56px; flex: 0 0 56px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #070b16; border-radius: 12px;
  font-size: 24px; font-weight: 800; font-family: var(--font-mono);
}
.method-tag { color: var(--text-soft); margin: 4px 0 0; font-size: 14.5px; }

.section-h {
  margin: 18px 0 8px; font-size: 14px; color: var(--primary-soft);
  text-transform: uppercase; letter-spacing: 1.2px; font-weight: 700;
}
.pseudocode {
  background: #050913;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.65;
  color: #c8d2e2;
  white-space: pre;
  overflow-x: auto;
}
.pseudocode .kw { color: #f0a4ff; }
.pseudocode .cm { color: #5e6b85; font-style: italic; }
.pseudocode .nm { color: #fcd34d; }

.proscons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.proscons > div {
  padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2);
}
.proscons h4 { margin: 0 0 6px; font-size: 14px; }
.proscons .pros h4 { color: var(--ok); }
.proscons .cons h4 { color: var(--err); }
.proscons ul { margin: 0; padding-left: 18px; font-size: 13.5px; }

/* ==================== BENCHMARK ==================== */
.re-tabs { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 4px; gap: 4px; margin-bottom: 18px; }
.re-tab {
  background: transparent; color: var(--text-soft);
  border: none; padding: 8px 16px; border-radius: 8px;
  font-size: 14px; font-weight: 600;
  transition: background .15s, color .15s;
}
.re-tab.active { background: var(--primary); color: #070b16; }
.re-tab:not(.active):hover { background: var(--surface); color: var(--text); }

.charts-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
}
.chart-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  display: flex; flex-direction: column;
}
.chart-wrap h3 { margin: 0 0 10px; font-size: 15px; color: var(--text); }
.chart-wrap canvas { max-height: 320px !important; width: 100% !important; height: 320px !important; }

.ref-data {
  margin-top: 18px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 18px;
}
.ref-data summary {
  cursor: pointer; font-weight: 600; color: var(--primary-soft);
  padding: 4px 0;
}
.ref-tables {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px; margin-top: 14px;
}
.ref-table-block h4 { margin: 0 0 8px; font-size: 14px; color: var(--text); }
.ref-table-block table { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 12.5px; }
.ref-table-block th, .ref-table-block td {
  text-align: right; padding: 4px 8px; border-bottom: 1px solid var(--border);
}
.ref-table-block th { color: var(--muted); font-weight: 600; }

/* ==================== COMPARE TABLE ==================== */
.table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: auto;
}
.compare-table { width: 100%; border-collapse: collapse; min-width: 760px; table-layout: auto; }
.compare-table th, .compare-table td {
  text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border);
  font-size: 13.5px; vertical-align: top;
  overflow-wrap: anywhere; word-break: normal;
}
.compare-table th {
  background: var(--surface-2);
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--muted); font-weight: 700;
  position: sticky; top: 0;
}
.compare-table tr:hover td { background: rgba(6, 182, 212, 0.04); }
.compare-table td:first-child { color: var(--primary-soft); font-family: var(--font-mono); font-weight: 700; width: 36px; }
.compare-table td:nth-child(2) { font-weight: 600; color: var(--text); white-space: nowrap; }
.compare-table td:nth-child(3) { color: var(--muted); font-family: var(--font-mono); width: 60px; }
.compare-table td:nth-child(4) { font-size: 12.5px; color: var(--text-soft); }
.compare-table td:nth-child(5), .compare-table td:nth-child(6) { width: 90px; }
.compare-table td:nth-child(7) { width: 110px; font-size: 12.5px; color: var(--text-soft); }
.compare-table td:nth-child(8) { font-size: 12.5px; }
.compare-table .stars { color: var(--warn); letter-spacing: 1px; font-family: var(--font-mono); }

/* ==================== WORKSPACE (full-screen) ==================== */
.workspace {
  position: fixed; inset: 0; z-index: 200;
  background: var(--bg);
  display: flex; flex-direction: column;
  animation: ws-fade .15s ease-out;
}
.workspace[hidden] { display: none; }
@keyframes ws-fade { from { opacity: 0; } to { opacity: 1; } }

.ws-header {
  display: flex; align-items: center; gap: 24px;
  padding: 12px 22px;
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.ws-title-block { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.ws-title-block h2 { margin: 0; font-size: 17px; line-height: 1.1; }
.ws-sub { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.ws-tabs { display: flex; gap: 4px; flex: 1; }
.ws-tab {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: transparent; color: var(--text-soft);
  border: 1px solid transparent; border-radius: 10px;
  font-size: 14px; font-weight: 600;
  transition: background .15s, color .15s, border-color .15s;
}
.ws-tab:hover { background: var(--surface-2); color: var(--text); }
.ws-tab.active { background: var(--surface); color: var(--primary-soft); border-color: var(--border-strong); }
.ws-tab-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  background: rgba(6, 182, 212, 0.12); color: var(--primary-soft);
  border-radius: 6px; font-family: var(--font-mono); font-size: 12px;
}
.ws-tab.active .ws-tab-num { background: var(--primary); color: #070b16; }
.ws-close {
  width: 36px; height: 36px;
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 20px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.ws-close:hover { background: var(--surface-2); color: var(--text); }

.ws-body { flex: 1 1 auto; overflow: auto; padding: 24px; }
.ws-pane { display: none; }
.ws-pane.active { display: block; }
.ws-pane-title { margin: 0 0 14px; font-size: 16px; color: var(--text); }

.ws-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 22px;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--muted);
  flex: 0 0 auto;
}
.ws-status { display: flex; align-items: center; gap: 8px; }
.ws-meta { font-family: var(--font-mono); }

/* ——— ПРЕПРОЦЕССОР ——— */
.pre-grid {
  display: grid; gap: 20px;
  grid-template-columns: minmax(320px, 1fr) minmax(360px, 1.2fr);
  align-items: start;
}
.pre-form, .pre-preview {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.pre-form fieldset { border: 0; padding: 0; margin: 0 0 18px; }
.pre-form legend {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--primary-soft); font-weight: 700;
  padding: 0; margin-bottom: 8px;
}
.field { display: block; margin-bottom: 10px; }
.field-label { display: block; font-size: 12.5px; color: var(--text-soft); margin-bottom: 6px; font-weight: 500; }
.field-label em { color: var(--primary-soft); font-style: italic; }
.field-row { display: flex; gap: 10px; align-items: center; }
.field-half { flex: 1 1 0; }
.field-hint { margin: 6px 0 0; color: var(--muted); font-size: 12px; }

input[type="range"] { flex: 1; accent-color: var(--primary); }
input.num, select {
  width: 100%;
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 10px; font-family: var(--font-mono); font-size: 13px;
}
input.num { width: 80px; }
select { font-family: var(--font-sans); }
input.num:focus, select:focus { outline: none; border-color: var(--primary); }

.re-presets { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chip-btn {
  background: var(--bg-2); color: var(--text-soft);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 4px 10px; font-size: 12px; font-family: var(--font-mono);
  cursor: pointer; transition: all .15s;
}
.chip-btn:hover { background: var(--surface-2); color: var(--text); }
.chip-btn.active { background: var(--primary); color: #070b16; border-color: var(--primary); }

.method-hint {
  margin-top: 8px; padding: 10px 12px;
  background: rgba(6, 182, 212, 0.06);
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-radius: 6px;
  color: var(--text-soft); font-size: 12.5px; line-height: 1.4;
}

.pre-actions { display: flex; gap: 10px; margin-top: 16px; }

.btn-primary, .btn-secondary, .btn-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 8px;
  font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .15s;
  border: 1px solid transparent;
}
.btn-primary { background: var(--primary); color: #070b16; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-soft); }
.btn-primary:disabled { background: var(--surface-2); color: var(--muted); border-color: var(--border); cursor: not-allowed; }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-secondary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--text-soft); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.pre-preview { display: flex; flex-direction: column; gap: 14px; }
.mesh-wrap {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px;
  display: flex; align-items: center; justify-content: center;
}
.mesh-wrap canvas { display: block; max-width: 100%; height: auto; }
.pre-info {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 18px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 14px;
  font-size: 13px;
}
.pre-info > div { display: flex; justify-content: space-between; gap: 8px; }
.pre-info .lbl { color: var(--muted); }
.pre-info .val { color: var(--text); font-family: var(--font-mono); }
.pre-tip {
  background: rgba(139, 92, 246, 0.06);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 8px; padding: 10px 12px;
  font-size: 12.5px; color: var(--text-soft); line-height: 1.5;
}
.pre-tip strong { color: var(--accent-soft); }

/* ——— ПРОЦЕССОР ——— */
.cpu-grid {
  display: grid; gap: 20px;
  grid-template-columns: minmax(360px, 1.1fr) minmax(320px, 1fr);
  align-items: start;
}
.cpu-controls, .cpu-log {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.cpu-status {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; color: var(--text-soft);
  margin-bottom: 14px;
}
.cpu-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 0 var(--muted);
}
.cpu-dot.running { background: var(--primary); animation: pulse 1.2s infinite; }
.cpu-dot.paused  { background: var(--warn); }
.cpu-dot.done    { background: var(--ok); }
.cpu-dot.error   { background: var(--err); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(6,182,212,0.6); } 100% { box-shadow: 0 0 0 12px rgba(6,182,212,0); } }

.cpu-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }

.cpu-progress-block { margin-bottom: 10px; }
.cpu-progress-label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; color: var(--text-soft); margin-bottom: 6px;
}
.cpu-progress-label span:last-child { font-family: var(--font-mono); color: var(--primary-soft); }
.cpu-progress {
  height: 8px; background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 4px; overflow: hidden;
  margin-bottom: 14px;
}
.cpu-progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width .2s ease-out;
}
.cpu-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.cpu-stats > div {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 10px;
}
.cpu-stats .lbl { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; }
.cpu-stats .val { display: block; font-size: 14px; color: var(--text); margin-top: 4px; }
.mono { font-family: var(--font-mono); }

.res-chart-wrap {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px;
}
.res-chart-wrap canvas { display: block; max-width: 100%; }

.cpu-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

.log-window {
  background: #050913; border: 1px solid var(--border);
  border-radius: 8px; padding: 12px;
  font-family: var(--font-mono); font-size: 12.5px;
  line-height: 1.6; color: var(--text-soft);
  height: 380px; overflow: auto; resize: vertical;
}
.log-line { display: flex; gap: 10px; padding: 2px 0; }
.log-time { color: var(--muted); }
.log-kind-info { color: var(--text-soft); }
.log-kind-warn { color: var(--warn); }
.log-kind-err  { color: var(--err); }
.log-kind-ok   { color: var(--ok); }

/* ——— ПОСТПРОЦЕССОР ——— */
.post-empty {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 60px 20px;
  text-align: center; color: var(--text-soft);
}
.post-empty p { margin: 0 0 18px; font-size: 16px; }

.post-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.post-toolbar h3 { margin: 0; }
.post-toggles { display: flex; gap: 14px; flex-wrap: wrap; }
.post-toggles label { display: flex; align-items: center; gap: 6px; color: var(--text-soft); font-size: 13px; cursor: pointer; }
.post-toggles input { accent-color: var(--primary); }

.post-grid {
  display: grid; gap: 20px;
  grid-template-columns: minmax(360px, 1fr) minmax(360px, 1.1fr);
  align-items: start;
}
.post-viz, .post-profiles {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.post-viz { position: relative; }
.post-viz canvas { display: block; max-width: 100%; height: auto; border-radius: 6px; }
.post-legend {
  position: absolute; bottom: 24px; left: 24px;
  background: rgba(7, 11, 22, 0.8);
  border: 1px solid var(--border);
  padding: 4px 10px;
  font-size: 11.5px; color: var(--text-soft);
  border-radius: 4px; font-family: var(--font-mono);
}
.post-profiles h4 { margin: 0 0 8px; font-size: 14px; color: var(--text-soft); }
.post-profiles canvas { display: block; max-width: 100%; margin-bottom: 14px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px; padding: 4px; }

.post-metrics {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-top: 20px;
}
.metric-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 14px;
}
.metric-card .lbl { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); }
.metric-card .val { display: block; font-size: 22px; font-family: var(--font-mono); color: var(--text); margin-top: 4px; }
.metric-card.ok  .val { color: var(--ok); }
.metric-card.warn .val { color: var(--warn); }
.metric-card.err  .val { color: var(--err); }
.metric-card .sub { display: block; font-size: 11.5px; color: var(--muted); margin-top: 4px; }

/* ——— RESPONSIVE для воркспейса ——— */
@media (max-width: 980px) {
  .pre-grid, .cpu-grid, .post-grid { grid-template-columns: 1fr; }
  .ws-header { flex-wrap: wrap; gap: 12px; }
  .ws-title-block { min-width: 0; }
}
@media (max-width: 640px) {
  .field-row { flex-direction: column; align-items: stretch; }
  .ws-body { padding: 14px; }
  .log-window { height: 220px; }
}

/* ==================== FOOTER ==================== */
.site-footer {
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  padding: 18px 0;
  margin-top: 32px;
}
.footer-credit {
  margin: 0;
  text-align: left;
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: .2px;
}


/* ==================== RESPONSIVE ==================== */
@media (max-width: 880px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-art { max-width: 360px; margin: 0 auto; }
  .charts-grid { grid-template-columns: 1fr; }
  .proscons { grid-template-columns: 1fr; }
  .nav { display: none; }
  .bc-list li { grid-template-columns: 1fr; gap: 4px; }
  .footer-credit { text-align: left; }
}
@media (max-width: 520px) {
  .section { padding: 48px 0; }
  .hero { padding: 32px 0; }
  .modal-panel { padding: 24px 18px; }
}
