/* ═══════════════════════════════════════════ */
/* Linger · 余温 — 全局样式 V4（设计稿重构版）  */
/* ═══════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* 色彩系统 */
  --bg:           #faf6f0;
  --bg2:          #f5efe6;
  --card:         #ffffff;
  --card-elevated:#fffdfa;

  --primary:      #FF9E5E;
  --primary-light:#FFB366;
  --primary-dark: #FF7A3D;
  --rose:         #FF5E78;
  --rose-light:   #FF8A9B;
  --gold:         #FFD9A8;

  --text:         #1a1a2e;
  --text2:        #4a4a5a;
  --text-muted:   #8a8a9a;
  --text-dim:     #b5b5c0;

  --border:       rgba(0,0,0,0.06);
  --border-light: rgba(0,0,0,0.04);
  --shadow:       0 4px 24px rgba(0,0,0,0.06);
  --shadow-sm:    0 2px 8px rgba(0,0,0,0.04);

  --radius:       24px;
  --radius-lg:    28px;
  --radius-md:    20px;
  --radius-sm:    16px;
  --radius-xs:    12px;
  --radius-pill:  999px;

  --max-w:        480px;
  --header-h:     56px;
  --tabbar-h:     72px;

  /* 纪念模式 */
  --memorial-bg:  #1A1A2E;
  --memorial-card:#252540;
  --memorial-text:#e8e8f0;
  --memorial-dim: #8888a0;
}

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

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
}

#app {
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: var(--max-w);
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  touch-action: none;
}

/* ═══════════════════════════════════════════ */
/* 页面系统                                     */
/* ═══════════════════════════════════════════ */
.page {
  position:absolute; inset:0;
  display:none;
  flex-direction:column;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background:var(--bg);
  padding-bottom:calc(var(--tabbar-h) + 24px);
}
.page.active { display:flex; }
.hidden { display:none !important; }

/* ═══════════════════════════════════════════ */
/* TabBar — 固定悬浮，不随页面滚动 */
.tabbar {
  position:fixed; bottom:16px; left:50%; transform:translateX(-50%);
  width:min(var(--max-w) - 32px, calc(100vw - 32px));
  height:var(--tabbar-h);
  display:flex; align-items:center; justify-content:space-around;
  background:rgba(255,255,255,0.72);
  backdrop-filter:blur(16px) saturate(150%);
  -webkit-backdrop-filter:blur(16px) saturate(150%);
  border-radius:var(--radius-pill);
  border:1px solid rgba(255,255,255,0.4);
  box-shadow:0 4px 24px rgba(0,0,0,0.08), inset 0 1px 1px rgba(255,255,255,0.5);
  z-index:1000;
  padding:0 8px;
}
/* 隐藏非活跃页面的 tabbar */
.page:not(.active) .tabbar {
  display: none;
}

.tabbar-item {
  flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:3px; padding:6px 0;
  background:none; border:none; color:var(--text-muted); font-size:11px; cursor:pointer;
  transition:color 0.25s ease;
}
.tabbar-item.active { color:var(--primary); }
.tabbar-icon {
  display:flex; align-items:center; justify-content:center;
  font-size:20px; line-height:1;
  filter:grayscale(0.2);
  transition:filter 0.25s, transform 0.2s;
}
.tabbar-icon img { display:none; }           /* 隐藏旧 PNG 图标 */
.tabbar-icon[data-lucide] svg {
  width:20px; height:20px; stroke-width:1.8;  /* Lucide 图标 */
}
.tabbar-item.active .tabbar-icon { filter:none; }
.tabbar-label { font-size:10px; font-weight:500; }

/* ═══════════════════════════════════════════ */
/* 01 性别选择                                  */
/* ═══════════════════════════════════════════ */
.gender-bg {
  position:absolute; inset:0;
  background: radial-gradient(circle at 30% 20%, rgba(255,158,94,0.08), transparent 50%),
              radial-gradient(circle at 70% 80%, rgba(255,94,120,0.06), transparent 50%),
              var(--bg);
}
.gender-body {
  position:relative; flex:1;
  display:flex; flex-direction:column; align-items:center;
  padding:80px 32px 40px;
  overflow-y:auto;
  min-height: 0;
}
.gender-brand { text-align:center; margin-bottom:48px; }
.gender-logo { margin-bottom:12px; }
.gender-brand-title { font-size:22px; font-weight:600; color:var(--text); }
.gender-brand-sub { font-size:13px; color:var(--text-muted); margin-top:6px; }
.gender-welcome { font-size:28px; font-weight:600; color:var(--text); margin-bottom:8px; }
.gender-hint { font-size:15px; color:var(--text-muted); margin-bottom:40px; }
.gender-options {
  display:flex; gap:20px; width:100%; max-width:320px;
}
.gender-card {
  flex:1; aspect-ratio:1;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:16px;
  background:var(--card);
  border-radius:var(--radius-md);
  border:1px solid var(--border);
  box-shadow:var(--shadow-sm);
  cursor:pointer;
  transition:transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.gender-card:active { transform:scale(0.96); }
.gender-card:hover { box-shadow:var(--shadow); }
.gender-icon {
  width:64px; height:64px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-size:32px; font-weight:300;
}
.gender-icon.male { background:#E3F2FD; color:#2196F3; }
.gender-icon.female { background:#FCE4EC; color:#E91E63; }
.gender-label { font-size:16px; font-weight:500; color:var(--text2); }
.gender-footer { margin-top:auto; padding-top:32px; font-size:12px; color:var(--text-dim); }

/* ═══════════════════════════════════════════ */
/* 02 「在一起」首页 — 沉浸式                    */
/* ═══════════════════════════════════════════ */
.home-hero-bg {
  position:absolute; top:0; left:0; right:0; height:50%;
  background-size:cover; background-position:center 15%;
  background-image: url('https://images.unsplash.com/photo-1544005313-94ddf0286df2?w=600&q=80');
  filter: saturate(0.9);
}
.home-hero-overlay {
  position:absolute; top:0; left:0; right:0; height:50%;
  background: linear-gradient(180deg, rgba(250,246,240,0.1) 0%, rgba(250,246,240,0.4) 50%, var(--bg) 100%);
}
.home-intimacy-badge {
  position:absolute; top:52px; right:20px; z-index:10;
  display:flex; align-items:center; gap:4px;
  background:rgba(255,255,255,0.85);
  backdrop-filter:blur(8px);
  padding:6px 12px; border-radius:var(--radius-pill);
  border:1px solid rgba(255,255,255,0.5);
  box-shadow:var(--shadow-sm);
  font-size:13px; font-weight:600; color:var(--rose);
}
.home-intimacy-heart { font-size:12px; }
.home-body {
  position:absolute; bottom:90px; left:0; right:0;
  display:flex; flex-direction:column; align-items:center;
  padding:0 24px;
  gap:6px;
}
.home-char-card {
  width:100%; max-width:340px;
  background:var(--card);
  border-radius:var(--radius-md);
  padding:16px;
  text-align:center;
  border:1px solid var(--border-light);
  box-shadow:var(--shadow);
}
.home-char-name { font-size:22px; font-weight:600; color:var(--text); }
.home-char-greeting { font-size:14px; color:var(--text2); margin-top:4px; }
.home-char-tags {
  display:flex; flex-wrap:wrap; gap:6px; justify-content:center;
  margin-top:10px;
}
.home-tag {
  font-size:11px; color:var(--text-muted);
  background:var(--bg2); padding:3px 8px; border-radius:var(--radius-pill);
}
.home-actions {
  display:flex; gap:20px; justify-content:center;
}
.home-action-item {
  display:flex; flex-direction:column; align-items:center; gap:4px;
  cursor:pointer;
}
.home-action-icon {
  width:44px; height:44px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-size:20px; color:#fff;
  box-shadow:0 4px 12px rgba(0,0,0,0.1);
  transition:transform 0.2s;
}
.home-action-item:active .home-action-icon { transform:scale(0.92); }
.home-action-label { font-size:11px; color:var(--text2); font-weight:500; }

/* ═══════════════════════════════════════════ */
/* 03 聊天页                                    */
/* ═══════════════════════════════════════════ */
.chat-header {
  display:flex; align-items:center; gap:12px;
  padding:12px 16px; padding-top:max(12px, env(safe-area-inset-top));
  background:var(--card);
  border-bottom:1px solid var(--border);
  z-index:10;
}
.chat-header-back, .chat-header-more {
  width:36px; height:36px; border-radius:50%;
  border:none; background:transparent; font-size:20px; color:var(--text2);
  display:flex; align-items:center; justify-content:center; cursor:pointer;
}
.chat-header-center { flex:1; display:flex; align-items:center; gap:10px; }
.chat-header-avatar {
  width:40px; height:40px; border-radius:50%;
  background:var(--bg2); overflow:hidden;
  display:flex; align-items:center; justify-content:center;
  font-size:20px;
}
.chat-header-avatar img { width:100%; height:100%; object-fit:cover; }
.chat-header-info { display:flex; flex-direction:column; }
.chat-header-name { font-size:15px; font-weight:600; color:var(--text); }
.chat-header-status { font-size:12px; color:#34C759; }
.tier-pill {
  display:flex; align-items:center; gap:4px;
  padding:3px 8px; border-radius:12px;
  background:rgba(0,0,0,0.06); font-size:11px;
  color:var(--text2); white-space:nowrap;
}
.tier-pill span:first-child { font-weight:500; }
.tier-pill span:last-child {
  background:var(--primary); color:#fff;
  padding:1px 5px; border-radius:8px; font-size:10px; font-weight:600;
}
.tier-pill.warning span:last-child { background:#FF9500; }
.tier-pill.danger span:last-child { background:#FF3B30; }
.chat-messages {
  flex:1; overflow-y:auto; padding:16px; padding-bottom:8px;
  display:flex; flex-direction:column; gap:12px;
  min-height: 0;
}
.chat-empty { text-align:center; padding:60px 20px; }
.chat-empty-icon { font-size:48px; margin-bottom:12px; opacity:0.5; }
.chat-empty-text { font-size:14px; color:var(--text-muted); }

.chat-msg { display:flex; flex-direction:column; max-width:78%; }
.chat-msg.user { align-self:flex-end; align-items:flex-end; }
.chat-msg.ai { align-self:flex-start; align-items:flex-start; }
.chat-bubble {
  padding:12px 16px; border-radius:20px; font-size:15px; line-height:1.5;
  word-break:break-word;
}
.chat-msg.ai .chat-bubble {
  background:var(--card); color:var(--text);
  border-bottom-left-radius:4px;
  border:1px solid var(--border-light);
  box-shadow:var(--shadow-sm);
}
.chat-msg.user .chat-bubble {
  background:var(--primary); color:#fff;
  border-bottom-right-radius:4px;
}
.chat-time { font-size:11px; color:var(--text-dim); margin-top:4px; }

.chat-footer {
  display:flex; align-items:flex-end; gap:8px;
  padding:10px 12px 24px; padding-bottom:max(24px, env(safe-area-inset-bottom));
  background:var(--card);
  border-top:1px solid var(--border);
}
.chat-footer-voice, .chat-footer-plus, .chat-footer-send {
  width:40px; height:40px; border-radius:50%;
  border:none; display:flex; align-items:center; justify-content:center;
  font-size:20px; flex-shrink:0; cursor:pointer;
}
.chat-footer-voice { background:var(--bg2); color:var(--text2); }
.chat-footer-plus { background:var(--bg2); color:var(--text2); font-size:22px; }
.chat-footer-send { background:var(--primary); color:#fff; font-size:18px; }
.chat-input-box {
  flex:1; background:var(--bg2); border-radius:20px; padding:8px 14px;
  display:flex; align-items:center;
}
.chat-input-box textarea {
  width:100%; background:transparent; border:none; outline:none;
  font-size:15px; color:var(--text); resize:none; max-height:100px;
  font-family:inherit;
}

/* ═══════════════════════════════════════════ */
/* 04 「他们」页面                              */
/* ═══════════════════════════════════════════ */
.them-header {
  padding:16px 20px 8px; padding-top:max(16px, env(safe-area-inset-top));
}
.them-title { font-size:24px; font-weight:600; color:var(--text); }
.them-search-wrap { padding:8px 20px 12px; }
.them-search {
  display:flex; align-items:center; gap:8px;
  background:var(--card); border-radius:var(--radius-pill);
  padding:10px 16px; border:1px solid var(--border-light);
}
.them-search-icon { font-size:16px; color:var(--text-dim); }
.them-search input {
  flex:1; border:none; outline:none; background:transparent;
  font-size:14px; color:var(--text);
}
.them-tabs {
  display:flex; gap:8px; padding:0 20px 12px;
  overflow-x:auto; scrollbar-width:none;
}
.them-tabs::-webkit-scrollbar { display:none; }
.them-tab {
  padding:6px 16px; border-radius:var(--radius-pill);
  font-size:13px; font-weight:500; color:var(--text-muted);
  background:transparent; border:1px solid transparent;
  white-space:nowrap; cursor:pointer; transition:all 0.2s;
}
.them-tab.active {
  background:var(--primary); color:#fff;
}
.them-list {
  flex:1; overflow-y:auto;
  display:grid; grid-template-columns:repeat(2, 1fr); gap:12px;
  padding:0 20px 100px;
  min-height: 0;
}
.them-card {
  position:relative;
  background:var(--card); border-radius:var(--radius-sm);
  padding:16px 14px; text-align:center;
  border:1px solid var(--border-light);
  box-shadow:var(--shadow-sm);
  cursor:pointer; transition:transform 0.2s, box-shadow 0.2s;
}
.them-card-star {
  position:absolute; top:8px; right:8px;
  width:28px; height:28px; border-radius:50%;
  border:none; background:rgba(255,255,255,0.9);
  backdrop-filter:blur(4px);
  font-size:16px; color:var(--text-dim); cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  box-shadow:0 1px 4px rgba(0,0,0,0.08); z-index:2;
}
.them-card-star.active { color:var(--primary); }
.them-card-star:active { transform:scale(0.9); }
.them-card:active { transform:scale(0.97); }
.them-card-avatar {
  width:72px; height:72px; border-radius:50%; margin:0 auto 10px;
  background:var(--bg2); overflow:hidden;
  display:flex; align-items:center; justify-content:center;
  font-size:36px;
}
.them-card-avatar img { width:100%; height:100%; object-fit:cover; }
.them-card-name { font-size:15px; font-weight:600; color:var(--text); }
.them-card-lv { font-size:12px; color:var(--text-muted); margin-top:2px; }
.them-card-intimacy {
  margin-top:10px; height:4px; background:var(--bg2); border-radius:2px; overflow:hidden;
}
.them-card-intimacy-fill { height:100%; background:linear-gradient(90deg, var(--primary), var(--rose)); border-radius:2px; }
.them-add-btn {
  position:absolute; bottom:96px; right:20px; z-index:50;
  width:56px; height:56px; border-radius:50%;
  background:var(--primary); color:#fff; font-size:28px;
  border:none; box-shadow:0 4px 16px rgba(255,158,94,0.4);
  display:flex; align-items:center; justify-content:center; cursor:pointer;
}

/* ═══════════════════════════════════════════ */
/* 05 创建角色                                  */
/* ═══════════════════════════════════════════ */
.create-header {
  display:flex; align-items:center; gap:12px;
  padding:12px 16px; padding-top:max(12px, env(safe-area-inset-top));
  background:var(--card); border-bottom:1px solid var(--border);
}
.create-back {
  width:36px; height:36px; border-radius:50%; border:none;
  background:transparent; font-size:20px; color:var(--text2);
  display:flex; align-items:center; justify-content:center; cursor:pointer;
}
.create-title { font-size:17px; font-weight:600; flex:1; text-align:center; margin-right:36px; }
.create-stepper {
  position:absolute; top:max(12px, env(safe-area-inset-top)); left:50%;
  transform:translateX(-50%);
  display:flex; align-items:center; gap:8px;
  margin-top:44px;
}
.create-step {
  width:28px; height:28px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-size:13px; font-weight:600;
  background:var(--bg2); color:var(--text-muted);
  border:2px solid var(--border);
}
.create-step.active { background:var(--primary); color:#fff; border-color:var(--primary); }
.create-step-line { width:40px; height:2px; background:var(--border); border-radius:1px; }
.create-body {
  flex:1; overflow-y:auto; padding:56px 24px 40px;
  min-height: 0;
}
.create-step-label { font-size:13px; color:var(--text-muted); margin-bottom:20px; }
.create-type-grid {
  display:grid; grid-template-columns:repeat(3, 1fr); gap:14px;
}
.create-type-item {
  display:flex; flex-direction:column; align-items:center; gap:10px;
  padding:20px 8px;
  background:var(--card); border-radius:var(--radius-sm);
  border:1px solid var(--border-light);
  box-shadow:var(--shadow-sm);
  cursor:pointer; transition:all 0.2s;
}
.create-type-item:active { transform:scale(0.96); border-color:var(--primary); }
.create-type-icon { font-size:32px; }
.create-type-name { font-size:14px; font-weight:500; color:var(--text); }
.create-persona-grid {
  display:grid; grid-template-columns:repeat(2, 1fr); gap:14px;
}
.create-persona-item {
  background:var(--card); border-radius:var(--radius-sm);
  border:2px solid transparent; padding:16px;
  text-align:center; cursor:pointer; transition:all 0.2s;
}
.create-persona-item.selected { border-color:var(--primary); box-shadow:0 0 0 4px rgba(255,158,94,0.1); }
.create-persona-avatar {
  width:64px; height:64px; border-radius:50%; margin:0 auto 10px;
  background:var(--bg2); overflow:hidden;
}
.create-persona-avatar img { width:100%; height:100%; object-fit:cover; }
.create-persona-name { font-size:14px; font-weight:600; }
.create-persona-tags { display:flex; flex-wrap:wrap; gap:4px; justify-content:center; margin-top:8px; }
.create-persona-tag { font-size:11px; color:var(--text-muted); background:var(--bg2); padding:2px 8px; border-radius:var(--radius-pill); }
.create-name-wrap { margin:24px 0 12px; }
.create-name-label { display:block; font-size:13px; color:var(--text-muted); margin-bottom:8px; }
.create-name-input {
  width:100%; padding:12px 16px; border-radius:var(--radius-sm);
  border:1px solid var(--border); background:var(--card);
  font-size:15px; outline:none; font-family:inherit;
}
.create-name-input:focus { border-color:var(--primary); }
.create-submit-btn {
  width:100%; padding:14px; border-radius:var(--radius-sm);
  background:var(--primary); color:#fff; font-size:16px; font-weight:600;
  border:none; cursor:pointer; box-shadow:0 4px 16px rgba(255,158,94,0.3);
}

/* ═══════════════════════════════════════════ */
/* 06 宠物详情                                  */
/* ═══════════════════════════════════════════ */
.pet-hero {
  position:relative; padding:20px; padding-top:max(20px, env(safe-area-inset-top));
  background: linear-gradient(180deg, rgba(255,158,94,0.15), var(--bg));
  text-align:center;
}
.pet-back {
  position:absolute; top:max(16px, env(safe-area-inset-top)); left:16px;
  width:36px; height:36px; border-radius:50%; border:none;
  background:rgba(255,255,255,0.8); font-size:20px;
  display:flex; align-items:center; justify-content:center; cursor:pointer;
}
.pet-hero-avatar { font-size:100px; line-height:1; margin:20px 0 8px; }

/* 宠物页头像图片 */
.pet-hero-avatar img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  font-size: inherit;
  line-height: 1;
  vertical-align: middle;
}

/* 角色卡片头像图片 */
.them-card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  font-size: inherit; /* Reset */
  line-height: 1;    /* Reset */
  vertical-align: middle;
}

/* 聊天头部头像图片 */
.chat-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  font-size: inherit;
  line-height: 1;
  vertical-align: middle;
}


.pet-hero-name { font-size:22px; font-weight:600; color:var(--text); }
.pet-hero-speech { font-size:14px; color:var(--text-muted); margin-top:6px; font-style:italic; }
.pet-body { flex:1; overflow-y:auto; padding:0 20px 40px;   min-height: 0;
}
.pet-stats { display:flex; flex-direction:column; gap:14px; margin-bottom:24px; }
.pet-stat-row { display:flex; align-items:center; gap:12px; }
.pet-stat-icon { font-size:20px; width:28px; text-align:center; }
.pet-stat-info { flex:1; }
.pet-stat-header { display:flex; justify-content:space-between; margin-bottom:4px; }
.pet-stat-label { font-size:13px; color:var(--text2); }
.pet-stat-value { font-size:13px; font-weight:600; color:var(--text); }
.pet-stat-bar { height:6px; background:var(--bg2); border-radius:3px; overflow:hidden; }
.pet-stat-fill { height:100%; border-radius:3px; transition:width 0.5s ease; }
.pet-actions {
  display:flex; gap:16px; justify-content:center;
}
.pet-action-btn {
  width:72px; height:72px; border-radius:50%;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:4px; color:#fff; border:none; cursor:pointer;
  box-shadow:0 4px 12px rgba(0,0,0,0.12);
  transition:transform 0.2s;
}
.pet-action-btn:active { transform:scale(0.92); }
.pet-action-btn.orange { background:#FF9E5E; }
.pet-action-btn.purple { background:#C4B5FD; }
.pet-action-btn.green { background:#7DD3C0; }
.pet-action-btn.yellow { background:#FCD34D; color:#7C6A3F; }
.pet-action-icon { font-size:24px; }
.pet-action-label { font-size:11px; font-weight:500; }

/* ═══════════════════════════════════════════ */
/* 宠物列表页                                   */
/* ═══════════════════════════════════════════ */
.pets-header { padding:16px 20px 8px; padding-top:max(16px, env(safe-area-inset-top)); }
.pets-title { font-size:24px; font-weight:600; color:var(--text); }
.pets-list {
  flex:1; overflow-y:auto;
  display:grid; grid-template-columns:repeat(2, 1fr); gap:12px;
  padding:8px 20px 100px;
  min-height: 0;
}

/* ═══════════════════════════════════════════ */
/* 07 「我」个人中心                            */
/* ═══════════════════════════════════════════ */
.profile-header {
  display:flex; flex-direction:column; align-items:center;
  padding:32px 20px 20px;
  padding-top:max(32px, env(safe-area-inset-top));
}
.profile-avatar {
  width:80px; height:80px; border-radius:50%;
  background:var(--bg2); font-size:40px;
  display:flex; align-items:center; justify-content:center;
  margin-bottom:12px; overflow:hidden;
}
.profile-avatar img { width:100%; height:100%; object-fit:cover; }
.profile-name { font-size:20px; font-weight:600; color:var(--text); }
.profile-id { font-size:13px; color:var(--text-muted); margin-top:4px; }
.profile-badge {
  margin-top:8px; font-size:12px; color:var(--primary);
  background:rgba(255,158,94,0.1); padding:3px 12px; border-radius:var(--radius-pill);
}
.profile-stats {
  display:flex; justify-content:space-around;
  padding:16px 20px; margin:0 20px;
  background:var(--card); border-radius:var(--radius-sm);
  border:1px solid var(--border-light); box-shadow:var(--shadow-sm);
}
.profile-stat { text-align:center; }
.profile-stat-val { font-size:20px; font-weight:700; color:var(--text); }
.profile-stat-label { font-size:12px; color:var(--text-muted); margin-top:2px; }
.profile-memorial-entry {
  display:flex; align-items:center; gap:14px;
  margin:16px 20px; padding:18px 20px;
  background:linear-gradient(135deg, #2a2a4a, #1A1A2E);
  border-radius:var(--radius-sm); color:#fff;
  cursor:pointer; transition:transform 0.2s;
}
.profile-memorial-entry:active { transform:scale(0.98); }
.profile-memorial-icon { font-size:28px; }
.profile-memorial-text { flex:1; }
.profile-memorial-title { font-size:15px; font-weight:600; }
.profile-memorial-sub { font-size:12px; color:#a0a0c0; margin-top:2px; }
.profile-memorial-arrow { font-size:18px; color:#a0a0c0; }
.profile-menu { padding:0 20px 100px; }
.profile-menu-item {
  display:flex; align-items:center; gap:12px;
  padding:14px 0; border-bottom:1px solid var(--border-light);
  cursor:pointer;
}
.profile-menu-icon { font-size:20px; width:28px; text-align:center; }
.profile-menu-label { flex:1; font-size:15px; color:var(--text); }
.profile-menu-arrow { font-size:16px; color:var(--text-dim); }

/* ═══════════════════════════════════════════ */
/* 08 数字怀念 — 纪念模式（深色主题）            */
/* ═══════════════════════════════════════════ */
.memorial-theme { background:var(--memorial-bg); color:var(--memorial-text); }
.memorial-theme .chat-header { background:var(--memorial-bg); border-bottom-color:rgba(255,255,255,0.08); }
.memorial-theme .chat-header-back, .memorial-theme .chat-header-more { color:var(--memorial-text); }
.memorial-theme .chat-header-name { color:var(--memorial-text); }
.memorial-theme .chat-header-status { color:#a0a0c0; }
.memorial-theme .chat-footer { background:var(--memorial-bg); border-top-color:rgba(255,255,255,0.08); }
.memorial-theme .chat-input-box { background:rgba(255,255,255,0.08); }
.memorial-theme .chat-input-box textarea { color:var(--memorial-text); }
.memorial-theme .chat-input-box textarea::placeholder { color:var(--memorial-dim); }
.memorial-theme .chat-footer-voice { background:rgba(255,255,255,0.08); color:var(--memorial-text); }

.memorial-step {
  flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center;
  padding:40px 32px; text-align:center;
}
.memorial-candle-wrap { position:relative; width:120px; height:160px; margin-bottom:32px; }
.memorial-candle {
  position:absolute; bottom:0; left:50%; transform:translateX(-50%);
  width:40px; height:80px;
  background:linear-gradient(180deg, #FFF5E6, #FFD9A8);
  border-radius:4px 4px 12px 12px;
}
.memorial-flame {
  position:absolute; top:-24px; left:50%; transform:translateX(-50%);
  width:16px; height:28px;
  background:linear-gradient(180deg, #FFD9A8, #FF9E5E, #FF5E78);
  border-radius:50% 50% 50% 50% / 60% 60% 40% 40%;
  animation:flameFlicker 2s ease-in-out infinite;
}
.memorial-flame-glow {
  position:absolute; top:-40px; left:50%; transform:translateX(-50%);
  width:80px; height:80px;
  background:radial-gradient(circle, rgba(255,158,94,0.25), transparent 70%);
  animation:glowPulse 3s ease-in-out infinite;
}
@keyframes flameFlicker {
  0%, 100% { transform:translateX(-50%) scaleY(1); }
  50% { transform:translateX(-50%) scaleY(1.08) scaleX(0.95); }
}
@keyframes glowPulse {
  0%, 100% { opacity:0.6; transform:translateX(-50%) scale(1); }
  50% { opacity:1; transform:translateX(-50%) scale(1.1); }
}
.memorial-step-title { font-size:22px; font-weight:600; margin-bottom:8px; }
.memorial-step-desc { font-size:14px; color:var(--memorial-dim); margin-bottom:32px; }
.memorial-btn {
  width:100%; max-width:280px; padding:14px;
  background:linear-gradient(135deg, var(--primary), var(--rose));
  color:#fff; font-size:16px; font-weight:600;
  border:none; border-radius:var(--radius-sm);
  cursor:pointer; box-shadow:0 4px 20px rgba(255,94,120,0.3);
}
.memorial-back {
  position:absolute; top:max(16px, env(safe-area-inset-top)); left:16px;
  font-size:15px; color:var(--memorial-dim); cursor:pointer;
}
.memorial-upload {
  width:100%; max-width:280px; aspect-ratio:1;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:12px;
  border:2px dashed rgba(255,255,255,0.15); border-radius:var(--radius-md);
  margin-bottom:24px; cursor:pointer;
}
.memorial-upload-icon { font-size:40px; }
.memorial-upload-text { font-size:14px; color:var(--memorial-dim); }

/* 纪念页：称呼输入 */
.memorial-name-wrap { margin:0 auto 20px; width:100%; max-width:280px; text-align:left; }
.memorial-name-label {
  display:block; font-size:13px; color:var(--memorial-dim); margin-bottom:8px;
}
.memorial-name-input {
  width:100%; padding:12px 16px; border-radius:var(--radius-sm);
  border:1px solid rgba(255,255,255,0.12);
  background:rgba(255,255,255,0.06);
  font-size:16px; font-weight:500; color:var(--memorial-text);
  outline:none; font-family:inherit; text-align:center;
}
.memorial-name-input:focus { border-color:var(--primary); background:rgba(255,255,255,0.1); }
.memorial-name-input::placeholder { color:var(--memorial-dim); }

.memorial-textarea {
  width:100%; max-width:340px; min-height:160px;
  background:rgba(255,255,255,0.06); border:1px solid rgba(255,255,255,0.1);
  border-radius:var(--radius-sm); padding:14px;
  color:var(--memorial-text); font-size:15px; font-family:inherit;
  outline:none; resize:none; margin-bottom:20px;
}
.memorial-textarea::placeholder { color:var(--memorial-dim); }

/* 圆形进度条 */
.memorial-progress-ring { position:relative; width:140px; height:140px; margin-bottom:24px; }
.memorial-progress-ring svg { transform:rotate(-90deg); }
.memorial-progress-bg { fill:none; stroke:rgba(255,255,255,0.08); stroke-width:6; }
.memorial-progress-fill { fill:none; stroke:var(--primary); stroke-width:6; stroke-linecap:round;
  stroke-dasharray:264; stroke-dashoffset:58; /* 78% */
  transition:stroke-dashoffset 1s ease;
}
.memorial-progress-text { position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
  font-size:28px; font-weight:700; color:var(--memorial-text);
}

.memorial-bubble {
  background:var(--memorial-card) !important; color:var(--memorial-text) !important;
  border:1px solid rgba(255,255,255,0.06) !important;
}
.memorial-avatar { background:var(--memorial-card) !important; }
.memorial-send { background:linear-gradient(135deg, var(--primary), var(--rose)) !important; }

/* ═══════════════════════════════════════════ */
/* 工具类                                       */
/* ═══════════════════════════════════════════ */
.loading { display:flex; align-items:center; gap:6px; color:var(--text-muted); font-size:13px; }
.loading-dots::after { content:''; animation:dots 1.5s steps(4,end) infinite; }
@keyframes dots { 0%{content:''} 25%{content:'.'} 50%{content:'..'} 75%{content:'...'} }

.toast {
  position:fixed; top:50%; left:50%; transform:translate(-50%,-50%) scale(0.9);
  background:rgba(0,0,0,0.78); color:#fff; padding:12px 24px; border-radius:var(--radius-sm);
  font-size:14px; opacity:0; pointer-events:none; transition:all 0.3s ease;
  z-index:9999; white-space:nowrap;
}
.toast.show { opacity:1; transform:translate(-50%,-50%) scale(1); }

/* 滚动条美化 */
::-webkit-scrollbar { width:4px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--border); border-radius:2px; }

/* ═══════════════════════════════════════════ */
/* 开场 — 黑屏亮起                              */
/* ═══════════════════════════════════════════ */
.opening-screen {
  position:absolute; inset:0;
  background:#000;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:20px; color:#fff; z-index:200;
}
.opening-line-1, .opening-line-2 {
  font-size:18px; font-weight:400; letter-spacing:0.1em;
  opacity:0; transform:translateY(20px);
  transition:all 1.2s cubic-bezier(0.4,0,0.2,1);
}
.opening-line-1.show, .opening-line-2.show {
  opacity:1; transform:translateY(0);
}

/* ═══════════════════════════════════════════ */
/* 人物瞬间卡片                                 */
/* ═══════════════════════════════════════════ */
.character-select-bg {
  position:absolute; inset:0;
  background: radial-gradient(circle at 30% 20%, rgba(255,158,94,0.08), transparent 50%),
              radial-gradient(circle at 70% 80%, rgba(255,94,120,0.06), transparent 50%),
              var(--bg);
}
.character-select-body {
  position:relative; flex:1;
  display:flex; flex-direction:column;
  padding:60px 24px calc(var(--tabbar-h) + 32px);
  overflow-y:auto;
  min-height: 0;
}
.character-select-title {
  font-size:28px; font-weight:600; color:var(--text); margin-bottom:8px;
}
.character-select-subtitle {
  font-size:15px; color:var(--text-muted); margin-bottom:32px;
}
.character-select-grid {
  display:grid; grid-template-columns:repeat(2, 1fr); gap:16px;
}
.moment-card {
  background:var(--card); border-radius:var(--radius-sm);
  border:1px solid var(--border-light); box-shadow:var(--shadow-sm);
  overflow:hidden; cursor:pointer;
  transition:transform 0.2s, box-shadow 0.2s;
}
.moment-card:active { transform:scale(0.97); }
.moment-card-visual {
  width:100%; aspect-ratio:1;
  background:var(--bg2); overflow:hidden;
}
.moment-card-avatar {
  width:100%; height:100%; background-size:cover; background-position:center;
}
.moment-card-feeling {
  padding:12px; font-size:13px; color:var(--text2); text-align:center;
}
.moment-card-name {
  padding:0 12px 12px; font-size:14px; font-weight:600; color:var(--text); text-align:center;
}
.moment-card-name.hidden { display:none; }

/* Tab 栏图标样式 */
.tab-icon-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(255, 158, 94, 0.3));
}

/* 空状态图标（保持 emoji 或改为小图） */
.empty-icon {
  font-size: 3rem;
  margin-bottom: 10px;
  display: block;
}



/* ═══════════════════════════════════════════ */
/* 设置页 (BYOK)                                */
/* ═══════════════════════════════════════════ */
#page-settings {
  background: #f6f4ef;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 40px;
}
.settings-intro {
  padding: 16px 20px 4px;
}
.settings-intro-title {
  font-size: 16px;
  font-weight: 600;
  color: #3a2f28;
  margin-bottom: 6px;
}
.settings-intro-desc {
  font-size: 13px;
  color: #8a7d75;
  line-height: 1.6;
}
#settings-form {
  padding: 12px 20px;
}
.settings-section {
  margin-bottom: 18px;
}
.settings-label {
  font-size: 13px;
  color: #6b5e56;
  margin-bottom: 6px;
  font-weight: 500;
}
.settings-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #e4ddd3;
  background: #fff;
  font-size: 14px;
  color: #3a2f28;
  outline: none;
  transition: border-color .15s;
}
.settings-input:focus {
  border-color: #FF9E5E;
}
.settings-hint {
  margin-top: 6px;
  font-size: 12px;
  color: #a89b92;
}
.settings-hint a { color: #FF7A45; text-decoration: underline; }
.settings-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}
.settings-btn {
  flex: 1;
  padding: 12px;
  border-radius: 14px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .1s, opacity .1s;
}
.settings-btn:active { transform: scale(0.97); }
.settings-btn.primary {
  background: linear-gradient(135deg, #FF9E5E, #FF5E78);
  color: #fff;
}
.settings-btn.secondary {
  background: #fff;
  color: #6b5e56;
  border: 1px solid #e4ddd3;
}
.settings-btn.danger {
  width: 100%;
  background: #fff;
  color: #d45a5a;
  border: 1px solid #eccfcf;
}
.settings-result {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  min-height: 1em;
  color: #6b5e56;
  word-break: break-word;
}
.settings-result.ok {
  background: #ecf7ec;
  color: #2f7a3a;
}
.settings-result.error {
  background: #faeaea;
  color: #b44040;
}
.tier-pill.warning { background: #fff5e0; color: #a87020; }

/* ═══════════════════════════════════════════
   数据管理
   ═══════════════════════════════════════════ */
.data-mgmt-page {
  padding: 20px 16px;
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
}
.data-mgmt-info-card {
  background: #fff5f5;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}
.data-mgmt-info-title {
  font-size: 15px;
  font-weight: 600;
  color: #c0392b;
  margin-bottom: 8px;
}
.data-mgmt-info-text {
  font-size: 13px;
  color: #6b5e56;
  line-height: 1.6;
}
.data-mgmt-stats-bar {
  background: rgba(255, 255, 255, 0.6);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 16px;
}
.data-mgmt-stat-line {
  font-size: 14px;
  font-weight: 500;
  color: #3c3c43;
  text-align: center;
}
.data-mgmt-key-detail {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  font-size: 12px;
  color: #8e8e93;
}
.data-mgmt-key-detail span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.data-mgmt-key-detail {
  display: flex;
  flex-direction: column;
}
.data-mgmt-key-detail > div {
  display: flex;
  justify-content: space-between;
}
.data-mgmt-actions {
  display: grid;
  gap: 12px;
}
.data-mgmt-btn {
  padding: 14px 20px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}
.data-mgmt-btn:active {
  opacity: 0.7;
}
.action-export {
  background: var(--primary, #6366f1);
  color: #fff;
}
.action-import {
  background: #f0f0f5;
  color: var(--text-primary, #3c3c43);
}
.action-reset {
  background: #fff;
  border: 1px solid #e5e5ea;
  color: #c0392b;
  margin-top: 8px;
}
.data-mgmt-result {
  margin-top: 16px;
  padding: 12px;
  border-radius: 10px;
  font-size: 13px;
  text-align: center;
  min-height: 1em;
}
.data-mgmt-result.success {
  background: #ecf7ec;
  color: #2f7a3a;
}
.data-mgmt-result.error {
  background: #faeaea;
  color: #b44040;
}

/* Mobile 适配 */
@media (prefers-color-scheme: dark) {
  .data-mgmt-info-card {
    background: #2a1a1a;
    border: 1px solid #3a2a2a;
  }
  .data-mgmt-info-title {
    color: #ff6b6b;
  }
  .data-mgmt-info-text {
    color: #a0a0b0;
  }
  .data-mgmt-stats-bar {
    background: rgba(255, 255, 255, 0.06);
  }
  .data-mgmt-stat-line {
    color: #e0e0e0;
  }
  .data-mgmt-key-detail {
    color: #666;
  }
  .action-import {
    background: #2a2a3a;
    color: #e0e0e0;
  }
  .action-reset {
    background: #1a1a2e;
    border-color: #3a3a4a;
  }
  .data-mgmt-result.success {
    background: #1a2a1a;
    color: #4ade80;
  }
  .data-mgmt-result.error {
    background: #2a1a1a;
    color: #f87171;
  }
}
