/* ==========================================================
   五运六气五行体质免费评测 · 移动端样式
   适配：微信 / 小程序 WebView / iOS 安全区
   ========================================================== */

:root {
  --brown: #6b4f2a;
  --gold: #b08a4f;
  --gold-light: #d9c7a8;
  --cream: #fdfaf4;
  --cream-2: #f6efe1;
  --ink: #332f28;
  --ink-2: #7c7062;
  --green: #6fae5a;
  --red: #d4634f;
  --yellow: #c9a24a;
  --metal: #9aa0a6;
  --blue: #4a7fb5;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(107, 79, 42, 0.08);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: #f4efe6;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  min-height: 100vh;
}

/* ---------------- 顶部 ---------------- */
.hero {
  background: linear-gradient(160deg, #7a5c33 0%, #5e4526 60%, #4c3720 100%);
  color: #fff;
  padding: calc(22px + env(safe-area-inset-top)) 20px 26px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  right: -40px; top: -40px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
}
.hero-brand {
  font-size: 12px;
  letter-spacing: 2px;
  color: #e3d3b6;
  margin-bottom: 14px;
}
.hero-title {
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 12px;
  line-height: 1.4;
  letter-spacing: 1px;
}
.hero-title span { color: #f0d9a8; }
.hero-sub {
  font-size: 13px;
  color: #ddd0ba;
  margin: 0 0 16px;
  line-height: 1.75;
}
.hero-badges { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.badge {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #f2e6cf;
  font-size: 12px;
  padding: 3px 12px;
  border-radius: 20px;
}

/* ---------------- 卡片 ---------------- */
.card {
  background: #fff;
  margin: 12px;
  padding: 18px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--brown);
  margin-bottom: 7px;
}
.req { color: #c0483a; margin-left: 3px; }
.field input, .field select {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #e3d9c6;
  border-radius: 8px;
  background: #fdfbf7;
  font-size: 15px;
  color: var(--ink);
  appearance: none;
  -webkit-appearance: none;
}
.field select {
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23b08a4f' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 34px;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--gold);
  background: #fff;
}
.hint { font-size: 12px; color: #a1958434; color: #a19584; margin: 6px 0 0; }

.agree {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-2);
  margin: 4px 0 16px;
  line-height: 1.6;
}
.agree input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--brown); flex: none; }
.agree a { color: var(--brown); text-decoration: underline; }

.btn-primary {
  display: block;
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 24px;
  background: linear-gradient(135deg, #7a5c33, #5e4526);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 1px;
  box-shadow: 0 4px 14px rgba(94, 69, 38, 0.28);
  cursor: pointer;
}
.btn-primary:active { transform: translateY(1px); opacity: 0.95; }
.btn-primary[disabled] { background: #ccc2b2; box-shadow: none; }

.btn-text {
  display: block;
  width: 100%;
  height: 40px;
  margin-top: 10px;
  border: none;
  background: transparent;
  color: var(--ink-2);
  font-size: 14px;
  cursor: pointer;
}

.safe-note {
  text-align: center;
  font-size: 12px;
  color: #8d8271;
  margin: 12px 0 0;
}

/* ---------------- 加载 ---------------- */
.loading { text-align: center; padding: 46px 20px; }
.loading-ring {
  width: 44px; height: 44px;
  margin: 0 auto 16px;
  border: 3px solid #ece3d2;
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 15px; color: var(--brown); margin: 0; }
.loading-text span { font-size: 12.5px; color: var(--ink-2); }

/* ---------------- 结果 ---------------- */
.result-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px dashed var(--gold-light);
  padding-bottom: 10px;
  margin-bottom: 14px;
}
.result-title { font-size: 18px; font-weight: 700; color: var(--brown); }
.result-no { font-size: 11px; color: #a19584; }

.result-block { margin-bottom: 16px; }
.block-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--brown);
  border-left: 3px solid var(--gold);
  padding-left: 8px;
  margin-bottom: 10px;
}
.row-item, .yun-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 13.5px;
  border-bottom: 1px solid #f6f2ea;
}
.row-item .k, .yun-row .k { color: var(--ink-2); }
.row-item .v, .yun-row .v { color: var(--ink); font-weight: 600; }

.tizhi-type {
  font-size: 20px;
  font-weight: 700;
  color: var(--brown);
  text-align: center;
  padding: 10px 0 4px;
}
.tizhi-care {
  font-size: 13px;
  color: var(--ink-2);
  text-align: center;
  padding-bottom: 6px;
}

/* 五行分布条 */
.dist { padding: 2px 0; }
.dist-row { display: flex; align-items: center; margin-bottom: 8px; }
.dist-name { width: 26px; font-weight: 700; color: var(--brown); font-size: 14px; }
.dist-bar-wrap {
  flex: 1;
  height: 10px;
  background: #f1ece2;
  border-radius: 5px;
  overflow: hidden;
  margin: 0 8px;
}
.dist-bar { height: 100%; border-radius: 5px; transition: width .6s ease; }
.wx-木 { background: var(--green); }
.wx-火 { background: var(--red); }
.wx-土 { background: var(--yellow); }
.wx-金 { background: var(--metal); }
.wx-水 { background: var(--blue); }
.dist-val { width: 74px; text-align: right; font-size: 11.5px; color: #8d8271; }

.mini-disclaimer {
  margin-top: 14px;
  background: var(--cream);
  border: 1px solid var(--gold-light);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 11.5px;
  line-height: 1.7;
  color: #7a6d59;
}

/* ---------------- 简介 ---------------- */
.sec-title {
  font-size: 16px;
  color: var(--brown);
  margin: 0 0 12px;
  padding-left: 9px;
  border-left: 3px solid var(--gold);
}
.intro-item {
  font-size: 13.5px;
  color: var(--ink-2);
  margin-bottom: 8px;
  line-height: 1.7;
}
.intro-item b { color: var(--brown); }
.intro-note {
  margin-top: 12px;
  background: var(--cream);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  color: #7a6d59;
  line-height: 1.7;
}

/* ---------------- 页脚 ---------------- */
.footer { text-align: center; padding: 18px 16px 8px; color: #9b9083; font-size: 12px; }
.footer-links { margin-bottom: 6px; }
.footer-links a { color: var(--brown); text-decoration: none; }
.footer-text { margin: 2px 0; }

/* ---------------- 弹窗 ---------------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(40, 30, 18, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99;
  padding: 20px;
}
.modal {
  background: #fff;
  border-radius: 16px;
  padding: 24px 20px 18px;
  width: 100%;
  max-width: 340px;
  text-align: center;
  position: relative;
  animation: pop .25s ease;
}
@keyframes pop { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-close {
  position: absolute;
  right: 12px; top: 8px;
  font-size: 24px;
  color: #b8ae9d;
  cursor: pointer;
}
.modal-title { font-size: 19px; font-weight: 700; color: var(--brown); }
.modal-sub { font-size: 13px; color: var(--ink-2); margin: 6px 0 14px; }
.qr-box {
  background: var(--cream);
  border: 1px solid var(--gold-light);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
}
.qr-box img { width: 100%; max-width: 190px; border-radius: 6px; display: block; margin: 0 auto; }
.qr-fallback p { font-size: 12.5px; color: var(--ink-2); margin: 0 0 8px; }
.copy-row { display: flex; gap: 6px; }
.copy-row input {
  flex: 1;
  height: 36px;
  border: 1px solid #e3d9c6;
  border-radius: 6px;
  padding: 0 8px;
  font-size: 13px;
  background: #fff;
}
.btn-copy {
  border: none;
  background: var(--brown);
  color: #fff;
  border-radius: 6px;
  padding: 0 14px;
  font-size: 13px;
  cursor: pointer;
}
.modal-tip {
  font-size: 11.5px;
  color: #9b9083;
  margin: 10px 0 0;
  line-height: 1.6;
}

/* ---------------- 文档页（协议 / 关于） ---------------- */
.doc h2 {
  font-size: 15px;
  color: var(--brown);
  margin: 20px 0 8px;
  padding-left: 9px;
  border-left: 3px solid var(--gold);
}
.doc h2:first-child { margin-top: 0; }
.doc p { font-size: 13.5px; color: #5f584c; line-height: 1.85; margin: 0 0 10px; }
.doc ul { margin: 0 0 12px; padding-left: 20px; }
.doc li { font-size: 13.5px; color: #5f584c; line-height: 1.85; margin-bottom: 5px; }
.doc b { color: var(--brown); }
.doc a { color: var(--brown); }
.doc-disclaimer {
  margin-top: 18px;
  background: var(--cream);
  border: 1px solid var(--gold-light);
  border-radius: 8px;
  padding: 12px;
  font-size: 12px;
  line-height: 1.75;
  color: #7a6d59;
}

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 12%;
  transform: translateX(-50%);
  background: rgba(48, 38, 24, 0.92);
  color: #fff;
  font-size: 13px;
  padding: 9px 18px;
  border-radius: 20px;
  z-index: 200;
  animation: fadein .2s ease;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
