/* ============ 设计变量 ============ */
:root {
  --bg: #0e1116;
  --bg-alt: #151a21;
  --card: #1b212b;
  --border: #2a323f;
  --text: #e8edf4;
  --text-dim: #9aa6b5;
  --accent: #f5455c;        /* 主色：能量红（涨/激励），健身语境 */
  --accent-2: #ffb020;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --maxw: 1080px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
}

img, svg { max-width: 100%; display: block; }

.container { width: min(var(--maxw), 100% - 2.5rem); margin-inline: auto; }
.container-narrow { width: min(720px, 100% - 2.5rem); }

/* ============ 导航 ============ */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(14, 17, 22, .85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { font-weight: 800; font-size: 1.35rem; color: var(--text); text-decoration: none; letter-spacing: .5px; }
.logo span { color: var(--accent); }
.nav-links { display: flex; gap: 1.75rem; }
.nav-links a { color: var(--text-dim); text-decoration: none; font-size: .95rem; transition: color .2s; }
.nav-links a:hover, .nav-links a:focus-visible { color: var(--text); }

.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: 0; cursor: pointer; padding: 8px; }
.nav-toggle span { width: 24px; height: 2px; background: var(--text); border-radius: 2px; transition: transform .25s, opacity .25s; }
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============ Hero ============ */
.hero { padding: 4.5rem 0 5rem; background:
  radial-gradient(700px 400px at 80% -10%, rgba(245, 69, 92, .16), transparent 60%),
  radial-gradient(500px 300px at 10% 110%, rgba(255, 176, 32, .08), transparent 60%);
}
.hero-inner { display: grid; grid-template-columns: 1.15fr .85fr; gap: 3rem; align-items: center; }
.badge {
  display: inline-block; font-size: .8rem; color: var(--accent-2);
  border: 1px solid rgba(255, 176, 32, .4); border-radius: 999px;
  padding: .25rem .85rem; margin-bottom: 1.1rem; background: rgba(255, 176, 32, .08);
}
.hero h1 { font-size: clamp(2rem, 4.5vw, 3.2rem); line-height: 1.2; font-weight: 800; }
.hero h1 em { font-style: normal; color: var(--accent); }
.lead { margin-top: 1.1rem; color: var(--text-dim); font-size: 1.05rem; max-width: 34em; }
.hero-cta { display: flex; gap: 1rem; margin-top: 2rem; flex-wrap: wrap; }

/* Hero 右侧卡片 */
.hero-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 1.5rem; justify-content: center; flex-wrap: wrap;
}
.hc-ring { position: relative; }
.ring-bg { fill: none; stroke: var(--border); stroke-width: 12; }
.ring-fg {
  fill: none; stroke: var(--accent); stroke-width: 12; stroke-linecap: round;
  stroke-dasharray: 553; stroke-dashoffset: 110; transform: rotate(-90deg); transform-origin: center;
}
.ring-num { fill: var(--text); font-size: 44px; font-weight: 800; text-anchor: middle; }
.ring-num span { font-size: 18px; }
.ring-label { fill: var(--text-dim); font-size: 14px; text-anchor: middle; }
.hc-stats { list-style: none; display: grid; gap: .9rem; }
.hc-stats li { color: var(--text-dim); font-size: .92rem; }
.hc-stats strong { color: var(--text); font-size: 1.05rem; margin-right: .35rem; }

/* ============ 按钮 ============ */
.btn {
  display: inline-block; padding: .8rem 1.6rem; border-radius: 10px;
  font-size: 1rem; font-weight: 600; text-decoration: none;
  cursor: pointer; border: 1px solid transparent; transition: transform .15s, background .2s, border-color .2s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover, .btn-primary:focus-visible { background: #e03a50; }
.btn-ghost { border-color: var(--border); color: var(--text); background: transparent; }
.btn-ghost:hover, .btn-ghost:focus-visible { border-color: var(--text-dim); }
.btn-lg { padding: 1rem 2.2rem; font-size: 1.08rem; width: 100%; }

/* ============ 通用 Section ============ */
.section { padding: 4.5rem 0; }
.section-alt { background: var(--bg-alt); border-block: 1px solid var(--border); }
.section-head { text-align: center; margin-bottom: 2.5rem; }
.section-head h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800; }
.section-head p { color: var(--text-dim); margin-top: .5rem; }

/* ============ 表单 ============ */
.plan-form { display: grid; gap: 1.5rem; }
.form-block {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card); padding: 1.6rem; display: grid; gap: 1.2rem;
}
.form-block legend { font-weight: 700; padding-inline: .5rem; font-size: 1.02rem; color: var(--accent-2); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
.field { display: grid; gap: .4rem; font-size: .9rem; color: var(--text-dim); }
.field input, .field select {
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: .7rem .85rem; font-size: .95rem; color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 69, 92, .18);
}
.field input[aria-invalid="true"] { border-color: #e05656; }
.form-actions { text-align: center; }
.form-error { color: #ff8a8a; text-align: center; font-size: .9rem; }

/* ============ 结果区 ============ */
.plan-result { margin-top: 2.5rem; }
.result-tabs {
  display: flex; gap: .5rem; background: var(--card);
  border: 1px solid var(--border); border-radius: 12px 12px 0 0; padding: .5rem;
  overflow-x: auto;
}
.tab {
  flex: 1; min-width: 96px; padding: .65rem 1rem; border: 0; border-radius: 8px;
  background: transparent; color: var(--text-dim); font-size: .95rem; font-weight: 600;
  cursor: pointer; transition: background .2s, color .2s; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--accent); color: #fff; }
.tab-panel {
  border: 1px solid var(--border); border-top: 0; border-radius: 0 0 12px 12px;
  background: var(--card); padding: 1.6rem;
}
.disclaimer { margin-top: 1.2rem; font-size: .8rem; color: var(--text-dim); }

/* 结果内容卡片 */
.plan-summary {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem;
}
.kpi {
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 12px;
  padding: 1rem; text-align: center;
}
.kpi b { display: block; font-size: 1.45rem; color: var(--accent-2); }
.kpi span { font-size: .8rem; color: var(--text-dim); }

.day-card {
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: 12px; padding: 1.1rem 1.3rem; margin-bottom: 1rem;
}
.day-card h4 { font-size: 1rem; margin-bottom: .35rem; }
.day-card h4 .tag {
  font-size: .72rem; font-weight: 600; vertical-align: middle; margin-left: .5rem;
  background: rgba(245, 69, 92, .15); color: var(--accent);
  border-radius: 999px; padding: .1rem .6rem;
}
.day-card p { color: var(--text-dim); font-size: .92rem; }
.day-card.rest { border-style: dashed; }

.diet-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.diet-table th, .diet-table td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--border); }
.diet-table th { color: var(--text-dim); font-weight: 600; }
.diet-table td b { color: var(--accent-2); }

.reco-list { list-style: none; display: grid; gap: .9rem; }
.reco-list li {
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: 10px; padding: .9rem 1.1rem .9rem 2.6rem; position: relative; font-size: .95rem;
}
.reco-list li::before { content: "✓"; position: absolute; left: .9rem; top: .85rem; color: var(--accent); font-weight: 800; }

/* ============ 功能卡片 ============ */
.features-grid { gap: 1.4rem; }
.feature-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.8rem; transition: transform .2s, border-color .2s;
}
.feature-card:hover { transform: translateY(-4px); border-color: #3a4453; }
.fc-icon { font-size: 2rem; margin-bottom: .8rem; }
.feature-card h3 { margin-bottom: .5rem; font-size: 1.1rem; }
.feature-card p { color: var(--text-dim); font-size: .92rem; }

/* ============ FAQ ============ */
.faq-item {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 1.1rem 1.4rem; margin-bottom: .9rem;
}
.faq-item summary { cursor: pointer; font-weight: 600; }
.faq-item p { margin-top: .7rem; color: var(--text-dim); font-size: .93rem; }

/* ============ 页脚 ============ */
.footer { border-top: 1px solid var(--border); padding: 1.8rem 0; background: var(--bg-alt); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .8rem; }
.footer p { color: var(--text-dim); font-size: .85rem; }
.footer a { color: var(--text-dim); text-decoration: none; margin-left: 1.2rem; font-size: .85rem; }
.footer a:hover { color: var(--text); }

/* ============ 响应式断点 ============ */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-card { justify-content: flex-start; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .plan-summary { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 620px) {
  .hero { padding: 3rem 0 3.5rem; }
  .grid-3 { grid-template-columns: 1fr; }
  .section { padding: 3rem 0; }

  /* 移动端汉堡菜单 */
  .nav-toggle { display: flex; }
  .nav-links {
    position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: var(--bg-alt); border-bottom: 1px solid var(--border);
    padding: 0; max-height: 0; overflow: hidden;
    transition: max-height .3s ease, padding .3s ease;
  }
  .nav-links.open { max-height: 220px; padding: .5rem 0; }
  .nav-links a { padding: .85rem 1.5rem; display: block; }
  .nav-links a:hover { background: rgba(255, 255, 255, .04); }

  .plan-summary { grid-template-columns: repeat(2, 1fr); }
  .tab-panel { padding: 1.1rem; }
  .btn-lg { width: 100%; }
}

/* 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ============ 安全筛查复选框 ============ */
.check-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .7rem; }
.check {
  display: flex; align-items: center; gap: .55rem; cursor: pointer;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: .6rem .85rem; font-size: .9rem; color: var(--text); user-select: none;
  transition: border-color .2s;
}
.check:hover { border-color: #3a4453; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.check-note { font-size: .8rem; color: var(--text-dim); }

/* ============ 风险闸门 ============ */
.risk-gate {
  margin-top: 1.5rem; border-radius: 12px; padding: 1.2rem 1.4rem;
  border: 1px solid; font-size: .95rem; display: grid; gap: .4rem;
}
.risk-gate.rg-high { background: rgba(224, 86, 86, .1); border-color: rgba(224, 86, 86, .5); }
.risk-gate.rg-mid { background: rgba(255, 176, 32, .08); border-color: rgba(255, 176, 32, .45); }
.risk-gate h3 { font-size: 1rem; margin-bottom: .3rem; }
.risk-gate.rg-high h3 { color: #ff8a8a; }
.risk-gate.rg-mid h3 { color: var(--accent-2); }
.risk-gate p { color: var(--text-dim); font-size: .88rem; }
.risk-gate p b { color: var(--text); }

/* ============ 安全边界框（结果内） ============ */
.safety-box {
  background: rgba(255, 176, 32, .07); border: 1px solid rgba(255, 176, 32, .4);
  border-radius: 12px; padding: 1.1rem 1.3rem; margin-bottom: 1.4rem; font-size: .9rem;
}
.safety-box h4 { color: var(--accent-2); margin-bottom: .4rem; font-size: .95rem; }
.safety-box ul { list-style: none; display: grid; gap: .25rem; color: var(--text-dim); }
.safety-box li::before { content: "▸ "; color: var(--accent-2); }

/* ============ 今日训练 ============ */
.today-card { max-width: 720px; margin-inline: auto; }
.today-empty { color: var(--text-dim); text-align: center; padding: 2rem 1rem; }
.today-head {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .8rem;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px 12px 0 0;
  padding: 1rem 1.3rem;
}
.today-head h3 { font-size: 1.05rem; }
.today-head .tag {
  font-size: .72rem; font-weight: 600; margin-left: .5rem; vertical-align: middle;
  background: rgba(245, 69, 92, .15); color: var(--accent); border-radius: 999px; padding: .1rem .6rem;
}
.today-body {
  background: var(--card); border: 1px solid var(--border); border-top: 0;
  border-radius: 0 0 12px 12px; padding: 1.2rem 1.3rem; display: grid; gap: 1rem;
}
.today-rest { color: var(--text-dim); font-size: .95rem; }
.ex-item {
  display: flex; align-items: center; gap: .8rem; padding: .75rem .9rem;
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 10px;
  cursor: pointer; transition: opacity .2s, border-color .2s; user-select: none;
}
.ex-item input { accent-color: var(--accent); width: 18px; height: 18px; flex-shrink: 0; }
.ex-item span { font-size: .92rem; }
.ex-item.done { opacity: .45; }
.ex-item.done span { text-decoration: line-through; }
.today-done { text-align: center; color: var(--accent-2); font-weight: 700; }

/* 组间计时器 */
.timer {
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 12px;
  padding: 1.1rem 1.3rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.timer-presets { display: flex; gap: .4rem; flex-wrap: wrap; }
.timer-presets button, .timer button {
  background: var(--bg); border: 1px solid var(--border); color: var(--text-dim);
  border-radius: 8px; padding: .45rem .8rem; font-size: .85rem; cursor: pointer;
  transition: border-color .2s, color .2s;
}
.timer-presets button.active { border-color: var(--accent); color: var(--accent); }
.timer-presets button:hover, .timer button:hover { color: var(--text); }
.timer-display {
  font-size: 1.9rem; font-weight: 800; font-variant-numeric: tabular-nums;
  min-width: 90px; text-align: center;
}
.timer-display.urgent { color: #ff8a8a; }
.timer button.btn-start { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }

/* ============ 体重进度 ============ */
.weight-layout { display: grid; grid-template-columns: 380px 1fr; gap: 1.4rem; align-items: start; }
.weight-form-card, .weight-chart-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.4rem;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.w-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; margin-top: 1.1rem; }
.w-stats .kpi b { font-size: 1.15rem; }
.w-advice {
  margin-top: 1rem; font-size: .88rem; color: var(--text-dim);
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 10px; padding: .8rem 1rem;
}
.w-advice b { color: var(--accent-2); }
.w-chart-empty { color: var(--text-dim); text-align: center; padding: 4rem 1rem; font-size: .9rem; }
.w-chart-svg { width: 100%; height: auto; }
.w-chart-legend { display: flex; gap: 1.2rem; margin-top: .6rem; font-size: .78rem; color: var(--text-dim); flex-wrap: wrap; }
.w-chart-legend i { display: inline-block; width: 18px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: .35rem; }

/* ============ 导出按钮行 ============ */
.export-row { text-align: center; margin-top: 1.2rem; }

@media (max-width: 900px) {
  .weight-layout { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .w-stats { grid-template-columns: repeat(3, 1fr); }
  .grid-2 { grid-template-columns: 1fr 1fr; }
}

/* ============ PDF 导出（打印视图） ============ */
@media print {
  body { background: #fff; color: #111; }
  .nav, .hero, #generator .plan-form, #today, #weight, #features, #faq, .footer,
  .result-tabs, .export-row, .disclaimer, #riskGate, .nav-toggle { display: none !important; }
  .plan-result { display: block !important; margin-top: 0; }
  .plan-result[hidden] { display: block !important; }
  .tab-panel { display: block !important; border: none; background: #fff; padding: 0; page-break-after: always; }
  .tab-panel[hidden] { display: block !important; }
  .kpi { border: 1px solid #ccc; background: #f6f6f6; }
  .kpi b { color: #b45309; }
  .day-card, .diet-table th, .diet-table td, .reco-list li, .safety-box { border-color: #ccc; }
  .diet-table td b { color: #b45309; }
  .day-card, .reco-list li { background: #f6f6f6; }
  .day-card p, .reco-list li, .diet-table th { color: #333; }
  .safety-box { background: #fffbe8; }
  .safety-box h4 { color: #b45309; }
}
