:root {
  color-scheme: light;
  --bg: #f8faf6;
  --surface: #ffffff;
  --surface-soft: #eef5eb;
  --text: #172118;
  --muted: #61705f;
  --line: #d9e2d4;
  --brand: #26734d;
  --brand-dark: #195437;
  --accent: #b65f22;
  --danger: #b42318;
  --shadow: 0 14px 40px rgba(39, 62, 42, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(238, 245, 235, 0.92), rgba(248, 250, 246, 1)),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 20px 14px 36px;
}

.hero {
  padding: 12px 2px 20px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--text);
  font-weight: 900;
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 9vw, 3.4rem);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 4px;
  font-size: 1.12rem;
}

.hero-copy,
.section-heading p,
.disclaimer {
  color: var(--muted);
}

.hero-copy {
  max-width: 42rem;
  margin-bottom: 0;
  font-size: 1rem;
  line-height: 1.55;
}

.panel,
.summary-panel,
.cta-panel {
  margin-top: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel,
.summary-panel {
  padding: 16px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-heading p {
  margin-bottom: 0;
  font-size: 0.92rem;
}

.field-label,
.manual-grid span,
.profile-grid span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.search-input,
.manual-grid input,
.profile-grid input,
.profile-grid select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
  background: #fff;
  color: var(--text);
  outline: none;
}

.search-input:focus,
.manual-grid input:focus,
.profile-grid input:focus,
.profile-grid select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(38, 115, 77, 0.15);
}

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

.profile-wide {
  grid-column: 1 / -1;
}

.target-note {
  margin: 12px 0 0;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--brand-dark);
  padding: 11px 12px;
  font-weight: 800;
}

.suggestions {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.suggestion-button,
.portion-button {
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-align: left;
}

.suggestion-button {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
}

.suggestion-button strong,
.selected-food span {
  display: block;
  font-weight: 800;
}

.suggestion-button small {
  color: var(--muted);
  text-transform: capitalize;
}

.portion-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.selected-food {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.portion-grid {
  display: grid;
  gap: 10px;
}

.portion-button {
  padding: 12px;
}

.portion-button strong,
.portion-button span {
  display: block;
}

.portion-button span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.portion-button:active,
.suggestion-button:active {
  transform: translateY(1px);
}

.manual-entry {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.manual-entry summary {
  color: var(--brand-dark);
  font-weight: 800;
  cursor: pointer;
}

.manual-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.primary-button,
.ghost-button,
.text-button,
.remove-button {
  border: 0;
  border-radius: 8px;
  font-weight: 800;
}

.primary-button {
  min-height: 48px;
  padding: 0 16px;
  background: var(--brand);
  color: #fff;
}

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

.ghost-button {
  min-height: 38px;
  padding: 0 12px;
  background: var(--surface-soft);
  color: var(--brand-dark);
}

.text-button {
  background: transparent;
  color: var(--brand);
}

.full-width {
  width: 100%;
}

.calorie-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #f5efe8;
  color: var(--accent);
  padding: 8px 11px;
  font-size: 0.92rem;
}

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

.selected-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: #fff;
}

.food-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.remove-button {
  width: 38px;
  height: 38px;
  background: #fff1ef;
  color: var(--danger);
}

.summary-panel {
  background: #143827;
  color: #fff;
}

.summary-panel h2 {
  color: #fff;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 14px 0;
}

.summary-grid div {
  min-height: 84px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.08);
}

.summary-grid span {
  display: block;
  min-height: 30px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
}

.summary-grid strong {
  display: block;
  font-size: 1.1rem;
}

.insight {
  margin-bottom: 10px;
  line-height: 1.5;
}

.disclaimer {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.88rem;
  line-height: 1.45;
}

.summary-panel .primary-button {
  background: #f3c969;
  color: #172118;
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-empty,
.history-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: #fff;
}

.history-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.history-item span {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

.cta-panel {
  padding: 18px;
  background: #fff7e8;
  border-color: #efd59e;
}

.cta-panel p {
  margin-bottom: 6px;
  color: #503912;
}

.cta-panel strong {
  color: #172118;
}

.instagram-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  color: #172118;
  font-weight: 900;
  text-decoration: none;
}

.instagram-link svg {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
}

.hidden {
  display: none;
}

@media (min-width: 680px) {
  .app-shell {
    padding: 32px 18px 48px;
  }

  .panel,
  .summary-panel {
    padding: 20px;
  }

  .portion-grid,
  .manual-grid,
  .profile-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .manual-grid .primary-button {
    align-self: end;
  }
}
