.ruler-launch { display: grid; justify-items: start; gap: 10px; }
.ruler-workspace[data-stage-active] { display: flex; flex-direction: column; background: #fcfaff; color: #171727; }
.ruler-toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; padding: 12px; background: #f1ebff; }
.ruler-toolbar label, .ruler-calibration label { display: grid; gap: 3px; font-size: .85rem; font-weight: 650; }
.ruler-toolbar select, .ruler-calibration :is(select,input[type=number]) { min-height: 38px; padding: 5px 8px; background: #fff; border: 1px solid #d5c8ef; border-radius: 8px; font: inherit; }
.ruler-toolbar button, .ruler-calibration button { min-height: 38px; padding-inline: 10px; }
.ruler-results { flex-basis: 100%; font-size: .9rem; font-variant-numeric: tabular-nums; }
.ruler-board { position: relative; flex: 1; min-height: 0; }
.ruler-board canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.ruler-calibration { position: absolute; z-index: 2; top: min(145px, 24%); right: 12px; width: min(580px, calc(100% - 24px)); max-height: calc(100% - min(145px, 24%) - 12px); overflow: auto; padding: 16px; background: white; border: 1px solid #d5c8ef; border-radius: 12px; box-shadow: 0 8px 32px #25184130; }
.ruler-calibration h2 { font-size: 1.1rem; margin-bottom: 8px; }
.ruler-calibration p { margin: 6px 0; font-size: .85rem; }
.ruler-calibration input[type=range] { width: 100%; accent-color: #5538da; }
.ruler-reference { overflow: hidden; margin: 10px 0; }
.ruler-reference div { height: 34px; background: #ede5ff; border: 2px solid #5538da; border-radius: 3px; }
.ruler-workspace [hidden] { display: none; }

.ruler-launch-scale {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  grid-template-rows: 23px clamp(92px, 16vw, 146px);
  width: 100%;
  padding: 5px 12px 12px 4px;
  border: 1px solid #d5c8ef;
  border-radius: 10px;
  background: #f2ebff;
  color: #4329bb;
  font-size: .75rem;
  font-weight: 650;
}
.ruler-preview-x {
  grid-column: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ruler-preview-x span { flex: 0 0 0; white-space: nowrap; }
.ruler-preview-x span:last-child { transform: translateX(-100%); }
.ruler-preview-y {
  grid-column: 1;
  display: grid;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  text-align: center;
}
.ruler-preview-y span { align-self: end; transform: translateY(50%); }
.ruler-preview-grid {
  grid-column: 2;
  border: 1px solid #9a80d9;
  background:
    linear-gradient(90deg, #c5b4ef 1px, transparent 1px) 0 0 / 20% 100%,
    linear-gradient(#c5b4ef 1px, transparent 1px) 0 0 / 100% calc(100% / 3),
    linear-gradient(90deg, #e4d9f9 1px, transparent 1px) 0 0 / 4% 100%,
    linear-gradient(#e4d9f9 1px, transparent 1px) 0 0 / 100% calc(100% / 15),
    #fcfaff;
}
.ruler-calibration {
  inset: 10px 12px;
  width: min(1000px, calc(100% - 24px));
  max-height: none;
  margin-inline: auto;
  background: #fcfaff;
}
.ruler-methods { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ruler-methods button { background: white; border: 1px solid #d5c8ef; border-radius: 8px; color: #4329bb; font-size: .85rem; }
.ruler-methods button[aria-selected="true"] { background: #5538da; border-color: #5538da; color: white; }
.ruler-methods span { font-size: 1rem; }
.ruler-reference {
  display: grid;
  place-items: center;
  height: max(180px, calc(100dvh - 275px));
  border: 1px solid #e4d9f8;
  border-radius: 10px;
  background: #f7f3ff;
}
.ruler-reference div {
  display: grid; place-items: center; color: #4329bb; white-space: nowrap; font-size: .82rem;
}
.ruler-reference-controls { display: flex; align-items: end; gap: 10px; }
.ruler-reference-controls label { flex: 1; }
.ruler-results { font-weight: 650; }
