/* --- Thème Général --- */
:root {
    --bg-color: #1a1a1a;
    --primary-color: #2c2c2c;
    --secondary-color: #404040;
    --font-color: #e0e0e0;
    --accent-color: #29b6f6;
    --error-color: #e74c3c;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--font-color);
    line-height: 1.6;
    overflow: hidden; /* Empêche le défilement de la page entière */
}

#game-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
}

/* --- Nouvelle structure de l'en-tête --- */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--secondary-color);
    flex-shrink: 0; /* Empêche l'en-tête de rétrécir */
}

#top-left, #top-right {
    flex: 1;
}

#top-center {
    flex: 2;
    text-align: center;
}

/* --- Section Gauche : Boutons --- */
#controls {
    display: flex;
    gap: 10px;
}

button {
    padding: 0.8rem;
    font-size: 1.2rem;
    font-weight: bold;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    background-color: var(--secondary-color);
    color: var(--font-color);
    transition: transform 0.2s, background-color 0.2s;
    line-height: 1; /* Pour que les emojis soient bien centrés */
}

button:hover {
    transform: translateY(-2px);
    background-color: #555;
}

#reveal-lyrics {
    background-color: var(--error-color);
}

/* --- Section Centrale : Info Chanson --- */
header h1 {
    color: var(--accent-color);
    margin-bottom: 0.25rem;
    font-size: 1.8rem;
}

#song-info h2 {
    font-size: 1.2rem;
}

#song-info p {
    font-size: 0.9rem;
    color: #aaa;
}

#timer-container {
    margin-top: 0.5rem;
    font-size: 1rem;
    font-weight: bold;
    color: var(--accent-color);
}

/* --- Section Droite : Saisie et Score --- */
#top-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

#word-input {
    background-color: var(--secondary-color);
    color: var(--font-color);
    border: 1px solid var(--secondary-color);
    border-radius: 5px;
    padding: 0.8rem;
    font-size: 1.2rem;
    width: 100%;
    max-width: 300px;
    text-align: right;
    transition: border-color 0.3s;
}

#word-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

#score-container {
    font-size: 1.2rem;
    font-weight: bold;
}


/* --- Zone Principale (Paroles) --- */
main {
    flex-grow: 1; /* Prend TOUT l'espace vertical restant */
    overflow: hidden; /* Empêche le débordement */
    padding: 1.5rem 2rem;
    display: flex;
}

#lyrics-container {
    width: 100%;
    height: 100%;
    overflow-y: auto; /* Permet de défiler si les paroles sont longues */
    font-size: 1.1rem; /* Réduit (était 1.4rem) */
    line-height: 2.2;  /* Ajusté */
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: center;
    gap: 10px;         /* Ajusté */
    padding: 1rem;
    background-color: var(--primary-color);
    border-radius: 8px;
}

.word {
    white-space: pre;
    transition: all 0.3s ease;
}

.word.hidden {
    color: transparent;
    background-color: var(--secondary-color);
    border-radius: 5px;
    padding: 0.1em 0.5em;
    line-height: 1.6;
}


/* --- Fenêtre de recherche (Modale) --- */
/* (Le style de la modale reste inchangé) */
#search-modal {
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

#search-modal:not(.modal-hidden) {
    opacity: 1;
    visibility: visible;
}

#modal-content {
    background-color: var(--primary-color);
    padding: 2rem;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    position: relative;
    border: 1px solid var(--secondary-color);
    transform: scale(0.9);
    transition: transform 0.3s;
}

#search-modal:not(.modal-hidden) #modal-content {
    transform: scale(1);
}

#close-modal {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

#close-modal:hover, #close-modal:focus {
    color: var(--font-color);
}

#search-input {
    width: 100%;
    padding: 0.8rem;
    margin-bottom: 1rem;
    box-sizing: border-box;
    font-size: 1rem;
    background-color: var(--secondary-color);
    color: var(--font-color);
    border: 1px solid var(--secondary-color);
    border-radius: 5px;
}

#search-results {
    list-style-type: none;
    padding: 0;
    margin: 0;
    max-height: 40vh;
    overflow-y: auto;
}

#search-results li {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--secondary-color);
    cursor: pointer;
    text-align: left;
}

#search-results li:last-child {
    border-bottom: none;
}

#search-results li:hover {
    background-color: var(--accent-color);
    color: var(--bg-color);
}

#search-results .result-artist {
    opacity: 0.7;
    font-size: 0.9rem;
}
