/* ─── CHAT PAGE ─── */
.chat-page {
  height: 100vh;
  padding-top: 60px;
  display: flex;
  flex-direction: column;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

/* ─── Header ─── */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(14,165,233,0.1);
  flex-shrink: 0;
}

.chat-header-left {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.chat-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--blue-2);
  letter-spacing: 0.04em;
}

.chat-online {
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.chat-rules-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}
.chat-rules-btn:hover {
  background: rgba(14,165,233,0.08);
  color: var(--blue-2);
}

/* ─── Messages container ─── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.chat-welcome {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}
.chat-welcome-sub {
  font-size: 0.75rem;
  margin-top: 0.4rem;
  opacity: 0.7;
}

/* ─── Single message ─── */
.msg {
  display: flex;
  flex-direction: column;
  padding: 0.6rem 0.85rem;
  border-radius: 10px;
  transition: background 0.2s;
  position: relative;
}
.msg:hover {
  background: rgba(14,165,233,0.04);
}

.msg-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.msg-alias {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--blue-3);
  letter-spacing: 0.03em;
}

.msg-alias.self {
  color: #34d399;
}

.msg-time {
  font-size: 0.65rem;
  color: var(--muted);
  opacity: 0.6;
  letter-spacing: 0.03em;
}

.msg-body {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.55;
  margin-top: 0.15rem;
  word-break: break-word;
}

/* ─── Message actions (hover) ─── */
.msg-actions {
  position: absolute;
  right: 0.5rem;
  top: 0.4rem;
  display: none;
  gap: 0.25rem;
}
.msg:hover .msg-actions {
  display: flex;
}

.msg-action-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: none;
  background: rgba(14,165,233,0.06);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s;
}
.msg-action-btn:hover {
  background: rgba(14,165,233,0.14);
  color: var(--blue-2);
}
.msg-action-btn.report-btn:hover {
  background: rgba(239,68,68,0.1);
  color: #ef4444;
}

/* ─── Reactions ─── */
.msg-reactions {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.3rem;
  flex-wrap: wrap;
}

.reaction-pill {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  border-radius: 50px;
  border: 1px solid rgba(14,165,233,0.12);
  background: rgba(14,165,233,0.04);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--muted);
}
.reaction-pill:hover {
  border-color: rgba(14,165,233,0.3);
  background: rgba(14,165,233,0.08);
}
.reaction-pill.active {
  border-color: rgba(56,189,248,0.4);
  background: rgba(56,189,248,0.1);
  color: var(--blue-2);
}

.reaction-emoji { font-size: 0.85rem; }
.reaction-count {
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}

/* ─── Reaction picker ─── */
.reaction-picker {
  display: none;
  position: absolute;
  right: 0.5rem;
  top: -2rem;
  background: var(--surface);
  border: 1px solid rgba(14,165,233,0.18);
  border-radius: 8px;
  padding: 0.3rem 0.4rem;
  gap: 0.15rem;
  z-index: 10;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.reaction-picker.open { display: flex; }

.reaction-pick {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  border-radius: 6px;
  border: none;
  background: none;
  transition: all 0.15s;
}
.reaction-pick:hover {
  background: rgba(14,165,233,0.1);
  transform: scale(1.2);
}

/* ─── Muted bar ─── */
.chat-muted-bar {
  padding: 0.75rem 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: #fbbf24;
  background: rgba(251,191,36,0.06);
  border-top: 1px solid rgba(251,191,36,0.15);
}

/* ─── Input ─── */
.chat-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem 1rem;
  border-top: 1px solid rgba(14,165,233,0.1);
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(14,165,233,0.18);
  background: rgba(14,165,233,0.04);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: all 0.2s;
}
.chat-input:focus {
  border-color: var(--blue-2);
  background: rgba(14,165,233,0.08);
}
.chat-input::placeholder {
  color: var(--muted);
}

.chat-send {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid rgba(14,165,233,0.3);
  background: rgba(14,165,233,0.1);
  color: var(--blue-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.chat-send:hover {
  background: rgba(14,165,233,0.2);
  border-color: var(--blue-2);
  box-shadow: 0 0 16px rgba(14,165,233,0.15);
}
.chat-send:active {
  transform: scale(0.95);
}

/* ─── Date divider ─── */
.chat-date-divider {
  text-align: center;
  font-size: 0.65rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.75rem 0;
  opacity: 0.6;
}

/* ─── Loading ─── */
.chat-loading {
  text-align: center;
  padding: 1rem;
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.06em;
}

/* ─── Rules list ─── */
.rules-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1rem;
}
.rules-list li {
  font-size: 0.82rem;
  color: var(--text);
  padding-left: 1.2rem;
  position: relative;
  line-height: 1.5;
}
.rules-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--blue-2);
}

/* ─── MOBILE ─── */
@media (max-width: 768px) {
  .chat-page {
    max-width: 100%;
  }
  .chat-header { padding: 0.75rem 1rem; }
  .chat-messages { padding: 0.75rem 1rem; }
  .chat-input-wrap { padding: 0.5rem 1rem 0.75rem; }
  .msg-actions { display: none !important; }
  .msg {
    -webkit-user-select: none;
    user-select: none;
  }
}
