/* ========================================
   SCRIPT CARDS - Card Component Styles
   ======================================== */

@import url('../components/username-effects.css');
@import url('../components/badge-effects.css');

/* Card Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(264px, 1fr));
  gap: 16px;
}

/* Script Card */
.script-card {
  position: relative;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 300px;
  opacity: 1;
  content-visibility: auto;
  contain-intrinsic-size: auto 380px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Faster staggered animation for better perceived performance */
.script-card:nth-child(1) { animation-delay: 0.02s; }
.script-card:nth-child(2) { animation-delay: 0.04s; }
.script-card:nth-child(3) { animation-delay: 0.06s; }
.script-card:nth-child(4) { animation-delay: 0.08s; }
.script-card:nth-child(5) { animation-delay: 0.1s; }
.script-card:nth-child(6) { animation-delay: 0.12s; }
.script-card:nth-child(7) { animation-delay: 0.14s; }
.script-card:nth-child(8) { animation-delay: 0.16s; }
.script-card:nth-child(9) { animation-delay: 0.18s; }
.script-card:nth-child(10) { animation-delay: 0.2s; }
.script-card:nth-child(11) { animation-delay: 0.22s; }
.script-card:nth-child(12) { animation-delay: 0.24s; }

/* Instant mode - skip animations for cached content */
.cards-grid.instant .script-card {
  animation: none;
  opacity: 1;
}

.script-card:hover {
  border-color: color-mix(in srgb, var(--accent-primary) 35%, var(--border-light));
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

/* Card Thumbnail */
.script-card-thumbnail {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 0;
  /* Letterbox matte: when an uploaded thumbnail's aspect ratio doesn't
     match 16:9, `contain` leaves bars on the sides. A solid dark backdrop
     reads as intentional rather than the page bg bleeding through. */
  background-color: #0d0d10;
  overflow: hidden;
  cursor: pointer;
  /* New stacking context so the blurred backdrop (z-index 0) sits behind
     the sharp image (z-index 1) and the overlay badges (z-index 2). */
  isolation: isolate;
}

/* Blurred backdrop fill: a scaled-up, blurred copy of the thumbnail that
   colours in the letterbox bars left by `object-fit: contain`. The image
   URL is supplied per-card via the `--thumb-bg` custom property. Square
   logos and tall banners now read as framed artwork instead of floating
   on a flat black box. */
.script-card-thumbnail::before {
  content: none;
  display: none;
}

.script-card-thumbnail > img:not(.script-card-game-thumb) {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  /* Scale to fill the 16:9 frame so thumbnails sit flush with the card
     edges (no letterbox bars). The blurred backdrop still covers any
     transparent PNG areas. */
  object-fit: cover;
  object-position: center;
  transition: transform var(--transition-slow);
  display: block;
}

/* Overlay chrome must clear both backdrop and image. */
.script-card-game,
.script-card-type,
.script-card-indicators,
.script-card-thumbnail-placeholder {
  z-index: 2;
}

.script-card:hover .script-card-thumbnail > img:not(.script-card-game-thumb) {
  transform: scale(1.05);
}

.script-card-thumbnail-placeholder {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 2.5rem;
  background-color: var(--bg-tertiary);
}

/* Game Badge on Thumbnail */
.script-card-game {
  position: absolute;
  bottom: 10px;
  left: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background-color: rgba(10, 10, 12, 0.88);
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  pointer-events: none;
}

.script-card-game--linked {
  max-width: calc(100% - 24px);
  min-width: 0;
  padding: 0;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 10px;
  background: none;
  border: none;
  backdrop-filter: none;
  box-shadow: none;
}

.script-card-game--linked .script-card-game-thumb {
  position: static;
  z-index: auto;
  width: 52px;
  height: 52px;
  max-width: 52px;
  max-height: 52px;
  border-radius: 10px;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
  background-color: transparent;
  transform: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

.script-card-game--linked .script-card-game-name {
  position: static;
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
  padding: 3px 7px;
  margin-bottom: 1px;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: left;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
  border-radius: 6px;
  background: rgba(10, 10, 12, 0.72);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

/* Card Type Badge */
.script-card-type {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  pointer-events: none;
}

.script-card-type.serverside {
  background-color: var(--accent-primary);
  color: var(--bg-primary);
}

.script-card-type.client {
  background-color: #6c5ce7;
  color: white;
}

.script-card-type.local {
  background-color: #4ecdc4;
  color: var(--bg-primary);
}

.script-card-type.universal {
  background-color: var(--warning);
  color: var(--bg-primary);
}

.script-card-type.serverside_executor {
  background-color: #6c5ce7;
  color: white;
}

.script-card-type.bundle {
  background-color: #8b5cf6;
  color: #fff;
}

.script-card-trust--bundle {
  color: #c4b5fd;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.3);
  text-transform: none;
  padding: 3px 9px;
}

.script-card-bundle-link {
  display: inline-flex;
  align-items: center;
  margin: 0 0 8px;
  max-width: 100%;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #c4b5fd;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.28);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.script-card-bundle-link:hover {
  border-color: rgba(139, 92, 246, 0.55);
  color: #ddd6fe;
}

.script-card-bundle-link::before {
  content: 'Bundle · ';
  font-weight: 600;
  opacity: 0.85;
}

/* Card Content */
.script-card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 14px 16px 12px;
}

.script-card-trust-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.script-card-trust {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px 3px 6px;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
  white-space: nowrap;
}

.script-card-trust--verified {
  color: #00d4aa;
  background: rgba(0, 212, 170, 0.1);
  border: 1px solid rgba(0, 212, 170, 0.28);
  text-transform: none;
}

.script-card-trust--verified .nex-trust-icon {
  flex: 0 0 auto;
}

.script-card-trust--meta {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  text-transform: none;
  padding: 3px 9px;
}

.script-card-trust--premium {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.28);
  text-transform: none;
  padding: 3px 9px;
}

.script-card-trusted-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  line-height: 0;
  height: 1em;
}

.script-card-trusted-mark .nex-trust-icon--twitter {
  display: block;
  width: 17px;
  height: 17px;
}

.nex-trust-icon {
  display: block;
  flex: 0 0 auto;
}

.script-card-trust--nex-plus,
.script-card-nex-plus-badge {
  position: relative;
  overflow: hidden;
  color: #fbbf24;
  background: linear-gradient(120deg, rgba(245, 158, 11, 0.22), rgba(251, 191, 36, 0.18));
  border: 1px solid rgba(251, 191, 36, 0.35);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.16);
  animation: nex-plus-card-glow 2.8s ease-in-out infinite;
  text-transform: none;
}

.script-card-trust--nex-plus::after,
.script-card-nex-plus-badge::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 20%, rgba(255, 255, 255, 0.32) 45%, transparent 70%);
  transform: translateX(-120%);
  animation: nex-plus-card-shimmer 2.4s ease-in-out infinite;
  pointer-events: none;
}

.script-card-top-actions {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 20px);
}

.script-card-boosted-pill {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(251, 191, 36, 0.92);
  color: #1a1205;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}

.script-card-nex-plus-mini {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.2;
  height: 17px;
  box-sizing: border-box;
  color: #fbbf24;
  background: linear-gradient(120deg, rgba(245, 158, 11, 0.28), rgba(251, 191, 36, 0.16));
  border: 1px solid rgba(251, 191, 36, 0.4);
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.18);
  animation: nex-plus-card-glow 2.8s ease-in-out infinite;
}

button.script-card-nex-plus-trigger {
  appearance: none;
  margin: 0;
  /* Keep chip size; do not inherit parent username font-size */
  font-family: inherit;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.2;
  cursor: pointer;
  vertical-align: middle;
}

button.script-card-nex-plus-trigger:focus-visible {
  outline: 2px solid rgba(251, 191, 36, 0.65);
  outline-offset: 2px;
}

/* Nex+ custom self-badge — replaces NEX+ mini on cards when set */
.script-card-self-badge {
  --badge-color: #fbbf24;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  max-width: 7.5rem;
  padding: 3px 8px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.15;
  height: auto;
  min-height: 1.45em;
  box-sizing: border-box;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--badge-color);
  /* Base-color screen gradient (effects may layer on top via badge-fx-*) */
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--badge-color) 42%, #ffffff) 0%,
    color-mix(in srgb, var(--badge-color) 18%, transparent) 100%
  );
  border: 1px solid color-mix(in srgb, var(--badge-color) 40%, transparent);
}

/* ---------- Luxury Nex+ badge tooltip (body portal) ---------- */
.nex-plus-lux-tip {
  --lux-gold: #e8c872;
  --lux-gold-soft: rgba(232, 200, 114, 0.55);
  --lux-ink: #0c0a07;
  position: fixed;
  z-index: 10050;
  top: 0;
  left: 0;
  width: min(268px, calc(100vw - 24px));
  transform: translate(-50%, calc(-100% - 2px)) scale(0.96);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0.32s;
  filter: drop-shadow(0 18px 40px rgba(0, 0, 0, 0.55));
}

.nex-plus-lux-tip.is-below {
  transform: translate(-50%, 2px) scale(0.96);
}

.nex-plus-lux-tip.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, calc(-100% - 2px)) scale(1);
}

.nex-plus-lux-tip.is-below.is-visible {
  transform: translate(-50%, 2px) scale(1);
}

.nex-plus-lux-tip.is-instant {
  transition: none !important;
}

.nex-plus-lux-tip-glow {
  position: absolute;
  inset: -18% -12% auto;
  height: 70%;
  background: radial-gradient(
    ellipse at 50% 0%,
    rgba(232, 200, 114, 0.35) 0%,
    transparent 70%
  );
  pointer-events: none;
  filter: blur(2px);
}

.nex-plus-lux-tip-panel {
  position: relative;
  padding: 16px 18px 15px;
  border-radius: 14px;
  background:
    linear-gradient(165deg, rgba(36, 30, 20, 0.97) 0%, rgba(12, 10, 8, 0.98) 55%, rgba(8, 7, 6, 0.99) 100%);
  border: 1px solid rgba(232, 200, 114, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 236, 190, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, 0.03),
    0 0 0 1px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  cursor: pointer;
}

.nex-plus-lux-tip-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    115deg,
    transparent 0%,
    rgba(255, 240, 200, 0.06) 42%,
    transparent 58%
  );
  background-size: 220% 100%;
  animation: nex-plus-lux-sheen 5.5s linear infinite;
  pointer-events: none;
}

.nex-plus-lux-tip-panel::after {
  content: '';
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(232, 200, 114, 0.45),
    transparent
  );
  pointer-events: none;
}

.nex-plus-lux-tip-crest {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #1a1408;
  background: linear-gradient(180deg, #f3e0a8 0%, #d4af37 48%, #b8922a 100%);
  box-shadow:
    0 0 16px rgba(212, 175, 55, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.nex-plus-lux-tip-kicker {
  margin: 0 0 4px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(232, 200, 114, 0.72);
}

.nex-plus-lux-tip-title {
  margin: 0 0 6px;
  font-family: 'Outfit', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #f7efd8;
  line-height: 1.25;
}

.nex-plus-lux-tip-copy {
  margin: 0 0 12px;
  font-size: 0.78rem;
  line-height: 1.45;
  color: rgba(235, 225, 205, 0.68);
}

.nex-plus-lux-tip-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--lux-gold);
}

.nex-plus-lux-tip-cta::after {
  content: '→';
  transition: transform 0.25s ease;
}

.nex-plus-lux-tip-panel:hover .nex-plus-lux-tip-cta::after {
  transform: translateX(3px);
}

@keyframes nex-plus-lux-sheen {
  from { background-position: 120% 0; }
  to { background-position: -120% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .nex-plus-lux-tip,
  .nex-plus-lux-tip-panel::before,
  .nex-plus-lux-tip-cta::after {
    animation: none !important;
    transition: opacity 0.15s ease, visibility 0.15s ease !important;
  }
}

.script-card-nex-plus-mini::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 20%, rgba(255, 255, 255, 0.35) 45%, transparent 70%);
  transform: translateX(-120%);
  animation: nex-plus-card-shimmer 2.4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes nex-plus-card-glow {
  0%, 100% { box-shadow: 0 0 6px rgba(251, 191, 36, 0.12); }
  50% { box-shadow: 0 0 14px rgba(251, 191, 36, 0.28); }
}

@keyframes nex-plus-card-shimmer {
  0% { transform: translateX(-120%); }
  55%, 100% { transform: translateX(120%); }
}

@media (prefers-reduced-motion: reduce) {
  .script-card-trust--nex-plus,
  .script-card-nex-plus-badge,
  .script-card-nex-plus-mini,
  .script-card-trust--nex-plus::after,
  .script-card-nex-plus-badge::after,
  .script-card-nex-plus-mini::after {
    animation: none !important;
  }
}

.script-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 5px;
  line-height: 1.3;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.script-card-title a {
  color: inherit;
  transition: color var(--transition-fast);
}

.script-card-title a:hover {
  color: var(--accent-primary);
}

.script-card-description {
  font-size: 0.83rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Card Meta Info */
.script-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

.script-card-uploader {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  min-width: 0;
}

.script-card-avatar {
  width: 24px;
  height: 24px;
  aspect-ratio: 1 / 1;
  background-color: var(--bg-tertiary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  flex-shrink: 0;
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.script-card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.script-card-uploader-info {
  min-width: 0;
  flex: 1;
}

.script-card-uploader-name {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: visible;
}

.script-card-uploader-handle {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.script-card-uploader-name a {
  color: inherit;
  transition: color var(--transition-fast);
  position: relative;
  z-index: 10;
}

.script-card-uploader-name a:hover {
  color: var(--accent-primary);
}

.script-author {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  line-height: 1.2;
}

.script-card-date {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Card Stats */
.script-card-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  min-width: 0;
}

.script-card-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.74rem;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Keep icon glyphs from collapsing into the count text */
.script-card-stat.views::before,
.script-card-stat.likes::before,
.script-card-stat.dislikes::before,
.script-card-stat.copies::before {
  display: block;
  flex-shrink: 0;
  -webkit-mask-size: contain;
  mask-size: contain;
}

/* Card stat icons using CSS */
.script-card-stat.views::before {
  content: '';
  width: 14px;
  height: 14px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z'/%3E%3C/svg%3E") no-repeat center;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z'/%3E%3C/svg%3E") no-repeat center;
  transition: transform var(--transition-fast);
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  pointer-events: none;
}

.script-card-stat.likes::before {
  content: '';
  width: 14px;
  height: 14px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M2 20h2c.55 0 1-.45 1-1v-9c0-.55-.45-1-1-1H2v11zm19.83-7.12c.11-.25.17-.52.17-.8V11c0-1.1-.9-2-2-2h-5.5l.92-4.65c.05-.22.02-.46-.08-.66-.23-.45-.52-.86-.88-1.22L14 2 7.59 8.41C7.21 8.79 7 9.3 7 9.83v7.84C7 18.95 8.05 20 9.34 20h8.11c.7 0 1.36-.37 1.72-.97l2.66-6.15z'/%3E%3C/svg%3E") no-repeat center;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M2 20h2c.55 0 1-.45 1-1v-9c0-.55-.45-1-1-1H2v11zm19.83-7.12c.11-.25.17-.52.17-.8V11c0-1.1-.9-2-2-2h-5.5l.92-4.65c.05-.22.02-.46-.08-.66-.23-.45-.52-.86-.88-1.22L14 2 7.59 8.41C7.21 8.79 7 9.3 7 9.83v7.84C7 18.95 8.05 20 9.34 20h8.11c.7 0 1.36-.37 1.72-.97l2.66-6.15z'/%3E%3C/svg%3E") no-repeat center;
  transition: transform var(--transition-fast);
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  pointer-events: none;
}

.script-card-stat.dislikes::before {
  content: '';
  width: 14px;
  height: 14px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M22 4h-2c-.55 0-1 .45-1 1v9c0 .55.45 1 1 1h2V4zM2.17 11.12c-.11.25-.17.52-.17.8V13c0 1.1.9 2 2 2h5.5l-.92 4.65c-.05.22-.02.46.08.66.23.45.52.86.88 1.22L10 22l6.41-6.41c.38-.38.59-.89.59-1.42V6.34C17 5.05 15.95 4 14.66 4h-8.1c-.71 0-1.36.37-1.72.97l-2.67 6.15z'/%3E%3C/svg%3E") no-repeat center;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M22 4h-2c-.55 0-1 .45-1 1v9c0 .55.45 1 1 1h2V4zM2.17 11.12c-.11.25-.17.52-.17.8V13c0 1.1.9 2 2 2h5.5l-.92 4.65c-.05.22-.02.46.08.66.23.45.52.86.88 1.22L10 22l6.41-6.41c.38-.38.59-.89.59-1.42V6.34C17 5.05 15.95 4 14.66 4h-8.1c-.71 0-1.36.37-1.72.97l-2.67 6.15z'/%3E%3C/svg%3E") no-repeat center;
  transition: transform var(--transition-fast);
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  pointer-events: none;
}

.script-card-stat.likes:hover {
  color: var(--success);
}

.script-card-stat.likes:hover::before {
  transform: scale(1.2);
}

.script-card-stat.dislikes:hover {
  color: var(--danger);
}

.script-card-stat.dislikes:hover::before {
  transform: scale(1.2);
}

.script-card-stat.views {
  color: var(--text-muted);
}

.script-card-stat.copies::before {
  content: '';
  width: 14px;
  height: 14px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z'/%3E%3C/svg%3E") no-repeat center;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z'/%3E%3C/svg%3E") no-repeat center;
  transition: transform var(--transition-fast);
  user-select: none;
  pointer-events: none;
}

.script-card-stat.copies {
  color: var(--text-muted);
}

.script-card-stat-price {
  margin-left: auto;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-primary);
  background-color: color-mix(in srgb, var(--accent-primary) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-primary) 28%, transparent);
  white-space: nowrap;
}

.script-card-share {
  position: relative;
  top: auto;
  left: auto;
  z-index: 1;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(10, 10, 12, 0.72);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
  opacity: 0.92;
}

.script-card-share:hover {
  background: rgba(10, 10, 12, 0.92);
  transform: scale(1.05);
}

.script-card-share:focus-visible {
  outline: 2px solid var(--accent-primary, #5b8cff);
  outline-offset: 2px;
}

/* Card Footer Actions (Optional) */
.script-card-actions {
  display: flex;
  gap: 8px;
  padding: 16px 20px;
  background-color: var(--bg-tertiary);
  border-top: 1px solid var(--border-color);
}

.script-card-action {
  flex: 1;
  padding: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.script-card-action-primary {
  background-color: var(--accent-primary);
  color: var(--bg-primary);
}

.script-card-action-primary:hover {
  box-shadow: var(--shadow-glow);
}

.script-card-action-secondary {
  background-color: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.script-card-action-secondary:hover {
  color: var(--text-primary);
  border-color: var(--border-light);
}

/* Loading State */
.script-card-skeleton {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  min-height: 300px;
  contain: layout style paint;
}

.skeleton-thumbnail {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--bg-tertiary);
  position: relative;
  overflow: hidden;
}

.skeleton-thumbnail::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
  animation: shimmer 1.2s ease-in-out infinite;
  will-change: transform;
}

.skeleton-content {
  padding: 14px 16px;
}

.skeleton-title {
  height: 18px;
  width: 70%;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  position: relative;
  overflow: hidden;
}

.skeleton-title::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
  animation: shimmer 1.5s ease-in-out infinite;
}

.skeleton-description {
  height: 14px;
  width: 100%;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  position: relative;
  overflow: hidden;
}

.skeleton-description::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
  animation: shimmer 1.5s ease-in-out infinite;
}

.skeleton-description:last-child {
  width: 60%;
}

.skeleton-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.skeleton-avatar {
  width: 24px;
  height: 24px;
  background: var(--bg-tertiary);
  border-radius: 50%;
}

.skeleton-stats {
  display: flex;
  gap: 12px;
}

.skeleton-stat {
  width: 40px;
  height: 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

/* Responsive */
@media (max-width: 768px) {
  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
  }

  .script-card {
    min-height: 280px;
  }

  .script-card-content {
    padding: 12px 14px;
  }

  /* Narrow cards: stack author + stats so icons/counts never collide */
  .script-card-meta {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .script-card-uploader {
    flex: none;
    width: 100%;
  }

  .script-card-stats {
    width: 100%;
    flex-shrink: 1;
    flex-wrap: wrap;
    gap: 8px;
    row-gap: 6px;
  }

  .script-card-stat-price {
    margin-left: auto;
  }
}

@media (max-width: 480px) {
  .cards-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .script-card {
    min-height: 0;
  }

  .script-card-content {
    padding: 10px 12px;
  }

  .script-card-title {
    font-size: 0.92rem;
  }

  .script-card-description {
    font-size: 0.78rem;
    -webkit-line-clamp: 2;
    margin-bottom: 8px;
  }

  .script-card-meta {
    gap: 8px;
    padding-top: 8px;
  }

  .script-card-avatar {
    width: 22px;
    height: 22px;
    font-size: 0.65rem;
  }

  .script-card-uploader-name {
    font-size: 0.72rem;
  }

  .script-card-date {
    font-size: 0.65rem;
  }

  .script-card-stats {
    gap: 6px;
  }

  .script-card-stat {
    font-size: 0.68rem;
    gap: 3px;
  }

  .script-card-stat.views::before,
  .script-card-stat.likes::before,
  .script-card-stat.dislikes::before,
  .script-card-stat.copies::before {
    width: 12px;
    height: 12px;
  }

  .script-card-stat-price {
    padding: 2px 7px;
    font-size: 0.66rem;
  }

  .script-card-game--linked .script-card-game-thumb {
    width: 42px;
    height: 42px;
    max-width: 42px;
    max-height: 42px;
  }
}

/* ========================================
   USER CARDS - Profile Card Styles
   ======================================== */

.user-card {
  height: auto;
  min-height: 320px;
}

.user-card-banner {
  width: 100%;
  height: 100px;
  display: block;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  overflow: hidden;
  position: relative;
}

.user-card-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-card-banner-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
}

.user-card-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.user-card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: -40px;
  position: relative;
  z-index: 1;
}

.user-card-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background-color: var(--bg-tertiary);
  border: 3px solid var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
  transition: transform var(--transition-fast);
}

.user-card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-card:hover .user-card-avatar {
  transform: scale(1.05);
}

.user-card-info {
  flex: 1;
  min-width: 0;
  padding-top: 32px;
}

.user-card-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-card-name a {
  color: inherit;
  transition: color var(--transition-fast);
}

.user-card-name a:hover {
  color: var(--accent-primary);
}

.user-card-verified {
  color: var(--accent-primary);
  font-size: 0.9rem;
}

.user-card-handle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

.user-card-bio {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.user-card-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

.user-card-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-card-stat-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.user-card-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .user-card {
    min-height: 300px;
  }
  
  .user-card-banner {
    height: 80px;
  }
  
  .user-card-avatar {
    width: 56px;
    height: 56px;
  }
  
  .user-card-info {
    padding-top: 28px;
  }
}

/* ========================================
   CARD INDICATOR CHIPS
   (key-required, discord-only, etc.)
   ======================================== */

.script-card-indicators {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  flex-direction: row;
  gap: 5px;
  z-index: 2;
  pointer-events: none;
}

.script-card-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  font-size: 0.75rem;
  background-color: rgba(10, 10, 12, 0.82);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  transition: transform var(--transition-fast),
              border-color var(--transition-fast);
}

.script-card-indicator > span {
  display: block;
  line-height: 1;
}

.script-card-indicator--key {
  border-color: rgba(245, 158, 11, 0.45);
  color: #fde68a;
}

.script-card-indicator--discord {
  border-color: rgba(88, 101, 242, 0.45);
  color: #c7d2fe;
}

.script-card-indicator--trial {
  border-color: rgba(74, 222, 128, 0.45);
  color: #bbf7d0;
}

.script-card:hover .script-card-indicator {
  transform: translateY(-1px);
}

@media (max-width: 480px) {
  .script-card-indicator {
    width: 24px;
    height: 24px;
    font-size: 0.75rem;
  }
}

/* Sponsored cards (Admin → Marketing → Card ads) */
.marketing-ad-card {
  border-color: color-mix(in srgb, var(--accent-primary) 28%, var(--border-color));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent-primary) 6%, var(--bg-card)), var(--bg-card));
}

.marketing-ad-card:hover {
  border-color: color-mix(in srgb, var(--accent-primary) 55%, var(--border-color));
  box-shadow: 0 10px 28px color-mix(in srgb, var(--accent-primary) 16%, transparent);
}

.marketing-ad-card-type {
  background: color-mix(in srgb, var(--accent-primary) 88%, #000);
  color: var(--bg-primary);
  font-weight: 700;
  letter-spacing: 0.06em;
}

.marketing-ad-card-placeholder {
  background: color-mix(in srgb, var(--accent-primary) 10%, var(--bg-tertiary));
  color: var(--accent-primary);
  font-size: 2rem;
}

.marketing-ad-card-avatar {
  background: color-mix(in srgb, var(--accent-primary) 16%, var(--bg-tertiary));
  color: var(--accent-primary);
  font-weight: 700;
}

.marketing-ad-card-cta {
  color: var(--accent-primary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.72rem;
}
