/* Demineurdle - Styles */

* { box-sizing: border-box; }

:root {
    --logo-w: 400px;
    --logo-dip: 46px;
    --wlog-top: 138px;
    --cell-size: 38px;
    --grid-gap: 5px;
}

.demineurdle-body {
    margin: 0; padding: 0;
    font-family: 'Poppins', sans-serif;
    min-height: 100vh;
    min-height: 100dvh;
    color: white;
    overflow-x: hidden;
    user-select: none;
    background: url('../img/bg2.jpg') center center fixed no-repeat;
    background-size: cover;
}

/* Demineurdle est pleinement responsive mobile & tablette */
.demineurdle-body #game-responsive-error {
    display: none !important;
}

.demineurdle-stage {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 16px 24px 16px;
}

#dm-layout {
    width: 100%;
    max-width: 1180px;
    margin: auto 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.dm-core {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: fit-content;
    max-width: 100%;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

canvas#fireworks {
    position: fixed; top: 0; left: 0;
    width: 100vw; height: 100vh;
    pointer-events: none; z-index: 999;
}

/* --- MODALE DES RÈGLES (format compact identique à Dropdle) --- */
#rules-modal {
    position: fixed;
    inset: 0;
    background: rgba(4, 10, 18, 0.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1050;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}

#rules-modal.visible {
    visibility: visible;
    opacity: 1;
}

.rules-content {
    background: linear-gradient(168deg, rgba(16, 32, 52, 0.92) 0%, rgba(9, 18, 32, 0.96) 100%);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border: 1px solid rgba(155, 210, 255, 0.24);
    border-top-color: rgba(215, 240, 255, 0.4);
    border-radius: 22px;
    padding: 26px 22px;
    max-width: 420px;
    width: 100%;
    max-height: 88vh;
    box-shadow: 0 22px 55px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.14);
    text-align: left;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.rules-scroll-area {
    overflow-y: auto;
    padding-right: 6px;
    flex-grow: 1;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.rules-content h2 {
    margin: 0 0 18px 0;
    color: #f4f9ff;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    flex-shrink: 0;
}

.rules-content .rb {
    display: flex;
    gap: 12px;
    margin-bottom: 13px;
    align-items: flex-start;
}

.rules-content .rb:last-child {
    margin-bottom: 4px;
}

.rules-content .ri {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: rgba(86, 195, 255, 0.14);
    border: 1px solid rgba(126, 212, 255, 0.26);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.rules-content .rt {
    font-size: 0.87rem;
    color: #c2d7ea;
    line-height: 1.52;
}

.rules-content .rt strong {
    color: #f4f9ff;
    font-weight: 700;
}

#rules-modal button.mok {
    background: linear-gradient(165deg, #ffe580 0%, #f5be36 56%, #de9319 100%) !important;
    color: #1c1204 !important;
    border: 1px solid rgba(255, 248, 215, 0.78) !important;
    font-weight: 800;
    border-radius: 13px !important;
    padding: 13px 0 !important;
    font-size: 1rem;
    letter-spacing: 0.06em;
    cursor: pointer;
    width: 100%;
    margin-top: 14px;
    flex-shrink: 0;
    box-shadow:
      inset 0 2px 1px rgba(255, 255, 255, 0.65),
      0 5px 0 #945c0a,
      0 12px 22px rgba(2, 8, 18, 0.55) !important;
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.15s ease;
    text-transform: uppercase;
}

#rules-modal button.mok:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
}

#rules-modal button.mok:active {
    transform: translateY(3px);
    box-shadow: inset 0 2px 2px rgba(255, 255, 255, 0.4), 0 1px 0 #945c0a !important;
}

.rules-scroll-area::-webkit-scrollbar { width: 6px; }
.rules-scroll-area::-webkit-scrollbar-thumb { background: rgba(126, 212, 255, 0.4); border-radius: 10px; }

/* --- NOTIFICATION GLASMORPHISME (en haut de l'écran, ne masque jamais le mot mystère) --- */
#toast-notification {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translate(-50%, -18px);
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 10px 24px;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
    color: #f8fafc;
    font-weight: 800;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    text-align: center;
    max-width: calc(100vw - 32px);
    line-height: 1.3;
    z-index: 2500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#toast-notification.visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

#toast-notification.success {
    border-color: rgba(74, 222, 128, 0.75);
    background: rgba(6, 78, 59, 0.94);
    color: #86efac;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 18px rgba(74, 222, 128, 0.25);
}

#toast-notification.error {
    border-color: rgba(248, 113, 113, 0.75);
    background: rgba(127, 29, 29, 0.94);
    color: #fecaca;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 18px rgba(248, 113, 113, 0.25);
}

.glass-panel {
    background: rgba(147, 33, 33, 0.06);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    padding: 72px 24px 22px 24px;
    margin: 0;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    display: flex; flex-direction: column;
    align-items: center;
    width: fit-content;
    min-width: min(440px, calc(100vw - 24px));
    max-width: 100%;
    z-index: 10;
    position: relative;
}

.help-btn {
    position: absolute;
    top: 22px;
    right: 14px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 1.1rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 50;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}

.help-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
}

.help-btn.tut-icon-btn {
    right: 54px;
    background: #0072ff;
}

.help-btn.tut-icon-btn:hover {
    background: #38bdf8;
    box-shadow: 0 0 15px rgba(0, 114, 255, 0.6);
}

.help-btn.sound-icon-btn {
    right: 94px;
    background: rgba(255, 255, 255, 0.1);
}

.help-btn.sound-icon-btn.muted {
    background: rgba(239, 68, 68, 0.22);
    border-color: rgba(248, 113, 113, 0.55);
    color: #fca5a5;
}

.help-btn.sound-icon-btn.muted:hover {
    background: rgba(239, 68, 68, 0.35);
    box-shadow: 0 0 15px rgba(248, 113, 113, 0.45);
}

.demineurdle-body .modal,
.demineurdle-body #game-nav,
.demineurdle-body #popup-not-logged {
    user-select: text;
    -webkit-user-select: text;
}

#app h1 {
    margin: 0 0 15px 0; font-weight: 800; font-size: 2.2rem;
    letter-spacing: 2px; text-transform: uppercase;
    background: linear-gradient(to right, #00c6ff, #fff, #f286ff);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    text-align: center;
}

.header-info {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    margin-bottom: 14px; width: 100%; max-width: 540px;
}

.stats-row {
    display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; width: 100%;
}

.actions-row {
    display: flex; justify-content: center; width: 100%;
}

.stat-box {
    background: rgba(0,0,0,0.4);
    padding: 6px 11px; border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
    display: flex; align-items: center; gap: 6px;
    transition: all 0.3s ease;
    font-size: 0.9rem; color: #e5e7eb;
    white-space: nowrap;
}
.stat-box.combo-active {
    background: rgba(245, 87, 108, 0.2);
    border-color: #f5576c;
    transform: scale(1.05);
}

.score-box {
    background: linear-gradient(135deg, #fbbf24, #d97706);
    color: #fff; font-weight: bold;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    border: 1px solid #fef3c7;
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.4);
}

.scanner-btn {
    background: rgba(16, 185, 129, 0.15); 
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(52, 211, 153, 0.3);
    color: #34d399; 
    padding: 8px 20px;
    border-radius: 14px;
    cursor: pointer; 
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2), inset 0 0 10px rgba(52, 211, 153, 0.1);
    font-weight: 800; 
    font-size: 0.8rem; 
    text-transform: uppercase; 
    letter-spacing: 1px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex; 
    align-items: center; 
    gap: 10px;
}
.scanner-btn:hover:not(.disabled) {
    background: rgba(16, 185, 129, 0.3);
    border-color: rgba(52, 211, 153, 0.7);
    transform: translateY(-2px);
    box-shadow: 0 10px 40px 0 rgba(16, 185, 129, 0.3), inset 0 0 15px rgba(52, 211, 153, 0.3);
    color: #fff; 
}
.scanner-btn:active:not(.disabled) {
    transform: translateY(1px);
}
.scanner-btn.disabled {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.3);
    box-shadow: none;
    cursor: not-allowed;
}

#grid-container {
    position: relative;
    margin-bottom: 14px;
    width: 100%;
    display: flex;
    justify-content: center;
}

#grid {
    display: grid;
    gap: var(--grid-gap, 5px);
    position: relative;
    justify-content: center;
}

.radar-line {
    position: absolute;
    top: 0; left: -10px; right: -10px;
    height: 4px;
    background: #34d399;
    box-shadow: 0 0 15px 5px rgba(52, 211, 153, 0.6);
    z-index: 50;
    pointer-events: none;
    animation: scanRadar 3s linear forwards; 
}

@keyframes scanRadar {
    0% { top: 0%; opacity: 0; }
    5% { opacity: 1; }
    95% { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

.bomb-svg.temp {
    fill: #ef4444;
    filter: drop-shadow(0 0 10px rgba(239, 68, 68, 0.8));
    animation: sonarReveal 0.8s ease-in-out forwards;
}

@keyframes sonarReveal {
    0% { transform: scale(0); opacity: 0; }
    15% { transform: scale(1.3); opacity: 1; }
    40% { transform: scale(1); opacity: 1; }
    80% { transform: scale(1); opacity: 1; }
    100% { transform: scale(0); opacity: 0; }
}

.cell {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    width: var(--cell-size, 38px);
    height: var(--cell-size, 38px);
    aspect-ratio: 1 / 1;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05));
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 3px 6px rgba(0,0,0,0.2), inset 0 1px 1px rgba(255,255,255,0.3);
    border-radius: clamp(4px, calc(var(--cell-size, 38px) * 0.2), 8px);
    display: flex; justify-content: center; align-items: center;
    font-size: clamp(0.68rem, calc(var(--cell-size, 38px) * 0.48), 1.2rem);
    font-weight: 800;
    cursor: pointer; transition: all 0.15s ease;
    position: relative;
    line-height: 1;
}

.cell:hover:not(.revealed) { background: rgba(255, 255, 255, 0.25); transform: translateY(-2px); }
.cell:active:not(.revealed) { transform: scale(0.92); box-shadow: inset 0 2px 5px rgba(0,0,0,0.5); }

.cell.flagged { color: #fca5a5; }
.cell.flagged::after { content: '🚩'; font-size: clamp(0.65rem, calc(var(--cell-size, 38px) * 0.48), 1.2rem); filter: drop-shadow(0 2px 2px rgba(0,0,0,0.5)); }

.cell.peeked:not(.revealed):not(.flagged)::before {
    content: attr(data-char);
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.48);
    font-size: clamp(0.62rem, calc(var(--cell-size, 38px) * 0.44), 1.05rem);
    font-weight: 800;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    pointer-events: none;
    transition: all 0.2s;
}
.cell.peeked:hover:not(.revealed):not(.flagged)::before {
    color: rgba(255, 255, 255, 0.9);
    transform: translate(-50%, -50%) scale(1.1);
}

.cell.revealed { cursor: default; transform: none; box-shadow: inset 0 3px 6px rgba(0,0,0,0.5); border: none; }
.cell.revealed.empty { background: rgba(0, 0, 0, 0.3); }

.cell.revealed.letter {
    background: linear-gradient(135deg, #0f172a, #1e293b);
    color: #38bdf8; border: 1px solid #38bdf8;
    box-shadow: 0 0 10px rgba(56,189,248,0.2), inset 0 2px 4px rgba(0,0,0,0.5);
    text-shadow: none;
    animation: pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.cell.revealed.letter.word-hover {
    background: linear-gradient(135deg, #0284c7, #0369a1);
    border-color: #7dd3fc;
    box-shadow: 0 0 15px rgba(56,189,248,0.8), inset 0 2px 4px rgba(0,0,0,0.5);
    transform: scale(1.08); z-index: 5;
}

.cell.revealed.letter.golden {
    background: linear-gradient(135deg, #451a03, #78350f);
    color: #fbbf24; border: 1px solid #fbbf24;
    box-shadow: 0 0 15px rgba(251,191,36,0.4), inset 0 2px 4px rgba(0,0,0,0.5);
    text-shadow:none;
    animation: popGold 0.4s ease, pulseGold 2s infinite alternate;
}

.cell.revealed.word-completed {
    background: linear-gradient(135deg, #064e3b, #0f766e);
    color: #34d399; border-color: #34d399;
    box-shadow: 0 0 15px rgba(52, 211, 153, 0.5);
    text-shadow:none;
}

.cell.revealed.bomb {
    background: #ef4444; box-shadow: 0 0 15px rgba(239, 68, 68, 0.6);
    animation: explode 0.4s ease;
}

.cell.neighbor-highlight:not(.revealed) {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.3), inset 0 0 8px rgba(255, 255, 255, 0.4);
    transform: scale(1.03);
    z-index: 4;
}

/* Lien externe de définition des mots */
.def-link {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #0ea5e9;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
    z-index: 20;
}
.cell.word-completed:hover .def-link {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}
.def-link:hover {
    background: #38bdf8;
    transform: scale(1.15) !important;
}

.bomb-svg { width: clamp(14px, calc(var(--cell-size, 38px) * 0.62), 24px); height: clamp(14px, calc(var(--cell-size, 38px) * 0.62), 24px); fill: white; filter: drop-shadow(0 2px 2px rgba(0,0,0,0.5)); }

@keyframes pop { 0% { transform: scale(0.5); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes popGold { 0% { transform: scale(0.5) rotate(-10deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes pulseGold { 0% { box-shadow: 0 0 10px rgba(251,191,36,0.3); } 100% { box-shadow: 0 0 20px rgba(251,191,36,0.7); } }
@keyframes explode { 0% { transform: scale(1); } 50% { transform: scale(1.3); background: #fff; } 100% { transform: scale(1); } }

.n1 { color: #60a5fa; }
.n2 { color: #4ade80; }
.n3 { color: #f87171; }
.n4 { color: #c084fc; }
.n5 { color: #fbbf24; }

.letter-hint {
    position: absolute;
    top: 1px;
    right: 2px;
    font-size: clamp(0.45rem, calc(var(--cell-size, 38px) * 0.26), 0.68rem);
    color: #7dd3fc;
    font-weight: 800;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    pointer-events: none;
    line-height: 1;
}

.mystery-box { width: 100%; border-top: 1px solid rgba(255, 255, 255, 0.1); padding-top: 12px; text-align: center; }
.mystery-box p { margin: 0 0 6px 0; font-weight: 600; color: #fff; font-size: 0.85rem; }

.theme-banner {
    background: rgba(241, 251, 255, 0.1);
    border-radius: 12px;
    padding: 8px 18px;
    margin-bottom: 10px;
    display: inline-block;
    max-width: 100%;
}
.theme-banner-label {
    color: #7dd3fc;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
}
.theme-banner-title {
    color: #fff;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    display: block;
    line-height: 1.25;
}

/* Styles pour le compteur de mots trouvé */
.words-counter {
    color: #cbd5e1;
    font-size: 0.85rem;
    margin-top: 5px;
    font-weight: normal;
    display: inline-block;
    transition: all 0.3s ease;
}

.words-counter-gold {
    color: #fbbf24 !important;
    font-weight: 800 !important;
    animation: counterGoldAnim 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes counterGoldAnim {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); color: #fbbf24; text-shadow: 0 0 20px rgba(251, 191, 36, 1); }
    100% { transform: scale(1); color: #fbbf24; text-shadow: 0 0 10px rgba(251, 191, 36, 0.5); }
}

.gold-bank {
    min-height: 26px; margin-bottom: 10px; font-size: 1.15rem; letter-spacing: 5px;
    color: #ffb800; font-weight: 800;
}

#app .input-group {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
}

#app .input-group input {
    padding: 10px 14px;
    border-radius: 12px !important;
    border: 2px solid rgba(255,255,255,0.12);
    background: rgba(0,0,0,0.3);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    outline: none;
    text-transform: uppercase;
    font-family: 'Poppins', sans-serif;
    width: 210px;
    min-width: 0;
    flex: 1 1 auto;
    transition: all 0.3s;
    text-align: center;
    letter-spacing: 2px;
    margin: 0 !important;
}
#app .input-group input:focus { border-color: #fbbf24; box-shadow: 0 0 15px rgba(251,191,36,0.3); }

#app button:not(.help-btn):not(.scanner-btn):not(.full-btn),
#rules-modal button,
#tutorial-overlay button {
    padding: 12px 25px;
    border-radius: 12px !important;
    border: none;
    background: linear-gradient(135deg, #00c6ff, #0072ff);
    color: white;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(0, 114, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-left: 0 !important;
}
#app button:not(.help-btn):not(.scanner-btn):not(.full-btn):hover,
#rules-modal button:hover,
#tutorial-overlay button:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0, 114, 255, 0.6); }
#app button.action-btn,
#rules-modal button.action-btn,
#tutorial-overlay button.action-btn { background: linear-gradient(135deg, #f093fb, #f5576c); box-shadow: 0 4px 15px rgba(245, 87, 108, 0.4); }

.floating-text {
    position: absolute; pointer-events: none; z-index: 100;
    font-weight: 800; font-size: 1.2rem;
    animation: floatUp 1s cubic-bezier(0.25, 1, 0.5, 1) forwards;
    text-shadow: 0px 2px 5px rgba(0,0,0,0.8);
}
@keyframes floatUp { 0% { transform: translateY(0) scale(1); opacity: 1; } 100% { transform: translateY(-40px) scale(1.2); opacity: 0; } }

.win-screen h2 { font-size: 2.5rem; margin-bottom: 5px; text-transform: uppercase;}
.win-score { font-size: 3rem; color: #fbbf24; margin: 0; font-weight: 800;}
.stars {  font-size: 2.5rem; margin-bottom: 15px; letter-spacing: 5px; text-align: center; display: flex; justify-content: center; }

.game-logo {
    position: relative;
    display: block;
    width: var(--logo-w);
    max-width: 88vw;
    height: auto;
    margin: 0 auto calc(var(--logo-dip) * -1) auto;
    z-index: 20;
    pointer-events: none;
    flex-shrink: 0;
}

/* --- PANNEAU MOTS TROUVÉS (style Dropdle : à droite sur desktop, en dessous sur mobile) --- */
.dm-wlog-panel {
    width: 100%;
    max-width: 440px;
    padding: 16px;
    border-radius: 20px;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.45);
    z-index: 10;
}

#wlog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 0 2px;
}

#wlog-lbl {
    font-size: 0.78rem;
    color: #cbd5e1;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 800;
}

#wlog-count {
    font-size: 0.74rem;
    color: #ffe08a;
    font-weight: 800;
    padding: 3px 9px;
    background: rgba(245, 158, 11, 0.18);
    border-radius: 8px;
    border: 1px solid rgba(251, 191, 36, 0.42);
}

#wlog-empty {
    font-size: 0.84rem;
    color: #94a3b8;
    text-align: center;
    padding: 12px 6px;
    line-height: 1.5;
}

#wlog-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
    width: 100%;
}

.wc {
    font-size: 0.84rem;
    padding: 6px 12px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    text-decoration: none;
    background: linear-gradient(165deg, rgba(165, 212, 250, 0.16), rgba(22, 42, 68, 0.56));
    border: 1px solid rgba(165, 212, 250, 0.22);
    border-top-color: rgba(220, 242, 255, 0.36);
    font-weight: 700;
    box-shadow: 0 3px 0 rgba(5, 12, 22, 0.72), 0 4px 10px rgba(0, 0, 0, 0.25);
    transition: transform 0.14s ease, background 0.18s ease, box-shadow 0.18s ease;
    cursor: pointer;
}

.wc:hover {
    background: linear-gradient(165deg, rgba(165, 212, 250, 0.28), rgba(34, 64, 102, 0.68));
    transform: translateY(-2px);
    color: #fff;
    text-decoration: none;
}

.wc.wc-mystery {
    background: linear-gradient(165deg, rgba(251, 191, 36, 0.22), rgba(120, 53, 15, 0.55));
    border-color: rgba(251, 191, 36, 0.5);
}

.wc.wc-mystery:hover {
    background: linear-gradient(165deg, rgba(251, 191, 36, 0.34), rgba(146, 64, 14, 0.65));
}

.wc-word-wrap {
    color: #f8fafc;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    letter-spacing: 0.4px;
}

.wc .p {
    color: #fbbf24;
    font-weight: 800;
}

/* Desktop split-screen : jeu centré + panneau Mots trouvés sur le côté droit */
@media (min-width: 1024px) {
    #dm-layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto minmax(256px, 1fr);
        gap: 22px;
        align-items: start;
    }

    .dm-core {
        grid-column: 2;
    }

    .dm-wlog-panel {
        grid-column: 3;
        width: 256px;
        max-width: 256px;
        position: sticky;
        top: 24px;
        margin-top: var(--wlog-top);
        max-height: calc(100vh - 48px);
        overflow-y: auto;
    }
}

#tutorial-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(15, 23, 42, 0.92); backdrop-filter: blur(10px);
    z-index: 3000; display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    visibility: hidden; opacity: 0; transition: opacity 0.4s;
}
#tutorial-overlay.visible { visibility: visible; opacity: 1; }

.tut-grid-container {
    background: rgba(0,0,0,0.5); padding: 20px; border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.1); box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    position: relative; overflow: visible;
}
.tut-grid {
    --cell-size: 38px;
    display: grid; gap: 5px; grid-template-columns: repeat(5, 38px);
}

.tut-tooltip {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: 1px solid #38bdf8; border-radius: 16px;
    padding: 20px; width: 380px; max-width: 90vw;
    color: white; font-size: 0.95rem; line-height: 1.5;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8); margin-top: 30px; text-align: center;
    min-height: 160px; display: flex; flex-direction: column; justify-content: space-between;
}

#tut-cursor {
    position: absolute; width: 25px; height: 35px;
    filter: drop-shadow(2px 4px 4px rgba(0,0,0,0.6));
    transition: top 0.7s cubic-bezier(0.25, 0.8, 0.25, 1), left 0.7s cubic-bezier(0.25, 0.8, 0.25, 1), transform 0.15s ease-out;
    z-index: 3010; pointer-events: none;
    top: 90%; left: 90%; transform-origin: top left;
}
#tut-cursor.click { transform: scale(0.7); }

@keyframes shakeGrid {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}
.shake-animation { animation: shakeGrid 0.4s cubic-bezier(.36,.07,.19,.97) both; }

#help-tooltip {
    position: absolute; top: 60px; right: 25px;
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: white; padding: 8px 16px; border-radius: 12px;
    font-size: 0.85rem; font-weight: 800; box-shadow: 0 10px 25px rgba(2, 132, 199, 0.6);
    border: 1px solid #7dd3fc; pointer-events: none; z-index: 100; opacity: 0;
}
#help-tooltip::after {
    content: ''; position: absolute; top: -6px; right: 20px; width: 10px; height: 10px;
    background: #0284c7; transform: rotate(45deg); border-top: 1px solid #7dd3fc; border-left: 1px solid #7dd3fc;
}

.anim-tooltip { animation: tooltipFadeInOut 2.5s ease-in-out forwards; }
.anim-btn-highlight { animation: btnPulse 2.5s ease-in-out forwards; }

@keyframes tooltipFadeInOut { 0% { opacity: 0; transform: translateY(10px); } 15% { opacity: 1; transform: translateY(0); } 85% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-10px); } }
@keyframes btnPulse { 0% { box-shadow: 0 4px 10px rgba(0,0,0,0.3); transform: scale(1); } 15% { box-shadow: 0 0 20px rgba(56,189,248,0.9); transform: scale(1.15); background: #38bdf8; border-color: #fff; } 85% { box-shadow: 0 0 20px rgba(56,189,248,0.9); transform: scale(1.15); background: #38bdf8; border-color: #fff; } 100% { transform: scale(1); } }

.leaderboard-card {
    background: linear-gradient(135deg, rgba(88, 28, 135, 0.5), rgba(46, 16, 101, 0.7));
    backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(192, 132, 252, 0.3); border-radius: 20px;
    padding: 25px 30px; margin: 20px auto 0 auto; width: 100%;
    box-shadow: 0 15px 35px rgba(0,0,0,0.6), inset 0 0 20px rgba(168, 85, 247, 0.1); text-align: left;
}
.leaderboard-title { color: #fde047; font-size: 1.5rem; font-weight: 800; text-align: center; margin-top: 0; margin-bottom: 30px; text-transform: uppercase; display: flex; align-items: center; justify-content: center; gap: 10px; }
.lb-row { display: flex; align-items: center; margin-bottom: 20px; gap: 20px; padding-left: 10px; }
.lb-rank { font-size: 1.5rem; font-weight: 800; width: 20px; text-align: center; }
.lb-stats { color: #e9d5ff; font-size: 0.85rem; font-weight: 500; margin: 0; letter-spacing: 0.5px; }
.rank-1 { color: #fde047; } .rank-2 { color: #d1d5db; } .rank-3 { color: #b45309; }
.lb-avatar { width: 55px; height: 55px; border-radius: 50%; object-fit: cover; background: #1e293b; border: 2px solid rgba(255,255,255,0.1); }
.lb-info { display: flex; flex-direction: column; justify-content: center; }
.lb-name { font-weight: 800; font-size: 1.1rem; color: white; margin: 0 0 4px 0; }
.lb-score { color: #9ca3af; font-size: 0.9rem; font-weight: 600; margin: 0; text-transform: uppercase; letter-spacing: 1px; }
.full-btn { width: 100%; background: rgba(0, 0, 0, 0.4); color: #e9d5ff; border-radius: 12px; padding: 15px; font-size: 0.95rem; font-weight: 600; margin-top: 25px; box-shadow: none; border: 1px solid rgba(192, 132, 252, 0.2); cursor: pointer; transition: all 0.2s; }
.full-btn:hover { background: rgba(0, 0, 0, 0.6); border-color: rgba(192, 132, 252, 0.5); }
.stats-table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 15px 0 25px 0; background: rgba(0,0,0,0.3); border-radius: 16px; border: 1px solid rgba(255,255,255,0.1); overflow: hidden; }
.stats-table th { background: rgba(255,255,255,0.05); color: #7dd3fc; font-weight: 600; font-size: 0.85rem; text-transform: uppercase; padding: 12px 10px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.stats-table td { padding: 15px 10px; text-align: center; color: white; }

/* Écrans desktop peu hauts (laptops 720p / 768p / 820p) */
@media (max-height: 840px) and (min-width: 769px) {
    :root {
        --logo-w: 310px;
        --logo-dip: 36px;
        --wlog-top: 106px;
    }
    .demineurdle-stage {
        padding: 8px 14px 14px 14px;
    }
    .glass-panel {
        padding: 64px 20px 14px 20px;
    }
    .help-btn { top: 18px; }
    #help-tooltip { top: 56px; }
    .header-info { gap: 8px; margin-bottom: 10px; }
    .stat-box { padding: 5px 9px; font-size: 0.85rem; }
    .scanner-btn { padding: 6px 16px; font-size: 0.75rem; }
    #grid-container { margin-bottom: 10px; }
    .mystery-box { padding-top: 8px; }
    .theme-banner { padding: 6px 14px; margin-bottom: 8px; }
    .theme-banner-title { font-size: 0.92rem; }
    .gold-bank { min-height: 22px; margin-bottom: 8px; font-size: 1.05rem; }
    #app .input-group input { padding: 8px 12px; font-size: 0.95rem; }
    #app button:not(.help-btn):not(.scanner-btn):not(.full-btn) { padding: 9px 18px; font-size: 0.9rem; }
}

@media (max-width: 992px) {
    .demineurdle-stage {
        min-height: calc(100vh - 40px);
        min-height: calc(100dvh - 40px);
        padding: 6px 10px 16px 10px;
    }
}

@media (max-width: 768px) {
    :root {
        --logo-w: 265px;
        --logo-dip: 24px;
    }
    .demineurdle-stage {
        padding: 4px 8px 16px 8px;
    }
    .dm-core {
        width: 100%;
    }
    .glass-panel {
        padding: 60px 10px 16px 10px;
        border-radius: 18px;
        width: 100%;
        min-width: 0;
    }
    .dm-wlog-panel {
        max-width: 100%;
        padding: 14px 12px;
        border-radius: 18px;
    }
    .header-info { gap: 8px; margin-bottom: 10px; }
    .stats-row { gap: 6px; }
    .stat-box { padding: 5px 8px; font-size: 0.8rem; gap: 4px; }
    .scanner-btn { padding: 6px 14px; font-size: 0.74rem; gap: 6px; }
    #grid-container { margin-bottom: 10px; }
    .mystery-box { padding-top: 10px; }
    .mystery-box p { font-size: 0.78rem; margin-bottom: 5px; }
    .theme-banner { padding: 6px 14px; margin-bottom: 8px; }
    .theme-banner-label { font-size: 0.7rem; }
    .theme-banner-title { font-size: 0.9rem; letter-spacing: 1px; }
    .words-counter { font-size: 0.78rem; margin-top: 2px; }
    .gold-bank { min-height: 22px; margin-bottom: 8px; font-size: 1rem; letter-spacing: 4px; }
    #app .input-group input { padding: 9px 10px; font-size: 0.95rem; letter-spacing: 1px; }
    #app button:not(.help-btn):not(.scanner-btn):not(.full-btn) { padding: 9px 16px; font-size: 0.88rem; }
    .help-btn { top: 16px; right: 10px; width: 30px; height: 30px; font-size: 1rem; }
    .help-btn.tut-icon-btn { right: 46px; }
    .help-btn.sound-icon-btn { right: 82px; }
    #help-tooltip { top: 52px; right: 10px; }
    #toast-notification { top: 12px; padding: 9px 18px; font-size: 0.82rem; }
    .rules-content { padding: 22px 16px; }
}

@media (max-width: 480px) {
    :root {
        --logo-w: 225px;
        --logo-dip: 18px;
    }
    .glass-panel {
        padding: 56px 8px 14px 8px;
    }
    .stat-box { padding: 4px 7px; font-size: 0.76rem; }
}
