/* Brooks Puzzles - daily puzzle site. No trackers, no frameworks. */
:root {
  --ink: #1d2419;
  --paper: #fdfcf8;
  --accent: #2e5e2e;
  --accent-soft: #e5efe0;
  --found: #bfe3b4;
  --answer: #ffe1a8;
  --wrong: #f6c1c1;
  --ok: #cdeac0;
  --line: #9db894;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px; line-height: 1.5;
}
header.site, footer.site {
  background: var(--accent); color: #fff; padding: 0.7rem 1rem;
}
header.site .wrap, footer.site .wrap, main { max-width: 860px; margin: 0 auto; }
header.site a { color: #fff; text-decoration: none; margin-right: 1.1rem; }
header.site .brand { font-weight: bold; font-size: 1.25rem; }
main { padding: 1rem; }
h1 { font-size: 1.7rem; margin: 0.4rem 0; }
h2 { font-size: 1.3rem; margin-top: 2rem; border-bottom: 2px solid var(--line); padding-bottom: 0.2rem; }
.daynav { display: flex; justify-content: space-between; margin: 0.6rem 0; }
.daynav a { color: var(--accent); }
button {
  font: inherit; font-size: 0.95rem; cursor: pointer;
  background: var(--accent); color: #fff; border: none; border-radius: 6px;
  padding: 0.45rem 0.9rem; margin: 0.25rem 0.25rem 0.25rem 0;
}
button.secondary { background: #fff; color: var(--accent); border: 2px solid var(--accent); }
button:disabled { background: #b9b9b9; cursor: not-allowed; }
.hint { color: #555; font-size: 0.95rem; }
.win { font-weight: bold; color: var(--accent); min-height: 1.4em; }

/* Word search */
.ws-wrap { display: flex; flex-wrap: wrap; gap: 1.2rem; align-items: flex-start; }
.ws-grid {
  display: grid; gap: 0; border: 2px solid var(--ink);
  user-select: none; -webkit-user-select: none; touch-action: none;
  background: #fff;
}
.ws-cell {
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  font-family: "Courier New", monospace; font-weight: bold; font-size: 17px;
  border: 1px solid #e2e2d8; cursor: pointer; text-transform: uppercase;
}
.ws-grid.large .ws-cell { width: 42px; height: 42px; font-size: 24px; }
.ws-cell.sel { background: #cfe0ff; }
.ws-cell.found { background: var(--found); }
.ws-cell.answer { background: var(--answer); }
.ws-words { list-style: none; padding: 0; margin: 0; columns: 2; min-width: 170px; }
.ws-words li { padding: 0.12rem 0; letter-spacing: 0.04em; }
.ws-words li.done { text-decoration: line-through; color: var(--accent); font-weight: bold; }

/* Sudoku */
.sdk-grid {
  display: grid; grid-template-columns: repeat(9, 42px); gap: 0;
  border: 3px solid var(--ink); width: max-content; background: #fff;
}
.sdk-cell {
  width: 42px; height: 42px; text-align: center; font-size: 22px; font-family: inherit;
  border: 1px solid #c9c9bd; padding: 0; border-radius: 0; background: #fff; color: #20409a;
}
.sdk-cell.given { font-weight: bold; color: var(--ink); background: #f2f2e9; }
.sdk-cell.wrong { background: var(--wrong); }
.sdk-cell.ok { background: var(--ok); }
.sdk-cell.revealed { background: var(--answer); }
.sdk-cell:nth-child(3n) { border-right: 2px solid var(--ink); }
.sdk-cell:nth-child(9n) { border-right: none; }
.sdk-grid .sdk-cell { border-bottom: 1px solid #c9c9bd; }

/* Maze */
.maze-box { background: #fff; border: 2px solid var(--ink); width: max-content; max-width: 100%; }
canvas#maze-canvas { display: block; width: 100%; height: auto; }

/* Book CTA + email */
.books, .email-box {
  background: var(--accent-soft); border: 1px solid var(--line); border-radius: 8px;
  padding: 1rem 1.2rem; margin-top: 2rem;
}
.books a { color: var(--accent); font-weight: bold; }
.email-box input {
  font: inherit; padding: 0.45rem; border: 1px solid #999; border-radius: 6px; width: 260px; max-width: 90%;
}
.email-box .soon { font-weight: bold; }

/* Answers (screen: toggled; print: always, on its own page) */
.answers { margin-top: 2rem; }
.answers .ans-grid { display: grid; gap: 0; border: 2px solid var(--ink); width: max-content; background: #fff; }
.answers .ans-cell {
  width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
  font-family: "Courier New", monospace; font-size: 13px; border: 1px solid #e2e2d8;
}
.answers .ans-cell.hit { background: var(--found); font-weight: bold; }
.answers table.sdk-ans { border-collapse: collapse; background: #fff; }
.answers table.sdk-ans td {
  width: 26px; height: 26px; text-align: center; border: 1px solid #999; font-size: 15px;
}
.screen-hidden { display: none; }

footer.site { margin-top: 3rem; font-size: 0.9rem; }

@media (max-width: 560px) {
  .sdk-grid { grid-template-columns: repeat(9, 34px); }
  .sdk-cell { width: 34px; height: 34px; font-size: 18px; }
  .ws-cell { width: 24px; height: 24px; font-size: 14px; }
  .ws-grid.large .ws-cell { width: 34px; height: 34px; font-size: 19px; }
}

@media print {
  .no-print, header.site nav, .daynav { display: none !important; }
  header.site { background: none; color: var(--ink); }
  header.site a { color: var(--ink); }
  .answers { display: block !important; page-break-before: always; }
  .screen-hidden { display: block !important; }
  .print-answers-hidden { display: block !important; }
  body { font-size: 13pt; }
  .books, .email-box { border: 1px solid #999; background: none; }
  section { page-break-inside: avoid; }
}

/* Storefront additions: landing and books pages. */
.cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin: 1rem 0; }
.card { border: 1px solid var(--line); border-radius: 8px; padding: 1rem; background: #fff; }
.card h3 { margin-top: 0; }
.playlink { font-weight: bold; color: var(--accent); font-size: 1.1rem; }
.status { color: #555; font-style: italic; }
.book { border: 1px solid var(--line); border-radius: 8px; padding: 1rem; background: #fff; margin: 1rem 0; }
.book h2 { border-bottom: none; margin-top: 0; }
