:root {
  --background: #f5f7f2;
  --surface: #ffffff;
  --surface-soft: #eef3ea;
  --text: #18221b;
  --muted: #667269;
  --line: #dce4dc;
  --primary: #245c3a;
  --primary-dark: #17442a;
  --less: #9f3f35;
  --less-soft: #fff0ed;
  --mixed: #8a6400;
  --mixed-soft: #fff7d9;
  --more: #25623d;
  --more-soft: #eaf7ee;
  --shadow: 0 16px 45px rgba(30, 54, 38, 0.08);
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at top right, #dfeedd 0, transparent 28rem),
    var(--background);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1100px, calc(100% - 32px));
  margin-inline: auto;
}

.site-header {
  border-bottom: 1px solid rgba(220, 228, 220, 0.8);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--surface-soft);
  font-size: 24px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 17px;
}

.brand small {
  color: var(--muted);
  margin-top: 1px;
}

.privacy-badge,
.ai-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
}

main {
  padding-block: 56px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 36px;
  margin-bottom: 30px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 680px;
  margin-bottom: 14px;
  font-size: clamp(42px, 7vw, 72px);
  line-height: 0.98;
  letter-spacing: -0.05em;
}

.hero-copy {
  max-width: 650px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}

.score-key {
  min-width: 210px;
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.score-key span {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 13px;
}

.score-key b {
  color: var(--text);
}

.card,
.info-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.add-card {
  padding: clamp(22px, 5vw, 38px);
}

.card-heading,
.section-heading,
.food-topline,
.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.card-heading {
  margin-bottom: 24px;
}

.card-heading h2,
.section-heading h2,
.info-card h2 {
  margin-bottom: 0;
  font-size: 27px;
  letter-spacing: -0.025em;
}

form {
  display: grid;
  gap: 18px;
}

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

label {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 750;
}

label small {
  color: var(--muted);
  font-weight: 500;
}

input {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  background: #fbfcfa;
  color: var(--text);
  padding: 0 15px;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(36, 92, 58, 0.11);
}

.form-footer {
  align-items: flex-end;
  margin-top: 2px;
}

.form-footer p {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.primary-button,
.ghost-button,
.small-button {
  border-radius: 12px;
  font-weight: 800;
}

.primary-button {
  min-height: 48px;
  flex: 0 0 auto;
  border: 0;
  background: var(--primary);
  color: #fff;
  padding: 0 20px;
  box-shadow: 0 8px 24px rgba(36, 92, 58, 0.22);
}

.primary-button:hover {
  background: var(--primary-dark);
}

.primary-button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.form-message {
  min-height: 20px;
  margin-bottom: 0;
  color: var(--less);
  font-size: 14px;
  font-weight: 650;
}

.dashboard-section {
  margin-top: 52px;
}

.section-heading {
  margin-bottom: 20px;
}

.ghost-button {
  min-height: 42px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 0 16px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.summary-card {
  min-height: 116px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  padding: 17px;
}

.summary-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.summary-card strong {
  font-size: 32px;
  line-height: 1;
}

.summary-card.less {
  background: var(--less-soft);
}

.summary-card.mixed {
  background: var(--mixed-soft);
}

.summary-card.more {
  background: var(--more-soft);
}

.state-card {
  display: grid;
  justify-items: center;
  gap: 6px;
  border: 1px dashed #c8d4c9;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.58);
  padding: 52px 20px;
  text-align: center;
}

.state-card h3 {
  margin-bottom: 0;
}

.state-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.empty-icon {
  font-size: 40px;
}

.spinner {
  width: 34px;
  height: 34px;
  border: 4px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.food-list {
  display: grid;
  gap: 14px;
}

.food-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) auto;
  gap: 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  padding: 20px;
  box-shadow: 0 8px 28px rgba(30, 54, 38, 0.055);
}

.score-bubble {
  width: 72px;
  height: 72px;
  display: grid;
  place-content: center;
  border-radius: 20px;
  background: var(--surface-soft);
  text-align: center;
}

.score-bubble strong {
  font-size: 29px;
  line-height: 1;
}

.score-bubble span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

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

.food-title {
  margin-bottom: 4px;
  font-size: 20px;
  overflow-wrap: anywhere;
}

.food-details {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.food-label {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 850;
}

.food-reason {
  margin: 14px 0;
  color: #3f4b42;
  line-height: 1.55;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag {
  border-radius: 999px;
  background: #f1f4f0;
  color: #4e5b51;
  padding: 6px 9px;
  font-size: 11px;
  font-weight: 750;
}

.cap-notice,
.question-notice {
  margin-top: 13px;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.45;
}

.cap-notice {
  background: var(--less-soft);
  color: #73342d;
}

.question-notice {
  background: #edf2ff;
  color: #354a73;
}

.cap-notice strong,
.question-notice strong {
  margin-right: 4px;
}

.food-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 13px;
  color: var(--muted);
  font-size: 11px;
}

.food-actions {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.small-button {
  min-height: 36px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 0 11px;
  font-size: 12px;
}

.danger-button {
  color: var(--less);
}

.food-card.less .score-bubble,
.food-card.less .food-label {
  background: var(--less-soft);
  color: var(--less);
}

.food-card.mixed .score-bubble,
.food-card.mixed .food-label {
  background: var(--mixed-soft);
  color: var(--mixed);
}

.food-card.more .score-bubble,
.food-card.more .food-label {
  background: var(--more-soft);
  color: var(--more);
}

.info-card {
  margin-top: 52px;
  padding: clamp(22px, 5vw, 36px);
}

.info-card > p {
  max-width: 740px;
  margin: 12px 0 22px;
  color: var(--muted);
  line-height: 1.6;
}

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

.rule-list div {
  min-height: 116px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  border-radius: 16px;
  background: var(--surface-soft);
  padding: 16px;
}

.rule-list strong {
  font-size: 18px;
}

.rule-list span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.footer {
  padding: 0 0 44px;
}

.footer p {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

@media (max-width: 860px) {
  .hero {
    align-items: stretch;
    flex-direction: column;
  }

  .score-key {
    min-width: 0;
  }

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

  .summary-card:first-child {
    grid-column: span 2;
  }

  .food-card {
    grid-template-columns: 70px minmax(0, 1fr);
  }

  .food-actions {
    grid-column: 2;
  }

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

@media (max-width: 620px) {
  .shell {
    width: min(100% - 22px, 1100px);
  }

  .privacy-badge {
    display: none;
  }

  main {
    padding-block: 38px;
  }

  .form-grid,
  .form-footer {
    display: grid;
    grid-template-columns: 1fr;
  }

  .primary-button {
    width: 100%;
  }

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

  .score-bubble {
    width: 64px;
    height: 64px;
  }

  .food-actions {
    grid-column: 1;
    flex-wrap: wrap;
  }

  .food-topline {
    align-items: flex-start;
  }
}


/* Dual-score additions */
.overall-summary {
  background: #edf2ff;
}

.nutrition-summary {
  background: #eef7ff;
}

.longevity-summary {
  background: var(--more-soft);
}

.overall-column {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 10px;
}

.overall-column .food-label {
  display: block;
  width: 100%;
  text-align: center;
  line-height: 1.25;
}

.score-bubble {
  width: 96px;
  height: 96px;
  border-radius: 25px;
}

.score-bubble span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.score-bubble strong {
  font-size: 34px;
}

.score-bubble small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.subscore-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 190px));
  gap: 10px;
  margin: 14px 0;
}

.subscore {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: baseline;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 12px;
}

.subscore span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.subscore strong {
  font-size: 22px;
}

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

.nutrition-score-box {
  background: #eef7ff;
}

.longevity-score-box {
  background: var(--more-soft);
}

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

.reason-grid > div {
  border-radius: 14px;
  background: #f6f8f5;
  padding: 12px;
}

.reason-grid strong {
  font-size: 12px;
}

.reason-grid p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.formula-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-radius: 16px;
  background: #edf2ff;
  margin-bottom: 14px;
  padding: 16px;
}

.formula-panel strong {
  font-size: 18px;
}

.formula-panel span {
  color: #3f5278;
  font-weight: 750;
}

.processed-meat-tag {
  background: var(--less-soft);
  color: var(--less);
}

@media (max-width: 860px) {
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-card:first-child {
    grid-column: auto;
  }

  .food-card {
    grid-template-columns: 100px minmax(0, 1fr);
  }
}

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

  .overall-column {
    grid-template-columns: auto 1fr;
    justify-items: start;
    align-items: center;
  }

  .overall-column .food-label {
    width: auto;
  }

  .subscore-grid,
  .reason-grid {
    grid-template-columns: 1fr;
  }

  .formula-panel {
    align-items: flex-start;
    flex-direction: column;
  }
}
