body {
    font-family: 'Arial', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    background-color: #f0f0f0;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

h1 {
    color: #333;
    margin-bottom: 10px;
}

.canvas-container {
    border: 2px solid #333;
    position: relative;
}

canvas {
    display: block;
    background-color: #D3D3D3;
}

.game-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 20px;
    border-radius: 10px;
    font-size: 2em;
    text-align: center;
    z-index: 10;
    white-space: nowrap;
}

.stats {
    display: flex;
    justify-content: space-around;
    width: 100%;
    max-width: 600px;
}

.ball-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    width: 45%;
}

.ball-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

.health-bar {
    width: 100%;
    height: 20px;
    background-color: #ddd;
    border-radius: 10px;
    overflow: hidden;
}

.health-fill {
    height: 100%;
    width: 100%;
    transition: width 0.3s;
}

.ball-stat-display {
    font-size: 0.9em;
    color: #555;
    min-height: 1.2em;
}

.buttons {
    display: flex;
    gap: 15px;
}

#resetButton, #selectOpponentsButton, #startGameButton {
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
}

#resetButton:hover, #selectOpponentsButton:hover {
    background-color: #45a049;
}

#startGameButton {
    background-color: #007bff;
    font-size: 1.2em;
    padding: 12px 25px;
    margin-top: 10px;
}

#startGameButton:hover {
    background-color: #0056b3;
}

.game-menu {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0.95);
    border: 2px solid #333;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 20; /* Above game message */
    display: flex; /* Will be toggled to flex when shown */
    flex-direction: column;
    gap: 20px;
    align-items: center;
    white-space: nowrap; /* Prevent text wrapping inside the menu */
}

.game-menu h2 {
    margin-top: 0;
    color: #333;
}

.selection-group-container {
    display: flex;
    flex-wrap: wrap; /* Allow groups to wrap for 2v2 */
    justify-content: center;
    gap: 20px; /* Space between groups */
}

.selection-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 1px solid #ccc;
    padding: 15px;
    border-radius: 8px;
    background-color: #eee;
    width: 250px; /* Fixed width for better layout */
    box-sizing: border-box; /* Include padding in width */
}

.selection-group h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #555;
}

.selection-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1em;
    cursor: pointer;
}

.selection-group input[type="radio"] {
    transform: scale(1.2);
}

.mode-selection {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    padding: 10px;
    border-radius: 8px;
    background-color: #f9f9f9;
}

.mode-selection label {
    font-size: 1.1em;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}