@font-face { font-family: "Fredoka"; src: url("fonts/fredoka.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }

:root {
  --bg: #ffffff;
  --ink: #1f232b;
  --muted: #565d6b;
  --line: #dfe2e8;
  --soft: #f3f4f7;
  --red: #d2372c;
  --red-ink: #b42a20;
  --mustard: #e3a21a;
  --teal: #1f8a8a;
  --table: #e9e4da;
  --focus: #1f6fd1;
  --display: "Fredoka", ui-rounded, "Arial Rounded MT Bold", system-ui, sans-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: #1a1d24; --ink: #eceef2; --muted: #a9afbc; --line: #353a46; --soft: #232731;
    --red: #ff6f61; --red-ink: #ff8a7e; --mustard: #f0b93c; --teal: #4cc3c3; --table: #2b2f39; --focus: #7fb2ff;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.55 var(--sans); }
a { color: var(--red-ink); text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* header: a strip of construction paper colours */
.site-header { display: flex; align-items: center; padding: 10px max(16px, calc(50% - 600px)); border-bottom: 5px solid var(--red); border-image: linear-gradient(90deg, var(--red) 0 33%, var(--mustard) 33% 66%, var(--teal) 66%) 1; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; color: var(--ink); text-decoration: none; font: 600 1.15rem/1 var(--display); }
main { max-width: 1200px; margin: 0 auto; padding: 0 16px 40px; }
.crumbs { font-size: .95rem; color: var(--muted); padding-top: 14px; }
.crumbs a { color: var(--muted); }
.hero { padding: 22px 0 8px; max-width: 46rem; }
h1 { font: 600 clamp(1.9rem, 5.4vw, 2.7rem)/1.1 var(--display); margin: 0 0 10px; letter-spacing: -.01em; }
.lede { margin: 0; font-size: 1.08rem; color: var(--muted); }

/* tool layout */
.maker { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; margin-top: 18px; }
@media (min-width: 980px) { .maker { grid-template-columns: minmax(340px, 410px) 1fr; align-items: start; } }
.form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.field { display: grid; gap: 6px; min-width: 0; }
label, legend, .label { font-weight: 600; font-size: .98rem; }
input[type=text], input[type=date], input[type=number], select, textarea {
  font: inherit; font-size: 16px; color: var(--ink); background: var(--bg); border: 1.5px solid #b9bfca; border-radius: 6px; padding: 10px 12px; min-height: 46px; width: 100%;
}
@media (prefers-color-scheme: dark) { input[type=text], input[type=date], input[type=number], select, textarea { border-color: #4a5060; } }
textarea { resize: vertical; line-height: 1.4; }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
input[type=date] { min-width: 0; padding-left: 8px; padding-right: 6px; }
@media (max-width: 359px) { .pair { grid-template-columns: minmax(0, 1fr); } }
.hint { margin: -6px 0 0; color: var(--muted); font-size: .95rem; }
.linkish { background: none; border: 0; padding: 4px 0; font: inherit; color: var(--red-ink); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; min-height: 32px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 6px; }

.seg { display: flex; flex-wrap: wrap; }
.seg legend { width: 100%; }
.seg label { position: relative; flex: 1 1 0; font-weight: 500; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 6px 10px; border: 1.5px solid #b9bfca; margin-left: -1.5px; cursor: pointer; text-align: center; line-height: 1.2; }
.seg label:first-of-type span { border-radius: 6px 0 0 6px; margin-left: 0; }
.seg label:last-of-type span { border-radius: 0 6px 6px 0; }
.seg input:checked + span { background: var(--ink); color: var(--bg); border-color: var(--ink); position: relative; z-index: 1; }
.seg input:focus-visible + span, .sizes input:focus-visible + .sz { outline: 3px solid var(--focus); outline-offset: 2px; z-index: 2; position: relative; }

.sizes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.sizes legend { grid-column: 1 / -1; }
.sizes label { position: relative; font-weight: 500; }
.sizes input { position: absolute; opacity: 0; inset: 0; }
.sz { display: grid; justify-items: start; gap: 2px; padding: 9px 8px 8px; border: 1.5px solid #b9bfca; border-radius: 6px; cursor: pointer; min-height: 44px; line-height: 1.2; }
.sz b { font-weight: 600; font-size: .95rem; }
.sz small { color: var(--muted); font-size: .85rem; }
.sizes input:checked + .sz { border-color: var(--red); box-shadow: inset 0 0 0 1.5px var(--red); }
.strip-ico { display: block; height: 10px; border: 2px solid var(--muted); border-radius: 2px; margin: 2px 0 4px; }
.s-mini { width: 40%; height: 8px; margin-bottom: 6px; } .s-small { width: 40%; } .s-classic { width: 80%; } .s-big { width: 80%; height: 14px; margin: 0 0 2px; }
.jump { font-weight: 600; }
@media (min-width: 980px) { .jump { display: none; } }
@media (prefers-color-scheme: dark) { .seg span, .sz { border-color: #4a5060; } }

.more { border-top: 1px solid var(--line); padding-top: 6px; }
.more summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; color: var(--red-ink); }
.more[open] { display: grid; gap: 14px; }
.more[open] summary { margin-bottom: -4px; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; min-height: 36px; }
.check input { width: 20px; height: 20px; accent-color: var(--red); flex: none; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline input { flex: 1; min-width: 0; }
.chips { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li { display: inline-flex; align-items: center; gap: 4px; background: var(--soft); border-radius: 4px; padding: 2px 2px 2px 10px; font-size: .95rem; }
.chip-x { border: 0; background: none; color: var(--muted); font-size: 1.2rem; min-width: 36px; min-height: 36px; cursor: pointer; }

.btn { font: 600 1rem/1.2 var(--sans); min-height: 46px; padding: 10px 16px; border-radius: 6px; border: 1.5px solid var(--ink); background: var(--bg); color: var(--ink); cursor: pointer; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary { color: #1a1d24; } }
.btn.small { min-height: 40px; min-width: 44px; padding: 6px 12px; }
.btn:disabled { opacity: .45; cursor: default; }

/* result */
.result { display: grid; gap: 14px; min-width: 0; }
.answer-box { border-left: 6px solid var(--red); padding: 4px 0 4px 16px; }
.answer { font: 500 1.6rem/1.2 var(--display); margin: 0 0 6px; }
.answer strong { font-weight: 600; color: var(--red-ink); }
.answer.err { color: var(--red-ink); font-size: 1.25rem; }
.answer-sub { margin: 0; color: var(--muted); }
.tip { margin: 8px 0 0; font-size: .97rem; }
.tip-line { display: block; }
.tip-line + .tip-line { margin-top: 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.copied { margin: -4px 0 0; min-height: 1.2em; color: var(--muted); font-size: .95rem; overflow-wrap: anywhere; }
.pager { display: flex; align-items: center; gap: 12px; }
.pager span { font-weight: 600; }
.preview { background: var(--table); border-radius: 6px; padding: 14px; overflow: hidden; min-height: 120px; }
.sheets { zoom: var(--z, .5); }
.sheets .sheet { display: none; margin: 0 auto; box-shadow: 0 2px 10px rgba(0, 0, 0, .15); }
.sheets .sheet.on { display: block; }

/* tracker */
.tracker { margin: 18px 0 10px; padding: 24px 0; border-top: 5px solid var(--mustard); }
.tr-title { font: 600 1.4rem/1.2 var(--display); margin: 0; }
.tr-big { font: 600 clamp(5rem, 26vw, 9rem)/1 var(--display); margin: 10px 0 0; color: var(--red-ink); }
.tr-sub { font-size: 1.25rem; margin: 4px 0 10px; }
.tr-text { font: 500 1.35rem/1.3 var(--display); margin: 0 0 14px; padding: 10px 14px; background: var(--soft); border-radius: 6px; max-width: 36rem; }
.tr-chain { display: flex; flex-wrap: wrap; align-items: center; row-gap: 12px; padding: 8px 0 20px 10px; max-width: 760px; }
.loop { width: 38px; height: 24px; border: 6px solid var(--c); border-radius: 12px; margin-left: -10px; }
.loop:nth-child(even) { height: 14px; border-width: 5px; }
.more-n { margin-left: 10px; font-weight: 600; color: var(--muted); }

/* content */
.content { max-width: 46rem; margin-top: 44px; }
.content h2 { font: 600 1.55rem/1.2 var(--display); margin: 0 0 12px; }
.content p, .content li { max-width: 70ch; }
.steps { padding-left: 1.3em; margin: 0 0 12px; }
.steps li { margin-bottom: 6px; }
.sizes-table { border-collapse: collapse; width: 100%; font-size: .97rem; }
.sizes-table th, .sizes-table td { text-align: left; padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.sizes-table th { font-weight: 600; }
@media (max-width: 480px) { .sizes-table th:nth-child(2), .sizes-table td:nth-child(2) { display: none; } }
.qa { border-bottom: 1px solid var(--line); }
.qa summary { cursor: pointer; font-weight: 600; padding: 12px 0; min-height: 44px; list-style-position: inside; }
.qa p { margin: 0 0 14px; }
.occ-links { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 22px; }
.occ-links a { display: inline-block; padding: 6px 0; }

/* footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 30px; padding: 20px 16px 30px; color: var(--muted); font-size: .95rem; }
.sb-footer { max-width: 1200px; margin: 0 auto; }
.sb-footer a { color: var(--muted); }
.sb-footer p { margin: 6px 0; }
.notfound { padding: 40px 0; }
.notfound .big { font: 600 5rem/1 var(--display); color: var(--red-ink); margin: 0; }

/* ---------- printed sheets (also shown scaled in the preview) ---------- */
.sheet { width: 196mm; padding: 3mm; background: #fff; color: #1a1a1a; font-family: var(--sans); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.sheet-head { height: 10mm; display: flex; flex-direction: column; justify-content: center; font-size: 7.5pt; line-height: 1.3; color: #555; width: 184mm; margin: 0 auto; }
.sheet-head p { margin: 0; }
.sheet-head b { color: #1a1a1a; }
.grid { display: grid; width: max-content; margin: 0 auto; border-top: .3mm dashed #a6a6a6; border-left: .3mm dashed #a6a6a6; }
.strip { position: relative; display: grid; grid-template-columns: var(--glue) auto minmax(0, 1fr) auto; align-items: center; overflow: hidden;
  border-right: .3mm dashed #a6a6a6; border-bottom: .3mm dashed #a6a6a6; }
.strip::after { content: ""; position: absolute; top: 1.4mm; bottom: 1.4mm; right: 1.4mm; left: calc(var(--glue) + 1mm); border: .45mm solid var(--c, #333); border-radius: 1.2mm; pointer-events: none; }
.strip.spare::after { border-color: #d0d0d0; border-width: .3mm; }
.ink-black .strip::after, .ink-outline .strip::after { border-color: #444; border-width: .3mm; }
.glue { align-self: stretch; display: flex; align-items: center; justify-content: center; border-right: .3mm dotted #9a9a9a; color: #8a8a8a;
  font-size: 6.5pt; writing-mode: vertical-rl; transform: rotate(180deg); }
.nb { display: flex; flex-direction: column; align-items: center; padding: 0 2.6mm 0 3mm; line-height: 1; min-width: var(--nbw); }
.num { font-family: var(--display); font-weight: 600; color: var(--c, #1a1a1a); letter-spacing: -.01em; }
.ink-black .num { color: #1a1a1a; }
.ink-outline .num { color: transparent; -webkit-text-stroke: .32mm #1a1a1a; font-weight: 700; }
.cap { color: #444; margin-top: .6mm; white-space: nowrap; }
.mid { display: flex; flex-direction: column; justify-content: center; gap: .6mm; min-width: 0; padding-right: 2mm; }
.badge { display: inline-flex; align-items: center; gap: 1mm; font-weight: 700; color: var(--c, #1a1a1a); line-height: 1.1; }
.ink-black .badge, .ink-outline .badge { color: #1a1a1a; }
.star { width: 1.15em; height: 1.15em; fill: currentColor; flex: none; }
.ink-outline .star { fill: none; stroke: #1a1a1a; stroke-width: 1.6; }
.txt { line-height: 1.18; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.when { text-align: right; padding-right: 3.2mm; line-height: 1.15; color: #333; white-space: nowrap; }
.when b { display: block; font-weight: 700; }

.sz-classic { --glue: 13mm; --nbw: 27mm; } .sz-big { --glue: 15mm; --nbw: 36mm; } .sz-small { --glue: 10mm; --nbw: 19mm; } .sz-mini { --glue: 8mm; --nbw: 15mm; }
.sz-classic .num { font-size: 37pt; } .sz-classic .num.d3 { font-size: 30pt; } .sz-classic .cap { font-size: 7.5pt; }
.sz-classic .txt { -webkit-line-clamp: 2; } .sz-classic .t1 { font-size: 11.5pt; } .sz-classic .t2 { font-size: 10.5pt; } .sz-classic .t3 { font-size: 9.5pt; } .sz-classic .t4 { font-size: 8.5pt; -webkit-line-clamp: 3; }
.sz-classic .badge { font-size: 8.5pt; } .sz-classic .when { font-size: 9pt; }
.sz-big .num { font-size: 54pt; } .sz-big .num.d3 { font-size: 44pt; } .sz-big .cap { font-size: 9.5pt; }
.sz-big .txt { -webkit-line-clamp: 3; } .sz-big .t1 { font-size: 15pt; } .sz-big .t2 { font-size: 13pt; } .sz-big .t3 { font-size: 11.5pt; } .sz-big .t4 { font-size: 10pt; -webkit-line-clamp: 4; }
.sz-big .badge { font-size: 10pt; } .sz-big .when { font-size: 11pt; }
.sz-small .nb { padding: 0 1.8mm 0 2.2mm; } .sz-small .num { font-size: 28pt; } .sz-small .num.d3 { font-size: 22pt; } .sz-small .cap { font-size: 6.5pt; }
.sz-small .txt { -webkit-line-clamp: 2; } .sz-small .t1 { font-size: 8.5pt; } .sz-small .t2 { font-size: 8pt; } .sz-small .t3 { font-size: 7.5pt; } .sz-small .t4 { font-size: 7pt; -webkit-line-clamp: 3; }
.sz-small .badge { font-size: 7pt; } .sz-small .when { font-size: 7.5pt; padding-right: 2.6mm; }
.sz-mini .nb { padding: 0 1.6mm 0 2mm; } .sz-mini .num { font-size: 21pt; } .sz-mini .num.d3 { font-size: 17pt; } .sz-mini .cap { font-size: 6pt; margin-top: .3mm; }
.sz-mini .txt { -webkit-line-clamp: 2; } .sz-mini .t1 { font-size: 7.5pt; } .sz-mini .t2 { font-size: 7pt; } .sz-mini .t3 { font-size: 6.5pt; } .sz-mini .t4 { font-size: 6.5pt; -webkit-line-clamp: 3; line-height: 1.12; }
.sz-mini .badge { font-size: 6.5pt; } .sz-mini .when { font-size: 7pt; padding-right: 2.4mm; }

.strip.notext { grid-template-columns: var(--glue) minmax(0, 1fr) auto; }
.notext .nb { justify-self: center; padding: 0; }
.notext .badge { margin-top: .5mm; }
.zero .num svg { width: .8em; height: .8em; fill: var(--c, #1a1a1a); display: block; }
.ink-black .zero .num svg { fill: #1a1a1a; }
.ink-outline .zero .num svg { fill: none; stroke: #1a1a1a; stroke-width: 1.2; }
.final::after { border-width: .8mm; border-style: double; }
.final .when { padding-right: 4mm; }
/* Number-only links with a badge stack three lines; a smaller number keeps the badge clear of the frame. */
.sz-classic .notext.hb .num { font-size: 29pt; } .sz-classic .notext.hb .num.d3 { font-size: 25pt; }
.sz-big .notext.hb .num { font-size: 44pt; } .sz-big .notext.hb .num.d3 { font-size: 38pt; }
.sz-small .notext.hb .num { font-size: 22pt; } .sz-small .notext.hb .num.d3 { font-size: 19pt; }
.sz-mini .notext.hb .num { font-size: 16pt; } .sz-mini .notext.hb .num.d3 { font-size: 14pt; }

.topper { position: relative; width: 184.3mm; margin: 0 auto; border: .3mm dashed #a6a6a6; border-top: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 4mm 10mm; }
.hole { position: absolute; top: 3.5mm; left: 50%; width: 4mm; height: 4mm; margin-left: -2mm; border: .3mm solid #9a9a9a; border-radius: 50%; }
.tp-title { margin: 3mm 0 0; font: 600 22pt/1.1 var(--display); color: #1a1a1a; }
.tp-sub { margin: 1mm 0 3mm; font-size: 9.5pt; color: #444; }
.tp-verse { margin: 0 0 3mm; font-size: 11pt; line-height: 1.45; font-style: italic; color: #222; }
.tp-how { margin: 0; font-size: 8pt; color: #555; }

@page { margin: 10mm; }
@media print {
  body { background: #fff; color: #000; }
  .site-header, .crumbs, .hero, .form, .answer-box, .actions, .copied, .pager, .content, .site-footer, .tracker { display: none !important; }
  #maker[hidden] { display: block !important; }
  main, .maker, .result, .preview { display: block; padding: 0; margin: 0; max-width: none; background: none; border: 0; box-shadow: none; min-height: 0; }
  .sheets { zoom: 1 !important; }
  .sheets .sheet { display: block !important; width: 190mm; padding: 0; margin: 0 auto; box-shadow: none; break-after: page; break-inside: avoid; }
  .sheets .sheet:last-child { break-after: auto; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
