:root {
    --bs-bg-1: #111827;
    --bs-bg-2: #1f2937;
    --bs-bg-3: #0f172a;
    --bs-line: #374151;
    --bs-line-soft: #4b5563;
    --bs-text-soft: #9ca3af;
    --bs-blue: #60a5fa;
    --bs-cyan: #22d3ee;
    --bs-green: #34d399;
    --bs-red: #f87171;
    --bs-orange: #fb923c;
    --bs-cell-water: #132236;
    --bs-cell-ship: #64748b;
    --bs-cell-hit: #dc2626;
    --bs-cell-miss: #0284c7;
    --bs-cell-preview: #10b981;
    --bs-cell-invalid: #b91c1c;
}

.bs-hero {
    position: relative;
    border: 1px solid var(--bs-line);
    border-radius: 1rem;
    background: radial-gradient(circle at top right, rgba(96, 165, 250, 0.18), transparent 32%),
                linear-gradient(145deg, var(--bs-bg-2), var(--bs-bg-1));
    padding: 1.6rem;
}

.bs-hero-guide-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    border-color: rgba(96, 165, 250, 0.65);
    background: rgba(15, 23, 42, 0.84);
    color: #dbeafe;
}

.bs-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border: 1px solid #1e3a8a;
    background: rgba(37, 99, 235, 0.2);
    color: #bfdbfe;
    border-radius: 999px;
    padding: 0.2rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.bs-hero-title {
    margin-top: 0.7rem;
    font-size: 2rem;
    line-height: 1.2;
    font-weight: 800;
    color: #e5efff;
}

.bs-hero-subtitle {
    margin-top: 0.45rem;
    color: #cbd5e1;
    max-width: 760px;
}

.bs-hero-pills {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.bs-hero-pills span {
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid var(--bs-line);
    border-radius: 999px;
    padding: 0.3rem 0.7rem;
    font-size: 0.78rem;
    color: #cbd5e1;
}

.bs-layout {
    display: grid;
    grid-template-columns: 330px 1fr;
    gap: 1rem;
}

.bs-sidebar,
.bs-main {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.bs-card {
    border: 1px solid var(--bs-line);
    background: linear-gradient(160deg, rgba(31, 41, 55, 0.95), rgba(15, 23, 42, 0.96));
    border-radius: 0.95rem;
    padding: 1rem;
}

.bs-status-card {
    padding-bottom: 1.1rem;
}

.bs-card-title,
.bs-card h3 {
    font-size: 1.08rem;
    font-weight: 700;
    color: #e5e7eb;
}

.bs-card-title.mb-0 {
    margin-bottom: 0;
}

.bs-muted {
    color: var(--bs-text-soft);
    font-size: 0.86rem;
}

.bs-label {
    display: block;
    color: #d1d5db;
    font-size: 0.82rem;
    margin-bottom: 0.35rem;
}

.bs-control-group {
    margin-top: 0.7rem;
}

.bs-select,
.bs-input {
    width: 100%;
    border: 1px solid var(--bs-line-soft);
    background: rgba(17, 24, 39, 0.9);
    color: #f3f4f6;
    border-radius: 0.7rem;
    padding: 0.55rem 0.7rem;
    font-size: 0.9rem;
}

.bs-select:focus,
.bs-input:focus,
.bs-btn:focus,
.bs-range:focus {
    outline: 2px solid rgba(96, 165, 250, 0.6);
    outline-offset: 1px;
}

.bs-range {
    width: 100%;
}

.bs-check {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: #d1d5db;
    font-size: 0.84rem;
    margin-top: 0.5rem;
}

.bs-check input {
    width: 1rem;
    height: 1rem;
}

.bs-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.bs-mode-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
}

.bs-btn {
    border: 1px solid transparent;
    border-radius: 0.7rem;
    font-size: 0.84rem;
    font-weight: 700;
    padding: 0.5rem 0.78rem;
    cursor: pointer;
    transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.bs-btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

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

.bs-btn-primary {
    background: linear-gradient(135deg, #2563eb, #0284c7);
    color: white;
    border-color: #1d4ed8;
}

.bs-btn-secondary {
    background: rgba(55, 65, 81, 0.7);
    color: #e5e7eb;
    border-color: var(--bs-line-soft);
}

.bs-btn-ghost {
    background: transparent;
    color: #d1d5db;
    border-color: var(--bs-line-soft);
}

.bs-btn-danger {
    background: rgba(220, 38, 38, 0.18);
    color: #fecaca;
    border-color: rgba(220, 38, 38, 0.5);
}

.bs-pill {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--bs-line-soft);
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
    font-size: 0.74rem;
    font-weight: 700;
}

.bs-pill-muted {
    color: #cbd5e1;
    background: rgba(30, 41, 59, 0.6);
}

.bs-pill-ok {
    color: #bbf7d0;
    background: rgba(6, 78, 59, 0.42);
    border-color: rgba(16, 185, 129, 0.55);
}

.bs-pill-warn {
    color: #fde68a;
    background: rgba(120, 53, 15, 0.35);
    border-color: rgba(245, 158, 11, 0.5);
}

.bs-status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.bs-status-chip {
    border: 1px solid var(--bs-line);
    background: rgba(2, 6, 23, 0.62);
    color: #d1d5db;
    border-radius: 999px;
    padding: 0.28rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 700;
}

.bs-turn-row {
    margin-top: 0.9rem;
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 1rem;
    align-items: center;
}

.bs-turn-label {
    font-size: 0.78rem;
    color: var(--bs-text-soft);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.bs-turn-value {
    margin-top: 0.1rem;
    font-size: 1.08rem;
    font-weight: 700;
    color: #e5e7eb;
}

.bs-timer {
    min-width: 70px;
    text-align: center;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--bs-cyan);
    border-radius: 0.8rem;
    border: 1px solid rgba(34, 211, 238, 0.35);
    background: rgba(8, 47, 73, 0.3);
    padding: 0.48rem 0.5rem;
}

.bs-timer.warning {
    color: #facc15;
    border-color: rgba(250, 204, 21, 0.45);
}

.bs-timer.danger {
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.6);
}

.bs-morse-panel {
    margin-top: 0.9rem;
    border: 1px solid #1e3a8a;
    background: linear-gradient(135deg, rgba(12, 74, 110, 0.28), rgba(15, 23, 42, 0.62));
    border-radius: 0.8rem;
    padding: 0.75rem;
}

.bs-morse-visual {
    font-family: "Courier New", Courier, monospace;
    font-size: 1.18rem;
    letter-spacing: 0.1em;
    color: #dbeafe;
}

.bs-morse-decoded {
    margin-top: 0.35rem;
    color: #bae6fd;
    font-size: 0.88rem;
}

.bs-board-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.bs-board-header {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.bs-mini-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    color: #cbd5e1;
    font-size: 0.79rem;
}

.bs-mini-stats strong {
    color: #e2e8f0;
}

.bs-board-shell {
    margin-top: 0.75rem;
}

.bs-col-labels {
    margin-left: 1.45rem;
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 2px;
    font-size: 0.7rem;
    color: #9ca3af;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.bs-col-labels span,
.bs-row-labels span {
    text-align: center;
}

.bs-board-main {
    display: flex;
    gap: 0.3rem;
}

.bs-row-labels {
    width: 1.2rem;
    display: grid;
    grid-template-rows: repeat(10, minmax(0, 1fr));
    gap: 2px;
    font-size: 0.68rem;
    color: #9ca3af;
    font-weight: 700;
}

.bs-row-labels span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
}

.bs-board {
    width: min(100%, 380px);
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 2px;
    background: #0b1b30;
    border-radius: 0.55rem;
    padding: 2px;
}

.bs-cell {
    background: var(--bs-cell-water);
    border: 1px solid rgba(148, 163, 184, 0.2);
    min-height: 26px;
    aspect-ratio: 1 / 1;
    border-radius: 0.25rem;
    cursor: pointer;
    position: relative;
    transition: transform 0.12s ease, filter 0.12s ease;
}

.bs-cell:hover {
    transform: scale(1.03);
    filter: brightness(1.12);
}

.bs-cell.player-ship {
    background: var(--bs-cell-ship);
}

.bs-cell.preview-valid {
    background: rgba(16, 185, 129, 0.78);
}

.bs-cell.preview-invalid {
    background: rgba(185, 28, 28, 0.8);
}

.bs-cell.hit {
    background: var(--bs-cell-hit);
}

.bs-cell.hit::after {
    content: "";
    position: absolute;
    inset: 28%;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
}

.bs-cell.miss {
    background: var(--bs-cell-miss);
}

.bs-cell.miss::after {
    content: "";
    position: absolute;
    inset: 34%;
    border-radius: 999px;
    border: 2px solid rgba(224, 242, 254, 0.85);
}

.bs-cell.sunk {
    box-shadow: inset 0 0 0 2px rgba(249, 115, 22, 0.7);
}

.bs-placement,
.bs-fire-panel {
    margin-top: 0.95rem;
    border-top: 1px solid var(--bs-line);
    padding-top: 0.8rem;
}

.bs-placement h4,
.bs-fire-panel h4 {
    font-size: 0.92rem;
    font-weight: 700;
    color: #e5e7eb;
}

.bs-ship-queue {
    margin-top: 0.62rem;
    display: grid;
    gap: 0.45rem;
}

.bs-ship-item {
    border: 1px solid var(--bs-line-soft);
    background: rgba(17, 24, 39, 0.6);
    border-radius: 0.6rem;
    padding: 0.42rem 0.55rem;
    font-size: 0.8rem;
    color: #d1d5db;
}

.bs-ship-item.active {
    border-color: #0ea5e9;
    box-shadow: inset 0 0 0 1px rgba(14, 165, 233, 0.45);
}

.bs-ship-item.done {
    opacity: 0.5;
}

.bs-fire-row {
    margin-top: 0.65rem;
    display: flex;
    gap: 0.45rem;
}

.bs-fire-row .bs-input {
    max-width: 120px;
    text-transform: uppercase;
    text-align: center;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.bs-log {
    margin-top: 0.65rem;
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--bs-line);
    background: rgba(3, 7, 18, 0.78);
    border-radius: 0.7rem;
    padding: 0.5rem;
}

.bs-log-entry {
    border-bottom: 1px solid rgba(51, 65, 85, 0.35);
    padding: 0.45rem 0.35rem;
    font-size: 0.8rem;
    color: #cbd5e1;
}

.bs-log-entry:last-child {
    border-bottom: 0;
}

.bs-log-entry.hit {
    color: #fecaca;
}

.bs-log-entry.miss {
    color: #bae6fd;
}

.bs-log-entry.info {
    color: #bfdbfe;
}

.bs-log-entry.sunk {
    color: #fdba74;
}

.bs-help-grid {
    margin-top: 0.65rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.bs-help-grid h4 {
    font-size: 0.9rem;
    font-weight: 700;
    color: #bfdbfe;
}

.bs-help-grid p {
    margin-top: 0.25rem;
    color: #cbd5e1;
    font-size: 0.82rem;
    line-height: 1.45;
}

.bs-best-stats {
    display: grid;
    gap: 0.42rem;
}

.bs-best-row {
    border: 1px solid rgba(71, 85, 105, 0.5);
    background: rgba(2, 6, 23, 0.55);
    border-radius: 0.6rem;
    padding: 0.42rem 0.55rem;
    font-size: 0.77rem;
}

.bs-best-row strong {
    color: #e2e8f0;
}

.bs-room-list {
    max-height: 260px;
    overflow-y: auto;
    display: grid;
    gap: 0.5rem;
}

.bs-room-item {
    border: 1px solid var(--bs-line);
    border-radius: 0.6rem;
    background: rgba(2, 6, 23, 0.55);
    padding: 0.52rem;
}

.bs-room-item h4 {
    font-size: 0.85rem;
    font-weight: 700;
    color: #dbeafe;
}

.bs-room-item p {
    margin-top: 0.2rem;
    font-size: 0.76rem;
    color: #cbd5e1;
}

.bs-room-item .bs-actions {
    margin-top: 0.45rem;
}

.bs-active-room {
    border: 1px solid #1d4ed8;
    border-radius: 0.65rem;
    padding: 0.6rem;
    background: rgba(30, 64, 175, 0.2);
}

.bs-active-room.hidden {
    display: none;
}

.bs-active-room-row {
    font-size: 0.78rem;
    color: #dbeafe;
    display: flex;
    gap: 0.4rem;
}

.bs-chat-messages {
    margin-top: 0.55rem;
    border: 1px solid var(--bs-line);
    border-radius: 0.7rem;
    background: rgba(2, 6, 23, 0.78);
    min-height: 140px;
    max-height: 220px;
    overflow-y: auto;
    padding: 0.45rem;
    display: grid;
    gap: 0.4rem;
}

.bs-chat-item {
    border: 1px solid rgba(51, 65, 85, 0.45);
    border-radius: 0.55rem;
    padding: 0.35rem 0.45rem;
    background: rgba(15, 23, 42, 0.72);
}

.bs-chat-item.self {
    border-color: rgba(37, 99, 235, 0.55);
    background: rgba(30, 58, 138, 0.32);
}

.bs-chat-meta {
    font-size: 0.7rem;
    color: #93c5fd;
}

.bs-chat-text {
    margin-top: 0.15rem;
    font-size: 0.8rem;
    color: #e2e8f0;
    white-space: pre-wrap;
    word-break: break-word;
}

.bs-chat-input-row {
    margin-top: 0.55rem;
    display: flex;
    gap: 0.45rem;
}

.bs-modal {
    position: fixed;
    inset: 0;
    z-index: 10020;
    background: rgba(2, 6, 23, 0.78);
    display: grid;
    place-items: center;
    padding: 1rem;
}

.bs-modal.hidden {
    display: none;
}

.bs-modal-content {
    width: min(100%, 530px);
    border-radius: 0.95rem;
    border: 1px solid #1d4ed8;
    background: linear-gradient(160deg, rgba(30, 41, 59, 0.98), rgba(15, 23, 42, 0.98));
    padding: 1.1rem;
}

.bs-modal-content h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #dbeafe;
}

.bs-result-summary {
    margin-top: 0.7rem;
    border: 1px solid var(--bs-line);
    background: rgba(2, 6, 23, 0.62);
    border-radius: 0.75rem;
    padding: 0.8rem;
    color: #e5e7eb;
    line-height: 1.6;
    font-size: 0.9rem;
}

.bs-guide-modal-content {
    width: min(100%, 640px);
}

.bs-guide-option-list {
    margin-top: 0.9rem;
    display: grid;
    gap: 0.55rem;
}

.bs-guide-quick-grid {
    margin-top: 0.8rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
}

.bs-guide-quick-grid > div {
    border: 1px solid rgba(71, 85, 105, 0.52);
    background: rgba(2, 6, 23, 0.58);
    border-radius: 0.66rem;
    padding: 0.58rem 0.64rem;
}

.bs-guide-quick-grid h4 {
    font-size: 0.88rem;
    font-weight: 700;
    color: #bfdbfe;
}

.bs-guide-quick-grid p {
    margin-top: 0.22rem;
    font-size: 0.8rem;
    color: #d1d5db;
    line-height: 1.45;
}

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

    .bs-sidebar {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 1rem;
    }
}

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

    .bs-sidebar {
        grid-template-columns: 1fr;
    }

    .bs-turn-row {
        grid-template-columns: 1fr;
        gap: 0.7rem;
    }

    .bs-timer {
        width: fit-content;
    }
}

@media (max-width: 640px) {
    .bs-hero-title {
        font-size: 1.62rem;
    }

    .bs-hero-guide-btn {
        position: static;
        margin-bottom: 0.8rem;
    }

    .bs-col-labels {
        margin-left: 1.32rem;
    }

    .bs-cell {
        min-height: 24px;
    }

    .bs-help-grid {
        grid-template-columns: 1fr;
    }

    .bs-guide-quick-grid {
        grid-template-columns: 1fr;
    }
}
