* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --green: #2f8f5b;
  --green-dark: #1f6b42;
  --green-soft: #e8f3ec;
  --ink: #243029;
  --muted: #7c8b81;
  --bad: #e2574c;
  --warn: #e0a23a;
  --good: #2f8f5b;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  /* 更精致的浅色背景：柔和叠加渐变 */
  background:
    radial-gradient(900px 500px at 85% -5%, #d7ede0 0%, transparent 60%),
    radial-gradient(700px 400px at 110% 100%, #e6f2ea 0%, transparent 55%),
    #f5f8f6;
  min-height: 100vh;
}

.back-home {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 999;
  padding: 8px 14px;
  background: rgba(255,255,255,0.95);
  color: var(--green-dark);
  text-decoration: none;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
  transition: transform 0.2s, background 0.2s;
}

.back-home:hover {
  background: #fff;
  transform: translateY(-2px);
}

/* 整体布局：左栏 + 右内容 */
.app {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
  max-width: 1180px;
  margin: 0 auto;
}

/* ---------- 左侧栏 ---------- */
.sidebar {
  width: 340px;
  flex-shrink: 0;
  background: linear-gradient(170deg, var(--green) 0%, var(--green-dark) 100%);
  color: #fff;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  box-shadow: 4px 0 24px rgba(31, 107, 66, 0.18);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand .logo {
  font-size: 38px;
  line-height: 1;
}

.brand h1 {
  font-size: 26px;
  letter-spacing: 1px;
}

.subtitle {
  margin-top: 4px;
  font-size: 13px;
  opacity: 0.88;
}

.block-title {
  font-size: 14px;
  font-weight: 700;
  opacity: 0.92;
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}

/* 上传区 */
.upload-zone {
  background: rgba(255, 255, 255, 0.12);
  border: 2px dashed rgba(255, 255, 255, 0.55);
  border-radius: 14px;
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  overflow: hidden;
}

.upload-zone.dragover {
  background: rgba(255, 255, 255, 0.22);
  border-color: #fff;
}

.upload-inner {
  text-align: center;
}

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

.upload-text {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 600;
}

.preview {
  display: none;
  max-width: 100%;
  max-height: 220px;
  border-radius: 10px;
}

/* 多图缩略图网格 */
.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 6px;
  width: 100%;
}

.thumb {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
}

.thumb img {
  display: block;
  width: 100%;
  height: 64px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.12);
}

.thumb-badge {
  position: absolute;
  right: 3px;
  bottom: 3px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 999px;
}

.thumb-badge.ok {
  background: rgba(47, 143, 91, 0.9);
}

.upload-text small {
  display: inline-block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 400;
  opacity: 0.8;
}

.btn-text {
  margin-top: 10px;
  background: none;
  border: none;
  color: #fff;
  text-decoration: underline;
  font-size: 13px;
  cursor: pointer;
  opacity: 0.9;
}

/* 识别状态 */
.status {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 8px;
}

.manual {
  margin-top: 10px;
}

/* 进度条 */
.progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.progress-track {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: #fff;
  border-radius: 999px;
  transition: width 0.25s ease;
}

.progress-pct {
  font-size: 12px;
  min-width: 36px;
  text-align: right;
  opacity: 0.92;
}

/* 搜索框 */
.search {
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 12px;
  outline: none;
}

/* 食物标签 */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.chip {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.chip:hover {
  background: rgba(255, 255, 255, 0.32);
  transform: translateY(-1px);
}

.chip.active {
  background: #fff;
  color: var(--green-dark);
  font-weight: 700;
}

/* ---------- 右侧内容 ---------- */
.content {
  flex: 1;
  padding: 36px 40px;
}

.content-title {
  font-size: 18px;
  color: var(--green-dark);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.content-title::before {
  content: "🤖";
}

.answer {
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 8px 28px rgba(31, 107, 66, 0.1);
  min-height: 320px;
}

.placeholder {
  text-align: center;
  color: var(--muted);
  padding: 50px 0;
  line-height: 1.8;
}

.placeholder-icon {
  font-size: 52px;
  margin-bottom: 14px;
}

/* 食物结果卡片 */
.food-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid #eef2ef;
  margin-bottom: 18px;
}

.food-emoji {
  font-size: 46px;
}

.food-name {
  font-size: 24px;
  font-weight: 700;
}

.food-cat {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.badge {
  margin-left: auto;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.badge.good { background: var(--good); }
.badge.warn { background: var(--warn); }
.badge.bad  { background: var(--bad); }

.auto-tag {
  display: inline-block;
  font-size: 12px;
  color: var(--muted);
  background: var(--green-soft);
  border-radius: 8px;
  padding: 5px 10px;
  margin-bottom: 16px;
}

/* 对错反馈 + 学习 */
.feedback {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #eef2ef;
}

.fb-q {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.fb-btn {
  border: 1px solid #cfe3d6;
  background: #fff;
  color: var(--green-dark);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.fb-btn:hover {
  background: var(--green-soft);
  transform: translateY(-1px);
}

.fb-msg {
  font-size: 14px;
  font-weight: 700;
  color: var(--green-dark);
}

.learn-stat {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

.stats {
  display: flex;
  gap: 14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.stat {
  background: var(--green-soft);
  border-radius: 12px;
  padding: 14px 18px;
  flex: 1;
  min-width: 130px;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--green-dark);
  margin-top: 4px;
}

.section-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin: 18px 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.answer p.text {
  font-size: 15px;
  line-height: 1.7;
  color: #3a4a40;
}

.solution {
  background: #fff7ec;
  border-left: 4px solid var(--warn);
  border-radius: 0 10px 10px 0;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.7;
  color: #6b5326;
}

.solution.good-note {
  background: var(--green-soft);
  border-left-color: var(--good);
  color: #2a5b3f;
}

/* 多图结果列表 */
.multi-head {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 16px;
}

.result-card + .result-card {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px dashed #e3ece6;
}

/* 响应式：窄屏堆叠 */
@media (max-width: 820px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; }
}
