/* ==========================================================================
   树洞 - 样式表 v2
   主题：温馨、简洁、自然。柔和米白 + 木色 + 苔藓绿点缀。
   布局：左侧栏（会话列表） + 右侧栏（聊天区）
   ========================================================================== */

/* ---- Design tokens ---------------------------------------------------- */
:root {
  --color-bg:          #faf6f0;   /* 米白底 */
  --color-bg-soft:     #f3ece1;   /* 卡片柔色 */
  --color-surface:     #ffffff;   /* 卡片纯白 */
  --color-text:        #3a322b;   /* 深木色文字 */
  --color-text-soft:   #8a7e6e;   /* 次要文字 */
  --color-primary:     #6b8e4e;   /* 苔藓绿 */
  --color-primary-dark:#557a3c;
  --color-accent:      #c8956d;   /* 暖木色 */
  --color-border:      #e8dfd0;
  --color-danger:      #b5654a;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --shadow-soft: 0 2px 8px rgba(107, 78, 46, 0.06);
  --shadow-card: 0 4px 16px rgba(107, 78, 46, 0.08);
  --shadow-bubble: 0 1px 2px rgba(107, 78, 46, 0.06);

  --sidebar-w: 260px;

  --font-sans:
    -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

/* ---- Reset ------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

body {
  background-color: var(--color-bg);
  background-image:
    radial-gradient(circle at 15% 10%, rgba(200, 149, 109, 0.08), transparent 40%),
    radial-gradient(circle at 85% 90%, rgba(107, 142, 78, 0.08), transparent 40%);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---- App shell: 两栏 flex -------------------------------------------- */
.app {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* ==========================================================================
   左侧栏 Sidebar
   ========================================================================== */
.sidebar {
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.28s ease;
  z-index: 20;
}

.sidebar-header {
  padding: 20px 18px 12px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.sidebar-title {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--color-primary-dark);
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-logo {
  max-width: 120px;
  display: block;
  margin: 0 auto 8px;
}

.sidebar-subtitle {
  margin: 0;
  font-size: 12px;
  color: var(--color-text-soft);
  letter-spacing: 0.5px;
}

/* ---- 新建对话按钮 ---------------------------------------------------- */
.new-chat-btn {
  margin: 14px 14px 8px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: var(--color-primary);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(107, 142, 78, 0.3);
  transition: background 0.18s ease, transform 0.06s ease, box-shadow 0.18s ease;
  flex-shrink: 0;
}

.new-chat-btn:hover {
  background: var(--color-primary-dark);
  box-shadow: 0 3px 10px rgba(107, 142, 78, 0.4);
}

.new-chat-btn:active {
  transform: translateY(1px);
}

.new-chat-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.plus-icon {
  font-size: 16px;
  line-height: 1;
  font-weight: 400;
}

/* ---- 会话列表 -------------------------------------------------------- */
.session-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  /* 隐藏滚动条但保留功能 */
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.session-list::-webkit-scrollbar {
  width: 6px;
}

.session-list::-webkit-scrollbar-track {
  background: transparent;
}

.session-list::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 3px;
}

.session-list-empty {
  margin: 24px 12px;
  padding: 16px 12px;
  text-align: center;
  font-size: 13px;
  color: var(--color-text-soft);
  line-height: 1.6;
  background: var(--color-bg-soft);
  border-radius: var(--radius-md);
}

.session-item {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 6px;
  align-items: center;
  padding: 10px 10px 10px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  color: var(--color-text);
  transition: background 0.15s ease, border-color 0.15s ease;
  position: relative;
}

.session-item:hover {
  background: var(--color-bg-soft);
}

.session-item.is-active {
  background: rgba(107, 142, 78, 0.10);
  border-color: rgba(107, 142, 78, 0.25);
}

.session-item-title {
  grid-column: 1;
  grid-row: 1;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-text);
}

.session-item-time {
  grid-column: 1;
  grid-row: 2;
  font-size: 11px;
  color: var(--color-text-soft);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.session-item-del {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  color: var(--color-text-soft);
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
  user-select: none;
}

.session-item:hover .session-item-del,
.session-item:focus-within .session-item-del {
  opacity: 1;
}

.session-item-del:hover {
  background: var(--color-danger);
  color: #fff;
}

/* ---- 侧栏底部 -------------------------------------------------------- */
.sidebar-footer {
  padding: 12px 18px 16px;
  border-top: 1px solid var(--color-border);
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer small {
  font-size: 11px;
  color: var(--color-text-soft);
  letter-spacing: 0.5px;
  font-style: italic;
}

/* ==========================================================================
   右侧聊天区 Chat pane
   ========================================================================== */
.chat-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;     /* 防止 flex 子项内容溢出 */
  height: 100vh;
  background: var(--color-bg);
  position: relative;
}

/* ---- 聊天顶部 -------------------------------------------------------- */
.chat-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 1px 0 rgba(107, 78, 46, 0.02);
  z-index: 5;
}

.icon-btn {
  display: none;          /* 默认隐藏；移动端显示 */
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 18px;
  color: var(--color-text);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover {
  background: var(--color-bg-soft);
  border-color: var(--color-primary);
}

.icon-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}

.chat-header-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* ---- 聊天流 --------------------------------------------------------- */
.chat-stream {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.chat-stream::-webkit-scrollbar {
  width: 8px;
}

.chat-stream::-webkit-scrollbar-track {
  background: transparent;
}

.chat-stream::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
}

/* ---- 欢迎页 --------------------------------------------------------- */
.welcome {
  margin: auto;
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-soft);
  max-width: 480px;
}

.welcome-logo {
  max-width: 380px;
  width: 100%;
  height: auto;
  display: block;
  margin: 0 auto 16px;
}

.welcome-emoji {
  font-size: 56px;
  margin-bottom: 12px;
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(107, 78, 46, 0.15));
  animation: floaty 4s ease-in-out infinite;
}

.welcome h2 {
  margin: 0 0 10px;
  font-size: 22px;
  color: var(--color-primary-dark);
  font-weight: 700;
  letter-spacing: 1px;
}

.welcome p {
  margin: 6px 0;
  font-size: 14px;
  line-height: 1.7;
}

.welcome-hint {
  margin-top: 14px !important;
  color: var(--color-text-soft);
  font-size: 13px !important;
  font-style: italic;
}

/* ==========================================================================
   聊天气泡 Bubble
   ========================================================================== */
.bubble-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  animation: bubbleIn 0.25s ease-out;
  max-width: 100%;
}

.bubble-row-user {
  justify-content: flex-end;
}

.bubble-row-ai {
  justify-content: flex-start;
}

.bubble-avatar {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  user-select: none;
}

.bubble-col {
  display: flex;
  flex-direction: column;
  max-width: min(72%, 520px);
  min-width: 0;
}

.bubble-row-user .bubble-col {
  align-items: flex-end;
}

.bubble-row-ai .bubble-col {
  align-items: flex-start;
}

.bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 16px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: var(--shadow-bubble);
  position: relative;
  border: 1px solid transparent;
}

/* 用户气泡：右对齐，主色绿 */
.bubble-user {
  background: var(--color-primary);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  border-color: var(--color-primary-dark);
}

.bubble-user::after {
  content: "";
  position: absolute;
  right: -6px;
  bottom: 0;
  width: 12px;
  height: 12px;
  background: var(--color-primary);
  border-bottom-right-radius: 0;
  clip-path: polygon(0 0, 100% 100%, 0 100%);
}

/* AI 气泡：左对齐，白底 */
.bubble-ai {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
  border-bottom-left-radius: 4px;
}

.bubble-ai::after {
  content: "";
  position: absolute;
  left: -6px;
  bottom: 0;
  width: 12px;
  height: 12px;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

.bubble-meta {
  margin-top: 4px;
  font-size: 11px;
  color: var(--color-text-soft);
  font-variant-numeric: tabular-nums;
  padding: 0 4px;
}

/* ---- 打字中动画 ------------------------------------------------------ */
.bubble-thinking .bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 14px 16px;
  min-width: 56px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-text-soft);
  display: inline-block;
  animation: typingBounce 1.2s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}

/* ==========================================================================
   底部输入框 Composer
   ========================================================================== */
.composer {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 16px 14px;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -1px 0 rgba(107, 78, 46, 0.02);
}

.composer-input {
  flex: 1;
  min-height: 40px;
  max-height: 160px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg-soft);
  border: 1px solid transparent;
  border-radius: 20px;
  resize: none;
  outline: none;
  transition: border-color 0.18s ease, background 0.18s ease;
  scrollbar-width: thin;
}

.composer-input::placeholder {
  color: var(--color-text-soft);
  opacity: 0.7;
}

.composer-input:focus {
  background: var(--color-surface);
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(107, 142, 78, 0.10);
}

.send-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(107, 142, 78, 0.3);
  transition: background 0.18s ease, transform 0.06s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.send-btn:hover:not(:disabled) {
  background: var(--color-primary-dark);
  box-shadow: 0 3px 10px rgba(107, 142, 78, 0.4);
}

.send-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.send-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.send-icon {
  font-size: 16px;
  line-height: 1;
  display: inline-block;
  transform: translateX(1px);
}

.send-btn.is-loading .send-icon {
  animation: spin 0.9s linear infinite;
}

.composer-error {
  flex-shrink: 0;
  margin: 0;
  padding: 0 20px 6px;
  min-height: 0;
  font-size: 12px;
  color: var(--color-danger);
  background: var(--color-surface);
  transition: min-height 0.2s ease, padding 0.2s ease;
}

.composer-error:not(:empty) {
  min-height: 1.4em;
  padding: 0 20px 8px;
}

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes bubbleIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ==========================================================================
   响应式：≤768px 移动端
   ========================================================================== */
@media (max-width: 768px) {
  /* 基础字号略调，移动端阅读舒适 */
  body {
    font-size: 15px;
  }

  /* 侧栏改成抽屉式：默认隐藏，.is-open 滑入 */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    width: 85vw;
    max-width: 320px;
    box-shadow: 4px 0 24px rgba(107, 78, 46, 0.15);
    transform: translateX(-100%);
    z-index: 30;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  /* 侧栏内 logo 在移动端适当缩小 */
  .sidebar-logo {
    max-width: 100px;
  }

  .sidebar-header {
    padding: 16px 14px 10px;
  }

  .icon-btn {
    display: flex;
  }

  .chat-pane {
    width: 100%;
    height: 100vh;
    height: 100dvh;
  }

  .chat-header {
    padding: 10px 14px;
    gap: 10px;
  }

  .chat-stream {
    padding: 14px 14px 10px;
    gap: 12px;
  }

  /* composer 在移动端用 safe-area 适配 iPhone 底部 */
  .composer {
    padding: 8px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    gap: 8px;
  }

  /* composer-error 紧贴 composer，padding 收紧 */
  .composer-error {
    padding: 0 14px calc(6px + env(safe-area-inset-bottom, 0px));
  }

  .composer-input {
    font-size: 17px;
    min-height: 40px;
    padding: 9px 14px;
    max-height: 120px;
  }

  /* 发送按钮在移动端保持 40x40，可点击区域足够大 */
  .send-btn {
    width: 40px;
    height: 40px;
  }

  .bubble {
    font-size: 17px;
    line-height: 1.6;
  }

  .bubble-col {
    max-width: 82%;
  }

  /* 欢迎页 logo 缩小，留出空间 */
  .welcome-logo {
    max-width: 300px;
    margin-bottom: 12px;
  }

  .welcome {
    padding: 20px 18px;
  }

  .welcome-emoji {
    font-size: 44px;
  }

  .welcome h2 {
    font-size: 20px;
  }

  .welcome p {
    font-size: 14px;
  }

  .welcome-hint {
    font-size: 12.5px !important;
  }

  /* 打开侧栏时，主区背景加遮罩 */
  body.sidebar-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(58, 50, 43, 0.35);
    z-index: 25;
    animation: fadeIn 0.2s ease;
  }
}

@media (max-width: 480px) {
  .chat-header {
    padding: 9px 12px;
  }

  .chat-header-title {
    font-size: 15px;
  }

  .composer {
    padding: 7px 10px calc(9px + env(safe-area-inset-bottom, 0px));
  }

  .composer-input {
    font-size: 17px;
    padding: 8px 12px;
    border-radius: 18px;
  }

  .send-btn {
    width: 40px;
    height: 40px;
  }

  .bubble-avatar {
    width: 30px;
    height: 30px;
    font-size: 16px;
  }

  .bubble {
    padding: 9px 12px;
    font-size: 16.5px;
  }

  .bubble-col {
    max-width: 84%;
  }

  /* 小屏 welcome 再缩小一点 */
  .welcome-logo {
    max-width: 220px;
  }
}

/* iOS 输入框字号自适应防止页面缩放 */
@supports (-webkit-touch-callout: none) {
  .composer-input,
  .composer-input:focus {
    font-size: 16px;
  }
}

/* ==========================================================================
   重试提示（移动端断网自动重试用）
   ========================================================================== */

/* 思考气泡上方的"连接中断，正在重试…"提示 */
.retry-hint {
  font-size: 12px;
  color: var(--color-text-soft);
  text-align: center;
  padding: 4px 16px 2px;
  letter-spacing: 0.5px;
  animation: bubbleIn 0.25s ease;
}

/* "🔄 重新发送"按钮——显示在 composer-error 旁边 */
.retry-btn {
  display: inline-block;
  margin: 4px 0 0;
  padding: 5px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-text);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.retry-btn:hover {
  background: var(--color-bg-soft);
  border-color: var(--color-primary);
  color: var(--color-primary-dark);
}

.retry-btn:active {
  background: var(--color-bg);
  transform: translateY(1px);
}

.retry-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* 暗色主题兼容 */
@media (prefers-color-scheme: dark) {
  .retry-btn {
    background: var(--color-bg-soft);
  }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .welcome-emoji {
    animation: none;
  }
}

/* ---- 可点击选项按钮 ---- */
.options-card {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.option-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f0f7e8;
  color: #6b8e4e;
  border: 1px solid #c8dbb0;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 16px;
  line-height: 1.6;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s, color 0.2s, transform 0.15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.option-btn:hover {
  background: #6b8e4e;
  color: #fff;
  border-color: #6b8e4e;
}
.option-btn:active {
  transform: scale(0.97);
}
/* 移动端触摸目标 */
@media (max-width: 768px) {
  .option-btn {
    min-height: 44px;
    font-size: 17px;
    padding: 12px 16px;
    width: 100%;
  }
}
/* 无障碍：减少动画 */
@media (prefers-reduced-motion: reduce) {
  .option-btn {
    transition: none;
  }
}
.options-sep {
  width: 100%;
  height: 1px;
  background: var(--sep-color, #d4d4c8);
  margin: 4px 0;
}


/* =============================================================
   痛苦命名卡片 (Pain Naming Card) — v2.7
   叙事疗法·外化问题 — "痛苦不是我，它只是暂时寄居在我身上的结构"
   配色：温馨米色 / 淡奶油色，简洁明了
   ============================================================= */

.pain-card-wrapper {
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.pain-card {
  width: 100%;
  max-width: 480px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 2px 16px rgba(140, 100, 70, 0.12), 0 1px 4px rgba(140, 100, 70, 0.06);
  background: linear-gradient(135deg, #fdf6f0 0%, #f5ede4 100%);
  position: relative;
  border: 1px solid rgba(224, 201, 176, 0.5);
}

/* 装饰光晕：暖橙（右上） */
.pain-card::before {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(212, 165, 116, 0.18) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

/* 装饰光晕：浅粉米（左下） */
.pain-card::after {
  content: '';
  position: absolute;
  bottom: -40px;
  left: -40px;
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, rgba(232, 184, 138, 0.14) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.pain-card-header {
  padding: 28px 28px 18px;
  text-align: center;
  position: relative;
  z-index: 1;
}

.pain-card-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.3em;
  color: rgba(160, 123, 101, 0.8);
  margin-bottom: 14px;
  text-transform: uppercase;
}

.pain-card-name {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.3;
  color: #6b4e3d;
  letter-spacing: 0.06em;
  font-family: "Noto Serif SC", "PingFang SC", -apple-system, serif;
}

.pain-card-divider {
  width: 36px;
  height: 2px;
  background: #e0c9b0;
  border-radius: 2px;
  margin: 6px auto 18px;
  position: relative;
  z-index: 1;
}

.pain-card-body {
  padding: 0 28px 20px;
  position: relative;
  z-index: 1;
}

.pain-card-desc {
  font-size: 14px;
  line-height: 1.85;
  color: rgba(107, 78, 61, 0.82);
  text-align: center;
  margin-bottom: 16px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 400px;
  overflow-y: auto;
}

.pain-card-motto {
  font-size: 13px;
  line-height: 1.7;
  color: rgba(160, 123, 101, 0.85);
  text-align: center;
  font-style: italic;
  letter-spacing: 0.04em;
  font-family: "Noto Serif SC", "PingFang SC", -apple-system, serif;
}

.pain-card-footer {
  padding: 16px 28px 20px;
  border-top: 1px dashed rgba(180, 130, 80, 0.18);
  text-align: center;
  position: relative;
  z-index: 1;
}

.pain-card-foot-note {
  font-size: 11px;
  line-height: 1.7;
  color: rgba(160, 123, 101, 0.65);
  margin-bottom: 8px;
  letter-spacing: 0.04em;
}

.pain-card-date {
  font-size: 11px;
  color: rgba(160, 123, 101, 0.55);
  letter-spacing: 0.05em;
}

/* 保存按钮 */
.pain-card-actions {
  display: flex;
  gap: 8px;
}

.pain-save-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 22px;
  border: 1px solid rgba(160, 123, 101, 0.4);
  border-radius: 12px;
  background: rgba(160, 123, 101, 0.08);
  color: #a07b65;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  backdrop-filter: blur(4px);
}

.pain-save-btn:hover {
  background: rgba(160, 123, 101, 0.18);
  border-color: rgba(160, 123, 101, 0.6);
  color: #6b4e3d;
  transform: translateY(-1px);
}

.pain-save-btn:active {
  transform: translateY(0);
}

/* 移动端适配 */
@media (max-width: 768px) {
  .pain-card {
    max-width: 100%;
    border-radius: 16px;
  }
  .pain-card-name {
    font-size: 24px;
  }
  .pain-card-header { padding: 22px 20px 14px; }
  .pain-card-body { padding: 0 20px 16px; }
  .pain-card-footer { padding: 14px 20px 16px; }
}

@media (max-width: 480px) {
  .pain-card-name {
    font-size: 20px;
  }
  .pain-card-desc {
    font-size: 13px;
  }
  .pain-card-motto {
    font-size: 12px;
  }
}

/* =============================================================
   v3.0「停止下坠」反刍中断按钮
   ——琥珀色发光按钮（Animated Glow Button）
   ============================================================= */

.stop-falling-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  margin: 0;
  /* 不覆盖 width —— 让它和保存按钮并排 */
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #ffffff;
  background: linear-gradient(135deg, #e8927c 0%, #d4a574 100%);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  /* 柔和暖色光晕脉动（21st.dev Animated Glow Button 风格） */
  box-shadow:
    0 0 0 0 rgba(212, 165, 116, 0.45),
    0 4px 14px rgba(232, 146, 124, 0.28);
  animation: stopFallingGlow 2.6s ease-in-out infinite;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

/* 内部光泽高光（轻微扫光） */
.stop-falling-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.22),
    transparent
  );
  animation: stopFallingShimmer 3.4s ease-in-out infinite;
  pointer-events: none;
}

.stop-falling-btn:hover {
  transform: translateY(-1px);
  box-shadow:
    0 0 0 4px rgba(212, 165, 116, 0.18),
    0 6px 20px rgba(232, 146, 124, 0.40);
}

.stop-falling-btn:active {
  transform: translateY(0);
}

.stop-falling-btn:focus-visible {
  outline: 2px solid #d4a574;
  outline-offset: 3px;
}

.stop-falling-icon {
  font-size: 15px;
  line-height: 1;
  display: inline-block;
  /* 微微呼吸 */
  animation: stopFallingIconBreathe 2.6s ease-in-out infinite;
}

.stop-falling-label {
  white-space: nowrap;
}

@keyframes stopFallingGlow {
  0%, 100% {
    box-shadow:
      0 0 0 0 rgba(212, 165, 116, 0.45),
      0 4px 14px rgba(232, 146, 124, 0.28);
  }
  50% {
    box-shadow:
      0 0 0 8px rgba(212, 165, 116, 0.0),
      0 6px 22px rgba(232, 146, 124, 0.42);
  }
}

@keyframes stopFallingShimmer {
  0%   { left: -100%; }
  60%  { left: 120%; }
  100% { left: 120%; }
}

@keyframes stopFallingIconBreathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.08); }
}

/* =============================================================
   v3.0 60 秒全屏毛玻璃中断空间（Frosted Glass Card）
   ——暖米色底 + backdrop-filter blur(20px)
   ============================================================= */

.frosted-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  /* 暖色毛玻璃背景：米色 + 高斯模糊 */
  background: rgba(245, 235, 220, 0.55);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  overflow-y: auto;
}

.frosted-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

.frosted-overlay.is-leaving {
  opacity: 0;
  visibility: visible;
}

/* 主卡片 */
.frosted-card {
  position: relative;
  width: 100%;
  max-width: 460px;
  padding: 40px 32px 28px;
  border-radius: 28px;
  background: rgba(253, 246, 240, 0.72);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow:
    0 20px 60px rgba(107, 78, 46, 0.22),
    0 4px 12px rgba(107, 78, 46, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  text-align: center;
  transform: translateY(12px) scale(0.97);
  opacity: 0;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.55s ease;
  overflow: hidden;
}

.frosted-overlay.is-visible .frosted-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.frosted-overlay.is-leaving .frosted-card {
  transform: translateY(8px) scale(0.98);
  opacity: 0;
  transition-duration: 0.32s;
}

/* 卡片内装饰光晕（暖橙 / 浅粉米） */
.frosted-card-glow {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(28px);
  opacity: 0.55;
}
.frosted-card-glow-1 {
  top: -60px;
  right: -50px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(212, 165, 116, 0.55), transparent 70%);
  animation: frostedGlowDrift 9s ease-in-out infinite;
}
.frosted-card-glow-2 {
  bottom: -50px;
  left: -40px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(232, 184, 138, 0.45), transparent 70%);
  animation: frostedGlowDrift 11s ease-in-out -3s infinite reverse;
}

/* 提示语 */
.frosted-hint {
  position: relative;
  z-index: 1;
  margin: 0 0 24px;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.7;
  color: rgba(107, 78, 61, 0.85);
  letter-spacing: 0.05em;
  font-family: "Noto Serif SC", "PingFang SC", serif;
}

/* 倒计时区域 */
.countdown-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 8px 0 18px;
}

.countdown-number {
  font-size: 96px;
  font-weight: 700;
  line-height: 1;
  color: #6b4e3d;
  font-variant-numeric: tabular-nums;
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", sans-serif;
  letter-spacing: -0.04em;
  /* 数字整体柔和呼吸 */
  text-shadow:
    0 2px 8px rgba(212, 165, 116, 0.25),
    0 0 32px rgba(232, 146, 124, 0.18);
  display: inline-block;
  transform-origin: center;
  transition: transform 0.18s ease, color 0.3s ease;
}

/* 数字跳变时轻微下沉再回弹 */
.countdown-number.is-tick {
  animation: countdownTick 0.42s ease;
}

.countdown-number.is-complete {
  font-size: 72px;
  color: #d4a574;
  animation: countdownCompletePulse 1.2s ease-out;
}

.countdown-unit {
  margin-top: 4px;
  font-size: 13px;
  letter-spacing: 0.5em;
  color: rgba(160, 123, 101, 0.7);
  padding-left: 0.5em;
}

@keyframes countdownTick {
  0%   { transform: translateY(0)    scale(1);    }
  35%  { transform: translateY(6px)  scale(0.94); }
  100% { transform: translateY(0)    scale(1);    }
}

@keyframes countdownCompletePulse {
  0%   { transform: scale(0.7); opacity: 0; }
  60%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1);    opacity: 1; }
}

/* 接地活动卡片舞台 */
.grounding-stage {
  position: relative;
  z-index: 1;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 6px 0 4px;
}

.grounding-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 8px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  width: 100%;
}

.grounding-stage.is-active .grounding-card {
  opacity: 1;
  transform: translateY(0);
}

.grounding-icon {
  font-size: 44px;
  line-height: 1;
  /* 微微浮入 */
  animation: groundingIconFloat 3s ease-in-out infinite;
}

.grounding-icon-large {
  font-size: 56px;
}

.grounding-title {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.5;
  color: #6b4e3d;
  letter-spacing: 0.04em;
  font-family: "Noto Serif SC", "PingFang SC", serif;
}

.grounding-hint {
  font-size: 13px;
  line-height: 1.7;
  color: rgba(160, 123, 101, 0.85);
  letter-spacing: 0.03em;
}

.grounding-card.is-complete-card .grounding-title {
  font-size: 17px;
  color: #6b4e3d;
}

@keyframes groundingIconFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}

/* 分隔线 */
.frosted-divider {
  position: relative;
  z-index: 1;
  width: 36px;
  height: 2px;
  background: #e0c9b0;
  border-radius: 2px;
  margin: 14px auto 12px;
}

/* 进度条 */
.progress-track {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 4px;
  background: rgba(224, 201, 176, 0.4);
  border-radius: 2px;
  overflow: hidden;
  margin: 0 0 22px;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #e8927c 0%, #d4a574 100%);
  border-radius: 2px;
  /* 不用 transition，每帧更新 width（已经够丝滑） */
  box-shadow: 0 0 6px rgba(232, 146, 124, 0.4);
}

/* 退出按钮（始终可见） */
.exit-overlay-btn {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 26px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #6b4e3d;
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(160, 123, 101, 0.35);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}

.exit-overlay-btn:hover {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(160, 123, 101, 0.6);
  transform: translateY(-1px);
}

.exit-overlay-btn:active {
  transform: translateY(0);
}

.exit-overlay-btn:focus-visible {
  outline: 2px solid #d4a574;
  outline-offset: 2px;
}

.exit-overlay-icon {
  font-size: 15px;
  line-height: 1;
}

/* 光晕漂浮动效 */
@keyframes frostedGlowDrift {
  0%, 100% { transform: translate(0, 0); }
  50%      { transform: translate(-12px, 10px); }
}

/* =============================================================
   停止下坠：响应式适配
   ============================================================= */

@media (max-width: 768px) {
  .frosted-overlay {
    padding: 14px;
  }
  .frosted-card {
    padding: 32px 22px 22px;
    border-radius: 22px;
    max-width: 100%;
  }
  .frosted-hint {
    font-size: 14.5px;
    margin-bottom: 18px;
  }
  .countdown-number {
    font-size: 72px;
  }
  .countdown-number.is-complete {
    font-size: 56px;
  }
  .grounding-stage {
    min-height: 156px;
  }
  .grounding-icon {
    font-size: 38px;
  }
  .grounding-icon-large {
    font-size: 48px;
  }
  .grounding-title {
    font-size: 16px;
  }
  .grounding-hint {
    font-size: 12.5px;
  }
  .exit-overlay-btn {
    padding: 11px 22px;
    font-size: 13.5px;
  }
  /* 移动端：按钮在小屏换行 */
  .pain-card-actions {
    flex-wrap: wrap;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .frosted-card {
    padding: 26px 18px 20px;
    border-radius: 20px;
  }
  .frosted-hint {
    font-size: 13.5px;
  }
  .countdown-number {
    font-size: 60px;
  }
  .countdown-unit {
    font-size: 12px;
  }
  .grounding-title {
    font-size: 15px;
  }
  .grounding-hint {
    font-size: 12px;
  }
  .stop-falling-btn {
    font-size: 13px;
    padding: 9px 18px;
    gap: 6px;
  }
}

/* 暗色模式（柔化而非深色，仍保持暖色） */
@media (prefers-color-scheme: dark) {
  .frosted-overlay {
    background: rgba(58, 50, 43, 0.55);
  }
  .frosted-card {
    background: rgba(80, 65, 50, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.08);
  }
  .frosted-hint {
    color: rgba(253, 246, 240, 0.88);
  }
  .countdown-number {
    color: #f5ede4;
  }
  .grounding-title {
    color: #f5ede4;
  }
  .grounding-hint {
    color: rgba(245, 237, 228, 0.7);
  }
  .exit-overlay-btn {
    background: rgba(80, 65, 50, 0.6);
    color: #f5ede4;
    border-color: rgba(245, 237, 228, 0.3);
  }
}

/* =============================================================
   减少动画（无障碍）
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  .stop-falling-btn,
  .stop-falling-btn::before,
  .stop-falling-icon,
  .frosted-card-glow-1,
  .frosted-card-glow-2,
  .grounding-icon,
  .countdown-number.is-tick {
    animation: none !important;
  }
}

