/* ===========================================================
   Battleships — game-specific styles only.
   Chrome (body, h1, button, #status, .score-box, .hint) come
   from shared.css. Colours use the shared design tokens so the
   board works in both light and dark themes.
   =========================================================== */

body { gap: 16px; }

/* sub-headings above each grid */
.board-title {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 8px;
  color: var(--muted);
}

/* fleet counters row */
#scoreboard {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* layout for the two grids: side by side, stacking when narrow */
#boards {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
}
.board-wrap { display: flex; flex-direction: column; align-items: center; }

/* the grid itself — 8x8, sitting in a "sea" frame */
.board {
  display: grid;
  grid-template-columns: repeat(8, var(--cell, 34px));
  grid-template-rows: repeat(8, var(--cell, 34px));
  gap: 3px;
  padding: 8px;
  background: var(--blue-board);
  border-radius: 12px;
  box-shadow: 0 10px 34px var(--shadow);
  border-bottom: 5px solid var(--blue-board-dark);
}

/* a single water cell */
.cell {
  width: var(--cell, 34px);
  height: var(--cell, 34px);
  background: var(--surface-2);
  border-radius: 5px;
  cursor: pointer;
  position: relative;
  transition: background 0.12s, transform 0.08s;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.25);
}

/* enemy cells are the only clickable ones; show a hover/aim cue */
#enemyBoard .cell:hover,
.cell.aim {
  background: var(--hole-hover);
}
/* keyboard cursor highlight on the enemy board */
.cell.aim {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
  z-index: 2;
}

/* your own ships, visible on the player board */
.cell.ship {
  background: var(--surface-3);
  cursor: default;
}

/* once the game is over (or it's the player board) cells aren't clickable */
.board.locked .cell { cursor: default; }
#playerBoard .cell { cursor: default; }

/* a miss — small dot floating on the water */
.cell.miss::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 26%;
  height: 26%;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0.8;
}

/* a hit — red splash */
.cell.hit {
  background: var(--red);
  animation: splash 0.3s ease;
}
.cell.hit::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 40%;
  height: 40%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
}

/* a sunk ship — darker, dimmed red across the whole ship */
.cell.sunk {
  background: var(--red);
  filter: brightness(0.55);
}
.cell.sunk::after { background: rgba(255, 255, 255, 0.5); }

@keyframes splash {
  0%   { transform: scale(0.7); }
  60%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* shrink cells so two boards fit on small screens */
@media (max-width: 760px) {
  .board { --cell: 30px; }
}
@media (max-width: 600px) {
  /* stack the boards vertically */
  #boards { flex-direction: column; gap: 18px; }
  .board { --cell: 34px; }
}
@media (max-width: 360px) {
  .board { --cell: 30px; gap: 2px; padding: 6px; }
}
