/*
 * Gift Guide — shared bar styles (used by the OBS overlay AND the
 * builder's live preview). Self-contained: no dependency on the
 * loadout design tokens so the overlay stays a single tiny payload.
 */

.gb-root {
  --gb-h: 64px;
  --gb-font: 18px;
  --gb-text: #ffffff;
  --gb-accent: #7c5cff;
  /* Text legibility over gameplay. 'strong' is the default; 'outline' adds
     a dark stroke around the glyphs for the busiest scenes. */
  --gb-text-shadow: 0 2px 5px rgba(0,0,0,0.95), 0 1px 2px rgba(0,0,0,0.9);
  --gb-icon-shadow: drop-shadow(0 2px 4px rgba(0,0,0,0.8));
  display: flex;
  position: relative;
  width: 100%;
  height: 100%;
}

/* Animated gradient background (transform-only → GPU compositor → no lag).
   Mounted in the root for a full-source fill, or inside the bar for a pill. */
.gb-bgfx {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}
.gb-bgfx::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 200%;          /* twice the box: always covers as it pans */
  height: 100%;
  /* Periodic gradient (period = 1 box width) so a -50% pan loops seamlessly. */
  background: linear-gradient(90deg,
    var(--c1, #7c5cff) 0%,  var(--c2, #22b8e6) 12.5%, var(--c3, #3ddc84) 25%, var(--c2, #22b8e6) 37.5%,
    var(--c1, #7c5cff) 50%, var(--c2, #22b8e6) 62.5%, var(--c3, #3ddc84) 75%, var(--c2, #22b8e6) 87.5%,
    var(--c1, #7c5cff) 100%);
  transform: translate3d(0, 0, 0);
  will-change: transform;
  backface-visibility: hidden;
  animation: gb-grad-pan var(--gb-grad-speed, 26s) linear infinite;
}
.gb-bgfx[data-anim="off"]::before { animation: none; }
@keyframes gb-grad-pan { to { transform: translate3d(-50%, 0, 0); } }
@media (prefers-reduced-motion: reduce) { .gb-bgfx::before { animation: none; } }

/* ── Stacked list overlay ──────────────────────────────────────────── */
.gb-list-root { display: block; }
.gb-list-root .gb-col { width: 100%; height: 100%; gap: 0; }
.gb-list-root .gb-listwrap { flex: 1 1 auto; width: 100%; min-height: 0; overflow: hidden; }
.gb-list-root .gb-listscroll { display: flex; flex-direction: column; }
.gb-list-root .gb-list { display: flex; flex-direction: column; gap: calc(var(--gb-h) * 0.16); }
.gb-list-root .gb-dup { margin-top: calc(var(--gb-h) * 0.16); }   /* match the row gap across the seam */
/* Rows are always visible + stacked (override the bar's crossfade stacking). */
.gb-list-root .gb-item {
  position: static; grid-area: auto; opacity: 1; transform: none;
  white-space: normal;            /* let long effect text wrap in a list */
  transition: none;
}
.gb-list-root[data-align="center"] .gb-list { align-items: center; }
.gb-list-root[data-align="center"] .gb-item { justify-content: center; }
/* In a list, the effect should wrap fully rather than ellipsis-clip. */
.gb-list-root .gb-label { overflow: visible; text-overflow: clip; white-space: normal; overflow-wrap: break-word; flex: 1 1 auto; }
.gb-scrolling { animation: gb-scroll var(--gb-scroll-dur, 30s) linear infinite; will-change: transform; backface-visibility: hidden; }
@keyframes gb-scroll { to { transform: translate3d(0, calc(-1 * var(--gb-scroll-dist, 0px)), 0); } }
@media (prefers-reduced-motion: reduce) { .gb-scrolling { animation: none; } }

/* Text-shadow strength levels (set on the root). */
.gb-root[data-shadow="soft"] {
  --gb-text-shadow: 0 1px 3px rgba(0,0,0,0.7);
  --gb-icon-shadow: drop-shadow(0 1px 3px rgba(0,0,0,0.5));
}
.gb-root[data-shadow="strong"] {
  --gb-text-shadow: 0 2px 5px rgba(0,0,0,0.95), 0 1px 2px rgba(0,0,0,0.9);
  --gb-icon-shadow: drop-shadow(0 2px 4px rgba(0,0,0,0.8));
}
.gb-root[data-shadow="outline"] {
  --gb-text-shadow:
    -1.5px -1.5px 0 rgba(0,0,0,0.9), 1.5px -1.5px 0 rgba(0,0,0,0.9),
    -1.5px 1.5px 0 rgba(0,0,0,0.9), 1.5px 1.5px 0 rgba(0,0,0,0.9),
    0 2px 6px rgba(0,0,0,0.75);
  --gb-icon-shadow: drop-shadow(0 0 2px rgba(0,0,0,0.95)) drop-shadow(0 2px 4px rgba(0,0,0,0.8));
}

/* Horizontal alignment of the bar within the browser source (hug mode). */
.gb-root[data-align="left"]   { justify-content: flex-start; }
.gb-root[data-align="center"] { justify-content: center; }
/* Vertical placement within a tall source (e.g. a full 1080×1920 canvas). */
.gb-root { align-items: center; }
.gb-root[data-pos="top"]    { align-items: flex-start; }
.gb-root[data-pos="center"] { align-items: center; }
.gb-root[data-pos="bottom"] { align-items: flex-end; }

/* Column stack: optional caption / bar / optional caption. Aligns with
   the bar per data-align; spans the source width in full mode. */
.gb-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  max-width: 100%;
  position: relative;
  z-index: 1;               /* above a full-source gradient layer */
}
.gb-root[data-align="center"] .gb-col { align-items: center; }
.gb-root[data-fit="full"] .gb-col { width: 100%; }

/* Floating caption text above / below the bar. Transparent, shadowed for
   readability over gameplay; hidden when blank. */
.gb-caption {
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-shadow: var(--gb-text-shadow);
  max-width: 100%;
}
.gb-root[data-align="center"] .gb-caption { text-align: center; }
.gb-caption[hidden] { display: none; }
/* Optional gift icon inside a caption, scaled to the caption's font. */
.gb-cap-icon {
  height: 1.2em;
  width: auto;
  vertical-align: -0.22em;
  margin-right: 0.32em;
  filter: var(--gb-icon-shadow);
}

/* The pill. Auto-hugs the widest gift row; only paints a background
   when the streamer turns one on, so it's invisible by default. */
.gb-bar {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: var(--gb-h);
  padding: 0 calc(var(--gb-h) * 0.32);
  box-sizing: border-box;
  overflow: hidden;
  max-width: 100%;
  /* Promote the bar to its own GPU layer so the whole overlay composites
     in one cheap pass — keeps OBS/CEF smooth even under GPU contention. */
  transform: translateZ(0);
}
.gb-bar--filled {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  /* NO backdrop-filter: blur() — it forces CEF to re-sample the backdrop
     every frame and is the #1 cause of OBS browser-source stutter. A flat
     translucent fill is effectively free. */
}

/* Full-width banner mode (default for vertical / TikTok): the bar spans the
   whole browser source and the gift content is justified inside it. */
.gb-root[data-fit="full"] .gb-bar { display: flex; width: 100%; }
.gb-root[data-fit="full"][data-align="left"]   .gb-bar { justify-content: flex-start; }
.gb-root[data-fit="full"][data-align="center"] .gb-bar { justify-content: center; }

/* Instant-cut mode: kill the crossfade so gifts swap with zero animation
   (and zero transition cost) — the active item just appears. */
.gb-root[data-fx="cut"] .gb-item { transition: none; }

/* Grid stacking lets every gift row occupy the same cell, so the pill
   sizes to the WIDEST row and rows can crossfade in place. */
.gb-stage {
  display: grid;
  align-items: center;
  min-height: calc(var(--gb-h) - 2px);
  position: relative;
  z-index: 1;               /* above a pill gradient layer */
}
.gb-item {
  grid-area: 1 / 1;
  display: flex;
  align-items: center;
  gap: calc(var(--gb-h) * 0.18);
  opacity: 0;
  /* translate3d keeps the crossfade on the compositor (no layout/paint). */
  transform: translate3d(0, 2px, 0);
  transition: opacity 0.5s ease, transform 0.5s ease;
  will-change: opacity, transform;
  backface-visibility: hidden;
  pointer-events: none;
  white-space: nowrap;
}
.gb-item.is-active {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}
/* Center each rotating gift within the gallery's (widest-row) cell, so
   short rows don't sit left of long ones when the bar is centered. */
.gb-root[data-align="center"] .gb-item { justify-content: center; }

.gb-icon {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--gb-h) * 0.66);
  height: calc(var(--gb-h) * 0.66);
}
.gb-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: var(--gb-icon-shadow);
}
.gb-icon--fallback {
  font-size: calc(var(--gb-h) * 0.5);
  line-height: 1;
}

.gb-qty {
  flex: 0 0 auto;
  font-size: var(--gb-font);
  font-weight: 800;
  color: var(--gb-text);
  letter-spacing: -0.01em;
  text-shadow: var(--gb-text-shadow);
}

.gb-name {
  flex: 0 0 auto;
  font-size: var(--gb-font);
  font-weight: 800;
  color: var(--gb-text);
  letter-spacing: -0.01em;
  text-shadow: var(--gb-text-shadow);
}

/* Optional coin-cost badge (gold chip with a coin glyph). */
.gb-coins {
  flex: 0 0 auto;
  font-size: calc(var(--gb-font) * 0.72);
  font-weight: 800;
  color: #ffd86b;
  background: rgba(255, 184, 48, 0.14);
  border: 1px solid rgba(255, 200, 80, 0.38);
  border-radius: 999px;
  padding: 0.04em 0.5em;
  line-height: 1.35;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
.gb-coins::before { content: '🪙'; margin-right: 0.18em; font-size: 0.88em; }

/* Live reaction pulse — a gift's row scales when that gift is sent. The
   keyframes start/end at scale(1) (= the active row's identity transform),
   so there's no glide-back fight with the crossfade transition. */
@keyframes gbPulse {
  0%   { transform: scale(1); }
  22%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}
.gb-item.gb-pulse {
  animation: gbPulse 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.gb-eq {
  flex: 0 0 auto;
  font-size: calc(var(--gb-font) * 1.05);
  font-weight: 800;
  color: var(--gb-accent);
  text-shadow: var(--gb-text-shadow);
}

.gb-label {
  flex: 0 1 auto;
  font-size: var(--gb-font);
  font-weight: 700;
  color: var(--gb-text);
  letter-spacing: -0.01em;
  text-shadow: var(--gb-text-shadow);
  overflow: hidden;
  text-overflow: ellipsis;
}

.gb-empty {
  opacity: 1;
  color: var(--gb-text);
  font-size: var(--gb-font);
  font-weight: 600;
  opacity: 0.6;
}
