:root {
  color-scheme: dark;
  --gold: #ffc957;
  --gold-hot: #fff1a8;
  --cyan: #00d5e9;
  --navy: #020611;
  --coin-size: clamp(240px, 48vmin, 510px);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--navy);
}

body {
  overscroll-behavior: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#particles {
  position: fixed;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
}

.stage {
  position: relative;
  z-index: 2;
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 100svh;
  place-items: center;
  isolation: isolate;
  perspective: 1200px;
  background:
    radial-gradient(circle at 50% 46%, rgba(0, 180, 205, .11), transparent 27%),
    radial-gradient(circle at 50% 50%, transparent 30%, rgba(0, 0, 0, .4) 78%),
    linear-gradient(135deg, rgba(0, 53, 80, .18), transparent 35% 65%, rgba(107, 60, 0, .1));
}

.vignette {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.012) 0 1px, transparent 1px 4px),
    radial-gradient(ellipse at center, transparent 42%, rgba(0, 0, 0, .72) 110%);
  mix-blend-mode: soft-light;
}

.aurora {
  position: absolute;
  width: 70vmax;
  height: 70vmax;
  border-radius: 50%;
  opacity: .17;
  filter: blur(80px);
  pointer-events: none;
  mix-blend-mode: screen;
}

.aurora--one {
  top: -52vmax;
  left: -20vmax;
  background: #00c9e7;
  animation: aurora-one 13s ease-in-out infinite alternate;
}

.aurora--two {
  right: -35vmax;
  bottom: -55vmax;
  background: #d88a12;
  animation: aurora-two 17s ease-in-out infinite alternate;
}

.orbit {
  position: absolute;
  z-index: 3;
  width: calc(var(--coin-size) * 1.42);
  aspect-ratio: 1;
  border: 1px solid rgba(74, 222, 236, .17);
  border-radius: 50%;
  pointer-events: none;
  transform-style: preserve-3d;
}

.orbit::before,
.orbit::after {
  position: absolute;
  inset: 8%;
  content: "";
  border: 1px dashed rgba(255, 199, 76, .16);
  border-radius: inherit;
}

.orbit::after {
  inset: -5%;
  border-style: solid;
  border-color: rgba(0, 216, 235, .07);
}

.orbit i {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 7px;
  margin: -3.5px;
  border-radius: 50%;
  background: var(--gold-hot);
  box-shadow: 0 0 8px #fff, 0 0 20px var(--gold), 0 0 40px var(--gold);
}

.orbit--outer {
  animation: orbit-spin 24s linear infinite;
}

.orbit--outer i:nth-child(1) { transform: rotate(18deg) translateX(calc(var(--coin-size) * .71)); }
.orbit--outer i:nth-child(2) { transform: rotate(153deg) translateX(calc(var(--coin-size) * .71)); }
.orbit--outer i:nth-child(3) { transform: rotate(274deg) translateX(calc(var(--coin-size) * .71)); }

.orbit--inner {
  width: calc(var(--coin-size) * 1.22);
  border-color: rgba(255, 197, 70, .15);
  transform: rotateX(67deg) rotateZ(8deg);
  animation: orbit-tilted 13s linear infinite reverse;
}

.orbit--inner::before,
.orbit--inner::after {
  display: none;
}

.orbit--inner i {
  width: 9px;
  height: 9px;
  background: #74f5ff;
  box-shadow: 0 0 10px #fff, 0 0 24px var(--cyan);
}

.orbit--inner i:nth-child(1) { transform: rotate(55deg) translateX(calc(var(--coin-size) * .61)); }
.orbit--inner i:nth-child(2) { transform: rotate(235deg) translateX(calc(var(--coin-size) * .61)); }

.coin-float {
  position: relative;
  z-index: 8;
  width: var(--coin-size);
  aspect-ratio: 1;
  animation: coin-float 5.2s ease-in-out infinite;
  transform-style: preserve-3d;
}

.coin-tilt {
  width: 100%;
  height: 100%;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transform-style: preserve-3d;
  transition: transform .18s ease-out;
  will-change: transform;
}

.coin {
  position: relative;
  width: 100%;
  height: 100%;
  cursor: pointer;
  border-radius: 50%;
  transform-style: preserve-3d;
  filter: drop-shadow(0 34px 30px rgba(0, 0, 0, .58));
}

.coin::before {
  position: absolute;
  inset: 1.6%;
  z-index: -2;
  content: "";
  border-radius: 50%;
  background: #9a5611;
  transform: translateZ(-16px) scale(1.015);
  box-shadow: 0 0 0 5px #4d2807, 0 0 32px rgba(255, 183, 55, .48);
}

.coin::after {
  position: absolute;
  inset: -3%;
  z-index: -3;
  content: "";
  border: 1px solid rgba(255, 215, 111, .42);
  border-radius: 50%;
  box-shadow: 0 0 25px rgba(255, 187, 63, .2), inset 0 0 25px rgba(255, 187, 63, .15);
  animation: breathe 2.8s ease-in-out infinite;
}

.coin img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  pointer-events: none;
  transform: translateZ(1px);
  backface-visibility: hidden;
}

.coin.is-bursting img {
  animation: logo-bloom .72s ease-out;
}

.coin__halo {
  position: absolute;
  inset: -12%;
  z-index: -4;
  border-radius: 50%;
  opacity: .65;
  background: conic-gradient(from 0deg, transparent, rgba(0, 230, 246, .48), transparent 22%, transparent 53%, rgba(255, 182, 45, .5), transparent 77%);
  filter: blur(18px);
  animation: halo-spin 8s linear infinite;
}

.coin__edge {
  position: absolute;
  inset: 0;
  z-index: 3;
  border: clamp(1px, .4vmin, 3px) solid rgba(255, 234, 170, .34);
  border-radius: 50%;
  pointer-events: none;
  box-shadow: inset 10px -8px 16px rgba(28, 9, 0, .35), inset -6px 6px 12px rgba(255,255,255,.16);
}

.coin__shine {
  position: absolute;
  inset: 0;
  z-index: 4;
  overflow: hidden;
  border-radius: 50%;
  pointer-events: none;
  background: linear-gradient(112deg, transparent 27%, rgba(255,255,255,.04) 38%, rgba(255,255,255,.55) 46%, rgba(255,225,137,.09) 54%, transparent 66%);
  background-size: 260% 100%;
  background-position: 160% 0;
  mix-blend-mode: screen;
  animation: shine 4.7s ease-in-out infinite;
}

.coin__glint {
  position: absolute;
  top: 8%;
  right: 15%;
  z-index: 5;
  width: 9%;
  aspect-ratio: 1;
  opacity: 0;
  background: radial-gradient(circle, #fff 0 5%, #ffe7a0 7% 12%, transparent 55%);
  filter: drop-shadow(0 0 8px #ffe494);
  pointer-events: none;
  animation: glint 4.7s ease-in-out infinite;
}

.floor {
  position: absolute;
  top: calc(50% + var(--coin-size) * .54);
  z-index: 2;
  width: calc(var(--coin-size) * .72);
  height: calc(var(--coin-size) * .13);
  border-radius: 50%;
  opacity: .72;
  background: radial-gradient(ellipse, rgba(0, 210, 228, .28), rgba(255, 176, 47, .09) 40%, transparent 72%);
  filter: blur(13px);
  animation: floor-pulse 5.2s ease-in-out infinite;
}

.flash {
  position: absolute;
  z-index: 30;
  width: 10px;
  height: 10px;
  border: 2px solid rgba(255, 231, 158, .95);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}

.flash.is-active {
  animation: flash .7s ease-out;
}

.spark {
  position: fixed;
  z-index: 9999;
  width: var(--spark-size, 180px);
  height: var(--spark-size, 180px);
  border: 1px solid rgba(255, 224, 138, .9);
  border-radius: 50%;
  background: url("logo.png") center / cover no-repeat;
  box-shadow:
    inset 0 0 5px rgba(255,255,255,.7),
    0 0 8px var(--spark-color, var(--gold));
  filter:
    drop-shadow(0 0 3px #fff)
    drop-shadow(0 0 9px var(--spark-color, var(--gold)));
  pointer-events: none;
  animation: spark var(--spark-time, 1.35s) cubic-bezier(.17,.67,.25,1) var(--spark-delay, 0s) forwards;
}

@keyframes coin-float {
  0%, 100% { transform: translateY(-7px) rotateZ(-.4deg); }
  50% { transform: translateY(10px) rotateZ(.4deg); }
}

@keyframes orbit-spin {
  to { transform: rotate(360deg); }
}

@keyframes orbit-tilted {
  from { transform: rotateX(67deg) rotateZ(8deg); }
  to { transform: rotateX(67deg) rotateZ(368deg); }
}

@keyframes halo-spin {
  to { transform: rotate(360deg); }
}

@keyframes breathe {
  0%, 100% { opacity: .35; transform: scale(.985); }
  50% { opacity: .85; transform: scale(1.025); }
}

@keyframes shine {
  0%, 56% { background-position: 160% 0; }
  82%, 100% { background-position: -70% 0; }
}

@keyframes glint {
  0%, 67%, 90%, 100% { opacity: 0; transform: scale(.3) rotate(0deg); }
  77% { opacity: 1; transform: scale(1.8) rotate(90deg); }
}

@keyframes floor-pulse {
  0%, 100% { opacity: .45; transform: scale(.88); }
  50% { opacity: .82; transform: scale(1.05); }
}

@keyframes flash {
  0% { opacity: .9; transform: scale(1); }
  100% { opacity: 0; transform: scale(55); }
}

@keyframes spark {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(0deg) scale(.02);
  }
  12% { opacity: .9; }
  38% {
    opacity: 1;
    transform: translate(calc(-50% + var(--sx-mid)), calc(-50% + var(--sy-mid))) rotate(var(--spin-mid, 30deg)) scale(1);
  }
  58% { opacity: .92; }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--sx)), calc(-50% + var(--sy))) rotate(var(--spin, 240deg)) scale(.04);
  }
}

@keyframes logo-bloom {
  0%, 100% { filter: brightness(1) saturate(1); }
  35% { filter: brightness(1.48) saturate(1.2) drop-shadow(0 0 20px rgba(255, 205, 91, .85)); }
}

@keyframes aurora-one {
  to { transform: translate(18vmax, 10vmax) scale(1.16); }
}

@keyframes aurora-two {
  to { transform: translate(-15vmax, -8vmax) scale(.84); }
}

@media (max-width: 540px) {
  :root { --coin-size: min(78vw, 390px); }
  .orbit { width: calc(var(--coin-size) * 1.28); }
  .orbit--inner { width: calc(var(--coin-size) * 1.12); }
  .orbit--outer i:nth-child(1),
  .orbit--outer i:nth-child(2),
  .orbit--outer i:nth-child(3) { transform: rotate(var(--a, 18deg)) translateX(calc(var(--coin-size) * .64)); }
  .orbit--outer i:nth-child(2) { --a: 153deg; }
  .orbit--outer i:nth-child(3) { --a: 274deg; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }

  .coin-tilt { transition: none; }

  .spark {
    animation-duration: 1.2s !important;
    animation-iteration-count: 1 !important;
  }
}
