/* ==================== Font ==================== */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;600;700;800&display=swap');

/* ==================== Tokens ==================== */
:root {
  --card-w: 372px;
  --card-h: 400px;

  /* layout */
  --gap: clamp(8px, 1.6vw, 22px);
  --card-pad: clamp(10px, 2.0vw, 18px);
  --card-radius: 30px;
  --radius: clamp(2px, 6vw, 30px);

  /* progress bar */
  --bar-h: clamp(40px, 10.8vw, 110px);

  /* accent colors (set by JS) */
  --accent: rgb(111,77,210);
  --accent-neon: rgba(111,77,210,.55);

  /* toaster background (fallback) */
  --toast-bg:
    radial-gradient(120% 140% at 10% -20%, var(--accent-neon) 0%, rgba(30,33,50,1) 40%),
    linear-gradient(180deg, #1e2231, #151826);
}

/* ==================== Base / Surface ==================== */
*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  height: 100%;
  width: 100%;
  margin: 0;
  overflow: hidden;
  background: transparent;       /* OBS-friendly */
  font-family: 'Roboto', sans-serif;
}

#overlay { height: 100%; display: grid; place-items: center; }

.stack {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  isolation: isolate;
}
#stack { pointer-events: none; }

/* ==================== Toast ==================== */
.toast.goal-toast {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  color: #fff;
  border-radius: var(--radius);
  background: var(--toast-bg);
  box-shadow: 0 18px 44px rgba(0,0,0,.45);
  overflow: visible;
  opacity: 0;
  transform: translateY(8px) scale(.98);
  animation: toastIn 360ms cubic-bezier(.2,.8,.2,1) forwards;

  /* layered background */
  background:
    radial-gradient(circle at center,
      var(--accent-neon, rgba(0,200,255,0.7)) 0%,
      rgba(20,20,30,0.85) 60%,
      rgba(10,10,15,1) 100%
    ),
    repeating-conic-gradient(
      from 90deg,
      rgba(0,80,200,0.6) 0deg 12deg,
      rgba(0,20,60,0.6) 12deg 24deg
    ),
    linear-gradient(180deg, #0a0f2d, #000000);
  background-blend-mode: screen, overlay, normal;
}

/* ==================== Banner ==================== */
.event-banner.image-card {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 22px;
  opacity: 1 !important;
  mix-blend-mode: normal !important;
  filter: none !important;

  width: clamp(20px, 50%, 320px);
  aspect-ratio: 1 / 1;
  margin: 4px 0 6px;
  position: relative;
  overflow: visible;
  object-fit: contain;
  flex-grow: 1;
  flex-shrink: 1;

  box-shadow:
    0 12px 28px rgba(0,0,0,.55),
    0 0 0 3px #FFD84D,
    0 0 0 6px rgba(0,0,0,.35);
}
.event-banner.image-card::before {
  content: "";
  position: absolute;
  inset: -10%;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(40% 60% at 50% 70%, var(--accent-neon) 0%, transparent 65%);
  filter: blur(28px);
}

/* ==================== Content Area ==================== */
.event-bottom {
  width: 100%;
  margin: 0 auto;
  padding: var(--card-pad);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(6px, 1.2vw, 14px);
  border-radius: var(--card-radius);
  background: none;
  overflow: visible;
  box-shadow: none;
}
.event-bottom > * { position: relative; z-index: 1; }

/* ==================== Titles ==================== */
.event-title {
  --ol: 3px; --oc: #000;
  padding-top: 2px;
  margin-top: -2px;
  font-size: clamp(30px, 7vw, 96px);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: .02em;
  text-align: center;
  color: #fff;
  text-shadow:
    calc( 1 * var(--ol)) 0 var(--oc),
    calc(-1 * var(--ol)) 0 var(--oc),
    0 calc( 1 * var(--ol)) var(--oc),
    0 calc(-1 * var(--ol)) var(--oc),
    calc( 1 * var(--ol)) calc( 1 * var(--ol)) var(--oc),
    calc(-1 * var(--ol)) calc( 1 * var(--ol)) var(--oc),
    calc( 1 * var(--ol)) calc(-1 * var(--ol)) var(--oc),
    calc(-1 * var(--ol)) calc(-1 * var(--ol)) var(--oc),
    0 0 6px rgba(0,0,0,.55);
  max-width: 92%;
  margin-inline: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-category {
  --ol: 2px; --oc: #000;
  font-size: clamp(22px, 3.8vw, 54px);
  font-weight: 800;
  text-align: center;
  color: #55ecaf;
  text-shadow:
    calc( 1 * var(--ol)) 0 var(--oc),
    calc(-1 * var(--ol)) 0 var(--oc),
    0 calc( 1 * var(--ol)) var(--oc),
    0 calc(-1 * var(--ol)) var(--oc),
    calc( 1 * var(--ol)) calc( 1 * var(--ol)) var(--oc),
    calc(-1 * var(--ol)) calc( 1 * var(--ol)) var(--oc),
    calc( 1 * var(--ol)) calc(-1 * var(--ol)) var(--oc),
    calc(-1 * var(--ol)) calc(-1 * var(--ol)) var(--oc),
    0 0 6px rgba(0,0,0,.55);
  max-width: 92%;
  margin: 0 auto 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==================== Bits Badge ==================== */
.bits-overlay {
  position: absolute;
  right: -10px;
  bottom: -10px;
  padding: 6px 12px;
  border-radius: 12px;
  background: rgba(10,10,20,.65);
  backdrop-filter: blur(2px);
  font-weight: 900;
  font-size: clamp(20px, 5vw, 80px);
  color: #00E6FF;
  z-index: 2;
  pointer-events: none;

  box-shadow:
    0 0 0 3px rgba(0,0,0,.65),
    0 6px 14px rgba(0,0,0,.55),
    0 0 16px rgba(0,230,255,.35);
  text-shadow:
    3px 3px 0 #000,
   -3px -3px 0 #000,
    0 0 10px rgba(0,0,0,.85);

  opacity: 0;
  transform: translate3d(0,14px,0) scale(.98);
  backface-visibility: hidden;
  will-change: transform, opacity;
  contain: paint;
}
@keyframes bits-float-up {
  0%   { opacity: 0; transform: translate3d(0,14px,0) scale(1); }
  28%  { opacity: 1; transform: translate3d(0,0,0) scale(1); }
  90%  { opacity: 1; transform: translate3d(0,0,0) scale(1); }
  100% { opacity: 0; transform: translate3d(0,-4px,0) scale(1); }
}
.bits-float {
  animation: bits-float-up var(--bits-float-dur, 6000ms) cubic-bezier(.2,.8,.2,1) forwards;
}

/* ==================== Progress Bar ==================== */
.progress-wrap { width: 100%; }
.progress-shell { padding: 4px; border-radius: 24px; }

.progress-bar {
  position: relative;
  width: 100%;
  height: var(--bar-h);
  border-radius: 999px;
  overflow: hidden;
  background: #1f1834;
  box-shadow: inset 0 3px 6px rgba(0,0,0,.65);
}
.progress-bar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.18), rgba(255,255,255,0) 55%);
}

.progress-bar-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  min-width: 8px;
  border-radius: inherit;
  z-index: 2;
  background: linear-gradient(90deg, #00E6B5, #55EBAF, #AFD9FF, #00E6B5);
  background-size: 300% 100%;
  animation: flow 3s linear infinite;
  box-shadow:
    0 0 14px rgba(0,0,0,.25),
    inset 0 0 12px rgba(255,255,255,.25);
  transition: width 700ms cubic-bezier(.2,.8,.2,1);
}
.progress-bar-fill.done {
  animation: flow 3s linear infinite, pulseGlow .9s ease-out 1;
}

.progress-icon {
  position: absolute;
  left: clamp(12px, 1.6vw, 18px);
  top: 50%;
  transform: translateY(-50%);
  width: clamp(34px, 5vw, 52px);
  height: clamp(34px, 5vw, 52px);
  z-index: 3;
  pointer-events: none;
}

/* ==================== Progress Value ==================== */
.progress-value {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: clamp(22px, 3.6vw, 36px);
  color: #fff;
  z-index: 4;
  pointer-events: none;
  /* subtle outline for legibility */
  text-shadow:
    -1px -1px 2px rgba(0,0,0,.75),
     1px -1px 2px rgba(0,0,0,.75),
    -1px  1px 2px rgba(0,0,0,.75),
     1px  1px 2px rgba(0,0,0,.75);
}

/* Active glow while counting */
.progress-value.active {
  color: #FFD84D;
  animation: glowPulse 1s ease-in-out infinite;
  text-shadow:
    -2px -2px 3px rgba(0,0,0,.9),
     2px -2px 3px rgba(0,0,0,.9),
    -2px  2px 3px rgba(0,0,0,.9),
     2px  2px 3px rgba(0,0,0,.9),
     0 0 12px rgba(255,216,77,0.9),
     0 0 22px rgba(255,180,0,0.8);
}

/* Smooth fadeout after counting */
.progress-value.fadeout {
  animation: glowFadeout 1s ease forwards;
}

/* ==================== Goal Label ==================== */
.goal-label {
  --ol: 2px; --oc: #000;
  font-size: clamp(20px, 3.8vw, 54px);
  font-weight: 800;
  text-align: center;
  color: #ffde67;
  text-shadow:
    calc( 1 * var(--ol)) 0 var(--oc),
    calc(-1 * var(--ol)) 0 var(--oc),
    0 calc( 1 * var(--ol)) var(--oc),
    0 calc(-1 * var(--ol)) var(--oc),
    calc( 1 * var(--ol)) calc( 1 * var(--ol)) var(--oc),
    calc(-1 * var(--ol)) calc( 1 * var(--ol)) var(--oc),
    calc( 1 * var(--ol)) calc(-1 * var(--ol)) var(--oc),
    calc(-1 * var(--ol)) calc(-1 * var(--ol)) var(--oc),
    0 0 6px rgba(0,0,0,.55);
  max-width: 92%;
  margin: 2px auto 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==================== Animations ==================== */
@keyframes flow { 0% { background-position:0% 50% } 100% { background-position:300% 50% } }
@keyframes toastIn { from { opacity:0; transform:translateY(10px) scale(.98) } to { opacity:1; transform:translateY(0) scale(1) } }
@keyframes toastOut { from { opacity:1; transform:translateY(0) scale(1) } to { opacity:0; transform:translateY(10px) scale(.98) } }
@keyframes pulseGlow { 0% { box-shadow:0 0 0 0 rgba(255,255,255,.35); } 100% { box-shadow:0 0 0 14px rgba(255,255,255,0); } }

@keyframes glowPulse {
  0%, 100% {
    text-shadow:
      -1px -1px 2px rgba(0,0,0,.85),
       1px -1px 2px rgba(0,0,0,.85),
      -1px  1px 2px rgba(0,0,0,.85),
       1px  1px 2px rgba(0,0,0,.85),
       0 0 6px rgba(255,216,77,0.6),
       0 0 12px rgba(255,180,0,0.5);
  }
  50% {
    text-shadow:
      -1px -1px 2px rgba(0,0,0,.85),
       1px -1px 2px rgba(0,0,0,.85),
      -1px  1px 2px rgba(0,0,0,.85),
       1px  1px 2px rgba(0,0,0,.85),
       0 0 10px rgba(255,216,77,0.9),
       0 0 18px rgba(255,180,0,0.8);
  }
}

@keyframes glowFadeout {
  0% {
    color: #FFD84D;
    text-shadow:
      -1px -1px 2px rgba(0,0,0,.85),
       1px -1px 2px rgba(0,0,0,.85),
      -1px  1px 2px rgba(0,0,0,.85),
       1px  1px 2px rgba(0,0,0,.85),
       0 0 8px rgba(255,216,77,0.9),
       0 0 14px rgba(255,180,0,0.7);
  }
  100% {
    color: #fff;
    text-shadow:
      -1px -1px 2px rgba(0,0,0,.7),
       1px -1px 2px rgba(0,0,0,.7),
      -1px  1px 2px rgba(0,0,0,.7),
       1px  1px 2px rgba(0,0,0,.7);
  }
}

}

/* ==================== Reduced Motion ==================== */
@media (prefers-reduced-motion: reduce) {
  .progress-bar-fill { animation: none; transition: none; }
  .bits-overlay { transition: none; }
}

/* ==================== Responsive ==================== */
@media (max-height:680px) {
  .event-bottom { padding-block: 8px 12px; }
  .event-title { font-size: clamp(28px, 6.2vw, 88px); }
}
@media (max-width:420px) {
  .toast.goal-toast { border-radius: 22px; }
  .event-banner.image-card { border-radius: 18px; }
}


/* ==================== Lightning Spark ==================== */
.event-category,
.goal-label,
.event-title {
  position: relative; /* ensure lightning overlays correctly */
  overflow: hidden;
}

.lightning-effect {
  position: absolute;
  top: 0;
  left: -150%;
  width: 300%;
  height: 100%;
  background: linear-gradient(
    100deg,
    transparent 46%,
    #ffffff 48%,
    #ffffff 49%,
    #00eaff 50%,
    #ffffff 51%,
    #ffffff 52%,
    transparent 54%
  );
  opacity: 0;
  pointer-events: none;
}


@keyframes lightningSpark {
  0%   { left: -150%; opacity: 0; }
  5%   { opacity: 1; }
  50%  { left: 0%; opacity: 1; }
  80%  { opacity: 0.7; }
  100% { left: 150%; opacity: 0; }
}

/* Keep gold frame but animate shimmer on the sides */
.event-banner.image-card {
  position: relative;
  border-radius: 15px;
  border: 3px solid #FFD84D; /* your static gold frame */
  animation: shimmer-border 2s ease-in-out infinite;
}

@keyframes shimmer-border {
  0%, 100% {
    border-left-color: #FFD84D;
    border-right-color: #FFD84D;
    box-shadow: none;
  }
  50% {
    border-left-color: #FFC94D; /* warmer gold highlight */
    border-right-color: #FFE77A; /* brighter blend */
    box-shadow:
      -4px 0 12px rgba(255, 216, 77, 0.6),
       4px 0 12px rgba(255, 216, 77, 0.6);
  }
}




/* ==================== Thank You Overlay ==================== */
.thank-you-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(6px);
  background: rgba(0,0,0,0.55);
  z-index: 99;
  opacity: 0;
  animation: thankYouFadeIn 0.6s ease forwards;
}

.thank-you-message {
  font-size: clamp(32px, 6vw, 80px);
  font-weight: 900;
  text-align: center;
  color: white; /* white base*/
  line-height: 1.2;
  text-shadow:
    -2px -2px 4px rgba(0,0,0,.9),
     2px -2px 4px rgba(0,0,0,.9),
     0 0 18px rgba(7, 7, 7, 0.9),
     0 0 32px rgba(0, 0, 0, 0.8);
  animation: thankYouPulse 1.4s ease-in-out infinite;
}

/* Highlight for viewer and bits */
.thank-you-highlight {
  color: #55EBAF; /* your custom green */
  text-shadow:
    0 0 6px rgba(0,0,0,.8),
    0 0 14px rgba(85,235,175,.9),
    0 0 24px rgba(85,235,175,.7);
}

@keyframes thankYouFadeIn {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes thankYouFadeOut {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(1.05); }
}
@keyframes thankYouPulse {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
