:root {
  /* Buddy's Deli colours (olive and cream from the logo) after dark, plus pumpkin orange */
  --night: #12170b;
  --night-2: #263219;
  --card: #222c16;
  --line: #3f4f2b;
  --olive: #55692d;
  --cream: #fff6ea;
  --orange: #ff8a1f;
  --orange-soft: #ffb066;
  --green: #a9c45e;
  --text: #fff6ea;
  --muted: #c9c8a7;
  --radius: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Nunito', system-ui, sans-serif;
  color: var(--text);
  background: radial-gradient(ellipse at top, var(--night-2), var(--night) 60%) fixed, var(--night);
  line-height: 1.5;
}

.wrap {
  position: relative;
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 16px calc(40px + env(safe-area-inset-bottom));
}

h1, h2 { margin: 0 0 8px; }
h1 {
  font-family: 'Creepster', 'Nunito', cursive; font-weight: 400; letter-spacing: 1px; color: var(--orange);
  font-size: clamp(2.4rem, 11vw, 3.4rem); line-height: 1.05; text-shadow: 0 0 18px rgba(255, 138, 31, .45);
}
h2 { font-family: 'Fraunces', Georgia, serif; font-weight: 900; font-size: 1.6rem; color: var(--cream); letter-spacing: -.3px; }

/* ----- Header ----- */

.hero { text-align: center; padding: 20px 0 12px; position: relative; }
.moon {
  width: 150px; height: 150px; margin: 0 auto; border-radius: 50%;
  background: radial-gradient(circle at 38% 35%, #fffbe8, #f6e3a1 55%, #d9bd6a);
  box-shadow: 0 0 60px 18px rgba(246, 227, 161, .28);
}
/* The logo sits in front of the moon like a sign, with a spider dangling off it */
.logo-wrap { position: relative; width: 200px; max-width: 62%; margin: -78px auto 18px; transform: rotate(-3deg); }
.logo {
  display: block; width: 100%; height: auto; border-radius: 16px; border: 3px solid var(--cream);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .55), 0 0 0 6px rgba(255, 138, 31, .25);
}
.spider { position: absolute; right: -26px; top: -6px; width: 2px; height: 58px; background: rgba(255, 246, 234, .55); transform-origin: top center; animation: dangle 3s ease-in-out infinite; }
.spider span { position: absolute; left: 50%; bottom: -14px; transform: translateX(-50%); font-size: 1.4rem; }
.intro { margin: 8px 0 0; font-size: 1.05rem; }

.notice {
  background: #3d2a10; border: 1px solid var(--orange); border-radius: 12px;
  padding: 12px 14px; margin: 16px 0; font-weight: 700;
}

/* ----- Progress ----- */

.progress-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 12px; margin: 20px 0 28px;
  text-align: center; box-shadow: 0 8px 30px rgba(0, 0, 0, .35);
}
.pumpkins { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; font-size: 2.3rem; }
.pumpkin { filter: grayscale(1) brightness(.45); transition: filter .4s, transform .4s; }
.pumpkin.lit { filter: drop-shadow(0 0 8px rgba(255, 138, 31, .9)); transform: scale(1.08); }
.count { margin: 8px 0 0; font-weight: 800; font-size: 1.2rem; }

/* ----- Clues ----- */

.tip { color: var(--muted); margin-top: 0; }
.clues { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.clue {
  background: var(--card); border-radius: var(--radius); padding: 14px 16px;
  border: 2px solid var(--line);
}
.clue.done { border-color: var(--green); background: #2c3a1b; }
.clue-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.clue-num {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--orange); color: var(--night); font-weight: 800;
}
.clue.done .clue-num { background: var(--green); color: var(--night); }
.clue-name { font-weight: 800; }
.clue:not(.done) .clue-name { color: var(--muted); font-style: italic; }
.clue-text { margin: 0; font-size: 1.02rem; }
.clue.done .clue-text { color: var(--muted); }

/* ----- Prize ----- */

.prize {
  text-align: center; margin: 20px 0; padding: 22px 16px; border-radius: var(--radius);
  background: linear-gradient(160deg, #ff9a35, #d24d0c);
  color: #fff; box-shadow: 0 0 40px rgba(255, 138, 31, .45);
}
.prize h2 { font-family: 'Creepster', cursive; font-weight: 400; font-size: 2rem; letter-spacing: 1px; color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .25); }
.prize.claimed { background: var(--olive); box-shadow: none; }
.prize-icon { font-size: 3.4rem; }
.prize-icon.spin { animation: wobble 2s ease-in-out infinite; }
.prize-what { font-size: 1.25rem; font-weight: 800; margin: 0 0 10px; }
.prize-code {
  display: inline-block; font-family: ui-monospace, Menlo, monospace; font-size: 1.6rem; font-weight: 800;
  letter-spacing: 3px; background: rgba(0, 0, 0, .3); padding: 6px 14px; border-radius: 10px; margin: 4px 0;
}
.prize-clock { font-weight: 700; margin: 8px 0; animation: pulse 1s ease-in-out infinite alternate; }
.prize-how { margin: 8px 0 16px; }

/* ----- Buttons & modal ----- */

.btn {
  font: inherit; font-weight: 800; font-size: 1.05rem; border: 0; border-radius: 999px;
  padding: 12px 24px; background: var(--orange); color: var(--night); cursor: pointer;
}
.btn-ghost { background: transparent; color: #fff; border: 2px solid rgba(255, 255, 255, .7); font-size: .9rem; padding: 8px 16px; }

.modal {
  position: fixed; inset: 0; background: rgba(10, 13, 6, .85); display: grid; place-items: center;
  padding: 16px; z-index: 10;
}
.modal[hidden] { display: none; }
.modal-card {
  background: var(--card); border: 2px solid var(--orange); border-radius: var(--radius);
  max-width: 400px; width: 100%; padding: 24px 20px; text-align: center; animation: pop .35s ease-out;
}
.modal-icon { font-size: 3.6rem; }

.foot { color: var(--muted); font-size: .85rem; text-align: center; margin-top: 32px; }

/* ----- Flying bats ----- */

.sky { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.bat { position: absolute; font-size: 1.6rem; opacity: .7; animation: fly 14s linear infinite; }
.b1 { top: 8%; animation-delay: 0s; }
.b2 { top: 22%; animation-delay: -5s; font-size: 1.2rem; animation-duration: 18s; }
.b3 { top: 48%; animation-delay: -10s; font-size: 1rem; animation-duration: 22s; }

@keyframes fly {
  from { transform: translateX(-10vw) translateY(0); }
  50% { transform: translateX(50vw) translateY(-20px); }
  to { transform: translateX(110vw) translateY(10px); }
}
@keyframes dangle { 0%, 100% { transform: rotate(6deg) scaleY(1); } 50% { transform: rotate(-6deg) scaleY(1.15); } }
@keyframes wobble { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg) scale(1.1); } }
@keyframes pulse { from { opacity: .7; } to { opacity: 1; } }
@keyframes pop { from { transform: scale(.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .bat, .prize-icon.spin, .modal-card, .spider { animation: none; }
}

/* ----- Sign-up ----- */

.join { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 16px; margin: 20px 0; box-shadow: 0 8px 30px rgba(0, 0, 0, .35); }
.join label { display: block; font-weight: 800; margin-bottom: 6px; }
.join input[type=email] {
  width: 100%; font: inherit; font-size: 1.05rem; padding: 12px 14px; border-radius: 12px;
  border: 2px solid var(--line); background: var(--night); color: var(--text);
}
.join input[type=email]:focus { outline: none; border-color: var(--orange); }
.join .check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 14px 0; }
.join .check input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--orange); }
.join .btn { width: 100%; }
.join-pending { background: #3d2a10; border-radius: 12px; padding: 10px 12px; font-weight: 700; }
.error { color: #ff9b9b; font-weight: 700; }
.small { color: var(--muted); font-size: .85rem; margin: 10px 0 0; }
.link { font: inherit; background: none; border: 0; padding: 0; color: var(--orange-soft); text-decoration: underline; cursor: pointer; }
.loading { text-align: center; color: var(--muted); }
.prize-label { margin: 0; font-size: .85rem; text-transform: uppercase; letter-spacing: 2px; font-weight: 800; }
.btn:disabled { opacity: .6; }

/* Cobweb in the top corner */
.cobweb { position: fixed; top: 0; left: 0; width: 120px; height: 120px; opacity: .22; pointer-events: none; z-index: 0; }
.wrap { z-index: 1; }

/* ----- Scan button and camera screen ----- */

.scan-btn {
  position: sticky; top: 10px; z-index: 5; display: block; width: 100%; margin: 4px 0 0;
  font-size: 1.15rem; padding: 14px 24px; box-shadow: 0 6px 24px rgba(0, 0, 0, .5), 0 0 0 4px rgba(255, 138, 31, .25);
}
.scan-btn[hidden] { display: none; }

.scanner { position: fixed; inset: 0; z-index: 20; background: #000; }
.scanner[hidden] { display: none; }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-frame {
  position: absolute; left: 50%; top: 42%; width: min(70vw, 70vh, 320px); aspect-ratio: 1;
  transform: translate(-50%, -50%); border-radius: 24px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45); border: 4px solid var(--orange);
}
.scan-bottom {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 20px 16px calc(24px + env(safe-area-inset-bottom));
  text-align: center; background: linear-gradient(transparent, rgba(0, 0, 0, .8) 35%);
}
.scan-msg { font-weight: 800; font-size: 1.1rem; margin: 0 0 14px; text-shadow: 0 1px 4px #000; }
