/* THOMZY.com — fun chat (loult-style) styles. Cohabits with panels.css. */

.fun-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 12px;
}
@media (max-width: 900px) { .fun-grid { grid-template-columns: 1fr; } }

.chat-shell { display: flex; flex-direction: column; flex: 1; min-height: 0; }

.chat-toolbar {
  display: flex; gap: 6px; align-items: center; flex-wrap: nowrap;
  padding: 4px 0 8px;
  border-bottom: 1px dashed rgba(255,255,255,0.18);
  flex-shrink: 0;
  overflow: visible;
}
.chat-toolbar .vol { width: 100px; }

.chat-list {
  flex: 1; min-height: 0; max-height: none;
  overflow-y: auto; padding: 8px 6px;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  font-family: 'Lucida Console', Monaco, monospace;
  font-size: 13px; line-height: 1.45;
}
.chat-msg { margin: 1px 0; word-wrap: break-word; }
.chat-msg-ts { color: #888; font-size: 11px; margin-right: 4px; }

.chat-day-sep {
  display: flex; align-items: center; gap: 8px;
  margin: 10px 4px 6px;
  color: #666; font-size: 11px; user-select: none;
}
.chat-day-sep::before, .chat-day-sep::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.15));
}
.chat-day-sep::after { background: linear-gradient(to left, transparent, rgba(255,255,255,0.15)); }
.chat-day-sep-label { white-space: nowrap; padding: 0 4px; text-transform: capitalize; }
.chat-msg-who { font-weight: bold; cursor: pointer; }
.chat-msg-who:hover { text-decoration: underline; }
.chat-msg-link { color: #7eb8f7; text-decoration: underline; word-break: break-all; }
.chat-msg-link:hover { color: #aad4ff; }
.chat-emote { height: 1.6em; width: auto; vertical-align: middle; margin: 0 1px; image-rendering: auto; }
.chat-msg-me .chat-msg-body { font-style: italic; color: #ffe066; }
.chat-msg-bot .chat-msg-body { font-style: italic; color: #66e0ff; }
.chat-msg-system { color: #ff66cc; font-style: italic; opacity: 0.85; }
.chat-msg-pm .chat-msg-body { color: #ffaaff; }

/* @mention pill */
.chat-msg-mention {
  display: inline;
  background: rgba(88, 101, 242, 0.25);
  color: #99aab5;
  border-radius: 3px;
  padding: 0 3px;
  font-weight: 600;
  cursor: pointer;
}
.chat-msg-mention-me {
  background: rgba(250, 166, 26, 0.3);
  color: #faa61a;
}
/* whole row highlighted when you're mentioned */
.chat-msg-mentioned {
  background: rgba(250, 166, 26, 0.06);
  border-left: 3px solid #faa61a;
  padding-left: 5px;
  margin-left: -5px;
  border-radius: 2px;
}

/* @mention autocomplete popup */
.chat-mention-popup {
  position: fixed;
  background: #0a0a0f;
  border: 1px solid rgba(0, 229, 255, 0.3);
  border-radius: 4px;
  padding: 4px 0;
  z-index: 9999;
  min-width: 160px;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 -6px 16px rgba(0,0,0,0.7);
  font-family: 'Lucida Console', Monaco, monospace;
  font-size: 12px;
}
.chat-mention-item {
  padding: 4px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #ccc;
  white-space: nowrap;
}
.chat-mention-item.active,
.chat-mention-item:hover { background: rgba(0, 229, 255, 0.12); color: #fff; }
.chat-mention-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.chat-form { display: flex; gap: 4px; margin-top: 8px; flex-shrink: 0; }
.chat-form input { flex: 1; padding: 6px 8px; font-family: inherit; }
.chat-form button { padding: 6px 14px; }

/* Emote picker */
.chat-emote-wrap { position: relative; display: flex; }
.chat-form-wrap { position: relative; flex-shrink: 0; width: 100%; }
.chat-emote-picker {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  z-index: 600;
  background: #0a0a0f;
  border: 1px solid rgba(0, 229, 255, 0.3);
  border-radius: 6px;
  padding: 6px;
  box-shadow: 0 -6px 20px rgba(0,0,0,0.8);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
}
.chat-emote-picker[hidden] { display: none; }
.chat-emote-item {
  cursor: pointer;
  border-radius: 4px;
  padding: 3px;
  transition: background 0.1s;
  line-height: 1;
}
.chat-emote-item:hover { background: rgba(0, 229, 255, 0.15); }
.chat-emote-item img { height: 28px; width: auto; display: block; vertical-align: middle; }
#chat-emote-btn { padding: 6px 8px; font-size: 15px; line-height: 1; }

.chat-users {
  display: flex; flex-direction: column; gap: 2px;
  max-height: 60vh; overflow-y: auto; padding: 4px;
  font-family: 'Lucida Console', Monaco, monospace; font-size: 12px;
}
.chat-user { display: flex; align-items: center; gap: 6px; padding: 2px 4px; border-radius: 3px; }
.chat-user:hover { background: rgba(255,255,255,0.06); cursor: pointer; }
.chat-user-me { background: rgba(255,255,255,0.08); }
.chat-user-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; box-shadow: 0 0 4px currentColor; }
.chat-user-mod { color: gold; }
.chat-user-muted { color: #888; }
.chat-user-fx { font-size: 11px; }

.settings-wrap { position: relative; }
.chat-settings {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;           /* aligns to right edge of the ⚙ button, opens leftward */
  left: auto;
  z-index: 500;
  width: min(280px, calc(100vw - 20px));
  background: #0a0a0f;
  border: 2px dashed var(--cyan, #00e5ff);
  border-radius: 6px;
  padding: 8px 4px;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.7);
}
.chat-settings:empty { display: none; }

/* compact user list in stats panel (header — horizontal row, never overflows) */
.chat-users-stat {
  display: flex; flex-direction: row; flex-wrap: nowrap;
  align-items: center; gap: 4px;
  font-family: 'Lucida Console', Monaco, monospace; font-size: 11px;
  overflow: hidden; max-width: 300px;
}
.chat-users-stat:empty { display: none; }
.chat-users-stat .chat-user {
  padding: 0 3px;
  flex-shrink: 1;
  min-width: 0;
  max-width: 90px;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}
.chat-users-stat .chat-user-dot { display: none; }
.chat-users-stat .chat-user-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 80px;
  color: var(--user-color);
  font-size: 15px;
  font-weight: bold;
}
.chat-users-stat .chat-user-fx {
  display: block;
  font-size: 10px;
  line-height: 1;
  opacity: 0.75;
}
.chat-set-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; min-width: 0; }
.chat-set-h { font-size: 12px; margin: 8px 0 4px; color: var(--cyan, #66e0ff); }
.chat-pseudo-input, .chat-voice-select { padding: 4px 6px; flex: 1; min-width: 0; font-family: inherit; box-sizing: border-box; }
.chat-fx-block { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.chat-fx-toggle { display: flex; align-items: center; gap: 4px; font-size: 12px; cursor: pointer; padding: 2px; }
.chat-fx-toggle:hover { background: rgba(255,255,255,0.06); }
.chat-slider-lbl { width: 46px; flex-shrink: 0; font-size: 11px; color: #aaa; }
.chat-voice-slider { flex: 1; accent-color: var(--cyan, #00e5ff); cursor: pointer; }
.chat-slider-val { width: 28px; text-align: right; font-size: 11px; color: var(--cyan, #00e5ff); flex-shrink: 0; }

/* ---- PM tab bar ---------------------------------------------------------- */
.chat-tab-bar {
  display: flex; gap: 2px; flex-wrap: nowrap; overflow-x: auto;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  padding-bottom: 2px; margin-bottom: 4px; flex-shrink: 0;
}
.chat-tab {
  padding: 3px 10px; font-size: 11px; font-family: inherit;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
  border-bottom: none; border-radius: 4px 4px 0 0;
  cursor: pointer; color: #aaa; white-space: nowrap; flex-shrink: 0;
}
.chat-tab.active { background: rgba(0,229,255,0.1); color: #00e5ff; border-color: rgba(0,229,255,0.25); }
.chat-tab.unread { color: #ff66cc; }
.chat-tab-close { margin-left: 6px; opacity: 0.5; font-size: 10px; vertical-align: middle; }
.chat-tab-close:hover { opacity: 1; }
.chat-pane { display: none; flex: 1; min-height: 0; flex-direction: column; }
.chat-pane.active { display: flex; }

/* Mini-panel mirror on the home view */
.chat-mini { font-family: 'Lucida Console', Monaco, monospace; font-size: 12px; }
.chat-mini-list {
  max-height: 140px; overflow-y: auto; padding: 4px;
  background: rgba(0,0,0,0.3); border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.08);
}
.chat-mini-list .chat-msg { font-size: 11px; }
.chat-mini-actions { margin-top: 6px; text-align: center; }
