/* DTI torque-curve generator – styles (light + dark, MkDocs Material aware) */
.dti-tt {
  --tt-surface: #ffffff;
  --tt-tile: #f3f3f1;
  --tt-text: #0b0b0b;
  --tt-text2: #52514e;
  --tt-muted: #8a8984;
  --tt-grid: #e6e5e1;
  --tt-axis: #b9b8b2;
  --tt-main: #2a78d6;
  --tt-ref: #a3a29c;
  --tt-warn-bg: #fff4d6;
  --tt-warn: #7a5200;
  color: var(--tt-text);
  background: var(--tt-surface);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 16px;
  border-radius: 8px;
  max-width: 100%;
  box-sizing: border-box;
}
/* standalone page: follow OS setting; MkDocs Material: follow its palette toggle */
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) body:not([data-md-color-scheme]) .dti-tt {
    color-scheme: dark;
  --tt-surface: #1a1a19; --tt-tile: #252524; --tt-text: #ffffff; --tt-text2: #c3c2b7; --tt-muted: #8f8e88;
  --tt-grid: #2f2f2d; --tt-axis: #55544f; --tt-main: #3987e5; --tt-ref: #6f6e69; --tt-warn-bg: #3a2e10; --tt-warn: #f2c869;
  }
}
[data-md-color-scheme="slate"] .dti-tt, :root[data-theme="dark"] .dti-tt {
  color-scheme: dark;
  --tt-surface: #1a1a19; --tt-tile: #252524; --tt-text: #ffffff; --tt-text2: #c3c2b7; --tt-muted: #8f8e88;
  --tt-grid: #2f2f2d; --tt-axis: #55544f; --tt-main: #3987e5; --tt-ref: #6f6e69; --tt-warn-bg: #3a2e10; --tt-warn: #f2c869;
}
.dti-tt-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-bottom: 12px; }
.dti-tt-inlabel { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.dti-tt-inlabel span { font-weight: 400; color: var(--tt-text2); }
.dti-tt-num { width: 4.5em; font: inherit; font-size: 0.9rem; padding: 3px 6px; border: 1px solid var(--tt-axis);
  border-radius: 6px; background: var(--tt-surface); color: var(--tt-text); }
.dti-tt-range { flex: 1 1 200px; min-width: 160px; accent-color: var(--tt-main); }
.dti-tt-check { color: var(--tt-text2); display: flex; align-items: center; gap: 6px; cursor: pointer; }
.dti-tt-note { background: var(--tt-warn-bg); color: var(--tt-warn); padding: 6px 10px; border-radius: 6px; margin: 0 0 12px; }
.dti-tt-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 8px; }
.dti-tt-tile { background: var(--tt-tile); border-radius: 8px; padding: 10px 12px; }
.dti-tt-tl { color: var(--tt-text2); font-size: 0.8rem; }
.dti-tt-tv { font-size: 1.35rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.dti-tt-tv small { font-size: 0.75rem; font-weight: 400; color: var(--tt-text2); }
.dti-tt-h { margin: 16px 0 4px !important; font-size: 0.95rem; font-weight: 600; color: var(--tt-text); }
.dti-tt-chart { position: relative; width: 100%; }
.dti-tt-svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.dti-tt-grid { stroke: var(--tt-grid); stroke-width: 1; }
.dti-tt-axis { stroke: var(--tt-axis); stroke-width: 1; }
.dti-tt-tick { fill: var(--tt-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.dti-tt-axlabel { fill: var(--tt-text2); font-size: 12px; }
.dti-tt-main { fill: none; stroke: var(--tt-main); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.dti-tt-ref { fill: none; stroke: var(--tt-ref); stroke-width: 1.5; stroke-dasharray: 5 4; }
.dti-tt-reflabel { fill: var(--tt-muted); font-size: 11px; }
.dti-tt-mainlabel { fill: var(--tt-text); font-size: 12px; font-weight: 600; }
.dti-tt-cross { stroke: var(--tt-axis); stroke-width: 1; }
.dti-tt-dot { fill: var(--tt-main); stroke: var(--tt-surface); stroke-width: 2; }
.dti-tt-tip { position: absolute; pointer-events: none; background: var(--tt-surface); color: var(--tt-text);
  border: 1px solid var(--tt-axis); border-radius: 6px; padding: 6px 9px; font-size: 0.8rem; line-height: 1.4;
  box-shadow: 0 2px 8px rgba(0,0,0,.12); white-space: nowrap; font-variant-numeric: tabular-nums; }
.dti-tt-actions { margin-top: 12px; }
.dti-tt-btn { font: inherit; padding: 6px 14px; border-radius: 6px; border: 1px solid var(--tt-main);
  background: transparent; color: var(--tt-main); cursor: pointer; }
.dti-tt-btn:hover { background: var(--tt-main); color: #fff; }
.dti-tt-details { margin-top: 12px; }
.dti-tt-details summary { cursor: pointer; color: var(--tt-text2); }
.dti-tt-table table { border-collapse: collapse; margin-top: 8px; font-variant-numeric: tabular-nums; }
.dti-tt-table th, .dti-tt-table td { padding: 3px 14px; text-align: right; border-bottom: 1px solid var(--tt-grid); }
.dti-tt-table th { color: var(--tt-text2); font-weight: 600; }
.dti-tt-cond { color: var(--tt-text2); font-size: 0.8rem; line-height: 1.5; margin-top: 14px; }

.dti-tt-h3row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 16px; }
.dti-tt-h3row .dti-tt-h { margin: 0 !important; }
.dti-tt-h small { font-weight: 400; color: var(--tt-muted); }
.dti-tt-seg { display: inline-flex; border: 1px solid var(--tt-axis); border-radius: 6px; overflow: hidden; }
.dti-tt-seg button { font: inherit; font-size: 0.8rem; padding: 4px 12px; border: 0; background: transparent; color: var(--tt-text2); cursor: pointer; }
.dti-tt-seg button[aria-pressed="true"] { background: var(--tt-main); color: #fff; }
.dti-tt-3d { margin-top: 6px; }
.dti-tt-canvas { display: block; cursor: grab; touch-action: none; }
.dti-tt-canvas:active { cursor: grabbing; }
.dti-tt-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.8rem; color: var(--tt-text2); margin-top: 4px; }
.dti-tt-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dti-tt-legend i { display: inline-block; width: 22px; height: 0; }
.dti-tt-lg-sel { border-top: 3px solid var(--tt-text); }
.dti-tt-lg-test { border-top: 2px dashed var(--tt-text2); }
.dti-tt-lg-ext { height: 10px !important; width: 14px !important; background: linear-gradient(90deg, rgba(49,104,142,.5), rgba(109,205,89,.5)); border-radius: 2px; }

.dti-tt-arms { color: var(--tt-text2); font-variant-numeric: tabular-nums; min-width: 7.5em; }
.dti-tt-main-scaled { stroke-dasharray: 7 5; }
.dti-tt-note { font-weight: 600; }

.dti-tt-mainlabel { paint-order: stroke; stroke: var(--tt-surface); stroke-width: 4px; stroke-linejoin: round; }

.dti-tt-cond ul { margin: 6px 0 0; padding-left: 1.2em; }
.dti-tt-cond li { margin: 2px 0; }
.dti-tt-cond li span { color: var(--tt-text); font-weight: 600; }
.dti-tt-cond b { color: var(--tt-text); }

.dti-tt-cond a { color: var(--tt-main); }
