@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Space Grotesk', sans-serif;
  --green: #16a34a;
  --green-light: #22c55e;
  --red: #ef4444;
  --bg: #f5f5f5;
  --card-bg: #ffffff;
  --text: #1a1a1a;
  --muted: #737373;
  --muted-light: rgba(115,115,115,0.5);
  --muted-lighter: rgba(115,115,115,0.3);
  --border: #e0e0e0;
  --border-light: #eeeeee;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app-container { max-width: 448px; margin: 0 auto; background: var(--bg); min-height: 100vh; box-shadow: 0 0 40px rgba(0,0,0,0.08); }

/* Header */
.header { position: relative; overflow: hidden; background: #fafafa; padding-bottom: 24px; }
.header-bg { position: absolute; pointer-events: none; user-select: none; right: -18%; top: 14%; width: 136%; height: 160%; }
.header-bg img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: right top; opacity: 0.5; }
.header-bg-overlay { position: absolute; inset: 0; background: linear-gradient(to right, rgba(245,245,245,1) 0%, rgba(245,245,245,1) 15%, rgba(245,245,245,0.85) 40%, rgba(245,245,245,0.4) 65%, rgba(245,245,245,0) 85%); }
.header-workout-bg img { opacity: 0.83; }
.header-workout-overlay { background: linear-gradient(to right, rgba(245,245,245,1) 0%, rgba(245,245,245,1) 8%, rgba(245,245,245,0.8) 28%, rgba(245,245,245,0.3) 50%, rgba(245,245,245,0) 72%); }

.logo { position: relative; width: 100%; display: flex; justify-content: center; padding: 40px 0 16px; }
.logo-text { font-size: 31px; font-weight: 900; font-style: italic; letter-spacing: -0.5px; user-select: none; line-height: 1; }
.logo-green { color: var(--green); }
.logo-dark { color: var(--text); }

.header-content { position: relative; width: 100%; padding: 0 24px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.header-title { font-size: 22px; font-weight: 700; font-family: var(--font-heading); color: var(--text); margin-bottom: 4px; }
.header-subtitle { font-size: 13px; color: var(--muted-light); }

.divider { height: 1px; background-color: #E0E0E0; }

/* Workout badge */
.workout-badge { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; border-radius: 9999px; border: 1px solid #e5e5e5; background: #f9f9f9; margin-bottom: 12px; }
.workout-badge-dot { width: 6px; height: 6px; border-radius: 50%; background: #e53935; }
.workout-badge-text { font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted-light); }
.workout-badge-num { font-size: 12.5px; font-weight: 900; color: rgba(115,115,115,0.9); }

.workout-title { font-size: 32px; font-weight: 900; font-style: italic; line-height: 1.1; letter-spacing: -0.5px; text-transform: uppercase; margin-bottom: 20px; text-align: center; max-width: 70%; }
.workout-title-green { color: var(--green); }
.workout-objective { font-size: 13px; font-weight: 600; color: #555; line-height: 1.6; max-width: 85%; text-align: center; }

.duration-badge { display: inline-flex; align-items: center; gap: 8px; padding: 8px 20px; border-radius: 9999px; border: 1px solid var(--border); background: var(--card-bg); margin: 24px 0; }
.duration-num { font-weight: 900; color: var(--green); font-size: 16px; }
.duration-unit { font-size: 16px; color: var(--text); }

/* Back link */
.back-link { display: block; padding: 16px 24px 0; font-size: 13px; font-weight: 500; color: #444; text-decoration: none; }
.back-link:hover { color: var(--green); }

/* Home workout cards */
.workout-list { padding: 24px 16px 40px; display: flex; flex-direction: column; gap: 12px; }
.workout-card { display: flex; align-items: center; gap: 16px; border-radius: 16px; padding: 16px; background: var(--card-bg); border: 2px solid; text-decoration: none; color: inherit; position: relative; transition: all 0.15s; }
.workout-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.08); }
.workout-card:active { transform: scale(0.99); }
.workout-card-bar { position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 9999px; }
.workout-card-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.workout-card-icon svg { width: 20px; height: 20px; }
.workout-card-info { flex: 1; min-width: 0; }
.workout-card-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.15em; color: var(--muted-light); }
.workout-card-name { font-size: 15px; font-weight: 700; font-family: var(--font-heading); color: var(--text); margin-top: 2px; }
.workout-card-meta { font-size: 11px; color: var(--muted-light); margin-top: 2px; }
.workout-card-duration { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 9999px; border: 1px solid var(--border); background: var(--card-bg); flex-shrink: 0; }
.workout-card-duration svg { width: 12px; height: 12px; color: var(--muted-light); }
.workout-card-duration span { font-size: 12px; font-weight: 700; color: var(--text); }
.workout-card-chevron { width: 16px; height: 16px; color: var(--muted-lighter); flex-shrink: 0; }

/* Stepper */
.stepper { padding: 12px 20px; }
.stepper-track { display: grid; position: relative; }
.stepper-line { position: absolute; height: 2px; background: var(--border); top: 12px; pointer-events: none; }
.stepper-progress { position: absolute; height: 2px; background: var(--green-light); top: 12px; pointer-events: none; }
.stepper-step { display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 1; }
.stepper-circle { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.stepper-done { background: var(--green-light); }
.stepper-done svg { width: 11px; height: 11px; stroke: white; stroke-width: 3; fill: none; }
.stepper-current { background: white; border: 2px solid var(--green); box-shadow: 0 0 0 4px rgba(22,163,74,0.15); }
.stepper-future { background: #f0f0f0; border: 2px solid var(--border); }
.stepper-label { font-size: 9px; font-weight: 500; text-align: center; width: 100%; }
.stepper-label-done { color: var(--green-light); }
.stepper-label-current { color: var(--text); }
.stepper-label-future { color: var(--muted-lighter); }

/* Blocks */
.blocks-container { padding: 16px 16px 24px; }

/* Completed block */
.block-completed { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 8px; border-radius: 16px; background: #f0fdf4; border: 1px solid rgba(187,247,208,0.8); }
.block-completed-check { width: 28px; height: 28px; border-radius: 50%; background: var(--green-light); display: flex; align-items: center; justify-content: center; flex-shrink: 0; box-shadow: 0 2px 4px rgba(34,197,94,0.2); }
.block-completed-check svg { width: 14px; height: 14px; stroke: white; stroke-width: 3; fill: none; }
.block-completed-name { font-size: 14px; font-weight: 600; color: var(--green-light); font-family: var(--font-heading); flex: 1; }
.block-completed-num { font-size: 11px; color: rgba(34,197,94,0.5); font-weight: 500; }

/* Future block */
.block-future { display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin-bottom: 8px; border-radius: 16px; background: var(--card-bg); border: 1px solid var(--border-light); }
.block-future-circle { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border); flex-shrink: 0; }
.block-future-name { font-size: 14px; font-weight: 600; color: var(--muted-lighter); font-family: var(--font-heading); }
.block-future-meta { font-size: 11px; color: rgba(115,115,115,0.3); margin-top: 2px; }
.block-future-num { font-size: 11px; color: rgba(115,115,115,0.25); font-weight: 500; margin-left: auto; }

/* Current block */
.block-current-header { width: 100%; display: flex; align-items: center; gap: 14px; border-radius: 16px; padding: 16px; background: var(--card-bg); border: 2px solid; position: relative; text-align: left; cursor: pointer; transition: all 0.15s; margin-bottom: 12px; }
.block-current-header:active { transform: scale(0.995); }
.block-current-header.open { box-shadow: 0 4px 20px rgba(0,0,0,0.09); }
.block-bar { position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 9999px; }
.block-number { font-size: 24px; font-weight: 900; font-family: var(--font-heading); color: rgba(26,26,26,0.08); line-height: 1; }
.block-icon { width: 36px; height: 36px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.block-icon svg { width: 18px; height: 18px; }
.block-title { font-size: 15px; font-weight: 600; font-family: var(--font-heading); color: var(--text); line-height: 1.2; }
.block-title-meta { font-size: 11px; font-weight: 400; color: var(--muted-light); }
.block-subtitle { font-size: 12px; color: rgba(115,115,115,0.65); margin-top: 2px; }
.block-duration { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 9999px; border: 1px solid var(--border); background: var(--card-bg); flex-shrink: 0; }
.block-duration svg { width: 12px; height: 12px; color: var(--muted-light); }
.block-duration span { font-size: 12px; font-weight: 700; color: var(--text); }

/* Block content */
.block-content { padding: 0 4px; }
.block-rules { margin: 0 8px 16px; border-radius: 12px; padding: 10px 16px; display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: nowrap; }
.block-rule { font-size: 11px; letter-spacing: 0.02em; }
.block-rule-dot { width: 3px; height: 3px; border-radius: 50%; flex-shrink: 0; }

/* Exercise cards area */
.exercise-area { display: flex; flex-direction: column; gap: 24px; align-items: center; margin-bottom: 16px; }
.exercise-wrapper { width: 100%; max-width: 340px; }
.series-indicator { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 12px; }
.series-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.15em; }
.series-dots { display: flex; align-items: center; gap: 8px; }
.series-dot { width: 11px; height: 11px; border-radius: 50%; }

/* Exercise card */
.exercise-card { width: 100%; cursor: pointer; transition: transform 0.2s; position: relative; }
.exercise-card:hover { transform: scale(1.01); }
.exercise-card:active { transform: scale(0.99); }
.exercise-card img { width: 100%; height: auto; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); display: block; }
.exercise-check-badge { position: absolute; top: -12px; right: -12px; z-index: 10; width: 32px; height: 32px; border-radius: 50%; background: var(--green-light); display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(34,197,94,0.3); animation: badge-pop 140ms ease-out both; }
.exercise-check-badge svg { width: 16px; height: 16px; stroke: white; stroke-width: 3; fill: none; }

.card-check-btn { margin-top: 8px; width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--card-bg); font-size: 12px; font-weight: 600; color: var(--muted-light); cursor: pointer; transition: all 0.2s; }
.card-check-btn:hover { border-color: rgba(34,197,94,0.4); color: rgba(34,197,94,0.6); background: rgba(240,253,244,0.5); }
.card-check-btn.checked { background: #f0fdf4; border-color: #bbf7d0; color: var(--green-light); }
.card-check-btn svg { width: 16px; height: 16px; }

/* Series separator */
.series-separator { margin: 0 8px 12px; height: 1px; background: var(--border-light); }

/* Rest timer */
.rest-timer { margin: 12px 8px; border-radius: 16px; border: 1px solid #e8e8e8; background: var(--card-bg); padding: 16px 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.rest-timer-title { font-size: 13px; font-weight: 700; font-family: var(--font-heading); color: var(--text); text-align: center; }
.rest-timer-circle { position: relative; display: flex; align-items: center; justify-content: center; }
.rest-timer-circle svg.ring { transform: rotate(-90deg); }
.rest-timer-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.rest-timer-number { font-size: 44px; font-weight: 900; font-family: var(--font-heading); line-height: 1; }
.rest-timer-unit { font-size: 11px; font-weight: 500; color: var(--muted-lighter); }
.rest-timer-check svg { width: 40px; height: 40px; stroke: var(--green-light); stroke-width: 2.5; fill: none; }
.skip-btn { font-size: 12px; font-weight: 600; color: var(--muted-light); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; background: none; border: none; transition: color 0.2s; }
.skip-btn:hover { color: var(--muted); }

/* Mark complete buttons */
.mark-complete-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px; border-radius: 12px; border: 2px dashed #d4d4d4; background: transparent; font-size: 13px; font-weight: 600; color: var(--muted-light); cursor: pointer; transition: all 0.2s; margin: 24px 8px 12px; }
.mark-complete-btn:hover { border-color: rgba(34,197,94,0.4); color: rgba(34,197,94,0.6); background: rgba(240,253,244,0.5); }
.mark-complete-btn svg { width: 16px; height: 16px; }
.block-completed-banner { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px; border-radius: 12px; background: #f0fdf4; border: 1px solid #bbf7d0; margin: 24px 8px 12px; }
.block-completed-banner svg { width: 16px; height: 16px; stroke: var(--green-light); stroke-width: 2.5; fill: none; }
.block-completed-banner span { font-size: 13px; font-weight: 700; color: var(--green-light); }

/* Mark series complete */
.mark-series-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px; border-radius: 12px; border: 2px dashed #d4d4d4; background: transparent; font-size: 13px; font-weight: 600; color: var(--muted-light); cursor: pointer; transition: all 0.2s; }
.mark-series-btn:hover { border-color: rgba(34,197,94,0.4); color: rgba(34,197,94,0.6); background: rgba(240,253,244,0.5); }
.mark-series-btn svg { width: 16px; height: 16px; }

/* Footer */
.app-footer { padding: 0 24px 40px; text-align: center; }
.footer-divider { height: 1px; background: #e8e8e8; margin-bottom: 32px; }
.footer-quote { display: inline-block; border-radius: 16px; background: var(--bg); border: 1px solid #e8e8e8; padding: 10px 17px; }
.footer-quote p { font-size: 12px; font-style: italic; color: #333; line-height: 1.6; }
.footer-quote .red { color: #e53935; }
.save-btn { width: 100%; border-radius: 16px; padding: 16px; font-size: 15px; font-weight: 700; letter-spacing: 0.02em; border: none; cursor: pointer; margin-top: 24px; transition: all 0.3s; }
.save-btn.disabled { background: #d4d4d4; color: #a3a3a3; cursor: not-allowed; }
.save-btn.active { background: var(--green-light); color: white; box-shadow: 0 8px 24px rgba(34,197,94,0.2); }
.save-btn.active:hover { background: var(--green); }
.save-btn.active:active { transform: scale(0.98); }
.saved-banner { width: 100%; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 16px; padding: 16px; text-align: center; margin-top: 24px; }
.saved-banner span { font-size: 15px; font-weight: 700; color: var(--green-light); }
.copyright { font-size: 10px; color: var(--muted-lighter); margin-top: 24px; letter-spacing: 0.04em; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(26,26,26,0.7); backdrop-filter: blur(4px); }
.modal-content { position: relative; width: 92%; max-width: 384px; background: #f8f8f8; border-radius: 24px; overflow: hidden; box-shadow: 0 25px 50px rgba(0,0,0,0.25); z-index: 10; }
.modal-close { position: absolute; top: 12px; right: 12px; z-index: 20; width: 32px; height: 32px; border-radius: 50%; background: rgba(0,0,0,0.06); display: flex; align-items: center; justify-content: center; border: none; cursor: pointer; transition: background 0.2s; }
.modal-close:hover { background: rgba(0,0,0,0.1); }
.modal-close svg { width: 16px; height: 16px; color: #444; }
.modal-header { padding: 20px 20px 16px; display: flex; align-items: center; gap: 12px; }
.modal-id { width: 32px; height: 32px; border-radius: 50%; background: #e8e8e8; border: 1px solid #d8d8d8; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 11px; font-weight: 700; color: #666; }
.modal-name { font-size: 17px; font-weight: 700; font-family: var(--font-heading); color: var(--text); }
.modal-divider { height: 1px; background: #e4e4e4; margin: 0 20px; }
.modal-body { padding: 20px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.modal-video-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 16px; border-radius: 16px; background: var(--green); color: white; font-size: 15px; font-weight: 700; text-decoration: none; box-shadow: 0 8px 24px rgba(22,163,74,0.2); transition: all 0.2s; }
.modal-video-btn:hover { background: #15803d; }
.modal-video-btn:active { transform: scale(0.98); }
.modal-video-btn svg { width: 20px; height: 20px; }
.modal-no-video { padding: 16px; color: #666; font-size: 13px; }

/* Hidden */
.hidden { display: none !important; }

/* Animations */
@keyframes badge-pop {
  0% { transform: scale(0); }
  80% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* SVG icons inline */
.icon-check { display: inline-block; }
.icon-square { display: inline-block; }
