/* Pencil Grids: pencil on paper. System fonts only, so nothing to download. */

:root {
  --paper: #faf7f0;
  --paper-2: #f2ede1;
  --card: #fffdf8;
  --ink: #24221d;
  --ink-2: #5d594f;
  --ink-3: #8a8577;
  --line: #ddd6c6;
  --line-strong: #24221d;
  --focus: #1f6feb;
  --good: #2e7d4f;
  --bad: #c0392b;
  --hint: #f4d35e;
  --accent: #6b4fa0;
  --c-queens: #6b4fa0;
  --c-tango: #b8612a;
  --c-zip: #2b7a6a;
  --c-nonograms: #3a5ca6;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(36, 34, 29, .06), 0 4px 16px rgba(36, 34, 29, .06);
  --serif: 'Iowan Old Style', 'Charter', 'Bitstream Charter', 'Sitka Text', Cambria, Georgia, serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1a1916; --paper-2: #23211d; --card: #22201c; --ink: #ede8db; --ink-2: #bdb7a8;
    --ink-3: #8d8778; --line: #3a372f; --line-strong: #ede8db; --focus: #6ea8fe; --hint: #8a7420;
    --c-queens: #a88be0; --c-tango: #e39a63; --c-zip: #5fc0ab; --c-nonograms: #86a6ec;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #1a1916; --paper-2: #23211d; --card: #22201c; --ink: #ede8db; --ink-2: #bdb7a8;
  --ink-3: #8d8778; --line: #3a372f; --line-strong: #ede8db; --focus: #6ea8fe; --hint: #8a7420;
  --c-queens: #a88be0; --c-tango: #e39a63; --c-zip: #5fc0ab; --c-nonograms: #86a6ec;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 17px/1.6 var(--sans);
  min-height: 100vh; display: flex; flex-direction: column;
}
body[data-type="queens"] { --accent: var(--c-queens); }
body[data-type="tango"] { --accent: var(--c-tango); }
body[data-type="zip"] { --accent: var(--c-zip); }
body[data-type="nonograms"] { --accent: var(--c-nonograms); }

a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); margin: .2em 0 .3em; }
h2 { font-size: 1.55rem; margin: 2em 0 .5em; }
h3 { font-size: 1.2rem; margin: 1.6em 0 .4em; }
p, ul, ol { margin: 0 0 1em; }
img, svg { max-width: 100%; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 720px; }
.muted { color: var(--ink-2); }
.small { font-size: .9rem; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--card); padding: 8px 12px; z-index: 10; }

/* ---------- header / footer ---------- */
.site-header { border-bottom: 1px solid var(--line); background: var(--paper); }
.site-header .wrap { display: flex; align-items: center; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--serif); font-size: 1.35rem; font-weight: 700; color: var(--ink); }
.logo svg { width: 30px; height: 30px; }
.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav a { text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: .95rem; color: var(--ink-2); }
.nav a:hover, .nav a[aria-current="page"] { background: var(--paper-2); color: var(--ink); }
.theme-toggle { background: none; border: 1px solid var(--line); border-radius: 8px; width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); cursor: pointer; }
.theme-toggle svg { width: 18px; height: 18px; }
@media (max-width: 640px) {
  .site-header .wrap { padding-top: 8px; padding-bottom: 8px; gap: 6px; }
  .nav { margin-left: 0; width: 100%; justify-content: space-between; order: 3; }
  .nav a { padding: 6px 6px; font-size: .9rem; }
  .theme-toggle { margin-left: auto; order: 2; }
}
main { flex: 1; }
.site-footer { border-top: 1px solid var(--line); margin-top: 64px; padding: 28px 0 40px; color: var(--ink-2); font-size: .92rem; }
.site-footer .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 20px; }
.site-footer h4 { font-family: var(--serif); color: var(--ink); margin: 0 0 6px; font-size: 1rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin: 3px 0; }
.site-footer a { text-decoration: none; }

/* ---------- home ---------- */
.hero { padding: 40px 0 8px; }
.hero p.lead { font-size: 1.15rem; color: var(--ink-2); max-width: 640px; }
.daily-set { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin: 24px 0; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; text-decoration: none; display: flex; flex-direction: column; gap: 10px; position: relative;
}
a.card:hover { border-color: var(--accent); color: inherit; transform: translateY(-1px); }
.card .thumb { aspect-ratio: 1; width: 100%; max-width: 180px; align-self: center; }
.card h3 { margin: 0; font-size: 1.3rem; }
.card .meta { font-size: .9rem; color: var(--ink-2); }
.card .status { position: absolute; top: 12px; right: 12px; font-size: .8rem; padding: 2px 8px; border-radius: 99px; background: var(--paper-2); color: var(--ink-2); }
.card .status.done { background: var(--good); color: #fff; }
.card[data-type="queens"] { --accent: var(--c-queens); }
.card[data-type="tango"] { --accent: var(--c-tango); }
.card[data-type="zip"] { --accent: var(--c-zip); }
.card[data-type="nonograms"] { --accent: var(--c-nonograms); }
.card .bar { height: 4px; background: var(--accent); border-radius: 4px; width: 40px; }
.streak-strip { display: flex; gap: 18px; flex-wrap: wrap; color: var(--ink-2); font-size: .95rem; }

/* ---------- game page ---------- */
.game-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 20px; }
.game-head h1 { margin: 0; }
.game-sub { color: var(--ink-2); margin: 2px 0 10px; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin: 10px 0 18px; overflow-x: auto; }
.tabs a { text-decoration: none; padding: 8px 12px; color: var(--ink-2); border-bottom: 3px solid transparent; white-space: nowrap; font-size: .95rem; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.game { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 14px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; align-items: center; width: 100%; }
.timer { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 64px; text-align: center; padding: 6px 10px; border-radius: 8px; background: var(--paper-2); }
.btn {
  font: inherit; font-size: .95rem; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px;
}
.btn:hover { border-color: var(--ink-3); color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); color: #fff; }
.btn[disabled] { opacity: .45; cursor: default; }
.level-pick { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.level-pick a { text-decoration: none; padding: 6px 12px; border: 1px solid var(--line); border-radius: 99px; font-size: .9rem; color: var(--ink-2); }
.level-pick a[aria-current="true"] { border-color: var(--accent); color: var(--ink); background: var(--paper-2); font-weight: 600; }
.hint-msg { min-height: 1.6em; max-width: 560px; text-align: center; color: var(--ink-2); font-size: .98rem; }
.hint-msg.error { color: var(--bad); }
.board-wrap { width: 100%; display: flex; justify-content: center; touch-action: none; user-select: none; -webkit-user-select: none; }
.loading { padding: 80px 0; color: var(--ink-3); }

/* shared cell grid */
.grid { display: grid; background: var(--line-strong); gap: 1px; border: 2px solid var(--line-strong); border-radius: 6px; overflow: hidden; width: min(92vw, 520px); }
.cell { aspect-ratio: 1; background: var(--card); display: flex; align-items: center; justify-content: center; position: relative; cursor: pointer; border: 0; padding: 0; font: inherit; color: var(--ink); }
.cell.hl::after { content: ''; position: absolute; inset: 0; background: var(--hint); opacity: .45; pointer-events: none; }
.cell.target::before { content: ''; position: absolute; inset: 3px; border: 3px solid var(--focus); border-radius: 4px; pointer-events: none; z-index: 2; }
.cell.err { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }

/* Queens */
.queens .cell { background: var(--rc); }
.queens .cell.bt { border-top: 3px solid var(--line-strong); }
.queens .cell.bl { border-left: 3px solid var(--line-strong); }
.queens .cell svg { width: 62%; height: 62%; pointer-events: none; }
.queens .cell.x::before { content: '×'; font-size: 1.3em; color: rgba(36, 34, 29, .55); line-height: 1; }
.queens .cell.clash { box-shadow: inset 0 0 0 3px var(--bad); }
.queens .cell.clash svg { color: var(--bad); }
.queens .cell { color: #24221d; }

/* Win dialog */
dialog.win { border: 0; border-radius: 14px; padding: 0; max-width: 420px; width: calc(100% - 32px); background: var(--card); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
dialog.win::backdrop { background: rgba(20, 18, 14, .45); }
.win-body { padding: 24px; text-align: center; }
.win-body h2 { margin: 0 0 6px; }
.win-stats { display: flex; justify-content: center; gap: 22px; margin: 14px 0 18px; }
.win-stats div { display: flex; flex-direction: column; }
.win-stats b { font-size: 1.5rem; font-family: var(--serif); }
.win-stats span { font-size: .8rem; color: var(--ink-2); }
.win-actions { display: flex; flex-direction: column; gap: 8px; }
.win-more { margin-top: 14px; font-size: .92rem; color: var(--ink-2); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 8px; font-size: .95rem; z-index: 50; }

/* consent bar */
.consent { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 60; max-width: 720px; margin: 0 auto; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,.18); padding: 14px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: .93rem; }
.consent p { margin: 0; flex: 1 1 260px; }
.consent div { display: flex; gap: 8px; }

/* ---------- prose / guides ---------- */
.prose { max-width: 720px; }
.prose li { margin: .3em 0; }
.prose figure { margin: 1.5em 0; text-align: center; }
.prose figure svg { width: min(100%, 320px); height: auto; }
.prose figcaption { font-size: .9rem; color: var(--ink-2); margin-top: 6px; }
.callout { background: var(--paper-2); border-left: 4px solid var(--accent); padding: 12px 16px; border-radius: 0 8px 8px 0; margin: 1.2em 0; }
.faq dt { font-weight: 600; margin-top: 1em; }
.faq dd { margin: 4px 0 0; color: var(--ink-2); }
.below { width: 100%; max-width: 720px; margin-top: 28px; }
.crumbs { font-size: .88rem; color: var(--ink-3); margin-top: 16px; }
.crumbs a { color: var(--ink-2); }

/* archive & stats */
.archive-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.archive-list a { display: flex; justify-content: space-between; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; background: var(--card); font-size: .93rem; }
.archive-list a.done { border-color: var(--good); }
.archive-list a.done::after { content: '✓'; color: var(--good); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.stat-grid table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.stat-grid td { padding: 3px 0; border-bottom: 1px solid var(--line); }
.stat-grid td:last-child { text-align: right; font-variant-numeric: tabular-nums; }

/* printable */
.print-controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 12px 0 20px; }
.print-sheet { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.print-sheet figure { margin: 0; text-align: center; break-inside: avoid; }
.print-sheet svg { width: 100%; height: auto; }
.print-only { display: none; }
@media print {
  .site-header, .site-footer, .no-print, .tabs, .crumbs { display: none !important; }
  .print-only { display: block; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .print-page { break-after: page; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Tango board. The grid carries `grid tango`; the wrapper carries `tango-wrap`. */

.tango-wrap {
  --sun: #f2a93b; --sun-edge: #c97d12;
  --moon: #7f95b5; --moon-edge: #5a6f8e;
  --given: #ece6d7;
  --sign-bg: var(--card);
  position: relative;
  container-type: inline-size;
  width: min(92vw, 520px);
  max-width: 100%;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tango-wrap {
    --sun: #f4b04a; --sun-edge: #ffd08a; --moon: #a3b6d2; --moon-edge: #c9d6ea; --given: #302d27;
  }
}
:root[data-theme="dark"] .tango-wrap {
  --sun: #f4b04a; --sun-edge: #ffd08a; --moon: #a3b6d2; --moon-edge: #c9d6ea; --given: #302d27;
}

.tango-wrap .grid.tango { width: 100%; background: var(--ink-3); }
.tango .cell { background: var(--card); transition: background-color .12s; }
.tango .cell.given { background: var(--given); cursor: default; }
@media (hover: hover) {
  .tango:not(.locked) .cell:not(.given):hover { background: var(--paper-2); }
}
.tango .cell .sym { width: 64%; height: 64%; pointer-events: none; overflow: visible; }
.tango .cell .sun circle { fill: var(--sun); stroke: var(--sun-edge); stroke-width: 1.2; }
.tango .cell .moon path { fill: var(--moon); stroke: var(--moon-edge); stroke-width: 1.2; stroke-linejoin: round; }
.tango .cell.given .sym { width: 58%; height: 58%; }
.tango .cell.clash { box-shadow: inset 0 0 0 3px var(--bad); }
.tango .cell:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; z-index: 3; }
.tango.locked .cell { cursor: default; }

/* Sign overlay matches the grid's content box (inside the 2px border). */
.tango-signs { position: absolute; inset: 2px; pointer-events: none; z-index: 4; }
.tango-signs .sign {
  position: absolute; transform: translate(-50%, -50%);
  width: clamp(15px, 4.4vw, 22px); height: clamp(15px, 4.4vw, 22px);
  border-radius: 50%;
  background: var(--sign-bg); color: var(--ink);
  border: 1px solid var(--ink-3);
  display: flex; align-items: center; justify-content: center;
  font: 700 clamp(11px, 3.2vw, 15px)/1 var(--sans);
  box-shadow: 0 0 0 2px var(--sign-bg);
}
@supports (width: 1cqw) {
  .tango-signs .sign {
    width: clamp(15px, 100cqw / var(--n) * .27, 30px); height: clamp(15px, 100cqw / var(--n) * .27, 30px);
    font-size: clamp(11px, 100cqw / var(--n) * .19, 20px);
  }
}
.tango-signs .sign.eq { letter-spacing: 0; }
.tango-signs .sign.bad { color: #fff; background: var(--bad); border-color: var(--bad); box-shadow: 0 0 0 2px var(--card); }

/* Zip board. Wrapper `.zip-wrap` > `.zip-stage` (grid + SVG overlay) + `.zip-caption`. */

.zip-wrap {
  --zip-path: var(--accent);
  --zip-tint: color-mix(in srgb, var(--accent) 17%, var(--card));
  --zip-num: #24221d;
  --zip-num-ring: transparent;
  --zip-num-text: #fff;
  --zip-wall: var(--ink);
  --zip-lines: var(--ink-3);
  width: min(92vw, 520px);
  max-width: 100%;
  display: flex; flex-direction: column; gap: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .zip-wrap {
    --zip-tint: color-mix(in srgb, var(--accent) 22%, var(--card));
    --zip-num: #0e0d0b; --zip-num-ring: #ede8db;
  }
}
:root[data-theme="dark"] .zip-wrap {
  --zip-tint: color-mix(in srgb, var(--accent) 22%, var(--card));
  --zip-num: #0e0d0b; --zip-num-ring: #ede8db;
}

.zip-stage { position: relative; width: 100%; }
.zip-wrap .grid.zip { width: 100%; gap: 0; background: var(--card); touch-action: none; cursor: pointer; }
.zip-wrap .grid.zip:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.zip .cell { background: transparent; cursor: inherit; transition: background-color .12s; }
.zip .cell.on { background: var(--zip-tint); }
@media (hover: hover) {
  .zip-wrap:not(.locked) .zip .cell:not(.on):hover { background: var(--paper-2); }
}
.zip .cell.target::before { z-index: 1; }
.zip-wrap.locked .grid.zip { cursor: default; }

/* Overlay sits on the grid's content box (inside its 2px border). */
.zip-overlay {
  position: absolute; inset: 2px; width: calc(100% - 4px); height: calc(100% - 4px);
  max-width: none; pointer-events: none; overflow: visible; z-index: 3;
}
.zip-lines { stroke: var(--zip-lines); stroke-opacity: .45; stroke-width: 1; fill: none; }
.zip-path, .zip-glint { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.zip-path { stroke: var(--zip-path); stroke-width: .36; }
.zip-glint { stroke: #fff; stroke-opacity: 0; stroke-width: .14; stroke-dasharray: .1 1.1; stroke-dashoffset: .1; }
.zip-head { fill: var(--card); stroke: var(--zip-path); stroke-width: .06; }
.zip-walls { stroke: var(--zip-wall); stroke-width: .11; stroke-linecap: round; fill: none; }
.zip-num circle { fill: var(--zip-num); stroke: var(--zip-num-ring); stroke-width: .035; }
.zip-num text {
  fill: var(--zip-num-text); font: 700 .3px var(--sans); text-anchor: middle;
  font-variant-numeric: tabular-nums;
}
.zip-num.done circle { stroke: var(--zip-path); stroke-width: .06; }
.zip-num.bad circle { fill: var(--bad); stroke: var(--bad); }

/* Progress caption */
.zip-caption { display: flex; align-items: center; gap: 10px; font-size: .88rem; color: var(--ink-2); padding: 0 2px; }
.zip-bar { flex: 1; height: 6px; border-radius: 99px; background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.zip-bar i { display: block; height: 100%; width: 0; background: var(--zip-path); border-radius: inherit; transition: width .15s; }
.zip-count { font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 6.5em; text-align: right; }

/* Win: cells flash in path order and a glint runs along the line. */
.zip-wrap.celebrate .zip .cell.on { animation: zip-pulse .5s ease-out calc(var(--i) * 18ms) both; }
.zip-wrap.celebrate .zip-glint { animation: zip-glint 1.6s ease-in-out .1s both; }
.zip-wrap.locked .zip-caption { color: var(--accent); font-weight: 600; }
@keyframes zip-pulse {
  0% { background: var(--zip-tint); }
  35% { background: color-mix(in srgb, var(--accent) 55%, var(--card)); }
  100% { background: var(--zip-tint); }
}
@keyframes zip-glint {
  0% { stroke-dashoffset: .1; stroke-opacity: .9; }
  90% { stroke-opacity: .9; }
  100% { stroke-dashoffset: -1; stroke-opacity: 0; }
}

@media (max-width: 360px) {
  .zip-wrap { width: 100%; }
  .zip-caption { font-size: .82rem; }
}

/* Nonogram board. Sizes (--s cell, --f clue font) are set inline by the board. */

.nonogram {
  --ng-thin: color-mix(in srgb, var(--ink) 16%, var(--card));
  --ng-thick: color-mix(in srgb, var(--ink) 62%, var(--card));
  --ng-line-hl: color-mix(in srgb, var(--accent) 9%, var(--card));
  --ng-clue-hl: color-mix(in srgb, var(--accent) 14%, transparent);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  max-width: 100%;
}

/* ----- mode toggle ----- */
.nonogram .ng-modes {
  display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px;
  background: var(--paper-2); border: 1px solid var(--line);
}
.nonogram .ng-mode {
  font: inherit; font-size: .92rem; display: inline-flex; align-items: center; gap: 7px;
  min-height: 36px; padding: 4px 16px; border: 0; border-radius: 7px; cursor: pointer;
  background: transparent; color: var(--ink-2);
}
.nonogram .ng-mode svg { width: 14px; height: 14px; flex: none; }
.nonogram .ng-mode[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent) 14%, var(--card)); color: var(--ink); font-weight: 600;
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 70%, transparent);
}
.nonogram .ng-mode[disabled] { cursor: default; opacity: .5; }
.nonogram.locked .ng-modes { visibility: hidden; }

/* ----- layout ----- */
.nonogram .ng-board { display: grid; }
.nonogram .ng-corner { grid-area: 1 / 1; }
.nonogram .ng-cols { grid-area: 1 / 2; display: flex; align-items: stretch; padding: 0 2px; }
.nonogram .ng-rows { grid-area: 2 / 1; display: flex; flex-direction: column; padding: 2px 0; }

.nonogram .ng-clue {
  font-family: var(--sans); font-size: var(--f); font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--ink); line-height: 1; transition: color .2s, opacity .2s;
}
.nonogram .ng-cclue {
  width: var(--s); flex: none; display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  padding-bottom: calc(var(--f) * .35); border-radius: 4px 4px 0 0;
}
.nonogram .ng-cclue span { height: var(--clh); display: flex; align-items: center; justify-content: center; }
.nonogram .ng-rclue {
  height: var(--s); flex: none; display: flex; justify-content: flex-end; align-items: center;
  gap: var(--cgap); padding-right: calc(var(--f) * .5); border-radius: 4px 0 0 4px; white-space: nowrap;
}
.nonogram .ng-cclue span.d2 { font-variant-numeric: proportional-nums; letter-spacing: -.04em; }
.nonogram .ng-clue.done { color: var(--ink-3); opacity: .55; }
.nonogram .ng-clue.ln { background: var(--ng-clue-hl); }
/* ----- grid ----- */
.nonogram .ng-grid {
  grid-area: 2 / 2; width: auto; gap: 0; background: var(--card);
  border: 2px solid var(--line-strong); border-radius: 4px; overflow: hidden;
  transition: border-color .6s;
}
.nonogram .ng-grid .cell {
  --rw: 1px; --bw: 1px; --rcol: var(--ng-thin); --bcol: var(--ng-thin);
  aspect-ratio: auto; width: var(--s); height: var(--s); border-radius: 0;
  background-color: var(--card);
  box-shadow: inset calc(-1 * var(--rw)) 0 0 var(--rcol), inset 0 calc(-1 * var(--bw)) 0 var(--bcol);
  transition: box-shadow .6s;
}
.nonogram .ng-grid .cell.r5 { --rw: 2px; --rcol: var(--ng-thick); }
.nonogram .ng-grid .cell.b5 { --bw: 2px; --bcol: var(--ng-thick); }
.nonogram .ng-grid .cell.er { --rw: 0px; }
.nonogram .ng-grid .cell.eb { --bw: 0px; }
.nonogram .ng-grid .cell.ln { background-color: var(--ng-line-hl); }
.nonogram .ng-grid .cell.f { background-color: var(--ink); }
.nonogram .ng-grid .cell.x {
  --xc: var(--ink-3);
  background-image:
    linear-gradient(45deg, transparent calc(50% - .9px), var(--xc) calc(50% - .9px), var(--xc) calc(50% + .9px), transparent calc(50% + .9px)),
    linear-gradient(-45deg, transparent calc(50% - .9px), var(--xc) calc(50% - .9px), var(--xc) calc(50% + .9px), transparent calc(50% + .9px));
  background-size: 46% 46%; background-position: center; background-repeat: no-repeat;
}
.nonogram.tight .ng-grid .cell.x { background-size: 56% 56%; }
.nonogram .ng-grid .cell:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; z-index: 3; }
.nonogram .ng-grid .cell.target::before { inset: 1px; border-width: 2px; border-radius: 2px; }
@media (hover: hover) {
  .nonogram .ng-grid:not(.locked) .cell:hover:not(.f) { background-color: color-mix(in srgb, var(--accent) 18%, var(--card)); }
}

/* ----- solved: crosses vanish and the grid lines fade, leaving the picture ----- */
.nonogram.locked .ng-grid { border-color: transparent; }
.nonogram.locked .ng-grid .cell { --rcol: transparent; --bcol: transparent; cursor: default; }
.nonogram.locked .ng-grid .cell.x { background-image: none; }
.nonogram.locked .ng-grid .cell.f { animation: ng-pop .5s ease-out both; }
.nonogram.locked .ng-clue { color: var(--ink-3); opacity: .5; }
@keyframes ng-pop { 0% { filter: brightness(1); } 40% { filter: brightness(1.6); } 100% { filter: brightness(1); } }
