:root {
  --bg0: #04121f;
  --bg1: #061a2b;
  --panel: #0a1e31;
  --panel-2: #0d2740;
  --line: #16324c;
  --line-soft: #122a41;
  --ink: #e8f4ff;
  --ink-dim: #9db8d3;
  --ink-faint: #6386a5;
  --cyan: #57e6ff;
  --cyan-deep: #1f7ea6;
  --red: #ff5c39;
  --amber: #ffb347;
  --foam: #cfe6f7;
  --steel-hi: #a7c1d6;
  --steel-lo: #5f7f9c;
  --font-ui: 'Chakra Petch', 'Trebuchet MS', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-ui);
  color: var(--ink);
  background:
    radial-gradient(1100px 700px at 80% -12%, rgba(31, 126, 166, 0.16), transparent 60%),
    radial-gradient(900px 650px at -10% 108%, rgba(20, 84, 120, 0.14), transparent 60%),
    linear-gradient(180deg, var(--bg0), var(--bg1) 55%, #03101d);
  background-attachment: fixed;
}

body::before {
  content: '';
  position: fixed;
  inset: -20%;
  pointer-events: none;
  background:
    repeating-linear-gradient(115deg, transparent 0 90px, rgba(120, 200, 255, 0.025) 90px 92px);
  animation: drift 26s ease-in-out infinite alternate;
}

@keyframes drift {
  from { transform: translate3d(-2%, -1%, 0); }
  to { transform: translate3d(2%, 1.5%, 0); }
}

button { font: inherit; color: inherit; }

svg.ic, .btn svg, .icon-btn svg { width: 17px; height: 17px; flex: none; }

.hidden { display: none !important; }

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 34px);
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(10, 30, 49, 0.85), rgba(6, 22, 37, 0.4));
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(6px);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--cyan);
  border: 1px solid rgba(87, 230, 255, 0.35);
  border-radius: 50%;
  box-shadow: 0 0 14px rgba(87, 230, 255, 0.18), inset 0 0 10px rgba(87, 230, 255, 0.08);
}

.brand-mark svg { width: 20px; height: 20px; }

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.brand-text small {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.28em;
  color: var(--ink-faint);
  margin-top: 4px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-dim);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.icon-btn:hover { color: var(--cyan); border-color: rgba(87, 230, 255, 0.5); }

.icon-btn .ic-off { display: none; }
.icon-btn.muted .ic-on { display: none; }
.icon-btn.muted .ic-off { display: block; }
.icon-btn.muted { color: var(--ink-faint); }

/* ---------- screens & layout ---------- */

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(16px, 3vw, 34px) clamp(14px, 3.5vw, 34px) 60px;
}

.screen { animation: rise 0.35s ease both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.phase-head { margin: 4px 0 22px; }

.phase-head h2 {
  margin: 0 0 8px;
  font-size: clamp(22px, 4.5vw, 30px);
  font-weight: 700;
  letter-spacing: 0.03em;
}

.phase-head p {
  margin: 0;
  max-width: 62ch;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-dim);
}

.placement-layout {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 26px;
}

.board-slot { width: 100%; display: flex; justify-content: center; }

/* ---------- board frames ---------- */

.board-frame {
  --ruler: 20px;
  width: min(100%, 470px);
  padding: clamp(8px, 1.6vw, 14px);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(140, 200, 240, 0.06);
}

.board-nameplate {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 10px calc(var(--ruler) + 2px);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--ink-dim);
}

.board-nameplate b { color: var(--ink); }

.board-nameplate em {
  font-family: var(--font-mono);
  font-style: normal;
  font-weight: 400;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
}

.ruler {
  display: grid;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-faint);
  user-select: none;
}

.ruler span { display: grid; place-items: center; }

.ruler-top {
  grid-template-columns: repeat(10, 1fr);
  margin: 0 0 4px calc(var(--ruler) + 4px);
}

.board-row { display: flex; align-items: stretch; }

.ruler-left {
  grid-template-rows: repeat(10, 1fr);
  width: var(--ruler);
  margin-right: 4px;
}

.board {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  position: relative;
  border-radius: 4px;
  overflow: hidden;
}

.board.shaking { animation: shake 0.5s ease; }

@keyframes shake {
  10%, 50%, 90% { transform: translate(-3px, 1px); }
  30%, 70% { transform: translate(3px, -2px); }
}

/* ---------- cells ---------- */

.cell {
  appearance: none;
  position: relative;
  border: 0;
  margin: 0;
  padding: 0;
  aspect-ratio: 1 / 1;
  border-radius: 3px;
  background: linear-gradient(155deg, #0d2942 0%, #091d30 70%);
  box-shadow: inset 0 0 0 1px rgba(38, 84, 122, 0.38);
  cursor: default;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.cell:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: -2px;
  z-index: 2;
}

#placementScreen .cell:not(:disabled) { cursor: crosshair; }

.board[data-owner='enemy']:not(.waiting) .cell:not(:disabled) { cursor: crosshair; }

.board[data-owner='enemy']:not(.waiting) .cell:not(:disabled):hover {
  background: linear-gradient(155deg, #143a58 0%, #0e2841 70%);
}

#placementScreen .cell:not(:disabled):hover {
  background: linear-gradient(155deg, #12324e 0%, #0d2438 70%);
}

.board.waiting { opacity: 0.94; }

/* ships */

.cell.ship {
  background: linear-gradient(180deg, var(--steel-hi), var(--steel-lo) 78%);
  box-shadow: inset 0 0 0 1px rgba(24, 48, 68, 0.85), inset 0 2px 0 rgba(255, 255, 255, 0.16);
}

.cell.ship.seg-bow.dir-h { border-radius: 45% 4px 4px 45%; }
.cell.ship.seg-stern.dir-h { border-radius: 4px 45% 45% 4px; }
.cell.ship.seg-bow.dir-v { border-radius: 45% 45% 4px 4px; }
.cell.ship.seg-stern.dir-v { border-radius: 4px 4px 45% 45%; }

.cell.ship::after {
  content: '';
  position: absolute;
  inset: 32% 18%;
  background: rgba(12, 30, 46, 0.35);
  border-radius: 2px;
}

.cell.ship.seg-bow::after, .cell.ship.seg-stern::after { inset: 32% 34%; }

.cell.ship.sunk {
  background: linear-gradient(180deg, #4a3138, #33232a 78%);
  box-shadow: inset 0 0 0 1px rgba(120, 40, 40, 0.9);
}

.cell.ship.sunk::after { background: rgba(20, 10, 12, 0.5); }

.cell.wreck {
  background: linear-gradient(180deg, #43302f, #2c1d20 78%);
  box-shadow: inset 0 0 0 1px rgba(150, 60, 44, 0.75);
}

.cell.wreck.seg-bow.dir-h { border-radius: 45% 4px 4px 45%; }
.cell.wreck.seg-stern.dir-h { border-radius: 4px 45% 45% 4px; }
.cell.wreck.seg-bow.dir-v { border-radius: 45% 45% 4px 4px; }
.cell.wreck.seg-stern.dir-v { border-radius: 4px 4px 45% 45%; }

/* shots */

.cell.miss {
  background: linear-gradient(155deg, #0c2438 0%, #0a1c2c 70%);
}

.cell.miss::after {
  content: '';
  position: absolute;
  inset: 34%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--foam) 0 55%, transparent 60%);
  opacity: 0.85;
}

.cell.miss::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(207, 230, 247, 0.7);
  animation: ripple 0.55s ease-out forwards;
}

@keyframes ripple {
  from { transform: scale(0.25); opacity: 0.9; }
  to { transform: scale(1.15); opacity: 0; }
}

.cell.hit {
  background: radial-gradient(circle at 50% 42%, #3a120a 0 55%, #20090b 100%);
  box-shadow: inset 0 0 0 1px rgba(180, 70, 40, 0.55);
}

.cell.hit::after {
  content: '';
  position: absolute;
  inset: 18%;
  background:
    linear-gradient(45deg, transparent 42%, var(--amber) 44% 56%, transparent 58%),
    linear-gradient(135deg, transparent 42%, var(--amber) 44% 56%, transparent 58%);
}

.cell.hit::before {
  content: '';
  position: absolute;
  inset: -14%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 190, 120, 0.95) 0 18%, rgba(255, 92, 57, 0.85) 22% 40%, transparent 62%);
  animation: burst 0.5s ease-out forwards;
}

@keyframes burst {
  from { transform: scale(0.2); opacity: 1; }
  60% { opacity: 0.9; }
  to { transform: scale(1.1); opacity: 0; }
}

.cell.last-shot { z-index: 1; }

.cell.hit.last-shot, .cell.wreck.last-shot {
  animation: throb 1.1s ease-out infinite;
}

.cell.miss.last-shot {
  animation: throb-cool 1.1s ease-out infinite;
}

@keyframes throb {
  0% { box-shadow: inset 0 0 0 1px rgba(180, 70, 40, 0.55), 0 0 0 0 rgba(255, 150, 80, 0.75); }
  100% { box-shadow: inset 0 0 0 1px rgba(180, 70, 40, 0.55), 0 0 0 9px rgba(255, 150, 80, 0); }
}

@keyframes throb-cool {
  0% { box-shadow: inset 0 0 0 1px rgba(38, 84, 122, 0.38), 0 0 0 0 rgba(120, 210, 255, 0.6); }
  100% { box-shadow: inset 0 0 0 1px rgba(38, 84, 122, 0.38), 0 0 0 9px rgba(120, 210, 255, 0); }
}

/* placement preview */

.cell.preview {
  background: rgba(87, 230, 255, 0.22) !important;
  box-shadow: inset 0 0 0 1px var(--cyan) !important;
}

.cell.preview-bad {
  background: rgba(255, 92, 57, 0.2) !important;
  box-shadow: inset 0 0 0 1px var(--red) !important;
}

/* targeting */

.cell.aim {
  box-shadow: inset 0 0 0 1px rgba(87, 230, 255, 0.3);
  background: #0f3450;
}

.cell.aim-hot::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(87, 230, 255, 0.65), rgba(87, 230, 255, 0.65)) center / 1px 100% no-repeat,
    linear-gradient(rgba(87, 230, 255, 0.65), rgba(87, 230, 255, 0.65)) center / 100% 1px no-repeat;
}

/* radar sweep */

.radar {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 3;
}

.radar::before {
  content: '';
  position: absolute;
  inset: -32%;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(87, 230, 255, 0.16), rgba(87, 230, 255, 0.045) 55deg, transparent 95deg);
  animation: sweep 5.5s linear infinite;
}

@keyframes sweep {
  to { transform: rotate(360deg); }
}

/* ---------- dock ---------- */

.dock {
  width: min(100%, 470px);
  padding: 16px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-self: start;
}

.dock-title, .log-title {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--ink-dim);
}

.dock-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dock-ship {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(9, 26, 42, 0.6);
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  text-align: left;
  transition: border-color 0.15s, background 0.15s, opacity 0.2s;
}

.dock-ship:hover { border-color: rgba(87, 230, 255, 0.45); }

.dock-ship:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.dock-ship.selected {
  border-color: var(--cyan);
  background: rgba(87, 230, 255, 0.09);
  box-shadow: 0 0 12px rgba(87, 230, 255, 0.12);
}

.dock-ship.placed { opacity: 0.45; cursor: default; }

.dock-ship.placed.selected { opacity: 1; }

.dock-ship.dragging-source { opacity: 0.25; }

.hull {
  display: flex;
  gap: 3px;
  flex: none;
}

.hull.v { flex-direction: column; }

.hull i {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--steel-hi), var(--steel-lo) 80%);
  box-shadow: inset 0 0 0 1px rgba(24, 48, 68, 0.8);
}

.hull i:first-child { border-radius: 45% 4px 4px 45%; }
.hull i:last-child { border-radius: 4px 45% 45% 4px; }
.hull.v i:first-child { border-radius: 45% 45% 4px 4px; }
.hull.v i:last-child { border-radius: 4px 4px 45% 45%; }

.dock-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }

.dock-name { font-weight: 600; font-size: 15px; letter-spacing: 0.02em; }

.dock-tag { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-faint); letter-spacing: 0.06em; }

.dock-check {
  display: none;
  width: 18px;
  height: 18px;
  color: var(--cyan);
  flex: none;
}

.dock-ship.placed .dock-check { display: block; }

.ghost {
  position: fixed;
  z-index: 90;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1.04);
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.5));
}

.ghost .hull i {
  background: linear-gradient(180deg, #c3d9ea, #7291ad 80%);
  box-shadow: inset 0 0 0 1px rgba(87, 230, 255, 0.5);
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(11, 32, 52, 0.75);
  color: var(--ink-dim);
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, box-shadow 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover { color: var(--ink); border-color: rgba(87, 230, 255, 0.5); }

.btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn:disabled:hover { color: var(--ink-dim); border-color: var(--line); }

.btn.primary {
  background: linear-gradient(180deg, #0f3c58, #0a2c43);
  border-color: rgba(87, 230, 255, 0.65);
  color: #dbf6ff;
  text-shadow: 0 0 12px rgba(87, 230, 255, 0.4);
  box-shadow: 0 0 18px rgba(87, 230, 255, 0.12), inset 0 1px 0 rgba(160, 230, 255, 0.14);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}

.btn.primary:hover { border-color: var(--cyan); box-shadow: 0 0 24px rgba(87, 230, 255, 0.28); }

.dock-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.dock-actions .btn { flex: 1 1 auto; padding: 9px 10px; font-size: 12.5px; }

#startBtn { margin-top: 2px; }

/* ---------- battle hud ---------- */

.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 22px;
  margin-bottom: 22px;
}

.turn-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(87, 230, 255, 0.4);
  background: rgba(15, 52, 79, 0.5);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #c9f2ff;
}

.turn-pill .lamp {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
  animation: lamp 1.7s ease-in-out infinite;
}

@keyframes lamp {
  50% { opacity: 0.45; }
}

.turn-pill.enemy {
  border-color: rgba(255, 92, 57, 0.45);
  background: rgba(64, 22, 18, 0.5);
  color: #ffd2c4;
}

.turn-pill.enemy .lamp {
  background: var(--red);
  box-shadow: 0 0 10px var(--red);
}

.fleet-status { display: flex; flex-direction: column; gap: 7px; }

.pips-line { display: flex; align-items: center; gap: 10px; }

.pips-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  width: 74px;
}

.pips { display: flex; align-items: center; gap: 7px; }

.pip {
  height: 9px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--steel-hi), var(--steel-lo));
  box-shadow: inset 0 0 0 1px rgba(20, 42, 60, 0.7);
  transition: opacity 0.3s;
}

.pip[data-size='2'] { width: 15px; }
.pip[data-size='3'] { width: 21px; }
.pip[data-size='4'] { width: 27px; }
.pip[data-size='5'] { width: 33px; }

.pip.sunk {
  background: linear-gradient(135deg, #4a2530 0 44%, #8c2f2f 44% 56%, #4a2530 56%);
  opacity: 0.7;
}

.battle-layout {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 26px;
}

/* ---------- log ---------- */

.log-panel {
  width: min(100%, 470px);
  padding: 16px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 10px;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 150px;
  max-height: 560px;
}

#log {
  list-style: none;
  margin: 0;
  padding: 0 6px 0 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.log-entry {
  padding: 5px 10px;
  border-left: 2px solid var(--line);
  color: var(--ink-dim);
  background: rgba(9, 24, 38, 0.45);
  border-radius: 0 4px 4px 0;
  animation: rise 0.25s ease both;
}

.log-entry b { color: var(--ink); font-weight: 600; }

.log-entry.hit { border-color: rgba(255, 92, 57, 0.7); color: #ffb59a; }
.log-entry.miss { border-color: rgba(87, 230, 255, 0.35); }
.log-entry.sunk { border-color: var(--amber); color: #ffd9a0; background: rgba(70, 40, 16, 0.25); }
.log-entry.info { border-color: rgba(87, 230, 255, 0.5); color: #a8ecff; }

/* ---------- toast ---------- */

#toast {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translate(-50%, -14px);
  z-index: 60;
  padding: 10px 24px;
  border-radius: 6px;
  border: 1px solid rgba(255, 92, 57, 0.7);
  background: rgba(26, 12, 14, 0.94);
  color: #ffd9a0;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s, transform 0.22s;
}

#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- overlay ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(3, 10, 18, 0.78);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s;
}

.overlay.show { opacity: 1; }

.overlay.hidden { display: none; }

.overlay-card {
  position: relative;
  width: min(460px, 100%);
  padding: 44px 40px 36px;
  text-align: center;
  background: linear-gradient(180deg, #0d2740, #081829);
  border: 1px solid #2a5a7d;
  border-radius: 12px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  clip-path: polygon(18px 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%, 0 18px);
  transform: translateY(12px);
  transition: transform 0.3s;
}

.overlay.show .overlay-card { transform: none; }

.overlay-card h2 {
  margin: 0 0 10px;
  font-size: clamp(36px, 9vw, 54px);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #7deaff;
  text-shadow: 0 0 26px rgba(87, 230, 255, 0.5);
}

.overlay-card.lost h2 {
  color: #ff8563;
  text-shadow: 0 0 26px rgba(255, 92, 57, 0.4);
}

.overlay-card p {
  margin: 0 0 26px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-dim);
  line-height: 1.6;
}

.stats {
  margin: 0 0 30px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 10px;
  text-align: center;
}

.stats dt {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  margin-bottom: 4px;
}

.stats dd {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
}

.ping {
  position: absolute;
  top: 34px;
  left: 50%;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  pointer-events: none;
}

.ping::before, .ping::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(87, 230, 255, 0.55);
  animation: ping 2.4s ease-out infinite;
}

.ping::after { animation-delay: 1.2s; }

@keyframes ping {
  from { transform: scale(1); opacity: 0.8; }
  to { transform: scale(16); opacity: 0; }
}

/* ---------- responsive ---------- */

@media (min-width: 880px) {
  .placement-layout {
    grid-template-columns: minmax(320px, 500px) minmax(280px, 340px);
    justify-content: center;
    align-items: start;
  }
}

@media (min-width: 1020px) {
  .battle-layout {
    grid-template-columns: minmax(320px, 440px) minmax(320px, 440px) minmax(250px, 300px);
    justify-content: center;
    align-items: start;
  }

  .log-panel { max-height: none; width: auto; }
}

@media (min-width: 640px) and (max-width: 1019px) {
  .battle-layout {
    grid-template-columns: repeat(2, minmax(280px, 440px));
  }

  .log-panel { grid-column: 1 / -1; max-height: 200px; }
}

@media (max-width: 420px) {
  .hull i { width: 17px; height: 17px; }

  .dock { padding: 12px; }

  .stats { gap: 10px 6px; }

  .stats dd { font-size: 20px; }

  .overlay-card { padding: 36px 22px 30px; }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  body::before, .radar::before, .turn-pill .lamp, .cell.hit.last-shot,
  .cell.wreck.last-shot, .cell.miss.last-shot, .ping::before, .ping::after,
  .board.shaking, .screen, .log-entry {
    animation: none !important;
  }

  .cell.miss::before, .cell.hit::before { animation: none !important; opacity: 0; }

  .overlay, .overlay-card, #toast { transition: none; }
}
