/* =========================================================
   CYBERSECURITY LIFE - QUIZ PAGE
   Animated grid design
   ========================================================= */

:root {
    --quiz-bg: #020b18;
    --quiz-panel: rgba(5, 22, 42, 0.88);
    --quiz-panel-light: rgba(9, 35, 61, 0.92);
    --quiz-cyan: #27e9ff;
    --quiz-blue: #2684ff;
    --quiz-green: #55ffb0;
    --quiz-red: #ff5f79;
    --quiz-gold: #ffd56a;
    --quiz-text: #ecfaff;
    --quiz-muted: #a9c5d6;
    --quiz-border: rgba(39, 233, 255, 0.28);
    --quiz-shadow: 0 0 26px rgba(39, 233, 255, 0.12);
}

html {
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;
}

.quiz-page {
    position: relative;
    isolation: isolate;
    min-height: 100vh;
    color: var(--quiz-text);
    background:
        radial-gradient(circle at 15% 10%, rgba(38, 132, 255, 0.18), transparent 30%),
        radial-gradient(circle at 85% 35%, rgba(39, 233, 255, 0.12), transparent 28%),
        linear-gradient(180deg, #03101f 0%, var(--quiz-bg) 100%);
}

.quiz-page::before,
.quiz-page::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
}

.quiz-page::before {
    z-index: -2;
    opacity: 0.35;
    background-image:
        linear-gradient(rgba(39, 233, 255, 0.12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(39, 233, 255, 0.12) 1px, transparent 1px);
    background-size: 46px 46px;
    animation: quizGridMove 18s linear infinite;
}

.quiz-page::after {
    z-index: -1;
    background: linear-gradient(180deg, transparent, rgba(2, 11, 24, 0.84));
}

.quiz-hero {
    position: relative;
    min-height: 610px;
    display: grid;
    place-items: center;
    overflow: hidden;
    padding: 110px 24px 80px;
    border-bottom: 1px solid var(--quiz-border);
}

.quiz-hero::before,
.quiz-hero::after {
    content: "";
    position: absolute;
    width: 430px;
    height: 430px;
    border: 1px solid rgba(39, 233, 255, 0.22);
    border-radius: 50%;
    animation: heroOrbit 16s linear infinite;
}

.quiz-hero::after {
    width: 590px;
    height: 590px;
    border-style: dashed;
    animation-direction: reverse;
    animation-duration: 24s;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, transparent 49.7%, rgba(39, 233, 255, 0.18) 50%, transparent 50.3%),
        linear-gradient(transparent 49.7%, rgba(39, 233, 255, 0.14) 50%, transparent 50.3%);
    opacity: 0.28;
    animation: overlayPulse 5s ease-in-out infinite;
}

.quiz-hero-content {
    position: relative;
    z-index: 2;
    width: min(980px, 100%);
    text-align: center;
}

.status-badge,
.section-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    border: 1px solid var(--quiz-border);
    border-radius: 999px;
    color: var(--quiz-cyan);
    background: rgba(5, 24, 43, 0.72);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    box-shadow: inset 0 0 16px rgba(39, 233, 255, 0.08);
}

.status-badge i {
    animation: brainPulse 1.8s ease-in-out infinite;
}

.quiz-hero h1 {
    max-width: 900px;
    margin: 28px auto 18px;
    font-size: clamp(2.5rem, 6vw, 5.3rem);
    line-height: 1.03;
    letter-spacing: -0.045em;
    text-shadow: 0 0 28px rgba(39, 233, 255, 0.24);
}

.quiz-hero-content > p {
    max-width: 760px;
    margin: 0 auto;
    color: var(--quiz-muted);
    font-size: clamp(1rem, 2vw, 1.22rem);
    line-height: 1.8;
}

.quiz-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    max-width: 820px;
    margin: 46px auto 0;
}

.stat-box {
    position: relative;
    overflow: hidden;
    padding: 24px 18px;
    border: 1px solid var(--quiz-border);
    border-radius: 18px;
    background: linear-gradient(145deg, rgba(8, 34, 60, 0.9), rgba(3, 17, 32, 0.88));
    box-shadow: var(--quiz-shadow);
    animation: statFloat 4s ease-in-out infinite;
}

.stat-box:nth-child(2) { animation-delay: 0.5s; }
.stat-box:nth-child(3) { animation-delay: 1s; }

.stat-box::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 30%, rgba(39, 233, 255, 0.14), transparent 70%);
    transform: translateX(-120%);
    animation: cardScan 5s linear infinite;
}

.stat-box h2 {
    position: relative;
    margin: 0 0 8px;
    color: var(--quiz-cyan);
    font-size: 2rem;
}

.stat-box p {
    position: relative;
    margin: 0;
    color: var(--quiz-muted);
}

.quiz-intro,
.quiz-section,
.continue-learning {
    padding: 86px 24px;
}

.section-title,
.quiz-section,
.learning-box {
    width: min(1080px, 100%);
    margin-inline: auto;
}

.section-title {
    text-align: center;
}

.section-title h2,
.learning-box h2,
#quizResults h2 {
    margin: 20px 0 14px;
    font-size: clamp(2rem, 4vw, 3.1rem);
}

.section-title > p,
.learning-box > p {
    max-width: 760px;
    margin-inline: auto;
    color: var(--quiz-muted);
    line-height: 1.8;
}

.quiz-section {
    position: relative;
    padding-top: 26px;
}

#quizQuestions {
    display: grid;
    gap: 24px;
}

.question-card {
    position: relative;
    overflow: hidden;
    padding: 28px;
    border: 1px solid var(--quiz-border);
    border-radius: 22px;
    background: linear-gradient(145deg, var(--quiz-panel-light), var(--quiz-panel));
    box-shadow: var(--quiz-shadow);
    animation: questionReveal 0.55s ease both;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.question-card:nth-child(2) { animation-delay: 0.08s; }
.question-card:nth-child(3) { animation-delay: 0.16s; }
.question-card:nth-child(4) { animation-delay: 0.24s; }
.question-card:nth-child(5) { animation-delay: 0.32s; }

.question-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--quiz-cyan), transparent);
    animation: topLineMove 4s linear infinite;
}

.question-card:hover {
    transform: translateY(-4px);
    border-color: rgba(39, 233, 255, 0.58);
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.28), 0 0 30px rgba(39, 233, 255, 0.14);
}

.question-card h3 {
    margin: 0 0 22px;
    font-size: clamp(1.08rem, 2vw, 1.32rem);
    line-height: 1.5;
}

.answer-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.answer-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-height: 68px;
    padding: 16px;
    border: 1px solid rgba(169, 197, 214, 0.2);
    border-radius: 14px;
    background: rgba(2, 13, 27, 0.68);
    color: var(--quiz-muted);
    cursor: pointer;
    transition: 0.22s ease;
}

.answer-option:hover {
    color: var(--quiz-text);
    border-color: var(--quiz-cyan);
    background: rgba(39, 233, 255, 0.08);
    transform: translateX(3px);
}

.answer-option input {
    width: 19px;
    height: 19px;
    margin-top: 2px;
    accent-color: var(--quiz-cyan);
    flex: 0 0 auto;
}

.answer-option:has(input:checked) {
    color: var(--quiz-text);
    border-color: var(--quiz-cyan);
    background: rgba(39, 233, 255, 0.12);
    box-shadow: inset 0 0 18px rgba(39, 233, 255, 0.08);
}

.answer-option.correct-answer,
.question-card.correct-answer {
    border-color: rgba(85, 255, 176, 0.72);
}

.answer-option.correct-answer {
    color: #dffff0;
    background: rgba(85, 255, 176, 0.12);
}

.answer-option.incorrect-answer,
.question-card.incorrect-answer {
    border-color: rgba(255, 95, 121, 0.72);
}

.answer-option.incorrect-answer {
    color: #FF7373;
    background: rgba(255, 95, 121, 0.12);
}

.question-feedback {
    display: none;
    margin-top: 18px;
    padding: 15px 17px;
    border-radius: 12px;
    line-height: 1.65;
}

.correct-feedback,
.incorrect-feedback,
.unanswered-feedback {
    display: block;
    animation: feedbackReveal 0.35s ease both;
}

.correct-feedback {
    border: 1px solid rgba(85, 255, 176, 0.42);
    background: rgba(85, 255, 176, 0.09);
    color: #d8ffeb;
}

.incorrect-feedback,
.unanswered-feedback {
    border: 1px solid rgba(255, 95, 121, 0.4);
    background: rgba(255, 95, 121, 0.09);
    color: #ffe0e5;
}

.quiz-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 34px;
}

.quiz-buttons button,
.learning-button {
    position: relative;
    overflow: hidden;
    min-width: 190px;
    padding: 15px 24px;
    border: 1px solid var(--quiz-cyan);
    border-radius: 999px;
    color: #00121f;
    background: linear-gradient(135deg, var(--quiz-cyan), #67ffc5);
    font: inherit;
    font-weight: 800;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 0 22px rgba(39, 233, 255, 0.2);
    transition: transform 0.22s ease, box-shadow 0.22s ease, opacity 0.22s ease;
}

#resetQuiz,
.secondary-learning-button {
    color: var(--quiz-text);
    background: rgba(5, 24, 43, 0.86);
}

.quiz-buttons button:hover,
.learning-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(39, 233, 255, 0.25);
}

.quiz-buttons button:disabled {
    cursor: not-allowed;
    opacity: 0.58;
    transform: none;
}

#quizResults {
    margin-top: 34px;
    padding: 30px;
    border: 1px solid var(--quiz-border);
    border-radius: 22px;
    background: rgba(4, 19, 36, 0.9);
    text-align: center;
    box-shadow: var(--quiz-shadow);
}

#quizResults.result-active {
    animation: resultReveal 0.5s ease both, resultGlow 2.4s ease-in-out infinite alternate;
}

#quizResults h2 {
    margin-top: 0;
    font-size: 2rem;
}

#scoreText {
    margin-bottom: 0;
    color: var(--quiz-muted);
    line-height: 1.7;
}

#quizResults.perfect-score { border-color: rgba(85, 255, 176, 0.72); }
#quizResults.good-score { border-color: rgba(39, 233, 255, 0.72); }
#quizResults.low-score { border-color: rgba(255, 213, 106, 0.72); }

.continue-learning {
    padding-top: 44px;
    padding-bottom: 100px;
}

.learning-box {
    position: relative;
    overflow: hidden;
    padding: 58px 32px;
    border: 1px solid var(--quiz-border);
    border-radius: 28px;
    background:
        radial-gradient(circle at 50% 0%, rgba(39, 233, 255, 0.16), transparent 42%),
        rgba(4, 19, 36, 0.92);
    text-align: center;
    box-shadow: var(--quiz-shadow);
}

.learning-box::before {
    content: "";
    position: absolute;
    inset: -60%;
    background: conic-gradient(transparent, rgba(39, 233, 255, 0.08), transparent 35%);
    animation: learningRotate 14s linear infinite;
}

.learning-box > * {
    position: relative;
}

.learning-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 30px;
}

@keyframes quizGridMove {
    from { background-position: 0 0, 0 0; }
    to { background-position: 46px 46px, 46px 46px; }
}

@keyframes heroOrbit { to { transform: rotate(360deg); } }
@keyframes overlayPulse { 50% { opacity: 0.48; } }
@keyframes brainPulse { 50% { transform: scale(1.18); color: var(--quiz-green); } }
@keyframes statFloat { 50% { transform: translateY(-7px); } }
@keyframes cardScan { 55%, 100% { transform: translateX(120%); } }
@keyframes questionReveal { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
@keyframes topLineMove { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes feedbackReveal { from { opacity: 0; transform: translateY(-7px); } to { opacity: 1; transform: none; } }
@keyframes resultReveal { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: scale(1); } }
@keyframes resultGlow { to { box-shadow: 0 0 34px rgba(39, 233, 255, 0.24); } }
@keyframes learningRotate { to { transform: rotate(360deg); } }

@media (max-width: 780px) {
    .quiz-hero {
        min-height: 560px;
        padding-top: 90px;
    }

    .quiz-stats,
    .answer-options {
        grid-template-columns: 1fr;
    }

    .quiz-stats {
        max-width: 460px;
    }

    .question-card {
        padding: 22px;
    }
}

@media (max-width: 520px) {
    .quiz-intro,
    .quiz-section,
    .continue-learning {
        padding-left: 16px;
        padding-right: 16px;
    }

    .quiz-buttons,
    .learning-links {
        flex-direction: column;
    }

    .quiz-buttons button,
    .learning-button {
        width: 100%;
    }

    .learning-box {
        padding: 42px 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}





/* Incorrect selected answer */
.answer-option.incorrect-answer {
    border-color: #ff3b5c;
    background: rgba(255, 59, 92, 0.16);
    box-shadow:
        0 0 0 1px rgba(255, 59, 92, 0.35),
        0 0 22px rgba(255, 59, 92, 0.28);
    color: #ffffff;
}

/* Red radio marker */
.answer-option.incorrect-answer .answer-marker {
    border-color: #ff3b5c;
    background: #ff3b5c;
    box-shadow: 0 0 14px rgba(255, 59, 92, 0.8);
}

/* Add an X inside the incorrect marker */
.answer-option.incorrect-answer .answer-marker::after {
    content: "✕";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 900;
}

/* Incorrect question card */
.question-card.question-incorrect {
    border-color: rgba(255, 59, 92, 0.8);
    box-shadow:
        0 0 0 1px rgba(255, 59, 92, 0.25),
        0 0 30px rgba(255, 59, 92, 0.18);
}

/* Incorrect status label */
.question-status.incorrect-status {
    color: #ff8da1;
    border-color: rgba(255, 59, 92, 0.55);
    background: rgba(255, 59, 92, 0.14);
}

/* Incorrect answer explanation */
.question-incorrect .answer-feedback {
    border-left: 4px solid #ff3b5c;
    background: rgba(255, 59, 92, 0.1);
}




.question-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.question-number,
.question-status {
    display: inline-block;
}