/* ========================================
   校园新生AI助手 - 样式表
   设计风格：微信小程序风、清新、现代
   ======================================== */

/* ===== CSS 变量 ===== */
:root {
  --primary: #4F6EF6;
  --primary-light: #E8EDFE;
  --primary-dark: #3A56D4;
  --secondary: #6C5CE7;
  --bg: #F0F2F5;
  --card-bg: #FFFFFF;
  --text-main: #1A1A2E;
  --text-sub: #8E8E93;
  --text-light: #AEAEB2;
  --border: #E5E5EA;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --max-width: 430px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ===== Reset ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, sans-serif;
  font-size: 15px;
  color: var(--text-main);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ===== App 容器 ===== */
.app-container {
  max-width: var(--max-width);
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

/* ===== 顶部导航栏 ===== */
.navbar {
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: #fff;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 12px rgba(79, 110, 246, 0.25);
  z-index: 10;
}

.navbar .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  backdrop-filter: blur(10px);
}

.navbar .nav-info {
  flex: 1;
  min-width: 0;
}

.navbar .nav-title {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
}

.navbar .nav-subtitle {
  font-size: 12px;
  opacity: 0.85;
  margin-top: 2px;
}

.navbar .nav-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.2);
  padding: 3px 8px;
  border-radius: 20px;
  margin-top: 3px;
}

.navbar .nav-status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ADE80;
  box-shadow: 0 0 4px #4ADE80;
}

.navbar .nav-admin {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.navbar .nav-admin:active {
  background: rgba(255, 255, 255, 0.35);
}

/* ===== 聊天区域 ===== */
.chat-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 12px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.chat-area::-webkit-scrollbar {
  width: 3px;
}

.chat-area::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* ===== 欢迎卡片 ===== */
.welcome-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  text-align: center;
}

.welcome-card .welcome-icon {
  font-size: 48px;
  margin-bottom: 8px;
}

.welcome-card .welcome-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-card .welcome-desc {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.6;
}

/* ===== 分类标签 ===== */
.category-section {
  margin-bottom: 16px;
}

.category-section .section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
  margin-bottom: 10px;
  padding: 0 4px;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.category-item {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 12px 4px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow);
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.category-item:active {
  transform: scale(0.94);
}

.category-item .cat-icon {
  font-size: 26px;
  line-height: 1;
}

.category-item .cat-name {
  font-size: 11px;
  color: var(--text-main);
  font-weight: 500;
}

/* ===== 热门问题 ===== */
.popular-section {
  margin-bottom: 16px;
}

.popular-list {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.popular-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.popular-item:last-child {
  border-bottom: none;
}

.popular-item:active {
  background: var(--primary-light);
}

.popular-item .pop-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.popular-item .pop-text {
  flex: 1;
  font-size: 14px;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.popular-item .pop-arrow {
  color: var(--text-light);
  font-size: 14px;
  flex-shrink: 0;
}

/* ===== 消息气泡 ===== */
.message {
  display: flex;
  margin-bottom: 16px;
  animation: msgIn 0.3s ease-out;
}

@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.ai {
  flex-direction: row;
  gap: 8px;
}

.message.user {
  flex-direction: row-reverse;
  gap: 8px;
}

.message .msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.message.ai .msg-avatar {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
}

.message.user .msg-avatar {
  background: #E5E5EA;
  color: var(--text-sub);
  font-size: 16px;
}

.message .msg-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.65;
  word-break: break-word;
  position: relative;
  white-space: pre-wrap;
}

.message.ai .msg-bubble {
  background: var(--card-bg);
  color: var(--text-main);
  border-top-left-radius: 4px;
  box-shadow: var(--shadow);
}

/* AI 生成标识 */
.ai-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 9px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--secondary);
  background: rgba(108, 92, 231, 0.1);
  border: 1px solid rgba(108, 92, 231, 0.3);
  border-radius: 10px;
}

.message.user .msg-bubble {
  background: var(--primary);
  color: #fff;
  border-top-right-radius: 4px;
}

/* ===== 打字动画 ===== */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-light);
  animation: typingBounce 1.2s infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingBounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

/* 正在联网搜索 文字提示 */
.typing-hint {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-muted, #94a3b8);
}

/* 不确定进度条（滑动动画，表示加载中） */
.typing-progress {
  margin-top: 8px;
  height: 3px;
  width: 150px;
  max-width: 60vw;
  background: rgba(148, 163, 184, 0.22);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.typing-progress::after {
  content: "";
  position: absolute;
  top: 0;
  left: -40%;
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, var(--primary, #6c5ce7), var(--secondary, #00b894));
  border-radius: 3px;
  animation: typingProgressSlide 1.2s ease-in-out infinite;
}

@keyframes typingProgressSlide {
  0% {
    left: -40%;
  }
  100% {
    left: 100%;
  }
}

/* ===== 推荐问题 ===== */
.suggestions {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.suggestion-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--primary-light);
  border: 1px solid rgba(79, 110, 246, 0.15);
  border-radius: 20px;
  font-size: 13px;
  color: var(--primary);
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
  align-self: flex-start;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggestion-chip:active {
  transform: scale(0.96);
  background: rgba(79, 110, 246, 0.15);
}

.suggestion-chip .sug-icon {
  font-size: 14px;
  flex-shrink: 0;
}

/* ===== 分类问题列表 ===== */
.category-questions {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.category-questions .cq-header {
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.category-questions .cq-item {
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: background 0.15s;
}

.category-questions .cq-item:last-child {
  border-bottom: none;
}

.category-questions .cq-item:active {
  background: var(--primary-light);
}

.category-questions .cq-text {
  font-size: 14px;
  flex: 1;
}

.category-questions .cq-arrow {
  color: var(--text-light);
  font-size: 14px;
}

/* ===== 输入区域 ===== */
.input-area {
  flex-shrink: 0;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  padding: 10px 12px;
  padding-bottom: calc(10px + var(--safe-bottom));
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.input-area .input-wrap {
  flex: 1;
  background: var(--bg);
  border-radius: 22px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  border: 1.5px solid transparent;
  transition: border-color 0.2s;
  min-height: 40px;
}

.input-area .input-wrap:focus-within {
  border-color: var(--primary);
  background: #fff;
}

.input-area input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  color: var(--text-main);
  line-height: 1.5;
}

.input-area input::placeholder {
  color: var(--text-light);
}

.input-area .send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s, opacity 0.15s;
  opacity: 0.5;
  pointer-events: none;
}

.input-area .send-btn.active {
  opacity: 1;
  pointer-events: auto;
}

.input-area .send-btn:active {
  transform: scale(0.9);
}

/* ===== 快捷按钮 ===== */
.quick-actions {
  display: flex;
  gap: 6px;
  padding: 0 12px 8px;
  overflow-x: auto;
  background: var(--card-bg);
  -webkit-overflow-scrolling: touch;
}

.quick-actions::-webkit-scrollbar {
  display: none;
}

.quick-action {
  flex-shrink: 0;
  padding: 6px 12px;
  background: var(--primary-light);
  border-radius: 16px;
  font-size: 12px;
  color: var(--primary);
  cursor: pointer;
  border: none;
  white-space: nowrap;
  transition: transform 0.15s;
}

.quick-action:active {
  transform: scale(0.94);
}

/* ===== 底部提示 ===== */
.footer-hint {
  text-align: center;
  font-size: 11px;
  color: var(--text-light);
  padding: 6px 0;
  background: var(--card-bg);
}

/* ===== 滚动到底部按钮 ===== */
.scroll-bottom-btn {
  position: absolute;
  bottom: 80px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 5;
}

.scroll-bottom-btn.show {
  opacity: 1;
  pointer-events: auto;
}

.scroll-bottom-btn:active {
  transform: scale(0.9);
}

/* ===== 响应式 ===== */
@media (min-width: 500px) {
  .app-container {
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.08);
  }
}

/* ===== 管理后台样式 ===== */
.admin-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-header h1 {
  font-size: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-header .back-btn {
  padding: 8px 16px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  text-align: center;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-sub);
  margin-top: 4px;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.admin-toolbar select,
.admin-toolbar input {
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  background: #fff;
}

.admin-toolbar select:focus,
.admin-toolbar input:focus {
  border-color: var(--primary);
}

.admin-toolbar .btn {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: opacity 0.2s;
}

.admin-toolbar .btn:active {
  opacity: 0.7;
}

.admin-toolbar .btn-primary {
  background: var(--primary);
  color: #fff;
}

.admin-toolbar .btn-secondary {
  background: var(--border);
  color: var(--text-main);
}

.admin-toolbar .btn-danger {
  background: #FF3B30;
  color: #fff;
}

.qa-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.qa-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.qa-card .qa-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.qa-card .qa-question {
  font-size: 15px;
  font-weight: 600;
  flex: 1;
}

.qa-card .qa-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.qa-card .qa-actions button {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qa-card .qa-actions .btn-edit {
  background: var(--primary-light);
  color: var(--primary);
}

.qa-card .qa-actions .btn-del {
  background: #FFEAEA;
  color: #FF3B30;
}

.qa-card .qa-answer {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.6;
  white-space: pre-wrap;
  margin-bottom: 8px;
  max-height: 100px;
  overflow: hidden;
  position: relative;
}

.qa-card .qa-answer.expanded {
  max-height: none;
}

.qa-card .qa-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.qa-card .qa-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--primary);
}

.qa-card .qa-keywords {
  font-size: 11px;
  color: var(--text-light);
}

/* ===== 模态框 ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 18px;
}

.modal-header .close-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg);
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-body {
  padding: 20px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  background: #fff;
  color: var(--text-main);
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--primary);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

.form-group .hint {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.modal-footer button {
  padding: 8px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}

.modal-footer .btn-cancel {
  background: var(--bg);
  color: var(--text-sub);
}

.modal-footer .btn-save {
  background: var(--primary);
  color: #fff;
}

/* ===== Toast 提示 ===== */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-10px);
}

/* ===== 让 toast 默认可见（JS 直接 append 并定时移除，不切换 show 类） ===== */
.toast {
  opacity: 1;
  animation: toastIn 0.2s ease;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(6px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ===== 底部 tab 切换 ===== */
.tabbar {
  display: flex;
  background: var(--card-bg, #fff);
  border-bottom: 1px solid var(--border, #eee);
  flex-shrink: 0;
}
.tab-item {
  flex: 1;
  text-align: center;
  padding: 11px 4px;
  font-size: 14px;
  color: var(--text-sub, #666);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.tab-item.active {
  color: var(--primary, #4F6EF6);
  border-bottom-color: var(--primary, #4F6EF6);
  font-weight: 600;
}

/* ===== 论坛 ===== */
.forum-area {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  -webkit-overflow-scrolling: touch;
}
.loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 40px 0;
  color: var(--text-light, #999);
}
.loading-text { font-size: 13px; }
.empty-box {
  text-align: center;
  color: var(--text-light, #999);
  font-size: 14px;
  padding: 50px 20px;
  line-height: 1.6;
}
.post-card {
  background: var(--card-bg, #fff);
  border-radius: var(--radius, 14px);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow, 0 2px 8px rgba(0,0,0,0.05));
}
.post-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.post-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--primary-light, #eef1fe);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.post-author { font-size: 13px; font-weight: 600; color: var(--text-main); }
.post-time { font-size: 12px; color: var(--text-light, #999); margin-left: auto; }
.post-content {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-main);
  white-space: pre-wrap;
  word-break: break-word;
}
.post-actions {
  display: flex;
  gap: 24px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border, #f0f0f0);
  font-size: 13px;
  color: var(--text-sub, #666);
}
.post-like, .post-comment { cursor: pointer; user-select: none; }
.post-like.liked { color: #fb7185; font-weight: 600; }

.fab-post {
  position: fixed;
  right: 18px;
  bottom: 80px;
  width: 52px; height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--primary, #4F6EF6);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  box-shadow: 0 4px 14px rgba(79,110,246,0.4);
  cursor: pointer;
  z-index: 50;
}
.fab-post:active { transform: scale(0.92); }

/* 弹层 */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
}
.modal-card {
  background: var(--card-bg, #fff);
  width: 100%;
  max-width: 560px;
  border-radius: 18px 18px 0 0;
  padding: 18px;
  box-sizing: border-box;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 14px;
}
.modal-close { font-size: 18px; color: var(--text-light, #999); cursor: pointer; padding: 4px; }
.post-input {
  width: 100%;
  min-height: 110px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  padding: 10px;
  font-size: 15px;
  resize: none;
  box-sizing: border-box;
  font-family: inherit;
}
.anon-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 12px 0;
  font-size: 14px;
  color: var(--text-sub, #555);
}
.modal-submit {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 24px;
  background: var(--primary, #4F6EF6);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.modal-submit:disabled { opacity: 0.6; }
.comment-list {
  max-height: 320px;
  overflow-y: auto;
  margin-bottom: 12px;
}
.comment-item {
  display: flex;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border, #f0f0f0);
}
.comment-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary-light, #eef1fe);
  display: flex; align-items: center; justify-content: center; font-size: 14px;
  flex-shrink: 0;
}
.comment-meta { font-size: 12px; color: var(--text-light, #999); margin-bottom: 2px; }
.comment-text { font-size: 14px; color: var(--text-main); line-height: 1.5; word-break: break-word; }
.comment-input-row { display: flex; gap: 8px; }
.comment-input {
  flex: 1;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 20px;
  padding: 10px 14px;
  font-size: 14px;
  box-sizing: border-box;
}
.comment-send {
  padding: 0 18px;
  border: none;
  border-radius: 20px;
  background: var(--primary, #4F6EF6);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

/* ===== 匹配 ===== */
.match-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.match-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 30px 24px;
  text-align: center;
}
.match-emoji { font-size: 64px; }
.match-title { font-size: 20px; font-weight: 700; color: var(--text-main); }
.match-desc { font-size: 14px; color: var(--text-sub, #666); line-height: 1.6; max-width: 280px; }
.match-start, .match-cancel {
  margin-top: 10px;
  padding: 14px 50px;
  border: none;
  border-radius: 26px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
}
.match-start { background: linear-gradient(135deg, #fb7185, #e11d8f); color: #fff; box-shadow: 0 6px 18px rgba(225,29,143,0.35); }
.match-cancel { background: #f1f3f7; color: var(--text-sub, #555); }
.match-tip { font-size: 12px; color: var(--text-light, #aaa); margin-top: 8px; }
.match-spinner {
  width: 46px; height: 46px;
  border: 4px solid rgba(251,113,133,0.2);
  border-top-color: #fb7185;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.match-chat { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.match-chat-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--card-bg, #fff);
  border-bottom: 1px solid var(--border, #eee);
}
.match-peer { font-size: 22px; }
.match-peer-name { font-size: 14px; font-weight: 600; color: var(--text-main); }
.match-timer {
  margin-left: auto;
  font-size: 13px;
  color: #fb7185;
  font-weight: 600;
  background: rgba(251,113,133,0.1);
  padding: 2px 10px;
  border-radius: 12px;
}
.match-end { font-size: 13px; color: var(--text-light, #999); cursor: pointer; padding: 4px; }
.match-msg-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mmessage { display: flex; }
.mmessage.me { justify-content: flex-end; }
.mbubble {
  max-width: 75%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.5;
  word-break: break-word;
}
.mmessage.peer .mbubble { background: var(--card-bg, #fff); color: var(--text-main); border-top-left-radius: 4px; box-shadow: var(--shadow); }
.mmessage.me .mbubble { background: var(--primary, #4F6EF6); color: #fff; border-top-right-radius: 4px; }
.match-input-row { display: flex; gap: 8px; padding: 10px 12px; background: var(--card-bg, #fff); border-top: 1px solid var(--border, #eee); }
.match-input {
  flex: 1;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 20px;
  padding: 10px 14px;
  font-size: 14px;
  box-sizing: border-box;
}
.match-send {
  padding: 0 18px;
  border: none;
  border-radius: 20px;
  background: var(--primary, #4F6EF6);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

/* ===== 找回入口引导 ===== */
.retention-fab {
  position: fixed;
  right: 14px;
  top: 14px;
  z-index: 120;
  background: rgba(26, 26, 46, 0.82);
  color: #fff;
  border: none;
  border-radius: 18px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.retention-fab:active { transform: scale(0.95); }

.retention-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 300;
}
.retention-overlay.show { display: flex; }

.retention-modal {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border-radius: 18px;
  padding: 20px 18px 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  animation: rgIn 0.22s ease-out;
}
@keyframes rgIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.retention-modal-head { margin-bottom: 14px; }
.retention-modal-title { font-size: 17px; font-weight: 700; color: var(--text-main); }
.retention-modal-sub { font-size: 12px; color: var(--text-sub); margin-top: 4px; line-height: 1.5; }

.retention-steps { display: flex; flex-direction: column; gap: 12px; }
.rg-step { display: flex; gap: 10px; align-items: flex-start; }
.rg-num {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.rg-step div { font-size: 13.5px; color: var(--text-main); line-height: 1.55; }
.rg-step b { color: var(--primary-dark); }

.retention-actions { display: flex; gap: 10px; margin-top: 18px; }
.retention-btn {
  flex: 1;
  border: none;
  border-radius: 12px;
  padding: 11px 0;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.retention-btn.ghost { background: var(--bg); color: var(--text-main); }
.retention-btn.primary { background: var(--primary); color: #fff; }
.retention-btn:active { opacity: 0.85; }
