@media print {
  body.printing > *:not(#print-root) { display: none !important; }
  body.printing #print-root { display: block !important; }
  body.printing { background: #fff !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
#print-root { font-size: 11px; color: #000; }
#print-root .print-page { page-break-after: always; break-after: page; }
#print-root .print-page:last-child { page-break-after: auto; break-after: auto; }
#print-root .print-page.flow { page-break-after: always; }
.p-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #000; padding-bottom: 4px; margin-bottom: 8px; }
.p-tname { font-size: 15px; font-weight: 800; }
/* the tournament's logo (Setup → Event) beside its name: no taller than the name and date, so pages don't grow */
.p-hl { display: flex; align-items: center; gap: 8px; min-width: 0; }
.p-logo { height: 0.4in; max-width: 1.2in; width: auto; object-fit: contain; flex: none; }
.sh-logo { height: 0.3in; max-width: 0.9in; width: auto; object-fit: contain; vertical-align: middle; margin-right: 6px; }
.s4-logo { height: 0.17in; max-width: 0.5in; width: auto; object-fit: contain; vertical-align: -0.04in; margin-right: 4px; }
.p-title { font-size: 18px; font-weight: 800; text-align: right; }
.p-sub { font-size: 11px; font-weight: 400; color: #333; }
.p-table { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.p-table th, .p-table td { border: 1px solid #999; padding: 4px 6px; text-align: left; vertical-align: top; }
.p-table.compact td { padding: 2px 5px; }
.p-table th { background: #eee; }
.p-table .num { text-align: right; }
.p-table td.small, .p-table .small { font-size: 9.5px; }
.p-table.weighin td { height: 26px; }
.p-cols { columns: 2; column-gap: 18px; }
.p-block { break-inside: avoid; margin-bottom: 8px; }
.p-block h3 { margin: 0 0 3px; font-size: 13px; }
.p-sign { margin-top: 30px; }
.p-placers { margin-top: 8px; font-size: 12px; }
.p-placers .placers { columns: 4; }
#print-root h3 { font-size: 13px; margin: 10px 0 4px; }
/* All Results: a weight's name stays with its table; a long table repeats its column headings on each page */
#print-root .p-wt h3 { break-after: avoid; page-break-after: avoid; }
#print-root .p-wt.keep { break-inside: avoid; page-break-inside: avoid; }
#print-root .p-res { table-layout: fixed; }
#print-root .p-res thead { display: table-header-group; }
#print-root .p-res th { font-size: 9.5px; padding: 2px 5px; }
#print-root .p-res th:nth-child(1) { width: 7%; } #print-root .p-res th:nth-child(2) { width: 16%; } #print-root .p-res th:nth-child(4) { width: 6%; } #print-root .p-res th:nth-child(6) { width: 13%; }
#print-root .p-res tr { break-inside: avoid; }
/* seeding sheets: tight rows so more weights fit on each page */
#print-root .seed-page .p-table.compact td { padding: 1px 5px; }
#print-root .seed-page .p-block h3 { margin: 0 0 2px; }
#print-root .bracket-wrap { border: 0; padding: 0; }
#print-root .bb { border-color: #666; }
#print-root .bb-meta { background: #f2f2f2; }
#print-root .br-pair::after, #print-root .br-pair::before, #print-root .br-single.has-next::after { border-color: #444; }

/* bout sheets: two per letter page */
.sheets { display: flex; flex-direction: column; height: 10.2in; justify-content: space-between; }
.cut { border-top: 1px dashed #999; margin: 0 -0.2in; }
.sheet { height: 4.95in; display: flex; flex-direction: column; gap: 5px; padding: 2px 0; overflow: hidden; }
.sh-top { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #000; }
.sh-t { font-weight: 800; font-size: 13px; }
.sh-bout { font-size: 16px; }
.sh-bout b { font-size: 26px; }
.sh-info { display: flex; gap: 18px; font-size: 12px; }
.sh-grid { width: 100%; border-collapse: collapse; }
.sh-grid th, .sh-grid td { border: 1px solid #000; padding: 2px 4px; font-size: 10px; text-align: center; }
.sh-grid th small { display: block; font-weight: 400; }
.sh-grid td { height: 38px; }
.sh-grid .sh-w { text-align: left; width: 34%; }
.sh-grid .sh-w b { font-size: 13px; display: block; }
.sh-grid .sh-w span { font-size: 9px; color: #333; }
.sh-color { font-weight: 800; width: 44px; color: #fff; }
.sh-color.c-red { background: #c62828; }
.sh-color.c-green { background: #1b7f4b; }
.sh-total { width: 50px; }
.sh-row2 { display: grid; grid-template-columns: 1.05fr 1fr; gap: 10px; flex: 1; }
.sh-row2:has(.sh-qr) { grid-template-columns: 1.05fr 1fr auto; }
.sh-qr { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 9.5px; text-align: center; line-height: 1.15; color: #333; }
.sh-qr small { font-size: 9.5px; } /* about 7 pt: readable next to the scale of a clipboard */
.sh-qr svg { width: 0.95in; height: 0.95in; }
.sheet4 { position: relative; }
.s4-qr { position: absolute; right: 0; bottom: 2px; flex-direction: row; gap: 4px; text-align: left; }
.s4-qr svg { width: 0.62in; height: 0.62in; }
.sheet4:has(.s4-qr) .s4-foot { padding-right: 1.4in; }
.sh-pen { border-collapse: collapse; width: 100%; }
.sh-pen th, .sh-pen td { border: 1px solid #000; font-size: 9.5px; padding: 1px 3px; text-align: left; }
.sh-pen td { height: 18px; }
.sh-c { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 2px; }
.sh-c.c-red { background: #c62828; }
.sh-c.c-green { background: #1b7f4b; }
.box { display: inline-block; min-width: 15px; height: 13px; border: 1px solid #000; margin: 0 1px; font-size: 8px; text-align: center; line-height: 12px; padding: 0 1px; }
.sh-choice { display: flex; flex-direction: column; gap: 6px; font-size: 10.5px; }
.sh-result { font-size: 11.5px; }
.sh-sign { margin-top: auto; font-size: 10.5px; }

/* ---- compact print brackets */
#print-root .bracket.print { --cell-h: 30px; --gap: 16px; }
#print-root .bracket.print .br-col { min-width: 168px; width: 168px; }
#print-root .bracket.print .br-col-title { font-size: 8.5px; margin-bottom: 1px; }
#print-root .bracket.print .br-section { margin-bottom: 8px; }
#print-root .bracket.print .br-section-title { font-size: 9px; margin-bottom: 2px; }
#print-root .bracket.print .bb { font-size: 9px; border-radius: 2px; }
#print-root .bracket.print .bb-line { min-height: 12px; padding: 0 3px; gap: 3px; }
#print-root .bracket.print .bb-team { font-size: 8.5px; }
#print-root .bracket.print .bb-num { font-size: 8.5px; font-weight: 700; color: #444; min-width: 14px; }
#print-root .bracket.print .bb-pres { font-size: 8.5px; font-weight: 700; color: #000; white-space: nowrap; }
/* on paper a name is never cut short with "…": a long one wraps */
#print-root .bb-name { white-space: normal; text-overflow: clip; overflow: visible; line-height: 1.1; overflow-wrap: anywhere; }
/* losers and byes print dark enough to read on any printer */
#print-root .bb-line.lose .bb-name, #print-root .bb-line.ph .bb-name { color: #444; }
#print-root .bb-line.bye .bb-name { color: #666; }
#print-root .bb.is-bye { opacity: .85; }
#print-root .bracket.print .bb-dot { width: 5px; height: 5px; }
#print-root .bracket.print .br-place > div { width: 168px; } /* as wide as a bracket column */
#print-root .bracket.print .bb.champion { min-height: 14px; }
/* pools (paper): the pool tables wrap into rows of up to 4 (--pcols, set by renderPools); the pools' bracket under them
   has boxes as wide as an elimination bracket's, with the result on a line of its own */
#print-root .pools.print.multi { display: grid; grid-template-columns: repeat(var(--pcols, 4), max-content); gap: 6px 18px; align-items: start; }
#print-root .pools.print .pool-block { margin-bottom: 4px; }
#print-root .pools.print .pool-grid { margin-bottom: 4px; }
/* 3 or more pools (.tight): compact pool tables — the page is scaled to fit its widest row — with a short name column and results that wrap */
#print-root .pools.print.tight .pool-grid .pg-name { min-width: 0; }
#print-root .pools.print.tight .pool-grid td.pg-r { width: 46px; max-width: 46px; line-height: 1.15; }
#print-root .pools.print.tight .pool-grid td.pg-r b { display: block; }
#print-root .pools.print.tight .pool-grid th, #print-root .pools.print.tight .pool-grid td { padding: 1px 3px; }
#print-root .pools.print ~ .bracket.print { --cell-h: 40px; margin-top: 6px; }
#print-root .bb-resline { min-height: 11px; padding: 0 3px; border-top: 1px dashed #bbb; text-align: right; font-size: 8.5px; font-weight: 700; color: #000; white-space: nowrap; line-height: 11px; }
#print-root .pools.print .pool-grid th, #print-root .pools.print .pool-grid td { padding: 2px 4px; font-size: 9px; }
#print-root .bracket-page .p-placers { font-size: 10px; }
#print-root .bracket-page .p-placers .placers { columns: 4; margin: 2px 0 0; }
#print-root .print-fit { transform-origin: top left; }

/* ---- 4 bout sheets per page */
.sheets4 { display: flex; flex-direction: column; height: 10.2in; justify-content: space-between; }
.sheet4 { height: 2.45in; display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.s4-top { display: flex; gap: 14px; align-items: baseline; border-bottom: 1.5px solid #000; font-size: 11px; }
.s4-bout b { font-size: 20px; }
.s4-t { margin-left: auto; font-weight: 700; font-size: 10px; }
.s4-grid td { height: 52px; }
.s4-grid .sh-w { width: 24%; }
.s4-grid .sh-w b { font-size: 11.5px; }
.s4-grid .sh-color { width: 18px; }
.s4-grid th { font-size: 8.5px; }
.s4-qr small { font-size: 8.5px; }
.s4-pens { text-align: left !important; font-size: 8.5px; line-height: 1.55; width: 31%; }
.s4-pen { display: inline-block; margin-right: 4px; white-space: nowrap; }
.s4-pens .box { min-width: 12px; height: 12px; font-size: 8px; line-height: 11px; }
.s4-foot { display: flex; gap: 14px; flex-wrap: wrap; font-size: 10.5px; align-items: center; padding-top: 4px; }

/* ---- QR cards */
.qr-print { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; height: 10in; text-align: center; }
.qp-t { font-size: 16px; font-weight: 700; color: #333; }
.qp-mat { font-size: 54px; font-weight: 900; }
.qp-loc { font-size: 22px; color: #444; margin-top: -10px; }
.qp-code { font-size: 30px; letter-spacing: .12em; }
.qp-code b { font-family: ui-monospace, Consolas, monospace; }
.qp-how { font-size: 15px; max-width: 5.5in; }
.qp-brand { font-size: 12px; color: #666; margin-top: 20px; }

/* ---- coach access cards (4 per page) */
.cc-page { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; height: 10in; gap: 0; }
.cc { border: 1px dashed #999; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: .2in .25in; gap: 4px; overflow: hidden; }
.cc-ev { font-size: 12px; font-weight: 700; color: #444; }
.cc-team { font-size: 24px; font-weight: 900; line-height: 1.1; }
.cc-lbl { font-size: 10px; letter-spacing: .15em; color: #666; margin-top: 4px; }
.cc-code { font-family: ui-monospace, Consolas, monospace; font-size: 34px; font-weight: 800; letter-spacing: .14em; border: 2px solid #000; border-radius: 8px; padding: 0 12px; }
.cc-qr svg { width: 1.7in; height: 1.7in; }
.cc-how { font-size: 10.5px; max-width: 3.4in; }
.cc-what { font-size: 9.5px; color: #444; max-width: 3.4in; }
.cc-keep { font-size: 9px; font-style: italic; color: #777; }

/* ---- placement certificates (landscape) */
.cert { height: 7.6in; display: flex; }
.cert-frame { flex: 1; border: 6px double #1f2a44; border-radius: 6px; padding: .45in .6in; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; font-family: Georgia, 'Times New Roman', serif; }
.cert-event { font-size: 20px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #1f2a44; }
.cert-kicker { font-size: 16px; letter-spacing: .3em; text-transform: uppercase; color: #6b7280; margin-top: 10px; }
.cert-place { font-size: 60px; font-weight: 700; color: #1f2a44; line-height: 1.1; }
.cert-weight { font-size: 24px; color: #374151; }
.cert-name { font-size: 46px; font-style: italic; margin-top: 18px; border-bottom: 2px solid #1f2a44; padding: 0 30px 4px; }
.cert-team { font-size: 22px; color: #374151; }
.cert-foot { display: flex; justify-content: space-between; align-items: flex-end; width: 100%; margin-top: auto; font-size: 13px; color: #374151; }
.cert-foot > div { width: 30%; text-align: center; }
.cert-line { display: block; border-top: 1px solid #111; margin-bottom: 4px; }

/* ---- black & white bout sheets: no color fills, colors spelled out */
.bw .sh-color { background: #fff !important; color: #000 !important; border: 2px solid #000 !important; letter-spacing: .04em; }
.bw .sh-color.c-green { outline: 2px solid #000; outline-offset: -5px; }
.bw .s4-grid .sh-color { font-size: 0; width: 44px; }
.bw .s4-grid .sh-color::after { content: attr(data-full); font-size: 9px; }
.bw .sh-c { width: auto; height: auto; border-radius: 0; background: none !important; font-size: 8px; font-weight: 800; margin-right: 3px; }
.bw .sh-c::after { content: attr(data-l); }
.bw .sh-pen th { background: #fff; }

/* ---- mat signs (spectators): the biggest possible mat name */
.msign { display: flex; flex-direction: column; text-align: center; overflow: hidden; }
.msign.land { height: 7.7in; }
.msign.port { height: 10.2in; }
.ms-event { font-size: 22px; font-weight: 700; color: #333; border-bottom: 3px solid #000; padding-bottom: 6px; }
.ms-main { flex: 1; display: flex; align-items: center; justify-content: center; gap: .3in; }
.msign.port .ms-main { flex-direction: column; }
.ms-text { display: flex; flex-direction: column; align-items: center; }
.ms-name { font-weight: 900; line-height: .9; letter-spacing: -.02em; }
.ms-kicker { font-size: 72px; font-weight: 900; letter-spacing: .3em; margin-bottom: -.1em; padding-left: .3em; }
.ms-loc { font-size: 44px; font-weight: 700; color: #222; margin-top: 10px; }
.ms-qr { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; }
.ms-qr svg { width: 2.1in; height: 2.1in; }

/* ---- mat table sign-in cards (workers): two per page */
.si-page { display: flex; flex-direction: column; height: 10.2in; justify-content: space-between; }
.si-card { height: 4.9in; display: grid; grid-template-columns: 1fr 2.9in; gap: .25in; align-items: center; padding: .1in .15in; }
.si-tag, #print-root .si-tag { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .12em; border: 2px solid #000; padding: 2px 8px; border-radius: 4px; margin-bottom: 8px; }
.si-ev { font-size: 14px; font-weight: 700; color: #333; }
.si-mat { font-size: 64px; font-weight: 900; line-height: 1.05; }
.si-loc { font-size: 22px; color: #333; }
.si-code { font-size: 26px; margin: 8px 0; letter-spacing: .1em; }
.si-code b { font-family: ui-monospace, Consolas, monospace; border: 2px solid #000; border-radius: 6px; padding: 0 10px; }
.si-how { font-size: 13px; margin-top: 6px; }
.si-keep { font-size: 11px; font-style: italic; color: #444; margin-top: 8px; }
.si-qr svg { width: 2.8in; height: 2.8in; }
