:root {
  --bg: #fbfaf7; --fg: #1d1d1b; --muted: #6b6a66; --line: #e3e0d8; --accent: #1f5f8b;
  --warn-bg: #fff4d6; --warn-fg: #6a4b00; --head: #f1eee6;
  --pos: #1e6b3a; --neg: #a12a2a;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161615; --fg: #e9e7e2; --muted: #a09e98; --line: #33322f; --accent: #7db7e0;
    --warn-bg: #3a3017; --warn-fg: #f2d68a; --head: #22211f; --pos: #7fcf9a; --neg: #f08a8a;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); line-height: 1.5; }
a { color: var(--accent); }
main { max-width: 1400px; margin: 0 auto; padding: 0 16px 32px; }
.top { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: baseline; padding: 12px 16px;
  border-bottom: 1px solid var(--line); }
.top .brand { font-weight: 700; font-size: 1.2rem; text-decoration: none; color: var(--fg); }
.top nav { display: flex; gap: 16px; flex: 1; }
.top nav a { text-decoration: none; }
.disclaimer { margin: 0; padding: 8px 16px; background: var(--warn-bg); color: var(--warn-fg); font-size: .9rem; }
footer { border-top: 1px solid var(--line); padding: 12px 16px; color: var(--muted); font-size: .85rem; }
h1 { margin: 24px 0 8px; }
.lead { color: var(--muted); max-width: 60em; }
#sort-basis { font-size: .9rem; }
.market-switch { display: flex; gap: 8px; margin: 16px 0; }
.market-switch a { padding: 6px 14px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; }
.market-switch a[aria-pressed="true"] { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.js .market h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; }
table.rating { border-collapse: collapse; font-size: .9rem; min-width: 100%; }
.rating th, .rating td { padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.rating thead th { background: var(--head); text-align: center; font-weight: 600; position: sticky; top: 0; }
.rating th.win { border-left: 2px solid var(--line); }
.rating th small { display: block; font-weight: 400; color: var(--muted); font-size: .75rem; }
.rating th button { all: unset; cursor: pointer; }
.rating th button:focus-visible { outline: 2px solid var(--accent); }
.rating th[aria-sort="descending"] button::after { content: " ↓"; }
.rating th[aria-sort="ascending"] button::after { content: " ↑"; }
.rating td.num { text-align: right; font-variant-numeric: tabular-nums; }
.rating td.empty { color: var(--muted); font-style: italic; }
.rating td.name, .rating th.name { text-align: left; position: sticky; left: 0; background: var(--bg); }
.rating thead th.name { background: var(--head); z-index: 1; }
.more summary { font-size: .75rem; color: var(--muted); cursor: pointer; }
.more dl { margin: 4px 0; font-size: .8rem; white-space: normal; min-width: 16em; }
.more dt { font-weight: 600; }
.more dd { margin: 0 0 4px; display: flex; flex-direction: column; }
.root main { max-width: 32em; padding-top: 10vh; text-align: center; }
.root .langs a { margin: 0 12px; font-size: 1.2rem; }

/* Карточка стратегии */
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.strategy-head h1 { margin-bottom: 4px; }
.strategy-head .meta { color: var(--muted); margin: 0 0 8px; }
.badge { display: inline-block; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: .85rem; }
code.sha { font-size: .85em; background: var(--head); padding: 0 4px; border-radius: 3px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 20px 0 12px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 8px 12px; text-decoration: none; border-radius: 6px 6px 0 0; }
.tabs a[aria-current="page"] { background: var(--head); color: var(--fg); font-weight: 600; }
.market-block { margin: 16px 0 32px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 12px 0; }
.stats > div { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
.stats dt { font-size: .8rem; color: var(--muted); }
.stats dd { margin: 0; font-size: 1.3rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.stats.small dd { font-size: 1rem; }
.checks { padding: 6px 10px; border-radius: 6px; font-size: .9rem; }
.checks.good { background: color-mix(in srgb, var(--pos) 12%, transparent); }
.checks.bad { background: color-mix(in srgb, var(--neg) 18%, transparent); }
.checks.unknown { background: var(--head); }
figure { margin: 16px 0; }
figcaption { font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
svg.chart { width: 100%; height: 180px; display: block; border: 1px solid var(--line); border-radius: 6px; }
svg.chart .line { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
svg.chart .area { fill: color-mix(in srgb, var(--accent) 12%, transparent); stroke: none; }
svg.chart .zero { stroke: var(--line); vector-effect: non-scaling-stroke; }
svg.drawdown .line { stroke: var(--neg); }
svg.drawdown .area { fill: color-mix(in srgb, var(--neg) 15%, transparent); }
table.monthly, table.runs, table.exits, table.regimes, table.long, table.protections, table.versions, table.kv, table.trades {
  border-collapse: collapse; font-size: .9rem; }
table.monthly th, table.monthly td, table.runs th, table.runs td, table.exits th, table.exits td, table.regimes th,
table.regimes td, table.long th, table.long td, table.protections th, table.protections td, table.versions th,
table.versions td, table.kv th, table.kv td, table.trades th, table.trades td {
  padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.kv th { font-weight: 500; color: var(--muted); }
table.kv td { white-space: normal; }
tr.old { color: var(--muted); }
.unknowns { border-left: 3px solid var(--warn-fg); padding: 4px 16px; background: var(--warn-bg); border-radius: 0 6px 6px 0; }
.scheme { border: 1px solid var(--line); border-radius: 6px; padding: 8px 14px; margin: 10px 0; }
.scheme h3 { margin: 4px 0; }
.conditions { margin: 6px 0; }
.note { color: var(--muted); font-size: .85rem; }
.filters { display: flex; gap: 8px; margin: 8px 0; }
.filters input, .filters select, .code-tools input { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg); color: var(--fg); }
.code-tools { display: flex; gap: 12px; align-items: center; margin: 8px 0; }
pre.code { font: 12.5px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; overflow-x: auto; border: 1px solid var(--line);
  border-radius: 6px; padding: 8px 0; tab-size: 4; }
pre.code .ln { display: inline-block; width: 6ch; padding-right: 1.5ch; margin-right: 1ch; text-align: right;
  color: var(--muted); border-right: 1px solid var(--line); user-select: none; }
pre.code .ln.hit { background: var(--warn-bg); color: var(--warn-fg); }
.checks.warn { background: var(--warn-bg); color: var(--warn-fg); }
.recheck-table { border-collapse: collapse; font-size: .85rem; }
.recheck-table th, .recheck-table td { padding: 4px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.recheck-table tr.v-confirmed td { color: var(--neg); font-weight: 600; }
.recheck-table tr.v-absent td { color: var(--muted); }
.toc { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0 16px; font-size: .9rem; }
section { margin: 20px 0; }
table.pairs { border-collapse: collapse; font-size: .85rem; margin: 6px 0; }
table.pairs td, table.pairs th { padding: 2px 10px; border-bottom: 1px solid var(--line); text-align: left; }
