/* Base styles */
:root {
    --primary-color: #4CAF50;
    --secondary-color: #2196F3;
    --background-color: #f0f8ff;
    --text-color: #333;
    --error-color: #f44336;
    --success-color: #4CAF50;
    --border-radius: 8px;
    --transition-speed: 0.3s;
}

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

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

.game-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

/* Screen styles */
.screen {
    text-align: center;
    padding: 20px;
}

.hidden {
    display: none;
}

/* Typography */
h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    color: var(--primary-color);
}

h2 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: var(--secondary-color);
}

.subtitle {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 30px;
}

/* Player Setup */
.player-setup {
    margin: 30px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

input[type="text"] {
    width: 250px;
    height: 45px;
    font-size: 1.2rem;
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    text-align: center;
    padding: 0;
}

/* Buttons */
.primary-button,
.secondary-button {
    padding: 12px 24px;
    font-size: 1.1rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-speed);
    margin: 5px;
}

.primary-button {
    background-color: var(--primary-color);
    color: white;
}

.secondary-button {
    background-color: var(--secondary-color);
    color: white;
}

.primary-button:hover,
.secondary-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.icon-button {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-color);
    cursor: pointer;
    padding: 8px;
    margin: 0 5px;
}

/* Game Header */
.game-header {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 100;
}

.score-container {
    background: white;
    padding: 15px 25px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    min-width: 120px;
}

.score-box {
    text-align: center;
}

.label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
}

#score {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary-color);
}

/* Answer Section */
.answer-section {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 30px;
}

input[type="number"] {
    width: 70px;
    height: 45px;
    font-size: 1.5rem;
    text-align: center;
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    padding: 0;
    background: white;
    transition: all var(--transition-speed);
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.primary-button {
    height: 45px;
    padding: 0 20px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Numbers Container */
#balloons-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 60px;
    margin: 60px 0;
    min-height: 300px;
    padding: 30px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--border-radius);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

.number {
    width: 100px;
    height: 100px;
    position: relative;
    cursor: pointer;
    transition: transform var(--transition-speed);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.8), transparent);
    border-radius: 50%;
    animation: float 8s ease-in-out infinite;
    transform-origin: center bottom;
}

.number:hover {
    transform: scale(1.1);
}

/* Animations */
@keyframes float {
    0% {
        transform: translateY(0) rotate(0deg) translateX(0);
    }
    25% {
        transform: translateY(-40px) rotate(8deg) translateX(15px);
    }
    50% {
        transform: translateY(0) rotate(0deg) translateX(0);
    }
    75% {
        transform: translateY(-30px) rotate(-8deg) translateX(-15px);
    }
    100% {
        transform: translateY(0) rotate(0deg) translateX(0);
    }
}

@keyframes sway {
    0% {
        transform: translateX(-50%) rotate(-12deg);
    }
    50% {
        transform: translateX(-50%) rotate(12deg);
    }
    100% {
        transform: translateX(-50%) rotate(-12deg);
    }
}

@keyframes pop {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(0);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

/* Audio Controls */
.audio-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
}

/* Responsive Design */
@media (max-width: 768px) {
    .number {
        width: 80px;
        height: 80px;
        font-size: 2.5rem;
    }

    input[type="text"] {
        width: 200px;
    }

    .game-header {
        top: 10px;
        right: 10px;
    }

    .score-container {
        padding: 10px 15px;
        min-width: 100px;
    }

    #score {
        font-size: 1.5rem;
    }

    .success-message {
        top: 15%;
        font-size: 2rem;
        padding: 15px 30px;
    }
}

@media (max-width: 480px) {
    .number {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }

    input[type="text"] {
        width: 180px;
    }

    .game-header {
        top: 5px;
        right: 5px;
    }

    .score-container {
        padding: 8px 12px;
        min-width: 80px;
    }

    #score {
        font-size: 1.2rem;
    }

    .success-message {
        top: 10%;
        font-size: 1.8rem;
        padding: 12px 25px;
    }
}

/* Game Over Screen */
.final-score {
    font-size: 2rem;
    margin: 20px 0;
    color: var(--primary-color);
}

.player-name {
    font-size: 1.2rem;
    margin-bottom: 30px;
    color: #666;
}

/* Success Message */
.success-message {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(76, 175, 80, 0.9);
    color: white;
    padding: 20px 40px;
    border-radius: var(--border-radius);
    font-size: 2.5rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    animation: fadeInOut 1.5s ease-in-out forwards;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Number Animations */
.number {
    width: 100px;
    height: 100px;
    position: relative;
    cursor: pointer;
    transition: transform var(--transition-speed);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.8), transparent);
    border-radius: 50%;
    animation: float 8s ease-in-out infinite;
    transform-origin: center bottom;
}

.number.pop {
    animation: popNumber 0.5s ease-out forwards;
}

.number.sparkle {
    animation: sparkle 0.5s ease-out forwards;
}

@keyframes popNumber {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.2) rotate(180deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(0) rotate(360deg);
        opacity: 0;
    }
}

@keyframes sparkle {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
    }
    50% {
        box-shadow: 0 0 20px 10px rgba(255, 255, 255, 0.7);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
    }
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
    80% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
}

/* Score Animation */
@keyframes scorePop {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
        color: #FFD700;
    }
    100% {
        transform: scale(1);
    }
}

#score.pop {
    animation: scorePop 0.5s ease-out;
}
