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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Public Pixel", Roboto, Helvetica, Arial, sans-serif;
    background:url('fond.gif')fixed;
    background-size: cover;
    background-position: bottom;
    height:100vh;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overscroll-behavior: none;
    touch-action: manipulation;
    -webkit-font-smoothing: antialiased;
}
h1, h2, div, span, p{
    font-family:'Public Pixel';
}

#installBtn {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
}

.game-container {
    background: #f8f8f8;
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    width: 100%;
    background: rgba(248, 248, 255, 0.89);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(248, 248, 255, 0.89);
    outline: 0.3rem solid;
    box-shadow: 0.6rem 0.6rem 0;
}

.header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-weight: 400;
    color: #1e40af;
}
.header div {
    font-size: 0.75rem;
}

#gameCanvas{
    width: 100%;
    height: auto;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 0.75rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.26);
    margin-bottom: 1rem;
}

.controls {
    display: flex;
    gap: 0.5rem;
    justify-content: space-between;
}
.controls button {
    width:30%;
}

.button {
    background: pink;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    border: 0;
    box-shadow: 0px 5px black, 0px -5px black, 5px 0px black, -5px 0px black, 0px 10px #00000038, 5px 5px #00000038, -5px 5px #00000038, inset 0px 5px #ffffff36;
    text-shadow: -2px 0 black, 0 2px black, 2px 0 black, 0 -2px black;
    font-family:'Public Pixel';
}

.button:hover {
    background: #ff6699;
}
button:active {
    transform: translateY(5px);
    box-shadow: 0px 5px black, 0px -5px black, 5px 0px black, -5px 0px black,inset 0px 5px #00000038;
}

.menu-container{
    display: flex;
    justify-content: center;
    flex-direction: column;
    gap: 50px;
    outline: 0.3rem solid;
    padding:clamp(1rem, 2vw, 2.5rem);
    margin-bottom: calc(clamp(1rem, 2vw, 2.5rem) * 2);
    box-shadow: 0.6rem 0.6rem 0;
    background: peachpuff;
}

.menu, .overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 50px;
    z-index: 100;
    background: #63cdda;
}

.menu > div, .message {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items:center;
    gap: 20px;
    outline: 0.3rem solid;
    box-shadow: 0.6rem 0.6rem 0;
}

.menu > div, .message button{
    margin-top: 2.5rem;
    padding: 1rem;
    width: 60%;
}

.level-select h2{
    font-size: 1rem;
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin: 3rem 0 1rem 0;
}

.level-grid button {
    aspect-ratio: 1;
    font-size: 1.25rem;
}
.level-page{
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    margin: 2rem;
    padding-top: 15px;
}
.prev{
    grid-area: 4 / 2;
}
.next{
    grid-area: 4 / 3;
}

.hidden {
    display: none;
}

@keyframes pop {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.5); }
    100% { transform: scale(1); }
}

.pop {
    animation: pop 1.3s ease-out forwards;
}

@keyframes player-hit-flash {
    0% { filter: brightness(100%); }
    50% { filter: brightness(200%) sepia(1) saturate(10000%) hue-rotate(0deg); }
    100% { filter: brightness(100%); }
}

.player-hit #gameCanvas {
    animation: player-hit-flash 0.25s ease-out;
}

.player-hit .game-container {
    animation: shake 0.25s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.boss-level {
    background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0)), url('fond.gif') fixed;
    background-size: cover;
    background-position: bottom;
}

.boss-health-container {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    display: none;
}

.boss-health-bar {
    width: 100%;
    height: 25px;
    background: #333;
    border: 2px solid #000;
    border-radius: 10px;
    overflow: hidden;
}

.boss-health-fill {
    width: 100%;
    height: 100%;
    background: #FF0000;
    transition: width 0.3s ease-out;
    padding-left: 0.5rem;
}

.boss-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 24px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.boss-phase {
    text-align: center;
    color: #fff;
    margin-top: 5px;
    font-size: 14px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.aiming-guide {
    position: absolute;
    pointer-events: none;
    opacity: 0.6;
}

/* Responsive */
@media screen and (max-width: 680px) {
    .game-container {
        width: 93vw !important;
        background: #ffffff65;
    }
    .header{
        background: ghostwhite;
        outline: 0.3rem solid black;
        padding: 1rem 0.2rem;
        border-radius: 5px;
    }
    .menu-container{
        width: 95vw !important;
    }
    .level-grid{
        width: 80vw;
    }
    .level-grid button{
        padding: 0;
    }
    .controls button{
        padding: 0.5rem 0.2rem !important;
    }
    .boss-health-container {
        width: 90%;
    }
}