/* ELEMENTARY — tons clairs, dans l'esprit de ChessWar. Palette en variables. */
:root {
    --fond: #f3efe6; --carte: #fffdf8; --encre: #2b2620; --doux: #6e6558;
    --accent: #9a6b1f; --accent-fonce: #7a5416; --trait: #e3dbcb;
    --feu: #c05038; --terre: #8a6d3b; --eau: #3a7ca5; --air: #7b98ad;
    --cat-soins: #3f7d3f; --cat-degats: #b64a3a; --cat-protection: #38618c;
    --cat-agressif: #b07d2b; --cat-invocation: #7b4b94; --cat-utilitaire: #6e6558;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    background: var(--fond); color: var(--encre);
    font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    min-height: 100vh; display: flex; flex-direction: column;
}

/* ---------- bandeau ---------- */
#bandeau {
    display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
    padding: .8rem 1.2rem; background: #ebe4d4; border-bottom: 1px solid var(--trait);
    position: sticky; top: 0; z-index: 10;
}
#titre {
    font-size: 1.35rem; font-weight: 700; letter-spacing: .08em; color: var(--accent);
    text-decoration: none; text-transform: uppercase;
}
#menu { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
#menu a { color: var(--encre); text-decoration: none; padding: .25rem .6rem; border-radius: 8px; }
#menu a:hover { background: rgba(154, 107, 31, .12); }
#menu a.actif { background: var(--accent); color: #fff; }
.groupe { display: flex; align-items: center; gap: .3rem; padding-left: 1rem; border-left: 1px solid var(--trait); }
.groupe-titre { color: var(--doux); font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; margin-right: .3rem; }
.a-venir { color: #b6ad9d; padding: .25rem .6rem; cursor: default; }

/* ---------- contenu ---------- */
#contenu { flex: 1; max-width: 75rem; width: 100%; margin: 0 auto; padding: 1.3rem; }
.chargement { color: var(--doux); text-align: center; padding: 3rem 0; }
h1 { margin: .2rem 0 .8rem; font-size: 1.5rem; color: var(--accent); }
h2 { margin: 1.2rem 0 .6rem; font-size: 1.15rem; }
p.note { color: var(--doux); margin: .2rem 0 1rem; }

/* ---------- filtres ---------- */
#filtres {
    display: flex; gap: .6rem; flex-wrap: wrap; align-items: center;
    background: var(--carte); border: 1px solid var(--trait); border-radius: 12px;
    padding: .7rem .9rem; margin-bottom: 1rem;
}
#filtres label { color: var(--doux); font-size: .85rem; }
#filtres select, #filtres input[type=search] {
    font: inherit; padding: .3rem .5rem; border: 1px solid var(--trait); border-radius: 8px;
    background: #fff; color: var(--encre);
}
#filtres input[type=search] { min-width: 12rem; flex: 1; }
#filtres .compte { margin-left: auto; color: var(--doux); font-size: .85rem; white-space: nowrap; }

/* ---------- cartes ---------- */
.grille { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr)); }
.carte {
    background: var(--carte); border: 1px solid var(--trait); border-left-width: 5px;
    border-radius: 12px; padding: .8rem .9rem; display: flex; flex-direction: column; gap: .45rem;
    box-shadow: 0 1px 6px rgba(60, 40, 10, .05);
}
.carte .entete { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.carte .nom { font-weight: 700; font-size: 1.02rem; }
.carte .description { color: var(--encre); font-size: .92rem; }
.carte .texte-origine { color: var(--doux); font-size: .8rem; font-style: italic; }
.badges { display: flex; gap: .35rem; flex-wrap: wrap; }
.badge {
    font-size: .75rem; padding: .1rem .5rem; border-radius: 999px;
    background: #efe9dc; color: var(--doux); white-space: nowrap;
}
.badge.plein { color: #fff; }
.badge.feu { background: var(--feu); } .badge.terre { background: var(--terre); }
.badge.eau { background: var(--eau); } .badge.air { background: var(--air); }
.badge.contour { background: transparent; border: 1px solid var(--trait); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(5.2rem, 1fr)); gap: .3rem .6rem; }
.stat { background: #f7f2e9; border-radius: 8px; padding: .25rem .45rem; text-align: center; }
.stat .v { font-weight: 700; display: block; font-size: .95rem; }
.stat .l { color: var(--doux); font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; }

/* liseré par catégorie de sort */
.carte.cat-Soins { border-left-color: var(--cat-soins); }
.carte.cat-Dégâts { border-left-color: var(--cat-degats); }
.carte.cat-Protection { border-left-color: var(--cat-protection); }
.carte.cat-Agressif { border-left-color: var(--cat-agressif); }
.carte.cat-Invocation { border-left-color: var(--cat-invocation); }
.carte.cat-Utilitaire { border-left-color: var(--cat-utilitaire); }
/* liseré par élément pour les créatures */
.carte.elem-Feu { border-left-color: var(--feu); }
.carte.elem-Terre { border-left-color: var(--terre); }
.carte.elem-Eau { border-left-color: var(--eau); }
.carte.elem-Air { border-left-color: var(--air); }

/* ---------- accueil ---------- */
.tuiles { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); margin-top: 1rem; }
.tuile {
    display: block; background: var(--carte); border: 1px solid var(--trait); border-radius: 14px;
    padding: 1.1rem 1.2rem; text-decoration: none; color: var(--encre);
    box-shadow: 0 2px 10px rgba(60, 40, 10, .06);
}
.tuile:hover { border-color: var(--accent); }
.tuile h2 { margin: 0 0 .3rem; color: var(--accent); font-size: 1.15rem; }
.tuile p { margin: 0; color: var(--doux); font-size: .9rem; }
.tuile .chiffre { font-size: 1.9rem; font-weight: 700; color: var(--encre); margin-right: .4rem; }

footer { text-align: center; color: var(--doux); font-size: .8rem; padding: 1rem; }

/* table des races */
table.simple { border-collapse: collapse; width: 100%; background: var(--carte); border-radius: 12px; overflow: hidden; }
table.simple th, table.simple td { border: 1px solid var(--trait); padding: .5rem .7rem; text-align: left; font-size: .9rem; }
table.simple th { background: #ebe4d4; }
td.centre, th.centre { text-align: center; }

/* ---------- vue tableaux des sorts ---------- */
.modes { display: flex; gap: .4rem; margin-bottom: .9rem; }
.mode {
    font: inherit; padding: .3rem .9rem; border: 1px solid var(--trait); border-radius: 999px;
    background: var(--carte); color: var(--doux); cursor: pointer;
}
.mode.actif { background: var(--accent); border-color: var(--accent); color: #fff; }
.legende { display: flex; gap: 1rem; flex-wrap: wrap; margin: .2rem 0 .8rem; font-size: .85rem; }
.defile { overflow-x: auto; margin-bottom: 1.4rem; }
table.grille-sorts {
    border-collapse: collapse; width: 100%; min-width: 46rem;
    background: var(--carte); font-size: .82rem;
}
.grille-sorts th, .grille-sorts td { border: 1px solid var(--trait); padding: .45rem .55rem; vertical-align: middle; }
.grille-sorts .coin { background: #ebe4d4; }
.grille-sorts .tete-element {
    color: #fff; font-size: 1rem; letter-spacing: .04em; padding: .5rem;
    width: 22%;
}
.tete-element.feu { background: var(--feu); } .tete-element.terre { background: var(--terre); }
.tete-element.eau { background: var(--eau); } .tete-element.air { background: var(--air); }
.grille-sorts .niveau {
    background: #f5e9c8; font-size: 1.2rem; width: 2.4rem; text-align: center;
}
.grille-sorts .portee { background: #f5e9c8; font-weight: 600; width: 4.6rem; text-align: left; }
.grille-sorts tr.debut-niveau th, .grille-sorts tr.debut-niveau td { border-top: 2px solid #c9bfa8; }
.grille-sorts .cellule { cursor: pointer; text-align: center; line-height: 1.3; }
.grille-sorts .cellule:hover { background: #f7f2e6; }
.grille-sorts .cellule.vide { color: #c8bfae; cursor: default; }
.grille-sorts .des { color: var(--doux); font-size: .72rem; white-space: nowrap; }
/* texte coloré par catégorie, comme les feuilles de conception */
.cat-txt-Soins { color: var(--cat-soins); }
.cat-txt-Dégâts { color: var(--cat-degats); }
.cat-txt-Protection { color: var(--cat-protection); }
.cat-txt-Agressif { color: var(--cat-agressif); }
.cat-txt-Invocation { color: var(--cat-invocation); }
.cat-txt-Utilitaire { color: var(--cat-utilitaire); }

/* détail en surimpression */
.voile {
    position: fixed; inset: 0; background: rgba(43, 38, 32, .45); z-index: 50;
    display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.detail { position: relative; max-width: 34rem; width: 100%; }
.detail .carte { box-shadow: 0 10px 40px rgba(0, 0, 0, .3); }
.detail .fermer {
    position: absolute; top: -.7rem; right: -.7rem; z-index: 1;
    width: 1.8rem; height: 1.8rem; border-radius: 50%; border: none;
    background: var(--accent); color: #fff; font-size: 1.1rem; cursor: pointer;
}

/* ---------- atelier des figurines ---------- */
.atelier { display: grid; grid-template-columns: minmax(0, 1fr) 16rem; gap: 1.2rem; align-items: start; }
@media (max-width: 46rem) { .atelier { grid-template-columns: 1fr; } }
.visionneuse {
    background: linear-gradient(180deg, #efe8d8, #e2d8c2);
    border: 1px solid var(--trait); border-radius: 14px; overflow: hidden;
    height: min(72vh, 33rem); box-shadow: inset 0 2px 14px rgba(60, 40, 10, .1);
}
.scene-heros { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.scene-heros:active { cursor: grabbing; }
.panneau-figurines h2 { margin: 0 0 .4rem; }
.panneau-figurines h2 + .choix { margin-bottom: 1rem; }
.choix { display: flex; flex-wrap: wrap; gap: .4rem; }
.pastille {
    font: inherit; padding: .3rem .7rem; border: 1px solid var(--trait); border-radius: 999px;
    background: var(--carte); color: var(--encre); cursor: pointer;
}
.pastille:hover { border-color: var(--accent); }
.pastille.actif { background: var(--accent); border-color: var(--accent); color: #fff; }
.porte-jeton svg { filter: drop-shadow(0 2px 4px rgba(60, 40, 10, .35)); }

/* ---------- visionneuse des décors ---------- */
.visionneuse.pleine { height: min(78vh, 42rem); }
#filtres input[type=number] {
    font: inherit; padding: .3rem .5rem; border: 1px solid var(--trait); border-radius: 8px;
    background: #fff; color: var(--encre); width: 8.5rem;
}
