body {
    font-family: sans-serif;
    background-color: #f4f7f6;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 50px;
    overscroll-behavior-y: none;
    color-scheme: only light;
}

.back-button {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: #5D9CEC;
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: bold;
    transition: background-color 0.2s;
}
.back-button:hover { background-color: #4A89DC; }

.board-container {
    width: 90vw;
    max-width: 650px;
    margin-top: 0px;
    touch-action: none;
}

#myBoard { width: 100%; }

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 5px;
}

.left-buttons {
    display: flex;
    gap: 5px; 
}

.control-button {
    background-color: #5D9CEC;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}
.control-button:hover { background-color: #4A89DC; }
.control-button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.start-button {
    background-color: white;
    color: #5D9CEC;
    border: 2px solid #5D9CEC;
}
.start-button:hover:not(:disabled) {
    background-color: #e8f0fe;
}

.modal-overlay {
    display: none; 
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    max-width: 300px;
}

.modal-content h2 { margin-top: 0; color: #333; }

/* NEW: Layout for the Promotion Buttons */
.promo-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}
.promo-btn {
    padding: 10px;
    font-size: 1.1rem;
}

@media (max-width: 800px) {
    .back-button {
        position: static;
        margin-bottom: 20px;
    }
}

/* Update the existing modal overlay to be less intrusive */
.modal-overlay {
    background-color: rgba(0, 0, 0, 0.15) !important; /* Overrides the 0.6 opacity */
}

/* Optional: Shrink the modal content slightly so it blocks less board space */
.modal-content {
    padding: 20px 30px !important;
    opacity: 0.95;
}

/* NEW: Highlight classes applied by JavaScript */
.highlight-move {
    box-shadow: inset 0 0 4px 4px rgba(255, 255, 0, 0.8); /* Yellow for moves */
}

.highlight-check {
    box-shadow: inset 0 0 4px 4px rgba(255, 0, 0, 0.8); /* Red for checks */
}

/* Highlight for the piece currently clicked/selected by the user */
.highlight-selected {
    box-shadow: inset 0 0 4px 4px rgba(93, 156, 236, 0.8); /* Blue highlight */
}

/* A clean, semi-transparent dot in the center of the square for possible moves */
.square-55d63 {
    position: relative; 
}

/* A clean dot that sits ON TOP of pieces and survives dark mode */
.highlight-possible::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30%;
    height: 30%;
    background-color: rgba(0, 0, 0, 0.4); /* Solid semi-transparent color instead of a gradient */
    border-radius: 50%;
    pointer-events: none;
    z-index: 10; /* Forces it to appear on top of the piece image */
}