#game-root .gm-shell {
    position: relative;
    max-width: 680px;
    margin: 0 auto;
    padding: 16px;
    border: 1px solid var(--cg-line);
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--cg-shadow);
}

#game-root .gm-bar,
#game-root .gm-stats,
#game-root .gm-modes,
#game-root .gm-actions,
#game-root .gm-end-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

#game-root .gm-bar {
    justify-content: space-between;
    margin-bottom: 10px;
}

#game-root .gm-stat {
    min-width: 72px;
    padding: 7px 10px;
    border: 1px solid var(--cg-line);
    border-radius: 8px;
    background: #f8faf8;
    text-align: center;
}

#game-root .gm-stat span {
    display: block;
    color: var(--cg-muted);
    font-size: 0.67rem;
    font-weight: 800;
    text-transform: uppercase;
}

#game-root .gm-stat strong {
    display: block;
    margin-top: 2px;
    font-size: 1rem;
}

#game-root .gm-modes {
    padding: 4px;
    border-radius: 9px;
    background: #edf1ef;
}

#game-root .gm-mode,
#game-root .gm-btn {
    min-height: 40px;
    padding: 8px 13px;
    border: 1px solid #bbc8c3;
    border-radius: 8px;
    background: #fff;
    color: var(--cg-ink);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
}

#game-root .gm-mode {
    border-color: transparent;
    background: transparent;
    color: var(--cg-muted);
}

#game-root .gm-mode-on,
#game-root .gm-btn-primary {
    border-color: var(--cg-green);
    background: var(--cg-green);
    color: #fff;
}

#game-root .gm-mode:hover,
#game-root .gm-mode:focus-visible,
#game-root .gm-btn:hover,
#game-root .gm-btn:focus-visible {
    border-color: var(--cg-teal);
    outline: none;
}

#game-root .gm-btn:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

#game-root .gm-status {
    min-height: 22px;
    margin-bottom: 9px;
    color: var(--cg-muted);
    text-align: center;
    font-size: 0.85rem;
    font-weight: 700;
}

#game-root .gm-board-wrap {
    position: relative;
    display: flex;
    justify-content: center;
}

#game-root .gm-board {
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    width: min(100%, 590px);
    aspect-ratio: 1;
    padding: 13px;
    border: 2px solid #926d37;
    border-radius: 10px;
    background: #e8c98d;
    box-shadow: inset 0 0 28px rgba(92, 60, 20, 0.13), 0 8px 18px rgba(33, 43, 40, 0.14);
    outline: none;
    touch-action: manipulation;
}

#game-root .gm-cell {
    position: relative;
    min-width: 0;
    min-height: 0;
    padding: 0;
    border: 0;
    background:
        linear-gradient(rgba(84, 58, 24, 0.5), rgba(84, 58, 24, 0.5)) no-repeat center / 100% 1px,
        linear-gradient(rgba(84, 58, 24, 0.5), rgba(84, 58, 24, 0.5)) no-repeat center / 1px 100%;
    cursor: pointer;
}

#game-root .gm-cell::before {
    content: "";
    position: absolute;
    inset: 17%;
    border-radius: 50%;
    opacity: 0;
    transform: scale(0.65);
    transition: opacity 0.12s ease, transform 0.12s ease;
}

#game-root .gm-cell:hover:not(:disabled)::before {
    opacity: 0.28;
    transform: scale(1);
    background: #26302d;
}

#game-root .gm-star::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 6px;
    height: 6px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: #68471f;
}

#game-root .gm-stone {
    position: absolute;
    z-index: 2;
    inset: 8%;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(18, 22, 21, 0.4);
    animation: gm-place 0.16s ease;
}

#game-root .gm-b {
    background: radial-gradient(circle at 34% 28%, #646e70, #111719 72%);
}

#game-root .gm-w {
    border: 1px solid #abb2ae;
    background: radial-gradient(circle at 34% 28%, #fff, #d8ddda 76%);
}

#game-root .gm-winstone {
    box-shadow: 0 0 0 3px #2f9b73, 0 2px 5px rgba(18, 22, 21, 0.45);
    animation: gm-win 0.55s ease infinite alternate;
}

#game-root .gm-last .gm-stone::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 24%;
    height: 24%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: var(--cg-amber);
}

#game-root .gm-cursor:not(:has(.gm-stone)) {
    outline: 2px dashed var(--cg-teal);
    outline-offset: -3px;
}

#game-root .gm-cell:focus-visible {
    z-index: 3;
    outline: 3px solid rgba(18, 122, 137, 0.5);
    outline-offset: -2px;
}

@keyframes gm-place {
    from { opacity: 0; transform: scale(0.55); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes gm-win {
    to { transform: scale(1.08); }
}

#game-root .gm-end {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: grid;
    place-items: center;
    padding: 16px;
    border-radius: inherit;
    background: rgba(20, 31, 29, 0.58);
}

#game-root .gm-end[hidden] {
    display: none;
}

#game-root .gm-end-panel {
    width: min(380px, 100%);
    padding: 20px;
    border-radius: 12px;
    background: #fff;
    text-align: center;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.24);
}

#game-root .gm-end-panel h2 {
    margin: 0 0 6px;
}

#game-root .gm-end-panel p {
    margin: 0 0 14px;
    color: var(--cg-muted);
}

#game-root .gm-actions,
#game-root .gm-end-actions {
    justify-content: center;
}

#game-root .gm-actions {
    margin-top: 10px;
}

#game-root .gm-hint {
    margin: 10px 0 0;
    color: var(--cg-muted);
    text-align: center;
    font-size: 0.8rem;
    line-height: 1.45;
}

@media (max-width: 600px) {
    #game-root .gm-shell {
        padding: 10px;
    }

    #game-root .gm-bar {
        align-items: stretch;
        flex-direction: column;
    }

    #game-root .gm-stats {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }

    #game-root .gm-stat {
        min-width: 0;
    }

    #game-root .gm-modes {
        justify-content: center;
    }

    #game-root .gm-board {
        padding: 7px;
    }

    #game-root .gm-actions {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }

    #game-root .gm-btn {
        padding: 7px 8px;
    }
}
