/* public/style.css — Bildschirmvorschau und A4-Druck
   Am Bildschirm sind die Blätter eine Vorschau auf grauem Tisch; im Druck füllt
   jedes .sheet genau eine A4-Seite ohne Browser-Ränder (@page margin 0), der
   Sicherheitsrand steckt im Padding. Ziffergrößen hängen per cqw am Raster. */

:root {
  --ink: #1d1d1b;
  --line: #1d1d1b;
  --thin: #8c8c88;
  --given-bg: #e4e4e0;
  --paper: #fff;
  --desk: #ebe9e4;
  --accent: #1f5f8b;
  --muted: #55554f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
}

.controls { max-width: 210mm; margin: 28px auto 20px; padding: 0 16px; }
h1 { font-size: 30px; margin: 0 0 6px; }
.lead { font-size: 19px; margin: 0 0 18px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }

button {
  font: inherit;
  font-size: 21px;
  padding: 12px 26px;
  border-radius: 8px;
  border: 2px solid var(--accent);
  background: var(--paper);
  color: var(--accent);
  cursor: pointer;
}
button.primary { background: var(--accent); color: #fff; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid #e0a100; outline-offset: 2px; }

.options { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; font-size: 18px; }
select { font: inherit; padding: 6px 8px; margin-left: 6px; }
.check input { width: 20px; height: 20px; margin: 0 6px 0 0; vertical-align: -3px; }
.hint { font-size: 16px; color: var(--muted); margin: 18px 0 4px; }
kbd { border: 1px solid #b9b9b3; border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--paper); font-family: inherit; }
.status { min-height: 1.3em; font-size: 16px; color: var(--muted); margin: 4px 0 0; }

.sheet {
  width: 210mm;
  height: 297mm;
  margin: 0 auto 24px;
  padding: 14mm 16mm;
  background: var(--paper);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  overflow: hidden;
}

.puzzle { width: min(var(--grid), 100%); }
.per-2 .puzzle { --grid: 118mm; }
.per-1 .puzzle { --grid: 172mm; }

.caption { display: flex; justify-content: space-between; font-size: 11pt; color: var(--muted); margin-bottom: 2.5mm; }

.grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  width: 100%;
  aspect-ratio: 1;
  border: 0.8mm solid var(--line);
  container-type: inline-size;
}
.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 0.25mm solid var(--thin);
  border-bottom: 0.25mm solid var(--thin);
  font-size: 7cqw;
  font-weight: 700;
  line-height: 1;
}
.cell.br { border-right: 0.6mm solid var(--line); }
.cell.bb { border-bottom: 0.6mm solid var(--line); }
.cell.c9 { border-right: 0; }
.cell.r9 { border-bottom: 0; }
.cell.given { background: var(--given-bg); -webkit-print-color-adjust: exact; print-color-adjust: exact; }

.solutions { justify-content: flex-start; }
.solutions h2 { align-self: flex-start; font-size: 18pt; margin: 0 0 9mm; }
.solution-list { display: grid; grid-template-columns: repeat(3, 54mm); gap: 9mm 8mm; }
.solution-list .puzzle { --grid: 54mm; }
.solution-list .caption { font-size: 9pt; margin-bottom: 1.5mm; }
.solution-list .grid { border-width: 0.6mm; }
.solution-list .cell { font-size: 6.5cqw; font-weight: 400; }
.solution-list .cell.given { font-weight: 700; }
.sheet-code { margin: auto 0 0; align-self: flex-end; font-size: 9pt; color: var(--muted); }

@page { size: A4 portrait; margin: 0; }

@media print {
  body { background: var(--paper); }
  .controls { display: none; }
  .sheet { margin: 0; box-shadow: none; break-after: page; }
  .sheet:last-child { break-after: auto; }
}

@media screen and (max-width: 860px) {
  .sheet { width: auto; height: auto; margin: 0 16px 16px; padding: 20px 16px; gap: 28px; }
  .solution-list { grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .solution-list .puzzle { --grid: 100%; }
}
