/* Think Floating Instant Wins — scrolling ticker
 * Override any --tfiw-* variable in your theme to restyle per site.
 */

.tfiw-ticker {
  --tfiw-bg: #ffffff;
  --tfiw-text: #1f2937;
  --tfiw-muted: #6b7280;
  --tfiw-border: rgba(15, 23, 42, 0.08);
  --tfiw-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.06);
  --tfiw-radius: 999px;
  --tfiw-gap: 12px;
  --tfiw-font-size: 13px;
  --tfiw-fade: 8%;
  --tfiw-dur: 60s; /* fallback; the script sets this from the speed settings */

  box-sizing: border-box;
  position: relative;
  width: 100%;
  margin: 0;
  padding: 0;
  font-size: var(--tfiw-font-size);
  line-height: 1.2;
}

.tfiw-ticker *,
.tfiw-ticker *::before,
.tfiw-ticker *::after {
  box-sizing: border-box;
}

.tfiw-ticker.tfiw-theme-dark {
  --tfiw-bg: #111827;
  --tfiw-text: #f9fafb;
  --tfiw-muted: #9ca3af;
  --tfiw-border: rgba(255, 255, 255, 0.1);
  --tfiw-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Viewport: clips the track and softly fades both edges */
.tfiw-ticker__rail {
  overflow: hidden;
  contain: layout paint; /* keep the animation's work isolated from the rest of the page */
  padding: 8px 0 10px; /* room for chip shadows */
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--tfiw-fade), #000 calc(100% - var(--tfiw-fade)), transparent);
          mask-image: linear-gradient(90deg, transparent, #000 var(--tfiw-fade), #000 calc(100% - var(--tfiw-fade)), transparent);
}

.tfiw-ticker--nofade .tfiw-ticker__rail {
  -webkit-mask-image: none;
          mask-image: none;
}

/* Track holds two identical groups; moving by -50% loops seamlessly */
.tfiw-ticker__track {
  display: flex;
  width: max-content;
  will-change: transform;
  animation: tfiw-ticker-scroll var(--tfiw-dur) linear infinite;
}

.tfiw-ticker--reverse .tfiw-ticker__track {
  animation-direction: reverse;
}

.tfiw-ticker.is-idle .tfiw-ticker__track {
  animation-play-state: paused; /* set by script while off-screen */
}

@media (hover: hover) {
  .tfiw-ticker--pausable:hover .tfiw-ticker__track {
    animation-play-state: paused;
  }
}

.tfiw-ticker__group {
  display: flex;
  flex: 0 0 auto;
  gap: var(--tfiw-gap);
  margin: 0;
  padding: 0 var(--tfiw-gap) 0 0; /* trailing gap keeps the seam even */
  list-style: none;
}

/* A single winner */
.tfiw-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 6px 16px 6px 6px;
  background: var(--tfiw-bg);
  color: var(--tfiw-text);
  border: 1px solid var(--tfiw-border);
  border-radius: var(--tfiw-radius);
  box-shadow: inset 0 -2px 0 var(--tfiw-accent, #61ce70), var(--tfiw-shadow);
  white-space: nowrap;
  transition: transform 0.2s ease;
}

@media (hover: hover) {
  .tfiw-chip:hover {
    transform: translateY(-1px);
  }
}

.tfiw-chip__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--tfiw-accent, #61ce70);
  color: var(--tfiw-on-accent, #fff);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.tfiw-chip__who {
  font-weight: 700;
}

.tfiw-chip__won {
  color: var(--tfiw-muted);
}

.tfiw-chip__won strong {
  color: var(--tfiw-text);
  font-weight: 700;
}

.tfiw-chip__when {
  padding-left: 10px;
  border-left: 1px solid var(--tfiw-border);
  color: var(--tfiw-muted);
  font-size: 0.85em;
  font-variant-numeric: tabular-nums;
}

@keyframes tfiw-ticker-scroll {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-50%, 0, 0); }
}

@media (max-width: 640px) {
  .tfiw-ticker {
    --tfiw-font-size: 12px;
    --tfiw-gap: 10px;
    --tfiw-fade: 6%;
  }
  .tfiw-chip {
    gap: 8px;
    padding: 5px 12px 5px 5px;
  }
  .tfiw-chip__avatar {
    width: 24px;
    height: 24px;
    font-size: 11px;
  }
}

/* Respect reduced-motion: no animation, let people swipe instead */
@media (prefers-reduced-motion: reduce) {
  .tfiw-ticker__track {
    animation: none;
  }
  .tfiw-ticker__rail {
    overflow-x: auto;
    -webkit-mask-image: none;
            mask-image: none;
  }
  .tfiw-ticker__group[aria-hidden="true"] {
    display: none;
  }
}
