/* Basic Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: #e0d4b8; /* Soft wood color */
    color: #333;
}

#gameContainer {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: url('wood_background.jpg') no-repeat center center; /* Wood texture background */
    background-size: cover;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.4);
}

#startGameContainer {
    text-align: center;
}

#startButton {
    padding: 20px 40px;
    font-size: 28px;
    background-color: #8b5a2f; /* Deep wood color */
    color: #fff;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 6px 12px rgba(0,0,0,0.5);
}

#startButton:hover, #startButton:active {
    background-color: #a76f3d; /* Lighter wood button color on hover */
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0,0,0,0.6);
}

#board {
    display: grid;
    grid-template-columns: repeat(3, 120px);
    grid-template-rows: repeat(3, 120px);
    gap: 12px;
    margin-top: 20px;
}

.cell {
    width: 120px;
    height: 120px;
    background: url('wood_texture.jpg'); /* Wood texture for cells */
    background-size: cover;
    border: 6px solid #6a4f3c; /* Rich wood border color */
    border-radius: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 50px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.3s, box-shadow 0.3s, border-color 0.3s;
    box-shadow: inset 0 0 12px rgba(0,0,0,0.4);
}

/* Touch effect for both click and touch events */
.cell:hover, .cell:active {
    background-color: #f3e2d2; /* Light wood highlight on hover */
    transform: scale(1.05);
    border-color: #8b5a2f; /* Darker border on hover */
    box-shadow: 0 8px 16px rgba(0,0,0,0.4); /* Deep shadow effect */
}

.cell:active {
    transform: scale(0.95); /* Slightly scale down on active (touch) */
    box-shadow: inset 0 0 12px rgba(0,0,0,0.6); /* Stronger inset shadow on tap */
}

.cell.X {
    color: #4a2e1b; /* Dark wood color for X */
}

.cell.O {
    color: #7a4f3c; /* Medium wood color for O */
}

.hidden {
    display: none;
}

#winnerMessage {
    font-size: 40px;
    font-weight: bold;
    margin: 20px 0;
    text-align: center;
    color: #4a2e1b; /* Dark wood text color */
    text-shadow: 2px 2px 6px rgba(0,0,0,0.3);
}

#restartButton {
    padding: 20px 40px;
    font-size: 28px;
    background-color: #8b5a2f; /* Deep wood color */
    color: #fff;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 6px 12px rgba(0,0,0,0.5);
}

#restartButton:hover, #restartButton:active {
    background-color: #a76f3d; /* Lighter wood button color on hover */
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0,0,0,0.6);
}

#musicControls {
    position: fixed;
    top: 20px;
    right: 20px;
}

#muteButton {
    padding: 15px 25px;
    font-size: 18px;
    background-color: #8b5a2f; /* Deep wood color */
    color: #fff;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 6px 12px rgba(0,0,0,0.5);
}

#muteButton:hover, #muteButton:active {
    background-color: #a76f3d; /* Lighter wood button color on hover */
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0,0,0,0.6);
}

@keyframes winAnimation {
    0% { background-color: #fff; }
    50% { background-color: #f2d0b0; } /* Soft highlight color */
    100% { background-color: #fff; }
}

@keyframes cellHighlight {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.cell.winAnimation {
    animation: winAnimation 1s ease-in-out, cellHighlight 1s ease-in-out;
}
