/* Achievement unlock feedback: instant capsule + full-screen first-unlock ceremony. */

/* ---------- 1. Instant capsule ---------- */
.achievement-capsule {
  --ac-bg: rgba(250, 249, 245, .74);
  --ac-ink: #2f3641;
  --ac-sub: #6e7580;
  --ac-edge: rgba(255, 255, 255, .78);
  --ac-shadow: 0 12px 32px rgba(24, 35, 51, .14), 0 2px 6px rgba(24, 35, 51, .06);
  position: fixed;
  z-index: 1200;
  top: max(14px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(420px, calc(100vw - 28px));
  padding: 7px 18px 7px 9px;
  border: 1px solid var(--ac-edge);
  border-radius: 999px;
  background: var(--ac-bg);
  color: var(--ac-ink);
  box-shadow: var(--ac-shadow), inset 0 1px 0 rgba(255, 255, 255, .72);
  backdrop-filter: blur(20px) saturate(1.35);
  -webkit-backdrop-filter: blur(20px) saturate(1.35);
  text-decoration: none;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
/* Fine rim highlight instead of a heavy border. */
.achievement-capsule::after {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: inherit;
  background: linear-gradient(140deg, rgba(255, 255, 255, .96), rgba(255, 255, 255, .1) 42%, rgba(255, 255, 255, .55));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.achievement-capsule-stack { display: flex; flex: none; align-items: center; }
.achievement-capsule-stack img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  filter: drop-shadow(0 2px 3px rgba(50, 40, 16, .22));
}
.achievement-capsule-stack img + img { margin-left: -12px; }
.achievement-capsule-stack img:nth-child(1) { z-index: 3; }
.achievement-capsule-stack img:nth-child(2) { z-index: 2; }
.achievement-capsule-stack img:nth-child(3) { z-index: 1; }
.achievement-capsule-copy { display: flex; min-width: 0; flex-direction: column; line-height: 1.3; }
.achievement-capsule-copy strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.achievement-capsule-copy small {
  font-size: 10.5px;
  letter-spacing: .05em;
  color: var(--ac-sub);
}

/* ---------- 2. New marker on the achievements entry ---------- */
.achievement-new-host { position: relative; }
.achievement-new {
  position: static;
  display: inline-block;
  margin-left: 6px;
  padding: 1px 4px;
  border: 1px solid rgba(150, 118, 52, .26);
  border-radius: 5px;
  background: linear-gradient(180deg, #fbf1d1, #f1dfab);
  box-shadow: 0 1px 2px rgba(90, 70, 20, .15), inset 0 1px 0 rgba(255, 255, 255, .72);
  color: #7d5d22;
  font: 600 8.5px/1.4 -apple-system, "PingFang SC", sans-serif;
  letter-spacing: .07em;
  text-transform: uppercase;
  vertical-align: super;
  pointer-events: none;
}
.achievement-new-host .achievement-new { position: absolute; right: 10px; top: 8px; margin: 0; }

/* ---------- 3. Full-screen first-unlock ceremony ---------- */
.achievement-unlock {
  --unlock-rgb: 214, 186, 128;
  --ul-ink: #2b333f;
  --ul-sub: #757b84;
  --ul-rule: rgba(56, 50, 38, .14);
  --ul-veil: rgba(245, 239, 228, .92);
  --ul-primary: #1d2e46;
  --ul-primary-ink: #f8f5ee;
  --ul-primary-shadow: 0 12px 26px rgba(24, 38, 60, .26);
  position: fixed;
  inset: 0;
  z-index: 1500;
  overflow: hidden;
  overscroll-behavior: contain;
  isolation: isolate;
  cursor: default;
  user-select: none;
  color: var(--ul-ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
html.achievement-unlock-open,
html.achievement-unlock-open body { overflow: hidden; }

/* Phase 1 — the page blurs into a warm, glassy veil. */
.unlock-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(88% 68% at 50% 30%, rgba(255, 253, 247, .9), rgba(247, 242, 232, .8) 52%, rgba(238, 232, 220, .92)),
    linear-gradient(158deg, #f8f3e8, #efe8da);
  -webkit-backdrop-filter: blur(18px) saturate(1.05);
  backdrop-filter: blur(18px) saturate(1.05);
}
.unlock-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(44% 36% at 50% 44%, rgba(var(--unlock-rgb), .2), transparent 72%);
}

.unlock-sequence {
  /* Absolute so the shelf underneath can be measured while the two cross-fade. */
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 2.6vh, 24px);
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  padding: calc(env(safe-area-inset-top) + 34px) 24px calc(env(safe-area-inset-bottom) + 40px);
  text-align: center;
}
.unlock-sequence[hidden] { display: none; }

/* Phase 2–4 stage: every effect is centred on the badge. */
.unlock-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(176px, 40vmin, 286px);
  aspect-ratio: 1;
  margin-block: clamp(4px, 1.4vh, 14px);
}
/* A quiet glow that stays after the burst. */
.unlock-stage::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 136%;
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--unlock-rgb), .18), rgba(var(--unlock-rgb), .05) 48%, transparent 70%);
  opacity: 0;
  transition: opacity .9s ease;
}
.achievement-unlock.is-settled .unlock-stage::before { opacity: 1; }

.unlock-core {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 150%;
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--unlock-rgb), .48), rgba(var(--unlock-rgb), .14) 38%, transparent 68%);
  filter: blur(9px);
  opacity: 0;
  will-change: transform, opacity;
}
.unlock-rays,
.unlock-dust,
.unlock-sparks { position: absolute; inset: 0; pointer-events: none; }
.unlock-rays i {
  position: absolute;
  left: 50%;
  bottom: 50%;
  width: 1.5px;
  height: 33%;
  margin-left: -.75px;
  border-radius: 1px;
  transform-origin: 50% 100%;
  background: linear-gradient(to top, rgba(var(--unlock-rgb), 0), rgba(255, 251, 238, .85) 58%, rgba(var(--unlock-rgb), 0));
  opacity: 0;
  will-change: transform, opacity;
}
.unlock-dust i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  margin: -2px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 252, 242, .95), rgba(var(--unlock-rgb), .68) 58%, transparent 74%);
  box-shadow: 0 0 6px rgba(var(--unlock-rgb), .5);
  opacity: 0;
  will-change: transform, opacity;
}
.unlock-halo {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 118%;
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--unlock-rgb), .5), rgba(var(--unlock-rgb), .16) 42%, transparent 68%);
  filter: blur(2px);
  opacity: 0;
  will-change: transform, opacity;
}

.unlock-badge-mount {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 20px 30px rgba(44, 36, 18, .22)) drop-shadow(0 2px 3px rgba(44, 36, 18, .16));
  will-change: transform;
}
.achievement-unlock.is-settled .unlock-badge-mount { animation: unlock-float 5.8s ease-in-out 2.1s infinite alternate; }
@keyframes unlock-float {
  from { transform: translateY(0); }
  to { transform: translateY(-7px); }
}
.unlock-badge {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: 50% 50%;
  will-change: transform, opacity, filter;
}
.unlock-sheen {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: linear-gradient(112deg, transparent 40%, rgba(255, 252, 240, .92) 48%, rgba(255, 255, 255, .2) 54%, transparent 61%) 170% 0 / 260% 100% no-repeat;
  -webkit-mask: var(--badge-mask, none) center / contain no-repeat;
  mask: var(--badge-mask, none) center / contain no-repeat;
  mix-blend-mode: screen;
  opacity: 0;
  pointer-events: none;
}
.unlock-sparks i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  margin: -5px;
  background: linear-gradient(180deg, #fffdf6, rgba(var(--unlock-rgb), .92));
  clip-path: polygon(50% 0, 58% 42%, 100% 50%, 58% 58%, 50% 100%, 42% 58%, 0 50%, 42% 42%);
  opacity: 0;
  will-change: transform, opacity;
}
.unlock-sparks i:nth-child(3n) { width: 7px; height: 7px; margin: -3.5px; }
.unlock-sparks i:nth-child(4n) { background: linear-gradient(180deg, #fff, rgba(255, 255, 255, .55)); }

.unlock-name {
  margin: 0;
  font-size: clamp(21px, 4.6vmin, 29px);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: .045em;
}
.unlock-progress {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: .26em;
  text-indent: .26em;
  color: var(--ul-sub);
  opacity: .75;
  font-variant-numeric: tabular-nums;
}
.unlock-progress:empty { display: none; }
.unlock-progress[hidden] { display: none; }

.unlock-skip {
  position: fixed;
  z-index: 3;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  padding: 6px 12px;
  border: 1px solid var(--ul-rule);
  border-radius: 999px;
  background: transparent;
  color: var(--ul-sub);
  font-family: inherit;
  font-size: 11.5px;
  line-height: 1.4;
  letter-spacing: .06em;
  cursor: pointer;
}
.unlock-skip[hidden] { display: none; }
.unlock-skip:focus-visible { outline: 2px solid rgba(var(--unlock-rgb), .8); outline-offset: 2px; }

/* ---------- 3b. Final collection overview ---------- */
.unlock-collection {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 3vh, 30px);
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  padding: calc(env(safe-area-inset-top) + clamp(26px, 6vh, 62px)) 0
    calc(env(safe-area-inset-bottom) + clamp(16px, 3vh, 32px));
  text-align: center;
}
.unlock-collection[hidden] { display: none; }
.unlock-collection-title {
  flex: none;
  margin: 0;
  padding: 0 24px;
  font-size: clamp(20px, 3.4vmin, 27px);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: .06em;
}
.unlock-showcase {
  --badge-size: 140px;
  --showcase-gap: 30px;
  --showcase-row-gap: 32px;
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
  gap: var(--showcase-row-gap);
  box-sizing: border-box;
  width: 100%;
  min-height: 0;
  max-height: 100%;
  padding: clamp(10px, 2.2vh, 22px) clamp(18px, 4vw, 40px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.unlock-showcase::-webkit-scrollbar { display: none; }
.unlock-row {
  display: flex;
  flex: none;
  align-items: flex-start;
  justify-content: center;
  gap: var(--showcase-gap);
}
.unlock-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(8px, 1.4vh, 12px);
  width: var(--badge-size);
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.unlock-cell:focus-visible { outline: none; }
/* The ring hugs the glow, not the artwork, so the badge never gains a frame. */
.unlock-cell:focus-visible .unlock-cell-inner::after {
  content: "";
  position: absolute;
  inset: -8%;
  border-radius: 50%;
  box-shadow: 0 0 0 1.5px rgba(var(--cell-rgb, 214, 186, 128), .5),
    0 0 24px rgba(var(--cell-rgb, 214, 186, 128), .28);
  pointer-events: none;
}
.unlock-cell-inner {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--badge-size);
  height: var(--badge-size);
  isolation: isolate;
}
/* A warm, diffused glow — light, never a disc, base or card. */
.unlock-cell-inner::before {
  content: "";
  position: absolute;
  inset: -26%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(205, 176, 120, .26), rgba(205, 176, 120, .08) 44%, transparent 70%);
  filter: blur(10px);
  opacity: .85;
  pointer-events: none;
}
.unlock-cell img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 16px 22px rgba(44, 36, 18, .16)) drop-shadow(0 2px 4px rgba(44, 36, 18, .12));
  /* A barely-there drift: the shelf stays alive without motion noise. */
  animation: unlock-drift 11s ease-in-out infinite;
}
.unlock-row > .unlock-cell:nth-child(2n) img { animation-delay: -3.2s; }
.unlock-row > .unlock-cell:nth-child(2n+1):nth-child(n+3) img { animation-delay: -6.1s; }
.unlock-row > .unlock-cell:nth-child(4n) img { animation-delay: -8.4s; }
@keyframes unlock-drift {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}
.unlock-cell span {
  display: -webkit-box;
  overflow: hidden;
  font-size: clamp(11px, 1.55vmin, 13px);
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: .02em;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.unlock-glint {
  position: absolute;
  z-index: 2;
  top: 10%;
  right: 6%;
  width: 9px;
  height: 9px;
  background: linear-gradient(180deg, #fffdf6, rgba(226, 200, 150, .9));
  clip-path: polygon(50% 0, 58% 42%, 100% 50%, 58% 58%, 50% 100%, 42% 58%, 0 50%, 42% 42%);
  opacity: 0;
  animation: unlock-twinkle 7.5s ease-in-out infinite;
  pointer-events: none;
}
.unlock-glint::after {
  content: "";
  position: absolute;
  left: -58%;
  top: 210%;
  width: 5px;
  height: 5px;
  background: rgba(255, 253, 244, .9);
  clip-path: inherit;
  opacity: .7;
}
@keyframes unlock-twinkle {
  0%, 86%, 100% { opacity: 0; }
  90% { opacity: .7; }
  94% { opacity: .12; }
}
.unlock-collection-foot {
  position: relative;
  flex: none;
  display: flex;
  justify-content: center;
  padding-top: clamp(12px, 2.4vh, 20px);
}
/* Content melts into the veil behind the action instead of a toolbar. */
.unlock-collection-foot::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  width: 100vw;
  height: 64px;
  translate: -50% 0;
  background: linear-gradient(to bottom, transparent, var(--ul-veil));
  pointer-events: none;
}
.unlock-done {
  min-height: 44px;
  padding: 0 34px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--ul-primary);
  color: var(--ul-primary-ink);
  box-shadow: var(--ul-primary-shadow), inset 0 1px 0 rgba(255, 255, 255, .16);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: .06em;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .2s ease;
}
.unlock-done:active { transform: scale(.97); }
.unlock-done:focus-visible { outline: 2px solid rgba(var(--unlock-rgb), .9); outline-offset: 3px; }
.unlock-ghost {
  position: fixed;
  z-index: 6;
  object-fit: contain;
  pointer-events: none;
  will-change: transform, opacity;
}

/* ---------- 4. Badge detail ---------- */
.unlock-detail {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
  padding: calc(env(safe-area-inset-top) + 64px) 24px calc(env(safe-area-inset-bottom) + 56px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  text-align: center;
}
.unlock-detail::-webkit-scrollbar { display: none; }
.unlock-detail[hidden] { display: none; }
/* The shelf blurs back into the veil; the badge and its story hold the frame. */
.unlock-detail-scrim {
  position: absolute;
  inset: 0;
  background: radial-gradient(72% 60% at 50% 40%,
    rgba(251, 247, 238, .84), rgba(243, 237, 225, .91) 68%, rgba(238, 231, 218, .95));
  -webkit-backdrop-filter: blur(22px) saturate(1.05);
  backdrop-filter: blur(22px) saturate(1.05);
  cursor: default;
}
.unlock-detail-scrim::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(36% 30% at 50% 36%, rgba(var(--cell-rgb, 214, 186, 128), .2), transparent 72%);
  pointer-events: none;
}
.unlock-detail-body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(6px, 1vh, 10px);
  box-sizing: border-box;
  width: min(100%, 34em);
  margin: auto;
}
.unlock-detail-visual {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(176px, 27vmin, 240px);
  aspect-ratio: 1;
  margin-bottom: clamp(6px, 1.6vh, 14px);
}
.unlock-detail-visual::before {
  content: "";
  position: absolute;
  inset: -30%;
  border-radius: 50%;
  /* Feather in the gradient itself: no blur layer, no edge to catch the eye. */
  background: radial-gradient(circle closest-side,
    rgba(var(--cell-rgb, 214, 186, 128), .26),
    rgba(var(--cell-rgb, 214, 186, 128), .12) 42%,
    rgba(var(--cell-rgb, 214, 186, 128), 0) 100%);
  pointer-events: none;
}
.unlock-detail-badge {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 22px 30px rgba(44, 36, 18, .2)) drop-shadow(0 3px 6px rgba(44, 36, 18, .14));
}
.unlock-detail-kicker {
  margin: 0;
  color: var(--ul-sub);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .24em;
}
.unlock-detail-name {
  margin: 0;
  font-size: clamp(19px, 2.6vmin, 24px);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: .02em;
}
.unlock-detail-rule {
  margin: 2px 0 0;
  color: var(--ul-sub);
  font-size: clamp(12px, 1.5vmin, 13px);
  line-height: 1.7;
}
.unlock-detail-desc {
  margin: 8px 0 0;
  max-width: 30em;
  color: var(--ul-ink);
  font-size: clamp(12.5px, 1.6vmin, 14px);
  line-height: 1.85;
  opacity: .72;
}
.unlock-detail-date {
  margin: 8px 0 0;
  color: var(--ul-sub);
  font-size: 11px;
  letter-spacing: .1em;
}
.unlock-detail-close {
  position: absolute;
  z-index: 2;
  top: calc(env(safe-area-inset-top) + 18px);
  right: 18px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(56, 50, 38, .14);
  border-radius: 999px;
  background: rgba(255, 255, 255, .46);
  color: var(--ul-ink);
  cursor: pointer;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.unlock-detail-close svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}
.unlock-detail-close:focus-visible { outline: 2px solid rgba(var(--cell-rgb, 214, 186, 128), .8); outline-offset: 2px; }

/* ---------- 5. Night mode ---------- */
body.atmo-on.atmo-night .achievement-unlock,
[data-theme="dark"] .achievement-unlock,
body.dark .achievement-unlock {
  --ul-ink: #f1ece2;
  --ul-sub: #a9a49a;
  --ul-rule: rgba(255, 255, 255, .13);
  --ul-veil: rgba(24, 29, 38, .94);
  --ul-primary: #ece3cf;
  --ul-primary-ink: #1d2836;
  --ul-primary-shadow: 0 12px 26px rgba(0, 0, 0, .45);
}
body.atmo-on.atmo-night .unlock-backdrop,
[data-theme="dark"] .unlock-backdrop,
body.dark .unlock-backdrop {
  background:
    radial-gradient(88% 68% at 50% 30%, rgba(58, 66, 82, .82), rgba(30, 36, 47, .88) 55%, rgba(20, 24, 32, .94)),
    linear-gradient(158deg, #1d2430, #141920);
}
/* At night each badge lends the shelf its own faint colour instead of plain champagne. */
body.atmo-on.atmo-night .unlock-cell-inner::before,
[data-theme="dark"] .unlock-cell-inner::before,
body.dark .unlock-cell-inner::before {
  background: radial-gradient(circle,
    rgba(var(--cell-rgb, 214, 186, 128), .3),
    rgba(var(--cell-rgb, 214, 186, 128), .09) 46%,
    transparent 72%);
}
body.atmo-on.atmo-night .unlock-cell img,
[data-theme="dark"] .unlock-cell img,
body.dark .unlock-cell img {
  filter: drop-shadow(0 16px 24px rgba(0, 0, 0, .46)) drop-shadow(0 2px 4px rgba(0, 0, 0, .34));
}
body.atmo-on.atmo-night .unlock-glint,
[data-theme="dark"] .unlock-glint,
body.dark .unlock-glint {
  background: linear-gradient(180deg, #fffdf4, rgba(226, 210, 176, .82));
}
body.atmo-on.atmo-night .unlock-detail-scrim,
[data-theme="dark"] .unlock-detail-scrim,
body.dark .unlock-detail-scrim {
  background: radial-gradient(74% 62% at 50% 38%,
    rgba(30, 35, 45, .88), rgba(22, 26, 35, .95) 68%, rgba(16, 19, 26, .97));
}
body.atmo-on.atmo-night .unlock-detail-close,
[data-theme="dark"] .unlock-detail-close,
body.dark .unlock-detail-close {
  border-color: rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .08);
}
body.atmo-on.atmo-night .unlock-detail-badge,
[data-theme="dark"] .unlock-detail-badge,
body.dark .unlock-detail-badge {
  filter: drop-shadow(0 22px 34px rgba(0, 0, 0, .5)) drop-shadow(0 3px 6px rgba(0, 0, 0, .36));
}
body.atmo-on.atmo-night .achievement-capsule,
[data-theme="dark"] .achievement-capsule,
body.dark .achievement-capsule {
  --ac-bg: rgba(34, 39, 49, .72);
  --ac-ink: #f1ede4;
  --ac-sub: #b6b0a4;
  --ac-edge: rgba(255, 255, 255, .16);
  --ac-shadow: 0 12px 32px rgba(0, 0, 0, .42), 0 2px 6px rgba(0, 0, 0, .24);
}
body.atmo-on.atmo-night .achievement-new,
[data-theme="dark"] .achievement-new,
body.dark .achievement-new {
  background: linear-gradient(180deg, #453b24, #38301e);
  border-color: rgba(214, 188, 128, .3);
  color: #e8d5a8;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .08);
}
.achievement-capsule:focus-visible { outline: 2px solid #b89a55; outline-offset: 3px; }

/* ---------- 6. Compact viewports ---------- */
@media (max-width: 520px) {
  .unlock-sequence { gap: 12px; padding-inline: 20px; }
  .unlock-stage { width: min(64vw, 236px); }
  .unlock-collection { gap: 12px; }
  .unlock-collection-title { font-size: 19px; padding-inline: 18px; }
  .unlock-showcase { padding-inline: 12px; }
  .unlock-done { padding: 0 28px; }
  .unlock-detail { padding-inline: 22px; }
  .unlock-detail-visual { width: clamp(158px, 42vmin, 210px); }
  .unlock-detail-desc { margin-top: 6px; }
}
@media (max-height: 560px) {
  .unlock-sequence {
    gap: 8px;
    padding-block: calc(env(safe-area-inset-top) + 14px) calc(env(safe-area-inset-bottom) + 14px);
  }
  .unlock-stage { width: min(34vmin, 160px); }
  .unlock-name { font-size: 19px; }
  .unlock-collection {
    gap: 8px;
    padding-block: calc(env(safe-area-inset-top) + 14px) calc(env(safe-area-inset-bottom) + 12px);
  }
  .unlock-collection-title { font-size: 17px; }
  .unlock-showcase { padding-block: 6px; }
  .unlock-collection-foot { padding-top: 8px; }
  .unlock-done { min-height: 38px; }
  .unlock-detail { padding-block: calc(env(safe-area-inset-top) + 40px) calc(env(safe-area-inset-bottom) + 26px); }
  .unlock-detail-visual { width: min(28vmin, 132px); margin-bottom: 2px; }
}
/* ---------- 7. Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .unlock-core,
  .unlock-rays,
  .unlock-dust,
  .unlock-halo,
  .unlock-sheen,
  .unlock-sparks,
  .unlock-glint { display: none; }
  .unlock-cell img { animation: none; }
  .achievement-unlock.is-settled .unlock-badge-mount { animation: none; }
  .unlock-stage::before { transition: none; }
  .unlock-done { transition: none; }
}
