*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
}

body {
  background: transparent;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

body.preview-mode {
  background: radial-gradient(ellipse 80% 60% at 85% 70%, #1a1408 0%, #0c0a06 100%);
}

.comment-waiting {
  position: fixed;
  right: 20px;
  bottom: 24px;
  padding: 12px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255, 248, 231, 0.7);
  background: rgba(18, 14, 8, 0.75);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 12px;
}

.comment-waiting.is-hidden {
  display: none;
}

.comment-spotlight {
  position: fixed;
  right: 20px;
  bottom: 24px;
  width: min(400px, calc(100vw - 40px));
}

.comment-card {
  position: relative;
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 12px 14px;
  align-items: start;
  padding: 14px 16px;
  background: linear-gradient(
    135deg,
    rgba(212, 175, 55, 0.16) 0%,
    rgba(18, 14, 8, 0.82) 50%,
    rgba(10, 8, 5, 0.88) 100%
  );
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 16px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.45),
    0 0 24px rgba(212, 175, 55, 0.12);
  opacity: 0;
  transform: translateY(14px) scale(0.97);
  transition:
    opacity 0.4s ease,
    transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.35s ease;
  overflow: visible;
}

body.obs-mode .comment-card {
  background: linear-gradient(
    135deg,
    rgba(212, 175, 55, 0.12) 0%,
    rgba(18, 14, 8, 0.76) 50%,
    rgba(10, 8, 5, 0.82) 100%
  );
}

body.preview-mode .comment-card {
  backdrop-filter: blur(10px);
}

.comment-card.is-in {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.comment-card.is-out {
  opacity: 0;
  transform: translateY(-10px) scale(0.98);
}

.comment-card.is-electric.is-in {
  animation: cardElectricGlow 2.4s ease-in-out infinite;
}

.comment-card.is-gift.is-in {
  border-color: rgba(255, 200, 120, 0.55);
  animation: cardElectricGlow 1.8s ease-in-out infinite, giftPulse 2s ease-in-out infinite;
}

/* Percikan listrik */
.electric-sparks {
  position: absolute;
  inset: -28px;
  z-index: 0;
  pointer-events: none;
}

.spark {
  position: absolute;
  width: 2px;
  height: 26px;
  background: linear-gradient(to bottom, transparent, #fffef0 40%, #f0d878 60%, transparent);
  border-radius: 2px;
  opacity: 0;
  filter: drop-shadow(0 0 8px #f0d878);
  transform-origin: center bottom;
}

.comment-card.is-in .spark {
  animation: sparkFlicker 0.38s ease-out infinite;
}

.spark--1 {
  left: 6%;
  top: 18%;
  transform: rotate(-22deg);
}

.spark--2 {
  right: 8%;
  top: 12%;
  transform: rotate(18deg);
  animation-delay: 0.1s;
}

.spark--3 {
  left: 20%;
  bottom: 14%;
  height: 20px;
  transform: rotate(-6deg);
  animation-delay: 0.2s;
}

.spark--4 {
  right: 16%;
  bottom: 18%;
  height: 22px;
  transform: rotate(10deg);
  animation-delay: 0.06s;
}

.avatar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow:
    0 0 0 2px rgba(212, 175, 55, 0.45),
    0 4px 14px rgba(0, 0, 0, 0.4);
}

.comment-card.is-electric.is-in .avatar {
  animation: avatarElectric 1.6s ease-in-out infinite;
}

.avatar-fallback {
  font-size: 1rem;
  font-weight: 800;
  color: #1a1408;
}

.avatar-fallback.is-hidden {
  display: none;
}

.avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.comment-body {
  position: relative;
  z-index: 2;
  min-width: 0;
  padding-top: 2px;
}

.comment-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 800;
  color: #f0d878;
  text-shadow: 0 0 14px rgba(212, 175, 55, 0.35);
}

.comment-card.is-electric.is-in .user-name {
  animation: textElectric 2.6s ease-in-out infinite;
}

.platform-badge {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  color: rgba(255, 248, 231, 0.65);
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
}

.comment-text {
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.4;
  color: #fff8e7;
  word-break: break-word;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}

/* Gift showcase */
.gift-showcase {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 12px;
}

.gift-emoji {
  font-size: 2.2rem;
  line-height: 1;
  filter: drop-shadow(0 0 12px rgba(255, 220, 120, 0.6));
  animation: giftEmojiPop 1.2s ease-in-out infinite;
}

.gift-icon {
  width: 40px;
  height: 40px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.5));
}

.gift-label {
  font-size: 1rem;
  font-weight: 800;
  color: #fff8e7;
  text-transform: capitalize;
  text-shadow:
    0 0 16px rgba(212, 175, 55, 0.5),
    0 2px 8px rgba(0, 0, 0, 0.6);
}

.comment-card.is-mod .user-name::after {
  content: ' MOD';
  font-size: 0.62rem;
  color: #6dd5fa;
}

@keyframes sparkFlicker {
  0%,
  100% {
    opacity: 0;
    transform: scaleY(0.35);
  }
  10% {
    opacity: 1;
    transform: scaleY(1);
  }
  22% {
    opacity: 0;
  }
}

@keyframes cardElectricGlow {
  0%,
  100% {
    box-shadow:
      0 8px 32px rgba(0, 0, 0, 0.45),
      0 0 16px rgba(212, 175, 55, 0.15);
    border-color: rgba(212, 175, 55, 0.35);
  }
  48% {
    box-shadow:
      0 8px 32px rgba(0, 0, 0, 0.45),
      0 0 28px rgba(255, 255, 220, 0.35),
      0 0 48px rgba(212, 175, 55, 0.25);
    border-color: rgba(255, 248, 200, 0.55);
  }
  50% {
    box-shadow:
      0 8px 32px rgba(0, 0, 0, 0.45),
      0 0 36px rgba(255, 255, 255, 0.45);
  }
}

@keyframes giftPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
}

@keyframes giftEmojiPop {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.12);
  }
}

@keyframes textElectric {
  0%,
  100% {
    color: #f0d878;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
  }
  50% {
    color: #fffef0;
    text-shadow:
      0 0 20px rgba(255, 255, 255, 0.8),
      0 0 32px rgba(212, 175, 55, 0.6);
  }
}

@keyframes avatarElectric {
  0%,
  100% {
    box-shadow:
      0 0 0 2px rgba(212, 175, 55, 0.45),
      0 4px 14px rgba(0, 0, 0, 0.4);
  }
  50% {
    box-shadow:
      0 0 0 2px rgba(255, 248, 200, 0.75),
      0 0 20px rgba(212, 175, 55, 0.55),
      0 4px 14px rgba(0, 0, 0, 0.4);
  }
}
