@font-face { font-family: "Creepster"; src: url(vendor/fonts/creepster.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Nunito"; src: url(vendor/fonts/nunito.woff2) format("woff2"); font-weight: 200 1000; font-display: swap; }

:root {
  --night: #140c24;
  --night-2: #21143a;
  --plum: #34205a;
  --pumpkin: #ff6a13;
  --candle: #ffb347;
  --bone: #f3ead8;
  --bone-dim: rgba(243, 234, 216, .66);
  --violet: #b48cff;
  --teal: #2ec4d6;
  --mint: #5fe3a1;
  --line: rgba(243, 234, 216, .12);
  --glass: rgba(29, 17, 51, .94);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --peek: 300px;
  --display: "Creepster", "Chiller", fantasy, cursive;
  --body: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--night); color: var(--bone); font-family: var(--body); overflow: hidden; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--candle); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- Map ---------- */
#map { position: fixed; inset: 0; background: var(--night); z-index: 0; }
.leaflet-container { font-family: var(--body); background: var(--night); }
.tiles-spooky .leaflet-tile-pane { filter: sepia(.35) hue-rotate(215deg) saturate(1.9) brightness(1.08) contrast(1.05); }
.leaflet-top { top: calc(var(--sat) + 62px); }
.leaflet-control-attribution { background: rgba(20, 12, 36, .7) !important; color: var(--bone-dim) !important; font-size: 10px; border-radius: 8px 0 0 8px; }
.leaflet-control-attribution a { color: var(--candle) !important; }

.fog { position: fixed; inset: -20%; pointer-events: none; z-index: 1;
  background:
    radial-gradient(40% 30% at 20% 30%, rgba(180, 140, 255, .10), transparent 70%),
    radial-gradient(35% 25% at 80% 60%, rgba(243, 234, 216, .07), transparent 70%),
    radial-gradient(50% 40% at 50% 100%, rgba(255, 106, 19, .08), transparent 70%);
  animation: drift 28s ease-in-out infinite alternate; }
@keyframes drift { to { transform: translate3d(6%, -4%, 0) scale(1.08); } }

/* Candy trail: the one loud thing */
.trail-glow { stroke: var(--candle); stroke-opacity: .22; stroke-width: 14; filter: blur(3px); }
.trail { stroke: var(--pumpkin); stroke-width: 6; stroke-linecap: round; stroke-dasharray: 0.1 14; animation: march 1.1s linear infinite; }
.trail.adult { stroke: var(--violet); }
@keyframes march { to { stroke-dashoffset: -14.1; } }

/* Pins */
.pin-wrap { background: none; border: 0; }
.pinbox { --c: var(--pumpkin); position: relative; width: 38px; height: 38px; }
.pinbox .pin { width: 100%; height: 100%; border-radius: 50% 50% 50% 8px; transform: rotate(-45deg);
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 65%, white), var(--c) 60%, color-mix(in srgb, var(--c) 60%, black));
  box-shadow: 0 0 0 2px rgba(20, 12, 36, .85), 0 0 18px color-mix(in srgb, var(--c) 70%, transparent);
  display: grid; place-items: center; }
.pinbox .g { transform: rotate(45deg); font-size: 19px; line-height: 1; position: relative; }
.pinbox .num { position: absolute; top: -9px; right: -11px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--bone); color: var(--night); font-size: 11px; font-weight: 900; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0,0,0,.45); font-style: normal; }
.pinbox .badges { position: absolute; left: 31px; top: 17px; font-size: 12px; font-style: normal; white-space: nowrap; letter-spacing: -2px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.9)); }
.pinbox.off { width: 22px; height: 22px; opacity: .8; }
.pinbox.off .pin { box-shadow: 0 0 0 2px rgba(20, 12, 36, .8); }
.pinbox.off .g { font-size: 11px; }
.pinbox.off .badges { display: none; }
.pinbox.visited .pin { filter: grayscale(1) brightness(.7); }
.pinbox.visited .g::after { content: "✓"; position: absolute; inset: -4px; display: grid; place-items: center; font-weight: 900; color: var(--mint); font-size: 22px; text-shadow: 0 0 4px #000; }
.pinbox.next .pin { animation: bob 1.1s ease-in-out infinite; }
.pinbox.approx .pin { outline: 2px dashed rgba(243,234,216,.6); outline-offset: 3px; }
@keyframes bob { 50% { transform: rotate(-45deg) translate(3px, -3px) scale(1.15); } }

.me { width: 20px; height: 20px; border-radius: 50%; background: var(--teal); border: 3px solid var(--bone); box-shadow: 0 0 0 0 rgba(46,196,214,.6); animation: ping 1.8s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 18px rgba(46,196,214,0); } 100% { box-shadow: 0 0 0 0 rgba(46,196,214,0); } }

/* ---------- Top bar ---------- */
.topbar { position: fixed; z-index: 20; top: 0; left: 0; right: 0; padding: calc(var(--sat) + 10px) 12px 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: linear-gradient(to bottom, rgba(20,12,36,.95), rgba(20,12,36,.6) 70%, transparent); pointer-events: none; }
.topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { font-family: var(--display); font-weight: 400; color: var(--pumpkin); letter-spacing: .02em; line-height: .9;
  text-shadow: 0 0 18px rgba(255, 106, 19, .55), 0 2px 0 #7a2a00; }
.logo.small { font-size: 28px; white-space: nowrap; }
.countdown { font-size: 12.5px; font-weight: 800; color: var(--night); background: var(--candle); padding: 4px 10px; border-radius: 999px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.countdown.live { background: var(--mint); animation: glowpulse 2s infinite; }
@keyframes glowpulse { 50% { box-shadow: 0 0 16px var(--mint); } }
.icon-btn { width: 44px; height: 44px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line); font-size: 20px; flex: none; }

.fabs { position: fixed; z-index: 15; right: 12px; bottom: calc(var(--peek) + 14px); display: flex; flex-direction: column; gap: 10px; transition: bottom .3s; }
.fab { width: 48px; height: 48px; border-radius: 50%; background: var(--glass); border: 1px solid var(--line); font-size: 21px; box-shadow: 0 6px 18px rgba(0,0,0,.4); }
.fab.on { background: var(--teal); }

/* ---------- Sheet ---------- */
.sheet { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; height: 86dvh; max-height: 86vh;
  background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-radius: 26px 26px 0 0; border-top: 1px solid var(--line); box-shadow: 0 -10px 40px rgba(0,0,0,.45);
  transform: translateY(calc(100% - var(--peek))); transition: transform .35s cubic-bezier(.2,.9,.25,1);
  display: flex; flex-direction: column; touch-action: none; }
.sheet.full { transform: translateY(0); }
.sheet.dragging { transition: none; }
.grab { padding: 10px 0 6px; display: grid; place-items: center; cursor: grab; flex: none; }
.grab span { width: 44px; height: 5px; border-radius: 3px; background: rgba(243,234,216,.35); }
#peekPart { flex: none; padding: 0 0 12px; }
#morePart { flex: 1; overflow-y: auto; padding: 0 16px calc(var(--sab) + 24px); touch-action: pan-y; -webkit-overflow-scrolling: touch; }
.sheet:not(.full) #morePart { overflow: hidden; }

/* Quest picker */
.quests { display: flex; gap: 10px; overflow-x: auto; padding: 4px 16px 10px; scroll-snap-type: x mandatory; scrollbar-width: none; touch-action: pan-x; }
.quests::-webkit-scrollbar { display: none; }
.quest { flex: none; width: 108px; scroll-snap-align: start; text-align: left; padding: 10px 10px 9px; border-radius: 18px;
  background: var(--night-2); border: 1.5px solid var(--line); transition: transform .15s, border-color .2s, background .2s; }
.quest:active { transform: scale(.96); }
.quest .e { font-size: 26px; display: block; line-height: 1.1; }
.quest .n { display: block; font-weight: 900; font-size: 14px; line-height: 1.15; margin-top: 6px; }
.quest .c { display: block; font-size: 12px; color: var(--bone-dim); margin-top: 2px; }
.quest.on { border-color: var(--pumpkin); background: linear-gradient(160deg, #4a2412, var(--night-2) 70%); box-shadow: 0 0 22px rgba(255,106,19,.25); }
.quest.on.adult { border-color: var(--violet); background: linear-gradient(160deg, #36245e, var(--night-2) 70%); box-shadow: 0 0 22px rgba(180,140,255,.25); }

.blurb { margin: 0 16px 10px; font-size: 14px; color: var(--bone-dim); line-height: 1.35; }
.blurb b { color: var(--bone); }

.custom { margin: 0 16px 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { padding: 7px 12px; border-radius: 999px; background: var(--night-2); border: 1.5px solid var(--line); font-size: 13.5px; font-weight: 800; white-space: nowrap; }
.chip.on { background: var(--bone); color: var(--night); border-color: var(--bone); }
.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { padding: 6px 11px; font-size: 12.5px; font-weight: 800; }
.seg button.on { background: var(--candle); color: var(--night); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0 16px 12px; border-radius: 16px; background: rgba(20,12,36,.6); border: 1px solid var(--line); }
.stat { padding: 9px 4px 8px; text-align: center; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat b { display: block; font-size: 19px; font-weight: 900; line-height: 1.1; }
.stat span { font-size: 11.5px; color: var(--bone-dim); }

.row { display: flex; gap: 10px; padding: 0 16px; align-items: center; }
.cta { flex: 1; min-height: 52px; border-radius: 16px; background: var(--pumpkin); color: #1c0a00; font-weight: 1000; font-size: 17px;
  box-shadow: 0 6px 0 #a33c00, 0 10px 24px rgba(255,106,19,.35); transition: transform .1s, box-shadow .1s; }
.cta:active { transform: translateY(4px); box-shadow: 0 2px 0 #a33c00, 0 6px 16px rgba(255,106,19,.3); }
.cta.big { padding: 0 28px; font-size: 19px; min-height: 58px; }
.cta.ghost { background: var(--night-2); color: var(--bone); box-shadow: 0 6px 0 #0c0716; border: 1px solid var(--line); }
.cta.ghost:active { box-shadow: 0 2px 0 #0c0716; }
.cta.mint { background: var(--mint); color: #062b19; box-shadow: 0 6px 0 #1f8a57, 0 10px 24px rgba(95,227,161,.3); }
.cta.violet { background: var(--violet); color: #1b0a3a; box-shadow: 0 6px 0 #6b47b8, 0 10px 24px rgba(180,140,255,.3); }
.sq { flex: none; width: 52px; min-height: 52px; border-radius: 16px; background: var(--night-2); border: 1px solid var(--line); font-size: 21px; }

.start-from { display: flex; align-items: center; justify-content: space-between; margin: 0 16px 10px; font-size: 13px; color: var(--bone-dim); }

/* Tabs + lists */
.tabs { display: flex; gap: 6px; margin: 6px 0 12px; position: sticky; top: 0; background: var(--glass); padding: 6px 0; z-index: 2; }
.tabs button { flex: 1; padding: 9px; border-radius: 12px; font-weight: 900; font-size: 14px; color: var(--bone-dim); background: var(--night-2); }
.tabs button.on { color: var(--night); background: var(--bone); }
.search { width: 100%; padding: 12px 14px; border-radius: 14px; background: var(--night-2); border: 1px solid var(--line); color: var(--bone); font: inherit; font-size: 16px; margin-bottom: 10px; }
.stops { list-style: none; margin: 0; padding: 0; }
.stop { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.stop .k { width: 30px; height: 30px; border-radius: 50%; background: var(--pumpkin); color: var(--night); display: grid; place-items: center; font-weight: 1000; font-size: 13px; }
.stop .k.v { background: var(--mint); }
.stop .k.dim { background: var(--plum); color: var(--bone); }
.stop .a { font-weight: 800; font-size: 15.5px; }
.stop .t { font-size: 12.5px; color: var(--bone-dim); margin-top: 1px; }
.stop .d { font-size: 12px; color: var(--bone-dim); text-align: right; white-space: nowrap; }
.stop.done .a { text-decoration: line-through; opacity: .6; }
.leg { font-size: 11.5px; color: var(--bone-dim); padding: 0 0 0 48px; margin: -4px 0 0; }
.empty { text-align: center; padding: 24px 10px; color: var(--bone-dim); }

/* Hunt */
.hunt-top { margin: 0 16px 10px; }
.progress { height: 12px; border-radius: 6px; background: var(--night-2); overflow: hidden; border: 1px solid var(--line); }
.progress i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(-45deg, var(--pumpkin) 0 10px, var(--bone) 10px 14px, var(--candle) 14px 24px); transition: width .5s cubic-bezier(.3,1.4,.5,1); }
.hunt-meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--bone-dim); margin-top: 6px; font-weight: 700; }
.hunt-meta b { color: var(--bone); }
.next { margin: 0 16px 12px; padding: 12px 14px; border-radius: 18px; background: linear-gradient(150deg, #43210f, var(--night-2) 75%); border: 1.5px solid rgba(255,106,19,.5); }
.next.adult { background: linear-gradient(150deg, #33225a, var(--night-2) 75%); border-color: rgba(180,140,255,.6); }
.next small { font-size: 12px; color: var(--candle); font-weight: 900; }
.next .addr { font-size: 22px; font-weight: 1000; line-height: 1.15; margin: 2px 0 4px; }
.next .what { font-size: 14px; color: var(--bone-dim); }
.next .far { font-size: 13px; font-weight: 800; color: var(--teal); margin-top: 4px; }
.next.here { animation: here 1s infinite alternate; }
@keyframes here { to { box-shadow: 0 0 26px rgba(95,227,161,.55); border-color: var(--mint); } }

/* ---------- Overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(10, 5, 20, .55); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.overlay.center { align-items: center; padding: 16px; }
@keyframes fade { from { opacity: 0; } }
.card, .menu { width: 100%; max-width: 520px; background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-radius: 26px 26px 0 0; border-top: 1px solid var(--line); padding: 18px 18px calc(var(--sab) + 18px); animation: up .28s cubic-bezier(.2,.9,.25,1); }
@keyframes up { from { transform: translateY(40%); opacity: 0; } }
.card h2 { margin: 0; font-size: 26px; font-weight: 1000; line-height: 1.1; }
.card .sub { color: var(--bone-dim); font-size: 13.5px; margin: 4px 0 12px; }
.tagrow { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.tag { --c: var(--pumpkin); padding: 6px 11px; border-radius: 999px; font-size: 13.5px; font-weight: 900; background: color-mix(in srgb, var(--c) 22%, transparent); border: 1.5px solid color-mix(in srgb, var(--c) 70%, transparent); }
.note { background: rgba(20,12,36,.6); border-radius: 14px; padding: 10px 12px; font-size: 15px; line-height: 1.4; margin-bottom: 14px; border-left: 4px solid var(--candle); }
.warn { font-size: 13px; color: var(--candle); margin: -4px 0 12px; }
.btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btns .cta { font-size: 15px; min-height: 50px; }

.menu h3 { font-family: var(--display); font-weight: 400; font-size: 30px; color: var(--pumpkin); margin: 0 0 10px; }
.menu .item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 13px 6px; border-bottom: 1px solid var(--line); font-weight: 800; font-size: 16px; }
.menu .item small { display: block; font-weight: 600; font-size: 12.5px; color: var(--bone-dim); }
.menu .item .ic { font-size: 22px; width: 30px; text-align: center; }
.menu .item .sw { margin-left: auto; width: 46px; height: 28px; border-radius: 14px; background: var(--night-2); border: 1px solid var(--line); position: relative; flex: none; }
.menu .item .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--bone-dim); transition: .2s; }
.menu .item .sw.on { background: var(--mint); }
.menu .item .sw.on::after { left: 21px; background: var(--night); }
.legend { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 0 4px; }

.modal { width: 100%; max-width: 440px; max-height: 88dvh; overflow-y: auto; background: var(--night-2); border: 1px solid var(--line); border-radius: 24px; padding: 22px 18px; box-shadow: 0 20px 60px rgba(0,0,0,.6); animation: pop .25s cubic-bezier(.2,1.4,.4,1); }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.modal h2 { margin: 0 0 6px; font-size: 24px; font-weight: 1000; }
.modal p { color: var(--bone-dim); line-height: 1.45; margin: 0 0 14px; font-size: 15px; }
.modal label { display: block; font-weight: 800; font-size: 14px; margin: 10px 0 6px; }
.modal input[type=text], .modal textarea { width: 100%; padding: 12px; border-radius: 12px; background: var(--night); border: 1px solid var(--line); color: var(--bone); font: inherit; font-size: 16px; }
.modal pre { background: var(--night); border-radius: 12px; padding: 12px; font-size: 12px; overflow-x: auto; white-space: pre-wrap; word-break: break-word; border: 1px solid var(--line); max-height: 220px; }
.modal .row { padding: 0; margin-top: 14px; }
.modal.win { text-align: center; }
.modal.win .logo { font-size: 46px; margin: 4px 0 10px; }

.toast { position: fixed; z-index: 70; left: 50%; top: calc(var(--sat) + 66px); transform: translate(-50%, -20px); opacity: 0; pointer-events: none;
  background: var(--bone); color: var(--night); font-weight: 900; padding: 10px 16px; border-radius: 999px; font-size: 14.5px; box-shadow: 0 10px 30px rgba(0,0,0,.4);
  transition: .3s cubic-bezier(.2,1.3,.4,1); max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
#confetti { position: fixed; inset: 0; z-index: 80; pointer-events: none; width: 100%; height: 100%; }

.fixbar { position: fixed; z-index: 40; left: 12px; right: 12px; top: calc(var(--sat) + 66px); display: flex; align-items: center; gap: 8px;
  background: var(--candle); color: var(--night); padding: 8px 10px 8px 14px; border-radius: 16px; font-weight: 900; font-size: 14px; }
.fixbar span { flex: 1; }
.fixbar .chip { background: var(--night); color: var(--bone); border: 0; }
.fixbar .chip.on { background: var(--pumpkin); color: var(--night); }

/* ---------- Splash ---------- */
#splash { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; text-align: center; padding: 24px;
  background: radial-gradient(120% 80% at 50% 0%, #3a2163 0%, var(--night) 60%); transition: opacity .6s, transform .6s; overflow: hidden; }
#splash.gone { opacity: 0; transform: scale(1.08); pointer-events: none; }
.moon { position: absolute; top: calc(var(--sat) + 6vh); right: 12vw; width: 90px; height: 90px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff7e0, #f3d98a 60%, #c9a24a); box-shadow: 0 0 60px 20px rgba(255, 220, 140, .35); }
.bats i { position: absolute; font-style: normal; font-size: 28px; top: 20%; left: -10%; animation: fly 9s linear infinite; }
.bats i:nth-child(2) { top: 32%; font-size: 20px; animation-delay: 3s; animation-duration: 11s; }
.bats i:nth-child(3) { top: 14%; font-size: 16px; animation-delay: 6s; animation-duration: 13s; }
@keyframes fly { 0% { transform: translate(0, 0); } 25% { transform: translate(30vw, -4vh); } 50% { transform: translate(60vw, 3vh); } 75% { transform: translate(90vw, -3vh); } 100% { transform: translate(125vw, 0); } }
.splash-inner { position: relative; max-width: 420px; }
.logo.drip { font-size: clamp(76px, 25vw, 132px); margin: 0 0 14px; animation: flicker 4s infinite; }
@keyframes flicker { 0%, 92%, 100% { opacity: 1; } 93% { opacity: .55; } 95% { opacity: 1; } 96% { opacity: .7; } }
.splash-sub { font-weight: 900; font-size: 17px; margin: 0 0 6px; }
.splash-count { color: var(--bone-dim); margin: 0 0 26px; font-size: 16px; }
.splash-count b { color: var(--candle); font-size: 20px; }
.splash-hint { color: var(--bone-dim); font-size: 13.5px; margin-top: 18px; }

/* ---------- Desktop: sheet becomes a side panel ---------- */
@media (min-width: 900px) {
  .sheet { left: 14px; right: auto; top: calc(var(--sat) + 70px); bottom: 14px; width: 410px; height: auto; max-height: none;
    border-radius: 24px; border: 1px solid var(--line); transform: none !important; }
  .grab { display: none; }
  #peekPart { padding-top: 12px; }
  .sheet #morePart { overflow-y: auto !important; }
  .fabs { bottom: 24px !important; }
  .overlay { align-items: center; }
  .card, .menu { border-radius: 24px; border: 1px solid var(--line); }
  .logo.small { font-size: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .trail { stroke-dasharray: 0.1 14; }
}
