/* Sprocket Designer — the page mirrors Timing Pulley Generator (M6c), so its
   stylesheet is PulleyWebApp-ss static/style.css: the layout, drive bar, 3D
   Mode switch, cards, collapsible sections, spoke-fit warning and the
   download window, copied unchanged. Sprocket-only rules follow at the end. */

/* ── Utility ── */
.no-spin::-webkit-inner-spin-button,
.no-spin::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: Segoe UI, Arial, sans-serif;
  font-size: 14px;
  color: #1a1a1a;
  background: #f0f2f5;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Header ── */
header {
  background: #0078d4;
  color: #fff;
  padding: 10px 24px;
  flex-shrink: 0;
}
.header-inner        { display: flex; align-items: center; gap: 16px; }
/* Drawn at 48px but laid out as 28px (the -10px margins), so it fills the
   header's padding without making the header any taller. */
.logo                { height: 48px; width: auto; display: block; margin: -10px 0; }
.header-title-block  { display: flex; flex-direction: column; gap: 1px; }
.header-title        { font-size: 14px; opacity: 0.88; }
.header-version      { font-size: 10px; opacity: 0.60; letter-spacing: 0.3px; }

/* ── Main layout ── */
main {
  display: flex;
  flex: 1;
  gap: 0;
  overflow: hidden;
  min-height: 0;
}

/* ── Controls panel ── */
.controls-panel {
  width: 280px;
  min-width: 240px;
  background: #fff;
  border-right: 1px solid #dde3ea;
  overflow-y: auto;
  padding: 12px;
  flex-shrink: 0;
}

.card {
  background: #f7f9fc;
  border: 1px solid #dde3ea;
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.card h2 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #0078d4;
  margin-bottom: 10px;
}

label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #444;
  margin-top: 8px;
  margin-bottom: 3px;
}

select, input[type="number"] {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #c8d0db;
  border-radius: 4px;
  font-size: 13px;
  background: #fff;
  color: #1a1a1a;
  appearance: none;
}
select:focus, input[type="number"]:focus {
  outline: none;
  border-color: #0078d4;
  box-shadow: 0 0 0 2px rgba(0,120,212,0.15);
}

.info-row {
  font-size: 11px;
  color: #666;
  margin-top: 6px;
}

.preset-info {
  font-size: 11px;
  color: #888;
  margin-top: 2px;
  height: 14px;
}

.toggle-row {
  margin-top: 10px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.toggle-row input { width: auto; }

.hidden { display: none !important; }

/* Download card */
.download-card { text-align: center; }

.btn-download {
  width: 100%;
  padding: 9px;
  background: #0078d4;
  color: #fff;
  border: none;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: background 0.15s;
}
.btn-download:hover { background: #005fa3; }
.btn-download-p2 {
  width: 100%;
  padding: 9px;
  background: #761516;
  color: #fff;
  border: none;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: background 0.15s;
}
.btn-download-p2:hover { background: #5a0f10; }

/* ── Download popup menu ── */
.dl-wrap {
  position: relative;
  margin-bottom: 6px;
}
.dl-wrap:last-child { margin-bottom: 0; }

.dl-menu {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #c8d0db;
  border-radius: 5px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.13);
  z-index: 200;
  overflow: hidden;
}

.dl-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 500;
  background: none;
  border: none;
  border-bottom: 1px solid #f0f2f5;
  cursor: pointer;
  color: #1a1a1a;
  text-align: left;
}
.dl-item:last-child { border-bottom: none; }
.dl-item:hover:not(.dl-item-soon) { background: #eef3f9; color: #0078d4; }

.dl-item-soon {
  color: #aaa;
  cursor: default;
}

.dl-soon-tag {
  font-size: 10px;
  background: #f3f4f6;
  color: #9ca3af;
  padding: 1px 6px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  font-weight: 400;
}

/* ── Preview panel ── */
.preview-panel {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  overflow: hidden;
}

.preview-header {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  gap: 8px;
  border-bottom: 1px solid #dde3ea;
  background: #f7f9fc;
  font-size: 13px;
  font-weight: 600;
  color: #333;
  flex-shrink: 0;
}

.preview-tab {
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #c8d0db;
  border-radius: 4px;
  background: #f0f2f5;
  color: #555;
  cursor: pointer;
}
.preview-tab.active {
  background: #0078d4;
  color: #fff;
  border-color: #0078d4;
}
.preview-tab:hover:not(.active) { background: #e2e8f0; }

.preview-box {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  overflow: hidden;
  padding: 12px;
  background: #fafbfc;
  position: relative;
}

#preview-img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  display: block;
}

.preview-box-3d {
  padding: 0 !important;
}

#three-canvas {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  align-self: stretch;
  display: block;
  touch-action: none;
}

.preview-box svg {
  max-width: 100%;
  max-height: 100%;
}

.preview-placeholder {
  color: #bbb;
  font-size: 14px;
}

.preview-footer {
  padding: 6px 16px;
  font-size: 11px;
  color: #888;
  border-top: 1px solid #eee;
  background: #f7f9fc;
  flex-shrink: 0;
  height: 28px;
}

/* ── Footer ── */
footer {
  background: #1a1a2e;
  color: #aaa;
  font-size: 11px;
  text-align: center;
  padding: 8px;
  flex-shrink: 0;
  height: 36px;
}
footer a { color: #6ab3e8; text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ── Drive bar ── */
.drive-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 6px 16px;
  background: #eef3f9;
  border-bottom: 1px solid #d0dae6;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.drive-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
  cursor: pointer;
}
.drive-toggle input[type="checkbox"] {
  width: auto;
  margin: 0;
  cursor: pointer;
  accent-color: #0078d4;
}

/* ── 3D Mode panel: drafting-blue blueprint grid, a small render of the 3D
   pulley, "3D MODE" and a switch — the height of the drive bar's other
   controls. The real checkbox sits inside, invisible but still focusable and
   clickable, so state, saved settings and onFeatureBuildToggle are
   unchanged. Off: pale lettering, grey pulley. On: white lettering, the
   pulley in colour, the switch across. No glow. ── */
.mode3d {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  margin: 0;                     /* the global label rule adds margins */
  padding: 0 8px 0 6px;
  border: 1.5px solid #2f63c8;
  border-radius: 7px;
  background-color: #123a8a;
  background-image:
    linear-gradient(rgba(160, 220, 255, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(160, 220, 255, 0.18) 1px, transparent 1px);
  background-size: 8px 8px;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}
.mode3d input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.mode3d-pulley {
  display: block;
  height: 26px;
  width: auto;
  filter: grayscale(1) contrast(0.8);
  opacity: 0.75;
  transition: filter 0.3s, opacity 0.3s;
  pointer-events: none;
}
.mode3d-text {
  font-family: Orbitron, "Segoe UI", Arial, sans-serif;
  font-weight: 900;
  font-size: 14px;
  line-height: 1;
  letter-spacing: 1.5px;
  color: #a9e6ff;
  white-space: nowrap;
  transition: color 0.3s;
  pointer-events: none;
}
.mode3d-switch {
  position: relative;
  flex: none;
  width: 30px;
  height: 16px;
  border-radius: 8px;
  background: #27488f;
  transition: background 0.25s;
  pointer-events: none;
}
.mode3d-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  transition: left 0.25s;
}
.mode3d input:checked ~ .mode3d-pulley { filter: none; opacity: 1; }
.mode3d input:checked ~ .mode3d-text { color: #fff; }
.mode3d input:checked ~ .mode3d-switch { background: #5ee0ff; }
.mode3d input:checked ~ .mode3d-switch::after { left: 16px; }
.mode3d input:focus-visible ~ .mode3d-switch { outline: 2px solid #fff; outline-offset: 2px; }

.drive-spacing {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #444;
}
.drive-spacing label {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  color: #444;
  white-space: nowrap;
}
.drive-spacing input[type="number"] {
  width: 90px;
  padding: 4px 6px;
  font-size: 12px;
}
#gear_ratio { width: 75px; }

.belt-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #b0bec5;
  border-radius: 6px;
  padding: 4px 10px;
}

.ratio-arrows {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.ratio-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 16px;
  padding: 0;
  font-size: 9px;
  line-height: 1;
  background: #e8edf3;
  border: 1px solid #c8d0db;
  border-radius: 3px;
  cursor: pointer;
  color: #444;
}
.ratio-btn:hover { background: #d0daea; border-color: #0078d4; color: #0078d4; }
.lock-ratio-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #475569;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.min-dist-btn {
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  background: #f1f3f5;
  border: 1px solid #c8d0db;
  border-radius: 4px;
  cursor: pointer;
  color: #555;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.min-dist-btn:hover { background: #e2e8f0; border-color: #0078d4; color: #0078d4; }
.min-dist-btn.min-dist-warn {
  background: #fee2e2;
  border-color: #f87171;
  color: #b91c1c;
}
.min-dist-btn.min-dist-warn:hover {
  background: #fecaca;
}

.reset-btn {
  padding: 3px 10px;
  font-size: 12px;
  background: #f1f3f5;
  border: 1px solid #c8d0db;
  border-radius: 4px;
  cursor: pointer;
  color: #555;
  white-space: nowrap;
}
.reset-btn:hover { background: #fee2e2; border-color: #f87171; color: #b91c1c; }
.import-btn {
  padding: 3px 10px;
  font-size: 12px;
  background: #eff6ff;
  border: 1px solid #93c5fd;
  border-radius: 4px;
  cursor: pointer;
  color: #1d4ed8;
  white-space: nowrap;
}
.import-btn:hover { background: #dbeafe; border-color: #3b82f6; }
.drive-info-btn {
  padding: 3px 10px;
  font-size: 12px;
  background: #eef5fc;
  border: 1px solid #90b8db;
  border-radius: 4px;
  cursor: pointer;
  color: #0078d4;
  white-space: nowrap;
}
.drive-info-btn:hover { background: #0078d4; border-color: #0078d4; color: #fff; }
/* The Spokes card's style gallery: each style drawn on this sprocket. */
.spoke-gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 2px 0 8px; }
.spoke-gallery:empty { display: none; }
.spoke-gallery button {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 2px 3px; background: #fff; border: 1px solid #c8d0db; border-radius: 5px;
  cursor: pointer; font-size: 10.5px; color: #334155; line-height: 1.15;
}
.spoke-gallery button svg { width: 100%; height: auto; aspect-ratio: 1; }
.spoke-gallery button:hover { border-color: #0078d4; }
.spoke-gallery button.chosen { border: 2px solid #0078d4; background: #eef6ff; padding: 3px 1px 2px; }
.spoke-gallery button.refit::after { content: "adjusted to fit"; font-size: 9px; color: #b45309; }
.spoke-gallery button.none { opacity: 0.45; cursor: default; }

/* Undo / redo, EBoxDesigner's pair: small, quiet, obviously paired. */
.undo-btn {
  padding: 1px 8px;
  font-size: 16px;
  line-height: 1.2;
  background: #f1f3f5;
  border: 1px solid #c8d0db;
  border-radius: 4px;
  cursor: pointer;
}
.undo-btn:hover:not(:disabled) { background: #e2e8f0; border-color: #94a3b8; }
.undo-btn:disabled { opacity: 0.35; cursor: default; }

/* The view when the settings can't be drawn. */
.preview-box { position: relative; }
.invalid-panel {
  position: absolute;
  inset: 0;
  margin: auto;
  width: min(520px, calc(100% - 40px));
  height: fit-content;
  max-height: calc(100% - 40px);
  overflow: auto;
  padding: 18px 22px 16px;
  background: #fff;
  border: 1px solid #fca5a5;
  border-top: 4px solid #dc2626;
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.18);
  z-index: 5;
}
.invalid-panel.hidden { display: none; }
.invalid-title { font-size: 20px; font-weight: 700; color: #b91c1c; margin-bottom: 6px; }
.invalid-lead { margin: 0 0 6px; color: #334155; font-size: 14px; }
.invalid-errors { margin: 0 0 10px; padding-left: 20px; color: #b91c1c; font-size: 14px; }
.invalid-errors li { margin-bottom: 4px; }
.invalid-cause { margin: 0 0 12px; color: #475569; font-size: 13px; }
.invalid-cause:empty { display: none; }
/* Auto-fix (when there's a known fix) and Undo, side by side at the bottom. */
.invalid-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.invalid-fix {
  padding: 6px 22px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: #c62828;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}
.invalid-fix:hover { background: #a61b1b; }
.invalid-fix.hidden { display: none; }
.invalid-undo {
  padding: 6px 22px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: #0078d4;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}
.invalid-undo:hover:not(:disabled) { background: #005fa8; }
.invalid-undo:disabled { background: #94a3b8; cursor: default; }

.drive-bar-right {
  margin-left: auto;
  display: flex;
  gap: 6px;
  align-items: center;
}
.drive-note {
  font-size: 11px;
  color: #888;
  white-space: nowrap;
}

/* ── Panel title ── */
.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  color: #0078d4;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 2px 10px;
  border-bottom: 2px solid #0078d4;
  margin-bottom: 10px;
}

/* ── Belt lock info card ── */
.belt-lock-info {
  font-size: 12px;
  color: #333;
  padding: 8px 12px;
  background: #eef3f9;
  border-color: #c2d4e8;
}

/* ── Dual layout: main becomes 3-column ── */
main.dual {
  display: grid;
  grid-template-columns: 280px 1fr 280px;
}
main.dual .controls-panel {
  border-right: 1px solid #dde3ea;
}
main.dual #panel2 {
  border-left: 1px solid #dde3ea;
  border-right: none;
}

/* ── Pulley 2 accent colour (amber/orange) ── */
.panel-title-p2 {
  color: #761516 !important;
  border-bottom-color: #761516 !important;
}

/* ── Snap buttons container (inside preview-header) ── */
.view-snap-bar {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
}
.view-snap-btn {
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(255,255,255,0.82);
  border: 1px solid #bbb;
  border-radius: 4px;
  cursor: pointer;
  color: #333;
  white-space: nowrap;
  backdrop-filter: blur(2px);
  transition: background 0.12s;
}
.view-snap-btn:hover {
  background: rgba(0,120,212,0.15);
  border-color: #0078d4;
  color: #0078d4;
}

/* ── Help button ── */
.help-btn-row {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  padding: 6px 2px 2px;
  background: linear-gradient(to bottom, transparent, #fff 40%);
}

/* .btn-help, .btn-bug-report and .btn-privacy come from cct_theme.css (cct_common); don't re-declare them here or the shared ones lose. */
/* Out-of-range number input highlight */
input.input-out-of-range {
  outline: 2px solid #dc2626 !important;
  background: #fff0f0 !important;
}

/* Help icon in drive bar */
.drive-help {
  display: flex;
  align-items: center;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  main { flex-direction: column; height: auto; }
  main.dual { grid-template-columns: 1fr; }
  .controls-panel { width: 100%; border-right: none; border-bottom: 1px solid #dde3ea; }
  .preview-panel { min-height: 360px; }
  .drive-bar { gap: 10px; }
}

/* ── Feature Build mode visibility ── */
body.feature-build .fb-2d { display: none !important; }
body:not(.feature-build) .fb-3d { display: none !important; }

/* ── Hub section collapsible ── */
.hub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #0078d4;
  margin-bottom: 0;
}
.hub-header:hover { color: #005fa3; }
.hub-arrow {
  font-size: 10px;
  transition: transform 0.2s;
  color: #0078d4;
}
.hub-arrow.open { transform: rotate(180deg); }
.hub-body {
  display: none;
  margin-top: 10px;
}
.hub-body.open { display: block; }
.hub-info {
  font-size: 11px;
  color: #888;
  margin-top: 4px;
}
.hub-warn {
  font-size: 11px;
  color: #b91c1c;
  background: #fee2e2;
  border-radius: 4px;
  padding: 4px 8px;
  margin-top: 6px;
}
@keyframes cct-spoke-flash {
  0%   { opacity: 0;   background: #fecaca; }
  30%  { opacity: 1;   background: #fca5a5; }
  60%  { opacity: 0.7; background: #fecaca; }
  100% { opacity: 1;   background: #fee2e2; }
}
.spoke-overlap-warn {
  font-size: 11px;
  color: #b91c1c;
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: 4px;
  padding: 5px 8px;
  margin-top: 4px;
}
.spoke-overlap-warn.flash {
  animation: cct-spoke-flash 0.45s ease-out forwards;
}
/* Spoke fit warning: what had to change, and the Auto-fit button */
.spoke-overlap-warn .spoke-fit-head { font-weight: 600; }
.spoke-overlap-warn ul { margin: 4px 0 6px; padding-left: 16px; }
.spoke-overlap-warn li { margin: 1px 0; }
.spoke-fit-btn {
  width: auto;
  padding: 3px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: #b91c1c;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.spoke-fit-btn:hover { background: #991b1b; }


/* The CCT dialogs, buttons and the Download window (.cct-dialog, .cct-btn, .cct-dl, …)
   come from cct_theme.css (cct_common): one copy for every app. */

/* ─────────────────────────────────────────────────────────────────────────
   Sprocket Designer only
   ───────────────────────────────────────────────────────────────────────── */
.mode3d-sprocket {
  display: block;
  height: 24px;
  width: 24px;
  filter: grayscale(1) contrast(0.8);
  opacity: 0.75;
  transition: filter 0.3s, opacity 0.3s;
  pointer-events: none;
}
.mode3d input:checked ~ .mode3d-sprocket { filter: none; opacity: 1; }

/* Size card: Num. Teeth and Outer Dia. side by side, as the pulley's belt-group */
.size-row { display: flex; gap: 8px; }
.size-row > div { flex: 1; min-width: 0; }
.size-row label { margin-top: 0; }

.check-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 12px;
  cursor: pointer;
}
.check-row input { width: auto; margin: 0; accent-color: #0078d4; }
.hint { display: block; font-size: 11px; color: #888; margin: 2px 0 0 20px; }
/* Under a field another setting fills in: what sets it, and how to type your own. */
.field-note { font-size: 11.5px; color: #1e3a5f; background: #eef5fc; border-left: 3px solid #0078d4;
              border-radius: 3px; padding: 4px 7px; margin: 4px 0 2px; line-height: 1.35; }
.field-note.hidden { display: none; }

.fit-scale { display: flex; justify-content: space-between; font-size: 10px; color: #888; }
input[type="range"] { width: 100%; accent-color: #0078d4; }

.chain-info { font-size: 11px; color: #666; margin-top: 6px; line-height: 1.5; }
.approx { color: #b91c1c; font-weight: 600; cursor: help; }
.approx-note { font-size: 11px; color: #666; margin-top: 6px; }

.measured { margin-top: 8px; font-size: 12px; }
.measured summary { cursor: pointer; color: #555; }

.bom { margin: 4px 0 6px; padding-left: 18px; font-size: 11px; color: #333; }

/* Preview: the drawing fills the box; 3D viewer likewise */
.preview-box > .drawing { flex: 1; min-width: 0; min-height: 0; display: flex;
  align-items: center; justify-content: center; }
.preview-box > .drawing svg { width: 100%; height: 100%; }
.preview-box > .viewer { flex: 1; min-width: 0; min-height: 0; position: relative; }
.preview-box > .viewer canvas { display: block; width: 100%; height: 100%; }
.assembly-controls { position: absolute; left: 12px; bottom: 10px; z-index: 5;
  display: flex; gap: 14px; align-items: center; font-size: 12px;
  background: rgba(255,255,255,0.85); padding: 4px 10px; border-radius: 4px; }
.assembly-controls label { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.assembly-controls input[type="range"] { width: 110px; }

/* Under the preview: warnings and the dimension table (both sprockets) */
.results { flex-shrink: 0; max-height: 34%; overflow-y: auto; border-top: 1px solid #eee;
  background: #fff; padding: 6px 16px 8px; }
.results summary { cursor: pointer; font-size: 12px; font-weight: 600; color: #0078d4;
  text-transform: uppercase; letter-spacing: 0.5px; }
.warnings { margin: 4px 0; padding-left: 18px; color: #b91c1c; font-size: 12px; }
.warnings:empty { display: none; }
.dims { border-collapse: collapse; font-size: 12px; margin-top: 4px; }
.dims td, .dims th { padding: 2px 10px 2px 0; border-bottom: 1px solid #f0f2f5; text-align: left; }
.dims th { color: #888; font-weight: 600; }
.dims td.num { text-align: right; font-variant-numeric: tabular-nums; }
.min-dist-note { font-size: 11px; color: #888; }
/* Chain Waist sits above "Apply to both sprockets": it is global already. */
.chain-waist { padding-bottom: 8px; margin-bottom: 4px; border-bottom: 1px solid #e3e8ef; }
.chain-waist .preset-info { height: auto; }      /* two lines: don't clip into the hint */
/* Warnings, with one Auto-fix for all of them on the left (the pulley
   app's spoke-fit button). */
.warn-row { display: flex; align-items: flex-start; gap: 10px; }
.warn-row .warnings { flex: 1; min-width: 0; }
.warn-row #fix_all { flex-shrink: 0; margin-top: 4px; white-space: nowrap; }

/* Hover a setting's label to see its help picture — the pulley app's rules
   (PulleyWebApp-ss static/style.css), copied. */
label.has-picture {
  cursor: help;
  text-decoration: underline dotted #94a3b8;
  text-underline-offset: 3px;
}
.feature-pic {
  position: fixed;
  z-index: 2000;
  width: auto;
  max-width: min(1000px, calc(100vw - 24px));
  padding: 6px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.28);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s ease;
}
.feature-pic.open { opacity: 1; visibility: visible; }
.feature-pic img { display: block; width: auto; max-width: 100%; height: auto;
                   max-height: calc(100vh - 38px); }   /* tall pictures fit the window */
.card h2 .btn-help { width: 22px; height: 22px; font-size: 13px; }

/* Help modal (the pulley app's) */
#help-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1000;
  display: flex; align-items: center; justify-content: center; }
#help-overlay[hidden] { display: none; }
#help-box { background: #fff; border-radius: 8px; width: min(760px, 95vw); height: 85vh;
  display: flex; flex-direction: column; box-shadow: 0 8px 40px rgba(0,0,0,0.3); overflow: hidden; }
#help-head { display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-bottom: 1px solid #dde3ea; background: #f7f9fc; flex-shrink: 0;
  font-size: 13px; font-weight: 600; color: #333; }
#help-close { background: none; border: none; font-size: 20px; cursor: pointer; color: #555;
  line-height: 1; padding: 0 4px; width: auto; }
#help-iframe { flex: 1; border: none; min-height: 0; }
input.len-wide { width: 90px; }
.drive-units select { width: auto; padding: 3px 6px; font-size: 12px; }

/* Report a bug — Timing Pulley Generator's dialog and button, copied
   (PulleyWebApp-ss static/style.css). */

/* ── Bug report modal ────────────────────────────────────────────────────── */
#bug-report-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1100;
  align-items: center;
  justify-content: center;
}
#bug-report-box {
  background: #fff;
  border-radius: 8px;
  width: min(520px, 96vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0,0,0,0.35);
  overflow: hidden;
}
.bug-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid #dde3ea;
  background: #fffbeb;
  flex-shrink: 0;
}
.bug-title {
  font-size: 18px;
  font-weight: 700;
  color: #92400e;
}
.bug-feature-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  margin-left: auto;
  margin-right: 10px;
  user-select: none;
}
.bug-feature-toggle input[type="checkbox"] {
  cursor: pointer;
  accent-color: #2563eb;
  width: 14px;
  height: 14px;
}
.bug-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #555;
  line-height: 1;
  padding: 0 4px;
}
.bug-close:hover { color: #000; }
.bug-body {
  overflow-y: auto;
  padding: 18px 20px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bug-label {
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
  display: block;
}
.bug-optional {
  font-weight: 400;
  color: #888;
  font-size: 12px;
}
.bug-textarea {
  width: 100%;
  border: 1px solid #c8d6e2;
  border-radius: 4px;
  padding: 7px 9px;
  font-size: 13px;
  resize: vertical;
  font-family: inherit;
  box-sizing: border-box;
  color: #1a1a1a;
}
.bug-textarea:focus { outline: none; border-color: #0078d4; }
.bug-input {
  width: 100%;
  border: 1px solid #c8d6e2;
  border-radius: 4px;
  padding: 7px 9px;
  font-size: 13px;
  font-family: inherit;
  box-sizing: border-box;
  color: #1a1a1a;
}
.bug-input:focus { outline: none; border-color: #0078d4; }
.bug-status {
  font-size: 12px;
  min-height: 18px;
  color: #555;
}
.bug-status-ok    { color: #16a34a; font-weight: 600; }
.bug-status-error { color: #dc2626; font-weight: 600; }
.bug-status-warn  { color: #b45309; font-weight: 600; white-space: pre-line; }
.bug-philosophy {
  font-size: 12px;
  color: #666;
  background: #f8fafc;
  border-top: 1px solid #dde3ea;
  padding: 10px 20px;
  line-height: 1.5;
}
.bug-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px 16px;
  border-top: 1px solid #dde3ea;
  flex-shrink: 0;
}
.bug-btn {
  padding: 6px 20px;
  font-size: 13px;
  border-radius: 4px;
  cursor: pointer;
  border: 1.5px solid transparent;
  font-weight: 600;
}
.bug-btn-cancel {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #475569;
}
.bug-btn-cancel:hover { background: #e2e8f0; }
.bug-btn-submit {
  background: #0078d4;
  border-color: #0078d4;
  color: #fff;
}
.bug-btn-submit:hover:not(:disabled) { background: #005fa3; border-color: #005fa3; }
.bug-btn-submit:disabled { opacity: 0.55; cursor: default; }
.bug-info-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid #c8d0db;
  background: #f0f4f9;
  color: #0078d4;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  flex-shrink: 0;
  margin-left: auto;
  margin-right: 6px;
}
.bug-info-btn:hover {
  background: #0078d4;
  border-color: #0078d4;
  color: #fff;
}
.bug-info-panel {
  background: #eef5fc;
  border-left: 3px solid #0078d4;
  border-radius: 0 4px 4px 0;
  padding: 10px 14px;
  margin: 0 0 12px;
  font-size: 13px;
  color: #1a3a5c;
  line-height: 1.5;
}
.bug-info-panel ul {
  margin: 6px 0 4px 18px;
}
.bug-info-panel li {
  margin-bottom: 3px;
}
.bug-info-panel p {
  margin-top: 6px;
  font-style: italic;
  color: #4a6080;
}

/* ── Token account box (static/tokens.js; Timing Pulley Generator's, ADR-040) ── */
.cct-account          { margin-left: 12px; display: flex; align-items: center; gap: 12px; font-size: 13px; }
.cct-account[hidden]  { display: none; }
.cct-account-email    { opacity: 0.88; }
.cct-account-balance  { background: rgba(255,255,255,0.18); border-radius: 12px; padding: 3px 10px;
                        border: 0; color: inherit; font: inherit; font-weight: 600; cursor: pointer; }
.cct-account-balance:hover,
.cct-account-balance:focus-visible { background: rgba(255,255,255,0.32); outline: none; }
.cct-token-count      { margin: 0 0 6px; font-size: 34px; font-weight: 700; color: #0078d4; line-height: 1.1; }
.cct-token-count span { font-size: 16px; font-weight: 600; color: #333; }
