<div class="cde-roll-result" data-aspect="{{aspect}}">

  {{!-- Header: aspect identity + roll label --}}
  <div class="cde-rr-header">
    <div class="cde-rr-header-left">
      <img class="cde-rr-aspect-icon" src="{{aspectIcon}}" alt="{{aspectLabel}}" />
      <div class="cde-rr-header-text">
        <span class="cde-rr-aspect-label">{{aspectLabel}}</span>
        <span class="cde-rr-roll-label">{{rollLabel}}</span>
      </div>
    </div>
    {{#if actorImg}}
    <div class="cde-rr-header-right">
      <img class="cde-rr-actor-avatar" src="{{actorImg}}" alt="{{actorName}}" />
      <span class="cde-rr-actor-name">{{actorName}}</span>
    </div>
    {{/if}}
  </div>

  {{!-- Hero: successes count (+ spell power for magic rolls) --}}
  <div class="cde-rr-hero">
    <span class="cde-rr-hero-count">{{successesdice}}</span>
    {{#if loksyuBonusSuc}}
    <span class="cde-rr-loksyu-bonus cde-rr-loksyu-bonus--success" title="Loksyu">+{{loksyuBonusSuc}} ☯</span>
    {{/if}}
    <div class="cde-rr-hero-right">
      <span class="cde-rr-hero-label">{{ localize "CDE.UpperCaseSuccesses" }}</span>
      <span class="cde-rr-hero-dice">{{totalDice}} <span class="cde-rr-hero-dice-label">d10</span></span>
    </div>
    {{#if spellPower}}
    <div class="cde-rr-spell-power">
      <span class="cde-rr-spell-power-count">{{spellPower}}</span>
      <span class="cde-rr-spell-power-formula">{{spellPowerAspectLabel}} ({{spellPowerAspectValue}}{{#if spellPowerFreeLevels}} + {{spellPowerFreeLevels}}{{/if}}) × {{rollDifficulty}}</span>
      <span class="cde-rr-spell-power-label">{{ localize "CDE.SpellPower" }}</span>
    </div>
    {{/if}}
  </div>

  {{!-- Detail rows: auspicious / noxious / loksyu / tinji --}}
  <div class="cde-rr-details">

    <div class="cde-rr-row cde-rr-row--auspicious">
      <span class="cde-rr-count">{{auspiciousdice}}</span>
      {{#if loksyuBonusFaste}}
      <span class="cde-rr-loksyu-bonus cde-rr-loksyu-bonus--faste" title="Loksyu">+{{loksyuBonusFaste}} ☯</span>
      {{/if}}
      <div class="cde-rr-icon"></div>
      <span class="cde-rr-label">{{ localize "CDE.UpperCaseAuspiciousDice" }}</span>
    </div>

    <div class="cde-rr-row cde-rr-row--noxious">
      <span class="cde-rr-count">{{noxiousdice}}</span>
      <div class="cde-rr-icon"></div>
      <span class="cde-rr-label">{{ localize "CDE.UpperCaseNoxiousDice" }}</span>
    </div>

    <div class="cde-rr-row cde-rr-row--loksyu">
      <span class="cde-rr-count">{{loksyudice}}</span>
      <div class="cde-rr-icon"></div>
      <span class="cde-rr-label">{{ localize "CDE.UpperCaseLoksyu" }}
        <span class="cde-rr-partition">{{loksyurepartition}}</span>
      </span>
    </div>

    <div class="cde-rr-row cde-rr-row--tinji">
      <span class="cde-rr-count">{{tinjidice}}</span>
      <div class="cde-rr-icon"></div>
      <span class="cde-rr-label">{{ localize "CDE.UpperCaseTinJi" }}</span>
    </div>

  </div>

  {{!-- Weapon damage (only for weapon rolls) --}}
  {{#if weaponName}}
  <div class="cde-rr-weapon-damage">
    <i class="fas fa-khanda cde-rr-weapon-icon"></i>
    <div class="cde-rr-weapon-text">
      <span class="cde-rr-weapon-name">{{weaponName}}</span>
      <span class="cde-rr-weapon-calc">
        {{#if damageBase}}{{damageBase}} + {{/if}}{{damageAspectLabel}} ({{damageAspectValue}})
        = <strong class="cde-rr-weapon-total">{{totalDamage}}</strong>
        <span class="cde-rr-weapon-unit">{{ localize "CDE.TotalDamage" }}</span>
      </span>
    </div>
  </div>
  {{/if}}

  {{!-- Modifiers footer (only if non-empty) --}}
  {{#if modifiersText}}
  <div class="cde-rr-footer">
    <span class="cde-rr-footer-label">{{ localize "CDE.Modifiers" }}</span>
    <span class="cde-rr-footer-text">{{modifiersText}}</span>
  </div>
  {{/if}}

  {{!-- Die face counts grid (d1–d9, d0=10) --}}
  <div class="cde-dice-grid">
    <div class="cde-dice-cell" data-face="1">
      <span class="cde-dice-count">{{d1}}</span>
      <span class="cde-dice-plate cde-dice-plate-css" data-value="1"></span>
    </div>
    <div class="cde-dice-cell" data-face="2">
      <span class="cde-dice-count">{{d2}}</span>
      <span class="cde-dice-plate cde-dice-plate-css" data-value="2"></span>
    </div>
    <div class="cde-dice-cell" data-face="3">
      <span class="cde-dice-count">{{d3}}</span>
      <span class="cde-dice-plate cde-dice-plate-css" data-value="3"></span>
    </div>
    <div class="cde-dice-cell" data-face="4">
      <span class="cde-dice-count">{{d4}}</span>
      <span class="cde-dice-plate cde-dice-plate-css" data-value="4"></span>
    </div>
    <div class="cde-dice-cell" data-face="5">
      <span class="cde-dice-count">{{d5}}</span>
      <span class="cde-dice-plate cde-dice-plate-css" data-value="5"></span>
    </div>
    <div class="cde-dice-cell" data-face="6">
      <span class="cde-dice-count">{{d6}}</span>
      <span class="cde-dice-plate cde-dice-plate-css" data-value="6"></span>
    </div>
    <div class="cde-dice-cell" data-face="7">
      <span class="cde-dice-count">{{d7}}</span>
      <span class="cde-dice-plate cde-dice-plate-css" data-value="7"></span>
    </div>
    <div class="cde-dice-cell" data-face="8">
      <span class="cde-dice-count">{{d8}}</span>
      <span class="cde-dice-plate cde-dice-plate-css" data-value="8"></span>
    </div>
    <div class="cde-dice-cell" data-face="9">
      <span class="cde-dice-count">{{d9}}</span>
      <span class="cde-dice-plate cde-dice-plate-css" data-value="9"></span>
    </div>
    <div class="cde-dice-cell" data-face="0">
      <span class="cde-dice-count">{{d0}}</span>
      <span class="cde-dice-plate cde-dice-plate-css" data-value="10"></span>
    </div>
  </div>

</div>
