/* Cryptograms — clean, high-contrast, senior-friendly, mobile-first. No frameworks.
 * Shares the look of the Sudoku / Sumtowers / Nonogram apps. */
:root {
  --bg: #f4f1ea; --panel: #fffdf7; --ink: #1f2430; --line: #2b2f3a;
  --thin: #b9c0cc; --accent: #2563eb; --ok: #15803d; --bad: #dc2626;
  --code: #b8460f; --sel: #fde68a; --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.4;
  -webkit-text-size-adjust: 100%;
}
.wrap { max-width: 880px; margin: 0 auto; padding: 14px 14px 40px; }

header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
header h1 { font-size: 1.5rem; margin: 0; letter-spacing: .5px; }
header .sub { flex: 1 1 100%; color: #6b7280; font-size: .92rem; margin: 2px 0 8px; }
.spacer { flex: 1; }
.iconbtn { border: 1px solid var(--thin); background: var(--panel); color: var(--ink);
  border-radius: 999px; padding: 8px 14px; font-size: .95rem; cursor: pointer; min-height: 40px; }

.toolbar { display: flex; align-items: center; gap: 10px; margin: 8px 0 10px; flex-wrap: wrap; }
.toolbar button { min-height: 44px; border-radius: 10px; border: 1px solid var(--thin);
  background: var(--panel); color: var(--ink); font-size: 1rem; padding: 0 14px; cursor: pointer; }
#newBtn { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.meta { margin-left: auto; display: flex; gap: 16px; font-variant-numeric: tabular-nums; }

.hintbar { color: #6b7280; font-size: .88rem; margin: 0 0 10px; text-align: center; }
.given { text-align: center; font-weight: 700; color: var(--code); margin: 4px 0 14px; font-size: 1.05rem; letter-spacing: .5px; }

.board { display: flex; flex-wrap: wrap; gap: 0 14px; justify-content: center; padding: 8px; }
.word { display: inline-flex; margin-bottom: 16px; }
.cellunit { display: flex; flex-direction: column; align-items: center; width: 26px; }
.code { font: 700 1.05rem/1 "Consolas", monospace; color: #1f2430; height: 20px; }
.punct .code { color: #1f2430; }
.slot { width: 22px; height: 30px; margin-top: 4px; border: none; border-bottom: 2px solid var(--line);
  text-align: center; font: 700 1.15rem/1 "Consolas", monospace; background: transparent; color: var(--accent);
  text-transform: uppercase; padding: 0; }
.slot:focus { outline: none; background: var(--sel); border-radius: 4px 4px 0 0; }
.punct .slot { border-bottom: none; }

body.large .wrap { max-width: 1200px; }
body.large .cellunit { width: 34px; }
body.large .code { font-size: 1.4rem; }
body.large .slot { width: 30px; height: 40px; font-size: 1.5rem; }

.status { text-align: center; min-height: 26px; margin: 12px 0; font-weight: 600; }
.status.win { color: var(--ok); font-size: 1.1rem; }
.status.bad { color: var(--bad); }

.actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 4px 0; }
.actions button { min-height: 48px; border-radius: 10px; border: 1px solid var(--thin);
  background: var(--panel); color: var(--ink); font-size: .95rem; cursor: pointer; padding: 0 16px; }

.book { background: var(--panel); border: 1px solid var(--thin); border-radius: var(--radius);
  padding: 16px; margin: 22px 0 12px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.book h3 { margin: 0 0 4px; font-size: 1.05rem; }
.book p { margin: 0; color: #555; font-size: .92rem; }
.book .crypt-ico { width: 54px; height: 54px; flex: none; border: 2px solid var(--line); border-radius: 8px;
  display: flex; align-items: center; justify-content: center; font: 700 1.6rem monospace; color: var(--code); }

.crosslinks { text-align: center; margin: 8px 0 0; font-size: .9rem; }
.crosslinks a { color: #6b7280; text-decoration: none; margin: 0 4px; }
.crosslinks a:hover { text-decoration: underline; }
footer { text-align: center; color: #8a8f9a; font-size: .82rem; margin-top: 16px; }
footer .links a { color: #6b7280; text-decoration: none; margin: 0 6px; }
.privacy { margin-top: 6px; }

@media print {
  body { background: #fff; }
  .toolbar, .actions, .book, .crosslinks, footer, header .sub, .hintbar,
  #langBtn, #largeBtn, .meta, .status { display: none !important; }
  .wrap { max-width: none; }
  .slot { color: #000; }
}
@media (max-width: 420px) {
  header h1 { font-size: 1.3rem; }
  .cellunit { width: 22px; }
  .code { font-size: .92rem; }
  .slot { width: 18px; height: 26px; font-size: 1rem; }
}
