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

/* ══ Reset ══ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  --gold:          #c9a84c;
  --gold-light:    #e8cc80;
  --gold-dim:      #a58241;
  --gold-glow:     rgba(201,168,76,.15);
  --bg-dark:       #0e0e0e;
  --bg-card-dark:  #161616;
  --bg-cell:       #1a1a1a;
  --bg-hover:      #222;
  --border-dark:   #2a2a2a;
  --border-gold:   #3a3020;
  --text-light:    #e8e0d0;
  --text-dim:      #ab9d86;
  --text-muted:    #8a8077;
  /* 浅色（基本信息页） */
  --bg-info:       #f5f3ef;
  --bg-row:        #faf9f7;
  --bg-row-alt:    #ede9e2;
  --border-info:   #e8e2d8;
  --text-dark:     #1a1a1a;
  --text-mid:      #4a4540;
  --text-sub:      #8a8478;
  --text-gold:     #b8860b;
  /* 五行色 */
  --c-wood:        #4a9060;
  --c-fire:        #d94040;
  --c-earth:       #c9a84c;
  --c-metal:       #c8c8c8;
  --c-water:       #4080c8;
  --c-fire-info:   #c0392b;
  --c-water-info:  #2471a3;
  --c-wood-info:   #1e7a4a;
  /* picker */
  --picker-item-h: 44px;
  --picker-visible: 5;
}

body {
  font-family: 'Noto Serif SC', 'Songti SC', 'STSong', serif;
  background: var(--bg-dark);
  color: var(--text-light);
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ══════════════════════════════════════
   首页（输入表单）
══════════════════════════════════════ */
#homeScreen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(ellipse at 50% 0%, #1a1508 0%, #0c0c0c 60%);
}

.home-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 20px 32px;
  position: relative;
}

.home-header::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23c9a84c' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/svg%3E");
}

/* 八卦盘 Logo 旋转环 */
.logo-ring {
  position: relative;
  width: 120px;
  height: 120px;
  margin-bottom: 20px;
}

.logo-ring::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: conic-gradient(
    #a07828 0deg, #e8cc80 60deg, #c9a84c 120deg,
    #f0d890 180deg, #c9a84c 240deg, #e8cc80 300deg, #a07828 360deg
  );
  animation: rotateSlow 20s linear infinite;
}

.logo-ring::after { display: none; }

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

.logo-inner {
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  overflow: hidden;
  background: #0c0c0c;
}

.logo-inner svg {
  width: 68px;
  height: 68px;
  filter: drop-shadow(0 0 8px rgba(201,168,76,.5));
}

.home-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 6px;
  color: var(--gold-light);
  animation: fadeUp .5s ease both;
}

.home-subtitle {
  font-size: 13px;
  color: var(--gold-dim);
  letter-spacing: 4px;
  margin-top: 6px;
  animation: fadeUp .5s .1s ease both;
}

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

/* 首页表单 */
.home-form {
  flex: 1;
  padding: 0 16px 48px;
}

.form-card {
  background: var(--bg-card-dark);
  border: 1px solid var(--border-dark);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 12px;
}

.form-card-title {
  font-size: 13px;
  color: var(--gold);
  letter-spacing: 3px;
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-dark);
}

.form-row { margin-bottom: 14px; }
.form-row:last-child { margin-bottom: 0; }

.form-label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 7px;
  letter-spacing: 1px;
}

.required { color: var(--c-fire); }

.form-input {
  width: 100%;
  background: #111;
  border: 1px solid var(--border-dark);
  border-radius: 8px;
  color: var(--text-light);
  font-size: 16px;
  font-family: inherit;
  padding: 11px 14px;
  outline: none;
  transition: border-color .2s;
  -webkit-appearance: none;
  appearance: none;
}
.form-input:focus { border-color: var(--gold-dim); }
.form-input::placeholder { color: var(--text-muted); }

/* 性别切换 */
.gender-toggle {
  display: flex;
  background: #111;
  border: 1px solid var(--border-dark);
  border-radius: 8px;
  padding: 3px;
  gap: 3px;
}

.gender-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 16px;
  font-family: inherit;
  font-weight: 500;
  padding: 9px 0;
  cursor: pointer;
  transition: background .2s, color .2s;
  letter-spacing: 2px;
}

.gender-btn.active {
  background: linear-gradient(135deg, #7a5010, #c9a84c);
  color: #0e0e0e;
  font-weight: 700;
}

/* picker 触发字段 */
.picker-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #111;
  border: 1px solid var(--border-dark);
  border-radius: 8px;
  padding: 11px 14px;
  cursor: pointer;
  transition: border-color .2s;
  user-select: none;
}
.picker-field:active { border-color: var(--gold-dim); }

.picker-value {
  font-size: 16px;
  color: var(--text-muted);
  font-family: inherit;
}
.picker-value.has-value { color: var(--text-light); }

.picker-arrow { color: var(--text-dim); font-size: 16px; line-height: 1; }

/* 提交按钮 */
.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #7a5010 0%, #c9a84c 50%, #7a5010 100%);
  background-size: 200% 100%;
  border: none;
  border-radius: 10px;
  color: #0a0800;
  font-size: 16px;
  font-family: inherit;
  font-weight: 700;
  letter-spacing: 6px;
  padding: 14px;
  cursor: pointer;
  margin-top: 8px;
  transition: background-position .4s, transform .1s, box-shadow .2s;
  box-shadow: 0 4px 20px rgba(201,168,76,.2);
}
.btn-primary:hover  { background-position: 100% 0; box-shadow: 0 6px 24px rgba(201,168,76,.35); }
.btn-primary:active { transform: scale(0.98); }

/* ══════════════════════════════════════
   结果页（topbar + tabs + panels）
══════════════════════════════════════ */
#resultScreen { display: none; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #000;
  border-bottom: 1px solid #1a1a1a;
  position: sticky;
  top: 0;
  z-index: 200;
}

.topbar-back  { font-size: 18px; color: #9a9a9a; cursor: pointer; padding: 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.topbar-back-label { font-size: 12px; color: #9a9a9a; letter-spacing: 1px; line-height: 1; }
.topbar-title {
  font-size: 16px;
  color: var(--text-light);
  letter-spacing: 3px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-more  { font-size: 20px; color: #9a9a9a; cursor: pointer; padding: 4px; display: flex; align-items: center; justify-content: center; position: relative; }

/* 右上角下拉菜单 */
.topbar-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: #1e1e1e;
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  overflow: hidden;
  min-width: 110px;
  z-index: 200;
  box-shadow: 0 4px 16px rgba(0,0,0,.6);
}
.topbar-dropdown.open { display: block; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  font-size: 15px;
  color: var(--text-light);
  cursor: pointer;
  letter-spacing: 1px;
}
.dropdown-item:hover { background: #2a2410; color: var(--gold); }

/* 设置弹窗 */
.settings-modal {
  width: 320px;
  max-width: 90vw;
}
.settings-body {
  padding: 20px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.settings-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.settings-avatar-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--gold-dim);
  cursor: pointer;
}
.settings-avatar-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.settings-avatar-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #fff;
  opacity: 0;
  transition: opacity .2s;
}
.settings-avatar-wrap:hover .settings-avatar-overlay { opacity: 1; }
.settings-avatar-hint {
  font-size: 13px;
  color: var(--text-dim);
}
.settings-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.settings-label {
  font-size: 14px;
  color: var(--gold-dim);
  letter-spacing: 1px;
}
.settings-input {
  background: var(--bg-dark);
  border: 1px solid var(--border-gold);
  border-radius: 6px;
  color: var(--text-light);
  font-size: 16px;
  padding: 9px 12px;
  outline: none;
}
.settings-input:focus { border-color: var(--gold-dim); }
.settings-save-btn { width: 100%; margin-top: 4px; }



.tab-panel { display: none; }
.tab-panel.active { display: block; }

.pb-nav { padding-bottom: 80px; }

/* 底部导航 */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: #000;
  border-top: 1px solid #1a1a1a;
  display: flex;
  padding: 8px 0 20px;
  z-index: 198;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
}

.nav-icon  { font-size: 20px; display: flex; align-items: center; justify-content: center; }
.nav-icon img { width: 24px; height: 24px; object-fit: contain; opacity: 0.35; }
.nav-item.active .nav-icon img { opacity: 1; }
.nav-label { font-size: 12px; color: #828282; letter-spacing: 1px; }
.nav-item.active .nav-label { color: var(--gold); }


/* ══════════════════════════════════════
   Loading
══════════════════════════════════════ */
.loading {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-dim);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 2px solid var(--border-dark);
  border-top-color: var(--gold);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin .8s linear infinite;
}

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

/* ══════════════════════════════════════
   Tab 0：基本信息 — Hero
══════════════════════════════════════ */
.hero {
  background: radial-gradient(ellipse at 50% 0%, #1a1508 0%, #0c0c0c 70%);
  padding: 32px 20px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23c9a84c' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/svg%3E");
}

.hero-ring {
  position: relative;
  width: 96px;
  height: 96px;
  margin-bottom: 16px;
}

.hero-ring::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: conic-gradient(
    var(--gold-dim) 0deg, var(--gold) 60deg, var(--gold-dim) 120deg,
    var(--gold) 180deg, var(--gold-dim) 240deg, var(--gold) 300deg, var(--gold-dim) 360deg
  );
  animation: rotateSlow 20s linear infinite;
}

.hero-ring::after {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: #0c0c0c;
}

.hero-avatar {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  background: radial-gradient(circle, #1f1a08 0%, #0c0c0c 100%);
  margin: 3px;
  font-size: 40px;
}

.hero-name {
  font-size: 20px;
  color: var(--gold-light);
  font-weight: 600;
  letter-spacing: 3px;
  margin-bottom: 4px;
  animation: fadeUp .4s ease both;
}

.hero-sub {
  font-size: 13px;
  color: var(--gold-dim);
  letter-spacing: 2px;
  animation: fadeUp .4s .1s ease both;
}

/* 信息列表（深色金风格） */
.info-section {
  background: var(--bg-dark);
}

.info-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  min-height: 48px;
  border-bottom: 1px solid var(--border-gold);
  transition: background .15s;
  animation: fadeRow .3s ease both;
}

.info-row:nth-child(odd)  { background: var(--bg-dark); }
.info-row:nth-child(even) { background: var(--bg-card-dark); }
.info-row:hover { background: #1e1a0e !important; }

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

.info-row:nth-child(1) { animation-delay: .04s; }
.info-row:nth-child(2) { animation-delay: .07s; }
.info-row:nth-child(3) { animation-delay: .10s; }
.info-row:nth-child(4) { animation-delay: .13s; }
.info-row:nth-child(5) { animation-delay: .16s; }
.info-row:nth-child(6) { animation-delay: .19s; }
.info-row:nth-child(7) { animation-delay: .22s; }

.info-label {
  font-size: 13px;
  color: var(--gold-dim);
  white-space: nowrap;
  min-width: 76px;
  flex-shrink: 0;
  letter-spacing: 1px;
}

.info-value {
  font-size: 15px;
  color: var(--text-light);
  font-weight: 400;
  flex: 1;
  line-height: 1.6;
}

.info-right-label { font-size: 13px; color: var(--gold-dim); white-space: nowrap; flex-shrink: 0; letter-spacing: 1px; }
.info-right-value { font-size: 15px; color: var(--text-light); font-weight: 400; margin-left: 8px; white-space: nowrap; }

.accent-gold { color: var(--gold) !important; font-weight: 600; }
.accent-red  { color: var(--c-fire) !important; }
.accent-blue { color: var(--c-water) !important; }

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 500;
  margin-left: 6px;
  letter-spacing: .5px;
}

.badge-qian { background: rgba(201,168,76,.15); color: var(--gold); border: 1px solid var(--gold-dim); }
.badge-yin  { background: rgba(64,128,200,.12); color: #6aaae0; border: 1px solid #2a4a70; }

/* 双列行 */
.info-row-2col {
  display: flex;
  border-bottom: 1px solid var(--border-gold);
  background: var(--bg-card-dark);
  animation: fadeRow .3s .24s ease both;
}

.info-col {
  flex: 1;
  padding: 11px 16px;
  border-right: 1px solid var(--border-gold);
}

.info-col:last-child { border-right: none; }

.col-label { font-size: 12px; color: var(--gold-dim); margin-bottom: 4px; letter-spacing: 1px; }
.col-value { font-size: 15px; color: var(--text-light); font-weight: 400; line-height: 1.5; }
.col-sub   { font-size: 12px; color: var(--text-dim); margin-top: 3px; }

.info-divider {
  height: 6px;
  background: #0a0a0a;
  border-top: 1px solid var(--border-gold);
  border-bottom: 1px solid var(--border-gold);
}

/* 日主属性块 */
.ai-block {
  background: linear-gradient(135deg, #111008 0%, #0e0c04 100%);
  border-top: 1px solid var(--border-gold);
}

.ai-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--border-gold);
}

.ai-title { font-size: 14px; color: var(--gold-dim); letter-spacing: 3px; }

.ai-grid { display: grid; grid-template-columns: 1fr 1fr; }

.ai-item {
  padding: 12px 16px;
  border-right: 1px solid var(--border-gold);
  border-bottom: 1px solid var(--border-gold);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-item:nth-child(even)      { border-right: none; }
.ai-item:nth-last-child(-n+2) { border-bottom: none; }

.ai-item-label { font-size: 13px; color: var(--gold-dim); letter-spacing: .5px; }
.ai-item-value { font-size: 15px; color: var(--text-light); font-weight: 500; }
.ai-item-value.fire  { color: var(--c-fire); }
.ai-item-value.water { color: var(--c-water); }
.ai-item-value.wood  { color: var(--c-wood); }
.ai-item-value.earth { color: var(--gold); }
.ai-item-value.metal { color: var(--c-metal); }

/* ══════════════════════════════════════
   Tab 1：基本排盘
══════════════════════════════════════ */

/* 用户信息小卡 */
.user-card {
  background: linear-gradient(135deg, #111 0%, #1a1610 100%);
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-gold);
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2a2010, #1a1a0a);
  border: 1px solid var(--gold-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.user-info { flex: 1; }
.user-name { font-size: 16px; color: var(--gold-light); font-weight: 600; letter-spacing: 1px; }
.user-meta { font-size: 13px; color: var(--text-dim); margin-top: 3px; line-height: 1.6; }
.user-tag  {
  font-size: 13px;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 6px;
}

.user-actions { display: flex; gap: 8px; }

.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #222;
  border: 1px solid #333;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  color: var(--text-dim);
}

/* 提示条 */
.hint-bar {
  background: #111;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-dark);
  display: flex;
  align-items: center;
  gap: 6px;
}

.hint-bar em { color: var(--gold-dim); font-style: normal; }

.hint-close {
  margin-left: auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #2a2a2a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  cursor: pointer;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* 主排盘表格 */
.paipan-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  font-family: inherit;
}

.paipan-table th {
  padding: 8px 4px;
  text-align: center;
  color: var(--text-dim);
  font-weight: 400;
  border-bottom: 1px solid var(--border-dark);
  font-size: 14px;
  letter-spacing: 1px;
}

.paipan-table td {
  padding: 7px 4px;
  text-align: center;
  border-bottom: 1px solid var(--border-dark);
  vertical-align: top;
}

.paipan-table tr:hover td { background: var(--bg-hover); }

.row-label {
  color: var(--text-dim);
  font-size: 14px;
  text-align: left !important;
  padding-left: 12px !important;
  white-space: nowrap;
  letter-spacing: 1px;
}

/* 五行颜色（深色页） */
.wx-wood  { color: var(--c-wood); }
.wx-fire  { color: var(--c-fire); }
.wx-earth { color: var(--c-earth); }
.wx-metal { color: var(--c-metal); }
.wx-water { color: var(--c-water); }

.gz-char { font-size: 22px; font-weight: 600; line-height: 1.2; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.gz-wx-icon { width: 20px; height: 20px; object-fit: contain; }

.shishen-tag { font-size: 14px; color: var(--gold); letter-spacing: .5px; cursor: pointer; }

.canggan-cell { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.canggan-item { font-size: 13px; line-height: 1.4; white-space: nowrap; }

.cs-tag       { font-size: 14px; color: var(--text-dim); cursor: pointer; }
.cs-tag.wang  { color: var(--gold); }
.cs-tag.sheng { color: var(--c-wood); }
.cs-tag.si    { color: #8e8e8e; }

.kongwang { font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.nayin    { font-size: 13px; color: var(--text-dim); cursor: pointer; }

.shensha-cell       { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.shensha-tag        { font-size: 13px; color: var(--gold); cursor: pointer; white-space: nowrap; transition: color .15s; }
.shensha-tag:hover  { color: var(--gold-light); }
.shensha-tag.xiong  { color: #c04040; }

/* 区块分隔 */
.section-divider {
  height: 8px;
  background: #0a0a0a;
  border-top: 1px solid var(--border-dark);
  border-bottom: 1px solid var(--border-dark);
}

/* 原局关系 */
.relations-block {
  padding: 12px 16px;
  background: var(--bg-card-dark);
  border-bottom: 1px solid var(--border-dark);
  margin-bottom: 12px;
}

.rel-row { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.rel-row:last-child { margin-bottom: 0; }
.rel-label   { color: var(--gold); white-space: nowrap; font-size: 13px; padding-top: 2px; min-width: 56px; }
.rel-content { color: var(--text-light); line-height: 1.8; font-size: 13px; }

.rel-item {
  display: inline-block;
  margin-right: 5px;
  margin-bottom: 4px;
  padding: 1px 6px;
  background: #1e1e1e;
  border: 1px solid #2a2a2a;
  border-radius: 3px;
  font-size: 13px;
}

.rel-item.he    { border-color: #2a3a2a; color: var(--c-wood); }
.rel-item.chong { border-color: #3a2a2a; color: var(--c-fire); }
.rel-item.xing  { border-color: #3a3020; color: var(--gold); }
.rel-item.none  { color: var(--text-muted); font-style: italic; border: none; background: none; }

/* 五行分析区块 */
.wuxing-analysis-block {
  background: var(--bg-card-dark);
  border: 1px solid var(--border-dark);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 16px;
}

.wangqi-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-dark);
}

.wuxing-bars-section {
  padding: 14px 16px;
}

.sub-title {
  font-size: 13px;
  color: var(--gold-dim);
  margin-bottom: 10px;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.wangqi-row { display: flex; gap: 6px; margin-bottom: 8px; }

.wq-item {
  flex: 1;
  text-align: center;
  padding: 6px 2px;
  background: #1a1a1a;
  border-radius: 4px;
  border: 1px solid var(--border-dark);
}

.wq-wx-icon  { width: 28px; height: 28px; object-fit: contain; margin-bottom: 2px; }
.wq-wx       { font-size: 13px; color: var(--text-light); margin-bottom: 2px; }
.wq-st       { font-size: 12px; color: var(--text-muted); }
.wq-st.wang  { color: var(--gold); }
.wq-st.xiang { color: var(--c-wood); }
.wq-st.xiu   { color: var(--text-dim); }
.wq-st.qiu   { color: #8e8e8e; }
.wq-st.si    { color: #3a3a3a; }

/* 五行力量条（已合并到五行分析区块，无需独立容器样式） */

.wx-bar-row   { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.wx-bar-label { width: 44px; font-size: 14px; text-align: center; display: flex; align-items: center; gap: 4px; }
.wx-icon-img  { width: 22px; height: 22px; object-fit: contain; flex-shrink: 0; }
.wx-bar-track { flex: 1; height: 5px; background: #222; border-radius: 3px; overflow: hidden; }
.wx-bar-fill  { height: 100%; border-radius: 3px; transition: width .8s cubic-bezier(.4,0,.2,1); }
.wx-bar-score { width: 54px; font-size: 12px; color: var(--text-muted); text-align: right; }

/* 大运/流年 */
.dayun-block {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-dark);
}

.block-title {
  font-size: 15px;
  color: var(--gold);
  letter-spacing: 2px;
  margin-top: 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.block-title:first-child {
  margin-top: 0;
}

.block-title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 14px;
  background: var(--gold);
  border-radius: 2px;
}

.block-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 8px;
  line-height: 1.8;
}

.dayun-scroll, .liunian-scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}

.dayun-scroll::-webkit-scrollbar,
.liunian-scroll::-webkit-scrollbar { display: none; }

.dayun-item {
  flex-shrink: 0;
  width: 62px;
  background: #1a1a1a;
  border: 1px solid var(--border-dark);
  border-radius: 6px;
  padding: 8px 4px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s;
}

.dayun-item:hover      { border-color: var(--gold-dim); }
.dayun-item.current    { border-color: var(--gold); background: #1e1a0e; }
.dayun-item.active-sel { border-color: var(--gold-light); background: #201c0e; }

.dayun-year { font-size: 13px; color: var(--text-muted); margin-bottom: 2px; }
.dayun-age  { font-size: 13px; color: var(--gold-dim); margin-bottom: 4px; font-weight: 600; }
.dayun-gz   { font-size: 16px; font-weight: 700; letter-spacing: 1px; }
.dayun-gan  { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

.liunian-item {
  flex-shrink: 0;
  width: 52px;
  background: #161616;
  border: 1px solid var(--border-dark);
  border-radius: 4px;
  padding: 6px 3px;
  text-align: center;
}

.liunian-item.current { border-color: var(--gold); background: #1a180a; }

.liunian-yr { font-size: 13px; color: var(--text-muted); margin-bottom: 2px; }
.liunian-gz { font-size: 16px; font-weight: 600; }
.liunian-ss { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* 基本解读文字块 */
.reading-block {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-dark);
  background: var(--bg-card-dark);
}

.reading-block h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 7px;
  letter-spacing: 1px;
}

.reading-block h3::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 13px;
  background: var(--gold);
  border-radius: 2px;
  flex-shrink: 0;
}

.reading-block p {
  font-size: 15px;
  color: var(--text-dim);
  line-height: 2;
}

.reading-block p strong { color: var(--text-light); }

/* 重新排盘按钮 */
.btn-secondary {
  display: block;
  width: calc(100% - 32px);
  margin: 16px;
  background: transparent;
  border: 1px solid var(--border-dark);
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 15px;
  font-family: inherit;
  letter-spacing: 2px;
  padding: 12px;
  cursor: pointer;
  transition: border-color .2s, color .2s;
  text-align: center;
}

.btn-secondary:hover { border-color: var(--gold-dim); color: var(--gold); }

/* Tab 2/3 占位 */
.placeholder-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  gap: 12px;
  color: var(--text-muted);
}

.placeholder-panel .ph-icon { font-size: 40px; opacity: .3; }
.placeholder-panel .ph-text { font-size: 15px; letter-spacing: 2px; }

/* ══════════════════════════════════════
   排盘历史 Tab 3
══════════════════════════════════════ */
/* ── AI解盘 敬请期待 ── */
.ai-coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  gap: 14px;
}
.ai-coming-icon {
  font-size: 40px;
  color: var(--gold-dim);
  animation: pulse 2.4s ease-in-out infinite;
}
.ai-coming-title {
  font-size: 20px;
  color: var(--gold-light);
  letter-spacing: 4px;
  font-weight: 600;
}
.ai-coming-desc {
  font-size: 15px;
  color: var(--text-dim);
  letter-spacing: 3px;
}
@keyframes pulse {
  0%, 100% { opacity: .4; transform: scale(1); }
  50%       { opacity: 1;  transform: scale(1.1); }
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border-dark);
}
.history-title { font-size: 16px; color: var(--gold); letter-spacing: 2px; }
.history-count { font-size: 13px; color: var(--text-muted); }

.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-dark);
  cursor: pointer;
  transition: background .15s;
}
.history-item:hover { background: var(--bg-hover); }
.history-item:active { background: #1e1a0e; }

.history-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.history-avatar.male   { background: #0e1a2a; color: #4080c8; border: 1px solid #1a2a3a; }
.history-avatar.female { background: #2a0e1a; color: #c84080; border: 1px solid #3a1a2a; }

.history-info { flex: 1; min-width: 0; }
.history-name { font-size: 16px; font-weight: 600; color: var(--text-light); margin-bottom: 3px; }
.history-date { font-size: 14px; color: var(--text-dim); margin-bottom: 2px; }
.history-time { font-size: 12px; color: var(--text-muted); }

.history-del {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border-dark);
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, color .15s;
}
.history-del:hover { border-color: var(--c-fire); color: var(--c-fire); }

.history-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 80px 20px;
  gap: 14px;
  color: var(--text-muted);
}
.history-empty-icon { font-size: 36px; opacity: .25; }
.history-empty-text { font-size: 15px; letter-spacing: 1px; text-align: center; line-height: 2; }

/* ══════════════════════════════════════
   Tab 2 专业细盘
══════════════════════════════════════ */

/* 通用区块容器 */
.pro-block {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-dark);
}
.pro-block:last-child { border-bottom: none; }

/* ── 格局 / 用神 ── */
.geju-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.geju-name {
  font-size: 18px;
  color: var(--gold-light);
  font-weight: 600;
  letter-spacing: 2px;
}
.kb-clickable {
  cursor: pointer;
  border-bottom: 1px dashed var(--gold-dim);
  transition: color .15s;
}
.kb-clickable:hover { color: var(--gold); }
.geju-type-tag {
  font-size: 13px;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  border-radius: 4px;
  padding: 1px 6px;
  letter-spacing: 1px;
}
.geju-strength-tag {
  font-size: 13px;
  color: #4a9060;
  border: 1px solid #2a5035;
  border-radius: 4px;
  padding: 1px 6px;
}
.geju-strength-tag.broken {
  color: #d94040;
  border-color: #7a2020;
}
.geju-say {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
  margin: 4px 0 8px;
}
.geju-broken {
  font-size: 14px;
  color: #d94040;
  margin-bottom: 8px;
}
.geju-section-title {
  font-size: 14px;
  color: var(--gold);
  letter-spacing: 1px;
  margin: 10px 0 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.geju-source {
  font-size: 13px;
  color: var(--text-dim);
}
.yongshen-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.yongshen-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 1px solid;
  border-radius: 6px;
  padding: 5px 10px;
  min-width: 44px;
  background: rgba(255,255,255,.03);
}
.yongshen-chip-wx {
  font-size: 16px;
  font-weight: 600;
}
.yongshen-chip-label {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}
.tiaohuo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.tiaohuo-label {
  font-size: 13px;
  color: var(--text-dim);
}
.tiaohuo-val {
  font-size: 15px;
  color: var(--gold-light);
  letter-spacing: 1px;
}
.suggest-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 4px;
}
.suggest-item {
  background: #1a1a0e;
  border: 1px solid var(--border-gold);
  border-radius: 6px;
  padding: 7px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.suggest-item-wide {
  grid-column: 1 / -1;
}
.suggest-key {
  font-size: 12px;
  color: var(--text-dim);
}
.suggest-val {
  font-size: 15px;
  color: var(--text-light);
}

/* 起运信息卡 */
.qiyun-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #1a1a0e;
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 4px;
}
.qiyun-icon { font-size: 22px; flex-shrink: 0; }
.qiyun-main { flex: 1; }
.qiyun-desc { font-size: 16px; color: var(--gold-light); font-weight: 600; letter-spacing: 1px; }
.qiyun-sub  { font-size: 13px; color: var(--text-dim); margin-top: 3px; }

/* 大运卡片（scroll 容器已有） */
.dayun-item { position: relative; }
.dayun-item.current::after {
  content: '当';
  position: absolute;
  top: 3px; right: 3px;
  font-size: 10px;
  color: var(--gold);
  background: #2a220a;
  border-radius: 2px;
  padding: 0 2px;
  line-height: 14px;
}
.dayun-ss { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* 当前大运详情 */
.dayun-detail {
  background: #161410;
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  padding: 10px 12px;
}
.dayun-detail-title { font-size: 13px; color: var(--gold-dim); margin-bottom: 8px; letter-spacing: 1px; }
.dayun-detail-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.dayun-detail-item  { display: flex; flex-direction: column; gap: 2px; }
.dayun-detail-label { font-size: 12px; color: var(--text-muted); }
.dayun-detail-value { font-size: 15px; color: var(--text-light); font-weight: 600; }

/* 胎元·命宫·身宫 */
.tms-row { display: flex; gap: 8px; margin-top: 4px; }
.tms-card {
  flex: 1;
  background: var(--bg-card-dark);
  border: 1px solid var(--border-dark);
  border-radius: 8px;
  padding: 10px 8px;
  text-align: center;
}
.tms-label { font-size: 12px; color: var(--gold-dim); margin-bottom: 6px; letter-spacing: 1px; }
.tms-gz    { font-size: 18px; font-weight: 700; color: var(--gold-light); letter-spacing: 2px; }
.tms-nayin { font-size: 11px; color: var(--text-muted); margin-top: 4px; line-height: 1.5; }

/* 流年（scroll 容器已有） */
.liunian-item.current .liunian-yr { color: var(--gold); }
.liunian-item.current .liunian-gz { color: var(--gold-light); }

/* 流月表格 */
.liuyue-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-top: 6px;
}
.liuyue-table th {
  color: var(--gold-dim);
  font-weight: 500;
  padding: 5px 4px;
  border-bottom: 1px solid var(--border-dark);
  text-align: center;
  letter-spacing: .5px;
}
.liuyue-table td {
  padding: 7px 4px;
  border-bottom: 1px solid #1e1e1e;
  text-align: center;
  color: var(--text-dim);
}
.liuyue-table tr:last-child td { border-bottom: none; }
.liuyue-table td.gz-cell {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-light);
  letter-spacing: 1px;
}
.liuyue-table td.jieqi-cell { color: var(--gold-dim); font-size: 13px; }
.liuyue-table td.date-cell  { color: var(--text-muted); font-size: 13px; }
.liuyue-table td.ss-cell    { font-size: 13px; }

/* ══════════════════════════════════════
   神煞弹窗
══════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.modal-overlay.open { display: flex; }

.modal {
  background: #161616;
  border-radius: 16px;
  padding: 20px 20px 28px;
  width: 100%;
  max-width: 420px;
  max-height: 80vh;
  overflow-y: auto;
  animation: fadeScale .22s ease;
}

@keyframes fadeScale {
  from { transform: scale(.94); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-title { font-size: 17px; color: var(--gold-light); font-weight: 600; letter-spacing: 1px; }

.modal-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #2a2a2a;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-section       { margin-bottom: 14px; }
.modal-section-title { font-size: 14px; color: var(--gold); margin-bottom: 6px; letter-spacing: 1px; }
.modal-body          { font-size: 15px; color: var(--text-light); line-height: 1.9; }
.modal-body.dim      { color: var(--text-dim); font-size: 14px; }

/* ── ? 解说图标 ── */
.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 5px;
  cursor: pointer;
  vertical-align: middle;
  flex-shrink: 0;
}
.info-icon img { opacity: 0.45; transition: opacity .2s; }
.info-icon:hover img { opacity: 1; }

/* 解说弹窗内容 */
.info-modal-body { padding: 4px 0; }
.info-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}
.info-row p {
  flex: 1;
  font-size: 15px;
  color: var(--text-light);
  line-height: 1.8;
  margin: 0;
}
.info-tag {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  font-size: 13px;
  border-radius: 4px;
  padding: 3px 0;
  letter-spacing: 1px;
  margin-top: 2px;
}
.info-tag.source { background: rgba(74,144,96,.15); color: #4a9060; }
.info-tag.reveal { background: rgba(64,128,200,.15); color: #4080c8; }
.info-tag.impact { background: rgba(201,168,76,.15); color: var(--gold); }

/* ══════════════════════════════════════
   Picker 浮层
══════════════════════════════════════ */
.picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.picker-overlay.open { display: flex; }

.picker-mask {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.6);
  animation: maskIn .2s ease;
}

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

.picker-sheet {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: #161616;
  border-radius: 16px;
  overflow: hidden;
  animation: fadeScale .22s ease;
}

.picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-dark);
}

.picker-title   { font-size: 16px; font-weight: 600; color: var(--text-light); letter-spacing: 1px; }
.picker-cancel  { background: none; border: none; font-size: 16px; color: var(--text-dim); cursor: pointer; padding: 4px 8px; font-family: inherit; }
.picker-confirm { background: none; border: none; font-size: 16px; color: var(--gold); font-weight: 600; cursor: pointer; padding: 4px 8px; font-family: inherit; }

.picker-body {
  position: relative;
  height: calc(var(--picker-item-h) * var(--picker-visible));
  overflow: hidden;
}

.picker-columns   { display: flex; height: 100%; }
.picker-columns-1 .picker-column { flex: 1; }
.picker-column    { flex: 1; height: 100%; overflow: hidden; position: relative; }

.picker-col-inner {
  padding: calc(var(--picker-item-h) * 2) 0;
  will-change: transform;
  cursor: grab;
}

.picker-col-inner:active { cursor: grabbing; }

.picker-item {
  height: var(--picker-item-h);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-muted);
  transition: color .15s;
  user-select: none;
  white-space: nowrap;
  font-family: inherit;
}

.picker-item.selected {
  color: var(--text-light);
  font-weight: 600;
  font-size: 16px;
}

.picker-highlight {
  position: absolute;
  top: 50%;
  left: 8px;
  right: 8px;
  height: var(--picker-item-h);
  transform: translateY(-50%);
  background: rgba(201,168,76,.08);
  border: 1px solid rgba(201,168,76,.2);
  border-radius: 8px;
  pointer-events: none;
}

.picker-fade-top,
.picker-fade-bottom {
  position: absolute;
  left: 0;
  right: 0;
  height: calc(var(--picker-item-h) * 2);
  pointer-events: none;
  z-index: 2;
}

.picker-fade-top    { top: 0;    background: linear-gradient(to bottom, #161616 0%, transparent 100%); }
.picker-fade-bottom { bottom: 0; background: linear-gradient(to top,    #161616 0%, transparent 100%); }

/* ══════════════════════════════════════
   城市选择器
══════════════════════════════════════ */
.city-picker-body {
  display: flex;
  height: 280px;
  border-top: 1px solid var(--border-dark);
}

.city-col {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.city-col:first-child { border-right: 1px solid var(--border-dark); }
.city-col::-webkit-scrollbar { width: 0; }

.city-item {
  padding: 13px 16px;
  font-size: 15px;
  color: var(--text-dim);
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: inherit;
}

.city-item:active { background: rgba(201,168,76,.08); }

.city-item.selected {
  color: var(--gold);
  background: rgba(201,168,76,.08);
  font-weight: 600;
}

/* ══════════════════════════════════════
   响应式
══════════════════════════════════════ */
@media (max-width: 360px) {
  .home-title { font-size: 22px; }
  .gz-char    { font-size: 18px; }
  .paipan-table th, .paipan-table td { padding: 5px 2px; }
}

/* ── AI 解盘（Chat 界面）───────────────────────────────────────────────────── */

/* 返回来源 Tab 提示条 */
.back-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1a1a0e;
  border: 1px solid var(--gold-dim);
  border-radius: 8px;
  padding: 8px 12px;
  margin: 8px 12px 0;
  cursor: pointer;
  transition: background .15s;
}
.back-banner:hover { background: #222210; }
.back-banner-text {
  font-size: 14px;
  color: var(--gold);
  letter-spacing: 1px;
}
.back-banner-close {
  font-size: 14px;
  color: var(--text-dim);
  padding: 0 4px;
  cursor: pointer;
}
.back-banner-close:hover { color: var(--gold); }

.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
  padding: 16px;
  gap: 14px;
}


/* 快捷提问标签（内嵌对话流） */
.chat-shortcuts-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 0 12px 44px;
}

.shortcut-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--border-gold);
  border-radius: 12px;
  color: var(--gold-dim);
  font-size: 13px;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
  white-space: nowrap;
}
.shortcut-tag:hover {
  border-color: var(--gold);
  color: var(--gold-light);
  background: rgba(201,168,76,.08);
}

/* ── 光点消耗角标（仅 Lucimix 用户渲染，游客端不生成节点）── */
.cost-badge {
  display: inline-flex;
  align-items: center;
  align-self: center;
  gap: 2px;
  margin-left: 5px;
  padding-left: 5px;
  border-left: 1px solid var(--border-gold);
  color: var(--gold);
  font-size: 12px;
  line-height: 1;
  letter-spacing: 0;
}
.cost-badge .spark-icon {
  width: 10px;
  height: 10px;
  object-fit: contain;
  opacity: .85;
}
.shortcut-tag:hover .cost-badge,
.ai-ask-btn:hover .cost-badge,
.liuyue-ai-btn:hover .cost-badge,
.btn-dayun-ai:hover .cost-badge,
.btn-liunian-ai:hover .cost-badge {
  color: var(--gold-light);
  border-left-color: var(--gold-dim);
}
.shortcut-tag:hover .cost-badge .spark-icon,
.ai-ask-btn:hover .cost-badge .spark-icon,
.liuyue-ai-btn:hover .cost-badge .spark-icon,
.btn-dayun-ai:hover .cost-badge .spark-icon,
.btn-liunian-ai:hover .cost-badge .spark-icon { opacity: 1; }

/* 区块「问渊微」小按钮与流月按钮：字号本就 10px，角标收紧一档 */
.ai-ask-btn .cost-badge,
.liuyue-ai-btn .cost-badge {
  margin-left: 4px;
  padding-left: 4px;
  font-size: 11px;
}
.ai-ask-btn .cost-badge .spark-icon,
.liuyue-ai-btn .cost-badge .spark-icon {
  width: 9px;
  height: 9px;
}

/* 大运 / 流年整行按钮：角标跟在文字后，分隔线略长 */
.btn-dayun-ai .cost-badge,
.btn-liunian-ai .cost-badge {
  margin-left: 7px;
  padding-left: 7px;
  font-size: 13px;
}
.btn-dayun-ai .cost-badge .spark-icon,
.btn-liunian-ai .cost-badge .spark-icon {
  width: 11px;
  height: 11px;
}

/* AI 回复末尾的本次消耗 */
.ai-cost-footer {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border-gold);
  color: var(--text-dim);
  font-size: 12px;
  letter-spacing: .5px;
}
.ai-cost-footer .spark-icon {
  width: 10px;
  height: 10px;
  object-fit: contain;
  opacity: .7;
}

/* 输入框上方的每轮消耗提示 */
.chat-cost-hint {
  position: absolute;
  top: -16px;
  right: 4px;
  display: inline-flex;
  align-items: center;
}
.chat-cost-hint .cost-badge {
  margin-left: 0;
  padding-left: 0;
  border-left: none;
  opacity: .8;
}

/* 对话历史 */
.chat-history {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 4px;
}

.chat-message {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.chat-message-user {
  flex-direction: row-reverse;
}

.chat-avatar {
  font-size: 22px;
  flex-shrink: 0;
  line-height: 1;
}

/* 道人头像（圆形，带金边） */
.sage-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--gold-dim);
  flex-shrink: 0;
}
.sage-chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 角色切换器 */
.sage-switcher {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #111;
  border-bottom: 1px solid var(--border-gold);
}

.sage-card {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #2a2a2a;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: #161616;
}
.sage-card:hover { border-color: var(--gold-dim); }
.sage-card.active {
  border-color: var(--gold);
  background: #1f1a08;
}

.sage-avatar {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity .2s;
}
.sage-card.active .sage-avatar { opacity: 1; }

.sage-info { flex: 1; min-width: 0; }
.sage-name {
  font-size: 15px;
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 1px;
  transition: color .2s;
}
.sage-card.active .sage-name { color: var(--gold-light); }
.sage-desc {
  font-size: 12px;
  color: #828282;
  margin-top: 2px;
  letter-spacing: 0.5px;
}
.sage-card.active .sage-desc { color: var(--gold-dim); }

.sage-divider {
  font-size: 16px;
  color: #333;
  flex-shrink: 0;
}

.chat-bubble {
  background: var(--bg-card-dark);
  border: 1px solid var(--border-gold);
  border-radius: 12px;
  padding: 10px 14px;
  max-width: 82%;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-light);
  word-wrap: break-word;
}

.chat-message-user .chat-bubble {
  background: var(--gold-dim);
  border-color: var(--gold);
  color: #fff;
}

.chat-message-user.shortcut .chat-bubble {
  background: var(--gold);
  font-weight: 500;
  color: #0e0e0e;
}

.chat-bubble .ai-text {
  font-size: 15px;
  line-height: 1.8;
  white-space: pre-wrap;
  color: inherit;
}

.chat-bubble .ai-section-title {
  color: var(--gold-light);
  font-weight: 600;
}

/* loading 动画 */
.ai-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 15px;
  padding: 4px 0;
}
.ai-dot {
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--gold);
  border-radius: 50%;
  animation: aiPulse 1s ease-in-out infinite;
}
.ai-dot:nth-child(2) { animation-delay: 0.15s; }
.ai-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes aiPulse {
  0%, 100% { opacity: .3; transform: scale(.8); }
  50%       { opacity: 1;  transform: scale(1.2); }
}

.ai-error {
  color: #d94040;
  font-size: 15px;
}

/* 输入框 */
.chat-input-container {
  position: relative;          /* 光点提示角标的定位基准 */
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px;
  background: var(--bg-card-dark);
  border-radius: 8px;
  border: 1px solid var(--border-gold);
}

.chat-input {
  flex: 1;
  background: var(--bg-dark);
  border: 1px solid var(--border-gold);
  border-radius: 6px;
  color: var(--text-light);
  font-size: 16px;
  padding: 10px 12px;
  outline: none;
  resize: none;
  line-height: 1.5;
  min-height: 40px;
  max-height: 160px;
  overflow-y: auto;
}

.chat-input:focus {
  border-color: var(--gold-dim);
}

.chat-input::placeholder {
  color: var(--text-dim);
}

.chat-send-btn {
  background: var(--gold);
  border: none;
  border-radius: 6px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chat-send-btn:hover {
  background: var(--gold-light);
  transform: scale(1.05);
}

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

.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 排盘历史 AI 标记 */
.history-ai-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  background: #2a1f08;
  border: 1px solid var(--gold-dim);
  border-radius: 4px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 400;
  vertical-align: middle;
  letter-spacing: 0;
}

/* 区块 渊微解读 按钮 */
.ai-ask-btn {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  font-size: 12px;
  letter-spacing: 0.5px;
  color: var(--gold-dim);
  border: 1px solid var(--gold-dim);
  border-radius: 4px;
  padding: 2px 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
  font-weight: 400;
}
.ai-ask-btn:hover {
  color: var(--gold-light);
  border-color: var(--gold);
}

/* 专项解读区上方小标题 */
.ai-section-label {
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  letter-spacing: 2px;
  margin-bottom: 10px;
}

/* 流年卡片交互 */
.liunian-item {
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.liunian-item:hover { border-color: var(--gold-dim); background: #1c1a0e; }
.liunian-item.selected {
  border-color: var(--gold);
  background: #1e1a0e;
}
.liunian-item.selected .liunian-yr { color: var(--gold); }
.liunian-item.selected .liunian-gz { color: var(--gold-light); }

/* 流年解读按钮 */
.btn-liunian-ai {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 8px;
  padding: 7px;
  background: transparent;
  border: 1px solid var(--gold-dim);
  border-radius: 6px;
  color: var(--gold);
  font-size: 13px;
  font-family: inherit;
  letter-spacing: 1.5px;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.btn-liunian-ai:hover {
  background: rgba(201,168,76,.08);
  border-color: var(--gold);
}

/* 大运 渊微解读按钮 */
.btn-dayun-ai {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 12px;
  padding: 9px;
  background: transparent;
  border: 1px solid var(--gold-dim);
  border-radius: 6px;
  color: var(--gold);
  font-size: 14px;
  font-family: inherit;
  letter-spacing: 2px;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.btn-dayun-ai:hover {
  background: rgba(201,168,76,.08);
  border-color: var(--gold);
}

/* 流月表格 问渊微 */
.liuyue-ai-btn {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  color: var(--gold-dim);
  border: 1px solid var(--gold-dim);
  border-radius: 4px;
  padding: 2px 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.liuyue-ai-btn:hover {
  color: var(--gold);
  border-color: var(--gold);
}
