/* 秀灵宫灵签阁 — 漆红鎏金 · 佛韵宫观风 */
:root {
  --lacquer: #6E1423;       /* 漆红 */
  --lacquer-deep: #4A0D18;  /* 深漆 */
  --cinnabar: #C03221;      /* 朱砂 */
  --gold: #D9A441;          /* 鎏金 */
  --gold-pale: #EFD9A7;     /* 淡金 */
  --gold-dim: #9C7325;      /* 暗金 */
  --paper: #F3E9D2;         /* 签纸 */
  --ink: #2B2118;           /* 墨色 */
  --seal: #B5302A;          /* 印泥 */
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { min-height: 100%; }

body {
  font-family: "Kaiti SC", "STKaiti", "KaiTi", "Noto Serif SC", "STSong", "SimSun", serif;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(217, 164, 65, 0.18), transparent 55%),
    linear-gradient(180deg, var(--lacquer-deep), var(--lacquer) 45%, var(--lacquer-deep));
  background-attachment: fixed;
  color: var(--gold-pale);
  overflow-x: hidden;
}

/* 鎏金点阵帛纹 */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; opacity: 0.06; z-index: 0;
  background-image:
    radial-gradient(circle at 25% 30%, var(--gold) 0 2px, transparent 3px),
    radial-gradient(circle at 75% 70%, var(--gold) 0 2px, transparent 3px);
  background-size: 160px 160px;
}

/* ---------- 旋转法轮曼陀罗 ---------- */
.mandala-wrap {
  position: fixed; top: 50%; left: 50%;
  width: min(94vw, 700px); height: min(94vw, 700px);
  transform: translate(-50%, -50%);
  z-index: 0; opacity: 0.13; pointer-events: none;
}
.mandala { width: 100%; height: 100%; animation: mandala-spin 120s linear infinite; }
@keyframes mandala-spin { to { transform: rotate(360deg); } }

/* ---------- 头部 ---------- */
.site-header { position: relative; z-index: 1; text-align: center; padding: 46px 16px 6px; }
.header-seal {
  display: inline-block; border: 2px solid var(--cinnabar); color: #E8856F;
  font-size: 14px; padding: 5px 7px; line-height: 1.2; writing-mode: vertical-rl;
  border-radius: 4px; letter-spacing: 4px; margin-bottom: 14px;
  text-shadow: 0 0 8px rgba(192, 50, 33, 0.8);
  box-shadow: 0 0 12px rgba(192, 50, 33, 0.4), inset 0 0 6px rgba(192, 50, 33, 0.3);
}
.site-title {
  font-size: clamp(34px, 7vw, 52px); font-weight: 700; letter-spacing: 0.3em; margin-right: -0.3em;
  color: var(--gold);
  text-shadow: 0 2px 14px rgba(217, 164, 65, 0.4), 0 0 50px rgba(239, 217, 167, 0.2), 0 2px 2px rgba(0,0,0,0.6);
}
.site-subtitle { margin-top: 10px; color: var(--gold-pale); opacity: 0.7; letter-spacing: 0.4em; margin-right: -0.4em; font-size: 15px; }
.header-divider { margin-top: 18px; color: var(--gold); display: flex; align-items: center; gap: 14px; justify-content: center; font-size: 17px; }
.header-divider::before, .header-divider::after {
  content: ''; height: 1px; width: min(28vw, 220px);
  background: linear-gradient(90deg, transparent, var(--gold));
}
.header-divider::after { background: linear-gradient(270deg, transparent, var(--gold)); }
.lotus-deco { display: block; width: 120px; height: 36px; margin: 8px auto 0; opacity: 0.85; }

/* ---------- 主体 ---------- */
.container { position: relative; z-index: 1; max-width: 720px; margin: 0 auto; padding: 24px 16px 60px; }

.panel {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(217, 164, 65, 0.45);
  border-radius: 10px;
  padding: 30px 26px;
  margin-bottom: 28px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), inset 0 0 40px rgba(217, 164, 65, 0.04);
  position: relative;
}
/* 鎏金回纹角 */
.panel::before, .panel::after {
  content: ''; position: absolute; width: 22px; height: 22px; pointer-events: none;
  border-color: var(--gold); border-style: solid; opacity: 0.85;
}
.panel::before { top: 8px; left: 8px; border-width: 1.5px 0 0 1.5px; }
.panel::after { bottom: 8px; right: 8px; border-width: 0 1.5px 1.5px 0; }

.panel-title { font-size: 23px; color: var(--gold); letter-spacing: 0.12em; display: flex; align-items: center; gap: 12px; }
.title-deco {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border: 1.5px solid var(--gold); border-radius: 50%;
  font-size: 17px; color: var(--gold);
  box-shadow: 0 0 10px rgba(217, 164, 65, 0.4), inset 0 0 8px rgba(217, 164, 65, 0.2);
}
.panel-hint { color: var(--gold-pale); opacity: 0.65; font-size: 14px; margin: 12px 0 22px; letter-spacing: 0.1em; line-height: 1.9; }

.hidden { display: none !important; }

/* ---------- 表单 ---------- */
.birth-form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 520px) { .birth-form { grid-template-columns: 1fr; } }
.form-row label { display: block; font-size: 14px; color: var(--gold); margin-bottom: 7px; letter-spacing: 0.25em; }
.form-row select {
  width: 100%; padding: 12px 14px; font-size: 16px;
  font-family: inherit; color: var(--ink);
  background: rgba(243, 233, 210, 0.95);
  border: 1px solid var(--gold); border-radius: 6px;
  outline: none; cursor: pointer;
}
.form-row select:focus { outline: 3px solid rgba(217, 164, 65, 0.5); }

.btn-main {
  display: block; width: 100%; margin-top: 24px;
  padding: 14px; font-size: 18px; font-family: inherit; letter-spacing: 0.35em; text-indent: 0.35em;
  color: var(--lacquer-deep);
  background: linear-gradient(180deg, var(--gold-pale), var(--gold));
  border: none; border-radius: 6px; cursor: pointer; font-weight: 700;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-main:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255,255,255,0.6); }
.btn-main:active { transform: translateY(1px); }
.btn-main:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn-gold { background: linear-gradient(180deg, #F8E6BC, var(--gold-pale) 50%, var(--gold)); }

.btn-secondary {
  flex: 1; padding: 12px; font-size: 15px; font-family: inherit; letter-spacing: 0.2em; text-indent: 0.2em;
  color: var(--gold); background: transparent;
  border: 1px solid var(--gold); border-radius: 6px; cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover { background: var(--gold); color: var(--lacquer-deep); }

/* ---------- 农历卡片 ---------- */
.lunar-card {
  margin-top: 24px; padding: 22px; text-align: center;
  border: 1px dashed rgba(217, 164, 65, 0.55); border-radius: 8px;
  background: rgba(217, 164, 65, 0.07);
  animation: fade-up 0.6s ease;
}
.lunar-card h3 { color: var(--gold); font-size: 15px; letter-spacing: 0.25em; font-weight: 400; }
.lunar-date { margin-top: 12px; font-size: 24px; color: var(--gold-pale); letter-spacing: 0.1em;
  text-shadow: 0 0 12px rgba(239, 217, 167, 0.35); }
.bazi-line { margin-top: 10px; font-size: 19px; color: var(--gold); letter-spacing: 0.08em; }
.bazi-summary { margin-top: 14px; font-size: 14px; color: var(--gold-pale); opacity: 0.85;
  letter-spacing: 0.1em; line-height: 1.9; }
.lunar-pillars { margin-top: 16px; display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }
.pillar {
  border: 1px solid rgba(217, 164, 65, 0.5); border-radius: 6px;
  padding: 10px 14px; min-width: 72px;
  background: rgba(0, 0, 0, 0.25);
}
.pillar .p-label { font-size: 12px; color: var(--gold); opacity: 0.8; letter-spacing: 0.2em; }
.pillar .p-value { margin-top: 6px; font-size: 20px; color: var(--gold-pale); }

/* ---------- 类别 ---------- */
.category-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 520px) { .category-grid { grid-template-columns: repeat(2, 1fr); } }
.category-btn {
  padding: 20px 8px 16px; font-family: inherit; font-size: 16px; letter-spacing: 0.25em; text-indent: 0.25em;
  color: var(--gold-pale); background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(217, 164, 65, 0.45); border-radius: 8px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  transition: all 0.2s; user-select: none; -webkit-tap-highlight-color: transparent;
}
.cat-icon {
  display: flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 50%;
  border: 1.5px solid var(--gold); color: var(--gold); font-size: 21px;
  text-indent: 0; letter-spacing: 0;
  transition: all 0.2s;
}
.category-btn:hover { transform: translateY(-3px); border-color: var(--gold); background: rgba(217, 164, 65, 0.12); }
.category-btn:hover .cat-icon { background: rgba(217, 164, 65, 0.2); box-shadow: 0 0 14px rgba(239, 217, 167, 0.4); }
.category-btn.sel { border-color: var(--gold); background: rgba(217, 164, 65, 0.2); box-shadow: 0 0 0 1px var(--gold); }

/* ---------- 签筒 ---------- */
.tube-stage { display: flex; justify-content: center; padding: 10px 0; }
.tube-wrap {
  margin: 18px 0; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: transform 0.25s;
}
.tube-wrap:hover { transform: translateY(-4px); }
.tube-wrap:focus-visible { outline: 3px solid var(--gold); outline-offset: 8px; border-radius: 20px; }
.tube { position: relative; width: 170px; height: 260px; }
.stick {
  position: absolute; bottom: 118px; width: 13px; height: 150px; border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, #E8C98C, #C89B5A 60%, #A87B3F);
  box-shadow: inset -2px 0 3px rgba(0, 0, 0, 0.25);
  transform-origin: bottom center;
}
.stick::after {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 26px;
  background: var(--cinnabar); border-radius: 6px 6px 0 0;
}
.stick.chosen {
  background: linear-gradient(180deg, #F5DCA8, #D9A441 60%, #B8862F); z-index: 5;
  animation: rise 1.1s cubic-bezier(0.2, 0.9, 0.3, 1.05) forwards;
}
@keyframes rise {
  0% { transform: translateY(0); }
  60% { transform: translateY(-150px) rotate(-2deg); }
  100% { transform: translateY(-130px); }
}
.tube-body {
  position: absolute; left: 0; right: 0; bottom: 0; height: 185px;
  background: linear-gradient(90deg, #4A0D18 0%, #8C2233 18%, #A93A4B 38%, #8C2233 62%, #5C1322 100%);
  border-radius: 14px 14px 22px 22px / 10px 10px 26px 26px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45), inset 0 8px 14px rgba(255, 255, 255, 0.08);
}
.tube-body::before {
  content: ""; position: absolute; top: -9px; left: -6px; right: -6px; height: 22px;
  background: linear-gradient(180deg, #D9A441, #9C7325); border-radius: 50%/60%;
  box-shadow: inset 0 -4px 6px rgba(0, 0, 0, 0.4);
}
.tube-body::after {
  content: ""; position: absolute; bottom: 14px; left: 0; right: 0; height: 14px;
  background: linear-gradient(180deg, #E2B65A, #9C7325); opacity: 0.9;
}
.tube-char {
  position: absolute; top: 46px; left: 50%; transform: translateX(-50%);
  writing-mode: vertical-rl; font-size: 30px; letter-spacing: 14px; color: var(--gold);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); font-weight: 700; z-index: 2; pointer-events: none;
}
.shaking { animation: shake 0.9s ease-in-out 3; }
@keyframes shake {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(-9deg) translateX(-6px); }
  35% { transform: rotate(8deg) translateX(6px); }
  55% { transform: rotate(-7deg) translateX(-4px); }
  75% { transform: rotate(6deg) translateX(4px); }
}
.shaking .stick:not(.chosen) { animation: rattle 0.22s ease-in-out infinite; }
@keyframes rattle {
  0%, 100% { transform: translateY(0) rotate(var(--tilt, 0deg)); }
  50% { transform: translateY(-10px) rotate(calc(var(--tilt, 0deg) * -1)); }
}
@media (prefers-reduced-motion: reduce) {
  .shaking, .shaking .stick, .stick.chosen { animation-duration: 0.01s !important; animation-iteration-count: 1 !important; }
  .card-flip { transition: none !important; }
  .mandala { animation: none; }
}

/* ---------- 翻面签卡 ---------- */
.card-scene { perspective: 1200px; width: 100%; max-width: 440px; margin: 0 auto; }
.card-flip {
  position: relative; width: 100%; transform-style: preserve-3d;
  transition: transform 1s cubic-bezier(0.3, 0.7, 0.3, 1); transform: rotateY(180deg);
}
.card-flip.show { transform: rotateY(0); }
.card-face { backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 8px; }
.card-back {
  position: absolute; inset: 0; transform: rotateY(180deg);
  background:
    repeating-linear-gradient(45deg, rgba(217, 164, 65, 0.12) 0 12px, transparent 12px 24px),
    linear-gradient(160deg, #8C2233, #5C1322);
  border: 2px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
}
.card-back span { font-size: 54px; color: var(--gold); }
.card-front {
  position: relative; background: var(--paper); color: var(--ink);
  border: 2px solid var(--gold); box-shadow: 0 24px 50px rgba(0, 0, 0, 0.5);
  padding: 30px 26px 34px;
}
.card-front::before {
  content: ""; position: absolute; inset: 10px;
  border: 1px solid rgba(181, 48, 42, 0.5); pointer-events: none;
}
.sign-no { text-align: center; font-size: 14px; letter-spacing: 0.4em; margin-right: -0.4em; color: var(--seal); }
.sign-level {
  text-align: center; font-size: 40px; font-weight: 700; margin: 8px 0 4px;
  letter-spacing: 0.25em; margin-right: -0.25em; color: var(--ink);
}
.sign-level.great { color: var(--seal); }
.sign-title { text-align: center; font-size: 15px; color: #6b5b45; letter-spacing: 0.2em; margin-right: -0.2em; }
.sign-poem { margin: 24px auto 6px; display: flex; justify-content: center; writing-mode: vertical-rl; height: 230px; }
.sign-poem .verse {
  font-size: 21px; line-height: 1; letter-spacing: 0.55em; padding: 0 13px; color: var(--ink);
  border-left: 1px solid rgba(181, 48, 42, 0.35);
}
.sign-poem .verse:last-child { border-right: 1px solid rgba(181, 48, 42, 0.35); }
.seal-stamp {
  position: absolute; right: 24px; bottom: 26px; width: 58px; height: 58px;
  border: 3px solid var(--seal); border-radius: 6px; color: var(--seal);
  display: grid; grid-template-columns: 1fr 1fr; place-items: center;
  font-size: 19px; font-weight: 700; line-height: 1; transform: rotate(-7deg); opacity: 0.85;
  background: rgba(181, 48, 42, 0.06);
}

/* ---------- 解读区 ---------- */
.reading {
  width: 100%; max-width: 440px; margin: 24px auto 0;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(217, 164, 65, 0.45); border-radius: 10px;
  padding: 24px 24px 28px;
  opacity: 0; transform: translateY(14px);
  transition: opacity 0.6s 0.2s, transform 0.6s 0.2s;
  position: relative; overflow: hidden;
}
.reading.show { opacity: 1; transform: none; }
.reading-title { font-size: 15px; color: var(--gold); letter-spacing: 0.4em; margin-right: -0.4em; text-align: center; margin-bottom: 14px; }
.r-sec { margin-bottom: 18px; }
.r-sec h4 { font-size: 14px; color: var(--gold); letter-spacing: 0.25em; margin-bottom: 6px; }
.r-sec h4::before { content: "❁ "; font-size: 11px; vertical-align: 2px; }
.r-sec p { font-size: 14.5px; line-height: 2.05; color: var(--paper); text-align: justify; }

/* 锁定遮罩 */
.locked-zone { position: relative; }
.locked-zone .paid-content.blurred { filter: blur(7px); user-select: none; pointer-events: none; opacity: 0.8; }
.lock-overlay {
  position: absolute; inset: -6px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center; gap: 10px;
  background: linear-gradient(180deg, rgba(74, 13, 24, 0) 0%, rgba(74, 13, 24, 0.88) 26%, rgba(74, 13, 24, 0.96) 100%);
  border-radius: 8px; padding: 30px 18px 22px;
}
.lock-overlay .lk-ico { font-size: 30px; color: var(--gold); }
.lock-overlay .lk-t { font-size: 17px; letter-spacing: 0.25em; margin-right: -0.25em; color: var(--gold); }
.lock-overlay .lk-d { font-size: 13px; opacity: 0.75; line-height: 1.9; }
.unlock-btn {
  margin-top: 6px; padding: 12px 38px; font-family: inherit; font-size: 16px; font-weight: 700;
  letter-spacing: 0.2em; color: var(--lacquer-deep); border: none; border-radius: 30px; cursor: pointer;
  background: linear-gradient(180deg, var(--gold-pale), var(--gold));
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4); transition: transform 0.15s;
}
.unlock-btn:hover { transform: translateY(-2px); }

.result-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 30px; max-width: 440px; margin-left: auto; margin-right: auto; }
.result-actions .btn-secondary { flex: 1 1 calc(50% - 7px); min-width: 120px; }

/* 签图分享 */
.share-img { display: block; width: 100%; max-height: 56vh; object-fit: contain; margin-top: 14px;
  border: 1px solid var(--gold); border-radius: 6px; background: var(--paper); }
.share-dl { display: block; text-align: center; text-decoration: none; margin-top: 14px; padding: 12px; }

/* ---------- 解锁弹窗（纸色） ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 0, 0, 0.65); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.modal-card {
  position: relative; width: 100%; max-width: 380px;
  background: var(--paper); color: var(--ink);
  border: 2px solid var(--gold); border-radius: 12px;
  padding: 28px 26px 22px; text-align: center;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
  animation: fade-up 0.3s ease;
}
.modal-close {
  position: absolute; top: 10px; right: 12px;
  background: none; border: none; color: #8a7a60; font-size: 18px; cursor: pointer;
}
.modal-close:hover { color: var(--seal); }
.modal-title { color: var(--seal); font-size: 20px; letter-spacing: 0.3em; margin-right: -0.3em; }
.modal-hint { margin-top: 14px; color: var(--ink); font-size: 15px; }
.modal-hint b { color: var(--seal); }
.modal-hint.small { font-size: 13px; color: #8a7a60; }
.qr-box {
  width: 200px; height: 200px; margin: 16px auto 0;
  border: 2px dashed var(--seal); border-radius: 8px;
  background: #fff; display: flex; align-items: center; justify-content: center;
  padding: 8px; overflow: hidden;
}
.qr-img { width: 100%; height: 100%; object-fit: contain; }
.unlock-input-row { display: flex; gap: 10px; margin-top: 16px; }
.unlock-input-row input {
  flex: 1; min-width: 0; padding: 12px; font-size: 15px; font-family: inherit;
  color: var(--ink); background: #fff;
  border: 1px solid var(--gold); border-radius: 6px; outline: none;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.unlock-input-row input:focus { outline: 3px solid rgba(217, 164, 65, 0.5); }
.unlock-input-row .btn-main { width: auto; margin: 0; padding: 12px 22px; font-size: 16px; }
.unlock-error { margin-top: 12px; color: var(--seal); font-size: 14px; min-height: 20px; }

/* ---------- 页脚 ---------- */
.site-footer {
  position: relative; z-index: 1; text-align: center; padding: 24px 16px 38px;
  color: var(--gold-pale); opacity: 0.5; font-size: 12.5px; letter-spacing: 0.22em; line-height: 2;
}
.site-footer a { color: var(--gold); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

@keyframes fade-up { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* ---------- 签文目录/详情页 ---------- */
.qian-nav { text-align: center; margin-bottom: 22px; }
.qian-nav a { color: var(--gold); text-decoration: none; font-size: 14px; letter-spacing: 0.15em; }
.qian-nav a:hover { text-decoration: underline; }
.qian-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.qian-grid a {
  display: block; padding: 16px 14px; text-decoration: none;
  background: rgba(0, 0, 0, 0.2); border: 1px solid rgba(217, 164, 65, 0.4); border-radius: 8px;
  color: var(--gold-pale); transition: all 0.2s;
}
.qian-grid a:hover { border-color: var(--gold); background: rgba(217, 164, 65, 0.12); transform: translateY(-2px); }
.qian-grid .g-no { font-size: 12px; color: var(--gold); letter-spacing: 0.15em; }
.qian-grid .g-title { margin-top: 6px; font-size: 18px; letter-spacing: 0.1em; }
.qian-grid .g-level { margin-top: 4px; font-size: 13px; color: #E8856F; }
.detail-paper {
  background: var(--paper); color: var(--ink); border: 2px solid var(--gold); border-radius: 8px;
  padding: 30px 26px; position: relative; max-width: 480px; margin: 0 auto;
}
.detail-paper::before { content: ""; position: absolute; inset: 10px; border: 1px solid rgba(181, 48, 42, 0.5); pointer-events: none; }
.detail-paper .sign-poem { height: 230px; }
.detail-extra { max-width: 480px; margin: 22px auto 0; }
.detail-extra .r-sec p { color: var(--paper); }
.qian-pager { display: flex; justify-content: space-between; max-width: 480px; margin: 26px auto 0; }
.qian-pager a { color: var(--gold); text-decoration: none; font-size: 14px; letter-spacing: 0.1em; }
.qian-pager a:hover { text-decoration: underline; }
