/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.app {
    max-width: 400px;
    margin: 0 auto;
    min-height: 100vh;
    background: white;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    text-align: center;
    padding: 2rem 1rem 1.5rem;
}

.header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.header p {
    opacity: 0.9;
    font-size: 0.9rem;
}

/* Main */
.main {
    padding: 1rem;
    flex: 1;
}

/* Screens */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* Menu principal */
.menu h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #374151;
}

.game-modes {
    display: grid;
    gap: 1rem;
    margin-bottom: 2rem;
}

.mode-btn {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
    flex-direction: row;
}

.mode-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.mode-btn:active {
    transform: translateY(0);
}

.mode-btn.special {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.mode-icon {
    font-size: 1.5rem;
    margin-right: 1rem;
}

.mode-title {
    font-weight: 600;
}

.mode-subtitle {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

.mode-btn.special .mode-subtitle {
    color: rgba(255, 255, 255, 0.8);
}

.mode-btn .mode-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

/* Boutons */
.primary-btn, .secondary-btn, .danger-btn {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.primary-btn {
    background: #2563eb;
    color: white;
}

.primary-btn:hover {
    background: #1d4ed8;
}

.secondary-btn {
    background: #f3f4f6;
    color: #374151;
    margin-top: 1rem;
}

.secondary-btn:hover {
    background: #e5e7eb;
}

.danger-btn {
    background: #ef4444;
    color: white;
    margin-top: 2rem;
}

.danger-btn:hover {
    background: #dc2626;
}

.back-btn {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.5rem;
    margin-bottom: 1rem;
}

.back-btn:hover {
    color: #374151;
}

/* Quiz */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 0 0.5rem;
}

.quiz-info {
    font-weight: 600;
    color: #374151;
}

.score {
    font-weight: 600;
    color: #059669;
}

.question-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.question-card h3 {
    color: #374151;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.product-info {
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    border-radius: 8px;
    padding: 1rem;
}

.product-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.product-range {
    font-size: 0.9rem;
    color: #6b7280;
    font-weight: 500;
}

.answers {
    display: grid;
    gap: 0.75rem;
}

.answer-btn {
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-size: 1rem;
}

.answer-btn:hover {
    border-color: #2563eb;
    background: #f0f9ff;
}

.answer-btn.correct {
    background: #10b981;
    color: white;
    border-color: #059669;
}

.answer-btn.incorrect {
    background: #ef4444;
    color: white;
    border-color: #dc2626;
}

.answer-btn.disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

/* Choix multiples */
.choice-container {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.choice-container:hover {
    border-color: #2563eb;
    background: #f0f9ff;
}

.choice-container.correct {
    background: #10b981;
    color: white;
    border-color: #059669;
}

.choice-container.incorrect {
    background: #ef4444;
    color: white;
    border-color: #dc2626;
}

.choice-container input[type="checkbox"] {
    margin-right: 1rem;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.choice-container label {
    flex: 1;
    cursor: pointer;
    font-size: 1rem;
}

.validate-btn {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 8px;
    background: #2563eb;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 1rem;
}

.validate-btn:hover:not(:disabled) {
    background: #1d4ed8;
}

.validate-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

/* Résultats */
.results-content {
    text-align: center;
    padding: 2rem 1rem;
}

.results-content h2 {
    color: #374151;
    margin-bottom: 2rem;
}

.final-score {
    margin-bottom: 2rem;
}

.score-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 auto 1rem;
}

.score-percentage {
    font-size: 2rem;
    font-weight: 700;
    color: #059669;
}

.score-message {
    font-size: 1.1rem;
    color: #6b7280;
    margin-bottom: 2rem;
}

.results-actions {
    display: grid;
    gap: 1rem;
}

/* Historique */
.history-header {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
}

.history-header h2 {
    color: #374151;
    margin-left: 1rem;
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-item {
    text-align: center;
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #2563eb;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.8rem;
    color: #6b7280;
}

/* Statistiques par gamme */
.range-stats {
    margin-bottom: 2rem;
}

.range-stats h3 {
    color: #374151;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.range-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.range-stat-item {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    text-align: center;
    border-left: 4px solid #e5e7eb;
}

.range-stat-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.range-stat-icon {
    margin-right: 0.5rem;
    font-size: 1.1rem;
}

.range-stat-percentage {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.range-stat-games {
    font-size: 0.75rem;
    color: #6b7280;
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.history-date {
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.history-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-mode {
    font-weight: 600;
    color: #374151;
}

.history-score {
    font-weight: 700;
    color: #059669;
}

/* Responsive */
@media (min-width: 768px) {
    .app {
        max-width: 500px;
    }
    
    .game-modes {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .answers {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Animation d'entrée */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.screen.active {
    animation: fadeIn 0.3s ease;
}

/* États de chargement */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* À propos */
.about-header, .products-header {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
}

.about-header h2, .products-header h2 {
    color: #374151;
    margin-left: 1rem;
}

.about-content, .products-content {
    padding: 0 0.5rem;
}

.about-section {
    margin-bottom: 2rem;
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.about-section h3 {
    color: #2563eb;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.about-section p {
    color: #374151;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.about-section ul {
    padding-left: 1rem;
    margin-bottom: 1rem;
}

.about-section li {
    color: #374151;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.about-footer {
    text-align: center;
    margin-top: 2rem;
}

.about-footer p {
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.about-signature {
    font-style: italic;
    font-size: 0.9rem;
}

.privacy-note {
    background: #f0f9ff;
    border-left: 4px solid #0369a1;
    padding: 1rem;
    border-radius: 0 8px 8px 0;
    margin-top: 1rem;
}

.privacy-note p {
    margin: 0;
    color: #0369a1;
    font-size: 0.9rem;
}

/* Liste des produits */
.products-intro {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.products-intro p {
    color: #374151;
    text-align: center;
    margin: 0;
}

.contact-notice {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    margin: 1.5rem 0;
    text-align: left;
}

.contact-notice p {
    margin: 0.5rem 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #374151;
}

.contact-notice p:first-child {
    margin-bottom: 0.8rem;
}

.contact-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.contact-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* Section développement professionnel */
.business-offer {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1rem 0;
}

.business-offer ul {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.business-offer li {
    margin: 0.5rem 0;
    line-height: 1.4;
}

.contact-cta {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1.5rem;
    border-left: 4px solid #2563eb;
}

.contact-cta p {
    margin: 0.5rem 0;
    font-size: 0.95rem;
}

.contact-cta .contact-link {
    font-weight: 600;
}

.range-section {
    margin-bottom: 2rem;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.range-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border-left: 4px solid;
    display: flex;
    align-items: center;
}

.range-icon {
    font-size: 1.5rem;
    margin-right: 1rem;
}

.range-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0;
}

.range-count {
    font-size: 0.9rem;
    color: #6b7280;
    margin-left: auto;
}

.products-grid {
    padding: 1.5rem;
    display: grid;
    gap: 1rem;
}

.product-item {
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fafafa;
}

.product-name {
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.product-flavors {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.flavor-tag {
    background: #e0f2fe;
    color: #0369a1;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Footer */
.footer {
    background: linear-gradient(135deg, #374151, #1f2937);
    color: white;
    text-align: center;
    padding: 1.5rem 1rem;
    margin-top: auto;
}

.footer-content p {
    margin: 0;
    font-size: 0.9rem;
}

.footer-content p:first-child {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.footer-subtitle {
    opacity: 0.8;
    font-size: 0.8rem !important;
}

.footer-link {
    color: white;
    text-decoration: none;
}

.footer-link:hover {
    text-decoration: underline;
}

/* Bouton d'installation PWA */
.install-btn {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 1rem;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.install-btn:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* Animation confettis pour score parfait */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #f39c12;
}

/* Confettis avec mouvement oscillant */
.confetti-1 { animation: confetti-fall-1 6s linear forwards; }
.confetti-2 { animation: confetti-fall-2 5s linear forwards; }
.confetti-3 { animation: confetti-fall-3 7s linear forwards; }
.confetti-4 { animation: confetti-fall-4 5.6s linear forwards; }
.confetti-5 { animation: confetti-fall-5 6.4s linear forwards; }

@keyframes confetti-fall-1 {
    0% {
        transform: translateY(-120px) translateX(0) rotate(0deg);
        opacity: 1;
    }
    25% {
        transform: translateY(25vh) translateX(20px) rotate(90deg);
    }
    50% {
        transform: translateY(50vh) translateX(-10px) rotate(180deg);
    }
    75% {
        transform: translateY(75vh) translateX(15px) rotate(270deg);
    }
    100% {
        transform: translateY(calc(100vh + 50px)) translateX(-5px) rotate(360deg);
        opacity: 0;
    }
}

@keyframes confetti-fall-2 {
    0% {
        transform: translateY(-120px) translateX(0) rotate(0deg);
        opacity: 1;
    }
    25% {
        transform: translateY(20vh) translateX(-15px) rotate(120deg);
    }
    50% {
        transform: translateY(45vh) translateX(25px) rotate(240deg);
    }
    75% {
        transform: translateY(70vh) translateX(-20px) rotate(360deg);
    }
    100% {
        transform: translateY(calc(100vh + 50px)) translateX(10px) rotate(480deg);
        opacity: 0;
    }
}

@keyframes confetti-fall-3 {
    0% {
        transform: translateY(-120px) translateX(0) rotate(0deg);
        opacity: 1;
    }
    30% {
        transform: translateY(30vh) translateX(30px) rotate(180deg);
    }
    60% {
        transform: translateY(60vh) translateX(-25px) rotate(360deg);
    }
    100% {
        transform: translateY(calc(100vh + 50px)) translateX(20px) rotate(540deg);
        opacity: 0;
    }
}

@keyframes confetti-fall-4 {
    0% {
        transform: translateY(-120px) translateX(0) rotate(0deg);
        opacity: 1;
    }
    20% {
        transform: translateY(15vh) translateX(-20px) rotate(90deg);
    }
    40% {
        transform: translateY(35vh) translateX(35px) rotate(180deg);
    }
    60% {
        transform: translateY(55vh) translateX(-15px) rotate(270deg);
    }
    80% {
        transform: translateY(80vh) translateX(25px) rotate(360deg);
    }
    100% {
        transform: translateY(calc(100vh + 50px)) translateX(-10px) rotate(450deg);
        opacity: 0;
    }
}

@keyframes confetti-fall-5 {
    0% {
        transform: translateY(-120px) translateX(0) rotate(0deg);
        opacity: 1;
    }
    33% {
        transform: translateY(25vh) translateX(40px) rotate(240deg);
    }
    66% {
        transform: translateY(65vh) translateX(-30px) rotate(480deg);
    }
    100% {
        transform: translateY(calc(100vh + 50px)) translateX(15px) rotate(720deg);
        opacity: 0;
    }
}

/* Variantes de formes pour plus de diversité */
.confetti.square {
    border-radius: 0;
}

.confetti.circle {
    border-radius: 50%;
}

.confetti.triangle {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 10px solid;
}

/* Animation de pulsation pour le score parfait */
.perfect-score {
    animation: perfect-pulse 0.6s ease-in-out 3;
}

@keyframes perfect-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 20px rgba(46, 204, 113, 0.6);
    }
}
