<div class="auth-container">
  <div class="auth-card">
    <header>
      <h1><%= t(".title") %></h1>
      <small><%= t(".subtitle") %></small>
    </header>

    <%= form_with url: verify_totp_login_attempt_path(@attempt), method: :post, local: true do |form| %>
      <%= hidden_field_tag :return_to, params[:return_to] if params[:return_to].present? %>
      <fieldset>
        <%= form.label :code, t(".code_label") %>
        <%= form.text_field :code,
            required: true,
            inputmode: "numeric",
            pattern: "[0-9]{6}",
            autofocus: true,
            autocomplete: "one-time-code",
            maxlength: 6,
            placeholder: t(".placeholder") %>
      </fieldset>
      <%= form.submit "#{t('.verify')} →" %>
    <% end %>

    <% if @attempt.backup_code_available? %>
      <footer>
        <p>
          <%= t(".lost_authenticator") %>
          <%= link_to t(".use_backup_code"), backup_code_login_attempt_path(@attempt) %>
        </p>
      </footer>
    <% end %>
  </div>
</div>
