.controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin: 12px 0; }
.controls label { display: flex; flex-direction: column; font-size: .95rem; }
.controls input[type=text], .controls select, textarea { padding: 6px; font: inherit; border: 1px solid var(--line); border-radius: 4px; background: var(--bg); color: var(--text); }
.controls label.check { flex-direction: row; gap: 6px; align-items: center; }
textarea { width: 100%; min-height: 150px; }
button { padding: 8px 14px; font: inherit; border-radius: 6px; border: 1px solid var(--link); background: var(--bg); color: var(--link); cursor: pointer; }
button.primary { background: var(--link); color: #fff; }
button:disabled { opacity: .5; cursor: default; }
#status { color: #b3261e; min-height: 1.4em; }
.buy a { display: inline-block; margin: 4px 10px 4px 0; padding: 9px 16px; border-radius: 6px; background: var(--link); color: #fff; text-decoration: none; font-weight: 600; }
.langs { font-size: .95rem; color: var(--subtle); }
.langs a { margin-right: 8px; }

/* The printable sheets: black on white on screen too, so the preview matches the paper. */
#sheets { margin: 20px 0; }
.sheet { background: #fff; color: #000; border: 1px solid var(--line); padding: 18px; margin-bottom: 18px; }
.sheet h2 { margin: 0 0 10px; font-size: 1.4rem; text-align: center; }
.sheet h3 { margin: 14px 0 6px; font-size: 1.1rem; }
.credit { font-size: .75rem; color: #555; text-align: center; margin: 10px 0 0; }
table.ws { border-collapse: collapse; margin: 0 auto; width: min(100%, 560px); table-layout: fixed; }
table.ws td { text-align: center; font-weight: 600; font-family: ui-monospace, Consolas, monospace; font-size: calc(min(100vw, 560px) / var(--n) * .55); line-height: 1.6; padding: 0; }
table.ws td.hit { background: #ffe08a; }
.list { columns: 3; list-style: none; padding: 0; font-size: 1.05rem; }
.list li { margin: 0 0 4px; }
.grid { display: grid; gap: 18px; justify-content: center; }
.grid.per1 { grid-template-columns: 1fr; }
.grid.per2 { grid-template-columns: 1fr; }
.grid.per4 { grid-template-columns: 1fr 1fr; }
.grid.per6 { grid-template-columns: 1fr 1fr; }
figure { margin: 0; }
figcaption { text-align: center; font-size: .85rem; margin-top: 4px; }
table.sd { border-collapse: collapse; margin: 0 auto; border: 3px solid #000; }
table.sd td { border: 1px solid #777; text-align: center; font-weight: 600; font-family: -apple-system, 'Segoe UI', Arial, sans-serif; padding: 0; }
table.sd tr:nth-child(3n) td { border-bottom: 2px solid #000; }
table.sd td:nth-child(3n) { border-right: 2px solid #000; }
table.sd.n1 td { width: 52px; height: 52px; font-size: 30px; }
table.sd.n2 td { width: 36px; height: 36px; font-size: 21px; }
table.sd.n4 td, table.sd.n6 td { width: 26px; height: 26px; font-size: 15px; }
@media (max-width: 640px) { .grid.per4, .grid.per6 { grid-template-columns: 1fr; } table.sd.n1 td { width: 34px; height: 34px; font-size: 20px; } }

@media print {
  @page { margin: 12mm; }
  body { background: #fff; }
  main > *:not(#sheets), footer { display: none !important; }
  main { max-width: none; padding: 0; }
  #sheets { margin: 0; }
  .sheet { border: 0; padding: 0; margin: 0; break-after: page; }
  .sheet:last-child { break-after: auto; }
  table.ws { width: 100%; }
  table.ws td { font-size: calc(170mm / var(--n) * .55); line-height: calc(170mm / var(--n)); }
  .list { font-size: 13pt; }
  table.sd.n1 td { width: 18mm; height: 18mm; font-size: 26pt; }
  table.sd.n2 td { width: 11mm; height: 11mm; font-size: 17pt; }
  table.sd.n4 td { width: 9mm; height: 9mm; font-size: 14pt; }
  table.sd.n6 td { width: 7.5mm; height: 7.5mm; font-size: 12pt; }
  .grid.per4, .grid.per6 { grid-template-columns: 1fr 1fr; gap: 8mm; }
}
