/* Calcudoku — ink on washi. */
.cd-defs { position: absolute; }
.cd-col { gap: 10px; }
.cd-grid {
  position: relative;
  display: grid;
  width: var(--w, 320px);
  height: var(--w, 320px);
  border: 3px solid #0B1F1C;
  border-radius: 6px;
  direction: ltr;
  color: #0B1F1C;
  background:
    repeating-linear-gradient(17deg, rgba(138, 90, 51, 0.07) 0 1px, transparent 1px 23px),
    repeating-linear-gradient(-71deg, rgba(138, 90, 51, 0.05) 0 1px, transparent 1px 37px),
    repeating-linear-gradient(98deg, rgba(255, 255, 255, 0.2) 0 2px, transparent 2px 53px),
    radial-gradient(120% 90% at 20% 10%, #F8F2E0 0%, #F1EAD6 55%, #E6DCC0 100%);
  box-shadow: 0 0 0 5px #EAD9A8, 0 0 0 6px rgba(11, 31, 28, 0.5), 0 20px 44px rgba(0, 0, 0, 0.4);
}
.cd-cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #0B1F1C;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.12s linear;
}
.cd-cell.is-peer { background: rgba(31, 122, 99, 0.09); }
.cd-cell.is-same { background: rgba(184, 137, 59, 0.24); }
.cd-cell.is-sel { background: rgba(31, 122, 99, 0.3); }
.cd-cell.is-bad { color: #C7361F; }
.cd-cell.is-bad:not(.is-sel) { background: rgba(226, 85, 58, 0.14); }
.cd-cell:focus-visible { outline: 3px solid #1F7A63; outline-offset: -4px; }
.cd-tag {
  position: absolute;
  top: 0.07em; left: 0.1em;
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: max(10.5px, 0.2em);
  font-weight: 750;
  line-height: 1;
  color: #0B1F1C;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}
.cd-tag.is-ok { color: #1F7A63; }
.cd-tag.is-bad { color: #C7361F; }
.cd-v {
  position: absolute;
  top: 24%; left: 17%;
  width: 66%; height: 70%;
  pointer-events: none;
}
.cd-v svg, .cd-key svg, .cd-seal svg { display: block; width: 100%; height: 100%; overflow: visible; }
.cd-s2 { opacity: 0.92; }
svg.is-fresh .cd-s1 { stroke-dasharray: 100; animation: cd-write 0.34s ease-out both; }
svg.is-fresh .cd-s2 { animation: cd-press 0.2s ease-out both; }
@keyframes cd-write { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes cd-press { from { opacity: 0; stroke-width: 26; } to { opacity: 0.92; stroke-width: 15; } }
.cd-notes {
  position: absolute;
  right: 0; bottom: 0.1em; left: 0;
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: max(10px, 0.19em);
  font-weight: 650;
  letter-spacing: 0.12em;
  line-height: 1;
  text-align: center;
  color: #17463F;
  pointer-events: none;
}
.cd-seal {
  position: absolute;
  right: -3%; bottom: -3%;
  width: 30%; height: 30%;
  opacity: 0;
  transform: rotate(-7deg);
  mix-blend-mode: multiply;
  pointer-events: none;
}
.cd-seal.is-on { opacity: 0.88; animation: cd-stamp 0.34s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
@keyframes cd-stamp { from { opacity: 0; transform: rotate(-16deg) scale(2.4); } to { opacity: 0.88; transform: rotate(-7deg) scale(1); } }

.cd-pad {
  display: grid;
  gap: 7px;
  width: var(--w, 320px);
  flex: none;
  direction: ltr;
}
.cd-key {
  height: 58px;
  min-width: 0;
  padding: 7px 0;
  border: 0;
  border-radius: 12px;
  background: #F1EAD6;
  box-shadow: inset 0 -3px 0 rgba(138, 90, 51, 0.28), 0 4px 10px rgba(0, 0, 0, 0.25);
  color: #0B1F1C;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.cd-key:active { background: #EAD9A8; transform: translateY(1px); }
.cd-key.is-full { opacity: 0.45; }
.cd-pad.is-notes .cd-key { background: #DCE8DC; box-shadow: inset 0 0 0 2px #1F7A63, 0 4px 10px rgba(0, 0, 0, 0.25); }
.cd-pad.is-notes .cd-key svg { transform: scale(0.72); }
.cd-new { display: grid; gap: 12px; }
.cd-new .kit-pills { margin: 0; }
@media (max-height: 620px) { .cd-key { height: 44px; padding: 5px 0; } .cd-col { gap: 6px; } }
@media (prefers-reduced-motion: reduce) {
  svg.is-fresh .cd-s1, svg.is-fresh .cd-s2, .cd-seal.is-on { animation: none; }
}
@media (max-width: 350px) { .cd-chip2 { display: none; } }
/* Short landscape screens: the number pad moves beside the sheet. */
@media (orientation: landscape) and (max-height: 520px) {
  .cd-col { flex-direction: row; gap: 18px; }
  .cd-col .kit-status { display: none; }
  .cd-col .kit-board-wrap { flex: 0 0 46%; width: auto; height: 100%; justify-content: flex-end; }
  .cd-pad { width: 186px !important; grid-template-columns: repeat(3, 1fr) !important; }
  .cd-key { height: 48px; }
}
