* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #121212;
    color: #fff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh; 
    width: 100vw;
    overflow: hidden; 
    padding: 15px;
}

#app-container {
    position: relative;
    background: #1e1e1e;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.7);
    text-align: center;
    width: 95vw;
    max-width: 650px; 
    max-height: 96vh; 
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 15px;
}

#btn-home {
    position: absolute;
    top: 20px;
    left: 20px;
    background: #333;
    color: #fff;
    padding: 6px 12px;
    font-size: 0.85em;
    border-radius: 5px;
    text-decoration: none;
    border: 1px solid #444;
    z-index: 10;
}

h1 {
    color: #00ffcc;
    font-size: calc(1.3rem + 0.6vw);
    margin-top: 20px;
    margin-bottom: 5px;
}

.control-panel {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.toggle-group {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    font-size: 1.05em;
}

select {
    background: #333;
    color: white;
    border: 2px solid #00ffcc;
    padding: 6px 12px;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    outline: none;
}

#btn-spin {
    background: #ff007f;
    color: white;
    padding: 8px 24px;
    font-size: 1.05em;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(255, 0, 127, 0.3);
}
#btn-spin:disabled { background: #444; cursor: not-allowed; box-shadow: none; opacity: 0.5; }

#custom-panel {
    background: #151515;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #333;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.custom-input-row { display: flex; gap: 10px; }

#custom-input {
    flex: 1;
    background: #252525;
    border: 1px solid #555;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-weight: bold;
    outline: none;
}

#btn-add-custom {
    background: #00ffcc; color: #121212; border: none;
    padding: 8px 16px; border-radius: 4px; cursor: pointer; font-weight: bold;
}

#custom-items-list {
    max-height: 100px; overflow-y: auto; text-align: left;
    display: flex; flex-direction: column; gap: 6px; padding-right: 4px;
}

.custom-item {
    display: flex; justify-content: space-between; align-items: center;
    background: #252525; padding: 6px 10px; border-radius: 4px; font-size: 0.95em;
}

/* AJOUTÉ : Style pour l'édition en direct d'un choix inscrit */
.editable-name {
    flex: 1;
    padding: 2px 5px;
    border-radius: 3px;
    outline: none;
    transition: background 0.2s;
}
.editable-name:hover {
    background: #333;
    cursor: text;
    box-shadow: inset 0 0 0 1px #00ffcc;
}
.editable-name:focus {
    background: #111;
    box-shadow: inset 0 0 0 1px #ff007f;
}

.btn-del-item { background: transparent; border: none; cursor: pointer; font-size: 0.9em; }

.wheel-container {
    position: relative; width: 100%; max-width: 570px; margin: 0 auto;
    display: flex; justify-content: center;
}

#wheel-pointer {
    position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
    font-size: 28px; color: #ffcc00; z-index: 5;
}

canvas {
    width: 100%; max-width: min(550px, 52vh); aspect-ratio: 1 / 1;
    height: auto; border-radius: 50%; box-shadow: 0 4px 25px rgba(0,0,0,0.6); cursor: pointer;
}

#result-display { padding: 12px; background: #252525; border-radius: 8px; border: 2px dashed #00ffcc; }
#result-display p { font-size: 0.85em; color: #aaa; text-transform: uppercase; letter-spacing: 1px; }

/* MODIFIÉ : Animation et états pour le vainqueur cliquable (Redirection ou Règles) */
#game-winner { color: #ffcc00; font-size: 1.6em; margin-top: 3px; transition: color 0.2s, transform 0.2s; }

#game-winner.action-available {
    cursor: pointer;
    text-decoration: underline;
}
#game-winner.action-available:hover {
    color: #00ffcc;
    text-shadow: 0 0 12px rgba(0, 255, 204, 0.6);
    transform: scale(1.03);
}

/* AJOUTÉ : Styles de la fenêtre modale des règles */
.modal {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.85); display: flex; justify-content: center;
    align-items: center; z-index: 100; padding: 20px;
}
.modal-content {
    background: #1e1e1e; padding: 25px; border-radius: 12px;
    border: 2px solid #00ffcc; width: 100%; max-width: 450px;
    text-align: left; box-shadow: 0 5px 25px rgba(0,0,0,0.5);
}
#rules-modal-body h3 { color: #ffcc00; margin-bottom: 12px; font-size: 1.3em; border-bottom: 1px solid #333; padding-bottom: 5px; }
#rules-modal-body p { color: #ddd; font-size: 0.95em; line-height: 1.5; margin-bottom: 10px; }
#btn-close-rules {
    margin-top: 15px; width: 100%; padding: 10px; background: #ff007f;
    color: white; border: none; border-radius: 5px; font-weight: bold; cursor: pointer;
}

.hidden { display: none !important; }

@media (max-width: 480px) {
    #app-container { padding: 15px; gap: 10px; }
    .control-panel { flex-direction: column; gap: 8px; width: 100%; }
    .toggle-group, select, #btn-spin { width: 100%; text-align: center; }
    #btn-home { position: relative; top: 0; left: 0; margin: 0 auto 10px auto; width: fit-content; }
    h1 { margin-top: 0; }
}