/* PairChamp chess board renderer styles (pairs with js/chess-board.js). */
.pcb-host { position: relative; }
.pcb {
  --pcb-light: #EEEED2;
  --pcb-dark: #769656;
  --pcb-select: rgba(255, 255, 51, 0.5);
  --pcb-last: rgba(255, 255, 51, 0.38);
  --pcb-dot: rgba(20, 30, 20, 0.24);
  --pcb-focus: #1F6FD1;
  --pcb-radius: 6px;
  position: relative;
  width: 100%;
  font-family: inherit;
  -webkit-user-select: none;
  user-select: none;
}
.pcb [hidden], .pcb-controls [hidden] { display: none !important; }
.pcb-board {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--pcb-radius);
  overflow: hidden;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.18);
  container-type: inline-size;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
@supports not (aspect-ratio: 1 / 1) {
  .pcb-board { height: 0; padding-bottom: 100%; }
}
/* Only an active (movable or drawing) board suppresses touch scrolling. */
.pcb-board.pcb-touch-lock { touch-action: none; }
.pcb-board.pcb-can-move { cursor: pointer; }
.pcb-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  outline: none;
}
.pcb-row { display: contents; }
.pcb-sq { position: relative; background: var(--pcb-light); }
.pcb-sq.is-dark { background: var(--pcb-dark); }
.pcb-sq.is-last::before,
.pcb-sq.is-selected::before { content: ""; position: absolute; inset: 0; background: var(--pcb-last); }
.pcb-sq.is-selected::before { background: var(--pcb-select); }
.pcb-sq.is-check::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 0, 0, 0.9) 0%, rgba(231, 0, 0, 0.55) 30%, rgba(169, 0, 0, 0) 72%);
}
.pcb-sq.is-mate::after { background: radial-gradient(circle, rgba(200, 0, 0, 1) 0%, rgba(180, 0, 0, 0.75) 45%, rgba(120, 0, 0, 0.15) 85%); }
.pcb-sq.is-hover { box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.75); }
.pcb-grid:focus-visible .pcb-sq.is-focus { box-shadow: inset 0 0 0 3px var(--pcb-focus); }
.pcb-marker { position: absolute; pointer-events: none; z-index: 3; }
.pcb-sq.is-target .pcb-marker {
  left: 50%; top: 50%; width: 30%; height: 30%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--pcb-dot);
}
.pcb-sq.is-capture .pcb-marker {
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, transparent 0 77%, var(--pcb-dot) 78% 100%);
}
.pcb-coord {
  position: absolute;
  z-index: 1;
  font-size: 11px;
  font-size: clamp(8px, 2.6cqi, 14px);
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}
.pcb-coord:empty { display: none; }
.pcb-coord-rank { top: 4%; left: 5%; }
.pcb-coord-file { bottom: 4%; right: 6%; }
.pcb-sq.is-light .pcb-coord { color: var(--pcb-dark); }
.pcb-sq.is-dark .pcb-coord { color: var(--pcb-light); }
.pcb-no-coords .pcb-coord { display: none; }
.pcb-pieces { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.pcb-piece {
  position: absolute;
  top: 0;
  left: 0;
  width: 12.5%;
  height: 12.5%;
  z-index: 2;
  will-change: transform;
}
.pcb-piece svg { display: block; width: 100%; height: 100%; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.28)); }
.pcb[data-piece-style="bold"] .pcb-piece svg { filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.35)); }
.pcb[data-piece-style="minimal"] .pcb-piece svg { filter: none; }
.pcb-animate .pcb-piece { transition: transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 180ms ease; }
.pcb-piece.pcb-dragging { transition: none !important; z-index: 10; cursor: grabbing; }
.pcb-piece.pcb-dragging svg { transform: scale(1.12); filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.35)); }
.pcb-piece.pcb-captured { opacity: 0; z-index: 1; }
.pcb-piece.pcb-appear { animation: pcb-appear 180ms ease-out; }
@keyframes pcb-appear { from { opacity: 0; transform-origin: center; } to { opacity: 1; } }
.pcb-annotations { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 6; }
.pcb-promo {
  position: absolute;
  z-index: 20;
  width: 12.5%;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}
.pcb-promo.pcb-promo-up { flex-direction: column-reverse; }
.pcb-promo-btn {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 6%;
  margin: 0;
  border: 0;
  background: #f2f2f2;
  cursor: pointer;
}
.pcb-promo-btn:hover, .pcb-promo-btn:focus-visible { background: #ffe680; outline: 3px solid var(--pcb-focus); outline-offset: -3px; }
.pcb-promo-btn svg { width: 100%; height: 100%; display: block; }
.pcb-promo-cancel { aspect-ratio: auto; padding: 4px 0; font-size: 18px; line-height: 1; color: #444; }
.pcb-sr {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Controls mounted with board.mountSettings(container) */
.pcb-controls { position: relative; min-width: 0; font-size: 14px; }
.pcb-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pcb-tools { display: inline-flex; flex-wrap: wrap; max-width: 100%; align-items: center; gap: 6px; }
.pcb-settings-btn { margin-left: auto; }
.pcb-btn {
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 8px;
  background: #fff;
  color: #1d2733;
  font: inherit;
  cursor: pointer;
}
.pcb-btn:hover { background: #f3f5f8; }
.pcb-btn:focus-visible, .pcb-swatch:focus-visible, .pcb-annot-color:focus-visible { outline: 3px solid var(--pcb-focus, #1F6FD1); outline-offset: 2px; }
.pcb-btn[aria-pressed="true"] { background: #1d2733; color: #fff; }
.pcb-annot-colors { display: inline-flex; gap: 4px; }
.pcb-annot-color {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
  background: var(--pcb-annot);
  cursor: pointer;
}
.pcb-annot-color[aria-checked="true"] { box-shadow: 0 0 0 3px #1d2733; }
.pcb-settings {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  max-width: 440px;
  min-width: 0;
  max-height: 60vh;
  max-height: 60dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 10px 0 0 auto;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #fff;
  color: #1d2733;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}
.pcb-settings-title { font-weight: 700; }
.pcb-swatches { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr)); gap: 6px; }
.pcb-swatch {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 4px 8px 4px 4px;
  border-radius: 8px;
  border: 2px solid rgba(0, 0, 0, 0.12);
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.pcb-swatch-chip {
  flex: none;
  width: 28px; height: 28px;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
  background: linear-gradient(135deg, var(--pcb-sw-light) 0 50%, var(--pcb-sw-dark) 50% 100%);
}
.pcb-swatch[aria-checked="true"] { border-color: #1d2733; font-weight: 700; }
.pcb-swatch-label { overflow-wrap: anywhere; }

/* High Contrast theme: stronger outlines and markers in addition to the square colors. */
.pcb[data-theme="high-contrast"] { --pcb-select: rgba(255, 140, 0, 0.6); --pcb-last: rgba(255, 212, 0, 0.55); --pcb-dot: rgba(0, 0, 0, 0.6); --pcb-focus: #D40000; }
.pcb[data-theme="high-contrast"] .pcb-sq.is-light .pcb-coord { color: #000; }
.pcb[data-theme="high-contrast"] .pcb-sq.is-dark .pcb-coord { color: #fff; }
.pcb[data-theme="high-contrast"] .pcb-sq.is-last { box-shadow: inset 0 0 0 3px #000; }
.pcb[data-theme="high-contrast"] .pcb-sq.is-selected { box-shadow: inset 0 0 0 4px #D40000; }
.pcb[data-theme="high-contrast"] .pcb-sq.is-dark.is-target .pcb-marker { background: rgba(255, 255, 255, 0.85); }
.pcb[data-theme="high-contrast"] .pcb-piece-b svg { filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff); }
.pcb[data-theme="high-contrast"] .pcb-piece-w svg { filter: drop-shadow(0 0 1px #000); }
.pcb-field { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.pcb-select { min-width: 0; max-width: 100%; min-height: 32px; font: inherit; }
.pcb-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.pcb-check input { width: 18px; height: 18px; }
.pcb-settings-close { justify-self: end; }

@media (pointer: coarse) {
  .pcb-controls .pcb-btn, .pcb-swatch, .pcb-select { min-height: 44px; }
  .pcb-annot-color { width: 40px; height: 40px; }
  .pcb-check { min-height: 40px; }
  .pcb-select { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .pcb-animate .pcb-piece { transition: none; }
  .pcb-piece.pcb-appear { animation: none; }
}
@media (prefers-color-scheme: dark) {
  .pcb-settings, .pcb-btn { background: #1f2630; color: #e8edf3; border-color: rgba(255, 255, 255, 0.18); }
  .pcb-btn:hover { background: #2a3340; }
  .pcb-btn[aria-pressed="true"] { background: #e8edf3; color: #1f2630; }
  .pcb-swatch[aria-checked="true"] { border-color: #e8edf3; }
  .pcb-swatch { border-color: rgba(255, 255, 255, 0.18); }
}