:root {
  --bg: #0d0b12;
  --panel: #1a1624;
  --panel-2: #241e33;
  --text: #f4efe6;
  --muted: #b3a9c6;
  --orange: #ff7a00;
  --orange-soft: #ffb347;
  --purple: #8a5cf6;
  --green: #4ade80;
  --danger: #ff6b6b;
  --radius: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body {
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button, a, input, label { touch-action: manipulation; }
a { color: var(--orange-soft); }
h1, h2 { margin: 0; line-height: 1.2; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* ---------- Buttons ---------- */
.btn {
  font: inherit; font-weight: 600; color: var(--text);
  background: var(--panel-2); border: 1px solid #3a3150; border-radius: 999px;
  padding: 12px 18px; min-height: 48px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:disabled { opacity: .6; cursor: default; }
.btn-primary { background: var(--orange); border-color: var(--orange); color: #1a0d00; }
.btn-active { background: var(--purple); border-color: var(--purple); color: #fff; }
.btn-big { width: 100%; min-height: 60px; font-size: 20px; border-radius: var(--radius); }
.btn-done { background: #1f3a2a; border-color: var(--green); color: var(--green); }
.pill {
  background: rgba(255, 122, 0, .15); border: 1px solid var(--orange); color: var(--orange-soft);
  padding: 8px 14px; border-radius: 999px; text-decoration: none; font-weight: 600; white-space: nowrap;
}

/* ---------- Map page ---------- */
.map-page { overflow: hidden; }
/* Google Maps sets position:relative inline on the map div, so the fixed
   full-screen box lives on a wrapper and the map just fills it. */
.map-wrap { position: fixed; inset: 0; }
#map { width: 100%; height: 100%; }

.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  background: linear-gradient(rgba(13, 11, 18, .95), rgba(13, 11, 18, .75));
  backdrop-filter: blur(6px);
}
.topbar h1 { font-size: 20px; color: var(--orange-soft); letter-spacing: .3px; }
.countdown { font-size: 14px; color: var(--muted); }

.bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: 0 16px calc(14px + var(--safe-b));
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.bottom > * { pointer-events: auto; }
.hint {
  background: rgba(26, 22, 36, .92); border: 1px solid #3a3150; border-radius: var(--radius);
  padding: 12px 16px; font-size: 18px; font-weight: 600;
}
.controls { display: flex; align-items: center; gap: 12px; }
.controls .btn { flex: 1; min-height: 56px; box-shadow: 0 6px 24px rgba(0, 0, 0, .5); }
.tally {
  background: rgba(26, 22, 36, .92); border-radius: 999px; padding: 10px 14px;
  font-size: 15px; color: var(--muted); white-space: nowrap;
}

.card {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--safe-b)); z-index: 3;
  max-width: 480px; margin: 0 auto;
  background: var(--panel); border: 1px solid #3a3150; border-radius: 20px;
  padding: 20px; box-shadow: 0 10px 40px rgba(0, 0, 0, .7);
}
.card h2 { font-size: 24px; padding-right: 40px; }
.card p { margin: 6px 0 16px; }
.card-close {
  position: absolute; top: 10px; right: 10px; width: 44px; height: 44px;
  border: 0; border-radius: 50%; background: var(--panel-2); color: var(--text); font-size: 18px; cursor: pointer;
}

.toast {
  position: fixed; top: calc(76px + var(--safe-t)); left: 16px; right: 16px; z-index: 4;
  max-width: 480px; margin: 0 auto; padding: 12px 16px; border-radius: 12px;
  background: #3a1d1d; border: 1px solid var(--danger); color: #ffdede;
}

/* ---------- Markers ---------- */
.html-marker { position: absolute; }
.html-marker.anchor-center { transform: translate(-50%, -50%); }
.html-marker.anchor-bottom { transform: translate(-50%, -100%); }

.candy {
  width: 52px; height: 52px; padding: 0; border: 0; background: none; cursor: pointer;
  display: grid; place-items: center;
}
.candy svg { width: 44px; height: 28px; position: relative; filter: drop-shadow(0 0 6px rgba(255, 140, 0, .9)); transition: transform .3s; }
.candy .halo {
  position: absolute; inset: 4px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 150, 30, .55) 0%, rgba(255, 122, 0, 0) 70%);
  animation: pulse 2.4s ease-in-out infinite;
}
.candy .check {
  position: absolute; right: 2px; top: 0; display: none;
  width: 20px; height: 20px; border-radius: 50%; background: var(--green); color: #062b12;
  font-size: 13px; font-weight: 800; line-height: 20px; text-align: center;
}
.candy.ahead { z-index: 1; }
.candy.ahead svg { transform: scale(1.35); }
.candy.ahead .halo { inset: -6px; background: radial-gradient(circle, rgba(255, 190, 80, .8) 0%, rgba(255, 122, 0, 0) 70%); }
.candy.visited svg { filter: grayscale(1) brightness(.6); opacity: .55; transform: none; }
.candy.visited .halo { display: none; }
.candy.visited .check { display: block; }

@keyframes pulse {
  0%, 100% { transform: scale(.8); opacity: .55; }
  50% { transform: scale(1.25); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .candy .halo { animation: none; }
}

.me { width: 0; height: 0; }
.me-dot {
  position: absolute; left: -11px; top: -11px; width: 22px; height: 22px; border-radius: 50%;
  background: #4c8dff; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(76, 141, 255, .3);
}
.me-cone {
  position: absolute; left: -30px; top: -60px; width: 60px; height: 60px; display: none;
  transform-origin: 50% 100%; transform: rotate(var(--heading, 0deg));
  background: radial-gradient(circle at 50% 100%, rgba(76, 141, 255, .55), rgba(76, 141, 255, 0) 70%);
  clip-path: polygon(50% 100%, 15% 0, 85% 0);
}
.me.has-heading .me-cone { display: block; }

/* ---------- Registration ---------- */
.register-page { min-height: 100%; }
.panel { max-width: 640px; margin: 0 auto; padding: calc(16px + var(--safe-t)) 16px calc(32px + var(--safe-b)); }
.reg-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.back { text-decoration: none; font-weight: 600; }
.panel h1 { font-size: 26px; color: var(--orange-soft); margin-bottom: 12px; }
.step { display: flex; flex-direction: column; gap: 14px; }
.step[hidden] { display: none; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
input[type="text"], input:not([type]) {
  font: inherit; color: var(--text); background: var(--panel); border: 1px solid #3a3150;
  border-radius: 12px; padding: 14px; min-height: 52px;
}
input:focus-visible, .btn:focus-visible { outline: 3px solid var(--orange-soft); outline-offset: 2px; }
.found { font-size: 18px; font-weight: 600; margin: 0; }
.pin-map { height: 55vh; min-height: 320px; border-radius: var(--radius); overflow: hidden; border: 1px solid #3a3150; }

.drag-pin { width: 64px; height: 76px; touch-action: none; cursor: grab; display: flex; flex-direction: column; align-items: center; }
.drag-pin.dragging { cursor: grabbing; }
.drag-pin-head {
  width: 64px; height: 56px; display: grid; place-items: center; border-radius: 50%;
  background: rgba(13, 11, 18, .75); border: 3px solid var(--orange);
}
.drag-pin-head svg { width: 46px; height: 30px; }
.drag-pin-tip { width: 4px; height: 20px; background: var(--orange); box-shadow: 0 0 0 1px #000; }
.drag-pin.dragging .drag-pin-head { transform: scale(1.1); }

.checks { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.checks legend { font-weight: 600; margin-bottom: 8px; }
#candy-options { display: flex; flex-direction: column; gap: 10px; }
.check-tile {
  flex-direction: row; align-items: center; gap: 14px; cursor: pointer;
  background: var(--panel); border: 2px solid #3a3150; border-radius: 12px; padding: 14px 16px; min-height: 56px;
}
.check-tile input {
  appearance: none; -webkit-appearance: none; margin: 0; flex: none;
  width: 26px; height: 26px; border: 2px solid var(--muted); border-radius: 6px; display: grid; place-items: center;
}
.check-tile input::after { content: "✓"; font-weight: 800; color: #1a0d00; display: none; }
.check-tile input:checked { background: var(--orange); border-color: var(--orange); }
.check-tile input:checked::after { display: block; }
.check-tile:has(input:checked) { border-color: var(--orange); background: #2a1c10; }
.check-tile input:focus-visible { outline: 3px solid var(--orange-soft); outline-offset: 2px; }

.row { display: flex; gap: 12px; }
.row .btn:first-child { flex: 0 0 auto; }
.error { color: var(--danger); font-weight: 600; }
.contact {
  margin-top: 28px; padding: 14px 16px; border-radius: 12px; background: var(--panel);
  color: var(--muted); text-align: center;
}
