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

body {
  font-family: 'Arial', sans-serif;
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  color: white;
  padding: 5px;
  margin: 0;
  width: 100%;
}

#game-container {
  position: relative;
  background: #0a1929;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  padding: 20px;
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 650px;
}

#game-info {
  text-align: center;
  margin-bottom: 25px;
  width: 100%;
}

#game-info h2 {
  font-size: 24px;
  margin-bottom: 8px;
  color: #4fc3f7;
  text-shadow: 0 0 10px rgba(79, 195, 247, 0.5);
}

#turn-info {
  font-size: 14px;
  font-weight: bold;
  color: #90caf9;
  margin-bottom: 10px;
}

#game-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  background: #1a1a1a;
  padding: 8px;
  border-radius: 8px;
  margin-bottom: 25px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin-left: auto;
  margin-right: auto;
}

.square {
  aspect-ratio: 1;
  background: #0d1f2d;
  border: 1px solid #1e88e5;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  user-select: none;
  transition: all 0.2s ease;
  position: relative;
  min-height: 0;
  touch-action: manipulation;
}

.square:hover {
  background: #1a3a4a;
}

.square.light {
  background: #d3d3d3;
  border-color: #b0b0b0;
}

.square.light:hover {
  background: #e8e8e8;
}

.square.dark {
  background: #8b7355;
  border-color: #6b5345;
}

.square.dark:hover {
  background: #a08966;
}

.square.selected {
  box-shadow: inset 0 0 15px rgba(255, 235, 59, 0.6);
  background: #ffd54f !important;
}

.square.valid-move {
  box-shadow: inset 0 0 10px rgba(76, 175, 80, 0.6);
  background: #81c784 !important;
}

.square.capture {
  box-shadow: inset 0 0 10px rgba(244, 67, 54, 0.6);
  background: #e57373 !important;
}

button {
  background: linear-gradient(135deg, #1e88e5 0%, #1565c0 100%);
  color: white;
  border: none;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: bold;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(30, 136, 229, 0.4);
  min-height: 44px;
  touch-action: manipulation;
  display: block;
  margin: 0 auto;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(30, 136, 229, 0.6);
  background: linear-gradient(135deg, #2196f3 0%, #1e88e5 100%);
}

button:active {
  transform: translateY(0);
}

#game-status {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(10, 25, 41, 0.98);
  padding: 25px 30px;
  border-radius: 12px;
  text-align: center;
  border: 2px solid #1e88e5;
  box-shadow: 0 0 30px rgba(30, 136, 229, 0.5);
  z-index: 100;
  width: 90%;
  max-width: 500px;
}

#game-status h2 {
  font-size: 24px;
  margin-bottom: 15px;
  color: #4fc3f7;
  text-shadow: 0 0 10px rgba(79, 195, 247, 0.5);
}

#start-screen {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(10, 25, 41, 0.98);
  padding: 25px 30px;
  border-radius: 12px;
  text-align: center;
  border: 2px solid #1e88e5;
  box-shadow: 0 0 30px rgba(30, 136, 229, 0.5);
  z-index: 100;
  width: 90%;
  max-width: 500px;
}

#start-screen h1 {
  font-size: 28px;
  margin-bottom: 15px;
  color: #4fc3f7;
  text-shadow: 0 0 10px rgba(79, 195, 247, 0.5);
}

#start-screen p {
  font-size: 14px;
  margin: 8px 0;
  color: #90caf9;
}

.hidden {
  display: none;
}

.back-button {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 1000;
  background: rgba(30, 136, 229, 0.9);
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
  font-size: 16px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(30, 136, 229, 0.4);
  backdrop-filter: blur(10px);
}

.back-button:hover {
  background: rgba(30, 136, 229, 1);
  transform: translateX(-5px);
  box-shadow: 0 6px 20px rgba(30, 136, 229, 0.6);
}

@media (min-width: 640px) {
  body {
    padding: 10px;
  }
  
  #game-container {
    padding: 25px;
    min-height: 700px;
  }
  
  #game-info {
    margin-bottom: 20px;
  }
  
  #game-info h2 {
    font-size: 28px;
  }
  
  #turn-info {
    font-size: 16px;
  }
  
  #game-board {
    gap: 2px;
    padding: 6px;
  }
  
  .square {
    font-size: 24px;
    border-width: 2px;
  }
  
  button {
    padding: 12px 30px;
    font-size: 16px;
    width: auto;
    max-width: none;
  }
  
  #start-screen, #game-status {
    padding: 35px 50px;
  }
  
  #start-screen h1, #game-status h2 {
    font-size: 38px;
  }
  
  #start-screen p {
    font-size: 16px;
  }
}

@media (min-width: 1024px) {
  #game-container {
    padding: 30px;
    min-height: 750px;
  }
  
  #game-info h2 {
    font-size: 32px;
  }
  
  #turn-info {
    font-size: 18px;
  }
  
  #game-board {
    gap: 2px;
    padding: 8px;
  }
  
  .square {
    font-size: 32px;
    border-width: 2px;
  }
  
  button {
    padding: 12px 30px;
    font-size: 16px;
  }
  
  #start-screen, #game-status {
    padding: 40px 60px;
  }
  
  #start-screen h1 {
    font-size: 48px;
  }
  
  #start-screen p {
    font-size: 16px;
  }
  
  #game-status h2 {
    font-size: 42px;
  }
}

@media (max-width: 640px) {
  body {
    padding: 5px;
    align-items: center;
    padding-top: 50px;
    justify-content: center;
  }
  
  #game-container {
    padding: 12px;
    margin: 0 auto;
    border-radius: 8px;
    align-self: center;
    min-height: 600px;
  }
  
  #game-info {
    margin-bottom: 10px;
  }
  
  #game-info h2 {
    font-size: 20px;
    margin-bottom: 5px;
  }
  
  #turn-info {
    font-size: 12px;
    margin-bottom: 8px;
  }
  
  #game-board {
    gap: 1px;
    padding: 3px;
    margin-bottom: 10px;
  }
  
  .square {
    font-size: 14px;
    border-width: 1px;
    min-width: 0;
  }
  
  button {
    padding: 10px 16px;
    font-size: 13px;
    width: 100%;
    max-width: 200px;
  }
  
  #start-screen, #game-status {
    padding: 20px 25px;
    width: 95%;
    max-width: none;
  }
  
  #start-screen h1, #game-status h2 {
    font-size: 22px;
    margin-bottom: 12px;
  }
  
  #start-screen p {
    font-size: 12px;
    margin: 6px 0;
  }
  
  .back-button {
    top: 10px;
    left: 10px;
    padding: 8px 14px;
    font-size: 12px;
    z-index: 1001;
  }
}

@media (max-width: 480px) {
  body {
    padding-top: 45px;
  }
  
  #game-container {
    padding: 5px;
  }
  
  .square {
    font-size: 12px;
  }
  
  #game-info h2 {
    font-size: 18px;
  }
  
  #turn-info {
    font-size: 11px;
  }
  
  button {
    font-size: 12px;
    padding: 8px 14px;
  }
}
