body {
  font-family: Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(135deg, #1e3c72, #2a5298);
  margin: 0;
  min-height: 100vh;
  color: white;
}

header {
  background-color: rgba(0, 0, 0, 0.3);
  width: 100%;
  padding: 1em;
  text-align: center;
  margin-bottom: 1em;
  backdrop-filter: blur(5px);
}

.game-container {
  background-color: rgba(255, 255, 255, 0.1);
  padding: 2em;
  border-radius: 15px;
  box-shadow: 0 0 20px rgba(0,0,0,0.3);
  max-width: 95vw;
  width: 100%;
  box-sizing: border-box;
  backdrop-filter: blur(10px);
}

.board {
  width: min(500px, 95vw);
  height: min(500px, 95vw);
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  margin: 0 auto;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.square {
  width: 100%;
  height: 0;
  padding-bottom: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
}

.square.white {
  background-color: #e8ebef;
}

.square.black {
  background-color: #7c97bc;
}

.square:hover {
  transform: scale(0.95);
  box-shadow: inset 0 0 20px rgba(255,255,255,0.3);
}

.selected {
  background-color: #4CAF50 !important;
  animation: pulse 1.5s infinite;
}

.valid-move {
  position: relative;
  overflow: hidden;
  background-color: rgba(77, 208, 225, 0.7) !important;
  animation: validPulse 1.5s infinite;
}

.valid-move::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 30%;
  height: 30%;
  background: rgba(77, 208, 225, 0.8);
  border-radius: 50%;
  animation: validPulse 1.5s infinite;
}

.move-highlight {
  position: relative;
  background-color: #ffd700 !important;
  animation: moveHighlight 1s ease;
}

.move-highlight::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 215, 0, 0.3);
  animation: moveHighlight 1.5s ease;
}

.piece {
  font-family: "DejaVu Sans", Arial, sans-serif;
  font-size: min(45px, 11vw);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  transition: all 0.3s ease;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
}

.piece.white {
  color: #ffffff;
  text-shadow: 
    0 0 3px rgba(0,0,0,0.6),
    0 0 5px rgba(0,0,0,0.4),
    0 0 8px rgba(0,0,0,0.3);
}

.piece.black {
  color: #000000;
  text-shadow: 
    0 0 3px rgba(255,255,255,0.6),
    0 0 5px rgba(255,255,255,0.4),
    0 0 8px rgba(255,255,255,0.3);
}

.controls {
  margin-top: 2em;
  display: flex;
  gap: 1em;
  justify-content: center;
  flex-wrap: wrap;
}

.difficulty-controls {
  display: flex;
  justify-content: center;
  gap: 1em;
  margin-bottom: 1em;
}

.difficulty-btn {
  background: linear-gradient(45deg, #2196F3, #1976D2);
}

.difficulty-btn.active {
  background: linear-gradient(45deg, #4CAF50, #45a049);
  transform: scale(1.05);
}

.game-info {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 1em;
  margin-top: 1em;
  padding: 1em;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
}

.captured-pieces {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3em;
  padding: 0.8em;
  min-height: 60px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  align-items: center;
  justify-content: center;
}

.captured-pieces .piece {
  position: relative;
  transform: none;
  top: auto;
  left: auto;
  font-size: 1.8em;
  margin: 0 3px;
  opacity: 0.8;
  transition: transform 0.2s ease;
}

.captured-pieces .piece:hover {
  transform: scale(1.2);
  opacity: 1;
}

.move-history {
  max-height: 150px;
  overflow-y: auto;
  padding: 1em;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  font-family: monospace;
  line-height: 1.5;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.move-history::-webkit-scrollbar {
  width: 8px;
}

.move-history::-webkit-scrollbar-track {
  background: transparent;
}

.move-history::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
}

.status {
  margin-top: 1.5em;
  text-align: center;
  font-size: 1.2em;
  min-height: 1.5em;
  padding: 1em;
  background: linear-gradient(to right, rgba(0,0,0,0.3), rgba(0,0,0,0.2), rgba(0,0,0,0.3));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  animation: fadeIn 0.5s ease;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
}

.modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, #1e3c72, #2a5298);
  padding: 2em;
  border-radius: 15px;
  text-align: center;
  border: 2px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.promotion-options {
  display: flex;
  justify-content: center;
  gap: 1em;
  margin-top: 1em;
}

.piece-option {
  font-size: 2em;
  padding: 0.5em;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  transition: all 0.3s ease;
}

.piece-option:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

button {
  padding: 1em 2em;
  font-size: 1em;
  cursor: pointer;
  background: linear-gradient(45deg, #4CAF50, #45a049);
  color: white;
  border: none;
  border-radius: 25px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

button:active {
  transform: translateY(1px);
}

footer {
  margin-top: auto;
  background-color: rgba(0, 0, 0, 0.3);
  width: 100%;
  text-align: center;
  padding: 1em;
  backdrop-filter: blur(5px);
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

@keyframes validPulse {
  0% { opacity: 0.7; }
  50% { opacity: 1; }
  100% { opacity: 0.7; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes moveHighlight {
  from { background-color: #ffd700; }
  to { background-color: inherit; }
}

@media (max-width: 480px) {
  .game-container {
    padding: 1em;
  }

  .controls button {
    width: 100%;
    margin: 0.2em 0;
  }

  .status {
    font-size: 1em;
  }

  .difficulty-controls {
    flex-direction: column;
  }
  
  .game-info {
    grid-template-columns: 1fr;
  }
}