/* Global styles for Dungeon Crawler Chess */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Arial, Helvetica, sans-serif;
  background-color: #121212;
  color: #e0e0e0;
}

#game-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

h1 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 1.5rem;
  text-align: center;
}

#board {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  border: 4px solid #444;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.square {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Light and dark squares use background images generated with the image generation tool */
.square.light {
  background-image: url('assets/board_light.png');
  background-size: cover;
  background-position: center;
}

.square.dark {
  background-image: url('assets/board_dark.png');
  background-size: cover;
  background-position: center;
}

.square.highlight {
  /* outlines are difficult to see atop textured tiles. Use a semi‑transparent overlay instead */
  position: relative;
  z-index: 1;
}

.square.selected {
  position: relative;
  z-index: 1;
}

/* overlays for selected and highlight squares */
.square.highlight::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 0, 0.35);
  pointer-events: none;
}

.square.selected::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 255, 255, 0.35);
  pointer-events: none;
}

.piece {
  width: 90%;
  height: 90%;
  pointer-events: none;
}

/* Dark pieces are tinted via CSS filters instead of recolouring the underlying PNG */
.piece.black-piece {
  filter: grayscale(1) brightness(0.6) sepia(1) saturate(4) hue-rotate(-20deg);
}

.controls {
  width: 100%;
  margin-top: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.controls label {
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ccc;
}

.controls input[type="range"] {
  width: 120px;
  accent-color: #607d8b;
}

button {
  background-color: #2a2a2a;
  border: none;
  color: #e0e0e0;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.2s ease;
}

button:hover {
  background-color: #444;
}

#message {
  margin-top: 10px;
  min-height: 1.5em;
  text-align: center;
  font-weight: bold;
  color: #ffeb3b;
}