/* ==========================================================================
   Impossible Chess - Board, Squares, Eval Bar, & Move Log Styles
   ========================================================================== */

.player-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 6px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 0.85rem;
}

.player-bar.bottom {
  margin-top: 6px;
  margin-bottom: 0;
}

.player-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.player-badge {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid #444;
}

.badge-white {
  background-color: #fff;
}

.badge-black {
  background-color: #222;
}

.captured-box {
  font-size: 0.95rem;
  color: var(--text-muted);
  letter-spacing: -2px;
  min-height: 20px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.advantage-badge {
  font-size: 0.75rem;
  background: #333942;
  color: #fff;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 700;
  margin-left: 4px;
}

.player-timer {
  font-family: monospace;
  font-size: 1rem;
  font-weight: 700;
  padding: 3px 8px;
  background: #121416;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: #fff;
}

.timer-active {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.board-stage {
  display: flex;
  align-items: stretch;
  gap: 10px;
  width: 100%;
  max-width: 480px;
}

#eval-bar-container {
  width: 22px;
  border-radius: 6px;
  background: #1a1c1e;
  border: 2px solid #2f353d;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

#eval-bar-fill {
  width: 100%;
  height: 50%;
  background: #f0f2f5;
  transition: height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

#eval-score-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-90deg);
  font-size: 0.65rem;
  font-weight: 800;
  font-family: monospace;
  color: #e5a93c;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
  pointer-events: none;
  white-space: nowrap;
}

#board-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 450px;
  flex: 1;
  border: 3px solid #2f353d;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  background-color: var(--dark-square);
}

#board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  height: 100%;
  user-select: none;
  touch-action: manipulation;
}

.square {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: clamp(28px, 7vw, 44px);
  line-height: 1;
  touch-action: manipulation;
  transition: background-color 0.12s ease;
}

.square.light {
  background-color: var(--light-square);
  color: #111;
}

.square.dark {
  background-color: var(--dark-square);
  color: #111;
}

.square.selected {
  background-color: var(--selected-square) !important;
}

.square.last-move {
  background-color: var(--last-move) !important;
}

.square.king-in-check {
  background: radial-gradient(circle at center, #ff3b30 0%, #b31010 70%, #730606 100%) !important;
  animation: pulse-check 1.5s infinite;
}

@keyframes pulse-check {
  0% {
    box-shadow: inset 0 0 0 0 rgba(255, 59, 48, 0.7);
  }

  70% {
    box-shadow: inset 0 0 15px 4px rgba(255, 59, 48, 0.9);
  }

  100% {
    box-shadow: inset 0 0 0 0 rgba(255, 59, 48, 0.7);
  }
}

.square.hint::after {
  content: "";
  width: 26%;
  height: 26%;
  background: rgba(18, 20, 22, 0.35);
  border-radius: 50%;
  position: absolute;
  pointer-events: none;
}

.square.capture-hint::after {
  content: "";
  width: 80%;
  height: 80%;
  border: 4px solid rgba(18, 20, 22, 0.35);
  border-radius: 50%;
  position: absolute;
  pointer-events: none;
}

.coordinate {
  position: absolute;
  font-size: clamp(8px, 2.2vw, 11px);
  font-weight: 700;
  font-family: monospace;
  pointer-events: none;
  line-height: 1;
}

.coord-rank {
  top: 3px;
  left: 3px;
}

.coord-file {
  bottom: 3px;
  right: 3px;
}

.square.light .coordinate {
  color: var(--dark-square);
}

.square.dark .coordinate {
  color: var(--light-square);
}

.piece-white {
  color: #ffffff;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.8));
  user-select: none;
}

.piece-black {
  color: #1a1a1a;
  filter: drop-shadow(0 1px 1px rgba(255, 255, 255, 0.4));
  user-select: none;
}

.moves-container {
  height: 130px;
  overflow-y: auto;
  background: #14171a;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 8px;
  font-family: monospace;
  font-size: 0.85rem;
}

.moves-container::-webkit-scrollbar {
  width: 6px;
}

.moves-container::-webkit-scrollbar-thumb {
  background: #2f353d;
  border-radius: 3px;
}

.move-row {
  display: flex;
  padding: 3px 0;
  border-bottom: 1px solid #1e2227;
  align-items: center;
}

.move-num {
  width: 38px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.move-white,
.move-black {
  flex: 1;
  padding: 0 4px;
}

.move-btn {
  cursor: pointer;
  border-radius: 3px;
  padding: 2px 5px;
  display: inline-block;
  transition: all 0.12s ease;
}

.move-btn:hover {
  background: #2b323c;
  color: #fcd34d;
}

.move-btn.active-move {
  background: #2e8253;
  color: #ffffff;
  font-weight: 700;
}

.replay-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  background: #292415;
  border: 1px solid #735118;
  color: #fcd34d;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  margin-top: 6px;
}

.hof-tab-btn {
  background: #1e2329;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.15s ease;
}

.hof-tab-btn.active {
  background: #27362c;
  border-color: #2e8253;
  color: #4ade80;
}

/* Mobile Adjustments for Board */
@media (max-width: 520px) {
  .player-bar {
    padding: 5px 8px;
    font-size: 0.8rem;
  }

  .player-profile {
    gap: 6px;
  }

  .player-timer {
    font-size: 0.9rem;
    padding: 2px 6px;
  }

  .board-stage {
    gap: 6px;
  }

  #eval-bar-container {
    width: 16px;
  }

  #eval-score-text {
    font-size: 0.55rem;
  }
}

@media (max-width: 380px) {
  .coordinate {
    display: none;
  }
}