/* Printable puzzles. Screen: the controls and an A4-shaped preview of each sheet. Print: only the sheets, one per A4 page,
   with no site header, menu, footer or advertisement. Shared styles are in puzzles/assets/puzzles.css. This file is loaded
   by printable puzzle pages only, because @page applies to the whole document. */

.pz-maker-controls { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px 22px; }
.pz-check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--text-primary, #E6EDF3); cursor: pointer; }
.pz-check input { width: 18px; height: 18px; accent-color: #D32F2F; }
.pz-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.pz-status { grid-column: 1 / -1; min-height: 1.4em; margin: 0; font-size: 0.9rem; }

/* A4 preview: the sheet keeps the A4 ratio, so drawing the puzzle never shifts the page. */
.pz-print { display: flex; flex-direction: column; align-items: center; gap: 18px; margin: 8px 0 24px; }
.pz-sheet { box-sizing: border-box; display: flex; flex-direction: column; align-items: center; width: min(100%, 600px); aspect-ratio: 210 / 297;
    padding: 6% 7%; border-radius: 4px; background: #fff; color: #111; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5); font-family: Inter, Arial, Helvetica, sans-serif; }
.pz-sheet-head { display: flex; justify-content: space-between; align-items: baseline; width: 100%; padding-bottom: 2%; border-bottom: 2px solid #111; font-size: clamp(0.85rem, 2.6vw, 1.25rem); }
.pz-sheet-head span { color: #4b5563; font-size: 0.8em; }
.pz-sheet-fields { display: flex; gap: 8%; width: 100%; margin: 3% 0 5%; color: #4b5563; font-size: clamp(0.7rem, 2vw, 0.95rem); }
.pz-sheet-fields span { flex: 1; padding-bottom: 2px; border-bottom: 1px solid #9ca3af; }
.pz-sheet-rule { margin: 5% 0 0; color: #374151; font-size: clamp(0.68rem, 1.9vw, 0.92rem); line-height: 1.45; text-align: center; }
.pz-sheet-foot { margin-top: auto; padding-top: 3%; color: #6b7280; font-size: clamp(0.6rem, 1.6vw, 0.78rem); }
.pz-answer-sheet:not(.is-shown) { display: none; }
.pz-printable:not(.is-ready) .pz-answer-toggle { visibility: hidden; }

@media (max-width: 760px) {
    .pz-maker-controls { grid-template-columns: 1fr; }
    .pz-levels { justify-self: start; }
    .pz-actions { justify-content: stretch; }
    .pz-actions .pz-btn { flex: 1; }
}

/* A4 paper. Top level: Chromium ignores @page nested inside @media print. */
@page { size: A4 portrait; margin: 12mm; }

@media print {
    html, body { background: #fff !important; color: #000 !important; }
    /* Only the puzzle sheets print: everything else on the page (header, menu, breadcrumb, ads, footer, share
       buttons, Auto ads placed anywhere) is hidden at every level above the sheets. */
    body > *:not(main) { display: none !important; }
    .pz-printable { max-width: none; margin: 0; padding: 0; }
    .pz-printable > *:not(.pz-print), .pz-print > *:not(.pz-sheet) { display: none !important; }
    .pz-print { display: block; margin: 0; }
    .pz-sheet { width: 100%; height: 268mm; aspect-ratio: auto; padding: 4mm 6mm; margin: 0; border-radius: 0; box-shadow: none; break-after: page; page-break-after: always; }
    .pz-sheet:last-child { break-after: auto; page-break-after: auto; }
    .pz-sheet-head { font-size: 16pt; }
    .pz-sheet-fields { font-size: 11pt; }
    .pz-sheet-rule { font-size: 11pt; }
    .pz-sheet-foot { font-size: 9pt; }
    .pz-answer-sheet, .pz-answer-sheet:not(.is-shown) { display: flex !important; }
    .pz-printable.pz-no-answers .pz-answer-sheet { display: none !important; }
    .pz-printable.pz-no-answers .pz-sheet:first-child { break-after: auto; page-break-after: auto; }
}

/* The sheet is paper: dark ink on white, on screen and in print. tool-dark.css colours every p, span and label of a tool
   page light with !important, so these need the same weight and a more specific selector. */
.pz .pz-sheet strong { color: #111 !important; }
.pz .pz-sheet-head span, .pz .pz-sheet-fields span { color: #4b5563 !important; }
.pz .pz-sheet p.pz-sheet-rule { color: #374151 !important; }
.pz .pz-sheet .pz-sheet-foot { color: #6b7280 !important; }
