/* ===================== CSS VARIABLES ===================== */
:root {
  --crpb-bar-height: 20px;
  --crpb-max-width: 1450px;
  --crpb-radius: 18px;
  --crpb-icon: 76px;
  --crpb-grad-start: #2b1c4b;
  --crpb-grad-end: #d4af37;
  --crpb-fill-color: #b175ff;
  --crpb-text: #ffffff;
  --crpb-tick: #c9b9ff;
  --crpb-tick-text: #ffffff;
  --crpb-neon: #39ff88;
  --crpb-fab-offset: 120px;
}

/* ===================== DESKTOP BAR ===================== */
#crpb-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 9999;
  display: flex;
  justify-content: center;
  pointer-events: none;
  transition: transform 0.3s ease;
}

#crpb-bar .crpb-shell {
  width: 95%;
  max-width: var(--crpb-max-width);
  background: rgba(20, 14, 38, 0.92);
  border-radius: 22px 22px 0 0;
  padding: 22px 26px 28px;
  backdrop-filter: blur(12px);
  pointer-events: auto;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.35);
  transition: padding 0.3s ease;
}

/* Collapsed state */
#crpb-bar.crpb-collapsed .crpb-milestones,
#crpb-bar.crpb-collapsed .crpb-msg-row {
  display: none;
}

#crpb-bar.crpb-collapsed .crpb-shell {
  padding: 16px 26px 18px;
}

/* Desktop neon title - ALWAYS VISIBLE */
.crpb-desktop-neon-title {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--crpb-neon);
  margin-bottom: 16px;
  text-shadow: 0 0 10px currentColor, 0 0 20px currentColor, 0 0 30px currentColor;
  animation: neonPulse 2s ease-in-out infinite;
  letter-spacing: 1px;
}

@keyframes neonPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

/* ===================== PROGRESS BAR ===================== */
.crpb-top-row {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Beautiful expand/collapse button - CIRCULAR AND POSITIONED HIGHER */
.crpb-toggle {
  position: absolute;
  right: 10px;
  top: -50px; /* Moved higher up */
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(57,255,136,0.25), rgba(177,117,255,0.25));
  border: 2px solid rgba(57,255,136,0.5);
  color: var(--crpb-neon);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  text-align: center;
  transition: all 0.3s ease;
  z-index: 20;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3), 0 0 25px rgba(57,255,136,0.2);
}

.crpb-toggle:hover {
  background: linear-gradient(135deg, rgba(57,255,136,0.4), rgba(177,117,255,0.4));
  border-color: rgba(57,255,136,0.8);
  box-shadow: 0 6px 25px rgba(0,0,0,0.4), 0 0 35px rgba(57,255,136,0.5);
  transform: scale(1.08);
}

.crpb-toggle:active {
  transform: scale(0.95);
}

.crpb-track-wrap {
  width: 100%;
  height: var(--crpb-bar-height);
  border-radius: var(--crpb-radius);
  background: rgba(255,255,255,0.08);
  position: relative;
  overflow: visible; /* Changed from hidden to visible */
  padding-right: 60px; /* Add padding to prevent cropping */
}

.crpb-track {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: visible;
}

.crpb-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--crpb-fill-color) 0%, #a569ff 50%, var(--crpb-neon) 100%);
  border-radius: var(--crpb-radius);
  transition: width 0.4s ease;
  width: 0%;
}

.crpb-ticks {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.crpb-tick {
  position: absolute;
  top: 0;
  height: 100%;
  transform: translateX(-50%);
}

.crpb-tick i {
  display: block;
  width: 2px;
  height: 12px;
  background: var(--crpb-tick);
  position: absolute;
  left: 0;
  top: -14px;
  transform: translateX(-50%);
  border-radius: 1px;
  font-style: normal;
}

.crpb-tick em {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translate(-50%, -50%);
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(0,0,0,0.55);
  font-size: 13px;
  font-weight: 700;
  color: var(--crpb-tick-text);
  white-space: nowrap;
  z-index: 15;
  font-style: normal;
}

/* ===================== GIFTS GRID ===================== */
.crpb-milestones {
  margin-top: 26px;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 20px;
  justify-items: center;
  align-items: start;
}

.crpb-item {
  text-align: center;
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.crpb-item:hover {
  transform: translateY(-4px);
}

.crpb-img-wrap {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.25s;
  border: 2px solid transparent;
  overflow: hidden;
  flex-shrink: 0;
}

.crpb-img-wrap img {
  width: 70px;
  height: 70px;
  object-fit: contain;
  filter: blur(2px) brightness(0.5);
  opacity: 0.75;
  transition: all 0.25s ease;
}

/* Label text - FIXED HEIGHT TO ALIGN ALL ITEMS */
.crpb-item-label {
  color: var(--crpb-text);
  margin-top: 8px;
  font-size: 13px;
  font-weight: 500;
  min-height: 36px; /* Fixed height for 2 lines */
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.3;
  max-width: 90px;
}

/* Unlocked state */
.crpb-item.unlocked .crpb-img-wrap img {
  filter: none !important;
  opacity: 1 !important;
  transform: scale(1.05);
}

.crpb-item.unlocked .crpb-img-wrap {
  border: 2px solid var(--crpb-neon);
  box-shadow: 0 0 14px rgba(57,255,136,0.55), 0 0 34px rgba(165,105,255,0.28);
}

.crpb-item.gold .crpb-img-wrap {
  border: 2px solid gold;
}

.crpb-item.gold.unlocked .crpb-img-wrap {
  box-shadow: 0 0 24px rgba(255,215,0,0.8), 0 0 40px rgba(255,215,0,0.4);
}

/* ===================== MESSAGES ===================== */
.crpb-msg-row {
  text-align: center;
  margin-top: 18px;
}

.crpb-msg {
  color: var(--crpb-text);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.4px;
}

/* ===================== MOBILE FAB - RIGHT SIDE BY DEFAULT ===================== */
.crpb-fab {
  position: fixed !important;
  bottom: var(--crpb-fab-offset) !important;
  right: 20px !important; /* RIGHT SIDE BY DEFAULT */
  left: auto !important;
  width: 68px !important;
  height: 68px !important;
  border-radius: 50% !important; /* PERFECTLY ROUND */
  background: linear-gradient(135deg, var(--crpb-grad-start), var(--crpb-grad-end)) !important;
  color: #fff !important;
  font-size: 36px !important;
  border: 3px solid rgba(57,255,136,0.4) !important;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(0,0,0,0.5), 0 0 30px rgba(57,255,136,0.3) !important;
  z-index: 9998 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: transform 0.3s ease, box-shadow 0.3s ease !important;
  padding: 0 !important;
  animation: fabPulse 3s ease-in-out infinite !important;
}

/* When fab_side is LEFT */
body[data-fab-side="left"] .crpb-fab {
  right: auto !important;
  left: 20px !important;
}

@keyframes fabPulse {
  0%, 100% {
    box-shadow: 0 6px 24px rgba(0,0,0,0.5), 0 0 30px rgba(57,255,136,0.3);
  }
  50% {
    box-shadow: 0 6px 24px rgba(0,0,0,0.5), 0 0 40px rgba(57,255,136,0.6);
  }
}

.crpb-fab:hover,
.crpb-fab:active {
  transform: scale(1.12) !important;
  box-shadow: 0 8px 30px rgba(0,0,0,0.6), 0 0 50px rgba(57,255,136,0.7) !important;
}

/* ===================== MOBILE MODAL ===================== */
.crpb-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: none;
  align-items: flex-end;
}

.crpb-modal.open {
  display: flex;
}

.crpb-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
}

.crpb-modal-sheet {
  position: relative;
  width: 100%;
  max-height: 85vh;
  background: linear-gradient(180deg, rgba(20,14,38,0.98) 0%, rgba(30,20,50,0.98) 100%);
  border-radius: 24px 24px 0 0;
  padding: 46px 24px 24px;
  overflow-y: auto;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* CLOSE BUTTON - ARROW DOWN & CENTERED - SMALLER */
.crpb-close {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(57,255,136,0.2), rgba(177,117,255,0.2));
  border: 2px solid rgba(57,255,136,0.4);
  color: var(--crpb-neon);
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.3s ease;
  padding: 0;
  line-height: 1;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.crpb-close::before {
  content: "▼";
  display: block;
}

.crpb-close:hover {
  background: linear-gradient(135deg, rgba(57,255,136,0.35), rgba(177,117,255,0.35));
  border-color: rgba(57,255,136,0.7);
  box-shadow: 0 6px 20px rgba(0,0,0,0.4), 0 0 25px rgba(57,255,136,0.4);
  transform: translateX(-50%) scale(1.08);
}

.crpb-modal-top {
  margin-bottom: 24px;
}

.crpb-modal-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--crpb-neon);
  text-align: center;
  margin-bottom: 16px;
  text-shadow: 0 0 10px currentColor, 0 0 20px currentColor, 0 0 30px currentColor;
}

.crpb-modal-track-wrap {
  width: 100%;
  height: 16px;
  border-radius: 8px;
  background: rgba(255,255,255,0.1);
  position: relative;
  overflow: hidden;
  margin-bottom: 12px;
}

.crpb-modal-track {
  width: 100%;
  height: 100%;
  position: relative;
}

.crpb-modal-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--crpb-fill-color), var(--crpb-neon));
  border-radius: 8px;
  transition: width 0.4s ease;
  width: 0%;
}

.crpb-modal-ticks {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.crpb-modal-tick {
  position: absolute;
  top: 0;
  height: 100%;
  transform: translateX(-50%);
}

.crpb-modal-tick i {
  display: block;
  width: 1px;
  height: 8px;
  background: rgba(255,255,255,0.5);
  position: absolute;
  left: 0;
  top: -8px;
  transform: translateX(-50%);
  font-style: normal;
}

.crpb-modal-tick em {
  position: absolute;
  top: -24px;
  left: 0;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,0.8);
  white-space: nowrap;
  font-style: normal;
}

.crpb-modal-msg {
  text-align: center;
  color: var(--crpb-text);
  font-size: 14px;
  font-weight: 600;
}

/* ===================== GIFT CARDS ===================== */
.crpb-modal-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.crpb-card {
  background: rgba(255,255,255,0.05);
  border-radius: 16px;
  padding: 16px;
  text-align: center;
  border: 2px solid rgba(255,255,255,0.1);
  transition: all 0.3s ease;
}

.crpb-card:hover {
  transform: translateY(-4px);
  background: rgba(255,255,255,0.08);
}

.crpb-card-img-wrap {
  width: 80px;
  height: 80px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border: 2px solid transparent;
  overflow: hidden;
}

.crpb-card-img-wrap img {
  width: 70px;
  height: 70px;
  object-fit: contain;
  filter: blur(2px) brightness(0.5);
  opacity: 0.7;
  transition: all 0.3s ease;
}

.crpb-card.unlocked .crpb-card-img-wrap img {
  filter: none;
  opacity: 1;
}

.crpb-card.unlocked .crpb-card-img-wrap {
  border: 2px solid var(--crpb-neon);
  box-shadow: 0 0 16px rgba(57,255,136,0.5);
}

.crpb-card.gold .crpb-card-img-wrap {
  border: 2px solid gold;
}

.crpb-card.gold.unlocked .crpb-card-img-wrap {
  box-shadow: 0 0 20px rgba(255,215,0,0.6);
}

.crpb-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--crpb-text);
  margin-bottom: 6px;
}

.crpb-card-desc {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  margin-bottom: 8px;
  line-height: 1.3;
}

.crpb-card-amount {
  font-size: 13px;
  font-weight: 700;
  color: var(--crpb-neon);
}

/* ===================== CONFETTI ===================== */
.crpb-confetti {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10001;
  overflow: hidden;
}

.crpb-confetti span {
  position: absolute;
  top: -10px;
  width: 8px;
  height: 8px;
  background: #ff6b6b;
  animation: confettiFall linear forwards;
  opacity: 0;
}

.crpb-confetti span:nth-child(2n) { background: #4ecdc4; }
.crpb-confetti span:nth-child(3n) { background: #ffe66d; }
.crpb-confetti span:nth-child(4n) { background: #a8e6cf; }
.crpb-confetti span:nth-child(5n) { background: #ff6b9d; }

@keyframes confettiFall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
  .crpb-milestones {
    grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
    gap: 12px;
  }
  
  .crpb-img-wrap {
    width: 60px;
    height: 60px;
  }
  
  .crpb-img-wrap img {
    width: 50px;
    height: 50px;
  }
  
  .crpb-item-label {
    font-size: 11px;
    min-height: 32px;
    max-width: 70px;
  }
  
  .crpb-modal-list {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
  }
  
  .crpb-desktop-neon-title {
    font-size: 18px;
    margin-bottom: 12px;
  }
}