@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600&family=JetBrains+Mono:wght@400;500&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --square-light: #e8e0d5;
  --square-dark: #7d6e5c;
  --square-hover: rgba(155, 199, 0, 0.4);
  --square-selected: rgba(155, 199, 0, 0.6);
  --square-move: rgba(155, 199, 0, 0.3);
  --piece-white: #f5f5f0;
  --piece-black: #2c2c2c;
  --bg: #1a1a1a;
  --accent: #9bc700;
  --text: #e8e0d5;
}

body {
  min-height: 100vh;
  background: var(--bg);
  font-family: 'JetBrains Mono', monospace;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}

.game-container {
  padding: 2rem;
  text-align: center;
}

h1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  letter-spacing: 0.2em;
  color: var(--accent);
}

.status-bar {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  opacity: 0.9;
}

.turn-indicator {
  color: var(--accent);
}

.board-wrapper {
  position: relative;
  display: inline-block;
  padding: 20px 20px 20px 40px;
  background: linear-gradient(145deg, #252525 0%, #1a1a1a 100%);
  border-radius: 12px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.coordinates {
  position: absolute;
  font-size: 0.7rem;
  color: rgba(232, 224, 213, 0.5);
}

.coordinates-files {
  bottom: 4px;
  left: 40px;
  right: 20px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  text-align: center;
}

.coordinates-ranks {
  top: 20px;
  left: 12px;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  text-align: right;
  padding-right: 8px;
}

#chessboard {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: min(72vmin, 480px);
  height: min(72vmin, 480px);
  border: 2px solid rgba(125, 110, 92, 0.5);
  border-radius: 4px;
  overflow: hidden;
}

.square {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
  position: relative;
}

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

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

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

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

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

.square.valid-move::after {
  content: '';
  position: absolute;
  width: 25%;
  height: 25%;
  background: rgba(125, 110, 92, 0.6);
  border-radius: 50%;
}

.square.valid-move.has-piece::after {
  width: 85%;
  height: 85%;
  background: transparent;
  border: 3px solid rgba(125, 110, 92, 0.6);
  border-radius: 4px;
}

.piece {
  font-size: clamp(2rem, 6vmin, 3.5rem);
  font-weight: 500;
  line-height: 1;
  pointer-events: none;
  user-select: none;
  transition: transform 0.1s ease;
  z-index: 2;
}

.square:hover .piece {
  transform: scale(1.05);
}

.piece.white {
  color: var(--piece-white);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.piece.black {
  color: var(--piece-black);
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
}

.btn {
  margin-top: 1.5rem;
  padding: 0.6rem 1.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn:hover {
  background: #b4e01a;
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.game-status.check {
  color: #e74c3c;
}

.game-status.checkmate {
  color: #e74c3c;
  font-weight: 600;
}

.game-status.stalemate {
  color: #f39c12;
}
