/* ---------- Tokens ---------- */
:root {
  --bg: #fff9f2;
  --surface: #ffffff;
  --ink: #1f2340;
  --muted: #5d6079;
  --line: #ece3d6;
  --accent: #e0452c;
  --accent-dark: #c2361f;
  --accent-soft: #ffe7e0;
  --navy: #1f2340;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(31, 35, 64, 0.06), 0 8px 28px rgba(31, 35, 64, 0.08);
  --max: 1140px;
  --display: "Fredoka", "Trebuchet MS", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--body);
}

/* Card colour palettes */
.pal-classic  { --c: #1f2340; --c-soft: #eef0f6; }
.pal-cherry   { --c: #e0452c; --c-soft: #ffe7e0; }
.pal-ocean    { --c: #1f6fb2; --c-soft: #e2effb; }
.pal-forest   { --c: #2b7a4b; --c-soft: #e0f2e6; }
.pal-grape    { --c: #6b3fa0; --c-soft: #efe6f9; }
.pal-blush    { --c: #d23f78; --c-soft: #fde5ef; }
.pal-sunshine { --c: #b57600; --c-soft: #fff0c7; }
.pal-pumpkin  { --c: #d0591a; --c-soft: #fde6d6; }
.pal-teal     { --c: #0d7d76; --c-soft: #d9f1ee; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); line-height: 1.65; }
a { color: var(--accent-dark); }
a:hover { text-decoration-thickness: 2px; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Header ---------- */
.site-header { background: rgba(255, 255, 255, 0.92); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; backdrop-filter: saturate(1.4) blur(8px); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; min-height: 64px; flex-wrap: wrap; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 1.35rem; color: var(--ink); text-decoration: none; }
.logo svg { width: 34px; height: 34px; flex: none; }
.logo b { color: var(--accent); font-weight: 700; }
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.93rem; padding: 6px 12px; border-radius: 999px; }
.site-nav a:hover { background: #f6eee3; color: var(--ink); }
.site-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-dark); }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 28px 0 96px; border-image: linear-gradient(160deg, #ffe3d6 0%, #fff4e3 55%, #fff9f2 100%) fill 0 / 0 / 0 100vw; overflow: hidden; }
.hero-inner { position: relative; z-index: 1; max-width: 700px; }
.breadcrumb { font-size: 0.88rem; color: var(--muted); margin: 0 0 8px; }
.breadcrumb a { color: var(--muted); }
h1, h2, h3, .display { font-family: var(--display); font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); line-height: 1.05; margin: 12px 0 14px; }
h1 em { font-style: normal; color: var(--accent); }
.lead { font-size: 1.12rem; color: var(--muted); margin: 0 0 18px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; padding: 0; margin: 0; list-style: none; }
.chips li { background: rgba(255, 255, 255, 0.8); border: 1px solid #f1dccb; border-radius: 999px; padding: 5px 12px 5px 10px; font-size: 0.88rem; font-weight: 600; color: var(--ink); }
.chips li::before { content: "✓"; color: #2b7a4b; font-weight: 800; margin-right: 6px; }

.balls { position: absolute; inset: 0; pointer-events: none; }
.ball { position: absolute; width: var(--s, 84px); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 32% 28%, #fff 0 10%, var(--bc) 60%); box-shadow: inset -6px -8px 0 rgba(0, 0, 0, 0.12), 0 10px 24px rgba(31, 35, 64, 0.14); transform: rotate(var(--r, 0deg)); }
.ball span { width: 56%; aspect-ratio: 1; border-radius: 50%; background: #fff; display: grid; place-items: center; font-family: var(--display); font-weight: 700; color: var(--ink); font-size: calc(var(--s, 84px) * 0.22); line-height: 1; text-align: center; }
.ball small { display: block; font-size: 0.6em; color: var(--bc); }
@media (max-width: 1180px) { .ball:last-child { display: none; } }
@media (max-width: 900px) { .balls { display: none; } }

/* ---------- Generator ---------- */
.tool { position: relative; z-index: 2; margin-top: -64px; display: grid; gap: 20px; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); align-items: start; }
@media (max-width: 900px) { .tool { grid-template-columns: minmax(0, 1fr); } }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.step { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 600; font-size: 1.08rem; margin: 0 0 12px; }
.step i { font-style: normal; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; font-size: 0.85rem; }
.step-gap { border-top: 1px dashed var(--line); margin: 20px 0 16px; }

.field { margin-bottom: 14px; border: 0; padding: 0; min-width: 0; }
.field label, .field .label, .field legend { display: block; font-weight: 650; font-size: 0.9rem; margin-bottom: 6px; padding: 0; }
.hint { display: block; font-size: 0.82rem; color: var(--muted); margin-top: 5px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

input[type="text"], input[type="number"], select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: #fffdfa;
  border: 1.5px solid #e4d9ca; border-radius: 12px; padding: 10px 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="text"]:hover, input[type="number"]:hover, select:hover, textarea:hover { border-color: #d3c4b1; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
textarea { min-height: 200px; resize: vertical; line-height: 1.5; }
button:focus-visible, a:focus-visible, .swatch input:focus-visible + span { outline: 3px solid #f7a593; outline-offset: 2px; }

.check { display: flex; gap: 10px; align-items: center; font-size: 0.94rem; margin: 6px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatch span { display: block; width: 32px; height: 32px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 3px #fff, 0 0 0 1.5px #d9cfc2; transition: transform 0.12s; }
.swatch:hover span { transform: scale(1.08); }
.swatch input:checked + span { box-shadow: inset 0 0 0 3px #fff, 0 0 0 3px var(--c); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--display); font-size: 1.02rem; font-weight: 600; border-radius: 999px; padding: 11px 22px; cursor: pointer; border: 1.5px solid transparent; text-decoration: none; transition: background 0.15s, transform 0.1s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(224, 69, 44, 0.3); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { background: #fff; color: var(--ink); border-color: #e0d4c4; }
.btn-ghost:hover { background: #fbf5ec; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.btn svg { width: 18px; height: 18px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

.status { min-height: 1.4em; font-size: 0.88rem; margin: 12px 0 0; }
.status.error { color: #b02a17; font-weight: 600; }

.preview { background: var(--surface) radial-gradient(#efe6da 1px, transparent 1.4px) 0 0 / 18px 18px; }
.preview-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.preview-head h2 { margin: 0; font-size: 1.3rem; }
.count-badge { display: inline-block; font-family: var(--body); font-size: 0.82rem; font-weight: 600; color: var(--muted); background: #f6eee3; border-radius: 999px; padding: 2px 10px; margin-left: 6px; vertical-align: middle; }

/* ---------- Bingo cards ---------- */
.sheets { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.sheet { display: contents; }
.card { background: #fff; border: 3px solid var(--c); border-radius: 16px; overflow: hidden; break-inside: avoid; box-shadow: 0 6px 18px rgba(31, 35, 64, 0.08); }
.card-title { margin: 0; background: var(--c); color: #fff; text-align: center; font-family: var(--display); font-weight: 700; font-size: 1.1rem; letter-spacing: 0.04em; line-height: 1.2; padding: 9px 10px; overflow-wrap: anywhere; }
.card-body { padding: 10px; container-type: inline-size; }
.bingo-head { display: grid; grid-template-columns: repeat(5, 1fr); margin-bottom: 1.6cqi; }
.bingo-head span { width: 76%; aspect-ratio: 1; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; background: var(--c); color: #fff; font-family: var(--display); font-weight: 700; font-size: 9cqi; line-height: 1; }
.grid { display: grid; border: 2px solid var(--c); border-radius: 8px; overflow: hidden; aspect-ratio: 1 / 1; }
.cell { display: flex; align-items: center; justify-content: center; text-align: center; border: 1px solid var(--c); border-color: color-mix(in srgb, var(--c) 45%, #fff); padding: 0.8cqi; font-size: 4cqi; line-height: 1.15; overflow: hidden; overflow-wrap: normal; word-break: normal; min-width: 0; min-height: 0; color: var(--ink); }
.cell.free { flex-direction: column; gap: 0.6cqi; background: var(--c-soft); color: var(--c); font-family: var(--display); font-weight: 700; }
.cell.free .star { font-size: 1.5em; line-height: 1; }
.card-foot { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--muted); padding: 0 12px 8px; }

.caller { margin-top: 24px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.caller h2 { margin: 0 0 6px; font-size: 1.2rem; }
.caller p { margin: 0 0 12px; color: var(--muted); font-size: 0.9rem; }
.caller ol { columns: 2; column-gap: 32px; padding-left: 1.6em; margin: 0; }
.caller li { break-inside: avoid; padding: 2px 0; }
.caller li::marker { color: var(--muted); }

.empty { color: var(--muted); border: 2px dashed #e4d9ca; border-radius: 14px; padding: 40px 16px; text-align: center; background: #fff; grid-column: 1 / -1; }

/* ---------- Content ---------- */
.content { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; margin-top: 56px; }
.prose { max-width: 760px; }
.prose h2 { font-size: 1.7rem; margin: 44px 0 12px; }
.prose h3 { font-size: 1.2rem; margin: 24px 0 6px; }
.prose li { margin: 6px 0; }
.prose ol, .prose ul { padding-left: 1.3em; }
.prose li::marker { color: var(--accent); font-weight: 700; }

.word-list { list-style: none; padding: 0 !important; display: flex; flex-wrap: wrap; gap: 8px; }
.word-list li { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 0.9rem; }

.faq details { background: #fff; border: 1px solid var(--line); border-radius: 14px; margin: 10px 0; padding: 0 18px; }
.faq summary { cursor: pointer; list-style: none; font-weight: 700; padding: 14px 28px 14px 0; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 0; top: 10px; font-family: var(--display); font-size: 1.4rem; color: var(--accent); }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0 0 16px; color: var(--muted); }

.section-title { font-size: 1.7rem; margin: 56px 0 6px; }
.section-sub { color: var(--muted); margin: 0 0 18px; }
.theme-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); padding: 0; margin: 0; list-style: none; }
.theme-grid a { display: flex; gap: 12px; align-items: center; height: 100%; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px; text-decoration: none; color: var(--ink); transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s; }
.theme-grid a:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--c); }
.theme-icon { flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 1.55rem; background: var(--c-soft); }
.theme-name { display: block; font-family: var(--display); font-weight: 600; font-size: 1.05rem; line-height: 1.25; }
.theme-meta { display: block; color: var(--muted); font-size: 0.82rem; }

.page-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px 28px 28px; margin-top: 32px; }
.noscript { background: #fff6d6; border: 1px solid #e8d48a; padding: 12px 16px; border-radius: 12px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy); color: #c9cbe0; margin-top: 80px; padding: 44px 0 24px; font-size: 0.92rem; }
.site-footer .cols { display: grid; gap: 28px; grid-template-columns: 1.4fr repeat(auto-fit, minmax(160px, 1fr)); }
@media (max-width: 700px) { .site-footer .cols { grid-template-columns: 1fr 1fr; } .site-footer .cols > :first-child { grid-column: 1 / -1; } }
.site-footer h2 { color: #fff; font-size: 1.05rem; margin: 0 0 10px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin: 5px 0; }
.site-footer a { color: #c9cbe0; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.site-footer .logo { color: #fff; margin-bottom: 8px; }
.site-footer .copy { border-top: 1px solid rgba(255, 255, 255, 0.12); margin-top: 28px; padding-top: 16px; font-size: 0.85rem; }

/* ---------- Print: only the cards (and optional caller list) ---------- */
@media print {
  @page { margin: 10mm; }
  :root, body { background: #fff; }
  .no-print, .site-header, .site-footer, .preview-head, .hero, .content { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .tool { display: block; margin: 0; }
  .panel.preview { border: none; padding: 0; background: #fff; box-shadow: none; }
  .card, .card *, .caller * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  .sheets { display: block; }
  .sheet { display: flex; flex-wrap: wrap; justify-content: center; align-content: flex-start; gap: 8mm; break-after: page; page-break-after: always; }
  .sheet:last-child { break-after: auto; page-break-after: auto; }
  .card { box-shadow: none; border-width: 0.9mm; border-radius: 4mm; }
  .card-title { font-size: 15pt; padding: 2mm; }
  .card-body { padding: 2.5mm; }
  .card-foot { font-size: 7.5pt; padding: 0 3mm 1.5mm; }

  .per-1 .card { width: 180mm; }
  .per-1 .card-title { font-size: 26pt; padding: 3mm; }
  .per-2 .card { width: 92mm; }
  .per-2 .card-title { font-size: 16pt; }
  .per-4 .card { width: 88mm; }
  .per-4 .card-title { font-size: 13pt; }

  .caller { border: none; padding: 0; margin: 0; break-before: page; page-break-before: always; }
  .caller ol { columns: 3; font-size: 11pt; }
}
