:root {
  color-scheme: dark;
  --ink: #202626;
  --panel: #2c3433;
  --paper: #f2eedf;
  --muted: #b5c3bd;
  --cyan: #77dec9;
  --amber: #edbc76;
  --line: #4b5853;
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  font-synthesis: none;
  background: var(--ink);
  color: var(--paper);
  line-height: 1.55;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--cyan); text-underline-offset: 4px; }
a:hover { color: var(--paper); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--amber); outline-offset: 4px; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: not-allowed; }
.skip { position: fixed; left: 12px; top: -100px; z-index: 10; padding: 10px 16px; background: var(--paper); color: var(--ink); }
.skip:focus { top: 12px; }
.site-header, main, footer { width: min(1180px, calc(100% - 64px)); margin-inline: auto; }
.site-header { display: flex; align-items: center; justify-content: space-between; padding-block: 24px; border-bottom: 1px solid var(--line); font-size: .88rem; }
.site-header a { text-decoration: none; }
.brand { color: var(--paper); font-weight: 600; display: flex; gap: 9px; align-items: center; }
.brand-mark { color: var(--ink); background: var(--cyan); width: 23px; height: 23px; display: inline-grid; place-items: center; font-size: 1.2rem; line-height: 1; }
.intro { display: flex; justify-content: space-between; gap: 36px; align-items: end; padding-block: 44px 32px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2.8rem, 5.5vw, 4.4rem); line-height: 1.02; letter-spacing: -.065em; font-weight: 600; }
h1 span { color: var(--cyan); }
.lead { color: var(--muted); font-size: 1.12rem; margin-top: 12px; }
.intro-note { max-width: 37ch; font-size: .96rem; color: var(--muted); }
.intro-note em { font-style: normal; color: var(--paper); }
.workbench { display: grid; grid-template-columns: 300px minmax(0, 1fr); border: 1px solid var(--line); }
.controls { background: var(--panel); padding: 26px 24px; border-right: 1px solid var(--line); }
.section-heading, .drawing-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h2 { font-size: 1.13rem; font-weight: 600; letter-spacing: -.025em; }
.section-heading { margin-bottom: 27px; }
.unit-tag { color: var(--cyan); font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: .8rem; border: 1px solid var(--line); padding: 1px 7px; }
.field { margin-bottom: 22px; min-width: 0; }
.field label { display: block; font-size: .87rem; font-weight: 600; margin-bottom: 7px; }
.input-unit { position: relative; }
.input-unit > span { position: absolute; right: 12px; top: 12px; color: var(--muted); font-size: .88rem; pointer-events: none; }
input { width: 100%; min-width: 0; min-height: 46px; padding: 8px 38px 8px 12px; background: var(--ink); border: 1px solid #6c7b73; border-radius: 3px; color: var(--paper); font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 1rem; }
input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[aria-invalid="true"] { border-color: var(--amber); }
.hint { color: var(--muted); font-size: .75rem; margin-top: 6px; line-height: 1.45; }
.field-error { color: var(--amber); font-size: .78rem; margin-top: 5px; }
.field-error:empty { display: none; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-pair input { padding-right: 32px; }
.download { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px; min-height: 50px; padding: 12px 15px; color: var(--ink); background: var(--cyan); border: 1px solid var(--cyan); border-radius: 3px; font-weight: 700; font-size: .92rem; transition: background .12s ease; }
.download:not(:disabled):hover { background: var(--paper); border-color: var(--paper); }
.download > span:last-child { font-size: 1.35rem; line-height: 1; }
.download-status { color: var(--muted); margin-top: 12px; min-height: 2.8em; font-size: .78rem; }
.local-note { color: var(--muted); font-size: .69rem; margin-top: 6px; }
.result-area { min-width: 0; padding: 24px 28px; }
.drawing-heading { margin-bottom: 16px; }
.drawing-heading > span { font-size: .74rem; color: var(--muted); }
.drawing { margin: 0; background: var(--paper); color: var(--ink); border-radius: 2px; }
.drawing svg { width: 100%; height: clamp(250px, 30vw, 350px); display: block; padding: 16px 22px 0; }
.drawing figcaption { color: #45514c; padding: 10px 18px 14px; font-size: .73rem; }
.drawing .coupon { fill: #d8e2da; stroke: var(--ink); stroke-width: .25; }
.drawing .hole { fill: var(--paper); stroke: var(--ink); stroke-width: .22; }
.drawing .dot { fill: #527e71; }
.drawing .identifier { fill: #52615b; text-anchor: middle; dominant-baseline: central; font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; }
.drawing .dimension { stroke: #527e71; stroke-width: .2; fill: none; }
.drawing .dimension-label { fill: #3e5e54; font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; text-anchor: middle; }
.plate-summary { display: grid; grid-template-columns: 1.15fr 1fr 1.1fr; gap: 16px; padding-block: 16px 21px; border-bottom: 1px solid var(--line); }
.plate-summary span { display: block; font-size: .7rem; color: var(--muted); margin-bottom: 4px; }
.plate-summary strong { display: block; font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: .78rem; font-weight: 500; }
.plate-summary p:last-child strong { font-family: inherit; }
.table-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-top: 22px; margin-bottom: 12px; }
.table-heading h2 { font-size: 1rem; }
.table-heading p { font-size: .72rem; color: var(--muted); }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .79rem; font-variant-numeric: tabular-nums; }
th { color: var(--muted); font-size: .69rem; font-weight: 500; line-height: 1.35; text-align: right; padding: 7px 0 10px 12px; }
td { padding: 9px 0 9px 12px; text-align: right; border-top: 1px solid #3e4a44; font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; padding-left: 0; }
tbody th { font-size: .79rem; padding-block: 9px; border-top: 1px solid #3e4a44; color: var(--paper); }
.dot-key { display: inline-flex; gap: 3px; vertical-align: middle; margin-left: 8px; }
.dot-key i { width: 4px; height: 4px; border-radius: 50%; background: var(--cyan); }
.formula { font-size: .74rem; color: var(--cyan); padding-top: 15px; line-height: 1.6; }
.guide { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 28px; margin-top: 56px; }
.guide-title h2 { font-size: 1.9rem; line-height: 1.2; font-weight: 500; letter-spacing: -.045em; }
.guide-title p { color: var(--muted); max-width: 26ch; font-size: .88rem; margin-top: 16px; }
.steps { margin: 0; padding: 0; counter-reset: instruction; list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 25px 30px; }
.steps li { counter-increment: instruction; border-top: 1px solid var(--line); padding-top: 13px; }
.steps li::before { content: counter(instruction); color: var(--cyan); font-size: .78rem; font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; display: block; margin-bottom: 8px; }
h3 { font-size: .97rem; font-weight: 600; line-height: 1.4; }
.steps p, .method p, .sources p { color: var(--muted); font-size: .84rem; line-height: 1.65; max-width: 76ch; margin-top: 8px; }
.caution { border-left: 3px solid var(--amber); background: #302f28; display: flex; align-items: start; gap: 17px; padding: 20px 23px; margin-top: 42px; }
.caution > span { color: var(--amber); font-family: Georgia, serif; font-size: 1.6rem; line-height: 1.3; }
.caution p { color: var(--muted); font-size: .83rem; max-width: 76ch; }
.caution strong { color: var(--amber); font-weight: 600; }
.method { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; padding-block: 40px 30px; border-bottom: 1px solid var(--line); }
.method h3 { font-size: 1.13rem; }
.method .equation { color: var(--paper); font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: .78rem; margin-block: 13px; }
.sources { padding-block: 28px 44px; }
.sources h2 { font-size: .95rem; }
.sources p { max-width: 76ch; font-size: .79rem; }
footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); padding-block: 24px 32px; font-size: .72rem; color: var(--muted); }
footer p { max-width: 55ch; }
.notice { border: 1px solid var(--amber); padding: 15px; margin-top: 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (max-width: 900px) {
  .site-header, main, footer { width: min(100% - 40px, 760px); }
  .workbench { grid-template-columns: 260px minmax(0, 1fr); }
  .controls { padding: 23px 18px; }
  .result-area { padding: 23px 18px; }
  .plate-summary { grid-template-columns: 1fr 1fr; gap: 12px; }
  .plate-summary p:last-child { grid-column: 1 / -1; }
  .table-heading { display: block; }
  .table-heading p { margin-top: 3px; }
  .guide { grid-template-columns: 220px minmax(0, 1fr); }
  .steps { grid-template-columns: 1fr; }
  .dot-key { display: none; }
}
@media (max-width: 640px) {
  .site-header, main, footer { width: calc(100% - 32px); }
  .site-header { padding-block: 18px; }
  .intro { display: block; padding-block: 29px 25px; }
  h1 { font-size: 3.3rem; }
  .lead { font-size: 1rem; }
  .intro-note { margin-top: 19px; max-width: 45ch; font-size: .88rem; }
  .workbench { grid-template-columns: 1fr; }
  .controls { border-right: 0; border-bottom: 1px solid var(--line); padding: 23px 20px; }
  .section-heading { margin-bottom: 22px; }
  .field { margin-bottom: 18px; }
  .download-status { min-height: 0; }
  .result-area { padding: 23px 15px; }
  .drawing svg { height: 280px; padding: 10px 12px 0; }
  .plate-summary { grid-template-columns: 1fr 1fr; }
  .table-heading { display: flex; align-items: baseline; }
  .table-heading p { font-size: .68rem; }
  .dot-key { display: inline-flex; }
  .guide { grid-template-columns: 1fr; gap: 24px; margin-top: 38px; }
  .guide-title h2 br { display: none; }
  .guide-title h2 { font-size: 1.75rem; }
  .guide-title p { max-width: 43ch; margin-top: 10px; }
  .steps { gap: 24px; }
  .caution { padding: 16px; gap: 12px; margin-top: 32px; }
  .method { grid-template-columns: 1fr; gap: 25px; padding-top: 32px; }
  footer { align-items: start; flex-wrap: wrap; gap: 14px; }
  footer p { order: 3; width: 100%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }
@media print {
  :root { color-scheme: light; color: #111; background: #fff; }
  .site-header, .intro-note, .controls, .guide, .caution, .sources, footer, .skip { display: none; }
  main { width: 100%; }
  .intro { padding: 10px 0 20px; }
  .workbench { display: block; border: 0; }
  .result-area { padding: 0; }
  .drawing svg { height: 220px; }
  .drawing { break-inside: avoid; }
  .drawing-heading span, .plate-summary span, th, .table-heading p, .formula, .method p { color: #333; }
  .method { padding-block: 20px; }
  .method .equation { color: #111; }
  .plate-summary { grid-template-columns: 1fr 1fr 1fr; }
  .plate-summary p:last-child { grid-column: auto; }
  .dot-key i { background: #111; }
}
