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

:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface2: #334155;
  --text: #f1f5f9;
  --text2: #94a3b8;
  --accent: #3b82f6;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 80px;
}

h1 { font-size: 1.5rem; margin-bottom: 8px; }
h2 { font-size: 1.2rem; margin-bottom: 8px; color: var(--text2); }
h3 { font-size: 1rem; margin-bottom: 4px; }

a { color: var(--accent); text-decoration: none; }

/* Header */
.header {
  text-align: center;
  padding: 20px 0;
  border-bottom: 1px solid var(--surface2);
  margin-bottom: 20px;
}
.header h1 { font-size: 1.8rem; }
.header p { color: var(--text2); font-size: 0.9rem; }

/* Navigation */
.nav {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.nav a {
  background: var(--surface);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--text);
  transition: background 0.2s;
}
.nav a.active, .nav a:hover {
  background: var(--accent);
}

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s;
}
.card:hover { transform: translateY(-2px); background: var(--surface2); }
.card-title { font-size: 1.1rem; font-weight: 600; }
.card-sub { color: var(--text2); font-size: 0.85rem; margin-top: 4px; }

/* Tags */
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag {
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  color: white;
}

/* Exercise item in plan */
.exercise-item {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
}
.exercise-item .order {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  margin-right: 10px;
  flex-shrink: 0;
}
.exercise-header {
  display: flex;
  align-items: center;
}
.exercise-meta {
  color: var(--text2);
  font-size: 0.85rem;
  margin-top: 6px;
  margin-left: 38px;
}

/* Detail sections */
.detail-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.detail-section h3 {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Tips and Warnings */
.tip-list, .warning-list {
  list-style: none;
  padding: 0;
}
.tip-list li, .warning-list li {
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 0.9rem;
  line-height: 1.5;
}
.tip-list li {
  background: rgba(16, 185, 129, 0.1);
  border-left: 3px solid var(--success);
}
.warning-list li {
  background: rgba(239, 68, 68, 0.1);
  border-left: 3px solid var(--danger);
}

/* Posture section */
.posture-step {
  padding: 12px;
  background: var(--surface2);
  border-radius: 8px;
  margin-bottom: 8px;
}
.posture-step strong {
  color: var(--accent);
  display: block;
  margin-bottom: 4px;
  font-size: 0.85rem;
}
.posture-step p {
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Expandable */
.expandable-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 8px 0;
}
.expandable-toggle::after {
  content: '▼';
  font-size: 0.7rem;
  color: var(--text2);
  transition: transform 0.2s;
}
.expandable-toggle.open::after { transform: rotate(180deg); }
.expandable-content {
  display: none;
  padding-top: 8px;
}
.expandable-content.open { display: block; }

/* Share button */
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 0.9rem;
  cursor: pointer;
  margin-bottom: 16px;
}
.share-btn:hover { opacity: 0.9; }

/* Back button */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text2);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

/* Muscle browser accordion */
.accordion-tier1 {
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
}
.accordion-header {
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}
.accordion-header::after {
  content: '+';
  font-size: 1.2rem;
  color: var(--text2);
}
.accordion-header.open::after { content: '−'; }
.accordion-body {
  display: none;
  padding: 0 16px 12px;
}
.accordion-body.open { display: block; }
.muscle-group {
  padding: 10px 12px;
  margin: 6px 0 4px;
  border-radius: 8px;
  background: var(--surface2);
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.muscle-group.clickable { cursor: pointer; transition: background 0.15s; }
.muscle-group.clickable:hover { background: var(--accent); }
.muscle-group .chev { color: var(--text2); font-size: 1.1rem; }
.muscle-sub {
  font-size: 0.85rem;
  color: var(--text2);
  padding: 6px 12px 6px 24px;
  border-radius: 6px;
}
.muscle-sub.clickable { cursor: pointer; transition: background 0.15s, color 0.15s; }
.muscle-sub.clickable:hover { background: var(--surface2); color: var(--text); }

/* Muscle filter result cards */
.muscle-card-row {
  display: flex;
  gap: 12px;
  align-items: center;
}
.muscle-card-row img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  background: #fff;
  flex-shrink: 0;
}

/* Sets/Reps badge */
.sets-reps {
  display: inline-block;
  background: var(--surface2);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* Exercise images */
.exercise-images {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}
.exercise-images figure {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  text-align: center;
}
.exercise-images img {
  width: 100%;
  height: auto;
  display: block;
  background: #fff;
}
.exercise-images figcaption {
  padding: 6px;
  font-size: 0.75rem;
  color: var(--text2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.phase-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
}
.phase-tag.start { background: #10b981; }
.phase-tag.end { background: #ef4444; }

/* Video demo button */
.video-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 6px;
  box-shadow: 0 2px 8px rgba(239,68,68,0.3);
}
.video-btn:hover { opacity: 0.92; color: #fff; }
.video-hint {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text2);
  margin-bottom: 16px;
  line-height: 1.4;
}

/* Plan thumbnail strip */
.exercise-thumbs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 10px 0 4px 38px;
}
.exercise-thumbs img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  background: #fff;
  display: block;
}

/* Muscle badges */
.muscle-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.muscle-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.muscle-section {
  margin-bottom: 10px;
}
.muscle-label {
  font-size: 0.8rem;
  color: var(--text2);
  margin-bottom: 4px;
}

/* Body diagram - cream anatomy chart (muvon style) */
.body-diagram {
  margin-top: 14px;
  background: #faf3e8;
  border-radius: 12px;
  padding: 14px 8px 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
.body-view {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.body-label {
  font-size: 0.78rem;
  color: #8b6f47;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 4px;
}
.body-svg {
  width: 100%;
  height: auto;
  max-height: 380px;
  display: block;
}
.body-svg .i {
  fill: #f5d6b8;
  stroke: #c89876;
  stroke-width: 0.3;
}
.body-svg .s {
  fill: #f8a78a;
  stroke: #c4604a;
  stroke-width: 0.4;
}
.body-svg .p {
  fill: #e85a4f;
  stroke: #b8362a;
  stroke-width: 0.5;
}
.body-diagram .legend {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 0.75rem;
  color: #6b4f30;
  margin-top: 6px;
  padding: 8px 0 4px;
  border-top: 1px solid #e8d4b4;
}
.body-diagram .legend i.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
  border: 1px solid rgba(0,0,0,0.15);
}
.body-diagram .legend i.dot.p { background: #e85a4f; }
.body-diagram .legend i.dot.s { background: #f8a78a; }
.body-diagram .legend i.dot.i { background: #f5d6b8; }

/* Weekly schedule */
.schedule-card {
  background: linear-gradient(135deg, #059669 0%, #0891b2 100%);
  border: 1px solid rgba(255,255,255,0.1);
}
.schedule-card .card-title { color: #fff; }
.schedule-card .card-sub { color: rgba(255,255,255,0.85); }

.schedule-pick {
  display: flex;
  align-items: center;
  gap: 14px;
}
.schedule-pick-num {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #059669 0%, #0891b2 100%);
  color: #fff;
  font-size: 1.6rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.schedule-pick-num.women {
  background: linear-gradient(135deg, #ec4899 0%, #f97316 100%);
}
.women-pick {
  border-left: 3px solid #ec4899;
}

.science-box {
  background: linear-gradient(135deg, rgba(5,150,105,0.12) 0%, rgba(8,145,178,0.12) 100%);
  border-left: 4px solid #10b981;
  border-radius: 8px;
  padding: 12px 14px;
  margin: 14px 0;
  font-size: 0.9rem;
  line-height: 1.55;
}
.science-title {
  font-weight: 700;
  margin-bottom: 8px;
  color: #10b981;
}
.rest-pattern {
  background: var(--surface);
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  line-height: 1.55;
}

.schedule-day {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
}
.schedule-day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--surface2);
}
.schedule-day-header h3 { font-size: 1.05rem; }
.day-badge {
  background: var(--accent);
  color: #fff;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
}
.schedule-day .exercise-item {
  background: var(--surface2);
  margin-bottom: 8px;
}
.exercise-note {
  margin-left: 38px;
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--text);
  background: rgba(59,130,246,0.1);
  border-left: 3px solid var(--accent);
  padding: 6px 10px;
  border-radius: 4px;
}

/* Custom plan builder */
.builder-card {
  background: linear-gradient(135deg, #1e40af 0%, #7c3aed 100%);
  border: 1px solid rgba(255,255,255,0.1);
}
.builder-card .card-title { color: #fff; }
.builder-card .card-sub { color: rgba(255,255,255,0.85); }

.builder-groups {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}
.builder-tier {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px;
}
.builder-tier h3 {
  margin-bottom: 10px;
  color: var(--text2);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.builder-check {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface2);
  padding: 10px 12px;
  margin-bottom: 6px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.builder-check:hover { background: #475569; }
.builder-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}
.builder-check input:checked + span {
  font-weight: 700;
}
.builder-summary {
  background: var(--surface);
  padding: 14px;
  border-radius: var(--radius);
  margin: 16px 0 12px;
  border-left: 4px solid var(--accent);
}
.builder-summary h3 { margin-bottom: 4px; }
.compound-tag {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 700;
  vertical-align: middle;
  margin-left: 4px;
}
.builder-thumb {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 6px;
  background: #fff;
}

/* Responsive */
@media (min-width: 768px) {
  body { max-width: 640px; }
}
