/* Styling for the reusable pieces built in js/components.js: card tiles,
   card chips, collection group headers, the points input, the +/- stepper,
   and the player search widget. Mirrors that module 1:1. */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

/* "Мир Лучей" card visual (js/components.js::rayCard): one DOM layout,
   detail level swaps by the card's own rendered width via a CSS container
   query - no JS resize tracking. `.card` is just the grid/list wrapper
   (sizing + optional action button below); `.ray-card` is the visual
   itself; `.ray-card--mini` fixes a small width for chip-style spots. */
.card {
  display: flex;
  flex-direction: column;
}

.card.unowned .ray-card {
  filter: grayscale(1) brightness(.55);
  opacity: .6;
}

.ray-card {
  container-type: inline-size;
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 10px;
  cursor: pointer;
  background: var(--card-bg);
  border-style: solid;
  border-color: var(--tone, #8b8b96);
  border-width: calc(var(--border-w, 1.8) * 1px);
  box-shadow:
    0 4px 14px rgba(0, 0, 0, .45),
    0 0 18px var(--glow, transparent),
    inset 0 1px 0 rgba(255, 255, 255, .08),
    inset 0 0 26px rgba(0, 0, 0, .35);
}

.ray-card--mini {
  width: 64px;
  flex: 0 0 auto;
}

/* Full card name, revealed on tap (js/components.js::rayCard) - the name in
   the card itself truncates at smaller sizes. A single shared element
   appended to <body> and repositioned per tap, not one per card: escapes
   .collection-box's overflow:hidden (which would otherwise clip a tooltip
   nested under a bottom-row card) and doubles as its own "only one open at
   a time" state. Not a toast - sits anchored under the tapped card instead
   of the fixed bottom-of-screen status spot. */
.ray-tip {
  position: absolute;
  z-index: 60;
  width: max-content;
  max-width: 220px;
  padding: 5px 9px;
  border-radius: 8px;
  background: rgba(10, 10, 14, .96);
  border: 1px solid rgba(255, 255, 255, .18);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .5);
  color: #f2f2f5;
  font-size: 11.5px;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, -4px);
  transition: opacity .12s ease, transform .12s ease;
}

.ray-tip.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.ray-art {
  position: relative;
  flex: 0 0 74%;
  background-color: var(--secondary-bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Foil-stripe sheen + a chain of soft mist patches zigzagging from the
   top-left corner to the bottom-right, always on top of the art (real
   image or not) - color comes from the collection's hue so each collection
   reads distinctly even before it has real card art. */
.ray-art::before {
  content: "";
  position: absolute;
  inset: 0;
  /* background-image:
    radial-gradient(ellipse 44% 34% at 10% 12%, hsla(var(--hue, 265), 90%, 75%, .5), transparent 70%),
    radial-gradient(ellipse 40% 32% at 60% 32%, hsla(var(--hue, 265), 90%, 75%, .38), transparent 70%),
    radial-gradient(ellipse 40% 32% at 28% 58%, hsla(var(--hue, 265), 90%, 75%, .38), transparent 70%),
    radial-gradient(ellipse 44% 34% at 88% 88%, hsla(var(--hue, 265), 90%, 75%, .32), transparent 70%),
    repeating-linear-gradient(
      135deg,
      hsla(var(--hue, 265), 80%, 72%, .22) 0 2px,
      transparent 2px 16px
    ); */
  mix-blend-mode: screen;
  pointer-events: none;
}

.ray-plate {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 5px 7px;
  text-align: center;
  background: linear-gradient(180deg, var(--secondary-bg), var(--card-bg));
  border-top: 1px solid rgba(255, 255, 255, .08);
}

.ray-name {
  font-family: "Cinzel", Georgia, "Times New Roman", serif;
  font-weight: 700;
  font-size: 12.5px;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ray-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  margin-top: 2px;
}

.ray-qty,
.ray-rarity {
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

.ray-qty {
  font-size: 11px;
  font-weight: 600;
}

.ray-rarity {
  font-size: 9.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* Collection icon: the asset itself is expected to already be shaped
   (transparent PNG, own silhouette) - just place and size it, no extra
   circle/backdrop/ring drawn on top of it. */
.ray-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  width: max(20px, 16cqw);
  height: max(20px, 16cqw);
  object-fit: contain;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .7));
}

.ray-chip {
  position: absolute;
  top: 6px;
  right: 6px;
  display: none;
  align-items: center;
  gap: 2px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(10, 10, 14, .94);
  border: 1px solid rgba(255, 255, 255, .25);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  font-weight: 600;
}

.ray-notch {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 30%;
  height: 3px;
  display: none;
  background: var(--tone, #8b8b96);
  box-shadow: 0 0 6px var(--tone, transparent);
}

/* l: 180-259px wide */
@container (min-width: 180px) {
  .ray-art {
    flex: 0 0 68%;
  }

  .ray-plate {
    padding: 8px 10px;
    gap: 4px;
  }

  .ray-name {
    font-size: 17px;
  }

  .ray-qty {
    font-size: 13px;
  }

  .ray-rarity {
    font-size: 10.5px;
  }
}

/* xl: >=260px wide */
@container (min-width: 260px) {
  .ray-art {
    flex: 0 0 63%;
  }

  .ray-plate {
    padding: 12px 14px;
    gap: 6px;
  }

  .ray-name {
    font-size: 24px;
    letter-spacing: .03em;
  }

  .ray-qty {
    font-size: 16px;
  }
}

/* s/xs: <120px wide - too narrow for the name+rarity plate, so the art
   fills the frame, the name overlays it, qty/price becomes a corner chip,
   and rarity gets a color notch instead of a label */
@container (max-width: 119px) {
  .ray-art {
    position: absolute;
    inset: 0;
    flex: 0 0 auto;
  }

  .ray-art::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 55%;
    background: linear-gradient(to top, var(--card-bg), transparent);
  }

  .ray-plate {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 4px 6px 6px;
    background: none;
    border-top: none;
  }

  .ray-name {
    font-size: 10.5px;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .9), 0 0 8px rgba(0, 0, 0, .8);
  }

  .ray-meta {
    display: none;
  }

  .ray-chip {
    display: flex;
  }

  .ray-notch {
    display: block;
  }
}

/* Steam-badge-style collection group: one bordered container - a banner
   header (icon + name + owned/total) capping a body that holds the full
   card roster (owned cards normal, missing ones dimmed via .unowned).
   Bleeds slightly past the page's own padding to read a bit wider than
   regular content. */
.collection-box {
  margin: 0 -6px 28px;
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.collection-header {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--secondary-bg);
  border-bottom: 3px solid var(--border);
  padding: 12px 14px;
}

.collection-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}

.collection-name {
  font-weight: 800;
  font-size: 17px;
  flex: 1;
  letter-spacing: .01em;
}

.collection-progress {
  font-size: 12px;
  font-weight: 700;
  color: var(--hint);
  background: var(--card-bg);
  padding: 4px 12px;
  border-radius: 20px;
  flex-shrink: 0;
}

.collection-body {
  padding: 14px;
}

.items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}

/* wraps a mini .ray-card (see components.js::rayCard) - the card itself
   carries its own border/shadow now, this is just a label underneath. */
.card-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.card-chip.insufficient .ray-card {
  opacity: .4;
  filter: grayscale(70%);
}

.card-chip .have {
  font-size: 10px;
  color: var(--hint);
}

.currency-chip {
  display: flex;
  align-items: center;
  background: var(--secondary-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
}

.currency-input-row {
  position: relative;
  margin-bottom: 8px;
}

.currency-input-row input {
  padding-left: 30px;
  margin-bottom: 0;
}

.currency-input-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  pointer-events: none;
}

.stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}

.stepper button {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--secondary-bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1;
}

.stepper button:disabled {
  opacity: .35;
}

.stepper span {
  font-size: 12px;
  font-weight: 700;
  min-width: 16px;
  text-align: center;
}

.user-search {
  margin-bottom: 8px;
}

.user-search-row {
  position: relative;
}

.user-search-row input {
  margin-bottom: 0;
  padding-right: 34px;
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.search-results .action {
  margin-top: 0;
}

.spinner {
  position: absolute;
  right: 10px;
  top: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border: 2px solid var(--border);
  border-top-color: var(--link);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}