/* --- Variables for Vibrant Theme --- */
:root {
    --bg-color: #e3f2fd;        /* Light Blue Background */
    --card-bg: #ffffff;         /* White Card Background */
    --text-color: #37474f;      /* Dark Slate Text */
    --primary-color: #1e88e5;   /* Deep Blue for Primary Actions */
    --accent-x: #43a047;        /* Bright Green for X */
    --accent-o: #f44336;        /* Bright Red for O */
    --shadow-color: rgba(0, 0, 0, 0.15);
}

/* --- Global & Background --- */
body {
    font-family: 'Roboto', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    text-align: center;
}

.container {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 40px;
    /* Soft Material Design Shadow */
    box-shadow: 0 6px 20px var(--shadow-color), 0 0 4px rgba(0, 0, 0, 0.05);
}

h1 {
    color: var(--primary-color);
    margin-bottom: 30px;
    font-weight: 700;
    font-size: 2.5em;
    letter-spacing: 1px;
}

/* --- Buttons (Color-Block Style) --- */
#mode-selection button,
#difficulty-selection button,
#restart-btn,
#play-again-btn {
    padding: 12px 25px;
    margin: 8px;
    font-size: 1.1em;
    font-weight: 500;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 0 #1565c0; /* Deep blue flat shadow */
    transition: all 0.15s ease-out;
}

#mode-selection button:hover,
#difficulty-selection button:hover,
#restart-btn:hover,
#play-again-btn:hover {
    background-color: #1976d2; /* Slightly lighter blue */
    box-shadow: 0 2px 0 #1565c0; /* Lift shadow on hover/click */
    transform: translateY(2px);
}

/* Back button special style */
#difficulty-selection button:last-child {
    background-color: #607d8b; /* Gray/Slate color */
    box-shadow: 0 4px 0 #455a64;
}

#difficulty-selection button:last-child:hover {
    background-color: #546e7a;
    box-shadow: 0 2px 0 #455a64;
}

/* --- Game Board & Cells --- */
#board {
    display: grid;
    grid-template-columns: repeat(3, 90px);
    grid-template-rows: repeat(3, 90px);
    gap: 8px; 
    margin: 30px auto;
    width: 286px; 
    background-color: var(--bg-color);
    border-radius: 4px;
    padding: 4px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
}

.cell {
    background-color: var(--card-bg);
    border: none;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 64px;
    font-weight: 900;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s, box-shadow 0.2s;
}

.cell:not(.X):not(.O):hover {
    background-color: #f5f5f5;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.cell.X {
    color: var(--accent-x);
}

.cell.O {
    color: var(--accent-o);
}

.cell.win {
    background-color: #ffeb3b;
    color: var(--text-color);
    box-shadow: 0 0 15px #ffeb3b;
    font-weight: 900;
}

/* --- Message Styling --- */
#message {
    font-size: 1.3em;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 20px;
    min-height: 1.5em;
}

/* --- Utility Class --- */
.hidden {
    display: none;
}