:root {
  --bg: #f6f8f4;
  --surface: #ffffff;
  --surface-soft: #eef5ef;
  --ink: #1c2821;
  --muted: #627167;
  --line: #d9e3dc;
  --green: #2f7d57;
  --green-dark: #1f5e42;
  --blue: #326f8f;
  --amber: #b87522;
  --red: #b94b46;
  --shadow: 0 18px 45px rgba(31, 56, 40, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(246, 248, 244, 0.7) 34rem),
    var(--bg);
  color: var(--ink);
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    "Noto Sans SC",
    system-ui,
    sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

img {
  display: block;
  width: 100%;
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 28px clamp(16px, 3vw, 36px) 48px clamp(72px, 6vw, 96px);
}

.menu-toggle {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 30;
  display: grid;
  gap: 5px;
  place-content: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(217, 227, 220, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 14px 34px rgba(31, 56, 40, 0.14);
  backdrop-filter: blur(12px);
}

.menu-toggle span {
  display: block;
  width: 21px;
  height: 2px;
  border-radius: 999px;
  background: var(--green-dark);
  transition:
    transform 180ms ease,
    opacity 180ms ease;
}

.menu-toggle.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.menu-toggle.open span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(20, 32, 25, 0.2);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 180ms ease;
}

.nav-backdrop.show {
  opacity: 1;
}

.side-nav {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 25;
  display: grid;
  width: min(360px, calc(100vw - 28px));
  align-content: start;
  gap: 10px;
  border-right: 1px solid rgba(217, 227, 220, 0.95);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(240, 247, 242, 0.98)),
    var(--surface);
  padding: 84px 16px 18px;
  box-shadow: 28px 0 60px rgba(31, 56, 40, 0.18);
  transform: translateX(-105%);
  transition: transform 220ms ease;
}

.side-nav.open {
  transform: translateX(0);
}

.side-nav-head {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
  padding: 0 4px 16px;
}

.side-nav-head strong,
.side-nav-link strong {
  display: block;
}

.side-nav-head small,
.side-nav-link small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.76rem;
}

.nav-orb {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--green), var(--blue));
  box-shadow: 0 14px 32px rgba(47, 125, 87, 0.24);
}

.nav-orb::before {
  content: "";
  width: 18px;
  height: 18px;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.22);
}

.side-nav-link {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ink);
  padding: 10px;
  text-decoration: none;
  transition:
    border-color 140ms ease,
    background 140ms ease,
    transform 140ms ease;
}

.side-nav-link:hover {
  border-color: var(--line);
  background: #f8fbf8;
  transform: translateX(2px);
}

.nav-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #eef5ef;
  color: var(--green-dark);
  font-size: 0.82rem;
  font-weight: 900;
}

.icon-ai::before {
  content: "AI";
}

.icon-medal::before {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(145deg, #e7c75b, #2f7d57);
  box-shadow: 0 11px 0 -6px #9ab7a4;
}

.icon-target::before {
  content: "";
  width: 22px;
  height: 22px;
  border: 2px solid currentColor;
  border-radius: 50%;
  box-shadow: inset 0 0 0 5px #eef5ef;
}

.icon-menu::before {
  content: "";
  width: 22px;
  height: 16px;
  border-top: 3px solid currentColor;
  border-bottom: 3px solid currentColor;
  box-shadow: inset 0 5px 0 currentColor;
}

.icon-sugar::before {
  content: "";
  width: 18px;
  height: 18px;
  border: 2px solid #d6c9bd;
  border-radius: 4px;
  background: #fff;
  transform: rotate(12deg);
}

.icon-fridge::before {
  content: "";
  width: 18px;
  height: 24px;
  border: 2px solid currentColor;
  border-radius: 4px;
  box-shadow: inset 0 9px 0 rgba(47, 125, 87, 0.16);
}

.icon-data::before {
  content: "";
  width: 21px;
  height: 18px;
  border-left: 4px solid currentColor;
  border-bottom: 4px solid currentColor;
  box-shadow:
    7px 4px 0 -2px currentColor,
    14px -3px 0 -2px currentColor;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: clamp(20px, 4vw, 56px);
  align-items: center;
  min-height: 260px;
}

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

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

h1 {
  max-width: 680px;
  margin-bottom: 14px;
  font-size: clamp(2.15rem, 5vw, 4.6rem);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.25rem, 2vw, 1.75rem);
  letter-spacing: 0;
}

h3 {
  margin-bottom: 12px;
  font-size: 1.05rem;
}

.lead {
  max-width: 650px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.35vw, 1.18rem);
  line-height: 1.75;
}

.food-photo {
  position: relative;
  overflow: hidden;
  min-height: 230px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  box-shadow: var(--shadow);
}

.food-photo::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 45%;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(18, 33, 25, 0.42));
}

.food-photo img {
  height: 100%;
  min-height: 230px;
  object-fit: cover;
}

.health-rank-banner,
.app-directory,
.ai-section,
.goal-band,
.planner-grid,
.drink-section,
.builder-section,
.source-section {
  margin-top: 28px;
}

.section-heading {
  display: flex;
  gap: 18px;
  align-items: flex-end;
  justify-content: space-between;
}

.section-heading.compact {
  align-items: center;
}

.goal-switch,
.builder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.goal-btn,
.ghost-btn,
.primary-btn,
.secondary-btn,
.mini-btn {
  min-height: 40px;
  border-radius: 8px;
  font-weight: 800;
  transition:
    transform 140ms ease,
    background 140ms ease,
    color 140ms ease,
    border-color 140ms ease;
}

.goal-btn,
.ghost-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  padding: 0 16px;
}

.goal-btn.active {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.primary-btn {
  background: var(--green-dark);
  color: #fff;
  padding: 0 18px;
  box-shadow: 0 12px 28px rgba(31, 94, 66, 0.18);
}

.secondary-btn {
  background: #e9f1ec;
  color: var(--green-dark);
  padding: 0 16px;
}

.mini-btn {
  min-height: 32px;
  padding: 0 10px;
  background: #edf4ef;
  color: var(--green-dark);
  font-size: 0.84rem;
}

.ghost-btn.danger {
  color: var(--red);
}

button:hover {
  transform: translateY(-1px);
}

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

.goal-stat {
  min-height: 105px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
}

.goal-stat span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.goal-stat strong {
  display: block;
  margin: 8px 0;
  font-size: clamp(1.2rem, 2.2vw, 1.8rem);
}

.goal-stat p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.planner-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(310px, 360px);
  gap: 22px;
  align-items: start;
}

.planner-main,
.insight-panel,
.health-rank-banner,
.ai-section,
.drink-section,
.builder-section,
.source-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.planner-main,
.insight-panel,
.health-rank-banner,
.ai-section,
.drink-section,
.builder-section,
.source-section {
  padding: clamp(18px, 2.4vw, 26px);
}

.health-rank-banner {
  display: grid;
  grid-template-columns: 128px minmax(0, 0.8fr) minmax(320px, 1.2fr);
  gap: 18px;
  align-items: center;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(238, 245, 239, 0.88)),
    var(--surface);
}

.rank-medal-wrap {
  position: relative;
  display: grid;
  place-items: center;
}

.rank-medal-wrap::before,
.rank-medal-wrap::after {
  content: "";
  position: absolute;
  bottom: 0;
  width: 26px;
  height: 42px;
  border-radius: 0 0 6px 6px;
  background: linear-gradient(180deg, #4b9ad4, #2f7d57);
  transform-origin: top center;
}

.rank-medal-wrap::before {
  left: 37px;
  transform: rotate(18deg);
}

.rank-medal-wrap::after {
  right: 37px;
  transform: rotate(-18deg);
}

.rank-medal {
  position: relative;
  display: grid;
  place-items: center;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  color: #fff;
  isolation: isolate;
  animation: medal-float 3.4s ease-in-out infinite;
}

.rank-medal::before,
.rank-medal::after {
  content: "";
  position: absolute;
  border-radius: inherit;
  z-index: -1;
}

.rank-medal::before {
  inset: -9px;
  border: 2px solid rgba(255, 255, 255, 0.78);
  box-shadow: 0 0 0 10px rgba(47, 125, 87, 0.09);
  animation: medal-pulse 2.2s ease-out infinite;
}

.rank-medal::after {
  inset: 9px;
  background: radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0) 35%);
}

.rank-medal span {
  margin-top: 8px;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.rank-medal strong {
  margin-top: -8px;
  font-size: 3.2rem;
  line-height: 1;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.18);
}

.rank-s {
  background: linear-gradient(145deg, #1f9d63, #88c541);
  box-shadow: 0 18px 48px rgba(47, 125, 87, 0.28);
}

.rank-a {
  background: linear-gradient(145deg, #2f7d57, #4b9ad4);
  box-shadow: 0 18px 48px rgba(50, 111, 143, 0.22);
}

.rank-b {
  background: linear-gradient(145deg, #c98625, #e7c75b);
  box-shadow: 0 18px 48px rgba(184, 117, 34, 0.22);
}

.rank-c {
  background: linear-gradient(145deg, #b94b46, #e49a62);
  box-shadow: 0 18px 48px rgba(185, 75, 70, 0.25);
}

@keyframes medal-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

@keyframes medal-pulse {
  0% {
    opacity: 0.82;
    transform: scale(0.96);
  }
  70% {
    opacity: 0;
    transform: scale(1.2);
  }
  100% {
    opacity: 0;
    transform: scale(1.2);
  }
}

.rank-copy h2 {
  margin-bottom: 8px;
}

.rank-copy p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
}

.rank-bars {
  display: grid;
  gap: 10px;
}

.rank-bar-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 52px;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.rank-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6eee8;
}

.rank-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--blue));
  animation: rank-fill 650ms ease both;
}

@keyframes rank-fill {
  from {
    width: 0;
  }
}

.app-directory {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  border: 1px solid rgba(217, 227, 220, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  padding: 10px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.app-directory a {
  display: grid;
  min-height: 78px;
  align-content: center;
  gap: 4px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ink);
  padding: 10px;
  text-decoration: none;
  transition:
    border-color 140ms ease,
    background 140ms ease,
    transform 140ms ease;
}

.app-directory a:hover {
  border-color: var(--line);
  background: #f5faf6;
  transform: translateY(-1px);
}

.app-directory span {
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 900;
}

.app-directory strong {
  font-size: 0.95rem;
}

.app-directory small {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.3;
}

.ai-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.78fr) minmax(0, 1.22fr);
  gap: 18px;
  margin-top: 20px;
}

.ai-input-panel,
.ai-result-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
  padding: 16px;
}

.ai-input-panel {
  display: grid;
  gap: 12px;
  align-content: start;
}

.analysis-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.analysis-tips {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.analysis-tips span {
  border-radius: 8px;
  background: #eef5ef;
  padding: 8px 10px;
}

.ai-result-panel {
  display: grid;
  gap: 14px;
}

.analysis-level {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  border-radius: 8px;
  padding: 16px;
  background: #eef5ef;
}

.analysis-level strong {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  grid-row: 1 / span 3;
  border-radius: 50%;
  background: #fff;
  color: var(--green-dark);
  font-size: 2rem;
  font-weight: 900;
  box-shadow: inset 0 0 0 2px rgba(47, 125, 87, 0.28);
  animation: grade-pop 380ms ease both;
}

.analysis-level span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.analysis-level p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.analysis-level.empty strong {
  color: var(--muted);
  box-shadow: inset 0 0 0 2px var(--line);
}

.analysis-level.grade-s {
  background: #e8f6ee;
}

.analysis-level.grade-a {
  background: #eef6e7;
}

.analysis-level.grade-b {
  background: #fff8e8;
}

.analysis-level.grade-c {
  background: #fff0ec;
}

.analysis-level.grade-c strong {
  color: #9b382f;
  box-shadow: inset 0 0 0 2px rgba(185, 75, 70, 0.35);
}

@keyframes grade-pop {
  from {
    transform: scale(0.86);
    opacity: 0.3;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.analysis-totals {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.analysis-total {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.analysis-total span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
}

.analysis-total strong {
  display: block;
  margin-top: 5px;
  font-size: 1.04rem;
}

.analysis-sugar {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.analysis-sugar h3,
.assistant-advice h3,
.analysis-food-list h3 {
  margin-bottom: 8px;
  font-size: 0.98rem;
}

.assistant-advice {
  display: grid;
  gap: 8px;
}

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

.advice-list li {
  border-left: 4px solid var(--green);
  border-radius: 8px;
  background: #f6faf7;
  padding: 10px 12px;
  color: #34443a;
  line-height: 1.5;
}

.advice-list li.warning {
  border-left-color: var(--red);
  background: #fff5f3;
}

.remaining-grid,
.analysis-food-items {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.remaining-grid div,
.analysis-food-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.remaining-grid span,
.analysis-food-item span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
}

.remaining-grid strong,
.analysis-food-item strong {
  display: block;
  margin-top: 5px;
}

.day-totals {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.recipe-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.84rem;
}

.recipe-stats span {
  border-radius: 999px;
  background: #edf4ef;
  padding: 5px 10px;
  font-weight: 800;
}

.total-pill {
  border: 1px solid #d9e3dc;
  border-radius: 8px;
  background: #f8fbf8;
  padding: 12px;
}

.total-pill span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
}

.total-pill strong {
  display: block;
  margin-top: 6px;
  font-size: 1.08rem;
}

.meal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.meal-card,
.ingredient-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.meal-card {
  display: flex;
  min-height: 540px;
  flex-direction: column;
  padding: 16px;
}

.meal-top {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  min-height: 92px;
}

.meal-label {
  color: var(--amber);
  font-size: 0.78rem;
  font-weight: 900;
}

.meal-card h3 {
  margin: 6px 0 8px;
  line-height: 1.35;
}

.meal-reason {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.nutrition-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 14px 0;
}

.nutrition-row div {
  border-radius: 8px;
  background: #f3f7f4;
  padding: 8px 6px;
  text-align: center;
}

.nutrition-row span {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
}

.nutrition-row strong {
  display: block;
  margin-top: 3px;
  font-size: 0.92rem;
}

.ingredient-lines,
.steps-list,
.dish-notes {
  margin: 0;
  padding-left: 18px;
  color: var(--ink);
  line-height: 1.65;
}

.ingredient-lines {
  min-height: 130px;
  color: #2c3a31;
  font-size: 0.91rem;
}

.steps-list {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.meal-footer {
  margin-top: auto;
  padding-top: 14px;
}

.macro-meters {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.meter-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

.meter-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7eee9;
}

.meter-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--blue));
}

.camera-ready {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.camera-ready p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.camera-mark {
  position: relative;
  flex: 0 0 42px;
  height: 42px;
  border: 2px solid var(--green);
  border-radius: 8px;
}

.camera-mark::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 2px solid var(--green);
  border-radius: 50%;
}

.drink-search {
  display: grid;
  gap: 8px;
  min-width: min(320px, 100%);
}

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

.drink-stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf8;
  padding: 14px;
}

.drink-stat span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
}

.drink-stat strong {
  display: block;
  margin-top: 6px;
  font-size: 1.18rem;
}

.drink-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 18px;
}

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

.drink-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.drink-brand-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.drink-logo {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--brand-bg, #f4f7f5);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
  text-align: center;
}

.drink-logo img {
  max-width: 38px;
  max-height: 38px;
  object-fit: contain;
}

.drink-card h3 {
  margin-bottom: 3px;
  line-height: 1.3;
}

.drink-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.55;
}

.drink-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.drink-tags span {
  border-radius: 999px;
  background: #edf4ef;
  color: var(--muted);
  padding: 4px 8px;
  font-size: 0.74rem;
  font-weight: 800;
}

.sugar-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

.sugar-line strong {
  font-size: 1.5rem;
  line-height: 1;
}

.sugar-line span {
  color: var(--muted);
  font-size: 0.78rem;
}

.cube-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 30px;
}

.cube {
  width: 12px;
  height: 12px;
  border: 1px solid #d6c9bd;
  border-radius: 3px;
  background: linear-gradient(145deg, #fff, #f1e8dc);
  box-shadow: inset -1px -1px 0 rgba(157, 132, 102, 0.18);
}

.cube.more {
  display: grid;
  place-items: center;
  width: auto;
  min-width: 24px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  box-shadow: none;
}

.sugar-alert {
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.8rem;
  font-weight: 900;
}

.sugar-alert.high {
  background: #fff0ec;
  color: #9b382f;
}

.sugar-alert.medium {
  background: #fff7e8;
  color: #8b5a16;
}

.sugar-alert.low {
  background: #eaf5ef;
  color: var(--green-dark);
}

.builder-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 22px;
  margin-top: 20px;
}

.search-row,
.pantry-parser {
  display: grid;
  gap: 8px;
}

label {
  color: #304238;
  font-size: 0.86rem;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
  color: var(--ink);
  outline: none;
}

input {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  padding: 12px;
  line-height: 1.55;
}

input:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 125, 87, 0.12);
}

.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.ingredient-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.84rem;
}

.ingredient-stats span {
  border-radius: 999px;
  background: #edf4ef;
  padding: 5px 10px;
  font-weight: 800;
}

.category-pill {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 0 12px;
  font-size: 0.82rem;
  font-weight: 800;
}

.category-pill.active {
  border-color: var(--blue);
  background: #edf5f8;
  color: var(--blue);
}

.ingredient-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-height: 590px;
  overflow: auto;
  padding-right: 4px;
}

.ingredient-card {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.ingredient-card h3 {
  margin-bottom: 0;
  font-size: 0.98rem;
}

.ingredient-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 0.76rem;
}

.ingredient-meta span {
  border-radius: 999px;
  background: #eef5ef;
  padding: 4px 8px;
}

.ingredient-control {
  display: grid;
  grid-template-columns: minmax(74px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.ingredient-control input {
  min-height: 36px;
}

.basket-zone {
  display: grid;
  gap: 18px;
  align-content: start;
}

.parse-notice {
  min-height: 22px;
  color: var(--muted);
  font-size: 0.84rem;
}

.basket-table-wrap {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.basket-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.basket-head h3 {
  margin: 0;
}

.basket-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 92px 76px 38px;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid #e8eee9;
  padding: 10px 0;
}

.basket-row.header {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.basket-row input {
  min-height: 34px;
  text-align: right;
}

.icon-btn {
  min-height: 34px;
  border: 1px solid #ead3d0;
  border-radius: 8px;
  background: #fff5f4;
  color: var(--red);
  font-weight: 900;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 20px;
  color: var(--muted);
  text-align: center;
}

.custom-dish {
  margin-top: 22px;
}

.dish-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
  padding: 18px;
}

.dish-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
}

.score-badge {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border: 2px solid var(--green);
  border-radius: 50%;
  color: var(--green-dark);
  font-weight: 900;
}

.score-badge span {
  display: block;
  font-size: 1.45rem;
  line-height: 1;
}

.dish-body {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
  margin-top: 16px;
}

.source-section {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.source-copy p {
  margin-bottom: 10px;
  color: var(--muted);
  line-height: 1.7;
}

.source-copy p:last-child {
  margin-bottom: 0;
}

@media (max-width: 1120px) {
  .topbar,
  .health-rank-banner,
  .planner-grid,
  .ai-grid,
  .builder-grid,
  .source-section {
    grid-template-columns: 1fr;
  }

  .app-directory {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .meal-grid {
    grid-template-columns: 1fr;
  }

  .meal-card {
    min-height: auto;
  }

  .ingredient-list {
    max-height: none;
  }

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

@media (max-width: 760px) {
  .app-shell {
    padding-top: 18px;
  }

  .section-heading,
  .section-heading.compact,
  .dish-header,
  .dish-body {
    grid-template-columns: 1fr;
    display: grid;
  }

  .goal-summary,
  .day-totals,
  .analysis-totals,
  .remaining-grid,
  .analysis-food-items,
  .drink-stats,
  .drink-grid,
  .ingredient-list {
    grid-template-columns: 1fr;
  }

  .app-directory {
    grid-template-columns: 1fr;
  }

  .analysis-level {
    grid-template-columns: 1fr;
  }

  .analysis-level strong {
    grid-row: auto;
  }

  .rank-bar-row {
    grid-template-columns: 72px minmax(0, 1fr) 44px;
  }

  .nutrition-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .basket-row {
    grid-template-columns: minmax(0, 1fr) 78px 68px 34px;
    font-size: 0.9rem;
  }

  .food-photo,
  .food-photo img {
    min-height: 180px;
  }
}

/* Product polish layer */
:root {
  --bg: #f4f8f5;
  --surface: #ffffff;
  --surface-soft: #f0f6f2;
  --ink: #14251b;
  --muted: #607267;
  --line: #dce8df;
  --green: #2f8a62;
  --green-dark: #14523a;
  --blue: #2e6d8d;
  --amber: #bb7a25;
  --red: #b5473f;
  --shadow: 0 18px 54px rgba(20, 48, 32, 0.1);
  --shadow-soft: 0 10px 28px rgba(20, 48, 32, 0.07);
}

body {
  background:
    linear-gradient(180deg, rgba(238, 246, 241, 0.96) 0, rgba(247, 250, 247, 0.92) 420px, #f7faf7 100%),
    var(--bg);
}

.app-shell {
  width: min(1360px, 100%);
  padding: 24px clamp(16px, 3.2vw, 42px) 56px clamp(76px, 6vw, 104px);
}

.menu-toggle {
  border-color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 16px 36px rgba(19, 65, 44, 0.18);
}

.menu-toggle:hover {
  background: #fff;
}

.side-nav {
  gap: 8px;
  border-right-color: rgba(222, 234, 225, 0.9);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 250, 246, 0.98)),
    #fff;
}

.side-nav-link {
  border-color: transparent;
  background: transparent;
}

.side-nav-link:hover {
  border-color: #dbe9df;
  background: #f5faf7;
}

.nav-icon {
  background: #edf7f1;
  box-shadow: inset 0 0 0 1px rgba(47, 138, 98, 0.1);
}

.topbar {
  position: relative;
  isolation: isolate;
  display: grid;
  min-height: clamp(430px, 62vh, 620px);
  overflow: hidden;
  border: 1px solid rgba(211, 225, 216, 0.85);
  border-radius: 8px;
  background: #14251b;
  box-shadow: 0 24px 70px rgba(20, 48, 32, 0.16);
}

.topbar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(9, 30, 20, 0.86) 0%, rgba(16, 50, 34, 0.68) 39%, rgba(18, 44, 35, 0.08) 74%),
    linear-gradient(180deg, rgba(8, 24, 16, 0.16), rgba(8, 24, 16, 0.42));
}

.hero-copy {
  position: relative;
  z-index: 2;
  display: grid;
  width: min(680px, 100%);
  align-self: end;
  gap: 18px;
  padding: clamp(28px, 5vw, 62px);
  color: #fff;
}

.topbar .eyebrow {
  color: #a8dfbf;
}

.topbar h1 {
  max-width: 560px;
  margin-bottom: 0;
  color: #fff;
  text-shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
}

.topbar .lead {
  max-width: 560px;
  color: rgba(248, 255, 250, 0.86);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-primary,
.hero-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 8px;
  padding: 0 18px;
  font-weight: 900;
  text-decoration: none;
}

.hero-primary {
  background: #ffffff;
  color: var(--green-dark);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.18);
}

.hero-secondary {
  border: 1px solid rgba(255, 255, 255, 0.36);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  backdrop-filter: blur(10px);
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  max-width: 620px;
}

.hero-metrics div {
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.11);
  padding: 12px;
  backdrop-filter: blur(12px);
}

.hero-metrics strong,
.hero-metrics span {
  display: block;
}

.hero-metrics strong {
  font-size: clamp(1.15rem, 2vw, 1.8rem);
  line-height: 1;
}

.hero-metrics span {
  margin-top: 6px;
  color: rgba(248, 255, 250, 0.78);
  font-size: 0.78rem;
  font-weight: 800;
}

.food-photo {
  position: absolute;
  inset: 0;
  z-index: 0;
  min-height: 100%;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(135deg, #dfeee5, #9cbcab),
    var(--surface-soft);
  box-shadow: none;
}

.food-photo::after {
  display: none;
}

.food-photo img {
  height: 100%;
  min-height: 100%;
  object-fit: cover;
  object-position: center;
  filter: saturate(1.04) contrast(1.02);
}

.food-photo figcaption {
  position: absolute;
  right: clamp(18px, 3vw, 36px);
  bottom: clamp(18px, 3vw, 34px);
  z-index: 3;
  width: min(300px, calc(100% - 36px));
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 8px;
  background: rgba(12, 36, 26, 0.58);
  color: #fff;
  padding: 14px;
  backdrop-filter: blur(14px);
}

.food-photo figcaption strong,
.food-photo figcaption span {
  display: block;
}

.food-photo figcaption span {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.82rem;
}

.health-rank-banner,
.goal-band,
.planner-grid,
.ai-section,
.drink-section,
.builder-section,
.source-section {
  margin-top: clamp(24px, 3vw, 38px);
}

.section-heading {
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(220, 232, 223, 0.88);
}

.section-heading.compact {
  padding-bottom: 14px;
}

.planner-main,
.insight-panel,
.health-rank-banner,
.ai-section,
.drink-section,
.builder-section,
.source-section {
  border-color: rgba(220, 232, 223, 0.92);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
}

.goal-band {
  border: 1px solid rgba(220, 232, 223, 0.78);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(241, 248, 244, 0.82)),
    #fff;
  padding: clamp(18px, 2.4vw, 26px);
  box-shadow: var(--shadow-soft);
}

.goal-btn,
.ghost-btn,
.primary-btn,
.secondary-btn,
.mini-btn,
.category-pill {
  border-radius: 8px;
}

.primary-btn {
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  box-shadow: 0 14px 30px rgba(20, 82, 58, 0.22);
}

.secondary-btn {
  background: #edf6f1;
}

.ghost-btn,
.goal-btn {
  background: #fff;
}

.goal-btn.active {
  background: linear-gradient(135deg, var(--green-dark), var(--green));
}

.goal-stat,
.total-pill,
.analysis-total,
.remaining-grid div,
.analysis-food-item,
.drink-stat,
.ingredient-card,
.dish-card {
  border-color: rgba(220, 232, 223, 0.95);
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(20, 48, 32, 0.04);
}

.health-rank-banner {
  grid-template-columns: 150px minmax(0, 0.9fr) minmax(320px, 1.05fr);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(238, 248, 242, 0.92)),
    #fff;
}

.rank-medal {
  box-shadow:
    0 18px 40px rgba(20, 82, 58, 0.2),
    inset 0 -8px 18px rgba(0, 0, 0, 0.08);
}

.rank-copy h2,
.section-heading h2 {
  line-height: 1.22;
}

.rank-bars {
  background: rgba(247, 251, 248, 0.78);
  border-radius: 8px;
  padding: 14px;
}

.ai-grid,
.builder-grid {
  gap: clamp(18px, 2.4vw, 28px);
}

.ai-input-panel,
.ai-result-panel,
.pantry-parser,
.basket-table-wrap {
  border: 1px solid rgba(220, 232, 223, 0.86);
  border-radius: 8px;
  background: #fbfdfb;
  padding: 16px;
}

.basket-table-wrap {
  border-top: 1px solid rgba(220, 232, 223, 0.86);
}

input,
textarea {
  background: #fff;
}

.analysis-level {
  background:
    linear-gradient(135deg, #eef8f2, #f9fcfa);
  border: 1px solid rgba(220, 232, 223, 0.86);
}

.day-totals,
.drink-stats,
.goal-summary {
  gap: 12px;
}

.meal-grid {
  gap: 16px;
}

.meal-card {
  position: relative;
  overflow: hidden;
  border-color: rgba(220, 232, 223, 0.95);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 253, 251, 0.96));
  box-shadow: 0 14px 32px rgba(20, 48, 32, 0.07);
}

.meal-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--green), var(--blue), #d79b42);
}

.meal-label {
  color: var(--blue);
  letter-spacing: 0.05em;
}

.nutrition-row div {
  background: #eff7f2;
}

.ingredient-lines {
  min-height: 120px;
}

.drink-grid {
  gap: 14px;
}

.drink-card {
  border-color: rgba(220, 232, 223, 0.95);
  box-shadow: 0 12px 26px rgba(20, 48, 32, 0.06);
}

.drink-logo {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.sugar-line strong {
  color: #98382f;
}

.ingredient-list {
  scrollbar-color: rgba(47, 138, 98, 0.35) transparent;
}

.source-section {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(241, 248, 244, 0.9)),
    #fff;
}

@media (max-width: 1120px) {
  .topbar {
    min-height: 560px;
  }

  .hero-copy {
    align-self: end;
  }

  .food-photo figcaption {
    display: none;
  }

  .health-rank-banner {
    grid-template-columns: 128px minmax(0, 1fr);
  }

  .rank-bars {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 72px 14px 42px;
  }

  .menu-toggle {
    top: 14px;
    left: 14px;
  }

  .topbar {
    min-height: 560px;
  }

  .topbar::before {
    background:
      linear-gradient(180deg, rgba(9, 30, 20, 0.24), rgba(9, 30, 20, 0.9) 54%, rgba(9, 30, 20, 0.94)),
      linear-gradient(90deg, rgba(9, 30, 20, 0.38), rgba(9, 30, 20, 0.08));
  }

  .hero-copy {
    gap: 14px;
    padding: 24px;
  }

  .hero-actions {
    display: grid;
  }

  .hero-metrics {
    grid-template-columns: 1fr;
  }

  .hero-metrics div {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: end;
  }

  .hero-metrics span {
    margin-top: 0;
  }

  .health-rank-banner {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .rank-medal-wrap {
    justify-content: start;
  }

  .goal-summary,
  .day-totals,
  .analysis-totals,
  .drink-stats,
  .remaining-grid,
  .analysis-food-items {
    grid-template-columns: 1fr;
  }

  .meal-grid,
  .drink-grid,
  .ingredient-list {
    grid-template-columns: 1fr;
  }
}

/* Feature hub upgrade */
.icon-week::before {
  content: "";
  width: 22px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 5px;
  background:
    linear-gradient(currentColor, currentColor) 4px 6px / 4px 4px no-repeat,
    linear-gradient(currentColor, currentColor) 12px 6px / 4px 4px no-repeat,
    linear-gradient(currentColor, currentColor) 4px 12px / 4px 2px no-repeat,
    transparent;
  box-shadow: inset 0 5px 0 rgba(47, 138, 98, 0.14);
}

.icon-calendar::before {
  content: "";
  width: 22px;
  height: 22px;
  border: 2px solid currentColor;
  border-radius: 6px;
  background:
    linear-gradient(currentColor, currentColor) 0 6px / 100% 2px no-repeat,
    linear-gradient(currentColor, currentColor) 6px 12px / 4px 4px no-repeat,
    linear-gradient(currentColor, currentColor) 14px 12px / 4px 4px no-repeat;
}

.icon-photo::before {
  content: "";
  width: 22px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 5px;
  background: radial-gradient(circle at center, currentColor 0 4px, transparent 5px);
}

.side-nav-link.active {
  border-color: rgba(47, 138, 98, 0.28);
  background: #edf7f1;
  box-shadow: inset 3px 0 0 var(--green);
}

body.panel-mode main > section {
  display: none;
}

body.panel-mode main > section.is-active {
  display: block;
  animation: panelEnter 260ms ease both;
}

body.panel-mode main > .planner-grid.is-active {
  display: grid;
}

@keyframes panelEnter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.weekly-section,
.calendar-section,
.photo-section {
  margin-top: clamp(24px, 3vw, 38px);
  border: 1px solid rgba(220, 232, 223, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  padding: clamp(18px, 2.4vw, 28px);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
}

.weekly-controls {
  display: grid;
  grid-template-columns: minmax(220px, 0.75fr) minmax(160px, 0.45fr) minmax(260px, 1fr);
  gap: 14px;
  align-items: end;
  margin: 18px 0;
}

.weekly-controls label,
.daily-editor label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.weekly-controls select,
.weekly-controls input,
.daily-editor input,
.daily-editor textarea,
.daily-editor select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  font: inherit;
}

.weekly-note {
  border: 1px solid rgba(46, 109, 141, 0.16);
  border-radius: 8px;
  background: #eef7fb;
  padding: 12px;
  color: #315d70;
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1.55;
}

.weekly-plan {
  display: grid;
  grid-template-columns: repeat(7, minmax(190px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.week-day-card {
  min-width: 190px;
  border: 1px solid rgba(220, 232, 223, 0.95);
  border-radius: 8px;
  background:
    linear-gradient(180deg, #ffffff, #f7fbf8);
  padding: 14px;
  box-shadow: 0 10px 22px rgba(20, 48, 32, 0.06);
}

.week-day-head {
  display: grid;
  gap: 5px;
  margin-bottom: 12px;
}

.week-day-head span {
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.week-day-head strong {
  font-size: 1.02rem;
}

.week-day-head small {
  color: var(--muted);
  line-height: 1.45;
}

.week-meals {
  display: grid;
  gap: 9px;
}

.week-meals div {
  display: grid;
  gap: 3px;
  border-top: 1px solid rgba(220, 232, 223, 0.8);
  padding-top: 9px;
}

.week-meals span,
.week-nutrition span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
}

.week-meals strong {
  line-height: 1.35;
}

.week-nutrition {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.week-nutrition span {
  border-radius: 999px;
  background: #edf7f1;
  padding: 5px 8px;
  color: var(--green-dark);
}

.substitution-panel {
  margin-top: 14px;
}

.substitution-panel:empty {
  display: none;
}

.substitution-panel h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

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

.substitution-grid article {
  border: 1px solid rgba(47, 138, 98, 0.16);
  border-radius: 8px;
  background: #f3faf6;
  padding: 12px;
}

.substitution-grid strong {
  display: block;
  color: var(--green-dark);
  line-height: 1.35;
}

.substitution-grid p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

.calendar-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.55fr);
  gap: 14px;
  margin: 18px 0;
}

.rank-panel {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 10px;
}

.rank-window {
  position: relative;
  overflow: hidden;
  min-height: 112px;
  border: 1px solid rgba(220, 232, 223, 0.9);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  box-shadow: 0 10px 22px rgba(20, 48, 32, 0.06);
}

.rank-window::after {
  content: "";
  position: absolute;
  right: -24px;
  bottom: -24px;
  width: 82px;
  height: 82px;
  border-radius: 50%;
  opacity: 0.15;
  background: currentColor;
}

.rank-window span,
.rank-window em {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 900;
}

.rank-window strong {
  display: block;
  margin: 10px 0 8px;
  line-height: 1.28;
}

.rank-master {
  color: #236f50;
}

.rank-diamond {
  color: #2e6d8d;
}

.rank-gold {
  color: #a66a19;
}

.rank-silver {
  color: #627482;
}

.rank-bronze {
  color: #8a6548;
}

.streak-card {
  height: 100%;
  border: 1px solid rgba(47, 138, 98, 0.16);
  border-radius: 8px;
  background:
    radial-gradient(circle at 88% 20%, rgba(232, 200, 91, 0.24), transparent 34%),
    linear-gradient(135deg, #113928, #2f8a62);
  padding: 18px;
  color: #fff;
  box-shadow: 0 16px 34px rgba(20, 82, 58, 0.18);
}

.streak-card span,
.streak-card small {
  color: rgba(255, 255, 255, 0.78);
  font-weight: 900;
}

.streak-card strong {
  display: block;
  margin: 6px 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
}

.streak-card p {
  margin: 0 0 14px;
  color: rgba(255, 255, 255, 0.84);
  line-height: 1.55;
}

.streak-track {
  overflow: hidden;
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
}

.streak-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #fff, #e7c75b);
}

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(430px, 1fr) minmax(300px, 0.48fr);
  gap: 18px;
}

.calendar-toolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.calendar-toolbar strong {
  text-align: center;
  font-size: 1.05rem;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(58px, 1fr));
  gap: 8px;
}

.calendar-weekday {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 1000;
  text-align: center;
}

.calendar-cell {
  min-height: 72px;
  border: 1px solid rgba(220, 232, 223, 0.92);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 9px;
  text-align: left;
  cursor: pointer;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease;
}

.calendar-cell:hover {
  border-color: rgba(47, 138, 98, 0.34);
  transform: translateY(-2px);
}

.calendar-cell strong,
.calendar-cell span {
  display: block;
}

.calendar-cell span {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
}

.calendar-cell.active {
  border-color: var(--green);
  background: #edf7f1;
}

.calendar-cell.checked {
  box-shadow: inset 0 -4px 0 rgba(47, 138, 98, 0.32);
}

.calendar-cell.muted {
  background: transparent;
  box-shadow: none;
  cursor: default;
}

.daily-editor {
  display: grid;
  align-content: start;
  gap: 12px;
  border: 1px solid rgba(220, 232, 223, 0.92);
  border-radius: 8px;
  background: #fbfdfb;
  padding: 16px;
}

.day-score-panel {
  border-radius: 8px;
  background: #edf7f1;
  padding: 14px;
}

.day-score-panel strong,
.day-score-panel span {
  display: block;
}

.day-score-panel strong {
  color: var(--green-dark);
  font-size: 1.7rem;
  line-height: 1;
}

.day-score-panel span {
  margin-top: 6px;
  font-weight: 1000;
}

.day-score-panel p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.badge-animation {
  position: fixed;
  inset: auto 18px 18px auto;
  z-index: 40;
  width: min(380px, calc(100vw - 36px));
  pointer-events: none;
}

.badge-burst {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 8px;
  background:
    radial-gradient(circle at 18% 24%, rgba(255, 255, 255, 0.32), transparent 22%),
    linear-gradient(135deg, #103a2a, #2f8a62);
  padding: 18px;
  color: #fff;
  box-shadow: 0 22px 48px rgba(20, 82, 58, 0.26);
  animation: badgePop 520ms ease both;
}

.badge-burst strong,
.badge-burst span {
  position: relative;
  z-index: 2;
  display: block;
}

.badge-burst strong {
  font-size: 1.05rem;
}

.badge-burst span {
  margin-top: 7px;
  color: rgba(255, 255, 255, 0.78);
}

.badge-burst i {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #e7c75b;
  animation: spark 1400ms ease infinite;
}

.badge-burst i:nth-child(3) {
  left: 26px;
  top: 22px;
}

.badge-burst i:nth-child(4) {
  right: 42px;
  top: 28px;
  animation-delay: 180ms;
}

.badge-burst i:nth-child(5) {
  left: 46%;
  bottom: 18px;
  animation-delay: 320ms;
}

.badge-burst i:nth-child(6) {
  right: 18px;
  bottom: 32px;
  animation-delay: 500ms;
}

@keyframes badgePop {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes spark {
  0%,
  100% {
    opacity: 0.28;
    transform: translateY(0) scale(0.72);
  }

  45% {
    opacity: 1;
    transform: translateY(-14px) scale(1.18);
  }
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid rgba(46, 109, 141, 0.2);
  border-radius: 999px;
  background: #eef7fb;
  padding: 0 12px;
  color: #315d70;
  font-size: 0.78rem;
  font-weight: 1000;
}

.photo-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.55fr) minmax(300px, 1fr);
  gap: 16px;
  margin-top: 18px;
}

.photo-drop {
  display: grid;
  place-items: center;
  min-height: 260px;
  border: 2px dashed rgba(47, 138, 98, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(237, 247, 241, 0.94), rgba(248, 252, 249, 0.9));
  padding: 22px;
  text-align: center;
  cursor: pointer;
}

.photo-drop input {
  width: min(100%, 260px);
  border: 1px solid rgba(47, 138, 98, 0.2);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.photo-drop strong,
.photo-drop span {
  display: block;
}

.photo-drop strong {
  margin-top: 12px;
  font-size: 1.1rem;
}

.photo-drop span {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.6;
}

.photo-preview {
  display: grid;
  align-content: center;
  min-height: 260px;
  overflow: hidden;
  border: 1px solid rgba(220, 232, 223, 0.92);
  border-radius: 8px;
  background: #fbfdfb;
}

.photo-preview img {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
}

.photo-preview > div:not(.empty-state) {
  padding: 14px;
}

.photo-preview strong {
  display: block;
  color: var(--green-dark);
}

.photo-preview p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

@media (max-width: 1180px) {
  .weekly-controls,
  .calendar-dashboard,
  .calendar-layout,
  .photo-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  .weekly-section,
  .calendar-section,
  .photo-section {
    padding: 16px;
  }

  .weekly-plan {
    grid-template-columns: 1fr;
    overflow-x: visible;
  }

  .calendar-grid {
    grid-template-columns: repeat(7, minmax(36px, 1fr));
    gap: 5px;
  }

  .calendar-cell {
    min-height: 56px;
    padding: 6px;
  }

  .calendar-cell span {
    margin-top: 7px;
    font-size: 0.66rem;
  }

  .rank-panel {
    grid-template-columns: 1fr;
  }

  .calendar-toolbar {
    grid-template-columns: 1fr;
  }

  .calendar-toolbar strong {
    order: -1;
  }

  .badge-animation {
    inset: auto 12px 12px 12px;
    width: auto;
  }
}
