:root {
  --bg: #f1f3ee;
  --panel: #fbfcf9;
  --ink: #1b221d;
  --muted: #485249;
  --line: #c6cdc3;
  --field: #7a857b;
  --berry: #8c2240;
  --berry-ink: #ffffff;
  --berry-soft: #f6e3e9;
  --moss: #2f5d34;
  --ok: #24572c;
  --err: #9b1c1c;
  --focus: #1f5fa8;
  --r: 8px;
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', 'URW Palladio L', Georgia, serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161a17;
    --panel: #1e2420;
    --ink: #e6ebe5;
    --muted: #b4beb4;
    --line: #3b463d;
    --field: #7f8c80;
    --berry: #f193ac;
    --berry-ink: #2a0b15;
    --berry-soft: #3a1d26;
    --moss: #9ccc9f;
    --ok: #9ccc9f;
    --err: #ff9d9d;
    --focus: #8cc0ff;
  }
}
* { 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(--sans); }
a { color: var(--berry); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--panel); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

.top { border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; min-height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 600 1.1rem/1.2 var(--serif); color: var(--ink); text-decoration: none; }
.brand-mark { width: 26px; height: 26px; color: var(--moss); }

.intro { padding: 22px 0 12px; max-width: 46rem; }
h1 { font: 700 clamp(1.75rem, 4.2vw, 2.6rem)/1.12 var(--serif); margin: 0 0 8px; letter-spacing: -0.01em; }
.lede { margin: 0; font-size: 1.08rem; color: var(--muted); }
h2 { font: 700 1.35rem/1.25 var(--serif); margin: 0 0 12px; }
h3 { font: 600 1.08rem/1.3 var(--sans); margin: 22px 0 6px; }

/* tool layout: phone order is entry, wheel, options, list; wide screens put the wheel on the right */
.tool { display: grid; gap: 20px; padding: 8px 0 32px; }
.pane { min-width: 0; }
@media (min-width: 980px) {
  .tool { grid-template-columns: minmax(340px, 400px) 1fr; grid-template-areas: "entry wheel" "opts wheel" "list wheel"; align-items: start; column-gap: 36px; }
  .pane-entry { grid-area: entry; }
  .pane-wheel { grid-area: wheel; position: sticky; top: 12px; }
  .pane-opts { grid-area: opts; }
  .pane-list { grid-area: list; }
}

.seg { display: flex; width: 100%; max-width: 26rem; border: 1.5px solid var(--field); border-radius: var(--r); overflow: hidden; margin-bottom: 16px; max-width: 100%; }
.seg label { position: relative; display: block; flex: 1 1 0; min-width: 0; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: flex; align-items: center; justify-content: center; text-align: center; height: 100%; min-height: 44px; padding: 4px 10px; font-weight: 600; line-height: 1.2; }
.seg label + label span { border-left: 1.5px solid var(--field); }
.seg input:checked + span { background: var(--moss); color: var(--bg); }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: -3px; }
.seg.small span { padding: 0 12px; font-weight: 500; }

.f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.f > span, .f legend { font-size: 1rem; font-weight: 600; color: var(--ink); }
input[type=text], input[type=date], input[type=number], select, textarea {
  font: inherit; font-size: 16px; color: var(--ink); background: var(--panel); border: 1.5px solid var(--field);
  border-radius: var(--r); padding: 9px 10px; min-height: 44px; width: 100%; min-width: 0;
}
textarea { min-height: 110px; resize: vertical; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 15px; }
input[aria-invalid=true] { border-color: var(--err); }
fieldset.f { border: 0; padding: 0; margin: 0; }

.add-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.add-grid .f-what { grid-column: 1 / -1; order: -1; }
.add-grid .f-btn { grid-column: 1 / -1; }
@media (min-width: 560px) and (max-width: 979px) {
  .add-grid { grid-template-columns: 11rem 1fr 9rem auto; }
  .add-grid .f-what { grid-column: auto; order: 0; }
  .add-grid .f-btn { grid-column: auto; }
}

.btn { font: inherit; font-weight: 600; min-height: 44px; padding: 8px 16px; border-radius: var(--r); border: 1.5px solid var(--field);
  background: var(--panel); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--berry); border-color: var(--berry); color: var(--berry-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--err); }
.link-btn { border: 0; background: none; color: var(--berry); text-decoration: underline; padding: 8px 4px; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-btn:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.msg { min-height: 1.5em; margin: 8px 0 0; }
.msg:empty { min-height: 0; margin: 0; }
.msg.ok { color: var(--ok); }
.msg.err { color: var(--err); font-weight: 600; }
.note { margin: 10px 0 0; color: var(--ink); }
.note:empty { display: none; }
.hint { margin: 6px 0 10px; color: var(--muted); }
.empty { color: var(--muted); margin: 0; }

.example-bar { background: var(--berry-soft); border-radius: var(--r); padding: 12px; margin-bottom: 16px; }
.example-bar p { margin: 0 0 10px; font-weight: 600; }
.import { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 10px; }
.import summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; color: var(--berry); }
.import .row { margin: 10px 0; }

.blank-set { display: grid; gap: 12px; }
.blank-set .f-n { max-width: 8rem; }
.blank-names { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* the wheel sits on a sheet of paper in both colour schemes */
.paper { margin: 0; background: #ffffff; color: #1d1d1d; border-radius: 3px; box-shadow: 0 1px 2px rgba(0,0,0,.12), 0 8px 24px rgba(30,40,30,.12); padding: clamp(8px, 2.5vw, 22px); }
@media (max-width: 979px) { .wheel { cursor: zoom-in; } }
.wheel svg { display: block; width: 100%; height: auto; aspect-ratio: 1; }
.legend { font-size: 16px; line-height: 1.4; padding-top: 10px; color: #1d1d1d; }
.legend:empty { display: none; }
.legend ul { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.legend li { display: inline-flex; align-items: center; gap: 6px; overflow-wrap: anywhere; }
.legend .lg-h { color: #3a3a3a; }
.mk { width: 15px; height: 15px; flex: none; }
.swatch { width: 15px; height: 15px; border: 1px solid #6b6b6b; flex: none; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
@media (min-width: 980px) { .paper { max-width: max(420px, calc(100vh - 120px)); } }

.pane-opts { border-top: 1px solid var(--line); padding-top: 16px; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.opts .f-title { grid-column: 1 / -1; }
.opts .seg-f { grid-column: 1 / -1; }
.opts .seg { margin: 0; }
.checks { display: grid; gap: 2px; margin-top: 12px; }
.checks label { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.checks input { width: 22px; height: 22px; accent-color: var(--moss); flex: none; }
body.mode-blank .obs-only { display: none !important; }

.pane-list { border-top: 1px solid var(--line); padding-top: 16px; }
.count { font: 500 1rem var(--sans); color: var(--muted); }
.list { display: grid; gap: 8px; }
.item { display: grid; grid-template-columns: 9.8rem 1fr 44px; grid-template-areas: "date cat del" "what what what"; gap: 6px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.item .f-date { grid-area: date; }
.item .f-what { grid-area: what; }
.item .f-cat { grid-area: cat; }
.item .del { grid-area: del; padding: 0; font-size: 1.4rem; line-height: 1; width: 44px; }
.list-tools { margin-top: 14px; }
.ask { margin-top: 12px; padding: 12px; border: 1.5px solid var(--err); border-radius: var(--r); }
.ask p { margin: 0 0 10px; font-weight: 600; }
.earlier { margin-top: 14px; }
.earlier p { margin: 0; font-weight: 600; }
.earlier ul { margin: 4px 0 0; padding-left: 20px; }

.toast { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 20; display: flex; gap: 12px; align-items: center;
  background: var(--ink); color: var(--bg); padding: 8px 8px 8px 16px; border-radius: var(--r); width: max-content; max-width: min(560px, calc(100% - 32px)); box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.toast[hidden] { display: none; }
.toast .btn { background: var(--bg); color: var(--ink); border-color: var(--bg); }
.toast .btn[hidden] { display: none; }

.content { max-width: 46rem; padding: 12px 0 40px; border-top: 1px solid var(--line); }
.content h2 { margin-top: 28px; }
.content p { margin: 0 0 12px; }
.faq h3:first-child { margin-top: 8px; }
.sources { color: var(--muted); margin-top: 24px !important; }

.foot { border-top: 1px solid var(--line); padding: 20px 0 36px; color: var(--muted); }
.sb-footer p { margin: 0 0 10px; overflow-wrap: anywhere; }
.sb-more a, .sb-privacy a, .sb-credit a { color: var(--berry); }

.print-root { display: none; }
.zoom { width: min(100vw - 16px, 1100px); max-width: none; height: min(100dvh - 16px, 1100px); max-height: none; padding: 0; border: 0; border-radius: var(--r); background: #fff; color: #1d1d1d; }
.zoom::backdrop { background: rgba(0, 0, 0, .6); }
.zoom[open] { display: flex; flex-direction: column; }
.zoom-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border-bottom: 1px solid #c6cdc3; }
.zoom-bar h2 { margin: 0; font-size: 1.1rem; color: #1d1d1d; }
.zoom-bar .btn { background: #fff; color: #1d1d1d; border-color: #6b6b6b; }
.zoom-body { flex: 1; overflow: auto; overscroll-behavior: contain; }
.zoom-wheel svg { display: block; width: 1000px; height: 1000px; max-width: none; }

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

@page { margin: 12mm; }
@media print {
  html, body { background: #fff !important; color: #000 !important; }
  body > *:not(.print-root) { display: none !important; }
  .print-root { display: block !important; font-family: Helvetica, Arial, 'Liberation Sans', sans-serif; color: #1d1d1d; }
  .print-root * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .p-sheet { break-after: auto; }
  .p-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 8mm; border-bottom: 0.4mm solid #1d1d1d; padding-bottom: 2mm; margin-bottom: 4mm; }
  .p-head p { margin: 1mm 0 0; font-size: 10.5pt; }
  .p-head .p-title { font: 400 20pt/1.15 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', 'URW Palladio L', Georgia, serif; margin: 0; }
  .p-name { font-size: 11pt; display: flex; align-items: flex-end; gap: 2mm; white-space: nowrap; margin: 0; }
  .p-name span { display: inline-block; width: 55mm; border-bottom: 0.3mm solid #1d1d1d; }
  .p-wheel svg { display: block; width: 180mm; height: 180mm; margin: 0 auto; }
  .p-legend { font-size: 10.5pt; margin-top: 4mm; }
  .p-legend ul { list-style: none; padding: 0; margin: 1mm 0 0; display: flex; flex-wrap: wrap; gap: 1mm 6mm; }
  .p-legend li { display: inline-flex; align-items: center; gap: 1.5mm; }
  .p-legend .mk, .p-legend .swatch { width: 3.6mm; height: 3.6mm; }
  .p-note { font-size: 10.5pt; margin: 2mm 0 0; }
  .p-list { break-before: page; }
  .p-list th.p-title2 { font: 400 14pt/1.2 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', 'URW Palladio L', Georgia, serif; border-bottom: 0; padding: 0 0 2.5mm; }
  .p-list table { width: calc(100% - 0.6mm); margin-left: 0.3mm; border-collapse: collapse; table-layout: fixed; font-size: 10.5pt; }
  .p-list col.c-date { width: 32mm; }
  .p-list col.c-ring { width: 36mm; }
  .p-list th { text-align: left; border-bottom: 0.4mm solid #1d1d1d; padding: 1mm 2mm; }
  .p-list td { border-bottom: 0.2mm solid #9a9a9a; padding: 0.8mm 2mm; vertical-align: top; overflow-wrap: anywhere; }
  .p-list tr { break-inside: avoid; }
  .p-list thead { display: table-header-group; }
}
