@import url('https://fonts.googleapis.com/css2?family=Carter+One&display=swap');

* {
    box-sizing: border-box;
}

body {
    font-family: 'Carter One', sans-serif;
    background-color: #0c0c0c;
    color: #e6e6e6;
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Menu dépliant des meilleurs scores (style calqué sur le panneau de chaosballs) */
#toggle-scores {
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 100;
    background-color: rgba(52, 51, 54, 0.9);
    color: #fff;
    border: 1px solid #58575c;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Carter One', sans-serif;
    transition: background-color 0.3s;
}

#toggle-scores:hover {
    background-color: #58575c;
}

#toggle-scores:focus-visible {
    outline: 2px solid #4da6ff;
    outline-offset: 2px;
}

#scores-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background-color: #343336;
    border-radius: 0 8px 8px 0;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    padding: 70px 20px 20px 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    z-index: 50;
    transition: transform 0.3s ease;
}

#scores-panel.closed {
    transform: translateX(-100%);
}

#scores-panel h2 {
    margin: 0 0 15px;
    font-size: 1.2rem;
    text-align: center;
    color: #fff;
    border-bottom: 2px solid #58575c;
    padding-bottom: 10px;
}

#scores-list {
    flex: 1;
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

#scores-list li {
    display: flex;
    justify-content: space-between;
    background-color: #0c0c0c;
    border: 1px solid #58575c;
    border-radius: 5px;
    padding: 8px 12px;
}

#scores-list .rank {
    color: #4da6ff;
}

#scores-empty {
    color: #999;
    text-align: center;
}

/* Bouton retour, en bas du menu des scores */
#scores-panel .back-link {
    align-self: flex-start;
    margin-top: 15px;
    background-color: #0c0c0c;
    color: #e6e6e6;
    border: 1px solid #58575c;
    padding: 10px 15px;
    border-radius: 5px;
    text-decoration: none;
    transition: background-color 0.3s, color 0.3s;
}

#scores-panel .back-link:hover {
    background-color: #58575c;
    color: #fff;
}

#scores-panel .back-link:focus-visible {
    outline: 2px solid #4da6ff;
    outline-offset: 2px;
}

.game-wrapper {
    width: 90%;
    max-width: 800px;
}

h1 {
    margin: 0 0 10px;
    text-align: center;
    font-size: 1.8rem;
    color: #fff;
}

.hud {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.game-panel {
    position: relative;
    background-color: #343336;
    border: 2px solid #1800c9;
    border-radius: 8px;
    overflow: hidden;
    touch-action: none; /* le tap fait sauter : il ne doit pas faire défiler la page */
}

#game-canvas {
    display: block;
    width: 100%;
    height: auto;
}

/* Écrans ready / game over, par-dessus le canvas */
.overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    text-align: center;
    background-color: rgba(12, 12, 12, 0.75);
}

.overlay-title {
    margin: 0;
    font-size: 1.6rem;
    color: #fff;
}

#overlay-text {
    margin: 0;
}

.overlay-score {
    margin: 0;
    color: #4da6ff;
}

.hidden {
    display: none;
}
