/* =========================================================
 * AI 公益营养师 · 丝滑玻璃拟态风格
 * ---------------------------------------------------------
 * 设计原则：
 *   1. 玻璃拟态 (Glassmorphism) — 半透明 + 背景模糊
 *   2. 弹性过渡 — 使用 cubic-bezier 获得物理感
 *   3. 分层阴影 — 多层阴影模拟真实光源
 *   4. 微交互 — hover / focus / active 都有专属反馈
 *   5. 入场动画 — 页面加载后各面板依次淡入
 * ========================================================= */

/* ----------------------------------------------------------
 * 0. 设计令牌 — 统一色板、圆角、阴影、缓动曲线
 * ---------------------------------------------------------- */

:root {
  /* 色板 — 更柔和、更通透 */
  --bg: #eef4ef;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --surface-2: #f8fbf8;
  --ink: #16211c;
  --ink-soft: #2d3b33;
  --muted: #5d6f66;
  --muted-soft: #8a9c91;
  --line: rgba(184, 201, 192, 0.55);
  --line-strong: #b8c9c0;
  --accent: #1f7a53;
  --accent-soft: #e3f2ea;
  --accent-strong: #165d3f;
  --accent-glow: rgba(31, 122, 83, 0.25);
  --accent-2: #f1b94d;
  --accent-2-soft: #fdf3dd;
  --danger: #b04235;
  --danger-soft: #fbeee8;

  /* 阴影 — 三层叠加模拟真实光照（近光、远光、环境光） */
  --shadow-sm:
    0 1px 2px rgba(25, 54, 39, 0.06),
    0 2px 6px rgba(25, 54, 39, 0.04);
  --shadow:
    0 4px 12px rgba(25, 54, 39, 0.06),
    0 16px 40px rgba(25, 54, 39, 0.10),
    0 2px 4px rgba(25, 54, 39, 0.04);
  --shadow-soft:
    0 2px 8px rgba(25, 54, 39, 0.05),
    0 12px 28px rgba(25, 54, 39, 0.08);
  --shadow-lift:
    0 8px 20px rgba(25, 54, 39, 0.08),
    0 24px 60px rgba(25, 54, 39, 0.12);

  /* 圆角层级 */
  --radius: 10px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  /* 统一缓动曲线 — 弹性但克制，避免晃眼 */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);       /* 标准出入 */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);    /* 快速弹入 */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1); /* 轻微回弹 */

  /* 过渡时长 */
  --dur-fast: 160ms;
  --dur: 280ms;
  --dur-slow: 520ms;

  /* 玻璃边框：高光 + 阴影 */
  --glass-border: 1px solid rgba(255, 255, 255, 0.5);
  --glass-border-soft: 1px solid rgba(184, 201, 192, 0.4);
}

/* ----------------------------------------------------------
 * 1. 基础重置与全局样式
 * ---------------------------------------------------------- */

* {
  box-sizing: border-box;
}

*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
  /* 多层渐变背景 — 柔和的光斑营造空气感 */
  background:
    radial-gradient(circle at 15% 12%, rgba(31, 122, 83, 0.10), transparent 32rem),
    radial-gradient(circle at 88% 18%, rgba(241, 185, 77, 0.10), transparent 26rem),
    radial-gradient(circle at 50% 110%, rgba(31, 122, 83, 0.08), transparent 34rem),
    linear-gradient(180deg, #f8fbf9 0%, #e8f0ea 100%);
}

/* 背景装饰：缓慢漂浮的光斑，营造呼吸感 */
body::before,
body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(60px);
  opacity: 0.35;
  z-index: 0;
}

body::before {
  width: 420px;
  height: 420px;
  top: -120px;
  left: -80px;
  background: radial-gradient(circle, rgba(31, 122, 83, 0.35), transparent 70%);
  animation: float-orbs 18s var(--ease) infinite;
}

body::after {
  width: 380px;
  height: 380px;
  bottom: -140px;
  right: -60px;
  background: radial-gradient(circle, rgba(241, 185, 77, 0.30), transparent 70%);
  animation: float-orbs 22s var(--ease) infinite reverse;
}

@keyframes float-orbs {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.06); }
  66% { transform: translate(-20px, 30px) scale(0.96); }
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
}

:focus-visible {
  outline: 3px solid rgba(31, 122, 83, 0.22);
  outline-offset: 3px;
  border-radius: var(--radius);
}

::selection {
  background: rgba(31, 122, 83, 0.18);
  color: var(--ink);
}

/* ----------------------------------------------------------
 * 2. 主布局 — shell + sidebar + workspace
 * ---------------------------------------------------------- */

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 24px;
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 24px;
  position: relative;
  z-index: 1;
}

/* —— 侧边栏：强玻璃效果 —— */

.sidebar {
  position: sticky;
  top: 24px;
  align-self: start;
  min-height: calc(100dvh - 48px);
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 20px;
  background: var(--surface);
  border: var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  position: sticky;
  overflow: hidden;
}

/* 侧边栏内发光顶边 */
.sidebar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.9), transparent);
}

/* Brand 区块 */

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

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #2d8f66 55%, #49a37b);
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  box-shadow:
    0 6px 14px var(--accent-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform var(--dur) var(--ease-spring), box-shadow var(--dur) var(--ease);
}

.brand-mark:hover {
  transform: rotate(-4deg) scale(1.06);
  box-shadow:
    0 10px 22px var(--accent-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.brand strong {
  display: block;
  font-size: 16px;
  color: var(--ink);
}

.brand span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
}

/* —— 导航 —— */

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 600;
  position: relative;
  transition:
    transform var(--dur) var(--ease),
    background-color var(--dur) var(--ease),
    color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
  touch-action: manipulation;
  will-change: transform;
}

.nav-item::before {
  /* 激活态的左侧高亮条 */
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  height: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  border-radius: 0 3px 3px 0;
  transform: translateY(-50%);
  transition: height var(--dur) var(--ease-out);
}

.nav-item:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
  transform: translateX(3px);
}

.nav-item.active {
  background: linear-gradient(135deg, var(--accent-soft), #f3faf5);
  color: var(--accent-strong);
  box-shadow:
    inset 0 0 0 1px rgba(31, 122, 83, 0.14),
    0 4px 14px rgba(31, 122, 83, 0.08);
  transform: translateX(4px);
}

.nav-item.active::before {
  height: 22px;
}

.nav-item:active {
  transform: translateX(2px) scale(0.98);
}

/* 侧边栏底部提示卡 */

.sidebar-note {
  margin-top: auto;
  padding: 16px;
  background: linear-gradient(180deg, #fff9eb, #fdf3dd);
  border: 1px solid #f3dca0;
  border-radius: 14px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 4px 12px rgba(241, 185, 77, 0.12);
  transition: transform var(--dur) var(--ease);
}

.sidebar-note:hover {
  transform: translateY(-2px);
}

.sidebar-note strong {
  color: #7a5a12;
  font-size: 13px;
}

.sidebar-note p {
  margin: 6px 0 0;
  color: #77633a;
  font-size: 12.5px;
  line-height: 1.6;
}

/* —— 主工作区 —— */

.workspace {
  display: grid;
  gap: 22px;
  min-width: 0;
}

/* 顶栏和面板通用：玻璃质感 */

.topbar,
.panel {
  background: var(--surface);
  border: var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  position: relative;
  overflow: hidden;
  /* 入场动画由 GSAP 控制，CSS 只设置初始不可见状态 */
  opacity: 0;
}

/* 顶栏 */

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 26px 32px;
}

/* 面板顶部高光边 */

.topbar::after,
.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.85), transparent 72%);
  pointer-events: none;
}

/* 面板容器 */

.panel {
  padding: 28px;
}

/* ----------------------------------------------------------
 * 3. 标题与文字层级
 * ---------------------------------------------------------- */

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

h1 {
  margin-bottom: 6px;
  font-size: clamp(28px, 3.4vw, 42px);
  font-weight: 750;
  letter-spacing: -0.01em;
  line-height: 1.1;
  background: linear-gradient(135deg, var(--ink) 0%, var(--accent-strong) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

h2 {
  margin-bottom: 6px;
  font-size: clamp(22px, 2vw, 28px);
  font-weight: 700;
  letter-spacing: -0.005em;
  line-height: 1.2;
  color: var(--ink);
}

h3 {
  margin-bottom: 8px;
  font-size: 19px;
  font-weight: 700;
}

.topbar p,
.panel-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

/* 标题行容器 */

.panel-heading,
.result-main,
.plan-header,
.chart-title,
.button-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

/* ----------------------------------------------------------
 * 4. 状态徽标（右上角药丸）
 * ---------------------------------------------------------- */

.status-pill {
  min-width: 112px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  background: var(--surface-solid);
  position: relative;
  transition:
    transform var(--dur) var(--ease),
    border-color var(--dur) var(--ease),
    background-color var(--dur) var(--ease),
    color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}

.status-pill::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
  background: var(--muted-soft);
  transition: background-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.status-pill.ready {
  background: linear-gradient(135deg, #eaf6ee, #d6f0df);
  color: var(--accent-strong);
  border-color: rgba(31, 122, 83, 0.22);
  box-shadow: 0 2px 10px var(--accent-glow);
  animation: pulse-green 3.2s var(--ease) infinite;
}

.status-pill.ready::before {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 122, 83, 0.18);
}

.status-pill.demo {
  background: linear-gradient(135deg, #fff8e6, #fef0c2);
  color: #7a5a12;
  border-color: rgba(241, 185, 77, 0.35);
  box-shadow: 0 2px 10px rgba(241, 185, 77, 0.16);
}

.status-pill.demo::before {
  background: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(241, 185, 77, 0.22);
  animation: pulse-amber 2.6s var(--ease) infinite;
}

.status-pill.error {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(176, 66, 53, 0.3);
}

.status-pill.error::before {
  background: var(--danger);
}

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 2px 10px var(--accent-glow); }
  50% { box-shadow: 0 4px 18px rgba(31, 122, 83, 0.28); }
}

@keyframes pulse-amber {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

/* ----------------------------------------------------------
 * 5. 食物识别区（上传 / 预览 / 分析）
 * ---------------------------------------------------------- */

.recognition-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(280px, 1.1fr);
  gap: 20px;
  margin-top: 24px;
}

/* 上传区：大而醒目，支持拖拽 */

.upload-zone {
  position: relative;
  min-height: 340px;
  display: grid;
  place-items: center;
  border: 2px dashed rgba(31, 122, 83, 0.28);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(31, 122, 83, 0.04), rgba(241, 185, 77, 0.05)),
    var(--surface-solid);
  overflow: hidden;
  cursor: pointer;
  transition:
    border-color var(--dur) var(--ease),
    transform var(--dur) var(--ease-spring),
    box-shadow var(--dur) var(--ease),
    background var(--dur) var(--ease);
}

.upload-zone::before {
  /* 扫光效果 */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 30%, rgba(31, 122, 83, 0.06) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 700ms var(--ease-out);
  pointer-events: none;
}

.upload-zone:hover {
  border-color: rgba(31, 122, 83, 0.45);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
}

.upload-zone:hover::before {
  transform: translateX(100%);
}

.upload-zone.dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.015);
  box-shadow:
    0 0 0 4px rgba(31, 122, 83, 0.12),
    var(--shadow-lift);
}

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* 上传区中央图标与文字 */

.upload-empty {
  display: grid;
  gap: 10px;
  place-items: center;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  transition: transform var(--dur) var(--ease-spring), opacity var(--dur) var(--ease);
  pointer-events: none;
}

.upload-zone:hover .upload-empty {
  transform: translateY(-3px);
}

.upload-empty strong {
  color: var(--ink);
  font-size: 16.5px;
  font-weight: 700;
}

.upload-empty small {
  font-size: 12.5px;
  color: var(--muted-soft);
}

/* 大号上传图标 */

.upload-icon {
  display: grid;
  width: 62px;
  height: 62px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #2b9969);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  box-shadow:
    0 10px 22px var(--accent-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  animation: breathe-icon 3.6s var(--ease) infinite;
}

@keyframes breathe-icon {
  0%, 100% { transform: scale(1); box-shadow: 0 10px 22px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
  50% { transform: scale(1.04); box-shadow: 0 14px 30px rgba(31, 122, 83, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
}

/* 图片预览：柔和的圆角 + 边缘高光 */

#imagePreview {
  width: 100%;
  height: 100%;
  min-height: 340px;
  object-fit: cover;
  transition: transform var(--dur-slow) var(--ease-out), filter var(--dur) var(--ease);
  animation: image-pop 400ms var(--ease-out);
}

#imagePreview:hover {
  transform: scale(1.02);
  filter: saturate(1.1);
}

@keyframes image-pop {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1.001); opacity: 1; }
}

/* 分析表单（右侧） */

.analysis-form,
.chat-form {
  display: grid;
  align-content: start;
  gap: 14px;
}

/* ----------------------------------------------------------
 * 6. 表单元素 — label / input / select / textarea
 * ---------------------------------------------------------- */

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: color var(--dur) var(--ease);
}

label:has(input:focus-visible),
label:has(textarea:focus-visible),
label:has(select:focus-visible) {
  color: var(--accent-strong);
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-solid);
  color: var(--ink);
  outline: none;
  font-size: 14.5px;
  transition:
    border-color var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease);
}

textarea {
  resize: vertical;
  min-height: 92px;
  line-height: 1.6;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted-soft);
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--line-strong);
  background: #fdfefd;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow:
    0 0 0 4px rgba(31, 122, 83, 0.12),
    0 1px 2px rgba(25, 54, 39, 0.04);
  transform: translateY(-1px);
}

/* 自定义下拉箭头 */

select {
  appearance: none;
  -webkit-appearance: none;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235d6f66' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
  cursor: pointer;
}

/* ----------------------------------------------------------
 * 7. 按钮三态 — 主按钮 / 次按钮 / 幽灵按钮
 * ---------------------------------------------------------- */

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
  border-radius: var(--radius);
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.005em;
  position: relative;
  overflow: hidden;
  touch-action: manipulation;
  transition:
    transform var(--dur) var(--ease-spring),
    box-shadow var(--dur) var(--ease),
    background-position var(--dur-slow) var(--ease),
    opacity var(--dur-fast) var(--ease),
    filter var(--dur) var(--ease);
  will-change: transform;
}

/* —— 主按钮：主色渐变 + 上浮 + 光晕 —— */

.primary-button {
  background: linear-gradient(135deg, var(--accent), #2d8f66 55%, #49a37b);
  background-size: 180% 180%;
  background-position: 0% 0%;
  color: #fff;
  border: 1px solid rgba(31, 122, 83, 0.2);
  box-shadow:
    0 6px 16px var(--accent-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.primary-button:hover {
  transform: translateY(-2px);
  background-position: 100% 100%;
  box-shadow:
    0 12px 28px rgba(31, 122, 83, 0.30),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.primary-button:active {
  transform: translateY(0) scale(0.97);
  box-shadow:
    0 4px 10px rgba(31, 122, 83, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* —— 次按钮：深色玻璃 —— */

.secondary-button {
  background: linear-gradient(135deg, #1f2d26, #2d3b33);
  color: #fff;
  box-shadow:
    0 6px 16px rgba(21, 33, 27, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.secondary-button:hover {
  transform: translateY(-2px);
  box-shadow:
    0 12px 26px rgba(21, 33, 27, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.secondary-button:active {
  transform: translateY(0) scale(0.97);
}

/* —— 幽灵按钮：玻璃质感 —— */

.ghost-button {
  background: var(--surface-solid);
  color: var(--accent-strong);
  border: 1.5px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.ghost-button:hover {
  transform: translateY(-2px);
  background: var(--accent-soft);
  border-color: rgba(31, 122, 83, 0.32);
  box-shadow:
    0 8px 18px rgba(31, 122, 83, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.ghost-button:active {
  transform: translateY(0) scale(0.97);
}

/* —— 禁用态 —— */

button:disabled {
  cursor: not-allowed !important;
  opacity: 0.62 !important;
  transform: none !important;
  box-shadow: none !important;
  filter: saturate(0.7);
}

/* —— 加载态：脉动点 —— */

button.is-loading::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  margin-left: 2px;
  animation: loading-dots 1.1s var(--ease) infinite;
  opacity: 0.85;
}

@keyframes loading-dots {
  0%, 80%, 100% { transform: scale(0.5); opacity: 0.3; }
  40% { transform: scale(1.1); opacity: 1; }
}

/* ----------------------------------------------------------
 * 8. 结果卡 — 食物识别结果 / 饮食计划 / 问答答案
 * ---------------------------------------------------------- */

.result-card,
.plan-output,
.answer-card {
  margin-top: 22px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(248, 251, 248, 0.85)),
    var(--surface-solid);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  /* 入场动画由 GSAP 控制 */
}

.result-main h3,
.plan-header h3 {
  margin: 4px 0 4px;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
}

.eyebrow {
  display: block;
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result-main p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

/* 卡路里环形展示 */

.calorie-ring,
.target-card {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 122px;
  height: 122px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #fff 60%, transparent 61%),
    conic-gradient(var(--accent) 0 var(--ring-progress, 74%), #d9e5de var(--ring-progress, 74%) 100%);
  color: var(--ink);
  text-align: center;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 10px 24px rgba(25, 54, 39, 0.12),
    0 2px 6px rgba(25, 54, 39, 0.06);
  animation: ring-pop 600ms var(--ease-spring);
  transition: transform var(--dur) var(--ease-spring), box-shadow var(--dur) var(--ease);
}

.calorie-ring:hover,
.target-card:hover {
  transform: scale(1.03) rotate(-2deg);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 14px 32px rgba(25, 54, 39, 0.16);
}

@keyframes ring-pop {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.calorie-ring strong,
.target-card strong {
  display: block;
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  color: var(--ink);
}

.calorie-ring span,
.target-card span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
  font-weight: 600;
}

/* 宏量营养素卡片网格 */

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

.macro-tile {
  min-height: 82px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-solid);
  box-shadow: var(--shadow-sm);
  transition:
    transform var(--dur) var(--ease-spring),
    box-shadow var(--dur) var(--ease),
    border-color var(--dur) var(--ease),
    background var(--dur) var(--ease);
  position: relative;
  overflow: hidden;
}

.macro-tile::before {
  /* 悬停时的微弱渐变 */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(31, 122, 83, 0.04), transparent 60%);
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
  pointer-events: none;
}

.macro-tile:hover {
  transform: translateY(-3px);
  border-color: rgba(31, 122, 83, 0.22);
  box-shadow: var(--shadow-lift);
}

.macro-tile:hover::before {
  opacity: 1;
}

.macro-tile strong {
  display: block;
  margin-bottom: 4px;
  font-size: 21px;
  font-weight: 800;
  color: var(--ink);
}

.macro-tile span {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}

/* 建议框：琥珀色左边条 + 柔光背景 */

.suggestion-box {
  padding: 16px 18px;
  border-left: 4px solid var(--accent-2);
  background: linear-gradient(135deg, #fffaf0, #fef5de);
  border-radius: var(--radius-lg);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 4px 14px rgba(241, 185, 77, 0.08);
  transition: transform var(--dur) var(--ease);
}

.suggestion-box:hover {
  transform: translateX(2px);
}

.suggestion-box strong {
  color: #7a5a12;
  font-size: 13.5px;
}

.suggestion-box p {
  margin: 6px 0 0;
  color: #614f2b;
  font-size: 14px;
  line-height: 1.65;
}

/* ----------------------------------------------------------
 * 9. 饮食计划 / 每日目标
 * ---------------------------------------------------------- */

.plan-header h3 {
  font-size: 22px;
}

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

.meal-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-solid);
  box-shadow: var(--shadow-sm);
  transition:
    transform var(--dur) var(--ease-spring),
    box-shadow var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
  position: relative;
  overflow: hidden;
}

.meal-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  transform: translateX(-100%);
  transition: transform var(--dur-slow) var(--ease-out);
}

.meal-card:hover {
  transform: translateY(-3px);
  border-color: rgba(31, 122, 83, 0.24);
  box-shadow: var(--shadow-lift);
}

.meal-card:hover::after {
  transform: translateX(100%);
}

.meal-card h4 {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}

.meal-card p {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.65;
}

.meal-card small {
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.005em;
}

/* ----------------------------------------------------------
 * 10. 个人资料表单 / 日记表单 / API 配置表单
 * ---------------------------------------------------------- */

.profile-form,
.diary-form,
.settings-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.wide-field {
  grid-column: span 4;
}

/* 开关字段（青少年模式复选框） */

.switch-field {
  grid-column: span 2;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-solid);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease),
    background-color var(--dur) var(--ease),
    transform var(--dur-fast) var(--ease);
}

.switch-field:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.switch-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(31, 122, 83, 0.12);
  background: #fff;
}

.switch-field input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-height: 20px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* —— API 配置面板分组卡 —— */

.settings-group {
  grid-column: span 4;
  padding: 20px 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.85), rgba(248, 251, 248, 0.7)),
    var(--surface-solid);
  box-shadow: var(--shadow-sm);
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 14px;
  position: relative;
  overflow: hidden;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.settings-group::before {
  /* 顶部细渐变色条 — 区分多模态模型配置区 */
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent) 0%, #49a37b 40%, var(--accent-2) 100%);
  opacity: 0.7;
}

.settings-group:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
  border-color: rgba(31, 122, 83, 0.2);
}

.settings-group > h3 {
  grid-column: span 4;
  margin-bottom: 2px;
  margin-top: 6px;
  font-size: 15.5px;
  font-weight: 700;
  color: var(--accent-strong);
}

.settings-group > h3::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  vertical-align: middle;
  box-shadow: 0 0 0 3px rgba(31, 122, 83, 0.15);
}

.settings-actions {
  grid-column: span 4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}

.settings-actions .primary-button,
.settings-actions .ghost-button {
  flex: 0 0 auto;
}

.settings-actions .hint {
  flex: 1 1 220px;
  margin-top: 0;
}

/* ----------------------------------------------------------
 * 11. 健康日记 — 图表 + 条目列表
 * ---------------------------------------------------------- */

.diagram-form {
  display: grid;
}

.trend-layout {
  display: grid;
  grid-template-columns: minmax(360px, 1.1fr) minmax(260px, 0.9fr);
  gap: 20px;
  margin-top: 20px;
}

.chart-card,
.entry-list {
  min-height: 320px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-solid);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.chart-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}

.chart-title {
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}

.chart-title span {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 14px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff, #fcfefe);
}

/* 日记条目列表 — 可滚动 */

.entry-list {
  display: grid;
  gap: 10px;
  align-content: start;
  max-height: 410px;
  overflow-y: auto;
  /* 自定义滚动条 */
  scrollbar-width: thin;
  scrollbar-color: rgba(31, 122, 83, 0.25) transparent;
}

.entry-list::-webkit-scrollbar {
  width: 6px;
}

.entry-list::-webkit-scrollbar-thumb {
  background: rgba(31, 122, 83, 0.22);
  border-radius: 999px;
}

.entry-list::-webkit-scrollbar-thumb:hover {
  background: rgba(31, 122, 83, 0.4);
}

.entry-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  transition:
    transform var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease),
    border-color var(--dur) var(--ease),
    background-color var(--dur) var(--ease);
}

.entry-item:hover {
  transform: translateX(3px) translateY(-1px);
  border-color: rgba(31, 122, 83, 0.22);
  background: #f5faf6;
  box-shadow: var(--shadow-sm);
}

.entry-item strong {
  display: block;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
}

.entry-item span {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  margin-top: 3px;
}

.entry-item time {
  display: block;
  color: var(--muted-soft);
  font-size: 11.5px;
  margin-top: 3px;
}

/* 删除按钮 — 悬停时柔和放大并变红色 */

.delete-entry {
  min-width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  transition:
    transform var(--dur) var(--ease-spring),
    background-color var(--dur) var(--ease),
    border-color var(--dur) var(--ease),
    color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}

.delete-entry:hover {
  background: var(--danger-soft);
  border-color: rgba(176, 66, 53, 0.3);
  color: var(--danger);
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(176, 66, 53, 0.18);
}

.delete-entry:active {
  transform: scale(0.94);
}

/* ----------------------------------------------------------
 * 12. 问答答案卡
 * ---------------------------------------------------------- */

.answer-card {
  line-height: 1.8;
  font-size: 14.5px;
}

.answer-card ul {
  padding-left: 22px;
}

.answer-card li {
  margin-top: 6px;
}

.answer-card li::marker {
  color: var(--accent);
}

.answer-card strong {
  color: var(--accent-strong);
  font-weight: 700;
}

/* ----------------------------------------------------------
 * 13. 人体分析面板
 * ---------------------------------------------------------- */

.body-analysis-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1.1fr) minmax(300px, 0.9fr);
  gap: 22px;
  margin-top: 22px;
}

/* —— 左侧表单 —— */

.body-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 14px;
  align-content: start;
}

.body-form .wide-field {
  grid-column: span 2;
}

/* —— 右侧可视化卡片 —— */

.body-visual-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(248, 251, 248, 0.85)),
    var(--surface-solid);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.body-visual-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
}

.body-visual-header strong {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
}

.body-visual-header span {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  padding: 4px 10px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-radius: 999px;
}

/* —— 3D 人体模型容器 —— */

.body-3d-container {
  position: relative;
  flex: 1;
  min-height: 480px;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 50% 30%, rgba(31, 122, 83, 0.05), transparent 60%),
    linear-gradient(180deg, #f2f5f3, #e7ece9);
  overflow: hidden;
}

#body3dCanvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 480px;
  cursor: grab;
}

#body3dCanvas:active {
  cursor: grabbing;
}

/* —— 加载中状态 —— */

.body-3d-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(252, 254, 253, 0.9);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 5;
  transition: opacity 0.4s ease;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(31, 122, 83, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.body-3d-loading span {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

/* —— 3D 控制按钮 —— */

.body-3d-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 4;
}

.control-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: all 0.2s var(--ease);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.control-btn:hover {
  background: white;
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(31, 122, 83, 0.15);
}

.control-btn:active {
  transform: translateY(0);
}

.control-btn.active,
.view-preset.active {
  color: #176b4a;
  border-color: rgba(31, 122, 83, 0.45);
  background: #e8f5ef;
}

.view-presets {
  display: grid;
  grid-template-columns: repeat(3, 30px);
  padding: 3px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.view-preset {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.view-preset:hover {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

/* —— 图例 —— */

.body-legend {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 14px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.body-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}

.body-legend i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

/* —— 结果区域 —— */

.body-result {
  margin-top: 22px;
  display: grid;
  gap: 22px;
  animation: result-pop 500ms var(--ease-spring);
}

@keyframes result-pop {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.body-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 14px;
}

.body-stat-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-solid);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 8px;
  text-align: center;
  transition: transform var(--dur) var(--ease-spring), box-shadow var(--dur) var(--ease);
  position: relative;
  overflow: hidden;
}

.body-stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
}

.body-stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: 0.6;
}

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

.stat-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1;
}

.stat-tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  justify-self: center;
}

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

.stat-tag.level-low {
  background: #dcfce7;
  color: #166534;
}

.stat-tag.level-normal {
  background: #fef9c3;
  color: #854d0e;
}

.stat-tag.level-high {
  background: #ffedd5;
  color: #9a3412;
}

.stat-tag.level-veryHigh {
  background: #fee2e2;
  color: #991b1b;
}

/* —— 各部位脂肪分析 —— */

.body-fat-analysis h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--ink);
}

.fat-parts-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 12px;
}

.fat-part-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-solid);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 8px;
  transition: transform var(--dur) var(--ease-spring), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.fat-part-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}

.fat-part-card.level-low { border-color: rgba(34, 197, 94, 0.3); }
.fat-part-card.level-normal { border-color: rgba(234, 179, 8, 0.3); }
.fat-part-card.level-high { border-color: rgba(249, 115, 22, 0.3); }
.fat-part-card.level-veryHigh { border-color: rgba(239, 68, 68, 0.3); }

.fat-part-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.fat-part-header strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.fat-part-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--ink-soft);
}

.fat-part-bar {
  height: 6px;
  background: #e5ece9;
  border-radius: 999px;
  overflow: hidden;
}

.fat-part-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.8s var(--ease-out);
}

.level-low .fat-part-fill { background: linear-gradient(90deg, #22c55e, #4ade80); }
.level-normal .fat-part-fill { background: linear-gradient(90deg, #eab308, #facc15); }
.level-high .fat-part-fill { background: linear-gradient(90deg, #f97316, #fb923c); }
.level-veryHigh .fat-part-fill { background: linear-gradient(90deg, #ef4444, #f87171); }

.fat-part-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}

.level-low .fat-part-label { color: #166534; }
.level-normal .fat-part-label { color: #854d0e; }
.level-high .fat-part-label { color: #9a3412; }
.level-veryHigh .fat-part-label { color: #991b1b; }

/* ----------------------------------------------------------
 * 14. Toast 浮层提示 — 底部右侧弹入
 * ---------------------------------------------------------- */

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: min(420px, calc(100vw - 48px));
  padding: 14px 20px;
  border-radius: 14px;
  background:
    linear-gradient(135deg, #15211b, #2d3b33);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  box-shadow:
    0 10px 28px rgba(21, 33, 27, 0.35),
    0 2px 6px rgba(21, 33, 27, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  pointer-events: none;
  transition:
    opacity 280ms var(--ease-out),
    transform 320ms var(--ease-spring);
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ----------------------------------------------------------
 * 14. 杂项
 * ---------------------------------------------------------- */

.nav-item span,
.upload-icon,
.brand-mark {
  user-select: none;
}

section[id] {
  scroll-margin-top: 20px;
}

.hint {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

/* ----------------------------------------------------------
 * 15. 响应式 — 平板 / 手机
 * ---------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  body::before, body::after { display: none; }
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 16px;
    gap: 18px;
  }
  .sidebar {
    position: static;
    min-height: auto;
    padding: 18px;
  }
  .nav-list {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  }
  .sidebar-note { display: none; }
}

@media (max-width: 980px) {
  .recognition-grid,
  .trend-layout,
  .body-analysis-layout {
    grid-template-columns: 1fr;
  }
  .profile-form,
  .settings-form,
  .settings-group,
  .body-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .wide-field { grid-column: span 2; }
  .diary-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .body-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .fat-parts-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar,
  .panel-heading,
  .result-main,
  .plan-header,
  .button-row {
    display: grid;
  }
  .panel, .topbar, .sidebar {
    padding: 18px 16px;
    border-radius: 16px;
  }
  .topbar { gap: 12px; }
  .nav-list,
  .profile-form,
  .diary-form,
  .macro-grid,
  .meal-list,
  .settings-form,
  .settings-group,
  .body-form,
  .body-stats-grid,
  .fat-parts-grid {
    grid-template-columns: 1fr;
  }
  .nav-item { padding: 10px 12px; }
  .wide-field, .switch-field { grid-column: span 1; }
  .calorie-ring, .target-card {
    width: 104px;
    height: 104px;
  }
  .body-3d-container {
    min-height: 420px;
  }
  #body3dCanvas {
    min-height: 420px;
  }
  .toast {
    right: 14px;
    left: 14px;
    max-width: none;
  }
  h1 { font-size: 24px; }
  h2 { font-size: 19px; }
}
