/* ==========================================================================
   madarch-labs — terminal / hacker aesthetic
   ========================================================================== */

:root,
:root[data-theme="dark"] {
  --bg: #0a0e14;
  --bg-2: #0d121a;
  --panel: #111821;
  --panel-2: #16202b;
  --border: #1e2a38;
  --border-strong: #2b3b4f;
  --text: #c9d4e0;
  --text-strong: #eef3f8;
  --muted: #6f8399;
  --accent: #39ff9f;      /* phosphor green */
  --accent-dim: #1f8f5c;
  --amber: #ffb86b;
  --blue: #7aa2ff;
  --mad: #ff4fd8;         /* the "mad" magenta */
  --bad: #ff5f6d;
  --ok: #39ff9f;
  --code-bg: #0b1017;
  --glow: 0 0 0 1px rgba(57, 255, 159, .35), 0 0 24px rgba(57, 255, 159, .08);
  --grid-line: rgba(122, 162, 255, .04);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f4f3ee;
  --bg-2: #eceae2;
  --panel: #ffffff;
  --panel-2: #f6f5f0;
  --border: #dcd9cf;
  --border-strong: #c3bfb2;
  --text: #2a3138;
  --text-strong: #0f1419;
  --muted: #6c757d;
  --accent: #087f4f;
  --accent-dim: #0a9c62;
  --amber: #a85d00;
  --blue: #2851c7;
  --mad: #b0179a;
  --bad: #c62a37;
  --ok: #087f4f;
  --code-bg: #f1efe8;
  --glow: 0 0 0 1px rgba(8, 127, 79, .35), 0 6px 18px rgba(0, 0, 0, .06);
  --grid-line: rgba(0, 0, 0, .035);
  color-scheme: light;
}

:root {
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 6px;
  --container: 1180px;
  --gutter: 20px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  margin: 0;
  overflow-x: clip;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--text);
  font: 15px/1.6 var(--mono);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
::selection { background: var(--accent); color: var(--bg); }
:focus-visible { outline: 2px dashed var(--accent); outline-offset: 2px; }

h1, h2, h3 { color: var(--text-strong); line-height: 1.25; font-family: var(--mono); }
h1 { font-size: clamp(26px, 4vw, 40px); margin: .2em 0 .4em; letter-spacing: -.02em; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }
.container--narrow { max-width: 880px; }
.site-main { flex: 1; padding-bottom: 64px; outline: none; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
.mad { color: var(--mad); }
.comment { color: var(--muted); font-size: 12.5px; }
.prompt { color: var(--accent); font-weight: 500; }
.prompt.mad { color: var(--mad); }
.cursor { color: var(--accent); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--bg); padding: 6px 10px; z-index: 100; }
.skip:focus { left: 8px; }

/* progress bar while fetching contracts */
.progress { position: fixed; top: 0; left: 0; height: 2px; width: 0; background: linear-gradient(90deg, var(--accent), var(--mad)); z-index: 60; opacity: 0; transition: width .3s, opacity .3s; }
.progress.is-active { width: 70%; opacity: 1; transition: width 2s cubic-bezier(.1, .7, .2, 1); }

/* boot screen */
.boot { max-width: var(--container); margin: 80px auto; padding: 0 var(--gutter); }
.boot__log { color: var(--muted); }
.noscript { padding: 40px; text-align: center; color: var(--amber); }

/* ------------------------------------------------------------------ header */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header__row { display: flex; align-items: center; gap: 24px; min-height: 60px; }
.logo { font-weight: 700; color: var(--text-strong); white-space: nowrap; font-size: 15px; }
.logo:hover { text-decoration: none; }
.logo__user { color: var(--accent); }
.logo__at { color: var(--muted); }
.logo__host { color: var(--mad); }
.logo__path { color: var(--blue); }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav__item { color: var(--muted); padding: 6px 10px; border-radius: var(--radius); white-space: nowrap; font-size: 14px; }
.nav__item:hover { color: var(--text-strong); background: var(--panel); text-decoration: none; }
.nav__item.is-active { color: var(--accent); background: var(--panel); box-shadow: inset 0 -2px 0 var(--accent); }
.nav__item--support { color: var(--mad); }
.header__tools { display: flex; align-items: center; gap: 8px; }
.tool {
  font: inherit; font-size: 13px; color: var(--text); background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 4px 8px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center;
}
.tool:hover { border-color: var(--accent); color: var(--accent); }
kbd { font: 11px var(--mono); color: var(--muted); border: 1px solid var(--border-strong); border-radius: 3px; padding: 0 4px; }
.lang { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.lang__item { padding: 4px 8px; font-size: 13px; color: var(--muted); text-transform: uppercase; }
.lang__item.is-active { background: var(--accent); color: var(--bg); font-weight: 700; }
.lang__item:hover { text-decoration: none; color: var(--text-strong); }
.lang__item.is-active:hover { color: var(--bg); }

/* ------------------------------------------------------------------ hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 40px; align-items: center; padding-top: 48px; padding-bottom: 32px; }
.ascii { color: var(--accent); font-size: 11px; line-height: 1.15; margin: 0 0 12px; opacity: .85; overflow: hidden; text-shadow: 0 0 12px rgba(57, 255, 159, .35); }
.ascii--big { font-size: 14px; }
.hero__title { font-size: clamp(28px, 4.2vw, 46px); margin: 0 0 12px; }
.hero__subtitle { font-family: var(--sans); font-size: 18px; color: var(--text); max-width: 46ch; }
.stats { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 18px; color: var(--muted); font-size: 13px; }
.stats b { color: var(--amber); }

.glitch { position: relative; }
.glitch:hover::before, .glitch:hover::after {
  content: attr(data-text); position: absolute; inset: 0; overflow: hidden;
}
.glitch:hover::before { color: var(--mad); transform: translate(2px, -1px); clip-path: inset(0 0 55% 0); animation: glitch .4s steps(2) infinite; }
.glitch:hover::after { color: var(--blue); transform: translate(-2px, 1px); clip-path: inset(50% 0 0 0); animation: glitch .3s steps(2) infinite reverse; }
@keyframes glitch { 50% { transform: translate(-1px, 1px); } }

.terminal { background: var(--panel); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--glow); overflow: hidden; }
.terminal__bar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: var(--panel-2); border-bottom: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.terminal__bar i { width: 11px; height: 11px; border-radius: 50%; background: var(--bad); display: inline-block; }
.terminal__bar i:nth-child(2) { background: var(--amber); }
.terminal__bar i:nth-child(3) { background: var(--ok); }
.terminal__bar span { margin-left: 8px; }
.terminal__body { padding: 16px 18px; font-size: 13.5px; min-height: 240px; }
.term-line { margin-bottom: 8px; opacity: 0; animation: appear .01s forwards; animation-delay: var(--d); }
.term-cmd { color: var(--text-strong); }
.term-out { color: var(--muted); padding-left: 14px; }
@keyframes appear { to { opacity: 1; } }

/* ------------------------------------------------------------------ blocks / grid */
.block { margin: 40px 0; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; border-bottom: 1px dashed var(--border-strong); margin-bottom: 18px; }
.section-head h2 { margin: 0 0 10px; font-size: 18px; }
.section-head .prompt { font-size: 13px; font-weight: 400; }
.more { font-size: 13px; white-space: nowrap; }
.small-head { font-size: 14px; color: var(--muted); font-weight: 500; margin: 0 0 14px; }

.grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 32px; }
.hero > *, .split > *, .doc > * { min-width: 0; }

.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; transition: border-color .15s, box-shadow .15s, transform .15s; position: relative;
}
.card:hover { border-color: var(--accent-dim); box-shadow: var(--glow); }
.card__meta { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.card__title { margin: 6px 0 6px; font-size: 16px; }
.card__title a { color: var(--text-strong); }
.card__title a::after { content: ""; position: absolute; inset: 0; } /* whole card clickable */
.card__desc { margin: 0 0 10px; font-family: var(--sans); font-size: 14px; color: var(--text); }
.card__tags, .card__stack { display: flex; flex-wrap: wrap; gap: 6px; position: relative; z-index: 1; }
.card__stack { margin-bottom: 8px; }

.chip { font-size: 12px; color: var(--blue); background: color-mix(in srgb, var(--blue) 10%, transparent); border: 1px solid color-mix(in srgb, var(--blue) 25%, transparent); padding: 1px 8px; border-radius: 20px; }
.chip:hover { text-decoration: none; border-color: var(--blue); }
.chip sup { color: var(--muted); margin-left: 2px; }
.chip--channel { color: var(--mad); border-color: color-mix(in srgb, var(--mad) 35%, transparent); background: color-mix(in srgb, var(--mad) 8%, transparent); }
.stack { display: inline-block; font-size: 12px; color: var(--amber); border: 1px dashed color-mix(in srgb, var(--amber) 45%, transparent); padding: 0 6px; border-radius: 3px; margin: 0 4px 4px 0; }

.badge { font-size: 11px; font-weight: 700; letter-spacing: .04em; white-space: nowrap; }
.badge--planned { color: var(--muted); }
.badge--running { color: var(--amber); animation: pulse 1.6s ease-in-out infinite; }
.badge--done { color: var(--ok); }
.badge--failed { color: var(--bad); }
@keyframes pulse { 50% { opacity: .45; } }
h1 .badge { font-size: .45em; vertical-align: middle; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--muted); }
.dot--running { background: var(--amber); }
.dot--done { background: var(--ok); }
.dot--failed { background: var(--bad); }

/* video thumbnail card */
.thumb { display: block; position: relative; aspect-ratio: 16 / 9; margin: -16px -18px 12px; background: repeating-linear-gradient(45deg, var(--panel-2) 0 10px, var(--bg-2) 10px 20px); border-bottom: 1px solid var(--border); overflow: hidden; border-radius: var(--radius) var(--radius) 0 0; }
.thumb img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.7) contrast(1.05); transition: filter .2s; }
.card:hover .thumb img { filter: none; }
.thumb__play { position: absolute; inset: 0; display: grid; place-items: center; font-size: 34px; color: #fff; text-shadow: 0 0 18px rgba(0, 0, 0, .8); }
.thumb__dur, .thumb__provider { position: absolute; bottom: 8px; font-size: 11px; background: rgba(0, 0, 0, .75); color: #fff; padding: 1px 6px; border-radius: 3px; }
.thumb__dur { right: 8px; }
.thumb__provider { left: 8px; color: var(--accent); text-transform: uppercase; }

/* compact lines (notes) */
.lines { list-style: none; padding: 0; margin: 0 0 24px; }
.line-item { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px dotted var(--border); }
.line-item a { color: var(--text-strong); }

/* now in progress */
.now { list-style: none; padding: 0; margin: 0; }
.now__item { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 6px 0; font-size: 14px; }
.now__pct { color: var(--amber); white-space: pre; }
.ascii-bar { white-space: nowrap; letter-spacing: -1px; }
.ascii-bar__fill { color: var(--accent); }
.ascii-bar__empty { color: var(--border-strong); }

/* ------------------------------------------------------------------ CTAs */
.cta { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; padding: 18px 20px; border-radius: var(--radius); margin: 32px 0; border: 1px solid var(--border-strong); background: var(--panel); }
.cta__icon { font-size: 26px; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; }
.cta__title { color: var(--text-strong); font-weight: 700; }
.cta p { margin: 4px 0 0; font-family: var(--sans); font-size: 14px; }
.cta--telegram { border-color: color-mix(in srgb, var(--blue) 40%, transparent); }
.cta--telegram .cta__icon { color: var(--blue); background: color-mix(in srgb, var(--blue) 12%, transparent); }
.cta--support { border-color: color-mix(in srgb, var(--mad) 40%, transparent); background: linear-gradient(120deg, var(--panel), color-mix(in srgb, var(--mad) 7%, var(--panel))); }
.cta--support .cta__icon { color: var(--mad); background: color-mix(in srgb, var(--mad) 12%, transparent); }
.split .cta { grid-template-columns: auto 1fr; }
.split .cta .btn { grid-column: 1 / -1; justify-self: start; }

.btn { font: 500 14px var(--mono); display: inline-block; padding: 8px 14px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--panel-2); color: var(--text-strong); cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.btn--primary:hover { color: var(--bg); filter: brightness(1.1); box-shadow: var(--glow); }
.btn--mad { background: transparent; border-color: var(--mad); color: var(--mad); }
.btn--mad:hover { background: var(--mad); color: var(--bg); border-color: var(--mad); }

/* ------------------------------------------------------------------ page head / crumbs */
.crumbs { font-size: 13px; padding: 18px 0 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs a:last-child { color: var(--text); }
.crumbs .sep { color: var(--border-strong); }
.page-head { padding: 18px 0 8px; }
.page-head h1 .prompt { font-size: .5em; vertical-align: middle; font-weight: 400; }
.lead { font-family: var(--sans); font-size: 18px; color: var(--text); max-width: 70ch; }
.empty { color: var(--muted); padding: 40px 0; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 24px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 24px; }
.tab { padding: 4px 12px; border: 1px solid var(--border); border-radius: 20px; color: var(--text); font-size: 13px; display: inline-flex; align-items: center; }
.tab:hover { text-decoration: none; border-color: var(--accent); }
.tab.is-active { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.tab sup { color: var(--muted); margin-left: 4px; }
.channels { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 24px; }

.pagination { display: flex; gap: 6px; margin: 32px 0; flex-wrap: wrap; }
.page-link { min-width: 34px; text-align: center; padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); }
.page-link.is-active { border-color: var(--accent); color: var(--accent); }

/* ------------------------------------------------------------------ article layout */
.doc { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 48px; }
.doc__aside { position: relative; }
.toc { position: sticky; top: 84px; font-size: 13px; border-left: 1px solid var(--border); padding-left: 14px; }
.toc__title { color: var(--muted); margin-bottom: 8px; }
.toc ol { list-style: none; padding: 0; margin: 0; }
.toc li { margin: 4px 0; }
.toc .toc__l3 { padding-left: 12px; }
.toc a { color: var(--muted); }
.toc a.is-active { color: var(--accent); }
.toc a.is-active::before { content: "▸ "; }
.cover { width: 100%; border-radius: var(--radius); border: 1px solid var(--border); }

.prose { font-family: var(--sans); font-size: 17px; line-height: 1.75; color: var(--text); max-width: 72ch; }
.prose h2, .prose h3 { margin: 1.8em 0 .6em; }
.prose h2::before { content: "## "; color: var(--accent); }
.prose h3::before { content: "### "; color: var(--accent); }
.prose p, .prose ul, .prose ol { margin: 0 0 1.1em; }
.prose li { margin: .3em 0; }
.prose li::marker { color: var(--accent); }
.prose strong { color: var(--text-strong); }
.prose blockquote { margin: 1.4em 0; padding: 10px 18px; border-left: 3px solid var(--amber); background: color-mix(in srgb, var(--amber) 6%, transparent); color: var(--text); border-radius: 0 var(--radius) var(--radius) 0; }
.prose blockquote p { margin: 0; }
.prose code { font-family: var(--mono); font-size: .86em; background: var(--code-bg); border: 1px solid var(--border); padding: 1px 5px; border-radius: 4px; color: var(--amber); }
.prose pre { position: relative; background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 0; overflow: hidden; margin: 1.4em 0; }
.prose pre code { display: block; padding: 14px 16px; overflow-x: auto; background: none; border: 0; color: var(--text); font-size: 13.5px; line-height: 1.6; }
.code-bar { display: flex; justify-content: space-between; align-items: center; padding: 4px 12px; font: 12px var(--mono); color: var(--muted); background: var(--panel-2); border-bottom: 1px solid var(--border); }
.code-copy { font: 12px var(--mono); background: none; border: 0; color: var(--muted); cursor: pointer; }
.code-copy:hover { color: var(--accent); }
.prose a { color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); text-underline-offset: 3px; }
.prose hr { border: 0; border-top: 1px dashed var(--border-strong); margin: 2em 0; }
.prose input[type=checkbox] { accent-color: var(--accent); margin-right: 8px; }
.prose ul:has(input[type=checkbox]) { list-style: none; padding-left: 4px; }

.table-wrap { overflow-x: auto; margin: 1.2em 0; border: 1px solid var(--border); border-radius: var(--radius); }
.table-wrap table, .metrics { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 13.5px; }
.table-wrap th, .table-wrap td { padding: 8px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.table-wrap th { color: var(--muted); font-weight: 500; background: var(--panel-2); }
.table-wrap tr:last-child td { border-bottom: 0; }

.links { padding-left: 18px; }
.links li::marker { content: "→ "; color: var(--accent); }

.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 40px 0 0; }
.prevnext a { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-strong); }
.prevnext a:hover { border-color: var(--accent); text-decoration: none; }
.prevnext__next { text-align: right; grid-column: 2; }

/* ------------------------------------------------------------------ experiments */
.hypothesis { border: 1px solid color-mix(in srgb, var(--blue) 45%, transparent); background: color-mix(in srgb, var(--blue) 6%, transparent); border-radius: var(--radius); padding: 12px 16px; margin: 12px 0 20px; }
.hypothesis__label { color: var(--blue); font-size: 13px; }
.hypothesis p { margin: 6px 0 0; font-family: var(--sans); font-size: 17px; color: var(--text-strong); }
.kv { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; margin: 8px 0; font-size: 14px; }
.kv__k { color: var(--muted); min-width: 110px; }
.metrics .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.metrics__bar-col { width: 28%; min-width: 120px; }
.bar { height: 6px; border-radius: 3px; margin: 3px 0; }
.bar--base { background: var(--border-strong); }
.bar--ok { background: var(--ok); }
.bar--bad { background: var(--bad); }
.verdict { border-radius: var(--radius); padding: 12px 16px; margin: 24px 0; border: 1px solid var(--border-strong); background: var(--panel); }
.verdict__label { font-size: 13px; color: var(--muted); }
.verdict p { margin: 6px 0 0; font-family: var(--sans); font-size: 16px; color: var(--text-strong); }
.verdict--done { border-color: var(--ok); }
.verdict--failed { border-color: var(--bad); }
.verdict--running { border-color: var(--amber); }

/* ------------------------------------------------------------------ video player */
.player { margin: 16px 0 24px; }
.player > button, .player > iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 1px solid var(--border-strong); border-radius: var(--radius); background: #000; }
.player__facade { position: relative; padding: 0; cursor: pointer; overflow: hidden; font: inherit; background: repeating-linear-gradient(45deg, var(--panel-2) 0 12px, var(--bg-2) 12px 24px) !important; }
.player__facade img { width: 100%; height: 100%; object-fit: cover; opacity: .55; filter: grayscale(.4); }
.player__overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: #fff; text-shadow: 0 1px 8px #000; }
.player__btn { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; background: var(--accent); color: #0a0e14; text-shadow: none; box-shadow: 0 0 30px rgba(57, 255, 159, .5); transition: transform .15s; }
.player__facade:hover .player__btn { transform: scale(1.08); }
.player__label { font-weight: 700; }
.player__note { font-size: 12px; opacity: .8; }
.player figcaption { font-size: 13px; color: var(--muted); margin-top: 6px; }

/* ------------------------------------------------------------------ about / support */
.principles { list-style: none; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.principles li { display: flex; gap: 12px; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; background: var(--panel); }
.principles__n { color: var(--mad); font-weight: 700; }
.principles p { margin: 4px 0 0; font-family: var(--sans); font-size: 14px; }
.goal { border: 1px dashed var(--mad); border-radius: var(--radius); padding: 14px 16px; margin: 24px 0; }
.goal__bar { margin: 8px 0 4px; font-size: 15px; overflow: hidden; }
.goal .ascii-bar__fill { color: var(--mad); }
.tier { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--panel); }
.tier:hover { border-color: var(--mad); }
.tier__title { color: var(--text-strong); font-weight: 700; }
.tier__price { font-size: 22px; color: var(--mad); }
.tier p { margin: 0; font-family: var(--sans); font-size: 14px; }
.tier .btn { margin-top: auto; white-space: normal; }
.perks { padding-left: 18px; margin: 0; font-size: 13px; }
.perks li::marker { content: "+ "; color: var(--ok); }
.methods { display: grid; gap: 8px; }
.method { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); }
.method.is-disabled { opacity: .7; }
.method .badge { margin-left: auto; }
.faq { border-bottom: 1px dashed var(--border); padding: 10px 0; }
.faq summary { cursor: pointer; color: var(--text-strong); list-style: none; }
.faq summary::before { content: "[+] "; color: var(--accent); }
.faq[open] summary::before { content: "[-] "; }
.faq p { font-family: var(--sans); margin: 8px 0 0 32px; }
.console { background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; font-size: 13px; color: var(--text); white-space: pre-wrap; overflow-x: auto; }

/* system pages */
.system { padding-top: 48px; }
.system .ascii { color: var(--mad); text-shadow: 0 0 14px rgba(255, 79, 216, .4); }

/* ------------------------------------------------------------------ footer */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-2); padding: 32px 0; font-size: 14px; }
.footer__grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; }
.footer__brand { color: var(--text-strong); font-weight: 700; }
.footer__title { color: var(--muted); margin-bottom: 8px; }
.site-footer p { font-family: var(--sans); }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { margin: 4px 0; }
.icon { display: inline-block; width: 18px; color: var(--muted); }

/* ------------------------------------------------------------------ palette */
.palette { position: fixed; inset: 0; z-index: 80; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 0; }
.palette__backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); backdrop-filter: blur(2px); }
.palette__box { position: relative; width: 100%; max-width: 640px; background: var(--panel); border: 1px solid var(--accent-dim); border-radius: 10px; box-shadow: var(--glow), 0 20px 60px rgba(0, 0, 0, .5); overflow: hidden; }
.palette__input { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.palette__input input { flex: 1; font: 16px var(--mono); background: none; border: 0; color: var(--text-strong); outline: none; }
.palette__list { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow-y: auto; }
.palette__item { display: flex; gap: 12px; padding: 8px 10px; border-radius: var(--radius); cursor: pointer; }
.palette__item.is-active { background: var(--panel-2); color: var(--accent); }
.palette__kind { color: var(--muted); min-width: 84px; font-size: 12px; padding-top: 2px; }
.palette__empty { padding: 12px; color: var(--muted); }
.palette__hint { padding: 8px 16px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1000px) {
  .hero { grid-template-columns: minmax(0, 1fr); padding-top: 28px; }
  .doc { grid-template-columns: minmax(0, 1fr); }
  .doc__aside { display: none; }
  .split { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  :root { --gutter: 16px; }
  body { font-size: 14px; }
  .header__row { flex-wrap: wrap; gap: 8px 12px; padding-top: 8px; padding-bottom: 6px; }
  .logo { order: 1; }
  .header__tools { order: 2; margin-left: auto; }
  .nav { order: 3; flex-basis: 100%; }
  .tool kbd { display: none; }
  .ascii { display: none; }
  .grid--2, .grid--3, .principles { grid-template-columns: minmax(0, 1fr); }
  .header__row > * { min-width: 0; }
  .term-out { overflow-wrap: anywhere; }
  .ascii--big { font-size: 10px; }
  .cta { grid-template-columns: 1fr; text-align: left; }
  .cta__icon { display: none; }
  .footer__grid { grid-template-columns: 1fr; gap: 20px; }
  .prose { font-size: 16px; }
  .line-item { grid-template-columns: 1fr; gap: 0; }
  .prevnext { grid-template-columns: 1fr; }
  .prevnext__next { grid-column: 1; }
  .metrics__bar-col { display: none; }
  .site-header { position: static; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .term-line { opacity: 1; }
  html { scroll-behavior: auto; }
}
