/* 天机预测 — 八卦求签页 */
:root {
  --xtw-predict-gold: #f0c76a;
  --xtw-predict-gold-dim: #c9a043;
  --xtw-predict-purple: #1a0a2e;
  --xtw-predict-purple-mid: #2d1b4e;
  --xtw-predict-accent: #9d4edd;
}

body.xtw-predict-open {
  overflow: hidden;
}

body.xtw-predict-open #xtw-season-fx {
  display: none !important;
}

body.xtw-predict-open #app {
  visibility: hidden;
  pointer-events: none;
}

#xtw-predict {
  position: fixed;
  inset: 0;
  z-index: 900;
  max-width: 720px;
  margin: 0 auto;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 16px 16px calc(var(--xtw-tabbar-h, 52px) + 20px);
  background:
    radial-gradient(ellipse 120% 80% at 50% 0%, #3d2066 0%, var(--xtw-predict-purple) 45%, #0d0618 100%);
  color: #f5e6c8;
  font-family: "Microsoft YaHei", "PingFang SC", "STKaiti", "KaiTi", serif;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s;
}

#xtw-predict.is-open {
  opacity: 1;
  visibility: visible;
  animation: xtw-predict-bg-shift 12s ease-in-out infinite alternate;
}

#xtw-predict.is-ready .xtw-predict__header,
#xtw-predict.is-ready .xtw-predict__game-banner,
#xtw-predict.is-ready .xtw-predict__bagua-wrap,
#xtw-predict.is-ready .xtw-predict__games,
#xtw-predict.is-ready .xtw-predict__qiu-wrap,
#xtw-predict.is-ready .xtw-predict__hint {
  animation: xtw-predict-rise 0.75s cubic-bezier(0.22, 1, 0.36, 1) both;
}

#xtw-predict.is-ready .xtw-predict__game-banner {
  animation-delay: 0.08s;
}

#xtw-predict.is-ready .xtw-predict__bagua-wrap {
  animation-delay: 0.16s;
}

#xtw-predict.is-ready .xtw-predict__games {
  animation-delay: 0.24s;
}

#xtw-predict.is-ready .xtw-predict__qiu-wrap {
  animation-delay: 0.32s;
}

#xtw-predict.is-ready .xtw-predict__hint {
  animation-delay: 0.4s;
}

#xtw-predict.is-open .xtw-predict__bagua-ring--outer {
  animation: xtw-bagua-spin 24s linear infinite;
}

#xtw-predict.is-open .xtw-predict__bagua-ring--inner {
  animation: xtw-bagua-spin 16s linear infinite reverse;
}

#xtw-predict.is-casting .xtw-predict__bagua-ring--outer {
  animation-duration: 3s;
}

#xtw-predict.is-casting .xtw-predict__bagua-ring--inner {
  animation-duration: 2s;
}

#xtw-predict.is-casting .xtw-predict__qiu-btn {
  animation: xtw-qiu-pulse 0.5s ease infinite;
  pointer-events: none;
}

.xtw-predict__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.7;
}

.xtw-predict__ink {
  position: absolute;
  inset: -20%;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 30%, rgba(157, 78, 221, 0.18) 0%, transparent 42%),
    radial-gradient(circle at 80% 70%, rgba(240, 199, 106, 0.1) 0%, transparent 38%);
  animation: xtw-ink-flow 10s ease-in-out infinite alternate;
  mix-blend-mode: screen;
}

.xtw-predict__fog {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 70%, rgba(157, 78, 221, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 70% 30%, rgba(240, 199, 106, 0.08) 0%, transparent 45%);
  pointer-events: none;
  animation: xtw-fog-drift 8s ease-in-out infinite alternate;
}

.xtw-predict__fog--gold {
  animation: xtw-fog-drift 11s ease-in-out infinite alternate-reverse;
  opacity: 0.55;
}

.xtw-predict__floats {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.xtw-predict__float {
  position: absolute;
  bottom: -10%;
  color: rgba(240, 199, 106, 0.55);
  text-shadow: 0 0 12px rgba(240, 199, 106, 0.45);
  animation: xtw-float-rise linear forwards;
  opacity: 0;
}

.xtw-predict__corner {
  position: absolute;
  z-index: 1;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: rgba(240, 199, 106, 0.28);
  text-shadow: none;
  animation: xtw-corner-glow 4s ease-in-out infinite;
  pointer-events: none;
}

.xtw-predict__corner--tl { top: 56px; left: 8px; animation-delay: 0s; }
.xtw-predict__corner--tr { top: 56px; right: 8px; animation-delay: 1s; }
.xtw-predict__corner--bl { bottom: calc(var(--xtw-tabbar-h, 52px) + 12px); left: 12px; animation-delay: 2s; }
.xtw-predict__corner--br { bottom: calc(var(--xtw-tabbar-h, 52px) + 12px); right: 12px; animation-delay: 3s; }

.xtw-predict__header {
  position: relative;
  z-index: 2;
  text-align: center;
  margin-bottom: 4px;
}

.xtw-predict__eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.35em;
  text-indent: 0.35em;
  color: rgba(240, 199, 106, 0.55);
  animation: xtw-text-breathe 3.5s ease-in-out infinite;
}

.xtw-predict__title {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.35em;
  text-indent: 0.35em;
  background: linear-gradient(120deg, #fff8e7 0%, var(--xtw-predict-gold) 35%, #fff3c4 50%, var(--xtw-predict-gold-dim) 75%, #fff8e7 100%);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(240, 199, 106, 0.35));
  animation: xtw-title-shimmer 4.5s linear infinite;
}

.xtw-predict__subtitle {
  margin: 6px 0 0;
  font-size: 12px;
  color: rgba(245, 230, 200, 0.72);
  letter-spacing: 0.18em;
  animation: xtw-text-breathe 4s ease-in-out infinite reverse;
}

.xtw-predict__game-banner {
  position: relative;
  z-index: 3;
  width: min(100%, 360px);
  margin: 12px 0 10px;
  padding: 0;
  border-radius: 16px;
  border: 1px solid rgba(240, 199, 106, 0.35);
  background: linear-gradient(180deg, rgba(61, 32, 102, 0.88) 0%, rgba(13, 6, 24, 0.92) 100%);
  box-shadow: 0 0 20px rgba(157, 78, 221, 0.18), inset 0 0 16px rgba(240, 199, 106, 0.05);
  overflow: visible;
}

.xtw-predict__game-banner-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 18px;
  min-height: 52px;
}

.xtw-predict__game-banner .xtw-predict__game-sigil {
  position: static;
  z-index: 1;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: 0;
  border-radius: 50%;
  border: 1px solid rgba(240, 199, 106, 0.5);
  font-size: 15px;
  font-weight: 700;
  color: #fff8e7;
  background: radial-gradient(circle at 35% 30%, rgba(255, 248, 231, 0.25) 0%, rgba(240, 199, 106, 0.18) 100%);
  box-shadow: 0 0 10px rgba(240, 199, 106, 0.25);
  animation: none;
}

.xtw-predict__game-banner-name {
  position: relative;
  z-index: 1;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.08em;
  color: #f0c76a;
  text-shadow: 0 0 12px rgba(240, 199, 106, 0.35);
  text-align: left;
}

#xtw-predict.is-switching .xtw-predict__game-banner-name {
  animation: xtw-game-switch 0.65s ease;
}

.xtw-predict__game-char {
  display: inline-block;
  animation: xtw-char-float 3.2s ease-in-out infinite;
}

.xtw-predict__game-banner-name .xtw-predict__game-char {
  color: #f0c76a;
  background: none;
  -webkit-background-clip: border-box;
  background-clip: border-box;
}

.xtw-predict__game.is-active .xtw-predict__game-char {
  background: linear-gradient(180deg, #fffef5 0%, #f0c76a 55%, #d4a843 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.xtw-predict__bagua-wrap {
  position: relative;
  z-index: 2;
  width: 220px;
  height: 220px;
  margin: 18px auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.xtw-predict__bagua-glow {
  position: absolute;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(240, 199, 106, 0.25) 0%, transparent 70%);
  animation: xtw-glow-pulse 3s ease-in-out infinite;
}

.xtw-predict__bagua-ring {
  position: absolute;
  width: 100%;
  height: 100%;
}

.xtw-predict__bagua-ring--inner {
  width: 88px;
  height: 88px;
}

.xtw-predict__bagua-ring svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 12px rgba(240, 199, 106, 0.4));
}

.xtw-predict__games {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  width: 100%;
  max-width: 360px;
  margin-bottom: 20px;
}

.xtw-predict__game {
  position: relative;
  flex: 1 1 30%;
  min-width: 100px;
  padding: 12px 8px 10px;
  border: 1px solid rgba(240, 199, 106, 0.28);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(61, 32, 102, 0.55) 0%, rgba(26, 10, 46, 0.78) 100%);
  color: rgba(245, 230, 200, 0.82);
  font-size: 11px;
  line-height: 1.35;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.xtw-predict__game::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(240, 199, 106, 0.12) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.6s ease;
  pointer-events: none;
}

.xtw-predict__game:active::before,
.xtw-predict__game.is-active::before {
  transform: translateX(120%);
}

.xtw-predict__game-sigil {
  display: block;
  width: 22px;
  height: 22px;
  margin: 0 auto 6px;
  border-radius: 50%;
  border: 1px solid rgba(240, 199, 106, 0.25);
  line-height: 20px;
  font-size: 11px;
  color: rgba(240, 199, 106, 0.75);
}

.xtw-predict__game-text {
  display: block;
}

.xtw-predict__game.is-active {
  border-color: var(--xtw-predict-gold);
  box-shadow:
    0 0 20px rgba(240, 199, 106, 0.35),
    0 0 40px rgba(157, 78, 221, 0.18),
    inset 0 0 24px rgba(240, 199, 106, 0.08);
  color: #fff8e7;
  transform: translateY(-2px) scale(1.03);
  animation: xtw-game-glow 2.4s ease-in-out infinite;
}

.xtw-predict__game.is-active .xtw-predict__game-sigil {
  border-color: rgba(240, 199, 106, 0.65);
  color: #fff8e7;
  box-shadow: 0 0 12px rgba(240, 199, 106, 0.45);
  animation: xtw-sigil-pulse 2.2s ease-in-out infinite;
}

.xtw-predict__qiu-wrap {
  position: relative;
  z-index: 2;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.xtw-predict__qiu-aura {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px dashed rgba(240, 199, 106, 0.35);
  animation: xtw-qiu-aura-spin 10s linear infinite;
}

.xtw-predict__qiu-aura::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 1px solid rgba(157, 78, 221, 0.25);
  animation: xtw-qiu-aura-spin 7s linear infinite reverse;
}

.xtw-predict__qiu-btn {
  position: relative;
  z-index: 1;
  width: 88px;
  height: 88px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 36px;
  font-weight: 700;
  color: #2a1500;
  background: radial-gradient(circle at 35% 30%, #fff8dc 0%, var(--xtw-predict-gold) 40%, #b8860b 100%);
  box-shadow: 0 0 0 4px rgba(240, 199, 106, 0.3),
    0 0 30px rgba(240, 199, 106, 0.5),
    0 8px 24px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s;
  -webkit-tap-highlight-color: transparent;
  animation: xtw-qiu-float 3s ease-in-out infinite;
}

.xtw-predict__qiu-btn:active {
  transform: scale(0.94);
}

@media (prefers-reduced-motion: reduce) {
  #xtw-predict.is-open .xtw-predict__bagua-ring--outer,
  #xtw-predict.is-open .xtw-predict__bagua-ring--inner,
  .xtw-predict__bagua-glow,
  .xtw-predict__fog,
  .xtw-predict__ink,
  .xtw-predict__float,
  .xtw-predict__game-char,
  .xtw-predict__title,
  .xtw-predict__hint,
  .xtw-predict__qiu-btn,
  .xtw-predict__game.is-active {
    animation: none !important;
  }
}

.xtw-predict__hint {
  position: relative;
  z-index: 2;
  margin: 12px 0 0;
  font-size: 12px;
  color: rgba(245, 230, 200, 0.62);
  letter-spacing: 0.15em;
  animation: xtw-text-breathe 3.8s ease-in-out infinite;
}

.xtw-predict__fortune {
  text-align: center;
  font-size: 15px;
  color: var(--xtw-predict-gold);
  margin-bottom: 4px;
  letter-spacing: 0.08em;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.xtw-predict__fortune-level {
  font-size: 16px;
  font-weight: 700;
  animation: xtw-title-shimmer 5s linear infinite;
  background: linear-gradient(120deg, #fff8e7, #f0c76a, #fff8e7);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.xtw-predict__fortune-game {
  font-size: 13px;
  color: rgba(245, 230, 200, 0.85);
}

.xtw-predict__result {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 400px;
  margin-top: 20px;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid rgba(240, 199, 106, 0.25);
  background: rgba(13, 6, 24, 0.75);
  backdrop-filter: blur(8px);
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.34, 1.4, 0.64, 1);
  pointer-events: none;
}

.xtw-predict__result.is-show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  box-shadow: 0 0 28px rgba(240, 199, 106, 0.18), inset 0 0 24px rgba(157, 78, 221, 0.08);
}

.xtw-predict__verse {
  text-align: center;
  font-size: 12px;
  color: rgba(245, 230, 200, 0.6);
  margin-bottom: 14px;
  line-height: 1.6;
}

.xtw-predict__balls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.xtw-predict__ball {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35), inset 0 -2px 4px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: scale(0) rotate(-180deg);
  animation: xtw-ball-pop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.xtw-predict__ball--red {
  background: radial-gradient(circle at 30% 28%, #ff6b6b, #c0392b);
}

.xtw-predict__ball--blue {
  background: radial-gradient(circle at 30% 28%, #5dade2, #2471a3);
}

.xtw-predict__ball--green {
  background: radial-gradient(circle at 30% 28%, #58d68d, #1e8449);
}

.xtw-predict__again {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 10px;
  border: 1px solid rgba(240, 199, 106, 0.4);
  border-radius: 8px;
  background: transparent;
  color: var(--xtw-predict-gold);
  font-size: 14px;
  cursor: pointer;
  letter-spacing: 0.2em;
}

@keyframes xtw-bagua-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes xtw-glow-pulse {
  0%,
  100% {
    opacity: 0.6;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

@keyframes xtw-fog-drift {
  from {
    opacity: 0.7;
  }
  to {
    opacity: 1;
  }
}

@keyframes xtw-qiu-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 4px rgba(240, 199, 106, 0.3), 0 0 40px rgba(240, 199, 106, 0.8);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(240, 199, 106, 0.5), 0 0 60px rgba(240, 199, 106, 1);
  }
}

@keyframes xtw-ball-pop {
  to {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

@keyframes xtw-predict-bg-shift {
  from {
    filter: hue-rotate(0deg) brightness(1);
  }
  to {
    filter: hue-rotate(8deg) brightness(1.05);
  }
}

@keyframes xtw-predict-rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes xtw-title-shimmer {
  from {
    background-position: 0% center;
  }
  to {
    background-position: 200% center;
  }
}

@keyframes xtw-text-breathe {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

@keyframes xtw-char-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

@keyframes xtw-game-glow {
  0%,
  100% {
    box-shadow:
      0 0 20px rgba(240, 199, 106, 0.28),
      0 0 40px rgba(157, 78, 221, 0.14),
      inset 0 0 24px rgba(240, 199, 106, 0.08);
  }
  50% {
    box-shadow:
      0 0 28px rgba(240, 199, 106, 0.45),
      0 0 50px rgba(157, 78, 221, 0.22),
      inset 0 0 28px rgba(240, 199, 106, 0.12);
  }
}

@keyframes xtw-game-switch {
  0% {
    opacity: 0.4;
    transform: scale(0.96);
    filter: blur(2px);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
}

@keyframes xtw-sigil-pulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 12px rgba(240, 199, 106, 0.35);
  }
  50% {
    transform: scale(1.08);
    box-shadow: 0 0 22px rgba(240, 199, 106, 0.55);
  }
}

@keyframes xtw-banner-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes xtw-float-rise {
  0% {
    opacity: 0;
    transform: translateY(0) scale(0.8);
  }
  10% {
    opacity: 0.75;
  }
  100% {
    opacity: 0;
    transform: translateY(-120vh) scale(1.1) rotate(18deg);
  }
}

@keyframes xtw-corner-glow {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(1);
  }
  50% {
    opacity: 0.85;
    transform: scale(1.08);
  }
}

@keyframes xtw-ink-flow {
  from {
    transform: translate3d(-2%, 0, 0) scale(1);
  }
  to {
    transform: translate3d(2%, -1%, 0) scale(1.04);
  }
}

@keyframes xtw-qiu-aura-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes xtw-qiu-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

@media (max-width: 360px) {
  .xtw-predict__bagua-wrap {
    width: 190px;
    height: 190px;
  }
  .xtw-predict__ball {
    width: 40px;
    height: 40px;
    font-size: 14px;
  }
}
