/* Variables CSS pour le thème */
:root {
    --color-primary: #4FC3F7;
    --color-secondary: #81C784;
    --color-accent: #FFB74D;
    --color-pink: #F06292;
    --color-purple: #BA68C8;
    --color-success: #66BB6A;
    --color-error: #EF5350;
    --color-text: #333;
    --color-white: #fff;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    --shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.2);
}

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

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

/* Container principal */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Gestion des pages */
.page {
    display: none;
    min-height: 100vh;
    padding: 20px;
}

.page.active {
    display: block;
}

/* Titre principal */
.main-title {
    text-align: center;
    font-size: 3.5em;
    color: var(--color-white);
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
    margin: 30px 0;
}

.main-title .emoji {
    display: inline-block;
    font-size: 1.2em;
}

/* Mascotte */
.mascot-container {
    text-align: center;
    position: relative;
    margin: 40px 0;
}

.mascot {
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.2));
    cursor: pointer;
    transition: transform 0.3s ease;
}

.mascot:hover {
    transform: scale(1.1) rotate(5deg);
}

.mini-mascot {
    position: absolute;
    top: 20px;
    left: 20px;
}

.mini-mascot svg {
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.2));
}

/* Bulle de dialogue */
.speech-bubble {
    background: var(--color-white);
    border-radius: 25px;
    padding: 20px 30px;
    margin: 20px auto;
    max-width: 450px;
    position: relative;
    box-shadow: var(--shadow);
    font-size: 1.4em;
    color: var(--color-text);
    text-align: center;
}

.speech-bubble::after {
    content: '';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-bottom: 15px solid var(--color-white);
}

/* Menu des leçons */
.lessons-menu {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 25px;
    margin-top: 50px;
}

.lesson-card {
    background: var(--color-white);
    border-radius: 20px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.lesson-card:hover {
    transform: translateY(-10px) scale(1.05);
    box-shadow: var(--shadow-hover);
}

.lesson-card:nth-child(1) {
    border-top: 5px solid var(--color-primary);
}

.lesson-card:nth-child(2) {
    border-top: 5px solid var(--color-secondary);
}

.lesson-card:nth-child(3) {
    border-top: 5px solid var(--color-accent);
}

.lesson-card:nth-child(4) {
    border-top: 5px solid var(--color-pink);
}

.lesson-card:nth-child(5) {
    border-top: 5px solid var(--color-purple);
}

.lesson-icon {
    font-size: 4em;
    margin-bottom: 15px;
}

.lesson-card h3 {
    font-size: 1.7em;
    margin: 10px 0;
    color: var(--color-text);
}

.lesson-card p {
    font-size: 1.3em;
    color: #666;
    margin-bottom: 15px;
}

.stars {
    display: flex;
    justify-content: center;
    gap: 5px;
}

.star {
    font-size: 1.5em;
    opacity: 0.3;
    transition: opacity 0.3s ease;
}

.star.earned {
    opacity: 1;
    animation: star-pop 0.5s ease;
}

/* Boutons */
.btn-primary,
.btn-secondary,
.back-btn {
    padding: 15px 40px;
    font-size: 1.4em;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-weight: bold;
    box-shadow: var(--shadow);
    min-width: 180px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-secondary), var(--color-primary));
    color: var(--color-white);
}

.btn-primary:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-hover);
}

.btn-secondary {
    background: var(--color-white);
    color: var(--color-primary);
    border: 3px solid var(--color-primary);
}

.btn-secondary:hover {
    background: var(--color-primary);
    color: var(--color-white);
}

.back-btn {
    padding: 10px 25px;
    background: var(--color-white);
    color: var(--color-text);
    font-size: 1.3em;
    margin-bottom: 20px;
}

.back-btn:hover {
    background: var(--color-accent);
    color: var(--color-white);
}

/* Page de leçon */
.lesson-content {
    background: var(--color-white);
    border-radius: 30px;
    padding: 50px;
    margin-top: 30px;
    box-shadow: var(--shadow);
    position: relative;
}

.lesson-content h2 {
    font-size: 2.5em;
    color: var(--color-primary);
    text-align: center;
    margin-bottom: 30px;
}

.lesson-text {
    font-size: 1.6em;
    line-height: 1.8;
    color: var(--color-text);
    margin: 30px 0;
}

.lesson-visual {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 30px;
    margin: 40px 0;
}

.shape {
    width: 150px;
    height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.shape:hover {
    transform: scale(1.2) rotate(5deg);
}

.shape-item {
    margin-bottom: 10px;
}

.shape-name {
    font-size: 1.4em;
    font-weight: bold;
    margin-top: 10px;
}

/* Formes géométriques */
.square {
    width: 100px;
    height: 100px;
    background: var(--color-primary);
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.rectangle {
    width: 140px;
    height: 80px;
    background: var(--color-secondary);
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.circle {
    width: 100px;
    height: 100px;
    background: var(--color-accent);
    border-radius: 50%;
    box-shadow: var(--shadow);
}

.triangle {
    width: 0;
    height: 0;
    border-left: 50px solid transparent;
    border-right: 50px solid transparent;
    border-bottom: 100px solid var(--color-pink);
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.15));
}

/* Page d'exercice */
.exercise-header {
    background: var(--color-white);
    padding: 15px 30px;
    border-radius: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.exercise-progress {
    display: flex;
    gap: 30px;
    align-items: center;
    font-size: 1.4em;
    font-weight: bold;
}

.score-display {
    color: var(--color-accent);
}

.exercise-content {
    background: var(--color-white);
    border-radius: 30px;
    padding: 50px;
    box-shadow: var(--shadow);
}

.exercise-content h3 {
    font-size: 2.2em;
    color: var(--color-primary);
    text-align: center;
    margin-bottom: 40px;
}

#exercise-area {
    min-height: 300px;
    margin: 40px 0;
}

/* Zone de glisser-déposer */
.drop-zone {
    border: 4px dashed var(--color-primary);
    border-radius: 20px;
    padding: 40px;
    min-height: 150px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

.drop-zone.drag-over {
    background: rgba(79, 195, 247, 0.1);
    border-color: var(--color-secondary);
    transform: scale(1.02);
}

.draggable {
    cursor: move;
    padding: 15px 30px;
    background: var(--color-white);
    border: 3px solid var(--color-primary);
    border-radius: 15px;
    font-size: 1.5em;
    font-weight: bold;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.draggable:hover {
    transform: scale(1.1);
}

.draggable.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}

/* Options de choix multiples */
.choice-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.choice-option {
    background: var(--color-white);
    border: 4px solid var(--color-primary);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.5em;
    font-weight: bold;
}

.choice-option:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.choice-option.selected {
    background: var(--color-primary);
    color: var(--color-white);
    transform: scale(1.05);
}

.choice-option.correct {
    background: var(--color-success);
    color: var(--color-white);
    border-color: var(--color-success);
}

.choice-option.incorrect {
    background: var(--color-error);
    color: var(--color-white);
    border-color: var(--color-error);
}

/* Slider de rotation */
.rotation-slider {
    margin: 40px 0;
}

.rotation-slider input[type="range"] {
    width: 100%;
    height: 15px;
    border-radius: 10px;
    background: linear-gradient(to right, var(--color-primary), var(--color-accent));
    outline: none;
    -webkit-appearance: none;
}

.rotation-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--color-white);
    border: 4px solid var(--color-primary);
    cursor: pointer;
    box-shadow: var(--shadow);
}

.rotation-preview {
    text-align: center;
    margin: 30px 0;
}

.rotatable-shape {
    display: inline-block;
    transition: transform 0.3s ease;
}

/* Feedback */
.exercise-feedback {
    min-height: 80px;
    margin: 30px 0;
    text-align: center;
    font-size: 1.7em;
    font-weight: bold;
}

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

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

/* Contrôles des exercices */
.exercise-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 40px;
}

/* Page de résultats */
.results-content {
    background: var(--color-white);
    border-radius: 30px;
    padding: 60px;
    text-align: center;
    box-shadow: var(--shadow);
    margin-top: 50px;
}

.results-content h2 {
    font-size: 3em;
    color: var(--color-primary);
    margin-bottom: 30px;
}

.final-score {
    margin: 50px 0;
}

.final-score p {
    font-size: 1.7em;
    margin: 20px 0;
}

.big-stars {
    font-size: 4em;
    margin: 30px 0;
}

#encouragement {
    font-size: 2em;
    color: var(--color-accent);
    font-weight: bold;
}

.results-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 40px;
    flex-wrap: wrap;
}

/* 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;
    opacity: 0;
}

/* ======================== */
/* Popup d'accueil Géo      */
/* ======================== */

.geo-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    animation: fade-in 0.6s ease-out forwards;
}

.geo-popup-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease-out;
}

.geo-popup {
    background: linear-gradient(135deg, #e8f5e9 0%, #e3f2fd 50%, #fce4ec 100%);
    border-radius: 30px;
    padding: 40px 35px 30px;
    max-width: 520px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    position: relative;
    animation: geo-popup-enter 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s forwards;
    transform: scale(0) translateY(50px);
    opacity: 0;
}

@keyframes geo-popup-enter {
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.geo-scene {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* Géo le personnage */
.geo-character {
    animation: geo-bounce 2s ease-in-out infinite;
    filter: drop-shadow(0 8px 15px rgba(0, 0, 0, 0.2));
}

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

/* Ailes qui battent */
.geo-wing-left {
    transform-origin: 65px 130px;
    animation: geo-wing-flap-l 0.6s ease-in-out infinite;
}

.geo-wing-right {
    transform-origin: 135px 130px;
    animation: geo-wing-flap-r 0.6s ease-in-out infinite;
}

@keyframes geo-wing-flap-l {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(-20deg); }
}

@keyframes geo-wing-flap-r {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(20deg); }
}

/* Bec qui parle */
.geo-beak-talk {
    animation: geo-beak-move 0.3s ease-in-out infinite;
}

@keyframes geo-beak-move {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(0.7) translateY(2px); }
}

/* Bulle de dialogue */
.geo-speech {
    background: white;
    border-radius: 25px;
    padding: 22px 28px;
    max-width: 420px;
    width: 100%;
    min-height: 80px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    position: relative;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.geo-speech.visible {
    opacity: 1;
    transform: scale(1);
}

.geo-speech-arrow {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 14px solid transparent;
    border-right: 14px solid transparent;
    border-bottom: 14px solid white;
}

#geo-speech-text {
    font-size: 1.15em;
    line-height: 1.6;
    color: var(--color-text);
    text-align: center;
    font-weight: 500;
}

/* Curseur clignotant pour effet machine à écrire */
.geo-cursor {
    display: inline-block;
    width: 2px;
    height: 1.1em;
    background: var(--color-primary);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: geo-cursor-blink 0.6s step-end infinite;
}

@keyframes geo-cursor-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Bouton C'est parti */
.geo-popup-btn {
    display: block;
    margin: 25px auto 0;
    padding: 16px 50px;
    font-size: 1.4em;
    font-family: inherit;
    font-weight: 700;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, var(--color-secondary), var(--color-primary));
    color: white;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(79, 195, 247, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: pulse 1.5s ease-in-out infinite;
}

.geo-popup-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 25px rgba(79, 195, 247, 0.6);
}

/* Bouton mute */
.geo-mute-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    font-size: 1.2em;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.geo-mute-btn:hover {
    background: white;
}

/* Responsive */
@media (max-width: 768px) {
    .main-title {
        font-size: 2.5em;
    }

    .lessons-menu {
        grid-template-columns: 1fr;
    }

    .lesson-content,
    .exercise-content,
    .results-content {
        padding: 30px 20px;
    }

    .choice-options {
        grid-template-columns: 1fr;
    }

    .exercise-header {
        flex-direction: column;
        gap: 15px;
    }

    .results-buttons {
        flex-direction: column;
    }

    .geo-popup {
        padding: 30px 20px 25px;
    }

    .geo-character svg {
        width: 130px;
        height: 130px;
    }

    #geo-speech-text {
        font-size: 1em;
    }

    .geo-popup-btn {
        font-size: 1.2em;
        padding: 14px 40px;
    }
}
