.jm-labs {
  --lab-line: #d2cfc5;
  --lab-paper: #f6f4ed;
  --lab-ink: #252824;
  --lab-muted: #545a53;
  --lab-red: #a33a27;
  color: var(--lab-ink);
  min-width: 0;
}
.lab-topics { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 24px; }
.lab-topics button {
  font: inherit; font-size: .9rem; font-weight: 600; min-height: 42px; padding: 7px 17px;
  border: 1px solid var(--lab-line); background: transparent; border-radius: 4px;
  color: var(--lab-ink); cursor: pointer;
}
.lab-topics button:hover { background: #e9e7de; }
.lab-topics button[aria-pressed="true"] { border-color: var(--lab-ink); color: #fffaf1; background: var(--lab-ink); }
.jm-labs :is(button,input,select,a):focus-visible { outline: 3px solid var(--lab-red); outline-offset: 3px; }
.lab-title { margin: 0; font-size: clamp(1.35rem,2vw,1.9rem); line-height: 1.4; }
.lab-intro { max-width: 74ch; color: var(--lab-muted); margin: 9px 0 21px; line-height: 1.85; }
.lab-instrument { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(198px,.85fr); border: 1px solid var(--lab-line); }
.lab-chart { background: #232822; color: #f2f2e9; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.lab-face-title { padding: 13px 16px 9px; font-size: .82rem; font-weight: 600; color: #e3e9db; border-bottom: 1px solid #434940; }
.lab-scope { display: block; width: 100%; height: auto; }
.lab-scope text { fill: #d1dbce; font-family: "Microsoft YaHei",system-ui,sans-serif; font-size: 13px; }
.lab-scope .big,.lab-scope .byte-text { font-family: ui-monospace,Consolas,monospace; font-weight: 600; font-size: 20px; }
.lab-scope .hot-text { fill: #ffab80; }
.lab-scope .cold-text { fill: #b0d9c6; }
.lab-scope .gridline { fill: none; stroke: #727c6b; stroke-width: .5; opacity: .25; }
.lab-scope .rule,.lab-scope .dial,.lab-scope .rim,.lab-scope .dial-fine { stroke: #839182; stroke-width: 1; fill: none; }
.lab-scope .rim { fill: #899383; stroke-width: 2; }
.lab-scope .ring-gear { fill: #252b25; stroke: #c3c8b9; stroke-width: 1; }
.lab-scope .gear-body,.lab-scope .cross-part,.lab-scope .shaft-body { fill: #4d5b50; stroke: #c7d0bc; stroke-width: 1.1; }
.lab-scope .shaft-body { fill: #7c877a; }
.lab-scope .cross-active { fill: #a85f42; stroke: #ffc6a0; stroke-width: 2; }
.lab-scope .hub,.lab-scope .bar-cold { fill: #aad3bb; }
.lab-scope .bar-base { fill: #4f584f; }
.lab-scope .bar-hot { fill: #ffab80; }
.lab-scope .trace-hot,.lab-scope .trace-cold,.lab-scope .guide,.lab-scope .target-line { fill: none; stroke: #ffab80; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.lab-scope .trace-cold,.lab-scope .target-line { stroke: #a9ccba; stroke-width: 1.7; }
.lab-scope .target-line,.lab-scope .guide { stroke-dasharray: 5 4; }
.lab-scope .guide { stroke: #939f8d; stroke-width: 1; }
.lab-scope .byte-box { fill: #313830; stroke: #586456; stroke-width: .8; }
.lab-settings { padding: 17px 18px; display: flex; flex-direction: column; justify-content: center; gap: 13px; background: var(--lab-paper); }
.lab-control { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 0 5px; font-size: .81rem; line-height: 1.55; }
.lab-control output { color: var(--lab-red); font-variant-numeric: tabular-nums; }
.lab-control input { grid-column: 1/-1; width: 100%; margin: 0; height: 24px; accent-color: var(--lab-red); cursor: pointer; }
.lab-control select { grid-column: 1/-1; min-width: 0; max-width: 100%; width: 100%; font: inherit; min-height: 38px; margin-top: 4px; padding: 5px 8px; color: var(--lab-ink); border: 1px solid var(--lab-line); background: #fffdf7; border-radius: 2px; }
.lab-metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); margin: 0; border: 1px solid var(--lab-line); border-top: 0; }
.lab-metrics div { padding: 11px 15px 13px; min-width: 0; }
.lab-metrics div + div { border-left: 1px solid var(--lab-line); }
.lab-metrics div:nth-child(3n + 1) { border-left: 0; }
.lab-metrics div:nth-child(n + 4) { border-top: 1px solid var(--lab-line); }
.lab-metrics dt { font-size: .75rem; color: var(--lab-muted); }
.lab-metrics dd { margin: 4px 0 0; font-size: clamp(.91rem,1.5vw,1.1rem); font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.lab-method-title { margin: 27px 0 8px; font-size: 1.05rem; }
.lab-method { margin: 0; padding-left: 1.55em; max-width: 80ch; line-height: 1.85; }
.lab-method li { padding-left: .22em; margin: 7px 0; }
.lab-method li::marker { color: var(--lab-red); font-weight: 700; }
.lab-references { margin: 15px 0 22px; display: flex; gap: 2px 18px; flex-wrap: wrap; }
.lab-references a { display: inline-flex; align-items: center; gap: 5px; min-height: 40px; text-decoration: underline; text-underline-offset: 3px; color: var(--lab-red); font-size: .83rem; }
@media(max-width: 800px) {
  .lab-instrument { grid-template-columns: minmax(0,1fr); }
  .lab-settings { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media(max-width: 520px) {
  .lab-topics { gap: 5px; margin-bottom: 17px; }
  .lab-topics button { padding: 5px 10px; font-size: .81rem; min-height: 44px; }
  .lab-settings { grid-template-columns: minmax(0,1fr); padding: 13px; gap: 8px; }
  .lab-metrics div { padding: 9px 7px; }
  .lab-metrics dd { font-size: .9rem; }
  .lab-intro,.lab-method { font-size: .91rem; }
  .lab-scope text { font-size: 15px; }
  .lab-scope .big,.lab-scope .byte-text { font-size: 20px; }
}

/* Software walkthroughs keep the input, source image and explanation together. */
.gear-guide { max-width:1040px; margin-top:24px; }
.gear-intro { border-left:3px solid #75886c; padding:6px 0 6px 23px; margin:0 0 30px; }
.gear-intro>.lesson-button { margin:16px 0 12px; }
.gear-guide p,.gear-guide li { font-size:15px; line-height:1.9!important; color:#414a40; }
.gear-assumption { max-width:88ch; font-size:13px!important; color:#6c5946!important; }
.gear-chapter { border-top:1px solid #acb4a5; padding-top:28px; margin-top:32px; }
.gear-chapter>h4 { display:flex; align-items:baseline; gap:12px; font-size:23px; margin:0 0 18px; line-height:1.4; }
.gear-chapter>h4>span { font:500 18px var(--mono); color:#a33a27; }
.gear-chapter>p { margin:14px 0; max-width:91ch; }
.gear-chapter>ul,.gear-chapter>ol { padding-left:24px; margin:18px 0; }
.gear-chapter li { margin:9px 0; padding-left:4px; }
.gear-equations { display:grid; grid-template-columns:1fr 1fr; margin:24px 0; border-block:1px solid #d5d8cc; }
.gear-equations>div { padding:21px 24px 21px 0; }
.gear-equations>div+div { padding-left:24px; border-left:1px solid #d5d8cc; }
.gear-equations small { display:block; color:#63705e; font-size:12px; }
.gear-equations strong { display:block; margin:9px 0; color:#8b3627; font:550 clamp(15px,1.8vw,24px) var(--mono); }
.gear-equations p { font-size:13px; }
.gear-screenshot { margin:22px 0 25px; }
.gear-screenshot>a { display:block; border:1px solid #c7cdc2; background:white; }
.gear-screenshot img { width:100%; height:auto; }
.gear-screenshot:has(img[src*="kiss-warning"]) { max-width:660px; }
.gear-screenshot figcaption { display:flex; flex-direction:column; gap:4px; margin-top:9px; font-size:12px; color:#596451; line-height:1.7; }
.gear-screenshot figcaption strong { color:#354030; font-size:13px; }
.gear-table-wrap { overflow-x:auto; margin:22px 0; }
.gear-parameters { border-collapse:collapse; width:100%; font-size:14px; text-align:left; }
.gear-parameters caption { text-align:left; font-weight:650; margin-bottom:10px; }
.gear-parameters th,.gear-parameters td { border-bottom:1px solid #d5d8cc; padding:12px 14px; vertical-align:top; line-height:1.75; }
.gear-parameters thead { background:#e9ede3; }
.gear-parameters th:first-child { width:19%; }
.gear-parameters td:nth-child(2) { width:25%; color:#923c2c; }
.gear-parameters tbody th { font-weight:550; }
.gear-experiment-heading { margin:45px 0 22px; padding-top:26px; border-top:2px solid #596a54; }
.gear-experiment-heading h4 { font-size:23px; margin:0 0 11px; }
@media(max-width:740px) {
 .gear-chapter>h4 { font-size:20px; gap:9px; }
 .gear-intro { padding-left:14px; }
 .gear-equations { grid-template-columns:1fr; }
 .gear-equations>div+div { border-left:0; border-top:1px solid #d5d8cc; padding-left:0; }
 .gear-parameters { font-size:12px; }
 .gear-parameters th,.gear-parameters td { padding:9px 7px; }
 .gear-parameters td:nth-child(2) { width:29%; overflow-wrap:anywhere; }
 .gear-parameters th:first-child { width:25%; }
 .gear-chapter { padding-top:23px; }
 .gear-screenshot { margin-inline:-3px; }
 .gear-guide p,.gear-guide li { font-size:14px; }
}
