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

body {
    font-family: 'Segoe UI', sans-serif;
    background: linear-gradient(to right, #f0f8ff, #d0e8f2);
    color: #333;
    padding: 10px;
    text-align: center;
}

header {
    margin-bottom: 10px;
}

.controls {
    margin: 10px auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.control-row {
    display: flex;
    justify-content: space-between;
    width: 100%;
    gap: 10px;
}

/* अधिकतम स्कोर कंटेनर */
#high-score-container {
    width: fit-content; /* सामग्री के अनुसार चौड़ाई */
    margin: 10px auto; /* सेंटर में करें */
    padding: 10px 20px;
    border-radius: 15px;
    box-shadow: 0 6px 12px rgba(0,0,0,0.25);
    background: linear-gradient(45deg, #0D47A1, #1976D2, #2196F3); /* गहरा नीला ग्रेडिएंट */
    color: #FFFFFF; /* सफेद टेक्स्ट */
    font-size: 1.3em; /* थोड़ा बड़ा फॉन्ट */
    font-weight: bold;
    background-size: 300% 300%;
    animation: gradientMove 8s infinite linear; /* एनीमेशन बरकरार */
}

/* नई स्टेटस बार - स्कोर-लक्ष्य और टाइमर को होरिजेंटली रखेगा */
.status-main-bar {
    display: flex; /* फ्लैक्सबॉक्स चालू */
    justify-content: space-between; /* आइटमों को दोनों सिरों पर फैलाएं */
    align-items: center; /* वर्टिकली सेंटर में संरेखित करें */
    margin: 10px auto; /* मार्जिन कम किया ताकि जगह बचे */
    gap: 10px; /* स्टेटस बॉक्स के बीच गैप */
    flex-wrap: wrap; /* छोटे स्क्रीन पर रैप करें */
    max-width: 600px; /* कुल चौड़ाई को नियंत्रित करें */
}

.status-box {
    width: calc(50% - 10px); /* लगभग आधी चौड़ाई, गैप के लिए 10px घटाया */
    padding: 8px 12px; /* पैडिंग कम किया */
    border-radius: 10px; /* बॉर्डर रेडियस भी कम किया */
    box-shadow: 0 3px 6px rgba(0,0,0,0.1); /* शैडो कम किया */
    display: flex;
    flex-direction: column; /* यह अंदर के कंटेंट को वर्टिकल रखेगा */
    justify-content: center;
    align-items: center;
    font-size: 1em; /* फॉन्ट साइज थोड़ा कम किया */
    font-weight: bold;
    color: white;
    background-size: 300% 300%;
    animation: gradientMove 8s infinite linear; /* बैकग्राउंड एनीमेशन */
}

/* स्कोर और लक्ष्य के लिए बॉक्स */
#score-target-container {
    background: linear-gradient(45deg, #E65100, #F57C00, #FB8C00); /* गहरा नारंगी ग्रेडिएंट */
}

/* टाइमर कंटेनर */
#timer-container {
    background: linear-gradient(45deg, #004D40, #00695C, #00897B); /* गहरा हरा/टील ग्रेडिएंट */
}

/* लक्ष्य संख्या टेक्स्ट (स्थिर) */
.target-display {
    color: white; /* टेक्स्ट का रंग सफेद रखें */
    display: flex; /* लक्ष्य और अंक को एक लाइन में रखने के लिए */
    align-items: center;
    gap: 5px; /* लक्ष्य टेक्स्ट और अंक के बीच थोड़ा गैप */
}

/* लक्ष्य अंक के लिए चमकदार लाल और ब्लिंकिंग स्टाइल */
#target-number {
    color: #FF1744; /* चमकीला लाल रंग */
    font-size: 1.1em; /* फॉन्ट साइज थोड़ा कम किया */
    text-shadow: 0 0 8px rgba(255, 23, 68, 0.9), 0 0 15px rgba(255, 23, 68, 0.7); /* अधिक चमकदार प्रभाव */
    animation: blinkTarget 1s step-end infinite; /* ब्लिंकिंग एनीमेशन */
}

@keyframes blinkTarget {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0.3; } /* ब्लिंक के लिए थोड़ी कम ओपेसिटी */
}


/* बटनों का साइज और फॉन्ट छोटा करें */
.game-btn, #level-select, .time-select-btn {
    padding: 6px 12px; /* पैडिंग कम करें */
    font-size: 14px;   /* फॉन्ट साइज कम करें */
    border: none;
    border-radius: 6px; /* बॉर्डर रेडियस भी कम करें */
    cursor: pointer;
    transition: background 0.3s;
    flex-grow: 1;
    text-align: center;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2); /* शैडो कम करें */
    font-weight: bold; /* फॉन्ट को बोल्ड करें */
}

.game-btn:hover, #level-select:hover, .time-select-btn:hover {
    transform: scale(1.01); /* थोड़ा ज़ूम कम करें */
    filter: brightness(1.2); /* हॉवर पर और चमकीला करें */
}

/* बटनों के लिए गहरे बैकग्राउंड और चमकीले टेक्स्ट रंग */
#resetButton { background-image: linear-gradient(45deg, #8B0000, #B22222); color: #FFD700; /* गोल्ड */ }
#howToPlayButton { background-image: linear-gradient(45deg, #483D8B, #6A5ACD); color: #00FFFF; /* एक्वा */ }
#level-select { background-image: linear-gradient(45deg, #1A237E, #283593); color: #FF69B4; /* हॉट पिंक */ }
#backgroundMusicToggleButton { background-image: linear-gradient(45deg, #36454F, #5A5A5A); color: #00FF00; /* लाइम ग्रीन */ }
#pauseButton { background-image: linear-gradient(45deg, #607D8B, #78909C); color: #FFFF00; /* पीला */ }
#startButton { background-image: linear-gradient(45deg, #2E8B57, #3CB371); color: #FF8C00; /* डार्क ऑरेंज */ }
.time-select-btn { background-image: linear-gradient(45deg, #4B0082, #6A0DAD); color: #FFFFFF; /* सफेद */ }


#game-area {
    position: relative;
    width: 100%;
    max-width: 600px;
    height: 400px; /* यह ऊंचाई अब अधिक दिखेगी */
    margin: 0 auto;
    border: 3px solid #2196f3;
    background-color: #fff;
    overflow: hidden;
    border-radius: 15px;
}

.emoji-number-ball {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #ffeb3b;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    animation: float 5s linear infinite;
    transition: transform 0.3s;
}

.emoji-number-ball span.emoji {
    font-size: 24px;
}

.emoji-number-ball.selected {
    border: 3px solid #4caf50;
    transform: scale(1.1);
}

.emoji-number-ball.correct {
    animation: fadeOutPop 0.6s forwards;
}

.emoji-number-ball.incorrect {
    animation: shake 0.5s;
}

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

@keyframes fadeOutPop {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.5); }
}

/* Popup specific styles */
.popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border: 3px solid #333;
    border-radius: 12px;
    padding: 20px;
    z-index: 1000;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    position: relative; 
}

.popup.hidden {
    display: none;
}

/* "कैसे खेलें" पॉपअप के क्लोज बटन के लिए नया स्टाइल */
#howToPlayPopup .close-button {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 2.2em;
    color: #FF0000;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
    transition: transform 0.2s ease;
}

#howToPlayPopup .close-button:hover {
    transform: scale(1.2);
}

/* हाई स्कोर ब्लिंकिंग एनीमेशन */
@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

.high-score-blink {
    animation: blink 1s step-end infinite;
}

/* ग्रेडिएंट एनीमेशन कीफ्रेम */
@keyframes gradientMove {
    0% {background-position: 0% 50%;}
    50% {background-position: 100% 50%;}
    100% {background-position: 0% 50%;}
}

/* बधाई पॉपअप */
#popup.complete {
    background-color: #e0ffe0;
    border-color: #4caf50;
}

/* Responsive Design */
@media (max-width: 600px) {
    .controls {
        flex-direction: column;
        max-width: 100%;
    }

    .control-row {
        flex-direction: row;
        justify-content: space-between;
    }

    /* **यहाँ बदलाव किया गया है:** `flex-direction: column;` को हटाया गया है ताकि बॉक्स छोटे स्क्रीन पर भी हॉरिजॉन्टल रहें। */
    .status-main-bar {
        /* flex-direction: column; */ /* यह लाइन अब टिप्पणी की गई है या हटाई गई है */
        gap: 10px;
        align-items: stretch; /* आइटम्स को पूरी चौड़ाई लेने दें */
    }

    .status-box {
        width: calc(50% - 5px); /* छोटे स्क्रीन पर भी हॉरिजॉन्टल रहने के लिए चौड़ाई एडजस्ट की */
        min-width: unset;
    }

    .game-btn, #level-select, .time-select-btn {
        width: 48%;
        padding: 5px 8px;
        font-size: 13px;
    }

    #game-area {
        height: 300px;
    }
}