.world-actions {
  display: flex;
  flex-shrink: 0;
  gap: 5px;
}
.world-actions small {
  color: #9a451a;
  font-size: .85em;
}

.milestone-tray {
  --milestone-columns: 2;
  position: fixed;
  z-index: 20;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  left: max(12px, env(safe-area-inset-left));
  display: flex;
  flex-direction: row-reverse;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}
@media (min-width: 600px) { .milestone-tray { --milestone-columns: 3; } }
@media (min-width: 920px) { .milestone-tray { --milestone-columns: 4; } }

.milestone-arrival {
  position: relative;
  isolation: isolate;
  flex: 0 1 216px;
  min-width: 0;
  max-width: calc((100% - 10px * (var(--milestone-columns) - 1)) / var(--milestone-columns));
  animation: milestone-rise .58s cubic-bezier(.16,.8,.25,1) both;
  transition: opacity .32s ease;
}
.milestone-arrival.milestone-fading { opacity: 0; }
.milestone-arrival.ng-leave { display: none; animation: none; }
.milestone-painting {
  position: relative;
  overflow: hidden;
  border: 1px solid #d59243;
  border-radius: 10px;
  background: #57301d;
  box-shadow: 0 5px 18px #69351d52;
}
.milestone-painting img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: contain;
}
.milestone-caption {
  padding: 6px 9px 8px;
  background: linear-gradient(100deg, #522a19, #784122 68%, #57301d);
  color: #ffedc4;
}
.milestone-caption h2, .milestone-caption p {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.milestone-caption h2 { font-size: 15px; line-height: 1.25; }
.milestone-caption p { margin-top: 3px; color: #ffe1ad; font-size: 11px; line-height: 1.3; }

.milestone-flames {
  position: absolute;
  z-index: 1;
  bottom: -23%;
  left: 19%;
  width: 63%;
  height: 49%;
  pointer-events: none;
  mask-image: linear-gradient(90deg, #000 70%, #0009 93%, transparent);
  rotate: -90deg;
  transform-origin: 72% center;
  animation: milestone-fire .88s ease-out both;
}
.milestone-flames i {
  position: absolute;
  inset: 12% 0;
  background: linear-gradient(90deg, #c653272b, #d35525 38%, #f18e38 66%, #ffd780);
  clip-path: polygon(0 61%, 18% 57%, 36% 44%, 41% 36%, 32% 28%, 14% 25%, 29% 23%,
    47% 30%, 59% 31%, 55% 20%, 44% 9%, 58% 15%, 75% 27%, 86% 22%, 92% 10%, 100% 20%,
    100% 78%, 88% 82%, 75% 73%, 60% 72%, 49% 80%, 39% 94%, 43% 79%, 51% 68%, 34% 70%, 17% 68%);
  clip-path: shape(from 0 61%, curve to 36% 44% with 16% 62% / 29% 53%,
    curve to 14% 25% with 54% 30% / 27% 29%, curve to 59% 31% with 29% 19% / 48% 34%,
    curve to 44% 9% with 59% 23% / 50% 13%, curve to 86% 22% with 63% 11% / 69% 36%,
    curve to 100% 20% with 92% 17% / 91% 3%, line to 100% 78%,
    curve to 60% 72% with 83% 90% / 81% 64%, curve to 39% 94% with 47% 77% / 44% 85%,
    curve to 51% 68% with 39% 83% / 44% 74%, curve to 0 61% with 29% 76% / 19% 64%, close);
}
.milestone-flames i:nth-child(2) {
  inset: 25% -2% 24% 4%;
  background: linear-gradient(90deg, #c9522430, #f28a38 41%, #ffc072 75%, #ffdc91);
  transform: rotate(8deg);
}
.milestone-flames i:nth-child(3) {
  inset: 35% -4% 33% 22%;
  background: linear-gradient(90deg, #ed792439, #ffbc60 60%, #ffe2a0);
  transform: rotate(-8deg);
}
.milestone-flames span {
  position: absolute;
  top: var(--ember-y);
  left: var(--ember-x);
  width: var(--ember-size, 12px);
  height: 4px;
  border-radius: 100% 30% 60% 30%;
  background: linear-gradient(90deg, #b9532160, #f6a64c 78%, #ffd678);
  box-shadow: 1px 0 7px #d87535a0;
  animation: milestone-ember .65s .10s ease-out both;
}
.milestone-flames span:nth-of-type(1) { --ember-x: 13%; --ember-y: 26%; --ember-drift: -19px; }
.milestone-flames span:nth-of-type(2) { --ember-x: 27%; --ember-y: 18%; --ember-drift: -24px; --ember-size: 8px; }
.milestone-flames span:nth-of-type(3) { --ember-x: 47%; --ember-y: 35%; --ember-drift: -15px; }
.milestone-flames span:nth-of-type(4) { --ember-x: 20%; --ember-y: 67%; --ember-drift: 11px; --ember-size: 9px; }
.milestone-flames span:nth-of-type(5) { --ember-x: 31%; --ember-y: 80%; --ember-drift: 18px; --ember-size: 16px; }
.milestone-flames span:nth-of-type(6) { --ember-x: 52%; --ember-y: 72%; --ember-drift: 28px; }

@keyframes milestone-rise {
  0% { transform: translateY(calc(100% + 24px)) scale(.96); }
  72% { transform: translateY(-7px) scale(1.01); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes milestone-fire {
  0% { opacity: .25; transform: scaleX(.7); }
  25% { opacity: .95; transform: scaleX(1.2); }
  64% { opacity: .85; transform: scaleX(.95); }
  100% { opacity: 0; transform: scaleX(.3); }
}
@keyframes milestone-ember {
  0% { opacity: 0; transform: translateX(45px) scaleX(1.7) rotate(-14deg); }
  26% { opacity: .9; }
  100% { opacity: 0; transform: translate(-30px, var(--ember-drift)) scaleX(.5) rotate(-24deg); }
}
.static-celebration .milestone-arrival { animation: none; transition: none; }
.static-celebration .milestone-flames { display: none; }
@media (prefers-reduced-motion: reduce) {
  .milestone-arrival { animation: none; transition: none; }
  .milestone-flames { display: none; }
}

#milestone-dialog {
  width: min(760px, calc(100% - 28px));
  max-height: min(86svh, 820px);
}
.milestone-goals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 7px;
  margin: 8px 0 15px;
  padding: 0;
  list-style: none;
}
.milestone-goals li {
  display: grid;
  gap: 4px;
  padding: 7px 9px;
  border: 1px solid #e9cd8f;
  border-radius: 9px;
  background: #fff4d4;
  font-size: 12px;
}
.milestone-goals li span { color: #785231; }
.milestone-goals progress { width: 100%; height: 7px; accent-color: #b66b28; }
.milestone-nav { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0; }
.milestone-nav .utility[aria-pressed="true"] { background: #ffdb89; border-color: #b47b39; }

.milestone-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 8px;
}
.milestone-tile {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: stretch;
  min-width: 0;
  padding: 6px;
  border: 1px solid #dfb771;
  border-radius: 9px;
  background: #fff5d8;
  text-align: left;
}
.milestone-tile:hover:not(:disabled) { background: #ffe7a9; border-color: #b77a32; }
.milestone-tile img, .milestone-locked {
  display: grid;
  width: 100%;
  aspect-ratio: 3 / 2;
  place-items: center;
  margin-bottom: 2px;
  border-radius: 5px;
  object-fit: cover;
}
.milestone-locked { background: #f4e5c4; color: #795b3e; font-size: 12px; }
.milestone-tile strong { font-size: 13px; color: #653d20; }
.milestone-tile small { font-size: 11px; line-height: 1.35; color: #745537; }

@media (max-width: 540px) {
  .world-actions { flex-wrap: wrap; justify-content: flex-end; }
  .world-actions .utility { padding-inline: 5px; white-space: nowrap; }
  .milestone-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .milestone-goals { grid-template-columns: 1fr; }
}
