<div class="celestopol chat-roll {{resultClass}}">

  {{!-- En-tête : acteur + domaine --}}
  <div class="roll-header">
    {{#if actorImg}}
      <img src="{{actorImg}}" class="actor-img" alt="{{actorName}}">
    {{/if}}
    <div class="roll-info">
      <span class="actor-name">{{actorName}}</span>
      <span class="skill-info">
        {{#if statLabel}}<span class="stat-lbl">{{statLabel}}</span><span class="sep"> › </span>{{/if}}
        <span class="skill-lbl">{{skillLabel}}</span>
      </span>
      {{#if woundLabel}}<span class="wound-info">⚠ {{woundLabel}}</span>{{/if}}
    </div>
  </div>

  {{!-- Zone dés --}}
  <div class="dice-zone">
    {{#each diceResults as |die|}}
    <span class="die-face d8 {{#if (eq die 8)}}max{{/if}}{{#if (eq die 1)}}min{{/if}}">{{die}}</span>
    {{/each}}
  </div>

  {{!-- Formule détaillée --}}
  <div class="formula-line">
    <span class="fl-label">{{localize "CELESTOPOL.Roll.formula"}} :</span>
    <span class="fl-ndice">{{nbDice}}d8</span>
    <span class="fl-eq"> = </span>
    <span class="fl-sum">{{diceSum}}</span>
    {{#if modifier}}
    <span class="fl-op">{{#if (gt modifier 0)}}+{{else}}−{{/if}}</span>
    <span class="fl-mod">{{abs modifier}}</span>
    {{/if}}
    {{#if aspectMod}}
    <span class="fl-op">{{#if (gt aspectMod 0)}}+{{else}}−{{/if}}</span>
    <span class="fl-asp" title="{{localize "CELESTOPOL.Roll.usedAspect"}}">✦{{abs aspectMod}}</span>
    {{/if}}
    <span class="fl-sep">=</span>
    <span class="fl-total">{{total}}</span>
  </div>

  {{!-- Seuil et marge --}}
  <div class="threshold-line">
    <span class="vs-wrap">
      <span class="vs-label">vs</span>
      <span class="diff-label">{{difficultyLabel}}</span>
      <span class="diff-val">({{difficultyValue}})</span>
    </span>
    {{#if margin}}
    <span class="margin-badge {{#if marginAbove}}above{{else}}below{{/if}}">
      {{#if marginAbove}}+{{/if}}{{margin}}
    </span>
    {{/if}}
  </div>

  {{!-- Infos bonus (Destin, Aspect) --}}
  {{#if useDestin}}
  <div class="used-info">
    <span class="used-destin">✦ {{localize "CELESTOPOL.Roll.usedDestin"}}</span>
  </div>
  {{/if}}

  {{!-- Résultat du Dé de la Lune (narratif) --}}
  {{#if hasMoonDie}}
  <div class="moon-die-result {{moonResultClass}}">
    <span class="moon-die-face">{{moonFaceSymbol}}</span>
    <div class="moon-die-info">
      <span class="moon-die-phase">{{moonFaceLabel}}</span>
      <span class="moon-die-type">{{moonResultLabel}}</span>
      <span class="moon-die-desc">{{moonResultDesc}}</span>
    </div>
  </div>
  {{/if}}

  {{!-- Bandeau résultat --}}
  <div class="roll-result-banner {{resultClass}}">
    {{#if isCriticalSuccess}}
      <span class="result-icon">✦✦</span>
      <span class="result-label">{{localize "CELESTOPOL.Roll.criticalSuccess"}}</span>
      <span class="result-desc">{{localize "CELESTOPOL.Roll.criticalSuccessDesc"}}</span>
    {{else if isSuccess}}
      <span class="result-icon">✦</span>
      <span class="result-label">{{localize "CELESTOPOL.Roll.success"}}</span>
    {{else if isCriticalFailure}}
      <span class="result-icon">✖✖</span>
      <span class="result-label">{{localize "CELESTOPOL.Roll.criticalFailure"}}</span>
      <span class="result-desc">{{localize "CELESTOPOL.Roll.criticalFailureDesc"}}</span>
    {{else if isFailure}}
      <span class="result-icon">✖</span>
      <span class="result-label">{{localize "CELESTOPOL.Roll.failure"}}</span>
    {{/if}}
  </div>

</div>
