:root {
  --bg: #ffffff;
  --bg-soft: #f4f6fa;
  --surface: #ffffff;
  --surface-hover: #f1f5f9;
  --border: #e6eaf0;
  --text: #1e293b;
  --text-muted: #64748b;
  --primary: #16a34a;
  --primary-dark: #15803d;
  --primary-soft: rgba(22, 163, 74, 0.1);
  --accent: #3b82f6;
  --danger: #dc2626;
  --warning: #d97706;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.05), 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.12);
}

/* 深色模式 */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --bg-soft: #1e293b;
    --surface: #1e293b;
    --surface-hover: #334155;
    --border: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --primary: #22c55e;
    --primary-dark: #16a34a;
    --primary-soft: rgba(34, 197, 94, 0.1);
    --accent: #60a5fa;
    --danger: #f87171;
    --warning: #fbbf24;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.2), 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.4);
  }
}

/* 主题类 */
.theme-dark {
  --bg: #0f172a;
  --bg-soft: #1e293b;
  --surface: #1e293b;
  --surface-hover: #334155;
  --border: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --primary: #22c55e;
  --primary-dark: #16a34a;
  --primary-soft: rgba(34, 197, 94, 0.1);
  --accent: #60a5fa;
  --danger: #f87171;
  --warning: #fbbf24;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.2), 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.theme-midnight {
  --bg: #0a1929;
  --bg-soft: #132f4c;
  --surface: #132f4c;
  --surface-hover: #1a3a5c;
  --border: #1a3a5c;
  --text: #e3f2fd;
  --text-muted: #90caf9;
  --primary: #4caf50;
  --primary-dark: #388e3c;
  --primary-soft: rgba(76, 175, 80, 0.1);
  --accent: #42a5f5;
  --danger: #ef5350;
  --warning: #ffa726;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.theme-forest {
  --bg: #f0fdf4;
  --bg-soft: #dcfce7;
  --surface: #ffffff;
  --surface-hover: #bbf7d0;
  --border: #bbf7d0;
  --text: #14532d;
  --text-muted: #166534;
  --primary: #15803d;
  --primary-dark: #166534;
  --primary-soft: rgba(21, 128, 61, 0.1);
  --accent: #059669;
  --danger: #dc2626;
  --warning: #eab308;
  --shadow: 0 1px 3px rgba(21, 128, 61, 0.1), 0 4px 16px rgba(21, 128, 61, 0.15);
  --shadow-lg: 0 12px 40px rgba(21, 128, 61, 0.2);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

.app {
  max-width: 760px;
  margin: 0 auto;
  padding: 1rem 1rem 3rem;
}

/* ===== 头部 ===== */
.header {
  text-align: center;
  padding: 1.75rem 0 1.25rem;
}

.header-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

.logo {
  font-size: 1.35rem;
  width: 2.75rem;
  height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  background: linear-gradient(135deg, #15803d, #2563eb);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* ===== 导航 ===== */
.nav {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.5rem;
  margin-bottom: 1.25rem;
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 100;
  -webkit-overflow-scrolling: touch;
}

.nav-btn {
  flex: 1;
  min-width: fit-content;
  padding: 0.6rem 0.9rem;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.nav-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.nav-btn.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.35);
}

/* ===== 页签 ===== */
.tab {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== 卡片 ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.card h2 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--text);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.card-header h2 {
  margin-bottom: 0;
}

.card-header-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ===== 表单 ===== */
.form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 480px) {
  .form-row { grid-template-columns: 1fr; }
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

select, input[type="number"], input[type="text"], input[type="date"] {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

select:focus, input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* ===== 按钮 ===== */
.btn {
  padding: 0.7rem 1.25rem;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--surface-hover);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn-icon {
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.btn-danger-icon:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.hidden {
  display: none !important;
}

/* ===== 徽章 ===== */
.badge {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 0.78rem;
  font-weight: 600;
}

.plan-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}

/* ===== 训练计划 ===== */
.plan-days {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.plan-day {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
}

.plan-day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
  gap: 0.5rem;
}

.plan-day-name {
  font-weight: 700;
  color: var(--primary-dark);
}

.plan-day-focus {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: right;
}

.plan-exercises {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.plan-exercises li {
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  padding: 0.35rem 0.5rem;
  background: var(--surface);
  border-radius: 8px;
}

.ex-name {
  font-weight: 600;
  color: var(--text);
}

.ex-spec {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-left: auto;
}

.ex-tag {
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 0.72rem;
}

.ex-tag-equipment {
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
}

.plan-rest {
  margin-top: 0.6rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: right;
}

/* ===== 训练 ===== */
.workout-timer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, var(--primary-soft), rgba(59, 130, 246, 0.08));
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-dark);
}

.workout-timer-display {
  font-variant-numeric: tabular-nums;
  font-size: 1.1rem;
}

.exercise-list {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.exercise-card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
}

.exercise-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  gap: 0.5rem;
}

.exercise-name {
  font-weight: 700;
}

.exercise-target {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: right;
}

.last-record {
  font-size: 0.78rem;
  color: var(--accent);
  background: rgba(59, 130, 246, 0.08);
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  margin-bottom: 0.6rem;
}

.sets-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.sets-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 500;
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.sets-table td {
  padding: 0.35rem 0.5rem;
}

.sets-table input {
  width: 70px;
  padding: 0.4rem;
  text-align: center;
}

.sets-table input[type="checkbox"] {
  width: auto;
  accent-color: var(--primary);
}

.add-set-btn {
  margin-top: 0.5rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text-muted);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.add-set-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
}

/* ===== 历史记录 ===== */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 400px;
  overflow-y: auto;
}

.history-item {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  font-size: 0.85rem;
}

.history-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.history-date {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-top: 0.15rem;
}

.history-detail {
  color: var(--primary-dark);
  font-weight: 600;
  font-size: 0.8rem;
  white-space: nowrap;
}

.history-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.history-expand {
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.history-exercise {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.history-exercise-detail {
  color: var(--text-muted);
  text-align: right;
}

/* ===== 计时器 ===== */
.timer-card {
  text-align: center;
}

.timer-circle {
  position: relative;
  width: 220px;
  height: 220px;
  margin: 1.25rem auto;
}

.timer-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-ring-track {
  fill: none;
  stroke: var(--border);
  stroke-width: 12;
}

.timer-ring {
  fill: none;
  stroke: var(--primary);
  stroke-width: 12;
  stroke-linecap: round;
  transition: stroke-dasharray 0.2s linear, stroke 0.3s;
}

.timer-ring.warning {
  stroke: var(--warning);
}

.timer-ring.danger {
  stroke: var(--danger);
}

.timer-display {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--primary-dark);
  letter-spacing: 0.03em;
}

.timer-display.warning {
  color: var(--warning);
}

.timer-display.danger {
  color: var(--danger);
  animation: pulse 0.5s ease infinite;
}

@keyframes pulse {
  50% { opacity: 0.6; }
}

.timer-presets {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.btn-preset {
  padding: 0.5rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.btn-preset:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-preset.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-dark);
  font-weight: 600;
}

.timer-custom {
  max-width: 200px;
  margin: 0 auto 1rem;
}

.timer-controls {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== 统计 ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 0.75rem;
  text-align: center;
}

.stat-icon {
  display: block;
  font-size: 1.35rem;
  margin-bottom: 0.25rem;
}

.stat-value {
  display: block;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary-dark);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

canvas {
  max-height: 250px;
  margin-top: 0.5rem;
}

.chart-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 1rem;
  font-size: 0.9rem;
}

/* ===== 身体数据 ===== */
.body-record {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  background: var(--bg-soft);
  border-radius: 10px;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.body-record-date {
  color: var(--text-muted);
}

.body-record strong {
  color: var(--text);
}

.body-record-change {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ===== 设置 ===== */
.setting-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.9rem;
}

.setting-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.about-logo {
  text-align: center;
  padding: 1rem 0 0.5rem;
}

.about-logo .logo {
  width: 3.5rem;
  height: 3.5rem;
  font-size: 1.6rem;
  margin: 0 auto;
}

.about-title {
  font-weight: 700;
  font-size: 1.1rem;
  margin-top: 0.5rem;
}

.about-version {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--primary);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  font-weight: 500;
  font-size: 0.9rem;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

@media (max-width: 480px) {
  .header h1 { font-size: 1.5rem; }
  .timer-circle { width: 190px; height: 190px; }
  .timer-display { font-size: 2.5rem; }
  .stat-value { font-size: 1.35rem; }
}

/* ===== 营养追踪样式 ===== */
.nutrition-summary {
  margin-bottom: 1.5rem;
}

.nutrition-progress {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.progress-ring {
  position: relative;
  width: 120px;
  height: 120px;
}

.progress-ring svg {
  transform: rotate(-90deg);
}

.progress-ring-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 8;
}

.progress-ring-fill {
  fill: none;
  stroke: var(--primary);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s ease;
}

.progress-ring-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.progress-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.progress-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.nutrition-goals {
  flex: 1;
}

.goal-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.goal-label {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.goal-value {
  font-weight: 600;
  color: var(--text);
}

.goal-unit {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.macro-bars {
  margin-top: 1rem;
}

.macro-item {
  margin-bottom: 1rem;
}

.macro-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.macro-name {
  font-weight: 500;
  color: var(--text);
}

.macro-value {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.macro-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.macro-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.macro-bar-fill.protein {
  background: #3b82f6;
}

.macro-bar-fill.carbs {
  background: #f59e0b;
}

.macro-bar-fill.fat {
  background: #ef4444;
}

/* 食物搜索 */
.food-search {
  margin-bottom: 1rem;
}

.food-search input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.food-search-results {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.food-search-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.food-search-item:last-child {
  border-bottom: none;
}

.food-search-item:hover {
  background: var(--surface-hover);
}

.food-search-item .food-name {
  font-weight: 500;
}

.food-search-item .food-info {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.food-search-item .food-category {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-soft);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

/* 餐次列表 */
.meals-list {
  max-height: 400px;
  overflow-y: auto;
}

.meal-item {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
}

.meal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.meal-name {
  font-weight: 600;
}

.meal-time {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.meal-foods {
  margin-bottom: 0.75rem;
}

.food-item {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.food-item:last-child {
  border-bottom: none;
}

.meal-summary {
  display: flex;
  gap: 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* 喝水追踪 */
.water-tracker {
  text-align: center;
}

.water-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.water-icon {
  font-size: 2rem;
}

.water-amount {
  font-size: 1.25rem;
  font-weight: 600;
}

.water-buttons {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.water-btn {
  flex: 1;
  max-width: 120px;
}

/* ===== 成就系统样式 ===== */
.achievements-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  text-align: center;
}

.achievement-stat {
  padding: 1rem;
}

.achievement-stat .stat-icon {
  display: block;
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.achievement-stat .stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.achievement-stat .stat-label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* 徽章网格 */
.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 1rem;
}

.badge-item {
  text-align: center;
  padding: 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.badge-icon {
  display: block;
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.badge-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

/* 成就列表 */
.achievements-list {
  max-height: 400px;
  overflow-y: auto;
}

.achievement-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
}

.achievement-item.locked {
  opacity: 0.6;
}

.achievement-item.unlocked {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.achievement-icon {
  font-size: 2rem;
}

.achievement-info {
  flex: 1;
}

.achievement-name {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.achievement-description {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.achievement-reward {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.achievement-status {
  font-size: 1.25rem;
}

/* 成就弹窗 */
.achievement-popup {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.achievement-popup.show {
  opacity: 1;
}

.achievement-popup-content {
  background: var(--surface);
  padding: 2rem;
  border-radius: var(--radius);
  text-align: center;
  max-width: 300px;
  box-shadow: var(--shadow-lg);
}

.achievement-popup-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.achievement-popup-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.achievement-popup-name {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.achievement-popup-description {
  color: var(--text-muted);
}

/* ===== 主题切换样式 ===== */
.theme-switcher {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.theme-btn {
  flex: 1;
  min-width: 80px;
  padding: 0.75rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-btn:hover {
  border-color: var(--primary);
}

.theme-btn.active {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.theme-btn-icon {
  font-size: 1.5rem;
  display: block;
  margin-bottom: 0.25rem;
}

.theme-btn-name {
  font-size: 0.75rem;
  color: var(--text);
}

/* ===== 无动画模式 ===== */
.no-animations * {
  animation: none !important;
  transition: none !important;
}

/* ===== C 包新增 ===== */

/* ---- 训练日历热力图（§3.1）---- */
.heatmap-scroll {
  overflow-x: auto;
  padding-bottom: 0.25rem;
  -webkit-overflow-scrolling: touch;
}

.heatmap-grid {
  display: grid;
  grid-template-rows: repeat(7, 12px);
  grid-auto-flow: column;
  grid-auto-columns: 12px;
  gap: 3px;
  width: max-content;
}

.hm-cell {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--bg-soft);
}

.hm-cell[data-level="1"] { background: color-mix(in srgb, var(--primary) 30%, var(--bg-soft)); }
.hm-cell[data-level="2"] { background: color-mix(in srgb, var(--primary) 50%, var(--bg-soft)); }
.hm-cell[data-level="3"] { background: color-mix(in srgb, var(--primary) 75%, var(--bg-soft)); }
.hm-cell[data-level="4"] { background: color-mix(in srgb, var(--primary) 100%, var(--bg-soft)); }

.hm-cell.hm-future { background: transparent; }

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ---- PR 摘要（§3.2）---- */
.pr-summary {
  display: flex;
  gap: 0.75rem;
  margin: 0.75rem 0;
}

.pr-summary:empty { display: none; }

.pr-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.6rem 0.5rem;
  background: var(--bg-soft);
  border-radius: var(--radius);
}

.pr-value {
  font-weight: 700;
  color: var(--primary);
}

.pr-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ---- 1RM 计算器（§3.2）---- */
.orm-result { margin-top: 0.75rem; }

.orm-headline {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.orm-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.orm-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

.orm-table th,
.orm-table td {
  padding: 0.4rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.orm-table th {
  color: var(--text-muted);
  font-weight: 600;
}

/* ---- 训练模式增强（§3.3）---- */
.exercise-card.active-exercise {
  border-left: 4px solid var(--primary);
}

#start-session.session-active {
  background: var(--primary-soft);
  color: var(--primary);
}

.rest-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(0px + env(safe-area-inset-bottom));
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.12);
}

.rest-bar.hidden { display: none; }

.rest-bar-label {
  font-weight: 700;
  color: var(--text);
  min-width: 6.5em;
}

.rest-bar-btn { padding: 0.4rem 0.9rem; }

@keyframes rest-bar-blink {
  50% { opacity: 0.25; }
}

.rest-bar-flash {
  animation: rest-bar-blink 0.3s linear 3;
}
