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

:root {
    --primary-bg: #121212;
    --secondary-bg: #1e1e1e;
    --text-color: #e0e0e0;
    --primary-color: #356ab0;
    --success-color: #27ae60;
    --success-color-dark: #219652;
    --disabled-color: #555555;
    --disabled-color-dark: #444444;
    --container-bg: #ffffff10;
    --border-color: #444444;
    --button-shadow-color: rgba(0, 0, 0, 0.3);
    --modal-bg: #2d2d2d;
    --input-bg: #3d3d3d;
    --input-border: #555555;
    --blinking-color: transparent;
    --buzzer-size: min(80vw, 80vh);
}

body {
    font-family: 'Arial', sans-serif;
    background-color: var(--primary-bg);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.container {
    width: 100%;
    max-width: 800px;
    padding: 20px;
    text-align: center;
    background-color: var(--container-bg);
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    margin: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

h1 {
    margin-bottom: 20px;
    color: var(--text-color);
}

#player-name-container {
    margin-bottom: 20px;
    font-size: 1.2rem;
}

#status-container {
    margin-bottom: 30px;
    font-weight: bold;
    min-height: 24px;
}

#buzzer-container {
    margin-bottom: 30px;
    width: 100%;
    display: flex;
    justify-content: center;
    perspective: 1000px;
}

.buzzer-button {
    width: var(--buzzer-size);
    height: var(--buzzer-size);
    max-width: 90%;
    max-height: 90%;
    border-radius: 50%;
    color: white;
    font-size: 6rem;
    font-weight: bold;
    border: none;
    cursor: pointer;
    box-shadow: 
        0 10px 20px var(--button-shadow-color),
        0 6px 6px var(--button-shadow-color),
        inset 0 5px 10px rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    outline: none;
    margin: 0 auto;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transform-style: preserve-3d;
    position: relative;
}

.buzzer-button:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.2), transparent 70%);
    pointer-events: none;
}

.buzzer-button:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 
        0 15px 30px var(--button-shadow-color),
        0 10px 10px var(--button-shadow-color),
        inset 0 5px 10px rgba(255, 255, 255, 0.2);
}

.buzzer-button:active {
    transform: translateY(5px) scale(0.98) rotateX(20deg);
    box-shadow: 
        0 5px 10px var(--button-shadow-color),
        0 3px 3px var(--button-shadow-color),
        inset 0 2px 5px rgba(255, 255, 255, 0.1);
}

.buzzer-button:disabled {
    cursor: not-allowed;
    opacity: 0.1;
    filter: grayscale(80%);
}

.buzzer-button.winner {
    animation: blink 1s infinite, pulse 2s infinite;
}

.buzzer-button.disabled {
    background: linear-gradient(145deg, var(--disabled-color), var(--disabled-color-dark));
    box-shadow: 
        0 5px 10px rgba(0, 0, 0, 0.2),
        inset 0 -2px 5px var(--disabled-color-dark);
    cursor: not-allowed;
    transform: translateY(0) scale(1);
}

.buzzer-button.wait {
    background: linear-gradient(145deg, #e67e22, #d35400);
    box-shadow: 
        0 5px 10px rgba(0, 0, 0, 0.2),
        inset 0 -2px 5px #d35400;
    cursor: wait;
    transform: translateY(0) scale(1);
    animation: pulse-wait 1s infinite;
}

@keyframes pulse-wait {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.98);
    }
    100% {
        transform: scale(1);
    }
}

#winner-container {
    margin-top: 20px;
    padding: 10px;
    background-color: var(--secondary-bg);
    border-radius: 5px;
    border: 1px solid var(--border-color);
}

#winner-name {
    font-weight: bold;
    transition: color 0.3s ease;
}

.hidden {
    visibility: hidden;
}

/* Modal Styles */
.modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: var(--modal-bg);
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    width: 90%;
    max-width: 500px;
    padding: 30px;
    animation: modalFadeIn 0.3s ease-in-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#user-profile-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#user-profile-form h2 {
    margin-bottom: 20px;
    text-align: center;
    color: var(--text-color);
}

#user-profile-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

#user-profile-form input[type="text"] {
    width: 100%;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid var(--input-border);
    background-color: var(--input-bg);
    color: var(--text-color);
    font-size: 16px;
}

#user-profile-form input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.3);
}

.color-palette {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-top: 5px;
}

.color-option {
    width: 100%;
    aspect-ratio: 1/1;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 3px solid transparent;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.color-option:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.color-option.selected {
    border: 3px solid white;
    transform: scale(1.1);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5), 0 6px 12px rgba(0, 0, 0, 0.15);
}

.modal-button {
    color: white;
    background-color: var(--primary-color);
    border: none;
    border-radius: 6px;
    padding: 14px 20px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modal-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.modal-button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
}

/* Logout Button */
.logout-button {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 15px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.logout-button:hover {
    background-color: rgba(231, 76, 60, 0.2);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Blinking background effect */
@keyframes blinkBackground {
    0% { background-color: var(--primary-bg); }
    45% { background-color: var(--blinking-color); }
    55% { background-color: var(--blinking-color); }
    100% { background-color: var(--primary-bg); }
}

.blinking-background {
    animation: blinkBackground 0.5s ease-in-out infinite;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
}

/* Media queries for responsive design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
        max-width: 95%;
    }
    
    .buzzer-button {
        font-size: 2.5rem;
    }

    .color-palette {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
        max-width: 98%;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .buzzer-button {
        font-size: 4rem;
    }

    .color-palette {
        grid-template-columns: repeat(5, 1fr);
    }

    .modal-content {
        padding: 20px;
    }

    .logout-button {
        top: 10px;
        right: 10px;
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* Additional responsive adjustments */
@media (max-width: 320px) {
    .buzzer-button {
        font-size: 3.6rem;
    }
    
    h1 {
        font-size: 1.3rem;
    }
    
    #player-name-container {
        font-size: 1rem;
    }

    .color-palette {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }
}

/* Support for system dark mode preference */
@media (prefers-color-scheme: light) {
    :root {
        --primary-bg: #f5f5f5;
        --secondary-bg: #f8f9fa;
        --text-color: #333;
        --container-bg: #ffffff;
        --border-color: #dee2e6;
        --button-shadow-color: rgba(0, 0, 0, 0.2);
        --modal-bg: #ffffff;
        --input-bg: #f8f9fa;
        --input-border: #ced4da;
    }
    
    h1 {
        color: #2c3e50;
    }
}

/* Add specific styles for the animal selection options */

.animal-options-container {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: 10px;
    margin: 15px 0;
    width: 100%;
}

.animal-option {
    position: relative;
    background: linear-gradient(145deg, #2a2a2a, #333);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    aspect-ratio: 1/1;
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border: 2px solid transparent;
}

.animal-option:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
}

.animal-option.selected {
    border-color: var(--primary-color);
    background: linear-gradient(145deg, #333, #3a3a3a);
    box-shadow: 0 0 15px rgba(55, 125, 255, 0.4);
}

.animal-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 70% 20%, rgba(255, 255, 255, 0.1), transparent 60%);
    pointer-events: none;
}

.animal-option-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.animal-emoji {
    font-size: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.animal-option:hover .animal-emoji {
    transform: scale(1.2);
    animation: bounce 0.6s ease;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0) scale(1.2); }
    50% { transform: translateY(-10px) scale(1.2); }
}

.animal-option.selected .animal-emoji {
    transform: scale(1.1);
    animation: pulse 2s infinite;
}

@media (max-width: 768px) {
    .animal-options-container {
        gap: 8px;
    }
    
    .animal-emoji {
        font-size: 50px;
    }
}

@media (max-width: 480px) {
    .animal-options-container {
        gap: 5px;
    }
    
    .animal-option {
        padding: 8px;
    }
    
    .animal-emoji {
        font-size: 36px;
    }
}

@media (max-width: 360px) {
    .animal-emoji {
        font-size: 28px;
    }
}

@media (prefers-color-scheme: light) {
    .animal-option {
        background: linear-gradient(145deg, #f0f0f0, #e8e8e8);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    }
    
    .animal-option.selected {
        background: linear-gradient(145deg, #e8e8e8, #f5f5f5);
        box-shadow: 0 0 15px rgba(55, 125, 255, 0.2);
    }
    
    .animal-option::before {
        background: radial-gradient(circle at 70% 20%, rgba(255, 255, 255, 0.5), transparent 70%);
    }
}