/* board.css — chessboard component styles */

.cb-wrap {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; min-width: 0; min-height: 0;
}
.cb {
  position: relative;
  width: min(100%, calc(100cqh)); /* sized by mode container */
  aspect-ratio: 1;
  border: 1px solid var(--board-border);
  border-radius: 2px;
  outline: none;
  touch-action: none;
  user-select: none;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.25);
}
.cb.coords-outside { margin: 0 18px 18px 0; }

.cb-squares, .cb-layer { position: absolute; inset: 0; overflow: hidden; }
.cb-sq { position: absolute; width: 12.5%; height: 12.5%; }
.cb-sq.light { background: var(--sq-light); }
.cb-sq.dark { background: var(--sq-dark); }

.cb-hl { position: absolute; width: 12.5%; height: 12.5%; pointer-events: none; }
.hl-last { background: var(--sq-lastmove); }
.hl-sel { background: var(--sq-selected); }
.hl-premove { background: var(--sq-premove); }
.hl-check { background: radial-gradient(circle, var(--sq-check) 0%, transparent 72%); }
.hl-circle-green { box-shadow: inset 0 0 0 4px rgba(76, 160, 90, .85); border-radius: 50%; }
.hl-circle-red { box-shadow: inset 0 0 0 4px rgba(200, 70, 70, .85); border-radius: 50%; }
.hl-circle-blue { box-shadow: inset 0 0 0 4px rgba(70, 120, 200, .85); border-radius: 50%; }

.cb-hint { position: absolute; width: 12.5%; height: 12.5%; display: grid; place-items: center; pointer-events: none; }
.cb-hint::after { content: ''; width: 28%; height: 28%; border-radius: 50%; background: var(--sq-target); }
.cb-hint.capture::after { width: 82%; height: 82%; background: transparent; border: 4.5px solid var(--sq-target); }

.cb-piece {
  position: absolute; width: 12.5%; height: 12.5%;
  display: grid; place-items: center;
  cursor: grab; z-index: 3;
  transition: transform 120ms var(--ease);
  will-change: transform;
}
.cb-piece.no-anim { transition: none !important; }
.cb-piece.dragging { transition: none !important; z-index: 30; cursor: grabbing; }
.cb.blindfold .cb-piece .piece-svg { visibility: hidden; }

.piece-svg { width: 94%; height: 94%; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .35)); pointer-events: none; }
.piece-img { object-fit: contain; user-select: none; }

/* piece colors */
.piece-w .pc-body { fill: url(#pgw); }
.piece-w .pc-line { stroke: #3a4150; stroke-width: 3.2; stroke-linejoin: round; stroke-linecap: round; }
.piece-w .pc-cut { stroke: #3a4150; stroke-width: 4.5; stroke-linecap: round; }
.piece-w .pc-gleam { fill: rgba(255, 255, 255, .85); }
.piece-w .pc-gleamline { stroke: rgba(255, 255, 255, .8); stroke-width: 3; stroke-linecap: round; }
.piece-w .pc-dot { fill: #3a4150; }
.piece-b .pc-body { fill: url(#pgb); }
.piece-b .pc-line { stroke: #05070c; stroke-width: 3.2; stroke-linejoin: round; stroke-linecap: round; }
.piece-b .pc-cut { stroke: #cfd6e4; stroke-width: 4.5; stroke-linecap: round; }
.piece-b .pc-gleam { fill: rgba(255, 255, 255, .28); }
.piece-b .pc-gleamline { stroke: rgba(255, 255, 255, .35); stroke-width: 3; stroke-linecap: round; }
.piece-b .pc-dot { fill: #e8ecf4; }

.set-minimal.piece-w .pc-body { fill: #f0f2f6; }
.set-minimal.piece-b .pc-body { fill: #2b3040; }

/* Neo — flat modern set in the chess.com aesthetic (original artwork):
   solid two-tone fills, bold unified outline (base drop-shadow applies) */
.set-neo.piece-w .pc-body { fill: #f8f8f6; }
.set-neo.piece-w .pc-line { stroke: #3d3c3a; stroke-width: 4; stroke-linejoin: round; stroke-linecap: round; }
.set-neo.piece-b .pc-body { fill: #575452; }
.set-neo.piece-b .pc-line { stroke: #211f1e; stroke-width: 4; stroke-linejoin: round; stroke-linecap: round; }
.set-letters .pc-letter { fill: currentColor; }
.set-letters.piece-w { color: #2b3040; }
.set-letters.piece-w .pc-body { fill: #f0f2f6; }
.set-letters.piece-b { color: #f0f2f6; }
.set-letters.piece-b .pc-body { fill: #2b3040; }

/* coordinates */
.cb-coords { position: absolute; inset: 0; pointer-events: none; font-size: 10.5px; font-weight: 600; z-index: 4; }
.cb-coord { position: absolute; opacity: .85; }
.cb-coord.inside.file { bottom: 1px; width: 12.5%; text-align: right; padding-right: 4px; }
.cb-coord.inside.rank { left: 3px; height: 12.5%; padding-top: 2px; }
.cb-coord.inside[data-shade="l"] { color: var(--sq-light); }
.cb-coord.inside[data-shade="d"] { color: var(--sq-dark); }
.cb-coord.outside.file { bottom: -17px; width: 12.5%; text-align: center; color: var(--text-faint); }
.cb-coord.outside.rank { right: -15px; height: 12.5%; display: flex; align-items: center; color: var(--text-faint); }

/* arrows */
.cb-arrows { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 6; }
.cb-arrow { opacity: .82; }
.arrow-green { fill: #4ca05a; }
.arrow-red { fill: #c84646; }
.arrow-blue { fill: #4678c8; }
.arrow-engine { fill: color-mix(in srgb, var(--accent) 88%, #fff 12%); }
.arrow-hint { fill: #58b06a; }
.arrow-premove { fill: #7a8bb8; opacity: .65; }

/* keyboard entry chip */
.cb-kbd {
  position: absolute; left: 50%; bottom: 6%; transform: translateX(-50%);
  background: var(--bg-raised); border: 1px solid var(--border-strong); border-radius: var(--rad-1);
  padding: 3px 10px; font-family: var(--font-mono); font-size: var(--fs-14);
  box-shadow: var(--shadow-menu); z-index: 40; pointer-events: none;
}

/* promotion picker */
.cb-promo {
  position: absolute; z-index: 50; width: 12.5%;
  display: flex; flex-direction: column;
  background: var(--bg-raised); border: 1px solid var(--border-strong);
  border-radius: var(--rad-1); box-shadow: var(--shadow-dialog); overflow: hidden;
}
.cb-promo-opt { aspect-ratio: 1; display: grid; place-items: center; cursor: pointer; }
.cb-promo-opt:hover { background: var(--bg-selected); }
.cb-promo-opt svg { width: 88%; height: 88%; }

/* ---- eval bar (used beside boards) ---- */
.evalbar {
  width: 24px; flex: none; border: 1px solid var(--border-strong); border-radius: 2px;
  background: var(--eval-black); overflow: hidden; position: relative;
  display: flex; flex-direction: column; justify-content: flex-end;
}
.evalbar-white { width: 100%; background: var(--eval-white); transition: height .4s var(--ease); }
.evalbar-mark { position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: rgba(128,128,128,.55); }
.evalbar-label {
  position: absolute; left: 0; right: 0; text-align: center;
  font-size: 9.5px; font-weight: 700; font-family: var(--font-mono);
  letter-spacing: -0.4px; pointer-events: none; line-height: 1.15;
  white-space: nowrap;
}

/* ---- player bar (above/below board) ---- */
.playerbar {
  display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 4px;
  min-width: 0;
}
.playerbar .pb-name { font-weight: var(--fw-semibold); font-size: var(--fs-13); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.playerbar .pb-rating { color: var(--text-faint); font-size: var(--fs-12); }
.playerbar .pb-captured { color: var(--text-secondary); font-size: var(--fs-14); letter-spacing: 1px; white-space: nowrap; overflow: hidden; }
.playerbar .pb-diff { color: var(--ok-text); font-size: var(--fs-11); font-weight: 700; }
.playerbar .pb-clock {
  margin-left: auto; font-family: var(--font-mono); font-size: 17px; font-weight: 600;
  padding: 2px 9px; border-radius: var(--rad-1); border: 1px solid var(--border);
  background: var(--bg-inset); font-variant-numeric: tabular-nums;
}
.playerbar .pb-clock.running { border-color: var(--accent); color: var(--text); }
.playerbar .pb-clock.low { color: var(--err-text); border-color: var(--err); animation: pb-low 1s ease-in-out infinite; }
@keyframes pb-low { 50% { background: color-mix(in srgb, var(--err) 15%, var(--bg-inset)); } }
.playerbar .pb-turn { width: 7px; height: 7px; border-radius: 50%; background: transparent; flex: none; }
.playerbar .pb-turn.on { background: var(--ok); }
