/* 有卦吗 — AI 命理师 */
/* 基于树洞暖色调 + 命理主题配色 */

:root {
  --color-bg: #fdf6f0;
  --color-surface: #f5ede4;
  --color-border: #e8d9c8;
  --color-text: #2a1a0a;
  --color-text-soft: #6a5040;
  --color-primary: #b8863c;
  --color-primary-light: #d4a574;
  --color-accent: #c43a31;
  --color-ai-bubble: #faf5ef;
  --color-user-bubble: #ede0cf;
  --sidebar-w: 280px;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(60, 30, 10, 0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, "PingFang SC", "Noto Serif SC", serif;
  background: var(--color-bg);
  color: var(--color-text);
  height: 100vh;
  overflow: hidden;
}

/* ---- App 布局 ---- */
.app {
  display: flex;
  height: 100vh;
}

/* ---- 侧栏 ---- */
.sidebar {
  width: var(--sidebar-w);
  background: #f8f2eb;
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar-header {
  padding: 20px 16px 12px;
  text-align: center;
  border-bottom: 1px solid var(--color-border);
}
.sidebar-brand { font-size: 40px; line-height: 1.2; }
.sidebar-subtitle { font-size: 14px; color: var(--color-text-soft); margin-top: 4px; }
.new-chat-btn {
  margin: 12px 16px;
  padding: 10px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.new-chat-btn:hover { background: #a0732e; }
.plus-icon { font-size: 18px; font-weight: 300; }
.session-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px;
}
.session-list-empty {
  padding: 20px 12px;
  color: var(--color-text-soft);
  font-size: 13px;
  text-align: center;
}
.session-item {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
  color: var(--color-text);
  position: relative;
}
.session-item:hover { background: rgba(184, 134, 60, 0.08); }
.session-item.is-active { background: rgba(184, 134, 60, 0.12); font-weight: 500; }
.session-item-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-item-time { font-size: 12px; color: var(--color-text-soft); }
.session-item-del {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: #c99;
  cursor: pointer;
  padding: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.session-item:hover .session-item-del { opacity: 1; }
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--color-border);
  text-align: center;
  font-size: 12px;
  color: var(--color-text-soft);
}

/* ---- 聊天区 ---- */
.chat-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--color-surface);
}
.chat-header-title { font-size: 16px; font-weight: 500; }
.icon-btn { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--color-text-soft); }
.chat-stream {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.welcome {
  text-align: center;
  margin: auto;
  padding: 40px 20px;
}
.welcome-brand { font-size: 60px; margin-bottom: 12px; }
.welcome h2 { font-size: 24px; margin-bottom: 8px; color: var(--color-text); }
.welcome p { color: var(--color-text-soft); font-size: 15px; line-height: 1.8; }
.welcome-hint { font-size: 13px; margin-top: 12px; }

/* ---- 气泡 ---- */
.bubble-row {
  display: flex;
  gap: 8px;
  max-width: 85%;
  animation: fadeInUp 0.3s ease;
}
.bubble-row-ai { align-self: flex-start; }
.bubble-row-user { align-self: flex-end; flex-direction: row-reverse; }
.bubble-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  background: #f0e6d8;
}
.bubble-col { display: flex; flex-direction: column; gap: 8px; }
.bubble {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 15px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}
.bubble-ai { background: var(--color-ai-bubble); border: 1px solid var(--color-border); }
.bubble-user { background: var(--color-user-bubble); }

/* ---- 选项按钮 ---- */
.options-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.option-btn {
  background: #fdf6f0;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  color: var(--color-text);
  transition: all 0.15s;
}
.option-btn:hover { background: var(--color-primary-light); border-color: var(--color-primary); color: #fff; }
.options-sep {
  height: 1px;
  background: var(--color-border);
  margin: 4px 0;
}

/* ---- 思考中 ---- */
.thinking-text {
  color: var(--color-text-soft);
  font-size: 14px;
  animation: thinkingPulse 2.4s ease-in-out infinite;
}
@keyframes thinkingPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1.0; }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- 输入区 ---- */
.composer {
  padding: 12px 16px;
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--color-surface);
}
.composer-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  font-size: 15px;
  font-family: inherit;
  resize: none;
  background: #fff;
  outline: none;
}
.composer-input:focus { border-color: var(--color-primary); }
.send-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--color-primary);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.send-btn:disabled { opacity: 0.4; cursor: default; }
.send-icon { font-size: 16px; }
.composer-error {
  padding: 4px 16px;
  color: var(--color-accent);
  font-size: 13px;
  min-height: 20px;
}
.retry-btn {
  margin: 4px 16px;
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--color-accent);
  border-radius: 8px;
  color: var(--color-accent);
  cursor: pointer;
  font-size: 13px;
}

/* ---- 命盘卡片 ---- */
.mingpan-card-wrap {
  margin-top: 8px;
  border-radius: var(--radius);
  overflow: hidden;
}
.mingpan-card {
  background: linear-gradient(135deg, #f5f0e8, #ebe3d5);
  border: 2px solid #c43a31;
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
}
.mingpan-card-traditional .mingpan-card {
  background:
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(180,160,130,0.02) 2px, rgba(180,160,130,0.02) 4px),
    linear-gradient(135deg, #faf6ef 0%, #f3ece0 40%, #ece3d2 100%);
  border: 2.5px solid #a8322a;
  box-shadow: inset 0 0 40px rgba(180,150,120,0.04);
  position: relative;
}
/* v1.6: 去除朱砂印章伪元素（传统风格不需要印章装饰） */

/* 下载引导提示 — v1.6 已移除 */
/* v1.6: card-download-hint 已删除 */
.mingpan-card-modern .mingpan-card {
  background: linear-gradient(135deg, #fdf6f0, #ede0cf);
  border-color: #d4a574;
}
.card-pillars {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 12px 0;
}
.card-pillar {
  text-align: center;
  min-width: 48px;
}
.card-pillar-gan { font-size: 20px; font-weight: 700; }
.card-pillar-zhi { font-size: 14px; color: var(--color-text-soft); }
.card-daymaster {
  font-size: 28px;
  font-weight: 700;
  margin: 8px 0;
}
.card-pattern {
  display: inline-block;
  padding: 4px 16px;
  border: 1px solid var(--color-accent);
  border-radius: 20px;
  color: var(--color-accent);
  font-size: 14px;
}
.card-footer {
  margin-top: 16px;
  font-size: 12px;
  color: var(--color-text-soft);
}
.card-save-btn {
  margin-top: 12px;
  padding: 8px 20px;
  border: none;
  border-radius: 20px;
  background: var(--color-primary);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}
.card-style-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.card-style-btn {
  flex: 1;
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
}
.card-style-btn.is-active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* ---- 移动端 ---- */
@media (max-width: 768px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 100; transform: translateX(-100%); transition: transform 0.25s; }
  .sidebar.is-open { transform: translateX(0); }
  .bubble-row { max-width: 92%; }
  .card-pillars { gap: 8px; }
  .card-pillar-gan { font-size: 18px; }
  .card-daymaster { font-size: 24px; }
  /* v1.8: 移动端缩小太极图 */
  .taiji-circle { width: 200px; height: 200px; }
  .taiji-circle::before, .taiji-circle::after { width: 100px; height: 100px; }
}

/* ---- v1.8: 太极八卦背景装饰 ---- */
.taiji-bg {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.03;
}
.taiji-circle {
  width: 400px; height: 400px;
  border-radius: 50%;
  background: conic-gradient(
    #1a1a1a 0deg 180deg,
    #f0ebe0 180deg 360deg
  );
  position: relative;
}
.taiji-circle::before {
  content: '';
  position: absolute;
  width: 200px; height: 200px;
  background: #f0ebe0;
  border-radius: 50%;
  top: 0; left: 50%;
  transform: translateX(-50%);
}
.taiji-circle::after {
  content: '';
  position: absolute;
  width: 200px; height: 200px;
  background: #1a1a1a;
  border-radius: 50%;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
}
