/* ===========================================================
   關理錢莊 · 還陰債系統 共用樣式
   風格：中式廟堂金紅配色，莊重、可信、帶一點溫暖
=========================================================== */

:root {
  --gold: #c9a24b;
  --gold-light: #e8cd85;
  --gold-deep: #a8791f;
  --red-deep: #6e0f0f;
  --red: #8b1e1e;
  --red-bright: #b3272c;
  --cream: #fdf6e6;
  --cream-2: #f7ecd3;
  --ink: #2a1a10;
  --ink-soft: #5a4632;
  --line: #e4d5b8;
  --shadow: 0 10px 30px rgba(110, 15, 15, 0.15);
  --radius: 16px;
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: "Noto Serif SC", "PingFang SC", "Microsoft YaHei", "Songti SC", serif;
  scroll-behavior: smooth;
}

img { max-width: 100%; display: block; }

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

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- 頂部品牌條 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(180deg, var(--red-deep), var(--red));
  color: var(--gold-light);
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 2px;
}
.brand img { width: 40px; height: 40px; border-radius: 50%; box-shadow: 0 0 0 2px var(--gold); }
.brand .name-cn { font-size: 1.15rem; }
.brand .name-en { font-size: 0.7rem; opacity: 0.75; letter-spacing: 1px; }
/* ---------- 中英文雙語（同頁顯示，不切換） ---------- */
.i18n { display: block; }
.i18n .zh { display: block; }
.i18n .en {
  display: block;
  font-size: 0.82em;
  opacity: 0.68;
  font-style: italic;
  font-weight: 400;
  margin-top: 3px;
}
h1 .i18n .en, h2 .i18n .en, h3 .i18n .en, summary .i18n .en {
  font-style: normal;
  letter-spacing: 0.2px;
}

.topbar-cta {
  background: var(--gold);
  color: var(--red-deep);
  padding: 8px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

/* ---------- 通用區塊 ---------- */
section { padding: 64px 0; }
.section-tight { padding: 40px 0; }

.eyebrow {
  display: inline-block;
  color: var(--red);
  font-weight: 700;
  letter-spacing: 4px;
  font-size: 0.8rem;
  border: 1px solid var(--red);
  padding: 4px 14px;
  border-radius: 999px;
  margin-bottom: 16px;
}
h1, h2, h3 { color: var(--red-deep); margin: 0 0 16px; line-height: 1.4; }
h1 { font-size: 2.2rem; }
h2 { font-size: 1.75rem; text-align: center; }
h3 { font-size: 1.2rem; }
p { line-height: 1.9; color: var(--ink-soft); }
.center { text-align: center; }
.lead { font-size: 1.05rem; }

.divider {
  width: 64px;
  height: 3px;
  background: var(--gold);
  margin: 12px auto 32px;
  border-radius: 3px;
}

/* ---------- 按鈕 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 30px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-primary {
  background: linear-gradient(135deg, var(--gold-light), var(--gold) 60%, var(--gold-deep));
  color: var(--red-deep);
  box-shadow: 0 8px 20px rgba(212,175,55,0.45);
}
.btn-primary:hover { box-shadow: 0 10px 26px rgba(212,175,55,0.6); }
.btn-whatsapp {
  background: #25d366;
  color: #06381d;
  box-shadow: 0 8px 20px rgba(37,211,102,0.4);
}
.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--gold-deep);
  color: var(--red-deep);
}
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- 卡片 ---------- */
.card {
  background: #fffdf6;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}
.grid {
  display: grid;
  gap: 20px;
}
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 860px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  h1 { font-size: 1.7rem; }
}

/* ---------- Hero ---------- */
.hero {
  background:
    radial-gradient(circle at 20% 20%, rgba(212,175,55,0.18), transparent 40%),
    radial-gradient(circle at 80% 0%, rgba(139,30,30,0.12), transparent 45%),
    var(--cream-2);
  padding: 72px 0 56px;
  border-bottom: 1px solid var(--line);
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: center;
}
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; } }
.hero-badges { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0 26px; }
.badge {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--red);
  font-size: 0.82rem;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 600;
}
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; }
.hero-visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.coin-wrap {
  width: 320px;
  max-width: 80vw;
  animation: spin-slow 16s linear infinite;
  filter: drop-shadow(0 20px 30px rgba(139,30,30,0.35));
}
@keyframes spin-slow { from { transform: rotateY(0deg);} to { transform: rotateY(360deg);} }

/* ---------- 痛點 ---------- */
.pain-card {
  text-align: center;
  padding: 26px 20px;
}
.pain-icon { font-size: 2.2rem; margin-bottom: 10px; }
.pain-card h3 { margin-bottom: 8px; }
.pain-card p { font-size: 0.92rem; }

.section-alt { background: var(--cream-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

/* ---------- 步驟 ---------- */
.steps { counter-reset: step; }
.step-item {
  display: flex;
  gap: 18px;
  padding: 18px 0;
  border-bottom: 1px dashed var(--line);
}
.step-item:last-child { border-bottom: none; }
.step-num {
  flex: none;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-light), var(--gold-deep));
  color: var(--red-deep);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
}
.step-body h3 { margin: 0 0 6px; }
.step-body p { margin: 0; font-size: 0.94rem; }

/* ---------- 陰債分類展示 ---------- */
.suit-card { border-top: 4px solid var(--gold); }
.suit-card .suit-icon { font-size: 1.8rem; }
.suit-card.spade { border-top-color: #2a2a2a; }
.suit-card.diamond { border-top-color: #b3272c; }
.suit-card.heart { border-top-color: #d4487a; }
.suit-card.club { border-top-color: #2f6b3f; }
.suit-count { color: var(--red); font-weight: 800; font-size: 1.6rem; }

/* ---------- FAQ ---------- */
details.faq {
  background: #fffdf6;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 12px;
}
details.faq summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--red-deep);
  list-style: none;
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "＋"; float: right; color: var(--gold-deep); }
details.faq[open] summary::after { content: "－"; }
details.faq p { margin: 10px 0 0; }

/* ---------- Footer ---------- */
footer {
  background: linear-gradient(180deg, var(--red), var(--red-deep));
  color: var(--gold-light);
  padding: 40px 0 24px;
  text-align: center;
}
footer .brand { justify-content: center; margin-bottom: 10px; }
footer p { color: rgba(243,217,139,0.75); font-size: 0.85rem; }

/* ---------- 懸浮 WhatsApp 按鈕 ---------- */
.float-wa {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 999;
  background: #25d366;
  color: #06381d;
  width: 60px; height: 60px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(37,211,102,0.55); }
  70% { box-shadow: 0 0 0 14px rgba(37,211,102,0); }
  100% { box-shadow: 0 0 0 0 rgba(37,211,102,0); }
}

/* ===========================================================
   互動排盤系統 (app.html) 專用樣式
=========================================================== */
.app-shell {
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 0%, rgba(212,175,55,0.15), transparent 40%),
    radial-gradient(circle at 90% 10%, rgba(139,30,30,0.12), transparent 45%),
    var(--cream);
  padding-bottom: 60px;
}
.app-header {
  background: linear-gradient(180deg, var(--red-deep), var(--red));
  padding: 18px 0;
  color: var(--gold-light);
}
.app-header .container { display: flex; justify-content: space-between; align-items: center; }
.progress-track {
  max-width: 1080px;
  margin: 18px auto 0;
  padding: 0 24px;
  display: flex;
  gap: 6px;
}
.progress-seg {
  flex: 1;
  height: 6px;
  border-radius: 4px;
  background: rgba(255,255,255,0.15);
}
.progress-seg.done { background: var(--gold); }
.progress-seg.current { background: var(--gold-light); }

.stage {
  max-width: 720px;
  margin: 36px auto 0;
  padding: 0 24px;
}
.stage-card {
  background: #fffdf6;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 32px;
}
.stage-tag {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--red);
  background: var(--cream-2);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 700; color: var(--red-deep); margin-bottom: 6px; font-size: 0.92rem; }
.field input, .field select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 1rem;
  font-family: inherit;
  color: var(--ink);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } }
.hint { font-size: 0.82rem; color: var(--ink-soft); margin-top: 6px; }

/* 擲筊 */
.jiao-stage { text-align: center; }
.mantra-box {
  background: var(--cream-2);
  border: 1px dashed var(--gold-deep);
  border-radius: 14px;
  padding: 18px;
  margin: 18px 0 26px;
  font-size: 1.05rem;
  color: var(--red-deep);
  font-weight: 700;
}
.jiao-pair {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin: 24px 0;
  perspective: 600px;
}
/* 🔴 2026-08-20 修：拿掉「用 CSS 画杯」的旧写法。
   原本这里有 border-radius + background 渐层 + inset box-shadow，
   是圣杯还没有实图时用纯 CSS 画的。後来加了 PNG（见下方 .jiao-piece .jiao-img），
   **但旧的背景没删** → PNG 盖在那个深色圆角块上，块的底部露在外面，
   而 `.jiao-piece.flat` 换的是那个**背景**的颜色 →
   看起来就是「上面尖角永远不变，底部在暗亮两色之间跳」（Tom 2026-08-20 回报）。
   🔴 正确做法同三才燈的 .jiao-block：容器不画任何东西，只负责定位与投影，
      明暗完全交给 .flat / .round 两张图切换。 */
.jiao-piece {
  width: 74px; height: 110px;
  position: relative;
  filter: drop-shadow(0 8px 8px rgba(0,0,0,.35));
  transition: transform .6s cubic-bezier(.2,.8,.3,1.2);
}
.jiao-piece.flipping { animation: jiao-flip .6s ease; }
@keyframes jiao-flip {
  0% { transform: rotateY(0deg) translateY(0); }
  40% { transform: rotateY(360deg) translateY(-40px); }
  100% { transform: rotateY(720deg) translateY(0); }
}
.jiao-result {
  font-size: 1.4rem;
  font-weight: 800;
  margin: 18px 0 6px;
  min-height: 1.8em;
}
.jiao-result.sheng { color: #1f7a3f; }
.jiao-result.yin { color: var(--red); }
.jiao-result.xiao { color: var(--gold-deep); }
.jiao-log { font-size: 0.82rem; color: var(--ink-soft); min-height: 1.4em; margin-bottom: 14px; }

/* 撲克牌 */
.deck-stage { text-align: center; }
.card-slot {
  width: 140px; height: 200px;
  margin: 20px auto;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--red), var(--red-deep));
  border: 3px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
  color: var(--gold-light);
  font-size: 2.4rem;
  box-shadow: var(--shadow);
  transition: transform .5s ease;
}
.card-slot.flipped { background: #fffdf6; color: var(--ink); }
.card-slot.flipping { animation: shuffle-spin .7s ease; }
@keyframes shuffle-spin {
  0% { transform: rotate(0deg) scale(1); }
  35% { transform: rotate(200deg) scale(1.08); }
  70% { transform: rotate(380deg) scale(1.08); }
  100% { transform: rotate(360deg) scale(1); }
}
.card-slot .pip { font-size: 2.8rem; font-weight: 800; }
.card-slot.suit-spade .pip, .card-slot.suit-club .pip { color: #222; }
.card-slot.suit-diamond .pip, .card-slot.suit-heart .pip { color: var(--red-bright); }
.card-back-mark { font-size: 2rem; }

.result-line {
  background: var(--cream-2);
  border-radius: 12px;
  padding: 14px 18px;
  margin: 14px 0;
  font-size: 0.95rem;
  color: var(--ink);
  text-align: left;
}
.result-line b { color: var(--red-deep); }

.choice-list { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.choice-btn {
  text-align: left;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
}
.choice-btn.active { border-color: var(--gold-deep); background: var(--cream-2); font-weight: 700; }

.actions-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; }

/* 明細表 / 彙總 */
.summary-table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 0.92rem; }
.summary-table th, .summary-table td { border-bottom: 1px solid var(--line); padding: 10px 8px; text-align: left; }
.summary-table th { color: var(--red-deep); }
.summary-total {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: var(--red-deep);
  border-radius: 14px;
  padding: 20px;
  text-align: center;
  font-size: 1.3rem;
  font-weight: 800;
  margin: 20px 0;
}
.summary-total small { display: block; font-size: 0.8rem; font-weight: 500; margin-top: 4px; }

.log-panel {
  max-height: 220px;
  overflow-y: auto;
  background: #fffaf0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.78rem;
  color: var(--ink-soft);
  font-family: "SF Mono", Consolas, monospace;
}
.log-panel div { padding: 2px 0; border-bottom: 1px dotted #eadfb8; }

/* ---------- 陰陽司公問答聊天窗口 ---------- */
.chat-overlay {
  position: fixed;
  inset: 0;
  background: rgba(42, 26, 16, 0.55);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
@media (min-width: 640px) {
  .chat-overlay { align-items: center; }
}
.chat-panel {
  background: var(--cream);
  width: 100%;
  max-width: 480px;
  max-height: 82vh;
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.35);
  overflow: hidden;
}
@media (min-width: 640px) {
  .chat-panel { border-radius: 20px; max-height: 640px; margin-bottom: 20px; }
}
.chat-header {
  background: linear-gradient(135deg, var(--red-deep), var(--red));
  color: var(--gold-light);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chat-header .title { font-weight: 800; display: flex; align-items: center; gap: 8px; }
.chat-header .sub { font-size: 0.72rem; opacity: 0.8; font-weight: 400; display: block; }
.chat-close {
  background: rgba(255,255,255,0.15);
  border: none;
  color: var(--gold-light);
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--cream-2);
}
.chat-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.6;
}
.chat-bubble.bot {
  align-self: flex-start;
  background: #fffdf6;
  border: 1px solid var(--line);
  color: var(--ink);
  border-bottom-left-radius: 4px;
}
.chat-bubble.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: var(--red-deep);
  font-weight: 600;
  border-bottom-right-radius: 4px;
}
.chat-bubble.typing { color: var(--ink-soft); font-style: italic; }
.chat-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 10px;
  background: var(--cream-2);
}
.chat-quick button {
  font-size: 0.78rem;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--red-deep);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
}
.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 12px;
  background: #fffdf6;
  border-top: 1px solid var(--line);
}
.chat-input-row input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 16px;
  font-family: inherit;
  font-size: 0.9rem;
}
.chat-input-row button {
  background: linear-gradient(135deg, var(--gold-light), var(--gold-deep));
  color: var(--red-deep);
  border: none;
  border-radius: 999px;
  padding: 0 20px;
  font-weight: 700;
  cursor: pointer;
}

.round-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--red-deep);
  color: var(--gold-light);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}

/* ── PDPA 同意區塊（2026-08-12 接線時新增）────────────────────── */
.consent-box{
  margin:18px 0 10px; padding:14px 16px;
  background:rgba(243,217,139,.08);
  border:1px solid rgba(243,217,139,.35); border-radius:10px;
}
.consent-line{ display:flex; align-items:flex-start; gap:10px; cursor:pointer; }
.consent-line input[type="checkbox"]{ margin-top:3px; width:17px; height:17px; flex:0 0 auto; cursor:pointer; }
.consent-line span{ font-size:.85rem; line-height:1.65; }
.consent-more{ margin-top:10px; font-size:.78rem; padding:5px 12px; }
.consent-full{
  margin-top:12px; max-height:260px; overflow:auto;
  white-space:pre-wrap; word-break:break-word;
  font-size:.78rem; line-height:1.7; font-family:inherit;
  background:rgba(0,0,0,.18); padding:12px 14px; border-radius:8px;
}

/* ── 筊杯真圖（Alex 2026-08-16 交付；原本是純 CSS 畫的）────────────────
   🔴 圖片絕對定位疊在 .jiao-piece 上，靠 .flat / .round class 切換 opacity。
      擲筊中 .casting 讓兩面快速交替閃爍 = 翻滾感。 */
.jiao-piece .jiao-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
}
.jiao-piece .jiao-img-flat  { opacity: 0; }
.jiao-piece .jiao-img-round { opacity: 1; }
.jiao-piece.flat  .jiao-img-flat  { opacity: 1; }
.jiao-piece.flat  .jiao-img-round { opacity: 0; }
.jiao-piece.round .jiao-img-round { opacity: 1; }
.jiao-piece.round .jiao-img-flat  { opacity: 0; }
.jiao-piece.casting .jiao-img-flat  { animation: jiaoFlickerFlat  .12s steps(1) infinite; }
.jiao-piece.casting .jiao-img-round { animation: jiaoFlickerRound .12s steps(1) infinite; }
@keyframes jiaoFlickerFlat  { 0%, 100% { opacity: 0; } 50% { opacity: 1; } }
@keyframes jiaoFlickerRound { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* ── 常见征兆 section（Alex 2026-08-16 新增内容用到）────────────── */
.symptom-list { margin: 0; padding-left: 1.2em; }
.symptom-list li { font-size: 0.92rem; line-height: 1.6; margin-bottom: 6px; }
.symptom-card h3 { margin-bottom: 10px; }
.note-box {
  background: var(--cream-2);
  border: 1px dashed var(--gold-deep);
  border-radius: 14px;
  padding: 16px 18px;
  margin-top: 24px;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

/* ── 受生債經文全文（2026-08-21 · Alex 交件內容）──────────────────────
   只加 `.scripture-body`：`.intro-box` 在合併後的 HTML 裡**一次都沒用到**，
   不加沒用的規則。
   🔴 這一段在**普通 `<section>`（底色 --cream #fdf6e6）**，不是 `.section-alt`。
      金色小標 #a8791f on #fdf6e6 = 3.60:1，過 WCAG AA 大字級（需 3.0）。
      別把它搬到深底 section —— 那要換色（MKCA 鐵律 3）。 */
.scripture-body h4 {
  color: var(--gold-deep);
  font-size: 0.85rem;
  letter-spacing: 1px;
  margin: 20px 0 4px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.scripture-body h4:first-child { margin-top: 10px; padding-top: 0; border-top: none; }
.scripture-body p { line-height: 1.8; }
