* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #0f1117;
  color: #e6e6e6;
  height: 100vh;
  overflow: hidden;
}

/* 登录遮罩 */
.login-mask {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 30%, #1a1d29, #0a0b10);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.login-box {
  background: #171923;
  padding: 32px 28px;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  width: 320px;
  text-align: center;
}
.login-box h2 { margin-top: 0; }
.login-box input {
  width: 100%;
  padding: 10px 12px;
  margin: 14px 0;
  border-radius: 8px;
  border: 1px solid #30333f;
  background: #0f1117;
  color: #fff;
  font-size: 14px;
}
.login-box button {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg,#6a5cff,#00c2ff);
  color: #fff;
  font-weight: bold;
  cursor: pointer;
}
.error-text { color: #ff6b6b; font-size: 13px; min-height: 18px; }

/* 主体应用 */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: #171923;
  border-bottom: 1px solid #262a36;
}
.topbar .title { font-size: 18px; font-weight: bold; }
.topbar .actions button {
  background: #232636;
  border: none;
  color: #ddd;
  padding: 6px 12px;
  border-radius: 8px;
  margin-left: 8px;
  cursor: pointer;
}
.topbar .actions button:hover { background: #2f3346; }

.chat-window {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.msg {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg,#6a5cff,#8f7bff);
  color: #fff;
  border-bottom-right-radius: 2px;
}
.msg.assistant {
  align-self: flex-start;
  background: #232636;
  border-bottom-left-radius: 2px;
}
.msg img {
  max-width: 240px;
  border-radius: 8px;
  display: block;
  margin-top: 6px;
}
.msg.loading { opacity: 0.6; font-style: italic; }

.input-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 20px;
  background: #171923;
  border-top: 1px solid #262a36;
}
.upload-btn {
  font-size: 22px;
  cursor: pointer;
  padding: 6px 8px;
}
.image-preview-wrap {
  position: relative;
  width: 48px;
  height: 48px;
}
.image-preview-wrap img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
}
#remove-image {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #ff5252;
  color: #fff;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
#text-input {
  flex: 1;
  resize: none;
  max-height: 120px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #30333f;
  background: #0f1117;
  color: #fff;
  font-size: 14px;
  font-family: inherit;
}
#send-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg,#6a5cff,#00c2ff);
  color: #fff;
  font-weight: bold;
  cursor: pointer;
}
#send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* 记忆弹窗 */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.modal-content {
  background: #171923;
  padding: 24px;
  border-radius: 16px;
  width: 360px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
}
.memory-list {
  flex: 1;
  overflow-y: auto;
  margin: 12px 0;
  font-size: 13px;
}
.memory-list .memory-item {
  padding: 8px;
  border-bottom: 1px solid #262a36;
}
.memory-add { display: flex; gap: 6px; margin-bottom: 12px; }
.memory-add input {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #30333f;
  background: #0f1117;
  color: #fff;
  font-size: 13px;
  min-width: 0;
}
.memory-add button, .close-btn {
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  background: #6a5cff;
  color: #fff;
  cursor: pointer;
}
.close-btn { margin-top: 6px; background: #333747; }
