/* ═══════════════════════════════════════
   愈见自己 OH卡AI助手 — 样式表
   ═══════════════════════════════════════ */

/* ====== 基础重置与全局 ====== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-deep: #0b0b12;
  --bg-dark: #121219;
  --bg-card: #171724;
  --gold: #d7bf95;
  --gold-light: #ead8b9;
  --gold-dim: #b9a17b;
  --text-primary: #f3f0ea;
  --text-secondary: #d8d3df;
  --text-muted: #a29bb0;
  --glass: rgba(255, 255, 255, 0.055);
  --glass-border: rgba(255, 255, 255, 0.12);
  --chat-ai-bg: rgba(255, 255, 255, 0.07);
  --chat-user-bg: rgba(90, 108, 150, 0.22);
  --shadow-glow: rgba(215, 191, 149, 0.10);
  --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ====== 星空粒子背景 ====== */
.stars-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.star {
  position: absolute;
  width: 1.5px;
  height: 1.5px;
  background: rgba(232, 213, 183, 0.36);
  border-radius: 50%;
  animation: twinkle var(--duration, 3s) infinite alternate ease-in-out;
  animation-delay: var(--delay, 0s);
}

@keyframes twinkle {
  0% { opacity: 0.05; transform: scale(0.8); }
  100% { opacity: 0.28; transform: scale(1.05); }
}

/* ====== 页面状态容器 ====== */
.page {
  display: none;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
}

.page.active {
  display: flex;
  flex-direction: column;
}

/* ═══════════════════════════════════════
   第一屏：口令验证页
   ═══════════════════════════════════════ */
#page-verify {
  justify-content: flex-start;
  align-items: center;
  text-align: center;
  padding: 60px 30px 40px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.verify-container {
  max-width: 360px;
  width: 100%;
  margin-top: auto;
  margin-bottom: auto;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.verify-logo {
  font-size: 3rem;
  margin-bottom: 20px;
  animation: float 4s ease-in-out infinite;
}

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

.verify-title {
  font-size: 1.6rem;
  color: var(--gold-light);
  letter-spacing: 4px;
  margin-bottom: 8px;
  font-weight: 650;
}

.verify-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  letter-spacing: 2px;
  margin-bottom: 40px;
}

.verify-input-group {
  position: relative;
  margin-bottom: 20px;
}

.verify-input {
  width: 100%;
  padding: 15px 20px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  letter-spacing: 2px;
  text-align: center;
  transition: all 0.3s var(--transition-smooth);
  outline: none;
}

.verify-input::placeholder {
  color: #a9a2b1;
  letter-spacing: 1px;
}

.verify-input:focus {
  border-color: var(--gold-dim);
  box-shadow: 0 0 20px var(--shadow-glow);
}

.verify-btn {
  width: 100%;
  padding: 15px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  color: var(--gold-light);
  font-family: inherit;
  font-size: 1rem;
  letter-spacing: 3px;
  cursor: pointer;
  transition: all 0.3s var(--transition-smooth);
}

.verify-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(212, 184, 150, 0.45);
  box-shadow: 0 4px 20px var(--shadow-glow);
}

.verify-btn:active {
  transform: scale(0.98);
}

.verify-error {
  margin-top: 15px;
  color: #e8a0a0;
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity 0.3s;
}

.verify-error.show {
  opacity: 1;
}

.verify-contact {
  margin-top: 30px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.verify-contact a {
  color: var(--gold-dim);
  text-decoration: none;
}

/* ═══════════════════════════════════════
   第二屏：抽卡页
   ═══════════════════════════════════════ */
#page-draw {
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 30px;
}

.draw-welcome {
  max-width: 400px;
  margin-bottom: 50px;
}

.draw-welcome h2 {
  font-size: 1.4rem;
  color: var(--gold-light);
  letter-spacing: 2px;
  margin-bottom: 20px;
  font-weight: 650;
}

.draw-welcome p {
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.8;
  letter-spacing: 0.3px;
}

.draw-note {
  margin-top: 16px;
  padding: 16px 17px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  text-align: left;
}

.draw-note strong {
  display: block;
  color: var(--gold-light);
  font-size: 0.8rem;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.draw-note span {
  display: block;
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1.75;
}

.draw-safety-note {
  background: rgba(120, 113, 108, 0.08);
}

.draw-btn-container {
  position: relative;
}

.draw-btn {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%,
    rgba(212, 184, 150, 0.12) 0%,
    rgba(212, 184, 150, 0.04) 60%,
    transparent 100%);
  border: 1.5px solid rgba(212, 184, 150, 0.3);
  color: var(--gold-light);
  font-family: inherit;
  font-size: 1.3rem;
  letter-spacing: 6px;
  cursor: pointer;
  transition: all 0.4s var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.draw-btn::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    transparent,
    rgba(212, 184, 150, 0.1),
    transparent,
    rgba(212, 184, 150, 0.05),
    transparent
  );
  animation: rotate-glow 6s linear infinite;
  z-index: -1;
}

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

.draw-btn:hover {
  border-color: rgba(212, 184, 150, 0.6);
  box-shadow: 0 0 40px rgba(212, 184, 150, 0.12), 0 0 80px rgba(212, 184, 150, 0.05);
  transform: scale(1.06);
}

.draw-btn:active {
  transform: scale(0.97);
}

.draw-btn.loading {
  pointer-events: none;
  animation: pulse-draw 1.5s ease-in-out infinite;
}

@keyframes pulse-draw {
  0%, 100% { box-shadow: 0 0 20px rgba(212, 184, 150, 0.1); }
  50% { box-shadow: 0 0 50px rgba(212, 184, 150, 0.2); }
}

.draw-hint {
  margin-top: 30px;
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 1px;
}

/* ═══════════════════════════════════════
   第三屏：主页面（卡牌 + 对话 分屏）
   ═══════════════════════════════════════ */
#page-main {
  height: 100vh;           /* fallback */
  height: 100dvh;          /* 动态视口高度，自动顺应键盘收缩 */
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* — 卡牌展示区（固定顶部） — */
.card-display {
  width: 100%;
  height: 35vh;
  min-height: 190px;
  max-height: 320px;
  background: linear-gradient(180deg, #0b0b13 0%, #121221 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  flex-shrink: 0;
  border-bottom: 1px solid var(--glass-border);
  overflow: hidden;
}

/* 卡牌区的微光效果 */
.card-display::before {
  content: '';
  position: absolute;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(212, 184, 150, 0.045), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.card-image-wrapper {
  position: relative;
  height: 85%;
  max-width: 85%;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: card-appear 1s var(--transition-smooth) forwards;
  opacity: 0;
}

@keyframes card-appear {
  from {
    opacity: 0;
    transform: scale(0.8) rotateY(30deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotateY(0deg);
  }
}

.card-image {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  border-radius: 10px;
  box-shadow:
    0 10px 34px rgba(0, 0, 0, 0.42),
    0 0 42px rgba(212, 184, 150, 0.045);
}

.card-number {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 1px;
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 8px;
  border-radius: 10px;
}

/* 卡牌区折叠/展开控制 */
.card-toggle {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(50%);
  width: 36px;
  height: 20px;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: 0 0 10px 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 5;
  color: var(--text-muted);
  font-size: 0.6rem;
  transition: all 0.3s;
}

.card-toggle:hover {
  color: var(--gold-dim);
  border-color: var(--gold-dim);
}

.card-display.collapsed {
  height: 60px;
  min-height: 60px;
}

.card-display.collapsed .card-image-wrapper {
  height: 50px;
}

.card-display.collapsed .card-image {
  max-height: 50px;
  border-radius: 6px;
}

/* — 对话区域 — */
.chat-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 22px 18px;
  padding-bottom: 20px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* 滚动条美化 */
.chat-area::-webkit-scrollbar {
  width: 3px;
}

.chat-area::-webkit-scrollbar-thumb {
  background: rgba(212, 184, 150, 0.15);
  border-radius: 3px;
}

/* 消息气泡 */
.message {
  margin-bottom: 16px;
  animation: msg-appear 0.5s var(--transition-smooth) forwards;
  opacity: 0;
}

@keyframes msg-appear {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-ai {
  padding: 18px 20px;
  background: var(--chat-ai-bg);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  max-width: 88%;
}

.message-ai .message-label {
  font-size: 0.72rem;
  color: var(--gold-light);
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.message-ai .message-text {
  font-size: 1rem;
  line-height: 1.78;
  color: var(--text-primary);
  letter-spacing: 0.2px;
}

.message-user {
  padding: 14px 18px;
  background: var(--chat-user-bg);
  border-radius: 18px;
  max-width: 80%;
  margin-left: auto;
}

.message-user .message-text {
  font-size: 0.96rem;
  line-height: 1.65;
  color: var(--text-primary);
}

/* AI 打字中动画 */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 16px 18px;
  background: var(--chat-ai-bg);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  max-width: 100px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: var(--gold-dim);
  border-radius: 50%;
  animation: typing-bounce 1.2s infinite;
}

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

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
  30% { transform: translateY(-6px); opacity: 0.8; }
}

/* — 底部输入栏 — */
.input-bar {
  position: relative;
  width: 100%;
  padding: 10px 16px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  background: var(--bg-card);
  border-top: 1px solid var(--glass-border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  z-index: 20;
  flex-shrink: 0;
}

.input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.input-field {
  flex: 1;
  padding: 13px 16px;
  background: rgba(255, 255, 255, 0.075);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 22px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.3s, background 0.3s;
  min-height: 46px;
  resize: none;
  line-height: 1.45;
  max-height: 100px;
  overflow-y: auto;
}

.input-field::placeholder {
  color: var(--text-muted);
}

.input-field:focus {
  border-color: rgba(212, 184, 150, 0.42);
  background: rgba(255, 255, 255, 0.095);
}

.send-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(212, 184, 150, 0.18);
  border: 1px solid rgba(212, 184, 150, 0.32);
  color: var(--gold-light);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
}

.send-btn:hover {
  background: rgba(212, 184, 150, 0.25);
  box-shadow: 0 2px 12px var(--shadow-glow);
}

.send-btn:disabled {
  opacity: 0.3;
  pointer-events: none;
}

.send-btn:active {
  transform: scale(0.92);
}


/* ====== Toast 提示 ====== */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-80px);
  background: rgba(20, 20, 40, 0.9);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  padding: 10px 24px;
  border-radius: 24px;
  color: var(--gold-light);
  font-size: 0.82rem;
  letter-spacing: 1px;
  transition: transform 0.4s var(--transition-smooth);
  z-index: 999;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ====== 全局响应式 ====== */
@media (max-width: 380px) {
  .verify-title { font-size: 1.3rem; letter-spacing: 4px; }
  .draw-btn { width: 150px; height: 150px; font-size: 1.1rem; }
  .card-display { height: 34vh; }
}

@media (min-width: 768px) {
  /* 平板/桌面端：限制最大宽度 */
  #page-main {
    max-width: 480px;
    margin: 0 auto;
    border-left: 1px solid var(--glass-border);
    border-right: 1px solid var(--glass-border);
  }
}

/* ====== 页面切换动画 ====== */
.page.fade-in {
  animation: page-fade-in 0.6s var(--transition-smooth) forwards;
}

@keyframes page-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ═══════════════════════════════════════
   翻牌仪式动画
   ═══════════════════════════════════════ */
.flip-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(4, 4, 14, 0.92);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  animation: overlay-in 0.6s var(--transition-smooth) forwards;
}

@keyframes overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.flip-overlay.out {
  animation: overlay-out 0.8s var(--transition-smooth) forwards;
}

@keyframes overlay-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

.flip-card-container {
  width: 220px;
  height: 320px;
  perspective: 1200px;
}

.flip-card {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.flip-card.flipped {
  transform: rotateY(180deg);
}

.flip-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 80px rgba(212, 184, 150, 0.08);
}

.flip-back {
  background: linear-gradient(145deg, #1a1540, #0e1a35);
  border: 2px solid rgba(212, 184, 150, 0.25);
  display: flex;
  justify-content: center;
  align-items: center;
}

.flip-back-inner {
  width: 180px;
  height: 280px;
  border: 1px solid rgba(212, 184, 150, 0.15);
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2.2rem;
  letter-spacing: 6px;
  color: var(--gold);
  font-family: inherit;
}

.flip-front {
  transform: rotateY(180deg);
  background: #0a0a18;
  border: 2px solid rgba(212, 184, 150, 0.2);
}

.flip-front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}

/* 翻牌光芒 */
.flip-glow {
  position: absolute;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(212, 184, 150, 0.15), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s;
}

.flip-glow.active {
  opacity: 1;
  animation: glow-pulse 2s ease-in-out infinite;
}

@keyframes glow-pulse {
  0%, 100% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.1); opacity: 1; }
}

/* ═══════════════════════════════════════
   七步进度条
   ═══════════════════════════════════════ */
.step-progress {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 10px 16px 14px;
  background: linear-gradient(180deg, rgba(18, 18, 31, 0.96), rgba(18, 18, 31, 0.55), transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.16);
  transition: all 0.5s var(--transition-smooth);
  position: relative;
}

.step-dot.active {
  width: 10px;
  height: 10px;
  background: var(--gold);
  border-color: var(--gold-light);
  box-shadow: 0 0 10px rgba(212, 184, 150, 0.4);
}

.step-dot.done {
  background: rgba(212, 184, 150, 0.34);
  border-color: var(--gold-dim);
}

.step-line {
  width: 16px;
  height: 1px;
  background: rgba(255, 255, 255, 0.13);
  transition: background 0.5s;
}

.step-line.done {
  background: rgba(212, 184, 150, 0.3);
}

.step-label {
  font-size: 0.68rem;
  color: var(--text-secondary);
  letter-spacing: 1px;
  margin-left: 8px;
}

/* ═══════════════════════════════════════
   打字光标效果
   ═══════════════════════════════════════ */
.typing-cursor::after {
  content: '▍';
  color: var(--gold-dim);
  animation: blink-cursor 0.8s infinite;
  margin-left: 1px;
}

@keyframes blink-cursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ═══════════════════════════════════════
   定心观察提示
   ═══════════════════════════════════════ */
.calm-prompt {
  text-align: center;
  padding: 40px 20px;
  animation: msg-appear 0.8s var(--transition-smooth) forwards;
  opacity: 0;
}

.calm-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 2;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.calm-btn {
  margin-top: 30px;
  padding: 14px 32px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(212, 184, 150, 0.25);
  border-radius: 999px;
  color: var(--gold-light);
  font-family: inherit;
  font-size: 0.9rem;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.3s var(--transition-smooth);
}

.calm-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(212, 184, 150, 0.45);
  box-shadow: 0 4px 20px var(--shadow-glow);
}

/* ═══════════════════════════════════════
   引导完成总结卡片
   ═══════════════════════════════════════ */
/* 完成区域分隔线 */
.session-divider {
  width: 40px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212, 184, 150, 0.3), transparent);
  margin: 30px auto;
}

.session-complete {
  text-align: center;
  padding: 32px 20px;
  margin-top: 8px;
  animation: msg-appear 0.8s var(--transition-smooth) forwards;
  opacity: 0;
}

.summary-card {
  background: rgba(255, 255, 255, 0.065);
  border: 1px solid rgba(212, 184, 150, 0.12);
  border-radius: 22px;
  padding: 32px 24px;
  margin-bottom: 24px;
  text-align: center;
}

.summary-card .summary-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.summary-card .summary-title {
  font-size: 1rem;
  color: var(--gold-light);
  letter-spacing: 1px;
  margin-bottom: 14px;
}

.summary-card .summary-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

.summary-card .summary-divider {
  width: 40px;
  height: 1px;
  background: rgba(212, 184, 150, 0.2);
  margin: 16px auto;
}

.complete-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 8px;
}

/* ═══════════════════════════════════════
   卡牌区光晕动画
   ═══════════════════════════════════════ */
.card-display::after {
  content: '';
  position: absolute;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(212, 184, 150, 0.04), transparent 70%);
  border-radius: 50%;
  animation: ambient-glow 5s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes ambient-glow {
  from { transform: scale(0.8); opacity: 0.5; }
  to { transform: scale(1.3); opacity: 1; }
}

/* ═══════════════════════════════════════
   顶部导航栏
   ═══════════════════════════════════════ */
.main-nav {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 16px 0;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  pointer-events: none;
}

.nav-btn {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-secondary);
  font-size: 17px;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s var(--transition-smooth);
  pointer-events: auto;
}

.nav-btn:hover,
.nav-btn:active {
  background: rgba(212, 184, 150, 0.1);
  color: var(--gold);
  border-color: rgba(212, 184, 150, 0.2);
}

/* ═══════════════════════════════════════
   历史记录抽屉
   ═══════════════════════════════════════ */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 900;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s var(--transition-smooth);
}

.drawer-overlay.active {
  opacity: 1;
  visibility: visible;
}

.history-drawer {
  position: fixed;
  top: 0;
  right: -100%;
  width: 100%;
  max-width: 420px;
  height: 100%;
  background: var(--bg-deep);
  z-index: 901;
  transition: right 0.35s var(--transition-smooth);
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--glass-border);
}

.history-drawer.open {
  right: 0;
}

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

.drawer-header h3 {
  font-size: 18px;
  color: var(--text-primary);
  font-weight: 600;
}

.drawer-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.drawer-action-btn {
  background: none;
  border: none;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
  font-family: inherit;
}

.drawer-action-btn:hover {
  color: #e57373;
  background: rgba(229, 115, 115, 0.08);
}

.drawer-close-btn {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.drawer-close-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  -webkit-overflow-scrolling: touch;
}

.drawer-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.drawer-empty .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.drawer-empty p {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 4px;
}

.drawer-empty .empty-hint {
  color: var(--text-muted);
  font-size: 13px;
}

/* ═══════════════════════════════════════
   历史记录列表项
   ═══════════════════════════════════════ */
.history-item {
  display: flex;
  gap: 12px;
  padding: 14px 12px;
  border-radius: 12px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.25s var(--transition-smooth);
  align-items: center;
}

.history-item:hover,
.history-item:active {
  background: rgba(212, 184, 150, 0.06);
  border-color: rgba(212, 184, 150, 0.15);
}

.history-item-thumb {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--glass-border);
}

.history-item-info {
  flex: 1;
  min-width: 0;
}

.history-item-date {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.history-item-summary {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.history-item-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  flex-shrink: 0;
  transition: all 0.2s;
  opacity: 0;
}

.history-item:hover .history-item-delete {
  opacity: 1;
}

.history-item-delete:hover {
  color: #e57373;
  background: rgba(229, 115, 115, 0.08);
}

/* ═══════════════════════════════════════
   通用弹窗
   ═══════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s var(--transition-smooth);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--bg-dark);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  width: 100%;
  max-width: 440px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.3s var(--transition-smooth);
}

.modal-overlay.active .modal-content {
  transform: scale(1) translateY(0);
}

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

.modal-header h3 {
  font-size: 16px;
  color: var(--text-primary);
  font-weight: 600;
}

.modal-close-btn {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  -webkit-overflow-scrolling: touch;
}

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: center;
  padding: 14px 20px;
  border-top: 1px solid var(--glass-border);
  flex-shrink: 0;
}

.modal-action-btn {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s var(--transition-smooth);
  font-family: inherit;
}

.modal-action-btn:hover {
  background: rgba(212, 184, 150, 0.1);
  color: var(--gold);
  border-color: rgba(212, 184, 150, 0.2);
}

.modal-action-btn.delete-from-detail:hover {
  background: rgba(229, 115, 115, 0.08);
  color: #e57373;
  border-color: rgba(229, 115, 115, 0.2);
}

/* ═══════════════════════════════════════
   历史对话详情弹窗
   ═══════════════════════════════════════ */
.history-detail-modal {
  max-height: 80vh;
}

.detail-card-header {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--glass-border);
}

.detail-card-thumb {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--glass-border);
}

.detail-card-info {
  flex: 1;
}

.detail-card-date {
  font-size: 13px;
  color: var(--gold-dim);
}

.detail-card-id {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.detail-message {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  line-height: 1.6;
  font-size: 14px;
}

.detail-message.detail-ai {
  background: var(--chat-ai-bg);
  border: 1px solid rgba(212, 184, 150, 0.08);
}

.detail-message.detail-user {
  background: var(--chat-user-bg);
  border: 1px solid rgba(100, 120, 180, 0.1);
}

.detail-message-role {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.detail-message-text {
  color: var(--text-primary);
  white-space: pre-wrap;
}

/* ═══════════════════════════════════════
   导出图片预览弹窗
   ═══════════════════════════════════════ */
.export-preview-modal {
  max-width: 380px;
}

.export-preview-body {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.export-preview-container {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  background: var(--bg-card);
}

.export-preview-container img {
  width: 100%;
  display: block;
}

.export-tip {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 12px;
  text-align: center;
}

.modal-action-btn.download-btn:hover {
  background: rgba(212, 184, 150, 0.15);
  color: var(--gold-light);
}

/* ═══════════════════════════════════════
   导出专用排版样式（html2canvas渲染区域）
   ═══════════════════════════════════════ */
.export-render-container {
  width: 375px;
  font-family: 'Noto Serif SC', 'Georgia', 'Songti SC', serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  overflow: hidden;
}

.export-render-card {
  padding: 24px 20px;
  text-align: center;
  border-bottom: 1px solid var(--glass-border);
}

.export-render-card img {
  width: 120px;
  height: 120px;
  border-radius: 12px;
  object-fit: cover;
  margin-bottom: 8px;
}

.export-render-card-title {
  font-size: 16px;
  color: var(--gold);
  font-weight: 600;
  margin-bottom: 4px;
}

.export-render-card-date {
  font-size: 12px;
  color: var(--text-muted);
}

.export-render-messages {
  padding: 16px 20px;
}

.export-render-msg {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  line-height: 1.6;
  font-size: 14px;
}

.export-render-msg.export-ai {
  background: var(--chat-ai-bg);
  border: 1px solid rgba(212, 184, 150, 0.08);
}

.export-render-msg.export-user {
  background: var(--chat-user-bg);
  border: 1px solid rgba(100, 120, 180, 0.1);
}

.export-render-role {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.export-render-text {
  color: var(--text-primary);
  white-space: pre-wrap;
}

.export-render-footer {
  padding: 12px 20px;
  text-align: center;
  border-top: 1px solid var(--glass-border);
}

.export-render-footer-text {
  font-size: 11px;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════
   v5.0 新增：隐私宣言
   ═══════════════════════════════════════ */
.privacy-pledge {
  margin-top: 28px;
  padding: 18px 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  text-align: center;
  animation: pledge-appear 1.2s var(--transition-smooth) forwards;
  animation-delay: 0.4s;
  opacity: 0;
}

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

.privacy-icon {
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.privacy-title {
  margin-bottom: 8px;
  color: var(--gold-light);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 1px;
}

.privacy-text {
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.9;
  letter-spacing: 0.5px;
  margin: 0;
}

.privacy-text strong {
  color: var(--gold-dim);
  font-weight: 600;
}

.safety-note {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--glass-border);
  display: flex;
  gap: 10px;
  text-align: left;
  color: var(--text-secondary);
  font-size: 0.7rem;
  line-height: 1.7;
}

.safety-note p {
  margin: 0;
}

.safety-icon {
  flex: 0 0 auto;
  margin-top: 1px;
}

/* ═══════════════════════════════════════
   v5.0 新增：激活状态提示
   ═══════════════════════════════════════ */
.activation-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  padding: 10px 18px;
  background: rgba(72, 187, 120, 0.08);
  border: 1px solid rgba(72, 187, 120, 0.15);
  border-radius: 999px;
  animation: status-appear 0.5s var(--transition-smooth) forwards;
}

@keyframes status-appear {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.activation-icon {
  font-size: 1rem;
}

.activation-text {
  font-size: 0.75rem;
  color: rgba(72, 187, 120, 0.85);
  letter-spacing: 0.5px;
}

/* ═══════════════════════════════════════
   v5.0 新增：重抽按钮样式
   ═══════════════════════════════════════ */
.redraw-btn {
  padding: 12px 28px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(212, 184, 150, 0.25);
  border-radius: 999px;
  color: var(--gold-light);
  font-family: inherit;
  font-size: 0.9rem;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.3s var(--transition-smooth);
}

.redraw-btn:hover {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(212, 184, 150, 0.4);
  box-shadow: 0 4px 20px var(--shadow-glow);
}

.redraw-btn:active {
  transform: scale(0.97);
}

.secondary-complete-btn {
  letter-spacing: 1px;
  padding-left: 22px;
  padding-right: 22px;
}

.export-render-journal {
  padding: 18px 20px;
}

.journal-field {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(212, 184, 150, 0.04);
  border: 1px solid rgba(212, 184, 150, 0.08);
}

.journal-field-label {
  color: var(--gold-dim);
  font-size: 12px;
  margin-bottom: 6px;
}

.journal-field-value {
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
}
