* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
}

.container {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 600px;
    min-width: 320px;
    overflow: hidden;
}

/** Header  */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: clamp(25px, 5vw, 50px) clamp(20px, 5vw, 40px);
    text-align: center;
}

.header h1 {
    margin-bottom: 10px;
    font-size:  clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 300;
    letter-spacing: 1px;
    text-transform: capitalize;
}

.header p {
    font-size: clamp(0.9rem, 2.5vw, 1.2rem);
    opacity: 0.9;
    font-weight: 300;
}

.content {
    padding: clamp(20px, 4vw, 40px) clamp(15px, 4vw, 30px);
}

/** Choose Section  */
.choose-card {
    background: #fff;
    border: 2px solid #f1f3f4;
    border-radius: 15px;
    padding: clamp(20px, 4vw, 30px);
    margin-bottom: 30px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.chooseTopic, .chooseNumQuestions {
    width: 100%;
    margin-bottom: 25px;
}

.chooseTopic:last-child, .chooseNumQuestions:last-child {
    margin-bottom: 0;
}

.chooseTopic h3, .chooseNumQuestions h3 {
    color: #333;
    font-size: clamp(1rem, 3vw, 1.3rem);
    font-weight: 600;
    margin-bottom: 20px;
    text-align: center;

}

/** Topic Section Styling */
#chooseSection {
    display: none;
}

#topics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
    gap: clamp(10px, 2vw, 15px);
    margin-top: 15px;
}

.topic-option {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(12px, 3vw, 15px) clamp(15px, 3vw, 20px);
    background: #f8f9ff;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    color: #4a5568;
    text-align: center;
    min-height: clamp(50px, 8vw, 60px);
    font-size: clamp(0.85rem, 2vw, 1rem);
}

.topic-option:hover {
    border-color: #667eea;
    background: #f0f4ff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
}

.topic-option.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.3);
}

.topic-option input[type="radio"] {
    display: none;
}

/** Number Selection Styling */
#numbers {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(70px, max-content));
    gap: clamp(12px, 2vw, 20px);
    margin: 0 auto;
    max-width: 540px;
    justify-content: center;
    justify-items: center;
    width: 100%;
}

.number-option {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(10px, 2.5vw, 12px) clamp(15px, 3vw, 20px);
    background: #f8f9ff;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    color: #4a5568;
    font-size: clamp(0.9rem, 2.2vw, 1.1rem);
    min-width: 60px;
    max-width: 80px;
    width: auto;
}

.number-option:hover {
    border-color: #667eea;
    background: #f0f4ff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
}

.number-option.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.3);
}

.number-option input[type="radio"] {
    display: none;
}

/** Instruction  */
.instructions {
    background: #f8f9ff;
    border-left: 4px solid #667eea;
    padding: clamp(20px, 4vw, 25px);
    margin-bottom: 30px;
    border-radius:  0 10px 10px 0;
}

.instructions h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    font-weight: 600;
}

.instructions p {
    color: #666;
    line-height: 1.6;
    font-size: clamp(0.85rem, 2vw, 1rem);
    margin-bottom: 10px;
}

/** Quiz section  */
#quizSection {
    display: none;
}

#quizSection.active {
    display: block;
}

/** Progress Bar  */
.progress-bar {
    background:  #e9ecef;
    height: clamp(4px, 1vw, 6px);
    border-radius: 3px;
    margin-bottom: clamp(20px, 4vw, 30px);
    overflow: hidden;
}

#progress {
    background: linear-gradient(90deg, #667eea, #764ba2);
    height: 100%;
    width: 0%;
    border-radius: 3px;
    transition: width 0.3s ease;
}


/** Question Card  */ 
.question-card {
    background: #fff;
    border: 2px solid #f1f3f4;
    border-radius: 15px;
    padding: clamp(20px, 4vw, 30px);
    margin-bottom: clamp(20px, 4vw, 30px);
    transition: all 0.3s ease;
}

#questionNumber {
    color: #667eea;
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

#questionText {
    color: #333;
    font-size: clamp(1rem, 2.8vw, 1.4rem);
    line-height: 1.5;
    margin-bottom: 25px;
    font-weight: 400;
    text-align: center;
}

/** Aswers  */
#answersContainer {
    display: flex;
    flex-direction: column;
    gap: clamp(12px, 2.5vw, 15px);
}

.answer-option {
    padding: clamp(12px, 3vw, 15px) clamp(15px, 3vw, 20px);
    background: #f8f9ff;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: clamp(0.9rem, 2.2vw, 1.1rem);
    font-weight: 500;
    color: #4a5568;
    text-align: center;
    position: relative;
}

.answer-option:hover {
    border-color: #667eea;
    background: #f0f4ff;
    transform: translateY(-2px);
}

.answer-option.correct {
    background: #c6f6d5;
    color: #22543d;
    border-color: #68d391;
}

.answer-option.incorrect {
    background: #fed7d7;
    color: #742a2a;
    border-color: #fc8181;
}

.answer-option.correct-reveal {
    background: #c6f6d5;
    color: #22543d;
    border-color: #68d391;
    animation: revealCorrectAnswer 0.5s ease;
}

.answer-option.correct-reveal::after {
    content: " ✔";
    position: absolute;
    font-weight: bold;
    color: #22543d;
    left: 13px;
    top: 13px;
}

.answer-option.correct::after {
    content: " ✔";
    position: absolute;
    font-weight: bold;
    color: #22543d;
    left: 13px;
    top: 13px;
}

.answer-option.incorrect::after {
    content: " ✖";
    position: absolute;
    font-weight: bold;
    color: #742a2a;
    left: 13px;
    top: 13px;
}


@keyframes revealCorrectAnswer {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}

/** Feedback  */
#feedback {
    margin-top: clamp(15px, 3vw, 20px);
    padding: clamp(12px, 3vw, 15px);
    border-radius: 10px;
    font-size: clamp(0.9rem, 2.2vw, 1.1rem);
    font-weight: 500;
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

#feedback.show {
    opacity: 1;
    transform: translateY(0);
}

#feedback.correct {
    background: #d9f3e2;
    color: #2c6b4d;
    border: 2px solid #bfe6ca;
}

#feedback.incorrect {
    background: #ffe6e6;
    color: #9b3b3b;
    border: 2px solid #ffd0d0;
}

/**  Buttons  */
#startBtn, #okayBtn, #restartBtn, #backToResultsBtn {
    display: block;
    width: min(200px, 80%);
    margin: 0 auto;
    padding: clamp(12px, 3vw, 15px) clamp(20px, 5vw, 30px);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 25px;
    font-size: clamp(0.9rem, 2.2vw, 1.1rem);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;

}

#startBtn:hover, #okayBtn:hover, #restartBtn:hover, #backToResultsBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

#viewAnswersBtn {
    display: block;
    width: min(200px, 80%);
    margin: 0 auto 10px auto;
    padding: clamp(12px, 3vw, 15px) clamp(20px, 5vw, 30px);
    background: #fff;
    color: #667eea;
    border: 2px solid #667eea;
    border-radius: 25px;
    font-size: clamp(0.9rem, 2.2vw, 1.1rem);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

#viewAnswersBtn:hover {
    background:  #667eea;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

/** Result Section  */
#resultSection {
    text-align: center;
    display: none;
}

#resultSection.show {
    display: block;
}

#scoreCircle {
    width: clamp(120px, 20vw, 150px);
    height: clamp(120px, 20vw, 150px);
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 30px;
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 300;
}

#resultMessage {
    font-size: clamp(1.1rem, 3vw, 1.4rem);
    margin-bottom: 20px;
    font-weight: 400;
}

#resultMessage.pass {
    color: #22543d;
}

#resultMessage.fail {
    color: #742a2a;
}

#resultDetails {
    color: #666;
    font-size: clamp(0.9rem, 2.2vw, 1.1rem);
    line-height: 1.6;
    margin-bottom: 20px;
}



/** Answer Review Section */
#answerReviewSection {
    display: none;
}

#answerReviewSection.show {
    display: block;
}

.review-question-card {
    background: #fff;
    border: 2px solid #f1f3f4;
    border-radius: 15px;
    padding: clamp(20px, 4vw, 30px);
    margin-bottom: clamp(15px, 3vw, 20px);
    text-align: center;
}

.review-question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.review-question-number {
    color: #667eea;
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.review-result-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: clamp(0.75rem, 1.8vw, 0.85rem);
    font-weight: 600;
    text-transform: uppercase;
}

.review-result-badge.correct {
    background: #c6f6d5;
    color: #22543d;
}

.review-result-badge.incorrect {
    background: #fed7d7;
    color: #742a2a;
}

.review-question-text {
    color: #333;
    font-size: clamp(0.95rem, 2.5vw, 1.2rem);
    line-height: 1.5;
    margin-bottom: 20px;
    font-weight: 400;
}

.review-answers {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.review-answer {
    padding: 12px 15px;
    border-radius: 8px;
    font-size: clamp(0.85rem, 2vw, 1rem);
    position: relative;
    border: 2px solid transparent;
    font-weight: 500;
}

.review-answer.user-selected {
    border: 2px solid #667eea;
    background: #f0f4ff;
}

.review-answer.correct-answer {
    background: #c6f6d5;
    color: #22543d;
}

.review-answer.user-selected.correct-answer {
    background: #a7f3d0;
    border-color: #68d391;
}

.review-answer.user-selected.incorrect {
    background: #fed7d7;
    color: #742a2a;
    border-color: #fc8181;
}

.review-answer::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 20px;
    border-radius: 2px;
}

.review-answer.correct-answer::before {
    background: #22543d;
}

.review-answer.user-selected::before {
    background: #667eea;
}

.review-answer.user-selected.incorrect::before {
    background: #742a2a;
}

.review-summary {
    background: #f8f9ff;
    border-left: 4px solid #667eea;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 0 10px 10px 0;
    text-align: center;
}

.review-summary h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: clamp(1.1rem, 2.8vw, 1.3rem);
}

.review-summary p {
    color: #666;
    font-size: clamp(0.9rem, 2.2vw, 1rem);
    margin-bottom: 5px;
}



/** Responsiveness  */
@media (min-width: 1200px) {
    .container {
        max-width: 620px;
        max-height: 95vh;
        display: flex;
        flex-direction: column;
    }

    .header {
        padding: 25px 30px;
        flex-shrink: 0;
    }

    .header h1 {
        font-size: 1.8rem;
        margin-bottom: 5px;
    }

    .header p {
        font-size: 1rem;
    }

    .content {
        padding: 25px 30px;
        flex: 1;
        overflow-y: auto;
        min-height: 0;
    }

    .choose-card {
        padding: 20px;
        margin-bottom: 20px;
        gap: 20px;
    }

    .chooseTopic, .chooseNumQuestions {
        margin-bottom: 15px;
    }

    .chooseTopic h3, .chooseNumQuestions h3 {
        font-size: 1.1rem;
        margin-bottom: 15px;
    }

    #topics {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .topic-option {
        padding: 12px 15px;
        min-height: 50px;
        font-size: 0.95rem;
    }

    #numbers {
        grid-template-columns: repeat(6, 1fr);
        max-width: 500px;
        gap: 12px;
    }

    .number-option {
        padding: 10px 15px;
        font-size: 1rem;
    }

    .instructions {
        padding: 20px;
        margin-bottom: 20px;
    }

    .instructions h3 {
        font-size: 1.1rem;
        margin-bottom: 12px;
    }

    .instructions p {
        font-size: 0.95rem;
        margin-bottom: 8px;
    }

    .question-card {
        padding: 25px;
        margin-bottom: 20px;
    }

    #questionNumber {
        font-size: 0.85rem;
        margin-bottom: 12px;
    }

    #questionText {
        font-size: 1.2rem;
        margin-bottom: 20px;
    }

    #answersContainer {
        gap: 10px;
    }

    .answer-option {
        padding: 12px 18px;
        font-size: 1rem;
    }

    #feedback {
        margin-top: 15px;
        padding: 12px;
        font-size: 1rem;
    }

    .progress-bar {
        margin-bottom: 20px;
    }

    #startBtn, #okayBtn, #restartBtn, #backToResultsBtn {
        padding: 12px 25px;
        font-size: 1rem;
    }

    #viewAnswersBtn {
        padding: 12px 25px;
        font-size: 1rem;
        margin-bottom: 10px;
    }

    #scoreCircle {
        width: 130px;
        height: 130px;
        margin: 0 auto 20px;
        font-size: 1.8rem;
    }

    #resultMessage {
        font-size: 1.3rem;
        margin-bottom: 15px;
    }

    #resultDetails {
        font-size: 1rem;
        margin-bottom: 15px;
    }

    .review-question-card {
        padding: 20px;
        margin-bottom: 15px;
    }

    .review-question-number {
        font-size: 0.85rem;
    }

    .review-result-badge {
        padding: 4px 10px;
        font-size: 0.8rem;
    }

    .review-question-text {
        font-size: 1.1rem;
        margin-bottom: 15px;
    }

    .review-answer {
        padding: 10px 15px;
        font-size: 0.95rem;
    }

    .review-summary {
        padding: 18px;
        margin-bottom: 18px;
    }

    .review-summary h3 {
        font-size: 1.2rem;
        margin-bottom: 8px;
    }

    .review-summary p {
        font-size: 0.95rem;
    }
}


@media (max-width:768px) and (max-width: 1199px) {
    body {
        padding: 20px;
    }
    
    .container {
        max-width: 750px;
    }

    #topic {
        grid-template-columns: repeat(2, 1fr);
    }

    #numbers {
        grid-template-columns: repeat(auto-fit, minmax(70px, max-content));
        max-width: 400px;
        gap: 15px;
    }

    .number-option {
        max-width: 75px;
    }

    .choose-card {
        gap: 20px;
    }

    .review-question-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .review-answer {
        padding-left: 25px;
    }

    
} 


@media (min-width: 481px) and (max-width: 767px) {
    body {
        padding: 15px;
    }

    .container {
        max-width: 95%;
    }

    #topics {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    #numbers {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }

    .topic-option, .number-option {
        min-height: 45px;
    }


}


@media (max-width: 480px) {
    body {
        padding: 10px;
        padding-top: 20px;
    }

    .container {
        max-width: 100%;
        border-radius: 15px;
    }


    .header {
        border-radius: 15px 15px 0 0;
    }

    #topics {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    #numbers {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    
    .topic-option {
        min-height: 50px;
        padding: 15px 10px;
    }
    
    .number-option {
        min-height: 45px;
        padding: 12px 8px;
    }
    
    .answer-option {
        /* text-align: left; */
        padding: 15px;
    }
    
    #questionText {
        /* text-align: left; */
        margin-bottom: 20px;
    }
    

}

@media (max-width: 360px) {
    #number {
        grid-template-columns: repeat(2, 1fr);
    }

    .chooseTopic h3, .chooseNumQuestions h3 {
        font-size: 1rem;
    }

    .topic-option, .number-option {
        font-size: 0.85rem;
    }
}

