/* Gear experiment: scoped controls, drawings and print fallback. */
[data-interactive="gear-ratios"] { min-width: 0; }
.article:has([data-interactive="gear-ratios"]) { max-width: 76rem; }
.gr-live > .gr-static { display: none; }
.gr-lab { font: .92rem/1.4 var(--f-display); }
.gr-lab p { margin: 0; }
.gr-lab [hidden] { display: none !important; }
.gr-start { margin-bottom: .65rem !important; color: var(--ink-soft); }
.gr-start strong { color: var(--ink); }
.gr-modes { border: 0; padding: 0; margin: 0 0 .75rem; min-width: 0; }
.gr-modes legend { font-size: .75rem; color: var(--ink-soft); margin-bottom: .3rem; }
.gr-modes > div { display: flex; gap: .4rem; }
.gr-modes label { flex: 1; position: relative; cursor: pointer; }
.gr-modes input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.gr-modes span { display: flex; align-items: center; justify-content: center; min-height: 42px; border: 1px solid var(--rule); border-radius: var(--radius-xs); background: var(--paper); font-weight: 600; }
.gr-modes input:checked + span { border-color: var(--accent); background: var(--accent); color: var(--paper); }
.gr-lab :is(button, select, input):focus-visible, .gr-modes input:focus-visible + span, .gr-lab summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.gr-workbench { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(17rem, 1fr); gap: .85rem; align-items: start; }
.gr-observe { min-width: 0; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--paper); overflow: hidden; }
.gr-view-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem .5rem; align-items: baseline; padding: .6rem .7rem 0; }
.gr-view-head > span { font-size: .65rem; letter-spacing: .08em; color: var(--ink-soft); }
.gr-view-head strong { color: var(--accent); font-size: .9rem; }
.gr-train { display: block; width: 100%; height: auto; overflow: visible; }
.gr-text { font: 17px var(--f-display); fill: var(--ink); }
.gr-gear-label { font-size: 15px; font-weight: 600; }
.gr-rpm { font-size: 19px; font-weight: 600; }
.gr-stage { font-size: 12px; letter-spacing: 1px; fill: var(--ink-soft); }
.gr-hub-label { font-size: 16px; font-weight: 700; }
.gr-note-strong { font-size: 15px; font-weight: 600; }
.gr-note-small { font-size: 13px; }
.gr-gear { fill: var(--surface-2); stroke: var(--ink-soft); stroke-width: .3; stroke-linejoin: round; }
.gr-gear.gr-input { fill: var(--cat1-soft); stroke: var(--accent); }
.gr-gear.gr-output { fill: var(--flag-soft); stroke: var(--ink); }
.gr-pitch { fill: none; stroke: var(--ink-soft); stroke-width: .8; stroke-dasharray: 3 4; }
.gr-spoke { fill: none; stroke: var(--ink); stroke-width: 2; }
.gr-marker { fill: var(--ink); stroke: var(--paper); stroke-width: 1; }
.gr-hub { fill: var(--surface); stroke: var(--ink-soft); stroke-width: 1; }
.gr-leader { fill: none; stroke: var(--rule); stroke-width: 1; }
.gr-shaft-link { fill: none; stroke: var(--ink-soft); stroke-width: 7; stroke-dasharray: 6 4; }
.gr-shaft-note { fill: var(--surface); stroke: var(--rule); }
.gr-motion { display: flex; flex-wrap: wrap; gap: .35rem; justify-content: center; padding: .45rem .5rem .25rem; }
.gr-lab button, .gr-lab select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-xs); min-height: 42px; padding: .42rem .65rem; cursor: pointer; }
.gr-lab button:hover { border-color: var(--accent); }
.gr-lab button:disabled { cursor: default; opacity: .55; }
.gr-lab [data-gr-run], .gr-lab [data-gr-test] { background: var(--accent); border-color: var(--accent); color: var(--paper); font-weight: 600; }
.gr-lab [data-gr-run] { min-width: 4.5rem; }
.gr-turns { text-align: center; font-size: .82rem; font-variant-numeric: tabular-nums; min-height: 1.3em; padding: .35rem .4rem 0; }
.gr-animation { text-align: center; color: var(--ink-soft); font-size: .7rem; padding: .35rem .7rem .65rem; }
.gr-controls { min-width: 0; }
.gr-counts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem .7rem; }
.gr-control { min-width: 0; }
.gr-control label { display: flex; flex-direction: column; gap: .15rem; font-weight: 600; font-size: .8rem; }
.gr-control output { color: var(--accent); font: 600 1rem var(--f-mono); }
.gr-control input[type="range"] { display: block; width: 100%; min-height: 32px; margin: .1rem 0 0; accent-color: var(--accent); cursor: pointer; }
.gr-results { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: .6rem; }
.gr-results > div { padding: .55rem .6rem; border: 1px solid var(--rule); border-top: 3px solid var(--flag); border-radius: var(--radius-xs); background: var(--flag-soft); display: flex; flex-direction: column; gap: .2rem; }
.gr-results span { font-size: .72rem; color: var(--ink-soft); }
.gr-results strong { font-size: clamp(1.15rem, 1.8vw, 1.6rem); white-space: nowrap; letter-spacing: -.025em; }
.gr-results small { font-size: .7rem; }
.gr-equation { padding: .55rem 0; font-size: .76rem; color: var(--ink-soft); }
.gr-loss-control { margin-top: .6rem; grid-column: 1 / -1; }
.gr-loss-note { font-size: .76rem; color: var(--ink-soft); grid-column: 1 / -1; }
.gr-delivered { grid-column: 1 / -1; }
.gr-settings { border-block: 1px solid var(--rule); font-size: .8rem; }
.gr-settings > summary, .gr-predict > summary { padding: .6rem 0; cursor: pointer; font-weight: 600; min-height: 42px; }
.gr-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin: .3rem 0; }
.gr-reverse { display: flex; align-items: center; min-height: 42px; gap: .5rem; }
.gr-reverse input { width: 18px; height: 18px; accent-color: var(--accent); }
.gr-bottom { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding-top: .55rem; }
.gr-bottom > span { font-size: .72rem; color: var(--ink-soft); }
.gr-bottom button { font-size: .75rem; flex: none; }
.gr-insight { margin-top: .75rem !important; border-left: 3px solid var(--cat1); padding: .45rem .65rem; background: var(--cat1-soft); }
.gr-convention, .gr-limit { color: var(--ink-soft); font-size: .75rem; margin-top: .45rem !important; }
.gr-predict { border-top: 1px solid var(--rule); margin-top: .75rem; }
.gr-predict-body { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: .6rem; padding: .2rem 0 .6rem; }
.gr-predict-body > :is(fieldset, p, div) { grid-column: 1 / -1; }
.gr-predict-body > label { font-size: .8rem; }
.gr-predict-body > button { grid-column: 1 / -1; justify-self: start; }
.gr-choices { border: 0; padding: 0; margin: 0; min-width: 0; }
.gr-choices legend { font-weight: 600; margin-bottom: .6rem; }
.gr-choices > div { display: flex; gap: .4rem; flex-wrap: wrap; }
.gr-choices label { display: flex; align-items: center; gap: .5rem; min-height: 44px; border: 1px solid var(--rule); border-radius: var(--radius-xs); padding: .45rem .6rem; cursor: pointer; }
.gr-choices input { margin: 0; accent-color: var(--accent); }
.gr-choices label:has(input:checked) { border-color: var(--accent); background: var(--cat1-soft); }
[data-gr-feedback], [data-gr-comparison] { font-size: .85rem; }
.gr-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.gr-static { display: grid; gap: 1rem; }
.gr-static-figure { margin: 0; break-inside: avoid; }
.gr-static-figure svg { max-width: 40rem; margin-inline: auto; }
.gr-static-figure h3 { margin-bottom: .5rem; }
.gr-static-figure figcaption { font-size: .9rem; }
.gr-law { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; }
.gr-law > div { border: 1px solid var(--rule); border-top: 3px solid var(--cat1); border-radius: var(--radius-sm); padding: .75rem; }
.gr-law strong { display: block; font-family: var(--f-display); }
.presenting .xcard:has(.gr-lab) { padding-block: .8rem; justify-content: flex-start; }
.presenting .xcard:has(.gr-lab) > summary { font-size: clamp(1.3rem, 2.2vw, 1.9rem); padding-bottom: .55rem; }
.presenting .xcard:has(.gr-lab) .body { padding-top: .65rem; }
.presenting .gr-lab { max-width: 72rem; margin-inline: auto; width: 100%; }
.presenting .gr-plot { max-width: 34rem; margin-inline: auto; }
.presenting [data-gr-mode="compound"] .gr-plot { max-width: 28rem; }
.presenting .gr-workbench { grid-template-columns: minmax(0, 1.3fr) minmax(19rem, 1fr); }
@media (max-width: 60rem) {
  .gr-workbench, .presenting .gr-workbench { grid-template-columns: 1fr; }
  .gr-controls { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem .8rem; }
  .gr-counts { align-content: start; }
  .gr-results { margin-top: 0; }
  .gr-equation, .gr-settings, .gr-bottom { grid-column: 1 / -1; }
  .gr-plot { max-width: 36rem; margin-inline: auto; }
}
@media (max-width: 34rem) {
  .xcard:has([data-interactive="gear-ratios"]) .body { padding: .7rem .5rem; }
  .gr-lab { font-size: .85rem; }
  .gr-start { font-size: .82rem; }
  .gr-modes { margin-bottom: .5rem; }
  .gr-modes span { min-height: 44px; }
  .gr-workbench { gap: .55rem; }
  .gr-controls { display: block; }
  .gr-counts { gap: .35rem .7rem; }
  .gr-control label { flex-direction: row; flex-wrap: wrap; align-items: baseline; justify-content: space-between; font-size: .75rem; }
  .gr-control output { font-size: .9rem; }
  .gr-control input[type="range"] { min-height: 36px; }
  .gr-results { margin-top: .4rem; }
  .gr-results strong { font-size: 1.3rem; }
  .gr-motion { gap: .3rem; padding-top: .2rem; }
  .gr-motion button { font-size: .78rem; padding: .4rem .55rem; min-height: 44px; }
  .gr-turns { font-size: .74rem; }
  .gr-animation { font-size: .68rem; padding-bottom: .5rem; }
  .gr-train .gr-gear-label { font-size: 21px; }
  .gr-train .gr-rpm { font-size: 24px; }
  .gr-train .gr-stage { font-size: 15px; letter-spacing: 0; }
  .gr-train .gr-hub-label { font-size: 20px; }
  .gr-train .gr-note-strong { font-size: 17px; }
  .gr-train .gr-note-small { font-size: 16px; }
  .gr-law { grid-template-columns: 1fr; }
  .gr-predict-body { grid-template-columns: 1fr; }
  .gr-predict-body > * { grid-column: 1 !important; }
  .gr-choices > div { flex-direction: column; }
}
@media print {
  .xcard:has([data-interactive="gear-ratios"]) { break-inside: auto; }
  .gr-lab { display: none !important; }
  .gr-live > .gr-static { display: grid !important; }
  .gr-static-figure svg { max-width: 31rem; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .gr-static-figure figcaption { font-size: 10pt; }
  .gr-law { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
