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

:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --error-color: #ef4444;
    --bg-gradient-start: #0f172a;
    --bg-gradient-end: #1e293b;
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    
    /* Couleurs des énergies */
    --color-eau: #1e40af;
    --color-soleil: #fbbf24;
    --color-vegetaux: #22c55e;
    --color-terre: #dc2626;
    --color-vent: #ec4899;
    --color-mer: #06b6d4;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
    position: relative;
}

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

/* Écrans */
.screen {
    display: none;
    opacity: 0;
    transform: translateY(30px);
}

.screen.active {
    display: block;
    animation: slideUpFadeIn 0.6s ease forwards;
}

@keyframes slideUpFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOutUp {
    to {
        opacity: 0;
        transform: translateY(-50px);
    }
}

/* Écran de démarrage */
#start-screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

/* Écran du quiz */
#quiz-screen {
    min-height: 100vh;
    padding: 40px 0;
}

#quiz-screen.active {
    animation: slideUpFadeIn 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.logo-container {
    margin-bottom: 50px;
}

.energy-icon {
    font-size: 100px;
    animation: pulse 2s ease-in-out infinite;
    margin-bottom: 20px;
    filter: drop-shadow(0 0 20px rgba(99, 102, 241, 0.5));
}

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

.title {
    font-size: 3.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
    animation: slideDown 0.8s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

.form-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 400px;
}

input[type="text"] {
    padding: 18px 25px;
    font-size: 1.1rem;
    border: 2px solid var(--card-border);
    border-radius: 15px;
    background: var(--card-bg);
    color: var(--text-primary);
    outline: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

input[type="text"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

input[type="text"]::placeholder {
    color: var(--text-secondary);
}

.btn-primary {
    padding: 18px 40px;
    font-size: 1.2rem;
    font-weight: 600;
    border: none;
    border-radius: 15px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-primary:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover:before {
    left: 100%;
}

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

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

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Header du quiz */
.header {
    margin-bottom: 30px;
    animation: slideDown 0.6s ease forwards;
    animation-delay: 0.1s;
    opacity: 0;
    transform: translateY(-20px);
}

@keyframes slideDown {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.progress-container {
    width: 100%;
    height: 8px;
    background: var(--card-bg);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 20px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    width: 0%;
    transition: width 0.5s ease;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

.score-display {
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Question card */
.question-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 25px;
    padding: 40px;
    backdrop-filter: blur(10px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: scaleIn 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: 0.2s;
    opacity: 0;
    transform: scale(0.9);
}

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

.question {
    font-size: 1.8rem;
    margin-bottom: 40px;
    text-align: center;
    color: var(--text-primary);
}

/* Matching container */
.matching-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
    min-height: 400px;
}

.sources-column,
.targets-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.source-item,
.target-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease, opacity 0.5s ease;
    position: relative;
    opacity: 0;
    transform: translateX(-20px);
    animation: slideInItem 0.5s ease forwards;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-width: 0;
}

@keyframes slideInItem {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

.source-item {
    justify-content: flex-start;
}

.target-item {
    justify-content: flex-end;
    transform: translateX(20px);
}

.source-item:nth-child(1) { animation-delay: 0.5s; }
.source-item:nth-child(2) { animation-delay: 0.6s; }
.source-item:nth-child(3) { animation-delay: 0.7s; }
.source-item:nth-child(4) { animation-delay: 0.8s; }
.source-item:nth-child(5) { animation-delay: 0.9s; }
.source-item:nth-child(6) { animation-delay: 1s; }

.target-item:nth-child(1) { animation-delay: 0.5s; }
.target-item:nth-child(2) { animation-delay: 0.6s; }
.target-item:nth-child(3) { animation-delay: 0.7s; }
.target-item:nth-child(4) { animation-delay: 0.8s; }
.target-item:nth-child(5) { animation-delay: 0.9s; }
.target-item:nth-child(6) { animation-delay: 1s; }

.source-item:hover,
.target-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(5px);
}

.target-item:hover {
    transform: translateX(-5px);
}

.source-item.selected {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.target-item.selected {
    border-color: var(--secondary-color);
    background: rgba(139, 92, 246, 0.1);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}

.source-item.correct,
.target-item.correct {
    border-color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
    animation: correctPulse 0.6s ease;
}

.source-item.incorrect,
.target-item.incorrect {
    border-color: var(--error-color);
    background: rgba(239, 68, 68, 0.1);
    animation: shake 0.5s ease;
}

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

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

.energy-dot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.source-item:hover .energy-dot,
.target-item:hover .energy-dot {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.energy-label {
    font-size: 1.1rem;
    font-weight: 500;
}

/* Couleurs des énergies */
.color-eau { background-color: var(--color-eau); }
.color-soleil { background-color: var(--color-soleil); }
.color-vegetaux { background-color: var(--color-vegetaux); }
.color-terre { background-color: var(--color-terre); }
.color-vent { background-color: var(--color-vent); }
.color-mer { background-color: var(--color-mer); }

.actions {
    display: flex;
    justify-content: center;
    margin-top: 30px;
    animation: fadeIn 0.6s ease forwards;
    animation-delay: 1.1s;
    opacity: 0;
}

/* Écran des résultats */
#results-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.results-container {
    text-align: center;
    width: 100%;
}

.trophy-icon {
    font-size: 100px;
    margin-bottom: 20px;
    animation: bounce 1s ease infinite;
}

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

.results-title {
    font-size: 3rem;
    margin-bottom: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.score-circle {
    position: relative;
    width: 250px;
    height: 250px;
    margin: 0 auto 30px;
}

.circular-progress {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.bg-circle {
    fill: none;
    stroke: var(--card-bg);
    stroke-width: 8;
}

.progress-circle {
    fill: none;
    stroke: url(#gradient);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    transition: stroke-dashoffset 1.5s ease;
}

.score-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.score-max {
    font-size: 2rem;
    color: var(--text-secondary);
}

.performance-message {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
    font-weight: 500;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 30px 20px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 5px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

/* Particules en arrière-plan */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.8), transparent);
    animation: float linear infinite;
}

@keyframes float {
    0% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) scale(1);
        opacity: 0;
    }
}

/* Modal de feedback */
.feedback-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: var(--card-bg);
    border: 2px solid var(--card-border);
    border-radius: 25px;
    padding: 40px 50px;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    text-align: center;
    min-width: 400px;
}

.feedback-modal.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.feedback-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(99, 102, 241, 0.1), transparent);
    border-radius: 25px;
    z-index: -1;
}

.correct-feedback {
    border-color: var(--success-color);
}

.correct-feedback::before {
    background: radial-gradient(circle at center, rgba(16, 185, 129, 0.2), transparent);
}

.incorrect-feedback {
    border-color: var(--error-color);
}

.incorrect-feedback::before {
    background: radial-gradient(circle at center, rgba(239, 68, 68, 0.2), transparent);
}

.feedback-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    font-weight: bold;
}

.correct-feedback .feedback-icon {
    color: var(--success-color);
    animation: successBounce 0.6s ease;
}

.incorrect-feedback .feedback-icon {
    color: var(--error-color);
    animation: errorShake 0.6s ease;
}

@keyframes successBounce {
    0%, 100% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.2);
    }
    50% {
        transform: scale(0.9);
    }
    75% {
        transform: scale(1.1);
    }
}

@keyframes errorShake {
    0%, 100% {
        transform: translateX(0) rotate(0deg);
    }
    25% {
        transform: translateX(-15px) rotate(-10deg);
    }
    75% {
        transform: translateX(15px) rotate(10deg);
    }
}

.feedback-message {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 25px;
    color: var(--text-primary);
}

.feedback-link {
    display: inline-block;
    padding: 15px 30px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(99, 102, 241, 0.3);
}

.feedback-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.feedback-link:active {
    transform: translateY(0);
}

/* Responsive */
/* Media query pour tablettes */
@media (max-width: 1024px) and (min-width: 769px) {
    .matching-container {
        gap: 25px;
    }
    
    .source-item,
    .target-item {
        padding: 15px;
        font-size: 0.95rem;
    }
    
    .color-circle {
        width: 42px;
        height: 42px;
        min-width: 42px;
    }
    
    .question {
        font-size: 1.6rem;
    }
}

/* Media query pour mobile et petites tablettes */
@media (max-width: 768px) {
    .feedback-modal {
        min-width: auto;
        width: 90%;
        padding: 30px 25px;
    }
    
    .feedback-icon {
        font-size: 3rem;
    }
    
    .feedback-message {
        font-size: 1.2rem;
    }
    
    .feedback-link {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
    .title {
        font-size: 2.5rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .matching-container {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        min-height: 350px;
    }
    
    .question-card {
        padding: 20px 15px;
    }
    
    .question {
        font-size: 1.2rem;
        margin-bottom: 20px;
    }
    
    .source-item,
    .target-item {
        padding: 10px 12px;
        font-size: 0.85rem;
        gap: 8px;
    }
    
    .color-circle {
        width: 35px;
        height: 35px;
        min-width: 35px;
        font-size: 1rem;
    }
    
    .btn-primary {
        padding: 12px 25px;
        font-size: 0.95rem;
    }
    
    .header {
        padding: 15px;
    }
    
    .score-display {
        font-size: 0.9rem;
        gap: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .results-title {
        font-size: 2rem;
    }
    
    .score-number {
        font-size: 3rem;
    }
}

/* Media query pour très petits écrans (mobiles portrait) */
@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .matching-container {
        gap: 8px;
        min-height: 300px;
    }
    
    .source-item,
    .target-item {
        padding: 8px 10px;
        font-size: 0.75rem;
        gap: 6px;
    }
    
    .color-circle {
        width: 30px;
        height: 30px;
        min-width: 30px;
        font-size: 0.9rem;
    }
    
    .question {
        font-size: 1.1rem;
    }
    
    .question-card {
        padding: 15px 10px;
    }
    
    .btn-primary {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 0.9rem;
    }
    
    .score-display {
        font-size: 0.85rem;
        gap: 10px;
    }
    
    .energy-icon {
        font-size: 3rem;
    }
}

/* Gradient pour le cercle de progression */
svg defs {
    display: none;
}
