@import url('/static/vendor/prism/prism-tomorrow.min.css');

:root {
  --bg: #080A0F;
  --panel: rgba(12, 15, 22, 0.78);
  --ink: #F2E3C2;
  --muted: #9FA8Bd;
  --line: rgba(255, 176, 0, 0.22);
  --amber: #FFB000;
  --amber-hi: #FFD34D;
  --blue: #5A8CE0;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "EB Garamond", Georgia, serif;
  font-size: 18.5px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.bg-photo {
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(120% 80% at 50% -12%, rgba(90, 140, 224, 0.12), rgba(90, 140, 224, 0) 46%),
    linear-gradient(180deg, rgba(46, 78, 150, 0.09) 0%, rgba(46, 78, 150, 0) 55%),
    var(--bg);
}
.bg-photo::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(130% 100% at 50% 34%, transparent 60%, rgba(0, 0, 0, 0.6) 100%);
}

.content { position: relative; z-index: 2; }
.wrap { max-width: 820px; margin: 0 auto; padding: 0 32px; }

header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  background: rgba(7, 9, 14, 0.55);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(90, 140, 224, 0.16);
}
.header-in {
  max-width: 1000px; margin: 0 auto; padding: 12px 32px;
  display: flex; justify-content: space-between; align-items: center;
}
.logo { display: inline-flex; align-items: center; line-height: 0; }
.logo img { height: 34px; width: auto; display: block; }
.back {
  font-size: 14.5px; color: var(--muted); text-decoration: none;
  letter-spacing: 0.06em; transition: color .2s;
  display: inline-flex; align-items: center;
}
.back:hover { color: var(--amber-hi); }

.room-hero { padding: 170px 0 56px; text-align: center; }
.room-hero .room-num {
  font-size: 15px; color: var(--blue); letter-spacing: 0.22em; margin-bottom: 14px;
  text-transform: uppercase;
}
.room-hero h1 {
  font-weight: 500; font-size: clamp(30px, 5vw, 46px); line-height: 1.15;
  color: var(--ink); text-shadow: 0 2px 18px rgba(0, 0, 0, 0.9);
}
.room-hero h1 em { font-style: italic; color: var(--amber); }
.room-hero .meta { margin-top: 16px; font-size: 15px; color: var(--muted); letter-spacing: 0.08em; }

.room-hero .meta.diff {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  letter-spacing: normal;
}
.room-hero .meta.diff .diff-sep { width: 14px; }
.room-hero .meta .star {
  width: 15px; height: 15px; display: block;
  fill: rgba(255, 176, 0, 0.07); stroke: rgba(255, 176, 0, 0.32);
  stroke-width: 1.4; stroke-linejoin: round;
}
.room-hero .meta .star.on {
  fill: var(--amber); stroke: var(--amber-hi);
  filter: drop-shadow(0 0 4px rgba(255, 176, 0, 0.35));
}
.room-hero .meta .anth-ico {
  width: 15px; height: 15px; display: block; fill: var(--amber); opacity: 0.75;
}
.room-hero .meta .book,
.room-hero .meta .code-ico {
  width: 18px; height: 18px; display: block; stroke: var(--amber);
  stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round;
  opacity: 0.75;
}
.room-hero .meta .book { fill: rgba(255, 176, 0, 0.06); }
.room-hero .meta .code-ico { fill: none; }

.room-hero .intro {
  margin: 34px auto 0; max-width: 34em; font-size: 20px; color: var(--muted);
  line-height: 1.8; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9);
}
.room-hero .intro strong { color: var(--ink); font-weight: 600; }

section { padding: 36px 0 0; }
section:last-of-type { padding-bottom: 40px; }
.card {
  background: var(--panel); backdrop-filter: blur(3px);
  border: 1px solid var(--line); border-radius: 12px; padding: 44px 48px;
}
@media (max-width: 600px) { .card { padding: 28px 22px; } }
h2 {
  font-weight: 600; font-size: 15px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 28px;
}
.card p { color: var(--ink); font-size: 17.5px; margin-bottom: 18px; }
.card p:last-child { margin-bottom: 0; }

.card > * + * { margin-top: 18px; }

.card > figure + *,     .card > * + figure,
.card > .mtx-scroll + *, .card > * + .mtx-scroll,
.card > .mtx-grid + *,   .card > * + .mtx-grid,
.card > .mtx-add + *,    .card > * + .mtx-add,
.card > .prob-bars + *,  .card > * + .prob-bars,
.card > .tw-root + *,    .card > * + .tw-root,
.card > .mviz + *,       .card > * + .mviz { margin-top: 30px; }
.card p .dim { color: var(--muted); }
.card em { color: var(--amber); font-style: italic; }
.card ul { margin: 0 0 18px 22px; color: var(--muted); font-size: 17px; }
.card li { margin-bottom: 6px; }
.card li strong { color: var(--ink); font-weight: 600; }

.steps { display: grid; gap: 32px; counter-reset: step; }
.step { display: grid; grid-template-columns: 48px 1fr; gap: 18px; }
.step::before {
  counter-increment: step; content: counter(step, decimal-leading-zero);
  font-size: 14px; color: var(--amber); padding-top: 3px;
}
.step h3 { font-size: 20px; font-weight: 600; margin-bottom: 8px; color: var(--ink); }
.step p { color: var(--muted); font-size: 17px; line-height: 1.75; margin-bottom: 12px; }

.bpe-steps {
  list-style: none;
  counter-reset: step;
  margin: 6px 0 18px; padding: 0;
  display: grid; gap: 14px;
}
.bpe-steps li {
  counter-increment: step;
  position: relative; padding-left: 48px; min-height: 32px; min-width: 0;
  color: var(--ink); font-size: 17.5px; line-height: 1.55;
}
.bpe-steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 176, 0, 0.55);
  background: rgba(255, 176, 0, 0.09);
  color: var(--amber);
  font-family: "JetBrains Mono", monospace; font-size: 15px; font-weight: 600;
  line-height: 1;
}

.bpe-steps li > * + * { margin-top: 14px; }
.bpe-steps li > p:last-child { margin-bottom: 0; }

pre.terminal {
  background: rgba(0, 0, 0, 0.72); border: 1px solid var(--line); border-radius: 10px;
  padding: 24px 28px; overflow-x: auto;
  font-family: "JetBrains Mono", monospace; font-size: 14.5px; line-height: 1.85;
}
pre.terminal code {
  font-family: inherit; font-size: inherit; line-height: inherit; white-space: pre;
  background: transparent; border: none; border-radius: 0; padding: 0;
}
.terminal .dim { color: #6b7488; }
.terminal .green { color: var(--amber); }
.terminal .flag { color: var(--amber-hi); font-weight: 600; text-shadow: 0 0 10px rgba(255, 176, 0, 0.5); }
.term-caption { margin-top: 4px; font-size: 15.5px; color: var(--muted); }

pre.terminal.output { color: #B4E7B9; border-color: rgba(112, 200, 118, 0.4); }
pre.terminal.output code { color: #B4E7B9; }
figcaption { text-align: center; color: var(--muted); font-size: 15px; margin-top: 8px; font-style: italic; }

.reveal { position: relative; }
.reveal > .output { filter: blur(9px); clip-path: inset(0 round 10px); user-select: none; transition: filter .35s ease; }
.reveal.shown > .output { filter: none; clip-path: none; user-select: text; }
.reveal-btn {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.72); border: none; border-radius: 10px; color: var(--muted);
  cursor: pointer; font-family: inherit; font-size: 15px; letter-spacing: 0.08em; transition: color .2s;
}
.reveal-btn:hover { color: var(--ink); }
.reveal.shown .reveal-btn { opacity: 0; pointer-events: none; transition: opacity .3s ease; }

p.note {
  border-left: 3px solid var(--amber); background: rgba(255, 176, 0, 0.05);
  padding: 12px 18px; border-radius: 0 8px 8px 0; color: var(--muted); font-size: 16.5px;
}

.recap { margin-top: 26px; padding: 22px 26px; background: rgba(0, 0, 0, 0.45); border: 1px solid var(--line); border-radius: 10px; }
.recap > p:first-child {
  font-size: 13.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--amber); margin-bottom: 14px;
}
.recap ul { margin-bottom: 0; }

.card img.ilu { display: block; width: 100%; border: 1px solid var(--line); border-radius: 10px; margin: 20px 0 6px; }

.code-wrap { position: relative; }
.code-wrap pre { padding-right: 56px; }
.copy-btn {
  position: absolute; top: 12px; right: 12px; display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; background: rgba(10, 10, 6, 0.85); border: 1px solid var(--line);
  border-radius: 7px; color: var(--muted); cursor: pointer; transition: color .2s, border-color .2s; z-index: 3;
}
.copy-btn:hover { color: var(--amber-hi); border-color: rgba(255, 176, 0, 0.55); }
.copy-btn.copied { color: var(--amber); border-color: rgba(255, 176, 0, 0.55); }
.copy-btn svg { width: 15px; height: 15px; }

.quiz-q { padding: 16px 0; }
.quiz-question { font-size: 18px; }
.quiz-num { font-size: 13.5px; color: var(--muted); letter-spacing: 0.1em; margin-right: 8px; }
.quiz-answers { display: grid; gap: 10px; margin-top: 14px; }
.quiz-answers button {
  font-family: inherit; font-size: 16.5px; text-align: left; color: var(--ink);
  background: rgba(0, 0, 0, 0.45); border: 1px solid var(--line); border-radius: 9px;
  padding: 12px 18px; cursor: pointer; transition: border-color .2s, color .2s, box-shadow .2s;
}
.quiz-answers button:hover:not(:disabled) { border-color: rgba(255, 176, 0, 0.6); color: var(--amber-hi); }
.quiz-answers button:disabled { cursor: default; }
.quiz-answers button.chosen-ok { border-color: rgba(112, 200, 118, 0.8); color: #B4E7B9; box-shadow: 0 0 16px rgba(112, 200, 118, 0.3); }
.quiz-answers button.chosen-err { border-color: rgba(217, 106, 85, 0.8); color: #EBA394; box-shadow: 0 0 16px rgba(217, 106, 85, 0.3); }

.inline-quiz { margin: 26px 0; }
.inline-quiz .quiz-question { margin-bottom: 0; }
.inline-quiz .iq-exp { margin: 14px 0 0; color: var(--muted); font-size: 16px; }
.quiz-score { padding: 4px 0 22px; border-bottom: 1px solid rgba(255, 176, 0, 0.12); margin-bottom: 8px; }
.quiz-score p { margin-bottom: 10px; }
.quiz-score strong { color: var(--amber); font-size: 24px; }
.quiz-flavor { color: var(--muted); }

.quiz-stats { display: flex; flex-wrap: wrap; gap: 14px 40px; margin-bottom: 16px; }
.quiz-stat { display: flex; flex-direction: column; gap: 3px; }
.quiz-stat-label { font-size: 12px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }
.quiz-stat-val { color: var(--amber); font-size: 26px; line-height: 1; font-weight: 600; }

.quiz-stat-val.pass { color: #B4E7B9; text-shadow: 0 0 18px rgba(112, 200, 118, 0.28); }
.quiz-stat-val.fail { color: #EBA394; text-shadow: 0 0 18px rgba(217, 106, 85, 0.25); }
.quiz-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 16px; }
.quiz-retry {
  padding: 11px 22px; font-family: inherit; font-size: 14px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink); background: rgba(10, 10, 6, 0.55);
  border: 1px solid rgba(242, 227, 194, 0.3); border-radius: 10px; cursor: pointer; transition: border-color .25s, color .25s;
}
.quiz-retry:hover { border-color: rgba(255, 176, 0, 0.75); color: var(--amber-hi); }
.quiz-retry:disabled, .quiz-retry.is-off {
  opacity: 0.4; cursor: not-allowed; color: var(--muted); border-color: rgba(242, 227, 194, 0.18);
}
.quiz-retry:disabled:hover, .quiz-retry.is-off:hover { border-color: rgba(242, 227, 194, 0.18); color: var(--muted); }
.quiz-attempts { font-size: 13px; color: var(--muted); letter-spacing: 0.02em; }
.quiz-timer { font-size: 13px; color: var(--muted); letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }

.cert-req {
  margin: 4px 0 24px; padding: 18px 22px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--line); border-left: 3px solid var(--amber);
  border-radius: 0 10px 10px 0;
}
.cert-req-tag {
  font-size: 13.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--amber); margin: 0 0 10px;
}
.cert-req p { margin: 0; color: var(--muted); }
.cert-req strong { color: var(--ink); font-weight: 600; }

.task-row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.task-row input {
  flex: 1; min-width: 200px;
  font-family: "JetBrains Mono", monospace; font-size: 15.5px; color: var(--ink);
  background: rgba(0, 0, 0, 0.45); border: 1px solid var(--line); border-radius: 9px;
  padding: 12px 18px; outline: none; transition: border-color .2s, box-shadow .2s;
}
.task-row input:focus { border-color: rgba(255, 176, 0, 0.6); }
.task-row input.task-ok { border-color: rgba(112, 200, 118, 0.8); color: #B4E7B9; box-shadow: 0 0 16px rgba(112, 200, 118, 0.3); }
.task-row input.task-err { border-color: rgba(217, 106, 85, 0.8); color: #EBA394; box-shadow: 0 0 16px rgba(217, 106, 85, 0.3); }
.task-row button {
  font-family: inherit; font-size: 14px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink); background: rgba(10, 10, 6, 0.55); border: 1px solid rgba(242, 227, 194, 0.3);
  border-radius: 9px; padding: 12px 20px; cursor: pointer; transition: border-color .25s, color .25s;
}
.task-row button:hover { border-color: rgba(255, 176, 0, 0.75); color: var(--amber-hi); }
p.task-feedback { margin-top: 14px; font-size: 16.5px; min-height: 1.5em; }
p.task-feedback.ok { color: #B4E7B9; }
p.task-feedback.err { color: #EBA394; }

.task-tick {
  width: 1.15em; height: 1.15em; vertical-align: -0.2em; margin-right: 9px;
  stroke: #7ECB84; fill: none; stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round;
  filter: drop-shadow(0 0 7px rgba(112, 200, 118, 0.35));
}

.task-hint-btn { display: flex; align-items: center; justify-content: center; }
.task-hint-btn svg {
  width: 18px; height: 18px; stroke: currentColor; fill: none;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}

.formula {
  text-align: center;
  font-size: 19px; color: var(--ink);
  padding: 22px 18px;
  margin: 26px 0;
  background: linear-gradient(180deg, rgba(255, 176, 0, 0.09), rgba(255, 176, 0, 0.03));
  border: 1px solid rgba(255, 176, 0, 0.28); border-radius: 10px;
  box-shadow: 0 0 22px rgba(255, 176, 0, 0.07), inset 0 1px 0 rgba(255, 176, 0, 0.12);
}
.formula code { border: none; background: none; padding: 0 2px; font-size: 0.85em; white-space: normal; color: var(--amber-hi); }

code {
  font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; font-size: 0.78em;
  color: #C9B78C; background: rgba(0, 0, 0, 0.5); border: 1px solid var(--line);
  border-radius: 5px; padding: 1px 7px; white-space: nowrap;
}

p a {
  color: var(--amber);
  text-decoration: none;
  transition: color 0.2s;
}
p a:hover {
  color: var(--amber-hi);
}

.loot { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 16px; color: var(--ink); opacity: 0.85; }
.loot .xp { color: var(--amber); font-weight: 600; }

.room-nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 56px;
}
.room-nav a {
  display: flex; align-items: center; gap: 14px; padding: 15px 22px; min-width: 0;
  background: rgba(10, 12, 18, 0.55); backdrop-filter: blur(4px);
  border: 1px solid rgba(242, 227, 194, 0.18); border-radius: 12px; color: var(--ink);
  text-decoration: none;
  transition: border-color .25s ease, color .25s ease, background .25s ease;
}
.room-nav a:hover { border-color: rgba(255, 176, 0, 0.75); color: var(--amber-hi);
  background: rgba(255, 176, 0, 0.06); }

.room-nav .nav-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }

.room-nav .nav-kicker { font-size: 13px; color: var(--muted); }
.room-nav .nav-label { font-size: 16.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.room-nav .nav-next { justify-content: flex-end; text-align: right; }
.room-nav .nav-next .nav-txt { align-items: flex-end; }
@media (max-width: 620px) {
  .room-nav { grid-template-columns: 1fr; }
}

.nav-arrow {
  width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round; flex: none; transition: transform .5s ease;
}

.room-nav a:hover .nav-arrow { transform: translateX(4px) rotate(60deg); }
.room-nav a:hover .nav-arrow.left { transform: translateX(-4px) rotate(-60deg); }
.back .nav-arrow {
  width: 15px; height: 15px; stroke: currentColor; vertical-align: middle; margin-right: 8px;
  transition: transform .5s ease;
}
.back:hover .nav-arrow { transform: translateX(-4px) rotate(-60deg); }

footer { padding: 40px 0 72px; font-size: 15.5px; color: var(--muted); text-align: center; }

.fb-link { display: inline-flex; align-items: center; gap: 9px;
  padding: 9px 18px; border-radius: 22px; font-size: 15px;
  color: #a9d9b8; text-decoration: none;
  border: 1px solid rgba(120,200,140,.3); background: rgba(120,200,140,.07);
  transition: background .2s ease, border-color .2s ease, color .2s ease; }
.fb-link:hover { color: #d6f2e0; border-color: rgba(143,217,168,.75);
  background: rgba(120,200,140,.15); }
.fb-quill { width: 17px; height: 17px; flex: none; }
.foot-sig { margin-top: 16px; }

.mtx-scroll { overflow-x: auto; }
table.mtx {
  border-collapse: separate; border-spacing: 3px; margin: 0 auto;
  font-family: "JetBrains Mono", monospace; font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.mtx caption {
  caption-side: top; text-align: center; padding-bottom: 10px;
  font-size: 13px; letter-spacing: 0.06em; color: var(--muted); white-space: nowrap;
}
.mtx caption strong { color: var(--amber); font-weight: 600; font-size: 14px; }
.mtx th {
  padding: 3px 8px; font-weight: 400; font-size: 12px; color: var(--blue);
  text-align: center; white-space: nowrap;
}
.mtx thead th { color: var(--amber); opacity: 0.85; }
.mtx tbody th { text-align: right; }
.mtx td {
  min-width: 62px; padding: 6px 10px; text-align: right;
  background: rgba(0, 0, 0, 0.5); border: 1px solid rgba(255, 176, 0, 0.1);
  border-radius: 6px; color: var(--ink);
}
.mtx td.zero { color: #55607A; }
.mtx td.ninf {
  text-align: center; color: #D96A55;
  background: rgba(217, 106, 85, 0.05); border-color: rgba(217, 106, 85, 0.22);
}

.mtx tr.hi th { color: var(--amber); }
.mtx tr.hi td {
  color: var(--amber-hi); font-weight: 600;
  background: rgba(255, 176, 0, 0.08); border-color: rgba(255, 176, 0, 0.35);
}

.prob-bars { display: grid; gap: 8px; font-family: "JetBrains Mono", monospace; font-size: 13px; }
.prob-bars .pb { display: grid; grid-template-columns: 48px 1fr 54px; align-items: center; gap: 12px; }
.prob-bars .pb-lab { color: var(--blue); text-align: right; }
.prob-bars .pb-track {
  height: 14px; background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 176, 0, 0.12); border-radius: 4px; overflow: hidden;
}
.prob-bars .pb-fill {
  display: block; height: 100%; border-radius: 3px 0 0 3px;
  background: linear-gradient(90deg, rgba(255, 176, 0, 0.35), rgba(255, 176, 0, 0.85));
}
.prob-bars .pb-val { color: var(--muted); font-variant-numeric: tabular-nums; }
.prob-bars .pb.top .pb-fill { background: linear-gradient(90deg, rgba(255, 176, 0, 0.55), var(--amber)); }
.prob-bars .pb.top .pb-val, .prob-bars .pb.top .pb-lab { color: var(--amber); font-weight: 600; }

.tw-root {
  background: rgba(0, 0, 0, 0.45); border: 1px solid var(--line); border-radius: 10px;
  padding: 22px 24px;
}
.tw-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.tw-title { font-family: "JetBrains Mono", monospace; font-size: 14px; color: var(--ink); line-height: 1.4; }
.tw-sub { font-size: 14.5px; color: var(--muted); margin-top: 4px; }
.tw-tempbox { text-align: right; flex-shrink: 0; }
.tw-templabel { display: block; font-size: 11px; letter-spacing: 0.14em; color: var(--muted); }
.tw-tempval { font-family: "JetBrains Mono", monospace; font-size: 22px; color: var(--amber); font-variant-numeric: tabular-nums; line-height: 1.2; }
.tw-bars { display: grid; gap: 9px; margin-bottom: 22px; }
.tw-row {
  display: grid; grid-template-columns: 76px 1fr 54px; align-items: center; gap: 12px;
  font-family: "JetBrains Mono", monospace; font-size: 12.5px;
}
.tw-tok { color: var(--blue); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tw-track {
  height: 16px; background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 176, 0, 0.12); border-radius: 4px; overflow: hidden;
}
.tw-fill {
  height: 100%; background: linear-gradient(90deg, rgba(255, 176, 0, 0.4), var(--amber));
  transition: width .18s cubic-bezier(.4, 0, .2, 1);
}
.tw-num { color: var(--ink); font-variant-numeric: tabular-nums; }
.tw-controls { margin-bottom: 16px; }
.tw-slider {
  -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 2px;
  background: rgba(255, 176, 0, 0.22); outline: none; margin: 0 0 10px;
}
.tw-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--amber); cursor: pointer; border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--amber);
}
.tw-slider::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--amber); cursor: pointer; border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--amber);
}
.tw-ticks { display: flex; justify-content: space-between; gap: 6px; }
.tw-ticks button {
  background: none; border: none; padding: 2px 0; cursor: pointer; white-space: nowrap;
  font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--muted); transition: color .2s;
}
.tw-ticks button:hover { color: var(--amber-hi); }
.tw-note {
  font-size: 15.5px; line-height: 1.6; color: var(--muted);
  border-top: 1px solid var(--line); padding-top: 14px; min-height: 40px;
}
.tw-note b { color: var(--ink); font-weight: 600; }

.mtx-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 22px 10px; align-items: start; }
.mtx-grid .mtx td { min-width: 52px; padding: 5px 8px; font-size: 12.5px; }

.mtx-grid.qkv { grid-template-columns: repeat(2, minmax(0, 1fr)); justify-items: center; }
.mtx-grid.qkv > :last-child { grid-column: 1 / -1; }
@media (max-width: 560px) { .mtx-grid.qkv { grid-template-columns: 1fr; } }

.mtx-add { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 18px; margin: 4px 0 2px; }
.mtx-add .mtx-plus { font-family: "JetBrains Mono", monospace; font-size: 42px; font-weight: 600; color: var(--amber); line-height: 1; padding: 0 4px; }

.formula.math { font-size: 21px; line-height: 1.4; }
.formula.math .fn { color: var(--amber-hi); }
.formula.math .frac { display: inline-flex; flex-direction: column; vertical-align: middle; margin: 0 5px; text-align: center; }
.formula.math .frac > span { display: block; padding: 2px 10px; }

.formula.math .frac > span:first-of-type { border-bottom: 1px solid rgba(242, 227, 194, 0.55); }
.formula.math .paren { font-size: 1.9em; font-weight: 300; vertical-align: middle; line-height: 0; opacity: 0.8; }
.formula.math sup, .formula.math sub { font-size: 0.6em; }
.formula.math sup .frac { vertical-align: baseline; position: relative; top: -0.55em; margin: 0 2px; }
.formula.math sup .frac > span { padding: 1px 4px; }

.sqrt { position: relative; display: inline-block; padding-left: 0.58em; line-height: 1.1; }

.sqrt > .rad { position: absolute; left: 0; top: 0; width: 0.58em; height: 100%; overflow: visible; }
.sqrt > .rad path {
  fill: none; stroke: currentColor; stroke-width: 1.1;
  stroke-linejoin: miter; stroke-linecap: butt;
  vector-effect: non-scaling-stroke;
}

.sqrt > .rcd { display: inline-block; border-top: 1px solid currentColor; padding: 0.12em 0.18em 0 0.06em; }

.formula.math,
.sqrt { -webkit-user-select: none; user-select: none; }
.math-cpy {
  -webkit-user-select: text; user-select: text;
  display: inline; font-size: 0; line-height: 0; letter-spacing: 0; font-style: normal;
  text-transform: none;
}

h2 .sqrt { text-transform: none; }
h2 .sqrt > .rcd { padding-right: 0.1em; }

.mviz {
  background: rgba(0, 0, 0, 0.45); border: 1px solid var(--line);
  border-radius: 10px; padding: 22px 18px;
}
.mviz .mviz-scroll { overflow-x: auto; padding-bottom: 4px; }
.mviz .stage { display: grid; grid-template-columns: auto auto; gap: 14px; justify-content: center; align-items: start; width: max-content; margin: 0 auto; }
.mviz .mm .lbl {
  text-align: center; font-family: "JetBrains Mono", monospace; font-size: 11.5px;
  letter-spacing: 0.06em; color: var(--muted); margin-bottom: 6px; white-space: nowrap;
}
.mviz table {
  border-collapse: separate; border-spacing: 3px; margin: 0 auto;
  font-family: "JetBrains Mono", monospace; font-size: 12px; font-variant-numeric: tabular-nums;
}
.mviz td {
  width: 54px; height: 30px; text-align: center;
  background: rgba(0, 0, 0, 0.55); border: 1px solid rgba(255, 176, 0, 0.08);
  border-radius: 5px; color: var(--ink);
  transition: background .25s, color .25s, border-color .25s;
}
.mviz td.hdr { width: auto; background: transparent; border-color: transparent; color: var(--muted); font-size: 11px; padding: 0 6px; }
.mviz td.rowhl { background: var(--amber); border-color: var(--amber); color: #151005; }
.mviz td.colhl { background: var(--blue); border-color: var(--blue); color: #0B111E; }
.mviz td.outhl { background: #70C876; border-color: #70C876; color: #0C150D; font-weight: 600; }
.mviz td.donecell { background: rgba(112, 200, 118, 0.12); border-color: rgba(112, 200, 118, 0.3); color: #B4E7B9; }
.mviz td.empty { background: rgba(255, 255, 255, 0.02); border-color: rgba(255, 255, 255, 0.04); }
.mviz .calc {
  margin-top: 16px; min-height: 24px; text-align: center;
  font-family: "JetBrains Mono", monospace; font-size: 12.5px; color: var(--muted);
  overflow-wrap: anywhere;
}
.mviz .calc .r { color: var(--amber); }
.mviz .calc .c { color: #7EA6EF; }
.mviz .calc .o { color: #8FD694; font-weight: 700; }
.mviz .controls { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.mviz .controls button {
  font-family: "EB Garamond", Georgia, serif; font-size: 14px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink); background: rgba(10, 10, 6, 0.55); border: 1px solid rgba(242, 227, 194, 0.3);
  border-radius: 9px; padding: 9px 20px; cursor: pointer; transition: border-color .25s, color .25s;
}
.mviz .controls button:hover { border-color: rgba(255, 176, 0, 0.75); color: var(--amber-hi); }

pre[class*="language-"] {
  background: rgba(0, 0, 0, 0.72) !important; border: 1px solid var(--line) !important;
  border-radius: 10px !important; box-shadow: none !important; text-shadow: none !important;
  font-size: 14.5px !important;
}
code[class*="language-"] {
  background: transparent !important; border: none !important; box-shadow: none !important;
  text-shadow: none !important; padding: 0 !important; white-space: pre !important;
}
