:root {
  color-scheme: light;
  --ink: #17382e;
  --muted: #4c5e53;
  --paper: #f8f5eb;
  --line: #d9d3c3;
  font: 100%/1.5 system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: inherit; text-underline-offset: .2em; }
button, input, select { font: inherit; }
:focus-visible { outline: 3px solid #9b4f1e; outline-offset: 3px; }
.wrap { width: min(72rem, calc(100% - 3rem)); margin-inline: auto; }
.mast { border-bottom: 1px solid var(--line); }
.mast-inner, footer { display: flex; justify-content: space-between; gap: .7rem 1.5rem; flex-wrap: wrap; align-items: center; padding-block: 1rem; }
.mast span { font-weight: 750; }
.mast a, footer a { font-size: .9rem; font-weight: 650; }
.intro { margin-block: clamp(1.75rem, 5vw, 4rem) 1.8rem; }
h1, h2, p, dl, dd { margin: 0; }
h1 { font: 600 clamp(2.5rem, 6.8vw, 5.25rem)/1 Georgia, serif; letter-spacing: -.05em; }
.intro p { margin-top: .85rem; color: var(--muted); max-width: 48ch; }
h2 { font-size: 1.25rem; line-height: 1.2; letter-spacing: -.025em; }
.workspace { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.3fr); gap: 1rem; align-items: start; }
.settings, .preview { padding: clamp(1rem, 2.6vw, 2rem); border: 1px solid var(--line); border-radius: .8rem; background: #fffdf7; }
.settings h2 { margin-bottom: 1.1rem; }
label, legend { font-weight: 700; }
input, select { display: block; width: 100%; min-width: 0; margin-top: .3rem; color: var(--ink); background: #fff; border: 1px solid #8e9d92; border-radius: .4rem; padding: .55rem .65rem; min-height: 2.75rem; }
fieldset { min-width: 0; border: 0; padding: 0; margin: 1.05rem 0 0; }
legend { padding: 0; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; margin-top: .3rem; }
.pair label { font-size: .86rem; color: var(--muted); }
.pair input { font-size: 1rem; }
.hint { color: var(--muted); font-size: .88rem; }
button { background: var(--ink); color: white; border: 0; border-radius: .42rem; font-weight: 750; padding: .75rem 1rem; width: 100%; margin-block: 1.25rem .55rem; cursor: pointer; }
button:hover { background: #285646; }
button:disabled { background: #52655a; cursor: default; }
#feedback { color: #8c3021; margin-top: .7rem; }
.preview-header { display: flex; justify-content: space-between; gap: .35rem 1rem; flex-wrap: wrap; align-items: baseline; margin-bottom: 1rem; }
.preview-header span { color: var(--muted); font-size: .85rem; }
.board { container-type: inline-size; position: relative; min-height: 16rem; height: clamp(16rem, 27vw, 20rem); display: grid; place-items: center; text-align: center; padding: 1rem; border: 1px solid #ccdacc; border-radius: .4rem; background-color: #edf2e8; background-image: radial-gradient(#a2b3a3 1px, transparent 1px); background-size: 12px 12px; }
.diagram, .paper-diagram { position: relative; display: grid; place-items: center; }
.diagram { width: max(2px, min(calc(76cqw * var(--box-w, 1)), calc(11rem * var(--board-w, 1)))); height: max(2px, min(calc(76cqw * var(--box-h, 1)), calc(11rem * var(--board-h, 1)))); outline: 2px dashed #436550; outline-offset: 2px; background: #fffdf7; }
.impression { width: var(--fit-w, 100%); height: var(--fit-h, 33.333%); min-width: 1px; min-height: 1px; background: #276146; }
#empty { background: #fffdf7; border-radius: .4rem; padding: .6rem .9rem; }
.readings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; margin-top: 1rem; }
.readings > div { padding: .65rem .75rem; background: #f3f0e6; border-radius: .4rem; }
dt { font-size: .85rem; color: var(--muted); }
dd { font-weight: 750; overflow-wrap: anywhere; }
.preview-hint { margin-top: .85rem; max-width: 54ch; }
footer { margin-top: 1.5rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; }
.print-sheet { display: none; }
@media (max-width: 44rem) {
  .wrap { width: calc(100% - 1.5rem); }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .board { height: 14rem; min-height: 14rem; }
}
@media (max-width: 20rem) {
  .readings { grid-template-columns: minmax(0, 1fr); }
}
@page { margin: .5in; }
@media print {
  :root { background: white; color: black; }
  .screen, noscript { display: none; }
  .print-sheet { display: block; font: 11pt/1.4 system-ui, sans-serif; }
  .print-sheet h1 { font: 700 24pt/1.2 Georgia, serif; letter-spacing: normal; }
  .print-sheet p { margin: 8pt 0; }
  .scale-line { width: 50mm; height: 0; border-top: 1pt solid black; margin-block: 12pt; }
  .paper-diagram { width: var(--paper-w, 3in); height: var(--paper-h, 3in); margin: 13pt 1pt; outline: .75pt dashed black; break-inside: avoid; }
  .paper-fit { width: var(--fit-w, 100%); height: var(--fit-h, 33.333%); outline: 1pt solid black; }
  .paper-credit { font-size: 9pt; }
  .invalid .print-sheet { display: none; }
}
