:root {
  color-scheme: light;
  --ink: #17332e;
  --muted: #60756f;
  --line: #d9e6e1;
  --paper: #ffffff;
  --wash: #eef7f3;
  --green: #0f6d58;
  --green-dark: #0a5142;
  --blue: #2d79c8;
  --shadow: 0 12px 34px rgba(25, 68, 58, 0.12);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body { width: 100%; height: 100%; margin: 0; }

body {
  color: var(--ink);
  background: var(--wash);
  overflow: hidden;
}

button, input, select { font: inherit; }
button, select, input[type="checkbox"], input[type="range"] { cursor: pointer; }
a { color: var(--green); }

.app-shell {
  display: grid;
  grid-template-columns: minmax(340px, 430px) 1fr;
  width: 100%;
  height: 100%;
}

.sidebar {
  z-index: 500;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #f9fcfb;
  border-right: 1px solid var(--line);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #b6cec6 transparent;
}

.hero {
  padding: 26px 24px 22px;
  color: white;
  background:
    radial-gradient(circle at 92% 8%, rgba(130, 218, 187, .42), transparent 34%),
    linear-gradient(145deg, #0a5847 0%, #12816a 100%);
}

.eyebrow {
  margin: 0 0 8px;
  color: #c7eee0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(23px, 3vw, 32px);
  line-height: 1.18;
  letter-spacing: -.02em;
}

.hero > p:not(.eyebrow) {
  margin: 12px 0 18px;
  color: #e0f5ed;
  font-size: 14px;
  line-height: 1.65;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 14px;
  background: rgba(255, 255, 255, .08);
  backdrop-filter: blur(8px);
}

.hero-stats div { padding: 11px 8px; text-align: center; }
.hero-stats div + div { border-left: 1px solid rgba(255, 255, 255, .15); }
.hero-stats strong { display: block; font-size: 19px; }
.hero-stats span { color: #caeee1; font-size: 11px; }

.filter-panel { padding: 20px 22px; border-bottom: 1px solid var(--line); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-heading h2 { margin: 0; font-size: 16px; }
.text-button { padding: 3px 0; color: var(--green); background: none; border: 0; font-size: 12px; font-weight: 700; }

.search-field, .two-column-control label, .range-control { display: grid; gap: 7px; }
.search-field { margin: 16px 0; }
.search-field span, .two-column-control label > span, .range-control > span, legend { color: #516a63; font-size: 12px; font-weight: 700; }

input[type="search"], select {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  color: var(--ink);
  background: white;
  border: 1px solid #cfded9;
  border-radius: 10px;
  outline: none;
}

input[type="search"]:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(15, 109, 88, .12); }
fieldset { margin: 0 0 17px; padding: 0; border: 0; }
legend { margin-bottom: 9px; }

.chip-grid { display: flex; flex-wrap: wrap; gap: 7px; }

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  color: #5b6965;
  background: white;
  border: 1px solid #d5e2dd;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  transition: .15s ease;
}

.filter-chip span {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: white;
  background: #aab6b2;
  border-radius: 50%;
}

.filter-chip.active { color: var(--chip-color); border-color: color-mix(in srgb, var(--chip-color) 45%, white); background: color-mix(in srgb, var(--chip-color) 8%, white); }
.filter-chip.active span { background: var(--chip-color); }

.check-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.check-chip { position: relative; }
.check-chip input { position: absolute; opacity: 0; pointer-events: none; }
.check-chip span { display: block; padding: 7px 10px; border: 1px solid #d5e2dd; border-radius: 8px; background: white; color: #52645f; font-size: 11px; font-weight: 700; }
.check-chip input:checked + span { color: white; border-color: var(--green); background: var(--green); }

.two-column-control { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.range-control input { width: 100%; accent-color: var(--green); }
.evidence-toggle { display: flex; align-items: center; gap: 10px; margin-top: 16px; padding: 11px 12px; color: #355b51; background: #eaf5f1; border: 1px solid #c8ded6; border-radius: 10px; }
.evidence-toggle input { width: 17px; height: 17px; accent-color: var(--green); }
.evidence-toggle span { display: grid; gap: 2px; }
.evidence-toggle strong { font-size: 11px; }
.evidence-toggle small { color: #6d8079; font-size: 9px; }

.results-section { min-height: 250px; padding: 0 14px 20px; }
.sticky-heading { position: sticky; top: 0; z-index: 3; padding: 16px 8px 10px; background: rgba(249, 252, 251, .96); backdrop-filter: blur(8px); }
.muted { color: var(--muted); font-size: 12px; }
.restaurant-list { display: grid; gap: 10px; }

.restaurant-card {
  position: relative;
  padding: 14px 14px 13px;
  background: white;
  border: 1px solid #dbe6e2;
  border-radius: 13px;
  box-shadow: 0 3px 10px rgba(37, 74, 65, .04);
  outline: none;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.restaurant-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; border-radius: 13px 0 0 13px; background: var(--accent); }
.restaurant-card:hover, .restaurant-card:focus-visible, .restaurant-card.highlighted { transform: translateY(-1px); border-color: var(--accent); box-shadow: 0 8px 20px rgba(37, 74, 65, .1); }
.card-topline { display: flex; align-items: center; justify-content: space-between; }
.card-topline > strong { color: var(--green-dark); font-size: 18px; }
.card-topline small { color: var(--muted); font-size: 10px; }
.card-type { display: inline-flex; align-items: center; gap: 6px; color: #50635d; font-size: 11px; font-weight: 700; }
.card-type i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.restaurant-card h3 { margin: 7px 0 5px; color: #163630; font-size: 15px; line-height: 1.35; }
.card-address { margin: 0; color: #6b7b76; font-size: 11px; line-height: 1.5; }
.distance-row { display: flex; gap: 7px; margin: 9px 0; }
.distance-row span { padding: 4px 7px; color: #42665d; background: #edf6f2; border-radius: 6px; font-size: 10px; font-weight: 700; }
.card-picks { margin: 0 0 9px; color: #3f514c; font-size: 11px; line-height: 1.55; }
.scene-row { display: flex; flex-wrap: wrap; gap: 5px; }
.scene-row span { padding: 3px 6px; color: #697873; background: #f3f6f5; border-radius: 5px; font-size: 9px; }
.card-bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.card-actions { display: grid; flex: 0 0 auto; justify-items: end; gap: 5px; }
.dianping-card-link { padding: 3px 6px; color: #b84b22; background: #fff0e8; border-radius: 5px; font-size: 9px; font-weight: 800; text-decoration: none; }
.dianping-card-link:hover { color: #8f3517; background: #ffe2d3; }
.dianping-card-link.exact { color: #08734f; background: #e1f4eb; }
.dianping-card-link.exact:hover { color: #07583d; background: #cfecdf; }
.dianping-card-link.review { color: #5f4b96; background: #eee9fb; }
.dianping-card-link.review:hover { color: #493675; background: #e2daf7; }
.dianping-card-link.conflict { color: #8a4d18; background: #fff0d7; }
.dianping-card-link.conflict:hover { color: #69380d; background: #ffe4b9; }
.business-evidence { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; padding: 6px 8px; border-radius: 7px; font-size: 9px; }
.business-evidence strong { padding: 2px 5px; border-radius: 4px; }
.business-evidence.strong { color: #315f50; background: #e9f5f0; }
.business-evidence.strong strong { color: white; background: #258263; }
.business-evidence.weak { color: #755f60; background: #f7eeee; }
.business-evidence.weak strong { color: white; background: #9a6d70; }
.menu-count { flex: 0 0 auto; color: var(--green); font-size: 9px; font-weight: 800; }
.menu-count.missing { color: #8b7778; }
.menu-count.verified { padding: 3px 6px; color: #08734f; background: #e1f4eb; border-radius: 5px; }

.empty-state { display: grid; justify-items: center; gap: 6px; margin-top: 18px; padding: 32px 18px; color: var(--muted); border: 1px dashed #bfd1ca; border-radius: 12px; background: #f6faf8; font-size: 12px; }
.sidebar-footer { margin-top: auto; padding: 18px 22px 24px; color: var(--muted); background: #eff6f3; border-top: 1px solid var(--line); font-size: 11px; line-height: 1.6; }
.sidebar-footer p { margin: 0 0 8px; }
.sidebar-footer a { display: block; font-weight: 700; }
.sidebar-footer a + a { margin-top: 4px; }

.map-stage { position: relative; min-width: 0; min-height: 0; }
#map { width: 100%; height: 100%; background: #dceae5; }

.map-toolbar {
  position: absolute;
  z-index: 600;
  top: 16px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 9px 8px 12px;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, .94);
  border: 1px solid rgba(197, 214, 207, .95);
  border-radius: 12px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.core-legend { display: flex; align-items: center; gap: 11px; white-space: nowrap; color: #3f5851; font-size: 11px; font-weight: 700; }
.core-legend span { display: inline-flex; align-items: center; gap: 3px; }
.legend-star { font-style: normal; font-size: 16px; line-height: 1; }
.legend-star.red { color: #df3949; }
.legend-star.blue { color: #2679d3; }
.map-button { padding: 7px 10px; color: white; background: var(--green); border: 0; border-radius: 8px; font-size: 11px; font-weight: 700; }
.map-button:hover { background: var(--green-dark); }

.map-legend {
  position: absolute;
  z-index: 600;
  right: 16px;
  bottom: 34px;
  display: grid;
  gap: 6px;
  padding: 10px 11px;
  background: rgba(255, 255, 255, .94);
  border: 1px solid #d2e0db;
  border-radius: 10px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(9px);
}

.map-legend span { display: flex; align-items: center; gap: 7px; color: #435a54; font-size: 10px; font-weight: 700; }
.map-legend i { display: grid; place-items: center; width: 19px; height: 19px; color: white; background: var(--legend); border-radius: 50%; font-size: 9px; font-style: normal; }
.map-note { position: absolute; z-index: 500; left: 50%; bottom: 8px; transform: translateX(-50%); padding: 4px 8px; color: #51665f; background: rgba(255, 255, 255, .78); border-radius: 5px; font-size: 9px; white-space: nowrap; }

.restaurant-marker-shell, .core-marker-shell { background: transparent; border: 0; }
.restaurant-marker { position: relative; display: grid; place-items: center; width: 34px; height: 34px; color: white; background: var(--marker-color); border: 3px solid white; border-radius: 50% 50% 50% 10%; box-shadow: 0 4px 11px rgba(18, 53, 45, .28); transform: rotate(-45deg); }
.restaurant-marker span { font-size: 11px; font-weight: 900; transform: rotate(45deg); }
.core-marker { display: grid; place-items: center; width: 42px; height: 42px; color: white; border: 3px solid white; border-radius: 50%; box-shadow: 0 5px 14px rgba(20, 50, 45, .3); font-size: 24px; }
.core-red { background: #dc3447; }
.core-blue { background: #2577d0; }

.leaflet-popup-content-wrapper { border-radius: 14px; box-shadow: 0 16px 40px rgba(24, 54, 47, .22); }
.leaflet-popup-content { margin: 14px 15px 15px; }
.popup-card { color: #314842; font-size: 11px; line-height: 1.55; }
.popup-card h3 { margin: 7px 0 5px; color: #15352f; font-size: 17px; line-height: 1.3; }
.popup-card p { margin: 6px 0; }
.popup-topline { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.type-pill { padding: 4px 7px; color: var(--pill); background: color-mix(in srgb, var(--pill) 10%, white); border-radius: 999px; font-size: 9px; font-weight: 800; }
.health-badge { color: var(--green); font-size: 16px; }
.popup-address { color: #6d7d78; }
.popup-metrics { display: flex; gap: 7px; margin: 8px 0; }
.popup-metrics span { padding: 4px 7px; color: #3d6459; background: #edf6f2; border-radius: 6px; font-size: 10px; font-weight: 700; }
.popup-combos { margin: 7px 0; padding-left: 18px; }
.popup-combos li + li { margin-top: 4px; }
.popup-detail-button { width: 100%; margin: 7px 0 4px; padding: 8px 10px; color: white; background: var(--green); border: 0; border-radius: 7px; font-size: 10px; font-weight: 800; }
.popup-detail-button:hover { background: var(--green-dark); }
.popup-card .warning { padding: 7px 8px; color: #724a22; background: #fff7e7; border-radius: 7px; }
.popup-card a { font-weight: 800; text-decoration: none; }
.dianping-link { color: #b84b22; }
.core-popup { display: grid; gap: 5px; min-width: 190px; color: #4b615b; }
.core-popup strong { color: #173b33; font-size: 15px; }
.core-popup span { font-size: 11px; line-height: 1.5; }

.map-error { position: absolute; z-index: 800; inset: 50% auto auto 50%; display: grid; justify-items: center; gap: 7px; width: min(340px, 80%); padding: 24px; transform: translate(-50%, -50%); text-align: center; background: white; border: 1px solid #d1dfda; border-radius: 14px; box-shadow: var(--shadow); }
.map-error[hidden] { display: none; }
.map-error span { color: var(--muted); font-size: 12px; }
.fatal-error { max-width: 620px; margin: 12vh auto; padding: 28px; background: white; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }

.detail-backdrop {
  position: fixed;
  z-index: 1900;
  inset: 0;
  background: rgba(8, 29, 24, .42);
  backdrop-filter: blur(2px);
}

.detail-backdrop[hidden], .detail-drawer[hidden] { display: none; }

.detail-drawer {
  position: fixed;
  z-index: 2000;
  top: 0;
  right: 0;
  width: min(540px, 94vw);
  height: 100%;
  color: var(--ink);
  background: #f8fbfa;
  box-shadow: -22px 0 55px rgba(12, 42, 35, .22);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.detail-header {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 17px 20px;
  color: white;
  background: linear-gradient(135deg, #0b5c49, #10836a);
  box-shadow: 0 6px 18px rgba(18, 64, 53, .18);
}

.detail-header p { margin: 0 0 4px; color: #cceee2; font-size: 10px; font-weight: 700; letter-spacing: .06em; }
.detail-header h2 { margin: 0; font-size: 19px; line-height: 1.3; }
.detail-header button { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; color: white; background: rgba(255, 255, 255, .13); border: 1px solid rgba(255, 255, 255, .25); border-radius: 50%; font-size: 25px; line-height: 1; }
.detail-content { padding-bottom: 36px; }
.detail-hero { margin: 0; background: #e3efeb; }
.detail-hero img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.detail-hero figcaption { padding: 8px 18px; color: #6b7c77; background: #edf5f2; font-size: 9px; line-height: 1.5; }
.detail-hero figcaption a { font-weight: 800; }
.real-photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 3px; background: #dceae5; }
.real-photo-grid figure { min-width: 0; margin: 0; background: white; }
.real-photo-grid img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.real-photo-grid figcaption { padding: 6px; color: #62736e; font-size: 8px; line-height: 1.45; }
.missing-evidence { margin: 16px 18px 0; padding: 18px; color: #685d5e; background: #fff; border: 1px dashed #cbbfc0; border-radius: 12px; text-align: center; }
.missing-evidence strong { font-size: 13px; }
.missing-evidence p { margin: 7px 0 0; font-size: 10px; line-height: 1.6; }

.detail-summary, .dish-section, .combo-section, .detail-warning, .detail-sources { margin: 16px 18px 0; }
.detail-summary { padding: 16px; background: white; border: 1px solid var(--line); border-radius: 13px; }
.detail-tags { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.detail-tags span { padding: 5px 8px; color: var(--tag); background: color-mix(in srgb, var(--tag) 10%, white); border-radius: 999px; font-size: 10px; font-weight: 800; }
.detail-tags .evidence-status { margin-right: auto; color: #52635e; background: #edf2f0; }
.detail-tags .evidence-status.verified { color: #08734f; background: #e1f4eb; }
.detail-tags .evidence-status.missing { color: #8c5c61; background: #f7e9ea; }
.detail-tags strong { color: var(--green); font-size: 21px; }
.detail-summary p { margin: 10px 0 0; color: #455b55; font-size: 11px; line-height: 1.65; }
.detail-address { color: #6c7e78 !important; }
.detail-distances { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.detail-distances span { padding: 5px 7px; color: #366458; background: #eaf5f1; border-radius: 6px; font-size: 9px; font-weight: 800; }

.nutrition-notice { margin: 14px 18px 0; padding: 12px 14px; color: #624d24; background: #fff8e7; border: 1px solid #f1dfb9; border-radius: 11px; }
.nutrition-notice strong { font-size: 11px; }
.nutrition-notice p { margin: 5px 0 0; font-size: 9px; line-height: 1.65; }
.drawer-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.drawer-section-heading h3 { margin: 0; font-size: 15px; }
.drawer-section-heading span { color: var(--muted); font-size: 9px; }
.menu-completeness { margin: -3px 0 10px; color: #6b7b76; font-size: 9px; line-height: 1.55; }
.dish-grid { display: grid; gap: 9px; }

.dish-card { padding: 12px 13px; background: white; border: 1px solid var(--line); border-radius: 11px; }
.dish-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.dish-heading h4 { margin: 0 0 3px; font-size: 13px; }
.dish-heading div > span { color: #72827e; font-size: 9px; }
.recommendation { padding: 4px 7px; border-radius: 999px; font-size: 9px; white-space: nowrap; }
.recommendation.good { color: #08734f; background: #e1f4eb; }
.recommendation.moderate { color: #8a671b; background: #fff1c9; }
.recommendation.limit { color: #a43e45; background: #fde7e8; }
.macro-values { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin: 10px 0 7px; }
.macro-values span { color: #657671; font-size: 8px; white-space: nowrap; }
.macro-values strong { color: #263f38; }
.macro-values i { display: inline-block; width: 6px; height: 6px; margin-right: 3px; border-radius: 50%; }
.protein-dot, .macro-bar .protein { background: #2aa978; }
.carb-dot, .macro-bar .carb { background: #3d81d6; }
.fat-dot, .macro-bar .fat { background: #e49136; }
.macro-bar { display: flex; height: 7px; overflow: hidden; background: #ecf1ef; border-radius: 999px; }
.dish-card > p { margin: 8px 0 0; color: #586b65; font-size: 9px; line-height: 1.55; }

.combo-section { display: grid; gap: 8px; }
.combo-section .drawer-section-heading { margin-bottom: 2px; }
.combo-section article { padding: 11px 12px; background: white; border: 1px solid var(--line); border-radius: 10px; }
.combo-section article strong { color: var(--green); font-size: 11px; }
.combo-section article p { margin: 5px 0; color: #405851; font-size: 10px; line-height: 1.55; }
.combo-section article span { color: #75857f; font-size: 8px; }
.detail-warning { padding: 12px 13px; color: #724a22; background: #fff4e3; border-radius: 10px; }
.detail-warning strong { font-size: 11px; }
.detail-warning p { margin: 5px 0 0; font-size: 9px; line-height: 1.6; }
.detail-sources { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 12px 13px; background: #eaf3f0; border-radius: 10px; font-size: 9px; }
.detail-sources a { font-weight: 800; text-decoration: none; }
.detail-sources span { color: #6c7b77; }
body.detail-open { overflow: hidden; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: minmax(320px, 390px) 1fr; }
  .map-toolbar { left: 14px; transform: none; }
  .core-legend { display: none; }
}

@media (max-width: 760px) {
  body { overflow: auto; }
  .app-shell { display: flex; flex-direction: column; height: auto; min-height: 100%; }
  .sidebar { order: 2; height: auto; overflow: visible; border-right: 0; }
  .map-stage { order: 1; height: 58vh; min-height: 390px; }
  .hero { padding: 20px 18px; }
  .filter-panel { padding: 18px; }
  .results-section { padding-inline: 10px; }
  .sticky-heading { top: 0; }
  .map-toolbar { top: 10px; right: 10px; left: auto; }
  .map-legend { right: 10px; bottom: 32px; max-width: 160px; }
  .map-legend span { font-size: 9px; }
  .detail-drawer { width: 100%; }
  .detail-header { padding-top: max(17px, env(safe-area-inset-top)); }
}

@media (max-width: 430px) {
  .map-stage { height: 52vh; min-height: 340px; }
  .hero h1 { font-size: 24px; }
  .two-column-control { grid-template-columns: 1fr; }
  .map-legend { display: none; }
  .map-note { max-width: 85%; overflow: hidden; text-overflow: ellipsis; }
  .detail-summary, .dish-section, .combo-section, .detail-warning, .detail-sources, .nutrition-notice { margin-inline: 12px; }
  .missing-evidence { margin-inline: 12px; }
  .real-photo-grid { display: flex; gap: 4px; overflow-x: auto; scroll-snap-type: x mandatory; }
  .real-photo-grid figure { flex: 0 0 86%; scroll-snap-align: start; }
  .macro-values { gap: 3px; }
  .macro-values span { font-size: 7.5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
