* {
    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;
}

.container {
    width: 100%;
    max-width: 1200px;
}

.page {
    display: none;
    animation: fadeIn 0.5s ease-in;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

h1 {
    color: #667eea;
    text-align: center;
    margin-bottom: 10px;
    font-size: 2.8em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    text-align: center;
    color: #764ba2;
    font-size: 1.2em;
    margin-bottom: 25px;
    font-style: italic;
}

.topic-info {
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 25px;
}

.topic-info h3 {
    color: white;
    font-size: 1.3em;
}

.instructions {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    border-left: 5px solid #667eea;
}

.instructions h2 {
    color: #667eea;
    margin-bottom: 20px;
}

.instructions ul {
    list-style-position: inside;
    line-height: 2;
}

.instructions li {
    margin-bottom: 12px;
    font-size: 1.05em;
    color: #555;
}

.sub-list {
    margin-left: 30px;
    margin-top: 10px;
    font-size: 0.95em;
}

.green-text {
    color: #28a745;
    font-weight: bold;
}

.red-text {
    color: #dc3545;
    font-weight: bold;
}

.tip-box {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    padding: 15px;
    border-radius: 10px;
    margin-top: 20px;
    border-left: 4px solid #ffc107;
    color: #856404;
}

.btn {
    padding: 15px 40px;
    font-size: 1.2em;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    display: block;
    margin: 0 auto;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
}

.btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Game Page Styles */
.game-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
    border: 2px solid #667eea;
}

.level-info h2 {
    color: #667eea;
    margin-bottom: 10px;
}

.level-info p {
    color: #6c757d;
    font-size: 1.1em;
}

.score-display {
    display: flex;
    gap: 30px;
    margin-top: 15px;
    justify-content: center;
}

.score-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2em;
}

.score-item .label {
    color: #6c757d;
    font-weight: 500;
}

.score-item .value {
    color: #667eea;
    font-weight: bold;
    font-size: 1.3em;
}

.game-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.organisms-section h3,
.categories-section h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.organisms-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    min-height: 150px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px dashed #dee2e6;
}

.organism-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    border: 2px solid #dee2e6;
    cursor: move;
    transition: all 0.3s ease;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.organism-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border-color: #667eea;
}

.organism-card.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}

.organism-card .icon {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.organism-card .name {
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.organism-card .traits {
    font-size: 0.9em;
    color: #6c757d;
    line-height: 1.5;
}

.categories-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.category-box {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 3px dashed #667eea;
    border-radius: 15px;
    padding: 20px;
    min-height: 200px;
    transition: all 0.3s ease;
}

.category-box.drag-over {
    background: linear-gradient(135deg, #e7f1ff 0%, #c3e0ff 100%);
    border-color: #007bff;
    transform: scale(1.02);
}

.category-box .category-header {
    text-align: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid #667eea;
}

.category-box .category-name {
    font-size: 1.3em;
    font-weight: bold;
    color: #667eea;
}

.category-box .category-description {
    font-size: 0.9em;
    color: #6c757d;
    margin-top: 5px;
}

.category-box .dropped-organisms {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dropped-organism {
    background: white;
    padding: 12px;
    border-radius: 8px;
    border: 2px solid #dee2e6;
    font-size: 0.95em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dropped-organism.correct {
    border-color: #28a745;
    background: #d4edda;
    animation: correctPulse 0.5s ease;
}

.dropped-organism.wrong {
    border-color: #dc3545;
    background: #f8d7da;
    animation: wrongShake 0.5s ease;
}

.dropped-organism .organism-name {
    font-weight: 600;
    color: #333;
}

.dropped-organism .feedback-icon {
    font-size: 1.2em;
    font-weight: bold;
}

@keyframes correctPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes wrongShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.game-controls {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.game-controls .btn {
    margin: 0;
    flex: 1;
    max-width: 250px;
}

/* Result Page Styles */
.score-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 40px;
    border-radius: 20px;
    margin-bottom: 30px;
    border: 3px solid #667eea;
}

.score-card h2 {
    text-align: center;
    color: #667eea;
    margin-bottom: 30px;
}

.final-score-big {
    text-align: center;
    font-size: 5em;
    font-weight: bold;
    color: #667eea;
    margin: 20px 0;
}

.final-score-big .total {
    font-size: 0.6em;
    color: #764ba2;
}

.percentage {
    text-align: center;
    font-size: 2.5em;
    color: #764ba2;
    margin-bottom: 30px;
    font-weight: 600;
}

.grade-display {
    text-align: center;
    margin: 30px 0;
}

.grade-label {
    font-size: 1.3em;
    color: #6c757d;
    margin-bottom: 10px;
}

.grade-value {
    font-size: 4em;
    font-weight: bold;
    color: #667eea;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.level-breakdown {
    margin: 30px 0;
    padding: 25px;
    background: white;
    border-radius: 12px;
}

.level-breakdown h3 {
    color: #667eea;
    margin-bottom: 20px;
    text-align: center;
}

.level-scores {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.level-score-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 1.1em;
}

.level-name {
    color: #6c757d;
    font-weight: 600;
}

.level-score {
    color: #667eea;
    font-weight: bold;
}

.performance-message {
    text-align: center;
    font-size: 1.3em;
    color: #555;
    margin-top: 30px;
    line-height: 1.6;
    font-weight: 500;
}

.button-group {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.button-group .btn {
    margin: 0;
    flex: 1;
    max-width: 250px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .card {
        padding: 25px;
    }

    h1 {
        font-size: 2em;
    }

    .organisms-container {
        grid-template-columns: 1fr;
    }

    .categories-container {
        grid-template-columns: 1fr;
    }

    .score-display {
        flex-direction: column;
        gap: 15px;
    }

    .game-controls {
        flex-direction: column;
    }

    .game-controls .btn {
        max-width: 100%;
    }

    .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;
        }


    .button-group {
        flex-direction: column;
    }

    .button-group .btn {
        max-width: 100%;
    }

    .final-score-big {
        font-size: 3.5em;
    }

    .level-scores {
        gap: 10px;
    }
}