:root {
  --panneau: rgba(9, 12, 24, 0.78);
  --panneau-plein: #0c1020;
  --bord: rgba(255, 255, 255, 0.09);
  --texte: #e9edf6;
  --texte-2: #8e97ad;
  --doux: #8e97ad;
  --or: #f2c14e;
  --vert: #3ddc84;
  --rouge: #ff4d6d;
  --jaune: #ffc145;
  --bleu: #5ab0ff;
  --gris: #4a5068;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --rayon: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #070b1a; color: var(--texte); font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
.mono { font-family: var(--mono); }
code { font-family: var(--mono); font-size: 0.92em; background: rgba(255, 255, 255, 0.07); padding: 1px 5px; border-radius: 5px; }

#scene { position: fixed; inset: 0; touch-action: none; }
#scene canvas { display: block; }
.bandeau-webgl-perdu {
  position: absolute; inset: 0; z-index: 5; display: grid; place-items: center;
  background: rgba(4, 6, 14, 0.92); pointer-events: none; text-align: center; padding: 24px;
}
.bandeau-webgl-perdu p { max-width: 28rem; margin: 0; line-height: 1.5; color: var(--texte); }
.bandeau-webgl-perdu kbd { font-family: var(--mono); background: rgba(255,255,255,0.08); padding: 2px 6px; border-radius: 4px; }
.bandeau-webgl-perdu .bouton-bandeau-webgl {
  margin-top: 12px; padding: 10px 18px; border-radius: 999px; border: 1px solid var(--or);
  background: rgba(242, 193, 78, 0.15); color: var(--or); font-weight: 600; pointer-events: auto; cursor: pointer;
}
.bandeau-navigateur-embed {
  position: fixed; bottom: 48px; left: 50%; transform: translateX(-50%); z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; max-width: min(640px, 94vw);
  padding: 8px 14px; border-radius: 999px; border: 1px solid rgba(90, 176, 255, 0.45);
  background: rgba(8, 14, 32, 0.92); font-size: 0.88rem; color: var(--doux); pointer-events: auto;
}
.bandeau-navigateur-embed a.bouton { padding: 6px 14px; font-size: 0.85rem; text-decoration: none; white-space: nowrap; }
[data-refaire-test] { color: var(--or); text-decoration: none; }
[data-refaire-test]:hover { text-decoration: underline; }
.banc-perf {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 60; max-height: 80vh; overflow: auto;
  width: min(760px, 94vw); padding: 14px 18px; border-radius: 14px; border: 1px solid rgba(242, 193, 78, 0.4);
  background: rgba(8, 12, 24, 0.96); color: var(--texte); font-size: 0.85rem; pointer-events: auto;
}
.banc-perf .banc-tete { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--doux); }
.banc-perf .banc-tete b { color: var(--or); }
.banc-perf .banc-fermer { margin-left: auto; background: none; border: 0; color: var(--doux); font-size: 1.3rem; cursor: pointer; }
.banc-perf table { width: 100%; border-collapse: collapse; font-family: var(--mono); }
.banc-perf th, .banc-perf td { padding: 4px 6px; text-align: right; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.banc-perf th:first-child, .banc-perf td:first-child { text-align: left; }
.banc-perf .banc-alerte { color: #ffb36b; margin: 0 0 8px; }
.banc-perf .banc-pied { color: var(--doux); margin: 8px 0 0; }
.calque-tele { position: absolute !important; inset: 0; pointer-events: none; }
.calque-tele.interactive iframe { pointer-events: auto; }
.calque-etiquettes { position: absolute !important; inset: 0; pointer-events: none; }

/* ---------- Barre du haut ---------- */
.barre {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto);
  grid-template-areas: "marque actions" "stats stats" "hud hud";
  align-items: center; gap: 6px 12px; padding: 10px 14px 12px;
  background: linear-gradient(rgba(4, 6, 14, 0.92), rgba(4, 6, 14, 0));
  pointer-events: none;
}
.barre > * { pointer-events: auto; }
.marque { grid-area: marque; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-width: 0; }
.stats { grid-area: stats; width: 100%; display: flex; gap: 14px; font-size: 12.5px; color: var(--doux); flex-wrap: wrap; order: unset; }
.hud { grid-area: hud; width: 100%; }
.actions {
  grid-area: actions; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end;
  max-width: min(720px, 58vw);
}
.identite-resident { font-size: 11px; color: var(--texte-2); display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--bord); background: rgba(255,255,255,0.04); }
.identite-resident .carre { width: 8px; height: 8px; border-radius: 2px; }
.identite-resident a { color: var(--or); text-decoration: none; }
.identite-resident a:hover { text-decoration: underline; }
#nom-ville { color: var(--or); font-weight: 700; font-size: 21px; letter-spacing: 0.42em; text-shadow: 0 0 18px rgba(242, 193, 78, 0.35); }
#horloge { color: var(--doux); font-size: 13px; }
.stats b { color: var(--texte); font-weight: 600; }
.stats .pt::before { content: '●'; margin-right: 6px; }
.stats .vert::before { color: var(--vert); }
.stats .rouge::before { color: var(--rouge); }
.stats .bleu::before { color: var(--bleu); }
.stats .jaune { color: var(--jaune); }
.stats .jaune::before { color: var(--jaune); }
.actions { margin-left: 0; }

.bouton {
  background: rgba(10, 14, 28, 0.66); border: 1px solid rgba(242, 193, 78, 0.38); color: var(--or);
  padding: 8px 15px; border-radius: 999px; font-size: 13px; font-weight: 500; backdrop-filter: blur(8px);
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
}
.bouton:hover { border-color: var(--or); background: rgba(242, 193, 78, 0.12); }
.bouton:active { transform: scale(0.97); }
.bouton.actif, .bouton.principal { background: var(--or); color: #17130a; border-color: var(--or); }
.bouton.principal:hover { background: #ffd36b; }
.bouton.plein { width: 100%; margin-top: 14px; }
.bouton.danger { border-color: rgba(255, 77, 109, 0.5); color: var(--rouge); grid-column: 1 / -1; }

/* ---------- Panneaux ---------- */
.colonne, .fiche, .tiroir, dialog {
  background: var(--panneau); border: 1px solid var(--bord); border-radius: var(--rayon);
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}
.colonne { position: fixed; z-index: 9; top: 118px; right: 14px; width: 220px; max-height: calc(100vh - 168px); overflow: auto; padding: 12px; background: transparent; border: none; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.bloc + .bloc { margin-top: 14px; }
.bloc h3, .fiche h3, .ajout h3 { font-size: 10.5px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--or); margin: 0 0 8px 4px; font-weight: 600; }
.ligne {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left;
  background: var(--panneau); border: 1px solid var(--bord); border-radius: 10px; padding: 7px 11px; margin-bottom: 5px;
  backdrop-filter: blur(10px); transition: border-color 0.15s, background 0.15s;
}
.ligne:hover { border-color: rgba(242, 193, 78, 0.45); }
.ligne.choisi { border-color: var(--or); box-shadow: 0 0 0 1px var(--or) inset; }
.ligne > span:nth-child(2) { flex: 1; font-size: 14px; }
.ligne b { color: var(--or); font-size: 12px; }
.ligne .ico { width: 22px; text-align: center; color: var(--doux); }
.ligne.agent small { margin-left: auto; color: var(--doux); font-size: 11px; white-space: nowrap; }
.ligne.agent .nom-agent { flex: 1; font-size: 13.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nom-agent { display: flex; align-items: center; gap: 8px; }
.carre { display: inline-block; width: 11px; height: 11px; border-radius: 3px; flex: none; box-shadow: 0 0 10px currentColor; }
.carre.grand { width: 34px; height: 34px; border-radius: 9px; }
.pastille { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--gris); }
.st-working.pastille, .pastille.st-working { background: var(--vert); box-shadow: 0 0 8px var(--vert); }
.pastille.st-waiting { background: var(--rouge); box-shadow: 0 0 8px var(--rouge); animation: pulse 1.1s infinite; }
.pastille.st-idle { background: var(--jaune); }
.pastille.st-offline { background: var(--gris); }

.fiche { position: fixed; z-index: 9; top: var(--bas-barre, 100px); left: 16px; width: 330px; max-height: calc(100vh - var(--bas-barre, 100px) - 50px); overflow: auto; padding: 18px; }
.fiche-tete { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; padding-right: 24px; }
.fiche-tete h2 { margin: 0; font-size: 22px; }
.fiche .ico.grand { font-size: 26px; width: 34px; text-align: center; color: var(--or); }
.etat { font-size: 12px; color: var(--doux); }
.etat.st-working { color: var(--vert); }
.etat.st-waiting { color: var(--rouge); }
.etat.st-idle { color: var(--jaune); }
dl { display: grid; grid-template-columns: 92px 1fr; gap: 7px 10px; margin: 0 0 14px; font-size: 12.5px; }
dt { color: var(--doux); }
dd { margin: 0; overflow-wrap: anywhere; }
.sessions { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.sessions li { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid var(--bord); flex-wrap: wrap; }
.sessions li span { margin-left: auto; color: var(--doux); }
.sessions li.cliquable { cursor: pointer; }
.sessions li.cliquable:hover { color: var(--or); }
.fermer { position: absolute; top: 10px; right: 12px; background: none; border: none; color: var(--doux); font-size: 22px; line-height: 1; padding: 4px; }
.fermer:hover { color: var(--texte); }

.aide { position: fixed; z-index: 5; bottom: 46px; left: 50%; transform: translateX(-50%); font-size: 12px; color: rgba(200, 208, 225, 0.55); pointer-events: none; white-space: nowrap; }

/* ---------- Fil en direct ---------- */
.fil { position: fixed; z-index: 10; left: 0; right: 0; bottom: 0; height: 36px; display: flex; align-items: center; background: rgba(4, 6, 14, 0.9); border-top: 1px solid var(--bord); font-size: 12.5px; }
.direct { color: var(--rouge); letter-spacing: 0.2em; padding: 0 16px 0 18px; flex: none; font-weight: 600; }
.defile { overflow: hidden; flex: 1; mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); }
#fil-texte { display: inline-block; white-space: nowrap; animation: defile 60s linear infinite; }
.defile:hover #fil-texte { animation-play-state: paused; }
.evt { margin-right: 44px; color: #c9d0de; }
.evt .h { color: var(--doux); }
@keyframes defile { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------- Étiquettes dans la scène ---------- */
/* Le point d'ancrage est au centre de l'élément : le padding du bas pousse le contenu au-dessus (place pour l'émote). */
.etiquette-agent { pointer-events: none; cursor: default; display: flex; flex-direction: column; align-items: center; gap: 4px; padding-bottom: 46px; transform-origin: center bottom; }
.etiquette-agent > * { pointer-events: none; }
.etiquette-agent .nom {
  font-family: var(--mono); font-size: 11px; color: #fff; white-space: nowrap;
  background: rgba(6, 8, 18, 0.8); border: 1px solid rgba(255, 255, 255, 0.14); padding: 3px 8px; border-radius: 6px;
  display: flex; align-items: center; gap: 6px;
}
.etiquette-agent .nom i { width: 7px; height: 7px; border-radius: 2px; }
.etiquette-agent .nom span { color: var(--or); }
.etiquette-agent.dort { opacity: 0.6; }
.etiquette-agent.filtre-masque { display: none; }
.filtre-voir { appearance: none; -webkit-appearance: none; cursor: pointer; font-family: inherit; padding-right: 15px; }
.filtre-voir[hidden] { display: none; }
.filtre-voir option { background: #0a0e1c; color: #fff; }
.filtre-voir.actif { background: var(--or); color: #0a0e1c; }
body.loin .etiquette-agent:not(.choisi) .bulle:not(.st-waiting) { display: none; }
body.loin .etiquette-agent:not(.choisi) .nom { font-size: 9.5px; padding: 2px 6px; gap: 4px; }
body.loin .etiquette-agent:not(.choisi) .nom span { display: none; }
body.loin .etiquette-agent.dort:not(.choisi) { display: none; }
.etiquette-agent.dort .nom { font-size: 10px; padding: 2px 6px; }
.etiquette-agent.choisi .nom { border-color: var(--or); box-shadow: 0 0 14px rgba(242, 193, 78, 0.5); }
.bulle { font-family: var(--mono); font-size: 10.5px; padding: 2px 7px; border-radius: 10px; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.bulle:empty { display: none; }
.bulle.st-working { background: rgba(61, 220, 132, 0.16); color: #9ff5c4; border: 1px solid rgba(61, 220, 132, 0.4); }
.bulle.st-waiting { background: var(--rouge); color: #fff; font-weight: 600; animation: pulse 1.1s infinite; }
.bulle.st-waiting b { background: #fff; color: var(--rouge); border-radius: 50%; display: inline-grid; place-items: center; width: 14px; height: 14px; font-size: 10px; margin-right: 2px; }
.bulle.st-idle { background: rgba(255, 193, 69, 0.14); color: #ffe2a3; }
.bulle.st-offline { color: #b9c3ff; font-style: italic; letter-spacing: 0.15em; animation: zzz 3s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }
@keyframes zzz { 0%, 100% { transform: translateY(0); opacity: 0.5; } 50% { transform: translateY(-5px); opacity: 1; } }

.etiquette-lieu {
  pointer-events: auto; border: none; background: rgba(250, 248, 242, 0.94); color: #15161b; font-weight: 600; font-size: 12.5px;
  padding: 5px 11px; border-radius: 7px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.etiquette-lieu:hover { background: var(--or); }

/* ---------- Tiroir de personnalisation ---------- */
.tiroir { position: fixed; z-index: 30; top: 12px; right: 12px; bottom: 48px; width: 410px; display: flex; flex-direction: column; background: rgba(9, 12, 24, 0.92); }
.tiroir[hidden] { display: none; }
.tiroir-tete { padding: 18px 20px 6px; position: relative; }
.tiroir-tete h2 { margin: 0; font-size: 20px; }
.onglets { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 16px 12px; border-bottom: 1px solid var(--bord); }
.onglets button { background: none; border: 1px solid transparent; color: var(--doux); padding: 6px 12px; border-radius: 999px; font-size: 13px; }
.onglets button.actif { color: var(--or); border-color: rgba(242, 193, 78, 0.45); background: rgba(242, 193, 78, 0.08); }
.tiroir-corps { flex: 1; overflow: auto; padding: 16px 20px; }
.tiroir-pied { padding: 10px 20px; border-top: 1px solid var(--bord); font-size: 11px; color: var(--doux); }
.champ { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; font-size: 13px; }
.champ > span { color: var(--doux); font-size: 12px; display: flex; align-items: center; gap: 6px; }
input, select { font: inherit; color: var(--texte); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--bord); border-radius: 8px; padding: 8px 10px; min-width: 0; }
input:focus, select:focus { outline: none; border-color: var(--or); }
select option { background: var(--panneau-plein); }
input[type='range'] { padding: 0; accent-color: var(--or); }
input[type='color'] { padding: 2px; height: 36px; width: 100%; cursor: pointer; }
.choix { display: flex; flex-wrap: wrap; gap: 6px; }
.choix button { background: rgba(255, 255, 255, 0.04); border: 1px solid var(--bord); padding: 6px 11px; border-radius: 8px; font-size: 12.5px; color: #cdd3e1; }
.choix button:hover { border-color: rgba(242, 193, 78, 0.5); }
.choix button.actif { background: var(--or); border-color: var(--or); color: #17130a; font-weight: 600; }
.carte-agent { border: 1px solid var(--bord); border-radius: 10px; margin-bottom: 8px; background: rgba(255, 255, 255, 0.025); }
.carte-agent[open] { border-color: rgba(242, 193, 78, 0.35); }
.carte-agent summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 11px 12px; cursor: pointer; }
.carte-agent summary::-webkit-details-marker { display: none; }
.carte-agent summary span { flex: 1; font-weight: 500; }
.grille { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; padding: 4px 12px 12px; }
.grille .champ { min-width: 0; }
.champ select { width: 100%; }
.grille .champ:first-child, .grille .large { grid-column: 1 / -1; }
.interrupteur { position: relative; width: 34px; height: 20px; flex: none; }
.interrupteur input { opacity: 0; position: absolute; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.interrupteur i { position: absolute; inset: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.12); transition: background 0.15s; }
.interrupteur i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.interrupteur input:checked + i { background: var(--vert); }
.interrupteur input:checked + i::after { transform: translateX(14px); }
.ajout { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--bord); }
.ajout p, .note { color: var(--doux); font-size: 12px; line-height: 1.5; }
.ligne-form { display: flex; gap: 6px; flex-wrap: wrap; }
.ligne-form input { flex: 1 1 140px; }

/* ---------- Relier mes agents ---------- */
dialog { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 60px); padding: 24px 26px; color: var(--texte); background: rgba(10, 13, 26, 0.96); }
dialog::backdrop { background: rgba(2, 3, 8, 0.6); backdrop-filter: blur(3px); }
dialog h2 { margin: 0 0 8px; font-size: 22px; }
.intro { color: #c3cadb; font-size: 13.5px; line-height: 1.55; }
.etape { margin-top: 18px; }
.etape h3 { margin: 0 0 4px; font-size: 14px; color: var(--or); }
.etape p { margin: 0 0 8px; color: var(--doux); font-size: 12.5px; line-height: 1.5; }
.commande { display: flex; gap: 8px; align-items: stretch; }
.commande code { flex: 1; display: block; white-space: pre-wrap; word-break: break-all; padding: 10px 12px; border-radius: 8px; background: rgba(0, 0, 0, 0.45); border: 1px solid var(--bord); font-size: 12px; line-height: 1.5; }
.copier { flex: none; background: rgba(242, 193, 78, 0.12); border: 1px solid rgba(242, 193, 78, 0.4); color: var(--or); border-radius: 8px; padding: 0 12px; font-size: 12px; }

.ecran-verrou { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 32px; text-align: center; background: rgba(4, 6, 14, 0.92); font-size: 16px; line-height: 1.6; }

/* ---------- Alertes (panneau sous le bouton) ---------- */
.menu-alertes { position: relative; }
.panneau-alertes { position: absolute; z-index: 25; top: calc(100% + 8px); right: 0; width: 290px; padding: 12px 14px; background: rgba(9, 12, 24, 0.95); border: 1px solid var(--bord); border-radius: var(--rayon); box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45); backdrop-filter: blur(14px); text-align: left; }
.panneau-alertes[hidden] { display: none; }
.interrupteur-ligne { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 13px; border-bottom: 1px solid var(--bord); }
.interrupteur-ligne:last-of-type { border-bottom: none; }
.interrupteur-ligne > span:first-child { display: flex; flex-direction: column; gap: 2px; }
.interrupteur-ligne small { color: var(--doux); font-size: 11px; }
.bouton.petit { padding: 4px 10px; font-size: 12px; }
.bouton.actif.petit { font-weight: 600; }

/* ---------- Colonne : potes ---------- */
.ligne.pote small { margin-left: auto; color: var(--doux); font-size: 11px; white-space: nowrap; }
.ligne.pote .nom-agent { flex: 1; font-size: 13.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ligne.pote em { font-style: normal; color: var(--or); font-size: 11px; margin-left: 4px; }
.etiquette-agent .nom i + i { margin-left: -3px; }
.sessions li .qui { color: var(--doux); font-size: 11px; }

/* ---------- Fiche du salon ---------- */
.chaines { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.chaine { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--bord); border-radius: 8px; padding: 6px 10px; text-align: left; }
.chaine b { font-size: 12.5px; font-weight: 500; }
.chaine small { color: var(--doux); font-size: 10.5px; }
.chaine:hover { border-color: rgba(242, 193, 78, 0.5); }
.chaine.actif { background: rgba(242, 193, 78, 0.16); border-color: var(--or); }
.chaine.actif b { color: var(--or); }
.boutons { display: flex; gap: 8px; margin: 6px 0 12px; flex-wrap: wrap; }
.boutons .bouton { flex: 1; }
.choisie { font-size: 12px; color: var(--doux); margin: 0 0 8px; }

/* ---------- Journal (historique) ---------- */
.stat-agent { border: 1px solid var(--bord); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; background: rgba(255, 255, 255, 0.025); }
.stat-agent .tete { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 7px; }
.stat-agent .tete b { font-weight: 500; }
.stat-agent .tete .mono { margin-left: auto; color: var(--doux); font-size: 11px; white-space: nowrap; }
.bande { display: grid; grid-template-columns: repeat(24, 1fr); gap: 2px; height: 14px; margin-bottom: 7px; }
.bande i { display: block; border-radius: 2px; background: var(--vert); }
.outils { display: flex; flex-wrap: wrap; gap: 6px; font-size: 11px; color: var(--doux); }
.outils span { background: rgba(255, 255, 255, 0.05); border-radius: 6px; padding: 2px 7px; }
.outils span b { color: var(--texte); font-weight: 600; margin-left: 4px; }
.totaux { display: flex; flex-direction: column; gap: 5px; margin: 6px 0 16px; font-size: 12.5px; }
.totaux div { display: flex; align-items: center; gap: 8px; }
.totaux div span { margin-left: auto; color: var(--doux); font-family: var(--mono); font-size: 11px; }
.totaux .total { border-top: 1px solid var(--bord); padding-top: 6px; font-weight: 600; }
.barre-stat { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.07); overflow: hidden; margin-top: 6px; }
.barre-stat i { display: block; height: 100%; background: var(--or); }
.evenements { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.evenements li { display: flex; gap: 8px; padding: 6px 0; border-top: 1px solid var(--bord); line-height: 1.4; }
.evenements .h { color: var(--doux); font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.evenements .texte { color: #c9d0de; }
.tiroir h3 { font-size: 10.5px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--or); margin: 14px 0 8px; font-weight: 600; }
.tiroir h3:first-child { margin-top: 0; }

/* ---------- Personnaliser : potes, télé, alertes, journal ---------- */
.carte-pote { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.carte-pote input[type='color'] { width: 40px; height: 34px; flex: none; }
.carte-pote input[type='text'] { flex: 1; }
.carte-pote small { color: var(--or); font-size: 11px; padding: 0 8px; }
.carte-pote .bouton.danger { grid-column: auto; }
.invitation { margin-top: 12px; padding: 12px; border: 1px solid rgba(242, 193, 78, 0.35); border-radius: 10px; background: rgba(242, 193, 78, 0.06); }
.invitation h3 { margin-top: 0; }
.invitation .commande { margin-bottom: 8px; }
.invitation p { margin: 0 0 8px; }
.chaine-ligne { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid var(--bord); font-size: 13px; }
.chaine-ligne:first-of-type { border-top: none; }
.chaine-ligne .infos { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chaine-ligne .infos small { color: var(--doux); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chaine-ligne b.actif { color: var(--or); }
.chaine-ligne .retirer { background: none; border: none; color: var(--doux); font-size: 18px; padding: 0 4px; }
.chaine-ligne .retirer:hover { color: var(--rouge); }
.ligne-form select { flex: 0 0 auto; }
.ligne-form .large { flex: 1 1 100%; }
.interrupteur-champ { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--bord); font-size: 13.5px; }
.interrupteur-champ small { display: block; color: var(--doux); font-size: 11.5px; margin-top: 2px; }

/* ---------- Petits écrans ---------- */
@media (max-width: 900px) {
  .barre { grid-template-columns: 1fr; grid-template-areas: "marque" "actions" "stats" "hud"; padding: 10px 12px 14px; gap: 8px; }
  .actions { max-width: 100%; justify-content: flex-start; }
  .stats { gap: 12px; font-size: 12px; }
  #btn-visite, #btn-demo { display: none; }
  .colonne { display: none; }
  .fiche { top: auto; bottom: 46px; left: 16px; right: 16px; width: auto; max-height: 46vh; }
  .tiroir { left: 12px; width: auto; }
  .onglets { flex-wrap: wrap; }
  .panneau-alertes { width: min(290px, calc(100vw - 32px)); }
  .aide { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  #fil-texte { animation: none; }
  .bulle, .pastille { animation: none !important; }
}

/* ---------- Mairie ---------- */
.tiroir.large { width: min(600px, calc(100vw - 24px)); }
.etiquette-agent .titre { font-family: var(--mono); font-size: 9.5px; color: rgba(233, 237, 246, 0.72); background: rgba(6, 8, 18, 0.55); padding: 1px 6px; border-radius: 5px; margin-top: -2px; white-space: nowrap; }
body.loin .etiquette-agent:not(.choisi) .titre { display: none; }
.bulle.mission { background: rgba(242, 193, 78, 0.18); color: #ffe2a3; border: 1px solid rgba(242, 193, 78, 0.5); }
/* Organigramme : arbre vertical, traits de liaison en CSS */
.org, .org ul { list-style: none; margin: 0; padding: 0; }
.org ul { margin-left: 16px; padding-left: 14px; border-left: 1px solid rgba(242, 193, 78, 0.28); }
.org li { position: relative; padding: 4px 0; }
.org ul > li::before { content: ''; position: absolute; left: -14px; top: 22px; width: 12px; border-top: 1px solid rgba(242, 193, 78, 0.28); }
.org-carte { display: flex; align-items: center; gap: 9px; width: 100%; max-width: 420px; text-align: left; background: rgba(255, 255, 255, 0.035); border: 1px solid var(--bord); border-radius: 10px; padding: 7px 10px; }
button.org-carte:hover { border-color: rgba(242, 193, 78, 0.55); }
.org-carte.moi { border-color: rgba(242, 193, 78, 0.45); background: rgba(242, 193, 78, 0.07); }
.org-carte.cache { opacity: 0.5; }
.org-nom { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.org-nom b { font-weight: 500; font-size: 13.5px; }
.org-nom small { color: var(--doux); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-carte em { font-style: normal; font-size: 10.5px; color: var(--doux); white-space: nowrap; }
.org-groupe { display: grid; gap: 6px; }
/* Missions */
.mission-form textarea, .carte-agent textarea { font: inherit; color: var(--texte); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--bord); border-radius: 8px; padding: 8px 10px; width: 100%; resize: vertical; }
.mission-form textarea:focus, .carte-agent textarea:focus { outline: none; border-color: var(--or); }
.mission-form .ligne-form { margin-top: 8px; }
.mission-form .ligne-form .champ { flex: 1 1 150px; margin-bottom: 4px; }
.mission-form .ligne-form .champ.large { flex: 2 1 220px; }
.ligne-form .champ input, .ligne-form .champ select { flex: none; }
.mission-form .erreur, .note.erreur { color: var(--rouge); margin: 4px 0 0; min-height: 1em; }
.types-mission { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.chip { background: rgba(242, 193, 78, 0.08); border: 1px solid rgba(242, 193, 78, 0.3); color: #f3dc9c; border-radius: 999px; padding: 3px 10px; font-size: 11.5px; }
.chip:hover { background: rgba(242, 193, 78, 0.18); }
.bouton[disabled] { opacity: 0.45; cursor: not-allowed; }
.colonnes-missions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--bord); }
.col-missions { min-width: 0; }
.col-missions h3 b { color: var(--texte); margin-left: 4px; letter-spacing: 0; }
.col-missions .vide { margin: 4px; }
.carte-mission { border: 1px solid var(--bord); border-radius: 10px; padding: 9px 10px; margin-bottom: 8px; background: rgba(255, 255, 255, 0.03); font-size: 12.5px; }
.carte-mission.st-m-en-cours { border-color: rgba(61, 220, 132, 0.45); }
.carte-mission.st-m-ouverte { border-color: rgba(90, 176, 255, 0.45); }
.carte-mission.st-m-erreur { border-color: rgba(255, 77, 109, 0.5); }
.carte-mission header { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; }
.carte-mission header b { font-weight: 600; }
.carte-mission header small { color: var(--doux); font-size: 11px; }
.statut-mission { margin-left: auto; font-size: 10.5px; color: var(--doux); }
.st-m-en-cours .statut-mission { color: var(--vert); }
.st-m-erreur .statut-mission { color: var(--rouge); }
.carte-mission .texte { margin: 6px 0; line-height: 1.4; overflow-wrap: anywhere; white-space: pre-line; }
.carte-mission .meta { display: flex; justify-content: space-between; gap: 6px; color: var(--doux); font-size: 10.5px; }
.carte-mission .meta span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.carte-mission .meta span:last-child { white-space: nowrap; flex: none; }
.carte-mission .resume { margin: 6px 0 0; font-size: 10.5px; color: #aab3c7; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 4.5em; overflow: hidden; }
.actions-mission { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.bouton.petit.danger { grid-column: auto; }
dialog.petit { width: min(560px, calc(100vw - 32px)); }
dialog .boutons { justify-content: flex-end; margin-top: 16px; }
dialog .boutons .bouton { flex: 0 0 auto; }
.texte-mission { margin: 0; padding: 10px 12px; border-left: 3px solid var(--or); background: rgba(242, 193, 78, 0.06); border-radius: 0 8px 8px 0; white-space: pre-line; font-size: 13px; overflow-wrap: anywhere; max-height: 30vh; overflow: auto; }
dialog dl .carre { vertical-align: -1px; }
#journal-mission h2 { display: flex; align-items: center; gap: 10px; }
.tail { height: min(56vh, 520px); overflow: auto; margin: 10px 0 6px; padding: 10px 12px; background: rgba(0, 0, 0, 0.5); border: 1px solid var(--bord); border-radius: 8px; font-size: 11.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.carte-lanceur { border: 1px solid var(--bord); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; background: rgba(255, 255, 255, 0.025); }
.carte-lanceur .tete { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; flex-wrap: wrap; }
.carte-lanceur .tete small { color: var(--doux); font-size: 11px; }
.carte-lanceur .commande { margin-bottom: 8px; }
.carte-lanceur .champ { flex: 1 1 140px; margin-bottom: 0; }
.carte-agent summary small { color: var(--doux); font-weight: 400; font-size: 11.5px; margin-left: 6px; }
/* Figurants : étiquette discrète, jamais cliquable */
.etiquette-agent.figurant { padding-bottom: 40px; opacity: 0.62; }
.etiquette-agent.figurant > * { pointer-events: none; }
.etiquette-agent.figurant .nom { font-size: 9.5px; padding: 1px 6px; color: #d5dae6; background: rgba(6, 8, 18, 0.45); border-color: rgba(255, 255, 255, 0.07); cursor: default; }
body.loin .etiquette-agent.figurant { opacity: 0.4; }
body.loin .etiquette-agent.figurant .nom { font-size: 8.5px; }
.evt.figurant { color: #8e97ad; font-style: italic; }
@media (max-width: 900px) {
  .tiroir.large { width: auto; }
  .colonnes-missions { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- v3 : économie ---------- */
.hud { order: 4; width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 12px; color: var(--doux); }
.hud[hidden] { display: none; }
.hud .puce { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; background: rgba(10, 14, 28, 0.6); border: 1px solid var(--bord); backdrop-filter: blur(8px); font-size: 12px; color: var(--doux); }
.hud .puce b { color: var(--or); font-weight: 600; }
.hud .puce.cliquable:hover { border-color: rgba(242, 193, 78, 0.5); color: var(--texte); }
.bandeau-decret { display: inline-flex; align-items: center; gap: 8px; max-width: min(520px, 100%); padding: 4px 12px; border-radius: 999px; border: 1px solid rgba(242, 193, 78, 0.6); background: linear-gradient(90deg, rgba(242, 193, 78, 0.22), rgba(242, 193, 78, 0.06)); color: #ffe7ad; font-size: 12px; animation: lueur 3s ease-in-out infinite; }
.bandeau-decret b { color: var(--or); white-space: nowrap; }
.bandeau-decret span { color: #d9c9a0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bandeau-decret:hover { background: rgba(242, 193, 78, 0.3); }
@keyframes lueur { 50% { box-shadow: 0 0 16px rgba(242, 193, 78, 0.35); } }

/* Étiquettes : niveau, grade, couronne */
.etiquette-agent .niveau { font-family: var(--mono); font-size: 9px; color: #f3dc9c; background: rgba(6, 8, 18, 0.55); padding: 1px 6px; border-radius: 5px; white-space: nowrap; margin-top: -2px; }
.etiquette-agent .niveau b, .etiquette-agent .couronne { color: var(--or); text-shadow: 0 0 8px rgba(242, 193, 78, 0.7); }
.etiquette-agent .couronne { font-size: 12px; margin-right: -2px; }
body.loin .etiquette-agent:not(.choisi) .niveau { display: none; }
.etiquette-agent.figurant .nom .nv { color: #b9c3d6; margin-left: 2px; }
.etiquette-agent.figurant .nom b { color: var(--or); }

/* Textes flottants (animation CSS, aucun calcul par image) */
.flottant { pointer-events: none; }
.flottant span { display: inline-block; font-family: var(--mono); font-size: 11px; font-weight: 600; white-space: nowrap; color: #b6f7cf; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 0 10px rgba(61, 220, 132, 0.5); animation: flotte 2.2s ease-out forwards; }
.flottant b { color: #b6f7cf; }
.flottant i { font-style: normal; color: #ffe08a; }
.flottant i.neg { color: #ff9aa9; }
@keyframes flotte { 0% { transform: translateY(6px); opacity: 0; } 12% { opacity: 1; } 70% { opacity: 1; } 100% { transform: translateY(-46px); opacity: 0; } }

/* Colonne : classement */
.ligne.rang { gap: 8px; padding: 6px 10px; }
.ligne.rang .pos { width: 14px; text-align: right; color: var(--doux); font-size: 11px; }
.ligne.rang .nom-agent { flex: 1; min-width: 0; font-size: 13px; }
.ligne.rang .txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ligne.rang .txt small { color: var(--doux); font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; }
.ligne.rang > b:last-child { font-size: 11px; white-space: nowrap; }

/* Fiche citoyen */
.eco-fiche { margin: 4px 0 8px; }
.eco-fiche h3 { margin-top: 14px !important; }
.xp-ligne { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.xp-ligne > b { color: var(--or); font-size: 16px; }
.xp-ligne span { color: var(--texte); }
.xp-ligne em { margin-left: auto; font-style: normal; color: var(--doux); font-size: 11px; }
.or { color: var(--or); }
.barre-xp { height: 7px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); overflow: hidden; margin: 6px 0 10px; }
.barre-xp i { display: block; height: 100%; background: linear-gradient(90deg, #c99a2e, var(--or)); box-shadow: 0 0 10px rgba(242, 193, 78, 0.5); }
.jauges { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; align-items: center; margin-bottom: 12px; }
.jauges .pieces { grid-row: span 2; display: flex; flex-direction: column; align-items: flex-start; padding-right: 6px; border-right: 1px solid var(--bord); }
.jauges .pieces b { color: var(--or); font-size: 15px; }
.jauges .pieces span { color: var(--doux); font-size: 11px; }
.jauge { display: grid; grid-template-columns: 54px 1fr 26px; gap: 6px; align-items: center; font-size: 11.5px; color: var(--doux); }
.jauge > div { height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.jauge > div i { display: block; height: 100%; background: var(--vert); }
.jauge.humeur > div i { background: #ff9ae0; }
.jauge b { font-size: 11px; color: var(--texte); text-align: right; }
.badges { display: flex; flex-wrap: wrap; gap: 5px; }
.badge { background: rgba(242, 193, 78, 0.1); border: 1px solid rgba(242, 193, 78, 0.35); color: #f3dc9c; border-radius: 999px; padding: 2px 9px; font-size: 11px; }
.stats-cit { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 11.5px; }
.stats-cit div { display: flex; justify-content: space-between; gap: 6px; color: var(--doux); border-bottom: 1px dashed var(--bord); padding: 2px 0; }
.stats-cit b { color: var(--texte); }
.eco-fiche .evenements { max-height: 190px; overflow: auto; }
.eco-fiche .evenements .xp { color: #9ff5c4; font-weight: 500; font-family: var(--mono); font-size: 10.5px; }
.eco-fiche .evenements .pc { color: #ffe08a; font-weight: 500; font-family: var(--mono); font-size: 10.5px; }
.prime { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; font-size: 12px; color: var(--doux); }
.prime span { width: 100%; }

/* Mairie : décrets, économie */
.carte-decret { border: 1px solid var(--bord); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; background: rgba(255, 255, 255, 0.025); font-size: 12.5px; }
.carte-decret.actif { border-color: rgba(242, 193, 78, 0.55); background: rgba(242, 193, 78, 0.07); }
.carte-decret header { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.carte-decret header b { color: var(--or); }
.carte-decret header span { color: var(--doux); font-size: 11px; }
.carte-decret p { margin: 6px 0 4px; line-height: 1.45; color: #d6dbe7; font-style: italic; }
.carte-decret small { color: var(--doux); font-size: 11px; }
.forcer { margin: 6px 0 4px; padding: 10px 12px; border: 1px dashed rgba(242, 193, 78, 0.35); border-radius: 10px; }
.forcer h3 { margin-top: 0 !important; }
.forcer select { flex: 1 1 200px; }
.eco-cartes { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-bottom: 6px; }
.eco-cartes > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--bord); border-radius: 10px; background: rgba(255, 255, 255, 0.03); }
.eco-cartes small { color: var(--doux); font-size: 11px; }
.eco-cartes b { font-size: 17px; color: var(--or); font-weight: 600; }
.eco-cartes em { font-style: normal; color: var(--doux); font-size: 10.5px; }
.graphe-xp { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; height: 110px; align-items: end; padding: 6px 4px 0; }
.graphe-xp .jour { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.graphe-xp .jour i { display: block; width: 100%; max-width: 34px; border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg, var(--or), rgba(242, 193, 78, 0.35)); }
.graphe-xp small { color: var(--doux); font-size: 10.5px; }
.ameliorations { display: grid; gap: 5px; }
.amelioration { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; font-size: 12.5px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--bord); color: var(--doux); }
.amelioration.fait { color: #9ff5c4; border-color: rgba(61, 220, 132, 0.35); }
.amelioration.suivante { color: var(--texte); border-color: rgba(242, 193, 78, 0.5); }
.amelioration .barre-stat { grid-column: 1 / -1; margin-top: 2px; }
.table-classement { overflow-x: auto; }
.table-classement table { width: 100%; border-collapse: collapse; font-size: 12px; }
.table-classement th { text-align: left; color: var(--doux); font-weight: 500; font-size: 11px; padding: 4px 6px; border-bottom: 1px solid var(--bord); }
.table-classement td { padding: 5px 6px; border-bottom: 1px solid var(--bord); white-space: nowrap; }
.table-classement td small { color: var(--doux); font-size: 10px; }
.table-classement tbody tr { cursor: pointer; }
.table-classement tbody tr:hover td { color: var(--or); }
.org-carte.maire { border-color: rgba(242, 193, 78, 0.6); background: rgba(242, 193, 78, 0.1); }

/* Personnaliser : figurants existants */
.liste-figurants { display: flex; flex-wrap: wrap; gap: 5px; margin: 4px 0 12px; }
.liste-figurants .chip { display: inline-flex; align-items: center; gap: 6px; }
.liste-figurants .chip small { color: var(--doux); font-size: 10.5px; }
.choix button[disabled] { opacity: 0.5; cursor: not-allowed; }

/* Fil : lignes de l'économie */
.evt.eco { color: #e3d9bd; }
.evt .ico-eco { margin-right: 2px; }
.evt.eco.t-decret, .evt.eco.t-election { color: #ffe7ad; }

@media (max-width: 900px) {
  .hud { gap: 5px; font-size: 11px; }
  .hud .puce { padding: 2px 8px; font-size: 11px; }
  .bandeau-decret { font-size: 11px; max-width: 100%; }
}

/* ---------- v4 : balade ---------- */
.balade-hud { position: fixed; inset: 0; z-index: 8; pointer-events: none; }
.balade-hud[hidden] { display: none; }
.balade-hud > * { pointer-events: auto; }
body.en-balade .colonne, body.en-balade .aide { display: none; }
body.en-balade.souris-verrouillee #scene { cursor: none; }
.aide b { color: rgba(242, 193, 78, 0.8); font-weight: 600; }
.balade-aide { position: fixed; bottom: 46px; left: 50%; transform: translateX(-50%); font-size: 11.5px; color: rgba(210, 216, 230, 0.7); white-space: nowrap; pointer-events: none; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8); }
.balade-aide b { color: var(--or); font-weight: 600; }
.balade-invite { position: fixed; bottom: 92px; left: 50%; transform: translateX(-50%); padding: 9px 18px 9px 10px; border-radius: 999px; background: rgba(9, 12, 24, 0.86); border: 1px solid rgba(242, 193, 78, 0.6); color: var(--texte); font-size: 14px; display: flex; align-items: center; gap: 10px; cursor: pointer; box-shadow: 0 8px 26px rgba(0, 0, 0, 0.45); backdrop-filter: blur(8px); animation: invite 0.18s ease-out; }
.balade-invite[hidden] { display: none; }
.balade-invite b { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--or); color: #17130a; font-family: var(--mono); font-size: 13px; }
@keyframes invite { from { transform: translate(-50%, 6px); opacity: 0; } }
.balade-lieu { position: fixed; top: 118px; left: 50%; transform: translateX(-50%); padding: 8px 18px; border-radius: 999px; background: rgba(242, 193, 78, 0.92); color: #17130a; font-weight: 700; font-size: 14px; letter-spacing: 0.02em; pointer-events: none; box-shadow: 0 8px 26px rgba(0, 0, 0, 0.35); }
.balade-lieu[hidden] { display: none; }
.balade-lieu.montre { animation: annonce 2.6s ease-out forwards; }
@keyframes annonce { 0% { opacity: 0; transform: translate(-50%, -8px); } 10%, 80% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }
.balade-carte { position: fixed; right: 16px; bottom: 50px; width: 180px; height: 180px; border-radius: 50%; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); pointer-events: none; }
.balade-quitter { position: fixed; right: 16px; bottom: 240px; font-size: 12px; padding: 6px 12px; }
.balade-joystick, .balade-e { display: none; }
.balade-hud.tactile .balade-joystick { display: block; position: fixed; left: 22px; bottom: 64px; width: 128px; height: 128px; border-radius: 50%; background: rgba(9, 12, 24, 0.45); border: 1px solid rgba(242, 193, 78, 0.45); touch-action: none; backdrop-filter: blur(6px); }
.balade-joystick i { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffe08a, var(--or)); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45); }
.balade-hud.tactile .balade-e { display: grid; place-items: center; position: fixed; right: 26px; bottom: 196px; width: 70px; height: 70px; border-radius: 50%; border: 2px solid var(--or); background: rgba(9, 12, 24, 0.7); color: var(--or); font: 700 24px var(--mono); touch-action: manipulation; backdrop-filter: blur(6px); }
.balade-hud.tactile .balade-aide { display: none; }
.balade-hud.tactile .balade-carte { width: 124px; height: 124px; bottom: 56px; right: 14px; }
.balade-hud.tactile .balade-quitter { top: auto; bottom: 280px; right: 14px; }
.balade-hud.tactile .balade-invite { bottom: 206px; }
body.en-balade .etiquette-agent.toi .nom { border-color: var(--or); color: var(--or); box-shadow: 0 0 12px rgba(242, 193, 78, 0.45); }
body.en-interieur .etiquette-lieu { opacity: 0.35; }

/* Bulle de dialogue (au-dessus de l'habitant) */
.balade-bulle { position: fixed; z-index: 12; left: 50%; top: 30%; width: min(370px, calc(100vw - 24px)); padding: 14px 16px 12px; border-radius: 16px; background: rgba(12, 16, 32, 0.94); border: 1px solid rgba(242, 193, 78, 0.5); box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55); backdrop-filter: blur(12px); }
.balade-bulle[hidden] { display: none; }
.balade-bulle::after { content: ''; position: absolute; left: 50%; bottom: -9px; width: 16px; height: 16px; margin-left: -8px; transform: rotate(45deg); background: rgba(12, 16, 32, 0.94); border-right: 1px solid rgba(242, 193, 78, 0.5); border-bottom: 1px solid rgba(242, 193, 78, 0.5); }
.balade-bulle.bas { left: 12px !important; right: 12px; top: auto !important; bottom: 300px; width: auto; }
.balade-bulle.bas::after { display: none; }
.balade-bulle .qui { display: flex; align-items: center; gap: 8px; font-size: 16px; padding-right: 26px; }
.balade-bulle .qui i { width: 10px; height: 10px; border-radius: 3px; }
.balade-bulle .pastille { margin-left: auto; font: 600 10px var(--mono); padding: 2px 8px; border-radius: 999px; background: rgba(255, 193, 69, 0.16); color: var(--jaune); white-space: nowrap; }
.balade-bulle .pastille.st-working { background: rgba(61, 220, 132, 0.15); color: var(--vert); }
.balade-bulle .pastille.st-waiting { background: rgba(255, 77, 109, 0.16); color: #ff8aa0; }
.balade-bulle .sous { font-size: 10.5px; color: var(--doux); margin-top: 2px; }
.balade-bulle .replique { margin: 10px 0 10px; font-size: 15px; line-height: 1.45; min-height: 22px; color: #f3f5fb; }
.balade-bulle .gains { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 11.5px; color: var(--doux); margin: -2px 0 10px; }
.balade-bulle .gains .barre-xp { width: 100%; margin: 0 0 4px; }
.balade-bulle .gains b { color: var(--or); }
.balade-bulle .choix { display: grid; gap: 5px; }
.balade-bulle .choix button { display: flex; align-items: center; gap: 8px; text-align: left; padding: 7px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--bord); font-size: 13px; transition: border-color 0.15s, background 0.15s; }
.balade-bulle .choix button:hover { border-color: rgba(242, 193, 78, 0.6); background: rgba(242, 193, 78, 0.08); }
.balade-bulle .choix button.discret { color: var(--doux); font-size: 12px; }
.balade-bulle kbd { font: 600 10.5px var(--mono); padding: 1px 6px; border-radius: 5px; background: rgba(242, 193, 78, 0.15); color: var(--or); border: 1px solid rgba(242, 193, 78, 0.35); }
.flottant.coeur span, .flottant.coeur b { color: #ffb3cb; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 0 10px rgba(255, 107, 154, 0.6); }
@media (max-width: 900px) {
  #btn-balade { order: -1; }
  .balade-hud .balade-lieu { top: 150px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .balade-invite, .balade-lieu.montre { animation: none; }
}

/* ---------- v4 vague 2 : sports, fonctions et salaires, discours, fête ---------- */
.ligne.sport small, .ligne span small { color: var(--doux); font-size: 10.5px; margin-left: 4px; }
.ligne.sport.ferme { opacity: 0.55; }
.ligne.sport.ferme .ico { color: var(--gris); }
.parties li span { font-size: 11px; }
.recettes { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--doux); margin: 4px 0 8px; }
.recettes b { color: var(--or); font-weight: 600; margin-left: 4px; }
.badge.sport { background: rgba(90, 176, 255, 0.1); border-color: rgba(90, 176, 255, 0.4); color: #bfe0ff; }
.badge.sport.a-gagner { background: none; border-style: dashed; border-color: var(--bord); color: var(--doux); }
.badge small { font-family: var(--mono); font-size: 10px; opacity: 0.8; }
.org-nom small.fonction { color: #e6d39c; }

/* Mairie › Fonctions & salaires : tableau éditable (depuis ce Mac) */
.table-fonctions td { vertical-align: middle; }
.table-fonctions td.titre { min-width: 150px; }
.table-fonctions input { width: 100%; min-width: 0; box-sizing: border-box; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--bord); border-radius: 7px; color: var(--texte); padding: 5px 7px; font: inherit; font-size: 12px; }
.table-fonctions input[type="number"] { width: 64px; font-family: var(--mono); }
.table-fonctions input:focus { outline: none; border-color: var(--or); background: rgba(242, 193, 78, 0.08); }
.table-fonctions td small { color: var(--doux); font-size: 10px; }

/* HUD : fête de quartier et discours du maire */
.bandeau-fete, .bandeau-discours { display: inline-flex; align-items: center; gap: 8px; max-width: min(420px, 100%); padding: 4px 12px; border-radius: 999px; font-size: 12px; }
.bandeau-fete { border: 1px solid rgba(255, 107, 214, 0.65); background: linear-gradient(90deg, rgba(255, 107, 214, 0.25), rgba(90, 176, 255, 0.18)); color: #ffe1f6; animation: fete-lueur 1.6s ease-in-out infinite; }
.bandeau-fete b { color: #ff9be4; white-space: nowrap; }
.bandeau-fete span, .bandeau-discours span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bandeau-discours { border: 1px solid rgba(242, 193, 78, 0.6); background: rgba(242, 193, 78, 0.14); color: #ffe7ad; }
.bandeau-discours b { color: var(--or); white-space: nowrap; }
@keyframes fete-lueur { 0%, 100% { box-shadow: 0 0 0 rgba(255, 107, 214, 0); } 50% { box-shadow: 0 0 16px rgba(255, 107, 214, 0.55); } }
.etiquette-lieu.fete { animation: fete-etiquette 0.9s ease-in-out infinite alternate; }
@keyframes fete-etiquette { from { filter: drop-shadow(0 0 4px rgba(255, 107, 214, 0.8)); } to { filter: drop-shadow(0 0 12px rgba(90, 176, 255, 0.9)) hue-rotate(60deg); } }

/* Bulle du discours (au-dessus du maire, sur le parvis) */
.bulle-discours { pointer-events: none; display: flex; flex-direction: column; gap: 4px; width: 250px; padding: 9px 12px; border-radius: 14px; background: rgba(255, 248, 228, 0.96); color: #2a2110; font-size: 11.5px; line-height: 1.4; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); transform: translateY(-50%); animation: discours-entre 0.35s ease-out; }
.bulle-discours b { font-size: 12.5px; color: #8a5a00; }
.bulle-discours span { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; font-style: italic; }
@keyframes discours-entre { from { opacity: 0; transform: translateY(-40%) scale(0.92); } }

@media (max-width: 900px) {
  .bandeau-fete, .bandeau-discours { font-size: 11px; max-width: 100%; }
  .bulle-discours { width: 190px; font-size: 10.5px; }
  .table-fonctions td.titre { min-width: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  .bandeau-fete, .etiquette-lieu.fete, .bulle-discours { animation: none; }
}

/* ---------- v5 : pilote automatique ---------- */
/* HUD : jauge du réservoir (barre = ce qui reste, repère doré = objectif), tâches du jour, badge de nuit */
.hud .puce.jauge-pilote { --zone: var(--vert); gap: 8px; border-color: color-mix(in srgb, var(--zone) 55%, transparent); background: color-mix(in srgb, var(--zone) 10%, rgba(10, 14, 28, 0.62)); }
.hud .puce.jauge-pilote .lib { font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--doux); }
.hud .puce.jauge-pilote b { color: var(--zone); min-width: 2.4em; text-align: right; font-family: var(--mono); }
.hud .puce.jauge-pilote em { font-style: normal; font-size: 10.5px; color: var(--zone); text-transform: uppercase; letter-spacing: 0.08em; }
.barre-reservoir { position: relative; width: 96px; height: 9px; border-radius: 5px; background: rgba(255, 255, 255, 0.1); overflow: visible; }
.barre-reservoir .rempli { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; background: linear-gradient(90deg, color-mix(in srgb, var(--zone) 55%, #000), var(--zone)); box-shadow: 0 0 10px color-mix(in srgb, var(--zone) 70%, transparent); transition: width 0.8s ease; }
.barre-reservoir .cible { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; border-radius: 1px; background: #fff3c4; box-shadow: 0 0 6px rgba(255, 243, 196, 0.9); }
.hud .puce.badge-nuit { border-color: rgba(169, 155, 255, 0.6); background: rgba(90, 70, 190, 0.28); color: #d9d2ff; animation: lueur-nuit 3.2s ease-in-out infinite; }
.hud .puce.badge-nuit b { color: #c7bcff; }
@keyframes lueur-nuit { 50% { box-shadow: 0 0 16px rgba(169, 155, 255, 0.45); } }

/* Bouton « Je pars dormir » / « Je suis là » */
.bouton-nuit[hidden] { display: none; }
.bouton-nuit { border-color: rgba(169, 155, 255, 0.5); color: #cfc6ff; }
.bouton-nuit:hover { border-color: #b9aeff; background: rgba(169, 155, 255, 0.14); }
.bouton-nuit.actif { background: linear-gradient(135deg, #ffd36b, #ffb15c); border-color: #ffd36b; color: #1d1405; }
.lune, .lune-anim { display: inline-block; color: #bfb3ff; text-shadow: 0 0 10px rgba(169, 155, 255, 0.8); }
.soleil { display: inline-block; color: #ffb43a; }
.bouton-nuit.actif .soleil { color: #7a3d00; }

/* Bandeau et ambiance de nuit */
.bandeau-nuit { position: fixed; z-index: 11; left: 50%; bottom: 48px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; max-width: min(640px, calc(100vw - 24px)); padding: 9px 18px; border-radius: 999px; border: 1px solid rgba(169, 155, 255, 0.6); background: linear-gradient(90deg, rgba(48, 36, 110, 0.9), rgba(24, 20, 64, 0.9)); backdrop-filter: blur(10px); box-shadow: 0 10px 32px rgba(10, 6, 40, 0.6), 0 0 22px rgba(130, 110, 255, 0.35); color: #e5e0ff; font-size: 13px; cursor: pointer; }
.bandeau-nuit[hidden] { display: none; }
.bandeau-nuit b { color: #fff; font-weight: 600; white-space: nowrap; }
.bandeau-nuit span:not(.lune-anim) { color: #b9b0e8; font-family: var(--mono); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lune-anim { font-size: 20px; animation: lune-flotte 4s ease-in-out infinite; }
@keyframes lune-flotte { 50% { transform: translateY(-3px) rotate(-8deg); } }
body.equipe-nuit .aide { display: none; }
body.equipe-nuit::after { content: ''; position: fixed; inset: 0; z-index: 4; pointer-events: none; box-shadow: inset 0 0 180px rgba(96, 74, 220, 0.28); }

/* Étiquettes dans la scène : décision du pilote, apprentis */
.etiquette-decision { pointer-events: none; font-family: var(--mono); font-size: 11.5px; font-weight: 600; white-space: nowrap; color: #fff; padding: 4px 11px; border-radius: 999px; background: rgba(6, 8, 18, 0.88); border: 1px solid var(--or); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45); }
.etiquette-apprenti { pointer-events: none; display: flex; flex-direction: column; align-items: center; padding-bottom: 34px; }
.etiquette-apprenti .pill { display: flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 9.5px; color: #fff; white-space: nowrap; background: rgba(6, 8, 18, 0.82); border: 1px solid rgba(255, 255, 255, 0.16); padding: 2px 7px; border-radius: 999px; }
.etiquette-apprenti .pill i { width: 6px; height: 6px; border-radius: 2px; flex: none; }
.etiquette-apprenti .pill b { font-weight: 600; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.etiquette-apprenti .pill span { color: var(--or); max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
body.loin .etiquette-apprenti .pill span { display: none; }
body.loin .etiquette-apprenti { display: none; }
.decisions-fiche li { gap: 8px; }
.decisions-fiche li span { margin-left: auto; color: var(--doux); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%; }

/* Mairie › Pilote */
.pilote-vue h3 { font-size: 10.5px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--or); margin: 20px 0 8px; font-weight: 600; }
.pilote-vue h3:first-child { margin-top: 0; }
.reservoir-carte { --zone: var(--vert); display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 16px; padding: 14px 16px; border: 1px solid var(--bord); border-radius: 14px; background: radial-gradient(circle at 12% 10%, color-mix(in srgb, var(--zone) 14%, transparent), transparent 60%), rgba(255, 255, 255, 0.025); box-shadow: 0 0 34px -14px var(--zone); }
.cuve-svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 0 12px color-mix(in srgb, var(--zone) 40%, transparent)); }
.cuve-pct { font: 700 27px 'Space Grotesk', system-ui, sans-serif; fill: #fff; paint-order: stroke; stroke: rgba(0, 0, 0, 0.35); stroke-width: 3px; }
.cuve-u { font-size: 13px; }
.cuve-obj { font: 600 9px var(--mono); }
.zone-pastille { display: inline-block; padding: 2px 12px; border-radius: 999px; background: var(--zone); color: #0b0e17; font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 10px; }
.zone-pastille b { font-weight: 800; }
.reservoir-infos dl { grid-template-columns: 104px 1fr; margin-bottom: 8px; }
.reservoir-infos dd b { color: var(--zone); font-size: 14px; }
.reservoir-infos .vert { color: var(--vert); }
.reservoir-infos .orange { color: #ffab40; }
.conseil { margin: 0; font-size: 12.5px; line-height: 1.5; color: #c9d0de; padding-left: 10px; border-left: 2px solid var(--zone); }
.courbe-carte { border: 1px solid var(--bord); border-radius: 12px; padding: 10px 10px 8px; background: rgba(255, 255, 255, 0.02); }
.courbe-svg { width: 100%; height: auto; display: block; }
.courbe-svg .grille { stroke: rgba(255, 255, 255, 0.07); stroke-width: 1; }
.courbe-svg .axe { fill: var(--doux); font: 10px var(--mono); }
.courbe-svg .cible-txt { fill: #fff3c4; opacity: 0.8; }
.courbe-svg .ligne-cible { stroke: #fff3c4; stroke-width: 1.7; stroke-dasharray: 6 4; opacity: 0.9; }
.courbe-svg .reel { fill: none; stroke-width: 2.8; stroke-linejoin: round; stroke-linecap: round; filter: drop-shadow(0 0 4px currentColor); }
.courbe-svg .proj { stroke-width: 1.8; stroke-dasharray: 1.5 6; stroke-linecap: round; opacity: 0.85; }
.courbe-svg .avant { stroke: rgba(255, 255, 255, 0.3); stroke-width: 1.4; stroke-dasharray: 3 4; }
.courbe-svg .maintenant { stroke: rgba(255, 255, 255, 0.25); stroke-width: 1; }
.courbe-svg .valeur { font: 700 12px var(--mono); }
.legende-courbe { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 11px; color: var(--doux); padding: 4px 4px 0; }
.legende-courbe i { display: inline-block; vertical-align: middle; margin-right: 6px; }
.legende-courbe .l-reel { width: 18px; height: 3px; border-radius: 2px; }
.legende-courbe .l-cible { width: 18px; height: 0; border-top: 2px dashed #fff3c4; }
.legende-courbe .l-bande { width: 14px; height: 9px; border-radius: 2px; background: rgba(61, 220, 132, 0.25); }
.legende-courbe .proj-txt { margin-left: auto; color: #c9d0de; }
.recalibrer { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; }
.recalibrer .champ { margin-bottom: 0; }
.recalibrer .champ > span { min-height: 2.6em; align-items: flex-end; }
.recalibrer button { height: 38px; margin-bottom: 0; }
.abos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.abo { border: 1px solid var(--bord); border-radius: 10px; padding: 10px 12px; background: rgba(255, 255, 255, 0.025); font-size: 12px; }
.abo.ok { border-color: rgba(61, 220, 132, 0.4); }
.abo.a-brancher { border-color: rgba(255, 171, 64, 0.4); }
.abo.local { border-color: rgba(90, 176, 255, 0.35); }
.abo.app { border-color: rgba(66, 133, 244, 0.4); }
.abo.app .pastille-etat { background: rgba(66, 133, 244, 0.18); color: #9cc2ff; }
.abo header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.abo header b { font-weight: 600; font-size: 13px; }
.pastille-etat { margin-left: auto; font-size: 10px; padding: 1px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.06em; background: rgba(255, 255, 255, 0.08); color: var(--doux); }
.abo.ok .pastille-etat { background: rgba(61, 220, 132, 0.18); color: #7df0b0; }
.abo.a-brancher .pastille-etat { background: rgba(255, 171, 64, 0.18); color: #ffc780; }
.abo.local .pastille-etat { background: rgba(90, 176, 255, 0.18); color: #9fd0ff; }
.abo p { margin: 0 0 6px; color: #b9c1d3; line-height: 1.45; }
.abo .commande code { font-size: 10.5px; padding: 6px 8px; }
.abo .copier { padding: 0 8px; font-size: 11px; }
.tokens-barres { display: grid; gap: 6px; font-size: 12px; }
.tokens-barres > div { display: grid; grid-template-columns: 150px 1fr 54px; gap: 10px; align-items: center; }
.tokens-barres > div > span { color: #c9d0de; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tokens-barres b { text-align: right; color: var(--texte); font-size: 11px; }
.tokens-barres .barre-stat { margin-top: 0; }
.regle-ligne { display: grid; grid-template-columns: 10px 54px 1fr; gap: 8px; align-items: center; margin-bottom: 6px; font-size: 12px; color: var(--doux); }
.regle-ligne i { width: 10px; height: 10px; border-radius: 50%; }
.regle-ligne input { font-family: var(--mono); font-size: 12px; width: 100%; }
.regle-ligne input[disabled] { opacity: 0.6; }
.decisions { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.decisions li { display: grid; grid-template-columns: 40px 11px 1fr; gap: 8px; align-items: start; padding: 8px 0; border-top: 1px solid var(--bord); }
.decisions li .h { color: var(--doux); font-size: 11px; padding-top: 1px; }
.decisions li .carre { margin-top: 3px; }
.decisions li b { font-weight: 600; }
.decisions li small { color: var(--doux); font-size: 11px; }
.decisions li em { font-style: normal; font-size: 10.5px; color: #f3dc9c; background: rgba(242, 193, 78, 0.1); border-radius: 999px; padding: 1px 8px; margin-left: 4px; }
.decisions li p { margin: 2px 0 2px; color: #d6dbe7; line-height: 1.4; overflow-wrap: anywhere; }
.zone-pt { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: 1px; margin-left: 4px; box-shadow: 0 0 8px currentColor; }
.carte-nuit { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--bord); background: rgba(255, 255, 255, 0.025); }
.carte-nuit.actif { border-color: rgba(169, 155, 255, 0.6); background: rgba(90, 70, 190, 0.18); }
.carte-nuit > div { flex: 1; display: flex; flex-direction: column; min-width: 160px; }
.carte-nuit small { color: var(--doux); font-size: 11.5px; }
/* Mairie › Chantiers */
.chantier { border: 1px solid var(--bord); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; background: rgba(255, 255, 255, 0.025); }
.chantier.en-cours { border-color: rgba(94, 240, 255, 0.45); box-shadow: 0 0 22px -12px #5ef0ff; }
.chantier header { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.chantier header b { font-size: 14.5px; }
.chantier header .st { font-size: 10.5px; padding: 1px 9px; border-radius: 999px; background: rgba(94, 240, 255, 0.15); color: #8ff3ff; text-transform: uppercase; letter-spacing: 0.06em; }
.chantier.fini header .st { background: rgba(61, 220, 132, 0.15); color: #7df0b0; }
.chantier header small { margin-left: auto; color: var(--doux); font-size: 11px; }
.progression { display: grid; grid-template-columns: 1fr 44px; gap: 10px; align-items: center; margin: 8px 0; }
.progression .barre-stat { margin-top: 0; height: 8px; }
.progression b { font-size: 11.5px; color: var(--texte); text-align: right; }
.phases { list-style: none; counter-reset: ph; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 5px; }
.phases li { counter-increment: ph; display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--bord); color: var(--doux); }
.phases li::before { content: counter(ph); font: 600 10px var(--mono); opacity: 0.7; }
.phases li small { font: 10px var(--mono); opacity: 0.8; }
.phases li.fait { color: #7df0b0; border-color: rgba(61, 220, 132, 0.4); background: rgba(61, 220, 132, 0.08); }
.phases li.en-cours { color: #1d1405; background: #ffdd40; border-color: #ffdd40; font-weight: 600; box-shadow: 0 0 14px rgba(255, 221, 64, 0.4); }
.agents-chantier { display: flex; flex-wrap: wrap; gap: 5px; font-size: 11px; }
.agents-chantier span { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 8px; background: rgba(255, 255, 255, 0.05); color: #c9d0de; }
.agents-chantier span.fini { opacity: 0.55; }
.table-apprentis td.desc { white-space: normal; min-width: 170px; }
.table-apprentis td.desc small { display: block; color: var(--doux); font-size: 10.5px; }
.table-apprentis tr.fini td { opacity: 0.5; }
.table-apprentis tbody tr { cursor: default; }
.table-apprentis tbody tr:hover td { color: inherit; }
/* Formulaire de mission : Auto (pilote) */
.bloc-auto { margin-top: 10px; padding: 10px 12px; border-radius: 10px; border: 1px dashed rgba(242, 193, 78, 0.4); background: rgba(242, 193, 78, 0.04); }
.bloc-auto[hidden] { display: none; }
.bloc-auto .ligne-form { margin-top: 0; }
.bloc-auto .interrupteur-champ { border-bottom: none; padding: 4px 0 8px; }
.devis { font-size: 12.5px; padding: 9px 12px; border-radius: 8px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--bord); min-height: 46px; }
.devis.dans-dialogue { margin: 8px 0; }
.devis-ligne { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.devis-ligne b { font-weight: 600; }
.devis-ligne .cout { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: #9ff5c4; }
.devis small { display: block; color: var(--doux); margin-top: 3px; font-size: 11px; }
.ligne-pilote { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: 10.5px; color: var(--doux); margin: 0 0 6px; }
.ligne-pilote b { color: var(--or); font-weight: 600; }
.puce-nuit { color: #bfb3ff; font-size: 13px; }
/* Dialogues : nuit et rapport */
#nuit-dialog h2, #rapport-nuit h2 { display: flex; align-items: center; gap: 10px; }
.titre-charte { font-size: 10.5px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--or); margin: 16px 0 6px; font-weight: 600; }
.charte, .file-nuit { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.55; color: #c9d0de; }
.charte li, .file-nuit li { margin-bottom: 3px; }
.charte b { color: var(--texte); }
#rapport-nuit h3 { font-size: 10.5px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--or); margin: 16px 0 8px; font-weight: 600; }
.missions-nuit { display: grid; gap: 8px; max-height: 38vh; overflow: auto; }
.mission-nuit { border: 1px solid var(--bord); border-radius: 10px; padding: 9px 12px; background: rgba(255, 255, 255, 0.03); font-size: 12.5px; }
.mission-nuit.ok { border-color: rgba(61, 220, 132, 0.4); }
.mission-nuit.erreur { border-color: rgba(255, 77, 109, 0.5); }
.mission-nuit header { display: flex; align-items: center; gap: 8px; }
.mission-nuit header small { color: var(--doux); }
.mission-nuit header .st { margin-left: auto; font-size: 10.5px; color: var(--doux); }
.mission-nuit.ok .st { color: var(--vert); }
.mission-nuit.erreur .st { color: var(--rouge); }
.mission-nuit p { margin: 6px 0 0; line-height: 1.4; }
.mission-nuit pre { margin: 6px 0 0; padding: 6px 8px; background: rgba(0, 0, 0, 0.35); border-radius: 6px; font: 10.5px/1.45 var(--mono); color: #aab3c7; white-space: pre-wrap; overflow-wrap: anywhere; }
.challenge { display: grid; gap: 6px; font-size: 12px; }
.challenge > div { display: grid; grid-template-columns: 150px 1fr 54px; gap: 10px; align-items: center; }
.challenge .barre-stat { margin-top: 0; }
.challenge b { text-align: right; font-family: var(--mono); font-size: 11px; }
@media (max-width: 900px) {
  .reservoir-carte { grid-template-columns: 1fr; }
  .cuve-svg { max-width: 130px; margin: 0 auto; }
  .recalibrer { grid-template-columns: 1fr; }
  .abos { grid-template-columns: 1fr; }
  .barre-reservoir { width: 64px; }
  .tokens-barres > div, .challenge > div { grid-template-columns: 100px 1fr 48px; }
  .bandeau-nuit { bottom: 90px; flex-wrap: wrap; border-radius: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .hud .puce.badge-nuit, .lune-anim { animation: none; }
  .barre-reservoir .rempli { transition: none; }
}

.courbe-svg .calib { fill: #0c1020; stroke: #fff3c4; stroke-width: 1.6; }
.aide-abo { margin: 4px 0 0 !important; font-size: 10.5px; color: var(--doux) !important; }

.abo-infos { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 8px 0 0; font-size: 12.5px; }
.abo-infos dt { color: var(--doux); }
.abo-infos dd { margin: 0; }

/* ---------- v6 : conduite, concession, garage ---------- */
.balade-aide .ba-voiture { display: none; }
body.en-conduite .balade-aide .ba-pied { display: none; }
body.en-conduite .balade-aide .ba-voiture { display: inline; }
.balade-garage { position: fixed; right: 16px; bottom: 276px; font-size: 12px; padding: 6px 12px; }
.balade-hud.tactile .balade-garage { top: auto; bottom: 318px; right: 14px; }
.conduite { pointer-events: none; }
.conduite > * { pointer-events: auto; }
.ct-tableau { position: fixed; left: 18px; bottom: 56px; min-width: 214px; padding: 11px 16px 12px; border-radius: 16px; background: rgba(9, 12, 24, 0.8); border: 1px solid rgba(242, 193, 78, 0.45); backdrop-filter: blur(10px); box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5); pointer-events: none; }
.ct-tableau[hidden], .ct-chrono[hidden], .ct-essai[hidden], .ct-fiche[hidden] { display: none; }
.ct-nom { font-size: 12.5px; color: var(--texte); letter-spacing: 0.03em; }
.ct-nom small { margin-left: 6px; font: 600 10px var(--mono); color: var(--or); letter-spacing: 0.12em; }
.ct-ligne { display: flex; align-items: flex-end; gap: 14px; margin-top: 2px; }
.ct-vitesse b { font: 700 54px/1 var(--mono); color: #fff; letter-spacing: -0.02em; }
.ct-vitesse span { color: var(--doux); font-size: 12px; margin-left: 5px; }
.ct-rapport { width: 40px; height: 40px; margin-bottom: 4px; border-radius: 10px; display: grid; place-items: center; background: var(--or); color: #17130a; font-weight: 700; font-size: 21px; }
.ct-regime { height: 6px; margin-top: 9px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.ct-regime i { display: block; width: 0; height: 100%; background: linear-gradient(90deg, #3ddc84, #ffc145 70%, #ff4d6d); }
.ct-regime.rouge { box-shadow: 0 0 10px rgba(255, 77, 109, 0.6); }
.ct-voyants { display: flex; gap: 12px; margin-top: 9px; font-size: 9.5px; letter-spacing: 0.14em; }
.ct-voyants span { color: rgba(255, 255, 255, 0.2); }
.ct-voyants .ct-v-phares.on { color: #bfe9ff; }
.ct-voyants .ct-v-main.on { color: var(--rouge); }
.ct-chrono { position: fixed; top: 150px; left: 50%; transform: translateX(-50%); display: flex; align-items: baseline; gap: 12px; padding: 7px 18px; border-radius: 999px; background: rgba(9, 12, 24, 0.84); border: 1px solid rgba(255, 213, 74, 0.7); pointer-events: none; white-space: nowrap; }
.ct-chrono span { font-size: 12px; color: #ffd54a; letter-spacing: 0.08em; text-transform: uppercase; }
.ct-chrono b { font: 700 24px var(--mono); color: #fff; }
.ct-chrono small { font: 500 11px var(--mono); color: var(--doux); }
.ct-essai { position: fixed; top: 196px; left: 50%; transform: translateX(-50%); padding: 6px 16px; border-radius: 999px; background: rgba(242, 193, 78, 0.92); color: #17130a; font-weight: 600; font-size: 13px; pointer-events: none; white-space: nowrap; }
.ct-essai b { font-family: var(--mono); margin-left: 8px; }
.ct-boutons { display: none; }
.balade-hud.tactile.en-conduite .ct-boutons { display: flex; flex-direction: column; gap: 8px; position: fixed; right: 14px; bottom: 190px; }
.ct-boutons button { width: 74px; height: 40px; border-radius: 12px; border: 1px solid rgba(242, 193, 78, 0.6); background: rgba(9, 12, 24, 0.72); color: var(--or); font-size: 13px; font-weight: 600; touch-action: manipulation; backdrop-filter: blur(6px); }
.ct-boutons button:active, .ct-boutons .ct-b-main:active { background: var(--or); color: #17130a; }
.balade-hud.tactile.en-conduite .balade-e, .balade-hud.tactile.en-conduite .balade-quitter, .balade-hud.tactile.en-conduite .balade-garage { display: none; }
/* Mobile : la barre du haut occupe jusqu'à 320 px, le tableau de bord passe au-dessus du joystick */
.balade-hud.tactile .ct-tableau { bottom: 204px; left: 10px; min-width: 150px; padding: 7px 11px 8px; }
.balade-hud.tactile .ct-vitesse b { font-size: 34px; }
.balade-hud.tactile .ct-rapport { width: 30px; height: 30px; font-size: 16px; }
.balade-hud.tactile .ct-voyants { display: none; }
.balade-hud.tactile .ct-chrono { top: auto; bottom: 300px; left: 10px; transform: none; padding: 5px 12px; }
.balade-hud.tactile .ct-chrono b { font-size: 18px; }
.balade-hud.tactile .ct-chrono small { display: none; }
.balade-hud.tactile .ct-essai { top: auto; bottom: 342px; left: 10px; transform: none; }
.balade-hud.tactile .ct-fiche { bottom: 204px; }
.balade-hud.tactile .balade-lieu { top: 334px; }
/* Fiche d'un modèle de la concession */
.ct-fiche { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); width: min(410px, calc(100vw - 24px)); padding: 14px 16px 14px; border-radius: 16px; background: rgba(12, 16, 32, 0.95); border: 1px solid rgba(242, 193, 78, 0.55); box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55); backdrop-filter: blur(12px); animation: invite 0.18s ease-out; }
.ct-fiche .fermer { top: 8px; right: 10px; }
.cf-tete { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-right: 26px; }
.cf-tete b { font-size: 20px; }
.cf-variantes { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 2px; }
.cf-variantes button { padding: 6px 10px; border-radius: 999px; font-size: 12px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--bord); transition: border-color 0.15s, background 0.15s; }
.cf-variantes button:hover { border-color: rgba(242, 193, 78, 0.6); }
.cf-variantes button.actif { background: var(--or); color: #10131f; border-color: var(--or); font-weight: 600; }
.cf-variantes button small { font-weight: 400; opacity: 0.8; }
.cf-niv { font-size: 10.5px; letter-spacing: 0.14em; color: var(--or); border: 1px solid rgba(242, 193, 78, 0.45); padding: 1px 8px; border-radius: 999px; }
.cf-pastille { font: 600 10px var(--mono); padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.cf-pastille.ok { background: rgba(61, 220, 132, 0.15); color: var(--vert); }
.cf-pastille.bloque { background: rgba(255, 255, 255, 0.08); color: var(--doux); }
.cf-barre { display: grid; grid-template-columns: 92px 1fr 74px; gap: 9px; align-items: center; margin-top: 8px; font-size: 12px; color: var(--doux); }
.cf-barre > div { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.cf-barre i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #c98d1c, var(--or)); }
.cf-barre span { text-align: right; color: var(--texte); font-size: 11px; }
.cf-prix { display: flex; align-items: baseline; gap: 12px; margin-top: 13px; }
.cf-prix b { font-size: 24px; color: var(--or); }
.cf-prix small { color: var(--doux); font-size: 12px; }
.cf-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.cf-actions:empty { display: none; }
.cf-actions button { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px; border-radius: 11px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--bord); font-size: 13px; transition: border-color 0.15s, background 0.15s; }
.cf-actions button:hover:not(:disabled) { border-color: rgba(242, 193, 78, 0.7); background: rgba(242, 193, 78, 0.1); }
.cf-actions button:disabled { opacity: 0.4; cursor: not-allowed; }
.cf-actions .cf-principal { background: var(--or); color: #17130a; border-color: var(--or); font-weight: 600; }
.cf-actions .cf-principal:hover:not(:disabled) { background: #ffd36b; }
.cf-actions kbd { font: 600 10.5px var(--mono); padding: 1px 6px; border-radius: 5px; background: rgba(0, 0, 0, 0.18); border: 1px solid rgba(255, 255, 255, 0.25); }
.cf-note { margin: 9px 0 0; font-size: 12px; line-height: 1.5; color: var(--doux); }
/* Étiquettes au-dessus des modèles exposés */
.etiquette-modele { pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 5px 12px 6px; border-radius: 10px; background: rgba(8, 10, 20, 0.84); border: 1px solid rgba(255, 255, 255, 0.18); color: #fff; white-space: nowrap; }
.etiquette-modele b { font-size: 13px; }
.etiquette-modele small { font-size: 11px; font-weight: 600; color: #fff; opacity: 0.85; }
.etiquette-modele i { font: 600 9px var(--mono); font-style: normal; letter-spacing: 0.16em; color: var(--or); }
.etiquette-modele span { font-size: 11px; color: var(--doux); }
.etiquette-modele.achetable { border-color: var(--or); box-shadow: 0 0 16px rgba(242, 193, 78, 0.55); }
.etiquette-modele.achetable span { color: var(--or); }
.etiquette-modele.actif { border-color: var(--vert); }
.etiquette-modele.actif span, .etiquette-modele.possede span { color: var(--vert); }
.etiquette-modele.verrou, .etiquette-modele.maire { opacity: 0.7; }
.etiquette-modele.galerie { padding: 3px 10px 4px; background: rgba(8, 10, 20, 0.72); }
.etiquette-modele.galerie b { font-size: 12px; }
body.loin .etiquette-modele { display: none; }
/* Garage (fiche du joueur) */
dialog.garage { width: min(800px, calc(100vw - 24px)); }
dialog.garage .fermer { top: 14px; right: 16px; }
.g-resume { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; margin: 10px 0 14px; }
.g-resume > div { display: flex; flex-direction: column; padding: 9px 12px; border-radius: 11px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--bord); }
.g-resume span { font-size: 19px; color: var(--or); }
.g-resume small { color: var(--doux); font-size: 10.5px; margin-top: 1px; }
.g-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 8px; }
.g-carte { display: flex; flex-direction: column; gap: 3px; padding: 11px 13px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--bord); }
.g-carte.actif { border-color: var(--or); background: rgba(242, 193, 78, 0.1); }
.g-carte.verrou { opacity: 0.55; }
.g-carte b { font-size: 15px; }
.g-carte small { color: var(--doux); font-size: 11px; }
.g-niv { font-size: 10px; letter-spacing: 0.16em; color: var(--or); }
.g-act { margin-top: 7px; }
.g-note { margin: 14px 0 4px; color: var(--doux); font-size: 12.5px; line-height: 1.55; }
.g-note b { color: var(--texte); }
@media (prefers-reduced-motion: reduce) { .ct-fiche { animation: none; } }

/* ---------- v7 : Tout voir ---------- */
.bouton-tout-voir { order: -2; font-weight: 700; border-color: var(--or); background: rgba(242, 193, 78, 0.14); box-shadow: 0 0 16px rgba(242, 193, 78, 0.28); }
.bouton-tout-voir:hover { background: rgba(242, 193, 78, 0.26); }
.bouton-tout-voir kbd { font: 600 10.5px var(--mono); margin-left: 5px; padding: 0 5px; border-radius: 5px; border: 1px solid rgba(242, 193, 78, 0.55); color: var(--or); }
.bouton-tout-voir.actif kbd { color: #17130a; border-color: rgba(23, 19, 10, 0.5); }

@media (min-width: 901px) { #tout-voir { width: min(680px, calc(100vw - 24px)); } }
.tv-corps { overflow-x: hidden; overscroll-behavior: contain; font-size: 13px; }
.tv-corps > *, .tv-corps li, .tv-corps article { min-width: 0; }
.tv-recherche { padding: 10px 16px 0; }
.tv-recherche input {
  width: 100%; padding: 9px 12px 9px 34px; border-radius: 10px; font-size: 13.5px; -webkit-appearance: none; appearance: none;
  background: rgba(255, 255, 255, 0.05) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238e97ad' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 11px center;
}
.tv-recherche input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; height: 14px; width: 14px; cursor: pointer; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238e97ad' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E") center / contain no-repeat; }
.tv-badge { display: inline-block; min-width: 17px; margin-left: 5px; padding: 0 5px; border-radius: 999px; background: var(--vert); color: #06210f; font: 700 10.5px/17px var(--mono); text-align: center; vertical-align: 1px; }
.tv-badge[hidden] { display: none; }
#tout-voir .tiroir-pied { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.tv-lien-btn { background: none; border: none; padding: 0 2px; font: inherit; color: var(--or); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.tv-lien-btn:hover { color: #ffd36b; }
.tv-corps h3 b { color: var(--texte); letter-spacing: 0; margin-left: 6px; font-weight: 600; }
.tv-corps h3 small { letter-spacing: 0; text-transform: none; font-size: 11px; margin-left: 6px; }
.tv-doux { color: var(--doux); }
.tv-corps .note { margin: 4px 0 8px; }
.tv-corps .note.erreur { color: var(--rouge); }

/* Puces de filtre */
.tv-puces { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.tv-lib { color: var(--doux); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; margin-right: 2px; }
.tv-puce { display: inline-flex; align-items: center; gap: 6px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--bord); color: #cdd3e1; border-radius: 999px; padding: 3px 10px; font-size: 12px; }
.tv-puce b { color: var(--texte); font-weight: 600; font-size: 11px; }
button.tv-puce:hover { border-color: rgba(242, 193, 78, 0.55); }
.tv-puce.actif { background: rgba(242, 193, 78, 0.16); border-color: var(--or); color: var(--or); }
.tv-puce.actif b { color: var(--or); }
.tv-puce.fixe { cursor: default; padding: 2px 9px; }
.tv-puce[class*='tv-s-']::before, .tv-puce[class*='tv-e-']::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--gris)); box-shadow: 0 0 6px var(--c, transparent); }
.tv-tri { display: inline-flex; gap: 4px; margin-left: auto; }
.tv-compte { margin: 0 0 10px; font-size: 11.5px; color: var(--doux); display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; }
:is(button.tv-puce, .tv-carte, .tv-mini, .tv-lien-btn, .tv-retour):focus-visible { outline: 2px solid var(--or); outline-offset: 2px; }

/* Couleurs des statuts */
.tv-s-actif { --c: var(--vert); }
.tv-s-demarrage { --c: var(--bleu); }
.tv-s-en-pause { --c: var(--jaune); }
.tv-s-livre { --c: var(--or); }
.tv-s-abandonne { --c: #c0647a; }
.tv-s-inconnu { --c: var(--gris); }
.tv-statut { flex: none; align-self: flex-start; font: 600 10px var(--mono); text-transform: uppercase; letter-spacing: 0.08em; padding: 2px 8px; border-radius: 999px; white-space: nowrap; color: var(--c, var(--doux)); background: color-mix(in srgb, var(--c, var(--gris)) 14%, transparent); border: 1px solid color-mix(in srgb, var(--c, var(--gris)) 42%, transparent); }

/* Cartes et blocs */
.tv-grille { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tv-carte, .tv-outil, .tv-mission, .tv-bloc, .tv-reservoir { border: 1px solid var(--bord); border-radius: 12px; background: rgba(255, 255, 255, 0.03); }
.tv-carte { display: flex; flex-direction: column; gap: 7px; padding: 12px 13px; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.tv-carte:hover { border-color: rgba(242, 193, 78, 0.5); background: rgba(242, 193, 78, 0.045); }
.tv-carte header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.tv-carte header b { font-size: 14px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.tv-meta { color: var(--doux); font-size: 11px; line-height: 1.45; overflow-wrap: anywhere; }
.tv-resume { margin: 0; font-size: 12px; line-height: 1.5; color: #b9c1d3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.tv-resume.plein { display: block; font-size: 13px; line-height: 1.6; margin: 8px 0; }
.tv-chaleur { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.tv-chaleur i { display: block; height: 100%; border-radius: 2px; background: linear-gradient(90deg, #c98d1c, var(--or)); box-shadow: 0 0 8px rgba(242, 193, 78, 0.5); }
.tv-chaleur.gros { height: 6px; margin: 8px 0; }
.tv-liens { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 11.5px; }
.tv-plus { color: var(--doux); font: 11px var(--mono); }
.tv-lien { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 1px 7px; border-radius: 6px; color: #9fd0ff; background: rgba(90, 176, 255, 0.1); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.tv-lien:hover { background: rgba(90, 176, 255, 0.22); color: #fff; }
.tv-lien.mort { color: var(--doux); background: rgba(255, 255, 255, 0.05); }
.tv-lien.tv-obs, .tv-lien.tv-note { color: #cdbcff; background: rgba(155, 107, 255, 0.14); }
a.tv-lien.tv-obs:hover, a.tv-lien.tv-note:hover { background: rgba(155, 107, 255, 0.28); }
.tv-lien.tv-bouton-lien { padding: 4px 12px; border-radius: 999px; font-size: 12px; border: 1px solid rgba(155, 107, 255, 0.45); }
.tv-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tv-carte .tv-actions { margin-top: auto; padding-top: 2px; }
.pastille.tv-site-ok { background: var(--vert); box-shadow: 0 0 6px var(--vert); }
.pastille.tv-site-lent { background: var(--jaune); box-shadow: 0 0 6px var(--jaune); }
.pastille.tv-site-erreur { background: var(--rouge); box-shadow: 0 0 6px var(--rouge); }
.pastille.tv-site-inconnu { background: var(--gris); }

/* Fiche d'un projet */
.tv-retour { background: none; border: none; padding: 2px 0 8px; color: var(--or); font-size: 12.5px; }
.tv-retour:hover { color: #ffd36b; }
.tv-fiche-tete { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin-bottom: 4px; }
.tv-fiche-tete h4 { margin: 0; font-size: 21px; font-weight: 700; overflow-wrap: anywhere; }
.tv-fiche-tete .tv-statut { align-self: center; }
.tv-tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }
.tv-tag { font-size: 10.5px; color: var(--doux); background: rgba(255, 255, 255, 0.05); padding: 1px 7px; border-radius: 6px; }
.tv-lignes { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.tv-lignes li { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 7px 0; border-top: 1px solid var(--bord); }
.tv-lignes li:first-child { border-top: none; }
.tv-lignes li .tv-ligne { align-self: stretch; }
.tv-prive { font: 600 9.5px var(--mono); text-transform: uppercase; letter-spacing: 0.08em; padding: 0 6px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); color: var(--doux); }
.tv-dl { grid-template-columns: 104px minmax(0, 1fr); gap: 5px 10px; font-size: 12px; margin: 0 0 8px; }
.tv-attention { color: #ffc780; }

/* Outils */
.tv-outil { --c: var(--gris); display: flex; flex-direction: column; gap: 7px; padding: 12px 13px; border-left: 3px solid var(--c); }
.tv-outil header { display: flex; align-items: center; gap: 8px; }
.tv-outil header b { flex: 1; min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.tv-outil .tv-dl { margin: 0; }
.tv-outil.tv-e-travail { border-color: rgba(61, 220, 132, 0.45); border-left-color: var(--c); box-shadow: 0 0 24px -14px var(--vert); }
.tv-outil.tv-e-absent { opacity: 0.62; }
.tv-outil.surligne { animation: tv-surligne 3.5s ease-out; }
@keyframes tv-surligne { 0%, 40% { box-shadow: 0 0 0 2px var(--or), 0 0 26px rgba(242, 193, 78, 0.6); } 100% { box-shadow: none; } }
.tv-etat { flex: none; margin-left: auto; font-size: 10px; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; background: rgba(255, 255, 255, 0.08); color: var(--doux); }
.tv-etat.tv-e-travail { background: rgba(61, 220, 132, 0.18); color: #7df0b0; }
.tv-etat.tv-e-attend { background: var(--rouge); color: #fff; animation: pulse 1.1s infinite; }
.tv-etat.tv-e-pret { background: rgba(90, 176, 255, 0.16); color: #9fd0ff; }
.tv-etat.tv-e-a-brancher { background: rgba(255, 171, 64, 0.18); color: #ffc780; }
.tv-puce.tv-e-travail { --c: var(--vert); }
.tv-puce.tv-e-pret { --c: var(--bleu); }
.tv-puce.tv-e-a-brancher { --c: #ffab40; }
.tv-puce.tv-e-absent { --c: var(--gris); }
.tv-live { margin: 0; display: flex; align-items: center; gap: 7px; padding: 5px 9px; border-radius: 8px; font-size: 12px; color: #9ff5c4; background: rgba(61, 220, 132, 0.1); border: 1px solid rgba(61, 220, 132, 0.3); overflow-wrap: anywhere; }
.tv-live.attend { color: #ffb3c0; background: rgba(255, 77, 109, 0.1); border-color: rgba(255, 77, 109, 0.45); }

/* Réservoir de la semaine */
.tv-reservoir { --zone: var(--vert); padding: 12px 14px; margin-bottom: 12px; background: radial-gradient(circle at 10% 0%, color-mix(in srgb, var(--zone) 14%, transparent), transparent 60%), rgba(255, 255, 255, 0.025); box-shadow: 0 0 30px -16px var(--zone); }
.tv-reservoir-tete { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 10px; }
.tv-reservoir-tete .bouton { margin-left: auto; }
.tv-zone { padding: 2px 11px; border-radius: 999px; background: var(--zone); color: #0b0e17; font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; }
.tv-reservoir-pct { font-size: 13px; }
.tv-reservoir-pct b { color: var(--zone); font-size: 19px; }
.tv-cuve { position: relative; height: 12px; border-radius: 6px; background: rgba(255, 255, 255, 0.1); margin-bottom: 8px; }
.tv-cuve .rempli { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; background: linear-gradient(90deg, color-mix(in srgb, var(--zone) 55%, #000), var(--zone)); box-shadow: 0 0 10px color-mix(in srgb, var(--zone) 70%, transparent); transition: width 0.8s ease; }
.tv-cuve .cible { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; border-radius: 1px; background: #fff3c4; box-shadow: 0 0 6px rgba(255, 243, 196, 0.9); }
.tv-conseil { margin: 8px 0 0; padding-left: 10px; border-left: 2px solid var(--zone); font-size: 12px; line-height: 1.5; color: #c9d0de; }

/* Activité */
.tv-barre-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.tv-barre-actions:empty { display: none; }
.tv-nuit { margin: 0 0 10px; padding: 7px 11px; border-radius: 9px; background: rgba(169, 155, 255, 0.12); border: 1px solid rgba(169, 155, 255, 0.35); color: #cfc7ff; font-size: 12.5px; }
.tv-sous-titre { margin: 12px 0 6px; font-size: 11.5px; font-weight: 500; color: var(--doux); }
.tv-sous-titre b { color: var(--texte); margin-left: 4px; }
.tv-arbre { list-style: none; margin: 0; padding: 0; }
.tv-arbre .tv-arbre { margin-left: 14px; padding-left: 12px; border-left: 1px solid rgba(242, 193, 78, 0.28); }
.tv-arbre > li { position: relative; padding: 3px 0; }
.tv-arbre .tv-arbre > li::before { content: ''; position: absolute; left: -12px; top: 17px; width: 10px; border-top: 1px solid rgba(242, 193, 78, 0.28); }
.tv-ligne { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; padding: 6px 9px; border: 1px solid var(--bord); border-radius: 9px; background: rgba(255, 255, 255, 0.03); font-size: 12.5px; }
.tv-ligne.attend { border-color: rgba(255, 77, 109, 0.55); }
.tv-ligne.fini { opacity: 0.55; }
.tv-sous { padding: 4px 9px; font-size: 12px; }
.tv-nom { flex: 1 1 130px; min-width: 0; overflow-wrap: anywhere; }
.tv-nom b { font-weight: 600; }
.tv-projet { color: var(--or); font-family: var(--mono); font-size: 11.5px; }
.tv-detail { flex: 2 1 170px; min-width: 0; color: var(--doux); font-size: 11.5px; overflow-wrap: anywhere; }
.tv-mini { flex: none; background: none; border: 1px solid rgba(242, 193, 78, 0.4); color: var(--or); border-radius: 6px; font-size: 11px; padding: 1px 9px; }
.tv-mini:hover { background: rgba(242, 193, 78, 0.14); }
.tv-chantier { border: 1px solid rgba(94, 240, 255, 0.3); border-radius: 9px; padding: 6px 9px 8px; background: rgba(94, 240, 255, 0.04); }
.tv-chantier .tv-ligne { border: none; background: none; padding: 0; }
.tv-chantier.fini { opacity: 0.6; }
.tv-ico-chantier { color: #5ef0ff; }
.tv-progression { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 11px; color: var(--doux); }
.tv-progression .barre-stat { flex: 1; margin-top: 0; }
.tv-chantier .barre-stat i { background: #5ef0ff; }
.tv-phases, .tv-agents { display: flex; flex-wrap: wrap; gap: 5px; }
.tv-agents { gap: 4px 10px; margin-top: 6px; font-size: 11px; color: var(--doux); }
.tv-phase { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.05); color: var(--doux); border: 1px solid var(--bord); }
.tv-phase b { margin-right: 4px; }
.tv-phase.fait { color: #7df0b0; border-color: rgba(61, 220, 132, 0.35); }
.tv-phase.en-cours { color: #5ef0ff; border-color: rgba(94, 240, 255, 0.5); background: rgba(94, 240, 255, 0.1); }
.tv-agent-mini { display: inline-flex; align-items: center; gap: 5px; }
.tv-agent-mini.fini { opacity: 0.55; }
.tv-mission { padding: 9px 11px; margin-bottom: 8px; font-size: 12.5px; }
.tv-mission.tv-m-en-cours { border-color: rgba(61, 220, 132, 0.45); }
.tv-mission.tv-m-ouverte { border-color: rgba(90, 176, 255, 0.45); }
.tv-mission header { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.tv-mission p { margin: 6px 0; line-height: 1.45; overflow-wrap: anywhere; }
.tv-fil { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.tv-fil li { display: flex; gap: 8px; padding: 6px 0; border-top: 1px solid var(--bord); line-height: 1.4; }
.tv-fil .h { color: var(--doux); font-size: 11px; white-space: nowrap; }
.tv-fil .texte { min-width: 0; color: #c9d0de; overflow-wrap: anywhere; }

/* Données */
.tv-bloc { padding: 12px 14px 14px; margin-bottom: 12px; }
.tv-compteurs { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin: 4px 0 10px; }
.tv-compteurs > div { display: flex; flex-direction: column; padding: 8px 11px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--bord); }
.tv-compteurs b { font-size: 20px; font-weight: 600; color: var(--or); }
.tv-compteurs small { color: var(--doux); font-size: 10.5px; }
.tv-compteurs > .tv-attention-bloc { border-color: rgba(255, 171, 64, 0.5); background: rgba(255, 171, 64, 0.08); }
.tv-compteurs > .tv-attention-bloc b { color: #ffc780; }
.tv-tableau { font-size: 12px; }
.tv-rangee { display: grid; grid-template-columns: 14px minmax(0, 1fr) 40px 76px 88px; gap: 4px 8px; align-items: center; padding: 6px 0; border-top: 1px solid var(--bord); }
.tv-rangee.tete { border-top: none; color: var(--doux); font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; padding-top: 0; }
.tv-site-nom { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.tv-site-nom .tv-lien { padding-left: 0; background: none; }
.tv-site-nom .tv-lien-btn { text-decoration: none; color: var(--doux); font-size: 11px; text-align: left; }
.tv-site-nom .tv-lien-btn:hover { color: var(--or); text-decoration: underline; }
.tv-verif { font-size: 11px; text-align: right; }
.tv-code, .tv-ms { font-size: 11.5px; }
.tv-aide { margin: 0 0 8px; font-size: 12.5px; line-height: 1.55; color: #c3cadb; }
.tv-agenda-form { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.tv-agenda-form input { flex: 1 1 220px; }
.tv-agenda-form .bouton.danger { grid-column: auto; }
.tv-secret { -webkit-text-security: disc; font-family: var(--mono); font-size: 12px; }
.tv-msg { min-height: 1.3em; margin: 4px 0 0; font-size: 12px; color: var(--vert); }
.tv-msg.erreur { color: var(--rouge); }
.tv-heure { flex: none; min-width: 74px; color: var(--or); font-size: 11.5px; }
.tv-vide { text-align: center; padding: 26px 16px; color: var(--doux); border: 1px dashed var(--bord); border-radius: 12px; font-size: 12.5px; line-height: 1.5; margin-bottom: 8px; }
.tv-vide b { display: block; margin-bottom: 4px; color: var(--texte); font-weight: 500; font-size: 14px; }
.tv-vide p { margin: 4px 0 8px; }

@media (max-width: 900px) {
  .tv-recherche input { font-size: 16px; }
  .bouton-tout-voir kbd { display: none; }
  .tv-corps { padding: 14px; }
  #tout-voir .onglets { padding: 8px 10px 10px; gap: 2px; }
  #tout-voir .onglets button { padding: 6px 10px; }
}
@media (max-width: 560px) {
  .tv-grille { grid-template-columns: minmax(0, 1fr); }
  .tv-rangee { grid-template-columns: 14px minmax(0, 1fr) auto; }
  .tv-rangee.tete { display: none; }
  .tv-rangee .tv-ms { grid-column: 2; }
  .tv-rangee .tv-verif { grid-column: 3; }
  .tv-dl { grid-template-columns: 88px minmax(0, 1fr); }
  .tv-tri { margin-left: 0; }
  .tv-puces > .tv-lib { display: none; }
  .tv-puce { padding: 3px 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .tv-cuve .rempli { transition: none; }
  .tv-outil.surligne, .tv-etat.tv-e-attend { animation: none; }
}

/* ---------- v8 : Tout jouer — HUD commun des mini-jeux (jeux.js) ---------- */
body.en-jeu .balade-aide, body.en-jeu .balade-invite, body.en-jeu .balade-joystick, body.en-jeu .balade-e,
body.en-jeu .balade-garage, body.en-jeu .balade-carte, body.en-jeu .balade-quitter, body.en-jeu .balade-bulle { display: none !important; }
/* En jeu, l'écran est au jeu : barre du haut, colonne, fiche, bandeau du bas, étiquettes des lieux et de Toi rangés. */
body.en-jeu .barre, body.en-jeu .colonne, body.en-jeu .fiche, body.en-jeu .aide, body.en-jeu .fil, body.en-jeu .bandeau-nuit,
body.en-jeu .balade-lieu, body.en-jeu .calque-etiquettes .etiquette-lieu, body.en-jeu .calque-etiquettes .etiquette-agent.toi,
body.en-jeu .calque-etiquettes .etiquette-agent:not(.jeu), body.en-jeu .calque-etiquettes .etiquette-modele { display: none !important; }
.jeu-hud { position: fixed; inset: 0; z-index: 9; pointer-events: none; }
.jeu-hud[hidden] { display: none; }
.jeu-hud [hidden] { display: none !important; }
.jeu-haut { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.jeu-titre { font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--or); text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7); }
.jeu-score { padding: 8px 20px; border-radius: 999px; background: rgba(9, 12, 24, 0.86); border: 1px solid rgba(242, 193, 78, 0.55); font-size: 17px; font-weight: 600; white-space: nowrap; box-shadow: 0 8px 26px rgba(0, 0, 0, 0.4); }
.jeu-score b { color: var(--or); }
.jeu-zone { position: fixed; inset: 0; pointer-events: none; }
.jeu-message { position: fixed; top: 38%; left: 50%; transform: translate(-50%, -50%); width: max-content; max-width: calc(100vw - 32px); text-align: center; font-size: 40px; font-weight: 700; color: #fff; text-shadow: 0 3px 18px rgba(0, 0, 0, 0.75), 0 0 28px rgba(242, 193, 78, 0.45); pointer-events: none; }
.jeu-message.montre { animation: jeu-message 0.35s cubic-bezier(0.2, 1.4, 0.4, 1); }
.jeu-message.bon { color: var(--vert); }
.jeu-message.mauvais { color: var(--rouge); }
@keyframes jeu-message { from { transform: translate(-50%, -50%) scale(0.6); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
.jeu-jauge { position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%); width: min(420px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 6px; align-items: center; }
.jeu-jauge-libelle { font-size: 12px; color: var(--texte); text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8); }
.jeu-jauge-barre { position: relative; width: 100%; height: 16px; border-radius: 999px; background: rgba(9, 12, 24, 0.86); border: 1px solid rgba(255, 255, 255, 0.25); overflow: hidden; }
.jeu-jauge-barre i { position: absolute; top: 0; bottom: 0; left: 0; }
.jeu-jauge-niveau { background-image: linear-gradient(90deg, var(--vert), var(--jaune), var(--rouge)); background-size: min(420px, calc(100vw - 32px)) 100%; background-repeat: no-repeat; } /* le dégradé couvre toute la barre, pas seulement le remplissage */
.jeu-jauge-cible { background: rgba(255, 255, 255, 0.28); border-left: 2px solid #fff; border-right: 2px solid #fff; z-index: 1; }
.jeu-jauge-repere { width: 3px; margin-left: -1px; background: #fff; z-index: 2; }
.jeu-aide { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); padding: 7px 14px; border-radius: 10px; background: rgba(9, 12, 24, 0.78); border: 1px solid var(--bord); font-size: 12px; color: var(--doux); white-space: nowrap; max-width: calc(100vw - 24px); overflow: hidden; text-overflow: ellipsis; }
.jeu-aide b { color: var(--texte); }
.jeu-boutons { position: fixed; right: 14px; bottom: 24px; display: none; flex-wrap: wrap-reverse; justify-content: flex-end; gap: 8px; max-width: calc(100vw - 28px); pointer-events: auto; }
.balade-hud.tactile ~ .jeu-hud .jeu-boutons, body.tactile-jeu .jeu-boutons { display: flex; }
.jeu-boutons button { min-width: 64px; height: 64px; padding: 0 12px; border-radius: 999px; border: 1px solid rgba(242, 193, 78, 0.6); background: rgba(9, 12, 24, 0.78); color: var(--texte); font-weight: 600; font-size: 13px; touch-action: none; user-select: none; -webkit-user-select: none; }
.jeu-boutons button.appuye { background: var(--or); color: #17130a; }
.jeu-pause { position: fixed; top: 14px; right: 14px; pointer-events: auto; }
.jeu-carte { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 140px); overflow-y: auto; padding: 20px 22px; border-radius: var(--rayon); background: rgba(9, 12, 24, 0.94); border: 1px solid rgba(242, 193, 78, 0.45); box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55); pointer-events: auto; backdrop-filter: blur(10px); }
.jc-tete h2 { margin: 4px 0 10px; font-size: 26px; }
.jc-tete h2.perdu { color: var(--doux); }
.jc-groupe { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--or); }
.jc-resume { margin: 0 0 12px; color: var(--texte); line-height: 1.45; }
.jc-commandes { font-size: 12px; color: var(--doux); line-height: 1.7; margin-bottom: 10px; }
.jc-commandes b { color: var(--texte); }
.jc-limite { font-size: 12.5px; color: var(--doux); margin: 0 0 12px; }
.jc-limite b { color: var(--jaune); margin-right: 6px; }
.jc-niveaux { display: flex; gap: 6px; margin-bottom: 10px; }
.jc-niveaux button { flex: 1; padding: 7px 6px; border-radius: 9px; border: 1px solid var(--bord); background: rgba(255, 255, 255, 0.04); font-size: 13px; }
.jc-niveaux button.actif { background: var(--or); color: #17130a; border-color: var(--or); }
.jc-adv { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--doux); margin-bottom: 10px; }
.jc-adv select { flex: 1; max-width: 230px; padding: 6px 8px; border-radius: 8px; background: var(--panneau-plein); color: var(--texte); border: 1px solid var(--bord); font: inherit; }
.jc-record { font-size: 13px; color: var(--doux); margin: 4px 0 8px; }
.jc-record b { color: var(--texte); }
.jc-record.neuf { color: var(--or); font-weight: 600; }
.jc-gros { font-size: 34px; font-weight: 700; margin: 0 0 8px; color: var(--or); }
.jc-prime { font-size: 18px; font-weight: 700; color: var(--vert); margin: 4px 0 8px; }
.jc-prime span { font-size: 12px; font-weight: 400; color: var(--doux); }
.jc-note { font-size: 12px; color: var(--doux); margin: 4px 0 8px; }
.jc-erreur { font-size: 12.5px; color: var(--rouge); }
.jc-details { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 8px; }
.jc-details th { text-align: left; font-weight: 400; color: var(--doux); padding: 3px 0; }
.jc-details td { text-align: right; padding: 3px 0; }
.jc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.jc-actions .bouton { flex: 1; min-width: 120px; }
.jeu-carte kbd, .jc-niveaux kbd { font-family: var(--mono); font-size: 10px; opacity: 0.65; margin-left: 4px; }
.jeu-borne { padding: 4px 11px; border-radius: 999px; background: rgba(9, 12, 24, 0.82); border: 1px solid rgba(242, 193, 78, 0.55); color: var(--texte); font-size: 12px; white-space: nowrap; pointer-events: none; transform: translateY(-4px); }
.jeu-borne b { color: var(--or); margin-right: 3px; }
.jeu-borne.proche { background: var(--or); color: #17130a; }
.jeu-borne.proche b { color: #17130a; }
@media (max-width: 640px) {
  .jeu-haut { top: 12px; max-width: calc(100vw - 110px); }
  .jeu-score { font-size: 15px; padding: 6px 14px; }
  .jeu-message { font-size: 30px; }
  .jeu-pause { top: 12px; }
  .jeu-jauge { bottom: 150px; }
  .jeu-aide { display: none; }
  .jeu-boutons button { min-width: 56px; height: 56px; padding: 0 10px; }
}

/* ---------- v8 : carnet des activités ---------- */
.bouton-activites kbd { font: 600 10.5px var(--mono); margin-left: 5px; padding: 0 5px; border-radius: 5px; border: 1px solid rgba(242, 193, 78, 0.55); color: var(--or); }
.bouton-activites.actif kbd { color: #17130a; border-color: rgba(23, 19, 10, 0.5); }
.bouton-activites:disabled { opacity: 0.45; cursor: not-allowed; }
.bouton-activites:disabled:hover { background: rgba(10, 14, 28, 0.66); border-color: rgba(242, 193, 78, 0.38); }
@media (min-width: 641px) { #activites { left: auto; width: min(560px, calc(100vw - 24px)); } }

/* Portefeuille en tête, onglets, recherche */
.ac-portefeuille { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin: 4px 16px 0; padding: 9px 13px; border-radius: 12px; border: 1px solid rgba(242, 193, 78, 0.32); background: rgba(242, 193, 78, 0.07); }
.ac-portefeuille[hidden] { display: none; }
.ac-pieces { display: flex; align-items: baseline; gap: 7px; }
.ac-pieces b { font-size: 20px; font-weight: 600; color: var(--or); }
.ac-pieces small { color: var(--doux); font-size: 11px; }
.ac-gain { margin: 0; flex: 1 1 210px; font-size: 12px; line-height: 1.45; color: #c3cadb; }
#activites .onglets { padding-top: 12px; }
.ac-compte { margin-left: 3px; font-size: 10.5px; color: var(--doux); }
#activites .onglets button.actif .ac-compte { color: var(--or); }
.ac-recherche { padding: 10px 16px 0; }
.ac-recherche input {
  width: 100%; padding: 9px 12px 9px 34px; border-radius: 10px; font-size: 13.5px; -webkit-appearance: none; appearance: none;
  background: rgba(255, 255, 255, 0.05) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238e97ad' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 11px center;
}
.ac-recherche input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; height: 14px; width: 14px; cursor: pointer; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238e97ad' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E") center / contain no-repeat; }

/* Liste : groupes, lignes, boutons */
.ac-corps { overflow-x: hidden; overscroll-behavior: contain; font-size: 13px; }
.ac-corps > *, .ac-corps article { min-width: 0; }
.ac-groupe + .ac-groupe { margin-top: 22px; }
.ac-corps h3 b { color: var(--texte); letter-spacing: 0; margin-left: 6px; font-weight: 600; }
.ac-corps h4 { margin: 14px 0 7px 2px; font-size: 11.5px; font-weight: 500; letter-spacing: 0.06em; color: var(--doux); }
.ac-note { margin: -2px 0 10px 4px; font-size: 11.5px; line-height: 1.5; color: var(--doux); }
.ac-liste { display: grid; gap: 8px; }
.ac-ligne { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 11px 13px; border: 1px solid var(--bord); border-radius: 12px; background: rgba(255, 255, 255, 0.03); transition: border-color 0.15s, background 0.15s; }
.ac-ligne:hover { border-color: rgba(242, 193, 78, 0.5); background: rgba(242, 193, 78, 0.045); }
.ac-info { flex: 1 1 auto; min-width: 0; }
.ac-nom { display: flex; flex-wrap: wrap; align-items: baseline; gap: 1px 10px; }
.ac-nom b { font-size: 14.5px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.ac-lieu { color: var(--doux); font-size: 10.5px; line-height: 1.4; overflow-wrap: anywhere; }
.ac-resume { margin: 4px 0 0; font-size: 12.5px; line-height: 1.5; color: #c3cadb; overflow-wrap: anywhere; }
.ac-limite { margin: 4px 0 0; font-size: 11.5px; line-height: 1.5; color: var(--doux); overflow-wrap: anywhere; }
.ac-limite b { margin-right: 6px; font: 600 9.5px var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--jaune); }
.ac-etat { margin: 6px 0 0; font-size: 11px; line-height: 1.5; color: var(--doux); }
.ac-etat b { color: var(--texte); font-weight: 600; }
.ac-actions { flex: none; display: flex; flex-direction: column; gap: 6px; width: 82px; }
.ac-actions .bouton { width: 100%; }
.ac-puces { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ac-puce { padding: 4px 11px; border-radius: 999px; border: 1px solid var(--bord); background: rgba(255, 255, 255, 0.04); color: #cdd3e1; font-size: 12px; transition: border-color 0.15s, background 0.15s, color 0.15s; }
.ac-puce:hover { border-color: rgba(242, 193, 78, 0.55); background: rgba(242, 193, 78, 0.08); color: var(--or); }
.ac-vide { text-align: center; padding: 26px 16px; color: var(--doux); border: 1px dashed var(--bord); border-radius: 12px; font-size: 12.5px; line-height: 1.5; }
.ac-vide b { display: block; margin-bottom: 4px; color: var(--texte); font-weight: 500; font-size: 14px; overflow-wrap: anywhere; }
.ac-vide p { margin: 4px 0 10px; }
.ac-pied { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 14px; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
.ac-pied kbd { font: 600 10px var(--mono); padding: 0 5px; border-radius: 5px; border: 1px solid var(--bord); color: var(--texte); }
.ac-erreur { color: var(--rouge); }
:is(#activites .bouton, .ac-puce, #activites .onglets button, #activites .fermer):focus-visible { outline: 2px solid var(--or); outline-offset: 2px; }
@media (pointer: coarse) { .ac-astuces { display: none; } }

/* Téléphone : le tiroir prend tout l'écran, les boutons restent faciles à toucher */
@media (max-width: 640px) {
  #activites { top: 0; left: 0; right: 0; bottom: 0; width: auto; border-radius: 0; border: none; }
  #activites .tiroir-tete { padding-top: calc(16px + env(safe-area-inset-top, 0px)); }
  #activites .onglets { padding: 10px 10px 10px; gap: 2px; }
  #activites .onglets button { padding: 8px 11px; }
  #activites .fermer { top: 8px; right: 6px; padding: 8px 12px; font-size: 26px; }
  .ac-portefeuille { margin: 4px 12px 0; }
  .ac-recherche { padding: 10px 12px 0; }
  .ac-recherche input { font-size: 16px; }
  .ac-corps { padding: 12px; }
  .ac-ligne { flex-direction: column; gap: 10px; }
  .ac-actions { flex-direction: row; width: 100%; }
  .ac-actions .bouton { flex: 1; padding: 9px 10px; font-size: 13px; }
  .ac-puce { padding: 8px 13px; font-size: 13px; }
  .ac-astuces { display: none; }
  .bouton-activites kbd { display: none; }
  #btn-activites { order: -1; }
}
