:root {
  --bg: #f4f1e8;
  --surface: #fffdf7;
  --ink: #1f2328;
  --muted: #4b5157;
  --line: #d3ccb9;
  --line-strong: #8d8572;
  --accent: #b4232a;
  --accent-ink: #ffffff;
  --blue: #1f5fa8;
  --focus: #1f5fa8;
  --sheet: #fffdf7;
  --rule: #c9c1ab;
  --rule-mid: #8d8572;
  --rule-heavy: #2c2a25;
  --head: "Avenir Next Condensed", "Roboto Condensed", "Arial Narrow", "Helvetica Neue", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16191c;
    --surface: #1f2327;
    --ink: #ebe7dc;
    --muted: #b8b3a6;
    --line: #3a3f45;
    --line-strong: #6d7278;
    --accent: #ff8a7a;
    --accent-ink: #1a0d0b;
    --blue: #8cb8f0;
    --focus: #8cb8f0;
    --sheet: #1c2024;
    --rule: #353a40;
    --rule-mid: #6d7278;
    --rule-heavy: #d9d4c7;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.55 var(--body); }
.wrap { max-width: 1320px; margin: 0 auto; padding: 0 16px; }
a { color: var(--blue); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.top { border-bottom: 2px solid var(--ink); }
.brand { display: inline-flex; align-items: center; gap: 10px; padding: 12px 0; font: 700 20px/1 var(--head); font-stretch: condensed; color: var(--ink); text-decoration: none; text-transform: none; }
.mark { width: 30px; height: 30px; }
.m-sheet { fill: var(--surface); stroke: var(--ink); stroke-width: 1.6; }
.m-rule { stroke: var(--line-strong); stroke-width: 1.2; fill: none; }
.m-key { fill: none; stroke: var(--accent); stroke-width: 2; }

.intro { padding: 22px 16px 6px; }
h1 { font: 700 clamp(28px, 4.4vw, 42px)/1.12 var(--head); font-stretch: condensed; margin: 0 0 8px; max-width: 30ch; }
.lede { margin: 0; color: var(--muted); font-size: 18px; max-width: 62ch; }
h2 { font: 700 23px/1.2 var(--head); font-stretch: condensed; margin: 0 0 10px; }
h3 { font-size: 18px; margin: 22px 0 4px; }

.tool { display: grid; gap: 24px; padding: 14px 0 36px; }
@media (min-width: 1240px) {
  .tool { grid-template-columns: minmax(380px, 440px) 1fr; align-items: start; }
}
.inputs { display: grid; gap: 14px; min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 16px; min-width: 0; }
.panel.quiet { background: transparent; }
details.panel > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; min-height: 44px; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::before { content: "+"; font: 700 22px/1 var(--mono); width: 18px; color: var(--accent); }
details.panel[open] > summary::before { content: "\2212"; }
details.panel > summary h2 { margin: 0; }
.hint { margin: -4px 0 10px; color: var(--muted); }

label { display: grid; gap: 4px; font-weight: 600; font-size: 16px; }
input[type=text], select {
  font: 17px/1.3 var(--body); color: var(--ink); background: var(--bg); border: 1px solid var(--line-strong);
  border-radius: 4px; padding: 9px 10px; min-height: 44px; width: 100%; min-width: 0;
}
input[inputmode=numeric], .conv input, .len-boxes input { font-family: var(--mono); }
fieldset { border: 0; margin: 0 0 14px; padding: 0; min-width: 0; }
legend { font-weight: 600; font-size: 16px; padding: 0; margin-bottom: 4px; }
.seg { display: flex; flex-wrap: wrap; }
.seg legend { width: 100%; }
.seg label { display: block; flex: 1 1 0; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: 46px; border: 1px solid var(--line-strong); margin-left: -1px; font: 700 19px/1 var(--mono); cursor: pointer; background: var(--bg); }
.seg label:first-of-type span { border-radius: 4px 0 0 4px; margin-left: 0; }
.seg label:last-of-type span { border-radius: 0 4px 4px 0; }
.seg input:checked + span { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; position: relative; }
.seg span::after { content: " fps"; font: 400 14px/1 var(--body); margin-left: 4px; }

.len { display: grid; gap: 10px; }
.len-boxes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.len-boxes label { grid-template-columns: 1fr auto; align-items: center; gap: 8px; font-weight: 400; }
.err { color: var(--accent); margin: 8px 0 0; font-weight: 600; }
.err.info { color: var(--muted); font-weight: 400; }
.readout { margin-top: 12px; border-top: 2px solid var(--ink); padding-top: 10px; }
.readout .big { font: 700 26px/1.2 var(--head); font-stretch: condensed; margin: 0 0 6px; }
.readout .small { margin: 6px 0 0; color: var(--muted); }
.units { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 6px 14px; margin: 0; }
.units div, .conv-out div { display: flex; flex-direction: column; }
.units dt, .conv-out dt { color: var(--muted); font-size: 16px; }
.units dd, .conv-out dd { margin: 0; font: 600 19px/1.3 var(--mono); }
.actions { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 10px; }
.jump { display: inline-flex; align-items: center; text-decoration: none; }
@media (min-width: 1240px) { .jump { display: none; } }
.print-info { margin: 10px 0 0; color: var(--muted); }
.split-note { display: block; margin-top: 4px; color: var(--accent); font-weight: 600; }
.nw { white-space: nowrap; }

.btn { font: 600 16px/1.2 var(--body); color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 4px; padding: 10px 14px; min-height: 44px; cursor: pointer; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.small { padding: 6px 10px; min-height: 40px; }
.btn.danger { color: var(--accent); border-color: var(--accent); }
.btn:disabled { opacity: 0.45; cursor: default; }
.icon { font: 700 18px/1 var(--body); width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 4px; background: transparent; color: var(--ink); cursor: pointer; }
.icon:disabled { opacity: 0.35; cursor: default; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 12px; }
.rows { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.nt { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.nt label { flex: 1 1 96px; }
.nt .fr { flex: 0 1 72px; }
.nt .grow { flex: 1 1 100%; }
.nt-act .grow, .nt-cam .grow { flex: 1 1 200px; }
.row label { flex: 1 1 120px; min-width: 0; }
.row .grow { flex: 3 1 160px; }
.row .fr { flex: 0 1 92px; }
.row .stp { flex: 1 1 130px; }
.row-head { display: flex; gap: 8px; margin: 0 0 4px; font-weight: 600; font-size: 16px; }
.row-head .grow { flex: 2 1 90px; }
.row-head .stp { flex: 1 1 110px; }
#dial-head .grow { flex: 3 1 110px; margin-right: 52px; }
@media (min-width: 480px) { .row-head .stp { margin-right: 154px; } }
.row-head .fr { flex: 0 1 92px; }
.dl .grow { flex: 3 1 110px; }
.dl .fr { flex: 0 1 84px; }
#dial-head .fr { flex: 0 1 84px; }
.lv .grow { flex: 2 1 90px; }
.lv .stp { flex: 1 1 110px; }
.row-btns { display: flex; gap: 6px; }
.row-msg { flex-basis: 100%; margin: 0; color: var(--accent); font-weight: 600; }
.add-row { display: flex; flex-wrap: wrap; gap: 8px; }
.conv { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.conv-out { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px 14px; margin: 12px 0 0; }
.confirm { margin: 0 0 10px; }
.earlier { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.earlier li { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; }
.earlier summary, #earlier-box summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; }
#earlier-box { margin-top: 12px; }
.note, .demo-bar { margin: 6px 0 0; padding: 10px 14px; border: 1px solid var(--accent); border-radius: 4px; background: var(--surface); }

.out { min-width: 0; }
.out-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.out-head h2 { margin: 0; }
.pager { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.pager .btn { width: 44px; font-size: 20px; }
.sheet-box { overflow-x: auto; border: 1px solid var(--line-strong); background: var(--sheet); }

/* ---------- the sheet ---------- */
.xs { --row: 24px; min-width: 720px; padding: 10px 12px 14px; color: var(--ink); font-family: var(--body); }
.xs-head { display: grid; gap: 4px; margin-bottom: 6px; }
.xs-top { display: flex; justify-content: space-between; font: 700 18px/1.2 var(--head); font-stretch: condensed; }
.xs-fields { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.xf { display: flex; gap: 6px; align-items: baseline; flex: 1 1 140px; }
.xl { font-size: 15px; color: var(--muted); }
.xv { flex: 1; border-bottom: 1px solid var(--rule-mid); min-height: 1.3em; font-weight: 600; font-size: 16px; }
.xs-info { display: flex; flex-wrap: wrap; gap: 2px 18px; font-size: 15px; color: var(--muted); }
.blank-line { display: inline-block; width: 9em; border-bottom: 1px solid var(--rule-mid); }
.blank-line.short { width: 3em; }
.xs-cols { display: grid; border: 2px solid var(--rule-heavy); }
.col { min-width: 0; border-right: 1px solid var(--rule-mid); }
.col:last-child { border-right: 0; }
.col-dial, .col-fr, .col-cam { border-right: 2px solid var(--rule-heavy); }
.col-lv + .col-cam { border-left: 1px solid var(--rule-heavy); }
.col-act { border-right: 1px solid var(--rule-mid); }
.ch { height: 2.6em; padding: 2px 3px; font: 700 14px/1.15 var(--head); font-stretch: condensed; text-align: center; border-bottom: 2px solid var(--rule-heavy); overflow: hidden; overflow-wrap: normal; word-break: normal; hyphens: none; display: flex; align-items: center; justify-content: center; }
.ch span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.cells { position: relative; }
.r { height: var(--row); border-bottom: 1px solid var(--rule); }
.r.r-half { border-bottom: 1px solid var(--rule-mid); }
.r.r-foot { border-bottom: 2px solid var(--rule-mid); }
.r.r-sec { border-bottom: 2px solid var(--rule-heavy); }
.r.r-end { border-bottom: 3px double var(--accent); }
.r:last-child { border-bottom: 0; }
.o { position: absolute; left: 0; right: 0; height: var(--row); font-size: calc(var(--row) * 0.67); line-height: var(--row); overflow: hidden; }
.num { text-align: center; font-family: var(--mono); color: var(--muted); }
.dn { color: var(--ink); font-weight: 600; }
.word { padding: 0 3px; font-weight: 700; white-space: nowrap; text-overflow: ellipsis; }
.hold { left: 30%; right: auto; width: 0; border-left: 1.5px solid var(--ink); }
.col-lv .hold { left: 50%; }
.hold.stop { height: calc(var(--row) * 0.6); }
.ntxt { padding: 0 4px; white-space: normal; overflow-wrap: anywhere; color: var(--blue); display: -webkit-box; -webkit-box-orient: vertical; text-overflow: ellipsis; }
.ntxt i { font-style: normal; color: var(--muted); }
.ntxt.in-brk { padding-right: 18px; }
.brk { left: auto; right: 6px; width: 9px; border-right: 2px solid var(--blue); }
.brk.b-top { border-top: 2px solid var(--blue); }
.brk.b-end { border-bottom: 2px solid var(--blue); }
.mk { text-align: center; }
.key { display: inline-block; min-width: calc(var(--row) * 0.95); height: calc(var(--row) * 0.92); line-height: calc(var(--row) * 0.86); padding: 0 2px; border: 1.5px solid var(--accent); border-radius: 999px; color: var(--accent); font-weight: 700; font-size: calc(var(--row) * 0.56); }
.bd { color: var(--accent); font-weight: 700; }
.legend { font: 400 15px/1.2 var(--body); color: var(--muted); margin-left: auto; margin-right: 18px; align-self: center; }
.legend .key { --row: 1.4em; vertical-align: middle; }
.el { text-align: center; font-size: calc(var(--row) * 0.56); font-weight: 600; white-space: nowrap; }
.el.two { display: flex; flex-direction: column; justify-content: center; font-size: calc(var(--row) * 0.46); line-height: calc(var(--row) * 0.48); letter-spacing: -0.01em; }
.endnote { color: var(--accent); font-weight: 700; }
.endl { padding: 0 4px; color: var(--accent); font-weight: 700; }


#print-root { display: none; }

/* ---------- content ---------- */
.content { padding: 8px 16px 40px; max-width: 760px; margin-left: 0; }
@media (min-width: 1240px) { .content { margin-left: max(16px, calc((100vw - 1320px) / 2)); } }
.content section { margin-top: 30px; }
.content p { max-width: 70ch; }
.table-wrap { overflow-x: auto; }
.ref { border-collapse: collapse; width: 100%; max-width: 560px; }
.ref th, .ref td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.ref th { border-bottom: 2px solid var(--ink); }
.sources { color: var(--muted); margin-top: 28px; }

.foot { border-top: 2px solid var(--ink); margin-top: 20px; padding: 18px 0 30px; color: var(--muted); font-size: 16px; }
.sb-footer p { margin: 0 0 10px; }
.sb-more a { color: var(--blue); }

.toast { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); max-width: calc(100vw - 32px); background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 6px; display: flex; gap: 12px; align-items: center; z-index: 20; }
.toast .btn { background: var(--bg); color: var(--ink); }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* ---------- print: only the sheets ---------- */
@media print {
  :root { --sheet: #fff; --ink: #000; --muted: #333; --rule: #9a9a9a; --rule-mid: #555; --rule-heavy: #000; --accent: #b4232a; --blue: #1b3f75; }
  body { background: #fff; color: #000; font-size: 10pt; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block; }
  .xs { min-width: 0; width: 100%; height: var(--sh); padding: 0; break-after: page; page-break-after: always; display: flex; flex-direction: column; --row: var(--prow); overflow: hidden; }
  .xs:last-child { break-after: auto; page-break-after: auto; }
  .xs-head { gap: 1.5mm; margin-bottom: 2mm; height: 26mm; overflow: hidden; align-content: start; }
  .xs-top { font-size: 13pt; }
  .xl { font-size: 9pt; color: #333; }
  .xv { font-size: 10pt; }
  .xs-info { font-size: 9pt; color: #222; }
  .ch { height: 7mm; font-size: 8pt; line-height: 1.05; }
  .o { font-size: min(calc(var(--row) * 0.8), 10pt); }
  .ntxt { line-height: var(--row); }
  .el { font-size: min(calc(var(--row) * 0.7), 8.5pt); }
  .el.two { font-size: min(calc(var(--row) * 0.42), 7pt); line-height: calc(var(--row) * 0.47); }
  .key { font-size: min(calc(var(--row) * 0.66), 9pt); }
  .legend { font-size: 9pt; }
  .legend .key { --row: 4mm; }
  .xs-cols, .r, .key, .hold, .brk, .col { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
