/* Police d'importation Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&family=Dancing+Script:wght@700&display=swap');

:root {
    --primary-red: #DC143C;
    --primary-gold: #FFD700;
    --secondary-gold: #FFA500;
    --dark-red: #8B0000;
    --light-gold: #FFEC8B;
    --white: #FFFFFF;
    --bg-dark: #1a0505;
    --text-dark: #2C1810;
}

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

body {
    font-family: 'Montserrat', sans-serif;
    background: linear-gradient(135deg, var(--dark-red) 0%, var(--primary-red) 100%);
    min-height: 100vh;
    color: var(--text-dark);
    overflow-x: hidden;
    position: relative;
}

/* Motif de fond vietnamien */
.background-pattern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.05;
    background-image: 
        repeating-linear-gradient(45deg, transparent, transparent 50px, var(--primary-gold) 50px, var(--primary-gold) 51px),
        repeating-linear-gradient(-45deg, transparent, transparent 50px, var(--primary-gold) 50px, var(--primary-gold) 51px);
    pointer-events: none;
    z-index: 0;
}

/* Dragons en arrière-plan sur les côtés */
.dragon-background {
    position: fixed;
    pointer-events: none;
    z-index: 0;
    opacity: 0.6;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.5));
}

.dragon-left {
    top: 20%;
    left: 2%;
    width: 150px;
    height: auto;
    animation: floatDragon 20s ease-in-out infinite;
}

.dragon-right {
    top: 20%;
    right: 2%;
    width: 150px;
    height: auto;
    animation: floatDragon 20s ease-in-out infinite 1s;
}

@keyframes floatDragon {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-30px);
    }
}

.container {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* En-tête */
header {
    text-align: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, var(--primary-gold) 0%, var(--secondary-gold) 100%);
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    margin-bottom: 20px;
    border: 4px solid var(--primary-red);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.header-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.envelope-left,
.envelope-right {
    font-size: 3em;
    animation: envelopePulse 2s ease-in-out infinite;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.envelope-left {
    animation-delay: 0s;
}

.envelope-right {
    animation-delay: 1s;
}

@keyframes envelopePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.title {
    font-family: 'Dancing Script', cursive;
    font-size: 2em;
    color: var(--primary-red);
    text-shadow: 3px 3px 0px rgba(0, 0, 0, 0.2);
    margin-bottom: 5px;
    letter-spacing: 2px;
}

.subtitle {
    font-size: 0.9em;
    color: var(--dark-red);
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.5);
}

/* Contenu principal */
.main-content {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 15px;
    margin-bottom: 40px;
}

/* Section de la roue */
.wheel-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
    border: 3px solid var(--primary-gold);
    position: relative;
    overflow: visible;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* Icône musique dans le coin du bloc */
.music-icon {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 35px;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    user-select: none;
}

.music-icon:hover {
    transform: scale(1.1);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

.music-icon:active {
    transform: scale(0.95);
}

/* Image de fleurs sous la roue */
.flowers-decoration {
    position: absolute;
    bottom: 0px;
    max-width: 1000px;
    width: 100%;
    height: auto;
    margin-top: 10px;
}

/* Fleurs d'abricotiers décoratives autour de la roue */

@keyframes blossomFloat {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
        opacity: 0.9;
    }
    50% {
        transform: translateY(-10px) rotate(5deg);
        opacity: 1;
    }
}

.wheel-container {
    position: relative;
    width: 700px;
    height: 700px;
    margin: 0 auto 30px;
}

.wheel-pointer {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 50px;
    color: var(--primary-red);
    z-index: 10;
    filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.3));
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(10px); }
}

#wheelCanvas {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.3));
}

.wheel-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    transition: transform 0.3s ease;
}

.wheel-center.spinning {
    transform: translate(-50%, -50%) scale(0.5);
}

/* Bouton central - Simple et fonctionnel */
.spin-button {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-gold) 0%, var(--secondary-gold) 100%);
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    color: var(--dark-red);
    /* Bordure simulée avec box-shadow pour qu'elle se scale correctement */
    box-shadow: 
        0 0 0 5px var(--primary-red),
        0 5px 20px rgba(0, 0, 0, 0.3);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

.spin-button:disabled {
    cursor: not-allowed;
}

.button-text {
    text-align: center;
    line-height: 1.3;
    transition: opacity 0.3s ease;
}

.spin-button:disabled .button-text {
    opacity: 0;
}

/* Contrôles */
.controls {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid var(--primary-gold);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 14px;
}

.input-group input {
    padding: 12px 16px;
    border: 2px solid var(--primary-gold);
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    width: 150px;
    text-align: center;
}

.reset-button, .clear-button, .music-button {
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--primary-red) 0%, var(--dark-red) 100%);
    color: var(--white);
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.music-button {
    padding: 10px 14px;
    background: linear-gradient(135deg, var(--primary-gold) 0%, var(--secondary-gold) 100%);
    color: var(--dark-red);
    font-size: 22px;
    min-width: auto;
}

.music-button.muted {
    background: linear-gradient(135deg, #888 0%, #666 100%);
    color: var(--white);
}

.reset-button:hover, .clear-button:hover, .music-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Section des résultats */
.results-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
    border: 3px solid var(--primary-gold);
    display: flex;
    flex-direction: column;
}

.results-section h2 {
    text-align: center;
    color: var(--primary-red);
    margin-bottom: 10px;
    font-size: 1.1em;
}

.winner-stats {
    text-align: center;
    font-size: 0.9em;
    font-weight: 700;
    color: var(--dark-red);
    background: var(--light-gold);
    padding: 8px;
    border-radius: 8px;
    margin-bottom: 10px;
}

#winnerCount {
    font-size: 1.2em;
    color: var(--primary-red);
}

.winners-list {
    flex: 1;
    overflow-y: auto;
    max-height: 550px;
    padding: 8px;
    background: #FFF9E6;
    border-radius: 8px;
    margin-bottom: 10px;
}

.empty-message {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 30px;
}

.winner-item {
    background: linear-gradient(135deg, var(--primary-gold) 0%, var(--light-gold) 100%);
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    border: 2px solid var(--secondary-gold);
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideIn 0.5s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.winner-number {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--primary-red);
    min-width: 50px;
}

.winner-time {
    font-size: 0.75em;
    color: var(--text-dark);
    opacity: 0.8;
}

.clear-button {
    width: 100%;
}

/* Animation de célébration */
.celebration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.celebration.hidden {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.celebration-content {
    background: linear-gradient(135deg, var(--primary-gold) 0%, var(--secondary-gold) 100%);
    padding: 60px 80px;
    border-radius: 30px;
    text-align: center;
    border: 6px solid var(--primary-red);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: scaleIn 0.5s ease;
    position: relative;
    overflow: hidden;
}

/* Décoration florale dans la modale de célébration */
.celebration-content::before,
.celebration-content::after {
    content: '🌺';
    position: absolute;
    font-size: 100px;
    opacity: 0.2;
    animation: spin 4s linear infinite;
}

.celebration-content::before {
    top: -20px;
    left: -20px;
}

.celebration-content::after {
    bottom: -20px;
    right: -20px;
    animation-direction: reverse;
}

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

@keyframes scaleIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.celebration-title {
    font-size: 3em;
    color: var(--primary-red);
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.winning-number {
    font-size: 5em;
    font-weight: 700;
    color: var(--dark-red);
    margin: 30px 0;
    text-shadow: 3px 3px 0px rgba(0, 0, 0, 0.1);
}

.celebration-message {
    font-size: 1.8em;
    color: var(--primary-red);
    font-weight: 600;
    font-style: italic;
}

/* Canvas confettis */
#confettiCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1001;
}

/* Responsive */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .results-section {
        max-width: 600px;
        margin: 0 auto;
    }
}

@media (max-width: 600px) {
    .title {
        font-size: 2em;
    }
    
    .envelope-left,
    .envelope-right {
        display: none;
    }
    
    header {
        gap: 10px;
        padding: 10px 15px;
        justify-content: center;
    }
    
    .wheel-container {
        width: 100%;
        height: auto;
        aspect-ratio: 1;
        max-width: 400px;
    }
    
    #wheelCanvas {
        width: 100%;
        height: auto;
    }
    
    .wheel-section {
        padding: 20px;
    }
    
    .celebration-content {
        padding: 20px 25px;
        margin: 0 15px;
        max-width: calc(100vw - 30px);
    }
    
    .celebration-content::before,
    .celebration-content::after {
        font-size: 60px;
    }
    
    .celebration-title {
        font-size: 1.5em;
        margin-bottom: 15px;
    }
    
    .winning-number {
        font-size: 2.5em;
        margin: 15px 0;
    }
    
    .celebration-message {
        font-size: 1.1em;
    }
}

