:root {
  color-scheme: dark;
  --bg: #0a0a0a;
  --gold: #ffd700;
  --gold-soft: rgba(255, 215, 0, 0.16);
  --red: #ff0044;
  --blue: #00d4ff;
  --deep-blue: #0077ff;
  --magenta: #ff00aa;
  --violet: #aa00ff;
  --glass: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 215, 0, 0.18);
  --font-display: "Orbitron", "Noto Sans SC", sans-serif;
  --font-body: "Noto Sans SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background:
    radial-gradient(circle at top, rgba(255, 0, 170, 0.09), transparent 24%),
    radial-gradient(circle at 80% 15%, rgba(0, 212, 255, 0.14), transparent 20%),
    linear-gradient(180deg, #040404 0%, #0a0a0a 45%, #050505 100%);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 215, 0, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 215, 0, 0.045) 1px, transparent 1px);
  background-size: 88px 88px;
  mask-image: radial-gradient(circle at center, black 32%, transparent 90%);
  opacity: 0.36;
}

.font-orbitron {
  font-family: var(--font-display);
}

.glass-card,
.result-panel,
.glass-subtle {
  border: 1px solid rgba(255, 215, 0, 0.1);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.035));
  backdrop-filter: blur(26px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 30px 80px rgba(0, 0, 0, 0.45);
  border-radius: 2rem;
}

.glass-subtle {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.025));
}

.panel-kicker {
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: rgba(255, 215, 0, 0.72);
}

.hero-title,
.cta-primary,
.logo-chip,
.wallet-btn,
.cyber-coin,
.result-panel h4 {
  text-shadow: 0 0 14px rgba(255, 215, 0, 0.2);
}

.hero-title {
  animation: titlePulse 4s ease-in-out infinite;
}

.cta-primary {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 215, 0, 0.48);
  background: linear-gradient(135deg, #ffd700 0%, #fff06f 35%, #ff8f00 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12) inset,
    0 0 28px rgba(255, 0, 68, 0.16),
    0 18px 40px rgba(255, 162, 0, 0.24);
}

.cta-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.6) 50%, transparent 100%);
  transform: translateX(-125%);
  animation: shine 3s linear infinite;
}

.cta-primary.large {
  min-width: min(100%, 22rem);
}

.field {
  display: grid;
  gap: 0.6rem;
}

.field span {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.68);
}

.input-shell {
  width: 100%;
  border-radius: 1.25rem;
  border: 1px solid rgba(255, 215, 0, 0.16);
  background: rgba(0, 0, 0, 0.38);
  color: white;
  padding: 1rem 1.1rem;
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.input-shell:focus {
  border-color: rgba(0, 212, 255, 0.48);
  box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.2), 0 0 22px rgba(0, 212, 255, 0.12);
}

.logo-chip {
  background: rgba(255, 255, 255, 0.035);
}

.logo-chip:hover .brand-logo-wrap {
  transform: rotate(6deg) scale(1.06);
  box-shadow: 0 0 24px rgba(255, 0, 68, 0.25);
}

.brand-logo-wrap {
  width: 2.9rem;
  height: 2.9rem;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 215, 0, 0.45);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 0 20px rgba(255, 215, 0, 0.12);
  transition: 0.35s ease;
  flex: 0 0 auto;
}

.brand-logo-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.coin-logo,
.cyber-coin {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
}

.coin-logo {
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid rgba(255, 215, 0, 0.45);
  background: radial-gradient(circle at 30% 30%, rgba(255, 215, 0, 0.55), rgba(255, 215, 0, 0.06) 40%, rgba(255, 0, 68, 0.24) 100%);
  transition: 0.35s ease;
}

.coin-core {
  width: 0.82rem;
  height: 0.82rem;
  border: 1px solid rgba(255, 215, 0, 0.7);
  border-radius: 0.2rem;
  transform: rotate(45deg);
}

.coin-line {
  position: absolute;
  width: 110%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.8), transparent);
}

.line-b {
  transform: rotate(90deg);
}

.rotating-hex {
  perspective: 1200px;
}

.giant-hexagram {
  width: min(82vw, 58rem);
  display: grid;
  gap: clamp(1rem, 2vw, 1.45rem);
  padding: 4rem 3rem;
  opacity: 0.2;
  filter: drop-shadow(0 0 22px rgba(255, 215, 0, 0.16));
  animation: spin 38s linear infinite;
  transform-origin: center;
}

.hex-line-bg {
  position: relative;
  height: clamp(0.9rem, 1.8vw, 1.15rem);
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.1), rgba(255, 215, 0, 0.65), rgba(255, 215, 0, 0.1));
  box-shadow:
    0 0 14px rgba(255, 215, 0, 0.16),
    0 0 38px rgba(255, 215, 0, 0.08);
}

.hex-line-bg.split {
  background: transparent;
  box-shadow: none;
}

.hex-line-bg.split::before,
.hex-line-bg.split::after {
  content: "";
  position: absolute;
  top: 0;
  width: calc(50% - 1.2rem);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.1), rgba(255, 215, 0, 0.65), rgba(255, 215, 0, 0.1));
  box-shadow:
    0 0 14px rgba(255, 215, 0, 0.16),
    0 0 38px rgba(255, 215, 0, 0.08);
}

.hex-line-bg.split::before {
  left: 0;
}

.hex-line-bg.split::after {
  right: 0;
}

.hero-stage {
  min-height: 38rem;
}

.coin-swarm,
.coin-tray,
.overlay-coins {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.cyber-coin {
  width: 7rem;
  height: 7rem;
  border: 1px solid rgba(255, 215, 0, 0.45);
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.22), transparent 22%),
    radial-gradient(circle at 50% 50%, rgba(255, 215, 0, 0.24), rgba(255, 0, 68, 0.1) 58%, rgba(0, 0, 0, 0.88) 100%);
  box-shadow:
    0 0 0 1px rgba(255, 215, 0, 0.08) inset,
    0 0 24px rgba(255, 215, 0, 0.18),
    0 0 55px rgba(255, 0, 170, 0.12);
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  transform-style: preserve-3d;
}

.cyber-coin::before,
.cyber-coin::after {
  content: "";
  position: absolute;
  border-radius: inherit;
  inset: 0.55rem;
  border: 1px solid rgba(0, 212, 255, 0.28);
}

.cyber-coin::after {
  inset: 1.3rem;
  border-style: dashed;
  border-color: rgba(255, 0, 68, 0.3);
}

.coin-one {
  animation: floatA 5.3s ease-in-out infinite;
}

.coin-two {
  animation: floatB 6s ease-in-out infinite;
}

.coin-three {
  animation: floatC 5.6s ease-in-out infinite;
}

.coin-stage {
  width: 100%;
  border-radius: 2rem;
  border: 1px solid rgba(255, 215, 0, 0.12);
  background:
    radial-gradient(circle at top, rgba(0, 212, 255, 0.14), transparent 38%),
    rgba(255, 255, 255, 0.03);
  padding: 2rem 1rem;
  transition:
    transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.55s ease,
    border-color 0.4s ease;
}

.stage-coin {
  width: 5.2rem;
  height: 5.2rem;
}

.rolling .stage-coin,
.cast-overlay.active .overlay-coin {
  animation: flipCoin 0.55s linear infinite;
}

.rolling {
  transform: scale(1.015) translateY(-4px);
  box-shadow:
    0 0 0 1px rgba(255, 215, 0, 0.16) inset,
    0 0 38px rgba(255, 0, 170, 0.12),
    0 26px 55px rgba(0, 0, 0, 0.34);
  border-color: rgba(255, 215, 0, 0.25);
}

.coin-stage.impact {
  animation: stageImpact 0.72s cubic-bezier(0.22, 1, 0.36, 1);
}

.line-progress {
  margin-top: 1.2rem;
  text-align: center;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.7);
}

.cast-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at center, rgba(255, 215, 0, 0.06), transparent 28%),
    rgba(0, 0, 0, 0.86);
  backdrop-filter: blur(18px);
  overflow: hidden;
}

.cast-overlay.hidden {
  display: none;
}

.overlay-inner {
  display: grid;
  gap: 2rem;
  justify-items: center;
  padding: 2rem;
  position: relative;
  z-index: 2;
}

.overlay-text {
  text-align: center;
}

.impact-ring,
.impact-flash,
.impact-shock {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
}

.impact-ring {
  width: 12rem;
  height: 12rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 215, 0, 0.28);
  box-shadow:
    0 0 30px rgba(255, 215, 0, 0.18),
    inset 0 0 18px rgba(0, 212, 255, 0.12);
}

.impact-ring-b {
  border-color: rgba(255, 0, 68, 0.3);
}

.impact-flash {
  width: 30rem;
  height: 30rem;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255,255,255,0.6) 0%, rgba(255,215,0,0.24) 26%, rgba(255,0,68,0.12) 42%, transparent 72%);
  filter: blur(10px);
}

.impact-shock {
  width: 100vw;
  height: 100vh;
  background:
    radial-gradient(circle at center, rgba(255,255,255,0.16), transparent 16%),
    radial-gradient(circle at center, rgba(255,0,170,0.1), transparent 24%);
}

.cast-overlay.impact .impact-ring-a {
  animation: impactRing 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.cast-overlay.impact .impact-ring-b {
  animation: impactRing 1.05s cubic-bezier(0.22, 1, 0.36, 1) 0.06s;
}

.cast-overlay.impact .impact-flash {
  animation: impactFlash 0.46s ease-out;
}

.cast-overlay.impact .impact-shock {
  animation: shockFade 0.72s ease-out;
}

.cast-overlay.impact .overlay-inner {
  animation: impactLift 0.85s cubic-bezier(0.22, 1, 0.36, 1);
}

.result-shell {
  opacity: 0;
  transform: translateY(42px) scale(0.985);
  filter: blur(10px);
}

.result-shell.is-visible {
  animation: resultReveal 0.95s cubic-bezier(0.2, 0.9, 0.2, 1) forwards;
}

.result-shell > * {
  opacity: 0;
  transform: translateY(18px);
}

.result-shell.is-visible > *:nth-child(1) {
  animation: sectionFadeUp 0.55s ease forwards 0.08s;
}

.result-shell.is-visible > *:nth-child(2) {
  animation: sectionFadeUp 0.55s ease forwards 0.18s;
}

.result-shell.is-visible > *:nth-child(3) {
  animation: sectionFadeUp 0.55s ease forwards 0.28s;
}

.result-shell.is-visible > *:nth-child(4) {
  animation: sectionFadeUp 0.55s ease forwards 0.38s;
}

.result-panel {
  padding: 1.5rem;
}

.hexagram-stage svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.hexagram-card {
  position: relative;
  overflow: hidden;
  border-radius: 1.8rem;
  border: 1px solid rgba(255, 215, 0, 0.12);
  background:
    radial-gradient(circle at top, rgba(255, 215, 0, 0.08), transparent 32%),
    radial-gradient(circle at bottom right, rgba(0, 212, 255, 0.09), transparent 30%),
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  padding: 1rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 18px 42px rgba(0, 0, 0, 0.28);
}

.hexagram-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 215, 0, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 215, 0, 0.03) 1px, transparent 1px);
  background-size: 34px 34px;
  opacity: 0.45;
  pointer-events: none;
}

.changed-card {
  border-color: rgba(255, 0, 170, 0.14);
  background:
    radial-gradient(circle at top, rgba(255, 0, 170, 0.1), transparent 32%),
    radial-gradient(circle at bottom right, rgba(170, 0, 255, 0.12), transparent 30%),
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
}

.hexagram-card-head,
.hexagram-card-foot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.hexagram-card-foot {
  margin-top: 0.7rem;
}

.hexagram-label,
.hexagram-meta,
.hexagram-chip {
  border-radius: 999px;
  border: 1px solid rgba(255, 215, 0, 0.14);
  background: rgba(0, 0, 0, 0.26);
  padding: 0.45rem 0.8rem;
  font-size: 0.74rem;
}

.hexagram-label {
  color: rgba(255, 255, 255, 0.78);
}

.hexagram-meta {
  color: var(--gold);
  font-family: var(--font-display);
  letter-spacing: 0.08em;
}

.hexagram-chip {
  color: rgba(255, 255, 255, 0.66);
}

.hexagram-chip.alt {
  border-color: rgba(0, 212, 255, 0.16);
  color: rgba(0, 212, 255, 0.92);
}

.hexagram-chip.changed {
  border-color: rgba(255, 0, 170, 0.18);
  color: rgba(255, 0, 170, 0.92);
}

.hexagram-chip.danger {
  border-color: rgba(255, 0, 68, 0.18);
  color: rgba(255, 121, 154, 0.95);
}

.hexagram-stage {
  position: relative;
  z-index: 1;
  margin-top: 1rem;
  border-radius: 1.4rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background:
    radial-gradient(circle at center, rgba(255,255,255,0.04), transparent 52%),
    linear-gradient(180deg, rgba(0,0,0,0.22), rgba(0,0,0,0.3));
  padding: 0.85rem;
}

.moving-card,
.history-item,
.relative-bar,
.tag-chip {
  border-radius: 1.4rem;
  border: 1px solid rgba(255, 215, 0, 0.12);
  background: rgba(255, 255, 255, 0.035);
}

.moving-card {
  padding: 1rem 1.1rem;
}

.history-item {
  padding: 1.2rem;
}

.history-item button {
  border-radius: 999px;
  border: 1px solid rgba(255, 215, 0, 0.18);
  background: rgba(255, 215, 0, 0.07);
  color: var(--gold);
  padding: 0.55rem 0.9rem;
}

.line-clamp {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.relative-bar {
  padding: 0.8rem 0.95rem;
}

.bar-track {
  margin-top: 0.6rem;
  height: 0.6rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--gold), var(--red));
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.2);
}

.tag-chip {
  padding: 0.75rem 1rem;
  color: rgba(255, 255, 255, 0.8);
}

.ca-card {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 18px 40px rgba(0, 0, 0, 0.2);
}

.ca-address {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 999px;
  border: 1px solid rgba(255, 215, 0, 0.12);
  background: rgba(255, 255, 255, 0.04);
  padding: 0.8rem 1rem;
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.82);
}

.dev-panel {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 1.2rem;
}

.dev-hotspot {
  position: fixed;
  top: 0.35rem;
  left: 0.35rem;
  z-index: 60;
  width: 1rem;
  height: 1rem;
  border: 0;
  background: transparent;
  opacity: 0;
}

.dev-panel.hidden {
  display: none;
}

.dev-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(16px);
}

.dev-modal {
  position: relative;
  z-index: 1;
  width: min(100%, 40rem);
  border-radius: 2rem;
  border: 1px solid rgba(255, 215, 0, 0.14);
  background:
    radial-gradient(circle at top, rgba(255, 215, 0, 0.08), transparent 35%),
    linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
  backdrop-filter: blur(24px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.05),
    0 30px 80px rgba(0, 0, 0, 0.45);
  padding: 1.5rem;
}

.wallet-btn,
.tag-chip {
  backdrop-filter: blur(10px);
}

.scanlines {
  background: repeating-linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.02) 0,
    rgba(255, 255, 255, 0.02) 1px,
    transparent 1px,
    transparent 4px
  );
  opacity: 0.17;
  mix-blend-mode: screen;
}

.watermark-layer::before,
.watermark-layer::after {
  content: "天机泄露";
  position: absolute;
  font-size: clamp(2rem, 6vw, 6rem);
  font-weight: 900;
  color: rgba(255, 255, 255, 0.03);
  letter-spacing: 0.35em;
  writing-mode: vertical-rl;
  animation: watermarkFlash 9s ease-in-out infinite;
}

.watermark-layer::before {
  right: 3vw;
  top: 12vh;
}

.watermark-layer::after {
  left: 2vw;
  bottom: 6vh;
  animation-delay: 4s;
}

.result-panel .flash {
  animation: redFlash 1.4s ease-in-out infinite;
}

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

@keyframes floatA {
  0%, 100% { transform: translateY(0) rotateX(16deg); }
  50% { transform: translateY(-14px) rotateX(16deg) rotateY(10deg); }
}

@keyframes floatB {
  0%, 100% { transform: translateY(-6px) rotateY(-10deg); }
  50% { transform: translateY(16px) rotateY(16deg); }
}

@keyframes floatC {
  0%, 100% { transform: translateY(0) rotateZ(-6deg); }
  50% { transform: translateY(-18px) rotateZ(6deg) rotateY(-12deg); }
}

@keyframes flipCoin {
  from { transform: rotateY(0) rotateX(0); }
  to { transform: rotateY(360deg) rotateX(720deg); }
}

@keyframes titlePulse {
  0%, 100% { text-shadow: 0 0 10px rgba(255, 215, 0, 0.15), 0 0 25px rgba(255, 0, 68, 0.08); }
  50% { text-shadow: 0 0 16px rgba(255, 215, 0, 0.3), 0 0 42px rgba(255, 0, 68, 0.18); }
}

@keyframes redFlash {
  0%, 100% { box-shadow: 0 0 0 rgba(255, 0, 68, 0); }
  50% { box-shadow: 0 0 28px rgba(255, 0, 68, 0.22); }
}

@keyframes shine {
  to { transform: translateX(120%); }
}

@keyframes watermarkFlash {
  0%, 90%, 100% { opacity: 0.15; filter: blur(0); }
  94% { opacity: 0.28; filter: blur(1px); }
}

@keyframes stageImpact {
  0% { transform: scale(1.015) translateY(-4px); }
  20% { transform: scale(0.965) translateY(8px); }
  45% { transform: scale(1.02) translateY(-2px); }
  100% { transform: scale(1) translateY(0); }
}

@keyframes impactRing {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.35); }
  18% { opacity: 0.85; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(4.4); }
}

@keyframes impactFlash {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
  30% { opacity: 0.95; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.8); }
}

@keyframes shockFade {
  0% { opacity: 0; }
  28% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes impactLift {
  0% { transform: translateY(0) scale(1); }
  30% { transform: translateY(18px) scale(0.98); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes resultReveal {
  0% {
    opacity: 0;
    transform: translateY(42px) scale(0.985);
    filter: blur(10px);
  }
  60% {
    opacity: 1;
    transform: translateY(-6px) scale(1.005);
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes sectionFadeUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .hero-stage {
    min-height: 30rem;
  }

  .cyber-coin {
    width: 5.2rem;
    height: 5.2rem;
    font-size: 1rem;
  }

  .overlay-inner {
    padding: 1.25rem;
  }
}
