.food-main {
  width: min(1180px, calc(100% - 32px));
}

.food-hero {
  align-items: center;
}

.food-hero h1 {
  max-width: 880px;
  font-size: clamp(38px, 6.5vw, 70px);
}

.legcow-route,
.food-browser {
  min-width: 0;
  margin: 24px 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.legcow-route {
  border-color: #d9bd8c;
  background:
    linear-gradient(145deg, #fff8e9, #fff 42%),
    var(--paper);
}

.legcow-route[data-route-status="active"] {
  border-color: #9fc9bc;
  background: linear-gradient(145deg, #edf8f3, #fff 44%);
}

.route-heading,
.browser-heading {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.route-heading > *,
.browser-heading > * {
  min-width: 0;
}

.route-heading h2,
.browser-heading h2 {
  margin: 0;
  font-size: clamp(27px, 4vw, 39px);
}

.route-badge,
.status-badge,
.meta-chip {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.route-badge {
  flex: 0 0 auto;
  border-color: #e6c29d;
  background: #fff7ed;
  color: var(--amber);
}

.legcow-route[data-route-status="active"] .route-badge,
.status-badge.active {
  border-color: #bcd8cf;
  background: #edf7f4;
  color: var(--green-dark);
}

.status-badge.removed {
  border-color: #efb8b2;
  background: #fff1f0;
  color: var(--red);
}

.status-badge.unresolved {
  border-color: #e6c29d;
  background: #fff7ed;
  color: var(--amber);
}

#legcow-summary {
  margin: 14px 0 0;
  color: #536861;
  line-height: 1.65;
}

.legcow-steps {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.route-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.route-card strong,
.route-card span,
.route-card small {
  display: block;
}

.route-card strong {
  color: var(--green-dark);
  font-size: 15px;
}

.route-card span {
  margin-top: 7px;
  color: #536861;
  line-height: 1.55;
}

.route-card small {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.route-card.blocked {
  border-color: #e6c29d;
  background: #fff9f0;
}

.route-card.blocked strong {
  color: var(--amber);
}

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

#clear-food-filters {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 900;
}

.view-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 17px;
}

.view-switch button {
  min-height: 38px;
  padding: 0 13px;
  font-size: 12px;
  font-weight: 900;
}

.view-switch button[aria-pressed="true"] {
  border-color: var(--green);
  background: #e4f3ed;
  color: var(--green-dark);
}

.filter-grid {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 2fr) minmax(180px, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.filter-field {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.filter-field span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.filter-field input,
.filter-field select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.filter-field select:focus {
  border-color: var(--green);
  outline: 2px solid #0f766e24;
}

.filter-boundary,
.result-status {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.result-status {
  color: var(--green-dark);
  font-weight: 800;
}

.state-panel {
  display: grid;
  min-width: 0;
  gap: 7px;
  justify-items: center;
  padding: 25px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: var(--paper);
  color: var(--muted);
  text-align: center;
}

.state-panel[hidden] {
  display: none;
}

.state-panel strong {
  color: var(--ink);
  font-size: 16px;
}

.state-panel span {
  max-width: 760px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.state-error {
  border-style: solid;
  border-color: #e6c29d;
  background: #fff7ed;
  color: #8a4b12;
}

.state-error strong {
  color: var(--amber);
}

.state-empty {
  background: #f7faf8;
}

.food-results,
.group-grid,
.recipe-grid {
  min-width: 0;
}

.group-grid,
.recipe-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.item-group {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--paper);
  box-shadow: 0 9px 24px #1d3a320d;
}

.item-group-heading {
  display: grid;
  min-width: 0;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
}

.item-visual {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  overflow: hidden;
  border: 1px solid #d5e0db;
  border-radius: 9px;
  background: #eef4f1;
}

.item-visual img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  image-rendering: pixelated;
}

.item-placeholder {
  position: relative;
  display: block;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  color: #668078;
}

.item-placeholder::before,
.item-placeholder::after {
  position: absolute;
  content: "";
}

.item-placeholder.is-item::before {
  inset: 6px;
  border: 2px solid currentcolor;
  border-radius: 5px;
  transform: rotate(45deg);
}

.item-placeholder.is-fluid::before {
  width: 16px;
  height: 21px;
  top: 3px;
  left: 7px;
  border: 2px solid #3a7d9f;
  border-radius: 65% 35% 62% 38%;
  background: #d9f2ff;
  transform: rotate(45deg);
}

.item-placeholder.is-dynamic::before {
  inset: 5px;
  border: 2px dashed currentcolor;
  border-radius: 50%;
}

.item-placeholder.is-dynamic::after {
  width: 6px;
  height: 6px;
  top: 12px;
  left: 12px;
  border-radius: 50%;
  background: currentcolor;
}

.item-placeholder.is-choice::before,
.item-placeholder.is-choice::after {
  width: 15px;
  height: 15px;
  border: 2px solid currentcolor;
  border-radius: 4px;
  background: #eef4f1;
}

.item-placeholder.is-choice::before {
  top: 5px;
  left: 5px;
}

.item-placeholder.is-choice::after {
  right: 4px;
  bottom: 4px;
}

.item-placeholder.is-station::before {
  inset: 3px;
  border-radius: 50%;
  background:
    radial-gradient(circle, transparent 0 4px, #668078 5px 8px, transparent 9px),
    repeating-conic-gradient(#668078 0 12deg, transparent 12deg 30deg);
}

.item-group-title {
  min-width: 0;
}

.item-group-title h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.35;
}

.item-en,
.item-id,
.item-aliases {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.item-id {
  padding: 0;
  background: none;
  color: #71817c;
  font-size: 9px;
}

.group-relation {
  margin: 12px 0 9px;
  color: #536861;
  font-size: 12px;
  line-height: 1.5;
}

.recipe-stack {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.recipe-alternatives {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8fbf9;
}

.recipe-alternatives > summary {
  min-width: 0;
  padding: 10px 12px;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.45;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.recipe-alternatives[open] > summary {
  border-bottom: 1px solid var(--line);
}

.recipe-alternative-list {
  display: grid;
  min-width: 0;
  gap: 8px;
  padding: 8px;
}

.recipe-alternatives:not([open]) > .recipe-alternative-list {
  display: none;
}

.recipe-alternative-list .recipe-card {
  box-shadow: none;
}

.food-more {
  display: block;
  min-height: 44px;
  margin: 14px auto 0;
  padding: 0 20px;
  border-color: var(--green);
  color: var(--green-dark);
  font-weight: 900;
}

.recipe-card {
  min-width: 0;
  padding: 11px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  box-shadow: 0 8px 22px #1d3a3209;
}

.recipe-formula {
  display: grid;
  min-width: 0;
  max-width: 100%;
  grid-template-columns: minmax(0, 1fr) auto minmax(92px, 0.55fr);
  align-items: center;
  gap: 8px;
}

.formula-side {
  display: flex;
  min-width: 0;
  max-width: 100%;
  flex: 1 1 210px;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.formula-token {
  display: inline-grid;
  min-width: 0;
  max-width: 100%;
  grid-template-columns: 40px minmax(0, auto);
  gap: 6px;
  align-items: center;
  padding: 5px 7px 5px 5px;
  border: 1px solid #d9e3df;
  border-radius: 8px;
  background: #fff;
}

.formula-token .item-visual {
  width: 38px;
  height: 38px;
  border-radius: 7px;
}

.formula-token .item-visual img {
  width: 34px;
  height: 34px;
}

.formula-token-copy,
.formula-token-name,
.formula-amount,
.formula-token-note {
  display: block;
  min-width: 0;
}

.formula-token-copy {
  max-width: 150px;
}

.formula-token-name {
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.formula-amount {
  margin-top: 2px;
  color: var(--green-dark);
  font-size: 10px;
  font-weight: 900;
  line-height: 1.2;
}

.formula-token-note {
  margin-top: 2px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  line-height: 1.3;
}

.formula-choice {
  display: inline-flex;
  min-width: 0;
  max-width: 100%;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

.formula-choice-word,
.formula-operator,
.formula-arrow {
  flex: 0 0 auto;
  color: var(--green-dark);
  font-weight: 900;
  line-height: 1;
}

.formula-choice-word {
  color: var(--muted);
  font-size: 9px;
}

.formula-operator {
  font-size: 16px;
}

.formula-transition {
  display: inline-flex;
  min-width: 0;
  max-width: 100%;
  flex: 0 1 auto;
  align-items: center;
  gap: 6px;
}

.formula-arrow {
  font-size: 23px;
}

.recipe-station {
  display: inline-flex;
  min-width: 0;
  max-width: 100%;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 5px;
  border: 1px solid #bed6ce;
  border-radius: 999px;
  background: #edf7f4;
  color: var(--green-dark);
}

.recipe-station.is-handcraft {
  padding-left: 8px;
  border-style: dashed;
  background: #f7faf8;
}

.station-visual {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  overflow: hidden;
  border: 1px solid #d5e0db;
  border-radius: 50%;
  background: #fff;
}

.station-visual img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  image-rendering: pixelated;
}

.station-visual .item-placeholder {
  width: 24px;
  height: 24px;
}

.station-name {
  min-width: 0;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.formula-note {
  margin: 8px 0 0;
  color: #536861;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.45;
}

.recipe-card[data-craftable="false"] {
  border-color: #e4c5a7;
  background: #fffdfa;
}

.recipe-card > summary {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 14px;
  cursor: pointer;
  list-style: none;
}

.recipe-card > summary::-webkit-details-marker {
  display: none;
}

.recipe-card > summary::after {
  content: "+";
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  color: var(--green);
  font-size: 23px;
  line-height: 1;
}

.recipe-card[open] > summary::after {
  content: "−";
}

.recipe-summary-main {
  min-width: 0;
}

.recipe-title-row {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}

.recipe-title-row h2,
.recipe-title-row h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
}

.recipe-preview {
  margin: 7px 0 0;
  color: #536861;
  font-size: 11px;
  line-height: 1.55;
}

.recipe-meta {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.recipe-body {
  display: grid;
  min-width: 0;
  gap: 13px;
  padding: 14px;
  border-top: 1px solid #edf2ef;
}

.noncraftable-warning {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid var(--amber);
  background: #fff7ed;
  color: #6f451e;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.55;
}

.recipe-facts {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.recipe-fact {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-2);
}

.recipe-fact small,
.recipe-fact strong {
  display: block;
}

.recipe-fact small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
}

.recipe-fact strong {
  margin-top: 4px;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.recipe-section {
  min-width: 0;
}

.recipe-section h4 {
  margin: 0 0 8px;
  color: var(--green-dark);
  font-size: 13px;
}

.part-list {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.part-row {
  display: grid;
  min-width: 0;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.part-row .item-visual {
  width: 40px;
  height: 40px;
  border-radius: 7px;
}

.part-row .item-visual img {
  width: 34px;
  height: 34px;
}

.part-copy {
  min-width: 0;
}

.part-copy b,
.part-copy span,
.part-copy code {
  display: block;
}

.part-copy b {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.4;
}

.part-copy span {
  margin-top: 3px;
  color: #536861;
  font-size: 10px;
  line-height: 1.45;
}

.part-copy code {
  margin-top: 3px;
  padding: 0;
  background: none;
  color: #71817c;
  font-size: 8px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.instruction-list {
  margin: 0;
  padding-left: 21px;
}

.instruction-list li {
  color: #536861;
  font-size: 12px;
  line-height: 1.65;
}

.instruction-list li + li {
  margin-top: 5px;
}

.evidence-boundary {
  padding: 11px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #fbfdfc;
}

.evidence-boundary > p {
  margin: 0;
  color: #536861;
  font-size: 11px;
  line-height: 1.55;
}

.evidence-list {
  display: grid;
  min-width: 0;
  gap: 7px;
  margin-top: 9px;
}

.evidence-record {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.evidence-record dl {
  display: grid;
  min-width: 0;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 4px 9px;
  margin: 0;
}

.evidence-record dt {
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
}

.evidence-record dd {
  min-width: 0;
  margin: 0;
  color: #536861;
  font: 9px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace;
  overflow-wrap: anywhere;
}

.source-ref {
  display: block;
  margin-top: 8px;
  padding: 8px 9px;
  border-radius: 7px;
  background: #edf3f0;
  color: #315e55;
  font: 9px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace;
  overflow-wrap: anywhere;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

@media (max-width: 900px) {
  .filter-grid,
  .recipe-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search-field {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .group-grid,
  .recipe-grid,
  .legcow-steps {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .food-main {
    width: calc(100% - 24px);
  }

  .food-hero h1 {
    font-size: clamp(34px, 10.5vw, 48px);
  }

  .legcow-route,
  .food-browser {
    padding: 15px 12px;
  }

  .route-heading,
  .browser-heading {
    display: grid;
    gap: 10px;
  }

  .route-badge,
  #clear-food-filters {
    justify-self: start;
  }

  .filter-grid,
  .recipe-facts,
  .part-list {
    grid-template-columns: 1fr;
  }

  .search-field {
    grid-column: auto;
  }

  .view-switch button {
    flex: 1 1 130px;
  }

  .item-group {
    padding: 12px;
  }

  .recipe-card {
    padding: 10px;
  }

  .recipe-formula {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .formula-side {
    width: 100%;
  }

  .formula-transition {
    justify-self: start;
  }

  .formula-token {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .formula-token-copy {
    max-width: min(170px, calc(100vw - 112px));
  }

  .recipe-card > summary,
  .recipe-body {
    padding: 12px;
  }

  .evidence-record dl {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .evidence-record dd + dt {
    margin-top: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
