.board {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(var(--n), 1fr);
  grid-template-rows: repeat(var(--n), 1fr);
  border-left: 1px solid rgba(15, 23, 42, 0.08);
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  z-index: 1;
}

.cell {
  position: relative;
  border-right: 1px solid rgba(15, 23, 42, 0.08);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  user-select: none;
}

.cell:nth-child(n + 1) {
  /* no-op: keep specificity */
}

.cell.isEndpoint {
  background: rgba(37, 99, 235, 0.06);
}

.cell.isActive {
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.55);
}

.cell.isInvalid {
  box-shadow: inset 0 0 0 2px var(--danger);
}

.cell.isFilled {
  background: color-mix(in srgb, var(--pair-color), transparent 78%);
}

/* Labels are rendered in a separate overlay layer */
.labels {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(var(--n), 1fr);
  grid-template-rows: repeat(var(--n), 1fr);
  pointer-events: none;
  z-index: 3;
}

.label {
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: clamp(12px, 2.6vw, 18px);
  color: color-mix(in srgb, var(--pair-color), white 18%);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}

.paths {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.paths path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.08));
}

.app, .boardWrap, .board, .cell, .paths, .labels {
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.touchLens {
  position: absolute;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.25);
  border: 1px solid rgba(15, 23, 42, 0.12);
  overflow: hidden;
  pointer-events: none;
  z-index: 20;
  display: none;
}

.touchLens__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 100%;
  height: 100%;
}

.touchLens__cell {
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  border: 1px solid rgba(15, 23, 42, 0.18);
  background: transparent;
  user-select: none;
}
