.gomoku-tool {
    max-width: 900px;
    margin: 0 auto;
}

.gomoku-settings .form-label {
    color: var(--bs-secondary-color, #6c757d);
}

.gomoku-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 12px;
    padding: 8px 12px;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 10px;
    background: var(--bs-tertiary-bg, #f8f9fa);
}

.gomoku-turn {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.gomoku-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.gomoku-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(5, 44, 101, 0.08);
    color: #052c65;
    font-size: 0.78rem;
    white-space: nowrap;
}

.gomoku-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    border-radius: 6px;
    font-weight: 800;
    font-size: 1rem;
    line-height: 1;
    background: #fff;
    border: 1px solid var(--bs-border-color, #dee2e6);
}

.gomoku-mark.mark-1 { color: #d62828; }
.gomoku-mark.mark-2 { color: #1d4ed8; }
.gomoku-mark.mark-0 { color: #6c757d; }

.gomoku-mark.is-stone {
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.35);
}
.gomoku-mark.is-stone.mark-1 { background: radial-gradient(circle at 35% 35%, #666, #111); }
.gomoku-mark.is-stone.mark-2 { background: radial-gradient(circle at 35% 35%, #fff, #cfcfcf); }
.gomoku-mark.is-stone.mark-0 { background: linear-gradient(90deg, #111 50%, #eee 50%); }

.gomoku-thinking {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--bs-secondary-color, #6c757d);
}
.gomoku-thinking.d-none { display: none !important; }

.gomoku-board-shell {
    position: relative;
}

.gomoku-scroll {
    width: 100%;
    max-height: min(82vh, 920px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    border-radius: 8px;
    border: 1px solid var(--bs-border-color, #dee2e6);
    background: var(--bs-tertiary-bg, #f8f9fa);
    text-align: center;
    line-height: 0;
}

.gomoku-scroll.is-scrollable {
    text-align: left;
}

.gomoku-canvas {
    display: inline-block;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.gomoku-canvas.is-locked {
    cursor: default;
}

.gomoku-zoom {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 6px;
}

.gomoku-zoom .btn {
    padding: 2px 7px;
    border: 1px solid var(--bs-border-color, #dee2e6);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.gomoku-zoom .btn .fsvg {
    margin: 0;
}

#gmHintBtn.is-busy {
    opacity: 0.65;
}

.gomoku-pulse {
    animation: gomokuPulse 1.4s ease-in-out infinite;
}

@keyframes gomokuPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.45); }
    50% { box-shadow: 0 0 0 8px rgba(13, 110, 253, 0); }
}

.gomoku-tally {
    text-align: center;
    padding: 12px;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 10px;
}

.gomoku-tally-title {
    font-weight: 600;
    margin-bottom: 8px;
}

.gomoku-tally-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-width: 420px;
    margin: 0 auto;
}

.gomoku-tally-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 4px;
    border-radius: 8px;
    background: var(--bs-tertiary-bg, #f8f9fa);
}

.gomoku-tally-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #052c65;
    line-height: 1.2;
}

.gomoku-tally-label {
    font-size: 0.8rem;
    color: var(--bs-secondary-color, #6c757d);
    word-break: break-word;
}

[data-bs-theme="dark"] .gomoku-status,
[data-bs-theme="dark"] .gomoku-scroll,
[data-bs-theme="dark"] .gomoku-tally-item {
    background: #1b1f27;
    border-color: #343a46;
}

[data-bs-theme="dark"] .gomoku-tally {
    border-color: #343a46;
}

[data-bs-theme="dark"] .gomoku-badge {
    background: rgba(110, 168, 254, 0.15);
    color: #9ec5fe;
}

[data-bs-theme="dark"] .gomoku-tally-value {
    color: #9ec5fe;
}

[data-bs-theme="dark"] .gomoku-mark {
    background: #11151c;
    border-color: #343a46;
}
[data-bs-theme="dark"] .gomoku-mark.mark-1 { color: #ff6b6b; }
[data-bs-theme="dark"] .gomoku-mark.mark-2 { color: #6ea8fe; }

[data-bs-theme="dark"] .gomoku-zoom .btn {
    background: #2b303b;
    border-color: #444b59;
}
[data-bs-theme="dark"] .gomoku-zoom .btn .fsvg {
    filter: invert(1);
}

@media (max-width: 575.98px) {
    .gomoku-status {
        padding: 6px 8px;
    }
    .gomoku-scroll {
        max-height: 72vh;
    }
}
