* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #eeedee;
    font-family: "Poppins", sans-serif;
}


/* Quiz page */

.quiz-page {
    width: 100%;
    min-height: 100vh;
    padding: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}


/* Quiz start */

.quiz-start {
    width: 100%;
    max-width: 1250px;

    display: grid;
    grid-template-columns: minmax(500px, 1fr) minmax(500px, 1fr);
    align-items: center;
    gap: 30px;
}

.quiz-start-card {
    width: 100%;
    padding: 45px;
    background: #f9f9fa;
    border-radius: 20px;
    text-align: center;
}

.quiz-label {
    display: block;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #5865FF;
}

.quiz-start-card h1 {
    margin: 0;
    font-size: 36px;
    background: linear-gradient(
        90deg,
        #b36bff,
        #5865FF
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.quiz-information {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.quiz-info-item {
    min-width: 180px;
    padding: 18px;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.info-title {
    font-size: 13px;
    color: #888;
}

.info-value {
    font-size: 18px;
    font-weight: 600;
    color: #222;
}

.quiz-description {
    margin: 30px auto;
    max-width: 550px;
    color: #777;
    line-height: 1.6;
}

.last-score {
    display: none;
    margin: 20px auto;
    padding: 12px 18px;
    max-width: 350px;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    color: #666;
    font-size: 14px;
}

.last-score strong {
    color: #5865FF;
}


/* Buttons */

.start-quiz-button,
.next-button,
.return-button {
    border: none;
    padding: 14px 30px;
    border-radius: 10px;
    background: linear-gradient(
        90deg,
        #b36bff,
        #5865FF
    );
    color: white;
    font-family: "Poppins", sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s ease;
}

.start-quiz-button:hover,
.next-button:hover,
.return-button:hover {
    transform: translateY(-2px);
}

.next-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}


/* Quiz */

.quiz-container {
    display: none;
    width: 100%;
    max-width: 850px;
}

.quiz-header {
    margin-bottom: 20px;
    padding: 25px;
    background: #f9f9fa;
    border-radius: 18px;
}

.quiz-header h2 {
    margin: 0;
    color: #222;
    font-size: 22px;
}


/* Hp */

.quiz-hp {
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.hp-label {
    font-size: 13px;
    font-weight: 700;
    color: #5865FF;
}

.hp-bar {
    flex: 1;
    height: 14px;
    background: #e5e5e5;
    border-radius: 20px;
    overflow: hidden;
}

.hp-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        #b36bff,
        #5865FF
    );
    border-radius: 20px;
    transition: width 0.3s ease;
}

.hp-value {
    min-width: 55px;
    font-size: 13px;
    font-weight: 600;
    color: #555;
}


/* Question */

.question-card {
    padding: 35px;
    background: #f9f9fa;
    border-radius: 18px;
}

.question-card h2 {
    margin: 0 0 30px;
    color: #222;
    font-size: 23px;
    line-height: 1.5;
}


/* Answer options */

.answer-options {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.answer-option {
    display: flex;
    align-items: center;
    padding: 18px;
    background: white;
    border: 2px solid #e5e5e5;
    border-radius: 12px;
    cursor: pointer;
    transition:
        border-color 0.2s ease,
        background 0.2s ease,
        transform 0.2s ease;
}

.answer-option:hover {
    border-color: #5865FF;
    transform: translateY(-2px);
}

.answer-option input {
    display: none;
}


/* Answer letter */

.answer-letter {
    width: 38px;
    height: 38px;
    margin-right: 15px;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
    background: #f1f1f3;
    font-weight: 600;
    color: #555;
    transition:
        background 0.2s ease,
        color 0.2s ease;
}


/* Selected answer */

.answer-option:has(
    input:checked
) {
    border-color: #5865FF;
}

.answer-option:has(
    input:checked
) .answer-letter {
    background: linear-gradient(
        90deg,
        #b36bff,
        #5865FF
    );
    color: white;
}


/* Answer text */

.answer-text {
    font-size: 15px;
    color: #333;
    line-height: 1.5;
}


/* Correct answer */

.answer-option.correct-answer {
    border-color: #22c55e !important;
    background: rgba(
        34,
        197,
        94,
        0.08
    ) !important;
}

.answer-option.correct-answer
.answer-letter {
    background: #22c55e !important;
    color: white !important;
}


/* Wrong selected answer */

.answer-option.wrong-answer {
    border-color: #ef4444 !important;
    background: rgba(
        239,
        68,
        68,
        0.08
    ) !important;
}

.answer-option.wrong-answer
.answer-letter {
    background: #ef4444 !important;
    color: white !important;
}


/* Answer feedback */

.answer-feedback {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
}

.correct-feedback {
    color: #15803d;
    background: rgba(
        34,
        197,
        94,
        0.10
    );
}

.wrong-feedback {
    color: #b91c1c;
    background: rgba(
        239,
        68,
        68,
        0.10
    );
}


/* Quiz navigation */

.quiz-navigation {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
}


/* Result */

.quiz-result {
    display: none;
    width: 100%;
    max-width: 650px;
}

.quiz-result-card {
    padding: 45px;
    background: #f9f9fa;
    border-radius: 20px;
    text-align: center;
}

.quiz-result-card h1 {
    margin: 0 0 25px;
    font-size: 34px;
    color: #222;
}


/* Score circle */

.score-circle {
    width: 180px;
    height: 180px;
    margin: 0 auto;
    border-radius: 50%;
    background: linear-gradient(
        90deg,
        #b36bff,
        #5865FF
    );
    display: flex;
    justify-content: center;
    align-items: center;
}

.score-circle > div {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: #f9f9fa;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.score-circle strong {
    font-size: 28px;
    color: #222;
}

.score-circle span {
    font-size: 13px;
    color: #888;
}


/* Result percentage */

.quiz-result-card h2 {
    margin: 20px 0 5px;
    font-size: 30px;
    background: linear-gradient(90deg,#b36bff,#5865FF);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.quiz-result-card p {
    color: #777;
}


/* Attempt history */

.attempt-history {
    width: 100%;
    margin-top: 35px;
    padding-top: 28px;

    border-top: 1px solid #e5e5e5;
}


.attempt-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    margin-bottom: 18px;
}


.history-label {
    display: block;
    margin-bottom: 4px;

    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;

    background: linear-gradient(
        90deg,
        #b36bff,
        #5865FF
    );

    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}


.attempt-history-header h3 {
    margin: 0;

    font-size: 20px;
    font-weight: 600;

    background: linear-gradient(90deg,#b36bff,#5865FF);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}


.attempt-count {
    padding: 7px 12px;

    border-radius: 20px;

    background: #f1eafa;
    color: #8c45d4;

    font-size: 12px;
    font-weight: 600;

    white-space: nowrap;
}


.attempt-table-wrapper {
    width: 100%;

    overflow-x: auto;

    border: 1px solid #e5e5e5;
    border-radius: 12px;
}


.attempt-table {
    width: 100%;
    min-width: 600px;

    border-collapse: collapse;

    background: white;
}


.attempt-table th {
    padding: 13px 16px;

    border-bottom: 1px solid #e5e5e5;

    background: #f7f5f9;

    background: linear-gradient(90deg,#b36bff,#5865FF);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;

    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;

    text-align: left;
    text-transform: uppercase;
}


.attempt-table td {
    padding: 14px 16px;

    border-bottom: 1px solid #eeeeee;

    color: #555;

    font-size: 13px;

    vertical-align: middle;
}


.attempt-table tbody tr:last-child td {
    border-bottom: none;
}


.attempt-table td strong {
    color: #5865FF;
    font-weight: 600;
}


.attempt-table tbody tr {
    transition:
        background 0.2s ease;
}


.attempt-table tbody tr:hover {
    background: #faf8fc;
}


/* Highlight latest attempt */

.attempt-table .latest-attempt {
    background: rgba(
        179,
        107,
        255,
        0.08
    );
}


.attempt-table .latest-attempt:hover {
    background: rgba(
        179,
        107,
        255,
        0.11
    );
}


.attempt-table .latest-attempt td {
    color: #444;
}


.attempt-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 28px;
    height: 28px;
    padding: 0 8px;

    border-radius: 8px;

    background: #f1edf5;
    color: #666;

    font-size: 12px;
    font-weight: 600;
}


.latest-attempt .attempt-number {
    background: rgba(
        179,
        107,
        255,
        0.2
    );

    color: #8c45d4;
}


.latest-badge {
    display: inline-block;

    margin-left: 7px;
    padding: 4px 7px;

    border-radius: 5px;

    background: rgba(
        179,
        107,
        255,
        0.15
    );

    color: #8c45d4;

    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.4px;

    text-transform: uppercase;
}

@media (max-width: 700px) {

    .attempt-history {
        margin-top: 28px;
        padding-top: 22px;
    }


    .attempt-history-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }


    .attempt-history-header h3 {
        font-size: 18px;
    }


    .attempt-table {
        min-width: 600px;
    }


    .attempt-table th,
    .attempt-table td {
        padding: 11px 12px;
    }

}


/* Highlight latest attempt */

.attempt-table .latest-attempt {
    background: rgba(
        179,
        107,
        255,
        0.08
    );
}

.attempt-table .latest-attempt:hover {
    background: rgba(
        179,
        107,
        255,
        0.11
    );
}

.attempt-table .latest-attempt td {
    color: #444;
}

.attempt-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border-radius: 8px;
    background: #f1edf5;
    color: #666;
    font-size: 12px;
    font-weight: 600;
}

.latest-attempt .attempt-number {
    background: rgba(
        179,
        107,
        255,
        0.2
    );
    color: #8c45d4;
}

.latest-badge {
    display: inline-block;
    margin-left: 7px;
    padding: 4px 7px;
    border-radius: 5px;
    background: rgba(
        179,
        107,
        255,
        0.15
    );
    color: #8c45d4;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}


/* Exit button */

#exitQuiz {
    width: 100%;
    margin-top: 12px;
    padding: 12px 18px;
    border: 1px solid rgba(
        255,
        255,
        255,
        0.12
    );
    border-radius: 10px;
    background: rgba(
        255,
        255,
        255,
        0.05
    );
    color: #cfc5d8;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}

#exitQuiz:hover {
    background: rgba(
        179,
        107,
        255,
        0.10
    );
    border-color: rgba(
        179,
        107,
        255,
        0.35
    );
    color: #b36bff;
}

#exitQuiz:active {
    transform: scale(0.98);
}


/* Exit modal */

.exit-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: rgba(
        20,
        12,
        30,
        0.45
    );
    backdrop-filter: blur(6px);
}

.exit-modal-card {
    width: 100%;
    max-width: 420px;
    padding: 32px;
    background: #f9f9fa;
    border: 1px solid #e5e1e8;
    border-radius: 18px;
    text-align: center;
    box-shadow:
        0 20px 50px rgba(
            0,
            0,
            0,
            0.18
        );
}

.exit-modal-label {
    display: block;
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #5865FF;
}

.exit-modal-card h2 {
    margin: 0 0 12px;
    font-size: 24px;
    font-weight: 700;
    color: #222;
}

.exit-modal-card p {
    margin: 0 auto 25px;
    max-width: 330px;
    font-size: 14px;
    line-height: 1.6;
    color: #777;
}

.exit-modal-actions {
    display: flex;
    gap: 12px;
}

.cancel-exit-button,
.confirm-exit-button {
    flex: 1;
    padding: 12px 18px;
    border-radius: 10px;
    font-family: "Poppins", sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}

.cancel-exit-button {
    border: 1px solid #ded9e3;
    background: #f2f0f4;
    color: #666;
}

.cancel-exit-button:hover {
    background: #e9e5ed;
    color: #444;
}

.confirm-exit-button {
    border: 1px solid transparent;
    background: linear-gradient(
        90deg,
        #b36bff,
        #5865FF
    );
    color: white;
}

.confirm-exit-button:hover {
    transform: translateY(-2px);
}

.cancel-exit-button:active,
.confirm-exit-button:active {
    transform: scale(0.98);
}


/* Tablet */

@media (max-width: 1100px) {

    .quiz-start {
        grid-template-columns: 1fr;
        max-width: 850px;
    }

    .attempt-history {
        order: 2;
    }

    .quiz-start-card {
        order: 1;
    }

}


/* Mobile */

@media (max-width: 700px) {

    .quiz-page {
        padding: 20px;
    }

    .quiz-start {
        gap: 20px;
    }

    .quiz-start-card,
    .question-card,
    .quiz-result-card,
    .attempt-history {
        padding: 25px;
    }

    .quiz-start-card h1 {
        font-size: 28px;
    }

    .quiz-information {
        flex-direction: column;
    }

    .quiz-info-item {
        width: 100%;
    }

    .quiz-hp {
        flex-wrap: wrap;
    }

    .hp-bar {
        min-width: 150px;
    }

    .question-card h2 {
        font-size: 20px;
    }

    .answer-option {
        padding: 15px;
    }

    .answer-letter {
        width: 34px;
        height: 34px;
        margin-right: 12px;
    }

    .answer-text {
        font-size: 14px;
    }

    .quiz-navigation {
        justify-content: stretch;
    }

    .next-button {
        width: 100%;
    }

    .attempt-history-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .attempt-history-header h3 {
        font-size: 18px;
    }

    .attempt-table {
        min-width: 600px;
    }

    .attempt-table th,
    .attempt-table td {
        padding: 11px 12px;
    }

    #exitQuiz {
        margin-top: 10px;
        padding: 14px 18px;
        min-height: 46px;
        font-size: 14px;
        border-radius: 10px;
    }

    .exit-modal {
        padding: 20px;
    }

    .exit-modal-card {
        padding: 25px 20px;
        border-radius: 16px;
    }

    .exit-modal-card h2 {
        font-size: 22px;
    }

    .exit-modal-card p {
        font-size: 13px;
    }

    .exit-modal-actions {
        flex-direction: column;
    }

    .cancel-exit-button,
    .confirm-exit-button {
        width: 100%;
        min-height: 46px;
    }

}