/* 招财平安符页面样式。一页为符：朱砂红纸、黄纸、玄墙、墨、金。 */

:root {
  --wall: #0b0908;
  --zhu: #de3b2c;
  --zhu-lo: #b3271c;
  --zhu-print: rgba(112, 8, 6, .46);
  --huang: #f3b93b;
  --ink: #17110e;
  --ink-a: rgba(23, 17, 14, .74);
  --ink-b: rgba(23, 17, 14, .36);
  --gold: #dcb468;
  --gold-hi: #f8e7b6;
  --gold-a: rgba(220, 180, 104, .68);
  --gold-b: rgba(220, 180, 104, .3);
  --gold-c: rgba(220, 180, 104, .15);
  --cream: #f1e8d5;
  --cream-a: rgba(241, 232, 213, .76);
  --cream-b: rgba(241, 232, 213, .48);
  --foil: linear-gradient(168deg, #fcefc6 0%, #e8c57e 30%, #b98a3e 58%, #f1d696 82%, #c89a4c 100%);
  --f-brush: "Ma Shan Zheng", "Kaiti SC", "STKaiti", "KaiTi", serif;
  --f-wei: "ZCOOL XiaoWei", "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  --f-song: "Noto Serif SC", "Songti SC", "STSong", "Noto Serif CJK SC", "SimSun", serif;
  /* 页面最宽 480 像素。--vw 是页面宽度的百分之一。 */
  --vw: min(1vw, 4.8px);
  --pad: calc(var(--vw) * 6);
  /* 每一张纸都斜着贴。--cut 是纸边两端的高度差，--tilt 是对应的角度。 */
  --cut: calc(var(--vw) * 4);
  --tilt: -2.29deg;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --grain-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .22 0 0 0 0 .02 0 0 0 0 0 0 0 0 .3 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --grain-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 .92 0 0 0 0 .78 0 0 0 .11 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: #050403;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

/* 禁用下拉刷新和缩放。overscroll-behavior 管下拉刷新和顶部回弹，touch-action 管双指缩放和双击缩放。 */
html,
body {
  overscroll-behavior-y: none;
  touch-action: pan-x pan-y;
}

html.lock {
  overflow: hidden;
}

body {
  margin: 0;
  color: var(--cream);
  font-family: var(--f-song);
  font-weight: 500;
  font-size: 15px;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

h1,
h2,
h3,
p,
ul,
dl,
dd,
figure {
  margin: 0;
  padding: 0;
  font-weight: inherit;
}

ul {
  list-style: none;
}

i {
  font-style: normal;
}

b {
  font-weight: inherit;
}

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

button {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

img {
  display: block;
  max-width: none;
}

:focus-visible {
  outline: 1px solid var(--gold-hi);
  outline-offset: 3px;
}

.defs {
  position: absolute;
}

.dust {
  position: fixed;
  inset: 0;
  z-index: 5;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ---------- 玄墙 ---------- */

.page {
  position: relative;
  z-index: 0;
  max-width: 480px;
  margin: 0 auto;
  overflow: hidden;
  background: var(--wall);
}

.page::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .6;
  background-image: var(--grain-light);
}

.page > * {
  position: relative;
  z-index: 1;
}

/* ---------- 纸 ---------- */

.paper {
  color: var(--ink);
  isolation: isolate;
}

.paper::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  pointer-events: none;
}

/* 洒金红纸 */
.paper-red {
  background: var(--zhu);
}

.paper-red::before {
  background-image:
    url("assets/fleck.svg"),
    var(--grain-dark),
    radial-gradient(90% 420px at 10% 0, rgba(255, 126, 92, .5), transparent 72%),
    radial-gradient(90% 460px at 100% 100%, rgba(142, 16, 10, .42), transparent 74%);
  background-size: 560px 560px, 220px 220px, 100% 100%, 100% 100%;
}

/* 黄纸 */
.paper-yellow {
  background: var(--huang);
}

.paper-yellow::before {
  background-image:
    var(--grain-dark),
    radial-gradient(90% 400px at 0 0, rgba(255, 233, 150, .6), transparent 72%),
    radial-gradient(90% 440px at 100% 100%, rgba(196, 118, 12, .36), transparent 74%);
  background-size: 220px 220px, 100% 100%, 100% 100%;
}

/* 纸上的木刻印：字压在印上，和原符一样 */
.print {
  position: absolute;
  z-index: -1;
  writing-mode: vertical-rl;
  padding: 11px 9px 9px;
  border: 2px solid currentColor;
  box-shadow: inset 0 0 0 4px transparent, inset 0 0 0 5px currentColor;
  color: var(--zhu-print);
  font-family: var(--f-wei);
  font-size: calc(var(--vw) * 4.4);
  line-height: 1.55;
  letter-spacing: .34em;
  white-space: nowrap;
  pointer-events: none;
  filter: url(#rough);
}

.print span {
  display: block;
}

.print-a {
  top: calc(var(--vw) * 24);
  right: calc(var(--vw) * 5);
  transform: rotate(2.5deg);
}

.print-b {
  top: calc(var(--vw) * 74);
  left: calc(var(--vw) * 7);
  transform: rotate(-3deg);
}

.print-c {
  top: calc(var(--vw) * 14);
  right: calc(var(--vw) * 7);
  color: rgba(204, 30, 18, .74);
  transform: rotate(4deg);
}

/* 文字之间的小圆点 */
.topbar-date i,
.duty span i,
.seal-hint i,
.photo figcaption i,
.card-paper i,
.viewer-name i {
  display: inline-block;
  width: 3px;
  height: 3px;
  margin: 0 .7em;
  border-radius: 50%;
  background: currentColor;
  vertical-align: middle;
}

/* 金箔字 */
.head-gold h2,
.card-name,
.seal-core b,
.foot-main {
  background: var(--foil);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

/* ---------- 莲纹 ---------- */

.lotus {
  position: absolute;
  overflow: hidden;
  pointer-events: none;
  aspect-ratio: 2 / 1;
}

.lotus img {
  position: absolute;
  left: 0;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  animation: turn 150s linear infinite;
  will-change: transform;
}

.lotus-up {
  right: -17%;
  bottom: 54%;
  width: 96%;
  border-bottom: 1.5px solid var(--gold);
  opacity: .78;
}

.lotus-up img {
  top: 0;
}

.lotus-down {
  top: 46%;
  left: -24%;
  width: 90%;
  border-top: 1.5px solid var(--gold);
  opacity: .7;
}

.lotus-down img {
  bottom: 0;
  animation-direction: reverse;
}

@keyframes turn {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- 首屏：一页红纸，横过一道玄墙 ---------- */

.hero {
  z-index: 3;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) var(--pad) calc(var(--cut) + 16px);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--cut)), 0 100%);
}

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 11px;
  border-bottom: 3px solid var(--ink);
  font-family: var(--f-wei);
  font-size: 12.5px;
  line-height: 1;
  letter-spacing: .2em;
}

.topbar::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -7px;
  left: 0;
  height: 1px;
  background: var(--ink);
}

.topbar-date {
  white-space: nowrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px 8px 11px;
  border-radius: 999px;
  background: var(--ink);
  box-shadow: 0 5px 12px rgba(80, 8, 4, .35);
  color: var(--gold-hi);
  letter-spacing: .14em;
  white-space: nowrap;
}

.chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff9a4a;
  box-shadow: 0 0 8px 2px rgba(255, 122, 46, .8);
  animation: ember 2.4s ease-in-out infinite;
}

@keyframes ember {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: .72;
    transform: scale(.82);
  }
}

.title-zone {
  position: relative;
  margin-top: 22px;
}

/* 四个大字分两列，右起竖读。左列下沉半字。 */
.title {
  display: flex;
  flex-direction: row-reverse;
  justify-content: space-between;
  margin: 0 -3px;
  font-family: var(--f-brush);
  font-size: calc(var(--vw) * 42.4);
  font-size: min(calc(var(--vw) * 42.4), 20.4svh);
  line-height: .97;
}

.title-col {
  display: flex;
  flex-direction: column;
}

.title-col-2 {
  margin-top: .55em;
}

.title b {
  display: block;
  width: 1em;
  text-align: center;
  filter: url(#rough);
}

/* 金箔印 */
.stamp {
  position: absolute;
  top: calc(var(--vw) * 2.4);
  left: calc(var(--vw) * 3);
  writing-mode: vertical-rl;
  height: 2.8em;
  padding: .28em .24em;
  border-radius: .2em;
  background: var(--foil);
  box-shadow: 0 6px 14px rgba(84, 8, 4, .38);
  color: var(--zhu-lo);
  font-family: var(--f-wei);
  font-size: calc(var(--vw) * 5.6);
  line-height: 1.12;
  transform: rotate(-6deg);
  filter: url(#rough);
}

.lede {
  position: absolute;
  right: 0;
  bottom: calc(var(--vw) * 1.6);
  width: calc(var(--vw) * 40);
  padding-left: 12px;
  border-left: 1px solid var(--ink);
  font-size: 13px;
  line-height: 1.82;
  letter-spacing: .08em;
}

/* 横过红纸的一道玄墙，八道符贴在墙上 */
.wall {
  position: relative;
  z-index: 1;
  margin: calc(var(--vw) * 5.6) calc(var(--pad) * -1 - 8vw) 0;
  padding: calc(var(--vw) * 6.6) calc(var(--pad) + 8vw) calc(var(--vw) * 4.4);
  overflow: hidden;
  background: var(--wall) var(--grain-light);
  box-shadow: inset 0 1px 0 rgba(220, 180, 104, .4), inset 0 -1px 0 rgba(220, 180, 104, .4);
  transform: rotate(var(--tilt));
}

.wall-stage {
  position: relative;
}

.wall-row,
.wall-tags {
  position: relative;
  z-index: 2;
  display: flex;
  gap: calc(var(--vw) * 1.9);
}

.wall-fu {
  flex: var(--ar) 1 0%;
  min-width: 0;
  transform: translateY(var(--y));
  transition: transform .7s var(--ease);
}

.strip {
  display: block;
  transform: rotate(var(--r));
  transform-origin: 50% 0;
  box-shadow: 0 8px 16px rgba(0, 0, 0, .6);
  transition: box-shadow .6s var(--ease);
  animation: sway calc(5.6s + var(--d) * .37s) ease-in-out calc(var(--d) * -.9s) infinite;
}

.strip img {
  width: 100%;
  height: auto;
  transition: filter 1s;
}

@keyframes sway {
  0%,
  100% {
    transform: rotate(calc(var(--r) - .55deg));
  }
  50% {
    transform: rotate(calc(var(--r) + .55deg));
  }
}

.wall-fu.is-duty .strip {
  box-shadow: 0 0 0 1px rgba(248, 231, 182, .9), 0 0 22px 5px rgba(232, 190, 110, .62), 0 10px 18px rgba(0, 0, 0, .6);
}

.wall-fu.is-duty {
  transform: translateY(calc(var(--y) - 7px));
}

.wall-tags {
  margin-top: 15px;
  font-family: var(--f-wei);
  font-size: 11.5px;
  line-height: 1.25;
  color: var(--gold-a);
}

.wall-tags span {
  flex: var(--ar) 1 0%;
  min-width: 0;
  display: flex;
  align-items: center;
  writing-mode: vertical-rl;
  letter-spacing: .12em;
  transition: color .6s;
}

.wall-tags span.is-duty {
  color: var(--gold-hi);
  text-shadow: 0 0 10px rgba(232, 190, 110, .9);
}

.hero-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: calc(var(--vw) * 5.4);
  font-family: var(--f-wei);
}

.duty {
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: .16em;
}

.duty span i {
  margin: 0 .55em;
}

.down {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 9px;
  font-size: 11px;
  line-height: 1;
  letter-spacing: .32em;
}

.down i {
  width: 1px;
  height: 30px;
  background: var(--ink);
  transform-origin: 50% 0;
  animation: drip 2.4s var(--ease) infinite;
}

@keyframes drip {
  0% {
    transform: scaleY(0);
    opacity: 1;
  }
  60% {
    transform: scaleY(1);
    opacity: 1;
  }
  100% {
    transform: scaleY(1);
    opacity: 0;
  }
}

/* 首屏入场。脚本可用时，入场前先隐藏。动画结束后，元素回到自身样式。 */
.js:not(.ready) .topbar,
.js:not(.ready) .lede,
.js:not(.ready) .hero .print,
.js:not(.ready) .wall-tags,
.js:not(.ready) .hero-foot,
.js:not(.ready) .hero .lotus,
.js:not(.ready) .wall-fu,
.js:not(.ready) .stamp {
  opacity: 0;
}

.js:not(.ready) .title b {
  clip-path: inset(0 0 100% 0);
}

.js:not(.ready) .wall {
  clip-path: inset(0 100% 0 0);
}

.js.ready .topbar {
  animation: fade 1s var(--ease) .05s backwards;
}

.js.ready .hero .print {
  animation: fade 1.6s var(--ease) .1s backwards;
}

.js.ready .title b {
  animation: brush .75s cubic-bezier(.5, .1, .2, 1) calc(.15s + var(--k) * .2s) backwards;
}

.js.ready .stamp {
  animation: stamp .42s cubic-bezier(.2, 1.5, .4, 1) 1.25s backwards;
}

.js.ready .lede {
  animation: rise .9s var(--ease) 1.15s backwards;
}

.js.ready .wall {
  animation: unroll .9s cubic-bezier(.6, 0, .2, 1) .85s backwards;
}

.js.ready .hero .lotus {
  animation: fade 1.6s var(--ease) 1.3s backwards;
}

.js.ready .wall-fu {
  animation: drop .8s cubic-bezier(.2, .9, .3, 1.15) calc(1.35s + var(--d) * .085s) backwards;
}

.js.ready .wall-tags {
  animation: fade 1s var(--ease) 2.1s backwards;
}

.js.ready .hero-foot {
  animation: fade 1s var(--ease) 2.3s backwards;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

@keyframes brush {
  from {
    clip-path: inset(0 0 100% 0);
  }
  to {
    clip-path: inset(-6% -6% -6% -6%);
  }
}

@keyframes unroll {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

@keyframes stamp {
  from {
    opacity: 0;
    transform: rotate(-14deg) scale(1.9);
  }
}

@keyframes drop {
  from {
    opacity: 0;
    transform: translateY(calc(var(--y) - 30px));
  }
}

/* ---------- 段落标题 ---------- */

.head {
  position: relative;
  padding: 0 var(--pad);
}

.head::before {
  content: "";
  position: absolute;
  top: 13px;
  right: 0;
  left: calc(var(--pad) + 38px);
  height: 1px;
  background: currentColor;
  opacity: .45;
}

/* 小印章。毛边只加在印面上，字保持清楚。 */
.head-no,
.dates dt,
.count-days i {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-wei);
  line-height: 1;
  color: #fff1dc;
}

.head-no::before,
.dates dt::before,
.count-days i::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 3px;
  background: var(--zhu);
  filter: url(#rough);
}

.head-no {
  width: 27px;
  height: 27px;
  font-size: 16px;
}

.head h2 {
  width: fit-content;
  margin-top: 12px;
  padding: .04em .06em .06em 0;
  font-family: var(--f-brush);
  font-size: calc(var(--vw) * 15.5);
  line-height: 1.1;
  letter-spacing: .03em;
}

.head p {
  margin-top: 8px;
  font-family: var(--f-wei);
  font-size: 13px;
  line-height: 1.4;
  letter-spacing: .3em;
}

.head-gold {
  color: var(--gold);
}

.head-gold p {
  color: var(--gold-a);
}

.paper-red .head-no {
  color: var(--gold-hi);
}

.paper-red .head-no::before {
  background: var(--ink);
}

.reveal {
  transition: opacity 1s var(--ease), transform 1s var(--ease);
}

.js .reveal {
  opacity: 0;
  transform: translateY(24px);
}

.js .reveal.in {
  opacity: 1;
  transform: none;
}

/* ---------- 八道灵符：贴在玄墙上 ---------- */

.fus {
  margin-top: calc(var(--cut) * -1);
  padding: calc(var(--cut) + var(--vw) * 15) 0 calc(var(--cut) + var(--vw) * 12);
  overflow: hidden;
}

.lotus-back {
  position: absolute;
  top: calc(var(--vw) * 44);
  left: 50%;
  z-index: -1;
  width: 168%;
  margin-left: -84%;
  opacity: .13;
  pointer-events: none;
}

.lotus-back img {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  animation: turn 260s linear infinite;
}

.rail {
  --card-w: calc(var(--vw) * 84);
  --fu-h: calc(var(--vw) * 118);
  position: relative;
  display: flex;
  gap: 12px;
  margin-top: 26px;
  padding: 16px calc((min(100vw, 480px) - var(--card-w)) / 2) 26px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.rail::-webkit-scrollbar {
  display: none;
}

.card {
  position: relative;
  isolation: isolate;
  flex: 0 0 var(--card-w);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 18px;
  padding: 0 4px 0 8px;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  transition: opacity .5s var(--ease), transform .5s var(--ease);
}

/* 墙上的金线，从一道符连到下一道 */
.card::after {
  content: "";
  position: absolute;
  top: calc(var(--fu-h) * .46);
  right: -12px;
  left: -12px;
  z-index: -1;
  height: 1.5px;
  background: var(--gold);
  opacity: .5;
}

/* 墙上的大字序号 */
.card::before {
  content: attr(data-ord);
  position: absolute;
  right: -4px;
  bottom: calc(var(--vw) * 30);
  z-index: -1;
  font-family: var(--f-brush);
  font-size: calc(var(--vw) * 50);
  line-height: 1;
  color: rgba(220, 180, 104, .085);
  pointer-events: none;
}

.js .card:not(.is-active) {
  opacity: .3;
  transform: scale(.95);
}

.card-fu {
  position: relative;
  align-self: start;
  line-height: 0;
}

.card-fu img {
  width: auto;
  height: var(--fu-h);
  box-shadow: 0 18px 34px rgba(0, 0, 0, .7);
  transition: filter 1s;
}

.card-duty {
  position: absolute;
  top: -8px;
  left: -8px;
  display: none;
  writing-mode: vertical-rl;
  padding: 8px 4px 7px;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold));
  box-shadow: 0 4px 12px rgba(0, 0, 0, .5);
  color: #3a2408;
  font-family: var(--f-wei);
  font-size: 11px;
  line-height: 1.2;
  letter-spacing: .16em;
}

.card.is-duty .card-duty {
  display: block;
}

.card-side {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.card-script {
  writing-mode: vertical-rl;
  align-self: flex-end;
  height: calc(var(--vw) * 54);
}

.card-ord {
  margin-left: 7px;
  font-family: var(--f-wei);
  font-size: 12px;
  line-height: 1.3;
  letter-spacing: .34em;
  color: var(--zhu);
}

.card-name {
  margin-left: 10px;
  padding: .04em 0;
  font-family: var(--f-brush);
  font-size: calc(var(--vw) * 12.4);
  line-height: 1.14;
  letter-spacing: .04em;
}

.card-lines {
  font-size: 14px;
  line-height: 1.72;
  letter-spacing: .2em;
  color: var(--cream-a);
}

.card-lines span {
  display: block;
}

.card-lines span:first-child {
  color: var(--gold);
}

.card-text {
  margin-top: auto;
  padding-top: 16px;
}

.card-lord {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-wei);
  font-size: 12px;
  line-height: 1;
  letter-spacing: .16em;
  color: var(--gold-a);
  white-space: nowrap;
}

.card-lord i {
  flex: 1;
  height: 1px;
  background: var(--gold-b);
}

.card-lord i:first-child {
  flex: 0 0 10px;
}

.card-bless {
  margin-top: 12px;
  font-size: 14.5px;
  line-height: 1.9;
  letter-spacing: .04em;
  color: var(--cream);
  text-align: justify;
}

.card-paper {
  margin-top: 12px;
  font-family: var(--f-wei);
  font-size: 11px;
  line-height: 1;
  letter-spacing: .14em;
  color: var(--cream-b);
  white-space: nowrap;
}

.card-paper i {
  margin: 0 .55em;
}

.pips {
  display: flex;
  justify-content: center;
  gap: 2px;
  margin-top: 2px;
}

.pip {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 40px;
}

.pip i {
  width: 6px;
  height: 18px;
  border: 1px solid var(--gold-b);
  transition: height .4s var(--ease), background .4s, border-color .4s, box-shadow .4s;
}

.pip.is-duty i {
  border-color: var(--gold-hi);
}

.pip.is-active i {
  height: 28px;
  border-color: var(--zhu);
  background: var(--zhu);
  box-shadow: 0 0 12px rgba(222, 59, 44, .8);
}

/* ---------- 三月之期：一张黄纸 ---------- */

.term {
  z-index: 2;
  margin-top: calc(var(--cut) * -1);
  padding: calc(var(--cut) + var(--vw) * 13) 0 calc(var(--cut) + var(--vw) * 13);
  clip-path: polygon(0 var(--cut), 100% 0, 100% calc(100% - var(--cut)), 0 100%);
}

.count {
  margin-top: calc(var(--vw) * 8);
  padding: 0 var(--pad);
}

.count-label {
  font-family: var(--f-wei);
  font-size: 13px;
  line-height: 1;
  letter-spacing: .5em;
}

.count-days {
  display: flex;
  align-items: flex-end;
  gap: calc(var(--vw) * 2);
  margin: 2px 0 0 -3px;
  white-space: nowrap;
}

.count-days b {
  padding: .04em 0 .06em;
  font-family: var(--f-brush);
  font-size: calc(var(--vw) * 30);
  line-height: 1.02;
  filter: url(#rough);
}

.count-days b[data-len="3"] {
  font-size: calc(var(--vw) * 25.4);
}

.count-days b[data-len="4"] {
  font-size: calc(var(--vw) * 19);
}

/* 「天」盖成一枚朱印 */
.count-days i {
  width: 1.62em;
  height: 1.62em;
  margin-bottom: 1.1em;
  font-size: calc(var(--vw) * 5.2);
}

.count-days i:empty {
  display: none;
}

.count-hms {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 6px;
  border-top: 3px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.count-hms span {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  padding: 12px 0 11px;
  border-left: 1px solid var(--ink-b);
}

.count-hms span:first-child {
  border-left: 0;
}

.count-hms b {
  font-family: var(--f-wei);
  font-size: calc(var(--vw) * 5.8);
  line-height: 1.1;
  white-space: nowrap;
}

.count-hms i {
  font-family: var(--f-wei);
  font-size: 12px;
  line-height: 1;
  color: var(--zhu-lo);
}

/* 符期历：三个农历月，一日一点，十日一旬 */
.almanac {
  display: grid;
  gap: calc(var(--vw) * 2.3);
  margin: calc(var(--vw) * 7) var(--pad) 0;
}

.alm-row {
  display: flex;
  align-items: center;
  gap: calc(var(--vw) * 2.6);
}

.alm-row b {
  flex: 0 0 auto;
  font-family: var(--f-wei);
  font-size: 13px;
  line-height: 1;
  letter-spacing: .08em;
}

.alm-dots {
  flex: 1;
  display: flex;
  gap: calc(var(--vw) * .62);
}

.alm-dots i {
  flex: 1 1 0;
  aspect-ratio: 1;
  border: 1px solid var(--ink);
  border-radius: 50%;
}

.alm-dots i:nth-child(10n) {
  margin-right: calc(var(--vw) * 1.7);
}

.alm-dots i:last-child {
  margin-right: 0;
}

.alm-dots i.is-past {
  background: var(--ink);
}

.alm-dots i.is-today {
  border-color: var(--zhu);
  background: var(--zhu);
  animation: today 2.4s ease-in-out infinite;
}

.alm-dots i.is-none {
  visibility: hidden;
}

@keyframes today {
  0%,
  100% {
    box-shadow: 0 0 0 2px rgba(222, 59, 44, .3);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(222, 59, 44, 0);
  }
}

.count-note {
  margin: calc(var(--vw) * 4) var(--pad) 0;
  font-size: 13px;
  line-height: 1.75;
  letter-spacing: .04em;
}

.dates {
  margin: calc(var(--vw) * 7) var(--pad) 0;
  border-top: 3px solid var(--ink);
}

.dates > div {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--ink-b);
}

.dates > div:last-child {
  border-bottom-color: var(--ink);
}

.dates dt {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  font-size: 16px;
}

.dates dd {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 10px;
  font-family: var(--f-wei);
  line-height: 1.3;
}

.dates dd b {
  font-size: 17px;
  letter-spacing: .06em;
  white-space: nowrap;
}

.dates dd span {
  font-size: 12px;
  letter-spacing: .1em;
  color: var(--ink-a);
  white-space: nowrap;
}

/* ---------- 受符：又一页红纸 ---------- */

.bless {
  z-index: 2;
  margin-top: calc(var(--vw) * 5);
  padding: calc(var(--cut) + var(--vw) * 13) 0 calc(var(--cut) + var(--vw) * 15);
  clip-path: polygon(0 var(--cut), 100% 0, 100% calc(100% - var(--cut)), 0 100%);
}

.bless-copy {
  margin-top: calc(var(--vw) * 6);
  padding: 0 var(--pad);
  font-size: 15.5px;
  line-height: 2;
  letter-spacing: .1em;
}

.seal {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: calc(var(--vw) * 2);
}

.seal-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--vw) * 70);
  height: calc(var(--vw) * 70);
  border-radius: 50%;
}

/* 莲纹压在红纸上，同色深一度 */
.seal-ring {
  position: absolute;
  inset: 0;
  background: #96190f;
  -webkit-mask: url("assets/mandala.svg") center / contain no-repeat;
  mask: url("assets/mandala.svg") center / contain no-repeat;
  opacity: .8;
  animation: turn 90s linear infinite;
  transition: opacity 1s;
}

.seal-core {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 39%;
  height: 39%;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 26%, #4a3830, var(--ink) 62%);
  box-shadow: 0 0 0 5px var(--zhu), 0 0 0 6.5px var(--gold), 0 16px 30px rgba(70, 6, 2, .5);
  transition: transform .3s var(--ease);
  animation: pulse 2.8s ease-in-out infinite;
}

.seal-core b {
  padding: .06em;
  font-family: var(--f-brush);
  font-size: calc(var(--vw) * 16);
  line-height: 1;
}

.seal-btn:active .seal-core {
  transform: scale(.93);
}

.seal-btn.is-pressed .seal-core {
  animation: press .7s var(--ease);
}

.seal-btn.is-pressed .seal-ring {
  opacity: 1;
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 5px var(--zhu), 0 0 0 6.5px var(--gold), 0 16px 30px rgba(70, 6, 2, .5), 0 0 0 0 rgba(248, 231, 182, .5);
  }
  50% {
    box-shadow: 0 0 0 5px var(--zhu), 0 0 0 6.5px var(--gold-hi), 0 16px 30px rgba(70, 6, 2, .5), 0 0 0 18px rgba(248, 231, 182, 0);
  }
}

@keyframes press {
  0% {
    transform: scale(1);
  }
  22% {
    transform: scale(.86);
  }
  55% {
    transform: scale(1.1);
    box-shadow: 0 0 0 5px var(--zhu), 0 0 0 6.5px var(--gold-hi), 0 0 90px 30px rgba(255, 226, 150, .8);
  }
  100% {
    transform: scale(1);
  }
}

.seal-hint {
  margin-top: -4px;
  font-family: var(--f-wei);
  font-size: 13px;
  line-height: 1.4;
  letter-spacing: .34em;
  text-indent: .34em;
}

.vows {
  display: flex;
  justify-content: center;
  gap: calc(var(--vw) * 2);
  margin-top: 26px;
  padding: 0 var(--pad);
}

.vows li {
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  width: calc(var(--vw) * 8.4);
  height: calc(var(--vw) * 18);
  border: 1px solid var(--ink);
  font-family: var(--f-wei);
  font-size: 13px;
  line-height: 1;
  letter-spacing: .22em;
  transition: background .6s var(--ease), color .6s, border-color .6s, box-shadow .6s, transform .6s var(--ease);
}

.vows li.is-on {
  background: var(--ink);
  box-shadow: 0 10px 18px rgba(70, 6, 2, .4);
  color: var(--gold-hi);
  transform: translateY(-4px);
}

.vows li:first-child.is-on {
  border-color: var(--huang);
  background: var(--huang);
  color: var(--ink);
}

/* 受符之前，这一段不占高度。 */
.bless-done {
  display: grid;
  grid-template-rows: 0fr;
  padding: 0 var(--pad);
  font-size: 15px;
  line-height: 1.9;
  letter-spacing: .08em;
  text-align: center;
  opacity: 0;
  transition: grid-template-rows .9s var(--ease), opacity 1.1s var(--ease) .2s;
}

.bless-done > div {
  min-height: 0;
  overflow: hidden;
}

.bless-done p {
  padding-top: 24px;
}

.bless-done.is-on {
  grid-template-rows: 1fr;
  opacity: 1;
}

.bless-done b {
  display: block;
  margin-bottom: 4px;
  font-family: var(--f-wei);
  font-size: 13px;
  letter-spacing: .26em;
  text-indent: .26em;
}

/* ---------- 页脚：回到玄墙 ---------- */

.foot {
  margin-top: calc(var(--cut) * -1);
  padding: calc(var(--cut) + var(--vw) * 13) 0 calc(env(safe-area-inset-bottom, 0px) + 44px);
  text-align: center;
}

.photo-scroll {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  border-top: 1px solid var(--gold-b);
  border-bottom: 1px solid var(--gold-b);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.photo-scroll::-webkit-scrollbar {
  display: none;
}

.photo-scroll img {
  width: auto;
  height: calc(var(--vw) * 60);
}

.photo figcaption {
  margin-top: 14px;
  font-family: var(--f-wei);
  font-size: 12px;
  line-height: 1;
  letter-spacing: .3em;
  text-indent: .3em;
  color: var(--cream-b);
}

.lotus-foot {
  position: relative;
  left: -10%;
  width: 120%;
  margin-top: calc(var(--vw) * 8);
  border: 0;
  opacity: .55;
  -webkit-mask-image: linear-gradient(transparent, #000 55%);
  mask-image: linear-gradient(transparent, #000 55%);
}

.lotus-foot img {
  top: 0;
}

.foot-main {
  width: fit-content;
  margin: 0 auto;
  font-family: var(--f-brush);
  font-size: calc(var(--vw) * 13);
  line-height: 1.2;
  letter-spacing: .3em;
  text-indent: .3em;
}

.foot-sub {
  margin-top: 12px;
  font-size: 13.5px;
  letter-spacing: .14em;
  color: var(--cream-a);
}

.foot-note {
  margin-top: 6px;
  font-family: var(--f-wei);
  font-size: 12px;
  letter-spacing: .5em;
  text-indent: .5em;
  color: var(--gold-a);
}

/* ---------- 大图 ---------- */

.viewer {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 5, 4, .93);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  animation: fade .35s var(--ease) both;
}

.viewer[hidden] {
  display: none;
}

.viewer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) 20px calc(env(safe-area-inset-bottom, 0px) + 16px);
}

.viewer-inner img {
  width: auto;
  max-width: 78vw;
  height: 76vh;
  height: 76svh;
  object-fit: contain;
  filter: drop-shadow(0 20px 50px rgba(0, 0, 0, .8)) drop-shadow(0 0 40px rgba(214, 58, 42, .25));
  animation: rise .5s var(--ease) both;
}

.viewer-name {
  margin-top: 16px;
  font-family: var(--f-wei);
  font-size: 14px;
  line-height: 1;
  letter-spacing: .28em;
  color: var(--gold-hi);
  white-space: nowrap;
}

.viewer-close {
  margin-top: 16px;
  padding: 10px 28px;
  border: 1px solid var(--gold-b);
  border-radius: 999px;
  font-family: var(--f-wei);
  font-size: 13px;
  line-height: 1;
  letter-spacing: .4em;
  text-indent: .4em;
  color: var(--gold);
}

/* ---------- 符期已满 ---------- */

[data-state="expired"] .strip img,
[data-state="expired"] .card-fu img {
  filter: saturate(.45) brightness(.72);
}

[data-state="expired"] .chip-dot,
[data-state="expired"] .count-hms {
  display: none;
}

[data-state="expired"] .seal-core {
  animation: none;
}

/* ---------- 矮屏幕 ---------- */

@media (max-height: 700px) {
  .title-zone {
    margin-top: 16px;
  }

  .down {
    display: none;
  }
}

/* ---------- 减少动效 ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
