/* Teatime Puzzles: larger base type and high contrast */
body { font-size: 20px; }
.btn { font-size: 1.05rem; min-height: 50px; }
.puzzle-toolbar { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: end; }
.puzzle-toolbar label.field { min-width: 170px; }
.puzzle-sheet { background: #fff; border: 1px solid var(--rule); border-radius: 12px; padding: 20px; margin: 18px 0; }
.puzzle-title { font: 700 1.6rem var(--display); text-align: center; margin: 0 0 12px; }
.answer-key { margin-top: 28px; }
.print-only { display: none; }
@media print {
  body { font-size: 14pt; }
  .puzzle-sheet { border: none; padding: 0; margin: 0; }
  .answer-key { break-before: page; page-break-before: always; }
  .print-only { display: block; }
  .no-print, .puzzle-toolbar, .btn-row { display: none !important; }
  main > h1, main > .lede, main > .prose, main > .rules, main > section:not(.puzzle-print) { display: none !important; }
}
/* Word search */
.ws-layout { display: flex; flex-wrap: wrap; gap: 24px; justify-content: center; align-items: flex-start; }
.ws-grid { --n: 12; display: grid; grid-template-columns: repeat(var(--n), 1fr); width: min(100%, 640px); border: 3px solid #111; border-radius: 6px; user-select: none; }
.ws-cell { aspect-ratio: 1; display: grid; place-items: center; font: 700 clamp(1rem, calc(48vw / var(--n)), 2.1rem) var(--sans); color: #111; background: #fff; border: none; padding: 0; cursor: pointer; }
span.ws-cell { cursor: default; }
.ws-cell.first { background: #ffd75e; }
.ws-cell.found { background: #ffe3b3; color: #8a2c0d; }
.ws-cell.ans { background: #e8e8e8; outline: 2px solid #111; outline-offset: -3px; }
.ws-words { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 28px; font: 700 1.35rem var(--sans); min-width: 240px; }
.ws-words li { padding: 3px 0; }
.ws-words li.done { text-decoration: line-through; color: #9b8f82; }
.answer-key .ws-grid { width: min(100%, 460px); margin: 0 auto; }
@media print { .ws-grid { width: 100%; max-width: 17cm; } .ws-cell { font-size: calc(200mm / var(--n) * .55); } .ws-words { font-size: 16pt; columns: 3; } .ws-layout { display: block; } .ws-words { margin-top: 12pt; } .ws-cell.found { background: #fff; color: #111; } }
/* Sudoku */
.sd-play { display: flex; flex-wrap: wrap; gap: 24px; justify-content: center; align-items: flex-start; }
.sd-grid { display: grid; grid-template-columns: repeat(9, 1fr); width: min(100%, 560px); border: 3px solid #111; background: #fff; }
.sd-cell { aspect-ratio: 1; display: grid; place-items: center; background: #fff; border-right: 1px solid #888 !important; border-bottom: 1px solid #888 !important; font: 500 clamp(1.2rem, 5vw, 2.3rem) var(--sans); color: #1d4ed8; border: none; padding: 0; position: relative; }
button.sd-cell { cursor: pointer; }
.sd-cell.given { color: #111; font-weight: 800; }
.sd-cell:nth-child(9n) { border-right: none !important; }
.sd-cell:nth-child(n+73) { border-bottom: none !important; }
.sd-cell.br { border-right: 3px solid #111 !important; }
.sd-cell.bb { border-bottom: 3px solid #111 !important; }
.sd-cell.peer { background: #f4eee4; }
.sd-cell.same { background: #ffe8b8; }
.sd-cell.sel { background: #ffd75e; }
.sd-cell.wrong { color: #c92a2a; background: #ffe0e0; }
.sd-cell.solved { color: #555; }
.sd-notes { position: absolute; inset: 2px; display: grid; grid-template-columns: repeat(3, 1fr); font: 600 clamp(.45rem, 1.3vw, .7rem) var(--sans); color: #555; }
.sd-notes i { font-style: normal; display: grid; place-items: center; }
.sd-pad { min-width: 260px; max-width: 320px; }
.sd-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sd-keys .btn { font-size: 1.6rem; min-height: 64px; }
.sd-sheet { display: grid; gap: 18px; }
.sd-sheet.per-2 { grid-template-columns: 1fr; } .sd-sheet.per-4 { grid-template-columns: 1fr 1fr; } .sd-sheet.per-6 { grid-template-columns: 1fr 1fr; }
.sd-sheet .sd-grid { width: 100%; }
.sd-sheet.per-1 .sd-grid { max-width: 18cm; margin: 0 auto; }
.sd-sheet.per-2 .sd-grid { max-width: 11cm; margin: 0 auto; }
.sd-num { font-weight: 700; margin-bottom: 4px; }
@media print {
  .sd-cell { font-size: 20pt; color: #000; }
  .sd-sheet.per-4 .sd-cell, .sd-sheet.per-6 .sd-cell { font-size: 12pt; }
  .sd-sheet.answers .sd-cell { font-size: 9pt; }
  .sd-sheet.per-6 { gap: 8pt; } .sd-sheet.per-6 .sd-grid { max-width: 8.2cm; }
}
/* Cryptoquote */
.cq-text { display: flex; flex-wrap: wrap; gap: 14px 26px; justify-content: center; padding: 10px 0; }
.cq-word { display: inline-flex; gap: 4px; }
.cq-cell { display: inline-flex; flex-direction: column; align-items: center; width: 2.1em; background: none; border: none; padding: 2px 0; font: inherit; color: inherit; cursor: pointer; border-radius: 6px; }
span.cq-cell { cursor: default; }
.cq-cell.sel { background: #ffe8b8; }
.cq-guess { font: 800 1.9rem/1.2 var(--sans); min-height: 1.2em; border-bottom: 3px solid #111; width: 100%; text-align: center; color: #8a2c0d; }
.cq-guess.wrong { color: #c92a2a; background: #ffe0e0; }
.cq-cipher { font: 600 1.2rem var(--mono); color: #4d4740; margin-top: 3px; }
.cq-punct { font: 800 1.9rem var(--sans); align-self: flex-start; }
.cq-author { text-align: center; font: italic 1.3rem var(--display); }
.cq-keys { display: grid; grid-template-columns: repeat(13, 1fr); gap: 5px; margin: 16px 0 10px; }
.cq-keys .btn { padding: 4px 0; min-height: 48px; font-size: 1.15rem; }
@media (max-width: 640px) { .cq-keys { grid-template-columns: repeat(7, 1fr); } .cq-cell { width: 1.7em; } .cq-guess, .cq-punct { font-size: 1.5rem; } }
.cq-solution { font: 1.3rem var(--display); text-align: center; }
@media print { .cq-guess { color: #000; } .cq-cell.sel { background: none; } }
/* Crossword */
.xw-layout { display: flex; flex-wrap: wrap; gap: 26px; align-items: flex-start; justify-content: center; }
.xw-grid { --w: 13; display: grid; grid-template-columns: repeat(var(--w), 1fr); width: calc(var(--w) * 46px); max-width: calc(100vw - 72px); gap: 0; }
.xw-block { aspect-ratio: 1; }
.xw-cell { position: relative; aspect-ratio: 1; background: #fff; border: 2px solid #111; margin: -1px 0 0 -1px; padding: 0; display: grid; place-items: center; font: inherit; color: #111; cursor: pointer; }
span.xw-cell { cursor: default; }
.xw-cell small { position: absolute; top: 1px; left: 3px; font: 700 clamp(.55rem, 1.4vw, .8rem) var(--sans); }
.xw-cell b { font: 800 clamp(1rem, 3.2vw, 1.7rem) var(--sans); }
.xw-cell.word { background: #fff1d6; }
.xw-cell.cur { background: #ffd75e; }
.xw-cell.wrong b { color: #c92a2a; }
.xw-clue-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; flex: 1; min-width: 300px; }
@media (max-width: 700px) { .xw-clue-cols { grid-template-columns: 1fr; } }
.xw-clues h3 { margin-top: 0; }
.xw-clues ol { list-style: none; padding: 0; margin: 0; }
.xw-clues li { margin: 0 0 6px; font-size: 1.1rem; line-height: 1.35; }
.xw-clues li button { background: none; border: none; text-align: left; font: inherit; color: inherit; cursor: pointer; padding: 3px 4px; border-radius: 6px; }
.xw-clues li.on button { background: #fff1d6; }
.xw-current { font: 700 1.2rem var(--sans); background: #fff1d6; padding: 8px 12px; border-radius: 8px; margin-bottom: 14px; min-height: 2.2em; }
@media print { .xw-grid { width: min(100%, calc(var(--w) * 1.25cm)); } .xw-layout { display: block; } .xw-clue-cols { margin-top: 14pt; } .xw-clues li { font-size: 12.5pt; } .answer-key .xw-grid { width: calc(var(--w) * .8cm); } .xw-cell.word, .xw-cell.cur { background: #fff; } }
/* Word ladder */
.ladder { list-style: none; padding: 0; margin: 20px auto; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.rung { display: flex; flex-direction: column; align-items: center; }
.rung-word { font: 800 2.2rem var(--mono); letter-spacing: .3em; padding: 6px 18px; border: 3px solid #111; border-radius: 10px; background: #fff1d6; }
.rung-input { font: 800 2.2rem var(--mono); letter-spacing: .3em; text-transform: uppercase; text-align: center; width: 9.5ch; border: 3px solid #b9ada0; border-radius: 10px; padding: 4px; min-height: 0; }
.rung.good .rung-input { border-color: #2b8a3e; background: #ebf8ee; }
.rung.bad .rung-input { border-color: #c92a2a; background: #fff0f0; }
.rung-msg { color: #c92a2a; font-size: .95rem; font-weight: 600; }
/* Word scramble */
.scramble-list { columns: 2; column-gap: 40px; padding-left: 1.6em; font-size: 1.3rem; }
@media (max-width: 700px) { .scramble-list { columns: 1; } }
.scramble-list li { break-inside: avoid; margin-bottom: 16px; }
.scr-word { display: block; font: 800 1.7rem var(--mono); letter-spacing: .18em; }
.scr-input { font: 700 1.4rem var(--mono); letter-spacing: .12em; text-transform: uppercase; width: 100%; max-width: 14ch; }
.scramble-list li.ok .scr-input { border-color: #2b8a3e; background: #ebf8ee; }
.scr-blank { font: 1.3rem var(--mono); letter-spacing: .1em; }
.scramble-answers { columns: 3; font-size: 14pt; }
@media print { .rung-input { border: none; border-bottom: 3px solid #000; border-radius: 0; color: transparent; } .scramble-list { font-size: 16pt; } .scr-word { font-size: 20pt; } }
@page { margin: 12mm; }
@media print {
  .ws-grid, .sd-grid, .xw-grid { margin-left: auto; margin-right: auto; }
  .ws-grid { max-width: 17.5cm; }
  .cq-cipher { font-size: 15pt; }
  .cq-guess { font-size: 22pt; min-height: 1.3em; }
  .cq-text { gap: 18pt 26pt; }
  .xw-layout > div { display: block; }
}
