/* Kakuro board (archetype 05, grille de chiffres) scoped under .kak-root.
   A grid of black clue cells and white number cells. Black cells that start a run
   carry a split triangle: the across sum sits in the upper-right, the down sum in
   the lower-left, divided by a thin diagonal. Uses the shared design tokens (gold
   accent + warm neutrals) with explicit light/dark values so the black cells stay
   dark in both themes. */

.kak-root {
  --cell: 52px;
  --white: #fbf9f3;
  --white-2: #efeadd;
  --black: #2b2823;
  --clue: #f3eee2;
  --line: #cfc8b8;
  --diag: #726b5e;
  --ink: var(--color-text, #2a2620);
  --accent: var(--color-accent-700, #b68235);
  --accent-soft: var(--color-accent-100, #f3e6c9);
  --accent-line: var(--color-accent, #b68235);
  --bad: #c0182b;
  display: flex; flex-direction: column; align-items: center; gap: clamp(14px, 3vw, 24px);
  padding: clamp(10px, 2.5vw, 22px) 0;
  color: var(--ink);
}
/* Board tonality is fixed by the surface panel (BOARD_SURFACES.md): the board
   follows our .mode-dark class only, never the OS colour-scheme. */
.kak-root.mode-dark {
  --white: #26241f; --white-2: #302d26; --black: #14130f;
  --clue: #e9e3d6; --line: #4a463f; --diag: #8b8577;
  --accent: var(--color-accent-400, #d8b65c); --accent-soft: #403715; --bad: #ff9384;
}

.kak-grid {
  display: grid; justify-content: center;
  background: var(--black);
  border: 2px solid var(--black); border-radius: 8px; overflow: hidden;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}

/* white number cells */
.kak-cell {
  position: relative;
  inline-size: var(--cell); block-size: var(--cell);
  display: flex; align-items: center; justify-content: center;
  box-sizing: border-box;
  background: var(--white); color: var(--accent);
  border-inline-end: 1px solid var(--line); border-block-end: 1px solid var(--line);
  font-family: var(--font-body, inherit); font-weight: 600;
  font-size: calc(var(--cell) * 0.46); font-variant-numeric: tabular-nums; line-height: 1;
  cursor: pointer; user-select: none; transition: background 0.1s;
}
.kak-cell.given { color: var(--ink); font-weight: 700; background: var(--white-2); }
.kak-cell.same { background: var(--accent-soft); }
.kak-cell.sel { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent-line); z-index: 2; }
.kak-cell.conflict { color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); }

/* black cells + clue triangles */
.kak-black {
  position: relative;
  inline-size: var(--cell); block-size: var(--cell);
  box-sizing: border-box; background: var(--black);
  border-inline-end: 1px solid var(--black); border-block-end: 1px solid var(--black);
}
.kak-hasclue {
  background:
    linear-gradient(to top right,
      transparent calc(50% - 0.7px), var(--diag) calc(50% - 0.7px),
      var(--diag) calc(50% + 0.7px), transparent calc(50% + 0.7px)),
    var(--black);
}
.kak-across, .kak-down {
  position: absolute; color: var(--clue);
  font-family: var(--font-body, inherit); font-weight: 700;
  font-size: calc(var(--cell) * 0.3); font-variant-numeric: tabular-nums; line-height: 1;
}
.kak-across { top: 8%; right: 10%; }   /* horizontal run to the right */
.kak-down { bottom: 8%; left: 10%; }   /* vertical run below */

/* number pad */
.kak-pad {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  max-inline-size: min(96vw, 460px);
}
.kak-key {
  min-inline-size: 44px; block-size: 46px; padding: 0 12px;
  border: 1.5px solid var(--line); border-radius: 9px; background: var(--white);
  color: var(--ink); font-family: var(--font-body, inherit);
  font-size: 19px; font-weight: 600; cursor: pointer; font-variant-numeric: tabular-nums;
}
.kak-key:hover { border-color: var(--accent-line); }
.kak-key:active { background: var(--accent-soft); }

@media (prefers-reduced-motion: reduce) { .kak-cell { transition: none; } }
.kak-root.no-motion .kak-cell { transition: none; }
