.bs-shell {
    display: block;
}

.bs-wrap {
    --bs-deep: #062033;
    --bs-sea: #0d3f5c;
    --bs-sea-lite: #17658b;
    --bs-foam: rgba(180, 226, 244, 0.16);
    --bs-steel: #93a2ac;
    --bs-steel-dk: #3b4750;
    --bs-alert: #e8563f;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-family: Inter, Arial, sans-serif;
    color: var(--cg-ink);
}

.bs-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.bs-chips {
    display: flex;
    gap: 8px;
    min-width: 0;
}

.bs-chip {
    display: flex;
    align-items: baseline;
    gap: 7px;
    padding: 7px 12px;
    border: 1px solid var(--cg-line);
    border-radius: 999px;
    background: var(--cg-panel);
}

.bs-chip span {
    color: var(--cg-muted);
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.bs-chip strong {
    font-size: 0.98rem;
    font-variant-numeric: tabular-nums;
}

.bs-actions {
    display: flex;
    gap: 8px;
}

.bs-btn {
    appearance: none;
    min-height: 40px;
    border: 1px solid var(--cg-line);
    background: var(--cg-panel);
    color: var(--cg-ink);
    border-radius: 9px;
    padding: 9px 14px;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
    transition: border-color 0.12s ease, transform 0.12s ease, background 0.12s ease;
}

.bs-btn:hover:not(:disabled) {
    border-color: var(--cg-teal);
    transform: translateY(-1px);
}

.bs-btn:disabled {
    opacity: 0.48;
    cursor: not-allowed;
}

.bs-primary {
    background: linear-gradient(180deg, #1a6d86, #0f4d63);
    border-color: #0f4d63;
    color: #fff;
}

.bs-primary:hover:not(:disabled) {
    border-color: var(--cg-ink);
}

.bs-key {
    display: inline-block;
    margin-left: 4px;
    padding: 1px 5px;
    border: 1px solid var(--cg-line);
    border-radius: 5px;
    background: var(--cg-bg);
    color: var(--cg-muted);
    font-size: 0.7rem;
}

.bs-icon {
    width: 42px;
    padding: 9px 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.bs-icon svg {
    width: 20px;
    height: 20px;
}

.bs-statusbar {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    min-height: 1.5em;
}

.bs-status {
    font-size: 1.04rem;
    font-weight: 800;
}

.bs-sub {
    color: var(--cg-muted);
    font-size: 0.84rem;
    font-weight: 700;
}

.bs-stage {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    align-items: start;
}

.bs-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    padding: 10px;
    border: 2px solid var(--cg-line);
    border-radius: 14px;
    background: var(--cg-panel);
    box-shadow: var(--cg-shadow);
    transition: border-color 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.bs-panel[data-active="0"] {
    opacity: 0.88;
}

.bs-panel[data-active="1"] {
    border-color: var(--cg-teal);
    box-shadow: 0 0 0 3px rgba(18, 122, 137, 0.16), var(--cg-shadow);
}

.bs-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.bs-head h2 {
    margin: 0;
    font-size: 0.94rem;
    font-weight: 900;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.bs-panel-own .bs-head h2 {
    color: var(--cg-green);
}

.bs-panel-foe .bs-head h2 {
    color: var(--cg-red);
}

.bs-head span {
    color: var(--cg-muted);
    font-size: 0.74rem;
    font-weight: 800;
    white-space: nowrap;
}

.bs-panel[data-active="1"] .bs-head::after {
    content: 'ACTIVE';
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--cg-teal);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    align-self: center;
}

.bs-boardwrap {
    display: grid;
    grid-template-columns: 15px minmax(0, 1fr);
    grid-template-rows: 13px auto;
    gap: 3px;
}

.bs-corner {
    grid-area: 1 / 1;
}

.bs-cols {
    grid-area: 1 / 2;
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
}

.bs-rows {
    grid-area: 2 / 1;
    display: grid;
    grid-template-rows: repeat(10, minmax(0, 1fr));
}

.bs-cols span,
.bs-rows span {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cg-muted);
    font-size: 0.6rem;
    font-weight: 900;
    letter-spacing: 0.02em;
    line-height: 1;
}

.bs-board {
    grid-area: 2 / 2;
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    background:
        radial-gradient(120% 90% at 20% 0%, rgba(120, 200, 230, 0.22), rgba(0, 0, 0, 0) 60%),
        linear-gradient(155deg, var(--bs-sea-lite), var(--bs-sea) 48%, var(--bs-deep));
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35), inset 0 6px 22px rgba(0, 0, 0, 0.3);
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    outline-offset: 3px;
}

.bs-panel-own .bs-board {
    background:
        repeating-linear-gradient(45deg, rgba(214, 244, 255, 0.05) 0 10px, rgba(0, 0, 0, 0) 10px 22px),
        radial-gradient(120% 90% at 20% 0%, rgba(120, 200, 230, 0.22), rgba(0, 0, 0, 0) 60%),
        linear-gradient(155deg, var(--bs-sea-lite), var(--bs-sea) 48%, var(--bs-deep));
}

.bs-panel-foe .bs-board {
    background:
        repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0 8px, rgba(0, 0, 0, 0) 8px 16px),
        radial-gradient(120% 90% at 80% 0%, rgba(90, 160, 200, 0.2), rgba(0, 0, 0, 0) 60%),
        linear-gradient(155deg, #135066, #0a3247 52%, #041a2a);
}

.bs-wrap[data-state="placing"] #bs-board-p {
    touch-action: none;
}

.bs-cell {
    position: relative;
    box-shadow: inset 0 0 0 1px var(--bs-foam);
}

.bs-grab {
    cursor: grab;
}

.bs-aim {
    cursor: crosshair;
}

.bs-aim:hover {
    background: rgba(255, 255, 255, 0.16);
    box-shadow: inset 0 0 0 2px rgba(255, 235, 190, 0.65);
}

.bs-hull {
    position: absolute;
    box-sizing: border-box;
    background: linear-gradient(180deg, #aab7c0, var(--bs-steel) 42%, var(--bs-steel-dk));
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.3);
    z-index: 1;
}

.bs-h .bs-hull {
    left: -1px;
    right: -1px;
    top: 14%;
    bottom: 14%;
}

.bs-h.bs-a .bs-hull {
    left: 10%;
    border-radius: 55% 0 0 55%;
}

.bs-h.bs-b .bs-hull {
    right: 10%;
    border-radius: 0 55% 55% 0;
}

.bs-v .bs-hull {
    top: -1px;
    bottom: -1px;
    left: 14%;
    right: 14%;
    background: linear-gradient(90deg, #aab7c0, var(--bs-steel) 42%, var(--bs-steel-dk));
    box-shadow: inset -3px 0 0 rgba(0, 0, 0, 0.3), inset 2px 0 0 rgba(255, 255, 255, 0.3);
}

.bs-v.bs-a .bs-hull {
    top: 10%;
    border-radius: 55% 55% 0 0;
}

.bs-v.bs-b .bs-hull {
    bottom: 10%;
    border-radius: 0 0 55% 55%;
}

.bs-reveal .bs-hull {
    opacity: 0.45;
}

.bs-sunk .bs-hull {
    background: linear-gradient(180deg, #6a3a37, #2f1a19);
    box-shadow: none;
    border-color: var(--bs-alert);
    border-style: solid;
    border-width: 0;
}

.bs-h.bs-sunk .bs-hull {
    border-top-width: 2px;
    border-bottom-width: 2px;
}

.bs-h.bs-a.bs-sunk .bs-hull {
    border-left-width: 2px;
}

.bs-h.bs-b.bs-sunk .bs-hull {
    border-right-width: 2px;
}

.bs-v.bs-sunk .bs-hull {
    background: linear-gradient(90deg, #6a3a37, #2f1a19);
    border-left-width: 2px;
    border-right-width: 2px;
}

.bs-v.bs-a.bs-sunk .bs-hull {
    border-top-width: 2px;
}

.bs-v.bs-b.bs-sunk .bs-hull {
    border-bottom-width: 2px;
}

.bs-sunk {
    background: rgba(200, 60, 45, 0.22);
}

.bs-mark {
    position: absolute;
    z-index: 2;
}

.bs-miss .bs-mark {
    inset: 30%;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #f2f7f9, #b6c7d1);
    box-shadow: 0 0 0 2px rgba(8, 30, 44, 0.45), 0 0 0 5px rgba(190, 225, 240, 0.22);
}

.bs-hit .bs-mark {
    inset: 8%;
    background: radial-gradient(circle at 50% 42%, #ffe08a 0%, #ff9d3d 32%, var(--bs-alert) 62%, #8d2318 100%);
    clip-path: polygon(50% 0, 60% 30%, 85% 15%, 72% 40%, 100% 50%, 72% 60%, 85% 85%, 60% 70%, 50% 100%, 40% 70%, 15% 85%, 28% 60%, 0 50%, 28% 40%, 15% 15%, 40% 30%);
    filter: drop-shadow(0 0 5px rgba(255, 120, 60, 0.75));
}

.bs-hit.bs-sunk .bs-mark {
    inset: 16%;
}

.bs-prev {
    background: rgba(120, 235, 190, 0.4);
    box-shadow: inset 0 0 0 2px rgba(140, 255, 205, 0.9);
}

.bs-prev-bad {
    background: rgba(255, 90, 70, 0.4);
    box-shadow: inset 0 0 0 2px rgba(255, 130, 110, 0.95);
}

.bs-cursor {
    box-shadow: inset 0 0 0 3px #ffd75e;
    z-index: 3;
}

.bs-fleet {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 0;
    padding: 0;
    list-style: none;
    min-height: 46px;
}

.bs-fs {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border: 1px solid var(--cg-line);
    border-radius: 999px;
    background: var(--cg-bg);
}

.bs-fs b {
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.01em;
}

.bs-pips {
    display: flex;
    gap: 2px;
}

.bs-pips i {
    width: 6px;
    height: 6px;
    border-radius: 2px;
    background: var(--bs-steel);
}

.bs-pips i.bs-pip-on {
    background: var(--bs-alert);
}

.bs-fs-sunk {
    border-color: var(--cg-red);
    background: #fbeceb;
    color: var(--cg-red);
}

.bs-fs-sunk b {
    text-decoration: line-through;
}

.bs-fs-off {
    opacity: 0.45;
}

.bs-tray {
    min-height: 108px;
    padding: 10px 12px;
    border: 1px solid var(--cg-line);
    border-radius: 12px;
    background: linear-gradient(140deg, #eef6f9, #f8fbfc 60%, #eef3f7);
}

.bs-roster {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.bs-shipbtn {
    appearance: none;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 46px;
    padding: 6px 12px;
    border: 1px solid var(--cg-line);
    border-radius: 10px;
    background: var(--cg-panel);
    color: var(--cg-ink);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: grab;
    touch-action: none;
    transition: border-color 0.12s ease, transform 0.12s ease;
}

.bs-shipbtn:hover {
    border-color: var(--cg-teal);
    transform: translateY(-1px);
}

.bs-shipbtn.bs-selected {
    border-color: var(--cg-teal);
    background: #e2f2f5;
    box-shadow: 0 0 0 2px rgba(18, 122, 137, 0.28);
}

.bs-shipbtn.bs-placed {
    opacity: 0.6;
}

.bs-shipbtn.bs-placed.bs-selected {
    opacity: 1;
}

.bs-mini {
    display: flex;
    gap: 2px;
}

.bs-mini i {
    width: 9px;
    height: 16px;
    border-radius: 2px;
    background: linear-gradient(180deg, #aab7c0, var(--bs-steel-dk));
}

.bs-mini i:first-child {
    border-radius: 6px 2px 2px 6px;
}

.bs-mini i:last-child {
    border-radius: 2px 6px 6px 2px;
}

.bs-placebar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 9px;
}

.bs-tray-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 7px;
}

.bs-tray-head strong {
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--cg-teal);
}

.bs-tray-head span {
    color: var(--cg-muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.bs-tray-btns {
    display: flex;
    gap: 8px;
}

.bs-log {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.bs-logcol h3 {
    margin: 0 0 4px;
    color: var(--cg-muted);
    font-size: 0.66rem;
    font-weight: 900;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.bs-logcol ul {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.bs-log li {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 4px 9px;
    border-left: 3px solid var(--cg-line);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.8);
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
}

.bs-log-hit {
    border-left-color: var(--bs-alert);
}

.bs-log-hit span {
    color: var(--cg-red);
    font-weight: 800;
}

.bs-log-sunk {
    border-left-color: #8d2318;
    background: #fbe9e7;
}

.bs-log-sunk span {
    color: #8d2318;
    font-weight: 900;
}

.bs-log-miss span {
    color: var(--cg-muted);
    font-weight: 700;
}

.bs-log-empty {
    color: var(--cg-muted);
}

.bs-stats {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.bs-stat {
    min-width: 84px;
    padding: 8px 16px;
    border: 1px solid var(--cg-line);
    border-radius: 9px;
    background: var(--cg-panel);
    text-align: center;
}

.bs-stat span {
    display: block;
    color: var(--cg-muted);
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.bs-stat strong {
    display: block;
    font-size: 1.12rem;
}

.bs-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(6, 26, 40, 0.6);
}

.bs-overlay[hidden] {
    display: none;
}

.bs-dialog {
    position: relative;
    width: 100%;
    max-width: 470px;
    padding: 22px 24px;
    border-radius: 14px;
    background: var(--cg-panel);
    color: var(--cg-ink);
    box-shadow: var(--cg-shadow);
}

.bs-dialog h2 {
    margin: 0 0 10px;
    font-size: 1.2rem;
}

.bs-dialog ul {
    margin: 0;
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.9rem;
    line-height: 1.45;
}

.bs-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border: 1px solid var(--cg-line);
    border-radius: 9px;
    background: var(--cg-panel);
    color: var(--cg-ink);
    font-size: 1.2rem;
    font-weight: 800;
    cursor: pointer;
}

.bs-close:hover {
    border-color: var(--cg-red);
    color: var(--cg-red);
}

.bs-resdialog {
    text-align: center;
    background: linear-gradient(160deg, #eef7fa, #ffffff 55%, #eef2f7);
}

.bs-res-badge {
    display: inline-block;
    margin-bottom: 8px;
    padding: 5px 16px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 900;
    letter-spacing: 0.16em;
}

.bs-res-badge.bs-win {
    background: var(--cg-green);
    color: #fff;
}

.bs-res-badge.bs-lose {
    background: var(--cg-red);
    color: #fff;
}

.bs-res-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 14px 0 16px;
}

.bs-res-grid div {
    padding: 9px 6px;
    border: 1px solid var(--cg-line);
    border-radius: 10px;
    background: var(--cg-panel);
}

.bs-res-grid span {
    display: block;
    color: var(--cg-muted);
    font-size: 0.66rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.bs-res-grid strong {
    display: block;
    font-size: 1.25rem;
}

.bs-res-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

@media (max-width: 760px) {
    .bs-stage {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }

    .bs-wrap[data-state="battle"] .bs-panel-foe {
        order: -1;
    }

    .bs-panel[data-active="0"] {
        opacity: 0.82;
        filter: saturate(0.72);
    }

    .bs-panel[data-active="0"] .bs-head h2 {
        color: var(--cg-muted);
    }

    .bs-panel[data-active="1"] {
        box-shadow: 0 0 0 3px rgba(18, 122, 137, 0.24), var(--cg-shadow);
    }

    .bs-panel[data-active="1"] .bs-head::after {
        font-size: 0.64rem;
        padding: 3px 9px;
    }

    .bs-wrap {
        gap: 10px;
    }

    .bs-chip {
        padding: 6px 10px;
        gap: 5px;
    }

    .bs-chip span {
        font-size: 0.6rem;
    }

    .bs-chip strong {
        font-size: 0.9rem;
    }

    .bs-btn {
        padding: 9px 11px;
        font-size: 0.82rem;
    }

    .bs-status {
        font-size: 0.95rem;
    }

    .bs-boardwrap {
        grid-template-columns: 13px minmax(0, 1fr);
    }

    .bs-log {
        grid-template-columns: minmax(0, 1fr);
    }

    .bs-tray {
        min-height: 96px;
        padding: 9px 10px;
    }

    .bs-stat {
        min-width: 70px;
        padding: 7px 12px;
    }

    .bs-stat strong {
        font-size: 1rem;
    }
}

@media (max-width: 420px) {
    .bs-shipbtn {
        flex: 1 1 44%;
        padding: 6px 8px;
        font-size: 0.75rem;
    }

    .bs-mini i {
        width: 7px;
        height: 14px;
    }

    .bs-placebar .bs-btn {
        flex: 1 1 44%;
    }
}
