
/* Layout: working form on the left, a sticky score sheet on the right that reads like an official tally; one column on phones with a score bar pinned to the bottom. */
:root {
  --paper: #f3f6f5;
  --sheet: #ffffff;
  --ink: #14211d;
  --muted: #56655f;
  --line: #d5dedb;
  --spruce: #1d5c4c;
  --spruce-soft: #e1eeea;
  --maple: #b8352b;
  --good: #1f7a4d;
  --font-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-num: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --r: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e1513; --sheet: #151f1c; --ink: #e4ece9; --muted: #9aaba5; --line: #2a3733;
    --spruce: #74c4ab; --spruce-soft: #1b2e28; --maple: #f0786d; --good: #6fcf9b; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0e1513; --sheet: #151f1c; --ink: #e4ece9; --muted: #9aaba5; --line: #2a3733;
  --spruce: #74c4ab; --spruce-soft: #1b2e28; --maple: #f0786d; --good: #6fcf9b; color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  background: var(--paper); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.55;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0 96px;
}
.wrap { max-width: 1120px; margin: 0 auto; }
.page-head { padding-block: 32px 20px; display: grid; gap: 10px; }
.eyebrow { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(30px, 5vw, 44px); line-height: 1.08; margin: 0; text-wrap: balance; letter-spacing: -.01em; }
.lede { margin: 0; max-width: 62ch; color: var(--muted); }
.notice { margin-bottom: 20px; display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); background: var(--sheet); border-radius: var(--r); padding: 12px 14px; font-size: 14px; max-width: 75ch; }
.notice b { color: var(--maple); }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: minmax(0, 1fr); } }

form { display: grid; gap: 18px; min-width: 0; }
fieldset { border: 1px solid var(--line); background: var(--sheet); border-radius: var(--r); padding: 18px 18px 20px; margin: 0; display: grid; gap: 16px; min-width: 0; }
legend { font-family: var(--font-display); font-weight: 600; font-size: 19px; padding: 0 6px; margin-left: -6px; }
.q { display: grid; gap: 6px; }
.q > label, .q > .label { font-weight: 600; font-size: 14px; }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
select, input[type="number"] {
  font: inherit; font-size: 15px; color: var(--ink); background: var(--paper); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 10px; width: 100%; max-width: 100%;
}
select:focus-visible, input:focus-visible, button:focus-visible { outline: 2px solid var(--spruce); outline-offset: 2px; }
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 520px) { .row2 { grid-template-columns: minmax(0, 1fr); } }
.scores { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 560px) { .scores { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.score { display: grid; gap: 4px; }
.score label { font-size: 13px; color: var(--muted); font-weight: 500; }
.chip { font-family: var(--font-num); font-size: 12px; color: var(--spruce); background: var(--spruce-soft); border-radius: 999px; padding: 2px 8px; justify-self: start; font-variant-numeric: tabular-nums; }
.checks { display: grid; gap: 10px; }
.check { display: grid; grid-template-columns: 20px 1fr; gap: 10px; align-items: start; font-size: 14px; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--spruce); }
.check small { display: block; color: var(--muted); font-size: 13px; }
.sub { border-left: 2px solid var(--spruce-soft); padding-left: 14px; display: grid; gap: 14px; }

/* score sheet */
aside { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 16px); display: grid; gap: 16px; min-width: 0; }
@media (max-width: 900px) { aside { position: static; } }
.sheet { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; display: grid; gap: 18px; }
.total { display: grid; gap: 2px; }
.total .num { font-family: var(--font-num); font-weight: 600; font-size: 64px; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.total .num small { font-size: 18px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.total .cap { font-size: 13px; color: var(--muted); }
.example-tag { font-size: 12px; font-weight: 600; color: var(--maple); }
.parts { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.part { display: grid; gap: 5px; }
.part-head { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.part-head span:last-child { font-family: var(--font-num); font-variant-numeric: tabular-nums; white-space: nowrap; }
.part-head em { font-style: normal; color: var(--muted); }
.bar { height: 6px; background: var(--spruce-soft); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--spruce); border-radius: 3px; transition: width .25s ease; }
details { font-size: 14px; }
summary { cursor: pointer; font-weight: 600; color: var(--spruce); }
.detail { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin-top: 10px; font-variant-numeric: tabular-nums; }
.detail span:nth-child(even) { font-family: var(--font-num); text-align: right; }
.detail .h { grid-column: 1 / -1; font-weight: 600; margin-top: 8px; border-top: 1px solid var(--line); padding-top: 8px; }
.whatif h2 { font-family: var(--font-display); font-size: 17px; margin: 0 0 8px; font-weight: 600; }
.whatif ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.whatif li { display: grid; grid-template-columns: auto 1fr; gap: 10px; font-size: 14px; align-items: baseline; }
.whatif b { font-family: var(--font-num); color: var(--good); font-variant-numeric: tabular-nums; min-width: 4.2ch; }
.warn { color: var(--maple); font-weight: 600; }
.label-row { margin: 0; font-size: 14px; }
#copyMsg { word-break: break-all; }
.swap-rows { display: grid; gap: 6px; font-size: 14px; }
.swap-rows div { display: flex; justify-content: space-between; gap: 12px; }
.swap-rows b { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.verdict { margin: 10px 0 0; font-size: 14px; font-weight: 600; color: var(--spruce); }
.tt-wrap { overflow-x: auto; }
.tt { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
.tt th, .tt td { padding: 6px 6px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; background: none; font-weight: 400; }
.tt th { color: var(--muted); font-weight: 600; }
.tt th:first-child, .tt td:first-child { text-align: left; }
.tt td:last-child { font-family: var(--font-num); font-weight: 600; }
.tt tr.reached td { color: var(--muted); }
.drows { display: grid; gap: 12px; }
.drow { display: grid; gap: 2px; font-size: 14px; }
.drow-head { display: flex; justify-content: space-between; gap: 10px; font-weight: 600; }
.drow-head span:last-child { font-family: var(--font-num); white-space: nowrap; font-variant-numeric: tabular-nums; }
.drow small { color: var(--muted); font-size: 13px; }
.drow.off .drow-head { color: var(--muted); font-weight: 500; }
.above { color: var(--good); }
.below { color: var(--maple); }
.btns { display: flex; gap: 10px; flex-wrap: wrap; }
button { font: inherit; font-size: 14px; font-weight: 600; border-radius: 8px; padding: 8px 14px; cursor: pointer; border: 1px solid var(--line); background: var(--sheet); color: var(--ink); }
button.primary { background: var(--spruce); border-color: var(--spruce); color: var(--sheet); }
.fine { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.fine a { color: var(--spruce); }
.bottom-bar { display: none; }
@media (max-width: 900px) {
  .bottom-bar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; justify-content: space-between; align-items: center;
    background: var(--sheet); border-top: 1px solid var(--line);
    padding: 10px max(16px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  }
  .bottom-bar .num { font-family: var(--font-num); font-weight: 600; font-size: 24px; font-variant-numeric: tabular-nums; }
  .bottom-bar a { color: var(--spruce); font-weight: 600; font-size: 14px; }
}
.calc-notes { margin-top: 36px; border-top: 1px solid var(--line); padding-top: 18px; display: grid; gap: 8px; max-width: 75ch; }
@media (prefers-reduced-motion: reduce) { .bar i { transition: none; } }

/* ---- site chrome and article pages (added to the calculator styles) ---- */
body { padding-block: 0; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--sheet); padding: 6px 10px; border-radius: 6px; z-index: 20; }
.site-head { border-bottom: 1px solid var(--line); background: var(--sheet); margin-inline: calc(-1 * max(16px, env(safe-area-inset-left, 0px))); padding-inline: max(16px, env(safe-area-inset-left, 0px)); }
.head-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding-block: 14px; }
.brand { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--ink); text-decoration: none; }
.site-head nav, .site-foot nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-head nav a, .site-foot nav a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; }
.site-head nav a:hover, .site-foot nav a:hover { color: var(--spruce); }
main.wrap { padding-bottom: 40px; }
.crumbs { font-size: 13px; color: var(--muted); padding-top: 20px; }
.crumbs a { color: var(--muted); }
.prose { max-width: 68ch; display: grid; gap: 14px; padding-top: 8px; }
.prose h1 { margin-top: 12px; }
.prose h2 { font-family: var(--font-display); font-size: 24px; line-height: 1.2; margin: 18px 0 0; text-wrap: balance; }
.prose h3 { font-size: 17px; margin: 8px 0 0; }
.prose p, .prose ul, .prose ol { margin: 0; }
.prose ul, .prose ol { padding-left: 22px; display: grid; gap: 6px; }
.prose a { color: var(--spruce); }
.content-below { margin-top: 48px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--sheet); }
table { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; background: var(--spruce-soft); }
td.n, th.n { text-align: right; font-family: var(--font-num); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.ok { color: var(--good); font-weight: 600; }
.faq details { border-top: 1px solid var(--line); padding-block: 12px; }
.faq summary { color: var(--ink); font-size: 16px; }
.faq details p { margin-top: 8px; }
.site-foot { border-top: 1px solid var(--line); margin-top: 24px; }
.foot-row { display: grid; gap: 10px; padding-block: 24px 96px; font-size: 13px; color: var(--muted); }
.foot-row p { margin: 0; max-width: 75ch; }
@media (min-width: 901px) { .foot-row { padding-bottom: 32px; } }
/* ---- draws page ---- */
:root { --s1: #14876b; --s2: #c96a12; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --s1: #2fa184; --s2: #c8741f; } }
:root[data-theme="dark"] { --s1: #2fa184; --s2: #c8741f; }
.latest-draw { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; display: grid; gap: 12px; }
.ld-grid { display: grid; grid-template-columns: repeat(4, minmax(0, auto)); gap: 12px 28px; }
@media (max-width: 700px) { .ld-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ld-grid > div { display: grid; gap: 2px; min-width: 0; }
.ld-k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.ld-v { font-size: 16px; font-weight: 600; }
.ld-v.num { font-family: var(--font-num); font-size: 26px; font-variant-numeric: tabular-nums; }
.ld-cta { justify-self: start; background: var(--spruce); color: var(--sheet) !important; text-decoration: none; font-weight: 600; font-size: 14px; padding: 9px 14px; border-radius: 8px; }
.chart { margin: 0; display: grid; gap: 8px; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.chart figcaption { font-weight: 600; font-size: 14px; }
.chart-scroll { overflow-x: auto; }
.chart svg { width: 100%; min-width: 520px; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 12px; font-family: var(--font-num); }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; }
.chart .line.s1 { stroke: var(--s1); } .chart .line.s2 { stroke: var(--s2); }
.chart .dot { stroke: var(--sheet); stroke-width: 2; }
.chart .dot.s1 { fill: var(--s1); } .chart .dot.s2 { fill: var(--s2); }
.chart .end-label { fill: var(--ink); font-size: 12px; font-weight: 600; font-family: var(--font-num); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.lg i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.lg i.s1 { background: var(--s1); } .lg i.s2 { background: var(--s2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn { font: inherit; font-size: 13px; font-weight: 500; border: 1px solid var(--line); background: var(--sheet); color: var(--ink); border-radius: 999px; padding: 5px 12px; cursor: pointer; }
.chip-btn[aria-pressed="true"] { background: var(--spruce); border-color: var(--spruce); color: var(--sheet); }
/* wide content (tables, chart, cards) may use the full column; running text stays ~68ch */
.prose { max-width: 1000px; }
.prose > :not(.table-wrap):not(.chart):not(.latest-draw):not(.chips):not(.faq) { max-width: 68ch; }
th.n { font-family: inherit; }
