:root { color-scheme: light; font-family: Georgia, serif; background: #faf9f5; color: #23231f; }
* { box-sizing: border-box; }
body { margin: 0; }
main { width: min(940px, 100%); margin: 0 auto; padding: clamp(1rem, 4vw, 3rem); }
a { color: #71432f; text-underline-offset: .18em; }
.back, legend, .slide label, .result, .marks, summary { font-family: system-ui, sans-serif; }
.back { font-size: .84rem; }
h1 { margin: 1.3rem 0 .55rem; font-size: clamp(2.1rem, 5vw, 3.8rem); font-weight: normal; line-height: 1.04; letter-spacing: -.044em; }
p { max-width: 64ch; font-size: 1.05rem; line-height: 1.48; }
.intro { margin: .6rem 0 1.5rem; }
figure { margin: 0 0 1.65rem; border-block: 1px solid #a39b8b; }
.stage { position: relative; width: 100%; background: #f3eee2; }
.fallback svg, canvas { width: 100%; height: auto; display: block; }
.stage canvas, .marks, .controls { display: none; }
main[data-ready] .stage { height: clamp(265px, 42vw, 400px); }
main[data-ready] .fallback { display: none; }
main[data-ready] canvas { display: block; width: 100%; height: 100%; }
main[data-ready] .marks { display: block; position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.marks span { position: absolute; white-space: nowrap; transform: translate(-50%, -100%); color: #37372e; background: #f3eee2e8; padding: .1em .25em; font-size: clamp(.72rem, 2vw, .9rem); }
.marks svg { position: absolute; inset: 0; }
main[data-ready] .controls { display: flex; flex-wrap: wrap; align-items: end; gap: .9rem 1.5rem; padding: .9rem 0; border-top: 1px solid #b7b09f; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend, .slide label, .result { padding: 0; margin: 0; color: #555246; font-size: .8rem; }
.switch { display: flex; margin-top: .3rem; }
.switch label { position: relative; cursor: pointer; }
.switch input { position: absolute; clip-path: inset(50%); height: 1px; width: 1px; }
.switch span { display: grid; place-items: center; min-height: 44px; padding: .3rem .8rem; border: 1px solid #a69f8e; color: #363730; font: .86rem system-ui, sans-serif; }
.switch label + label span { border-left: 0; }
.switch input:checked + span { background: #393a34; color: #fff; }
.switch input:focus-visible + span { outline: 2px solid #9e4e30; outline-offset: 2px; }
.slide { flex: 1 1 9rem; }
.slide label { display: flex; justify-content: space-between; gap: .5rem; }
.slide input { display: block; width: 100%; height: 44px; margin: .3rem 0 0; accent-color: #984d32; cursor: pointer; }
output { font-variant-numeric: tabular-nums; }
.result { padding-bottom: .2rem; min-width: 5.3rem; }
.result output { display: block; color: #2c302b; font: 1.75rem/1.35 Georgia, serif; }
figcaption { padding: .65rem 0; border-top: 1px solid #c5beb0; font-size: .9rem; color: #555246; }
details { font-size: .9rem; }
summary { cursor: pointer; text-decoration: underline; text-underline-offset: .18em; }
@media (max-width: 540px) {
  main { padding: 1rem; }
  main[data-ready] .controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .45rem 1rem; }
  .controls fieldset { grid-column: 1; grid-row: 1; }
  .result { grid-column: 2; grid-row: 1; }
  .slide { grid-column: 1 / -1; }
}
@media print {
  main[data-ready] .fallback { display: block; }
  main[data-ready] .stage { height: auto; }
  main[data-ready] .stage canvas, main[data-ready] .controls, main[data-ready] .marks { display: none; }
}
