@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url(fonts/source-serif-4-latin-opsz-normal.woff2) format("woff2-variations"); }
@font-face { font-family: "Source Serif 4"; font-style: italic; font-weight: 200 900; font-display: swap;
  src: url(fonts/source-serif-4-latin-opsz-italic.woff2) format("woff2-variations"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/inter-latin-wght-normal.woff2) format("woff2-variations"); }
:root {
  --ink: #1f2430; --muted: #5f6673; --paper: #fbf9f4; --rule: #e6e0d3;
  --panel: #f3efe6; --panel-edge: #e2dbcb; --good: #26703f; --bad: #9b2c1c;
  --serif: "Source Serif 4", Charter, Georgia, serif; --sans: Inter, system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 19px/1.62 var(--serif);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
main { max-width: 760px; margin: 0 auto; padding: 56px 20px 96px; }
h1 { font: 650 2.6em/1.08 var(--serif); letter-spacing: -0.02em; margin: 0 0 0.35em; }
h2 { font: 650 1.4em/1.25 var(--serif); letter-spacing: -0.01em; margin: 2.2em 0 0.55em; }
.dek { font: 400 1.22em/1.5 var(--serif); color: #3d4452; margin: 0 0 1.1em; }
.byline { color: var(--muted); font: 400 15px/1.55 var(--sans); margin: 0 0 2em; padding-bottom: 1.4em; border-bottom: 1px solid var(--rule); }
a { color: #1e5b9c; text-decoration-thickness: 1px; text-underline-offset: 2px; }
p { margin: 0 0 1.05em; }
:focus-visible { outline: 3px solid #4a90d9; outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.widget { background: var(--panel); border: 1px solid var(--panel-edge); border-radius: 14px; padding: 18px 20px;
  margin: 1.6em -20px 2em; font: 400 15px/1.5 var(--sans); }
.widget h3 { font: 650 13px/1.3 var(--sans); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 1.6em 0 .7em; }
.unitrow { display: flex; justify-content: space-between; align-items: center; }
.unitrow h3 { margin-top: 0; }
.unit { display: flex; gap: 8px; align-items: center; font-weight: 550; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 14px; align-items: end; }
.grid3 label { display: flex; flex-direction: column; gap: 4px; font-weight: 550; }
.hint { font-weight: 400; color: var(--muted); font-size: 13px; line-height: 1.3; }
input[type=number], select { font: inherit; padding: 7px 9px; border: 1px solid #cfc5ae; border-radius: 8px; background: #fff; min-width: 0; width: 100%; }
.unit select { width: auto; }
input:invalid { border-color: var(--bad); }
.note { color: var(--muted); font-size: 14px; margin: .8em 0 0; }
.kinds { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.kinds label { display: flex; gap: 7px; align-items: center; cursor: pointer; }
.diagram { margin: 12px 0 10px; }
.diagram svg { width: 100%; max-width: 420px; height: auto; display: block; }
.actions { margin-top: 16px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
button { font: 600 15px/1 var(--sans); padding: 11px 18px; border-radius: 9px; border: 1px solid #cfc5ae; background: #fff; color: var(--ink); cursor: pointer; }
#go { background: var(--ink); color: #fff; border-color: var(--ink); }
button:disabled { opacity: .55; cursor: progress; }
#status { color: var(--muted); }
.linkish { border: 0; background: none; padding: 0; color: #1e5b9c; text-decoration: underline; font: inherit; cursor: pointer; }

.verdict { font: 600 1.15em/1.45 var(--sans); }
.verdict.good { color: var(--good); }
.verdict.bad { color: var(--bad); }
.verdict .sub { display: block; font-weight: 400; color: var(--ink); font-size: .82em; margin-top: .35em; }
.stage { background: #fff; border: 1px solid var(--panel-edge); border-radius: 12px; padding: 10px; margin: 0 -10px 1em; }
#view { width: 100%; height: 380px; display: block; touch-action: pan-y; }
.controls { display: flex; gap: 10px; align-items: center; font: 400 14px/1 var(--sans); flex-wrap: wrap; }
.controls button { padding: 8px 12px; font-size: 14px; }
#scrub { flex: 1 1 160px; }
.seg { display: inline-flex; }
.seg button { border-radius: 0; }
.seg button:first-child { border-radius: 8px 0 0 8px; }
.seg button:last-child { border-radius: 0 8px 8px 0; border-left: 0; }
.seg button[aria-pressed=true] { background: var(--ink); color: #fff; border-color: var(--ink); }
#steps { font: 400 16px/1.5 var(--sans); padding-left: 1.4em; }
#steps li { margin: .3em 0; }
.longest { font: 400 16px/1.5 var(--sans); background: var(--panel); border-radius: 10px; padding: 10px 14px; }
.small { font: 400 14px/1.5 var(--sans); color: var(--muted); }

@media (max-width: 560px) {
  main { padding-top: 32px; }
  h1 { font-size: 2.1em; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .grid3.items { grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
  #view { height: 300px; }
}
.tag { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); color: #fff; font: 600 12px/1 var(--sans); margin-right: 3px; vertical-align: 1px; }
.longest:empty { display: none; }
.check { display: flex; gap: 8px; align-items: center; margin: 14px 0 4px; font-weight: 550; cursor: pointer; }
#sofaFields { margin-top: 10px; }
#sofaFields .grid3.items { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 560px) { #sofaFields .grid3.items { grid-template-columns: 1fr 1fr; } }
