/* Style Graphique Amélioré : Genshin Impact Style (Dark & Gold) */
:root {
    --gold-primary: #E5C07B;
    --gold-bright: #F9E596;
    --bg-dark: rgba(20, 25, 35, 0.95);
    --bg-light: rgba(30, 38, 52, 0.85);
    --text-light: #E2E8F0;
    --text-white: #FFFFFF;
    
    /* Nouvelles couleurs élégantes pour les bordures et éléments */
    --color-continent: #d35400;
    --color-ocean: #2980b9;
    --color-river: #00cec9;
    --color-mountain: #8e44ad;
    --color-city: #c0392b;
    --color-drom: #27ae60;
}

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

body {
    background-color: #0B0E14;
    background-image: url('assets/fondjeu.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: var(--text-light);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    font-family: 'Lato', sans-serif;
}

.cinzel-font, .main-title, .title-medium, .title-small { font-family: 'Cinzel', serif; }
.lato-font { font-family: 'Lato', sans-serif; }

.main-title { font-size: 3.5rem; font-weight: 700; text-shadow: 0 4px 20px rgba(229, 192, 123, 0.5); margin-bottom: 10px; letter-spacing: 2px;}
.title-medium { font-size: 2.2rem; font-weight: 700; letter-spacing: 1px;}
.title-small { font-size: 1.4rem; font-weight: 700; letter-spacing: 1px; margin-bottom: 8px;}

.gold-text { color: var(--gold-primary); text-shadow: 0 2px 5px rgba(0,0,0,0.6); }
.highlight-green { color: #2ecc71; text-shadow: 0 0 10px rgba(46, 204, 113, 0.5);}
.hidden { display: none !important; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.text-center { text-align: center; }

#game-container {
    width: 100%;
    max-width: 1700px;
    height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

/* Glassmorphism Panels */
.glass-panel {
    background: var(--bg-dark);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(229, 192, 123, 0.3);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), inset 0 0 20px rgba(229, 192, 123, 0.05);
    padding: 40px;
}

.glass-panel-translucent {
    background: var(--bg-light);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
}

.glass-panel-top {
    background: linear-gradient(to bottom, rgba(20,25,35,0.98), rgba(20,25,35,0.7));
    padding: 15px 30px;
    border-bottom: 2px solid rgba(229, 192, 123, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.6);
}

.center-box {
    text-align: center;
    width: 100%;
    max-width: 650px;
}

.menu-box {
    width: 100%;
    max-width: 700px;
    text-align: center;
}

.subtitle {
    font-size: 1.3rem;
    color: #94A3B8;
    margin-bottom: 30px;
    font-style: italic;
    letter-spacing: 1px;
}

/* Boutons & Inputs */
.header-controls {
    display: flex;
    align-items: center;
    gap: 30px;
}

.audio-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0,0,0,0.5);
    padding: 8px 20px;
    border-radius: 30px;
    border: 1px solid rgba(229, 192, 123, 0.2);
}

.vol-label {
    font-size: 1.2rem;
}

input[type="range"] {
    width: 100px;
    cursor: pointer;
    accent-color: var(--gold-primary);
}

.audio-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    padding: 5px 10px !important;
    background: transparent;
    border: none;
    box-shadow: none;
}

input[type="text"] {
    font-size: 1.2rem;
    padding: 15px 30px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255,255,255,0.15);
    color: var(--text-white);
    border-radius: 30px;
    text-align: center;
    outline: none;
    transition: all 0.3s;
    font-family: 'Lato', sans-serif;
    width: 80%;
    max-width: 400px;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.8);
}

input[type="text"]:focus {
    border-color: var(--gold-primary);
    background: rgba(0, 0, 0, 0.8);
    box-shadow: 0 0 20px rgba(229, 192, 123, 0.4), inset 0 2px 10px rgba(0,0,0,0.8);
}

.glow-btn {
    background: linear-gradient(135deg, #2C3E50, #1A252F);
    color: var(--text-light);
    border: 1px solid rgba(229, 192, 123, 0.3);
    padding: 15px 40px;
    font-size: 1.2rem;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    cursor: pointer;
    border-radius: 30px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.5);
}

.glow-btn:hover {
    background: linear-gradient(135deg, #E5C07B, #C29B57);
    color: #12161F;
    border-color: var(--gold-bright);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(229, 192, 123, 0.6);
}

.glow-btn.small {
    padding: 10px 20px;
    font-size: 0.9rem;
}

.glass-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-light);
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: bold;
    letter-spacing: 1px;
}

.glass-btn:hover {
    background: rgba(229, 192, 123, 0.2);
    border-color: var(--gold-primary);
    transform: scale(1.05);
}

.menu-layout-centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-top: 40px;
}

.menu-btn {
    width: 100%;
    max-width: 450px;
    padding: 18px;
    font-size: 1.3rem;
}

.score-display {
    font-size: 1.4rem;
    color: #94A3B8;
    margin-top: 10px;
    font-family: 'Cinzel', serif;
}

.screen {
    display: none;
    width: 100%;
    height: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.screen.active {
    display: flex;
}

.stats-board { display: flex; gap: 30px; font-family: 'Cinzel', serif; font-size: 1.4rem;}

/* -------- ZONES DE JEU -------- */
.play-area {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: calc(100% - 100px);
    gap: 20px;
}

/* PANNEAUX LATERAUX */
#left-panel {
    flex: 0 0 280px; 
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
    border-right: 2px solid var(--gold-primary);
    background: linear-gradient(to right, rgba(20,25,35,0.9), rgba(30,38,52,0.6));
}

#right-panel {
    flex: 1.2; 
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 250px;
    max-width: 320px;
}

/* CORRECTION DU BUG D'ÉTIREMENT DES ÉTIQUETTES : Flex-start compacte les éléments en haut */
.items-list {
    flex: 3;
    padding: 20px 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Ne distribue pas l'espace vide, les garde en haut */
    gap: 15px;
    align-items: center;
}

.drom-list {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 15px;
    margin-top: 10px;
}

/* ZONE CARTE (Centre) */
#map-container {
    flex: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 15px;
    background: rgba(10, 14, 20, 0.9);
    position: relative;
}

/* Animation 1 : Lueur ambiante de la carte */
.ambient-glow {
    animation: ambientPulse 8s infinite alternate;
}
@keyframes ambientPulse {
    0% { box-shadow: inset 0 0 20px rgba(0,0,0,0.9); }
    100% { box-shadow: inset 0 0 50px rgba(229, 192, 123, 0.15); }
}

#map-wrapper {
    position: relative;
    box-shadow: 0 8px 35px rgba(0,0,0,0.9);
    border-radius: 8px;
    background-color: #fff;
}

#background-map {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    border-radius: 8px;
}

/* Animation 2 : Ligne de scan au démarrage */
#map-scanline {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: rgba(229, 192, 123, 0.8);
    box-shadow: 0 0 15px rgba(229, 192, 123, 1);
    z-index: 40;
    opacity: 0;
}
.scanning {
    animation: scanMap 2s ease-in-out;
}
@keyframes scanMap {
    0% { top: 0%; opacity: 1; }
    90% { top: 100%; opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

/* Images DROM dans le panneau de gauche */
.drom-row {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(0, 0, 0, 0.3);
    padding: 15px 10px;
    border-radius: 8px;
    border: 1px solid rgba(229, 192, 123, 0.15);
    transition: all 0.3s ease;
}
.drom-row:hover {
    background: rgba(255,255,255,0.05);
}

.drom-row img {
    height: 80px;
    width: 80px;
    object-fit: contain;
    filter: drop-shadow(2px 2px 5px rgba(0,0,0,0.8));
}

#drop-zones {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
}

/* CIBLES DE DÉPÔT : Plus classe, fond sombre avec bordure fine solide */
.drop-zone {
    position: absolute;
    border-radius: 4px;
    transition: all 0.3s ease;
    background: rgba(10, 15, 25, 0.5);
    border: 1px solid rgba(229, 192, 123, 0.4);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
}

.drom-dz {
    flex: 1;
    height: 50px;
    background: rgba(10, 15, 25, 0.5);
    border: 1px solid rgba(229, 192, 123, 0.4);
    border-radius: 6px;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.drop-zone.hovered, .drom-dz.hovered {
    background: rgba(229, 192, 123, 0.2) !important;
    border: 1px solid var(--gold-bright) !important;
    box-shadow: 0 0 15px var(--gold-bright) !important;
    transform: scale(1.05);
}

.drop-zone.correct, .drom-dz.correct {
    border: 1px solid rgba(255,255,255,0.2) !important;
    background: transparent !important;
    box-shadow: none !important;
}


/* ÉTIQUETTES : Fixation rigide de la taille pour empêcher l'étirement */
.draggable-item {
    cursor: grab;
    transition: all 0.2s;
    width: 100%;
    max-width: 250px;
    height: 48px; /* FIXE */
    flex: 0 0 48px; /* FIXE : Ne grossit pas, ne rétrécit pas */
}
.draggable-item:hover {
    transform: scale(1.03);
    box-shadow: 0 5px 20px rgba(0,0,0,0.6);
}
.draggable-item:active { cursor: grabbing; transform: scale(0.95); opacity: 0.9;}

.draggable-text {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 15px;
    width: 100%;
    height: 100%;
    border-radius: 6px;
    font-weight: 700;
    text-align: center;
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    font-family: 'Lato', sans-serif;
    color: var(--text-white);
    background: linear-gradient(135deg, rgba(30, 40, 55, 0.98), rgba(20, 25, 35, 0.98));
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 10px rgba(0,0,0,0.6);
    border-left: 6px solid var(--gold-primary);
    white-space: nowrap; 
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Bordures gauches colorées */
.draggable-text.type-continent { border-left-color: var(--color-continent); }
.draggable-text.type-ocean { border-left-color: var(--color-ocean); }
.draggable-text.type-river { border-left-color: var(--color-river); }
.draggable-text.type-mountain { border-left-color: var(--color-mountain); }
.draggable-text.type-city { border-left-color: var(--color-city); }
.draggable-text.type-drom { border-left-color: var(--color-drom); }


/* ANIMATION 3 : Ripple Effect sur le DropZone lors du succès */
@keyframes rippleEffect {
    0% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.8); }
    100% { box-shadow: 0 0 0 30px rgba(46, 204, 113, 0); }
}

.anim-success { 
    animation: rippleEffect 0.6s ease-out !important; 
    border-color: #2ecc71 !important;
    background: rgba(46, 204, 113, 0.2) !important;
}

.anim-error { 
    animation: superError 0.5s ease-in-out !important; 
    background: rgba(231, 76, 60, 0.6) !important; 
    border: 1px solid #e74c3c !important;
    box-shadow: 0 0 20px rgba(231, 76, 60, 0.8) !important;
}

@keyframes superError {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-10px); }
    40%, 80% { transform: translateX(10px); }
}

/* Panneau Anecdote */
#anecdote-panel {
    flex: 0 0 auto;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
    border-top: 4px solid var(--gold-primary);
    background: linear-gradient(to bottom, rgba(30, 40, 55, 0.95), rgba(20, 25, 35, 0.98));
    border-radius: 8px;
}

.anecdote-content p {
    font-size: 1.05rem;
    color: #E2E8F0;
    line-height: 1.5;
    text-align: justify;
}

/* Modale de Victoire (Déplacée en bas à droite, non bloquante) */
#victory-modal {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 420px;
    height: auto;
    background: transparent;
    pointer-events: none; /* Laisse passer les clics autour */
    z-index: 1000;
}

.victory-box {
    padding: 30px;
    text-align: center;
    border-top: 5px solid var(--gold-primary);
    background: rgba(20, 25, 35, 0.95);
    pointer-events: auto; /* Réactive les clics pour la boite */
    box-shadow: 0 15px 50px rgba(0,0,0,0.9);
}

.victory-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.victory-icon {
    font-size: 2.5rem;
    animation: float 2s infinite ease-in-out;
}

.recap-stats { font-size: 1.5rem; font-family: 'Cinzel', serif;}
.victory-buttons { display: flex; flex-direction: column; gap: 10px; }

/* Animations Utilitaires */
.floating-anim { animation: float 4s ease-in-out infinite; }
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-12px); }
    100% { transform: translateY(0px); }
}

.slide-up { animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes slideUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.5s ease-in; }
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes victoryPop {
    0% { transform: scale(0.5); opacity: 0; }
    70% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}
.pop-in-victory { animation: victoryPop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }

/* Animation 4 : Particules de succès style feu d'artifice */
#particles-container {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 50;
}
.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #F9E596;
    border-radius: 50%;
    pointer-events: none;
    box-shadow: 0 0 10px #F9E596;
    animation: explode 0.8s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}
@keyframes explode {
    0% { transform: scale(1) translate(0, 0); opacity: 1; }
    100% { transform: scale(0) translate(var(--tx), var(--ty)); opacity: 0; }
}

/* Animation 5 : Pop du score (+100) */
.score-popup {
    position: absolute;
    color: #2ecc71;
    font-weight: bold;
    font-size: 1.5rem;
    font-family: 'Cinzel', serif;
    text-shadow: 0 2px 5px rgba(0,0,0,0.8);
    pointer-events: none;
    z-index: 200;
    animation: scoreFly 1s ease-out forwards;
}
@keyframes scoreFly {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(-50px) scale(1.2); opacity: 0; }
}
