/* Tiktok Live Style Battles */

.battle-panel-container {
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  padding: 12px 16px;
  color: #f1f5f9;
  font-family: inherit;
  z-index: 100;
  position: relative;
  transition: all 0.3s ease;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  margin: 8px;
}

.battle-header {
  font-weight: 600;
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}

.battle-round-info {
  background: rgba(255, 255, 255, 0.08);
  padding: 4px 10px;
  border-radius: 20px;
}

.battle-timer-badge {
  background: #ef4444;
  color: #ffffff;
  padding: 4px 12px;
  border-radius: 20px;
  animation: pulse-timer 1s infinite alternate;
}

@keyframes pulse-timer {
  0% { transform: scale(1); box-shadow: 0 0 5px rgba(239, 68, 68, 0.5); }
  100% { transform: scale(1.05); box-shadow: 0 0 15px rgba(239, 68, 68, 0.8); }
}

.battle-vs-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  margin: 10px 0;
  position: relative;
}

.battle-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 40%;
  position: relative;
  transition: all 0.3s ease;
}

.battle-avatar-ring {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  box-sizing: border-box;
}

.pr-ring {
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
}

.sc-ring {
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  box-shadow: 0 0 15px rgba(236, 72, 153, 0.5);
}

.battle-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background-color: #334155;
  border: 2px solid rgba(15, 23, 42, 0.9);
}

.battle-player-name {
  font-size: 13px;
  font-weight: 500;
  color: #e2e8f0;
  margin-bottom: 4px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  max-width: 100%;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.battle-score {
  font-size: 22px;
  font-weight: 800;
  margin: 2px 0 6px 0;
  font-family: monospace;
}

.player-left .battle-score {
  color: #38bdf8;
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
}

.player-right .battle-score {
  color: #f472b6;
  text-shadow: 0 0 10px rgba(244, 114, 182, 0.6);
}

.battle-vs-mark {
  font-size: 26px;
  font-weight: 900;
  color: #ffffff;
  font-style: italic;
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.8), 0 0 3px #000;
  z-index: 5;
  user-select: none;
}

.btn-support {
  border: none;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 11px;
  font-weight: bold;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.btn-support-left {
  background: linear-gradient(90deg, #2563eb, #1d4ed8);
}
.btn-support-left:hover {
  background: linear-gradient(90deg, #1d4ed8, #1e40af);
  transform: translateY(-1px);
}
.btn-support-left:active {
  transform: scale(0.95);
}

.btn-support-right {
  background: linear-gradient(90deg, #db2777, #be185d);
}
.btn-support-right:hover {
  background: linear-gradient(90deg, #be185d, #9d174d);
  transform: translateY(-1px);
}
.btn-support-right:active {
  transform: scale(0.95);
}

/* Progress Slider */
.battle-progress-wrapper {
  margin: 14px 0;
  width: 100%;
}

.battle-progress {
  height: 12px;
  background: linear-gradient(90deg, #ec4899, #8b5cf6); /* Player 2 color */
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.battle-progress-p1 {
  height: 100%;
  background: linear-gradient(90deg, #06b6d4, #3b82f6); /* Player 1 color */
  width: 50%;
  border-right: 2px solid #ffffff;
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.8);
}

/* Won Rounds Indicators (Tick / Dots) */
.battle-won-rounds {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.round-won-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background-color: transparent;
}

.player-left .round-won-dot.won {
  background-color: #38bdf8;
  box-shadow: 0 0 8px #38bdf8;
  border-color: #38bdf8;
}

.player-right .round-won-dot.won {
  background-color: #f472b6;
  box-shadow: 0 0 8px #f472b6;
  border-color: #f472b6;
}

/* Support Actions Footer */
.battle-support-actions {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 10px;
}

.bt-gift-btn {
  background: linear-gradient(135deg, #eab308, #ca8a04);
  color: #1e1b4b;
  border: none;
  font-weight: 700;
  font-size: 11px;
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 0 10px rgba(234, 179, 8, 0.3);
}

.bt-gift-btn:hover {
  background: linear-gradient(135deg, #facc15, #eab308);
  transform: translateY(-1px);
}

.bt-cancel-btn {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
  font-size: 10px;
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.bt-cancel-btn:hover {
  background: rgba(239, 68, 68, 0.35);
}

.battle-status-msg {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 500;
}

/* Flying Gift Animation Overlay styles */
.battle-flying-gift {
  position: absolute;
  z-index: 9999;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: inherit;
  font-weight: bold;
  animation: gift-fly-up 1.6s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.gift-fly-icon {
  font-size: 38px;
  filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.8));
  animation: scale-bounce 0.4s ease alternate infinite;
}

.gift-fly-label {
  background: rgba(15, 23, 42, 0.85);
  color: #ffffff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  margin-top: 4px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  white-space: nowrap;
}

@keyframes gift-fly-up {
  0% { transform: translate(0, 150px) scale(0.4); opacity: 0; }
  15% { transform: translate(0, 30px) scale(1.2); opacity: 1; }
  25% { transform: translate(0, 0) scale(1); opacity: 1; }
  75% { transform: translate(0, -50px) scale(1); opacity: 1; }
  100% { transform: translate(0, -120px) scale(0.6); opacity: 0; }
}

@keyframes scale-bounce {
  0% { transform: scale(1); }
  100% { transform: scale(1.15); }
}

/* Tap Effect anim */
.battle-tap-ripple {
  position: absolute;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  pointer-events: none;
  animation: tap-fade-out 0.6s ease-out forwards;
  z-index: 1000;
}

@keyframes tap-fade-out {
  0% { transform: scale(0.2); opacity: 1; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* Battle gift picker modal customized CSS */
#battle-gift-picker-modal .modal-content {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f8fafc;
}

#battle-gift-picker-modal .modal-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#battle-gift-picker-modal .modal-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.battle-gift-selection-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.battle-gift-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.battle-gift-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: #3b82f6;
  transform: translateY(-2px);
}

.battle-gift-card.selected {
  background: rgba(59, 130, 246, 0.15);
  border-color: #3b82f6;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

.battle-gift-icon-view {
  font-size: 32px;
  margin-bottom: 6px;
  display: block;
}

.battle-gift-name-view {
  font-size: 11px;
  font-weight: 700;
  color: #cbd5e1;
  display: block;
}

.battle-gift-price-view {
  font-size: 9px;
  font-weight: 500;
  color: #eab308;
  display: block;
}

/* Styled final result box CSS rules */
.bt-final-result-box {
  direction: rtl;
  text-align: center;
  padding: 8px 4px;
}

.bt-final-winner {
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 14px;
  color: #fff;
  box-shadow: 0 8px 20px rgba(0,0,0,0.18);
}

.bt-final-winner.blue {
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
}

.bt-final-winner.pink {
  background: linear-gradient(135deg, #ec4899, #7c3aed);
}

.bt-final-cup {
  font-size: 34px;
  line-height: 1;
  margin-bottom: 4px;
}

.bt-final-winner-label {
  font-size: 13px;
  opacity: 0.9;
  margin-bottom: 4px;
}

.bt-final-winner-name {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.5;
}

.bt-final-draw {
  background: linear-gradient(135deg, #64748b, #334155);
  color: #fff;
  border-radius: 14px;
  padding: 16px;
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 14px;
}

.bt-final-reason {
  background: #f1f5f9;
  color: #334155;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  margin-bottom: 12px;
}

.bt-final-score-title {
  font-size: 14px;
  font-weight: 700;
  color: #475569;
  margin: 8px 0 10px;
}

.bt-final-score-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 8px;
}

.bt-final-player-card {
  border-radius: 12px;
  padding: 10px 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.bt-final-player-card.blue {
  border-top: 4px solid #0ea5e9;
}

.bt-final-player-card.pink {
  border-top: 4px solid #ec4899;
}

.bt-final-player-name {
  font-size: 13px;
  font-weight: 700;
  color: #111827;
  min-height: 24px;
  line-height: 1.4;
  word-break: break-word;
}

.bt-final-player-name * {
  display: inline-block;
  vertical-align: middle;
}

.bt-final-player-score {
  font-size: 28px;
  font-weight: 900;
  color: #111827;
  margin-top: 6px;
}

.bt-final-player-rounds {
  font-size: 12px;
  color: #64748b;
  margin-top: 4px;
}

.bt-final-vs {
  align-self: center;
  font-weight: 900;
  color: #94a3b8;
  padding: 0 2px;
}

@media (max-width: 480px) {
  .bt-final-score-row {
    grid-template-columns: 1fr;
  }

  .bt-final-vs {
    padding: 4px 0;
  }
}

/* TikTok-style Battle Challenge Enhancements */
.bt-gift-feed {
  position: absolute;
  left: 14px;
  bottom: 58px;
  width: 260px;
  max-width: 85%;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.bt-gift-feed-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 999px;
  padding: 5px 10px 5px 5px;
  color: #fff;
  box-shadow: 0 8px 22px rgba(0,0,0,0.22);
  animation: btGiftSlideIn .35s ease both;
  backdrop-filter: blur(8px);
}

.bt-gift-feed-item.fade-out {
  animation: btGiftFadeOut .55s ease both;
}

.bt-gift-feed-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.bt-gift-feed-body {
  min-width: 0;
  flex: 1;
  line-height: 1.2;
}

.bt-gift-feed-name {
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bt-gift-feed-text {
  font-size: 11px;
  color: #cbd5e1;
}

.bt-gift-feed-gift {
  color: #fde68a;
  font-weight: 800;
}

.bt-gift-feed-qty {
  font-size: 18px;
  font-weight: 900;
  color: #facc15;
  text-shadow: 0 0 8px rgba(250,204,21,0.5);
}

@keyframes btGiftSlideIn {
  from { transform: translateX(-40px) scale(.95); opacity: 0; }
  to { transform: translateX(0) scale(1); opacity: 1; }
}

@keyframes btGiftFadeOut {
  to { transform: translateX(-30px) scale(.95); opacity: 0; }
}

.bt-top-supporters {
  position: absolute;
  right: 14px;
  bottom: 58px;
  width: 230px;
  max-width: 85%;
  z-index: 10;
  pointer-events: none;
}

.bt-top-title {
  color: #facc15;
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 5px;
  text-shadow: 0 0 8px rgba(250,204,21,0.45);
}

.bt-top-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.bt-top-item {
  display: grid;
  grid-template-columns: 22px 30px 1fr auto;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  padding: 5px 7px;
  color: #fff;
  backdrop-filter: blur(8px);
}

.bt-top-rank {
  font-size: 12px;
  font-weight: 900;
  color: #facc15;
}

.bt-top-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.bt-top-name {
  font-size: 11px;
  font-weight: 800;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.bt-top-score {
  font-size: 12px;
  font-weight: 900;
  color: #38bdf8;
}

@media (max-width: 600px) {
  .bt-gift-feed,
  .bt-top-supporters {
    position: static;
    width: 100%;
    max-width: 100%;
    margin-top: 6px;
  }

  .bt-top-supporters {
    padding: 0 10px 8px;
  }

  .bt-gift-feed {
    padding: 0 10px;
  }
}

.bt-tap-avatar-bubble {
  position: absolute;
  width: 38px;
  height: 38px;
  z-index: 50;
  pointer-events: none;
  animation: btTapAvatarFloat 1.45s ease-out forwards;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.35));
}

.bt-tap-avatar-img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.95);
  background: #fff;
}

.bt-tap-avatar-bubble::after {
  content: '+1';
  position: absolute;
  right: -8px;
  top: -8px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #facc15;
  color: #111827;
  font-size: 11px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.8);
}

@keyframes btTapAvatarFloat {
  0% {
    transform: translate(0, 0) scale(0.75);
    opacity: 0;
  }

  15% {
    transform: translate(0, -12px) scale(1);
    opacity: 1;
  }

  70% {
    opacity: 1;
  }

  100% {
    transform: translate(var(--bt-tap-random-x, 0px), -120px) scale(1.15);
    opacity: 0;
  }
}

@media (max-width: 600px) {
  .bt-tap-avatar-bubble {
    width: 34px;
    height: 34px;
  }

  .bt-tap-avatar-img {
    width: 34px;
    height: 34px;
  }
}
