:root {
    --bg: #1e2a78;
    --primary: #3a48d6;
    --accent: #6e7cff;
    --soft: #b4c4ff;
    --text: #ffffff;
}

body {
    margin: 0;
    background: var(--bg);
    font-family: "Poppins", sans-serif;
    color: var(--text);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

#game-container {
    width: 100%;
    max-width: 460px;
    padding: 20px;
    text-align: center;
    position: relative;
}

#menu-screen {
    padding-top: 120px;
}

#game-screen {
    padding-top: 120px; /* Space so hearts/score sit lower */
}

#level-flash {
    position: absolute;
    top: 40%;
    width: 100%;
    text-align: center;
    font-size: 2rem;
    color: #6e7cff;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s;
}

#leaderboard {
    margin-top: 15px;
    color: #b4c4ff;
}

#control-stack {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px; /* spacing between buttons */
    z-index: 50;
}

#control-stack .sound-btn {
    position: relative; /* override absolute from .sound-btn */
}

#pause-btn {
    display: none; /* hide at start */
}

.screen {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.screen.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.sound-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    padding: 10px 12px;
    border-radius: 50%;
    cursor: pointer;
    color: white;
    font-size: 1.2rem;
    backdrop-filter: blur(4px);
    box-shadow: 0 0 10px rgba(110,124,255,0.5);
    transition: 0.2s;
}

.sound-btn:hover {
    background: rgba(255,255,255,0.25);
    transform: scale(1.08);
}

.title {
    font-size: 2.8rem;
    letter-spacing: 2px;
    margin-bottom: 30px;
}

.btn {
    padding: 12px 28px;
    margin-top: 20px;
    font-size: 1.1rem;
    border: none;
    background: var(--primary);
    color: var(--text);
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 0 12px var(--accent);
    transition: 0.2s;
}

.btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 18px var(--accent);
}

.mode-btn {
    margin-bottom: 10px;
    width: 80%;
}

.mode-btn:hover {
    transform: scale(1.07);
    box-shadow: 0 0 20px rgba(110,124,255,0.6);
}

.small-btn {
    margin-top: 10px;
    font-size: 0.9rem;
    padding: 8px 20px;
}

.modal.hidden { display: none; }

.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    backdrop-filter: blur(6px);
    background: rgba(0,0,0,0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.modal-box {
    width: 80%;
    max-width: 400px;
    padding: 20px;
    background: rgba(255,255,255,0.08);
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(110,124,255,0.6);
    animation: pop 0.3s ease;
}

@keyframes pop {
    0% { transform: scale(0.7); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

#fact-box {
    background: rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    font-size: 1.1rem;
    min-height: 80px;
}

.option-btn {
    width: 100%;
    padding: 12px;
    margin: 6px 0;
    background: var(--accent);
    border: none;
    border-radius: 10px;
    color: var(--bg);
    font-weight: 600;
    cursor: pointer;
    transition: 0.15s;
}

.option-btn:hover {
    transform: scale(1.03);
    background: var(--soft);
}

.correct-glow {
    animation: correctFlash 0.3s ease;
}

.wrong-glow {
    animation: wrongFlash 0.3s ease;
}

@keyframes correctFlash {
    0% { background:#6aff9f;}
    100% { background:var(--accent);}
}

@keyframes wrongFlash {
    0% { background:#ff6a6a;}
    100% { background:var(--accent);}
}


#top-bar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

#lives {
    margin-top: 5px;
    min-width: 90px;
    text-align: right;
}

#timer-bar {
    width: 100%;
    background: rgba(255,255,255,0.15);
    height: 10px;
    border-radius: 50px;
    margin-top: 15px;
    overflow: hidden;
}

#timer-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #6be7ff, #4c74ff);
    transition: width cubic-bezier(0.45, 0, 0.55, 1);
}

.shake {
    animation: shake 0.3s;
}

@keyframes shake {
    0% { transform: translateX(0px); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
    100% { transform: translateX(0px); }
}

.fade-out {
    animation: fadeout 0.4s forwards;
}
.fade-in {
    animation: fadein 0.4s forwards;
}

@keyframes fadeout {
    to { opacity:0; transform:scale(0.98); }
}

@keyframes fadein {
    from { opacity:0; transform:scale(1.02); }
    to { opacity:1; transform:scale(1); }
}

.credits {
    margin-top: 25px;
    opacity: 0.6;
    font-size: 0.8rem;
}


@media (max-width: 480px) {
    #game-container {
        padding: 10px;
    }
    .option-btn {
        font-size: 0.9rem;
        padding: 10px;
    }
}