/* ========================================
   chat.css — Chat Core / UI Components / Pet
   K-Tell2 [v11.4] — 분리 출처: chat.css
   Chat → chat.css (lines 451-2825)
======================================== */

/* ========================================
   Chat Messages & Media Previews
======================================== */
.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px; /* [v11.45] 20px -> 16px (조밀화) */
  display: flex;
  flex-direction: column;
  gap: 2px; /* [v11.47] 4px -> 2px (극성 고밀도화) */
  scroll-behavior: smooth;
  position: relative;
  z-index: 1;
}

.chat-area::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 0;
  pointer-events: none;
  display: none;
  /* Only activated via JS if needed, but provides a readable layer */
}

.msg {
  display: flex;
  gap: 10px;
  max-width: 85%;
  align-items: flex-start;
  position: relative;
  z-index: 2;
}

.msg.mine {
  align-self: flex-end;
  flex-direction: row-reverse;
  max-width: 85%;
}

.msg-body {
  display: flex;
  flex-direction: column;
  gap: 1px; /* [v11.47] 2px -> 1px (극성 조밀화) */
  align-items: flex-start; /* [v11.48 FIX] 수신 메시지 말풍선 가설폭 유연화 */
}

.msg.mine .msg-body {
  align-items: flex-end;
}

.msg-nick {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-area .msg.mine .msg-nick {
  display: none;
}

/* [v11.17] 닉/아이디 배경 칩 — 배경색 무관하게 가독성 확보 */
.nick-tag {
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  padding: 1px 7px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

/* [v11.17] 레벨 표시 — 배경 제거, 연한 텍스트만 */
.msg-level {
  font-size: 10px;
  color: var(--text-muted, #64748b);
  font-weight: 500;
}

.msg-item {
  display: flex;
  flex-direction: row; /* [v11.46 FIX] 가로 배치 복구 (아바타-말풍선 나란히) */
  padding: 1px 12px; /* [v11.47] 3px -> 1px (극성 조밀화) */
  max-width: 85%;
  position: relative;
  gap: 10px; /* 아바타-말풍선 간격 확보 */
}

.msg-bubble {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px;
  background: var(--chat-bubble-other);
  color: var(--chat-text-other); /* [Fix] --text-primary -> --chat-text-other (테마 전용 변수 사용) */
  border-radius: 14px;
  border-top-left-radius: 4px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  position: relative;
  border: none;
}

.msg.mine .msg-bubble {
  background: var(--chat-bubble-mine);
  color: var(--chat-text-mine);
  border-top-left-radius: 14px;
  border-top-right-radius: 4px;
}

.msg-time {
  font-size: 10px;
  color: var(--text-tertiary);
  text-align: right;
}

/* media style addition */
.msg-media {
  margin-top: 8px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.05);
}

.media-preview,
.media-video {
  max-width: 100%;
  max-height: 280px;
  /* 세로로 긴 이미지가 말풍선 영역 초과 방지 */
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  border-radius: 6px;
}

.download-box {
  margin-top: 8px;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--color-prime);
  text-decoration: none;
  transition: background 0.2s;
}

.btn-download:hover {
  background: var(--bg-surface-hover);
}

/* Bubble color 충돌 방지: 중복 규칙 제거됨 — .msg-bubble 기본 규칙만 사용 */

.chat-area .msg .msg-time {
  font-size: 10px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.chat-area .msg.mine .msg-time {
  text-align: right;
}

.chat-area .msg .msg-bubble.pending {
  /* opacity 사용 금지 — 수신자에게 ACK가 가지 않아 영구 희미해지는 버그 방지 */
  border: 1px dashed var(--border-color);
}

.chat-area .msg .msg-bubble .ack-icon {
  font-size: 11px;
  margin-left: 4px;
}

/* System messages */
.chat-area .system-msg {
  align-self: center;
  padding: 4px 12px;
  background: var(--chat-system-bg);
  border-radius: var(--radius-full);
  font-size: 12px !important; /* [v11.18] 11px -> 12px */
  color: var(--text-primary);
  text-align: center;
  max-width: 85%;
  width: fit-content;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  margin: 1px 0; /* [v11.47] 3px -> 1px (극성 조밀화) */
}

/* [v1.1] Argos AI 비공개 응답 전용 — .system-msg 클래스 보존, 서브클래스만 신설 */
.chat-area .system-msg--private {
  border-left: 3px solid var(--color-prime, #7c5cfc);
  padding-left: 12px;
  font-style: italic;
  opacity: 0.9;
  background: rgba(124, 92, 252, 0.08);
}

/* [v11.16] 귓속말/pending 제외한 모든 말풍선 테두리 강제 제거 */
.chat-area .msg:not(.whisper) .msg-bubble:not(.pending) {
  border: none !important;
}

/* Whisper — 프리미엄 로즈 스타일 (v1.6) [Harmonized with Mentions] */
@keyframes whisperPulse {
  0% { box-shadow: 0 0 8px rgba(220, 38, 38, 0.4); }
  50% { box-shadow: 0 0 30px rgba(220, 38, 38, 1), 0 0 10px rgba(220, 38, 38, 0.7); }
  100% { box-shadow: 0 0 8px rgba(220, 38, 38, 0.4); }
}

.chat-area .msg.whisper .msg-bubble {
  background: rgba(220, 38, 38, 0.45) !important; /* 0.75에서 0.45로 조정 */
  color: #ffffff !important;
  border: 1px solid #ff4e51 !important;
  animation: whisperPulse 1.5s ease-in-out infinite;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.chat-area .msg.whisper .msg-nick::before {
  content: "🔒귓속말 : ";
  font-size: 10px;
}

/* Media embed in chat */
.chat-area .msg .msg-media {
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 4px;
  max-width: 300px;
  border: 1px solid var(--border-light);
}

.chat-area .msg .msg-media img.media-preview {
  width: 100%;
  height: auto;
  max-height: 280px;
  object-fit: contain;
  display: block;
}

.chat-area .msg .msg-media video.media-video {
  width: 100%;
  max-height: 240px;
  display: block;
  background: #000;
}

.chat-area .msg .msg-media audio.media-audio {
  width: 100%;
  display: block;
  padding: 4px;
}

.chat-area .msg .msg-media .file-attach {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.chat-area .msg .msg-media .file-attach i {
  font-size: 22px;
  color: var(--color-prime);
}

.chat-area .msg .msg-media .file-attach .file-info {
  font-size: 12px;
}

.chat-area .msg .msg-media .file-attach .file-name {
  font-weight: 600;
}

/* ========================================
   Chat Input Bar
======================================== */
.chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}

.chat-input-bar .input-tools {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.chat-input-bar .input-tools button {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 20px;
  transition: var(--transition);
}

.chat-input-bar .input-tools button:hover {
  color: var(--color-prime);
  background: var(--bg-surface-hover);
}

.chat-input-bar .msg-input {
  flex: 1;
  height: 36px;
  /* 높이를 고정하여 움직임 방지 */
  min-height: 36px;
  max-height: 36px;
  /* 최대 높이도 고정 */
  padding: 8px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  resize: none;
  /* 사용자 리사이즈 금지 */
  color: var(--text-primary);
  font-size: 14px;
  line-height: 20px;
  /* 줄 높이를 픽셀 단위로 고정 */
  overflow: hidden;
  /* 스크롤바와 그로 인한 떨림을 완전히 제거 */
  box-sizing: border-box;
  /* 패딩이 높이에 영향을 주지 않도록 고정 */
}

.chat-input-bar .msg-input:focus {
  border-color: var(--color-prime);
}

.chat-input-bar .send-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: var(--color-prime);
  color: #fff;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: var(--transition);
}

.chat-input-bar .send-btn:hover {
  background: var(--color-prime-dark);
  transform: scale(1.05);
}

/* Slash command autocomplete */
.slash-menu {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  display: none;
  max-height: 200px;
  overflow-y: auto;
}

.slash-menu.show {
  display: block;
}

.slash-menu .slash-item {
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.slash-menu .slash-item:hover {
  background: var(--bg-surface-hover);
}

.slash-menu .slash-item .cmd {
  font-weight: 700;
  color: var(--color-prime);
}

.slash-menu .slash-item .desc {
  color: var(--text-secondary);
}

/* ========================================
   Chat Top Banner (Announcement / Media)
======================================== */
.chat-banner {
  padding: 6px 16px;
  background: var(--bg-header); /* 테마 헤더 배경 연동 */
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center; /* 중앙 정렬 */
  gap: 10px;
  flex-shrink: 0;
  min-height: 36px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

/* [v11.27] 공지 라벨 뱃지 */
.chat-notice-badge {
  background: var(--color-accent); /* 테마 강조색 연동 */
  color: #000;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chat-banner i {
  color: var(--text-heading);
  font-size: 16px;
  opacity: 0.8;
}

.chat-banner .banner-text {
  /* flex: 1; -> 중앙 정렬을 위해 제거 */
  font-weight: 600;
  color: var(--text-heading);
  animation: chatNoticeBreathe 2s ease-in-out infinite; /* 숨쉬기 효과 */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 70%;
}

@keyframes chatNoticeBreathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.chat-banner .close-banner {
  cursor: pointer;
  color: var(--text-heading);
  opacity: 0.5;
  transition: opacity 0.2s;
  margin-left: 10px;
}
.chat-banner .close-banner:hover { opacity: 1; }

/* Media player (PiP Mode) */
.media-player {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 370px; /* [v11.45 Phase 2] 가로 50px 확장 (볼륨 컨트롤 영역 확보) */
  height: 305px; /* [v11.45 Phase 2] 세로 25px 확장 (황금 비율 조정) */
  min-width: 270px;
  min-height: 44px;
  /* 헤더 높이만 */
  max-width: 90vw;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  resize: both;
  /* 자유 리사이즈 — 내부 미디어도 함께 반응 */
  overflow: hidden;
}

.media-player-header {
  padding: 5px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border-light);
  cursor: move;
  user-select: none;
  touch-action: none; /* [Fix] 모바일 터치 드래그 활성화 */
  background: rgba(111, 72, 255, 0.05);
  flex-shrink: 0;
  height: 44px;
  box-sizing: border-box;
}

/* ── compact 모드: 헤더만 표시, 미디어 숨김 ── */
.media-player.media-compact {
  height: 44px !important;
  min-height: 44px;
  resize: none !important;
  overflow: hidden;
}

.media-player.media-compact .yt-container,
.media-player.media-compact #nativeMediaPlayer {
  display: none !important;
}

/* ── 커스텀 리사이즈 핸들 (코너) ── */
.pip-resize-handle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 16px;
  height: 16px;
  cursor: se-resize;
  z-index: 10;
  background: transparent;
}

.pip-resize-handle::after {
  content: '';
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 8px;
  height: 8px;
  border-right: 2px solid rgba(255, 255, 255, 0.7);
  border-bottom: 2px solid rgba(255, 255, 255, 0.7);
}

.media-player.media-compact .pip-resize-handle {
  display: none;
  /* 축소 모드에선 코너 핸들 숨김 */
}

/* ── 하단 전체 라인 리사이즈 핸들 ── */
.pip-bottom-resize-handle {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 16px;
  /* 코너 액션과 겹치지 않게 */
  height: 4px;
  /* 최소 두께 */
  cursor: ns-resize;
  z-index: 10;
  display: block;
  background: transparent;
}

/* ── 우측 전체 라인 리사이즈 핸들 ── */
.pip-right-resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 16px;
  /* 코너 액션과 겹치지 않게 */
  width: 4px;
  /* 최소 두께 */
  cursor: ew-resize;
  z-index: 10;
}

/* [C-SW] 좌하단(SW) 리사이즈 핸들 — 오른쪽 가장자리 고정, 왼쪽·아래 확장 */
.pip-left-resize-handle {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 16px;
  height: 16px;
  cursor: sw-resize;
  z-index: 10;
}

.pip-left-resize-handle::after {
  content: '';
  position: absolute;
  left: 3px;
  bottom: 3px;
  width: 8px;
  height: 8px;
  border-left: 2px solid rgba(255, 255, 255, 0.65);
  border-bottom: 2px solid rgba(255, 255, 255, 0.65);
  border-radius: 0 0 0 3px;
}

.media-player .media-info {
  flex: 1;
  font-size: 12px;
}

.media-player .media-title {
  font-weight: 600;
}

.media-player .media-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* [v11.45 Phase 2] 볼륨 조절 슬라이더 스타일 — 가시성 개선 */
.media-volume-wrap {
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(0, 0, 0, 0.3); /* 더 진하게 조정하여 프리미엄한 구분감 부여 */
  padding: 2px 8px 2px 4px;
  border-radius: var(--radius-full);
  margin-right: 4px;
  transition: var(--transition);
  border: 1px solid rgba(0, 0, 0, 0.05); /* 미세한 테두리 추가 */
}

.media-volume-wrap:hover {
  background: rgba(0, 0, 0, 0.2);
}

#mediaVolumeSlider {
  width: 60px;
  height: 4px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.2); /* 트랙 배경을 투명도 있는 흰색으로 변경 */
  border-radius: 2px;
  outline: none;
}

#mediaVolumeSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  background: var(--color-prime);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.1s;
}

#mediaVolumeSlider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.media-player .media-controls button {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  font-size: 16px;
  color: var(--text-secondary);
  transition: var(--transition);
}

.media-player .media-controls button:hover {
  background: var(--bg-surface-hover);
  color: var(--color-prime);
}

/* [v11.45 Phase 2] 미디어 컨테이너가 부모 높이를 100% 채우도록 보정 */
.yt-container {
  flex: 1;
  width: 100%;
  height: 0; /* flex-grow가 실제 높이를 결정하도록 0으로 설정 */
  min-height: 0;
  background: #000;
}

#ytPlayer {
  width: 100%;
  height: 100%;
}

/* ========================================
   User List Items & Cards (side panel)
======================================== */
.user-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.user-card.my-card {
  border: 1px solid var(--color-prime);
  background: rgba(111, 72, 255, 0.03);
}

.user-card.owner-card {
  border-color: #ffd700;
  background: rgba(255, 215, 0, 0.04);
}

.user-card.owner-card.my-card {
  border-color: #ffd700;
  background: rgba(255, 215, 0, 0.06);
}

.user-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  cursor: pointer;
  background: transparent;
  transition: var(--transition);
}

.user-card-header:hover {
  background: var(--bg-surface-hover);
}

.user-card-body {
  padding: 4px 10px 6px;
  border-top: 1px dashed var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 3px;
  animation: slideUp 0.2s ease;
}

.card-bio {
  font-size: 12px;
  color: var(--text-primary);
  background: var(--bg-input);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: flex-start;
  gap: 6px;
  word-break: break-all;
}

.card-stats {
  display: flex;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  padding-bottom: 2px;
}

.card-stats span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  margin-top: 0;
}

.user-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.user-item:hover {
  background: var(--bg-surface-hover);
}

.user-item .u-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  position: relative;
  flex-shrink: 0;
}

.user-item .u-avatar .online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  border: 2px solid var(--bg-sidebar);
}

.user-item .u-info {
  flex: 1;
  min-width: 0;
}

.user-item .u-info .u-nick {
  font-size: 13px;
  font-weight: 600;
}

.user-item .u-info .u-status {
  font-size: 11px;
  color: var(--text-secondary);
}

.user-item .u-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: var(--transition);
}

.user-item:hover .u-actions {
  opacity: 1;
}

.user-item .u-actions button {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 14px;
  color: var(--text-secondary);
}

.user-item .u-actions button:hover {
  color: var(--color-prime);
  background: rgba(111, 72, 255, 0.1);
}

/* ========================================
   Operator Panel (방장 전용)
======================================== */
.operator-panel {
  padding: 12px;
}

.operator-panel h4 {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.operator-panel .op-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.operator-panel .op-btn {
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  transition: var(--transition);
}

.operator-panel .op-btn:hover {
  border-color: var(--color-prime);
  color: var(--color-prime);
}

.operator-panel .op-btn.danger:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* ========================================
   Pet Widget
======================================== */
.pet-widget {
  padding: 12px;
  text-align: center;
}

.pet-widget .pet-icon {
  font-size: 42px;
  margin-bottom: 6px;
}

.pet-widget .pet-name {
  font-weight: 700;
  font-size: 14px;
}

.pet-widget .pet-level {
  font-size: 11px;
  color: var(--text-secondary);
}

.pet-widget .pet-exp {
  width: 100%;
  height: 4px;
  background: var(--bg-input);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}

.pet-widget .pet-exp .bar {
  height: 100%;
  background: var(--color-prime);
  border-radius: 2px;
  transition: width 0.3s;
}

/* ========================================
   Login Page
======================================== */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-body);
  padding: 20px;
}

.login-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
  padding: 40px 32px;
  text-align: center;
}

.login-card .logo-area {
  margin-bottom: 28px;
}

.login-card .logo-area i {
  font-size: 48px;
  color: var(--color-prime);
}

.login-card .logo-area h1 {
  font-size: 24px;
  font-weight: 800;
  margin-top: 8px;
}

.login-card .logo-area p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.login-card .form-group {
  margin-bottom: 14px;
  text-align: left;
}

.login-card .form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.login-card .divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-tertiary);
  font-size: 12px;
}

.login-card .divider::before,
.login-card .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.login-card .theme-selector {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 20px;
}

.login-card .theme-selector button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  transition: var(--transition);
}

.login-card .theme-selector button:hover,
.login-card .theme-selector button.active {
  border-color: var(--color-prime);
  transform: scale(1.15);
}

.login-card .theme-selector .t-light {
  background: #ffffff;
}

.login-card .theme-selector .t-dark {
  background: #1a1a1a;
}

.login-card .theme-selector .t-hitel {
  background: #000033;
}

/* ========================================
   Connection Status
======================================== */
.conn-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}

.conn-status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

.conn-status .dot.disconnected {
  background: var(--danger);
  animation: pulse 1s infinite;
}

.conn-status .dot.connecting {
  background: var(--warning);
  animation: pulse 0.8s infinite;
}

/* ========================================
   Context Menu (Right-click on user)
======================================== */
.ctx-menu {
  position: fixed;
  z-index: 150;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  min-width: 160px;
  overflow: hidden;
  display: none;
}

.ctx-menu.show {
  display: block;
}

.ctx-menu .ctx-item {
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.ctx-menu .ctx-item:hover {
  background: var(--bg-surface-hover);
  color: var(--color-prime);
}

.ctx-menu .ctx-item.danger {
  color: var(--danger);
}

.ctx-menu .ctx-item.danger:hover {
  background: rgba(244, 67, 54, 0.08);
}

.ctx-menu .ctx-sep {
  height: 1px;
  background: var(--border-light);
  margin: 4px 0;
}

/* ========================================
   모바일 사이드패널 오버레이 (외부 터치 → 닫기)
======================================== */
#sidePanelOverlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;       /* side-panel(1000) 바로 아래 */
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
  transition: opacity .25s ease;
  opacity: 0;
}
#sidePanelOverlay.visible {
  display: block;
  opacity: 1;
}

/* ========================================
   Responsive
======================================== */
@media (max-width: 768px) {
  /* ── 사이드패널 슬라이드 + 스크롤 ── */
  .side-panel {
    position: fixed;
    right: 0;
    top: 50px; /* [v11.34] Header height 50px와 동기화 */
    bottom: 0;
    z-index: 1000;
    width: 280px;
    background: var(--bg-sidebar);
    box-shadow: -4px 0 20px rgba(0,0,0,0.2);
    /* 슬라이드 애니메이션 (width 대신 transform 사용 → 성능 향상) */
    transform: translateX(0);
    transition: transform .28s cubic-bezier(0.4,0,0.2,1),
                box-shadow .28s ease;
    display: flex;
    flex-direction: column;
  }

  .side-panel.collapsed {
    transform: translateX(100%);
    box-shadow: none;
    width: 280px; /* width는 고정, transform으로만 숨김 */
  }

  /* ── panel-body: 카드 전체 스크롤 보장 ── */
  .side-panel .panel-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch; /* iOS 관성 스크롤 */
    padding: 8px;
    /* 하단 안전 영역(노치폰) 여백 */
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  /* ── 열린 카드 body: 내용이 잘리지 않게 overflow 해제 ── */
  .user-card {
    overflow: visible;
  }
  .user-card-body {
    overflow: visible;
  }

  /* ── card-actions: 모바일에서 버튼 잘림 방지 ── */
  .card-actions {
    flex-wrap: wrap;
  }

  .room-grid {
    grid-template-columns: 1fr !important;
  }

  .chat-area .msg {
    max-width: 85%;
  }

  .lobby-toolbar .search-box {
    width: 160px;
  }

  /* [v11.19] Mobile declutter: Hide connection status above footer */
  .conn-status {
    display: none !important;
  }
}

/* ========================================
   PC / Mobile visibility
======================================== */
.mobile-only {
  display: none !important;
}

@media (max-width: 768px) {
  .pc-only {
    display: none !important;
  }

  .mobile-only {
    display: inline-flex !important;
  }
}

/* Floating side toggle button (mobile) */
.floating-side-btn {
  position: fixed;
  bottom: 80px;
  right: 16px;
  z-index: 30;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-prime);
  color: #fff;
  box-shadow: var(--shadow-md);
  align-items: center;
  justify-content: center;
  font-size: 22px;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.floating-side-btn:hover {
  background: var(--color-prime-dark);
  transform: scale(1.1);
}

/* ========================================
   #8: Welcome Message
======================================== */
.welcome-msg .msg-item {
  display: flex;
  flex-direction: row; /* [v11.46 FIX] 웰컴 메시지도 가로 배치 복구 */
  padding: 1px 12px; /* [v11.47] 3px -> 1px (극성 조밀화) */
  max-width: 85%;
  position: relative;
  gap: 10px;
}

.welcome-msg .welcome-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.welcome-msg .welcome-sub {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 400;
}

/* ========================================
   #8: Animated Search Box
======================================== */
.lobby-toolbar {
  flex-direction: row-reverse;
}

.lobby-toolbar .search-box {
  width: 42px;
  transition: width 0.35s ease;
  overflow: hidden;
  cursor: pointer;
}

.lobby-toolbar .search-box.expanded {
  width: 240px;
}

.lobby-toolbar .search-box input {
  opacity: 0;
  transition: opacity 0.2s ease 0.1s;
}

.lobby-toolbar .search-box.expanded input {
  opacity: 1;
}

@media (max-width: 768px) {
  .lobby-toolbar .search-box {
    width: 160px;
  }

  .lobby-toolbar .search-box input {
    opacity: 1;
  }

  .lobby-toolbar {
    flex-direction: row;
  }
}

/* ========================================
   #6: Expandable User Card
======================================== */
.user-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 6px;
  overflow: hidden;
  animation: slideUp 0.2s ease;
}

.user-card.my-card {
  border-color: var(--color-prime);
  border-width: 2px;
  background: rgba(255, 106, 0, 0.04);
}

:root.darkMode .user-card.my-card {
  background: rgba(255, 136, 51, 0.08);
}

:root.hitelMode .user-card.my-card {
  background: rgba(0, 170, 255, 0.08);
}

.user-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  cursor: pointer;
  transition: var(--transition);
}

.user-card-header:hover {
  background: var(--bg-surface-hover);
}

.user-card-body {
  padding: 4px 10px 6px;
  border-top: 1px solid var(--border-light);
  animation: fadeIn 0.2s ease;
}

.card-bio {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
}

.card-bio i {
  font-size: 13px;
  color: var(--color-prime);
}

.card-stats {
  display: flex;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  padding-bottom: 2px;
}

.card-stats span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-stats i {
  font-size: 13px;
  color: var(--color-prime);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding-top: 4px;
  border-top: 1px solid var(--border-light);
}

.card-actions .btn {
  font-size: 11px;
  padding: 3px 7px;
}

/* ========================================
   #17: Color Palette Popup
======================================== */
.color-palette-popup {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 14px;
  /* 내부 여백을 살짝 늘려 안정감 부여 */
  display: none;
  z-index: 40;
  width: 300px;
  /* 280px에서 300px로 확장하여 잘림 방지 */
  box-sizing: border-box;
  /* 패딩이 너비 계산에 포함되도록 고정 */
}

@media (max-width: 768px) {
  .color-palette-popup {
    /* 모바일: position:fixed로 부모 stacking context 탈출,
       side-panel(z-index:1000) 위로 올리기 */
    position: fixed;
    bottom: 62px;   /* 입력바 높이(~52px) + 여백 */
    left: 8px;
    right: 8px;
    width: auto;
    margin-bottom: 0;
    z-index: 1100;
  }
}

.color-palette-popup.show {
  display: block;
  animation: fadeIn 0.15s ease;
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}

.palette-swatch {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
}

.palette-swatch:hover {
  transform: scale(1.15);
  border-color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.palette-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
}

.palette-footer input[type="color"] {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: none;
  padding: 0;
}

.palette-eyedropper {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 18px;
}

.palette-eyedropper input[type="color"] {
  width: 0;
  height: 0;
  padding: 0;
  border: none;
  visibility: hidden;
  position: absolute;
}

.palette-alpha {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  font-size: 12px;
  color: var(--text-secondary);
}

.palette-alpha input[type="range"] {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border-color);
  border-radius: 2px;
  outline: none;
}

.palette-alpha input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-prime);
  cursor: pointer;
}

.palette-alpha span {
  min-width: 36px;
  text-align: right;
  font-weight: 600;
}

/* ========================================
   #3: Media Filename Display
======================================== */
.media-fname {
  font-size: 11px;
  color: var(--text-secondary);
  padding: 4px 0 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.media-fname i {
  font-size: 13px;
  color: var(--color-prime);
}

/* ========================================
   #16: Emoji Popup
======================================== */
.emoji-popup {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0;
  display: none;
  z-index: 40;
  width: 340px;
  max-height: 380px;
  overflow: hidden;
}

.emoji-popup.show {
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.15s ease;
}

/* Emoji Tabs */
.emoji-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.emoji-tab {
  flex: 1;
  padding: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.emoji-tab.active {
  color: var(--color-prime);
  border-bottom: 2px solid var(--color-prime);
}

.emoji-tab:hover {
  background: var(--bg-surface-hover);
}

/* Tab content */
.emoji-tab-content {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.emoji-tab-content.active {
  display: flex;
}

/* Default emoji grid */
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 2px;
  padding: 10px;
  overflow-y: auto;
  max-height: 200px;
}

.emoji-item {
  font-size: 22px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
}

.emoji-item:hover {
  background: var(--bg-surface-hover);
  transform: scale(1.2);
}

/* #4: Custom emoji category tabs */
.emoji-custom-cats {
  display: flex;
  gap: 4px;
  padding: 6px 10px;
  overflow-x: auto;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-light);
}

.emoji-cat-btn {
  padding: 3px 10px;
  font-size: 11px;
  border-radius: 12px;
  background: var(--bg-surface-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.emoji-cat-btn.active {
  background: var(--color-prime);
  color: #fff;
  border-color: var(--color-prime);
}

/* Custom emoji grid */
.emoji-custom-grid {
  grid-template-columns: repeat(6, 1fr);
  max-height: 160px;
  overflow-y: auto;
}

.emoji-custom-item {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-base);
  border: 1px solid var(--border-light);
}

.emoji-custom-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.emoji-custom-item:hover {
  border-color: var(--color-prime);
  transform: scale(1.05);
}

.emoji-del {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  font-size: 12px;
  line-height: 14px;
  text-align: center;
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}

.emoji-custom-item:hover .emoji-del {
  opacity: 1;
}

/* Emoji management controls */
.emoji-mgmt {
  padding: 8px 10px;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}

.emoji-mgmt-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.emoji-mgmt-row:last-child {
  margin-bottom: 0;
  justify-content: space-between;
}

/* ========================================
   #12: Enhanced Media Player
======================================== */
.media-player-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  min-height: 42px;
}

.yt-container {
  width: 100%;
  flex: 1 1 auto;
  /* 컨테이너 남은 높이 채움 → 리사이즈 시 미디어도 함께 조정 */
  min-height: 160px;
  overflow: hidden;
  background: #000;
  border-bottom: 1px solid var(--border-color);
}

/* ytPlayer div: YT API가 iframe으로 교체하기 전/후 모두 100% 높이 채움 */
#ytPlayer {
  width: 100%;
  height: 100%;
}

.yt-container iframe {
  width: 100%;
  height: 100% !important;
  /* YT API의 height="100%" 인라인 속성 보강 */
  border: none;
  display: block;
}

/* nativeMediaPlayer (오디오/비디오) - yt-container와 동일하게 flex로 채움 */
#nativeMediaPlayer {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  display: block;
  border-radius: 0;
}

/* 채팅 파일 업로드 미디어 헤더 (상단 파일명+저장버튼) */
.media-file-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  background: rgba(0, 0, 0, 0.04);
  border-bottom: 1px solid var(--border-light);
  border-radius: 6px 6px 0 0;
  font-size: 12px;
  font-weight: 500;
}

/* 미디어(비디오/오디오) 헤더: 파일명 + 저장버튼 균등배열 (클립아이콘 없음) */
.media-file-header.media-header-equal {
  justify-content: space-between;
}

.media-file-header.media-header-equal .media-file-name {
  max-width: none;
  flex: 1;
  margin-right: 8px;
}

.media-file-header i {
  font-size: 16px;
  color: var(--color-prime);
  flex-shrink: 0;
}

.media-file-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
  font-size: 12px;
  font-weight: 500;
}

/* 이미지 하단 저장 버튼 영역 */
.media-img-footer {
  display: flex;
  justify-content: flex-end;
  padding: 4px 6px;
  background: rgba(0, 0, 0, 0.04);
  border-top: 1px solid var(--border-light);
}

.btn-save-sm {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.2s;
}

.btn-save-sm:hover {
  opacity: 0.8;
}

.btn-save-sm i {
  font-size: 13px;
}

/* 압축/기타파일 전용 박스 (클립아이콘+파일명 상단, 다운로드버튼 하단) */
.file-nonmedia-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 10px 8px;
}

.file-nonmedia-top {
  display: flex;
  align-items: center;
  gap: 7px;
}

.file-nonmedia-top i {
  font-size: 22px;
  color: var(--color-prime);
  flex-shrink: 0;
}

.btn-download-block {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 5px 14px;
  background: var(--color-prime);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  align-self: flex-start;
  transition: opacity 0.2s;
}

.btn-download-block:hover {
  opacity: 0.85;
}

.btn-download-block i {
  font-size: 15px;
}

.btn-save {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 3px 8px;
  background: var(--color-prime);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  flex-shrink: 0;
  transition: opacity 0.2s;
}

.btn-save:hover {
  opacity: 0.85;
}

.btn-save i {
  font-size: 14px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 420px;
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
}

.btn-prime {
  background: var(--color-prime);
  color: #fff;
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: var(--transition);
}

.btn-prime:hover {
  background: var(--color-prime-dark);
}

/* ========================================
   Card Section Labels (role-based controls)
======================================== */
.card-section-label {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 0 2px;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 700;
  color: var(--color-prime);
  border-top: 1px solid var(--border-light);
}

.card-section-label i {
  font-size: 13px;
}

/* ========================================
   #14: Owner Controls Divider
======================================== */
.op-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.op-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-light);
}

.owner-controls {
  border-top: 1px solid var(--border-light);
  margin-top: 8px;
  padding-top: 4px;
}

/* iframe 포인터 이벤트 제어 (크기 조절 드래그 중 버벅이기 완벽 방지) */
.media-player.is-resizing .yt-container iframe,
.media-player.is-resizing #ytPlayer {
  pointer-events: none;
}

/* ========================================
   [v9.24] Chat Mechanism Enhancements
======================================== */

/* 타이핑 인디케이터 바 — [v10.3] 플로팅 오버레이 (본문 레이아웃에 영향 없음) */
.typing-bar {
  position: absolute;
  /* 부모 .content(relative) 기준 절대 위치 */
  bottom: 65px;
  /* 본문 하단에서 65px 띄움 (입력창 피함) */
  left: 165px;
  /* 좌측에서 165px 위치 */
  transform: none;
  width: fit-content;
  max-width: 85%;
  padding: 6px 18px;
  font-size: 13px;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.5);
  /* 검은색 50% */
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  /* 흰색 1px (부드럽게 처리) */
  border-radius: 40px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  z-index: 200;
  pointer-events: none;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: none;
  animation: typingFadeIn 0.3s ease-out;
}

@keyframes typingFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* 중복된 .reply-bar 관련 구형 정의 삭제 (2180라인에 통합 정의됨) */

/* 메시지 액션 버튼 */
.msg-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 0; /* [v11.47] 1px -> 0 (극정 조밀화) */
}

.msg-actions {
  display: flex;
  visibility: hidden;
  opacity: 0;
  gap: 2px;
  transition: opacity 0.2s, visibility 0.2s;
}

/* [v11.45] 트리거 영역을 .msg-body로 제한하여 마우스 이동 시 요동 방지 */
.msg-body:hover .msg-actions {
  visibility: visible;
  opacity: 1;
}

.msg-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px; /* [v11.45] 18px (정밀 조정) */
  color: var(--text-tertiary);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, transform .15s;
}

.msg-action-btn:hover {
  background: var(--bg-hover, rgba(111, 72, 255, 0.08));
  color: var(--color-prime, #6f48ff);
}

/* 수정됨 배지 */
.edit-badge {
  font-size: 10px;
  color: var(--text-tertiary);
  margin-left: 4px;
  opacity: 0.7;
}

/* ========================================
   [v11.45] Reply Bar (Input Area Target)
   ======================================== */
.reply-bar {
  display: none; /* [v11.48 FIX] 기본 숨김 처리 (답장 시에만 JS로 표시) */
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--reply-bg-alpha, var(--bg-surface));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  color: var(--text-secondary);
  animation: slideUp 0.2s ease;
}

/* [v11.48] 입력창 배너 정책: 미리보기 생략 (PC/모바일 공통 숨김) */
.reply-bar .rp-preview-text {
  display: none !important;
}

#replyBarText {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

/* ── 입력창 배너 모바일 최적화 ── */
@media screen and (max-width: 780px) {
  .reply-bar {
    padding: 3px 10px;
    gap: 6px;
  }
  
  /* [v11.48] 모바일 정책: 입력창 배너에서 아이디 숨김 (닉네임만 노출) */
  .reply-bar .rp-target-id {
    display: none !important;
  }
  
  .reply-bar #replyBarText {
    font-size: 12px;
  }
}

/* 읽음 배지 */
.seen-badge {
  font-size: 10px;
  color: var(--color-prime, #6f48ff);
  margin-left: auto;
}

/* 답장 인용 미리보기  [v11.44 Redesign] */
.msg-reply-preview {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px; /* 약간 축소 (내부 레이어 대응) */
  color: inherit; /* 부모(말풍선) 텍스트 색상 상속 (가독성 핵심) */
  background: rgba(90, 90, 90, 0.5); /* 더 옅은 배경 (말풍선 테두리 조화) */
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-left: 3px solid var(--rp-identity, var(--color-prime, #6f48ff));
  padding: 4px 10px 4px 7px;
  border-radius: 0 6px 6px 0;
  margin-bottom: 2px;
  cursor: pointer;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  transition: opacity .15s;
}
.msg-reply-preview:hover { opacity: 0.75; }

/* ── [v11.27] 통합 정체성 완성: 6종 테마 컬러 전면 동기화 ── */
/* 답장 배너 전용 정체성 컬러 변수 */
:root { --rp-identity: #E0E0E0; } /* 기본: White Natural (Silver) */
:root.darkMode     { --rp-identity: #E2C08A; } /* Dark Hanji (Antique Gold) */
:root.hitelMode    { --rp-identity: #00CCFF; } /* HiTel (Sky Blue) */
:root.lavenderMode { --rp-identity: #C7D2FE; } /* Lavender (Indigo) */
:root.roseMode     { --rp-identity: #FCA5A5; } /* Rose (Soft Rose) */
:root.navyMode     { --rp-identity: #A78BFA; } /* Steel Navy (Electric Lavender) */

/* 100% 동기화 적용: 닉네임, 아이콘, 왼쪽 바 */
.rp-nick { color: var(--rp-identity) !important; }
.rp-icon { color: var(--rp-identity) !important; }
.msg-reply-preview { border-left-color: var(--rp-identity) !important; }

/* ↩ 아이콘 */
.rp-icon {
  font-size: 13px;
  color: var(--color-prime, #6f48ff);
  flex-shrink: 0;
  opacity: .85;
}
/* 원본 작성자 닉네임 */
.rp-nick {
  font-weight: 700;
  color: var(--color-prime, #6f48ff);
  flex-shrink: 0;
  max-width: 120px; /* 아이디와 함께 표시되므로 소폭 확장 */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rp-target-id {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.85) !important; /* 고명도 화이트로 가독성 전면 격상 */
  margin-left: 2px;
  opacity: 1; /* 불투명도 100% 확보 */
}
/* › 구분자 */
.rp-sep {
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.6) !important; /* 위계에 맞는 명도 상향 */
  font-size: 10px;
  opacity: 1;
}
/* 원본 메시지 미리보기 */
.rp-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-style: italic;
  opacity: .85;
}

/* ========================================
   [v9.25] 채팅 검색 패널
======================================== */
.search-panel {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
}

.search-input-wrap {
  display: flex;
  gap: 6px;
  align-items: center;
}

.search-input {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg-input, var(--bg-primary));
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border 0.2s;
}

.search-input:focus {
  border-color: var(--color-prime, #6f48ff);
}

.search-input-wrap button {
  padding: 7px 10px;
  background: var(--color-prime, #6f48ff);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}

.search-input-wrap button:hover {
  opacity: 0.85;
}

.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px; /* [v11.45] 패딩 축소 */
  display: flex;
  flex-direction: column;
  gap: 8px; /* [v11.45] 12px -> 8px (고밀도화) */
  scroll-behavior: smooth;
  position: relative;
}

.search-result-panel {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.search-result-item {
  padding: 8px 10px;
  background: var(--bg-secondary, #f5f5f5);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.search-result-item:hover {
  background: rgba(111, 72, 255, 0.08);
}

.search-nick {
  font-weight: 600;
  font-size: 12px;
  color: var(--color-prime, #6f48ff);
  margin-right: 6px;
}

.search-ts {
  font-size: 11px;
  color: var(--text-secondary);
}

.search-msg {
  font-size: 13px;
  color: var(--text-primary);
  margin-top: 2px;
  word-break: break-all;
}

.search-empty {
  text-align: center;
  padding: 20px;
  color: var(--text-secondary);
  font-size: 13px;
}

/* 검색 결과 하이라이트 */
.msg-item.highlight {
  animation: highlight-flash 0.5s ease 0s 3 alternate;
}

@keyframes highlight-flash {
  from {
    background: transparent;
  }

  to {
    background: rgba(111, 72, 255, 0.15);
    border-radius: 8px;
  }
}

/* ========================================
   [v9.26] WebRTC P2P 방송 UI
======================================== */

/* 방송 알림 배너 */
.broadcast-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 16px;
  background: linear-gradient(90deg, rgba(111, 72, 255, 0.12), rgba(111, 72, 255, 0.04));
  border-bottom: 1px solid rgba(111, 72, 255, 0.2);
  font-size: 13px;
  color: var(--text-primary);
  flex-shrink: 0;
  animation: banner-slide-in 0.3s ease;
}

.broadcast-banner i.bx-broadcast {
  color: var(--color-prime, #6f48ff);
  font-size: 18px;
  animation: pulse-broadcast 1.5s ease-in-out infinite;
}

@keyframes pulse-broadcast {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

@keyframes banner-slide-in {
  from {
    transform: translateY(-10px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.btn-join-broadcast {
  padding: 4px 12px;
  background: var(--color-prime, #6f48ff);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: opacity 0.15s;
}

.btn-join-broadcast:hover {
  opacity: 0.85;
}

/* On Air 배지 [FEAT-1] */
.on-air-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #22c55e;
  color: #fff;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  animation: pulse-onair 1.5s ease-in-out infinite;
}

@keyframes pulse-onair {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
  }
}

/* 방송/시청 플로팅 패널 [FEAT-2] — media-player PiP 스타일로 통일 */
.webrtc-panel {
  position: absolute;
  top: 20px;
  left: calc(50% - 160px);
  /* 초기: 콘텐츠 영역 상단 중앙 */
  width: 320px;
  min-width: 240px;
  min-height: 180px;
  background: var(--bg-card, #1e1e2e);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  z-index: 900;
  display: none;
  flex-direction: column;
  resize: both;
}

.webrtc-panel.active {
  display: flex;
}

.webrtc-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-secondary);
  font-size: 13px;
  font-weight: 600;
  border-bottom: 1px solid var(--border-light);
  cursor: move;
  user-select: none;
  flex-shrink: 0;
  /* 헤더 높이 고정 */
}

.webrtc-panel-header .viewer-count {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 400;
}

.webrtc-close-btn {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-secondary);
  padding: 0 2px;
  line-height: 1;
}

.webrtc-close-btn:hover {
  color: #ff4d4f;
}

.webrtc-video {
  width: 100%;
  flex: 1;
  min-height: 80px;
  /* [v9.35] 순수 검정 대신 패널 배경색으로 → 레터박스 영역이 자연스럽게 처리됨 */
  background: linear-gradient(135deg, #0c0c1e 0%, #0a1525 100%);
  object-fit: contain;
  display: block;
}

/* [v9.29 B] WebRTC 패널 추가 스타일 */
.live-badge {
  color: #ff4d4f;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .5px;
  animation: livePulse 1.4s ease-in-out infinite;
}

@keyframes livePulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: .45;
  }
}

.webrtc-type-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 400;
  padding: 2px 6px;
  background: rgba(255, 255, 255, .08);
  border-radius: 10px;
}

.webrtc-ctrl-btn {
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
  padding: 2px 3px;
  border-radius: 4px;
  opacity: .75;
  transition: opacity .12s;
}

.webrtc-ctrl-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, .1);
}

.webrtc-ctrl-btn.muted {
  opacity: .4;
}

/* 오디오 전용 표시 [v9.35 개편: 풀스크린 이미지 지원] */
.webrtc-audio-indicator {
  flex: 1;
  position: relative;
  /* 자식 absolute 위치 기준 */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, #111128, #0e1a30);
  overflow: hidden;
  min-height: 120px;
}

/* [v9.35] 풀스크린 배경 이미지 (이미지 업로드 시) */
.audio-fill-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.88;
  z-index: 0;
  transition: opacity .3s;
}

/* 웨이브/텍스트/펫은 이미지 위에 오버레이 — 중앙 하단 고정 */
.audio-overlay {
  position: absolute;
  bottom: 18px;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.audio-wave-text {
  font-size: 12px;
  color: rgba(255, 255, 255, .8);
  text-shadow: 0 1px 4px rgba(0, 0, 0, .8);
  background: rgba(0, 0, 0, .35);
  padding: 3px 10px;
  border-radius: 20px;
}

/* 접이식 시청자 목록 */
.webrtc-viewer-list {
  flex-shrink: 0;
  border-top: 1px solid rgba(255, 255, 255, .08);
  background: rgba(0, 0, 0, .15);
  overflow: hidden;
  max-height: 160px;
  transition: max-height .2s ease;
}

.webrtc-viewer-list.collapsed {
  max-height: 30px;
}

.webrtc-viewer-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 12px;
  font-size: 11px;
  color: rgba(255, 255, 255, .45);
  cursor: pointer;
  user-select: none;
}

.webrtc-viewer-list-header:hover {
  background: rgba(255, 255, 255, .04);
}

.webrtc-collapse-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 10px;
  color: rgba(255, 255, 255, .4);
  line-height: 1;
  padding: 0;
  transition: transform .15s;
}

.webrtc-viewer-list.collapsed .webrtc-collapse-btn {
  transform: rotate(-90deg);
}

.webrtc-viewer-items {
  list-style: none;
  margin: 0;
  padding: 0 8px 6px;
  max-height: 122px;
  overflow-y: auto;
}

.webrtc-viewer-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  font-size: 12px;
  color: #ccc;
  border-radius: 6px;
  transition: background .1s;
}

.webrtc-viewer-item:hover {
  background: rgba(255, 255, 255, .06);
}

.webrtc-viewer-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.webrtc-viewer-item-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  opacity: .55;
  padding: 1px 3px;
  border-radius: 3px;
  transition: opacity .12s;
}

.webrtc-viewer-item-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, .1);
}

/* 방송 모달: 미디어 타입 선택 버튼 */
.broadcast-type-btn {
  flex: 1;
  padding: 16px 8px;
  border: 2px solid var(--border-light);
  border-radius: 10px;
  background: var(--bg-secondary);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.broadcast-type-btn i {
  font-size: 22px;
  margin-bottom: 4px;
  display: block;
}

.broadcast-type-btn:hover {
  border-color: var(--color-prime, #6f48ff);
  color: var(--color-prime, #6f48ff);
}

.broadcast-type-btn.active {
  border-color: var(--color-prime, #6f48ff);
  background: rgba(111, 72, 255, 0.1);
  color: var(--color-prime, #6f48ff);
  font-weight: 700;
}

/* ========================================
   [v9.27] Warden + PetBot AI 시스템
======================================== */

/* ── Warden: Optimistic UI 롤백 마스크 ── */
.warden-blocked {
  position: relative;
  pointer-events: none;
}

.warden-blocked::after {
  content: '🚫 차단됨';
  position: absolute;
  inset: 0;
  background: rgba(255, 60, 60, 0.55);
  border-radius: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  backdrop-filter: blur(2px);
  animation: warden-fade-in 0.2s ease;
}

@keyframes warden-fade-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ── PetBot 메시지 스타일 ── */
.petbot-msg {
  padding: 2px 0;
}

.petbot-nick {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-prime, #6f48ff);
  margin-bottom: 3px;
}

.petbot-bubble {
  background: linear-gradient(135deg, rgba(111, 72, 255, 0.10), rgba(111, 72, 255, 0.04)) !important;
  border: 1px solid rgba(111, 72, 255, 0.2) !important;
  border-radius: 12px 12px 12px 3px !important;
  font-size: 12px !important; /* [v11.17] 14px -> 12px 축소 */
  line-height: 1.55;
  max-width: 80%;
  padding: 8px 12px;
}

/* ──────────────────────────────────────────────────────────────────
   [v11.17] 이모지 스케일링 및 AI/펫 말풍선 미학 개선
   기존 하드코딩된 3.5em/56px 스타일을 클래스 기반으로 전환하여 컨텍스트별 대응
   ────────────────────────────────────────────────────────────────── */

/* 기본 이모지 크기 (사용자 말풍선용 - 3.5배) */
.emo-uni { 
  font-size: 3.5em; 
}
.emo-custom { 
  height: 56px; 
}

/* AI 및 Argos 답변 최적화 (12px 기반) */
.ai-msg .msg-bubble {
  font-size: 13px !important;
  background: rgba(111, 72, 255, 0.1) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(111, 72, 255, 0.2);
  transition: all 0.3s ease;
}

/* [v11.18] 배경 밝기 감지 기반 동적 테마 (Argos AI & System) */
#chatArea[data-bg-brightness="light"] .ai-msg .msg-bubble {
  background: rgba(40, 20, 100, 0.75) !important; /* 진보라 글래시 */
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}
#chatArea[data-bg-brightness="light"] .system-msg {
  background: rgba(0, 0, 0, 0.6) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#chatArea[data-bg-brightness="dark"] .ai-msg .msg-bubble {
  background: rgba(255, 255, 255, 0.85) !important; /* 화이트 글래시 */
  color: #000000 !important;
  border: 1px solid rgba(111, 72, 255, 0.3);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}
#chatArea[data-bg-brightness="dark"] .system-msg {
  background: rgba(255, 255, 255, 0.7) !important;
  color: #000000 !important;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

/* AI/펫 답변 내 이모지 축소 (텍스트 수준 정렬) */
.ai-msg .emo-uni,
.petbot-msg .emo-uni {
  font-size: 1.15em; 
  vertical-align: middle;
}

.ai-msg .emo-custom,
.petbot-msg .emo-custom {
  height: 18px;
  vertical-align: middle;
}

/* ── PetBot 설정 폼 ── */
.petbot-settings {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.form-label-sm {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.input-sm {
  padding: 6px 10px;
  border: 1px solid var(--border-light);
  border-radius: 7px;
  background: var(--bg-input, var(--bg-primary));
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border 0.2s;
  width: 100%;
  box-sizing: border-box;
}

.input-sm:focus {
  border-color: var(--color-prime, #6f48ff);
}

/* ─── [v9.31] Pet 애니메이션 키프레임 ─── */
@keyframes petBounce {

  0%,
  100% {
    transform: translateY(0) rotate(-2deg) scale(1);
  }

  25% {
    transform: translateY(-6px) rotate(2deg) scale(1.05);
  }

  75% {
    transform: translateY(-3px) rotate(-1deg) scale(1.02);
  }
}

@keyframes petFloat {

  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  33% {
    transform: translateY(-10px) scale(1.06) rotate(3deg);
  }

  66% {
    transform: translateY(-5px) scale(1.03) rotate(-2deg);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* [v9.31] 소환된 플로팅 펫 등장 */
#floatingPet {
  display: none;
}

/* [v10.22] Meet 패널(z-index:1400) 위에 펫이 표시되도록 z-index 상향 */
#floatingPet.active {
  display: flex !important;
  z-index: 1500;
}

/* ─── [v9.34] 방송 시스템 UI ─── */

/* [v1.0] Chat Helper (Autocomplete & History) */
.helper-list {
  position: absolute;
  bottom: calc(100% + 15px);
  left: 0;
  width: 100%;
  background: rgba(20, 23, 33, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  display: none;
  z-index: 2000;
}

.helper-list.show {
  display: block;
  animation: helperSlideUp 0.25s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes helperSlideUp {
  from {
    transform: translateY(12px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.helper-header {
  padding: 8px 12px;
  font-size: 11px;
  color: var(--color-prime, #6f48ff);
  font-weight: 700;
  background: rgba(111, 72, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.h-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.h-item:hover,
.h-item.active {
  background: rgba(111, 72, 255, 0.15);
}

.h-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #333;
}

.h-icon {
  font-size: 18px;
  color: var(--color-prime, #6f48ff);
}

.h-info {
  flex: 1;
  min-width: 0;
}

.h-title {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.h-lv {
  font-size: 10px;
  background: var(--color-prime, #6f48ff);
  color: #fff;
  padding: 1px 4px;
  border-radius: 4px;
  margin-left: 4px;
}

.h-sub {
  font-size: 11px;
  color: var(--text-muted, #aaa);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 멘션 강조 (v1.8) - 테마 변수 기반 및 가독성 최적화 */
.msg.mentioned .msg-bubble {
  border: none !important; /* 사용자 요청: 테두리 없는 자연스러운 형태 */
  background: var(--mention-bg) !important;
  color: var(--mention-text) !important;
  backdrop-filter: blur(10px) saturate(180%);
  -webkit-backdrop-filter: blur(10px) saturate(180%);
  animation: mentionPulse 1.5s ease-in-out infinite;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  font-weight: 600;
}

/* [v1.8] 어두운 배경(이미지/다크모드)에서 글로우 효과 강화 */
#chatArea[data-bg-brightness="dark"] .msg.mentioned .msg-bubble {
  box-shadow: 0 0 20px var(--mention-glow);
}

@keyframes mentionPulse {
  0% { box-shadow: 0 0 12px var(--mention-glow); transform: scale(1); }
  50% { box-shadow: 0 0 45px var(--mention-glow), 0 0 15px var(--mention-glow); transform: scale(1.02); }
  100% { box-shadow: 0 0 12px var(--mention-glow); transform: scale(1); }
}

/* 선택 시 피드백 애니메이션 */
.h-item.h-pop {
  animation: hPop 0.2s ease-out forwards;
}

@keyframes hPop {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.8; }
  100% { transform: scale(1.1); opacity: 0; }
}


/* ════════════════════════════════════════════════════════════════
   LOBBY MOBILE — 하단 내비게이션 + 레이아웃 겹침 방지
   (lobby.html 전용, chat.html 클래스와 분리)
════════════════════════════════════════════════════════════════ */

/* 로비 모바일 하단 내비게이션 바 */
.lobby-mobile-nav {
  display: none;           /* 기본: 숨김 (PC) */
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg-footer);
  border-top: var(--border-main);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
  z-index: 200;
  justify-content: space-around;
  align-items: center;
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom); /* iPhone 홈바 대응 */
}

/* 로비 푸터 탭 버튼 */
.lobby-nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10px;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  position: relative;
  flex: 1;
  border-radius: var(--radius-sm);
  transition: color 0.15s;
  min-width: 0;
}
.lobby-nav-tab i {
  font-size: 20px;
  line-height: 1;
}
.lobby-nav-tab span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.lobby-nav-tab:hover,
.lobby-nav-tab:active {
  color: var(--color-prime);
}

/* 알림 뱃지 */
.lobby-nav-badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 20px);
  background: #e74c3c;
  color: #fff;
  border-radius: 50%;
  min-width: 16px;
  height: 16px;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  padding: 0 3px;
  font-weight: 700;
  pointer-events: none;
}

/* 모바일 검색 슬라이드 바 — PC에서는 항상 숨김, 모바일에서 JS로 토글 */
.lobby-mobile-search-bar {
  display: none;           /* 기본 숨김 (JS가 style.display='flex'로 토글) */
  flex-shrink: 0;          /* flex 컬럼에서 height 유지 */
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-surface);
  border-bottom: var(--border-main);
}
.lobby-mobile-search-bar i {
  color: var(--text-tertiary);
  font-size: 18px;
  flex-shrink: 0;
}
.lobby-mobile-search-bar input {
  flex: 1;
  background: var(--bg-input);
  border: var(--border-main);
  border-radius: var(--radius-full);
  padding: 6px 12px;
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
}
.lobby-search-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 20px;
  padding: 4px;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  /* 로비 모바일 푸터 표시 */
  .lobby-mobile-nav {
    display: flex;
  }

  /* ════════════════════════════════════════════════════
     lobby-page 전용 — chat.html과 완전 격리
     핵심: content = flex column, room-grid = 스크롤 영역
  ════════════════════════════════════════════════════ */

  /* 로비 툴바 — 모바일 숨김 (방만들기는 푸터로 이동) */
  .lobby-page .lobby-toolbar {
    display: none;
  }

  /* 카테고리 탭 — flex 컬럼에서 고정 높이 유지, sticky 불필요 */
  .lobby-page .category-tabs {
    flex-shrink: 0;
    background: var(--bg-body);
    padding: 5px 8px 4px;             /* 가로 여백 축소 */
    position: static; /* sticky 해제 — content가 overflow:hidden이라 sticky 불동작 */
    z-index: auto;
  }

  /* 카테고리 탭 버튼 — 모바일에서 패딩 축소 */
  .lobby-page .cat-tab {
    padding: 5px 10px;
    font-size: 11px;
  }

  /* ── room-grid: 스크롤 담당 + 2열 고정 ── */
  /* chat.css 상단의 1fr !important 를 높은 명시도로 재정의 */
  .lobby-page .room-grid {
    flex: 1;                          /* 카테고리 탭 아래 남은 공간 모두 차지 */
    min-height: 0;                    /* flex shrink 허용 (필수!) */
    overflow-y: auto;                 /* 여기서만 스크롤 */
    -webkit-overflow-scrolling: touch;
    grid-template-columns: repeat(2, 1fr) !important; /* 2열 고정 */
    gap: 12px;                        /* 가로·세로 동일 간격 */
    padding: 8px 10px 72px;          /* 하단 72px = 푸터(60px) + 여유 */
    align-items: stretch;             /* 같은 행 카드 높이 일치 (기본값 stretch) */
  }

  /* 사이드패널 — 패널 바디에 푸터 여백 (패널 열렸을 때 내용 안 가려짐) */
  .lobby-page .side-panel .panel-body {
    padding-bottom: 68px;
  }

  /* ── 모바일 카드 스타일 — 둥근 사각형, 내용 잘림 없음 ── */
  .lobby-page .room-card {
    border-radius: 16px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;           /* 내부 레이아웃 세로 정렬 */
  }
  /* 설명 텍스트: 최대 3줄 제한, 나머지 공간 채움 */
  .lobby-page .room-desc-sm {
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* 커버: 모바일에서 조금 낮게 */
  .lobby-page .room-cover {
    height: 72px;
  }

  /* 정보 영역: 패딩 조정 */
  .lobby-page .room-info {
    padding: 8px 10px 10px;
    gap: 4px;
  }

  /* 방 이름 — 줄바꿈 허용, 잘림 없음 */
  .lobby-page .room-name {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
    font-size: 12px;
    line-height: 1.4;
  }

  /* 방 설명 — 줄바꿈 허용, 잘림 없음 */
  .lobby-page .room-desc-sm {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    font-size: 11px;
    min-height: 0;
    line-height: 1.35;
  }

  /* 방장 행: 폰트 작게 */
  .lobby-page .room-host-row {
    margin-top: 6px;
    padding-top: 6px;
    gap: 5px;
  }
  .lobby-page .room-host-nick {
    white-space: normal;
    overflow-wrap: break-word;
    font-size: 10px;
  }
  .lobby-page .room-host-avatar {
    width: 20px;
    height: 20px;
  }
  .lobby-page .room-whisper-btn {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
  }

  /* 커버 배지들 — 2열 좁은 카드에서 크기 조정 */
  .lobby-page .category-badge {
    font-size: 8px;
    padding: 1px 6px;
  }
  .lobby-page .room-temp-badge,
  .lobby-page .room-members-badge {
    font-size: 10px;
    padding: 1px 5px;
  }
}