/* game-pixels.css — Pixel garden (nonogram), prefix gp-. SPEC §18e.
   Shared classes (.seg .btn .num .pf .sub) come from app.css; the hub's .gm-* from games.css.
   Cells: 24 px desktop; ≤ 420 px: 10×10 → 22 px, 15×15 → 18 px (270 px) with gutters ≤ 64 px,
   clue digits 11 px, so 15×15 fits 375-px phones (270 + 64 = 334 ≤ 343). */

.gp-wrap { display: flex; flex-direction: column; gap: 14px; align-items: center; }

/* ---------- top row: Fill | Cross, timer, actions ---------- */
.gp-top { display: flex; align-items: center; gap: 14px 18px; flex-wrap: wrap; width: 100%; }
.gp-modeseg button { min-height: 40px; min-width: 88px; }
.gp-timerbox { display: inline-flex; align-items: baseline; gap: 8px; }
.gp-timer-label { font-size: 13px; font-weight: 700; }
.gp-timer { font-size: 18px; color: var(--gold); line-height: 1; letter-spacing: 1px; }
.gp-actions { display: flex; gap: 10px; margin-left: auto; flex-wrap: wrap; }
.gp-actions .btn { min-height: 40px; }

/* ---------- board ---------- */
.gp-board {
  --gp-cell: 24px; --gp-gutter: 84px; --gp-band: 84px; --gp-clue: 13px;
  --gp-accent: var(--gold);
  display: grid;
  grid-template-columns: var(--gp-gutter) auto;
  grid-template-rows: var(--gp-band) auto;
  gap: 4px;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  max-width: 100%;
  /* parchment backing: the clues are ink-coloured and must never sit on the dark page */
  background: var(--panel); padding: 10px 12px 12px 8px;
  border: 3px solid var(--edge); box-shadow: inset 0 0 0 2px var(--line), 4px 4px 0 var(--shadow);
}
.gp-corner { background: transparent; }
.gp-colclues { display: grid; grid-template-columns: repeat(var(--gp-w), var(--gp-cell)); }
.gp-rowclues { display: grid; grid-template-rows: repeat(var(--gp-h), var(--gp-cell)); }
.gp-cells {
  display: grid;
  grid-template-columns: repeat(var(--gp-w), var(--gp-cell));
  grid-template-rows: repeat(var(--gp-h), var(--gp-cell));
  border: 2px solid var(--edge);
  background: var(--field);
  cursor: crosshair;
}
.gp-clue {
  display: flex; font-size: var(--gp-clue); color: var(--ink); line-height: 1; gap: 3px;
  transition: opacity .25s, color .25s;
}
.gp-clue-col { flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 4px; }
.gp-clue-row { flex-direction: row; align-items: center; justify-content: flex-end; padding-right: 6px; }
.gp-clue.gp-ok { opacity: .38; }
.gp-clue.gp-b5 { position: relative; }
.gp-clue-col.gp-b5::after { content: ""; position: absolute; right: -1px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.gp-clue-row.gp-b5::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--line); }
.gp-n { display: block; }

.gp-cell {
  box-sizing: border-box; position: relative;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: var(--field);
  transition: background-color .5s ease, border-color .5s ease;
}
.gp-cell.gp-b5x { border-right: 2px solid var(--edge); }
.gp-cell.gp-b5y { border-bottom: 2px solid var(--edge); }
.gp-cell.gp-on { background: var(--ink); transition: none; }
/* a 3×3 pixel X, drawn with gradients so no image is needed */
.gp-cell.gp-x::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 9px; height: 9px; margin: -5px 0 0 -5px;
  background:
    linear-gradient(var(--muted), var(--muted)) 0 0 / 3px 3px no-repeat,
    linear-gradient(var(--muted), var(--muted)) 3px 3px / 3px 3px no-repeat,
    linear-gradient(var(--muted), var(--muted)) 6px 6px / 3px 3px no-repeat,
    linear-gradient(var(--muted), var(--muted)) 6px 0 / 3px 3px no-repeat,
    linear-gradient(var(--muted), var(--muted)) 0 6px / 3px 3px no-repeat;
  opacity: .75;
}
.gp-solved .gp-cells { cursor: default; box-shadow: 0 0 0 3px var(--gp-accent); }
.gp-solved .gp-cell.gp-on { transition: background-color .6s ease; }
.gp-cell.gp-won { background: var(--gp-accent); }
.gp-solved .gp-clue { opacity: .3; }

/* ---------- reveal + help ---------- */
.gp-reveal { margin: 0; font-size: 26px; color: var(--accent); line-height: 1.15; }
.gp-reveal[hidden] { display: none; }
.gp-help { margin: 0; max-width: 520px; text-align: center; }
.gp-solved .gp-help { display: none; }

/* ---------- phones ---------- */
@media (max-width: 860px) {
  .gp-board { --gp-cell: 24px; --gp-gutter: 72px; --gp-band: 72px; }
  .gp-actions { margin-left: 0; }
}
@media (max-width: 420px) {
  .gp-wrap { gap: 10px; }
  .gp-top { gap: 10px 12px; }
  .gp-modeseg button { min-width: 0; flex: 1; }
  .gp-modeseg { display: flex; width: 100%; }
  .gp-board { --gp-cell: 22px; --gp-gutter: 58px; --gp-band: 60px; --gp-clue: 11px; gap: 2px; padding: 3px; border-width: 0; box-shadow: none; }
  .gp-board[data-size="15"] { --gp-cell: 18px; }
  .gp-clue-col { gap: 1px; padding-bottom: 3px; }
  .gp-clue-row { gap: 2px; padding-right: 4px; }
  .gp-cell.gp-x::before { width: 6px; height: 6px; margin: -3px 0 0 -3px;
    background:
      linear-gradient(var(--muted), var(--muted)) 0 0 / 2px 2px no-repeat,
      linear-gradient(var(--muted), var(--muted)) 2px 2px / 2px 2px no-repeat,
      linear-gradient(var(--muted), var(--muted)) 4px 4px / 2px 2px no-repeat,
      linear-gradient(var(--muted), var(--muted)) 4px 0 / 2px 2px no-repeat,
      linear-gradient(var(--muted), var(--muted)) 0 4px / 2px 2px no-repeat; }
  .gp-reveal { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .gp-cell, .gp-clue, .gp-solved .gp-cell.gp-on { transition: none !important; transition-delay: 0ms !important; }
}
