:root {
  --bb-bg: rgba(0, 0, 0, 0.65);
  --bb-card: rgba(255, 255, 255, 0.96);
  --bb-accent: #ff3b30;
  --bb-text: #111;
  --bb-success: #21c45d;
  --bb-warning: #ff8f3b;
}

.bb-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.bb-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bb-bg);
  z-index: 9999;
  padding: 24px;
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 220ms ease, transform 220ms ease;
}

.bb-overlay.bb-mounted {
  opacity: 1;
  transform: scale(1);
}

.bb-modal {
  position: relative;
  width: min(480px, 100%);
  background: var(--bb-card);
  color: var(--bb-text);
  border-radius: 20px;
  padding: 32px 28px 28px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  animation: bb-pop-in 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.bb-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.06);
  color: var(--bb-text);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.bb-modal-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bb-badge {
  align-self: flex-start;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--bb-accent);
  color: #fff;
  padding: 6px 10px;
  border-radius: 999px;
}

.bb-modal h2 {
  font-size: 28px;
  line-height: 1.1;
  margin: 0;
}

.bb-modal-subtitle {
  margin: 0;
  color: rgba(0, 0, 0, 0.72);
  font-size: 16px;
  line-height: 1.4;
}

.bb-countdown {
  font-size: 20px;
  font-weight: 700;
  color: var(--bb-accent);
}

.bb-code-block {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.04);
  padding: 12px 16px;
  border-radius: 14px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.bb-code {
  font-family: 'Roboto Mono', monospace;
  font-size: 18px;
}

.bb-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.bb-btn {
  border: none;
  border-radius: 999px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.bb-btn-primary {
  background: var(--bb-accent);
  color: #fff;
  box-shadow: 0 14px 24px rgba(0, 0, 0, 0.16);
}

.bb-btn-secondary {
  background: rgba(0, 0, 0, 0.08);
  color: var(--bb-text);
}

.bb-btn-ghost {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 10px 16px;
}

.bb-btn-link {
  background: none;
  color: var(--bb-text);
  text-decoration: underline;
  padding: 8px 12px;
}

.bb-btn-small {
  background: var(--bb-accent);
  color: #fff;
  padding: 8px 16px;
  font-size: 14px;
}

.bb-btn-disabled {
  opacity: 0.6;
  pointer-events: none;
}

.bb-btn:hover {
  transform: translateY(-1px);
}

.bb-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.bb-btn-pulse {
  animation: bb-pulse 600ms ease;
}

.bb-flyout {
  position: fixed;
  inset: auto 12px 12px auto;
  width: min(360px, calc(100% - 24px));
  background: var(--bb-card);
  color: var(--bb-text);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.26);
  transform: translateX(110%);
  opacity: 0;
  transition: transform 260ms ease, opacity 260ms ease;
  z-index: 9998;
}

.bb-flyout.bb-flyout-visible {
  transform: translateX(0);
  opacity: 1;
}

.bb-flyout-close {
  position: absolute;
  top: 16px;
  right: 16px;
  border: none;
  background: transparent;
  font-size: 24px;
  cursor: pointer;
  color: var(--bb-text);
}

.bb-flyout-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.bb-flyout-header h2 {
  margin: 0;
  font-size: 22px;
}

.bb-flyout-subtitle {
  margin: 0;
  color: rgba(0, 0, 0, 0.68);
  font-size: 15px;
}

.bb-bundle-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.bb-bundle-progress-track {
  position: relative;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.bb-bundle-progress-bar {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--bb-accent);
  width: 32%;
  transition: width 200ms ease;
}

.bb-bundle-progress-text {
  font-size: 14px;
  color: rgba(0, 0, 0, 0.72);
}

.bb-bundle-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bb-bundle-item {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  align-items: center;
}

.bb-bundle-item img {
  border-radius: 16px;
  width: 72px;
  height: 72px;
  object-fit: cover;
}

.bb-bundle-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bb-bundle-info h3 {
  margin: 0;
  font-size: 16px;
}

.bb-bundle-info p {
  margin: 0;
  font-size: 14px;
  color: rgba(0, 0, 0, 0.64);
}

.bb-bundle-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.bb-bundle-price {
  font-weight: 700;
}

.bb-flyout-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.bb-sticky {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  min-height: 48px;
  z-index: 9997;
  background: var(--bb-card);
  color: var(--bb-text);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  transition: transform 200ms ease;
}

.bb-sticky-hidden {
  transform: translateY(-120%);
}

.bb-sticky-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.bb-sticky-message {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 14px;
}

.bb-sticky-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
}

.bb-sticky-highlight {
  font-weight: 700;
}

.bb-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  color: var(--bb-accent);
}

.bb-toast-stack {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10000;
}

.bb-toast {
  background: rgba(17, 17, 17, 0.88);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 14px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 200ms ease, transform 200ms ease;
}

.bb-toast-visible {
  opacity: 1;
  transform: translateY(0);
}

.bb-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.bb-confetti span {
  position: absolute;
  top: -10px;
  left: 50%;
  width: 8px;
  height: 14px;
  border-radius: 4px;
  background: var(--bb-confetti-color, var(--bb-accent));
  animation: bb-confetti-fall 900ms ease-in forwards;
  transform: translateX(calc((var(--bb-confetti-idx) - 8) * 8px));
}

@keyframes bb-confetti-fall {
  0% { transform: translate(var(--bb-confetti-x, 0), -10px) rotate(0deg); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: translate(var(--bb-confetti-x, 0), 130px) rotate(260deg); opacity: 0; }
}

.bb-spin-wheel-wrap {
  position: relative;
  width: min(320px, 100%);
  margin: 0 auto;
}

.bb-spin-wheel {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: var(--bb-spin-gradient, conic-gradient(var(--bb-accent) 0deg 60deg, var(--bb-warning) 60deg 120deg, var(--bb-success) 120deg 180deg, #00cfff 180deg 240deg, #9b5bff 240deg 300deg, #ff3b30 300deg 360deg));
  box-shadow: inset 0 0 0 6px rgba(255, 255, 255, 0.6), 0 16px 32px rgba(0, 0, 0, 0.24);
  transition: transform 4200ms cubic-bezier(0.17, 0.92, 0.45, 1);
  transform: rotate(0deg);
}

.bb-spin-wheel-animating {
  transition-duration: 4600ms;
}

.bb-spin-labels {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.bb-spin-label {
  position: absolute;
  width: 40%;
  left: 50%;
  top: 50%;
  transform-origin: center left;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
  transform: rotate(var(--bb-spin-angle)) translate(8px, -50%);
}

.bb-spin-pointer {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-bottom: 28px solid var(--bb-accent);
}

.bb-spin-result {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.bb-mystery-zone {
  position: relative;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.06);
}

.bb-mystery-canvas {
  width: 100%;
  display: block;
}

.bb-mystery-fallback {
  padding: 32px;
  text-align: center;
  font-weight: 600;
}

.bb-mystery-hint {
  margin: 0;
  text-align: center;
  font-size: 14px;
  color: rgba(0, 0, 0, 0.65);
}

.bb-mystery-result {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
  text-align: center;
}

.bb-mystery-result strong {
  font-size: 22px;
}

@keyframes bb-pop-in {
  from {
    transform: scale(0.92);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes bb-slide-in-right {
  from {
    transform: translateX(40px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes bb-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.035); }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

@media (min-width: 720px) {
  .bb-modal {
    padding: 36px 32px 32px;
  }
  .bb-modal h2 {
    font-size: 32px;
  }
}
