/* Checkmutt site. Light theme matching reference.png. */
:root {
  --bg: #ffffff;
  --ink: #1d1d1f;
  --ink-2: #55565c;
  --red: #e8372c;
  --red-dark: #c92a20;
  --cream: #fdf5e2;
  --blue: #e6f1fb;
  --yellow: #ffe45c;
  --sq-light: #ffffff;
  --sq-dark: #e4e4e4;
  --glow: #ffd84d;
  --ok: #1f9d55;
  --radius: 28px;
  --pad: 46px;
  --gutter: 40px;
  --hand: "Patrick Hand", "Comic Sans MS", "Chalkboard SE", cursive;
  --body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 18px/1.5 var(--body); overflow-x: hidden; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3, p, ul { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #2563eb; outline-offset: 3px; border-radius: 6px; }

.wrap { width: 100%; max-width: calc(1024px - 2 * var(--gutter) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }
main { outline: none; }

/* ---------- Type ---------- */
.hand { font-family: var(--hand); font-weight: 400; letter-spacing: .005em; -webkit-text-stroke: .6px currentColor; }
.h-lg { font-size: 48px; line-height: 1.04; }
.h-md { font-size: 38px; line-height: 1.1; }
.label { display: flex; align-items: center; gap: 12px; color: var(--red); font: 800 17px/1 var(--body); letter-spacing: .09em; text-transform: uppercase; }
.label .cal { width: 30px; height: 30px; }
.body-copy, .lede, .sub { color: var(--ink-2); font-size: 18px; line-height: 1.5; }
.text-link { color: var(--ink-2); font-size: 15px; font-weight: 600; text-decoration: none; }
.text-link:hover { color: var(--ink); text-decoration: underline; }
.tag { display: inline-block; background: var(--yellow); color: var(--ink); font: 700 12px/1 var(--body); letter-spacing: .06em; text-transform: uppercase; padding: 5px 9px; border-radius: 99px; vertical-align: middle; }

/* ---------- Buttons ---------- */
.btn-row { display: flex; flex-wrap: wrap; gap: 18px; }
.pill { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 56px; padding: 0 28px;
  border-radius: 999px; border: 2px solid transparent; font: 400 20px/1 var(--hand); text-decoration: none; cursor: pointer;
  transition: transform .12s ease, background-color .12s ease, box-shadow .12s ease; }
.pill-red { background: var(--red); color: #fff; box-shadow: 0 3px 0 rgba(0,0,0,.06); }
.pill-red:hover { background: var(--red-dark); }
.pill-outline { background: #fff; color: var(--ink); border-color: var(--ink); }
.pill-outline:hover { background: #f5f5f5; }
.pill-black { background: var(--ink); color: #fff; }
.pill-sm { min-height: 42px; padding: 0 23px; font-size: 18px; }
.pill-lg { min-height: 60px; padding: 0 44px; font-size: 22px; }
.pill:active { transform: translateY(1px); }
.pill .apple { width: 19px; height: 22px; margin-top: -3px; }
.pill.soon { cursor: default; }
.pill.soon::after { content: "coming soon"; position: absolute; top: -10px; right: 10px; background: var(--yellow); color: var(--ink);
  font: 800 10px/1 var(--body); letter-spacing: .06em; text-transform: uppercase; padding: 4px 7px; border-radius: 99px; border: 1.5px solid var(--ink); }
@media (prefers-reduced-motion: reduce) { .pill { transition: none; } }

/* ---------- Nav ---------- */
.nav { background: #fff; position: relative; z-index: 5; }
.nav-row { display: flex; align-items: center; height: 70px; gap: 24px; }
.nav-logo img { width: 234px; }
.nav-links { display: flex; gap: 37px; margin: 0 auto; padding-left: 50px; }
.nav-links a { position: relative; font: 400 17px/1 var(--hand); text-decoration: none; padding: 10px 0; }
.nav-links a.active::after { content: ""; position: absolute; left: -2px; right: -2px; bottom: -4px; height: 3px; border-radius: 3px; background: var(--red); }
.nav-links a:hover { color: var(--red); }
.menu-btn { display: none; }

/* ---------- Hero ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 470px) 1fr; align-items: start; padding-top: 30px; }
.hero-copy { position: relative; z-index: 1; }
.hero-logo { margin: 0 0 12px -6px; }
.hero-logo img { width: 492px; max-width: none; }
.hero-copy .lede { margin: 0 0 32px 40px; max-width: 390px; }
.hero-copy .btn-row { margin-left: 39px; }
.hero-art { margin: 0 calc(-1 * var(--gutter)) 0 -30px; }
.hero-art img { width: 100%; }

/* ---------- Panels ---------- */
.panel { border-radius: var(--radius); padding: var(--pad); }
.panel-cream { background: var(--cream); }
.panel-blue { background: var(--blue); }

.today { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; align-items: center; margin-top: -6px; padding: 40px 48px 36px; border-radius: 20px; }
.today .label { margin-bottom: 20px; }
.today h2 { max-width: 330px; margin-bottom: 18px; }
.today .body-copy { max-width: 330px; margin-bottom: 20px; }
.today .pill-lg { margin-bottom: 22px; }
.today-board { display: block; text-decoration: none; color: inherit; border-radius: 8px; }
.today-board:hover .board { transform: rotate(-.4deg) scale(1.01); }
@media (prefers-reduced-motion: reduce) { .today-board:hover .board { transform: none; } }

/* ---------- Witnesses ---------- */
.witnesses { padding-top: 30px; }
.witnesses .sub { margin: 4px 0 20px; }
.cast { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; text-align: center; }
.cast img { width: 110px; margin: 0 auto 6px; }
.cast strong { display: block; font: 400 21px/1.2 var(--hand); -webkit-text-stroke: .4px currentColor; }
.cast em { display: block; font-style: normal; color: var(--red); font-size: 14px; font-weight: 700; margin-top: 2px; }
.cast span { display: block; color: var(--ink-2); font-size: 15px; line-height: 1.3; max-width: 100px; margin: 4px auto 0; }

/* ---------- Books ---------- */
.books { display: grid; gap: 36px; margin-top: 34px; }
.book { display: grid; grid-template-columns: 300px 1fr; gap: 46px; align-items: center; padding: 0 46px 0 70px; min-height: 290px; }
.book-cover { align-self: start; margin-top: -12px; margin-bottom: -60px; }
.book-cover img { width: 258px; transform: rotate(-3.5deg); border-radius: 4px 8px 8px 4px;
  box-shadow: 0 18px 30px -12px rgba(30, 40, 70, .35), 0 4px 10px rgba(30, 40, 70, .15); }
.book-copy { padding: 42px 0; }
.book-copy .label { margin-bottom: 14px; font-size: 15px; }
.book-copy h2 { font-size: 36px; margin-bottom: 16px; }
.book-copy .body-copy { margin-bottom: 22px; }
.book-copy .pill { min-height: 50px; font-size: 19px; }

/* ---------- Game ---------- */
#game { margin-top: 90px; scroll-margin-top: 20px; }
#books { scroll-margin-top: 30px; }
.game { display: grid; grid-template-columns: 1fr auto; gap: 30px; align-items: center; }
.game .label { margin-bottom: 14px; }
.game h2 { margin-bottom: 18px; }
.ticks { list-style: none; padding: 0; margin-bottom: 26px; display: grid; gap: 8px; }
.ticks li { position: relative; padding-left: 32px; color: var(--ink-2); font-size: 18px; }
.ticks li::before { content: "✓"; position: absolute; left: 0; top: -1px; color: var(--red); font: 400 24px/1 var(--hand); }
.game-art { display: flex; align-items: flex-end; }
.game-art img { width: 150px; }
.game-art img + img { margin-left: -24px; width: 130px; }

/* ---------- How to Play ---------- */
.how { padding-top: 70px; scroll-margin-top: 10px; }
.how h2 { margin-bottom: 18px; }
.steps { list-style: none; padding: 0; counter-reset: step; display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.steps li { counter-increment: step; background: var(--cream); border-radius: 20px; padding: 20px 20px 22px; color: var(--ink-2); font-size: 16px; line-height: 1.45; }
.steps li::before { content: counter(step); display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; margin-bottom: 10px;
  border-radius: 99px; border: 2px solid var(--ink); background: #fff; color: var(--ink); font: 400 20px/1 var(--hand); }
.steps strong { color: var(--ink); }
.steps .r-mark, .steps .x-inline { display: inline-block; width: 22px; height: 22px; vertical-align: -5px; }
.steps .x-inline { color: var(--red); }
.grass-note { margin-top: 18px; display: flex; gap: 14px; align-items: center; background: var(--blue); border-radius: 20px; padding: 14px 20px; color: var(--ink-2); }
.grass-note img { width: 56px; flex: none; }
.grass-note strong { color: var(--ink); }

/* ---------- About / footer ---------- */
.about { padding-top: 70px; padding-bottom: 70px; max-width: 820px; scroll-margin-top: 10px; }
.about h2 { margin-bottom: 14px; }
.about .body-copy + .body-copy { margin-top: 12px; }
.footer { border-top: 1px solid #ececec; padding: 26px 0 34px; }
.footer-row { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.footer-row img { width: 156px; }
.footer-row p { color: var(--ink-2); font-size: 14px; margin-right: auto; }

/* ---------- Board ---------- */
.board { --cell: 70px; display: grid; grid-template-columns: 26px repeat(var(--n), var(--cell)); grid-template-rows: 26px repeat(var(--n), var(--cell));
  width: max-content; margin: 0 auto; transition: transform .15s ease; }
.board.n6 { --cell: 58px; }
.board .corner { grid-column: 1; grid-row: 1; }
.col-l, .row-l { display: flex; align-items: center; justify-content: center; font: 400 17px/1 var(--hand); color: var(--ink); }
.col-l { align-items: flex-start; }
.row-l { justify-content: flex-start; }
.cell { position: relative; display: flex; align-items: center; justify-content: center; margin: 0; padding: 0; border: 0; font: inherit; color: inherit;
  box-shadow: inset 0 0 0 .5px #1d1d1f, 0 0 0 .5px #1d1d1f; }
.cell.light { background: var(--sq-light); }
.cell.dark { background: var(--sq-dark); }
.cell > img { width: 72%; pointer-events: none; }
.cell.witness > img { width: 64%; transform: translate(-12%, -8%); }
.cell.tree > img { width: 62%; }
.badge { position: absolute; right: 7%; bottom: 7%; min-width: 27px; height: 27px; padding: 0 4px; border-radius: 99px; background: #fff; border: 2px solid var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 1px; font: 400 18px/1 var(--hand); -webkit-text-stroke: .3px currentColor; }
.badge i { font-style: normal; font-size: 13px; }
.badge.ok { background: var(--ok); border-color: #146b39; color: #fff; }
.badge.over { background: var(--red); border-color: #8f1b14; color: #fff; }
.x-mark { width: 58%; color: var(--red); }
.cell.bandit > img { width: 78%; }
/* Bandit mark while solving: pencil R in a circle. Raccoons appear only on the win. */
.r-mark { width: 62%; color: #3f4046; }
.cell.revealing > * { grid-area: 1 / 1; }
.cell.revealing { display: grid; place-items: center; }
.cell.revealing > .r-mark { width: 62%; animation: r-out .2s ease-in both; animation-delay: calc(var(--i, 0) * 260ms + 150ms); }
.cell.revealing > .raccoon { width: 78%; animation: pop-in .5s cubic-bezier(.2, 1.7, .45, 1) both; animation-delay: calc(var(--i, 0) * 260ms + 150ms); }
@keyframes r-out { to { opacity: 0; transform: scale(.4); } }
@keyframes pop-in { 0% { opacity: 0; transform: scale(0) rotate(-14deg); } 100% { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .cell.revealing > .r-mark { display: none; }
  .cell.revealing > .raccoon { animation: none; }
}

.board.is-live .cell { cursor: pointer; }
.board.is-live .cell.tree { cursor: default; }
.board.is-live .cell.open:hover { filter: brightness(.96); }
.cell.glow { background: #fff2b3; box-shadow: inset 0 0 0 .5px #1d1d1f, inset 0 0 0 5px var(--glow), 0 0 0 .5px #1d1d1f; }
.cell.witness.focused { background: #fff7d1; }
.cell.witness.focused::after { content: ""; position: absolute; inset: 4px; border: 3px dashed #d9a400; border-radius: 10px; pointer-events: none; }
.cell.wrong::after { content: ""; position: absolute; inset: 3px; border: 4px solid var(--red); border-radius: 8px; pointer-events: none; }
.cell.hinted::before { content: ""; position: absolute; inset: 3px; border: 4px dotted #2563eb; border-radius: 8px; pointer-events: none; }
.cell:focus-visible { outline: 3px solid #2563eb; outline-offset: -3px; border-radius: 2px; z-index: 1; }
/* Outer frame */
.board { position: relative; }
.board::after { content: ""; position: absolute; left: 26px; top: 26px; right: 0; bottom: 0; border: 3px solid var(--ink); pointer-events: none; }

/* ---------- Play page ---------- */
.play { padding-top: 20px; padding-bottom: 60px; }
.play-head { margin-bottom: 24px; }
.play-head .label { margin-bottom: 10px; }
.play-head .tag { margin-left: 6px; }
.play-grid { display: grid; grid-template-columns: auto 1fr; gap: 44px; align-items: start; }
.play-board { background: var(--cream); border-radius: var(--radius); padding: 30px 34px 28px; }
.play-board .board { --cell: 84px; }
.play-board .board.n6 { --cell: 72px; }
.play-board.solved { background: #e5f6ea; }
.counter { text-align: center; margin: 18px 0 14px; font: 400 22px/1 var(--hand); }
.controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.controls .pill { min-height: 48px; padding: 0 22px; font-size: 19px; }
.notes { background: var(--blue); border-radius: 20px; padding: 22px 24px; margin-bottom: 22px; min-height: 120px; }
.notes h2, .legend h2 { font-size: 26px; margin-bottom: 8px; }
.notes p { font-size: 17px; }
.legend ul { list-style: none; padding: 0; display: grid; gap: 12px; }
.legend li { display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: start; }
.legend strong { font: 400 19px/1.2 var(--hand); }
.legend .kind { color: var(--ink-2); font-size: 14px; font-weight: 700; margin-left: 2px; }
.legend .piece { color: var(--red); font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; margin-left: 4px; }
.legend li p { color: var(--ink-2); font-size: 15px; line-height: 1.4; }
.legend-foot { color: var(--ink-2); font-size: 15px; margin: 14px 0 16px; }

/* ---------- Archive ---------- */
.archive { padding-top: 20px; padding-bottom: 70px; }
.archive .label { margin-bottom: 10px; }
.archive .sub { margin: 6px 0 26px; }
.cards { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.card { display: flex; flex-direction: column; gap: 4px; min-height: 108px; padding: 16px 18px; border-radius: 18px; background: var(--cream); text-decoration: none; color: var(--ink); border: 2px solid transparent; }
.card:hover { border-color: var(--ink); }
.card strong { font-size: 24px; line-height: 1.1; }
.card span { color: var(--ink-2); font-size: 14px; }
.card .tag { align-self: flex-start; margin-top: 2px; font-size: 10px; color: var(--ink); }
.card .solved { color: var(--ok); font-weight: 800; }
.card.today { background: var(--red); color: #fff; }
.card.today span, .card.today .solved { color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .nav-links { gap: 24px; padding-left: 0; }
  .hero-logo img { width: 100%; max-width: 492px; }
  .play-grid { grid-template-columns: 1fr; }
  .play-board { justify-self: center; }
}
@media (max-width: 820px) {
  :root { --gutter: 20px; --pad: 28px; }
  .nav-row { flex-wrap: wrap; height: auto; padding-top: 12px; padding-bottom: 12px; gap: 12px; }
  .nav-logo img { width: 170px; }
  .menu-btn { display: inline-flex; margin-left: auto; align-items: center; min-height: 40px; padding: 0 16px; border: 2px solid var(--ink); border-radius: 99px; background: #fff; font: 400 18px/1 var(--hand); cursor: pointer; }
  .nav-cta { display: none; }
  .nav-links { display: none; order: 3; width: 100%; flex-direction: column; gap: 0; margin: 0; }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 4px; font-size: 20px; border-top: 1px solid #eee; }
  .nav-links a.active::after { left: 4px; right: auto; width: 40px; bottom: 6px; }
  .hero { grid-template-columns: 1fr; padding-top: 10px; }
  .hero-logo { margin: 0 auto 10px; max-width: 492px; }
  .hero-copy .lede, .hero-copy .btn-row { margin-left: 0; }
  .hero-art { margin: 20px calc(-1 * var(--gutter)) 0; }
  .today { grid-template-columns: 1fr; padding: 28px 22px; margin-top: 10px; }
  .today h2, .today .body-copy { max-width: none; }
  .h-lg { font-size: 40px; }
  .h-md { font-size: 32px; }
  .cast { grid-template-columns: repeat(3, 1fr); row-gap: 22px; }
  .steps { grid-template-columns: 1fr 1fr; }
  .how { padding-top: 44px; }
  .book { grid-template-columns: 1fr; padding: 28px 22px; gap: 10px; }
  .book-cover { margin: -40px auto 0; }
  .book-cover img { width: 200px; }
  .book-copy { padding: 10px 0 0; }
  .game { grid-template-columns: 1fr; }
  .game-art { display: none; }
  #game { margin-top: 40px; }
  .board { --cell: min(62px, calc((100vw - 2 * var(--gutter) - 2 * 22px - 26px) / var(--n))); }
  .board.n6 { --cell: min(54px, calc((100vw - 2 * var(--gutter) - 2 * 22px - 26px) / var(--n))); }
  .play-board { padding: 18px 12px 20px; width: 100%; }
  .play-board .board, .play-board .board.n6 { --cell: calc((100vw - 2 * var(--gutter) - 24px - 26px) / var(--n)); }
  .badge { min-width: 22px; height: 22px; font-size: 15px; border-width: 1.5px; }
  .controls .pill { flex: 1 1 40%; }
}
@media (max-width: 400px) {
  .steps { grid-template-columns: 1fr; }
  .pill { padding: 0 20px; font-size: 18px; }
  .pill-lg { padding: 0 26px; font-size: 20px; }
}
