/* ---------------------------------------------------------------------------
   Groth16, Incrementally — design system
   --------------------------------------------------------------------------- */

:root {
  --bg: #0a0b10;
  --bg-deep: #06070a;
  --panel: #11131b;
  --panel-2: #161923;
  --panel-3: #1c2030;
  --line: #242838;
  --line-soft: #1a1d29;

  --ink: #e4e7ef;
  --ink-dim: #a8b0c4;
  --ink-faint: #6b7386;

  --accent: #8ba4ff;
  --accent-deep: #5b78e8;
  --accent-glow: rgba(139, 164, 255, 0.16);
  --gold: #e8b563;
  --teal: #4fd6c0;
  --rose: #ff7a8a;

  --ok: #4fd6c0;
  --err: #ff7a8a;
  --warn: #e8b563;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;

  --radius: 10px;
  --radius-lg: 14px;
  --topbar-h: 58px;
  --sidebar-w: 274px;

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px -12px rgba(0, 0, 0, 0.7);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* A faint grid + glow, so the page does not read as a flat black rectangle. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px 480px at 78% -8%, rgba(139, 164, 255, 0.07), transparent 70%),
    radial-gradient(720px 420px at 8% 4%, rgba(79, 214, 192, 0.045), transparent 70%),
    linear-gradient(rgba(255, 255, 255, 0.014) 1px, transparent 1px) 0 0 / 100% 44px;
}

a {
  color: var(--accent);
  text-decoration-color: rgba(139, 164, 255, 0.35);
  text-underline-offset: 3px;
}
a:hover {
  text-decoration-color: var(--accent);
}

/* ---------------------------------------------------------------- boot ---- */

.boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--bg-deep);
  transition: opacity 0.4s ease;
}
.boot--gone {
  opacity: 0;
  pointer-events: none;
}
.boot__inner {
  text-align: center;
  color: var(--ink-faint);
  font-size: 14px;
}
.boot__spinner {
  width: 30px;
  height: 30px;
  margin: 0 auto 16px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* -------------------------------------------------------------- topbar ---- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  background: rgba(10, 11, 16, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}
.topbar__mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(150deg, var(--accent-deep), #2b3a7a);
  color: #fff;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.02em;
  box-shadow: 0 0 0 1px rgba(139, 164, 255, 0.25), 0 4px 14px -4px var(--accent-deep);
}
.topbar__title {
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: 0.01em;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.progress {
  display: flex;
  align-items: center;
  gap: 9px;
}
.progress__track {
  width: 110px;
  height: 5px;
  border-radius: 99px;
  background: var(--panel-3);
  overflow: hidden;
}
.progress__fill {
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent-deep), var(--teal));
  transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress__label {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  min-width: 46px;
}

/* -------------------------------------------------------------- layout ---- */

.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  align-items: start;
}

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 16px 10px 40px 16px;
  border-right: 1px solid var(--line-soft);
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.sidebar__part {
  margin: 16px 0 5px;
  padding-left: 10px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.sidebar__part:first-child {
  margin-top: 0;
}

.navlink {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 8px;
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 13px;
  line-height: 1.38;
  transition: background 0.15s, color 0.15s;
}
.navlink:hover {
  background: var(--panel-2);
  color: var(--ink);
}
.navlink--active {
  background: var(--panel-3);
  color: var(--ink);
  box-shadow: inset 2px 0 0 var(--accent);
}
.navlink__num {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-faint);
  min-width: 16px;
  font-variant-numeric: tabular-nums;
}
.navlink--active .navlink__num {
  color: var(--accent);
}
.navlink__dots {
  margin-left: auto;
  display: flex;
  gap: 3px;
  align-self: center;
}
.dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--line);
  transition: background 0.25s;
}
.dot--done {
  background: var(--teal);
  box-shadow: 0 0 6px rgba(79, 214, 192, 0.5);
}

.main {
  min-width: 0;
  padding: 44px 40px 140px;
}

.chapter {
  max-width: 780px;
  margin: 0 auto;
}

/* ------------------------------------------------------------- article ---- */

.kicker {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.chapter h1 {
  font-family: var(--serif);
  font-size: clamp(30px, 4.2vw, 43px);
  line-height: 1.14;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 14px;
}

.chapter .lede {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.62;
  color: var(--ink-dim);
  margin: 0 0 6px;
}

.rule {
  height: 1px;
  margin: 30px 0 34px;
  background: linear-gradient(90deg, var(--line), transparent);
}

.prose {
  font-family: var(--serif);
  font-size: 17.5px;
  line-height: 1.72;
  color: #d3d8e4;
}
.prose p {
  margin: 0 0 20px;
}
.prose h2 {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 44px 0 16px;
  scroll-margin-top: 80px;
}
.prose h3 {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  margin: 32px 0 12px;
}
.prose ul,
.prose ol {
  margin: 0 0 20px;
  padding-left: 24px;
}
.prose li {
  margin-bottom: 9px;
}
.prose li::marker {
  color: var(--ink-faint);
}
.prose strong {
  color: #f2f4f9;
  font-weight: 600;
}
.prose em {
  color: var(--ink);
}
.prose code {
  font-family: var(--mono);
  font-size: 0.855em;
  padding: 0.14em 0.4em;
  border-radius: 5px;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  color: #cbd5f0;
  white-space: nowrap;
}

.prose figure {
  margin: 30px 0;
  text-align: center;
}
.prose figure img {
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #f7f7f4;
  padding: 14px;
}
.prose figcaption {
  margin-top: 10px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-faint);
}

/* Callouts */
.note {
  position: relative;
  margin: 26px 0;
  padding: 16px 20px 16px 22px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-left: 2px solid var(--accent-deep);
  font-size: 16px;
  line-height: 1.66;
  color: var(--ink-dim);
}
.note p:last-child {
  margin-bottom: 0;
}
.note__title {
  display: block;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
.note--warn {
  border-left-color: var(--gold);
}
.note--warn .note__title {
  color: var(--gold);
}
.note--attack {
  border-left-color: var(--rose);
}
.note--attack .note__title {
  color: var(--rose);
}

/* Math */
.katex-display {
  margin: 26px 0;
  padding: 4px 0;
  overflow-x: auto;
  overflow-y: hidden;
}
.katex {
  font-size: 1.03em;
}
.katex-display > .katex {
  font-size: 1.09em;
}

/* The recurring "state of the CRS / verifier check" box */
.state {
  margin: 26px 0;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  overflow: hidden;
  box-shadow: var(--shadow);
}
.state__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  background: rgba(139, 164, 255, 0.055);
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
}
.state__body {
  padding: 6px 18px 12px;
}
.state__row {
  padding: 10px 0;
  border-bottom: 1px dashed var(--line-soft);
}
.state__row:last-child {
  border-bottom: none;
}
.state__label {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 2px;
}
.state .katex-display {
  margin: 6px 0;
}

/* ------------------------------------------------------------ exercise ---- */

.ex {
  margin: 40px 0;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
  scroll-margin-top: 76px;
}
.ex--solved {
  border-color: rgba(79, 214, 192, 0.4);
}
.ex--attack {
  border-color: rgba(255, 122, 138, 0.32);
}

.ex__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line-soft);
}
.ex--attack .ex__head {
  background: linear-gradient(90deg, rgba(255, 122, 138, 0.09), var(--panel-2) 60%);
}
.ex__badge {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 5px;
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid rgba(139, 164, 255, 0.2);
  white-space: nowrap;
}
.ex--attack .ex__badge {
  background: rgba(255, 122, 138, 0.13);
  color: var(--rose);
  border-color: rgba(255, 122, 138, 0.25);
}
.ex__title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  flex: 1;
  min-width: 0;
}
.ex__status {
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 99px;
  border: 1px solid var(--line);
  color: var(--ink-faint);
  white-space: nowrap;
}
.ex__status--solved {
  color: var(--ok);
  border-color: rgba(79, 214, 192, 0.35);
  background: rgba(79, 214, 192, 0.08);
}
.ex__status--failed {
  color: var(--err);
  border-color: rgba(255, 122, 138, 0.35);
  background: rgba(255, 122, 138, 0.08);
}

.ex__prompt {
  padding: 18px 20px 4px;
  font-family: var(--serif);
  font-size: 16.5px;
  line-height: 1.68;
  color: var(--ink-dim);
}
.ex__prompt p {
  margin: 0 0 14px;
}
.ex__prompt code {
  font-family: var(--mono);
  font-size: 0.85em;
  padding: 0.12em 0.38em;
  border-radius: 5px;
  background: var(--panel-3);
  color: #cbd5f0;
  white-space: nowrap;
}
.ex__prompt ul {
  margin: 0 0 14px;
  padding-left: 22px;
}
.ex__prompt li {
  margin-bottom: 6px;
}

/* API hint table */
.api {
  margin: 4px 20px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  background: var(--bg-deep);
  overflow: hidden;
}
.api__head {
  padding: 7px 14px;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-faint);
  border-bottom: 1px solid var(--line-soft);
}
.api__row {
  display: grid;
  grid-template-columns: minmax(160px, 0.42fr) 1fr;
  gap: 14px;
  padding: 7px 14px;
  font-size: 13px;
  border-bottom: 1px solid rgba(36, 40, 56, 0.5);
}
.api__row:last-child {
  border-bottom: none;
}
.api__sig {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  overflow-wrap: anywhere;
}
.api__doc {
  color: var(--ink-faint);
  line-height: 1.5;
}

/* ---------------------------------------------------------------- code ---- */

.editor {
  position: relative;
  margin: 0 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-deep);
  overflow: hidden;
}
.editor:focus-within {
  border-color: rgba(139, 164, 255, 0.45);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.editor__scroll {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  max-height: 560px;
  overflow: auto;
}

.editor__gutter {
  position: sticky;
  left: 0;
  z-index: 2;
  padding: 14px 10px 14px 14px;
  text-align: right;
  background: var(--bg-deep);
  border-right: 1px solid var(--line-soft);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  color: #363c4d;
  user-select: none;
  white-space: pre;
  font-variant-numeric: tabular-nums;
}

/*
 * The highlight layer and the textarea share a single grid cell, so the <pre>
 * dictates the height and the textarea stretches to match it. Doing this in
 * CSS rather than by measuring in JS matters: the editor is built before its
 * card is in the document, so any scrollHeight read at construction time is 0.
 */
.editor__area {
  display: grid;
  min-width: 0;
}

.editor__hl,
.editor__input {
  grid-area: 1 / 1;
  margin: 0;
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  tab-size: 2;
  white-space: pre;
  overflow-wrap: normal;
  border: 0;
}

.editor__hl {
  pointer-events: none;
  color: var(--ink);
}

.editor__input {
  width: 100%;
  height: 100%;
  min-height: 0;
  resize: none;
  background: transparent;
  color: transparent;
  caret-color: var(--accent);
  outline: none;
  overflow: hidden;
}
.editor__input::selection {
  background: rgba(139, 164, 255, 0.28);
}

/* syntax colors */
.tok-key {
  color: #c99bf5;
}
.tok-str {
  color: #9fe0a8;
}
.tok-num {
  color: #ffb888;
}
.tok-com {
  color: #566079;
  font-style: italic;
}
.tok-fn {
  color: #8ba4ff;
}
.tok-op {
  color: #93a0bd;
}
.tok-punc {
  color: #6f7996;
}
.tok-const {
  color: #5fd3d3;
}

/* --------------------------------------------------------------- tools ---- */

.ex__tools {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 14px 18px;
  flex-wrap: wrap;
}
.ex__tools .spacer {
  flex: 1;
}

.btn {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 550;
  padding: 7px 15px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-3);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.08s;
  white-space: nowrap;
}
.btn:hover {
  background: #232838;
  border-color: #303650;
}
.btn:active {
  transform: translateY(1px);
}
.btn--primary {
  background: linear-gradient(180deg, var(--accent-deep), #4763d0);
  border-color: #6c85ea;
  color: #fff;
  box-shadow: 0 5px 16px -8px var(--accent-deep);
}
.btn--primary:hover {
  background: linear-gradient(180deg, #6c85ea, var(--accent-deep));
  border-color: #8098f0;
}
.btn--ghost {
  background: transparent;
  color: var(--ink-faint);
  font-size: 12.5px;
  padding: 6px 12px;
}
.btn--ghost:hover {
  color: var(--ink);
  background: var(--panel-2);
}
.btn kbd {
  font-family: var(--mono);
  font-size: 10px;
  opacity: 0.65;
  margin-left: 6px;
  border: 1px solid currentColor;
  border-radius: 3px;
  padding: 0 3px;
}

/* -------------------------------------------------------------- output ---- */

.out {
  margin: 0 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  background: var(--bg-deep);
  overflow: hidden;
}
.out[hidden] {
  display: none;
}
.out__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.out__time {
  margin-left: auto;
  font-family: var(--mono);
  letter-spacing: 0;
  text-transform: none;
  font-weight: 400;
}
.out__log {
  margin: 0;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.62;
  color: #b9c1d4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 320px;
  overflow: auto;
}
.out__log:empty {
  display: none;
}
.out__log .log-err {
  color: var(--err);
}
.out__log .log-warn {
  color: var(--warn);
}

.tests {
  border-top: 1px solid var(--line-soft);
  padding: 8px 6px 10px;
}
.tests:first-child {
  border-top: none;
}
.test {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 5px 12px;
  font-size: 13px;
  line-height: 1.5;
}
.test__icon {
  flex: none;
  width: 15px;
  height: 15px;
  margin-top: 2px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 9px;
  font-weight: 700;
  color: var(--bg-deep);
}
.test--pass .test__icon {
  background: var(--ok);
}
.test--pass .test__icon::after {
  content: "✓";
}
.test--fail .test__icon {
  background: var(--err);
}
.test--fail .test__icon::after {
  content: "✕";
}
.test__name {
  color: var(--ink-dim);
}
.test--fail .test__name {
  color: var(--ink);
}
.test__detail {
  display: block;
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--err);
  overflow-wrap: anywhere;
}

.verdict {
  margin: 0 14px 16px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14.5px;
  font-family: var(--serif);
  line-height: 1.55;
}
.verdict[hidden] {
  display: none;
}
.verdict--ok {
  background: rgba(79, 214, 192, 0.09);
  border: 1px solid rgba(79, 214, 192, 0.28);
  color: #a5ecdf;
}
.verdict--err {
  background: rgba(255, 122, 138, 0.08);
  border: 1px solid rgba(255, 122, 138, 0.25);
  color: #ffbcc4;
}
.verdict strong {
  color: #fff;
}

/* ------------------------------------------------------------ solution ---- */

.solution {
  margin: 0 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  background: var(--bg-deep);
  overflow: hidden;
}
.solution[hidden] {
  display: none;
}
.solution__head {
  padding: 8px 14px;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--gold);
}
.solution pre {
  margin: 0;
  padding: 12px 16px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  overflow-x: auto;
  white-space: pre;
}

/* ----------------------------------------------------------- chapter nav -- */

.chapnav {
  display: flex;
  gap: 12px;
  margin-top: 64px;
  padding-top: 26px;
  border-top: 1px solid var(--line-soft);
}
.chapnav a {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.15s, background 0.15s;
}
.chapnav a:hover {
  border-color: var(--accent-deep);
  background: var(--panel-2);
}
.chapnav a[data-dir="next"] {
  text-align: right;
}
.chapnav__dir {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 4px;
}
.chapnav__name {
  font-family: var(--serif);
  font-size: 16px;
}
.chapnav__spacer {
  flex: 1;
}

/* --------------------------------------------------------------- cover ---- */

.cover {
  max-width: 820px;
  margin: 0 auto;
}
.cover__hero {
  padding: 20px 0 8px;
}
.cover h1 {
  font-family: var(--serif);
  font-size: clamp(38px, 6vw, 62px);
  line-height: 1.06;
  letter-spacing: -0.025em;
  font-weight: 600;
  margin: 0 0 18px;
}
.cover h1 .grad {
  background: linear-gradient(100deg, var(--accent) 10%, var(--teal) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.cover__sub {
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.6;
  color: var(--ink-dim);
  max-width: 62ch;
  margin: 0 0 30px;
}

.eqcard {
  margin: 30px 0;
  padding: 22px 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background:
    radial-gradient(600px 200px at 50% 0%, rgba(139, 164, 255, 0.09), transparent 70%),
    var(--panel);
  text-align: center;
  overflow-x: auto;
  box-shadow: var(--shadow);
}
.eqcard__cap {
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 14px;
}

/* The card already supplies the breathing room; the display margin doubles it. */
.eqcard .katex-display {
  margin: 0;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin: 30px 0;
}
.card {
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
}
.card__k {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
.card__v {
  font-family: var(--serif);
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--ink-dim);
}
.card__v strong {
  color: var(--ink);
}

.cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 12px 22px;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--accent-deep), #4763d0);
  border: 1px solid #6c85ea;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 8px 24px -10px var(--accent-deep);
  transition: transform 0.12s;
}
.cta:hover {
  transform: translateY(-1px);
}

/* -------------------------------------------------------------- mobile ---- */

@media (max-width: 940px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--line-soft);
    padding: 14px 16px;
  }
  .main {
    padding: 28px 18px 100px;
  }
  .topbar__title {
    display: none;
  }
  .progress__track {
    width: 70px;
  }
  .api__row {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}
