/* Reset & Base Styles */
* {
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
}

body {
    background-color: #1e90ff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    color: #fff;
}

/* Game Title */
h1 {
    width: 90%;
    max-width: 600px;
    font-size: 8vw;
    text-align: center;
    padding: 10px 0;
    background-color: #b2c6d6;
    color: #1e90ff;
    border-radius: 10px;
    box-shadow: 0 0 5px #b2c6d6, 0 0 25px #b2c6d6;
    cursor: pointer;
    margin: 20px 0;
}

/* Canvas */
canvas {
    width: 90vw;
    max-width: 750px;
    height: auto;
    background: #b2c6d6;
    border-radius: 5px;
    box-shadow: 0 0 5px #b2c6d6, 0 0 25px #b2c6d6;
    display: block;
    margin-bottom: 20px;
}

/* Rules Button */
.rules-btn {
    position: absolute;
    top: 2%;
    right: 2%;
    padding: 0.5em 1em;
    font-size: 4vw;
    border: none;
    border-radius: 10px;
    background-color: #fff;
    color: #1e90ff;
    cursor: pointer;
    z-index: 10;
}

.rules-btn:hover {
    box-shadow: 0 0 5px #fff, 0 0 25px #fff;
}

/* Rules Panel */
.rules {
    position: absolute;
    top: 0;
    left: 0;
    width: 90vw;
    max-width: 400px;
    min-height: 100vh;
    background-color: #fff;
    color: #1e90ff;
    padding: 1em;
    line-height: 1.5;
    transform: translateX(-100%);
    transition: transform 0.5s ease-in-out;
    z-index: 20;
}

.rules.show {
    transform: translateX(0);
}

#close-btn {
    padding: 0.5em 1em;
    width: 80%;
    font-size: 4vw;
    border: none;
    border-radius: 10px;
    background-color: #1e90ff;
    color: #fff;
    cursor: pointer;
    margin-top: 10px;
}

#close-btn:hover {
    box-shadow: 0 0 5px #1e90ff, 0 0 25px #1e90ff, 0 0 50px #b2c6d6;
}

/* Game Wrapper */
.game-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* Start & Difficulty & Win/Lose Panels */
.start, .difficulty, .lose, .win {
    position: absolute;
    width: 80vw;
    max-width: 400px;
    padding: 1em;
    border-radius: 10px;
    text-align: center;
    animation: pop-in 0.5s;
    z-index: 5;
}

.start {
    top: 40%;
    background-color: #fff;
    color: #1e90ff;
}

.difficulty {
    top: 40%;
    background-color: #fff;
    color: #1e90ff;
    display: none;
}

.lose {
    top: 35%;
    background-color: #fff;
    color: #1e90ff;
    display: none;
}

.win {
    top: 35%;
    background-color: #009B77;
    color: #fff;
    display: none;
}

/* Buttons Inside Panels */
.start-btn, .diff-btn, .btn {
    padding: 0.5em 1em;
    font-size: 4vw;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    margin: 5px 0;
}

.start-btn {
    background-color: #fff;
    color: #1e90ff;
}

.start-btn:hover {
    background-color: #b2c6d6;
}

.diff-btn {
    background-color: #fff;
    color: #1e90ff;
}

.diff-btn:hover {
    background-color: #b2c6d6;
}

.btn {
    background-color: #1e90ff;
    color: #fff;
}

.btn:hover {
    background-color: #b2c6d6;
}

/* Animations */
@keyframes pop-in {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Media Queries for Very Small Screens */
@media screen and (max-width: 400px) {
    h1 {
        font-size: 6vw;
    }
    .rules-btn, .start-btn, .diff-btn, .btn, #close-btn {
        font-size: 5vw;
    }
}