.sq-gb, .sq-gb *, .sq-gb *::before, .sq-gb *::after { box-sizing: border-box; }

.sq-gb {
    display: grid;
    gap: 11px;
    width: min(100%, 570px);
    margin-inline: auto;
    min-width: 0;
    color: #e7ecff;
}

.sq-gb-top,
.sq-gb-strip,
.sq-gb-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 9px 12px;
    flex-wrap: wrap;
}

.sq-gb-title { margin: 0 0 4px; font-size: 19px; }
.sq-gb-rules, .sq-gb-hint {
    margin: 0;
    color: #9eaeca;
    font-size: 12px;
    line-height: 1.55;
}

.sq-gb-strip {
    justify-content: flex-start;
    padding: 8px 10px;
    border: 1px solid rgba(126, 168, 226, .21);
    border-radius: 10px;
    background: rgba(125, 161, 220, .08);
    color: #d5e1f8;
    font-size: 13px;
}
.sq-gb-strip > span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.sq-gb-pass { margin-inline-start: auto; }

.sq-gb-action {
    padding: 6px 10px;
    border: 1px solid rgba(132, 176, 229, .38);
    border-radius: 7px;
    background: #142740;
    color: #eafaFF;
    font: inherit;
    font-size: 12px;
    font-weight: 650;
    cursor: pointer;
}
.sq-gb-action:focus-visible { outline: 2px solid #86e5ff; outline-offset: 2px; }
.sq-gb-action:hover:not(:disabled) { background: #213d64; }
.sq-gb-action:disabled { opacity: .55; cursor: default; }

.sq-gb-token {
    display: inline-block;
    flex: none;
    width: 13px;
    height: 13px;
    border-radius: 50%;
}
.sq-gb-token--black, .sq-gb-cell[data-stone="1"]::after {
    border: 1px solid #18202b;
    background: radial-gradient(circle at 33% 25%, #666f7b, #272e39 39%, #080b12 74%);
}
.sq-gb-token--white, .sq-gb-cell[data-stone="2"]::after {
    border: 1px solid #c1c8d3;
    background: radial-gradient(circle at 35% 25%, #fff, #e8f0f7 50%, #a5b2c4 97%);
}

.sq-gb-info { min-height: 20px; font-size: 13px; }
.sq-gb-status { color: #a9eaff; font-weight: 650; }
.sq-gb-score { color: #c1cce0; }
.sq-gb-hint { text-align: center; }

.sq-gb-board-frame {
    width: min(100%, 470px);
    min-width: 0;
    margin-inline: auto;
    padding: clamp(5px, 1.35vw, 11px);
    border: 1px solid #f2c782;
    border-radius: 13px;
    background: repeating-linear-gradient(111deg, rgba(118, 64, 25, .06) 0 1px, transparent 1px 9px),
        linear-gradient(155deg, #e7b77c, #cc8f52 72%, #b67742);
    box-shadow: 0 13px 29px rgba(5, 9, 22, .35), inset 0 0 0 3px rgba(110, 54, 25, .13);
}

.sq-gb-grid {
    --sq-gb-line: rgba(85, 44, 20, .77);
    position: relative;
    display: grid;
    grid-template-columns: repeat(var(--sq-gb-size), minmax(0, 1fr));
    width: 100%;
    aspect-ratio: 1;
    user-select: none;
}

.sq-gb-grid::before {
    content: '';
    position: absolute;
    inset: calc(50% / var(--sq-gb-size));
    border-right: 1px solid var(--sq-gb-line);
    border-bottom: 1px solid var(--sq-gb-line);
    background:
        linear-gradient(to right, var(--sq-gb-line) 1px, transparent 1px) 0 0 / calc(100% / (var(--sq-gb-size) - 1)) 100%,
        linear-gradient(to bottom, var(--sq-gb-line) 1px, transparent 1px) 0 0 / 100% calc(100% / (var(--sq-gb-size) - 1));
    pointer-events: none;
}

.sq-gb-cell {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    min-width: 0;
    width: 100%;
    aspect-ratio: 1;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
}
.sq-gb-cell[aria-disabled="true"] { cursor: default; }
.sq-gb-busy .sq-gb-cell { cursor: wait; }
.sq-gb-cell::before,
.sq-gb-cell::after {
    content: '';
    position: absolute;
    display: none;
    border-radius: 50%;
    pointer-events: none;
}

.sq-gb-star[data-stone="0"]::before {
    display: block;
    width: 14%;
    aspect-ratio: 1;
    background: #663d25;
}

.sq-gb-cell[data-stone="1"]::after,
.sq-gb-cell[data-stone="2"]::after,
.sq-gb-cell[data-stone="0"][aria-disabled="false"]:hover::after {
    display: block;
    width: 77%;
    aspect-ratio: 1;
    box-shadow: 0 2px 3px rgba(65, 32, 13, .45);
}

.sq-gb-cell[data-stone="0"][aria-disabled="false"]:hover::after {
    border: 1px solid rgba(40, 32, 34, .63);
    background: rgba(41, 39, 42, .33);
}

.sq-gb-cell.sq-gb-last::before {
    display: block;
    z-index: 2;
    width: 19%;
    aspect-ratio: 1;
    background: #32c3ec;
    box-shadow: 0 0 0 1px #1f5a71;
}

.sq-gb-cell:focus-visible {
    outline: 2px solid #163851;
    outline-offset: -1px;
    z-index: 3;
}

@media (max-width: 540px) {
    .sq-gb { gap: 8px; }
    .sq-gb-strip { font-size: 12px; }
    .sq-gb-info { font-size: 12px; }
    .sq-gb-board-frame { padding: 6px; }
}

@media (hover: none) {
    .sq-gb-cell[data-stone="0"][aria-disabled="false"]:hover::after { display: none; }
}
