/* ============================================================
   댓글·답글 이모지 반응 (2026-11-06) — js/comment-reactions.js 와 짝
   기존 색상 변수(--sky*, --border, --text*, --white)만 사용 → 기본/LABBER 테마 모두 따라감
   style.css(압축 산출물)는 건드리지 않고 별도 파일로 둔다.
   ============================================================ */

/* 답글 버튼 + 반응 묶음 한 줄 (좁은 화면에서는 줄바꿈) */
.cr-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin-top: 6px;
  min-width: 0;
}
.cr-row .comment-reply-btn { padding: 6px 2px; min-height: 32px; }

.cr-bar {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}

.cr-emo,
.cr-pop-btn {
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  font-style: normal;
  line-height: 1;
}

.cr-chip,
.cr-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 32px;
  min-width: 44px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--white);
  color: var(--text-sub, #64748B);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .12s, border-color .12s, color .12s;
}
.cr-chip .cr-emo { font-size: 15px; }
.cr-chip .cr-n { font-variant-numeric: tabular-nums; }

/* 반응 아트웍(images/icons/reaction-*.png, 2026-11-07)
   · 크기를 먼저 고정 → 이미지 로딩 전후로 버튼 크기·배치가 흔들리지 않음
   · 원본 색상 유지(필터 없음), 비율 유지(object-fit: contain)
   · 이미지는 클릭·드래그·길게 누르기 대상이 아님 → 버튼이 받음 */
.cr-img,
.cr-pop-img,
.cr-add-img,
.dm-react-img {
  display: block;
  flex: none;
  object-fit: contain;
  filter: none;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}
.cr-img { width: 20px; height: 20px; }
/* 선택창 여는 버튼 아이콘(따봉 아트웍) — 반응 등록 아님 */
.cr-add-img { width: 19px; height: 19px; }   /* 기존 🙂(14px 글리프, 폭 약 19px)과 같은 버튼 폭 유지 */
.dm-react-img { width: 18px; height: 18px; }
.cr-pop-img { width: 30px; height: 30px; }
.cr-chip:hover,
.cr-add:hover { border-color: var(--sky); color: var(--sky-deep); }

/* 내가 고른 반응 — 배경 + 진한 테두리 + 굵은 숫자 */
.cr-chip.is-mine {
  background: var(--sky-light);
  border-color: var(--sky-dark);
  color: var(--sky-deep);
  box-shadow: inset 0 0 0 1px var(--sky-dark);
}

.cr-add { min-width: 40px; padding: 4px 8px; color: var(--text-mute); border-style: dashed; }
.cr-add .cr-emo { font-size: 14px; filter: grayscale(.2); }
.cr-add .cr-plus { font-size: 13px; font-weight: 700; }
.cr-add[aria-expanded="true"] { border-style: solid; border-color: var(--sky); color: var(--sky-deep); background: var(--sky-pale); }

.cr-chip:focus-visible,
.cr-add:focus-visible,
.cr-pop-btn:focus-visible {
  outline: 2px solid var(--sky-dark);
  outline-offset: 2px;
}

/* 팝오버 */
.cr-add-wrap { position: relative; display: inline-flex; }
.cr-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 300;
  display: flex;
  gap: 2px;
  padding: 4px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-md, 0 4px 16px rgba(0,0,0,0.10));
  white-space: nowrap;
}
.cr-pop.cr-pop--up { top: auto; bottom: calc(100% + 6px); }   /* 스크롤 영역 아래가 잘리면 위로 */

/* ── DM 말풍선 (js/chat.js) ──
   · 반응이 있을 때만 말풍선 아래 줄 표시(없으면 hidden → 빈 공간 없음), 말풍선 폭(max-width)은 그대로
   · 상시 [반응 추가] 버튼 없음 — 모바일은 길게 누르기, PC 는 마우스 올림/키보드 포커스 때 작은 버튼
   · 작은 버튼은 시간 표시(meta) 바깥쪽에 띄워서(position:absolute) 나타나도 배치가 밀리지 않는다 */
.dm-msg-row.has-cr { flex-wrap: wrap; row-gap: 3px; }
.dm-msg-row > .dm-msg-reactions { flex-basis: 100%; display: flex; min-width: 0; margin: 0; }
.dm-msg-row > .dm-msg-reactions[hidden] { display: none; }
.dm-msg-row--mine > .dm-msg-reactions { justify-content: flex-end; }
.dm-msg-reactions .cr-bar { gap: 4px; }
.dm-msg-reactions .cr-chip { min-height: 26px; min-width: 38px; padding: 1px 7px; gap: 3px; font-size: 11.5px; }
.dm-msg-reactions .cr-chip .cr-emo { font-size: 13px; }
.dm-msg-reactions .cr-chip .cr-img { width: 18px; height: 18px; }

.dm-msg-row.has-cr .dm-msg-meta { position: relative; }
.dm-react-btn {
  position: absolute;
  bottom: 0;
  left: calc(100% + 4px);          /* 상대 메시지: 시간 오른쪽 */
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--white);
  box-shadow: var(--shadow-sm, 0 1px 4px rgba(0,0,0,0.06));
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;                      /* 기본은 숨김 — 키보드로는 그대로 닿는다(포커스 시 표시) */
  pointer-events: none;
  transition: opacity .12s;
  z-index: 2;
}
.dm-msg-row--mine .dm-react-btn { left: auto; right: calc(100% + 4px); }   /* 내 메시지: 시간 왼쪽 */
@media (hover: hover) {
  .dm-msg-row.has-cr:hover .dm-react-btn { opacity: 1; pointer-events: auto; }
}
.dm-msg-row.has-cr:focus-within .dm-react-btn,
.dm-react-btn:focus-visible,
.dm-react-btn[aria-expanded="true"] { opacity: 1; pointer-events: auto; }
.dm-react-btn:hover { border-color: var(--sky); }
.dm-react-btn:focus-visible { outline: 2px solid var(--sky-dark); outline-offset: 2px; }

/* 기준 요소에 띄우는 선택창(DM) */
.cr-pop.cr-pop--fixed { position: fixed; top: 0; left: 0; z-index: 2100; }
.cr-pop-btn {
  width: 40px;
  height: 40px;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  font-size: 21px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform .12s, background .12s;
  -webkit-tap-highlight-color: transparent;
}
.cr-pop-btn:hover { background: var(--sky-pale); transform: scale(1.12); }
.cr-pop-btn.is-mine { background: var(--sky-light); border-color: var(--sky-dark); }

/* 오류 알림(낭독기용 상태 영역 겸용) */
.cr-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 2000;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 10px;
  background: #1E293B;
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
  /* 숨김 상태에서도 낭독기는 읽도록 display:none 을 쓰지 않는다 */
}
.cr-toast.is-visible { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .cr-chip, .cr-add, .cr-pop-btn, .cr-toast { transition: none; }
  .cr-pop-btn:hover { transform: none; }
}

@media (max-width: 480px) {
  .cr-pop-btn { width: 38px; height: 38px; font-size: 20px; }
  .cr-pop-img { width: 28px; height: 28px; }
}
