{% from 'partials/_macros.html' import color_identity %}
{% set combined = combined_commander if combined_commander else {} %}
{% set display_commander_name = commander_display_name or commander %}
{% if not display_commander_name %}
{% set display_commander_name = commander %}
{% endif %}
{% set color_identity_list = commander_color_identity if commander_color_identity else [] %}
{% if not color_identity_list and summary and summary.colors %}
{% set color_identity_list = summary.colors %}
{% endif %}
{% set color_label = commander_color_label %}
{% if not color_label and color_identity_list %}
{% set color_label = color_identity_list|join(' / ') %}
{% endif %}
{% if not color_label and (color_identity_list|length == 0) and combined %}
{% set color_label = 'Colorless (C)' %}
{% endif %}
{% set display_tags_source = deck_theme_tags if deck_theme_tags else (tags if tags else commander_combined_tags) %}
{% set hover_tags_source = deck_theme_tags if deck_theme_tags else commander_combined_tags %}
{% set hover_tags_joined = hover_tags_source|join(', ') %}
{% set display_tags = display_tags_source if display_tags_source else [] %}
{% set show_color_identity = color_label or (color_identity_list|length > 0) %}
{# Step phases removed #}
Commander:
{% if commander %}
{{ display_commander_name or commander }}
{% else %}
None selected
{% endif %}
{% if show_color_identity %}
{{ color_identity(color_identity_list, is_colorless=(color_identity_list|length == 0), aria_label=color_label or '', title_text=color_label or '') }}
{{ color_label }}
{% if i and n %}
Stage {{ i }}/{{ n }}
{% endif %}
{% set deck_count = (total_cards if total_cards is not none else 0) %}
Deck {{ deck_count }}/100
{% if added_total is not none %}
Added {{ added_total }}
{% endif %}
{% if prefer_combos %}
Combos: {{ combo_target_count }} ({{ combo_balance }})
{% endif %}
{% if clamped_overflow is defined and clamped_overflow and (clamped_overflow > 0) %}
Clamped {{ clamped_overflow }}
{% endif %}
{% if stage_label and stage_label == 'Multi-Copy Package' and mc_summary is defined and mc_summary %}
{{ mc_summary }}
{% endif %}
{% if locks and locks|length > 0 %}🔒 {{ locks|length }} locked{% endif %}
{% set pct = ((deck_count / 100.0) * 100.0) if deck_count else 0 %}
{% set pct_clamped = (pct if pct <= 100 else 100) %}
{% set pct_int = pct_clamped|int %}
{% if mc_adjustments is defined and mc_adjustments and stage_label and stage_label == 'Multi-Copy Package' %}
Adjusted targets: {{ mc_adjustments|join(', ') }}
{% endif %}
{% if status %}
Status: {{ status }}{% if stage_label %} — {{ stage_label }}{% endif %}
{% endif %}
{% if gated and (not status or not status.startswith('Build complete')) %}
Compliance gating active — resolve violations above (replace or remove cards) to continue.
{% endif %}
{# Load compliance panel as soon as the page renders, regardless of final status #}
{% if status and status.startswith('Build complete') %}
{% endif %}
{% if locked_cards is defined and locked_cards %}
{% from 'partials/_macros.html' import lock_button %}
Locked cards (always kept)
{% for lk in locked_cards %}
{{ lk.name }}{% if lk.owned %}✔ Owned{% else %}✖ Not owned{% endif %}
{% if lk.in_deck %}• In deck{% else %}• Will be included on rerun{% endif %}
{% if added_cards is not none %}
{% if history is defined and history %}
Stage timeline
Jump back to a previous stage, then you can continue forward again.
{% for h in history %}
{{ h.label }}
{% endfor %}
{% endif %}
Cards added this stage
{% if skipped and (not added_cards or added_cards|length == 0) %}
No cards added in this stage.
{% endif %}
✔ Owned✖ Not owned
{% if stage_label and stage_label.startswith('Creatures') %}
{% set groups = added_cards|groupby('sub_role') %}
{% for g in groups %}
{% set group_idx = loop.index0 %}
{% set role = g.grouper %}
{% if role %}
{% set heading = 'Theme: ' + role.title() %}
{% else %}
{% set heading = 'Additional Picks' %}
{% endif %}
{{ heading }}
({{ g.list|length }})
{% for c in g.list %}
{% set owned = (owned_set is defined and c.name and (c.name|lower in owned_set)) %}
{% set is_locked = (locks is defined and (c.name|lower in locks)) %}
{% if owned %}✔{% else %}✖{% endif %}
{{ c.name|safe }}{% if c.count and c.count > 1 %} ×{{ c.count }}{% endif %}
{% from 'partials/_macros.html' import lock_button %}
{{ lock_button(c.name, is_locked) }}
{% if c.reason %}
{{ c.reason }}
{% else %}
{% endif %}
{% endfor %}
{% endfor %}
{% else %}
{% for c in added_cards %}
{% set owned = (owned_set is defined and c.name and (c.name|lower in owned_set)) %}
{% set is_locked = (locks is defined and (c.name|lower in locks)) %}
{% if owned %}✔{% else %}✖{% endif %}
{{ c.name|safe }}{% if c.count and c.count > 1 %} ×{{ c.count }}{% endif %}
{% from 'partials/_macros.html' import lock_button %}
{{ lock_button(c.name, is_locked) }}
{% if c.reason %}
{{ c.reason }}
{% else %}
{% endif %}
{% endfor %}
{% endif %}
Tip: Use the 🔒 Lock button under each card to keep it across reruns. Tap or click the card art to view details without changing the lock state.
No cards match your filters.
{% endif %}
{% if show_logs and log %}
Show logs
{{ log }}
{% endif %}
{% if status and status.startswith('Build complete') and summary %}
{% include "partials/include_exclude_summary.html" %}
{% include "partials/deck_summary.html" %}
{% endif %}