:root {
  --bg: #12121a;
  --card: #1c1c28;
  --accent: #ff4d6d;
  --accent2: #ffb703;
  --text: #f1f1f6;
  --muted: #9a9ab0;
  --good: #34d399;
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 40px;
}

.app-header {
  padding: 28px 20px 20px;
  text-align: center;
  background: linear-gradient(135deg, #ff4d6d, #ffb703);
}

.app-header h1 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: -0.5px;
  color: #12121a;
}

.tagline {
  margin: 6px 0 0;
  color: #241010;
  font-weight: 500;
  font-size: 0.95rem;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
}

.card-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
}

.card-section h2 {
  margin: 0 0 12px;
  font-size: 1.2rem;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.section-head h2 { margin: 0; }

.btn-add {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.85rem;
}

.goals-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 420px) {
  .goals-grid { grid-template-columns: 1fr; }
}

.goal-card {
  background: #262636;
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
}

.goal-card h3 {
  margin: 0 0 6px;
  font-size: 0.95rem;
}

.goal-values {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.progress-bar-bg {
  background: #3a3a4c;
  border-radius: 8px;
  height: 10px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 8px;
  transition: width 0.3s ease;
}

.progress-pct {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
  text-align: right;
}

.week-row {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

.day-btn {
  flex: 1;
  aspect-ratio: 1;
  border-radius: 10px;
  border: none;
  background: #262636;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.8rem;
}

.day-btn.done {
  background: var(--good);
  color: #06281c;
}

.day-btn.today {
  outline: 2px solid var(--accent2);
}

.week-stats {
  display: flex;
  justify-content: space-around;
  margin-top: 16px;
}

.stat { text-align: center; }

.stat-value {
  display: block;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent2);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--muted);
}

.plan-note {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0;
}

.plan-day {
  margin-bottom: 16px;
}

.plan-day h3 {
  margin: 0 0 8px;
  color: var(--accent2);
  font-size: 1rem;
}

.exercise-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #2c2c3c;
}

.exercise-row:last-child { border-bottom: none; }

.exercise-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.exercise-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.exercise-sets {
  font-size: 0.78rem;
  color: var(--muted);
}

.exercise-row.checked .exercise-name {
  text-decoration: line-through;
  color: var(--muted);
}

.measure-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.measure-form input {
  background: #262636;
  border: 1px solid #3a3a4c;
  color: var(--text);
  padding: 10px;
  border-radius: 8px;
  font-size: 0.85rem;
}

.measure-form input[type="date"] { grid-column: 1 / -1; }

.measure-form button {
  grid-column: 1 / -1;
}

canvas {
  width: 100%;
  height: 200px;
  background: #262636;
  border-radius: 12px;
  margin-bottom: 12px;
}

.measure-list {
  font-size: 0.82rem;
  color: var(--muted);
  max-height: 160px;
  overflow-y: auto;
}

.measure-entry {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid #2c2c3c;
}

.measure-entry button {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.8rem;
}

footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.75rem;
  padding: 20px;
}

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 10;
}

.modal-backdrop.open { display: flex; }

.modal {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  width: 100%;
  max-width: 360px;
}

.modal h3 { margin-top: 0; }

.modal label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.modal input {
  display: block;
  width: 100%;
  margin-top: 4px;
  background: #262636;
  border: 1px solid #3a3a4c;
  color: var(--text);
  padding: 8px;
  border-radius: 8px;
}

.modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 600;
}

.btn-secondary {
  background: #3a3a4c;
  color: var(--text);
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  margin-right: 8px;
}

.btn-danger {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 8px 14px;
  border-radius: 20px;
}
