:root {
  color-scheme: dark;
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: #f0f2f3;
  background: #090e12;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100dvh;
  background:
    radial-gradient(circle at 50% 42%, rgba(228, 182, 110, 0.045), transparent 30%),
    #090e12;
}

button {
  font: inherit;
}

.demo-shell {
  width: min(100% - 40px, 780px);
  margin: 0 auto;
  padding: 52px 0 40px;
}

.demo-heading {
  max-width: 560px;
}

.demo-brand {
  margin: 0 0 12px;
  color: #e4b66e;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.28em;
}

.demo-heading h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.12;
  letter-spacing: -0.035em;
}

.demo-heading > p:last-child {
  margin: 14px 0 0;
  color: #98a1a8;
  font-size: 15px;
  line-height: 1.7;
}

.demo-stage {
  display: grid;
  place-items: center;
  min-height: 470px;
  margin-top: 30px;
  overflow: hidden;
  border-top: 1px solid rgba(228, 182, 110, 0.16);
  border-bottom: 1px solid rgba(228, 182, 110, 0.1);
  background:
    radial-gradient(circle at 50% 56%, rgba(228, 182, 110, 0.055), transparent 24%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.008), transparent 32%);
}

.demo-controls {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-top: 24px;
}

#playAnimation {
  min-width: 148px;
  min-height: 48px;
  padding: 0 26px;
  border: 1px solid #e4b66e;
  border-radius: 10px;
  color: #20170d;
  background: #e4b66e;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, background-color 180ms ease, opacity 180ms ease;
}

#playAnimation:hover:not(:disabled) {
  background: #f2c67f;
}

#playAnimation:active:not(:disabled) {
  transform: scale(0.98);
}

#playAnimation:focus-visible {
  outline: 2px solid #f2c67f;
  outline-offset: 4px;
}

#playAnimation:disabled {
  color: #a8a095;
  border-color: rgba(228, 182, 110, 0.24);
  background: rgba(228, 182, 110, 0.09);
  box-shadow: none;
  cursor: not-allowed;
}

#animationStatus {
  margin: 0;
  color: #7f8991;
  font-size: 13px;
}

blind-box-animation {
  display: block;
  width: 100%;
}

.xba-root {
  --xba-duration: 2000ms;
  --xba-lid-lift: 82px;
  --xba-glow-intensity: 0.92;
  position: relative;
  width: 100%;
  isolation: isolate;
}

.xba-scene {
  position: relative;
  width: min(100%, 620px);
  height: 430px;
  margin: 0 auto;
  overflow: hidden;
  perspective: 760px;
  contain: layout paint style;
}

.xba-scene::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 54px;
  width: 250px;
  height: 54px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(228, 182, 110, 0.14), rgba(6, 10, 13, 0) 70%);
  filter: blur(8px);
  opacity: 0.55;
  transform: translateX(-50%);
}

.xba-ambient-glow,
.xba-core-light,
.xba-burst-ring {
  position: absolute;
  left: 50%;
  border-radius: 50%;
  pointer-events: none;
}

.xba-ambient-glow {
  top: 52%;
  width: 270px;
  height: 270px;
  background: radial-gradient(circle, rgba(228, 182, 110, 0.1), rgba(228, 182, 110, 0.025) 40%, transparent 70%);
  filter: blur(7px);
  opacity: 0.48;
  transform: translate(-50%, -50%);
}

.xba-core-light {
  z-index: 2;
  top: 52%;
  width: 178px;
  height: 178px;
  background: radial-gradient(circle, rgba(255, 234, 185, 0.92), rgba(235, 184, 95, 0.4) 33%, transparent 71%);
  filter: blur(9px) opacity(var(--xba-glow-intensity));
  opacity: 0.06;
  transform: translate(-50%, -58%) scale(0.56);
}

.xba-burst-ring {
  z-index: 3;
  top: 48%;
  width: 104px;
  height: 104px;
  border: 1px solid rgba(246, 207, 132, 0.7);
  box-shadow: inset 0 0 24px rgba(228, 182, 110, 0.18), 0 0 20px rgba(228, 182, 110, 0.2);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.4);
}

.xba-beams,
.xba-particles,
.xba-elements,
.xba-return-particles,
.xba-ambient-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.xba-beams {
  z-index: 1;
}

.xba-beam {
  position: absolute;
  left: calc(50% - 26px);
  bottom: 192px;
  width: 52px;
  height: 220px;
  background: linear-gradient(to top, rgba(248, 218, 155, 0.45), rgba(228, 182, 110, 0.13) 52%, transparent 96%);
  filter: blur(4px);
  opacity: 0;
  transform: rotate(var(--beam-angle)) scaleY(0.12);
  transform-origin: 50% 100%;
  will-change: transform, opacity;
}

.xba-beam:nth-child(2),
.xba-beam:nth-child(4) {
  width: 34px;
  filter: blur(3px);
}

.xba-box-cluster {
  position: absolute;
  z-index: 6;
  top: 54%;
  left: 50%;
  width: 160px;
  height: 164px;
  transform: translate(-50%, -50%);
  transform-style: preserve-3d;
  will-change: transform;
}

.xba-lid {
  position: absolute;
  z-index: 5;
  top: 0;
  left: 5px;
  width: 150px;
  height: 35px;
  border: 1px solid rgba(228, 182, 110, 0.86);
  border-radius: 8px 8px 5px 5px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent 42%),
    linear-gradient(135deg, #171a1a, #0b1013 72%);
  box-shadow:
    inset 0 1px 0 rgba(255, 241, 208, 0.08),
    0 7px 18px rgba(2, 5, 7, 0.46);
  transform-origin: 50% 100%;
  will-change: transform;
}

.xba-lid::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: 6px;
  left: 12px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(242, 198, 127, 0.65), transparent);
  opacity: 0.48;
}

.xba-seam-light {
  position: absolute;
  z-index: 4;
  top: 34px;
  left: 13px;
  width: 134px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #f7d99c 16%, #fff1c8 50%, #f7d99c 84%, transparent);
  box-shadow: 0 0 8px rgba(242, 198, 127, 0.7), 0 0 18px rgba(228, 182, 110, 0.35);
  opacity: 0.08;
}

.xba-box-body {
  position: absolute;
  z-index: 4;
  top: 36px;
  left: 12px;
  display: grid;
  width: 136px;
  height: 118px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(228, 182, 110, 0.8);
  border-radius: 7px 7px 10px 10px;
  background:
    linear-gradient(125deg, rgba(255, 255, 255, 0.045), transparent 34%),
    linear-gradient(155deg, #171b1c, #0b1013 62%, #080c0f);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    inset 0 -24px 42px rgba(2, 5, 7, 0.28),
    0 18px 36px rgba(2, 5, 7, 0.42);
}

.xba-box-body::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(228, 182, 110, 0.1);
  border-radius: 5px 5px 7px 7px;
}

.xba-x-mark {
  position: relative;
  color: #e4b66e;
  font-size: 43px;
  font-weight: 300;
  line-height: 1;
  text-shadow: 0 0 13px rgba(228, 182, 110, 0.16);
}

.xba-ambient-particle,
.xba-burst-particle,
.xba-return-particle {
  position: absolute;
  left: 50%;
  top: 53%;
  width: var(--particle-size, 3px);
  height: var(--particle-size, 3px);
  border-radius: 50%;
  background: #efd095;
  box-shadow: 0 0 6px rgba(228, 182, 110, 0.58);
  pointer-events: none;
}

.xba-ambient-particle {
  left: var(--ambient-x);
  top: var(--ambient-y);
  opacity: var(--ambient-opacity);
  transform: translate3d(0, 0, 0);
}

.xba-particles {
  z-index: 8;
}

.xba-burst-particle {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.4);
  will-change: transform, opacity;
}

.xba-return-particles {
  z-index: 7;
}

.xba-return-particle {
  left: calc(50% + var(--return-x));
  top: calc(53% + var(--return-y));
  opacity: 0;
  will-change: transform, opacity;
}

.xba-elements {
  z-index: 9;
}

.xba-design-element {
  position: absolute;
  left: 50%;
  top: 52%;
  width: 1px;
  height: 1px;
  color: #e8bd77;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.25);
  transform-origin: center;
  will-change: transform, opacity;
}

.xba-glyph {
  position: absolute;
  display: block;
  transform: translate(-50%, -50%) scale(var(--glyph-scale));
}

.xba-flower .xba-glyph {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f4d59a;
  box-shadow: 0 0 6px rgba(228, 182, 110, 0.35);
}

.xba-flower .xba-glyph::before,
.xba-flower .xba-glyph::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9px;
  height: 16px;
  border: 1px solid currentColor;
  border-radius: 58% 58% 46% 46%;
  background: rgba(228, 182, 110, 0.08);
  transform-origin: 50% 50%;
}

.xba-flower .xba-glyph::before {
  transform: translate(-50%, -50%) rotate(90deg);
  box-shadow: 0 0 7px rgba(228, 182, 110, 0.12);
}

.xba-flower .xba-glyph::after {
  transform: translate(-50%, -50%);
}

.xba-leaf .xba-glyph {
  width: 27px;
  height: 13px;
  border: 1px solid currentColor;
  border-radius: 100% 0 100% 0;
  background: linear-gradient(145deg, rgba(239, 208, 149, 0.18), transparent 64%);
}

.xba-leaf .xba-glyph::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 3px;
  width: 21px;
  height: 1px;
  background: rgba(242, 205, 137, 0.68);
  transform: rotate(-22deg);
}

.xba-petal .xba-glyph {
  width: 17px;
  height: 25px;
  border: 1px solid currentColor;
  border-radius: 74% 26% 68% 32%;
  background: radial-gradient(circle at 36% 30%, rgba(255, 239, 202, 0.25), rgba(228, 182, 110, 0.07) 58%, transparent);
  transform: translate(-50%, -50%) rotate(24deg) scale(var(--glyph-scale));
}

.xba-butterfly .xba-glyph {
  width: 3px;
  height: 20px;
  border-radius: 50%;
  background: #edc886;
}

.xba-butterfly .xba-glyph::before,
.xba-butterfly .xba-glyph::after {
  content: "";
  position: absolute;
  top: 1px;
  width: 15px;
  height: 19px;
  border: 1px solid currentColor;
  background: rgba(228, 182, 110, 0.09);
}

.xba-butterfly .xba-glyph::before {
  right: 2px;
  border-radius: 88% 28% 68% 38%;
  transform: rotate(-20deg);
}

.xba-butterfly .xba-glyph::after {
  left: 2px;
  border-radius: 28% 88% 38% 68%;
  transform: rotate(20deg);
}

.xba-branch .xba-glyph {
  width: 1px;
  height: 39px;
  background: currentColor;
  transform: translate(-50%, -50%) rotate(33deg) scale(var(--glyph-scale));
  transform-origin: 50% 80%;
}

.xba-branch .xba-glyph::before,
.xba-branch .xba-glyph::after {
  content: "";
  position: absolute;
  width: 13px;
  height: 7px;
  border: 1px solid currentColor;
  border-radius: 100% 0 100% 0;
  background: rgba(228, 182, 110, 0.06);
}

.xba-branch .xba-glyph::before {
  top: 7px;
  left: -12px;
  transform: rotate(16deg);
}

.xba-branch .xba-glyph::after {
  top: 20px;
  left: 0;
  transform: rotate(196deg);
}

.xba-motif .xba-glyph {
  width: 25px;
  height: 25px;
  border: 1px solid currentColor;
  transform: translate(-50%, -50%) rotate(45deg) scale(var(--glyph-scale));
}

.xba-motif .xba-glyph::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(242, 205, 137, 0.62);
  border-radius: 50%;
}

.xba-card .xba-glyph {
  width: 29px;
  height: 36px;
  overflow: hidden;
  border: 1px solid currentColor;
  border-radius: 4px;
  background: linear-gradient(145deg, rgba(228, 182, 110, 0.17), rgba(10, 15, 18, 0.3));
}

.xba-card .xba-glyph::before,
.xba-card .xba-glyph::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  height: 1px;
  background: rgba(242, 205, 137, 0.68);
  box-shadow: 0 5px 0 rgba(242, 205, 137, 0.34);
}

.xba-card .xba-glyph::before {
  top: 10px;
}

.xba-card .xba-glyph::after {
  top: 25px;
  right: 12px;
}

.xba-root.is-playing .xba-box-cluster {
  animation: xba-box-float var(--xba-duration) cubic-bezier(0.16, 1, 0.3, 1) both;
}

.xba-root.is-playing .xba-lid {
  animation: xba-lid-open var(--xba-duration) cubic-bezier(0.16, 1, 0.3, 1) both;
}

.xba-root.is-playing .xba-seam-light {
  animation: xba-seam-awake var(--xba-duration) ease-in-out both;
}

.xba-root.is-playing .xba-core-light {
  animation: xba-core-glow var(--xba-duration) ease-in-out both;
}

.xba-root.is-playing .xba-ambient-glow {
  animation: xba-ambient-breathe var(--xba-duration) ease-in-out both;
}

.xba-root.is-playing .xba-burst-ring {
  animation: xba-ring-release var(--xba-duration) ease-out both;
}

.xba-root.is-playing .xba-beam {
  animation: xba-beam-rise var(--xba-duration) ease-in-out both;
}

.xba-root.is-playing .xba-burst-particle {
  animation: xba-particle-flight var(--xba-duration) cubic-bezier(0.2, 0.75, 0.22, 1) both;
}

.xba-root.is-playing .xba-return-particle {
  animation: xba-energy-return var(--xba-duration) ease-in-out both;
}

.xba-root.is-playing .xba-ambient-particle {
  animation: xba-ambient-drift var(--xba-duration) ease-in-out both;
}

.xba-root.is-playing .xba-design-element {
  animation: xba-element-flight var(--xba-duration) cubic-bezier(0.18, 0.72, 0.22, 1) both;
}

@keyframes xba-box-float {
  0%, 10%, 100% { transform: translate(-50%, -50%) scale(1); }
  20% { transform: translate(-50%, calc(-50% - 5px)) scale(1.012); }
  35% { transform: translate(-50%, calc(-50% - 7px)) scale(1.015); }
  50% { transform: translate(-50%, calc(-50% - 4px)) scale(1.01); }
  65% { transform: translate(-50%, calc(-50% - 2px)) scale(1.006); }
  80%, 95% { transform: translate(-50%, -50%) scale(1); }
}

@keyframes xba-lid-open {
  0%, 20%, 100% { transform: translateY(0) rotateX(0) rotateZ(0); }
  35% { transform: translateY(calc(-1 * var(--xba-lid-lift))) rotateX(-24deg) rotateZ(-1.2deg); }
  50%, 65%, 80% { transform: translateY(calc(-1 * var(--xba-lid-lift))) rotateX(-21deg) rotateZ(-1deg); }
  95% { transform: translateY(-3px) rotateX(-2deg) rotateZ(0); }
}

@keyframes xba-seam-awake {
  0%, 10%, 100% { opacity: 0.08; }
  20% { opacity: 0.72; }
  35%, 65% { opacity: 1; }
  80% { opacity: 0.56; }
  95% { opacity: 0.12; }
}

@keyframes xba-core-glow {
  0%, 10%, 100% { opacity: 0.06; transform: translate(-50%, -58%) scale(0.56); }
  20% { opacity: 0.2; transform: translate(-50%, -59%) scale(0.66); }
  35% { opacity: 0.62; transform: translate(-50%, -62%) scale(0.88); }
  50% { opacity: 1; transform: translate(-50%, -68%) scale(1.28); }
  65% { opacity: 0.82; transform: translate(-50%, -70%) scale(1.18); }
  80% { opacity: 0.44; transform: translate(-50%, -64%) scale(0.88); }
  95% { opacity: 0.1; transform: translate(-50%, -58%) scale(0.6); }
}

@keyframes xba-ambient-breathe {
  0%, 10%, 100% { opacity: 0.48; transform: translate(-50%, -50%) scale(1); }
  20% { opacity: 0.58; transform: translate(-50%, -50%) scale(1.03); }
  50% { opacity: 0.92; transform: translate(-50%, -50%) scale(1.24); }
  80% { opacity: 0.58; transform: translate(-50%, -50%) scale(1.08); }
  95% { opacity: 0.42; transform: translate(-50%, -50%) scale(1); }
}

@keyframes xba-ring-release {
  0%, 35% { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
  42% { opacity: 0.62; }
  58% { opacity: 0; transform: translate(-50%, -50%) scale(2.2); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(2.2); }
}

@keyframes xba-beam-rise {
  0%, 35%, 100% { opacity: 0; transform: rotate(var(--beam-angle)) scaleY(0.12); }
  50% { opacity: 0.78; transform: rotate(var(--beam-angle)) scaleY(1); }
  65% { opacity: 0.68; transform: rotate(var(--beam-angle)) scaleY(0.92); }
  80% { opacity: 0.36; transform: rotate(var(--beam-angle)) scaleY(0.76); }
  95% { opacity: 0; transform: rotate(var(--beam-angle)) scaleY(0.24); }
}

@keyframes xba-particle-flight {
  0%, 35% { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
  39% { opacity: 0.96; }
  50% { opacity: 0.92; transform: translate(calc(-50% + var(--particle-x1)), calc(-50% + var(--particle-y1))) scale(1); }
  65% { opacity: 0.76; transform: translate(calc(-50% + var(--particle-x2)), calc(-50% + var(--particle-y2))) scale(0.88); }
  80% { opacity: 0.36; transform: translate(calc(-50% + var(--particle-x3)), calc(-50% + var(--particle-y3))) scale(0.72); }
  95%, 100% { opacity: 0; transform: translate(calc(-50% + var(--particle-x3)), calc(-50% + var(--particle-y3))) scale(0.4); }
}

@keyframes xba-element-flight {
  0%, 49% { opacity: 0; transform: translate(-50%, -50%) rotate(0) scale(0.22); }
  53% { opacity: 0.94; }
  65% { opacity: 1; transform: translate(calc(-50% + var(--element-x1)), calc(-50% + var(--element-y1))) rotate(var(--element-r1)) scale(1); }
  80% { opacity: 0.86; transform: translate(calc(-50% + var(--element-x2)), calc(-50% + var(--element-y2))) rotate(var(--element-r2)) scale(0.96); }
  92% { opacity: 0.18; transform: translate(calc(-50% + var(--element-x3)), calc(-50% + var(--element-y3))) rotate(var(--element-r3)) scale(0.82); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--element-x3)), calc(-50% + var(--element-y3))) rotate(var(--element-r3)) scale(0.72); }
}

@keyframes xba-energy-return {
  0%, 79% { opacity: 0; transform: translate(0, 0) scale(0.7); }
  82% { opacity: 0.72; }
  95% { opacity: 0.08; transform: translate(calc(-1 * var(--return-x)), calc(-1 * var(--return-y))) scale(0.3); }
  100% { opacity: 0; transform: translate(calc(-1 * var(--return-x)), calc(-1 * var(--return-y))) scale(0.2); }
}

@keyframes xba-ambient-drift {
  0% { opacity: var(--ambient-opacity); transform: translate3d(0, 0, 0); }
  10% { transform: translate3d(1px, -2px, 0); }
  20% { opacity: calc(var(--ambient-opacity) + 0.08); transform: translate3d(-1px, -4px, 0); }
  50% { opacity: calc(var(--ambient-opacity) + 0.12); transform: translate3d(2px, -7px, 0); }
  80% { opacity: var(--ambient-opacity); transform: translate3d(-1px, -3px, 0); }
  100% { opacity: var(--ambient-opacity); transform: translate3d(0, 0, 0); }
}

@media (max-width: 640px) {
  .demo-shell {
    width: min(100% - 28px, 780px);
    padding-top: 30px;
  }

  .demo-stage {
    min-height: 420px;
    margin-top: 24px;
  }

  .xba-scene {
    height: 400px;
    transform: scale(0.9);
  }

  .demo-controls {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  #playAnimation {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .xba-root.is-playing .xba-box-cluster,
  .xba-root.is-playing .xba-lid,
  .xba-root.is-playing .xba-seam-light,
  .xba-root.is-playing .xba-core-light,
  .xba-root.is-playing .xba-ambient-glow,
  .xba-root.is-playing .xba-burst-ring,
  .xba-root.is-playing .xba-beam,
  .xba-root.is-playing .xba-burst-particle,
  .xba-root.is-playing .xba-return-particle,
  .xba-root.is-playing .xba-ambient-particle,
  .xba-root.is-playing .xba-design-element {
    animation: none;
  }

  .xba-root.is-playing .xba-core-light {
    animation: xba-reduced-glow var(--xba-duration) ease-in-out both;
  }

  .xba-root.is-playing .xba-seam-light {
    animation: xba-reduced-seam var(--xba-duration) ease-in-out both;
  }
}

@keyframes xba-reduced-glow {
  0%, 100% { opacity: 0.06; transform: translate(-50%, -58%) scale(0.56); }
  50% { opacity: 0.58; transform: translate(-50%, -60%) scale(0.9); }
}

@keyframes xba-reduced-seam {
  0%, 100% { opacity: 0.08; }
  50% { opacity: 0.9; }
}
