:root {
  --bg: #0f1115;
  --panel: #181b22;
  --panel-2: #20242d;
  --text: #e8eaed;
  --muted: #9aa0aa;
  --accent: #4ade80;
  --border: #2a2f3a;
  --shadow: 0 8px 30px rgba(0,0,0,.45);
  /* cuisine colors */
  --c-texmex: #f59e0b;
  --c-med: #38bdf8;
  --c-korean: #f43f5e;
  --c-desi: #a78bfa;
  --c-thai: #34d399;
  --c-poke: #fb7185;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--text); overflow: hidden;
}

#map { position: absolute; inset: 0; z-index: 1; background: var(--bg); }

/* Top bar */
#topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 1000;
  padding: max(env(safe-area-inset-top), 10px) 10px 8px;
  background: linear-gradient(180deg, rgba(15,17,21,.96) 60%, rgba(15,17,21,0));
  pointer-events: none;
}
#topbar > * { pointer-events: auto; }
.brand { font-weight: 700; font-size: 15px; margin: 0 2px 8px; letter-spacing: .2px; }
.chip-row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto; border: 1px solid var(--border); background: var(--panel);
  color: var(--text); padding: 6px 12px; border-radius: 999px; font-size: 13px;
  font-weight: 600; cursor: pointer; white-space: nowrap; transition: all .12s;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip[aria-pressed="true"] { background: var(--accent); color: #07120a; border-color: var(--accent); }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.chip.toggle[aria-pressed="true"] { background: #e8eaed; color: #07120a; border-color: #e8eaed; }

/* Floating buttons */
#locateBtn, #listToggle {
  position: absolute; z-index: 1000; border: 1px solid var(--border);
  background: var(--panel); color: var(--text); box-shadow: var(--shadow);
  cursor: pointer; font-weight: 600;
}
#locateBtn {
  right: 12px; bottom: calc(env(safe-area-inset-bottom) + 22px);
  width: 50px; height: 50px; border-radius: 50%; font-size: 22px;
}
#listToggle {
  left: 12px; bottom: calc(env(safe-area-inset-bottom) + 22px);
  height: 44px; padding: 0 16px; border-radius: 999px; font-size: 14px;
}

#count {
  position: absolute; z-index: 999; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 30px);
  background: var(--panel); border: 1px solid var(--border); color: var(--muted);
  padding: 5px 12px; border-radius: 999px; font-size: 12px; box-shadow: var(--shadow);
  pointer-events: none;
}

/* Bottom sheet */
#sheet {
  position: absolute; z-index: 1100; left: 0; right: 0; bottom: 0;
  background: var(--panel); border-top: 1px solid var(--border);
  border-radius: 18px 18px 0 0; box-shadow: var(--shadow);
  padding: 18px 18px calc(env(safe-area-inset-bottom) + 22px);
  max-height: 72vh; overflow-y: auto; transition: transform .22s ease;
}
#sheet.hidden { transform: translateY(110%); }
#sheetClose {
  position: absolute; top: 12px; right: 12px; width: 32px; height: 32px;
  border-radius: 50%; border: 1px solid var(--border); background: var(--panel-2);
  color: var(--text); font-size: 15px; cursor: pointer;
}
.sheet-name { font-size: 20px; font-weight: 700; margin: 2px 60px 4px 0; }
.sheet-meta { color: var(--muted); font-size: 13px; margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.badge { display: inline-flex; align-items: center; gap: 5px; background: var(--panel-2); border: 1px solid var(--border); padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge .dot { width: 8px; height: 8px; border-radius: 50%; }
.macros { color: var(--accent); font-weight: 700; }

.order-label { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin: 14px 0 6px; font-weight: 700; }
.order-box {
  background: var(--panel-2); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 10px; padding: 12px 14px; font-size: 15px; line-height: 1.5;
}
.notes { color: var(--muted); font-size: 13px; margin-top: 10px; font-style: italic; }
.apps { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.app-link {
  text-decoration: none; background: var(--accent); color: #07120a; font-weight: 700;
  padding: 9px 14px; border-radius: 10px; font-size: 14px;
}
.app-link.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
.dist { margin-left: auto; color: var(--muted); font-size: 12px; }

/* List panel */
#listPanel {
  position: absolute; z-index: 1100; left: 0; right: 0; bottom: 0; top: auto;
  max-height: 80vh; overflow-y: auto; background: var(--bg);
  border-top: 1px solid var(--border); border-radius: 18px 18px 0 0;
  padding: 14px 12px calc(env(safe-area-inset-bottom) + 80px); box-shadow: var(--shadow);
}
.list-item {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 10px; cursor: pointer;
}
.list-item h3 { margin: 0 0 4px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.list-item .li-meta { color: var(--muted); font-size: 12px; }
.list-item .li-order { font-size: 13px; margin-top: 6px; color: var(--text); opacity: .9; }

.hidden { display: none; }

.sep { flex: 0 0 auto; width: 1px; align-self: stretch; background: var(--border); margin: 2px 2px; }
#picksToggle[aria-pressed="true"] { background: #fbbf24; color: #1a1206; border-color: #fbbf24; }

/* Leaflet marker pin (verified picks — big, with ring) */
.pin {
  width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  border: 2px solid #fff; box-shadow: 0 0 0 2px rgba(251,191,36,.9), 0 2px 8px rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
}
.pin span { transform: rotate(45deg); font-size: 13px; }
.pin .star { position: absolute; top: -7px; right: -7px; transform: rotate(45deg); font-size: 11px; }

/* Nearby (auto) markers — small dots */
.dotpin {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.7); box-shadow: 0 1px 3px rgba(0,0,0,.5);
  opacity: .9;
}

/* Cluster bubble */
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background: rgba(74,222,128,.25); }
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div {
  background: rgba(74,222,128,.85); color: #07120a; font-weight: 700;
}

.disclaimer {
  background: rgba(251,191,36,.1); border: 1px solid rgba(251,191,36,.3);
  color: #fcd34d; border-radius: 8px; padding: 8px 10px; font-size: 12px; margin: 12px 0 4px;
}
.pick-badge { background: #fbbf24 !important; color: #1a1206 !important; border-color: #fbbf24 !important; }

/* Toast / location fallback */
#toast {
  position: absolute; z-index: 1200; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 84px); width: min(92vw, 460px);
  background: var(--panel); border: 1px solid var(--border); box-shadow: var(--shadow);
  border-radius: 14px; padding: 12px 14px; font-size: 13px; color: var(--text);
  transition: opacity .2s, transform .2s;
}
#toast.hidden { opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(8px); }
#toast .t-msg { margin-bottom: 8px; line-height: 1.4; }
#toast .t-row { display: flex; gap: 6px; flex-wrap: wrap; }
#toast button {
  flex: 1 1 auto; border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  border-radius: 9px; padding: 8px 10px; font-size: 13px; font-weight: 600; cursor: pointer;
}
#toast button.primary { background: var(--accent); color: #07120a; border-color: var(--accent); }
#toast .t-close { position: absolute; top: 6px; right: 8px; flex: 0; padding: 2px 6px; background: none; border: none; color: var(--muted); font-size: 14px; }
.me-dot {
  width: 18px; height: 18px; background: #3b82f6; border-radius: 50%;
  border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(59,130,246,.25);
}

@media (min-width: 760px) {
  #topbar { max-width: 520px; }
  #sheet, #listPanel { left: auto; right: 16px; bottom: 16px; width: 420px; border-radius: 16px; border: 1px solid var(--border); }
  #sheet.hidden { transform: translateY(120%); }
}
