:root {
  --bg-gradient: linear-gradient(135deg, #f7f4ff 0%, #eef9ff 100%);
  --bg-parallax-offset: 0px;
  --card-bg: rgba(255, 255, 255, 0.92);
  --border: rgba(255, 255, 255, 0.6);
  --shadow: 0 20px 45px -24px rgba(16, 24, 40, 0.3);
  --primary: #f97316;
  --primary-dark: #ea580c;
  --text-muted: #5f6b7d;
  --pill-green-bg: #dcfce7;
  --pill-green-text: #166534;
  --pill-yellow-bg: #fef3c7;
  --pill-yellow-text: #a16207;
  --pill-red-bg: #fee2e2;
  --pill-red-text: #b91c1c;
  --slider-green: #16a34a;
  --slider-yellow: #facc15;
  --slider-red: #ef4444;
  --slider-green-muted: rgba(22, 163, 74, 0.22);
  --slider-yellow-muted: rgba(250, 204, 21, 0.22);
  --slider-red-muted: rgba(239, 68, 68, 0.22);
  --slider-neutral: rgba(15, 23, 42, 0.22);
  font-family: "Inter", "SF Pro Display", "Segoe UI", system-ui, sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  background: #eef4ff;
  color: #0f172a;
  position: relative;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
}

body::before {
  background: var(--bg-gradient);
  z-index: -2;
}

body::after {
  background-image: url("bg.jpg");
  background-repeat: repeat-y;
  background-size: cover;
  background-position: center var(--bg-parallax-offset, 0px);
  mix-blend-mode: multiply;
  opacity: 0.9;
  z-index: -1;
}
.page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 20px 64px;
}
header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 28px;
}
header .header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
header h1 {
  font-size: clamp(2rem, 3vw, 2.6rem);
  margin: 0;
  font-weight: 700;
}
header p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.55;
}
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  padding: clamp(18px, 2vw, 24px);
}
.form-card {
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.section-title {
  margin: 0 0 12px;
  font-size: 1.1rem;
  font-weight: 600;
}
.grid-two {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
label span.label {
  display: block;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
  color: var(--text-muted);
  font-weight: 600;
}
.language-switcher {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.language-switcher label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
}
.language-switcher-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
select,
input[type="number"] {
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  padding: 10px 12px;
  font-size: 0.95rem;
  background: white;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.language-switcher select {
  width: auto;
  min-width: 150px;
}
select:focus,
input[type="number"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.18);
}
.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  color: #1f2937;
  background: rgba(15, 23, 42, 0.06);
  cursor: pointer;
  border: none;
  transition: transform 0.12s ease, background 0.12s ease;
}
.chip input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.chip[data-color="green"] {
  color: var(--pill-green-text);
}
.chip[data-color="yellow"] {
  color: var(--pill-yellow-text);
}
.chip[data-color="red"] {
  color: var(--pill-red-text);
}
.chip[data-selected="true"] span,
.chip input:checked + span {
  background: rgba(15, 23, 42, 0.9);
  color: #fff;
}
.chip span {
  padding: 6px 12px;
  border-radius: inherit;
  transition: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip:hover span {
  transform: translateY(-1px);
}
.chip[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}
.chip[disabled] span {
  pointer-events: none;
}
.attributes-layout {
  display: flex;
  gap: 24px;
  align-items: stretch;
}

.attributes-column,
.ingredients-column {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.ingredients-column {
  position: relative;
}

.column-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-direction: column;
}

.ingredients-header {
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
}

.ingredients-header-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.ingredients-header-top .section-title {
  margin-bottom: 0;
}

.ingredients-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ingredients-actions > * {
  flex-shrink: 0;
}

.ingredients-header-bottom {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}

.mobile-selection-heading {
  display: none;
  align-items: center;
  gap: 14px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--text-muted);
}

.mobile-selection-title {
  font-size: inherit;
}

.mobile-selection-options {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.mobile-selection-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mobile-selection-option::before {
  content: "";
  display: inline-flex;
  width: 16px;
  height: 16px;
  border-radius: 5px;
  border: 2px solid rgba(15, 23, 42, 0.35);
  background: #fff;
}

.mobile-selection-option--include::before {
  background: var(--primary);
  border-color: var(--primary);
}

.mobile-selection-option--optional::before {
  border-style: dashed;
}

.ingredients-header .optional-toggle {
  margin-left: 0;
}

.column-header .section-title {
  margin-bottom: 0;
}

.btn-make-green {
  height: 50px;
  max-width: 170px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 12px 30px -18px rgba(34, 197, 94, 0.8);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.btn-make-green:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 32px -18px rgba(22, 163, 74, 0.9);
}

.btn-make-green:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.35);
}

.btn-make-green-icon {
  font-size: 1.1rem;
}

.attr-list {
  flex: 1;
  overflow: auto;
  padding-right: 4px;
}
.attr-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.attr-card {
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 18px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: rgba(255, 255, 255, 0.92);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.attr-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 34px -26px rgba(15, 23, 42, 0.45);
}
.attr-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.attr-card-header h4 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}
.chip.chip-clear {
  background: transparent;
  border: 1px dashed rgba(15, 23, 42, 0.2);
  color: var(--text-muted);
}
.chip.chip-clear span {
  padding: 4px 12px;
}
.chip.chip-clear:hover span {
  transform: none;
}
.attr-card-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: stretch;
}
.chips-colors {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
}

.chips-colors .chip {
  display: flex;
  align-items: stretch;
  width: 100%;
}

.chips-colors .chip span {
  justify-content: center;
  width: 100%;
}
.attr-controls {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
  min-width: 0;
  transition: opacity 0.2s ease;
}
.attr-controls.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}
.mode-toggle {
  display: inline-flex;
  justify-content: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  width: 100%;
}
.mode-btn {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.96);
  font-size: 1.2rem;
  font-weight: 700;
  color: #1f2937;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease,
    box-shadow 0.15s ease;
}
.mode-btn:hover {
  transform: translateY(-1px);
}
.mode-btn[aria-pressed='true'] {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 14px 30px -20px rgba(249, 115, 22, 0.65);
}
.mode-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}
.slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  order: -1;
}
.slider-range {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  padding: 10px 0;
}
.range-slider {
  --slider-range-start: 0%;
  --slider-range-end: 50%;
  position: relative;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background:
    linear-gradient(
      90deg,
      rgba(15, 23, 42, 0.12) 0%,
      rgba(15, 23, 42, 0.12) var(--slider-range-start, 0%),
      rgba(255, 255, 255, 0) var(--slider-range-start, 0%),
      rgba(255, 255, 255, 0) var(--slider-range-end, 100%),
      rgba(15, 23, 42, 0.12) var(--slider-range-end, 100%),
      rgba(15, 23, 42, 0.12) 100%
    ),
    var(--slider-track, linear-gradient(90deg, var(--slider-neutral) 0%, var(--slider-neutral) 100%));
  background-repeat: no-repeat;
  background-size: 100% 100%;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.12);
  cursor: pointer;
  touch-action: none;
}

.range-slider--disabled {
  cursor: not-allowed;
}

.range-slider[data-active-color-band] {
  cursor: default;
}

.range-slider-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--primary);
  box-shadow: 0 6px 16px -10px rgba(249, 115, 22, 0.8);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
  touch-action: none;
}

.range-slider-thumb:active {
  transform: translate(-50%, -50%) scale(1.05);
  box-shadow: 0 10px 20px -12px rgba(249, 115, 22, 0.75);
}

.range-slider-thumb:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.25);
}

.range-slider-thumb[disabled],
.range-slider--disabled .range-slider-thumb {
  cursor: not-allowed;
  border-color: rgba(148, 163, 184, 0.6);
  box-shadow: none;
}

.range-slider-thumb[aria-hidden='true'] {
  display: none;
}

.range-slider[data-active-color-band] .range-slider-thumb {
  opacity: 0;
  pointer-events: none;
  border-color: transparent;
  box-shadow: none;
}

.range-slider-thumb[data-active-color-band='green'] {
  border-color: var(--slider-green);
  box-shadow: 0 6px 16px -10px rgba(22, 163, 74, 0.65);
}

.range-slider-thumb[data-active-color-band='yellow'] {
  border-color: var(--slider-yellow);
  box-shadow: 0 6px 16px -10px rgba(250, 204, 21, 0.65);
}

.range-slider-thumb[data-active-color-band='red'] {
  border-color: var(--slider-red);
  box-shadow: 0 6px 16px -10px rgba(239, 68, 68, 0.65);
}
.slider-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
}
.slider-value {
  position: relative;
}
.slider-value-range {
  display: flex;
  gap: 12px;
}
.slider-value-single {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.slider-range-value {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.slider-value-single[hidden],
.slider-value-range[hidden] {
  display: none;
}
.icon-btn {
  border: none;
  background: rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  padding: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
  color: inherit;
}
.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
.icon-btn:hover {
  background: rgba(15, 23, 42, 0.12);
  transform: translateY(-1px);
}
.icon-btn:active {
  transform: translateY(0);
}
.icon-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.slider-value {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-width: 78px;
  background: rgba(15, 23, 42, 0.05);
  padding: 6px 12px;
  border-radius: 12px;
  margin-left: auto;
}
.slider-meta .mode-toggle {
  flex: 1 1 auto;
  min-width: 0;
}
.slider-meta .slider-value {
  flex: 0 0 auto;
}
.slider-value-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.slider-value-number {
  font-size: 1.25rem;
  font-weight: 700;
}
.ingredients-column {
  align-self: stretch;
}

.ingredients-column .section-title {
  font-size: 1rem;
}

.ingredients-column .table-wrapper {
  flex: 1;
  overflow-y: auto;
  max-height: none;
  padding-right: 4px;
}
.ingredients-table--compact th,
.ingredients-table--compact td {
  font-size: 0.8rem;
  padding: 8px 10px;
}
.ingredients-table--compact th.col-selection,
.ingredients-table--compact td.ingredient-selection-cell {
  min-width: 220px;
}
.ingredients-legend {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  max-width: 34ch;
}
.hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 4px 0 0;
}
.btn-primary {
  align-self: flex-start;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn-primary:hover {
  transform: translateY(-1px);
  background: var(--primary-dark);
  box-shadow: 0 14px 30px -20px rgba(234, 88, 12, 0.65);
}
.btn-primary:disabled {
  background: rgba(15, 23, 42, 0.18);
  color: rgba(15, 23, 42, 0.5);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}
.btn-primary:disabled:hover {
  background: rgba(15, 23, 42, 0.18);
}
.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.checkbox-inline input {
  width: 18px;
  height: 18px;
}

.debug-content {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.debug-panel h3 {
  margin-top: 0;
}
.btn-secondary {
  background: rgba(249, 115, 22, 0.1);
  color: var(--primary);
  border: 1px solid rgba(249, 115, 22, 0.35);
  border-radius: 12px;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn-secondary:hover {
  background: rgba(249, 115, 22, 0.18);
  border-color: rgba(249, 115, 22, 0.6);
}
.btn-secondary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.25);
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 0.5em;
}
.section-header .section-title {
  margin-bottom: 0;
}
.table-wrapper {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.9);
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 23, 42, 0.2) transparent;
}

.table-wrapper::-webkit-scrollbar {
  height: 8px;
}

.table-wrapper::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.25);
  border-radius: 999px;
}

.table-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.ingredients-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 12px;
}
.ingredients-table th,
.ingredients-table td {
  padding: 10px 12px;
  text-align: left;
  font-size: 0.92rem;
}
.ingredients-table th.col-selection {
  min-width: 240px;
}
.ingredients-table td.ingredient-selection-cell {
  padding-right: 18px;
}
.ingredient-selection {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: nowrap;
  width: 100%;
  justify-content: flex-start;
}
.ingredient-selection-checkboxes {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.ingredient-selection .ingredient-name {
  flex: 1 1 auto;
  min-width: 0;
}
.ingredients-table thead {
  background: rgba(15, 23, 42, 0.85);
  color: #fff;
}
.ingredients-table tbody tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.03);
}

.ingredients-table tbody[data-category-header] {
  background: rgba(15, 23, 42, 0.06);
}

.ingredients-table tbody[data-category-header] td {
  padding: 0;
}

.ingredients-table tbody[data-ingredient-category] {
  transition: height 0.2s ease;
}

.ingredients-table tbody[data-ingredient-category][hidden] {
  display: none;
}

.ingredients-table tbody[data-ingredient-category] tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.03);
}

.ingredients-table tbody[data-ingredient-category] tr:nth-child(odd) {
  background: transparent;
}

.category-toggle {
  width: 100%;
  border: none;
  background: none;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font: inherit;
  font-weight: 600;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.category-toggle:hover {
  background: rgba(15, 23, 42, 0.08);
}

.category-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.category-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.12);
  color: rgba(15, 23, 42, 0.7);
  font-size: 0.7rem;
  transition: transform 0.2s ease;
}

.category-toggle-icon::before {
  content: '\25BC';
}

.category-toggle[aria-expanded="false"] .category-toggle-icon {
  transform: rotate(-90deg);
}

.category-toggle-label {
  flex: 1;
}

.category-toggle-count {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ingredient-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
}
.ingredient-option input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
}
.ingredient-option input:not(:disabled) {
  cursor: pointer;
}
.ingredient-option input:disabled {
  cursor: not-allowed;
}
.checkbox-visual {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 2px solid rgba(15, 23, 42, 0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  color: transparent;
}
.ingredient-option input:focus-visible + .checkbox-visual {
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.25);
}
.ingredient-option input:checked + .checkbox-visual {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.ingredient-option input:checked + .checkbox-visual::after {
  content: '✓';
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}
.ingredient-option input:disabled + .checkbox-visual {
  background: rgba(15, 23, 42, 0.12);
  border-color: rgba(15, 23, 42, 0.16);
  color: rgba(15, 23, 42, 0.45);
}

.ingredient-optional {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 22px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(15, 23, 42, 0.75);
}

.ingredient-optional input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
}

.ingredient-optional input:not(:disabled) {
  cursor: pointer;
}

.ingredient-optional input:disabled {
  cursor: not-allowed;
}

.ingredient-optional .checkbox-visual {
  width: 18px;
  height: 18px;
  border-radius: 6px;
}

.ingredient-optional input:focus-visible + .checkbox-visual {
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.25);
}

.ingredient-optional input:checked + .checkbox-visual {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.ingredient-optional input:checked + .checkbox-visual::after {
  content: '✓';
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}

.ingredient-optional input:disabled + .checkbox-visual {
  background: rgba(15, 23, 42, 0.12);
  border-color: rgba(15, 23, 42, 0.16);
  color: rgba(15, 23, 42, 0.45);
}

.ingredient-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.ingredient-badge {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}
.badge-required {
  background: rgba(15, 23, 42, 0.8);
  color: #fff;
}
.ingredient-locked td {
  color: rgba(15, 23, 42, 0.85);
}
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
}
.pill.green {
  background: var(--pill-green-bg);
  color: var(--pill-green-text);
}
.pill.yellow {
  background: var(--pill-yellow-bg);
  color: var(--pill-yellow-text);
}
.pill.red {
  background: var(--pill-red-bg);
  color: var(--pill-red-text);
}
.pill.n-a {
  background: rgba(15, 23, 42, 0.12);
  color: rgba(15, 23, 42, 0.7);
}
.results-header-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.72));
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(26px);
  transition: box-shadow 260ms ease, transform 260ms ease;
}

.results-header-card::before,
.results-header-card::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.38;
  filter: blur(0);
  transform: translate3d(0, 0, 0);
}

.results-header-card::before {
  width: 260px;
  height: 260px;
  top: -150px;
  right: -110px;
  background: radial-gradient(circle at center, rgba(59, 130, 246, 0.28), rgba(59, 130, 246, 0));
  animation: results-orbit 18s linear infinite;
}

.results-header-card::after {
  width: 210px;
  height: 210px;
  bottom: -120px;
  left: -70px;
  background: radial-gradient(circle at center, rgba(236, 72, 153, 0.26), rgba(236, 72, 153, 0));
  animation: results-orbit 16s linear infinite reverse;
}

.results-header-card.is-ready {
  box-shadow: 0 28px 56px rgba(15, 23, 42, 0.22);
  transform: translateY(-2px);
}

.results-header-card.is-loading {
  opacity: 0.9;
}

.results-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.results-heading {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(520px, 100%);
}

.results-title {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 700;
  line-height: 1.15;
  color: rgba(15, 23, 42, 0.95);
}

.results-header-card.is-ready .results-title {
  animation: results-title-pop 500ms cubic-bezier(0.22, 1, 0.36, 1) both;
  color: rgba(15, 23, 42, 1);
}

.results-header-top .results-loading {
  padding: 0;
  align-items: center;
  gap: 10px;
}

.results-header-top .results-loading .hint {
  font-size: 0.85rem;
  color: rgba(15, 23, 42, 0.7);
}

.results-header-top .loading-spinner {
  width: 42px;
  height: 42px;
}

.results-summary-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.results-summary-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  color: rgba(15, 23, 42, 0.88);
  font-weight: 600;
  font-size: 0.92rem;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.18);
  opacity: 0;
  transform: translateY(10px) scale(0.96);
  animation: results-pill-rise 480ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(var(--item-index, 0) * 90ms);
}

.results-status,
.results-status-empty {
  margin-top: 16px;
  color: rgba(15, 23, 42, 0.7);
}

.results-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.results-section .results-controls {
  margin-top: 12px;
}

.results-section .results-summary-list[hidden],
.results-section .results-status[hidden],
.results-section .results-status-empty[hidden] {
  display: none !important;
}

@keyframes results-orbit {
  0% {
    transform: rotate(0deg) scale(1);
    opacity: 0.45;
  }
  50% {
    transform: rotate(180deg) scale(1.08);
    opacity: 0.6;
  }
  100% {
    transform: rotate(360deg) scale(1);
    opacity: 0.45;
  }
}

@keyframes results-title-pop {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.95);
  }
  70% {
    opacity: 1;
    transform: translateY(-4px) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes results-pill-rise {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.9);
  }
  60% {
    opacity: 1;
    transform: translateY(-4px) scale(1.04);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.results-placeholder {
  margin-top: 4px;
}

.results-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 0;
}

.results-loading[hidden] {
  display: none;
}

.results-loading .hint {
  margin: 0;
  text-align: center;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 4px solid rgba(15, 23, 42, 0.12);
  border-top-color: var(--primary);
  animation: spinner-rotate 0.8s linear infinite;
}

@keyframes spinner-rotate {
  to {
    transform: rotate(360deg);
  }
}

.results-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
}

.results-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 180px;
}

.results-control select {
  min-width: 160px;
}

.results-list {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  justify-content: center;
  align-items: stretch;
}

.result-card {
  display: grid;
  gap: 18px;
  width: min(100%, 480px);
  margin: 0 auto;
}

.result-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.result-card-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1;
}

.result-card-header h3 {
  margin: 0;
  font-size: 1.25rem;
}

.result-card-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  display: block;
}

.result-card-rank {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  color: rgba(15, 23, 42, 0.6);
}

.result-section-title {
  margin: 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
}

.result-ingredients {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.result-cost {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-cost-summary {
  display: grid;
  grid-template-columns: auto auto;
  gap: 6px 24px;
  margin: 0;
}

.result-cost-summary dt {
  font-weight: 600;
  color: var(--text-muted);
}

.result-cost-summary dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.result-cost-chart-title {
  margin: 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
}

.result-cost-chart {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding: 4px 0 8px;
}

.result-cost-chart-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 48px;
}

.result-cost-chart-value {
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  color: rgba(15, 23, 42, 0.75);
}

.result-cost-chart-bar-wrapper {
  width: 100%;
  height: 140px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.result-cost-chart-bar {
  width: 60%;
  min-height: 4px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, rgba(249, 115, 22, 0.75) 0%, var(--primary) 100%);
  transition: height 0.3s ease;
}

.result-cost-chart-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

@media (max-width: 600px) {
  .result-cost-summary {
    grid-template-columns: 1fr;
    gap: 4px 0;
  }

  .result-cost-summary dd {
    text-align: left;
  }

  .result-cost-chart {
    gap: 12px;
  }

  .result-cost-chart-column {
    min-width: 40px;
  }

  .result-cost-chart-bar-wrapper {
    height: 110px;
  }
}

.result-ingredients .chips {
  gap: 10px;
}

.result-attr-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
  gap: 0px;
  align-items: end;
  padding-top: 8px;
}

.result-attr-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.result-attr-value {
  font-size: 1.1rem;
  font-weight: 700;
}

.result-attr-track {
  width: 36px;
  height: 160px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.08) 0%, rgba(15, 23, 42, 0.18) 100%);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  position: relative;
}

.result-attr-fill {
  width: 100%;
  border-radius: inherit;
  transition: height 0.3s ease;
  background: rgba(15, 23, 42, 0.5);
}

.result-attr-fill[data-band='green'] {
  background: linear-gradient(180deg, #bbf7d0 0%, #16a34a 100%);
}

.result-attr-fill[data-band='yellow'] {
  background: linear-gradient(180deg, #fef3c7 0%, #f59e0b 100%);
}

.result-attr-fill[data-band='red'] {
  background: linear-gradient(180deg, #fee2e2 0%, #ef4444 100%);
}

.result-attr-fill[data-band='n-a'] {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.18) 0%, rgba(15, 23, 42, 0.35) 100%);
}

.result-attr-name {
  font-size: 0.85rem;
  text-align: center;
  color: var(--text-muted);
}

.result-band-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.result-band-pills--inline {
  gap: 8px;
}

.result-band-pills .pill {
  font-size: 0.8rem;
}

@media (max-width: 1024px) {
  .attributes-layout {
    flex-direction: column;
    gap: 20px;
  }

  .attributes-column,
  .ingredients-column {
    gap: 16px;
  }

  .attr-list {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .ingredients-column {
    width: 100%;
  }

  .ingredients-column .table-wrapper {
    max-height: none;
    padding-right: 0;
  }
}

@media (max-width: 720px) {
  .result-attr-track {
    height: 120px;
  }

  .result-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .result-card-title-row {
    width: 100%;
    gap: 8px;
  }

  .attr-card-body {
    align-items: stretch;
  }

  .attr-controls {
    min-width: 0;
  }

  .attributes-layout {
    gap: 18px;
  }

  .ingredients-column {
    width: 100%;
  }
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
details summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 8px;
}
.collapsible summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  padding: 0;
  margin: 0;
}
.collapsible summary::-webkit-details-marker {
  display: none;
}
.collapsible summary .section-title {
  margin: 0;
}
.collapsible summary::after {
  content: '▾';
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}
.collapsible[open] summary::after {
  transform: rotate(180deg);
}
.collapsible > .mobile-attr-toggle,
.collapsible > .table-wrapper {
  margin-top: 12px;
}

.mobile-attr-toggle {
  display: none;
  align-items: center;
  justify-content: flex-start;
}

.mobile-attr-toggle label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.mobile-attr-toggle input[type="checkbox"] {
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid rgba(15, 23, 42, 0.35);
  display: grid;
  place-items: center;
  background: #fff;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.mobile-attr-toggle input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.25);
}

.mobile-attr-toggle input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.mobile-attr-toggle input[type="checkbox"]:checked::after {
  content: '✓';
  font-size: 0.8rem;
  transform: translateY(-1px);
}
.support-section {
  margin-top: 48px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  text-align: left;
}
.support-section h2 {
  margin: 0;
  font-size: clamp(1.5rem, 2.5vw, 1.9rem);
}
.support-section p {
  margin: 0;
  line-height: 1.6;
}
.support-actions {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.support-note {
  font-weight: 600;
  color: var(--text-muted);
}
.support-buttons {
  display: flex;
  align-items: center;
}
.support-buttons a {
  display: inline-flex;
  transition: transform 0.2s ease;
}
.support-buttons a:hover {
  transform: translateY(-2px);
}
.site-footer {
  background: rgba(15, 23, 42, 0.92);
  color: #f8fafc;
  padding: 32px 20px;
}
.footer-inner {
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.footer-tagline {
  margin: 6px 0 0;
  color: rgba(248, 250, 252, 0.7);
}
.footer-links {
  list-style: none;
  display: flex;
  gap: 16px;
  margin: 0;
  padding: 0;
}
.footer-links a {
  color: #facc15;
  text-decoration: none;
  font-weight: 600;
}
.footer-links a:hover {
  text-decoration: underline;
}
.legal-page {
  min-height: 100vh;
  margin: 0;
  background: var(--bg-gradient);
  font-family: "Inter", "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  color: #0f172a;
}
.legal-page .legal-container {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 20px 64px;
}
.legal-page a {
  color: var(--primary);
}
.legal-page h1 {
  font-size: clamp(2rem, 3vw, 2.4rem);
  margin-bottom: 12px;
}
.legal-page h2 {
  margin-top: 32px;
  margin-bottom: 12px;
}
.legal-page p {
  line-height: 1.7;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 24px;
  text-decoration: none;
  color: var(--primary-dark);
  font-weight: 600;
}
.back-link:hover {
  text-decoration: underline;
}
@media (max-width: 640px) {
  .page {
    padding: 28px 16px 40px;
  }

  header {
    margin-bottom: 18px;
  }

  .card {
    padding: 16px;
  }

  .form-card {
    gap: 22px;
  }

  .attributes-layout {
    gap: 14px;
  }

  .attributes-column,
  .ingredients-column {
    gap: 12px;
  }

  .column-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .btn-make-green {
    width: 100%;
    justify-content: center;
    padding: 10px 14px;
  }

  .attr-list {
    gap: 14px;
  }

  .attr-card {
    padding: 16px 18px;
    gap: 14px;
  }

  .attr-card-body {
    flex-direction: column;
    gap: 16px;
  }

  .mode-toggle {
    width: 100%;
    justify-content: flex-start;
  }

  .slider-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .slider-value {
    align-items: flex-start;
  }

  .mobile-attr-toggle {
    display: flex;
  }

  .table-wrapper {
    border: none;
    background: transparent;
    overflow: visible;
  }

  .ingredients-table {
    border-radius: 0;
  }

  .ingredients-table thead {
    border: 0;
    clip: rect(0 0 0 0);
    height: 1px;
    width: 1px;
    margin: -1px;
    overflow: hidden;
    position: absolute;
  }

  .ingredients-table tbody + tbody { margin-top: 12px; }

  .ingredient-category-header {
    padding-left: 1em;
  }

  .ingredients-column .table-wrapper {
    padding-right: 0;
  }

  .ingredients-table--compact th,
  .ingredients-table--compact td {
    padding: 8px;
  }

  .ingredients-table tbody {
    display: flex;
    flex-direction: column;
    gap: 7px;
  }

  .ingredients-table tbody tr:not(.ingredient-category-header) {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 16px;
    padding: 16px 18px;
    position: relative;
    box-shadow: 0 12px 20px -18px rgba(15, 23, 42, 0.5);
  }

  .ingredients-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.95);
  }

  .ingredients-table td {
    padding: 0;
    font-size: 0.95rem;
  }

  .ingredients-table td[data-label] {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
  }

  .ingredients-table td[data-label]::before {
    content: attr(data-label);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 600;
  }

  .table-wrapper[data-hide-attributes="true"] .ingredients-table td[data-attr-cell] {
    display: none;
  }

  .table-wrapper[data-hide-attributes="true"] .ingredients-table th[data-attr-header] {
    display: none;
  }

  .table-wrapper[data-hide-attributes="true"] .ingredients-table tbody tr {
    gap: 10px;
  }

  .ingredient-name {
    align-items: center;
    flex-direction: row;
    gap: 8px;
    flex-wrap: wrap;
  }

  .ingredients-header {
    gap: 12px;
  }

  .ingredients-header-top {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .ingredients-actions {
    width: 100%;
    margin-left: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 8px;
  }

  .ingredients-actions > * {
    width: 100%;
  }

  .ingredients-header-bottom {
    gap: 8px;
    align-items: stretch;
  }

  .ingredients-legend {
    text-align: left;
  }

  .mobile-selection-heading {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .mobile-selection-options {
    gap: 10px;
  }

  .mobile-selection-option {
    font-size: 0.68rem;
    letter-spacing: 0.05em;
  }

  .ingredients-table td.ingredient-selection-cell {
    align-items: flex-start;
    gap: 10px;
  }

  .ingredients-table td.ingredient-selection-cell::before {
    content: none;
  }

  .ingredient-selection {
    width: 100%;
    gap: 12px;
  }

  .ingredient-selection-checkboxes {
    gap: 10px;
  }

  .ingredient-option {
    width: 26px;
    height: 26px;
  }

  .ingredient-option .checkbox-visual {
    width: 22px;
    height: 22px;
  }

  .range-inputs {
    grid-template-columns: 1fr;
  }
  .footer-links {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}
