/* A small completion moment, scoped to interactive word-search boards. */
.puzzle-completion {
  position: fixed;
  width: min(440px, calc(100% - 32px));
  max-height: calc(100dvh - 48px);
  margin: auto;
  padding: 40px 28px 28px;
  overflow: auto;
  border: 1px solid #dcded2;
  border-radius: 16px;
  background: #fffdf8;
  color: #213c31;
  font-family: 'Trebuchet MS', sans-serif;
  text-align: center;
  box-shadow: 0 18px 70px rgb(33 60 49 / 18%);
}
.puzzle-completion::backdrop { background: rgb(33 60 49 / 38%); }
.puzzle-completion[open] { animation: completion-arrive 220ms ease-out; }
.puzzle-completion h2 {
  margin: 24px auto 26px;
  max-width: 13ch;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 34px;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -.035em;
}
.completion-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  margin: 8px auto 0;
  border-radius: 50%;
  background: #f7d56e;
  color: #244f40;
}
.completion-spark {
  position: absolute;
  top: calc(50% - 3px);
  left: calc(50% - 3px);
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: #b45309;
  pointer-events: none;
  opacity: 0;
  animation: completion-spark 750ms ease-out both;
}
.completion-spark:nth-of-type(even) { background: #2e5a45; border-radius: 50%; }
.spark-0 { --spark-x: -62px; --spark-y: -38px; }
.spark-1 { --spark-x: -28px; --spark-y: -66px; }
.spark-2 { --spark-x: 24px; --spark-y: -62px; }
.spark-3 { --spark-x: 62px; --spark-y: -26px; }
.spark-4 { --spark-x: 61px; --spark-y: 27px; }
.spark-5 { --spark-x: 29px; --spark-y: 58px; }
.spark-6 { --spark-x: -31px; --spark-y: 59px; }
.spark-7 { --spark-x: -63px; --spark-y: 22px; }
.completion-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.completion-actions .button { flex: 1 1 150px; min-height: 48px; padding: 12px 14px; font-size: 14px; }
@keyframes completion-arrive {
  from { opacity: 0; transform: translateY(8px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes completion-spark {
  0% { opacity: 0; transform: translate(0, 0) rotate(0deg); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--spark-x), var(--spark-y)) rotate(100deg); }
}
@media (max-width: 400px) {
  .puzzle-completion { padding: 32px 20px 22px; }
  .puzzle-completion h2 { font-size: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  .puzzle-completion[open], .completion-spark { animation: none; }
}
@media print {
  .puzzle-completion, .puzzle-completion::backdrop { display: none !important; }
}
