/* Hexmarket print-and-play. Screen: a preview of the A4 sheets. Print: A4 portrait, no margins, 3 x 3 cards of 63 x 88 mm. */
:root { --felt: #1b1b2f; --felt-2: #24243d; --cream: #f6e7cb; --accent: #e94560; --gold: #ffbd39; }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--felt); color: var(--cream); font-family: Bitter, Georgia, serif; font-size: 16px; line-height: 1.5; }
:focus-visible { outline: 3px solid var(--cream); outline-offset: 3px; }
main:focus { outline: none; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 10; padding: 12px 18px; background: var(--cream); color: var(--felt); font-weight: 700; border-radius: 6px; text-decoration: none; }
.skip:focus { top: 12px; }

.bar { position: sticky; top: 0; z-index: 5; background: rgba(27, 27, 47, .96); border-bottom: 1px solid rgba(246, 231, 203, .16); padding: 10px 16px 12px; }
.bar-in { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; max-width: 1100px; margin: 0 auto; }
.back { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; color: var(--cream); text-decoration: none; }
.bar h1 { margin: 0; font: 700 24px/1.1 "Zilla Slab", Georgia, serif; }
.bar-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.bar-title span { display: inline-block; margin-left: 6px; font: 600 14px/1.2 Bitter, Georgia, serif; color: rgba(246, 231, 203, .75); }
.bar-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin-left: auto; }
.ink { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; font-weight: 600; cursor: pointer; }
.ink input { width: 20px; height: 20px; accent-color: var(--accent); }
.btn-print { min-height: 48px; padding: 0 22px; font: 700 16px/1 Bitter, Georgia, serif; color: #11111d; background: var(--accent); border: 0; border-radius: 8px; cursor: pointer; }
.bar-note { max-width: 1100px; margin: 4px auto 0; font-size: 14px; color: rgba(246, 231, 203, .75); }

main { padding: 24px 12px 64px; }
.sheet {
  position: relative;
  width: min(210mm, 100%);
  margin: 0 auto 28px;
  background: #fffdf8; color: var(--felt);
  box-shadow: 0 20px 40px -20px rgba(0, 0, 0, .8);
  container-type: inline-size;
}
.cards-sheet { aspect-ratio: 210 / 297; padding: 0; }
.pgrid { display: grid; width: 90cqw; margin: 7.86cqw auto 0; grid-template-columns: repeat(3, 30cqw); grid-auto-rows: 41.9cqw; }
.pcell { position: relative; container-type: inline-size; }
.pcell::after { content: ""; position: absolute; inset: 0; border: 1px dashed #8a8a8a; pointer-events: none; z-index: 1; }
.pcell .cf { border-radius: 0; height: 100%; }
.sheet-foot { position: absolute; left: 5cqw; right: 5cqw; bottom: 2.4cqw; margin: 0; font-size: max(1.6cqw, 9px); color: #4a4a5e; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* rules page */
.rules-page { padding: 32px 28px 56px; }
.rules-sheet { color: var(--felt); }
.rs-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 20px; padding-bottom: 10px; border-bottom: 3px double var(--felt); }
.rules-sheet .rs-title { margin: 0; font: 700 36px/1 "Zilla Slab", Georgia, serif; }
.rules-sheet .rs-sub { margin: 0; font-size: 14px; font-weight: 600; }
.rs-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 24px; }
.rs-col + .rs-col { border-left: 1px solid rgba(27, 27, 47, .25); padding-left: 24px; }
.rules-sheet h3 { margin: 16px 0 0; font: 700 18px/1.2 "Zilla Slab", Georgia, serif; }
.rules-sheet p, .rules-sheet li { font-size: 14.5px; line-height: 1.45; }
.rules-sheet p { margin: 6px 0 0; }
.rules-sheet ul, .rules-sheet ol { margin: 6px 0 0; padding-left: 18px; }
.rs-sum { padding: 6px 10px; background: rgba(27, 27, 47, .07); font-weight: 600; }
.rules-page .sheet-foot { bottom: 18px; left: 28px; right: 28px; font-size: 12px; white-space: normal; }
@media (max-width: 720px) {
  .rs-cols { grid-template-columns: minmax(0, 1fr); }
  .rs-col + .rs-col { border-left: 0; padding-left: 0; border-top: 1px solid rgba(27, 27, 47, .25); margin-top: 16px; }
  .rules-page { padding: 24px 18px 56px; }
}

/* low ink: no art, plain paper */
body:has(#lowink:checked) .cf-art { display: none; }
body:has(#lowink:checked) .cf { background: #fff; box-shadow: inset 0 0 0 2.4cqw #fff, inset 0 0 0 2.8cqw #9a9a9a; }
body:has(#lowink:checked) .cf-box { background: none; border-top: .5cqw solid #9a9a9a; border-radius: 0; }
body:has(#lowink:checked) .cf-name { margin-top: 5cqw; font-size: 10cqw; }
body:has(#lowink:checked) .cf-text { font-size: 6.4cqw; }

@media (hover: hover) {
  .back:hover { text-decoration: underline; }
  .btn-print:hover { background: var(--cream); }
}
.btn-print:focus-visible, .back:focus-visible { outline: 3px solid var(--cream); outline-offset: 3px; }
@page { size: A4 portrait; margin: 0; }
@media print {
  html, body { background: #fff; }
  .bar, .skip { display: none !important; }
  main { padding: 0; }
  .sheet { width: 210mm; height: 297mm; margin: 0; box-shadow: none; break-after: page; page-break-after: always; overflow: hidden; }
  .sheet:last-child { break-after: auto; page-break-after: auto; }
  .cards-sheet { aspect-ratio: auto; padding: 0; }
  .pgrid { width: 189mm; margin: 16.5mm auto 0; grid-template-columns: repeat(3, 63mm); grid-auto-rows: 88mm; }
  .pcell::after { border: .25mm dashed #777; }
  .sheet-foot { left: 10.5mm; right: 10.5mm; bottom: 7mm; font-size: 7.5pt; }
  .rules-page { padding: 14mm 14mm 20mm; }
  .rules-page .sheet-foot { left: 14mm; right: 14mm; bottom: 8mm; font-size: 7.5pt; }
  .rules-sheet .rs-title { font-size: 26pt; }
  .rules-sheet .rs-sub { font-size: 8pt; }
  .rules-sheet h3 { font-size: 11.5pt; margin-top: 4mm; }
  .rules-sheet p, .rules-sheet li { font-size: 9pt; line-height: 1.4; }
  .rs-cols { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 6mm; }
  .rs-col + .rs-col { border-left: .3mm solid rgba(27, 27, 47, .3); padding-left: 6mm; border-top: 0; margin-top: 0; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
