/* =============================================================
   GAME: Killer Sudoku — dashed cages with sums, rose neon
   ============================================================= */
.board-killersudoku {
  --cell: min(calc((100vw - 76px) / 9), 52px);
  --ks-glow: #ff5468;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.ks-grid {
  display: grid; grid-template-columns: repeat(9, var(--cell)); grid-auto-rows: var(--cell); gap: 1px;
  position: relative; padding: 3px; border-radius: 14px;
  background: linear-gradient(160deg, #5a1a2c, #3a0e1c 60%, #521a2a);
  box-shadow: 0 0 0 2px var(--ks-glow), 0 0 28px rgba(255, 84, 104, .36), 0 12px 30px rgba(0, 0, 0, .35);
}
.ks-boxes {
  position: absolute; inset: 3px; z-index: 3; pointer-events: none; border-radius: 10px; overflow: hidden;
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
}
.ks-boxes i { border: 1px solid rgba(255, 108, 128, .95); }
.ks-cell {
  position: relative; border: 0; padding: 0; margin: 0; cursor: pointer; border-radius: 2px;
  background: linear-gradient(180deg, #2a1220, #1f0d18); color: #ffd0d8;
  font: 600 calc(var(--cell) * .5) / 1 var(--font-body); font-variant-numeric: tabular-nums;
  display: grid; place-items: center;
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.ks-cell:nth-child(1) { border-top-left-radius: 10px; }
.ks-cell:nth-child(9) { border-top-right-radius: 10px; }
.ks-cell:nth-child(73) { border-bottom-left-radius: 10px; }
.ks-cell:nth-child(81) { border-bottom-right-radius: 10px; }
.ks-cell.ks-bl { margin-left: 2px; }
.ks-cell.ks-bt { margin-top: 2px; }
/* cage outline: dashed line on the sides that face another cage */
.ks-cell::before {
  content: ""; position: absolute; inset: -1px; pointer-events: none;
  border: 0 dashed rgba(255, 196, 206, .62);
}
.ks-cell.ks-ct::before { top: 3px; border-top-width: 1.5px; }
.ks-cell.ks-cb::before { bottom: 3px; border-bottom-width: 1.5px; }
.ks-cell.ks-cl::before { left: 3px; border-left-width: 1.5px; }
.ks-cell.ks-cr::before { right: 3px; border-right-width: 1.5px; }
.ks-sum {
  position: absolute; left: 4px; top: 3px; z-index: 1;
  font: 800 max(9px, calc(var(--cell) * .22)) / 1 var(--font-body); color: #ffe9a8;
  background: #1f0d18; padding: 0 1px; border-radius: 2px; letter-spacing: -.02em;
}
.ks-sum:empty { display: none; }
.ks-cell:hover { background: #3a1a2c; }
.ks-cell:focus { outline: none; }
.ks-cell:focus-visible { box-shadow: inset 0 0 0 2px var(--focus); }
.ks-cell.ks-user { color: #ffb3c0; text-shadow: 0 0 10px rgba(255, 84, 104, .45); }
.ks-cell.ks-peer { background: #331526; }
.ks-cell.ks-peer .ks-sum { background: #331526; }
.ks-cell.ks-incage { background: #44203a; }
.ks-cell.ks-incage .ks-sum { background: #44203a; }
.ks-cell.ks-incage::before { border-color: #ffe9a8; }
.ks-cell.ks-same { background: #5a1f38; color: #fff; }
.ks-cell.ks-same .ks-sum { background: #5a1f38; }
.ks-cell.ks-sel { background: linear-gradient(180deg, #a3324e, #7d2440); color: #fff; box-shadow: inset 0 0 0 2px var(--ks-glow), 0 0 12px rgba(255, 84, 104, .55); z-index: 2; }
.ks-cell.ks-sel .ks-sum { background: transparent; }
.ks-cell.ks-sel::before { border-color: #ffe9a8; }
.ks-cell.ks-cagebad .ks-sum { color: #fff; background: var(--t-red); }
.ks-cell.ks-conflict { color: var(--t-red); text-shadow: 0 0 10px rgba(255, 61, 127, .55); }
.ks-cell.ks-conflict::after {
  content: ""; position: absolute; inset: 4px; border-radius: 4px; box-shadow: inset 0 0 0 2px rgba(255, 61, 127, .8);
}
.ks-cell.ks-pop .ks-v { display: inline-block; animation: kspop .28s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes kspop { from { transform: scale(.4); opacity: .2; } }
.ks-cell.ks-conflict.ks-pop .ks-v { animation: ksshake .32s ease; }
@keyframes ksshake { 25% { transform: translateX(-3px); } 50% { transform: translateX(3px); } 75% { transform: translateX(-2px); } }
.ks-cell.ks-flash { animation: ksflash .7s ease both; }
@keyframes ksflash { 35% { background: #c43a5e; color: #fff; box-shadow: 0 0 14px rgba(255, 84, 104, .8); } }
.ks-cell.ks-done { animation: kswin .6s ease both; }
.ks-cell.ks-done:nth-child(9n+2), .ks-cell.ks-done:nth-child(9n+4) { animation-delay: .06s; }
.ks-cell.ks-done:nth-child(9n+6), .ks-cell.ks-done:nth-child(9n+8) { animation-delay: .12s; }
@keyframes kswin { 50% { background: #b8304f; color: #fff; } }
.ks-cell:disabled { cursor: default; }
.ks-loading .ks-cell { background: #1f0d18; animation: ksload 1.2s ease-in-out infinite alternate; }
.ks-loading .ks-cell:nth-child(2n) { animation-delay: .3s; }
@keyframes ksload { to { background: #33152a; } }
.ks-v:empty { display: none; }
.ks-notes {
  position: absolute; inset: 24% 3px 2px 3px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  font: 600 calc(var(--cell) * .2) / 1 var(--font-body); color: #e0a8b8; pointer-events: none;
}
.ks-notes span { display: grid; place-items: center; visibility: hidden; border-radius: 3px; }
.ks-notes span.on { visibility: visible; }
.ks-notes span.hl { background: rgba(255, 84, 104, .35); color: #fff; }

.ks-info { margin: 0; min-height: 1.3em; font-size: .88rem; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }

/* number pad */
.ks-pad { display: grid; grid-template-columns: repeat(9, 1fr); gap: 5px; width: calc(var(--cell) * 9 + 18px); max-width: 100%; }
.ks-key, .ks-act {
  border: 0; cursor: pointer; border-radius: 10px; color: var(--ink);
  background: linear-gradient(180deg, var(--surface-3), var(--surface-2));
  box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, .08), 0 2px 0 rgba(0, 0, 0, .35);
  font: 700 1.25rem/1 var(--font-body); transition: transform .1s, box-shadow .15s, background .15s;
}
.ks-key { position: relative; min-height: 46px; padding: 0; }
.ks-key small { position: absolute; right: 4px; bottom: 3px; font-size: .62rem; font-weight: 600; color: var(--muted); }
.ks-key:hover, .ks-act:hover { box-shadow: inset 0 0 0 1px var(--ks-glow); }
.ks-key:active, .ks-act:active { transform: translateY(2px); }
.ks-key.ks-used { opacity: .35; }
.ks-notes-on .ks-key { color: #e0a8b8; font-size: .95rem; font-weight: 600; box-shadow: inset 0 0 0 1px rgba(255, 84, 104, .5); }
.ks-act {
  grid-column: span 4; min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: .9rem; padding: 6px 10px;
}
.ks-notes-btn { grid-column: 1 / span 5; }
.ks-act[aria-pressed="true"] { background: linear-gradient(135deg, #d63c5c, #8e1f3a); color: #fff; box-shadow: 0 0 0 1px var(--ks-glow), 0 0 16px rgba(255, 84, 104, .4); }
.ks-key:disabled, .ks-act:disabled { opacity: .4; cursor: default; transform: none; }
.ks-key:focus-visible, .ks-act:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ks-pencil { width: 14px; height: 4px; background: currentColor; border-radius: 1px 0 0 1px; transform: rotate(-45deg); position: relative; }
.ks-pencil::after { content: ""; position: absolute; right: -4px; top: 0; border: 2px solid transparent; border-left: 4px solid currentColor; }
.ks-eraser { width: 13px; height: 8px; border: 2px solid currentColor; border-radius: 2px; transform: rotate(-30deg); background: linear-gradient(90deg, currentColor 40%, transparent 40%); }

.ks-clock { font-variant-numeric: tabular-nums; }
.ks-tag { font-size: .8rem; padding: 2px 10px; border-radius: 999px; background: rgba(255, 84, 104, .18); color: #ffc2cc; }
@media (prefers-reduced-motion: reduce) {
  .ks-cell { transition: none; }
}
