.screw-config {
  margin-top: 18px;
}
.screw-config > .layout {
  display: grid;
  grid-template-columns: minmax(330px, .9fr) minmax(360px, 1.35fr);
  gap: 18px;
  align-items: start;
}
.screw-config .panel {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.screw-config h2 {
  margin: 0 0 9px;
  font-size: 20px;
}
.screw-config h3 {
  margin: 14px 0 6px;
}
.screw-config .grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 12px;
}
.screw-config label {
  display: block;
}
.screw-config select,
.screw-config input:not([type="checkbox"]) {
  display: block;
  width: 100%;
  min-width: 0;
}
.screw-config input[type="checkbox"] {
  width: auto;
  min-height: 0;
}
.screw-config .tools,
.screw-config .row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 9px 0;
}
.screw-config button:not(.primary):not(.secondary) {
  border: 1px solid #a9bcb9;
  border-radius: 5px;
  background: #fff;
  color: inherit;
  padding: 6px 11px;
  font: inherit;
  cursor: pointer;
}
.screw-config button[aria-pressed="true"] {
  background: #215b60 !important;
  color: #fff !important;
}
.screw-config .view {
  position: sticky;
  top: 105px;
}
.screw-config #screwViewer {
  height: clamp(260px, 33vw, 450px);
  background: #edf3f1;
  border-radius: 6px;
  overflow: hidden;
}
.screw-config canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.screw-config .base {
  display: block;
  margin: 8px 0;
  color: #85501f;
}
.screw-config #startsField {
  margin-top: 9px;
}
.screw-config #lead {
  display: block;
  margin-top: 3px;
  padding: 6px 9px;
  color: #16585b;
  background: #e8f2ef;
  border-radius: 4px;
  font-weight: 700;
}
.screw-config #err,
.screw-config #lockHint {
  color: #963913;
}
.screw-config #err:empty {
  display: none;
}
.screw-config fieldset {
  margin: 12px 0;
  min-width: 0;
}
.screw-config fieldset button {
  margin-top: 7px;
}
.screw-config hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 14px 0;
}
.shaft-sizing {
  margin: 0;
  padding: 12px clamp(10px, 1.6vw, 22px) 16px;
  border-top: 1px solid var(--line, #c8d5d2);
}
.shaft-diagram {
  display: flex;
  align-items: center;
  min-height: 20px;
  margin-bottom: 10px;
}
.shaft-diagram span {
  flex-basis: 0;
  min-width: 2px;
  border: 1px solid #a6b9c0;
  background: #c3d1d4;
}
.shaft-diagram span[data-hand] {
  border-color: #59909b;
  background: repeating-linear-gradient(var(--thread-angle), #c9e0e1 0 5px, #5f9098 5px 6px);
}
.shaft-diagram span[data-hand='L'] { --thread-angle: -45deg; }
.shaft-diagram span[data-hand='R'] { --thread-angle: 45deg; }
.shaft-diagram span[data-selected] { box-shadow: inset 0 0 0 1px #ac5d29; }
.shaft-dimensions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
  text-align: center;
}
.shaft-dimensions dt, .shaft-schematic-meta { color: var(--muted, #536e70); font-size: 13px; }
.shaft-dimensions dd { margin: 2px 0 0; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.shaft-schematic-meta { margin: 9px 0 0; text-align: center; }
@media (max-width: 460px) {
  .shaft-dimensions dt { font-size: 12px; }
  .shaft-dimensions dd { font-size: 14px; }
}
.screw-config .bearings {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.screw-config .bearings summary {
  cursor: pointer;
  font-weight: 700;
}
.screw-config .bearing-reference,
.screw-config .bearing-scroll {
  overflow-x: auto;
}
.screw-config .bearing-reference {
  margin-top: 14px;
}
.screw-config .bearing-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(520px, 1fr));
  gap: 20px;
  align-items: start;
}
.screw-config .bearing-side {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}
.screw-config .bearing-side > h3 {
  margin: 0 0 8px;
}
.screw-config .bearing-sketch svg {
  display: block;
  width: 100%;
  height: auto;
}
.screw-config .bearing-scroll {
  margin: 12px 0 17px;
}
.screw-config .bearings table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.screw-config .bearings caption {
  padding: 4px 0 8px;
  text-align: left;
  font-weight: 700;
}
.screw-config .bearings th,
.screw-config .bearings td {
  padding: 6px 7px;
  text-align: center;
  line-height: 1.4;
  border: 1px solid var(--line);
}
.screw-config .bearings thead th {
  background: #e8f2ef;
}
.screw-config .bearings tbody td,
.screw-config .bearings tbody th {
  white-space: nowrap;
}
.screw-config .bearings tbody th {
  text-align: left;
  font-weight: 600;
}
.screw-config .bearing-photo {
  max-width: 360px;
  margin: 16px auto 0;
}
.screw-config .bearing-photo img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}
.screw-config .bearing-photo figcaption {
  margin-top: 6px;
  text-align: center;
  font-size: 14px;
}
#previewHandField {
  display: block;
  max-width: 180px;
  margin: 12px 0;
}
[hidden] {
  display: none !important;
}
@media (max-width: 800px) {
  .screw-config > .layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .screw-config .view {
    position: static;
    order: -1;
  }
  .screw-config #screwViewer {
    height: 220px;
  }
}
