/* ============================================================
   可悬停符号 + 弹窗 + 每个符号自己的动画
   ============================================================ */
.sym {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  font: inherit; color: inherit; background: none; border: 0; padding: 0 .05em; margin: 0;
  cursor: help; line-height: inherit;
}
.sym .sg { position: relative; display: inline-block; transition: transform .25s, text-shadow .25s; }
.sym:hover .sg, .sym.open .sg, .sym:focus-visible .sg { transform: translateY(-2px); text-shadow: 0 0 14px currentColor; }
.sym-tengod { color: var(--gold); font-size: .85rem; border-bottom: 1px dotted currentColor; }
.sym-element { font-weight: 600; }
.sym-plain { color: var(--mist); font-size: .85rem; }

/* 弹窗 */
.sym .pop {
  --dx: 0px;
  position: absolute; z-index: 30; bottom: calc(100% + 10px); left: 50%;
  width: 280px; padding: 1rem 1.1rem .9rem; text-align: left;
  transform: translate(calc(-50% + var(--dx)), 6px); opacity: 0; visibility: hidden; pointer-events: none;
  background: var(--pop-bg, var(--indigo)); color: var(--moon);
  border: 1px solid var(--gold); border-radius: var(--radius-m);
  box-shadow: 0 18px 40px rgba(0,0,0,.35);
  font-family: var(--body); font-size: .86rem; line-height: 1.6; font-weight: 400; text-shadow: none;
  transition: opacity .18s, transform .18s, visibility .18s;
}
.sym.below .pop { bottom: auto; top: calc(100% + 10px); }
.sym:hover .pop, .sym.open .pop, .sym:focus-visible .pop { opacity: 1; visibility: visible; transform: translate(calc(-50% + var(--dx)), 0); pointer-events: auto; }
.pop > span { display: block; }
.pop-icon {
  width: 3.6rem; height: 3.6rem; margin: -2.6rem auto .5rem; border-radius: 50%;
  display: grid !important; place-items: center; font-size: 2rem; line-height: 1;
  background: radial-gradient(circle at 35% 30%, var(--medal-hi, #2f3d66), var(--medal-lo, #151d36));
  border: 1px solid var(--gold); position: relative;
}
.pop-title { font-size: .98rem; margin-bottom: .1rem; }
.pop-title b { font-family: var(--display); font-weight: 400; font-size: 1.35rem; margin-right: .2rem; }
.pop-title i { color: var(--mist); font-style: normal; margin-right: .3rem; }
.pop-sub { color: var(--mist); font-size: .82rem; margin-bottom: .55rem; }
.pop-row { padding-top: .45rem; margin-top: .45rem; border-top: 1px solid var(--indigo-2); }
.pop-k { display: block; font-size: .75rem; color: var(--gold); margin-bottom: .1rem; }
.pop-row.shadow .pop-k { color: var(--fire); }
.pop .bi .tr { font-size: .9em; }

/* 生肖大卡片（首页图鉴 / 敦煌主题轮盘） */
.sym-animal { flex-direction: column; cursor: pointer; }
.sym-animal .sg { display: grid; justify-items: center; gap: .2rem; }
.sym-animal .live { display: inline-block; font-size: 2.3rem; line-height: 1.1; }
.sym-animal small { font-family: var(--display); font-size: .95rem; color: var(--moon); }

/* ------------------------------------------------------------ 动画：只在弹窗打开时播放 */
.pop-icon, .sym-animal .live { animation-duration: 1.6s; animation-iteration-count: infinite; animation-timing-function: ease-in-out; animation-play-state: paused; }
.sym:hover .pop-icon, .sym.open .pop-icon, .sym:focus-visible .pop-icon { animation-play-state: running; }
.sym-animal:hover .live, .sym-animal.open .live, .sym-animal:focus-visible .live { animation-play-state: running; }

/* 五行 */
.a-grow    { animation-name: a-grow; transform-origin: 50% 90%; }
.a-flicker { animation-name: a-flicker; animation-duration: .9s !important; transform-origin: 50% 90%; }
.a-rise    { animation-name: a-rise; }
.a-shine   { animation-name: a-shine; }
.a-ripple  { animation-name: a-ripple; }
.a-ripple::after { content: ""; position: absolute; inset: 18%; border-radius: 50%; border: 1px solid var(--water); animation: a-ring 1.6s ease-out infinite; animation-play-state: inherit; }
@keyframes a-grow    { 0% { transform: scale(.35) translateY(8px); } 45% { transform: scale(1.12) rotate(-4deg); } 70% { transform: scale(1) rotate(4deg); } 100% { transform: scale(1) rotate(-2deg); } }
@keyframes a-flicker { 0%,100% { transform: scale(1,1) skewX(0); filter: drop-shadow(0 0 4px #ff9a3c); } 25% { transform: scale(1.06,1.16) skewX(4deg); filter: drop-shadow(0 0 12px #ff7a2c); } 55% { transform: scale(.96,1.04) skewX(-4deg); } 80% { transform: scale(1.04,1.12) skewX(2deg); filter: drop-shadow(0 0 9px #ffb14a); } }
@keyframes a-rise    { 0% { transform: translateY(16px) scale(.9); opacity: .3; } 40% { transform: translateY(-4px) scale(1.05); opacity: 1; } 60%,100% { transform: translateY(0) scale(1); } }
@keyframes a-shine   { 0%,100% { transform: rotate(0) scale(1); filter: brightness(1); } 50% { transform: rotate(18deg) scale(1.2); filter: brightness(1.7) drop-shadow(0 0 8px #fff3c4); } }
@keyframes a-ripple  { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes a-ring    { 0% { transform: scale(.6); opacity: .9; } 100% { transform: scale(1.7); opacity: 0; } }

/* 十二生肖：每只动物有自己的动作 */
.a-scurry  { animation-name: a-scurry; animation-duration: .9s !important; }
.a-nod     { animation-name: a-nod; transform-origin: 30% 90%; }
.a-pounce  { animation-name: a-pounce; transform-origin: 50% 100%; }
.a-hop     { animation-name: a-hop; transform-origin: 50% 100%; animation-duration: .9s !important; }
.a-soar    { animation-name: a-soar; animation-duration: 2.4s !important; }
.a-slither { animation-name: a-slither; }
.a-gallop  { animation-name: a-gallop; animation-duration: .5s !important; transform-origin: 50% 100%; }
.a-sway    { animation-name: a-sway; animation-duration: 2.2s !important; transform-origin: 50% 100%; }
.a-swing   { animation-name: a-swing; transform-origin: 50% -30%; }
.a-peck    { animation-name: a-peck; animation-duration: .8s !important; transform-origin: 70% 90%; }
.a-wag     { animation-name: a-wag; animation-duration: .45s !important; transform-origin: 50% 100%; }
.a-roll    { animation-name: a-roll; animation-duration: 2s !important; }
@keyframes a-scurry  { 0%,100% { transform: translateX(-12px) scaleX(1); } 45% { transform: translateX(12px) scaleX(1); } 50% { transform: translateX(12px) scaleX(-1); } 95% { transform: translateX(-12px) scaleX(-1); } }
@keyframes a-nod     { 0%,100% { transform: rotate(0); } 30% { transform: rotate(10deg); } 60% { transform: rotate(-4deg); } }
@keyframes a-pounce  { 0%,100% { transform: translate(0,0) scale(1,1); } 25% { transform: translate(-4px,2px) scale(1.1,.82); } 55% { transform: translate(8px,-16px) scale(1.12) rotate(-8deg); } 75% { transform: translate(2px,0) scale(1.05,.92); } }
@keyframes a-hop     { 0%,100% { transform: translateY(0) scale(1.08,.9); } 45% { transform: translateY(-18px) scale(.95,1.08); } }
@keyframes a-soar    { 0% { transform: translate(-10px,6px) rotate(-6deg); } 25% { transform: translate(0,-8px) rotate(4deg); } 50% { transform: translate(10px,4px) rotate(-4deg); } 75% { transform: translate(0,-6px) rotate(6deg); } 100% { transform: translate(-10px,6px) rotate(-6deg); } }
@keyframes a-slither { 0%,100% { transform: skewX(-14deg) translateX(-4px); } 50% { transform: skewX(14deg) translateX(4px); } }
@keyframes a-gallop  { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-8px) rotate(5deg); } }
@keyframes a-sway    { 0%,100% { transform: rotate(-7deg); } 50% { transform: rotate(7deg); } }
@keyframes a-swing   { 0%,100% { transform: rotate(-22deg); } 50% { transform: rotate(22deg); } }
@keyframes a-peck    { 0%,60%,100% { transform: rotate(0); } 20% { transform: rotate(28deg); } 35% { transform: rotate(-4deg); } }
@keyframes a-wag     { 0%,100% { transform: rotate(-5deg) translateX(-2px); } 50% { transform: rotate(5deg) translateX(2px); } }
@keyframes a-roll    { 0%,100% { transform: rotate(-12deg) translateY(0); } 30% { transform: rotate(14deg) translateY(-6px); } 60% { transform: rotate(-6deg) translateY(0); } }

/* 十神 */
.a-shoulder { animation-name: a-shoulder; }
.a-dash     { animation-name: a-dash; animation-duration: 1s !important; }
.a-steam    { animation-name: a-bob; }
.a-steam::after { content: "∿"; position: absolute; top: -.2rem; left: 50%; font-size: 1.2rem; color: var(--mist); animation: a-steam 1.6s ease-out infinite; animation-play-state: inherit; }
.a-flip     { animation-name: a-flip; animation-duration: 2s !important; }
.a-tumble   { animation-name: a-tumble; animation-duration: 1.3s !important; }
.a-drop     { animation-name: a-drop; animation-duration: 1.4s !important; }
.a-slash    { animation-name: a-slash; animation-duration: 1.1s !important; transform-origin: 30% 80%; }
.a-tilt     { animation-name: a-tilt; animation-duration: 2.6s !important; }
.a-swirl    { animation-name: a-swirl; animation-duration: 2.4s !important; }
.a-stamp    { animation-name: a-stamp; animation-duration: 1.8s !important; }
.a-stamp::after { content: "印"; position: absolute; right: -.5rem; bottom: -.3rem; width: 1.3rem; height: 1.3rem; display: grid; place-items: center;
  font-family: var(--display); font-size: .8rem; color: #fff; background: var(--cinnabar); border-radius: 2px; animation: a-seal 1.8s ease-out infinite; animation-play-state: inherit; }
@keyframes a-shoulder { 0%,100% { transform: translateX(0); } 30% { transform: translateX(-6px) rotate(-6deg); } 60% { transform: translateX(6px) rotate(6deg); } }
@keyframes a-dash     { 0% { transform: translateX(-18px) skewX(-12deg); opacity: .4; } 50% { transform: translateX(8px) skewX(0); opacity: 1; } 100% { transform: translateX(18px) skewX(8deg); opacity: .4; } }
@keyframes a-bob      { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes a-steam    { 0% { transform: translate(-50%, 0); opacity: 0; } 30% { opacity: .9; } 100% { transform: translate(-50%, -18px); opacity: 0; } }
@keyframes a-flip     { 0%,100% { transform: rotateY(0); } 50% { transform: rotateY(180deg); } }
@keyframes a-tumble   { 0% { transform: translateY(-10px) rotate(0); } 50% { transform: translateY(4px) rotate(200deg); } 100% { transform: translateY(-10px) rotate(360deg); } }
@keyframes a-drop     { 0% { transform: translateY(-22px) rotateY(0); opacity: 0; } 40% { transform: translateY(0) rotateY(360deg); opacity: 1; } 55% { transform: translateY(-6px); } 70%,100% { transform: translateY(0); } }
@keyframes a-slash    { 0%,100% { transform: rotate(-35deg); } 30% { transform: rotate(30deg); } 45% { transform: rotate(24deg); } }
@keyframes a-tilt     { 0%,100% { transform: rotate(-12deg); } 50% { transform: rotate(12deg); } }
@keyframes a-swirl    { 0% { transform: rotate(0) scale(1); filter: hue-rotate(0) drop-shadow(0 0 4px #b7a6e8); } 50% { transform: rotate(180deg) scale(1.12); filter: hue-rotate(60deg) drop-shadow(0 0 12px #b7a6e8); } 100% { transform: rotate(360deg) scale(1); filter: hue-rotate(0) drop-shadow(0 0 4px #b7a6e8); } }
@keyframes a-stamp    { 0% { transform: translateY(-14px) scale(1.4); } 30% { transform: translateY(0) scale(.92); } 40%,100% { transform: translateY(0) scale(1); } }
@keyframes a-seal     { 0%,28% { opacity: 0; transform: scale(1.6); } 38% { opacity: 1; transform: scale(1); } 90% { opacity: 1; } 100% { opacity: 0; } }

/* ------------------------------------------------------------ 符号图鉴（首页） */
.atlas { display: grid; gap: 2.2rem; }
.atlas-row h3 { margin-bottom: .2rem; }
.atlas-row > p { color: var(--mist); font-size: .95rem; }
.atlas-strip { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .8rem; }
.atlas-strip .sym-stem .sg, .atlas-strip .sym-element .sg { font-family: var(--display); font-size: 2.1rem; width: 3.6rem; height: 3.6rem; display: grid; place-items: center;
  border: 1px solid var(--indigo-2); border-radius: 50%; }
.atlas-strip .sym-stem:hover .sg, .atlas-strip .sym-stem.open .sg, .atlas-strip .sym-element:hover .sg { border-color: currentColor; }
.atlas-strip .sym-animal .sg { width: 4.6rem; padding: .5rem 0 .4rem; border: 1px solid var(--indigo-2); border-radius: var(--radius-m); }
.atlas-strip .sym-animal:hover .sg, .atlas-strip .sym-animal.open .sg { border-color: var(--gold); }
.atlas-strip .sym-tengod { font-size: 1rem; border: 1px solid var(--indigo-2); border-radius: 30px; padding: .3rem .9rem; color: var(--moon); }
.atlas-strip .sym-tengod:hover, .atlas-strip .sym-tengod.open { border-color: var(--gold); color: var(--gold); }
.motto { font-family: var(--display); font-size: 1.25rem; color: var(--celadon); }

@media (prefers-reduced-motion: reduce) {
  .pop-icon, .sym-animal .live, .a-ripple::after, .a-steam::after, .a-stamp::after { animation: none !important; }
}
@media (max-width: 680px) {
  .sym .pop { width: min(280px, 88vw); }
}
/* 打开的符号浮在最上层（敦煌轮盘里的生肖互相有 transform，需要单独抬高） */
.sym:hover, .sym.open, .sym:focus-visible { z-index: 40; }
