/* Holiday Bingo Card Generator + Card Grid + Crisp @media print Sheets */
.hb-tool { padding: 8px 0 24px; }
.hb-toolgrid { display: grid; gap: 20px; }
@media (min-width: 980px) {
  .hb-toolgrid { grid-template-columns: 360px minmax(0, 1fr); align-items: start; }
  .hb-out { position: sticky; top: 12px; }
}

.hb-ctl {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-card); padding: 6px 18px 18px;
}
.hb-fs { border: 0; margin: 0; padding: 14px 0 6px; border-top: 1px solid var(--line); }
.hb-fs:first-child { border-top: 0; }
.hb-fs legend {
  font-family: var(--font-display); font-weight: 600; font-size: 19px; line-height: 1;
  padding: 10px 0 6px; float: left; width: 100%;
}
.hb-fs legend + * { clear: both; }
.hb-field { display: block; margin: 0 0 14px; }
.hb-lab { display: block; font-size: var(--step-small); font-weight: 600; margin-bottom: 6px; color: var(--ink-2); }
.hb-lab small { font-weight: 400; }
.hb-help { display: block; font-size: var(--step-small); color: var(--ink-3); margin: 6px 0 10px; }
.hb-help[data-bad="1"] { color: var(--neg-fg); font-weight: 600; }

.hb-in {
  width: 100%; min-height: 44px; font-family: var(--font-text); font-size: 16px; line-height: 1.35;
  color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--line-strong); border-radius: 8px; padding: 9px 12px;
}
.hb-in:focus { border-color: var(--ink); }
select.hb-in {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px;
}
textarea.hb-in { resize: vertical; min-height: 140px; }
.hb-count .hb-in { max-width: 120px; }

.hb-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.hb-seg label { position: relative; }
.hb-seg input, .hb-sw input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.hb-seg span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 8px 15px;
  border-radius: var(--r-chip); border: 1.5px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font-size: 15px; font-weight: 600;
  transition: background-color 150ms var(--ease), color 150ms var(--ease), border-color 150ms var(--ease);
}
.hb-seg input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.hb-seg input:focus-visible + span, .hb-sw input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.hb-seg input:disabled + span { opacity: 0.4; text-decoration: line-through; cursor: not-allowed; }

.hb-check { display: flex; gap: 10px; align-items: center; min-height: 42px; font-size: 15px; cursor: pointer; }
.hb-check input { width: 20px; height: 20px; accent-color: var(--ink); margin: 0; flex: none; }
.hb-check input:disabled + span { color: var(--ink-3); }

.hb-sws { display: flex; flex-wrap: wrap; gap: 6px; }
.hb-sw { position: relative; }
.hb-sw span {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px;
  padding: 6px 12px 6px 8px; border-radius: var(--r-chip);
  border: 1.5px solid var(--line-strong); font-size: 14px; background: var(--surface); color: var(--ink);
}
.hb-sw i { width: 18px; height: 18px; border-radius: 50%; background: var(--sw); flex: none; }
.hb-sw input:checked + span { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.hb-custom { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.hb-custom .hb-lab { margin: 0; }
.hb-color-in { width: 44px; height: 38px; border: 1.5px solid var(--line-strong); border-radius: 6px; padding: 2px; background: var(--surface); cursor: pointer; }

.hb-list summary, .hb-calls summary {
  cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center;
}
.hb-list[open] summary { margin-bottom: 8px; }

/* output column */
.hb-out { min-width: 0; }
.hb-bar {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-card); padding: 14px 16px; display: grid; gap: 10px;
}
.hb-bar .hb-actions { margin-top: 0; }
.hb-tip { margin: 0; font-size: var(--step-small); color: var(--ink-3); line-height: 1.45; }
.hb-codebox { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hb-codebox .hb-lab { margin: 0; }
.hb-code { width: 15.5em; max-width: 100%; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.hb-status { margin: 0; font-size: var(--step-small); color: var(--ink-2); min-height: 1.4em; }
.hb-status[data-bad="1"] { color: var(--neg-fg); font-weight: 600; }

.hb-preview {
  margin-top: 12px; background: var(--raised); border: 1px solid var(--line);
  border-radius: var(--r-card); padding: 14px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px; max-height: 76vh; overflow: auto; overscroll-behavior: contain;
}
.hb-empty { grid-column: 1 / -1; margin: 40px auto; max-width: 40ch; text-align: center; color: var(--ink-2); }

/* interactive host call sheet */
.hb-calls {
  margin-top: 12px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-card); padding: 4px 16px;
}
.hb-caller-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 12px; }
.hb-caller-progress { font-size: var(--step-small); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.hb-caller-now {
  background: var(--raised); border: 1.5px solid var(--line-strong); border-radius: 8px;
  padding: 12px 16px; margin: 0 0 12px;
  font-family: var(--font-display); font-size: 22px; font-weight: 600; color: var(--ink);
  display: flex; align-items: center; gap: 10px;
}
.hb-call-list { columns: 3 12em; margin: 0 0 14px; padding-left: 0; list-style: none; font-size: 15px; }
.hb-call-list li { break-inside: avoid; margin: 0 0 6px; }
.hb-call-btn {
  display: inline-flex; align-items: center; gap: 6px; width: 100%; text-align: left;
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  padding: 5px 8px; font-family: var(--font-text); font-size: 15px; color: var(--ink); cursor: pointer;
}
.hb-call-btn:hover { background: var(--raised); }
.hb-call-btn[aria-pressed="true"] { background: var(--raised); color: var(--ink-3); text-decoration: line-through; }
.hb-call-num { font-size: 12px; color: var(--ink-3); min-width: 20px; font-variant-numeric: tabular-nums; }

@media (max-width: 979px) {
  .hb-out { order: -1; }
  .hb-preview {
    grid-auto-flow: column; grid-template-columns: none;
    grid-auto-columns: min(84vw, 350px);
    max-height: none; overflow-x: auto; overflow-y: hidden;
    scroll-snap-type: x mandatory; padding: 12px;
  }
  .hb-preview > .hb-card { scroll-snap-align: center; }
  .hb-preview > .hb-empty { grid-column: auto; width: 80vw; }
}

/* Sample card embedded inside prose pages */
.hb-sample { margin: 20px 0 24px; }
.hb-sample-card { max-width: 340px; padding: 14px; background: var(--raised); border-radius: var(--r-card); }
.hb-sample figcaption { margin-top: 10px; font-size: var(--step-small); color: var(--ink-3); max-width: 52ch; }
.hb-sample figcaption b { color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* Bingo cards (on-screen preview & print; scaled with container units) */
.hb-card {
  background: #ffffff; color: #16181a; border-radius: 6px;
  padding: 16px 16px 10px; font-family: var(--font-display);
}
.hb-c-in { container-type: inline-size; }
.hb-c-t {
  margin: 0; text-align: center; color: var(--c-title);
  font-weight: 600; font-size: 7.4cqw; line-height: 1.1; letter-spacing: -0.01em;
}
.hb-c-s { margin: 0.6cqw 0 0; text-align: center; color: var(--c-title); font-size: 4cqw; font-family: var(--font-text); }
.hb-c-letters {
  display: grid; grid-template-columns: repeat(5, 1fr); margin-top: 3cqw;
  background: var(--c-head); color: var(--c-headink);
  border: 0.5cqw solid var(--c-line); border-bottom: 0;
}
.hb-c-letters span { text-align: center; font-weight: 600; font-size: 9cqw; line-height: 1.25; }
.hb-c-band { height: 1.6cqw; margin-top: 3cqw; background: var(--c-head); }
.hb-c-grid { display: grid; border: 0.6cqw solid var(--c-line); }
.g3 .hb-c-grid { grid-template-columns: repeat(3, 1fr); }
.g4 .hb-c-grid { grid-template-columns: repeat(4, 1fr); }
.g5 .hb-c-grid { grid-template-columns: repeat(5, 1fr); }
.hb-c-cell {
  aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1cqw; padding: 1.2cqw; text-align: center;
  border-right: 0.3cqw solid var(--c-line); border-bottom: 0.3cqw solid var(--c-line);
  overflow: hidden; overflow-wrap: break-word; hyphens: auto; line-height: 1.1; font-weight: 500;
}
.g5 .hb-c-cell { font-size: 3.5cqw; }
.g4 .hb-c-cell { font-size: 4.3cqw; }
.g3 .hb-c-cell { font-size: 5.6cqw; }
.g5 .hb-c-cell:nth-child(5n), .g4 .hb-c-cell:nth-child(4n), .g3 .hb-c-cell:nth-child(3n) { border-right: 0; }
.g5 .hb-c-cell:nth-last-child(-n+5), .g4 .hb-c-cell:nth-last-child(-n+4), .g3 .hb-c-cell:nth-last-child(-n+3) { border-bottom: 0; }
.hb-c-e { font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; line-height: 1; font-size: 1.9em; }
.hb-c-cell .hb-c-e:only-child { font-size: 2.8em; }
.hb-c-free { background: var(--c-free); color: var(--c-freeink); font-weight: 600; }
.hb-c-star { width: 42%; fill: currentColor; }
.hb-c-foot {
  display: flex; justify-content: space-between; gap: 2cqw; margin: 1.8cqw 0 0;
  font-family: var(--font-text); font-size: 3cqw; line-height: 1.2; color: var(--c-title);
}
.hb-c-foot span { font-variant-numeric: tabular-nums; }
.hb-c-wm { margin: 1cqw 0 0; text-align: center; font-family: var(--font-text); font-size: 2.6cqw; line-height: 1.2; color: #56685e; }

/* Crisp print view (populated into #hb-printroot right before window.print()) */
.hb-print {
  font-family: var(--font-display);
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}
.hb-ppage {
  break-after: page; page-break-after: always;
  break-inside: avoid; page-break-inside: avoid;
  display: grid; gap: 0.35in; width: 7.5in; height: 9.8in;
  align-content: center; justify-items: center; position: relative;
}
.a4 .hb-ppage { width: 7.2in; height: 10.5in; }
.hb-ppage:last-child { break-after: auto; page-break-after: auto; }
.hb-ppage .hb-card { width: 100%; padding: 0; border-radius: 0; break-inside: avoid; page-break-inside: avoid; }
.pp1 .hb-card { width: min(100%, 6.8in); }
.pp2 { grid-template-rows: 1fr 1fr; }
.pp2 .hb-card { width: 4.35in; }
.a4 .pp2 .hb-card { width: 4.55in; }
.pp4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.pp4 .hb-card { width: 3.35in; }
.cut.pp2::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px dashed #888888; }
.cut.pp4::before { content: ''; position: absolute; top: 0; bottom: 0; left: 50%; border-left: 1px dashed #888888; }
.cut.pp4::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px dashed #888888; }

.hb-pcall, .hb-pslips { display: block; height: auto; }
.hb-p-h { font-weight: 600; font-size: 20pt; text-align: center; margin: 0 0 4pt; color: var(--c-title); }
.hb-p-sub { text-align: center; font-family: var(--font-text); font-size: 9.5pt; margin: 0 0 16pt; color: #33473c; }
.hb-pcall ol { columns: 3; column-gap: 18pt; margin: 0; padding: 0; list-style: none; font-family: var(--font-text); font-size: 10pt; line-height: 1.25; }
.hb-pcall li { break-inside: avoid; padding: 4.5pt 0; display: flex; gap: 6pt; align-items: center; }
.hb-pcall li i { width: 10pt; height: 10pt; border: 0.8pt solid #16181a; flex: none; }
.hb-pcall li small { width: 16pt; color: #56685e; font-size: 8.5pt; flex: none; }
.hb-pcall .hb-c-e { font-size: 12pt; }
.hb-pslips > div { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px dashed #888888; border-left: 1px dashed #888888; }
.hb-pslips span {
  height: 1.15in; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 6pt; border-right: 1px dashed #888888; border-bottom: 1px dashed #888888;
  font-family: var(--font-display); font-weight: 500; font-size: 11.5pt; line-height: 1.15;
  break-inside: avoid;
}
.hb-pslips b { font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; font-size: 20pt; font-weight: 400; }

@media print {
  header.hb-top, footer.hb-foot, main#main, .hb-skip { display: none !important; }
  body { background: #ffffff !important; margin: 0 !important; }
  body > *:not(#hb-printroot) { display: none !important; }
  #hb-printroot { display: block !important; }
}
