* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

:root {
  --primary: #4F46E5;
  --primary-light: #818CF8;
  --primary-dark: #3730A3;
  --accent: #10B981;
  --accent-light: #34D399;
  --warning: #F59E0B;
  --danger: #EF4444;
  --bg: #F8FAFC;
  --card-bg: #FFFFFF;
  --text: #1E293B;
  --text-light: #64748B;
  --border: #E2E8F0;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

#app {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px;
}

header {
  text-align: center;
  padding: 30px 0 20px;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.logo-icon {
  font-size: 32px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo h1 {
  font-size: 28px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  color: var(--text-light);
  margin-top: 8px;
  font-size: 14px;
}

/* Steps Navigation */
.steps-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 24px 0 32px;
  padding: 8px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.step-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.3s;
  font-size: 14px;
  color: var(--text-light);
}

.step-btn:hover {
  background: var(--bg);
}

.step-btn.active {
  background: var(--primary);
  color: white;
}

.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  background: var(--border);
  color: var(--text-light);
}

.step-btn.active .step-num {
  background: rgba(255,255,255,0.3);
  color: white;
}

.step-btn.completed .step-num {
  background: var(--accent);
  color: white;
}

.step-connector {
  width: 40px;
  height: 2px;
  background: var(--border);
  transition: background 0.3s ease;
}

.step-connector.completed {
  background: var(--accent);
}

/* Sections */
.step-section {
  display: none;
}

.step-section.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-header {
  margin-bottom: 24px;
}

.section-header h2 {
  font-size: 24px;
  margin-bottom: 4px;
}

.section-header p {
  color: var(--text-light);
  font-size: 14px;
}

/* Cards */
@keyframes cardEntrance {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  animation: cardEntrance 0.45s ease both;
}

.card:nth-of-type(2) { animation-delay: 0.06s; }
.card:nth-of-type(3) { animation-delay: 0.12s; }
.card:nth-of-type(4) { animation-delay: 0.18s; }
.card:nth-of-type(5) { animation-delay: 0.24s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card,
  .step-section.active {
    animation: none;
  }
}

.card h3 {
  font-size: 18px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--primary);
  color: white;
  font-weight: 500;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
}

input[type="text"],
input[type="number"],
select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.2s;
  background: var(--bg);
}

input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Better focus states for keyboard navigation */
.btn:focus-visible,
.step-btn:focus-visible,
.goal-type-btn:focus-visible,
.week-btn:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

/* Fitness Items */
.fitness-items {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.fitness-item {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.item-name {
  font-weight: 600;
  font-size: 14px;
}

.item-weight {
  font-size: 12px;
  color: var(--primary);
  background: rgba(79, 70, 229, 0.1);
  padding: 2px 8px;
  border-radius: 12px;
}

.item-desc {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 8px;
}

.item-input {
  width: 200px;
}

.item-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  margin: 4px 0;
}

.item-score {
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

.action-bar {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  justify-content: center;
}

/* Score Summary */
.score-summary {
  border: 2px solid var(--primary);
}

.score-overview {
  display: flex;
  align-items: center;
  gap: 40px;
  margin-bottom: 24px;
}

.total-score-ring {
  position: relative;
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}

.total-score-ring svg {
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 8;
}

.ring-fill {
  fill: none;
  stroke: var(--primary);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 339.292;
  stroke-dashoffset: 339.292;
  transition: stroke-dashoffset 1s ease;
}

.score-number {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
}

.score-label {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--text-light);
}

.score-breakdown {
  flex: 1;
}

.breakdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.breakdown-label {
  width: 100px;
  font-size: 13px;
  font-weight: 500;
}

.breakdown-bar {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s ease;
  width: 0;
}

.health-bar {
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
}

.sports-bar {
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
}

.breakdown-value {
  font-weight: 700;
  font-size: 14px;
  width: 40px;
  text-align: right;
}

.score-level {
  text-align: center;
  padding: 12px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 16px;
  margin-top: 16px;
}

.level-excellent { background: #D1FAE5; color: #065F46; }
.level-good { background: #DBEAFE; color: #1E40AF; }
.level-average { background: #FEF3C7; color: #92400E; }
.level-poor { background: #FEE2E2; color: #991B1B; }

/* Score detail grid: individual item scores */
.score-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.score-detail-grid:empty {
  display: none;
}

.score-detail-grid .detail-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.score-detail-grid .detail-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--primary-light);
}

.score-detail-grid .detail-name {
  display: block;
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 4px;
}

.score-detail-grid .detail-score {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.score-detail-grid .detail-score.detail-low {
  color: var(--danger);
}

.score-detail-grid .detail-score.detail-high {
  color: var(--accent);
}

/* Radar Chart */
#radarCanvas {
  display: block;
  margin: 0 auto;
  max-width: 100%;
}

/* Goal Types */
.goal-types {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.goal-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  transition: all 0.2s;
}

.goal-type-btn:hover {
  border-color: var(--primary-light);
}

.goal-type-btn.active {
  border-color: var(--primary);
  background: rgba(79, 70, 229, 0.05);
}

.goal-type-icon {
  font-size: 32px;
}

.goal-type-name {
  font-weight: 700;
  font-size: 14px;
}

.goal-type-desc {
  font-size: 12px;
  color: var(--text-light);
}

.goal-plan-form {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

#generatedPlan h4 {
  font-size: 15px;
  margin: 16px 0 8px;
  color: var(--primary-dark);
}

#phaseGoals {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.phase-goal {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg);
  border-radius: 8px;
  border-left: 3px solid var(--primary);
}

.phase-week {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  min-width: 60px;
}

.phase-desc {
  font-size: 13px;
}

#trainingAdvice, #nutritionAdvice {
  font-size: 13px;
  line-height: 1.8;
  color: var(--text);
}

#trainingAdvice ul, #nutritionAdvice ul {
  padding-left: 20px;
}

/* Step 3 - Tracking */
.week-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.week-btn {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.week-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.training-log {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.log-day {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px;
  background: var(--bg);
  border-radius: 8px;
}

.log-day label {
  font-weight: 600;
  font-size: 13px;
  min-width: 120px;
}

.log-controls {
  display: flex;
  gap: 8px;
  flex: 1;
}

.completion-select {
  width: 120px;
}

.log-note {
  flex: 1;
}

#currentGoalOverview {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.overview-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: 8px;
}

.overview-stat .stat-label {
  font-size: 13px;
  color: var(--text-light);
}

.overview-stat .stat-value {
  font-weight: 700;
  font-size: 16px;
}

.progress-chart {
  margin-bottom: 16px;
}

#progressCanvas {
  display: block;
  max-width: 100%;
}

.progress-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.progress-stat {
  text-align: center;
  padding: 16px;
  background: var(--bg);
  border-radius: 8px;
}

.progress-stat .stat-number {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
}

.progress-stat .stat-desc {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

.retest-section {
  text-align: center;
}

.retest-section p {
  color: var(--text-light);
  margin-bottom: 16px;
}

#comparisonTable {
  margin-top: 16px;
}

.comparison-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.comparison-row:last-child {
  border-bottom: none;
}

.comparison-item {
  font-weight: 500;
}

.comparison-values {
  display: flex;
  gap: 16px;
  align-items: center;
}

.comparison-before, .comparison-after {
  font-size: 14px;
  min-width: 60px;
  text-align: center;
}

.comparison-change {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}

.change-up {
  background: #D1FAE5;
  color: #065F46;
}

.change-down {
  background: #FEE2E2;
  color: #991B1B;
}

.change-same {
  background: var(--border);
  color: var(--text-light);
}

.placeholder-text {
  color: var(--text-light);
  text-align: center;
  padding: 20px;
  font-style: italic;
}

/* History */
#historyList {
  max-height: 300px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.history-item:last-child {
  border-bottom: none;
}

.history-date {
  font-size: 12px;
  color: var(--text-light);
}

.history-score {
  font-weight: 700;
  color: var(--primary);
}

.history-type {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--bg);
}

/* Toast notifications */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translate(-50%, -150%);
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: white;
  background: var(--text);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s ease, opacity 0.35s ease;
  max-width: calc(100vw - 32px);
  text-align: center;
}

.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
  animation: toastSlideIn 0.35s ease;
}

.toast-success {
  background: var(--accent);
}

.toast-error {
  background: var(--danger);
}

@keyframes toastSlideIn {
  from { transform: translate(-50%, -150%); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 24px 0 12px;
  margin-top: 32px;
  border-top: 1px solid var(--border);
  color: var(--text-light);
  font-size: 12px;
}

/* Responsive */
@media (max-width: 768px) {
  .goal-types {
    grid-template-columns: 1fr;
  }
  .goal-plan-form {
    grid-template-columns: 1fr;
  }
  .score-overview {
    flex-direction: column;
  }
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }
  .progress-stats {
    grid-template-columns: 1fr;
  }
  .steps-nav {
    flex-wrap: wrap;
    gap: 4px;
  }
  .step-connector {
    display: none;
  }
}

/* Card entrance animation */
.card {
  animation: cardEnter 0.4s ease-out;
}

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Toast notifications */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  z-index: 1000;
  transition: transform 0.3s ease;
  box-shadow: var(--shadow-lg);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast.success {
  background: var(--accent);
  color: white;
}

.toast.error {
  background: var(--danger);
  color: white;
}

.toast.info {
  background: var(--primary);
  color: white;
}

/* Score detail grid */
.score-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.score-detail-item {
  text-align: center;
  padding: 12px;
  background: var(--bg);
  border-radius: 8px;
}

.score-detail-item .detail-label {
  font-size: 11px;
  color: var(--text-light);
  margin-bottom: 4px;
}

.score-detail-item .detail-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}

/* Footer */
footer {
  text-align: center;
  padding: 24px;
  margin-top: 40px;
  color: var(--text-light);
  font-size: 12px;
  border-top: 1px solid var(--border);
}

/* Step connector completed state */
.step-connector.completed {
  background: var(--accent);
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Better focus states */
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Improved mobile layout */
@media (max-width: 480px) {
  #app {
    padding: 12px;
  }
  
  header {
    padding: 20px 0 16px;
  }
  
  .logo h1 {
    font-size: 22px;
  }
  
  .card {
    padding: 16px;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  .item-input {
    width: 100%;
  }
  
  .action-bar {
    flex-direction: column;
  }
  
  .btn {
    width: 100%;
  }
}

/* Exercise Plan */
.exercise-plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin: 8px 0 4px;
}

.exercise-day {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.exercise-day-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-light);
}

.exercise-day-sub {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-light);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 10px;
  white-space: nowrap;
}

.exercise-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
}

.exercise-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 4px;
}

.exercise-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.exercise-target {
  color: var(--text-light);
}

.exercise-rx {
  color: var(--primary);
  font-weight: 600;
  white-space: nowrap;
}

.exercise-cue {
  font-size: 12px;
  color: var(--text-light);
  line-height: 1.5;
  border-top: 1px dashed var(--border);
  padding-top: 6px;
}

@media (max-width: 640px) {
  .exercise-plan-grid {
    grid-template-columns: 1fr;
  }
}

/* v2: safety screening, goal separation and education center */
.goal-types-four {
  grid-template-columns: repeat(4, 1fr);
}

.screening-intro {
  color: var(--text-light);
  font-size: 13px;
  margin-bottom: 14px;
}

.badge-safety {
  background: #FEF3C7;
  color: #92400E;
}

.screening-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.screening-option {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  font-size: 13px;
  line-height: 1.5;
  cursor: pointer;
}

.screening-option input {
  width: auto;
  margin-top: 3px;
}

.screening-alert,
.risk-notice,
.plan-rationale,
.training-dose-summary,
.adaptive-coach {
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.7;
}

.screening-alert {
  margin-top: 12px;
}

.screening-clear {
  background: #D1FAE5;
  color: #065F46;
}

.screening-risk,
.risk-notice {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #F59E0B;
}

.plan-rationale {
  background: linear-gradient(135deg, #EEF2FF, #ECFDF5);
  border-left: 4px solid var(--primary);
}

.plan-rationale ul,
.training-dose-summary ul {
  margin: 6px 0 0;
  padding-left: 20px;
}

.training-dose-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.dose-item {
  text-align: center;
  padding: 8px;
}

.dose-value {
  display: block;
  color: var(--primary);
  font-size: 20px;
  font-weight: 800;
}

.dose-label {
  color: var(--text-light);
  font-size: 11px;
}

.progression-roadmap {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.roadmap-week {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: var(--card-bg);
}

.roadmap-week strong,
.roadmap-week span {
  display: block;
}

.roadmap-week strong {
  color: var(--primary);
  margin-bottom: 3px;
}

.roadmap-week span {
  color: var(--text-light);
  font-size: 11px;
}

.adaptive-coach {
  margin-top: 14px;
  background: #EEF2FF;
  border: 1px solid #C7D2FE;
  color: #3730A3;
}

.adaptive-coach.warning {
  background: #FEF3C7;
  border-color: #F59E0B;
  color: #92400E;
}

.adaptive-coach.recovery {
  background: #FEE2E2;
  border-color: #FCA5A5;
  color: #991B1B;
}

.knowledge-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.knowledge-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  background: linear-gradient(135deg, #EEF2FF, #ECFDF5);
}

.knowledge-hero p {
  color: var(--text-light);
  margin-top: 6px;
}

.knowledge-progress {
  flex-shrink: 0;
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--primary);
  color: white;
  font-weight: 700;
  font-size: 12px;
}

.knowledge-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.knowledge-filter {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card-bg);
  cursor: pointer;
}

.knowledge-filter.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.knowledge-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.knowledge-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card-bg);
  padding: 18px;
  box-shadow: var(--shadow);
}

.knowledge-card-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.knowledge-tag {
  height: fit-content;
  padding: 2px 8px;
  border-radius: 999px;
  background: #EEF2FF;
  color: var(--primary-dark);
  font-size: 10px;
  font-weight: 700;
}

.knowledge-card p,
.knowledge-card li {
  color: var(--text-light);
  font-size: 13px;
  line-height: 1.7;
}

.knowledge-card ul {
  padding-left: 18px;
  margin: 8px 0;
}

.knowledge-apply {
  padding: 9px 10px;
  margin-top: 10px;
  border-radius: 8px;
  background: var(--bg);
  font-size: 12px;
  color: var(--text);
}

.glossary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.glossary-item {
  padding: 10px;
  border-radius: 8px;
  background: var(--bg);
  font-size: 12px;
  line-height: 1.6;
}

.glossary-item strong {
  display: block;
  color: var(--primary-dark);
}

@media (max-width: 960px) {
  .goal-types-four {
    grid-template-columns: repeat(2, 1fr);
  }
  .training-dose-summary,
  .progression-roadmap {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .goal-types-four,
  .screening-grid,
  .knowledge-grid,
  .glossary-grid {
    grid-template-columns: 1fr;
  }
  .knowledge-hero {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Injury/Experience selects get same styling as other form elements - already handled by existing select styles */

/* Enhanced Training Log (wider, multi-row layout) */
.log-day-enhanced {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.log-day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.log-day-header label {
  font-weight: 700;
  font-size: 14px;
}

.log-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.log-row label {
  font-size: 12px;
  color: var(--text-light);
  min-width: 50px;
}

.log-row select,
.log-row input {
  padding: 6px 8px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
}

.log-row input {
  width: 80px;
}

.log-row select {
  width: 100px;
}

/* Pain Scale Styling */
.pain-scale {
  display: flex;
  gap: 4px;
  align-items: center;
}

.pain-level {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: white;
  cursor: pointer;
  transition: transform 0.15s;
}

.pain-level:hover {
  transform: scale(1.2);
}

.pain-low { background: #10B981; }
.pain-medium { background: #F59E0B; }
.pain-high { background: #EF4444; }

/* Body Tracking Table */
.body-tracking-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.body-tracking-table th,
.body-tracking-table td {
  padding: 10px 12px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.body-tracking-table th {
  background: var(--bg);
  font-weight: 600;
  color: var(--text-light);
  font-size: 12px;
}

.body-tracking-table td:first-child {
  font-weight: 600;
  text-align: left;
}

/* Wellness Summary */
.wellness-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.wellness-stat {
  text-align: center;
  padding: 14px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.wellness-stat .ws-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
}

.wellness-stat .ws-label {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 4px;
}

/* Exercise Card Enhancements (rest interval, equipment badges) */
.exercise-badges {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.exercise-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.badge-rest {
  background: #DBEAFE;
  color: #1E40AF;
}

.badge-equip {
  background: #FEF3C7;
  color: #92400E;
}

.badge-regression {
  background: #FCE7F3;
  color: #9D174D;
}

.exercise-level-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  margin: 8px 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  font-size: 12px;
}

.exercise-level-summary > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.level-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.level-chip,
.badge-level {
  border-radius: 999px;
  font-weight: 700;
}

.level-chip {
  padding: 3px 8px;
}

.level-beginner {
  background: #D1FAE5;
  color: #065F46;
}

.level-intermediate {
  background: #DBEAFE;
  color: #1E40AF;
}

.level-advanced {
  background: #FEE2E2;
  color: #991B1B;
}

.pool-count {
  color: var(--text-light);
  margin-left: 4px;
}

/* Warm-up / Cool-down Section in Day Card */
.exercise-warmup,
.exercise-cooldown {
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
}

.exercise-warmup {
  background: #FEF3C7;
  border: 1px dashed #F59E0B;
}

.exercise-cooldown {
  background: #DBEAFE;
  border: 1px dashed #3B82F6;
}

.exercise-warmup-title,
.exercise-cooldown-title {
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.exercise-warmup-list,
.exercise-cooldown-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.exercise-warmup-item,
.exercise-cooldown-item {
  background: rgba(255,255,255,0.7);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
}

/* Progression Indicator */
.progression-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: linear-gradient(135deg, rgba(79,70,229,0.05), rgba(16,185,129,0.05));
  border-radius: 8px;
  margin-bottom: 10px;
  font-size: 12px;
}

.progression-week {
  font-weight: 700;
  color: var(--primary);
}

.progression-desc {
  color: var(--text-light);
}

.progression-volume {
  margin-left: auto;
  font-weight: 600;
  color: var(--accent);
  font-size: 11px;
}

/* Nutrition Personalized Display */
.nutrition-personalized {
  background: linear-gradient(135deg, #D1FAE5, #DBEAFE);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
}

.nutrition-personalized h5 {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.nutrition-macro {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
}

.nutrition-macro-value {
  font-weight: 700;
  color: var(--primary-dark);
}

/* Rehab-specific Warning Box */
.rehab-warning {
  background: #FEF3C7;
  border: 1px solid #F59E0B;
  border-radius: 8px;
  padding: 12px;
  margin: 8px 0;
  font-size: 12px;
  color: #92400E;
}

.rehab-warning strong {
  display: block;
  margin-bottom: 4px;
}

/* Responsive adjustments for enhanced log */
@media (max-width: 640px) {
  .log-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .log-row select,
  .log-row input {
    width: 100%;
  }
  .wellness-summary {
    grid-template-columns: repeat(2, 1fr);
  }
}

.training-backup { margin: 0 0 24px; padding: 18px; }
.training-backup h2 { font-size: 18px; margin-bottom: 8px; }
.training-backup p { font-size: 14px; margin: 8px 0; overflow-wrap: anywhere; }
.backup-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.storage-warning { color: #8b2e18; background: #fff1e8; padding: 12px; border-radius: 8px; }

.exercise-search-controls {display:flex; flex-wrap:wrap; gap:12px; align-items:end; margin:16px 0;}
.exercise-search-controls label {display:grid; gap:6px; flex:1 1 160px;}
.exercise-search-results {display:grid; grid-template-columns:repeat(auto-fit,minmax(min(240px,100%),1fr)); gap:12px;}

/* Named controls retain practical touch targets on narrow screens. */
.log-day-header h4 { margin: 0; font-size: inherit; }
.log-row input, .log-row select { min-height: 44px; }

/* Keep training controls inside the same mobile layout as the responsive chart. */
.log-controls, .log-note { min-width: 0; }
@media (max-width: 640px) {
  .log-day { flex-direction: column; align-items: stretch; }
  .log-day label { min-width: 0; }
  .log-controls { flex-wrap: wrap; }
  .log-note { flex: 1 1 140px; }
}
/* Prescription estimates remain readable on narrow screens. */
.plan-estimate { font-size: 12px; color: var(--text-light); line-height: 1.6; margin-top: 8px; }
.exercise-day-sub { white-space: normal; }
