* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow-x: hidden;
}

.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;
        }


.page {
    display: none;
    min-height: 100vh;
    padding: 20px;
    align-items: center;
    justify-content: center;
}

.page.active {
    display: flex;
}

/* Instructions Page */
#instructionsPage {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

#instructionsPage .container {
    background: white;
    border-radius: 30px;
    padding: 50px;
    max-width: 800px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.header {
    text-align: center;
    margin-bottom: 30px;
}

.icon-circle {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 50px;
    margin-bottom: 20px;
}

h1 {
    font-size: 42px;
    color: #333;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 18px;
    color: #666;
}

.instructions-box {
    background: linear-gradient(135deg, #e0f7fa 0%, #e1bee7 100%);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
}

.instructions-box h2 {
    font-size: 28px;
    color: #333;
    margin-bottom: 20px;
}

.instructions-list {
    list-style: none;
}

.instructions-list li {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
}

.number {
    background: #667eea;
    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;
}

.learning-goals {
    background: #fff3cd;
    border-left: 5px solid #ffc107;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.learning-goals h3 {
    color: #856404;
    margin-bottom: 10px;
}

.learning-goals ul {
    list-style: none;
    color: #856404;
}

.learning-goals li {
    margin-bottom: 8px;
}

.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;
}

.btn-primary:hover {
    transform: scale(1.05);
}

.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: scale(1.05);
}

/* Game Page */
#gamePage {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.game-container {
    width: 100%;
    max-width: 1400px;
}

.game-header {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.level-info h2 {
    font-size: 28px;
    color: #333;
    margin-bottom: 5px;
}

.level-info p {
    color: #666;
    font-size: 16px;
}

.stats {
    display: flex;
    gap: 20px;
}

.stat-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 15px 25px;
    border-radius: 12px;
    color: white;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
}

.stat-box .icon {
    font-size: 24px;
}

.stat-box .value {
    font-size: 20px;
}

.progress-container {
    background: white;
    border-radius: 15px;
    padding: 15px 30px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    flex: 1;
    height: 15px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
    width: var(--progress, 0%);
    transition: width 0.5s ease;
}

.streak-display {
    background: #ff9800;
    padding: 8px 15px;
    border-radius: 20px;
    color: white;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 5px;
}

.streak-display.hidden {
    display: none;
}

.feedback {
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 20px;
    animation: fadeIn 0.3s;
}

.feedback.hidden {
    display: none;
}

.feedback.success {
    background: #4caf50;
    color: white;
}

.feedback.error {
    background: #f44336;
    color: white;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.game-area {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

.items-panel {
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.items-panel h3 {
    font-size: 22px;
    color: #333;
    margin-bottom: 20px;
}

.items-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.item {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    padding: 15px;
    border-radius: 12px;
    border: 3px solid #667eea;
    cursor: grab;
    font-weight: bold;
    color: #333;
    transition: transform 0.2s, box-shadow 0.2s;
    user-select: none;
}

.item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.item:active {
    cursor: grabbing;
}

.drop-zone {
    background: white;
    border-radius: 20px;
    padding: 25px;
    border: 4px dashed #ccc;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    min-height: 400px;
    transition: all 0.3s;
}

.drop-zone.drag-over {
    border-color: #667eea;
    background: #f0f4ff;
}

.drop-zone h3 {
    font-size: 22px;
    margin-bottom: 20px;
}

.zone-1 h3 {
    color: #9c27b0;
}

.zone-2 h3 {
    color: #ff5722;
}

.zone-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.placed-item {
    padding: 15px;
    border-radius: 12px;
    font-weight: bold;
    color: #333;
    border: 3px solid;
}

.zone-1 .placed-item {
    background: linear-gradient(135deg, #e1bee7 0%, #f8bbd0 100%);
    border-color: #9c27b0;
}

.zone-2 .placed-item {
    background: linear-gradient(135deg, #ffccbc 0%, #ffecb3 100%);
    border-color: #ff5722;
}

/* Level Complete Page */
#levelCompletePage {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.score-display {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    margin-bottom: 30px;
}

.big-score {
    font-size: 72px;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 10px;
}

/* Score Card Page */
#scoreCardPage {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.score-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.score-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.score-value {
    font-size: 48px;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 10px;
}

.score-label {
    font-size: 14px;
    color: #666;
}

.learning-summary {
    background: linear-gradient(135deg, #e1bee7 0%, #f8bbd0 100%);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
}

.learning-summary h3 {
    font-size: 24px;
    color: #333;
    margin-bottom: 15px;
}

.learning-summary ul {
    list-style: none;
    color: #333;
}

.learning-summary li {
    margin-bottom: 10px;
    font-size: 16px;
}

.button-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 1024px) {
    .game-area {
        grid-template-columns: 1fr;
    }
    
    .score-grid {
        grid-template-columns: 1fr;
    }
    
    .button-group {
        grid-template-columns: 1fr;
    }
}