* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    /* Ne pas centrer toute la page verticalement pour que le reste soit sous le pli */
    display: block;
    overflow-x: hidden;
    color: #333;
}

.container {
    max-width: 800px;
    width: 100%;
    padding: 20px;
    text-align: center;
    margin: 0 auto; /* centrer horizontalement */
}

header {
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

.wheel-container {
    background: white;
    border-radius: 20px;
    padding: 24px 24px 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    position: relative;
    
    /* Laisser la hauteur s'adapter au contenu pour afficher aussi la carte résultat */
    min-height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px; /* rapprocher la roue du bouton */
}

.wheel-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: 0; /* le bouton est sous la roue via flex */
}

#wheelCanvas {
    border-radius: 50%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    transition: transform 0.1s ease;
    /* Agrandir la roue sur desktop pour mieux remplir l'espace */
    width: 520px;  /* un peu plus grande */
    height: 520px;
}

.wheel-pointer {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 25px solid #ff6b6b;
    z-index: 10;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.spin-button {
    background: linear-gradient(45deg, #ff6b6b, #ffa500);
    border: none;
    border-radius: 50px;
    padding: 14px 28px; /* légèrement plus compact */
    font-size: 1.2rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
    font-family: 'Poppins', sans-serif;
    align-self: center; /* bouton bien centré sous la roue */
}

.spin-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.6);
}

.spin-button:active {
    transform: translateY(0);
}

.spin-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.result-container {
    margin-top: 14px; /* rapprocher le résultat */
    margin-bottom: 30px;
}

.result-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border-left: 5px solid #4ecdc4;
}

.result-card h2 {
    color: #4ecdc4;
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.result-card p {
    font-size: 1.3rem;
    font-weight: 500;
    color: #333;
    line-height: 1.4;
}

.controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.control-btn {
    background: white;
    border: 2px solid #667eea;
    border-radius: 25px;
    padding: 12px 25px;
    font-size: 1rem;
    font-weight: 500;
    color: #667eea;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
}

.control-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 15px;
}

.close:hover {
    color: #000;
}

.modal-content h2 {
    margin-bottom: 25px;
    color: #333;
    text-align: center;
}

.add-constraint {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.add-constraint input {
    flex: 1;
    min-width: 200px;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
}

.add-constraint select {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    background: white;
}

.add-constraint button {
    padding: 12px 20px;
    background: #4ecdc4;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s ease;
    font-family: 'Poppins', sans-serif;
}

.add-constraint button:hover {
    background: #45b7b8;
}

.constraints-list h3 {
    margin-bottom: 15px;
    color: #333;
    text-align: left;
}

.constraint-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #4ecdc4;
}

.constraint-text {
    flex: 1;
    text-align: left;
}

.constraint-category {
    background: #667eea;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    margin-right: 10px;
}

.delete-btn {
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.3s ease;
}

.delete-btn:hover {
    background: #ff5252;
}

/* Styles pour la gestion des listes */
.list-management {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

.list-management h3 {
    margin-bottom: 15px;
    color: #333;
    text-align: left;
}

.save-load-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.save-load-controls input,
.save-load-controls select {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: 'Poppins', sans-serif;
    background: white;
}

.save-load-controls input {
    flex: 1;
    min-width: 150px;
}

.save-load-controls select {
    min-width: 200px;
}

.save-load-controls button {
    padding: 8px 15px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s ease;
    font-family: 'Poppins', sans-serif;
    white-space: nowrap;
}

.save-load-controls button:hover {
    background: #5a6fd8;
}

#savedListsInfo {
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
}

/* Animations */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spinning {
    animation: spin linear;
}

.result-appear {
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .wheel-container {
        padding: 20px;
        /* Sur mobile, occuper presque tout l'écran malgré un header plus compact */
        min-height: calc(100vh - 140px);
    }
    
    #wheelCanvas {
        width: 320px; /* un peu plus grande sur mobile moderne */
        height: 320px;
        margin: 0 auto;
    }
    
    .add-constraint {
        flex-direction: column;
        margin-top: 20px;
    }
    
    .add-constraint input,
    .add-constraint select {
        min-width: auto;
    }
    
    .save-load-controls {
        flex-direction: column;
    }
    
    .save-load-controls input,
    .save-load-controls select,
    .save-load-controls button {
        width: 100%;
        min-width: auto;
    }
}
