/* hoopla — the over-the-top gauntlet stylesheet.
   Mobile-first. Everything self-hosted, no external fonts or assets. */

:root {
  --accent: #ff4d6d;
  --accent-soft: color-mix(in srgb, var(--accent) 55%, #ffd23f);
  --bg-0: #0e0b1a;
  --bg-1: #1b1033;
  --bg-2: #2a0f3a;
  --ink: #f6f2ff;
  --ink-dim: #b9aee0;
  --card: rgba(255, 255, 255, 0.06);
  --card-border: rgba(255, 255, 255, 0.14);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --radius: 22px;
  --ease-pop: cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  min-height: 100dvh;
  font-family: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(120% 90% at 20% -10%, var(--bg-2) 0%, transparent 55%),
    radial-gradient(120% 100% at 90% 10%, color-mix(in srgb, var(--accent) 40%, var(--bg-1)) 0%, transparent 50%),
    linear-gradient(160deg, var(--bg-0), var(--bg-1) 60%, var(--bg-0));
  background-attachment: fixed;
  overflow-x: hidden;
}

/* ---- background shimmer + screen shake ---------------------------------- */
body::before {
  content: "";
  position: fixed;
  inset: -25%;
  background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 60%);
  opacity: 0.35;
  animation: drift 18s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 0;
}

@keyframes drift {
  from { transform: translate3d(-4%, -2%, 0) scale(1); }
  to   { transform: translate3d(4%, 3%, 0) scale(1.15); }
}

body.shake #stage { animation: shake 0.6s ease-in-out; }
@keyframes shake {
  0%, 100% { transform: translate3d(0, 0, 0); }
  20% { transform: translate3d(-8px, 4px, 0) rotate(-1deg); }
  40% { transform: translate3d(7px, -6px, 0) rotate(1deg); }
  60% { transform: translate3d(-6px, 5px, 0) rotate(-0.6deg); }
  80% { transform: translate3d(5px, -3px, 0) rotate(0.4deg); }
}

/* ---- confetti canvas sits above everything ------------------------------ */
#confetti {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  pointer-events: none;
  z-index: 40;
}

/* ---- ambient floating dots ---------------------------------------------- */
.ambient {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}
.ambient span {
  position: absolute;
  bottom: -10vh;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 60%, #fff);
  opacity: 0.18;
  animation: rise linear infinite;
}
.ambient span:nth-child(1)  { left: 6%;  width: 8px;  animation-duration: 15s; animation-delay: -2s; }
.ambient span:nth-child(2)  { left: 18%; width: 16px; animation-duration: 21s; animation-delay: -8s; }
.ambient span:nth-child(3)  { left: 30%; width: 6px;  animation-duration: 12s; animation-delay: -1s; }
.ambient span:nth-child(4)  { left: 42%; width: 20px; animation-duration: 24s; animation-delay: -14s; }
.ambient span:nth-child(5)  { left: 54%; width: 10px; animation-duration: 18s; animation-delay: -5s; }
.ambient span:nth-child(6)  { left: 63%; width: 14px; animation-duration: 20s; animation-delay: -11s; }
.ambient span:nth-child(7)  { left: 72%; width: 7px;  animation-duration: 13s; animation-delay: -3s; }
.ambient span:nth-child(8)  { left: 81%; width: 18px; animation-duration: 23s; animation-delay: -16s; }
.ambient span:nth-child(9)  { left: 89%; width: 9px;  animation-duration: 16s; animation-delay: -6s; }
.ambient span:nth-child(10) { left: 96%; width: 12px; animation-duration: 19s; animation-delay: -9s; }
@keyframes rise {
  to { transform: translateY(-120vh) scale(1.4); opacity: 0; }
}

/* ---- stage layout ------------------------------------------------------- */
#stage {
  position: relative;
  z-index: 2;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
}

.stage {
  grid-area: 1 / 1;
  width: min(560px, 100%);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  opacity: 0;
  transform: translateY(26px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.5s ease, transform 0.5s var(--ease-pop);
}
.stage.is-active {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.stage.is-leaving {
  opacity: 0;
  transform: translateY(-24px) scale(0.97);
  transition: opacity 0.32s ease, transform 0.32s ease;
}

.headline {
  margin: 0;
  font-size: clamp(1.8rem, 7vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
  text-shadow: 0 6px 30px rgba(0, 0, 0, 0.35);
}
.headline em { color: var(--accent-soft); font-style: italic; }
.accent {
  color: var(--accent);
  filter: drop-shadow(0 0 18px color-mix(in srgb, var(--accent) 60%, transparent));
}
.sub {
  margin: 0;
  font-size: clamp(1rem, 3.6vw, 1.25rem);
  color: var(--ink-dim);
  max-width: 34ch;
}
.taunt {
  min-height: 1.4em;
  margin: 0;
  font-size: 1rem;
  font-style: italic;
  color: var(--accent-soft);
}

/* ---- teaser gift -------------------------------------------------------- */
.teaser {
  font-size: clamp(5rem, 26vw, 9rem);
  filter: drop-shadow(0 18px 34px rgba(0, 0, 0, 0.5));
  animation: teaser-bob 2.4s ease-in-out infinite;
}
@keyframes teaser-bob {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50%      { transform: translateY(-14px) rotate(4deg); }
}

/* ---- optional emote avatar --------------------------------------------- */
.emote {
  width: clamp(96px, 30vw, 132px);
  height: clamp(96px, 30vw, 132px);
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--accent);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: var(--shadow), 0 0 26px color-mix(in srgb, var(--accent) 55%, transparent);
  animation: emote-bob 3s ease-in-out infinite;
}
@keyframes emote-bob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%      { transform: translateY(-10px) rotate(2deg); }
}
.emote--card {
  width: clamp(80px, 22vw, 104px);
  height: clamp(80px, 22vw, 104px);
  margin-bottom: 4px;
}

/* ---- buttons ------------------------------------------------------------ */
.btn {
  font: inherit;
  font-weight: 700;
  border: none;
  cursor: pointer;
  padding: 16px 30px;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  box-shadow: var(--shadow), 0 0 0 rgba(255, 255, 255, 0);
  transition: transform 0.18s var(--ease-pop), box-shadow 0.3s ease, filter 0.2s ease;
  touch-action: manipulation;
}
.btn:hover { transform: translateY(-2px) scale(1.03); }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn--primary {
  font-size: 1.2rem;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: var(--shadow), 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
  50%      { box-shadow: var(--shadow), 0 0 0 18px rgba(255, 77, 109, 0); }
}
.btn--ghost {
  background: transparent;
  border: 2px solid var(--card-border);
  color: var(--ink);
  box-shadow: none;
}
.btn--yes { background: linear-gradient(135deg, #2dd47f, #7ef0a9); color: #06251a; }
.btn--no  { background: linear-gradient(135deg, #4a3f6b, #6a5a92); }

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  position: relative;
  width: 100%;
}
/* the runaway "no" button pops out of flow once it starts dodging */
.btn--no.is-loose {
  position: fixed;
  z-index: 30;
  margin: 0;
  transition: left 0.18s ease, top 0.18s ease, transform 0.18s ease;
}

/* ---- charge (press & hold) --------------------------------------------- */
.charge {
  position: relative;
  width: min(280px, 80vw);
  height: 96px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  overflow: hidden;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid var(--card-border);
  box-shadow: var(--shadow);
  touch-action: none;
  user-select: none;
}
.charge__fill {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  transform: scaleX(0);
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  transition: transform 0.08s linear;
}
.charge__label {
  position: relative;
  z-index: 1;
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: 0.25em;
}
.charge.is-charging { animation: charge-buzz 0.35s ease-in-out infinite; }
@keyframes charge-buzz {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-1.5px, 1px); }
  75% { transform: translate(1.5px, -1px); }
}

/* ---- giftbox ------------------------------------------------------------ */
.giftbox {
  position: relative;
  width: 200px;
  height: 200px;
  border: none;
  background: transparent;
  cursor: pointer;
  filter: drop-shadow(0 24px 40px rgba(0, 0, 0, 0.5));
  animation: box-idle 2.6s ease-in-out infinite;
  touch-action: manipulation;
}
@keyframes box-idle {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50%      { transform: translateY(-8px) rotate(1deg); }
}
.giftbox.is-shaking { animation: box-shake 0.4s ease-in-out; }
@keyframes box-shake {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-7deg) scale(1.04); }
  75% { transform: rotate(7deg) scale(1.04); }
}
.giftbox__base {
  position: absolute;
  left: 20px;
  bottom: 0;
  width: 160px;
  height: 130px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #000));
}
.giftbox__ribbon {
  position: absolute;
  left: 50%;
  top: 0;
  width: 26px;
  height: 100%;
  transform: translateX(-50%);
  background: var(--accent-soft);
}
.giftbox__lid {
  position: absolute;
  left: 6px;
  top: 30px;
  width: 188px;
  height: 44px;
  border-radius: 8px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 85%, #fff 15%), var(--accent));
  transform-origin: center bottom;
  transition: transform 0.5s var(--ease-pop), opacity 0.5s ease;
  z-index: 2;
}
.giftbox__bow {
  position: absolute;
  left: 50%;
  top: -26px;
  width: 54px;
  height: 34px;
  transform: translateX(-50%);
  background: var(--accent-soft);
  border-radius: 50% 50% 45% 45% / 60% 60% 40% 40%;
  box-shadow: -22px 4px 0 -6px var(--accent-soft), 22px 4px 0 -6px var(--accent-soft);
}
.giftbox.is-open .giftbox__lid {
  transform: translateY(-160px) rotate(24deg);
  opacity: 0;
}
.giftbox.is-open { animation: none; }

/* ---- finale card -------------------------------------------------------- */
.card {
  width: 100%;
  padding: 40px 30px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
}
.card__eyebrow {
  margin: 0;
  font-size: 1.1rem;
  color: var(--ink-dim);
}
.card__message {
  margin: 0;
  font-size: clamp(1.8rem, 8vw, 3.4rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-wrap: balance;
  background: linear-gradient(120deg, #fff, var(--accent-soft), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: message-in 0.7s var(--ease-pop) both;
}
@keyframes message-in {
  from { opacity: 0; transform: scale(0.6) rotate(-3deg); }
  to   { opacity: 1; transform: none; }
}
.card__sign {
  margin: 0;
  font-size: 0.95rem;
  font-style: italic;
  color: var(--ink-dim);
}

/* ---- accessibility: respect reduced motion ------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.12s !important;
  }
  .ambient { display: none; }
}
