/* =========================================
   LinkAI - Refined Business Chat UI
   Design: Modern, Sophisticated, Wave-inspired
========================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;600;700&display=swap');

* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

:root {
  --primary: #0098d4;
  --primary-dark: #00689f;
  --primary-light: #e8f6fc;
  --primary-glow: rgba(0, 152, 212, 0.35);

  --accent: #ff7e29;
  --accent-light: #fff1e6;
  --accent-glow: rgba(255, 126, 41, 0.4);

  --bg: #f4f7fa;
  --bg-deep: #e8eef4;
  --surface: #ffffff;
  --surface-elevated: #ffffff;

  --side-bg: #1a2332;
  --side-bg-light: #243044;
  --side-bg-hover: #2d3b54;
  --side-text: #e2e8f0;
  --side-text-dim: #94a3b8;
  --side-border: rgba(255,255,255,0.06);

  --text: #1a2332;
  --text-body: #334155;
  --text-mute: #64748b;
  --text-faint: #94a3b8;

  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.10);
  --shadow-glow: 0 0 0 4px rgba(0, 152, 212, 0.12);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: 'Plus Jakarta Sans', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, "Hiragino Sans", sans-serif;
  margin: 0;
  height: 100vh;
  display: flex;
  background: var(--bg);
  color: var(--text-body);
  font-size: 14px;
  letter-spacing: -0.005em;
  overflow: hidden;
}

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

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes modal-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-rise {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 2px 8px var(--accent-glow); }
  50% { box-shadow: 0 2px 16px var(--accent-glow), 0 0 0 4px rgba(255, 126, 41, 0.15); }
}

@keyframes pickerFadeIn {
  from { opacity: 0; transform: translateY(4px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes highlightFlash {
  0% { box-shadow: 0 0 0 0 transparent; }
  10%, 70% {
    box-shadow: 0 0 0 3px rgba(255, 126, 41, 0.35),
                0 0 24px rgba(255, 126, 41, 0.35);
  }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* =========================================
   SIDEBAR
========================================= */
.sidebar {
  width: 272px;
  background: var(--side-bg);
  color: var(--side-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}
.sidebar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(180deg, transparent 0%, rgba(0,152,212,0.3) 50%, transparent 100%);
}

.sidebar-header {
  padding: 22px 22px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--side-border);
  position: relative;
  overflow: hidden;
}
.sidebar-header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -10%;
  width: 60%;
  height: 200%;
  background: radial-gradient(ellipse, rgba(0, 152, 212, 0.18) 0%, transparent 60%);
  pointer-events: none;
}
.logo-wave {
  font-size: 24px;
  color: var(--primary);
  display: inline-block;
  filter: drop-shadow(0 0 12px var(--primary-glow));
  animation: wave 3s ease-in-out infinite;
  z-index: 1;
}
.logo-text {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
  z-index: 1;
  position: relative;
}
.logo-text::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, var(--primary) 0%, transparent 100%);
  opacity: 0.6;
}

.user-info {
  padding: 14px 22px;
  border-bottom: 1px solid var(--side-border);
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0,0,0,0.18);
}
.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.15);
  position: relative;
}
.user-avatar::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid var(--side-bg);
}
.user-name {
  font-size: 14px;
  font-weight: 600;
  color: white;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 8px 0;
}
.section-title {
  padding: 14px 22px 6px;
  font-size: 10px;
  color: var(--side-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
}

.room-list {
  padding: 0 8px;
}
.room-item {
  padding: 9px 14px;
  margin-bottom: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: var(--transition);
  color: var(--side-text);
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  position: relative;
}
.room-item:hover {
  background: var(--side-bg-hover);
  color: white;
}
.room-item.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  font-weight: 600;
  box-shadow: 0 4px 12px var(--primary-glow);
}
.room-item.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px var(--primary-glow);
}

.add-room-btn {
  margin: 8px 16px;
  padding: 9px 12px;
  background: transparent;
  color: var(--side-text-dim);
  border: 1px dashed rgba(255,255,255,0.18);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: var(--transition);
  letter-spacing: 0.01em;
}
.add-room-btn:hover {
  background: rgba(0, 152, 212, 0.12);
  border-color: var(--primary);
  border-style: solid;
  color: white;
}

.user-list {
  padding: 0 8px 12px;
}
.user-list-item {
  padding: 8px 14px;
  margin-bottom: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 11px;
  transition: var(--transition);
  color: var(--side-text);
  font-size: 14px;
  border-radius: var(--radius-sm);
  position: relative;
}
.user-list-item:hover {
  background: var(--side-bg-hover);
  color: white;
}
.user-list-item.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  font-weight: 600;
  box-shadow: 0 4px 12px var(--primary-glow);
}
.user-list-item.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px var(--primary-glow);
}
.user-list-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.15);
}
.user-list-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.user-list-empty {
  padding: 10px 22px;
  font-size: 12px;
  color: var(--side-text-dim);
  font-style: italic;
}

.sidebar-scroll::-webkit-scrollbar {
  width: 5px;
}
.sidebar-scroll::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
}
.sidebar-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.2);
}

/* ROOM AVATARS */
.room-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.18);
  letter-spacing: -0.02em;
}
.room-item .room-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.room-item.active .room-avatar {
  box-shadow: 0 2px 8px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.25);
}

.header-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.18);
  letter-spacing: -0.02em;
}

/* =========================================
   MAIN AREA
========================================= */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
  position: relative;
}
.main::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(0, 152, 212, 0.04) 0%, transparent 70%);
  pointer-events: none;
}

.header {
  background: var(--surface);
  color: var(--text);
  padding: 18px 28px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  z-index: 2;
  box-shadow: var(--shadow-sm);
}

/* MESSAGES */
#messages {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
  list-style: none;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  z-index: 1;
}
#messages li {
  display: flex;
  flex-direction: column;
  max-width: 68%;
  animation: fadeInUp 0.3s ease-out;
}
#messages li.other {
  align-self: flex-start;
}
#messages li.self {
  align-self: flex-end;
  align-items: flex-end;
}

.name-label {
  font-size: 12px;
  margin-bottom: 5px;
  padding: 0 6px;
  font-weight: 700;
  letter-spacing: 0.005em;
}

.bubble-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  position: relative;
}
#messages li.self .bubble-wrapper {
  flex-direction: row-reverse;
}

.bubble {
  padding: 12px 16px;
  word-wrap: break-word;
  white-space: pre-wrap;
  line-height: 1.55;
  font-size: 14px;
  position: relative;
  letter-spacing: -0.003em;
}
#messages li.other .bubble {
  background: var(--surface);
  color: var(--text);
  border-radius: 4px 16px 16px 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
#messages li.self .bubble {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border-radius: 16px 4px 16px 16px;
  box-shadow: 0 4px 14px rgba(0, 152, 212, 0.22);
}

.time {
  font-size: 11px;
  color: var(--text-faint);
  white-space: nowrap;
  margin-bottom: 2px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.empty-message {
  text-align: center;
  color: var(--text-mute);
  margin: 60px auto;
  font-size: 14px;
  padding: 24px 32px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border);
  max-width: 320px;
  box-shadow: var(--shadow-sm);
}

/* FORM */
#form {
  background: var(--surface);
  padding: 16px 24px 20px;
  display: flex;
  gap: 12px;
  border-top: 1px solid var(--border);
  position: relative;
  z-index: 2;
  align-items: center;
}
#input {
  flex: 1;
  padding: 13px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 14px;
  outline: none;
  background: var(--bg);
  transition: var(--transition);
  font-family: inherit;
  letter-spacing: -0.003em;
}
#input::placeholder {
  color: var(--text-faint);
}
#input:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: var(--shadow-glow);
}
#input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button.send-btn {
  padding: 13px 26px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: var(--transition);
  box-shadow: 0 4px 12px var(--primary-glow);
  font-family: inherit;
}
button.send-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 152, 212, 0.35);
}
button.send-btn:active:not(:disabled) {
  transform: translateY(0);
}
button.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

#messages::-webkit-scrollbar {
  width: 10px;
}
#messages::-webkit-scrollbar-track {
  background: transparent;
}
#messages::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.1);
  border-radius: 5px;
  border: 2px solid var(--bg);
}
#messages::-webkit-scrollbar-thumb:hover {
  background: rgba(15, 23, 42, 0.2);
}

/* DELETE BUTTON */
.delete-btn {
  background: var(--surface);
  color: var(--text-mute);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 4px 11px;
  font-size: 11px;
  cursor: pointer;
  opacity: 0;
  transition: var(--transition);
  font-weight: 600;
  font-family: inherit;
  box-shadow: var(--shadow-sm);
}
#messages li:hover .delete-btn {
  opacity: 1;
}
.delete-btn:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* MENTION */
.mention {
  background: linear-gradient(180deg, transparent 55%, #fff3b0 55%, #ffeb6e 100%);
  color: var(--primary-dark);
  padding: 0 4px;
  border-radius: 2px;
  font-weight: 700;
  display: inline-block;
  margin: 0 1px;
  font-size: 0.96em;
  letter-spacing: -0.01em;
  box-shadow: none;
}
#messages li.self .mention {
  background: linear-gradient(180deg, transparent 55%, rgba(255, 240, 150, 0.7) 55%, rgba(255, 230, 100, 0.85) 100%);
  color: white;
  box-shadow: none;
}

#messages li.mentioned .bubble {
  background: linear-gradient(135deg, #fff5e6 0%, #ffe7d1 100%) !important;
  color: #7c4a1a !important;
  border: 2px solid var(--accent) !important;
  box-shadow: 0 4px 16px var(--accent-glow) !important;
}
#messages li.mentioned .name-label {
  color: var(--accent) !important;
}
#messages li.mentioned .name-label::after {
  content: " 🔔";
  filter: drop-shadow(0 0 4px var(--accent-glow));
}

/* UNREAD BADGE */
.unread-badge {
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  margin-left: auto;
  min-width: 22px;
  text-align: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px var(--accent-glow);
  letter-spacing: 0.02em;
  animation: badge-pulse 2s ease-in-out infinite;
}
.room-item.active .unread-badge,
.user-list-item.active .unread-badge {
  background: white;
  color: var(--accent);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  animation: none;
}

/* =========================================
   REPLY (返信機能)
========================================= */

/* 返信ボタン */
.reply-btn {
  background: var(--surface);
  color: var(--text-mute);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 4px 11px;
  font-size: 11px;
  cursor: pointer;
  opacity: 0;
  transition: var(--transition);
  font-weight: 600;
  font-family: inherit;
  box-shadow: var(--shadow-sm);
  margin-right: 4px;
}
#messages li:hover .reply-btn {
  opacity: 1;
}
.reply-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 2px 8px var(--primary-glow);
}

/* 返信元の表示 - 控えめな縦線スタイル(LINE WORKS 風) */
.reply-quote {
  display: block;
  font-size: 12px;
  padding: 2px 0 4px 10px;
  margin: 0 0 8px;
  background: transparent;
  border-left: 3px solid rgba(0, 152, 212, 0.45);
  border-radius: 0;
  color: var(--text-mute);
  max-width: 100%;
  line-height: 1.4;
  cursor: pointer;
  transition: opacity 0.15s ease;
  position: relative;
  opacity: 0.75;
}
.reply-quote:hover {
  opacity: 1;
  background: transparent;
}
.reply-quote:active {
  opacity: 1;
}

/* 自分のメッセージ内の引用 */
#messages li.self .reply-quote {
  background: transparent;
  border-left-color: rgba(255, 255, 255, 0.6);
  color: rgba(255, 255, 255, 0.85);
  opacity: 0.92;
}
#messages li.self .reply-quote:hover {
  opacity: 1;
  background: transparent;
}
#messages li.self .reply-quote:active {
  background: transparent;
}

.reply-quote-name {
  font-weight: 600;
  font-size: 11px;
  margin-bottom: 1px;
  letter-spacing: -0.005em;
  color: var(--primary-dark);
  opacity: 0.85;
}
#messages li.self .reply-quote-name {
  color: rgba(255, 255, 255, 0.92);
  opacity: 0.95;
}

.reply-quote-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  letter-spacing: -0.003em;
}

/* ジャンプ先メッセージのハイライト(3.5秒) */
#messages li.highlight-target .bubble {
  animation: highlightFlash 3.5s ease-in-out;
  position: relative;
  z-index: 2;
}

/* 入力欄上の返信先プレビュー */
.reply-preview {
  background: var(--primary-light);
  border-top: 1px solid var(--border);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideDown 0.2s ease-out;
}
.reply-preview-content {
  flex: 1;
  min-width: 0;
  border-left: 3px solid var(--primary);
  padding: 4px 0 4px 10px;
}
.reply-preview-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 2px;
  letter-spacing: 0.02em;
}
.reply-preview-text {
  font-size: 13px;
  color: var(--text-body);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reply-preview-text #reply-preview-name {
  font-weight: 600;
  color: var(--primary-dark);
}
.reply-cancel-btn {
  background: transparent;
  border: none;
  color: var(--text-mute);
  cursor: pointer;
  font-size: 18px;
  padding: 6px 10px;
  border-radius: 6px;
  font-weight: 500;
  transition: var(--transition);
}
.reply-cancel-btn:hover {
  background: rgba(0,0,0,0.06);
  color: var(--text);
}

/* =========================================
   REACTIONS
========================================= */
.reaction-btn {
  background: var(--surface);
  color: var(--text-mute);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 4px 9px;
  font-size: 13px;
  cursor: pointer;
  opacity: 0;
  transition: var(--transition);
  font-family: inherit;
  box-shadow: var(--shadow-sm);
  margin-right: 4px;
  line-height: 1;
}
#messages li:hover .reaction-btn {
  opacity: 1;
}
.reaction-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 2px 8px var(--primary-glow);
  transform: scale(1.05);
}

.reaction-picker {
  position: fixed;
  z-index: 100;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18),
              0 2px 8px rgba(15, 23, 42, 0.06);
  display: flex;
  gap: 2px;
  animation: pickerFadeIn 0.15s ease-out;
}
.reaction-pick-btn {
  background: transparent;
  border: none;
  padding: 6px 8px;
  font-size: 20px;
  cursor: pointer;
  border-radius: 8px;
  transition: var(--transition);
  line-height: 1;
}
.reaction-pick-btn:hover {
  background: var(--primary-light);
  transform: scale(1.2);
}
.reaction-pick-btn:active {
  transform: scale(1.1);
}

.reactions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
  padding: 0 4px;
}
#messages li.self .reactions-bar {
  justify-content: flex-end;
}
.reaction-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 600;
  color: var(--text-body);
  line-height: 1;
  user-select: none;
}
.reaction-chip:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.reaction-chip.self-reacted {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
}
.reaction-chip-emoji {
  font-size: 14px;
}
.reaction-chip-count {
  font-size: 11px;
  font-weight: 700;
  min-width: 8px;
  text-align: center;
}

/* =========================================
   ATTACHMENT
========================================= */
.attach-btn {
  width: 42px;
  height: 42px;
  background: var(--bg);
  color: var(--primary);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  font-size: 22px;
  font-weight: 300;
  transition: var(--transition);
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
  padding: 0;
}
.attach-btn:hover:not(:disabled) {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-color: var(--primary);
  transform: rotate(90deg);
}
.attach-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.attachment-preview {
  background: var(--primary-light);
  border-top: 1px solid var(--border);
  padding: 12px 24px;
  animation: slideDown 0.2s ease-out;
}
.attachment-preview-content {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
}
.attachment-preview-icon {
  font-size: 24px;
  flex-shrink: 0;
}
.attachment-preview-icon img {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  display: block;
}
.attachment-preview-info {
  flex: 1;
  min-width: 0;
}
.attachment-preview-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-preview-size {
  font-size: 11px;
  color: var(--text-mute);
  margin-top: 2px;
}
.attachment-cancel-btn {
  background: transparent;
  border: none;
  color: var(--text-mute);
  cursor: pointer;
  font-size: 18px;
  padding: 6px 10px;
  border-radius: 6px;
  transition: var(--transition);
  flex-shrink: 0;
}
.attachment-cancel-btn:hover {
  background: rgba(0,0,0,0.06);
  color: var(--text);
}

.message-attachment {
  margin-top: 8px;
  border-radius: 10px;
  overflow: hidden;
  max-width: 340px;
}
.message-attachment-image {
  display: block;
  max-width: 100%;
  max-height: 320px;
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--border);
}
.message-attachment-image:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
}

.message-attachment-file {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(0,0,0,0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  transition: var(--transition);
  max-width: 320px;
}
.message-attachment-file:hover {
  background: rgba(0,152,212,0.08);
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
#messages li.self .message-attachment-file {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.3);
  color: white;
}
#messages li.self .message-attachment-file:hover {
  background: rgba(255,255,255,0.22);
}
.message-attachment-icon {
  font-size: 28px;
  flex-shrink: 0;
  line-height: 1;
}
.message-attachment-info {
  flex: 1;
  min-width: 0;
}
.message-attachment-name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.message-attachment-size {
  font-size: 11px;
  opacity: 0.7;
  margin-top: 2px;
}

.image-viewer {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  cursor: zoom-out;
  animation: modal-fade 0.2s ease-out;
}
.image-viewer img {
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
  animation: modal-rise 0.3s ease-out;
}
.image-viewer-close {
  position: absolute;
  top: 24px;
  right: 32px;
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
  transition: var(--transition);
  backdrop-filter: blur(8px);
}
.image-viewer-close:hover {
  background: rgba(255,255,255,0.25);
  transform: scale(1.08);
}

/* =========================================
   MODAL (ユーザー登録モーダル)
========================================= */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: modal-fade 0.3s ease-out;
}
.modal-content {
  background: var(--surface);
  padding: 44px 40px 36px;
  border-radius: 20px;
  width: 440px;
  max-width: 90%;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.25),
              0 0 0 1px rgba(255,255,255,0.5) inset;
  text-align: center;
  animation: modal-rise 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}
.modal-content::before {
  content: '';
  position: absolute;
  top: -100px;
  left: -100px;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, var(--primary-light) 0%, transparent 70%);
  opacity: 0.7;
  pointer-events: none;
}
.modal-content::after {
  content: '';
  position: absolute;
  bottom: -80px;
  right: -80px;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, var(--accent-light) 0%, transparent 70%);
  opacity: 0.5;
  pointer-events: none;
}
.modal-content > * {
  position: relative;
  z-index: 1;
}
.modal-logo {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 32px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.modal-logo::before {
  content: '〰️';
  font-size: 28px;
  animation: wave 3s ease-in-out infinite;
}
.modal-content h2 {
  margin: 12px 0 6px;
  color: var(--text);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.modal-content p {
  color: var(--text-mute);
  margin: 6px 0 24px;
  font-size: 14px;
  line-height: 1.6;
}
.modal-content input {
  width: 100%;
  padding: 14px 18px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: 15px;
  margin-bottom: 14px;
  outline: none;
  transition: var(--transition);
  font-family: inherit;
  background: var(--bg);
}
.modal-content input:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: var(--shadow-glow);
}
.modal-content button {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 6px 16px var(--primary-glow);
  font-family: inherit;
  letter-spacing: 0.01em;
}
.modal-content button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 152, 212, 0.4);
}
.modal-content button:active {
  transform: translateY(0);
}
.modal-note {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 18px;
  font-style: italic;
  letter-spacing: 0.01em;
}

/* =========================================
   HAMBURGER MENU (スマホ用)
========================================= */
.hamburger-btn {
  display: none;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  padding: 6px;
  cursor: pointer;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.hamburger-btn span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: var(--transition);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 50;
  backdrop-filter: blur(2px);
  animation: modal-fade 0.2s ease-out;
}
.sidebar-overlay.visible {
  display: block;
}

/* =========================================
   RESPONSIVE - SMARTPHONE
========================================= */
@media (max-width: 768px) {
  body {
    font-size: 15px;
  }
  
  .hamburger-btn {
    display: flex;
  }
  
  .sidebar {
    position: fixed;
    top: 0;
    left: -288px;
    height: 100vh;
    width: 280px;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    box-shadow: 4px 0 24px rgba(0,0,0,0.2);
  }
  .sidebar.open {
    left: 0;
  }
  
  .header {
    padding: 14px 16px;
    font-size: 16px;
    gap: 12px;
  }
  
  #messages {
    padding: 16px 12px;
    gap: 12px;
  }
  
  #messages li {
    max-width: 85%;
  }
  
  .bubble {
    font-size: 15px;
    padding: 11px 14px;
  }
  
  .reaction-btn,
  .reply-btn,
  .delete-btn {
    opacity: 0.7;
    padding: 6px 12px;
    font-size: 12px;
  }
  
  .name-label {
    font-size: 13px;
  }
  
  #form {
    padding: 12px 12px 14px;
    gap: 8px;
  }
  #input {
    padding: 11px 16px;
    font-size: 15px;
  }
  button.send-btn {
    padding: 11px 20px;
    font-size: 14px;
  }
  .attach-btn {
    width: 38px;
    height: 38px;
    font-size: 20px;
  }
  
  .modal-content {
    padding: 32px 24px 28px;
    width: 92%;
  }
  .modal-content h2 {
    font-size: 20px;
  }
  
  .reaction-pick-btn {
    padding: 10px 12px;
    font-size: 24px;
  }
  
  .reply-preview {
    padding: 8px 16px;
  }
  
  .attachment-preview {
    padding: 10px 12px;
  }
  
  .reaction-chip {
    padding: 5px 11px;
    font-size: 13px;
  }
}

/* タッチデバイス */
@media (hover: none) {
  .reaction-btn,
  .reply-btn,
  .delete-btn {
    opacity: 0.5;
  }
}

/* iPhone セーフエリア */
@supports (padding: max(0px)) {
  #form {
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }
}

/* =========================================
   THEME SWITCHER (テーマ切り替え機能)
========================================= */

/* ヘッダー右側のアクションエリア */
.header-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

/* テーマ切り替えボタン */
.theme-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  font-size: 18px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.theme-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  transform: rotate(15deg);
}

/* テーマ選択メニュー */
.theme-menu {
  position: fixed;
  top: 70px;
  right: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.18),
              0 4px 12px rgba(15, 23, 42, 0.08);
  z-index: 1000;
  min-width: 280px;
  animation: pickerFadeIn 0.18s ease-out;
}
.theme-menu-header {
  padding: 8px 12px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 4px;
}
.theme-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  text-align: left;
}
.theme-option:hover {
  background: var(--bg);
}
.theme-option-preview {
  width: 44px;
  height: 32px;
  border-radius: 6px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.theme-preview-line {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}
.theme-preview-line::after {
  content: '';
  position: absolute;
  left: 4px;
  bottom: 4px;
  width: 18px;
  height: 10px;
  background: white;
  border-radius: 3px 3px 3px 0;
}
.theme-preview-chatwork {
  background: #ffffff;
}
.theme-preview-chatwork::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 5px;
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
}
.theme-preview-chatwork::after {
  content: '';
  position: absolute;
  left: 16px;
  top: 7px;
  right: 4px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  box-shadow: 0 7px 0 var(--border-light);
}
.theme-option-info {
  flex: 1;
  min-width: 0;
}
.theme-option-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1px;
}
.theme-option-desc {
  font-size: 11px;
  color: var(--text-mute);
}
.theme-option-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  opacity: 0;
  transform: scale(0.5);
  transition: var(--transition);
}
.theme-option.active .theme-option-check {
  opacity: 1;
  transform: scale(1);
}
.theme-option.active {
  background: var(--primary-light);
}

/* =========================================
   CHATWORK THEME (Chatwork風スタイル)
========================================= */

/* Chatwork テーマ時のメッセージレイアウト */
.theme-chatwork #messages {
  padding: 0;
  gap: 0;
  background: var(--surface);
}

.theme-chatwork #messages li {
  max-width: 100%;
  align-self: stretch !important;
  align-items: stretch !important;
  flex-direction: row;
  padding: 14px 24px;
  gap: 12px;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface);
  transition: background 0.15s ease;
  animation: fadeInUp 0.2s ease-out;
}
.theme-chatwork #messages li:hover {
  background: #fafbfc;
}
.theme-chatwork #messages li.mentioned {
  background: linear-gradient(90deg, rgba(255, 126, 41, 0.06) 0%, transparent 100%);
  border-left: 3px solid var(--accent);
  padding-left: 21px;
}

/* アバター(Chatwork は左に表示、message-sender-avatar を流用) */
.theme-chatwork #messages li::before {
  display: none; /* 旧仕様の疑似要素アバターは廃止 */
}

.theme-chatwork .message-sender-avatar {
  display: flex !important; /* Chatwork でも表示する */
  width: 40px;
  height: 40px;
  border-radius: 8px;
  font-size: 14px;
  margin-right: 4px;
}

/* 吹き出しを廃止、フラットなブロックに */
.theme-chatwork .bubble-wrapper {
  flex: 1;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 4px;
  min-width: 0;
}

/* メッセージヘッダー(名前+時間) */
.theme-chatwork .name-label {
  display: inline-flex !important;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 4px;
  padding: 0;
}
.theme-chatwork .name-label::after {
  content: var(--message-time, '');
}

/* 吹き出しのスタイルを完全リセット */
.theme-chatwork .bubble {
  background: transparent !important;
  color: var(--text) !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 2px 0 !important;
  font-size: 14px;
  line-height: 1.65;
}

/* 時間表示を名前の横へ */
.theme-chatwork .time {
  display: inline-block;
  font-size: 12px;
  color: var(--text-faint);
  font-weight: 400;
  margin: 0 0 0 4px;
}

/* 自分のメッセージも左寄せ(背景だけ違う) */
.theme-chatwork #messages li.self {
  background: #f0f7fb;
}
.theme-chatwork #messages li.self:hover {
  background: #e8f4fa;
}
.theme-chatwork #messages li.self .bubble {
  color: var(--text) !important;
  background: transparent !important;
}

/* メンション(Chatwork 風の薄いハイライト) */
.theme-chatwork .mention {
  background: rgba(255, 235, 110, 0.5) !important;
  color: var(--primary-dark) !important;
  padding: 1px 5px !important;
  border-radius: 3px !important;
  font-weight: 600 !important;
}
.theme-chatwork li.self .mention {
  background: rgba(255, 235, 110, 0.7) !important;
  color: var(--primary-dark) !important;
}

/* 引用ブロック - Chatwork 風 */
.theme-chatwork .reply-quote {
  background: rgba(0, 0, 0, 0.04) !important;
  border-left: 3px solid var(--primary) !important;
  border-radius: 4px !important;
  padding: 6px 10px !important;
  margin: 4px 0 8px !important;
  color: var(--text-mute) !important;
  font-size: 12px !important;
  opacity: 1 !important;
}
.theme-chatwork .reply-quote:hover {
  background: rgba(0, 0, 0, 0.06) !important;
}
.theme-chatwork li.self .reply-quote {
  background: rgba(0, 0, 0, 0.04) !important;
  border-left-color: var(--primary) !important;
  color: var(--text-mute) !important;
}
.theme-chatwork .reply-quote-name {
  color: var(--primary-dark) !important;
  opacity: 1 !important;
  font-weight: 700 !important;
  font-size: 11px !important;
}
.theme-chatwork li.self .reply-quote-name {
  color: var(--primary-dark) !important;
}

/* ボタン類(Chatwork は右上にコンパクトに) */
.theme-chatwork .bubble-wrapper .time {
  /* 名前の横にあるので消す */
  display: none;
}
.theme-chatwork .reaction-btn,
.theme-chatwork .reply-btn,
.theme-chatwork .delete-btn {
  position: absolute;
  top: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  opacity: 0;
}
.theme-chatwork #messages li:hover .reaction-btn,
.theme-chatwork #messages li:hover .reply-btn,
.theme-chatwork #messages li:hover .delete-btn {
  opacity: 1;
}
.theme-chatwork .reaction-btn { right: 100px; }
.theme-chatwork .reply-btn { right: 50px; }
.theme-chatwork .delete-btn { right: 20px; }

/* リアクションは下にチップ表示 */
.theme-chatwork .reactions-bar {
  margin-top: 6px;
  padding: 0;
  justify-content: flex-start !important;
}

/* 添付ファイル(画像も控えめに) */
.theme-chatwork .message-attachment-image {
  max-height: 240px;
  max-width: 320px;
}

/* メンション通知の見た目 */
.theme-chatwork #messages li.mentioned .bubble {
  background: transparent !important;
  color: var(--text) !important;
  border: none !important;
  box-shadow: none !important;
}
.theme-chatwork #messages li.mentioned .name-label {
  color: var(--accent) !important;
}

/* テーマメニューのスマホ対応 */
@media (max-width: 768px) {
  .theme-menu {
    right: 12px;
    left: 12px;
    min-width: auto;
    top: 64px;
  }
  .theme-chatwork #messages li {
    padding: 12px 14px;
    gap: 10px;
  }
  .theme-chatwork #messages li::before {
    width: 36px;
    height: 36px;
  }
}

/* =========================================
   COLOR PRESETS (配色テーマ)
========================================= */

/* === Forest Green 🌿 === */
body.color-forest {
  --primary: #10b981;
  --primary-dark: #047857;
  --primary-light: #ecfdf5;
  --primary-glow: rgba(16, 185, 129, 0.35);
  --accent: #f59e0b;
  --accent-light: #fef3c7;
  --accent-glow: rgba(245, 158, 11, 0.4);
  --side-bg: #1c2e26;
  --side-bg-light: #2a4035;
  --side-bg-hover: #364f43;
}

/* === Sunset Orange 🌅 === */
body.color-sunset {
  --primary: #f97316;
  --primary-dark: #c2410c;
  --primary-light: #fff7ed;
  --primary-glow: rgba(249, 115, 22, 0.35);
  --accent: #8b5cf6;
  --accent-light: #f3f0ff;
  --accent-glow: rgba(139, 92, 246, 0.4);
  --side-bg: #2a1f1a;
  --side-bg-light: #3a2d25;
  --side-bg-hover: #4a3b30;
}

/* === Royal Purple 💜 === */
body.color-purple {
  --primary: #8b5cf6;
  --primary-dark: #6d28d9;
  --primary-light: #f5f3ff;
  --primary-glow: rgba(139, 92, 246, 0.35);
  --accent: #ec4899;
  --accent-light: #fdf2f8;
  --accent-glow: rgba(236, 72, 153, 0.4);
  --side-bg: #1f1a2e;
  --side-bg-light: #2d2640;
  --side-bg-hover: #3d3450;
}

/* === Midnight Dark 🌙 === */
body.color-midnight {
  --primary: #3b82f6;
  --primary-dark: #1d4ed8;
  --primary-light: #1e293b;
  --primary-glow: rgba(59, 130, 246, 0.45);
  --accent: #fbbf24;
  --accent-light: #422f00;
  --accent-glow: rgba(251, 191, 36, 0.5);
  --bg: #0f1117;
  --bg-deep: #060810;
  --surface: #1a1d2e;
  --surface-elevated: #232843;
  --side-bg: #0a0d14;
  --side-bg-light: #14182a;
  --side-bg-hover: #1c2237;
  --side-text: #e5e7eb;
  --side-text-dim: #94a3b8;
  --side-border: rgba(255,255,255,0.08);
  --text: #f1f5f9;
  --text-body: #cbd5e1;
  --text-mute: #94a3b8;
  --text-faint: #64748b;
  --border: #2d3548;
  --border-light: #232a3d;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

/* Midnight 専用調整 */
body.color-midnight #messages li.other .bubble {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
body.color-midnight .header {
  background: var(--surface);
}
body.color-midnight #form {
  background: var(--surface);
}
body.color-midnight #input {
  background: var(--bg);
  color: var(--text);
}
body.color-midnight .modal-content {
  background: var(--surface);
}
body.color-midnight .modal-content h2 {
  color: var(--text);
}
body.color-midnight .modal-content input {
  background: var(--bg);
  color: var(--text);
}
body.color-midnight .reaction-picker,
body.color-midnight .theme-menu,
body.color-midnight .reaction-chip,
body.color-midnight .reaction-btn,
body.color-midnight .reply-btn,
body.color-midnight .delete-btn {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
body.color-midnight .reply-preview,
body.color-midnight .attachment-preview {
  background: var(--surface-elevated);
}
body.color-midnight .add-room-btn {
  color: var(--side-text-dim);
}
body.color-midnight .empty-message {
  background: var(--surface);
  color: var(--text-mute);
}
body.color-midnight.theme-chatwork #messages li {
  background: var(--surface);
  border-bottom-color: var(--border);
}
body.color-midnight.theme-chatwork #messages li:hover {
  background: var(--surface-elevated);
}
body.color-midnight.theme-chatwork #messages li.self {
  background: rgba(59, 130, 246, 0.08);
}

/* =========================================
   COLOR PRESET SELECTOR (色選択メニュー)
========================================= */

.theme-menu-section {
  border-top: 1px solid var(--border-light);
  margin-top: 6px;
  padding-top: 6px;
}

.color-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  text-align: left;
}
.color-option:hover {
  background: var(--bg);
}
.color-option.active {
  background: var(--primary-light);
}

.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.2);
}
.color-swatch.color-blue {
  background: linear-gradient(135deg, #0098d4 0%, #00689f 100%);
}
.color-swatch.color-forest {
  background: linear-gradient(135deg, #10b981 0%, #047857 100%);
}
.color-swatch.color-sunset {
  background: linear-gradient(135deg, #f97316 0%, #c2410c 100%);
}
.color-swatch.color-purple {
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
}
.color-swatch.color-midnight {
  background: linear-gradient(135deg, #1a1d2e 0%, #0a0d14 100%);
  border: 1px solid #2d3548;
}
.color-swatch.color-midnight::after {
  content: '✨';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
}

.color-option-info {
  flex: 1;
  min-width: 0;
}
.color-option-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1px;
}
.color-option-desc {
  font-size: 11px;
  color: var(--text-mute);
}
.color-option-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  opacity: 0;
  transform: scale(0.5);
  transition: var(--transition);
}
.color-option.active .color-option-check {
  opacity: 1;
  transform: scale(1);
}

/* =========================================
   AI THINKING ANIMATION (考え中表示)
========================================= */
.ai-thinking-bubble {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px 16px 16px 16px;
  box-shadow: var(--shadow-sm);
}

.ai-thinking-dot {
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
  animation: thinkingPulse 1.4s ease-in-out infinite;
  opacity: 0.5;
}
.ai-thinking-dot:nth-child(2) {
  animation-delay: 0.2s;
}
.ai-thinking-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes thinkingPulse {
  0%, 80%, 100% {
    transform: scale(0.7);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* AI が考え中のリストアイテム全体 */
#messages li.ai-thinking {
  align-self: flex-start;
  animation: fadeInUp 0.3s ease-out;
}
#messages li.ai-thinking .name-label {
  color: var(--primary);
}

/* Chatwork テーマでも対応 */
.theme-chatwork .ai-thinking-bubble {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 4px 0;
}

/* Midnight テーマでも対応 */
body.color-midnight .ai-thinking-bubble {
  background: var(--surface);
  border-color: var(--border);
}

/* =========================================
   READ RECEIPT (既読表示)
========================================= */

/* 既読数表示(自分のメッセージの下) */
.read-receipt {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 4px;
  padding: 0 8px;
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
  align-self: flex-end;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.read-receipt:hover {
  color: var(--primary);
}
.read-receipt-icon {
  font-size: 10px;
}

/* 自分のメッセージ用(右寄せ) */
#messages li.self .read-receipt {
  align-self: flex-end;
}

/* Chatwork テーマ用 */
.theme-chatwork .read-receipt {
  margin-top: 2px;
  font-size: 11px;
}

/* DM での既読/未読表示 */
.read-receipt.dm-read {
  color: var(--primary);
}
.read-receipt.dm-unread {
  color: var(--text-faint);
}

/* =========================================
   READERS MODAL (既読者一覧)
========================================= */
.readers-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1500;
  animation: modal-fade 0.2s ease-out;
}
.readers-modal-content {
  background: var(--surface);
  border-radius: 16px;
  width: 380px;
  max-width: 92%;
  max-height: 70vh;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.25);
  animation: modal-rise 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}
.readers-modal-header {
  padding: 18px 22px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
}
.readers-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.readers-modal-close {
  background: transparent;
  border: none;
  color: var(--text-mute);
  cursor: pointer;
  font-size: 20px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: var(--transition);
}
.readers-modal-close:hover {
  background: rgba(0,0,0,0.06);
  color: var(--text);
}
.readers-modal-body {
  overflow-y: auto;
  flex: 1;
  padding: 8px 0;
}
.readers-section-title {
  padding: 12px 22px 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.reader-item {
  padding: 8px 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text);
}
.reader-item-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.reader-item-name {
  flex: 1;
  font-weight: 500;
}
.reader-item-status {
  font-size: 11px;
  color: var(--text-faint);
}
.reader-item.unread .reader-item-name {
  color: var(--text-faint);
}

/* =========================================
   AI STATUS INDICATOR (ヘッダーの状態表示)
========================================= */
.ai-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mute);
  cursor: default;
  transition: var(--transition);
}
.ai-status-indicator.online {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.3);
  color: #16a34a;
}
.ai-status-indicator.offline {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.3);
  color: #dc2626;
}

.ai-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
  position: relative;
}
.ai-status-indicator.online .ai-status-dot {
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
  animation: ai-dot-pulse 2s ease-in-out infinite;
}
.ai-status-indicator.offline .ai-status-dot {
  background: #ef4444;
}
@keyframes ai-dot-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6); }
  50% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}

.ai-status-text {
  letter-spacing: 0.02em;
}

/* =========================================
   AI TOGGLE SWITCH (設定メニュー内のスイッチ)
========================================= */
.ai-toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
}
.ai-toggle-info {
  flex: 1;
  min-width: 0;
}
.ai-toggle-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.ai-toggle-desc {
  font-size: 11px;
  color: var(--text-mute);
}
.ai-toggle-desc.enabled {
  color: #16a34a;
  font-weight: 600;
}
.ai-toggle-desc.disabled {
  color: #dc2626;
  font-weight: 600;
}

/* スイッチ本体 */
.ai-toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
  cursor: pointer;
}
.ai-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.ai-toggle-slider {
  position: absolute;
  inset: 0;
  background: #cbd5e1;
  border-radius: 26px;
  transition: var(--transition);
}
.ai-toggle-slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.ai-toggle-switch input:checked + .ai-toggle-slider {
  background: var(--primary);
}
.ai-toggle-switch input:checked + .ai-toggle-slider::before {
  transform: translateX(22px);
}

.ai-toggle-note {
  padding: 4px 12px 8px;
  font-size: 10px;
  color: var(--text-faint);
  font-style: italic;
  letter-spacing: 0.02em;
}

/* AI停止中のメッセージ表示用 */
.ai-disabled-banner {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(239, 68, 68, 0.04) 100%);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #dc2626;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  margin: 0 24px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ai-disabled-banner::before {
  content: '⚠️';
}

/* =========================================
   AI STATUS INDICATOR (ヘッダーの状態表示)
========================================= */

/* =========================================
   LOGOUT BUTTON
========================================= */
.logout-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  font-size: 18px;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-decoration: none;
  color: var(--text-mute);
}
.logout-btn:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.3);
  color: #dc2626;
}

/* =========================================
   返信引用ブロック - コンパクト版(LINE WORKS 風)
   ※ 既存の .reply-quote を上書き
========================================= */
#messages .bubble .reply-quote {
  display: block;
  font-size: 11px;
  padding: 1px 0 1px 8px;
  margin: -2px 0 4px;
  background: transparent;
  border-left: 2px solid rgba(0, 152, 212, 0.5);
  border-radius: 0;
  color: var(--text-mute);
  max-width: 100%;
  line-height: 1.3;
  cursor: pointer;
  transition: opacity 0.15s ease;
  opacity: 0.75;
}
#messages .bubble .reply-quote:hover {
  opacity: 1;
}
#messages li.self .bubble .reply-quote {
  border-left-color: rgba(255, 255, 255, 0.55);
  color: rgba(255, 255, 255, 0.85);
  opacity: 0.9;
}

#messages .bubble .reply-quote-name {
  font-weight: 600;
  font-size: 10.5px;
  margin-bottom: 0;
  line-height: 1.3;
  color: var(--primary-dark);
  opacity: 0.9;
  display: block;
}
#messages li.self .bubble .reply-quote-name {
  color: rgba(255, 255, 255, 0.95);
}

#messages .bubble .reply-quote-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  line-height: 1.3;
  display: block;
  max-width: 280px;
}

/* バブル本体のパディングも少し詰める(返信ありメッセージで効く) */
#messages li .bubble {
  padding: 9px 14px;
}

/* =========================================
   文字装飾(Markdown 風)
========================================= */
.msg-bold {
  font-weight: 700;
}
.msg-italic {
  font-style: italic;
}
.msg-strike {
  text-decoration: line-through;
  opacity: 0.75;
}
.msg-code {
  font-family: 'SF Mono', 'Monaco', 'Consolas', 'Courier New', monospace;
  font-size: 0.88em;
  background: rgba(15, 23, 42, 0.08);
  color: #c7254e;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  word-break: break-all;
}
#messages li.self .msg-code {
  background: rgba(255, 255, 255, 0.18);
  color: #fff8dc;
  border-color: rgba(255, 255, 255, 0.25);
}
body.color-midnight .msg-code {
  background: rgba(255, 255, 255, 0.08);
  color: #f9a8d4;
  border-color: rgba(255, 255, 255, 0.1);
}

/* =========================================
   自動リンク
========================================= */
.msg-link {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-color: rgba(0, 152, 212, 0.4);
  text-underline-offset: 2px;
  word-break: break-all;
  transition: var(--transition);
}
.msg-link:hover {
  text-decoration-color: var(--primary);
  color: var(--primary-dark);
}
#messages li.self .msg-link {
  color: #ffffff;
  text-decoration-color: rgba(255, 255, 255, 0.6);
}
#messages li.self .msg-link:hover {
  text-decoration-color: #ffffff;
  color: #ffffff;
  filter: brightness(1.1);
}

/* =========================================
   ハッシュタグ
========================================= */
.msg-hashtag {
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  padding: 0 1px;
  border-radius: 3px;
  transition: var(--transition);
}
.msg-hashtag:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
}
#messages li.self .msg-hashtag {
  color: #ffffff;
  text-shadow: 0 0 1px rgba(255, 255, 255, 0.3);
}
#messages li.self .msg-hashtag:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}
body.color-midnight .msg-hashtag:hover {
  background: rgba(59, 130, 246, 0.18);
}

/* =========================================
   返信枠の高さ問題の根本対策
   white-space: pre-wrap が引用ブロック前後の改行を空白化していたため、
   引用ブロックを inline-block 化せず、bubble の white-space を制御する
========================================= */

/* 返信引用ブロックを使う場合、bubble の white-space を normal に上書きしてから、
   本文だけを pre-wrap で囲む方式へ。ただし既存実装に影響しないよう、
   引用ブロック自体を改行スペースから隔離する */
#messages .bubble .reply-quote {
  display: block;
  margin: 0 0 4px;
  padding: 1px 0 1px 8px;
  border-left: 2px solid rgba(0, 152, 212, 0.5);
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-mute);
  opacity: 0.8;
  cursor: pointer;
  white-space: normal;  /* ← 重要:親の pre-wrap を打ち消す */
  max-width: 100%;
}
#messages .bubble .reply-quote:hover {
  opacity: 1;
}
#messages li.self .bubble .reply-quote {
  border-left-color: rgba(255, 255, 255, 0.55);
  color: rgba(255, 255, 255, 0.88);
  opacity: 0.92;
}

#messages .bubble .reply-quote-name {
  display: block;
  font-weight: 600;
  font-size: 10.5px;
  line-height: 1.3;
  color: var(--primary-dark);
  margin: 0;
}
#messages li.self .bubble .reply-quote-name {
  color: rgba(255, 255, 255, 0.95);
}

#messages .bubble .reply-quote-text {
  display: block;
  font-size: 11.5px;
  line-height: 1.3;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 280px;
}

/* =========================================
   日付セパレータ(中央配置・ピル型バッジ)
========================================= */
#messages li.date-separator {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center !important;
  max-width: 100% !important;
  width: 100%;
  margin: 8px 0 4px;
  padding: 0;
  animation: fadeInUp 0.3s ease-out;
  background: transparent;
  pointer-events: none; /* バッジ以外をクリックさせない */
}

#messages li.date-separator::before,
#messages li.date-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--border) 30%,
    var(--border) 70%,
    transparent 100%
  );
}

.date-separator-label {
  display: inline-block;
  padding: 5px 16px;
  margin: 0 12px;
  background: var(--surface);
  color: var(--text-mute);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  pointer-events: auto;
}

/* 「今日」の日付セパレータは少し強調 */
.date-separator-label.today {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-color: rgba(0, 152, 212, 0.25);
  font-weight: 700;
}

/* Chatwork テーマ用調整(li の padding が効いてしまうため上書き) */
.theme-chatwork #messages li.date-separator {
  padding: 12px 0 !important;
  background: transparent !important;
  border-bottom: none !important;
}
.theme-chatwork #messages li.date-separator::before,
.theme-chatwork #messages li.date-separator::after {
  background: var(--border-light);
}
.theme-chatwork #messages li.date-separator:hover {
  background: transparent !important;
}

/* Midnight テーマ用 */
body.color-midnight .date-separator-label {
  background: var(--surface-elevated);
  color: var(--text-mute);
  border-color: var(--border);
}
body.color-midnight .date-separator-label.today {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.3);
}

/* スマホ */
@media (max-width: 768px) {
  .date-separator-label {
    font-size: 11px;
    padding: 4px 14px;
  }
  #messages li.date-separator {
    margin: 6px 0 2px;
  }
}

/* =========================================
   アバター画像対応(Google プロフィール画像)
========================================= */

/* 画像入りアバターの共通処理 */
.has-image {
  position: relative;
  overflow: hidden;
}
.has-image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
  display: block;
}
.has-image .avatar-initial {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  color: white;
  font-weight: 700;
}
/* 画像読み込み失敗時(img が display:none になる)、頭文字を表示 */
.has-image img[style*="display: none"] + .avatar-initial,
.has-image img[style*="display:none"] + .avatar-initial {
  z-index: 3;
}

/* user-avatar(サイドバー左上、40px)で has-image の場合のサイズ */
.user-avatar.has-image .avatar-initial {
  font-size: 15px;
}

/* user-list-avatar(DM一覧、28px)用 */
.user-list-avatar.has-image .avatar-initial {
  font-size: 12px;
}

/* reader-item-avatar(既読モーダル、32px)用 */
.reader-item-avatar.has-image .avatar-initial {
  font-size: 13px;
}

/* =========================================
   メッセージ送信者の名前ヘッダー(アバター付き)
========================================= */
.message-sender-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  padding: 0 4px;
}

.message-sender-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 11px;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.18);
  background-size: cover;
  background-position: center;
  letter-spacing: -0.02em;
  position: relative;
  overflow: hidden;
}

.message-sender-header .name-label {
  margin-bottom: 0;
  padding: 0;
}

/* =========================================
   グループ設定:管理者用⚙️ボタン
========================================= */
.room-settings-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  padding: 2px 6px;
  cursor: pointer;
  border-radius: 4px;
  opacity: 0;
  transition: var(--transition);
  margin-left: 4px;
}
.room-item:hover .room-settings-btn {
  opacity: 1;
}
.room-settings-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  transform: scale(1.1);
}

/* 非管理者には完全に非表示 */
body:not(.is-admin) .room-settings-btn {
  display: none !important;
}

/* ロビー(is-special)は特別マーキング(右に小さい★) */
.room-item.is-special .room-name::after {
  content: ' ★';
  font-size: 9px;
  color: rgba(255, 215, 0, 0.7);
  font-weight: 700;
}

/* =========================================
   グループ設定モーダル(メンバー管理)
========================================= */
.room-settings-modal,
.room-create-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1500;
  animation: modal-fade 0.2s ease-out;
}

.room-settings-content {
  background: var(--surface);
  border-radius: 16px;
  width: 480px;
  max-width: 92%;
  max-height: 85vh;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.25);
  animation: modal-rise 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}
.room-settings-header {
  padding: 18px 22px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
}
.room-settings-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.room-settings-close {
  background: transparent;
  border: none;
  color: var(--text-mute);
  cursor: pointer;
  font-size: 20px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: var(--transition);
}
.room-settings-close:hover {
  background: rgba(0,0,0,0.06);
  color: var(--text);
}
.room-settings-body {
  overflow-y: auto;
  flex: 1;
  padding: 14px 22px 18px;
}

.settings-section {
  margin-bottom: 20px;
}
.settings-section:last-child {
  margin-bottom: 0;
}
.settings-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.add-member-search,
.create-room-search {
  margin-bottom: 8px;
}
.add-member-search input,
.create-room-search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  background: var(--bg);
  transition: var(--transition);
}
.add-member-search input:focus,
.create-room-search:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: var(--shadow-glow);
}

.members-list,
.add-member-list,
.create-members-list {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg);
}
.member-item,
.add-member-item,
.create-member-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  cursor: default;
}
.member-item:last-child,
.add-member-item:last-child,
.create-member-item:last-child {
  border-bottom: none;
}
.create-member-item {
  cursor: pointer;
  transition: var(--transition);
}
.create-member-item:hover {
  background: var(--primary-light);
}
.create-member-check {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

.member-item-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.member-item-info {
  flex: 1;
  min-width: 0;
}
.member-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}
.member-item-email {
  font-size: 11px;
  color: var(--text-mute);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-badge {
  background: var(--primary);
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.02em;
}
.member-self-mark {
  font-size: 11px;
  color: var(--text-mute);
  font-style: italic;
}
.member-remove-btn,
.member-add-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-mute);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
  flex-shrink: 0;
  font-family: inherit;
}
.member-remove-btn:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.member-add-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px var(--primary-glow);
}
.member-empty {
  padding: 16px;
  text-align: center;
  color: var(--text-mute);
  font-size: 12px;
  font-style: italic;
}

.create-room-name-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  background: var(--bg);
  transition: var(--transition);
}
.create-room-name-input:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: var(--shadow-glow);
}

.create-room-submit-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 12px var(--primary-glow);
  font-family: inherit;
}
.create-room-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 152, 212, 0.35);
}

.settings-danger {
  border-top: 1px solid var(--border-light);
  padding-top: 16px;
  margin-top: 8px;
}
.delete-room-btn {
  width: 100%;
  padding: 10px;
  background: transparent;
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}
.delete-room-btn:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.5);
}

/* 非管理者には新規グループ作成ボタンを非表示 */
body:not(.is-admin) .add-room-btn {
  display: none;
}

/* Midnight テーマ用 */
body.color-midnight .room-settings-content {
  background: var(--surface);
}
body.color-midnight .members-list,
body.color-midnight .add-member-list,
body.color-midnight .create-members-list {
  background: var(--bg);
  border-color: var(--border);
}
body.color-midnight .member-item-name {
  color: var(--text);
}
body.color-midnight .member-remove-btn,
body.color-midnight .create-room-name-input,
body.color-midnight .add-member-search input,
body.color-midnight .create-room-search {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
}

@media (max-width: 768px) {
  .room-settings-content {
    width: 95%;
    max-height: 90vh;
  }
  .room-settings-body {
    padding: 12px 16px 16px;
  }
}

/* =========================================
   ヘッダーのルーム名 + 説明文(強化版)
   既存スタイルとの競合を避けるため詳細度を上げて上書き
========================================= */

/* room-title は flex で横に「アイコン + テキスト枠」を並べる */
.header #room-title,
header #room-title,
#room-title {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  min-width: 0;
  flex: 1;
}

/* テキスト枠は縦に「タイトル / 説明文」を並べる */
#room-title .room-title-text {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: center;
  min-width: 0;
  gap: 2px;
  line-height: 1.2;
}

/* タイトル(大きく、太く) */
#room-title .room-title-name {
  display: block !important;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}

/* 説明文(小さく、薄く、別の行に) */
#room-title .room-description {
  display: block !important;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-mute);
  letter-spacing: 0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  line-height: 1.3;
  margin-top: 1px;
}

/* スマホ */
@media (max-width: 768px) {
  #room-title .room-title-name {
    font-size: 15px;
  }
  #room-title .room-description {
    font-size: 11px;
  }
}

/* Midnight テーマ */
body.color-midnight #room-title .room-title-name {
  color: var(--text);
}
body.color-midnight #room-title .room-description {
  color: var(--text-mute);
}
/* === LINE風テーマ: 自分の発言ではアバター+名前を非表示(従来通り) === */
body.theme-line #messages li.self .message-sender-header {
  display: none;
}

/* === 引用ブロック === */
.msg-quote {
  margin: 6px 0;
  padding: 4px 12px;
  border-left: 3px solid var(--border, #ddd);
  color: var(--text-mute, #777);
  background: rgba(0, 0, 0, 0.025);
  border-radius: 0 4px 4px 0;
  white-space: pre-wrap;
}
body.theme-linkai .msg-quote {
  border-left-color: var(--ink-5, #ccc);
  background: rgba(0, 152, 212, 0.04);
  color: var(--ink-3);
}


/* === コードブロック === */
.msg-codeblock {
  margin: 8px 0;
  padding: 10px 12px;
  background: #f6f8fa;
  border: 1px solid #e1e4e8;
  border-radius: 6px;
  overflow-x: auto;
  position: relative;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 13px;
  line-height: 1.5;
}
.msg-codeblock code {
  background: transparent;
  padding: 0;
  border: none;
  white-space: pre;
  display: block;
  color: #24292e;
}
.msg-codeblock-lang {
  display: block;
  font-size: 11px;
  color: #888;
  margin-bottom: 6px;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  user-select: none;
}
body.theme-linkai .msg-codeblock {
  background: var(--bg-app, #f8fafc);
  border-color: var(--border, #e2e8f0);
}
body.theme-linkai .msg-codeblock code {
  color: var(--ink-1);
}

/* === textarea (入力欄) の見た目 === */
#input {
  resize: none;
  font-family: inherit;
  line-height: 1.5;
  min-height: 38px;
  max-height: 160px;
  overflow-y: hidden;
  vertical-align: middle;
}

/* ========== ルームメンバー表示(ヘッダー内) ========== */
.room-members-display {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  margin-right: 12px;
  padding: 4px 10px;
  border-radius: 16px;
  background: var(--surface-muted, rgba(0,0,0,0.04));
  cursor: pointer;
  transition: background 0.15s ease;
  user-select: none;
}
.room-members-display:hover {
  background: var(--surface-hover, rgba(0,0,0,0.08));
}
.room-members-avatars {
  display: flex;
  align-items: center;
}
.room-members-avatars .room-member-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--bg-color, #fff);
  margin-left: -8px;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
}
.room-members-avatars .room-member-avatar:first-child {
  margin-left: 0;
}
.room-members-count {
  font-size: 13px;
  color: var(--text-color, #333);
  font-weight: 500;
  white-space: nowrap;
}

/* モバイル時の調整 */
@media (max-width: 768px) {
  .room-members-display {
    padding: 4px 8px;
    margin-right: 8px;
  }
  .room-members-count {
    display: none; /* スマホでは人数表記を省略 */
  }
  .room-members-avatars .room-member-avatar {
    width: 22px;
    height: 22px;
    font-size: 10px;
  }
}

/* メンバー一覧モーダル */
.members-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.members-modal-content {
  background: var(--bg-color, #fff);
  border-radius: 12px;
  width: 90%;
  max-width: 420px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.members-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color, #e0e0e0);
}
.members-modal-title {
  font-size: 16px;
  font-weight: 600;
}
.members-modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-mute, #888);
  padding: 4px 8px;
}
.members-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.members-modal-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
}
.members-modal-item:hover {
  background: var(--surface-hover, rgba(0,0,0,0.04));
}
.members-modal-item-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background-size: cover;
  background-position: center;
}
.members-modal-item-name {
  flex: 1;
  font-size: 14px;
}
.members-modal-item-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--accent-color, #0098d4);
  color: #fff;
}

/* ========== メッセージ編集・削除表示 ========== */

/* 削除済みメッセージ(トゥームストーン) */
.bubble-deleted {
  color: var(--text-mute, #888);
  font-style: italic;
  background: var(--surface-muted, rgba(0,0,0,0.03));
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px dashed var(--border-subtle, rgba(0,0,0,0.1));
  user-select: none;
}
#messages li.deleted .msg-actions,
#messages li.deleted .reactions-bar,
#messages li.deleted .read-receipt {
  display: none !important;
}

/* 「(編集済み)」ラベル(薄色) */
.edited-label {
  margin-left: 6px;
  font-size: 11px;
  color: var(--text-mute, #888);
  opacity: 0.7;
  font-style: italic;
}

/* 返信引用元が削除済み */
.reply-quote-deleted .reply-quote-text {
  font-style: italic;
  color: var(--text-mute, #888);
  opacity: 0.7;
}

/* インライン編集モード */
.message-edit-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
  width: 100%;
}
.message-edit-textarea {
  width: 100%;
  min-height: 60px;
  padding: 8px 12px;
  border: 1px solid var(--accent-color, #0098d4);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  box-sizing: border-box;
  background: var(--bg-color, #fff);
  color: var(--text-color, #333);
}
.message-edit-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.message-edit-actions button {
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid var(--border-color, #ccc);
  background: var(--bg-color, #fff);
}
.message-edit-actions .message-edit-save {
  background: var(--accent-color, #0098d4);
  color: #fff;
  border-color: var(--accent-color, #0098d4);
}
.message-edit-actions button:hover {
  opacity: 0.85;
}
.message-edit-hint {
  font-size: 11px;
  color: var(--text-mute, #888);
}

/* ========== メッセージ編集・削除済み表示 ========== */

/* 編集ボタン(削除ボタンと同じスタイルに統一) */
.edit-btn {
  background: var(--surface);
  color: var(--text-mute);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 4px 11px;
  font-size: 11px;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s ease;
}
li:hover .edit-btn,
li:focus-within .edit-btn {
  opacity: 1;
}
.edit-btn:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* 削除済みメッセージ(トゥームストーン) */
.message-deleted .bubble {
  color: var(--text-mute, #888) !important;
  font-style: italic;
  background: var(--surface-muted, rgba(0,0,0,0.03)) !important;
  border: 1px dashed var(--border-light, rgba(0,0,0,0.1)) !important;
  background-image: none !important;
}
.message-deleted .bubble::before {
  content: "🗑 ";
  opacity: 0.5;
}
/* 削除済みメッセージは余計な装飾を全部消す */
.message-deleted .reply-quote,
.message-deleted .message-attachment,
.message-deleted .message-attachment-file,
.message-deleted .reactions-bar,
.message-deleted .msg-actions {
  display: none !important;
}

/* インライン編集中のUI */
.message-editing .bubble {
  padding: 8px !important;
}
.message-editing-textarea {
  width: 100%;
  min-height: 60px;
  border: 1px solid var(--accent-color, #0098d4);
  border-radius: 6px;
  padding: 6px 8px;
  font-family: inherit;
  font-size: inherit;
  resize: vertical;
  background: var(--bg-color, #fff);
  color: var(--text-color, #333);
  box-sizing: border-box;
}
.message-editing-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  justify-content: flex-end;
}
.message-editing-save,
.message-editing-cancel {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid transparent;
}
.message-editing-save {
  background: var(--accent-color, #0098d4);
  color: #fff;
  border-color: var(--accent-color, #0098d4);
}
.message-editing-save:hover {
  opacity: 0.85;
}
.message-editing-cancel {
  background: transparent;
  color: var(--text-mute, #888);
  border-color: var(--border-color, #ddd);
}
.message-editing-cancel:hover {
  background: var(--surface-hover, rgba(0,0,0,0.06));
}
.message-editing-hint {
  font-size: 11px;
  color: var(--text-faint, #aaa);
  margin-top: 4px;
}

/* ============================================================
   メンション補完ポップアップ(v3.9で追加)
   ============================================================ */
.mention-popup {
  position: absolute;
  bottom: 70px;
  left: 60px;
  max-width: 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  padding: 4px 0;
  z-index: 1000;
  overflow-y: auto;
  max-height: 240px;
}
.mention-popup[hidden] {
  display: none;
}
.mention-popup-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  cursor: pointer;
  transition: background-color 0.1s ease;
  font-size: 13px;
}
.mention-popup-item:hover {
  background: var(--primary-light);
}
.mention-popup-item.selected {
  background: var(--primary-light);
  font-weight: 600;
}
.mention-popup-item-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
  font-weight: 600;
}
.mention-popup-item-name {
  flex: 1;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* @all メンション専用スタイル(v3.9で追加)*/
.mention-popup-item-avatar-all {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==== グループ名・サブタイトル変更モーダル(v3.11) ==== */
.rename-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: renameModalFade 0.15s ease-out;
}

@keyframes renameModalFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.rename-modal-content {
  background: white;
  border-radius: 12px;
  padding: 0;
  width: 90%;
  max-width: 440px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.rename-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #eee;
}

.rename-modal-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.rename-modal-close {
  background: none;
  border: none;
  color: #888;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
}

.rename-modal-close:hover {
  color: #333;
  background: #f0f0f0;
}

.rename-modal-body {
  padding: 20px;
}

.rename-modal-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #444;
  margin-bottom: 6px;
}

.rename-modal-label:not(:first-child) {
  margin-top: 16px;
}

.rename-modal-hint {
  font-weight: 400;
  color: #888;
  font-size: 11px;
}

.rename-modal-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  color: #333;
  box-sizing: border-box;
  transition: border-color 0.15s;
}

.rename-modal-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 152, 212, 0.15);
}

.rename-modal-error {
  margin-top: 12px;
  padding: 8px 12px;
  background: #fdecec;
  color: #c2311d;
  border-radius: 6px;
  font-size: 13px;
}

.rename-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid #eee;
  background: #fafafa;
}

.rename-modal-cancel,
.rename-modal-save {
  padding: 8px 20px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.rename-modal-cancel {
  background: #f4f4f4;
  color: #555;
}

.rename-modal-cancel:hover {
  background: #e8e8e8;
}

.rename-modal-save {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
}

.rename-modal-save:hover:not(:disabled) {
  box-shadow: 0 4px 12px var(--primary-glow);
  transform: translateY(-1px);
}

.rename-modal-save:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ==== ヘッダーの編集ボタン(グループ名の隣) ==== */
.room-edit-btn {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  padding: 6px 8px;
  border-radius: 6px;
  color: #666;
  opacity: 0.6;
  transition: all 0.15s;
  flex-shrink: 0;
}

.room-edit-btn:hover {
  opacity: 1;
  background: #f0f0f0;
  color: var(--primary);
}

/* ============================================
   Composer Toolbar (v3.12 block 1: skeleton)
   ============================================ */

.composer-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: var(--bg-secondary, rgba(0, 0, 0, 0.03));
  border-top: 1px solid var(--border-color, rgba(0, 0, 0, 0.08));
  border-bottom: 1px solid var(--border-color, rgba(0, 0, 0, 0.08));
  min-height: 36px;
  flex-wrap: wrap;
}

.composer-toolbar-placeholder {
  font-size: 12px;
  color: var(--text-muted, #888);
  opacity: 0.7;
  font-style: italic;
}

.composer-toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-color, inherit);
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  transition: background 0.15s ease, transform 0.1s ease;
}

.composer-toolbar-btn:hover:not(:disabled) {
  background: var(--primary-glow, rgba(99, 102, 241, 0.12));
  transform: translateY(-1px);
}

.composer-toolbar-btn:active:not(:disabled) {
  transform: translateY(0);
}

.composer-toolbar-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.composer-toolbar-divider {
  width: 1px;
  height: 18px;
  background: var(--border-color, rgba(0, 0, 0, 0.15));
  margin: 0 4px;
}

@media (max-width: 600px) {
  .composer-toolbar {
    padding: 4px 8px;
    min-height: 32px;
  }
  .composer-toolbar-btn {
    width: 26px;
    height: 26px;
    font-size: 13px;
  }
}

/* ============================================
   Emoji Picker (v3.12 block 4)
   ============================================ */
.emoji-picker {
  position: fixed;
  z-index: 1000;
  display: none;
  flex-wrap: wrap;
  gap: 4px;
  padding: 10px;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, rgba(0, 0, 0, 0.1));
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  width: 280px;
  max-height: 240px;
  overflow-y: auto;
}
.emoji-pick-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease, transform 0.1s ease;
}
.emoji-pick-btn:hover {
  background: var(--primary-glow, rgba(99, 102, 241, 0.12));
  transform: scale(1.15);
}
.emoji-pick-btn:active {
  transform: scale(1.0);
}
body.color-midnight .emoji-picker {
  background: var(--surface);
  border-color: var(--border);
}
