/* Puzzles to print (/nanpure/print/…): calm on the screen, nothing but the grid on paper. */
:root {
  --bg: #f6f5f2;
  --surface: #fff;
  --ink: #1e222a;
  --muted: #6b6e78;
  --line: #c9c6bf;
  --accent: #ff8a5c;
  --answer: #2b8ad2;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17181c;
    --surface: #212228;
    --ink: #ecebe8;
    --muted: #a3a5ad;
    --line: #4a4b52;
    --answer: #7cc4f7;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.8 "Noto Sans JP", system-ui, sans-serif; }
main { max-width: 760px; margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 16px 64px; }
a { color: var(--accent); }
.crumbs { font-size: 13px; font-weight: 700; color: var(--muted); }
.crumbs a { color: inherit; text-decoration: none; }
h1 { margin: 12px 0 4px; font-size: 25px; line-height: 1.4; }
h2 { margin: 0 0 6px; font-size: 19px; }
h2 small { margin-left: 10px; color: var(--muted); font-size: 13px; }
h2 a { color: var(--ink); text-decoration: none; }
.lead { margin: 0 0 12px; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; }
.print, .play { display: inline-flex; align-items: center; min-height: 46px; padding: 0 20px; border: 0; border-radius: 14px; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.print { background: var(--accent); color: #fff; }
.play { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgb(0 0 0 / 0.1); }
.sheet { padding: 18px; border-radius: 18px; background: var(--surface); }
.sheet-title { display: flex; justify-content: space-between; gap: 10px; margin: 0 0 12px; font-weight: 700; }
.sheet-site { color: var(--muted); font-size: 12px; font-weight: 400; }
.rule { margin: 12px 0 0; color: var(--muted); font-size: 13px; text-align: center; }
.board { display: grid; grid-template-columns: repeat(9, 1fr); grid-template-rows: repeat(9, 1fr); width: min(100%, 540px); aspect-ratio: 1; margin: 0 auto; border: 3px solid var(--ink); background: var(--surface); }
.board span { display: grid; place-items: center; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: clamp(18px, 5.4vw, 30px); font-weight: 700; }
.board span:nth-child(3n) { border-right: 2px solid var(--ink); }
.board span:nth-child(9n) { border-right: 0; }
.board span:nth-child(n + 19):nth-child(-n + 27), .board span:nth-child(n + 46):nth-child(-n + 54) { border-bottom: 2px solid var(--ink); }
.board span:nth-child(n + 73) { border-bottom: 0; }
.board .a { color: var(--answer); font-weight: 400; }
.board.small { width: min(100%, 320px); }
.board.small span { font-size: clamp(13px, 3.6vw, 18px); }
.answer-screen { margin: 14px 0; padding: 12px 18px; border-radius: 14px; background: var(--surface); }
.answer-screen summary { font-weight: 700; cursor: pointer; }
.answer-screen .board { margin-top: 12px; }
.answer-print { display: none; }
.pager { display: flex; justify-content: space-between; gap: 10px; margin: 18px 0 10px; font-weight: 700; }
.levels { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.levels a, .levels b { padding: 6px 14px; border-radius: 999px; background: var(--surface); font-size: 14px; text-decoration: none; }
.levels b { background: var(--ink); color: var(--bg); }
.numbers { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; margin: 12px 0; }
.numbers a { display: grid; place-items: center; min-height: 40px; border-radius: 10px; background: var(--surface); color: var(--ink); font-weight: 700; text-decoration: none; }
.numbers a:hover { color: var(--accent); }
.numbers .all { grid-column: span 3; color: var(--accent); }
.grade, .howto { margin-top: 18px; padding: 18px 20px; border-radius: 18px; background: var(--surface); }
.grade .numbers a { background: var(--bg); }
.more { color: var(--muted); font-size: 14px; }
.about, .today, .all, .faq { margin-top: 18px; padding: 18px 20px; border-radius: 18px; background: var(--surface); }
.today .sheet, .today .answer-screen { padding: 0; background: none; }
.about ul { margin: 0; padding-left: 1.3em; }
h3 { margin: 12px 0 4px; font-size: 16px; }
.note { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.all .numbers a, .today-card { background: var(--bg); }
.today-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.today-card { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 14px; color: var(--ink); text-decoration: none; }
.today-card span { color: var(--accent); font-size: 13px; font-weight: 700; }
.board.mini { width: 100%; border-width: 2px; }
.board.mini span { color: var(--ink); font-size: 11px; }
h1 small { display: block; color: var(--muted); font-size: 15px; }
.faq details { padding: 10px 0; border-top: 1px solid var(--line); }
.faq summary { font-weight: 700; cursor: pointer; }
.faq p { margin: 6px 0 0; color: var(--muted); }
footer { margin-top: 30px; color: var(--muted); font-size: 13px; text-align: center; }
footer a { color: inherit; }

/* On paper: the puzzle large on the first sheet, its answer on the second, nothing else. */
@media print {
  @page { size: A4; margin: 16mm; }
  :root { --ink: #000; --line: #888; --answer: #444; }
  body { background: #fff; color: #000; }
  main { max-width: none; padding: 0; }
  .crumbs, .head, .answer-screen, .pager, .levels, .more, footer, .numbers, .grade, .howto, .about, .all, .faq, .actions, .today > h2, .today > .note, .today-cards { display: none !important; }
  .today { margin: 0; padding: 0; background: none; }
  .sheet { padding: 0; border-radius: 0; background: none; }
  .sheet-title { font-size: 14pt; }
  .sheet-site { font-size: 9pt; color: #666; }
  .board { width: 170mm; border-width: 3px; }
  .board span { font-size: 22pt; }
  .answer-print { display: block; break-before: page; }
  .board.small { width: 110mm; }
  .board.small span { font-size: 13pt; }
  .rule { color: #444; }
}
