/* Muscle Map — dark theme matching iOS */
:root {
  --bg: #000000;
  --surface: #121212;
  --surface-elevated: #1f1f1f;
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.65);
  --accent: #29D982;
  --accent-secondary: #519FFF;
  --strong: #29D982;
  --balanced: #F2C633;
  --weak: #F25252;
  --border: rgba(255, 255, 255, 0.08);
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--text-primary); -webkit-font-smoothing: antialiased; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", "PingFang TC", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* Layout */
.container { max-width: 720px; margin: 0 auto; padding: 24px 20px; }

.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(0,0,0,0.85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { max-width: 720px; margin: 0 auto; padding: 14px 20px; display: flex; align-items: center; gap: 16px; }
.nav-logo { font-weight: 800; font-size: 18px; letter-spacing: -0.01em; }
.nav-logo .accent { color: var(--accent); }
.nav-links { display: flex; gap: 8px; margin-left: auto; }
.nav-links a {
  padding: 6px 12px; border-radius: 8px;
  font-size: 14px; font-weight: 500;
  color: var(--text-secondary);
}
.nav-links a.active { color: var(--text-primary); background: var(--surface); }
.nav-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-elevated);
  display: grid; place-items: center;
  overflow: hidden;
  font-size: 14px; font-weight: 600;
}
.nav-avatar img { width: 100%; height: 100%; object-fit: cover; }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.card.elevated { background: var(--surface-elevated); }

h1 { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 16px; }
h2 { font-size: 22px; font-weight: 700; margin-bottom: 12px; }
h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
p { color: var(--text-secondary); }
.muted { color: var(--text-secondary); font-size: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 12px 18px;
  border-radius: var(--radius-sm); font-weight: 600; font-size: 15px;
  background: var(--surface-elevated); color: var(--text-primary);
  transition: transform 0.05s ease, opacity 0.15s ease;
}
.btn:hover { opacity: 0.9; }
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent); color: #000; }
.btn.full { width: 100%; }
.btn.large { padding: 16px 22px; font-size: 17px; }

.stat-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px;
}
.stat-tile {
  padding: 16px 12px; background: var(--surface);
  border-radius: var(--radius-sm); text-align: center;
}
.stat-tile .value { font-size: 22px; font-weight: 800; }
.stat-tile .label { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

/* Stepper / inputs */
.stepper {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border-radius: var(--radius); padding: 14px 16px;
  margin-bottom: 12px;
}
.stepper-label { font-weight: 600; }
.stepper-control { display: flex; align-items: center; gap: 12px; }
.stepper-btn {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--surface-elevated); color: var(--text-primary);
  font-size: 22px; font-weight: 700;
}
.stepper-btn.plus { background: var(--accent); color: #000; }
.stepper-value {
  font-size: 26px; font-weight: 800; min-width: 80px; text-align: center;
  font-feature-settings: "tnum";
}

/* Exercise grid */
.exercise-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.exercise-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 16px 8px; text-align: center;
  transition: transform 0.1s ease;
}
.exercise-card:hover { background: var(--surface-elevated); transform: translateY(-1px); }
.exercise-card .icon { font-size: 32px; margin-bottom: 8px; color: var(--accent); }
.exercise-card .name { font-weight: 700; font-size: 14px; }
.exercise-card .muscle { font-size: 11px; color: var(--text-secondary); margin-top: 4px; }

/* Chips */
.chip-row { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.chip {
  padding: 6px 12px; border-radius: 999px;
  background: var(--surface); color: var(--text-secondary);
  font-size: 13px; font-weight: 500; cursor: pointer;
}
.chip.active { background: var(--accent); color: #000; }

/* Standards table */
.level-bar {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px;
  margin: 6px 0;
}
.level-cell {
  height: 8px; border-radius: 3px;
  background: rgba(255,255,255,0.08);
}
.level-cell.fill-0 { background: var(--weak); }
.level-cell.fill-1, .level-cell.fill-2 { background: var(--balanced); }
.level-cell.fill-3 { background: var(--accent-secondary); }
.level-cell.fill-4, .level-cell.fill-5 { background: var(--strong); }

.muscle-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; background: var(--surface);
  border-radius: var(--radius-sm); margin-bottom: 8px;
}
.muscle-row .dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.muscle-row .name { font-weight: 600; min-width: 80px; }
.muscle-row .meter { flex: 1; }
.muscle-row .level-label { font-weight: 700; min-width: 60px; text-align: right; }

.dot.strong { background: var(--strong); }
.dot.balanced { background: var(--balanced); }
.dot.weak { background: var(--weak); }
.dot.intermediate { background: var(--accent-secondary); }

.threshold-row {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 8px 0;
}
.threshold-cell {
  padding: 8px 4px; border-radius: 6px; text-align: center;
  background: var(--surface-elevated);
}
.threshold-cell.reached { background: rgba(41,217,130,0.15); }
.threshold-cell .label { font-size: 11px; color: var(--text-secondary); }
.threshold-cell .value { font-size: 13px; font-weight: 600; }
.threshold-cell.reached .value { color: var(--accent); }

/* Body diagram */
.body-diagram { width: 220px; height: 440px; margin: 16px auto; position: relative; }
.body-silhouette { fill: rgba(255,255,255,0.06); stroke: rgba(255,255,255,0.18); stroke-width: 1.5; }
.hotspot {
  position: absolute; transform: translate(-50%, -50%);
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700; color: #000;
  box-shadow: 0 0 14px rgba(0,0,0,0.5);
}
.hotspot.weak { background: var(--weak); }
.hotspot.balanced { background: var(--balanced); }
.hotspot.strong { background: var(--strong); }
.hotspot.intermediate { background: var(--accent-secondary); }

/* Login */
.login-screen {
  min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(180deg, #000, #061609);
}
.login-card {
  background: var(--surface); padding: 36px 28px;
  border-radius: 20px; max-width: 380px; width: 90%;
  text-align: center; box-shadow: var(--shadow);
}
.login-card .icon { font-size: 60px; color: var(--accent); margin-bottom: 12px; }
.login-card h1 { font-size: 36px; margin-bottom: 6px; }
.login-card p { margin-bottom: 24px; }

/* Helpers */
.row { display: flex; align-items: center; gap: 12px; }
.right { margin-left: auto; }
.spacer-md { height: 12px; }
.hidden { display: none !important; }
.text-accent { color: var(--accent); }
.text-warn { color: var(--weak); }

/* Mobile */
@media (max-width: 540px) {
  h1 { font-size: 26px; }
  .exercise-grid { grid-template-columns: repeat(2, 1fr); }
  .nav-links { display: none; }
}

/* Recommend card */
.rec-card {
  background: linear-gradient(135deg, rgba(41,217,130,0.10), rgba(81,159,255,0.05));
  border: 1px solid rgba(41,217,130,0.25);
  border-radius: var(--radius);
  padding: 18px 20px;
}

/* Badge */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; color: #000;
}
.badge.strong { background: var(--strong); }
.badge.balanced { background: var(--balanced); }
.badge.weak { background: var(--weak); }
.badge.intermediate { background: var(--accent-secondary); }
