* { box-sizing: border-box; }
:root { color: #1f3044; background: #f4f6f8; font-family: -apple-system, BlinkMacSystemFont, "Yu Gothic", Meiryo, sans-serif; }
body { margin: 0; }
main, .sitebar > div { max-width: 1096px; margin: auto; padding-inline: 24px; }
.sitebar { background: white; border-bottom: 1px solid #dce1e6; }
.sitebar a { display: inline-block; padding-block: 14px; color: #233e61; text-decoration: none; font: bold 18px/1.2 Georgia, serif; }
.page-heading, .sheet-heading, .more { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.page-heading { margin: 26px 0 20px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(26px, 4vw, 36px); letter-spacing: .04em; }
.page-heading p, .more p { color: #536375; margin-top: 5px; font-size: 14px; }
button { border: 0; border-radius: 7px; padding: 12px 28px; background: #224d80; color: white; font: inherit; font-weight: bold; cursor: pointer; }
button:hover { background: #183c68; }
.settings { display: flex; flex-wrap: wrap; gap: 12px 36px; margin-bottom: 18px; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0 0 5px; color: #4c5b6b; font-size: 13px; font-weight: bold; }
.choices { display: flex; }
.choices label { position: relative; cursor: pointer; }
.choices input { position: absolute; opacity: 0; }
.choices span { display: block; min-width: 44px; text-align: center; padding: 8px 14px; background: white; border: 1px solid #aebac6; color: #344659; font-size: 14px; }
.choices label + label span { border-left: 0; }
.choices label:first-child span { border-radius: 6px 0 0 6px; }
.choices label:last-child span { border-radius: 0 6px 6px 0; }
.choices input:checked + span { background: #243c58; color: white; }
.choices input:focus-visible + span { outline: 3px solid #548fca; outline-offset: 2px; position: relative; z-index: 1; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; align-items: start; gap: 24px; }
.sheet { min-width: 0; padding: 20px clamp(14px, 3vw, 32px) 28px; background: white; border: 1px solid #d5dce3; border-radius: 8px; --board-width: 440px; }
.sheet[data-size="medium"] { --board-width: 540px; }
.sheet[data-size="large"] { --board-width: 640px; }
.sheet-heading { flex-wrap: wrap; row-gap: 4px; border-bottom: 1px solid #dce1e6; padding-bottom: 12px; margin-bottom: 20px; }
.sheet-heading h2 { flex: none; white-space: nowrap; font-size: 17px; }
.sheet-heading > span { flex: none; white-space: nowrap; margin-inline-start: auto; color: #596675; font-size: 13px; }
.board-frame { width: min(100%, var(--board-width)); margin: auto; }
.sudoku-sheet-board {
  --cell-line: 1px; --box-line: 3px;
  display: block; width: 100%; height: auto; border: var(--box-line) solid #253345;
  font: 54px Arial, sans-serif; text-anchor: middle; fill: #192639;
}
[data-lines="thin"] .sudoku-sheet-board { --box-line: 2px; }
[data-lines="bold"] .sudoku-sheet-board { --cell-line: 2px; --box-line: 4px; }
.cell-line { stroke: #919ba6; stroke-width: var(--cell-line); }
.box-line { stroke: #253345; stroke-width: var(--box-line); }
.sudoku-sheet-board .given { font-weight: bold; }
[data-lines="thin"] .given { font-weight: normal; }
.answer, .notes, .paper-footer { display: none; }
[data-mode="answer"] .answer { display: inline; fill: #0000ff; font-style: italic; }
[data-mode="notes"] .notes { display: inline; font-size: 21px; fill: #495765; }
.ad { min-width: 0; text-align: center; }
.ad > span { display: block; padding: 5px 0 8px; color: #657181; font-size: 11px; }
.more { border-left: 3px solid #7594b5; padding: 12px 18px; margin: 22px 0; background: #eaf0f6; }
.more h2, .related h2 { font-size: 17px; }
a { color: #244f7e; text-underline-offset: 3px; }
.more a { font-size: 14px; font-weight: bold; }
.related { margin: 26px 0; }
.related table { border-spacing: 8px 2px; width: min(100%, 520px); table-layout: fixed; font-size: 13px; margin-top: 10px; }
.related img { width: 100%; max-width: 88px; height: auto; }
@media (max-width: 790px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .sheet { width: 100%; }
}
@media (max-width: 560px) {
  main, .sitebar > div { padding-inline: 14px; }
  .page-heading { margin-block: 18px; }
  button { padding: 11px 16px; }
  .settings { gap: 10px 16px; }
  .choices span { padding: 8px 9px; }
  .sheet { padding: 14px 10px; }
  .sheet-heading { padding-bottom: 9px; margin-bottom: 12px; }
  .sheet-heading > span { font-size: 11px; }
  .more { flex-direction: column; align-items: flex-start; }
}
@page { size: A4 portrait; margin: 16mm; }
@media print {
  :root, body { color: black; background: white; }
  html, body { margin: 0 !important; padding: 0 !important; height: auto !important; min-height: 0 !important; }
  /* Auto ads can insert wrappers outside the configured ad slot, even inside the sheet. */
  body > :not(main), main > :not(.layout), .layout > :not(#sheet),
  #sheet > :not(.sheet-heading):not(.board-frame):not(.paper-footer),
  .sheet-heading > :not(h2):not(span), .sheet-heading h2 > :not(#mode-title),
  .board-frame > :not(svg), .paper-footer > :not(br):not(a),
  iframe, ins.adsbygoogle, .google-auto-placed {
    display: none !important; position: fixed !important; visibility: hidden !important; clip-path: inset(100%) !important;
  }
  main, .layout { display: block; max-width: none; padding: 0; }
  .sheet { padding: 0; border: 0; break-inside: avoid; page-break-inside: avoid; --board-width: 112mm; }
  .sheet[data-size="medium"] { --board-width: 144mm; }
  .sheet[data-size="large"] { --board-width: 172mm; }
  .sheet-heading { margin: 0 0 9mm; padding: 0 0 3mm; }
  .sheet-heading h2 { font-size: 15pt; }
  .sheet-heading > span { color: black; font-size: 10pt; }
  .board-frame { width: var(--board-width); break-inside: avoid; }
  .sudoku-sheet-board { border-color: black; }
  .paper-footer { display: block; margin-top: 7mm; color: #444; font-size: 9pt; line-height: 1.7; text-align: center; }
  .paper-footer a { color: inherit; text-decoration: none; }
}
