/* ============================================
   EXERCISE DETAIL SCREEN
============================================ */
#detail-view { display: none; }

.hub-back-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: #4b3f5c;
  cursor: pointer;
  padding: 4px 8px;
  margin-bottom: 0.6rem;
}
/* the ← back arrows only (other buttons share .hub-back-btn): thickens the arrow a little, whatever the font */
.hub-back-arrow { -webkit-text-stroke: 0.6px currentColor; }
/* "← Back" at the bottom of long screens (shared-js/bottom-back.js) */
.hub-bottom-back {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  margin: 1.2rem 0 0.6rem;
  padding: 4px 8px 4px 0;
}
.hub-bottom-back-arrow {
  font-size: 1.4rem;
  vertical-align: -0.1em;
  -webkit-text-stroke: 0.6px currentColor;
}

/* ---------- Video ---------- */
.hub-video-box {
  background: linear-gradient(135deg, #eee2f2, #f2ede4);
  border-radius: 16px;
  aspect-ratio: 16 / 9;
  height: auto;
  width: 87.5%;
  margin: 0 auto 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a698b8;
  font-size: 0.9rem;
  position: relative;
  overflow: hidden;
  cursor: default;
}
.hub-video-box.has-video {
  cursor: pointer;
}
.hub-video-box iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: inherit;
}
.hub-video-box .play-overlay {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 60px; height: 60px;
  background: rgba(255,255,255,0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #7c5cbf;
  pointer-events: none;
}

/* ---------- Title + target ---------- */
.hub-exercise-title {
  color: #333;
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0;
  max-width: 260px;
  overflow-wrap: break-word;
  line-height: 1.25;
}

.hub-exercise-target {
  color: #8a8073;
  font-size: 0.85rem;
  margin: 0;
}

.hub-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.hub-title-row.multi-line {
  align-items: center;
}

.hub-title-with-audio {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-shrink: 0;
}

.hub-sets-label {
  flex-shrink: 0;
}

.hub-target-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
}

.hub-set-dots {
  display: flex;
  gap: 6px;
}

/* ---------- Reps / weight steppers ---------- */
.hub-stepper-row {
  display: flex;
  align-items: stretch;
  justify-content: center;
  background: #f2ede4;
  border-radius: 14px;
  padding: 6px 0;
  margin-top: 8px;
  margin-bottom: 0.6rem;
}
.hub-stepper-row .hub-stepper {
  flex: 1;
  min-width: 0;
  padding: 0 8px;
}
.hub-stepper-row .hub-stepper + .hub-stepper {
  border-left: 1px solid rgba(63,53,80,0.15);
}

.hub-stepper {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hub-stepper-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #8a8073;
  margin-bottom: 2px;
}
.hub-stepper-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 4px;
}
.hub-stepper-btn {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  border: none;
  background: #ddd2eb;
  color: #4b3f5c;
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  -webkit-appearance: none;
  appearance: none;
}

.hub-stepper-value {
  border: none;
  background: transparent;
  text-align: center;
  font-family: inherit;
  outline: none;
  font-size: 1.3rem;
  font-weight: 700;
  color: #333;
  flex: 1;
  min-width: 0;
  width: 0;
  box-sizing: border-box;
}

/* ---------- Restyle (Sept 2026) ---------- */
.back-row { margin-bottom: 6px; }

.top-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.top-meta-row.no-superset { justify-content: flex-end; }

.hist-link {
  font-size: 0.8rem;
  font-weight: 600;
  color: #7c5cbf;
  text-decoration: underline;
}

.summary-row { margin-top: 2px; }
.summary-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: #8a8073;
}

.label-caps {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #8a8073;
  text-transform: uppercase;
}
.coach-note-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sets-bar {
  margin-top: 8px;
  background: #ddd2eb;
  border-radius: 10px;
  padding: 5px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sets-bar .label-caps {
  font-size: 0.75rem;
}

.coach-note {
  margin-top: 10px;
  background: #ece6f5;
  border-radius: 10px;
  padding: 8px 10px;
}
.coach-note-text {
  white-space: pre-wrap;
  margin: 2px 0 0;
  font-size: .93rem;
  color: #4b3f5c;
  line-height: 1.4;
}

.note-input-wrap { margin-top: 7px; }
.note-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #eee6da;
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 16px; /* 16px stops iPhone Safari from zooming in on tap */
  color: #8a8073;
  background: #fff;
  font-family: inherit;
  resize: none;
  overflow: hidden;
  min-height: 34px;
}

.hub-note-label {
  font-size: 0.75rem;
  color: #8a8073;
  margin: 1rem 0 0.4rem;
}
.hub-note-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #ddd2eb;
  border-radius: 10px;
  padding: 10px;
  font-family: inherit;
  font-size: 16px; /* 16px stops iPhone Safari from zooming in on tap */
  resize: none;
  overflow: hidden;
  min-height: 40px;
}

/* ---------- Full-height "app shell" mode ---------- */
body.detail-mode header.hero { display: none; }
body.hub-logged-in header.hero { display: none; }
/* client hub: footer only on the login screen, never during a workout */
body.client-hub.hub-logged-in > footer { display: none; }
/* stops the page behind the exercise screen from scrolling or bouncing (which drags the screen down) */
html.detail-mode,
body.detail-mode { overflow: hidden; overscroll-behavior: none; }

#detail-view.active {
  position: fixed;
  top: 0;
  top: var(--vv-top, 0px);          /* set by fitDetailToScreen() in client-helpers.js */
  left: 0; right: 0;
  height: 100vh;   /* fallback for old browsers */
  height: 100dvh;  /* visible height, excludes Safari's toolbar */
  height: var(--vv-height, 100dvh); /* measured visible height (fitDetailToScreen) */
  z-index: 500;
  display: flex;
  flex-direction: column;
  max-width: 460px;
  margin: 0 auto;
  background: #faf7f2;
  overflow: hidden;
  touch-action: pan-y;   /* no pinch / double-tap zoom on the exercise screen (iPhone) */
}
.detail-content-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  touch-action: pan-y;   /* scrolls up/down only; repeated because a scroll box resets touch-action */
  padding: 10px 24px 10px;
  box-sizing: border-box;
}
.footer-fixed {
  flex: 0 0 auto;
  border-top: 1px solid #eee6da;
  background: #faf7f2;
  padding: 10px 24px calc(14px + env(safe-area-inset-bottom));
  box-sizing: border-box;
}

/* ---------- Set dots ---------- */
.hub-set-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid #3fae7a;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: background-color 0.2s ease;
}
.hub-set-dot.filled {
  background: #3fae7a;
  border-color: #3fae7a;
}
.hub-set-dot.filled::after {
  content: "";
  width: 6px;
  height: 4px;
  border-left: 1.5px solid #fff;
  border-bottom: 1.5px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}

/* ---------- Skip / Done buttons ---------- */
.hub-action-row {
  display: flex;
  gap: 10px;
}
.hub-skip-btn {
  flex: 1;
  background: #fff;
  border: 1px solid #ddd2eb;
  border-radius: 12px;
  color: #5f5648;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 13px 0;
}
.hub-done-btn {
  flex: 2;
  background: #c6b7e2;
  border: none;
  border-radius: 12px;
  color: #3f3550;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  padding: 13px 0;
  transition: background-color 0.2s ease;
}
.hub-done-btn:hover { background-color: #ddd2eb; }

/* ---------- Audio cue button ---------- */
.audio-cue-btn {
  background: #ddd2eb;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  line-height: 0;
}
.audio-cue-bars {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 22px;
}
.audio-bar {
  width: 4px;
  height: 14px;
  background: #4b3f5c;
  border-radius: 2px;
  display: inline-block;
  animation: audio-bar-bounce 0.9s ease-in-out infinite;
}
.audio-bar:nth-child(2) { height: 22px; animation-delay: 0.15s; }
.audio-bar:nth-child(3) { height: 11px; animation-delay: 0.3s; }

@keyframes audio-bar-bounce {
  0%, 100% { transform: scaleY(0.6); }
  50% { transform: scaleY(1.3); }
}

/* ---------- Rest timer ---------- */
.rest-timer-bar {
  position: relative;
  height: 48px;
  border-radius: 12px;
  background: #eee6da;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.rest-timer-bar-fill {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  width: 0%;
  background: #c6b7e2;
  transition: width 1s linear;
}
.rest-timer-bar-count {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 16px;
  font-size: 1rem;
  font-weight: 700;
  color: #3f3550;
}
.rest-timer-bar-skip {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 16px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #4b3f5c;
  text-decoration: underline;
}

/* ---------- Exercise header: list pill + prev/next bar ---------- */
.top-meta-row.exercise-top-row,
.top-meta-row.exercise-top-row.no-superset {
  justify-content: space-between;
  min-height: 22px;
  margin-bottom: 0;
}
.exercise-list-pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 10px;
  background: #ddd2eb; color: #4b3f5c;
  border: none; border-radius: 20px;
  font-size: 12px; font-weight: 500; cursor: pointer;
}
.exercise-badge-pill {
  display: inline-block; box-sizing: border-box;
  height: 22px; line-height: 20px; padding: 0 10px;
  background: #f7dd43; color: #7a5c00;
  border: 1px solid #ffe98a; border-radius: 20px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
}
.exercise-nav-bar {
  display: grid; grid-template-columns: 1fr auto 1fr;
  height: 40px; margin: 6px 0 10px;
  background: #fff; border: 1px solid #ddd2eb;
  border-radius: 10px; overflow: hidden;
}
.exercise-nav-seg {
  display: flex; align-items: center; gap: 4px;
  min-width: 0; padding: 0 8px;
  background: none; border: none; font: inherit;
  color: #6b4fb3; text-align: left; cursor: pointer;
}
.exercise-nav-seg + .exercise-nav-seg { border-left: 1px solid #ddd2eb; }
.exercise-nav-seg.next { justify-content: flex-end; text-align: right; }
.exercise-nav-seg.count {
  flex-direction: column; justify-content: center;
  gap: 0; padding: 0 12px; color: #4b3f5c; cursor: default;
}
.exercise-nav-seg:disabled { opacity: 0.35; cursor: default; }
.nav-arrow { font-size: 20px; line-height: 1; }
.nav-text { display: flex; flex-direction: column; min-width: 0; }
.nav-label { font-size: 11px; line-height: 13px; color: #6f655a; }
.nav-name {
  font-size: 13px; line-height: 15px; color: #4b3f5c;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.target-row {
  display: flex; justify-content: space-between;
  align-items: baseline; gap: 8px;
}
.target-row .hist-link { white-space: nowrap; flex-shrink: 0; }