:root {
  --bg: #09090b;
  --surface: #131316;
  --surface-2: #1a1a1f;
  --surface-3: #222228;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #fafafa;
  --text-2: #a1a1aa;
  --text-3: #71717a;
  --accent: #f97316;
  --accent-2: #fb923c;
  --accent-soft: rgba(249, 115, 22, 0.12);
  --accent-glow: rgba(249, 115, 22, 0.35);
  --violet: #a78bfa;
  --violet-soft: rgba(167, 139, 250, 0.12);
  --blue: #60a5fa;
  --blue-soft: rgba(96, 165, 250, 0.12);
  --green: #4ade80;
  --green-soft: rgba(74, 222, 128, 0.12);
  --rose: #fb7185;
  --rose-soft: rgba(251, 113, 133, 0.12);
  --radius: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --nav-h: 76px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html { font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  z-index: 0;
}

.bg-glow-1 {
  width: 280px;
  height: 280px;
  top: -80px;
  right: -60px;
  background: rgba(249, 115, 22, 0.14);
}

.bg-glow-2 {
  width: 220px;
  height: 220px;
  bottom: 120px;
  left: -80px;
  background: rgba(167, 139, 250, 0.1);
}

#app {
  position: relative;
  z-index: 1;
  max-width: 440px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  padding: 20px 20px 14px;
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(9, 9, 11, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent) 0%, #ea580c 100%);
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 8px 24px var(--accent-glow);
}

.brand-mark svg { width: 20px; height: 20px; }

.logo {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.logo-sub {
  font-size: 0.72rem;
  color: var(--text-3);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.datetime {
  text-align: right;
  font-size: 0.78rem;
  color: var(--text-2);
  line-height: 1.45;
}

.datetime .date-line {
  color: var(--text-3);
  font-weight: 500;
}

.datetime .time {
  display: block;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.progress-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.summary-chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 5px 12px;
  font-size: 0.72rem;
  color: var(--text-2);
  font-weight: 500;
}

.summary-chip strong {
  color: var(--accent-2);
  font-weight: 700;
}

/* Main */
.main-content {
  flex: 1;
  padding: 8px 20px calc(var(--nav-h) + var(--safe-b) + 20px);
}

.tab-panel {
  display: none;
  animation: fadeUp 0.35s ease;
}

.tab-panel.active { display: block; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-head {
  margin: 20px 0 14px;
}

.section-head.compact { margin-top: 28px; }

.section-head h2 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section-head p {
  font-size: 0.82rem;
  color: var(--text-3);
  margin-top: 3px;
}

.subtitle { color: var(--text-3); }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
}

.card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 14px;
}

/* Day buttons */
.day-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.day-btn {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 14px 14px 16px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: all 0.22s ease;
  overflow: hidden;
  font-family: inherit;
}

.day-btn::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--day-color, var(--accent));
  opacity: 0.5;
  transition: opacity 0.22s;
}

.day-btn.active::before { opacity: 1; }

.day-btn.active {
  background: var(--surface-2);
  border-color: var(--border-strong);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}

.day-btn .day-num {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 2px;
}

.day-btn .day-sub {
  font-size: 0.75rem;
  color: var(--text-3);
  font-weight: 500;
}

.day-btn.active .day-num { color: var(--day-color, var(--accent-2)); }

.day-btn.is-today:not(.active) {
  border-color: rgba(255, 255, 255, 0.14);
}

.today-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--day-color, var(--accent-2));
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
}

.exercise-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin: 16px 0 8px;
  padding-left: 2px;
}

.exercise-section-title:first-child { margin-top: 0; }

.rest-day-card {
  text-align: center;
  padding: 40px 24px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-2);
}

.rest-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-3);
  display: grid;
  place-items: center;
}

.rest-icon svg { width: 28px; height: 28px; }

.rest-day-card p { font-size: 0.95rem; font-weight: 600; color: var(--text); }

.rest-sub {
  font-size: 0.82rem !important;
  font-weight: 500 !important;
  color: var(--text-3) !important;
  margin-top: 6px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn svg { width: 18px; height: 18px; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, #ea580c 100%);
  color: #fff;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:active { transform: scale(0.98); }

.btn-ghost {
  width: 100%;
  background: transparent;
  border: 1px dashed var(--border-strong);
  color: var(--text-2);
  margin-bottom: 16px;
}

.btn-ghost:hover { border-color: var(--accent); color: var(--accent-2); }

.btn-outline {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text-2);
  padding: 9px 14px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-block { width: 100%; }

/* Workout info */
.workout-info-card {
  background: linear-gradient(160deg, var(--surface-2) 0%, var(--surface) 100%);
}

.workout-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.workout-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.workout-meta {
  font-size: 0.8rem;
  color: var(--text-3);
  margin-top: 4px;
}

.progress-ring-wrap {
  flex-shrink: 0;
  position: relative;
  width: 56px;
  height: 56px;
}

.progress-ring-wrap svg { transform: rotate(-90deg); }

.progress-ring-bg {
  fill: none;
  stroke: var(--surface-3);
  stroke-width: 4;
}

.progress-ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s ease;
}

.progress-ring-text {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-2);
}

.reset-workout { margin-top: 4px; }

/* Current exercise */
.current-exercise-card {
  background: linear-gradient(145deg, rgba(249,115,22,0.08) 0%, var(--surface) 60%);
  border-color: rgba(249, 115, 22, 0.2);
}

.current-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-2);
  font-weight: 600;
  margin-bottom: 12px;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulseDot 1.8s ease infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 var(--accent-glow); }
  50% { opacity: 0.7; box-shadow: 0 0 0 6px transparent; }
}

.current-exercise-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.25;
  margin-bottom: 10px;
}

.current-set-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  color: var(--accent-2);
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.current-reps {
  font-size: 0.88rem;
  color: var(--text-2);
}

.current-tip {
  font-size: 0.8rem;
  color: var(--text-3);
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--accent);
  line-height: 1.45;
}

.complete-state {
  text-align: center;
  padding: 8px 0;
}

.complete-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  display: grid;
  place-items: center;
}

.complete-icon svg { width: 24px; height: 24px; }

/* Exercise list */
.exercise-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 8px;
  transition: border-color 0.2s, background 0.2s;
}

.exercise-item.active {
  border-color: rgba(249, 115, 22, 0.35);
  background: var(--surface-2);
}

.exercise-item.completed { opacity: 0.55; }

.exercise-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.exercise-index {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--surface-3);
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-3);
  flex-shrink: 0;
}

.exercise-item.active .exercise-index {
  background: var(--accent-soft);
  color: var(--accent-2);
}

.exercise-item.completed .exercise-index {
  background: var(--green-soft);
  color: var(--green);
}

.exercise-item.completed .exercise-index::after {
  content: '';
}

.exercise-info { flex: 1; min-width: 0; }

.exercise-name {
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.exercise-reps {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 2px;
  font-weight: 500;
}

.exercise-tip {
  font-size: 0.75rem;
  color: var(--text-3);
  margin: -4px 0 12px 40px;
  line-height: 1.4;
}

.sets-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding-left: 40px;
}

.btn-set {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-3);
  color: var(--text-2);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: inherit;
}

.btn-set.done {
  background: var(--green-soft);
  border-color: rgba(74, 222, 128, 0.3);
  color: var(--green);
}

.btn-set.current {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

.set-progress {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-3);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Cardio */
.cardio-card {
  border-color: rgba(96, 165, 250, 0.2);
  background: linear-gradient(145deg, var(--blue-soft) 0%, var(--surface) 50%);
}

.cardio-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.cardio-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--blue);
}

.cardio-title svg { width: 18px; height: 18px; }

.cardio-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-2);
}

.cardio-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.cardio-desc {
  font-size: 0.85rem;
  color: var(--text-2);
}

/* Nutrition */
.macro-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.macro-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.macro-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.macro-icon svg { width: 20px; height: 20px; }

.macro-card.protein .macro-icon { background: var(--rose-soft); color: var(--rose); }
.macro-card.carbs .macro-icon { background: var(--violet-soft); color: var(--violet); }
.macro-card.fat .macro-icon { background: var(--green-soft); color: var(--green); }
.macro-card.calories .macro-icon { background: var(--accent-soft); color: var(--accent-2); }

.macro-info { flex: 1; min-width: 0; }

.macro-name {
  font-size: 0.78rem;
  color: var(--text-3);
  font-weight: 500;
  display: block;
}

.macro-value {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: block;
  margin: 2px 0 8px;
}

.progress-bar {
  height: 5px;
  background: var(--surface-3);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 4px;
}

.progress-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 0.5s ease;
  width: 0%;
}

.macro-card.protein .progress-fill { background: linear-gradient(90deg, var(--rose), #fda4af); }
.macro-card.carbs .progress-fill { background: linear-gradient(90deg, var(--violet), #c4b5fd); }
.macro-card.fat .progress-fill { background: linear-gradient(90deg, var(--green), #86efac); }
.macro-card.calories .progress-fill { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

.macro-card.protein .progress-fill.at-goal { background: linear-gradient(90deg, var(--green), #86efac); }
.macro-card.protein .progress-fill.below-min { background: linear-gradient(90deg, #f87171, var(--rose)); }

.macro-info small {
  font-size: 0.7rem;
  color: var(--text-3);
}

/* Forms */
.form-row { margin-bottom: 0; }

.form-row label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-3);
  margin-bottom: 6px;
  font-weight: 500;
}

.form-row input,
.form-row textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-row input:focus,
.form-row textarea:focus {
  outline: none;
  border-color: rgba(249, 115, 22, 0.5);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-row input::placeholder,
.form-row textarea::placeholder { color: var(--text-3); }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.nutrition-form .form-grid { margin-bottom: 18px; }

/* Measurements */
.measurement-history {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.measurement-entry {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.measurement-date {
  font-size: 0.75rem;
  color: var(--accent-2);
  font-weight: 600;
  margin-bottom: 10px;
  letter-spacing: 0.01em;
}

.measurement-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.measurement-item {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 8px 6px;
  text-align: center;
}

.measurement-item .label {
  font-size: 0.65rem;
  color: var(--text-3);
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.measurement-item .value {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.empty-state {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-3);
  font-size: 0.85rem;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  line-height: 1.6;
}

/* Bottom nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 440px;
  height: calc(var(--nav-h) + var(--safe-b));
  padding: 8px 12px calc(8px + var(--safe-b));
  background: rgba(19, 19, 22, 0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 200;
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 0.68rem;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  transition: color 0.2s;
  font-family: inherit;
  letter-spacing: 0.01em;
}

.nav-btn.active {
  color: var(--accent-2);
}

.nav-icon {
  width: 22px;
  height: 22px;
  transition: transform 0.2s;
}

.nav-btn.active .nav-icon { transform: scale(1.08); }

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 300;
  align-items: flex-end;
  justify-content: center;
}

.modal.open { display: flex; }

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 440px;
  max-height: 88dvh;
  overflow-y: auto;
  padding: 22px 20px 28px;
  animation: slideUp 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}

.modal-close svg { width: 18px; height: 18px; }

.modal .form-row { margin-bottom: 14px; }

.modal-section { margin-bottom: 18px; }

.modal-section-label {
  font-size: 0.78rem;
  color: var(--text-3);
  font-weight: 500;
  margin-bottom: 10px;
}

.template-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.template-card {
  display: flex;
  gap: 8px;
  align-items: stretch;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-2);
  transition: border-color 0.2s;
}

.template-card.selected {
  border-color: var(--day-color, var(--accent));
  box-shadow: inset 3px 0 0 var(--day-color, var(--accent));
}

.template-load {
  flex: 1;
  text-align: left;
  padding: 12px 14px;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}

.template-name {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.template-sub {
  display: block;
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 1px;
}

.template-meta {
  display: block;
  font-size: 0.7rem;
  color: var(--text-3);
  margin-top: 4px;
}

.template-start {
  flex-shrink: 0;
  padding: 0 16px;
  background: var(--accent-soft);
  border: none;
  border-left: 1px solid var(--border);
  color: var(--accent-2);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}

.template-start:active {
  background: rgba(249, 115, 22, 0.22);
}

.modal-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--text-3);
  font-size: 0.75rem;
}

.modal-divider::before,
.modal-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* YouTube */
.exercise-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.exercise-name-row .exercise-name { flex: 1; min-width: 0; }

.current-name-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.current-name-row .current-exercise-name {
  margin-bottom: 0;
  flex: 1;
}

.btn-youtube {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid rgba(255, 0, 0, 0.25);
  background: rgba(255, 0, 0, 0.1);
  color: #ff4444;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  transition: all 0.2s ease;
}

.btn-youtube svg { width: 18px; height: 18px; }

.btn-youtube:hover,
.btn-youtube:active {
  background: rgba(255, 0, 0, 0.18);
  border-color: rgba(255, 0, 0, 0.45);
  transform: scale(1.05);
}

.btn-youtube.lg {
  width: 40px;
  height: 40px;
  border-radius: 11px;
}

.btn-youtube.lg svg { width: 20px; height: 20px; }

/* Video modal */
.video-modal {
  align-items: center;
  padding: 16px;
}

.video-modal.open { display: flex; }

.video-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
}

.video-modal-box {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  animation: fadeUp 0.28s ease;
}

.video-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.video-modal-header h3 {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.video-wrap {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background: #000;
}

.video-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Toast */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-b) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 12px 22px;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 400;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Responsive */
@media (min-width: 441px) {
  body { background: #050506; }
  #app {
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
}

@media (max-width: 360px) {
  .form-grid { grid-template-columns: 1fr; }
  .measurement-grid { grid-template-columns: repeat(2, 1fr); }
}
