/* FD – Dés Star Wars CSS v1.4.0 — Imperial DataPad */

/* ─── Variables ─────────────────────────────────────────────────────────── */
:root {
  --fd-bg:        #05090e;
  --fd-panel:     #080e18;
  --fd-border:    rgba(93,210,255,.18);
  --fd-border-hi: rgba(93,210,255,.45);
  --fd-neon:      #5dd2ff;
  --fd-neon2:     #4ef5b0;
  --fd-red:       #f5554a;
  --fd-gold:      #f5c842;
  --fd-text:      rgba(220,238,255,.92);
  --fd-muted:     rgba(140,185,220,.60);
  --fd-glow:      rgba(93,210,255,.22);
  --fd-scan:      rgba(255,255,255,.025);
  --fd-font:      ui-monospace, "SFMono-Regular", "Courier New", monospace;
}

/* ─── ZONES PRINCIPALES ──────────────────────────────────────────────────── */
#fd-zone-mj,
#fd-zone-joueur,
#fd-historique-jets {
  position: relative;
  padding: 14px 16px;
  margin: 10px 0;
  border: 1px solid var(--fd-border);
  border-radius: 14px;
  color: var(--fd-text);
  background:
    radial-gradient(900px 400px at 15% 0%, rgba(50,130,255,.07), transparent 55%),
    linear-gradient(180deg, rgba(8,14,24,.97), rgba(5,9,16,.95));
  box-shadow:
    0 0 0 1px rgba(93,210,255,.05) inset,
    0 20px 60px rgba(0,0,0,.65),
    0 0 40px rgba(93,210,255,.06);
  overflow: hidden;
}

/* Grille holographique de fond */
#fd-zone-mj::before,
#fd-zone-joueur::before,
#fd-historique-jets::before {
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(to right,  rgba(93,210,255,.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(93,210,255,.025) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  opacity: .5;
}

/* Scanlines subtiles */
#fd-zone-mj::after,
#fd-zone-joueur::after,
#fd-historique-jets::after {
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    180deg,
    var(--fd-scan) 0, var(--fd-scan) 1px,
    transparent 1px, transparent 6px
  );
  pointer-events: none;
  opacity: .5;
}

/* Contenu au-dessus des pseudo-éléments */
#fd-zone-mj > *,
#fd-zone-joueur > *,
#fd-historique-jets > * { position: relative; z-index: 1; }

/* ─── TITRES ─────────────────────────────────────────────────────────────── */
#fd-zone-mj h3,
#fd-zone-joueur h3,
#fd-historique-jets h3,
#fd-zone-mj h4,
#fd-zone-joueur h4,
#fd-historique-jets h4 {
  margin: 0 0 10px 0;
  letter-spacing: .10em;
  text-transform: uppercase;
  font-family: var(--fd-font);
  font-weight: 700;
  font-size: 13px;
  color: var(--fd-neon);
  text-shadow: 0 0 18px rgba(93,210,255,.45);
  border-bottom: 1px solid var(--fd-border);
  padding-bottom: 8px;
}

#fd-zone-mj h4,
#fd-zone-joueur h4,
#fd-historique-jets h4 {
  font-size: 11px;
  color: rgba(140,185,220,.80);
  text-shadow: none;
  border-color: rgba(93,210,255,.10);
  margin-top: 20px;
}

/* ─── LABELS & FORMULAIRES ───────────────────────────────────────────────── */
#fd-zone-mj label,
#fd-zone-joueur label {
  display: block;
  margin: 6px 0;
  font-family: var(--fd-font);
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: rgba(140,185,220,.75);
}

#fd-zone-mj input[type="number"],
#fd-zone-mj input[type="text"],
#fd-zone-joueur input[type="number"],
#fd-zone-joueur input[type="text"] {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 7px 10px;
  border-radius: 7px;
  border: 1px solid var(--fd-border);
  background: rgba(0,0,0,.35);
  color: var(--fd-text);
  font-family: var(--fd-font);
  font-size: 12px;
  outline: none;
  box-sizing: border-box;
  transition: border-color .2s, box-shadow .2s;
}
#fd-zone-mj input:focus,
#fd-zone-joueur input:focus {
  border-color: var(--fd-border-hi);
  box-shadow: 0 0 0 2px rgba(93,210,255,.10);
}

#fd-zone-mj select,
#fd-zone-joueur select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 7px 10px;
  border-radius: 7px;
  border: 1px solid var(--fd-border);
  background: rgba(0,0,0,.45);
  color: var(--fd-text);
  font-family: var(--fd-font);
  font-size: 11px;
  outline: none;
  cursor: pointer;
  box-sizing: border-box;
  transition: border-color .2s;
}
#fd-zone-mj select:focus,
#fd-zone-joueur select:focus {
  border-color: var(--fd-border-hi);
}

/* ─── GRILLES DE FORMULAIRE ──────────────────────────────────────────────── */
.fd-sw-row {
  display: grid;
  gap: 8px;
  margin: 6px 0;
  align-items: start;
}
.fd-sw-row-2 { grid-template-columns: 1fr 1fr; }
.fd-sw-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.fd-sw-row-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
@media (max-width: 640px) {
  .fd-sw-row-2,
  .fd-sw-row-3,
  .fd-sw-row-4 { grid-template-columns: 1fr; }
}

/* Champ nombre + texte côte à côte */
.fd-sw-input-row {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 6px;
  margin-top: 4px;
}
.fd-sw-input-row input { margin-top: 0 !important; }

/* Info lines sous les selects */
.fd-sw-info-line,
.fd-sw-info-inline {
  font-size: 11px;
  color: var(--fd-muted);
  margin-top: 4px;
  line-height: 1.4;
}

/* Description label pleine largeur */
.fd-sw-label-desc { grid-column: 1 / -1; }

/* Header historique */
.fd-sw-hist-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.fd-sw-hist-header h4 { margin: 0; flex: 1; }

/* ─── MODIFICATEURS AVANCÉS REPLIABLES ───────────────────────────────────── */
.fd-sw-collapsible { margin: 6px 0; }
.fd-sw-collapse-toggle {
  background: transparent;
  border: 1px solid rgba(93,210,255,.15);
  border-radius: 7px;
  color: rgba(93,210,255,.6);
  font-family: var(--fd-font);
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 5px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  width: auto;
  transition: border-color .2s, color .2s;
}
.fd-sw-collapse-toggle:hover {
  border-color: rgba(93,210,255,.4);
  color: rgba(93,210,255,.9);
  box-shadow: none;
}
.fd-sw-collapse-caret { font-size: 9px; transition: transform .2s; }
.fd-sw-collapse-toggle.open .fd-sw-collapse-caret { transform: rotate(90deg); }
.fd-sw-collapse-body {
  display: none;
  padding: 8px 0 4px;
}
.fd-sw-collapse-body.open { display: block; }

/* Modificateurs manuels (fortune/infortune) */
.fd-sw-mods-main { margin: 6px 0; }

/* ─── FIELDSET (conservé pour compatibilité) ─────────────────────────────── */
#fd-zone-mj fieldset,
#fd-zone-joueur fieldset {
  border: 1px solid rgba(93,210,255,.12);
  border-radius: 10px;
  padding: 10px;
  margin: 8px 0;
  background: rgba(0,0,0,.18);
}
#fd-zone-mj fieldset legend,
#fd-zone-joueur fieldset legend {
  padding: 0 8px;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-family: var(--fd-font);
  font-size: 10px;
  color: rgba(93,210,255,.65);
}

/* ─── PREVIEW POOL ───────────────────────────────────────────────────────── */
.fd-sw-preview {
  margin: 14px 0;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid rgba(93,210,255,.20);
  background: radial-gradient(600px 60px at 10% 50%, rgba(30,100,200,.10), rgba(0,0,0,.12));
  font-family: var(--fd-font);
  font-size: 13px;
  min-height: 48px;
  line-height: 1.6;
}

/* ─── POOL SUMMARY ───────────────────────────────────────────────────────── */
.fd-pool-summary { line-height: 1.7; }
.fd-pool-label   { font-family: var(--fd-font); font-size:13px; color: var(--fd-text); display:block; margin-bottom:4px; }
.fd-pool-text    { font-size: 11px; margin-top: 4px; display:block; }
.fd-pool-dice    { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }

/* Dés pool — badges colorés */
.fd-pool-die {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: var(--fd-font);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  border: 1px solid currentColor;
}
.fd-die-vert  { color: #4ef07a; background: rgba(78,240,122,.10); }
.fd-die-jaune { color: #f5d63d; background: rgba(245,214,61,.10); }
.fd-die-bleu  { color: #5dd2ff; background: rgba(93,210,255,.10); }
.fd-die-noir  { color: #9aabb8; background: rgba(154,171,184,.08); }
.fd-die-mauve { color: #b87af5; background: rgba(184,122,245,.10); }
.fd-die-rouge { color: #f5554a; background: rgba(245,85,74,.10);  }
.fd-die-force { color: #e8e8f5; background: rgba(232,232,245,.08); }

/* ─── BOUTONS ────────────────────────────────────────────────────────────── */
#fd-zone-mj button,
#fd-zone-joueur button,
#fd-historique-jets button {
  appearance: none;
  border: 1px solid var(--fd-border-hi);
  background: linear-gradient(180deg, rgba(93,210,255,.14), rgba(93,210,255,.06));
  color: var(--fd-text);
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
  font-family: var(--fd-font);
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  font-size: 11px;
  margin-top: 12px;
  transition: filter .15s, transform .1s, box-shadow .2s;
  box-shadow: 0 0 18px rgba(93,210,255,.08);
}
#fd-zone-mj button:hover,
#fd-zone-joueur button:hover {
  filter: brightness(1.18);
  box-shadow: 0 0 24px rgba(93,210,255,.18);
}
#fd-zone-mj button:active,
#fd-zone-joueur button:active {
  transform: scale(.98);
}
#fd-zone-mj button:disabled,
#fd-zone-joueur button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.fd-sw-btn-small {
  padding: 6px 12px !important;
  font-size: 10px !important;
  margin-top: 6px !important;
}

/* ─── MESSAGES STATUS ────────────────────────────────────────────────────── */
#fd-mj-message,
#fd-jl-message {
  margin-top: 10px;
  font-family: var(--fd-font);
  font-size: 12px;
  color: var(--fd-neon2);
  min-height: 18px;
}

/* ─── CARTES JET ─────────────────────────────────────────────────────────── */
.fd-sw-card {
  position: relative;
  margin: 10px 0;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--fd-border);
  background: rgba(0,0,0,.22);
  transition: border-color .2s;
}
.fd-sw-card:hover { border-color: rgba(93,210,255,.30); }

.fd-sw-card-title {
  font-family: var(--fd-font);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .04em;
  margin-bottom: 4px;
  color: var(--fd-text);
}
.fd-sw-card-meta {
  font-family: var(--fd-font);
  font-size: 10px;
  letter-spacing: .05em;
  color: var(--fd-muted);
  margin-bottom: 8px;
}
.fd-sw-card-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 8px 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(0,0,0,.20);
  border: 1px solid rgba(255,255,255,.05);
}

/* Arme info */
.fd-weapon-line {
  font-family: var(--fd-font);
  font-size: 11px;
  color: var(--fd-gold);
  margin: 4px 0;
}

/* Resolve area */
.fd-sw-resolve-area {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.fd-sw-resolve-area input {
  flex: 1;
  min-width: 140px;
}
.fd-resolve-msg {
  font-family: var(--fd-font);
  font-size: 11px;
  margin-top: 4px;
  color: var(--fd-neon2);
}

/* ─── RÉSULTAT DE JET ────────────────────────────────────────────────────── */
.fd-roll-result {
  margin: 10px 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(93,210,255,.15);
}

.fd-verdict {
  display: inline-block;
  font-family: var(--fd-font);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .10em;
  padding: 3px 10px;
  border-radius: 6px;
  margin-bottom: 8px;
}
.fd-verdict-success {
  background: rgba(78,245,176,.15);
  border: 1px solid rgba(78,245,176,.40);
  color: var(--fd-neon2);
}
.fd-verdict-failure {
  background: rgba(245,85,74,.12);
  border: 1px solid rgba(245,85,74,.40);
  color: var(--fd-red);
}
.fd-verdict-triumph {
  background: rgba(245,200,66,.18);
  border: 2px solid rgba(245,200,66,.70);
  color: var(--fd-gold);
  font-size: 13px;
  letter-spacing: .12em;
  text-shadow: 0 0 12px rgba(245,200,66,.6);
  animation: fd-triumph-pulse 1.2s ease-in-out infinite alternate;
}
.fd-verdict-despair {
  background: rgba(192,80,240,.15);
  border: 2px solid rgba(192,80,240,.65);
  color: #d070f8;
  font-size: 13px;
  letter-spacing: .12em;
  text-shadow: 0 0 10px rgba(192,80,240,.5);
  animation: fd-despair-pulse 1.2s ease-in-out infinite alternate;
}
.fd-verdict-crit-success {
  border-color: var(--fd-gold);
  color: var(--fd-gold);
  text-shadow: 0 0 8px rgba(245,200,66,.4);
  font-size: 13px;
}
.fd-verdict-crit-failure {
  border-color: #d070f8;
  color: #d070f8;
  text-shadow: 0 0 8px rgba(192,80,240,.4);
  font-size: 13px;
}
@keyframes fd-triumph-pulse {
  from { box-shadow: 0 0 4px rgba(245,200,66,.3); }
  to   { box-shadow: 0 0 14px rgba(245,200,66,.7); }
}
@keyframes fd-despair-pulse {
  from { box-shadow: 0 0 4px rgba(192,80,240,.3); }
  to   { box-shadow: 0 0 14px rgba(192,80,240,.6); }
}

.fd-roll-symbols {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
  font-family: var(--fd-font);
  font-size: 13px;
}

.fd-roll-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 8px 0;
  padding: 8px;
  background: rgba(0,0,0,.15);
  border-radius: 8px;
  font-family: var(--fd-font);
  font-size: 11px;
}
.fd-die-roll {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid currentColor;
  opacity: .85;
}

/* ─── SYMBOLES NARRATIFS ─────────────────────────────────────────────────── */
.fd-sym-success  { color: var(--fd-neon2); font-weight: 700; }
.fd-sym-failure  { color: var(--fd-red);  font-weight: 700; }
.fd-sym-adv      { color: #5dd2ff; font-weight: 700; }
.fd-sym-threat   { color: #f59a45; font-weight: 700; }
.fd-sym-triumph  { color: var(--fd-gold); font-weight: 700; text-shadow: 0 0 8px rgba(245,200,66,.4); }
.fd-sym-despair  { color: #c050f0; font-weight: 700; }
.fd-sym-light    { color: #e8e8f5; font-weight: 700; }
.fd-sym-dark     { color: #9070c0; font-weight: 700; }

/* ─── HISTORIQUE TABLE ───────────────────────────────────────────────────── */
.fd-sw-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-family: var(--fd-font);
  font-size: 11px;
}
.fd-sw-table th,
.fd-sw-table td {
  border: 1px solid rgba(93,210,255,.08);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}
.fd-sw-table th {
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 10px;
  color: rgba(93,210,255,.70);
  background: rgba(0,0,0,.30);
}
.fd-sw-table tr:hover td {
  background: rgba(93,210,255,.03);
}
.fd-pool-cell {
  font-size: 10px;
}

/* ─── UTILITAIRES ────────────────────────────────────────────────────────── */
.fd-sw-muted  { color: var(--fd-muted); font-size: 12px; }
.fd-sw-empty  { padding: 14px; color: var(--fd-muted); font-style: italic; font-family: var(--fd-font); font-size: 12px; }
.fd-sw-error  {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(245,85,74,.35);
  color: rgba(255,130,120,.90);
  background: rgba(245,85,74,.06);
  font-family: var(--fd-font);
  font-size: 12px;
}

.fd-sw-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.fd-sw-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr));
  gap: 10px;
}
.fd-sw-grid-2 { grid-template-columns: repeat(2, minmax(180px, 1fr)); }

@media (max-width: 900px) { .fd-sw-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .fd-sw-grid, .fd-sw-grid-2 { grid-template-columns: 1fr; } }

hr {
  border: none;
  border-top: 1px solid rgba(93,210,255,.10);
  margin: 20px 0;
}

/* ─── BOUTON DANGER ──────────────────────────────────────────────────────── */
.fd-btn-danger {
  border-color: rgba(245,85,74,.55) !important;
  background: linear-gradient(180deg, rgba(245,85,74,.14), rgba(245,85,74,.06)) !important;
  color: #f5887e !important;
}
.fd-btn-danger:hover {
  filter: brightness(1.2) !important;
  box-shadow: 0 0 16px rgba(245,85,74,.22) !important;
}

/* ─── ACTIONS HISTORIQUE MJ ──────────────────────────────────────────────── */
.fd-history-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}
.fd-history-count {
  font-family: var(--fd-font);
  font-size: 11px;
}

/* ─── MODAL HISTORIQUE ───────────────────────────────────────────────────── */
#fd-history-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
}

.fd-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(4px);
}

.fd-modal-box {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1100px;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  border: 1px solid var(--fd-border-hi);
  background:
    radial-gradient(900px 400px at 50% 0%, rgba(50,130,255,.08), transparent 60%),
    linear-gradient(180deg, rgba(8,14,24,.99), rgba(5,9,16,.98));
  box-shadow:
    0 0 0 1px rgba(93,210,255,.06) inset,
    0 32px 80px rgba(0,0,0,.80),
    0 0 60px rgba(93,210,255,.10);
  overflow: hidden;
}

.fd-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--fd-border);
  flex-shrink: 0;
}

.fd-modal-title {
  font-family: var(--fd-font);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--fd-neon);
  text-shadow: 0 0 18px rgba(93,210,255,.45);
}

.fd-modal-close {
  appearance: none;
  background: transparent;
  border: 1px solid rgba(93,210,255,.25);
  color: var(--fd-muted);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  margin: 0 !important;
  transition: color .15s, border-color .15s;
}
.fd-modal-close:hover {
  color: var(--fd-text);
  border-color: rgba(93,210,255,.55);
}

.fd-modal-body {
  overflow-y: auto;
  padding: 18px 22px;
  flex: 1;
  font-family: var(--fd-font);
  font-size: 12px;
}

/* Indicateur de polling actif */
@keyframes fd-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}
.fd-poll-indicator {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fd-neon2);
  margin-left: 8px;
  vertical-align: middle;
  animation: fd-pulse 2.5s ease-in-out infinite;
}

/* =====================================================
   Calcul de combat v2.0
   ===================================================== */
.fd-pnj-line {
  margin: 4px 0;
  padding: 5px 10px;
  background: rgba(120, 220, 255, 0.06);
  border-left: 2px solid rgba(120, 220, 255, 0.4);
  border-radius: 0 6px 6px 0;
  font-size: 12px;
  color: rgba(190, 245, 255, 0.85);
}
.fd-pnj-portrait-mini {
  width: 28px; height: 28px;
  object-fit: cover; border-radius: 50%;
  vertical-align: middle; margin-left: 6px;
  border: 1px solid rgba(120,220,255,0.3);
}

.fd-combat-rapport {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(120, 220, 255, 0.25);
  border-radius: 8px;
  background: rgba(8, 18, 30, 0.5);
}
.fd-combat-echec {
  border-color: rgba(255, 80, 80, 0.3);
  color: rgba(255, 150, 150, 0.85);
}
.fd-combat-header {
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(120, 220, 255, 0.6);
  margin-bottom: 6px;
}
.fd-combat-header strong { color: rgba(190, 245, 255, 0.9); font-size: 13px; }
.fd-combat-degats {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 8px;
}
.fd-combat-num {
  font-size: 28px;
  font-weight: 900;
  color: rgba(120, 220, 255, 1);
  line-height: 1;
}
.fd-combat-unit {
  font-size: 12px;
  color: rgba(190, 245, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.fd-combat-details {
  margin: 0 0 8px;
  padding: 0 0 0 16px;
  font-size: 12px;
  color: rgba(220, 250, 255, 0.85);
  line-height: 1.6;
}
.fd-combat-caps { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.fd-combat-cap {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.4;
}
.fd-cap-active {
  background: rgba(255, 150, 50, 0.1);
  border: 1px solid rgba(255, 150, 50, 0.25);
  color: rgba(255, 200, 120, 0.9);
}
.fd-cap-fortune {
  background: rgba(255, 200, 50, 0.1);
  border: 1px solid rgba(255, 200, 50, 0.25);
  color: rgba(255, 230, 120, 0.9);
}
.fd-combat-pnj-statut {
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}
.fd-pnj-dead {
  background: rgba(220, 50, 50, 0.15);
  border: 1px solid rgba(220, 50, 50, 0.4);
  color: rgba(255, 120, 120, 1);
}
.fd-pnj-alive {
  background: rgba(50, 180, 50, 0.1);
  border: 1px solid rgba(50, 180, 50, 0.3);
  color: rgba(120, 220, 120, 0.9);
}

/* PNJ attaquant — style "danger" */
.fd-pnj-attaquant {
  background: rgba(220, 60, 60, 0.1);
  border-left-color: rgba(220, 60, 60, 0.6);
  color: rgba(255, 160, 160, 0.9);
}
.fd-pnj-attaquant strong { color: rgba(255, 120, 120, 1); }

/* Capacités par type */
.fd-cap-critique {
  background: rgba(255, 100, 30, 0.15);
  border: 1px solid rgba(255, 100, 30, 0.4);
  color: rgba(255, 160, 100, 0.95);
  font-weight: 700;
}
.fd-cap-controle {
  background: rgba(180, 80, 220, 0.12);
  border: 1px solid rgba(180, 80, 220, 0.35);
  color: rgba(210, 150, 255, 0.9);
}
.fd-cap-info {
  background: rgba(100, 180, 255, 0.06);
  border: 1px solid rgba(100, 180, 255, 0.2);
  color: rgba(150, 200, 255, 0.6);
  font-size: 10px;
}

/* ── Auto-confirmation joueur ──────────────────────────────────── */
.fd-auto-confirm-label {
  font-size: 11px;
  color: rgba(100,200,255,.6);
  margin-top: 10px;
  text-align: right;
  font-style: italic;
}
.fd-auto-confirm-bar {
  height: 3px;
  background: rgba(100,200,255,.15);
  border-radius: 2px;
  margin-top: 4px;
  overflow: hidden;
}
.fd-auto-confirm-progress {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, rgba(0,255,160,.6), rgba(100,200,255,.6));
  border-radius: 2px;
  transition: width 8s linear;
}

/* Disparition de la carte après résolution */
.fd-card-resolving {
  opacity: 0;
  transform: translateY(-6px) scale(.98);
  transition: opacity .5s ease, transform .5s ease;
  pointer-events: none;
}

/* ── Toasts résultats jets (Vue MJ) ──────────────────────────────── */
#fd-roll-toast-container {
  position: fixed;
  top: 50%;
  right: 32px;
  transform: translateY(-50%);
  z-index: 99990;
  display: flex;
  flex-direction: column-reverse;
  gap: 12px;
  pointer-events: none;
  max-width: 400px;
}

.fd-roll-toast {
  background: rgba(8, 16, 14, 0.97);
  border: 1px solid rgba(0, 255, 160, 0.4);
  border-radius: 14px;
  box-shadow: 0 8px 40px rgba(0,0,0,.8);
  overflow: hidden;
  pointer-events: all;
  opacity: 0;
  transform: translateX(24px);
  transition: opacity .25s ease, transform .25s ease;
  min-width: 340px;
}
.fd-roll-toast.fd-toast-visible {
  opacity: 1;
  transform: translateX(0);
}
.fd-roll-toast.fd-toast-leaving {
  opacity: 0;
  transform: translateX(20px);
  transition: opacity .35s ease, transform .35s ease;
}

.fd-toast-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 8px;
  border-bottom: 1px solid rgba(0,255,160,.12);
}
.fd-toast-player {
  font-size: 14px;
  font-weight: 700;
  color: rgba(0,255,160,.95);
  flex: 1;
}
.fd-toast-type {
  font-size: 11px;
  opacity: .45;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.fd-toast-close {
  background: none;
  border: none;
  color: rgba(255,255,255,.35);
  cursor: pointer;
  font-size: 15px;
  padding: 0 2px;
  line-height: 1;
}
.fd-toast-close:hover { color: rgba(255,255,255,.7); }

.fd-toast-body {
  padding: 10px 14px 10px;
}
.fd-toast-weapon {
  font-size: 12px;
  color: rgba(255,200,100,.8);
  margin-bottom: 6px;
}
.fd-toast-result {
  font-size: 15px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.fd-toast-combat-wrap {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,120,80,.18);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.fd-toast-degats {
  font-size: 16px;
  font-weight: 700;
  color: rgba(255,140,100,.95);
}
.fd-toast-degats strong {
  font-size: 20px;
  color: rgba(255,100,60,1);
}
.fd-toast-crit {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
  background: rgba(255,140,30,.2);
  border: 1px solid rgba(255,140,30,.5);
  color: rgba(255,180,60,1);
  border-radius: 4px;
  padding: 1px 7px;
  vertical-align: middle;
  margin-left: 6px;
}
.fd-toast-effets {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.fd-toast-effet-dmg {
  font-size: 11px;
  background: rgba(120,200,255,.12);
  border: 1px solid rgba(120,200,255,.3);
  color: rgba(160,220,255,.9);
  border-radius: 4px;
  padding: 1px 7px;
}
.fd-toast-effet-ctrl {
  font-size: 11px;
  background: rgba(200,140,255,.12);
  border: 1px solid rgba(200,140,255,.3);
  color: rgba(210,170,255,.9);
  border-radius: 4px;
  padding: 1px 7px;
}
.fd-toast-target {
  font-size: 11px;
  color: rgba(180,240,180,.7);
}
.fd-toast-target-pnj {
  color: rgba(255,160,160,.7);
}
.fd-toast-raté {
  font-size: 12px;
  color: rgba(255,100,100,.6);
  font-style: italic;
}

/* Barre de progression */
.fd-toast-bar {
  height: 3px;
  background: rgba(0,255,160,.12);
}
.fd-toast-progress {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, rgba(0,255,160,.5), rgba(100,200,255,.5));
  transition: width 8s linear;
}

/* ── Référentiel compétences MJ ─────────────────────────────────────────── */
.fd-skills-ref-wrap { margin-top: .8rem; }

.fd-skillref-group {
  margin: .6rem 0;
  border: 1px solid rgba(54,224,255,.1);
  border-radius: 8px;
  overflow: hidden;
}
.fd-skillref-group-title {
  background: rgba(54,224,255,.07);
  padding: .3rem .6rem;
  font-size: .75rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(54,224,255,.7);
  font-family: var(--fd-font);
}
.fd-skillref-item {
  padding: .4rem .6rem;
  border-top: 1px solid rgba(54,224,255,.06);
  display: grid;
  grid-template-columns: 140px 1fr;
  grid-template-rows: auto auto;
  gap: .1rem .5rem;
  font-size: .83rem;
}
.fd-skillref-item:first-of-type { border-top: none; }
.fd-skillref-item:hover { background: rgba(54,224,255,.04); }
.fd-skillref-name {
  font-weight: 600;
  color: #c8e8ff;
  grid-row: 1 / 3;
  align-self: center;
  font-size: .84rem;
}
.fd-skillref-desc { color: rgba(200,230,255,.8); line-height: 1.4; }
.fd-skillref-ex {
  color: rgba(160,200,230,.5);
  font-style: italic;
  font-size: .78rem;
}

/* ── Bouton référentiel inline (face au Mode) ────────────────────────────── */
.fd-sw-row-3-ref {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: end;
  margin: 6px 0;
}
@media (max-width: 640px) {
  .fd-sw-row-3-ref { grid-template-columns: 1fr; }
}
.fd-skillref-btn-wrap {
  display: flex;
  align-items: flex-end;
  padding-bottom: 1px;
}
.fd-skillref-inline-toggle {
  white-space: nowrap;
  font-size: .85rem !important;
  padding: 6px 10px !important;
}
.fd-skillref-panel {
  border: 1px solid rgba(93,210,255,.12);
  border-radius: 8px;
  padding: .6rem;
  background: rgba(0,0,0,.18);
  margin-top: .4rem;
}

/* ── Modale référentiel compétences ─────────────────────────────────────── */
.fd-skillref-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fd-skillref-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(2px);
}
.fd-skillref-modal-box {
  position: relative;
  background: #0b1520;
  border: 1px solid rgba(54,224,255,.3);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,.6);
  width: min(740px, 95vw);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.fd-skillref-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .6rem 1rem;
  background: rgba(54,224,255,.06);
  border-bottom: 1px solid rgba(54,224,255,.15);
  font-family: var(--fd-font);
  font-size: .88rem;
  color: #7ee8ff;
  letter-spacing: .05em;
  flex-shrink: 0;
}
.fd-skillref-modal-close {
  background: none;
  border: 1px solid rgba(54,224,255,.2);
  border-radius: 6px;
  color: rgba(54,224,255,.6);
  padding: .2rem .5rem;
  cursor: pointer;
  font-size: .9rem;
  line-height: 1;
  transition: border-color .15s, color .15s;
}
.fd-skillref-modal-close:hover { border-color: #36e0ff; color: #36e0ff; }

/* Body : scroll simple, pas de grid */
.fd-skillref-modal-body {
  overflow-y: auto;
  padding: .6rem .8rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(54,224,255,.2) transparent;
  /* Colonnes CSS natives — pas de grid JS */
  columns: 2;
  column-gap: .8rem;
  column-fill: balance;
}
@media (max-width: 540px) {
  .fd-skillref-modal-body { columns: 1; }
}

/* Groupes : ne pas couper en milieu de groupe */
.fd-skillref-modal-body .fd-skillref-group {
  display: inline-block; /* force break-inside:avoid dans columns */
  width: 100%;
  margin: 0 0 .5rem 0;
  break-inside: avoid;
}
.fd-skillref-modal-body .fd-skillref-group-title {
  padding: .25rem .5rem;
  font-size: .72rem;
}

/* Items : display:block forcé pour écraser le grid global */
.fd-skillref-modal-body .fd-skillref-item {
  display: block !important;
  grid-template-columns: none !important;
  padding: .3rem .5rem;
  font-size: .79rem;
  border-top: 1px solid rgba(54,224,255,.06);
}
.fd-skillref-modal-body .fd-skillref-item:hover { background: rgba(54,224,255,.04); }
.fd-skillref-modal-body .fd-skillref-name {
  display: block !important;
  grid-row: auto !important;
  font-size: .82rem;
  font-weight: 600;
  color: #c8e8ff;
  margin-bottom: .1rem;
}
.fd-skillref-modal-body .fd-skillref-desc {
  display: block !important;
  grid-row: auto !important;
  color: rgba(200,230,255,.75);
  line-height: 1.4;
}
.fd-skillref-modal-body .fd-skillref-ex {
  display: block !important;
  grid-row: auto !important;
  color: rgba(160,200,230,.5);
  font-style: italic;
  font-size: .74rem;
}

/* ── Mode Initiative ─────────────────────────────────────── */
.fd-sw-initiative-info {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(39,211,255,.06);
  border: 1px solid rgba(39,211,255,.25);
  border-radius: 8px;
  padding: 10px 14px;
}
.fd-sw-initiative-icon {
  font-size: 22px;
  flex-shrink: 0;
}
.fd-sw-initiative-info strong {
  font-family: 'Orbitron','Audiowide',sans-serif;
  font-size: 12px;
  color: #00eaff;
  letter-spacing: .05em;
}

/* --- Origine des dés d'infortune (rang 0 technique / surcharge) --- */
.fd-pool-malus {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px;
  margin: 4px 0 2px; font-size: 12px; line-height: 1.4;
}
.fd-pool-malus-total {
  color: #e53935; font-weight: 600;
}
.fd-pool-malus-raison {
  color: #7d8b9a;
}
