@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap');

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #121213, #110a18);
    color: #300be9;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

/* Quiz Container */
#quiz-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.7);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.6), rgba(118, 75, 162, 0.6));
    backdrop-filter: blur(10px);
}

/* Background effects */
#quiz-container::before {
    content: "";
    position: absolute;
    inset: 0;
    filter: brightness(0.5) contrast(1.2);
    transform: scale(1.05);
    transition: transform 0.8s ease;
    z-index: 0;
    border-radius: 16px;
}

#quiz-container:hover::before {
    transform: scale(1.1);
    filter: brightness(0.55) contrast(1.3);
}

#quiz-container::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(30, 30, 47, 0.85), rgba(30, 30, 47, 0.9));
    border-radius: 16px;
    z-index: 1;
}

#quiz-container>* {
    position: relative;
    z-index: 2;
    padding: 2rem;
    text-align: center;
    color: #fff;
}

h1 {
    margin-bottom: 1rem;
    font-weight: 700;
    font-size: 2rem;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

/* Category selection */
#category-selection {
    margin-bottom: 2rem;
}

.category-label {
    display: block;
    margin-bottom: 0.6rem;
    font-weight: 600;
    font-size: 1.1rem;
    color: #d1d1f9;
    text-align: left;
    max-width: 340px;
    margin: 0 auto 0.6rem auto;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

#category-select {
    padding: 12px 16px;
    width: 100%;
    max-width: 340px;
    font-size: 1rem;
    border-radius: 10px;
    border: 2px solid #a78bfa;
    background: rgba(51, 51, 77, 0.7);
    color: #fff;
    outline: none;
    cursor: pointer;
    text-align-last: center;
    margin-bottom: 1rem;
    transition: 0.3s ease;
}

#category-select:hover,
#category-select:focus {
    border-color: #e0d7ff;
    background: rgba(70, 60, 110, 0.85);
}

/* Start button */
#start-btn {
    background: #6c63ff;
    color: white;
    border: none;
    padding: 14px 32px;
    font-size: 1rem;
    border-radius: 40px;
    cursor: pointer;
    transition: 0.3s ease;
    max-width: 340px;
    width: 100%;
    margin: 0 auto;
    display: block;
    box-shadow: 0 8px 20px rgba(108, 99, 255, 0.6);
}

#start-btn:hover {
    background: #5548d6;
}

#start-btn:disabled {
    background: #9999cc;
    cursor: not-allowed;
    box-shadow: none;
}

/* Question */
#question-number {
    font-weight: 700;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

#question {
    font-size: 1.3rem;
    margin-bottom: 1.2rem;
    min-height: 70px;
    font-weight: 600;
}

/* Answers */
.answers {
    list-style: none;
    padding: 0;
    margin: 1rem 0 2rem 0;
    user-select: none;
}

.answers li {
    background: rgba(51, 51, 77, 0.75);
    margin-bottom: 0.8rem;
    padding: 14px 18px;
    border-radius: 12px;
    cursor: pointer;
    transition: 0.3s ease;
    border: 2px solid transparent;
    color: #fff;
    font-weight: 600;
}

.answers li:hover {
    background: rgba(84, 84, 126, 0.9);
    box-shadow: 0 8px 15px rgba(120, 104, 255, 0.7);
}

.answers li.selected {
    background: #6c63ff;
    border-color: #a78bfa;
    box-shadow: 0 0 12px 3px #a78bfa;
}

/* Next button */
#next-btn {
    background: #6c63ff;
    color: white;
    border: none;
    padding: 14px 28px;
    font-size: 1rem;
    border-radius: 40px;
    cursor: pointer;
    transition: 0.3s ease;
    box-shadow: 0 10px 28px rgba(108, 99, 255, 0.65);
}

#next-btn:hover {
    background: #5548d6;
}

#next-btn:disabled {
    background: #9999cc;
    cursor: not-allowed;
    box-shadow: none;
}

/* Score */
#score-container {
    font-size: 1.4rem;
    margin-top: 2rem;
    font-weight: 700;
}

#reload-btn {
    background: transparent;
    border: 2px solid #6c63ff;
    color: #6c63ff;
    padding: 10px 22px;
    font-weight: 700;
    border-radius: 40px;
    cursor: pointer;
    margin-top: 1.2rem;
    transition: 0.3s ease;
}

#reload-btn:hover {
    background: #a78bfa;
    color: #fff;
    border-color: #a78bfa;
}

/* Loader */
.loader {
    border: 6px solid #f3f3f3;
    border-top: 6px solid #6c63ff;
    border-radius: 50%;
    width: 52px;
    height: 52px;
    animation: spin 1s linear infinite;
    margin: 50px auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ✅ Responsive Media Queries */
@media (max-width: 768px) {
    #quiz-container {
        max-width: 90%;
    }

    h1 {
        font-size: 1.6rem;
    }

    #question {
        font-size: 1.1rem;
    }

    .answers li {
        font-size: 0.95rem;
        padding: 12px 16px;
    }

    #next-btn,
    #start-btn {
        font-size: 0.95rem;
        padding: 12px 24px;
    }
}

@media (max-width: 480px) {
    #quiz-container {
        padding: 1rem;
    }

    h1 {
        font-size: 1.4rem;
    }

    #question {
        font-size: 1rem;
    }

    .answers li {
        font-size: 0.9rem;
        padding: 10px 14px;
    }

    #next-btn,
    #start-btn {
        font-size: 0.9rem;
        padding: 10px 20px;
    }
}

@media (max-width: 360px) {
    h1 {
        font-size: 1.2rem;
    }

    #question {
        font-size: 0.95rem;
    }

    .answers li {
        font-size: 0.85rem;
        padding: 8px 12px;
    }

    #next-btn,
    #start-btn {
        font-size: 0.85rem;
        padding: 8px 16px;
    }
}

@media (max-width: 320px) {
    h1 {
        font-size: 1.1rem;
    }

    #question {
        font-size: 0.9rem;
    }

    .answers li {
        font-size: 0.8rem;
        padding: 6px 10px;
    }

    #next-btn,
    #start-btn {
        font-size: 0.8rem;
        padding: 6px 14px;
    }
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #1a1a2e, #16213e);
    }

    #quiz-container {
        background: linear-gradient(135deg, rgba(26, 26, 46, 0.8), rgba(22, 33, 62, 0.8));
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.9);
    }

    .category-label,
    #category-select,
    #start-btn,
    #next-btn,
    #reload-btn {
        color: #d1d1f9;
        border-color: #a78bfa;
        background: rgba(51, 51, 77, 0.85);
    }
}

/* Adjustments for dark mode */
#category-select:hover,
#category-select:focus {
    border-color: #e0d7ff;
    background: rgba(70, 60, 110, 0.95);
}

.answers li {
    background: rgba(51, 51, 77, 0.85);
    color: #fff;
}

.answers li:hover {
    background: rgba(84, 84, 126, 1);
    box-shadow: 0 8px 15px rgba(120, 104, 255, 0.8);
}

/* Adjustments for dark mode */
.answers li.selected {
    background: #6c63ff;
    border-color: #a78bfa;
    box-shadow: 0 0 12px 3px #a78bfa;
}

#next-btn:hover,
#start-btn:hover {
    background: #5548d6;
}

/* Adjustments for dark mode */
#next-btn:disabled,
#start-btn:disabled {
    background: #9999cc;
    cursor: not-allowed;
    box-shadow: none;
}

#reload-btn:hover {
    background: #a78bfa;
    color: #fff;
    border-color: #a78bfa;
}

/* Adjustments for dark mode */
#reload-btn {
    background: transparent;
    border: 2px solid #6c63ff;
    color: #6c63ff;
    padding: 10px 22px;
    font-weight: 700;
    border-radius: 40px;
    cursor: pointer;
    margin-top: 1.2rem;
    transition: 0.3s ease;

    box-shadow: 0 0 12px rgba(108, 99, 255, 0.5);

}

#reload-btn:hover {
    background: #a78bfa;
    color: #fff;
    border-color: #a78bfa;
}