/* Main page: the "stage" in each slot. On the left the staked skins share it, on the right stands the target,
   the Mystery showcase or the Mystery drop. Both stages are the same size and start at the same height,
   so the two slots mirror each other and nothing moves when the content changes. */

.slot-body {
  --stage-height: 220px;
  --stage-image: 150px;
  --stage-pad: 12px;
  position: relative;
}

/* The frame both stages share: dashed while empty, a solid card once something stands in it */
.stage {
  position: relative;
  width: 100%;
  height: var(--stage-height);
  border-radius: var(--radius);
}

.stage-empty {
  border: 1px dashed var(--iron-lighter);
  background: rgba(0, 0, 0, 0.12) no-repeat center;
}

.stage-card {
  background: linear-gradient(180deg, var(--iron) 55%, color-mix(in srgb, var(--rarity, var(--steel)) 16%, var(--iron)));
  border: var(--border);
  border-bottom: 2px solid var(--rarity, var(--steel));
}

/* Empty slots: a dim knife over the upgrade arrows (Gemini, owner 2026-11-27), mirrored on the target side,
   so the first screen is not two blank boxes. The picture is dark, so it stays in the background. */
.stake-list.stage-empty {
  background-image: url("/images/forge/slot-knife.jpg");
  background-size: cover;
}

.target.stage-empty {
  background-image: url("/images/forge/slot-knife-mirror.jpg");
  background-size: cover;
}

/* The staked skins: one fills the stage, two share it in halves, three in thirds, and so on.
   forge.js sets --stake-cols and --stake-row; more than two rows scroll. */
.stake-list {
  display: grid;
  grid-template-columns: repeat(var(--stake-cols, 1), minmax(0, 1fr));
  grid-auto-rows: var(--stake-row, 1fr);
  gap: 8px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  list-style: none;
}

/* The cell stretches the tile with flex, which every browser does the same way;
   it is also the size container that decides whether the name fits */
.stake-list > li {
  display: flex;
  min-width: 0;
  min-height: 0;
  container-type: size;
}

.stake-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 4px;
  min-width: 0;
  padding: 8px;
  overflow: hidden;
  background: linear-gradient(180deg, var(--iron) 50%, color-mix(in srgb, var(--rarity, var(--steel)) 18%, var(--iron)));
  border: var(--border);
  border-bottom: 2px solid var(--rarity, var(--steel));
  border-radius: var(--radius);
  color: var(--white-hot);
  font: inherit;
  cursor: pointer;
}

.stake-tile:hover {
  border-top-color: var(--steel);
  border-left-color: var(--steel);
  border-right-color: var(--steel);
}

.stake-tile:focus-visible {
  outline: 2px solid var(--ember-light);
  outline-offset: 1px;
}

.stake-image {
  flex: 1 1 0;
  width: 100%;
  min-height: 0;
  max-height: var(--stage-image);
  object-fit: contain;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5));
}

.stake-name {
  display: none;
  overflow: hidden;
  max-width: 100%;
  font-size: var(--text-sm);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stake-tile .skin-price {
  gap: 4px;
  font-size: var(--text-xs);
}

.stake-tile .coin {
  width: 14px;
  height: 14px;
}

/* Big tiles have room for the name and a bigger price */
@container (min-width: 150px) and (min-height: 150px) {
  .stake-name {
    display: block;
  }

  .stake-tile .skin-price {
    font-size: var(--text-sm);
  }

  .stake-tile .coin {
    width: 18px;
    height: 18px;
  }
}

/* The remove buttons in the top right corner of a stake tile and of the target */
.stake-remove,
.target-clear {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  background: rgba(0, 0, 0, 0.55);
  border: 0;
  border-radius: 50%;
  color: var(--ash);
  font: inherit;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
}

.stake-tile:hover .stake-remove,
.target-clear:hover {
  background: var(--danger);
  color: var(--white-hot);
}

.target-clear {
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
}

/* The target, a showcase skin and the Mystery drop: picture, name, price */
.target,
.showcase-face {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: var(--stage-pad) 16px 0;
}

/* Larger system text can't push the price out of the card */
.target {
  overflow: hidden;
}

.target-image {
  flex: none;
  width: 200px;
  max-width: 100%;
  height: var(--stage-image);
  object-fit: contain;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.55));
}

.target-name {
  overflow: hidden;
  max-width: 100%;
  font-size: var(--text-sm);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Mystery: the skins that can drop take turns on the stage */
.mystery-showcase {
  overflow: hidden;
}

.showcase-face {
  position: absolute;
  inset: 0;
  isolation: isolate;
  /* The new skin waits until the old one is mostly gone, so their names never overlap */
  animation: showcase-in 0.35s var(--ease-out, ease-out) 0.18s backwards;
}

/* Each skin glows in its rarity colour */
.showcase-face::before {
  content: "";
  position: absolute;
  top: var(--stage-pad);
  left: 50%;
  z-index: -1;
  width: 220px;
  height: var(--stage-image);
  background: radial-gradient(closest-side, color-mix(in srgb, var(--rarity, var(--steel)) 32%, transparent), transparent);
  transform: translateX(-50%);
}

.showcase-face .target-image {
  animation: none;
}

.showcase-face .target-name {
  color: var(--ash);
}

.showcase-face-leaving {
  animation: showcase-out 0.22s ease-in forwards;
}

@keyframes showcase-in {
  from { opacity: 0; transform: translateY(14px); }
}

@keyframes showcase-out {
  to { opacity: 0; transform: translateY(-14px); }
}
