:root {
  --bg: #0f0718;
  --bg-2: #1a0b2e;
  --panel: #ffffff;
  --panel-soft: #f7f4fa;
  --ink: #1a1224;
  --muted: #6b6178;
  --line: #ebe4f2;
  --brand: #c41e8c;
  --brand-2: #7b1fa2;
  --brand-soft: rgba(196, 30, 140, 0.12);
  --ok: #0d9488;
  --map-h: min(48vh, 380px);
  --radius: 20px;
  --shadow: 0 12px 40px rgba(26, 11, 46, 0.18);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, a { font-family: inherit; }
.hidden { display: none !important; }

#app { min-height: 100dvh; }

/* ——— Cover ——— */
.view-cover {
  position: relative;
  min-height: 100dvh;
  color: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cover-bg {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  transform: scale(1.04);
}
.cover-gradient {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(15,7,24,.45) 0%, rgba(15,7,24,.2) 35%, rgba(15,7,24,.92) 78%, #0f0718 100%);
}
.cover-top, .cover-body { position: relative; z-index: 1; }
.cover-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 0;
}
.brand {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: .92rem;
  letter-spacing: .02em;
}
.cover-body {
  margin-top: auto;
  padding: 24px 20px calc(28px + var(--safe-b));
  max-width: 520px;
}
.pill {
  display: inline-block;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.22);
  backdrop-filter: blur(8px);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  margin-bottom: 12px;
}
.cover-body h1 {
  font-family: var(--display);
  font-size: clamp(1.7rem, 6vw, 2.25rem);
  line-height: 1.15;
  margin: 0 0 10px;
  font-weight: 700;
}
.cover-body > p {
  margin: 0 0 18px;
  color: rgba(255,255,255,.82);
  line-height: 1.45;
  font-size: .98rem;
}
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}
.stat-chip {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px;
  padding: 10px 6px;
  text-align: center;
}
.stat-chip b {
  display: block;
  font-size: 1rem;
  font-weight: 700;
}
.stat-chip span {
  font-size: .68rem;
  opacity: .75;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.btn-primary {
  width: 100%;
  border: 0;
  cursor: pointer;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  color: #fff;
  font-weight: 700;
  font-size: 1.02rem;
  padding: 16px 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 10px 28px rgba(196, 30, 140, .4);
  text-decoration: none;
}
.btn-primary:active { transform: scale(.98); }
.btn-arrow { opacity: .9; }
.cover-note {
  text-align: center;
  margin: 14px 0 0 !important;
  font-size: .8rem !important;
  color: rgba(255,255,255,.55) !important;
}

/* Lang */
.lang-select {
  display: flex;
  gap: 4px;
  background: rgba(0,0,0,.28);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  padding: 3px;
}
.lang-select button {
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.75);
  font-size: .72rem;
  font-weight: 700;
  padding: 6px 8px;
  border-radius: 999px;
  cursor: pointer;
  text-transform: uppercase;
}
.lang-select button.active {
  background: #fff;
  color: var(--ink);
}
.lang-select--sm {
  background: var(--panel-soft);
  border-color: var(--line);
}
.lang-select--sm button { color: var(--muted); }
.lang-select--sm button.active {
  background: var(--ink);
  color: #fff;
}

/* ——— Dashboard ——— */
.view-dash {
  min-height: 100dvh;
  background: var(--panel-soft);
  display: flex;
  flex-direction: column;
}
.dash-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.icon-btn {
  width: 40px; height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
}
.dash-header-text { flex: 1; min-width: 0; }
.dash-header-text h2 {
  margin: 0;
  font-size: .95rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-header-text p {
  margin: 2px 0 0;
  font-size: .75rem;
  color: var(--muted);
}

.map-wrap {
  position: relative;
  height: var(--map-h);
  flex-shrink: 0;
  background: #d9d0e4;
}
#map { width: 100%; height: 100%; }
.map-fab-row {
  position: absolute;
  left: 12px; right: 12px; bottom: 12px;
  display: flex;
  gap: 8px;
  z-index: 500;
  pointer-events: none;
}
.map-fab {
  pointer-events: auto;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: .82rem;
  font-weight: 700;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.map-fab--ghost {
  background: rgba(255,255,255,.9);
  color: var(--muted);
}

.sheet {
  flex: 1;
  background: var(--panel);
  border-radius: 24px 24px 0 0;
  margin-top: -18px;
  position: relative;
  z-index: 10;
  padding: 8px 16px calc(24px + var(--safe-b));
  box-shadow: 0 -8px 30px rgba(26, 11, 46, .08);
}
.sheet-handle {
  width: 40px; height: 4px;
  background: var(--line);
  border-radius: 999px;
  margin: 6px auto 14px;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}
.stat-card {
  background: var(--panel-soft);
  border-radius: 14px;
  padding: 12px 8px;
  text-align: center;
}
.stat-card b {
  display: block;
  font-size: 1.05rem;
  color: var(--brand-2);
  font-weight: 700;
}
.stat-card span {
  font-size: .68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.sheet-section h3 {
  margin: 0 0 12px;
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

/* Timeline Komoot-style */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 6px;
}
.tl-item {
  position: relative;
  padding: 0 0 18px 28px;
  cursor: pointer;
}
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: "";
  position: absolute;
  left: 7px; top: 22px; bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--brand), #e9d5f5);
}
.tl-item:last-child::before { display: none; }
.tl-dot {
  position: absolute;
  left: 0; top: 8px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
  z-index: 1;
}
.tl-item.is-food .tl-dot { border-color: var(--ok); box-shadow: 0 0 0 3px rgba(13,148,136,.15); }
.tl-card {
  background: var(--panel-soft);
  border-radius: 16px;
  padding: 12px 14px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.tl-item:active .tl-card {
  transform: scale(.99);
  box-shadow: 0 6px 18px rgba(26,11,46,.08);
}
.tl-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}
.tl-time {
  font-size: .72rem;
  font-weight: 700;
  color: var(--brand);
  white-space: nowrap;
}
.tl-name {
  margin: 4px 0 0;
  font-size: .98rem;
  font-weight: 700;
  line-height: 1.25;
}
.tl-meta {
  margin: 6px 0 0;
  font-size: .8rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tl-leg {
  margin: 8px 0 0 0;
  padding: 0 0 10px 28px;
  font-size: .75rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.tl-leg::before {
  content: "↓";
  color: var(--brand-2);
  font-weight: 700;
}

.upsell-card {
  display: flex;
  gap: 12px;
  align-items: center;
  background: linear-gradient(135deg, #1a0b2e, #4a148c);
  color: #fff;
  border-radius: 18px;
  padding: 16px;
  margin-top: 8px;
}
.upsell-card p {
  margin: 4px 0 0;
  font-size: .8rem;
  opacity: .85;
  line-height: 1.35;
}
.btn-secondary {
  flex-shrink: 0;
  background: #fff;
  color: var(--brand);
  text-decoration: none;
  font-weight: 700;
  font-size: .85rem;
  padding: 10px 14px;
  border-radius: 999px;
}

/* Drawer */
.drawer {
  position: fixed; inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
}
.drawer-backdrop {
  position: absolute; inset: 0;
  background: rgba(15,7,24,.45);
}
.drawer-panel {
  position: relative;
  width: 100%;
  max-height: min(78dvh, 640px);
  background: #fff;
  border-radius: 24px 24px 0 0;
  padding: 8px 16px calc(16px + var(--safe-b));
  overflow: auto;
  animation: slideUp .28s ease;
}
@keyframes slideUp {
  from { transform: translateY(40px); opacity: .6; }
  to { transform: translateY(0); opacity: 1; }
}
.drawer-body h3 {
  font-family: var(--display);
  font-size: 1.35rem;
  margin: 0 0 8px;
  line-height: 1.2;
}
.drawer-body .drawer-time {
  color: var(--brand);
  font-weight: 700;
  font-size: .85rem;
  margin-bottom: 10px;
}
.drawer-body p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.5;
  font-size: .95rem;
}
.tip-box {
  background: #fff8e7;
  border-left: 3px solid #f5a623;
  border-radius: 0 12px 12px 0;
  padding: 12px 14px;
  margin: 12px 0;
  font-size: .9rem;
  line-height: 1.45;
}
.tip-box strong { color: #9a6700; }
.meta-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 4px;
}
.meta-chips span {
  background: var(--panel-soft);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--ink);
}
.drawer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}
.btn-ghost {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  padding: 14px;
}

/* Leaflet custom markers */
.smf-marker {
  background: var(--brand);
  color: #fff;
  border: 2px solid #fff;
  border-radius: 50%;
  width: 28px !important;
  height: 28px !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .72rem;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(196,30,140,.45);
}
.smf-marker.is-food { background: var(--ok); }

@media (min-width: 768px) {
  .view-dash {
    max-width: 480px;
    margin: 0 auto;
    box-shadow: 0 0 0 1px var(--line), var(--shadow);
  }
  .view-cover .cover-body {
    margin-left: auto;
    margin-right: auto;
  }
  .drawer { justify-content: center; }
  .drawer-panel {
    max-width: 480px;
    margin: 0 auto;
  }
}
