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

:root {
    --bg-dark: #262626;
    --input-bg: #3a3a3a;
    --input-focus: #4a4a4a;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --accent: #8ffe0c; /* #5b9bd5 */
    --accent-hover: #4a8bc2;
    --border: #505050;
    --result-hover: #3f3f3f;
    --shadow: rgba(0, 0, 0, 0.3);
    --brand-color: #8ffe0c;
    --tooltip-bg: rgba(26, 26, 26, 0.95);
    --tooltip-border: #404040;
}

/* Body et container principal */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    height: 100vh;
    padding: 0;
    margin: 0;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 4rem 1.5rem 2rem;
    flex: 1;
    position: relative;
    z-index: 0;
}

.search-wrapper {
    width: 100%;
    margin-top: 2rem;
}

/* Titre */
.title {
    text-align: center;
    font-size: 3rem;
    font-weight: 300;
    margin-bottom: 2rem;
    margin-top: 0;
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Animation flip board pour les lettres */
.title-letter {
    display: inline-block;
    width: 0.75em;       /* Largeur fixe pour éviter les mouvements */
    text-align: center;
    flex-shrink: 0;      /* Ne pas rétrécir */
}

.title-letter.animating {
    animation: flip 0.05s linear;
}

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

/* Désactiver l'animation sur mobile */
@media (max-width: 768px) {
    .title {
        pointer-events: none;
    }

    .title-letter.animating {
        animation: none;
    }
}

/* Input de recherche - Focus permanent avec border vert */
.search-input {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.2rem;
    background-color: var(--input-focus);
    border: 1px solid #8ffe0c !important;
    box-shadow: none !important;
    border-radius: 8px;
    color: var(--text-primary);
    outline: none !important;
    transition: all 0.3s ease;
    font-family: inherit;
}

.search-input:focus,
.search-input:active,
.search-input:focus-visible {
    border: 1px solid #8ffe0c !important;
    box-shadow: none !important;
    outline: none !important;
}

.search-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

/* Container des résultats */
.results-container {
    margin-top: 1rem;
    /* Hauteur = 6 lignes × (padding 24px + line-height 28px + border 1px) = 53px par ligne
       6 lignes = 318px pour afficher exactement 6 résultats sans coupure */
    max-height: 318px;
    overflow-y: auto;
    border-radius: 8px;
    background-color: var(--input-bg);
    box-shadow: 0 4px 6px var(--shadow);
}

.results-container:empty {
    display: none;
}

/* Scrollbar personnalisée */
.results-container::-webkit-scrollbar {
    width: 8px;
}

.results-container::-webkit-scrollbar-track {
    background: var(--input-bg);
}

.results-container::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.results-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Items de résultats */
.result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border);
    transition: background-color 0.2s ease;
}

.result-item:last-child {
    border-bottom: none;
}

.result-item:hover {
    background-color: var(--result-hover);
}

/* Match exact : vert transparent */
.result-item.exact-match {
    background-color: rgba(76, 175, 80, 0.15);
    border-left: 3px solid #8FFE0C; /* #4CAF50 */
}

/* Suggestion fuzzy : orange transparent */
.result-item.fuzzy-match {
    background-color: rgba(255, 152, 0, 0.15);
    border-left: 3px solid #ff9800;
}

.result-word {
    font-size: 1.1rem;
    color: var(--text-primary);
    flex-grow: 1;
    user-select: text;
}

.result-word.has-info {
    cursor: pointer;
}

.result-word .word-suffix {
    color: #a2a2a2;
}

/* Indicateurs et icône copier */
.indicators {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-right: 22px;
}

.indicator-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.indicator-dot.antonym {
    background-color: #4EE0FF;
}

.indicator-dot.etymology {
    background-color: #A1FF00;
}

.indicator-dot.synonym {
    background-color: #FEB6FF;
}

.copy-icon {
    font-size: 1.3rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0.25rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copy-icon:hover {
    color: var(--accent);
    background-color: var(--result-hover);
    /* transform: scale(1.1); */
}

.copy-icon:active {
    transform: scale(0.95);
}

.copy-icon.copied {
    color: #8FFE0C; /* #4CAF50 */
}

/* Message de chargement */
.loading-message {
    padding: 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
}

/* Message aucun résultat */
.no-results {
    padding: 1rem;
    text-align: center;
    color: var(--text-secondary);
}

/* Compteur de résultats et bouton clear dans l'input */
.search-input-wrapper {
    position: relative;
    width: 100%;
}

.clear-button {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    z-index: 2;
}

.clear-button:hover {
    color: #FF0D0D;
    background-color: var(--result-hover);
}

.result-count {
    position: absolute;
    right: 3.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 0.95rem;
    pointer-events: none;
    font-weight: 500;
}

/* ========== TOOLTIPS PERSONNALISÉS (DESKTOP UNIQUEMENT) ========== */

@media (min-width: 1025px) {
    /* Container du tooltip */
    .custom-tooltip {
        position: absolute;
        background-color: var(--tooltip-bg);
        color: #E0E0E0;
        padding: 0.5rem 0.75rem;
        border-radius: 6px;
        font-size: 0.85rem;
        white-space: nowrap;
        pointer-events: none;
        z-index: 10001;
        opacity: 0;
        transform: translateY(8px);
        transition: opacity 0.2s ease, transform 0.2s ease;
        border: 1px solid rgba(143, 254, 12, 0.25);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    }

    .custom-tooltip.show {
        opacity: 1;
        transform: translateY(0);
    }

    /* Flèche du tooltip (pointant vers la gauche) */
    .custom-tooltip::after {
        content: '';
        position: absolute;
        right: 100%;
        top: 50%;
        transform: translateY(-50%);
        border: 6px solid transparent;
        border-right-color: var(--tooltip-bg);
    }

    .custom-tooltip::before {
        content: '';
        position: absolute;
        right: 100%;
        top: 50%;
        transform: translateY(-50%);
        border: 7px solid transparent;
        border-right-color: rgba(143, 254, 12, 0.25);
        margin-right: 1px;
    }

    /* Coffee button */
    .coffee-button {
        height: 60px !important; /* 60px */
        width: 217px !important; /* 217px */
        transition: opacity 0.2s ease;
        display: block;
        clip-path: inset(0 round 12px);
    }

    .coffee-button:hover {
        opacity: 0.8;
    }
}

/* Responsive */

/* Tablettes (768px - 1024px) */
@media (max-width: 1024px) and (min-width: 769px) {
    .container {
        max-width: 680px;
        padding: 3.5rem 2rem 2rem;
    }

    .title {
        font-size: 2.25rem;
    }

    .search-input {
        font-size: 1.1rem;
        padding: 0.95rem 1.4rem;
    }

    .results-container {
        max-height: 300px;
    }

    .result-word {
        font-size: 1.05rem;
    }
}

/* Mobiles paysage / Petites tablettes (641px - 768px) */
@media (max-width: 768px) and (min-width: 641px) {
    .container {
        max-width: 640px;
        padding: 3rem 1.75rem 2rem;
    }

    .title {
        font-size: 2.15rem;
    }

    .search-input {
        font-size: 1.05rem;
        padding: 0.925rem 1.35rem;
    }

    .result-count {
        right: 3.25rem;
    }
}

/* Mobiles portrait (≤ 640px) */
@media (max-width: 640px) {
    .title {
        font-size: 2rem;
        margin-bottom: 1rem;
    }

    .search-input {
        font-size: 1rem;
        padding: 0.875rem 1.25rem;
    }

    .result-item {
        padding: 0.625rem 1rem;
    }

    .result-word {
        font-size: 1rem;
    }

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

    .clear-button {
        font-size: 1.2rem;
        right: 0.875rem;
        top: 50%;
        transform: translateY(-50%);
    }

    .result-count {
        font-size: 0.85rem;
        right: 3rem;
    }

    /* Panneau enrichissement mobile - flow naturel */
    .enrichment-panel {
        margin-top: 1rem;
        margin-bottom: 2rem;
        padding: 1.5rem;
    }

    .enrichment-header {
        position: static;
        margin: 0;
        padding: 0 0 1rem 0;
    }

    .enrichment-word {
        font-size: 1.5rem;
    }

    .enrichment-score {
        font-size: 0.9rem;
    }
}

/* Modale */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    opacity: 0;
    animation: fadeIn 0.2s ease forwards;
}

.modal-content {
    background-color: var(--input-bg);
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    min-height: 300px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--text-primary);
    background-color: var(--result-hover);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.modal-section {
    margin-bottom: 2rem;
}

.modal-section:last-child {
    margin-bottom: 0;
}

.modal-section-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0.75rem 1rem;
    border-radius: 6px;
}

.modal-section-title.antonym {
    background-color: rgba(78, 224, 255, 0.15);
}

.modal-section-title.etymology {
    background-color: rgba(161, 255, 0, 0.15);
}

.modal-section-title.synonym {
    background-color: rgba(254, 182, 255, 0.15);
}

.modal-section-content {
    color: var(--text-primary);
    font-size: 1.05rem;
    line-height: 1.6;
}

.modal-section-content ul {
    list-style: none;
    padding: 0;
}

.modal-section-content li {
    padding: 0.5rem 0;
}

.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: var(--input-bg);
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Responsive modale */
@media (max-width: 640px) {
    .modal-content {
        max-height: 85vh;
    }

    .modal-header {
        padding: 1.25rem;
    }

    .modal-title {
        font-size: 1.25rem;
    }

    .modal-body {
        padding: 1.25rem;
    }

    .modal-section {
        margin-bottom: 1.5rem;
    }

    .modal-section-content {
        font-size: 1rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-item {
    animation: fadeIn 0.2s ease;
}

/* Panneau latéral */
.side-panel {
    position: fixed;
    top: 0;
    left: -450px;
    width: 450px;
    height: 100vh;
    background-color: #343434; /* var(--bg-dark) */
    z-index: 1000;
    transition: left 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
    overflow-x: visible;
    overflow-y: scroll;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.5);
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    will-change: left;
}

.side-panel::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

.side-panel.open {
    left: 0;
}

.side-panel-content {
    padding: 1.5rem;
}

/* Languette du panneau */
.panel-tab {
    position: fixed;
    top: 25px;
    left: 0;
    width: 72px;
    height: 50px;
    background-color: #474747;
    border-radius: 0 8px 8px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    /* box-shadow: 3px 2px 10px rgba(0, 0, 0, 0.3); */
    z-index: 9999;
    transition: left 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
    padding: 4px;
    text-decoration: none;
    will-change: left;
}

/* Languette active (même couleur que le panneau latéral) */
.panel-tab.active {
    background-color: #343434;
    /* box-shadow: 3px 2px 10px rgba(0, 0, 0, 0.3); */
    border-radius: 0 8px 8px 0;
    /* border-top: 1px solid #E0E0E0;
    border-right: 1px solid #E0E0E0;
    border-bottom: 1px solid #E0E0E0; */
    padding: 0;
    transition: left 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* Languette du panneau coffee */
.panel-tab-coffee {
    position: fixed;
    top: 25px;
    left: 0;
    width: 72px;
    height: 50px;
    background-color: #CCC;
    border-radius: 0 8px 8px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    /* box-shadow: 3px 2px 10px rgba(0, 0, 0, 0.3); */
    z-index: 9999;
    transition: left 0.6s cubic-bezier(0.25, 0.1, 0.25, 1), opacity 0.3s ease;
    padding: 4px;
    text-decoration: none;
    opacity: 1;
    will-change: left, opacity;
}

/* Languette active coffee (même couleur que le panneau latéral) */
.panel-tab-coffee.active {
    background-color: #CCC;
    border-radius: 0 8px 8px 0;
    padding: 0;
    transition: left 0.6s cubic-bezier(0.25, 0.1, 0.25, 1), opacity 0.3s ease;
    opacity: 1;
}

.panel-tab img {
    width: 48px;
    height: 36px;
    display: block;
    pointer-events: none;
}

.side-panel.open ~ .panel-tab {
    left: 450px;
}

.side-panel.open ~ .panel-tab-coffee {
    left: 450px;
}

/* Positionnement vertical des languettes (hauteur 50px + 2px espacement = 52px) */
#panelTabFR {
    top: 25px;
}

#panelTabDE {
    top: 77px; /* 25 + 52 */
}

#panelTabEN {
    top: 129px; /* 25 + 104 */
}

#panelTabES {
    top:181px; /* 25 + 156 */
}

#panelTabIT {
    top: 233px; /* 25 + 208 */
}

#panelTabJA {
    top: 285px; /* 25 + 260 */
}

#panelTabPT {
    top: 337px; /* 25 + 312 */
}

#panelTabCoffee {
    top: 389px; /* 25 + 364 */
    cursor: pointer;
    overflow: hidden;
    /* Transition douce sur la largeur pour l'effet de déploiement soft */
    transition: left 0.6s cubic-bezier(0.25, 0.1, 0.25, 1), opacity 0.3s ease, width 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
}

#panelTabCoffee.open {
    width: 217px; /* Largeur déployée pour afficher le bouton */
    cursor: pointer;
    background-color: #4A4A4A; /* Test couleur demandée */
    /* Image du bouton buymeacoffee en background - pleine largeur */
    background-image: url('https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=&slug=panlogia&button_colour=4a4a4a&font_colour=ffffff&font_family=Cookie&outline_colour=ffffff&coffee_colour=FFDD00');
    background-size: 210px auto; /* Bouton élargi pour remplir l'espace */
    background-repeat: no-repeat;
    background-position: center;
}

/* Icône café (visible par défaut, fade out progressif quand déployé) */
.coffee-icon {
    display: block;
    flex-shrink: 0;
    pointer-events: none;
    position: relative;
    z-index: 1;
    opacity: 1;
    transition: opacity 0.6s cubic-bezier(0.25, 0.1, 0.25, 1); /* Fade progressif */
}

#panelTabCoffee.open .coffee-icon {
    opacity: 0; /* Fade out au lieu de disparition brutale */
}

.panel-tab i {
    color: var(--bg-dark);
    font-size: 2.2rem;
    font-weight: 600;
    line-height: 1;
    display: block;
    transition: transform 0.3s ease;
}

/* Contenu SEO */
.seo-content {
    margin: 0;
    padding: 2.5rem;
    background: linear-gradient(135deg, rgba(58, 58, 58, 0.4), rgba(58, 58, 58, 0.2));
    border-radius: 16px;
    border: 1px solid rgba(143, 254, 12, 0.25); /* rgba(109, 209, 0, 0.1); */
    color: var(--text-primary);
    line-height: 1.9;
}

.seo-content h1 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #E0E0E0; /* var(--brand-color) */
    text-align: center;
    letter-spacing: 0.5px;
}

.seo-content h2 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    border-left: 4px solid var(--brand-color);
    padding-left: 1rem;
}

/* Ancien h3 conservé pour rétrocompatibilité si besoin */
.seo-content h3 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    border-left: 4px solid var(--brand-color);
    padding-left: 1rem;
}

.seo-content p {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    text-align: justify;
}

.seo-content ul,
.seo-content ol {
    margin-bottom: 2rem;
    padding-left: 2.5rem;
    color: var(--text-secondary);
}

.seo-content ol {
    list-style-type: decimal;
    list-style-position: outside;
}

.seo-content ul {
    list-style-type: disc;
    list-style-position: outside;
}

.seo-content li {
    margin-bottom: 0.75rem;
    padding-left: 0.5rem;
    line-height: 1.8;
}

.seo-content strong {
    color: var(--brand-color);
    font-weight: 600;
}

.seo-content em {
    color: var(--text-primary);
    font-style: italic;
}

/* Footer */
.footer {
    width: 100%;
    padding: 2rem 1.5rem;
    text-align: center;
    background-color: var(--bg-dark);
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-shrink: 0;
}

.footer a {
    display: inline-block;
    border-radius: 12px;
    overflow: hidden;
    line-height: 0;
}

/* Coffee button */
.coffee-button {
    height: 35px; /* 60px */
    width: 127px; /* 217px */
    transition: opacity 0.2s ease;
    display: block;
    clip-path: inset(0 round 12px);
}

.coffee-button:hover {
    opacity: 0.8;
}

/* .footer-separator {
    color: #949494;
    font-weight: 300;
    font-size: 1.2rem;
    display: inline-block;
    margin: 0 0.5rem;
} */

.footer-copyright {
    color: #949494;
    font-style: italic;
    font-weight: 300;
    font-size: 0.8rem;
    opacity: 0.8;
    display: inline-block;
    white-space: nowrap;
    position: relative;
    top: 1.5px;
}

/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */

/* Sélecteur de langue mobile (caché sur desktop) */
.mobile-lang-selector {
    display: none;
}

/* Cacher les éléments mobiles sur desktop */
.mobile-lang-selector,
.mobile-seo-trigger,
.mobile-seo-overlay {
    display: none;
}

@media (max-width: 767px) {
    /* ========== AJUSTEMENTS LAYOUT MOBILE ========== */

    /* Fixer le viewport pour éviter le resize au clavier */
    body {
        height: auto !important;
        min-height: 100vh;
        overflow: visible !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Barre opaque en haut pour masquer le contenu qui scroll sous les éléments fixes */
    body::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 80px;
        background-color: var(--bg-dark);
        z-index: 9999;
        pointer-events: none;
    }

    .container {
        height: auto !important;
        padding-top: 120px !important;
        padding-left: 1.5rem;
        padding-right: 1.5rem;
        padding-bottom: 2rem;
    }

    /* ========== CACHE LES ÉLÉMENTS DESKTOP ========== */

    /* Cacher les languettes desktop sur mobile */
    .panel-tab {
        display: none !important;
    }

    /* Afficher et repositionner le coffee tab sur mobile */
    #panelTabCoffee {
        display: flex !important;
        top: 0.75rem !important; /* Aligné avec le flag */
        right: 0 !important; /* Collé au bord droit */
        left: auto !important; /* Annuler le left du desktop */
        width: 50px; /* Ajuster la largeur */
        height: 44px; /* Ajuster la hauteur */
        align-items: center; /* Centrage vertical de l'icône */
        justify-content: center; /* Centrage horizontal de l'icône */
        border-radius: 8px 0 0 8px !important; /* Arrondis à gauche uniquement */
        z-index: 10002 !important; /* Au-dessus du trigger */
        transform-origin: right center; /* Déploiement de droite vers gauche */
    }

    /* Coffee tab déployé sur mobile */
    #panelTabCoffee.open {
        width: 210px !important; /* Longueur de la languette déployée */
    }

    /* Cacher le panneau latéral desktop sur mobile (mais garder dans le DOM pour copier le contenu) */
    .side-panel {
        visibility: hidden !important;
        pointer-events: none !important;
        left: -9999px !important;
    }

    /* ========== SÉLECTEUR DE LANGUE MOBILE (HAUT GAUCHE) ========== */

    .mobile-lang-selector {
        display: block;
        position: fixed;
        top: 1rem;
        left: 1rem;
        z-index: 10000;
    }

    /* Bouton avec drapeau actuel */
    .mobile-lang-button {
        width: 40px;
        height: 40px;
        background-color: var(--bg-dark);
        border: none;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.8), 0 3px 10px rgba(0, 0, 0, 0.6); /* shadow flag */
        border-radius: 50%;
    }

    .mobile-lang-button img {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        box-shadow: 4px 6px 16px rgba(0, 0, 0, 0.8), 2px 3px 6px rgba(0, 0, 0, 0.7);
        opacity: 0.7;
    }

    /* Menu déroulant des drapeaux */
    .mobile-lang-dropdown {
        position: absolute;
        top: 56px;
        left: 0;
        background-color: #343434;
        border-radius: 12px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
        padding: 0.5rem;
        min-width: 180px;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transform: translateY(-10px);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        pointer-events: none;
    }

    .mobile-lang-dropdown.open {
        max-height: 500px;
        opacity: 1;
        transform: translateY(0);
        pointer-events: all;
    }

    .mobile-lang-item {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.65rem 0.85rem;
        text-decoration: none;
        color: var(--text-primary);
        border-radius: 8px;
    }

    .mobile-lang-item:active {
        background-color: #474747;
    }

    .mobile-lang-item.active {
        background-color: #5a5a5a;
    }

    .mobile-lang-item img {
        width: 28px;
        height: 28px;
        border-radius: 50%;
        flex-shrink: 0;
    }

    .mobile-lang-name {
        font-size: 0.95rem;
        color: var(--text-primary);
    }

    /* ========== OVERLAY SEO MOBILE ========== */

    /* Trigger "Über..." en haut à gauche, juste après les drapeaux */
    .mobile-seo-trigger {
        position: fixed;
        top: 1.50rem;
        left: 50%;
        transform: translateX(-50%);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        padding: 0;
        background-color: var(--bg-dark);
        border: none;
        color: var(--text-primary);
        font-size: 0.85rem;
        cursor: pointer;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
        z-index: 10000;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.8), 0 3px 10px rgba(0, 0, 0, 0.6); /* trigger shadow */ 
        border-radius: 8px;
        padding: 0.25rem 0.5rem;
    }

    .mobile-seo-trigger-text {
        font-weight: 300;
        color: #949494;
        font-style: italic;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: calc(100vw - 7rem);
    }

    /* ========== AJUSTEMENTS SPÉCIFIQUES PAR LANGUE ========== */

    /* Trigger japonais : ajustement vertical pour les caractères plus hauts
       Les caractères japonais (について) ont une hauteur supérieure aux caractères latins
       Nécessite un positionnement légèrement différent pour l'alignement visuel

       MODIFICATION FACILE : Ajuster la valeur de 'top' ci-dessous
       - Valeur par défaut (autres langues) : 1.80rem (ligne 1000)
       - Valeur japonaise : à ajuster selon besoin visuel */
    .mobile-seo-trigger[data-lang="ja"],
    html[lang="ja"] .mobile-seo-trigger {
        top: 1.52rem !important;
    }

    /* Footer japonais : réduction du padding-top pour éviter que le footer soit tronqué */
    html[lang="ja"] .footer {
        padding-top: 1rem !important;
    }

    /* Footer copyright japonais : force la police latine pour l'italique */
    html[lang="ja"] .footer-copyright {
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
        font-style: italic !important;
        font-weight: 300 !important;
    }

    /* Titre japonais : harmoniser avec les autres langues (police, graisse, espacement) */
    html[lang="ja"] .title {
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
        font-weight: 300 !important;
        letter-spacing: normal !important;
    }

    /* Input japonais : réduire le padding vertical pour harmoniser la hauteur */
    html[lang="ja"] .search-input {
        padding: 0.75rem 1.5rem !important;
    }

    /* Trigger japonais : réduire le padding vertical pour harmoniser la hauteur du container */
    html[lang="ja"] .mobile-seo-trigger {
        padding: 0.1rem 0.5rem !important;
    }

    html[lang="ja"] .mobile-seo-trigger-text {
        line-height: 1.49; /* ou margin-top: -0.1rem; ou transform: translateY(-1px); */
    }

    /* Overlay fullscreen */
    .mobile-seo-overlay {
        display: none;
        position: fixed;
        top: 4rem;
        left: 0;
        width: 100%;
        height: calc(100% - 4rem);
        background-color: #262626;
        z-index: 9998;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .mobile-seo-overlay.open {
        display: block;
        opacity: 1;
        pointer-events: all;
    }

    /* Contenu de l'overlay */
    .mobile-seo-content {
        max-width: 95%;
        margin: 1.5rem auto 3rem;
        padding: 0 0.5rem;
        transform: translateY(20px);
        opacity: 0;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .mobile-seo-overlay.open .mobile-seo-content {
        transform: translateY(0);
        opacity: 1;
    }

    .mobile-seo-content-inner {
        background-color: #262626;
        padding: 1.5rem 1.25rem;
    }

    /* Styles IDENTIQUES au desktop pour le contenu SEO */
    .mobile-seo-content h1 {
        font-size: 1.35rem;
        margin-bottom: 1.5rem;
        color: #E0E0E0;
        font-weight: 700;
        word-break: normal;
        hyphens: auto;
        line-height: 1.4;
    }

    .mobile-seo-content h3 {
        font-size: 1.4rem;
        margin-top: 2rem;
        margin-bottom: 1rem;
        color: var(--brand-color);
        font-weight: 600;
    }

    .mobile-seo-content p {
        margin-bottom: 1.5rem;
        line-height: 1.8;
        color: var(--text-secondary);
        font-size: 1rem;
        text-align: justify;
    }

    .mobile-seo-content ol,
    .mobile-seo-content ul {
        margin-bottom: 1.5rem;
        padding-left: 2rem;
        text-align: justify;
    }

    .mobile-seo-content li {
        margin-bottom: 0.75rem;
        color: var(--text-secondary);
        line-height: 1.8;
        font-size: 1rem;
        text-align: justify;
    }

    .mobile-seo-content strong {
        color: var(--brand-color);
        font-weight: 600;
    }

    .mobile-seo-content em {
        font-style: italic;
        color: #E0E0E0;
    }

    /* ========== AJUSTEMENTS GÉNÉRAUX MOBILE ========== */

    .container {
        padding-top: 0;
        padding-bottom: 5rem;
    }

    /* Titre en position static pour permettre le scroll */
    .title {
        position: static !important;
        width: 100% !important;
        margin-top: 0 !important;
        margin-bottom: 1rem !important;
    }

    /* Wrapper de recherche en position static pour permettre le scroll */
    .search-wrapper {
        position: static !important;
        margin-top: 1rem !important;
        padding: 0 !important;
    }

    /* Input sans border par défaut sur mobile, border vert uniquement au focus */
    .search-input {
        border: 1px solid transparent !important;
    }

    .search-input:focus,
    .search-input:active,
    .search-input:focus-visible {
        border: 1px solid #8ffe0c !important;
    }

    /* Limiter la hauteur des résultats pour éviter de pousser le footer */
    .results-container {
        max-height: 38vh;
        overflow-y: auto;
        z-index: 10; /* Au-dessus du footer pour visibilité correcte */
    }

    /* Footer en position static pour permettre le scroll */
    .footer {
        padding: 1.5rem 1rem;
        position: static;
        margin-top: 2rem;
    }
}

/* ==============================================================================
   ACCESSIBILITÉ - Focus visible pour tous les éléments interactifs
   ============================================================================== */

/* Focus visible pour boutons, liens et inputs */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Focus visible spécifique pour le bouton clear */
.clear-button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

/* Focus visible pour les éléments du menu langue mobile */
.mobile-lang-item:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

/* Focus visible pour le trigger SEO mobile */
.mobile-seo-trigger:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Screen reader only - Texte visible uniquement pour les lecteurs d'écran */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==============================================================================
   PANNEAU D'ENRICHISSEMENT
   ============================================================================== */

.enrichment-panel {
    margin-top: 2rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.3s ease-out;
    width: 100%;
    box-sizing: border-box;
}

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

/* Header du panneau - Mot + Badge + Score - FIXE */
.enrichment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    margin: -1.5rem -1.5rem 1.5rem -1.5rem; /* Compenser le padding du panel parent */
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.enrichment-word {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.enrichment-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.enrichment-badge {
    font-size: 1.2rem;
}

.enrichment-score {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Contenu du panneau */
.enrichment-content {
    width: 100%;
    box-sizing: border-box;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

.enrichment-section {
    margin-bottom: 1.5rem;
}

.enrichment-section:last-child {
    margin-bottom: 0;
}

.enrichment-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.enrichment-section-title i {
    font-size: 1.2rem;
}

/* Définitions */
.enrichment-definitions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.enrichment-definition-item {
    padding: 0.5rem;
    background: var(--input-bg);
    border-radius: 6px;
    color: var(--text-primary);
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Tags pour synonymes et antonymes */
.enrichment-synonyms,
.enrichment-antonyms {
    line-height: 2;
}

.enrichment-tag {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    margin: 0.25rem; /* Margin pour l'espacement */
    background: var(--input-bg);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    white-space: nowrap;
    vertical-align: top;
}

.enrichment-tag:hover {
    background-color: rgba(143, 254, 12, 0.2); /* Vert clair de la border input */
}

/* Phonétique */
.enrichment-phonetic {
    padding: 0.75rem;
    background: var(--input-bg);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
}

/* Étymologie */
.enrichment-etymology {
    padding: 0.75rem;
    background: var(--input-bg);
    border-radius: 6px;
    color: var(--text-primary);
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Exemples */
.enrichment-examples {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.enrichment-example-item {
    padding: 0.5rem;
    background: var(--input-bg);
    border-radius: 6px;
    color: var(--text-primary);
    font-style: italic;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Sources */
.enrichment-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.enrichment-source-badge {
    padding: 0.3rem 0.6rem;
    background: var(--input-bg);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}
