/* Cipherday: brand tokens and the cryptogram board, on top of kit/kit.css. */
:root {
  --brand: #8a2c3b; --brand-ink: #fff; --accent: #e9b44c;
  --paper: #fbf6ec; --paper-line: #e6dcc7; --cell-sel: #f6e2b3;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --paper: #1f1b17; --paper-line: #3a3229; --cell-sel: #4a3a1c; }
}
:root[data-theme="dark"] { --paper: #1f1b17; --paper-line: #3a3229; --cell-sel: #4a3a1c; }

.site-header nav { align-items: center; }
.brand { font-family: var(--font-display); font-size: 1.25rem; }

.play-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s2); margin: var(--s4) 0 var(--s3); }
.play-head h1 { font-size: var(--step-3); margin: 0; line-height: 1.15; }
.play-head .promise { margin: var(--s1) 0 0; color: var(--ink-2); font-size: var(--step-0); }
.play-meta { font-size: var(--step--1); color: var(--ink-2); display: flex; gap: var(--s3); align-items: center; }

/* The coded quote, on a paper card. Words never break across lines. */
.puzzle { background: var(--paper); border: 1px solid var(--paper-line); border-radius: var(--radius-l); padding: var(--s4) var(--s3); box-shadow: var(--shadow-1); }
.quote { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s3); justify-content: center; container-type: inline-size; }
[hidden] { display: none !important; }
.word { display: inline-flex; gap: 3px; }
/* Cells shrink so the longest word fits on one line; game.js sets --n to its length. */
.cell { display: flex; flex-direction: column; align-items: center; width: min(1.9rem, calc((100cqw - (var(--n, 10) - 1) * 3px) / var(--n, 10))); padding: 0; border: 0; background: none; color: var(--ink); font: inherit; cursor: pointer; border-radius: 6px; }
.cell .g { display: block; width: 100%; height: 2rem; line-height: 2rem; font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; text-align: center; border-bottom: 2px solid var(--ink-2); }
.cell .c { display: block; font-size: .9rem; font-weight: 600; letter-spacing: .02em; color: var(--ink); padding-top: 2px; }
.cell.same .g { background: var(--cell-sel); }
.cell.sel .g { background: var(--accent); color: #1b1606; border-bottom-color: var(--brand); }
.cell.sel .c { color: var(--ink); }
.cell.given .g { color: var(--brand-text); }
.cell.given .g::after { content: "•"; font-size: .7rem; vertical-align: super; margin-left: 1px; }
.cell.wrong .g { text-decoration: line-through; text-decoration-thickness: 2px; }
.cell.wrong .g::after { content: "×"; font-size: .8rem; vertical-align: super; color: var(--brand-text); }
.cell.pop .g { animation: pop .18s ease-out; }
.punct { display: flex; align-items: flex-start; font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; height: 2rem; line-height: 2rem; padding: 0 1px; }
@keyframes pop { 50% { transform: scale(1.18); } }
.cue { margin: 0 0 var(--s2); text-align: center; font-weight: 600; color: var(--ink); font-size: var(--step--1); }
.loading { margin: var(--s5) 0; color: var(--ink-2); }
.progress { text-align: center; margin: var(--s3) 0 0; font-size: var(--step--1); color: var(--ink-2); }
.solved .cell { cursor: default; }
.solved .cell .g { border-bottom-color: var(--brand); }

/* Letter pad: alphabetical, so the phone's own keyboard never covers the quote. */
.pad { position: sticky; bottom: 0; z-index: 5; background: var(--bg); border-top: 1px solid var(--line); padding: var(--s2) 0 var(--s3); margin-top: var(--s3); }
.keys { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.keys button { min-height: 44px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: 700 1.05rem var(--font-body); cursor: pointer; padding: 0; }
.keys button.used { background: var(--surface-2); color: var(--ink-2); text-decoration: line-through; text-decoration-color: var(--brand-text); }
.keys button:active { transform: translateY(1px); }
.keys .wide { font-size: 1.1rem; }
.keys .hint { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-size: .85rem; }
.tools:empty, .tools:not(:has(:not([hidden]))) { display: none; }
.tools { display: flex; gap: var(--s2); justify-content: center; margin-top: var(--s2); flex-wrap: wrap; }
.tools .btn { min-height: 44px; padding: var(--s2) var(--s3); font-size: var(--step--1); }

.result { margin-top: var(--s4); text-align: center; }
.result .said { font-family: var(--font-display); font-size: var(--step-1); line-height: 1.35; margin: var(--s2) 0; }
.result .who { color: var(--ink-2); margin: 0 0 var(--s3); }
.share-text { white-space: pre-line; }
.result .cluster { justify-content: center; }
.archive-note { margin-top: var(--s4); }
.ready { margin-top: var(--s6); text-align: center; }
.ready h2 { margin-top: 0; }
.print-row { margin-top: var(--s3); }

.archive { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: var(--s2); }
.archive a { display: block; padding: var(--s3); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--ink); }
.archive a b { display: block; font-family: var(--font-display); font-size: var(--step-1); }
.archive a span { font-size: var(--step--1); color: var(--ink-2); }
.archive a:hover { border-color: var(--brand-text); }

.guide h2 { margin-top: var(--s6); font-size: var(--step-1); }
.guide .example { font-family: var(--font-display); font-size: var(--step-1); background: var(--paper); border: 1px solid var(--paper-line); border-radius: var(--radius); padding: var(--s3); letter-spacing: .08em; }

@media (min-width: 720px) {
  .cell { width: min(2.2rem, calc((100cqw - (var(--n, 10) - 1) * 3px) / var(--n, 10))); }
  .cell .g { font-size: 1.55rem; height: 2.3rem; line-height: 2.3rem; }
  .punct { font-size: 1.55rem; height: 2.3rem; line-height: 2.3rem; }
  .keys { grid-template-columns: repeat(14, 1fr); }
  .pad { padding-bottom: var(--s2); }
}

/* Print: the coded quote with blank lines to write on, nothing else. */
@media print {
  .site-header, .pad, .tools, .result, .how, footer, .toast, .play-meta, .skip-link { display: none !important; }
  .puzzle { box-shadow: none; border: 0; background: none; }
  .cell .g { color: transparent !important; background: none !important; border-bottom-color: #000; }
  .cell .c { color: #000; font-size: .95rem; }
  .print-only { display: block !important; }
}
.print-only { display: none; }

/* Search pages: a set of puzzles with a picker, then the case's own explanation and questions. */
.pick-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2); margin: 0 0 var(--s3); font-size: var(--step--1); color: var(--ink-2); }
.pick { display: flex; gap: 6px; }
.pick a { display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font-weight: 700; text-decoration: none; }
.pick a[aria-current] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.pick a:hover { border-color: var(--brand-text); }
.num .cell .c { font-size: .8rem; letter-spacing: 0; }
.content { margin-top: var(--s5); }
.content h2 { margin-top: var(--s6); font-size: var(--step-1); }
.content h3 { font-size: var(--step-0); margin: var(--s4) 0 var(--s1); }
.content .faq p { margin-top: 0; }
.print-row { align-items: center; gap: var(--s3); }
.big-toggle { display: inline-flex; align-items: center; gap: var(--s2); min-height: 44px; font-size: var(--step--1); cursor: pointer; }
.big-toggle input { width: 1.2rem; height: 1.2rem; accent-color: var(--brand); }
.answers details { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: var(--s2) var(--s3); margin-bottom: var(--s2); }
.answers summary { cursor: pointer; font-weight: 700; min-height: 32px; }
.more-links { padding-left: 1.2rem; }
.more-links li { margin: var(--s2) 0; }
table.wl { width: 100%; border-collapse: collapse; font-size: var(--step--1); table-layout: fixed; }
table.wl th { text-align: left; width: 5.5rem; vertical-align: top; padding: var(--s2) var(--s2) var(--s2) 0; }
table.wl td { padding: var(--s2) 0; overflow-wrap: anywhere; }
table.wl tr + tr { border-top: 1px solid var(--line); }

/* The print-out of a page's set, built by game.js only when printing. */
.sheet h1 { font-size: 20pt; margin: 0 0 12pt; }
.sp { display: flex; gap: 8pt; break-inside: avoid; margin-bottom: 18pt; }
.sn { font: 700 13pt var(--font-display); margin: 0; }
.sq { display: flex; flex-wrap: wrap; gap: 6pt 12pt; margin: 0; }
.sw { display: inline-flex; gap: 2pt; }
.sl { display: inline-flex; flex-direction: column; align-items: center; width: 17pt; }
.sl i { display: block; width: 100%; height: 18pt; border-bottom: 1pt solid #000; font: normal 700 13pt var(--font-display); text-align: center; }
.sl b { font-size: 9pt; }
.sx { font: 700 13pt var(--font-display); align-self: flex-start; }
.sk { break-before: page; }
.sk h2 { font-size: 16pt; margin: 0 0 10pt; }
.sk li { margin-bottom: 8pt; }
.sk span { color: #555; font-size: 10pt; }
.sfoot { margin-top: 18pt; font-size: 9pt; color: #555; }
.big .sl { width: 24pt; }
.big .sl i { height: 26pt; font-size: 18pt; }
.big .sl b { font-size: 13pt; }
.big .sx { font-size: 18pt; }
.big .sq { gap: 10pt 18pt; }
@media print {
  .set-page main > :not(#sheet) { display: none !important; }
  .set-page .container { max-width: none; }
}
.more-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: var(--s2); }
.more-grid a { display: block; padding: var(--s2) var(--s3); border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); color: var(--ink); text-decoration: none; min-height: 44px; }
.more-grid a:hover { border-color: var(--brand-text); }
