/*CSS applies styling and beautification to elements in the game. It is highly vital to make the game look appealing to all users.*/
/*I have not applied scaling and dynamicity for some screens as I am not bothered to, but later I might.*/

@import url('https://fonts.googleapis.com/css2?family=Baskervville:ital@0;1&display=swap'); /*Custom font*/

body { /*Whole page*/
    margin: 0;
    font-family: "Baskervville", serif;
    background-color: #2c2c2c;
    color: white;
    overflow: scroll;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100vw;
    height: 100vh;
}

#game-title {
    text-align: center;
    font-size: 3rem;
    margin-top: 50px;
}

#motd {
    position: absolute;
    top: 100px;
    left: 45%;
    transform: translateX(-50%) rotate(-10deg);
    color: goldenrod;
    font-weight: bold;
    animation: floatMotd 5s ease-in-out infinite alternate;
    font-size: 1rem;
}

@keyframes floatMotd { /*Animation keyframes for MOTD*/
    0% {transform: translateX(-150px) translateY(0) rotate(-10deg);}
    25% {transform: translateX(-75px) translateY(10px) rotate(-5deg);}
    50% {transform: translateX(0) translateY(0) rotate(0deg);}
    75% {transform: translateX(75px) translateY(10px) rotate(5deg);}
    100% {transform: translateX(150px) translateY(0) rotate(-10deg);}
}

@keyframes floatMotdSMALL { /*No lateral movement for phones*/
    0% {transform: rotate(-10deg);}
    50% {transform: rotate(10deg);}
    100% {transform: rotate(-10deg);}
}

#main-menu {
    background-color: #3a3a3a;
    padding: 40px;
    border-radius: 10px;
    width: 30vw;
    margin: 0 auto;
    margin-top: 100px;
    text-align: center;
}

#main-menu button {
    display: block;
    width: 100%;
    margin: 10px 0;
    padding: 15px;
    background-color: goldenrod;
    border: none;
    border-radius: 5px;
    font-size: 1.25rem;
    cursor: pointer;
    color: #fff;
}

#main-menu button:hover { /*Glowing effect*/
    background-color: #daa520;
}

#import-modal {
    display: none;
    position: fixed;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #222222;
    padding: 20px;
    border-radius: 10px;
    z-index: 10;
    width: 15%;
}

#import-modal button {
    width: 100%;
    margin-top: 10px;
}

#import-modal input[type="file"] {
    display: block;
    margin-bottom: 10px;
    width: 100%;
}

#import-close {
    background-color: #FF5733;
    border: none;
    padding: 10px;
    border-radius: 5px;
    color: white;
    cursor: pointer;
}

#import-submit {
    background-color: goldenrod;
    border: none;
    padding: 10px;
    border-radius: 5px;
    color: white;
    cursor: pointer;
}

button {
    font-family: "Baskervville", serif;
}

#achievements-menu {
    position: fixed;
    top: 50%;
    left: 40px;
    transform: translate(-300px, -50%);
    background-color: #3a3a3a;
    padding: 20px;
    border-radius: 10px;
    width: 200px;
    transition: transform 0.4s ease;
    z-index: 1000;
    outline: solid #4e4e4e;
    outline-width: thick;
}

#achievements-menu.show {
    transform: translate(0, -50%);
}

.achievement {
    margin-bottom: 20px;
    text-align: center;
}

.achievement img {
    width: 80px;
    height: 80px;
    display: block;
    margin: 0 auto 10px;
}

.achievement-title {
    font-weight: bold;
    margin-bottom: 5px;
}

#quiz {
    display: none;
    text-align: center;
    margin-top: 50px;
    width: 75vw;
}

#progress-bar,
#timer-bar {
    background-color: #444;
    border-radius: 5px;
    height: 20px;
    width: 80%;
    margin: 10px auto;
    position: relative;
}

#progress-fill,
#timer-fill {
    background-color: goldenrod;
    height: 100%;
    width: 0%;
    border-radius: 5px;
}

.progress-text,
.timer-text {
    position: absolute;
    width: 100%;
    text-align: center;
    top: 0;
    line-height: 20px;
    font-size: 1rem;
    font-weight: bold;
    color: white;
}

#question {
    font-size: 1.5rem;
    margin: 30px auto;
    width: 60%;
    max-height: 150px; 
    overflow-y: auto;
}

.answer-btn {
    background-color: goldenrod;
    border: none;
    padding: 15px;
    margin: 10px;
    border-radius: 5px;
    color: white;
    cursor: pointer;
    width: 200px;
    max-width: 90%;
    display: inline-block;
    white-space: normal;
    word-break: break-word;
}

.answer-btn:hover {
    background-color: #daa520;
}

#end-screen {
    display: none;
    text-align: center;
    margin-top: 100px;
    font-size: 1.25rem;
}

#end-screen button {
    font-size: 1.25rem;
    margin-top: 30px;
    padding: 15px;
    background-color: goldenrod;
    border: none;
    border-radius: 5px;
    color: white;
    cursor: pointer;
}

#continue-btn {
    width: 80%;
    padding: 10px 0;
    background-color: #daa520;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    text-align: center;
}

#timer-fill {
    height: 100%;
    background-color: #FFA500;
    transition: width 0.1s ease-out;
}

#pause-overlay, #exit-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(30, 30, 30, 1);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 9999;
}

#pause-text, #exit-text {
    font-size: 5rem;
    text-align: center;
    margin-bottom: 20px;
}

#pause-continue-btn, #exit-yes-btn, #exit-no-btn {
    background: goldenrod;
    border: none;
    color: rgb(255, 255, 255);
    font-size: 1.25rem;
    padding: 12px 24px;
    margin: 10px;
    cursor: pointer;
    border-radius: 8px;
}

#pause-continue-btn:hover, #exit-yes-btn:hover, #exit-no-btn:hover, #main-menu button:hover, #import-submit:hover {
    background: #e7b100;
}

#exit-quiz-btn:hover, #import-close:hover {
    background: #ff7151;
}

#exit-quiz-btn {
    display: none;
    width: 80%;
    padding: 10px 0;
    background-color: #FF5733;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    text-align: center;
}

#loading-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #3a3a3a;
    color: rgb(255, 255, 255);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 5rem;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.5);
    transition: opacity 0.5s ease, transform 0.8s ease;
    z-index: 9999;
}

#loading-screen.show {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

@keyframes bounceOut { /*More animation keyframes*/
    0% {transform: scale(1);}
    50% {transform: scale(1.2);}
    100% {transform: scale(0); opacity: 0;}
}

@media screen and (max-width: 479px) { /*Scaling for phones*/
    #main-menu {
        width: 50vw;
    }
    
    #main-menu button {
        margin: 15px 0;
        padding: 15px;
        font-size: 1.25rem;
    }

    #game-title {
        font-size: 2.5rem;
    }

    #motd {
        transform: translateX(-75%);
        font-size: 1rem;
        animation: floatMotdSMALL 5s ease-in-out infinite alternate; /*Use turning animation instead*/
    }
    
    #import-modal {
        width: 50vw;
    }
    
    #import-modal button {
        font-size: 1rem;
    }
    
    #achievements-menu {
        height: 90vh;
        overflow: scroll;
        font-size: 1rem;
    }
    
    #achievements-menu.show {
        transform: translate(-10%, -50%); /*Open out less*/
    }
    
    #quiz {
        width: 90vw;
    }
    
    .answer-btn {
        font-size: 1rem;
    }
    
    #pause-text, #exit-text {
        font-size: 2.5rem;
    }
    
    #end-screen {
        font-size: 1rem;
    }
    
    #end-screen button {
        font-size: 1rem;

    }
}