.tool-intro { padding-block: 2rem 0; max-inline-size: 58rem; }
.tool-intro h1 { font-size: clamp(2rem, 3.5vw, 3rem); }
.tool { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1.5rem; align-items: start; padding-block: 1.5rem 3rem; }
.tool > * { min-inline-size: 0; }
.tool .tool-stage { overflow: visible; margin-inline: .5rem; }
/* The photo area does not scroll the page on touch, so the print and corners can be dragged. */
.tool-stage__frame { position: relative; border-radius: .3rem; touch-action: none; }
.tool-stage__frame:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.tool-stage__frame canvas { display: block; width: 100%; height: auto; border-radius: .3rem .3rem 0 0; }
#tool-overlay, #tool-handles { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.tool-handles { direction: ltr; }
.tool-handle { position: absolute; width: 44px; height: 44px; min-block-size: 44px; padding: 0; border: 0; border-radius: 0; background: transparent; transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px))); pointer-events: auto; touch-action: none; cursor: grab; }
/* A 44 px hit target with a small visible dot, so the markers never hide the reference they mark. */
.tool-handle::after { content: ''; position: absolute; inset: 17px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1.5px #fffdf8, 0 0 0 2.5px rgb(0 0 0 / .45); transform: translate(calc(0px - var(--dx, 0px)), calc(0px - var(--dy, 0px))); }
.tool-handle:active { cursor: grabbing; }
.tool-handle:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; box-shadow: 0 0 0 4px var(--surface); }
.tool-badge { display: inline-block; margin: 1rem; padding: .2rem .75rem; border: 1px solid var(--line); border-radius: 2rem; background: var(--surface); font-weight: 600; }
.tool-badge:empty { display: none; }
.tool .tool-status { margin: 0; padding: .5rem 1rem 1rem; overflow-wrap: anywhere; }
.tool-controls { min-inline-size: 0; padding: 1rem; }
.tool-controls > fieldset { display: grid; gap: .65rem; padding: .85rem; border-radius: .25rem; }
.tool-controls legend { max-inline-size: 100%; padding-inline: .35rem; font-weight: 600; }
.tool-controls :is(p, .tool-note, .tool-hint) { margin: 0; }
.tool-note, .tool-hint { color: var(--muted); font-size: .875rem; }
.tool-controls .button { display: inline-flex; inline-size: 100%; cursor: pointer; }
.tool-controls label.button:has(+ input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 4px; }
.tool .tool-controls input.visually-hidden { inline-size: 1px; min-block-size: 1px; block-size: 1px; }
.tool-controls .tool-inline { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .5rem; }
.tool-inline input, .tool-check input { inline-size: 1.25rem; block-size: 1.25rem; min-block-size: 1.25rem; margin: 0; accent-color: var(--accent); flex-shrink: 0; }
.tool-inline label { margin-inline-end: .65rem; cursor: pointer; }
.tool-controls .tool-check { display: flex; gap: .5rem; align-items: center; min-block-size: 2.75rem; cursor: pointer; }
.tool-dims { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: .5rem; }
.tool-dims[hidden] { display: none; }
.tool-guide { max-inline-size: 52rem; }
.tool-size-chart { min-inline-size: 30rem; font-variant-numeric: tabular-nums; }
.tool-size-chart caption { text-align: start; color: var(--muted); margin-block-end: 1rem; }
.tool-size-chart tbody th { background: transparent; }
@media (min-width: 52.01rem) {
  .tool .tool-stage { position: sticky; inset-block-start: 1rem; }
}
@media (max-width: 52rem) {
  .tool { grid-template-columns: minmax(0, 1fr); }
}
