/* ========================================
   Enguerrand 1072 V2 - Design Chevalier Épique
   ======================================== */

:root {
    --gold: #FFD700;
    --gold-light: #FFF4CC;
    --gold-dark: #B8860B;
    --gold-glow: rgba(255, 215, 0, 0.15);
    --bronze: #CD7F32;
    --bg: #0A0A0F;
    --bg-elevated: #12121A;
    --bg-card: #1A1A26;
    --text: #E8E8F0;
    --text-light: #B0B0C0;
    --text-muted: #707080;
    --border: #2A2A38;
    --border-gold: #3A3420;
    --shadow: rgba(0, 0, 0, 0.6);
    --shadow-strong: rgba(0, 0, 0, 0.8);
    --shadow-gold: 0 0 30px rgba(255, 215, 0, 0.2);
}

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

html {
    overflow-x: hidden;
    overflow-y: auto;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(180deg, #0A0A0F 0%, #0F0F14 100%);
    color: var(--text);
    font-size: 16px;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    width: 100%;
}

.container {
    width: 100%;
    max-width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
}

/* ========================================
   HEADER V2 - Design Épique
   ======================================== */

.header-v2 {
    position: relative;
    padding: 0;
    background: var(--bg-elevated);
    border-bottom: 3px solid var(--gold-dark);
    overflow: hidden;
    width: 100%;
    max-width: 100vw;
}

/* Bannière château médiéval */
.castle-banner {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background:
        linear-gradient(180deg, rgba(184, 134, 11, 0.1) 0%, transparent 100%),
        repeating-linear-gradient(90deg,
            transparent 0px,
            transparent 50px,
            rgba(255, 215, 0, 0.03) 50px,
            rgba(255, 215, 0, 0.03) 100px
        );
    opacity: 0.5;
}

.castle-banner::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg,
        transparent 0%,
        transparent 35%,
        var(--gold-light) 48%,
        var(--gold) 50%,
        var(--gold-light) 52%,
        transparent 65%,
        transparent 100%
    );
    animation: slideHorizontal 6s linear infinite;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 0 10px rgba(255, 215, 0, 0.5);
    z-index: 10;
}

@keyframes shimmer {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

@keyframes slideHorizontal {
    0% {
        transform: translateX(-100%);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    50% {
        transform: translateX(100%);
        opacity: 1;
    }
    60% {
        opacity: 0;
    }
    100% {
        transform: translateX(-100%);
        opacity: 0;
    }
}

.header-content {
    position: relative;
    display: flex;
    align-items: center;
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 30px;
    z-index: 1;
}

/* Avatar Hero avec effets */
.avatar-hero {
    position: relative;
    width: 100px;
    height: 100px;
    flex-shrink: 0;
}

.avatar-glow {
    position: absolute;
    inset: -20px;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.2) 0%, rgba(255, 215, 0, 0.1) 40%, transparent 70%);
    animation: pulse-glow 2.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes pulse-glow {
    0%, 100% {
        transform: scale(0.95);
        opacity: 0.4;
    }
    50% {
        transform: scale(1.15);
        opacity: 0.7;
    }
}

.avatar-hero img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    object-position: center 20%;
    border: 5px solid var(--gold);
    box-shadow:
        0 0 0 3px var(--bg-elevated),
        0 0 0 6px var(--gold-dark),
        var(--shadow-gold);
    position: relative;
    z-index: 2;
}

.avatar-ring {
    position: absolute;
    inset: -8px;
    border: 2px solid var(--gold);
    border-radius: 50%;
    opacity: 0.3;
    /* animation: rotate-ring 10s linear infinite; */
}

@keyframes rotate-ring {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Texte du header */
.hero-title {
    font-family: 'Cinzel', 'Cormorant', serif;
    font-size: 1.5rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 50%, var(--bronze) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 10px rgba(255, 215, 0, 0.2);
}

.hero-subtitle {
    font-family: 'Cormorant', Georgia, serif;
    font-size: 0.95rem;
    color: var(--text-light);
    font-style: italic;
    margin-bottom: 6px;
}

.status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.status-dot {
    width: 10px;
    height: 10px;
    background: radial-gradient(circle, #10B981 0%, #059669 100%);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
    animation: pulse-status 2s ease-in-out infinite;
}

@keyframes pulse-status {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(0.9);
    }
}

.status-text {
    font-family: 'Cormorant', serif;
    font-weight: 500;
}

/* Logo container */
.logo-container {
    margin-left: auto;
    position: relative;
}

.header-logo {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    object-fit: cover;
    border: 2px solid var(--gold-dark);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(255, 215, 0, 0.1);
    transition: all 0.3s ease;
    background: var(--bg-card);
}

.header-logo:hover {
    transform: scale(1.05) rotate(2deg);
    border-color: var(--gold);
    box-shadow:
        0 6px 16px rgba(0, 0, 0, 0.4),
        0 0 30px rgba(255, 215, 0, 0.2);
}

/* ========================================
   MESSAGES - Style amélioré
   ======================================== */

.messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    background:
        radial-gradient(circle at 20% 50%, rgba(255, 215, 0, 0.02) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(184, 134, 11, 0.02) 0%, transparent 50%);
}

.message {
    display: flex;
    gap: 12px;
    /* animation: messageSlide 0.4s ease-out; */
}

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

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid var(--gold-dark);
    box-shadow:
        0 2px 10px rgba(0, 0, 0, 0.4),
        inset 0 0 0 1px rgba(255, 215, 0, 0.2);
    position: relative;
}

.message-avatar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 25%;
}

.message.user .message-avatar {
    display: none;
}

.message-content {
    max-width: 650px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Bulles de message */
.message-bubble {
    background: var(--bg-card);
    padding: 12px 16px;
    border-radius: 16px;
    border: 1px solid var(--border);
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.message-bubble p {
    margin: 0;
    line-height: 1.4;
    font-size: 0.95rem;
}

/* Message ancien français */
.message.bot .message-bubble.old-french {
    font-family: 'Cormorant', Georgia, serif;
    font-size: 1rem;
    font-weight: 500;
    background:
        linear-gradient(135deg, rgba(255, 215, 0, 0.15) 0%, rgba(184, 134, 11, 0.1) 100%),
        var(--bg-card);
    border: 2px solid var(--gold-dark);
    color: var(--gold-light);
    box-shadow:
        inset 0 1px 0 rgba(255, 215, 0, 0.2),
        0 4px 12px rgba(255, 215, 0, 0.1);
    letter-spacing: 0.3px;
}

/* Symbole croix désactivé
.message.bot .message-bubble.old-french::before {
    content: '✠';
    position: absolute;
    top: -8px;
    right: 20px;
    font-size: 16px;
    color: var(--gold);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}
*/

/* Message utilisateur */
.message.user .message-bubble {
    background: linear-gradient(135deg, #2A2A38 0%, #1C1C28 100%);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Toggle de traduction amélioré */
.translation-toggle {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.05) 0%, transparent 100%);
    border: 2px dashed var(--border-gold);
    padding: 12px 16px;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

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

.translation-toggle:hover::before {
    left: 100%;
}

.translation-toggle:hover {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.12) 0%, rgba(184, 134, 11, 0.05) 100%);
    border-color: var(--gold);
    border-style: solid;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.15);
}

.toggle-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
    font-style: italic;
    font-family: 'Cormorant', serif;
    font-weight: 600;
}

.translation-content {
    display: none;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border-gold);
    color: var(--text-light);
    font-size: 1rem;
    font-family: 'Cormorant', Georgia, serif;
    /* animation: fadeInDown 0.4s ease; */
}

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

.translation-toggle.active .toggle-text {
    color: var(--gold-light);
    font-weight: 600;
}

.translation-toggle.active .translation-content {
    display: block;
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding-left: 8px;
    font-style: italic;
}

/* ========================================
   INPUT AREA V2
   ======================================== */

.input-area {
    padding: 20px 30px 24px;
    border-top: 3px solid var(--gold-dark);
    background: var(--bg-elevated);
    position: relative;
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
}

.input-area::before {
    content: '';
    position: absolute;
    top: -3px;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg,
        transparent 0%,
        transparent 40%,
        var(--gold-light) 50%,
        var(--gold) 52%,
        var(--gold-light) 54%,
        transparent 60%,
        transparent 100%
    );
    animation: slideHorizontal 7s linear infinite 0.5s;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
}

@keyframes scan {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 1;
    }
}

/* Indicateur de frappe amélioré */
.typing-indicator {
    display: none;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    color: var(--text-light);
    font-size: 0.95rem;
    font-family: 'Cormorant', serif;
    font-style: italic;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

.typing-indicator.active {
    display: flex;
    /* animation: fadeIn 0.3s ease; */
}

.typing-dots {
    display: flex;
    gap: 5px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, var(--gold-light), var(--gold));
    border-radius: 50%;
    animation: typingPulse 1.4s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingPulse {
    0%, 60%, 100% {
        transform: translateY(0) scale(1);
        opacity: 0.3;
    }
    30% {
        transform: translateY(-10px) scale(1.2);
        opacity: 1;
    }
}

/* Formulaire d'input amélioré */
.input-form {
    display: flex;
    align-items: stretch;
    gap: 14px;
    background: linear-gradient(135deg, var(--bg) 0%, rgba(26, 26, 38, 0.8) 100%);
    border: 2px solid var(--border);
    border-radius: 20px;
    padding: 14px 14px 14px 20px;
    transition: all 0.3s ease;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

.input-form::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(255, 215, 0, 0.05) 0%,
        transparent 50%
    );
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.input-form:focus-within {
    border-color: var(--gold);
    box-shadow:
        0 0 0 3px var(--gold-glow),
        var(--shadow-gold),
        inset 0 1px 0 rgba(255, 215, 0, 0.1);
    transform: translateY(-1px);
}

.input-form:focus-within::before {
    opacity: 1;
}

#input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: 1.05rem;
    font-family: 'Inter', sans-serif;
    resize: none;
    max-height: 140px;
    color: var(--text);
    padding: 4px 0;
    align-self: center;
    line-height: 1.5;
}

#input::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

/* Bouton d'envoi épique */
#send-btn {
    width: 46px;
    height: 46px;
    border: 2px solid var(--gold-dark);
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    color: var(--bg);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    box-shadow:
        0 2px 8px rgba(255, 215, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

#send-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

#send-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow:
        0 6px 20px rgba(255, 215, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

#send-btn:hover:not(:disabled)::before {
    transform: translateX(100%);
}

#send-btn:active:not(:disabled) {
    transform: translateY(0) scale(1);
}

#send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

#send-btn svg {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* ========================================
   SCROLLBAR CUSTOM
   ======================================== */

.messages::-webkit-scrollbar {
    width: 12px;
}

.messages::-webkit-scrollbar-track {
    background: var(--bg);
    border-radius: 6px;
}

.messages::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--border) 0%, var(--gold-dark) 50%, var(--border) 100%);
    border-radius: 6px;
    border: 2px solid var(--bg);
}

.messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--gold-dark) 0%, var(--gold) 50%, var(--gold-dark) 100%);
}

/* ========================================
   ANIMATIONS GLOBALES
   ======================================== */

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

/* ========================================
   RESPONSIVE
   ======================================== */

/* ======= AJOUTS MOBILES UNIQUEMENT (Ne touchent pas le desktop) ======= */
@media (max-width: 768px) {
    /* Widget crédits compact en haut à droite sur mobile */
    .credits-widget {
        position: fixed !important;
        top: 10px !important;
        right: 10px !important;
        background: rgba(20, 15, 10, 0.95) !important;
        border: 1px solid rgba(255, 215, 0, 0.3) !important;
        border-radius: 6px !important;
        padding: 5px 7px !important;
        height: 32px !important;
        width: auto !important;
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
        z-index: 1001 !important;
    }

    /* Cacher le label CRÉDITS sur mobile */
    .credits-label {
        display: none !important;
    }

    /* Cacher l'icône pièce sur mobile (déjà caché par le widget desktop) */
    .credits-icon img {
        display: none !important;
    }

    /* Bouton documentation compact sur mobile */
    .doc-link {
        position: fixed !important;
        top: 10px !important;
        right: 60px !important;
        width: 32px !important;
        height: 32px !important;
        padding: 6px !important;
        background: rgba(20, 15, 10, 0.95) !important;
        border: 1px solid rgba(255, 215, 0, 0.3) !important;
        border-radius: 6px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        z-index: 1001 !important;
    }

    /* Cacher le texte Documentation sur mobile */
    .doc-text {
        display: none !important;
    }

    /* Remplacer le grimoire par icône livre sur mobile */
    .doc-icon img {
        display: none !important;
    }

    .doc-icon::after {
        content: '📖';
        font-size: 18px;
        display: block;
    }

    /* Titre sur 2 lignes pour mobile - méthode CSS pure */
    .hero-title {
        line-height: 1.2 !important;
        word-spacing: 100vw !important; /* Force le retour à la ligne après "Enguerrand" */
    }

    /* Status en ligne visible sur mobile */
    .status {
        display: flex !important;
        font-size: 0.7rem;
    }

    /* Popup avatar uniquement sur mobile */
    .avatar-hero, .message-avatar {
        cursor: pointer;
    }
}

/* Popup avatar (caché par défaut, visible seulement quand activé) */
.avatar-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.avatar-popup-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.avatar-popup img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 80vh;
    border-radius: 10px;
}

.avatar-popup-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: rgba(255, 215, 0, 0.2);
    border: 2px solid var(--gold);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: var(--gold);
    font-size: 24px;
    cursor: pointer;
}

@media (max-width: 768px) {
    /* Header agrandi pour mobile avec boutons */
    .header-v2 {
        min-height: 110px;
    }

    .header-content {
        padding: 12px 10px 18px 10px;
        gap: 8px;
        position: relative;
        min-height: 110px;
    }

    /* Avatar header plus petit */
    .avatar-hero {
        width: 45px;
        height: 45px;
    }

    /* Texte header réduit */
    .hero-title {
        font-size: 1rem;
    }

    .hero-subtitle {
        font-size: 0.75rem;
    }

    .status {
        font-size: 0.7rem;
    }

    .logo-container {
        display: none;
    }

    /* Widgets reste en fixed mais réduits */
    .credits-widget {
        top: 10px;
        right: 10px;
        width: auto;
        max-width: 100px;
        padding: 4px 8px;
        gap: 4px;
        font-size: 11px;
    }

    .credits-icon {
        display: none;
    }

    .credits-content {
        gap: 3px;
        flex-direction: row;
    }

    .credits-count {
        font-size: 13px;
    }

    .credits-label {
        font-size: 0;
    }

    .credits-label::after {
        content: 'Crédit';
        font-size: 11px;
    }

    .btn-buy-credits {
        width: 20px;
        height: 20px;
        font-size: 12px;
    }

    .doc-link {
        top: 42px; /* En dessous des crédits */
        right: 10px;
        left: auto;
        transform: none;
        width: auto;
        max-width: 60px;
        padding: 4px 8px;
        gap: 0;
        font-size: 11px;
    }

    .doc-text {
        font-size: 0;
    }

    .doc-text::after {
        content: 'Doc';
        font-size: 11px;
    }

    .doc-icon {
        display: none;
    }

    .menu-hamburger {
        top: 10px;
        left: 10px;
    }

    .menu-toggle {
        width: 34px;
        height: 34px;
    }

    /* Zone messages maximisée */
    .messages {
        padding: 15px 10px;
        gap: 15px;
        /* Utiliser tout l'espace disponible */
        flex: 1 1 auto;
    }

    .message-content {
        max-width: 85%;
    }

    /* Avatars messages plus petits */
    .message-avatar {
        width: 32px;
        height: 32px;
    }

    /* Input area ultra-compacte */
    .input-area {
        padding: 10px 12px 12px;
    }

    .input-form {
        padding: 8px 10px;
        gap: 8px;
    }

    #input {
        font-size: 0.95rem;
        padding: 2px 0;
        max-height: 60px;
    }

    #send-btn {
        width: 38px;
        height: 38px;
    }

    .typing-indicator {
        margin-bottom: 8px;
        font-size: 0.85rem;
    }

    /* Bulles de message plus compactes */
    .message-bubble {
        padding: 10px 12px;
    }

    .message-bubble p {
        font-size: 0.9rem;
    }
}

@media (min-width: 1600px) {
    .messages,
    .header-content,
    .input-form,
    .typing-indicator {
        max-width: 1600px;
    }
}


/* ========================================
   EFFETS SPÉCIAUX
   ======================================== */

/* Particules dorées flottantes - DÉSACTIVÉ pour résoudre le problème de scrollbar */
/*
@keyframes float-particle {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.4;
    }
    90% {
        opacity: 0.4;
    }
    100% {
        transform: translateY(-100vh) rotate(360deg);
        opacity: 0;
    }
}

.container::before {
    content: '⚜';
    position: fixed;
    color: var(--gold);
    font-size: 20px;
    opacity: 0.1;
    animation: float-particle 20s linear infinite;
    left: 10%;
    pointer-events: none;
}

.container::after {
    content: '✠';
    position: fixed;
    color: var(--gold-dark);
    font-size: 24px;
    opacity: 0.08;
    animation: float-particle 25s linear infinite 5s;
    left: 80%;
    pointer-events: none;
}
*/

/* ===============================================
   SYSTÈME DE CRÉDITS v1.0
   =============================================== */

/* Compteur de crédits */
.credits-widget {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 200px; /* Largeur augmentée pour accommoder plus de chiffres */
    background: linear-gradient(135deg, rgba(26, 26, 38, 0.9), rgba(18, 18, 26, 0.95));
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 12px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    z-index: 1000;
    transition: all 0.3s ease;
    min-height: 48px;
    justify-content: space-between;
}

.credits-widget:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 215, 0, 0.3);
}

.credits-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

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

.credits-content {
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1;
    flex: 1;
    min-width: 0; /* Permet au contenu de se rétrécir si nécessaire */
}

.credits-label {
    font-size: 11px;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

.credits-count {
    font-size: 20px;
    font-weight: 600;
    color: rgba(255, 215, 0, 0.9);
    font-variant-numeric: tabular-nums;
    line-height: 1;
    white-space: nowrap; /* Empêche le retour à la ligne */
    flex-shrink: 0; /* Empêche le rétrécissement du nombre */
}

.credits-count.low {
    color: #ff6b6b;
    animation: pulse 1s ease-in-out infinite;
}

.btn-buy-credits {
    background: rgba(50, 50, 60, 0.8);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    color: rgba(255, 215, 0, 0.8);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
}

.btn-buy-credits:hover {
    background: rgba(255, 215, 0, 0.2);
    border-color: rgba(255, 215, 0, 0.5);
    color: rgba(255, 215, 0, 1);
    transform: scale(1.1);
}

/* Bouton Documentation */
.doc-link {
    position: fixed;
    top: 76px;  /* En dessous du widget de crédits (20px + 48px height + 8px gap) */
    right: 20px; /* Aligné avec le widget de crédits */
    width: 200px; /* Même largeur que le widget crédits */
    background: linear-gradient(135deg, rgba(26, 26, 38, 0.9), rgba(18, 18, 26, 0.95));
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 12px;
    padding: 8px 12px; /* Même padding que crédits */
    display: flex;
    align-items: center;
    gap: 12px; /* Même gap que crédits */
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    z-index: 1000;
    text-decoration: none;
    color: var(--text-light);
    font-family: 'Cormorant', serif;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    min-height: 48px; /* Même hauteur minimum que crédits */
    justify-content: flex-start;
}

.doc-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 215, 0, 0.3);
    background: linear-gradient(135deg, rgba(30, 30, 46, 0.95), rgba(22, 22, 32, 0.98));
    color: var(--gold-light);
}

.doc-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    /* Pas de border-radius pour afficher le grimoire en entier */
    /* Pas de overflow hidden pour ne pas couper l'image */
    background: transparent; /* Fond transparent pour utiliser la transparence du PNG */
}

.sceau-img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* contain pour afficher l'image en entier */
    /* Ajustement pour rendre le grimoire visible */
    filter: contrast(1.1) brightness(1) saturate(1.2);
    /* Pas de transform scale pour afficher l'image à sa taille normale */
}

.doc-link:hover .sceau-img {
    filter: contrast(1.3) brightness(1.1) saturate(1.5);
    transform: scale(1.1); /* Scale plus subtil pour le grimoire */
}

.doc-text {
    letter-spacing: 0.5px;
}

/* Responsive pour le bouton documentation */
@media (max-width: 768px) {
    .doc-link {
        top: 70px; /* Ajuster pour mobile */
        right: 10px;
        width: 180px; /* Largeur augmentée */
        padding: 8px 12px;
        font-size: 0.95rem;
    }

    .credits-widget {
        width: 180px; /* Même largeur sur mobile */
        right: 10px;
    }
}

@media (max-width: 480px) {
    /* Header agrandi pour smartphone */
    .header-v2 {
        min-height: 100px;
    }

    .header-content {
        padding: 10px 10px 16px 10px;
        gap: 6px;
        position: relative;
        min-height: 100px;
    }

    .avatar-hero {
        width: 40px;
        height: 40px;
    }

    .hero-title {
        font-size: 0.95rem;
    }

    .hero-subtitle {
        display: none; /* Masquer pour gagner de l'espace */
    }

    .status {
        font-size: 0.65rem;
    }

    .status-dot {
        width: 7px;
        height: 7px;
    }

    /* Widgets en fixed, encore plus compacts */
    .credits-widget {
        top: 8px;
        right: 8px;
        max-width: 90px;
        padding: 3px 6px;
        gap: 3px;
    }

    .credits-label::after {
        font-size: 10px;
    }

    .credits-count {
        font-size: 12px;
    }

    .btn-buy-credits {
        width: 18px;
        height: 18px;
        font-size: 11px;
    }

    .doc-link {
        top: 38px; /* En dessous */
        right: 8px;
        left: auto;
        transform: none;
        max-width: 50px;
        padding: 3px 6px;
    }

    .doc-text::after {
        font-size: 10px;
    }

    .menu-hamburger {
        top: 8px;
        left: 10px;
    }

    .menu-toggle {
        width: 32px;
        height: 32px;
    }

    .menu-toggle span {
        width: 16px;
        height: 1.5px;
    }

    /* Zone messages MAXIMISÉE */
    .messages {
        padding: 10px 8px;
        gap: 12px;
    }

    /* Avatars messages très petits */
    .message-avatar {
        width: 26px;
        height: 26px;
    }

    /* Bulles messages compactes */
    .message-bubble {
        padding: 8px 10px;
        border-radius: 12px;
    }

    .message-bubble p {
        font-size: 0.85rem;
        line-height: 1.3;
    }

    /* Input area ULTRA-fine */
    .input-area {
        padding: 6px 8px 8px;
    }

    .input-form {
        padding: 5px 8px;
        gap: 6px;
        border-radius: 14px;
    }

    #input {
        font-size: 0.9rem;
        padding: 1px 0;
        max-height: 45px; /* Limiter hauteur du textarea */
        line-height: 1.3;
    }

    #send-btn {
        width: 32px;
        height: 32px;
    }

    #send-btn svg {
        width: 18px;
        height: 18px;
    }

    .typing-indicator {
        margin-bottom: 5px;
        font-size: 0.75rem;
    }

    .typing-dots span {
        width: 6px;
        height: 6px;
    }
}

/* Modal générique */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 40px;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    animation: slideDown 0.3s ease;
}

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

.modal-content h2 {
    color: #667eea;
    margin-bottom: 20px;
}

.modal-content p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 30px;
}

/* ===============================================
   MODAL MÉDIÉVAL - Trésor Royal Épuisé
   =============================================== */

.modal-medieval {
    background: linear-gradient(135deg,
        rgba(26, 26, 38, 0.98),
        rgba(18, 18, 26, 0.99)
    );
    border: 3px solid var(--gold-dark);
    border-radius: 20px;
    padding: 0;
    max-width: 550px;
    box-shadow:
        0 0 60px rgba(255, 215, 0, 0.2),
        0 20px 60px rgba(0, 0, 0, 0.8),
        inset 0 0 30px rgba(255, 215, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.modal-medieval::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg,
        var(--gold) 0%,
        transparent 40%,
        transparent 60%,
        var(--gold) 100%
    );
    border-radius: 20px;
    opacity: 0.5;
    animation: rotateGradient 8s linear infinite;
    z-index: -1;
}

@keyframes rotateGradient {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.modal-header-medieval {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 25px 20px 20px;
    border-bottom: 2px solid rgba(255, 215, 0, 0.2);
    background: rgba(255, 215, 0, 0.05);
}

.fleur-de-lys {
    font-size: 28px;
    color: var(--gold);
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    animation: pulseSlow 3s ease-in-out infinite;
}

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

.modal-title-medieval {
    font-family: 'Cinzel', serif;
    font-size: 1.8rem;
    background: linear-gradient(135deg,
        var(--gold-light) 0%,
        var(--gold) 50%,
        var(--bronze) 100%
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 20px rgba(255, 215, 0, 0.3);
    margin: 0;
    letter-spacing: 1px;
}

.modal-seal {
    padding: 20px;
    display: flex;
    justify-content: center;
}

.modal-coin {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid var(--gold);
    box-shadow:
        0 0 30px rgba(255, 215, 0, 0.4),
        0 5px 15px rgba(0, 0, 0, 0.5);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(5deg); }
}

.modal-body-medieval {
    padding: 0 30px 20px;
    color: var(--text);
}

.proclamation {
    font-family: 'Cormorant', serif;
    font-size: 1.3rem;
    color: var(--gold-light);
    margin-bottom: 15px;
    font-weight: 600;
}

.lettrine {
    font-family: 'Cinzel', serif;
    font-size: 2.5rem;
    color: var(--gold);
    float: left;
    line-height: 0.8;
    margin-right: 5px;
    text-shadow: 0 2px 10px rgba(255, 215, 0, 0.5);
}

.medieval-text {
    font-family: 'Cormorant', serif;
    font-size: 1.1rem;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 20px;
}

.offer-scroll {
    background: linear-gradient(135deg,
        rgba(255, 215, 0, 0.15) 0%,
        rgba(184, 134, 11, 0.08) 100%
    );
    border: 2px dashed var(--gold-dark);
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
    position: relative;
}

.offer-scroll::before,
.offer-scroll::after {
    content: '⚜';
    position: absolute;
    font-size: 20px;
    color: var(--gold);
    opacity: 0.3;
}

.offer-scroll::before {
    top: 10px;
    left: 10px;
}

.offer-scroll::after {
    bottom: 10px;
    right: 10px;
}

.offer-title {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    color: var(--gold);
    margin: 0 0 10px 0;
    text-shadow: 0 2px 10px rgba(255, 215, 0, 0.3);
}

.offer-price {
    font-family: 'Cormorant', serif;
    font-size: 1.4rem;
    color: var(--gold-light);
    font-weight: 700;
    margin: 10px 0;
}

.offer-detail {
    font-family: 'Cormorant', serif;
    font-size: 1rem;
    color: var(--text-light);
    font-style: italic;
    opacity: 0.9;
}

.modal-actions-medieval {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 30px 25px;
}

.btn-medieval-primary,
.btn-medieval-secondary {
    padding: 14px 24px;
    border-radius: 12px;
    font-family: 'Cormorant', serif;
    font-size: 1.15rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-medieval-primary {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    color: var(--bg);
    border: 2px solid var(--gold-dark);
    box-shadow:
        0 4px 15px rgba(255, 215, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-medieval-primary:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow:
        0 6px 25px rgba(255, 215, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 100%);
}

.btn-medieval-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-light);
    border: 2px solid var(--border);
}

.btn-medieval-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--gold-dark);
    color: var(--gold-light);
}

.btn-icon {
    font-size: 20px;
}

.modal-footer-medieval {
    padding: 15px;
    border-top: 1px solid rgba(255, 215, 0, 0.15);
    background: rgba(0, 0, 0, 0.2);
}

.seal-text {
    font-family: 'Cormorant', serif;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    margin: 0;
    opacity: 0.7;
}

.btn-primary, .btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    margin: 10px 5px;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: scale(1.05);
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

/* Toast notifications */
.toast-notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 10px;
    padding: 15px 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 10001;
    animation: slideUpToast 0.3s ease;
}

.toast-notification.warning {
    border-left: 4px solid #ff6b6b;
}

@keyframes slideUpToast {
    from {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* Responsive pour mobile */
@media (max-width: 768px) {
    .credits-widget {
        top: 10px;
        right: 10px;
        padding: 10px 12px;
    }

    .credits-icon {
        font-size: 24px;
    }

    .credits-count {
        font-size: 18px;
    }
}

/* ===============================================
   BANNIÈRE RGPD - Style Médiéval
   =============================================== */

.rgpd-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, rgba(26, 26, 38, 0.98), rgba(18, 18, 26, 0.99));
    border-top: 3px solid var(--gold-dark);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    backdrop-filter: blur(10px);
}

.rgpd-banner.show {
    transform: translateY(0);
}

.rgpd-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 25px 30px;
    display: flex;
    align-items: center;
    gap: 25px;
    position: relative;
}

.rgpd-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--gold-light) 25%,
        var(--gold) 50%,
        var(--gold-light) 75%,
        transparent 100%
    );
    animation: slideHorizontal 8s linear infinite;
}

.rgpd-icon {
    flex-shrink: 0;
    animation: float 3s ease-in-out infinite;
}

.rgpd-text {
    flex: 1;
    color: var(--text-light);
}

.rgpd-text h3 {
    font-family: 'Cinzel', serif;
    font-size: 1.3rem;
    color: var(--gold);
    margin-bottom: 10px;
    text-shadow: 0 2px 10px rgba(255, 215, 0, 0.3);
}

.rgpd-text p {
    font-family: 'Cormorant', serif;
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 8px;
    color: var(--text-light);
}

.rgpd-subtitle {
    font-style: italic;
    color: var(--gold-light) !important;
    opacity: 0.9;
}

.rgpd-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rgpd-btn {
    padding: 10px 20px;
    border: 2px solid var(--gold-dark);
    border-radius: 10px;
    font-family: 'Cormorant', serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.rgpd-accept {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    color: var(--bg);
    box-shadow: 0 3px 10px rgba(255, 215, 0, 0.3);
}

.rgpd-accept:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.4);
}

.rgpd-settings {
    background: rgba(255, 215, 0, 0.1);
    color: var(--gold-light);
    border-color: rgba(255, 215, 0, 0.3);
}

.rgpd-settings:hover {
    background: rgba(255, 215, 0, 0.2);
    border-color: var(--gold);
}

.rgpd-reject {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
}

.rgpd-reject:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-light);
}

.rgpd-link {
    position: absolute;
    bottom: 5px;
    right: 30px;
    font-size: 0.85rem;
    color: var(--gold-light);
    text-decoration: none;
    font-family: 'Cormorant', serif;
    font-style: italic;
    opacity: 0.8;
    transition: all 0.3s;
}

.rgpd-link:hover {
    opacity: 1;
    text-decoration: underline;
    color: var(--gold);
}

/* Modal Paramètres Cookies */
.cookie-settings {
    background: linear-gradient(135deg, var(--bg-card), var(--bg-elevated));
    color: var(--text);
    border: 3px solid var(--gold-dark);
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.2);
}

.cookie-settings h2 {
    font-family: 'Cinzel', serif;
    color: var(--gold);
    margin-bottom: 30px;
    text-shadow: 0 2px 10px rgba(255, 215, 0, 0.3);
}

.cookie-category {
    background: rgba(255, 215, 0, 0.05);
    border: 1px solid var(--border-gold);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.cookie-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.cookie-header h3 {
    font-family: 'Cormorant', serif;
    color: var(--gold-light);
    font-size: 1.2rem;
    margin: 0;
}

.cookie-badge {
    background: var(--gold-dark);
    color: var(--bg);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.cookie-category p {
    color: var(--text-light);
    font-family: 'Cormorant', serif;
    line-height: 1.5;
}

/* Switch Style Médiéval */
.cookie-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.cookie-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--border);
    transition: 0.4s;
    border-radius: 24px;
    border: 1px solid var(--gold-dark);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: var(--gold-light);
    transition: 0.4s;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

input:checked + .slider {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
}

input:checked + .slider:before {
    transform: translateX(26px);
    background: white;
}

.cookie-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
}

/* Responsive pour bannière RGPD */
@media (max-width: 768px) {
    .rgpd-content {
        flex-direction: column;
        padding: 20px;
        text-align: center;
    }

    .rgpd-actions {
        flex-direction: column;
        width: 100%;
    }

    .rgpd-btn {
        width: 100%;
    }

    .rgpd-link {
        position: static;
        display: block;
        margin-top: 15px;
        text-align: center;
    }
}
/* ==================== MENU HAMBURGER ==================== */

.menu-hamburger {
    position: fixed;
    top: 20px;
    right: 220px; /* Position ajustée pour le widget plus large */
    z-index: 1000;
}

/* Bouton hamburger */
.menu-toggle {
    background: linear-gradient(135deg, rgba(26, 26, 38, 0.9), rgba(18, 18, 26, 0.95));
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 10px;
    width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.menu-toggle:hover {
    border-color: var(--gold);
    background: linear-gradient(135deg, rgba(30, 30, 46, 0.95), rgba(22, 22, 32, 0.98));
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.2);
}

/* Les 3 barres du hamburger */
.menu-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--gold);
    transition: all 0.3s ease;
    border-radius: 2px;
}

.menu-toggle:hover span {
    background: var(--gold-light);
}

/* Menu déroulant */
.menu-dropdown {
    position: absolute;
    top: 54px;
    right: 0;
    background: linear-gradient(135deg, rgba(26, 26, 38, 0.98), rgba(18, 18, 26, 0.99));
    border: 2px solid var(--gold-dark);
    border-radius: 15px;
    min-width: 280px;
    padding: 0;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    backdrop-filter: blur(20px);
}

.menu-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* En-tête du menu */
.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
}

.menu-header h3 {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    color: var(--gold);
    margin: 0;
}

.menu-close {
    background: none;
    border: none;
    color: var(--gold);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.menu-close:hover {
    opacity: 1;
}

/* Liste du menu */
.menu-list {
    list-style: none;
    margin: 0;
    padding: 10px 0;
}

.menu-list li {
    margin: 0;
}

.menu-list a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.menu-list a:hover {
    background: rgba(255, 215, 0, 0.1);
    color: var(--gold-light);
}

.menu-list a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--gold);
    transition: height 0.3s ease;
}

.menu-list a:hover::before {
    height: 60%;
}

/* Icônes et texte du menu */
.menu-icon {
    font-size: 20px;
    margin-right: 12px;
    width: 24px;
    text-align: center;
}

.menu-text {
    flex: 1;
    font-family: 'Cormorant', serif;
    font-size: 1.1rem;
    font-weight: 600;
}

.menu-desc {
    display: none;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-left: auto;
    font-style: italic;
}

.menu-list a:hover .menu-desc {
    display: block;
}

/* Animation d'apparition du menu */
@keyframes menuSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .menu-hamburger {
        right: 170px; /* Ajusté pour le widget plus large */
    }

    .menu-dropdown {
        right: -50px; /* Centrer le menu sur mobile */
        min-width: 250px;
    }

    .menu-desc {
        display: none !important; /* Cacher les descriptions sur mobile */
    }

    .menu-text {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .menu-hamburger {
        right: 150px; /* Ajusté pour le widget plus large */
    }

    .menu-dropdown {
        position: fixed;
        top: 80px;
        left: 20px;
        right: 20px;
        width: auto;
        min-width: unset;
    }
}

/* ============================================
   VERSION MOBILE 8H10 - NE PAS TOUCHER AU DESKTOP
   ============================================ */

/* Masquer par défaut les éléments mobile-only sur desktop */
@media (min-width: 769px) {
    .mobile-only {
        display: none !important;
    }
}

/* Mobile uniquement - reproduction exacte version 8h10 */
@media (max-width: 768px) {
    /* Assurer le fond sombre unifié sur mobile */
    html {
        background: #0d0d1a !important;
    }

    body {
        background: #0d0d1a !important;
    }

    .container {
        background: #0d0d1a !important;
    }

    .messages {
        background: #0d0d1a !important;
    }

    /* Cache les widgets desktop sur mobile */
    .credits-widget {
        display: none !important;
    }

    .doc-link {
        display: none !important;
    }

    /* Affiche uniquement les widgets mobile */
    .mobile-only {
        display: block !important;
    }

    /* Cache le bouton paramètres RGPD sur mobile */
    .rgpd-settings {
        display: none !important;
    }

    /* Widgets flottants mobiles en haut à droite */
    .floating-widgets.mobile-only {
        position: fixed !important;
        top: 10px !important;
        right: 10px !important;
        z-index: 1001 !important;
        display: flex !important;
        gap: 8px !important;
    }

    /* Widget crédits mobile compact */
    .credits-widget-mobile {
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
        background: rgba(13, 13, 26, 0.95) !important;
        border: 1px solid rgba(212, 175, 55, 0.3) !important;
        border-radius: 20px !important;
        padding: 4px 8px !important;
        height: 32px !important;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5) !important;
    }

    .credits-widget-mobile .credits-icon {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .credits-widget-mobile .credits-icon svg {
        width: 16px !important;
        height: 16px !important;
        color: rgba(212, 175, 55, 0.8) !important;
    }

    .credits-count-mobile {
        color: #d4af37 !important;
        font-weight: 600 !important;
        font-size: 14px !important;
        min-width: 20px !important;
        text-align: center !important;
    }

    .credits-widget-mobile .btn-buy-credits {
        background: transparent !important;
        border: none !important;
        color: rgba(212, 175, 55, 0.7) !important;
        cursor: pointer !important;
        padding: 2px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        transition: color 0.2s !important;
    }

    .credits-widget-mobile .btn-buy-credits:hover {
        color: #d4af37 !important;
    }

    .credits-widget-mobile .btn-buy-credits svg {
        width: 12px !important;
        height: 12px !important;
    }

    /* Bouton documentation mobile */
    .doc-link-mobile {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 32px !important;
        height: 32px !important;
        background: rgba(13, 13, 26, 0.95) !important;
        border: 1px solid rgba(212, 175, 55, 0.3) !important;
        border-radius: 50% !important;
        text-decoration: none !important;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5) !important;
        transition: all 0.3s ease !important;
    }

    .doc-link-mobile:hover {
        border-color: rgba(212, 175, 55, 0.5) !important;
        transform: scale(1.05) !important;
    }

    .doc-link-mobile svg {
        width: 18px !important;
        height: 18px !important;
        color: rgba(212, 175, 55, 0.8) !important;
    }


    .header-content {
        gap: 12px !important;
        overflow: visible !important;
        display: block !important; /* Pas flex sur mobile */
        width: 100% !important;
    }

    .header-text {
        overflow: visible !important;
        width: 100% !important;
        max-width: none !important;
    }

    /* Cache l'avatar hero sur mobile */
    .avatar-hero {
        display: none !important;
    }

    /* Titre sur 2 lignes sur mobile */
    .hero-title {
        font-size: 1.1rem !important;
        line-height: 1.5 !important;  /* Augmenté pour plus d'espace */
        margin-bottom: 10px !important;  /* Plus d'espace en bas */
        white-space: normal !important;
        max-width: 100% !important;
        text-align: left !important;  /* Aligné à gauche sur mobile */
        overflow: visible !important;
        width: 100% !important;
        min-height: 50px !important;  /* Hauteur minimale pour garantir l'espace */
    }

    /* Masquer le sous-titre sur mobile */
    .hero-subtitle {
        display: none !important;
    }

    /* Header mobile avec tout l'espace nécessaire */
    .header-v2 {
        position: relative !important;
        z-index: 100 !important;
        min-height: 120px !important; /* Plus d'espace pour le titre sur 2-3 lignes */
        height: auto !important;
        padding: 10px 15px 20px !important;
        margin-bottom: 10px !important;
        transform: translateZ(0) !important;
        overflow: visible !important; /* CRITIQUE: Ne pas couper le texte */
    }

    /* Status avec point vert pulsant */
    .status {
        font-size: 0.75rem !important;
    }

    .status-dot {
        width: 6px !important;
        height: 6px !important;
        background: #00ff00 !important;
        animation: pulse-status 2s infinite !important;
    }

    @keyframes pulse-status {
        0%, 100% {
            opacity: 1;
            transform: scale(1);
        }
        50% {
            opacity: 0.5;
            transform: scale(1.2);
        }
    }

    /* Messages plus compacts avec espace pour Safari iOS */
    .messages {
        padding: 10px !important;
        padding-bottom: 20px !important;
    }

    /* Ajustement pour iOS Safari */
    @supports (-webkit-touch-callout: none) {
        .messages {
            padding-bottom: 30px !important;
        }
    }

    .message {
        gap: 8px !important;
        margin-bottom: 12px !important;
    }

    .message-avatar {
        width: 35px !important;
        height: 35px !important;
        cursor: pointer !important;
    }

    .message-avatar img {
        width: 35px !important;
        height: 35px !important;
    }

    .message-bubble {
        padding: 10px 12px !important;
        font-size: 0.95rem !important;
    }

    /* Zone de saisie très fine avec espace pour Safari iOS */
    .input-area {
        padding: 8px !important;
        padding-bottom: 28px !important; /* Espace pour la barre Safari */
        position: relative !important;
        z-index: 50 !important; /* Plus bas que le header (100) */
    }

    /* Ajustement spécifique pour iOS Safari */
    @supports (-webkit-touch-callout: none) {
        .input-area {
            padding-bottom: env(safe-area-inset-bottom, 28px) !important;
            padding-bottom: max(28px, env(safe-area-inset-bottom)) !important;
        }
    }

    .input-form {
        gap: 8px !important;
    }

    #input {
        font-size: 16px !important;  /* Min 16px pour éviter le zoom automatique iOS */
        padding: 8px 12px !important;
        min-height: 36px !important;
        max-height: 80px !important;
    }

    #send-btn {
        width: 36px !important;
        height: 36px !important;
    }

    /* Popup avatar mobile */
    .avatar-popup {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.9);
        z-index: 2000;
        justify-content: center;
        align-items: center;
    }

    .avatar-popup-content {
        position: relative;
        max-width: 90%;
        max-height: 90%;
    }

    .avatar-popup-content img {
        width: 100%;
        height: auto;
        border-radius: 10px;
    }

    .avatar-popup-close {
        position: absolute;
        top: -40px;
        right: 0;
        background: transparent;
        border: none;
        color: white;
        font-size: 36px;
        cursor: pointer;
    }
}
