/* 东方仪式空间：重组首屏层级，不改动求签状态机。 */
:root {
  --luzu-copy: #b8ac99;
  --luzu-copy-strong: #d6c6aa;
  --luzu-gold: #c6a56b;
  --luzu-gold-bright: #e0c486;
  --luzu-line: rgba(215, 178, 111, .42);
  --luzu-ease-out: cubic-bezier(.22, .78, .25, 1);
}
[hidden] { display: none !important; }

.ritual-hero {
  background: #070605;
  isolation: isolate;
}

.ritual-hero::after {
  position: absolute;
  inset: 0;
  z-index: 1;
  content: "";
  pointer-events: none;
  background:
    radial-gradient(circle at 73% 53%, rgba(133, 33, 23, .16), transparent 25%),
    radial-gradient(circle at 35% 45%, rgba(164, 115, 53, .08), transparent 31%),
    linear-gradient(90deg, rgba(4, 3, 2, .18), transparent 52%, rgba(4, 3, 2, .36));
  mix-blend-mode: screen;
}

.ritual-hero .hero-image {
  opacity: .42;
  filter: saturate(.72) contrast(1.12) brightness(.82);
  object-position: 69% center;
}

.ritual-hero .hero-shade {
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(4, 3, 2, .88) 0%, rgba(4, 3, 2, .58) 36%, rgba(4, 3, 2, .08) 72%, rgba(4, 3, 2, .68) 100%),
    linear-gradient(0deg, rgba(4, 3, 2, .88), transparent 40%, rgba(4, 3, 2, .3));
}

.ritual-hero > header,
.ritual-stage,
.ritual-note { z-index: 3; }

.ritual-hero > header {
  height: 78px;
  padding: 0 6vw;
  border-color: rgba(213, 180, 120, .19);
}

.brand { gap: 14px; font-size: 14px; letter-spacing: .24em; }
.brand img { width: 42px; height: 42px; }
.brand > span:last-child { color: #d9c6a7; }
.edition { color: #8f7e65; }

.rite-progress {
  top: 104px;
  left: 6vw;
  transform: none;
  gap: 15px;
  color: #aa9475;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: .18em;
}

.rite-progress span {
  transition: color 220ms var(--luzu-ease-out), opacity 220ms var(--luzu-ease-out);
}
.rite-progress span.is-current { color: var(--luzu-gold-bright); }
.rite-progress span.is-complete { color: var(--luzu-copy); }
.rite-progress span.is-complete + i { background: rgba(201, 160, 89, .72); }
.rite-progress i { width: 34px; background: rgba(201, 160, 89, .46); }

.ritual-stage {
  inset: 145px 6vw 64px;
  overflow: visible;
}

/* A rite is a scene, not a stacked carousel: only the current scene exists in layout. */
.rite-panel:not(.is-active) { display: none !important; }
.rite-panel.is-active { display: grid; }
.jiaobei-scene,
.cylinder-scene { overflow: clip; }

.intro-panel {
  align-content: center;
  justify-items: start;
  padding-left: 7vw;
  text-align: left;
}

.intro-panel::before {
  position: absolute;
  top: 18%;
  bottom: 18%;
  left: 3.5vw;
  width: 1px;
  content: "";
  background: linear-gradient(transparent, rgba(183, 143, 73, .6) 22%, rgba(183, 143, 73, .6) 78%, transparent);
}

.intro-panel::after {
  position: absolute;
  top: 32%;
  left: calc(3.5vw - 3px);
  width: 7px;
  height: 7px;
  content: "";
  background: #9f2f25;
  border-radius: 50%;
  box-shadow: 0 0 18px rgba(159, 47, 37, .7);
}

.intro-panel .rite-kicker {
  margin-bottom: 27px;
  color: #b19770;
  font-size: 14px;
  letter-spacing: .42em;
}

.intro-panel h1 {
  max-width: 8em;
  color: #e7dcc7;
  font-size: clamp(64px, 7.2vw, 116px);
  line-height: 1.12;
  letter-spacing: .08em;
  text-shadow: 0 12px 34px rgba(0, 0, 0, .42);
  text-wrap: balance;
}

.intro-panel h1 em { color: #b53c2d; }

.intro-panel .rite-copy {
  max-width: 31em;
  margin: 30px 0 34px;
  color: var(--luzu-copy);
  font-size: 15px;
  line-height: 2;
}

.rite-overview {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  color: #d8c8aa;
  font-family: var(--brush);
  list-style: none;
}

.rite-overview li {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: 34px 1fr;
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 7px;
  padding: 20px 18px 0;
  border-top: 1px solid rgba(203, 164, 93, .34);
}

.rite-overview li::before {
  position: absolute;
  top: -3px;
  left: 18px;
  width: 7px;
  height: 7px;
  content: "";
  background: #9f2f25;
  transform: rotate(45deg);
}

.rite-overview b {
  grid-row: 1 / 3;
  color: #a98754;
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
}

.rite-overview strong {
  min-width: 0;
  font-size: 21px;
  font-weight: 500;
  letter-spacing: .18em;
  line-height: 1;
}

.rite-overview span {
  min-width: 0;
  color: var(--luzu-copy);
  font-size: 12px;
  letter-spacing: .08em;
  line-height: 1.55;
}

.intro-panel .rite-button {
  width: 218px;
  height: 58px;
  padding: 0 20px;
  color: #f0dec0;
  background: rgba(116, 27, 21, .9);
  border-color: rgba(211, 170, 94, .58);
  box-shadow: inset 0 1px rgba(255, 218, 158, .13);
}

.intro-panel .rite-button:hover { background: #913128; }
.intro-panel .rite-button:focus-visible { outline-color: #e4ba6c; }

.rite-button {
  min-height: 54px;
  border-color: var(--luzu-line);
  transition:
    background-color 220ms var(--luzu-ease-out),
    border-color 220ms var(--luzu-ease-out),
    color 220ms var(--luzu-ease-out),
    transform 220ms var(--luzu-ease-out);
}
.rite-button:hover { border-color: rgba(225, 190, 126, .7); }
.rite-button:active { transform: translateY(1px); }
.rite-button:focus-visible {
  outline: 2px solid var(--luzu-gold-bright);
  outline-offset: 4px;
}
.rite-button:disabled {
  color: rgba(232, 220, 197, .72);
  background: rgba(76, 39, 31, .82);
  border-color: rgba(198, 165, 107, .3);
}
.rite-panel[aria-busy="true"] .rite-button b { animation: none; transform: none; }

.ritual-note {
  bottom: 26px;
  color: var(--luzu-copy);
  font-size: 12px;
}

.ritual-hero[data-rite="permission"] .hero-image,
.ritual-hero[data-rite="confirm"] .hero-image {
  opacity: .28;
  filter: saturate(.58) contrast(1.08) brightness(.68);
}

/* 筊杯签示采用三列独立竖排：动作说明 / 主标题 / 仪式次序。 */
.jiaobei-panel .vertical-instruction {
  width: 132px;
  height: min(290px, 48vh);
  display: grid;
  grid-template-columns: max-content max-content max-content;
  grid-template-areas: "copy title step";
  place-content: center;
  align-items: start;
  column-gap: clamp(8px, .8vw, 14px);
  writing-mode: horizontal-tb;
  text-orientation: mixed;
}

.jiaobei-panel .vertical-instruction > * {
  margin: 0;
  writing-mode: vertical-rl;
  text-orientation: upright;
  white-space: nowrap;
}

.jiaobei-panel .vertical-instruction small {
  grid-area: step;
  padding-top: 4px;
  color: #a88e64;
  font-size: 11px;
  line-height: 1.3;
  letter-spacing: .18em;
}

.jiaobei-panel .vertical-instruction h2 {
  grid-area: title;
  font-size: clamp(27px, 2.5vw, 34px);
  line-height: 1.05;
  letter-spacing: .08em;
}

.jiaobei-panel .vertical-instruction p {
  grid-area: copy;
  max-height: none;
  color: var(--luzu-copy);
  font-size: 13px;
  line-height: 1.45;
  letter-spacing: .1em;
}

/* 出签时三维器物是唯一主角，压低摄影背景中的第二只签筒。 */
.ritual-hero[data-rite="draw"] .hero-image {
  opacity: .11;
  filter: sepia(.12) saturate(.5) contrast(1.08) brightness(.55) blur(.7px);
  object-position: 76% center;
}

.ritual-hero[data-rite="draw"] .hero-shade {
  background:
    radial-gradient(ellipse at 50% 43%, rgba(112, 64, 31, .16) 0 12%, rgba(22, 12, 8, .16) 30%, rgba(4, 3, 2, .76) 72%),
    linear-gradient(116deg, rgba(4, 3, 2, .66) 0 34%, rgba(102, 26, 20, .12) 59%, rgba(4, 3, 2, .72) 100%),
    linear-gradient(0deg, rgba(4, 3, 2, .86), transparent 38%, rgba(4, 3, 2, .46));
}

.ritual-hero[data-rite="draw"]::after {
  background:
    radial-gradient(ellipse at 49% 73%, rgba(154, 91, 42, .09), transparent 30%),
    linear-gradient(103deg, transparent 0 39%, rgba(185, 122, 63, .055) 49%, transparent 60%),
    radial-gradient(ellipse at 71% 48%, rgba(105, 27, 20, .12), transparent 27%);
  mix-blend-mode: screen;
}

.cylinder-panel::before {
  position: absolute;
  z-index: 0;
  inset: 5% 10% 13%;
  content: "";
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 86%, rgba(166, 104, 50, .09), transparent 38%),
    radial-gradient(ellipse at 44% 36%, rgba(151, 90, 45, .06), transparent 30%);
  filter: blur(18px);
}

.cylinder-panel::after {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(560px, 68vw);
  height: min(410px, 52vh);
  z-index: 0;
  content: "";
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse, rgba(191, 112, 54, .17), rgba(124, 42, 27, .06) 38%, transparent 70%);
  filter: blur(14px);
  transform: translate(-50%, -42%) scale(.8);
  transition: opacity 260ms ease, transform 720ms cubic-bezier(.16, 1, .3, 1);
}

.cylinder-panel:has(.cylinder-scene.is-physical-shaking)::after {
  opacity: 1;
  transform: translate(-50%, -42%) scale(1);
}

.cylinder-panel > * { z-index: 1; }

.rite-panel[aria-busy="true"] .rite-button {
  cursor: progress;
  opacity: .78;
}

@media (max-width: 760px) {
  .ritual-hero .hero-image { opacity: .34; object-position: 70% center; }
  .ritual-hero > header {
    height: calc(68px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) max(18px, env(safe-area-inset-right)) 0 max(18px, env(safe-area-inset-left));
  }
  .brand { gap: 9px; font-size: 12px; letter-spacing: .16em; }
  .brand img { width: 34px; height: 34px; }
  .rite-progress {
    top: calc(90px + env(safe-area-inset-top));
    left: 50%;
    width: calc(100% - 32px);
    justify-content: center;
    gap: 6px;
    color: #b29b7a;
    font-size: 20px;
    letter-spacing: .1em;
    transform: translateX(-50%);
  }
  .rite-progress i { width: 18px; flex: 0 1 18px; background: rgba(201, 160, 89, .54); }
  .ritual-stage { inset: calc(126px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(58px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .intro-panel { justify-items: center; padding-left: 0; text-align: center; }
  .intro-panel::before,
  .intro-panel::after { display: none; }
  .intro-panel .rite-kicker { font-size: 12px; letter-spacing: .3em; }
  .intro-panel h1 { max-width: 9em; font-size: 46px; line-height: 1.16; }
  .intro-panel .rite-copy { max-width: 25em; margin: 17px auto 18px; font-size: 12px; line-height: 1.75; }
  .rite-overview {
    position: static;
    width: min(100%, 370px);
    grid-template-columns: 1fr;
    margin: 0 auto 16px;
  }
  .rite-overview li {
    min-height: 43px;
    grid-template-columns: 30px 64px minmax(0, 1fr);
    grid-template-rows: 1fr;
    align-items: center;
    column-gap: 9px;
    padding: 0 10px;
    border-top: 0;
    border-bottom: 1px solid rgba(203, 164, 93, .28);
  }
  .rite-overview li:last-child { border-bottom: 0; }
  .rite-overview li::before { display: none; }
  .rite-overview b,
  .rite-overview strong,
  .rite-overview span { grid-row: 1; }
  .rite-overview b { font-size: 18px; }
  .rite-overview strong { font-size: 20px; letter-spacing: .12em; }
  .rite-overview span { color: #a99b86; font-size: 12px; letter-spacing: .05em; text-align: left; }
  .intro-panel .rite-button { width: 200px; }

  /* 手机验签：实体场景与竖排签示各占自己的安全区，禁止互相覆盖。 */
  .ritual-stage {
    overflow: hidden;
  }

  .jiaobei-panel {
    grid-template-columns: minmax(0, 1fr) clamp(100px, 28vw, 116px);
    grid-template-rows: minmax(0, 1fr) auto;
    align-items: stretch;
    justify-items: stretch;
    gap: 12px 4px;
    padding: 0 0 8px;
  }

  .jiaobei-panel .jiaobei-scene {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 1 / 1.18;
    min-width: 0;
    filter: drop-shadow(0 18px 18px rgba(0, 0, 0, .58));
  }

  .jiaobei-panel .vertical-instruction {
    position: static;
    grid-column: 2;
    grid-row: 1;
    align-self: start;
    justify-self: center;
    width: clamp(100px, 28vw, 116px);
    height: min(270px, 43vh);
    margin-top: 18px;
    transform: none;
  }

  .jiaobei-panel .vertical-instruction small { color: #b29a74; font-size: 12px; }
  .jiaobei-panel .vertical-instruction h2 {
    margin: 12px 0 8px;
    color: #ead8b8;
    font-size: clamp(24px, 7vw, 29px);
    line-height: 1.12;
    letter-spacing: .1em;
  }
  .jiaobei-panel .vertical-instruction p {
    max-height: 10em;
    overflow: hidden;
    color: #aaa08f;
    font-size: 13px;
    line-height: 1.7;
    letter-spacing: .12em;
  }

  .jiaobei-panel .pending-slip,
  .jiaobei-panel .rite-outcome {
    z-index: 4;
    left: 6px;
    top: 16%;
    max-height: 48%;
    overflow: hidden;
    color: #c8ad79;
    font-size: 14px;
    line-height: 1.7;
    letter-spacing: .1em;
  }

  .jiaobei-panel .rite-outcome { top: auto; bottom: 78px; transform: none; }
  .jiaobei-panel .rite-button {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
    width: min(220px, 72vw);
    margin-bottom: env(safe-area-inset-bottom);
  }

  .ritual-note { bottom: max(22px, env(safe-area-inset-bottom)); font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .intro-panel .rite-button { transition: none; }
  .has-drawn-slip .drawn-slip-reveal {
    animation: none;
    opacity: 1;
    transform: translate(-50%, -50%) rotate(-.35deg);
  }
}

/* 结果页首屏：卷轴与解签必须在一个视口内完成阅读。 */
.reading {
  min-height: 100svh;
  height: 100svh;
  overflow: hidden;
}

.reading .scroll-stage {
  min-height: 0;
  height: 100%;
  padding: 12px 0;
}

.reading .scroll-reveal {
  width: min(430px, 52vw);
  max-height: min(720px, 78vh);
  aspect-ratio: .49 / 1;
  background:
    linear-gradient(90deg, rgba(79, 43, 19, .18), transparent 10% 90%, rgba(79, 43, 19, .2)),
    repeating-linear-gradient(0deg, rgba(102, 64, 28, .035) 0 1px, transparent 1px 5px),
    #c19a61;
  border: 1px solid rgba(79, 43, 19, .42);
  box-shadow: 0 24px 42px rgba(0, 0, 0, .34), inset 0 0 26px rgba(75, 41, 18, .18);
  overflow: hidden;
  transform: rotate(-.7deg);
  container-type: inline-size;
  --paper-brush: "HanziPen SC", "STXingkai SC", "Kaiti SC", "STKaiti", "KaiTi", cursive;
  --poem-size: clamp(22px, 5.9cqw, 30px);
  --poem-leading: 1.56;
}

.reading .scroll-reveal[data-poem-density="open"] {
  --poem-size: clamp(25px, 6.6cqw, 34px);
  --poem-leading: 1.5;
}

.reading .scroll-reveal[data-poem-density="dense"] {
  --poem-size: clamp(18px, 4.9cqw, 25px);
  --poem-leading: 1.5;
}

.reading .scroll-reveal[data-poem-density="tight"] {
  --poem-size: clamp(16px, 4.4cqw, 22px);
  --poem-leading: 1.45;
}

.reading .scroll-reveal::before {
  position: absolute;
  z-index: 1;
  inset: 5% 3.5%;
  content: "";
  border: 1px solid rgba(100, 58, 24, .32);
  box-shadow: inset 0 0 16px rgba(89, 49, 18, .12);
  pointer-events: none;
}

.reading .scroll-reveal canvas {
  position: relative;
  z-index: 0;
  opacity: .55;
}

.reading .scroll-copy {
  z-index: 2;
  inset: 8% 13% 8%;
  display: block;
  overflow: hidden;
  font-family: var(--paper-brush);
  font-synthesis: none;
}

.reading .scroll-heading,
.reading .scroll-allusion { gap: 9px; }
.reading .scroll-heading {
  position: absolute;
  top: 10%;
  right: 9%;
  height: auto;
  max-height: 43%;
  margin: 0;
}
.reading .scroll-allusion {
  position: absolute;
  top: 74%;
  left: 6%;
  height: 16%;
  margin: 0;
}
.reading .scroll-heading span,
.reading .scroll-allusion span {
  font-size: clamp(11px, 3.2cqw, 14px);
  line-height: 1.6;
  letter-spacing: .18em;
}
.reading .scroll-heading strong {
  display: block;
  font-size: clamp(16px, 4.3cqw, 20px);
  line-height: 1.45;
  letter-spacing: .1em;
  white-space: nowrap;
}
.reading .scroll-heading b {
  font-size: clamp(24px, 7.2cqw, 32px);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.reading .scroll-allusion b {
  max-height: 9em;
  overflow-wrap: anywhere;
  font-size: var(--fitted-paper-size, clamp(15px, 4cqw, 19px));
  line-height: 1.55;
  letter-spacing: .08em;
}

.reading .scroll-copy blockquote {
  position: absolute;
  top: 15%;
  right: 37%;
  width: 44%;
  height: 56%;
  max-width: 210px;
  max-height: 56%;
  overflow: hidden;
  font-family: var(--paper-brush);
  font-size: var(--fitted-paper-size, var(--poem-size));
  font-weight: 400;
  line-height: var(--poem-leading);
  letter-spacing: .06em;
  overflow-wrap: anywhere;
}

.reading .interpretation {
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.reading .interpretation article {
  min-height: 0;
  overflow: hidden;
  padding: 22px 20px;
}

.reading .interpretation h2 {
  margin-bottom: 16px;
  font-size: clamp(24px, 2.4vw, 34px);
  line-height: 1.35;
  text-wrap: balance;
}
.reading .interpretation h3 {
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: .12em;
}
.reading .interpretation p {
  display: block;
  overflow: visible;
  font-size: 15px;
  line-height: 1.9;
  overflow-wrap: anywhere;
  white-space: pre-line;
  text-wrap: pretty;
}

.reading .reading-actions { padding: 12px 0 20px; }

/* 展卷后的页面只留下品牌签名；仪式场景与进度条退到幕后，避免结果页被首屏撑高。 */
.ritual-hero.is-reading {
  min-height: 78px !important;
  height: 78px !important;
  overflow: hidden;
}

.ritual-hero.is-reading .hero-image,
.ritual-hero.is-reading .hero-shade,
.ritual-hero.is-reading::after,
.ritual-hero.is-reading .rite-progress,
.ritual-hero.is-reading .ritual-stage,
.ritual-hero.is-reading .ritual-note {
  display: none;
}

.ritual-hero.is-reading > header {
  position: relative;
  inset: auto;
  height: 78px;
  border-bottom-color: rgba(213, 180, 120, .24);
}

#reading.is-final-reading .reading-nav { display: none; }
#reading.is-final-reading { padding-top: 10px; }

.reading .scroll-copy > .scroll-seal {
  position: absolute;
  right: 7%;
  bottom: 5%;
  width: clamp(38px, 5vw, 64px);
  height: clamp(38px, 5vw, 64px);
  object-fit: contain;
  opacity: .78;
  filter: sepia(.45) saturate(1.2) brightness(.82);
  transform: rotate(-7deg);
}

/* 签筒出签后的第二拍：完整签筒退到右后方，竹木签成为前景主角。 */
.cylinder-panel .cylinder-scene canvas {
  transform-origin: 58% 70%;
  transition:
    transform 720ms cubic-bezier(.22, .78, .25, 1),
    opacity 560ms ease,
    filter 560ms ease;
}

.cylinder-scene.is-grabbed canvas {
  filter: brightness(1.2) saturate(1.1);
}

.cylinder-panel.has-drawn-slip .cylinder-scene canvas {
  opacity: .54;
  filter: saturate(.72) brightness(.82);
  transform: translate(23%, 9%) scale(.78);
}
.cylinder-panel.is-revealing-slip .vertical-instruction,
.cylinder-panel.is-revealing-slip .cylinder-scene > p,
.cylinder-panel.is-revealing-slip .rite-button { opacity: 0 !important; visibility: hidden; pointer-events: none; }
.cylinder-panel.is-revealing-slip .drawn-slip-reveal { visibility: hidden; }

.cylinder-panel .vertical-instruction,
.cylinder-panel .cylinder-scene > p {
  transition: opacity 420ms ease;
}

.cylinder-panel.has-drawn-slip .vertical-instruction,
.cylinder-panel.has-drawn-slip .cylinder-scene > p { opacity: .2; }

.drawn-slip-reveal {
  position: absolute;
  z-index: 5;
  top: 50%;
  left: 31%;
  width: clamp(86px, 8.5vw, 108px);
  height: min(350px, 56vh);
  min-height: 270px;
  display: grid;
  grid-template-rows: 26px minmax(0, 1fr);
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 19px 14px 17px;
  color: #28170d;
  background:
    radial-gradient(ellipse at 50% 2%, rgba(255, 231, 171, .28), transparent 24%),
    repeating-linear-gradient(96deg, rgba(77, 40, 14, .045) 0 1px, transparent 1px 7px),
    linear-gradient(90deg, #895325 0%, #c58e43 15%, #dfb66c 46%, #c28a40 82%, #77451f 100%);
  border: 1px solid rgba(80, 43, 18, .82);
  box-shadow:
    -18px 30px 46px rgba(15, 7, 3, .48),
    0 0 38px rgba(161, 91, 36, .12),
    inset 1px 0 rgba(255, 229, 166, .28),
    inset -1px 0 rgba(71, 35, 12, .28);
  clip-path: polygon(7% 0, 93% 0, 100% 2.2%, 100% 97.8%, 93% 100%, 7% 100%, 0 97.8%, 0 2.2%);
  font-family: var(--brush);
  writing-mode: horizontal-tb;
  overflow: hidden;
  opacity: 0;
  transform: translate(-50%, -43%) scale(.96) rotate(-.35deg);
  transform-origin: center;
  pointer-events: none;
  container-type: size;
}

.cylinder-scene > span { display: none !important; }

.drawn-slip-reveal::before {
  position: absolute;
  inset: 8px;
  content: "";
  border: 1px solid rgba(76, 39, 15, .42);
  clip-path: inherit;
  box-shadow: inset 0 0 18px rgba(92, 48, 17, .1);
}

.drawn-slip-reveal span {
  position: static !important;
  inset: auto !important;
  width: auto !important;
  height: auto !important;
  display: grid !important;
  place-items: center;
  color: inherit !important;
  background: none !important;
  border: 0 !important;
  border-bottom: 1px solid rgba(112, 49, 24, .52) !important;
  box-shadow: none !important;
  padding-bottom: 8px;
  color: #6e2f20 !important;
  font-size: 12px;
  line-height: 1;
  letter-spacing: .34em;
  writing-mode: horizontal-tb !important;
  opacity: 1 !important;
  transform: none !important;
  animation: none !important;
}

.has-slip .drawn-slip-reveal span { animation: none !important; }
.drawn-slip-reveal strong {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  font-size: clamp(27px, 11.8cqh, 33px);
  font-weight: 500;
  line-height: 1.03;
  letter-spacing: .065em;
  writing-mode: vertical-rl;
  text-orientation: upright;
  white-space: nowrap;
}

/* “一百签”等长号码也必须完整留在签木内框。 */
.drawn-slip-reveal strong[data-length="5"] { font-size: clamp(25px, 10.8cqh, 30px); }
.drawn-slip-reveal strong[data-length="6"] { font-size: clamp(22px, 9.7cqh, 27px); }
.has-drawn-slip .drawn-slip-reveal {
  animation: revealDrawnSlip 680ms cubic-bezier(.22, .78, .25, 1) forwards;
}

@keyframes revealDrawnSlip {
  0% { opacity: 0; transform: translate(-50%, -43%) scale(.96) rotate(-.35deg); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-.35deg); }
}

@media (max-width: 760px) {
  .cylinder-panel {
    grid-template-rows: minmax(0, 1fr) 58px;
    align-items: center;
    justify-items: center;
    gap: 4px;
    padding: 0;
  }

  .cylinder-panel .cylinder-scene {
    align-self: center;
    width: min(100%, 430px);
    height: min(100%, 700px);
    max-height: 700px;
    min-height: 0;
    filter: drop-shadow(0 22px 24px rgba(0, 0, 0, .64));
  }

  .cylinder-panel .vertical-instruction {
    top: clamp(14px, 4vh, 32px);
    right: 2px;
    height: min(210px, 34vh);
  }

  .cylinder-panel .vertical-instruction h2 {
    margin: 10px 0 8px;
    font-size: clamp(23px, 6.7vw, 29px);
    letter-spacing: .08em;
  }

  .cylinder-panel .vertical-instruction p {
    max-height: 9em;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.55;
    letter-spacing: .08em;
  }

  .cylinder-panel .rite-button {
    align-self: end;
    width: min(250px, 72vw);
    min-height: 54px;
  }

  .cylinder-panel .cylinder-scene > p {
    bottom: 1%;
    max-width: calc(100% - 40px);
    overflow: hidden;
    letter-spacing: .12em;
    text-overflow: ellipsis;
  }

  .drawn-slip-reveal {
    left: 34%;
    top: 49%;
    width: clamp(86px, 26vw, 100px);
    height: min(318px, 48vh);
    min-height: 252px;
    grid-template-rows: 23px minmax(0, 1fr);
    gap: 9px;
    padding: 16px 12px 14px;
  }
  .drawn-slip-reveal strong {
    align-self: center;
    font-size: clamp(25px, 11.3cqh, 30px);
    line-height: 1.03;
  }
  .drawn-slip-reveal strong[data-length="5"] { font-size: clamp(23px, 10.5cqh, 28px); }
  .drawn-slip-reveal strong[data-length="6"] { font-size: clamp(21px, 9.4cqh, 25px); }
  .drawn-slip-reveal span { font-size: 10px; }

  .cylinder-panel.has-drawn-slip .cylinder-scene canvas {
    opacity: .5;
    transform: translate(31%, 17%) scale(.69);
  }

  .cylinder-panel.has-drawn-slip .vertical-instruction { opacity: 0; }
}

/* 平板/窄桌面：取消结果页的超宽双栏，解签正文恢复横排。 */
@media (max-width: 1180px) {
  .reading {
    display: block;
    height: auto;
    min-height: 100svh;
    overflow: visible;
    padding: 0 28px;
  }

  .reading .scroll-stage {
    height: auto;
    min-height: 700px;
    padding: 18px 0 8px;
  }

  .reading .scroll-reveal {
    width: min(430px, 58vw);
    max-height: 680px;
    aspect-ratio: .49 / 1;
    margin: 0 auto;
  }

  .reading .scroll-copy { inset: 8% 13% 8%; }
  .reading .scroll-heading { top: 10%; right: 9%; height: auto; max-height: 43%; }
  .reading .scroll-copy blockquote { top: 15%; right: 37%; width: 44%; height: 56%; max-height: 56%; }
  .reading .scroll-allusion { top: 74%; left: 6%; height: 16%; }

  .reading .interpretation {
    direction: ltr;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    height: auto;
    overflow: visible;
  }

  .reading .interpretation article {
    min-height: 190px;
    height: auto;
    display: block;
    padding: 22px 18px;
    border-right: 1px solid var(--line);
  }

  .reading .interpretation h2,
  .reading .interpretation h3,
  .reading .interpretation p {
    max-width: 100%;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
  }

  .reading .interpretation h2 {
    margin: 0 0 12px;
    font-size: clamp(22px, 3vw, 32px);
    line-height: 1.35;
  }

  .reading .interpretation h3 { margin: 0 0 12px; }
  .reading .interpretation p {
    display: block;
    max-height: none;
    overflow: visible;
    font-size: 15px;
    line-height: 1.85;
    letter-spacing: .04em;
  }

  .reading .reading-actions { padding: 20px 0 46px; }
}

@media (max-width: 760px) {
  .reading .scroll-reveal { --poem-size: clamp(18px, 5.7cqw, 22px); --poem-leading: 1.5; }
  .reading .scroll-reveal[data-poem-density="open"] { --poem-size: clamp(19px, 5.9cqw, 22px); }
  .reading .scroll-reveal[data-poem-density="dense"] { --poem-size: clamp(16px, 5cqw, 19px); }
  .reading .scroll-reveal[data-poem-density="tight"] { --poem-size: clamp(14px, 4.5cqw, 17px); --poem-leading: 1.42; }
  .reading { height: auto; min-height: 100svh; overflow: visible; }
  .reading .scroll-stage { height: auto; min-height: 590px; padding: 18px 0 4px; }
  .reading .scroll-reveal { width: min(284px, 78vw); max-height: 570px; aspect-ratio: .49 / 1; transform: none; }
  .reading .scroll-copy { inset: 8% 12% 8%; }
  .reading .scroll-heading { right: 5%; top: 8%; height: auto; max-height: 42%; }
  .reading .scroll-copy blockquote { top: 14%; right: 36%; width: 48%; height: 58%; max-height: 58%; }
  .reading .scroll-allusion { left: 5%; top: 75%; height: 15%; }
  .reading { padding: 0 18px; }
  .reading .interpretation { grid-template-columns: 1fr; height: auto; overflow: visible; }
  .reading .interpretation article { min-height: 0; overflow: visible; padding: 22px 0; border-right: 0; }
  .reading .interpretation p { display: block; overflow: visible; -webkit-line-clamp: unset; }
  .reading .reading-actions { padding: 18px 0 42px; }
  .ritual-hero.is-reading,
  .ritual-hero.is-reading > header { height: calc(68px + env(safe-area-inset-top)) !important; min-height: calc(68px + env(safe-area-inset-top)) !important; }
  .ritual-hero.is-reading > header { padding: env(safe-area-inset-top) 18px 0; }
  #reading.is-final-reading { padding-top: 4px; }
  .reading .scroll-copy > .scroll-seal { right: 4%; bottom: 2%; width: 38px; height: 38px; }
}

/* 签纸保留古法竖排；解释属于现代长文，横排才能完整、准确地读完。 */
@media (min-width: 1181px) {
  .reading {
    height: auto;
    min-height: 100svh;
    overflow: visible;
    grid-template-rows: auto auto auto;
    align-items: start;
  }

  .reading .scroll-stage {
    position: sticky;
    top: 84px;
    align-self: start;
    height: calc(100svh - 110px);
    min-height: 660px;
  }

  .reading .interpretation {
    direction: ltr;
    display: flex;
    flex-direction: column;
    height: auto;
    overflow: visible;
    align-self: start;
    padding-top: 28px;
  }

  .reading .interpretation article {
    direction: ltr;
    min-height: 0;
    height: auto;
    display: block;
    overflow: visible;
    padding: 28px 22px 32px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .reading .interpretation h2,
  .reading .interpretation h3,
  .reading .interpretation p {
    max-width: 100%;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
  }

  .reading .interpretation h2 {
    margin: 0 0 14px;
    font-size: clamp(28px, 2.4vw, 38px);
    line-height: 1.4;
  }

  .reading .interpretation h3 { margin: 0 0 12px; }
  .reading .interpretation p {
    max-height: none;
    font-size: 16px;
    line-height: 2;
    letter-spacing: .04em;
  }
}

/* 2026-08-26：微信 / iOS 窄屏筊杯页。结果退出实体画面，按流程独占一行。 */
@media (max-width: 760px) {
  .ritual-hero {
    width: 100%;
    min-height: 100dvh;
    height: 100dvh;
    overflow: hidden;
  }

  .rite-progress {
    top: calc(88px + env(safe-area-inset-top));
    width: calc(100% - max(28px, env(safe-area-inset-left) + env(safe-area-inset-right)));
    gap: clamp(3px, 1.25vw, 6px);
    padding-inline: 2px;
    font-size: clamp(14px, 4vw, 17px);
    letter-spacing: .05em;
  }

  .rite-progress i {
    width: clamp(9px, 3.4vw, 16px);
    flex: 0 1 clamp(9px, 3.4vw, 16px);
  }

  .ritual-stage {
    inset:
      calc(124px + env(safe-area-inset-top))
      max(14px, env(safe-area-inset-right))
      max(76px, calc(58px + env(safe-area-inset-bottom)))
      max(14px, env(safe-area-inset-left));
  }

  .jiaobei-panel {
    grid-template-columns: minmax(0, 1fr) clamp(100px, 28vw, 116px);
    grid-template-rows: minmax(0, 1fr) auto auto auto;
    align-items: center;
    gap: 6px 8px;
    padding: 0;
  }

  .jiaobei-panel .jiaobei-scene {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
    justify-self: center;
    width: min(100%, 340px);
    max-height: 100%;
    aspect-ratio: 1;
  }

  .jiaobei-panel .jiaobei-scene p {
    bottom: 3%;
    max-width: calc(100% - 24px);
    overflow: hidden;
    font-size: 12px;
    letter-spacing: .12em;
    text-overflow: ellipsis;
  }

  .jiaobei-panel .vertical-instruction {
    position: static;
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    justify-self: center;
    width: 100%;
    height: auto;
    max-height: min(300px, 44dvh);
    margin: 0;
    transform: none;
    display: grid;
    grid-template-columns: max-content max-content max-content;
    grid-template-areas: "copy title step";
    place-content: center;
    align-items: flex-start;
    column-gap: clamp(6px, 1.8vw, 9px);
    writing-mode: horizontal-tb;
    text-orientation: mixed;
  }

  .jiaobei-panel .vertical-instruction > * {
    margin: 0;
    writing-mode: vertical-rl;
    text-orientation: upright;
  }

  .jiaobei-panel .vertical-instruction small {
    padding-top: 4px;
    white-space: nowrap;
  }

  .jiaobei-panel .vertical-instruction h2 {
    margin: 0;
    font-size: clamp(23px, 6.6vw, 29px);
    line-height: 1.08;
    letter-spacing: .06em;
  }

  .jiaobei-panel .vertical-instruction p {
    max-height: none;
    font-size: 12px;
    line-height: 1.55;
    letter-spacing: .08em;
    white-space: nowrap;
  }

  .jiaobei-panel .pending-slip,
  .jiaobei-panel .rite-outcome {
    position: static;
    width: 100%;
    max-width: 100%;
    max-height: none;
    overflow: visible;
    transform: none;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    text-align: center;
  }

  .jiaobei-panel .pending-slip {
    grid-column: 1 / -1;
    grid-row: 2;
    min-height: 0;
    font-size: 12px;
    line-height: 1.5;
  }

  .jiaobei-panel .rite-outcome {
    grid-column: 1 / -1;
    grid-row: 3;
    min-height: 46px;
    display: block;
    color: #d2b577;
    font-size: 20px;
    line-height: 1.35;
    letter-spacing: .12em;
  }

  .jiaobei-panel .rite-outcome:empty { min-height: 0; }

  .jiaobei-panel .rite-outcome small {
    display: block;
    margin: 3px 0 0;
    color: #999080;
    font-size: 12px;
    line-height: 1.45;
    letter-spacing: .08em;
  }

  .jiaobei-panel .rite-button {
    grid-column: 1 / -1;
    grid-row: 4;
    width: min(270px, 78vw);
    min-height: 56px;
    margin: 2px 0 0;
  }

  .ritual-note {
    bottom: max(18px, env(safe-area-inset-bottom));
    max-width: calc(100% - 28px);
    overflow: hidden;
    font-size: 10px;
    letter-spacing: .1em;
    text-overflow: ellipsis;
  }

  /* 仪式进行中只保留场景内提示，避免与全站页脚重复。 */
  .ritual-hero:not(.is-reading) ~ footer { display: none; }
}

@media (max-width: 380px), (max-height: 720px) and (max-width: 760px) {
  .rite-progress {
    top: calc(82px + env(safe-area-inset-top));
    font-size: 13px;
  }

  .ritual-stage {
    top: calc(112px + env(safe-area-inset-top));
  }

  .jiaobei-panel {
    grid-template-columns: minmax(0, 1fr) 96px;
    gap: 4px 6px;
  }

  .jiaobei-panel .vertical-instruction h2 { font-size: 22px; }
  .jiaobei-panel .vertical-instruction p { font-size: 11px; }
  .jiaobei-panel .rite-outcome { min-height: 40px; font-size: 18px; }
  .jiaobei-panel .rite-button { min-height: 52px; }
}

/* 矮桌面与横屏平板：验签三件主体收进同一构图，不再贴边散落。 */
@media (min-width: 761px) and (max-height: 850px) {
  .ritual-stage {
    inset: 132px 6vw 62px;
    overflow: clip;
  }

  .jiaobei-panel {
    grid-template-columns: minmax(118px, .42fr) minmax(360px, 440px) minmax(118px, .42fr);
    grid-template-rows: minmax(0, 1fr) 58px;
    justify-content: center;
    align-items: center;
    column-gap: clamp(26px, 4vw, 64px);
    row-gap: 8px;
    padding: 0;
  }

  .jiaobei-panel .jiaobei-scene {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    justify-self: center;
    width: min(440px, 40vw, calc(100dvh - 300px));
    max-height: 100%;
    aspect-ratio: 1;
  }

  .jiaobei-panel .vertical-instruction {
    position: static;
    grid-column: 3;
    grid-row: 1;
    align-self: center;
    justify-self: center;
    width: auto;
    height: min(250px, 42vh);
    transform: none;
  }

  .jiaobei-panel .pending-slip,
  .jiaobei-panel .rite-outcome {
    position: static;
    grid-column: 1;
    grid-row: 1;
    justify-self: center;
    max-height: 44%;
    transform: none;
  }

  .jiaobei-panel .pending-slip { align-self: start; margin-top: 16%; }
  .jiaobei-panel .rite-outcome { align-self: end; margin-bottom: 16%; }

  .jiaobei-panel .rite-button {
    grid-column: 2;
    grid-row: 2;
    justify-self: center;
    margin: 0;
  }
}

/* 2026-09-12：统一细字对比度，并让器物操作提示在深色场景中可读。 */
.jiaobei-scene > p,
.cylinder-scene > p,
.rite-overview span,
.pending-slip { color: var(--luzu-copy); }

.reading .interpretation h3 { color: #bdae93; }
.reading .interpretation p { color: #c7bdad; }
.reading .reading-actions a { color: #aa9d89; }
.reading .reading-actions a:hover { color: #eadfc9; }

footer {
  color: #958a79;
  border-top-color: rgba(215, 178, 111, .24);
}

/* 2026-09-12b：视觉精修。场景参考夜庙供案，不做泛古风装饰堆叠。 */
.ritual-hero::before {
  position: absolute;
  inset: 0;
  z-index: 2;
  content: "";
  pointer-events: none;
  background:
    radial-gradient(ellipse at 52% 72%, rgba(151, 70, 37, .14), transparent 34%),
    radial-gradient(ellipse at 72% 32%, rgba(197, 137, 68, .08), transparent 27%),
    linear-gradient(180deg, rgba(7, 6, 5, .02), rgba(7, 6, 5, .3) 72%, rgba(7, 6, 5, .72));
}

.ritual-hero .hero-image {
  opacity: .5;
  filter: saturate(.78) contrast(1.08) brightness(.88);
}

.intro-panel h1 {
  max-width: 7.6em;
  font-size: clamp(64px, 7.2vw, 96px);
}

.intro-panel .rite-copy {
  max-width: 29em;
  font-size: 16px;
}

.rite-progress span { position: relative; }
.rite-progress span.is-current::after {
  position: absolute;
  left: 50%;
  bottom: -12px;
  width: 5px;
  height: 5px;
  content: "";
  background: #a53a2c;
  box-shadow: 0 0 14px rgba(177, 64, 48, .72);
  transform: translateX(-50%) rotate(45deg);
}

.rite-button {
  color: #f1e3ca;
  background: linear-gradient(135deg, #7d241c, #57140f);
  border-color: rgba(220, 179, 105, .68);
  box-shadow: inset 0 1px rgba(255, 226, 170, .14), inset 0 -1px rgba(21, 5, 3, .42);
}
.rite-button:hover {
  color: #fff4df;
  background: linear-gradient(135deg, #96352a, #6c1b15);
  border-color: rgba(235, 199, 132, .88);
}
.rite-button b {
  min-width: 32px;
  padding-left: 14px;
  border-left: 1px solid rgba(225, 188, 119, .28);
  text-align: right;
}

.jiaobei-panel::before {
  position: absolute;
  inset: 14% 11% 10%;
  z-index: 0;
  content: "";
  pointer-events: none;
  background:
    radial-gradient(ellipse at 45% 55%, rgba(142, 55, 31, .16), transparent 32%),
    radial-gradient(ellipse at 48% 72%, rgba(194, 133, 66, .09), transparent 38%);
  filter: blur(16px);
}
.jiaobei-panel > * { z-index: 1; }

.jiaobei-scene canvas {
  filter: none;
}
.cylinder-scene canvas {
  filter: brightness(1.13) saturate(1.07);
}

.jiaobei-panel .vertical-instruction h2,
.cylinder-panel .vertical-instruction h2 {
  color: #eedfc3;
  text-shadow: 0 8px 20px rgba(0, 0, 0, .38);
}

.reading {
  background:
    radial-gradient(ellipse at 78% 42%, rgba(158, 86, 38, .13), transparent 30%),
    radial-gradient(ellipse at 18% 74%, rgba(111, 28, 22, .12), transparent 36%),
    #080706;
}
.reading .scroll-stage {
  background: radial-gradient(ellipse at 54% 48%, rgba(215, 168, 92, .07), transparent 48%);
}
.reading .scroll-reveal {
  box-shadow: 0 26px 42px rgba(0, 0, 0, .44), 0 0 52px rgba(173, 110, 47, .08), inset 0 0 26px rgba(75, 41, 18, .18);
}
.reading .interpretation article { position: relative; }
.reading .interpretation article:last-child {
  background: linear-gradient(90deg, rgba(111, 29, 22, .15), rgba(111, 29, 22, .025));
}
.reading .interpretation-main h2 {
  color: #eee2ca;
  text-shadow: 0 8px 22px rgba(0, 0, 0, .28);
}
.reading .reading-actions button {
  color: #f4e7d1;
  background: #922f25;
  border: 1px solid rgba(223, 181, 108, .56);
}

@media (max-width: 760px) {
  .ritual-hero[data-rite="permission"] .hero-image,
  .ritual-hero[data-rite="confirm"] .hero-image {
    opacity: .38;
    filter: saturate(.68) contrast(1.04) brightness(.8);
  }

  .ritual-hero[data-rite="draw"] .hero-image {
    opacity: .18;
    filter: sepia(.1) saturate(.58) contrast(1.04) brightness(.68) blur(.45px);
  }

  .jiaobei-panel {
    grid-template-rows: clamp(330px, 46dvh, 520px) auto auto 56px;
    align-content: center;
  }

  .jiaobei-panel .jiaobei-scene {
    width: min(100%, 390px);
  }

  .cylinder-panel {
    grid-template-rows: clamp(390px, 53dvh, 620px) 58px;
    align-content: center;
  }

  .cylinder-panel .cylinder-scene {
    width: min(100%, 460px);
    height: 100%;
  }

  .intro-panel h1 {
    max-width: 8.6em;
    font-size: clamp(42px, 12vw, 54px);
  }

  .intro-panel .rite-copy {
    max-width: 27em;
    font-size: 13px;
  }

  .rite-progress span.is-current::after { bottom: -9px; }

  .reading .reading-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
  }
  .reading .reading-actions button { width: 100%; }
  .reading .reading-actions a {
    display: block;
    min-height: 44px;
    padding: 14px 0;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rite-progress span,
  .rite-button { transition: none; }
}
