:root {
  --bg: #ffffff;
  --surface: #f4f4f6;
  --surface-2: #ebebef;
  --line: #e4e4e9;
  --text: #0a0a0c;
  --muted: #6b6b76;
  --chip-on-bg: #0a0a0c;
  --chip-on-fg: #ffffff;
  --star: #f5b400;
  --star-off: #dcdce2;
  --open: #12a150;
  --soon: #d97706;
  --closed: #d63c3c;
  --c-restaurant: #f43f5e;
  --c-late-night: #7c3aed;
  --c-cafe: #f59e0b;
  --c-bar: #0891b2;
  --shadow: 0 1px 2px rgb(10 10 12 / .06), 0 8px 24px rgb(10 10 12 / .10);
  --radius: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0e;
    --surface: #17171c;
    --surface-2: #212128;
    --line: #26262e;
    --text: #f4f4f6;
    --muted: #9a9aa6;
    --chip-on-bg: #f4f4f6;
    --chip-on-fg: #0b0b0e;
    --star-off: #3a3a44;
    --open: #34d27b;
    --soon: #f5a524;
    --closed: #f26b6b;
    --c-restaurant: #fb5a76;
    --c-late-night: #9b6bff;
    --c-cafe: #fbb024;
    --c-bar: #22b8d6;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 10px 30px rgb(0 0 0 / .45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }

/* ---------- layout ---------- */
.app {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
  grid-template-areas: "top" "main";
}
.top { grid-area: top; }
.list, .map-wrap { grid-area: main; min-height: 0; }
.app[data-view="map"] .list { display: none; }
.app[data-view="list"] .map-wrap { visibility: hidden; }


/* ---------- header ---------- */
.top {
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  z-index: 500;
  min-width: 0;
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  background: var(--c-restaurant) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 2v7c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2V2M7 2v20M21 15V2a5 5 0 0 0-5 5v6c0 1.1.9 2 2 2h3Zm0 0v7'/%3E%3C/svg%3E") center / 18px no-repeat;
}
.brand-text { min-width: 0; flex: 1; }
.brand h1 { margin: 0; font-size: 19px; line-height: 1.1; font-weight: 800; letter-spacing: -.025em; }
.brand h1 span { color: var(--c-restaurant); }
.brand p { margin: 1px 0 0; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.credit {
  flex: none; text-align: right; font-size: 11px; line-height: 1.25; color: var(--muted);
  text-decoration: none; padding: 4px 0 4px 8px;
}
.credit b { color: var(--text); font-weight: 650; }
.credit:hover b { text-decoration: underline; }

.search {
  margin-top: 10px; display: flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 6px 0 14px; border-radius: 12px; background: var(--surface);
  border: 1px solid transparent; transition: border-color .15s, background .15s;
}
.search:focus-within { border-color: var(--text); background: var(--bg); }
.search svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; }
.search input::-webkit-search-cancel-button { display: none; }
.search button { width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; }

.chips {
  display: flex; gap: 6px; margin: 10px -16px 0; padding: 0 16px;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chips > * { flex: none; }
.chips button, .select select, .price-seg {
  height: 34px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg);
  font-size: 13.5px; font-weight: 550; white-space: nowrap;
}
.chips > button { display: inline-flex; align-items: center; gap: 6px; padding: 0 13px; transition: background .15s, color .15s, border-color .15s; }
.chips button[aria-pressed="true"] { background: var(--chip-on-bg); color: var(--chip-on-fg); border-color: var(--chip-on-bg); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.d-restaurant { background: var(--c-restaurant); }
.d-late-night { background: var(--c-late-night); }
.d-cafe { background: var(--c-cafe); }
.d-bar { background: var(--c-bar); }
.live { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
#near svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linejoin: round; }
#near[aria-pressed="true"] { background: #2f7bff; border-color: #2f7bff; color: #fff; }
#near[aria-pressed="true"] svg { fill: currentColor; }
#open[aria-pressed="true"] .live { background: var(--open); box-shadow: 0 0 0 3px rgb(18 161 80 / .25); }

.price-seg { display: inline-flex; padding: 2px; gap: 2px; }
.price-seg button { height: 28px; border: 0; padding: 0 9px; border-radius: 999px; background: transparent; font-weight: 650; letter-spacing: -.02em; }

.select { position: relative; display: inline-block; }
.select select { appearance: none; -webkit-appearance: none; padding: 0 30px 0 13px; cursor: pointer; }
.select::after {
  content: ""; position: absolute; right: 13px; top: 50%; width: 6px; height: 6px; margin-top: -5px;
  border: solid var(--muted); border-width: 0 1.8px 1.8px 0; transform: rotate(45deg); pointer-events: none;
}
.select.on select { background: var(--chip-on-bg); color: var(--chip-on-fg); border-color: var(--chip-on-bg); }
.select.on::after { border-color: var(--chip-on-fg); }

/* ---------- list ---------- */
.list { overflow-y: auto; -webkit-overflow-scrolling: touch; background: var(--bg); padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
@media (min-width: 960px) { .list { padding-bottom: 24px; } }
.list-head { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 16px 4px; font-size: 13px; color: var(--muted); }
.list-head b { color: var(--text); }
.link { border: 0; background: none; padding: 0; color: var(--text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; font-size: 13px; }

#results { padding: 4px 12px; display: grid; gap: 10px; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }

.card {
  position: relative; padding: 14px 14px 12px; border-radius: var(--radius);
  background: var(--bg); border: 1px solid var(--line);
  transition: border-color .15s, box-shadow .15s;
}
.card:hover { border-color: var(--surface-2); box-shadow: var(--shadow); }
.card.sel { border-color: var(--text); }
.c-head { display: flex; gap: 11px; align-items: flex-start; }
.badge { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; color: #fff; }
.badge svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.b-restaurant { background: var(--c-restaurant); }
.b-late-night { background: var(--c-late-night); }
.b-cafe { background: var(--c-cafe); }
.b-bar { background: var(--c-bar); }
.c-title { min-width: 0; flex: 1; }
.c-title h3 { margin: 0; font-size: 16px; line-height: 1.25; font-weight: 700; letter-spacing: -.012em; }
.c-kind { font-size: 13px; color: var(--muted); margin-top: 1px; }
.x { border: 0; background: var(--surface); width: 30px; height: 30px; border-radius: 50%; font-size: 18px; line-height: 1; color: var(--muted); flex: none; }

.c-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 10px; font-size: 13.5px; }
.rating { display: inline-flex; align-items: center; gap: 5px; }
.rating .muted, .muted { color: var(--muted); }
.stars {
  --star-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5l2.9 6.1 6.6.8-4.9 4.6 1.3 6.6L12 17.3 6.1 20.6l1.3-6.6L2.5 9.4l6.6-.8z'/%3E%3C/svg%3E");
  width: 75px; height: 15px; display: inline-block;
  background: linear-gradient(90deg, var(--star) var(--p), var(--star-off) var(--p));
  -webkit-mask: var(--star-mask) 0 0 / 15px 15px repeat-x;
          mask: var(--star-mask) 0 0 / 15px 15px repeat-x;
}
.price { display: inline-flex; align-items: baseline; gap: 6px; font-weight: 700; letter-spacing: -.02em; }
.price i { font-style: normal; color: var(--star-off); margin-left: -6px; }
.price small { font-weight: 500; color: var(--muted); letter-spacing: 0; font-size: 12.5px; }
.dist { color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.dist svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.c-status { margin-top: 6px; font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.c-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.s-open { color: var(--open); }
.s-soon { color: var(--soon); }
.s-closed { color: var(--closed); }
.s-na { color: var(--muted); }

.c-note { margin: 8px 0 0; font-size: 14px; color: var(--text); opacity: .86; }
.c-note::before { content: "“"; }
.c-note::after { content: "”"; }

.c-actions { display: flex; gap: 8px; margin-top: 12px; }
.btn {
  height: 38px; padding: 0 14px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 13.5px; font-weight: 650; text-decoration: none; border: 1px solid var(--line); background: var(--bg); white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.btn.primary { flex: 1; background: var(--chip-on-bg); color: var(--chip-on-fg); border-color: var(--chip-on-bg); }
.btn.icon { width: 38px; padding: 0; }
.btn:active { transform: scale(.98); }

.c-hours { margin-top: 10px; font-size: 13px; }
.c-hours summary { cursor: pointer; color: var(--muted); font-weight: 600; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.c-hours summary::-webkit-details-marker { display: none; }
.c-hours summary::after { content: ""; width: 5px; height: 5px; border: solid currentColor; border-width: 0 1.6px 1.6px 0; transform: rotate(45deg) translateY(-2px); transition: transform .15s; }
.c-hours[open] summary::after { transform: rotate(225deg) translateY(-1px); }
.c-hours ul { list-style: none; margin: 8px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--surface); display: grid; gap: 3px; }
.c-hours li { display: flex; justify-content: space-between; gap: 12px; }
.c-hours li span:first-child { color: var(--muted); width: 36px; flex: none; }
.c-hours li span:last-child { text-align: right; }
.c-hours li.today { font-weight: 700; }
.c-hours li.today span:first-child { color: var(--text); }

.about { padding: 18px 20px 8px; font-size: 12.5px; color: var(--muted); }
.about p { margin: 0 0 8px; }

/* ---------- map ---------- */
.map-wrap { position: relative; }
#map { position: absolute; inset: 0; background: var(--surface); }
.leaflet-container { font: inherit; background: var(--surface); }
.leaflet-tile-pane { filter: grayscale(1) brightness(1.04) contrast(.86); }
.leaflet-control-attribution { font-size: 10px; background: rgb(255 255 255 / .75) !important; }
@media (prefers-color-scheme: dark) {
  .leaflet-tile-pane { filter: grayscale(1) invert(1) brightness(.82) contrast(.92); }
  .leaflet-control-attribution { background: rgb(11 11 14 / .7) !important; color: var(--muted); }
  .leaflet-control-attribution a { color: var(--text); }
}
.leaflet-bar a { background: var(--bg); color: var(--text); border-color: var(--line); }

.pin {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  border: 2px solid #fff; box-shadow: 0 2px 6px rgb(0 0 0 / .3); transition: transform .15s;
}
.pin svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.p-restaurant { background: var(--c-restaurant); }
.p-late-night { background: var(--c-late-night); }
.p-cafe { background: var(--c-cafe); }
.p-bar { background: var(--c-bar); }
.pin-wrap:hover .pin { transform: scale(1.15); }
.pin-wrap.sel { z-index: 900 !important; }
.pin-wrap.sel .pin { transform: scale(1.35); box-shadow: 0 0 0 4px rgb(10 10 12 / .25), 0 4px 10px rgb(0 0 0 / .35); }
.pin-wrap.dim .pin { opacity: .25; transform: scale(.8); }

.venue {
  display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 999px;
  background: #0a0a0c; color: #fff; font-size: 12px; font-weight: 700; white-space: nowrap; box-shadow: 0 3px 10px rgb(0 0 0 / .35);
  width: max-content;
}
.venue i { width: 22px; height: 22px; border-radius: 50%; background: #fff; color: #0a0a0c; display: grid; place-items: center; font-style: normal; font-size: 12px; }
.me-dot { width: 16px; height: 16px; border-radius: 50%; background: #2f7bff; border: 3px solid #fff; box-shadow: 0 0 0 6px rgb(47 123 255 / .25); }

.map-btn {
  position: absolute; z-index: 600; right: 12px; top: 12px; width: 42px; height: 42px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg); box-shadow: var(--shadow); display: grid; place-items: center;
}
@media (min-width: 960px) { .map-btn { top: 86px; right: 10px; width: 34px; height: 34px; border-radius: 8px; } }
.map-btn svg { width: 20px; height: 20px; fill: none; stroke: var(--text); stroke-width: 2; stroke-linecap: round; }
.map-btn .fill { fill: var(--text); stroke: none; }
.map-btn.on svg { stroke: #2f7bff; }
.map-btn.on .fill { fill: #2f7bff; }

.peek {
  position: absolute; z-index: 700; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom));
  max-width: 440px; margin: 0 auto;
  animation: up .2s ease-out;
}
.peek .card { box-shadow: var(--shadow); border-color: var(--line); max-height: 48dvh; overflow-y: auto; }
.peek .c-note { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@media (min-width: 960px) { .peek { bottom: 24px; left: 24px; right: auto; width: 400px; } }
@keyframes up { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

.view-toggle {
  position: fixed; z-index: 800; left: 50%; transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom));
  height: 46px; padding: 0 20px; border-radius: 999px; border: 0;
  background: var(--chip-on-bg); color: var(--chip-on-fg); font-weight: 700; font-size: 14.5px;
  display: inline-flex; align-items: center; gap: 8px; box-shadow: 0 6px 20px rgb(0 0 0 / .3);
}
.view-toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.toast {
  position: fixed; z-index: 900; left: 50%; top: calc(16px + env(safe-area-inset-top)); transform: translateX(-50%);
  padding: 10px 16px; border-radius: 12px; background: var(--chip-on-bg); color: var(--chip-on-fg); font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow); max-width: calc(100vw - 32px);
}

/* ---------- desktop ---------- */
@media (min-width: 960px) {
  .app {
    grid-template-columns: 440px 1fr;
    grid-template-areas: "top map" "list map";
  }
  .list { grid-area: list; display: block !important; border-right: 1px solid var(--line); }
  .map-wrap { grid-area: map; visibility: visible !important; }
  .top { border-right: 1px solid var(--line); }
  .chips { flex-wrap: wrap; overflow: visible; }
  .view-toggle { display: none; }
}
