/* 知命八字 — 主樣式 */
:root {
  --bg: #14161f;
  --bg-card: #1d2030;
  --bg-input: #262a3d;
  --border: #33384f;
  --text: #e8e6df;
  --text-dim: #a9a698;
  --gold: #d9b23c;
  --gold-soft: #c9a227;
  --accent: #8f6ad9;
  --radius: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
  line-height: 1.75;
  min-height: 100vh;
}

h1, h2, .brand, .pillar-gan, .pillar-zhi {
  font-family: 'Noto Serif TC', 'Noto Sans TC', serif;
}

main { max-width: 720px; margin: 0 auto; padding: 0 16px 48px; }

/* Header */
.site-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand { font-size: 1.3rem; font-weight: 700; letter-spacing: 0.15em; }
.brand span { color: var(--gold); }
/* 語系切換器 */
.lang-switch { margin-left: auto; display: inline-flex; gap: 6px; }
.lang-switch button {
  background: none; border: 1px solid var(--border); color: var(--text-dim, #a9a698);
  font-size: 13px; padding: 4px 10px; border-radius: 8px; cursor: pointer;
}
.lang-switch button:hover { color: var(--gold); border-color: var(--gold); }
.lang-switch button.lang-cur { color: var(--gold); border-color: var(--gold); font-weight: 600; }

/* Hero */
.hero { text-align: center; padding: 48px 0 32px; }
.hero h1 {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, var(--gold) 30%, #f0dfa0);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 12px;
}
.hero-sub { color: var(--text-dim); font-size: 1.05rem; margin-bottom: 8px; }
.hero-privacy { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 28px; }

/* 卡片 */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  margin-bottom: 20px;
  text-align: left;
}
.card h2 { font-size: 1.25rem; color: var(--gold); margin-bottom: 14px; letter-spacing: 0.05em; }

/* 表單 */
.form-card { max-width: 520px; margin: 0 auto; }
.form-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-bottom: 16px;
}
.form-label {
  flex: 0 0 3em; font-weight: 500; color: var(--gold);
  letter-spacing: 0.2em; font-size: 0.95rem;
}
select, input[type="number"], input[type="text"] {
  background: var(--bg-input); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 11px 12px; font-size: 1rem; font-family: inherit;   /* 16px：手機不觸發自動放大 */
  flex: 1; min-width: 90px; min-height: 46px;                  /* 觸控目標 ≥44px */
}
select:focus, input:focus { outline: 2px solid var(--gold-soft); border-color: transparent; }
/* 年份：數字直接鍵入、隱藏上下微調鈕、寬度收斂置中 */
.inp-year { flex: 0 1 7.5em; min-width: 6em; text-align: center; -moz-appearance: textfield; appearance: textfield; }
.inp-year::-webkit-outer-spin-button, .inp-year::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.field-hint { font-size: 0.8rem; color: var(--text-dim); margin: -8px 0 14px; }

/* 性別／曆別＝好按的片狀選項（觸控目標大、選中有底色，一眼看出選了誰） */
.radio {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 1rem;
  min-height: 44px; padding: 8px 14px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--bg-input);
  transition: border-color 0.15s, background 0.15s;
}
.radio:hover { border-color: var(--gold-soft); }
.radio:has(input:checked) { border-color: var(--gold); background: rgba(217, 178, 60, 0.14); }
.radio input { accent-color: var(--gold); width: 17px; height: 17px; }
.form-hint { font-size: 0.8rem; color: var(--text-dim); }
.form-error { color: #e58a8a; font-size: 0.9rem; margin-bottom: 12px; }

.btn-primary {
  display: block; width: 100%;
  background: linear-gradient(135deg, var(--gold-soft), #a8821c);
  color: #1a1505; font-weight: 700; font-size: 1.1rem;
  border: none; border-radius: 10px; padding: 14px;
  cursor: pointer; letter-spacing: 0.1em;
  transition: transform 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(217, 178, 60, 0.25); }
.btn-primary:disabled { opacity: 0.75; cursor: default; transform: none; box-shadow: none; }

/* 排盤鈕：更大更醒目；手機 sticky 貼底見下方 RWD */
.form-actions { margin-top: 8px; }
.btn-generate { min-height: 52px; font-size: 1.15rem; box-shadow: 0 4px 14px rgba(217, 178, 60, 0.22); }

/* 命盤 */
.basic-info { color: var(--text-dim); font-size: 0.92rem; margin-bottom: 18px; }
.basic-info b { color: var(--gold); }
.pillars { display: grid; gap: 10px; margin-bottom: 10px; }
/* minmax(0,1fr)：長藏干不撐爆版面＝任何寬度都不產生橫向捲動 */
.pillars.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pillars.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pillar {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 6px; text-align: center; min-width: 0;
}
.pillar-label { font-size: 0.8rem; color: var(--text-dim); margin-bottom: 4px; }
.pillar-shishen { font-size: 0.78rem; color: var(--accent); margin-bottom: 8px; }
.pillar-gan, .pillar-zhi { font-size: 1.9rem; font-weight: 700; line-height: 1.3; }
.pillar-gan { color: var(--gold); }
.pillar-hide { font-size: 0.75rem; color: var(--text-dim); margin-top: 8px; overflow-wrap: anywhere; }
.ph-title { font-size: 0.68rem; opacity: 0.65; margin-bottom: 2px; }
.ph-row { display: flex; justify-content: center; align-items: baseline; gap: 4px; line-height: 1.5; }
.ph-gan { color: var(--gold-soft); font-weight: 600; }
.ph-ss { color: var(--accent); font-size: 0.72rem; }

/* 大運／流年 */
.yun-steps {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px;
  margin-bottom: 18px; -webkit-overflow-scrolling: touch;
}
.yun-step {
  flex: 0 0 auto; min-width: 66px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 8px; cursor: pointer;
  color: var(--text); font-family: inherit;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.yun-step:hover { transform: translateY(-1px); border-color: var(--gold-soft); }
.yun-step-shishen { font-size: 0.72rem; color: var(--accent); }
.yun-step-gz {
  font-family: 'Noto Serif TC', serif; font-size: 1.35rem; line-height: 1.2;
}
.yun-step-gz b { color: var(--gold); font-weight: 700; }
.yun-step-age { font-size: 0.72rem; color: var(--text-dim); }
.yun-step-year { font-size: 0.68rem; color: var(--text-dim); opacity: 0.7; }
.yun-step.is-now { border-color: var(--gold-soft); }
.yun-step.is-selected {
  background: rgba(217, 178, 60, 0.14); border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold-soft) inset;
}

.liunian-wrap { margin-bottom: 18px; }
.liunian-title { color: var(--gold); font-size: 0.95rem; margin-bottom: 12px; letter-spacing: 0.03em; }
.liunian-title b { font-family: 'Noto Serif TC', serif; font-size: 1.1em; }
.drill-hint { font-size: 0.72rem; color: var(--text-dim); opacity: 0.7; letter-spacing: 0; font-weight: 400; }
.liunian-grid {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px;
}
.ln-cell {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 0;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 4px; text-align: center;
  color: var(--text); font-family: inherit; cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.ln-cell:hover { transform: translateY(-1px); border-color: var(--gold-soft); }
.ln-year { font-size: 0.78rem; color: var(--text-dim); }
.ln-gz { font-family: 'Noto Serif TC', serif; font-size: 1.05rem; line-height: 1.2; }
.ln-gz b { color: var(--gold); font-weight: 700; }
.ln-shishen { font-size: 0.7rem; color: var(--accent); }
.ln-age { font-size: 0.68rem; color: var(--text-dim); opacity: 0.75; }
.ln-cell.is-now { border-color: var(--gold-soft); }
.ln-cell.is-selected {
  background: rgba(217, 178, 60, 0.14); border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold-soft) inset;
}

/* 流日 */
.liuri-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px;
}
.lr-cell {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  min-width: 0;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 7px; padding: 6px 2px; text-align: center;
}
.lr-md { font-size: 0.66rem; color: var(--text-dim); opacity: 0.8; }
.lr-gz { font-family: 'Noto Serif TC', serif; font-size: 0.92rem; line-height: 1.15; }
.lr-gz b { color: var(--gold); font-weight: 700; }
.lr-shishen { font-size: 0.62rem; color: var(--accent); }
.lr-cell.is-now {
  border-color: var(--gold); background: rgba(217, 178, 60, 0.16);
}

/* 今日運勢 */
.daily-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.daily-date { color: var(--text-dim); font-size: 0.92rem; }
.daily-date b { color: var(--gold); font-family: 'Noto Serif TC', serif; }
.daily-score { display: flex; align-items: baseline; gap: 8px; }
.ds-num { font-family: 'Noto Serif TC', serif; font-size: 2.6rem; font-weight: 700; color: var(--gold); line-height: 1; }
.ds-band { color: var(--text); font-size: 1rem; }
.daily-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.daily-tags span {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 12px; font-size: 0.82rem; color: var(--text-dim);
}
.daily-headline { color: var(--text); font-size: 1.08rem; font-weight: 500; margin-bottom: 16px; letter-spacing: 0.02em; }
.daily-cats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.daily-cats > div { background: var(--bg-input); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.daily-cats span { display: block; color: var(--accent); font-size: 0.82rem; margin-bottom: 4px; letter-spacing: 0.08em; }
.daily-cats p { color: var(--text); font-size: 0.9rem; line-height: 1.6; }
.daily-tip { color: var(--text-dim); font-size: 0.9rem; }

/* 分享 */
.share-row { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); }
.share-main { max-width: 360px; margin: 0 auto 14px; }
.share-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.share-chip {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-input); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 8px 14px; font-size: 0.9rem; font-family: inherit;
  cursor: pointer; text-decoration: none; transition: border-color 0.15s, transform 0.1s;
}
.share-chip:hover { border-color: var(--gold-soft); transform: translateY(-1px); }
.share-hint { color: var(--text-dim); font-size: 0.8rem; text-align: center; margin-top: 12px; line-height: 1.6; }

/* 五行 */
.wuxing-bars { margin-bottom: 18px; }
.wx-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.wx-name { flex: 0 0 1.2em; font-weight: 700; font-size: 1.1rem; }
.wx-track {
  flex: 1; height: 12px; background: var(--bg-input);
  border-radius: 6px; overflow: hidden;
}
.wx-bar { height: 100%; border-radius: 6px; transition: width 0.6s ease; }
.wx-count { flex: 0 0 1.5em; text-align: right; color: var(--text-dim); font-size: 0.9rem; }

/* 解讀文字 */
.reading h4 {
  color: var(--gold); font-size: 1rem; margin: 16px 0 6px;
  letter-spacing: 0.05em;
}
.reading h4:first-child { margin-top: 0; }
.reading p { color: var(--text); font-size: 0.97rem; }
.wx-tips { color: var(--text-dim); font-size: 0.9rem !important; margin-top: 4px; }
.dm-metaphor { color: var(--accent); font-size: 1.02rem; margin-bottom: 12px; letter-spacing: 0.08em; }

/* 付費預告 */
.teaser-card {
  border: 1px solid rgba(217, 178, 60, 0.45);
  background: linear-gradient(160deg, #241f30, #1d2030);
  text-align: center;
}
.teaser-lock { font-size: 2rem; margin-bottom: 6px; }
.teaser-desc { color: var(--text-dim); margin-bottom: 14px; }
.teaser-list {
  list-style: none; text-align: left; max-width: 420px;
  margin: 0 auto 16px; color: var(--text);
}
.teaser-list li { padding: 4px 0; }
.teaser-price { margin-bottom: 16px; color: var(--text-dim); }
.teaser-price b { color: var(--gold); font-size: 1.15em; }
.teaser-card .btn-primary { max-width: 340px; margin: 0 auto; }
.teaser-note { color: var(--text-dim); font-size: 0.78rem; margin-top: 12px; }

/* FAQ */
.faq { padding: 24px 0; }
.faq h2 { color: var(--gold); font-size: 1.25rem; margin-bottom: 14px; }
.faq details {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 18px; margin-bottom: 10px;
}
.faq summary { cursor: pointer; font-weight: 500; }
.faq details p { margin-top: 10px; color: var(--text-dim); font-size: 0.95rem; }

/* 十天干日主內部連結區 */
.rizhu-links { max-width: 640px; margin: 8px auto 0; text-align: center; }
.rizhu-links h2 { font-family: 'Noto Serif TC', serif; color: var(--gold); font-size: 1.3rem; margin-bottom: 8px; }
.rizhu-intro { color: var(--text-dim); font-size: 0.95rem; line-height: 1.8; margin-bottom: 14px; }
.rizhu-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 12px; }
.rizhu-chips a {
  display: inline-block; padding: 7px 14px; border: 1px solid var(--border);
  border-radius: 999px; color: var(--text); text-decoration: none;
  font-family: 'Noto Serif TC', serif; font-size: 1rem; transition: border-color .15s, color .15s;
}
.rizhu-chips a:hover { border-color: var(--gold-soft); color: var(--gold); }
.rizhu-more { color: var(--gold); text-decoration: none; font-size: 0.95rem; }
.rizhu-more:hover { text-decoration: underline; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 16px 40px; text-align: center;
  color: var(--text-dim); font-size: 0.8rem;
}
.site-footer p { margin-bottom: 4px; }

/* ======== RWD：320 / 375 / 768 / 1024 / 1440 全順、零橫向捲動 ======== */

/* 手機（≤768）：標籤獨佔一行、立即排盤 sticky 貼底方便單手按 */
@media (max-width: 768px) {
  .form-label { flex-basis: 100%; margin-bottom: 2px; }
  .form-actions {
    position: sticky; bottom: 8px; z-index: 20; padding-top: 10px;
    background: linear-gradient(180deg, rgba(29, 32, 48, 0) 0%, var(--bg-card) 26%);
  }
}

/* 一般手機（≤480） */
@media (max-width: 480px) {
  .hero { padding: 32px 0 20px; }
  .hero h1 { font-size: 1.9rem; }
  .card { padding: 20px 14px; }
  .pillar-gan, .pillar-zhi { font-size: 1.5rem; }
  .liunian-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .ln-gz { font-size: 0.95rem; }
  .liuri-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
  .daily-top { flex-wrap: wrap; }
}

/* 小手機（≤380，iPhone SE／320 裝置）：四柱與寬格再收斂，保持一行可讀、不被裁 */
@media (max-width: 380px) {
  main { padding-left: 14px; padding-right: 14px; }
  .pillars { gap: 6px; }
  .pillar { padding: 12px 3px; }
  .pillar-gan, .pillar-zhi { font-size: 1.32rem; }
  .pillar-shishen { font-size: 0.7rem; }
  .pillar-hide { font-size: 0.62rem; letter-spacing: -0.02em; }
  .pillar-label { font-size: 0.72rem; }
  .liunian-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .liuri-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* 桌機大屏（≥1024）：略放寬仍守可讀行寬 */
@media (min-width: 1024px) {
  main { max-width: 760px; }
}
