:root {
  /* Fresh green palette */
  --paper: #eef3ee;
  --paper-deep: #e2eae3;
  --surface: #ffffff;
  --ink: #1b2a22;
  --ink-soft: #46584d;
  --muted: #82908a;
  --line: #e6ece8;
  --line-strong: #d4ded8;

  --accent: #1c6b43;        /* forest green */
  --accent-deep: #134d30;
  --accent-soft: #e6f3ec;
  --accent-line: #c2e1cf;

  --sage: #3f7a55;
  --sage-soft: #e6f1ea;
  --sage-line: #c9e1d3;
  --amber: #9a6a17;
  --amber-soft: #fbf0db;
  --amber-line: #efddb6;
  --plum: #6f5480;
  --plum-soft: #efe7f3;
  --plum-line: #ddcfe6;
  --slate: #3f5878;
  --slate-soft: #e4e9f0;
  --slate-line: #cdd7e6;
  --gold: #b07d2b;

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;

  --radius-lg: 18px;
  --radius: 14px;
  --radius-sm: 10px;

  --shadow-sm: 0 1px 2px rgba(20, 50, 35, 0.05);
  --shadow: 0 4px 16px rgba(20, 50, 35, 0.08);
  --shadow-lg: 0 24px 60px rgba(15, 45, 30, 0.22);
  --ring: 0 0 0 3px rgba(28, 107, 67, 0.25);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--paper-deep);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.88rem; }
a { color: var(--accent-deep); }

/* Phone-shaped app shell, centered on desktop */
.device {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--paper);
  box-shadow: var(--shadow-lg);
  position: relative;
  display: flex;
  flex-direction: column;
}

.kicker {
  display: block;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: rgba(246, 241, 231, 0.86);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 500;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark { border-radius: 12px; box-shadow: var(--shadow-sm); flex-shrink: 0; }
.wordmark h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.42rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
}
.wm-1 { color: var(--ink); }
.wm-2 { color: var(--accent); }
.tagline { margin: 3px 0 0; font-size: 0.74rem; color: var(--muted); }

/* Buttons */
button {
  font: inherit;
  font-family: var(--sans);
  cursor: pointer;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, color 0.16s ease, transform 0.04s ease;
}
button:focus-visible { outline: none; box-shadow: var(--ring); }
button:active { transform: translateY(1px); }

.primary-btn { background: var(--accent); color: #ffffff; padding: 11px 18px; font-weight: 600; box-shadow: var(--shadow-sm); }
.primary-btn:hover { background: var(--accent-deep); }
.primary-btn:disabled { background: #b7cabe; color: #f0f6f2; cursor: not-allowed; box-shadow: none; }
.primary-btn.wide { width: 100%; padding: 13px 18px; }

.secondary-btn { background: var(--surface); color: var(--ink); padding: 9px 15px; border: 1px solid var(--line-strong); font-weight: 600; }
.secondary-btn:hover { background: var(--paper); border-color: var(--accent-line); color: var(--accent-deep); }

.ghost-btn { background: transparent; color: var(--ink-soft); padding: 9px 15px; border: 1px solid var(--line-strong); font-weight: 600; }
.ghost-btn:hover { background: var(--surface); }

/* Layout */
main { flex: 1; padding: 18px 16px 28px; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.controls { padding: 18px; margin-bottom: 16px; }
.control-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.control-row:last-child { margin-bottom: 0; }
.control-row.manual input { flex: 1; min-width: 0; }
.location-status { margin: -4px 0 12px; }

/* Auto-location row + Traveling? toggle */
.loc-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.loc-row .location-status { margin: 0; flex: 1; min-width: 0; }
.travel-btn {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: 999px;
}
.travel-btn:hover { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-deep); }
.travel-btn.active { background: var(--accent); border-color: var(--accent); color: #ffffff; }
.travel-btn { display: inline-flex; align-items: center; gap: 6px; }
.travel-btn .travel-ico { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.manual-location { margin-top: 14px; }
.manual-location .manual { margin-bottom: 8px; }
.link-btn {
  background: none;
  border: none;
  color: var(--accent-deep);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 2px;
}
.link-btn:hover { text-decoration: underline; }

/* Find restaurants button under the map */
.find-btn { margin: 0 0 20px; }
.radius-row { gap: 14px; }
.radius-row label { font-size: 0.9rem; color: var(--ink-soft); white-space: nowrap; }
.radius-row strong { color: var(--accent-deep); font-family: var(--serif); }
.radius-row input[type="range"] { flex: 1; min-width: 120px; accent-color: var(--accent); height: 5px; }

/* Primary labeled 'Find restaurants near me' CTA under the controls */
.find-cta { margin: 4px 0 16px; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; font-size: 0.98rem; }
.find-cta.loading { pointer-events: none; }
.find-cta.loading .find-cta-label::before {
  content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 8px;
  border: 2px solid rgba(255,255,255,0.5); border-top-color: #fff; border-radius: 50%;
  animation: spin 0.7s linear infinite; vertical-align: -2px;
}

input[type="text"], input[type="email"], input[type="password"] {
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
input[type="text"]::placeholder, input[type="email"]::placeholder, input[type="password"]::placeholder { color: var(--muted); }
input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: var(--ring); }

/* "or" divider */
.divider { display: flex; align-items: center; gap: 12px; margin: 14px 0; color: var(--muted); font-size: 0.78rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line-strong); }
.divider span { text-transform: uppercase; letter-spacing: 0.12em; }

.profile-summary { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }

/* Engine banner */
.engine-banner { padding: 11px 18px; font-size: 0.84rem; font-weight: 500; text-align: center; }
.engine-banner.mock { background: var(--accent-soft); color: var(--accent-deep); }

/* Severe banner */
.severe-banner {
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--accent-deep);
  padding: 13px 15px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-weight: 500;
  font-size: 0.86rem;
  box-shadow: var(--shadow-sm);
}

/* Results */
.results-header { display: flex; align-items: center; justify-content: space-between; margin: 4px 2px 14px; flex-wrap: wrap; gap: 10px; }
.results-header h2 { margin: 0; font-family: var(--serif); font-size: 1.4rem; font-weight: 600; letter-spacing: -0.01em; }
.results-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.toggle { font-size: 0.84rem; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.toggle input { accent-color: var(--accent); width: 15px; height: 15px; }
.sort-control { font-size: 0.84rem; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; user-select: none; }
.sort-select { font-family: var(--sans); font-size: 0.84rem; color: var(--ink); background: var(--paper); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 4px 22px 4px 8px; cursor: pointer; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23888' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }
.sort-select:focus { outline: none; border-color: var(--accent-line); box-shadow: var(--ring); }

/* Empty-profile nudge in the results area */
.profile-nudge {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px 11px 14px; margin: 2px 2px 12px;
  background: var(--accent-soft); border: 1px solid var(--accent-line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.profile-nudge .pn-text { flex: 1; min-width: 0; font-size: 0.86rem; font-weight: 500; color: var(--accent-deep); line-height: 1.4; }
.profile-nudge .pn-btn {
  flex-shrink: 0; font-size: 0.8rem; font-weight: 600; padding: 8px 13px;
  border-radius: 999px; background: var(--accent); color: #fff; border: 1px solid var(--accent);
}
.profile-nudge .pn-btn:hover { background: var(--accent-deep); }
.profile-nudge .pn-close {
  flex-shrink: 0; width: 30px; height: 30px; padding: 0; display: grid; place-items: center;
  background: transparent; border: none; color: var(--accent-deep); border-radius: 50%;
}
.profile-nudge .pn-close:hover { background: rgba(0,0,0,0.06); }
.profile-nudge .pn-close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Map shell with floating overlay chips */
.map-wrap {
  position: relative;
  margin-bottom: 16px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}
#map { height: 300px; background: #efe9dd; }
/* Tint the gray basemap toward a soft, fresh green to match the brand */
#map .leaflet-tile { filter: sepia(0.18) saturate(0.85) hue-rotate(70deg) brightness(1.05) contrast(1.02); }
/* Soft inner vignette so floating chips stay legible */
.map-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 401;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(30, 70, 50, 0.06),
    inset 0 28px 36px -28px rgba(20, 50, 35, 0.22),
    inset 0 -28px 36px -28px rgba(20, 50, 35, 0.18);
}

/* Floating location + radius chip */
.map-chip {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1000;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: calc(100% - 84px);
  padding: 6px 13px;
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.map-chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  flex-shrink: 0;
}
.map-chip-sep { color: var(--muted); }

/* Floating marker legend */
.map-legend {
  position: absolute;
  bottom: 10px;
  left: 10px;
  z-index: 1000;
  pointer-events: none;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 5px 12px;
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  font-size: 0.71rem;
  font-weight: 500;
  color: var(--ink-soft);
}
.map-legend span { display: flex; align-items: center; gap: 5px; }
.lg-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.lg-rest { background: var(--accent); }
.lg-you { background: var(--sage); }

/* Brand-styled Leaflet controls */
.leaflet-control-zoom {
  border: none !important;
  border-radius: 12px !important;
  overflow: hidden;
  box-shadow: var(--shadow) !important;
  margin: 10px !important;
}
.leaflet-control-zoom a {
  width: 32px;
  height: 32px;
  line-height: 32px;
  font-size: 18px;
  color: var(--ink);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  transition: background 0.15s ease, color 0.15s ease;
}
.leaflet-control-zoom a:hover { background: var(--accent-soft); color: var(--accent-deep); }
.leaflet-control-zoom a:last-child { border-bottom: none; }
.leaflet-control-zoom a.leaflet-disabled { color: var(--line-strong); background: var(--surface); }
.leaflet-control-attribution {
  background: rgba(255, 253, 248, 0.82) !important;
  color: var(--muted) !important;
  font-family: var(--sans);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 8px 0 0 0;
}
.leaflet-control-attribution a { color: var(--accent-deep) !important; }

.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; align-items: start; }
.cards .placeholder { grid-column: 1 / -1; }
.placeholder {
  color: var(--muted);
  padding: 44px 26px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
}

/* Restaurant card — compact tile in a 2-up grid */
.r-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: opacity 0.45s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.2s ease, border-color 0.2s ease;
}
.r-card.reveal:not(.in) { opacity: 0; transform: translateY(14px); }
.r-card:hover { box-shadow: var(--shadow); transform: translateY(-3px); border-color: var(--line-strong); }
.r-card:focus-visible { outline: none; box-shadow: var(--ring), var(--shadow); }

.r-thumb {
  position: relative;
  aspect-ratio: 16 / 11;
  background: var(--tint, var(--accent-soft));
  display: grid;
  place-items: center;
  overflow: hidden;
}
.r-mono { font-family: var(--serif); font-weight: 600; font-size: 2.5rem; color: var(--accent-deep); opacity: 0.82; }
.thumb-match { position: absolute; top: 8px; left: 8px; }

.r-body { padding: 11px 13px 13px; }
.r-body h3 {
  margin: 0 0 3px;
  font-family: var(--serif);
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.r-meta { font-size: 0.78rem; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 7px; }
.r-meta a { color: var(--accent-deep); text-decoration: none; font-weight: 500; }
.r-meta a:hover { text-decoration: underline; }
.r-dot { color: var(--line-strong); }

/* Favorite heart */
.fav-btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 1.05rem;
  line-height: 1;
  display: grid;
  place-items: center;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--muted);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}
.fav-btn:hover { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.fav-btn.active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.r-thumb .fav-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  font-size: 0.92rem;
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(4px);
}
@keyframes favpop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
.fav-btn.pop { animation: favpop 0.28s ease; }

/* Inline-SVG icons inside round buttons. The button's grid place-items:center
   centers the <svg> box; a symmetric viewBox then centers the glyph exactly —
   unlike the font glyphs these replaced, which drifted off-center. */
.fav-btn svg, .modal-close svg, .report-btn svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.fav-btn.active svg { fill: currentColor; } /* filled heart when favorited */
.r-thumb .fav-btn svg { width: 16px; height: 16px; }
.detail-hero .fav-btn svg, .detail-hero .report-btn svg, .modal.detail .modal-close svg { width: 20px; height: 20px; }

/* Skeleton loaders */
.r-card.skeleton { cursor: default; }
.sk { background: linear-gradient(90deg, #e3ece6 25%, #f1f6f2 37%, #e3ece6 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.sk-thumb { aspect-ratio: 16 / 11; border-radius: 0; }
.r-card.skeleton .r-body { padding: 11px 13px 14px; }
.sk-line { height: 12px; margin-bottom: 8px; }
.sk-line.short { width: 58%; }
.sk-chips { height: 16px; width: 78%; margin-top: 10px; }

/* "+N" overflow chip on compact cards */
.badge-more { background: var(--surface); color: var(--muted); border: 1px solid var(--line-strong); }
.diet-tags-mini { margin: 9px 0 0; gap: 4px; }
.diet-tags-mini .badge { font-size: 0.66rem; padding: 3px 8px; }

/* Badges */
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.diet-tags { margin: 12px 0 2px; }
.badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.badge.lifestyle { background: var(--sage-soft); color: var(--sage); border-color: var(--sage-line); }
.badge.allergen { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-line); }
.badge.diet { background: var(--plum-soft); color: var(--plum); border-color: var(--plum-line); }
.badge.religious { background: var(--slate-soft); color: var(--slate); border-color: var(--slate-line); }
.badge.profile-chip { background: var(--surface); color: var(--ink-soft); border: 1px solid var(--line-strong); }
.badge-src { margin-left: 4px; font-size: 0.62rem; opacity: 0.6; vertical-align: 0.5px; }
.badge.match { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Match pill */
.match-pill {
  background: var(--accent);
  color: #ffffff;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Menu scrape panel */
.menu-block { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; font-size: 0.86rem; }
.menu-head { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 8px; }
.menu-head a { font-weight: 600; text-transform: none; letter-spacing: 0; }
.dish-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.dish-chip { font-size: 0.77rem; padding: 5px 11px; background: var(--paper); border: 1px solid var(--line-strong); border-radius: 999px; color: var(--ink-soft); }
.dish-chip em { color: var(--accent-deep); font-style: normal; font-weight: 600; }

/* Compact, consistent menu action row (every card has one) */
.menu-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.menu-block .menu-actions { margin-top: 8px; }
.scan-note { font-size: 0.8rem; }
.scan-btn {
  font-size: 0.77rem;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent-deep);
  border: 1px solid var(--accent-line);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.scan-btn:hover { background: var(--accent-soft); }
.scan-btn:disabled {
  color: var(--muted);
  background: var(--surface);
  border-color: var(--line-strong);
  cursor: default;
}
.scan-btn:disabled:hover { background: var(--surface); }

/* Structured full-menu (categories + items + prices) */
.mcat { margin-bottom: 12px; }
.mcat-name { font-size: 0.78rem; font-weight: 700; color: var(--accent-deep); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 5px; }
.mitem { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 0.86rem; }
.mitem:last-child { border-bottom: none; }
.mitem span { color: var(--ink-soft); }
.mitem em { color: var(--accent-deep); font-style: normal; font-weight: 600; flex-shrink: 0; }

/* Per-item safety flags */
.mflag { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; font-size: 0.62rem; font-weight: 700; margin-right: 6px; vertical-align: 0.5px; }
.mflag.ok { background: var(--sage-soft); color: var(--sage); }
.mflag.warn { background: var(--amber-soft); color: var(--amber); }
.mflag.danger { background: #fbe9e7; color: #c0392b; }
.menu-legend { font-size: 0.74rem; color: var(--ink-soft); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin: 2px 0 12px; }
.deep-ext { background: var(--accent); color: #fff; border-color: var(--accent); }
.deep-ext:hover { background: var(--accent-deep); }

/* "Before you go" message card */
.ask-card { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.ask-msg { margin: 8px 0 10px; padding: 11px 13px; background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--radius-sm); font-size: 0.86rem; color: var(--ink); line-height: 1.5; }

.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--accent-line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: -2px; margin-right: 7px; }
.spinner-sm { width: 11px; height: 11px; border-width: 2px; margin-right: 2px; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Community ratings */
.community { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 11px; font-size: 0.82rem; }
.community > strong { font-size: 0.8rem; }
.community .stars { color: var(--gold); letter-spacing: 1.5px; margin: 4px 0 2px; font-size: 0.92rem; }
.rate-row { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 10px; }
.rate-q { font-size: 0.82rem; color: var(--muted); }
.rate-btns { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.rate-row button { background: var(--paper); border: 1px solid var(--line-strong); width: 29px; height: 29px; padding: 0; font-size: 0.8rem; font-weight: 600; border-radius: 50%; color: var(--ink-soft); }
.rate-row button:hover { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-deep); }

/* AI review-sentiment summary ("What diners are saying") */
.review-analysis { margin-top: 14px; padding: 13px 14px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); }
.ra-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ra-head > strong { font-size: 0.86rem; }
.ra-count { font-size: 0.74rem; margin-left: auto; }
.ra-badge { font-size: 0.64rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 8px; border-radius: 999px; }
.ra-badge.positive { background: var(--sage-soft); color: var(--sage); }
.ra-badge.mixed { background: var(--amber-soft); color: var(--amber); }
.ra-badge.negative { background: #fbe9e7; color: #c0392b; }
.ra-headline { font-family: var(--serif); font-size: 1rem; font-weight: 600; color: var(--ink); margin-top: 8px; }
.ra-summary { font-size: 0.86rem; color: var(--ink-soft); line-height: 1.5; margin: 7px 0 0; }
.ra-points { margin: 8px 0 0; padding-left: 18px; font-size: 0.82rem; color: var(--ink-soft); }
.ra-points li { margin: 2px 0; }
.ra-points.pos li::marker { content: "✓  "; color: var(--sage); }
.ra-points.neg li::marker { content: "!  "; color: var(--amber); }
.ra-foot { font-size: 0.7rem; color: var(--muted); margin: 9px 0 0; }

/* Written reviews list + form */
.reviews { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.reviews > strong { font-size: 0.8rem; }
.review-list { margin-top: 8px; }
.review-item { padding: 9px 0; border-bottom: 1px dashed var(--line); }
.review-item:last-child { border-bottom: none; }
.review-item.mine { background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--radius-sm); padding: 9px 11px; margin-bottom: 8px; }
.review-who { font-size: 0.8rem; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 6px; }
.review-you { font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent-deep); background: var(--surface); border: 1px solid var(--accent-line); border-radius: 999px; padding: 1px 6px; }
.review-del { margin-left: auto; background: none; border: none; padding: 2px 4px; font-family: var(--sans); font-size: 0.72rem; font-weight: 600; color: #c0392b; cursor: pointer; }
.review-del:hover { text-decoration: underline; }
.review-del:disabled { opacity: 0.5; cursor: default; }
.review-text { font-size: 0.86rem; color: var(--ink-soft); line-height: 1.5; margin: 4px 0 0; white-space: pre-wrap; word-break: break-word; }
.review-empty { font-size: 0.85rem; margin: 6px 0; }
.review-more { margin-top: 8px; background: none; border: none; padding: 4px 0; font-family: var(--sans); font-size: 0.82rem; font-weight: 600; color: var(--accent-deep); cursor: pointer; }
.review-more:hover { text-decoration: underline; }
.review-signin { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0; font-size: 0.85rem; }
.review-form { margin-top: 12px; }
.review-input { width: 100%; resize: vertical; min-height: 64px; padding: 9px 11px; font-family: var(--sans); font-size: 0.86rem; color: var(--ink); background: var(--paper); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); }
.review-input:focus { outline: none; border-color: var(--accent-line); box-shadow: var(--ring); }
.review-msg { font-size: 0.78rem; }

/* Map markers — designed teardrop pin with a cream center */
.hb-marker {
  position: relative;
  width: 19px;
  height: 19px;
  background: linear-gradient(135deg, #2f9e63 0%, var(--accent) 60%);
  border: 2.5px solid #ffffff;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 3px 8px rgba(20, 50, 35, 0.35);
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.hb-marker::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  background: #ffffff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.hb-marker:hover {
  transform: rotate(-45deg) scale(1.22);
  box-shadow: 0 5px 12px rgba(20, 50, 35, 0.4);
}
/* "You are here" — sage dot with a gentle radar pulse */
.hb-you {
  position: relative;
  width: 15px;
  height: 15px;
  background: var(--sage);
  border: 3px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(20, 50, 35, 0.3);
}
.hb-you::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--sage);
  animation: hb-pulse 2.2s ease-out infinite;
}
@keyframes hb-pulse {
  0% { transform: scale(1); opacity: 0.55; }
  70% { transform: scale(2.6); opacity: 0; }
  100% { opacity: 0; }
}

/* Branded popup */
.leaflet-popup-content-wrapper { background: var(--surface) !important; border: 1px solid var(--line) !important; }
.leaflet-popup-tip { background: var(--surface) !important; box-shadow: none !important; border: 1px solid var(--line); border-top: none; border-left: none; }
.leaflet-popup-close-button { color: var(--muted) !important; }
.leaflet-popup-close-button:hover { color: var(--accent-deep) !important; }

/* App footer */
.appfoot { text-align: center; padding: 18px 16px 26px; font-size: 0.74rem; color: var(--muted); border-top: 1px solid var(--line); }
.appfoot span { font-family: var(--serif); color: var(--ink-soft); font-weight: 600; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(43, 33, 24, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  animation: overlay-in 0.18s ease;
}
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  position: relative;
  max-width: 480px;
  width: 100%;
  padding: 26px 24px 22px;
  max-height: 92vh;
  overflow-y: auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(0.985); } to { opacity: 1; transform: none; } }
.modal h2 { margin: 0 0 6px; font-family: var(--serif); font-size: 1.6rem; font-weight: 600; letter-spacing: -0.02em; }
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid transparent;
  border-radius: 50%;
}
.modal-close:hover { background: var(--line); color: var(--ink); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); margin: 16px 0; padding: 14px 16px; }
legend { font-weight: 600; padding: 0 7px; font-size: 0.85rem; color: var(--ink-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 9px; }
.chip {
  padding: 9px 14px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.86rem;
  font-weight: 500;
  user-select: none;
  cursor: pointer;
  transition: background 0.13s ease, border-color 0.13s ease, color 0.13s ease;
}
.chip:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.chip.selected { background: var(--accent); color: #ffffff; border-color: var(--accent); }
.chip.selected:hover { background: var(--accent-deep); }
.chip-ic { font-size: 1rem; line-height: 1; }
.chip-label { line-height: 1; }
/* Collapsed extra options, revealed by "+ Add More" */
.chips .chip-extra { display: none; }
.chips.show-extra .chip-extra { display: inline-flex; }
.chip-more {
  padding: 9px 14px; min-height: 42px;
  display: inline-flex; align-items: center;
  border: 1px dashed var(--line-strong); border-radius: 999px;
  background: transparent; color: var(--accent-deep);
  font-size: 0.84rem; font-weight: 600; cursor: pointer;
}
.chip-more:hover { background: var(--accent-soft); border-color: var(--accent-line); }
#severeInput { width: 100%; }

/* Severe-allergy alert card (replaces the plain fieldset) */
.severe-card { background: #fdecea; border: 1px solid #f3c2bb; border-radius: var(--radius); padding: 13px 14px; margin: 18px 0 10px; }
.severe-card-main { display: flex; align-items: center; gap: 11px; }
.severe-card-ic { flex-shrink: 0; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: #f6d2cc; color: #c0392b; }
.severe-card-ic svg { width: 19px; height: 19px; }
.severe-card-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.severe-card-text strong { color: #a3271b; font-size: 0.92rem; letter-spacing: -0.01em; }
.severe-card-text input#severeInput { background: #fff; border-color: #f0c4bd; padding: 7px 10px; font-size: 0.85rem; }
.severe-card-text input#severeInput:focus { border-color: #c0392b; box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.18); background: #fff; }
.severe-card-note { display: block; margin-top: 9px; font-size: 0.76rem; font-weight: 600; color: #b23a2b; }
.severe-switch { flex-shrink: 0; }
.severe-switch .switch-track { width: 46px; height: 28px; }
.severe-switch .switch-thumb { width: 22px; height: 22px; }
.severe-switch input:checked + .switch-track { background: #c0392b; }
.severe-switch input:checked + .switch-track .switch-thumb { transform: translateX(18px); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

body.modal-open { overflow: hidden; }

/* Topbar account + profile buttons */
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.topbar-actions .ghost-btn { padding: 8px 12px; font-size: 0.84rem; }

/* Auth modal */
.modal.auth { max-width: 400px; }
.auth-fields { display: flex; flex-direction: column; gap: 10px; margin: 16px 0 12px; }
.auth-error { color: #c0392b; font-size: 0.84rem; margin: 0 0 12px; font-weight: 500; }
.secondary-btn.wide { width: 100%; }
.auth-google { margin-top: 10px; }
.auth-switch { text-align: center; margin: 16px 0 0; font-size: 0.85rem; color: var(--muted); }
.auth-switch .link-btn { font-size: 0.85rem; }
.auth-signed { font-size: 0.95rem; color: var(--ink-soft); margin: 16px 0; }
.auth-signed strong { color: var(--ink); }

/* Terms of service gate */
.modal.tos { max-width: 460px; }
.tos-body { margin: 12px 0 16px; max-height: 56vh; overflow-y: auto; padding-right: 4px; }
.tos-body > p { margin: 0 0 10px; font-size: 0.86rem; line-height: 1.5; color: var(--ink-soft); }
.tos-body .tos-meta { font-size: 0.78rem; }
.tos-body h3 { margin: 16px 0 5px; font-family: var(--serif); font-size: 0.98rem; font-weight: 600; color: var(--ink); }
.tos-body ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 9px; }
.tos-body li { font-size: 0.86rem; line-height: 1.45; color: var(--ink-soft); }
.tos-body li strong, .tos-body p strong { color: var(--ink); }
.tos-body a { color: var(--accent-deep); }
.tos-callout { margin: 8px 0 6px; padding: 12px 14px; border-radius: 12px; background: #fdf1e6; border: 1px solid #f1d8bd; color: #7a3d12; font-size: 0.82rem; line-height: 1.5; }
.tos-callout strong { color: #6a3410; }
.tos-agree { display: flex; align-items: flex-start; gap: 9px; margin-top: 4px; padding: 12px 13px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); font-size: 0.86rem; cursor: pointer; }
.tos-agree input { margin-top: 2px; width: 17px; height: 17px; flex-shrink: 0; accent-color: var(--accent); cursor: pointer; }
#tosGate { margin-top: 14px; }

/* First-run dietary preferences popup */
.modal.diet-modal { max-width: 460px; }
.diet-modal .diet-intro { margin: 4px 0 4px; font-size: 0.9rem; line-height: 1.5; }
.diet-modal .diet-groups { margin: 6px 0 4px; }
.diet-modal fieldset { margin: 14px 0; }
.diet-modal .primary-btn.wide { margin-top: 8px; }
.diet-skip { display: block; width: 100%; text-align: center; margin: 12px 0 0; padding: 10px; font-size: 0.85rem; }

/* Restaurant detail view */
.modal.detail { padding: 0; max-width: 460px; overflow: hidden; }
#detailBody { display: flex; flex-direction: column; }
.detail-hero {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--tint, var(--accent-soft));
  display: grid;
  place-items: center;
}
.detail-mono { font-family: var(--serif); font-weight: 600; font-size: 4rem; color: var(--accent-deep); opacity: 0.82; }
.detail-hero .fav-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 38px;
  height: 38px;
  font-size: 1.15rem;
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(4px);
}
.detail-main { padding: 18px 20px 22px; max-height: 60vh; overflow-y: auto; }
.detail-titlerow { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.detail-main h2 { margin: 0; font-family: var(--serif); font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; }
.detail-meta { margin-top: 7px; }
.detail-contact { margin-top: 5px; }
.detail-main .diet-tags { margin-top: 14px; }
.detail-main .community { margin-top: 14px; }

/* Detail header rating line (gold stars + value + count) */
.detail-rating { margin-top: 8px; display: flex; align-items: center; gap: 6px; }
.detail-rating .r-rating { display: inline-flex; align-items: center; gap: 5px; }
.detail-rating .stars { color: var(--gold); letter-spacing: 1px; font-size: 0.98rem; }
.detail-rating .stars .star { color: var(--line-strong); }
.detail-rating .stars .star.on { color: var(--gold); }
.detail-rating .rating-val { font-weight: 700; color: var(--ink); font-size: 0.9rem; }
.detail-rating .d-count { color: var(--muted); font-size: 0.84rem; }
.detail-rating .r-norate { color: var(--muted); font-size: 0.82rem; font-weight: 600; }

/* Detail share button (top-right cluster with heart) */
.detail-hero .share-btn {
  position: absolute; top: 12px; right: 56px;
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; padding: 0;
  background: rgba(16, 20, 24, 0.55); color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22); backdrop-filter: blur(4px); z-index: 6;
}
.detail-hero .share-btn:hover { background: rgba(16, 20, 24, 0.82); }
.detail-hero .share-btn.copied { background: var(--accent); }
.detail-hero .share-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
/* Heart moves to the top-right (next to close), report stays top-left */
.detail-hero .fav-btn { top: 12px; right: 100px; left: auto; }

/* Menu / Info / Reviews tabs */
.detail-tabs { display: flex; gap: 4px; margin: 16px 0 4px; border-bottom: 1px solid var(--line); }
.dtab {
  flex: 1; background: transparent; border: none; border-bottom: 2px solid transparent;
  padding: 9px 6px 11px; font-size: 0.9rem; font-weight: 600; color: var(--muted);
  border-radius: 0; transition: color 0.15s ease, border-color 0.15s ease;
}
.dtab:hover { color: var(--ink-soft); }
.dtab.active { color: var(--accent-deep); border-bottom-color: var(--accent); }
.dpane { padding-top: 6px; }
.dpane .menu-block:first-child { border-top: none; padding-top: 4px; margin-top: 4px; }

/* 3-pill safety legend under the tabs */
.menu-legend3 { display: flex; flex-wrap: wrap; gap: 7px; margin: 8px 0 14px; }
.ml3 { display: inline-flex; align-items: center; gap: 6px; font-size: 0.74rem; font-weight: 600; padding: 5px 11px 5px 6px; border-radius: 999px; border: 1px solid transparent; }
.ml3 .mflag { margin-right: 0; }
.ml3.ok { background: var(--sage-soft); color: var(--sage); border-color: var(--sage-line); }
.ml3.warn { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-line); }
.ml3.danger { background: #fbe9e7; color: #c0392b; border-color: #f3c2bb; }

/* Menu item rows with right-aligned Safe / Check / Avoid pills */
.mitem { align-items: center; }
.mitem-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.mitem-name { color: var(--ink); font-weight: 500; }
.mitem-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.mitem-price { color: var(--accent-deep); font-weight: 600; font-size: 0.8rem; }
.mpill-wrap { flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.mpill { font-size: 0.72rem; font-weight: 700; padding: 3px 11px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap; }
.mpill.ok { background: var(--sage-soft); color: var(--sage); border-color: var(--sage-line); }
.mpill.warn { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-line); }
.mpill.danger { background: #fbe9e7; color: #c0392b; border-color: #f3c2bb; }
.mpill-sub { font-size: 0.66rem; font-weight: 600; line-height: 1.2; max-width: 120px; }
.mpill-sub.danger { color: #c0392b; }
.mpill-sub.warn { color: var(--amber); }

/* Onboarding tutorial */
.tutorial {
  position: fixed;
  inset: 0;
  z-index: 1500;
  background: var(--paper);
  display: flex;
  justify-content: center;
  animation: overlay-in 0.2s ease;
}
.tut-shell {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  padding: 56px 26px 30px;
}
.tut-skip {
  position: absolute;
  top: 18px;
  right: 18px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
  padding: 6px 8px;
}
.tut-skip:hover { color: var(--ink); }
.tut-viewport { flex: 1; overflow: hidden; }
.tut-track { display: flex; height: 100%; transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1); }
.tut-slide {
  min-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px 6px;
}
.tut-scene {
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #ffffff 0%, var(--tint, var(--accent-soft)) 70%);
  box-shadow: inset 0 0 0 1px rgba(30, 70, 50, 0.06), var(--shadow);
  display: grid;
  place-items: center;
  margin-bottom: 34px;
  animation: tut-float 5s ease-in-out infinite;
}
@keyframes tut-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
.tut-icon { width: 92px; height: 92px; color: var(--accent); }
.tut-title { margin: 0; font-family: var(--serif); font-size: 1.95rem; font-weight: 600; line-height: 1.16; letter-spacing: -0.02em; color: var(--ink); }
.tut-title .ac { color: var(--accent); }
.tut-text { margin: 12px 0 0; color: var(--muted); font-size: 0.93rem; line-height: 1.55; max-width: 300px; }
.tut-dots { display: flex; gap: 7px; justify-content: center; margin: 26px 0 22px; }
.tut-dot { width: 7px; height: 7px; padding: 0; border: none; border-radius: 999px; background: var(--line-strong); transition: width 0.3s ease, background 0.3s ease; cursor: pointer; }
.tut-dot.active { width: 24px; background: var(--accent); }
/* Clean exit from the tutorial into the main screen */
.tutorial.closing { animation: tut-out 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
@keyframes tut-out { to { opacity: 0; transform: scale(1.04); } }
@keyframes screen-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
main.intro-in { animation: screen-in 0.55s cubic-bezier(0.16, 1, 0.3, 1) both; }

.tut-actions { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.tut-actions .primary-btn { width: 100%; }
.tut-back { background: none; border: none; color: var(--muted); font-size: 0.86rem; font-weight: 600; padding: 6px 10px; }
.tut-back:hover { color: var(--ink); }

/* Leaflet popup */
.leaflet-popup-content { font-family: var(--sans); font-size: 0.84rem; line-height: 1.5; }
.leaflet-popup-content strong { font-family: var(--serif); color: var(--accent-deep); }
.leaflet-popup-content-wrapper { border-radius: var(--radius) !important; box-shadow: var(--shadow) !important; }
.leaflet-container { font: inherit; }

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .r-card.reveal:not(.in) { opacity: 1; transform: none; }
}

/* ===========================================================================
   DARK REDESIGN — v2 (overrides everything above via cascade)
   Variable-driven theme flip + new tabbed/mobile components.
   =========================================================================== */

/* 1) Dark palette — redefining :root overrides the light values per-property.
      Fonts and radii from the first :root block are intentionally kept. */
:root {
  --paper: #21272c;
  --paper-deep: #14181b;
  --surface: #2a3137;
  --ink: #eef2f0;
  --ink-soft: #aeb8b3;
  --muted: #7f8a85;
  --line: #313940;
  --line-strong: #3f484f;

  /* Muted, natural greens (not neon) — calmer than the v2 mint accents. */
  --accent: #3f9468;
  --accent-deep: #74b393;
  --accent-soft: rgba(63, 148, 104, 0.15);
  --accent-line: rgba(116, 179, 147, 0.26);

  --sage: #71b395; --sage-soft: rgba(108, 198, 154, 0.13); --sage-line: rgba(108, 198, 154, 0.26);
  --amber: #e0b15a; --amber-soft: rgba(224, 177, 90, 0.15); --amber-line: rgba(224, 177, 90, 0.30);
  --plum: #b79bd6; --plum-soft: rgba(183, 155, 214, 0.16); --plum-line: rgba(183, 155, 214, 0.32);
  --slate: #8fb0d6; --slate-soft: rgba(143, 176, 214, 0.15); --slate-line: rgba(143, 176, 214, 0.32);
  --gold: #e6c46a;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.30);
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.38);
  --shadow-lg: 0 30px 70px rgba(0, 0, 0, 0.55);
  --ring: 0 0 0 3px rgba(63, 148, 104, 0.28);
}

/* 2) Patch the few hardcoded-light spots from the v1 sheet */
.primary-btn:disabled { background: #2c3a33; color: #6f7d75; }
#map { background: #10141a; }
#map .leaflet-tile { filter: none; }           /* satellite imagery, no green tint */
.map-chip {
  background: rgba(16, 20, 24, 0.78);
  border-color: rgba(255, 255, 255, 0.12);
  color: #f2f6f4;
  backdrop-filter: blur(8px);
}
.r-thumb .fav-btn { background: rgba(16, 20, 24, 0.55); border-color: rgba(255, 255, 255, 0.18); color: #fff; }
.leaflet-control-attribution { background: rgba(16, 20, 24, 0.7) !important; color: #9aa6a0 !important; }
.leaflet-control-attribution a { color: var(--accent-deep) !important; }
.leaflet-control-zoom a { background: #232a30; color: #dfe7e3; border-bottom-color: #313940; }
.leaflet-control-zoom a:hover { background: #2c353b; color: #fff; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface) !important; border-color: var(--line) !important; }
.modal-overlay { background: rgba(0, 0, 0, 0.62); }
.mflag.danger { background: rgba(200, 80, 70, 0.18); color: #e08a7e; }
.sk { background: linear-gradient(90deg, #262d33 25%, #313a41 37%, #262d33 63%); background-size: 400% 100%; }

/* 3) Device shell — leave room for the fixed bottom nav */
body { background: var(--paper-deep); }
.device { background: var(--paper); box-shadow: var(--shadow-lg); }
main.tabs { padding: 6px 20px calc(86px + env(safe-area-inset-bottom, 0px)); }

/* 4) Tab panels */
.tab-panel { display: none; animation: panel-in 0.32s cubic-bezier(0.16, 1, 0.3, 1); }
.tab-panel.active { display: block; }
@keyframes panel-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* 5) Big centered title */
.app-hero { text-align: center; padding: 14px 0 16px; }
.hero-title {
  margin: 0;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 2.3rem;
  letter-spacing: -0.025em;
  color: #f4f8f6;
  line-height: 1;
}

/* 6) Map — taller hero with strong rounding */
.map-wrap { margin-bottom: 14px; border-color: rgba(255, 255, 255, 0.08); border-radius: 22px; }
#map { height: 340px; }
.map-wrap::before {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    inset 0 26px 40px -30px rgba(0, 0, 0, 0.7),
    inset 0 -26px 40px -30px rgba(0, 0, 0, 0.6);
}

/* 7) Search bar (pill) */
.searchbar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 5px 6px 5px 12px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}
.searchbar input[type="text"] {
  flex: 1;
  min-width: 0;
  width: auto;
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 9px 4px;
  color: var(--ink);
  font-size: 0.95rem;
}
.searchbar input[type="text"]:focus { border: none; box-shadow: none; background: transparent; }
.search-ico {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: var(--muted);
  width: 30px; height: 30px;
  display: grid; place-items: center;
  padding: 0;
}
.search-ico:hover { color: var(--accent-deep); }
.search-ico svg { width: 19px; height: 19px; }
.round-icon {
  flex-shrink: 0;
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid; place-items: center;
  padding: 0;
  background: #323a41;
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
}
.round-icon:hover { background: #3a444b; color: #fff; }
.round-icon svg { width: 19px; height: 19px; }
.round-icon.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.round-icon.accent:hover { background: var(--accent-deep); }
.round-icon.accent:disabled { background: #2c3a33; border-color: var(--line-strong); color: #61706a; cursor: default; }

/* 8) Compact controls */
.map-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.map-controls .location-status { margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.radius-row { margin-bottom: 8px; }
.radius-row label { color: var(--ink-soft); }
.manual-location { margin: 0 0 14px; }

/* 9) Results header */
.results-header { margin: 2px 2px 12px; }
.results-header h2 { color: var(--ink); }

/* 10) Card carousel — horizontal scroll-snap */
.cards {
  display: flex;
  grid-template-columns: none;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding: 4px 2px 10px;
  margin: 0 -2px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.cards::-webkit-scrollbar { height: 7px; }
.cards::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; }
.cards .placeholder { min-width: 100%; }
.cards .r-card {
  min-width: 184px;
  max-width: 184px;
  scroll-snap-align: start;
  background: var(--surface);
  border-color: var(--line);
}
/* In a horizontal scroller the reveal-on-scroll gate can hide off-screen cards — keep them visible */
.cards .r-card.reveal:not(.in) { opacity: 1; transform: none; }
.r-thumb { aspect-ratio: 16 / 12; }
.r-thumb::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.18), rgba(0, 0, 0, 0.12));
  pointer-events: none;
}
.r-emoji { font-size: 2.5rem; line-height: 1; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.22)); position: relative; z-index: 1; }
.r-body h3 { color: var(--ink); }

/* 11) Coming-soon placeholder panels */
.coming-soon { text-align: center; padding: 40px 26px; color: var(--muted); }
.coming-soon svg { width: 56px; height: 56px; color: var(--accent); opacity: 0.85; margin-bottom: 16px; }
.coming-soon h2 { margin: 0 0 10px; font-family: var(--serif); font-size: 1.5rem; font-weight: 600; color: var(--ink); }
.coming-soon p { margin: 0 auto; max-width: 300px; font-size: 0.9rem; line-height: 1.55; }
.coming-soon strong { color: var(--accent-deep); }

/* 12) Profile pane */
.profile-pane { padding: 6px 2px; }
.profile-intro { margin: 0 0 16px; font-size: 0.9rem; line-height: 1.5; }
.profile-pane .profile-summary { margin-top: 18px; }
.profile-foot { margin-top: 22px; text-align: center; }

/* 13) Bottom tab bar */
.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  gap: 2px;
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom, 0px));
  background: rgba(22, 27, 31, 0.92);
  backdrop-filter: saturate(160%) blur(14px);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  z-index: 800;
}
.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 12px;
  padding: 9px 2px 7px;
  min-height: 52px;
  justify-content: center;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: color 0.16s ease, background 0.16s ease;
}
.tab-btn svg { width: 23px; height: 23px; }
.tab-btn span { line-height: 1; }
.tab-btn:hover { color: var(--ink-soft); }
.tab-btn.active { color: var(--accent-deep); }
.tab-btn.active svg { stroke: var(--accent-deep); }

/* Center "Scan Menu" FAB — a raised green disc with a label beneath, sitting
   between Search and Saved in the 5-item nav. */
.tab-fab {
  flex: 1;
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 0 2px 7px;
  min-height: 52px;
  justify-content: flex-end;
  color: var(--accent-deep);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.tab-fab-disc {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin-top: -20px;               /* float above the bar */
  background: var(--accent);
  color: #fff;
  border: 3px solid var(--surface);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.32);
  transition: background 0.16s ease, transform 0.12s ease, box-shadow 0.16s ease;
}
.tab-fab:hover .tab-fab-disc { background: #357f59; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.36); }
.tab-fab:active .tab-fab-disc { transform: translateY(1px); }
.tab-fab-disc svg { width: 24px; height: 24px; stroke: currentColor; }
.tab-fab-label { line-height: 1; }
/* Empty balancing slot so the Cook-mode Scan Food FAB sits dead-center. */
.tab-spacer { flex: 1; pointer-events: none; }

/* Scan-menu coming-soon sheet */
.modal.scan-modal { max-width: 380px; text-align: center; }
.scan-modal-ic {
  display: grid; place-items: center;
  width: 60px; height: 60px; margin: 4px auto 12px;
  border-radius: 18px; background: var(--accent-soft); color: var(--accent-deep);
  border: 1px solid var(--accent-line);
}
.scan-modal-ic svg { width: 30px; height: 30px; }
.scan-modal .kicker { text-align: center; }
.scan-modal p { font-size: 0.9rem; line-height: 1.55; margin: 6px 0 18px; }
/* Scanner — capture, busy, results, and the contribution offer. The result list
   reuses the menu-block / mitem styles, but left-aligned inside the centered modal. */
.scan-modal { max-width: 420px; }
/* Sit above the detail modal (1000) so scanning from a restaurant page works. */
#scanModal { z-index: 1100; }
.scan-actions { margin-top: 6px; }
.scan-busy { display: flex; align-items: center; justify-content: center; gap: 9px; padding: 18px 0; }
.scan-result { text-align: left; max-height: 46vh; overflow-y: auto; margin-top: 6px; }
.scan-result .menu-block { border: none; padding: 0; margin: 0; }
.scan-result .menu-head { margin-bottom: 8px; }
.scan-error { text-align: center; color: #c0392b; font-size: 0.88rem; margin: 12px 0 6px; }
.scan-contribute { text-align: left; margin-top: 14px; }
.scan-share-card { border: 1px solid var(--accent-line); background: var(--accent-soft); border-radius: 14px; padding: 14px 15px; }
.scan-share-card strong { display: block; margin-bottom: 4px; }
.scan-share-card p { margin: 0 0 12px; }
.scan-share-card .menu-actions { margin-top: 0; }
.scan-share-msg { display: block; margin-top: 8px; }
.scan-share-thanks { margin: 0; font-weight: 600; color: var(--accent-deep); }
.scan-menu-btn::before { content: "📷"; margin-right: 6px; }

/* Premium gate inside the scanner */
.scan-locked { text-align: center; }
.scan-locked p { margin: 6px 0 14px; }
.scan-locked-badge {
  display: inline-block; margin-bottom: 16px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
  color: var(--accent-deep); background: var(--accent-soft);
  border: 1px solid var(--accent-line); border-radius: 999px; padding: 4px 12px;
}
.scan-upgrade-msg { min-height: 1em; margin: 10px 0 4px; }
.scan-locked .link-btn { margin-top: 4px; }

/* Diner-contributed menu photo on the detail page */
.menu-photo-card { margin: 4px 0 14px; }
.menu-photo { display: block; position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.menu-photo img { display: block; width: 100%; max-height: 280px; object-fit: cover; }
.menu-photo-tag {
  position: absolute; left: 8px; bottom: 8px;
  font-size: 0.68rem; font-weight: 600; color: #fff;
  background: rgba(16, 20, 24, 0.62); border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px; padding: 3px 9px; backdrop-filter: blur(4px);
}
.menu-photo-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 7px; font-size: 0.78rem; }
.mp-vote { display: flex; gap: 6px; }
.mp-vote button {
  font-size: 0.74rem; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); cursor: pointer;
}
.mp-vote .mp-real:hover { background: var(--sage-soft); color: var(--sage); border-color: var(--sage-line); }
.mp-vote .mp-fake:hover { background: #fbe9e7; color: #c0392b; border-color: #f3c2bb; }
.mp-vote button:disabled { opacity: 0.5; cursor: default; }
.mp-voted, .mp-mine { font-weight: 600; color: var(--accent-deep); }

/* 14) Darker inputs inside modals keep contrast */
input[type="text"], input[type="email"], input[type="password"] { background: #1b2126; }
input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus { background: #20272c; }

/* 15) Tutorial scene — dark glass disc (the light pastel --tint pearl is for
   light mode only; on dark it read as a glaring white ball). */
.tut-scene {
  background: radial-gradient(circle at 34% 26%, var(--surface) 0%, var(--paper-deep) 76%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), var(--shadow);
}
.tut-title { color: var(--ink); }

/* 16) Account icon — signed-in state */
.round-icon.signed-in { color: var(--accent-deep); border-color: var(--accent-line); background: var(--accent-soft); }

/* 17) Profile tab — account card + inline editor */
.account-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 22px;
}
.account-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.account-avatar {
  flex-shrink: 0;
  width: 46px; height: 46px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent);
  color: #fff;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.25rem;
}
.account-avatar.guest { background: #39424a; color: var(--accent-deep); }
.account-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.account-meta strong { color: var(--ink); font-size: 0.98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-meta .muted { font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-action { flex-shrink: 0; padding: 9px 16px; }

.profile-edit { margin-bottom: 10px; }
.pe-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 2px; }
.pe-hint { font-size: 0.72rem; font-weight: 600; color: var(--accent-deep); letter-spacing: 0.01em; }
.section-title { margin: 0 0 10px; font-family: var(--serif); font-size: 1.18rem; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.profile-edit fieldset { margin: 14px 0; }

/* 18) Activity tab */
.activity-pane { padding: 4px 2px; }
.activity-search { margin-bottom: 20px; }
.activity-pane .section-title { margin-top: 20px; }
.activity-list { display: flex; flex-direction: column; gap: 9px; margin-bottom: 8px; }
.act-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.05s ease, background 0.15s ease;
}
.act-item:hover { border-color: var(--accent-line); background: #2f373d; }
.act-emoji {
  flex-shrink: 0;
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: var(--tint, var(--accent-soft));
  font-size: 1.55rem;
  font-family: var(--serif);
  color: var(--accent-deep);
}
.act-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.act-text strong { color: var(--ink); font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-meta { font-size: 0.78rem; color: var(--muted); display: flex; align-items: center; gap: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-review { font-size: 0.78rem; color: var(--accent-deep); margin-top: 1px; }
.placeholder.small { padding: 22px 18px; font-size: 0.85rem; }

/* Reviews feed on the Saved screen */
.reviews-feed { margin-top: 24px; }
.rf-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.rf-head .section-title { margin: 0; }
.rf-seeall { background: none; border: none; padding: 2px 4px; font-family: var(--sans); font-size: 0.82rem; font-weight: 600; color: var(--accent-deep); cursor: pointer; }
.rf-seeall:hover { text-decoration: underline; }
.review-feed { display: flex; flex-direction: column; gap: 10px; }
.rf-card {
  display: flex; flex-direction: column; gap: 8px; width: 100%; text-align: left;
  padding: 13px 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease;
}
.rf-card:hover { border-color: var(--accent-line); }
.rf-top { display: flex; align-items: center; gap: 11px; }
.rf-top .r-thumb { width: 42px; height: 42px; flex-shrink: 0; aspect-ratio: auto; border-radius: 11px; overflow: hidden; }
.rf-top .r-thumb .r-emoji { font-size: 1.4rem; }
.rf-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.rf-meta strong { color: var(--ink); font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rf-loc { font-size: 0.78rem; color: var(--muted); }
.rf-rating .stars, .rf-text .stars { color: var(--gold); letter-spacing: 0.5px; }
.rf-rating .stars .star, .rf-text .stars .star { color: var(--line-strong); }
.rf-rating .stars .star.on, .rf-text .stars .star.on { color: var(--gold); }
.rf-text { margin: 0; font-size: 0.82rem; color: var(--ink-soft); }
.rf-foot { font-size: 0.72rem; font-weight: 600; color: var(--accent-deep); }

/* 19) Search button loading state (icon button — spin the icon, never show text) */
.round-icon.loading svg { animation: spin 0.7s linear infinite; }

/* 20) Settings — appearance row + toggle switch */
.settings-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 16px; margin-bottom: 22px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.settings-label { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.settings-label strong { color: var(--ink); font-size: 0.96rem; }
.settings-label .muted { font-size: 0.8rem; }
.switch { position: relative; flex-shrink: 0; cursor: pointer; display: inline-block; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track { display: block; width: 50px; height: 30px; border-radius: 999px; background: #3a434a; transition: background 0.18s ease; }
.switch-thumb {
  position: absolute; top: 3px; left: 3px; width: 24px; height: 24px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(20px); }
.switch input:focus-visible + .switch-track { box-shadow: var(--ring); }

/* 21) Danger zone */
.danger-zone { margin: 18px 0 4px; padding-top: 16px; border-top: 1px solid var(--line); }
.danger-title { color: #ff8a7d; font-size: 1.05rem; margin-bottom: 10px; }
.danger-btn {
  width: 100%; padding: 12px 16px; font-weight: 600; font-size: 0.92rem;
  border-radius: var(--radius-sm);
  background: rgba(220, 70, 60, 0.14); color: #ff8a7d; border: 1px solid rgba(220, 70, 60, 0.4);
}
.danger-btn:hover { background: rgba(220, 70, 60, 0.22); }
.danger-btn.ghost { background: transparent; color: var(--ink-soft); border-color: var(--line-strong); }
.danger-btn.ghost:hover { background: var(--surface); color: var(--ink); }
.danger-note { font-size: 0.78rem; margin: 8px 0 0; }

/* 22) LIGHT THEME (opt-in via html.light) — restores the original light palette
       and reverts the dark-mode hardcoded patches. */
html.light {
  --paper: #eef3ee; --paper-deep: #e2eae3; --surface: #ffffff;
  --ink: #1b2a22; --ink-soft: #46584d; --muted: #82908a;
  --line: #e6ece8; --line-strong: #d4ded8;
  --accent: #1c6b43; --accent-deep: #134d30; --accent-soft: #e6f3ec; --accent-line: #c2e1cf;
  --sage: #3f7a55; --sage-soft: #e6f1ea; --sage-line: #c9e1d3;
  --amber: #9a6a17; --amber-soft: #fbf0db; --amber-line: #efddb6;
  --plum: #6f5480; --plum-soft: #efe7f3; --plum-line: #ddcfe6;
  --slate: #3f5878; --slate-soft: #e4e9f0; --slate-line: #cdd7e6;
  --gold: #b07d2b;
  --shadow-sm: 0 1px 2px rgba(20, 50, 35, 0.05);
  --shadow: 0 4px 16px rgba(20, 50, 35, 0.08);
  --shadow-lg: 0 24px 60px rgba(15, 45, 30, 0.22);
  --ring: 0 0 0 3px rgba(28, 107, 67, 0.25);
}
html.light .hero-title { color: #16241c; }
html.light #map { background: #e8efe9; }
html.light .map-wrap { border-color: var(--line-strong); }
html.light .map-chip { background: rgba(255, 253, 248, 0.92); border-color: var(--line-strong); color: var(--ink); }
html.light .r-thumb .fav-btn { background: rgba(255, 253, 248, 0.92); border-color: var(--line-strong); color: var(--muted); }
html.light .leaflet-control-attribution { background: rgba(255, 253, 248, 0.82) !important; color: var(--muted) !important; }
html.light .leaflet-control-zoom a { background: #fff; color: var(--ink); border-bottom-color: var(--line); }
html.light .leaflet-control-zoom a:hover { background: var(--accent-soft); color: var(--accent-deep); }
html.light .sk { background: linear-gradient(90deg, #e3ece6 25%, #f1f6f2 37%, #e3ece6 63%); background-size: 400% 100%; }
html.light .mflag.danger { background: #fbe9e7; color: #c0392b; }
html.light .primary-btn:disabled { background: #b7cabe; color: #f0f6f2; }
html.light .round-icon { background: #eef3ee; color: var(--ink-soft); }
html.light .round-icon:hover { background: #e2eae3; color: var(--ink); }
html.light .round-icon.accent { background: var(--accent); color: #fff; }
html.light .round-icon.accent:disabled { background: #b7cabe; color: #f0f6f2; }
html.light .tabbar { background: rgba(246, 250, 247, 0.93); border-top-color: rgba(0, 0, 0, 0.06); }
html.light input[type="text"], html.light input[type="email"], html.light input[type="password"] { background: var(--paper); }
html.light input[type="text"]:focus, html.light input[type="email"]:focus, html.light input[type="password"]:focus { background: var(--surface); }
html.light .act-item:hover { background: var(--paper); }
html.light .account-avatar.guest { background: #dce7df; color: var(--accent-deep); }
html.light .switch-track { background: #cdd7d0; }
html.light .danger-title { color: #c0392b; }
html.light .danger-btn { background: #fbe9e7; color: #c0392b; border-color: #f1c4bd; }
html.light .danger-btn:hover { background: #f7ddd9; }
html.light .danger-btn.ghost { background: transparent; color: var(--ink-soft); border-color: var(--line-strong); }
html.light .tut-scene { background: radial-gradient(circle at 32% 28%, #ffffff 0%, var(--tint, var(--accent-soft)) 70%); }

/* 23) Staggered card entrance (applied only on fresh searches via .anim-in).
   Quick slide-up that overshoots and settles — reads as deliberate motion,
   not a plain fade. */
@keyframes card-rise {
  0%   { opacity: 0; transform: translateY(24px) scale(0.96); }
  55%  { opacity: 1; transform: translateY(-4px) scale(1.005); }
  100% { opacity: 1; transform: none; }
}
.cards .r-card.anim-in { animation: card-rise 0.42s cubic-bezier(0.2, 0.9, 0.25, 1) both; }

/* 24) Disabled cuisine search input */
.searchbar input:disabled { cursor: not-allowed; opacity: 0.6; }

/* 25) Detail view close button — clearly visible over the hero */
.modal.detail .modal-close {
  /* Match the heart/report buttons so all three align across the hero top. */
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  background: rgba(16, 20, 24, 0.58);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(4px);
  z-index: 6;
}
.modal.detail .modal-close:hover { background: rgba(16, 20, 24, 0.82); color: #fff; }

/* 26) Scorecard — recorded answer */
.my-vote { color: var(--accent-deep); font-weight: 600; font-size: 0.82rem; }

/* 27) Detail hero report (mod check) button — true top-left corner */
.detail-hero .report-btn {
  position: absolute; top: 12px; left: 12px;
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; padding: 0;
  font-size: 1.05rem; line-height: 1;
  background: rgba(16, 20, 24, 0.55); color: #ffcf99;
  border: 1px solid rgba(255, 255, 255, 0.22); backdrop-filter: blur(4px);
}
.detail-hero .report-btn:hover { background: rgba(190, 64, 44, 0.78); color: #fff; }

/* 28) Community menu */
.cmenu-hint { font-size: 0.78rem; color: var(--muted); margin: 0 0 12px; line-height: 1.45; }
.cmenu-empty { font-size: 0.85rem; margin: 6px 0; }
.cmenu-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.cmenu-item:last-of-type { border-bottom: none; }
.cmenu-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cmenu-name { color: var(--ink); font-size: 0.9rem; }
.cmenu-name em { color: var(--accent-deep); font-style: normal; font-weight: 600; }
.cmenu-meta { font-size: 0.72rem; color: var(--muted); }
.cmenu-item.confirmed .cmenu-meta { color: var(--accent-deep); }
.cmenu-vote { display: flex; gap: 6px; flex-shrink: 0; }
.cmenu-real, .cmenu-fake { width: 30px; height: 30px; border-radius: 50%; padding: 0; font-size: 0.85rem; font-weight: 700; border: 1px solid var(--line-strong); background: var(--paper); }
.cmenu-real { color: var(--accent-deep); }
.cmenu-real:hover { background: var(--accent-soft); border-color: var(--accent-line); }
.cmenu-fake { color: #ff8a7d; }
.cmenu-fake:hover { background: rgba(220, 70, 60, 0.18); border-color: rgba(220, 70, 60, 0.4); }
.cmenu-voted { font-size: 0.95rem; color: var(--muted); flex-shrink: 0; }
.cmenu-add { display: flex; gap: 6px; margin-top: 12px; }
.cmenu-add .cmenu-input { flex: 1; min-width: 0; }
.cmenu-add .cmenu-price { width: 60px; flex-shrink: 0; }
.cmenu-add input { padding: 8px 10px; }
.cmenu-add .scan-btn { flex-shrink: 0; }
.cmenu-addmsg { font-size: 0.78rem; margin-top: 6px; }
.cmenu-addmsg:empty { display: none; }

/* 29) AI menu — inline dietary tags on menu items */
.ai-tags { display: inline-flex; gap: 4px; margin-left: 6px; vertical-align: 1px; }
.ai-tags .badge { font-size: 0.6rem; padding: 2px 7px; }

/* 30) Restaurant photos (og:image) on cards + detail hero */
.r-thumb .r-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.35s ease; z-index: 0; }
.r-thumb.has-photo .r-photo { opacity: 1; }
.r-thumb.has-photo .r-emoji, .r-thumb.has-photo .r-mono { opacity: 0; }
.detail-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.detail-hero.has-photo .detail-mono { opacity: 0; }

/* ===========================================================================
   31) LIGHT-SAGE REDESIGN (v3) — softer palette, preferences card, list rows.
   Light is now the default theme; these refine html.light and add the new
   Home components. Appended last so it wins the cascade.
   =========================================================================== */
html.light {
  --paper: #f4f7f2;            /* near-white app background (matches mockup) */
  --paper-deep: #e9efe8;
  --surface: #ffffff;          /* clean white cards */
  --ink: #21302a; --ink-soft: #4f6157; --muted: #84938b;
  --line: #e6efe8; --line-strong: #d3e1d7;
  --accent: #2e7d4f; --accent-deep: #1c6a40; --accent-soft: #e3f1e8; --accent-line: #c6e3d1;
  --sage: #3a7d56; --sage-soft: #e4f1ea; --sage-line: #c7e2d4;
  --amber: #9a6a17; --amber-soft: #fbf0db; --amber-line: #eedcb4;
  --plum: #6f5480; --plum-soft: #efe7f3; --plum-line: #ddcfe6;
  --slate: #3f5878; --slate-soft: #e3e9f1; --slate-line: #ccd7e6;
  --gold: #b07d2b;
  --shadow-sm: 0 1px 3px rgba(31, 74, 48, 0.06);
  --shadow: 0 6px 20px rgba(31, 74, 48, 0.10);
  --shadow-lg: 0 24px 60px rgba(20, 55, 35, 0.18);
}
html.light body { background: var(--paper); }
html.light .device { background: var(--paper); }

/* Home hero — leaf + green wordmark */
.home-hero { display: flex; align-items: center; justify-content: center; gap: 9px; padding: 16px 2px 14px; }
.home-hero .hero-title { font-size: 1.6rem; color: var(--accent-deep); font-weight: 700; }
.hero-leaf { color: var(--accent); display: inline-flex; }
.hero-leaf svg { width: 26px; height: 26px; }

/* Preferences card */
.prefs-card { padding: 15px 16px 16px; margin: 0 0 14px; }
.prefs-head { display: flex; align-items: center; gap: 12px; }
.prefs-avatar {
  width: 48px; height: 48px; flex-shrink: 0; border-radius: 50%;
  display: grid; place-items: center; padding: 0;
  background: var(--accent-soft); color: var(--accent-deep); border: 1px solid var(--accent-line);
}
.prefs-avatar svg { width: 26px; height: 26px; }
.prefs-avatar.signed-in { background: var(--accent); color: #fff; border-color: var(--accent); }
.prefs-id { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.prefs-kicker { font-size: 0.72rem; font-weight: 600; color: var(--muted); }
.prefs-name { font-family: var(--serif); font-size: 1.18rem; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prefs-signin { align-self: flex-start; margin-top: 5px; font-size: 0.74rem; font-weight: 700; padding: 4px 12px; border-radius: 999px; background: var(--accent); color: #fff; border: 1px solid var(--accent); cursor: pointer; }
.prefs-signin:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.prefs-edit {
  width: 38px; height: 38px; flex-shrink: 0; border-radius: 50%; padding: 0;
  display: grid; place-items: center;
  background: transparent; border: 1px solid var(--line-strong); color: var(--ink-soft);
}
.prefs-edit:hover { background: var(--accent-soft); color: var(--accent-deep); border-color: var(--accent-line); }
.prefs-edit svg { width: 18px; height: 18px; }
.prefs-filters-label { font-size: 0.78rem; font-weight: 600; color: var(--ink-soft); margin: 14px 0 9px; }
.prefs-filters { display: flex; flex-wrap: wrap; gap: 8px; }

/* Active-filter pills, colored by kind */
.filter-pill {
  font-size: 0.78rem; font-weight: 600; padding: 6px 12px; border-radius: 999px;
  border: 1px solid; display: inline-flex; align-items: center; line-height: 1.1;
}
.filter-pill.severe { background: #fdeceb; color: #c0392b; border-color: #f2c7c1; }
.filter-pill.allergen { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-line); }
.filter-pill.lifestyle { background: var(--sage-soft); color: var(--sage); border-color: var(--sage-line); }
.filter-pill.diet { background: var(--slate-soft); color: var(--slate); border-color: var(--slate-line); }
.filter-pill.religious { background: var(--plum-soft); color: var(--plum); border-color: var(--plum-line); }
.filter-pill.add { background: transparent; color: var(--accent-deep); border: 1px dashed var(--accent-line); cursor: pointer; }
.filter-pill.add:hover { background: var(--accent-soft); }

/* Filtered list — vertical rows (override the carousel layout) */
.cards.list {
  display: flex; flex-direction: column; gap: 12px;
  overflow: visible; padding: 2px; margin: 0;
  scroll-snap-type: none;
}
.cards.list .placeholder { min-width: 0; }
.r-row {
  display: flex; gap: 12px; align-items: stretch;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; padding: 10px; box-shadow: var(--shadow-sm);
  cursor: pointer; transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}
.r-row:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--line-strong); }
.r-row:focus-visible { outline: none; box-shadow: var(--ring), var(--shadow); }
.cards.list .r-row.anim-in { animation: card-rise 0.42s cubic-bezier(0.2, 0.9, 0.25, 1) both; }

/* In-feed Google ad slot — framed like a restaurant card (same surface, border,
   radius and shadow) so it blends into the feed, but kept honest with a small
   "Sponsored" label as AdSense policy requires ads stay distinguishable from
   content. min-height reserves space so the feed doesn't jump as the ad fills. */
.ad-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 9px 12px 12px;
  box-shadow: var(--shadow-sm);
  min-height: 96px;
  overflow: hidden;
}
.ad-card .ad-label {
  display: block;
  font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--muted); margin-bottom: 6px;
}
.ad-card .adsbygoogle { display: block; width: 100%; min-height: 60px; }
.r-row .r-thumb {
  width: 78px; height: 78px; flex-shrink: 0; aspect-ratio: auto;
  border-radius: 13px; overflow: hidden;
}
.r-row .r-thumb .r-emoji { font-size: 1.9rem; }
.r-row .r-thumb .r-mono { font-size: 1.7rem; }
.r-row .r-thumb .fav-btn { position: absolute; top: 5px; right: 5px; width: 26px; height: 26px; }
.r-row .r-thumb .fav-btn svg { width: 14px; height: 14px; }
.r-row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; justify-content: center; padding: 2px 4px 2px 0; }
.r-row-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.r-row-top h3 { margin: 0; font-family: var(--serif); font-size: 1.02rem; font-weight: 600; line-height: 1.2; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-match { flex-shrink: 0; text-align: right; font-size: 0.68rem; font-weight: 600; color: var(--muted); line-height: 1.15; text-transform: uppercase; letter-spacing: 0.03em; }
.r-match strong { display: block; font-family: var(--serif); font-size: 1.02rem; font-weight: 700; color: var(--accent-deep); letter-spacing: 0; text-transform: none; }
.r-row-sub { display: flex; align-items: center; gap: 8px; min-width: 0; }
.r-stars { flex-shrink: 0; font-size: 0.8rem; font-weight: 600; color: var(--gold); }
.r-row .r-meta { font-size: 0.78rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-row .badges { margin-top: 2px; }

/* Explore tab — find CTA + round refresh side by side */
.explore-actions { display: flex; gap: 10px; align-items: center; margin: 4px 0 14px; }
.explore-actions .find-cta { flex: 1; margin: 0; }
.explore-actions .round-icon { flex-shrink: 0; }

/* Cross-contamination caution on the detail view */
.xcontam {
  display: flex; gap: 10px; align-items: flex-start;
  margin: 14px 0 2px; padding: 12px 14px; border-radius: 14px;
  background: #fdf1e6; border: 1px solid #f1d8bd; color: #8a4b1f;
  font-size: 0.85rem; line-height: 1.46;
}
.xcontam strong { color: #7a3d12; }
.xcontam-ic { font-size: 1.15rem; line-height: 1.2; flex-shrink: 0; }

/* Row skeleton during loading */
.r-row.skeleton { cursor: default; }
.r-row.skeleton .sk-thumb { width: 78px; height: 78px; flex-shrink: 0; aspect-ratio: auto; border-radius: 13px; }
.r-row.skeleton .r-row-body { gap: 8px; }

/* Bottom nav — keep the four labels on one line each */
.tab-btn { font-size: 0.6rem; }
.tab-btn span { white-space: nowrap; }

/* ===========================================================================
   32) EXPLORE (browse) + PROFILE + SAFELIST cards
   =========================================================================== */
/* Explore header with a filter/location action on the right */
.explore-hero { position: relative; display: flex; align-items: center; justify-content: center; padding: 16px 0 12px; }
.hero-action {
  position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border-radius: 50%; padding: 0; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink-soft);
}
.hero-action:hover { background: var(--accent-soft); color: var(--accent-deep); border-color: var(--accent-line); }
.hero-action svg { width: 18px; height: 18px; }
.explore-controls { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px 14px; margin: 0 0 14px; box-shadow: var(--shadow-sm); }
.explore-title { margin: 8px 2px 12px; }
.explore-city { color: var(--accent-deep); }

/* Profile screen */
.profile-hero { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 0 12px; }
.profile-avatar {
  width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-deep); border: 1px solid var(--accent-line);
  font-family: var(--serif); font-size: 2rem; font-weight: 600;
}
.profile-avatar svg { width: 42px; height: 42px; }
.profile-avatar.signed-in { background: var(--accent); color: #fff; border-color: var(--accent); }
.profile-name { margin: 6px 0 0; font-size: 1.5rem; }
.profile-sub { font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.settings-list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-sm); margin: 2px 0 18px; }
.settings-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 14px 15px; background: transparent; border: none; border-bottom: 1px solid var(--line);
  text-align: left; color: var(--ink); font-size: 0.92rem; font-weight: 500; font-family: inherit; cursor: pointer;
}
.settings-item:last-child { border-bottom: none; }
.settings-item:hover { background: var(--paper); }
.settings-item.static, .settings-item.static:hover { cursor: default; background: transparent; }
.si-ic { width: 30px; height: 30px; flex-shrink: 0; display: grid; place-items: center; color: var(--accent-deep); }
.si-ic svg { width: 20px; height: 20px; }
.si-label { flex: 1; }
.si-chev { color: var(--muted); font-size: 1.25rem; line-height: 1; }
.settings-item.danger { justify-content: center; color: #c0392b; font-weight: 600; }
.settings-item.danger:hover { background: #fdeceb; }
.diet-summary-head .ro { font-weight: 500; font-size: 0.78rem; color: var(--muted); }
.diet-summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 2px 16px; }

/* SafeList saved-restaurant cards reuse the .r-row layout via .act-item */
.activity-list { display: flex; flex-direction: column; gap: 12px; }
.act-item.r-row { width: 100%; font: inherit; text-align: left; }
.act-heart { flex-shrink: 0; align-self: center; color: var(--accent); display: grid; place-items: center; padding: 0 2px; }
.act-heart svg { width: 22px; height: 22px; fill: currentColor; stroke: currentColor; }
.act-review { display: block; margin-top: 4px; font-size: 0.76rem; color: var(--muted); }

/* ===========================================================================
   33) POLISH PASS — header dividers, search pill, fuller cards, SafeList switch
   =========================================================================== */
/* Page headers: breathing room + a thin divider rule below (not on the avatar
   profile header, which reads better clean). */
.app-hero { padding: 16px 2px 12px; margin: 0 0 16px; border-bottom: 1px solid var(--line); }
.profile-hero { border-bottom: none; margin-bottom: 6px; }

/* Frozen header — the page title bar (HealthyBite / Explore / My SafeList) stays
   pinned to the top of the screen and rides along as you scroll. Background
   matches the page so cards slide underneath it. */
.app-hero {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
}
.profile-hero { position: static; } /* tall avatar header reads better unpinned */

/* Search bar — clean, symmetric pill (no lopsided padding now the buttons moved out) */
.searchbar { gap: 8px; border-radius: 16px; padding: 2px 16px; }
.searchbar input[type="text"] { padding: 12px 0; }

/* Block layout (not flex-column) so each row is a block-level flex container
   pinned to the container width — a wide name then ellipsizes inside it instead
   of stretching the row past the viewport. */
.cards.list, .activity-list { display: block; overflow: visible; }
.cards.list > .r-row, .activity-list > .act-item { margin-bottom: 12px; }
.cards.list > .r-row:last-child, .activity-list > .act-item:last-child { margin-bottom: 0; }

/* Fuller restaurant cards — taller, larger thumbnail, content vertically centered */
.r-row { padding: 12px; gap: 14px; min-height: 104px; align-items: center; overflow: hidden; }
.r-row .diet-tags { flex-wrap: wrap; }
.r-row .r-thumb { width: 90px; height: 90px; border-radius: 16px; }
.r-row .r-thumb .r-emoji { font-size: 2.2rem; }
.r-row .r-thumb .r-mono { font-size: 2rem; }
.r-row-body { gap: 6px; padding: 0; overflow: hidden; min-width: 0; }
/* min-width:0 down the whole flex chain so a long name ellipsizes instead of
   blowing the row out past the viewport. */
.r-row-top { align-items: baseline; min-width: 0; }
.r-row-top h3 { font-size: 1.06rem; flex: 1 1 auto; min-width: 0; }
.r-row-sub { min-width: 0; }
.r-row.skeleton .sk-thumb { width: 90px; height: 90px; }

/* Explore location (airplane) button — hold position on tap/focus */
.hero-action:active, .hero-action:focus { transform: translateY(-50%); outline: none; }

/* SafeList Saved/Reviews segmented switch */
.seg { display: flex; gap: 4px; background: var(--paper-deep); border: 1px solid var(--line); border-radius: 999px; padding: 4px; margin: 0 0 16px; }
.seg-btn { flex: 1; border: none; background: transparent; border-radius: 999px; padding: 9px 10px; font-size: 0.85rem; font-weight: 600; color: var(--ink-soft); cursor: pointer; transition: background 0.15s ease, color 0.15s ease; }
.seg-btn.active { background: var(--surface); color: var(--accent-deep); box-shadow: var(--shadow-sm); }

/* ===========================================================================
   34) CLEAN CARD v2 — stars + side favorite, tidy thumbnail; search-input fix;
   profile-picture upload; Explore "Popular …" title row with the airplane.
   =========================================================================== */
/* Search input must be fully transparent inside the pill (the light-theme
   input background was bleeding through as an inner box). */
.searchbar input[type="text"],
.searchbar input[type="text"]:focus,
html.light .searchbar input[type="text"],
html.light .searchbar input[type="text"]:focus { background: transparent; border: none; box-shadow: none; }

/* Restaurant card — flat thumbnail, name, stars, meta, tags, side heart */
.r-row { display: flex; align-items: center; gap: 13px; padding: 12px; min-height: 92px; }
.r-row .r-thumb { width: 76px; height: 76px; flex-shrink: 0; aspect-ratio: auto; border-radius: 14px; overflow: hidden; }
.r-row .r-thumb::after { display: none; }          /* drop the glossy overlay — cleaner */
.r-row .r-emoji { font-size: 2rem; filter: none; }
.r-row .r-mono { font-size: 1.7rem; }
.r-row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.r-row-body h3 { margin: 0; font-family: var(--serif); font-size: 1.05rem; font-weight: 600; line-height: 1.2; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-rating-row { min-height: 15px; }
.r-rating { display: inline-flex; align-items: center; gap: 5px; }
.stars { letter-spacing: 1.5px; font-size: 0.8rem; line-height: 1; }
.stars .star { color: var(--line-strong); }
.stars .star.on { color: var(--gold); }
.rating-val { font-size: 0.78rem; font-weight: 600; color: var(--ink-soft); }
.r-norate { font-size: 0.75rem; color: var(--muted); }
.r-row .r-meta { font-size: 0.78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-tagrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 3px; }
.r-tagrow .badge { font-size: 0.7rem; padding: 3px 9px; }
.r-tagrow .badge-src { display: none; }            /* hide the tiny source mark for a cleaner chip */
.r-matchpill { font-size: 0.7rem; font-weight: 700; color: var(--accent-deep); background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 999px; padding: 3px 9px; }

/* Explore quick-filter chip row */
.filter-chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px; margin: 0 -2px; scrollbar-width: none; }
.filter-chip-row::-webkit-scrollbar { display: none; }
.filter-chip {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px; font-size: 0.82rem; font-weight: 600;
  background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink-soft);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.filter-chip svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.filter-chip:hover { border-color: var(--accent-line); color: var(--accent-deep); }
.filter-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.r-found { font-size: 0.7rem; font-weight: 700; color: var(--plum); background: var(--plum-soft); border: 1px solid var(--plum-line); border-radius: 999px; padding: 3px 9px; }
/* Favorite button now sits at the right of the card, vertically centered */
.r-row > .fav-btn { position: static; flex-shrink: 0; align-self: center; width: 40px; height: 40px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line-strong); color: var(--muted); }
.r-row > .fav-btn svg { width: 19px; height: 19px; }
.r-row > .fav-btn.active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }

/* SafeList saved-card heart stays a filled green indicator on the right */
.act-item.r-row .act-heart svg { width: 22px; height: 22px; }

/* Profile picture */
.profile-avatar { position: relative; overflow: visible; padding: 0; cursor: pointer; }
.avatar-img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.avatar-edit { position: absolute; right: -2px; bottom: -2px; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; border: 2px solid var(--paper); display: grid; place-items: center; }
.avatar-edit svg { width: 15px; height: 15px; }

/* Explore "Popular restaurants in <city>" with the airplane on the right */
.explore-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 2px 12px; }
.explore-title-row .section-title { margin: 0; }
.explore-title-row .hero-action { position: static; transform: none; flex-shrink: 0; }
.explore-title-row .hero-action:active, .explore-title-row .hero-action:focus { transform: none; }

/* ===========================================================================
   35) Detail-hero map (tap → native maps) + "Best rated today" featured card
   =========================================================================== */
/* Info-tab map card — an in-flow block (NOT an overlay), so it never covers the
   tabs/close button. Tapping it opens the native maps app. */
.detail-map-wrap { position: relative; margin-top: 14px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
.detail-map { height: 170px; cursor: pointer; }
.detail-hero .fav-btn, .detail-hero .report-btn, .modal.detail .modal-close { z-index: 10; }
.detail-map-hint {
  position: absolute; right: 12px; bottom: 12px; z-index: 5; pointer-events: none;
  font-size: 0.72rem; font-weight: 600; color: #fff;
  background: rgba(16, 20, 24, 0.62); border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px; padding: 4px 10px; backdrop-filter: blur(4px);
}
/* Leaflet attribution/zoom not used here, but keep the marker crisp */
.detail-map .leaflet-container { background: var(--paper-deep); }

.explore-featured { margin: 0 0 16px; }
.featured-label { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; font-weight: 700; color: var(--accent-deep); margin: 0 2px 9px; }
.explore-featured .r-row.featured {
  border: 1.5px solid var(--accent-line);
  box-shadow: var(--shadow);
  background: linear-gradient(180deg, var(--accent-soft), var(--surface) 62%);
}

/* ===================== Cook mode ===================== */
/* Persistent top bar — brand wordmark on the left, mode switcher on the right.
   Page-colored with a hairline divider so it reads as a real app header that
   matches the rest of the UI. (Not sticky — the per-tab heros own the frozen-top
   behavior, so a sticky topbar would double up with them.) */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 20px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.topbar-name {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 1.22rem;
  letter-spacing: -0.02em;
  color: var(--accent-deep);
}

/* Mode toggle — compact segmented pill. */
.mode-toggle {
  display: flex;
  gap: 3px;
  padding: 3px;
  flex-shrink: 0;
  background: var(--paper-deep);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
}
.mode-btn {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-weight: 600;
  font-size: 0.82rem;
  padding: 6px 15px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.mode-btn.active { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.mode-btn:not(.active):hover { color: var(--accent-deep); }

/* Cook home — single "What's in your kitchen?" card */
.cook-panel { text-align: center; padding: 26px 20px 22px; margin-top: 8px; }
.cook-panel-ic {
  display: inline-grid; place-items: center; width: 60px; height: 60px; margin-bottom: 12px;
  border-radius: 50%; color: var(--accent);
  background: var(--accent-soft); border: 1.5px solid var(--accent-line);
}
.cook-panel-ic svg { width: 30px; height: 30px; }
.cook-panel-title {
  margin: 0 0 5px; font-family: var(--serif, "Fraunces", serif); font-weight: 600;
  font-size: 1.45rem; color: var(--ink); letter-spacing: -0.01em;
}
.cook-count { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 0 0 18px; font-size: 0.84rem; color: var(--muted); }
.cook-clear { border: none; background: none; color: #b8492f; font: inherit; font-size: 0.82rem; font-weight: 600; cursor: pointer; }
.cook-clear:hover { text-decoration: underline; }

/* Ingredient input + add button */
.cook-input-row { display: flex; gap: 8px; margin-bottom: 14px; }
.cook-input-row input {
  flex: 1; min-width: 0; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit;
}
.cook-input-row input:focus { outline: none; border-color: var(--accent-line); box-shadow: var(--ring); }
.cook-add-btn {
  flex-shrink: 0; width: 46px; border-radius: 12px; border: none; cursor: pointer;
  background: var(--accent); color: #fff; font-size: 22px; line-height: 1; display: grid; place-items: center;
  transition: background 0.15s;
}
.cook-add-btn:hover { background: var(--accent-deep); }

/* Ingredient chips */
.cook-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0 0 16px; }
.cook-chips:empty { display: none; margin: 0; }
.cook-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--paper); color: var(--ink); border: 1px solid var(--line-strong);
  border-radius: 999px; padding: 6px 8px 6px 12px; font-size: 0.84rem; font-weight: 500;
}
.cook-chip-x {
  border: none; background: transparent; color: var(--muted);
  font-size: 16px; line-height: 1; cursor: pointer; padding: 0 2px;
}
.cook-chip-x:hover { color: var(--ink); }

/* Camera / Upload / Find Recipes */
.cook-actions-row { display: flex; gap: 7px; margin-bottom: 12px; }
.cook-act-btn {
  flex: 1; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 11px 6px; border-radius: 12px; cursor: pointer; font: inherit; font-weight: 600; font-size: 0.82rem;
  background: var(--surface); color: var(--ink-soft); border: 1px solid var(--line-strong);
  transition: background 0.15s, border-color 0.15s, color 0.15s; white-space: nowrap;
}
.cook-act-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.cook-act-btn:hover { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-deep); }
.cook-act-btn.primary { flex: 1.3; background: var(--accent); color: #fff; border-color: var(--accent); }
.cook-act-btn.primary:hover { background: var(--accent-deep); }

.cook-style-input {
  width: 100%; padding: 11px 14px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit;
}
.cook-style-input:focus { outline: none; border-color: var(--accent-line); box-shadow: var(--ring); }

.cook-inline-busy { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 14px; color: var(--ink-soft); font-size: 0.88rem; }
.cook-panel .scan-error { margin-top: 12px; }

/* Tap-to-add popular ingredients */
.cook-suggest { margin: 0 0 16px; }
.cook-suggest-label {
  display: block; margin-bottom: 8px; font-size: 0.74rem; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted);
}
.cook-suggest-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; }
.cook-suggest-chip {
  display: inline-flex; align-items: center; cursor: pointer; font: inherit;
  font-size: 0.82rem; font-weight: 500; padding: 6px 12px; border-radius: 999px;
  background: var(--surface); color: var(--ink-soft); border: 1px dashed var(--line-strong);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.cook-suggest-chip:hover { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-deep); }
.cook-suggest-chip.on {
  background: var(--accent); color: #fff; border-style: solid; border-color: var(--accent);
}

/* Cook empty state — "how it works" until the first results land */
.cook-empty { margin: 20px 2px 8px; }
.cook-empty.hidden { display: none; }
.cook-empty-title {
  margin: 0 0 14px; font-family: var(--serif, "Fraunces", serif); font-weight: 600;
  font-size: 1.1rem; color: var(--ink); text-align: center;
}
.cook-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.cook-steps li { display: flex; align-items: flex-start; gap: 12px; }
.cook-step-n {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-deep); border: 1px solid var(--accent-line);
  font-size: 0.82rem; font-weight: 700;
}
.cook-steps li strong { display: block; font-size: 0.92rem; color: var(--ink); margin-bottom: 1px; }
.cook-steps li p { margin: 0; font-size: 0.84rem; color: var(--muted); line-height: 1.4; }
.cook-empty-diet {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin: 16px 0 0; padding: 12px 14px; border-radius: 12px;
  background: var(--accent-soft); border: 1px solid var(--accent-line);
}
.cook-empty-diet.hidden { display: none; }
.cook-empty-diet-label { font-size: 0.84rem; font-weight: 600; color: var(--accent-deep); }
.cook-empty-tip {
  margin: 16px 0 0; padding: 0; font-size: 0.82rem; color: var(--muted);
  text-align: center; line-height: 1.45;
}

/* Results */
.cook-results { margin-top: 16px; }
.cook-results-head { margin: 4px 2px 12px; font-size: 1.05rem; }
.cook-finding {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin: 18px 0; padding: 16px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-soft); font-size: 0.9rem;
}

/* Recipe detail modal */
/* Recipe detail modal (Cook mode) — full-bleed hero with a padded body. */
.modal.recipe-modal { padding: 0; max-width: 500px; overflow: hidden; display: flex; flex-direction: column; }
/* Hero stays pinned; the body scrolls on its own so long recipes are reachable
   on phones (mirrors the restaurant detail modal's .detail-main). */
#recipeBody { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.modal.recipe-modal .modal-close {
  top: 16px; right: 16px;
  width: 36px; height: 36px;
  background: var(--surface);
  color: var(--ink-soft);
  border: 1px solid var(--line-strong);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  z-index: 6;
}
.modal.recipe-modal .modal-close:hover { background: var(--line); color: var(--ink); }

.recipe-hero { width: 100%; aspect-ratio: 16 / 10; overflow: hidden; background: var(--accent-soft); flex-shrink: 0; }
.recipe-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }

.recipe-detail { padding: 26px; flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.recipe-title {
  margin: 0;
  font-family: var(--serif, "Fraunces", serif);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.02em;
  /* Keep the title clear of the absolute close button when there's no hero. */
  padding-right: 44px;
}
.recipe-hero ~ .recipe-detail .recipe-title { padding-right: 0; }

.recipe-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 0; }
.recipe-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-deep);
  font-size: 0.8rem; font-weight: 600; white-space: nowrap;
}
.recipe-tags { margin: 12px 0 0; }

.recipe-disclaimer {
  margin: 16px 0 0;
  padding: 10px 12px;
  font-size: 0.78rem; line-height: 1.45;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.recipe-sub {
  margin: 24px 0 12px;
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted);
}

.recipe-ingredients {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 9px 18px;
}
.recipe-ingredients li {
  position: relative; padding-left: 17px;
  font-size: 0.9rem; line-height: 1.4; color: var(--ink);
}
.recipe-ingredients li::before {
  content: ""; position: absolute; left: 2px; top: 8px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}

.recipe-steps { list-style: none; counter-reset: step; margin: 0; padding: 0; }
.recipe-steps li {
  position: relative; counter-increment: step;
  padding: 0 0 16px 40px;
  font-size: 0.93rem; line-height: 1.5; color: var(--ink);
}
.recipe-steps li:last-child { padding-bottom: 0; }
.recipe-steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: -2px;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-deep);
  font-size: 0.8rem; font-weight: 700;
}
/* Connector line tying the numbered steps together. */
.recipe-steps li:not(:last-child)::after {
  content: ""; position: absolute; left: 12.5px; top: 28px; bottom: 6px;
  width: 1.5px; background: var(--line);
}

.recipe-actions { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.recipe-save-btn {
  width: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-size: 0.92rem; font-weight: 600;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
.recipe-save-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.recipe-save-btn:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.recipe-save-btn.active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-deep); }
.recipe-save-btn.active svg { fill: var(--accent); stroke: var(--accent); }

@media (max-width: 420px) {
  .recipe-detail { padding: 22px 18px; }
  .recipe-ingredients { grid-template-columns: 1fr; gap: 7px; }
}

/* Static intro + site links at the foot of the Home feed. Real, crawlable
   content for search engines / AdSense, and the in-app entry point to the
   guides and legal pages. Kept quiet so it doesn't compete with the feed. */
.home-footer {
  margin: 28px 0 6px;
  padding: 22px 2px 4px;
  border-top: 1px solid var(--line);
}
.home-footer h2 {
  margin: 0 0 8px;
  font-family: var(--serif, "Fraunces", serif);
  font-size: 1.12rem; font-weight: 600; letter-spacing: -0.01em;
  color: var(--ink);
}
.home-footer h3 {
  margin: 20px 0 8px;
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--muted);
}
.home-footer p { margin: 0 0 8px; font-size: 0.85rem; line-height: 1.55; color: var(--soft, var(--ink-soft)); }
.home-footer-note { color: var(--muted); font-size: 0.78rem; }
.home-footer-links { list-style: none; margin: 0; padding: 0; }
.home-footer-links li { margin: 6px 0; }
.home-footer-links a { color: var(--accent-deep); text-decoration: none; font-size: 0.86rem; font-weight: 500; }
.home-footer-links a:hover { text-decoration: underline; }
.home-footer-nav {
  display: flex; flex-wrap: wrap; gap: 8px 18px;
  margin: 22px 0 10px; padding-top: 16px;
  border-top: 1px solid var(--line);
}
.home-footer-nav a { color: var(--muted); text-decoration: none; font-size: 0.82rem; font-weight: 600; }
.home-footer-nav a:hover { color: var(--accent-deep); }
.home-footer-copy { color: var(--muted); font-size: 0.78rem; margin: 0; }
