used to emphasize that something was achieved with difficulty or effort; often implies disappointment when the result is wasted ("having gone to the trouble of...").
せっかく来たのに、店が閉まっていた。
We went all that way, but the shop was closed.
せっかく作ったのに、誰も食べてくれなかった。
I went to the trouble of making it, but no one ate it.
せっかくのチャンスを逃さないでください。
Please don't miss this hard‑earned opportunity.
(literary/rare) something rare, valuable or long‑awaited — a worthwhile or precious opportunity/item.
せっかくの機会を無駄にしてはいけない。
You must not waste this rare opportunity.
せっかくの品だから、大切に保管しておこう。
It's a precious item, so let's keep it carefully.
(rare) denotes a kind or generous disposition; an old-fashioned usage.
せっかくな計らいに、みんな感謝した。
Everyone was grateful for the generous arrangement.
used adverbially to mean 'especially' or 'specially', often implying that something is done with intent or for a special reason.
今日はせっかくの誕生日だから、外で食事しよう。
Since it's a special birthday, let's eat out.
せっかく用意したプレゼントを見せてあげた。
I showed the present I had prepared especially for them.