/* Game card preview — metrics from battle-ui CardFace (OG):
 * width 380, height 528, artHeight 266, radius 24, padding 5, gap 5
 *
 * IMPORTANT: cqi units resolve against the nearest ANCESTOR container.
 * Size the frame; keep preview at 100% so cqi tracks card width, not the viewport.
 */
.game-card-frame {
  container-type: inline-size;
  container-name: game-card;
  box-sizing: border-box;
  width: min(100%, 380px);
  aspect-ratio: 380 / 528;
  height: auto;
  min-height: 0;
  align-self: start;
  justify-self: start;
}

.game-card-frame--arena {
  width: min(100%, 200px);
}

.game-card-frame--deck {
  width: 110px;
}

.game-card-frame--mini {
  width: 86px;
}

.game-card-frame--strip {
  width: min(100%, 288px);
  aspect-ratio: auto;
  height: auto;
}

.game-card-preview {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 1.315cqi; /* 5/380 */
  padding: 1.315cqi;
  border-radius: 6.316cqi; /* 24/380 */
  overflow: hidden;
  color: #fff;
  background: var(--game-card-bg);
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.28),
    inset 0 0 0 1px rgba(255, 255, 255, 0.22);
  font-family: "SF Pro Rounded Local", "SF Pro Rounded", "Avenir Next Rounded", "Trebuchet MS", var(--font, sans-serif);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.game-card-frame--deck .game-card-preview {
  box-shadow:
    0 0.45rem 1.25rem rgba(15, 23, 42, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.game-card-frame--mini .game-card-preview {
  box-shadow:
    0 0.35rem 1rem rgba(15, 23, 42, 0.16),
    inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.game-card-preview--active {
  transform: translateY(-2px) scale(1.02);
  box-shadow:
    0 1.1rem 2.8rem rgba(15, 23, 42, 0.28),
    0 0 0 2px rgba(255, 255, 255, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.game-card-top {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2.895cqi;
  align-items: center;
  width: 100%;
  padding: 2.105cqi 3.684cqi; /* 8 / 14 */
  white-space: nowrap;
  line-height: normal;
}

.game-card-title {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.game-card-title h3 {
  margin: 0;
  overflow: hidden;
  color: #fff;
  font-size: 6.316cqi; /* 24 */
  font-weight: 600;
  line-height: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.game-card-title p {
  margin: -0.526cqi 0 0; /* marginTop: -2 */
  overflow: hidden;
  color: rgba(255, 255, 255, 0.35);
  font-size: 4.211cqi; /* 16 */
  font-weight: 600;
  line-height: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.game-card-preview--deck .game-card-title p,
.game-card-preview--mini .game-card-title p {
  display: none;
}

.game-card-stats {
  display: flex;
  gap: 2.895cqi; /* 11 */
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
  text-align: center;
}

.game-card-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-width: 8.421cqi; /* 32 */
  flex-shrink: 0;
}

.game-card-preview .game-card-stat strong {
  color: #fff;
  font-size: 6.316cqi; /* 24 */
  font-weight: 600;
  line-height: normal;
}

.game-card-preview .game-card-stat span {
  color: rgba(255, 255, 255, 0.35);
  font-size: 4.211cqi; /* 16 */
  font-weight: 600;
  line-height: normal;
  margin-top: -0.526cqi;
}

.game-card-art {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: 370 / 266;
  min-height: 0;
  z-index: 3;
  overflow: visible;
  background: transparent;
}

/* Flat NFT image: clip inside the rounded art window */
.game-card-art:not(.game-card-art--layered) {
  border-radius: 5cqi; /* 19 */
  overflow: hidden;
  isolation: isolate;
  contain: paint;
  clip-path: inset(0 round 5cqi);
  background: rgba(255, 255, 255, 0.24);
}

.game-card-art-frame {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: 5cqi;
  overflow: hidden;
  background-color: rgba(0, 0, 0, 0.18);
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
}

.game-card-art img,
.game-card-art-fallback {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
  object-fit: cover;
}

.game-card-art-fallback {
  background: rgba(0, 0, 0, 0.18);
}

/* Square sticker stack, bottom-anchored — taller than the art window so the head pops over the header */
.game-card-art-layers {
  position: absolute;
  left: 50%;
  bottom: 0;
  z-index: 5;
  width: 84.211cqi; /* 320/380 */
  height: 84.211cqi;
  transform: translateX(-50%);
  pointer-events: none;
}

.game-card-art-layers img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  object-position: center center;
  transform-origin: center center;
}

.game-card-art--layered .game-card-role,
.game-card-art--layered .game-card-energy,
.game-card-art--layered .game-card-art-badges {
  z-index: 7;
}

.game-card-role,
.game-card-energy {
  position: absolute;
  left: 2.632cqi; /* 10 */
  z-index: 2;
  display: inline-flex;
  gap: 0.526cqi; /* 2 */
  align-items: center;
  justify-content: center;
}

.game-card-role {
  top: 2.632cqi;
}

.game-card-role span:last-child {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.526cqi 1.842cqi 0.789cqi; /* 2 7 3 */
  border-radius: 30px;
  background: var(--game-role);
  color: #fff;
  font-size: 2.895cqi; /* 11 */
  font-weight: 600;
  line-height: 2.895cqi;
  white-space: nowrap;
  flex-shrink: 0;
  margin: 0;
}

.game-card-skill,
.game-card-energy span {
  width: 4.211cqi; /* 16 */
  height: 4.211cqi;
  min-width: 4.211cqi;
  min-height: 4.211cqi;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: #fff;
  font-size: 2.632cqi;
  font-weight: 600;
  line-height: 1;
  overflow: hidden;
  flex-shrink: 0;
}

.game-card-skill svg,
.game-card-energy svg {
  width: 4.211cqi;
  height: 4.211cqi;
  display: block;
}

.game-card-skill img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.game-card-skill {
  background: var(--game-role);
}

.game-card-energy {
  bottom: 2.632cqi;
}

.game-card-art-badges {
  position: absolute;
  top: 2.632cqi;
  right: 2.632cqi;
  z-index: 2;
  max-width: 65%;
  display: grid;
  gap: 0.526cqi;
  justify-items: end;
  overflow: hidden;
}

.game-card-preview--mini .game-card-art-badges {
  display: none;
}

.game-card-art-badge-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.526cqi;
  align-items: center;
}

.game-card-art-badge-row span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.526cqi 1.842cqi 0.789cqi;
  border-radius: 30px;
  background: rgba(255, 152, 1, 0.95);
  color: #fff;
  font-size: 2.895cqi;
  font-weight: 600;
  line-height: 2.895cqi;
  white-space: nowrap;
  flex-shrink: 0;
}

.game-card-art-badge-row-milestone span {
  font-size: 2.632cqi;
}

.game-card-energy span {
  background: #54bcdc;
}

.game-card-effects {
  display: flex;
  flex: 1 0 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4.211cqi; /* 16 — Wt when lines < 5 */
  min-height: 0;
  min-width: 0;
  width: 100%;
  padding: 4.474cqi 0; /* 17 */
  text-align: center;
  box-sizing: border-box;
}

.game-card-preview--dense .game-card-effects {
  gap: 3.158cqi; /* 12 */
}

.game-card-effect {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.526cqi; /* 2 — It when lines < 5 */
  width: 100%;
  padding: 0 2.368cqi; /* 9 */
  flex-shrink: 0;
  box-sizing: border-box;
  text-align: center;
}

.game-card-preview--dense .game-card-effect {
  gap: 0;
}

.game-card-effect-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.526cqi;
  flex-wrap: wrap;
}

.game-card-effect-label > span:not(.game-card-effect-icon) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.526cqi 1.842cqi 0.789cqi;
  border-radius: 1.053cqi; /* 4 — not a pill */
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 2.895cqi; /* 11 */
  font-weight: 600;
  line-height: 2.895cqi;
  white-space: nowrap;
  flex-shrink: 0;
}

.game-card-effect-icon {
  width: 4.211cqi;
  height: 4.211cqi;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 1.053cqi;
  background: rgba(255, 255, 255, 0.25);
  overflow: hidden;
  flex-shrink: 0;
}

.game-card-effect-icon svg,
.game-card-effect-icon img {
  width: 4.211cqi;
  height: 4.211cqi;
  display: block;
}

.game-card-preview .game-card-effect strong,
.game-card-preview .game-card-empty-effect {
  margin: 0;
  padding: 0;
  color: #fff;
  font-size: 5.263cqi; /* 20 */
  font-weight: 600;
  line-height: 5.263cqi;
  white-space: nowrap;
}

.game-card-preview--dense .game-card-effect strong,
.game-card-preview--dense .game-card-empty-effect {
  font-size: 4.211cqi; /* 16 */
  line-height: 4.211cqi;
}

.game-card-preview--deck .game-card-top {
  grid-template-columns: 1fr;
  gap: 0.18rem;
}

.game-card-preview--deck .game-card-stats {
  justify-content: flex-end;
}

/* Stage strip: grow with content, don't lock to hand aspect */
.game-card-preview--strip {
  width: 100%;
  height: auto;
  min-height: 0;
  gap: 0.55rem;
}

.game-card-preview--strip .game-card-top {
  grid-template-columns: 1fr;
}

.game-card-preview--strip-titled .game-card-top {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.game-card-preview--strip-titled .game-card-title p {
  margin-top: 0;
}

.game-card-preview--strip .game-card-art {
  aspect-ratio: 370 / 266;
}

.game-card-preview--strip .game-card-effects {
  flex: 0 0 auto;
  justify-content: flex-start;
  gap: 0.7rem;
  padding: 0.15rem 0.2rem 0.1rem;
}

.game-card-preview--strip .game-card-effect strong,
.game-card-preview--strip .game-card-empty-effect {
  white-space: normal;
}

.game-card-preview--strip .game-card-stat--changed {
  padding: 0.14rem 0.34rem 0.18rem;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.94);
  box-shadow:
    0 0.2rem 0.55rem rgba(15, 23, 42, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.95);
}

.game-card-preview--strip .game-card-stat--changed strong,
.game-card-preview--strip .game-card-stat--changed span {
  color: #18181b;
  text-shadow: none;
}

.game-card-preview--strip .game-card-stat--changed span {
  color: rgba(24, 24, 27, 0.62);
}

.game-card-preview--strip .game-card-effect-line--changed,
.game-card-preview--strip strong.game-card-effect-line--changed {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  border-radius: 0.45rem;
  background: rgba(255, 255, 255, 0.94);
  color: #18181b;
  box-shadow:
    0 0.18rem 0.45rem rgba(15, 23, 42, 0.2),
    inset 0 0 0 1px rgba(255, 255, 255, 0.95);
}

.game-card-empty-slot {
  width: min(100%, 200px);
  aspect-ratio: 380 / 528;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed rgba(113, 113, 122, 0.35);
  border-radius: 1rem;
  color: var(--muted, #71717a);
  font-size: 0.88rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.45);
}
