html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background-color: #1e1e1e;
    color: #eeeeee;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.page {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 2rem;
}

h1 {
    margin: 0 0 0.5rem 0;
    font-size: 1.8rem;
}

.user-color {
    font-size: 1rem;
    color: #999;
    margin-bottom: 0.5rem;
}

.status {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    min-height: 1.5rem;
    font-weight: 500;
}

.board {
    display: grid;
    grid-template-columns: repeat(8, 4rem);
    grid-template-rows: repeat(8, 4rem);
    border: 4px solid #4a4a4a;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.square {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    line-height: 1;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.square.light {
    background-color: #eeeed2;
    color: #1a1a1a;
}

.square.dark {
    background-color: #769656;
    color: #1a1a1a;
}

.square.selected {
    box-shadow: inset 0 0 0 4px #f6f669;
}

.square.highlight::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.25);
}

/* If a highlighted square has a piece on it, show a ring instead of a dot */
.square.highlight:not(:empty)::after {
    width: 100%;
    height: 100%;
    border-radius: 0;
    background-color: transparent;
    box-shadow: inset 0 0 0 4px rgba(0, 0, 0, 0.25);
}

button {
    margin-top: 1.5rem;
    padding: 0.5rem 1.5rem;
    font-size: 1rem;
    border: none;
    border-radius: 4px;
    background-color: #4a4a4a;
    color: #eeeeee;
    cursor: pointer;
}

button:hover {
    background-color: #5a5a5a;
}
/* Add this wrapper class around your board in the HTML above */
.board-container {
    position: relative;
}

/* Promotion Modal Overlay */
.promotion-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.promotion-content {
    background-color: #2a2a2a;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.promotion-content h3 {
    margin: 0 0 1rem 0;
    font-size: 1.2rem;
}

.promotion-pieces {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.promo-square {
    width: 4rem;
    height: 4rem;
    background-color: #eeeed2; /* Using your light square color */
    color: #1a1a1a;
    font-size: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
    transition: transform 0.1s;
}

.promo-square:hover {
    transform: scale(1.1);
    background-color: #fff;
}

.cancel-btn {
    margin-top: 0;
    background-color: #d32f2f;
}

.cancel-btn:hover {
    background-color: #f44336;
}

.piece-image {
    width: 90%;
    height: 90%;
    /* Prevents the browser's native drag-and-drop from grabbing the image */
    user-select: none;
    -webkit-user-drag: none;
    /* Allows the parent .square to consistently catch the click event */
    pointer-events: none;
}
