/* Modernist tokens —— 站点唯一样式表,颜色/字体/间距全部走变量 */
@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@400;600;700;800&display=swap');

:root {
  --color-bg: #f3f2f2;
  --color-text: #201e1d;
  --color-accent: #ec3013;
  --color-accent-100: #fff2ef;
  --color-accent-700: #ae1800;
  --color-divider: color-mix(in srgb, #201e1d 40%, transparent);

  --surface: #ffffff;
  --t2: #605d5d;
  --t3: #7d7979;
  --line: #d7d3d3;
  --tint: var(--color-accent-100);
  --dim: #bab6b6;

  --font-body: "Archivo", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #1b1918;
    --color-text: #f3f2f2;
    --color-divider: #f3f2f2;
    --surface: #252322;
    --t2: #c9c5c2;
    --t3: #9d9893;
    --line: #454140;
    --tint: #3b1f1a;
    --dim: #5c5754;
  }
}

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

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
}

a { color: var(--color-accent-700); text-underline-offset: 3px; }
a:hover { color: var(--color-accent); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--color-accent) 30%, transparent); }

@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(236, 48, 19, .55); } 50% { box-shadow: 0 0 0 8px rgba(236, 48, 19, 0); } }
@keyframes laneflow { from { background-position-y: 0; } to { background-position-y: 22px; } }
@keyframes wipe { from { transform: scaleX(0); } to { transform: scaleX(1); } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
@media print { body { background: #fff; } }

.page { max-width: 780px; margin: 0 auto; padding: 40px 20px 80px; }

/* —— 页头 —— */
.masthead { animation: fadeUp .5s ease both; }
.masthead-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.kicker { font-size: 13px; letter-spacing: .08em; font-weight: 700; color: var(--color-accent); }
.today { font-size: 13px; color: var(--t3); font-variant-numeric: tabular-nums; }
.masthead h1 { font-size: clamp(30px, 6vw, 42px); font-weight: 700; margin: 10px 0 0; letter-spacing: -0.01em; line-height: 1.15; }
.masthead p { margin: 10px 0 0; font-size: 14px; line-height: 1.7; color: var(--t2); max-width: 620px; }

/* —— 数字面板 —— */
.stat-panel {
  margin-top: 32px;
  background: var(--color-accent); color: #fff;
  transform-origin: left;
  animation: wipe .55s cubic-bezier(.7, 0, .2, 1) .15s both;
}
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 2px; background: rgba(255, 255, 255, .28);
}
.stat-cell { background: var(--color-accent); padding: 18px 16px 20px; animation: fadeUp .4s ease both; }
.stat-cell:nth-child(1) { animation-delay: .50s; }
.stat-cell:nth-child(2) { animation-delay: .58s; }
.stat-cell:nth-child(3) { animation-delay: .66s; }
.stat-cell:nth-child(4) { animation-delay: .74s; }
.stat-label { font-size: 12px; letter-spacing: .08em; opacity: .85; }
.stat-value { font-size: 40px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; margin-top: 4px; }
.stat-value small { font-size: 20px; font-weight: 600; }
.stat-sub { font-size: 12px; opacity: .85; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* —— 分节 —— */
.sec { margin-top: 44px; animation: fadeUp .5s ease both; }
.sec:nth-of-type(2) { animation-delay: .16s; }
.sec:nth-of-type(3) { animation-delay: .24s; }
.sec:nth-of-type(4) { animation-delay: .30s; }
.sec:nth-of-type(5) { animation-delay: .36s; }
.sec:nth-of-type(6) { animation-delay: .42s; }
.sec:nth-of-type(7) { animation-delay: .48s; }
.sec:nth-of-type(8) { animation-delay: .54s; }
.sec-head {
  display: flex; align-items: baseline; gap: 14px;
  border-bottom: 2px solid var(--color-divider); padding-bottom: 8px;
}
.sec-num { font-size: 13px; font-weight: 700; color: var(--color-accent); font-variant-numeric: tabular-nums; }
.sec-head h2 { font-size: 20px; margin: 0; font-weight: 700; }
.sec-sub { font-size: 13px; color: var(--t3); }

/* —— 方案切换 —— */
.scheme-toggle {
  display: flex; gap: 2px; margin-top: 16px;
  border: 2px solid var(--color-text); background: var(--color-text); width: fit-content;
}
.scheme-btn {
  border: none; cursor: pointer; font-family: inherit; text-align: left;
  padding: 9px 18px 10px; background: var(--surface); color: var(--color-text);
  transition: background .18s, color .18s;
}
.scheme-btn strong { display: block; font-size: 15px; font-weight: 700; }
.scheme-btn span { display: block; font-size: 12px; margin-top: 2px; opacity: .8; }
.scheme-btn.active { background: var(--color-accent); color: #fff; }

/* —— 每日时间轴 —— */
.timeline { position: relative; margin-top: 8px; }
.timeline::before {
  content: ""; position: absolute; left: 7px; top: 20px; bottom: 20px; width: 2px;
  background: repeating-linear-gradient(to bottom, var(--color-text) 0 14px, transparent 14px 22px);
  background-size: 2px 22px; opacity: .8; animation: laneflow 16s linear infinite;
}
.tl-item {
  position: relative; display: flex; gap: 16px;
  padding: 16px 12px 16px 0; animation: fadeUp .5s ease both; break-inside: avoid;
}
.tl-item.past { opacity: .45; }
.tl-item.next { background: var(--tint); }
.tl-mark { width: 16px; height: 16px; background: var(--color-text); flex: none; margin-top: 8px; }
.tl-item.past .tl-mark { background: var(--dim); }
.tl-item.next .tl-mark { background: var(--color-accent); animation: pulse 2.2s ease-in-out infinite; }
.tl-main { flex: 1; min-width: 0; }
.tl-top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.tl-time { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.tl-item.next .tl-time { color: var(--color-accent-700); }
.tl-slot { font-size: 13px; font-weight: 600; color: var(--t3); }
.badge { font-size: 12px; font-weight: 700; color: #fff; background: var(--color-accent); padding: 2px 8px 3px; }
.tl-food { font-size: 15px; line-height: 1.65; margin-top: 4px; text-wrap: pretty; }
.tl-meta {
  display: flex; gap: 18px; margin-top: 8px; font-size: 14px;
  font-variant-numeric: tabular-nums; color: var(--t2); flex-wrap: wrap; align-items: center;
}
.tl-meta strong { color: var(--color-text); font-size: 15px; }
.supp-chip { border: 1.5px solid var(--color-text); padding: 2px 8px 3px; font-size: 12.5px; color: var(--color-text); }
.tl-note { font-size: 13px; line-height: 1.6; color: var(--t3); margin-top: 6px; }
.all-done { margin: 8px 0 0 32px; padding: 10px 14px; border: 1.5px solid var(--line); font-size: 13.5px; color: var(--t2); }

.totals {
  margin-top: 12px; padding-top: 12px; border-top: 2px solid var(--color-divider);
  font-size: 14px; font-variant-numeric: tabular-nums; color: var(--t2);
  display: flex; gap: 20px; flex-wrap: wrap;
}
.totals strong { color: var(--color-text); }
.totals .note { color: var(--color-accent-700); font-weight: 600; }

/* —— 碳水兑换表 —— */
.exchange { margin-top: 24px; border: 2px solid var(--color-text); }
.exchange-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; border-bottom: 2px solid var(--color-text);
}
.exchange-head strong { font-size: 15px; font-weight: 700; }
.exchange-head span { font-size: 12.5px; font-weight: 600; color: var(--t3); font-variant-numeric: tabular-nums; }
.exchange-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1.5px; background: var(--line); }
.ex-cell { background: var(--surface); padding: 12px 14px; }
.ex-cell strong { display: block; font-size: 15px; font-weight: 700; }
.ex-cell span { display: block; font-size: 13px; color: var(--t3); margin-top: 2px; font-variant-numeric: tabular-nums; }

/* —— 每周训练 —— */
.legend { display: flex; gap: 14px; align-items: center; font-size: 13px; color: var(--t3); }
.legend i { width: 10px; height: 10px; display: inline-block; margin-right: 5px; vertical-align: -1px; }
.legend .str i { background: var(--color-text); }
.legend .swim i { border: 2px solid var(--color-text); }
.train-list { margin-top: 4px; }
.train-row {
  display: flex; gap: 14px; padding: 13px 10px;
  border-bottom: 1px solid var(--line); border-left: 4px solid transparent;
  margin-left: -4px; animation: fadeUp .45s ease both; break-inside: avoid;
}
.train-row.today { border-left-color: var(--color-accent); background: var(--tint); }
.train-day { width: 44px; flex: none; font-size: 15px; font-weight: 700; padding-top: 1px; }
.train-mark { width: 12px; height: 12px; flex: none; margin-top: 5px; }
.train-mark.str { background: var(--color-text); }
.train-mark.swim { border: 2.5px solid var(--color-text); }
.train-mark.rest { background: var(--dim); opacity: .5; }
.train-main { flex: 1; min-width: 0; }
.train-top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.train-type { font-size: 15px; font-weight: 700; }
.train-detail { font-size: 13.5px; line-height: 1.7; color: var(--t2); margin-top: 3px; font-variant-numeric: tabular-nums; text-wrap: pretty; }

/* —— 红线规则 —— */
.redline-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-top: 20px; }
.redline { border: 2px solid var(--color-accent); break-inside: avoid; }
.redline-head { background: var(--color-accent); color: #fff; font-size: 14px; font-weight: 700; padding: 8px 14px; letter-spacing: .04em; }
.redline ul, .principles ul, .shop-card ul { list-style: none; margin: 0; padding: 0; }
.redline ul { padding: 12px 14px 14px; }
.redline li { display: flex; gap: 10px; padding: 6px 0; font-size: 14px; line-height: 1.7; }
.redline li::before { content: ""; width: 8px; height: 8px; background: var(--color-accent); flex: none; margin-top: 8px; }
.principles { margin-top: 20px; border: 1.5px solid var(--line); padding: 14px 16px; }
.principles-title { font-size: 13px; font-weight: 700; letter-spacing: .04em; color: var(--t2); }
.principles ul { margin-top: 8px; }
.principles li { display: flex; gap: 10px; padding: 4px 0; font-size: 14px; line-height: 1.7; color: var(--t2); }
.principles li::before { content: ""; width: 8px; height: 8px; border: 1.5px solid var(--color-text); flex: none; margin-top: 8px; }

/* —— 补剂明细 —— */
.supp-row { display: flex; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.supp-info { min-width: 0; }
.supp-name { font-size: 15px; font-weight: 700; }
.supp-name span { font-weight: 400; color: var(--t3); font-size: 13.5px; }
.supp-purpose { font-size: 13.5px; color: var(--t2); line-height: 1.6; margin-top: 2px; }
.supp-cost { font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 600; flex: none; }

/* —— 替换规则 —— */
.swap-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2px; margin-top: 20px; border: 2px solid var(--color-text); background: var(--color-text);
}
.swap-cell { background: var(--surface); padding: 16px 14px; break-inside: avoid; }
.swap-top { display: flex; align-items: baseline; gap: 8px; }
.swap-top strong { font-size: 14px; font-weight: 700; }
.swap-freq { font-size: 12px; font-weight: 700; border: 1.5px solid var(--color-text); padding: 1px 7px 2px; font-variant-numeric: tabular-nums; }
.swap-body { font-size: 14px; line-height: 1.75; color: var(--t2); margin-top: 8px; text-wrap: pretty; }
.swap-body strong { color: var(--color-text); }
.swap-warn { font-size: 13.5px; line-height: 1.6; color: var(--color-accent-700); font-weight: 600; margin-top: 6px; }

/* —— 购物清单 —— */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-top: 20px; }
.shop-card { border: 1.5px solid var(--color-text); break-inside: avoid; align-self: start; }
.shop-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 10px 14px; border-bottom: 1.5px solid var(--color-text);
}
.shop-head strong { font-size: 15px; font-weight: 700; }
.shop-head span { font-size: 12.5px; font-weight: 600; color: var(--t3); letter-spacing: .04em; }
.shop-card ul { padding: 10px 14px 14px; font-size: 14px; color: var(--t2); }
.shop-card li { padding: 5px 0; border-bottom: 1px solid var(--line); }
.shop-card li:last-child { border-bottom: none; }
.shop-note { margin-top: 14px; font-size: 13.5px; line-height: 1.7; color: var(--t3); }

/* —— 进度追踪 —— */
.track-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 2px; margin-top: 20px; border: 2px solid var(--color-text); background: var(--color-text);
}
.track-cell { background: var(--surface); padding: 14px; font-size: 14px; line-height: 1.6; }
.track-cell span { display: block; font-size: 12.5px; color: var(--t3); margin-top: 3px; }
.track-expect { font-size: 14px; line-height: 1.8; color: var(--t2); margin: 16px 0 0; max-width: 640px; text-wrap: pretty; }
.track-warning {
  margin-top: 12px; border-left: 4px solid var(--color-accent); padding: 8px 0 8px 14px;
  font-size: 14px; line-height: 1.7; color: var(--color-accent-700); font-weight: 600;
}

/* —— 页脚 —— */
.footer {
  margin-top: 56px; border-top: 2px solid var(--color-divider); padding-top: 14px;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--t3); font-variant-numeric: tabular-nums;
}
