:root {
  --bg-1: #f3f7f4;
  --bg-2: #e7f0ea;
  --ink: #1c2b24;
  --muted: #5c6f65;
  --brand: #1a5c45;
  --brand-deep: #0f3d2e;
  --accent: #c4783a;
  --surface: rgba(255, 255, 255, 0.78);
  --line: rgba(26, 92, 69, 0.14);
  --shadow: 0 18px 50px rgba(15, 61, 46, 0.08);
  --radius: 22px;
  --font-display: "ZCOOL XiaoWei", "Noto Serif SC", serif;
  --font-body: "Noto Sans SC", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg-1);
  line-height: 1.6;
  overflow-x: hidden;
}

.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(196, 120, 58, 0.18), transparent 55%),
    radial-gradient(ellipse 70% 45% at 100% 0%, rgba(26, 92, 69, 0.16), transparent 50%),
    linear-gradient(165deg, #f7faf8 0%, #eaf3ee 45%, #f2f0e8 100%);
}

.page-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.35) 0 1px, transparent 1.5px),
    radial-gradient(circle at 80% 70%, rgba(26, 92, 69, 0.08) 0 1px, transparent 1.5px);
  background-size: 48px 48px, 36px 36px;
  opacity: 0.7;
  pointer-events: none;
}

.site-header {
  padding: 1.25rem 0 0.5rem;
}

.header-inner {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.brand {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  color: var(--brand);
  text-decoration: none;
  letter-spacing: 0.04em;
  animation: fade-up 0.7s ease both;
}

.brand-tag {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  animation: fade-up 0.7s ease 0.08s both;
}

.main-wrap {
  max-width: 720px;
  padding-bottom: 4rem;
}

.hero {
  padding: 2.5rem 0 1.5rem;
  text-align: center;
  animation: fade-up 0.75s ease 0.12s both;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(3rem, 12vw, 4.5rem);
  color: var(--brand-deep);
  letter-spacing: 0.08em;
  margin: 0 0 0.75rem;
  line-height: 1.1;
}

.hero-desc {
  margin: 0 auto 1.75rem;
  max-width: 28rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.cta-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.btn-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.7rem 1.35rem;
  border-radius: 999px;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.btn-primary {
  --bs-btn-bg: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand-deep);
  --bs-btn-hover-border-color: var(--brand-deep);
  --bs-btn-active-bg: var(--brand-deep);
  --bs-btn-active-border-color: var(--brand-deep);
}

.btn-outline-primary {
  --bs-btn-color: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand);
  --bs-btn-hover-border-color: var(--brand);
  --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: var(--brand-deep);
  --bs-btn-active-border-color: var(--brand-deep);
  background: rgba(255, 255, 255, 0.55);
}

.btn-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(26, 92, 69, 0.18);
}

.config-hint {
  margin: 1.25rem auto 0;
  max-width: 28rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: rgba(196, 120, 58, 0.12);
  color: #7a4a1f;
  font-size: 0.88rem;
}

.config-hint code {
  font-size: 0.82rem;
  color: var(--brand-deep);
}

.preview-section,
.result-section {
  margin-top: 1.5rem;
  animation: fade-up 0.5s ease both;
}

.preview-frame {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: #0f3d2e;
  box-shadow: var(--shadow);
  aspect-ratio: 4 / 3;
}

.preview-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  animation: soft-zoom 0.6s ease both;
}

.btn-clear {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(28, 43, 36, 0.55);
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

.btn-analyze {
  width: 100%;
  margin-top: 1rem;
  min-height: 50px;
  border-radius: 14px;
  font-weight: 600;
  font-size: 1.05rem;
}

.result-header {
  text-align: center;
  margin-bottom: 1.25rem;
}

.result-title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  color: var(--brand-deep);
  margin: 0 0 0.35rem;
}

.result-summary {
  margin: 0;
  color: var(--muted);
}

.nutri-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

@media (min-width: 576px) {
  .nutri-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.nutri-item {
  padding: 1rem 0.75rem;
  text-align: center;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  animation: fade-up 0.45s ease both;
}

.nutri-item:nth-child(1) { animation-delay: 0.05s; }
.nutri-item:nth-child(2) { animation-delay: 0.1s; }
.nutri-item:nth-child(3) { animation-delay: 0.15s; }
.nutri-item:nth-child(4) { animation-delay: 0.2s; }
.nutri-item:nth-child(5) { animation-delay: 0.25s; }
.nutri-item:nth-child(6) { animation-delay: 0.3s; }

.nutri-value {
  display: block;
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: -0.02em;
}

.nutri-label {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.ingredients-block,
.tips-block {
  margin-top: 1.5rem;
  padding: 1.15rem 1.2rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.block-title {
  font-size: 1rem;
  font-weight: 650;
  margin: 0 0 0.75rem;
  color: var(--brand-deep);
}

.ingredient-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ingredient-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}

.ingredient-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.ingredient-list .meta {
  color: var(--muted);
  white-space: nowrap;
}

.tips-block p {
  margin: 0;
  color: var(--muted);
}

.disclaimer {
  margin: 1rem 0 0;
  font-size: 0.78rem;
  color: #8a9a90;
  text-align: center;
}

#errorBox {
  margin-top: 1.25rem;
  border-radius: 12px;
  font-size: 0.95rem;
  word-break: break-word;
}

.site-footer {
  padding: 1.5rem 0 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.site-footer p {
  margin: 0;
}

.is-analyzing .btn-analyze {
  pointer-events: none;
  opacity: 0.85;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes soft-zoom {
  from {
    opacity: 0.4;
    transform: scale(1.04);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
