:root { --sea1:#0a3d62; --sea2:#1a7f37; --accent:#f7b731; }
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh;
  font-family: system-ui, -apple-system, sans-serif;
  background: linear-gradient(180deg, #0a3d62 0%, #1e5799 60%, #2989d8 100%);
  color: #fff; padding-bottom: 40px;
}
#fishes { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.fish { position: fixed; left: -40px; font-size: 22px; opacity: .5; animation: swim linear infinite; }
@keyframes swim { from { transform: translateX(-60px); } to { transform: translateX(110vw); } }
header { text-align: center; padding: 14px 10px 4px; position: relative; z-index: 1; }
header h1 { margin: 0; font-size: 24px; text-shadow: 0 2px 6px rgba(0,0,0,.4); }
#tabs { display: flex; gap: 6px; justify-content: center; padding: 8px; position: relative; z-index: 1; flex-wrap: wrap; }
#tabs button { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 10px; padding: 8px 14px; font-size: 15px; cursor: pointer; }
#tabs button.on { background: var(--accent); color: #1a1a1a; border-color: var(--accent); font-weight: 600; }
main { max-width: 720px; margin: 0 auto; padding: 10px; position: relative; z-index: 1; }
.panel { background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.15); border-radius: 12px; padding: 12px; margin: 8px 0; }
#match-info { text-align: center; font-size: 18px; font-weight: 700; margin: 8px 0; }
#status { text-align: center; min-height: 22px; color: #ffe9a8; font-size: 15px; margin-bottom: 4px; }
#boards { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.board-wrap { text-align: center; }
.board-wrap h3 { margin: 4px 0 6px; font-size: 14px; font-weight: 600; opacity: .9; }
.board { display: grid; grid-template-columns: repeat(10, 30px); grid-auto-rows: 30px; gap: 2px; background: rgba(255,255,255,.08); padding: 4px; border-radius: 8px; }
#place-board { margin: 0 auto; width: max-content; }
.cell { background: rgba(255,255,255,.16); border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 14px; cursor: default; user-select: none; }
.board.clickable .cell, #enemy-board .cell, #place-board .cell { cursor: pointer; }
.cell.ship { background: #cfd8dc; }
.cell.ghost { background: rgba(247,183,49,.55); }
.cell.miss { background: rgba(255,255,255,.1); color: #bcd; }
.cell.hit { background: #c0392b; }
.cell.sunk { background: #7b241c; }
.row { display: flex; gap: 8px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
button.big, .row button { background: var(--sea2); color: #fff; border: none; border-radius: 10px; padding: 10px 16px; font-size: 15px; cursor: pointer; }
.row button:disabled { opacity: .45; cursor: default; }
.row button:not(:disabled):hover { filter: brightness(1.12); }
#btn-ai { background: var(--accent); color: #1a1a1a; font-weight: 600; }
table { width: 100%; border-collapse: collapse; background: rgba(0,0,0,.35); border-radius: 10px; overflow: hidden; }
th, td { padding: 8px 10px; text-align: center; border-bottom: 1px solid rgba(255,255,255,.1); }
th { background: rgba(255,255,255,.1); }
.hidden { display: none !important; }
.shake { animation: shake .35s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-box { background: #0e2a47; border: 1px solid rgba(255,255,255,.2); border-radius: 14px; padding: 20px; text-align: center; max-width: 90vw; }
.modal-box h2 { margin: 0 0 8px; }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 1001; }
.cf { position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 2px; animation: fall 3s linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(540deg); } }
@media (max-width: 520px) {
  .board { grid-template-columns: repeat(10, 27px); grid-auto-rows: 27px; }
}
