/* PoodleChessgroundBoard вЂ” opt-in second engine styles.
 * Board-local only: inherits the surrounding `.puzzle-board` box, never
 * resizes it. Upstream lichess chessground renders into `.cg-mount` as
 * `.cg-wrap > cg-container > (cg-board, svg, coords)` with persistent
 * `<piece>` nodes; this file provides the structural layout (mirroring the
 * upstream base stylesheet, which is not loaded as a separate asset),
 * Poodle square colors, piece images per set, highlight/dest styling,
 * promotion dialog, terminal flashes, and overlay anchors. */

.cg-host {
  position: relative;
  display: block;
}

.cg-host:focus-visible {
  outline: 2px solid rgba(16, 185, 129, 0.65);
  outline-offset: 2px;
}

.cg-premove {
  position: absolute;
  z-index: 20;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 16px);
  padding: 4px 6px 4px 10px;
  border: 1px solid var(--border-color, #c9c9bd);
  border-radius: 12px;
  background: var(--card-bg, #fffdf6);
  color: var(--text-color, #232b24);
  box-shadow: 0 3px 14px #0002;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.3;
}
.cg-premove[hidden] { display: none; }
.cg-premove span { white-space: nowrap; }
.cg-premove button {
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid var(--border-color, #d5d5c9);
  border-radius: 8px;
  background: var(--button-bg, #efeddf);
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.cg-keyboard-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.cg-mount {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 100%;
  margin: 0 auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* --- upstream structural layout (cf. vendor/chessground/chessground.base.css) --- */
.cg-mount.cg-wrap {
  box-sizing: content-box;
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
}

.cg-mount cg-container {
  position: absolute;
  width: 100%;
  height: 100%;
  display: block;
  top: 0;
}

.cg-mount cg-board {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  line-height: 0;
  background-size: cover;
  border-radius: 6px;
}

.cg-mount.cg-wrap.manipulable cg-board {
  cursor: pointer;
}

.cg-mount cg-board square {
  position: absolute;
  top: 0;
  left: 0;
  width: 12.5%;
  height: 12.5%;
  pointer-events: none;
}

.cg-mount cg-board square.move-dest {
  pointer-events: auto;
}

.cg-mount cg-board square.last-move {
  will-change: transform;
}

.cg-mount.cg-wrap piece {
  position: absolute;
  top: 0;
  left: 0;
  width: 12.5%;
  height: 12.5%;
  background-size: cover;
  z-index: 2;
  will-change: transform;
  pointer-events: none;
}

.cg-mount cg-board piece.dragging {
  cursor: move;
  z-index: 11 !important;
}

.cg-mount piece.anim {
  z-index: 8;
}

.cg-mount piece.fading {
  z-index: 1;
  opacity: 0.5;
}

.cg-mount.cg-wrap piece.ghost {
  opacity: 0.3;
}

.cg-mount.cg-wrap cg-auto-pieces,
.cg-mount.cg-wrap .cg-shapes,
.cg-mount.cg-wrap .cg-custom-svgs,
.cg-mount.cg-wrap .cg-shapes-below,
.cg-mount.cg-wrap .cg-custom-below {
  overflow: visible;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.cg-mount.cg-wrap .cg-shapes {
  overflow: hidden;
  opacity: 0.6;
  z-index: 2;
}

.cg-mount.cg-wrap coords {
  position: absolute;
  display: flex;
  pointer-events: none;
  opacity: 0.8;
  font-family: sans-serif;
  font-size: 9px;
}

.cg-mount.cg-wrap coords.ranks {
  left: 4px;
  top: -20px;
  flex-flow: column-reverse;
  height: 100%;
  width: 12px;
}

.cg-mount.cg-wrap coords.ranks.black {
  flex-flow: column;
}

.cg-mount.cg-wrap coords.files {
  bottom: -4px;
  left: 24px;
  flex-flow: row;
  width: 100%;
  height: 16px;
  text-transform: uppercase;
  text-align: center;
}

.cg-mount.cg-wrap coords.files.black {
  flex-flow: row-reverse;
}

.cg-mount.cg-wrap coords coord {
  flex: 1 1 auto;
}

.cg-mount.cg-wrap coords.ranks coord {
  transform: translateY(39%);
}

/* --- Poodle square colors (checkerboard via conic gradient) --- */
.cg-mount cg-board {
  background-color: #f0d9b5;
  background-image: repeating-conic-gradient(#b58863 90deg, #f0d9b5 90deg 180deg, #b58863 180deg 270deg, #f0d9b5 270deg);
  background-size: 25% 25%;
}

.cg-mount[data-cg-theme="green"] cg-board {
  background-color: #eeeed2;
  background-image: repeating-conic-gradient(#769656 90deg, #eeeed2 90deg 180deg, #769656 180deg 270deg, #eeeed2 270deg);
  background-size: 25% 25%;
}

.cg-mount[data-cg-theme="tournament"] cg-board {
  background-color: #ebecd0;
  background-image: repeating-conic-gradient(#739552 90deg, #ebecd0 90deg 180deg, #739552 180deg 270deg, #ebecd0 270deg);
  background-size: 25% 25%;
}

.cg-mount[data-cg-theme="ocean"] cg-board {
  background-color: #dee3e6;
  background-image: repeating-conic-gradient(#8ca2ad 90deg, #dee3e6 90deg 180deg, #8ca2ad 180deg 270deg, #dee3e6 270deg);
  background-size: 25% 25%;
}

.cg-mount[data-cg-theme="midnight"] cg-board {
  background-color: #dee2e6;
  background-image: repeating-conic-gradient(#6c7a89 90deg, #dee2e6 90deg 180deg, #6c7a89 180deg 270deg, #dee2e6 270deg);
  background-size: 25% 25%;
}

.cg-mount[data-cg-theme="walnut"] cg-board {
  background-color: #e5c29f;
  background-image: repeating-conic-gradient(#9b6b43 90deg, #e5c29f 90deg 180deg, #9b6b43 180deg 270deg, #e5c29f 270deg);
  background-size: 25% 25%;
}

/* --- Poodle piece images per set (upstream renders piece.<role>.<color>) --- */
.cg-mount piece.pawn.white { background-image: url("/pieces/wP.svg"); }
.cg-mount piece.knight.white { background-image: url("/pieces/wN.svg"); }
.cg-mount piece.bishop.white { background-image: url("/pieces/wB.svg"); }
.cg-mount piece.rook.white { background-image: url("/pieces/wR.svg"); }
.cg-mount piece.queen.white { background-image: url("/pieces/wQ.svg"); }
.cg-mount piece.king.white { background-image: url("/pieces/wK.svg"); }
.cg-mount piece.pawn.black { background-image: url("/pieces/bP.svg"); }
.cg-mount piece.knight.black { background-image: url("/pieces/bN.svg"); }
.cg-mount piece.bishop.black { background-image: url("/pieces/bB.svg"); }
.cg-mount piece.rook.black { background-image: url("/pieces/bR.svg"); }
.cg-mount piece.queen.black { background-image: url("/pieces/bQ.svg"); }
.cg-mount piece.king.black { background-image: url("/pieces/bK.svg"); }

.cg-mount[data-piece-set="neo"] piece.pawn.white { background-image: url("/pieces/neo/wP.svg"); }
.cg-mount[data-piece-set="neo"] piece.knight.white { background-image: url("/pieces/neo/wN.svg"); }
.cg-mount[data-piece-set="neo"] piece.bishop.white { background-image: url("/pieces/neo/wB.svg"); }
.cg-mount[data-piece-set="neo"] piece.rook.white { background-image: url("/pieces/neo/wR.svg"); }
.cg-mount[data-piece-set="neo"] piece.queen.white { background-image: url("/pieces/neo/wQ.svg"); }
.cg-mount[data-piece-set="neo"] piece.king.white { background-image: url("/pieces/neo/wK.svg"); }
.cg-mount[data-piece-set="neo"] piece.pawn.black { background-image: url("/pieces/neo/bP.svg"); }
.cg-mount[data-piece-set="neo"] piece.knight.black { background-image: url("/pieces/neo/bN.svg"); }
.cg-mount[data-piece-set="neo"] piece.bishop.black { background-image: url("/pieces/neo/bB.svg"); }
.cg-mount[data-piece-set="neo"] piece.rook.black { background-image: url("/pieces/neo/bR.svg"); }
.cg-mount[data-piece-set="neo"] piece.queen.black { background-image: url("/pieces/neo/bQ.svg"); }
.cg-mount[data-piece-set="neo"] piece.king.black { background-image: url("/pieces/neo/bK.svg"); }

.cg-mount[data-piece-set="cburnett"] piece.pawn.white { background-image: url("/pieces/cburnett/wP.svg"); }
.cg-mount[data-piece-set="cburnett"] piece.knight.white { background-image: url("/pieces/cburnett/wN.svg"); }
.cg-mount[data-piece-set="cburnett"] piece.bishop.white { background-image: url("/pieces/cburnett/wB.svg"); }
.cg-mount[data-piece-set="cburnett"] piece.rook.white { background-image: url("/pieces/cburnett/wR.svg"); }
.cg-mount[data-piece-set="cburnett"] piece.queen.white { background-image: url("/pieces/cburnett/wQ.svg"); }
.cg-mount[data-piece-set="cburnett"] piece.king.white { background-image: url("/pieces/cburnett/wK.svg"); }
.cg-mount[data-piece-set="cburnett"] piece.pawn.black { background-image: url("/pieces/cburnett/bP.svg"); }
.cg-mount[data-piece-set="cburnett"] piece.knight.black { background-image: url("/pieces/cburnett/bN.svg"); }
.cg-mount[data-piece-set="cburnett"] piece.bishop.black { background-image: url("/pieces/cburnett/bB.svg"); }
.cg-mount[data-piece-set="cburnett"] piece.rook.black { background-image: url("/pieces/cburnett/bR.svg"); }
.cg-mount[data-piece-set="cburnett"] piece.queen.black { background-image: url("/pieces/cburnett/bQ.svg"); }
.cg-mount[data-piece-set="cburnett"] piece.king.black { background-image: url("/pieces/cburnett/bK.svg"); }

.cg-mount[data-piece-set="merida"] piece.pawn.white { background-image: url("/pieces/merida/wP.svg"); }
.cg-mount[data-piece-set="merida"] piece.knight.white { background-image: url("/pieces/merida/wN.svg"); }
.cg-mount[data-piece-set="merida"] piece.bishop.white { background-image: url("/pieces/merida/wB.svg"); }
.cg-mount[data-piece-set="merida"] piece.rook.white { background-image: url("/pieces/merida/wR.svg"); }
.cg-mount[data-piece-set="merida"] piece.queen.white { background-image: url("/pieces/merida/wQ.svg"); }
.cg-mount[data-piece-set="merida"] piece.king.white { background-image: url("/pieces/merida/wK.svg"); }
.cg-mount[data-piece-set="merida"] piece.pawn.black { background-image: url("/pieces/merida/bP.svg"); }
.cg-mount[data-piece-set="merida"] piece.knight.black { background-image: url("/pieces/merida/bN.svg"); }
.cg-mount[data-piece-set="merida"] piece.bishop.black { background-image: url("/pieces/merida/bB.svg"); }
.cg-mount[data-piece-set="merida"] piece.rook.black { background-image: url("/pieces/merida/bR.svg"); }
.cg-mount[data-piece-set="merida"] piece.queen.black { background-image: url("/pieces/merida/bQ.svg"); }
.cg-mount[data-piece-set="merida"] piece.king.black { background-image: url("/pieces/merida/bK.svg"); }

/* --- upstream square highlights --- */
.cg-mount cg-board square.selected {
  background-color: rgba(20, 85, 30, 0.5);
}

.cg-mount cg-board square.last-move {
  background-color: rgba(155, 199, 0, 0.41);
}

.cg-mount cg-board square.check {
  background: radial-gradient(circle, rgba(224, 49, 49, 0.9) 15%, rgba(224, 49, 49, 0.3) 55%, transparent 72%);
}

.cg-mount cg-board square.move-dest {
  background: radial-gradient(circle, rgba(20, 40, 30, 0.32) 22%, transparent 23%);
}

.cg-mount cg-board square.move-dest.oc {
  background: radial-gradient(circle, transparent 78%, rgba(20, 40, 30, 0.35) 79%);
}

.cg-mount cg-board square.current-premove {
  background-color: rgba(32, 120, 200, 0.5);
}

/* --- overlay anchor layer for host feedback badges --- */
.cg-mount .cg-anchors {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.cg-mount .cg-anchor {
  position: absolute;
  display: block;
  pointer-events: none;
}

/* --- Promotion chooser --- */
.cg-promo-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 20;
}

.cg-promo {
  position: absolute;
  width: 12.5%;
  height: 50%;
  z-index: 21;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.cg-promo-opt {
  flex: 1 1 0;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  cursor: pointer;
  border-radius: 4px;
}

.cg-promo-opt:hover,
.cg-promo-opt:focus-visible {
  background-color: rgba(16, 185, 129, 0.25);
  outline: none;
}

/* --- Visual-only terminal states (no canvas, no audio) --- */
.cg-host.cg-solved { animation: cg-flash-solved 1200ms ease-out; }
.cg-host.cg-failed { animation: cg-shake-failed 600ms ease-out; }
.cg-host.cg-correct { animation: cg-flash-correct 400ms ease-out; }
.cg-host.cg-wrong { animation: cg-flash-wrong 400ms ease-out; }

@keyframes cg-flash-solved {
  0%, 100% { box-shadow: none; }
  25% { box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.85); }
}

@keyframes cg-shake-failed {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-3px); }
  40% { transform: translateX(3px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}

@keyframes cg-flash-correct {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.8); }
}

@keyframes cg-flash-wrong {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: 0 0 0 3px rgba(224, 49, 49, 0.8); }
}

@media (prefers-reduced-motion: reduce) {
  .cg-mount.cg-wrap piece {
    transition: none !important;
    animation: none !important;
  }

  .cg-host.cg-solved { animation: none; box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.85); }
  .cg-host.cg-failed { animation: none; box-shadow: 0 0 0 4px rgba(224, 49, 49, 0.85); }
  .cg-host.cg-correct { animation: none; box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.8); }
  .cg-host.cg-wrong { animation: none; box-shadow: 0 0 0 3px rgba(224, 49, 49, 0.8); }
}

/* piece-sets-20260929 */
.cg-mount[data-piece-set="sport"] piece.pawn.white { background-image: url("/pieces/sport/wP.png"); }
.cg-mount[data-piece-set="sport"] piece.knight.white { background-image: url("/pieces/sport/wN.png"); }
.cg-mount[data-piece-set="sport"] piece.bishop.white { background-image: url("/pieces/sport/wB.png"); }
.cg-mount[data-piece-set="sport"] piece.rook.white { background-image: url("/pieces/sport/wR.png"); }
.cg-mount[data-piece-set="sport"] piece.queen.white { background-image: url("/pieces/sport/wQ.png"); }
.cg-mount[data-piece-set="sport"] piece.king.white { background-image: url("/pieces/sport/wK.png"); }
.cg-mount[data-piece-set="sport"] piece.pawn.black { background-image: url("/pieces/sport/bP.png"); }
.cg-mount[data-piece-set="sport"] piece.knight.black { background-image: url("/pieces/sport/bN.png"); }
.cg-mount[data-piece-set="sport"] piece.bishop.black { background-image: url("/pieces/sport/bB.png"); }
.cg-mount[data-piece-set="sport"] piece.rook.black { background-image: url("/pieces/sport/bR.png"); }
.cg-mount[data-piece-set="sport"] piece.queen.black { background-image: url("/pieces/sport/bQ.png"); }
.cg-mount[data-piece-set="sport"] piece.king.black { background-image: url("/pieces/sport/bK.png"); }
.cg-mount[data-piece-set="cosmos"] piece.pawn.white { background-image: url("/pieces/cosmos/wP.png"); }
.cg-mount[data-piece-set="cosmos"] piece.knight.white { background-image: url("/pieces/cosmos/wN.png"); }
.cg-mount[data-piece-set="cosmos"] piece.bishop.white { background-image: url("/pieces/cosmos/wB.png"); }
.cg-mount[data-piece-set="cosmos"] piece.rook.white { background-image: url("/pieces/cosmos/wR.png"); }
.cg-mount[data-piece-set="cosmos"] piece.queen.white { background-image: url("/pieces/cosmos/wQ.png"); }
.cg-mount[data-piece-set="cosmos"] piece.king.white { background-image: url("/pieces/cosmos/wK.png"); }
.cg-mount[data-piece-set="cosmos"] piece.pawn.black { background-image: url("/pieces/cosmos/bP.png"); }
.cg-mount[data-piece-set="cosmos"] piece.knight.black { background-image: url("/pieces/cosmos/bN.png"); }
.cg-mount[data-piece-set="cosmos"] piece.bishop.black { background-image: url("/pieces/cosmos/bB.png"); }
.cg-mount[data-piece-set="cosmos"] piece.rook.black { background-image: url("/pieces/cosmos/bR.png"); }
.cg-mount[data-piece-set="cosmos"] piece.queen.black { background-image: url("/pieces/cosmos/bQ.png"); }
.cg-mount[data-piece-set="cosmos"] piece.king.black { background-image: url("/pieces/cosmos/bK.png"); }
.cg-mount[data-piece-set="greek"] piece.pawn.white { background-image: url("/pieces/greek/wP.png?v=20260929-fit1"); }
.cg-mount[data-piece-set="greek"] piece.knight.white { background-image: url("/pieces/greek/wN.png?v=20260929-fit1"); }
.cg-mount[data-piece-set="greek"] piece.bishop.white { background-image: url("/pieces/greek/wB.png?v=20260929-fit1"); }
.cg-mount[data-piece-set="greek"] piece.rook.white { background-image: url("/pieces/greek/wR.png?v=20260929-fit1"); }
.cg-mount[data-piece-set="greek"] piece.queen.white { background-image: url("/pieces/greek/wQ.png?v=20260929-fit1"); }
.cg-mount[data-piece-set="greek"] piece.king.white { background-image: url("/pieces/greek/wK.png?v=20260929-fit1"); }
.cg-mount[data-piece-set="greek"] piece.pawn.black { background-image: url("/pieces/greek/bP.png?v=20260929-fit1"); }
.cg-mount[data-piece-set="greek"] piece.knight.black { background-image: url("/pieces/greek/bN.png?v=20260929-fit1"); }
.cg-mount[data-piece-set="greek"] piece.bishop.black { background-image: url("/pieces/greek/bB.png?v=20260929-fit1"); }
.cg-mount[data-piece-set="greek"] piece.rook.black { background-image: url("/pieces/greek/bR.png?v=20260929-fit1"); }
.cg-mount[data-piece-set="greek"] piece.queen.black { background-image: url("/pieces/greek/bQ.png?v=20260929-fit1"); }
.cg-mount[data-piece-set="greek"] piece.king.black { background-image: url("/pieces/greek/bK.png?v=20260929-fit1"); }
.cg-mount[data-piece-set="greek-icon"] piece.pawn.white { background-image: url("/pieces/greek-icon/wP.svg?v=20260930-gl1"); }
.cg-mount[data-piece-set="greek-icon"] piece.knight.white { background-image: url("/pieces/greek-icon/wN.svg?v=20260930-gl1"); }
.cg-mount[data-piece-set="greek-icon"] piece.bishop.white { background-image: url("/pieces/greek-icon/wB.svg?v=20260930-gl1"); }
.cg-mount[data-piece-set="greek-icon"] piece.rook.white { background-image: url("/pieces/greek-icon/wR.svg?v=20260930-gl1"); }
.cg-mount[data-piece-set="greek-icon"] piece.queen.white { background-image: url("/pieces/greek-icon/wQ.svg?v=20260930-gl1"); }
.cg-mount[data-piece-set="greek-icon"] piece.king.white { background-image: url("/pieces/greek-icon/wK.svg?v=20260930-gl1"); }
.cg-mount[data-piece-set="greek-icon"] piece.pawn.black { background-image: url("/pieces/greek-icon/bP.svg?v=20260930-gl1"); }
.cg-mount[data-piece-set="greek-icon"] piece.knight.black { background-image: url("/pieces/greek-icon/bN.svg?v=20260930-gl1"); }
.cg-mount[data-piece-set="greek-icon"] piece.bishop.black { background-image: url("/pieces/greek-icon/bB.svg?v=20260930-gl1"); }
.cg-mount[data-piece-set="greek-icon"] piece.rook.black { background-image: url("/pieces/greek-icon/bR.svg?v=20260930-gl1"); }
.cg-mount[data-piece-set="greek-icon"] piece.queen.black { background-image: url("/pieces/greek-icon/bQ.svg?v=20260930-gl1"); }
.cg-mount[data-piece-set="greek-icon"] piece.king.black { background-image: url("/pieces/greek-icon/bK.svg?v=20260930-gl1"); }
.cg-mount[data-piece-set="greek-lines"] piece.pawn.white { background-image: url("/pieces/greek-lines/wP.svg?v=20260930-gl1"); }
.cg-mount[data-piece-set="greek-lines"] piece.knight.white { background-image: url("/pieces/greek-lines/wN.svg?v=20260930-gl1"); }
.cg-mount[data-piece-set="greek-lines"] piece.bishop.white { background-image: url("/pieces/greek-lines/wB.svg?v=20260930-gl1"); }
.cg-mount[data-piece-set="greek-lines"] piece.rook.white { background-image: url("/pieces/greek-lines/wR.svg?v=20260930-gl1"); }
.cg-mount[data-piece-set="greek-lines"] piece.queen.white { background-image: url("/pieces/greek-lines/wQ.svg?v=20260930-gl1"); }
.cg-mount[data-piece-set="greek-lines"] piece.king.white { background-image: url("/pieces/greek-lines/wK.svg?v=20260930-gl1"); }
.cg-mount[data-piece-set="greek-lines"] piece.pawn.black { background-image: url("/pieces/greek-lines/bP.svg?v=20260930-gl1"); }
.cg-mount[data-piece-set="greek-lines"] piece.knight.black { background-image: url("/pieces/greek-lines/bN.svg?v=20260930-gl1"); }
.cg-mount[data-piece-set="greek-lines"] piece.bishop.black { background-image: url("/pieces/greek-lines/bB.svg?v=20260930-gl1"); }
.cg-mount[data-piece-set="greek-lines"] piece.rook.black { background-image: url("/pieces/greek-lines/bR.svg?v=20260930-gl1"); }
.cg-mount[data-piece-set="greek-lines"] piece.queen.black { background-image: url("/pieces/greek-lines/bQ.svg?v=20260930-gl1"); }
.cg-mount[data-piece-set="greek-lines"] piece.king.black { background-image: url("/pieces/greek-lines/bK.svg?v=20260930-gl1"); }
