:root {
  --primary: #6C5CE7;
  --primary-light: #A29BFE;
  --primary-dark: #5541C7;
  --green: #00B894;
  --green-light: #55EFC4;
  --orange: #FDA428;
  --red: #FF6B6B;
  --bg: #F0F0F8;
  --card: #FFFFFF;
  --text: #2D3436;
  --text-light: #636E72;
  --border: #DFE6E9;
  --radius: 16px;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 18px;
  line-height: 1.5;
  overscroll-behavior: none;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 80px;
}

/* ===== Typography ===== */
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 22px; font-weight: 700; }
h3 { font-size: 18px; font-weight: 600; }
p { font-size: 17px; }

.muted { color: var(--text-light); }
.center { text-align: center; }

/* ===== Cards ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin: 12px 16px;
  box-shadow: var(--shadow);
}

/* ===== Buttons ===== */
.btn {
  display: block;
  width: 100%;
  padding: 18px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 19px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s;
  text-align: center;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-green { background: var(--green); color: #fff; }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-gray { background: #DFE6E9; color: var(--text); }
.btn-red { background: var(--red); color: #fff; }
.btn:disabled { opacity: 0.5; }

/* ===== Bottom Nav ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 8px 0;
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}
.nav-item {
  flex: 1;
  text-align: center;
  padding: 8px 4px;
  cursor: pointer;
  border: none;
  background: none;
  font-size: 12px;
  color: var(--text-light);
  font-weight: 600;
}
.nav-item .nav-icon { font-size: 24px; display: block; margin-bottom: 2px; }
.nav-item.active { color: var(--primary); }

/* ===== Progress Ring ===== */
.progress-ring {
  width: 160px;
  height: 160px;
  margin: 0 auto;
  position: relative;
}
.progress-ring svg { transform: rotate(-90deg); }
.progress-ring .bg-ring { stroke: var(--border); }
.progress-ring .fg-ring { stroke: var(--primary); stroke-linecap: round; transition: stroke-dashoffset 0.5s; }
.progress-ring .ring-label {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

/* ===== Exercise Card ===== */
.exercise-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin: 12px 16px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
}
.exercise-card.warmup { border-left-color: var(--orange); }
.exercise-card.cooldown { border-left-color: var(--green); }
.exercise-card .ex-tag {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
}
.exercise-card .ex-tag.warmup { background: #FFF3E0; color: var(--orange); }
.exercise-card .ex-tag.main { background: #E8E6FF; color: var(--primary); }
.exercise-card .ex-tag.cooldown { background: #E0F8F4; color: var(--green); }

/* ===== Feedback Buttons ===== */
.feedback-btn {
  display: block;
  width: 100%;
  padding: 16px 20px;
  margin: 8px 0;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}
.feedback-btn:active { border-color: var(--primary); background: #F0EDFF; }
.feedback-btn.selected { border-color: var(--primary); background: #E8E6FF; }

/* ===== Stats Row ===== */
.stats-row {
  display: flex;
  gap: 10px;
  margin: 12px 16px;
}
.stat-box {
  flex: 1;
  background: var(--card);
  border-radius: 12px;
  padding: 16px 12px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-box .stat-value { font-size: 24px; font-weight: 800; color: var(--primary); }
.stat-box .stat-label { font-size: 13px; color: var(--text-light); margin-top: 4px; }

/* ===== Inputs ===== */
input[type="number"], input[type="text"], input[type="date"], select, textarea {
  width: 100%;
  padding: 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 18px;
  font-family: inherit;
  background: var(--card);
  color: var(--text);
  margin: 8px 0;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }

/* ===== Badges ===== */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
}
.badge-green { background: #E0F8F4; color: var(--green); }
.badge-orange { background: #FFF3E0; color: var(--orange); }
.badge-purple { background: #E8E6FF; color: var(--primary); }

/* ===== Onboarding ===== */
.onboard-progress {
  display: flex;
  gap: 6px;
  margin: 16px 0 24px;
}
.onboard-dot {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
}
.onboard-dot.active { background: var(--primary); }

/* ===== Misc ===== */
.section-title { font-size: 20px; font-weight: 700; margin: 20px 16px 8px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-light); }
.empty-state .emoji { font-size: 48px; display: block; margin-bottom: 12px; }
.fade-in { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Workout Timer ===== */
.timer-display {
  font-size: 56px;
  font-weight: 800;
  text-align: center;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}
.timer-label { text-align: center; font-size: 16px; color: var(--text-light); margin-bottom: 12px; }

/* ===== Meal Cards ===== */
.meal-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 10px 16px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 14px;
}
.meal-card .meal-emoji { font-size: 36px; }
.meal-card .meal-info { flex: 1; }
.meal-card .meal-name { font-weight: 700; font-size: 18px; }
.meal-card .meal-desc { font-size: 15px; color: var(--text-light); }

/* ===== Weight Chart ===== */
.weight-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 140px;
  padding: 12px 0;
  overflow-x: auto;
}
.bar-col { display: flex; flex-direction: column; align-items: center; min-width: 36px; }
.bar { width: 28px; border-radius: 6px 6px 0 0; background: var(--primary-light); min-height: 4px; transition: height 0.3s; }
.bar-label { font-size: 11px; color: var(--text-light); margin-top: 4px; }

/* ===== Alert ===== */
.alert {
  background: #FFF5F5;
  border: 1px solid var(--red);
  border-radius: 12px;
  padding: 16px;
  margin: 12px 16px;
  color: #C0392B;
  font-size: 16px;
}
.alert-safe {
  background: #E0F8F4;
  border: 1px solid var(--green);
  color: #009688;
}

/* ===== Big tap targets ===== */
@media (min-width: 481px) {
  #app { box-shadow: 0 0 40px rgba(0,0,0,0.1); }
}
