body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #1a1a2e; /* Fond sombre bleu nuit */
    color: #e0e0e0; /* Texte clair */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden; /* Empêche les barres de défilement dues au canvas 3D */
}

#scene-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1; /* Derrière l'UI */
}

#ui-container {
    background-color: rgba(27, 27, 42, 0.9); /* Fond semi-transparent pour l'UI, légèrement plus opaque */
    padding: 35px 45px; /* Padding légèrement augmenté */
    border-radius: 20px; /* Coins plus arrondis */
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35), 0 0 15px rgba(130, 170, 255, 0.2) inset; /* Ombre plus prononcée et lueur intérieure */
    text-align: center;
    max-width: 550px; /* Légèrement plus large */
    width: 90%;
    border: 1px solid rgba(130, 170, 255, 0.4); /* Bordure plus visible */
    display: flex; /* Pour gérer l'affichage des différentes vues */
    flex-direction: column;
    transition: box-shadow 0.3s ease-in-out; /* Transition pour l'ombre */
}
#ui-container:hover {
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4), 0 0 20px rgba(130, 170, 255, 0.3) inset;
}
/* Styles pour les vues (menu, jeu, boutique, crédits) */
#main-menu-view, #game-view, #shop-view, #credits-view, #language-selection-view {
    width: 100%; /* Prennent toute la largeur du ui-container */
}
#language-selection-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px; /* Espace entre les boutons */
    padding: 20px 0;
}
#language-selection-view h2 {
    color: #ffcb6b; /* Jaune orangé */
    margin-bottom: 10px;
}
.lang-button {
    width: 200px; /* Un peu moins large que les boutons de menu principaux */
}
#main-menu-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px; /* Espace entre les boutons du menu */
    padding: 20px 0;
}
.menu-button {
    background-image: linear-gradient(to right, #82aaff 0%, #658efc 100%); /* Dégradé subtil */
    color: #ffffff; /* Texte blanc pour meilleur contraste */
    border: none;
    padding: 15px 30px; /* Plus de padding */
    font-size: 1.15em; /* Légèrement plus grand */
    border-radius: 10px; /* Coins plus arrondis */
    cursor: pointer;
    transition: all 0.3s ease; /* Transition pour toutes les propriétés */
    width: 280px; /* Largeur augmentée */
    max-width: 85%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2); /* Ombre portée subtile */
    text-shadow: 0 1px 2px rgba(0,0,0,0.2); /* Ombre sur le texte */
    font-weight: bold; /* Texte en gras */
}
.menu-button:hover {
    background-image: linear-gradient(to right, #658efc 0%, #82aaff 100%); /* Inverser le dégradé au survol */
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3); /* Ombre plus prononcée au survol */
    transform: translateY(-2px); /* Léger soulèvement */
}
.menu-button:active {
    transform: translateY(0px) scale(0.98); /* Effet d'enfoncement */
    box-shadow: 0 2px 5px rgba(0,0,0,0.2); /* Ombre réduite au clic */
}
#credits-view {
    padding: 20px;
    text-align: center;
}
#credits-view h2 {
    color: #ffcb6b;
    margin-bottom: 15px;
}
#credits-view p {
    margin-bottom: 10px;
    font-size: 1.1em;
}
header h1 {
    color: #ffcb6b; /* Jaune orangé, plus vibrant */
    margin-bottom: 30px; /* Plus d'espace */
    font-size: 3em; /* Plus grand */
    letter-spacing: 1.5px; /* Plus d'espacement */
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3), 0 0 10px rgba(255, 203, 107, 0.3); /* Ombre portée et lueur subtile */
    font-family: 'Arial Black', Gadget, sans-serif; /* Police plus audacieuse */
}

#stats-container {
    display: flex;
    justify-content: space-between; /* Better distribution */
    align-items: stretch; /* Make items same height if they wrap */
    margin-bottom: 25px;
    font-size: 1.1em;
    flex-wrap: wrap;
    gap: 10px; /* Consistent spacing */
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.1); /* Subtle background for the container */
    border-radius: 10px;
}
/* Common style for all stat items */
#score-display, #xp-display, #coins-display, #level-display {
    flex-grow: 1; /* Allow items to grow and fill space */
    min-width: 120px; /* Minimum width before wrapping, adjusted for icon */
    background-color: rgba(40, 40, 65, 0.85); /* Slightly darker, more defined background */
    padding: 12px 15px; /* Adjusted padding */
    border-radius: 8px;
    margin: 0; /* Removed individual margins, handled by gap on container */
    text-align: center;
    border: 1px solid rgba(128, 128, 255, 0.3); /* Subtle border */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); /* Soft shadow for depth */
    transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
    display: flex; /* For icon alignment */
    align-items: center; /* Vertically center icon and text */
    justify-content: center; /* Center content horizontally */
}
#score-display:hover, #xp-display:hover, #coins-display:hover, #level-display:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}
#score-display {
    color: #c3e88d; /* Vert clair */
    border-left: 4px solid #c3e88d;
}
#xp-display {
    color: #89ddff; /* Bleu ciel pour XP */
    border-left: 4px solid #89ddff;
}
#coins-display {
    color: #ffcb6b; /* Jaune orangé */
    border-left: 4px solid #ffcb6b;
}
#level-display {
    color: #ff8f70; /* Corail pour niveau */
    border-left: 4px solid #ff8f70;
}
.stat-icon {
    width: 1em; /* Relative to parent font-size */
    height: 1em;
    margin-right: 0.5em; /* Space between icon and text */
    flex-shrink: 0; /* Prevent icon from shrinking */
}
.stat-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}
.stat-value {
    font-weight: bold;
}
#passive-wealth-progress-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: rgba(40, 40, 65, 0.7); /* Consistent with new stat item bg */
    padding: 8px 12px; /* Adjusted padding */
    border-radius: 6px;
    font-size: 0.9em; /* Slightly increased for better readability */
    color: #ffcb6b;
    margin: 5px 0; /* Adjusted margin to fit within the new flow */
    border: 1px solid rgba(255, 203, 107, 0.4); /* Border consistent with coin color */
    width: 100%; /* Make it take full width within the stats container if it's the only item on a line */
    box-sizing: border-box;
}
#passive-wealth-label {
    white-space: nowrap;
}
#passive-wealth-bar-outer {
    width: 80px; /* Largeur de la barre de progression */
    height: 12px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255, 203, 107, 0.5);
}
#passive-wealth-bar-inner {
    height: 100%;
    width: 0%; /* Commence vide */
    background-color: #ffcb6b; /* Couleur des coins */
    border-radius: 6px;
    transition: width 0.2s linear; /* Transition douce */
}
#passive-wealth-countdown {
    min-width: 30px; /* Pour éviter les sauts de layout */
    text-align: right;
}
#word-to-type-container {
    margin-bottom: 20px;
    padding: 15px;
    background-color: rgba(0,0,0,0.2);
    border-radius: 8px;
}
/* Styles pour l'événement bonus */
.bonus-mode-active {
    border: 3px dashed #ffcb6b; /* Jaune orangé pour le mot */
    background-color: rgba(255, 203, 107, 0.05); /* Léger fond jaune très subtil */
    animation: bonus-pulse 1.5s infinite alternate;
    box-shadow: 0 0 0px rgba(255, 203, 107, 0.1); /* Initial shadow state for pulse */
}
.bonus-mode-active #timer-display {
    color: #ff8f70; /* Couleur plus urgente pour le timer en mode bonus */
    font-weight: bold;
}
@keyframes bonus-pulse {
    0% { 
        box-shadow: 0 0 8px rgba(255, 203, 107, 0.3);
    }
    100% { 
        box-shadow: 0 0 20px rgba(255, 203, 107, 0.8);
    }
}
#word-display {
    font-size: 2.2em;
    font-weight: bold;
    color: #ffcb6b; /* Jaune orangé pour le mot */
    min-height: 40px; 
    letter-spacing: 2px;
    margin-bottom: 5px; /* Espace pour le timer en dessous */
}
#bonus-progress-display {
    font-size: 0.8em;
    color: #ffcb6b; /* Jaune orangé, comme le thème bonus */
    margin-top: 5px;
    font-style: italic;
}
#timer-display {
    font-size: 0.9em;
    color: #82aaff; /* Bleu clair */
    min-height: 20px; /* Pour éviter les sauts de layout */
    transition: color 0.3s ease; /* Pour une transition douce si la couleur change */
}
.timer-warning {
    color: #ff5370 !important; /* Rouge clair, important pour outrepasser la couleur de base */
    animation: blink-animation 0.7s infinite;
}
@keyframes blink-animation {
    0% { opacity: 1; }
    50% { opacity: 0.4; }
    100% { opacity: 1; }
}
#text-input {
    width: calc(100% - 22px); /* Pleine largeur moins padding et bordure */
    padding: 12px;
    margin-bottom: 20px;
    border: 1px solid #505070;
    border-radius: 8px;
    background-color: #25253a;
    color: #e0e0e0;
    font-size: 1.2em;
    text-align: center;
}
.shake {
    animation: shake-animation 0.4s cubic-bezier(.36,.07,.19,.97) both;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    perspective: 1000px;
}
@keyframes shake-animation {
  10%, 90% {
    transform: translate3d(-1px, 0, 0);
  }
  20%, 80% {
    transform: translate3d(2px, 0, 0);
  }
  30%, 50%, 70% {
    transform: translate3d(-3px, 0, 0);
  }
  40%, 60% {
    transform: translate3d(3px, 0, 0);
  }
}
#text-input:focus {
    outline: none;
    border-color: #82aaff;
    box-shadow: 0 0 8px rgba(130, 170, 255, 0.5);
}
#start-button {
    background-color: #82aaff; /* Bleu clair */
    color: #1a1a2e;
    border: none;
    padding: 12px 25px;
    font-size: 1.1em;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease;
    margin-bottom: 15px;
}
/* Boutons de contrôle en jeu */
#in-game-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px; /* Espace au-dessus des boutons */
}
.game-control-button {
    background-color: #505070; /* Couleur neutre pour les contrôles en jeu */
    color: #e0e0e0;
    border: 1px solid #8080a0;
    padding: 8px 15px;
    font-size: 0.9em;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
.game-control-button:hover {
    background-color: #656585;
}
/* L'ancien bouton boutique dans le jeu est commenté/supprimé, pas besoin de ces styles ici pour le moment */
/* #shop-button { ... } */
/* Le bouton start original sera peut-être supprimé ou réutilisé */
/* #start-button { ... } */
/* Ajustement pour les boutons dans la vue shop */
#shop-view .menu-button { /* Cible le bouton "Retour au Menu" dans la boutique */
    width: auto; /* Pour qu'il ne prenne pas la largeur fixe des boutons du menu principal */
    padding: 10px 20px;
    font-size: 1em;
    margin-top: 15px; /* Espace au-dessus du bouton retour */
}
/* #start-button:hover { ... } */
/* #start-button:active { ... } */
#feedback-message {
    background-color: #658efc;
}
#start-button:active {
    transform: scale(0.98);
}
#feedback-message {
    min-height: 25px; /* Pour éviter les sauts */
    font-size: 1em;
    margin-top: 10px;
    font-weight: bold;
}
.correct {
    color: #c3e88d; /* Vert clair */
}
.incorrect {
    color: #ff5370; /* Rouge clair */
}
.level-up {
    color: #ffcb6b; /* Jaune orangé, comme le mot à taper */
    font-style: italic;
    text-shadow: 0 0 4px rgba(0,0,0,0.5);
}
.bonus-event-start {
    color: #ffcb6b; /* Jaune orangé */
    font-weight: bold;
    font-size: 1.1em;
}
.bonus-event-success {
    color: #99ff99; /* Vert très vif */
    font-weight: bold;
    font-size: 1.1em;
}
.bonus-event-end { /* Pour la fin sans succès */
    color: #aaaaaa; /* Gris neutre */
}
footer p {
    font-size: 0.9em;
    color: #707090;
    margin-top: 20px;
}
/* Style pour cacher le bouton start une fois le jeu lancé */
.game-started #start-button {
    display: none;
}
.game-not-started #text-input {
    display: none;
}
/* Classe utilitaire pour cacher des éléments */
.hidden {
    display: none !important;
}
/* Styles pour la vue Boutique */
#shop-view {
    padding: 25px; /* Augmentation du padding */
    border-top: none; /* Suppression de la bordure supérieure, gérée par le ui-container */
    margin-top: 0; /* Suppression de la marge, ui-container gère l'espacement */
    max-height: 75vh; /* Légère augmentation de la hauteur max */
    overflow-y: auto;
    background: linear-gradient(145deg, rgba(30, 30, 50, 0.9), rgba(45, 45, 70, 0.95)); /* Fond dégradé subtil */
    border-radius: 10px; /* Coins arrondis pour la vue boutique elle-même */
    box-shadow: 0 5px 15px rgba(0,0,0,0.2); /* Ombre plus douce */
}
#shop-items-container {
    display: flex;
    flex-direction: column;
    gap: 20px; /* Espace entre les items */
    margin-bottom: 20px;
}
.shop-item {
    background-color: rgba(50, 50, 80, 0.85); /* Fond légèrement plus clair et plus opaque */
    padding: 20px; /* Augmentation du padding */
    border-radius: 12px; /* Coins plus arrondis */
    border: 1px solid rgba(128, 128, 255, 0.35); /* Bordure plus visible */
    text-align: left;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25); /* Ombre portée pour effet de carte */
    transition: transform 0.2s ease-out, box-shadow 0.2s ease-out; /* Transition pour hover */
}
.shop-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}
.shop-item-name {
    color: #ffcb6b; /* Jaune orangé */
    margin-top: 0;
    margin-bottom: 10px; /* Plus d'espace en dessous */
    font-size: 1.3em; /* Légèrement plus grand */
    border-bottom: 1px solid rgba(255, 203, 107, 0.3); /* Ligne de séparation */
    padding-bottom: 8px; /* Espace pour la ligne */
    display: flex; /* Pour aligner l'icône et le texte */
    align-items: center; /* Centrer verticalement l'icône et le texte */
}
.shop-item-description {
    font-size: 0.95em; /* Légèrement plus grand */
    color: #c0c0e0; /* Un peu plus clair */
    margin-bottom: 12px; /* Plus d'espace */
    line-height: 1.5; /* Meilleure lisibilité */
}
.shop-item-icon {
    display: inline-block;
    width: 1.2em; /* Taille relative à la police du titre */
    height: 1.2em;
    margin-right: 0.5em; /* Espace entre l'icône et le texte du titre */
    vertical-align: middle; /* Mieux aligner avec le texte si flex n'est pas utilisé sur le parent */
}
.shop-item-icon svg {
    display: block;
    width: 100%;
    height: 100%;
    fill: currentColor; /* Utilise la couleur du texte du titre (h3) */
}
.shop-item-details, .shop-item-effect, .shop-item-cost {
    font-size: 1em;
    margin-bottom: 8px; /* Plus d'espace */
    color: #d0d0f0; /* Texte des détails plus clair */
}
.shop-item-cost span, .shop-item-effect span, .shop-item-details span {
    font-weight: bold;
}
/* Spécifier les couleurs pour les valeurs et coûts */
.shop-item-details span, .shop-item-effect span {
    color: #c3e88d; /* Vert clair pour les valeurs numériques */
}
.shop-item-cost span {
    color: #ffcb6b; /* Jaune orangé pour le coût en coins */
}
.shop-item-buy-button {
    background-image: linear-gradient(to bottom, #c3e88d, #a9d178); /* Dégradé pour le bouton */
    color: #1e2a38; /* Couleur de texte plus foncée pour contraste */
    border: 1px solid #8fbc8f; /* Bordure subtile */
    padding: 10px 18px; /* Plus de padding */
    font-size: 1em; /* Taille de police augmentée */
    font-weight: bold; /* Texte en gras */
    border-radius: 8px; /* Coins plus arrondis */
    cursor: pointer;
    transition: all 0.3s ease; /* Transition pour toutes les propriétés */
    margin-top: 15px; /* Plus d'espace au-dessus */
    display: block; 
    width: 100%;
    text-shadow: 0 1px 1px rgba(0,0,0,0.1); /* Ombre portée subtile sur le texte */
}
.shop-item-buy-button:hover:not(:disabled) {
    background-image: linear-gradient(to bottom, #a9d178, #8fbc8f);
    box-shadow: 0 2px 5px rgba(0,0,0,0.15); /* Ombre au survol */
    transform: translateY(-1px); /* Léger soulèvement */
}
.shop-item-buy-button:active:not(:disabled) {
    transform: translateY(0px); /* Retour à la position initiale au clic */
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.2); /* Ombre intérieure au clic */
}
.shop-item-buy-button:disabled {
    background-image: none; /* Pas de dégradé pour le bouton désactivé */
    background-color: #505070;
    color: #808080;
    cursor: not-allowed;
    border-color: #404050; /* Bordure plus foncée */
    text-shadow: none; /* Pas d'ombre portée sur le texte */
}
.shop-item-purchased-animation {
    animation: purchase-success-pulse 0.6s ease-out;
}
@keyframes purchase-success-pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(195, 232, 141, 0.5); /* Vert clair */
    }
    50% {
        transform: scale(1.03);
        box-shadow: 0 0 15px rgba(195, 232, 141, 0.8);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(195, 232, 141, 0.5);
    }
}
#shop-view h2 {
    color: #ffcb6b; /* Jaune orangé */
    margin-bottom: 20px; /* Plus d'espace en dessous */
    font-size: 1.8em; /* Taille augmentée */
    border-bottom: 2px solid rgba(255, 203, 107, 0.4); /* Ligne de séparation plus marquée */
    padding-bottom: 10px; /* Espace pour la ligne */
}
#shop-view .menu-button { /* Pour le bouton "Retour au Menu" dans la boutique */
    width: auto; 
    padding: 12px 25px; /* Padding augmenté */
    font-size: 1.05em; /* Légèrement plus grand */
    margin-top: 25px; /* Plus d'espace au-dessus */
    background-color: #6a6a8a; /* Couleur de fond plus discrète */
    color: #e0e0e0;
}
#shop-view .menu-button:hover {
    background-color: #7f7f9f;
}