/* =========================================================
   운동 화면
   순서: 진행 막대 → 자세 그림 → 설명 → 타이머 → (고정) 이전/시작/다음
   ========================================================= */

.progress-count {
  flex-shrink: 0;
  margin-top: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--leaf-soft);
  color: var(--leaf-ink);
  font-size: 0.9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  margin-bottom: 20px;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--leaf);
  transition: width 0.4s var(--ease);
}

.exercise {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---------- 자세 그림 ---------- */
.exercise-figure {
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 32vh;           /* 작은 폰에서 타이머가 화면 밖으로 밀리지 않게 */
  border-radius: var(--radius-lg);
  background: #FFFFFF;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.exercise-image {
  width: 92%;
  height: 92%;
  object-fit: contain;
  transition: opacity 0.2s;
}

/* 다크 모드에서 흰 그림 칸이 눈부시지 않게 */
:root[data-theme="dark"] .exercise-figure {
  border-color: transparent;
  filter: brightness(0.9);
}

.exercise-image.fade-out {
  opacity: 0;
}

.exercise-image.fade-in {
  opacity: 1;
}

.image-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--line);
  cursor: pointer;
  transition: width 0.2s, background-color 0.2s;
}

.dot.active {
  width: 22px;
  background: var(--leaf);
}

/* ---------- 설명 ---------- */
.exercise-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 2px;
}

.exercise-title {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.exercise-description {
  font-size: 1.02rem;
  line-height: 1.7;
  color: var(--ink);
}

.exercise-recommend {
  align-self: flex-start;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--leaf-soft);
  color: var(--leaf-ink);
  font-size: 0.88rem;
  font-weight: 600;
}

.exercise-recommend[hidden] {
  display: none;
}

.exercise-safety-note {
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---------- 타이머 ---------- */
.timer-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line);
}

.timer-left-col {
  display: flex;
  align-items: center;
  gap: 18px;
}

.timer-circle-wrapper {
  position: relative;
  width: 96px;
  height: 96px;
  flex-shrink: 0;
}

.timer-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-track {
  fill: none;
  stroke: var(--surface-2);
  stroke-width: 9;
}

.timer-bar {
  fill: none;
  stroke: var(--leaf);
  stroke-width: 9;
  stroke-linecap: round;
  stroke-dasharray: 283;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.3s linear, stroke 0.2s;
}

.timer-text-container {
  position: absolute;
  inset: 0;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  align-items: baseline;
  justify-content: center;
}

.timer-countdown {
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.timer-unit {
  margin-left: 2px;
  font-size: 0.9rem;
  color: var(--muted);
}

.rep-label {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
}

/* 준비 중: 햇살 노랑으로 운동 중과 구분 */
.timer-section.is-prep {
  background: var(--sun-soft);
  border-color: transparent;
}

.timer-section.is-prep .timer-bar {
  stroke: var(--sun);
}

.timer-section.is-prep .timer-track {
  stroke: rgba(239, 162, 58, 0.18);
}

.timer-section.is-prep .rep-label,
.timer-section.is-prep .timer-countdown {
  color: var(--sun-ink);
}

/* 반복·시간 선택 */
.preset-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.preset-label {
  flex-shrink: 0;
  width: 2.4em;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
}

.rep-presets,
.timer-presets {
  flex: 1;
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.rep-btn,
.preset-btn {
  flex: 1;
  min-height: 40px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s;
}

.rep-btn:hover,
.preset-btn:hover {
  color: var(--ink);
}

.rep-btn.active,
.preset-btn.active {
  background: var(--surface);
  color: var(--leaf-ink);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(16, 24, 20, 0.12);
}

.exercise-extra {
  display: flex;
  justify-content: center;
  gap: 8px;
}

/* ---------- 하단 고정 조작 버튼 ---------- */
.app-controls {
  position: sticky;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  z-index: 900;
  margin: 12px calc(var(--page-pad) * -1) 0;
  padding: 12px var(--page-pad);
  background: var(--bg);
  border-top: 1px solid var(--line);
}

.controls-wrapper {
  display: flex;
  gap: 10px;
}

.controls-wrapper .secondary-btn {
  flex: 1;
  padding: 0 10px;
}

.controls-wrapper .primary-btn {
  flex: 1.6;
  font-size: 1.08rem;
}

/* ---------- 완료 화면 ---------- */
.complete-content {
  text-align: center;
  padding-top: 32px;
}

.complete-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--leaf);
  display: flex;
  align-items: center;
  justify-content: center;
}

.complete-icon svg {
  width: 34px;
  height: 34px;
  fill: var(--on-leaf);
}

.complete-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.complete-sub {
  margin-top: 4px;
  color: var(--muted);
}

.complete-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 22px 0;
}

.complete-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 4px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.complete-stat-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--leaf-ink);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.complete-stat-label {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}

.complete-actions {
  display: flex;
  gap: 10px;
}

.complete-actions .secondary-btn {
  flex: 1;
}

.complete-actions .primary-btn {
  flex: 2;
}
