@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&display=swap');

body {
  background-color: #0b132b; 
  color: #6fffe9; 
  font-family: 'Share Tech Mono', monospace;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  padding: 40px 20px;
}

#stats {
  display: flex;
  gap: 30px;
  margin-bottom: 20px;
  background: #1c2541;
  padding: 15px 30px;
  border-radius: 8px;
  border: 1px solid #3a506b;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  font-size: 1.2rem;
  align-items: center;
}

.stat-box { font-weight: bold; }

#instruction-text {
  font-size: 1.3rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 0 0 8px currentColor; 
  margin-left: 20px;
  padding-left: 20px;
  border-left: 2px solid #3a506b;
}

#scene {
  background: #1c2541;
  padding: 20px;
  border-radius: 10px;
  border: 2px solid #5bc0be;
  box-shadow: 0 0 20px rgba(91, 192, 190, 0.3), inset 0 0 30px rgba(0,0,0,0.8);
  margin-bottom: 30px;
}

.row { display: flex; }

.grid-cell {
  width: 50px;
  height: 50px;
  border: 1px solid rgba(91, 192, 190, 0.3);
  display: flex;
  justify-content: center;
  align-items: center;
  color: rgba(111, 255, 233, 0.3); 
  font-size: 0.8rem;
  cursor: crosshair;
  background-color: rgba(11, 19, 43, 0.6);
  transition: all 0.2s ease;
  position: relative;
}

.grid-cell:hover {
  background-color: rgba(91, 192, 190, 0.2);
  border-color: #5bc0be;
  color: #5bc0be;
}

.grid-cell.ship {
  box-shadow: inset 0 0 15px rgba(0,0,0,0.7); 
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 1px 1px 2px black;
}

.grid-cell.hit {
  background-color: #111 !important;
  border-color: #ff4a4a !important;
}

.grid-cell.hit::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  background: radial-gradient(circle at 30% 30%, #ff7b7b, #d90000 60%, #600000);
  border-radius: 50%;
  box-shadow: 0 0 10px #ff4a4a, inset 0 -2px 5px rgba(0,0,0,0.5);
  animation: pegDrop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.grid-cell.miss { background-color: rgba(255, 255, 255, 0.1) !important; }

.grid-cell.miss::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: radial-gradient(circle at 30% 30%, #ffffff, #d4d4d4 60%, #888888);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.5), inset 0 -2px 5px rgba(0,0,0,0.5);
  animation: pegDrop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes pegDrop {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

#actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

#dice { display: flex; gap: 20px; margin-bottom: 10px; }

.dice-containers {
  width: 70px;
  height: 70px;
  background: #1c2541;
  border: 2px solid #6fffe9;
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2.5rem;
  font-weight: bold;
  color: #fff;
  box-shadow: 0 0 15px rgba(111, 255, 233, 0.4), inset 0 0 10px rgba(0,0,0,0.5);
  text-transform: uppercase;
}

button {
  background: rgba(11, 19, 43, 0.8);
  color: #6fffe9;
  border: 2px solid #5bc0be;
  padding: 12px 30px;
  font-size: 1.2rem;
  font-family: inherit;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease-in-out;
  letter-spacing: 2px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

button:hover:not(:disabled) {
  background: #5bc0be;
  color: #0b132b;
  box-shadow: 0 0 15px #5bc0be, 0 0 30px rgba(91, 192, 190, 0.4);
  transform: translateY(-2px);
}

button:disabled {
  border-color: #3a506b;
  color: #3a506b;
  background: transparent;
  cursor: not-allowed;
  box-shadow: none;
}

#add-money {
  border-color: #ffaa00;
  color: #ffaa00;
}
#add-money:hover {
  background: #ffaa00;
  color: #0b132b;
  box-shadow: 0 0 15px #ffaa00;
}

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 600px) {
  body { padding: 10px; }
  
  #stats {
    flex-direction: column;
    gap: 10px;
    padding: 15px;
    text-align: center;
    width: 90%;
  }

  #instruction-text {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    border-top: 2px solid #3a506b;
    padding-top: 10px;
    font-size: 1.1rem;
  }

  #scene { padding: 10px; }

  /* Scales grid cells to fit perfectly on small screens */
  .grid-cell {
    width: 13vw;
    height: 13vw;
    max-width: 45px;
    max-height: 45px;
    font-size: 0.7rem;
  }

  .grid-cell.hit::after { width: 16px; height: 16px; }
  .grid-cell.miss::after { width: 12px; height: 12px; }

  .dice-containers {
    width: 55px;
    height: 55px;
    font-size: 1.8rem;
  }

  button { padding: 10px 20px; font-size: 1rem; width: 100%; max-width: 300px; }
}