<div class="sortilege-dialog invocation-dialog">

  {{!-- Header --}}
  <div class="sortilege-header flexrow">
    {{#if actorImg}}<img src="{{actorImg}}" class="sortilege-actor-img" alt="{{actorName}}" />{{/if}}
    <div class="sortilege-actor-info">
      <span class="sortilege-actor-name">{{actorName}}</span>
      <span class="sortilege-ame-info">Âme disponible : <strong>{{ameDisponible}}</strong></span>
      <span class="sortilege-ame-info">
        <i class="fas fa-star" style="color:gold;"></i>
        Enchantement de la Loi
      </span>
    </div>
  </div>

  {{!-- Objet ciblé --}}
  <div class="invoc-comp-summary" style="margin-bottom:0.5em;">
    <span class="comp-badge">
      {{#if itemImg}}<img src="{{itemImg}}" alt="{{itemName}}" style="width:20px;height:20px;border:none;vertical-align:middle;margin-right:4px;" />{{/if}}
      <strong>{{itemName}}</strong>
    </span>
    {{#if enchantementActif}}
    <span class="comp-badge" style="color:gold;">
      <i class="fas fa-star"></i> Déjà enchanté : +{{enchantementBonus}}{{#if enchantementAntiChaos}}, Anti-Chaos{{/if}}
    </span>
    {{/if}}
  </div>

  {{!-- Prérequis --}}
  {{#unless hasRuneLoi}}
  <div class="invoc-warning-box">
    <i class="fas fa-exclamation-triangle"></i>
    <strong>Prérequis :</strong>
    <div>• Rune de la Loi requise dans l'inventaire</div>
  </div>
  {{/unless}}

  {{!-- Compétences disponibles --}}
  <div class="invoc-comp-summary">
    <span class="comp-badge {{#unless savoirRunesNiveau}}comp-missing{{/unless}}">
      Savoir : Runes : {{#if savoirRunesNiveau}}<strong>{{savoirRunesNiveau}}</strong>{{else}}<em>absent</em>{{/if}}
    </span>
    <span class="comp-badge {{#unless hautParlerNiveau}}comp-missing{{/unless}}">
      Haut-Parler : {{#if hautParlerNiveau}}<strong>{{hautParlerNiveau}}</strong>{{else}}<em>absent</em>{{/if}}
    </span>
    <span class="comp-badge {{#unless artisanatNiveau}}comp-missing{{/unless}}">
      Savoir : Artisanat : {{#if artisanatNiveau}}<strong>{{artisanatNiveau}}</strong>{{else}}<em>absent</em>{{/if}}
    </span>
  </div>

  {{!-- Paramètres du jet --}}
  <div class="invoc-seuil-calculator">
    <h4 class="invoc-section-title"><i class="fas fa-dice-d20"></i> Jet d'Enchantement</h4>

    <div class="invoc-criteria-grid">
      <label>Points d'Âme à investir</label>
      <input type="number" name="ptsAme" value="5" min="5" max="{{ameDisponible}}" step="1" />

      <label>Type d'enchantement</label>
      <select name="antiChaos">
        <option value="false">Standard (+1 bonus par tranche de 5 pts)</option>
        <option value="true">Anti-Chaos (aura lumineuse)</option>
      </select>

      <label>Modificateur</label>
      <select name="modificateur">
        {{#each modOptions}}<option value="{{this}}" {{#if (eq this 0)}}selected{{/if}}>{{#if (gt this 0)}}+{{/if}}{{this}}</option>{{/each}}
      </select>
    </div>
  </div>

  {{!-- Résumé calculé --}}
  <div class="potion-dialog-section potion-summary">
    <div class="flexrow summary-row">
      <span class="summary-label">Formule :</span>
      <span class="summary-value">CLA ({{claValeur}}) + Savoir:Runes (<span id="enchant-total-dice">{{savoirRunesNiveau}}</span>)</span>
    </div>
    {{#if limiteur}}
    <div class="flexrow summary-row">
      <span class="summary-label">Limité par :</span>
      <span class="summary-value">min(Haut-Parler, Artisanat) = {{limiteur}}</span>
    </div>
    {{/if}}
    <div class="flexrow summary-row">
      <span class="summary-label">Difficulté :</span>
      <span class="summary-value" id="enchant-difficulte">—</span>
    </div>
    <div class="flexrow summary-row">
      <span class="summary-label">Bonus prévu :</span>
      <span class="summary-value" id="enchant-bonus-preview">+0</span>
    </div>
    <div class="flexrow summary-row">
      <span class="summary-label">Âme disponible :</span>
      <span class="summary-value">{{ameDisponible}}</span>
    </div>
  </div>

  <div id="enchant-ame-warn" class="invoc-warning-box" style="display:none;">
    <i class="fas fa-exclamation-triangle"></i> Pas assez de points d'Âme disponibles !
  </div>

</div>
