/* Web Battleship — play-specific layout on top of style.css. */

.play-hero {
  padding: 24px 16px 4px;
  text-align: center;
}
.play-hero h1 {
  margin: 8px 0 0;
  font-size: 30px;
  letter-spacing: 2px;
  color: var(--accent);
  text-shadow: 0 2px 12px rgba(0,0,0,.7);
}
.play-status {
  margin: 6px 0 0;
  color: var(--fg-dim);
  font-size: 13px;
}

.play-main { max-width: 980px; margin: 0 auto; padding: 12px 12px 32px; }

.phase { animation: fade .3s ease both; }
.phase.hidden { display: none; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.phase-card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 18px 50px rgba(0,0,0,.4);
}
.phase-card.center { text-align: center; }
.phase-card h2 {
  margin: 0 0 6px;
  font-size: 22px;
  color: var(--fg);
}
.phase-card .hint, .stats-line, .muted {
  color: var(--fg-dim);
  font-size: 13px;
  margin: 0 0 12px;
}

.placement-controls { display: flex; gap: 10px; margin: 10px 0 14px; flex-wrap: wrap; }
.placement-controls .btn { flex: 1 1 160px; }

.btn {
  font: inherit; cursor: pointer; padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--border); background: rgba(255,255,255,.04); color: var(--fg);
  transition: background .15s, transform .1s;
}
.btn:hover { background: rgba(255,255,255,.10); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-accent { background: var(--accent); color: #1d1303; border-color: var(--accent); font-weight: 700; }
.btn-accent:hover { filter: brightness(1.05); }
.btn-outline { background: transparent; }

.turn-line { font-weight: 700; color: var(--accent); margin: 0 0 4px; }
.turn-line.cpu { color: #ff8a80; }

/* ── Board grid ──────────────────────────────────────── */

.single-board-wrap, .boards {
  display: flex; gap: 16px; justify-content: center; align-items: flex-start;
  margin-top: 6px;
}
.boards { flex-wrap: wrap; }
.board-col {
  flex: 1 1 320px;
  max-width: 440px;
  display: flex; flex-direction: column; align-items: center;
}
.board-label {
  font-size: 12px; text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--fg-dim); margin-bottom: 4px; align-self: flex-start;
}

/* ── Coordinate labels (A–H top, 1–8 left) ──────────── */
.board-frame {
  display: grid;
  grid-template-columns: 18px 1fr;
  grid-template-rows: 18px 1fr;
  gap: 2px;
  width: 100%;
  max-width: 460px;
}
.board-frame > .corner { grid-row: 1; grid-column: 1; }
.board-frame > .cols {
  grid-row: 1; grid-column: 2;
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 1px;
  align-items: center; justify-items: center;
}
.board-frame > .rows {
  grid-row: 2; grid-column: 1;
  display: grid; grid-template-rows: repeat(8, 1fr); gap: 1px;
  align-items: center; justify-items: center;
}
.board-frame > .board { grid-row: 2; grid-column: 2; }
.cols span, .rows span {
  font-size: 10px; color: var(--accent);
  text-shadow: 0 1px 2px rgba(0,0,0,.7);
  font-weight: 700;
}

.board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 1px;
  width: 100%;
  aspect-ratio: 1;
  max-width: 440px;
  background: #04101b;                /* shows as 1px grid lines */
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1px;
  user-select: none;
  -webkit-user-select: none;
}
#own-board-placement { max-width: 460px; margin-top: 6px; }

.cell {
  position: relative;
  background: linear-gradient(135deg, #1a3754, #16304a);
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; line-height: 1;
  cursor: default;
  overflow: hidden;
  transition: background .12s;
}
.cell.tappable { cursor: pointer; }
.cell.tappable:hover { background: linear-gradient(135deg, #21466b, #1c3a59); }
.cell.ship  { background: linear-gradient(135deg, #57636e, #404a55); }
.cell.miss  { background: linear-gradient(135deg, #2c4f72, #1d3d5d); }
.cell.miss::after { content: ""; width: 30%; height: 30%; border-radius: 50%; background: rgba(255,255,255,.85); }
.cell.hit   { background: linear-gradient(135deg, #b03325, #6e1d14); }
.cell.hit::after { content: "✸"; color: #ffd54f; font-size: 18px; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.cell.sunk  { background: linear-gradient(135deg, #5a1818, #2c0c0c); }
.cell.sunk::after { content: "✸"; color: #ffb74d; font-size: 18px; }
.cell.last-shot { outline: 2px solid #ffd54f; outline-offset: -2px; }

/* Ghost preview (placement) */
.cell.ghost-ok  { background: rgba(255,213,79,.40); outline: 1px solid rgba(255,213,79,.7); outline-offset: -1px; }
.cell.ghost-bad { background: rgba(255,80,80,.40); outline: 1px solid rgba(255,80,80,.7); outline-offset: -1px; }

/* Stats / fleet remaining */
.stats-line { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.stats-line span { color: var(--fg); }

/* Result modal-like card */
.result-actions { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.name-row {
  display: flex; gap: 8px; justify-content: center; align-items: center;
  margin: 12px auto 8px; max-width: 360px; flex-wrap: wrap;
}
.name-row input {
  flex: 1 1 160px; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: rgba(0,0,0,.3); color: var(--fg);
  font: inherit;
}
.name-row input::placeholder { color: var(--fg-dim); }

/* GIF FX layered on the last-shot cell — small animated overlay. */
.cell.fx-hit::before, .cell.fx-miss::before {
  content: ""; position: absolute; inset: 0;
  background-position: center; background-size: 140% 140%; background-repeat: no-repeat;
  pointer-events: none;
  animation: fxFade 1.4s ease-out forwards;
}
.cell.fx-hit::before  { background-image: url("fire.gif"); }
.cell.fx-miss::before { background-image: url("water_splash.gif"); }
@keyframes fxFade {
  0% { opacity: 0; transform: scale(.6); }
  20% { opacity: 1; transform: scale(1); }
  85% { opacity: 1; }
  100% { opacity: 0; }
}

/* Subtle small-cell on phones */
@media (max-width: 540px) {
  .play-hero h1 { font-size: 24px; letter-spacing: 1.5px; }
  .boards { flex-direction: column; align-items: center; }
  .board-col { width: 100%; max-width: 380px; }
  .cell::after { font-size: 14px; }
}

/* Mode + difficulty pickers on the placement screen */
.game-options {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 4px 0 10px;
}
.opt-group {
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 10px;
  padding: 4px 10px 8px;
  margin: 0;
  min-width: 150px;
}
.opt-group legend {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: rgba(255, 255, 255, .65);
  padding: 0 4px;
}
.opt-group label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .85rem;
  margin-right: 8px;
  cursor: pointer;
  white-space: nowrap;
}
.opt-group input { accent-color: var(--accent); }

/* ── Battle polish: hint, combo callout, blitz critical ── */
.battle-card { position: relative; }

.hint-row { margin: 0 0 10px; }
.hint-row .btn { font-size: .85rem; padding: 7px 14px; }

/* Pulsing gold ring on the sonar-revealed enemy ship cell. */
.cell.hint-mark {
  box-shadow: inset 0 0 0 2px var(--accent);
  animation: hint-pulse 1.2s ease-in-out infinite;
}
@keyframes hint-pulse {
  0%, 100% { box-shadow: inset 0 0 0 2px var(--accent); }
  50%      { box-shadow: inset 0 0 0 3px var(--accent), 0 0 12px var(--accent); }
}

/* Big centered "Nx!" that pops + fades on consecutive hits. */
.combo-callout {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none; z-index: 5;
  font-size: 64px; font-weight: 900; color: var(--accent);
  text-shadow: 0 4px 18px rgba(0,0,0,.85), 0 0 32px rgba(255,213,79,.45);
}
.combo-callout.show { animation: combo-pop 1.1s ease both; }
@keyframes combo-pop {
  0%   { opacity: 0; transform: scale(.4); }
  18%  { opacity: 1; transform: scale(1.15); }
  30%  { transform: scale(1); }
  75%  { opacity: 1; }
  100% { opacity: 0; transform: scale(1.05); }
}

/* Blitz final-3s warning: the turn line pulses red. */
.turn-line.critical { color: #ff5252; animation: blitz-critical .5s ease-in-out infinite; }
@keyframes blitz-critical {
  0%, 100% { opacity: 1; }
  50%      { opacity: .55; }
}
@media (prefers-reduced-motion: reduce) {
  .cell.hint-mark, .combo-callout.show, .turn-line.critical { animation: none; }
}
