/* --- IMPORT DE LA POLICE PIXEL --- */
@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

/* --- STYLE GLOBAL RÉTRO --- */
body {
    /* On applique la police pixel. "Courier New" en secours */
    font-family: 'VT323', 'Courier New', monospace;
    /* Couleur de fond bleu ciel de l'image */
    background-color: #8fd3f4; 
    margin: 0;
    padding-bottom: 100px; /* Plus d'espace en bas pour les gros boutons */
    color: #000;
    /* Empêche le lissage des polices pour un rendu plus net */
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: grayscale;
    font-size: 20px; /* La police pixel est souvent petite, on augmente la base */
}

/* TRUC CSS : Force les images à rester pixelisées quand on les agrandit */
img {
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* --- LE "CADRE PIXEL" (Le secret du look) --- */
/* On crée une classe qu'on peut réutiliser partout */
.pixel-box {
    border: 4px solid #000; /* Bordure noire épaisse */
    /* L'ombre portée dure (0 flou) qui crée l'effet 3D */
    box-shadow: 6px 6px 0px rgba(0,0,0,0.8); 
    background: #fceabb; /* Fond beige par défaut */
    padding: 15px;
    margin-bottom: 20px;
    /* Pas de border-radius rond en pixel art pur ! */
}

/* --- Header & Navigation --- */
.header {
    background: #333;
    color: white;
    padding: 15px;
    text-align: center;
    border-bottom: 4px solid #000;
    font-size: 1.5em;
}
.header a {
    color: #ffcc00; /* Jaune rétro */
    text-decoration: none;
    font-weight: bold;
    position: absolute;
    left: 15px;
    top: 15px;
    font-size: 0.8em;
}
.header h2 { margin: 0; }


/* --- Conteneurs --- */
.container {
    padding: 20px;
    max-width: 600px; /* Un peu plus étroit pour le look mobile */
    margin: 0 auto;
}

/* --- Dashboard Elements --- */
/* Le gros header rouge/orange */
.countdown-box {
    border: 4px solid #000;
    box-shadow: 8px 8px 0px #000;
    /* Dégradé pixel art style */
    background: linear-gradient(#1c2ed4, #51ff00);
    color: white;
    padding: 20px;
    text-align: center;
    margin-bottom: 30px;
    text-shadow: 2px 2px 0px #000; /* Ombre portée sur le texte pour la lisibilité */
}
.countdown-timer { 
    font-size: 2.5em; 
    font-weight: bold; 
    margin: 10px 0;
}

/* Grille des stats */
.stats-grid { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 15px; 
    margin-bottom: 30px; 
}

/* Les cartes de stats (utilisent le style pixel-box de base) */
.stat-card {
    border: 4px solid #000;
    box-shadow: 6px 6px 0px rgba(0,0,0,0.8);
    background: #fceabb;
    padding: 10px;
    display: flex; /* Pour aligner l'image et le texte */
    align-items: center;
    text-align: left;
}
/* Pour simuler les icônes de l'image si tu n'en as pas encore */
.stat-card::before {
    font-size: 3em;
    margin-right: 15px;
    display: block;
}
.card-pompe::before { content: '🙇‍♂️'; }  
.card-abdo::before  { content: '🍫'; } 
.card-dips::before  { content: '💪'; }  
.card-run::before   { content: '👟'; } 
.card-autre::before { content: '⏱️'; }

.stat-val { font-size: 1.8em; font-weight: bold; color: #000; line-height: 1; }
.stat-label { font-size: 1.1em; color: #333; text-transform: uppercase; font-weight: bold;}

/* --- Classement --- */
.ranking-title {
    text-align: center; /* Centre le texte */
    margin-top: 40px;
    margin-bottom: 20px;
}

.ranking-subtitle {
    font-size: 0.6em; /* Plus petit */
    color: #555;      /* Gris foncé */
    font-weight: normal;
}

.ranking-table {
    width: 100%;
    max-width: 600px;

    margin: 20px auto;
    
    border-collapse: separate; /* Nécessaire pour les bordures épaisses */
    border-spacing: 0 10px; /* Espace entre les lignes */
}
.ranking-table tr {
    background: #fceabb;
    box-shadow: 4px 4px 0px #000;
}
.ranking-table td { 
    padding: 15px; 
    border-top: 4px solid #000;
    border-bottom: 4px solid #000;
}
.ranking-table td:first-child { border-left: 4px solid #000; }
.ranking-table td:last-child { border-right: 4px solid #000; font-weight: bold; text-align: right; }

/* Le premier du classement */
.rank-1 { background-color: #fff3cd !important; }

/* --- Boutons du bas (Gros style rétro) --- */
.action-bar {
    position: fixed;
    bottom: 0; left: 0; width: 100%;
    /* Fond transparent pour voir le bleu derrière */
    padding: 20px;
    display: flex;
    justify-content: space-between;
    box-sizing: border-box; 
    /* Pas d'ombre sur la barre elle-même dans ce style */
}
.btn { 
    padding: 15px 10px; 
    text-decoration: none; 
    font-weight: bold; 
    flex: 1; /* Prend toute la largeur dispo */
    text-align: center; 
    margin: 0 10px; 
    font-size: 1.4em;
    color: #000;
    background: #e6d0a0; /* Beige un peu plus foncé */
    border: 4px solid #000;
    box-shadow: 6px 6px 0px #000; /* L'ombre dure est cruciale ici */
    transform: translateY(0);
    transition: all 0.1s; /* Transition très rapide */
}
/* Effet "clic" : le bouton s'enfonce */
.btn:active {
    transform: translateY(4px); /* Le bouton descend */
    box-shadow: 2px 2px 0px #000; /* L'ombre rétrécit */
}
.btn-add { background-color: #e6d0a0; }
.btn-badges { background-color: #e6d0a0; }

/* --- Ajustements Badges & Formulaires pour le style pixel --- */
.badges-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 20px; }
.badge-card {
    border: 4px solid #000; box-shadow: 6px 6px 0px #000; background: #fceabb;
    padding: 15px; text-align: center; height: auto; display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.badge-locked { filter: grayscale(100%) contrast(1.2); opacity: 0.7; background: #d0c0a0; }
.badge-unlocked { background: #fff7d9; border-color: #000; } /* Pas de bordure dorée, on reste en noir */
.badge-title { font-size: 1.1em; margin-top: 10px;}

/* Formulaires */
input[type="text"], input[type="password"], input[type="number"] {
    width: 100%; padding: 15px; margin: 10px 0;
    border: 4px solid #000; background: #fff; font-family: 'VT323', monospace; font-size: 1.2em;
    box-shadow: 4px 4px 0px #000; box-sizing: border-box;
}
.btn-submit {
    width: 100%; padding: 15px; background-color: #28a745; color: white; border: 4px solid #000;
    box-shadow: 6px 6px 0px #000; font-size: 1.5em; font-family: 'VT323', monospace; cursor: pointer;
}
.btn-submit:active { transform: translateY(4px); box-shadow: 2px 2px 0px #000; }

/* Animation Arcade pour le bouton de connexion */
@keyframes press-start {
    0% { background-color: #28a745; transform: scale(1); }
    50% { background-color: #34ce57; transform: scale(1.02); } /* Devient un peu plus clair et gros */
    100% { background-color: #28a745; transform: scale(1); }
}

/* On applique l'animation uniquement sur le bouton de l'écran de connexion */
.login-card .btn-submit {
    animation: press-start 1.5s infinite; /* Répète l'animation à l'infini */
    text-shadow: 2px 2px 0px #000; /* Ombre sur le texte pour la lisibilité */
}

/* --- Case Mystère (Badge non débloqué) --- */
.badge-mystery {
    background: #d3d3d3; /* Gris ciment */
    border: 4px dashed #555; /* Bordure pointillée : indique un emplacement vide */
    color: #777;
    box-shadow: inset 4px 4px 0px rgba(0,0,0,0.2); /* Ombre à l'intérieur pour faire "creux" */
    
    /* Pour centrer le point d'interrogation */
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center;
    height: 180px; /* Même hauteur que les autres */
    padding: 10px;
}

.mystery-icon {
    font-size: 4em;
    font-weight: bold;
    font-family: 'VT323', monospace;
    opacity: 0.5;
}

.mystery-text {
    font-size: 0.8em;
    margin-top: 10px;
    font-style: italic;
}

.card-autre {
    grid-column: 1 / -1; 
    
    padding: 5px 15px; 
    
    justify-content: center; 
    align-items: center;
    
    display: flex; 
    gap: 15px; /* Espace entre les éléments */
}

.card-autre::before {
    font-size: 2em; /* Plus petit que les 3em des autres cartes */
    margin-right: 0; /* On gère l'espace avec le gap du dessus */
}

/* --- PANNEAU D'AFFICHAGE (Correction Pixel Art) --- */
.message-board {
    /* 1. L'image source */
    border-image-source: url('board_bg.png');

    /* 2. LA DÉCOUPE (Slice)
       Ton image fait 32x16. Les bords semblent faire 4 pixels d'épaisseur.
       On met donc '4' pour couper les coins proprement.
    */
    border-image-slice: 4 fill;

    /* 3. L'épaisseur visuelle de la bordure sur l'écran */
    border-width: 16px; 
    border-style: solid;
    border-color: transparent;

    /* 4. ANTICRENELEAGE (Le secret pour enlever le flou) */
    image-rendering: pixelated;        /* Standard moderne */
    image-rendering: -moz-crisp-edges; /* Firefox */
    image-rendering: crisp-edges;      /* Autres */

    /* 5. Dimensions */
    width: 100%;
    max-width: 600px; /* IMPORTANT : On limite la largeur pour qu'il ne s'étire pas trop */
    min-height: 80px;
    margin: 20px auto; /* Centré */
    
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    
    /* On enlève l'ombre portée CSS car ton image a déjà des ombres */
    box-shadow: none; 
}
.message-text {
    font-family: 'VT323', monospace;
    font-size: 1.8em;
    color: #3e2723; /* Marron très foncé pour le texte (effet gravure) */
    text-align: center;
    font-weight: bold;
    text-shadow: 1px 1px 0px rgba(255,255,255,0.4); /* Légère lueur pour lisibilité */
    
    /* L'animation est gérée ici */
    opacity: 0; /* Invisible au départ */
    animation: fadeMessage 60s infinite; /* Change toutes les 6 secondes */
}

/* L'animation Fade In / Fade Out */
@keyframes fadeMessage {
    0%   { opacity: 0; transform: translateY(5px); } /* Invisible */
    10%  { opacity: 1; transform: translateY(0); }   /* Apparition */
    90%  { opacity: 1; transform: translateY(0); }   /* Reste visible */
    100% { opacity: 0; transform: translateY(-5px);} /* Disparition */
}