:root {
    color-scheme: light;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #202124;
    background: #f3f4f6;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
}

.app {
    width: min(92vw, 560px);
    margin: 0 auto;
    padding: 32px 0;
}

h1 {
    margin: 0;
    font-size: 2rem;
}

.subtitle {
    margin: 6px 0 20px;
    color: #5f6368;
}

.board {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
}

.game-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 18px;
    padding: 14px 16px;
    border: 1px solid #d9dce1;
    border-radius: 8px;
    background: white;
}

#status {
    margin: 0;
    font-weight: 600;
}

button {
    flex: 0 0 auto;
    padding: 9px 14px;
    border: 0;
    border-radius: 6px;
    color: white;
    background: #2f6f44;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

button:hover {
    background: #245936;
}

button:focus-visible {
    outline: 3px solid #9bc5a8;
    outline-offset: 2px;
}

.history {
    margin-top: 16px;
    padding: 14px 16px;
    border: 1px solid #d9dce1;
    border-radius: 8px;
    background: white;
}

.history h2 {
    margin: 0 0 8px;
    font-size: 1rem;
}

#move-history {
    margin: 0;
    color: #4b5563;
    line-height: 1.6;
}

.selected-square {
    box-shadow: inset 0 0 0 4px rgba(59, 130, 246, 0.85);
}

#board {
    touch-action: manipulation;
}

.legal-target::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 26%;
    height: 26%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.55);
    pointer-events: none;
}

@media (max-width: 480px) {
    .app {
        padding: 20px 0;
    }

    .game-info {
        align-items: flex-start;
        flex-direction: column;
    }
}
