<div class="mgt2-npc-result">
  <div class="npc-header">
    <h3>
      <i class="fas fa-handshake"></i>
      {{#if relationChanged}}
        {{lookupRelationKey originalRelationKey}} → {{relation.label}}
      {{else}}
        {{relation.label}}
      {{/if}}
    </h3>
  </div>

  <div class="npc-pill-row">
    <span class="npc-pill">{{relation.label}}</span>
    <span class="npc-pill npc-pill-muted">Score net : {{netScore}}</span>
  </div>

  <div class="npc-card-grid">
    <div class="npc-card-block">
      <div class="npc-card-title">Affinité ({{affinity.value}}/6)</div>
      <div class="npc-roll-line">{{affinity.formula}} → {{affinity.roll}}</div>
      <div class="npc-card-value">{{affinity.label}}</div>
      <div class="npc-subline">{{affinity.description}}</div>
    </div>
    <div class="npc-card-block">
      <div class="npc-card-title">Inimitié ({{inimity.value}}/6)</div>
      <div class="npc-roll-line">{{inimity.formula}} → {{inimity.roll}}</div>
      <div class="npc-card-value">-{{inimity.value}} — {{inimity.label}}</div>
      <div class="npc-subline">{{inimity.description}}</div>
    </div>
  </div>

  <div class="npc-card-grid">
    <div class="npc-card-block">
      <div class="npc-card-title">Pouvoir ({{power.value}}/6)</div>
      <div class="npc-card-value">{{power.label}}</div>
      <div class="npc-subline">{{power.description}}</div>
    </div>
    <div class="npc-card-block">
      <div class="npc-card-title">Influence ({{influence.value}}/6)</div>
      <div class="npc-card-value">{{influence.label}}</div>
      <div class="npc-subline">{{influence.description}}</div>
    </div>
  </div>

  {{#if specialCharacteristics.length}}
  <div class="npc-section">
    <div class="npc-section-title">Caractéristiques spéciales</div>
    {{#each specialCharacteristics}}
    <div class="ae-special-entry">
      <div class="ae-special-header">
        <span class="npc-inline-roll">D{{d66}}</span>
        <span>{{text}}</span>
      </div>
      {{#if rerollNote}}
      <div class="ae-special-detail">{{rerollNote}}</div>
      {{/if}}
      {{#if swapNote}}
      <div class="ae-special-detail">{{swapNote}}</div>
      {{/if}}
      {{#if narrativeText}}
      <div class="ae-special-detail ae-narrative">{{narrativeText}}</div>
      {{/if}}
      {{#if newRelationKey}}
      <div class="ae-special-detail">La relation devient : {{lookupRelationKey newRelationKey}}</div>
      {{/if}}
      <div class="ae-special-mods">
        {{#if appliedDeltas.affinity}}
          <span class="ae-mod ae-mod-{{#if (gt appliedDeltas.affinity 0)}}pos{{else}}neg{{/if}}">
            Affinité {{formatSigned appliedDeltas.affinity}}
          </span>
        {{/if}}
        {{#if appliedDeltas.inimity}}
          <span class="ae-mod ae-mod-{{#if (gt appliedDeltas.inimity 0)}}pos{{else}}neg{{/if}}">
            Inimitié {{formatSigned appliedDeltas.inimity}}
          </span>
        {{/if}}
        {{#if appliedDeltas.power}}
          <span class="ae-mod ae-mod-{{#if (gt appliedDeltas.power 0)}}pos{{else}}neg{{/if}}">
            Pouvoir {{formatSigned appliedDeltas.power}}
          </span>
        {{/if}}
        {{#if appliedDeltas.influence}}
          <span class="ae-mod ae-mod-{{#if (gt appliedDeltas.influence 0)}}pos{{else}}neg{{/if}}">
            Influence {{formatSigned appliedDeltas.influence}}
          </span>
        {{/if}}
      </div>
    </div>
    {{/each}}
  </div>
  {{/if}}

  <div class="npc-footer">
    <small>Généré par le module {{MODULE_ID}}</small>
  </div>
</div>
