/* SharpLab HQ — Battleship page.
   Builds on hqstyle.css (shared vars/header/nav/.btn/.card). Only page-specific
   styling here. A free (no-coins) 2-player online game over WebSockets. */

/* ── Page intro ── */
.bs-head { margin: 4px 0 20px; text-align: center; }
.bs-head h1 { font-size: 26px; margin: 0 0 4px; }
.bs-head p { color: var(--muted); margin: 0; font-size: 14px; }

.bs-wrap { max-width: 460px; margin: 0 auto; }
.bs-wrap.wide { max-width: 900px; }

/* ── Lobby ── */
.bs-lobby { display: flex; flex-direction: column; gap: var(--s-4); }
.bs-field { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.bs-field label { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; }
.bs-input {
  width: 100%; box-sizing: border-box; background: var(--panel2); color: var(--fg);
  border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; font-size: 15px;
  transition: border-color var(--t), box-shadow var(--t);
}
.bs-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.bs-input.code { text-transform: uppercase; letter-spacing: 4px; font-weight: 700; font-family: var(--font-mono); }
.bs-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.bs-actions .btn { flex: 1 1 auto; }
.bs-sep { text-align: center; color: var(--faint); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.bs-joinrow { display: flex; gap: var(--s-2); }
.bs-joinrow .bs-input { flex: 1 1 auto; }

/* ── Room / share ── */
.bs-codebox { text-align: center; }
.bs-codelabel { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.bs-code {
  display: inline-block; margin-top: 6px; font-family: var(--font-mono); font-weight: 800;
  font-size: 34px; letter-spacing: 8px; color: var(--gold);
  background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 8px 20px 8px 28px; cursor: pointer; transition: border-color var(--t), transform var(--t);
}
.bs-code:hover { border-color: var(--gold); transform: translateY(-1px); }
.bs-copyhint { display: block; margin-top: 6px; font-size: 11px; color: var(--faint); }

/* ── Status line ── */
.bs-status { text-align: center; font-size: 15px; font-weight: 700; min-height: 22px; }
.bs-status.wait { color: var(--muted); font-weight: 500; }
.bs-status.yours { color: var(--green); }
.bs-status.theirs { color: var(--accent2); }
.bs-status.win { color: var(--green); }
.bs-status.lose { color: var(--red); }

/* ── Player chips ── */
.bs-players { display: flex; justify-content: center; gap: var(--s-3); flex-wrap: wrap; }
.bs-pchip {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r-pill); font-size: 13px;
}
.bs-pchip.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--ring); }
.bs-pname { font-weight: 700; }
.bs-pyou { color: var(--faint); font-size: 11px; }
.bs-pready { color: var(--green); font-size: 11px; font-weight: 700; }
.bs-pwait { color: var(--faint); font-size: 11px; }
.bs-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.bs-dot.on { background: var(--green); }

/* ── Grids ── */
.bs-boards { display: flex; gap: var(--s-4); flex-wrap: wrap; justify-content: center; }
.bs-boardwrap { flex: 1 1 300px; min-width: 260px; max-width: 380px; }
.bs-boardtitle { text-align: center; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 8px; }
.bs-boardtitle .cnt { color: var(--gold); }

.bs-grid {
  display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px;
  width: 100%; aspect-ratio: 1; margin: 0 auto;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--r); padding: 2px;
}
.bs-cell {
  display: grid; place-items: center; background: var(--panel2);
  font-size: 11px; line-height: 1; user-select: none; color: var(--fg);
  border-radius: 2px; transition: background var(--t), border-color var(--t), transform var(--t);
  aspect-ratio: 1;
}
/* Your fleet cells */
.bs-cell.ship { background: var(--accent-soft); border: 1px solid var(--accent); }
.bs-cell.hit { background: var(--red); color: #fff; }
.bs-cell.miss { background: var(--panel); color: var(--faint); }
.bs-cell.sunk { background: var(--red); border: 1px solid var(--gold); color: #fff; }
/* Enemy waters — firable */
.bs-grid.firable .bs-cell.fire { cursor: crosshair; }
.bs-grid.firable .bs-cell.fire:hover { background: var(--accent-soft); border: 1px solid var(--accent); transform: scale(1.04); }
.bs-cell .pin { animation: bs-pop .18s ease both; }
@keyframes bs-pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ── Placement UI ── */
.bs-place { display: flex; flex-direction: column; gap: var(--s-3); }
.bs-tray { display: flex; flex-wrap: wrap; gap: var(--s-2); justify-content: center; }
.bs-ship {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; cursor: pointer;
  background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r-pill); font-size: 13px;
  transition: border-color var(--t), transform var(--t), opacity var(--t);
}
.bs-ship:hover { border-color: var(--accent); transform: translateY(-1px); }
.bs-ship.selected { border-color: var(--gold); box-shadow: 0 0 0 2px var(--ring); }
.bs-ship.placed { opacity: .45; }
.bs-ship.placed:hover { transform: none; border-color: var(--line); }
.bs-ship .pips { display: inline-flex; gap: 2px; }
.bs-ship .pip { width: 8px; height: 8px; border-radius: 2px; background: var(--accent); }
.bs-shipname { font-weight: 700; }
.bs-shiplen { color: var(--faint); font-size: 11px; }
.bs-placehint { text-align: center; color: var(--muted); font-size: 13px; min-height: 18px; }
/* Placement grid hover preview */
.bs-cell.preview-ok { background: var(--accent-soft); border: 1px solid var(--accent); }
.bs-cell.preview-bad { background: var(--red); opacity: .6; }
.bs-placebtns { display: flex; gap: var(--s-2); flex-wrap: wrap; justify-content: center; }
.bs-placebtns .btn { flex: 1 1 auto; }

/* ── Banner + rematch ── */
.bs-banner { text-align: center; margin-top: 6px; }
.bs-rematch { margin-top: 4px; }

@media (prefers-reduced-motion: reduce) {
  .bs-code:hover, .bs-ship:hover, .bs-grid.firable .bs-cell.fire:hover { transform: none; }
  .bs-cell .pin { animation: none; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Copied verbatim from tictactoe.css / cards.css so the coins hub + toasts are
   styled on this page too. This game is free, but the shared nav chip is kept.
   ═══════════════════════════════════════════════════════════════════════════ */
.coinschip { font-weight: 700; color: var(--gold); background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 11px; font-size: 13px; white-space: nowrap; cursor: pointer; transition: border-color .15s, transform .15s; }
.coinschip:hover { border-color: var(--gold); transform: translateY(-1px); }

/* Coins hub modal */
.hubov { position: fixed; inset: 0; z-index: 250; display: grid; place-items: center; padding: 20px; background: rgba(5,7,11,.6); backdrop-filter: blur(3px); animation: cd-scrim-in .18s ease both; }
@keyframes cd-scrim-in { from { opacity: 0; } to { opacity: 1; } }
.hubcard { width: min(460px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px 20px; box-shadow: 0 24px 60px -20px #000; }
.hubhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.hubhead h3 { margin: 0; font-size: 17px; }
.hubx { background: none; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; line-height: 1; padding: 4px 8px; border-radius: 8px; }
.hubx:hover { color: var(--fg); background: var(--panel2); }
.hubrow { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.hubrow:first-of-type { border-top: 0; }
.hubicon { font-size: 20px; width: 30px; text-align: center; flex: 0 0 auto; }
.hubt { font-weight: 700; font-size: 14px; }
.hubd { color: var(--muted); font-size: 12.5px; line-height: 1.45; margin-top: 2px; }
.hubfoot { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; text-align: right; }
.hubfoot b { color: var(--gold); }

.cardtoast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 300;
  background: var(--panel2); color: var(--fg); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 18px; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
