<% if @game.igdb_game&.cover_url.present? %>
<%= image_tag @game.igdb_game.cover_image_url("cover_big"), alt: @game.title, class: "w-32 h-44 object-cover rounded-lg shadow-lg" %>
IGDB
<% end %>

<%= @game.title %>

<%= @game.platform.name %>

<% if @game.igdb_id.present? %>
✓ IGDB Matched <% if @game.igdb_match_confidence %> <%= @game.igdb_match_confidence.to_i %>% confidence <% end %>
<% if @game.igdb_game&.first_release_date %>

Released: <%= @game.igdb_game.first_release_date.strftime("%B %Y") %>

<% end %> <% elsif current_user.igdb_sync_enabled? %>
No IGDB Match <%= link_to "Find Match", igdb_matches_path, class: "text-xs text-indigo-600 hover:text-indigo-800" %>
<% end %>
<%= link_to "Edit", edit_game_path(@game), class: "px-4 py-2 bg-indigo-600 text-white rounded hover:bg-indigo-700" %> <%= button_to "Delete", @game, method: :delete, data: { turbo_confirm: "Are you sure you want to delete '#{@game.title}'? This will permanently remove it from your collection." }, class: "px-4 py-2 bg-red-600 text-white rounded hover:bg-red-700" %>
<% if @game.igdb_game&.summary.present? %>

About this game (from IGDB)

<%= @game.igdb_game.summary %>

<% end %>
<%= @game.format.titleize %>

<%= @game.date_added.strftime("%B %d, %Y") %>

<%= @game.completion_status&.titleize || "Not set" %>

<%= @game.user_rating ? "⭐ #{@game.user_rating}/5" : "Not rated" %>

<% if @game.genres.any? %>
<% @game.genres.each do |genre| %> <%= genre.name %> <% end %>
<% end %> <% if @game.physical? %>

Physical Details

<%= @game.condition&.titleize || "Not specified" %>

<%= @game.price_paid ? "$#{sprintf("%.2f", @game.price_paid)}" : "Not specified" %>

<%= @game.location || "Not specified" %>

<% end %> <% if @game.digital? %>

Digital Details

<%= @game.digital_store || "Not specified" %>

<%= @game.price_paid ? "$#{sprintf("%.2f", @game.price_paid)}" : "Not specified" %>

<% end %> <% if @game.notes.present? %>

<%= @game.notes %>

<% end %>
<% if @game.collections.any? %>
<% @game.collections.each do |collection| %> <%= link_to collection.name, collection, class: "px-3 py-1 bg-indigo-100 text-indigo-700 rounded-full text-sm hover:bg-indigo-200" %> <% end %>
<% else %>

Not in any collections. <%= link_to "Edit game", edit_game_path(@game), class: "text-indigo-600 hover:text-indigo-800" %> to add to collections.

<% end %>
<%= link_to "← Back to Games", games_path, class: "text-indigo-600 hover:text-indigo-800" %>