/*
============================================================
MOT-LAMBDA — GAME SHELL
V29bk — menu, modal close motion, dark theme
============================================================
*/

:root {
    --ml-shell-surface: #ffffff;
    --ml-shell-surface-soft: #f5f5f2;
    --ml-shell-border: rgba(12, 28, 48, 0.10);
    --ml-shell-text: #202020;
    --ml-shell-muted: #6f7379;
    --ml-shell-navy: #0b1728;
    --ml-shell-gold: #e5b755;
}


/* ==========================================================
   HEADER UTILITY MENU
   ========================================================== */

.game-menu {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
}

.game-menu-panel[hidden] {
    display: none !important;
}

.game-menu-panel {
    position: absolute;
    z-index: 9500;
    top: calc(100% + 9px);
    right: 0;
    width: min(264px, calc(100vw - 24px));
    padding: 7px;
    border: 1px solid rgba(13, 30, 51, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.98);
    color: #182333;
    box-shadow: 0 18px 46px rgba(3, 15, 31, 0.18);
    backdrop-filter: blur(16px);
    animation: ml-game-menu-in 0.16s ease-out both;
}

@keyframes ml-game-menu-in {
    from {
        opacity: 0;
        transform: translateY(-5px) scale(0.985);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.game-menu-item,
.game-menu-theme-row {
    display: grid;
    width: 100%;
    min-height: 48px;
    grid-template-columns: 31px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    padding: 7px 8px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    text-align: left;
}

.game-menu-item {
    cursor: pointer;
}

.game-menu-item:hover,
.game-menu-item:focus-visible {
    background: #f2f3f1;
    outline: none;
}

.game-menu-item-icon {
    display: inline-flex;
    width: 31px;
    height: 31px;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: #f0f2f3;
    color: #24344b;
}

.game-menu-item-icon svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.game-menu-item-copy {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.game-menu-item-copy strong {
    font-size: 11px;
    font-weight: 850;
    line-height: 1.2;
}

.game-menu-item-copy small {
    color: #7b828b;
    font-size: 9px;
    line-height: 1.25;
}

.game-menu-divider {
    height: 1px;
    margin: 4px 7px;
    background: rgba(12, 29, 50, 0.09);
}

.game-theme-switch {
    position: relative;
    width: 38px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: #d6d9dc;
    cursor: pointer;
    transition: background 0.16s ease;
}

.game-theme-switch > span {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.20);
    transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}

.game-theme-switch[aria-checked="true"] {
    background: #d9aa4e;
}

.game-theme-switch[aria-checked="true"] > span {
    transform: translateX(16px);
}

.game-theme-switch:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}


/* ==========================================================
   STATS / ARCHIVES — TRUE SLIDE-DOWN CLOSE
   ========================================================== */

.stats-modal.is-closing,
.archives-modal.is-closing {
    pointer-events: none;
}

.stats-modal.is-closing .stats-dialog,
.archives-modal.is-closing .archives-dialog {
    animation: ml-sheet-dialog-out 0.21s cubic-bezier(0.4, 0, 1, 1) both !important;
}

.stats-modal.is-closing .stats-modal-backdrop,
.archives-modal.is-closing .archives-modal-backdrop {
    animation: ml-sheet-backdrop-out 0.20s ease-in both !important;
}

@keyframes ml-sheet-dialog-out {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateY(18px) scale(0.985);
    }
}

@keyframes ml-sheet-backdrop-out {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@media (max-width: 600px) {
    .stats-modal.is-closing .stats-dialog,
    .archives-modal.is-closing .archives-dialog {
        animation: ml-mobile-sheet-down 0.28s cubic-bezier(0.4, 0, 1, 1) both !important;
    }

    @keyframes ml-mobile-sheet-down {
        from {
            opacity: 1;
            transform: translateY(0);
        }

        to {
            opacity: 1;
            transform: translateY(100%);
        }
    }
}

@media (prefers-reduced-motion: reduce) {
    .stats-modal.is-closing .stats-dialog,
    .archives-modal.is-closing .archives-dialog,
    .stats-modal.is-closing .stats-modal-backdrop,
    .archives-modal.is-closing .archives-modal-backdrop,
    .game-menu-panel {
        animation: none !important;
    }
}


/* L'ancienne flamme de la série dans Mes statistiques est redondante. */
.player-stat-streak .player-stat-value::after {
    display: none !important;
    content: none !important;
}


/* ==========================================================
   DARK THEME
   ========================================================== */

html[data-theme="dark"] {
    color-scheme: dark;
    --ml-dark-bg: #08111f;
    --ml-dark-bg-2: #0b1625;
    --ml-dark-surface: #101c2b;
    --ml-dark-surface-2: #142234;
    --ml-dark-surface-3: #19283a;
    --ml-dark-border: rgba(206, 220, 238, 0.12);
    --ml-dark-text: #edf3f8;
    --ml-dark-muted: #9daaba;
}

html[data-theme="dark"] body {
    background: linear-gradient(180deg, #08111f 0%, #0b1625 100%) !important;
    color: var(--ml-dark-text) !important;
}

html[data-theme="dark"] .subtitle,
html[data-theme="dark"] .stat-label,
html[data-theme="dark"] .player-stat-label,
html[data-theme="dark"] .player-stats-kicker,
html[data-theme="dark"] .player-stats-note,
html[data-theme="dark"] .archives-kicker,
html[data-theme="dark"] .archives-count,
html[data-theme="dark"] .game-info-eyebrow,
html[data-theme="dark"] .game-info-section p,
html[data-theme="dark"] .game-info-card span,
html[data-theme="dark"] .archive-item-meta,
html[data-theme="dark"] .group-field label,
html[data-theme="dark"] .semantic-ranking-header span,
html[data-theme="dark"] .semantic-ranking-summary,
html[data-theme="dark"] .victory-timezone {
    color: var(--ml-dark-muted) !important;
}

html[data-theme="dark"] :where(
    .stat,
    .results,
    .latest-section,
    .yesterday-word-card,
    .victory-section,
    .victory-next,
    .victory-heat-summary,
    .victory-heat-summary-item,
    .stats-dialog,
    .archives-dialog,
    .game-info-dialog,
    .group-dialog,
    .semantic-ranking-dialog,
    .mc-dialog-panel,
    .seo-content
) {
    border-color: var(--ml-dark-border) !important;
    background: var(--ml-dark-surface) !important;
    color: var(--ml-dark-text) !important;
    box-shadow: 0 18px 54px rgba(0, 0, 0, 0.24) !important;
}

html[data-theme="dark"] :where(
    .player-stat,
    .archive-item,
    .game-info-card,
    .meaning-step,
    .group-invite-summary,
    .group-player-chip,
    .semantic-ranking-row,
    .mc-dialog-button
) {
    border-color: var(--ml-dark-border) !important;
    background: var(--ml-dark-surface-2) !important;
    color: var(--ml-dark-text) !important;
}

html[data-theme="dark"] :where(
    .results-header,
    .stats-close-button,
    .archives-close-button,
    .game-info-close,
    .group-dialog-close,
    .semantic-ranking-close
) {
    border-color: var(--ml-dark-border) !important;
    background: var(--ml-dark-surface-3) !important;
    color: var(--ml-dark-text) !important;
}

html[data-theme="dark"] :where(
    .result-row,
    .results-title,
    .archives-dialog-header,
    .stats-dialog-header,
    .game-info-header,
    .group-dialog-header,
    .semantic-ranking-header
) {
    border-color: var(--ml-dark-border) !important;
    color: var(--ml-dark-text) !important;
}

html[data-theme="dark"] .game-info-header,
html[data-theme="dark"] .group-dialog-header,
html[data-theme="dark"] .semantic-ranking-header {
    background: rgba(16, 28, 43, 0.96) !important;
}

html[data-theme="dark"] .result-row {
    background: transparent !important;
}

html[data-theme="dark"] .is-winning-row {
    background: linear-gradient(
        90deg,
        rgba(218, 169, 76, 0.18),
        var(--ml-dark-surface)
    ) !important;
}

html[data-theme="dark"] :where(
    .guess-line input,
    .group-field input,
    .group-field select,
    input,
    select,
    textarea
) {
    border-color: rgba(210, 223, 239, 0.17) !important;
    background: #0c1828 !important;
    color: var(--ml-dark-text) !important;
}

html[data-theme="dark"] :where(
    .guess-line input::placeholder,
    .group-field input::placeholder
) {
    color: #718095 !important;
}

html[data-theme="dark"] .reset-button,
html[data-theme="dark"] .archive-return-button,
html[data-theme="dark"] .group-secondary-button {
    border-color: var(--ml-dark-border) !important;
    background: transparent !important;
    color: #b6c2d1 !important;
}

html[data-theme="dark"] .stats-dialog-handle,
html[data-theme="dark"] .archives-dialog-handle {
    background: #536277 !important;
}

html[data-theme="dark"] .archives-loading-row,
html[data-theme="dark"] .archive-transition-skeleton {
    border-color: var(--ml-dark-border) !important;
    background: var(--ml-dark-surface-2) !important;
}

html[data-theme="dark"] .archives-loading-main,
html[data-theme="dark"] .archives-loading-state,
html[data-theme="dark"] .archive-skeleton-block {
    background: linear-gradient(
        100deg,
        #1b2b3f 20%,
        #24374e 38%,
        #1b2b3f 56%
    ) !important;
    background-size: 220% 100% !important;
}

html[data-theme="dark"] .game-menu-panel {
    border-color: rgba(212, 224, 239, 0.14);
    background: rgba(14, 26, 41, 0.985);
    color: var(--ml-dark-text);
    box-shadow: 0 20px 56px rgba(0, 0, 0, 0.40);
}

html[data-theme="dark"] .game-menu-item:hover,
html[data-theme="dark"] .game-menu-item:focus-visible {
    background: #19283a;
}

html[data-theme="dark"] .game-menu-item-icon {
    background: #1a2a3e;
    color: #dbe7f3;
}

html[data-theme="dark"] .game-menu-item-copy small {
    color: #91a0b2;
}

html[data-theme="dark"] .game-menu-divider {
    background: rgba(216, 227, 240, 0.11);
}

html[data-theme="dark"] .game-theme-switch {
    background: #435064;
}

html[data-theme="dark"] .game-theme-switch[aria-checked="true"] {
    background: #d9aa4e;
}

html[data-theme="dark"] .stats-modal-backdrop,
html[data-theme="dark"] .archives-modal-backdrop,
html[data-theme="dark"] .game-info-dialog::backdrop,
html[data-theme="dark"] .group-dialog::backdrop,
html[data-theme="dark"] .semantic-ranking-dialog::backdrop {
    background: rgba(1, 6, 13, 0.68) !important;
}

@media (max-width: 700px) {
    .game-menu-panel {
        width: min(272px, calc(100vw - 24px));
    }
}

/* ==========================================================
   V29bl — RELIABLE MODAL EXIT + REFINED DARK THEME
   ========================================================== */

/*
La sortie est désormais pilotée par Web Animations dans stats.js /
archives.js. On neutralise ici l'ancienne animation CSS V29bk afin
qu'elle ne se superpose jamais au mouvement réellement joué.
*/
html .stats-modal.is-closing .stats-dialog,
html .archives-modal.is-closing .archives-dialog,
html .stats-modal.is-closing .stats-modal-backdrop,
html .archives-modal.is-closing .archives-modal-backdrop {
    animation: none !important;
}

.stats-modal.is-closing,
.archives-modal.is-closing {
    pointer-events: none !important;
}


/* ----------------------------------------------------------
   DARK THEME — palette plus discrète et cohérente
   ---------------------------------------------------------- */

html[data-theme="dark"] {
    --ml-dark-bg: #07111e;
    --ml-dark-bg-2: #091523;
    --ml-dark-surface: #0d1a29;
    --ml-dark-surface-raised: #102033;
    --ml-dark-surface-soft: rgba(255, 255, 255, 0.045);
    --ml-dark-surface-hover: rgba(255, 255, 255, 0.075);
    --ml-dark-border: rgba(191, 210, 232, 0.13);
    --ml-dark-border-soft: rgba(191, 210, 232, 0.08);
    --ml-dark-text: #edf3f8;
    --ml-dark-text-soft: #c2cfdd;
    --ml-dark-muted: #8e9bad;
    --ml-dark-muted-2: #718095;
    --ml-dark-gold: #ddb15a;
    --ml-dark-blue: #79b8f6;
}

html[data-theme="dark"] body {
    background:
        radial-gradient(circle at 50% -10%, rgba(53, 89, 128, 0.13), transparent 33%),
        linear-gradient(180deg, #07111e 0%, #091523 100%)
        !important;
    color: var(--ml-dark-text) !important;
}

html[data-theme="dark"] body .game {
    color: var(--ml-dark-text) !important;
}


/* Header : un seul rail sombre, plus de gros pavés gris. */
html[data-theme="dark"] body .game .game-header {
    border-color: rgba(214, 226, 240, 0.10) !important;
    background: #071323 !important;
}

html[data-theme="dark"] body .game .game-header .header-controls {
    border-color: var(--ml-dark-border-soft) !important;
    background: rgba(255, 255, 255, 0.035) !important;
    box-shadow: none !important;
}

html[data-theme="dark"] body .game .game-header .game-mode-switch,
html[data-theme="dark"] body .game .game-header .game-mode-options {
    background: transparent !important;
    box-shadow: none !important;
}

html[data-theme="dark"] body .game .game-header .game-mode-button {
    border-color: transparent !important;
    background: transparent !important;
    color: #94a3b5 !important;
    box-shadow: none !important;
}

html[data-theme="dark"] body .game .game-header .game-mode-button:hover,
html[data-theme="dark"] body .game .game-header .game-mode-button:focus-visible {
    background: rgba(255, 255, 255, 0.055) !important;
    color: var(--ml-dark-text) !important;
}

html[data-theme="dark"] body .game .game-header .game-mode-button.is-active,
html[data-theme="dark"] body .game .game-header .game-mode-switch[data-mode="solo"] #game-mode-solo,
html[data-theme="dark"] body .game .game-header .game-mode-switch[data-mode="group"] #game-mode-group {
    border-color: rgba(221, 177, 90, 0.38) !important;
    background: linear-gradient(180deg, #13263b 0%, #102136 100%) !important;
    color: #ffffff !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        0 5px 14px rgba(0, 0, 0, 0.16)
        !important;
}

html[data-theme="dark"] body .game .game-header .game-mode-button.is-active svg,
html[data-theme="dark"] body .game .game-header .game-mode-switch[data-mode="solo"] #game-mode-solo svg,
html[data-theme="dark"] body .game .game-header .game-mode-switch[data-mode="group"] #game-mode-group svg {
    color: var(--ml-dark-gold) !important;
    stroke: currentColor !important;
}

html[data-theme="dark"] body .game .game-header .header-icon-button {
    border: 1px solid var(--ml-dark-border) !important;
    background: rgba(255, 255, 255, 0.045) !important;
    color: #aebdce !important;
    box-shadow: none !important;
}

html[data-theme="dark"] body .game .game-header .header-icon-button:hover,
html[data-theme="dark"] body .game .game-header .header-icon-button:focus-visible {
    border-color: rgba(221, 177, 90, 0.34) !important;
    background: rgba(255, 255, 255, 0.075) !important;
    color: #f0d08a !important;
}


/* Stats du jeu : petites surfaces translucides, pas de cartes grises. */
html[data-theme="dark"] body .game .game-stats .stat,
html[data-theme="dark"] body .game .game-stats .yesterday-word-card.is-inline-stat {
    border: 1px solid var(--ml-dark-border-soft) !important;
    background: rgba(255, 255, 255, 0.045) !important;
    color: var(--ml-dark-text) !important;
    box-shadow: none !important;
}

html[data-theme="dark"] body .game .game-stats .stat-label,
html[data-theme="dark"] body .game .game-stats .yesterday-word-card.is-inline-stat .yesterday-word-kicker {
    color: #7f90a5 !important;
}

html[data-theme="dark"] body .game .game-stats .stat strong,
html[data-theme="dark"] body .game .game-stats .yesterday-word-card.is-inline-stat .yesterday-word-value {
    color: #edf3f8 !important;
}

html[data-theme="dark"] body .game .game-stats .yesterday-word-card.is-inline-stat .yesterday-word-value.is-masked {
    color: #718197 !important;
}

html[data-theme="dark"] body .game .game-stats .yesterday-word-card.is-inline-stat .yesterday-word-reveal {
    border: 1px solid var(--ml-dark-border) !important;
    background: rgba(255, 255, 255, 0.055) !important;
    color: #c7d5e4 !important;
    box-shadow: none !important;
}

html[data-theme="dark"] body .game .game-stats .yesterday-word-card.is-inline-stat .yesterday-word-reveal:hover,
html[data-theme="dark"] body .game .game-stats .yesterday-word-card.is-inline-stat .yesterday-word-reveal:focus-visible {
    background: rgba(255, 255, 255, 0.09) !important;
    color: #ffffff !important;
}


/* Recherche : vraie surface sombre, bouton d'action en accent doux. */
html[data-theme="dark"] body .game .guess-line input {
    border: 1px solid rgba(183, 205, 229, 0.16) !important;
    background: #0d1a2a !important;
    color: #f1f5f9 !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.10) !important;
}

html[data-theme="dark"] body .game .guess-line input::placeholder {
    color: #66778d !important;
}

html[data-theme="dark"] body .game .guess-line input:focus {
    border-color: rgba(121, 184, 246, 0.42) !important;
    box-shadow: 0 0 0 2px rgba(121, 184, 246, 0.10) !important;
}

html[data-theme="dark"] body .game .guess-line button {
    border-color: rgba(221, 177, 90, 0.52) !important;
    background: #d9ad56 !important;
    color: #132033 !important;
    box-shadow: none !important;
}

html[data-theme="dark"] body .game .guess-line button:hover,
html[data-theme="dark"] body .game .guess-line button:focus-visible {
    background: #e4ba68 !important;
}


/* Dernier essai + classement : hiérarchie sombre cohérente. */
html[data-theme="dark"] body .game .latest-section,
html[data-theme="dark"] body .game .results {
    border-color: var(--ml-dark-border) !important;
    background: rgba(10, 24, 39, 0.76) !important;
    color: var(--ml-dark-text) !important;
    box-shadow: none !important;
}

html[data-theme="dark"] body .game .results-header {
    border-color: var(--ml-dark-border-soft) !important;
    background: rgba(255, 255, 255, 0.035) !important;
    color: #b8c6d6 !important;
}

html[data-theme="dark"] body .game .result-row {
    border-color: var(--ml-dark-border-soft) !important;
    background: transparent !important;
    color: var(--ml-dark-text) !important;
}

html[data-theme="dark"] body .game .result-row:hover {
    background: rgba(255, 255, 255, 0.025) !important;
}

html[data-theme="dark"] body .game .result-row .word,
html[data-theme="dark"] body .game .latest-section .word {
    color: #eaf1f7 !important;
}

html[data-theme="dark"] body .game .result-row .temperature,
html[data-theme="dark"] body .game .latest-section .temperature {
    color: #9aa9ba !important;
}

html[data-theme="dark"] body .game .result-row .attempt-number,
html[data-theme="dark"] body .game .latest-section .attempt-number {
    border-color: rgba(221, 177, 90, 0.16) !important;
    background: rgba(221, 177, 90, 0.08) !important;
    color: #f0d18f !important;
}

html[data-theme="dark"] body .game .progress-track,
html[data-theme="dark"] body .game .meter-track {
    background: rgba(220, 230, 241, 0.12) !important;
}


/* Boutons secondaires. */
html[data-theme="dark"] body .game .reset-button,
html[data-theme="dark"] body .game .archive-return-button,
html[data-theme="dark"] body .game .group-secondary-button {
    border-color: var(--ml-dark-border) !important;
    background: transparent !important;
    color: #aebdce !important;
    box-shadow: none !important;
}

html[data-theme="dark"] body .game .reset-button:hover,
html[data-theme="dark"] body .game .archive-return-button:hover,
html[data-theme="dark"] body .game .group-secondary-button:hover {
    background: rgba(255, 255, 255, 0.045) !important;
    color: #edf3f8 !important;
}


/* SEO : fond ouvert et petites surfaces sombres, aucun grand bloc gris. */
html[data-theme="dark"] body .game .seo-content {
    border: 0 !important;
    border-top: 1px solid var(--ml-dark-border-soft) !important;
    background: transparent !important;
    color: #b9c7d6 !important;
    box-shadow: none !important;
}

html[data-theme="dark"] body .game .seo-content-heading > span {
    color: var(--ml-dark-gold) !important;
}

html[data-theme="dark"] body .game .seo-content h2,
html[data-theme="dark"] body .game .seo-content-grid h3 {
    color: #edf3f8 !important;
}

html[data-theme="dark"] body .game .seo-content-heading > p {
    color: #c2cfdd !important;
}

html[data-theme="dark"] body .game .seo-content-grid article {
    border-color: var(--ml-dark-border-soft) !important;
    background: rgba(255, 255, 255, 0.03) !important;
    box-shadow: none !important;
}

html[data-theme="dark"] body .game .seo-content-grid p {
    color: #8e9bad !important;
}


/* Popups : profondeur légère, cartes internes non grises. */
html[data-theme="dark"] body .stats-dialog,
html[data-theme="dark"] body .archives-dialog,
html[data-theme="dark"] body .game-info-dialog,
html[data-theme="dark"] body .group-dialog,
html[data-theme="dark"] body .semantic-ranking-dialog,
html[data-theme="dark"] body .mc-dialog-panel {
    border-color: var(--ml-dark-border) !important;
    background: #0d1a29 !important;
    color: var(--ml-dark-text) !important;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.42) !important;
}

html[data-theme="dark"] body .stats-dialog-header,
html[data-theme="dark"] body .archives-dialog-header,
html[data-theme="dark"] body .game-info-header,
html[data-theme="dark"] body .group-dialog-header,
html[data-theme="dark"] body .semantic-ranking-header {
    border-color: var(--ml-dark-border-soft) !important;
    background: #0d1a29 !important;
    color: var(--ml-dark-text) !important;
}

html[data-theme="dark"] body .player-stats-title,
html[data-theme="dark"] body .archives-title,
html[data-theme="dark"] body .game-info-header h2,
html[data-theme="dark"] body .group-dialog-header h2,
html[data-theme="dark"] body .semantic-ranking-header h2 {
    color: #f1f5f9 !important;
}

html[data-theme="dark"] body .player-stats-kicker,
html[data-theme="dark"] body .player-stats-note,
html[data-theme="dark"] body .archives-kicker,
html[data-theme="dark"] body .archives-count,
html[data-theme="dark"] body .archive-item-meta,
html[data-theme="dark"] body .game-info-eyebrow,
html[data-theme="dark"] body .game-info-section p,
html[data-theme="dark"] body .group-field label,
html[data-theme="dark"] body .semantic-ranking-header span,
html[data-theme="dark"] body .semantic-ranking-summary {
    color: var(--ml-dark-muted) !important;
}

html[data-theme="dark"] body .player-stat,
html[data-theme="dark"] body .archive-item,
html[data-theme="dark"] body .game-info-card,
html[data-theme="dark"] body .meaning-step,
html[data-theme="dark"] body .group-invite-summary,
html[data-theme="dark"] body .group-player-chip,
html[data-theme="dark"] body .semantic-ranking-row {
    border-color: var(--ml-dark-border-soft) !important;
    background: rgba(255, 255, 255, 0.035) !important;
    color: var(--ml-dark-text) !important;
    box-shadow: none !important;
}

html[data-theme="dark"] body .player-stat-value,
html[data-theme="dark"] body .archive-item-title,
html[data-theme="dark"] body .game-info-card strong,
html[data-theme="dark"] body .group-player-chip strong,
html[data-theme="dark"] body .semantic-ranking-row strong {
    color: #edf3f8 !important;
}

html[data-theme="dark"] body .player-stat-label,
html[data-theme="dark"] body .game-info-card span,
html[data-theme="dark"] body .archive-item-meta {
    color: #8493a7 !important;
}

html[data-theme="dark"] body .stats-close-button,
html[data-theme="dark"] body .archives-close-button,
html[data-theme="dark"] body .game-info-close,
html[data-theme="dark"] body .group-dialog-close,
html[data-theme="dark"] body .semantic-ranking-close {
    border: 1px solid var(--ml-dark-border-soft) !important;
    background: rgba(255, 255, 255, 0.045) !important;
    color: #b7c6d6 !important;
}

html[data-theme="dark"] body .stats-dialog-handle,
html[data-theme="dark"] body .archives-dialog-handle {
    background: #425269 !important;
}

html[data-theme="dark"] body .archives-loading-row,
html[data-theme="dark"] body .archive-transition-skeleton {
    border-color: var(--ml-dark-border-soft) !important;
    background: rgba(255, 255, 255, 0.03) !important;
}

html[data-theme="dark"] body .archives-loading-main,
html[data-theme="dark"] body .archives-loading-state,
html[data-theme="dark"] body .archive-skeleton-block {
    background: linear-gradient(
        100deg,
        #142337 20%,
        #1d3048 38%,
        #142337 56%
    ) !important;
    background-size: 220% 100% !important;
}


/* Menu burger. */
html[data-theme="dark"] body .game-menu-panel {
    border-color: var(--ml-dark-border) !important;
    background: rgba(12, 25, 40, 0.985) !important;
    color: var(--ml-dark-text) !important;
    box-shadow: 0 20px 56px rgba(0, 0, 0, 0.38) !important;
}

html[data-theme="dark"] body .game-menu-item:hover,
html[data-theme="dark"] body .game-menu-item:focus-visible {
    background: rgba(255, 255, 255, 0.055) !important;
}

html[data-theme="dark"] body .game-menu-item-icon {
    background: rgba(255, 255, 255, 0.05) !important;
    color: #d7e3ef !important;
}

html[data-theme="dark"] body .game-menu-item-copy strong {
    color: #eef4f9 !important;
}

html[data-theme="dark"] body .game-menu-item-copy small {
    color: #8191a5 !important;
}

html[data-theme="dark"] body .game-menu-divider {
    background: var(--ml-dark-border-soft) !important;
}

html[data-theme="dark"] body .game-theme-switch {
    background: #35445a !important;
}

html[data-theme="dark"] body .game-theme-switch[aria-checked="true"] {
    background: #d9ad56 !important;
}


/* Formulaires et textes génériques dans les popups. */
html[data-theme="dark"] body .group-field input,
html[data-theme="dark"] body .group-field select,
html[data-theme="dark"] body .group-field textarea {
    border-color: var(--ml-dark-border) !important;
    background: #0a1726 !important;
    color: var(--ml-dark-text) !important;
}

html[data-theme="dark"] body .group-field input::placeholder {
    color: #66778d !important;
}

html[data-theme="dark"] body .game-info-lead,
html[data-theme="dark"] body .group-dialog-body,
html[data-theme="dark"] body .archives-scroll,
html[data-theme="dark"] body .semantic-ranking-body {
    color: var(--ml-dark-text-soft) !important;
}


/* Victory et autres panneaux de jeu : pas de rectangles gris. */
html[data-theme="dark"] body .victory-section,
html[data-theme="dark"] body .victory-next,
html[data-theme="dark"] body .victory-heat-summary,
html[data-theme="dark"] body .victory-heat-summary-item {
    border-color: var(--ml-dark-border-soft) !important;
    background: rgba(255, 255, 255, 0.035) !important;
    color: var(--ml-dark-text) !important;
    box-shadow: none !important;
}

html[data-theme="dark"] body .victory-section h2,
html[data-theme="dark"] body .victory-section strong {
    color: #eef4f9 !important;
}

html[data-theme="dark"] body .victory-timezone,
html[data-theme="dark"] body .victory-heat-summary-title,
html[data-theme="dark"] body .victory-heat-summary-item small {
    color: #8392a5 !important;
}


/* Backdrops plus doux que V29bk. */
html[data-theme="dark"] body .stats-modal-backdrop,
html[data-theme="dark"] body .archives-modal-backdrop,
html[data-theme="dark"] body .game-info-dialog::backdrop,
html[data-theme="dark"] body .group-dialog::backdrop,
html[data-theme="dark"] body .semantic-ranking-dialog::backdrop {
    background: rgba(1, 7, 15, 0.60) !important;
}

@media (max-width: 700px) {
    html[data-theme="dark"] body .game .seo-content {
        padding-left: 4px !important;
        padding-right: 4px !important;
    }
}
/* ==========================================================
   V29bm — DARK UI LIGHTWEIGHT REFINEMENT
   Allègement visuel du thème sombre uniquement.
   Les cartes de stats et les trois boutons du header sont conservés.
   ========================================================== */

/* ----------------------------------------------------------
   SWITCH SOLO / DESTINS LIÉS
   Rail sans liseré clair, sélection plus calme.
   ---------------------------------------------------------- */
html[data-theme="dark"] body .game .game-header
#game-mode-switch.game-mode-switch,
html[data-theme="dark"] body .game .game-header
#game-mode-switch .game-mode-options {
    border: 0 !important;
    outline: 0 !important;
    background: rgba(255, 255, 255, 0.022) !important;
    box-shadow: none !important;
}

html[data-theme="dark"] body .game .game-header
#game-mode-switch .game-mode-button {
    border: 0 !important;
    outline: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

html[data-theme="dark"] body .game .game-header
#game-mode-switch[data-mode="solo"] #game-mode-solo,
html[data-theme="dark"] body .game .game-header
#game-mode-switch[data-mode="group"] #game-mode-group,
html[data-theme="dark"] body .game .game-header
#game-mode-switch[data-mode="group-pending"] #game-mode-group {
    border: 0 !important;
    outline: 0 !important;
    background: rgba(58, 106, 151, 0.16) !important;
    box-shadow: none !important;
}

html[data-theme="dark"] body .game .game-header
#game-mode-switch .game-mode-button:hover,
html[data-theme="dark"] body .game .game-header
#game-mode-switch .game-mode-button:focus-visible {
    background: rgba(255, 255, 255, 0.035) !important;
}


/* ----------------------------------------------------------
   CHAMP DE SAISIE
   On force une vraie surface sombre : plus de texte clair
   sur un input resté clair à cause des anciennes règles mobile.
   ---------------------------------------------------------- */
html[data-theme="dark"] body .game
#guess-form .guess-line #guess-input {
    border: 1px solid rgba(183, 205, 229, 0.13) !important;
    background: rgba(255, 255, 255, 0.055) !important;
    color: #e8eef5 !important;
    caret-color: #e0b25b !important;
    box-shadow: none !important;
}

html[data-theme="dark"] body .game
#guess-form .guess-line #guess-input::placeholder {
    color: #66778b !important;
    opacity: 1 !important;
}

html[data-theme="dark"] body .game
#guess-form .guess-line #guess-input:focus {
    border-color: rgba(132, 184, 231, 0.36) !important;
    background: rgba(255, 255, 255, 0.070) !important;
    box-shadow: 0 0 0 2px rgba(101, 160, 214, 0.08) !important;
}

html[data-theme="dark"] body .game
#guess-form .guess-line #submit-button {
    border-color: transparent !important;
    background: #d4a84f !important;
    color: #122033 !important;
    box-shadow: none !important;
}

html[data-theme="dark"] body .game
#guess-form .guess-line #submit-button:hover,
html[data-theme="dark"] body .game
#guess-form .guess-line #submit-button:focus-visible {
    background: #deb45d !important;
}


/* ----------------------------------------------------------
   DESTINS LIÉS — LISIBILITÉ DES JOUEURS
   ---------------------------------------------------------- */
html[data-theme="dark"] body.group-game-active .game
.game-stats .stat-solvers #solved-count,
html[data-theme="dark"] body.group-game-active .game
.game-stats .stat-solvers strong {
    color: #dce6ef !important;
}

html[data-theme="dark"] body.group-game-active .game
#group-session-online {
    color: #8d9caf !important;
}

html[data-theme="dark"] body.group-game-active .game
.group-player-chip,
html[data-theme="dark"] body.group-game-active .game
.group-player-chip.is-compact,
html[data-theme="dark"] body.group-game-active .game
.group-player-name {
    color: #c6d2de !important;
}

html[data-theme="dark"] body.group-game-active .game
.group-player-chip.is-compact {
    border-color: rgba(190, 208, 228, 0.08) !important;
    background: rgba(255, 255, 255, 0.030) !important;
}

html[data-theme="dark"] body.group-game-active .game
.group-player-chip.is-offline {
    color: #6f7e90 !important;
    opacity: 0.72 !important;
}


/* ----------------------------------------------------------
   DERNIER ESSAI
   Plus une carte : un repère horizontal très léger.
   ---------------------------------------------------------- */
html[data-theme="dark"] body .game
#latest-section.latest-section,
html[data-theme="dark"] body .game
#latest-section.is-replayed-guess {
    margin-top: 12px !important;
    margin-bottom: 6px !important;
    overflow: visible !important;
    border: 0 !important;
    border-left: 2px solid rgba(116, 178, 234, 0.28) !important;
    border-radius: 0 !important;
    background:
        linear-gradient(
            90deg,
            rgba(64, 119, 170, 0.050) 0%,
            rgba(64, 119, 170, 0.014) 58%,
            transparent 100%
        ) !important;
    box-shadow: none !important;
}

html[data-theme="dark"] body .game
#latest-section.is-replayed-guess {
    border-left-color: rgba(214, 168, 79, 0.28) !important;
}

html[data-theme="dark"] body .game
#latest-guess .latest-row {
    min-height: 50px !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}


/* ----------------------------------------------------------
   LISTE DES MOTS
   Suppression de la grosse boîte : structure par séparateurs.
   ---------------------------------------------------------- */
html[data-theme="dark"] body .game
#results-section.results {
    margin-top: 4px !important;
    overflow: visible !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

html[data-theme="dark"] body .game
#results-section .results-header {
    min-height: 0 !important;
    padding-top: 7px !important;
    padding-bottom: 7px !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(190, 209, 231, 0.070) !important;
    background: transparent !important;
    color: #718095 !important;
    font-size: 9px !important;
    letter-spacing: 0.055em !important;
}

html[data-theme="dark"] body .game
#results-list .result-row {
    min-height: 50px !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(190, 209, 231, 0.050) !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

html[data-theme="dark"] body .game
#results-list .result-row:last-child {
    border-bottom: 0 !important;
}

html[data-theme="dark"] body .game
#results-list .result-row:hover {
    background: rgba(255, 255, 255, 0.016) !important;
}

html[data-theme="dark"] body .game
#results-list .result-row.is-latest-in-ranking::before {
    width: 2px !important;
    background: rgba(116, 178, 234, 0.26) !important;
}


/* Pastilles d'essai : fini le disque presque blanc. */
html[data-theme="dark"] body .game
#latest-guess .attempt-badge,
html[data-theme="dark"] body .game
#results-list .attempt-badge {
    min-width: 30px !important;
    min-height: 30px !important;
    padding: 0 7px !important;
    border: 1px solid rgba(190, 209, 231, 0.075) !important;
    border-radius: 999px !important;
    background: rgba(255, 255, 255, 0.032) !important;
    color: #8797aa !important;
    box-shadow: none !important;
}

html[data-theme="dark"] body .game
#latest-guess .attempt-badge {
    border-color: rgba(116, 178, 234, 0.11) !important;
    background: rgba(65, 126, 184, 0.075) !important;
    color: #cbd7e3 !important;
}

html[data-theme="dark"] body .game
#results-list .is-winning-row .attempt-badge {
    border-color: rgba(214, 168, 79, 0.18) !important;
    background: rgba(214, 168, 79, 0.075) !important;
    color: #d9b96f !important;
}


/* Mot = niveau principal ; chiffres et température = secondaire. */
html[data-theme="dark"] body .game
#results-list .result-row .word {
    color: #c6d2de !important;
    font-weight: 720 !important;
}

html[data-theme="dark"] body .game
#latest-guess .latest-row .word {
    color: #d8e2ec !important;
    font-weight: 760 !important;
}

html[data-theme="dark"] body .game
#results-list .result-row .temperature,
html[data-theme="dark"] body .game
#latest-guess .latest-row .temperature,
html[data-theme="dark"] body .game
#results-list .numeric-score,
html[data-theme="dark"] body .game
#latest-guess .numeric-score,
html[data-theme="dark"] body .game
#results-list .progression-value,
html[data-theme="dark"] body .game
#latest-guess .progression-value {
    color: #77879a !important;
}


/* Motmètre : rail plus fin, moins blanc. */
html[data-theme="dark"] body .game
#latest-guess .progress,
html[data-theme="dark"] body .game
#results-list .progress {
    height: 7px !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: rgba(180, 201, 224, 0.105) !important;
    box-shadow: none !important;
}

html[data-theme="dark"] body .game
#latest-guess .progress-bar,
html[data-theme="dark"] body .game
#results-list .progress-bar {
    border-radius: 999px !important;
    filter: saturate(0.82) brightness(0.94);
}


/* ----------------------------------------------------------
   CONTENU ÉDITORIAL SOUS LE JEU
   Plus discret : il informe sans concurrencer la partie.
   ---------------------------------------------------------- */
html[data-theme="dark"] body .game .seo-content {
    border-top-color: rgba(190, 209, 231, 0.045) !important;
    color: #7f8ea1 !important;
}

html[data-theme="dark"] body .game
.seo-content-heading > span {
    color: #b88f42 !important;
}

html[data-theme="dark"] body .game
.seo-content h2 {
    color: #aebac8 !important;
}

html[data-theme="dark"] body .game
.seo-content-heading > p {
    color: #8392a5 !important;
}

html[data-theme="dark"] body .game
.seo-content-grid article {
    border: 0 !important;
    border-top: 1px solid rgba(190, 209, 231, 0.045) !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

html[data-theme="dark"] body .game
.seo-content-grid h3 {
    color: #9eacbb !important;
}

html[data-theme="dark"] body .game
.seo-content-grid p {
    color: #718195 !important;
}


/* Effacer la partie reste présent sans devenir un point focal. */
html[data-theme="dark"] body .game #reset-button.reset-button {
    border-color: rgba(190, 209, 231, 0.075) !important;
    background: transparent !important;
    color: #7f8ea1 !important;
    box-shadow: none !important;
}

html[data-theme="dark"] body .game #reset-button.reset-button:hover,
html[data-theme="dark"] body .game #reset-button.reset-button:focus-visible {
    background: rgba(255, 255, 255, 0.022) !important;
    color: #aebbc9 !important;
}


@media (max-width: 700px) {
    html[data-theme="dark"] body .game
    #results-section .results-header {
        padding-left: 7px !important;
        padding-right: 7px !important;
    }

    html[data-theme="dark"] body .game
    #results-list .result-row,
    html[data-theme="dark"] body .game
    #latest-guess .latest-row {
        padding-top: 7px !important;
        padding-bottom: 7px !important;
    }

    html[data-theme="dark"] body .game
    #latest-guess .progress,
    html[data-theme="dark"] body .game
    #results-list .progress {
        height: 6px !important;
    }
}
