/* ===== 导航栏：认证按钮与用户区 ===== */
.nav-actions { display: flex; gap: 10px; align-items: center; margin-left: 18px; }
.nav-user { display: flex; align-items: center; gap: 12px; margin-left: 18px; }
.user-name { font-size: .92rem; color: var(--text); font-weight: 600; }
.btn-sm { padding: 8px 16px; font-size: .88rem; }
@media (max-width: 768px) {
  .nav-actions { margin-left: 0; }
  .nav-user { margin-left: 0; }
  .user-name { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ===== 注册/登录弹窗 ===== */
.auth-overlay {
  position: fixed; inset: 0; z-index: 200; display: none;
  align-items: center; justify-content: center;
  background: rgba(4, 6, 10, .72); backdrop-filter: blur(6px); padding: 20px;
}
.auth-modal {
  position: relative; width: 100%; max-width: 400px;
  background: var(--card); border: 1px solid var(--border); border-radius: 20px;
  padding: 32px 28px 28px; box-shadow: 0 24px 64px rgba(0,0,0,.5);
  animation: modalIn .25s cubic-bezier(.16,1,.3,1);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.97); } }
.auth-modal h2 { font-size: 1.4rem; margin-bottom: 20px; text-align: center; }
.auth-close {
  position: absolute; top: 12px; right: 14px; background: none; border: none;
  color: var(--text-dim); font-size: 1.6rem; line-height: 1; cursor: pointer; padding: 4px 8px;
}
.auth-close:hover { color: var(--text); }
.auth-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.auth-field > span { font-size: .85rem; color: var(--text-dim); font-weight: 600; }
.auth-field input {
  background: rgba(255,255,255,.04); border: 1px solid var(--border); border-radius: 999px;
  color: var(--text); padding: 12px 24px; font-size: 1rem; outline: none; font-family: inherit;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}
.auth-field input:focus { border-color: var(--primary); background: rgba(88,166,255,.08); }
.auth-field input:hover { background: rgba(255,255,255,.07); }
.auth-error { color: #ff7b72; font-size: .86rem; min-height: 1.2em; margin: -6px 0 12px; }
.auth-submit { width: 100%; justify-content: center; }

/* ===== 验证码 ===== */
.captcha-box {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.04); border: 1px dashed rgba(255,255,255,.16);
  border-radius: 999px; padding: 8px 12px;
}
.captcha-q { font-weight: 700; font-size: 1rem; white-space: nowrap; letter-spacing: 1px; }
.captcha-input {
  flex: 1; min-width: 0; background: rgba(0,0,0,.25); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); padding: 8px 10px; font-size: .95rem; outline: none;
}
.captcha-input:focus { border-color: var(--primary); background: rgba(88,166,255,.1); }
.captcha-refresh {
  background: rgba(255,255,255,.06); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text-dim); width: 32px; height: 32px; cursor: pointer; font-size: 1rem; flex: none;
}
.captcha-refresh:hover { color: var(--text); background: rgba(255,255,255,.12); }
.captcha-loading, .captcha-error { font-size: .85rem; color: var(--text-dim); }

/* ===== 聊天悬浮窗 ===== */
.chat-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 150;
  width: 58px; height: 58px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #0b0f14;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 30px rgba(88,166,255,.4);
  transition: transform .2s ease, box-shadow .2s ease;
}
.chat-fab:hover { transform: translateY(-3px) scale(1.05); }
.chat-fab::before {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid rgba(88,166,255,.35); animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: .2; transform: scale(.92); } 50% { opacity: .9; transform: scale(1.08); } }

.chat-panel {
  position: fixed; right: 22px; bottom: 90px; z-index: 151; width: 360px; max-width: calc(100vw - 32px);
  height: 480px; max-height: calc(100vh - 120px);
  background: var(--card); border: 1px solid var(--border); border-radius: 20px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,.5);
  opacity: 0; visibility: hidden; transform: translateY(12px);
  transition: opacity .25s ease, transform .25s ease, visibility .25s;
}
.chat-panel.open { opacity: 1; visibility: visible; transform: translateY(0); }
.chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  font-weight: 700; background: rgba(255,255,255,.03);
}
.chat-close {
  background: none; border: none; color: var(--text-dim); font-size: 1.4rem; cursor: pointer; line-height: 1;
}
.chat-close:hover { color: var(--text); }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.chat-msg { display: flex; max-width: 85%; }
.chat-bubble {
  padding: 10px 14px; border-radius: 14px; font-size: .9rem; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word;
}
.chat-user { align-self: flex-end; }
.chat-user .chat-bubble {
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #0b0f14;
  border-bottom-right-radius: 4px;
}
.chat-assistant .chat-bubble {
  background: rgba(255,255,255,.06); border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.chat-error.chat-bubble, .chat-bubble.chat-error { background: rgba(255,123,114,.12); color: #ff8b82; }
.chat-bubble.typing::after {
  content: "▋"; display: inline-block; animation: blink 1s step-end infinite; margin-left: 3px;
}
.chat-input-row { display: flex; align-items: center; gap: 10px; padding: 12px; border-top: 1px solid var(--border); }
.chat-input-row textarea {
  flex: 1; resize: none; max-height: 120px; min-height: 40px;
  background: rgba(255,255,255,.04); border: 1px solid var(--border); border-radius: 999px;
  color: var(--text); padding: 12px 20px; font-size: .95rem; font-family: inherit; outline: none;
  transition: border-color .2s ease, background .2s ease;
}
.chat-input-row textarea:focus { border-color: var(--primary); background: rgba(88,166,255,.07); }
.chat-input-row textarea:hover { background: rgba(255,255,255,.07); }

/* 退出登录按钮：调亮醒目 */
.btn-logout {
  border: 1px solid rgba(88,166,255,.55);
  color: #8fc4ff;
  background: rgba(88,166,255,.12);
  font-weight: 600;
  transition: background .2s ease, border-color .2s ease, color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.btn-logout:hover {
  background: rgba(88,166,255,.28);
  border-color: var(--primary);
  color: #c9e4ff;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(88,166,255,.32);
}
