/* 觀象志 · V0 樣式（暖紙 / 墨 / 金） */
:root {
  --paper: #f7f2e8;
  --paper-2: #fdfaf3;
  --ink: #241f1a;
  --muted: #6f655a;
  --gold: #a37f43;
  --line: #e3d9c7;
  --card: #fffdf8;
  --seal: #a33b2b;
  --ok: #4c7a52;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
.serif { font-family: "Noto Serif TC", "Source Han Serif TC", "Songti TC", "STSong", "SimSun", serif; }

/* 头部 */
.site-header {
  text-align: center;
  padding: 26px 16px 8px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; }
.seal {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 8px;
  background: var(--seal); color: #fff;
  font-family: "Noto Serif TC", "Songti TC", serif;
  font-size: 22px; line-height: 1;
}
.brand .name {
  font-family: "Noto Serif TC", "Songti TC", serif;
  font-size: 26px; letter-spacing: 4px;
}
.tag { color: var(--muted); font-size: 12px; letter-spacing: 3px; margin: 6px 0 0; }

main { max-width: 760px; margin: 0 auto; padding: 8px 14px 40px; }

.hero { text-align: center; padding: 10px 6px 4px; }
.hero h1 {
  font-family: "Noto Serif TC", "Songti TC", serif;
  font-size: 26px; margin: 8px 0; letter-spacing: 2px;
}
.hero .sub { color: var(--muted); font-size: 14px; margin: 0 auto; max-width: 560px; }
.hero .hint { color: var(--gold); font-size: 12px; letter-spacing: 1px; margin-top: 10px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  margin: 14px 0;
  box-shadow: 0 1px 0 rgba(36, 31, 26, 0.03);
}
.card-title {
  font-family: "Noto Serif TC", "Songti TC", serif;
  font-size: 17px; margin: 0 0 14px; letter-spacing: 2px;
  display: flex; align-items: baseline; justify-content: space-between;
}
.title-note { font-size: 12px; color: var(--muted); letter-spacing: 1px; font-family: system-ui, sans-serif; }

/* 表单 */
.form .row { display: flex; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 5px; flex: 1 1 90px; min-width: 82px; }
.field.wide { flex-basis: 100%; }
.field > span { font-size: 12px; color: var(--muted); }
select, input[type="text"], input[type="number"], input:not([type]) {
  width: 100%;
  padding: 10px 11px;
  font-size: 15px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-family: inherit;
  appearance: none;
}
select:focus, input:focus { outline: 2px solid rgba(163, 127, 67, 0.35); border-color: var(--gold); }

/* 曆法切換 */
.seg { display: flex; gap: 6px; margin-bottom: 12px; }
.seg-btn {
  flex: 1; padding: 9px 8px; font-size: 14px; font-family: inherit;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 9px;
  color: var(--muted); cursor: pointer;
}
.seg-btn.active { border-color: var(--gold); color: var(--gold); background: #fbf5e8; }
.link-btn {
  display: inline; background: none; border: 0; padding: 0; margin: 4px 0 8px;
  color: var(--gold); font-family: inherit; font-size: 13px; cursor: pointer; text-decoration: underline;
}
.tswarn {
  background: #fdf3e3; border: 1px solid #e6c98f; border-left: 4px solid var(--gold);
  color: #6b5327; font-size: 13px; line-height: 1.75; padding: 10px 12px;
  border-radius: 8px; margin: 10px 0;
}
.tswarn b { color: #8a5a1f; }
.tswarn .link-btn { color: #8a5a1f; margin-top: 6px; }
.checkbox.slim { margin: 0; font-size: 13px; }
.field .checkbox.slim { padding-top: 8px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin: 12px 0; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--gold); }
.fine { font-size: 12px; color: var(--muted); margin: 8px 0 0; }

.btn {
  display: inline-block; width: 100%;
  padding: 13px 18px; margin-top: 6px;
  font-size: 15px; font-family: inherit; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  cursor: pointer;
}
.btn.primary { background: var(--ink); color: #f7f2e8; border-color: var(--ink); letter-spacing: 2px; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.55; cursor: default; }

/* 結果區 */
.hidden { display: none !important; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pillar {
  text-align: center; padding: 10px 4px; border-radius: 10px;
  background: var(--paper-2); border: 1px solid var(--line);
}
.pillar .gz { font-family: "Noto Serif TC", "Songti TC", serif; font-size: 22px; letter-spacing: 2px; }
.pillar .sg { font-size: 11px; color: var(--gold); }
.pillar .wx { font-size: 11px; color: var(--muted); }
.pillar.day { border-color: var(--gold); background: #fbf5e8; }
.kv { display: flex; justify-content: space-between; font-size: 13px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); }
.big-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 6px 0 12px; }
.big-row .daymaster { font-family: "Noto Serif TC", serif; font-size: 26px; color: var(--seal); }
.big-row .note { font-size: 12px; color: var(--muted); }

.wx-bars { margin-top: 6px; }
.wx-bar { display: flex; align-items: center; gap: 8px; margin: 5px 0; font-size: 12px; }
.wx-bar .lbl { width: 22px; color: var(--muted); }
.wx-bar .track { flex: 1; height: 8px; background: #efe7d7; border-radius: 4px; overflow: hidden; }
.wx-bar .fill { height: 100%; background: var(--gold); border-radius: 4px; }
.wx-bar .num { width: 16px; text-align: right; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  font-size: 12px; padding: 5px 10px; border-radius: 20px;
  background: var(--paper-2); border: 1px solid var(--line); color: var(--muted);
}
.chip.on { border-color: var(--gold); color: var(--gold); }

.palace-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.palace {
  border: 1px solid var(--line); border-radius: 10px; padding: 8px;
  background: var(--paper-2); font-size: 12px; min-height: 92px;
}
.palace.ming { border-color: var(--gold); background: #fbf5e8; }
.palace .pname { font-weight: 600; font-size: 13px; display: flex; justify-content: space-between; }
.palace .pname .gz { color: var(--muted); font-weight: 400; font-size: 11px; }
.palace .stars { margin-top: 4px; color: var(--ink); line-height: 1.5; }
.palace .star { color: var(--seal); }
.palace .minor { color: var(--muted); }

/* 流年 */
.annual-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.annual-head .year { font-family: "Noto Serif TC", serif; font-size: 24px; letterspacing: 2px; }
.annual-head .dz { color: var(--muted); font-size: 13px; }
.month-list { margin-top: 10px; }
.month {
  display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line);
  font-size: 13px; align-items: baseline;
}
.month:last-child { border-bottom: 0; }
.month .mno { width: 46px; color: var(--muted); flex: none; }
.month .mgz { width: 64px; font-family: "Noto Serif TC", serif; color: var(--ink); flex: none; }
.month .mtext { color: var(--muted); }
.locked-wrap { position: relative; }
.locked-wrap .month-list.locked { max-height: 150px; overflow: hidden; filter: blur(1px); }
.locked-wrap .fade {
  position: absolute; left: 0; right: 0; bottom: 0; height: 120px;
  background: linear-gradient(to bottom, rgba(255, 253, 248, 0), var(--card) 75%);
  pointer-events: none;
}
.lock-cta {
  position: relative; margin-top: -18px; text-align: center; padding: 10px 6px 0;
}
.lock-cta .price { font-family: "Noto Serif TC", serif; font-size: 20px; color: var(--ink); }
.lock-cta .old { color: var(--muted); text-decoration: line-through; font-size: 13px; margin-left: 6px; }
.lock-cta .sub { font-size: 12px; color: var(--muted); margin: 4px 0 10px; }

/* 起卦 */
.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tab {
  flex: 1; padding: 9px 8px; font-size: 13px; font-family: inherit;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 9px;
  color: var(--muted); cursor: pointer;
}
.tab.active { border-color: var(--gold); color: var(--gold); background: #fbf5e8; }
.gua-out { margin-top: 14px; }
.gua-figure { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.lines { display: flex; flex-direction: column-reverse; gap: 6px; width: 148px; flex: none; }
.line-row { display: flex; align-items: center; gap: 6px; height: 12px; }
.line-row .bar { height: 8px; background: var(--ink); border-radius: 2px; flex: 1; }
.line-row.yin .bar { flex: 1; }
.line-row.yin { gap: 10px; }
.line-row.yin::before, .line-row.yin::after { content: ""; }
.line-row .mark { width: 12px; font-size: 11px; color: var(--seal); text-align: center; flex: none; }
.line-row.yang .bars { display: flex; width: 100%; }
.line-row .solid { flex: 1; height: 8px; background: var(--ink); border-radius: 2px; }
.line-row .broken { display: flex; gap: 10px; flex: 1; }
.line-row .broken i { height: 8px; background: var(--ink); border-radius: 2px; flex: 1; }
.gua-text { flex: 1; min-width: 180px; }
.gua-name { font-family: "Noto Serif TC", serif; font-size: 18px; }
.gua-sub { font-size: 12px; color: var(--muted); margin: 2px 0 6px; }
.guaci { font-size: 13px; color: var(--ink); background: var(--paper-2); border-left: 3px solid var(--gold); padding: 8px 10px; border-radius: 0 8px 8px 0; margin: 8px 0; }
.gua-block { margin: 10px 0; }
.gua-block .q { font-size: 12px; color: var(--gold); letter-spacing: 1px; }

.disclaimer h3 { font-size: 14px; margin: 0 0 6px; color: var(--muted); font-weight: 600; }
.disclaimer p { font-size: 12px; color: var(--muted); margin: 0; }

footer { text-align: center; padding: 10px 16px 34px; color: var(--muted); font-size: 12px; }
footer p { margin: 4px 0; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); font-size: 13px;
  padding: 10px 16px; border-radius: 22px; opacity: 0.95; z-index: 20;
}

@media (max-width: 520px) {
  .palace-grid { grid-template-columns: repeat(2, 1fr); }
  .hero h1 { font-size: 22px; }
  .pillar .gz { font-size: 19px; }
}

/* 語言切換 */
.lang {
  position: fixed; top: 10px; right: 10px; z-index: 40;
  display: flex; gap: 3px; padding: 4px;
  background: rgba(255,253,248,0.92); border: 1px solid var(--line); border-radius: 20px;
}
.lang button {
  border: 0; background: transparent; font-family: inherit; font-size: 12px;
  color: var(--muted); padding: 5px 9px; border-radius: 15px; cursor: pointer;
}
.lang button.active { background: var(--ink); color: var(--paper); }

/* 城市地理編碼建議 */
.sug {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  margin: -4px 0 10px; overflow: hidden; box-shadow: 0 6px 18px rgba(36,31,26,0.08);
}
.sug-item {
  display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left;
  padding: 9px 12px; background: transparent; border: 0; border-bottom: 1px solid #f1eadd;
  font-family: inherit; cursor: pointer;
}
.sug-item:last-child { border-bottom: 0; }
.sug-item:hover { background: #fbf5e8; }
.sug-t { font-size: 14px; color: var(--ink); }
.sug-s { font-size: 11px; color: var(--muted); }

/* 紫微盤鎖定 */
.palace-grid.locked { filter: blur(3px); pointer-events: none; user-select: none; }

/* 分享卡 / 收款彈窗 */
.gxz-modal {
  position: fixed; inset: 0; background: rgba(36,31,26,0.55);
  display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 100;
}
.gxz-modal-box {
  background: var(--card); border-radius: 16px; padding: 16px;
  max-width: 520px; width: 100%; max-height: 88vh; overflow: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,0.25);
}
.card-preview img { width: 100%; border-radius: 10px; border: 1px solid var(--line); display: block; }
.modal-btns { display: flex; gap: 8px; margin-top: 12px; }
.modal-btns .btn { margin-top: 0; }
.pay { text-align: center; }
.pay-title { font-family: "Noto Serif TC", serif; font-size: 20px; letter-spacing: 2px; }
.pay-price { font-size: 30px; margin: 6px 0 12px; }
.pay-qr {
  width: 200px; height: 200px; margin: 8px auto; display: block;
  border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: #fff;
}
.pay .btn { margin-top: 10px; }

main a, footer a, .card a { color: #8a5a1f; }

/* 私域表單彈窗 */
.lead .field { margin-bottom: 8px; }
.lead-title { font-size: 20px; letter-spacing: 1px; margin: 4px 0 2px; }
.lead .btn { margin-top: 8px; }
