:root {
  color-scheme: light;
  --paper: #f4efe4;
  --ink: #192d39;
  --muted: #4d6066;
  --accent: #1a4d6c;
  --line: #c3c1b8;
  --mono: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-family: system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
main { width: min(76rem, 100% - 2rem); margin: auto; }
.mast { padding: 2.5rem 0 1.8rem; border-bottom: 2px solid var(--ink); }
.kicker, .caption, footer { font: 0.82rem/1.5 var(--mono); }
.kicker { color: var(--accent); text-transform: uppercase; letter-spacing: 0.09em; }
h1, h2 { font-family: Georgia, serif; font-weight: 500; }
h1 { margin: 0; font-size: clamp(2.6rem, 7vw, 5rem); line-height: 1; letter-spacing: -0.055em; }
h2 { margin: 0 0 1rem; font-size: 1.65rem; }
p { margin: 0.6rem 0 0; line-height: 1.5; }
.workbench { display: grid; grid-template-columns: minmax(18rem, 22rem) minmax(0, 1fr); }
form, .proof { padding: 1.8rem 0; }
form { padding-right: 1.5rem; border-right: 1px solid var(--line); }
.proof { padding-left: 1.5rem; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 0.7rem; }
label, legend { display: block; font-size: 0.88rem; font-weight: 650; }
label { margin: 0 0 0.82rem; }
fieldset { min-width: 0; border: 0; padding: 0; margin: 0; }
fieldset p { color: var(--muted); font-size: 0.86rem; margin: 0 0 0.65rem; }
input, select, button { font: inherit; min-height: 2.6rem; }
input, select { width: 100%; color: var(--ink); background: #fffdf8; border: 1px solid #89959a; padding: 0.4rem 0.45rem; margin-top: 0.23rem; }
summary { cursor: pointer; margin: 0.25rem 0 0.9rem; font-size: 0.9rem; }
button { border: 1px solid var(--accent); background: var(--accent); color: white; padding: 0.5rem 1rem; cursor: pointer; }
a { color: var(--accent); text-underline-offset: 0.2em; }
:focus-visible { outline: 3px solid #a25320; outline-offset: 2px; }
#status { font-size: 0.9rem; color: var(--muted); min-height: 1.4em; margin: -0.5rem 0 0.8rem; }
#status.error { color: #8e251f; }
.stage {
  display: grid;
  place-items: center;
  padding: clamp(0.75rem, 3vw, 2rem);
  background-color: #dfe8e9;
  background-image: linear-gradient(#c8d6d9 1px, transparent 1px), linear-gradient(90deg, #c8d6d9 1px, transparent 1px);
  background-size: 16px 16px;
  overflow: hidden;
}
.blueprint { position: relative; width: min(100%, 28rem, var(--proof-width, 28rem)); aspect-ratio: var(--aspect, 4 / 3); background: #adc4cf; outline: 1px solid var(--accent); }
.guide { position: absolute; left: var(--x); top: var(--y); width: var(--width); height: var(--height); }
.panel { display: grid; place-items: center; background: #f9f6ee; color: var(--accent); font: clamp(0.65rem, 2vw, 1rem) var(--mono); outline: 1px solid #7896a3; overflow: hidden; }
.spine, .spine-key { background: #2a5d78; }
.hinge, .hinge-key { background: repeating-linear-gradient(45deg, #83a7b7 0 3px, #b7c9ce 3px 6px); }
.barcode, .barcode-key { background: #b36b38; }
.barcode { outline: 1px dashed #713b19; }
.caption { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; color: var(--muted); }
.swatch { width: 0.78em; height: 0.78em; display: inline-block; margin-left: 0.7rem; }
.swatch:first-child { margin-left: 0; }
.measurements { margin: 1rem 0 0; }
.measurements div { display: grid; grid-template-columns: 1fr 1.4fr; gap: 0.55rem; padding: 0.55rem 0; border-bottom: 1px solid var(--line); }
.measurements dt { font-size: 0.88rem; }
.measurements dd { margin: 0; font: 0.88rem/1.4 var(--mono); overflow-wrap: anywhere; }
.fine-print { font-size: 0.85rem; color: var(--muted); }
footer { border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 0.6rem 1.2rem; padding: 1rem 0 2rem; }
@media (max-width: 45rem) {
  .workbench { grid-template-columns: minmax(0, 1fr); }
  form { padding-right: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .proof { padding-left: 0; }
}
