/* Ticks and Crosses - a puzzle pad: squared paper, a red margin rule, pencil ticks and crosses. */
:root {
  --paper: #fbfaf4; --sheet: #fffef9; --rule: #d7e2ec; --rule2: #c3d3e2; --margin: #e3a3a3; --ink: #26303b; --soft: #55606c; --faint: #7a8591;
  --tick: #1f6f4a; --cross: #b4232b; --accent: #2f5d8a; --accent-ink: #ffffff; --chip: #eef3f8; --line: #c9d4df; --warn-bg: #fff4e0; --warn-ink: #7a4a00;
  --ok-bg: #e6f4ec; --ok-ink: #17563a; --void: #f1efe6; --focus: #2f5d8a; --shadow: 0 1px 0 rgba(30, 40, 50, .06), 0 6px 18px rgba(30, 40, 50, .06);
}
:root[data-theme="dark"] {
  --paper: #161a1f; --sheet: #1d232a; --rule: #26313c; --rule2: #2f3c49; --margin: #7a3a3a; --ink: #e7ecf1; --soft: #b7c1cb; --faint: #8f9aa5;
  --tick: #6fd3a0; --cross: #ff8a8a; --accent: #8ab8e6; --accent-ink: #10161c; --chip: #26303a; --line: #3a4652; --warn-bg: #3a2c12; --warn-ink: #ffd89a;
  --ok-bg: #173226; --ok-ink: #9be3bd; --void: #20262d; --focus: #8ab8e6; --shadow: 0 1px 0 rgba(0, 0, 0, .3);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.hidden { display: none !important; }
.small { font-size: .88rem; } .muted { color: var(--faint); }
.top { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--sheet); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.back { text-decoration: none; color: var(--soft); white-space: nowrap; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; min-width: 0; }
.brand strong { white-space: nowrap; }
.logo { width: 26px; height: 26px; flex: none; }
.session { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chip-s { background: var(--chip); border-radius: 999px; padding: 3px 10px; font-size: .85rem; white-space: nowrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--sheet); border-radius: 8px; padding: 7px 12px; cursor: pointer; text-decoration: none; color: var(--ink); line-height: 1.2; min-height: 36px; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn.solid { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.solid:hover:not(:disabled) { filter: brightness(1.08); color: var(--accent-ink); }
.btn.tiny { padding: 4px 9px; font-size: .85rem; min-height: 30px; }
.btn.big { padding: 11px 20px; font-size: 1.05rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
main { max-width: 1120px; margin: 0 auto; padding: 0 16px 40px; }
.hero { padding: 28px 0 12px; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .78rem; color: var(--cross); margin: 0 0 6px; }
h1 { font-family: Georgia, "Times New Roman", serif; font-weight: 700; font-size: clamp(2rem, 6vw, 3rem); margin: 0; line-height: 1.1; }
h1 .sub { display: block; font-family: inherit; font-weight: 400; font-size: clamp(1.05rem, 3vw, 1.3rem); color: var(--soft); margin-top: 6px; }
.lede { max-width: 760px; color: var(--soft); }
.samples { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sample { border: 1px dashed var(--rule2); background: var(--sheet); border-radius: 999px; padding: 5px 12px; cursor: pointer; }
.sample.on { border-style: solid; border-color: var(--accent); background: var(--chip); }
.layout { display: grid; gap: 18px; margin-top: 12px; }
.card { background: var(--sheet); border: 1px solid var(--line); border-radius: 12px; padding: 18px 18px 18px 30px; box-shadow: var(--shadow); min-width: 0; }
.pad { background-image: linear-gradient(90deg, transparent 17px, var(--margin) 17px, var(--margin) 19px, transparent 19px), repeating-linear-gradient(0deg, transparent 0 27px, var(--rule) 27px 28px); }
.ch { display: flex; align-items: center; gap: 10px; font-size: 1.2rem; margin: 0 0 12px; flex-wrap: wrap; }
.no { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--ink); font-size: .9rem; flex: none; }
.free, .paid { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.free { background: var(--ok-bg); color: var(--ok-ink); } .paid { background: var(--warn-bg); color: var(--warn-ink); }
.lab { display: block; font-weight: 600; margin: 10px 0 4px; }
.inp { width: 100%; border: 1px solid var(--line); background: var(--sheet); border-radius: 8px; padding: 8px 10px; }
.inp.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92rem; }
.inp.narrow { width: auto; min-width: 110px; }
textarea.inp { resize: vertical; }
.row2 { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.row2 .lab { margin: 0; }
.tog { display: flex; gap: 8px; align-items: flex-start; font-size: .92rem; }
.note { background: var(--warn-bg); color: var(--warn-ink); border-radius: 8px; padding: 8px 12px; }
.note.good { background: var(--ok-bg); color: var(--ok-ink); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.kh { font-size: 1rem; margin: 16px 0 6px; }
.ptitle { font-family: Georgia, serif; font-size: 1.45rem; margin: 0 0 4px; overflow-wrap: anywhere; }
.puzzle { display: grid; grid-template-columns: minmax(0, auto) minmax(260px, 1fr); gap: 20px; align-items: start; margin-top: 8px; }
.gridwrap { overflow-x: auto; max-width: 100%; padding-bottom: 4px; }
.clues { margin: 0; padding-left: 22px; }
.clues li { margin: 0 0 8px; overflow-wrap: anywhere; }
.clues li.plainw::marker { color: var(--faint); }
.clues .tagw { font-size: .72rem; color: var(--faint); margin-left: 6px; white-space: nowrap; }
/* The grid */
.lg { border-collapse: collapse; background: var(--sheet); font-size: .85rem; }
.lg th, .lg td { padding: 0; }
.lg .corner { border: 0; }
.lg th.cat { font-weight: 700; text-align: center; padding: 4px 2px; border-bottom: 2px solid var(--ink); white-space: nowrap; }
.lg th.cat.side { border-bottom: 0; border-right: 2px solid var(--ink); width: 26px; }
.lg th.cat.side span { writing-mode: vertical-rl; transform: rotate(180deg); display: inline-block; white-space: nowrap; }
.lg th.it { font-weight: 500; text-align: right; padding: 0 8px; white-space: nowrap; max-width: 140px; overflow: hidden; text-overflow: ellipsis; border-right: 2px solid var(--ink); }
.lg th.it.up { height: 150px; vertical-align: bottom; text-align: left; padding: 0 0 6px; border-right: 0; width: 34px; max-width: 34px; }
.lg th.it.up span { writing-mode: vertical-rl; transform: rotate(180deg); display: inline-block; white-space: nowrap; max-height: 144px; overflow: hidden; text-overflow: ellipsis; }
.lg td { border: 1px solid var(--rule2); width: 34px; height: 34px; }
.lg td.gl, .lg th.gl { border-left: 2px solid var(--ink); }
.lg tr.gt td, .lg tr.gt th { border-top: 2px solid var(--ink); }
.lg td.void { border: 0; background: transparent; }
.cell { width: 34px; height: 34px; border: 0; background: transparent; cursor: pointer; font-size: 1.15rem; font-weight: 700; line-height: 1; display: grid; place-items: center; padding: 0; }
.cell:hover { background: var(--chip); }
.cell.m1 { color: var(--cross); } .cell.m2 { color: var(--tick); background: var(--ok-bg); }
.tablewrap { overflow-x: auto; }
.readout { border-collapse: collapse; font-size: .9rem; min-width: 260px; }
.readout th, .readout td { border: 1px solid var(--line); padding: 4px 10px; text-align: left; }
.readout td.q { color: var(--faint); }
.hints { margin: 0; padding-left: 22px; }
.hints li { margin: 0 0 6px; }
.hints details summary { cursor: pointer; color: var(--accent); }
.hints details p { margin: 4px 0 0; }
/* The run */
.progress { border: 1px dashed var(--line); border-radius: 8px; padding: 10px 14px; margin-top: 10px; }
.steps { list-style: none; padding: 0; margin: 8px 0; }
.step { color: var(--faint); } .step.active { color: var(--ink); font-weight: 600; } .step.done { color: var(--tick); }
.step-ic { display: inline-block; width: 1em; font-family: ui-monospace, Menlo, monospace; }
.raw { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--chip); padding: 10px; border-radius: 8px; max-height: 320px; overflow: auto; font-size: .82rem; }
.result { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.rhead { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.badge { font-size: .74rem; font-weight: 700; letter-spacing: .05em; border-radius: 999px; padding: 3px 10px; background: var(--chip); color: var(--soft); }
.badge.v-kept { background: var(--ok-bg); color: var(--ok-ink); } .badge.v-flagged { background: var(--warn-bg); color: var(--warn-ink); }
.result h3 { font-size: 1rem; margin: 12px 0 4px; }
.recon { margin: 0; padding-left: 20px; }
.recon li { margin: 0 0 4px; } .recon li.warn { color: var(--warn-ink); } .recon li.info, .recon li.none { color: var(--soft); }
/* Saved */
.saved { list-style: none; padding: 0; margin: 10px 0 0; }
.hrow { display: flex; gap: 12px; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding: 10px 0; flex-wrap: wrap; }
.hrow.none { color: var(--faint); }
.hinfo { display: flex; flex-direction: column; min-width: 0; flex: 1 1 240px; overflow-wrap: anywhere; }
.hbtns { display: flex; gap: 6px; }
.foot { max-width: 1120px; margin: 0 auto; padding: 18px 16px 40px; color: var(--soft); font-size: .88rem; border-top: 1px solid var(--line); }
.toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 20; width: min(92vw, 520px); }
.toast { background: var(--ink); color: var(--paper); border-radius: 8px; padding: 10px 14px; box-shadow: var(--shadow); transition: opacity .5s; }
.toast.err { background: var(--cross); color: #fff; } .toast a { color: inherit; }
.toast.gone { opacity: 0; }
.print-only { display: none; }
@media (max-width: 860px) { .puzzle { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) {
  .card { padding: 14px 12px 14px 26px; }
  .back-t { display: none; }
  .brand strong { font-size: .95rem; }
  .btn { padding: 6px 10px; }
  .lg td, .cell { width: 30px; height: 30px; } .lg th.it.up { width: 30px; max-width: 30px; }
  .lg th.it { max-width: 96px; padding: 0 5px; }
}
@media print {
  body { background: #fff; }
  .top, .hero, .layout, .foot, .toasts { display: none !important; }
  .print-only { display: block; }
  .print-only svg { width: 100%; height: auto; }
}
