:root {
  /* Paper + ink, not "app cream." Cooler and less saturated than a food-app
     palette on purpose — this is closer to newsprint than to a phone UI. */
  --bg: #f2efe6;
  --card: #fffefb;
  --card-2: #e9e3d3;
  --ink: #17130f;
  --muted: #564d40; /* 7.2:1 on --bg */
  --muted-dim: #4a4238;
  /* Oxblood, not brick — a deep, restrained red instead of a bright
     startup accent. Used sparingly: primary actions and identity marks
     only, never decoration. */
  --accent: #6e1f26;
  --accent-dark: #591821;
  --accent-soft: rgba(110, 31, 38, 0.08);
  --good: #1f6b45;
  --good-soft: rgba(31, 107, 69, 0.10);
  /* Danger is a brighter, more saturated red than --accent on purpose —
     both read as "red" but shouldn't be mistaken for each other; an error
     state must never look like a branded button. */
  --danger: #ab3a3f;
  --danger-soft: rgba(171, 58, 63, 0.10);
  --border: #d6cdb8;
  --pine: #1f4a37;
  --pine-dark: #163527;
  --pine-soft: rgba(31, 74, 55, 0.10);
  --pine-cream: #eef0e6;
  /* Restrained, moderate rounding — a considered radius, not a stamped-out
     rounded-app default and not a stark 90° corner either. --radius-lg is
     for a couple of larger surfaces (the bottom sheet's top edge) where
     the same radius would look proportionally too small. */
  --radius: 10px;
  --radius-lg: 16px;
  --font-serif: Georgia, "Times New Roman", serif;
  /* Score colors: 8+ high, 5–7.9 mid, <5 low. Low reuses --danger's exact
     value — a bad rating and an error are the same semantic weight. */
  --score-high: #1f6b45;
  --score-mid: #8a5a12;
  --score-low: #ab3a3f;
  /* Soft, barely-there elevation — two thin layers of blur, no visible
     offset edge. --shadow-card is the quiet, pervasive one (used on dozens
     of cards per page); --shadow-elevated is for the handful of elements
     that should read as sitting slightly above the page (primary buttons,
     the FAB, the capture trigger). */
  --shadow-card: 0 1px 2px rgba(23, 19, 15, 0.04), 0 2px 8px rgba(23, 19, 15, 0.06);
  --shadow-elevated: 0 2px 6px rgba(23, 19, 15, 0.08), 0 10px 24px -8px rgba(23, 19, 15, 0.16);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  padding-bottom: 84px;
  position: relative;
}

header.topbar {
  padding: 24px 18px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header.topbar h1 {
  font-family: var(--font-serif);
  font-size: 21px;
  margin: 0;
  letter-spacing: -0.01em;
  font-weight: 700;
}

header.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

header.topbar .brand .mark {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  box-shadow: var(--shadow-elevated);
}

header.topbar .brand .wordmark { display: flex; flex-direction: column; line-height: 1.15; }

header.topbar .brand .tagline {
  font-size: 11px;
  color: var(--muted-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* legacy dot marker kept as a tiny accent, still used by a couple pages —
   the one circle left in the system on purpose: a true status dot, not a
   card or a button, reads as a dot precisely because it's round. */
header.topbar .brand .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

main {
  flex: 1;
  padding: 0 16px 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-card);
}

.restaurant-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.restaurant-card:active {
  border-color: var(--accent);
}

.restaurant-card .name {
  font-weight: 700;
  font-size: 16px;
}

.restaurant-card .meta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.rating-pill {
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--radius);
  padding: 6px 12px;
  font-weight: 800;
  font-size: 14px;
  min-width: 44px;
  text-align: center;
}

.rating-pill.empty {
  background: var(--card-2);
  color: var(--muted);
}

/* Color-coded scores — the number's meaning carries into its color, so a
   list of ratings reads at a glance instead of as identical black pills.
   The .nearby-card selector is needed to outweigh the base
   .nearby-card .nearby-rating background declared later in this file. */
.rating-pill.score-high, .nearby-rating.score-high, .nearby-card .nearby-rating.score-high { background: var(--score-high); color: #f4faf1; }
.rating-pill.score-mid, .nearby-rating.score-mid, .nearby-card .nearby-rating.score-mid { background: var(--score-mid); color: #fdf7ea; }
.rating-pill.score-low, .nearby-rating.score-low, .nearby-card .nearby-rating.score-low { background: var(--score-low); color: #fdf1ec; }

form { display: flex; flex-direction: column; gap: 12px; }

label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
  display: block;
}

input, textarea, select {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 15px;
  background: var(--card-2);
  color: var(--ink);
  font-family: inherit;
}

input::placeholder, textarea::placeholder { color: var(--muted-dim); }

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}

textarea { resize: vertical; min-height: 80px; }

button.primary {
  background: var(--accent);
  color: white;
  border: none;
  padding: 13px 16px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--shadow-elevated);
  transition: transform 100ms ease-out, box-shadow 100ms ease-out;
}

button.primary:active {
  background: var(--accent-dark);
  transform: scale(0.98);
  box-shadow: var(--shadow-card);
}

button.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

button.secondary {
  background: var(--card-2);
  color: var(--ink);
  border: 1px solid var(--border);
  padding: 13px 16px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.error-msg {
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 14px;
}

.success-msg {
  background: var(--good-soft);
  color: var(--good);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 14px;
}

.link-row {
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  margin-top: 8px;
}

.link-row a { color: var(--accent); text-decoration: none; font-weight: 600; }

nav.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000; /* above Leaflet's panes/controls (~1000) on the map page */
  width: 100%;
  max-width: 430px;
  background: rgba(242, 239, 230, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 10px 0 22px;
}

nav.tabbar a {
  color: var(--muted);
  text-decoration: none;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-weight: 700;
}

nav.tabbar a.active { color: var(--accent); }

nav.tabbar .icon {
  padding: 3px 14px;
  border-radius: var(--radius);
  line-height: 0;
}

nav.tabbar .icon svg {
  width: 21px;
  height: 21px;
  display: block;
}

nav.tabbar a.active .icon { background: var(--accent-soft); }

.review-item {
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}

.review-item:last-child { border-bottom: none; }

.review-item .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.review-item .who { font-weight: 600; font-size: 14px; }
.review-item .when { color: var(--muted); font-size: 12px; }
.review-item .desc { font-size: 14px; color: var(--ink); }

.progress-track {
  background: var(--card-2);
  border-radius: var(--radius);
  height: 8px;
  overflow: hidden;
  margin: 8px 0;
}

.progress-fill {
  background: var(--accent);
  height: 100%;
  transition: width 0.3s ease;
}

.reward-card {
  border: 1px dashed var(--pine);
  background: var(--pine-soft);
}

.reward-card .amount {
  font-size: 24px;
  font-weight: 800;
  color: var(--pine-dark);
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 700;
}

/* Pending reads as "in progress" amber, not success green. */
.badge.pending { background: rgba(138, 90, 18, 0.16); color: #6e480f; }
.badge.redeemed { background: var(--good-soft); color: var(--good); }

.gift-code {
  font-family: "SF Mono", Menlo, monospace;
  /* Pine, not ink — a solid black bar read as a rendering error against
     the palette; money things live in the pine family. */
  background: var(--pine-dark);
  color: var(--pine-cream);
  padding: 10px 14px;
  border-radius: var(--radius);
  text-align: center;
  letter-spacing: 0.05em;
  font-size: 16px;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 40px 16px;
  font-size: 14px;
}

.star-rating {
  display: flex;
  align-items: center;
  gap: 10px;
}

.star-rating input[type="range"] { flex: 1; accent-color: var(--accent); }

.star-rating .value {
  font-weight: 800;
  font-size: 22px;
  min-width: 46px;
  text-align: center;
  color: var(--accent);
}

.loading {
  text-align: center;
  padding: 24px;
  color: var(--muted);
}

.capture-prompt {
  text-align: center;
  padding: 60px 20px;
}

#prompt-state, #form-state, #success-state {
  transition: opacity 150ms ease-out, transform 150ms ease-out;
}

.capture-state-exit { opacity: 0; transform: scale(0.98); }
.capture-state-enter { opacity: 0; transform: scale(0.98); }

.capture-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  cursor: pointer;
  box-shadow: var(--shadow-elevated);
  transition: transform 100ms ease-out;
}

.capture-circle:active { transform: scale(0.96); }

.capture-prompt h2 { margin: 4px 0; }

.capture-sub { color: var(--muted); font-size: 14px; }

.restaurant-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  margin-bottom: 6px;
}

.restaurant-option.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.restaurant-option-icon { font-size: 18px; flex-shrink: 0; }

.restaurant-option-name { display: block; }

.restaurant-option-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  text-transform: capitalize;
}

.restaurant-option.selected .restaurant-option-meta { color: var(--accent); opacity: 0.8; }

.fab {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2001; /* above nav.tabbar (2000) */
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
  text-decoration: none;
  box-shadow: var(--shadow-elevated);
  border: 4px solid var(--bg);
  transition: transform 100ms ease-out;
}

.fab:active { transform: translateX(-50%) scale(0.94); }

.post-card {
  padding: 0;
  overflow: hidden;
}

.post-card .post-photo {
  width: 100%;
  display: block;
  max-height: 420px;
  object-fit: cover;
  background: var(--card-2);
}

/* Seeded/dev posts (and any deleted upload) can 404 their photo; a broken
   image icon reads as a bug, so the wrap collapses instead. */
.post-card .post-photo-wrap.no-photo { display: none; }

.post-card .post-body {
  padding: 13px 16px 14px;
}

.post-card .post-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 2px;
}

/* Hierarchy: the specific dish is the headline when one was named — it's
   what was actually rated and what the nutrition below describes. The
   restaurant then demotes to the italic line beneath it (see
   .post-dish + .post-where). With no dish named, the restaurant keeps the
   headline role itself. */
.post-card .post-dish {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.post-card .post-dish + .post-where {
  font-size: 13px;
  font-weight: 400;
  font-style: italic;
  color: var(--accent-dark);
  margin-top: 1px;
}

.post-card .post-where {
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.post-card .post-where a { color: inherit; text-decoration: none; }
.post-card .post-where a:active { color: var(--accent); }

.post-card .post-byline {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}

.post-card .post-byline .post-avatar {
  width: 18px;
  height: 18px;
  font-size: 10px;
}

.post-card .post-caption {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 15px;
  line-height: 1.45;
  margin: 8px 0 2px;
  color: var(--ink);
}

.post-card .post-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

.cheer-btn {
  border: 1px solid var(--border);
  background: var(--card-2);
  border-radius: var(--radius);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
}

.cheer-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* Deliberately quiet: Report must exist on every post but shouldn't carry
   the same visual weight as Cheers — it's a safety valve, not an action
   we're promoting. */
.report-btn {
  border: none;
  background: none;
  padding: 6px 2px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
  font-family: inherit;
}

.report-btn:active { color: var(--danger); }

.delete-post-btn {
  border: 1px solid var(--border);
  background: var(--card-2);
  border-radius: var(--radius);
  width: 26px;
  height: 26px;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  padding: 0;
}

.delete-post-btn:active { color: var(--danger); border-color: var(--danger); }

.ftc-banner {
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  background: var(--card-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  overflow: hidden;
  max-height: 200px;
  opacity: 1;
  transform: scale(1);
  transition: max-height 200ms ease-out, opacity 160ms ease-out, transform 200ms ease-out, padding 200ms ease-out, margin 200ms ease-out, border-width 200ms ease-out;
}

.ftc-banner.hidden {
  display: flex;
  max-height: 0;
  opacity: 0;
  transform: scale(0.98);
  padding-top: 0;
  padding-bottom: 0;
  margin-bottom: 0;
  border-width: 0;
  pointer-events: none;
}

.ftc-banner-text { flex: 1; }

.ftc-banner-dismiss {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: var(--radius);
  border: none;
  background: var(--border);
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.ftc-banner-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: fit-content;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  padding: 0 12px;
  margin-bottom: 0;
  pointer-events: none;
  cursor: pointer;
  transition: max-height 200ms ease-out, opacity 200ms ease-out 40ms, padding 200ms ease-out, margin 200ms ease-out;
}

.ftc-banner-chip.shown {
  max-height: 40px;
  opacity: 1;
  padding: 6px 12px;
  margin-bottom: 12px;
  pointer-events: auto;
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 3000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease-out;
}

.sheet-backdrop.open { opacity: 1; pointer-events: auto; }

.sheet-modal {
  position: fixed;
  bottom: 0;
  left: 50%;
  width: 100%;
  max-width: 430px;
  background: var(--card);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 20px;
  z-index: 3001;
  transform: translateX(-50%) translateY(100%);
  transition: transform 260ms cubic-bezier(0.32, 0.72, 0, 1);
  pointer-events: none;
  /* Tall sheets (the nutrition editor's macro grid) must scroll inside
     themselves rather than running off the top of the viewport. */
  max-height: 88vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sheet-modal.open { transform: translateX(-50%) translateY(0); pointer-events: auto; }

.nearby-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin: 28px 2px 12px;
}

.nearby-section-head .eyebrow {
  display: block;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 3px;
}

.nearby-section-head h2 {
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.15;
}

.nearby-section-head .sub {
  color: var(--muted);
  font-size: 12px;
  padding-bottom: 2px;
}

.nearby-scroll {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.nearby-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.15s ease;
}

.nearby-card:active {
  border-color: var(--accent);
}

/* Serif rank numerals for the "Most popular" list — an editorial touch
   that also breaks the identical-repeated-card rhythm. */
.nearby-card .nearby-rank {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  font-style: italic;
  color: var(--accent);
  min-width: 18px;
  text-align: center;
  flex-shrink: 0;
  margin-left: 2px;
}

.nearby-card .nearby-photo {
  width: 54px;
  height: 54px;
  border-radius: var(--radius);
  flex-shrink: 0;
  overflow: hidden;
  background: var(--card-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}

.nearby-card .nearby-photo img.photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.nearby-card .nearby-photo img.logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;
  background: white;
}

.nearby-card .nearby-photo .nearby-photo-fallback { line-height: 1; }

.nearby-card .nearby-info {
  flex: 1;
  min-width: 0;
}

.nearby-card .nearby-name {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nearby-card .nearby-meta {
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 3px;
}

.nearby-card .nearby-meta .cuisine { text-transform: capitalize; }
.nearby-card .nearby-meta .sep { margin: 0 4px; opacity: 0.55; }

.nearby-card .nearby-rating {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 800;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: var(--radius);
  flex-shrink: 0;
}

.nearby-card .nearby-rating span { font-weight: 600; opacity: 0.7; font-size: 10px; }

.nearby-card .nearby-rating.empty {
  background: var(--accent-soft);
  color: var(--accent);
}

.nearby-locate-card {
  text-align: center;
  padding: 24px 16px;
}

.nearby-locate-card button {
  margin-top: 10px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.photo-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  background: var(--card-2);
}

.photo-grid-item { position: relative; display: block; }

.photo-grid-item .delete-post-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: white;
  border: none;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.friend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.friend-row:last-child { border-bottom: none; }

.friend-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  margin-right: 10px;
  flex-shrink: 0;
}

.friend-info { display: flex; align-items: center; flex: 1; min-width: 0; }

.friend-name { font-weight: 600; font-size: 14px; }
.friend-meta { color: var(--muted); font-size: 12px; }

.friend-avatar img, .post-avatar img, .profile-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.post-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.post-who-row { display: flex; align-items: center; gap: 8px; }

.profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 22px;
  flex-shrink: 0;
}

.profile-head-row { display: flex; align-items: center; gap: 14px; }

.wiz-progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px 0;
}

.wiz-back {
  background: none;
  border: none;
  color: var(--ink);
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px 4px 0;
  line-height: 1;
  flex-shrink: 0;
}

.wiz-progress-row .progress-track { flex: 1; margin: 0; }

.wiz-step {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 56px);
  padding: 28px 20px 24px;
  transition: opacity 200ms ease-out, transform 200ms ease-out;
}

.wiz-step.hidden { display: none; }

.wiz-step-exit-forward { opacity: 0; transform: translateX(-16px); }
.wiz-step-exit-back { opacity: 0; transform: translateX(16px); }
.wiz-step-enter-forward { opacity: 0; transform: translateX(16px); }
.wiz-step-enter-back { opacity: 0; transform: translateX(-16px); }

.wiz-headline {
  font-family: var(--font-serif);
  font-size: 30px;
  line-height: 1.2;
  margin: 0 0 8px;
}

.wiz-headline em { font-style: italic; color: var(--accent-dark); }

.wiz-reward-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--pine);
  color: var(--pine-cream);
  font-size: 11px;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: var(--radius);
  margin: 0 auto 20px;
  letter-spacing: 0.02em;
}

.wiz-sub {
  color: var(--muted);
  font-size: 15px;
  margin: 0 0 28px;
  line-height: 1.5;
}

.wiz-body { flex: 1; display: flex; flex-direction: column; gap: 14px; }

.wiz-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
}

.wiz-skip {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  padding: 4px;
}

.wiz-checklist { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }

.wiz-checklist-item { font-size: 13px; color: var(--muted-dim); display: flex; align-items: center; gap: 6px; }

.wiz-checklist-item.met { color: var(--good); }

.wiz-avatar-picker {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--card-2);
  border: 2px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  margin: 0 auto 12px;
  cursor: pointer;
  overflow: hidden;
  color: var(--muted);
}

.wiz-avatar-picker img { width: 100%; height: 100%; object-fit: cover; }

.wiz-username-status { font-size: 13px; margin-top: -6px; min-height: 18px; }
.wiz-username-status.available { color: var(--good); }
.wiz-username-status.taken { color: var(--danger); }

.wiz-chip-row { display: flex; flex-wrap: wrap; gap: 8px; }

.wiz-chip {
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.wiz-chip.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.wiz-done {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.wiz-done-check {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-elevated);
}

/* The one saturated block on the feed: the create CTA in deep pine, so
   the page opens with the brand's second color instead of another white
   card. */
.capture-cta {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 16px;
  margin-bottom: 12px;
  border-radius: var(--radius);
  background: var(--pine);
  color: var(--pine-cream);
  text-decoration: none;
  box-shadow: var(--shadow-elevated);
  transition: transform 100ms ease-out;
}

.capture-cta:active { transform: scale(0.985); }

.capture-cta .capture-cta-plus {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(238, 240, 230, 0.16);
  color: var(--pine-cream);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.capture-cta .capture-cta-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.capture-cta .capture-cta-sub {
  font-size: 12.5px;
  font-weight: 600;
  opacity: 0.85;
  margin-top: 1px;
}

/* Collapsed "You're at X" row, shown once a place is auto-selected. */
.place-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.place-eyebrow {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 2px;
}

.place-name {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: break-word;
}

.place-change {
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 7px 15px;
  font-size: 12.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  flex-shrink: 0;
}

/* Menu dish picker. */
.menu-hint {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.menu-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 11px 13px;
  margin-bottom: 6px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.menu-option.selected {
  border-color: var(--pine);
  background: var(--pine-soft);
  color: var(--pine-dark);
}

.menu-option-name {
  min-width: 0;
  overflow-wrap: break-word;
}

.menu-option-cal {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  flex-shrink: 0;
}

.menu-option.selected .menu-option-cal { color: var(--pine-dark); }

/* Reaction selfie: a small inset over the food photo, the way a dual-camera
   post reads. Present on the capture screen and on the post card. Not
   square (76x96), so it gets the normal card radius rather than a circle —
   50% on a non-square box renders as an ellipse. */
#reaction-chip,
.post-reaction {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 76px;
  height: 96px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 3px solid var(--bg);
  box-shadow: var(--shadow-elevated);
  background: var(--card-2);
  z-index: 2;
}

#reaction-chip img,
.post-reaction img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* #reaction-remove: the capture screen's pre-post chip (before upload).
   .reaction-remove-btn: the same control on an already-posted card, wired
   to DELETE /api/posts/:id/reaction — same look, different lifecycle. */
#reaction-remove,
.reaction-remove-btn {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.68);
  color: white;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.post-card .post-photo-wrap { position: relative; }

/* Nutrition strip on a post card. Calories lead; macros are secondary;
   the source badge is deliberately always visible so an estimate is never
   mistaken for a measured value. */
.post-nutrition {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.post-nutrition .nut-cal {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
  margin-right: auto;
}

.post-nutrition .nut-cal span {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-left: 3px;
}

/* Three macros plus the calorie block never fit one 375px line, so the
   split is made deliberate: calories and the source badge share the top
   row, macros get their own beneath. */
.post-nutrition .nut-macros {
  display: flex;
  gap: 12px;
  flex-basis: 100%;
  order: 3;
  flex-wrap: wrap;
}

.post-nutrition .nut-macro {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted-dim);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.post-nutrition .nut-macro i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: block;
}

.post-nutrition .nut-macro.protein i { background: var(--pine); }
.post-nutrition .nut-macro.carbs i { background: var(--score-mid); }
.post-nutrition .nut-macro.fat i { background: var(--accent); }

.nut-badge {
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 3px 8px;
  border-radius: var(--radius);
  white-space: nowrap;
  background: var(--card-2);
  color: var(--muted);
  border: 1px solid var(--border);
}

/* Verified sources (the cook's own numbers, or USDA lab data) read pine;
   anything estimated stays neutral so the difference is legible. */
.nut-badge.verified {
  background: var(--pine-soft);
  color: var(--pine-dark);
  border-color: transparent;
}

.nut-edit-btn {
  border: none;
  background: none;
  padding: 3px 2px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.nut-pending {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

/* Nutrition editor modal: a compact grid of macro inputs. */
.nut-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.nut-grid label { margin-bottom: 2px; }

.nut-derived {
  background: var(--pine-soft);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-top: 12px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.nut-derived .nut-derived-value {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  color: var(--pine-dark);
}

.nut-derived .nut-derived-label {
  font-size: 11.5px;
  color: var(--muted-dim);
  font-weight: 600;
  max-width: 58%;
  text-align: right;
  line-height: 1.35;
}

/* Welcome-page product demo: a small stack of faux feed rows so the
   landing screen shows the product instead of empty paper. */
.intro-demo {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 26px auto 0;
  width: 100%;
  max-width: 310px;
  text-align: left;
}

.intro-demo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  padding: 10px 12px;
  box-shadow: var(--shadow-card);
}

.intro-demo-row .intro-demo-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.intro-demo-row .intro-demo-text {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--muted-dim);
  line-height: 1.35;
}

.intro-demo-row .intro-demo-text strong { color: var(--ink); }

.intro-demo-row .intro-demo-text em {
  font-family: var(--font-serif);
  color: var(--accent-dark);
}

/* Standalone pill shape — the base .nearby-rating styles are scoped to
   .nearby-card and don't reach these demo rows. */
.intro-demo-row .nearby-rating {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: var(--radius);
  flex-shrink: 0;
}

.intro-demo-row .nearby-rating span { font-weight: 600; opacity: 0.7; font-size: 9px; }

.intro-points {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 26px auto 0;
  width: 100%;
  max-width: 310px;
  text-align: left;
}

.intro-point {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
}

.intro-point .intro-point-num {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 15px;
  color: var(--accent);
  flex-shrink: 0;
}

/* Reserved for rare, first-time celebration moments (onboarding done,
   post-created success) — not for anything a user sees routinely. */
.pop-in {
  animation: pop-in 480ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes pop-in {
  0% { opacity: 0; transform: scale(0.4); }
  60% { opacity: 1; transform: scale(1.08); }
  100% { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .pop-in { animation-duration: 40ms; }
  .wiz-step,
  .ftc-banner,
  .ftc-banner-chip,
  .sheet-backdrop,
  .sheet-modal,
  .fab,
  #prompt-state, #form-state, #success-state {
    transition-duration: 40ms !important;
  }
}
