/* ─── Topic bar ──────────────────────────────────────────────── */
.topic-bar {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(16, 16, 26, 0.3);
  flex-shrink: 0;
  min-height: 2.5rem;
}

.topic-channel {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  flex-shrink: 0;
}
.topic-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.topic-edit-btn {
  font-size: 0.6875rem;
  color: var(--text-faint);
  padding: 0.1875rem 0.5rem;
  border: 1px solid var(--border-medium);
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
  background: none;
}
.topic-edit-btn:active { color: var(--accent); border-color: var(--border-active); }

.topic-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(122, 162, 247, 0.3);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
}

/* ─── Search bar ─────────────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(16, 16, 26, 0.3);
  flex-shrink: 0;
}
.search-bar input {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-medium);
  border-radius: 4px;
  padding: 0.375rem 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
}
.search-bar input:focus { border-color: var(--accent); }
#search-count {
  font-size: 0.6875rem;
  color: var(--text-muted);
  white-space: nowrap;
}
#search-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.125rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}

/* ─── Mode bar ───────────────────────────────────────────────── */
.mode-bar {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(16, 16, 26, 0.2);
  flex-shrink: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.mode-label {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-faint);
  margin-right: 0.25rem;
  flex-shrink: 0;
}
.mode-btn, .mode-btn-special {
  font-size: 0.6875rem;
  padding: 0.1875rem 0.5rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-medium);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: var(--font-mono);
}
.mode-btn.active {
  background: rgba(122, 162, 247, 0.12);
  border-color: var(--border-active);
  color: var(--accent);
}
.mode-btn:active, .mode-btn-special:active {
  background: rgba(255, 255, 255, 0.06);
}
.mode-separator {
  width: 1px;
  height: 1rem;
  background: var(--border-subtle);
  margin: 0 0.25rem;
  flex-shrink: 0;
}

/* ─── Messages ───────────────────────────────────────────────── */
.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-faint);
  font-size: 0.875rem;
}

.msg {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.25rem 0;
}

.msg-time {
  font-size: 0.625rem;
  color: var(--text-faint);
  font-family: var(--font-mono);
  flex-shrink: 0;
  padding-top: 0.25rem;
  min-width: 2rem;
}

.msg-avatar {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.6875rem;
  color: #fff;
  flex-shrink: 0;
}

.msg-body {
  flex: 1;
  min-width: 0;
}

.msg-nick {
  font-size: 0.8125rem;
  font-weight: 600;
  margin-right: 0.375rem;
}

.msg-text {
  font-size: 0.8125rem;
  color: var(--text-primary);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* System messages */
.msg-system {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0;
}
.msg-system-line {
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}
.msg-system-text {
  font-size: 0.6875rem;
  color: var(--text-faint);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Action messages */
.msg-action .msg-text {
  font-style: italic;
  color: var(--text-secondary);
}

/* Error messages */
.msg-error .msg-text {
  color: var(--red);
}

/* Notice messages */
.msg-notice .msg-nick {
  color: var(--yellow);
}

/* Highlight messages */
.msg-highlight {
  background: rgba(247, 118, 142, 0.08);
  border-left: 2px solid var(--red);
  padding-left: 0.5rem;
  border-radius: 2px;
}

/* Self messages */
.msg-self .msg-nick {
  color: var(--accent) !important;
}

/* ─── Mobile: compact timestamps ─────────────────────────────── */
@media (max-width: 639px) {
  .msg-time { display: none; }
  .msg-avatar { width: 1.5rem; height: 1.5rem; font-size: 0.625rem; }
}
