* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    background: #CF9FFF;
    overflow: hidden;
}

.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
}

.screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

/* Welcome Screen */
.welcome-card {
    background: white;
    border-radius: 25px;
    padding: 40px 35px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-height: 90vh;
    overflow-y: auto;
}

.leaf-icon {
    font-size: 80px;
    animation: sway 3s ease-in-out infinite;
    margin-bottom: 15px;
}

@keyframes sway {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

.main-title {
    font-size: 2.5rem;
    color: #15803d;
    margin-bottom: 10px;
    font-weight: 800;
}

.subtitle {
    font-size: 1.2rem;
    color: #4b5563;
    margin-bottom: 25px;
}

.instructions-box {
    background: #f0fdf4;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    text-align: left;
}

.instructions-title {
    font-size: 1.6rem;
    color: #15803d;
    margin-bottom: 15px;
    font-weight: 700;
}

.instructions-list {
    list-style: none;
    margin-bottom: 20px;
}

.instructions-list li {
    font-size: 1rem;
    color: #374151;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.icon {
    font-size: 1.5rem;
}

.formula-box {
    background: #dbeafe;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
}

.formula-box h3 {
    color: #1e40af;
    font-size: 1.3rem;
    margin-bottom: 12px;
    text-align: center;
}

.formula {
    background: white;
    padding: 15px;
    border-radius: 10px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.ingredient {
    background: #fef3c7;
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 700;
    color: #92400e;
}

.product {
    background: #d1fae5;
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 700;
    color: #065f46;
}

.arrow {
    font-size: 1.5rem;
    color: #7c3aed;
    font-weight: 800;
}

.formula-text {
    text-align: center;
    color: #6b7280;
    font-size: 0.95rem;
    font-style: italic;
}

.scoring-info {
    background: #fef3c7;
    border-radius: 12px;
    padding: 20px;
}

.scoring-info h3 {
    color: #92400e;
    font-size: 1.3rem;
    margin-bottom: 12px;
}

.score-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.score-item-info {
    background: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #374151;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.score-item-info.penalty {
    background: #fee2e2;
    color: #991b1b;
}

.score-item-info span {
    font-weight: 700;
    color: #059669;
}

.score-item-info.penalty span {
    color: #dc2626;
}

.bonus-text {
    color: #1e40af;
    font-weight: 600;
    text-align: center;
    margin-top: 8px;
    font-size: 1rem;
}

.btn-start {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    font-size: 1.6rem;
    font-weight: 700;
    padding: 18px 50px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.4);
    transition: all 0.3s ease;
}

.btn-start:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 40px rgba(16, 185, 129, 0.6);
}

/* Game Screen */
.game-wrapper {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

.game-header {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 15px;
}

.stat-box {
    background: white;
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    flex: 1;
    text-align: center;
}

.stat-label {
    font-size: 0.9rem;
    color: #6b7280;
    font-weight: 600;
    display: block;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.8rem;
    color: #15803d;
    font-weight: 800;
}

.timer-box .stat-value {
    color: #dc2626;
}

.collected-items {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 15px;
    background: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.collection-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
}

.item-icon {
    font-size: 1.8rem;
}

.item-label {
    color: #6b7280;
    font-weight: 600;
}

.item-count {
    color: #15803d;
    font-weight: 800;
    font-size: 1.3rem;
}

.game-canvas {
    background: linear-gradient(180deg, #bfdbfe 0%, #86efac 100%);
    height: 500px;
    border-radius: 15px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    border: 5px solid #15803d;
    cursor: none;
}

.leaf {
    position: absolute;
    font-size: 60px;
    z-index: 100;
    transition: all 0.1s ease;
    filter: drop-shadow(0 0 10px rgba(22, 163, 74, 0.6));
    cursor: grab;
}

.leaf.dragging {
    cursor: grabbing;
    transform: scale(1.1);
}

.falling-item {
    position: absolute;
    font-size: 40px;
    z-index: 50;
    animation: fall linear;
    cursor: pointer;
}

@keyframes fall {
    from {
        top: -50px;
    }
    to {
        top: 550px;
    }
}

.obstacle {
    position: absolute;
    font-size: 35px;
    z-index: 50;
    animation: fall linear;
}

.controls-info {
    margin-top: 15px;
    text-align: center;
    background: white;
    padding: 12px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.controls-info p {
    color: #374151;
    font-weight: 600;
    font-size: 1rem;
}

.set-complete-animation {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 4rem;
    z-index: 200;
    animation: popAndFade 1s ease-out forwards;
}

@keyframes popAndFade {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0;
    }
}

/* Results Screen */
.results-card {
    background: white;
    border-radius: 25px;
    padding: 40px 35px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-height: 90vh;
    overflow-y: auto;
}

.result-icon {
    font-size: 100px;
    margin-bottom: 15px;
    animation: bounce 1s ease infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.result-title {
    font-size: 3rem;
    color: #15803d;
    margin-bottom: 10px;
    font-weight: 800;
}

.result-message {
    font-size: 1.2rem;
    color: #6b7280;
    margin-bottom: 25px;
}

.final-score-box {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 25px;
}

.final-score-label {
    font-size: 1.3rem;
    color: #92400e;
    font-weight: 600;
    margin-bottom: 10px;
}

.final-score {
    font-size: 4rem;
    font-weight: 800;
    color: #78350f;
}

.stats-breakdown {
    background: #f0fdf4;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
}

.breakdown-title {
    font-size: 1.4rem;
    color: #15803d;
    margin-bottom: 15px;
    font-weight: 700;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
    color: #374151;
    margin-bottom: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #e5e7eb;
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-highlight {
    font-weight: 700;
    color: #15803d;
}

.learning-box {
    background: #dbeafe;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    text-align: left;
}

.learning-box h3 {
    color: #1e40af;
    font-size: 1.4rem;
    margin-bottom: 12px;
}

.learning-box p {
    color: #374151;
    font-size: 1.05rem;
    line-height: 1.7;
}

.results-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn-play-again, .btn-exit {
    font-size: 1.3rem;
    font-weight: 700;
    padding: 15px 35px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
}
.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;
        }


.btn-play-again {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.btn-play-again:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 35px rgba(16, 185, 129, 0.6);
}

.btn-exit {
    background: linear-gradient(135deg, #6b7280, #4b5563);
    color: white;
    box-shadow: 0 8px 25px rgba(107, 114, 128, 0.4);
}

.btn-exit:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 35px rgba(107, 114, 128, 0.6);
}

/* Responsive */
@media (max-width: 768px) {
    .main-title {
        font-size: 2rem;
    }
    
    .game-canvas {
        height: 400px;
    }
    
    .collected-items {
        flex-direction: column;
        gap: 10px;
    }
    
    .results-buttons {
        flex-direction: column;
    }
    
    .btn-play-again, .btn-exit {
        width: 100%;
    }
    
    .formula {
        font-size: 0.9rem;
    }
}