:root {
  color-scheme: light;
  --bg: #f8f7f4;
  --paper: #fffefd;
  --paper-rgb: 255, 254, 253;
  --ink: #171412;
  --muted: #6f6860;
  --line: #e7e0d6;
  --soft: #f1ece4;
  --gold: #b58a45;
  --red: #b33a2e;
  --shadow: 0 24px 70px rgba(32, 24, 16, 0.08);
  --serif: "Songti SC", "STSong", "Noto Serif SC", serif;
  --sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --pointer-x: 50vw;
  --pointer-y: 38vh;
  --pointer-dx: 0px;
  --pointer-dy: 0px;
  --pointer-glow: 0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 42%, rgba(181, 138, 69, 0.07), transparent 22rem),
    radial-gradient(circle at 18% 12%, rgba(181, 138, 69, 0.08), transparent 28rem),
    radial-gradient(circle at 82% 20%, rgba(179, 58, 46, 0.052), transparent 26rem),
    linear-gradient(180deg, #fffefd 0%, var(--bg) 100%);
  color: var(--ink);
  font-family: var(--sans);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    linear-gradient(90deg, rgba(23, 20, 18, 0.018) 1px, transparent 1px),
    linear-gradient(180deg, rgba(23, 20, 18, 0.014) 1px, transparent 1px);
  background-size: 56px 56px, 56px 56px;
  mask-image: radial-gradient(circle at 50% 24%, black, transparent 72%);
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.copy-fallback {
  position: fixed;
  left: -9999px;
  top: 0;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 80px;
  position: relative;
  z-index: 1;
}

.ambient-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.paper-grain {
  position: absolute;
  inset: 0;
  opacity: 0.36;
  background-image:
    radial-gradient(circle at 18% 24%, rgba(23, 20, 18, 0.032) 0 1px, transparent 1.5px),
    radial-gradient(circle at 72% 62%, rgba(181, 138, 69, 0.04) 0 1px, transparent 1.6px),
    radial-gradient(circle at 42% 78%, rgba(23, 20, 18, 0.022) 0 1px, transparent 1.5px);
  background-size: 33px 37px, 41px 43px, 29px 31px;
  animation: grainDrift 18s steps(6, end) infinite;
}

.ink-wash {
  position: absolute;
  inset: -12%;
  opacity: 0.38;
  transform: translate(calc(var(--pointer-dx) * -0.34), calc(var(--pointer-dy) * -0.26));
  transition: transform 420ms ease-out;
  background:
    radial-gradient(circle at var(--pointer-x) var(--pointer-y), rgba(23, 20, 18, 0.12), transparent 6rem),
    linear-gradient(104deg, transparent 0 24%, rgba(23, 20, 18, 0.08) 24.2% 24.8%, transparent 25% 100%),
    linear-gradient(22deg, transparent 0 62%, rgba(181, 138, 69, 0.09) 62.2% 62.7%, transparent 63% 100%),
    linear-gradient(151deg, transparent 0 36%, rgba(23, 20, 18, 0.055) 36.2% 36.55%, transparent 37% 100%);
  filter: blur(0.2px);
  animation: inkCurrent 14s ease-in-out infinite alternate;
}

.cinnabar-orb {
  position: absolute;
  left: var(--pointer-x);
  top: var(--pointer-y);
  width: 132px;
  height: 132px;
  border-radius: 50%;
  opacity: calc(0.14 + var(--pointer-glow) * 0.2);
  transform: translate(-50%, -50%) scale(calc(0.82 + var(--pointer-glow) * 0.2));
  transition:
    left 260ms ease-out,
    top 260ms ease-out,
    opacity 280ms ease,
    transform 280ms ease;
  background:
    radial-gradient(circle, rgba(179, 58, 46, 0.24) 0 7%, rgba(179, 58, 46, 0.1) 8% 26%, transparent 62%);
  mix-blend-mode: multiply;
}

.bagua-directions {
  position: absolute;
  inset: clamp(18px, 4vw, 56px);
  color: rgba(23, 20, 18, 0.24);
  font-family: var(--serif);
  transform: translate(calc(var(--pointer-dx) * 0.08), calc(var(--pointer-dy) * 0.06));
  transition: transform 360ms ease-out;
}

.bagua-directions span {
  position: absolute;
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  border: 1px solid rgba(181, 138, 69, 0.14);
  border-radius: 50%;
  background: rgba(var(--paper-rgb), 0.2);
  animation: directionGlow 8s ease-in-out infinite;
  transition: border-color 220ms ease, color 220ms ease, background 220ms ease, opacity 220ms ease;
}

body.is-pointer-active .bagua-directions span {
  border-color: rgba(181, 138, 69, 0.2);
  color: rgba(23, 20, 18, 0.32);
}

.bagua-directions b {
  font-weight: 600;
  font-size: 22px;
  line-height: 1;
}

.bagua-directions i {
  font-style: normal;
  color: rgba(23, 20, 18, 0.2);
  font-size: 15px;
  line-height: 1;
}

.bagua-directions em {
  font-style: normal;
  color: rgba(111, 104, 96, 0.6);
  font-family: var(--sans);
  font-size: 10px;
  line-height: 1;
}

.gua-n { top: 0; left: 50%; transform: translateX(-50%); }
.gua-ne { top: 11%; right: 9%; animation-delay: 0.6s; }
.gua-e { top: 45%; right: 0; animation-delay: 1.2s; }
.gua-se { right: 10%; bottom: 12%; animation-delay: 1.8s; }
.gua-s { left: 50%; bottom: 0; transform: translateX(-50%); animation-delay: 2.4s; }
.gua-sw { left: 10%; bottom: 12%; animation-delay: 3s; }
.gua-w { top: 45%; left: 0; animation-delay: 3.6s; }
.gua-nw { top: 11%; left: 9%; animation-delay: 4.2s; }

.yao-mist {
  position: absolute;
  width: 360px;
  display: grid;
  gap: 18px;
  left: 50%;
  top: 48%;
  opacity: 0.16;
  transform:
    translate(calc(-50% + var(--pointer-dx) * 0.12), calc(-50% + var(--pointer-dy) * 0.1))
    rotate(calc(-9deg + var(--pointer-dx) * 0.015deg));
  transition: transform 420ms ease-out;
}

.yao-mist span {
  height: 10px;
  border-radius: 999px;
  background: var(--ink);
}

.yao-mist .yin {
  background:
    linear-gradient(90deg, var(--ink) 0 42%, transparent 42% 58%, var(--ink) 58% 100%);
}

.ambient-ring,
.ambient-line {
  position: absolute;
  opacity: 0.55;
}

.ambient-ring {
  border: 1px solid rgba(181, 138, 69, 0.18);
  border-radius: 50%;
  animation: driftRotate 36s linear infinite;
}

.ring-one {
  width: 560px;
  height: 560px;
  right: -180px;
  top: 44px;
}

.ring-two {
  width: 360px;
  height: 360px;
  left: -110px;
  bottom: 80px;
  animation-direction: reverse;
}

.ambient-line {
  height: 1px;
  width: 36vw;
  background: linear-gradient(90deg, transparent, rgba(23, 20, 18, 0.12), transparent);
  transform: rotate(-18deg);
  animation: inkLineBreath 9s ease-in-out infinite;
}

.line-one {
  left: 8vw;
  top: 26vh;
}

.line-two {
  right: 4vw;
  bottom: 18vh;
  animation-delay: -4s;
}

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

@keyframes directionGlow {
  0%, 100% {
    opacity: 0.34;
    border-color: rgba(181, 138, 69, 0.12);
  }
  50% {
    opacity: 0.62;
    border-color: rgba(181, 138, 69, 0.28);
  }
}

@keyframes grainDrift {
  50% {
    transform: translate(4px, -3px);
  }
}

@keyframes inkCurrent {
  from {
    opacity: 0.25;
    filter: blur(0.2px);
  }
  to {
    opacity: 0.42;
    filter: blur(0.7px);
  }
}

@keyframes inkLineBreath {
  0%, 100% {
    opacity: 0.28;
    background-size: 100% 100%;
  }
  50% {
    opacity: 0.58;
    background-size: 118% 100%;
  }
}

.oracle-hero {
  min-height: min(760px, calc(100vh - 40px));
  display: grid;
  align-content: center;
  gap: 28px;
}

.hero-copy {
  max-width: 840px;
}

.eyebrow,
.card-label {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
}

h1 {
  font-size: clamp(58px, 8vw, 104px);
  line-height: 1.02;
}

.lead {
  max-width: 620px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.8;
}

.oracle-stage {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(360px, 1.08fr);
  gap: 20px;
  align-items: stretch;
}

.question-panel,
.ritual-card,
.empty-state,
.result,
.casting-stage {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(255, 254, 253, 0.95)),
    radial-gradient(circle at 14% 0%, rgba(181, 138, 69, 0.08), transparent 17rem);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.question-panel {
  padding: 26px;
  backdrop-filter: blur(14px);
  transition: transform 260ms ease, box-shadow 260ms ease, border-color 260ms ease;
}

.question-panel:hover,
.ritual-card:hover,
.casting-board:hover,
.gua-card:hover {
  border-color: rgba(181, 138, 69, 0.34);
  box-shadow: 0 28px 78px rgba(32, 24, 16, 0.11);
}

.oracle-stage.is-casting {
  display: none;
}

label {
  display: block;
  margin-bottom: 12px;
  font-size: 18px;
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 142px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 18px;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.7;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

textarea:focus {
  border-color: rgba(181, 138, 69, 0.72);
  box-shadow: 0 0 0 4px rgba(181, 138, 69, 0.12);
}

.examples,
.actions,
.result-actions,
.meta-row,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.examples {
  margin-top: 14px;
}

.examples button,
.ghost {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 15px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
}

.examples button:hover,
.ghost:hover {
  border-color: rgba(181, 138, 69, 0.58);
}

.actions {
  margin-top: 22px;
  align-items: center;
}

.primary {
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  padding: 0 22px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
}

.primary.is-disabled {
  cursor: pointer;
  opacity: 0.42;
}

.coin-mark {
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 50%;
  position: relative;
}

.coin-mark::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid currentColor;
}

.primary:not(:disabled):hover .coin-mark {
  animation: cinnabarTap 920ms ease;
}

.process {
  margin-top: 18px;
  padding: 16px 18px;
  border-left: 3px solid var(--gold);
  background: var(--soft);
  color: var(--muted);
  line-height: 1.75;
}

.process ol {
  margin: 0;
  padding-left: 22px;
}

.ritual-card {
  min-height: 380px;
  padding: 26px;
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  backdrop-filter: blur(14px);
  transition: transform 280ms ease, box-shadow 280ms ease, border-color 280ms ease;
}

.ritual-card::before,
.ritual-card::after,
.casting-board::before {
  content: "";
  position: absolute;
  pointer-events: none;
}

.ritual-card::before {
  width: 460px;
  aspect-ratio: 1;
  border: 1px solid rgba(181, 138, 69, 0.18);
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent 49.7%, rgba(181, 138, 69, 0.16) 50%, transparent 50.3%),
    linear-gradient(0deg, transparent 49.7%, rgba(181, 138, 69, 0.16) 50%, transparent 50.3%);
  transform: rotate(calc(22.5deg + var(--pointer-dx) * 0.02deg));
  transition: transform 420ms ease-out;
  animation: compassTurn 18s linear infinite;
}

.ritual-card::after {
  inset: 18px;
  border: 1px solid rgba(23, 20, 18, 0.05);
}

.bagua-ring {
  width: min(300px, 72vw);
  aspect-ratio: 1;
  border: 1px solid rgba(181, 138, 69, 0.35);
  border-radius: 50%;
  position: relative;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-family: var(--serif);
  animation: ringBreath 4.8s ease-in-out infinite;
  transform: translate(calc(var(--pointer-dx) * 0.04), calc(var(--pointer-dy) * 0.04));
  transition: transform 360ms ease-out;
}

.bagua-ring::before,
.bagua-ring::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.bagua-ring::before {
  inset: 26%;
  border: 1px solid rgba(181, 138, 69, 0.32);
}

.bagua-ring::after {
  width: 56px;
  height: 56px;
  background: linear-gradient(90deg, var(--ink) 0 50%, #fff 50% 100%);
  border: 1px solid var(--ink);
  box-shadow: 0 0 0 18px rgba(181, 138, 69, 0.04);
}

.bagua-ring button {
  position: absolute;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 17px;
  cursor: pointer;
  transition: color 180ms ease, transform 180ms ease;
}

.bagua-ring button:hover,
.bagua-ring button.is-active {
  color: var(--red);
}

.bagua-ring button:nth-child(1) { top: 13px; left: 50%; transform: translateX(-50%); }
.bagua-ring button:nth-child(2) { top: 45px; right: 45px; }
.bagua-ring button:nth-child(3) { right: 13px; top: 50%; transform: translateY(-50%); }
.bagua-ring button:nth-child(4) { right: 45px; bottom: 45px; }
.bagua-ring button:nth-child(5) { bottom: 13px; left: 50%; transform: translateX(-50%); }
.bagua-ring button:nth-child(6) { left: 45px; bottom: 45px; }
.bagua-ring button:nth-child(7) { left: 13px; top: 50%; transform: translateY(-50%); }
.bagua-ring button:nth-child(8) { top: 45px; left: 45px; }

@keyframes ringBreath {
  0%, 100% {
    transform: scale(1);
    border-color: var(--line);
  }
  50% {
    transform: scale(1.035);
    border-color: rgba(181, 138, 69, 0.42);
  }
}

@keyframes compassTurn {
  to {
    rotate: 360deg;
  }
}

@keyframes cinnabarTap {
  0% {
    box-shadow: 0 0 0 0 rgba(179, 58, 46, 0.2);
  }
  55% {
    box-shadow: 0 0 0 10px rgba(179, 58, 46, 0.16);
  }
  100% {
    box-shadow: 0 0 0 18px rgba(179, 58, 46, 0);
  }
}

.preview-oracle {
  position: absolute;
  left: 28px;
  bottom: 70px;
  width: 150px;
  display: grid;
  gap: 12px;
  z-index: 1;
}

.preview-hexagram {
  width: 118px;
  margin: 0;
  gap: 8px;
  transition: opacity 360ms ease, transform 360ms ease;
}

.preview-oracle.is-changing .preview-hexagram {
  opacity: 0;
  transform: translateY(6px);
}

.preview-oracle .yao-line {
  height: 9px;
  gap: 16px;
}

.preview-oracle .yao-line span {
  background: rgba(23, 20, 18, 0.74);
}

.preview-meta {
  display: grid;
  gap: 4px;
  border-top: 1px solid rgba(231, 224, 214, 0.92);
  padding-top: 10px;
  color: var(--muted);
}

.preview-meta strong {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
}

.preview-meta span {
  color: rgba(111, 104, 96, 0.72);
  font-size: 13px;
}

.ritual {
  position: absolute;
  inset: auto 24px 24px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.ritual button {
  min-height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  opacity: 0.5;
  cursor: pointer;
  transition: color 180ms ease, opacity 180ms ease, border-color 180ms ease;
}

.ritual button:hover,
.ritual button.is-active {
  color: var(--red);
  opacity: 1;
  border-top-color: rgba(179, 58, 46, 0.42);
}

.ritual.active button {
  animation: ritualPulse 1.6s ease-in-out both;
}

.ritual.active button:nth-child(2) { animation-delay: 0.28s; }
.ritual.active button:nth-child(3) { animation-delay: 0.56s; }
.ritual.active button:nth-child(4) { animation-delay: 0.84s; }

@keyframes ritualPulse {
  0%, 100% {
    color: var(--muted);
    opacity: 0.45;
  }
  45% {
    color: var(--red);
    opacity: 1;
  }
}

.empty-state {
  margin-top: 22px;
  padding: 24px;
  color: var(--muted);
  line-height: 1.8;
}

.empty-state p {
  margin: 0;
}

.casting-stage {
  margin-top: 22px;
  padding: 24px;
}

.stage-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.stage-head h2 {
  font-size: clamp(30px, 5vw, 48px);
}

.stage-head p:last-child {
  max-width: 460px;
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.stage-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.78fr) minmax(360px, 1.08fr) minmax(220px, 0.68fr);
  gap: 16px;
  margin-top: 18px;
}

.derivation-panel,
.casting-board,
.math-panel {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  padding: 18px;
}

.derivation-panel,
.math-panel,
.gua-card,
.reading article,
.suggestions {
  transition: border-color 240ms ease, box-shadow 240ms ease, transform 240ms ease;
}

.derivation-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.derivation-steps li {
  display: grid;
  grid-template-columns: 34px 1fr;
  column-gap: 10px;
  row-gap: 2px;
  align-items: center;
  padding: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
}

.derivation-steps span {
  grid-row: span 2;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--gold);
  font-family: var(--serif);
}

.derivation-steps strong {
  color: var(--ink);
}

.derivation-steps em {
  font-style: normal;
  font-size: 13px;
  line-height: 1.5;
}

.derivation-steps li.active {
  border-color: rgba(181, 138, 69, 0.5);
  background: var(--soft);
}

.derivation-steps li.active span {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.derivation-steps li.done span {
  border-color: rgba(179, 58, 46, 0.42);
  color: var(--red);
}

.casting-board {
  display: grid;
  align-content: center;
  gap: 16px;
  min-height: 400px;
  position: relative;
  overflow: hidden;
  transition: border-color 260ms ease, box-shadow 260ms ease;
}

.casting-board::before {
  width: 280px;
  height: 280px;
  right: -86px;
  top: -92px;
  border: 1px solid rgba(181, 138, 69, 0.16);
  border-radius: 50%;
  background:
    radial-gradient(circle, transparent 0 30%, rgba(181, 138, 69, 0.04) 31% 32%, transparent 33%),
    conic-gradient(from 0deg, rgba(181, 138, 69, 0.08), transparent 16deg 45deg, rgba(23, 20, 18, 0.06) 46deg 58deg, transparent 59deg 90deg, rgba(181, 138, 69, 0.08));
  opacity: 0.8;
  transform: translate(calc(var(--pointer-dx) * -0.08), calc(var(--pointer-dy) * -0.08));
  transition: transform 360ms ease-out;
}

.board-labels,
.board-lines {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.board-labels span {
  color: var(--gold);
  font-weight: 700;
  font-size: 13px;
}

.board-caption {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  color: var(--muted);
  line-height: 1.7;
}

.stage-actions {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  color: var(--muted);
}

.stage-actions .reveal {
  flex: 0 0 auto;
  min-width: 148px;
  min-height: 52px;
  justify-content: center;
}

.casting-lines {
  width: min(150px, 100%);
  min-height: 117px;
  margin: 0;
}

.muted-lines .yao-line span {
  background: #55514d;
}

.yao-line.pending span {
  background: rgba(23, 20, 18, 0.05);
  border: 1px dashed rgba(23, 20, 18, 0.18);
  animation: none;
}

.yao-line.changed-now span {
  background: var(--red);
  animation: movingPulse 1.2s ease-in-out infinite, cinnabarSpread 2.4s ease-in-out infinite;
}

.math-panel dl {
  margin: 0;
  display: grid;
  gap: 10px;
}

.math-panel div {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.math-panel div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.math-panel dt {
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
}

.math-panel dd {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.55;
  word-break: break-word;
}

.result {
  margin-top: 22px;
  padding: 26px;
}

.result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.result-head h2 {
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1.25;
}

.small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 14px;
}

.copy-status {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  color: var(--red);
  font-size: 14px;
}

.gua-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.gua-card,
.reading article,
.suggestions {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  padding: 20px;
}

.gua-card h3 {
  font-size: 34px;
  line-height: 1.15;
}

.theme {
  margin: 8px 0 0;
  min-height: 48px;
  color: var(--muted);
  line-height: 1.65;
}

.hexagram-lines {
  display: grid;
  gap: 9px;
  width: 132px;
  margin: 20px 0;
}

.changed-gua .hexagram-lines {
  opacity: 0.76;
}

.main-gua,
.moving-gua,
.changed-gua {
  position: relative;
  overflow: hidden;
}

.main-gua::after,
.changed-gua::after {
  content: attr(data-oracle-mark);
  position: absolute;
  right: 18px;
  bottom: 12px;
  color: rgba(181, 138, 69, 0.1);
  font-family: var(--serif);
  font-size: 76px;
  line-height: 1;
  pointer-events: none;
}

.main-gua::after {
  content: "本";
}

.changed-gua::after {
  content: "之";
}

.yao-line {
  height: 12px;
  display: flex;
  gap: 18px;
  align-items: stretch;
  transform-origin: left center;
}

.yao-line span {
  display: block;
  height: 100%;
  background: var(--ink);
  border-radius: 999px;
  animation: lineCast 260ms ease both;
}

.yao-line.yang span {
  width: 100%;
}

.yao-line.yin span {
  flex: 1;
}

.yao-line.moving span {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(179, 58, 46, 0.1);
  animation: movingPulse 1.2s ease-in-out infinite, cinnabarSpread 2.4s ease-in-out infinite;
}

@keyframes lineCast {
  from {
    opacity: 0;
    transform: scaleX(0.2);
  }
  to {
    opacity: 1;
    transform: scaleX(1);
  }
}

@keyframes movingPulse {
  0%, 100% {
    box-shadow: 0 0 0 3px rgba(179, 58, 46, 0.1);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(179, 58, 46, 0.16);
  }
}

@keyframes cinnabarSpread {
  0%, 100% {
    filter: saturate(1);
  }
  50% {
    filter: saturate(1.22);
  }
}

.meta-row span,
.tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--muted);
  font-size: 13px;
}

.tag {
  color: var(--ink);
  background: var(--soft);
}

.reading {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 14px;
}

.reading p,
.suggestions li {
  color: var(--muted);
  line-height: 1.85;
}

.reading article p:last-child {
  margin-bottom: 0;
}

.suggestions {
  margin-top: 14px;
}

.suggestions ol {
  margin: 0;
  padding-left: 22px;
}

.suggestions li + li {
  margin-top: 8px;
}

[hidden] {
  display: none !important;
}

@media (max-width: 860px) {
  .bagua-directions {
    inset: 10px;
    opacity: 0.48;
  }

  .bagua-directions span {
    width: 58px;
    height: 58px;
  }

  .bagua-directions b {
    font-size: 16px;
  }

  .bagua-directions i {
    font-size: 12px;
  }

  .bagua-directions em {
    display: none;
  }

  .yao-mist {
    width: 250px;
    gap: 13px;
    opacity: 0.09;
  }

  .ink-wash {
    opacity: 0.22;
  }

  .cinnabar-orb {
    width: 96px;
    height: 96px;
  }

  .shell {
    width: min(100% - 24px, 680px);
    padding: 34px 0 52px;
  }

  .oracle-stage,
  .gua-grid,
  .stage-grid {
    grid-template-columns: 1fr;
  }

  .oracle-hero {
    min-height: auto;
    align-content: start;
  }

  .casting-board {
    order: 1;
  }

  .derivation-panel {
    order: 2;
  }

  .math-panel {
    order: 3;
  }

  .stage-head {
    align-items: start;
    flex-direction: column;
  }

  .ritual-card {
    min-height: 280px;
  }

  .result-head {
    flex-direction: column;
  }

  .casting-board {
    min-height: auto;
  }

  .stage-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .shell {
    padding-top: 24px;
  }

  h1 {
    font-size: 44px;
  }

  .lead {
    font-size: 16px;
    line-height: 1.62;
  }

  .question-panel,
  .ritual-card,
  .casting-stage,
  .result,
  .empty-state {
    padding: 18px;
  }

  .ritual {
    grid-template-columns: repeat(2, 1fr);
    position: static;
    width: 100%;
    margin-top: 22px;
  }

  .bagua-ring {
    width: min(178px, 58vw);
  }

  .preview-oracle {
    left: 24px;
    bottom: 68px;
    width: 118px;
  }

  .preview-hexagram {
    width: 86px;
    gap: 7px;
  }

  .preview-oracle .yao-line {
    height: 7px;
    gap: 12px;
  }

  .preview-meta strong {
    font-size: 16px;
  }

  .actions,
  .result-actions {
    width: 100%;
  }

  .primary,
  .ghost {
    justify-content: center;
  }

  .primary {
    flex: 1 1 150px;
  }

  .ghost {
    flex: 1 1 130px;
  }

  .board-lines {
    gap: 12px;
  }

  .casting-lines {
    width: 124px;
  }

  .stage-head h2 {
    font-size: 42px;
  }

  .stage-actions .reveal {
    width: 100%;
    flex-basis: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
