:root {
  --ocean-dark: #0f172a;
  --ocean-blue: #0284c7;
  --ocean-light: #38bdf8;
  --ship-hull-light: #90a4ae;
  --ship-hull-dark: #546e7a;
  --ship-border: #cfd8dc;
  --grid-size: min(8.5vw, 35px);
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: system-ui, sans-serif; }

body {
  background: linear-gradient(135deg, var(--ocean-dark), var(--ocean-blue));
  color: white;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 0.5rem;
}

.status {
  font-size: 1.1rem;
  font-weight: bold;
  background: rgba(0, 0, 0, 0.4);
  padding: 0.75rem 1.5rem;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  margin: 1rem 0;
  text-align: center;
}

.controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.btn {
  background: var(--ocean-light);
  color: var(--ocean-dark);
  border: none;
  padding: 10px 14px;
  font-size: 0.9rem;
  font-weight: bold;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Board Layouts */
.game-container {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

.board {
  display: grid;
  grid-template-columns: repeat(10, var(--grid-size));
  grid-template-rows: repeat(10, var(--grid-size));
  gap: 2px;
  background: rgba(0, 10, 30, 0.5);
  padding: 5px;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.cell {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--grid-size) * 0.6);
  cursor: crosshair;
}

/* Ship Styling */
.ship {
  background: linear-gradient(145deg, var(--ship-hull-dark), var(--ship-hull-light));
  border: 1px solid var(--ship-border);
  box-shadow: inset 1px 1px 2px rgba(255,255,255,0.3);
}

.hit { background: rgba(220, 38, 38, 0.6) !important; animation: pop 0.3s; }
.miss { background: rgba(255, 255, 255, 0.2) !important; opacity: 0.8; }

@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Mobile Stacking */
@media (max-width: 768px) {
  .game-container { flex-direction: column; align-items: center; }
  .player-area { order: 1; }
  .enemy-area { order: 2; margin-bottom: 2rem; }
}

/* Overlay */
#game-over-screen {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; backdrop-filter: blur(5px);
}
.hidden { display: none !important; }
.celebration-box {
  background: var(--ocean-dark);
  padding: 2rem; border-radius: 15px; border: 2px solid var(--ocean-light);
  text-align: center;
}