:root {
  --cream: #fff8ec;
  --ink: #241a2e;
  --hotpink: #ff3d81;
  --turquoise: #10c8c8;
  --marigold: #ffb703;
  --violet: #8b5cf6;
  --orange: #ff7b25;
  --lime: #8bd346;
  --coral: #ff5c5c;
  --gold: #ffcc33;
  --shadow: 0 6px 18px rgba(0,0,0,0.28);
  --pinata-size: clamp(200px, 25vw, 340px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
}

/* Pueblo terracotta arabesque tile floor */
body {
  background-color: #c98a55;
  background-image:
    linear-gradient(rgba(20,10,30,0.18), rgba(20,10,30,0.18)),
    url("assets/floor.jpg");
  background-repeat: repeat;
  background-size: 172px 166px;
}

.mono { font-family: "Courier New", monospace; letter-spacing: 0.5px; }

/* ---------- ticker ---------- */
.ticker-wrap {
  background: var(--ink);
  color: var(--marigold);
  overflow: hidden;
  white-space: nowrap;
  border-bottom: 3px solid var(--hotpink);
}
.ticker {
  display: inline-block;
  padding: 12px 0;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.5px;
  animation: scroll-ticker 32s linear infinite;
}
.ticker span.sep { margin: 0 1.5em; color: var(--turquoise); }
@keyframes scroll-ticker {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ---------- topbar ---------- */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  background: linear-gradient(180deg, #fffaf0, var(--cream));
  border-bottom: 4px solid var(--ink);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { font-size: 2.2rem; filter: drop-shadow(0 3px 3px rgba(0,0,0,0.25)); }
.brand-name {
  font-size: 1.9rem;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: var(--hotpink);
  text-shadow: 2px 2px 0 var(--marigold);
}
.stats { display: flex; gap: 16px; flex-wrap: wrap; }
.stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 9px 20px;
  border-radius: 12px;
  border: 3px solid var(--ink);
  box-shadow: var(--shadow);
  min-width: 160px;
}
.stat.pot { background: var(--lime); color: #1a3306; }
.stat.countdown { background: var(--turquoise); color: #06312f; }
.stat .label { font-size: 0.74rem; text-transform: uppercase; opacity: 0.75; font-weight: 800; }
.stat .value { font-size: 1.5rem; font-weight: 900; }
.stat .sub { font-size: 0.82rem; opacity: 0.85; }

/* ---------- live status badge ---------- */
.live-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--ink);
  opacity: 0.75;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #999;
  transition: background 0.3s ease;
}
.live-status.is-live .live-dot {
  background: #2fa84f;
  box-shadow: 0 0 6px rgba(47,168,79,0.8);
  animation: live-pulse 1.6s ease-in-out infinite;
}
.live-status.is-demo .live-dot { background: var(--coral); }
@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---------- layout ---------- */
main { max-width: 1180px; margin: 0 auto; padding: 12px 14px 16px; }

/* ---------- fiesta stage ---------- */
.fiesta-stage {
  position: relative;
  width: min(94vw, 900px);
  min-height: clamp(340px, 48vh, 560px);
  margin: 0 auto;
  border-radius: 26px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(139,92,246,0.35), transparent 60%),
    linear-gradient(180deg, #3a1f52 0%, #5c2a63 45%, #7a3350 100%);
  box-shadow: 0 20px 44px rgba(0,0,0,0.45), inset 0 0 0 6px rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: clamp(20px, 4vh, 36px);
}

/* papel picado bunting across the top */
.bunting {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 34px;
  display: flex;
  justify-content: space-evenly;
  z-index: 3;
}
.bunting span {
  width: 26px;
  height: 26px;
  margin-top: -4px;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform: rotate(180deg);
}
.bunting span:nth-child(7n+1) { background: var(--hotpink); }
.bunting span:nth-child(7n+2) { background: var(--turquoise); }
.bunting span:nth-child(7n+3) { background: var(--marigold); }
.bunting span:nth-child(7n+4) { background: var(--violet); }
.bunting span:nth-child(7n+5) { background: var(--orange); }
.bunting span:nth-child(7n+6) { background: var(--lime); }
.bunting span:nth-child(7n+7) { background: var(--coral); }

.stage-caption {
  position: relative;
  z-index: 2;
  text-align: center;
  color: var(--cream);
  margin-top: clamp(14px, 3vh, 24px);
}
.caption-title { font-size: 1.05rem; font-weight: 800; }
.caption-sub { font-size: 0.8rem; opacity: 0.75; margin-top: 2px; }

/* ---------- confetti ---------- */
.confetti-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  overflow: hidden;
}
.confetto {
  position: absolute;
  top: 38%;
  left: 50%;
  width: 9px;
  height: 14px;
  background: var(--c, var(--hotpink));
  opacity: 0;
  transform: translate(-50%, -50%);
  animation: confetti-burst var(--dur, 1.3s) ease-out forwards;
  animation-delay: var(--delay, 0s);
}
@keyframes confetti-burst {
  0%   { transform: translate(-50%, -50%) rotate(0deg) scale(0.6); opacity: 1; }
  70%  { opacity: 1; }
  100% {
    transform:
      translate(calc(-50% + var(--dx)), calc(-50% + var(--dy)))
      rotate(var(--rot))
      scale(0.9);
    opacity: 0;
  }
}

/* ---------- rig: beam, rope, pinata ---------- */
.rig {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform-origin: 50% 0%;
  animation: idle-swing 4.2s ease-in-out infinite;
}
.fiesta-stage.is-bursting .rig { animation-play-state: paused; }
@keyframes idle-swing {
  0%, 100% { transform: rotate(-3.5deg); }
  50%      { transform: rotate(3.5deg); }
}

.beam {
  width: min(70vw, 460px);
  height: 10px;
  border-radius: 6px;
  background: linear-gradient(180deg, #8a5a30, #5c3417);
  box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}
.rope {
  width: 3px;
  height: clamp(26px, 5vh, 46px);
  background: #d8c79a;
}

.pinata {
  position: relative;
  width: var(--pinata-size);
  height: var(--pinata-size);
}

.petal {
  position: absolute;
  left: 50%;
  bottom: 50%;
  width: calc(var(--pinata-size) * 0.23);
  height: calc(var(--pinata-size) * 0.56);
  margin-left: calc(var(--pinata-size) * -0.115);
  transform-origin: 50% 100%;
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
  border-radius: 4px 4px 0 0;
  transition: transform 0.85s cubic-bezier(.25,.85,.35,1), opacity 0.85s ease;
}
.petal-1 { transform: rotate(0deg);      background: repeating-linear-gradient(0deg, #ff3d81 0 12%, #ff77aa 12% 24%); }
.petal-2 { transform: rotate(51.43deg);  background: repeating-linear-gradient(0deg, #10c8c8 0 12%, #5fe0e0 12% 24%); }
.petal-3 { transform: rotate(102.86deg); background: repeating-linear-gradient(0deg, #ffb703 0 12%, #ffd166 12% 24%); }
.petal-4 { transform: rotate(154.29deg); background: repeating-linear-gradient(0deg, #8b5cf6 0 12%, #b28cf9 12% 24%); }
.petal-5 { transform: rotate(205.71deg); background: repeating-linear-gradient(0deg, #ff7b25 0 12%, #ffa564 12% 24%); }
.petal-6 { transform: rotate(257.14deg); background: repeating-linear-gradient(0deg, #8bd346 0 12%, #b3e37f 12% 24%); }
.petal-7 { transform: rotate(308.57deg); background: repeating-linear-gradient(0deg, #ff5c5c 0 12%, #ff9494 12% 24%); }

.pinata-body {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--pinata-size) * 0.42);
  height: calc(var(--pinata-size) * 0.42);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6cf, var(--gold) 55%, #d99a10 100%);
  border: 3px solid #7a4e08;
  box-shadow: var(--shadow);
  transition: transform 0.6s cubic-bezier(.34,1.2,.4,1), opacity 0.6s ease;
  z-index: 2;
}
.pinata-face { position: relative; width: 100%; height: 100%; }
.eye {
  position: absolute;
  top: 40%;
  width: 9%;
  aspect-ratio: 1;
  background: var(--ink);
  border-radius: 50%;
}
.eye-l { left: 32%; }
.eye-r { right: 32%; }
.cheek {
  position: absolute;
  top: 52%;
  width: 12%;
  aspect-ratio: 1;
  background: var(--hotpink);
  opacity: 0.55;
  border-radius: 50%;
}
.cheek-l { left: 20%; }
.cheek-r { right: 20%; }
.smile {
  position: absolute;
  top: 54%;
  left: 50%;
  width: 26%;
  height: 13%;
  border: 3px solid var(--ink);
  border-top: none;
  border-radius: 0 0 50% 50%;
  transform: translateX(-50%);
}

/* burst state */
.pinata.burst .petal {
  opacity: 0;
  transform: rotate(var(--r)) translateY(calc(var(--pinata-size) * -0.75)) rotate(25deg);
}
.pinata.burst .petal-1 { --r: 0deg; }
.pinata.burst .petal-2 { --r: 51.43deg; }
.pinata.burst .petal-3 { --r: 102.86deg; }
.pinata.burst .petal-4 { --r: 154.29deg; }
.pinata.burst .petal-5 { --r: 205.71deg; }
.pinata.burst .petal-6 { --r: 257.14deg; }
.pinata.burst .petal-7 { --r: 308.57deg; }
.pinata.burst .pinata-body {
  transform: translate(-50%, -50%) scale(1.3);
  opacity: 0;
}

.placeholder-note {
  max-width: 640px;
  margin: 10px auto 0;
  text-align: center;
  font-size: 0.7rem;
  opacity: 0.7;
  line-height: 1.4;
}
.placeholder-note code {
  background: rgba(0,0,0,0.08);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ---------- pre-burst warning popup ---------- */
.warn-overlay {
  position: fixed;
  inset: 0;
  background: rgba(24, 12, 30, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 55;
  opacity: 1;
  transition: opacity 0.25s ease;
}
.warn-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.warn-panel {
  background: linear-gradient(155deg, var(--orange), var(--hotpink));
  border: 4px solid #fff;
  border-radius: 20px;
  padding: 26px 42px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  animation: warn-shake 0.5s ease-in-out infinite;
}
.warn-icon { font-size: 3rem; filter: drop-shadow(0 3px 3px rgba(0,0,0,0.3)); }
.warn-text {
  margin-top: 6px;
  font-size: 1.25rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.25);
}
@keyframes warn-shake {
  0%, 100% { transform: rotate(-3deg); }
  50%      { transform: rotate(3deg); }
}

/* ---------- winner overlay ---------- */
.win-overlay {
  position: fixed;
  inset: 0;
  background: rgba(24, 12, 30, 0.84);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  opacity: 1;
  transition: opacity 0.35s ease;
}
.win-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.win-panel {
  background: linear-gradient(180deg, #fffaf0, var(--cream));
  border: 4px solid var(--marigold);
  border-radius: 18px;
  padding: 36px 44px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  max-width: 90vw;
}
.win-shout {
  font-size: clamp(2.2rem, 8vw, 3.6rem);
  font-weight: 900;
  color: var(--hotpink);
  text-shadow: 3px 3px 0 var(--marigold);
  animation: pop-in 0.5s cubic-bezier(.34,1.56,.64,1);
}
@keyframes pop-in {
  0%   { transform: scale(0.2) rotate(-8deg); opacity: 0; }
  60%  { transform: scale(1.15) rotate(3deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
.win-sub { font-weight: 700; opacity: 0.75; margin-top: 4px; }
.win-wallet {
  margin-top: 18px;
  font-family: "Courier New", monospace;
  font-size: 1.2rem;
  font-weight: 700;
  background: #fff;
  display: inline-block;
  padding: 6px 14px;
  border-radius: 8px;
  border: 2px solid var(--ink);
  opacity: 0;
  animation: fade-up 0.5s ease forwards;
  animation-delay: 0.5s;
}
.win-amount {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: baseline;
  opacity: 0;
  animation: fade-up 0.5s ease forwards;
  animation-delay: 0.8s;
}
.win-eth { font-size: 1.6rem; font-weight: 900; color: #2fa84f; }
.win-usd { font-size: 1.1rem; font-weight: 700; opacity: 0.8; }
@keyframes fade-up {
  from { transform: translateY(10px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.win-footnote {
  margin-top: 18px;
  font-size: 0.72rem;
  opacity: 0.6;
  max-width: 320px;
}

.site-footer {
  text-align: center;
  padding: 10px;
  font-size: 0.7rem;
  opacity: 0.6;
}

@media (max-width: 640px) {
  .topbar { justify-content: center; text-align: center; }
}
