#hex-result .hex-zh,
#hex-casting .hex-zh {
  font-size: 2.5rem;
  line-height: 1;
  color: #7c4d9e;
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
}
code { font-size: 0.85em; }

/* Hexagram casting ritual */
.hex-coins {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
}
.hex-coin {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 9999px;
  border: 1px solid #d4c4a8;
  background:
    radial-gradient(circle at 30% 28%, #fff8e8 0%, #f3e6c8 38%, #c9a24a 100%);
  box-shadow: 0 2px 8px rgba(43, 35, 64, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5a3d7a;
  transition: transform 0.45s ease, box-shadow 0.45s ease, border-color 0.45s ease;
}
.hex-coin[data-face="yin"] {
  background:
    radial-gradient(circle at 30% 28%, #f6f0fb 0%, #e4d7f2 40%, #7b5aa6 100%);
  border-color: #c4b0d8;
  color: #faf7f0;
}
.hex-coin-face {
  font-size: 1.15rem;
  line-height: 1;
  font-family: "Cormorant Garamond", Georgia, serif;
}
.hex-coins.is-shaking .hex-coin {
  animation: hex-coin-toss 0.9s ease-in-out infinite;
}
.hex-coins.is-shaking .hex-coin:nth-child(2) { animation-delay: 0.08s; }
.hex-coins.is-shaking .hex-coin:nth-child(3) { animation-delay: 0.16s; }
.hex-coin.is-settled {
  transform: scale(1.04);
  box-shadow: 0 4px 14px rgba(123, 90, 166, 0.18);
}
@keyframes hex-coin-toss {
  0% { transform: translateY(0) rotate(0deg); }
  35% { transform: translateY(-10px) rotate(160deg); }
  70% { transform: translateY(-4px) rotate(300deg); }
  100% { transform: translateY(0) rotate(360deg); }
}

.hex-cast-steps {
  list-style: none;
  display: grid;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
}
.hex-cast-step {
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: #6b647a;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  transition: background 0.35s ease, border-color 0.35s ease, color 0.35s ease;
}
.hex-cast-step.is-active {
  color: #2b2340;
  border-color: #e6ddcd;
  background: #f2edf9;
}
.hex-cast-step.is-done {
  color: #a8873f;
}

.hex-yao-stack {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  width: 5.5rem;
}
.hex-yao {
  display: flex;
  justify-content: space-between;
  height: 0.42rem;
  opacity: 0;
  transform: translateY(6px);
  animation: hex-yao-in 0.55s ease forwards;
  animation-delay: calc(var(--i, 0) * 0.12s);
}
.hex-yao-yang span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #a8873f, #7b5aa6);
}
.hex-yao-yin span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #c9b48a, #7b5aa6);
}
@keyframes hex-yao-in {
  to { opacity: 1; transform: translateY(0); }
}

.hex-stage {
  transition: opacity 1.2s ease, transform 1.2s ease;
}
.hex-stage-hidden {
  opacity: 0;
  transform: translateY(12px);
}
.hex-stage-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .hex-coins.is-shaking .hex-coin,
  .hex-yao,
  .hex-stage {
    animation: none !important;
    transition: none !important;
  }
  .hex-stage-hidden,
  .hex-yao {
    opacity: 1;
    transform: none;
  }
}
