/* Zebra puzzle generator page. Builds on site.css and only uses its
   variables, so light and dark mode follow the visitor's setting. */

.gen-tool { margin: 0 0 32px; }

.gen-form {
  display: grid; gap: 12px; background: var(--soft2); border-radius: var(--r);
  padding: 16px; margin: 0 0 12px;
}
.gen-field label { display: block; font-weight: 800; font-size: var(--text-small); margin: 0 0 4px; }
.gen-field select {
  width: 100%; min-height: 48px; padding: 0 12px; font: inherit; font-size: var(--text-small); font-weight: 600;
  color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-small);
}
.gen-tool button { font-family: inherit; cursor: pointer; }
.gen-make { width: 100%; border: 0; }
.gen-tool button:disabled { opacity: 0.6; cursor: progress; }

.gen-status { min-height: 1.6em; margin: 0 0 8px !important; color: var(--muted); font-size: var(--text-small); }
.is-busy .gen-status::before {
  content: ''; display: inline-block; width: 14px; height: 14px; margin-right: 8px; vertical-align: -2px;
  border: 2.5px solid var(--line); border-top-color: var(--accent); border-radius: 50%;
  animation: gen-spin 0.8s linear infinite;
}
@keyframes gen-spin { to { transform: rotate(360deg); } }

.gen-puzzle h2 { margin-top: 12px; }
.gen-puzzle h2:focus { outline: none; box-shadow: none; }
.gen-intro { font-size: 19px; }

.gen-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 8px; }
.gen-actions .gen-play { grid-column: 1 / -1; }
.gen-tool .gen-btn {
  min-height: 48px; padding: 0 12px; border: 0; border-radius: var(--r-mid);
  background: var(--soft); color: var(--ink); font-weight: 700; font-size: var(--text-small);
}
.gen-tool .gen-btn:hover { background: var(--line); }
.gen-copied { grid-column: 1 / -1; min-height: 1.4em; font-size: 15px; font-weight: 700; color: var(--good); }

.gen-cats { list-style: none; padding: 0 !important; }
.gen-cats li { background: var(--soft2); border-radius: var(--r-small); padding: 8px 12px; margin: 0 0 6px !important; }
.gen-cats b { font-weight: 800; }

.gen-answer td, .gen-answer th { white-space: nowrap; }

.gen-print-only { display: none; }

@media (min-width: 600px) {
  .gen-form { grid-template-columns: 1fr 1fr; align-items: end; }
  .gen-make { grid-column: 1 / -1; width: auto; justify-self: start; }
  .gen-actions { grid-template-columns: repeat(4, auto); justify-content: start; }
  .gen-actions .gen-play { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .is-busy .gen-status::before { animation: none; }
}

/* ---------- print: only the puzzle, black on white ---------- */
@media print {
  @page { margin: 14mm; }
  :root { color-scheme: light; }
  body { background: #fff !important; color: #000 !important; font-size: 12pt; line-height: 1.4; }
  .site-head, .site-foot, .crumbs, .cta, .skip, main > h1,
  .prose > :not(.gen-tool),
  .gen-form, .gen-status, .gen-actions, .gen-screen-only { display: none !important; }
  .page { max-width: none; padding: 0; }
  .gen-tool { margin: 0; }
  .gen-print-only { display: block; }

  .gen-puzzle h2 { font-size: 20pt; margin: 0 0 4pt; color: #000; }
  .gen-puzzle h3 { font-size: 13pt; margin: 12pt 0 4pt; color: #000; }
  .gen-intro { font-size: 12pt; margin: 0 0 10pt; }

  .gen-blank table { border-collapse: collapse; width: 100%; table-layout: fixed; }
  .gen-blank th, .gen-blank td { border: 1px solid #000; padding: 4pt; vertical-align: top; text-align: left; color: #000; }
  .gen-blank thead th { font-size: 10pt; text-align: center; }
  .gen-blank thead th:first-child { width: 26%; border-top-color: transparent; border-left-color: transparent; }
  .gen-blank tbody th { font-size: 11pt; font-weight: 800; }
  .gen-blank small { display: block; font-size: 8pt; font-weight: 500; line-height: 1.3; margin-top: 2pt; }
  .gen-blank td { height: 16mm; }
  .gen-blank tr { break-inside: avoid; page-break-inside: avoid; }

  .cluelist li { background: none !important; padding: 2pt 0 !important; margin: 0 0 3pt !important; break-inside: avoid; page-break-inside: avoid; color: #000; }
  .cluelist li::before { background: none !important; color: #000; border: 1px solid #000; }

  .gen-print-answer { page-break-before: always; break-before: page; }
  .gen-print-answer .table-wrap { overflow: visible; }
  .gen-print-answer table.data { width: 100%; border-collapse: collapse; font-size: 11pt; }
  .gen-print-answer .data th, .gen-print-answer .data td { border: 1px solid #000; color: #000; padding: 4pt 6pt; white-space: normal; }
  .gen-credit { font-size: 9pt; margin-top: 12pt; color: #000; }
  a { color: #000; }
}
