@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;700&display=swap');



/* ===============================
   VARIABLES DE THÈME (AJOUTÉES)
================================ */
:root {
    --bg-body: #f8f8f8;
    --text-main: #000;
    --bg-sidebar: #f08a5b;
    --bg-sidebar-hover: #f3a480;
    --bg-plat: white;
    --border-color: #ccc;
    --hamburger-color: #130664;
    --overlay-bg: rgba(255, 255, 255, 0.3);
    --transition-speed: 0.4s;
}

body.dark-theme {
    --bg-body: #121212;
    --text-main: #f5f5f5;
    --bg-sidebar: #b91c1c; /* Rouge foncé */
    --bg-sidebar-hover: #dc2626; /* Rouge vif */
    --bg-plat: #1e1e1e;
    --border-color: #444;
    --hamburger-color: #f5f5f5;
    --overlay-bg: rgba(0, 0, 0, 0.5);
}

/* ===============================
   SIDEBAR
================================ */
nav {
    background-color: var(--bg-sidebar); /* VARIABLE */
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 220px;
    z-index: 1000;
    border-right: 1px solid var(--border-color); /* VARIABLE */
    padding-top: 40px;
    transition: left 0.3s ease, background var(--transition-speed);
}

nav.hidden {
    left: -220px;
}

nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

nav li a {
    display: block;
    padding: 12px 20px;
    text-decoration: none;
    color: var(--text-main); /* VARIABLE */
    font-family: 'Manrope';
}

nav li a:hover {
    background-color: var(--bg-sidebar-hover); /* VARIABLE */
    color: #D5F2FF;
    transition: background 0.2s ease, color 0.1s ease;
}

/* Bouton hamburger */
.hamburger {
    position: fixed;
    top: 10px;
    left: 10px;
    width: 30px;
    height: 24px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    z-index: 1101;
}

.hamburger span {
    display: block;
    width: 100%;
    height: 4px;
    background: #FFFFFF;
    margin-bottom: 5px;
    border-radius: 2px;
    transition: all 0.3s ease, background var(--transition-speed);
}

.hamburger.open span:nth-child(1) {
    transform: rotate(45deg) translate(6.2px, 6.2px);
}

.hamburger.open span:nth-child(2) {
    opacity: 0;
}

.hamburger.open span:nth-child(3) {
    transform: rotate(-45deg) translate(6.2px, -6.2px);
}

#mainContent {
    margin-left: 0px;
    padding-top: 40px;
    transition: margin-left 0.3s ease;
}

#mainContent.shift {
    margin-left: 220px;
}

/* Overlay pour effet flou */
#overlayscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-bg); /* VARIABLE */
    backdrop-filter: blur(5px);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 999;
}

#overlayscreen.active {
    opacity: 1;
    pointer-events: auto;
}
/* ===============================
   STYLES MAKI-ROLL
================================ */
body {
    margin: 0; overflow: hidden; font-family: 'Fredoka One', cursive;
    background-color: #1a1a1a; transition: background 0.5s;
}

#game-container {
    position: relative; width: 100vw; height: 100vh;
    display: flex; justify-content: center; align-items: center;
}

/* Effet Fever Mode - Écran en feu */
.fever-mode-active {
    background: radial-gradient(circle, #ff4500 0%, #1a1a1a 100%);
    animation: heartbeat 0.8s infinite;
}

.fire-overlay {
    position: absolute; inset: 0; pointer-events: none; opacity: 0;
    background: url('https://www.transparenttextures.com/patterns/carbon-fibre.png'), 
                linear-gradient(to top, rgba(255,69,0,0.4), transparent);
    z-index: 5; transition: opacity 0.5s;
}

.fever-mode-active .fire-overlay { opacity: 1; }

@keyframes heartbeat {
    0% { transform: scale(1); }
    15% { transform: scale(1.02); }
    30% { transform: scale(1); }
    45% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

canvas {
    background: #fff; border-radius: 40px; z-index: 10;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    max-width: 95vw; max-height: 80vh;
}

.ui-layer {
    position: absolute; top: 20px; display: flex; flex-direction: column;
    align-items: center; pointer-events: none; z-index: 20; color: white;
}

.score-row {
    display: flex; gap: 20px; font-size: 1.5rem; text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.fever-bar {
    width: 250px; height: 15px; background: rgba(255,255,255,0.2);
    border-radius: 10px; margin-top: 10px; border: 2px solid white; overflow: hidden;
}

.fever-fill { height: 100%; width: 0%; background: #ffeb3b; transition: width 0.2s; }
.mistake-dot { color: #ff4444; font-size: 1.2rem; }

.overlay {
    position: absolute; inset: 0; background: rgba(0,0,0,0.8);
    display: flex; justify-content: center; align-items: center; z-index: 100;
}

.menu-card {
    background: white; padding: 40px; border-radius: 40px; text-align: center; width: 90%; max-width: 450px;
}

.btn-main {
    background: #ff5722; color: white; border: none; padding: 15px 40px;
    font-size: 1.5rem; border-radius: 50px; cursor: pointer; font-family: inherit; margin: 10px;
}

.btn-secondary { background: #555; font-size: 1rem; }

.hidden { display: none !important; }

/* Bouton d'aide en haut à droite */
.help-trigger {
    position: fixed; top: 20px; right: 20px;
    width: 40px; height: 40px; background: white;
    border-radius: 50%; display: flex; justify-content: center;
    align-items: center; font-size: 1.5rem; color: #ff5722;
    cursor: pointer; box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 200; pointer-events: auto;
}

/* Modal d'aide */
.how-to-card {
    text-align: left; line-height: 1.4; color: #333;
}
.how-to-card ul { padding-left: 20px; }
.how-to-card li { margin-bottom: 8px; }

/* Animation mistakes */
#mistakes-display {
    color: #f44336; font-size: 1.5rem; letter-spacing: 5px;
    text-shadow: 0 0 5px rgba(255,0,0,0.5);
}

.btn-play {
    background: #ff5722; color: white; border: none; padding: 15px 40px;
    font-size: 1.5rem; border-radius: 50px; cursor: pointer; font-family: inherit; margin: 10px;
}

/* Effet Tremblement intense pour la bombe */
@keyframes rumble {
    0% { transform: translate(0,0); }
    10% { transform: translate(-5px, -5px); }
    20% { transform: translate(5px, 5px); }
    100% { transform: translate(0,0); }
}
.rumble-active { animation: rumble 0.1s infinite; }

/* Styles des fonds de mort */
.death-bomb { 
    background: radial-gradient(circle, #ff4500 0%, #000 100%) !important; 
}

.death-nail { 
    background-color: #444 !important;
    background-image: 
        radial-gradient(circle at 20% 30%, #222 2%, transparent 0),
        radial-gradient(circle at 80% 70%, #222 2%, transparent 0) !important;
    background-size: 50px 50px !important;
    border: 10px inset #888 !important; /* Aspect métal cloué */
}

/* Animation pour "clouer" le message */
.nailed-anim {
    animation: slam 0.3s ease-out;
}
@keyframes slam {
    0% { transform: scale(5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* ===============================
   FIX JEU MOBILE (ANTI SCROLL / SELECTION)
================================ */

/* Bloque sélection et menus tactiles */
* {
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    user-select: none;
}

/* Empêche scroll / zoom mobile */
html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    touch-action: none;
}

/* Empêche le canvas de déclencher zoom ou sélection */
canvas {
    touch-action: none;
}

/* ===============================
   RESPONSIVE : PAYSAGE (LANDSCAPE MOBILE) - FIXÉ
================================ */
@media (max-height: 500px) {
    /* --- Sidebar & Hamburger --- */
    nav { width: 180px; padding-top: 10px; }
    nav.hidden { left: -180px; }
    nav li a { font-size: 0.9rem; padding: 8px 15px; }
    .hamburger { top: 5px; left: 5px; scale: 0.8; }
    #mainContent.shift { margin-left: 180px; }

    /* --- Menu de jeu "Slider vers le bas" --- */
    .overlay {
        align-items: flex-start; /* Aligne le menu en haut de l'écran */
        padding-top: 20px;       /* Petit espace en haut */
        overflow-y: auto;        /* Permet de défiler vers le bas si le contenu dépasse */
        -webkit-overflow-scrolling: touch; /* Scroll fluide sur iPhone */
    }

    .menu-card {
        margin-bottom: 40px;     /* Espace en bas pour pouvoir bien scroller jusqu'au bout */
        max-height: none;        /* On laisse la carte prendre la hauteur nécessaire */
        padding: 20px;
        width: 95%;              /* Plus large pour profiter de l'espace paysage */
    }

    /* Réduction des textes pour gagner de la place */
    h1 { font-size: 1.4rem !important; margin: 10px 0 !important; }
    .btn-main { padding: 10px 25px; font-size: 1rem; margin: 5px; }
    
    /* On cache certains éléments moins importants si besoin pour gagner de la place */
    .how-to-card { font-size: 0.8rem; }
}

/* ===============================
   RESPONSIVE : PORTRAIT (IPHONE 14) - FIXÉ
================================ */
@media (orientation: portrait) {
    nav {
        width: 30%;
    }

    nav.hidden { left: -30%; }

    #mainContent.shift { margin-left: 0; /* On ne décale pas le jeu en portrait, l'overlay suffit */ }

    nav li a {
        font-size: 1rem; /* Taille équilibrée */
    }



