/* The System: shared layer (tokens, HUD bar, dialogs, machine, reading pages, glossary).
   Two families only: Montserrat (display and text, the video face) and Roboto Mono (HUD labels, data).
   Colour rule carried over from the video kit: cyan = the thing to remember / done,
   orange = costs and warnings only, white = neutral. */

@font-face { font-family: "TS Sans"; src: url("../fonts/Montserrat-latin.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "TS Mono"; src: url("../fonts/RobotoMono-latin.woff2") format("woff2"); font-weight: 100 700; font-style: normal; font-display: swap; }

:root {
  --sc-canvas: #07121c;
  --sc-surface: #0d2031;
  --sc-ink: #eef3f8;
  --sc-ink-soft: #a7b6c8;
  --sc-accent: #37bdf8;
  --sc-accent-ink: #04101a;
  --sc-font-display: "TS Sans", "Montserrat", system-ui, sans-serif;
  --sc-font-text: "TS Sans", "Montserrat", system-ui, sans-serif;
  --sc-font-mono: "TS Mono", "Roboto Mono", ui-monospace, monospace;
  --sc-shadow-color: 210 70% 2%;

  --ts-deep: #040a12;
  --ts-orange: #f09025;
  --ts-line: rgba(55, 189, 248, 0.16);
  --ts-line-2: rgba(55, 189, 248, 0.32);
  --ts-glass: linear-gradient(180deg, rgba(20, 44, 66, 0.72), rgba(10, 26, 40, 0.78));
  --ts-dim: #7f91a6;
  --ts-bar-h: 64px;
  --ts-r: 14px;
}
html { background: var(--sc-canvas); scroll-padding-top: calc(var(--ts-bar-h) + 24px); }
body { font-weight: 450; letter-spacing: 0.002em; }
::selection { background: var(--sc-accent); color: var(--sc-accent-ink); }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.label { font-family: var(--sc-font-mono); font-size: 0.74rem; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; color: var(--sc-ink-soft); margin: 0; }
.c { color: var(--sc-accent); }
.o { color: var(--ts-orange); }
kbd { font-family: var(--sc-font-mono); font-size: 0.72rem; border: 1px solid var(--ts-line-2); border-radius: 5px; padding: 0.05em 0.4em; color: var(--sc-ink-soft); }
.skip { position: fixed; left: 12px; top: -60px; z-index: 200; background: var(--sc-accent); color: var(--sc-accent-ink); padding: 10px 14px; border-radius: 8px; font-weight: 700; text-decoration: none; }
.skip:focus { top: 12px; }

/* ------------------------------------------------------------- CTA */
.cta {
  display: inline-flex; align-items: center; gap: 0.6em; white-space: nowrap;
  background: var(--sc-accent); color: var(--sc-accent-ink);
  font-family: var(--sc-font-display); font-weight: 800; font-size: 0.98rem; letter-spacing: 0.01em;
  padding: 0.85em 1.35em; border-radius: 10px; text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.45), 0 6px 18px -6px rgba(4, 16, 26, 0.9);
  transition: transform 140ms var(--sc-ease-out), background-color 160ms var(--sc-ease-out);
}
.cta::after { content: ""; width: 0.55em; height: 0.55em; border-top: 2px solid currentColor; border-right: 2px solid currentColor; transform: rotate(45deg); margin-left: 0.1em; }
.cta:active { transform: translateY(1px) scale(0.98); }
@media (hover: hover) and (pointer: fine) { .cta:hover { background: #63ccfa; } }
.cta--lg { font-size: 1.08rem; padding: 1em 1.6em; }

/* ------------------------------------------------------------- HUD bar (the parts index) */
.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 60; height: var(--ts-bar-h);
  display: flex; align-items: center; gap: 16px; padding: 0 clamp(12px, 2.4vw, 28px);
  background: rgba(7, 18, 28, 0.9); border-bottom: 1px solid rgba(55, 189, 248, 0.10);
  -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
}
.bar__brand {
  display: inline-flex; align-items: center; gap: 10px; text-decoration: none; flex: none;
  padding: 7px 14px 7px 7px; border-radius: 999px; background: rgba(6, 12, 18, 0.86); border: 1px solid rgba(55,189,248,0.25);
  font-family: var(--sc-font-mono); font-weight: 600; font-size: 0.78rem; letter-spacing: 0.18em; text-transform: uppercase;
}
.bar__logo { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; background: var(--sc-accent); color: var(--sc-accent-ink); font-family: var(--sc-font-display); font-weight: 900; font-size: 0.86rem; letter-spacing: 0; }
.bar__parts { display: flex; align-items: center; gap: 4px; margin: 0 auto; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--ts-line); background: rgba(6, 12, 18, 0.6); }
.seg { position: relative; display: block; width: 22px; height: 18px; display: grid; place-items: center; }
.seg i { display: block; width: 100%; height: 5px; border-radius: 2px; background: rgba(150, 162, 182, 0.22); overflow: hidden; position: relative; }
.seg i::after { content: ""; position: absolute; inset: 0; background: var(--sc-accent); transform-origin: 0 50%; transform: scaleX(var(--fill, 0)); transition: transform 420ms var(--sc-ease-out); }
.seg[aria-current="true"] i { outline: 1px solid rgba(255,255,255,0.7); outline-offset: 2px; }
.seg__tip { position: absolute; top: calc(100% + 10px); left: 50%; translate: -50% 0; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity 140ms var(--sc-ease-out);
  font-family: var(--sc-font-mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; padding: 6px 10px; border-radius: 8px; background: #0b1b2a; border: 1px solid var(--ts-line-2); color: var(--sc-ink); }
.seg:hover .seg__tip, .seg:focus-visible .seg__tip { opacity: 1; }
.bar__tools { display: flex; align-items: center; gap: 8px; flex: none; }
.bar__btn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 10px;
  background: rgba(6, 12, 18, 0.7); border: 1px solid var(--ts-line); color: var(--sc-ink); text-decoration: none; cursor: pointer;
  font-family: var(--sc-font-mono); font-size: 0.76rem; letter-spacing: 0.12em; text-transform: uppercase;
  transition: border-color 160ms var(--sc-ease-out), background-color 160ms var(--sc-ease-out);
}
.bar__btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
@media (hover: hover) and (pointer: fine) { .bar__btn:hover { border-color: var(--ts-line-2); background: rgba(13, 32, 49, 0.9); } }
.bar__cta {
  display: inline-flex; align-items: center; height: 40px; padding: 0 16px; border-radius: 10px; white-space: nowrap;
  background: var(--sc-accent); color: var(--sc-accent-ink); text-decoration: none; font-weight: 800; font-size: 0.86rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.45); transition: background-color 160ms var(--sc-ease-out), transform 120ms var(--sc-ease-out);
}
.bar__cta:active { transform: translateY(1px); }
@media (hover: hover) and (pointer: fine) { .bar__cta:hover { background: #63ccfa; } }

@media (max-width: 900px) {
  :root { --ts-bar-h: 58px; }
  .bar { gap: 8px; padding-bottom: 6px; }
  .bar__name { display: none; }
  .bar__brand { padding: 6px; }
  .bar__btn--text span { display: none; }
  .bar__btn kbd { display: none; }
  .bar__btn { width: 42px; justify-content: center; padding: 0; height: 42px; }
  .bar__cta { height: 42px; padding: 0 14px; font-size: 0.84rem; }
  .bar__parts { position: absolute; left: 0; right: 0; bottom: -2px; margin: 0; padding: 0 12px; height: 8px; border: 0; border-radius: 0; background: none; gap: 3px; }
  .seg { flex: 1; width: auto; height: 8px; }
  .seg i { height: 3px; }
  .seg__tip { display: none; }
}

/* ------------------------------------------------------------- dialogs: contents drawer and search */
dialog { color: var(--sc-ink); }
dialog::backdrop { background: rgba(2, 7, 12, 0.72); }
.drawer {
  margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(30rem, 100vw); padding: 0; border: 0; border-left: 1px solid var(--ts-line-2);
  background: #08151f; overflow-y: auto; overscroll-behavior: contain;
}
.drawer[open] { animation: drawer-in 320ms var(--sc-ease-drawer); }
@keyframes drawer-in { from { transform: translateX(40px); opacity: 0; } }
.drawer__head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 12px; padding: 18px 22px; background: #08151f; border-bottom: 1px solid var(--ts-line); }
.drawer__head .label { margin-right: auto; color: var(--sc-ink); }
.drawer__gl { font-family: var(--sc-font-mono); font-size: 0.74rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--sc-accent); }
.x { cursor: pointer; background: transparent; border: 1px solid var(--ts-line-2); border-radius: 8px; padding: 6px 10px; font-family: var(--sc-font-mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--sc-ink-soft); }
.x:hover { color: var(--sc-ink); }

.toc-all { padding: 6px 22px 28px; }
.toc-all__mod h3 { font-family: var(--sc-font-mono); font-size: 0.72rem; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--sc-ink-soft); margin: 22px 0 8px; }
.toc-all__mod h3 span { color: var(--sc-accent); margin-right: 0.5em; }
.toc-all ol { list-style: none; margin: 0; padding: 0; }
.toc-all a { display: grid; grid-template-columns: 2.4rem 1fr 14px; align-items: center; gap: 10px; padding: 9px 10px; margin: 0 -10px; border-radius: 8px; text-decoration: none; color: var(--sc-ink); font-size: 0.95rem; font-weight: 550; line-height: 1.35; }
.toc-all a:hover { background: rgba(55, 189, 248, 0.07); }
.toc-all .n { font-family: var(--sc-font-mono); font-size: 0.76rem; color: var(--ts-dim); }
.toc-all .d { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid rgba(150, 162, 182, 0.45); }
.toc-all a.is-done .d { background: var(--sc-accent); border-color: var(--sc-accent); }
.toc-all a.is-here { background: rgba(55, 189, 248, 0.1); }

.search {
  width: min(44rem, calc(100vw - 24px)); max-height: min(78vh, 46rem); margin: 9vh auto auto; padding: 0;
  border: 1px solid var(--ts-line-2); border-radius: 16px; background: #08151f; overflow: hidden;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8);
}
.search[open] { display: flex; flex-direction: column; animation: search-in 220ms var(--sc-ease-out); }
@keyframes search-in { from { transform: translateY(-8px) scale(0.98); opacity: 0; } }
.search__form { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--ts-line); margin: 0; }
.search__form svg { width: 20px; height: 20px; fill: none; stroke: var(--sc-accent); stroke-width: 1.8; stroke-linecap: round; flex: none; }
.search__form input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; font-size: 1.1rem; font-weight: 550; color: var(--sc-ink); padding: 6px 0; }
.search__form input::placeholder { color: var(--ts-dim); }
.search__results { list-style: none; margin: 0; padding: 8px; overflow-y: auto; }
.search__results:empty { display: none; }
.search__results a { display: block; padding: 12px 14px; border-radius: 10px; text-decoration: none; color: var(--sc-ink); }
.search__results a[aria-selected="true"], .search__results a:hover { background: rgba(55, 189, 248, 0.09); }
.search__results .where { font-family: var(--sc-font-mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--sc-accent); }
.search__results .h { display: block; font-weight: 700; margin-top: 3px; }
.search__results .x2 { display: block; color: var(--sc-ink-soft); font-size: 0.9rem; line-height: 1.5; margin-top: 4px; }
.search__results mark { background: rgba(55, 189, 248, 0.22); color: var(--sc-ink); border-radius: 3px; padding: 0 2px; }
.search__results .none { padding: 18px 14px; color: var(--sc-ink-soft); }
.search__hint { margin: 0; padding: 12px 16px 16px; color: var(--ts-dim); font-size: 0.86rem; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.search__hint button { cursor: pointer; background: rgba(55,189,248,0.06); border: 1px solid var(--ts-line); color: var(--sc-ink-soft); border-radius: 999px; padding: 4px 12px; font-size: 0.82rem; }
.search__hint button:hover { color: var(--sc-ink); border-color: var(--ts-line-2); }

/* ------------------------------------------------------------- glossary popover */
a.gl { color: var(--sc-ink); text-decoration: underline dotted; text-decoration-color: rgba(55, 189, 248, 0.75); text-decoration-thickness: 1.5px; text-underline-offset: 0.24em; cursor: help; }
a.gl:hover, a.gl[aria-expanded="true"] { color: var(--sc-accent); }
.gpop {
  position: absolute; z-index: 80; width: min(22rem, calc(100vw - 24px)); padding: 14px 16px 12px;
  background: #0b1d2c; border: 1px solid var(--ts-line-2); border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3), 0 16px 40px -10px rgba(0, 0, 0, 0.75);
  font-size: 0.92rem; line-height: 1.55; color: var(--sc-ink-soft);
  opacity: 0; transform: translateY(4px); transition: opacity 140ms var(--sc-ease-out), transform 160ms var(--sc-ease-out);
}
.gpop.is-on { opacity: 1; transform: none; }
.gpop__t { font-family: var(--sc-font-display); font-weight: 800; color: var(--sc-ink); font-size: 1rem; margin: 0 0 4px; }
.gpop p { margin: 0; }
.gpop__more { display: inline-block; margin-top: 8px; font-family: var(--sc-font-mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--sc-accent); }
.gpop a.xref { color: var(--sc-ink); }

/* ------------------------------------------------------------- the machine (signature) */
.machine { position: relative; display: block; }
.machine svg { width: 100%; height: 100%; overflow: visible; }
.m-arc { fill: none; stroke: rgba(55, 189, 248, 0.16); stroke-linecap: round; }
.m-node { fill: #0a1a28; stroke: rgba(150, 162, 182, 0.5); }
.m-node.is-done { fill: var(--sc-accent); stroke: var(--sc-accent); }
.m-node.is-here { stroke: #fff; }
.m-node.is-next { stroke: #fff; }
.m-pool { fill: url(#m-pool); }
.m-hub { fill: none; stroke: rgba(55, 189, 248, 0.1); }

/* ------------------------------------------------------------- reading pages */
.read { padding-top: var(--ts-bar-h); }
.readbar { position: fixed; left: 0; right: 0; top: var(--ts-bar-h); height: 2px; z-index: 59; pointer-events: none; }
.readbar i { display: block; height: 100%; background: var(--sc-accent); transform-origin: 0 50%; transform: scaleX(0); }
@media (max-width: 900px) { .readbar { top: calc(var(--ts-bar-h) + 6px); } }

.chead { position: relative; overflow: clip; padding: clamp(2.5rem, 6vw, 5rem) var(--sc-gutter) clamp(2rem, 4vw, 3rem); isolation: isolate; }
.chead::before { content: ""; position: absolute; inset: -20% -10% 0; z-index: -1;
  background: radial-gradient(60rem 26rem at 30% 0%, rgba(55, 189, 248, 0.13), transparent 70%),
              radial-gradient(40rem 20rem at 90% 30%, rgba(44, 169, 225, 0.06), transparent 70%); }
.chead::after { content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0.6;
  background-image: linear-gradient(rgba(55, 189, 248, 0.045) 1px, transparent 1px), linear-gradient(90deg, rgba(55, 189, 248, 0.045) 1px, transparent 1px);
  background-size: 64px 64px; -webkit-mask-image: radial-gradient(ellipse at 30% 10%, #000 10%, transparent 70%); mask-image: radial-gradient(ellipse at 30% 10%, #000 10%, transparent 70%); }
.chead__in { max-width: 74rem; margin: 0 auto; display: grid; grid-template-columns: 1fr auto; gap: clamp(1.5rem, 4vw, 4rem); align-items: end; }
.chead__mod { color: var(--sc-accent); }
.chead__title { font-family: var(--sc-font-display); font-weight: 850; font-size: clamp(2.2rem, 1.5rem + 3.2vw, 4.2rem); line-height: 1.02; letter-spacing: -0.03em; margin: 14px 0 0; text-wrap: balance; max-width: 18ch; }
.chead__num { display: block; font-family: var(--sc-font-mono); font-weight: 500; font-size: 0.9rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ts-dim); margin-bottom: 10px; }
.chead__sub { font-size: clamp(1.08rem, 1rem + 0.35vw, 1.3rem); line-height: 1.5; color: var(--sc-ink-soft); max-width: 46ch; margin: 18px 0 0; text-wrap: pretty; font-weight: 450; }
.chead__meta { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-top: 22px; }
.chead__done { color: var(--sc-accent-ink); background: var(--sc-accent); border-radius: 6px; padding: 3px 9px; letter-spacing: 0.14em; }
.chead__machine { display: block; width: 168px; height: 168px; border-radius: 50%; }
.chead__machine [data-machine] { display: block; width: 100%; height: 100%; }
@media (max-width: 760px) {
  .chead__in { grid-template-columns: 1fr; }
  .chead__machine { display: none; }
  .chead__num { font-size: 0.78rem; }
}

.cvideo { margin: 0 auto; padding: 0 var(--sc-gutter); max-width: calc(64rem + 2 * var(--sc-gutter)); }
.cvideo__frame { position: relative; aspect-ratio: 16 / 9; border-radius: var(--ts-r); overflow: hidden; background: #050d15; border: 1px solid var(--ts-line-2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 4px 10px rgba(0,0,0,0.3), 0 30px 70px -24px rgba(0, 0, 0, 0.85); }
.cvideo video { width: 100%; height: 100%; object-fit: cover; background: #050d15; }
.cvideo figcaption { margin-top: 12px; font-family: var(--sc-font-mono); font-size: 0.74rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ts-dim); }
@media (max-width: 600px) { .cvideo { padding: 0; } .cvideo__frame { border-radius: 0; border-left: 0; border-right: 0; } .cvideo figcaption { padding: 0 var(--sc-gutter); } }

.rlayout { max-width: 74rem; margin: 0 auto; padding: clamp(2rem, 5vw, 4rem) var(--sc-gutter) 0; display: grid; grid-template-columns: 15rem minmax(0, 44rem); gap: clamp(2rem, 5vw, 5rem); justify-content: center; }
.rtoc { position: relative; }
.rtoc__d { position: sticky; top: calc(var(--ts-bar-h) + 28px); }
.rtoc summary { list-style: none; cursor: pointer; margin-bottom: 12px; }
.rtoc summary::-webkit-details-marker { display: none; }
.rtoc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--ts-line); }
.rtoc a { display: block; padding: 7px 0 7px 16px; margin-left: -1px; border-left: 1px solid transparent; text-decoration: none; color: var(--ts-dim); font-size: 0.88rem; line-height: 1.4; font-weight: 500; transition: color 140ms var(--sc-ease-out); }
.rtoc a:hover { color: var(--sc-ink); }
.rtoc a.is-on { color: var(--sc-ink); border-left-color: var(--sc-accent); }
.rtoc a .gl, .rtoc a a { pointer-events: none; text-decoration: none; color: inherit; }
@media (max-width: 1080px) {
  .rlayout { grid-template-columns: minmax(0, 44rem); }
  .rtoc__d { position: static; border: 1px solid var(--ts-line); border-radius: 12px; padding: 14px 16px; background: rgba(13, 32, 49, 0.4); }
  .rtoc summary { margin: 0; display: flex; justify-content: space-between; }
  .rtoc summary::after { content: "+"; font-family: var(--sc-font-mono); color: var(--sc-accent); }
  .rtoc__d[open] summary::after { content: "−"; }
  .rtoc__d[open] summary { margin-bottom: 10px; }
}

/* prose: the taste floor for long reading */
.prose { font-size: clamp(1.0625rem, 1.02rem + 0.2vw, 1.125rem); line-height: 1.74; color: #dfe7f0; font-weight: 450; min-width: 0; }
.prose > * { max-width: 66ch; }
.prose p { margin: 0 0 1.15em; text-wrap: pretty; }
.prose h2 { font-family: var(--sc-font-display); font-weight: 800; font-size: clamp(1.45rem, 1.2rem + 1vw, 1.95rem); line-height: 1.18; letter-spacing: -0.02em; color: var(--sc-ink); margin: 2.6em 0 0.7em; text-wrap: balance; }
.prose > h2:first-child { margin-top: 0; }
.prose h3 { font-family: var(--sc-font-display); font-weight: 750; font-size: 1.16rem; line-height: 1.3; letter-spacing: -0.01em; color: var(--sc-ink); margin: 2em 0 0.5em; }
.prose h4 { font-family: var(--sc-font-mono); font-weight: 500; font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--sc-ink-soft); margin: 1.8em 0 0.5em; }
.prose strong { font-weight: 700; color: #fff; }
.prose em { font-style: italic; }
.prose a:not(.gl) { color: var(--sc-ink); text-decoration-color: rgba(55, 189, 248, 0.6); }
.prose a:not(.gl):hover { color: var(--sc-accent); }
.prose code { overflow-wrap: anywhere; word-break: break-word; font-family: var(--sc-font-mono); font-size: 0.86em; background: rgba(55, 189, 248, 0.08); border: 1px solid var(--ts-line); border-radius: 5px; padding: 0.05em 0.35em; }
.prose ul, .prose ol { margin: 0 0 1.3em; padding-left: 1.5em; }
.prose li { margin: 0.42em 0; padding-left: 0.2em; }
.prose ul > li::marker { color: var(--sc-accent); content: "■  "; font-size: 0.6em; }
.prose ol > li::marker { color: var(--sc-accent); font-family: var(--sc-font-mono); font-size: 0.86em; font-weight: 500; }
.prose li > ul { margin: 0.3em 0 0.3em; }
.prose hr { border: 0; height: 1px; background: var(--ts-line); margin: 3em 0; }
.prose li.task { list-style: none; margin-left: -1.5em; }
.prose li.task::marker { content: none; }
.prose li.task label { display: grid; grid-template-columns: 1.4rem 1fr; gap: 0.6em; align-items: start; cursor: pointer; }
.prose li.task input { width: 1.15rem; height: 1.15rem; margin-top: 0.32em; accent-color: var(--sc-accent); }
.prose li.task input:checked + span { color: var(--sc-ink-soft); text-decoration: line-through; text-decoration-color: rgba(55,189,248,0.6); }

.callout { position: relative; margin: 2em 0; padding: 1.15em 1.35em 1.05em; border-radius: 12px; background: rgba(13, 32, 49, 0.62); border: 1px solid var(--ts-line); box-shadow: inset 0 1px 0 rgba(255,255,255,0.05); max-width: 66ch; }
.callout p:last-child, .callout ul:last-child, .callout ol:last-child { margin-bottom: 0; }
.callout-label { font-family: var(--sc-font-mono); font-size: 0.72rem; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; color: var(--sc-ink-soft); margin-bottom: 0.55em; display: flex; align-items: center; gap: 0.6em; }
.callout-label::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: currentColor; }
.callout-key { background: linear-gradient(180deg, rgba(55, 189, 248, 0.11), rgba(55, 189, 248, 0.05)); border-color: rgba(55, 189, 248, 0.34); }
.callout-key .callout-label { color: var(--sc-accent); }
.callout-key p { color: var(--sc-ink); font-weight: 550; }
.callout-warn { border-color: rgba(240, 144, 37, 0.34); background: rgba(240, 144, 37, 0.06); }
.callout-warn .callout-label { color: var(--ts-orange); }
.callout-asof { background: transparent; border-style: dashed; border-color: rgba(150, 162, 182, 0.35); font-size: 0.95em; }
.callout-asof .callout-label::before { border-radius: 50%; }
.callout-annex { background: rgba(13, 32, 49, 0.4); }
.callout-annex .callout-label { color: var(--sc-ink); }
.callout-tip .callout-label { color: #b7e6fb; }

.table-wrap { max-width: 100%; overflow-x: auto; margin: 1.8em 0; border: 1px solid var(--ts-line); border-radius: 12px; }
.prose .table-wrap { max-width: min(100%, 52rem); }
table.t { border-collapse: collapse; width: 100%; font-size: 0.92rem; line-height: 1.5; font-variant-numeric: tabular-nums; }
table.t th { text-align: left; font-family: var(--sc-font-mono); font-weight: 500; font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--sc-accent); background: rgba(13, 32, 49, 0.7); padding: 12px 14px; vertical-align: bottom; }
table.t td { padding: 11px 14px; border-top: 1px solid rgba(55, 189, 248, 0.1); vertical-align: top; color: #dbe4ee; }
table.t tr:nth-child(even) td { background: rgba(13, 32, 49, 0.25); }

/* done switch + pager */
.donebox { margin: 4.5em 0 2.5em; padding: 22px; border-radius: 16px; border: 1px solid var(--ts-line-2); background: var(--ts-glass); display: grid; grid-template-columns: 132px 1fr; gap: 24px; align-items: center; box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 20px 50px -24px rgba(0,0,0,0.8); max-width: 66ch; }
.donebox__machine { width: 132px; height: 132px; }
.donebox__machine [data-machine] { display: block; width: 100%; height: 100%; }
.donebox__q { font-family: var(--sc-font-display); font-weight: 800; font-size: 1.25rem; color: var(--sc-ink); margin: 0; }
.donebox__s { margin: 6px 0 16px !important; color: var(--sc-ink-soft); font-size: 0.98rem; line-height: 1.55; }
.donebox__btn { cursor: pointer; display: inline-flex; align-items: center; gap: 10px; border-radius: 10px; padding: 12px 18px; font-weight: 800; font-size: 0.95rem;
  background: transparent; color: var(--sc-ink); border: 1px solid var(--sc-accent); transition: background-color 160ms var(--sc-ease-out), color 160ms var(--sc-ease-out), transform 120ms var(--sc-ease-out); }
.donebox__btn::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--sc-accent); }
.donebox__btn:active { transform: scale(0.98); }
.donebox__btn .on { display: none; }
.donebox__btn[aria-pressed="true"] { background: var(--sc-accent); color: var(--sc-accent-ink); }
.donebox__btn[aria-pressed="true"]::before { background: var(--sc-accent-ink); border-color: var(--sc-accent-ink); }
.donebox__btn[aria-pressed="true"] .on { display: inline; }
.donebox__btn[aria-pressed="true"] .off { display: none; }
@media (hover: hover) and (pointer: fine) { .donebox__btn[aria-pressed="false"]:hover { background: rgba(55, 189, 248, 0.1); } }
@media (max-width: 520px) { .donebox { grid-template-columns: 1fr; text-align: left; } .donebox__machine { width: 110px; height: 110px; } }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 0 0 4rem; max-width: 66ch; }
.pager__a { display: block; padding: 18px 20px; border-radius: 14px; border: 1px solid var(--ts-line); text-decoration: none; background: rgba(13, 32, 49, 0.35); transition: border-color 160ms var(--sc-ease-out), background-color 160ms var(--sc-ease-out); }
.pager__a:hover { border-color: var(--ts-line-2); background: rgba(13, 32, 49, 0.7); }
.pager__next { text-align: right; grid-column: 2; }
.pager__t { display: block; margin-top: 6px; font-family: var(--sc-font-display); font-weight: 750; font-size: 1.02rem; line-height: 1.3; color: var(--sc-ink); }
@media (max-width: 520px) { .pager { grid-template-columns: 1fr; } .pager__next { grid-column: auto; } }

.sfoot { border-top: 1px solid var(--ts-line); padding: 28px var(--sc-gutter) 40px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; color: var(--ts-dim); font-family: var(--sc-font-mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; }
.sfoot p { margin: 0; }
.sfoot a { color: var(--sc-ink-soft); }

/* glossary page */
.gtools { position: sticky; top: var(--ts-bar-h); z-index: 20; background: rgba(7, 18, 28, 0.96); border-bottom: 1px solid var(--ts-line); padding: 12px var(--sc-gutter); display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: center; }
.gfilter { display: flex; align-items: center; gap: 12px; }
.gfilter input { width: min(20rem, 60vw); background: rgba(13, 32, 49, 0.7); border: 1px solid var(--ts-line-2); border-radius: 10px; padding: 9px 12px; font-size: 1rem; color: var(--sc-ink); }
.gfilter input:focus { outline: 2px solid var(--sc-accent); outline-offset: 2px; }
.gjump { display: flex; flex-wrap: wrap; gap: 2px; }
.gjump a { font-family: var(--sc-font-mono); font-size: 0.78rem; color: var(--sc-ink-soft); text-decoration: none; min-width: 26px; height: 30px; display: grid; place-items: center; border-radius: 6px; }
.gjump a:hover { color: var(--sc-ink); background: rgba(55, 189, 248, 0.1); }
.prose--gl { max-width: 50rem; margin: 0 auto; padding: 2.5rem var(--sc-gutter) 4rem; }
.glist { margin: 0; }
.gterm { padding: 20px 0 16px; border-top: 1px solid rgba(55, 189, 248, 0.1); scroll-margin-top: calc(var(--ts-bar-h) + 80px); }
.gterm dt { font-family: var(--sc-font-display); font-weight: 800; font-size: 1.18rem; color: var(--sc-ink); letter-spacing: -0.01em; }
.gterm dd { margin: 6px 0 0; color: #d4dee9; }
.gterm dd p { margin: 0 0 0.6em; }
.gterm:target { background: linear-gradient(90deg, rgba(55,189,248,0.08), transparent 70%); margin: 0 -16px; padding-left: 16px; padding-right: 16px; border-radius: 10px; }
.gterm[hidden] { display: none; }
@media (max-width: 760px) { .gtools { position: static; } }

/* machine text + states (shared by the home close, chapter headers, done box) */
.m-mod { font-family: var(--sc-font-mono); font-size: 5.6px; letter-spacing: 0.08em; fill: #7f91a6; }
.m-count { font-family: var(--sc-font-display); font-weight: 900; font-size: 30px; letter-spacing: -0.04em; fill: #fff; }
.m-of { font-family: var(--sc-font-mono); font-size: 5.4px; letter-spacing: 0.22em; fill: var(--sc-accent); }
.m-cur { font-family: var(--sc-font-display); font-weight: 900; font-size: 24px; letter-spacing: -0.03em; fill: #fff; }
.m-ping { fill: none; stroke: #fff; stroke-width: 0.8; opacity: 0.6; transform-box: fill-box; transform-origin: center; }
@media (prefers-reduced-motion: no-preference) {
  .m-ping { animation: m-ping 2.4s var(--sc-ease-out) infinite; }
  .m-node.is-new { transform-box: fill-box; transform-origin: center; animation: m-new 900ms var(--sc-ease-out); }
}
@keyframes m-ping { 0% { transform: scale(0.7); opacity: 0.8; } 80%, 100% { transform: scale(1.9); opacity: 0; } }
@keyframes m-new { 0% { transform: scale(2.4); } 100% { transform: scale(1); } }
.machine a { outline: none; }
.machine a:focus-visible .m-node { stroke: #fff; stroke-width: 2.2; }
.machine a:hover .m-node:not(.is-done) { stroke: var(--sc-accent); }

/* sync note under the done switch: only when progress could not reach the account yet */
.donebox__sync { margin: 12px 0 0 !important; color: var(--ts-orange); text-transform: none; letter-spacing: 0.06em; font-size: 0.76rem; line-height: 1.5; }
.donebox__sync:empty { display: none; }
