:root {
  --bg-page: #1c1917;
  --card: #34302e;
  --border-card: #44403c;
  --border-board: #4a2b23;

  --square-light: #f0d9b5;
  --square-dark: #b58863;

  --piece-light: #ffffff;
  --piece-dark: #262320;

  --status-text-active: #fff9f0;
  --status-text-muted: #d5c5b5;

  --white-status-color: #96775d;
  --black-status-color: #4a382b;

  --dot-inactive: #736051;
  --dot-active: #84cc16;
  --dot-active-flow: rgba(132, 204, 22, 0.45);

  --highlight-select: rgba(56, 189, 248, 0.4);

  --text-main: #f3f4f6;
}

body {
  background-color: var(--bg-page);
}

#mainDiv {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

#rightPanel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  width: 180px;
  flex-shrink: 0;
  height: 600px;
  background-color: var(--card);
  border: 6px solid var(--border-card);
}

#rightPanel > * {
  border: 4px solid var(--piece-dark);
  border-radius: 4px;
  font-size: 1rem;
  padding: 5px;
}

#turn-indicator {
  background-color: var(--text-main);
  color: var(--background-color);
  margin-top: 10px;
  margin-bottom: auto;
  min-width: 111.534px;
  text-align: center;
}

#rightPanel button {
  background-color: var(--square-dark);
  border: 4px solid var(--piece-dark);
  color: var(--text-main);
  width: 110px;
  height: 50px;
  cursor: pointer;
  margin-bottom: auto;
}

.horizontal-align {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 2vw;
}

h1 {
  color: var(--text-main);
}

#game-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.player-info {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: fit-content;
  padding: 8px 16px;
}

.player-info.white-player {
  background-color: var(--white-status-color);
}

.player-info.black-player {
  background-color: var(--black-status-color);
}

.turn-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--dot-inactive);
  transition:
    background-color 0.2s ease,
    box-shadow 0.2s ease;
}

.player-info .player-name,
.player-info .net-material {
  color: var(--status-text-muted);
}

.player-info.active .turn-dot {
  background-color: var(--dot-active);
  box-shadow: 0 0 8px var(--dot-active-glow);
}

.player-info.active .player-name,
.player-info.active .net-material {
  color: var(--status-text-active);
  font-weight: 600;
}

.info-pieces-container {
  display: flex;
  flex-direction: row;
}

.info-pieces-container span {
  transform: translateY(-3px);
  margin-right: -0.15em;
}

#chessboard {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: min(90vw, 600px);
  max-width: 600px;
  aspect-ratio: 1 / 1;
  border: 6px solid var(--border-board);
  border-radius: 4px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65);
  flex-shrink: 0;
}

.square {
  display: flex;
  width: 100%;
  height: 100%;

  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: calc(min(90vw, 600px) / 9 * 0.9);

  pointer-events: auto;
  cursor: pointer;
}

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

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

.piece {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-family: sans-serif;
  paint-order: stroke fill;
  line-height: 1;
  user-select: none;

  pointer-events: auto;
  cursor: pointer;
}

.piece.selected {
  outline: 3px solid var(--highlight-select);
  background-color: #93c5fd;
}

.light-piece {
  color: var(--piece-light);
  -webkit-text-stroke: 2px #1a1a1a;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35));
}

.dark-piece {
  color: var(--piece-dark);
  -webkit-text-stroke: 0.5px rgba(240, 217, 181, 0.4);
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35));
}

.captured-piece {
  -webkit-text-stroke-width: 0.5px;
  font-size: clamp(14px, 3vw, 24px);
  line-height: 1;
}

@media (max-width: 768px) {
  .horizontal-align {
    flex-direction: column;
    width: 100%;
  }

  #rightPanel {
    width: min(90vw, 600px);
    height: auto;
    padding: 16px 0;
    margin-top: 16px;
  }
}
