<form class="awemmy-roll-dialog">

  {{!-- Attribute name + modifier breakdown --}}
  <div class="roll-header">
    <span class="roll-attr-name">{{attrLabel}}</span>
    <span class="roll-formula-summary">
      1d20
      {{#if (gt modifier 0)}} + {{modifier}}{{else if (lt modifier 0)}} − {{abs modifier}}{{/if}}
      {{#if (gt attributeBonus 0)}} + <em>{{attributeBonus}}</em>{{else if (lt attributeBonus 0)}} − <em>{{abs attributeBonus}}</em>{{/if}}
    </span>
  </div>

  {{!-- Attribute persistent bonus/penalty (read-only if non-zero) --}}
  {{#if attributeBonus}}
  <div class="dialog-row hint-row">
    <span class="hint-label">{{localize "AWEMMY.Roll.AttributeBonus"}}</span>
    <span class="hint-value {{#if (gt attributeBonus 0)}}positive{{else}}negative{{/if}}">
      {{#if (gt attributeBonus 0)}}+{{/if}}{{attributeBonus}}
    </span>
  </div>
  {{/if}}

  {{!-- Situational bonus / penalty --}}
  <div class="dialog-row">
    <label for="awe-bonus">{{localize "AWEMMY.Roll.SituationalBonus"}}</label>
    <select id="awe-bonus" name="bonus">
      {{#each bonusChoices}}
      <option value="{{this.value}}"{{#if this.selected}} selected{{/if}}>{{this.label}}</option>
      {{/each}}
    </select>
  </div>

  {{!-- Knowledge bonus (field items) --}}
  {{#if knowledgeBonuses.length}}
  <div class="dialog-row">
    <label for="awe-knowledge">{{localize "AWEMMY.Roll.KnowledgeBonus"}}</label>
    <select id="awe-knowledge" name="knowledgeBonus">
      <option value="0">—</option>
      {{#each knowledgeBonuses}}
      <option value="{{this.bonus}}">{{this.label}} (+{{this.bonus}})</option>
      {{/each}}
    </select>
  </div>
  {{/if}}

  {{!-- DC --}}
  <div class="dialog-row">
    <label for="awe-dc">{{localize "AWEMMY.Roll.DC"}}</label>
    <select id="awe-dc" name="dc">
      {{#each dcChoices}}
      <option value="{{this.value}}"{{#if this.selected}} selected{{/if}}>{{this.label}}</option>
      {{/each}}
    </select>
  </div>

  {{!-- Formula preview --}}
  <div class="dialog-row formula-preview">
    <span class="formula-label">{{localize "AWEMMY.Roll.Formula"}}</span>
    <span class="formula-text" id="awe-formula-preview">1d20 + {{totalMod}}</span>
  </div>

  {{!-- Roll visibility --}}
  <div class="dialog-row">
    <label for="awe-visibility">{{localize "AWEMMY.Roll.Visibility"}}</label>
    <select id="awe-visibility" name="visibility">
      {{selectOptions rollModes selected=visibility localize=true}}
    </select>
  </div>

</form>

