{#if phase === 'idle'}

Find a Match

How to Play {#if decks.length === 0}

You need a deck to play. Build one first.

{:else}

{selectedDeck && (selectedDeck.total_cost === 0 || selectedDeck.total_cost > 50) ? `Deck cost must be between 1 and 50 (current: ${selectedDeck.total_cost})` : ''}

{/if}
{:else if phase === 'queuing'}

Waiting for an opponent...

{:else if (phase === 'playing' || (phase === 'ended' && viewingBoard)) && gameState}
{#each opp.board as card, slot}
{#if card && !destroyed.has(card.instance_id)}
{:else}
{/if}
{/each}
{phase === 'ended' ? 'Game Ended' : isMyTurn ? 'Your turn' : `${opp.username}'s turn`} {#if secondsRemaining <= TIMER_WARNING} {Math.ceil(secondsRemaining)}s {/if}
{#each me.board as card, slot}
{ if (sacrificeMode && card) { sacrifice(slot); } else if (card === null) { clickSlot(slot); } }} > {#if card && !destroyed.has(card.instance_id)}
{#if sacrificeMode}
🗡
{/if}
{:else}
{#if selectedHandIndex !== null} Play here {/if}
{/if}
{/each}
{#each me.hand as card, i} {/each}
{#if error}
{error}
{/if} {:else if phase === 'ended' && gameState?.result}

{gameState.result.winner_id === myId ? 'Victory' : 'Defeat'}

{gameState.result.reason}

{/if} {#if showDifficultyModal} {/if}