:root {
  --font-heading: "Satoshi", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --brand: #000000;
  --brand-dark: #111111;
  --accent: #34c759;
  --ink: #111111;
  --muted: #6e6e73;
  --subtle: #f5f5f7;
  --surface: #ffffff;
  --surface-strong: #fbfbfd;
  --surface-raised: #ffffff;
  --line: #e5e5ea;
  --danger: #ff3b30;
  --danger-bg: #fff2f1;
  --shadow: 0 10px 26px rgba(0, 0, 0, 0.08);
  --radius: 6px;
  --tap: 42px;
}

[data-theme="ember"] {
  --brand: #000000;
  --brand-dark: #111111;
  --accent: #ff9500;
  --subtle: #fff7ed;
  --surface-strong: #fffaf5;
  --surface-raised: #ffffff;
  --line: #eadfd5;
  --shadow: 0 10px 26px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  color: var(--ink);
  background: #000;
  font-family: var(--font-body);
  line-height: 1.5;
}

body {
  margin: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.skip-link {
  position: fixed;
  left: 12px;
  top: 12px;
  z-index: 10;
  transform: translateY(-160%);
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
}

.skip-link:focus {
  transform: translateY(0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--surface);
  box-shadow: 0 0 0 1px #1c1c1e;
}

.brand-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand-lockup {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: var(--radius);
  background: #e53935;
  color: #fff;
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 800;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.updated-line {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: var(--font-heading);
  letter-spacing: 0;
}

h1 {
  margin-bottom: 0;
  overflow-wrap: anywhere;
  font-size: 17px;
  line-height: 1.12;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.25;
}

h3 {
  margin-bottom: 4px;
  font-size: 15px;
  line-height: 1.25;
}

.icon-button {
  display: grid;
  width: var(--tap);
  height: var(--tap);
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}

.icon-button svg {
  width: 21px;
  height: 21px;
}

.menu-tools {
  padding: 12px 16px 10px;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-raised);
  padding: 0 10px;
  box-shadow: none;
}

.search-field svg {
  width: 17px;
  height: 17px;
  color: var(--muted);
}

.search-field input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 14px;
}

.search-results-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.inline-results {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.inline-results strong {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink);
  font-weight: 800;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.dot.available {
  background: #63c88a;
}

.dot.hidden {
  background: #ff7a7a;
}

.control-section,
.menu-results {
  padding: 14px;
  border-top: 1px solid var(--line);
}

.filter-sheet .control-section {
  padding-right: 0;
  padding-left: 0;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.section-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
}

.text-button {
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
}

.decision-section.is-complete {
  padding-bottom: 12px;
}

.decision-section.is-complete .decision-body,
.decision-section.is-complete [id^="pass"],
.decision-section:not(.is-complete) [id^="edit"] {
  display: none;
}

.decision-section.is-complete .section-heading {
  margin-bottom: 0;
}

.decision-summary {
  max-width: 285px;
}

.filter-group + .filter-group {
  margin-top: 12px;
}

.filter-group p {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.range-control {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  padding: 10px;
}

.range-control + .range-control {
  margin-top: 10px;
}

.range-control div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.range-control label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.range-control strong {
  color: var(--brand-dark);
  font-size: 12px;
}

.range-control input[type="range"] {
  width: 100%;
  accent-color: var(--brand);
}

.preset-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}

.preset-button {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: stretch;
  gap: 10px;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 10px;
  color: var(--ink);
  text-align: left;
}

.preset-button > span:nth-child(2) {
  align-self: center;
}

.preset-button[aria-pressed="true"] {
  border-color: var(--brand);
  background: var(--subtle);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.preset-button .preset-icon {
  display: grid;
  width: 38px;
  height: 100%;
  min-height: 38px;
  place-items: center;
  align-self: center;
  border-radius: var(--radius);
  background: var(--subtle);
  color: var(--brand-dark);
}

.preset-icon svg {
  width: 21px;
  height: 21px;
}

.preset-button strong {
  display: block;
  font-family: var(--font-heading);
  font-size: 14px;
}

.preset-button span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.preset-count {
  justify-self: end;
  align-self: center;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
}

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

.filter-chip {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 13px;
  font-size: 12px;
  font-weight: 800;
}

.filter-chip[aria-pressed="true"] {
  border-color: #111;
  background: #111;
  color: #fff;
}

.top-nine .filter-chip[aria-pressed="true"]::after {
  content: " x";
  font-weight: 900;
}

.compact .filter-chip,
.nutrition-controls .filter-chip {
  min-height: 34px;
  font-size: 12px;
}

.more-panel {
  margin-top: 10px;
}

.more-panel summary {
  min-height: 38px;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
}

.result-dock {
  position: sticky;
  top: 68px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 16px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #000;
  color: var(--ink);
  padding: 10px;
  box-shadow: var(--shadow);
}

.active-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  padding: 11px 12px;
}

.active-summary strong,
.active-summary p {
  display: block;
  margin: 0;
}

.active-summary strong {
  font-family: var(--font-heading);
  font-size: 13px;
}

.active-summary p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.result-dock strong,
.result-dock span {
  display: block;
}

.result-dock strong {
  font-size: 14px;
  color: #fff;
}

.result-dock span {
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
}

.result-dock button,
.empty-state button {
  min-height: 36px;
  border: 0;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 900;
}

.category-wrap {
  position: relative;
  padding-bottom: 8px;
}

.category-rail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 16px 8px;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 34px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 34px), transparent);
}

.rail-more {
  display: block;
  width: fit-content;
  margin: -7px 16px 0 auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-size: 10px;
  font-weight: 900;
  pointer-events: none;
}

.category-rail::-webkit-scrollbar {
  display: none;
}

.category-tab {
  min-height: 25px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 0 13px;
  font-size: 12px;
  font-weight: 900;
}

.category-tab[aria-current="true"] {
  border-color: var(--brand-dark);
  background: var(--ink);
  color: #fff;
}

.results-heading {
  align-items: center;
}

.show-hidden {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.menu-disclaimer {
  margin: 12px 0 0;
  border-left: 3px solid var(--accent);
  background: #fff8eb;
  padding: 8px 10px;
  color: #6a4b11;
  font-size: 12px;
}

.menu-disclaimer.bottom {
  margin-top: 14px;
}

.menu-list {
  display: grid;
  gap: 10px;
}

.menu-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
  text-align: left;
}

.menu-card.hidden-match {
  background: #fff8f7;
  opacity: 0.74;
}

.card-content {
  width: 100%;
  color: inherit;
  text-align: left;
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  margin: 0 0 4px;
  font-size: 15px;
}

.card-meta {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.card-description {
  margin: 0 0 12px;
  color: #4b4b52;
  font-size: 12px;
}

.calorie-badge {
  min-width: 58px;
  border-radius: var(--radius);
  background: var(--subtle);
  color: var(--brand-dark);
  padding: 7px 8px;
  text-align: center;
}

.calorie-badge strong,
.calorie-badge span {
  display: block;
}

.calorie-badge strong {
  font-size: 18px;
  line-height: 1;
}

.calorie-badge span {
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.allergen-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  width: 100%;
}

.allergen-badge {
  border: 1px solid #d7d7dc;
  border-radius: var(--radius);
  background: #fff;
  color: #1f1f25;
  padding: 3px 6px;
  font-size: 10px;
  font-weight: 900;
}

.mini-stat,
.warning-pill,
.diet-pill {
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 900;
}

.mini-stat {
  background: #f2f2f7;
  color: #303036;
}

.diet-pill {
  background: var(--subtle);
  color: var(--brand-dark);
}

.warning-pill {
  background: var(--danger-bg);
  color: var(--danger);
}

.hidden-reason {
  width: 100%;
  margin-top: 3px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 800;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 8px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  padding: 28px 18px;
  text-align: center;
}

.empty-state svg {
  width: 42px;
  height: 42px;
  color: var(--muted);
}

.empty-state p {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 8;
  background: rgba(0, 0, 0, 0.46);
}

.filter-sheet {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 9;
  max-height: min(84vh, 760px);
  overflow: auto;
  border-radius: 10px 10px 0 0;
  background: #fff;
  padding: 18px 16px 28px;
  box-shadow: 0 -18px 48px rgba(0, 0, 0, 0.64);
}

.filter-sheet {
  padding-top: 10px;
  padding-bottom: 88px;
}

.sheet-handle {
  width: 42px;
  height: 4px;
  margin: 0 auto 12px;
  border-radius: 999px;
  background: #d1d1d6;
}

.filter-sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
}

.filter-sheet-header h2 {
  margin-top: 2px;
}

.more-filters {
  border-top: 1px solid var(--line);
}

.more-filters summary {
  min-height: 44px;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 900;
}

.filter-sheet-actions,
.filter-action {
  position: sticky;
  bottom: 0;
  z-index: 6;
  display: grid;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.filter-action {
  position: sticky;
  margin-top: auto;
}

.filter-open,
.filter-sheet-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 0;
  border-radius: var(--radius);
  background: #111;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
}

.filter-open svg {
  width: 18px;
  height: 18px;
}

.disclaimer {
  margin: 18px 0 0;
  border-left: 3px solid var(--accent);
  background: #fff8eb;
  padding: 10px 12px;
  color: #6a4b11;
  font-size: 12px;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent), #ffffff 10%);
  outline-offset: 2px;
}

@media (min-width: 720px) {
  .app-shell {
    margin: 22px auto;
    min-height: calc(100vh - 44px);
    border-radius: 10px;
    overflow: hidden;
  }

  .detail-sheet {
    right: calc((100vw - 520px) / 2);
    left: auto;
    width: 520px;
  }
}
