/* Every mode uses the same compact row, populated with relevant controls. */
.result-card { position: relative; margin-bottom: 8px; }
.portion-tabs { padding-bottom: 4px; }
.portion-tabs button { padding-top: 10px; padding-bottom: 10px; }
.total-calories { margin: 2px 0 9px; }
.macro-summary { padding-bottom: 10px; }
.macro-number { margin-top: 3px; }
.ingredients-button { height: 42px; margin-bottom: 8px; }
.portion-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  height: 54px;
  padding: 0 0 5px;
  margin: 0;
}
.portion-fields label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 0;
  font-size: 10px;
  line-height: 1.3;
  color: #777;
}
.portion-fields label > span:first-child { white-space: nowrap; }
.portion-fields input { width: 62px; height: 30px; font-size: 14px; text-align: center; }
.portion-fields .inline-field { position: relative; justify-content: center; width: 104px; height: 30px; }
.portion-fields .inline-field > span { position: absolute; left: calc(50% + 36px); }
.portion-servings { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dish-weight-field { min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 10px; color: #777; }
.dish-weight-field > span { white-space: nowrap; line-height: 1.3; }
.dish-weight-field .weight-value { position: relative; justify-content: center; width: 104px; min-height: 30px; padding: 0; font-size: 13px; }
.dish-weight-field .weight-value .icon { position: absolute; right: 0; }
.dish-weight-field #weight-form { position: relative; display: flex; align-items: center; justify-content: center; width: 104px; height: 30px; }
.dish-weight-field #weight-form input { width: 62px; }
.dish-weight-field #weight-form > span { position: absolute; left: calc(50% + 36px); }
.dish-weight-field #weight-form .icon-button { position: absolute; right: -23px; width: 25px; min-height: 30px; padding: 4px; }
.dish-weight-field #weight-form .icon { width: 15px; height: 15px; }
.portion-fields[data-mode="all"] .dish-weight-field { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; gap: 10px; min-height: 44px; }
.portion-fields[data-mode="all"] .dish-weight-field > span { font-size: 11px; }
.portion-fields[data-mode="all"] .weight-value { font-size: 14px; }
.result-card #portion-error { position: absolute; left: 12px; right: 12px; bottom: 6px; margin: 0; padding: 8px 10px; border-radius: 10px; background: #fff4e8; box-shadow: 0 0 0 1px #e3d7c7; z-index: 2; }

/* Browser-native inertia and snapping; sliders own their vertical gestures. */
.ingredient-carousel {
  position: relative;
  display: flex;
  gap: 8px;
  padding: 0 9px;
  margin: 0;
  height: 308px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 9px;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  user-select: none;
  cursor: grab;
}
.ingredient-carousel::-webkit-scrollbar { display: none; }
.ingredient-carousel.is-dragging { scroll-snap-type: none; cursor: grabbing; }
.ingredient-carousel > .ingredient-card {
  flex: 0 0 100%;
  min-width: 0;
  height: 308px;
  min-height: 0;
  margin: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
.ingredient-carousel .ingredient-heading { min-height: 42px; height: 42px; margin-bottom: 4px; }
.ingredient-carousel .ingredient-heading strong { max-height: 42px; overflow: hidden; }
.ingredient-carousel .ingredient-calories { position: absolute; left: 10px; right: 10px; bottom: 10px; margin: 0; }
.ingredient-carousel .fader { gap: 3px; }
.fader-heading { font-size: 10px; min-height: 14px; white-space: nowrap; }
.ingredient-carousel .macro-dial { margin-top: -20px; }
/* Keep the rectangular macro table clear of the circular inner edge. */
.ingredient-carousel .dial-center { inset: 23%; padding: 0; gap: 3px; }
.ingredient-carousel .dial-line { font-size: 9px; gap: 3px; grid-template-columns: 6px minmax(0, 1fr) auto 6px; }
.ingredient-carousel .dial-line b { font-size: 11px; }
.ingredient-carousel .dial-line small { font-size: 9px; }
.native-fader { position: relative; width: 44px; height: 128px; flex-shrink: 0; touch-action: pan-x pan-y; cursor: pointer; border-radius: 8px; }
.native-fader:focus-visible { outline: 2px solid var(--range-color); outline-offset: 1px; }
.fader-rail { position: absolute; top: 14px; bottom: 14px; left: 20px; width: 4px; background: #dedde0; border-radius: 4px; pointer-events: none; }
.fader-fill { position: absolute; inset: auto 0 0; height: var(--fill); border-radius: inherit; background: var(--range-color); }
.fader-thumb { position: absolute; left: 50%; width: 28px; height: 28px; transform: translate(-50%, -50%); border-radius: 50%; background: #fff; border: .5px solid #d1d1d4; box-shadow: 0 2px 4px #0003; pointer-events: none; }
.fader-grab { position: absolute; left: 0; width: 44px; height: 44px; touch-action: none; cursor: ns-resize; }
.ingredient-carousel .macro-editor {
  position: absolute;
  inset: 74px 12px 55px;
  margin: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #fffefbf5;
  border: 1px solid #deddd9;
  box-shadow: 0 4px 15px #292a2b12;
  z-index: 3;
}
.ingredient-carousel .macro-fields { margin-top: 7px; }
.ingredient-carousel input { user-select: text; cursor: auto; }
.ingredient-carousel .dial-handle { touch-action: none; }
.ingredient-carousel .dial-handle { width: 44px; height: 44px; padding: 11px; z-index: 2; }
.ingredient-carousel .dial-handle::after { width: 22px; height: 22px; }
.dial-leaders { position: absolute; inset: 0; width: 100%; height: 100%; fill: none; stroke: #888; stroke-width: .5px; pointer-events: none; z-index: 1; }
.ingredient-carousel > .add-ingredient-card { padding: 0; }
.add-ingredient-card > button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 15px; width: 100%; height: 100%; background: #fffdfa; font-size: 17px; color: var(--blue); border-radius: inherit; }
.add-ingredient-card > button { touch-action: pan-x pan-y; }
.add-ingredient-icon { display: grid; place-items: center; width: 52px; height: 52px; background: #334f9c0e; border-radius: 18px; }
.add-ingredient-icon .icon { width: 26px; height: 26px; }
.page-dots { max-width: calc(100% - 56px); overflow-x: auto; scrollbar-width: none; }
.page-dots::-webkit-scrollbar { display: none; }
.page-dots button { flex-shrink: 0; }
.page-dots button.add-dot[aria-pressed="true"]::after { width: 14px; height: 14px; border-radius: 50%; background: var(--blue); color: #fff; font-size: 12px; line-height: 14px; }
@media (max-width: 390px) {
  .portion-fields, .portion-servings { gap: 8px; }
  .portion-fields label, .dish-weight-field { font-size: 9px; }
  .dish-weight-field .weight-value { font-size: 11px; }
}
