/* ============================================================
 * IFLISS GAMES — Explorateur de mots (/guides/explorateur-de-mots-preview)
 * Même thème que l'accueil, /jeux et les guides : blanc cassé, taupe, violet, boutons bleus.
 * S'ajoute à accueil.css (.acc-mark pour « mot juste »). La fenêtre de définition est hors
 * du <main> : ses couleurs sont donc définies ici aussi.
 * ============================================================ */

.wm-page,
.wm-modal {
    --wm-paper: #f3eee6;
    --wm-card: #fbf8f3;
    --wm-field: #f7f2eb;
    --wm-ink: #221a36;
    --wm-text: #3f3650;
    --wm-muted: #5f587a;
    --wm-line: #e0d7cb;
    --wm-line-strong: #d9cdbf;
    --wm-taupe-line: #cdbfae;
    --wm-taupe-ink: #4a3f36;
    --wm-violet-100: #e9e1fd;
    --wm-violet-200: #d6c8fb;
    --wm-violet-400: #a78bfa;
    --wm-violet-600: #7c5bd8;
    --wm-violet-800: #4a2f94;
    --wm-red: #d7263d;
    --wm-blue: linear-gradient(90deg, #1c1948, #2a2173 50%, #1a2c68);
    --wm-blue-hover: linear-gradient(90deg, #262260, #372c93 50%, #243a85);
    --wm-blue-solid: #2a2173;
}

.main-content { background: #f3eee6 !important; }

/* .acc apporte le style « mot juste » ; pas de coupe du contenu pour garder le panneau collant */
.wm-page.acc { overflow: visible; }
.wm-page *, .wm-modal * { box-sizing: border-box; }
.wm-page .bi, .wm-modal .bi { line-height: 1; vertical-align: -0.125em; }
.wm-page {
    min-height: 100vh;
    padding: 24px clamp(14px, 4vw, 44px) 72px;
    background: var(--wm-paper);
    color: var(--wm-ink);
    font-family: 'Lexend', sans-serif;
}
.wm-shell { width: min(1180px, 100%); margin: auto; }

.wm-breadcrumb { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; color: var(--wm-muted); font-size: 0.82rem; }
.wm-breadcrumb a { color: var(--wm-muted); text-decoration: none; }
.wm-breadcrumb a:hover { color: var(--wm-red); }

/* Bandeau taupe */
.wm-hero {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 30px;
    margin-bottom: 24px;
    padding: 30px 34px;
    border: 1px solid var(--wm-taupe-line);
    border-radius: 24px;
    background:
        radial-gradient(520px 260px at 85% 0%, rgb(255 250 243 / 0.5), transparent 70%),
        linear-gradient(135deg, #ddd1c3, #cfc0ae 55%, #c3b19d);
    box-shadow: 0 20px 40px -30px rgb(70 50 35 / 0.6);
}
.wm-hero h1 {
    position: relative;
    z-index: 0;
    max-width: 760px;
    margin: 0 0 12px;
    color: var(--wm-ink);
    font-size: clamp(2.3rem, 5.4vw, 4rem);
    font-weight: 900;
    line-height: 1.05;
    letter-spacing: -0.02em;
}
.wm-lead { max-width: 700px; margin: 0; color: var(--wm-taupe-ink); font-size: clamp(0.98rem, 1.8vw, 1.08rem); line-height: 1.7; }

.wm-dico-stat {
    display: grid;
    width: 150px;
    height: 150px;
    place-items: center;
    border: 1px solid var(--wm-line-strong);
    border-radius: 50%;
    background: var(--wm-card);
    box-shadow: 0 0 0 6px rgb(251 248 243 / 0.45), 0 16px 30px -18px rgb(70 50 35 / 0.6);
}
.wm-dico-stat div { text-align: center; }
.wm-dico-stat .bi { display: block; margin-bottom: 4px; color: var(--wm-violet-600); font-size: 1.1rem; }
.wm-dico-stat strong { display: block; color: var(--wm-violet-800); font-size: 1.6rem; font-weight: 900; line-height: 1.1; }
.wm-dico-stat span { color: var(--wm-muted); font-size: 0.66rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }

/* Mise en page */
.wm-layout { display: grid; grid-template-columns: 360px 1fr; gap: 22px; align-items: start; }
.wm-panel { border: 1px solid #dccfbf; border-radius: 20px; background: var(--wm-card); box-shadow: 0 18px 36px -26px rgb(70 50 35 / 0.6); }
.wm-filters { position: sticky; top: 82px; padding: 22px; }
.wm-panel-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.wm-panel-title h2 { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--wm-ink); font-size: 1.12rem; font-weight: 800; }
.wm-panel-title h2 .bi { color: var(--wm-violet-600); }
.wm-reset { display: inline-flex; align-items: center; gap: 5px; border: 0; background: transparent; color: var(--wm-red); font: 600 0.78rem 'Lexend', sans-serif; cursor: pointer; }
.wm-reset:hover { text-decoration: underline; }

.wm-field { margin-bottom: 15px; }
.wm-field label { display: flex; justify-content: space-between; margin-bottom: 7px; color: var(--wm-ink); font-size: 0.8rem; font-weight: 700; }
.wm-field label small { color: var(--wm-muted); font-weight: 400; }
.wm-input,
.wm-select {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 1px solid var(--wm-line-strong);
    border-radius: 12px;
    outline: 0;
    background: var(--wm-field);
    color: var(--wm-ink);
    font: 500 16px 'Lexend', sans-serif;
    transition: border-color 0.18s, box-shadow 0.18s, background-color 0.18s;
}
.wm-input:focus,
.wm-select:focus { border-color: var(--wm-violet-600); background-color: var(--wm-card); box-shadow: 0 0 0 4px rgb(124 91 216 / 0.18); }
.wm-input::placeholder { color: #9a90a8; }

.wm-lengths { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.wm-length {
    height: 40px;
    border: 1px solid var(--wm-line-strong);
    border-radius: 10px;
    background: var(--wm-field);
    color: var(--wm-text);
    font: 700 0.9rem 'Lexend', sans-serif;
    cursor: pointer;
}
.wm-length:hover { border-color: var(--wm-violet-400); color: var(--wm-violet-800); }
.wm-length.active, .wm-length.active:hover { border-color: var(--wm-blue-solid); background: var(--wm-blue); color: #fff; }

.wm-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 52px;
    margin-top: 7px;
    border: 0;
    border-radius: 999px;
    background: var(--wm-blue);
    box-shadow: 0 14px 26px -14px rgb(28 25 72 / 0.9);
    color: #fff;
    font: 700 0.98rem 'Lexend', sans-serif;
    cursor: pointer;
    transition: transform 0.15s;
}
.wm-search-btn:hover { background: var(--wm-blue-hover); }
.wm-search-btn:active { transform: translateY(1px); }

.wm-examples { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.wm-example {
    padding: 7px 12px;
    border: 1px solid var(--wm-violet-200);
    border-radius: 999px;
    background: var(--wm-violet-100);
    color: var(--wm-violet-800);
    font: 600 0.72rem 'Lexend', sans-serif;
    cursor: pointer;
}
.wm-example:hover { border-color: var(--wm-red); background: var(--wm-card); color: var(--wm-red); }

/* Résultats */
.wm-results { min-height: 620px; padding: 22px; }
.wm-results-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding-bottom: 17px; border-bottom: 1px solid var(--wm-line); }
.wm-results-title strong { display: block; color: var(--wm-ink); font-size: 1.3rem; font-weight: 900; }
.wm-results-title span { color: var(--wm-muted); font-size: 0.8rem; }
.wm-sort { width: auto; min-width: 180px; height: 42px; font-size: 0.8rem; }

.wm-word-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-top: 18px; }
.wm-word {
    position: relative;
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 7px;
    padding: 12px;
    border: 1px solid var(--wm-line);
    border-radius: 12px;
    background: var(--wm-paper);
    transition: border-color 0.15s, background-color 0.15s, transform 0.15s;
}
.wm-word:hover { border-color: var(--wm-violet-200); background: var(--wm-violet-100); transform: translateY(-1px); }
.wm-word b { overflow: hidden; color: var(--wm-ink); font-size: 0.86rem; letter-spacing: 0.025em; text-overflow: ellipsis; white-space: nowrap; }
.wm-word small { flex: none; padding: 3px 7px; border-radius: 999px; background: var(--wm-card); color: var(--wm-violet-800); font-size: 0.6rem; font-weight: 700; }
.wm-word button { position: absolute; inset: 0; border: 0; background: transparent; cursor: pointer; }

.wm-empty { display: grid; min-height: 390px; place-items: center; text-align: center; }
.wm-empty-icon {
    display: grid;
    width: 76px;
    height: 76px;
    margin: 0 auto 18px;
    place-items: center;
    border-radius: 22px;
    background: var(--wm-violet-100);
    color: var(--wm-violet-800);
    font-size: 1.9rem;
}
.wm-empty h3 { margin: 0 0 8px; color: var(--wm-ink); font-size: 1.25rem; font-weight: 800; }
.wm-empty p { max-width: 380px; margin: 0; color: var(--wm-muted); font-size: 0.88rem; line-height: 1.65; }

.wm-more {
    display: none;
    width: 100%;
    height: 46px;
    margin-top: 15px;
    border: 1px solid var(--wm-violet-200);
    border-radius: 999px;
    background: var(--wm-violet-100);
    color: var(--wm-violet-800);
    font: 700 0.9rem 'Lexend', sans-serif;
    cursor: pointer;
}
.wm-more:hover { border-color: var(--wm-violet-400); }

.wm-toast {
    position: fixed;
    z-index: 30;
    right: 22px;
    bottom: 22px;
    padding: 11px 18px;
    border-radius: 999px;
    background: var(--wm-blue);
    box-shadow: 0 14px 30px -12px rgb(28 25 72 / 0.8);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    opacity: 0;
    transform: translateY(15px);
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
}
.wm-toast.show { opacity: 1; transform: none; }

/* Conseils (fond taupe) */
.wm-info { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 24px; }
.wm-info-card {
    padding: 20px;
    border: 1px solid var(--wm-taupe-line);
    border-top: 4px solid var(--wm-violet-400);
    border-radius: 16px;
    background: linear-gradient(180deg, #e1d6c9, #d8cbbb);
}
.wm-info-card:nth-child(2) { border-top-color: var(--wm-red); }
.wm-info-card:nth-child(3) { border-top-color: var(--wm-blue-solid); }
.wm-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-bottom: 10px;
    border-radius: 12px;
    background: var(--wm-card);
    color: var(--wm-violet-800);
    font-size: 1.1rem;
}
.wm-info-card h3 { margin: 0 0 6px; color: var(--wm-ink); font-size: 1rem; font-weight: 800; }
.wm-info-card p { margin: 0; color: var(--wm-taupe-ink); font-size: 0.82rem; line-height: 1.55; }

/* Fenêtre de définition */
.wm-modal {
    position: fixed;
    z-index: 2500;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgb(34 26 54 / 0.55);
    backdrop-filter: blur(4px);
    font-family: 'Lexend', sans-serif;
}
.wm-modal.open { display: flex; }
.wm-dialog {
    position: relative;
    width: min(650px, 100%);
    max-height: min(760px, 90vh);
    overflow: auto;
    padding: 30px;
    border: 1px solid #dccfbf;
    border-radius: 22px;
    background: var(--wm-card);
    box-shadow: 0 30px 70px -20px rgb(34 26 54 / 0.5);
    color: var(--wm-ink);
}
.wm-dialog-close {
    position: absolute;
    top: 14px;
    right: 14px;
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 1px solid var(--wm-line-strong);
    border-radius: 50%;
    background: var(--wm-paper);
    color: var(--wm-ink);
    font-size: 0.95rem;
    cursor: pointer;
}
.wm-dialog-close:hover { border-color: var(--wm-red); color: var(--wm-red); }
.wm-definition-kicker { margin: 0 45px 8px 0; color: var(--wm-red); font-size: 0.74rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.wm-definition-title { margin: 0 45px 18px 0; color: var(--wm-violet-800); font-size: clamp(2rem, 6vw, 3rem); font-weight: 900; line-height: 1; }
.wm-definition-body { min-height: 120px; padding-top: 18px; border-top: 1px solid var(--wm-line); color: var(--wm-text); font-size: 0.95rem; line-height: 1.7; white-space: pre-line; }
.wm-definition-body.loading { color: var(--wm-muted); font-style: italic; }
.wm-definition-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 24px; }
.wm-definition-link { display: inline-flex; align-items: center; gap: 6px; color: var(--wm-violet-800); font-size: 0.84rem; font-weight: 700; }
.wm-definition-link:hover { color: var(--wm-red); }
.wm-copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 11px 20px;
    border: 0;
    border-radius: 999px;
    background: var(--wm-blue);
    color: #fff;
    font: 700 0.9rem 'Lexend', sans-serif;
    cursor: pointer;
}
.wm-copy-btn:hover { background: var(--wm-blue-hover); }

/* Proposer vos mots */
.wm-propose { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 34px; margin-top: 24px; padding: 30px; }
.wm-propose [hidden] { display: none !important; }
.wm-propose-kicker { display: inline-flex; align-items: center; gap: 7px; margin: 0 0 10px; color: var(--wm-red); font-size: 0.74rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.wm-propose-intro h2 { position: relative; z-index: 0; margin: 0 0 12px; color: var(--wm-ink); font-size: clamp(1.7rem, 3.4vw, 2.4rem); font-weight: 900; line-height: 1.1; letter-spacing: -0.02em; }
.wm-propose-lead { margin: 0 0 20px; color: var(--wm-text); font-size: 0.95rem; line-height: 1.7; }
.wm-propose-rules { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.wm-propose-rules li { display: flex; align-items: center; gap: 11px; color: var(--wm-text); font-size: 0.85rem; line-height: 1.45; }
.wm-propose-rules span { display: grid; flex: none; width: 32px; height: 32px; place-items: center; border-radius: 10px; background: var(--wm-violet-100); color: var(--wm-violet-800); font-size: 0.95rem; }

.wm-propose-side { min-width: 0; padding: 22px; border: 1px solid var(--wm-line); border-radius: 16px; background: var(--wm-paper); }
.wm-pot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Zone de saisie : 5 lignes numérotées, la numérotation prend la couleur de l'état du mot */
.wm-propose-box { display: flex; overflow: hidden; border: 1px solid var(--wm-line-strong); border-radius: 12px; background: var(--wm-card); transition: border-color 0.18s, box-shadow 0.18s; }
.wm-propose-box:focus-within { border-color: var(--wm-violet-600); box-shadow: 0 0 0 4px rgb(124 91 216 / 0.18); }
.wm-propose-lines { flex: none; width: 40px; margin: 0; padding: 12px 0; border-right: 1px solid var(--wm-line); background: var(--wm-field); list-style: none; color: #9a90a8; font: 700 0.72rem/30px 'Lexend', sans-serif; text-align: center; }
.wm-propose-lines li { height: 30px; }
.wm-propose-lines li.is-ok { color: var(--wm-violet-600); }
.wm-propose-lines li.is-skip { color: var(--wm-muted); }
.wm-propose-lines li.is-bad { color: var(--wm-red); }
.wm-propose-box textarea { flex: 1; min-width: 0; height: 174px; min-height: 0; margin: 0; padding: 12px 14px; border: 0; border-radius: 0; outline: 0; background: transparent; box-shadow: none; color: var(--wm-ink); font: 600 16px/30px 'Lexend', sans-serif; letter-spacing: 0.02em; white-space: pre; overflow-x: auto; overflow-y: hidden; resize: none; }
/* Le halo de focus est porté par le cadre (:focus-within) : pas de contour propre à la zone, que le cadre couperait en une barre à gauche */
.wm-propose-box textarea:focus,
.wm-propose-box textarea:focus-visible { outline: none; box-shadow: none; }
.wm-propose-box textarea::placeholder { color: #9a90a8; font-weight: 500; }

.wm-propose-chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0 0; padding: 0; list-style: none; }
.wm-propose-chips:empty { display: none; }
.wm-chip { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; padding: 6px 7px 6px 12px; border: 1px solid var(--wm-violet-200); border-radius: 999px; background: var(--wm-violet-100); color: var(--wm-violet-800); font-size: 0.8rem; }
.wm-chip b { overflow: hidden; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.wm-chip small { flex: none; padding: 2px 8px; border-radius: 999px; background: var(--wm-card); font-size: 0.64rem; font-weight: 700; }
.wm-chip.is-skip { border-color: var(--wm-line-strong); background: var(--wm-card); color: var(--wm-muted); }
.wm-chip.is-skip b { text-decoration: line-through; }
.wm-chip.is-skip small { background: var(--wm-field); }
.wm-chip.is-bad { border-color: #f1b7bf; background: #fdecee; color: #a61b2e; }

.wm-propose-msg { margin: 12px 0 0; padding: 10px 14px; border-radius: 12px; font-size: 0.8rem; line-height: 1.45; }
.wm-propose-msg.is-info { background: var(--wm-violet-100); color: var(--wm-violet-800); }
.wm-propose-msg.is-error { background: #fdecee; color: #a61b2e; }

.wm-propose-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.wm-propose-who { display: inline-flex; align-items: center; gap: 7px; color: var(--wm-muted); font-size: 0.78rem; }
.wm-propose-who b { color: var(--wm-violet-800); }
.wm-search-btn.wm-propose-btn { width: auto; height: 48px; margin: 0; padding: 0 24px; }
.wm-propose-btn:disabled,
.wm-propose-btn:disabled:hover { background: var(--wm-blue); box-shadow: none; opacity: 0.45; cursor: not-allowed; }

/* Après l'envoi */
.wm-propose-done { display: grid; min-height: 100%; align-content: center; justify-items: center; padding: 12px 0; text-align: center; }
.wm-propose-done-icon { display: grid; width: 60px; height: 60px; margin-bottom: 12px; place-items: center; border-radius: 50%; background: var(--wm-blue); color: #fff; font-size: 1.6rem; }
.wm-propose-done h3 { margin: 0 0 6px; color: var(--wm-ink); font-size: 1.2rem; font-weight: 800; }
.wm-propose-done p { max-width: 380px; margin: 0; color: var(--wm-muted); font-size: 0.88rem; line-height: 1.6; }
.wm-propose-done .wm-propose-chips { justify-content: center; }
.wm-propose-done .wm-chip { padding-right: 12px; }
.wm-propose-again { margin-top: 18px; padding: 11px 20px; border: 1px solid var(--wm-violet-200); border-radius: 999px; background: var(--wm-violet-100); color: var(--wm-violet-800); font: 700 0.86rem 'Lexend', sans-serif; cursor: pointer; }
.wm-propose-again:hover { border-color: var(--wm-violet-400); }

/* Écrans étroits */
@media (max-width: 900px) {
    .wm-layout { grid-template-columns: 1fr; }
    .wm-filters { position: static; }
    .wm-results { min-height: 500px; }
    .wm-word-grid { grid-template-columns: repeat(2, 1fr); }
    .wm-propose { grid-template-columns: 1fr; gap: 22px; }
}
@media (max-width: 600px) {
    .wm-page { padding-top: 14px; }
    .wm-hero { grid-template-columns: 1fr; padding: 22px 18px; border-radius: 20px; }
    .wm-dico-stat { display: none; }
    .wm-layout { gap: 13px; }
    .wm-filters, .wm-results { padding: 16px; border-radius: 16px; }
    .wm-word-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
    .wm-word { padding: 10px 8px; }
    .wm-word b { font-size: 0.74rem; }
    .wm-sort { min-width: 130px; }
    .wm-info { grid-template-columns: 1fr; }
    .wm-results-head { align-items: flex-end; }
    .wm-dialog { padding: 24px 19px; }
    .wm-definition-actions { flex-direction: column; align-items: stretch; }
    .wm-copy-btn { width: 100%; }
    .wm-propose { padding: 18px 16px; border-radius: 16px; }
    .wm-propose-side { padding: 14px; }
    .wm-propose-foot { flex-direction: column-reverse; align-items: stretch; }
    .wm-propose-who { justify-content: center; }
    .wm-search-btn.wm-propose-btn { width: 100%; }
}
@media (max-width: 360px) {
    .wm-word-grid { grid-template-columns: 1fr; }
    .wm-results-head { flex-direction: column; align-items: stretch; }
    .wm-sort { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    .wm-word, .wm-toast, .wm-search-btn, .wm-input, .wm-select, .wm-propose-box { transition: none; }
}
