/* Unnatural Games — chess + connect 4 board styling. Requires /css/base.css first. */

.uni-board {
  position: relative;
  display: block;
  width: 100%;
  max-width: var(--board-max-size, none);
  max-height: var(--board-max-height, 100%);
  margin-inline: auto;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.uni-board--chess { aspect-ratio: 1 / 1; }
.uni-board--c4 { aspect-ratio: 748 / 788; }

.uni-board__svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  outline: none;
  touch-action: manipulation;
}
.uni-board--chess .uni-board__svg {
  border-radius: 1.6%;
  overflow: hidden;
  box-shadow: 0 0 0 2px rgba(250, 74, 158, 0.28), 0 22px 60px rgba(0, 0, 0, 0.55), 0 0 60px rgba(89, 19, 55, 0.5);
}
.uni-board--chess.is-interactive .uni-board__svg { touch-action: none; cursor: pointer; }
.uni-board--c4.is-interactive .uni-board__svg { cursor: pointer; touch-action: pan-y; }
.uni-board--c4.is-view-only .uni-board__svg { cursor: default; }
.uni-board__svg:focus-visible { outline: 2px solid var(--uni-lime, #BAF837); outline-offset: 4px; }

.uni-board__live {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---- chess ---- */
.uni-coord {
  font: 700 19px/1 var(--font-mono, "JetBrains Mono", ui-monospace, monospace);
  opacity: 0.78;
  pointer-events: none;
}

.uni-piece {
  transition: transform 0.34s var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)), opacity 0.26s ease;
  will-change: transform;
}
.uni-piece.is-leaving { opacity: 0; }
.uni-piece.is-entering { animation: uni-piece-in 0.34s ease both; }
.uni-piece.is-dragging { transition: none; opacity: 0.96; }
@keyframes uni-piece-in { from { opacity: 0; } to { opacity: 1; } }

.uni-check { animation: uni-check-pulse 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes uni-check-pulse {
  0%, 100% { opacity: 0.85; transform: scale(0.96); }
  50% { opacity: 1; transform: scale(1.04); }
}

.uni-arrow.is-lead { animation: uni-arrow-pulse 1.3s ease-in-out infinite; }
@keyframes uni-arrow-pulse {
  0%, 100% { opacity: 0.78; }
  50% { opacity: 1; }
}
.uni-arrow__count {
  font: 700 21px/1 var(--font-mono, "JetBrains Mono", ui-monospace, monospace);
}

/* ---- connect 4 ---- */
.uni-c4-count {
  font: 700 25px/1 var(--font-mono, "JetBrains Mono", ui-monospace, monospace);
  pointer-events: none;
}
.uni-c4-bubble.is-lead {
  animation: uni-bubble-pulse 1.2s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes uni-bubble-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
.uni-c4-ghost { opacity: 0.9; }
.uni-board--c4 .is-dim { opacity: 0.3; transition: opacity 0.4s ease; }
.uni-c4-winring {
  animation: uni-win-pulse 0.95s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes uni-win-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .uni-piece { transition: none; }
  .uni-check, .uni-arrow.is-lead, .uni-c4-bubble.is-lead, .uni-c4-winring { animation: none; }
}
