:root {
  --green-main: #2ab34f;
  --green-soft: #c7f7d5;
  --green-border: #8be3a5;

  --text-dark: #1f2937;
  --text-green: #2a4932;
}

/* Base */

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial, sans-serif;
}

img {
  max-width: 100%;
  height: auto;
}

body {
  margin: 0;
  overflow-x: hidden;

  background: linear-gradient(
    180deg,
    #9af5bd,
    #aaf8c8,
    #aaf8c8,
    #9af5bd
  );

  display: flex;
  justify-content: center;
  min-height: 100vh;
}

.app {
  width: 100%;
  max-width: 480px;
  padding: 20px 18px 40px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Close button */

.close-btn {
  position: absolute;
  top: 16px;
  left: 16px;

  width: 34px;
  height: 34px;

  border-radius: 10px;
  border: none;

  background: white;

  font-size: 18px;
  font-weight: bold;

  display: flex;
  align-items: center;
  justify-content: center;

  text-decoration: none;
  color: black;

  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}

.close-btn:hover {
  transform: scale(1.05);
}

/* Brand */

.brand {
  color: white;
  font-weight: 800;
  font-size: 1.8rem;

  display: flex;
  justify-content: center;
  align-items: center;

  margin-bottom: 10px;
}

.logo {
  width: 55px;
  height: 55px;
  object-fit: contain;

  background-color: var(--green-main);
  border-radius: 18px;

  margin-right: 8px;
}

/* Search */

.search {
  margin: 18px 0;
  text-align: center;
}

.search input {
  width: 90%;
  max-width: 380px;

  padding: 12px 14px;

  border-radius: 12px;
  border: none;

  font-size: 16px;
  font-weight: 600;

  background: white;
  color: var(--text-green);

  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.search input:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--green-soft);
}

/* Food image */

.food-img {
  width: 100%;
  border-radius: 16px;
  margin: 18px 0;
}

/* Title */

h1 {
  font-size: 22px;
  margin-bottom: 10px;
  color: black;
}

/* Calories highlight */

.calories-box {
  font-size: 26px;
  font-weight: 900;

  text-align: center;

  padding: 14px;

  border-radius: 14px;

  background: white;

  color: var(--green-main);

  box-shadow: 0 6px 14px rgba(0,0,0,0.1);

  margin-bottom: 20px;
}

/* Cards */

.card {
  background: white;

  border-radius: 16px;

  padding: 18px;

  margin-bottom: 18px;

  box-shadow:
  0 6px 16px rgba(0,0,0,0.08);
}

.card h2 {
  margin-top: 0;
  font-size: 16px;
  margin-bottom: 10px;
}

.card p {
  margin: 0;
  line-height: 1.6;
  color: var(--text-green);
  font-weight: 500;
}

/* Nutrition rows */

.nutrition-row {
  display: flex;
  justify-content: space-between;

  padding: 10px 0;

  border-bottom: 1px solid #eee;

  font-weight: 600;
  color: var(--text-green);
}

.nutrition-row:last-child {
  border-bottom: none;
}

.nutrition-value {
  font-weight: 800;
  color: black;
}

/* Food list */

.food-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.food-item {
  display: flex;
  align-items: center;
  gap: 12px;

  background: white;

  border-radius: 14px;

  padding: 10px;

  cursor: pointer;

  box-shadow: 0 3px 10px rgba(0,0,0,0.08);

  transition: transform .1s ease;
}

.food-item:hover {
  transform: scale(1.02);
}

.food-item img.food-img {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
}

.food-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-green);
}

.calories {
  font-size: 13px;
  color: #444;
  font-weight: 600;
}

/* Daily card */

.daily-card {
  padding: 20px;
  border-radius: 16px;
  margin-bottom: 18px;

  background: white;

  box-shadow: 0 6px 14px rgba(0,0,0,0.08);
}

.daily-card h2 {
  font-size: 18px; /* bigger */
  text-align: center;
}

.mode-row {
  display: flex;
  justify-content: center;
  margin: 12px 0;
}

#calorieMode {
  padding: 10px 14px; /* bigger */
  border-radius: 10px;
  border: none;

  background: var(--green-soft);
  font-weight: 600;
  font-size: 16px;
}

#caloriePercent {
  text-align: center;
  font-weight: 700;
  font-size: 15px;
}

/* Empty state */

#emptyState {
  text-align: center;
  font-weight: 700;
  color: var(--text-green);
}

/* Footer */

footer {
  margin-top: auto;

  text-align: center;
  font-size: 13px;

  padding: 16px;

  color: #2f2f2f;

  background: rgba(255,255,255,0.5);

  border-radius: 12px;
}

/* =========================
   MOBILE OPTIMIZATION
========================= */

@media (max-width: 480px) {

  .app {
    padding: 16px 14px 32px;
  }

  .brand {
    font-size: 1.6rem;
  }

  .logo {
    width: 48px;
    height: 48px;
  }

  h1 {
    font-size: 20px;
  }

  .search input {
    width: 100%;
  }

  .food-img {
    margin: 16px 0;
  }

  .calories-box {
    font-size: 24px;
    padding: 12px;
  }

  .card {
    padding: 16px;
  }

  .nutrition-row {
    font-size: 14px;
  }

  .food-item img.food-img {
    width: 44px;
    height: 44px;
  }

  footer {
    font-size: 12px;
    padding: 14px;
  }

}

/* Related Foods Horizontal Scroll, compact */

.related-foods-list {
  display: flex;
  gap: 12px;
  overflow-x: auto;        /* horizontal scroll */
  white-space: nowrap;     
  padding: 8px 0;
  margin: 0;
  list-style: none;
  scrollbar-width: thin;
}

.related-foods-list::-webkit-scrollbar {
  height: 6px;
}

.related-foods-list::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.2);
  border-radius: 3px;
}

.related-foods-list li {
  display: inline-block;
  flex: 0 0 auto;
  background: white;
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transition: transform 0.12s ease;
}

.related-foods-list li:hover {
  transform: scale(1.03);
}

.related-foods-list a {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.related-foods-list a span {
  font-size: 13px;
  white-space: nowrap;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.food-img-small {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  object-fit: cover;
}