.scrollable-container {
  position: relative;
}

.best-line-grid-wrap {
  position: relative;
  overflow: visible;
}

.best-line-grid-wrap::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -100px;
  bottom: -100px;
  background-image: url("/static/images/ui/Best_line_background_img.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  z-index: 0;
}

.best-line-grid-wrap > * {
  position: relative;
  z-index: 1;
}

.scroll-button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.658);
  border: none;
  color: #000000;
  font-size: 32px;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 100;

  display: flex;              /* flexbox 사용 */
  align-items: end;        /* 수직 중앙 정렬 */
  justify-content: center;    /* 수평 중앙 정렬 */
  transition: background 0.2s;
}

.scroll-button:hover {
  background: rgba(255, 255, 255, 0.8);
}

.scroll-button.left {
  left: 5px;
}

.scroll-button.right {
  right: 5px;
}

/* 캐릭터 목록 (가로 스크롤) */
.ori-character-grid {
    display: flex;
    height: 320px;
    overflow-x: auto;  /* 수평 스크롤 가능 */
    gap: 25px;         /* 카드 간 간격 */
    padding: 10px;
    padding-left: calc(50% - 70px);
    padding-right: calc(50% - 70px);
    /* padding-left: 0px; */
    -webkit-overflow-scrolling: touch; /* 모바일에서 부드러운 스크롤 */
    /* cursor: grab;      마우스로 드래그 가능 */
    white-space: nowrap;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* Internet Explorer 10+ */
    margin: 10px 0px 10px;
}
.ori-character-grid::-webkit-scrollbar {
    display: none; /* WebKit browsers */
  }
  
  /* 드래그 중일 때 커서 변경 */
  /* .character-grid.active {
    cursor: grabbing;
  } */
  
  /* 캐릭터 카드 */
  .ori-character-card {
    flex: 0 0 auto;   /* 크기 고정 */
    width: 200px;     /* 카드 가로 크기 (원하는 크기로 조정) */
    height: 248px;    /* 카드 세로 크기 (원하는 크기로 조정) */
    /* background: #242424; */
    /* border: 1px solid #ffffff2a; */
    /* border-radius: 5%; */
    text-align: center;
    padding: 0;
    box-sizing: border-box;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    overflow: hidden;
  }

  .ori-character-card .card-link {
    z-index: 1;
  }

  .ori-character-card.is-center {
    transform: scale(1.05);
    z-index: 2;
  }
  
  /* 캐릭터 프로필 이미지 */
  .ori-character-card > img {
    width: 100%;       /* 이미지 크기 (카드 크기의 80%) */
    height: 248px;     /* 이미지 높이 (카드 높이와 동일) */
    object-fit: cover;
    /* border-radius: 5%; */
    margin-bottom: 0;
  }

  .ori-character-card::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 65%;
    background: linear-gradient(to top, rgba(178, 74, 71, 1), rgba(178, 74, 71, 0));
    pointer-events: none;
    border-radius: inherit;
  }
  
  /* 캐릭터 이름 */
  .ori-character-card h3 {
    margin: 0;
    padding-bottom: 5px;
    padding-top: 0;
    font-size: 1.3em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: absolute;
    left: 50%;
    bottom: 15%;
    transform: translateX(-50%);
    width: 90%;
    z-index: 1;
  }

  /* 캐릭터 설명 */
  .ori-character-card h4 {
    margin: 0;
    font-size: 0.8em;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* 라인 수 */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal; /* 줄바꿈 허용 */
    line-height: 1.3; /* 줄 간격 조절 (필요에 따라 조정 가능) */
    max-height: 2.6em; /* line-height * 2로 설정하여 2줄까지만 표시 */
    position: absolute;
    left: 50%;
    top: 64%;
    transform: translateX(-50%);
    width: 90%;
    z-index: 1;
  }

  .ori-character-card h5 {
    display: inline-block;
    
    padding: 2px 0px;
    border-radius: 2px;
    overflow: hidden;
    white-space: nowrap;
    margin: 0 2px;
    /* background: #ffffff23; */
    color: #ffffff;
    max-width: 100px; 
  }

  .ori-character-card .tags {
    position: absolute;
    left: 50%;
    bottom: 8%;
    transform: translateX(-50%);
    width: 90%;
    justify-content: center;
    z-index: 1;
  }

  .ori-character-card .like {
    top: 7px;
    right: 7px;
    bottom: auto;
    z-index: 3;
  }

  .ori-character-card .like img {
    width: 20px;
  }

/* ======================================================================================== 베스트 키워드 그리드 */
/* 캐릭터 목록 (가로 스크롤) */
.best-character-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: 1fr; /* 1행 */
  gap: 10px;
  height: 250px; /* 카드 한 줄 높이 */
  overflow-x: auto;
  padding: 20px;
  padding-left: 20px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  margin: 10px 0;
  align-content: stretch;
  margin-top: -20px;
}
.best-character-grid::-webkit-scrollbar {
  display: none;
}

.best-character-card {
  position: relative;
  width: 140px;
  height: 170px;
  box-sizing: border-box;
}

/* 카드 전체를 클릭 가능하게 만드는 오버레이 링크 */
.card-link {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
}

  .best-character-card .card-link {
    z-index: 1;
  }

  .best-character-card .like {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 3;
  }

  .best-character-card .like img {
    width: 20px;
    height: auto;
  }


  /* 캐릭터 프로필 이미지 */
  .best-character-card > img {
    width: 100%;       /* 이미지 크기 (카드 크기의 80%) */
    height: 170px;     /* 이미지 높이 (카드 높이와 동일) */
    object-fit: cover;
    /* border-radius: 5%; */
    margin-bottom: 5px;
  }
  
  /* 캐릭터 이름 */
  .best-character-card h3 {
    margin: 0;
    padding-bottom: 5px;
    padding-top: -5px;
    font-size: 1.1em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* 캐릭터 설명 */
  .best-character-card h4 {
    margin: 0;
    font-size: 0.8em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
    max-height: 1.3em;
    color: #cfcfcf;
  }

  .best-character-card h5 {
    display: inline-block;
    
    padding: 2px 0px;
    border-radius: 2px;
    overflow: hidden;
    white-space: nowrap;
    margin: 0 2px;
    /* background: #ffffff23; */
    color: #ffffff;
    max-width: 100px; 
  }


/* ============================================================================= 베스트 키워드 그리드 */
/* 캐릭터 목록 (가로 스크롤) */

.best-line-grid {
  display: flex;
  height: 430px;
  overflow-x: auto;  /* 수평 스크롤 가능 */
  gap: 10px;         /* 카드 간 간격 */
  padding: 10px;
  padding-left: 20px;
  -webkit-overflow-scrolling: touch; /* 모바일에서 부드러운 스크롤 */
  /* cursor: grab;      마우스로 드래그 가능 */
  white-space: nowrap;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* Internet Explorer 10+ */
  margin: 10px 0;
}
.best-line-card {
  position: relative;
  width: 250px;
  height: 407px;
  background: linear-gradient(to bottom, rgba(242, 205, 199, 1), rgba(242, 205, 199, 0.6));
  /* border-radius: 16px; */
  padding: 16px;
  box-sizing: border-box;
  color: #000;
  display: flex;
  flex-direction: column;
  /* gap: 12px; */
  font-size: 14px;
  flex-shrink: 0; 
}

.best-line-link {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
}

.best-line-card > *:not(.best-line-link) {
  position: relative;
  z-index: 1;
}

.best-line-header {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.best-line-header .best-line-profile-image {
  width: 30px !important;
  height: 30px !important;
  min-width: 30px !important;
  min-height: 30px !important;
  max-width: 30px !important;
  max-height: 30px !important;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
}

.character-name {
  font-weight: bold;
  font-size: 15px;
}

.external-icon {
  position: absolute;
  right: 0;
  width: 16px;
  height: 16px;
}

.best-line-text {
  font-size: 13px;
  line-height: 1.6;
  white-space: normal;
  text-align: left; 
  padding-top: 10px;
}


/* ======================================================================================== 베스트 키워드 그리드 */
/* 캐릭터 목록 (가로 스크롤) */
.new-character-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(2, auto); /* 2행 */
  gap: 20px;
  height: 500px; /* 카드 두 개 높이 + 간격 */
  overflow-x: auto;
  padding: 20px;
  padding-left: 20px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  margin: 10px 0;
  align-content: stretch;
  margin-top: 20px;
}
.new-character-grid::-webkit-scrollbar {
  display: none;
}

.new-character-card {
  position: relative;
  width: 139px;
  height: 167px;
  box-sizing: border-box;
}

.new-character-card .card-link {
  z-index: 1;
}

.new-character-card .like {
  position: absolute;
  top: 8px;
  right: 8px;
  bottom: auto;
  z-index: 3;
}

.new-character-card .like img {
  width: 20px;
  height: auto;
}

/* 카드 전체를 클릭 가능하게 만드는 오버레이 링크 */
.card-link {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
}


  /* 캐릭터 프로필 이미지 */
  .new-character-card > img {
    width: 100%;       /* 이미지 크기 (카드 크기의 80%) */
    height: 167px;     /* 이미지 높이 (카드 높이와 동일) */
    object-fit: cover;
    /* border-radius: 5%; */
    margin-bottom: 5px;
  }
  
  /* 캐릭터 이름 */
  .new-character-card h3 {
    margin: 0;
    padding-bottom: 5px;
    padding-top: -5px;
    font-size: 1.1em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* 캐릭터 설명 */
  .new-character-card h4 {
    margin: 0;
    font-size: 0.8em;
    display: -webkit-box;
    -webkit-line-clamp: 1; /* 라인 수 */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal; /* 줄바꿈 허용 */
    line-height: 1.3; /* 줄 간격 조절 (필요에 따라 조정 가능) */
    max-height: 2.6em; /* line-height * 2로 설정하여 2줄까지만 표시 */
    color: #cfcfcf;
  }

  .new-character-card h5 {
    display: inline-block;
    
    padding: 2px 0px;
    border-radius: 2px;
    overflow: hidden;
    white-space: nowrap;
    margin: 0 2px;
    /* background: #ffffff23; */
    color: #ffffff;
    max-width: 100px; 
  }

/* 랭킹 카드 그리드 */
.ranking-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  padding: 20px;
  padding-top: 40px;
}

.ranking-card {
  position: relative;
  width: 100%;
  aspect-ratio: 139 / 167;
  box-sizing: border-box;
  overflow: visible;
}

.ranking-rank {
  position: absolute;
  top: -8px;
  left: -8px;
  width: 30px;
  height: 30px;
  background: linear-gradient(to bottom, #B24A47 24%, #b24b4775 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4;
}

.ranking-rank-text {
  font-size: 20px;
  color: #ffffff;
  font-weight: bold;
  line-height: 1;
}

.ranking-card .card-link {
  z-index: 1;
}

.ranking-card .like {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
}

.ranking-card .like img {
  width: 20px;
  height: auto;
}

.ranking-card > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  margin-bottom: 6px;
}

.ranking-card h3 {
  margin: 0;
  padding-bottom: 5px;
  padding-top: -5px;
  font-size: 1.1em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ranking-card h4 {
  margin: 0;
  font-size: 0.8em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  line-height: 1.3;
  max-height: 2.6em;
  color: #cfcfcf;
}
