:root {
  --yi-ink: #191713;
  --yi-muted: #756e62;
  --yi-paper: #f1eee5;
  --yi-surface: #e9e3d7;
  --yi-line: rgba(31, 27, 20, 0.16);
  --yi-gold: #9c7637;
  --yi-page-bg: #f1eee5;
  --yi-tools-bg: rgba(242, 238, 229, 0.94);
  --yi-control-bg: rgba(255, 253, 248, 0.58);
  --yi-active-bg: rgba(156, 118, 55, 0.1);
  --yi-font: "霞骛文楷等宽GB", "霞骛文楷等宽 GB", "霞鹜文楷等宽GB", "霞鹜文楷等宽 GB", "LXGW WenKai Mono GB", "LXGW WenKai Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body.yijing-library {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background-color: var(--yi-page-bg);
  background-image: radial-gradient(circle at 50% -10%, rgba(180, 145, 82, 0.12), transparent 38rem);
  color: var(--yi-ink);
  transition: color 240ms ease, background-color 240ms ease;
}

.yijing-library,
.yijing-library * {
  font-family: var(--yi-font) !important;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.yijing-shell {
  width: min(1420px, calc(100% - 72px));
  margin: 0 auto;
}

.yijing-app-header {
  position: sticky;
  z-index: 100;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: 0 clamp(18px, 3.2vw, 52px);
  border-bottom: 1px solid var(--yi-line);
  background: color-mix(in srgb, var(--yi-paper) 90%, transparent);
  backdrop-filter: blur(18px);
  transition: transform 280ms cubic-bezier(0.22, 0.76, 0.22, 1), color 240ms ease, border-color 240ms ease, background-color 240ms ease;
  will-change: transform;
}

.yijing-app-header.is-hidden {
  transform: translateY(-110%);
}

.yijing-app-brand,
.app-nav-link,
.theme-switch {
  border: 0;
  background: none;
  cursor: pointer;
}

.yijing-app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.brand-seal {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 17px;
}

.yijing-app-nav {
  display: flex;
  align-items: center;
  gap: clamp(8px, 2.4vw, 34px);
}

.app-nav-link,
.theme-switch {
  position: relative;
  padding: 7px 2px;
  color: var(--yi-muted);
  font-size: 13px;
  white-space: nowrap;
}

.app-nav-link::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 2px;
  left: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transition: transform 180ms ease;
}

.app-nav-link:hover,
.app-nav-link.is-active,
.theme-switch:hover {
  color: var(--yi-ink);
}

.app-nav-link.is-active::after {
  transform: scaleX(1);
}

.theme-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--yi-line);
  border-radius: 999px;
}

.theme-switch svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.yijing-app-main {
  min-height: calc(100vh - 56px);
}

.app-view {
  animation: view-in 400ms ease both;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Home: rotating divination wheel */
.wheel-section {
  display: grid;
  min-height: calc(100vh - 56px);
  place-items: center;
  padding: 72px 24px 82px;
  overflow: hidden;
}

.wheel-stage {
  position: relative;
  display: grid;
  width: min(92vw, 820px);
  min-height: min(620px, calc(100vh - 180px));
  place-items: center;
}

.wheel-perspective {
  position: relative;
  display: grid;
  width: min(84vw, 760px);
  aspect-ratio: 1;
  place-items: center;
  perspective: 1400px;
  perspective-origin: 50% 42%;
  transform: translateY(-86px);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.wheel-model {
  --wheel-size: min(680px, 74vh, 88vw);
  position: relative;
  z-index: 2;
  width: var(--wheel-size);
  aspect-ratio: 1;
  transform-style: preserve-3d;
  transform: rotateX(var(--model-rx, 4deg)) rotateY(var(--model-ry, 0deg)) rotateZ(var(--model-rz, 0deg));
  will-change: transform;
  transition: filter 180ms ease;
}

.wheel-perspective.is-dragging {
  cursor: grabbing;
}

.wheel-depth-stack,
.wheel-depth-stack span,
.wheel-back,
.wheel-face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  transform-style: preserve-3d;
}

.wheel-depth-stack span {
  border: 7px solid #6a4217;
  background:
    conic-gradient(from 2deg, #3b200a, #8d5e20 8%, #3d2109 16%, #b07a2e 25%, #422309 34%, #986824 45%, #321a07 57%, #ad772c 71%, #46270b 84%, #281306);
  box-shadow: inset 0 0 18px rgba(255, 204, 108, 0.18);
  transform: translateZ(calc(-2px - (var(--depth) * 1.45px)));
}

.wheel-depth-stack span:nth-child(2n) {
  border-color: #382008;
}

.wheel-back {
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 9px solid #9b6825;
  color: #c99747;
  background:
    repeating-conic-gradient(from 0deg, rgba(221, 166, 75, 0.12) 0 1deg, transparent 1.3deg 15deg),
    radial-gradient(circle, #81531c 0 2%, #1b1006 2.5% 24%, #8c5c20 24.5% 25.5%, #211307 26% 67%, #9e6c27 67.5% 69%, #190e05 70%);
  box-shadow:
    inset 0 0 0 4px #301906,
    inset 0 0 38px rgba(0, 0, 0, 0.88);
  backface-visibility: hidden;
  transform: rotateY(180deg) translateZ(24px);
}

.wheel-back-rim {
  position: absolute;
  inset: 8%;
  border: 2px solid currentColor;
  border-radius: 50%;
  box-shadow:
    0 0 0 6px rgba(45, 24, 7, 0.9),
    0 0 0 8px rgba(196, 139, 54, 0.55),
    inset 0 0 0 2px rgba(205, 151, 67, 0.42);
}

.wheel-back-seal {
  display: grid;
  width: 32%;
  aspect-ratio: 1;
  place-items: center;
  border: 3px double currentColor;
  border-radius: 50%;
  background: radial-gradient(circle, #5e3a12, #160d05 72%);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55), inset 0 0 20px rgba(235, 180, 86, 0.16);
  font-family: var(--yi-font) !important;
  font-size: clamp(4rem, 9vw, 7rem);
  font-weight: 900;
  text-shadow: 1px 2px 1px #000;
}

.wheel-back-clouds {
  position: absolute;
  top: 22%;
  opacity: 0.4;
  font-size: clamp(1.4rem, 4vw, 3rem);
  letter-spacing: 0.65em;
}

.wheel-back-inscription {
  position: absolute;
  bottom: 15%;
  padding: 8px 18px;
  border: 1px solid rgba(203, 151, 70, 0.48);
  border-radius: 999px;
  font-size: clamp(8px, 1.2vw, 13px);
  letter-spacing: 0.16em;
}

.wheel-face {
  overflow: hidden;
  border: 9px solid #b98535;
  color: #b98535;
  background:
    radial-gradient(circle at 40% 31%, rgba(255, 215, 133, 0.24), transparent 3%),
    radial-gradient(circle at 61% 66%, rgba(0, 0, 0, 0.74), transparent 4%),
    radial-gradient(circle at center, #1f1308 0 19%, #7b4b17 19.4% 20.2%, #211307 20.6% 46%, #a8742a 46.4% 47.4%, #211307 48% 79%, #b37f31 79.5% 81%, #1c1006 81.5% 94%, #6f4113 95%),
    conic-gradient(from 17deg, #3a1f08, #8a571a, #271406, #a26b24, #301806, #6f4113, #221105);
  box-shadow:
    inset 0 0 0 3px #3f2108,
    inset 0 0 0 7px rgba(239, 185, 83, 0.55),
    inset 0 0 38px rgba(0, 0, 0, 0.9),
    0 0 0 2px #3b210a,
    0 10px 24px rgba(0, 0, 0, 0.38);
  backface-visibility: hidden;
  transform: translateZ(2px);
}

.wheel-face::before {
  content: "";
  position: absolute;
  z-index: 8;
  inset: 0;
  border-radius: 50%;
  background:
    linear-gradient(128deg, rgba(255, 239, 179, 0.2), transparent 25%, transparent 68%, rgba(0, 0, 0, 0.3)),
    radial-gradient(circle at 35% 28%, transparent 0 38%, rgba(255, 208, 111, 0.07) 38.5%, transparent 39.5%);
  mix-blend-mode: screen;
  pointer-events: none;
}

.wheel-face::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 5%;
  border-radius: 50%;
  opacity: 0.52;
  background:
    repeating-conic-gradient(from -2.8125deg, rgba(225, 171, 80, 0.38) 0 0.42deg, transparent 0.48deg 5.625deg),
    repeating-radial-gradient(circle, transparent 0 14px, rgba(218, 161, 68, 0.13) 15px, transparent 16px 29px);
  -webkit-mask: radial-gradient(circle, transparent 0 41%, #000 42% 100%);
  mask: radial-gradient(circle, transparent 0 41%, #000 42% 100%);
  pointer-events: none;
}

.wheel-rim {
  position: absolute;
  z-index: 4;
  border: 3px solid #b98434;
  border-radius: 50%;
  box-shadow:
    inset 0 0 0 2px #352006,
    0 0 0 2px #281506,
    0 2px 6px rgba(0, 0, 0, 0.75);
}

.wheel-rim-outer {
  inset: 4.8%;
}

.wheel-rim-middle {
  inset: 19%;
}

.wheel-rim-inner {
  inset: 35.5%;
}

.wheel-hex-ring,
.wheel-trigram-ring {
  position: absolute;
  z-index: 5;
  inset: 0;
  border-radius: 50%;
}

.wheel-hex-ring span,
.wheel-trigram-ring span {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  color: #d3a052;
  text-align: center;
  transform-origin: 50% 50%;
  text-shadow:
    -1px -1px 0 rgba(255, 224, 149, 0.22),
    1px 2px 2px rgba(0, 0, 0, 0.92);
}

.wheel-hex-ring span {
  width: 27px;
  height: 46px;
  margin: -23px 0 0 -13.5px;
  transform: rotate(calc(var(--i) * 5.625deg)) translateY(calc(var(--wheel-size) * -0.432));
}

.wheel-hex-ring span::before {
  content: "";
  position: absolute;
  inset: -2px 1px;
  border-right: 1px solid rgba(207, 151, 64, 0.22);
  border-left: 1px solid rgba(207, 151, 64, 0.22);
}

.wheel-hex-ring b,
.wheel-trigram-ring b {
  font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", sans-serif !important;
  font-weight: 500;
  line-height: 1;
}

.wheel-hex-ring b {
  font-size: 18px;
  font-weight: 700;
}

.wheel-hex-ring small {
  margin-top: 3px;
  font-size: 7px;
  font-weight: 800;
  line-height: 1;
}

.wheel-trigram-ring span {
  width: 62px;
  height: 64px;
  margin: -32px 0 0 -31px;
  transform: rotate(calc(var(--i) * 45deg)) translateY(calc(var(--wheel-size) * -0.196));
}

.wheel-trigram-ring b {
  font-size: 34px;
}

.wheel-trigram-ring small {
  font-size: 10px;
}

.wheel-dragon-relief {
  position: absolute;
  z-index: 2;
  inset: 18%;
  width: 64%;
  height: 64%;
  color: #9c6725;
  opacity: 0.92;
}

.dragon-body {
  stroke-width: 25;
}

.dragon-head {
  stroke-width: 12;
}

.dragon-claw,
.dragon-scale,
.cloud-line {
  stroke-width: 7;
}

.dragon-detail,
.dragon-whisker {
  stroke-width: 4.5;
}

.dragon-whisker {
  stroke-width: 3;
}

.dragon-body,
.dragon-scale {
  stroke-dasharray: 2 5;
}

.wheel-taiji {
  position: absolute;
  z-index: 7;
  top: 50%;
  left: 50%;
  width: 124px;
  height: 124px;
  border: 5px solid #624016;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 25%, #13100d 0 8%, #d8d1c5 8.7% 25%, transparent 25.8%),
    radial-gradient(circle at 50% 75%, #d8d1c5 0 8%, #13100d 8.7% 25%, transparent 25.8%),
    linear-gradient(90deg, #d8d1c5 0 50%, #13100d 50%);
  box-shadow:
    inset 4px 4px 8px rgba(255, 255, 255, 0.24),
    inset -5px -5px 9px rgba(0, 0, 0, 0.62),
    0 6px 10px rgba(0, 0, 0, 0.65);
  transform: translate(-50%, -50%) translateZ(12px);
}

.wheel-hub {
  position: absolute;
  z-index: 8;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  border: 2px solid #e2b863;
  border-radius: 50%;
  background: #2b1807;
  box-shadow: 0 2px 5px #000;
  transform: translate(-50%, -50%) translateZ(18px);
}

.wheel-model-shadow {
  position: absolute;
  z-index: 0;
  right: 7%;
  bottom: 10%;
  left: 7%;
  height: 25%;
  border-radius: 50%;
  background: rgba(31, 18, 6, 0.35);
  filter: blur(34px);
  transform: translateY(54px);
}

.wheel-caption {
  position: absolute;
  z-index: 3;
  bottom: 2px;
  margin: 0;
  color: var(--yi-muted);
  font-size: 12px;
  letter-spacing: 0.34em;
}

/* Home: draw lots */
.lot-section {
  display: block;
  min-height: 980px;
  padding: 72px max(5vw, 24px) 100px;
  border-top: 1px solid var(--yi-line);
  background:
    radial-gradient(circle at 50% 52%, rgba(155, 113, 60, 0.14), transparent 34rem),
    color-mix(in srgb, var(--yi-surface) 72%, var(--yi-paper));
}

.lot-copy {
  text-align: center;
}

.section-number {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  margin: 0 auto 20px;
  border: 1px solid currentColor;
  border-radius: 50%;
  color: var(--yi-gold);
}

.lot-copy h1 {
  margin: 0;
  font-size: clamp(2.4rem, 4vw, 4.4rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.05em;
}

.lot-copy p {
  max-width: 30em;
  margin: 18px auto 0;
  color: var(--yi-muted);
  font-size: 12px;
  line-height: 1.8;
}

.lot-copy p:empty {
  display: none;
}

.lot-stage {
  position: relative;
  display: grid;
  width: min(100%, 980px);
  min-height: 750px;
  place-items: center;
  margin: 10px auto 0;
  padding: 38px 20px 92px;
}

.lot-box {
  position: relative;
  width: 430px;
  height: 620px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  filter: drop-shadow(24px 36px 30px rgba(31, 20, 10, 0.35));
  perspective: 1100px;
  touch-action: none;
  user-select: none;
  appearance: none;
}

.box-model {
  position: absolute;
  inset: 0;
  display: block;
  transform: rotateX(var(--model-rx, -4deg)) rotateY(var(--model-ry, -8deg)) rotateZ(var(--model-rz, 0deg));
  transform-origin: 50% 55%;
  transform-style: preserve-3d;
  transition: filter 180ms ease;
  will-change: transform;
}

.lot-box.is-dragging {
  cursor: grabbing;
}

.lot-box:disabled {
  cursor: wait;
  opacity: 0.75;
}

.lot-box-lid,
.lot-box-body {
  position: absolute;
  left: 50%;
  display: block;
  width: 330px;
  color: #bd8a52;
  transform-style: preserve-3d;
}

.lot-box-lid {
  z-index: 6;
  top: 38px;
  height: 235px;
  transform: translateX(-50%);
  transform-origin: 12% 92%;
  transition: transform 760ms cubic-bezier(0.2, 0.78, 0.16, 1), opacity 540ms ease;
}

.box-lid-front,
.box-lid-back,
.box-body-front,
.box-body-back,
.box-lid-side,
.box-lid-left,
.box-body-side,
.box-body-left,
.box-lid-top,
.box-lid-bottom,
.box-body-rim,
.box-body-bottom {
  position: absolute;
  display: block;
  border: 1px solid #070503;
  background:
    radial-gradient(ellipse at 23% 16%, rgba(125, 82, 51, 0.17), transparent 36%),
    linear-gradient(104deg, #080707, #1d1715 44%, #070606 71%, #17110f);
  box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.86);
  backface-visibility: hidden;
}

.box-lid-front {
  inset: 0;
  z-index: 3;
  overflow: hidden;
  border-radius: 17px 17px 7px 7px;
  transform: translateZ(23px);
}

.box-lid-front::after,
.box-body-front::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(187, 130, 75, 0.2);
  border-radius: inherit;
  box-shadow: inset 0 0 12px rgba(175, 107, 67, 0.08);
  pointer-events: none;
}

.lid-dragon-mark {
  position: absolute;
  inset: 0;
  display: block;
  opacity: 0.42;
  background: url("../assets/yijing-card-engraving.webp") center 6% / 172% auto no-repeat;
  filter: sepia(1) saturate(0.75) hue-rotate(322deg) brightness(0.72) contrast(1.35);
  mix-blend-mode: screen;
}

.box-lid-front b {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 36px;
  left: 0;
  color: #c79457;
  font-family: var(--yi-font) !important;
  font-size: 43px;
  font-weight: 700;
  letter-spacing: 0.23em;
  text-align: center;
  text-indent: 0.23em;
  text-shadow: 0 2px 4px #000;
}

.box-lid-side {
  top: 7px;
  right: -43px;
  width: 47px;
  height: 220px;
  border-radius: 0 8px 5px 0;
  background: linear-gradient(90deg, #15100e, #050404);
  transform: rotateY(90deg);
  transform-origin: left center;
}

.box-lid-left {
  top: 7px;
  left: -43px;
  width: 47px;
  height: 220px;
  border-radius: 8px 0 0 5px;
  background: linear-gradient(270deg, #15100e, #050404);
  transform: rotateY(-90deg);
  transform-origin: right center;
}

.box-lid-back {
  inset: 0;
  overflow: hidden;
  border-radius: 17px 17px 7px 7px;
  background:
    radial-gradient(circle at 50% 52%, transparent 0 21%, rgba(189, 138, 82, 0.5) 21.5% 22%, transparent 22.5%),
    url("../assets/yijing-card-engraving.webp") center 90% / 165% auto no-repeat,
    #090706;
  filter: brightness(0.62) sepia(0.4);
  transform: rotateY(180deg) translateZ(23px);
}

.box-lid-top {
  top: -35px;
  left: 5px;
  display: grid;
  width: 324px;
  height: 61px;
  place-items: center;
  border-radius: 10px 10px 2px 2px;
  background:
    linear-gradient(180deg, rgba(180, 120, 75, 0.12), transparent),
    #0a0807;
  transform: rotateX(90deg);
  transform-origin: center bottom;
}

.box-lid-bottom {
  bottom: -29px;
  left: 3px;
  width: 324px;
  height: 52px;
  background: linear-gradient(#050404, #17110f);
  transform: rotateX(-90deg);
  transform-origin: center top;
}

.box-lid-top em {
  color: #d8a55c;
  font-family: var(--yi-font) !important;
  font-size: 21px;
  font-style: normal;
  font-weight: 900;
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  text-shadow: 0 2px 2px #000;
}

.lot-box-body {
  z-index: 4;
  bottom: 28px;
  height: 475px;
  transform: translateX(-50%);
}

.box-body-front {
  inset: 0;
  z-index: 3;
  overflow: hidden;
  border-radius: 5px 5px 19px 19px;
  transform: translateZ(23px);
}

.box-body-side {
  top: 4px;
  right: -45px;
  width: 49px;
  height: 465px;
  border-radius: 0 5px 11px 0;
  background:
    linear-gradient(90deg, rgba(93, 54, 38, 0.12), transparent 36%),
    #080606;
  transform: rotateY(90deg);
  transform-origin: left center;
}

.box-body-left {
  top: 4px;
  left: -45px;
  width: 49px;
  height: 465px;
  border-radius: 5px 0 0 11px;
  background:
    linear-gradient(270deg, rgba(93, 54, 38, 0.12), transparent 36%),
    #080606;
  transform: rotateY(-90deg);
  transform-origin: right center;
}

.box-body-back {
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 5px 5px 19px 19px;
  background:
    linear-gradient(rgba(8, 6, 5, 0.38), rgba(8, 6, 5, 0.7)),
    url("../assets/yijing-card-engraving.webp") center 87% / 126% auto no-repeat,
    #090706;
  filter: brightness(0.68) sepia(0.28);
  transform: rotateY(180deg) translateZ(23px);
}

.box-body-back i {
  width: 65%;
  color: rgba(213, 164, 91, 0.8);
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.28em;
  line-height: 2;
  text-align: center;
}

.box-body-rim {
  z-index: 5;
  top: -28px;
  left: -6px;
  width: 343px;
  height: 55px;
  border: 3px solid #15100e;
  border-radius: 4px;
  background:
    radial-gradient(ellipse, #050404 0 56%, #181211 58% 71%, #050404 73%);
  transform: rotateX(90deg) translateZ(4px);
  transform-origin: center bottom;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.025),
    0 5px 7px rgba(0, 0, 0, 0.62);
}

.box-body-bottom {
  right: 0;
  bottom: -24px;
  left: 0;
  height: 48px;
  border-radius: 0 0 14px 14px;
  background:
    radial-gradient(ellipse, #15100e, #050404 72%),
    #080606;
  transform: rotateX(-90deg);
  transform-origin: center top;
}

.box-engraving {
  position: absolute;
  inset: 0;
  display: block;
  font-style: normal;
  opacity: 0.7;
  background: url("../assets/yijing-card-engraving.webp") center 88% / 124% auto no-repeat;
  filter: sepia(1) saturate(0.82) hue-rotate(315deg) brightness(0.74) contrast(1.34);
  mix-blend-mode: screen;
}

.box-title {
  position: absolute;
  z-index: 4;
  top: 40%;
  right: 0;
  left: 0;
  color: #d5a25e;
  font-family: var(--yi-font) !important;
  font-size: 57px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.2em;
  text-align: center;
  text-indent: 0.2em;
  text-shadow:
    0 2px 2px #000,
    0 0 8px rgba(209, 147, 79, 0.22);
}

.box-body-front b {
  position: absolute;
  z-index: 3;
  right: 0;
  bottom: 42px;
  left: 0;
  color: rgba(205, 151, 94, 0.9);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.38em;
  text-align: center;
  text-indent: 0.38em;
  text-shadow: 0 2px 4px #000;
}

.lot-sticks {
  position: absolute;
  z-index: 3;
  top: 30px;
  left: 50%;
  width: 250px;
  height: 280px;
  opacity: 0;
  transform: translateX(-50%) translateY(145px) rotateY(-10deg);
  transition: transform 520ms ease, opacity 420ms ease;
}

.lot-sticks i {
  position: absolute;
  bottom: 0;
  left: calc(50% - 13px);
  width: 26px;
  height: 270px;
  border-radius: 13px 13px 3px 3px;
  background:
    radial-gradient(ellipse at 30% 10%, rgba(255, 218, 142, 0.22), transparent 20%),
    linear-gradient(90deg, #17100a, #4c331d 38%, #26190f 72%, #0e0906);
  box-shadow:
    inset 0 0 0 1px rgba(235, 190, 115, 0.22),
    inset 5px 0 8px rgba(255, 213, 137, 0.05),
    0 4px 5px rgba(0, 0, 0, 0.5);
  transform-origin: 50% 100%;
}

.lot-sticks i:nth-child(1) { transform: rotate(-18deg) translateY(12px); }
.lot-sticks i:nth-child(2) { transform: rotate(-12deg) translateY(3px); }
.lot-sticks i:nth-child(3) { transform: rotate(-6deg) translateY(8px); }
.lot-sticks i:nth-child(4) { transform: rotate(0deg) translateY(-1px); }
.lot-sticks i:nth-child(5) { transform: rotate(7deg) translateY(5px); }
.lot-sticks i:nth-child(6) { transform: rotate(13deg) translateY(11px); }
.lot-sticks i:nth-child(7) { transform: rotate(19deg) translateY(2px); }

.lot-sticks i::before {
  content: "䷀";
  position: absolute;
  top: 17px;
  right: 0;
  left: 0;
  color: #caa25f;
  font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", sans-serif !important;
  font-size: 16px;
  font-style: normal;
  line-height: 1;
  text-align: center;
  text-shadow: 0 1px 1px #000;
}

.lot-sticks i::after {
  content: "";
  position: absolute;
  top: 50px;
  left: 50%;
  width: 11px;
  height: 11px;
  border: 1px solid rgba(205, 161, 88, 0.72);
  border-radius: 50%;
  transform: translateX(-50%);
}

.lot-sticks i:nth-child(2)::before { content: "䷁"; }
.lot-sticks i:nth-child(3)::before { content: "䷜"; }
.lot-sticks i:nth-child(4)::before { content: "䷝"; }
.lot-sticks i:nth-child(5)::before { content: "䷲"; }
.lot-sticks i:nth-child(6)::before { content: "䷳"; }
.lot-sticks i:nth-child(7)::before { content: "䷸"; }

.lot-action {
  position: absolute;
  z-index: 8;
  right: 0;
  bottom: -18px;
  left: 0;
  color: var(--yi-muted);
  font-size: 12px;
  letter-spacing: 0.25em;
  text-align: center;
}

.lot-stage.is-shaking .lot-box {
  animation: lot-shake 130ms ease-in-out 6;
}

.lot-stage.is-opening .lot-box-lid,
.lot-stage.has-result .lot-box-lid {
  opacity: 0.94;
  transform: translateX(-50%) translate(-270px, -105px) rotateX(-16deg) rotateY(-24deg) rotateZ(-15deg);
}

.lot-stage.is-opening .lot-sticks,
.lot-stage.has-result .lot-sticks {
  opacity: 1;
  transform: translateX(-50%) translateY(-40px) rotateY(-10deg);
}

@keyframes lot-shake {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-3.2deg) translateX(-3px); }
  75% { transform: rotate(3.2deg) translateX(3px); }
}

.drawn-lot-wrap {
  position: absolute;
  z-index: 8;
  bottom: 116px;
  left: 50%;
  width: 82px;
  height: 520px;
  margin-left: -41px;
  animation: lot-rise 900ms cubic-bezier(0.2, 0.78, 0.18, 1) both;
  filter: drop-shadow(0 25px 18px rgba(24, 14, 7, 0.34));
}

.drawn-lot {
  position: absolute;
  inset: 0;
  cursor: grab;
  touch-action: none;
  transform: rotateX(var(--model-rx, -3deg)) rotateY(var(--model-ry, 8deg)) rotateZ(var(--model-rz, 0deg));
  transform-style: preserve-3d;
  will-change: transform;
}

.drawn-lot.is-dragging {
  cursor: grabbing;
}

.lot-stick-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 29px 9px 20px;
  overflow: hidden;
  border: 1px solid #080604;
  border-radius: 42px 42px 6px 6px;
  color: #d6aa5d;
  background:
    radial-gradient(ellipse at 22% 11%, rgba(168, 110, 59, 0.12), transparent 24%),
    radial-gradient(ellipse at 80% 74%, rgba(0, 0, 0, 0.68), transparent 48%),
    linear-gradient(94deg, #0b0805, #2a1d12 39%, #171008 70%, #070503);
  box-shadow:
    inset 0 0 0 3px rgba(239, 197, 123, 0.045),
    inset 0 0 24px rgba(0, 0, 0, 0.68),
    inset 7px 0 12px rgba(255, 211, 139, 0.035);
  backface-visibility: hidden;
}

.lot-stick-front {
  transform: translateZ(5px);
}

.lot-stick-front::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.24;
  background:
    repeating-linear-gradient(92deg, transparent 0 8px, rgba(218, 166, 91, 0.16) 9px, transparent 10px 19px),
    radial-gradient(ellipse at 50% -10%, transparent 0 34px, #c99b52 36px 37px, transparent 39px 61px),
    radial-gradient(ellipse at 60% 102%, transparent 0 42px, #000 44px 46px, transparent 48px 76px);
}

.lot-stick-back {
  justify-content: center;
  gap: 22px;
  color: #c99a50;
  background:
    radial-gradient(circle at 50% 45%, rgba(191, 139, 70, 0.13), transparent 28%),
    linear-gradient(94deg, #080604, #21160d 46%, #090604);
  transform: rotateY(180deg) translateZ(5px);
}

.lot-back-symbol {
  font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", sans-serif !important;
  font-size: 38px;
}

.lot-back-name {
  display: grid;
  width: 38px;
  min-height: 38px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 18px;
  writing-mode: vertical-rl;
}

.lot-back-seal {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
}

.lot-stick-edge {
  position: absolute;
  top: 42px;
  bottom: 6px;
  width: 10px;
  border: 1px solid #070503;
  background: linear-gradient(90deg, #090604, #3a2818, #0b0705);
}

.lot-stick-edge-left {
  left: -5px;
  transform: rotateY(-90deg);
}

.lot-stick-edge-right {
  right: -5px;
  transform: rotateY(90deg);
}

.lot-hexagram,
.lot-name-circles,
.lot-judgment,
.lot-number {
  position: relative;
  z-index: 1;
}

.lot-hexagram {
  font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", sans-serif !important;
  font-size: 36px;
  line-height: 1;
}

.lot-name-circles {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 16px;
}

.lot-name-circles span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
}

.lot-judgment {
  flex: 1;
  margin-top: 18px;
  overflow: hidden;
  font-size: 11.5px;
  line-height: 1.55;
  letter-spacing: 0.09em;
  writing-mode: vertical-rl;
}

.lot-number {
  margin-top: 12px;
  font-size: 8px;
  letter-spacing: 0.08em;
}

@keyframes lot-rise {
  0% { opacity: 0; transform: translate(0, 260px) rotate(0deg); }
  52% { opacity: 1; transform: translate(0, -38px) rotate(0deg); }
  100% { opacity: 1; transform: translate(-305px, 0) rotate(-2deg); }
}

.lot-result-actions {
  position: absolute;
  right: 0;
  bottom: 26px;
  left: 0;
  display: flex;
  justify-content: center;
  gap: 10px;
}

.lot-result-actions button,
.meaning-nav button {
  min-height: 38px;
  padding: 0 17px;
  border: 1px solid var(--yi-line);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
}

.lot-result-actions button:first-child {
  border-color: var(--yi-ink);
  background: var(--yi-ink);
  color: var(--yi-paper);
}

/* Card catalogue */
.yijing-tools {
  position: relative;
  z-index: 20;
  top: auto;
  padding: 22px 0 20px;
  border-bottom: 1px solid var(--yi-line);
  background-color: var(--yi-tools-bg);
  backdrop-filter: blur(16px);
  transition: color 240ms ease, border-color 240ms ease, background-color 240ms ease;
}

.tool-row {
  display: grid;
  gap: 18px;
}

.tool-primary {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.card-search {
  display: grid;
  flex: 1 1 680px;
  gap: 8px;
  max-width: 680px;
  color: var(--yi-muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.card-search input {
  width: 100%;
  height: 46px;
  padding: 0 16px;
  border: 1px solid color-mix(in srgb, var(--yi-ink) 20%, transparent);
  border-radius: 10px;
  outline: 0;
  background-color: var(--yi-control-bg);
  color: var(--yi-ink);
  font-size: 15px;
  letter-spacing: 0.02em;
  transition: color 240ms ease, border-color 180ms ease, background-color 240ms ease, box-shadow 180ms ease;
}

.card-search input:focus {
  border-color: color-mix(in srgb, var(--yi-gold) 72%, var(--yi-ink));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--yi-gold) 14%, transparent);
}

.tool-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.filter-block {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding-top: 17px;
  border-top: 1px solid color-mix(in srgb, var(--yi-line) 72%, transparent);
}

.filter-label {
  color: var(--yi-muted);
  font-size: 11px;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.palette-filters {
  display: flex;
  min-width: 0;
  gap: 7px;
}

.filter-chip,
.reset-cards {
  height: 40px;
  border: 1px solid color-mix(in srgb, var(--yi-ink) 18%, transparent);
  border-radius: 9px;
  background-color: var(--yi-control-bg);
  color: var(--yi-muted);
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, background-color 240ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.filter-chip {
  display: inline-flex;
  min-width: 82px;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 10px;
}

.filter-chip b {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.filter-chip small {
  color: color-mix(in srgb, currentColor 68%, transparent);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.filter-dot {
  display: block;
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.filter-dot.is-all {
  background: conic-gradient(#77736b 0 20%, #4f5947 20% 40%, #171411 40% 60%, #703a32 60% 80%, #6a5038 80%);
}

.filter-dot.is-metal {
  background: #77736b;
}

.filter-dot.is-wood {
  background: #4f5947;
}

.filter-dot.is-water {
  background: #171411;
}

.filter-dot.is-fire {
  background: #703a32;
}

.filter-dot.is-earth {
  background: #6a5038;
}

.filter-chip:hover,
.filter-chip.is-active,
.reset-cards:hover {
  border-color: color-mix(in srgb, var(--yi-gold) 68%, var(--yi-ink));
  background-color: var(--yi-active-bg);
  color: var(--yi-ink);
}

.filter-chip.is-active {
  box-shadow: inset 0 -2px 0 var(--yi-gold);
}

.reset-cards {
  display: inline-flex;
  min-width: 86px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  font-size: 13px;
  white-space: nowrap;
}

.reset-cards i {
  font-family: var(--yi-font);
  font-size: 16px;
  font-style: normal;
  line-height: 1;
}

.tool-count {
  display: grid;
  min-width: 86px;
  height: 40px;
  margin: 0;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--yi-ink) 13%, transparent);
  border-radius: 9px;
  background-color: color-mix(in srgb, var(--yi-control-bg) 70%, transparent);
  color: var(--yi-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  white-space: nowrap;
  transition: color 240ms ease, border-color 240ms ease, background-color 240ms ease;
}

.yijing-deck {
  min-height: calc(100vh - 145px);
  padding: 52px 0 120px;
  background-color: var(--yi-page-bg);
  transition: background-color 240ms ease;
}

.hex-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px 24px;
}

.hex-card-wrap {
  min-width: 0;
  perspective: 1600px;
}

.hex-card {
  position: relative;
  width: 100%;
  aspect-ratio: 0.675;
  outline: none;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 720ms cubic-bezier(0.2, 0.72, 0.18, 1);
}

.hex-card.is-flipped {
  transform: rotateY(180deg);
}

.hex-card:focus-visible .card-face {
  outline: 3px solid #a57b00;
  outline-offset: 4px;
}

.card-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 1px solid rgba(25, 24, 20, 0.18);
  border-radius: 24px;
  backface-visibility: hidden;
  box-shadow: 0 16px 38px rgba(36, 31, 20, 0.15);
}

.card-front {
  display: grid;
  place-items: center;
  isolation: isolate;
  padding: 28px;
  color: var(--card-fg);
  text-align: center;
  background:
    radial-gradient(ellipse at 14% -18%, transparent 0 24px, var(--grain-dark) 25px 27px, transparent 28px 48px),
    radial-gradient(ellipse at 110% 70%, transparent 0 37px, var(--grain-light) 39px 41px, transparent 43px 72px),
    radial-gradient(circle at 50% 43%, var(--card-glow) 0, transparent 32%),
    linear-gradient(145deg, var(--card-hi), var(--card-bg) 42%, var(--card-deep));
}

.card-front::after {
  content: "";
  position: absolute;
  z-index: -2;
  inset: 7%;
  border: 1px solid currentColor;
  border-radius: 18px;
  opacity: 0.24;
  pointer-events: none;
}

.front-engraving-image {
  position: absolute;
  z-index: -1;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.78;
  filter: invert(1) contrast(1.12);
  mix-blend-mode: multiply;
  pointer-events: none;
}

.hex-card-wrap[data-palette="water"] .front-engraving-image {
  opacity: 0.84;
  filter: contrast(1.08);
  mix-blend-mode: screen;
}

.front-symbol {
  position: absolute;
  z-index: 2;
  top: 15px;
  left: 50%;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid color-mix(in srgb, currentColor 72%, transparent);
  border-radius: 50%;
  background: linear-gradient(145deg, var(--card-core-hi), var(--card-core) 58%, var(--card-core-deep));
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
  font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", sans-serif !important;
  font-size: 28px;
  line-height: 1;
  transform: translateX(-50%);
}

.front-center {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46%;
  min-width: 0;
  aspect-ratio: 1;
  border: 2px solid currentColor;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--card-core-hi), var(--card-core) 62%, var(--card-core-deep));
  box-shadow:
    0 0 0 8px color-mix(in srgb, var(--card-core) 84%, transparent),
    0 0 0 10px color-mix(in srgb, currentColor 30%, transparent),
    0 10px 30px rgba(0, 0, 0, 0.13);
}

.front-name {
  display: block;
  font-size: clamp(3rem, 5.8vw, 5.2rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.08em;
  white-space: nowrap;
  transform: translateY(-0.03em);
}

.front-name.is-multichar {
  max-width: 86%;
  font-size: clamp(1.65rem, 3vw, 2.7rem);
  letter-spacing: 0;
  transform: translateY(-0.03em) scaleX(0.94);
}

.front-index,
.front-pair {
  position: absolute;
  z-index: 2;
  border: 1px solid color-mix(in srgb, currentColor 68%, transparent);
  border-radius: 999px;
  color: var(--card-fg);
  background: linear-gradient(145deg, var(--card-core-hi), var(--card-core) 58%, var(--card-core-deep));
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.22);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.front-index {
  top: 17px;
  left: 17px;
  padding: 5px 8px 4px;
}

.front-pair {
  bottom: 17px;
  left: 50%;
  width: max-content;
  padding: 6px 11px 5px;
  transform: translateX(-50%);
}

.hex-card-wrap[data-palette="metal"] {
  --card-bg: #77736b;
  --card-hi: #9b968c;
  --card-deep: #44413c;
  --card-core: #5f5b55;
  --card-core-hi: #817c73;
  --card-core-deep: #37342f;
  --card-fg: #fffaf0;
  --grain-dark: rgba(32, 30, 27, 0.24);
  --grain-light: rgba(246, 239, 222, 0.13);
  --card-glow: rgba(203, 197, 183, 0.16);
  --back-bg: #605c55;
  --back-hi: #817c73;
  --back-deep: #35322e;
  --back-fg: #fffaf0;
}

.hex-card-wrap[data-palette="wood"] {
  --card-bg: #4f5947;
  --card-hi: #707a63;
  --card-deep: #283024;
  --card-core: #3e4738;
  --card-core-hi: #626d57;
  --card-core-deep: #23291f;
  --card-fg: #f6f0df;
  --grain-dark: rgba(17, 25, 15, 0.3);
  --grain-light: rgba(204, 218, 183, 0.1);
  --card-glow: rgba(118, 136, 102, 0.16);
  --back-bg: #3e4837;
  --back-hi: #626d57;
  --back-deep: #22281e;
  --back-fg: #f6f0df;
}

.hex-card-wrap[data-palette="water"] {
  --card-bg: #171411;
  --card-hi: #302a25;
  --card-deep: #070605;
  --card-core: #12100e;
  --card-core-hi: #2a241f;
  --card-core-deep: #060504;
  --card-fg: #f0dfc2;
  --grain-dark: rgba(0, 0, 0, 0.42);
  --grain-light: rgba(150, 112, 76, 0.09);
  --card-glow: rgba(82, 63, 48, 0.16);
  --back-bg: #13100e;
  --back-hi: #2a241f;
  --back-deep: #060504;
  --back-fg: #f0dfc2;
}

.hex-card-wrap[data-palette="fire"] {
  --card-bg: #703a32;
  --card-hi: #925348;
  --card-deep: #381b18;
  --card-core: #582b26;
  --card-core-hi: #7b443b;
  --card-core-deep: #2e1513;
  --card-fg: #fff0dc;
  --grain-dark: rgba(57, 18, 15, 0.3);
  --grain-light: rgba(243, 186, 153, 0.1);
  --card-glow: rgba(148, 70, 57, 0.18);
  --back-bg: #592c27;
  --back-hi: #7b443b;
  --back-deep: #2c1412;
  --back-fg: #fff0dc;
}

.hex-card-wrap[data-palette="earth"] {
  --card-bg: #6a5038;
  --card-hi: #8c6a49;
  --card-deep: #362718;
  --card-core: #523b29;
  --card-core-hi: #76573c;
  --card-core-deep: #2f2116;
  --card-fg: #fff1d9;
  --grain-dark: rgba(46, 29, 16, 0.27);
  --grain-light: rgba(231, 198, 151, 0.11);
  --card-glow: rgba(150, 110, 69, 0.17);
  --back-bg: #55402d;
  --back-hi: #76573c;
  --back-deep: #2f2116;
  --back-fg: #fff1d9;
}

.card-back {
  display: flex;
  flex-direction: column;
  padding: 0;
  color: var(--back-fg);
  background:
    radial-gradient(circle at 16% 9%, color-mix(in srgb, var(--back-hi) 78%, transparent), transparent 33%),
    radial-gradient(circle at 88% 82%, var(--back-deep), transparent 54%),
    linear-gradient(145deg, var(--back-hi), var(--back-bg) 48%, var(--back-deep));
  transform: rotateY(180deg);
}

.back-scroll {
  height: 100%;
  overflow-y: auto;
  padding: 22px 22px 20px;
  scrollbar-width: thin;
}

.back-header {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.back-header::after {
  content: "";
}

.back-number {
  opacity: 0.7;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.back-name {
  display: grid;
  min-width: 42px;
  height: 42px;
  place-items: center;
  justify-self: center;
  padding: 0 8px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.08em;
}

.judgment {
  min-height: 3.4em;
  margin: 0 5px 14px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.65;
  text-align: center;
}

.hexagram-diagram {
  position: relative;
  display: grid;
  gap: 7px;
  width: min(76%, 235px);
  margin: 0 auto 18px;
  padding-right: 42px;
}

.yao-bar {
  display: flex;
  height: 9px;
  gap: 16%;
}

.yao-bar > i {
  display: block;
  flex: 1;
  background: currentColor;
}

.yao-bar.yang > i:last-child {
  display: none;
}

.yao-bar.yang > i:first-child {
  flex-basis: 100%;
}

.trigram-label {
  position: absolute;
  right: 0;
  display: flex;
  align-items: center;
  width: 35px;
  height: calc(50% - 3px);
  border-right: 1px solid currentColor;
  opacity: 0.72;
  font-size: 8px;
}

.trigram-label::before,
.trigram-label::after {
  content: "";
  position: absolute;
  right: 0;
  width: 7px;
  border-top: 1px solid currentColor;
}

.trigram-label::before { top: 0; }
.trigram-label::after { bottom: 0; }
.trigram-label.upper { top: 0; }
.trigram-label.lower { bottom: 0; }

.yao-texts {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.5;
}

.yao-texts li {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 7px;
}

.yao-texts b {
  font-weight: 800;
  white-space: nowrap;
}

.xiang {
  margin: 15px 0 0;
  padding-top: 12px;
  border-top: 1px solid color-mix(in srgb, currentColor 22%, transparent);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.55;
}

.deck-empty {
  padding: 100px 20px;
  text-align: center;
}

.deck-empty span {
  font-size: 2rem;
}

.deck-empty p {
  color: var(--yi-muted);
}

/* Meaning view */
.meaning-section {
  min-height: calc(100vh - 56px);
  padding: 74px max(5vw, 24px) 110px;
}

.meaning-shell {
  display: grid;
  grid-template-columns: minmax(220px, 310px) minmax(0, 820px);
  gap: clamp(40px, 8vw, 120px);
  width: min(1240px, 100%);
  margin: 0 auto;
}

.meaning-index {
  position: sticky;
  top: 118px;
  align-self: start;
}

.meaning-index > p {
  margin: 0 0 52px;
  color: var(--yi-muted);
  font-size: 11px;
  letter-spacing: 0.26em;
}

.meaning-index label {
  display: block;
  margin-bottom: 8px;
  color: var(--yi-muted);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.meaning-index select {
  width: 100%;
  padding: 13px 36px 13px 0;
  border: 0;
  border-bottom: 1px solid var(--yi-ink);
  border-radius: 0;
  outline: 0;
  background: transparent;
  color: var(--yi-ink);
  font-size: 17px;
}

.meaning-index select option {
  background: var(--yi-paper);
  color: var(--yi-ink);
}

.meaning-nav {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

.meaning-detail {
  min-width: 0;
}

.meaning-hero {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 24px;
  padding-bottom: 45px;
  border-bottom: 1px solid var(--yi-line);
}

.meaning-number {
  align-self: start;
  padding-top: 8px;
  color: var(--yi-muted);
  font-size: 10px;
  letter-spacing: 0.1em;
}

.meaning-symbol {
  display: grid;
  width: 80px;
  height: 80px;
  place-items: center;
  border: 1px solid var(--yi-line);
  border-radius: 50%;
  font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", sans-serif !important;
  font-size: 52px;
}

.meaning-hero h1 {
  margin: 0;
  font-size: clamp(4rem, 8vw, 7rem);
  font-weight: 500;
  line-height: 0.9;
}

.meaning-hero p {
  margin: 14px 0 0;
  color: var(--yi-muted);
  font-size: 12px;
  letter-spacing: 0.14em;
}

.meaning-body {
  padding-top: 50px;
}

.meaning-judgment,
.meaning-lines,
.meaning-body blockquote {
  position: relative;
  margin: 0;
  padding: 0 0 44px 100px;
}

.meaning-judgment > span,
.meaning-lines > span,
.meaning-body blockquote > span {
  position: absolute;
  top: 0;
  left: 0;
  color: var(--yi-gold);
  font-size: 11px;
  letter-spacing: 0.2em;
}

.meaning-judgment > p {
  margin: 0 0 34px;
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  line-height: 1.45;
}

.meaning-diagram {
  width: min(320px, 86%);
  margin: 0;
}

.meaning-line-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--yi-line);
  list-style: none;
}

.meaning-line-list li {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 18px;
  padding: 16px 0;
  border-bottom: 1px solid var(--yi-line);
  line-height: 1.7;
}

.meaning-line-list b {
  font-weight: 700;
}

.meaning-body blockquote {
  padding-top: 32px;
  border-top: 1px solid var(--yi-line);
}

.meaning-body blockquote > span {
  top: 35px;
}

.meaning-body blockquote p {
  margin: 0;
  font-size: 22px;
  line-height: 1.8;
}

/* Dark mode */
.yijing-library.is-dark {
  --yi-ink: #efe8da;
  --yi-muted: #a49b8b;
  --yi-paper: #12100d;
  --yi-surface: #1c1813;
  --yi-line: rgba(244, 231, 207, 0.16);
  --yi-gold: #c49a52;
  --yi-page-bg: #12100d;
  --yi-tools-bg: rgba(20, 17, 13, 0.94);
  --yi-control-bg: rgba(38, 32, 25, 0.62);
  --yi-active-bg: rgba(196, 154, 82, 0.12);
  background-color: var(--yi-page-bg);
}

.is-dark .wheel-model {
  filter: brightness(0.86) contrast(1.06);
}

.is-dark .lot-section {
  background:
    radial-gradient(circle at 72% 45%, rgba(135, 86, 36, 0.12), transparent 28rem),
    #17130f;
}

@media (max-width: 1180px) {
  .hex-card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tool-row { flex-wrap: wrap; }
  .card-search { max-width: none; }
}

@media (max-width: 900px) {
  .yijing-shell { width: min(100% - 38px, 680px); }
  .yijing-app-header { align-items: center; min-height: 56px; padding: 0 18px; }
  .yijing-app-brand { margin-top: 0; }
  .yijing-app-nav { flex-wrap: nowrap; justify-content: flex-end; max-width: none; gap: 0 18px; }
  .wheel-section { min-height: calc(100vh - 56px); }
  .lot-section { min-height: auto; }
  .lot-copy { padding-top: 0; text-align: center; }
  .section-number { margin-right: auto; margin-left: auto; }
  .lot-copy p { margin-right: auto; margin-left: auto; }
  .lot-stage { width: min(100%, 850px); margin: 20px auto 0; }
  .yijing-tools { position: relative; top: auto; }
  .tool-row { align-items: stretch; }
  .tool-primary { display: grid; grid-template-columns: 1fr; gap: 14px; }
  .card-search { max-width: none; }
  .tool-actions { justify-content: flex-end; }
  .filter-block { grid-template-columns: 1fr; gap: 10px; }
  .palette-filters {
    width: 100%;
    padding-bottom: 6px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
  }
  .palette-filters::-webkit-scrollbar { display: none; }
  .filter-chip { min-width: 88px; flex: 0 0 88px; }
  .hex-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 16px; }
  .meaning-shell { grid-template-columns: 1fr; gap: 56px; }
  .meaning-index { position: static; }
  .meaning-index > p { margin-bottom: 24px; }
}

@media (max-width: 600px) {
  .yijing-shell { width: calc(100% - 28px); }
  .yijing-app-header { min-height: 54px; padding: 0 12px; }
  .yijing-app-brand { font-size: 13px; }
  .yijing-app-brand > span:last-child { display: none; }
  .brand-seal { width: 30px; height: 30px; font-size: 15px; }
  .yijing-app-nav { max-width: none; gap: 0 10px; }
  .app-nav-link,
  .theme-switch { font-size: 12px; }
  .theme-switch { width: 28px; height: 28px; padding: 0; }
  .wheel-section { min-height: calc(100svh - 54px); padding: 34px 10px 52px; }
  .wheel-stage { width: min(96vw, 560px); min-height: min(500px, calc(100svh - 120px)); }
  .wheel-perspective { width: 96vw; }
  .wheel-perspective { transform: translateY(-22px); }
  .wheel-caption { bottom: -46px; font-size: 10px; letter-spacing: 0.22em; }
  .lot-section { padding: 70px 16px 88px; }
  .lot-copy h1 { font-size: 2.8rem; }
  .lot-stage { display: grid; min-height: 980px; padding: 0 0 70px; }
  .lot-box { align-self: start; margin-top: -40px; transform: scale(0.72); }
  .drawn-lot-wrap { bottom: 76px; width: 72px; height: 450px; margin-left: -36px; }
  .lot-result-actions { bottom: 6px; }
  @keyframes lot-rise {
    from { opacity: 0; transform: translateY(-320px) rotate(2deg); }
    to { opacity: 1; transform: translateY(0) rotate(-2deg); }
  }
  .yijing-tools { padding: 17px 0 15px; }
  .tool-row { gap: 14px; }
  .card-search { gap: 7px; font-size: 11px; }
  .card-search input { height: 44px; font-size: 14px; }
  .filter-block { padding-top: 14px; }
  .filter-label { font-size: 10px; }
  .palette-filters { width: 100%; flex-wrap: nowrap; }
  .filter-chip { min-width: 84px; flex: 0 0 84px; padding: 0 8px; }
  .filter-chip b { font-size: 12px; }
  .reset-cards { min-width: 80px; height: 38px; }
  .tool-count { min-width: 80px; height: 38px; }
  .yijing-deck { padding: 38px 0 80px; }
  .hex-card-grid { grid-template-columns: 1fr; gap: 22px; }
  .hex-card { aspect-ratio: 0.69; }
  .back-scroll { padding: 26px 25px 23px; }
  .judgment { font-size: 13px; }
  .yao-texts,
  .xiang { font-size: 11px; }
  .meaning-section { padding: 50px 20px 80px; }
  .meaning-hero { grid-template-columns: auto 1fr; gap: 18px; }
  .meaning-number { grid-column: 1 / -1; }
  .meaning-symbol { width: 64px; height: 64px; font-size: 40px; }
  .meaning-hero h1 { font-size: 4rem; }
  .meaning-judgment,
  .meaning-lines,
  .meaning-body blockquote { padding-left: 0; padding-top: 38px; }
  .meaning-judgment > span,
  .meaning-lines > span,
  .meaning-body blockquote > span { top: 0; }
  .meaning-body blockquote > span { top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .lot-stage.is-shaking .lot-box {
    animation: none;
  }

  .hex-card {
    transition-duration: 1ms;
  }
}

.app-nav-more {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.app-nav-trigger {
  position: relative;
}

.app-nav-trigger::after {
  content: "";
  position: absolute;
  right: .12em;
  bottom: -4px;
  left: 0;
  height: 1px;
  background: var(--yi-gold);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 240ms ease;
}

.app-nav-more:hover .app-nav-trigger::after,
.app-nav-more:focus-within .app-nav-trigger::after {
  transform: scaleX(1);
}

.app-nav-dropdown {
  position: absolute;
  z-index: 120;
  top: calc(100% + 12px);
  left: 50%;
  display: flex;
  width: max-content;
  min-width: 0;
  padding: 9px 10px;
  flex-direction: column;
  gap: 7px;
  border: 1px solid var(--yi-line);
  background: var(--yi-paper);
  box-shadow: 0 16px 38px rgba(18, 14, 9, 0.18);
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(8px);
  transition: opacity 240ms ease, transform 240ms ease, visibility 240ms ease;
}

.app-nav-more:hover .app-nav-dropdown,
.app-nav-more:focus-within .app-nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.app-nav-dropdown a {
  display: block;
  padding: 2px 1px;
  border-bottom: 1px solid transparent;
  color: var(--yi-muted);
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
}

.app-nav-dropdown a:hover,
.app-nav-dropdown a:focus-visible {
  border-bottom-color: var(--yi-gold);
  color: var(--yi-ink);
  outline: none;
}

@media (max-width: 600px) {
  .app-nav-dropdown {
    right: -38px;
    left: auto;
    transform: translateY(8px);
  }

  .app-nav-more:hover .app-nav-dropdown,
  .app-nav-more:focus-within .app-nav-dropdown {
    transform: translateY(0);
  }
}

/* WebGL ritual chamber --------------------------------------------------- */
.app-view[data-view="home"] {
  --yi-ink: #eee3cf;
  --yi-muted: #9f927e;
  --yi-line: rgba(196, 156, 85, 0.2);
  --yi-gold: #c69a51;
  position: relative;
  isolation: isolate;
  overflow: clip;
  color: var(--yi-ink);
  background: #080b0a;
}

.app-view[data-view="home"]::before {
  content: "";
  position: fixed;
  z-index: -1;
  inset: 56px 0 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 18%, rgba(138, 101, 42, 0.2), transparent 31rem),
    radial-gradient(circle at 8% 48%, rgba(34, 78, 65, 0.18), transparent 27rem),
    radial-gradient(circle at 91% 74%, rgba(106, 55, 26, 0.14), transparent 24rem),
    linear-gradient(180deg, #0d1110 0%, #050706 55%, #0b0907 100%);
}

.wheel-section,
.lot-section {
  position: relative;
  isolation: isolate;
}

.wheel-section {
  min-height: max(760px, calc(100vh - 56px));
  padding: 42px 24px 78px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.72), transparent 18%, transparent 82%, rgba(0, 0, 0, 0.72)),
    radial-gradient(circle at 50% 44%, rgba(118, 87, 40, 0.18), transparent 33rem);
}

.wheel-section::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: -14%;
  bottom: -17%;
  left: -14%;
  height: 48%;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 32% 65%, rgba(64, 91, 74, 0.2), transparent 33%),
    radial-gradient(ellipse at 68% 68%, rgba(92, 64, 37, 0.22), transparent 36%);
  filter: blur(30px);
  animation: chamber-fog 13s ease-in-out infinite alternate;
}

@keyframes chamber-fog {
  from { opacity: 0.45; transform: translate3d(-3%, 2%, 0) scale(0.96); }
  to { opacity: 0.86; transform: translate3d(3%, -2%, 0) scale(1.06); }
}

.wheel-stage {
  width: min(96vw, 900px);
  min-height: min(820px, calc(100vh - 100px));
}

.wheel-webgl {
  position: relative;
  z-index: 2;
  width: min(82vw, 760px);
  aspect-ratio: 1;
  outline: none;
  cursor: grab;
  touch-action: none;
  user-select: none;
  filter:
    drop-shadow(0 44px 32px rgba(0, 0, 0, 0.62))
    drop-shadow(0 0 42px rgba(151, 108, 43, 0.14));
}

.wheel-webgl::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 12%;
  border-radius: 50%;
  background: rgba(147, 102, 38, 0.14);
  filter: blur(52px);
}

.wheel-webgl canvas,
.lot-webgl canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}

.wheel-webgl.is-dragging,
.lot-webgl.is-dragging {
  cursor: grabbing;
}

.wheel-webgl:focus-visible,
.lot-webgl:focus-visible {
  border-radius: 22px;
  outline: 1px solid rgba(225, 187, 111, 0.7);
  outline-offset: 5px;
}

.model-drag-cue {
  position: absolute;
  z-index: 4;
  right: 50%;
  bottom: 4%;
  padding: 6px 12px;
  border: 1px solid rgba(203, 164, 92, 0.25);
  border-radius: 999px;
  background: rgba(8, 10, 9, 0.56);
  color: rgba(227, 210, 179, 0.64);
  font-size: 10px;
  letter-spacing: 0.15em;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateX(50%) translateY(5px);
  transition: opacity 220ms ease, transform 220ms ease;
  backdrop-filter: blur(8px);
}

.wheel-webgl:hover .model-drag-cue,
.wheel-webgl:focus-visible .model-drag-cue,
.lot-webgl:hover .model-drag-cue,
.lot-webgl:focus-visible .model-drag-cue {
  opacity: 1;
  transform: translateX(50%) translateY(0);
}

.wheel-caption {
  bottom: 6px;
  color: rgba(220, 197, 154, 0.62);
  text-shadow: 0 2px 12px #000;
}

.wheel-webgl.is-webgl-fallback {
  border: 1px solid rgba(196, 151, 72, 0.38);
  border-radius: 50%;
  background:
    radial-gradient(circle, #d2b47a 0 4%, #080a09 4.5% 15%, #7d5b2b 15.5% 16.5%, #11110e 17% 42%, #a77b38 42.5% 43.5%, #090a09 44% 76%, #b98d45 76.5% 78%, #17110a 79%);
}

.lot-section {
  min-height: 1040px;
  padding: 84px max(5vw, 24px) 110px;
  border-top-color: rgba(182, 140, 69, 0.24);
  background:
    linear-gradient(180deg, rgba(5, 7, 6, 0.94), rgba(10, 9, 7, 0.98)),
    radial-gradient(circle at 50% 45%, rgba(134, 87, 35, 0.2), transparent 35rem);
}

.lot-section::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.76), transparent 17%, transparent 83%, rgba(0, 0, 0, 0.76)),
    repeating-linear-gradient(90deg, transparent 0 13%, rgba(121, 90, 54, 0.035) 13.1% 13.4%);
}

.lot-copy {
  position: relative;
  z-index: 2;
}

.section-number {
  border-color: rgba(201, 158, 80, 0.62);
  box-shadow: inset 0 0 18px rgba(157, 104, 41, 0.2), 0 0 30px rgba(157, 104, 41, 0.12);
}

.lot-copy h1 {
  font-size: clamp(2rem, 3.2vw, 3.3rem);
  color: #e8dcc5;
  letter-spacing: 0.08em;
  text-shadow: 0 5px 25px rgba(0, 0, 0, 0.72);
}

.lot-stage {
  width: min(100%, 1000px);
  min-height: 760px;
  margin-top: 8px;
  padding: 0 20px 82px;
}

.lot-box.lot-webgl {
  width: min(88vw, 590px);
  height: min(116vw, 760px);
  max-height: 760px;
  margin: 0;
  border-radius: 26px;
  filter:
    drop-shadow(34px 46px 34px rgba(0, 0, 0, 0.66))
    drop-shadow(-8px -8px 32px rgba(139, 93, 43, 0.08));
  transform: none;
  perspective: none;
}

.lot-box.lot-webgl:disabled {
  opacity: 1;
  cursor: wait;
}

.lot-box.lot-webgl .lot-action {
  right: 50%;
  bottom: 2px;
  left: auto;
  min-width: 92px;
  padding: 8px 14px;
  border: 1px solid rgba(197, 151, 76, 0.32);
  border-radius: 999px;
  background: rgba(6, 8, 7, 0.66);
  color: rgba(226, 206, 168, 0.82);
  letter-spacing: 0.22em;
  transform: translateX(50%);
  backdrop-filter: blur(10px);
}

.lot-box.lot-webgl .lot-drag-cue {
  bottom: 49px;
}

.lot-stage.is-shaking .lot-box.lot-webgl {
  animation: none;
}

.drawn-lot-wrap {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: 0 !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
  filter: none !important;
  animation: none !important;
  white-space: nowrap;
}

.lot-result-actions {
  bottom: 8px;
  z-index: 12;
}

.lot-result-actions button {
  border-color: rgba(211, 177, 113, 0.32);
  background: rgba(12, 13, 11, 0.72);
  color: #d9c7a7;
  backdrop-filter: blur(10px);
}

.lot-result-actions button:first-child {
  border-color: #b88b45;
  background: #a67836;
  color: #090907;
}

.is-dark .app-view[data-view="home"] {
  background: #050706;
}

@media (max-width: 900px) {
  .wheel-section {
    min-height: max(680px, calc(100svh - 56px));
    padding-top: 34px;
  }

  .wheel-stage {
    min-height: min(720px, calc(100svh - 84px));
  }

  .wheel-webgl {
    width: min(92vw, 700px);
  }

  .lot-section {
    min-height: 930px;
    padding-top: 70px;
  }

  .lot-stage {
    min-height: 720px;
  }
}

@media (max-width: 600px) {
  .app-view[data-view="home"]::before {
    inset: 54px 0 0;
  }

  .wheel-section {
    min-height: calc(100svh - 54px);
    padding: 18px 4px 48px;
  }

  .wheel-stage {
    width: 100%;
    min-height: calc(100svh - 82px);
  }

  .wheel-webgl {
    width: min(100vw, 560px);
    transform: translateY(-8px);
  }

  .wheel-caption {
    bottom: 10px;
    font-size: 9px;
  }

  .model-drag-cue {
    display: none;
  }

  .lot-section {
    min-height: 820px;
    padding: 58px 8px 80px;
  }

  .lot-copy h1 {
    font-size: 2.15rem;
  }

  .lot-stage {
    min-height: 640px;
    margin-top: 0;
    padding: 0 0 66px;
  }

  .lot-box.lot-webgl {
    align-self: center;
    width: min(100vw, 510px);
    height: min(132vw, 680px);
    max-height: 680px;
    margin-top: 0;
    transform: none;
  }

  .lot-box.lot-webgl .lot-action {
    bottom: 2px;
  }

  .lot-result-actions {
    bottom: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wheel-section::after {
    animation: none;
  }
}

/* Narrative homepage: 玄门入局 ----------------------------------------- */
.app-view[data-view="home"]::before {
  position: absolute;
}

.wheel-section {
  display: block;
  min-height: max(760px, calc(100svh - 56px));
  padding: 54px 0 74px;
}

.ritual-hero {
  display: grid;
  width: min(1540px, calc(100% - 72px));
  min-height: min(780px, calc(100svh - 130px));
  align-items: center;
  grid-template-columns: minmax(350px, 0.78fr) minmax(620px, 1.22fr);
  gap: clamp(42px, 6vw, 108px);
  margin: 0 auto;
}

.hero-copy {
  position: relative;
  z-index: 4;
  max-width: 540px;
  padding-left: clamp(0px, 2.4vw, 38px);
}

.hero-kicker,
.inscription-heading > span,
.knowledge-heading > span,
.portal-copy > span {
  display: block;
  margin-bottom: 22px;
  color: #aa8244;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3em;
}

.hero-copy h1 {
  margin: 0;
  color: #e9deca;
  font-size: clamp(3.3rem, 5.4vw, 6.4rem);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.07em;
  text-shadow: 0 12px 40px rgba(0, 0, 0, 0.54);
}

.hero-copy h1 em {
  color: #c8a66a;
  font-style: normal;
}

.hero-copy > p {
  max-width: 36em;
  margin: 30px 0 0;
  color: #9c9384;
  font-size: 14px;
  line-height: 2;
}

.hero-marks {
  display: flex;
  width: min(100%, 440px);
  margin: 38px 0 0;
  padding: 18px 0;
  border-top: 1px solid rgba(191, 148, 77, 0.2);
  border-bottom: 1px solid rgba(191, 148, 77, 0.2);
}

.hero-marks div {
  flex: 1;
  min-width: 0;
  padding: 0 18px;
  border-right: 1px solid rgba(191, 148, 77, 0.16);
}

.hero-marks div:first-child {
  padding-left: 0;
}

.hero-marks div:last-child {
  border-right: 0;
}

.hero-marks dt {
  color: #d5b473;
  font-size: 25px;
}

.hero-marks dd {
  margin: 4px 0 0;
  color: #7f776b;
  font-size: 10px;
  letter-spacing: 0.18em;
}

.scroll-sigil {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-top: 34px;
  padding: 0;
  border: 0;
  background: none;
  color: #a89a83;
  cursor: pointer;
  font-size: 11px;
  letter-spacing: 0.2em;
}

.scroll-sigil i {
  position: relative;
  display: block;
  width: 42px;
  height: 1px;
  overflow: visible;
  background: rgba(201, 162, 91, 0.44);
}

.scroll-sigil i::after {
  content: "";
  position: absolute;
  top: -2px;
  right: 0;
  width: 5px;
  height: 5px;
  border-right: 1px solid #caa15a;
  border-bottom: 1px solid #caa15a;
  transform: rotate(45deg);
}

.scroll-sigil:hover {
  color: #dcc599;
}

.wheel-stage {
  width: 100%;
  min-height: 680px;
}

.wheel-webgl {
  width: min(100%, 680px);
}

.wheel-caption {
  bottom: 18px;
}

.inscription-section,
.knowledge-section,
.portal-section {
  position: relative;
  color: #e7dcc7;
  background: #080a09;
}

.inscription-section {
  padding: 118px 0 128px;
  border-top: 1px solid rgba(183, 139, 70, 0.22);
  border-bottom: 1px solid rgba(183, 139, 70, 0.18);
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.72), transparent 14%, transparent 86%, rgba(0, 0, 0, 0.72)),
    radial-gradient(circle at 86% 35%, rgba(91, 113, 89, 0.13), transparent 24rem),
    #0b0e0c;
}

.inscription-shell,
.knowledge-shell {
  position: relative;
  width: min(1500px, calc(100% - 72px));
  margin: 0 auto;
}

.inscription-heading {
  display: grid;
  max-width: 860px;
  grid-template-columns: minmax(290px, 1fr) minmax(270px, 0.8fr);
  gap: 12px 76px;
}

.inscription-heading > span {
  grid-column: 1 / -1;
  margin-bottom: 10px;
}

.inscription-heading h2,
.knowledge-heading h2,
.portal-copy h2 {
  margin: 0;
  color: #e6dbc6;
  font-size: clamp(2.1rem, 4vw, 4.4rem);
  font-weight: 500;
  line-height: 1.18;
  letter-spacing: -0.05em;
}

.inscription-heading p {
  align-self: end;
  margin: 0 0 5px;
  color: #8f877a;
  font-size: 13px;
  line-height: 2;
}

.evolution-rail {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-top: 80px;
  border-top: 1px solid rgba(196, 154, 81, 0.28);
}

.evolution-rail::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 22%;
  height: 1px;
  background: linear-gradient(90deg, transparent, #d1a758, transparent);
  animation: inscription-light 7s ease-in-out infinite;
}

@keyframes inscription-light {
  0% { opacity: 0; transform: translateX(-20%); }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateX(380%); }
}

.evolution-rail article {
  position: relative;
  min-height: 230px;
  padding: 38px 28px 25px;
  border-right: 1px solid rgba(196, 154, 81, 0.14);
}

.evolution-rail article:first-child {
  border-left: 1px solid rgba(196, 154, 81, 0.14);
}

.evolution-rail article::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 50%;
  width: 9px;
  height: 9px;
  border: 1px solid #a67c3c;
  border-radius: 50%;
  background: #0a0d0b;
  transform: translateX(-50%);
}

.evolution-rail article > span {
  display: flex;
  min-height: 70px;
  align-items: center;
  color: #d2ad68;
  font-size: clamp(1.4rem, 2vw, 2.5rem);
  letter-spacing: 0.08em;
}

.evolution-rail article b,
.evolution-rail article small {
  display: block;
}

.evolution-rail article b {
  margin-top: 28px;
  color: #ddd0b8;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.12em;
}

.evolution-rail article small {
  margin-top: 9px;
  color: #766e62;
  font-size: 10px;
  letter-spacing: 0.16em;
}

.inscription-rubbing {
  position: absolute;
  top: -34px;
  right: 1%;
  display: grid;
  width: 210px;
  height: 210px;
  place-items: center;
  border: 1px solid rgba(166, 126, 60, 0.18);
  border-radius: 50%;
  opacity: 0.56;
}

.inscription-rubbing::before,
.inscription-rubbing::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(166, 126, 60, 0.26);
  border-radius: 50%;
  inset: 14px;
}

.inscription-rubbing::after {
  inset: 35px;
}

.inscription-rubbing i {
  position: absolute;
  width: 46%;
  height: 2px;
  background: rgba(188, 146, 75, 0.35);
  transform: rotate(calc(var(--i, 0) * 30deg));
}

.inscription-rubbing i:nth-child(1) { --i: 0; }
.inscription-rubbing i:nth-child(2) { --i: 1; }
.inscription-rubbing i:nth-child(3) { --i: 2; }
.inscription-rubbing i:nth-child(4) { --i: 3; }
.inscription-rubbing i:nth-child(5) { --i: 4; }
.inscription-rubbing i:nth-child(6) { --i: 5; }

.inscription-rubbing span {
  position: relative;
  z-index: 2;
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  border: 1px solid #9c7338;
  border-radius: 50%;
  color: #b58a48;
  font-size: 40px;
}

.knowledge-section {
  padding: 128px 0 142px;
  background:
    radial-gradient(circle at 14% 62%, rgba(88, 64, 34, 0.16), transparent 25rem),
    linear-gradient(180deg, #080a09, #0c0b08);
}

.knowledge-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 40px;
}

.knowledge-heading > span {
  order: 2;
  margin: 0 0 10px;
}

.knowledge-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-top: 62px;
}

.knowledge-gate {
  position: relative;
  min-height: 340px;
  padding: 42px 34px 34px;
  overflow: hidden;
  border: 1px solid rgba(181, 139, 72, 0.2);
  border-radius: 3px;
  background:
    linear-gradient(145deg, rgba(64, 51, 34, 0.24), transparent 38%),
    linear-gradient(180deg, #141512, #090a08);
  color: #d9ccb6;
  cursor: pointer;
  text-align: left;
  transition: border-color 260ms ease, transform 320ms ease, background-color 260ms ease;
}

.knowledge-gate::before {
  content: "";
  position: absolute;
  inset: 15px;
  border: 1px solid rgba(185, 142, 72, 0.11);
  pointer-events: none;
}

.knowledge-gate::after {
  content: "";
  position: absolute;
  right: -40%;
  bottom: -55%;
  width: 120%;
  aspect-ratio: 1;
  border: 1px solid rgba(181, 139, 72, 0.11);
  border-radius: 50%;
  box-shadow: 0 0 0 22px rgba(181, 139, 72, 0.035), 0 0 0 45px rgba(181, 139, 72, 0.025);
  transition: transform 500ms ease;
}

.knowledge-gate:hover {
  border-color: rgba(210, 169, 93, 0.56);
  transform: translateY(-8px);
}

.knowledge-gate:hover::after {
  transform: translate(-7%, -7%) rotate(15deg);
}

.gate-symbol {
  display: block;
  min-height: 95px;
  color: #b78a45;
  font-size: 54px;
}

.knowledge-gate small,
.knowledge-gate strong,
.knowledge-gate i {
  position: relative;
  z-index: 2;
  display: block;
}

.knowledge-gate small {
  color: #6f685e;
  font-size: 9px;
  letter-spacing: 0.22em;
}

.knowledge-gate strong {
  margin-top: 15px;
  font-size: 24px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.knowledge-gate i {
  margin-top: 45px;
  color: #928674;
  font-size: 11px;
  font-style: normal;
  letter-spacing: 0.15em;
}

.lot-section {
  min-height: 1030px;
  background:
    radial-gradient(ellipse at 50% 68%, rgba(115, 74, 31, 0.19), transparent 31rem),
    linear-gradient(180deg, #070908, #0c0906);
}

.lot-section .lot-stage {
  width: min(1180px, 100%);
}

.lot-section::after {
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.7), transparent 11%, transparent 89%, rgba(0, 0, 0, 0.7)),
    repeating-linear-gradient(90deg, transparent 0 10%, rgba(121, 90, 54, 0.035) 10.1% 10.35%);
}

.portal-section {
  display: grid;
  min-height: 760px;
  align-items: center;
  grid-template-columns: minmax(130px, 0.35fr) minmax(380px, 0.85fr) minmax(420px, 1fr);
  gap: clamp(30px, 5vw, 88px);
  padding: 110px max(5vw, calc((100vw - 1500px) / 2));
  overflow: hidden;
  border-top: 1px solid rgba(182, 140, 69, 0.18);
  background:
    radial-gradient(circle at 80% 50%, rgba(92, 67, 37, 0.2), transparent 30rem),
    linear-gradient(90deg, #080a09, #0d0c09 60%, #050605);
}

.portal-ornament {
  display: grid;
  min-height: 360px;
  align-content: center;
  justify-items: center;
  gap: 17px;
  color: #9f783c;
}

.portal-ornament i {
  width: 1px;
  height: 75px;
  background: linear-gradient(transparent, #9a7137, transparent);
}

.portal-ornament b {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 26px;
  font-weight: 500;
}

.portal-copy {
  position: relative;
  z-index: 3;
  max-width: 620px;
}

.portal-copy p {
  max-width: 39em;
  margin: 27px 0 0;
  color: #8b8274;
  font-size: 13px;
  line-height: 2;
}

.portal-actions {
  display: flex;
  gap: 12px;
  margin-top: 38px;
}

.portal-actions button {
  min-height: 43px;
  padding: 0 22px;
  border: 1px solid rgba(198, 154, 79, 0.38);
  border-radius: 999px;
  background: transparent;
  color: #cdbc9c;
  cursor: pointer;
  font-size: 11px;
  letter-spacing: 0.12em;
}

.portal-actions button:first-child {
  background: #a87938;
  color: #080907;
}

.portal-door {
  position: relative;
  width: min(100%, 520px);
  height: 520px;
  justify-self: end;
  border: 1px solid rgba(169, 128, 61, 0.34);
  border-radius: 50% 50% 8px 8px / 38% 38% 8px 8px;
  background:
    linear-gradient(90deg, transparent 49.7%, rgba(177, 133, 64, 0.32) 49.8% 50.2%, transparent 50.3%),
    radial-gradient(circle at 50% 46%, rgba(157, 113, 46, 0.19), transparent 28%),
    repeating-linear-gradient(90deg, #11110d 0 18px, #0a0b09 19px 22px);
  box-shadow:
    inset 0 0 0 16px #060806,
    inset 0 0 0 17px rgba(178, 135, 67, 0.26),
    inset 0 -90px 100px rgba(0, 0, 0, 0.62),
    0 40px 70px rgba(0, 0, 0, 0.5);
}

.portal-door::before,
.portal-door::after {
  content: "";
  position: absolute;
  top: 53%;
  width: 56px;
  height: 82px;
  border: 1px solid rgba(190, 146, 74, 0.43);
  background: #0a0b09;
}

.portal-door::before { right: calc(50% + 12px); }
.portal-door::after { left: calc(50% + 12px); }

.portal-door span {
  position: absolute;
  top: 25%;
  left: 50%;
  display: grid;
  width: 86px;
  height: 86px;
  place-items: center;
  border: 1px solid rgba(193, 150, 77, 0.48);
  border-radius: 50%;
  color: #bd914a;
  font-size: 44px;
  transform: translateX(-50%);
}

.reveal-on-scroll {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 760ms cubic-bezier(0.2, 0.72, 0.2, 1),
    transform 900ms cubic-bezier(0.2, 0.72, 0.2, 1);
}

.reveal-on-scroll.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

.evolution-rail article:nth-child(2),
.knowledge-gate:nth-child(2) { transition-delay: 80ms; }
.evolution-rail article:nth-child(3),
.knowledge-gate:nth-child(3) { transition-delay: 160ms; }
.evolution-rail article:nth-child(4),
.knowledge-gate:nth-child(4) { transition-delay: 240ms; }
.evolution-rail article:nth-child(5) { transition-delay: 320ms; }

@media (max-width: 1180px) {
  .ritual-hero {
    width: min(100% - 48px, 980px);
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .hero-copy {
    max-width: 720px;
    padding: 54px 0 0;
    text-align: center;
    justify-self: center;
  }

  .hero-copy > p,
  .hero-marks {
    margin-right: auto;
    margin-left: auto;
  }

  .scroll-sigil {
    justify-content: center;
  }

  .wheel-stage {
    min-height: 670px;
  }

  .inscription-rubbing {
    top: -58px;
    right: 0;
    width: 160px;
    height: 160px;
  }

  .knowledge-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portal-section {
    grid-template-columns: 100px 1fr 0.9fr;
  }
}

@media (max-width: 760px) {
  .ritual-hero,
  .inscription-shell,
  .knowledge-shell {
    width: calc(100% - 28px);
  }

  .wheel-section {
    padding-top: 20px;
  }

  .hero-copy {
    padding-top: 32px;
  }

  .hero-copy h1 {
    font-size: clamp(2.85rem, 13vw, 4.5rem);
  }

  .hero-copy > p {
    font-size: 12px;
  }

  .hero-marks div {
    padding: 0 10px;
  }

  .wheel-stage {
    min-height: min(600px, 105vw);
  }

  .wheel-webgl {
    width: min(96vw, 560px);
  }

  .inscription-section,
  .knowledge-section {
    padding: 84px 0 92px;
  }

  .inscription-heading {
    display: block;
  }

  .inscription-heading h2,
  .knowledge-heading h2,
  .portal-copy h2 {
    font-size: 2.5rem;
  }

  .inscription-heading p {
    margin-top: 24px;
  }

  .inscription-rubbing {
    display: none;
  }

  .evolution-rail {
    grid-template-columns: 1fr;
    margin-top: 55px;
    border-top: 0;
    border-left: 1px solid rgba(196, 154, 81, 0.28);
  }

  .evolution-rail::before {
    top: 0;
    width: 1px;
    height: 22%;
    animation: inscription-light-mobile 7s ease-in-out infinite;
  }

  @keyframes inscription-light-mobile {
    0% { opacity: 0; transform: translateY(-20%); }
    20%, 80% { opacity: 1; }
    100% { opacity: 0; transform: translateY(380%); }
  }

  .evolution-rail article,
  .evolution-rail article:first-child {
    display: grid;
    min-height: 118px;
    grid-template-columns: 100px 1fr;
    align-items: center;
    padding: 20px 24px;
    border: 0;
    border-bottom: 1px solid rgba(196, 154, 81, 0.13);
  }

  .evolution-rail article::before {
    top: 50%;
    left: -5px;
  }

  .evolution-rail article > span {
    grid-row: 1 / 3;
    min-height: 0;
  }

  .evolution-rail article b {
    align-self: end;
    margin-top: 0;
  }

  .evolution-rail article small {
    align-self: start;
  }

  .knowledge-heading {
    display: block;
  }

  .knowledge-heading > span {
    margin-bottom: 18px;
  }

  .knowledge-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 42px;
  }

  .knowledge-gate {
    min-height: 220px;
    padding: 30px 28px;
  }

  .gate-symbol {
    min-height: 62px;
    font-size: 40px;
  }

  .knowledge-gate i {
    margin-top: 25px;
  }

  .portal-section {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 56px;
    padding: 88px 20px 100px;
  }

  .portal-ornament {
    display: none;
  }

  .portal-copy {
    text-align: center;
  }

  .portal-copy p {
    margin-right: auto;
    margin-left: auto;
  }

  .portal-actions {
    justify-content: center;
  }

  .portal-door {
    width: min(92vw, 430px);
    height: min(92vw, 430px);
    justify-self: center;
  }
}

@media (max-width: 480px) {
  .hero-marks {
    width: 100%;
  }

  .hero-marks dt {
    font-size: 20px;
  }

  .scroll-sigil {
    margin-top: 26px;
  }

  .portal-actions {
    flex-direction: column;
  }

  .portal-actions button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal-on-scroll {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .evolution-rail::before {
    animation: none;
  }
}

/* Wide ritual table — hollow 3D lot box */
.lot-section {
  min-height: 930px;
  padding: 92px 0 110px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 70% 54%, rgba(132, 83, 33, 0.18), transparent 35rem),
    radial-gradient(ellipse at 16% 42%, rgba(55, 77, 61, 0.1), transparent 30rem),
    linear-gradient(180deg, #070908, #0b0907 62%, #070706);
}

.lot-ritual-shell {
  display: grid;
  width: min(1580px, calc(100% - 64px));
  min-height: 760px;
  margin: 0 auto;
  grid-template-columns: minmax(270px, 350px) minmax(680px, 1fr);
  align-items: center;
  gap: clamp(28px, 4vw, 76px);
}

.lot-copy {
  align-self: center;
  text-align: left;
}

.lot-copy .section-number {
  margin-right: 0;
  margin-left: 0;
}

.lot-copy h1 {
  margin-top: 22px;
  font-size: clamp(2rem, 3vw, 3.2rem);
}

.lot-copy .lot-lead {
  max-width: 25em;
  margin: 24px 0 0;
  color: rgba(211, 196, 168, 0.66);
  font-size: 13px;
  line-height: 2;
}

.lot-flow {
  position: relative;
  display: grid;
  margin: 46px 0 0;
  padding: 0;
  gap: 0;
  list-style: none;
}

.lot-flow::before {
  content: "";
  position: absolute;
  top: 21px;
  bottom: 21px;
  left: 19px;
  width: 1px;
  background: linear-gradient(transparent, rgba(178, 133, 66, 0.48), transparent);
}

.lot-flow li {
  position: relative;
  display: grid;
  min-height: 70px;
  grid-template-columns: 40px 1fr;
  align-items: center;
  gap: 18px;
  color: rgba(203, 187, 157, 0.34);
  transition: color 280ms ease;
}

.lot-flow b {
  z-index: 1;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid rgba(166, 119, 55, 0.22);
  border-radius: 50%;
  background: #0a0907;
  font-size: 12px;
  font-weight: 400;
  transition: border-color 280ms ease, box-shadow 280ms ease, color 280ms ease;
}

.lot-flow span {
  font-size: 12px;
  letter-spacing: 0.28em;
}

.lot-flow li.is-active {
  color: #d9bb7d;
}

.lot-flow li.is-active b {
  border-color: rgba(207, 161, 82, 0.72);
  color: #e0bd77;
  box-shadow: inset 0 0 16px rgba(183, 126, 48, 0.16), 0 0 22px rgba(171, 111, 36, 0.1);
}

.lot-copy .lot-instruction {
  min-height: 24px;
  margin: 30px 0 0;
  color: rgba(224, 194, 134, 0.72);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.lot-stage,
.lot-section .lot-stage {
  width: 100%;
  min-height: 760px;
  margin: 0;
  padding: 0 0 74px;
  place-items: center;
}

.lot-box.lot-webgl {
  width: 100%;
  max-width: none;
  height: 760px;
  max-height: none;
  margin: 0;
  border-radius: 0;
  filter: drop-shadow(26px 38px 32px rgba(0, 0, 0, 0.48));
  transform: none !important;
  contain: layout paint;
}

.lot-box.lot-webgl canvas {
  width: 100%;
  height: 100%;
  touch-action: pan-y;
}

.lot-box.lot-webgl .lot-action {
  right: 24%;
  bottom: 10px;
  left: auto;
  transform: translateX(50%);
}

.lot-box.lot-webgl .lot-drag-cue {
  right: 24%;
  bottom: 56px;
}

.lot-result-actions {
  right: auto;
  bottom: 8px;
  left: 46%;
  transform: translateX(-50%);
}

@media (max-width: 1050px) {
  .lot-section {
    min-height: 1120px;
    padding: 80px 0 92px;
  }

  .lot-ritual-shell {
    width: min(920px, calc(100% - 40px));
    min-height: 0;
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .lot-copy {
    width: min(660px, 100%);
    margin: 0 auto;
    text-align: center;
  }

  .lot-copy .section-number {
    margin-right: auto;
    margin-left: auto;
  }

  .lot-copy .lot-lead {
    margin-right: auto;
    margin-left: auto;
  }

  .lot-flow {
    display: flex;
    width: min(460px, 100%);
    justify-content: space-between;
    margin: 32px auto 0;
  }

  .lot-flow::before {
    top: 19px;
    right: 20px;
    bottom: auto;
    left: 20px;
    width: auto;
    height: 1px;
  }

  .lot-flow li {
    display: grid;
    min-height: 0;
    justify-items: center;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .lot-copy .lot-instruction {
    margin-right: auto;
    margin-left: auto;
  }

  .lot-stage,
  .lot-section .lot-stage {
    min-height: 700px;
  }

  .lot-box.lot-webgl {
    height: 700px;
  }
}

@media (max-width: 680px) {
  .lot-section {
    min-height: 930px;
    padding: 68px 0 74px;
  }

  .lot-ritual-shell {
    width: min(100% - 20px, 620px);
    gap: 18px;
  }

  .lot-copy h1 {
    margin-top: 16px;
  }

  .lot-copy .lot-lead {
    max-width: 28em;
    font-size: 11px;
  }

  .lot-flow {
    width: min(360px, 92%);
    margin-top: 24px;
  }

  .lot-flow li {
    gap: 7px;
  }

  .lot-flow b {
    width: 36px;
    height: 36px;
  }

  .lot-flow::before {
    top: 17px;
  }

  .lot-flow span {
    font-size: 10px;
  }

  .lot-copy .lot-instruction {
    margin-top: 20px;
  }

  .lot-stage,
  .lot-section .lot-stage {
    min-height: 600px;
    padding-bottom: 68px;
  }

  .lot-box.lot-webgl {
    width: 100%;
    height: 600px;
    filter: drop-shadow(16px 24px 22px rgba(0, 0, 0, 0.42));
  }

  .lot-box.lot-webgl .lot-action {
    right: 50%;
  }

  .lot-result-actions {
    left: 50%;
    width: 100%;
  }
}

/* One-touch lacquered divination tube */
.inscription-section,
.knowledge-section,
.lot-section,
.portal-section {
  content-visibility: auto;
  contain-intrinsic-size: auto 900px;
}

.lot-eyebrow {
  display: block;
  margin-top: 30px;
  color: rgba(195, 151, 80, 0.72);
  font-size: 10px;
  letter-spacing: 0.46em;
}

.lot-copy .lot-eyebrow + h1 {
  margin-top: 13px;
}

.lot-stage::before {
  content: "";
  position: absolute;
  z-index: 0;
  right: 3%;
  bottom: 83px;
  left: 3%;
  height: 30%;
  pointer-events: none;
  opacity: 0.68;
  background:
    radial-gradient(ellipse at 64% 94%, rgba(172, 117, 54, 0.2), transparent 35%),
    linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.23));
  clip-path: polygon(8% 0, 92% 0, 100% 100%, 0 100%);
}

.lot-stage::after {
  content: none;
}

.lot-box.lot-webgl {
  z-index: 1;
}

.lot-box.lot-webgl .lot-action {
  min-width: 112px;
  padding: 10px 18px;
  border-color: rgba(203, 156, 82, 0.46);
  background: rgba(7, 7, 6, 0.8);
  color: #dfc58f;
  font-size: 11px;
  box-shadow: inset 0 0 22px rgba(153, 102, 43, 0.12), 0 9px 28px rgba(0, 0, 0, 0.32);
  pointer-events: none;
}

.lot-stage.is-shaking .lot-action,
.lot-stage.is-ready .lot-action,
.lot-stage.is-opening .lot-action {
  color: #c79c54;
  border-color: rgba(203, 156, 82, 0.25);
}

.lot-stage.has-result .lot-action {
  opacity: 0;
}

.lot-stage.is-shaking .lot-box,
.lot-stage.is-ready .lot-box,
.lot-stage.is-opening .lot-box,
.lot-stage.has-result .lot-box {
  cursor: default;
}

.lot-result-actions {
  left: 39%;
}

.lot-reading-panel {
  position: absolute;
  z-index: 10;
  top: 50%;
  left: 0;
  width: min(330px, 31%);
  min-height: 260px;
  padding: 28px 30px 30px;
  overflow: hidden;
  border: 1px solid rgba(190, 145, 76, 0.32);
  border-radius: 2px;
  background:
    linear-gradient(135deg, rgba(188, 139, 65, 0.08), transparent 34%),
    radial-gradient(circle at 86% 16%, rgba(168, 111, 42, 0.11), transparent 38%),
    rgba(7, 8, 7, 0.9);
  color: #ead9b5;
  box-shadow:
    inset 0 0 0 4px rgba(182, 132, 65, 0.035),
    inset 0 0 48px rgba(170, 105, 35, 0.06),
    0 26px 64px rgba(0, 0, 0, 0.42);
  text-align: left;
  pointer-events: none;
  animation: lot-reading-in 620ms cubic-bezier(.2, .82, .22, 1) both;
}

.lot-reading-panel::before,
.lot-reading-panel::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.lot-reading-panel::before {
  inset: 9px;
  border: 1px solid rgba(207, 164, 93, 0.12);
}

.lot-reading-panel::after {
  top: 0;
  right: 26px;
  width: 1px;
  height: 46px;
  background: linear-gradient(#c2934d, transparent);
  box-shadow: 7px 0 0 rgba(194, 147, 77, 0.28);
}

.lot-reading-kicker {
  display: block;
  color: rgba(208, 165, 91, 0.72);
  font-size: 10px;
  letter-spacing: 0.48em;
}

.lot-reading-panel h2 {
  display: flex;
  margin: 18px 0 20px;
  align-items: baseline;
  gap: 14px;
  color: #e8c987;
  font-weight: 400;
}

.lot-reading-panel h2 b {
  font-size: clamp(2rem, 3vw, 3rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.12em;
  text-shadow: 0 2px 15px rgba(191, 133, 54, 0.18);
}

.lot-reading-panel h2 small {
  color: rgba(202, 184, 153, 0.48);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.28em;
}

.lot-reading-panel p {
  position: relative;
  z-index: 1;
  margin: 0;
  color: rgba(245, 232, 205, 0.92);
  font-size: 17px;
  line-height: 2;
  letter-spacing: 0.08em;
  overflow-wrap: anywhere;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.72);
}

.lot-reading-panel > i {
  position: absolute;
  right: 22px;
  bottom: 19px;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(190, 142, 72, 0.3);
  border-radius: 50%;
}

.lot-reading-panel > i::before,
.lot-reading-panel > i::after {
  content: "";
  position: absolute;
  inset: 6px 4px auto;
  height: 2px;
  background: rgba(203, 159, 85, 0.38);
  box-shadow: 0 5px 0 rgba(203, 159, 85, 0.38), 0 10px 0 rgba(203, 159, 85, 0.38);
}

.lot-reading-panel > i::after {
  inset: 11px 4px auto;
  background:
    linear-gradient(90deg, rgba(203, 159, 85, 0.38) 0 38%, transparent 38% 62%, rgba(203, 159, 85, 0.38) 62%);
  box-shadow: none;
}

@keyframes lot-reading-in {
  from {
    opacity: 0;
    transform: translate3d(-24px, -46%, 0);
    filter: blur(5px);
  }
  to {
    opacity: 1;
    transform: translate3d(0, -46%, 0);
    filter: blur(0);
  }
}

@media (max-width: 1050px) {
  .lot-eyebrow {
    margin-top: 22px;
  }

  .lot-stage::after {
    left: 50%;
  }

  .lot-result-actions {
    left: 45%;
  }

  .lot-reading-panel {
    left: 2%;
    width: min(300px, 34%);
  }
}

@media (max-width: 680px) {
  .inscription-section,
  .knowledge-section,
  .lot-section,
  .portal-section {
    contain-intrinsic-size: auto 760px;
  }

  .lot-eyebrow {
    margin-top: 18px;
    font-size: 9px;
  }

  .lot-stage::before {
    right: 0;
    bottom: 312px;
    left: 0;
    height: 22%;
  }

  .lot-stage::after {
    bottom: 104px;
    font-size: 34px;
  }

  .lot-box.lot-webgl .lot-action {
    bottom: 12px;
  }

  .lot-result-actions {
    bottom: 8px;
    left: 50%;
    width: calc(100% - 28px);
  }

  .lot-stage,
  .lot-section .lot-stage {
    min-height: 890px;
    padding-bottom: 0;
    align-items: start;
  }

  .lot-box.lot-webgl {
    height: 620px;
    align-self: start;
  }

  .lot-reading-panel {
    top: auto;
    bottom: 64px;
    left: 50%;
    width: calc(100% - 28px);
    min-height: 204px;
    padding: 22px 24px 24px;
    animation-name: lot-reading-in-mobile;
  }

  .lot-reading-panel h2 {
    margin: 13px 0 14px;
  }

  .lot-reading-panel h2 b {
    font-size: 30px;
  }

  .lot-reading-panel p {
    font-size: 15px;
    line-height: 1.85;
  }

  @keyframes lot-reading-in-mobile {
    from {
      opacity: 0;
      transform: translate3d(-50%, 20px, 0);
      filter: blur(4px);
    }
    to {
      opacity: 1;
      transform: translate3d(-50%, 0, 0);
      filter: blur(0);
    }
  }
}

@media (max-width: 760px), (pointer: coarse) {
  .wheel-webgl,
  .wheel-webgl canvas,
  .lot-box,
  .lot-box canvas,
  .lot-box.lot-webgl,
  .lot-box.lot-webgl canvas {
    touch-action: pan-y !important;
  }

  .wheel-webgl {
    cursor: default;
  }

  .wheel-webgl .model-drag-cue {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lot-flow li,
  .lot-flow b,
  .lot-box.lot-webgl .lot-action {
    transition: none;
  }
}

/* Scroll cosmology — 太极生两仪，两仪生四象 ----------------------------- */
.cosmology-section {
  --cosmic-gold: #c69a52;
  --cosmic-ivory: #e8deca;
  --cosmic-ink: #080b09;
  position: relative;
  height: 560vh;
  color: var(--cosmic-ivory);
  background: #080a09;
}

.cosmic-sticky {
  position: sticky;
  z-index: 1;
  top: 56px;
  height: calc(100svh - 56px);
  min-height: 660px;
  overflow: hidden;
  border-top: 1px solid rgba(190, 145, 73, 0.18);
  border-bottom: 1px solid rgba(190, 145, 73, 0.18);
  background:
    radial-gradient(circle at 72% 47%, rgba(110, 90, 55, 0.13), transparent 31rem),
    radial-gradient(circle at 22% 70%, rgba(54, 78, 62, 0.1), transparent 28rem),
    linear-gradient(115deg, #070908, #0c0f0d 62%, #080908);
}

.cosmic-atmosphere {
  position: absolute;
  inset: 0;
  opacity: 0.32;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(205, 168, 100, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(205, 168, 100, 0.03) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(circle at 65% 48%, #000 0, transparent 68%);
}

.cosmic-copy {
  position: absolute;
  z-index: 5;
  top: clamp(74px, 13vh, 126px);
  left: clamp(34px, 5.6vw, 108px);
  width: min(450px, 29vw);
}

.cosmic-kicker {
  display: block;
  margin-bottom: 30px;
  color: #a98248;
  font-size: clamp(14px, 0.95vw, 16px);
  font-weight: 700;
  letter-spacing: 0.2em;
  line-height: 1.8;
  white-space: nowrap;
}

.cosmic-step {
  margin: 0;
  color: var(--cosmic-ivory);
  font-size: clamp(2.2rem, 2.7vw, 3.25rem);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.045em;
  white-space: nowrap;
  text-shadow: 0 15px 42px rgba(0, 0, 0, 0.55);
}

.cosmic-copy h2 {
  margin: 0;
  color: var(--cosmic-ivory);
  font-size: clamp(2.35rem, 4vw, 4.5rem);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.07em;
  text-shadow: 0 15px 42px rgba(0, 0, 0, 0.55);
}

.cosmic-copy h2 + p {
  max-width: 280px;
  margin: 24px 0 0;
  color: #8d877c;
  font-size: 12px;
  line-height: 2;
  transition: opacity 220ms ease, transform 220ms ease;
}

.cosmic-progress {
  position: absolute;
  z-index: 5;
  top: 50%;
  bottom: auto;
  left: 24px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin: 0;
  padding: 0;
  list-style: none;
  transform: translateY(-50%);
}

.cosmic-progress li {
  display: grid;
  width: 78px;
  grid-template-columns: 32px 1fr;
  gap: 9px;
  align-items: center;
  justify-items: start;
  color: rgba(216, 203, 181, 0.26);
  font-size: 9px;
  letter-spacing: 0.1em;
  transition: color 280ms ease;
}

.cosmic-progress i {
  width: 18px;
  height: 2px;
  background: currentColor;
  transition: width 280ms ease, background-color 280ms ease, box-shadow 280ms ease;
}

.cosmic-progress li.is-active {
  color: #c69a52;
}

.cosmic-progress li.is-active i {
  width: 32px;
  box-shadow: 0 0 16px rgba(198, 154, 82, 0.48);
}

.cosmic-stage {
  position: absolute;
  z-index: 2;
  top: 7%;
  right: 2.5%;
  bottom: 7%;
  left: max(340px, 28vw);
}

.cosmic-layer,
.cosmic-trigram-field,
.cosmic-grid-frame,
.binary-weights {
  position: absolute;
  inset: 0;
}

.cosmic-layer {
  display: grid;
  place-items: center;
  opacity: 0;
  transform: translateY(22px) scale(0.97);
  pointer-events: none;
  will-change: opacity, transform;
}

.taiji-layer {
  opacity: 1;
  transform: none;
}

.cosmic-mobile-label {
  display: none;
}

.taiji-symbol {
  width: clamp(230px, 27vw, 410px);
  overflow: visible;
  filter: drop-shadow(0 22px 44px rgba(0, 0, 0, 0.55));
}

.taiji-rim {
  fill: rgba(10, 13, 11, 0.82);
  stroke: rgba(198, 154, 82, 0.72);
  stroke-width: 1.5;
}

.taiji-core {
  transform-origin: 110px 110px;
  animation: cosmic-taiji-turn 12s linear infinite;
}

.taiji-petal,
.taiji-eye-piece {
  transform-box: view-box;
  transform-origin: 110px 110px;
  will-change: transform, opacity;
}

.taiji-eye {
  transform-box: fill-box;
  transform-origin: center;
  stroke: rgba(198, 154, 82, 0.34);
  stroke-width: 1.2;
  paint-order: stroke fill;
  animation: cosmic-eye-breathe 3.4s ease-in-out infinite alternate;
}

.taiji-orbit {
  position: absolute;
  width: clamp(300px, 35vw, 520px);
  aspect-ratio: 1;
  border: 1px solid rgba(198, 154, 82, 0.12);
  border-radius: 50%;
  animation: cosmic-orbit-turn 18s linear infinite reverse;
}

.taiji-orbit::before,
.taiji-orbit::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(198, 154, 82, 0.08);
  border-radius: 50%;
  inset: 9%;
}

.taiji-orbit::after {
  inset: 20%;
}

.taiji-orbit i {
  position: absolute;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -3px;
  border-radius: 50%;
  background: #d1aa64;
  box-shadow: 0 0 22px rgba(209, 170, 100, 0.8);
  animation: cosmic-attract 2.8s ease-in-out infinite alternate;
}

.taiji-orbit i:first-child { left: -3px; }
.taiji-orbit i:last-child {
  right: -3px;
  animation-direction: alternate-reverse;
}

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

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

@keyframes cosmic-eye-breathe {
  from { transform: scale(0.78); }
  to { transform: scale(1.15); }
}

@keyframes cosmic-attract {
  from { transform: translateX(0) scale(0.75); opacity: 0.45; }
  to { transform: translateX(34px) scale(1.15); opacity: 1; }
}

.liangyi-pair {
  display: flex;
  width: min(620px, 74%);
  gap: clamp(36px, 8vw, 120px);
  justify-content: center;
}

.yao-card {
  display: grid;
  min-width: 180px;
  gap: 22px;
  justify-items: center;
  will-change: transform, opacity;
}

.yao-card b {
  color: #d4c7b0;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.16em;
}

.yao-card small {
  color: #9c7741;
  font-size: 24px;
}

.yao {
  position: relative;
  display: block;
  width: 104px;
  height: 14px;
}

.yao::before,
.yao::after {
  content: "";
  position: absolute;
  top: 50%;
  height: 8px;
  border-radius: 1px;
  background: linear-gradient(180deg, #eadfc9, #a88955);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.42);
  transform: translateY(-50%);
}

.yao.yang::before {
  right: 0;
  left: 0;
}

.yao.yang::after {
  display: none;
}

.yao.yin::before {
  left: 0;
  width: 43%;
}

.yao.yin::after {
  right: 0;
  width: 43%;
}

.sixiang-set {
  position: relative;
  display: grid;
  width: min(820px, 90%);
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(24px, 4vw, 70px);
}

.sixiang-set article {
  position: relative;
  display: grid;
  min-height: 200px;
  place-items: center;
  align-content: center;
  gap: 20px;
  will-change: transform, opacity;
}

.sixiang-set article > div {
  display: grid;
  gap: 20px;
  padding: 0;
}

.sixiang-set article .yao:first-child,
.cosmic-trigram .trigram-lines .yao:first-child {
  transform-origin: center;
  will-change: transform, opacity;
}

.sixiang-set .yao {
  width: clamp(76px, 7vw, 112px);
  height: 9px;
}

.sixiang-set .yao::before,
.sixiang-set .yao::after {
  height: 6px;
}

.sixiang-set strong {
  color: #dccdb5;
  font-size: clamp(18px, 1.8vw, 26px);
  font-weight: 500;
  letter-spacing: 0.16em;
}

.binary-weights {
  z-index: 3;
  top: calc(50% - 28.5px);
  right: auto;
  bottom: auto;
  left: -70px;
  display: block;
  width: 80px;
  height: 61px;
  opacity: 0;
  transform: translate(-20px, -50%);
  pointer-events: none;
}

.binary-weights span {
  position: absolute;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  color: rgba(230, 218, 196, 0.76);
  font-size: clamp(19px, 1.2vw, 22px);
  font-weight: 500;
  letter-spacing: 0.08em;
  white-space: nowrap;
  transform: translateY(-50%);
}

.binary-weights span:nth-child(1) { top: 3.5px; }
.binary-weights span:nth-child(2) { top: 30.5px; }
.binary-weights span:nth-child(3) { top: 57.5px; }

.cosmic-trigram-field {
  z-index: 4;
  opacity: 0;
  pointer-events: none;
  will-change: opacity;
}

.cosmic-trigram {
  position: absolute;
  display: grid;
  width: clamp(72px, 6.6vw, 112px);
  justify-items: center;
  gap: 9px;
  transform: translate(-50%, -50%);
  will-change: left, top, transform;
}

.trigram-lines {
  display: grid;
  gap: 20px;
}

.trigram-lines .yao {
  width: clamp(64px, 5.6vw, 94px);
  height: 7px;
}

.trigram-lines .yao::before,
.trigram-lines .yao::after {
  height: 5px;
}

.cosmic-trigram strong {
  margin-top: 8px;
  color: #e6d9c2;
  font-size: clamp(19px, 1.7vw, 27px);
  font-weight: 500;
  letter-spacing: 0.16em;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 420ms ease, transform 420ms ease;
}

.cosmic-trigram small {
  color: #a77f43;
  font-size: 18px;
  opacity: 0;
  transition: opacity 420ms ease 80ms;
}

.cosmology-section[data-phase="3"] .cosmic-trigram strong,
.cosmology-section[data-phase="3"] .cosmic-trigram small,
.cosmology-section[data-phase="4"] .cosmic-trigram strong,
.cosmology-section[data-phase="4"] .cosmic-trigram small {
  opacity: 1;
  transform: none;
}

.cosmic-grid-frame {
  z-index: 2;
  width: min(680px, 72%);
  height: min(680px, 80%);
  margin: auto;
  border: 1px solid rgba(198, 154, 82, 0.3);
  opacity: 0;
  transform: scale(0.94);
  pointer-events: none;
}

.cosmic-grid-frame i {
  position: absolute;
  display: block;
  background: rgba(198, 154, 82, 0.2);
}

.cosmic-grid-frame i:nth-child(1),
.cosmic-grid-frame i:nth-child(2) {
  top: 0;
  bottom: 0;
  width: 1px;
}

.cosmic-grid-frame i:nth-child(1) { left: 33.333%; }
.cosmic-grid-frame i:nth-child(2) { left: 66.666%; }

.cosmic-grid-frame i:nth-child(3),
.cosmic-grid-frame i:nth-child(4) {
  right: 0;
  left: 0;
  height: 1px;
}

.cosmic-grid-frame i:nth-child(3) { top: 33.333%; }
.cosmic-grid-frame i:nth-child(4) { top: 66.666%; }

.cosmic-grid-frame > span {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.cosmic-grid-frame > span {
  color: rgba(202, 165, 101, 0.75);
  font-size: clamp(17px, 1.8vw, 26px);
  letter-spacing: 0.2em;
  white-space: nowrap;
}

.grid-direction {
  position: absolute;
  color: rgba(222, 208, 184, 0.68);
  font-size: clamp(15px, 1.4vw, 21px);
  font-style: normal;
  line-height: 1;
  letter-spacing: 0.14em;
  transform: translate(-50%, -50%);
}

.grid-south { top: -30px; left: 50%; }
.grid-north { top: calc(100% + 30px); left: 50%; }
.grid-east { top: 50%; left: -28px; }
.grid-west { top: 50%; left: calc(100% + 31px); }

.cosmology-section[data-phase="4"] .grid-direction {
  animation: grid-direction-in 480ms ease both;
}

@keyframes grid-direction-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.cosmic-scroll-cue {
  position: absolute;
  z-index: 6;
  right: 38px;
  bottom: 36px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(217, 202, 176, 0.36);
  font-size: 9px;
  letter-spacing: 0.18em;
  writing-mode: vertical-rl;
}

.cosmic-scroll-cue i {
  display: block;
  width: 1px;
  height: 44px;
  overflow: hidden;
  background: linear-gradient(#bd8e49 50%, rgba(189, 142, 73, 0.15) 50%);
  background-size: 100% 200%;
  animation: cosmic-scroll-line 2s ease-in-out infinite;
}

@keyframes cosmic-scroll-line {
  from { background-position: 0 100%; }
  to { background-position: 0 -100%; }
}

/* 文王后天九宫 ------------------------------------------------------- */
.palace-section {
  position: relative;
  overflow: hidden;
  padding: 124px 0 150px;
  color: #e7dcc7;
  border-bottom: 1px solid rgba(183, 139, 70, 0.18);
  background:
    radial-gradient(circle at 50% 44%, rgba(117, 91, 51, 0.13), transparent 34rem),
    linear-gradient(180deg, #080a09, #0c0c09 58%, #080a09);
}

.palace-shell {
  width: min(1180px, calc(100% - 72px));
  margin: 0 auto;
}

.palace-heading {
  display: grid;
  max-width: 850px;
  grid-template-columns: minmax(280px, 1fr) minmax(270px, 0.8fr);
  gap: 14px 70px;
}

.palace-heading > span {
  grid-column: 1 / -1;
  color: #aa8244;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3em;
}

.palace-heading h2 {
  margin: 0;
  color: #e6dbc6;
  font-size: clamp(2.4rem, 4.6vw, 5rem);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.06em;
}

.palace-heading p {
  align-self: end;
  margin: 0 0 7px;
  color: #8f877a;
  font-size: 12px;
  line-height: 2;
}

.palace-mode-switch {
  display: flex;
  width: max-content;
  margin: 72px auto 34px;
  padding: 4px;
  border: 1px solid rgba(192, 148, 76, 0.25);
  border-radius: 999px;
  background: rgba(7, 10, 8, 0.72);
}

.palace-mode-switch button {
  min-width: 132px;
  padding: 12px 22px;
  border: 0;
  border-radius: 999px;
  color: rgba(230, 218, 198, 0.48);
  background: transparent;
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.16em;
  cursor: pointer;
  transition: color 220ms ease, background 220ms ease, box-shadow 220ms ease;
}

.palace-mode-switch button.is-active {
  color: #19140c;
  background: #c69a52;
  box-shadow: 0 7px 24px rgba(198, 154, 82, 0.22);
}

.palace-mode-switch button:focus-visible {
  outline: 2px solid #e6c17c;
  outline-offset: 3px;
}

.palace-board {
  position: relative;
  display: grid;
  width: min(820px, 82vw);
  aspect-ratio: 1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 0 auto;
  padding: 1px;
  border: 1px solid rgba(198, 154, 82, 0.3);
  background: rgba(198, 154, 82, 0.2);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.32);
}

.palace-board::before,
.palace-board::after {
  content: "";
  position: absolute;
  z-index: 0;
  pointer-events: none;
}

.palace-board::before {
  border: 1px solid rgba(198, 154, 82, 0.12);
  inset: -18px;
}

.palace-board::after {
  border: 1px solid rgba(198, 154, 82, 0.07);
  inset: -34px;
}

.palace-cell,
.palace-center {
  position: relative;
  z-index: 2;
  display: grid;
  min-width: 0;
  place-items: center;
  align-content: center;
  gap: 7px;
  border: 0;
  color: #ded2bd;
  background:
    radial-gradient(circle at 50% 46%, rgba(179, 139, 74, 0.06), transparent 52%),
    rgba(8, 11, 9, 0.96);
  transition: opacity 260ms ease, transform 260ms ease, background 260ms ease, box-shadow 260ms ease;
}

.palace-cell {
  font: inherit;
  cursor: pointer;
}

.palace-cell::after {
  content: "";
  position: absolute;
  border: 1px solid transparent;
  opacity: 0;
  pointer-events: none;
  inset: 10px;
  transition: opacity 240ms ease, border-color 240ms ease;
}

.palace-cell:hover,
.palace-cell:focus-visible {
  z-index: 4;
  transform: translateY(-4px);
  outline: none;
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.32);
}

.palace-cell:hover::after,
.palace-cell:focus-visible::after {
  border-color: rgba(221, 180, 108, 0.38);
  opacity: 1;
}

.palace-symbol {
  color: #b58a49;
  font-size: clamp(24px, 3.1vw, 43px);
  line-height: 1;
}

.palace-cell > b {
  font-size: clamp(22px, 3vw, 42px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.1em;
}

.palace-cell > small {
  color: rgba(223, 211, 190, 0.34);
  font-size: 9px;
  letter-spacing: 0.2em;
}

.palace-cell em {
  margin-top: 7px;
  color: #c9a361;
  font-size: clamp(12px, 1.4vw, 17px);
  font-style: normal;
  letter-spacing: 0.18em;
}

.palace-center {
  background:
    radial-gradient(circle, rgba(159, 116, 57, 0.18), transparent 66%),
    #0b0d0b;
}

.palace-center > span {
  color: rgba(220, 202, 170, 0.44);
  font-size: 9px;
  letter-spacing: 0.24em;
}

.palace-center > b {
  color: #c99c55;
  font-size: clamp(2.3rem, 5vw, 4.8rem);
  font-weight: 500;
}

.element-center-node {
  position: relative;
  display: none;
  width: clamp(24px, 4vw, 48px);
  height: clamp(24px, 4vw, 48px);
  border: 1px solid rgba(201, 156, 85, 0.55);
  border-radius: 50%;
  box-shadow:
    0 0 0 10px rgba(201, 156, 85, 0.035),
    0 0 34px rgba(201, 156, 85, 0.24);
}

.element-center-node::before,
.element-center-node::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.element-center-node::before {
  width: 7px;
  height: 7px;
  background: #d0a35d;
  box-shadow: 0 0 15px rgba(208, 163, 93, 0.8);
}

.element-center-node::after {
  width: 68%;
  height: 68%;
  border: 1px solid rgba(201, 156, 85, 0.2);
}

.palace-center > small {
  color: rgba(220, 208, 187, 0.34);
  font-size: 9px;
  letter-spacing: 0.18em;
}

.element-detail,
.element-legend {
  display: none;
}

.palace-board.is-elements .family-detail,
.palace-board.is-elements + .palace-legend .family-legend {
  display: none;
}

.palace-board.is-elements .element-detail {
  display: block;
}

.palace-board.is-elements .palace-flow {
  opacity: 1;
}

.palace-board.is-elements .palace-cell[data-element="wood"] { --element-tone: #6f9973; }
.palace-board.is-elements .palace-cell[data-element="fire"] { --element-tone: #b85a3d; }
.palace-board.is-elements .palace-cell[data-element="earth"] { --element-tone: #a87a43; }
.palace-board.is-elements .palace-cell[data-element="metal"] { --element-tone: #c9b478; }
.palace-board.is-elements .palace-cell[data-element="water"] { --element-tone: #4f7892; }

.palace-board.is-elements .palace-cell {
  box-shadow: inset 0 0 46px color-mix(in srgb, var(--element-tone) 10%, transparent);
}

.palace-board.is-elements .palace-symbol,
.palace-board.is-elements .palace-cell em {
  color: var(--element-tone);
}

.palace-board.is-elements .palace-cell::after {
  border-color: color-mix(in srgb, var(--element-tone) 54%, transparent);
}

.palace-board.is-elements .palace-center {
  box-shadow: inset 0 0 70px rgba(168, 122, 67, 0.18);
}

.palace-flow {
  position: absolute;
  z-index: 3;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  inset: 0;
  transition: opacity 360ms ease;
}

.palace-flow path {
  fill: none;
  vector-effect: non-scaling-stroke;
}

.flow-base path {
  stroke: rgba(201, 170, 104, 0.13);
  stroke-width: 1.2;
}

.flow-pulses path {
  stroke: #dfb86f;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 0.07 0.93;
  stroke-dashoffset: 1;
  filter: drop-shadow(0 0 5px rgba(223, 184, 111, 0.72));
  animation: palace-flow-pulse 8s linear infinite;
  animation-delay: var(--delay);
}

@keyframes palace-flow-pulse {
  to { stroke-dashoffset: 0; }
}

.palace-board.has-focus .palace-cell:not(.is-focused) {
  opacity: 0.3;
}

.palace-board.has-focus .palace-cell.is-focused {
  z-index: 4;
  transform: translateY(-3px);
  background:
    radial-gradient(circle at 50% 46%, rgba(190, 150, 83, 0.2), transparent 58%),
    #0b0d0b;
}

.palace-board.is-elements.has-focus .palace-cell.is-focused {
  box-shadow: inset 0 0 62px color-mix(in srgb, var(--element-tone) 22%, transparent);
}

.palace-legend {
  min-height: 42px;
  margin-top: 44px;
  text-align: center;
}

.palace-legend p {
  margin: 0;
  color: rgba(218, 205, 183, 0.44);
  font-size: 10px;
  letter-spacing: 0.14em;
  line-height: 2;
}

.palace-legend .element-legend {
  align-items: center;
  justify-content: center;
  gap: 9px;
  flex-wrap: wrap;
}

.palace-board.is-elements + .palace-legend .element-legend {
  display: flex;
}

.element-legend i {
  width: 7px;
  height: 7px;
  margin-left: 9px;
  border-radius: 50%;
  box-shadow: 0 0 10px currentColor;
}

.element-legend i:first-child { margin-left: 0; }
.element-legend .wood { color: #6f9973; background: currentColor; }
.element-legend .fire { color: #b85a3d; background: currentColor; }
.element-legend .earth { color: #a87a43; background: currentColor; }
.element-legend .metal { color: #c9b478; background: currentColor; }
.element-legend .water { color: #4f7892; background: currentColor; }

@media (max-width: 1040px) {
  .cosmic-copy {
    left: 76px;
    width: 240px;
  }

  .cosmic-stage {
    left: 300px;
  }

  .cosmic-progress {
    left: 18px;
  }

  .cosmic-grid-frame {
    width: 74%;
    height: 70%;
  }
}

@media (max-width: 760px) {
  .cosmology-section {
    height: auto;
  }

  .cosmic-sticky {
    position: relative;
    top: 0;
    height: auto;
    min-height: 0;
    padding: 84px 20px 96px;
    overflow: hidden;
  }

  .cosmic-copy {
    position: relative;
    top: auto;
    left: auto;
    width: min(100%, 520px);
    margin: 0 auto 66px;
    text-align: center;
  }

  .cosmic-kicker {
    margin-bottom: 18px;
    font-size: 9px;
  }

  .cosmic-copy h2 + p {
    display: none;
  }

  .cosmic-step {
    font-size: clamp(2.5rem, 13vw, 4rem);
  }

  .cosmic-progress,
  .cosmic-scroll-cue,
  .cosmic-grid-frame {
    display: none;
  }

  .cosmic-stage {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    display: grid;
    width: min(100%, 620px);
    gap: 92px;
    margin: 0 auto;
  }

  .cosmic-layer {
    position: relative;
    display: grid;
    min-height: 280px;
    opacity: 1 !important;
    transform: none !important;
    inset: auto;
  }

  .cosmic-mobile-label {
    position: absolute;
    top: 0;
    left: 50%;
    display: block;
    color: rgba(205, 167, 99, 0.72);
    font-size: 10px;
    letter-spacing: 0.2em;
    white-space: nowrap;
    transform: translateX(-50%);
  }

  .taiji-symbol {
    width: min(60vw, 270px);
    margin-top: 28px;
  }

  .taiji-orbit {
    width: min(76vw, 340px);
    margin-top: 28px;
  }

  .liangyi-pair {
    width: 100%;
    gap: 22px;
  }

  .yao-card {
    min-width: 0;
    width: 44%;
  }

  .sixiang-layer {
    min-height: 470px;
  }

  .sixiang-set {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 44px;
  }

  .sixiang-set article {
    min-height: 190px;
  }

  .binary-weights {
    position: relative;
    display: flex;
    width: auto;
    height: auto;
    justify-content: center;
    gap: 34px;
    opacity: 1 !important;
    transform: none !important;
    inset: auto;
  }

  .binary-weights span {
    position: relative;
    top: auto !important;
    right: auto;
    transform: none;
  }

  .cosmic-trigram-field {
    position: relative;
    display: grid;
    height: auto;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 42px 5px;
    opacity: 1 !important;
    inset: auto;
  }

  .cosmic-trigram {
    position: relative;
    top: auto !important;
    left: auto !important;
    width: auto;
    transform: none !important;
  }

  .trigram-lines {
    gap: 14px;
  }

  .trigram-lines .yao {
    width: clamp(48px, 14vw, 74px);
  }

  .cosmic-trigram strong,
  .cosmic-trigram small {
    opacity: 1;
    transform: none;
  }

  .palace-section {
    padding: 88px 0 104px;
  }

  .palace-shell {
    width: min(100% - 28px, 640px);
  }

  .palace-heading {
    display: block;
    text-align: center;
  }

  .palace-heading > span {
    display: block;
    margin-bottom: 20px;
  }

  .palace-heading h2 {
    font-size: clamp(2.7rem, 13vw, 4.5rem);
  }

  .palace-heading p {
    max-width: 360px;
    margin: 22px auto 0;
  }

  .palace-mode-switch {
    width: min(100%, 340px);
    margin-top: 48px;
  }

  .palace-mode-switch button {
    min-width: 0;
    flex: 1;
    padding: 11px 14px;
  }

  .palace-board {
    width: 100%;
  }

  .palace-board::before { inset: -8px; }
  .palace-board::after { display: none; }

  .palace-cell {
    gap: 3px;
  }

  .palace-cell::after {
    inset: 4px;
  }

  .palace-symbol {
    font-size: clamp(18px, 7vw, 30px);
  }

  .palace-cell > b {
    font-size: clamp(17px, 6vw, 28px);
  }

  .palace-cell > small {
    font-size: 8px;
    letter-spacing: 0.08em;
  }

  .palace-cell em {
    margin-top: 3px;
    font-size: clamp(9px, 3vw, 13px);
    letter-spacing: 0.08em;
  }

  .palace-center > b {
    font-size: clamp(1.8rem, 10vw, 3.6rem);
  }

  .palace-center > span,
  .palace-center > small {
    font-size: 7px;
    letter-spacing: 0.08em;
  }

  .palace-legend {
    margin-top: 30px;
  }

  .palace-legend p {
    font-size: 9px;
    letter-spacing: 0.08em;
  }
}

.cosmology-section.is-static {
  height: auto;
}

.cosmology-section.is-static .cosmic-sticky {
  position: relative;
  top: 0;
  height: auto;
  min-height: 0;
  padding: 96px 6vw 110px;
}

.cosmology-section.is-static .cosmic-copy {
  position: relative;
  top: auto;
  left: auto;
  width: min(100%, 680px);
  margin: 0 auto 70px;
  text-align: center;
}

.cosmology-section.is-static .cosmic-progress,
.cosmology-section.is-static .cosmic-scroll-cue,
.cosmology-section.is-static .cosmic-grid-frame {
  display: none;
}

.cosmology-section.is-static .cosmic-stage {
  position: relative;
  top: auto;
  right: auto;
  bottom: auto;
  left: auto;
  display: grid;
  width: min(100%, 1040px);
  gap: 90px;
  margin: 0 auto;
}

.cosmology-section.is-static .cosmic-layer {
  position: relative;
  min-height: 340px;
  opacity: 1;
  transform: none;
  inset: auto;
}

.cosmology-section.is-static .cosmic-mobile-label {
  position: absolute;
  top: 0;
  left: 50%;
  display: block;
  color: rgba(205, 167, 99, 0.72);
  font-size: 10px;
  letter-spacing: 0.2em;
  transform: translateX(-50%);
}

.cosmology-section.is-static .binary-weights {
  position: relative;
  display: flex;
  width: auto;
  height: auto;
  justify-content: center;
  gap: 42px;
  opacity: 1;
  transform: none;
  inset: auto;
}

.cosmology-section.is-static .binary-weights span {
  position: relative;
  top: auto;
  right: auto;
  transform: none;
}

.cosmology-section.is-static .cosmic-trigram-field {
  position: relative;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 10px;
  opacity: 1;
  inset: auto;
}

.cosmology-section.is-static .cosmic-trigram {
  position: relative;
  top: auto !important;
  left: auto !important;
  width: auto;
  transform: none;
}

.cosmology-section.is-static .cosmic-trigram strong,
.cosmology-section.is-static .cosmic-trigram small {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .taiji-core,
  .taiji-core circle:not(:first-child),
  .taiji-orbit,
  .taiji-orbit i,
  .cosmic-scroll-cue i,
  .flow-pulses path {
    animation: none;
  }

  .palace-cell,
  .cosmic-trigram strong,
  .cosmic-trigram small {
    transition: none;
  }
}
