<%# /templates/chess/chess.html.ep %> % layout 'default'; % title 'Chess - Game ' . $game->{id}; <% content_for head => begin %> <%# Using chess.js for complex move validation (castling, en passant, checkmate) on the frontend %> <% end %>

♟️ Chess - Game #<%= $game->{id} %>

<% my $uid = current_user_id(); %>

<% if ($game->{status} eq 'waiting') { %> ⏳ Waiting for an opponent to join... <% } elsif ($game->{status} eq 'finished') { %> 🏆 Game Over! <% } else { %> <% if ($game->{current_turn} == current_user_id()) { %> 🟢 Your Turn <% } else { %> 🔴 Opponent's Turn <% } %> <% } %>

<% if ($uid == $game->{player1_id} || ($game->{player2_id} && $uid == $game->{player2_id})) { %> <% } %> 🚪 Exit to Lobby

Current FEN: <%= $game->{fen_state} %>