:root {
  color-scheme: light;
  --bg: #f2f3f5;
  --sheet: #fff;
  --ink: #212733;
  --muted: #505967;
  --accent: #244d86;
  --line: #c8ced6;
  --tint: #e0e8f2;
  --hot: #8d251e;
  --display: Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, Consolas, 'Courier New', monospace;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  scroll-behavior: smooth;
  scroll-padding-top: 1rem;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.48 var(--sans);
}
a {
  color: var(--accent);
  text-underline-offset: 0.2em;
}
button,
a,
input,
select,
textarea,
summary {
  touch-action: manipulation;
}
a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
main,
header,
footer {
  width: min(1232px, calc(100% - 72px));
  margin: auto;
}
.jump {
  position: absolute;
  left: 0.8rem;
  top: -5rem;
  z-index: 3;
  background: #fff;
  padding: 0.6rem;
  color: #111;
}
.jump:focus {
  top: 0.8rem;
}
.mast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 19px 0;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  gap: 0.55rem;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  font-weight: 750;
  font-size: 1.3rem;
  letter-spacing: -0.045em;
}
.brand img {
  width: 32px;
  height: 32px;
}
.mast nav {
  display: flex;
  gap: 1.4rem;
}
.mast nav a {
  color: var(--muted);
  font-size: 0.9rem;
}
.intro {
  padding: clamp(24px, 3vw, 45px) 0 24px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(235px, 0.85fr);
  align-items: end;
  gap: 3rem;
}
.intro h1,
.guide h1 {
  font: 500 clamp(2.7rem, 5vw, 4.8rem) / 0.99 var(--display);
  letter-spacing: -0.055em;
  margin: 0;
  text-wrap: balance;
}
.intro p {
  max-width: 54ch;
  color: var(--muted);
  margin: 0;
  font-size: clamp(1rem, 1.3vw, 1.13rem);
  padding-bottom: 0.2rem;
}
.bench {
  display: grid;
  grid-template-columns: minmax(270px, 0.83fr) minmax(0, 1.17fr);
  gap: clamp(16px, 2vw, 30px);
  align-items: start;
}
.controls,
.stage {
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--sheet);
  padding: clamp(18px, 2.4vw, 34px);
}
h2,
h3,
p {
  overflow-wrap: break-word;
}
.controls h2,
.stage h2,
.guide h2,
.aside-note h2 {
  font: 600 clamp(1.28rem, 2.2vw, 1.75rem) / 1.11 var(--display);
  letter-spacing: -0.025em;
  margin: 0;
}
.fields {
  margin-top: 21px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px 15px;
}
.fields label {
  display: flex;
  flex-direction: column;
  gap: 0.36rem;
  font-size: 0.88rem;
  font-weight: 600;
  min-width: 0;
}
.fields .wide {
  grid-column: 1/-1;
}
input,
select,
textarea {
  font: 500 1rem/1.3 var(--sans);
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: #202329;
  padding: 9px 10px;
  min-height: 43px;
  font-variant-numeric: tabular-nums;
}
textarea {
  min-height: 170px;
  color: #273147;
  line-height: 1.6;
  font-family: var(--mono);
  resize: vertical;
}
input[readonly] {
  background: #e8ebee;
}
.reset {
  margin: 21px 0 0;
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 1px dotted currentColor;
  border-radius: 0;
  padding: 3px 0;
  font: inherit;
  font-size: 0.86rem;
  color: var(--muted);
  cursor: pointer;
}
.file-line {
  margin: 15px 0 3px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 3px;
  color: var(--ink);
  font-size: 0.88rem;
}
.file-line label {
  display: block;
  font-weight: 650;
}
.file-line input {
  margin: 6px 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  font-size: 0.83rem;
}
.file-line input::file-selector-button {
  border: 0;
  padding: 9px;
  border-radius: 3px;
  background: var(--tint);
  color: var(--ink);
  font: 600 0.86rem var(--sans);
  cursor: pointer;
}
.file-line p,
.mini {
  color: var(--muted);
  font-size: 0.84rem;
  margin: 0.35rem 0;
}
.stage {
  border-top: 4px solid var(--accent);
}
.stage h2 {
  font: 650 0.9rem/1.5 var(--sans);
  color: var(--muted);
  letter-spacing: 0.01em;
}
.stage h3 {
  font: 550 clamp(1.9rem, 3.2vw, 3rem) / 1.06 var(--display);
  letter-spacing: -0.045em;
  margin: 0.35rem 0;
}
.stage > p {
  color: var(--muted);
  max-width: 66ch;
  margin: 8px 0 15px;
}
.stats {
  margin: 16px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
}
.stats div {
  min-width: 0;
}
.stats dt {
  color: var(--muted);
  font-size: 0.78rem;
}
.stats dd {
  margin: 1px 0;
  font-size: 1.08rem;
  font-weight: 660;
  font-variant-numeric: tabular-nums;
}
.figure {
  background: var(--tint);
  border-radius: 4px;
  margin: 4px 0 8px;
  width: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 8px;
}
.figure:empty {
  display: none;
}
.figure svg {
  display: block;
  width: min(100%, 530px);
  height: auto;
  max-height: 226px;
}
.figure svg text {
  font: 12px var(--sans);
  fill: var(--ink);
}
.rule,
.tick,
.crease {
  stroke: var(--muted);
  stroke-width: 1;
  fill: none;
}
.paper {
  fill: var(--sheet);
}
.actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 16px;
}
.primary,
.primary-link {
  appearance: none;
  background: var(--accent);
  color: var(--buttonInk, #fff);
  padding: 11px 18px;
  font: 650 0.96rem var(--sans);
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  text-decoration: none;
}
.primary:hover {
  filter: brightness(0.9);
}
.primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.notice {
  font-size: 0.86rem;
  color: var(--muted);
}
.stage[data-state='invalid'] h3,
.stage[data-state='invalid'] .notice {
  color: var(--hot);
}
details {
  font-size: 0.9rem;
  margin-top: 15px;
}
summary {
  cursor: pointer;
  color: var(--accent);
  width: max-content;
  max-width: 100%;
  padding: 5px 0;
  font-weight: 600;
}
ol {
  padding-left: 1.5rem;
  overflow-wrap: anywhere;
}
ol li {
  margin: 0.25rem 0;
}
#details {
  max-height: 16rem;
  overflow: auto;
}
.aside-note {
  margin: 32px 0 24px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 2rem;
}
.aside-note p {
  margin: 0;
  color: var(--muted);
}
footer {
  padding: 18px 0 32px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.82rem;
}
.guide {
  width: min(830px, 100%);
  margin: 38px auto 55px;
}
.guide h1 {
  max-width: 18ch;
}
.guide .lede {
  font-size: 1.1rem;
  color: var(--muted);
}
.guide article {
  margin: 25px 0;
  max-width: 68ch;
}
.guide article p {
  margin: 0.55rem 0;
  color: var(--ink);
  line-height: 1.65;
}
.guide .primary-link {
  display: inline-block;
  margin: 14px 0;
}
.guide ul {
  line-height: 1.7;
}
.guide footer {
  margin: 2rem 0;
}
.error404 {
  padding: 12vh 0;
}
.error404 h1 {
  font: 3rem var(--display);
}
@media (max-width: 870px) {
  main,
  header,
  footer {
    width: calc(100% - 40px);
  }
  .intro {
    gap: 1.2rem;
  }
  .bench {
    grid-template-columns: minmax(230px, 0.8fr) minmax(0, 1.05fr);
  }
  .controls,
  .stage {
    padding: 18px;
  }
  .fields {
    gap: 10px;
  }
  .stats {
    gap: 8px 14px;
  }
}
@media (max-width: 690px) {
  main,
  header,
  footer {
    width: calc(100% - 28px);
  }
  .mast {
    padding: 12px 0;
    gap: 8px;
  }
  .mast nav {
    gap: 11px;
  }
  .mast nav a {
    font-size: 0.81rem;
  }
  .intro {
    display: block;
    padding: 23px 0 18px;
  }
  .intro h1 {
    font-size: clamp(2.45rem, 9.5vw, 3.65rem);
  }
  .intro p {
    font-size: 0.98rem;
    margin-top: 10px;
  }
  .bench {
    display: flex;
    flex-direction: column;
    gap: 13px;
  }
  .bench > * {
    width: 100%;
  }
  .fields {
    gap: 10px 9px;
    margin-top: 13px;
  }
  .fields label {
    font-size: 0.83rem;
  }
  .aside-note {
    display: block;
    margin-top: 24px;
  }
  .aside-note p {
    margin-top: 0.55rem;
  }
  .guide {
    margin: 26px auto 30px;
  }
  footer {
    flex-wrap: wrap;
  }
  .figure svg {
    max-height: 190px;
  }
  .stats {
    margin: 12px 0;
  }
  .brand img {
    width: 27px;
    height: 27px;
  }
  .brand {
    font-size: 1.1rem;
  }
  input,
  select,
  textarea {
    font-size: 16px;
  }
  .controls,
  .stage {
    padding: 15px;
  }
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    animation: none !important;
    transition: none !important;
  }
}
@media print {
  .mast nav,
  .controls,
  .actions,
  .reset,
  footer,
  .aside-note,
  .jump {
    display: none;
  }
  .bench {
    display: block;
  }
  .stage {
    border: 0;
  }
  .intro h1 {
    font-size: 28pt;
  }
  body {
    background: white !important;
    color: black;
  }
  main {
    width: 95%;
  }
  .figure {
    print-color-adjust: exact;
  }
  .intro p {
    font-size: 10pt;
  }
}

@media (max-width: 380px) {
  .mast {
    gap: 4px;
  }
  .mast nav {
    gap: 6px;
  }
  .mast nav a {
    font-size: 0.75rem;
  }
  .mast .brand {
    font-size: 1.04rem;
  }
  .mast .brand img {
    width: 23px;
    height: 23px;
  }
}

:root {
  --bg: #faecdd;
  --sheet: #fffaf4;
  --ink: #482538;
  --muted: #6e4c56;
  --accent: #8b3656;
  --line: #d4bbb4;
  --tint: #f1d8bd;
  --display: Georgia, 'Times New Roman', serif;
}
.mast {
  border-bottom: 3px double var(--accent);
}
.stage {
  border: 1px solid var(--line);
  border-right: 6px solid var(--accent);
}
.controls {
  background: #fff4e7;
}
.intro h1 {
  font-weight: 600;
}
.figure .unused {
  fill: #fff3df;
  stroke: #b9a392;
}
.figure .cut {
  fill: #955368;
  stroke: #f1d8bd;
  stroke-width: 1.2;
}
.stats dd {
  border-left: 3px solid #b77078;
  padding-left: 7px;
}
.figure svg text {
  font-size: 12px;
}
.bench {
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.8fr);
}
.stage {
  border-radius: 0 14px 0 0;
}
.stage details {
  border-top: 1px dashed #b58b92;
}
.stage #details {
  columns: 2;
  max-height: 12rem;
  column-gap: 1.4rem;
  font-size: 0.82rem;
}
.stage #details li {
  break-inside: avoid;
  padding: 2px 4px;
}
@media (max-width: 510px) {
  .stage #details {
    columns: 1;
  }
}
