body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: 'Bangers', cursive;
    /* overflow: hidden; */ /* This was preventing scrolling */
    background-color: #76b6f7;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

#app {
    width: 100%;
    min-height: 100%; /* Allow the container to grow */
    background-image: url('asset_name.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed; /* Keep background fixed during scroll */
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: white;
    text-shadow: 2px 2px 4px #000000;
}

.screen {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 100vh; /* Ensure screen takes at least full viewport height */
    padding: 20px;
    box-sizing: border-box;
    background-color: rgba(0, 0, 0, 0.3);
}

.screen.active {
    display: flex;
}

h1 {
    font-size: 3rem;
    color: #f9a825;
    -webkit-text-stroke: 1.5px black;
}

h2 {
    font-size: 2.5rem;
    color: #f9a825;
}

.goku-logo {
    width: 150px;
    margin-bottom: -20px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
}

.game-button, .back-button {
    font-family: 'Bangers', cursive;
    font-size: 1.8rem;
    padding: 15px 30px;
    border: 3px solid #000;
    border-radius: 50px;
    cursor: pointer;
    background-image: url('dragonball_button.png');
    background-size: 50px;
    background-repeat: no-repeat;
    background-position: 15px center;
    background-color: #f9a825;
    color: #fff;
    text-shadow: 2px 2px 2px #c56200;
    box-shadow: 0 5px 10px rgba(0,0,0,0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    padding-left: 70px; /* Space for the Dragon Ball */
}

.game-button:hover, .back-button:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0,0,0,0.4);
}

.back-button {
    margin-top: 20px;
    background-image: none;
    padding-left: 30px;
    background-color: #2c7bb6;
}

p {
    font-size: 1.5rem;
}

.game-message {
    margin-top: 20px;
    font-size: 2rem;
    color: #f9a825;
    height: 30px;
}

/* --- Game 1: Memory Game --- */
#memory-game-board {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    perspective: 1000px;
    max-width: 500px;
    width: 95vw;
}

.game1-info {
    font-size: 1.5rem;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 10px 20px;
    border-radius: 20px;
    margin-bottom: 20px;
}

.memory-card {
    width: 100%;
    aspect-ratio: 1 / 1;
    cursor: pointer;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s;
}

.memory-card.flipped {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #f9a825;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.card-front {
    background-color: #f9a825;
}

.card-back {
    background-color: #fff;
    transform: rotateY(180deg);
}

.card-front img, .card-back img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 5%;
    box-sizing: border-box;
}

/* --- Game 2: Puzzle Game --- */
#puzzle-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

#puzzle-board {
    display: grid;
    border: 3px solid #f9a825;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    width: 300px;
    height: 300px;
}

.puzzle-piece {
    width: 100px;
    height: 100px;
    border: 1px solid #c56200;
    box-sizing: border-box;
    cursor: grab;
    transition: transform 0.2s;
    user-select: none;
}

.puzzle-piece:active {
    cursor: grabbing;
    transform: scale(1.05);
    z-index: 10;
}

#puzzle-board .puzzle-piece {
    width: 100%; /* Let grid control the size */
    height: 100%; /* Let grid control the size */
}

/* --- Game 3: Sphere Hunt --- */
.game3-info {
    font-size: 1.5rem;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 10px 20px;
    border-radius: 20px;
    margin-bottom: 20px;
    display: flex;
    gap: 30px;
}

#sphere-hunt-board {
    width: 90vw;
    max-width: 500px;
    height: 60vh;
    max-height: 400px;
    border: 3px solid #f9a825;
    background-color: rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
    border-radius: 10px;
}

.sphere {
    position: absolute;
    width: 50px;
    height: 50px;
    cursor: pointer;
    animation: pop-in 0.3s ease-out;
}

@keyframes pop-in {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

/* Mobile Styles */
@media (max-width: 768px) {
    h1 {
        font-size: 2.5rem;
    }

    .goku-logo {
        width: 120px;
    }

    .game-button, .back-button {
        font-size: 1.5rem;
        padding: 12px 25px;
        padding-left: 60px;
        background-size: 40px;
        background-position: 10px center;
    }

    .back-button {
        padding-left: 25px;
    }

    /* Game 1 Mobile */
    #memory-game-board {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
        max-width: 320px;
    }

    /* Game 2 Mobile */
    #puzzle-board {
        width: 240px;
        height: 240px;
    }
}