:root {
  --bg: #0f0f13; --bg2: #17171d; --card: #1e1e26;
  --bubble-her: #26262f; --bubble-me: #3b6ea5;
  --text: #e5e5ea; --muted: #6a6a78; --accent: #ff7a9c;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text);
  height: 100vh; display: flex; justify-content: center;
}
.chat-container {
  width: 100%; max-width: 500px; height: 100vh;
  display: flex; flex-direction: column; background: var(--bg);
}

/* 顶部 */
.chat-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; background: var(--bg2);
  border-bottom: 1px solid #22222c; flex-shrink: 0;
}
.header-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, #3a3a4a, #26262f);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; border: 2px solid var(--accent);
}
.header-name { font-size: 16px; font-weight: 600; }
.header-status { font-size: 12px; color: #4ade80; }
.header-activity {
  margin-left: auto; font-size: 11px; color: var(--muted);
  text-align: right; max-width: 140px; line-height: 1.4;
}

/* 消息区 */
.chat-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: #333; border-radius: 2px; }

.msg-day {
  text-align: center; font-size: 12px; color: var(--muted);
  margin: 8px 0;
}

.msg { display: flex; gap: 8px; max-width: 85%; }
.msg.her { align-self: flex-start; }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; background: var(--card);
}
.msg.her .msg-avatar { border: 1.5px solid var(--accent); }
.msg-body {
  padding: 10px 14px; border-radius: 16px;
  font-size: 15px; line-height: 1.6; word-wrap: break-word;
}
.msg.her .msg-body { background: var(--bubble-her); border-top-left-radius: 4px; }
.msg.me .msg-body { background: var(--bubble-me); border-top-right-radius: 4px; color: #fff; }

/* 照片消息 */
.msg-photo {
  max-width: 240px; border-radius: 14px; overflow: hidden;
  cursor: pointer; border: 1px solid #333;
}
.msg-photo img { width: 100%; display: block; }
.msg-photo-caption {
  font-size: 12px; color: var(--muted); margin-top: 4px; padding: 0 4px;
}

/* 打字中 */
.typing { display: flex; gap: 4px; padding: 12px 16px; }
.typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted); animation: bounce 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* 照片生成中 */
.photo-loading {
  width: 240px; height: 240px; border-radius: 14px;
  background: var(--card); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px;
  color: var(--muted); font-size: 13px;
}
.photo-loading .spinner {
  width: 26px; height: 26px; border: 2px solid #333;
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 输入区 */
.chat-input {
  display: flex; gap: 10px; padding: 12px 16px 20px;
  background: var(--bg2); border-top: 1px solid #22222c;
  align-items: flex-end; flex-shrink: 0;
}
.chat-input textarea {
  flex: 1; padding: 12px 16px; background: var(--card);
  border: 1px solid #2a2a35; border-radius: 22px;
  color: var(--text); font-size: 15px; font-family: inherit;
  resize: none; outline: none; max-height: 100px; line-height: 1.4;
}
.chat-input textarea:focus { border-color: var(--accent); }
.chat-input button {
  width: 68px; height: 44px; border-radius: 22px;
  background: var(--accent); border: 0; color: #fff;
  font-size: 15px; font-weight: 600; cursor: pointer;
  flex-shrink: 0;
}
.chat-input button:disabled { opacity: .4; }
