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

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
    font-family: Arial, sans-serif;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}


/* ======================================================
   BOUTON PLEIN ÉCRAN
   ====================================================== */

#fullscreenButton {
    position: fixed;

    top: calc(15px + env(safe-area-inset-top));
    left: calc(15px + env(safe-area-inset-left));

    width: 42px;
    height: 42px;

    border: none;

    border-radius: 10px;

    background: rgba(10, 15, 35, 0.85);

    color: white;

    font-size: 22px;

    z-index: 20;

    touch-action: manipulation;
}


#soundButton {
    position: fixed;

    top: calc(15px + env(safe-area-inset-top));
    left: calc(65px + env(safe-area-inset-left));

    width: 42px;
    height: 42px;

    border: none;

    border-radius: 10px;

    background: rgba(10, 15, 35, 0.85);

    color: white;

    font-size: 20px;

    z-index: 20;

    touch-action: manipulation;
}


#vibrationButton {
    position: fixed;

    top: calc(15px + env(safe-area-inset-top));
    left: calc(115px + env(safe-area-inset-left));

    width: 42px;
    height: 42px;

    border: none;

    border-radius: 10px;

    background: rgba(10, 15, 35, 0.85);

    color: white;

    font-size: 20px;

    z-index: 20;

    touch-action: manipulation;
}


#langButton {
    position: fixed;

    top: calc(15px + env(safe-area-inset-top));
    left: calc(165px + env(safe-area-inset-left));

    width: 42px;
    height: 42px;

    border: none;

    border-radius: 10px;

    background: rgba(10, 15, 35, 0.85);

    color: white;

    font-size: 14px;
    font-weight: bold;
    font-family: Arial, sans-serif;

    z-index: 20;

    touch-action: manipulation;
}


#powersButton {
    position: fixed;

    top: calc(15px + env(safe-area-inset-top));
    left: calc(215px + env(safe-area-inset-left));

    width: 42px;
    height: 42px;

    border: none;

    border-radius: 10px;

    background: rgba(10, 15, 35, 0.85);

    color: white;

    font-size: 20px;

    z-index: 20;

    touch-action: manipulation;
}


#pauseButton {
    position: fixed;

    top: calc(15px + env(safe-area-inset-top));
    right: calc(15px + env(safe-area-inset-right));

    width: 42px;
    height: 42px;

    border: none;

    border-radius: 23px;

    background: rgba(10, 15, 35, 0.85);

    color: white;

    font-size: 20px;

    z-index: 20;

    display: none;

    touch-action: manipulation;
}


#pauseButton.visible {
    display: block;
}


/* ======================================================
   ÉCRAN D'ACCUEIL
   ====================================================== */

#startOverlay {
    position: fixed;

    inset: 0;

    width: 100%;
    height: 100%;

    display: flex;

    align-items: center;

    justify-content: center;

    background:
        radial-gradient(
            circle at center,
            rgba(15, 45, 80, 0.55),
            rgba(3, 7, 20, 0.97) 70%
        );

    z-index: 100;

    opacity: 1;

    visibility: visible;

    transition:
        opacity 0.35s ease,
        visibility 0.35s ease;

    padding: 25px;
}


#startOverlay.hidden {
    opacity: 0;

    visibility: hidden;

    pointer-events: none;
}


/* ======================================================
   PANNEAU D'ACCUEIL
   ====================================================== */

.start-panel {
    width: min(420px, 90vw);

    padding: 40px 25px;

    text-align: center;

    background:
        rgba(10, 15, 35, 0.92);

    border:
        1px solid
        rgba(53, 232, 255, 0.35);

    border-radius: 24px;

    box-shadow:
        0 0 35px
        rgba(53, 232, 255, 0.15);

    backdrop-filter: blur(12px);

    animation:
        startPanelAppear
        0.5s ease;
}


/* ======================================================
   TITRE
   ====================================================== */

.start-title {
    color: #35e8ff;

    font-size: clamp(34px, 9vw, 56px);

    font-weight: 900;

    letter-spacing: 2px;

    text-shadow:
        0 0 10px rgba(53, 232, 255, 0.8),
        0 0 25px rgba(53, 232, 255, 0.45);

    margin-bottom: 10px;
}


.start-subtitle {
    color: rgba(255, 255, 255, 0.7);

    font-size: 14px;

    letter-spacing: 4px;

    margin-bottom: 35px;
}


/* ======================================================
   BOUTON PLAY
   ====================================================== */

#playButton {
    width: min(280px, 80vw);

    min-height: 62px;

    border: none;

    border-radius: 16px;

    background:
        linear-gradient(
            135deg,
            #35e8ff,
            #168cff
        );

    color: #06101d;

    font-size: 24px;

    font-weight: 900;

    letter-spacing: 2px;

    cursor: pointer;

    touch-action: manipulation;

    box-shadow:
        0 0 15px
        rgba(53, 232, 255, 0.45);

    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease;
}


#playButton:active {
    transform: scale(0.94);

    box-shadow:
        0 0 25px
        rgba(53, 232, 255, 0.7);
}


#playButton:hover {
    box-shadow:
        0 0 30px
        rgba(53, 232, 255, 0.7);
}


/* ======================================================
   TEXTE D'AIDE
   ====================================================== */

.start-hint {
    margin-top: 25px;

    color:
        rgba(255, 255, 255, 0.55);

    font-size: 13px;

    line-height: 1.5;
}


/* ======================================================
   ANIMATION
   ====================================================== */

@keyframes startPanelAppear {

    from {
        opacity: 0;

        transform:
            scale(0.88)
            translateY(20px);
    }

    to {
        opacity: 1;

        transform:
            scale(1)
            translateY(0);
    }
}


/* ======================================================
   PETITS ÉCRANS
   ====================================================== */

@media (max-width: 500px) {

    #fullscreenButton {
        top: calc(10px + env(safe-area-inset-top));
        left: calc(10px + env(safe-area-inset-left));

        width: 44px;
        height: 44px;

        font-size: 20px;
    }


    #soundButton {
        top: calc(10px + env(safe-area-inset-top));
        left: calc(62px + env(safe-area-inset-left));

        width: 44px;
        height: 44px;

        font-size: 18px;
    }


    #vibrationButton {
        top: calc(10px + env(safe-area-inset-top));
        left: calc(114px + env(safe-area-inset-left));

        width: 44px;
        height: 44px;

        font-size: 18px;
    }


    #langButton {
        top: calc(10px + env(safe-area-inset-top));
        left: calc(166px + env(safe-area-inset-left));

        width: 44px;
        height: 44px;

        font-size: 12px;
    }


    #powersButton {
        top: calc(10px + env(safe-area-inset-top));
        left: calc(218px + env(safe-area-inset-left));

        width: 44px;
        height: 44px;

        font-size: 18px;
    }


    #pauseButton {
        top: calc(10px + env(safe-area-inset-top));
        right: calc(10px + env(safe-area-inset-right));

        width: 44px;
        height: 44px;

        font-size: 18px;
    }


    .start-panel {
        padding: 35px 20px;
    }


    .start-subtitle {
        font-size: 11px;

        letter-spacing: 2px;

        margin-bottom: 28px;
    }


    #playButton {
        min-height: 58px;

        font-size: 22px;
    }


    .start-hint {
        font-size: 12px;
    }
}


#shareButton {
    white-space: nowrap;
    position: fixed;

    left: 50%;

    transform: translateX(-50%);

    top: -200px;

    display: none;

    padding: 12px 22px;

    border: none;

    border-radius: 30px;

    background: linear-gradient(135deg, #35e8ff, #8a7dff);

    color: #0b1020;

    font-family: Arial, sans-serif;

    font-size: 16px;
    font-weight: bold;

    z-index: 25;

    touch-action: manipulation;
}


#shareButton.visible {
    display: block;
}

#saveCardButton {
    white-space: nowrap;
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    top: -200px;
    display: none;
    padding: 8px 18px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-family: Arial, sans-serif;
    font-size: 13px;
    z-index: 25;
    touch-action: manipulation;
}

#saveCardButton.visible {
    display: block;
}


/* barre du haut masquée dans les sous-menus (ils ont leur propre bouton Retour / réglages) */
body.sub-screen #fullscreenButton,
body.sub-screen #soundButton,
body.sub-screen #vibrationButton,
body.sub-screen #langButton,
body.sub-screen #powersButton {
    display: none;
}


/* bannière pub 320×50, centrée en bas, au-dessus de la barre système */
#adBanner {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(6px + env(safe-area-inset-bottom));   /* à l'intérieur du cadre néon */
    width: min(320px, calc(100% - 16px));
    height: 50px;
    display: none;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    z-index: 5;
    font: 12px Arial, sans-serif;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.06);
    border: 1px dashed rgba(255, 255, 255, 0.35);
    border-radius: 6px;
    overflow: hidden;
}


/* Pendant une pub GameMonetize (SDK_GAME_PAUSE → SDK_GAME_START) : le jeu ne doit jamais recouvrir la pub */
body.gm-hold #gameCanvas,
body.gm-hold #adBanner,
body.gm-hold #fullscreenButton,
body.gm-hold #soundButton,
body.gm-hold #vibrationButton,
body.gm-hold #langButton,
body.gm-hold #powersButton,
body.gm-hold #pauseButton,
body.gm-hold #shareButton,
body.gm-hold #saveCardButton {
    visibility: hidden !important;      /* uniquement NOS éléments : les boutons de la pub (Passer, Fermer) restent utilisables */
}
