body {
    background-color: #1a1a1a;
    color: white;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: 'Segoe UI', sans-serif;
    height: 100vh;
    overflow: hidden;
}

#system-msg {
    position: fixed;
    top: 20px;
    background: rgba(255, 204, 0, 0.9);
    color: black;
    padding: 10px 30px;
    border-radius: 30px;
    font-weight: bold;
    display: none;
    z-index: 200;
}

#overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
}

#menu {
    text-align: center;
    background: #2a2a2a;
    padding: 40px;
    border-radius: 20px;
    min-width: 350px;
}

#color-options { 
    display: flex; 
    justify-content: center; 
    gap: 15px; 
    margin: 20px 0; 
    flex-wrap: wrap;
}

/* Updated for perfect circles */
.color-btn {
    width: 50px; 
    height: 50px;
    border: 4px solid transparent; 
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0; /* Prevents squishing into oblongs */
    padding: 0;
    transition: transform 0.2s, border-color 0.2s;
}

.color-btn.selected { 
    border-color: white; 
    transform: scale(1.1); 
}

.color-btn:disabled { 
    opacity: 0.1; 
    filter: grayscale(1); 
    cursor: not-allowed; 
}

button {
    margin-top: 20px; 
    padding: 12px 30px;
    font-size: 1.1rem; 
    font-weight: bold;
    cursor: pointer; 
    background: #ffcc00; 
    border: none; 
    border-radius: 8px;
    width: 100%;
}

button:disabled, button.not-leader {
    background: #3a3a3a !important;
    color: #777 !important;
    cursor: not-allowed;
    filter: grayscale(1);
}

#quit-btn { 
    background: #ff4444 !important; 
    color: white; 
}

#ui-header { 
    width: 600px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 15px 0; 
}

#score-display { 
    font-size: 1.5rem; 
    color: #4CAF50; 
    font-weight: bold; 
}

#timer-display { 
    font-size: 2.5rem; 
    font-family: monospace; 
    color: #ffcc00; 
}

#game-container {
    width: 600px; 
    height: 600px;
    background: #000; 
    border: 5px solid #333;
    position: relative; 
    overflow: hidden;
}

.snake-head { 
    width: 22px; 
    height: 22px; 
    position: absolute; 
    border-radius: 50%; 
    z-index: 10; 
}

.body-segment { 
    width: 18px; 
    height: 18px; 
    position: absolute; 
    border-radius: 50%; 
    z-index: 5; 
}

.food { 
    width: 14px; 
    height: 14px; 
    background: #ff4444; 
    border-radius: 50%; 
    position: absolute; 
    box-shadow: 0 0 12px #ff4444; 
}

.rank-item {
    display: flex; 
    align-items: center; 
    justify-content: space-between;
    background: #333; 
    margin: 8px 0; 
    padding: 10px 15px; 
    border-radius: 8px;
}

.rank-color { 
    width: 20px; 
    height: 20px; 
    border-radius: 50%; 
}

#start-btn:not(:disabled):not(.not-leader) {
    animation: pulse-gold 2s infinite;
}

@keyframes pulse-gold {
    0% { box-shadow: 0 0 0 0 rgba(255, 204, 0, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 204, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 204, 0, 0); }
}
