:root {
    --eco-dark: #9D174D;
    --eco-light: #EC4899;
    --eco-accent: #FBCFE8;
    --eco-neon: #F472B6;
    --bg-color: #FDF2F8;
    --text-dark: #2F0515;
    --text-light: #831843;
    --white-glass: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --card-shadow: 0 16px 40px rgba(157, 23, 77, 0.08); /* Updated shadow color to match dark pink */
    --correct: #4CAF50;
    --incorrect: #E57373;
    --option-bg: rgba(255, 255, 255, 0.9);
    --option-hover-bg: white;
    --progress-bg: rgba(255, 255, 255, 0.6);
}

body.dark-mode {
    --eco-dark: #FBCFE8;
    --eco-light: #F472B6;
    --eco-accent: #9D174D;
    --eco-neon: #EC4899;
    --bg-color: #1a050f;
    --text-dark: #FDF2F8;
    --text-light: #FBCFE8;
    --white-glass: rgba(47, 5, 21, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --card-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
    --option-bg: rgba(47, 5, 21, 0.8);
    --option-hover-bg: rgba(74, 8, 33, 1);
    --progress-bg: rgba(255, 255, 255, 0.15);
}

.theme-toggle-btn {
    background: var(--white-glass);
    border: 1px solid var(--glass-border);
    color: var(--text-dark);
    font-size: 1.5rem;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.theme-toggle-btn:hover {
    transform: scale(1.1);
    background: var(--option-hover-bg);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-dark);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    padding: 2rem 1rem;
}

/* Organic Background Blobs for Eco Feel */
.background-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    filter: blur(40px);
    opacity: 0.6;
    z-index: -1;
}

.organic-1 {
    top: -10vh;
    left: -10vw;
    width: 60vw;
    height: 60vw;
    background: var(--eco-neon);
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    /* CPU Fix: animation removed */
}

.organic-2 {
    bottom: -20vh;
    right: -10vw;
    width: 50vw;
    height: 50vw;
    background: var(--eco-accent);
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    /* CPU Fix: animation removed */
}

@keyframes morph {
    0% { border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%; }
    100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
}

.app-container {
    width: 100%;
    max-width: 700px;
    z-index: 10;
    animation: fadeIn 1s ease-out;
    margin: auto;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

h1 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--eco-dark);
    letter-spacing: -0.5px;
}

.subtitle {
    color: var(--text-light);
    font-weight: 400;
    font-size: 1.1rem;
    margin-top: 0.3rem;
}

.score-circle {
    background: linear-gradient(135deg, var(--eco-accent), var(--eco-neon));
    color: white;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 8px 20px rgba(236, 72, 153, 0.4);
    transform: scale(1);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease;
}

.score-circle.bump {
    transform: scale(1.15) rotate(5deg);
    box-shadow: 0 12px 25px rgba(236, 72, 153, 0.6);
}

#score-text {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.pts {
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0.9;
}

.progress-container {
    width: 100%;
    height: 10px;
    background: var(--progress-bg);
    border-radius: 20px;
    margin-bottom: 0.8rem;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--eco-neon), var(--eco-light));
    width: 0%;
    border-radius: 20px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(244, 114, 182, 0.5);
}

.progress-text {
    text-align: right;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 2rem;
}

.glass {
    background: var(--white-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    padding: 3rem;
    box-shadow: var(--card-shadow);
    transition: all 0.4s ease;
}

h2 {
    font-size: 1.6rem;
    margin-bottom: 2.5rem;
    line-height: 1.5;
    color: var(--eco-dark);
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.2rem;
}

.option-btn {
    background: var(--option-bg);
    border: 2px solid transparent;
    padding: 1.2rem 1.8rem;
    border-radius: 20px;
    font-size: 1.15rem;
    color: var(--text-dark);
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.02);
}

.option-btn:hover {
    background: var(--option-hover-bg);
    border-color: var(--eco-light);
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(236, 72, 153, 0.15);
}

.option-btn.correct {
    background: var(--correct);
    color: white;
    border-color: var(--correct);
    box-shadow: 0 8px 20px rgba(76, 175, 80, 0.3);
}

.option-btn.incorrect {
    background: var(--incorrect);
    color: white;
    border-color: var(--incorrect);
    box-shadow: 0 8px 20px rgba(229, 115, 115, 0.3);
    animation: shake 0.4s ease;
}

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

.hidden {
    display: none !important;
}

#result-card {
    text-align: center;
}

.final-score {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--eco-dark);
    margin: 2rem 0;
    text-shadow: 0 4px 15px rgba(157, 23, 77, 0.1);
}

.feedback {
    font-size: 1.2rem;
    color: var(--text-light);
    margin-bottom: 3rem;
    line-height: 1.6;
}

.primary-btn {
    background: linear-gradient(135deg, var(--eco-accent), var(--eco-neon));
    color: white;
    border: none;
    padding: 1.2rem 2.5rem;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(157, 23, 77, 0.3);
}

.primary-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(157, 23, 77, 0.4);
    filter: brightness(1.1);
}

.floating-points {
    position: absolute;
    color: var(--correct);
    font-weight: 800;
    font-size: 2rem;
    pointer-events: none;
    animation: floatUp 1s cubic-bezier(0.25, 1, 0.5, 1) forwards;
    z-index: 100;
    text-shadow: 0 2px 10px rgba(76, 175, 80, 0.4);
}

@keyframes floatUp {
    0% { opacity: 1; transform: translateY(0) scale(1.2); }
    100% { opacity: 0; transform: translateY(-70px) scale(0.8); }
}

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

@media (max-width: 768px) {
    .glass { padding: 2rem; }
    h1 { font-size: 1.6rem; }
    .score-circle { width: 75px; height: 75px; }
    #score-text { font-size: 1.4rem; }
}

@media (max-width: 480px) {
    .app-container { padding: 0.5rem; }
    .glass { padding: 1.5rem; border-radius: 20px; }
    h1 { font-size: 1.4rem; }
    h2 { font-size: 1.2rem; }
    .option-btn { font-size: 1rem; padding: 1rem; }
}

/* Nouvelles règles pour l'accueil et le footer */
.app-footer {
    text-align: center;
    margin-top: 3rem;
    padding-bottom: 1rem;
    font-size: 0.95rem;
    color: var(--text-light);
    font-weight: 500;
    opacity: 0.8;
}

.home-desc {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 2rem;
    text-align: center;
}

.themes-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

.theme-card {
    flex: 1 1 160px; /* Stretch to fill holes but wrap if smaller than 160px */
    background: var(--white-glass);
    border: 1px solid var(--glass-border);
    color: var(--text-dark);
    padding: 1.2rem 0.8rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.5rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.02);
}

.theme-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.08);
    border-color: var(--eco-main);
}

.mix-btn {
    flex: 1 1 100%; /* Force 100% width in flex container */
    background: var(--white-glass);
    color: #111111 !important; /* Force black text */
    padding: 1.2rem;
    border-radius: 15px;
    border: 1px solid var(--glass-border);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.mix-btn .theme-icon {
    font-size: 1.8rem;
    margin-bottom: 0.2rem;
}

.mix-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 20px rgba(157, 23, 77, 0.15);
    background: var(--option-hover-bg);
}

.theme-icon {
    font-size: 1.8rem;
    display: block;
}

.ue-title {
    color: var(--eco-dark);
    font-size: 1.3rem;
    margin-bottom: 1.2rem;
    border-bottom: 2px solid var(--eco-accent);
    padding-bottom: 0.5rem;
}

.home-btn {
    width: 100%;
    margin: 0;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--white-glass);
    border: 1px solid var(--glass-border);
    color: var(--text-dark);
    padding: 0.6rem 1.2rem;
    border-radius: 20px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.back-btn:hover {
    background: var(--option-hover-bg);
    transform: translateX(-5px);
    border-color: var(--eco-light);
}

.back-icon {
    font-size: 1.2rem;
}

.explanation-box {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--white-glass);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    animation: fadeIn 0.4s ease-out;
}

.explanation-box h3 {
    color: var(--eco-dark);
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#explanation-text {
    font-size: 1.05rem;
    color: var(--text-dark);
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

.mt-4 {
    margin-top: 1rem;
    width: 100%;
}



/* --- Nouvelles Options --- */
.multiple-choice-label {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem;
    gap: 1rem;
}

.dark-mode .multiple-choice-label {
    background: rgba(30,30,40,0.5);
    border-color: rgba(255,255,255,0.1);
    color: var(--dark-text);
}

.multiple-choice-label:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: translateX(5px);
}

.dark-mode .multiple-choice-label:hover {
    background: rgba(50,50,60,0.8);
}

.option-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.open-input {
    width: 100%;
    padding: 1rem;
    font-size: 1.2rem;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.6);
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.dark-mode .open-input {
    background: rgba(30, 30, 40, 0.6);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--dark-text);
}

.open-input:focus {
    outline: none;
    border-color: var(--eco-dark);
}

.multiple-choice-label.correct {
    background-color: rgba(76, 175, 80, 0.2);
    border-color: #4CAF50;
}

.multiple-choice-label.incorrect {
    background-color: rgba(244, 67, 54, 0.2);
    border-color: #F44336;
}


/* --- Scoreboard --- */
.scoreboard-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
}
.table-responsive {
    overflow-x: auto;
    margin-top: 1rem;
}
.score-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}
.score-table th, .score-table td {
    padding: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}
.dark-mode .score-table th, .dark-mode .score-table td {
    border-bottom-color: rgba(255,255,255,0.05);
}
.score-table th {
    font-weight: 600;
    color: var(--eco-dark);
}
.dark-mode .score-table th {
    color: #4CAF50;
}
.score-table tbody tr {
    transition: background 0.3s;
}
.score-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.2);
}
.dark-mode .score-table tbody tr:hover {
    background: rgba(50,50,60,0.5);
}
.note-badge {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9em;
}
.note-good { background: rgba(76, 175, 80, 0.2); color: #2E7D32; }
.dark-mode .note-good { color: #81C784; }
.note-average { background: rgba(255, 152, 0, 0.2); color: #E65100; }
.dark-mode .note-average { color: #FFB74D; }
.note-bad { background: rgba(244, 67, 54, 0.2); color: #C62828; }
.dark-mode .note-bad { color: #E57373; }
#reset-progress-btn:hover {
    background: rgba(244, 67, 54, 0.4) !important;
}


/* --- Modal --- */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal.hidden {
    display: none !important;
}
.modal-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
}
.modal-content {
    position: relative;
    padding: 2.5rem;
    max-width: 450px;
    width: 90%;
    text-align: center;
    z-index: 1001;
    border-radius: 20px;
}
.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    justify-content: center;
}
.delete-btn {
    background: #F44336;
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}
.delete-btn:hover {
    background: #d32f2f;
}

/* --- Completed Badge --- */
.home-btn {
    position: relative;
}
.completed-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #4CAF50;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    border: 2px solid white;
}
.dark-mode .completed-badge {
    border-color: #1e1e24;
}

/* Dark mode button contrast fixes */
body.dark-mode .primary-btn, 
body.dark-mode .mix-btn {
    color: #2F0515; /* Dark text for contrast against the inverted light pink primary gradient */
    font-weight: 800;
}

/* Styling for the UE selection tabs */
.ue-btn {
    background: var(--white-glass);
    border: 1px solid var(--glass-border);
    color: var(--text-dark);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-bottom: 1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    display: block; /* Ensure it takes full width properly */
}
.ue-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(157, 23, 77, 0.15);
    background: var(--option-hover-bg);
}
.dark-mode .ue-btn {
    color: #FDF2F8; /* White text in dark mode for visibility */
}
.dark-mode .mix-btn {
    color: #FDF2F8 !important; /* White text in dark mode for visibility */
}


/* Styling for 'Annuler' modal button */
.cancel-btn {
    background: var(--white-glass);
    color: var(--text-dark);
    border: 1px solid var(--glass-border);
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}
.cancel-btn:hover {
    background: rgba(0,0,0,0.05);
    transform: translateY(-2px);
}
.dark-mode .cancel-btn:hover {
    background: rgba(255,255,255,0.1);
}
.dark-mode .cancel-btn {
    color: #FDF2F8; /* White text in dark mode */
}
