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

:root {
  --bg:          #f5f0e8;
  --card-bg:     #ffffff;
  --ink:         #1a1a2e;
  --ink-mid:     #3a3a5a;
  --ink-light:   #7a7a9a;
  --gold:        #c9a84c;
  --gold-light:  #f0d080;
  --gold-pale:   #fdf5e0;
  --green:       #1a7a4a;
  --green-l:     #27ae60;
  --red:         #c0392b;
  --red-l:       #e74c3c;
  --border:      #e0d8c8;
  --shadow:      0 2px 12px rgba(26,26,46,.10);
  --shadow-md:   0 4px 20px rgba(26,26,46,.13);
  --radius:      14px;
  --radius-sm:   8px;
}

html, body {
  font-family: 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
body {
  background-image:
    radial-gradient(ellipse at 15% 15%, rgba(201,168,76,.06) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 85%, rgba(26,122,74,.04) 0%, transparent 50%);
}

/* ===== 动画 ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ===== 顶部标题栏 ===== */
.topbar {
  background: var(--card-bg);
  border-bottom: 2px solid var(--gold);
  padding: 13px 18px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow);
}
.topbar-inner { display:flex; align-items:center; gap:10px; max-width:900px; margin:0 auto; }
.topbar-icon  { font-size:24px; filter:drop-shadow(0 0 6px rgba(201,168,76,.5)); animation:spin-slow 20s linear infinite; }
.topbar-title {
  font-size:18px; font-weight:700; letter-spacing:3px;
  background: linear-gradient(90deg, var(--gold), var(--gold-light), var(--gold));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

/* ===== 主容器 ===== */
.flow-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  min-height: calc(100vh - 56px);
}

/* ===== 区块标题 ===== */
.section-title {
  font-size:13px; font-weight:600; color:var(--gold);
  margin-bottom:12px; display:flex; align-items:center; gap:7px; letter-spacing:1px;
}
.section-title::before {
  content:''; display:inline-block; width:4px; height:14px;
  background:var(--gold); border-radius:2px;
}

/* ===== 输入区 ===== */
.input-area { max-width: 480px; margin: 0 auto; padding-top: 20px; }

.input-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px;
  box-shadow: var(--shadow-md);
  animation: fadeInUp .4s ease;
}

.input-row { display:flex; gap:10px; margin-bottom:14px; }
.input-group { flex:1; display:flex; flex-direction:column; gap:6px; }
.input-group label { font-size:12px; color:var(--ink-light); letter-spacing:1px; }
.input-group input {
  width:100%; padding:11px; text-align:center;
  background: #faf7f0; border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--ink); font-size:16px; outline:none;
  transition: border-color .2s, box-shadow .2s; -webkit-appearance:none;
}
.input-group input:focus { border-color:var(--gold); box-shadow:0 0 0 3px rgba(201,168,76,.15); }
.input-group input::placeholder { color: var(--ink-light); font-size:12px; }
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance:none; margin:0; }
input[type=number] { -moz-appearance:textfield; }

.btn-calc {
  width:100%; padding:13px;
  background: linear-gradient(135deg, #b8902e, var(--gold), var(--gold-light));
  border:none; border-radius: var(--radius-sm); color:#1a0f00; font-size:17px; font-weight:700;
  letter-spacing:4px; cursor:pointer; transition:transform .1s, box-shadow .2s;
  box-shadow:0 4px 14px rgba(201,168,76,.30);
}
.btn-calc:active { transform:scale(.97); box-shadow:0 2px 8px rgba(201,168,76,.2); }

/* ==========================================
   流程图区域
   ========================================== */
.flowchart {
  animation: fadeIn .5s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

/* --- 顶部：出生属相框 --- */
.branch-root {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 0;
  animation: fadeInUp .4s ease;
}
.root-card {
  background: linear-gradient(145deg, #fffdf5, #fdf5e0);
  border: 2px solid var(--gold);
  border-radius: 16px;
  padding: 16px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  box-shadow: 0 6px 24px rgba(201,168,76,.25), 0 2px 8px rgba(0,0,0,.06);
  min-width: 140px;
}
.root-emoji { font-size: 48px; line-height: 1; }
.root-name  { font-size: 22px; font-weight: 800; color: var(--ink); }
.root-date  { font-size: 12px; color: var(--ink-light); margin-top: 2px; }
.root-label { font-size: 11px; color: var(--gold); letter-spacing: 2px; margin-top: 4px; font-weight: 600; }

/* --- 中间分叉线（SVG精准画线） --- */
.branch-split {
  width: 100%;
  height: 44px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

/* --- 下方两列 --- */
.branch-body {
  display: flex;
  gap: 0;
  width: 100%;
  align-items: flex-start;
}

.branch-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* --- 底部重新查询 --- */
.flow-footer {
  margin-top: 28px;
  animation: fadeInUp .4s ease;
}
.btn-reset {
  padding: 9px 28px;
  background: transparent;
  border: 1.5px solid var(--gold);
  border-radius: 30px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 2px;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.btn-reset:hover { background: var(--gold); color: #fff; }

/* ==========================================
   属相卡片（参考图样式）
   ========================================== */

/* 卡片整体 */
.zodiac-card {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 14px 14px 12px;
  box-shadow: var(--shadow);
  animation: fadeInUp .35s ease both;
  margin: 0 6px;
}

/* 卡片头部：属相+关系 */
.zc-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f0ebe0;
}

.zc-emoji-wrap {
  width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; border: 2px solid;
}
.zc-emoji-wrap.he    { background: rgba(26,122,74,.10); border-color: rgba(39,174,96,.50); }
.zc-emoji-wrap.chong { background: rgba(192,57,43,.10);  border-color: rgba(231,76,60,.50); }

.zc-info { flex: 1; min-width: 0; }
.zc-name { font-size: 18px; font-weight: 800; color: var(--ink); line-height: 1.2; }
.zc-tag  {
  display: inline-block; font-size: 10px; font-weight: 600;
  padding: 1px 8px; border-radius: 10px; border: 1px solid;
  letter-spacing: 1px; margin-top: 3px; width: fit-content;
}
.tag-he    { color: var(--green-l);  background: rgba(39,174,96,.10); border-color: rgba(39,174,96,.35); }
.tag-chong { color: var(--red-l);    background: rgba(231,76,60,.10);  border-color: rgba(231,76,60,.35); }

/* 年份网格：两列 */
.zc-years {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

/* 单个年份条目 */
.zc-year-item {
  background: #faf7f2;
  border: 1px solid #ede8dc;
  border-radius: 8px;
  padding: 8px 6px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  position: relative;
  transition: transform .1s, box-shadow .1s;
}
.zc-year-item:hover { transform: translateY(-1px); box-shadow: var(--shadow); }

.zcy-year-num  { font-size: 18px; font-weight: 800; color: var(--ink); line-height: 1; letter-spacing: 1px; }
.zcy-year-label { font-size: 11px; color: var(--ink-light); margin-top: 1px; }
.zcy-age-hint   { color: #c9a84c; font-weight: 600; }

/* ==========================================
   说明区
   ========================================== */
.legend-area { max-width: 900px; margin: 0 auto; padding: 0 16px 40px; }

.legend-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  animation: fadeInUp .4s ease;
}
.legend-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.legend-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #faf7f2;
  border: 1px solid #ede8dc;
  border-radius: 10px;
  padding: 10px 12px;
}
.leg-tag {
  flex-shrink: 0; font-size: 12px; font-weight: 700;
  padding: 2px 8px; border-radius: 8px; border: 1px solid;
  letter-spacing: 1px; margin-top: 1px;
}
.leg-desc { font-size: 12px; color: var(--ink-light); line-height: 1.6; }

/* ===== 页脚 ===== */
.footer { text-align:center; padding: 18px; font-size:12px; color: var(--ink-light); letter-spacing:1px; }

/* ==========================================
   手机端适配
   ========================================== */

/* 窄屏（< 520px）：左右列仍保持，但减少padding */
@media (max-width: 520px) {
  .zc-emoji-wrap { width: 42px; height: 42px; font-size: 22px; }
  .zc-name       { font-size: 16px; }
  .zcy-age       { font-size: 15px; }
  .zodiac-card   { padding: 12px 10px 10px; margin: 0 4px; }
  .root-card     { padding: 14px 20px; }
  .root-emoji    { font-size: 40px; }
}

/* 超窄屏（< 360px） */
@media (max-width: 360px) {
  .zc-emoji-wrap { width: 36px; height: 36px; font-size: 18px; }
  .zcy-age       { font-size: 14px; }
  .flow-container { padding: 16px 8px 30px; }
}

/* 桌面端：左右列之间加间距 */
@media (min-width: 600px) {
  .zodiac-card { margin: 0 8px; }
  .legend-grid { grid-template-columns: 1fr 1fr 1fr; }
  .branch-col  { gap: 12px; }
}
