/* --- Root Variables for Easy Customization --- */
:root {
    --font-family: 'Poppins', sans-serif;
    --bg-color: #1a2a2a;
    --board-bg: #0a3d3d;
    --cell-bg: #0c5252;
    --border-color: #083131;
    --text-color: #e0e0e0;
    --accent-color: #f0c47d; /* Gold-like accent */

    --black-piece-dark: #111;
    --black-piece-light: #444;
    --white-piece-dark: #b3b3b3;
    --white-piece-light: #ffffff;
}

/* --- Keyframe Animations --- */
@keyframes place-piece {
    from {
        transform: scale(0.5);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes pulse-hint {
    0%, 100% {
        transform: scale(0.45);
        opacity: 0.5;
    }
    50% {
        transform: scale(0.55);
        opacity: 0.7;
    }
}

/* --- General Body and Typography --- */
body {
    font-family: var(--font-family);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    padding: 1rem;
}

h1 {
    color: var(--accent-color);
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}

/* --- Controls Styling --- */
.controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
}

.control-group label {
    font-weight: 400;
    margin-right: 0.5rem;
}

select, button {
    font-family: var(--font-family);
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    background-color: rgba(0,0,0,0.2);
    color: var(--text-color);
    transition: all 0.2s ease-in-out;
}

button:hover, select:hover {
    border-color: var(--accent-color);
    background-color: rgba(0,0,0,0.3);
}

#new-game-button {
    background-color: var(--accent-color);
    color: var(--bg-color);
    font-weight: 600;
}

#new-game-button:hover {
    background-color: #ffda99;
}

/* --- Game Board & Cells --- */
.game-container {
    width: 90vmin;
    max-width: 550px;
    height: 90vmin;
    max-height: 550px;
}

#game-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    width: 100%;
    height: 100%;
    background-color: var(--board-bg);
    border: 3px solid var(--border-color);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 15px 30px rgba(0,0,0,0.4);
    gap: 4px;
}

.cell {
    background-color: var(--cell-bg);
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* --- Piece Styling and Flip Animation --- */
.piece-container {
    width: 85%;
    height: 85%;
    position: absolute;
    transform-style: preserve-3d;
    transition: transform 0.7s cubic-bezier(0.45, 0.05, 0.55, 0.95);
}

.piece-container.newly-placed {
    animation: place-piece 0.3s ease-out;
}

.piece-container.flipped {
    transform: rotateY(180deg);
}

.piece {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: absolute;
    backface-visibility: hidden;
    box-shadow: inset 0 3px 5px rgba(0,0,0,0.4), 0 4px 6px rgba(0,0,0,0.3);
}

.piece.black {
    background: radial-gradient(circle at 35% 35%, var(--black-piece-light), var(--black-piece-dark));
    transform: rotateY(0deg);
}

.piece.white {
    background: radial-gradient(circle at 35% 35%, var(--white-piece-light), var(--white-piece-dark));
    transform: rotateY(180deg);
}

/* --- Hint Styling with Pulse Animation --- */
.hint {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.hint::after {
    content: '';
    display: block;
    width: 50%;
    height: 50%;
    background-color: var(--accent-color);
    border-radius: 50%;
    animation: pulse-hint 2s infinite ease-in-out;
    transition: all 0.2s;
}

.hint:hover::after {
    transform: scale(0.65) !important;
    opacity: 1 !important;
}

/* --- Game Info Styling --- */
.game-info {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 400;
}

#turn-info {
    color: var(--accent-color);
    min-height: 1.5rem;
}