* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background-image: url("batman_background.jpg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
}


#game-container {
    width: 95%;
    max-width: 1200px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

header {
    text-align: center;
    margin-bottom: 20px;
}

header h1 {
    font-size: 2.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin-bottom: 10px;
}

.game-info {
    display: flex;
    justify-content: center;
    gap: 30px;
    font-size: 1.2rem;
}

/* Start Screen */
#start-screen {
    text-align: center;
    padding: 40px;
}

#start-screen h2 {
    font-size: 2rem;
    margin-bottom: 20px;
}

#start-screen p {
    font-size: 1.2rem;
    margin-bottom: 30px;
}

.instructions {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 20px;
    margin: 20px auto;
    max-width: 600px;
    text-align: left;
}

.instructions h3 {
    margin-bottom: 15px;
    text-align: center;
}

.instructions ul {
    list-style-position: inside;
    line-height: 1.8;
}

/* Game Screen */
#game-screen {
    display: flex;
    gap: 20px;
    justify-content: space-between;
}

#game-board-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-board {
    display: grid;
    gap: 2px;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 10px;
}

.grid-cell {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.grid-cell:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

.grid-cell.obstacle {
    background: #555;
    cursor: not-allowed;
}

.grid-cell.start {
    background: #4CAF50;
}

.grid-cell.end {
    background: #FF9800;
}

.grid-cell.path {
    background: #2196F3;
}

.grid-cell.active {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Controls Panel */
#controls-panel {
    width: 300px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 15px;
    padding: 20px;
}

#controls-panel h3 {
    text-align: center;
    margin-bottom: 15px;
    font-size: 1.5rem;
}

#blocks-palette {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.block-item {
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.block-item:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: translateX(5px);
}

.block-item.selected {
    background: #4CAF50;
    border-color: #fff;
}

.block-item.used {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Buttons */
.btn-primary, .btn-secondary {
    width: 100%;
    padding: 15px;
    margin: 10px 0;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.btn-secondary {
    background: linear-gradient(45deg, #2196F3, #1976D2);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4);
}

/* Modal Screens */
#level-complete, #game-over {
    text-align: center;
    padding: 40px;
}

#level-complete h2, #game-over h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
}

#level-complete p, #game-over p {
    font-size: 1.3rem;
    margin-bottom: 30px;
}

#level-stats {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 20px;
    margin: 20px auto;
    max-width: 400px;
    font-size: 1.2rem;
}

/* Credit */
.credit {
    margin-top: 30px;
    color: #FFD700;
    font-size: 1.1rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    padding: 10px;
    border-top: 2px solid rgba(255, 215, 0, 0.5);
    animation: creditGlow 2s ease-in-out infinite alternate;
}

@keyframes creditGlow {
    0% { opacity: 0.8; }
    100% { opacity: 1; text-shadow: 2px 2px 8px rgba(255, 215, 0, 0.8); }
}

/* Hidden class */
.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    #game-container {
        width: 100%;
        padding: 10px;
        border-radius: 0;
    }

    header h1 {
        font-size: 2rem;
    }

    .game-info {
        flex-direction: column;
        gap: 10px;
        font-size: 1rem;
    }

    #game-screen {
        flex-direction: column;
        gap: 15px;
    }
    
    #game-board-container {
        width: 100%;
        overflow-x: auto; /* Allow horizontal scrolling for larger grids */
    }

    #game-board {
        padding: 5px;
        min-width: 300px; /* Ensure board is not too small */
    }
    
    .grid-cell {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }
    
    #controls-panel {
        width: 100%;
        padding: 15px;
    }

    #blocks-palette {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        max-height: none;
        overflow-y: visible;
    }

    .block-item {
        flex: 1 1 calc(33% - 10px); /* 3 items per row */
        max-width: calc(33% - 10px);
        padding: 10px;
        font-size: 0.9rem;
    }

    .btn-primary, .btn-secondary, .btn-twitter {
        padding: 12px;
        font-size: 1rem;
    }

    #start-screen h2 {
        font-size: 1.8rem;
    }

    #start-screen p {
        font-size: 1rem;
    }

    .instructions {
        padding: 15px;
        margin: 15px auto;
    }

    #level-complete h2, #game-over h2 {
        font-size: 2rem;
    }

    #level-complete p, #game-over p {
        font-size: 1.1rem;
    }

    #level-stats {
        padding: 15px;
        font-size: 1rem;
    }
}


.grid-cell.start {
    background-image: url("penguin_superhero.png");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    font-size: 0; /* Hide emoji */
}

.grid-cell.end {
    background-image: url("emerald_goal.png");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    font-size: 0; /* Hide emoji */
}



.btn-twitter {
    background: linear-gradient(45deg, #1DA1F2, #0C85D0);
    color: white;
    border: none;
    padding: 15px;
    margin: 10px 0;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-twitter:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(29, 161, 242, 0.4);
}

