/* =================================================================
   奇門布陣 — 宣紙文房 × 現代精品選物
   色票  宣紙底 / 墨黑字 / 朱砂印（警示·印章）/ 鎏金（吉貴）/ 青瓷綠（安康）
   字體  明體 Noto Serif TC（標題·符號）+ 無襯線 Noto Sans TC（內文）
   ================================================================= */

:root {
  /* 宣紙 / 墨 */
  --paper:        #F4EEE0;   /* 主底：暖白宣紙 */
  --paper-card:   #FBF7EE;   /* 卡片：略亮的紙 */
  --paper-sunk:   #ECE4D2;   /* 凹陷／輸入框底 */
  --ink:          #211C16;   /* 墨黑 */
  --ink-soft:     #5C5447;   /* 次級墨 */
  --ink-faint:    #8C8270;   /* 提示灰 */
  --line:         #D8CDB6;   /* 細線·分隔 */

  /* 朱砂印泥（警示 / 印章主調） */
  --cinnabar:     #C0341F;
  --cinnabar-ink: #9E2616;
  --cinnabar-wash:#F3DDD3;

  /* 鎏金（吉貴點綴） */
  --gold:         #A9863F;
  --gold-bright:  #C7A14A;
  --gold-wash:    #EFE6CC;

  /* 青瓷綠（安康 / 吉） */
  --jade:         #4C7355;
  --jade-wash:    #E0E8DC;

  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(33,28,22,.06);
  --shadow-md: 0 8px 28px -16px rgba(33,28,22,.40);
  --shadow-lg: 0 20px 56px -28px rgba(33,28,22,.55);

  --serif: "Noto Serif TC", "Songti TC", "Source Han Serif TC", serif;
  --sans:  "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --mono:  "Spline Sans Mono", ui-monospace, "SFMono-Regular", monospace;

  --maxw: 1180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* 宣紙顆粒紋理（SVG turbulence，極淡，不擾讀） */
.paper-grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .55;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}
/* 角落淡墨暈染，增添文房氣 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(60% 40% at 88% -8%, rgba(192,52,31,.05), transparent 60%),
    radial-gradient(55% 45% at -8% 105%, rgba(169,134,63,.07), transparent 60%);
}

main, header, footer { position: relative; z-index: 1; }

/* ───────────── 報頭 ───────────── */
.masthead {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(var(--paper-card), var(--paper));
}
.masthead__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 20px 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
  width: fit-content;
}
.brand__seal {
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 9px;
  background: var(--cinnabar);
  color: #FBF1E6;
  font-family: var(--serif);
  font-weight: 900;
  font-size: 19px;
  line-height: .92;
  letter-spacing: 1px;
  box-shadow: inset 0 0 0 2px rgba(251,241,230,.30), var(--shadow-sm);
  /* 印章蝕刻感 */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cfilter id='r'%3E%3CfeTurbulence baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23r)' opacity='0.12'/%3E%3C/svg%3E");
}
.brand__seal span { display: block; }
.brand__word { display: flex; flex-direction: column; line-height: 1.15; }
.brand__name {
  font-family: var(--serif);
  font-weight: 900;
  font-size: 23px;
  letter-spacing: 3px;
}
.brand__sub {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 2px;
  color: var(--gold);
  text-transform: uppercase;
}
.masthead__tag {
  margin: 0;
  font-size: 13px;
  color: var(--ink-soft);
  letter-spacing: .5px;
}

/* ───────────── 版面網格 ───────────── */
.layout {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 22px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  align-items: start;
}

/* ───────────── 通用面板 / 區塊頭 ───────────── */
.panel {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 26px 22px;
  box-shadow: var(--shadow-sm);
}
.panel__eyebrow,
.section-eyebrow {
  display: inline-block;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 6px;
  color: #FBF1E6;
  background: var(--ink);
  padding: 3px 6px 3px 12px;
  border-radius: 3px;
  margin-bottom: 14px;
}
.panel__title {
  font-family: var(--serif);
  font-weight: 900;
  font-size: clamp(24px, 6vw, 32px);
  letter-spacing: 2px;
  margin: 0 0 8px;
  line-height: 1.25;
}
.panel__lede {
  margin: 0 0 22px;
  color: var(--ink-soft);
  font-size: 14.5px;
}

/* ───────────── 表單 ───────────── */
.field { margin-bottom: 18px; }
.field > label {
  display: block;
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 1px;
  margin-bottom: 7px;
}
.field__opt {
  font-weight: 400;
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: 1px;
}
.field__hint {
  margin: 6px 0 0;
  font-size: 11.5px;
  color: var(--ink-faint);
}

input[type="datetime-local"],
input[type="date"],
input[type="number"],
select {
  width: 100%;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
  background: var(--paper-sunk);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 14px;
  appearance: none;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
input:hover, select:hover { border-color: var(--gold); }
input:focus, select:focus {
  outline: none;
  border-color: var(--cinnabar);
  background: var(--paper-card);
  box-shadow: 0 0 0 3px var(--cinnabar-wash);
}
.select-wrap { position: relative; }
.select-wrap::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--ink-soft);
  border-bottom: 2px solid var(--ink-soft);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

/* 進階折疊 */
.advanced {
  border-top: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
  margin: 4px 0 22px;
}
.advanced > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 2px;
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 1px;
  color: var(--ink-soft);
}
.advanced > summary::-webkit-details-marker { display: none; }
.advanced__chev {
  width: 8px; height: 8px;
  border-right: 2px solid var(--gold);
  border-bottom: 2px solid var(--gold);
  transform: rotate(45deg);
  transition: transform .22s;
}
.advanced[open] .advanced__chev { transform: rotate(-135deg); }
.advanced__body { padding-bottom: 14px; }

/* 開關 */
.toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  margin: 4px 0 18px;
  user-select: none;
}
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle__track {
  width: 46px; height: 26px;
  border-radius: 999px;
  background: var(--paper-sunk);
  border: 1px solid var(--line);
  position: relative;
  transition: background .2s, border-color .2s;
  flex: none;
}
.toggle__thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--paper-card);
  box-shadow: var(--shadow-sm);
  transition: transform .22s cubic-bezier(.34,1.56,.64,1);
}
.toggle input:checked + .toggle__track {
  background: var(--cinnabar);
  border-color: var(--cinnabar-ink);
}
.toggle input:checked + .toggle__track .toggle__thumb { transform: translateX(20px); }
.toggle input:focus-visible + .toggle__track { box-shadow: 0 0 0 3px var(--cinnabar-wash); }
.toggle__label { font-size: 14px; font-weight: 500; }

/* 主按鈕 */
.btn-cast {
  width: 100%;
  position: relative;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 6px;
  color: #FBF1E6;
  background: var(--cinnabar);
  border: none;
  border-radius: var(--r-md);
  padding: 15px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: transform .15s, box-shadow .2s, background .2s;
}
.btn-cast:hover { background: var(--cinnabar-ink); transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn-cast:active { transform: translateY(0); }
.btn-cast:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.btn-cast__spin {
  display: none;
  width: 17px; height: 17px;
  margin-left: 8px;
  vertical-align: -3px;
  border: 2px solid rgba(251,241,230,.4);
  border-top-color: #FBF1E6;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn-cast.is-loading { pointer-events: none; opacity: .92; }
.btn-cast.is-loading .btn-cast__spin { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn-demo {
  width: 100%;
  margin-top: 10px;
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--ink-soft);
  background: rgba(0,0,0,.03);
  border: 1px solid var(--ink-faint);   /* 提高靜止態邊框對比，按鈕邊界可見 */
  border-radius: var(--r-md);
  padding: 11px;
  cursor: pointer;
  transition: border-color .18s, color .18s, background .18s;
}
.btn-demo:hover { border-color: var(--gold); color: var(--gold); background: var(--gold-wash); }
.btn-demo:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ───────────── 結果區 ───────────── */
.results { min-height: 200px; }

/* 邀請態 */
.invite {
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--r-lg);
  padding: 54px 26px;
  color: var(--ink-soft);
  background:
    radial-gradient(120% 80% at 50% 0%, var(--paper-card), transparent 70%);
}
.invite__seal {
  width: 76px; height: 76px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 2px solid var(--cinnabar);
  color: var(--cinnabar);
  font-family: var(--serif);
  font-weight: 900;
  font-size: 38px;
  opacity: .85;
}
.invite h2 { font-family: var(--serif); font-size: 21px; letter-spacing: 2px; margin: 0 0 8px; color: var(--ink); }
.invite p { margin: 0; font-size: 14px; }

/* 離線提示 */
.offline-note {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--gold);
  background: var(--gold-wash);
  border: 1px solid var(--gold);
  border-radius: var(--r-md);
  padding: 9px 14px;
  margin-bottom: 18px;
}
.offline-note::before {
  content: "示範";
  font-family: var(--serif);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 1px;
  color: #FBF1E6;
  background: var(--gold);
  padding: 1px 6px;
  border-radius: 3px;
  flex: none;
}

/* ───────────── 盤頭摘要 ───────────── */
.report { display: flex; flex-direction: column; gap: 22px; }

.headline {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  background: var(--ink);
  color: #F2E9DA;
  border-radius: var(--r-lg);
  padding: 24px 22px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.headline::after { /* 暗墨紋理 */
  content: ""; position: absolute; inset: 0; opacity: .4; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)' opacity='0.06'/%3E%3C/svg%3E");
}
.headline > * { position: relative; }

.ju-seal {
  align-self: start;
  width: 100%;            /* 手機：滿版朱印橫幅，消除右側死角（>=720px 還原為 fit-content） */
  text-align: center;
  border: 2px solid var(--cinnabar);
  background: var(--cinnabar);
  color: #FBF1E6;
  border-radius: 10px;
  padding: 12px 18px 14px;
  box-shadow: inset 0 0 0 2px rgba(251,241,230,.22);
}
.ju-seal__dun { font-family: var(--serif); font-weight: 700; font-size: 14px; letter-spacing: 4px; display: block; }
.ju-seal__num {
  font-family: var(--serif); font-weight: 900;
  font-size: 54px; line-height: .9; letter-spacing: 0; display: block; margin: 2px 0;
}
.ju-seal__label { font-size: 11px; letter-spacing: 3px; opacity: .85; }

.headline__meta { display: flex; flex-direction: column; gap: 14px; }
.head-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px; }
.head-row__k {
  font-family: var(--serif); font-size: 13px; letter-spacing: 3px; color: #B7AC97; flex: none;
}
.topic-chip {
  font-family: var(--serif); font-weight: 700; font-size: 19px; letter-spacing: 3px;
  color: var(--gold-bright);
}
.yueling {
  font-size: 15px; font-weight: 700; letter-spacing: 1px;
  padding: 4px 12px; border-radius: 999px;
}
.yueling--bad  { background: rgba(192,52,31,.22); color: #F0A998; border: 1px solid rgba(192,52,31,.6); }
.yueling--good { background: rgba(76,115,85,.24); color: #A9CFAE; border: 1px solid rgba(76,115,85,.6); }
.yueling--mid  { background: rgba(169,134,63,.22); color: #DCC079; border: 1px solid rgba(169,134,63,.55); }
.yueling__desc { font-weight: 400; opacity: .85; }

.yinpan-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.yinpan-tag {
  font-size: 12px; font-weight: 700; letter-spacing: 1px;
  color: #F0A998;
  background: rgba(192,52,31,.16);
  border: 1px solid rgba(192,52,31,.5);
  padding: 3px 11px; border-radius: 999px;
}

/* ───────────── 洛書九宮羅盤（signature） ───────────── */
.luopan-wrap {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.luopan-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.luopan-head h3 { font-family: var(--serif); font-weight: 900; font-size: 19px; letter-spacing: 2px; margin: 0; }
.luopan-head p { margin: 0; font-size: 11.5px; color: var(--ink-faint); letter-spacing: 1px; }

.luopan {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  aspect-ratio: 1 / 1;
  max-width: 420px;
  margin: 0 auto;
}
.gong {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto 1fr auto;
  grid-template-areas: "god star" "stem stem" "gate loc";
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper-sunk);
  padding: 5px 6px;
  transition: transform .16s, box-shadow .2s, border-color .2s;
}
.gong__god  { grid-area: god;  justify-self: start; }
.gong__star { grid-area: star; justify-self: end; }
.gong__gate { grid-area: gate; justify-self: start; }
.gong__god, .gong__star, .gong__gate {
  font-family: var(--serif); font-size: clamp(10px, 2.7vw, 12.5px);
  color: var(--ink-soft); letter-spacing: .5px; line-height: 1;
}
.gong__stem {
  grid-area: stem; justify-self: center; align-self: center;
  font-family: var(--serif); font-weight: 900;
  font-size: clamp(17px, 5vw, 25px); line-height: 1; letter-spacing: 1px;
  display: inline-flex; align-items: baseline; gap: 1px;
}
.gong__estem { font-size: .46em; font-weight: 700; font-style: normal; opacity: .65; color: var(--ink-soft); }
.gong__loc {
  grid-area: loc; justify-self: end; white-space: nowrap;
  font-size: clamp(7.5px, 2vw, 10px); color: var(--ink-faint); letter-spacing: 0; line-height: 1;
}
/* 中宮：天禽守中、簡化置中 */
.gong--center {
  background: var(--ink); color: #E9DECB; border-color: var(--ink);
  grid-template-areas: "star star" "stem stem" "loc loc"; text-align: center;
}
.gong--center .gong__star { justify-self: center; color: #C9BD9F; }
.gong--center .gong__loc  { justify-self: center; color: #9C907B; }
/* 用神宮：鎏金內框 */
.gong--yong { box-shadow: inset 0 0 0 2px var(--gold); border-color: var(--gold); }
/* 受困宮位：浮現朱砂印記 */
.gong--afflicted {
  border-color: var(--cinnabar);
  background:
    radial-gradient(120% 120% at 50% 30%, var(--cinnabar-wash), var(--paper-sunk) 75%);
  box-shadow: inset 0 0 0 1px var(--cinnabar);
}
.gong--afflicted::before { /* 朱砂印戳（頂部中央，避開神/星/門） */
  content: "困";
  position: absolute; top: 1px; left: 50%; transform: translateX(-50%);
  font-family: var(--serif); font-weight: 900; font-size: 10px;
  color: #FBF1E6; background: var(--cinnabar);
  width: 16px; height: 16px; border-radius: 4px;
  display: grid; place-items: center; z-index: 2;
  box-shadow: inset 0 0 0 1px rgba(251,241,230,.35);
}
/* 空亡（非用神）：淡金「空」記，僅參考、不需出手 */
.gong--void { border-color: var(--gold); }
.gong--void::before {
  content: "空";
  position: absolute; top: 1px; left: 50%; transform: translateX(-50%);
  font-family: var(--serif); font-weight: 700; font-size: 9.5px;
  color: var(--ink-soft); background: var(--paper-card);
  border: 1px solid var(--gold);
  width: 15px; height: 15px; border-radius: 4px;
  display: grid; place-items: center; z-index: 2;
}
/* 九宮圖例 */
.luopan-legend {
  display: flex; flex-wrap: wrap; gap: 5px 12px;
  margin: 4px 0 12px; font-size: 11px; color: var(--ink-faint); line-height: 1.4;
}
.lg { display: inline-flex; align-items: center; gap: 5px; }
.lg::before { content: ""; width: 11px; height: 11px; border-radius: 3px; flex: none; }
.lg--yong::before { box-shadow: inset 0 0 0 2px var(--gold); border: 1px solid var(--gold); }
.lg--aff::before  { background: var(--cinnabar); }
.lg--void::before { background: var(--paper-card); border: 1px solid var(--gold); }
button.gong { cursor: pointer; font: inherit; }
button.gong:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--gold); }
button.gong:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ───────────── 區塊標題（用神 / 布陣） ───────────── */
.block { display: flex; flex-direction: column; }
.block__head { margin-bottom: 16px; }
.block__title { font-family: var(--serif); font-weight: 900; font-size: clamp(20px, 5vw, 26px); letter-spacing: 2px; margin: 6px 0 4px; }
.block__note { margin: 0; font-size: 13px; color: var(--ink-soft); }

/* ───────────── 用神診斷卡 ───────────── */
.yong-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.yong-card {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--jade);
  border-radius: var(--r-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  scroll-margin-top: 16px;
  transition: box-shadow .2s, transform .16s;
}
.yong-card--harm { border-left-color: var(--cinnabar); background: linear-gradient(var(--cinnabar-wash), var(--paper-card) 60%); }
.yong-card.is-flash { animation: flash 1.1s ease; }
@keyframes flash { 0%,100% { box-shadow: var(--shadow-sm); } 25% { box-shadow: 0 0 0 3px var(--cinnabar-wash), var(--shadow-md); } }

.yong-card__top { display: flex; align-items: center; gap: 14px; }
.yong-sym {
  flex: none;
  width: 50px; height: 50px;
  display: grid; place-items: center;
  border-radius: 10px;
  font-family: var(--serif); font-weight: 900; font-size: 26px;
  background: var(--paper-sunk); border: 1px solid var(--line); color: var(--ink);
}
/* 兩字符號（八門/八神）縮字橫排，靠 .yong-sym 的 place-items:center 置中、不換行不爆框 */
.yong-sym--double { font-size: 19px; letter-spacing: 0; white-space: nowrap; }
.yong-card--harm .yong-sym { background: var(--cinnabar); color: #FBF1E6; border-color: var(--cinnabar-ink); }
.yong-card__id { flex: 1; min-width: 0; }
.yong-card__label { font-family: var(--serif); font-weight: 700; font-size: 17px; letter-spacing: 1px; }
.yong-card__palace { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.yong-card__palace b { color: var(--gold); font-weight: 700; }

.harm-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; }
.harm-tag {
  font-size: 12px; font-weight: 700; letter-spacing: .5px;
  padding: 3px 10px; border-radius: 999px;
}
.harm-tag--severe { color: #FBF1E6; background: var(--cinnabar); }
.harm-tag--minor  { color: var(--ink); background: var(--gold-wash); border: 1px solid var(--gold); }
.harm-explain { margin: 7px 0 0; font-size: 12.5px; color: var(--ink-soft); line-height: 1.5; }
.safe-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 700; color: var(--jade);
  background: var(--jade-wash); border: 1px solid var(--jade);
  padding: 3px 12px; border-radius: 999px; margin-top: 14px;
}

.xiang {
  margin: 14px 0 0; font-size: 13.5px; color: var(--ink-soft);
  display: flex; align-items: baseline; gap: 8px;
}
.xiang b { font-family: var(--serif); color: var(--ink); letter-spacing: 1px; flex: none; }

.remedies { margin: 14px 0 0; padding: 14px; background: var(--paper-sunk); border-radius: var(--r-sm); }
.remedies__h { font-family: var(--serif); font-weight: 700; font-size: 13px; letter-spacing: 2px; color: var(--gold); margin-bottom: 8px; }
.remedies ul { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.remedies li { position: relative; padding-left: 20px; font-size: 13px; line-height: 1.55; }
.remedies li::before {
  content: ""; position: absolute; left: 4px; top: 8px;
  width: 7px; height: 7px; border-radius: 2px; transform: rotate(45deg);
  background: var(--cinnabar);
}

/* ───────────── 開運布陣購物清單（產品核心） ───────────── */
.shop-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.shop-card {
  position: relative;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
  transition: transform .18s, box-shadow .22s, border-color .2s;
  overflow: hidden;
}
.shop-card::before { /* 頂緣鎏金細線 */
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright), var(--gold));
  opacity: .85;
}
.shop-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--gold); }

.shop-card__head { display: flex; align-items: flex-start; gap: 14px; }
/* 方位羅盤 badge */
.compass {
  flex: none;
  width: 58px; height: 58px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  background:
    repeating-conic-gradient(from 0deg, transparent 0deg 43deg, rgba(33,28,22,.10) 43deg 45deg),
    var(--paper-sunk);
  display: grid; place-items: center;
  position: relative;
  box-shadow: inset 0 0 0 4px var(--paper-card);
}
.compass__dir {
  font-family: var(--serif); font-weight: 900; font-size: 16px; letter-spacing: -1px;
  color: var(--ink); z-index: 2;
}
.compass__needle {
  position: absolute; left: 50%; top: 50%;
  width: 2px; height: 24px;
  transform-origin: 50% 100%;
  z-index: 1;
}
.compass__needle::before {
  content: ""; position: absolute; left: -3px; top: -2px;
  border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-bottom: 9px solid var(--cinnabar);
}

.shop-card__title { flex: 1; min-width: 0; }
.shop-item {
  font-family: var(--serif); font-weight: 700; font-size: 19px; letter-spacing: 1px;
  line-height: 1.3; margin: 0;
}
.shop-height {
  display: inline-block; margin-top: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: 2px;
  color: var(--ink-soft); background: var(--paper-sunk);
  border: 1px solid var(--line); padding: 2px 9px; border-radius: 4px;
}

.shop-meta { display: flex; flex-wrap: wrap; gap: 7px; margin: 16px 0 0; }
.tag {
  font-size: 11.5px; font-weight: 700; letter-spacing: .5px;
  padding: 3px 10px; border-radius: 4px; border: 1px solid transparent;
}
.tag--method  { color: var(--cinnabar-ink); background: var(--cinnabar-wash); border-color: rgba(192,52,31,.4); }
.tag--reason  { color: var(--ink-soft); background: var(--paper-sunk); border-color: var(--line); }
.tag--own     { color: #FBF1E6; background: var(--gold); }       /* 自營套組 */
.tag--affil   { color: var(--ink); background: transparent; border-color: var(--ink); } /* 聯盟長尾 */

.shop-color {
  margin: 12px 0 0; font-size: 13px; color: var(--ink-soft);
  display: flex; align-items: center; gap: 7px;
}
.shop-color .swatch {
  width: 18px; height: 18px; border-radius: 4px; flex: none;
  border: 1px solid rgba(0,0,0,.18); box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
}
.shop-color b { font-family: var(--serif); color: var(--ink); letter-spacing: 1px; }
.shop-symbol {
  margin: 10px 0 0; font-size: 13px; color: var(--ink-soft);
}
.shop-symbol b { font-family: var(--serif); font-size: 17px; color: var(--cinnabar); letter-spacing: 2px; }
.shop-sub {
  margin: 10px 0 0; font-size: 12.5px; color: var(--gold);
  display: flex; align-items: center; gap: 7px;
}
.shop-sub::before { content: "替"; font-family: var(--serif); font-weight: 700; font-size: 10px; color: #FBF1E6; background: var(--gold); width: 16px; height: 16px; border-radius: 3px; display: grid; place-items: center; flex: none; }

.shop-links { display: flex; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.buy-btn {
  flex: 1;
  text-align: center;
  text-decoration: none;
  font-weight: 700; font-size: 13.5px; letter-spacing: 1px;
  padding: 11px 8px; border-radius: var(--r-md);
  transition: transform .14s, box-shadow .2s, filter .2s;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.buy-btn small { font-size: 10px; opacity: .75; font-weight: 500; letter-spacing: 0; }
.buy-btn--taobao { color: #FBF1E6; background: var(--cinnabar); box-shadow: var(--shadow-sm); }
.buy-btn--shopee { color: var(--ink); background: var(--gold-wash); border: 1px solid var(--gold); }
.buy-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); filter: brightness(1.03); }
.buy-btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

/* ───────────── 頁尾 ───────────── */
.footer {
  max-width: var(--maxw);
  margin: 12px auto 0;
  padding: 26px 22px 40px;
  border-top: 1px solid var(--line);
  font-size: 12px; color: var(--ink-faint);
}
.footer p { margin: 0 0 4px; }
.footer__meta { font-family: var(--mono); font-size: 10.5px; letter-spacing: .5px; }

/* ───────────── 響應式 ───────────── */
@media (min-width: 720px) {
  .masthead__inner { flex-direction: row; align-items: flex-end; justify-content: space-between; }
  .masthead__tag { padding-bottom: 4px; }
  .yong-grid { grid-template-columns: repeat(2, 1fr); }
  .shop-grid { grid-template-columns: repeat(2, 1fr); }
  .headline { grid-template-columns: auto 1fr; align-items: center; }
  .ju-seal { width: fit-content; }   /* 還原為精巧朱印（手機才滿版） */
}

@media (min-width: 1024px) {
  .layout { grid-template-columns: 360px 1fr; }
  /* sticky 不超過視窗高，進階設定展開時面板內部自捲、標題不被推出視窗 */
  .form-panel { position: sticky; top: 22px; max-height: calc(100vh - 44px); overflow-y: auto; }
  .luopan { max-width: 360px; }
}

@media (min-width: 1280px) {
  .shop-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ───────────── 動效尊重 ───────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
