/* Printable puzzles (js/printable.js). Controls use the kit's chips and toggles (css/game.css).
 * The sheet is paper: always white with black ink, whatever the site theme. Sizes inside it
 * are container units (cqw), so it scales from a phone screen to A4 or US Letter. */

.pp { display: grid; grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); gap: var(--space-6); align-items: start; margin: 0 0 var(--space-7); }
.pp-controls { display: flex; flex-direction: column; gap: var(--space-5); padding: var(--space-5); border-radius: var(--radius-lg); background: var(--surface-200); border: 1px solid var(--line); position: sticky; top: var(--space-4); }
.pp-field { display: flex; flex-direction: column; gap: var(--space-2); }
.pp-label { font-weight: 500; color: var(--ink-muted); }
.pp-select { min-height: var(--tap-min); padding: 0 .8rem; border-radius: var(--radius-md); border: 1.5px solid var(--line); background: var(--surface-100); color: var(--ink); font: inherit; }
.pp-stepper { display: flex; align-items: center; gap: var(--space-2); }
.pp-step { width: var(--tap-min); height: var(--tap-min); border-radius: 50%; border: 1.5px solid var(--line); background: var(--surface-100); color: var(--ink); font: 500 1.2rem/1 var(--font-sans); cursor: pointer; }
.pp-step:hover { background: var(--fill-strong); }
.pp-n { width: 6rem; min-height: var(--tap-min); text-align: center; border-radius: var(--radius-md); border: 1.5px solid var(--line); background: var(--surface-100); color: var(--ink); font: 500 1rem var(--font-sans); }
.pp-toggles { gap: var(--space-3); }
.pp-actions { display: flex; flex-direction: column; gap: var(--space-3); }
.pp-actions .btn { width: 100%; justify-content: center; }
.pp-actions .icon { width: 1.2em; height: 1.2em; }

.pp-pages { display: flex; flex-direction: column; gap: var(--space-6); min-width: 0; }
.pp-wait { color: var(--ink-muted); padding: var(--space-6); text-align: center; }
/* the page starts with two blank sheets where the puzzle and answers will go (no jump when they arrive) */
.pp-blank { box-shadow: 0 2px 18px rgba(0, 0, 0, .18); }
.pp-pages[aria-busy] .pp-sheet { opacity: .6; transition: opacity .2s ease; }
@media print { .pp-blank { display: none !important; } }

/* ---- the paper ---- */
.pp-sheet {
  container-type: inline-size;
  width: 100%; max-width: 820px; aspect-ratio: 210 / 297; margin: 0 auto; padding: 6.5cqw 7cqw;
  display: flex; flex-direction: column; align-items: center;
  background: #fff; color: #111; border-radius: 6px; box-shadow: 0 2px 18px rgba(0, 0, 0, .35);
  font-family: var(--font-sans);
}
.pp-head { width: 100%; display: flex; justify-content: space-between; align-items: center; font-size: 1.9cqw; color: #555; border-bottom: .2cqw solid #ccc; padding-bottom: 1.4cqw; }
.pp-brand { display: inline-flex; align-items: center; gap: 1cqw; font-weight: 600; color: #111; }
.pp-brand img { width: 2.8cqw; height: 2.8cqw; }
.pp-title { margin: 3.2cqw 0 .6cqw; font-size: 4.6cqw; line-height: 1.15; font-weight: 600; text-align: center; color: #111; letter-spacing: -.01em; }
.pp-meta { margin: 0 0 3.2cqw; font-size: 2.3cqw; color: #444; text-align: center; }
.pp-fig { width: var(--pp-w, 90%); }
.pp-grid { display: block; width: 100%; height: auto; }
.pp-sub { margin: 3.4cqw 0 1.4cqw; font-size: 2.7cqw; font-weight: 600; color: #111; }
.pp-words { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2cqw 3cqw; font-size: 2.9cqw; font-weight: 500; letter-spacing: .04em; }
.pp-words li { display: flex; align-items: center; gap: 1.4cqw; }
.pp-box { flex: none; width: 2.4cqw; height: 2.4cqw; border: .25cqw solid #111; border-radius: .5cqw; }
.pp-rule { margin: 3.6cqw 0 0; font-size: 2.6cqw; color: #333; text-align: center; max-width: 80%; }
.pp-clues { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 0 4cqw; margin-top: 1cqw; }
.pp-clues ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1cqw; font-size: 2.35cqw; line-height: 1.3; }
.pp-clues li { display: grid; grid-template-columns: 4cqw 1fr; }
.pp-enum { color: #555; white-space: nowrap; }
.pp-foot { margin-top: auto; padding-top: 2.4cqw; font-size: 1.9cqw; color: #555; }

/* extra-large print: bigger words and clues (grids already fill the width) */
.pp-big .pp-words { grid-template-columns: repeat(2, 1fr); font-size: 3.6cqw; }
.pp-big .pp-clues ol { font-size: 2.9cqw; }
.pp-big .pp-meta, .pp-big .pp-rule { font-size: 2.9cqw; }

@media (max-width: 860px) {
  .pp { grid-template-columns: minmax(0, 1fr); }
  .pp-controls { position: static; }
}

/* ---- printing: only the sheets, one per page ---- */
@page { margin: 12mm; }
@media print {
  :root, html, body { background: #fff !important; color-scheme: light; }
  body > *:not(main), main > *:not(.pp), .pp > *:not(.pp-pages) { display: none !important; }
  main { padding: 0 !important; margin: 0 !important; max-width: none !important; }
  .pp { display: block; margin: 0; }
  .pp-pages { gap: 0; display: block; }
  .pp-sheet { max-width: none; aspect-ratio: auto; min-height: 0; padding: 0; box-shadow: none; border-radius: 0; overflow: visible; break-inside: auto; }
  .pp-sheet + .pp-sheet { break-before: page; }
  .pp-fig, .pp-clues li, .pp-words li { break-inside: avoid; }
}
