.bs-game {
  width: 100%;
}

.bs-main-card {
  position: relative;
  overflow: hidden;
  padding: 1.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 252, 246, .84);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(16px);
}

.bs-main-card::before {
  content: "";
  position: absolute;
  right: -5rem;
  top: -6rem;
  width: 15rem;
  height: 15rem;
  border-radius: 999px;
  background: rgba(52, 105, 154, .14);
  pointer-events: none;
}

.bs-status-bar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.bs-status-bar h2 {
  margin: .35rem 0 .35rem;
  color: var(--ink);
  font-size: clamp(1.7rem, 3.2vw, 2.55rem);
  line-height: 1;
  letter-spacing: -.055em;
  font-weight: 900;
}

.bs-status-bar p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.bs-turn-pill {
  flex: 0 0 auto;
  padding: .55rem .85rem;
  border-radius: 999px;
  border: 1px solid rgba(34, 40, 36, .09);
  background: rgba(255, 255, 255, .48);
  color: var(--muted);
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .07em;
  transition: background .2s ease, color .2s ease, border-color .2s ease, transform .2s ease;
}

.bs-turn-pill.is-your-turn {
  color: #fffaf2;
  border-color: rgba(36, 72, 63, .18);
  background: var(--brand);
  box-shadow: 0 12px 26px rgba(36, 72, 63, .18);
  animation: bsTurnPulse 1.55s ease-in-out infinite;
}

.bs-turn-pill.is-opponent-turn {
  color: #2f5f8d;
  border-color: rgba(52, 105, 154, .18);
  background: rgba(52, 105, 154, .13);
}

.bs-turn-pill.is-finished {
  color: #285640;
  border-color: rgba(47, 114, 87, .17);
  background: rgba(47, 114, 87, .13);
}

.bs-board-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.bs-board-card {
  padding: .85rem;
  border: 1px solid rgba(34, 40, 36, .10);
  border-radius: 24px;
  background: rgba(255, 255, 255, .42);
}

.bs-board-card.is-target {
  border-color: rgba(52, 105, 154, .15);
  background: rgba(52, 105, 154, .055);
}

.bs-board-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .7rem;
}

.bs-board-head span {
  display: block;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.bs-board-head strong {
  display: block;
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: -.035em;
}

.bs-board-head small {
  color: var(--muted);
  font-weight: 750;
  text-align: right;
}

.bs-board {
  --bs-size: 10;
  display: grid;
  grid-template-columns: repeat(var(--bs-size), 1fr);
  gap: clamp(.18rem, .42vw, .34rem);
  padding: clamp(.48rem, 1.2vw, .72rem);
  border: 1px solid rgba(52, 105, 154, .18);
  border-radius: 20px;
  background:
    radial-gradient(circle at 16% 12%, rgba(255,255,255,.13), transparent 28%),
    linear-gradient(145deg, rgba(44, 96, 135, .92), rgba(23, 62, 90, .98));
  box-shadow:
    0 16px 34px rgba(52, 105, 154, .13),
    inset 0 1px 0 rgba(255,255,255,.10);
}

.bs-cell {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: rgba(255, 250, 242, .92);
  background: rgba(255, 255, 255, .10);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .09),
    inset 0 -8px 18px rgba(0, 0, 0, .08);
  font-weight: 950;
  line-height: 1;
  transition: transform .14s ease, background .14s ease, box-shadow .14s ease;
}

button.bs-cell {
  cursor: default;
}

.bs-board[data-can-play="1"] button.bs-cell:not(:disabled) {
  cursor: crosshair;
}

.bs-board[data-can-play="1"] button.bs-cell:not(:disabled):hover {
  background: rgba(255, 255, 255, .24);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .14),
    0 0 0 3px rgba(255, 250, 242, .16);
  transform: translateY(-1px) scale(1.03);
}

.bs-cell.has-ship {
  background:
    linear-gradient(145deg, rgba(255, 250, 242, .48), rgba(255, 250, 242, .28)),
    rgba(255, 255, 255, .12);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.24),
    inset 0 -7px 14px rgba(29, 37, 34, .15);
}

.bs-cell.is-miss {
  background: rgba(255, 255, 255, .07);
  color: rgba(255, 250, 242, .78);
}

.bs-cell.is-hit,
.bs-cell.is-sunk {
  background:
    radial-gradient(circle at 50% 48%, rgba(255,255,255,.55), transparent 16%),
    linear-gradient(135deg, #d9894f, #b94b45);
  color: #fffaf2;
  box-shadow:
    inset 0 -8px 14px rgba(0,0,0,.18),
    0 8px 16px rgba(105, 45, 35, .18);
}

.bs-cell.is-sunk,
.bs-cell.is-known-sunk {
  outline: 2px solid rgba(255, 250, 242, .68);
  outline-offset: -3px;
}

.bs-marker {
  display: inline-grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-size: clamp(.7rem, 1.8vw, 1.05rem);
}

.bs-cell.is-new-shot .bs-marker,
.bs-cell.is-new-shot {
  animation: bsShotPulse .42s ease-out;
}

.bs-help-row {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: .95rem;
  color: var(--muted);
  font-size: .92rem;
}

.bs-help-row span:last-child {
  color: var(--brand);
  font-weight: 800;
}

.bs-game.is-my-turn .bs-main-card {
  border-color: rgba(36, 72, 63, .22);
}

.bs-rematch-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(29, 37, 34, .38);
  backdrop-filter: blur(10px);
}

.bs-rematch-modal-backdrop[hidden] {
  display: none;
}

.bs-rematch-modal {
  width: min(100%, 420px);
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--card-solid);
  box-shadow: var(--shadow-soft);
}

.bs-rematch-modal h2 {
  margin: .25rem 0 .5rem;
  color: var(--ink);
  font-weight: 900;
  letter-spacing: -.04em;
}

.bs-rematch-modal p {
  color: var(--muted);
}

.bs-rematch-actions {
  display: flex;
  gap: .65rem;
  margin-top: 1rem;
}

@keyframes bsTurnPulse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-1px); }
}

@keyframes bsShotPulse {
  0% { transform: scale(.82); opacity: .55; }
  70% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@media (max-width: 991.98px) {
  .bs-board-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 575.98px) {
  .bs-main-card {
    padding: .85rem;
  }

  .bs-status-bar {
    flex-direction: column;
  }

  .bs-board-card {
    padding: .62rem;
    border-radius: 20px;
  }

  .bs-board {
    gap: .14rem;
    padding: .42rem;
    border-radius: 16px;
  }

  .bs-cell {
    border-radius: 5px;
  }

  .bs-help-row {
    flex-direction: column;
    gap: .25rem;
  }
}
