/* The drop reel: a forged iron frame with steel caps, a notched ember marker and tiles in a row.
   Tile size must match TILE_WIDTH and TILE_GAP in cases-reel.js. */

.case-reel-frame {
  position: relative;
  /* Its own layer, so the case (z-index 4 at rest) always stands in front of it */
  z-index: 1;
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) 14px;
  padding: 4px 0;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--surface-well);
  box-shadow: var(--shadow);
}

/* At rest the case's skins stand still and dim under the case, and the marker is off */
.case-reel-marker {
  transition: opacity 300ms var(--ease-out), filter 300ms var(--ease-out);
}

.case-reel-frame.is-idle .case-reel-tile {
  opacity: 0.32;
  filter: saturate(0.5);
}

.case-reel-frame.is-idle .case-reel-marker {
  opacity: 0;
}

/* The skins right under the case fade out, so the case stands on the reel's dark floor, not on a tile */
.case-reel-frame.is-idle .case-reel {
  -webkit-mask: linear-gradient(90deg, transparent, #000 12%, #000 30%, transparent 38%, transparent 62%, #000 70%, #000 88%, transparent);
  mask: linear-gradient(90deg, transparent, #000 12%, #000 30%, transparent 38%, transparent 62%, #000 70%, #000 88%, transparent);
}

/* The resting row starts from the middle of the reel; cases-reel.js moves it back by half a tile */
.case-reel-strip.is-idle {
  position: relative;
  left: 50%;
}

/* The steel caps at the ends: a turned ring with two rivets */
.case-reel-cap {
  position: relative;
  background: linear-gradient(90deg, var(--surface-control), var(--surface-hover) 50%, var(--surface-control));
  border-radius: var(--radius-inner);
}

.case-reel-cap::before,
.case-reel-cap::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: var(--soot);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.case-reel-cap::before {
  top: 30%;
}

.case-reel-cap::after {
  top: 66%;
}

.case-reel {
  position: relative;
  height: 200px;
  overflow: hidden;
  background: linear-gradient(180deg, #0d0b0b, var(--iron));
  -webkit-mask: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

/* The marker: a glowing ember line, with a notch at each end that twitches on every tick */
.case-reel-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: 3;
  width: 2px;
  margin-left: -1px;
  background: var(--ember);
  box-shadow: 0 0 14px var(--ember), 0 0 40px rgba(255, 107, 26, 0.35);
  pointer-events: none;
}

.case-reel-notch {
  position: absolute;
  left: 50%;
  width: 0;
  height: 0;
  margin-left: -8px;
  border-right: 8px solid transparent;
  border-left: 8px solid transparent;
  filter: drop-shadow(0 0 1px #121011);
}

.case-reel-notch-top {
  top: 0;
  border-top: 10px solid var(--ember);
}

.case-reel-notch-bottom {
  bottom: 0;
  border-bottom: 10px solid var(--ember);
}

.case-reel-strip {
  display: flex;
  gap: 10px;
  width: max-content;
  padding: 20px 0;
  will-change: transform;
}

.case-reel-tile {
  display: grid;
  flex: none;
  gap: 6px;
  width: 156px;
  padding: 8px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--iron-light) 40%, color-mix(in srgb, var(--rarity, var(--steel)) 26%, var(--iron-light)));
  border-bottom: 3px solid var(--rarity, var(--steel));
  box-shadow: 0 6px 14px -8px var(--rarity, transparent);
  transition: opacity 260ms var(--ease-out), filter 260ms var(--ease-out), transform 320ms var(--ease-out);
}

/* While it turns, cases-reel.js draws the lens on every frame, so nothing may lag behind it. Each tile is its own
   layer then, so the lens's size and fade are only moved by the graphics card, never painted again (2026-11-26) */
.case-reel.is-spinning .case-reel-tile {
  transition: none;
  will-change: transform, opacity;
}

.case-reel-image {
  justify-self: center;
  width: 132px;
  aspect-ratio: 4 / 3;
  object-fit: contain;
}

.case-reel-name,
.case-reel-price {
  min-width: 0;
  transition: opacity 200ms var(--ease-out);
}

.case-reel-name {
  overflow: hidden;
  color: var(--white-hot);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-reel-price {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--ember-light);
  font-size: 0.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.case-reel-price .coin {
  width: 15px;
  height: 15px;
}

/* While the reel turns the names are hidden, and they come back on the reveal */
.case-reel.is-spinning .case-reel-name,
.case-reel.is-spinning .case-reel-price {
  opacity: 0;
}

.case-reel-tile.is-dim {
  opacity: 0.35;
  filter: saturate(0.4);
}

.case-reel-tile.case-reel-won {
  z-index: 2;
  transform: scale(var(--win-scale, 1.15));
  border-color: var(--rarity);
  box-shadow: 0 0 0 2px var(--rarity), 0 0 26px -2px var(--rarity);
}

@media (max-width: 760px) {
  .case-reel-frame {
    grid-template-columns: 10px minmax(0, 1fr) 10px;
  }
}

/* The multi-open reel: one column per drop. A row of columns shares one horizontal ember line, and on phones
   the columns come in rows of five. Column sizes and the tile height match cases-columns.js. */
.case-reel-body {
  position: relative;
  min-width: 0;
}

.case-columns {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 10px 0;
}

.case-columns[hidden] {
  display: none;
}

.case-reel-row {
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
  padding: 0 4px;
}

.case-reel-row::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  z-index: 3;
  height: 2px;
  margin-top: -1px;
  background: var(--ember);
  box-shadow: 0 0 12px var(--ember);
  pointer-events: none;
}

.case-column {
  position: relative;
  flex: 0 0 108px;
  height: 300px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 14%, #000 86%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 14%, #000 86%, transparent);
}

.case-column-strip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  will-change: transform;
}

.case-column-tile {
  box-sizing: border-box;
  width: 100%;
  height: 150px;
  gap: 4px;
  padding: 6px;
}

.case-column-tile .case-reel-image {
  width: 84px;
}

.case-column-tile .case-reel-name {
  font-size: 0.66rem;
}

.case-column-tile .case-reel-price {
  font-size: 0.72rem;
}

.case-column-tile .case-reel-price .coin {
  width: 12px;
  height: 12px;
}

.case-columns.is-spinning .case-reel-name,
.case-columns.is-spinning .case-reel-price {
  opacity: 0;
}

@media (max-width: 760px) {
  .case-column {
    flex: 0 0 calc((100% - 32px) / 5);
    min-width: 0;
  }

  .case-column-tile .case-reel-image {
    width: 100%;
  }

  .case-column-tile .case-reel-name {
    display: none;
  }
}
