/* «Самолечение от „как бы“»: статья, графики и счётчик. Токены — как у остальных штук. */
:root {
  --accent: #8fcbb5; --meh: #d9c38c; --bad: #e0836f; --line: #2b2e33; --text: #e7e7e4; --text-2: #b7b9b6; --muted: #8c8f8c;
  --surface: #1b1d20; --ground: #141517;
  /* серии графиков: тёмные шаги проверенной палитры (различимы при дальтонизме) */
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}
main { box-sizing: border-box; width: 100%; max-width: 760px; margin: 0 auto; padding: 56px 20px 64px; }
h1 { margin: 0 0 10px; font-size: clamp(30px, 6vw, 42px); line-height: 1.1; letter-spacing: -0.02em; }
.meta { margin: 0 0 18px; font: 400 13px/1.6 var(--mono); color: var(--muted); letter-spacing: 0.02em; }
.lead { margin: 0; color: var(--text-2); font-size: 18px; line-height: 1.55; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* ── Текст ── */
.prose > h2 { margin: 56px 0 0; padding-top: 24px; border-top: 1px solid var(--line); font-size: 26px; line-height: 1.2; letter-spacing: -0.01em; }
.prose > h3 { margin: 32px 0 0; font-size: 19px; line-height: 1.3; }
.prose > p, .prose > ul, .prose > ol, .prose > .tbl, .prose > figure, .prose > blockquote { margin: 1em 0 0; }
.prose p, .prose li { font-size: 17px; line-height: 1.65; }
.prose ul, .prose ol, .disc-body ul, .disc-body ol { padding-left: 1.3em; }
.prose li + li, .disc-body li + li { margin-top: 0.4em; }
.prose a, .disc-body a, .lead a { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.prose code, .disc-body code { font: 400 0.88em var(--mono); background: var(--surface); padding: 0.1em 0.35em; }
.prose strong { color: var(--text); font-weight: 600; }
.quote { margin: 1.2em 0 0; padding: 10px 16px; border-left: 2px solid var(--meh); background: var(--surface); }
.quote p { margin: 0; font-size: 16px; color: var(--text-2); font-style: italic; }
.note { font-size: 14px; color: var(--muted); }
.strength { display: inline-block; margin-left: 6px; padding: 1px 8px; border: 1px solid var(--line); font: 400 12px/1.6 var(--mono); color: var(--muted); white-space: nowrap; vertical-align: 1px; }
.short { margin-top: 1em; padding: 14px 18px; border-left: 2px solid var(--accent); background: var(--surface); }
.short p { margin: 0; }
.short p + p { margin-top: 0.6em; }

/* ── Таблицы ── */
.tbl { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.45; }
.tbl th, .tbl td { padding: 9px 16px 9px 0; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.tbl th:last-child, .tbl td:last-child { padding-right: 0; }
.tbl thead th { font: 400 12px/1.5 var(--mono); color: var(--muted); border-bottom-color: var(--muted); }
.tbl tbody th { font-weight: 400; color: var(--text-2); }
.tbl .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── Раскрывающийся блок (как в «Кого заденет блокировка адресов VPN») ── */
.disc { margin-top: 1.4em; border: 1px solid var(--line); }
.disc + .disc { margin-top: -1px; }
.disc > summary { display: grid; grid-template-columns: minmax(0, 1fr) 28px; column-gap: 16px; align-items: center; min-height: 56px; padding: 10px 12px 10px 16px; cursor: pointer; list-style: none; -webkit-tap-highlight-color: transparent; }
.disc > summary::-webkit-details-marker { display: none; }
.disc-label { grid-column: 1; font: 400 13px/1.5 var(--mono); color: var(--muted); }
.disc-title { grid-column: 1; font-size: 16px; font-weight: 500; line-height: 1.4; color: var(--text); }
.disc > summary::after { content: '+'; grid-column: 2; grid-row: 1 / span 2; width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--line); font: 400 16px/1 var(--mono); color: var(--text-2); }
.disc[open] > summary::after { content: '−'; }
.disc[open] { background: var(--surface); border-color: #3a3e44; position: relative; z-index: 1; }
.disc[open] > summary { border-bottom: 1px solid var(--line); }
.disc > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.disc-body { padding: 14px 16px 16px; color: var(--text-2); font-size: 16px; line-height: 1.6; }
.disc-body > * { margin: 0; }
.disc-body > * + * { margin-top: 0.8em; }
.disc-body p, .disc-body li { font-size: 16px; }
.disc-body .tbl { margin-left: -16px; margin-right: -16px; padding: 0 16px; }
@media (hover: hover) and (pointer: fine) {
  .disc > summary:hover::after { border-color: var(--muted); color: var(--text); }
  .disc:not([open]) > summary:hover { background: rgba(255, 255, 255, 0.02); }
}

/* ── Графики ── */
.fig { margin: 1.4em 0 0; }
/* На узком экране график не сжимается до нечитаемого — прокручивается внутри своей рамки. */
.fig-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.fig-scroll .chart { min-width: 520px; }
.chart { display: block; width: 100%; height: auto; }
.chart text { font: 12px system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; fill: var(--text-2); }
.chart .tick { fill: var(--muted); font: 11px var(--mono); }
.chart .tick.dim { fill: #5f6266; }
.chart .val { fill: var(--text); font-weight: 600; }
.chart .val.sm { font-size: 11px; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .base { stroke: var(--muted); stroke-width: 1.5; }
.chart .up { fill: var(--bad); }
.chart .down { fill: var(--accent); }
.chart .whisker { stroke: var(--bad); stroke-width: 2; }
.chart-ratio .ratio-band { fill: var(--surface); }
.chart-ratio .featured .lab { fill: var(--text); font-size: 16px; font-weight: 700; }
.chart-ratio .featured .val { fill: var(--bad); font-size: 14px; }
.chart-ratio .featured .whisker { stroke-width: 3; }
.chart-ratio g:not(.featured) path, .chart-ratio g:not(.featured) .whisker { opacity: 0.67; }
.chart path.s1 { fill: var(--s1); } .chart path.s2 { fill: var(--s2); }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.s1 { stroke: var(--s1); } .chart .line.s2 { stroke: var(--s2); } .chart .line.s3 { stroke: var(--s3); } .chart .line.s4 { stroke: var(--s4); }
.chart .dot { stroke: var(--ground); stroke-width: 2; }
.chart .dot.s1 { fill: var(--s1); } .chart .dot.s2 { fill: var(--s2); } .chart .dot.s3 { fill: var(--s3); } .chart .dot.s4 { fill: var(--s4); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 8px; font: 400 12px/1.6 var(--mono); color: var(--muted); }
.sw { display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: -1px; }
.sw.up { background: var(--bad); } .sw.down { background: var(--accent); }
.sw.s1 { background: var(--s1); } .sw.s2 { background: var(--s2); } .sw.s3 { background: var(--s3); } .sw.s4 { background: var(--s4); }
.fig figcaption { margin: 8px 0 0; font-size: 14px; line-height: 1.55; color: var(--muted); }

/* ── Счётчик ── */
.counter > summary { box-sizing: border-box; min-height: 44px; padding-block: 7px; }
.counter > summary::after { grid-row: 1; }
.counter-intro { margin: 0; font-size: 16px; line-height: 1.55; color: var(--text-2); }
.counter-field { position: relative; margin-top: 12px; }
.counter-field textarea, .counter-hl { scrollbar-gutter: stable; box-sizing: border-box; width: 100%; min-height: 168px; margin: 0; padding: 12px 14px; font: 400 16px/1.55 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; white-space: pre-wrap; overflow-wrap: break-word; border: 1px solid var(--line); }
.counter-field textarea { position: relative; z-index: 1; display: block; resize: vertical; color: var(--text); background: transparent; caret-color: var(--accent); }
.counter-field textarea:focus { outline: none; border-color: var(--accent); }
.counter-hl { position: absolute; inset: 0; overflow: hidden; color: transparent; background: var(--surface); pointer-events: none; }
.counter-hl mark { color: transparent; background: rgba(224, 131, 111, 0.32); border-radius: 2px; }
.counter-caption { margin: 8px 0 0; font: 400 13px/1.5 var(--mono); color: var(--muted); }
.counter-actions { display: flex; flex-wrap: wrap; gap: 8px 12px; margin: 14px 0 0; }
.btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; font: 500 15px/1 inherit; font-family: inherit; color: var(--ground); background: var(--accent); border: 0; cursor: pointer; }
.btn.ghost { color: var(--text-2); background: none; border: 1px solid var(--line); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.btn[hidden] { display: none; }
@media (hover: hover) and (pointer: fine) { .btn:hover { filter: brightness(1.08); } .btn.ghost:hover { border-color: var(--muted); color: var(--text); } }
.counter-res { margin: 18px 0 0; }
.counter-res .head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin: 0 0 8px; }
.counter-res .big { font-size: clamp(34px, 8vw, 48px); font-weight: 600; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.counter-res .big-cap { color: var(--text-2); font-size: 15px; }
.counter-res .more { color: var(--bad); }
.counter-res .less { color: var(--accent); }
.counter-warn { margin: 10px 0 0; padding: 8px 12px; border-left: 2px solid var(--meh); background: var(--surface); font-size: 14px; color: var(--text-2); }
.counter-foot { margin: 10px 0 0; font-size: 13px; line-height: 1.5; color: var(--muted); }

.share { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin: 40px 0 0; }
.toast { margin: 0; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.end-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 32px 0 0; padding: 20px 0 0; border-top: 1px solid var(--line); }
.end-nav a { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 6px 10px; border: 1px solid var(--line); color: var(--text-2); font-size: 15px; line-height: 1.25; text-align: center; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.end-nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) { .end-nav a:hover { border-color: var(--accent); color: var(--accent); } }
@media (max-width: 480px) {
  main { padding-top: 40px; }
  .prose p, .prose li { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
