/* 小久 H5 · 设计系统 v2.0
   配色：暖杏橙 #E8915B · 蜜桃粉 · 暖米白
   风格：premium mobile-first · 玻璃质感 · 流畅过渡
   单位：rem（1rem = 16px），兼顾 750rpx 设计稿的视觉比例 */

:root {
  --primary: #E8915B;
  --primary-dark: #D67B43;
  --primary-light: #FFB47A;
  --primary-soft: #FFF3E9;
  --accent: #FF9966;
  --bg: #FBF7F2;
  --bg-grad: linear-gradient(180deg, #FFF8F0 0%, #FBF7F2 40%, #F5EFE6 100%);
  --card: #FFFFFF;
  --text: #2D2520;
  --text-2: #5A4A40;
  --muted: #9A8B80;
  --line: #F0E9E1;
  --ok: #4CAF82;
  --danger: #E5484D;
  --shadow-sm: 0 0.125rem 0.5rem rgba(180, 100, 60, 0.08);
  --shadow-md: 0 0.5rem 1.5rem rgba(180, 100, 60, 0.12);
  --shadow-lg: 0 0.75rem 2.5rem rgba(180, 100, 60, 0.15);
  --radius: 1rem;
  --radius-sm: 0.75rem;
  --radius-lg: 1.5rem;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  height: 100%;
  background: var(--bg-grad);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  overflow: hidden;
}

button { font-family: inherit; }

/* 居中手机视口 — 钉死在可见区域，只有中间对话区滚动（微信式布局）
   用 position:fixed; inset:0 而非 height:100vh，避开移动端 100vh 比可见区高导致整页可滚动的陷阱 */
.app-shell {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  /* 键盘适配 v30 (2026-07-28 晴晴诊断 + Codex 落实)：
     用 dynamic visual viewport 高度，让 .app-shell 在键盘弹起时
     自动跟随收缩（iOS A2HS resize 模式治本 / WebAPK 兜底）
     兼容性三级回退：dvh (现代) → -webkit-fill-available (iOS 13.4-15.3) → vh (远古) */
  height: 100vh;              /* 远古浏览器兜底 */
  height: -webkit-fill-available;  /* iOS Safari 13.4-15.3 旧版 */
  height: 100dvh;             /* iOS Safari 15.4+ / Chrome 108+ / Android WebAPK 现代标准 */
  max-width: 30rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--bg-grad);
  overflow: hidden;
  /* 键盘适配：bottom 由 JS（visualViewport）动态设置，加过渡避免跳变 */
  transition: bottom 0.15s ease-out, height 0.15s ease-out;
}

/* ============ 顶部栏 — 固定在顶部不随对话滚动 ============ */
.topbar {
  flex-shrink: 0; position: relative; z-index: 20;
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 248, 240, 0.82);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--line);
}
.topbar .avatar {
  width: 2.5rem; height: 2.5rem; border-radius: 50%;
  object-fit: cover; background: var(--primary-soft);
  box-shadow: 0 0.125rem 0.5rem rgba(232, 145, 91, 0.25);
  flex-shrink: 0;
}
.topbar .text { display: flex; flex-direction: column; gap: 0.05rem; }
.topbar .title { font-size: 1rem; font-weight: 700; line-height: 1.2; }
.topbar .sub { font-size: 0.7rem; color: var(--muted); line-height: 1.2; }
.topbar .spacer { flex: 1; }
.topbar .icon-btn {
  width: 2.25rem; height: 2.25rem; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--card); box-shadow: var(--shadow-sm);
  font-size: 1.1rem; cursor: pointer; border: none;
  transition: transform .2s;
}
.topbar .icon-btn:active { transform: scale(0.92); }

/* ============ 滚动内容 ============ */
.scroll {
  flex: 1; overflow-y: auto;
  padding: 1rem;
  -webkit-overflow-scrolling: touch;
}

/* ============ 激活引导页（重做）============ */
.activate-box {
  margin: 1.5rem 0;
  padding: 0;
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  position: relative;
}
.activate-box::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 7rem;
  background: linear-gradient(135deg, #FFE0CC 0%, #FFD0A8 50%, #FFC299 100%);
  z-index: 0;
}
.activate-box .a-avatar {
  position: relative; z-index: 1;
  width: 5.5rem; height: 5.5rem;
  border-radius: 50%;
  margin: 1.75rem auto 0.75rem;
  display: block;
  background: #fff;
  padding: 0.25rem;
  box-shadow: 0 0.5rem 1.5rem rgba(232, 145, 91, 0.3);
  object-fit: cover;
}
.activate-box .a-title {
  position: relative; z-index: 1;
  text-align: center;
  font-size: 1.35rem; font-weight: 700;
  color: var(--text);
  margin: 0 1.25rem 0.4rem;
}
.activate-box .a-subtitle {
  position: relative; z-index: 1;
  text-align: center;
  font-size: 0.8rem; color: var(--muted);
  margin: 0 1.25rem 1.5rem;
}
.activate-box .a-desc {
  padding: 0 1.25rem;
  text-align: center;
  color: var(--text-2);
  font-size: 0.9rem;
  line-height: 1.7;
  margin: 0 0 1.25rem;
}

/* 步骤条 */
.activate-box .a-steps {
  display: flex;
  gap: 0.5rem;
  padding: 0 1.25rem;
  margin: 0 0 1.5rem;
}
.activate-box .a-step {
  flex: 1;
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.5rem;
  text-align: center;
  position: relative;
}
.activate-box .a-step .s-num {
  width: 1.5rem; height: 1.5rem;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: inline-flex;
  align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700;
  margin-bottom: 0.4rem;
}
.activate-box .a-step .s-text {
  font-size: 0.75rem;
  color: var(--text-2);
  line-height: 1.4;
}
.activate-box .a-step .s-text b {
  display: block;
  color: var(--text);
  font-size: 0.85rem;
  margin-bottom: 0.15rem;
}

.activate-box .a-input-group {
  padding: 0 1.25rem;
  margin-bottom: 0.75rem;
}
.activate-box .a-input-label {
  font-size: 0.8rem;
  color: var(--text-2);
  margin-bottom: 0.4rem;
  font-weight: 600;
}
.activate-box .a-input {
  width: 100%; border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  font-size: 1rem; outline: none;
  text-align: left;
  background: var(--bg);
  transition: all .2s;
}
.activate-box .a-input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(232, 145, 91, 0.12);
}
.activate-box .a-input::placeholder { color: #C8BAB0; }

.activate-box .a-btn-group {
  padding: 0 1.25rem;
  margin-bottom: 0.5rem;
}
.activate-box .a-save {
  width: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff; border: none;
  border-radius: var(--radius-sm);
  padding: 0.95rem 1rem;
  font-size: 1rem; font-weight: 600;
  cursor: pointer;
  box-shadow: 0 0.4rem 1rem rgba(232, 145, 91, 0.3);
  transition: all .2s;
  display: flex; align-items: center; justify-content: center; gap: 0.4rem;
}
.activate-box .a-save:active { transform: scale(0.98); }
.activate-box .a-save.ok {
  background: linear-gradient(135deg, var(--ok) 0%, #3A8E66 100%);
  box-shadow: 0 0.4rem 1rem rgba(76, 175, 130, 0.3);
}

.activate-box .a-divider {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 1.25rem 1.25rem 0.5rem;
  color: var(--muted); font-size: 0.75rem;
}
.activate-box .a-divider::before,
.activate-box .a-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--line);
}

.activate-box .a-id-block {
  padding: 0 1.25rem 1.5rem;
}
.activate-box .a-id-label {
  font-size: 0.8rem; color: var(--text-2);
  margin-bottom: 0.5rem;
  font-weight: 600;
}
.activate-box .a-id-row {
  display: flex; gap: 0.5rem; align-items: stretch;
}
.activate-box .a-openid {
  flex: 1;
  margin: 0;
  padding: 0.75rem 0.9rem;
  background: var(--bg);
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
  color: var(--text-2);
  word-break: break-all;
  display: flex; align-items: center;
  min-height: 2.75rem;
}
.activate-box .a-copy {
  background: var(--primary-soft);
  color: var(--primary);
  border: 1.5px solid var(--primary-soft);
  border-radius: var(--radius-sm);
  padding: 0 1rem;
  font-size: 0.85rem; font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
  display: flex; align-items: center; gap: 0.25rem;
  flex-shrink: 0;
  min-width: 4.5rem;
  justify-content: center;
}
.activate-box .a-copy:active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.activate-box .a-copy.done {
  background: var(--ok);
  color: #fff;
  border-color: var(--ok);
}
.activate-box .a-hint {
  font-size: 0.75rem; color: var(--muted);
  margin-top: 0.6rem; line-height: 1.5;
  text-align: center;
}
.activate-box .a-hint b { color: var(--primary); }

/* ============ 登录/注册页（全面开放模型）============ */
.login-box {
  margin: 1.5rem 0;
  padding: 0;
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  position: relative;
  animation: fadeInUp 0.4s cubic-bezier(.16,1,.3,1);
}
.login-box::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 7rem;
  background: linear-gradient(135deg, #FFE0CC 0%, #FFD0A8 50%, #FFC299 100%);
  z-index: 0;
}
.login-box .l-avatar {
  position: relative; z-index: 1;
  width: 5.5rem; height: 5.5rem;
  border-radius: 50%;
  margin: 1.75rem auto 0.75rem;
  display: block;
  background: #fff;
  padding: 0.25rem;
  box-shadow: 0 0.5rem 1.5rem rgba(232, 145, 91, 0.3);
  object-fit: cover;
}
.login-box .l-title {
  position: relative; z-index: 1;
  text-align: center;
  font-size: 1.35rem; font-weight: 700;
  color: var(--text);
  margin: 0 1.25rem 0.4rem;
}
.login-box .l-subtitle {
  position: relative; z-index: 1;
  text-align: center;
  font-size: 0.8rem; color: var(--muted);
  margin: 0 1.25rem 1.5rem;
}
.login-box .l-desc {
  padding: 0 1.25rem;
  text-align: center;
  color: var(--text-2);
  font-size: 0.9rem;
  line-height: 1.7;
  margin: 0 0 1.5rem;
}
.login-box .l-input-group {
  padding: 0 1.25rem;
  margin-bottom: 0.85rem;
}
.login-box .l-input-label {
  font-size: 0.8rem;
  color: var(--text-2);
  margin-bottom: 0.4rem;
  font-weight: 600;
}
.login-box .l-input {
  width: 100%; border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  font-size: 1rem; outline: none;
  text-align: left;
  background: var(--bg);
  transition: all .2s;
}
.login-box .l-input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(232, 145, 91, 0.12);
}
.login-box .l-input::placeholder { color: #C8BAB0; }
.login-box .l-btn-group {
  padding: 0.25rem 1.25rem 0.5rem;
}
.login-box .l-enter {
  width: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff; border: none;
  border-radius: var(--radius-sm);
  padding: 0.95rem 1rem;
  font-size: 1rem; font-weight: 600;
  cursor: pointer;
  box-shadow: 0 0.4rem 1rem rgba(232, 145, 91, 0.3);
  transition: all .2s;
}
.login-box .l-enter:active { transform: scale(0.98); }
.login-box .l-enter:disabled { opacity: 0.7; cursor: default; }
.login-box .l-hint {
  padding: 0.5rem 1.25rem 1.75rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  min-height: 1rem;
  line-height: 1.5;
  transition: color .2s;
}
.login-box .l-hint.err {
  color: var(--danger);
  font-weight: 600;
}

/* 昵称必填标注 */
.login-box .l-nick-required {
  font-size: 0.75rem;
  color: var(--danger);
  font-weight: 600;
  display: none;
}

/* 按钮抖动动画 — 校验失败时给用户明确反馈 */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-5px); }
  30% { transform: translateX(5px); }
  45% { transform: translateX(-4px); }
  60% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
  90% { transform: translateX(2px); }
}
.login-box .l-enter.shake {
  animation: shake 0.4s ease;
}

/* ============ 场景胶囊 ============ */
.capsules {
  display: flex; gap: 0.5rem; overflow-x: auto;
  padding: 0.25rem 0 0.75rem;
  scrollbar-width: none;
  margin: 0 -1rem;
  padding-left: 1rem; padding-right: 1rem;
}
.capsules::-webkit-scrollbar { display: none; }
.capsule {
  flex: 0 0 auto;
  padding: 0.5rem 0.9rem;
  background: var(--card); border-radius: 1.25rem;
  font-size: 0.85rem; color: var(--text);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
  transition: all .25s cubic-bezier(.16,1,.3,1);
  cursor: pointer; white-space: nowrap;
}
.capsule:active, .capsule.active {
  background: var(--primary); color: #fff;
  transform: scale(1.04);
  border-color: var(--primary);
}

/* ============ 对话气泡 ============ */
.msg { display: flex; gap: 0.6rem; margin-bottom: 1rem; align-items: flex-end; }
.msg .m-avatar {
  width: 2.4rem; height: 2.4rem; border-radius: 50%;
  flex: 0 0 auto;
  box-shadow: 0 0.1rem 0.4rem rgba(0,0,0,0.12);
}
.msg .m-avatar.avatar-bot {
  background: linear-gradient(135deg, #E8915B 0%, #FF6B6B 100%);
}
.msg .m-avatar.avatar-me {
  background: linear-gradient(135deg, #4A90D9 0%, #74B9FF 100%);
  box-shadow: 0 0.1rem 0.4rem rgba(74,144,217,0.3);
}
.msg .bubble {
  max-width: 76%;
  padding: 0.7rem 0.85rem;
  border-radius: 1rem;
  font-size: 0.95rem;
  line-height: 1.65;
  word-break: break-word;
  white-space: pre-wrap;
}
.msg.bot .bubble {
  background: var(--card);
  border-bottom-left-radius: 0.3rem;
  box-shadow: var(--shadow-sm);
  color: var(--text);
}
.msg.me { flex-direction: row-reverse; }
.msg.me .bubble {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  border-bottom-right-radius: 0.3rem;
  box-shadow: 0 0.25rem 0.75rem rgba(232, 145, 91, 0.25);
}
.msg .m-img { max-width: 100%; border-radius: 0.5rem; margin-top: 0.4rem; }

/* 引用块：左侧橙色条 + 淡底色，像在引述别人的话 */
.msg.bot .bubble blockquote {
  margin: 0.5rem 0;
  padding: 0.5rem 0.75rem;
  border-left: 3px solid var(--primary);
  background: rgba(232,145,91,0.07);
  border-radius: 0 0.5rem 0.5rem 0;
}
.msg .feedback {
  margin-top: 0.4rem; font-size: 0.75rem; color: var(--muted);
  display: flex; gap: 0.75rem;
}
.msg.bot .feedback { padding-left: 0.5rem; }
.msg .feedback .fb-btn { cursor: pointer; opacity: .65; user-select: none; }
.msg .feedback .fb-btn.done { color: var(--primary); opacity: 1; }

/* ============ 输入栏 — 微信式：flex 流内底部固定（app-shell 已钉死可视区）============ */
.composer {
  flex-shrink: 0;
  display: flex; align-items: flex-end; gap: 0.5rem;
  padding: 0.65rem 0.9rem calc(0.65rem + env(safe-area-inset-bottom));
  background: rgba(255, 248, 240, 0.92);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--line);
  z-index: 30;
  box-shadow: 0 -0.5rem 1.5rem rgba(180, 100, 60, 0.06);
}
.composer .c-input {
  flex: 1; border: none; outline: none; resize: none;
  background: var(--card); border-radius: 1.25rem;
  padding: 0.65rem 0.9rem;
  font-size: 0.95rem; line-height: 1.4;
  box-shadow: var(--shadow-sm);
  color: var(--text);
  max-height: 6rem;        /* 最多约4行，超出滚动 */
  overflow-y: auto;
  min-height: 2.3rem;     /* 初始单行高度 */
  font-family: inherit;
}
.composer .c-input::placeholder { color: #C8BAB0; }
.composer .c-btn {
  width: 2.5rem; height: 2.5rem; border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  font-size: 1.1rem;
  display: grid; place-items: center;
  cursor: pointer; flex: 0 0 auto;
  transition: transform .2s cubic-bezier(.16,1,.3,1);
  box-shadow: 0 0.25rem 0.75rem rgba(232, 145, 91, 0.3);
}
.composer .c-btn:active { transform: scale(0.92); }
.composer .c-icon {
  width: 2.25rem; height: 2.25rem; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  font-size: 1.05rem; cursor: pointer; flex: 0 0 auto;
  border: none;
  color: var(--text-2);
}
.composer .c-icon:active { transform: scale(0.92); }

/* ============ 成长卡片 ============ */
.growth-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-top: 0.75rem; }
.growth-card {
  background: var(--card); border-radius: var(--radius);
  padding: 1rem 0.9rem; box-shadow: var(--shadow-sm);
}
.growth-card.full { grid-column: 1 / -1; }
.growth-card .g-label { font-size: 0.75rem; color: var(--muted); }
.growth-card .g-value {
  font-size: 1.5rem; font-weight: 700;
  color: var(--primary); margin: 0.25rem 0;
  line-height: 1.2;
}
.growth-card .g-sub { font-size: 0.7rem; color: var(--muted); }
.growth-card .g-bar {
  height: 0.4rem; background: var(--line);
  border-radius: 0.5rem; margin-top: 0.65rem; overflow: hidden;
}
.growth-card .g-bar > i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: 0.5rem;
  transition: width .6s cubic-bezier(.16,1,.3,1);
}

.section-title { font-size: 1.05rem; font-weight: 700; margin: 1.5rem 0 0.5rem; }
.section-title .st-sub { font-size: 0.75rem; color: var(--muted); font-weight: 400; margin-left: 0.5rem; }

/* ============ 后台 ============ */
.admin-wrap { max-width: 30rem; margin: 0 auto; padding: 1rem; }
.admin-gate { margin-top: 6rem; text-align: center; }
.admin-gate input {
  width: 80%; padding: 0.75rem; border: 1px solid var(--line);
  border-radius: var(--radius-sm); font-size: 0.95rem;
  margin: 1rem 0; text-align: center; outline: none;
}
.admin-gate input:focus { border-color: var(--primary); }
.admin-gate button, .btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff; border: none;
  border-radius: var(--radius-sm);
  padding: 0.75rem 2rem; font-size: 0.95rem; font-weight: 600;
  cursor: pointer; box-shadow: 0 0.25rem 0.75rem rgba(232, 145, 91, 0.25);
}
.tabs { display: flex; gap: 0.5rem; margin: 0.75rem 0 1rem; flex-wrap: wrap; }
.tab {
  padding: 0.5rem 0.9rem; background: var(--card); border-radius: 1.25rem;
  font-size: 0.85rem; box-shadow: var(--shadow-sm); cursor: pointer; border: 1px solid var(--line);
}
.tab.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff; border-color: transparent;
}
.tab .badge {
  display: inline-block; min-width: 1.1rem; padding: 0 0.35rem;
  background: var(--danger); color: #fff; border-radius: 0.75rem;
  font-size: 0.7rem; margin-left: 0.25rem; text-align: center; line-height: 1.3;
}
.list-card {
  background: var(--card); border-radius: var(--radius-sm);
  padding: 0.85rem 0.9rem; margin-bottom: 0.65rem; box-shadow: var(--shadow-sm);
}
.list-card .lc-top { display: flex; justify-content: space-between; align-items: center; }
.list-card .lc-name { font-size: 0.95rem; font-weight: 700; }
.list-card .lc-st { font-size: 0.7rem; padding: 0.15rem 0.5rem; border-radius: 0.75rem; }
.list-card .lc-st.pending { background: #FFF0E0; color: var(--primary); }
.list-card .lc-st.active { background: #E8F6EE; color: var(--ok); }
.list-card .lc-id { font-size: 0.7rem; color: var(--muted); margin-top: 0.3rem; word-break: break-all; font-family: 'SF Mono', monospace; }
.list-card .lc-btn {
  background: var(--primary); color: #fff; border: none;
  border-radius: 0.85rem; padding: 0.4rem 0.85rem; font-size: 0.8rem; cursor: pointer;
}
.list-card .lc-btn.ok { background: var(--ok); }
.list-card .lc-content { font-size: 0.85rem; margin: 0.4rem 0; line-height: 1.6; }
.list-card .lc-actions { display: flex; gap: 0.4rem; margin-top: 0.4rem; }
.list-card .lc-actions button {
  border: none; border-radius: 0.85rem; padding: 0.4rem 0.85rem; font-size: 0.8rem; cursor: pointer;
}
.lc-approve { background: var(--primary); color: #fff; }
.lc-reject { background: var(--line); color: var(--text); }
.heat-chip {
  display: inline-block; background: var(--primary-soft); color: var(--primary);
  border-radius: 1rem; padding: 0.3rem 0.7rem; margin: 0.25rem; font-size: 0.8rem;
}

/* ============ 通用 ============ */
.typing { display: inline-flex; gap: 0.2rem; align-items: center; padding: 0.4rem 0; }
.typing i { width: 0.4rem; height: 0.4rem; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2){ animation-delay: .2s; } .typing i:nth-child(3){ animation-delay: .4s; }
@keyframes blink { 0%,80%,100%{ opacity:.3 } 40%{ opacity:1 } }

.toast {
  position: fixed; left: 50%; bottom: 5.5rem; transform: translateX(-50%);
  background: rgba(45, 37, 32, 0.92); color: #fff;
  padding: 0.6rem 1.1rem;
  border-radius: 1.25rem;
  font-size: 0.85rem; z-index: 100; opacity: 0;
  transition: opacity .3s; pointer-events: none;
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.2);
}
.toast.show { opacity: 1; }
.hidden { display: none !important; }

/* ============ 加载骨架屏 ============ */
.skeleton {
  background: linear-gradient(90deg, #F0E9E1 0%, #F8F2EA 50%, #F0E9E1 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 0.5rem;
}
@keyframes shimmer { 0%{ background-position: 200% 0 } 100%{ background-position: -200% 0 } }

/* ============ 进入动画 ============ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(0.5rem); }
  to { opacity: 1; transform: translateY(0); }
}
.activate-box { animation: fadeInUp 0.4s cubic-bezier(.16,1,.3,1); }
.msg.bot { animation: fadeInUp 0.3s cubic-bezier(.16,1,.3,1); }

/* ============ 小屏适配 ============ */
@media (max-width: 360px) {
  .topbar .sub { display: none; }
  .activate-box .a-avatar { width: 4.5rem; height: 4.5rem; margin-top: 1.5rem; }
  .activate-box .a-title { font-size: 1.2rem; }
  .login-box .l-avatar { width: 4.5rem; height: 4.5rem; margin-top: 1.5rem; }
  .login-box .l-title { font-size: 1.2rem; }
  .msg .bubble { font-size: 0.9rem; }
}

/* ============ Markdown 表格（chat.v22 renderMarkdown 生成） ============ */
.msg .bubble .md-table {
  display: block;
  width: 100%;
  margin: 0.6rem 0;
  border-collapse: collapse;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  font-size: 0.82rem;
  line-height: 1.5;
}
.msg .bubble .md-table th,
.msg .bubble .md-table td {
  border: 1px solid var(--line, #e7ddd2);
  padding: 0.4rem 0.55rem;
  text-align: left;
  vertical-align: top;
  white-space: normal;
  word-break: break-word;
}
.msg .bubble .md-table thead th {
  background: var(--primary-soft, #fbeede);
  color: var(--primary, #b8763e);
  font-weight: 700;
}
.msg .bubble .md-table tbody tr:nth-child(even) td {
  background: rgba(0, 0, 0, 0.02);
}

/* ===== 虚拟键盘适配（2026-07-28 WB 修复）=====
 * chat.v27.js setupKeyboardAdapter() 配合：
 * 键盘弹起 → .app-shell 底部上移键盘高度 → 输入框/登录框不被盖住 */
.app-shell {
  transition: bottom 0.15s ease-out;
}
/* .kb-open 由 JS 加在 .app-shell 上，抬起视口使输入框不被键盘盖 */
.app-shell.kb-open {
  bottom: var(--kb-offset, 0px);
}

/* ===== 桌面端适配（2026-09-09）：宽屏下居中成手机框，避免窄列 ===== */
@media (min-width: 600px) {
  html, body { background: #eef0f4; }
  .app-shell { max-width: 480px; }
}
