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

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    sans-serif;
  background: #faf6f1;
  color: #2d2a26;
  min-height: 100vh;
  line-height: 1.6;
}

header {
  text-align: center;
  padding: 32px 20px 24px;
}

header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: #2d2a26;
}

.subtitle {
  color: #7a7570;
  font-size: 0.95rem;
  margin: 4px 0 8px;
}

.goal-badge {
  display: inline-block;
  background: #e07c4f;
  color: white;
  border-radius: 20px;
  padding: 6px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  margin: 8px 0 16px;
}

/* Tab Navigation */
.tab-nav {
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 0 20px 24px;
  flex-wrap: wrap;
  max-width: 900px;
  margin: 0 auto;
}

.tab-btn {
  background: #fff;
  border: 1px solid #e0d8d0;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s;
  color: #5a5550;
  font-weight: 500;
}

.tab-btn:hover {
  border-color: #e07c4f;
  color: #e07c4f;
}

.tab-btn.active {
  background: #e07c4f;
  color: white;
  border-color: #e07c4f;
}

/* Sections */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

.section {
  display: none;
}

.section.active {
  display: block;
}

.card {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  padding: 20px 24px;
  margin-bottom: 16px;
}

.card h2 {
  font-size: 1.15rem;
  color: #2d2a26;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #f0ebe5;
}

.card h3 {
  font-size: 1rem;
  color: #4a7c59;
  margin: 14px 0 8px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-item {
  background: #fdf5ef;
  border-radius: 10px;
  padding: 14px;
  text-align: center;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: #e07c4f;
}

.stat-label {
  font-size: 0.78rem;
  color: #7a7570;
  margin-top: 2px;
}

/* Macro Bars */
.macro-bars {
  display: flex;
  gap: 12px;
  margin: 12px 0;
}

.macro-bar {
  flex: 1;
  background: #f5f0eb;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

.macro-bar .value {
  font-size: 1.2rem;
  font-weight: 700;
}

.macro-bar .label {
  font-size: 0.78rem;
  color: #7a7570;
}

.macro-bar.protein {
  border-left: 4px solid #e07c4f;
}
.macro-bar.carb {
  border-left: 4px solid #4a7c59;
}
.macro-bar.fat {
  border-left: 4px solid #c4973b;
}
.macro-bar.protein .value {
  color: #e07c4f;
}
.macro-bar.carb .value {
  color: #4a7c59;
}
.macro-bar.fat .value {
  color: #c4973b;
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin: 8px 0;
}

.data-table th {
  background: #f5f0eb;
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  color: #5a5550;
  font-size: 0.82rem;
}

.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #f0ebe5;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background-color: #fdf5ef;
}

/* Rules */
.rule-list {
  list-style: none;
  counter-reset: rule;
}

.rule-list li {
  counter-increment: rule;
  padding: 10px 0;
  border-bottom: 1px solid #f0ebe5;
  font-size: 0.92rem;
}

.rule-list li:last-child {
  border-bottom: none;
}

.rule-list li::before {
  content: counter(rule);
  display: inline-block;
  width: 24px;
  height: 24px;
  background: #e07c4f;
  color: white;
  border-radius: 50%;
  text-align: center;
  line-height: 24px;
  font-size: 0.75rem;
  font-weight: 700;
  margin-right: 10px;
  flex-shrink: 0;
}

.rule-list li strong {
  color: #2d2a26;
}

/* Weekly Meal Plan */
.week-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
}

.day-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.day-header {
  background: #e07c4f;
  color: white;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.day-header .reroll-day-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 6px;
  color: white;
  cursor: pointer;
  padding: 2px 8px;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.day-header .reroll-day-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: white;
}

.meal-section {
  padding: 8px 12px;
  border-bottom: 1px solid #f0ebe5;
  min-height: 125px;
}

.meal-section:last-child {
  border-bottom: none;
}

.meal-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: #4a7c59;
  margin-bottom: 6px;
}

.meal-title .kcal {
  color: #b0a8a0;
  font-weight: 400;
}

.meal-items {
  list-style: none;
  font-size: 0.8rem;
}

.meal-items li {
  padding: 3px 0;
  color: #4a4540;
}

.meal-items li::before {
  content: "·";
  color: #e07c4f;
  font-weight: 700;
  margin-right: 6px;
}

.has-detail {
  cursor: help;
  border-bottom: 1px dotted #c0b8b0;
}

/* Meal Prep */
.prep-flow {
  display: flex;
  gap: 12px;
  margin: 12px 0;
  flex-wrap: wrap;
}

.prep-step {
  flex: 1;
  min-width: 200px;
  background: #fdf5ef;
  border-radius: 10px;
  padding: 14px;
  position: relative;
}

.prep-step .step-num {
  background: #e07c4f;
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.prep-step .step-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.prep-step .step-desc {
  font-size: 0.82rem;
  color: #7a7570;
}

/* Training Day Toggle */
.toggle-row {
  display: flex;
  gap: 12px;
  margin: 12px 0;
}

.toggle-card {
  flex: 1;
  background: #f5f0eb;
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
}

.toggle-card.selected {
  border-color: #e07c4f;
  background: #fdf5ef;
}

.toggle-card .toggle-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.toggle-card .toggle-detail {
  font-size: 0.82rem;
  color: #5a5550;
}

/* Phase Timeline */
.phase-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 12px 0;
}

.phase-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.phase-marker {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #e07c4f;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.phase-content {
  flex: 1;
  background: #fdf5ef;
  border-radius: 10px;
  padding: 14px;
}

.phase-content .phase-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.phase-content .phase-desc {
  font-size: 0.85rem;
  color: #5a5550;
}

/* FAQ */
.faq-item {
  border-bottom: 1px solid #f0ebe5;
  padding: 12px 0;
  cursor: pointer;
}

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

.faq-q {
  font-weight: 600;
  font-size: 0.92rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-q .arrow {
  transition: transform 0.2s;
  color: #b0a8a0;
}

.faq-item.open .faq-q .arrow {
  transform: rotate(180deg);
}

.faq-a {
  font-size: 0.88rem;
  color: #5a5550;
  max-height: 0;
  overflow: hidden;
  transition:
    max-height 0.3s ease,
    padding 0.3s ease;
  padding-top: 0;
}

.faq-item.open .faq-a {
  max-height: 200px;
  padding-top: 8px;
}

/* Checklist */
.checklist {
  list-style: none;
}

.checklist li {
  padding: 8px 0;
  border-bottom: 1px solid #f0ebe5;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.checklist li:last-child {
  border-bottom: none;
}

.checklist li .check-box {
  width: 22px;
  height: 22px;
  border: 2px solid #d0c8c0;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.checklist li.checked .check-box {
  background: #4a7c59;
  border-color: #4a7c59;
}

.checklist li.checked .check-box::after {
  content: "✓";
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
}

.checklist li.checked .check-text {
  text-decoration: line-through;
  color: #b0a8a0;
}

/* Note */
.note {
  background: #fdf5ef;
  border-left: 3px solid #e07c4f;
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
  font-size: 0.85rem;
  color: #5a5550;
  margin: 12px 0;
}

footer {
  text-align: center;
  padding: 16px 20px 40px;
  color: #7a7570;
  font-size: 0.85rem;
}

@media (max-width: 768px) {
  header h1 {
    font-size: 1.5rem;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .macro-bars {
    flex-direction: column;
  }
  .toggle-row {
    flex-direction: column;
  }
  .week-grid {
    grid-template-columns: 1fr;
  }
  .prep-flow {
    flex-direction: column;
  }
  .tab-nav {
    gap: 6px;
  }
  .tab-btn {
    padding: 6px 10px;
    font-size: 0.82rem;
  }
}
