@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');

*{
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body{
    height: 100vh;
    color: white;
    background: #0F2027;  /* fallback for old browsers */
    background: -webkit-linear-gradient(to right, #2C5364, #203A43, #0F2027);  /* Chrome 10-25, Safari 5.1-6 */
    background: linear-gradient(to right, #2C5364, #203A43, #0F2027); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
    display: flex;
    justify-content: center;
    align-items: center;
}
.level-page .box{
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}
.box{
    background-color: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    height: fit-content;
    width: 350px;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

h2{
    text-align: center;
    padding-top: 20px;
    font-size: 2.2rem;
    padding-bottom: 10px;
    color: #FFC300;
}
.subtitle {
    text-align: center;
    color: #DAF7A6;
    margin-bottom: 20px;
}
a{
    text-decoration: none;
    color: white;
}
.btn-group{
    display: flex;
    flex-direction: column;
    width: 80%;
    margin: auto;
}

.menu-btn{
    color: white;
    padding: 12px 0;
    margin: 5px 0;
    border-radius: 12px;
    border: none;
    background-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 8px 0 rgba(0,0,0,0.4);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1rem;
    padding: 12px 20px;
    transition: all 0.3s ease;
}
.menu-btn:hover{
    background-color: #FFC300;
    color: #222;
    transform: translateY(-2px);
}
.menu-btn .icon{
    font-size: 1.2rem;
}

/* part level page start */
.btn-level{
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px;
    overflow-y: auto;
    flex-grow: 1;
}
h4{
    font-size: 1.6rem;
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
}
h4 a {
    margin-right: 15px;
    font-size: 1.8rem;
    transition: transform 0.3s ease;
}
h4 a:hover {
    transform: scale(1.2);
}

.level-btn{
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 8px 0 rgba(0,0,0,0.4);
    border-radius: 12px;
    color: #DAF7A6;
    font-size: 1.2rem;
    aspect-ratio: 1/1;
    transition: all 0.3s ease;
}
.level-btn:not(.locked):hover{
    background-color: #FFC300;
    color: #222;
    transform: translateY(-3px);
}
.level-btn.locked {
    background-color: rgba(0, 0, 0, 0.3);
    color: rgba(255, 255, 255, 0.3);
    cursor: not-allowed;
}
.level-btn.locked .lock-icon {
    font-size: 1.5rem;
}
/* part level page end*/


/* q1 start */
.question{
    height: 35vh;
    font-size: 2.8rem;
    font-weight: 700;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #FFC300;
    padding: 10px;
}
a.delete{
    font-size: 1.1rem;
    color: #FF5733;
    transition: color 0.3s ease;
}
a.delete:hover {
    color: #C70039;
}
.answer form button{
    background-color: #FFC300;
    color: #222;
    border: none;
    padding: 8px 15px;
    box-shadow: 0 2px 8px 0 rgba(0,0,0,0.4);
    font-size: 1.2rem;
    border-radius: 12px;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
}
.answer form button:hover{
    background-color: #DAF7A6;
    color: #222;
    transform: translateY(-2px);
}
.btns{
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.answer form {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 10px;
}
.answer form input{
    width: 50%;
    height: 50px;
    padding: 15px;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    outline: none;
    font-size: 1.2rem;
    background-color: rgba(0, 0, 0, 0.2);
    box-shadow: inset 0 0 5px 0 rgba(0,0,0,0.5);
    color: white;
    text-align: center;
    transition: all 0.3s ease;
}
.answer form input:focus {
    border-color: #FFC300;
}
.answer .btns button{
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 8px 0 rgba(0,0,0,0.4);
    border-radius: 12px;
    color: white;
    font-size: 1.2rem;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
}
.answer .btns button:hover{
    background-color: #DAF7A6;
    color: #222;
    transform: translateY(-2px);
}
/* q1 end */

/* Wrong answer styling */
.textarea.wrong {
    border-color: #FF5733 !important;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-8px); }
    20%, 40%, 60%, 80% { transform: translateX(8px); }
}

/* Score display */
.score {
    text-align: center;
    font-size: 1.2rem;
    margin: 10px 0;
    color: #DAF7A6;
    font-weight: 600;
}

/* Question counter */
.question-counter {
    text-align: center;
    font-size: 0.9rem;
    color: rgba(245, 245, 245, 0.7);
    margin-bottom: 10px;
}

/* Add completion message styling */
.completion-message {
    text-align: center;
    color: #DAF7A6;
    font-size: 1.3rem;
    margin: 20px 0;
    animation: fadeIn 1s;
}
.completion-message h3 {
    color: #FFC300;
    font-size: 2rem;
    margin-bottom: 10px;
}
.completion-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}
.btn-next {
    background-color: #FFC300;
    color: #222;
    padding: 10px 20px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}
.btn-next:hover {
    background-color: #DAF7A6;
    transform: translateY(-2px);
}


@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* =================================== */
/* ======== RESPONSIVE DESIGN ======== */
/* =================================== */

/* For Tablets */
@media screen and (max-width: 768px) {
    .box {
        width: 80vw;
        max-width: 450px;
    }
    h2 {
        font-size: 2rem;
    }
    h4 {
        font-size: 1.3rem;
        padding: 12px 15px;
    }
    h4 a {
        font-size: 1.5rem;
    }
    .question {
        font-size: 2.5rem;
    }
    .btn-level {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 8px;
    }
}


/* For Small Mobile Phones */
@media screen and (max-width: 480px) {
    body {
        align-items: flex-start;
        padding-top: 2vh;
    }
    .box {
        width: 95vw;
        height: 96vh;
        padding: 15px;
        display: flex;
        flex-direction: column;
    }
    .game-title {
        padding-bottom: 15px;
    }
    h2 {
        font-size: 1.8rem;
        padding-top: 10px;
        padding-bottom: 5px;
    }
    h4 {
        font-size: 1rem;
        padding: 10px;
        justify-content: center;
    }
    h4 a {
        font-size: 1.2rem;
        margin-right: 8px;
    }
    .subtitle {
        font-size: 0.9rem;
    }
    .menu-btn {
        padding: 10px 15px;
        font-size: 1rem;
    }
    .question {
        font-size: 2rem;
        height: auto;
        flex-grow: 1;
        min-height: 100px;
    }
    .answer {
        flex-shrink: 0;
    }
    .answer form input {
        height: 45px;
        font-size: 1.1rem;
    }
    .btns {
        gap: 5px;
        grid-template-columns: repeat(4, 1fr);
    }
    .answer .btns button {
        padding: 12px 5px;
        font-size: 1.1rem;
    }
    .level-btn {
        padding: 10px;
        font-size: 1.1rem;
    }
    .completion-message {
        font-size: 1.1rem;
    }
    .completion-message h3 {
        font-size: 1.8rem;
    }
}


.footer {
    text-align: center;
    padding: 20px 0 10px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
}

.menu-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px 0 rgba(0,0,0,0.4);
}

.level-progress {
    margin: 20px 0;
    padding: 0 10px;
}

.progress-text {
    color: #DAF7A6;
    margin-bottom: 8px;
    font-size: 1rem;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 15px;
    background-color: rgba(0, 0, 0, 0.4);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#progress-fill {
    height: 100%;
    width: 0%; /* Set by JS */
    background: #FFC300;
    border-radius: 10px;
    transition: width 0.5s ease-in-out;
}

.level-info {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 20px;
}

.locked-message {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #FF5733;
    color: white;
    padding: 15px 25px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    animation: fadeInUp 0.5s forwards;
    z-index: 100;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

.btn-level {
    grid-template-columns: repeat(auto-fill, minmax(65px, 1fr));
}
