<div class="oh-roll-dialog oh-spell-dialog">

  {{!-- Spell header --}}
  <div class="spell-header">
    <img src="{{spellImg}}" class="weapon-img-sm" alt="{{spellName}}" />
    <div class="spell-header-info">
      <span class="weapon-name-lg">{{spellName}}</span>
      <div class="weapon-badges">
        <span class="dv-badge">DV {{dv}}</span>
        <span class="tradition-badge">{{traditionLabel}}</span>
        {{#if isRitual}}<span class="ritual-badge">{{localize "OATHHAMMER.Label.Ritual"}}</span>{{/if}}
        {{#if isMagicMissile}}<span class="missile-badge">{{localize "OATHHAMMER.Label.MagicMissile"}}</span>{{/if}}
        {{#if range}}<span class="range-badge">{{range}}</span>{{/if}}
        {{#if duration}}<span class="duration-badge">{{duration}}</span>{{/if}}
      </div>
      {{#if spellSave}}<div class="save-info">{{localize "OATHHAMMER.Label.SpellSave"}}: {{spellSave}}</div>{{/if}}
    </div>
  </div>

  {{!-- Arcane stress tracker --}}
  <div class="stress-tracker {{#if isOverThreshold}}stress-danger{{/if}}">
    <i class="fa-solid fa-brain"></i>
    <span>{{localize "OATHHAMMER.Label.ArcaneStress"}}: <strong>{{currentStress}} / {{stressThreshold}}</strong></span>
    {{#if isOverThreshold}}<span class="stress-warning">⚠ {{localize "OATHHAMMER.Label.StressBlocked"}}</span>{{/if}}
  </div>

  {{!-- Cast options --}}
  <fieldset class="attack-options-block">
    <legend>{{localize "OATHHAMMER.Dialog.CastOptions"}}</legend>

    <div class="pool-info-line">
      {{localize "OATHHAMMER.Skill.Magic"}} ({{localize "OATHHAMMER.Attribute.Intelligence"}} {{intRank}})
      + {{localize "OATHHAMMER.Label.SkillRank"}} {{magicRank}}
      = <strong>{{basePool}}d6</strong>
    </div>

    {{#if poolSizeOptions}}
    <div class="roll-option-row">
      <label>{{localize "OATHHAMMER.Dialog.PoolSize"}}</label>
      <select name="poolSize">
        {{#each poolSizeOptions}}<option value="{{value}}"{{#if selected}} selected{{/if}}>{{label}}</option>{{/each}}
      </select>
      <span class="roll-option-hint">{{localize "OATHHAMMER.Dialog.PoolSizeHint"}}</span>
    </div>
    {{/if}}

    <div class="roll-option-row">
      <label>{{localize "OATHHAMMER.Dialog.Enhancement"}}</label>
      <select name="enhancement" class="enhancement-select">
        {{#each enhancementOptions}}<option value="{{value}}"{{#if selected}} selected{{/if}}>{{label}}</option>{{/each}}
      </select>
    </div>

    {{#if isElemental}}
    <div class="roll-option-row">
      <label>{{localize "OATHHAMMER.Dialog.ElementCondition"}}</label>
      <select name="elementalBonus">
        <option value="0">{{localize "OATHHAMMER.Dialog.ElementNone"}}</option>
        <option value="1">{{localize "OATHHAMMER.Dialog.ElementMet"}} (+1)</option>
      </select>
    </div>
    {{/if}}

    <div class="roll-option-row">
      <label>{{localize "OATHHAMMER.Dialog.Modifier"}}</label>
      <select name="bonus">
        {{#each bonusOptions}}<option value="{{value}}"{{#if selected}} selected{{/if}}>{{label}}</option>{{/each}}
      </select>
      <span class="roll-option-hint">{{localize "OATHHAMMER.Dialog.AttackModifierHint"}}</span>
    </div>

    <div class="roll-option-row">
      <label>{{localize "OATHHAMMER.Dialog.Grimoire"}}</label>
      <select name="noGrimoire">
        <option value="0">{{localize "OATHHAMMER.Dialog.GrimoireHas"}}</option>
        <option value="-2">{{localize "OATHHAMMER.Dialog.GrimoireNo"}} (−2)</option>
      </select>
    </div>

    {{#if availableLuck}}
    <div class="roll-option-row roll-option-luck">
      <label>{{localize "OATHHAMMER.Dialog.LuckSpend"}} <i class="fa-solid fa-clover luck-icon"></i></label>
      <select name="luckSpend">
        {{#each luckOptions}}<option value="{{value}}"{{#if selected}} selected{{/if}}>{{label}}</option>{{/each}}
      </select>
      <label class="luck-human-label" for="spellLuckIsHuman">{{localize "OATHHAMMER.Dialog.LuckHuman"}}</label>
      <input type="checkbox" id="spellLuckIsHuman" name="luckIsHuman" value="true" {{#if isHuman}}checked{{/if}} />
      <span class="roll-option-hint">{{localize "OATHHAMMER.Dialog.LuckHint"}} ({{availableLuck}} {{localize "OATHHAMMER.Dialog.Available"}})</span>
    </div>
    {{/if}}

    <div class="roll-option-row roll-option-check">
      <label for="spellExplodeOn5">{{localize "OATHHAMMER.Dialog.ExplodeOn5"}}</label>
      <input type="checkbox" id="spellExplodeOn5" name="explodeOn5" />
      <span class="roll-option-hint">{{localize "OATHHAMMER.Dialog.ExplodeOn5Hint"}}</span>
    </div>

  </fieldset>

  {{!-- Visibility --}}
  <fieldset class="roll-visibility-block">
    <legend>{{localize "OATHHAMMER.Dialog.Visibility"}}</legend>
    <select name="visibility">
      {{selectOptions rollModes selected=visibility localize=true}}
    </select>
  </fieldset>

</div>
