* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #CF9FFF;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

/* Animated Background Particles */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.particle {
    position: absolute;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: float 15s infinite;
}

.particle:nth-child(1) {
    width: 80px;
    height: 80px;
    left: 10%;
    animation-delay: 0s;
    animation-duration: 12s;
}

.particle:nth-child(2) {
    width: 60px;
    height: 60px;
    left: 30%;
    animation-delay: 2s;
    animation-duration: 15s;
}

.particle:nth-child(3) {
    width: 100px;
    height: 100px;
    left: 50%;
    animation-delay: 4s;
    animation-duration: 18s;
}

.particle:nth-child(4) {
    width: 70px;
    height: 70px;
    left: 70%;
    animation-delay: 1s;
    animation-duration: 14s;
}

.particle:nth-child(5) {
    width: 90px;
    height: 90px;
    left: 85%;
    animation-delay: 3s;
    animation-duration: 16s;
}

.particle:nth-child(6) {
    width: 50px;
    height: 50px;
    left: 20%;
    animation-delay: 5s;
    animation-duration: 13s;
}

.particle:nth-child(7) {
    width: 65px;
    height: 65px;
    left: 65%;
    animation-delay: 2.5s;
    animation-duration: 17s;
}

.particle:nth-child(8) {
    width: 75px;
    height: 75px;
    left: 90%;
    animation-delay: 4.5s;
    animation-duration: 14s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.7;
    }
    90% {
        opacity: 0.7;
    }
    100% {
        transform: translateY(-100px) rotate(360deg);
        opacity: 0;
    }
}

.container {
    width: 100%;
    max-width: 900px;
    position: relative;
    z-index: 10;
}

.page {
    display: none;
    animation: fadeInUp 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.page.active {
    display: block;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 30px;
    padding: 50px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.4), 0 0 60px rgba(126, 34, 206, 0.3);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

/* Icon Header */
.icon-header {
    text-align: center;
    margin-bottom: 20px;
}

.icon-large {
    font-size: 5em;
    display: inline-block;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

h1 {
    text-align: center;
    margin-bottom: 10px;
    font-size: 2.8em;
    font-weight: 800;
}

.gradient-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { filter: hue-rotate(0deg); }
    50% { filter: hue-rotate(20deg); }
}

.subtitle {
    text-align: center;
    font-size: 1.2em;
    color: #666;
    margin-bottom: 30px;
    font-style: italic;
}

/* Instructions */
.instructions {
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf3 100%);
    padding: 35px;
    border-radius: 20px;
    margin-bottom: 35px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05);
}

.instructions h2 {
    color: #2d3748;
    margin-bottom: 25px;
    font-size: 1.6em;
}

.instruction-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.instruction-item {
    background: white;
    padding: 20px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.instruction-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.inst-icon {
    font-size: 2em;
    flex-shrink: 0;
}

.instruction-item p {
    margin: 0;
    color: #555;
    line-height: 1.5;
}

.green-text {
    color: #10b981;
    font-weight: bold;
}

.red-text {
    color: #ef4444;
    font-weight: bold;
}

/* Buttons */
.btn {
    padding: 18px 45px;
    font-size: 1.2em;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    display: block;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.btn span {
    position: relative;
    z-index: 2;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.btn:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Quiz Header */
.quiz-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 25px;
    gap: 20px;
}

.header-item {
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf3 100%);
    padding: 20px 30px;
    border-radius: 15px;
    flex: 1;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.label {
    display: block;
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
    font-weight: 600;
}

.value {
    display: block;
    font-size: 1.8em;
    font-weight: bold;
    color: #667eea;
}

.score-value {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 15px;
    background: #e2e8f0;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 35px;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    transition: width 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    width: 0%;
    position: relative;
    overflow: hidden;
}

.progress-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shine 2s infinite;
}

@keyframes shine {
    to { left: 100%; }
}

/* Question Container */
.question-container {
    margin-bottom: 30px;
    min-height: 400px;
}

.question-icon {
    text-align: center;
    font-size: 3em;
    margin-bottom: 20px;
    animation: rotateIcon 0.6s ease;
}

@keyframes rotateIcon {
    from { transform: rotate(-180deg) scale(0); }
    to { transform: rotate(0deg) scale(1); }
}

#questionText {
    font-size: 1.5em;
    color: #2d3748;
    margin-bottom: 35px;
    line-height: 1.6;
    text-align: center;
    font-weight: 600;
}

.options-container {
    display: grid;
    gap: 18px;
}

.option {
    padding: 22px 25px;
    background: linear-gradient(135deg, #ffffff 0%, #f7fafc 100%);
    border: 3px solid #e2e8f0;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    font-size: 1.15em;
    font-weight: 500;
    color: #2d3748;
    position: relative;
    overflow: hidden;
}

.option::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 5px;
    background: #667eea;
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.option:hover {
    border-color: #667eea;
    transform: translateX(10px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.2);
}

.option:hover::before {
    transform: scaleY(1);
}

.option.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    transform: scale(1.02);
}

.option.correct {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%) !important;
    border-color: #10b981 !important;
    animation: correctBounce 0.6s ease;
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
}

.option.correct::before {
    background: #10b981;
    transform: scaleY(1);
}

.option.wrong {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%) !important;
    border-color: #ef4444 !important;
    animation: wrongShake 0.6s ease;
    box-shadow: 0 10px 25px rgba(239, 68, 68, 0.3);
}

.option.wrong::before {
    background: #ef4444;
    transform: scaleY(1);
}

.option.disabled {
    cursor: not-allowed;
    opacity: 0.8;
}

@keyframes correctBounce {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.05); }
    75% { transform: scale(0.98); }
}

@keyframes wrongShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

/* Feedback Message */
.feedback-message {
    text-align: center;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 1.1em;
    font-weight: 600;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

/* Result Page */
.result-card {
    position: relative;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
}

.result-header {
    text-align: center;
    margin-bottom: 40px;
}

.trophy-icon {
    font-size: 6em;
    display: inline-block;
    animation: trophyFloat 2s ease-in-out infinite;
}

@keyframes trophyFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-15px) rotate(10deg); }
}

.score-card {
    text-align: center;
    margin-bottom: 40px;
}

.score-circle {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto 40px;
}

.circular-progress {
    transform: rotate(-90deg);
}

.bg-circle {
    fill: none;
    stroke: #e2e8f0;
    stroke-width: 12;
}

.progress-circle {
    fill: none;
    stroke: url(#gradient);
    stroke-width: 12;
    stroke-linecap: round;
    stroke-dasharray: 565.48;
    stroke-dashoffset: 565.48;
    transition: stroke-dashoffset 2s ease-out;
}

.score-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.final-score {
    font-size: 3.5em;
    font-weight: bold;
    color: #667eea;
    line-height: 1;
}

.final-score .total {
    font-size: 0.6em;
    color: #999;
}

.percentage {
    font-size: 1.8em;
    color: #764ba2;
    font-weight: 600;
}

.grade-display {
    margin-bottom: 30px;
}

.grade-badge {
    display: inline-block;
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
    animation: gradeBounce 1s ease infinite;
}

@keyframes gradeBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.grade-badge span {
    font-size: 3em;
    font-weight: bold;
    color: white;
}

.performance-message {
    font-size: 1.4em;
    color: #555;
    font-style: italic;
    margin: 20px 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 30px;
}

.stat-item {
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf3 100%);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    font-size: 2em;
    display: block;
    margin-bottom: 10px;
}

.stat-label {
    display: block;
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 1.8em;
    font-weight: bold;
    color: #667eea;
}

.button-group {
    display: flex;
    gap: 20px;
    margin-top: 30px;
}

.button-group .btn {
    flex: 1;
    margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .card {
        padding: 30px 25px;
    }

    h1 {
        font-size: 2em;
    }

    .instruction-grid {
        grid-template-columns: 1fr;
    }

    .quiz-header {
        flex-direction: column;
    }
    .homeBtn {
        position: fixed;   /* stays at top-left even on scroll */
        top: 10px;         /* distance from top */
        left: 10px;        /* distance from left */
        z-index: 1000;     /* stays above other elements */
        }

        .homeBtn button {
        background: none;
        border: none;
        cursor: pointer;
        padding: 0;
        }

        #imgbtn {
        width: 100px;       /* adjust size if needed */
        height: auto;
        }


    .stats-grid {
        grid-template-columns: 1fr;
    }

    .button-group {
        flex-direction: column;
    }

    .icon-large {
        font-size: 3.5em;
    }

    .final-score {
        font-size: 2.5em;
    }
}