/* Potapanje brodova (igra #4). Platformske widgete stilizuje SDK (.vasa-*). */
:root {
    --text: #dceaff;
    --surface: rgba(255, 255, 255, 0.06);
    --surface-bd: rgba(120, 170, 255, 0.22);
    --bg2: #0a1a30;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    background: #061020;
    -webkit-tap-highlight-color: transparent;
}
body::before {
    content: '';
    position: fixed;
    inset: -20%;
    z-index: -1;
    background: radial-gradient(circle at 26% 20%, rgba(56, 132, 255, 0.4), transparent 44%),
               radial-gradient(circle at 78% 72%, rgba(0, 200, 200, 0.3), transparent 44%),
               radial-gradient(circle at 50% 100%, rgba(20, 80, 180, 0.35), transparent 45%);
    filter: blur(50px);
}

.bs-app {
    max-width: 460px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: calc(12px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom));
}

/* ---------- Top bar ---------- */
.bs-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bs-top__btns { display: flex; align-items: center; gap: 8px; }
.bs-iconbtn {
    display: flex; align-items: center; justify-content: center;
    width: 44px; height: 44px;
    color: var(--text);
    border: 1px solid var(--surface-bd);
    border-radius: 14px;
    background: var(--surface);
    backdrop-filter: blur(10px);
    cursor: pointer; text-decoration: none; position: relative;
}

.bs-title {
    margin: 2px 0 0;
    text-align: center;
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 0.5px;
}
.bs-title span {
    background: linear-gradient(90deg, #63b3ff, #3ce0d0, #8ad0ff);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}

.bs-status {
    text-align: center;
    font-size: 15px;
    font-weight: 800;
    min-height: 22px;
    color: rgba(220, 234, 255, 0.9);
}
.bs-status--you { color: #5ef0a8; }
.bs-status--opp { color: #ffcf6b; }
.bs-status--lose { color: #ff8a8a; }

/* ---------- Table ---------- */
.bs-boardwrap { display: flex; flex-direction: column; gap: 5px; }
.bs-board__label {
    font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase;
    color: rgba(220, 234, 255, 0.55); text-align: center; font-weight: 700;
}
.bs-board {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 2px;
    width: 100%;
    max-width: 380px;
    aspect-ratio: 1;
    margin: 0 auto;
    padding: 5px;
    border-radius: 14px;
    background: rgba(10, 26, 48, 0.7);
    border: 1px solid var(--surface-bd);
}
.bs-board--own { max-width: 320px; touch-action: none; }   /* svoja flota; touch-action:none za drag rasporeda */

.bs-cell {
    border-radius: 4px;
    background: rgba(40, 90, 160, 0.28);
    border: 1px solid rgba(120, 170, 255, 0.12);
    position: relative;
    cursor: default;
    transition: background 0.1s ease;
}
/* sonar: otkriven protivnički brod */
.bs-cell.sonar { background: rgba(245, 158, 11, 0.5); box-shadow: inset 0 0 8px #f59e0b; }
.bs-cell.sonar::after { content: ''; position: absolute; inset: 0; margin: auto; width: 30%; height: 30%; border-radius: 50%; background: #ffcf6b; }
/* svoji brodovi */
.bs-cell.ship { background: linear-gradient(135deg, #5b6b86, #8697b3); border-color: rgba(255, 255, 255, 0.25); }
/* promašaj (voda) */
.bs-cell.miss::after {
    content: ''; position: absolute; inset: 0; margin: auto;
    width: 26%; height: 26%; border-radius: 50%;
    background: rgba(220, 234, 255, 0.55);
}
/* pogodak */
.bs-cell.hit { background: radial-gradient(circle, #ff6b5e, #d0342a); border-color: rgba(255, 180, 120, 0.6); }
.bs-cell.hit::after { content: '✷'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 14px; color: #fff2c0; }
/* potopljen brod */
.bs-cell.sunk { background: linear-gradient(135deg, #7a1410, #4a0d0a); border-color: rgba(255, 90, 70, 0.5); }
.bs-cell.sunk::after { content: '✖'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; color: #ff9a8a; }

/* aktivna protivnička tabla (tvoj potez) — nišan */
.bs-board--enemy.active .bs-cell:not(.hit):not(.miss):not(.sunk) { cursor: crosshair; }
.bs-board--enemy.active .bs-cell:not(.hit):not(.miss):not(.sunk):hover { background: rgba(99, 179, 255, 0.4); }
.bs-board--enemy:not(.active) { opacity: 0.75; }

/* placement: brodovi su interaktivni (prevuci da pomeriš, tapni da okreneš) */
.bs-board--own.place .bs-cell.ship { cursor: grab; }
.bs-board--own.place .bs-cell.ship:active { cursor: grabbing; }
.bs-cell.pv-ok { box-shadow: inset 0 0 0 2px #5ef0a8; }
.bs-cell.pv-bad { box-shadow: inset 0 0 0 2px #ff6b6b; background: rgba(239, 68, 68, 0.4) !important; }

/* ---------- Traka pomoći (power-ups) ---------- */
.bs-weapons { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.bs-weapons[hidden] { display: none; }
.bs-wbtn {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 7px 13px; border-radius: 12px; cursor: pointer;
    color: #dceaff; font-size: 13px; font-weight: 800;
    border: 1px solid var(--surface-bd); background: var(--surface);
}
.bs-wbtn small { font-size: 10px; font-weight: 700; color: #ffd86b; letter-spacing: 0; }
.bs-wbtn:disabled { opacity: 0.4; cursor: not-allowed; }
.bs-wbtn.active { border-color: #ffcf6b; background: rgba(245, 158, 11, 0.25); box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.4); }

/* aktivan „nišan" za pomoć (sonar/bomba na protivničkoj, zakrpi na svojoj tabli) */
.bs-board--enemy.aim .bs-cell:not(.hit):not(.miss):not(.sunk) { cursor: crosshair; }
.bs-board--enemy.aim .bs-cell:hover { background: rgba(245, 158, 11, 0.35); }
.bs-board--own.aim .bs-cell.hit { cursor: pointer; box-shadow: inset 0 0 10px #10b981; }

/* ---------- Kontrole rasporeda ---------- */
.bs-controls { display: flex; gap: 8px; justify-content: center; }
.bs-controls[hidden] { display: none; }

.bs-btn {
    padding: 13px 22px;
    font-size: 16px;
    font-weight: 800;
    color: #fff;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    background: linear-gradient(135deg, #2f6bff, #16b6c8);
    box-shadow: 0 10px 24px rgba(47, 107, 255, 0.35);
}
.bs-btn--ghost { background: transparent; border: 1px solid rgba(255, 255, 255, 0.25); color: rgba(255, 255, 255, 0.85); box-shadow: none; }
.bs-controls .bs-btn { flex: 1; max-width: 170px; }

.bs-back {
    align-self: center;
    padding: 9px 22px;
    font-size: 13px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 14px;
    background: transparent;
    cursor: pointer;
}

.bs-adbanner {
    display: flex; align-items: center; justify-content: center;
    width: 100%; max-width: 360px; height: 52px;
    margin: auto auto 0;
    border-radius: 14px;
    border: 1px dashed var(--surface-bd);
    background: var(--surface);
    color: rgba(220, 234, 255, 0.5);
    font-size: 12px; letter-spacing: 2px; text-transform: uppercase;
}

/* ---------- Overlay ---------- */
.bs-overlay {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
    background: rgba(3, 8, 18, 0.82);
    backdrop-filter: blur(8px);
    z-index: 10000;
}
.bs-overlay[hidden] { display: none; }
.bs-card {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    width: 100%; max-width: 330px;
    padding: 28px 30px;
    border-radius: 24px;
    text-align: center;
    background: linear-gradient(160deg, rgba(18, 44, 80, 0.96), rgba(8, 20, 40, 0.96));
    border: 1px solid rgba(120, 170, 255, 0.18);
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.7);
}
.bs-card h2 { margin: 0 0 2px; font-size: 24px; font-weight: 900; color: #63b3ff; }
.bs-card .bs-win { color: #5ef0a8; }
.bs-card .bs-lose { color: #ff8a8a; }
.bs-card__sub { margin: 0 0 6px; font-size: 13px; color: rgba(255, 255, 255, 0.6); }

.bs-card .bs-btn { width: 100%; }
.bs-card--setup { max-width: 400px; }
.bs-card--setup .bs-board--own { max-width: 340px; }
.bs-card--setup .bs-controls .bs-btn { width: auto; }

.bs-input {
    width: 100%;
    padding: 12px 14px;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    letter-spacing: 2px;
    color: #fff;
    border: 1px solid var(--surface-bd);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    outline: none;
}
.bs-input[readonly] { font-size: 12px; letter-spacing: 0; color: rgba(255, 255, 255, 0.7); }
.bs-wager { display: flex; flex-direction: column; gap: 5px; width: 100%; text-align: left; font-size: 12px; font-weight: 600; color: rgba(220, 234, 255, 0.7); }
.bs-room__code { font-size: 42px; font-weight: 900; letter-spacing: 8px; color: #ffd86b; padding: 4px 0; }
.bs-room__wager { margin: 0; font-size: 15px; font-weight: 800; color: #ffd86b; }
.bs-room__btns { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.bs-wait { margin: 8px 0 0; font-size: 14px; font-weight: 700; color: #8ad0ff; animation: bsBlink 1.4s ease-in-out infinite; }
@keyframes bsBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.bs-rematch__msg { margin: 0; font-size: 13px; font-weight: 700; color: #8ad0ff; }
.bs-rematch__msg.ready { color: #5ef0a8; }
.bs-search__spin { font-size: 52px; animation: bsSpin 1.2s ease-in-out infinite; }
@keyframes bsSpin { 0% { transform: rotate(0) scale(1); } 50% { transform: rotate(180deg) scale(1.15); } 100% { transform: rotate(360deg) scale(1); } }
