/* Styles for the prize wheel and for seasonal decorations.
   The wheel is always available; its colours come from the active season (set as CSS variables on the card).
   Home page decorations are scoped to a season on <html data-season="...">, sit in their own layer on top of
   the page, and never edit the page's own backgrounds. */

/* ================= the prize wheel ================= */
.sw-dialog { width: min(100% - 2rem, 52rem); max-width: none; padding: 0; border: 0; background: transparent; color: inherit; overflow: visible auto; }
.sw-dialog::backdrop { background: #000000D9; }

/* the card: wheel on one side, words and sign-up on the other */
.sw { --a: #F97316; --a2: #FDBA74; --deep: #0A0908; --panel: #141110; --ink: #F5F3F0; --dim: #A8A099;
      position: relative; display: grid; grid-template-columns: minmax(0, 21rem) minmax(0, 1fr); align-items: center; gap: clamp(1rem, 4vw, 2.75rem);
      padding: clamp(1.25rem, 4vw, 2.5rem); padding-top: clamp(2.5rem, 5vw, 3.25rem); border-radius: 22px; background: var(--panel); color: var(--ink);
      border: 1px solid color-mix(in srgb, var(--a) 35%, transparent); overflow: hidden; isolation: isolate; }
.sw::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(60% 80% at 22% 50%, color-mix(in srgb, var(--a) 26%, transparent), transparent 70%); }
.sw .offer-close { z-index: 3; color: var(--ink); top: .9rem; right: .6rem; background: color-mix(in srgb, var(--deep) 70%, transparent); }
.sw .offer-close:hover { background: var(--deep); }
@media (max-width: 46rem) {
  .sw { grid-template-columns: 1fr; text-align: center; }
  .sw-wheel { max-width: 17.5rem; margin-inline: auto; }
}
/* phones held sideways: a smaller wheel so the card fits the short screen */
@media (max-height: 30rem) and (min-width: 36rem) and (orientation: landscape) {
  .sw { grid-template-columns: minmax(0, 14rem) minmax(0, 1fr); text-align: left; padding: 1.75rem 1.25rem 1rem; gap: 1.25rem; }
  .sw-wheel { max-width: none; margin: 0; }
  .sw h2 { font-size: 1.5rem; }
  .sw-intro { margin-bottom: .6rem; }
}

/* Wrappers for the floating shapes take up no space of their own. Without this the first one would
   occupy a cell of the card's two-column layout and push the wheel and the words out of place. */
.sw-extras { display: contents; }
/* the wheel and the words are placed explicitly, so nothing else in the card can shift them */
.sw-wheel { grid-column: 1; grid-row: 1; }
.sw-words { grid-column: 2; grid-row: 1; min-width: 0; }
@media (max-width: 46rem) { .sw-words { grid-column: 1; grid-row: 2; } }
@media (max-height: 30rem) and (min-width: 36rem) and (orientation: landscape) { .sw-words { grid-column: 2; grid-row: 1; } }

/* seasonal dressing on the card */
.sw-cap { position: absolute; top: 0; left: 0; width: 100%; height: 2.4rem; color: var(--a); pointer-events: none; z-index: 2; }
.sw-cap svg { display: block; width: 100%; height: 100%; }
.sw-fog { position: absolute; left: -20%; right: -20%; bottom: -2.5rem; height: 6rem; z-index: -1; background: radial-gradient(50% 60% at 30% 60%, color-mix(in srgb, var(--ink) 16%, transparent), transparent 70%), radial-gradient(40% 55% at 70% 50%, color-mix(in srgb, var(--ink) 12%, transparent), transparent 70%); filter: blur(10px); animation: sw-fog 14s ease-in-out infinite alternate; }
@keyframes sw-fog { from { transform: translateX(-4%); } to { transform: translateX(4%); } }
.sw-drift { position: absolute; z-index: -1; color: var(--deep); opacity: .9; animation: sw-drift var(--t, 11s) ease-in-out var(--d, 0s) infinite alternate; }
.sw-drift svg { display: block; width: 100%; height: auto; fill: currentColor; }
@keyframes sw-drift { from { transform: translate(0, 0) rotate(-5deg); } to { transform: translate(1.6rem, -.9rem) rotate(6deg); } }

/* the wheel itself */
.sw-wheel { position: relative; width: 100%; }
.sw-wheel > svg { display: block; width: 100%; height: auto; overflow: visible; }
.sw-wheel text { font-family: var(--display); font-weight: 800; letter-spacing: -.02em; }
.sw-ring { transform-origin: 0 0; transform-box: view-box; }
.sw-jackpot { animation: sw-pulse 1.6s ease-in-out infinite alternate; }
@keyframes sw-pulse { from { opacity: .75; } to { opacity: 1; } }
.sw-pointer { transform-origin: 0 -121px; transform-box: view-box; }
.is-spinning .sw-pointer { animation: sw-tick .14s linear infinite alternate; }
@keyframes sw-tick { from { transform: rotate(-7deg); } to { transform: rotate(5deg); } }
.sw-emblem { transform-origin: 0 0; transform-box: view-box; }
.is-won .sw-emblem { animation: sw-win .9s var(--ease); }
@keyframes sw-win { 40% { transform: scale(1.14); } }
.sw-glow { animation: sw-flicker 3.2s ease-in-out infinite; }
@keyframes sw-flicker { 0%, 100% { opacity: .9; } 45% { opacity: .65; } 60% { opacity: 1; } 80% { opacity: .75; } }
.sw-burst { position: absolute; left: 50%; top: 50%; width: 1.6rem; margin: -.8rem 0 0 -.8rem; color: var(--a2); opacity: 0; pointer-events: none; }
.sw-burst svg { display: block; width: 100%; height: auto; fill: currentColor; }
.is-won .sw-burst { animation: sw-burst 1.3s var(--ease) both; animation-delay: var(--d); }
@keyframes sw-burst { 0% { transform: translate(0, 0) scale(.4) rotate(0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translate(var(--x), var(--y)) scale(1.1) rotate(var(--r)); opacity: 0; } }

/* the words */
.sw-kicker { margin: 0 0 .4rem; font-weight: 700; font-size: .8125rem; color: var(--a2); }
.sw h2 { font-size: clamp(1.6rem, 4.4vw, 2.4rem); margin: 0 0 .5rem; }
.sw-intro { margin: 0 0 1.1rem; color: var(--dim); overflow-wrap: anywhere; }
.sw .field { text-align: left; margin-bottom: .8rem; }
.sw input { background: var(--deep); }
.sw .btn { width: 100%; background: var(--a); border-color: var(--a); }
.sw .btn:hover { background: var(--a2); border-color: var(--a2); }
.sw-fine { margin: .8rem 0 0; font-size: .8125rem; color: var(--dim); }
.sw-fine a { color: inherit; }
.sw-won { font-family: var(--display); font-weight: 800; font-size: clamp(1.4rem, 4vw, 2rem); line-height: 1.1; letter-spacing: -.04em; color: var(--a2); margin: 0 0 .5rem; }

/* floating "spin to win" button */
.season-launch { --a: #F97316; position: fixed; left: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom)); z-index: 35; display: flex; align-items: center; gap: .5rem; padding: .45rem 1rem .45rem .5rem; border: 2px solid var(--a); border-radius: 999px; background: #0A0908; color: #FFF7ED; font-weight: 700; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); animation: launch-bob 3.2s ease-in-out infinite; }
.season-launch svg { width: 2rem; height: 2rem; fill: var(--a); color: var(--a); }
.season-launch:hover { background: #1C0A04; }
@keyframes launch-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@media (max-width: 36rem) { body[data-page="box"] .season-launch { bottom: calc(5rem + env(safe-area-inset-bottom)); } }
@media (max-width: 30rem) {
  .season-launch { left: .6rem; bottom: calc(.6rem + env(safe-area-inset-bottom)); padding: .3rem .8rem .3rem .35rem; font-size: .9375rem; }
  .season-launch svg { width: 1.6rem; height: 1.6rem; }
}

/* ================= Halloween: home page decorations ================= */
[data-season="halloween"] .home-hero { position: relative; }
/* no z-index here on purpose: the hero vials blend into the page background, and that only works while
   nothing around them forms a separate layer */
.season-layer { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }

.season-bat { position: absolute; color: #000; opacity: .85; animation: bat-fly var(--fly) ease-in-out var(--delay) infinite alternate; }
.season-bat svg { width: 100%; height: auto; fill: currentColor; transform-origin: 50% 40%; animation: bat-flap .5s ease-in-out infinite alternate; filter: drop-shadow(0 0 6px rgba(249, 115, 22, .35)); }
@keyframes bat-fly {
  0% { transform: translate(0, 0) rotate(-6deg); }
  35% { transform: translate(3.5rem, -1.5rem) rotate(4deg); }
  70% { transform: translate(-2rem, 1.2rem) rotate(-3deg); }
  100% { transform: translate(5rem, .6rem) rotate(6deg); }
}
@keyframes bat-flap { from { transform: scaleY(1); } to { transform: scaleY(.55); } }

/* spider webs in the top corners of the hero, with one spider on a thread */
.season-cobweb { position: absolute; top: 0; left: 0; width: clamp(9rem, 22vw, 17rem); color: #F2EFEC; opacity: .2; }
.season-cobweb.is-right { left: auto; right: 0; transform: scaleX(-1); width: clamp(7rem, 16vw, 12rem); }
.season-cobweb svg { display: block; width: 100%; height: auto; }
.season-spider { position: absolute; top: 0; left: 30%; width: 1.5rem; color: #F2EFEC; opacity: .45; transform-origin: 50% 0; animation: spider-sway 5s ease-in-out infinite alternate; }
.season-spider svg { display: block; width: 100%; height: auto; }
@keyframes spider-sway { from { transform: rotate(-5deg) translateY(4.5rem); } to { transform: rotate(5deg) translateY(6rem); } }

.season-pumpkin { position: absolute; bottom: -.4rem; opacity: .9; filter: drop-shadow(0 0 18px rgba(249, 115, 22, .45)); }
.season-pumpkin svg { width: 100%; height: auto; }
@media (max-width: 54rem) {
  .season-pumpkin { width: 2.6rem !important; opacity: .75; }
  .season-pumpkin:nth-of-type(odd) { display: none; }
  .season-bat:nth-child(n + 7) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .season-bat, .season-bat svg, .season-launch, .season-spider, .sw-fog, .sw-drift, .sw-jackpot, .sw-glow, .sw-pointer, .sw-burst, .sw-emblem { animation: none !important; }
  .season-spider { transform: translateY(5rem); }
}
