<div class="mgt2-npc-result">

  <div class="npc-header">
    <h3>
      {{#if (eq type "npc")}}
        <i class="fas fa-user"></i> PNJ rapide
      {{else if (eq type "encounter")}}
        <i class="fas fa-random"></i> Rencontre aléatoire
      {{else if (eq type "client-mission")}}
        <i class="fas fa-briefcase"></i> Client & mission
      {{/if}}
    </h3>
  </div>

  {{#if (eq type "npc")}}
    <div class="npc-pill-row">
      <span class="npc-pill">{{relation.label}}</span>
      <span class="npc-pill npc-pill-muted">{{experience.profile.label}}</span>
    </div>

    <div class="npc-card-grid">
      <div class="npc-card-block">
        <div class="npc-card-title">Profession / rôle</div>
        <div class="npc-roll-line">D66 {{role.total}}</div>
        <div class="npc-card-value">{{role.entry.text}}</div>
      </div>
      <div class="npc-card-block">
        <div class="npc-card-title">Particularité</div>
        <div class="npc-roll-line">D66 {{quirk.total}}</div>
        <div class="npc-card-value">{{quirk.entry.text}}</div>
      </div>
    </div>

    <div class="npc-section">
      <div class="npc-section-title">Résumé jouable</div>
      <p><strong>Relation :</strong> {{relation.summary}}</p>
      <p><strong>Compétences-types :</strong> {{joinLocalizedSkills experience.profile.skills ", "}}</p>
      <p><strong>Niveau moyen de compétence :</strong> {{experience.profile.skillLevel}}</p>
      <p><strong>Bonus de caractéristiques :</strong>
        {{#if experience.profile.characteristicBonuses.length}}
          {{join experience.profile.characteristicBonuses ", "}}
        {{else}}
          Aucun
        {{/if}}
      </p>
      {{#if createdActor}}
        <p><strong>Fiche créée :</strong> {{createdActor.name}}</p>
      {{/if}}
    </div>
  {{/if}}

  {{#if (eq type "client-mission")}}
    <div class="npc-card-grid">
      <div class="npc-card-block">
        <div class="npc-card-title">Client</div>
        <div class="npc-roll-line">D66 {{client.total}}</div>
        <div class="npc-card-value">{{client.entry.text}}</div>
      </div>
      <div class="npc-card-block">
        <div class="npc-card-title">Mission</div>
        <div class="npc-roll-line">D66 {{mission.total}}</div>
        <div class="npc-card-value">{{mission.entry.text}}</div>
      </div>
    </div>

    <table class="npc-table">
      <tbody>
        <tr>
          <th>Cible</th>
          <td>
            <strong>D66 {{target.total}}</strong> — {{target.entry.text}}
            {{#if targetResolution}}
              <div class="npc-subline">{{targetResolution.label}} : {{targetResolution.text}}</div>
            {{/if}}
          </td>
        </tr>
        <tr>
          <th>Opposition</th>
          <td><strong>D66 {{opposition.total}}</strong> — {{opposition.entry.text}}</td>
        </tr>
      </tbody>
    </table>

    <div class="npc-note">
      <strong>Rémunération :</strong> {{rewardGuidance}}
    </div>
  {{/if}}

  {{#if (eq type "encounter")}}
    <div class="npc-pill-row">
      <span class="npc-pill">{{context.label}}</span>
      <span class="npc-pill npc-pill-muted">D66 {{encounter.total}}</span>
    </div>

    <div class="npc-highlight">
      {{encounter.entry.text}}
    </div>

    {{#if followUp}}
      <div class="npc-section">
        <div class="npc-section-title">Détail généré automatiquement</div>

        {{#if (eq followUp.type "client-mission")}}
          <p><strong>Client :</strong> {{followUp.client.entry.text}} <span class="npc-inline-roll">(D66 {{followUp.client.total}})</span></p>
          <p><strong>Mission :</strong> {{followUp.mission.entry.text}} <span class="npc-inline-roll">(D66 {{followUp.mission.total}})</span></p>
          <p><strong>Cible :</strong> {{followUp.target.entry.text}} <span class="npc-inline-roll">(D66 {{followUp.target.total}})</span></p>
        {{else if (eq followUp.type "npc")}}
          <p><strong>PNJ :</strong> {{followUp.role.entry.text}} <span class="npc-inline-roll">(D66 {{followUp.role.total}})</span></p>
          <p><strong>Particularité :</strong> {{followUp.quirk.entry.text}} <span class="npc-inline-roll">(D66 {{followUp.quirk.total}})</span></p>
        {{/if}}
      </div>
    {{/if}}
  {{/if}}

</div>
