/* ========================================================
   八字合婚系统 - 传统中国风主题样式
   ======================================================== */

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

/* CSS 变量 */
:root {
  --bg-dark: #0e0505;
  --bg-card: rgba(255, 248, 235, 0.04);
  --bg-card-hover: rgba(255, 248, 235, 0.07);
  --gold: #c8a951;
  --gold-light: #e8cc80;
  --gold-dark: #9a7a2a;
  --red: #9b2335;
  --red-light: #c0392b;
  --text-primary: #f5e6c8;
  --text-secondary: #c8a87a;
  --text-muted: #8a6a4a;
  --border: rgba(200, 169, 81, 0.25);
  --border-hover: rgba(200, 169, 81, 0.5);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  --male-color: #4a90d9;
  --female-color: #d94a7a;
  --wuxing-mu: #4caf50;
  --wuxing-huo: #f44336;
  --wuxing-tu: #ff9800;
  --wuxing-jin: #9e9e9e;
  --wuxing-shui: #2196f3;
}

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

body {
  font-family: 'Noto Serif SC', 'Songti SC', '宋体', serif;
  background-color: var(--bg-dark);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(155, 35, 53, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(200, 169, 81, 0.06) 0%, transparent 60%);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

/* 滚动条 */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--gold-dark); border-radius: 3px; }

/* ========================================================
   头部
   ======================================================== */
.site-header {
  text-align: center;
  padding: 40px 20px 30px;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.site-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, rgba(155, 35, 53, 0.1) 0%, transparent 100%);
  pointer-events: none;
}

.logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 8px;
}

.logo-taiji {
  width: 60px;
  height: 60px;
  animation: rotate-slow 20s linear infinite;
}

@keyframes rotate-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.site-title {
  font-size: 2.8rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  background: linear-gradient(135deg, var(--gold-light), var(--gold), var(--gold-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
}

.site-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  letter-spacing: 0.2em;
  margin-top: 6px;
}

/* 装饰线 */
.deco-line {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  margin-top: 16px;
}
.deco-line::before,
.deco-line::after {
  content: '';
  flex: 1;
  max-width: 120px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dark), transparent);
}
.deco-line span {
  color: var(--gold);
  font-size: 1rem;
}

/* ========================================================
   主体容器
   ======================================================== */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ========================================================
   输入区域
   ======================================================== */
.input-section {
  padding: 40px 0;
}

.input-section-title {
  text-align: center;
  font-size: 1.2rem;
  color: var(--gold);
  letter-spacing: 0.2em;
  margin-bottom: 30px;
}
.input-section-title::before { content: '◈ '; }
.input-section-title::after  { content: ' ◈'; }

.input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 768px) {
  .input-grid { grid-template-columns: 1fr; }
  .site-title { font-size: 2rem; }
}

/* 输入卡片 */
.person-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  transition: border-color 0.3s;
}
.person-card:hover { border-color: var(--border-hover); }

.person-card.male-card { border-top: 3px solid var(--male-color); }
.person-card.female-card { border-top: 3px solid var(--female-color); }

.card-title {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.male-card .card-title { color: var(--male-color); }
.female-card .card-title { color: var(--female-color); }

.card-title .icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}
.male-card .icon { background: rgba(74, 144, 217, 0.2); }
.female-card .icon { background: rgba(217, 74, 122, 0.2); }

/* 表单组 */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 7px;
  letter-spacing: 0.05em;
}

.form-hint {
  font-size: 0.75rem;
  color: #7a5c3a;
  margin-top: 5px;
  opacity: 0.8;
}

.form-row {
  display: grid;
  gap: 10px;
}
.form-row-3 { grid-template-columns: repeat(3, 1fr); }
.form-row-2 { grid-template-columns: repeat(2, 1fr); }

/* 输入控件 */
input[type="text"],
select {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.92rem;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
input[type="text"]:focus,
select:focus {
  border-color: var(--gold);
  background: rgba(255, 255, 255, 0.08);
}
select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23c8a951' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

/* 城市搜索 */
.city-search-wrap {
  position: relative;
}
.city-search-input {
  width: 100%;
}
.city-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: #1a0a05;
  border: 1px solid var(--border);
  border-radius: 6px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: var(--shadow);
}
.city-dropdown.show { display: block; }
.city-dropdown-item {
  padding: 9px 14px;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text-secondary);
  transition: background 0.15s;
}
.city-dropdown-item:hover,
.city-dropdown-item.selected {
  background: rgba(200, 169, 81, 0.1);
  color: var(--text-primary);
}
.city-dropdown-item .province {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: 6px;
}

/* 提交按钮区域 */
.submit-wrap {
  text-align: center;
  margin-top: 32px;
}

.btn-submit {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--red), var(--red-light));
  border: 1px solid rgba(200, 169, 81, 0.4);
  border-radius: 8px;
  color: var(--text-primary);
  cursor: pointer;
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  padding: 14px 48px;
  transition: all 0.3s;
  box-shadow: 0 4px 20px rgba(155, 35, 53, 0.4);
}
.btn-submit:hover {
  background: linear-gradient(135deg, #b22d42, #e04535);
  box-shadow: 0 6px 28px rgba(155, 35, 53, 0.6);
  transform: translateY(-1px);
}
.btn-submit:active { transform: translateY(0); }
.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-icon { font-size: 1.2rem; }

/* 加载动画 */
.loading-wrap {
  display: none;
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
}
.loading-wrap.show { display: block; }

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(200, 169, 81, 0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========================================================
   结果区域
   ======================================================== */
.result-section {
  display: none;
  padding: 20px 0 60px;
  animation: fadeIn 0.5s ease;
}
.result-section.show { display: block; }

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

/* 区块标题 */
.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.1em;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.section-title::before {
  content: '';
  width: 4px;
  height: 20px;
  background: linear-gradient(180deg, var(--gold-light), var(--gold-dark));
  border-radius: 2px;
  flex-shrink: 0;
}

/* ========================================================
   八字排盘卡片
   ======================================================== */
.bazi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 30px;
}

@media (max-width: 640px) {
  .bazi-grid { grid-template-columns: 1fr; }
}

.bazi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}
.bazi-card.male { border-left: 3px solid var(--male-color); }
.bazi-card.female { border-left: 3px solid var(--female-color); }

.bazi-card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 18px;
  letter-spacing: 0.1em;
}
.male .bazi-card-title { color: var(--male-color); }
.female .bazi-card-title { color: var(--female-color); }

/* 四柱表格 */
.pillars-table {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.pillar-cell {
  text-align: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 6px;
}

.pillar-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.05em;
}

.pillar-gan {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}

.pillar-zhi {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 6px;
}

.pillar-shishen {
  font-size: 0.68rem;
  color: var(--text-muted);
  background: rgba(200, 169, 81, 0.1);
  border-radius: 3px;
  padding: 2px 4px;
  display: inline-block;
}

.pillar-nayin {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* 五行颜色 */
.wx-mu { color: var(--wuxing-mu); }
.wx-huo { color: var(--wuxing-huo); }
.wx-tu { color: var(--wuxing-tu); }
.wx-jin { color: var(--wuxing-jin); }
.wx-shui { color: var(--wuxing-shui); }

/* 命局信息 */
.life-info {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  font-size: 0.85rem;
}

.life-info-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
}

.life-info-label {
  color: var(--text-muted);
  flex-shrink: 0;
  font-size: 0.78rem;
}

.life-info-value {
  color: var(--text-primary);
  font-weight: 500;
}

/* 五行分布条 */
.wuxing-bars {
  margin-top: 14px;
}
.wuxing-bar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.wuxing-bar-name {
  width: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  flex-shrink: 0;
}
.wuxing-bar-track {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
}
.wuxing-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s ease;
}
.wuxing-bar-pct {
  width: 36px;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: right;
  flex-shrink: 0;
}

/* 大运 */
.dayun-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.dayun-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  text-align: center;
  font-size: 0.78rem;
}
.dayun-ganzhi {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}
.dayun-year {
  color: var(--text-muted);
  font-size: 0.7rem;
  margin-top: 3px;
}

/* ========================================================
   综合评分区域
   ======================================================== */
.score-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px;
  margin-bottom: 30px;
  text-align: center;
}

.score-main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.score-circle-wrap {
  position: relative;
  width: 160px;
  height: 160px;
}

.score-circle-wrap canvas { position: absolute; top: 0; left: 0; }

.score-center-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.score-number {
  font-size: 2.8rem;
  font-weight: 700;
  line-height: 1;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.score-unit {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.score-grade-info {
  text-align: left;
}

.score-grade {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 10px;
  letter-spacing: 0.1em;
}

.score-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.8;
  max-width: 340px;
}

.score-breakdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

@media (max-width: 500px) {
  .score-breakdown { grid-template-columns: 1fr; }
  .score-main { gap: 20px; }
}

.score-sub {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}
.score-sub-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.score-sub-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gold);
}
.score-sub-max {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ========================================================
   维度评分卡片
   ======================================================== */
.dimensions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 30px;
}

@media (max-width: 768px) {
  .dimensions-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .dimensions-grid { grid-template-columns: 1fr; }
}

.dim-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  transition: border-color 0.2s, transform 0.2s;
}
.dim-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.dim-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.dim-name {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.dim-score {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gold);
  white-space: nowrap;
}
.dim-score-max {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

.dim-bar-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}
.dim-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold));
  transition: width 1s ease;
}

.dim-detail {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ========================================================
   警告 & 建议
   ======================================================== */
.warnings-section {
  background: rgba(155, 35, 53, 0.1);
  border: 1px solid rgba(155, 35, 53, 0.3);
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 20px;
}

.warnings-title {
  color: #e07070;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
  letter-spacing: 0.05em;
}
.warning-item {
  color: #d08080;
  font-size: 0.88rem;
  line-height: 1.7;
  margin-bottom: 6px;
  display: flex;
  gap: 8px;
}
.warning-item::before { content: '⚠'; flex-shrink: 0; }

.suggestions-section {
  background: rgba(200, 169, 81, 0.05);
  border: 1px solid rgba(200, 169, 81, 0.2);
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 30px;
}

.suggestions-title {
  color: var(--gold);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
  letter-spacing: 0.05em;
}
.suggestion-item {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.7;
  margin-bottom: 8px;
  display: flex;
  gap: 8px;
}
.suggestion-item::before { content: '◆'; color: var(--gold-dark); flex-shrink: 0; }

/* ========================================================
   五行雷达图区域
   ======================================================== */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 30px;
}
@media (max-width: 640px) {
  .charts-row { grid-template-columns: 1fr; }
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}
.chart-card-title {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
  letter-spacing: 0.08em;
}
.chart-card canvas {
  max-width: 200px;
  margin: 0 auto;
  display: block;
}

/* ========================================================
   底部免责声明
   ======================================================== */
.site-footer {
  text-align: center;
  padding: 30px 20px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.8;
}
.site-footer a { color: var(--text-secondary); text-decoration: none; }

/* ========================================================
   工具类
   ======================================================== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }

/* 错误提示 */
.error-msg {
  background: rgba(155, 35, 53, 0.15);
  border: 1px solid rgba(155, 35, 53, 0.4);
  border-radius: 8px;
  color: #e07070;
  font-size: 0.9rem;
  padding: 14px 18px;
  margin-top: 16px;
  display: none;
}
.error-msg.show { display: block; }

/* 响应式：小手机 */
@media (max-width: 380px) {
  .site-title { font-size: 1.6rem; }
  .pillars-table { gap: 5px; }
  .pillar-gan, .pillar-zhi { font-size: 1.3rem; }
}
