* {
    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: 1200px;
    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, #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, #a8edea 0%, #fed6e3 100%);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 25px;
}

.intro-box h2 {
    font-size: 26px;
    color: #1565c0;
    margin-bottom: 12px;
}

.intro-text {
    font-size: 16px;
    color: #0d47a1;
    line-height: 1.7;
}

.kingdoms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.kingdom-card {
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    border: 3px solid;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.kingdom-card:hover {
    transform: translateY(-5px);
}

.kingdom-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.kingdom-card h3 {
    font-size: 22px;
    margin-bottom: 12px;
}

.kingdom-details p {
    font-size: 13px;
    margin-bottom: 6px;
    line-height: 1.4;
}

.monera {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-color: #f57c00;
}

.monera h3 {
    color: #e65100;
}

.monera .kingdom-details p {
    color: #ef6c00;
}

.protista {
    background: linear-gradient(135deg, #e8eaf6 0%, #c5cae9 100%);
    border-color: #3f51b5;
}

.protista h3 {
    color: #283593;
}

.protista .kingdom-details p {
    color: #3949ab;
}

.fungi {
    background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
    border-color: #8e24aa;
}

.fungi h3 {
    color: #6a1b9a;
}

.fungi .kingdom-details p {
    color: #7b1fa2;
}

.plantae {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-color: #43a047;
}

.plantae h3 {
    color: #2e7d32;
}

.plantae .kingdom-details p {
    color: #388e3c;
}

.animalia {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    border-color: #e53935;
}

.animalia h3 {
    color: #c62828;
}

.animalia .kingdom-details p {
    color: #d32f2f;
}

.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;
}

.classification-tip {
    background: #e3f2fd;
    border-left: 5px solid #2196f3;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 25px;
    color: #0d47a1;
    line-height: 1.7;
}

.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;
    padding: 10px;
}

#gamePage.active {
    display: block !important;
}

.game-container {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.game-header {
    background: white;
    border-radius: 20px;
    padding: 20px 30px;
    margin-bottom: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.game-title {
    font-size: 28px;
    font-weight: bold;
    color: #333;
}

.stats-row {
    display: flex;
    gap: 15px;
}

.stat-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 12px 25px;
    border-radius: 12px;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.stat-icon {
    font-size: 24px;
}

.stat-value {
    font-size: 28px;
    font-weight: bold;
}

.timer-box {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%) !important;
}

.timer-box .stat-value {
    animation: timerPulse 1s infinite;
}

@keyframes timerPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.score-box {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%) !important;
    color: #d84315 !important;
}

.progress-section {
    background: white;
    border-radius: 15px;
    padding: 15px 20px;
    margin-bottom: 15px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.progress-info {
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}

.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.3s ease;
    border-radius: 10px;
}

.feedback {
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 15px;
    animation: slideDown 0.3s ease;
}

.feedback.hidden {
    display: none !important;
}

.feedback.correct {
    background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%);
    color: white;
}

.feedback.wrong {
    background: linear-gradient(135deg, #f44336 0%, #ef5350 100%);
    color: white;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.game-area {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 15px;
}

.organisms-pool {
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    max-height: 600px;
    overflow-y: auto;
}

.organisms-pool h3 {
    font-size: 18px;
    color: #333;
    margin-bottom: 15px;
    text-align: center;
}

.organisms-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.organism-item {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    padding: 12px;
    border-radius: 10px;
    border: 3px solid #ff6b6b;
    cursor: grab;
    font-weight: bold;
    color: #333;
    transition: transform 0.2s, box-shadow 0.2s;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.organism-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.organism-item:active {
    cursor: grabbing;
}

.organism-icon {
    font-size: 24px;
}

.kingdoms-area {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.drop-zone {
    background: white;
    border-radius: 15px;
    padding: 15px;
    border: 4px dashed #ccc;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    min-height: 200px;
    transition: all 0.3s;
}

.drop-zone.drag-over {
    transform: scale(1.03);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.zone-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.zone-icon {
    font-size: 28px;
}

.drop-zone h3 {
    font-size: 18px;
    margin: 0;
}

.zone-hint {
    font-size: 11px;
    color: #666;
    margin-bottom: 12px;
}

.monera-zone {
    border-color: #f57c00;
}

.monera-zone.drag-over {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-color: #e65100;
}

.monera-zone h3 {
    color: #e65100;
}

.protista-zone {
    border-color: #3f51b5;
}

.protista-zone.drag-over {
    background: linear-gradient(135deg, #e8eaf6 0%, #c5cae9 100%);
    border-color: #283593;
}

.protista-zone h3 {
    color: #283593;
}

.fungi-zone {
    border-color: #8e24aa;
}

.fungi-zone.drag-over {
    background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
    border-color: #6a1b9a;
}

.fungi-zone h3 {
    color: #6a1b9a;
}

.plantae-zone {
    border-color: #43a047;
}

.plantae-zone.drag-over {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-color: #2e7d32;
}

.plantae-zone h3 {
    color: #2e7d32;
}

.animalia-zone {
    border-color: #e53935;
}

.animalia-zone.drag-over {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    border-color: #c62828;
}

.animalia-zone h3 {
    color: #c62828;
}

.zone-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.placed-organism {
    padding: 10px;
    border-radius: 8px;
    font-weight: bold;
    color: #333;
    border: 2px solid;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.monera-zone .placed-organism {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-color: #f57c00;
}

.protista-zone .placed-organism {
    background: linear-gradient(135deg, #e8eaf6 0%, #c5cae9 100%);
    border-color: #3f51b5;
}

.fungi-zone .placed-organism {
    background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
    border-color: #8e24aa;
}

.plantae-zone .placed-organism {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-color: #43a047;
}

.animalia-zone .placed-organism {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    border-color: #e53935;
}

/* Score Card Page */
#scoreCardPage {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    display: none;
}

#scoreCardPage.active {
    display: flex !important;
}

.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%);
}

.time-card {
    background: linear-gradient(135deg, #2196f3 0%, #64b5f6 100%);
}

.accuracy-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;
}

.kingdom-breakdown {
    background: white;
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 25px;
    border: 3px solid #e0e0e0;
}

.kingdom-breakdown h3 {
    font-size: 20px;
    color: #333;
    margin-bottom: 15px;
}

.breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.breakdown-item {
    padding: 15px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    border: 2px solid;
}

.breakdown-icon {
    font-size: 32px;
}

.breakdown-name {
    font-size: 14px;
    font-weight: bold;
}

.breakdown-score {
    font-size: 20px;
    font-weight: bold;
}

.monera-bg {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-color: #f57c00;
    color: #e65100;
}

.protista-bg {
    background: linear-gradient(135deg, #e8eaf6 0%, #c5cae9 100%);
    border-color: #3f51b5;
    color: #283593;
}

.fungi-bg {
    background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
    border-color: #8e24aa;
    color: #6a1b9a;
}

.plantae-bg {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-color: #43a047;
    color: #2e7d32;
}

.animalia-bg {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    border-color: #e53935;
    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;
}

.hidden {
    display: none !important;
}

@media (max-width: 1200px) {
    .game-area {
        grid-template-columns: 1fr;
    }
    
    .organisms-pool {
        max-height: none;
    }
    
    .kingdoms-area {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}
.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) {
    .kingdoms-grid {
        grid-template-columns: 1fr;
    }
    
    .score-grid {
        grid-template-columns: 1fr;
    }
    
    .button-group {
        grid-template-columns: 1fr;
    }
    
    .breakdown-grid {
        grid-template-columns: 1fr;
    }
}