/* =============================================================
   GAME: Calcudoku
   ============================================================= */
.board-calcudoku {
  --n: 6;
  --cell: min(calc((100vw - 70px) / var(--n)), 68px);
  --cc-glow: #5dffa0;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.cc-grid {
  display: grid; grid-auto-rows: var(--cell); gap: 1px; padding: 4px; border-radius: 14px;
  background: linear-gradient(160deg, #1f5a40, #143a2b 60%, #1c5039);
  box-shadow: 0 0 0 2px var(--cc-glow), 0 0 28px rgba(93, 255, 160, .32), 0 12px 30px rgba(0, 0, 0, .35);
}
.cc-cell {
  position: relative; border: 0; padding: calc(var(--cell) * .14) 0 0; margin: 0; cursor: pointer;
  background: linear-gradient(180deg, #0f2a20, #0b1f18) #0d251c; color: #9dffc6;
  font: 700 calc(var(--cell) * .46) / 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;
}
/* cage outlines: thick border on each side that faces another cage */
.cc-cell::before { content: ""; position: absolute; inset: -1px; border: 0 solid #8affbf; pointer-events: none; z-index: 2; border-radius: inherit; }
.cc-cell[data-edges*="t"]::before { border-top-width: 2.5px; }
.cc-cell[data-edges*="r"]::before { border-right-width: 2.5px; }
.cc-cell[data-edges*="b"]::before { border-bottom-width: 2.5px; }
.cc-cell[data-edges*="l"]::before { border-left-width: 2.5px; }
.cc-lbl {
  position: absolute; top: calc(var(--cell) * .05); left: calc(var(--cell) * .08); z-index: 3;
  font: 800 calc(var(--cell) * .22) / 1 var(--font-body); color: #d6ffe6; letter-spacing: -.02em; white-space: nowrap;
  text-shadow: 0 0 6px rgba(93, 255, 160, .5); pointer-events: none;
}
.cc-cell:hover { background: #163a2c; }
.cc-cell:focus { outline: none; }
.cc-cell:focus-visible { box-shadow: inset 0 0 0 2px var(--focus); }
.cc-cell.cc-user { color: #c9ffe0; text-shadow: 0 0 10px rgba(93, 255, 160, .45); }
.cc-cell.cc-peer { background: #143528; }
.cc-cell.cc-mate { background: #1a4634; }
.cc-cell.cc-same { background: #20573f; color: #fff; }
.cc-cell.cc-sel { background: linear-gradient(180deg, #2d8a5e, #22704b) #287d55; box-shadow: inset 0 0 0 2px var(--cc-glow), 0 0 12px rgba(93, 255, 160, .55); z-index: 1; color: #fff; }
.cc-cell.cc-okcage .cc-lbl { opacity: .5; text-shadow: none; }
.cc-cell.cc-badcage .cc-lbl { color: var(--t-red); text-shadow: 0 0 6px rgba(255, 61, 127, .6); }
.cc-cell.cc-conflict { color: var(--t-red); text-shadow: 0 0 10px rgba(255, 61, 127, .55); }
.cc-cell.cc-conflict::after {
  content: ""; position: absolute; inset: 3px; border-radius: 5px; box-shadow: inset 0 0 0 2px rgba(255, 61, 127, .7); pointer-events: none;
}
.cc-cell.cc-pop .cc-v { display: inline-block; animation: ccpop .28s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes ccpop { from { transform: scale(.4); opacity: .2; } }
.cc-cell.cc-conflict.cc-pop .cc-v { animation: ccshake .32s ease; }
@keyframes ccshake { 25% { transform: translateX(-3px); } 50% { transform: translateX(3px); } 75% { transform: translateX(-2px); } }
.cc-cell.cc-flash { animation: ccflash .7s ease both; }
@keyframes ccflash { 35% { background: #2fae6e; color: #fff; box-shadow: 0 0 14px rgba(93, 255, 160, .8); } }
.cc-cell.cc-done { animation: ccwin .7s ease both; }
.cc-cell.cc-done:nth-child(even) { animation-delay: .08s; }
@keyframes ccwin { 50% { background: #2a9a62; color: #fff; } }
.cc-cell:disabled { cursor: default; }
.cc-loading .cc-cell { background: #0d221a; animation: ccload 1.2s ease-in-out infinite alternate; }
.cc-loading .cc-cell:nth-child(3n) { animation-delay: .3s; }
.cc-loading .cc-cell::before { border-width: 0 !important; }
@keyframes ccload { to { background: #133126; } }
.cc-v:empty { display: none; }
.cc-notes {
  position: absolute; top: calc(var(--cell) * .3); left: 3px; right: 3px; bottom: 3px;
  display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr;
  font: 600 calc(var(--cell) * .18) / 1 var(--font-body); color: #9ad8b4; pointer-events: none;
}
.cc-notes span { display: grid; place-items: center; visibility: hidden; border-radius: 3px; }
.cc-notes span.on { visibility: visible; }
.cc-notes span.hl { background: rgba(93, 255, 160, .28); color: #fff; }

/* number pad */
.cc-pad {
  --keys: 6;
  display: grid; grid-template-columns: repeat(var(--keys), 1fr); gap: 6px;
  width: min(100%, calc(var(--keys) * 58px)); min-width: min(100%, 280px);
}
.cc-key, .cc-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;
}
.cc-key { position: relative; min-height: 48px; padding: 0; }
.cc-key small { position: absolute; right: 5px; bottom: 3px; font-size: .62rem; font-weight: 600; color: var(--muted); }
.cc-key:hover, .cc-act:hover { box-shadow: inset 0 0 0 1px var(--cc-glow); }
.cc-key:active, .cc-act:active { transform: translateY(2px); box-shadow: inset 0 0 0 1px var(--cc-glow), 0 0 0 rgba(0, 0, 0, .35); }
.cc-key.cc-used { opacity: .35; }
.cc-notes-on .cc-key { color: #9ad8b4; font-size: .95rem; font-weight: 600; box-shadow: inset 0 0 0 1px rgba(93, 255, 160, .5); }
.cc-act {
  grid-column: span 2; min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: .9rem; padding: 6px 10px;
}
.cc-act[aria-pressed="true"] { background: linear-gradient(135deg, #22a865, #17804b); color: #fff; box-shadow: 0 0 0 1px var(--cc-glow), 0 0 16px rgba(93, 255, 160, .4); }
.cc-key:disabled, .cc-act:disabled { opacity: .4; cursor: default; transform: none; }
.cc-key:focus-visible, .cc-act:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.cc-pencil { width: 14px; height: 4px; background: currentColor; border-radius: 1px 0 0 1px; transform: rotate(-45deg); position: relative; }
.cc-pencil::after { content: ""; position: absolute; right: -4px; top: 0; border: 2px solid transparent; border-left: 4px solid currentColor; }
.cc-eraser { width: 13px; height: 8px; border: 2px solid currentColor; border-radius: 2px; transform: rotate(-30deg); background: linear-gradient(90deg, currentColor 40%, transparent 40%); }

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