* {
    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: 1000px;
    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, #4facfe 0%, #00f2fe 100%);
}

.header {
    text-align: center;
    margin-bottom: 30px;
}

.icon-circle {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 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, #e0f7fa 0%, #b2ebf2 100%);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 25px;
}

.intro-box h2 {
    font-size: 26px;
    color: #00695c;
    margin-bottom: 12px;
}

.intro-text {
    font-size: 16px;
    color: #004d40;
    line-height: 1.7;
}

.linnaeus-info {
    margin-bottom: 25px;
}

.scientist-card {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-radius: 20px;
    padding: 25px;
    text-align: center;
    border: 3px solid #f57c00;
}

.scientist-image {
    font-size: 72px;
    margin-bottom: 10px;
}

.scientist-card h3 {
    font-size: 28px;
    color: #e65100;
    margin-bottom: 5px;
}

.scientist-title {
    font-size: 16px;
    color: #ef6c00;
    font-weight: bold;
    margin-bottom: 10px;
}

.scientist-card p {
    font-size: 15px;
    color: #f57c00;
}

.rules-section {
    margin-bottom: 25px;
}

.rules-section h2 {
    font-size: 24px;
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}

.rules-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.rule-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    border: 3px solid #e0e0e0;
    transition: transform 0.2s;
}

.rule-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.rule-icon {
    font-size: 36px;
    margin-bottom: 10px;
}

.rule-card h3 {
    font-size: 18px;
    color: #1976d2;
    margin-bottom: 10px;
}

.rule-card p {
    font-size: 14px;
    color: #555;
    margin-bottom: 8px;
    line-height: 1.5;
}

.example {
    font-size: 13px;
    color: #2196f3;
    font-style: italic;
    margin-top: 8px;
}

.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, #667eea 0%, #764ba2 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;
}

.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-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, #a8edea 0%, #fed6e3 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;
}

.lab-badge {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 12px 25px;
    border-radius: 25px;
    font-size: 20px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge-icon {
    font-size: 28px;
}

.stats-row {
    display: flex;
    gap: 15px;
}

.stat-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 10px 20px;
    border-radius: 12px;
    color: white;
    text-align: center;
}

.stat-label {
    font-size: 12px;
    opacity: 0.9;
    display: block;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 22px;
    font-weight: bold;
}

.question-box {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%) !important;
}

.score-box {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%) !important;
    color: #d84315 !important;
}

.progress-section {
    background: white;
    border-radius: 15px;
    padding: 10px;
    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;
}

.organism-card {
    background: white;
    border-radius: 25px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.organism-display {
    text-align: center;
    margin-bottom: 30px;
}

.organism-icon {
    font-size: 100px;
    margin-bottom: 15px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.organism-name {
    font-size: 32px;
    color: #333;
    margin-bottom: 10px;
}

.organism-common {
    font-size: 16px;
    color: #999;
    font-style: italic;
}

.question-section {
    margin-bottom: 20px;
}

.question-title {
    font-size: 24px;
    color: #333;
    text-align: center;
    margin-bottom: 10px;
}

.question-hint {
    font-size: 14px;
    color: #666;
    text-align: center;
    margin-bottom: 25px;
    font-style: italic;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.option-btn {
    background: white;
    border: 4px solid #e0e0e0;
    border-radius: 15px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 18px;
}

.option-btn:hover:not(:disabled) {
    transform: translateX(10px);
    border-color: #4facfe;
    box-shadow: 0 5px 20px rgba(79, 172, 254, 0.3);
}

.option-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.option-letter {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    flex-shrink: 0;
}

.option-text {
    flex: 1;
    color: #333;
    font-weight: 500;
}

.option-btn.correct {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-color: #4caf50;
    animation: correctPulse 0.6s;
}

.option-btn.correct .option-letter {
    background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%);
}

.option-btn.wrong {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    border-color: #f44336;
    animation: wrongShake 0.6s;
}

.option-btn.wrong .option-letter {
    background: linear-gradient(135deg, #f44336 0%, #ef5350 100%);
}

@keyframes correctPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

@keyframes wrongShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.result-display {
    margin-top: 30px;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    animation: slideUp 0.5s ease;
}

.result-display.hidden {
    display: none !important;
}

.result-display.correct-result {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border: 4px solid #4caf50;
}

.result-display.wrong-result {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    border: 4px 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;
    margin-bottom: 20px;
}

.result-display.correct-result .result-explanation {
    color: #1b5e20;
}

.result-display.wrong-result .result-explanation {
    color: #b71c1c;
}

.next-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 25px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.next-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

/* Score Card Page */
#scoreCardPage {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    display: none;
}

#scoreCardPage.active {
    display: flex !important;
}

.taxonomist-badge {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    border: 5px solid #ff6b35;
    border-radius: 25px;
    padding: 30px;
    text-align: center;
    margin-bottom: 30px;
    position: relative;
    animation: badgeAppear 1s ease;
    box-shadow: 0 10px 40px rgba(255, 107, 53, 0.5);
}

.taxonomist-badge.hidden {
    display: none !important;
}

@keyframes badgeAppear {
    0% {
        opacity: 0;
        transform: scale(0.5) rotate(-10deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.badge-shine {
    display: inline-block;
    font-size: 48px;
    animation: shine 2s infinite;
}

@keyframes shine {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

.badge-medal {
    font-size: 80px;
    margin: 10px 0;
}

.taxonomist-badge h2 {
    font-size: 32px;
    color: #d84315;
    margin-bottom: 10px;
}

.taxonomist-badge p {
    font-size: 18px;
    color: #bf360c;
}

.final-score-display {
    text-align: center;
    margin-bottom: 30px;
}

.score-circle {
    width: 180px;
    height: 180px;
    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);
}

.final-score-value {
    font-size: 60px;
    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: 15px;
    margin-bottom: 25px;
}

.score-card {
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    color: white;
    box-shadow: 0 8px 25px 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%);
}

.accuracy-card {
    background: linear-gradient(135deg, #2196f3 0%, #64b5f6 100%);
}

.mastery-card {
    background: linear-gradient(135deg, #ff9800 0%, #ffb74d 100%);
}

.score-icon {
    font-size: 40px;
    margin-bottom: 8px;
}

.score-value {
    font-size: 40px;
    font-weight: bold;
    margin-bottom: 6px;
}

.score-label {
    font-size: 13px;
    opacity: 0.9;
}

.organisms-review {
    background: white;
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 25px;
    border: 3px solid #e0e0e0;
}

.organisms-review h3 {
    font-size: 22px;
    color: #333;
    margin-bottom: 15px;
}

.review-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.review-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border-radius: 10px;
    border: 2px solid;
}

.review-item.correct {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-color: #4caf50;
}

.review-item.wrong {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    border-color: #f44336;
}

.review-icon {
    font-size: 32px;
}

.review-status {
    font-size: 28px;
}

.review-details {
    flex: 1;
}

.review-name {
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

.review-scientific {
    font-size: 15px;
    font-style: italic;
    margin-top: 5px;
}

.review-item.correct .review-scientific {
    color: #2e7d32;
}

.review-item.wrong .review-scientific {
    color: #c62828;
}

.learning-summary {
    background: linear-gradient(135deg, #e1bee7 0%, #f8bbd0 100%);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 25px;
}

.learning-summary h3 {
    font-size: 22px;
    color: #6a1b9a;
    margin-bottom: 15px;
}

.learning-summary ul {
    list-style: none;
    color: #4a148c;
}

.learning-summary li {
    margin-bottom: 10px;
    font-size: 15px;
    line-height: 1.5;
}

.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;
}

.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;
        }

.hidden {
    display: none !important;
}

@media (max-width: 768px) {
    .rules-grid {
        grid-template-columns: 1fr;
    }
    
    .score-grid {
        grid-template-columns: 1fr;
    }
    
    .button-group {
        grid-template-columns: 1fr;
    }
}