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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

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

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

.toplike-panel {
  position: fixed;
  top: 24px;
  left: 24px;
  width: min(320px, calc(100vw - 48px));
  padding: 14px 16px 12px;
  background: linear-gradient(
    145deg,
    rgba(212, 175, 55, 0.18) 0%,
    rgba(20, 16, 8, 0.82) 55%,
    rgba(12, 10, 6, 0.88) 100%
  );
  border: 1px solid rgba(212, 175, 55, 0.38);
  border-radius: 16px;
  backdrop-filter: blur(12px);
  box-shadow:
    0 12px 36px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(212, 175, 55, 0.12),
    inset 0 1px 0 rgba(255, 248, 220, 0.06);
  opacity: 0;
  transform: translateX(-32px);
  transition:
    opacity 0.55s ease,
    transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

body.obs-mode .toplike-panel {
  background: linear-gradient(
    145deg,
    rgba(212, 175, 55, 0.12) 0%,
    rgba(20, 16, 8, 0.55) 55%,
    rgba(12, 10, 6, 0.62) 100%
  );
}

.toplike-panel.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.toplike-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.25);
}

.crown {
  font-size: 1.25rem;
  line-height: 1;
  filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.6));
  animation: crownFloat 2.5s ease-in-out infinite;
}

.toplike-title {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #f0d878;
  text-shadow: 0 0 16px rgba(212, 175, 55, 0.4);
}

.toplike-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toplike-item {
  display: grid;
  grid-template-columns: 28px 36px 1fr auto;
  align-items: center;
  gap: 8px 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  opacity: 0;
  transform: translateX(-16px);
  transition:
    opacity 0.45s ease,
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}

.toplike-item.is-in {
  opacity: 1;
  transform: translateX(0);
}

.toplike-item.is-updated {
  animation: itemPulse 0.65s ease;
}

.toplike-item.rank-1 {
  background: linear-gradient(
    90deg,
    rgba(212, 175, 55, 0.22) 0%,
    rgba(212, 175, 55, 0.06) 100%
  );
  border-color: rgba(212, 175, 55, 0.35);
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.12);
}

.rank-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-size: 0.8rem;
  font-weight: 900;
  color: #1a1408;
  background: linear-gradient(160deg, #f5e6a8 0%, #d4af37 100%);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.toplike-item.rank-1 .rank-badge {
  background: linear-gradient(160deg, #fff4c4 0%, #e8c547 50%, #d4af37 100%);
  box-shadow: 0 0 14px rgba(212, 175, 55, 0.55);
}

.toplike-item.rank-2 .rank-badge {
  background: linear-gradient(160deg, #e8e8e8 0%, #a8a8a8 100%);
}

.toplike-item.rank-3 .rank-badge {
  background: linear-gradient(160deg, #e8c4a0 0%, #b8860b 100%);
}

.user-avatar {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 0 0 2px rgba(212, 175, 55, 0.35),
    0 2px 8px rgba(0, 0, 0, 0.35);
}

.toplike-item.rank-1 .user-avatar {
  box-shadow:
    0 0 0 2px rgba(240, 216, 120, 0.65),
    0 0 12px rgba(212, 175, 55, 0.4);
}

.avatar-fallback {
  font-size: 0.75rem;
  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%;
}

.user-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff8e7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
  min-width: 0;
}

.like-count {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 800;
  color: #f0d878;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 12px rgba(212, 175, 55, 0.35);
}

.like-count::before {
  content: '♥';
  font-size: 0.7rem;
  color: #ff6b8a;
  filter: drop-shadow(0 0 4px rgba(255, 107, 138, 0.6));
}

.toplike-empty {
  padding: 12px 8px;
  font-size: 0.8rem;
  color: rgba(255, 248, 231, 0.55);
  text-align: center;
}

@keyframes crownFloat {
  0%,
  100% {
    transform: translateY(0) rotate(-4deg);
  }
  50% {
    transform: translateY(-3px) rotate(4deg);
  }
}

@keyframes itemPulse {
  0% {
    transform: scale(1);
  }
  35% {
    transform: scale(1.03);
    box-shadow: 0 0 24px rgba(212, 175, 55, 0.35);
  }
  100% {
    transform: scale(1);
  }
}
