:root {
  --bg: #f7f5f8;
  --surface: #ffffff;
  --ink: #221b22;
  --muted: #4a3f49;
  --line: #cbbfc8;
  --field: #8a7a87;
  --accent: #a32457;
  --accent-ink: #ffffff;
  --accent-soft: #f6e1ea;
  --err: #a1251a;
  --b1: #e8a7c0;
  --b2: #a9d3bd;
  --ctr: #f2d06b;
  --r: 4px;
  --head: Optima, Candara, "Segoe UI", "Gill Sans", "Trebuchet MS", sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17151b;
    --surface: #211d25;
    --ink: #eee7ee;
    --muted: #c9bcc8;
    --line: #4d4350;
    --field: #7d6f7c;
    --accent: #f08bb4;
    --accent-ink: #1b0f15;
    --accent-soft: #3a2230;
    --err: #ff9b8c;
    --b1: #a85a7a;
    --b2: #4f8a6f;
    --ctr: #b5963a;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.55 var(--body); }
a { color: var(--accent); text-underline-offset: 2px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--surface); color: var(--ink); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 700 19px/1.2 var(--head); color: var(--ink); text-decoration: none; }
.mark { width: 30px; height: 30px; flex: none; }
.m-bg { fill: var(--accent-soft); } .m-p { fill: var(--accent); } .m-q { fill: var(--b2); } .m-c { fill: var(--ctr); }
.nav { display: flex; gap: 4px; }
.nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; color: var(--ink); text-decoration: none; border-bottom: 3px solid transparent; }
.nav a[aria-current="page"] { border-bottom-color: var(--accent); font-weight: 600; }
.crumbs { margin: 14px 0 0; font-size: 16px; color: var(--muted); }

.intro { padding: 22px 0 4px; max-width: 46rem; }
h1 { font: 700 clamp(28px, 5vw, 40px)/1.12 var(--head); margin: 0 0 8px; }
.lede { margin: 0; color: var(--muted); font-size: 18px; }
h2 { font: 700 23px/1.25 var(--head); margin: 0 0 12px; }
h3 { font: 700 18px/1.3 var(--head); margin: 22px 0 6px; }

.tool { display: grid; gap: 20px; margin: 18px 0 10px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) {
  .tool { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); grid-template-areas: "in res" "opts res"; grid-template-rows: auto 1fr; align-items: start; }
  .inputs { grid-area: in; }
  .opts { grid-area: opts; }
  .result { grid-area: res; position: sticky; top: 16px; }
}
.panel { min-width: 0; }
.result { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; min-height: 260px; }

.field { display: flex; flex-direction: column; gap: 4px; margin: 0 0 14px; min-width: 0; }
.field > label { font-weight: 600; }
fieldset { border: 0; margin: 0 0 14px; padding: 0; min-width: 0; }
legend { font-weight: 600; padding: 0; margin-bottom: 4px; }
input[type=text], select { font: inherit; font-size: 17px; min-height: 44px; padding: 8px 10px; border: 1.5px solid var(--field); border-radius: var(--r); background: var(--surface); color: var(--ink); width: 100%; }
input[aria-invalid="true"] { border-color: var(--err); }
.suffix { display: flex; align-items: stretch; }
.suffix input { border-radius: var(--r) 0 0 var(--r); }
.suffix b { display: inline-flex; align-items: center; padding: 0 10px; border: 1.5px solid var(--field); border-left: 0; border-radius: 0 var(--r) var(--r) 0; font-weight: 600; background: var(--accent-soft); color: var(--ink); min-width: 42px; justify-content: center; }
.pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 14px; }
.count-row { display: flex; align-items: center; gap: 12px; }
.count-row input { width: 6.5em; flex: none; }
.angle { color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { font: inherit; font-size: 16px; min-width: 48px; min-height: 44px; padding: 0 10px; border: 1.5px solid var(--field); border-radius: 22px; background: var(--surface); color: var(--ink); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

.seg { display: flex; flex-wrap: wrap; }
.seg legend { width: 100%; }
.seg-opt { position: relative; }
.seg-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg-opt span { display: inline-flex; align-items: center; min-height: 44px; padding: 6px 14px; border: 1.5px solid var(--field); margin-left: -1.5px; background: var(--surface); color: var(--ink); font-size: 16px; white-space: nowrap; cursor: pointer; }
.seg-opt:first-of-type span { border-radius: var(--r) 0 0 var(--r); margin-left: 0; }
.seg-opt:last-of-type span { border-radius: 0 var(--r) var(--r) 0; }
.seg-opt input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); position: relative; z-index: 1; font-weight: 600; }
.seg-opt input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; z-index: 2; }
.more { margin: 4px 0 0; }
.more summary, .hand summary, #earlier summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; color: var(--accent); }
.more[open] summary { margin-bottom: 8px; }
.err { color: var(--err); margin: -6px 0 12px; font-weight: 600; }

.answer { margin: 0 0 10px; font: 400 21px/1.3 var(--head); }
.answer b { font-size: 26px; }
.pics { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: center; margin: 0 0 12px; }
.pic svg { display: block; width: 100%; height: auto; }
.pic.plate svg { max-width: 300px; margin: 0 auto; }
.pic.blade { color: var(--ink); max-height: 300px; display: flex; justify-content: center; }
.pic.blade svg { max-height: 300px; width: auto; max-width: 100%; }
.b1 { fill: var(--b1); stroke: var(--surface); stroke-width: 0.3; }
.b2 { fill: var(--b2); stroke: var(--surface); stroke-width: 0.3; }
.slit { stroke: var(--surface); stroke-width: 1.2; }
.ctr { fill: var(--ctr); }
.hole { fill: var(--surface); }
.facts { margin: 0; display: grid; gap: 6px; }
.facts div { display: grid; grid-template-columns: 6.5em minmax(0, 1fr); gap: 10px; }
.facts dt { font-weight: 600; color: var(--muted); }
.facts dd { margin: 0; }
.note { margin: 12px 0 0; padding: 8px 12px; background: var(--accent-soft); border-radius: var(--r); }
.res-wait { font-size: 18px; margin: 8px 0; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 16px 0 0; }
.btn { font: inherit; font-size: 17px; min-height: 44px; padding: 8px 18px; border: 1.5px solid var(--accent); border-radius: var(--r); background: var(--surface); color: var(--accent); font-weight: 600; cursor: pointer; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.small { min-height: 40px; padding: 4px 12px; font-size: 16px; }
.link-btn { font: inherit; background: none; border: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; padding: 10px 6px; min-height: 44px; }
.link-btn:disabled { color: var(--muted); cursor: not-allowed; }
.link-btn[aria-pressed="true"] { font-weight: 700; }
.quick { margin: 10px 0 0; }

.hand { margin: 8px 0 0; max-width: 46rem; }
.hand p { margin: 4px 0 10px; }
.hand-t { border-collapse: collapse; font-variant-numeric: tabular-nums; }
.hand-t th, .hand-t td { text-align: left; padding: 6px 16px 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.hand-t th { font-weight: 400; }
.hand-t td { font-weight: 600; overflow-wrap: break-word; }

.saved-sec { margin: 6px 0 0; }
.save-note { padding: 8px 12px; background: var(--accent-soft); border-radius: var(--r); }
#earlier-list { list-style: none; padding: 0; margin: 0 0 10px; }
#earlier-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.reset-row { margin: 0; }
.reset-row .link-btn { padding-left: 0; }

.content { max-width: 46rem; margin: 26px 0 40px; }
.content section { margin: 0 0 30px; }
.content p { margin: 0 0 12px; }
.steps { padding-left: 1.4em; margin: 0; }
.steps li { margin: 0 0 8px; }
.faq h3 { margin-top: 18px; }
.sources { color: var(--muted); }

.foot { border-top: 1px solid var(--line); padding: 22px 0 30px; background: var(--surface); }
.sb-footer { font-size: 16px; color: var(--muted); }
.sb-more { margin: 0 0 10px; line-height: 1.7; }
.sb-privacy, .sb-credit { margin: 0 0 6px; }
.sb-footer a { color: var(--ink); }


#print-root { display: none; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

@page { margin: 10mm; }
@media print {
  body { background: #fff; color: #000; font: 11pt/1.4 Arial, Helvetica, sans-serif; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block; color: #000; }
  #print-root svg.sheet { display: block; break-after: page; page-break-after: always; overflow: hidden; }
  #print-root svg.sheet.short { break-after: auto; page-break-after: auto; margin-bottom: 2mm; }
  .pnotes { break-inside: avoid; }
  .pnotes { font-size: 10.5pt; }
  .pnotes h2 { font: 700 13pt/1.25 Arial, sans-serif; margin: 0 0 3mm; }
  .pnotes ol { margin: 0 0 3mm; padding-left: 6mm; }
  .pnotes li { margin: 0 0 1.8mm; }
  .pnotes p { margin: 0; }
  .pnotes .pnum { margin: 0 0 3mm; font-size: 10pt; }
  .pnotes.mid { break-after: page; page-break-after: always; }
  .print-msg { font: 13pt Arial, sans-serif; }
}
#mine-bar { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 20; margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; width: max-content; max-width: calc(100% - 32px); box-shadow: 0 4px 16px rgba(0, 0, 0, .25); }
@media print { #mine-bar { display: none !important; } }
