/* public/css/app.css */

:root {
    /* TON UNIVERS RETRO EN VARIABLES CSS */
    --font-retro: 'Press Start 2P', cursive;

    --color-bg: #111111;
    --color-surface: #1a1a1a;
    --color-border: #333333;

    --color-primary: #007bff;   /* Bleu Saisie */
    --color-success: #28a745;   /* Vert QCM / Victoire */
    --color-danger: #dc3545;    /* Rouge Cœur / Erreur */
    --color-warning: #ffc107;   /* Jaune Highscore */
    --color-text: #ffffff;
}

/* APPLICATION GENERALE */
body {
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-retro);
    margin: 0;
    padding: 0;
}

#central-hub {
    background: var(--color-surface);
    border: 4px solid var(--color-border); /* Un peu plus épais pour le côté rétro */
    border-radius: 0px; /* Les pixels n'ont pas d'arrondis ! */
}


/* Conteneur principal de l'accueil */
.home-container {
    max-width: 900px;
    margin: 40px auto;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
}

.home-title {
    margin-bottom: 30px;
}

/* Grille du Leaderboard */
.leaderboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-top: 30px;
    margin-bottom: 40px;
}

/* Cartes des scores */
.leaderboard-card {
    background: var(--color-surface, #1e1e1e);
    padding: 20px;
    border-radius: 0px; /* Style pixel/rétro */
    border: 4px solid var(--color-border, #333);
}

/* Variantes de bordures pour l'ambiance */
.leaderboard-card.border-success {
    border-color: var(--color-success, #28a745);
}

.leaderboard-card.border-primary {
    border-color: var(--color-primary, #007bff);
}

.mode-title {
    margin-top: 0;
    margin-bottom: 15px;
}

/* Tableaux du classement */
.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.leaderboard-table tr {
    border-bottom: 1px solid var(--color-border, #333);
}

.leaderboard-table td {
    padding: 12px 10px;
}

.rank {
    font-weight: bold;
    margin-right: 5px;
}

.score-cell {
    text-align: right;
    color: var(--color-warning, #ffc107);
    font-weight: bold;
}

.empty-cell {
    padding: 10px;
    color: #666;
    text-align: center;
}

/* Zone d'appel à l'action (CTA) */
.cta-title {
    margin-top: 200px;
}

.cta-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

/* Bouton de lancement */
.btn-start {
    display: inline-block;
    padding: 15px 30px;
    background: transparent;
    color: white;
    text-decoration: none;
    border-radius: 0px;
    font-weight: bold;
    font-size: 1.1rem;
    border: 4px solid #fff; /* Effet cartouche rétro */
    cursor: pointer;
    transition: transform 0.1s ease;
}

.btn-start:hover {
    transform: scale(1.05);
}

/* Helpers couleurs de texte */
.text-success { color: var(--color-success, #28a745); }
.text-primary { color: var(--color-primary, #007bff); }


/* CONTAINER DE JEU */
.game-container {
    max-width: 600px;
    margin: 40px auto;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
}

/* BARRE DE SCORE & DIFFICULTÉ */
.game-meta-bar {
    display: flex;
    justify-content: space-around;
    background: var(--color-surface, #1e1e1e);
    padding: 10px;
    border-radius: 0px;
    margin-bottom: 20px;
    border: 1px solid var(--color-border, #333);
	font-size:14px;
}

.game-meta-bar p {
    margin: 0;
}

.difficulty-text {
    font-weight: bold;
}

.difficulty-text.diff-facile { color: var(--color-success, #28a745); }
.difficulty-text.diff-moyen { color: var(--color-warning, #ffc107); }
.difficulty-text.diff-difficile { color: #fd7e14; }
.difficulty-text.diff-enfer { color: var(--color-danger, #dc3545); }
.difficulty-text.diff-ultra-hell { color: var(--color-purple, #6f42c1); }

.score-text {
    color: var(--color-warning, #ffc107);
    font-weight: bold;
}

/* CENTRAL HUB (LE COEUR DU JEU) */
#central-hub {
    width: 100%;
    min-height: 280px;
    background: #1a1a1a;
    border-radius: 0px;
    display: flex;
	border:0;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

/* SÉLECTION DES MODES */
#mode-selection {
    text-align: center;
}

.mode-title {
    color: #fff;
}

.mode-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.btn-mode {
    padding: 15px 30px;
    color: white;
    border-radius: 0px;
    font-weight: bold;
    font-size: 1.1rem;
    cursor: pointer;
	font-family: var(--font-retro);
	border: 5px solid white;
	background: transparent;
	width:200px;
}

/* REINITIALISATION ET REPLAY */
.btn-reset {
    display: none;
    font-size: 1rem;
    padding: 10px 20px;
    cursor: pointer;
    background-color: var(--color-danger, #dc3545);
    color: white;
    border: none;
    border-radius: 5px;
    font-weight: bold;
}

.btn-replay {
    display: none;
    font-size: 1.2rem;
    padding: 12px 24px;
    cursor: pointer;
    background-color: transparent;
    color: #111;
    border: none;
    border-radius: 5px;
    font-weight: bold;
}

/* BARRE DE PROGRESSION DU CHRONO */
/*#progress-wrapper {
    width: 80%;
    background-color: #333;
    height: 16px;
    border: 4px solid var(--color-border, #333); 
    border-radius: 0px; 
    display: none;
    box-sizing: content-box;
    padding: 2px;
}

#progress-bar {
    width: 100%;
    background-color: var(--color-danger, #dc3545);
    height: 100%;
    
    transition: width 0.05s linear; 
}*/

#progress-wrapper {
    width: 80%;
    margin-top: 15px;
    display: none;
	position:absolute;
	z-index:2;
}

#progress-track {
    flex-grow: 1;
    background-color: #333;
    height: 16px;
	border: 4px solid var(--color-border, #333); 
    border-radius: 0px;
    overflow: hidden;
	padding: 2px;
}

#progress-bar {
    height: 100%;
    background-color: var(--color-danger, #dc3545);
    width: 100%;
    transition: width 0.05s linear;
}


/* ÉCRAN DE RÉVÉLATION DE LA MUSIQUE */
#reveal-ui {
    display: none;
    width: 100%;
}

#reveal-status {
    margin-top: 0;
    font-size: 1.3rem;
}

.reveal-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 10px 0;
}

.reveal-cover-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 4px;
    background: #000;
    flex-shrink: 0;
	position:absolute;
	top:0;
	bottom:0;
	left:0;
	right:0;
}


#reveal-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.reveal-details {
    text-align: left;
	position: absolute;
	top: -2px;
	left: -2px;
	background: rgba(26, 26, 26,0.90);
	border: 2px solid rgba(51, 51, 51, 0.9);
	padding: 7px;
}

#reveal-game {
    margin: 0 0 5px 0;
    color: white;
    font-size: 0.9rem;
}

#reveal-track {
    margin: 0;
    color: #aaa;
    font-size: 1.3rem;
	font-family: 'VT323', monospace !important;
}

.reveal-timer {
	font-size: 2rem;
	color: white;
	font-weight: bold;
	margin-top: 15px;
	position: absolute;
	bottom: 10px;
	right: 10px;
	text-shadow: 
        -1px -1px 0 #000,  
         1px -1px 0 #000,
        -1px  1px 0 #000,
         1px  1px 0 #000,
         0px  3px 5px rgba(0,0,0,0.8);
}

/* INTERFACE STATUT (VIES & BOUCLIERS) */
.status-panel {
    margin-bottom: 25px;
    background: transparent;
    padding: 0;
    border-radius: 0px;
    display: none;
}

.status-indicator {
    font-size: 1.5rem;
    display: flex;
	gap: 0px;
	justify-content: flex-end;
	flex-direction: row-reverse;
}

/* INTERFACE DES CHOIX ET DU MOTEUR DE RECHERCHE */
#quiz-ui {
    display: none;
}

#choices-container {
    display: grid;
    /* Répète des colonnes dynamiquement d'au moins 220px de large */
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); 
    gap: 15px; /* Espace équilibré entre les blocs */
    width: 100%;
    max-width: 800px; /* On donne de la liberté pour étaler les blocs */
    margin: 0 auto 0 auto;
    padding: 0px;
    box-sizing: border-box;
}
.choice-btn{
	width: 100%; /* Le bouton prend toute la place de sa cellule Grid */
    padding: 10px 10px;
    background-color: var(--color-surface, #1e1e1e);
    color: #ffffff;
    
    /* Look rétro validé */
    border: 4px solid white;
    border-radius: 0px !important;
    font-family: 'VT323', monospace;
	font-size: 19px;
	line-height:19px;
	min-height: 70px;
    cursor: pointer;
    text-align: center;
    box-sizing: border-box;
    transition: background-color 0.1s steps(2);
}

#search-mode-container {
    display: none;
    position: relative;
}

#game-search-input {
    width: 300px;
    padding: 12px;
    font-size: 1rem;
    background: var(--color-surface, #1e1e1e);
    color: white;
	font-size:10px;
	font-family: var(--font-retro);
    border: 1px solid #444;
    border-radius: 0px;
    text-align: center;
}

#search-results {
    max-height: 140px;
    width: 100%;
    overflow-y: auto;
    margin: 5px auto;
    background: #222;
    border: 1px solid #444;
    border-radius: 0px;
	font-size:10px;
    display: none;
    text-align: left;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}
#search-results div {
	font-family: 'VT323', monospace !important;
    font-size: 1.4rem; /* On grossit un peu car cette police est fine */
    letter-spacing: 1px;
    text-transform: none; 
	padding: 10px;
	cursor: pointer;
	borderBottom: 1px solid #333;
	color: #fff;
}

/* ABANDON */
.abandon-wrapper {
    margin-top: 40px;
}

#abandon-btn {
    font-size: 0.9rem;
    padding: 8px 16px;
    cursor: pointer;
    background-color: transparent;
    color: #666;
	font-family:var(--font-retro);
    border: 0;
    border-radius: 0px;
}

.pixel-heart {
    width: 30px;   
    height: 30px;
    vertical-align: middle; 
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}
.pixel-shield {
    width: 30px;   
    height: 30px;
    vertical-align: middle; 
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}
.pixel-reload {
    width: 200px;   
    height: 200px;
    vertical-align: middle; 
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#leaderboard-name{
	padding: 10px; 
	margin-top: 8px; 
	width: 200px; 
	text-align: center; 
	background: #333; 
	color: white; 
	border: 1px solid #444; 
	border-radius: 0px;
	font-family:var(--font-retro);
	font-size:10px;
	margin-right: 10px;
	margin-top: 25px;
}

.btn-submit-game-end{
	padding: 10px 20px;
	color: white;
	border-radius: 0px;
	font-weight: bold;
	font-size: 10px;
	cursor: pointer;
	font-family: var(--font-retro);
	border: 5px solid white;
	background: transparent;
	width:auto;
}
.btn-accueil{
	font-size: 0.7rem;
	padding: 8px 16px;
	cursor: pointer;
	background-color: transparent;
	color: #666;
	font-family: var(--font-retro);
	border: 0;
	border-radius: 0px;
	margin-top: 25px;
}

/* Gère à la fois le survol à la souris ET la sélection au clavier */
.search-item:hover,
.autocomplete-active {
    background-color: #333 !important;
}

@keyframes craneBalancement {
    0% { transform: rotate(-15deg); }
    50% { transform: rotate(15deg); }
    100% { transform: rotate(-15deg); }
}

.crane-punitif-anime {
    animation: craneBalancement 1s ease-in-out infinite;
    transform-origin: bottom center; /* Fait pivoter le crâne depuis sa base */
}

#abandon-btn-fixed, #volume-control-wrapper {
    position: fixed;
    width: 55px;
    height: 55px;
    background-color: #2a2a2a;
    border: 3px solid #555;
    border-radius: 12px; /* Un carré arrondi, plus fidèle aux vieux boutons plastiques */
    
    /* Centrage de l'icône */
    display: flex;
    justify-content: center;
    align-items: center;
    
    cursor: pointer;
    z-index: 1000;
    
    /* Effet de bouton physique (Ombre portée + relief interne) */
    box-shadow: 0 8px 15px rgba(0,0,0,0.6), inset 0 2px 5px rgba(255,255,255,0.1);
    transition: all 0.2s ease-in-out;
	box-sizing: border-box;
}

#abandon-btn-fixed{
	bottom: 30px;
    right: 30px;
}
#volume-control-wrapper{
	bottom: 30px;
    right: 95px;
}

/* L'icône du drapeau */
#abandon-btn-fixed .pixel-icon {
    width: 28px;
    height: 28px;
    image-rendering: pixelated; /* Indispensable pour que ton drapeau rétro ne soit pas flou */
    transition: transform 0.2s;
}

/* --- INTERACTIONS --- */

/* Au survol (sur PC) : Le bouton s'allume en rouge alerte */
#abandon-btn-fixed:hover {
    background-color: #8b0000;
    border-color: #ff4d4d;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 77, 77, 0.4), inset 0 2px 5px rgba(255,255,255,0.2);
}

/* Au clic (PC + Mobile) : Le bouton s'enfonce physiquement */
#abandon-btn-fixed:active {
    transform: translateY(4px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.8), inset 0 4px 8px rgba(0,0,0,0.6);
}

#abandon-btn-fixed:active .pixel-icon {
    transform: scale(0.9);
}