.dm-modal{
  position:fixed; inset:0;
  background:rgba(0,0,0,.6);
  display:none;
  justify-content:center;
  align-items:center;
  z-index:9999;
}

.dm-box{
  width:420px;
  height:500px;
  background:#111822;
  border-radius:12px;
  display:flex;
  flex-direction:column;
  overflow:hidden;
}

.dm-header{
  padding:12px;
  background:#1a2432;
  font-weight:700;
  display:flex;
  justify-content:space-between;
}

.dm-close{ cursor:pointer; }

.dm-messages{
  flex:1;
  padding:12px;
  overflow-y:auto;
  font-size:14px;
}

.dm-input-wrap{
  display:flex;
  border-top:1px solid #1e2a3a;
}

#dmInput{
  flex:1;
  resize:none;
  padding:10px;
  background:#0d141d;
  border:none;
  color:#fff;
}

#dmSend{
  width:80px;
  background:#5865F2;
  border:none;
  color:#fff;
}
.dm-badge{
  position:absolute;
  top:8px;
  right:8px;
  background:red;
  color:#fff;
  font-size:11px;
  padding:3px 6px;
  border-radius:10px;
}
.hidden{ display:none; }
.dm-toast{
  position:fixed;
  bottom:20px;
  right:20px;
  background:#1f6feb;
  color:#fff;
  padding:12px 16px;
  border-radius:10px;
  box-shadow:0 10px 25px rgba(0,0,0,.4);
  z-index:99999;
}
.dm-me{ margin:6px 0; padding:6px 10px; border-radius:8px; }
.dm-me.me{ background:#1f6feb; text-align:right; }
.dm-me.other{ background:#2a2f3a; }

.dm-toast{
  position:fixed;
  bottom:20px;
  right:20px;
  background:#1f6feb;
  color:#fff;
  padding:12px 16px;
  border-radius:10px;
  box-shadow:0 10px 25px rgba(0,0,0,.4);
  cursor:pointer;
  z-index:99999;
}
.dm-toast:hover{
  filter:brightness(1.1);
}
/* 전송 버튼 */
.chat-input-wrap {
    position: relative;
    width: 100%;
    background: #2b2f36;
    border-radius: 10px;
    border: 1px solid #1a1c20;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.6);
}

/* 입력창 */
.chat-input-wrap {
    position: relative;      /* 핵심 */
    width: 100%;
    background: #2b2f36;
    border-radius: 10px;
    border: 1px solid #1a1c20;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.6);
}

#msgInput {
    width: 100%;
    background: transparent;
    border: none;
    color: #ddd;
    padding: 12px 48px 12px 14px;
    resize: none;
    height: 46px;
    outline: none;
}

#btnSend {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
}
.dc-input {
    position: relative;   /* ⭐ 이거 필수 — 버튼 기준 부모 */
    width: 100%;
}

/* 입력창 */
#msgInput {
    width: 100%;
    height: 46px;
    background: #111822;
    border: 1px solid #1a1c20;
    border-radius: 10px;
    color: #ddd;
    padding: 12px 50px 12px 14px; /* 오른쪽 버튼 자리 확보 */
    resize: none;
    outline: none;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.6);
}

/* 🚀 버튼 */
#btnSend {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #ff5f5f;
    transition: 0.2s;
}

#btnSend:hover {
    transform: translateY(-50%) scale(1.15);
}

/***************************/
/* =========================================
   채팅 입력창 (로켓 & 글자 짤림 완벽 해결)
   ========================================= */

/* 채팅창 닉네임/아바타 클릭 가능하게 만들기 */
.chat-user-click {
    cursor: pointer; /* 마우스 올리면 손가락(버튼) 모양 */
    transition: opacity 0.2s;
}

.chat-user-click:hover {
    opacity: 0.8;
    text-decoration: underline; /* 닉네임에 마우스 올리면 밑줄 쫙! (디스코드 국룰) */
}

/* =========================================
   DM 모달창 다크 테마 디자인
   ========================================= */
.dm-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7); /* 반투명 배경 */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.dm-box {
    width: 400px;
    background: #36393f;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.dm-header {
    padding: 16px;
    background: #202225;
    color: #fff;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dm-close {
    cursor: pointer;
    color: #b9bbbe;
    font-size: 18px;
}

.dm-close:hover {
    color: #dc3545;
}

.dm-messages {
    height: 300px;
    padding: 16px;
    background: #36393f;
    overflow-y: auto;
}

.dm-input-wrap {
    display: flex;
    padding: 16px;
    background: #2f3136;
    gap: 10px;
}

#dmInput {
    flex: 1;
    background: #40444b;
    border: none;
    border-radius: 4px;
    color: #fff;
    padding: 10px;
    resize: none;
    outline: none;
}

#dmSend {
    background: #5865F2;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 0 16px;
    cursor: pointer;
    font-weight: bold;
}

.dc-input-inner {
    position: relative;
    display: flex;
    align-items: center; /* 버튼과 textarea 수직 정렬 */
}
#msgInput {
    padding-top: 20px;   /* 숫자만 조절해서 위치 맞추면 됨 */
    padding-bottom: 0;
    line-height: normal;
}


/* 반응 버튼 (마우스 올리면 나타남) */
.msg-row .react-btn { opacity: 0; transition: 0.2s; cursor: pointer; margin-left: 8px; font-size: 16px; }
.msg-row:hover .react-btn { opacity: 1; }

/* 반응 태그 (이미 달린 것들) */
.react-tag { 
    display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; 
    background: rgba(0,0,0,0.4); border: 1px solid rgba(255,255,255,0.1); 
    border-radius: 6px; font-size: 11px; margin-right: 4px; cursor: pointer;
}
.react-tag.active { border-color: #5865F2; background: rgba(88,101,242,0.2); }
.react-tag img { width: 16px; height: 16px; }

/* 디스코드 스타일 이모지 피커 */
#discordPicker {
    display: none;
    position: fixed;
    z-index: 9999;

    min-width: 220px;
    max-width: 360px;

    background: rgba(20, 22, 28, 0.98);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;

    box-shadow: 0 20px 60px rgba(0,0,0,0.75);
    backdrop-filter: blur(15px);

    flex-direction: column;
    padding: 8px 0;

    max-height: 320px;      /* 핵심 */
    overflow-y: auto;       /* 스크롤 생성 */
    overflow-x: hidden;
}
#discordPicker::-webkit-scrollbar {
    width: 6px;
}

#discordPicker::-webkit-scrollbar-track {
    background: transparent;
}

#discordPicker::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 10px;
}

#discordPicker::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.25);
}

#emojiGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(32px, 1fr)); /* 반응형 바둑판 */
    gap: 4px;
    padding: 0 8px; /* 스크롤바랑 안 겹치게 여백 */
}
#discordPicker.show {
    display: flex;
}


#discordPicker.show { display: flex; animation: popIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.dp-header { padding: 12px; border-bottom: 1px solid rgba(255,255,255,0.1); font-weight: bold; color: #ddd; }
.dp-grid { flex: 1; overflow-y: auto; padding: 10px; display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.dp-item { cursor: pointer; padding: 5px; border-radius: 5px; display: flex; align-items: center; justify-content: center; transition: 0.1s; }
.dp-item:hover { background: rgba(255,255,255,0.1); transform: scale(1.1); }
.dp-item img { width: 32px; height: 32px; object-fit: contain; }

@keyframes popIn { from{transform:scale(0.8); opacity:0;} to{transform:scale(1); opacity:1;} }

/* 반응형 컨테이너 */
.msg-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px; /* 메시지 본문과 간격 */
}

/* 개별 반응 태그 스타일 */
.react-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 2px 6px;
    font-size: 12px;
    color: #ccc;
    cursor: pointer;
    transition: 0.2s;
}

.react-tag:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #777;
}

/* 내가 누른 반응 (활성화) */
.react-tag.active {
    background: rgba(88, 101, 242, 0.2); /* 디스코드 블루 틴트 */
    border-color: #5865F2;
    color: #fff;
}

/* 이미지 이모지 크기 조절 */
.react-tag img {
    width: 16px;
    height: 16px;
    object-fit: contain;
}



/* 헤더 */
/* --- [수정] 메시지 헤더 (닉네임, 시간, 툴바 정렬용) --- */
.msg-header {
    display: flex;
    align-items: center; /* 수직 중앙 정렬 */
    gap: 8px; /* 요소 사이 간격 */
}

/* --- [수정] 툴바 위치 변경 (절대 위치 제거) --- */
.msg-toolbar {
    /* position: absolute;  <-- 이거 삭제 (범인) */
    /* top: -24px;          <-- 삭제 */
    /* right: 14px;         <-- 삭제 */
    
    display: inline-flex;   /* 옆으로 나란히 */
    align-items: center;
    gap: 2px;
    padding: 2px 4px;
    
    background: #36393f;
    border: 1px solid #202225;
    border-radius: 5px;
    
    /* 평소엔 안 보임 */
    opacity: 0;
    transform: translateX(-10px); /* 왼쪽에서 스윽 나오는 느낌 */
    transition: all 0.2s ease;
    
    /* 레이아웃 공간 차지 여부 (선택사항) */
    /* 공간 차지하기 싫으면 absolute 유지하되 left 값 조정해야 하는데, 
       닉네임 길이를 모르니 flex가 짱입니다. */
}

/* 마우스 올리면 등장 */
.msg:hover .msg-toolbar {
    opacity: 1;
    transform: translateX(0);
}


/* 답장 상태바 */
#reply-status-bar {
    background: #2f3136;   /* 어두운 회색 */
    color: #b9bbbe;        /* 연한 회색 글씨 */
    padding: 8px 15px;
    font-size: 13px;
    border-left: 4px solid #00b0f4; /* 왼쪽 파란 줄 포인트 */
    border-radius: 8px 8px 0 0;     /* 위쪽만 둥글게 */
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;      /* 입력창이랑 딱 붙이기 */
}


/* 답글 css 시작*/
/* 닫기 버튼 */
.reply-close {
    cursor: pointer;
    font-weight: bold;
    color: #dcddde;
    margin-left: 10px;
}
.reply-close:hover {
    color: #fff;
}
/* 답글 컬러 */
.msg-highlight {
    /*background: linear-gradient(90deg, #1e1f22, #2b2d31);*/ /*디스코드 스타일 컬러*/
	/*background: linear-gradient(90deg, #0f172a, #111827);*/ /*딥 네이비*/
	/*background: linear-gradient(90deg, #0b0f1a, #151a2e);*/ /*다크 네온 피플*/
	/*background: linear-gradient(90deg, #121212, #1c1c1c);*/ /*블랙 + 은은한 골드*/
    transition: background 0.3s ease;
}
/*
.msg-highlight {
    background: linear-gradient(
        90deg,
        rgba(34, 211, 238, 0.15),
        rgba(34, 211, 238, 0.05)
    );
    border-left: 3px solid #22d3ee;
}*/
/*
.msg-highlight {
    background: linear-gradient(
        90deg,
        rgba(34, 211, 238, 0.18),
        rgba(34, 211, 238, 0.06)
    );
    border-left: 3px solid #22d3ee;
    box-shadow: 0 0 12px rgba(34, 211, 238, 0.15);
    transition: all 0.3s ease;
}*/

.msg-highlight {
    background: linear-gradient(
        90deg,
        rgba(34, 211, 238, 0.20),
        rgba(34, 211, 238, 0.03)
    );
    border-left: 3px solid #22d3ee;
    filter: saturate(1.1);
}
/* 답글 css 끝*/




/* ==========================================================================
   디스코드 스타일 답변 닉네임 툴팁
   ========================================================================== */
.react-tag {
    position: relative; /* 툴팁 기준점 */
}

/* 툴팁 몸통 */
.react-tag:hover::after {
    content: attr(data-tooltip); /* 🔥 JS 데이터 가져오기 */
    
    position: absolute;
    bottom: 100%;         /* 아이콘 위로 */
    left: 50%;
    transform: translateX(-50%);
    
    background: #18191c;  /* 아주 진한 검정 */
    color: #ffffff;
    padding: 6px 10px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;  /* 줄바꿈 방지 */
    
    pointer-events: none; /* 마우스 간섭 방지 */
    z-index: 9999;        /* 제일 위로 */
    box-shadow: 0 5px 10px rgba(0,0,0,0.5);
    margin-bottom: 8px;   /* 아이콘과 간격 */
}

/* 툴팁 꼬리 (삼각형) */
.react-tag:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #18191c; /* 몸통 색이랑 동일하게 */
    margin-bottom: -4px;
    z-index: 9999;
}


.msg-row {
  display: flex;
  align-items: flex-start;
}

.msg-body {
  flex: 1;
  position: relative;
}

.msg-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.text {
  font-size: 14px;
  line-height: 1.5;
}