/* Mr Pumpkin Hunt.
 *
 * Dark by design, not by fashion: two October dates run to 6pm and the last
 * week closes on dusk, so a white screen is a torch in a child's face.
 * Everything assumes a phone held one-handed, in a field, by someone with
 * cold wet fingers.
 *
 * All colour lives in the tokens below. Restyling to match the main Mr
 * Pumpkin site means editing this block and very little else.
 */
:root {
  /* Taken from mrpumpkin.pages.dev: a warm near-black brown, bright orange
     as the single accent, cream text. Everything else in this file derives
     from these - to reskin, edit here and nowhere else. */
  --night:      #140d08;
  --night-2:    #241710;
  --night-3:    #33200f;
  --raise:      rgba(255, 236, 214, 0.055);
  --line:       rgba(255, 226, 196, 0.12);
  --line-warm:  rgba(249, 115, 22, 0.42);
  --ink:        #f8efe4;
  --muted:      #c3ad98;
  --dim:        #8d7864;
  --orange:     #f97316;
  --orange-2:   #fb9e3e;
  --orange-3:   #fdc270;
  --green:      #8bc766;
  --cream:      #fbe7c8;
  --wrap:       680px;
  --radius:     24px;
  --radius-sm:  16px;
  --tap:        54px;  /* minimum tap target - gloves, mud, cold hands */
  --shadow:     0 22px 48px -26px rgba(0, 0, 0, 0.95);
}

* { box-sizing: border-box; }

html { background: var(--night); }

body {
  margin: 0;
  min-height: 100svh;
  color: var(--ink);
  font-family: "Fredoka", ui-rounded, "Segoe UI", system-ui, -apple-system, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  position: relative;
  /* Warm brown dusk with an orange ambient glow, the same feel as the main
     Mr Pumpkin site rather than the plum night this started as. */
  background:
    radial-gradient(130% 68% at 50% 116%, rgba(249, 115, 22, 0.34) 0%, rgba(249, 115, 22, 0.09) 44%, transparent 70%),
    radial-gradient(95% 50% at 6% -6%, rgba(249, 115, 22, 0.2), transparent 62%),
    radial-gradient(85% 44% at 96% 2%, rgba(180, 83, 20, 0.16), transparent 60%),
    linear-gradient(180deg, #1a1009 0%, #150d07 48%, #110a05 100%);
  background-attachment: fixed;
}

/* Starfield. Three sizes of dot, fixed so it reads as sky rather than
   texture scrolling with the page. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(1.6px 1.6px at 18% 12%, rgba(255,234,204,.5), transparent 60%),
    radial-gradient(1.2px 1.2px at 74% 8%,  rgba(255,226,190,.36), transparent 60%),
    radial-gradient(1.8px 1.8px at 42% 22%, rgba(255,241,214,.45), transparent 60%),
    radial-gradient(1.1px 1.1px at 88% 26%, rgba(255,230,198,.3), transparent 60%),
    radial-gradient(1.4px 1.4px at 8% 34%,  rgba(255,226,190,.26), transparent 60%),
    radial-gradient(1.2px 1.2px at 60% 38%, rgba(255,241,214,.28), transparent 60%),
    radial-gradient(1.5px 1.5px at 30% 6%,  rgba(255,226,190,.36), transparent 60%);
  mask-image: linear-gradient(180deg, #000 0%, #000 34%, transparent 62%);
}

/* The horizon: a field with a few pumpkins and a bare tree, sat at the foot
   of the page. Anchored to the end of the document rather than fixed to the
   viewport - fixed meant it drifted through the middle of the grid as a dark
   band, which reads as a rendering fault rather than scenery. Decorative
   only, and it never intercepts a tap. */
body::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 190px;
  pointer-events: none;
  z-index: 0;
  background: url("/assets/field.svg") bottom center / 1200px 190px repeat-x;
  opacity: 0.75;
  mask-image: linear-gradient(180deg, transparent 0%, #000 48%);
}

img, svg { max-width: 100%; display: block; }
a { color: var(--orange-2); }

.wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 18px calc(46px + env(safe-area-inset-bottom));
}

/* ---------- header ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: linear-gradient(180deg, rgba(20,13,8,.97) 60%, rgba(20,13,8,.86));
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.topbar-in {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 11px 18px 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 600; font-size: 16px;
  color: var(--ink); text-decoration: none;
  letter-spacing: .005em;
}
.brand svg { width: 22px; height: 22px; flex: none; }
.count {
  margin-left: auto;
  font-weight: 600; font-size: 14px;
  color: var(--orange-3);
  white-space: nowrap;
  padding: 5px 12px;
  border-radius: 99px;
  background: rgba(249, 115, 22, .14);
  border: 1px solid rgba(249, 115, 22, .3);
}

/* Ten pips rather than a bar: you can count what is left at a glance, which
   a percentage never tells you. */
.pips {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 18px 11px;
  display: flex;
  gap: 5px;
}
.pip {
  flex: 1;
  height: 5px;
  border-radius: 99px;
  background: var(--night-3);
  transition: background .45s ease, box-shadow .45s ease;
}
.pip.on {
  background: linear-gradient(90deg, var(--orange), var(--orange-3));
  box-shadow: 0 0 10px rgba(242, 129, 29, .5);
}

/* ---------- type ---------- */

h1, h2, h3 { margin: 0; line-height: 1.1; font-weight: 700; letter-spacing: -.012em; }
h1 { font-size: clamp(32px, 8.4vw, 44px); }
h2 { font-size: 22px; }
p  { margin: 0; line-height: 1.62; color: var(--muted); }
.lede { font-size: 17px; color: #ded3e6; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 600;
  letter-spacing: .17em; text-transform: uppercase;
  color: var(--orange-2);
}
.eyebrow::before {
  content: ""; width: 18px; height: 1.5px; border-radius: 2px;
  background: linear-gradient(90deg, var(--orange), transparent);
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; min-height: var(--tap);
  padding: 15px 24px;
  border: 1px solid transparent; border-radius: 99px;
  font: inherit; font-weight: 600; font-size: 16.5px;
  text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .14s ease, filter .18s ease;
}
.btn-primary {
  background: linear-gradient(180deg, var(--orange-2), var(--orange));
  color: #2b1503;
  box-shadow: 0 12px 26px -12px rgba(242, 129, 29, .75);
}
.btn-ghost { background: var(--raise); border-color: var(--line); color: var(--ink); }
.btn:active { transform: scale(.975); filter: brightness(1.06); }
.btn[disabled] { opacity: .55; pointer-events: none; }

/* ---------- cards ---------- */

.card {
  position: relative;
  background: linear-gradient(180deg, var(--night-2), rgba(29,22,41,.72));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card-warm { border-color: var(--line-warm); }

.stack > * + * { margin-top: 15px; }
.stack-lg > * + * { margin-top: 28px; }

/* ---------- the grid ---------- */

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 13px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, 1fr); } }

.tile {
  position: relative;
  display: block;
  padding: 12px 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--night-2), rgba(24,18,34,.66));
  color: inherit; text-decoration: none;
  min-height: 166px;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  transition: transform .16s ease, border-color .25s ease;
}
.tile-art {
  display: flex; align-items: flex-end; justify-content: center;
  height: 104px; margin-bottom: 9px;
}
/* Relative sizing: a Jill Be Little really is a quarter of a Grizzly Bear,
   and seeing that is an identification aid, not decoration. */
.tile-art img { width: auto; height: auto; max-height: 100%; }
.tile-name { font-size: 14.5px; font-weight: 600; text-align: center; line-height: 1.22; }
.tile-sub  { font-size: 11px; text-align: center; color: var(--dim); margin-top: 4px; line-height: 1.4; }

/* Not-found state. The pumpkin shows in full, because with fifty varieties
   growing out there, knowing what you are looking for is the game - a
   silhouette helps nobody spot a Porcelain Doll. Found and not-found are told
   apart by the dashed edge and the tick, not by hiding the fruit. */
.tile.locked {
  border-style: dashed;
  border-color: rgba(255, 226, 196, .14);
  background: rgba(255, 236, 214, .02);
}
.tile.locked .tile-art img { opacity: .62 }
.tile.locked .tile-name { color: var(--muted) }

.tile.found { border-color: var(--line-warm); }
.tile.found::before {
  content: "";
  position: absolute;
  left: 50%; top: 14px;
  width: 116px; height: 88px;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(242,129,29,.3), transparent 72%);
  pointer-events: none;
}
.tile.found:active { transform: scale(.975); }

.badge {
  position: absolute;
  top: 9px; right: 9px;
  width: 24px; height: 24px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
}
.badge-found { background: linear-gradient(180deg, var(--orange-2), var(--orange)); color: #2b1503; }

/* ---------- tags ---------- */

.tag {
  display: inline-flex; align-items: center;
  padding: 6px 13px; border-radius: 99px;
  font-size: 12.5px; font-weight: 600;
  border: 1px solid;
}
.tag-eat   { color: var(--green);    border-color: rgba(139,199,102,.4); background: rgba(139,199,102,.1); }
.tag-carve { color: var(--orange-2); border-color: rgba(242,129,29,.4); background: rgba(242,129,29,.1); }
.tag-show  { color: var(--orange-3); border-color: rgba(253,194,112,.36); background: rgba(253,194,112,.1); }

/* ---------- the reveal ---------- */

.hero-art { position: relative; display: grid; place-items: center; padding: 6px 0 2px; }
.hero-art::before {
  content: "";
  position: absolute;
  width: min(330px, 84vw); aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(242,129,29,.28), rgba(242,129,29,.07) 58%, transparent 74%);
  animation: breathe 5s ease-in-out infinite;
}
.hero-art img {
  position: relative;
  width: min(270px, 68vw);
  filter: drop-shadow(0 22px 26px rgba(0,0,0,.55));
  animation: pop .6s cubic-bezier(.2, 1.35, .35, 1) both;
}
@keyframes pop { from { transform: scale(.7) rotate(-8deg); opacity: 0 } to { transform: none; opacity: 1 } }
@keyframes breathe { 0%, 100% { transform: scale(1); opacity: .9 } 50% { transform: scale(1.07); opacity: 1 } }
@keyframes riseIn { from { transform: translateY(14px); opacity: 0 } to { transform: none; opacity: 1 } }

.reveal-line > * { animation: riseIn .5s ease both; }
.reveal-line > *:nth-child(1) { animation-delay: .1s }
.reveal-line > *:nth-child(2) { animation-delay: .17s }
.reveal-line > *:nth-child(3) { animation-delay: .24s }
.reveal-line > *:nth-child(4) { animation-delay: .31s }

.found-flash {
  text-align: center;
  font-size: 12.5px; font-weight: 700;
  letter-spacing: .17em; text-transform: uppercase;
  color: var(--orange-3);
}
.found-flash.quiet { color: var(--dim); }

.fact {
  position: relative;
  padding: 15px 17px 15px 19px;
  border-radius: var(--radius-sm);
  background: rgba(249,115,22,.075);
  border: 1px solid rgba(249,115,22,.2);
  font-size: 15px; color: var(--cream);
  line-height: 1.6;
}
.fact::before {
  content: ""; position: absolute; left: 0; top: 13px; bottom: 13px;
  width: 3px; border-radius: 99px; background: var(--orange);
}

.meta-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.meta-size { font-size: 13px; color: var(--dim); }

/* ---------- completion ---------- */

.trophy { text-align: center; padding: 6px 0 2px; }
.trophy-ring {
  width: 92px; height: 92px; margin: 0 auto 4px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 42px;
  background: radial-gradient(closest-side, rgba(249,115,22,.3), transparent 76%);
  animation: breathe 4s ease-in-out infinite;
}
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.confetti i {
  position: absolute; top: -14px;
  width: 8px; height: 13px; border-radius: 2px;
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translateY(105vh) rotate(760deg); opacity: 0 }
}

@media (prefers-reduced-motion: reduce) {
  .hero-art img, .hero-art::before, .reveal-line > *, .trophy-ring { animation: none !important }
  .confetti { display: none }
  .pip { transition: none }
}

/* ---------- forms ---------- */

label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 7px; }
input[type="email"], input[type="text"] {
  width: 100%; min-height: var(--tap);
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,.26);
  color: var(--ink);
  font: inherit; font-size: 16px;  /* 16px or iOS zooms the page on focus */
}
input::placeholder { color: #6b6076 }
input:focus-visible, .btn:focus-visible, .tile:focus-visible {
  outline: 3px solid var(--orange-2); outline-offset: 2px;
}
.code-input { text-transform: lowercase; letter-spacing: .3em; text-align: center; font-weight: 600; font-size: 19px }
.hint-text  { font-size: 13px; color: var(--dim) }
.form-note  { font-size: 12px; color: #857a91; line-height: 1.55 }

.msg { font-size: 14px; font-weight: 600; padding: 13px 15px; border-radius: var(--radius-sm) }
.msg-ok  { background: rgba(139,199,102,.13); color: var(--green) }
.msg-bad { background: rgba(249,115,22,.14); color: var(--orange-2) }

/* ---------- offline + footer ---------- */

.offline {
  position: relative; z-index: 1;
  display: none; text-align: center;
  font-size: 13px; font-weight: 600;
  padding: 10px 16px;
  background: rgba(249,115,22,.16);
  color: var(--orange-3);
}
body.is-offline .offline { display: block }

.foot {
  margin-top: 40px; padding-top: 20px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 12px; color: #6f6479; line-height: 1.8;
}
.foot a { color: #9b8fa6; text-decoration: none }

.hide { display: none !important }

/* ---------- screens ---------- */
/* The hunt is one page in three states: start, hunting, finished. Screens
   rather than separate documents so nothing needs the network to move
   between them - out in the field there may not be any. */

.screen { animation: riseIn .4s ease both }

.hero-card {
  position: relative;
  overflow: hidden;
  padding: 30px 24px 26px;
}
.hero-card::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(90% 60% at 18% 0%, rgba(249,115,22,.16), transparent 62%);
  pointer-events: none;
}
.hero-card > * { position: relative }

.chips { display: flex; gap: 9px; flex-wrap: wrap }
.chip {
  flex: 1 1 0;
  min-width: 94px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--raise);
  border: 1px solid var(--line);
}
.chip b { display: block; font-size: 16px; font-weight: 700; color: var(--ink); white-space: nowrap }
.chip span { display: block; font-size: 11.5px; color: var(--dim); margin-top: 2px; line-height: 1.35 }

/* The email ask. Deliberately skippable: asking before anyone has had the
   fun costs players, and a family stood in a field with no signal cannot
   answer it at all. */
.skip {
  display: block;
  width: 100%;
  margin-top: 2px;
  padding: 13px;
  background: none;
  border: 0;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--dim);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.skip:active { color: var(--muted) }

.saved-note {
  display: flex; align-items: center; gap: 9px;
  font-size: 13px; font-weight: 600;
  color: var(--green);
}

/* The finish button only becomes real once all ten are in. Showing it
   greyed from the start tells a family there is an end to reach. */
.finish-cta { margin-top: 22px }
.finish-cta .btn[disabled] { opacity: .4 }
.finish-hint { text-align: center; font-size: 13px; color: var(--dim); margin-top: 10px }

/* ---------- the scanner ---------- */

.scan-stage {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--line);
}
.scan-stage video {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

/* A cut-out frame so people know where to aim. Corner brackets rather than a
   full box - a solid border competes with the code itself. */
.scan-frame {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: grid;
  place-items: center;
}
.scan-frame i {
  width: min(66%, 240px);
  aspect-ratio: 1;
  border-radius: 20px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45);
  outline: 2px solid rgba(255, 255, 255, .5);
  outline-offset: -2px;
}
.scan-frame i::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: min(66%, 240px);
  height: 2px;
  transform: translate(-50%, -50%);
  background: linear-gradient(90deg, transparent, var(--orange-2), transparent);
  animation: sweep 2.4s ease-in-out infinite;
}
@keyframes sweep {
  0%, 100% { transform: translate(-50%, calc(-50% - min(33vw, 116px))); opacity: .3 }
  50%      { transform: translate(-50%, calc(-50% + min(33vw, 116px))); opacity: 1 }
}

.scan-tip {
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  margin-top: 14px;
}

.torch {
  position: absolute;
  right: 12px; bottom: 12px;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.28);
  background: rgba(0,0,0,.5);
  color: #fff;
  font-size: 20px;
  display: grid; place-items: center;
  cursor: pointer;
}
.torch.on { background: var(--orange); color: #2b1503; border-color: transparent }

@media (prefers-reduced-motion: reduce) { .scan-frame i::after { animation: none } }

/* ---------- per-tile scan ---------- */

.tile-scan {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 9px 8px;
  border-radius: 99px;
  border: 1px solid rgba(249, 115, 22, .42);
  background: rgba(249, 115, 22, .12);
  color: var(--orange-3);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tile-scan:active { background: rgba(249, 115, 22, .24) }
.tile.found .tile-scan { display: none }

/* ---------- finishing early ---------- */

.confirm {
  margin-top: 14px;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line-warm);
  background: var(--night-2);
}
.confirm h3 { margin: 0 0 6px; font-size: 18px; font-weight: 700 }
.confirm p { font-size: 14px; margin-bottom: 14px }
.confirm .row { display: flex; gap: 10px }
.confirm .row .btn { font-size: 15px; padding: 13px 16px }
