:root {
    --primary-color: #00ffff;
    --secondary-color: #ff00ff;
    --correct-color: #00ff00;
    --incorrect-color: #ff0000;
    --background-color: #0d0d2b;
    --text-color: #f0f0f0;
    --glow-blur: 15px;
    --animation-speed: 0.3s;
}

body {
    font-family: 'Orbitron', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    overflow: hidden;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.container {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 90%;
    max-width: 600px;
    animation: fadeIn var(--animation-speed) ease-in-out;
}
.container:not(.hidden) {
    display: flex;
}
.hidden {
    display: none !important;
}

/* --- Background --- */
.background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(ellipse at bottom, #1b2735 0%, #090a0f 100%);
}
.math-symbol-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}
.math-symbol-bg span {
    position: absolute;
    color: var(--primary-color);
    font-size: 1.5rem;
    animation: flying-symbols 15s linear infinite;
    opacity: 0;
    text-shadow: 0 0 5px var(--primary-color);
}
@keyframes flying-symbols {
    0% { transform: translateY(100vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(-100px) rotate(360deg); opacity: 0; }
}

/* --- Splash Screen --- */
#splash-screen .splash-content {
    animation: pulse 2s infinite ease-in-out;
}
#splash-screen .math-symbols {
    margin: 20px 0;
}
#splash-screen .math-symbol {
    font-size: 2rem;
    margin: 0 15px;
    display: inline-block;
    animation: bounce 1s infinite;
}
#splash-screen .math-symbol:nth-child(2) { animation-delay: 0.2s; }
#splash-screen .math-symbol:nth-child(3) { animation-delay: 0.4s; }
#splash-screen .math-symbol:nth-child(4) { animation-delay: 0.6s; }
#splash-play-btn {
    margin-top: 20px;
    animation: fadeIn 1s;
}


/* --- General UI --- */
.game-title, .screen-title {
    font-size: 3rem;
    color: var(--secondary-color);
    text-shadow: 0 0 var(--glow-blur) var(--secondary-color);
    margin-bottom: 40px;
}
.btn {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 15px 30px;
    margin: 10px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all var(--animation-speed) ease;
    text-shadow: 0 0 5px var(--primary-color);
    position: relative;
}
.btn:hover {
    background: var(--primary-color);
    color: var(--background-color);
    box-shadow: 0 0 var(--glow-blur) var(--primary-color);
}
.btn-secondary {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}
.btn-secondary:hover {
    background: var(--secondary-color);
    box-shadow: 0 0 var(--glow-blur) var(--secondary-color);
}
.music-btn.toggled {
    border-color: var(--correct-color);
    color: var(--correct-color);
}

/* --- Instruction Screen --- */
.instructions-content {
    background: rgba(0,0,0,0.2);
    padding: 15px 25px;
    border-radius: 10px;
    border-left: 3px solid var(--primary-color);
    text-align: left;
    max-width: 90%;
}
.instructions-content p {
    line-height: 1.6;
}

/* --- Hard Mode Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}
.modal-content {
    background: var(--background-color);
    border: 2px solid var(--secondary-color);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 0 25px var(--secondary-color);
    animation: fadeIn 0.3s;
    position: relative;
}
.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 2rem;
    cursor: pointer;
}

/* --- Game Screen --- */
.game-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    font-size: 1.5rem;
    margin-bottom: 20px;
}
#question-indicators {
    display: flex;
}
.indicator {
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    margin: 0 5px;
    transition: background-color 0.3s;
}
.indicator.correct {
    background-color: var(--correct-color);
    border-color: var(--correct-color);
}
.indicator.incorrect {
    background-color: var(--incorrect-color);
    border-color: var(--incorrect-color);
}
#timer-bar-container {
    width: 100%;
    height: 20px;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--primary-color);
    border-radius: 10px;
    overflow: hidden;
}
#timer-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--secondary-color), var(--primary-color));
    transition: width 0.1s linear;
}
#question {
    font-size: 3rem;
    letter-spacing: 5px;
    margin: 30px 0;
}
#answer-options {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}
.answer-btn {
    min-width: 100px;
}

/* --- Game Over & Score Screens --- */
.game-over-layout {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    gap: 40px;
}
.final-grade-container {
    flex-basis: 40%;
}
.final-stats {
    flex-basis: 60%;
    font-size: 1.2rem;
    text-align: left;
}
.final-stats hr {
    border-color: var(--primary-color);
    margin: 15px 0;
}
#final-grade-text {
    font-size: 6rem;
    color: var(--correct-color);
    text-shadow: 0 0 30px var(--correct-color);
    animation: grade-animation 1s ease-out forwards;
}
.marks-sheet-container {
    display: flex;
    justify-content: space-around;
    width: 100%;
    gap: 20px;
}
.marks-sheet {
    background: rgba(0,0,0,0.3);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid var(--primary-color);
    text-align: left;
    flex-grow: 1;
}
.marks-sheet h4 {
    color: var(--secondary-color);
    text-align: center;
    margin-top: 0;
}

/* --- Animations --- */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-30px); }
    60% { transform: translateY(-15px); }
}
@keyframes grade-animation {
    0% { transform: scale(0) rotate(-90deg); opacity: 0; }
    70% { transform: scale(1.2); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* --- Responsive Design --- */
@media (max-width: 600px) {
    .game-title, .screen-title {
        font-size: 2.5rem;
    }
    .btn {
        padding: 12px 24px;
        font-size: 1rem;
    }
    #question {
        font-size: 2.5rem;
    }
    .indicator {
        width: 15px;
        height: 15px;
    }
    .game-over-layout {
        flex-direction: column;
        gap: 20px;
    }
    .final-stats {
        text-align: center;
    }
    #final-grade-text {
        font-size: 5rem;
    }
    .marks-sheet-container {
        flex-direction: column;
    }
}