* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow-x: hidden;
    background: #CF9FFF;
}

.page {
    display: none;
    min-height: 100vh;
    padding: 20px;
}

.page.active {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    background: white;
    border-radius: 30px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

/* Instructions Page */
#instructionsPage {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.header {
    text-align: center;
    margin-bottom: 30px;
}

.icon-circle {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

h1 {
    font-size: 42px;
    color: #333;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 18px;
    color: #666;
}

.intro-box {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 25px;
}

.intro-box h2 {
    font-size: 26px;
    color: #d84315;
    margin-bottom: 12px;
}

.intro-text {
    font-size: 16px;
    color: #bf360c;
    line-height: 1.7;
}

.microbe-categories {
    margin-bottom: 25px;
}

.microbe-categories h2 {
    font-size: 24px;
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.category-card {
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    border: 3px solid;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.category-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.category-card h3 {
    font-size: 20px;
    margin-bottom: 10px;
}

.category-card p {
    font-size: 14px;
    margin-bottom: 5px;
    line-height: 1.4;
}

.bacteria {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-color: #1976d2;
}

.bacteria h3 {
    color: #0d47a1;
}

.bacteria p {
    color: #1565c0;
}

.fungi {
    background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
    border-color: #7b1fa2;
}

.fungi h3 {
    color: #4a148c;
}

.fungi p {
    color: #6a1b9a;
}

.protozoa {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-color: #f57c00;
}

.protozoa h3 {
    color: #e65100;
}

.protozoa p {
    color: #ef6c00;
}

.algae {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-color: #388e3c;
}

.algae h3 {
    color: #1b5e20;
}

.algae p {
    color: #2e7d32;
}

.how-to-play {
    background: white;
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 25px;
    border: 3px solid #e0e0e0;
}

.how-to-play h2 {
    font-size: 24px;
    color: #333;
    margin-bottom: 20px;
}

.instructions-list {
    list-style: none;
}

.instructions-list li {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
}

.number {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 15px;
    flex-shrink: 0;
    font-size: 14px;
}

.tip-box {
    background: #fff3cd;
    border-left: 5px solid #ffc107;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 25px;
    color: #856404;
    line-height: 1.6;
}

.btn-primary {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 22px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.6);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #757575 0%, #424242 100%);
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 22px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-secondary:hover {
    transform: translateY(-3px);
}

/* Game Page */
#gamePage {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    display: none;
}

#gamePage.active {
    display: block !important;
}

.game-container {
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.game-header {
    background: white;
    border-radius: 20px;
    padding: 20px 30px;
    margin-bottom: 20px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mission-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 25px;
    border-radius: 25px;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge-icon {
    font-size: 24px;
}

.stats-row {
    display: flex;
    gap: 15px;
}

.stat-box {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    padding: 12px 20px;
    border-radius: 12px;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 90px;
    justify-content: center;
}

.stat-icon {
    font-size: 24px;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
}

.timer-box {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%) !important;
}

.countdown {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.score-box {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%) !important;
    color: #d84315 !important;
}

.streak-box {
    background: linear-gradient(135deg, #ff9800 0%, #ff5722 100%) !important;
}

.streak-box.hidden {
    display: none !important;
}

.progress-section {
    background: white;
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.progress-bar-container {
    height: 12px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 10px;
}

.question-card {
    background: white;
    border-radius: 25px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.microbe-display {
    text-align: center;
    margin-bottom: 30px;
}

.microbe-icon {
    font-size: 100px;
    margin-bottom: 10px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.microbe-type {
    font-size: 20px;
    font-weight: bold;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.question-content {
    text-align: center;
    margin-bottom: 30px;
}

.question-text {
    font-size: 26px;
    color: #333;
    margin-bottom: 15px;
    line-height: 1.4;
}

.question-hint {
    font-size: 16px;
    color: #999;
    font-style: italic;
}

.answer-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.answer-btn {
    background: white;
    border: 5px solid;
    border-radius: 20px;
    padding: 30px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.answer-btn:hover:not(:disabled) {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
}

.answer-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.good-btn {
    border-color: #4caf50;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
}

.good-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%);
    border-color: #2e7d32;
    color: white;
}

.bad-btn {
    border-color: #f44336;
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
}

.bad-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #f44336 0%, #ef5350 100%);
    border-color: #c62828;
    color: white;
}

.answer-icon {
    font-size: 56px;
}

.answer-text {
    font-size: 28px;
    font-weight: bold;
    color: #333;
}

.answer-desc {
    font-size: 14px;
    color: #666;
}

.answer-btn:hover:not(:disabled) .answer-text,
.answer-btn:hover:not(:disabled) .answer-desc {
    color: white;
}

.answer-btn.correct {
    background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%) !important;
    border-color: #2e7d32 !important;
    color: white !important;
    animation: correct-pulse 0.6s;
}

.answer-btn.wrong {
    background: linear-gradient(135deg, #f44336 0%, #ef5350 100%) !important;
    border-color: #c62828 !important;
    color: white !important;
    animation: wrong-shake 0.6s;
}

.answer-btn.correct .answer-text,
.answer-btn.correct .answer-desc,
.answer-btn.wrong .answer-text,
.answer-btn.wrong .answer-desc {
    color: white !important;
}

@keyframes correct-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

@keyframes wrong-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-15px); }
    75% { transform: translateX(15px); }
}

.result-display {
    text-align: center;
    padding: 30px;
    border-radius: 20px;
    margin-top: 20px;
    animation: slideUp 0.5s ease;
}

.result-display.hidden {
    display: none !important;
}

.result-display.correct-result {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border: 3px solid #4caf50;
}

.result-display.wrong-result {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    border: 3px solid #f44336;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-icon {
    font-size: 72px;
    margin-bottom: 15px;
}

.result-message {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 15px;
}

.result-display.correct-result .result-message {
    color: #2e7d32;
}

.result-display.wrong-result .result-message {
    color: #c62828;
}

.result-explanation {
    font-size: 18px;
    line-height: 1.6;
}

.result-display.correct-result .result-explanation {
    color: #1b5e20;
}

.result-display.wrong-result .result-explanation {
    color: #b71c1c;
}

/* Score Card Page */
#scoreCardPage {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    display: none;
}

#scoreCardPage.active {
    display: flex !important;
}

.final-score-display {
    text-align: center;
    margin-bottom: 30px;
}

.score-circle {
    width: 200px;
    height: 200px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.5);
    margin-bottom: 20px;
}

.final-score-value {
    font-size: 64px;
    font-weight: bold;
    color: white;
}

.score-circle .score-label {
    font-size: 16px;
    color: white;
    opacity: 0.9;
}

.score-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.score-card {
    border-radius: 20px;
    padding: 25px;
    text-align: center;
    color: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.correct-card {
    background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%);
}

.wrong-card {
    background: linear-gradient(135deg, #f44336 0%, #ef5350 100%);
}

.streak-card {
    background: linear-gradient(135deg, #ff9800 0%, #ff5722 100%);
}

.accuracy-card {
    background: linear-gradient(135deg, #2196f3 0%, #64b5f6 100%);
}

.score-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.score-value {
    font-size: 48px;
    font-weight: bold;
    margin-bottom: 8px;
}

.score-label {
    font-size: 14px;
    opacity: 0.9;
}

.learning-summary {
    background: linear-gradient(135deg, #e1bee7 0%, #f8bbd0 100%);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 25px;
}

.learning-summary h3 {
    font-size: 24px;
    color: #6a1b9a;
    margin-bottom: 15px;
}

.learning-summary ul {
    list-style: none;
    color: #4a148c;
}

.learning-summary li {
    margin-bottom: 12px;
    font-size: 16px;
    line-height: 1.5;
}

.microbe-stats {
    background: white;
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 25px;
    border: 3px solid #e0e0e0;
}

.microbe-stats h3 {
    font-size: 22px;
    color: #333;
    margin-bottom: 20px;
}

.knowledge-bars {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.knowledge-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.knowledge-label {
    font-size: 16px;
    font-weight: bold;
    color: #666;
}

.knowledge-bar {
    height: 30px;
    background: #e0e0e0;
    border-radius: 15px;
    overflow: hidden;
}

.knowledge-fill {
    height: 100%;
    width: 0%;
    transition: width 1s ease;
    border-radius: 15px;
}

.good-fill {
    background: linear-gradient(90deg, #4caf50 0%, #66bb6a 100%);
}

.bad-fill {
    background: linear-gradient(90deg, #f44336 0%, #ef5350 100%);
}

.fun-fact {
    background: linear-gradient(135deg, #b2dfdb 0%, #80cbc4 100%);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 25px;
    border-left: 5px solid #00897b;
}

.fun-fact h3 {
    font-size: 20px;
    color: #004d40;
    margin-bottom: 10px;
}

.fun-fact p {
    font-size: 16px;
    color: #00695c;
    line-height: 1.6;
}

.button-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.hidden {
    display: none !important;
}
.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;
        }


@media (max-width: 768px) {
    .categories-grid {
        grid-template-columns: 1fr;
    }
    
    .answer-section {
        grid-template-columns: 1fr;
    }
    
    .score-grid {
        grid-template-columns: 1fr;
    }
    
    .button-group {
        grid-template-columns: 1fr;
    }
    
    .stats-row {
        flex-wrap: wrap;
        justify-content: center;
    }
}