﻿/* ════════════════════════════════════════════════════════════════
   MISSIONS PRIMAIRES & DÉTACHEMENTS — Redesign V2
   Direction « Cogitator » : sobre, technique, touches 40K
   (or terni, rouge sang, hairlines, micro-labels mono)
   Le thème est SCOPÉ à .pr-wrap pour ne pas affecter le header/footer
   partagés du site. La modale vit à l'intérieur de .pr-wrap.
   ════════════════════════════════════════════════════════════════ */

/* Variables thème — limitées au contenu de l'app */
.pr-wrap {
  /* Hérite des tokens globaux (Acier/Ambre via data-theme).
     gold → accent / badge-new, red décoratif → accent, red sémantique → danger. */
  --bg2:     var(--bg-2);
  --line2:   var(--line-2);

  --gold:        var(--accent);
  --gold-bright: var(--accent-b);
  --gold-dim:    var(--accent);
  --red:         var(--accent);
  --red-bright:  var(--accent-b);

  --radius:  10px;
  --radius2: 6px;
  --shadow-lg: 0 24px 70px rgba(0,0,0,.18);

  --u: 1rem;

  font-family: var(--font);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  max-width: 1280px;
  margin: 0 auto;
  padding: calc(var(--u) * 1.2) clamp(16px, 3vw, 36px) calc(var(--u) * 3);
}

.pr-wrap button, .pr-wrap select, .pr-wrap input { font-family: inherit; }

/* texture discrète : fines lignes horizontales quasi invisibles */
body.ornaments::before {
  content: '';
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    repeating-linear-gradient(0deg, transparent 0 3px, color-mix(in srgb, var(--text) 1.4%, transparent) 3px 4px);
}
.page { position: relative; z-index: 1; }

@media (prefers-reduced-motion: no-preference) {
  .pr-panel.is-entering { animation: prFade .22s ease; }
}
@keyframes prFade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* ───────── onglets (déplacés dans le contenu) ───────── */
.hd-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: calc(var(--u) * 1.5); }
.hd-tab {
  appearance: none; background: transparent; border: none; cursor: pointer;
  font-family: var(--mono); font-size: .8rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); padding: 13px 18px 15px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .15s, border-color .15s;
  display: inline-flex; align-items: center; gap: 9px;
}
.hd-tab .idx { color: var(--gold-dim); font-size: .68rem; }
.hd-tab:hover { color: var(--text); }
.hd-tab.is-active { color: var(--gold-bright); border-bottom-color: var(--gold); }
.hd-tab.is-active .idx { color: var(--gold); }

/* ───────── sections ───────── */
.sec-hd { margin: calc(var(--u) * 1.6) 0 calc(var(--u) * .9); }
.sec-hd:first-child { margin-top: 0; }
.sec-hd--row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.sec-kicker {
  font-family: var(--mono); font-size: .66rem; letter-spacing: .26em;
  text-transform: uppercase; color: var(--gold);
  display: flex; align-items: center; gap: 10px; margin-bottom: 7px;
}
.sec-kicker::after { content: ''; height: 1px; width: 48px; background: var(--gold-dim); opacity: .6; }
.sec-hd h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: .01em; }
.sec-hd h3 { font-size: 1.02rem; font-weight: 700; }
.hint { color: var(--muted); font-size: .84rem; margin-top: 3px; }
.hint b { color: var(--text); }

.empty, .loading {
  color: var(--muted); font-size: .86rem; text-align: center;
  padding: calc(var(--u) * 1.4);
  border: 1px dashed var(--line2); border-radius: var(--radius);
}
.loading { border: none; text-align: left; padding: calc(var(--u) * .5) 0; }

.mini-btn {
  background: transparent; color: var(--muted); cursor: pointer;
  border: 1px solid var(--line2); border-radius: var(--radius2);
  font-family: var(--mono); font-size: .72rem; letter-spacing: .05em;
  padding: 7px 12px; transition: border-color .15s, color .15s;
}
.mini-btn:hover { border-color: var(--gold); color: var(--gold-bright); }

/* ───────── chips disposition ───────── */
.disp-row { display: flex; flex-wrap: wrap; gap: calc(var(--u) * .55); }
.chip {
  --disp: var(--gold);
  display: inline-flex; align-items: center; gap: 9px;
  padding: calc(var(--u) * .55) calc(var(--u) * .95);
  border-radius: var(--radius2); cursor: pointer;
  background: color-mix(in srgb, var(--disp) 7%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--disp) 38%, transparent);
  color: var(--text); font-weight: 600; font-size: .9rem; letter-spacing: .01em;
  transition: transform .12s, box-shadow .15s, background .15s, border-color .15s;
  position: relative;
}
.chip:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--disp) 75%, transparent); }
.chip .dot { width: 9px; height: 9px; flex: none; transform: rotate(45deg); background: var(--disp); }
.chip.is-active {
  background: color-mix(in srgb, var(--disp) 22%, var(--panel));
  border-color: var(--disp);
  box-shadow: inset 0 0 0 1px var(--disp), 0 4px 18px color-mix(in srgb, var(--disp) 28%, transparent);
}
.chip.is-active .dot { box-shadow: 0 0 8px var(--disp); }
.disp-row--small .chip { padding: calc(var(--u) * .35) calc(var(--u) * .65); font-size: .8rem; }

/* ───────── cartes mission (explorer) ───────── */
.opp-grid { display: grid; gap: calc(var(--u) * .8); grid-template-columns: repeat(auto-fill, minmax(218px, 1fr)); }
.m-card {
  --disp: var(--gold);
  appearance: none; text-align: left; cursor: pointer; color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line); border-top: 3px solid var(--disp);
  border-radius: var(--radius);
  padding: calc(var(--u) * .95) calc(var(--u) * 1) calc(var(--u) * .85);
  display: flex; flex-direction: column; gap: 4px;
  transition: transform .14s, box-shadow .18s, border-color .15s;
  position: relative; overflow: hidden;
}
.m-card::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(120% 90% at 50% -20%, color-mix(in srgb, var(--disp) 14%, transparent), transparent 60%);
  transition: opacity .18s;
}
.m-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--disp) 45%, var(--line)); }
.m-card:hover::after { opacity: 1; }
.m-card .kicker { font-family: var(--mono); font-size: .62rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted2); }
.m-card .opp { font-weight: 600; font-size: .86rem; color: color-mix(in srgb, var(--disp) 78%, var(--text)); }
.m-card .name { font-size: 1.12rem; font-weight: 700; line-height: 1.18; margin-top: 7px; text-wrap: pretty; min-height: 2.4em; }
.m-card .read { margin-top: auto; padding-top: 12px; font-family: var(--mono); font-size: .7rem; letter-spacing: .08em; color: var(--muted2); transition: color .15s; }
.m-card:hover .read { color: var(--gold-bright); }

/* ───────── matrice ───────── */
.matrix-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.matrix { border-collapse: collapse; width: 100%; font-size: .84rem; }
.matrix th, .matrix td { padding: calc(var(--u) * .55) calc(var(--u) * .7); text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
.matrix tr > * + * { border-left: 1px solid var(--line); }
.matrix tbody tr:last-child th, .matrix tbody tr:last-child td { border-bottom: none; }
.matrix thead th { font-family: var(--mono); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; background: var(--panel2); font-weight: 500; white-space: nowrap; }
.matrix th.rowhd { font-family: var(--mono); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 500; background: var(--panel2); white-space: nowrap; }
.matrix td.cell { cursor: pointer; transition: background .12s; font-weight: 600; }
.matrix td.cell:hover { background: color-mix(in srgb, var(--gold) 13%, transparent); }
.matrix td.cell .tag { display: inline-block; width: 8px; height: 8px; transform: rotate(45deg); margin-right: 9px; vertical-align: 1px; }
.matrix td.is-mirror { background: color-mix(in srgb, var(--gold) 5%, transparent); }

/* Matrice du builder : tout visible d'un coup, sans défilement horizontal */
#listMatrixWrap .matrix-scroll { overflow-x: visible; }
#listMatrixWrap .matrix { table-layout: fixed; }
#listMatrixWrap .matrix thead th, #listMatrixWrap .matrix th.rowhd { white-space: normal; font-size: .6rem; }
#listMatrixWrap .matrix th, #listMatrixWrap .matrix td { padding: calc(var(--u) * .45) calc(var(--u) * .5); overflow-wrap: break-word; }
#listMatrixWrap .matrix td.cell { font-size: .78rem; }
#listMatrixWrap .matrix td.cell .tag { margin-right: 6px; }

/* ───────── contenu complet de mission dans la cellule (widescreen) ───────── */
/* Masqué par défaut : seul le nom de la mission s'affiche. */
.matrix td.cell .cell-detail { display: none; }
.cell-detail { margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--line); font-weight: 400; }
.cell-detail .cd-intro { font-style: italic; color: var(--muted2); font-size: .72rem; line-height: 1.4; margin-bottom: 7px; }
.cell-detail .cd-block { margin-bottom: 8px; }
.cell-detail .cd-block:last-child { margin-bottom: 0; }
.cell-detail .cd-phase { font-family: var(--mono); font-size: .6rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); margin-bottom: 4px; }
.cell-detail .cd-when { font-size: .72rem; color: var(--muted); margin: 3px 0; line-height: 1.4; }
.cell-detail .cd-when b { color: var(--text); font-weight: 600; }
.cell-detail .cd-note { font-size: .72rem; color: var(--muted); margin: 3px 0; line-height: 1.4; }
.cell-detail .cd-entry { display: flex; gap: 8px; justify-content: space-between; align-items: baseline; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.cell-detail .cd-entry:last-child { border-bottom: none; }
.cell-detail .cd-entry.is-cumul { padding-left: 10px; }
.cell-detail .cd-entry .t { font-size: .74rem; line-height: 1.35; color: var(--text); }
.cell-detail .cd-entry .pts { font-family: var(--mono); font-weight: 600; font-size: .74rem; color: var(--gold-bright); white-space: nowrap; }
.cell-detail .cd-sub { color: var(--muted2); font-size: .68rem; }

/* Sélecteur de densité (full / compact) : visible seulement quand il y a la place. */
.matrix-ctrls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
/* Variante dans l'en-tête « Déploiement / Ma liste » : collée en haut à droite. */
.matrix-ctrls--top { align-self: flex-start; }
/* Spécificité > .lang-switch (défini plus bas) pour rester masqué hors widescreen. */
.matrix-ctrls .matrix-mode { display: none; }

/* En widescreen, le sélecteur apparaît ; le mode « Complet » (classe is-full sur
   .pr-wrap) déploie le contenu et élargit la page (≈16px de marges). En « Compact »,
   ou sous le palier, on conserve l'affichage d'origine (noms seuls, page à 1280px). */
@media (min-width: 1500px) {
  .matrix-ctrls .matrix-mode { display: inline-flex; }

  .pr-wrap.is-full { max-width: none; padding-left: 16px; padding-right: 16px; }

  /* Le nom devient un titre de cellule ; le contenu complet apparaît dessous. */
  .pr-wrap.is-full .matrix td.cell .cell-name { display: block; font-size: .95rem; line-height: 1.2; }
  .pr-wrap.is-full .matrix td.cell .cell-detail { display: block; }

  /* Colonnes à largeur égale : le texte s'enroule, plus de défilement horizontal. */
  .pr-wrap.is-full #matrixWrap .matrix, .pr-wrap.is-full #listMatrixWrap .matrix { table-layout: fixed; }
  .pr-wrap.is-full #matrixWrap .matrix-scroll, .pr-wrap.is-full #listMatrixWrap .matrix-scroll { overflow-x: visible; }
  .pr-wrap.is-full #matrixWrap .matrix td.cell, .pr-wrap.is-full #matrixWrap .matrix th.rowhd,
  .pr-wrap.is-full #listMatrixWrap .matrix td.cell, .pr-wrap.is-full #listMatrixWrap .matrix th.rowhd { vertical-align: top; }
  .pr-wrap.is-full #matrixWrap .matrix thead th, .pr-wrap.is-full #listMatrixWrap .matrix thead th,
  .pr-wrap.is-full #matrixWrap .matrix th.rowhd, .pr-wrap.is-full #listMatrixWrap .matrix th.rowhd { white-space: normal; }
  /* Colonne d'en-tête plus étroite ; les 5 colonnes adverses se partagent le reste. */
  .pr-wrap.is-full #matrixWrap .matrix th.rowhd, .pr-wrap.is-full #listMatrixWrap .matrix th.rowhd { width: clamp(120px, 9vw, 180px); }
  /* Annule la réduction de police propre au builder (place dispo). */
  .pr-wrap.is-full #listMatrixWrap .matrix thead th, .pr-wrap.is-full #listMatrixWrap .matrix th.rowhd { font-size: .68rem; }
  .pr-wrap.is-full #listMatrixWrap .matrix td.cell { font-size: .82rem; }
}

/* ───────── matrice détachements (faction × disposition) ───────── */
/* Code couleur par coût en DP : 1 = abordable (vert), 2 = or, 3 = lourd (rouge) */
.pr-wrap { --dp1: var(--success); --dp2: var(--badge-new); --dp3: var(--danger); }

.dp-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: calc(var(--u) * .9); }
.dp-legend .legend-label { font-family: var(--mono); font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }

.dp-pill {
  display: inline-block; font-size: .8rem; font-weight: 600; line-height: 1.25;
  padding: 3px 9px; border-radius: 4px; border: 1px solid;
  background: color-mix(in srgb, var(--pc) 14%, var(--panel));
  border-color: color-mix(in srgb, var(--pc) 55%, transparent);
  color: color-mix(in srgb, var(--pc) 62%, var(--text));
}
.dp-pill.dp-1 { --pc: var(--dp1); }
.dp-pill.dp-2 { --pc: var(--dp2); }
.dp-pill.dp-3 { --pc: var(--dp3); }
.dp-pill.is-legend { font-family: var(--mono); font-size: .72rem; letter-spacing: .04em; }
.pill-new { font-family: var(--mono); font-size: .56rem; letter-spacing: .1em; text-transform: uppercase; opacity: .8; vertical-align: 1px; }

.det-matrix { font-size: .82rem; }
.det-matrix th.disp-hd { color: color-mix(in srgb, var(--disp) 82%, var(--text)); white-space: nowrap; }
.det-matrix th.disp-hd .dot { display: inline-block; width: 8px; height: 8px; transform: rotate(45deg); background: var(--disp); margin-right: 8px; vertical-align: 1px; }
.det-matrix th.faction-hd { font-family: var(--font); text-transform: none; letter-spacing: 0; font-size: .86rem; font-weight: 700; color: var(--text); white-space: nowrap; vertical-align: middle; }
.det-matrix td.det-cell { vertical-align: top; padding: calc(var(--u) * .45) calc(var(--u) * .5); }
.det-matrix td.det-cell.is-empty { color: var(--muted2); text-align: center; }
.det-matrix .cell-pills { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.det-matrix th.faction-hd .fac-dp { font-family: var(--mono); font-size: .66rem; font-weight: 600; color: var(--gold-bright); margin-left: 4px; white-space: nowrap; }

/* pills interactives (sélection du roster) */
.det-matrix .dp-pill { cursor: pointer; transition: transform .1s, box-shadow .12s, opacity .12s, filter .12s; user-select: none; }
.det-matrix .dp-pill:hover:not(.is-disabled):not(.is-selected) { transform: translateY(-1px); box-shadow: 0 2px 8px color-mix(in srgb, var(--pc) 30%, transparent); }
.det-matrix .dp-pill.is-selected {
  background: var(--pc); border-color: var(--pc); color: var(--on-accent); font-weight: 700;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--pc) 40%, transparent);
}
.det-matrix .dp-pill.is-selected::before { content: '✓ '; font-weight: 700; }
.det-matrix .dp-pill.is-disabled { opacity: .28; filter: grayscale(.6); cursor: not-allowed; }

/* lignes / colonnes : retenues en haut, indisponibles barrées en bas / à droite */
.det-matrix tr.is-row-selected > th.faction-hd { color: var(--gold-bright); box-shadow: inset 3px 0 0 var(--gold); }
.det-matrix tr.is-row-selected { background: color-mix(in srgb, var(--gold) 5%, transparent); }
.det-matrix tr.is-row-unavail > th.faction-hd { text-decoration: line-through; color: var(--muted2); }
.det-matrix tr.is-row-unavail > td { opacity: .4; }
/* lignes indispo : aucune sélection dedans → tous les pills non cliquables.
   colonnes indispo : on garde les pills sélectionnés cliquables (pour les retirer). */
.det-matrix tr.is-row-unavail .dp-pill, .det-matrix td.det-cell.is-unavail .dp-pill:not(.is-selected) { pointer-events: none; }
.det-matrix th.disp-hd.is-unavail { text-decoration: line-through; color: var(--muted2); opacity: .6; }
.det-matrix th.disp-hd.is-unavail .dot { opacity: .4; }
.det-matrix td.det-cell.is-unavail { background: color-mix(in srgb, var(--text) 3%, transparent); }
.det-matrix td.det-cell.is-unavail.is-empty { opacity: .4; }

/* panneau roster : cartes de faction (DP, détachements, disposition retenue) */
.roster-panel { display: flex; flex-wrap: wrap; gap: calc(var(--u) * .7); margin-bottom: calc(var(--u) * 1); }
.roster-panel:empty { display: none; }
.rp-card {
  flex: 1 1 240px; max-width: 340px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius2); padding: calc(var(--u) * .6) calc(var(--u) * .7); display: flex; flex-direction: column; gap: 8px;
}
.rp-card.need-choice { border-color: color-mix(in srgb, var(--gold) 60%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--gold) 30%, transparent); }
.roster-recap-hd { margin: 0 0 calc(var(--u) * .6); }
.rp-head { display: flex; align-items: center; gap: 8px; }
.rp-headrow { margin-top: -2px; }
.rp-disp-badge { --disp: var(--gold); display: inline-flex; align-items: center; gap: 6px; font-size: .76rem; font-weight: 700; padding: 3px 9px; border-radius: 4px; color: color-mix(in srgb, var(--disp) 82%, var(--text)); background: color-mix(in srgb, var(--disp) 15%, var(--panel)); border: 1px solid color-mix(in srgb, var(--disp) 50%, transparent); }
.rp-disp-badge .dot { width: 8px; height: 8px; transform: rotate(45deg); background: var(--disp); }
.rp-disp-badge.need { color: var(--gold-bright); background: color-mix(in srgb, var(--gold) 12%, transparent); border-color: color-mix(in srgb, var(--gold) 50%, transparent); border-style: dashed; }
.rp-fac { font-style: normal; font-family: var(--mono); font-size: .64rem; letter-spacing: .04em; color: var(--muted); }
.rp-name { font-weight: 700; font-size: .9rem; flex: 1; min-width: 0; }
.rp-dp { font-family: var(--mono); font-size: .72rem; font-weight: 600; color: var(--gold-bright); white-space: nowrap; }
.rp-remove { width: 22px; height: 22px; flex: none; cursor: pointer; border-radius: 4px; background: transparent; color: var(--muted); border: 1px solid var(--line2); font-size: .95rem; line-height: 1; }
.rp-remove:hover { color: var(--red-bright); border-color: var(--red-bright); }
.rp-dets { display: flex; flex-wrap: wrap; gap: 5px; }
.rp-det { --disp: var(--gold); display: inline-flex; align-items: center; gap: 6px; font-size: .76rem; padding: 2px 4px 2px 8px; border-radius: 4px; background: color-mix(in srgb, var(--disp) 10%, var(--panel2)); border: 1px solid color-mix(in srgb, var(--disp) 35%, transparent); }
.rp-det .dot { width: 7px; height: 7px; transform: rotate(45deg); background: var(--disp); flex: none; }
.rp-det b { font-family: var(--mono); color: var(--gold-bright); }
.rp-x { width: 18px; height: 18px; flex: none; cursor: pointer; border: none; background: transparent; color: var(--muted); font-size: .9rem; line-height: 1; border-radius: 3px; }
.rp-x:hover { color: var(--red-bright); }
.rp-disp { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-top: 6px; border-top: 1px dashed var(--line2); }
.rp-disp.need { color: var(--gold-bright); }
.rp-disp-lbl { font-family: var(--mono); font-size: .64rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-right: 2px; }
.rp-disp-one { --disp: var(--gold); display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; color: color-mix(in srgb, var(--disp) 80%, var(--text)); }
.rp-disp-one .dot { width: 8px; height: 8px; transform: rotate(45deg); background: var(--disp); }
.rp-disp-opt { --disp: var(--gold); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: .76rem; font-weight: 600; padding: 4px 9px; border-radius: 4px; background: transparent; color: var(--muted); border: 1px solid var(--line2); transition: border-color .12s, color .12s, background .12s; }
.rp-disp-opt .dot { width: 8px; height: 8px; transform: rotate(45deg); background: var(--disp); opacity: .55; }
.rp-disp-opt:hover:not(:disabled) { color: var(--text); border-color: color-mix(in srgb, var(--disp) 60%, transparent); }
.rp-disp-opt.is-active { background: color-mix(in srgb, var(--disp) 20%, var(--panel)); border-color: var(--disp); color: color-mix(in srgb, var(--disp) 85%, var(--text)); }
.rp-disp-opt.is-active .dot { opacity: 1; }
.rp-disp-opt.is-blocked { opacity: .35; cursor: not-allowed; text-decoration: line-through; }
.roster-status .rs-state.is-warn { color: var(--gold-bright); border-color: color-mix(in srgb, var(--gold) 55%, transparent); background: color-mix(in srgb, var(--gold) 12%, transparent); }
.roster-status .rs-dup.is-over b { color: var(--red-bright); }

/* barre roster : format + statut */
.roster-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; margin-bottom: calc(var(--u) * .8); }
.roster-modes button { padding: 7px 14px; }
.roster-modes.lang-switch button.is-active { background: var(--red); color: var(--on-accent); }
.roster-status { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; font-family: var(--mono); font-size: .76rem; color: var(--muted); }
.roster-status b { color: var(--text); font-weight: 600; }
.roster-status .rs-count.is-full b { color: var(--gold-bright); }
.roster-status .rs-state { padding: 3px 9px; border-radius: 4px; border: 1px solid var(--line2); color: var(--muted2); }
.roster-status .rs-state.is-ok { color: var(--dp1); border-color: color-mix(in srgb, var(--dp1) 55%, transparent); background: color-mix(in srgb, var(--dp1) 12%, transparent); }
.roster-bar #rosterReset { margin-left: auto; }

/* couverture des dispositions */
.roster-coverage { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: calc(var(--u) * 1); }
.cov-chip {
  --disp: var(--gold); display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 10px; border-radius: var(--radius2); font-size: .78rem; font-weight: 600;
  border: 1px dashed color-mix(in srgb, var(--disp) 40%, var(--line2)); color: var(--muted2);
  background: transparent;
}
.cov-chip .dot { width: 8px; height: 8px; transform: rotate(45deg); background: var(--disp); opacity: .4; }
.cov-chip.is-on { border-style: solid; color: var(--text); background: color-mix(in srgb, var(--disp) 12%, var(--panel)); border-color: color-mix(in srgb, var(--disp) 55%, transparent); }
.cov-chip.is-on .dot { opacity: 1; }
.cov-chip b { font-family: var(--mono); color: color-mix(in srgb, var(--disp) 80%, var(--text)); }

/* ───────── builder ───────── */
.builder { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: calc(var(--u) * 1.8); align-items: start; }
@media (max-width: 960px) { .builder { grid-template-columns: 1fr; } }
.builder-right { position: sticky; top: calc(var(--u) * 1); }
@media (max-width: 960px) { .builder-right { position: static; } }

/* Expansion dynamique au survol : la colonne survolée s'élargit, l'autre se compacte.
   Au repos (souris ailleurs), retour à la répartition par défaut. */
@media (min-width: 961px) and (hover: hover) {
  .builder { transition: grid-template-columns .35s ease; }
  .builder:has(.builder-left:hover) { grid-template-columns: minmax(0, 8fr) minmax(0, 3fr); }
  .builder:has(.builder-right:hover) { grid-template-columns: minmax(0, 3fr) minmax(0, 8fr); }
  .builder-left, .builder-right { transition: opacity .35s ease; }
  .builder:has(.builder-left:hover) .builder-right,
  .builder:has(.builder-right:hover) .builder-left { opacity: .6; }
}

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: calc(var(--u) * .8); }
.field label { font-family: var(--mono); font-size: .68rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.field select, .save-row input {
  width: 100%; padding: 10px 12px; font-family: var(--font); font-size: .92rem;
  border: 1px solid var(--line2); border-radius: var(--radius2);
  background: var(--panel); color: var(--text); transition: border-color .15s;
}
.field select:focus, .save-row input:focus { outline: none; border-color: var(--gold); }

.detach-list { display: flex; flex-direction: column; gap: calc(var(--u) * .4); max-height: 64vh; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; }
.det {
  --disp: var(--gold);
  display: flex; align-items: center; gap: 12px;
  padding: calc(var(--u) * .55) calc(var(--u) * .75);
  background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--disp); border-radius: var(--radius2);
  transition: border-color .15s, background .15s;
}
.det:hover { border-color: color-mix(in srgb, var(--disp) 40%, var(--line)); }
.det.is-selected { background: color-mix(in srgb, var(--disp) 6%, var(--panel)); }
.det .d-main { flex: 1; min-width: 0; }
.det .d-name { font-weight: 600; font-size: .9rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.det .d-sub { font-size: .76rem; color: var(--muted); margin-top: 2px; }
.det .d-sub .d-disp { color: color-mix(in srgb, var(--disp) 80%, var(--text)); font-weight: 600; }
.det .dp { font-family: var(--mono); font-size: .78rem; font-weight: 600; color: var(--gold-bright); white-space: nowrap; letter-spacing: .04em; }
.badge-new { font-family: var(--mono); font-size: .58rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-bright); border: 1px solid var(--gold-dim); padding: 2px 6px; border-radius: 3px; }
.add-btn, .rm-btn { width: 30px; height: 30px; flex: none; cursor: pointer; border-radius: var(--radius2); font-size: 1.05rem; line-height: 1; display: grid; place-items: center; transition: background .15s, transform .12s, opacity .15s; }
.add-btn { background: transparent; color: var(--gold-bright); border: 1px solid var(--gold-dim); font-weight: 700; }
.add-btn:hover:not(:disabled) { background: color-mix(in srgb, var(--gold) 18%, transparent); transform: scale(1.06); }
.add-btn:disabled { opacity: .3; cursor: not-allowed; }
.add-btn.is-added { border-color: transparent; color: var(--muted2); }
.rm-btn { background: transparent; color: var(--muted); border: 1px solid var(--line2); }
.rm-btn:hover { color: var(--red-bright); border-color: var(--red-bright); }

/* Budget DP : 3 segments */
.dp-bar { display: flex; align-items: center; gap: 10px; margin-bottom: calc(var(--u) * .9); }
.dp-segs { display: flex; gap: 5px; flex: 1; }
.dp-seg { height: 10px; flex: 1; border-radius: 3px; background: color-mix(in srgb, var(--text) 9%, transparent); border: 1px solid var(--line); transition: background .2s, border-color .2s, box-shadow .2s; }
.dp-seg.is-filled { background: linear-gradient(90deg, var(--gold-dim), var(--gold)); border-color: var(--gold-dim); }
.dp-bar.is-full .dp-seg.is-filled { background: linear-gradient(90deg, var(--red), var(--red-bright)); border-color: var(--red); box-shadow: 0 0 10px color-mix(in srgb, var(--red-bright) 35%, transparent); }
.dp-label { font-family: var(--mono); font-size: .76rem; letter-spacing: .08em; color: var(--muted); white-space: nowrap; }
.dp-label b { color: var(--text); font-weight: 600; }

.list-current { display: flex; flex-direction: column; gap: calc(var(--u) * .4); margin-bottom: calc(var(--u) * .6); }

.save-row { margin-top: calc(var(--u) * 1.1); display: flex; flex-direction: column; gap: calc(var(--u) * .55); }
.save-actions { display: flex; gap: calc(var(--u) * .55); }
.btn { flex: 1; padding: 11px; cursor: pointer; font-weight: 600; font-size: .9rem; border-radius: var(--radius2); letter-spacing: .02em; background: transparent; color: var(--text); border: 1px solid var(--line2); transition: border-color .15s, background .15s, filter .15s; }
.btn:hover { border-color: var(--gold); }
.btn--accent { background: var(--red); border-color: color-mix(in srgb, var(--red-bright) 50%, transparent); color: var(--on-accent); }
.btn--accent:hover { filter: brightness(1.18); border-color: var(--red-bright); }
.save-hint { font-size: .8rem; color: var(--muted); min-height: 1.2em; }
.save-hint a { color: var(--gold-bright); }

.saved-list { display: flex; flex-direction: column; gap: calc(var(--u) * .35); }
.saved-item { display: flex; align-items: center; gap: 10px; padding: calc(var(--u) * .5) calc(var(--u) * .65); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius2); }
.saved-item .s-main { flex: 1; min-width: 0; cursor: pointer; }
.saved-item .s-name { font-weight: 600; font-size: .88rem; }
.saved-item .s-sub { font-size: .74rem; color: var(--muted); font-family: var(--mono); }

/* ───────── modale mission ───────── */
.modal { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(8,6,4,.72); backdrop-filter: blur(3px); }
.modal-card {
  position: relative; z-index: 1; width: min(1060px, 94vw);
  /* Redimensionnable : on tire le coin bas-droit pour agrandir/réduire. */
  max-width: calc(100vw - 40px); max-height: calc(100vh - 40px);
  min-width: 340px; min-height: 220px;
  overflow: auto; resize: both; overflow-wrap: break-word;
  background: var(--panel); border: 1px solid var(--gold-dim); border-radius: var(--radius);
  padding: calc(var(--u) * 1.6) calc(var(--u) * 1.7) calc(var(--u) * 1.7);
  box-shadow: var(--shadow-lg); animation: modalIn .2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .modal-card { animation: none; } }
body.ornaments .modal-card::before, body.ornaments .modal-card::after { content: ''; position: absolute; width: 18px; height: 18px; pointer-events: none; }
body.ornaments .modal-card::before { top: 7px; left: 7px; border-top: 2px solid var(--gold); border-left: 2px solid var(--gold); }
body.ornaments .modal-card::after { bottom: 7px; right: 7px; border-bottom: 2px solid var(--gold); border-right: 2px solid var(--gold); }
.modal-close { position: absolute; top: 12px; right: 14px; z-index: 2; background: none; border: none; color: var(--muted); font-size: 1.6rem; line-height: 1; cursor: pointer; transition: color .15s; }
.modal-close:hover { color: var(--gold-bright); }

.m-head { --disp: var(--gold); border-left: 4px solid var(--disp); padding-left: 14px; margin-bottom: calc(var(--u) * 1); }
.m-vs { font-family: var(--mono); font-size: .68rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.m-vs .me  { color: color-mix(in srgb, var(--disp) 82%, var(--text)); }
.m-vs .opp { color: color-mix(in srgb, var(--oppc, var(--gold)) 82%, var(--text)); }
.m-title { font-size: 1.65rem; font-weight: 700; line-height: 1.08; margin: 6px 0 4px; text-wrap: pretty; }
.m-sub { font-family: var(--mono); font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.m-intro { font-style: italic; color: var(--muted); line-height: 1.5; margin-bottom: calc(var(--u) * 1.1); font-size: .94rem; }
.m-block { margin-bottom: calc(var(--u) * 1); }
.m-phase {
  --disp: var(--gold);
  font-family: var(--mono); font-size: .7rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: color-mix(in srgb, var(--disp) 85%, var(--text));
  background: color-mix(in srgb, var(--disp) 11%, transparent);
  border-left: 3px solid var(--disp); padding: 8px 11px; border-radius: 0 var(--radius2) var(--radius2) 0;
}
.m-when { font-size: .8rem; color: var(--muted); margin: 8px 0 2px; }
.m-when b { color: var(--text); font-weight: 600; }
.m-note { font-size: .85rem; color: var(--muted); margin: 8px 0; line-height: 1.45; }
.m-entry { display: flex; gap: 16px; align-items: baseline; padding: 9px 0; border-bottom: 1px dashed var(--line2); }
.m-entry.is-cumul { padding-left: 16px; }
.m-entry .t { flex: 1; font-size: .9rem; line-height: 1.45; }
.m-entry .pts { font-family: var(--mono); font-weight: 600; font-size: .92rem; color: var(--gold-bright); white-space: nowrap; }
.m-actionnote { margin-top: calc(var(--u) * .9); font-size: .82rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: calc(var(--u) * .7); }

/* ───────── signalement d'erreur ───────── */
/* Picto warning en haut à droite de chaque carte. */
.m-report-btn {
  position: absolute; top: 0; right: 0; z-index: 2;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  width: 30px; height: 30px; border-radius: 50%;
  background: color-mix(in srgb, var(--red) 10%, var(--panel)); color: var(--red-bright);
  border: 1px solid color-mix(in srgb, var(--red) 45%, transparent);
  transition: background .15s, border-color .15s, transform .12s;
}
.m-report-btn:hover { background: color-mix(in srgb, var(--red) 22%, var(--panel)); border-color: var(--red-bright); transform: translateY(-1px); }
.m-report-btn .material-symbols-outlined { font-size: 18px; }

/* Popup de signalement, par-dessus la carte de mission. */
.report-popup { position: fixed; inset: 0; z-index: 1200; display: grid; place-items: center; padding: 18px; }
.report-popup[hidden] { display: none; }
.report-popup-backdrop { position: absolute; inset: 0; background: rgba(8,6,4,.78); backdrop-filter: blur(3px); }
.report-popup-card {
  position: relative; z-index: 1; width: min(520px, 94vw); max-height: 90vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--gold-dim); border-radius: var(--radius);
  padding: calc(var(--u) * 1.3) calc(var(--u) * 1.4) calc(var(--u) * 1.4);
  box-shadow: var(--shadow-lg); animation: modalIn .2s ease;
}
.report-popup-close { position: absolute; top: 10px; right: 12px; background: none; border: none; color: var(--muted); font-size: 1.5rem; line-height: 1; cursor: pointer; transition: color .15s; }
.report-popup-close:hover { color: var(--gold-bright); }
.report-popup-title { display: flex; align-items: center; gap: 9px; font-size: 1.15rem; font-weight: 700; margin: 0 0 6px; }
.report-popup-title .material-symbols-outlined { color: var(--red-bright); font-size: 22px; }
.report-popup-sub { font-size: .84rem; color: var(--muted); line-height: 1.45; margin-bottom: calc(var(--u) * .9); }
#reportPopupText {
  width: 100%; resize: vertical; min-height: 96px; font-family: var(--font); font-size: .92rem;
  color: var(--text); background: var(--panel2); border: 1px solid var(--line2);
  border-radius: var(--radius2); padding: 10px 12px;
}
#reportPopupText:focus { outline: none; border-color: var(--gold); }
.report-popup-hint { font-size: .82rem; color: var(--muted); min-height: 1.1em; margin: 8px 0 0; }
.report-popup-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: calc(var(--u) * .9); }
.report-popup-actions button {
  cursor: pointer; font-family: var(--font); font-weight: 600; font-size: .88rem;
  padding: 9px 18px; border-radius: var(--radius2); border: 1px solid var(--line2);
  background: transparent; color: var(--text); transition: border-color .15s, background .15s, filter .15s;
}
.m-report-cancel:hover { border-color: var(--gold); }
.m-report-send { background: var(--red); border-color: color-mix(in srgb, var(--red-bright) 50%, transparent); color: var(--on-accent); }
.m-report-send:hover:not(:disabled) { filter: brightness(1.15); border-color: var(--red-bright); }
.m-report-send:disabled { opacity: .5; cursor: not-allowed; }

/* ───────── bouton & popup « Copier » (capture image) ───────── */
.m-copy-btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  background: var(--panel); color: var(--gold-bright);
  border: 1px solid var(--gold-dim); border-radius: var(--radius2);
  font-family: var(--mono); font-size: .72rem; font-weight: 600; letter-spacing: .04em;
  padding: 6px 11px; transition: background .15s, border-color .15s, color .15s;
}
.m-copy-btn:hover { background: color-mix(in srgb, var(--gold) 16%, var(--panel)); border-color: var(--gold); }
.m-copy-btn .material-symbols-outlined { font-size: 17px; }

.copy-layout-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: calc(var(--u) * .5); }
.copy-layout-opt {
  display: flex; flex-direction: column; gap: 6px; padding: 6px; cursor: pointer;
  background: var(--panel2); border: 1px solid var(--line2); border-radius: var(--radius2);
  color: var(--muted); transition: border-color .15s, color .15s, background .15s;
}
.copy-layout-opt:hover { border-color: var(--gold-dim); color: var(--text); }
.copy-layout-opt img { width: 100%; height: auto; display: block; border-radius: 3px; }
.copy-layout-opt .copy-layout-label { font-family: var(--mono); font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; text-align: center; }
.copy-layout-opt.is-selected { border-color: var(--gold); color: var(--gold-bright); background: color-mix(in srgb, var(--gold) 12%, var(--panel2)); box-shadow: inset 0 0 0 1px var(--gold); }
.copy-layout-none { justify-content: center; min-height: 64px; }

/* Conteneur offscreen pour le rendu html2canvas (jamais visible). */
#exportStage { position: fixed; left: -10000px; top: 0; z-index: -1; pointer-events: none; }

/* ───────── composition exportée (html2canvas) ─────────
   Scopée .export-capture : AUCUN color-mix (html2canvas ne sait pas le parser),
   uniquement des couleurs pleines + var(--disp)/--oppc (posés en hex inline). */
.export-capture { width: 1080px; box-sizing: border-box; background: var(--panel); color: var(--text); font-family: var(--font); padding: 28px 30px 30px; }
.export-capture .export-banner { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--gold-dim); padding-bottom: 12px; margin-bottom: 22px; }
.export-capture .export-title { font-family: var(--mono); font-size: .8rem; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); }
.export-capture .export-pair { font-size: 1.15rem; font-weight: 700; color: var(--text); }
.export-capture .export-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.export-capture .m-side { position: static; }
.export-capture .m-side--opp { border-left: 1px solid var(--line); padding-left: 30px; }
.export-capture .export-layout { margin-top: 26px; text-align: center; }
.export-capture .export-layout img { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; }
/* Neutralisation des color-mix présents dans les .m-* affichées */
.export-capture .m-vs .me { color: var(--disp); }
.export-capture .m-vs .opp { color: var(--oppc, var(--gold)); }
.export-capture .m-side--opp .m-side-role { color: var(--disp); }
/* Couleur/bordure de phase = couleur de disposition (inline --disp) ; le fond
   teinté est posé en JS (rgba) pour éviter color-mix, illisible par html2canvas. */
.export-capture .m-phase { color: var(--disp); border-left: 3px solid var(--disp); }

.m-verify { font-size: .72rem; color: var(--muted2); font-style: italic; }

/* ───────── layouts recommandés (modale mission) ───────── */
.layout-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: calc(var(--u) * .6); margin-top: calc(var(--u) * .7); }
.layout-thumb {
  display: flex; flex-direction: column; gap: 6px; padding: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius2);
  cursor: zoom-in; transition: border-color .15s, transform .15s;
}
.layout-thumb:hover { border-color: var(--gold-dim); transform: translateY(-2px); }
.layout-thumb img { width: 100%; height: auto; display: block; border-radius: 3px; }
.layout-thumb .layout-label { font-family: var(--mono); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); text-align: center; }

.lightbox { position: fixed; inset: 0; z-index: 1100; display: grid; place-items: center; padding: 16px; background: rgba(8,6,4,.85); backdrop-filter: blur(3px); cursor: zoom-out; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 94vw; max-height: 94vh; border-radius: var(--radius2); box-shadow: var(--shadow-lg); }
.lightbox-close { position: absolute; top: 14px; right: 18px; background: none; border: none; color: var(--muted); font-size: 2rem; line-height: 1; cursor: pointer; transition: color .15s; }
.lightbox-close:hover { color: var(--gold-bright); }

@media (max-width: 560px) {
  .layout-grid { grid-template-columns: 1fr; }
}

/* ───────── switch langue FR/EN (contenu des missions) ───────── */
.lang-switch { display: inline-flex; border: 1px solid var(--line2); border-radius: var(--radius2); overflow: hidden; }
.lang-switch button {
  background: transparent; color: var(--muted); cursor: pointer; border: none;
  font-family: var(--mono); font-size: .72rem; font-weight: 600; letter-spacing: .08em;
  padding: 6px 12px; transition: background .15s, color .15s;
}
.lang-switch button + button { border-left: 1px solid var(--line2); }
.lang-switch button:hover { color: var(--gold-bright); }
.lang-switch button.is-active { background: var(--accent); color: var(--on-accent); }
/* ───────── double affichage mission (nous / adversaire) ───────── */
/* Barre de contrôle : switch langue + bouton « retourner » (mobile). */
.m-controls { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin: 0 30px calc(var(--u) * 1.1) 0; }
.m-controls .lang-switch { background: var(--panel); }

/* Bouton « retourner la carte » : double flèche circulaire. Mobile uniquement. */
.m-flip {
  display: none; align-items: center; justify-content: center; cursor: pointer;
  width: 36px; height: 36px; flex: none; border-radius: 50%;
  background: var(--panel); color: var(--gold-bright);
  border: 1px solid var(--gold-dim); transition: background .15s, transform .25s, color .15s;
}
.m-flip:hover { background: color-mix(in srgb, var(--gold) 16%, var(--panel)); }
.m-flip:active { transform: scale(.92); }
.m-flip .material-symbols-outlined { font-size: 22px; transition: transform .35s ease; }
.m-flip.is-flipped { color: var(--red-bright); border-color: var(--red); }
.m-flip.is-flipped .material-symbols-outlined { transform: rotate(180deg); }

/* Desktop : deux missions côte à côte, séparées par une hairline. */
.m-duo { display: grid; grid-template-columns: 1fr 1fr; gap: calc(var(--u) * 1.6); }
.m-side { min-width: 0; position: relative; }
.m-side--opp { border-left: 1px solid var(--line); padding-left: calc(var(--u) * 1.6); }
.m-side-role {
  font-family: var(--mono); font-size: .64rem; font-weight: 600; letter-spacing: .2em; text-transform: uppercase;
  color: var(--gold); margin-bottom: calc(var(--u) * .6);
  display: flex; align-items: center; gap: 9px; padding-right: 38px;
}
.m-side-role::after { content: ''; flex: 1; height: 1px; background: var(--line2); opacity: .7; }
.m-side--opp .m-side-role { color: color-mix(in srgb, var(--disp) 78%, var(--text)); }

/* Mobile : une seule mission visible, basculée par le bouton « retourner ». */
@media (max-width: 760px) {
  /* La modale remplit l'écran (petites marges) : min-width:0 évite tout
     débordement horizontal (sinon l'élément de grille garde sa taille min-content). */
  .modal { padding: 10px; }
  .modal-card {
    width: 100%; max-width: 100%; min-width: 0;
    max-height: calc(100vh - 20px); resize: none;
    padding: calc(var(--u) * 1.15) calc(var(--u) * 1.05) calc(var(--u) * 1.3);
  }
  .m-flip { display: inline-flex; }
  .m-controls { flex-wrap: wrap; }
  .m-copy-label { display: none; }
  .m-copy-btn { padding: 6px 9px; }
  .m-duo { grid-template-columns: 1fr; gap: 0; }
  .m-side--opp { border-left: none; padding-left: 0; }
  .m-duo[data-face="me"] .m-side--opp,
  .m-duo[data-face="opp"] .m-side--me { display: none; }
  /* Titre un peu plus compact pour éviter les retours sur 3 lignes. */
  .m-title { font-size: 1.4rem; }
  .m-controls { margin-right: 34px; }
}
