:root {
  --bg: #f7f3ec;
  --card: #fffdf9;
  --ink: #2d2a26;
  --muted: #7a7268;
  --accent: #3f5a4a;
  --accent-soft: #e3ebe4;
  --gold: #b8955a;
  --line: #e6dfd3;
  --parchment: #f1e2bf;
  --radius: 16px;
  --tabbar-h: 64px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 Inter, system-ui, sans-serif;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, .mono { font-family: "Cormorant Garamond", Georgia, serif; font-weight: 600; }
h2 { font-size: 2rem; margin: 8px 0 12px; }
h3 { font-size: 1.3rem; margin: 0 0 4px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }

.topbar {
  position: sticky; top: 0; z-index: 1000;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: rgba(247, 243, 236, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.mono { font-size: 1.4rem; letter-spacing: .08em; }
.amp { color: var(--gold); font-style: italic; }
.pill {
  border: 1px solid var(--accent); color: var(--accent); background: none;
  border-radius: 999px; padding: 6px 14px; font: 500 .85rem Inter, sans-serif;
}

main { max-width: 640px; margin: 0 auto; padding: 16px; }
.view { display: none; animation: fade .25s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }

.hero { text-align: center; padding: 28px 0 20px; }
.eyebrow { text-transform: uppercase; letter-spacing: .18em; font-size: .72rem; color: var(--muted); margin: 0; }
.hero h1 { font-size: clamp(2.6rem, 11vw, 3.8rem); line-height: 1.05; margin: 10px 0 6px; }
.date { color: var(--accent); font-weight: 500; margin: 0 0 18px; }
.tagline { color: var(--muted); max-width: 30ch; margin: 18px auto 0; }
.countdown { display: flex; justify-content: center; gap: 10px; }
.countdown div {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  min-width: 64px; padding: 8px 6px;
}
.countdown b { display: block; font: 600 1.7rem "Cormorant Garamond", serif; }
.countdown small { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 12px 0;
}
.card .label { text-transform: uppercase; letter-spacing: .14em; font-size: .7rem; color: var(--gold); font-weight: 600; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  background: var(--accent); color: #fff; border: 0; border-radius: 12px;
  padding: 10px 16px; font: 600 .9rem Inter, sans-serif; text-decoration: none; cursor: pointer;
}
.btn.ghost { background: var(--accent-soft); color: var(--accent); }
.btn.danger { background: #f3e1dc; color: #8a3b2a; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* schedule */
.day-head { font: 600 1.15rem "Cormorant Garamond", serif; color: var(--accent); margin: 20px 0 6px; }
.event { display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.event time { font-weight: 600; color: var(--accent); }
.event.past { opacity: .45; }
.event.now { background: var(--accent-soft); border-radius: 12px; padding: 12px 8px; margin: 0 -8px; }
.event a { color: var(--accent); font-size: .85rem; }

/* maps */
.map { height: 320px; border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; margin: 8px 0 12px; z-index: 0; }
.parchment { border: 3px double #8b6a3a; }
.parchment .leaflet-tile-pane { filter: sepia(.85) saturate(.7) contrast(.95) brightness(1.03); }
.parchment .leaflet-container, .parchment { background: var(--parchment); }
.venue-pin, .guest-pin, .x-pin {
  display: grid; place-items: center; border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,.25); font-size: 18px;
}
.venue-pin { background: #fff; border: 2px solid var(--accent); width: 36px; height: 36px; }
.guest-pin { background: var(--accent); color: #fff; border: 2px solid #fff; width: 34px; height: 34px; font: 600 .8rem Inter, sans-serif; }
.guest-pin.me { background: var(--gold); }
.x-pin { width: 34px; height: 34px; box-shadow: none; font: 700 30px "Cormorant Garamond", serif; color: #a3301f; text-shadow: 0 1px 0 #fff8; }
.x-pin.found { color: #3f5a4a; font-size: 24px; }

/* places */
.place { display: grid; grid-template-columns: 40px 1fr; gap: 12px; }
.place .emoji { font-size: 1.6rem; }

/* treasure */
.progress { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress div { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), #d9b979); transition: width .5s; }
.stop { display: grid; grid-template-columns: 32px 1fr auto; gap: 10px; align-items: start; padding: 12px 0; border-bottom: 1px dashed #d6c7a7; }
.stop .mark { font: 700 1.5rem "Cormorant Garamond", serif; color: #a3301f; }
.stop.found .mark { color: var(--accent); }
.stop .dist { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.code-form { display: flex; gap: 8px; margin: 14px 0; }
.code-form input {
  flex: 1; min-width: 0; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line);
  font: 500 1rem Inter, sans-serif; text-transform: uppercase; background: var(--card);
}
.prize { background: linear-gradient(135deg, #fff6df, #f3e1b5); border-color: #d9b979; text-align: center; }
.prize h3 { font-size: 1.8rem; }

/* guests */
.field { display: block; margin: 10px 0; }
.field input { width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); font: 1rem Inter, sans-serif; }
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #c9c1b4; margin-right: 6px; }
.status-dot.on { background: #3fa45c; box-shadow: 0 0 0 4px #3fa45c33; }

/* tab bar */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 253, 249, .96); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
}
.tabbar button {
  background: none; border: 0; color: var(--muted); font: 500 .7rem Inter, sans-serif;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer;
}
.tabbar button span { font-size: 1.3rem; filter: grayscale(1); opacity: .7; }
.tabbar button.active { color: var(--accent); }
.tabbar button.active span { filter: none; opacity: 1; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: .3s;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; z-index: 2000;
  max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.leaflet-popup-content { font: .9rem/1.4 Inter, sans-serif; }
