/* ========= Thème A Propos pour le menu principal ========= */
:root {
  --ss-cyan: #00f0ff;
  --ss-panel: rgba(255,255,255,0.08);
  --ss-border: rgba(255,255,255,0.20);
  --ss-border-soft: rgba(255,255,255,0.12);
  --ss-text: #fff;
}

/* Conteneur du menu (panneau glassmorph) */
#unifiedMenu
{
    position: relative;
    padding: 32px 28px;
    color: var(--ss-text);
    width: 100%;
    gap: 18px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1001;
    overflow: auto;
}

/* Logo */
#unifiedMenu #gameLogo {
  width: 30vw;
  margin: 0 auto 10px;
  display: block;
  -webkit-user-drag: none;
}

/* Boutons principaux (look bouton "Jeu en développement") */
#unifiedMenu button
{
  position: relative;
  display: block;
  width: 15vw;
  padding: 5px 22px;
  font-size: clamp(18px, 2.4vw, 20px);
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ss-text);
  background: linear-gradient(135deg, rgba(0,255,255,0.10), rgba(0,255,255,0.05));
  border: 1px solid rgba(0,255,255,0.50);
  border-radius: 14px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 0 12px rgba(0,255,255,0.20);
  transition: transform .2s ease, box-shadow .3s ease, border-color .3s ease;
  overflow: hidden;
  cursor: pointer!important;
}

/* Reflet "soleil" qui passe de temps en temps */
#unifiedMenu button::after{
  content:"";
  position:absolute;
  top:-60%;
  left:-30%;
  width:60%;
  height:220%;
  background: linear-gradient(120deg, transparent 0%, rgba(255,255,255,.75) 50%, transparent 100%);
  transform: rotate(25deg) translateX(-150%);
  pointer-events:none;
}
@keyframes menuShine{
  0%, 75% { transform: rotate(25deg) translateX(-150%); opacity: 0; }
  80%     { opacity: 1; }
  95%     { transform: rotate(25deg) translateX(260%); opacity: 0; }
  100%    { opacity: 0; }
}

/* Hover / focus */
#unifiedMenu button:hover,
#unifiedMenu button:focus-visible{
  transform: scale(1.03);
  box-shadow: 0 0 16px var(--ss-cyan), 0 0 28px rgba(0,255,255,0.55) inset;
  outline: none;
}

/* État actif (clic) */
#unifiedMenu button:active{
  transform: scale(0.995);
}

/* Charger une partie (désactivé) */
#loadGameButton {
  opacity: .55;
  cursor: not-allowed;
  filter: grayscale(.2);
}
#loadGameButton:hover{ transform:none; box-shadow: 0 0 12px rgba(0,255,255,0.25); }

/* Sous‑menus : overlay centré comme le menu principal */
.sub-menu {
    position: fixed;            /* occupe tout l’écran */
    inset: 0;                   /* top/right/bottom/left: 0 */
    z-index: 1001;
    padding: 24px;
    display: none !important;   /* caché par défaut */
    justify-content: center;    /* centrage horizontal */
    align-items: center;        /* centrage vertical */
    flex-direction: column;
    gap: 30px;

    /* même vibe que la modale / menu */
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    color: var(--ss-text);
}

/* Sous‑menus : cachés par défaut, visibles seulement avec .visible */
.sub-menu { display: none !important; }

/* Visible = reste en flex (ne PAS repasser en block) */
.sub-menu.visible {
    display: flex !important;
}

/* Compat : forcer le masquage si besoin */
.sub-menu.hidden {
    display: none !important;
}

/* Un peu de largeur contrôlée pour le contenu interne */
.sub-menu > * {
    max-width: min(92vw, 370px);
    width: 100%;
    display: flex;
}

/* Les groupes/paragraphes restent centrés sans s’étirer */
.sub-menu p,
.sub-menu .container_input_range,
.sub-menu div:not(:has(button)) {
    margin: 0 auto;
    text-align: center;
}

/* Titre sous‑menus = titre modale */
.sub-menu h2{
  margin: 0 0 70px 0;
  font-size: clamp(26px, 4vw, 46px);
  font-weight: 800;
  color: var(--ss-cyan);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 2px;
  position: relative;
  padding-bottom: 10px;
  text-shadow:
    0 0 5px rgba(0,255,255,.6),
    0 0 10px rgba(0,255,255,.6),
    0 0 20px rgba(0,255,255,.4);
}

.sub-menu > h2 { display: block; }


.sub-menu h2::after{
  content:"";
  position:absolute;
  left:50%; bottom:0;
  transform:translateX(-50%);
  width:60%; height:2px;
  background: linear-gradient(90deg, transparent, var(--ss-cyan), transparent);
  box-shadow: 0 0 8px var(--ss-cyan);
}
@keyframes glowTitleMenu{
  0%,100%{ text-shadow:0 0 5px rgba(0,255,255,.5), 0 0 15px rgba(0,255,255,.6); }
  50%{     text-shadow:0 0 10px rgba(0,255,255,.9), 0 0 25px rgba(0,255,255,.8); }
}
.sub-menu h2{ animation: glowTitleMenu 3s infinite; }

/* Boutons des sous‑menus = style boutons principaux (taille adaptée) */
.sub-menu button{
    position: relative;
    display:inline-block;
    min-width: 240px;
    /*margin: 10px 0 0 0;*/
    padding:12px 20px;
    font-size: clamp(14px, 1.8vw, 18px);
    font-weight:700;
    letter-spacing:.5px;
    text-transform: uppercase;
    color: var(--ss-text);
    background: linear-gradient(135deg, rgba(0,255,255,0.20), rgba(0,255,255,0.05));
    border: 1px solid rgba(0,255,255,0.50);
    border-radius: 12px;
    box-shadow: 0 0 12px rgba(0,255,255,0.35);
    transition: transform .2s, box-shadow .3s, border-color .3s;
    overflow: hidden;
    cursor: pointer!important;
}
.sub-menu button:hover,
.sub-menu button:focus-visible{
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 0 16px var(--ss-cyan), 0 0 26px rgba(0,255,255,0.55) inset;
  outline: none;
}
.sub-menu button:active{
  transform: translateY(0) scale(0.995);
}

/* Sliders / contrôles divers harmonisés */
.sub-menu input[type="range"]{
  -webkit-appearance:none; appearance:none;
  width: min(560px, 80%);
  height: 8px;
  background: rgba(255,255,255,0.12);
  border: 1px solid var(--ss-border-soft);
  border-radius: 999px;
  outline: none;
  box-shadow: inset 0 0 10px rgba(0,255,255,0.15);
}
.sub-menu input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance:none; appearance:none;
  width: 18px; height: 18px; border-radius:50%;
  background: var(--ss-cyan);
  border: 1px solid #66fcff;
  box-shadow: 0 0 12px var(--ss-cyan);
  cursor: pointer;
}
.sub-menu input[type="range"]::-moz-range-thumb{
  width: 18px; height: 18px; border-radius:50%;
  background: var(--ss-cyan);
  border: 1px solid #66fcff;
  box-shadow: 0 0 12px var(--ss-cyan);
  cursor: pointer;
}

/* Petits ajustements de layout */
.sub-menu .container_input_range { gap: 14px; margin:10px 0;}
.sub-menu label { font-size: clamp(16px, 2vw, 22px); }
.sub-menu .container_input_range label {
    display: inline-block;
    margin-bottom: 15px;
}

#backToOptionsButton, #backToOptionsButton2, #backToOptionsButton3
{
    margin-top: 70px;
}


/* État masqué conservé */
#unifiedMenu.hidden { display: none; }

/* Option : léger glow du focus clavier sur le premier bouton accessible */
#unifiedMenu button:focus-visible { outline: 2px solid rgba(0,240,255,.35); outline-offset: 2px; }

.pause-only {
  display: none !important;
}

/* === HERO BUTTON : JOUER (Hexagone + Thruster + Néon 3D + pseudo-3D bouton) === */
#newGameButton,#continueButton {
    /* Layout + taille (plus large que les autres) */
    position: relative;
    display: block;
    margin: 0 auto 18px;
    width: clamp(360px, 25vw, 820px) !important; /* force > aux 15vw génériques */
    height: clamp(60px, 1vw, 90px);
    line-height: 1;
    padding: 0;
    cursor: pointer;

    /* Texte */
    font-family: "Audiowide", sans-serif;
    font-size: clamp(26px, 3.2vw, 30px)!important;
    font-weight: 800;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #e9feff;

    /* Corps du bouton : bleu nuit → cyan, forme hexagonale */
    background: linear-gradient(145deg, #071629 0%, #0b2440 42%, #0f4e6e 100%);
    border: 2px solid rgba(0, 240, 255, 0.7);
    clip-path: polygon(8% 0, 92% 0, 100% 50%, 92% 100%, 8% 100%, 0 50%);

    /* Pseudo-3D du bouton (socle) + glow global */
    box-shadow:
        0 8px 0 #04121e,                              /* socle net sous le bouton */
        0 18px 28px rgba(0, 40, 60, 0.55),            /* ombre portée */
        0 0 22px rgba(0, 200, 255, 0.35),             /* glow externe */
        inset 0 0 18px rgba(0, 240, 255, 0.15);       /* glow interne */

    /* Animations */
    transition: transform 0.15s ease, box-shadow 0.25s ease, filter 0.25s ease;
    animation: playPulse 2.4s infinite ease-in-out;
    overflow: visible;
    z-index: 2;
}

/* Bordure interne lumineuse (même forme) */
#newGameButton::before,
#newGameButton::after {
    pointer-events: none;
}

/* === THRUSTER TRÈS VISIBLE (halo cyan animé) === */
#newGameButton::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -38px; /* sous le bouton */
    transform: translateX(-50%);
    width: min(70%, 520px);
    height: 46px;
    background: radial-gradient(
        ellipse at center,
        rgba(0, 255, 255, 0.90) 0%,
        rgba(0, 255, 255, 0.45) 35%,
        rgba(0, 255, 255, 0.16) 60%,
        transparent 100%
    );
    filter: blur(10px) drop-shadow(0 18px 24px rgba(0, 255, 255, 0.35));
    opacity: 0.95;
    border-radius: 999px;
    animation: thrusterPulse 1.6s infinite ease-in-out;
    z-index: -1; /* derrière le bouton */
}

/* Reflet oblique (gloss) sur la surface */
#newGameButton::after {
    content: "";
    position: absolute;
    inset: 0;
    clip-path: inherit;
    background: linear-gradient(
        115deg,
        rgba(255, 255, 255, 0) 35%,
        rgba(255, 255, 255, 0.35) 50%,
        rgba(255, 255, 255, 0) 65%
    );
    transform: translateX(-130%) skewX(-18deg);
    animation: shinePlay 5s infinite ease-in-out;
}

/* Hover : “décollage” + intensification */
#newGameButton:hover {
    transform: translateY(-4px) scale(1.06);
    box-shadow:
        0 10px 0 #04121e,
        0 26px 40px rgba(0, 60, 90, 0.65),
        0 0 34px rgba(0, 240, 255, 0.85),
        inset 0 0 26px rgba(0, 240, 255, 0.22);
    filter: saturate(1.15);
}

/* Pressé : bouton qui s’enfonce sur le socle */
#newGameButton:active {
    transform: translateY(2px) scale(1.02);
    box-shadow:
        0 4px 0 #04121e,
        0 16px 26px rgba(0, 40, 60, 0.6),
        0 0 26px rgba(0, 240, 255, 0.55),
        inset 0 0 22px rgba(0, 240, 255, 0.20);
}

/* Focus clavier accessible */
#newGameButton:focus-visible {
    outline: none;
    box-shadow:
        0 8px 0 #04121e,
        0 18px 28px rgba(0, 40, 60, 0.55),
        0 0 0 3px rgba(0, 240, 255, 0.5),
        0 0 30px rgba(0, 240, 255, 0.7),
        inset 0 0 26px rgba(0, 240, 255, 0.22);
}

/* Animations clés */
@keyframes playPulse {
    0%,
    100% { transform: scale(1); }
    50%   { transform: scale(1.035); }
}
@keyframes shinePlay {
    0%   { transform: translateX(-130%) skewX(-18deg); opacity: 0; }
    20%  { opacity: 0.6; }
    45%  { transform: translateX(130%) skewX(-18deg); opacity: 0; }
    100% { transform: translateX(130%) skewX(-18deg); opacity: 0; }
}
@keyframes thrusterPulse {
    0%,
    100% { transform: translateX(-50%) scaleX(1) scaleY(0.85); opacity: 0.85; }
    50%   { transform: translateX(-50%) scaleX(1.18) scaleY(1.18); opacity: 1; }
}

/* Piste du range : pas de 50% par défaut */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 8px;
    background: linear-gradient(to right, #00d9ff 0%, #333 0%) no-repeat;
    background-size: 100% 100%;
    outline: none;
    cursor: pointer;
}

/* Thumb */
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #00d9ff;
}
input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #00d9ff;
}

/* Évite un flash de style pendant l’init JS */
input[type="range"].range--uninit { opacity: 0; }
input[type="range"].range--ready { opacity: 1; transition: opacity .15s; }

.controls-help
{
    min-width: 560px;
}

#controlsSubMenu .controls-list {
    list-style: none;
    padding: 0;
    margin: 0;
    width: min(92vw, 560px);
    display: grid;
    gap: 10px;
}
#controlsSubMenu .row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 14px;
    background: var(--ss-panel);
    border: 1px solid var(--ss-border);
    border-radius: 12px;
}
#controlsSubMenu .keys {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 30%;
}
#controlsSubMenu .key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--ss-border);
    font-weight: 700;
    letter-spacing: .2px;
    box-shadow: 0 0 10px rgba(0,255,255,0.15);
    white-space: nowrap;
}
#controlsSubMenu .key::before { content: "["; color: var(--ss-cyan); opacity: .9; margin-right: 4px; }
#controlsSubMenu .key::after  { content: "]"; color: var(--ss-cyan); opacity: .9; margin-left: 4px; }
#controlsSubMenu .key.large { padding: 6px 12px; }
#controlsSubMenu .desc { color: var(--ss-text); opacity: .85; width: 70%; text-align: right;font-size: 1.1em;}
#controlsSubMenu .or { opacity: .7; margin: 0 4px; }

/* === Fix centrage du sous-menu Audio === */
#audioSubMenu > * {
    flex-direction: column;
}

/* Le titre ne doit pas être un conteneur flex */
#audioSubMenu h2 {
    display: block;
    width: 100%;
    text-align: center;
}

/* Centrer le conteneur du bouton "Retour aux options" */
#audioSubMenu .container_input_range:last-child {
    justify-content: center;     /* centre le bouton dans sa ligne */
}

/* Harmoniser la largeur des sliders avec le conteneur */
#audioSubMenu input[type="range"] {
    width: 100%;
    max-width: 560px;
    margin-inline: auto;
}

/* Icône qui dépasse sur les boutons du sous-menu Options */
#optionsSubMenu button {
    position: relative;          /* ancre pour l'image absolue */
    overflow: visible;           /* autorise le dépassement */
    padding-left: clamp(28px, 7vw, 84px); /* réserve de place pour ne pas gêner le texte */
}

#optionsSubMenu button#backToMainButton {
    padding:10px;
}

#optionsSubMenu button img {
    position: absolute;
    left: -16px;                /* dépasse vers l'extérieur */
    top: 50%;
    transform: translateY(-50%);
    height: 160%;                /* plus grand que le bouton */
    pointer-events: none;        /* ne bloque pas le clic */
    filter: drop-shadow(0 10px 14px rgba(0,0,0,.35));
    opacity: .95;
}



/**
//
// MENU COMMANDES
//
*/


/* === Controls Help (read-only) === */
.controls-help {
    display: block;
    width: 100%;
    max-width: 980px;
    margin: 0 auto;
    padding: 12px 16px;
    max-height: 50vh;           /* évite le débordement */
    overflow: auto;
}

.controls-help .controls-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.controls-help .category-block {
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 12px;
}

.controls-help .category-title {
    margin: 0 0 10px 0;
    font-size: 25px;
    font-weight: 600;
    opacity: 0.9;
    color: var(--ss-cyan);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    text-shadow: 0 0 5px rgba(0,255,255,.6), 0 0 10px rgba(0,255,255,.6), 0 0 20px rgba(0,255,255,.4);
}

/* Ligne: [Label] [Touches] [Bouton] */
.controls-help .control-row {
display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.02);
    margin: 10px 0;
}
.controls-help .control-row:nth-child(odd) {
    background: rgba(255, 255, 255, 0.02);
}

.controls-help .action-label
{
    font-size: 25px;
    opacity: 0.9;
    flex-grow: 1;
    width: 10%;
    display: flex;
    align-items: center;
}

.controls-help .key-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    flex-grow: 1;
    align-items: center;
}

.controls-help .key-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    padding: 6px 10px;
    border-radius: 10px;
    font-size: 25px;
    line-height: 1;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-weight: 600;
    letter-spacing: 0.2px;
    user-select: none;
}
.controls-help .key-chip.key-missing { opacity: 0.6; font-style: italic; }

.controls-help .controls-empty {
    text-align: center;
    opacity: 0.8;
    padding: 16px;
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 12px;
}

/* Bouton "Modifier" */
.controls-help .key-edit-btn {
    justify-self: end;
    width: auto;
    min-width: 140px;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    cursor: pointer;
    transition: transform 0.08s ease, background 0.2s ease, border-color 0.2s ease;
}
.controls-help .key-edit-btn:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.18);
}

/* État "verrouillé" */
.controls-help .control-row.locked {
    position: relative;
    background: rgba(255, 255, 255, 0.03);
    outline: 1px dashed rgba(255, 255, 255, 0.12);
}
.controls-help .control-row.locked .action-label::after {
    content: "🔒";
    margin-left: 8px;
    opacity: 0.8;
    font-size: 12px;
}
.controls-help .control-row.locked .key-chip {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Modal glasmorphism */
.rebind-modal.hidden { display: none; }
.rebind-modal {
    color: white;
    position: fixed;
    inset: 0;
    z-index: 9999;
}
.rebind-modal .rebind-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
}
.rebind-modal .rebind-card {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(520px, 92vw);
    padding: 18px 20px;
    border-radius: 16px;
    background: rgba(20, 20, 22, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.10);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    text-align: center;
}
.rebind-modal .rebind-card h3 { margin: 0 0 8px; }
.rebind-modal .rebind-card p  { margin: 0 0 12px; opacity: 0.9; }
.rebind-modal .rebind-feedback {
    min-height: 20px;
    margin-bottom: 12px;
    font-size: 14px;
    opacity: 0.95;
}
.rebind-modal .rebind-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}
.rebind-modal .btn-cancel {
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    color: white;
}

/* Responsive */
@media (min-width: 920px) {
    .controls-help .control-row {
        grid-template-columns: minmax(200px, 1fr) auto auto;
    }
}
@media (max-width: 680px) {
    .controls-help .control-row {
        grid-template-columns: 1fr auto;      /* label | (keys + bouton) */
        grid-auto-flow: row;
    }
    .controls-help .key-list { justify-content: flex-start; }
}


/* Footer centré sous la grille des commandes */
.controls-help .controls-footer {
    margin-top: 16px;
    display: flex;
    justify-content: center;
}

/* Bouton "Réinitialiser les touches par défaut" */
.controls-help .key-reset-all {
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: linear-gradient(180deg, rgba(25, 227, 227, 0.12), rgba(25, 227, 227, 0.06));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 6px 22px rgba(25, 227, 227, 0.12);
    transition: transform 0.08s ease, background 0.2s ease, border-color 0.2s ease;
}

.controls-help .key-reset-all:hover {
    transform: translateY(-1px);
    background: linear-gradient(180deg, rgba(25, 227, 227, 0.18), rgba(25, 227, 227, 0.10));
    border-color: rgba(25, 227, 227, 0.30);
}

.controls-help .key-reset-all:active {
    transform: translateY(0);
}
