/* ========== CSS Variables ========== */
:root {
  --color-ink: #2C2C2C;
  --color-gold: #C9A96E;          /* 装饰色，正文不要直接用 */
  --color-gold-text: #9C7E3F;     /* 用于文本时的加深金色（对比度达 4.5:1） */
  --color-paper: #F5F0E8;
  --color-red: #C84B31;
  --color-red-hover: #A83D28;
  --color-gray: #6A7686;          /* 加深到 4.5:1 */
  --color-gray-soft: #8B9DAF;     /* 软灰，仅用于装饰边框 */
  --color-light: #E8E0D4;
  --shadow-card: 0 4px 20px rgba(44,44,44,0.08);
  --shadow-card-hover: 0 8px 30px rgba(44,44,44,0.14);
  --radius: 12px;
  --font-serif: 'Noto Serif SC', serif;
  --font-sans: 'Noto Sans SC', sans-serif;
  --font-kai: 'Ma Shan Zheng', 'KaiTi', 'STKaiti', cursive;
}

/* ========== 全局焦点描边（可访问性） ========== */
*:focus-visible {
  outline: 2px solid var(--color-red);
  outline-offset: 2px;
  border-radius: 4px;
}

/* 触摸设备：禁用 hover 效果（防止粘连） */
@media (hover: none) {
  .btn-mic:hover, .btn-send:hover, .btn-demo:hover, .nav-back:hover {
    background: inherit !important;
    color: inherit !important;
  }
}

/* 加载动画 */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ========== Reset & Base ========== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background-color: var(--color-paper);
  color: var(--color-ink);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4 { font-family: var(--font-serif); font-weight: 600; }

/* ========== Page System ========== */
.page {
  display: none;
  min-height: 100vh;
  min-height: 100dvh;
  min-width: 0;
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.page.active {
  display: block;
  opacity: 1;
  transform: translateX(0);
}
.page.fade-in {
  animation: pageIn 0.5s ease forwards;
}
@keyframes pageIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ========== Navigation Bar ========== */
.nav-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: rgba(245,240,232,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(201,169,110,0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  transition: all 0.3s ease;
}
.nav-bar .nav-back {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--color-gray);
  font-size: 14px;
  font-family: var(--font-sans);
  background: none;
  border: none;
  transition: color 0.2s;
}
.nav-bar .nav-back:hover { color: var(--color-ink); }
.nav-bar .nav-back svg { width: 20px; height: 20px; }
.nav-bar .nav-title {
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--color-ink);
  letter-spacing: 2px;
}
.nav-bar .nav-progress {
  display: flex;
  gap: 6px;
  align-items: center;
}
.nav-bar .nav-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #D0D0D0;
  transition: background 0.3s;
}
.nav-bar .nav-dot.done { background: var(--color-gold); }

/* ========== HOME PAGE ========== */
#page-home { padding-top: 0; }

.hero-section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
  position: relative;
  overflow: hidden;
  /* 真实背景图 + 米色蒙层叠加：保留氛围，保证文字可读，维持品牌纸质感 */
  background-image:
    linear-gradient(180deg, rgba(245,240,232,0.70) 0%, rgba(245,240,232,0.82) 60%, rgba(245,240,232,0.90) 100%),
    url('/assets/05_首页背景.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Ink wash background effect */
.hero-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 600px 400px at 20% 30%, rgba(44,44,44,0.04) 0%, transparent 70%),
    radial-gradient(ellipse 500px 350px at 80% 60%, rgba(44,44,44,0.03) 0%, transparent 70%),
    radial-gradient(ellipse 400px 300px at 50% 80%, rgba(201,169,110,0.04) 0%, transparent 70%),
    radial-gradient(ellipse 300px 250px at 70% 20%, rgba(139,157,175,0.03) 0%, transparent 70%);
  pointer-events: none;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: 52px;
  font-weight: 700;
  color: var(--color-ink);
  letter-spacing: 8px;
  margin-bottom: 16px;
  opacity: 0;
  animation: fadeDown 0.8s ease 0.2s forwards;
}

.hero-divider {
  width: 60px;
  height: 2px;
  background: var(--color-gold);
  margin: 0 auto 16px;
  opacity: 0;
  animation: fadeIn 0.6s ease 0.5s forwards;
}

.hero-subtitle {
  font-size: 20px;
  color: var(--color-gray);
  font-weight: 300;
  letter-spacing: 2px;
  margin-bottom: 40px;
  opacity: 0;
  animation: fadeDown 0.8s ease 0.6s forwards;
}

.hero-cta {
  display: inline-block;
  padding: 16px 48px;
  background: var(--color-red);
  color: white;
  font-size: 18px;
  font-family: var(--font-sans);
  font-weight: 500;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  letter-spacing: 2px;
  transition: all 0.3s ease;
  opacity: 0;
  animation: fadeDown 0.8s ease 0.8s forwards;
  text-decoration: none;
}
.hero-cta:hover {
  background: var(--color-red-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(200,75,49,0.35);
}

.hero-stat {
  margin-top: 32px;
  font-size: 14px;
  color: var(--color-gray);
  font-style: italic;
  opacity: 0;
  animation: fadeIn 0.8s ease 1.2s forwards;
}

@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}
/* fadeIn 统一定义在下方（含 translateY 上浮），此处不再重复声明 */

/* Concept Cards */
.concept-section {
  padding: 60px 24px 80px;
  max-width: 960px;
  margin: 0 auto;
}
.concept-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}
.concept-card {
  background: white;
  border-radius: var(--radius);
  padding: 32px 24px;
  box-shadow: var(--shadow-card);
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  opacity: 0;
  animation: fadeUp 0.6s ease forwards;
}
.concept-card:nth-child(1) { animation-delay: 0.3s; }
.concept-card:nth-child(2) { animation-delay: 0.5s; }
.concept-card:nth-child(3) { animation-delay: 0.7s; }
.concept-card:nth-child(4) { animation-delay: 0.9s; }
.concept-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
}
/* 印章图标：48x48px，居中显示，下方留8px间距再接标题 */
.concept-icon {
  margin-bottom: 8px;
  display: flex;
  justify-content: center;
}
.concept-icon .seal-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
}
/* hover 盖章效果：放大 + 轻微旋转 */
.concept-card:hover .seal-img {
  transform: scale(1.1) rotate(3deg);
}
.concept-card h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--color-ink);
}
.concept-card p {
  font-size: 14px;
  color: var(--color-gray);
  line-height: 1.6;
}
.concept-quote {
  margin-top: 16px;
  font-family: var(--font-kai);
  font-size: 15px;
  color: var(--color-gold);
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Demo Preview Link */
.demo-preview {
  text-align: center;
  padding: 20px 24px 80px;
}
.demo-preview-link {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--color-red);
  font-size: 16px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}
.demo-preview-link:hover {
  text-decoration: underline;
}

/* ========== HOME FOOTER：飞书项目文档外链 ========== */
/* 设计原则：低调淡金色 + 暖纸卷质感，不抢 hero-cta 主操作红 */
.home-footer {
  padding: 28px 24px 56px;
  text-align: center;
  border-top: 1px solid rgba(201, 169, 110, 0.18);  /* 淡金色细分隔线，与品牌呼应 */
  background: linear-gradient(180deg, transparent 0%, rgba(245, 240, 232, 0.6) 100%);
}
.home-footer-inner {
  max-width: 960px;   /* 与 .concept-section 对齐 */
  margin: 0 auto;
}
.home-footer-text {
  font-size: 14px;
  color: var(--color-gray);
  line-height: 1.8;
  margin: 0 0 10px;
}
.home-footer-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: 1px solid rgba(201, 169, 110, 0.32);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--color-gold-text);          /* 加深金 #9C7E3F，满足 WCAG 4.5:1 对比度 */
  font-size: 14px;
  letter-spacing: 0.5px;
  text-decoration: none;
  font-family: var(--font-sans);
  transition: all 0.25s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.home-footer-link:hover {
  color: var(--color-red);
  border-color: rgba(200, 75, 49, 0.45);
  background: #fff;
  box-shadow: 0 4px 14px rgba(201, 169, 110, 0.18);
  transform: translateY(-1px);
}
.home-footer-link:active {
  transform: translateY(0);
}
.home-footer-link:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: 3px;
}
.home-footer-icon {
  font-size: 16px;
  line-height: 1;
}
.home-footer-label {
  font-weight: 500;
}
.home-footer-arrow {
  font-size: 13px;
  opacity: 0.75;
  margin-left: 2px;
}
.home-footer-copy {
  font-size: 12px;
  color: rgba(106, 118, 134, 0.7);  /* 在 --color-gray 基础上再淡一层，作为版权小字 */
  margin: 14px 0 0;
  letter-spacing: 1px;
  font-family: var(--font-serif);
}

/* ========== INTERVIEW PAGE ========== */
#page-interview { padding-top: 60px; }

.interview-container {
  max-width: 720px;
  margin: 0 auto;
  height: calc(100vh - 60px);
  height: calc(100dvh - 60px);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ========== 呼吸感球体 ========== */
.breath-orb-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
  animation: fadeIn 0.5s ease;
}

.breath-orb {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.breath-orb-inner {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--color-gold), var(--color-red));
  box-shadow: 0 0 40px rgba(200, 75, 49, 0.4);
  animation: breathPulse 3s ease-in-out infinite;
}

.breath-orb-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid var(--color-gold);
  opacity: 0.3;
  animation: breathRing 3s ease-in-out infinite;
}

.breath-orb-text {
  margin-top: 20px;
  font-size: 14px;
  color: var(--color-gray);
  font-family: var(--font-sans);
  animation: breathTextFade 3s ease-in-out infinite;
}

@keyframes breathPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 40px rgba(200, 75, 49, 0.4);
  }
  50% {
    transform: scale(1.15);
    box-shadow: 0 0 60px rgba(200, 75, 49, 0.6);
  }
}

@keyframes breathRing {
  0%, 100% {
    transform: scale(1);
    opacity: 0.3;
  }
  50% {
    transform: scale(1.3);
    opacity: 0;
  }
}

@keyframes breathTextFade {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* AI 说话时球体状态 */
.breath-orb.speaking .breath-orb-inner {
  animation: speakPulse 0.8s ease-in-out infinite;
  background: radial-gradient(circle at 30% 30%, var(--color-red), #ff6b4a);
}

.breath-orb.speaking .breath-orb-ring {
  animation: speakRing 0.8s ease-in-out infinite;
}

@keyframes speakPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 40px rgba(200, 75, 49, 0.6);
  }
  50% {
    transform: scale(1.25);
    box-shadow: 0 0 80px rgba(200, 75, 49, 0.8);
  }
}

@keyframes speakRing {
  0%, 100% {
    transform: scale(1);
    opacity: 0.4;
  }
  50% {
    transform: scale(1.5);
    opacity: 0;
  }
}

/* 方言探测中球体状态（金色脉冲） */
.breath-orb.detecting .breath-orb-inner {
  animation: probePulse 1.2s ease-in-out infinite;
  background: radial-gradient(circle at 30% 30%, #f0b429, #d48806);
}
.breath-orb.detecting .breath-orb-ring {
  animation: probeRing 1.2s ease-in-out infinite;
}

@keyframes probePulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 40px rgba(240, 180, 41, 0.5);
  }
  50% {
    transform: scale(1.15);
    box-shadow: 0 0 70px rgba(240, 180, 41, 0.8);
  }
}

@keyframes probeRing {
  0% { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* 方言提示 toast */
.dialect-toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(212, 136, 6, 0.92);
  color: #fff;
  padding: 10px 24px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(212, 136, 6, 0.4);
}
.dialect-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 方言选择器 */
.dialect-row {
  position: relative;
  display: flex;
  justify-content: center;
  margin-top: 6px;
}
.dialect-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  min-height: 36px;
  box-sizing: border-box;
  border: 1px solid rgba(200, 75, 49, 0.3);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--color-red, #c84b31);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.dialect-pill:hover {
  background: rgba(200, 75, 49, 0.08);
  border-color: var(--color-red, #c84b31);
}
.dialect-dropdown {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  padding: 4px 0;
  z-index: 100;
  min-width: 140px;
  margin-bottom: 4px;
}
.dialect-option {
  appearance: none;
  width: 100%;
  border: 0;
  background: transparent;
  font-family: inherit;
  text-align: left;
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
  color: #333;
  transition: background 0.15s;
  white-space: nowrap;
}
.dialect-option:hover {
  background: rgba(200, 75, 49, 0.08);
}

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

/* ========== 记忆卡片弹窗（水墨风精美卡片）========== */
.memory-card-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 15, 10, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
  padding: 20px;
}

.memory-card-modal {
  background: var(--color-paper, #faf6ed);
  border-radius: 16px;
  max-width: 420px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(200, 169, 86, 0.2);
  animation: cardScrollIn 1.2s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
}

@keyframes cardScrollIn {
  0% {
    opacity: 0;
    transform: translateY(60px) scale(0.7) rotateX(20deg);
    filter: blur(8px);
  }
  60% {
    opacity: 1;
    transform: translateY(0) scale(1.02) rotateX(0);
    filter: blur(0);
  }
  100% {
    transform: scale(1);
  }
}

/* 卡片顶部：水墨画图片 */
.mc-hero {
  position: relative;
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, #c84b31 0%, #c8a956 100%);
  overflow: hidden;
  border-radius: 16px 16px 0 0;
}
.mc-hero::before {
  content: none;
}
@keyframes heroFadeIn {
  to { opacity: 0.85; }
}
.mc-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(250, 246, 237, 0.95) 100%);
}

.mc-hero-content {
  position: absolute;
  bottom: 16px;
  left: 24px;
  right: 24px;
  z-index: 2;
}

.mc-tag-wrap {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--color-red, #c84b31);
  font-size: 12px;
  border-radius: 4px;
  margin-bottom: 8px;
  font-family: var(--font-serif, serif);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  animation: tagSlideIn 0.6s ease 0.8s both;
}

@keyframes tagSlideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

.mc-title {
  font-family: var(--font-serif, serif);
  font-size: 26px;
  color: var(--color-ink, #2c2c2c);
  margin: 0;
  text-shadow: 0 2px 8px rgba(255, 255, 255, 0.8);
  animation: titleSlideIn 0.8s ease 1s both;
}

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

.mc-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  font-size: 22px;
  color: var(--color-ink, #2c2c2c);
  cursor: pointer;
  border-radius: 50%;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.2s;
}
.mc-close:hover {
  background: white;
  transform: rotate(90deg);
}

.mc-body {
  padding: 24px;
  animation: bodyFadeIn 0.8s ease 1.2s both;
}

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

.mc-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px dashed rgba(200, 75, 49, 0.2);
}
.mc-meta-item {
  font-size: 12px;
  color: var(--color-gray, #888);
}
.mc-meta-item strong {
  color: var(--color-red, #c84b31);
  font-family: var(--font-serif, serif);
  font-size: 14px;
  margin-right: 4px;
}

.mc-section {
  margin: 18px 0;
  opacity: 0;
  animation: sectionStagger 0.6s ease forwards;
}
.mc-section:nth-of-type(1) { animation-delay: 1.4s; }
.mc-section:nth-of-type(2) { animation-delay: 1.6s; }
.mc-section:nth-of-type(3) { animation-delay: 1.8s; }
.mc-section:nth-of-type(4) { animation-delay: 2.0s; }

@keyframes sectionStagger {
  from { opacity: 0; transform: translateX(-15px); }
  to { opacity: 1; transform: translateX(0); }
}

.mc-section-title {
  font-family: var(--font-serif, serif);
  font-size: 15px;
  color: var(--color-red, #c84b31);
  margin-bottom: 8px;
  padding-left: 10px;
  border-left: 3px solid var(--color-gold, #c8a956);
  letter-spacing: 1px;
}
.mc-section-text {
  font-size: 14px;
  line-height: 1.8;
  color: var(--color-ink, #2c2c2c);
  font-family: var(--font-serif, serif);
}

.mc-list {
  margin: 0;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.9;
  color: var(--color-ink, #2c2c2c);
  font-family: var(--font-serif, serif);
}
.mc-list li {
  position: relative;
  list-style: none;
  padding-left: 4px;
}
.mc-list li::before {
  content: '·';
  position: absolute;
  left: -16px;
  color: var(--color-red, #c84b31);
  font-size: 20px;
  font-weight: bold;
  line-height: 1.4;
}

.mc-quotes {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mc-quote {
  background: linear-gradient(135deg, rgba(200, 169, 86, 0.12), rgba(200, 75, 49, 0.06));
  padding: 12px 16px;
  border-radius: 8px;
  font-style: italic;
  color: var(--color-ink, #2c2c2c);
  font-size: 15px;
  border-left: 3px solid var(--color-gold, #c8a956);
  font-family: var(--font-serif, serif);
  position: relative;
}
.mc-quote::before {
  content: '"';
  position: absolute;
  left: 8px;
  top: -4px;
  font-size: 32px;
  color: var(--color-gold, #c8a956);
  opacity: 0.3;
  font-family: serif;
}

.mc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}
.mc-tag {
  background: rgba(200, 75, 49, 0.08);
  color: var(--color-red, #c84b31);
  padding: 5px 14px;
  border-radius: 16px;
  font-size: 12px;
  border: 1px solid rgba(200, 75, 49, 0.2);
}

.mc-share {
  display: flex;
  gap: 16px;
  margin-top: 24px;
  padding: 18px;
  background: linear-gradient(135deg, rgba(200, 169, 86, 0.1), rgba(250, 246, 237, 0.5));
  border-radius: 10px;
  align-items: center;
  border: 1px dashed rgba(200, 169, 86, 0.4);
}
.mc-qr {
  width: 90px;
  height: 90px;
  border-radius: 6px;
  background: white;
  padding: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.mc-share-text { flex: 1; min-width: 0; }
.mc-share-title {
  font-family: var(--font-serif, serif);
  font-size: 15px;
  color: var(--color-red, #c84b31);
  margin-bottom: 6px;
  letter-spacing: 1px;
}
.mc-share-desc {
  font-size: 11px;
  color: var(--color-gray, #888);
  margin-bottom: 8px;
  line-height: 1.5;
}
.mc-copy-btn {
  padding: 6px 14px;
  border: 1px solid var(--color-red, #c84b31);
  background: transparent;
  color: var(--color-red, #c84b31);
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-serif, serif);
}
.mc-copy-btn:hover { background: var(--color-red, #c84b31); color: white; }

.mc-actions {
  display: flex;
  justify-content: center;
  padding: 0 24px 24px;
  gap: 12px;
}
.mc-btn-secondary {
  padding: 10px 28px;
  border: 1px solid var(--color-red, #c84b31);
  background: transparent;
  color: var(--color-red, #c84b31);
  border-radius: 24px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  font-family: var(--font-serif, serif);
  letter-spacing: 1px;
}
.mc-btn-secondary:hover {
  background: var(--color-red, #c84b31);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(200, 75, 49, 0.3);
}

.chat-area {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

.chat-bubble {
  display: flex;
  width: 100%;
  min-width: 0;
  gap: 12px;
  margin-bottom: 20px;
  opacity: 0;
  animation: bubbleIn 0.4s ease forwards;
}
.chat-bubble.ai { flex-direction: row; }
.chat-bubble.user { flex-direction: row-reverse; }

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

.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-family: var(--font-serif);
  font-weight: 600;
  flex-shrink: 0;
}
.chat-bubble.ai .chat-avatar {
  background: var(--color-gold);
  color: white;
}
.chat-bubble.user .chat-avatar {
  background: var(--color-red);
  color: white;
}

.chat-content {
  flex: 0 1 70%;
  min-width: 0;
  max-width: 70%;
}
.chat-bubble.user .chat-content { text-align: right; }

.chat-text {
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.8;
  display: inline-block;
  max-width: 100%;
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.chat-bubble.ai .chat-text {
  background: white;
  border-top-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.chat-bubble.user .chat-text {
  background: rgba(201,169,110,0.12);
  border-top-right-radius: 4px;
}

.chat-time {
  font-size: 12px;
  color: var(--color-gray);
  margin-top: 4px;
  padding: 0 4px;
}

/* ✅ 卡片召回气泡：点击重新打开记忆卡片，自然融入对话流 */
.chat-bubble.ai .chat-text.card-recall {
  cursor: pointer;
  background: linear-gradient(135deg, #fff9ee 0%, #f7ecd2 100%);
  /* 用 box-shadow 模拟边框，避免 border 占位导致与普通气泡左边线错位 */
  box-shadow: 0 0 0 1px rgba(200, 169, 110, 0.35), 0 2px 8px rgba(0,0,0,0.04);
  border-top-left-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  user-select: none;
}
.chat-bubble.ai .chat-text.card-recall:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 0 1px rgba(200, 169, 110, 0.5), 0 6px 16px rgba(200, 169, 110, 0.25);
}
.chat-bubble.ai .chat-text.card-recall:active {
  transform: translateY(0);
}
.chat-bubble.ai .chat-text.card-recall:focus-visible {
  outline: 2px solid #c9a96e;
  outline-offset: 2px;
}
.chat-bubble.ai .chat-text.card-recall .recall-main {
  flex: 1;
  min-width: 0;
  color: #5a4a30;
  line-height: 1.5;
}
.chat-bubble.ai .chat-text.card-recall .recall-title {
  color: #a8783c;
  font-weight: 600;
}
.chat-bubble.ai .chat-text.card-recall .recall-hint {
  display: block;
  font-size: 12px;
  color: #8a7349;
  margin-top: 3px;
  opacity: 0.85;
}
.chat-bubble.ai .chat-text.card-recall .recall-arrow {
  margin-left: auto;
  color: #c9a96e;
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 14px 18px;
  background: white;
  border-radius: 12px;
  border-top-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  width: fit-content;
}
.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-gray);
  animation: typingBounce 1.4s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Input Area */
.input-area {
  padding: 16px 24px;
  background: white;
  border-top: 1px solid rgba(0,0,0,0.06);
  flex: 0 0 auto;
  min-width: 0;
}
.input-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.input-field {
  flex: 1;
  width: 0;
  min-width: 0;
  padding: 12px 20px;
  border: 1px solid #E0E0E0;
  border-radius: 24px;
  font-size: 15px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.2s;
  background: var(--color-paper);
}
.input-field:focus { border-color: var(--color-gold); }
.input-field::placeholder { color: #B0B0B0; }

/* iOS 安全区适配 */
@supports (padding: env(safe-area-inset-bottom)) {
  .nav-bar {
    height: calc(60px + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
    padding-left: max(24px, env(safe-area-inset-left));
    padding-right: max(24px, env(safe-area-inset-right));
  }
  #page-interview {
    padding-top: calc(60px + env(safe-area-inset-top));
  }
  .interview-container {
    height: calc(100vh - 60px - env(safe-area-inset-top));
    height: calc(100dvh - 60px - env(safe-area-inset-top));
  }
  .input-area {
    padding-right: max(24px, env(safe-area-inset-right));
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    padding-left: max(24px, env(safe-area-inset-left));
  }
}

.btn-mic {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: #F0F0F0;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
  overflow: hidden;
}
/* 声字印章：填满圆形按钮，hover 盖戳效果 */
.btn-mic-seal {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.btn-mic:hover { background: #E0E0E0; }
.btn-mic:hover .btn-mic-seal { transform: scale(1.12) rotate(4deg); }
.btn-mic:active .btn-mic-seal { transform: scale(0.95); }
.btn-mic.recording {
  background: var(--color-red);
  animation: pulse 1.5s infinite;
}
.btn-mic.recording .btn-mic-seal { filter: brightness(0) invert(1); }
.btn-mic.connecting { animation: blink 0.8s infinite; }
.btn-mic.connecting .btn-mic-seal { opacity: 0.6; }
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(200,75,49,0.4); }
  50% { box-shadow: 0 0 0 12px rgba(200,75,49,0); }
}

.btn-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--color-red);
  color: white;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.btn-send:hover { background: var(--color-red-hover); transform: scale(1.05); }

.input-hint {
  text-align: center;
  font-size: 12px;
  color: #B0B0B0;
  margin-top: 8px;
}

/* Demo mode button */
.demo-btn-wrap {
  text-align: center;
  padding: 8px 0 4px;
}
.btn-demo {
  padding: 6px 18px;
  background: transparent;
  border: 1px dashed rgba(139, 157, 175, 0.5);
  color: #6A7686;       /* 加深，对比度提升到 4.5:1 */
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.2s;
  opacity: 0.7;
}
.btn-demo:hover {
  opacity: 1;
  border-style: solid;
  background: rgba(139, 157, 175, 0.1);
  color: white;
}

/* Transition overlay */
.transition-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-paper);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.transition-overlay[hidden] {
  display: none;
}
.transition-overlay.active {
  opacity: 1;
  pointer-events: all;
}
.transition-text {
  font-family: var(--font-serif);
  font-size: 22px;
  color: var(--color-ink);
  margin-bottom: 24px;
}
.ink-loader {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--color-gold) 0%, transparent 70%);
  animation: inkPulse 1.5s ease-in-out infinite;
}
@keyframes inkPulse {
  0%, 100% { transform: scale(0.8); opacity: 0.3; }
  50% { transform: scale(1.2); opacity: 0.8; }
}

/* ========== GARDEN PAGE ========== */
#page-garden { padding-top: 60px; }

.garden-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.garden-header {
  text-align: center;
  margin-bottom: 48px;
}
.garden-header h2 {
  font-size: 32px;
  color: var(--color-ink);
  margin-bottom: 12px;
}
.garden-header .gold-line {
  width: 80px;
  height: 2px;
  background: var(--color-gold);
  margin: 0 auto 12px;
}
.garden-header .stats {
  font-size: 14px;
  color: var(--color-gray);
}

/* Memory Card Grid */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 48px;
}

.memory-card {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  opacity: 0;
  animation: fadeUp 0.6s ease forwards;
}
.memory-card:nth-child(1) { animation-delay: 0.1s; }
.memory-card:nth-child(2) { animation-delay: 0.25s; }
.memory-card:nth-child(3) { animation-delay: 0.4s; }
.memory-card:nth-child(4) { animation-delay: 0.55s; }
.memory-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
}
.memory-card:hover .card-image img {
  transform: scale(1.03);
}

.card-image {
  width: 100%;
  height: 240px;
  overflow: hidden;
  position: relative;
}
.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.card-body {
  padding: 20px;
}
.card-tag {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(201,169,110,0.1);
  color: var(--color-gold);
  border-radius: 20px;
  font-size: 12px;
  margin-bottom: 12px;
}
.card-body h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--color-ink);
}
.card-body .card-summary {
  font-size: 14px;
  color: #666;
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-link {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  display: inline-block;
  margin-top: 12px;
  color: var(--color-red);
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 500;
}
.card-link:hover { text-decoration: underline; }

/* Quote Cards */
.quote-section {
  margin-bottom: 48px;
}
.quote-section h2 {
  font-size: 24px;
  margin-bottom: 24px;
  text-align: center;
}
/* 印章标题：印章图标 + 文字垂直居中对齐 */
.seal-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.seal-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  object-fit: contain;
}
.quote-scroll {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding: 8px 0 16px;
  scroll-snap-type: x mandatory;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.quote-scroll::-webkit-scrollbar { display: none; }

.quote-card {
  min-width: 240px;
  height: 300px;
  background: linear-gradient(145deg, #2C2C2C 0%, #3D3D3D 100%);
  border-radius: var(--radius);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  scroll-snap-align: start;
  transition: transform 0.3s ease;
  position: relative;
  overflow: hidden;
}
.quote-card::after {
  content: '';
  position: absolute;
  bottom: 20px;
  left: 24px;
  right: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-gold), transparent);
}
.quote-card:hover { transform: rotate(2deg) translateY(-4px); }

.quote-text {
  font-family: var(--font-kai);
  font-size: 22px;
  color: var(--color-gold);
  line-height: 1.6;
  text-align: center;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.quote-author {
  font-size: 14px;
  color: var(--color-gray);
  text-align: right;
}

/* Bottom Actions */
.garden-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}
.btn-outline {
  padding: 12px 32px;
  border: 1.5px solid var(--color-red);
  color: var(--color-red);
  background: transparent;
  border-radius: 24px;
  font-size: 15px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.2s;
}
.btn-outline:hover {
  background: var(--color-red);
  color: white;
}
.btn-solid {
  padding: 12px 32px;
  border: none;
  background: var(--color-red);
  color: white;
  border-radius: 24px;
  font-size: 15px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.2s;
}
.btn-solid:hover {
  background: var(--color-red-hover);
  transform: translateY(-1px);
}

/* ========== TIMELINE PAGE ========== */
#page-timeline { padding-top: 60px; }

.timeline-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.timeline-header {
  text-align: center;
  margin-bottom: 48px;
}
.timeline-header h2 {
  font-size: 32px;
  margin-bottom: 8px;
}
.timeline-header .range {
  font-size: 14px;
  color: var(--color-gray);
}

/* Vertical Timeline */
.timeline {
  position: relative;
  padding: 20px 0;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--color-gold);
  transform: translateX(-50%);
}

.timeline-item {
  position: relative;
  margin-bottom: 40px;
  display: flex;
  opacity: 0;
}
.timeline-item.visible {
  animation: timelineIn 0.6s ease forwards;
}
.timeline-item:nth-child(odd) { justify-content: flex-start; padding-right: 52%; }
.timeline-item:nth-child(even) { justify-content: flex-end; padding-left: 52%; }

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

.timeline-dot {
  position: absolute;
  left: 50%;
  top: 20px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-gold);
  border: 3px solid var(--color-paper);
  transform: translateX(-50%);
  z-index: 2;
}

.timeline-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-card);
  width: 100%;
  transition: transform 0.3s ease;
}
.timeline-card:hover { transform: translateY(-2px); }

.timeline-card .tc-tag {
  display: inline-block;
  padding: 3px 10px;
  background: rgba(201,169,110,0.1);
  color: var(--color-gold);
  border-radius: 12px;
  font-size: 12px;
  margin-bottom: 8px;
}
.timeline-card h3 {
  font-size: 18px;
  margin-bottom: 6px;
}
/* 时间节点标题：水墨小图标 + 标题文字垂直居中对齐 */
.timeline-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.timeline-node-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;            /* 圆形裁切 */
  object-fit: cover;             /* 裁切填充 */
  object-position: center;       /* 居中裁切 */
  border: 2px solid #C9A96E;     /* 暖金色边框 */
  box-shadow: 0 2px 8px rgba(44,44,44,0.15);
  flex-shrink: 0;
  transition: transform 0.3s ease, border-width 0.3s ease;
}
/* hover：图标轻微放大 + 边框变粗 */
.timeline-card:hover .timeline-node-icon {
  transform: scale(1.2);
  border-width: 3px;
}
.timeline-card p {
  font-size: 14px;
  color: #666;
  line-height: 1.7;
}
.timeline-card .tc-link {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  display: inline-block;
  margin-top: 10px;
  color: var(--color-red);
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
}

.timeline-ending {
  text-align: center;
  margin-top: 40px;
  padding-top: 20px;
}
.timeline-ending p {
  font-family: var(--font-kai);
  font-size: 20px;
  color: var(--color-gold);
  margin-bottom: 24px;
}

/* ========== Responsive ========== */
@media (max-width: 900px) {
  .concept-grid { grid-template-columns: repeat(2, 1fr); max-width: 560px; margin: 0 auto; }
}
@media (max-width: 768px) {
  .hero-title { font-size: 36px; letter-spacing: 4px; }
  .hero-subtitle { font-size: 16px; }
  .concept-grid { grid-template-columns: 1fr; max-width: 360px; margin: 0 auto; }
  .memory-grid { grid-template-columns: 1fr; }
  .timeline::before { left: 20px; }
  .timeline-item:nth-child(odd),
  .timeline-item:nth-child(even) {
    padding-left: 52px;
    padding-right: 0;
    justify-content: flex-start;
  }
  .timeline-dot { left: 20px; }
  .chat-area { padding: 16px 12px; }
  .chat-content {
    flex-basis: calc(100% - 48px);
    max-width: calc(100% - 48px);
  }
  .input-area { padding: 12px; }
  .input-row { gap: 8px; }
  .input-field { padding: 10px 14px; }
  @supports (padding: env(safe-area-inset-bottom)) {
    .nav-bar {
      padding-left: max(12px, env(safe-area-inset-left));
      padding-right: max(12px, env(safe-area-inset-right));
    }
    .input-area {
      padding-right: max(12px, env(safe-area-inset-right));
      padding-bottom: calc(12px + env(safe-area-inset-bottom));
      padding-left: max(12px, env(safe-area-inset-left));
    }
  }
  .garden-header h2, .timeline-header h2 { font-size: 26px; }
  /* Home Footer 移动端：缩小内边距，允许长文案换行 */
  .home-footer { padding: 20px 16px 36px; }
  .home-footer-text { font-size: 13px; }
  .home-footer-link {
    padding: 7px 14px;
    font-size: 13px;
    max-width: calc(100vw - 48px);
  }
  .home-footer-label {
    /* 必要时允许在中文之间断行，避免链接溢出 */
    word-break: break-word;
  }
  .home-footer-copy { font-size: 11px; }
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(201,169,110,0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(201,169,110,0.5); }

/* ========== Expanded Story Modal ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.3s;
}
.modal-overlay.active {
  display: flex;
  opacity: 1;
}
.modal-content {
  background: white;
  border-radius: var(--radius);
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 32px;
  position: relative;
  transform: scale(0.9);
  transition: transform 0.3s;
}
.modal-overlay.active .modal-content {
  transform: scale(1);
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #F0F0F0;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-content h2 {
  font-size: 22px;
  margin-bottom: 8px;
}
.modal-content .modal-tag {
  display: inline-block;
  padding: 3px 10px;
  background: rgba(201,169,110,0.1);
  color: var(--color-gold);
  border-radius: 12px;
  font-size: 12px;
  margin-bottom: 16px;
}
.modal-content .modal-story {
  font-size: 15px;
  line-height: 2;
  color: #444;
  white-space: pre-line;
}
/* 人生树：一册仍可续写的暖纸手稿 */
.life-tree-page {
  min-height: 100dvh;
  color: var(--color-ink);
  background:
    radial-gradient(circle at 18% 12%, rgba(201, 169, 110, 0.12), transparent 30rem),
    repeating-linear-gradient(0deg, rgba(127, 90, 69, 0.025) 0 1px, transparent 1px 6px),
    var(--color-paper);
}

.life-tree-sticky {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(245, 240, 232, 0.97);
  box-shadow: 0 1px rgba(127, 90, 69, 0.16);
}

.life-tree-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: calc(18px + env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) 16px max(18px, env(safe-area-inset-left));
  background: rgba(245, 240, 232, 0.97);
  border-bottom: 1px solid rgba(127, 90, 69, 0.16);
}

.life-tree-back {
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(127, 90, 69, 0.28);
  border-radius: 999px;
  background: transparent;
  color: #72513f;
  font: inherit;
  cursor: pointer;
}

.life-tree-heading {
  min-width: 0;
  padding-top: 2px;
}

.life-tree-heading h2 {
  font-size: clamp(23px, 7vw, 34px);
  line-height: 1.25;
  letter-spacing: 0.08em;
}

.life-tree-heading p {
  min-height: 1.6em;
  margin-top: 4px;
  color: #6d725f;
  font-size: 13px;
}

.life-tree-tabs {
  display: flex;
  gap: 8px;
  max-width: 760px;
  margin: 0 auto;
  padding: 12px 18px;
  overflow-x: auto;
  background: linear-gradient(180deg, rgba(245, 240, 232, 0.99), rgba(245, 240, 232, 0.92));
  scrollbar-width: thin;
}

.life-tree-tab {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 8px 18px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #6a6458;
  font: 600 14px var(--font-serif);
  cursor: pointer;
}

.life-tree-tab[aria-selected="true"] {
  border-bottom-color: #9c7e3f;
  color: #684635;
}

.life-tree-content {
  box-sizing: border-box;
  width: min(100%, 760px);
  min-height: 50dvh;
  margin: 0 auto;
  padding: 12px max(18px, env(safe-area-inset-right)) calc(48px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}

.life-tree-status {
  margin: 32px auto;
  color: #6d725f;
  text-align: center;
}

.life-tree-empty {
  margin: 28px auto;
  padding: 36px 24px;
  max-width: 420px;
  text-align: center;
  background: #fffdf7;
  border: 1px dashed #c9b18d;
  border-radius: 14px;
}

.life-tree-empty-title {
  margin: 0 0 8px;
  color: #694b39;
  font: 600 16px var(--font-serif);
}

.life-tree-empty-hint {
  margin: 0 0 18px;
  color: #6d725f;
  font-size: 13px;
  line-height: 1.7;
}

.life-tree-empty .life-tree-action {
  margin: 0 auto;
}

.life-tree-actions,
.life-tree-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.life-tree-actions {
  margin-bottom: 28px;
}

.life-tree-action,
.life-tree-entry,
.avatar-picker-action {
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid #8d6c50;
  border-radius: 999px;
  background: #fffdf7;
  color: #694b39;
  font: 600 14px var(--font-serif);
  cursor: pointer;
  transition: transform 160ms ease, background-color 160ms ease;
}

.life-tree-action:hover,
.life-tree-entry:hover,
.avatar-picker-action:hover {
  background: #f3e5c9;
  transform: translateY(-1px);
}

.life-tree-entry {
  display: block;
  margin: 14px auto 0;
  border-color: #647563;
  color: #536b5c;
}

.life-tree-section,
.life-tree-parallel,
.life-tree-legacy {
  position: relative;
  margin: 0 0 34px;
  padding-left: 28px;
}

.life-tree-section::before {
  content: "";
  position: absolute;
  top: 38px;
  bottom: -26px;
  left: 8px;
  width: 2px;
  background: linear-gradient(#a6844f, rgba(83, 107, 92, 0.35));
}

.life-tree-section-title {
  position: relative;
  margin-bottom: 14px;
  color: #536b5c;
  font-size: 18px;
  letter-spacing: 0.08em;
}

.life-tree-section-title::before {
  content: "";
  position: absolute;
  top: 0.7em;
  left: -24px;
  width: 9px;
  height: 9px;
  border: 3px solid var(--color-paper);
  border-radius: 50%;
  background: #9c7e3f;
  box-shadow: 0 0 0 1px rgba(127, 90, 69, 0.25);
}

.life-tree-branch {
  display: grid;
  gap: 14px;
}

.life-tree-story,
.life-tree-review-card,
.life-tree-draft,
.life-tree-account {
  position: relative;
  padding: 18px;
  border: 1px solid rgba(127, 90, 69, 0.17);
  border-radius: 3px 14px 14px 14px;
  background: rgba(255, 253, 247, 0.9);
  box-shadow: 0 8px 24px rgba(62, 49, 35, 0.055);
}

.life-tree-story::before {
  content: "";
  position: absolute;
  top: 24px;
  left: -21px;
  width: 20px;
  border-top: 1px solid rgba(83, 107, 92, 0.46);
}

.life-tree-story-media {
  position: relative;
  height: 132px;
  margin: -8px -8px 14px;
  overflow: hidden;
  border-radius: 2px 10px 5px;
  background: #eee7d9;
}

.life-tree-time,
.life-tree-account-time {
  color: #8c765b;
  font-size: 12px;
  letter-spacing: 0.05em;
}

.life-tree-story-title {
  margin: 5px 0 10px;
  font-size: 18px;
  line-height: 1.5;
}

.life-tree-story-link,
.life-tree-invite-link {
  color: #8c4f3b;
  overflow-wrap: anywhere;
}

.life-tree-parallel,
.life-tree-legacy {
  padding-top: 10px;
  border-top: 1px dashed rgba(127, 90, 69, 0.28);
}

.life-tree-account,
.life-tree-review-card,
.life-tree-draft {
  margin-bottom: 12px;
}

.life-tree-account-name {
  color: #536b5c;
  font: 600 14px var(--font-serif);
}

.life-tree-account-text,
.life-tree-draft-summary {
  margin-top: 8px;
  line-height: 1.9;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.life-tree-review-card .life-tree-item-actions,
.life-tree-draft .life-tree-action {
  margin-top: 14px;
}

.life-tree-item-status,
.life-tree-invite-status {
  color: #6d725f;
  font-size: 13px;
}

.life-tree-invite-link {
  display: block;
  flex-basis: 100%;
  padding: 10px 12px;
  background: rgba(168, 185, 161, 0.16);
  font-size: 12px;
}

.life-tree-invite-qr {
  display: block;
  width: min(220px, 70vw);
  height: auto;
  margin: 4px auto;
}

.life-tree-invite-hint {
  margin: 0;
  color: #6d725f;
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
}

.life-tree-onboarding {
  width: min(100%, 420px);
  margin: clamp(30px, 10vh, 96px) auto;
  padding: 26px 22px;
  border-top: 2px solid #9c7e3f;
  background: rgba(255, 253, 247, 0.76);
  box-shadow: 0 14px 40px rgba(62, 49, 35, 0.07);
}

.life-tree-field-label {
  display: grid;
  gap: 10px;
  color: #536b5c;
  font: 600 15px var(--font-serif);
}

.life-tree-field {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid rgba(127, 90, 69, 0.35);
  border-radius: 4px;
  background: #fffdf7;
  color: var(--color-ink);
  font: 16px var(--font-sans);
}

.life-tree-onboarding .life-tree-action {
  width: 100%;
  margin-top: 18px;
}

.life-tree-contribution {
  display: grid;
  gap: 14px;
  margin: 0 0 28px;
  padding: 18px;
  border: 1px solid rgba(127, 90, 69, 0.17);
  border-radius: 3px 14px 14px 14px;
  background: rgba(255, 253, 247, 0.9);
}

.life-tree-memory-field {
  resize: vertical;
}

.avatar-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: grid;
  place-items: end center;
  padding: 20px 14px calc(14px + env(safe-area-inset-bottom));
  background: rgba(37, 30, 23, 0.58);
}

.avatar-picker {
  width: min(100%, 420px);
  max-height: calc(100dvh - 28px);
  overflow-y: auto;
  padding: 24px;
  border-radius: 18px 18px 8px 8px;
  background: var(--color-paper);
  box-shadow: 0 24px 70px rgba(37, 30, 23, 0.34);
}

.avatar-picker h2 {
  margin-bottom: 18px;
  font-size: 21px;
}

.avatar-preset-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.avatar-preset {
  aspect-ratio: 1;
  padding: 3px;
  border: 2px solid transparent;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.avatar-preset:hover {
  border-color: #9c7e3f;
}

.avatar-preset img,
.chat-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-picker-action {
  width: 100%;
  margin-top: 8px;
}

.avatar-picker-close {
  border-color: transparent;
  background: transparent;
}

.avatar-picker-status {
  min-height: 1.7em;
  margin-top: 10px;
  color: #8c4f3b;
  text-align: center;
}

.story-image-host {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.story-image-host img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.interview-tools {
  z-index: 3;
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  padding: 8px 12px 0;
  background: var(--color-paper);
}

@media (min-width: 720px) {
  .life-tree-header {
    grid-template-columns: 92px minmax(0, 668px);
    justify-content: center;
    padding-inline: 24px;
  }

  .avatar-picker-overlay {
    place-items: center;
  }

  .avatar-picker {
    border-radius: 18px;
  }
}

@media (max-width: 640px) {
  .life-tree-header {
    gap: 10px;
  }

  .life-tree-content {
    padding-inline: 14px;
  }

  .life-tree-section,
  .life-tree-parallel,
  .life-tree-legacy {
    padding-left: 24px;
  }
}

@media (max-width: 640px) and (max-height: 480px) {
  .life-tree-contribution {
    gap: 8px;
    padding: 12px;
  }

  .life-tree-contribution .life-tree-field-label {
    gap: 6px;
  }

  .life-tree-memory-field {
    min-height: 72px;
    height: 72px;
  }

  /* 短屏（横屏/小窗）压缩 sticky 头部，确保 tabs 不溢出可视区 */
  .life-tree-header {
    padding-top: calc(10px + env(safe-area-inset-top));
    padding-bottom: 10px;
  }

  .life-tree-heading p {
    min-height: 1.2em;
    margin-top: 2px;
  }

  .life-tree-tabs {
    padding-top: 6px;
    padding-bottom: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
