/* Log-in event pop-up: Halloween 2026 pumpkin patch (js/events.js) */
.hw-overlay {
  --hw-orange: #ff8a1e;
  --hw-gold: #ffd23f;
  --hw-purple: #9b5cff;
  --hw-ink: #1b0d18;
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow-y: auto;
  background: radial-gradient(120% 90% at 50% 0%, #3a1f63 0%, #1c0f33 45%, #0b0614 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.hw-overlay.in { opacity: 1; }
.hw-overlay.out { opacity: 0; pointer-events: none; }

/* ---- sky ---- */
.hw-sky { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.hw-sky::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff, transparent), radial-gradient(1px 1px at 28% 8%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 44% 22%, #ffe9b0, transparent), radial-gradient(1px 1px at 63% 12%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 78% 28%, #fff, transparent), radial-gradient(1px 1px at 90% 6%, #fff, transparent),
    radial-gradient(1px 1px at 6% 40%, #fff, transparent), radial-gradient(1.5px 1.5px at 94% 46%, #ffe9b0, transparent),
    radial-gradient(1px 1px at 36% 36%, #fff, transparent), radial-gradient(1px 1px at 56% 4%, #fff, transparent);
  animation: hw-twinkle 3.5s ease-in-out infinite alternate;
}
.hw-moon {
  position: absolute;
  top: 6vh;
  right: 9vw;
  width: clamp(70px, 11vw, 130px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 36%, #fffbe8 0%, #ffe9a8 55%, #f5c860 100%);
  box-shadow: 0 0 40px 10px rgba(255, 220, 140, 0.35), 0 0 120px 40px rgba(255, 190, 90, 0.15);
}
.hw-moon::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 64% 60%, rgba(200, 150, 60, 0.35) 0 9%, transparent 10%), radial-gradient(circle at 34% 70%, rgba(200, 150, 60, 0.28) 0 6%, transparent 7%), radial-gradient(circle at 58% 28%, rgba(200, 150, 60, 0.25) 0 5%, transparent 6%);
}
.hw-bat {
  position: absolute;
  left: -80px;
  top: calc(8vh + var(--b) * 7vh);
  width: calc(34px + var(--b) * 6px);
  fill: #0d0716;
  filter: drop-shadow(0 0 6px rgba(155, 92, 255, 0.35));
  animation: hw-fly calc(11s + var(--b) * 2.6s) linear calc(var(--b) * -3.1s) infinite;
}
.hw-bat svg { display: block; width: 100%; animation: hw-flap 0.32s ease-in-out infinite alternate; transform-origin: 50% 40%; }
.hw-fog {
  position: absolute;
  left: -20%;
  right: -20%;
  bottom: -6vh;
  height: 34vh;
  background: radial-gradient(40% 60% at 20% 70%, rgba(190, 170, 255, 0.22), transparent 70%), radial-gradient(45% 55% at 65% 80%, rgba(190, 170, 255, 0.18), transparent 70%), radial-gradient(30% 50% at 95% 60%, rgba(190, 170, 255, 0.16), transparent 70%);
  animation: hw-drift 18s ease-in-out infinite alternate;
}
.hw-fog.two { bottom: -12vh; opacity: 0.8; animation-duration: 24s; animation-direction: alternate-reverse; }

/* ---- card ---- */
.hw-card {
  position: relative;
  width: min(760px, 100%);
  padding: 30px 28px 24px;
  border-radius: 28px;
  text-align: center;
  color: #f4ecff;
  background: linear-gradient(180deg, rgba(58, 30, 96, 0.96) 0%, rgba(30, 14, 52, 0.97) 70%, rgba(22, 10, 30, 0.98) 100%);
  border: 3px solid #ff8a1e;
  box-shadow: 0 0 0 6px rgba(27, 13, 24, 0.85), 0 0 50px rgba(255, 138, 30, 0.45), 0 30px 80px rgba(0, 0, 0, 0.6), inset 0 0 60px rgba(155, 92, 255, 0.18);
  transform: translateY(24px) scale(0.94);
  transition: transform 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
  overflow: hidden;
}
.hw-overlay.in .hw-card { transform: none; }
.hw-card.quake { animation: hw-quake 0.42s linear; }
.hw-web {
  position: absolute;
  top: 0;
  left: 0;
  width: 120px;
  height: 120px;
  opacity: 0.45;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 120' fill='none' stroke='%23e9dcff' stroke-width='1.2'%3E%3Cpath d='M0 0L120 26M0 0L96 70M0 0L60 110M0 0L18 120'/%3E%3Cpath d='M30 7Q26 18 24 28Q18 30 10 34Q6 32 4 36'/%3E%3Cpath d='M58 13Q50 32 47 54Q34 60 22 67Q12 70 8 72'/%3E%3Cpath d='M88 19Q76 46 70 80Q52 90 34 98Q22 104 12 108'/%3E%3C/svg%3E") no-repeat;
}
.hw-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}
.hw-close:hover { background: rgba(255, 138, 30, 0.4); }
.hw-overlay.picking .hw-close { visibility: hidden; }
.hw-kicker {
  margin: 0;
  font: 400 14px "Lilita One", system-ui, sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #c9a8ff;
}
.hw-title {
  margin: 4px 0 6px;
  font: 400 clamp(38px, 7vw, 58px) / 1 "Lilita One", system-ui, sans-serif;
  letter-spacing: 0.02em;
  color: #ffb02e;
  background: linear-gradient(180deg, #ffe27a 0%, #ffb02e 45%, #ff6a0a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 2px #1b0d18;
  filter: drop-shadow(0 4px 0 #1b0d18) drop-shadow(0 0 18px rgba(255, 138, 30, 0.55));
  animation: hw-glow 2.4s ease-in-out infinite alternate;
}
.hw-lead { margin: 0 auto; max-width: 520px; font-size: 15px; line-height: 1.45; color: #dccdf5; }
.hw-lead b { color: #ffd23f; }

/* ---- pumpkin patch ---- */
.hw-patch {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: clamp(6px, 3vw, 28px);
  margin: 18px -28px 0;
  padding: 26px 18px 18px;
  min-height: 250px;
}
.hw-ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 74px;
  background: radial-gradient(70% 100% at 50% 100%, #2c4a1c 0%, #1d3312 60%, transparent 61%), linear-gradient(transparent 40%, rgba(20, 36, 12, 0.6));
  pointer-events: none;
}
.hw-ground::before {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 14px;
  height: 16px;
  background: repeating-linear-gradient(90deg, transparent 0 9px, #3f6a26 9px 11px, transparent 11px 17px, #355b1f 17px 18px, transparent 18px 26px);
  -webkit-mask: linear-gradient(transparent, #000 60%);
  mask: linear-gradient(transparent, #000 60%);
}
.hw-burst { position: absolute; inset: -40px; width: calc(100% + 80px); height: calc(100% + 80px); pointer-events: none; z-index: 4; }
.hw-pumpkin {
  position: relative;
  z-index: 1;
  width: clamp(92px, 27vw, 200px);
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  color: inherit;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}
.hw-pumpkin:focus-visible { outline: 3px dashed var(--hw-gold); outline-offset: 6px; border-radius: 24px; }
.hw-pk-body { position: absolute; inset: 0; display: block; transition: transform 0.25s cubic-bezier(0.2, 1.6, 0.4, 1), opacity 0.3s, filter 0.3s; }
.hw-pk-svg { display: block; width: 100%; height: 100%; overflow: visible; animation: hw-bob 2.6s ease-in-out calc(var(--i) * -0.8s) infinite; transform-origin: 50% 92%; filter: drop-shadow(0 0 0 transparent); }
.hw-pk-shadow { fill: rgba(0, 0, 0, 0.35); }
.hw-pk-vine { fill: none; stroke: #1b0d18; stroke-width: 7; stroke-linecap: round; }
.hw-pk-vine-in { fill: none; stroke: #6fbf3a; stroke-width: 3; stroke-linecap: round; }
.hw-ink { stroke: #1b0d18; stroke-width: 5; stroke-linejoin: round; }
.hw-ink-thick { stroke: #1b0d18; stroke-width: 7; }
.hw-rib { stroke: #8a3208; stroke-width: 3; }
.hw-pk-face path { stroke: #1b0d18; stroke-width: 3.5; stroke-linejoin: round; }
.hw-pk-face > g:first-child path { stroke: none; }
.hw-pk-glow { animation: hw-flicker 1.7s ease-in-out calc(var(--i) * -0.5s) infinite; }
.hw-pumpkin:not(:disabled):hover .hw-pk-body,
.hw-pumpkin:focus-visible .hw-pk-body { transform: translateY(-10px) scale(1.06); filter: drop-shadow(0 0 22px rgba(255, 170, 40, 0.75)); }
.hw-pumpkin:not(:disabled):hover .hw-pk-svg { animation: hw-wobble 0.6s ease-in-out infinite; }
.hw-overlay.picking .hw-pumpkin:not(.chosen) .hw-pk-body { opacity: 0.5; filter: grayscale(0.5) brightness(0.7); }
.hw-pumpkin:disabled { cursor: default; }
.hw-pumpkin.shaking .hw-pk-body { filter: drop-shadow(0 0 30px rgba(255, 200, 60, 0.95)) brightness(1.15); }
.hw-pumpkin.shaking .hw-pk-svg { animation: hw-shake 1.3s cubic-bezier(0.4, 0, 1, 1) forwards; }
.hw-pumpkin.shaking .hw-pk-glow { animation: hw-hot 1.3s ease-in forwards; }
.hw-pumpkin.boom .hw-pk-body { transform: scale(1.5); opacity: 0; transition: transform 0.18s ease-out, opacity 0.18s ease-out; }
.hw-overlay.picking .hw-pumpkin.other.revealed .hw-pk-body { transform: translateY(20px) scale(0.7); opacity: 0; filter: none; }

/* ---- reveal ---- */
.hw-reveal {
  position: absolute;
  inset: -6px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding-bottom: 4px;
  animation: hw-pop 0.55s cubic-bezier(0.2, 1.7, 0.4, 1) both;
}
.hw-reveal[hidden] { display: none; }
.hw-rays {
  position: absolute;
  left: 50%;
  top: 44%;
  width: 260%;
  aspect-ratio: 1;
  translate: -50% -50%;
  z-index: -1;
  background: repeating-conic-gradient(from 0deg, rgba(255, 210, 63, 0.32) 0 9deg, transparent 9deg 22deg);
  -webkit-mask: radial-gradient(circle, #000 18%, transparent 62%);
  mask: radial-gradient(circle, #000 18%, transparent 62%);
  animation: hw-spin 14s linear infinite;
  pointer-events: none;
}
.hw-pumpkin.chosen .hw-reveal { inset: -38% -24% -4px; }
.hw-skin { flex: 1 1 auto; width: 100%; min-height: 0; }
.hw-name {
  font: 400 clamp(15px, 2.6vw, 22px) / 1.05 "Lilita One", system-ui, sans-serif;
  color: #fff;
  text-shadow: 0 2px 0 #1b0d18, 0 0 12px rgba(255, 170, 40, 0.6);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.hw-tag { font-size: 11px; }
.hw-pumpkin.other .hw-reveal { animation-duration: 0.4s; opacity: 0.62; filter: saturate(0.6); justify-content: center; }
.hw-pumpkin.other .hw-name { font-size: clamp(12px, 2vw, 16px); }
.hw-pumpkin.other .hw-thumb { width: clamp(44px, 10vw, 72px); height: clamp(44px, 10vw, 72px); }
.hw-could { font-size: 11px; color: #bba6e0; font-style: italic; }

.hw-thumb {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  background: #241338;
  box-shadow: 0 0 0 3px #1b0d18, 0 0 0 5px rgba(255, 255, 255, 0.65);
  flex: none;
}
.hw-thumb img { width: 100%; height: 100%; object-fit: cover; }
.hw-thumb.sm { width: 40px; height: 40px; box-shadow: 0 0 0 2px #1b0d18, 0 0 0 3px rgba(255, 255, 255, 0.5); }
.hw-thumb.lg { width: clamp(84px, 16vw, 124px); height: clamp(84px, 16vw, 124px); margin-bottom: 6px; }
.hw-thumb-coins { background: radial-gradient(circle at 50% 40%, #4a2a10, #20100a); }
.hw-coin {
  position: absolute;
  left: 50%;
  width: 46%;
  height: 16%;
  translate: -50% 0;
  border-radius: 50%;
  background: linear-gradient(180deg, #fff1a0 0%, #ffd23f 40%, #e09a12 100%);
  box-shadow: inset 0 -2px 0 #b8740a, 0 0 0 1.5px #1b0d18;
}
.hw-coin:nth-child(1) { top: 60%; }
.hw-coin:nth-child(2) { top: 47%; }
.hw-coin:nth-child(3) { top: 34%; }
.hw-coin:nth-child(3)::after {
  content: "";
  position: absolute;
  inset: 22% 30%;
  border-radius: 50%;
  border: 1.5px solid rgba(160, 100, 10, 0.7);
}

.hw-status { min-height: 1.4em; margin: 12px 0 0; font-size: 15px; color: #e7dbff; }
.hw-status b { color: #ffd23f; }
.hw-prizes {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  transition: opacity 0.3s;
}
.hw-overlay.picking .hw-prizes { opacity: 0.45; }
.hw-prize {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 14px 6px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.3);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  text-align: left;
}
.hw-prize.rarity-mythical { border-color: rgba(255, 120, 200, 0.55); box-shadow: 0 0 14px rgba(255, 90, 180, 0.25); }
.hw-prize span { display: grid; line-height: 1.15; }
.hw-prize b { font-size: 14px; color: #fff; }
.hw-prize small { font-size: 12px; color: #bba6e0; }
.hw-actions { display: flex; justify-content: center; gap: 12px; margin-top: 16px; animation: hw-pop 0.4s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
.hw-actions[hidden] { display: none; }
.hw-actions .btn-3d { min-width: 150px; }

.hw-flash { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(circle, #fff6d0 0%, rgba(255, 190, 80, 0.6) 40%, transparent 75%); opacity: 0; }
.hw-overlay.flash .hw-flash { animation: hw-flash 0.26s ease-out; }

/* ---- motion ---- */
@keyframes hw-twinkle { from { opacity: 0.55; } to { opacity: 1; } }
@keyframes hw-fly {
  0% { transform: translate(0, 0); }
  25% { transform: translate(30vw, -3vh); }
  50% { transform: translate(60vw, 2vh); }
  75% { transform: translate(90vw, -4vh); }
  100% { transform: translate(calc(100vw + 160px), 1vh); }
}
@keyframes hw-flap { from { transform: scaleY(1); } to { transform: scaleY(0.45); } }
@keyframes hw-drift { from { transform: translateX(-6%); } to { transform: translateX(6%); } }
@keyframes hw-glow { from { filter: drop-shadow(0 4px 0 #1b0d18) drop-shadow(0 0 12px rgba(255, 138, 30, 0.4)); } to { filter: drop-shadow(0 4px 0 #1b0d18) drop-shadow(0 0 26px rgba(255, 138, 30, 0.8)); } }
@keyframes hw-bob { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-5px) rotate(1deg); } }
@keyframes hw-wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }
@keyframes hw-flicker { 0%, 100% { opacity: 1; } 18% { opacity: 0.82; } 22% { opacity: 0.96; } 47% { opacity: 0.74; } 52% { opacity: 1; } 78% { opacity: 0.88; } }
@keyframes hw-hot { from { opacity: 1; filter: brightness(1); } to { opacity: 1; filter: brightness(1.6) saturate(1.4); } }
@keyframes hw-shake {
  0% { transform: rotate(0) scale(1); }
  10% { transform: rotate(-3deg) scale(1.01); }
  20% { transform: rotate(3deg) scale(1.02); }
  30% { transform: rotate(-5deg) scale(1.03) translateX(-2px); }
  40% { transform: rotate(5deg) scale(1.04) translateX(2px); }
  50% { transform: rotate(-7deg) scale(1.06) translateX(-3px); }
  60% { transform: rotate(7deg) scale(1.08) translateX(3px); }
  70% { transform: rotate(-9deg) scale(1.1, 1.06) translateX(-4px); }
  80% { transform: rotate(9deg) scale(1.13, 1.08) translateX(4px); }
  90% { transform: rotate(-6deg) scale(1.18, 1.1) translateX(-3px); }
  100% { transform: rotate(0) scale(1.24, 1.14); }
}
@keyframes hw-quake {
  0%, 100% { translate: 0 0; }
  20% { translate: -9px 4px; }
  40% { translate: 8px -5px; }
  60% { translate: -6px 3px; }
  80% { translate: 4px -2px; }
}
@keyframes hw-pop { from { opacity: 0; transform: scale(0.3) translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes hw-spin { to { rotate: 360deg; } }
@keyframes hw-flash { 0% { opacity: 0; } 30% { opacity: 0.95; } 100% { opacity: 0; } }

@media (max-width: 560px) {
  .hw-card { padding: 26px 14px 18px; }
  .hw-patch { margin: 12px -14px 0; padding: 18px 6px 14px; min-height: 160px; }
  .hw-lead { font-size: 14px; }
  .hw-kicker { padding: 0 34px; font-size: 12px; }
  .hw-prize { padding: 4px 10px 4px 4px; }
  .hw-actions .btn-3d { min-width: 0; flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .hw-bat, .hw-fog, .hw-pk-svg, .hw-pk-glow, .hw-rays, .hw-title, .hw-sky::before { animation: none !important; }
}
body.reduced-motion .hw-overlay *,
body.reduced-motion .hw-overlay *::before { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
