/* ============================================
   DUEL EMOTES — Inline one-tap emote bar
   Used by: Coinflip, Slice 'n' Dice, Knights Arena
   ============================================ */

/* ── Inline bar — centered at bottom of overlay card ── */
.de-bar {
  position: relative;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 5px 8px;
  margin: 8px auto 0;
  width: fit-content;
  max-width: 95%;
  background: rgba(8, 12, 22, 0.8);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  user-select: none;
  transition: opacity 0.2s ease;
}

.de-bar--disabled {
  opacity: 0.25;
  pointer-events: none;
  filter: grayscale(0.5);
}

.de-bar--cd {
  opacity: 0.55;
}

/* ── Emoji buttons ── */
.de-emoji-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
}

.de-emoji-btn:hover:not(:disabled) {
  background: rgba(168, 85, 247, 0.18);
  border-color: rgba(168, 85, 247, 0.3);
  transform: scale(1.2);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.12);
}

.de-emoji-btn:active:not(:disabled) {
  transform: scale(0.88);
}

.de-emoji-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ── Separator ── */
.de-sep {
  display: block;
  width: 1px;
  height: 20px;
  margin: 0 3px;
  background: rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

/* ── Taunt buttons ── */
.de-taunt-btn {
  display: flex;
  align-items: center;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--tc, #fff);
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
  letter-spacing: 0.02em;
}

.de-taunt-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.07);
  border-color: color-mix(in srgb, var(--tc, #a855f7) 40%, transparent);
  text-shadow: 0 0 10px color-mix(in srgb, var(--tc, #a855f7) 50%, transparent);
  transform: translateY(-1px);
}

.de-taunt-btn:active:not(:disabled) {
  transform: translateY(0) scale(0.95);
}

.de-taunt-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ── Flying emote container ── */
.de-flying-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 45;
}

/* ── Flying emote/taunt ── */
.de-flying {
  position: absolute;
  top: 20%;
  animation: deFlyUp var(--fly-duration, 2500ms) cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
  will-change: transform, opacity;
  contain: layout style;
  transform: translateZ(0);
}

.de-flying--left {
  left: 15%;
}

.de-flying--right {
  right: 15%;
}

.de-flying--emote .de-flying-emoji {
  font-size: 36px;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
  display: block;
  line-height: 1;
}

.de-flying--taunt {
  max-width: 200px;
}

.de-flying-text {
  display: inline-block;
  padding: 8px 14px;
  background: rgba(8, 12, 22, 0.88);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px 14px 4px 14px;
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  text-shadow: 0 0 12px currentColor;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.3),
    0 0 12px color-mix(in srgb, var(--fly-color, #a855f7) 15%, transparent);
}

.de-flying--right .de-flying-text {
  border-radius: 14px 14px 14px 4px;
}

@keyframes deFlyUp {
  0% {
    transform: translateX(var(--fly-x, 0px)) translateY(0) scale(0.5);
    opacity: 0;
  }
  8% {
    opacity: 1;
    transform: translateX(var(--fly-x, 0px)) translateY(-8px) scale(1.15);
  }
  15% {
    transform: translateX(var(--fly-x, 0px)) translateY(-20px) scale(1);
  }
  70% {
    opacity: 0.9;
    transform: translateX(calc(var(--fly-x, 0px) * 1.5)) translateY(-100px) scale(1.05);
  }
  100% {
    opacity: 0;
    transform: translateX(calc(var(--fly-x, 0px) * 2)) translateY(-160px) scale(0.7);
  }
}

/* ── Rave mode enhancements ── */
body.coinrush-radio-playing.coinrush-rave-on .de-bar {
  border-color: rgba(168, 85, 247, 0.2);
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.06);
}

body.coinrush-radio-playing.coinrush-rave-on .de-flying--emote .de-flying-emoji {
  filter:
    drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4))
    drop-shadow(0 0 12px hsla(var(--vibe-h, 165), 100%, 60%, 0.4));
}

body.coinrush-radio-playing.coinrush-rave-on .de-flying-text {
  border-color: rgba(168, 85, 247, 0.3);
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.4),
    0 0 16px rgba(168, 85, 247, 0.15),
    0 0 24px hsla(var(--vibe-h, 165), 80%, 55%, 0.08);
}

/* ── Mobile responsive ── */
@media (max-width: 720px) {
  .de-bar {
    gap: 2px;
    padding: 4px 5px;
    border-radius: 11px;
  }

  .de-emoji-btn {
    width: 26px;
    height: 26px;
    font-size: 14px;
    border-radius: 7px;
  }

  .de-taunt-btn {
    padding: 4px 7px;
    font-size: 9px;
    border-radius: 7px;
  }

  .de-sep { height: 16px; margin: 0 2px; }

  .de-flying--emote .de-flying-emoji { font-size: 28px; }
  .de-flying-text { font-size: 11px; padding: 6px 10px; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .de-flying {
    animation: none !important;
    display: none !important;
  }
}

/* ── Play Again button (shared across all games) ── */
.de-playagain-wrap {
  display: flex;
  justify-content: center;
  padding: 8px 16px 4px;
}

.de-playagain-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: linear-gradient(135deg, rgba(79, 255, 176, 0.12), rgba(168, 85, 247, 0.12));
  border: 1px solid rgba(79, 255, 176, 0.25);
  border-radius: 12px;
  color: #4fffb0;
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.de-playagain-btn:hover {
  background: linear-gradient(135deg, rgba(79, 255, 176, 0.2), rgba(168, 85, 247, 0.2));
  border-color: rgba(79, 255, 176, 0.4);
  box-shadow: 0 0 18px rgba(79, 255, 176, 0.12);
  transform: translateY(-1px);
}

.de-playagain-btn:active {
  transform: translateY(0) scale(0.97);
}

.de-playagain-btn svg {
  flex-shrink: 0;
}

/* Coinflip specific — Play Again in footer row */
.battle-popup__btn--playagain {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: linear-gradient(135deg, rgba(79, 255, 176, 0.12), rgba(168, 85, 247, 0.12));
  border: 1px solid rgba(79, 255, 176, 0.25);
  border-radius: 10px;
  color: #4fffb0;
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.battle-popup__btn--playagain:hover {
  background: linear-gradient(135deg, rgba(79, 255, 176, 0.2), rgba(168, 85, 247, 0.2));
  border-color: rgba(79, 255, 176, 0.4);
  box-shadow: 0 0 16px rgba(79, 255, 176, 0.1);
  transform: translateY(-1px);
}

.battle-popup__btn--playagain:active {
  transform: translateY(0) scale(0.97);
}

.battle-popup__btn--playagain svg {
  flex-shrink: 0;
}

@media (max-width: 720px) {
  .de-playagain-btn {
    padding: 6px 14px;
    font-size: 11px;
    border-radius: 10px;
  }
  
  .battle-popup__btn--playagain {
    padding: 6px 12px;
    font-size: 10px;
  }
}

/* ── Rematch state styles ── */
.de-rematch-badge {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(79, 255, 176, 0.1);
  border: 1px solid rgba(79, 255, 176, 0.25);
  border-radius: 20px;
  color: #4fffb0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  animation: de-rematch-pulse 1.5s ease infinite;
  white-space: nowrap;
}

@keyframes de-rematch-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(79, 255, 176, 0.15); }
  50% { box-shadow: 0 0 12px 4px rgba(79, 255, 176, 0.2); }
}

.de-rematch--waiting {
  opacity: 0.65;
  cursor: not-allowed;
  animation: de-rematch-dots 1.5s ease infinite;
}

@keyframes de-rematch-dots {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 0.35; }
}

.de-rematch--accept {
  background: linear-gradient(135deg, rgba(79, 255, 176, 0.25), rgba(168, 85, 247, 0.25)) !important;
  border-color: #4fffb0 !important;
  color: #4fffb0 !important;
  animation: de-rematch-glow 1s ease infinite;
}

@keyframes de-rematch-glow {
  0%, 100% { box-shadow: 0 0 8px rgba(79, 255, 176, 0.2); }
  50% { box-shadow: 0 0 20px rgba(79, 255, 176, 0.4); }
}

.de-rematch--loading {
  opacity: 0.5;
  cursor: wait;
  pointer-events: none;
}

/* ============================
   SPEECH BUBBLE — "Let's Play Again!"
   ============================ */
.de-rematch-bubble {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-top: 6px;
  z-index: 20;
  animation: de-bubble-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
             de-bubble-float 2.5s ease-in-out 0.4s infinite;
  pointer-events: none;
  filter: drop-shadow(0 0 12px rgba(79, 255, 176, 0.35));
}

.de-rematch-bubble__text {
  display: inline-block;
  background: linear-gradient(135deg, rgba(79, 255, 176, 0.15), rgba(168, 85, 247, 0.15));
  border: 1.5px solid rgba(79, 255, 176, 0.5);
  border-radius: 16px;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #4fffb0;
  white-space: nowrap;
  text-shadow: 0 0 8px rgba(79, 255, 176, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.de-rematch-bubble__tail {
  display: none; /* tail not needed with inline layout */
}

@keyframes de-bubble-pop {
  0%   { opacity: 0; transform: scale(0.3) translateY(8px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes de-bubble-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}
