* {
    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: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 30px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

#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;
}

.hierarchy-example {
    background: white;
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 25px;
    border: 3px solid #e0e0e0;
}

.hierarchy-example h2 {
    font-size: 24px;
    color: #333;
    margin-bottom: 10px;
    text-align: center;
}

.example-intro {
    text-align: center;
    color: #666;
    margin-bottom: 20px;
    font-style: italic;
}

.hierarchy-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.level-block {
    width: 100%;
    max-width: 400px;
    padding: 15px;
    border-radius: 12px;
    border: 3px solid;
    text-align: center;
    transition: transform 0.2s;
}

.level-block:hover {
    transform: scale(1.02);
}

.level-number {
    font-size: 14px;
    font-weight: bold;
    opacity: 0.7;
    margin-bottom: 5px;
}

.level-name {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 5px;
}

.level-example {
    font-size: 16px;
    font-style: italic;
    margin-bottom: 5px;
}

.level-desc {
    font-size: 13px;
    opacity: 0.8;
}

.arrow {
    font-size: 24px;
    color: #666;
}

.kingdom-block {
    background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
    border-color: #0d47a1;
    color: white;
}

.phylum-block {
    background: linear-gradient(135deg, #4a148c 0%, #6a1b9a 100%);
    border-color: #7b1fa2;
    color: white;
}

.class-block {
    background: linear-gradient(135deg, #0d47a1 0%, #1976d2 100%);
    border-color: #2196f3;
    color: white;
}

.order-block {
    background: linear-gradient(135deg, #00695c 0%, #00897b 100%);
    border-color: #26a69a;
    color: white;
}

.family-block {
    background: linear-gradient(135deg, #f57c00 0%, #fb8c00 100%);
    border-color: #ff9800;
    color: white;
}

.genus-block {
    background: linear-gradient(135deg, #c62828 0%, #d32f2f 100%);
    border-color: #e53935;
    color: white;
}

.species-block {
    background: linear-gradient(135deg, #6a1b9a 0%, #8e24aa 100%);
    border-color: #9c27b0;
    color: white;
}

.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;
}

.organism-modes {
    text-align: center;
}

.organism-modes h3 {
    font-size: 20px;
    color: #333;
    margin-bottom: 15px;
}

.mode-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.mode-btn {
    padding: 20px;
    border: 4px solid;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: bold;
}

.mode-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.lion-btn {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-color: #f57c00;
    color: #e65100;
}

.mango-btn {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-color: #43a047;
    color: #2e7d32;
}

.mode-icon {
    font-size: 48px;
}

.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);
}

#gamePage {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    display: none;
    padding: 10px;
}

#gamePage.active {
    display: block !important;
}

.game-container {
    max-width: 1300px;
    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;
}

.organism-badge {
    display: flex;
    align-items: center;
    gap: 15px;
}

.organism-icon {
    font-size: 48px;
}

.organism-name {
    font-size: 24px;
    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;
}

.feedback.collapse {
    background: linear-gradient(135deg, #ff5722 0%, #ff7043 100%);
    color: white;
    animation: shake 0.5s;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-15px); }
    75% { transform: translateX(15px); }
}

.game-area {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 15px;
}

.blocks-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;
}

.blocks-pool h3 {
    font-size: 18px;
    color: #333;
    margin-bottom: 15px;
    text-align: center;
}

.blocks-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.taxon-block {
    padding: 15px;
    border-radius: 12px;
    border: 3px solid;
    cursor: grab;
    transition: transform 0.2s, box-shadow 0.2s;
    user-select: none;
}

.taxon-block:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.taxon-block:active {
    cursor: grabbing;
}

.block-rank {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 5px;
}

.block-example {
    font-size: 15px;
    font-style: italic;
    margin-bottom: 5px;
}

.block-desc {
    font-size: 13px;
    opacity: 0.9;
}

.tower-area {
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.tower-area h3 {
    font-size: 18px;
    color: #333;
    margin-bottom: 15px;
    text-align: center;
}

.tower-container {
    min-height: 500px;
    border: 4px dashed #ccc;
    border-radius: 15px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tower-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    font-size: 16px;
    font-style: italic;
}

.tower-container.drag-over {
    border-color: #667eea;
    background: #f0f4ff;
}

.placed-block {
    padding: 15px;
    border-radius: 12px;
    border: 3px solid;
    animation: placeBlock 0.3s ease;
}

@keyframes placeBlock {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

#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%);
}

.status-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;
}

.tower-review {
    background: white;
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 25px;
    border: 3px solid #e0e0e0;
}

.tower-review h3 {
    font-size: 22px;
    color: #333;
    margin-bottom: 15px;
}

.tower-review-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.review-block {
    padding: 12px;
    border-radius: 10px;
    border: 2px solid;
    display: flex;
    align-items: center;
    gap: 10px;
}

.review-number {
    font-size: 20px;
    font-weight: bold;
}

.review-content {
    flex: 1;
}

.review-rank {
    font-size: 16px;
    font-weight: bold;
}

.review-example {
    font-size: 14px;
    font-style: italic;
    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: 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;
    }
}

@media (max-width: 768px) {
    .mode-buttons {
        grid-template-columns: 1fr;
    }
    
    .score-grid {
        grid-template-columns: 1fr;
    }
    
    .button-group {
        grid-template-columns: 1fr;
    }
}
/* ADD THESE NEW STYLES TO YOUR EXISTING CSS */

.lives-box {
    background: linear-gradient(135deg, #e91e63 0%, #f06292 100%) !important;
}

.check-button-container {
    text-align: center;
    margin-bottom: 20px;
}

.check-tower-btn {
    padding: 18px 50px;
    background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%);
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 5px 20px rgba(76, 175, 80, 0.4);
}

.check-tower-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.6);
}

.check-tower-btn:disabled {
    background: #bdbdbd;
    cursor: not-allowed;
    box-shadow: none;
}

.tower-slot {
    min-height: 70px;
    border: 3px dashed #ccc;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-style: italic;
    transition: all 0.3s;
}

.tower-slot.drag-over {
    border-color: #667eea;
    background: #f0f4ff;
}

.tower-slot.filled {
    border-style: solid;
}
.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;
        }


.placed-block.correct-highlight {
    border: 4px solid #4caf50 !important;
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.6);
    animation: correctGlow 1s;
}

.placed-block.wrong-highlight {
    opacity: 0.4;
    border: 4px solid #f44336 !important;
    animation: wrongShake 0.5s;
}

@keyframes correctGlow {
    0%, 100% { box-shadow: 0 0 20px rgba(76, 175, 80, 0.6); }
    50% { box-shadow: 0 0 40px rgba(76, 175, 80, 1); }
}

.accuracy-card {
    background: linear-gradient(135deg, #9c27b0 0%, #ba68c8 100%);
}