:root {
  --bg: #f7f5ef;
  --bg-tint: #efece3;
  --surface: #ffffff;
  --surface-2: #fbfaf6;
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.16);
  --text: #0b1220;
  --text-muted: #475569;
  --text-subtle: #94a3b8;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-fg: #ffffff;
  --ink: #0f172a;
  --accent: #f59e0b;
  --success: #16a34a;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 22px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 8px 28px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 18px 60px rgba(15, 23, 42, 0.14);
  --ring: 0 0 0 4px color-mix(in srgb, var(--primary) 22%, transparent);
  --ease: cubic-bezier(.32, .72, 0, 1);
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Fraunces', 'Inter', ui-serif, Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font: 16px/1.55 var(--font-sans);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
  min-height: 100dvh;
  overflow-x: hidden;
  position: relative;
}

/* Background glows */
.glow {
  position: fixed;
  z-index: 0;
  pointer-events: none;
  filter: blur(80px);
  opacity: .55;
  border-radius: 999px;
}
.glow--a {
  top: -180px; left: -120px;
  width: 520px; height: 520px;
  background: radial-gradient(circle, color-mix(in srgb, var(--primary) 30%, transparent), transparent 60%);
}
.glow--b {
  bottom: -220px; right: -160px;
  width: 560px; height: 560px;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 28%, transparent), transparent 60%);
}

/* Nav */
.nav {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1120px; margin: 0 auto;
  padding: 22px 28px;
}
.brand img { display: block; height: 34px; width: auto; }
.nav__pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 13px; font-weight: 500; color: var(--text-muted);
  box-shadow: var(--shadow-sm);
}
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 60%, transparent);
  animation: pulse 1.8s var(--ease) infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 60%, transparent); }
  70% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--success) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 0%, transparent); }
}

/* Layout */
.wrap {
  position: relative; z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 28px 80px;
}

/* Hero */
.hero { padding: 24px 0 8px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent);
}
.display {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(40px, 6.4vw, 72px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  margin: 18px 0 14px;
  max-width: 18ch;
  color: var(--ink);
}
.gradient {
  background: linear-gradient(96deg, var(--primary) 10%, #7c3aed 55%, var(--accent) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline;
}
.lede {
  font-size: clamp(16px, 1.6vw, 19px);
  color: var(--text-muted);
  max-width: 56ch;
  margin: 0 0 28px;
}

/* Hero card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}
.card--hero { padding: 28px; }
.card--hero::before {
  content: "";
  position: absolute; inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), #7c3aed, var(--accent));
}
.card__row {
  display: grid;
  grid-template-columns: minmax(0, 220px) 1fr;
  gap: 28px;
  align-items: center;
}
.prize {
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(135deg, #fff7ed, #ffe9b8);
  aspect-ratio: 16 / 10;
  display: grid; place-items: center;
  border: 1px solid var(--border);
}
.prize img { width: 100%; height: 100%; object-fit: cover; display: block; }
.meter__label {
  font-size: 13px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .14em;
  color: var(--text-subtle);
}
.meter__count {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(64px, 10vw, 112px);
  line-height: 1;
  letter-spacing: -0.045em;
  color: var(--ink);
  margin: 6px 0 14px;
  display: flex; align-items: baseline; gap: 14px;
  font-variant-numeric: tabular-nums;
}
.meter__count::after {
  content: "entries";
  font-family: var(--font-sans);
  font-size: 18px; font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text-muted);
}
.card[data-state="loading"] .meter__count [data-entries] { opacity: .35; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: var(--radius-pill);
  font-size: 13px; font-weight: 600;
  color: #7a4a02;
}
.chip__dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 28px 0 24px;
}

/* Share */
.share__label {
  display: block;
  font-size: 13px; font-weight: 600;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin: 0 0 10px;
}
.share__row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}
#refurl {
  height: 54px;
  padding: 0 18px;
  font: 500 15px/1 var(--font-sans);
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  letter-spacing: -0.01em;
  outline: none;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
  text-overflow: ellipsis;
  min-width: 0;
}
#refurl:focus { border-color: var(--primary); box-shadow: var(--ring); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 54px;
  padding: 0 22px;
  border-radius: var(--radius);
  font: 600 15px/1 var(--font-sans);
  letter-spacing: -0.005em;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 120ms var(--ease), background 160ms var(--ease), color 160ms var(--ease), border-color 160ms var(--ease), box-shadow 160ms var(--ease);
  white-space: nowrap;
}
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,.15) inset, 0 6px 18px rgba(15,23,42,.18);
}
.btn--primary:hover { background: #1e293b; }
.btn--primary.is-copied { background: var(--success); }
.btn--primary .i-check { display: none; }
.btn--primary.is-copied .i-check { display: inline; }
.btn--primary.is-copied .i-copy { display: none; }

.btn--ghost {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
  height: 44px;
  padding: 0 16px;
  font-size: 14px;
}
.btn--ghost:hover { background: var(--surface); border-color: var(--border-strong); }

.share__actions {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-top: 14px;
}

.empty {
  padding: 18px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  border: 1px dashed color-mix(in srgb, var(--accent) 50%, transparent);
  color: #6b4307;
  font-size: 14.5px;
}
.empty p { margin: 0; }

.toast {
  position: fixed;
  left: 50%; transform: translateX(-50%) translateY(20px);
  bottom: 32px;
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-pill);
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: opacity 200ms var(--ease), transform 240ms var(--ease);
  z-index: 10;
  pointer-events: none;
}
.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* How it works */
.how { margin: 88px 0 24px; }
.h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(28px, 3.6vw, 40px);
  letter-spacing: -0.025em;
  margin: 0 0 8px;
  color: var(--ink);
}
.sub {
  margin: 0 0 28px;
  color: var(--text-muted);
  font-size: 17px;
}
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: transform 200ms var(--ease), box-shadow 200ms var(--ease);
}
.step:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.step h3 {
  margin: 14px 0 6px;
  font-size: 18px; font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.step p { margin: 0; color: var(--text-muted); font-size: 14.5px; }
.step__num {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .08em;
  color: var(--text-subtle);
}
.step--accent {
  background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 6%, var(--surface)), var(--surface));
  border-color: color-mix(in srgb, var(--primary) 18%, var(--border));
}
.step--accent .step__num { color: var(--primary); }

/* Math card */
.math {
  margin-top: 22px;
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 28px;
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1.2fr;
  align-items: center;
  gap: 18px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.math::before {
  content: "";
  position: absolute; inset: -1px;
  background:
    radial-gradient(600px 200px at 0% 0%, color-mix(in srgb, var(--primary) 32%, transparent), transparent 60%),
    radial-gradient(500px 200px at 100% 100%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%);
  pointer-events: none;
}
.math__col { text-align: center; position: relative; }
.math__k {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(40px, 6vw, 64px);
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.math__v {
  margin-top: 6px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: rgba(255,255,255,.6);
}
.math__col--accent .math__k {
  background: linear-gradient(96deg, #fff, var(--accent));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.math__op {
  font-family: var(--font-display);
  font-size: clamp(24px, 3vw, 36px);
  color: rgba(255,255,255,.5);
  position: relative;
}
.math__hint {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 13px;
  color: rgba(255,255,255,.55);
  position: relative;
}

/* FAQ */
.faq { margin: 80px 0 8px; }
.faq__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.faq details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
.faq details[open] { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.faq summary {
  list-style: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-weight: 600;
  font-size: 15.5px;
  color: var(--ink);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary svg { color: var(--text-subtle); transition: transform 200ms var(--ease); flex-shrink: 0; }
.faq details[open] summary svg { transform: rotate(180deg); color: var(--primary); }
.faq p { margin: 10px 0 0; color: var(--text-muted); font-size: 14.5px; }

/* Footer */
.foot {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 28px 32px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  color: var(--text-subtle);
  font-size: 13px;
  position: relative; z-index: 1;
}
.foot__sep { color: var(--text-subtle); }

/* Responsive */
@media (max-width: 760px) {
  .nav { padding: 18px 20px; }
  .wrap { padding: 8px 20px 64px; }
  .card--hero { padding: 22px; }
  .card__row { grid-template-columns: 1fr; gap: 18px; }
  .prize { aspect-ratio: 16 / 8; max-width: 100%; }
  .meter__count { gap: 10px; }
  .meter__count::after { font-size: 15px; }
  .share__row { grid-template-columns: 1fr; }
  .btn { width: 100%; }
  .share__actions .btn { width: auto; flex: 1; }
  .steps { grid-template-columns: 1fr; }
  .math {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: auto auto auto;
    gap: 12px;
    padding: 22px;
  }
  .math__op { font-size: 22px; }
  .faq__grid { grid-template-columns: 1fr; }
  .foot { padding: 18px 20px 28px; }
}

/* Reveal */
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.card, .step, .math, .faq details, .display, .lede, .eyebrow {
  animation: rise 600ms var(--ease) both;
}
.lede { animation-delay: 60ms; }
.card { animation-delay: 120ms; }
.step:nth-child(2) { animation-delay: 80ms; }
.step:nth-child(3) { animation-delay: 140ms; }
.step:nth-child(4) { animation-delay: 200ms; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
