:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --error-color: #ef4444;
    --bg-color: #0f172a;
    --bg-light: #1e293b;
    --bg-lighter: #334155;
    --text-color: #f1f5f9;
    --text-muted: #94a3b8;
    --border-radius: 16px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Confettis */
#confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #f0f;
    animation: confetti-fall 3s ease-out forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Conteneurs */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

.game-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 1rem;
}

/* Écrans */
.screen {
    display: none;
    min-height: 100vh;
    animation: fadeIn 0.5s ease;
}

.screen.active {
    display: block;
}

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

/* En-tête du jeu */
.game-header {
    text-align: center;
    padding: 3rem 0;
}

.game-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    animation: bounce 2s infinite;
}

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

.title {
    font-size: 3rem;
    font-weight: bold;
    background: linear-gradient(90deg, #fbbf24, #f59e0b, #fbbf24);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shine 3s linear infinite;
    margin-bottom: 0.5rem;
}

@keyframes shine {
    to {
        background-position: 200% center;
    }
}

.subtitle {
    font-size: 1.5rem;
    color: #fbbf24;
    margin-bottom: 1rem;
}

.description {
    font-size: 1.1rem;
    color: var(--text-color);
    opacity: 0.9;
}

/* Boutons */
.btn {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

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

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-secondary {
    background: var(--bg-lighter);
    color: var(--text-color);
}

.btn-guess {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    width: 100%;
    justify-content: center;
    font-size: 1.2rem;
    padding: 1.5rem;
    margin-top: 2rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(245, 87, 108, 0.7);
    }
    50% {
        box-shadow: 0 0 0 15px rgba(245, 87, 108, 0);
    }
}

.btn-icon {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* Menu */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 400px;
    margin: 2rem auto;
}

.menu-buttons .btn {
    width: 100%;
    justify-content: center;
}

/* Catégories */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.category-card {
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.category-card:hover {
    transform: translateY(-10px);
    border-color: #fbbf24;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.category-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.category-name {
    font-size: 1.3rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.category-count {
    color: var(--text-muted);
}

/* En-tête du jeu */
.game-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
}

.score-display {
    font-size: 1.2rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #fbbf24;
}

.progress-display {
    font-weight: 600;
}

/* Image du personnage */
.character-image-container {
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 1.5rem;
    text-align: center;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.character-silhouette {
    opacity: 0.5;
    animation: mysterious 3s ease-in-out infinite;
}

@keyframes mysterious {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.05);
    }
}

.character-image {
    max-width: 250px;
    border-radius: 50%;
    border: 5px solid #fbbf24;
    animation: reveal 0.8s ease;
}

@keyframes reveal {
    from {
        opacity: 0;
        transform: scale(0.8) rotate(-10deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

/* Indices */
.clues-section {
    background: rgba(16, 185, 129, 0.1);
    border-left: 4px solid var(--success-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
}

.clues-section h3 {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.clues-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.clue {
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    animation: slideIn 0.5s ease;
}

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

.clue-icon {
    color: #fbbf24;
    font-size: 1.2rem;
}

/* Questions */
.question-section {
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 1rem;
}

.question-header {
    margin-bottom: 1.5rem;
}

.question-header h3 {
    font-size: 1.3rem;
    line-height: 1.6;
}

.answers-container {
    display: grid;
    gap: 1rem;
}

.answer-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    color: var(--text-color);
    padding: 1.2rem;
    border-radius: 12px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.answer-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--primary-color);
    transform: translateX(10px);
}

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

.answer-btn.correct {
    background: var(--success-color) !important;
    border-color: var(--success-color) !important;
    animation: correctShake 0.5s ease;
}

.answer-btn.incorrect {
    background: var(--error-color) !important;
    border-color: var(--error-color) !important;
    animation: incorrectShake 0.5s ease;
}

@keyframes correctShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(10px) scale(1.05); }
    75% { transform: translateX(-10px) scale(1.05); }
}

@keyframes incorrectShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Modales */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 2.5rem;
    border-radius: var(--border-radius);
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow);
    animation: modalSlide 0.4s ease;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-content h3 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-content input {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    border: none;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
}

.modal-buttons .btn {
    flex: 1;
    justify-content: center;
}

/* Paramètres */
.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.setting-item label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.setting-item select {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    font-size: 1rem;
    cursor: pointer;
}

/* Switch toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--success-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* Utilities */
.mt-2 {
    margin-top: 2rem;
}

.mb-2 {
    margin-bottom: 2rem;
}

.text-center {
    text-align: center;
}

.success-text {
    color: var(--success-color);
}

.error-text {
    color: var(--error-color);
}

/* Responsive */
@media (max-width: 768px) {
    .title {
        font-size: 2rem;
    }
    
    .categories-grid {
        grid-template-columns: 1fr;
    }
    
    .game-container {
        padding: 0.5rem;
    }
    
    .modal-content {
        padding: 1.5rem;
    }
    
    .modal-buttons {
        flex-direction: column;
    }
}

/* ========================================
   MODE SELECTION
   ======================================== */

.mode-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 3rem 0;
}

.mode-card {
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.mode-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
    transform: rotate(45deg);
    transition: all 0.6s ease;
}

.mode-card:hover::before {
    left: 100%;
}

.mode-card:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: #fbbf24;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.mode-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: float 3s ease-in-out infinite;
}

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

.mode-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #fbbf24;
}

.mode-card p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.mode-badge {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* ========================================
   FLASHCARDS
   ======================================== */

.flashcard-container {
    perspective: 1000px;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 0;
    cursor: pointer;
}

.flashcard {
    width: 100%;
    max-width: 600px;
    height: 450px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s;
}

.flashcard.flipped {
    transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--border-radius);
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.flashcard-front {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.flashcard-back {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    transform: rotateY(180deg);
}

.flashcard-question {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 2rem;
    text-align: center;
}

.flashcard-clues {
    list-style: none;
    padding: 0;
    width: 100%;
}

.flashcard-clues li {
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem;
    margin: 0.5rem 0;
    border-radius: 8px;
    border-left: 4px solid #fbbf24;
}

.flashcard-hint {
    margin-top: 2rem;
    opacity: 0.7;
    font-style: italic;
    animation: pulse-hint 2s infinite;
}

@keyframes pulse-hint {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.flashcard-answer {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 2rem;
    text-align: center;
    animation: reveal 0.6s ease;
}

@keyframes reveal {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.flashcard-anecdote {
    text-align: center;
    font-size: 1.1rem;
    line-height: 1.6;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
}

.flashcard-progress {
    font-size: 1.2rem;
    font-weight: bold;
    color: #fbbf24;
}

.flashcard-controls {
    display: flex;
    gap: 0.5rem;
}

.flashcard-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 2rem 0;
}

.flashcard-actions .btn {
    flex: 1;
    max-width: 150px;
}

.btn-error {
    background: var(--error-color);
    color: white;
}

.btn-warning {
    background: #f59e0b;
    color: white;
}

.flashcard-navigation {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.flashcard-navigation .btn {
    min-width: 150px;
}

/* ========================================
   MODE RÉVISION
   ======================================== */

.revision-card {
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 3rem;
    margin: 2rem 0;
}

.revision-question {
    font-size: 1.8rem;
    margin-bottom: 2rem;
    text-align: center;
    line-height: 1.6;
}

.revision-input-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.revision-input-container input {
    flex: 1;
    padding: 1.2rem;
    font-size: 1.2rem;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.revision-input-container input:focus {
    outline: none;
    border-color: #fbbf24;
}

.revision-feedback {
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    text-align: center;
    display: none;
}

.revision-feedback.correct {
    background: rgba(16, 185, 129, 0.2);
    border-left: 4px solid var(--success-color);
    display: block;
    animation: slideIn 0.5s ease;
}

.revision-feedback.wrong {
    background: rgba(239, 68, 68, 0.2);
    border-left: 4px solid var(--error-color);
    display: block;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.revision-hint {
    padding: 1rem;
    background: rgba(251, 191, 36, 0.1);
    border-radius: 8px;
    border-left: 4px solid #fbbf24;
    display: none;
}

.revision-hint.show {
    display: block;
    animation: slideIn 0.5s ease;
}

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

.stat-box {
    background: rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: #fbbf24;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.revision-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #fbbf24);
    transition: width 0.3s ease;
    width: 0%;
}

/* ========================================
   RESPONSIVE FLASHCARDS
   ======================================== */

@media (max-width: 768px) {
    .mode-selection {
        grid-template-columns: 1fr;
    }
    
    .flashcard {
        height: 400px;
    }
    
    .flashcard-front,
    .flashcard-back {
        padding: 2rem;
    }
    
    .flashcard-answer {
        font-size: 2rem;
    }
    
    .flashcard-actions {
        flex-direction: column;
    }
    
    .flashcard-actions .btn {
        max-width: 100%;
    }
    
    .flashcard-navigation {
        flex-direction: column;
    }
    
    .flashcard-navigation .btn {
        width: 100%;
    }
    
    .revision-input-container {
        flex-direction: column;
    }
    
    .revision-stats {
        grid-template-columns: 1fr;
    }
}
