/* spur and helical gears — on top of calc.css */
/* the drawing card (same box as calc.css's stage) */
.gr-canvas { display: flex; flex-direction: column; min-width: 0; overflow: hidden; position: relative; }
.gr-bar { display: flex; align-items: center; justify-content: flex-start; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.gr-bar .hist { margin-left: auto; }
#view { display: block; width: 100%; height: auto; user-select: none; touch-action: none; }
.gr-vw { position: relative; flex: 1; min-height: 0; }
#viewLab, #pathMk { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; user-select: none; }
#viewLab .pill.editable { pointer-events: auto; }
#view.dragging, #view.dragging * { cursor: grabbing !important; }
#view .hit { fill: transparent; stroke: none; }
#view .handle { cursor: grab; }
#view .handle .knob { fill: var(--surface); stroke: var(--sel); stroke-width: 1.8; }
#view .handle:hover .knob { fill: var(--sel); }
#view .handle.derived { cursor: default; }
#view .handle.derived .knob { stroke: var(--steel-500); }
#view .handle.derived:hover .knob { fill: var(--surface); }
#view .handle.hx { cursor: ew-resize; }

/* drawing */
.gr-g1 { fill: var(--steel-200); stroke: var(--steel-700); stroke-width: 1; stroke-linejoin: round; }
.gr-g2 { fill: var(--steel-100); stroke: var(--steel-700); stroke-width: 1; stroke-linejoin: round; }
.gr-pitch { fill: none; stroke: var(--steel-500); stroke-width: .7; stroke-dasharray: 8 3 2 3; }
.gr-base { fill: none; stroke: var(--steel-400); stroke-width: .7; stroke-dasharray: 2 2; }
.gr-form { fill: none; stroke: var(--warn); stroke-width: .9; stroke-dasharray: 3 2; }
.gr-cl { stroke: var(--steel-500); stroke-width: .6; stroke-dasharray: 10 3 2 3; fill: none; }
.gr-ctr { stroke: var(--steel-700); stroke-width: 1; fill: none; }
.gr-split { stroke: var(--line); }
.gr-dbg { fill: var(--surface-2); }
.gr-loa { stroke: var(--steel-550); stroke-width: .8; }
.gr-zone { stroke-width: 5; stroke-linecap: butt; }
.gr-zone.two { stroke: color-mix(in srgb, var(--sel) 28%, transparent); }
.gr-zone.one { stroke: color-mix(in srgb, var(--sel) 75%, transparent); }
.gr-cp { fill: var(--surface); stroke: var(--sel); stroke-width: 1.6; }
.gr-cp.one { fill: var(--sel); }
.gr-tick { stroke: var(--steel-700); stroke-width: 1; }
.gr-pt { font-size: var(--fs, 11.5px); font-weight: 600; fill: var(--ink); }
.gr-cap { font-size: var(--fs, 11.5px); fill: var(--text-3); }
.gr-ref { fill: none; stroke: var(--steel-550); stroke-width: .8; stroke-dasharray: 3 2; }
.gr-datum { fill: none; stroke: var(--sel); stroke-width: 1.4; }
.gr-xdim { stroke: var(--sel); stroke-width: .9; }
.gr-dim, .gr-ext { stroke: var(--steel-550); stroke-width: .8; fill: none; }
#viewLab .pill rect { fill: var(--surface); stroke: var(--steel-300); }
#viewLab .pill text { font-weight: 500; fill: var(--text-2); font-variant-numeric: tabular-nums; }
#viewLab .pill.editable { cursor: text; }
#viewLab .pill.editable:hover rect { stroke: var(--sel); stroke-width: 1.4; }
#viewLab .pill.editable:focus { outline: none; }
#viewLab .pill.editable:focus rect { stroke: var(--sel); stroke-width: 1.6; }
#viewLab .pill.dimv rect { stroke: var(--steel-200); }
#viewLab .pill.ea rect { stroke: color-mix(in srgb, var(--sel) 40%, transparent); } #viewLab .pill.ea text { fill: var(--x-1e4fbf, #1e4fbf); font-weight: 600; }
#viewLab .pill.ea.warn rect { stroke: var(--warn); } #viewLab .pill.ea.warn text { fill: var(--x-9a6a12, #9a6a12); }
#viewLab .pill.xp rect { stroke: color-mix(in srgb, var(--sel) 40%, transparent); } #viewLab .pill.xp text { fill: var(--x-1e4fbf, #1e4fbf); font-weight: 600; }
#view .gr-lds { stroke: var(--load); stroke-width: 1.8; fill: none; }
#view .gr-ldh { fill: var(--load); stroke: none; }
#viewLab .pill.ld rect { stroke: color-mix(in srgb, var(--load) 35%, transparent); } #viewLab .pill.ld text { fill: var(--load); font-weight: 600; }
.halo { paint-order: stroke; stroke: var(--halo); stroke-width: 3.5px; stroke-linejoin: round; }

/* live strip, flags */
.gr-live { display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; min-height: 38px; align-items: center; }
.gr-live b { font-weight: 500; color: var(--text-3); margin-right: 5px; }
.gr-live i { font-style: normal; }
.gr-key { margin-left: auto; color: var(--text-3); display: inline-flex; align-items: center; gap: 5px; }
.gr-key .sw { display: inline-block; width: 14px; height: 5px; border-radius: 1px; }
.gr-key .sw.one { background: color-mix(in srgb, var(--sel) 75%, transparent); } .gr-key .sw.two { background: color-mix(in srgb, var(--sel) 28%, transparent); margin-left: 8px; }
.gr-flags { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.gr-flag { font-size: 11.5px; font-weight: 500; border-radius: 999px; padding: 2px 9px; }
.gr-flag.warn { color: var(--wip-ink); background: var(--warn-bg); }
.gr-flag.bad { color: var(--bad-ink); background: var(--bad-bg); }

/* in-place editor */
.gr-edit { position: absolute; transform: translate(-50%, -50%); z-index: 5; display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1.5px solid var(--sel); border-radius: 9px; padding: 2px 8px 2px 4px; box-shadow: 0 6px 18px rgba(20, 22, 28, .14); }
.gr-edit input { width: 82px; border: 0; outline: none; font: inherit; font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; padding: 3px 2px; }
.gr-edit span { font-size: 11.5px; color: var(--text-3); }
.gr-edit.bad { border-color: var(--bad); }

/* examples menu */
.ex-wrap { position: relative; }

/* panel */
.gr-seg { margin: 4px 0 6px; }
.gr-kv { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 12px; color: var(--text-2); padding: 4px 0 2px; align-items: baseline; }
.gr-kv .srcs a, .small-note .srcs a { color: var(--text-3); font-size: 11px; text-decoration: none; }
.gr-lab { font-size: 12.5px; color: var(--text-2); margin: 4px 0 2px; }
.gr-ka { display: grid; grid-template-columns: auto repeat(3, minmax(0, 1fr)); gap: 3px; margin: 6px 0 4px; font-size: 11.5px; align-items: center; }
.gr-ka .h { color: var(--text-3); text-align: center; line-height: 1.2; }
.gr-ka .h.r { text-align: left; padding-right: 6px; }
.gr-ka button { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 3px 6px; cursor: pointer; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text-2); }
.gr-ka button:hover { border-color: var(--line-2); }
.gr-ka button[aria-pressed="true"] { border-color: var(--text); color: var(--text); font-weight: 500; }
#panel input.bad { color: var(--bad); }
#panel .num:has(input.bad) input { border-color: var(--bad); }
#panel input:disabled { color: var(--text-3); background: var(--bg); }

/* summary */
.gr-say { font-size: 12.5px; color: var(--text-2); margin-top: 6px; max-width: 36ch; line-height: 1.4; }
.gr-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.gr-stats .stat .v { white-space: nowrap; }

/* margins and preview cards */
.gr-ico { display: inline-flex; align-items: center; gap: 7px; cursor: help; outline: none; }
.gr-ico svg { flex: none; }
.gr-th { display: block; margin: -6px 0; }
.margins td.chk { padding-top: 9px; padding-bottom: 9px; }
.gr-ico:focus span { text-decoration: underline; }
.margins td.note { white-space: normal; min-width: 280px; }
.margins td small { color: var(--text-3); font-size: 11px; }
.gr-life-m { display: none; }
.gr-life { white-space: nowrap; font-size: 12.5px; color: var(--text-2); }
.gr-pv { position: fixed; z-index: 60; width: 236px; padding: 8px 8px 9px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 28px rgba(20, 24, 30, .14); pointer-events: none; font-size: 12px; color: var(--text); }
.gr-pv[hidden] { display: none; }
.gr-pv svg { display: block; width: 220px; height: auto; margin: 4px 0 6px; }
.gr-pv .pv-h { font-weight: 600; }
.gr-pv .pv-c { color: var(--text-2); line-height: 1.35; }
.gr-pv .pv-m { margin-top: 4px; color: var(--text-3); }
@media print { .gr-pv { display: none !important; } }

/* geometry, forces */
.gr-two { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; }
.gr-two > .block { margin: 0; }
table.gr-geo { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.gr-geo th { font-size: 11.5px; font-weight: 500; color: var(--text-3); text-align: right; padding: 0 8px 6px; }
.gr-geo td { padding: 5px 8px; border-top: 1px solid var(--line); text-align: right; white-space: nowrap; }
.gr-geo td.l, .gr-geo th.l { text-align: left; }
.gr-geo td.note { color: var(--text-3); font-size: 11.5px; white-space: normal; }
.gr-geo td small { color: var(--text-3); font-size: 11px; margin-left: 4px; }
.gr-geo tr.gr-sec td { font-size: 11.5px; font-weight: 600; color: var(--text-3); padding-top: 12px; }
.gr-geo td[colspan="2"] { text-align: left; }
.gr-bad { color: var(--warn-ink); font-weight: 600; }
.gr-forces { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 12px; align-items: start; }
.gr-fb { width: 100%; height: auto; }
.gr-fb .fb-p { fill: var(--steel-100); stroke: var(--steel-700); stroke-width: 1; }
.gr-fb .fb-f { stroke: var(--load); stroke-width: 1.8; }
.gr-fb .fb-t { font-size: 12px; font-weight: 600; fill: var(--load); }
.gr-fb .fb-c { font-size: 11px; fill: var(--text-3); }
.gr-fb .fb-ax { fill: none; stroke: var(--load); stroke-width: 1.3; }
.gr-fkv { display: grid; gap: 0; font-size: 13px; font-variant-numeric: tabular-nums; }
.gr-fkv > div { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-top: 1px solid var(--line); }
.gr-fkv > div:first-child { border-top: 0; }
.gr-fkv span { color: var(--text-2); }
.gr-fkv b { font-weight: 500; }

/* charts */
.gr-chart { display: block; width: 100%; height: auto; touch-action: none; user-select: none; }
.gr-chart .drag { cursor: ew-resize; }
.gr-chart .ch-t { font-size: calc(var(--cfs, 11px) * .95); fill: var(--text-3); font-variant-numeric: tabular-nums; }
.gr-chart .ch-a { font-size: var(--cfs, 11px); fill: var(--text-2); }
.gr-chart .ch-l { font-size: var(--cfs, 11px); font-weight: 600; }
.gr-chart .gr-onez { fill: color-mix(in srgb, var(--sel) 5%, transparent); }
#pathChart { cursor: ew-resize; }
.gr-chart .pill rect { fill: var(--surface); stroke: var(--steel-300); }
.gr-chart .pill text { font-weight: 500; fill: var(--text-2); font-variant-numeric: tabular-nums; }
.rf-t { fill: var(--steel-150); stroke: var(--ink); stroke-width: 1; stroke-linejoin: round; }
.rf-tan { stroke: var(--steel-550); stroke-width: .9; }
.rf-ch { stroke: var(--bad); stroke-width: 1.4; }
.rf-dot { fill: var(--surface); stroke: var(--bad); stroke-width: 1.4; }
.rf-ll { stroke: var(--load); stroke-width: .9; stroke-dasharray: 4 3; }
.rf-dim { stroke: var(--steel-700); stroke-width: .9; fill: none; }
.rf-ext { stroke: var(--steel-400); stroke-width: .7; fill: none; stroke-dasharray: 2 2; }
.rf-h { font-size: var(--cfs, 11.5px); font-weight: 600; fill: var(--text); }
.rf-v { font-size: calc(var(--cfs, 11.5px) * .95); fill: var(--text-2); font-variant-numeric: tabular-nums; }

@media (max-width: 1200px) { .gr-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } .gr-stats .stat:nth-child(4) { border-left: 0; } .gr-stats .stat:nth-child(n+4) { border-top: 1px solid var(--line); } }
@media (max-width: 1040px) { .gr-two { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
  .gr-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gr-stats .stat { border-left: 0; border-top: 1px solid var(--line); }
  .gr-stats .stat:nth-child(even) { border-left: 1px solid var(--line); }
  .gr-stats .stat:nth-child(-n+2) { border-top: 0; }
  .margins th:nth-child(4), .margins td.note { display: none; }
  .margins td.l { white-space: normal; }
  .margins td, .margins th { padding-left: 5px; padding-right: 5px; }
  .gr-live { font-size: 12px; gap: 3px 12px; }
  .gr-key { margin-left: 0; }
  .gr-forces { grid-template-columns: minmax(0, 1fr); }
  .gr-geo td.note, .gr-geo th:last-child { display: none; }
  .gr-geo td small { display: none; }
  .gr-geo td { white-space: normal; }
  .margins td small, .margins th:nth-child(5), .margins td.gr-life, .margins th:nth-child(3), .margins td:nth-child(3) { display: none; }
  .margins td small.gr-life-m { display: block; margin: 4px 0 0 43px; font-size: 11px; color: var(--text-3); }
  .gr-th { width: 36px; height: 36px; }
  .gr-ico { gap: 7px; }
  .gr-geo td { padding: 5px 4px; }
}
#shiftChart .pill.xsel rect { fill: var(--surface); stroke: var(--sel); }
#shiftChart .pill.xsel text { fill: var(--sel); font-weight: 600; }
.gr-fb .pill rect { fill: var(--surface); stroke: color-mix(in srgb, var(--load) 35%, transparent); }
.gr-fb .pill text { fill: var(--load); font-weight: 600; }
.gr-shaft { justify-self: start; margin: 8px 0 2px; text-decoration: none; display: inline-block; }
#view .gr-xdot { fill: var(--surface); stroke: var(--steel-500); stroke-width: 1.6; pointer-events: none; }

/* the panel fades out at an edge it scrolls past (fadePanel in app.js) */
#panel.fade-b { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 32px), transparent); }
#panel.fade-t { -webkit-mask-image: linear-gradient(to bottom, transparent, #000 28px); mask-image: linear-gradient(to bottom, transparent, #000 28px); }
#panel.fade-t.fade-b { -webkit-mask-image: linear-gradient(to bottom, transparent, #000 28px, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to bottom, transparent, #000 28px, #000 calc(100% - 32px), transparent); }

/* theme-auto:start · generated by scripts/theme/hexmap.py: dark values (the rule of scripts/theme/colour.py) for
   colours that are not tokens, written as var(--x-rrggbb, #rrggbb): light is the fallback, unchanged */
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --x-1e4fbf: #749ff5; --x-6e7177: #85827f; --x-8a5a9e: #c39ad5; --x-9a6a12: #d0a66a; --x-b06a2c: #e0a374;
    --x-cfd3d8: #3e3c38;
  }
}
@media screen {
  :root[data-theme="dark"] {
    --x-1e4fbf: #749ff5; --x-6e7177: #85827f; --x-8a5a9e: #c39ad5; --x-9a6a12: #d0a66a; --x-b06a2c: #e0a374;
    --x-cfd3d8: #3e3c38;
  }
}
/* theme-auto:end */
