@font-face { font-family: "Alfa Slab One"; src: url("fonts/alfa-slab-one.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --bg: #ffffff;
  --pen: #eceeed;          /* galvanized gate grey behind the planner */
  --surface: #ffffff;
  --ink: #1d1a17;
  --muted: #55504a;
  --line: #d6d9d8;
  --line-strong: #80878a;  /* input borders, 3:1 on white */
  --red: #9b2c1c;          /* barn red: buttons, chart line */
  --red-ink: #ffffff;
  --red-soft: #f7e6e2;
  --tag: #f2c230;          /* ear-tag yellow */
  --tag-soft: rgba(242, 194, 48, .38);
  --good: #1e6b3a;
  --warn: #8a5a00;
  --bad: #b3261e;
  --head: "Alfa Slab One", Rockwell, "Roboto Slab", Georgia, serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r: 6px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16120f; --pen: #211c18; --surface: #2a241f; --ink: #f1ece6; --muted: #bdb3a8; --line: #3e3630;
    --line-strong: #8a8076; --red: #ff9b85; --red-ink: #16120f; --red-soft: #3b231d; --tag: #f2c230;
    --tag-soft: rgba(242, 194, 48, .22); --good: #82d6a0; --warn: #f2c230; --bad: #ff9b85;
  }
}

* { 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); }
a { color: var(--red); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 18px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 9; }
:focus-visible { outline: 3px solid var(--tag); outline-offset: 2px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* header */
.top { border-bottom: 4px solid var(--tag); }
.top-in { display: flex; align-items: center; height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 22px/1 var(--head); }

.hero { padding-top: 22px; padding-bottom: 14px; }
h1 { font: 400 clamp(1.75rem, 4.6vw, 2.6rem)/1.12 var(--head); margin: 0 0 10px; max-width: 22ch; letter-spacing: .005em; }
.lede { margin: 0; color: var(--muted); max-width: 62ch; font-size: 1.06rem; }
h2 { font: 400 1.55rem/1.2 var(--head); margin: 2.2rem 0 .7rem; }
.h-small { font: 700 1.05rem/1.3 var(--body); margin: 0 0 .5rem; }

/* planner */
.tool { background: var(--pen); padding: 16px 0 26px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.animals { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tab { min-height: 44px; padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: 22px; background: var(--surface); color: var(--ink); font: 600 1rem var(--body); cursor: pointer; max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab .sp { font-weight: 400; color: var(--muted); }
.tab[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tab[aria-pressed="true"] .sp { color: inherit; opacity: .8; }
.example-note { margin: 0 0 12px; padding: 8px 12px; background: var(--tag-soft); border-radius: var(--r); font-size: .97rem; }

.grid { display: grid; gap: 18px; }
@media (min-width: 900px) { .grid { grid-template-columns: minmax(300px, 360px) 1fr; align-items: start; } }

.setup summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-height: 44px; padding: 6px 0; cursor: pointer; list-style: none; }
.setup summary::-webkit-details-marker { display: none; }
.setup summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(-45deg); margin-right: 2px; align-self: center; }
.setup[open] summary::before { transform: rotate(45deg); }
.s-title { font: 700 1.05rem/1.3 var(--body); }
.s-sum { color: var(--muted); font-size: .95rem; }
.setup[open] .s-sum { display: none; }
.setup-body { padding-top: 4px; }
.f { display: block; font-weight: 600; font-size: .95rem; margin-bottom: 12px; }
.row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
input, select { display: block; width: 100%; margin-top: 4px; min-height: 46px; padding: 8px 10px; font: 400 16px var(--body); color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r); }
input.bad { border-color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad); }
.win-row { display: flex; align-items: center; gap: 8px; }
.win-row input { width: 7.5rem; }
.win-row span { font-weight: 400; color: var(--muted); }
.hint { margin: 4px 0 0; font-weight: 400; color: var(--muted); font-size: .92rem; }
.add { margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.add-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; }
.add-row .f { margin-bottom: 0; }
.err { color: var(--bad); margin: 6px 0 0; font-weight: 600; min-height: 0; }
.err:empty { display: none; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 8px 16px; border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: 600 1rem var(--body); cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--red); color: var(--red-ink); border-color: var(--red); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); border-color: transparent; }
.linkish { background: none; border: 0; padding: 0; color: var(--red); text-decoration: underline; font: inherit; font-weight: 600; cursor: pointer; min-height: 32px; }

/* result: the one card */
.result { background: var(--surface); border-radius: var(--r); border-top: 6px solid var(--tag); padding: 16px 18px; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.verdict { display: flex; gap: 12px; align-items: flex-start; }
.verdict svg { flex: none; width: 34px; height: 34px; border-radius: 50%; padding: 5px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; margin-top: 2px; }
.verdict.good svg { background: var(--good); }
.verdict.warn svg { background: var(--warn); }
.verdict.bad svg { background: var(--bad); }
.verdict.info svg { background: var(--muted); }
@media (prefers-color-scheme: dark) { .verdict svg { stroke: #16120f; } }
.verdict .head { font: 400 1.6rem/1.15 var(--head); margin: 0 0 4px; }
.verdict.good .head { color: var(--good); }
.verdict.warn .head { color: var(--warn); }
.verdict.bad .head { color: var(--bad); }
.vtext { margin: 0; font-size: 1.08rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 18px; margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.stats dt { font-size: .9rem; color: var(--muted); }
.stats dd { margin: 0; font-weight: 700; font-size: 1.12rem; font-variant-numeric: tabular-nums; }
.stats small { display: block; font-weight: 400; font-size: .9rem; color: var(--muted); }
.tips { margin: 12px 0 0; padding-left: 1.1rem; }
.tips li { margin: 3px 0; }
.when { margin: 12px 0 0; color: var(--muted); font-size: .95rem; }

/* chart */
.chart { margin: 14px 0 0; }
#chart { width: 100%; min-height: 220px; }
.wchart { display: block; max-width: 100%; height: auto; font-family: var(--body); }
.wchart .grid { stroke: var(--line); stroke-width: 1; }
.wchart .axis, .wchart .tick { stroke: var(--line-strong); stroke-width: 1; }
.wchart .ax { fill: var(--muted); font-size: 12px; }
.wchart .band { fill: var(--tag-soft); }
.wchart .band-t { fill: var(--ink); font-size: 12px; font-weight: 600; }
.wchart .fair { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 2 4; }
.wchart .fair-t { fill: var(--ink); font-size: 12px; font-weight: 700; }
.wchart .line { fill: none; stroke: var(--red); stroke-width: 2.5; stroke-linejoin: round; }
.wchart .pt { fill: var(--red); stroke: var(--surface); stroke-width: 2; }
.wchart .proj { stroke: var(--red); stroke-width: 2; stroke-dasharray: 6 5; }
.wchart .fan { fill: var(--red); opacity: .12; }
.wchart .proj-pt { fill: var(--surface); stroke: var(--red); stroke-width: 2; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .92rem; color: var(--muted); margin-top: 4px; }
.legend i { display: inline-block; width: 22px; height: 10px; margin-right: 6px; vertical-align: middle; }
.k-line { border-top: 3px solid var(--red); height: 0 !important; }
.k-proj { border-top: 2px dashed var(--red); height: 0 !important; }
.k-band { background: var(--tag-soft); border: 1px solid var(--tag); }

/* log */
.log { margin-top: 22px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); }
thead th { white-space: nowrap; font-size: .9rem; color: var(--muted); font-weight: 600; border-bottom: 2px solid var(--line-strong); }
.n { text-align: right; }
.logt { background: var(--surface); max-width: 720px; }
.logt .x { width: 44px; padding: 0; text-align: center; }
.del { width: 44px; height: 44px; border: 0; background: none; color: var(--muted); font-size: 1.4rem; cursor: pointer; border-radius: var(--r); }
.del:hover { color: var(--bad); background: var(--red-soft); }
.yr { color: var(--muted); }
.empty { color: var(--muted); margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.share-out { margin: 10px 0 0; font-size: .95rem; }
.share-out:empty { display: none; }
.share-url { margin-top: 6px; font-size: 15px; }
.saved { margin: 12px 0 0; font-size: .95rem; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: var(--r); display: flex; gap: 14px; align-items: center; z-index: 5; max-width: calc(100% - 24px); }
.toast[hidden] { display: none; }
.toast .linkish { color: var(--tag); }

/* content */
.content { padding-bottom: 30px; }
.content p, .faq p { max-width: 68ch; }
.ref { max-width: 760px; }
.ref th[scope="row"] { font-weight: 600; }
.faq h3 { font-size: 1.07rem; margin: 1.3rem 0 .25rem; }
.faq p { margin: 0; }
.sources { margin-top: 2.2rem; font-size: .93rem; color: var(--muted); }
.foot { border-top: 1px solid var(--line); padding: 18px 0 28px; font-size: .93rem; color: var(--muted); }
.foot a { color: var(--ink); }
.sb-footer p { margin: 6px 0; }

/* 404 */
.nf { padding: 40px 0 60px; }

@media (max-width: 480px) {
  body { font-size: 16.5px; }
  .wrap { padding: 0 14px; }
  .add-row { grid-template-columns: 1fr 1fr; }
  .add-row .btn { grid-column: 1 / -1; }
  .verdict .head { font-size: 1.4rem; }
  th, td { padding: 7px 5px; }
  .yr, .u { display: none; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats .wide { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* print: only the record sheet */
.print-sheet { display: none; }
@page { margin: 13mm 14mm; }
@media print {
  :root { --ink: #000; --muted: #333; --line: #bbb; --line-strong: #555; --red: #9b2c1c; --surface: #fff; --tag-soft: rgba(242, 194, 48, .35); }
  body { background: #fff; color: #000; font-size: 10.5pt; }
  body > *:not(main), main > *:not(#print-sheet) { display: none !important; }
  .print-sheet { display: block; }
  .ps-head { border-bottom: 3pt solid #f2c230; padding-bottom: 6pt; margin-bottom: 8pt; }
  .ps-head h2 { font: 400 19pt/1.15 var(--head); margin: 0 0 3pt; }
  .ps-head p { margin: 0; font-size: 10pt; }
  .ps-verdict { margin: 0 0 8pt; font-size: 11pt; }
  .ps-stats { display: flex; flex-wrap: wrap; gap: 0; margin: 0 0 10pt; border: 1px solid #999; }
  .ps-stats div { flex: 1 1 auto; padding: 5pt 7pt; border-left: 1px solid #999; }
  .ps-stats div:first-child { border-left: 0; }
  .ps-stats dt { font-size: 8.5pt; color: #333; }
  .ps-stats dd { margin: 0; font-weight: 700; font-size: 11pt; white-space: nowrap; }
  .ps-stats dd.sub { font-weight: 400; font-size: 8.5pt; color: #333; }
  .ps-chart { break-inside: avoid; }
  .ps-chart svg { width: 100%; height: auto; }
  .print-sheet h3 { font-size: 12pt; margin: 10pt 0 4pt; break-after: avoid; }
  .logt { max-width: none; }
  .logt th, .logt td { padding: 3.5pt 6pt; border-bottom: 1px solid #aaa; font-size: 10pt; }
  .logt thead th { color: #000; border-bottom: 1.5pt solid #000; }
  .logt thead tr.cap th { font-size: 12pt; text-align: left; border-bottom: 0; padding: 10pt 0 4pt; }
  .logt tr { break-inside: avoid; }
  .logt tr.blank td { height: 19pt; }
  .ps-foot { font-size: 8.5pt; color: #333; margin-top: 6pt; }
}
