* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #0f172a;
  color: #f8fafc;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.panel {
  background: #111827;
  border: 1px solid #334155;
  border-radius: 16px;
  padding: 16px;
  margin-top: 16px;
}

.hidden {
  display: none;
}

.form-row,
.join-box,
.buttons-row,
.ship-controls,
.battle-head {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

input,
button {
  border-radius: 10px;
  border: 1px solid #475569;
  padding: 10px 12px;
  font-size: 16px;
}

input {
  background: #0b1220;
  color: #fff;
}

button {
  background: #f97316;
  color: white;
  cursor: pointer;
  border: none;
}

button:hover {
  opacity: 0.92;
}

.boards {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 16px;
}

.single-board {
  grid-template-columns: 1fr;
}

.board {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 3px;
  width: min(100%, 420px);
  touch-action: manipulation;
}

.cell {
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  background: #1e293b;
  border: 1px solid #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  user-select: none;
}

.cell.own-ship {
  background: #22c55e;
}

.cell.miss {
  background: #64748b;
}

.cell.hit {
  background: #ef4444;
}

.cell.enemy-unknown {
  background: #1d4ed8;
}

.cell.enemy-unknown:hover {
  filter: brightness(1.15);
}

@media (max-width: 800px) {
  .boards {
    grid-template-columns: 1fr;
  }

  .board {
    width: 100%;
    max-width: 100%;
  }
}
