/* ===== Discord page — the spectacular edition ===== */

@property --a { syntax: "<angle>"; initial-value: 0deg; inherits: false; }

.join {
  position: relative;
  width: min(1000px, 100%);
  min-height: clamp(320px, 48vh, 480px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(22px, 4vh, 36px);
  animation: enter .9s var(--out) both .5s;
}

/* ---------- sunburst rays ---------- */
.rays {
  position: absolute; left: 50%; top: 46%;
  width: min(1500px, 220vw); aspect-ratio: 1;
  transform: translate(-50%, -50%);
  pointer-events: none; z-index: 0;
  -webkit-mask-image: radial-gradient(closest-side, #000 8%, rgba(0,0,0,.6) 40%, transparent 72%);
          mask-image: radial-gradient(closest-side, #000 8%, rgba(0,0,0,.6) 40%, transparent 72%);
}
.rays span { position: absolute; inset: 0; border-radius: 50%; }
.rays .r1 {
  background: repeating-conic-gradient(rgba(255,255,255,.75) 0 6deg, transparent 6deg 16deg);
  animation: spin 50s linear infinite;
}
.rays .r2 {
  background: repeating-conic-gradient(from 8deg, rgba(138, 120, 255, .5) 0 4deg, transparent 4deg 24deg);
  animation: spin 80s linear infinite reverse;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- ripple rings ---------- */
.rings { position: absolute; left: 50%; top: 46%; width: 0; height: 0; z-index: 0; pointer-events: none; }
.rings i {
  position: absolute; left: 50%; top: 50%;
  width: min(640px, 86vw); height: clamp(150px, 24vw, 220px);
  border: 5px solid rgba(88, 101, 242, .75);
  border-radius: 44px;
  transform: translate(-50%, -50%) scale(1);
  opacity: 0;
  animation: ring 3.6s var(--out) infinite;
}
.rings i:nth-child(2) { animation-delay: 1.2s; border-color: rgba(255, 201, 58, .85); }
.rings i:nth-child(3) { animation-delay: 2.4s; border-color: rgba(255, 124, 156, .8); }
@keyframes ring {
  0%   { opacity: .9; transform: translate(-50%, -50%) scale(.9); }
  100% { opacity: 0;  transform: translate(-50%, -50%) scale(2.1); }
}

/* ---------- orbiting bits ---------- */
.orbit { position: absolute; left: 50%; top: 46%; width: 0; height: 0; pointer-events: none; z-index: 1; }
.orbit .o { position: absolute; left: 0; top: 0; animation: orbit var(--dur) linear infinite; animation-delay: var(--delay); }
@keyframes orbit {
  from { transform: rotate(0deg) translateX(var(--rx)) rotate(0deg) scaleY(var(--ratio)); }
  to   { transform: rotate(360deg) translateX(var(--rx)) rotate(-360deg) scaleY(var(--ratio)); }
}
.orbit .o > span { display: block; animation: twirl 2s var(--soft) infinite alternate; filter: drop-shadow(0 3px 0 rgba(59,32,9,.25)); }
@keyframes twirl { from { transform: scale(.75) rotate(-25deg); } to { transform: scale(1.3) rotate(25deg); } }

/* ---------- floating chat bubbles ---------- */
.bubbles { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.bub {
  position: absolute;
  font-family: "Silkscreen", monospace; font-weight: 700; font-size: 14px; line-height: 1;
  color: var(--brown-dark);
  background: #fff; border: 3px solid var(--brown-dark); border-radius: 14px 14px 14px 4px;
  padding: 7px 11px 8px;
  box-shadow: 0 4px 0 var(--brown-dark);
  white-space: nowrap;
  animation: bub 3.4s var(--out) forwards;
}
.bub.alt { border-radius: 14px 14px 4px 14px; background: var(--gold-1); }
@keyframes bub {
  0%   { opacity: 0; transform: translateY(20px) scale(.3) rotate(-8deg); }
  14%  { opacity: 1; transform: translateY(-4px) scale(1.12) rotate(3deg); }
  24%  { transform: translateY(0) scale(1) rotate(0); }
  80%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-56px) scale(.95); }
}

/* ---------- the mega button frame (rainbow border) ---------- */
.mega-frame {
  --lift: 0px; --rx: 0deg; --ry: 0deg;
  position: relative; z-index: 2;
  padding: 8px;
  border: 5px solid var(--brown-dark);
  border-radius: 40px;
  background: conic-gradient(from var(--a), #ff5a7a, #ffc93a, #9be36f, #4fd0ff, #b46ee0, #ff5a7a);
  box-shadow: 0 13px 0 #2a1f6e, 0 13px 0 5px var(--brown-dark), 0 34px 54px rgba(88, 101, 242, .45);
  transform: perspective(900px) translateY(var(--lift)) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform .5s var(--spring), box-shadow .25s var(--out);
  animation: megaIn 1.1s var(--spring) both .7s, rainbow 4s linear infinite, megaBob 3.4s var(--soft) infinite 1.8s;
  max-width: 100%;
}
.mega-frame::before { /* rainbow glow */
  content: ""; position: absolute; inset: -14px; z-index: -1; border-radius: 52px;
  background: inherit; filter: blur(22px); opacity: .7;
  animation: glowPulse 2.4s var(--soft) infinite;
}
@keyframes rainbow { to { --a: 360deg; } }
@keyframes glowPulse { 0%, 100% { opacity: .45; transform: scale(.97); } 50% { opacity: .9; transform: scale(1.04); } }
@keyframes megaIn { from { opacity: 0; transform: scale(.2) rotate(-14deg); } to { opacity: 1; transform: none; } }
@keyframes megaBob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -9px; } }

.mega-frame:hover { --lift: -7px; box-shadow: 0 20px 0 #2a1f6e, 0 20px 0 5px var(--brown-dark), 0 44px 70px rgba(88, 101, 242, .55); }
.mega-frame:active { --lift: 9px; transition-duration: .07s; box-shadow: 0 3px 0 #2a1f6e, 0 3px 0 5px var(--brown-dark), 0 10px 20px rgba(88, 101, 242, .4); }
.mega-frame.boom { animation: megaIn 0s, rainbow 4s linear infinite, boom .6s var(--spring), megaBob 3.4s var(--soft) infinite 1.8s; }
@keyframes boom { 0% { scale: 1; } 30% { scale: 1.12 .9; } 60% { scale: .96 1.06; } 100% { scale: 1; } }

.mega {
  position: relative;
  display: flex; align-items: center; gap: clamp(14px, 3vw, 28px);
  padding: clamp(20px, 3.6vw, 34px) clamp(26px, 5.4vw, 54px);
  text-decoration: none; color: #fff;
  border: 4px solid var(--brown-dark);
  border-radius: 28px;
  background:
    radial-gradient(circle at 16% 16%, rgba(255,255,255,.4), transparent 38%),
    repeating-conic-gradient(rgba(255,255,255,.09) 0 25%, transparent 0 50%) 0 0 / 30px 30px,
    linear-gradient(135deg, #7b87ff 0%, #5865f2 45%, #8a48d8 100%);
  background-size: auto, 30px 30px, 200% 200%;
  box-shadow: inset 0 6px 0 rgba(255,255,255,.38), inset 0 -10px 0 rgba(0,0,0,.2);
  animation: megaGrad 6s ease-in-out infinite;
  overflow: hidden; isolation: isolate;
  -webkit-tap-highlight-color: transparent;
}
@keyframes megaGrad { 0%, 100% { background-position: 0 0, 0 0, 0% 50%; } 50% { background-position: 0 0, 30px 30px, 100% 50%; } }
.mega:focus-visible { outline: 5px dashed #fff; outline-offset: 10px; }

.mega-shine { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.mega-shine::before {
  content: ""; position: absolute; top: -30%; bottom: -30%; width: 28%; left: -50%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.65), transparent);
  transform: skewX(-20deg);
  animation: shine 3.2s var(--soft) infinite 1.6s;
}
.mega-frame:hover .mega-shine::before { animation-duration: 1s; animation-delay: 0s; }

.mega-logo {
  flex: none; display: grid; place-items: center;
  width: clamp(70px, 12vw, 108px); height: clamp(70px, 12vw, 108px);
  background: #fff; color: #5865f2;
  border: 4px solid var(--brown-dark); border-radius: 26px;
  box-shadow: 0 5px 0 var(--brown-dark), inset 0 -6px 0 rgba(88,101,242,.15);
  transition: transform .6s var(--spring);
  animation: logoWobble 3.4s var(--soft) infinite 1.8s;
}
.mega-logo svg { width: 62%; height: auto; display: block; }
.mega-frame:hover .mega-logo { transform: rotate(-14deg) scale(1.18); animation: none; }
@keyframes logoWobble { 0%, 70%, 100% { transform: rotate(0); } 78% { transform: rotate(-12deg) scale(1.1); } 86% { transform: rotate(9deg); } 93% { transform: rotate(-4deg); } }

.mega-text { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.mega-top {
  font-family: "Silkscreen", monospace; font-weight: 700; font-size: clamp(12px, 1.8vw, 17px); letter-spacing: 3px;
  color: #e4e7ff;
}
.mega-main {
  font-size: clamp(36px, 8vw, 84px); line-height: .95;
  color: #fff;
  -webkit-text-stroke: 3px var(--brown-dark); paint-order: stroke fill;
  text-shadow: 0 6px 0 var(--brown-dark);
  white-space: nowrap;
}
.mega-main .ch { display: inline-block; animation: hop 3s var(--soft) infinite; animation-delay: calc(1.8s + var(--i) * 70ms); }
.mega-main .sp { display: inline-block; width: .28em; }

.mega-arrow {
  flex: none; font-size: clamp(30px, 5.4vw, 52px); color: var(--gold-2);
  text-shadow: 0 4px 0 var(--brown-dark);
  animation: nudge 1.1s var(--soft) infinite;
}
.mega-frame:hover .mega-arrow { animation: nudgeFast .45s var(--soft) infinite; }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(9px); } }
@keyframes nudgeFast { 0%, 100% { transform: translateX(0) scale(1.1); } 50% { transform: translateX(14px) scale(1.25); } }

/* ---------- live stats ---------- */
.stats {
  position: relative; z-index: 2;
  display: flex; gap: 12px; flex-wrap: wrap; justify-content: center;
}
.stats:not([hidden]) { animation: enter .8s var(--out) both; }
.stat {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: "Silkscreen", monospace; font-weight: 700; font-size: clamp(13px, 2vw, 16px); letter-spacing: 1px;
  background: var(--brown-dark); color: var(--gold-1);
  border: 3px solid var(--gold-3); border-radius: 999px;
  padding: 7px 16px 8px;
  box-shadow: 0 5px 0 rgba(59,32,9,.3);
  transition: transform .4s var(--spring);
}
.stat:hover { transform: translateY(-3px) rotate(-1.5deg) scale(1.05); }
.stat b { font-weight: 700; color: #fff; font-size: 1.25em; }
.live-dot { position: relative; width: 11px; height: 11px; background: #6ee05a; }
.live-dot::after { content: ""; position: absolute; inset: 0; background: #6ee05a; animation: ping 1.8s var(--out) infinite; }
.stat-ico svg { display: block; }

/* ---------- cursor sparkle trail ---------- */
.trail {
  position: fixed; z-index: 8; pointer-events: none;
  animation: trail .9s var(--out) forwards;
}
@keyframes trail {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + 36px)) scale(.2) rotate(var(--r)); }
}

/* shockwave on click */
.shock {
  position: fixed; z-index: 8; pointer-events: none;
  width: 20px; height: 20px; border-radius: 50%;
  border: 6px solid #fff; box-shadow: 0 0 0 4px var(--brown-dark), 0 0 40px 10px rgba(138, 120, 255, .8);
  transform: translate(-50%, -50%) scale(1);
  animation: shock .9s var(--out) forwards;
}
@keyframes shock { to { transform: translate(-50%, -50%) scale(60); opacity: 0; } }

@media (max-width: 620px) {
  .mega { flex-direction: column; text-align: center; gap: 10px; padding: 22px 24px 24px; }
  .mega-text { align-items: center; text-align: center; }
  .mega-arrow { display: none; }
  .mega-frame { border-radius: 34px; }
}
