body {
    font-family: sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: hsl(0, 0%, 94%);
    margin: 0;
    flex-direction: column;
}

#game-container {
    background-color: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 600px; /* Limit container width */
    width: 90%;
}

h1 {
    color: #333;
    margin-bottom: 15px;
}

p {
    color: #555;
    margin-bottom: 20px;
}

#ball-box-container {
    display: flex;
    justify-content: center; /* Center the box if container is wider */
    margin-bottom: 25px;
}

#ball-box {
    width: 400px;    /* Fixed width for the box */
    height: 300px;   /* Fixed height for the box */
    border: 2px solid #ccc;
    background-color: #e9e9e9;
    position: relative; /* Crucial for absolute positioning of balls */
    overflow: hidden;   /* Keep balls inside */
    border-radius: 5px;
    margin: 0 auto; /* Center the box */
    max-width: 100%; /* Ensure it doesn't overflow container on small screens */
}

.ball {
    position: absolute; /* Positioned relative to #ball-box */
    width: 40px;
    height: 40px;
    background-color: #3498db; /* Default ball color */
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2em;
    font-weight: bold;
    cursor: default;
    user-select: none; /* Prevent text selection */
    transition: background-color 0.3s ease; /* Smooth color transition for hints */
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.ball.hint {
    background-color: #e74c3c; /* Hint color */
}

#controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px; /* Spacing between input and buttons */
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    margin-bottom: 15px;
}

#guess-input {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    flex-grow: 1; /* Allow input to take available space */
    min-width: 150px; /* Minimum width */
}

button {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    background-color: #2ecc71;
    color: white;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

button:hover {
    background-color: #27ae60;
}

#submit-guess {
    background-color: #3498db;
}
#submit-guess:hover {
    background-color: #2980b9;
}

#message {
    margin-top: 15px;
    font-weight: bold;
    min-height: 1.2em; /* Reserve space to prevent layout shifts */
}

#hint-info {
    font-size: 0.9em;
    color: #777;
    margin-top: -10px; /* Adjust spacing */
}

/* Footer Styling */
footer {
    display: block;
    margin: 30px 0;
    text-align: center;
    color: #333;
    font-size: 1.3em;
    font-weight: bold;
    padding: 15px 30px;
    background-color: #3498db;
    max-width: 600px;
    width: 90%;   
    border-radius: 10px;
}

footer p {
    color: #000;
}

footer a {
    color: #ffffff;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.2s ease;
}

footer a:hover {
    color: #ffffff;
    text-decoration: underline;
}

/* Basic Responsive Adjustments */
@media (max-width: 650px) {
    #game-container {
        padding: 20px;
    }
    
    footer {
        padding: 20px;
    }
    #ball-box {
        width: 90%; /* Use percentage width */
        height: 250px; /* Adjust height */
    }
    .ball {
        width: 35px;
        height: 35px;
        font-size: 1.1em;
    }
    #controls {
       flex-direction: column; /* Stack controls vertically */
       width: 80%;
       margin: 0 auto 15px auto; /* Center column */
    }
    #guess-input {
        width: 100%; /* Full width in column layout */
        box-sizing: border-box; /* Include padding/border in width */
    }
    button {
        width: 100%; /* Full width */
    }
}

@media (max-width: 450px) {
     #ball-box {
        height: 200px;
     }
     .ball {
        width: 30px;
        height: 30px;
        font-size: 1em;
    }
}