.power-badge {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:.3em;
  color:#ffe3a4;
  background:#231c25;
  border:1px solid #b98d56;
  border-radius:.55rem;
  padding:.2em .45em;
  font-weight:800;
  cursor:pointer}
.power-badge img {
  width:1.75em;
  height:1.75em}
.power-earned {
  color:#ffdb85}
.power-badge.ready img {
  animation:power-ready 4s ease infinite}
:is(#powerDialog,#tokenDialog) {
  position:fixed;
  inset:0;
  margin:auto;
  width:min(22rem,90vw);
  height:fit-content;
  max-height:92dvh;
  overflow:auto;
  text-align:center;
  border:1px solid #e4b869;
  border-radius:1rem;
  background:radial-gradient(ellipse at 45% 34%,#45374e,#171724 70%);
  padding:1.5rem;
  color:#fff3dd}
:is(#powerDialog,#tokenDialog)::backdrop {
  background:#090a12b8}
:is(#powerDialog,#tokenDialog) form {
  position:absolute;
  top:.45rem;
  right:.5rem}
:is(#powerDialog,#tokenDialog) form button {
  color:#ffeccc;
  background:transparent;
  border:0;
  font-size:1.55rem}
.capsule-stage {
  position: relative;
  width: min(11rem, 48vw);
  aspect-ratio: 190 / 222;
  margin: auto;
}
/* The halo extends beyond the SVG viewport and fades before its own edges. */
.capsule-stage::before {
  content: "";
  position: absolute;
  inset: 2% -20% -2%;
  pointer-events: none;
  background: radial-gradient(ellipse 50% 48% at 50% 55%,
    rgb(255 232 168 / 70%) 0%, rgb(255 185 85 / 32%) 37%,
    rgb(255 196 108 / 10%) 68%, transparent 98%);
}
.capsule-art { position: relative; display: block; width: 100%; height: 100%; }
.capsule-lid { transition: transform 320ms ease-out, opacity 320ms ease-out; }
.revealed .capsule-lid { transform: translateY(-45px); opacity: .16; }
#powerDialog .power-result-icon {
  position: absolute;
  left: 50%;
  top: 52%;
  transform: translate(-50%, -50%);
  width: 39%;
  height: auto;
  aspect-ratio: 1;
  margin: 0;
  filter: drop-shadow(0 0 5px #ffd58280);
}
@media (prefers-reduced-motion: reduce) {
  .capsule-lid { transition: none; }
}
.power-charge {
  display:flex;
  gap:.3rem;
  justify-content:center;
  margin:.7rem}
.power-charge i {
  width:1.3rem;
  height:.28rem;
  border-radius:1rem;
  background:#564755}
.charging .power-charge i {
  animation:power-fill .6s linear both}
.charging i:nth-child(2) {
  animation-delay:.6s}
.charging i:nth-child(3) {
  animation-delay:1.2s}
.charging i:nth-child(4) {
  animation-delay:1.8s}
.charging i:nth-child(5) {
  animation-delay:2.4s}
.charging .capsule-art {
  animation:power-shake 1.5s ease 2}
.revealed .power-charge i {
  background:#ffe5a2}
@keyframes power-fill {
  to {
  background:#ffe5a2;
  box-shadow:0 0 6px #ffc457}
}
@keyframes power-shake {
  46%,72% {
  transform:rotate(0)}
52%,62% {
  transform:rotate(-6deg)}
57%,67% {
  transform:rotate(6deg)}
}
@keyframes power-ready {
  42%,55% {
  transform:rotate(0)}
47% {
  transform:rotate(-6deg);
  filter:drop-shadow(0 0 3px gold)}
51% {
  transform:rotate(5deg)}
}
@media(prefers-reduced-motion:reduce) {
  .power-badge.ready img,.charging .capsule-art {
  animation:none}
}

#inventoryTray button.power-badge {
  display:flex;
  align-items:center;
  gap:.08rem;
  flex-basis:auto;
  padding:2px 5px;
  color:#ffdf99}
#inventoryTray .power-badge img {
  width:24px;
  height:24px}
#powerOpen[hidden] {
  display:none}

.revival-portrait {
  display: grid;
  place-items: center;
  width: min(8rem, 34vw);
  aspect-ratio: 1.12;
  margin: .8rem auto;
  background: linear-gradient(155deg,#ffedb3,#ff9437 42%,#c24325 70%,#ffcb75);
  clip-path: polygon(24% 0,76% 0,100% 50%,76% 100%,24% 100%,0 50%);
}
.revival-portrait :is(img,.avatar) {
  display: grid;
  place-items: center;
  width: 93%;
  height: 92%;
  object-fit: cover;
  clip-path: inherit;
  border: 0;
  border-radius: 0;
  background: #572d24;
  color: #ffdfa3;
  font-size: 2.7rem;
}
.revival-burst { animation: revival-flare 1.25s ease-out both; }
@keyframes revival-flare {
  0% { opacity: 0; transform: scale(.7); }
  18% { opacity: 1; }
  70% { opacity: .85; }
  100% { opacity: 0; transform: scale(1.4); }
}
@media (prefers-reduced-motion: reduce) {
  .revival-burst { animation: none; }
  .revival-burst g { display: none; }
}

:is(#powerDialog,#tokenDialog) form button {display:grid;place-items:center;width:40px;height:40px;min-height:0;padding:0;line-height:1}
:is(#powerDialog,#tokenDialog) form button:focus-visible {outline:2px solid #ffe4a3;outline-offset:-4px}
#powerTitle {padding-inline:1.3rem}
#inventoryTray #readyCapsule {position:absolute;left:0;bottom:calc(100% + 7px);width:72px;height:72px;padding:0;background:none;border:0}
#readyCapsule img {width:100%;height:100%;animation:capsule-hover 3s ease-in-out infinite}
@keyframes capsule-hover {0%,100% {transform:translateY(0)} 45% {transform:translateY(-4px) rotate(0)} 50% {transform:translateY(-5px) rotate(-6deg)} 55% {transform:translateY(-5px) rotate(5deg)} 61% {transform:translateY(-4px)}}
@media(max-width:760px){#inventoryTray:not([hidden]) {position:relative;left:auto;bottom:auto}#inventoryTray #readyCapsule {width:44px;height:44px;bottom:calc(100% + 2px)}}
@media(prefers-reduced-motion:reduce){#readyCapsule img {animation:none}}
