/* =======================================================================
   太平八字 — 全站样式表
   现代简约风，移动优先，全面适配微信内置浏览器 / iOS / Android
   ======================================================================= */

/* ===== CSS 变量 ===== */
:root {
  --bg: #f7f8fa;
  --panel: #ffffff;
  --ink: #111111;
  --text: #333333;
  --muted: #888888;
  --line: #eaeaea;
  --accent: #4a7cf7;
  --radius: 12px;
  /* 安全区域（刘海屏/底部 Home Bar）*/
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display",
               "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
               "Noto Sans CJK SC", sans-serif;
}

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

html {
  /* 防止 iOS Safari 横屏时字体自动放大 */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* 微信内置浏览器滚动惯性 */
  -webkit-overflow-scrolling: touch;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

/* 所有可交互元素去掉微信/iOS 点击高亮蓝框 */
button, a, input, select, label {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}
button, input, select { font: inherit; }
button { cursor: pointer; }

/* ===== 全局触摸目标最小尺寸（WCAG 2.5.5） ===== */
button, a, select {
  min-height: 44px;
}

/* ===== 布局容器 ===== */
.app-shell, .result-shell, .admin-shell {
  width: min(1100px, 100%);
  /* 横向 padding 使用 safe-area，适配 iPhone X+ 刘海 */
  padding: 48px max(24px, var(--safe-left)) 80px max(24px, var(--safe-right));
  margin: 0 auto;
}

/* ===== 首页单列布局（iOS 风格） ===== */
.input-container {
  width: min(440px, 100%);
  margin: 0 auto;
  padding: 40px 0 60px;
}

/* 品牌区 */
.brand-area {
  text-align: center;
  margin-bottom: 32px;
}
.brand-logo {
  display: block;
  margin: 0 auto 16px;
  width: 80px;
  height: auto;
  animation: taiji-spin 8s linear infinite;
}
@keyframes taiji-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.brand-area h1 {
  font-size: 28px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}
.brand-area p {
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
  max-width: 320px;
  margin: 0 auto;
}

/* 表单容器 */
.form-list-wrap { display: grid; gap: 0; }

/* 表单行列表 */
.form-list {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
}

/* 表单行 */
.form-row {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 0 16px;
  gap: 12px;
}
.form-row + .form-row { border-top: 1px solid var(--line); }
.form-label {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  flex-shrink: 0;
  min-width: 64px;
}

/* 表单行内的输入框 */
.form-row input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]) {
  flex: 1;
  height: 36px;
  border: none;
  border-radius: 0;
  background: transparent;
  text-align: right;
  font-size: 15px;
  color: var(--ink);
  padding: 0;
  outline: none;
  box-shadow: none;
}
.form-row input::placeholder { color: #ccc; }
.form-row input:-webkit-autofill,
.form-row input:-webkit-autofill:hover,
.form-row input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--panel) inset !important;
  -webkit-text-fill-color: var(--ink) !important;
  transition: background-color 9999s ease-in-out 0s;
}

/* 性别切换 */
.gender-toggle {
  display: flex;
  gap: 0;
  margin-left: auto;
  background: var(--bg);
  border-radius: 8px;
  padding: 3px;
}
.gender-option {
  min-height: initial;
  height: 34px;
  padding: 0 18px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}
.gender-option.active {
  background: var(--panel);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* 可点击选择器行 */
.picker-row {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}
.picker-row:active { background: var(--bg); }
.picker-value {
  margin-left: auto;
  font-size: 15px;
  color: #ccc;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60%;
}
.picker-value.filled { color: var(--ink); }
.picker-arrow {
  color: #ccc;
  font-size: 20px;
  font-weight: 300;
  line-height: 1;
  flex-shrink: 0;
}

/* 全宽提交按钮 */
.btn-full {
  width: 100%;
  height: 50px;
  font-size: 16px;
  border-radius: 10px;
}

/* ===== 底部弹窗（Picker Modal） ===== */
.picker-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.picker-modal[hidden] { display: none; }

.picker-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.35);
}

.picker-sheet {
  position: relative;
  background: var(--panel);
  border-radius: 16px 16px 0 0;
  padding: 0 0 calc(16px + var(--safe-bottom));
  animation: slideUp 0.25s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.picker-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}
.picker-cancel {
  font-size: 15px;
  color: var(--muted);
  border: none;
  background: none;
  padding: 4px 8px;
  min-height: initial;
  cursor: pointer;
}
.picker-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}
.picker-confirm {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  border: none;
  background: none;
  padding: 4px 8px;
  min-height: initial;
  cursor: pointer;
}

/* 历法切换 tab — 在 header 内居中 */
.picker-sheet-header .calendar-tabs {
  display: flex;
  gap: 0;
  background: var(--bg);
  border-radius: 8px;
  padding: 3px;
  flex-shrink: 0;
}
.cal-tab {
  min-height: initial;
  height: 32px;
  padding: 0 14px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.cal-tab.active {
  background: var(--panel);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* === 滚轮选择器 === */

/* 摘要栏 */
.picker-summary {
  text-align: center;
  padding: 14px 16px 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}
.picker-summary .highlight {
  color: var(--ink);
  font-weight: 600;
}

/* 滚轮容器 */
.picker-wheel {
  display: flex;
  justify-content: center;
  gap: 2px;
  padding: 0 8px;
  height: 220px;
  position: relative;
  overflow: hidden;
}

/* 中间高亮条 + 上下渐变遮罩 */
.picker-wheel::before {
  content: '';
  position: absolute;
  z-index: 2;
  left: 8px; right: 8px;
  top: 50%;
  transform: translateY(-50%);
  height: 40px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  pointer-events: none;
}
.picker-wheel::after {
  content: '';
  position: absolute;
  z-index: 1;
  inset: 0;
  background: linear-gradient(to bottom,
    var(--panel) 0%,
    transparent 30%,
    transparent 70%,
    var(--panel) 100%
  );
  pointer-events: none;
}

/* 单列 */
.wheel-col {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: y mandatory;
  position: relative;
  z-index: 0;
  scrollbar-width: none;
}
.wheel-col::-webkit-scrollbar { display: none; }

.wheel-scroll {
  padding: 90px 0;
}

/* 每项 */
.wheel-item {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  color: #c0c0c0;
  transition: color 0.2s, font-weight 0.2s;
  scroll-snap-align: center;
  user-select: none;
}
.wheel-item.selected {
  color: var(--ink);
  font-weight: 700;
  font-size: 20px;
}

/* 闰月栏 */
#leapBar {
  padding: 0 16px 12px;
}
#leapBar:not([hidden]) {
  display: block;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  min-height: 44px;
}
.check-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  cursor: pointer;
}

/* 红色确认按钮（出生地弹窗）——已改回默认色 */
.btn-confirm-red {
  color: var(--accent) !important;
}

/* ===== 出生地双列选择器 ===== */
.region-picker {
  display: flex;
  height: 280px;
  border-top: 1px solid var(--line);
  overflow: hidden;
}

.region-col {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.region-col::-webkit-scrollbar { display: none; }
.region-col + .region-col { border-left: 1px solid var(--line); }

.region-col-scroll {
  padding: 6px 0;
}

.region-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  padding: 0 16px;
  font-size: 15px;
  color: var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: background 0.12s;
}
.region-item:active { background: var(--bg); }
.region-item.selected {
  color: var(--ink);
  font-weight: 600;
}

/* 地点弹窗内的输入（保留兼容） */
.picker-body { padding: 16px; }
.picker-input {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  font-size: 16px;
  color: var(--ink);
  background: var(--panel);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
}
.picker-input:focus { border-color: var(--accent); }
.picker-input::placeholder { color: #ccc; }

/* ===== 通用卡片 ===== */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}

/* ===== 表单卡片 ===== */
.input-card { padding: 32px; }

.section-title p {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.section-title h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.01em;
}
h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 14px;
}

/* ===== 表单 ===== */
.form-stack { display: grid; gap: 20px; }
.form-section {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
}
.form-section h3 { margin-top: 0; }

.field-grid {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}
.two-col { grid-template-columns: 1fr 1fr; }
.birth-grid { grid-template-columns: repeat(4, 1fr); }

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
}
label b { color: #e74c3c; }

input, select {
  width: 100%;
  /* 移动端至少 44px，防止 iOS 上看起来太小 */
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  font-size: 16px; /* iOS 14px 以下会触发自动缩放，必须 ≥ 16px */
  color: var(--ink);
  background: var(--panel);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  /* 禁止 iOS 自带外观 */
  -webkit-appearance: none;
  appearance: none;
}
input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74, 124, 247, 0.12);
}
/* 数字输入框禁止微信/iOS 出现加减号 */
input[type="number"] {
  -moz-appearance: textfield;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  min-height: 44px;
}
.check-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  cursor: pointer;
}

.section-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px;
}
.section-line span, .muted {
  font-size: 12px;
  color: var(--muted);
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 8px;
}
.form-actions p { font-size: 12px; color: var(--muted); margin: 0; }

/* ===== 按钮 ===== */
.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 28px;
  border: none;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: opacity 0.2s;
  /* 微信内置浏览器长按不弹菜单 */
  -webkit-user-select: none;
  user-select: none;
  white-space: nowrap;
}
.primary-btn:hover, .primary-btn:active { opacity: 0.82; }

.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  transition: border-color 0.2s;
}
.ghost-btn:hover { border-color: var(--muted); }

/* ===== 进度页 ===== */
.progress-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh; /* 动态视口高度，避免移动端地址栏遮挡 */
  padding: 12px max(16px, var(--safe-left)) calc(24px + var(--safe-bottom));
}
.progress-card {
  width: min(480px, 100%);
  text-align: center;
  padding: 48px 24px;
}
.bazi-ring-wrap {
  position: relative;
  width: 240px;
  height: 240px;
  margin: 28px auto 0;
}
.bazi-ring {
  position: absolute;
  top: 0; left: 0;
  width: 240px; height: 240px;
}
.progress-symbol-wrap {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 32px; height: 32px;
  pointer-events: none;
}
.progress-symbol {
  display: block;
  width: 32px;
  height: auto;
  animation: taiji-spin 4s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress-card .eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
.progress-card h1 {
  font-size: 26px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 12px;
}
.progress-subtitle {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 28px;
  line-height: 1.6;
}
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 20px;
  font-size: 12px;
  color: var(--muted);
}
.step {
  padding: 10px 8px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  line-height: 1.4;
}
.step.active {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}
.progress-track {
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
  margin-bottom: 16px;
}
#progressBar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.3s ease;
}
#progressText { font-size: 13px; color: var(--muted); }

/* ===== 结果页 ===== */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.page-head h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.01em;
  word-break: keep-all;
  overflow-wrap: break-word;
}
.page-head-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.head-taiji {
  width: 32px; height: 32px;
  object-fit: contain;
  animation: taiji-spin 8s linear infinite;
}

.report-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.basic-card { grid-column: 1 / -1; }
.pillars-card { grid-column: 1 / -1; }
.cta-card { grid-column: 1 / -1; }
.guide-card, .favor-card { grid-column: span 1; }

.card-title { margin-bottom: 16px; }
.card-title p {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.card-title h2 {
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.01em;
}

/* ===== 基础信息列表 ===== */
.info-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.info-list div {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg);
}
.info-list span, .favor-grid span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 3px;
}
.info-list strong, .favor-grid strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  word-break: break-all;
}

/* ===== 四柱表格式布局 ===== */
.pillars-grid {
  display: grid;
  grid-template-columns: 56px repeat(4, 1fr);
  gap: 0;
  background: var(--bg);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
}


/* 行容器 */
.pt-row {
  display: contents;
}

/* 行标签 */
.pt-label {
  grid-column: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--muted);
  background: var(--bg);
  padding: 4px 6px;
  border-right: 1px solid var(--line);
}

/* 列头 */
.pt-hdr {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.pt-hdr:not(:last-child) { border-right: 1px solid var(--line); }

/* 日期行 */
.pt-date {
  text-align: center;
  font-size: 12px;
  color: var(--text);
  padding: 6px 4px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.pt-date:not(:last-child) { border-right: 1px solid var(--line); }

/* 十神行 */
.pt-shishen {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  padding: 5px 4px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.pt-shishen:not(:last-child) { border-right: 1px solid var(--line); }

/* 天干大字 */
.pt-gan {
  text-align: center;
  font-size: 30px;
  font-weight: 800;
  line-height: 1.3;
  padding: 6px 4px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.pt-gan:not(:last-child) { border-right: 1px solid var(--line); }

/* 地支中字 */
.pt-zhi {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  padding: 4px 4px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.pt-zhi:not(:last-child) { border-right: 1px solid var(--line); }

/* 藏干行 */
.pt-hide {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 4px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
.pt-hide:not(:last-child) { border-right: 1px solid var(--line); }
.pt-hide span small {
  font-size: 9px;
  font-weight: 400;
  margin-left: 1px;
}

/* 底部信息行 */
.pt-foot {
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  padding: 6px 4px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.pt-foot:not(:last-child) { border-right: 1px solid var(--line); }

/* 最后一行无底部边框 */
.pt-row:last-child .pt-label,
.pt-row:last-child .pt-foot {
  border-bottom: none;
}

/* ===== 旧四柱卡片样式保留（如有其他地方使用） ===== */
.pillar-card {
  background: var(--bg);
  border-radius: 10px;
  padding: 14px 12px;
  text-align: center;
  border: 1px solid var(--line);
}
.pillar-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 8px;
}
.pillar-gan {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 4px;
}
.pillar-zhi {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 10px;
  color: var(--text);
}
.pillar-detail {
  text-align: left;
  display: grid;
  gap: 5px;
}
/* pd-row 是 pillar detail row 的简写（JS 渲染） */
.pd-row {
  font-size: 11px;
  line-height: 1.4;
}
.pd-row span {
  color: var(--muted);
  font-size: 10px;
  display: block;
  margin-bottom: 1px;
}
.pd-row strong {
  color: var(--text);
  font-weight: 600;
  font-size: 11px;
  display: block;
  word-break: break-all;
}
/* 兼容旧渲染方式的嵌套 div */
.pillar-detail div { font-size: 11px; line-height: 1.5; }
.pillar-detail > div > span {
  color: var(--muted);
  font-size: 10px;
  display: block;
  margin-bottom: 1px;
}
.pillar-detail > div > strong {
  color: var(--text);
  font-weight: 600;
  font-size: 11px;
}

/* ===== 起运信息 ===== */
.info-list.compact { grid-template-columns: repeat(2, 1fr); }

/* ===== 十神占比条 ===== */
.bar-chart { display: grid; gap: 10px; }
.bar-row {
  display: grid;
  grid-template-columns: 56px 1fr 36px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text);
}
.bar-row div {
  height: 8px;
  border-radius: 4px;
  background: var(--line);
  overflow: hidden;
}
.bar-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}
.bar-row b { font-weight: 700; color: var(--ink); text-align: right; }

/* ===== 日柱指引 ===== */
.guide { display: grid; gap: 10px; }
.guide-row {
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--bg);
}
.guide-row span {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
}
.guide-row p {
  font-size: 13px;
  line-height: 1.65;
  color: var(--text);
  margin: 0;
  word-break: break-all;
  overflow-wrap: break-word;
}

/* ===== 喜忌神 ===== */
.favor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.favor-grid div {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg);
}
.favor-grid span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 3px;
}
.favor-grid strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  word-break: break-all;
  overflow-wrap: break-word;
}

/* ===== 五行补运 网店引流 ===== */
.shop-card { grid-column: span 1; }
.shop-card .card-title h2 { color: var(--ink); }
.shop-intro {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 16px;
}
.shop-intro .shop-hl {
  color: var(--ink);
  font-weight: 600;
}
.shop-list {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}
.shop-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--ghost);
  border-radius: 10px;
}
.shop-tag {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
}
.shop-body strong {
  display: block;
  font-size: 14px;
  color: var(--ink);
  font-weight: 700;
  margin-bottom: 4px;
}
.shop-body p {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}
.shop-btn {
  width: 100%;
  text-align: center;
  font-weight: 700;
  background: #f6c343;
  color: var(--ink);
  border: none;
}
.shop-btn:hover, .shop-btn:active {
  opacity: 0.85;
  background: #f6c343;
}

/* ===== 八字解读 引流卡片 ===== */
.bazi-read-card { grid-column: span 1; }
.bazi-read-intro {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 16px;
}
.bazi-read-grid {
  display: grid;
  gap: 8px;
}
.bazi-read-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: var(--ghost);
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background 0.2s, border-color 0.2s;
}
.bazi-read-item:hover, .bazi-read-item:active {
  background: var(--panel);
  border-color: var(--border);
}
.bazi-read-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  font-size: 22px;
  display: grid;
  place-items: center;
  background: var(--panel);
  border-radius: 10px;
}
.bazi-read-body {
  flex: 1;
  min-width: 0;
}
.bazi-read-body strong {
  display: block;
  font-size: 14px;
  color: var(--ink);
  font-weight: 700;
  margin-bottom: 3px;
}
.bazi-read-body p {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bazi-read-arrow {
  flex-shrink: 0;
  font-size: 16px;
  color: var(--muted);
  font-weight: 300;
}

/* ===== CTA 卡片 ===== */
.cta-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 28px;
  background: var(--ink);
  color: #fff;
  border: none;
  /* 底部 padding 适配 iPhone Home Bar */
  padding-bottom: calc(24px + var(--safe-bottom));
}
.cta-card .eyebrow { color: rgba(255,255,255,0.5); }
.cta-card h2 { color: #fff; font-size: 18px; margin: 6px 0; }
.cta-card p:not(.eyebrow) { color: rgba(255,255,255,0.6); font-size: 13px; margin: 0; }
.cta-card .primary-btn {
  background: #fff;
  color: var(--ink);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ===== 模态框（微信内置浏览器兼容） ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  padding: 24px max(16px, var(--safe-left));
  background: rgba(0,0,0,0.45);
  /* 微信 WebView 中 position:fixed 在滚动时抖动，加 -webkit-overflow-scrolling:auto 修复 */
  -webkit-overflow-scrolling: auto;
}
.modal[hidden] { display: none; }
.modal-panel {
  width: min(400px, 100%);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  position: relative;
  /* 确保不被底部安全区遮住 */
  margin-bottom: var(--safe-bottom);
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--bg);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qr-image {
  width: 200px;
  height: 200px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--line);
  margin: 16px auto;
  display: block;
}
.qr-placeholder {
  width: 200px;
  height: 200px;
  border-radius: 8px;
  border: 2px dashed var(--line);
  display: grid;
  place-items: center;
  margin: 16px auto;
  font-size: 12px;
  color: var(--muted);
}
.modal-panel p { font-size: 12px; color: var(--muted); margin: 0; }

/* ===== 后台管理 ===== */
body.page-admin {
  min-height: 100vh;
  min-height: 100dvh;
}
.admin-login {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px;
}
.admin-login .login-card {
  width: min(400px, 100%);
}
.login-card {
  width: min(400px, 100%);
  padding: 32px;
}
.login-card .eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
  text-align: center;
}
.login-card h1 { font-size: 24px; font-weight: 800; color: var(--ink); margin-bottom: 24px; text-align: center; }
.alert {
  padding: 10px 14px;
  border-radius: 8px;
  background: #fef2f2;
  color: #dc2626;
  font-size: 13px;
  margin-bottom: 16px;
}
.login-card label { margin-bottom: 16px; display: grid; }
.login-card .primary-btn { width: 100%; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.metric {
  padding: 16px 18px;
  border-radius: var(--radius);
}
.metric span { font-size: 12px; color: var(--muted); }
.metric strong {
  display: block;
  font-size: 28px;
  font-weight: 800;
  color: var(--ink);
  margin-top: 6px;
  line-height: 1;
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  -webkit-overflow-scrolling: touch; /* 微信内置浏览器横滑 */
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 600px;
}
.admin-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  white-space: nowrap;
}
.admin-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
}
.admin-table tr:last-child td { border-bottom: none; }

/* ===== 经典依据库 ===== */
.source-list { display: grid; gap: 10px; }
.source-list a {
  display: block;
  padding: 16px 18px;
  border-radius: 10px;
  border: 1px solid var(--line);
  transition: border-color 0.2s;
  min-height: 48px;
}
.source-list a:hover { border-color: var(--accent); }
.source-list strong { display: block; font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.source-list span { font-size: 13px; color: var(--muted); line-height: 1.6; }

/* ===== 动画 ===== */
.fade-up { animation: fadeUp 0.4s ease both; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-up:nth-child(2) { animation-delay: 0.06s; }
.fade-up:nth-child(3) { animation-delay: 0.12s; }
.fade-up:nth-child(4) { animation-delay: 0.18s; }
/* 尊重用户减动画偏好 */
@media (prefers-reduced-motion: reduce) {
  .fade-up { animation: none; }
}

/* =====================================================
   响应式断点
   - 860px：平板 / 大屏手机横屏
   - 600px：手机竖屏
   - 390px：iPhone SE / 小屏安卓
   ===================================================== */

/* 860px 以下：平板及手机 */
@media (max-width: 860px) {
  .app-shell, .result-shell, .admin-shell {
    padding: 20px 16px calc(40px + var(--safe-bottom));
    padding-left: max(16px, var(--safe-left));
    padding-right: max(16px, var(--safe-right));
  }
  /* 首页 */
  .input-container { padding: 16px 0 40px; }
  .brand-area h1 { font-size: 24px; }
  /* 结果页：单列 */
  .report-grid { grid-template-columns: 1fr; gap: 12px; }
  .basic-card, .pillars-card, .cta-card,
  .guide-card, .favor-card, .shop-card, .bazi-read-card { grid-column: 1; }
  /* 后台指标：2 列 */
  .metric-grid { grid-template-columns: 1fr 1fr; }
  /* info-list 单列 */
  .info-list, .favor-grid { grid-template-columns: 1fr 1fr; }
  .info-list.compact { grid-template-columns: 1fr 1fr; }
  /* 出生时间：2 列 */
  .birth-grid { grid-template-columns: 1fr 1fr; }
  /* CTA 纵向 */
  .cta-card {
    flex-direction: column;
    text-align: center;
    align-items: center;
    padding-bottom: calc(24px + var(--safe-bottom));
  }
  .cta-card .primary-btn { width: 100%; }
  /* 四柱表：缩小标签列 */
  .pillars-grid { grid-template-columns: 40px repeat(4, 1fr); }
  .pt-gan { font-size: 24px; }
  .pt-zhi { font-size: 18px; }
  .pt-hide { font-size: 10px; }
  .pt-foot { font-size: 10px; }
  /* 进度步骤：单行 */
  .page-head h1 { font-size: 22px; }
}

/* 600px 以下：手机竖屏 */
@media (max-width: 600px) {
  .input-container { padding: 8px 0 32px; }
  .brand-area { margin-bottom: 24px; }
  .brand-area h1 { font-size: 22px; }
  .brand-area p { font-size: 13px; max-width: 280px; }
  .form-list { border-radius: 10px; }
  .form-row { padding: 0 14px; min-height: 48px; }
  .form-label { font-size: 14px; }
  .steps { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .card { padding: 16px; }
  .page-head h1 { font-size: 20px; }
  .btn-full { height: 48px; font-size: 15px; }
  /* 四柱表：手机尺寸 */
  .pillars-grid { grid-template-columns: 36px repeat(4, 1fr); }
  .pt-gan { font-size: 20px; }
  .pt-zhi { font-size: 15px; }
  .pt-hide { font-size: 9px; gap: 3px; }
  .pt-hide span small { font-size: 7px; }
  .pt-foot { font-size: 9px; }
  .pt-hdr { font-size: 11px; }
  .pt-date { font-size: 10px; }
  .pt-shishen { font-size: 10px; }
  .pt-label { font-size: 9px; padding: 3px 4px; }
  /* 基础信息：2 列 */
  .info-list { grid-template-columns: 1fr 1fr; }
  .info-list.compact { grid-template-columns: 1fr 1fr; }
}

/* 390px 以下：小屏手机（iPhone SE、低端安卓）*/
@media (max-width: 390px) {
  .input-container { padding: 4px 0 24px; }
  .brand-area h1 { font-size: 20px; }
  .pillars-grid { grid-template-columns: 30px repeat(4, 1fr); }
  .info-list, .favor-grid { grid-template-columns: 1fr; }
  .info-list.compact { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; gap: 6px; }
}
