/* Pairlink tokens: dark mode only changes these values. Twelve pair colours, each with an ink for its letter. */
:root {
  --g-pairlink: #e5383b;
  --pl-cell: #ffffff;
  --pl-line: #dcdcd8;
  --pl-frame: #1b1b1b;
  --pl-tint: 20%;
  --pl-c0: #e5383b;
  --pl-c1: #2f6fde;
  --pl-c2: #2f9e44;
  --pl-c3: #f2c018;
  --pl-c4: #f07c1a;
  --pl-c5: #1cb5c9;
  --pl-c6: #d63aa8;
  --pl-c7: #8d5a2b;
  --pl-c8: #7b4fd6;
  --pl-c9: #8fcf2e;
  --pl-c10: #34495e;
  --pl-c11: #ff8fa3;
  --pl-ink-light: #ffffff;
  --pl-ink-dark: #1b1b1b;
}
:root[data-theme='dark'] {
  --g-pairlink: #ff5c5f;
  --pl-cell: #1a1a1a;
  --pl-line: var(--board-grid);
  --pl-frame: #f2f2f2;
  --pl-tint: 28%;
  --pl-c0: #ff5c5f;
  --pl-c1: #5b8ff0;
  --pl-c2: #46c25e;
  --pl-c3: #f5cd3a;
  --pl-c4: #ff9640;
  --pl-c5: #33cde0;
  --pl-c6: #ef5cc4;
  --pl-c7: #b07a45;
  --pl-c8: #9c78ef;
  --pl-c9: #a6e04a;
  --pl-c10: #8aa0b8;
  --pl-c11: #ff9fb1;
  --pl-ink-light: #ffffff;
  --pl-ink-dark: #121212;
}

.pairlink-shell {
  --game-accent: var(--g-pairlink);
}
.pairlink-shell .shell-stage {
  gap: var(--space-3);
  padding: 0 var(--space-4);
}
.pairlink-shell .shell-board-area {
  display: flex;
  width: 100%;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}
.pairlink-board-wrap {
  width: min(
    calc(520px * max(1, var(--cols) / var(--rows))),
    calc(100vw - 32px),
    calc((100dvh - 260px) * var(--cols) / var(--rows))
  );
  margin: 0 auto;
}
.pairlink-board {
  position: relative;
  display: grid;
  overflow: hidden;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  grid-template-rows: repeat(var(--rows), minmax(0, 1fr));
  aspect-ratio: var(--cols) / var(--rows);
  border: 2px solid var(--pl-frame);
  border-radius: 12px;
  background: var(--pl-cell);
  /* Drawing must not scroll or zoom the page. */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.pairlink-cell {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
  padding: 0;
  border: 0;
  border-right: 1px solid var(--pl-line);
  border-bottom: 1px solid var(--pl-line);
  border-radius: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pairlink-cell.on {
  background: color-mix(in srgb, var(--c) var(--pl-tint), var(--pl-cell));
}
.pairlink-cell.hint-context {
  box-shadow: inset 0 0 0 3px var(--hint-context);
}
.pairlink-cell.hint-target {
  box-shadow: inset 0 0 0 3px var(--hint-target);
}
.pairlink-cell:focus-visible {
  outline: 0;
  box-shadow: inset 0 0 0 3px var(--text);
}
/* A colour the hint concludes for a cell: a small ring in that colour. */
.pairlink-paint {
  width: 34%;
  aspect-ratio: 1;
  border: 3px solid var(--c);
  border-radius: 50%;
}
/* Dots sit above the lines so their letters stay readable. */
.pairlink-dot {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 70%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--c);
  color: var(--ink);
  font: 800 clamp(11px, 3.6vw, 20px) / 1 var(--font-app);
}
.pairlink-dot.joined {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 40%, transparent);
}
.pairlink-layer {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.pairlink-path {
  fill: none;
  stroke: var(--c);
  stroke-width: 0.36;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pairlink-head {
  fill: var(--pl-cell);
  stroke: var(--c);
  stroke-width: 0.08;
}
.pairlink-hint-edges line {
  stroke-width: 0.12;
  stroke-linecap: round;
}
.pairlink-hint-edges .on {
  stroke: var(--hint-target);
  stroke-dasharray: 0.15 0.12;
}
.pairlink-hint-edges .off {
  stroke: var(--danger);
  stroke-dasharray: 0.06 0.1;
  opacity: 0.8;
}
.pairlink-board.solved .pairlink-path {
  animation: pairlink-glow 900ms ease-out;
}
@keyframes pairlink-glow {
  50% {
    stroke-width: 0.5;
  }
}
@media (prefers-reduced-motion: reduce) {
  .pairlink-board.solved .pairlink-path {
    animation: none;
  }
}
.pairlink-status {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}
.pairlink-status b {
  color: var(--text);
}

/* Picture rules: the 3 × 3 demo board, drawn with the real cells and lines, fills its stage. */
.pairlink-demo-board {
  position: relative;
  width: 100%;
}
.pairlink-demo-board .pairlink-cell {
  cursor: default;
}
.pairlink-demo-board .pairlink-dot {
  font-size: 26px;
}
