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

body {
  font-family: Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #f5f5f5;
  color: #333;
}

/* Header */
.app-header {
  background: #fff;
  border-bottom: 1px solid #ddd;
  padding: 1rem;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.app-header h1 {
  font-size: 2rem;
  font-weight: bold;
  margin-bottom: 0.8rem;
  color: #333;
}

/* Turn Indicator */
.turn-indicator {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border-radius: 20px;
  padding: 8px 16px;
  border: 1px solid #ddd;
  font-weight: 500;
  font-size: 1rem;
}

.turn-indicator.white-turn {
  background: #f8f8f8;
  color: #333;
  border-color: #ccc;
}

.turn-indicator.black-turn {
  background: #333;
  color: #fff;
  border-color: #444;
}

.turn-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.white-turn .turn-dot {
  background: #333;
}

.black-turn .turn-dot {
  background: #fff;
}

/* Game Container */
.game-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.board-container {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Chess Board */
.board {
  width: min(90vmin, 600px);
  height: min(90vmin, 600px);
  background: #8b4513;
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  border: 2px solid #654321;
}

.board.flipped { 
  transform: rotate(180deg); 
}
.board.flipped .allimg { 
  transform: rotate(180deg); 
}
.board.flipped .allpawn { 
  transform: rotate(180deg) scale(0.8); 
}

.divv {
  display: flex;
  height: 12.5%;
}

.box {
  width: 12.5%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 0;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.1);
  position: relative;
}

/* Board Square Colors */
.box:nth-child(odd) {
  background: #f0d9b5;
}

.box:nth-child(even) {
  background: #b58863;
}

.divv:nth-child(even) .box:nth-child(odd) {
  background: #b58863;
}

.divv:nth-child(even) .box:nth-child(even) {
  background: #f0d9b5;
}

/* Highlighted Squares */
.highlighted {
  background: #ff6b9d !important;
}

.valid-move {
  background: #51cf66 !important;
}

.castle-move {
  background: #339af0 !important;
}

/* Piece Images - Simple and clean */
.allimg {
  width: 75%;
  height: 75%;
  object-fit: contain;
  filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.3));
}

.allpawn {
  transform: scale(0.8);
}

/* Footer */
.app-footer {
  background: #fff;
  border-top: 1px solid #ddd;
  padding: 1rem;
  text-align: center;
  color: #666;
  font-weight: 400;
}

.heart {
  color: #e74c3c;
  font-size: 1.1em;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
}

.modal-overlay[aria-hidden="false"] { 
  display: flex; 
}

.modal {
  background: white;
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
  text-align: center;
  max-width: 400px;
  width: 100%;
}

.modal h3 {
  margin-bottom: 1rem;
  font-size: 1.5rem;
  color: #333;
  font-weight: 600;
}

.modal p {
  margin-bottom: 1.5rem;
  color: #666;
  font-size: 1rem;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-weight: 500;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  min-width: 120px;
  justify-content: center;
  transition: background-color 0.2s;
}

.btn-white {
  background: #f8f8f8;
  color: #333;
  border: 1px solid #ccc;
}

.btn-white:hover {
  background: #e8e8e8;
}

.btn-black {
  background: #333;
  color: #fff;
  border: 1px solid #444;
}

.btn-black:hover {
  background: #444;
}

.btn-primary {
  background: #007bff;
  color: white;
  border: 1px solid #0056b3;
}

.btn-primary:hover {
  background: #0056b3;
}

.piece-icon {
  font-size: 1.2em;
}

/* Win Modal Specific */
.win-modal {
  background: #f8f8f8;
}

.trophy {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.winner-section {
  margin: 1.5rem 0;
}

.winner-label {
  font-size: 1.1rem;
  color: #666;
  margin-right: 10px;
}

.winner-name {
  font-size: 1.8rem;
  font-weight: bold;
  color: #28a745;
  text-transform: uppercase;
}

.win-message {
  font-size: 1rem;
  color: #333;
  font-style: italic;
}

.heart {
  color: #dc3545;
  font-size: 1.2em;
  animation: heartbeat 1.5s ease-in-out infinite;
}

/* Responsive Design */
@media (max-width: 768px) {
  .app-header {
    padding: 0.8rem;
  }
  
  .app-header h1 {
    font-size: 1.6rem;
  }
  
  .game-container {
    padding: 0.5rem;
  }
  
  .board {
    width: min(95vw, 95vh);
    height: min(95vw, 95vh);
  }
  
  .modal {
    padding: 1.5rem;
    margin: 1rem;
  }
  
  .btn {
    padding: 8px 16px;
    font-size: 0.9rem;
    min-width: 100px;
  }
  
  .turn-indicator {
    padding: 6px 12px;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .modal-actions {
    flex-direction: column;
  }
  
  .btn {
    width: 100%;
    min-width: auto;
  }
  
  .board {
    width: min(100vw - 20px, 100vh - 120px);
    height: min(100vw - 20px, 100vh - 120px);
    padding: 4px;
  }
}