body {
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #7e8ba3 100%);
  min-height: 100vh;
}

.home-screen {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  gap: 50px;
}

.home-title {
  font-size: 72px;
  font-weight: bold;
  color: white;
  text-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
  letter-spacing: 8px;
  margin: 0;
}

.home-buttons {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.home-btn {
  padding: 20px 60px;
  font-size: 24px;
  font-weight: bold;
  color: white;
  background: rgba(255, 255, 255, 0.2);
  border: 3px solid white;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.home-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.home-btn:active {
  transform: translateY(-2px);
}

.game-screen {
  min-height: 100vh;
  padding: 20px;
}

.header-text {
  font-size: 48px;
  font-weight: bold;
  color: white;
  text-shadow: 0 3px 6px rgba(0, 0, 0, 0.5);
  letter-spacing: 4px;
  margin: 10px 0;
  text-transform: uppercase;
}

.game-screen .turn-message,
.game-screen .hit-message {
  font-size: 20px;
  color: white;
  font-weight: bold;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  margin: 5px 0;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(10, 30px);
  grid-template-rows: repeat(10, 30px);
  gap: 1px;
  border: 2px solid rgb(0, 0, 0);
  background-color: #333;
  padding: 2px;
}

#gameboard-1,
#gameboard-2 {
  display: inline-block;
  width: fit-content;
  margin-bottom: 50px;
}

.grid-cell {
  width: 30px;
  height: 30px;
  background-color: #87ceeb;
  border: none;
  cursor: pointer;
}

.grid-cell:hover {
  background-color: rgb(255, 251, 30);
}

/* Disable hover on player's own board during gameplay */
body.game-active #gameboard-1 .grid-cell:hover {
  background-color: #87ceeb !important;
}

body.game-active #gameboard-1 .grid-cell.hit:hover {
  background-color: red !important;
}

body.game-active #gameboard-1 .grid-cell.miss:hover {
  background-color: gray !important;
}

body.game-active #gameboard-1 .grid-cell.sunk:hover {
  background-color: black !important;
}

body.game-active .grid-cell[class*="ship"]:not(.hit):not(.sunk):hover {
  background-color: rgb(255, 251, 30) !important;
}

#gameboard-2 .grid-cell {
  background-color: lightcoral;
}

#gameboard-2 .grid-cell:hover {
  background-color: rgb(255, 251, 30);
}

body.game-active
  #gameboard-2
  .grid-cell[class*="ship"]:not(.hit):not(.sunk):hover {
  background-color: rgb(255, 251, 30) !important;
}

.grid-cell[class*="ship"] {
  background-color: #666;
}

#gameboard-2 .grid-cell[class*="ship"] {
  background-color: #666;
}

body.game-active .grid-cell[class*="ship"]:not(.hit):not(.sunk) {
  background-color: #87ceeb;
}

body.game-active #gameboard-2 .grid-cell[class*="ship"]:not(.hit):not(.sunk) {
  background-color: lightcoral;
}

.grid-cell.hit {
  background-color: red !important;
}

.grid-cell.miss {
  background-color: gray !important;
}

.grid-cell.sunk {
  background-color: black !important;
}

.bs-bank-1,
.bs-bank-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(3, auto);
  gap: 15px;
  padding: 20px;
  background-color: #f5f5f5;
  border: 2px solid #333;
  width: fit-content;
  border-radius: 8px;
}

.bank-title {
  grid-column: 1 / -1;
  margin: 0 0 10px 0;
  text-align: center;
}

.bank-item {
  display: flex;
  align-items: center;
  gap: 1px;
  cursor: grab;
  transition: all 0.2s;
  width: fit-content;
}

.bank-item.vertical {
  flex-direction: column;
}

.bank-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.bank-item:active {
  cursor: grabbing;
}

.bs-segment {
  width: 30px;
  height: 30px;
  background-color: #666;
  border: 1px solid #333;
}

.rotation-btn {
  margin-left: auto;
  padding: 8px 12px;
  cursor: pointer;
  background-color: #4caf50;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  margin-left: 10px;
  transition: background-color 0.2s;
}

.rotate-btn:hover {
  background-color: #45a049;
}

.placement-preview {
  background-color: rgba(76, 175, 80, 0.3) !important;
  border: 2px solid #4caf50 !important;
}

.invalid-placement {
  background-color: rgba(255, 68, 68, 0.3) !important;
  border: 2px solid #ff4444 !important;
}

.error-message {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #ff4444;
  color: white;
  padding: 15px 30px;
  border-radius: 5px;
  font-weight: bold;
  z-index: 2000;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    transform: translateX(-50%) translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

.hidden {
  display: none !important;
}

.ready-btn {
  position: fixed;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  padding: 15px 40px;
  background-color: #4caf50;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

.ready-btn:hover {
  background-color: #45a049;
  transform: translateX(-50%) translateY(-2px);
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.4);
}

.ready-btn:active {
  transform: translateX(-50%) translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Initially hide player 2's board and bank */
#gameboard-2,
.bs-bank-2 {
  display: none;
}

/* End game buttons */
.end-game-buttons {
  position: fixed;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 20px;
  z-index: 1000;
}

.end-game-btn {
  padding: 15px 45px;
  font-size: 20px;
  font-weight: bold;
  color: white;
  background: rgba(255, 255, 255, 0.2);
  border: 3px solid white;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.end-game-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.end-game-btn:active {
  transform: translateY(-2px);
}

/* Persistent Home Button */
.persistent-home-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 24px;
  font-size: 18px;
  font-weight: bold;
  color: white;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid white;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  z-index: 1500;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.persistent-home-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.persistent-home-btn:active {
  transform: translateY(-1px);
}

/* Confirmation Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.modal-content {
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  padding: 40px;
  border-radius: 16px;
  border: 3px solid white;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  text-align: center;
  max-width: 450px;
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    transform: scale(0.7);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-content h2 {
  color: white;
  font-size: 32px;
  margin: 0 0 20px 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.modal-content p {
  color: white;
  font-size: 18px;
  margin: 0 0 30px 0;
  line-height: 1.5;
}

.modal-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
}

.modal-btn {
  padding: 12px 30px;
  font-size: 16px;
  font-weight: bold;
  border: 2px solid white;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.confirm-btn {
  background: rgba(244, 67, 54, 0.8);
  color: white;
}

.confirm-btn:hover {
  background: rgba(244, 67, 54, 1);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.cancel-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.cancel-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.modal-btn:active {
  transform: translateY(0);
}
