:root {
  --bg: #f7f3e9;
  --bg-deep: #efe9dc;
  --surface: #fffdf8;
  --surface-soft: #e7eddc;
  --surface-warm: #f5e7cf;
  --text: #163b31;
  --text-strong: #0d352b;
  --muted: #68746e;
  --muted-strong: #4c5c55;
  --primary: #154b3b;
  --primary-hover: #0d3f31;
  --primary-soft: #dfeadd;
  --accent: #e96f50;
  --accent-soft: #f7ddd4;
  --gold: #dfa631;
  --gold-soft: #f6e6bd;
  --warning: #b66b28;
  --danger: #a94f45;
  --danger-soft: #f6dfdc;
  --border: #d9d4c9;
  --border-strong: #c7c1b5;
  --shadow-sm: 0 6px 20px rgba(32, 50, 42, 0.06);
  --shadow-md: 0 18px 50px rgba(29, 53, 43, 0.11);
  --shadow-lg: 0 28px 80px rgba(29, 53, 43, 0.15);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --radius-pill: 999px;
  --page: 1180px;
  --header-height: 82px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.8) 0, transparent 26%),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, -apple-system,
    BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(233, 111, 80, 0.48);
  outline-offset: 3px;
}

button:disabled {
  cursor: not-allowed;
}

img,
svg {
  max-width: 100%;
}

.skip-link {
  position: fixed;
  z-index: 200;
  top: 10px;
  left: 12px;
  padding: 10px 14px;
  transform: translateY(-140%);
  border-radius: 8px;
  background: var(--text-strong);
  color: white;
  text-decoration: none;
}

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

.page-width {
  width: min(calc(100% - 48px), var(--page));
  margin-inline: auto;
}

.site-header {
  position: relative;
  z-index: 40;
  display: flex;
  min-height: var(--header-height);
  align-items: center;
  justify-content: space-between;
  padding: 14px max(24px, calc((100vw - var(--page)) / 2));
  border-bottom: 1px solid rgba(198, 190, 176, 0.72);
  background: rgba(247, 243, 233, 0.94);
  backdrop-filter: blur(14px);
}

.site-header.is-sticky {
  position: sticky;
  top: 0;
}

.brand {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-strong);
  cursor: pointer;
  font-size: 21px;
  font-weight: 820;
  letter-spacing: -0.04em;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: inset 0 0 0 5px rgba(255, 255, 255, 0.12);
}

.brand-mark span {
  position: absolute;
  width: 4px;
  border-radius: 4px;
  background: var(--surface);
  transform-origin: bottom;
}

.brand-mark span:nth-child(1) {
  height: 9px;
  transform: translate(-7px, 2px) rotate(-12deg);
}

.brand-mark span:nth-child(2) {
  height: 16px;
  transform: translate(0, -1px);
}

.brand-mark span:nth-child(3) {
  height: 12px;
  transform: translate(7px, 1px) rotate(12deg);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 32px;
}

.stepper {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.stepper li {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #89918c;
  font-size: 13px;
  font-weight: 700;
}

.stepper li::after {
  width: 24px;
  height: 1px;
  margin-left: 2px;
  background: var(--border);
  content: "";
}

.stepper li:last-child::after {
  display: none;
}

.stepper span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  font-size: 11px;
}

.stepper .is-active {
  color: var(--text-strong);
}

.stepper .is-active span,
.stepper .is-done span {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

.stepper .is-done {
  color: var(--primary);
}

.text-button,
.inline-link,
.back-link {
  min-height: 44px;
  padding: 4px 2px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-weight: 680;
}

.text-button,
.inline-link {
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 6px;
  transition: color 180ms ease, text-decoration-color 180ms ease;
}

.text-button:hover,
.inline-link:hover {
  color: var(--primary-hover);
  text-decoration-color: currentColor;
}

.back-link {
  display: inline-flex;
  align-items: center;
  margin-bottom: 24px;
  color: var(--muted-strong);
  text-decoration: none;
}

.back-link:hover {
  color: var(--primary);
}

.view {
  min-height: calc(100vh - var(--header-height));
}

.view[hidden] {
  display: none !important;
}

.view.is-active {
  animation: view-in 380ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 790;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow > span {
  width: 24px;
  height: 3px;
  border-radius: 99px;
  background: var(--accent);
}

.primary-button,
.secondary-button {
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-weight: 760;
  transition:
    transform 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.primary-button {
  border: 1px solid var(--primary);
  background: var(--primary);
  box-shadow: 0 10px 24px rgba(21, 75, 59, 0.18);
  color: white;
}

.primary-button:hover:not(:disabled) {
  transform: translateY(-2px);
  background: var(--primary-hover);
  box-shadow: 0 14px 30px rgba(21, 75, 59, 0.25);
}

.primary-button:disabled {
  border-color: #bfc8c2;
  background: #bfc8c2;
  box-shadow: none;
  color: #f5f6f5;
}

.primary-button > span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  transition: transform 180ms ease;
}

.primary-button:hover:not(:disabled) > span {
  transform: translateX(3px);
}

.secondary-button {
  border: 1px solid var(--border-strong);
  background: rgba(255, 253, 248, 0.64);
  color: var(--text);
}

.secondary-button:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--primary);
  background: var(--surface);
}

/* Home */
.home-view {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 44px 24px 24px;
}

.hero-shell {
  display: grid;
  width: min(100%, 1280px);
  align-items: center;
  margin: auto;
  grid-template-columns: minmax(0, 1fr) minmax(450px, 0.92fr);
  gap: clamp(48px, 7vw, 104px);
}

.hero-copy {
  padding: 24px 0 14px;
}

.hero-copy h1 {
  max-width: 680px;
  margin: 0;
  color: var(--text-strong);
  font-size: clamp(60px, 6vw, 88px);
  font-weight: 900;
  letter-spacing: -0.075em;
  line-height: 1.13;
}

.hero-lead {
  max-width: 610px;
  margin: 30px 0 0;
  color: #283c34;
  font-size: clamp(18px, 1.7vw, 23px);
  line-height: 1.75;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 34px;
}

.hero-primary {
  min-width: 226px;
  min-height: 62px;
  justify-content: space-between;
  padding-left: 30px;
  font-size: 18px;
}

.continue-button {
  min-height: 58px;
}

.trust-row {
  display: grid;
  max-width: 700px;
  margin-top: 48px;
  grid-template-columns: repeat(3, 1fr);
}

.trust-row > div {
  display: grid;
  align-items: center;
  padding: 4px 18px;
  border-right: 1px solid var(--border);
  grid-template-columns: 40px 1fr;
  column-gap: 10px;
}

.trust-row > div:first-child {
  padding-left: 0;
}

.trust-row > div:last-child {
  border-right: 0;
}

.trust-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  background: #e4ead9;
  color: var(--primary);
  font-size: 17px;
  grid-row: 1 / 3;
}

.leaf-icon {
  font-size: 12px;
  transform: rotate(45deg);
}

.trust-row strong {
  color: var(--text-strong);
  font-size: 15px;
  line-height: 1.25;
}

.trust-row small {
  color: var(--muted);
  font-size: 12px;
}

.hero-visual {
  position: relative;
  overflow: hidden;
  padding: 22px 30px 30px;
  border: 1px solid rgba(211, 218, 196, 0.78);
  border-radius: 34px;
  background: var(--surface-soft);
  box-shadow: var(--shadow-md);
}

.hero-visual::before,
.hero-visual::after {
  position: absolute;
  border: 1px solid rgba(79, 111, 83, 0.22);
  border-radius: 50%;
  content: "";
}

.hero-visual::before {
  width: 170px;
  height: 170px;
  top: -80px;
  right: -50px;
}

.hero-visual::after {
  width: 94px;
  height: 94px;
  bottom: 18px;
  left: -48px;
}

.visual-label {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #557061;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.03em;
}

.tiny-pill {
  padding: 5px 9px;
  border: 1px solid rgba(21, 75, 59, 0.18);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.45);
}

.plate-wrap {
  position: relative;
  width: min(82%, 360px);
  margin: 16px auto 14px;
}

.plate {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 13px solid #fdfaf1;
  border-radius: 50%;
  background: #f2ede1;
  box-shadow:
    0 16px 26px rgba(50, 62, 50, 0.14),
    inset 0 0 0 2px rgba(164, 155, 138, 0.18);
}

.plate-cell {
  position: absolute;
  overflow: hidden;
  border: 3px solid #fdfaf1;
}

.cell-veg {
  top: 3%;
  left: 3%;
  width: 49%;
  height: 57%;
  border-radius: 80% 16% 14% 18%;
  background: #55734a;
}

.cell-veg i {
  position: absolute;
  width: 54px;
  height: 72px;
  border-radius: 50%;
  background: #8da573;
  transform: rotate(34deg);
}

.cell-veg i:nth-child(1) { top: 22px; left: 26px; }
.cell-veg i:nth-child(2) { top: 48px; left: 73px; background: #708c5e; }
.cell-veg i:nth-child(3) { top: 82px; left: 22px; width: 42px; height: 54px; }
.cell-veg i:nth-child(4) { top: 17px; left: 93px; width: 46px; height: 69px; background: #375c3b; }
.cell-veg i:nth-child(5) { top: 91px; left: 92px; width: 38px; height: 52px; background: #9db487; }

.cell-grain {
  top: 3%;
  right: 3%;
  width: 44%;
  height: 44%;
  border-radius: 16% 80% 18% 12%;
  background: #e7c26f;
}

.cell-grain i {
  position: absolute;
  width: 8px;
  height: 18px;
  border-radius: 80%;
  background: #bd8a2c;
  transform: rotate(24deg);
}

.cell-grain i:nth-child(1) { top: 38px; left: 46px; }
.cell-grain i:nth-child(2) { top: 66px; left: 77px; transform: rotate(-20deg); }
.cell-grain i:nth-child(3) { top: 98px; left: 43px; transform: rotate(52deg); }
.cell-grain i:nth-child(4) { top: 80px; left: 112px; transform: rotate(12deg); }

.cell-protein {
  right: 3%;
  bottom: 3%;
  width: 47%;
  height: 50%;
  border-radius: 12% 18% 80% 16%;
  background: #e86f4f;
}

.cell-protein i {
  position: absolute;
  width: 64px;
  height: 70px;
  border: 3px solid #f9d4ca;
  border-radius: 46% 54% 44% 56%;
  background: #d95b44;
}

.cell-protein i:nth-child(1) { top: 21px; left: 19px; transform: rotate(-18deg); }
.cell-protein i:nth-child(2) { top: 52px; right: 18px; transform: rotate(17deg); }
.cell-protein i:nth-child(3) { bottom: 9px; left: 47px; width: 54px; height: 60px; }

.cell-fruit {
  bottom: 3%;
  left: 3%;
  width: 46%;
  height: 38%;
  border-radius: 16% 13% 18% 80%;
  background: #dba62e;
}

.cell-fruit i {
  position: absolute;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #f1cf70;
}

.cell-fruit i:nth-child(1) { top: 34px; left: 42px; box-shadow: 29px -8px 0 #f1cf70, 64px 8px 0 #f1cf70; }
.cell-fruit i:nth-child(2) { top: 70px; left: 61px; box-shadow: 41px 10px 0 #f1cf70; }

.plate-note {
  position: absolute;
  padding: 6px 10px;
  border: 1px solid rgba(45, 74, 58, 0.18);
  border-radius: var(--radius-pill);
  background: rgba(255, 253, 248, 0.9);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
}

.note-one { top: 30%; left: -13%; }
.note-two { top: 13%; right: -10%; }
.note-three { right: -15%; bottom: 20%; }

.preview-bars {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 10px;
  padding: 15px 18px;
  border: 1px solid rgba(21, 75, 59, 0.1);
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.62);
}

.preview-bars > div {
  display: grid;
  align-items: center;
  grid-template-columns: 70px 1fr 36px;
  gap: 10px;
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 700;
}

.segmented-bar {
  display: grid;
  height: 9px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
}

.segmented-bar i {
  background: #cbd4c6;
}

.segmented-bar i.filled {
  background: var(--primary);
}

.preview-bars b {
  color: var(--text);
  font-size: 11px;
  text-align: right;
}

.home-footnote {
  display: flex;
  width: min(100%, 1280px);
  align-items: center;
  gap: 9px;
  margin: 24px auto 0;
  padding-top: 15px;
  border-top: 1px solid rgba(198, 190, 176, 0.55);
  color: var(--muted);
  font-size: 13px;
}

.home-footnote p {
  margin: 0;
}

.home-footnote .inline-link {
  margin-left: auto;
  color: var(--primary);
  font-size: 13px;
}

/* Selection */
.select-view {
  padding: 42px 0 140px;
}

.select-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.select-heading h1 {
  margin: 0;
  color: var(--text-strong);
  font-size: clamp(42px, 5vw, 68px);
  letter-spacing: -0.06em;
  line-height: 1.15;
}

.select-heading > div > p:last-child {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 17px;
}

.selection-count-badge {
  display: grid;
  width: 96px;
  height: 96px;
  flex: 0 0 auto;
  place-items: center;
  align-content: center;
  border: 1px solid rgba(21, 75, 59, 0.22);
  border-radius: 50%;
  background: var(--surface-soft);
}

.selection-count-badge span {
  color: var(--text-strong);
  font-size: 32px;
  font-weight: 850;
  line-height: 1;
}

.selection-count-badge small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.selection-layout {
  display: grid;
  align-items: start;
  margin-top: 38px;
  grid-template-columns: minmax(0, 1fr) 355px;
  gap: 30px;
}

.food-browser {
  min-width: 0;
}

.search-panel {
  position: sticky;
  z-index: 25;
  top: 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 253, 248, 0.95);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px);
}

.search-panel > label {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 760;
}

.search-box {
  display: grid;
  min-height: 58px;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: white;
  grid-template-columns: 44px 1fr 44px;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(21, 75, 59, 0.1);
}

.search-box > span {
  color: var(--primary);
  font-size: 25px;
  text-align: center;
}

.search-box input {
  width: 100%;
  height: 54px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-strong);
  font-size: 16px;
}

.search-box input::placeholder {
  color: #9a9f9a;
}

.search-box button {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--bg-deep);
  cursor: pointer;
  color: var(--muted);
  font-size: 22px;
}

.category-scroller {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  margin-top: 14px;
  padding-bottom: 3px;
  scrollbar-width: thin;
}

.category-chip {
  min-height: 42px;
  flex: 0 0 auto;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: transparent;
  cursor: pointer;
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 680;
}

.category-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.category-chip.is-active {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

.browser-meta {
  display: flex;
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.browser-meta p {
  margin: 0;
}

.browser-meta .inline-link {
  min-height: 36px;
  color: var(--primary);
  font-size: 12px;
}

.food-grid {
  display: grid;
  margin-top: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.food-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 224px;
  flex-direction: column;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 7px 18px rgba(40, 52, 46, 0.04);
  cursor: pointer;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.food-card:hover {
  transform: translateY(-3px);
  border-color: #aebaac;
  box-shadow: var(--shadow-md);
}

.food-card.is-selected {
  border-color: var(--primary);
  background: #f5f8f2;
}

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

.food-icon {
  display: grid;
  width: 50px;
  height: 50px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 15px;
  background: var(--surface-warm);
  font-size: 28px;
}

.confidence-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 10px;
}

.confidence-dot::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  content: "";
}

.confidence-dot[data-confidence="high"]::before {
  background: #5e926f;
}

.confidence-dot[data-confidence="low"]::before {
  background: var(--accent);
}

.food-card h3 {
  overflow: hidden;
  margin: 14px 0 2px;
  color: var(--text-strong);
  font-size: 17px;
  font-weight: 790;
  letter-spacing: -0.02em;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.serving-copy {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.food-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.food-tags span,
.tag {
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
}

.food-tags .risk-tag,
.tag.risk-tag {
  background: var(--accent-soft);
  color: #924735;
}

.food-card-actions {
  display: grid;
  align-items: end;
  margin-top: auto;
  padding-top: 14px;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.detail-hint {
  min-height: 38px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  font-size: 11px;
  text-align: left;
}

.detail-hint:hover {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.add-food {
  min-width: 78px;
  min-height: 40px;
  padding: 7px 12px;
  border: 1px solid var(--primary);
  border-radius: var(--radius-pill);
  background: transparent;
  cursor: pointer;
  color: var(--primary);
  font-size: 12px;
  font-weight: 760;
}

.add-food:hover:not(:disabled) {
  background: var(--primary);
  color: white;
}

.add-food:disabled {
  border-color: #a8b4ad;
  background: #e5eae6;
  color: #66766e;
}

.empty-state {
  display: grid;
  min-height: 330px;
  place-items: center;
  align-content: center;
  margin-top: 18px;
  padding: 32px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: rgba(255, 253, 248, 0.56);
  text-align: center;
}

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

.empty-state > span {
  color: var(--primary);
  font-size: 54px;
}

.empty-state h2 {
  margin: 4px 0;
  color: var(--text-strong);
}

.empty-state p {
  margin: 0 0 18px;
  color: var(--muted);
}

.tray-panel {
  position: sticky;
  top: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.tray-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--border);
}

.tray-head .eyebrow,
.drawer-head .eyebrow {
  margin-bottom: 5px;
}

.tray-head h2,
.drawer-head h2 {
  margin: 0;
  color: var(--text-strong);
  font-size: 23px;
}

.danger-text {
  color: var(--danger);
  font-size: 12px;
}

.danger-text:disabled {
  color: #afb4b1;
}

.tray-empty {
  display: grid;
  min-height: 290px;
  place-items: center;
  align-content: center;
  padding: 24px;
  text-align: center;
}

.empty-plate {
  display: grid;
  width: 116px;
  height: 116px;
  margin-bottom: 15px;
  place-items: center;
  border: 10px solid #ece8dd;
  border-radius: 50%;
  background: #f7f5ef;
  box-shadow: inset 0 0 0 1px #ded8ca;
}

.empty-plate span {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 23px;
}

.tray-empty strong {
  color: var(--text-strong);
}

.tray-empty p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.tray-list {
  display: grid;
  max-height: min(55vh, 540px);
  overflow: auto;
  gap: 10px;
  padding: 14px;
  scrollbar-color: #bdc7bf transparent;
  scrollbar-width: thin;
}

.tray-list:empty {
  display: none;
}

.tray-item {
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fbfaf5;
}

.tray-item-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tray-item-top .food-icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  font-size: 20px;
}

.tray-item-title {
  min-width: 0;
  flex: 1;
}

.tray-item-title strong {
  display: block;
  overflow: hidden;
  color: var(--text-strong);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tray-item-title small {
  color: var(--muted);
  font-size: 10px;
}

.remove-food {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  font-size: 21px;
}

.remove-food:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.portion-options {
  display: grid;
  margin: 10px 0 0;
  padding: 0;
  border: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.portion-options legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.portion-options label {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.portion-options input {
  position: absolute;
  opacity: 0;
}

.portion-options span {
  display: grid;
  min-height: 38px;
  place-items: center;
  padding: 5px 2px;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  text-align: center;
}

.portion-options input:checked + span {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

.portion-options input:focus-visible + span {
  outline: 3px solid rgba(233, 111, 80, 0.48);
  outline-offset: 2px;
}

.tray-footer {
  padding: 14px 18px 18px;
  border-top: 1px solid var(--border);
  background: #fbfaf6;
}

.tray-hint {
  display: flex;
  align-items: start;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 10px;
}

.tray-hint > span {
  display: grid;
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--muted);
  border-radius: 50%;
  font-size: 9px;
}

.tray-hint p {
  margin: 0;
}

.generate-button {
  width: 100%;
  min-height: 54px;
  font-size: 14px;
}

.mobile-tray-bar {
  display: none;
}

/* Results */
.result-view {
  padding: 34px 0 90px;
}

.result-shell {
  max-width: 1120px;
}

.result-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.result-topbar .back-link {
  margin: 0;
}

.result-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(28px, 5vw, 58px);
  border: 1px solid #cfd8c7;
  border-radius: 34px;
  background: var(--surface-soft);
  box-shadow: var(--shadow-md);
}

.result-hero::after {
  position: absolute;
  width: 320px;
  height: 320px;
  right: -150px;
  bottom: -190px;
  border: 1px solid rgba(21, 75, 59, 0.16);
  border-radius: 50%;
  content: "";
}

.result-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0.08em;
}

.result-kicker::before {
  width: 22px;
  height: 3px;
  border-radius: 99px;
  background: var(--accent);
  content: "";
}

.result-hero h1 {
  max-width: 830px;
  margin: 18px 0 20px;
  color: var(--text-strong);
  font-size: clamp(32px, 4.2vw, 50px);
  letter-spacing: -0.055em;
  line-height: 1.25;
}

.result-summary {
  max-width: 850px;
  margin: 0;
  color: #30483d;
  font-size: clamp(16px, 1.8vw, 20px);
  line-height: 1.8;
}

.meal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.meal-meta span {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 1px solid rgba(21, 75, 59, 0.15);
  border-radius: var(--radius-pill);
  background: rgba(255, 253, 248, 0.64);
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 680;
}

.result-section {
  margin-top: 24px;
  padding: clamp(22px, 4vw, 36px);
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.section-head h2 {
  margin: 0;
  color: var(--text-strong);
  font-size: clamp(25px, 3vw, 34px);
  letter-spacing: -0.045em;
}

.section-head p {
  max-width: 580px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.section-index {
  color: #b2b8b3;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

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

.metric-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fbfaf5;
}

.metric-card.metric-wide {
  grid-column: 1 / -1;
}

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

.metric-name {
  display: flex;
  align-items: center;
  gap: 10px;
}

.metric-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 16px;
  font-weight: 800;
}

.metric-name h3 {
  margin: 0;
  color: var(--text-strong);
  font-size: 15px;
}

.metric-name small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 10px;
}

.level-badge {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
}

.level-badge.risk-level {
  background: var(--accent-soft);
  color: #924735;
}

.metric-bar {
  display: grid;
  height: 11px;
  margin-top: 16px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.metric-bar i {
  background: #dfe3dc;
}

.metric-bar i.is-filled {
  background: var(--primary);
}

.metric-bar.risk-bar i.is-filled {
  background: var(--accent);
}

.metric-detail {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 11px;
}

.metric-detail strong {
  color: var(--text);
  font-size: 12px;
}

.metric-source {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.data-warning {
  display: flex;
  align-items: start;
  gap: 8px;
  margin: 12px 0 0;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--gold-soft);
  color: #71531e;
  font-size: 10px;
}

.data-warning::before {
  content: "!";
  font-weight: 900;
}

.split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.split-panel {
  padding: 22px;
  border-radius: 20px;
  background: #f7f5ee;
}

.split-panel.sugar-panel {
  background: #faf0ec;
}

.split-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.split-panel h3 {
  margin: 0;
  color: var(--text-strong);
  font-size: 19px;
}

.big-number {
  margin-top: 16px;
  color: var(--text-strong);
  font-size: 38px;
  font-weight: 850;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.big-number small {
  margin-left: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.split-panel > p {
  margin: 11px 0 0;
  color: var(--muted-strong);
  font-size: 12px;
}

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

.risk-card {
  display: flex;
  min-height: 240px;
  flex-direction: column;
  padding: 20px;
  border: 1px solid #ead8d0;
  border-radius: 20px;
  background: #fff8f4;
}

.risk-card h3 {
  margin: 12px 0 6px;
  color: var(--text-strong);
  font-size: 17px;
}

.risk-card p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.risk-card .metric-bar {
  margin-top: auto;
}

.risk-action {
  margin-top: 12px !important;
  padding-top: 10px;
  border-top: 1px solid #eadfd9;
  color: #724f43 !important;
}

.group-wheel {
  display: grid;
  align-items: center;
  grid-template-columns: 220px 1fr;
  gap: 32px;
}

.group-score {
  position: relative;
  display: grid;
  width: 190px;
  height: 190px;
  place-items: center;
  margin: auto;
  border: 20px solid var(--primary-soft);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
  text-align: center;
}

.group-score::before {
  position: absolute;
  inset: -20px;
  border: 20px solid transparent;
  border-top-color: var(--primary);
  border-right-color: var(--primary);
  border-radius: 50%;
  content: "";
  transform: rotate(-45deg);
}

.group-score strong {
  position: relative;
  z-index: 2;
  color: var(--text-strong);
  font-size: 46px;
  line-height: 1;
}

.group-score span {
  position: relative;
  z-index: 2;
  color: var(--muted);
  font-size: 11px;
}

.group-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.group-item {
  display: flex;
  min-height: 56px;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #faf9f4;
}

.group-item > span {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: #e7e6df;
  color: #858d88;
  font-size: 12px;
  font-weight: 800;
}

.group-item.is-covered > span {
  background: var(--primary);
  color: white;
}

.group-item strong {
  display: block;
  color: var(--text-strong);
  font-size: 12px;
}

.group-item small {
  color: var(--muted);
  font-size: 10px;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.insight-column {
  padding: 20px;
  border-radius: 20px;
  background: #f5f6ef;
}

.insight-column.improve {
  background: #faf0ec;
}

.insight-column.recommend {
  background: #f7edcf;
}

.insight-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 14px;
  color: var(--text-strong);
  font-size: 16px;
}

.insight-title span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  font-size: 13px;
}

.insight-list {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.insight-list li {
  position: relative;
  padding: 11px 11px 11px 28px;
  border: 1px solid rgba(120, 125, 117, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--muted-strong);
  font-size: 11px;
  line-height: 1.65;
}

.insight-list li::before {
  position: absolute;
  top: 12px;
  left: 10px;
  color: var(--primary);
  font-weight: 900;
  content: "•";
}

.insight-column.recommend .insight-list li::before {
  color: var(--warning);
  content: "→";
}

.combination-notes {
  display: grid;
  margin-top: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fbfaf5;
  grid-template-columns: 150px 1fr;
  gap: 18px;
}

.combination-notes > div strong {
  display: block;
  margin-top: 4px;
  color: var(--text-strong);
  font-size: 14px;
}

.combination-notes ul {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.combination-notes li {
  display: grid;
  align-items: start;
  grid-template-columns: 40px 1fr;
  gap: 9px;
}

.combination-notes li > span {
  display: inline-grid;
  min-height: 24px;
  place-items: center;
  border-radius: 7px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 9px;
  font-weight: 800;
}

.combination-notes li p {
  margin: 1px 0 0;
  color: var(--muted-strong);
  font-size: 10px;
  line-height: 1.65;
}

.prediction {
  display: block;
  margin-top: 5px;
  color: #8a6321;
  font-size: 9px;
  font-weight: 750;
}

.food-table-wrap {
  overflow-x: auto;
}

.food-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.food-table th {
  padding: 11px 10px;
  border-bottom: 1px solid var(--border-strong);
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-align: left;
}

.food-table td {
  padding: 14px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--muted-strong);
  vertical-align: top;
}

.food-table tr:last-child td {
  border-bottom: 0;
}

.table-food {
  display: flex;
  min-width: 130px;
  align-items: center;
  gap: 9px;
}

.table-food .food-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 19px;
}

.table-food button {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--text-strong);
  font-weight: 760;
  text-align: left;
}

.confidence-pill {
  display: inline-block;
  min-width: 42px;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  background: var(--gold-soft);
  color: #755721;
  font-size: 10px;
  font-weight: 760;
  text-align: center;
}

.confidence-pill.high {
  background: var(--primary-soft);
  color: var(--primary);
}

.confidence-pill.low {
  background: var(--accent-soft);
  color: #8a4434;
}

.food-feature-cards {
  display: none;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 26px;
}

.result-actions .primary-button,
.result-actions .secondary-button {
  min-width: 190px;
}

.result-disclaimer {
  max-width: 760px;
  margin: 22px auto 0;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

/* Dialogs */
.modal {
  width: min(calc(100% - 32px), 820px);
  max-height: min(90vh, 900px);
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 26px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  color: var(--text);
}

.modal::backdrop {
  background: rgba(13, 32, 26, 0.54);
  backdrop-filter: blur(4px);
}

.modal[open] {
  animation: dialog-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-card {
  position: relative;
  max-height: min(90vh, 900px);
  overflow-y: auto;
  padding: clamp(24px, 5vw, 46px);
}

.modal-close {
  position: absolute;
  z-index: 4;
  top: 16px;
  right: 16px;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: rgba(255, 253, 248, 0.88);
  cursor: pointer;
  color: var(--muted);
  font-size: 25px;
}

.modal-close:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.food-detail-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-right: 48px;
}

.food-detail-head .food-icon {
  width: 70px;
  height: 70px;
  border-radius: 20px;
  font-size: 38px;
}

.food-detail-head h2 {
  margin: 0;
  color: var(--text-strong);
  font-size: 31px;
  letter-spacing: -0.04em;
}

.food-detail-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.detail-description {
  margin: 20px 0;
  padding: 14px 16px;
  border-left: 4px solid var(--accent);
  border-radius: 0 12px 12px 0;
  background: #faf5eb;
  color: var(--muted-strong);
  font-size: 13px;
}

.detail-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.detail-box {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fbfaf5;
}

.detail-box.attention {
  background: #fff7f3;
}

.detail-box h3,
.nutrition-estimate h3,
.estimate-box h3,
.source-box h3 {
  margin: 0 0 10px;
  color: var(--text-strong);
  font-size: 14px;
}

.detail-box ul {
  padding-left: 18px;
  margin: 0;
  color: var(--muted-strong);
  font-size: 12px;
}

.nutrition-estimate,
.estimate-box,
.source-box {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
}

.nutrition-mini-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.nutrition-mini-grid div {
  padding: 10px;
  border-radius: 10px;
  background: var(--bg);
  text-align: center;
}

.nutrition-mini-grid strong {
  display: block;
  color: var(--text-strong);
  font-size: 14px;
}

.nutrition-mini-grid small {
  color: var(--muted);
  font-size: 9px;
}

.estimate-box p,
.source-box p {
  margin: 5px 0;
  color: var(--muted-strong);
  font-size: 11px;
}

.detail-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.method-modal {
  width: min(calc(100% - 32px), 940px);
}

.method-modal h2 {
  max-width: 700px;
  margin: 0;
  color: var(--text-strong);
  font-size: clamp(30px, 5vw, 48px);
  letter-spacing: -0.055em;
}

.modal-intro {
  max-width: 720px;
  margin: 14px 0 24px;
  color: var(--muted-strong);
}

.method-flow {
  display: grid;
  align-items: center;
  padding: 18px;
  border-radius: 18px;
  background: var(--surface-soft);
  grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
  gap: 8px;
}

.method-flow div {
  min-width: 0;
  text-align: center;
}

.method-flow div > span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  margin: 0 auto 5px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 11px;
  font-weight: 800;
}

.method-flow strong,
.method-flow small {
  display: block;
}

.method-flow strong {
  color: var(--text-strong);
  font-size: 12px;
}

.method-flow small {
  color: var(--muted);
  font-size: 9px;
}

.method-flow > b {
  color: var(--accent);
}

.method-grid {
  display: grid;
  margin-top: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.method-grid article {
  position: relative;
  min-height: 150px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 17px;
  background: #fbfaf5;
}

.method-number {
  color: var(--accent);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.1em;
}

.method-grid h3 {
  margin: 10px 0 5px;
  color: var(--text-strong);
  font-size: 15px;
}

.method-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.threshold-card {
  display: grid;
  align-items: center;
  margin-top: 14px;
  padding: 18px;
  border-radius: 18px;
  background: #f6ebd0;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 20px;
}

.threshold-card h3 {
  margin: 0;
  color: var(--text-strong);
  font-size: 15px;
}

.threshold-card p {
  margin: 4px 0 0;
  color: var(--muted-strong);
  font-size: 10px;
}

.level-legend {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.level-legend span {
  display: grid;
  place-items: center;
  gap: 4px;
  color: var(--muted-strong);
  font-size: 9px;
}

.level-legend i {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-style: normal;
  font-weight: 800;
}

.source-note {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
}

.source-note strong {
  color: var(--text-strong);
  font-size: 13px;
}

.source-note p,
.disclaimer {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.disclaimer {
  text-align: center;
}

.tray-drawer {
  width: min(100% - 12px, 620px);
  max-height: 88vh;
  margin: auto auto 6px;
  border-radius: 26px 26px 18px 18px;
}

.drawer-card {
  padding: 10px 14px max(18px, env(safe-area-inset-bottom));
}

.drawer-handle {
  width: 44px;
  height: 4px;
  margin: 0 auto 12px;
  border-radius: 99px;
  background: #c8c9c4;
}

.drawer-head {
  position: relative;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  padding: 5px 8px 10px;
}

.static-close {
  position: static;
  flex: 0 0 auto;
}

.tray-drawer .tray-list {
  max-height: 52vh;
}

.tray-drawer .generate-button {
  margin-top: 8px;
}

.toast-region {
  position: fixed;
  z-index: 300;
  right: 20px;
  bottom: 20px;
  display: grid;
  max-width: min(380px, calc(100% - 40px));
  gap: 8px;
}

.toast {
  display: flex;
  align-items: start;
  gap: 9px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 13px;
  background: var(--text-strong);
  box-shadow: var(--shadow-md);
  color: white;
  font-size: 12px;
  animation: toast-in 220ms ease both;
}

.toast::before {
  color: #efb042;
  font-weight: 900;
  content: "●";
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
}

.noscript-message {
  position: fixed;
  z-index: 400;
  inset: auto 20px 20px;
  padding: 14px;
  border-radius: 12px;
  background: var(--danger);
  color: white;
  text-align: center;
}

@media (min-width: 900px) {
  .stepper {
    display: flex;
  }
}

@media (max-width: 1060px) {
  .hero-shell {
    grid-template-columns: 1fr 420px;
    gap: 40px;
  }

  .hero-copy h1 {
    font-size: clamp(52px, 6.4vw, 70px);
  }

  .selection-layout {
    grid-template-columns: minmax(0, 1fr) 320px;
  }

  .food-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .insight-grid {
    grid-template-columns: 1fr;
  }

  .combination-notes {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  :root {
    --header-height: 70px;
  }

  .site-header {
    min-height: var(--header-height);
    padding: 10px 18px;
  }

  .brand {
    font-size: 17px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
  }

  .header-actions {
    gap: 12px;
  }

  .method-trigger {
    font-size: 13px;
  }

  .home-view {
    display: block;
    padding: 30px 20px 24px;
  }

  .hero-shell {
    grid-template-columns: 1fr;
    gap: 34px;
  }

  .hero-copy {
    text-align: left;
  }

  .hero-visual {
    width: min(100%, 590px);
    margin-inline: auto;
  }

  .home-footnote {
    flex-wrap: wrap;
  }

  .selection-layout {
    display: block;
  }

  .tray-panel {
    display: none;
  }

  .select-view {
    padding-bottom: 132px;
  }

  .search-panel {
    top: var(--header-height);
  }

  .mobile-tray-bar {
    position: fixed;
    z-index: 45;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 10px;
    display: grid;
    align-items: center;
    padding: 8px;
    border: 1px solid rgba(21, 75, 59, 0.18);
    border-radius: 18px;
    background: rgba(255, 253, 248, 0.97);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(14px);
    grid-template-columns: 1fr auto;
    gap: 8px;
  }

  .mobile-tray-bar > button:first-child {
    display: flex;
    min-width: 0;
    min-height: 54px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 12px;
    border: 0;
    background: transparent;
    cursor: pointer;
    text-align: left;
  }

  .mobile-tray-bar strong,
  .mobile-tray-bar small {
    display: block;
  }

  .mobile-tray-bar strong {
    color: var(--text-strong);
    font-size: 13px;
  }

  .mobile-tray-bar small {
    color: var(--muted);
    font-size: 9px;
  }

  .mobile-tray-bar .primary-button {
    min-height: 50px;
    padding-inline: 17px;
    font-size: 12px;
  }

  .risk-grid {
    grid-template-columns: 1fr;
  }

  .risk-card {
    min-height: 205px;
  }
}

@media (max-width: 700px) {
  .page-width {
    width: min(calc(100% - 28px), var(--page));
  }

  .header-actions .stepper {
    display: none;
  }

  .home-view {
    padding-inline: 16px;
  }

  .hero-copy h1 {
    font-size: clamp(45px, 13vw, 64px);
    line-height: 1.12;
  }

  .hero-lead {
    margin-top: 22px;
    font-size: 17px;
  }

  .hero-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-actions > button {
    width: 100%;
  }

  .trust-row {
    gap: 7px;
    margin-top: 32px;
  }

  .trust-row > div {
    padding: 2px 6px;
    border: 0;
    grid-template-columns: 1fr;
    text-align: center;
  }

  .trust-icon {
    width: 36px;
    height: 36px;
    margin: 0 auto 6px;
    grid-row: auto;
  }

  .hero-visual {
    padding: 18px 20px 22px;
    border-radius: 24px;
  }

  .plate-wrap {
    width: min(85%, 330px);
  }

  .home-footnote .inline-link {
    width: 100%;
    margin-left: 24px;
    text-align: left;
  }

  .select-view {
    padding-top: 24px;
  }

  .select-heading {
    align-items: start;
  }

  .select-heading h1 {
    font-size: 43px;
  }

  .selection-count-badge {
    width: 72px;
    height: 72px;
  }

  .selection-count-badge span {
    font-size: 24px;
  }

  .search-panel {
    margin-inline: -4px;
    padding: 13px;
    border-radius: 20px;
  }

  .browser-meta {
    align-items: start;
    flex-direction: column;
    gap: 0;
  }

  .food-card {
    min-height: 220px;
    padding: 14px;
  }

  .metric-grid,
  .split-grid {
    grid-template-columns: 1fr;
  }

  .metric-card.metric-wide {
    grid-column: auto;
  }

  .group-wheel {
    grid-template-columns: 1fr;
  }

  .group-list {
    grid-template-columns: 1fr;
  }

  .food-table-wrap {
    display: none;
  }

  .food-feature-cards {
    display: grid;
    gap: 10px;
  }

  .feature-card {
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: #fbfaf5;
  }

  .feature-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .feature-card-head .food-icon {
    width: 38px;
    height: 38px;
    font-size: 21px;
  }

  .feature-card-head strong {
    color: var(--text-strong);
    font-size: 13px;
  }

  .feature-card-head small {
    display: block;
    color: var(--muted);
    font-size: 9px;
  }

  .feature-card dl {
    display: grid;
    margin: 12px 0 0;
    grid-template-columns: 86px 1fr;
    gap: 7px 10px;
    font-size: 10px;
  }

  .feature-card dt {
    color: var(--muted);
  }

  .feature-card dd {
    margin: 0;
    color: var(--muted-strong);
  }

  .method-flow {
    grid-template-columns: 1fr 1fr;
  }

  .method-flow > b {
    display: none;
  }

  .method-grid {
    grid-template-columns: 1fr;
  }

  .threshold-card {
    grid-template-columns: 1fr;
  }

  .detail-two-col {
    grid-template-columns: 1fr;
  }

  .nutrition-mini-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 460px) {
  .site-header {
    padding-inline: 12px;
  }

  .brand {
    gap: 8px;
    font-size: 15px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }

  .method-trigger {
    font-size: 12px;
  }

  .hero-copy h1 {
    font-size: clamp(39px, 12.5vw, 54px);
  }

  .hero-lead {
    font-size: 16px;
  }

  .trust-row strong {
    font-size: 12px;
  }

  .trust-row small {
    font-size: 9px;
  }

  .hero-visual {
    margin-inline: -3px;
  }

  .preview-bars > div {
    grid-template-columns: 60px 1fr 32px;
  }

  .home-footnote {
    font-size: 11px;
  }

  .select-heading > div > p:last-child {
    font-size: 14px;
  }

  .selection-count-badge {
    display: none;
  }

  .food-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .food-card {
    min-height: 222px;
    padding: 12px;
    border-radius: 16px;
  }

  .food-icon {
    width: 44px;
    height: 44px;
    font-size: 24px;
  }

  .food-card h3 {
    font-size: 15px;
  }

  .food-card-actions {
    grid-template-columns: 1fr;
  }

  .add-food {
    width: 100%;
  }

  .mobile-tray-bar {
    right: 6px;
    left: 6px;
  }

  .mobile-tray-bar .primary-button {
    padding-inline: 13px;
  }

  .result-section {
    padding: 18px 14px;
    border-radius: 20px;
  }

  .result-hero {
    padding: 25px 20px;
    border-radius: 23px;
  }

  .section-head {
    align-items: start;
    flex-direction: column-reverse;
    gap: 4px;
  }

  .metric-card {
    padding: 14px;
  }

  .metric-detail {
    flex-direction: column;
    gap: 4px;
  }

  .result-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .result-actions button {
    width: 100%;
  }

  .modal {
    width: calc(100% - 12px);
    max-height: 94vh;
    border-radius: 22px;
  }

  .modal-card {
    max-height: 94vh;
    padding: 24px 16px;
  }

  .food-detail-head h2 {
    font-size: 25px;
  }

  .food-detail-head .food-icon {
    width: 58px;
    height: 58px;
    font-size: 31px;
  }
}

@media (max-width: 350px) {
  .food-grid {
    grid-template-columns: 1fr;
  }

  .food-card {
    min-height: 190px;
  }

  .trust-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .trust-row > div {
    grid-template-columns: 36px 1fr;
    text-align: left;
  }

  .trust-icon {
    margin: 0;
    grid-row: 1 / 3;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
