<section>
	{# Step phases removed #}
	<div class="two-col two-col-left-rail">
	<aside class="card-preview" data-card-name="{{ commander|urlencode }}">
			{# Strip synergy annotation for Scryfall search and image fuzzy param #}
			{% set commander_base = (commander.split(' - Synergy (')[0] if ' - Synergy (' in commander else commander) %}
			<a href="https://scryfall.com/search?q={{ commander_base|urlencode }}" target="_blank" rel="noopener">
			<img src="https://api.scryfall.com/cards/named?fuzzy={{ commander_base|urlencode }}&format=image&version=normal" alt="{{ commander }} card image" data-card-name="{{ commander_base }}" />
			</a>
		</aside>
			<div class="grow" data-skeleton>
			<div hx-get="/build/banner" hx-trigger="load"></div>
			{% if locks_restored and locks_restored > 0 %}
			  <div class="muted" style="margin:.35rem 0;">
			    <span class="chip" title="Locks restored from permalink">🔒 {{ locks_restored }} locks restored</span>
			  </div>
			{% endif %}
			<h4>Chosen Ideals</h4>
			<ul>
				{% for key, label in labels.items() %}
					<li>{{ label }}: <strong>{{ values[key] }}</strong></li>
				{% endfor %}
			</ul>
			<form hx-post="/build/toggle-owned-review" hx-target="#wizard" hx-swap="innerHTML" style="margin:.5rem 0; display:flex; align-items:center; gap:1rem; flex-wrap:wrap;">
				<label style="display:flex; align-items:center; gap:.35rem;">
					<input type="checkbox" name="use_owned_only" value="1" {% if owned_only %}checked{% endif %} onchange="this.form.requestSubmit();" />
					Use only owned cards
				</label>
				<label style="display:flex; align-items:center; gap:.35rem;">
					<input type="checkbox" name="prefer_owned" value="1" {% if prefer_owned %}checked{% endif %} onchange="this.form.requestSubmit();" />
					Prefer owned cards (allow unowned fallback)
				</label>
				<label style="display:flex; align-items:center; gap:.35rem;" title="When enabled, modal DFC lands will replace a matching basic land as they are added so land counts stay level without manual trims.">
					<input type="checkbox" name="swap_mdfc_basics" value="1" {% if swap_mdfc_basics %}checked{% endif %} onchange="this.form.requestSubmit();" />
					Swap basics for MDFC lands
				</label>
				<a href="/owned" target="_blank" rel="noopener" class="btn">Manage Owned Library</a>
			</form>
			<div class="muted" style="font-size:12px; margin-top:-.25rem;">Tip: Locked cards are respected on reruns in Step 5.</div>
							<div style="margin-top:1rem; display:flex; gap:.5rem;">
								<form action="/build/step5/start" method="post" hx-post="/build/step5/start" hx-target="#wizard" hx-swap="innerHTML" style="display:inline; margin:0;">
									<button type="submit" class="btn-continue" data-action="continue">Build Deck</button>
								</form>
								<button type="button" class="btn-back" data-action="back" hx-get="/build/step3" hx-target="#wizard" hx-swap="innerHTML">Back</button>
								<form hx-post="/build/reset-all" hx-target="#wizard" hx-swap="innerHTML" style="display:inline; margin:0;">
									<button type="submit">Start over</button>
								</form>
							</div>
		</div>
	</div>
</section>
