body {
    font-family: sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    background: #1a1a1a;
    color: white;
    text-align: center;
}

h1 {
    font-size: 3rem;
    margin-bottom: 0.2rem;
}

p {
    color: #aaa;
    margin-bottom: 1.5rem;
}

button {
    font-size: 1rem;
    padding: 0.75rem 1.5rem;
    margin: 0.3rem;
    border: none;
    border-radius: 8px;
    background: #064420;
    color: white;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

button:hover {
    background: #0a5c2b;
}

#status {
    font-size: 1.5rem;
    margin: 1.5rem;
    white-space: pre-wrap;
    text-align: center;
}

#container {
    display: grid;
    grid-template-columns: repeat(8, 80px);
    grid-template-rows: repeat(8, 80px);
    gap: 2px;
    background: #064420;
    padding: 5px;
}

.cell {
    width: 80px;
    height: 80px;
    background: #0a5c2b;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cell.black::after,
.cell.white::after {
    content: "";
    width: 65px;
    height: 65px;
    border-radius: 50%;
}

.cell.black::after {
    background: black;
}

.cell.white::after {
    background: white;
}

.cell.legal-move {
    cursor: pointer;
    box-shadow: inset 0 0 0 3px yellow;
}

.cell.legal-move:hover {
    background: #0d7038;
}

.cell.last-move::after {
    box-shadow: inset 0 0 0 3px red;
}

.cell.flipping::after {
    animation: flip-piece 0.25s ease both;
    animation-delay: var(--flip-delay);
}

.cell::after {
    transform-style: preserve-3d;
    backface-visibility: visible;
}

@keyframes flip-piece {
    0% {
        transform: rotateY(0deg);
    }
    50% {
        transform: rotateY(90deg);
    }
    100% {
        transform: rotateY(180deg);
    }
}



#join-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #444;
}

#join-code {
    font-size: 1rem;
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    border: 1px solid #444;
    background: #2a2a2a;
    color: white;
    margin-right: 0.3rem;
}

#join-code::placeholder {
    color: #888;
}

#code-error {
    color: #e05555;
    margin-bottom: 0.5rem;
}

.home-link {
    position: fixed;
    top: 1rem;
    left: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    font-size: 2rem;
    text-decoration: none;
    background: #3a3a3a;
    border-radius: 8px;
    transition: background-color 0.15s ease;
}

.home-link:hover {
    background: #4a4a4a;
}


#rules-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

#rules-panel {
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 12px;
    padding: 1.5rem 2rem;
    width: 320px;
    text-align: center;
    position: relative;
}

#rules-close {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
}

#rules-caption {
    margin: 0.5rem 0 1rem;
    color: #ddd;
}

#rules-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

#rules-indicator {
    color: #888;
    font-size: 0.9rem;
}

#rules-mini-container {
    display: grid;
    grid-template-columns: repeat(8, 28px);
    grid-template-rows: repeat(8, 28px);
    gap: 1px;
    background: #064420;
    padding: 3px;
    margin: 1rem auto;
    width: max-content;
}

#rules-mini-container .cell {
    width: 28px;
    height: 28px;
    background: #0a5c2b;
    display: flex;
    align-items: center;
    justify-content: center;
}

#rules-mini-container .cell.black::after,
#rules-mini-container .cell.white::after {
    content: "";
    width: 22px;
    height: 22px;
    border-radius: 50%;
}

#rules-mini-container .cell.black::after { background: black; }
#rules-mini-container .cell.white::after { background: white; }
#rules-mini-container .cell.legal-move { box-shadow: inset 0 0 0 2px yellow; }
#rules-mini-container .cell.last-move::after { box-shadow: inset 0 0 0 2px red; }