From f13310da7850afad11df68652a712ca5707c9b59 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Thu, 30 Apr 2026 16:02:57 +0000
Subject: [PATCH 1/2] =?UTF-8?q?feat:=20add=20TiltFix=20=E2=80=94=20anterio?=
=?UTF-8?q?r=20pelvic=20tilt=20PWA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Full progressive web app with:
- 11-exercise daily routine (5 stretches + 6 strengthening)
- Interactive timer with play/pause/reset for timed exercises
- Set tracking with visual dot indicators
- Day streak + weekly calendar on Progress tab
- Exercise library with expandable cards and step-by-step instructions
- Offline support via service worker (cache-first)
- Installable PWA (manifest + beforeinstallprompt banner)
- Minimalist sage-green design system with safe-area support
Agent-Logs-Url: https://github.com/RehmTheGreat/RehmTheGreat.github.io/sessions/5c7f8e4d-7312-4561-b38c-593ef005a978
Co-authored-by: RehmTheGreat <191198362+RehmTheGreat@users.noreply.github.com>
---
app.js | 929 ++++++++++++++++++++++++++++++++++++++++
icons/icon-maskable.svg | 17 +
icons/icon.svg | 18 +
index.html | 116 +++++
manifest.json | 24 ++
style.css | 875 +++++++++++++++++++++++++++++++++++++
sw.js | 45 ++
7 files changed, 2024 insertions(+)
create mode 100644 app.js
create mode 100644 icons/icon-maskable.svg
create mode 100644 icons/icon.svg
create mode 100644 index.html
create mode 100644 manifest.json
create mode 100644 style.css
create mode 100644 sw.js
diff --git a/app.js b/app.js
new file mode 100644
index 0000000..fec56f6
--- /dev/null
+++ b/app.js
@@ -0,0 +1,929 @@
+/* ── Data ────────────────────────────────────────────────── */
+const EXERCISES = [
+ // STRETCHES — release tight muscles
+ {
+ id: 'cat-cow',
+ name: 'Cat-Cow Stretch',
+ category: 'stretch',
+ emoji: '🐱',
+ muscle: 'Spine & Lower Back',
+ sets: 3,
+ reps: 10,
+ duration: null,
+ sides: false,
+ steps: [
+ 'Start on all fours with wrists under shoulders and knees under hips.',
+ 'Inhale — drop your belly toward the floor, lift your head and tailbone (cow).',
+ 'Exhale — round your spine toward the ceiling, tuck chin and pelvis (cat).',
+ 'Flow slowly and deliberately, matching breath to movement.'
+ ],
+ tip: 'Focus on tilting the pelvis posteriorly in the cat phase — that is exactly the movement that corrects APT.'
+ },
+ {
+ id: 'childs-pose',
+ name: "Child's Pose",
+ category: 'stretch',
+ emoji: '🧘',
+ muscle: 'Lower Back & Glutes',
+ sets: 3,
+ reps: null,
+ duration: 60,
+ sides: false,
+ steps: [
+ 'Kneel and sit back onto your heels, then fold forward and extend your arms overhead.',
+ 'Let your forehead rest on the floor and relax your entire back.',
+ 'Breathe deeply, allowing your lower back to lengthen on each exhale.',
+ 'Hold for the full duration without moving.'
+ ],
+ tip: 'Walk your hands further forward to feel a deeper stretch in the lumbar spine.'
+ },
+ {
+ id: 'hip-flexor-stretch',
+ name: 'Kneeling Hip Flexor Stretch',
+ category: 'stretch',
+ emoji: '🦵',
+ muscle: 'Hip Flexors (Psoas)',
+ sets: 3,
+ reps: null,
+ duration: 45,
+ sides: true,
+ steps: [
+ 'Kneel on one knee with the other foot forward at 90°.',
+ 'Tuck your pelvis slightly (posterior tilt) — this intensifies the stretch.',
+ 'Shift your hips gently forward until you feel a pull in the front of the kneeling hip.',
+ 'Keep your torso upright and core gently braced. Hold, then switch sides.'
+ ],
+ tip: 'The posterior pelvic tilt (PPT) during this stretch is critical. Without it, you compensate with the lower back and miss the psoas entirely.'
+ },
+ {
+ id: 'quad-stretch',
+ name: 'Standing Quad Stretch',
+ category: 'stretch',
+ emoji: '🏃',
+ muscle: 'Quadriceps & Rectus Femoris',
+ sets: 3,
+ reps: null,
+ duration: 30,
+ sides: true,
+ steps: [
+ 'Stand on one leg and bring the opposite heel toward your glute.',
+ 'Hold your ankle (not your toes) and keep knees together.',
+ 'Tuck your pelvis (posterior tilt) to deepen the rectus femoris stretch.',
+ 'Hold steady and switch sides.'
+ ],
+ tip: 'The rectus femoris crosses both the hip and knee. The PPT cue unlocks its upper portion, which standard quad stretches miss.'
+ },
+ {
+ id: 'pigeon-pose',
+ name: 'Pigeon Pose',
+ category: 'stretch',
+ emoji: '🕊️',
+ muscle: 'Hip Flexors & Piriformis',
+ sets: 2,
+ reps: null,
+ duration: 60,
+ sides: true,
+ steps: [
+ 'From all fours, bring one knee forward and place it behind the same-side wrist.',
+ 'Extend the opposite leg straight behind you with the top of the foot on the floor.',
+ 'Square your hips toward the floor as much as possible.',
+ 'Fold forward over the front leg, resting on forearms or a block. Hold, then switch.'
+ ],
+ tip: 'If your hip does not reach the floor, place a folded blanket under it to keep the pelvis level.'
+ },
+
+ // STRENGTHENING — activate weak muscles
+ {
+ id: 'ppt',
+ name: 'Posterior Pelvic Tilt',
+ category: 'strengthen',
+ emoji: '🎯',
+ muscle: 'Lower Abs & Glutes',
+ sets: 3,
+ reps: 15,
+ duration: null,
+ sides: false,
+ steps: [
+ 'Lie on your back with knees bent and feet flat on the floor.',
+ 'Flatten your lower back against the floor by contracting your lower abs and glutes simultaneously.',
+ 'Hold the tilt for 3 seconds, feeling your spine press into the ground.',
+ 'Release slowly and repeat — this is the exact correction movement for APT.'
+ ],
+ tip: 'Think of your pelvis as a bowl of water: APT spills it forward. PPT levels the bowl. Practice this movement awareness in sitting and standing throughout your day.'
+ },
+ {
+ id: 'glute-bridge',
+ name: 'Glute Bridge',
+ category: 'strengthen',
+ emoji: '🌉',
+ muscle: 'Glutes & Hamstrings',
+ sets: 3,
+ reps: 15,
+ duration: null,
+ sides: false,
+ steps: [
+ 'Lie on your back with knees bent, feet hip-width apart.',
+ 'Drive through your heels and squeeze your glutes to lift your hips.',
+ 'At the top, tuck your pelvis slightly to fully activate the glutes — do NOT arch your lower back.',
+ 'Lower slowly over 3 seconds and repeat.'
+ ],
+ tip: 'Squeeze the glutes hard at the top of each rep. Weak glutes are one of the primary drivers of APT.'
+ },
+ {
+ id: 'dead-bug',
+ name: 'Dead Bug',
+ category: 'strengthen',
+ emoji: '🐛',
+ muscle: 'Deep Core (TVA)',
+ sets: 3,
+ reps: 10,
+ duration: null,
+ sides: true,
+ steps: [
+ 'Lie on your back with arms pointing toward the ceiling and knees at 90° above hips.',
+ 'Press your lower back firmly into the floor (PPT) and hold it there throughout.',
+ 'Slowly lower your right arm and left leg toward the floor, breathing out.',
+ 'Return and alternate sides — if your back lifts off the floor, reduce range.'
+ ],
+ tip: 'Speed is the enemy here. Slow, controlled reps with the lower back glued to the floor are the goal.'
+ },
+ {
+ id: 'plank',
+ name: 'Forearm Plank',
+ category: 'strengthen',
+ emoji: '⚡',
+ muscle: 'Core & Glutes',
+ sets: 3,
+ reps: null,
+ duration: 30,
+ sides: false,
+ steps: [
+ 'Place forearms on the floor with elbows under shoulders, hands forward.',
+ 'Rise onto your toes, keeping the body in a straight line from head to heels.',
+ 'Actively tuck your pelvis (posterior tilt) and squeeze your glutes — do not let your hips sag or pike.',
+ 'Breathe steadily and hold for the full duration.'
+ ],
+ tip: 'Imagine pulling your elbows toward your feet without them moving — this activates your deep core far more than just holding position.'
+ },
+ {
+ id: 'reverse-crunch',
+ name: 'Reverse Crunch',
+ category: 'strengthen',
+ emoji: '🔄',
+ muscle: 'Lower Abs',
+ sets: 3,
+ reps: 15,
+ duration: null,
+ sides: false,
+ steps: [
+ 'Lie on your back with legs raised and knees at 90°, hands flat beside you.',
+ 'Use your lower abs to curl your hips off the floor, bringing knees toward your chest.',
+ 'At the top your hips and lower back should briefly peel off the floor.',
+ 'Lower slowly and controlled — do not let momentum take over.'
+ ],
+ tip: 'The lower abs are the key antagonist to the hip flexors in APT. Strengthening them directly counteracts the anterior pull.'
+ },
+ {
+ id: 'bird-dog',
+ name: 'Bird Dog',
+ category: 'strengthen',
+ emoji: '🐦',
+ muscle: 'Glutes & Core Stability',
+ sets: 3,
+ reps: 10,
+ duration: null,
+ sides: true,
+ steps: [
+ 'Start on all fours with a neutral spine (not arched or rounded).',
+ 'Extend your right arm and left leg simultaneously until they are parallel to the floor.',
+ 'Hold for 2 seconds, return, then switch to left arm and right leg.',
+ 'Keep your hips level — do not rotate or shift weight.'
+ ],
+ tip: 'If your lower back arches when you extend the leg, reduce range until strength improves.'
+ }
+];
+
+// Ordered daily routine (exercise IDs)
+const ROUTINE_ORDER = [
+ 'cat-cow',
+ 'childs-pose',
+ 'hip-flexor-stretch',
+ 'quad-stretch',
+ 'pigeon-pose',
+ 'ppt',
+ 'glute-bridge',
+ 'dead-bug',
+ 'plank',
+ 'reverse-crunch',
+ 'bird-dog'
+];
+
+const TIPS = [
+ 'When sitting, place a small lumbar pillow behind your lower back and consciously level your pelvis.',
+ 'Set an hourly reminder to check your posture — APT is mostly a habit of inattention.',
+ 'Avoid extended sitting. Stand and walk for at least 5 minutes every hour.',
+ 'When standing in line, gently activate your glutes. This alone resets pelvic alignment.',
+ 'Sleeping on your back with a pillow under your knees removes strain from your hip flexors overnight.',
+ 'Avoid excessive lower-back arching during gym exercises like squats and deadlifts.',
+ 'Building the habit of a daily routine is more valuable than any single perfect session.',
+ 'Consistency over 8–12 weeks produces lasting structural change. Do not rush the process.'
+];
+
+/* ── State & Storage ─────────────────────────────────────── */
+function loadState() {
+ try {
+ return JSON.parse(localStorage.getItem('tiltfix-state') || '{}');
+ } catch (_) {
+ return {};
+ }
+}
+
+function saveState(state) {
+ localStorage.setItem('tiltfix-state', JSON.stringify(state));
+}
+
+function todayKey() {
+ return new Date().toISOString().slice(0, 10);
+}
+
+/* ── Timer ───────────────────────────────────────────────── */
+let timerInterval = null;
+let timerSeconds = 0;
+let timerRunning = false;
+let currentExerciseId = null;
+let currentSet = 0;
+let completedSets = 0;
+
+function clearTimer() {
+ if (timerInterval !== null) {
+ clearInterval(timerInterval);
+ timerInterval = null;
+ }
+ timerRunning = false;
+}
+
+/* ── Navigation ──────────────────────────────────────────── */
+let currentView = 'home';
+
+function navigate(view) {
+ if (view === currentView) return;
+ clearTimer();
+ currentView = view;
+ document.querySelectorAll('.view').forEach((el) => el.classList.remove('active'));
+ document.querySelectorAll('.nav-item').forEach((el) => el.classList.remove('active'));
+
+ const viewEl = document.getElementById('view-' + view);
+ if (viewEl) viewEl.classList.add('active');
+ const navEl = document.querySelector('[data-view="' + view + '"]');
+ if (navEl) navEl.classList.add('active');
+
+ document.getElementById('app').scrollTop = 0;
+
+ renderView(view);
+}
+
+function renderView(view) {
+ if (view === 'home') renderHome();
+ if (view === 'exercises') renderExercises();
+ if (view === 'routine') renderRoutine();
+ if (view === 'progress') renderProgress();
+}
+
+/* ── HOME ─────────────────────────────────────────────────── */
+function renderHome() {
+ const state = loadState();
+ const today = todayKey();
+ const completedToday = state.completedToday || {};
+ const doneCount = Object.keys(completedToday[today] || {}).length;
+ const total = ROUTINE_ORDER.length;
+ const pct = Math.round((doneCount / total) * 100);
+
+ // Streak
+ const streak = calcStreak(state);
+
+ // Tip of the day (cycle by day-of-year)
+ const dayOfYear = Math.floor((Date.now() - new Date(new Date().getFullYear(), 0, 0)) / 86400000);
+ const tip = TIPS[dayOfYear % TIPS.length];
+
+ // Greeting
+ const hour = new Date().getHours();
+ const greeting = hour < 12 ? 'Good morning' : hour < 18 ? 'Good afternoon' : 'Good evening';
+
+ const circumference = 2 * Math.PI * 30;
+ const offset = circumference - (pct / 100) * circumference;
+
+ document.getElementById('home-content').innerHTML = `
+
+
${greeting} 👋
+
Fix Your Anterior Pelvic Tilt
+
+
+
+
+
+ ${pct}%
+ DONE
+
+
+
+
${doneCount} / ${total}
+
exercises done
+
Today's routine
+
+
+
+
+
+
+
+
Your streak
+
+
🔥
+
+
${streak} day${streak !== 1 ? 's' : ''}
+
Current streak
+
${streak === 0 ? 'Complete today\'s routine to start your streak!' : 'Keep it up — consistency is everything.'}
+
+
+
+
+
+
Daily tip
+
+
💡
+
+
Posture Tip
+
${tip}
+
+
+
+
+
+
What is Anterior Pelvic Tilt?
+
+
The Postural Imbalance
+
Anterior pelvic tilt (APT) is a postural dysfunction where the front of the pelvis drops and the back rises, creating an exaggerated lower-back arch. It is caused by a muscle imbalance between tight and weak groups.