:root { --trait: #777; --j1: #b9d9ff; --j2: #ffd3a8; --route: #cbb892; --herbe: #a9c98e; }
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; padding: 16px; color: #111; background: #fff; font: 16px Arial, sans-serif; }
button, input { font: inherit; }
button { padding: 7px 10px; border: 1px solid #555; border-radius: 0; background: #eee; cursor: pointer; }
button:hover:not(:disabled) { background: #ddd; }
button:disabled { cursor: not-allowed; opacity: .5; }
button:focus-visible, input:focus-visible, [role="button"]:focus-visible { outline: 3px solid #1466c3; outline-offset: 2px; }
input { width: 100%; padding: 7px; border: 1px solid #777; border-radius: 0; }
label { display: block; margin: 10px 0 4px; }
h1 { margin: 0 0 10px; font-size: 28px; }
h2 { margin: 0 0 8px; font-size: 18px; }
p { margin: 8px 0; }

.accueil { display: block; max-width: 760px; margin: 30px auto; }
.portail, .salon { border: 1px solid #777; padding: 20px; background: #fff; }
.blason { margin-bottom: 20px; }
.couronne { display: none; }
.choix-salon { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.choix-salon form { border: 1px solid #aaa; padding: 14px; }
.bouton { display: block; width: 100%; margin-top: 10px; }
.principal { font-weight: bold; }
.liste-joueurs { margin: 18px 0; border: 1px solid #aaa; }
.liste-joueurs p { margin: 0; padding: 8px; border-bottom: 1px solid #ccc; }
.liste-joueurs p:last-child { border: 0; }

.jeu { max-width: 1500px; margin: 0 auto; }
.hud-haut { width: 100%; border-collapse: collapse; table-layout: fixed; }
.hud-haut th, .hud-haut td { padding: 6px; border: 1px solid #555; text-align: center; font-size: 13px; }
.hud-haut th { background: #eee; }
.plateau { display: grid; grid-template-columns: minmax(500px, 1fr) 250px; gap: 14px; margin-top: 14px; }
.carte-jeu { min-width: 0; }

.grille-carte {
    --colonnes: 15; --lignes: 10;
    position: relative; display: grid;
    grid-template-columns: repeat(var(--colonnes), 1fr);
    grid-template-rows: repeat(var(--lignes), minmax(0, 1fr));
    width: min(100%, calc((100vh - 230px) * 1.5));
    min-width: 480px; margin: 0 auto;
    border-top: 1px solid #777; border-left: 1px solid #777;
    background: var(--herbe); aspect-ratio: 15 / 10; overflow: hidden;
}
.tuile { position: relative; z-index: 1; display: grid; place-items: center; min-width: 0; border-right: 1px solid rgba(0,0,0,.25); border-bottom: 1px solid rgba(0,0,0,.25); background: var(--herbe); font-size: clamp(8px, 1vw, 12px); }
.tuile.route-a, .tuile.route-b { background: var(--route); }
.tuile.croisement { background: #a89068; }
.tuile.croisement::after { content: "A/B"; color: #333; font-size: 9px; }
.grille-carte.avec-tuiles .tuile { background-size: 100% 100%; background-repeat: no-repeat; image-rendering: pixelated; }
.grille-carte.avec-tuiles .emplacement, .grille-carte.avec-tuiles .batiment { margin: 0; }
.tuile.chateau { z-index: 2; border-color: #333; background: #888; color: #fff; font-weight: bold; }
.tuile.decor::before { content: attr(data-decor); color: #49603b; font-size: 8px; }
.emplacement { z-index: 3; margin: 13%; border: 2px dashed #fff; background: rgba(255,255,255,.68); cursor: pointer; font-weight: bold; }
.emplacement-1 { box-shadow: inset 0 0 0 2px #2d6eb5; }
.emplacement-2 { box-shadow: inset 0 0 0 2px #b65b12; }
.emplacement-0 { box-shadow: inset 0 0 0 2px #555; }
.batiment { z-index: 4; margin: 8%; border: 2px solid #222; cursor: pointer; font-weight: bold; }
.batiment.joueur-1 { background: var(--j1); }
.batiment.joueur-2 { background: var(--j2); }
.batiment-tour_arbaletriers { border-radius: 50%; }
.batiment-baliste_lourde { border-width: 4px 1px; }
.selectionne { outline: 3px solid #fff000; outline-offset: -3px; }
.couche-unites { position: absolute; z-index: 6; inset: 0; pointer-events: none; }
.ennemi { display: inline-block; width: 12px; height: 12px; border: 1px solid #111; background: #d93832; }
.couche-unites .ennemi { position: absolute; transform: translate(-50%, -50%); transition: left .18s linear, top .18s linear; }
.ennemi-loup { background: #e9c52c; }
.ennemi-ogre { width: 15px; height: 15px; background: #714a94; }
.ennemi-chef_pillard { width: 18px; height: 18px; background: #6d1520; }

.radar { width: min(100%, calc((100vh - 230px) * 1.5)); min-width: 480px; margin: 10px auto 0; border: 1px solid #555; padding: 7px; }
.radar-titre { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.file-prevision { position: relative; height: 38px; overflow: hidden; border: 1px solid #aaa; }
.file-prevision::after { content: "carte"; position: absolute; right: 5px; top: 10px; color: #555; font-size: 11px; }
.convoi { position: absolute; top: 10px; display: flex; gap: 2px; transition: left .18s linear; }
.file-prevision > strong { position: absolute; right: 45px; top: 9px; }
.radar-vide { display: block; padding: 10px; text-align: center; color: #666; }
.message-jeu { min-height: 22px; text-align: center; }

.panneau { border: 1px solid #777; padding: 12px; }
.panneau section { margin-top: 14px; padding-top: 12px; border-top: 1px solid #aaa; }
.identite-joueur { margin-bottom: 10px; }
.identite-joueur small, .identite-joueur strong { display: block; }
.marque-joueur { display: inline-block; width: 14px; height: 14px; margin-right: 6px; }
.marque-joueur.joueur-1 { background: var(--j1); border: 1px solid #2d6eb5; }
.marque-joueur.joueur-2 { background: var(--j2); border: 1px solid #b65b12; }
.actions-ligne { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.bouton small { display: block; }

@media (max-width: 850px) {
    body { padding: 8px; }
    .plateau { grid-template-columns: 1fr; }
    .grille-carte, .radar { min-width: 0; width: 100%; }
    .panneau { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .panneau section { margin: 0; padding: 8px; border: 1px solid #aaa; }
}
@media (max-width: 560px) {
    .choix-salon, .panneau { grid-template-columns: 1fr; }
    .hud-haut { table-layout: auto; display: block; overflow-x: auto; white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
