-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
688 lines (628 loc) · 34.6 KB
/
index.html
File metadata and controls
688 lines (628 loc) · 34.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
<!--
MIT License
Copyright (c) 2025 Alwin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
<meta name="theme-color" content="#FF6B9D" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="#FF6B9D" />
<!-- Primary SEO Meta Tags -->
<meta name="description" content="ROS Cycle: Free, private menstrual cycle tracker. Track your period, predict fertility windows, and monitor cycle health. No data storage, student-friendly period tracker app." />
<meta name="keywords" content="period tracker, menstrual cycle tracker, cycle tracker, period calendar, fertility tracker, ovulation tracker, menstrual cycle app, period app, cycle prediction, fertility window, period prediction, women's health tracker, free period tracker, private period tracker" />
<meta name="author" content="Alwin" />
<meta name="robots" content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1" />
<meta name="language" content="English" />
<meta name="revisit-after" content="7 days" />
<!-- Open Graph Tags (for social sharing & SEO) -->
<meta property="og:type" content="website" />
<meta property="og:title" content="ROS Cycle - Free Menstrual Cycle & Period Tracker" />
<meta property="og:description" content="Track your period, predict fertility windows, and monitor your menstrual cycle health. Private, secure, and student-friendly period tracker." />
<meta property="og:url" content="https://alwin-m.github.io/ROS-Cycle-Project/" />
<meta property="og:site_name" content="ROS Cycle" />
<!-- Twitter Card Tags -->
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="ROS Cycle - Free Menstrual Cycle & Period Tracker" />
<meta name="twitter:description" content="Track your period, predict fertility windows, and monitor your menstrual cycle health. Private, secure, and student-friendly period tracker." />
<!-- Canonical URL -->
<link rel="canonical" href="https://alwin-m.github.io/ROS-Cycle-Project/" />
<!-- Additional SEO-friendly Tags -->
<meta name="color-scheme" content="light dark" />
<link rel="manifest" href="./manifest.json" />
<link rel="apple-touch-icon" href="./icon-192.png" />
<link rel="icon" type="image/png" href="alwin.png" />
<link rel="preload" href="https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;600;700&display=swap" as="style" />
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;600;700&display=swap" rel="stylesheet" async />
<!-- SEO-Optimized Title -->
<title>ROS Cycle - Free Period Tracker & Menstrual Cycle Calendar | Track Your Cycle</title>
<style>
:root{
--bg1:#FFF0F5;--bg2:#F0FFF0;--pink:#FF6B9D;--soft:#FFB6C1;--mint:#98D8C8;
--purple:#D8BFD8;--deep-purple:#BA55D3;--text:#3b3b3b;--muted:#8A8A8A;--card:#ffffff;
--shadow:0 6px 24px rgba(0,0,0,0.08);--bg-dark:#2b2b2b;--card-dark:#3c3c3c;--text-dark:#f0f0f0;--muted-dark:#b0b0b0;
}
[data-theme="dark"]{--bg1:#2b2b2b;--bg2:#3c3c3c;--card:#3c3c3c;--text:#f0f0f0;--muted:#b0b0b0;}
*{box-sizing:border-box;}html,body{height:100%;}
body{font-family:'Nunito',system-ui,-apple-system,Segoe UI,Roboto;margin:0;display:flex;align-items:center;justify-content:center;
background:linear-gradient(135deg,var(--bg1),var(--bg2));color:var(--text);padding:20px;overscroll-behavior:none;}
.app{width:100%;max-width:760px;background:var(--card);border-radius:18px;box-shadow:var(--shadow);padding:20px;}
header{display:flex;align-items:center;gap:16px;}
.logo{font-size:28px;font-weight:800;background:linear-gradient(45deg,var(--pink),var(--soft));-webkit-background-clip:text;color:transparent;}
.lead{color:var(--muted);font-weight:300;}
.step-indicator{margin:10px 0;font-size:13px;color:var(--muted);text-align:center;}
main{margin-top:14px;}
.step{display:none;opacity:0;transform:translateY(12px);transition:all .28s ease;}
.step.active{display:block;opacity:1;transform:translateY(0);}
.card{background:var(--card);border-radius:12px;padding:18px;box-shadow:0 4px 18px rgba(0,0,0,0.04);}
.field{margin-bottom:12px;text-align:left;}
label{display:block;font-weight:600;margin-bottom:6px;}
input[type="text"],input[type="date"],input[type="number"]{width:100%;padding:12px 14px;border-radius:10px;border:1.5px solid #f2dce4;
background:var(--card);outline:none;color:var(--text);font-size:16px;-webkit-appearance:none;}
input:focus{box-shadow:0 6px 20px rgba(255,107,157,0.12);border-color:var(--pink);}
.controls{display:flex;gap:10px;justify-content:flex-end;margin-top:10px;}
button{cursor:pointer;border:0;padding:10px 16px;border-radius:12px;font-weight:700;font-size:16px;touch-action:manipulation;}
.btn-primary{background:linear-gradient(45deg,var(--pink),var(--soft));color:white;}
.btn-ghost{background:transparent;color:var(--text);}
.month-nav{display:flex;align-items:center;justify-content:space-between;margin:18px 0;}
.month-title{font-weight:800;font-size:18px;}
.grid{display:grid;grid-template-columns:repeat(7,1fr);gap:8px;}
.weekday-label{text-align:center;font-size:12px;font-weight:600;color:var(--muted);padding:8px 0;}
.cell{background:var(--card);border-radius:10px;padding:10px;min-height:56px;display:flex;align-items:flex-start;justify-content:center;
flex-direction:column;border:1px solid #f4f4f4;position:relative;touch-action:manipulation;}
.cell.other{background:#fafafa;color:#bbb;}
.daynum{font-weight:700;}
.badge{position:absolute;right:8px;top:8px;font-size:11px;padding:4px 6px;border-radius:8px;}
.period{background:linear-gradient(45deg,var(--pink),#ff9bbf);color:#fff;}
.fertile{background:linear-gradient(45deg,var(--mint),#dff6ee);color:var(--text);}
.high-desire{background:linear-gradient(45deg,var(--purple),var(--deep-purple));color:#fff;}
.legend{display:flex;gap:12px;flex-wrap:wrap;margin-top:10px;align-items:center;}
.legend .box{width:14px;height:14px;border-radius:4px;}
.tooltip{position:absolute;bottom:100%;left:50%;transform:translateX(-50%);background:var(--card);border-radius:10px;
padding:8px 10px;box-shadow:0 6px 20px rgba(0,0,0,0.12);white-space:nowrap;font-size:13px;color:var(--text);display:none;z-index:10;}
.cell:hover .tooltip,.cell:focus-within .tooltip{display:block;}
@media (max-width:768px){.tooltip{bottom:auto;top:100%;white-space:normal;max-width:90vw;}.grid{gap:6px;}.cell{min-height:64px;}}
.modal{position:fixed;left:0;top:0;width:100%;height:100%;background:rgba(0,0,0,0.45);display:flex;justify-content:center;
align-items:center;z-index:60;display:none;}
.modal.active{display:flex;}
.modal .box{background:var(--card);padding:18px;border-radius:12px;max-width:480px;box-shadow:0 10px 40px rgba(0,0,0,0.18);width:90%;}
footer{margin-top:16px;font-size:13px;color:var(--muted);display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:10px;}
.theme-toggle{font-size:12px;cursor:pointer;color:var(--pink);}
.checkbox-field{display:flex;align-items:center;gap:8px;margin-bottom:8px;}
.checkbox-field input[type="checkbox"]{width:18px;height:18px;accent-color:var(--pink);}
a.github-link,a.portfolio-link{color:var(--pink);text-decoration:none;font-weight:600;}
a.github-link:hover,a.portfolio-link:hover{text-decoration:underline;}
/* New: Confidence info icon */
.info-icon {
display: inline-block;
width: 16px;
height: 16px;
line-height: 16px;
text-align: center;
font-size: 11px;
font-weight: bold;
background: var(--soft);
color: white;
border-radius: 50%;
margin-left: 6px;
cursor: pointer;
user-select: none;
transition: all 0.2s;
}
.info-icon:hover,
.info-icon:focus {
background: var(--pink);
transform: scale(1.15);
box-shadow: 0 0 0 3px rgba(255,107,157,0.2);
}
.confidence-text {
display: flex;
align-items: center;
gap: 4px;
}
</style>
<!-- JSON-LD Schema Markup for Search Engines -->
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "SoftwareApplication",
"name": "ROS Cycle",
"alternateName": "ROS Cycle - Period Tracker & Menstrual Cycle Calendar",
"description": "ROS Cycle is a free, private menstrual cycle tracker that helps you track your period, predict fertility windows, and monitor your cycle health. No data storage, student-friendly, and completely secure.",
"url": "https://alwin-m.github.io/ROS-Cycle-Project/",
"applicationCategory": "HealthApplication",
"offers": {
"@type": "Offer",
"price": "0",
"priceCurrency": "USD"
},
"operatingSystem": "Web",
"screenshot": "https://alwin-m.github.io/ROS-Cycle-Project/icon-192.png",
"author": {
"@type": "Person",
"name": "Alwin",
"url": "https://alwin-m.github.io/Portfolio/"
},
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "4.8",
"ratingCount": "100"
},
"keywords": "period tracker, menstrual cycle tracker, cycle tracker, fertility tracker, ovulation tracker, period predictor, cycle calendar, women's health, period app, free period tracker",
"inLanguage": "en-US",
"license": "MIT License",
"isAccessibleForFree": true,
"accessibilityFeature": ["DarkMode", "PrivacyPreserving"],
"genre": "HealthApplication"
}
</script>
<!-- JSON-LD FAQ Schema for Featured Snippets -->
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [
{
"@type": "Question",
"name": "What is a period tracker?",
"acceptedAnswer": {
"@type": "Answer",
"text": "A period tracker is an app or tool that helps you monitor your menstrual cycle, track period dates, predict fertility windows, and manage your reproductive health."
}
},
{
"@type": "Question",
"name": "How does a menstrual cycle tracker work?",
"acceptedAnswer": {
"@type": "Answer",
"text": "ROS Cycle uses the standard rhythm method to track your cycle. You enter your last period date and cycle length, and it predicts future periods, fertile windows, and ovulation dates."
}
},
{
"@type": "Question",
"name": "What is a fertility window?",
"acceptedAnswer": {
"@type": "Answer",
"text": "The fertility window is the period during your menstrual cycle when you're most likely to get pregnant, typically around ovulation which occurs about 14 days before your next period."
}
},
{
"@type": "Question",
"name": "Is ROS Cycle period tracker free?",
"acceptedAnswer": {
"@type": "Answer",
"text": "Yes, ROS Cycle is completely free to use. There are no fees, subscriptions, or hidden costs. Your data is stored locally on your device only."
}
},
{
"@type": "Question",
"name": "Is my period tracking data private?",
"acceptedAnswer": {
"@type": "Answer",
"text": "Yes, ROS Cycle is privacy-first. Your menstrual cycle data is stored locally on your device only and is never sent to our servers or any third party."
}
}
]
}
</script>
</head>
<body>
<div class="app" role="application" aria-label="ROS Cycle - Free Period Tracker & Menstrual Cycle Calendar">
<header>
<div class="logo">🌸 ROS Cycle</div>
<div>
<h1 style="margin:0;font-size:18px;font-weight:600">Free Period Tracker & Menstrual Cycle Calendar</h1>
<div class="lead">Gentle, private & student-friendly</div>
<div style="font-size:12px;color:var(--muted)">No data stored. Local only for this demo.</div>
</div>
</header>
<main aria-live="polite">
<!-- Step 1 -->
<section class="step active" id="step-1">
<div class="step-indicator">Step 1 of 4</div>
<div class="card">
<h2 style="margin:0 0 8px">Menstrual Cycle Tracker Setup ✨</h2>
<p style="margin:0 0 12px;color:var(--muted)">Let's set up your personal period tracker. Just a few friendly questions to get your cycle calendar started.</p>
<div class="field">
<label for="name">Name</label>
<input id="name" type="text" placeholder="How should I call you?" autocomplete="name" />
</div>
<div class="field">
<label for="dob">Date of birth <span style="font-weight:400;color:var(--muted);font-size:13px">(used only for age guidance)</span></label>
<input id="dob" type="date" />
<div style="font-size:12px;color:var(--muted);margin-top:6px">If you prefer, you can enter your age instead.</div>
</div>
<div class="controls" style="justify-content: space-between;">
<button class="btn-ghost" onclick="skipInfo()">Skip</button>
<div>
<button class="btn-primary" onclick="nextToPCOD()" style="margin-right: 10px;">Check for PCOD</button>
<button class="btn-primary" onclick="nextToStep2()">Continue</button>
</div>
</div>
</div>
</section>
<!-- Step PCOD -->
<section class="step" id="step-pcod">
<div class="step-indicator">Step 2 of 4</div>
<div class="card">
<h2 style="margin:0 0 8px">PCOD (Polycystic Ovarian Disease) Symptom Checker</h2>
<p style="margin:0 0 12px;color:var(--muted)">Check for possible PCOD or PCOS symptoms. Answer these questions about common signs. This is not a medical diagnosis—consult a doctor for proper advice.</p>
<form id="pcod-form">
<div class="checkbox-field"><input type="checkbox" id="symptom1"/><label for="symptom1">Irregular or missed periods</label></div>
<div class="checkbox-field"><input type="checkbox" id="symptom2"/><label for="symptom2">Excess facial or body hair</label></div>
<div class="checkbox-field"><input type="checkbox" id="symptom3"/><label for="symptom3">Acne or oily skin</label></div>
<div class="checkbox-field"><input type="checkbox" id="symptom4"/><label for="symptom4">Difficulty getting pregnant</label></div>
<div class="checkbox-field"><input type="checkbox" id="symptom5"/><label for="symptom5">Weight gain or difficulty losing weight</label></div>
<div class="checkbox-field"><input type="checkbox" id="symptom6"/><label for="symptom6">Thinning hair on the scalp</label></div>
<div class="checkbox-field"><input type="checkbox" id="symptom7"/><label for="symptom7">Darkening of skin (e.g., neck, groin)</label></div>
<div class="checkbox-field"><input type="checkbox" id="symptom8"/><label for="symptom8">Skin tags</label></div>
<div class="checkbox-field"><input type="checkbox" id="symptom9"/><label for="symptom9">Pelvic pain</label></div>
<div class="checkbox-field"><input type="checkbox" id="symptom10"/><label for="symptom10">Fatigue or low energy</label></div>
<div class="controls">
<button class="btn-ghost" onclick="showStep(1)">← Back</button>
<button class="btn-primary" type="button" onclick="checkPCOD()">Submit</button>
</div>
</form>
</div>
</section>
<!-- Step 2: Period details -->
<section class="step" id="step-2">
<div class="step-indicator">Step 3 of 4</div>
<div class="card">
<h2 style="margin:0 0 8px">Period Details for Cycle Prediction</h2>
<p style="margin:0 0 12px;color:var(--muted)">Enter your menstrual cycle details so we can create accurate fertility predictions and period forecasts.</p>
<div class="field">
<label for="last">When did your last period start?</label>
<input id="last" type="date" />
</div>
<div class="field">
<label for="cycle">Average cycle length (days)</label>
<input id="cycle" type="number" min="15" max="45" value="28" />
</div>
<div class="field">
<label for="periodLen">Average period length (days)</label>
<input id="periodLen" type="number" min="3" max="10" value="5" />
</div>
<div class="field">
<label for="variability">Cycle variability (± days) <span style="font-weight:400;color:var(--muted);font-size:13px">(optional, for better accuracy)</span></label>
<input id="variability" type="number" min="0" max="10" value="2" />
</div>
<div class="controls">
<button class="btn-ghost" onclick="showStep('pcod')">← Back</button>
<button class="btn-primary" onclick="createCalendar()">Create my calendar</button>
</div>
</div>
</section>
<!-- Step 3: Calendar -->
<section class="step" id="step-3">
<div class="step-indicator">Step 4 of 4</div>
<div class="card">
<h2 style="margin:0;font-size:18px;font-weight:700">Your Personal Menstrual Cycle Calendar</h2>
<div style="display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:10px;margin-top:12px">
<div>
<div id="greeting" style="font-weight:800"></div>
<div style="font-size:13px;color:var(--muted)" id="age-note"></div>
<div style="font-size:13px;color:var(--muted)" id="confidence-note"></div>
</div>
<div style="text-align:right">
<div style="font-size:12px;color:var(--muted)">Predicted months: 12</div>
<div style="font-size:12px;color:var(--muted)">Visible: <span id="visible-month"></span></div>
</div>
</div>
<div class="month-nav">
<button class="btn-ghost" id="prevBtn">←</button>
<div class="month-title" id="monthTitle">Month</div>
<button class="btn-ghost" id="nextBtn">→</button>
</div>
<div class="grid" id="weekdayLabels">
<div class="weekday-label">Sun</div><div class="weekday-label">Mon</div><div class="weekday-label">Tue</div>
<div class="weekday-label">Wed</div><div class="weekday-label">Thu</div><div class="weekday-label">Fri</div>
<div class="weekday-label">Sat</div>
</div>
<div class="grid" id="calendarGrid" role="grid"></div>
<div class="legend">
<div style="display:flex;align-items:center;gap:8px"><div class="box period" style="background:var(--pink)"></div> <span>Menstrual Period (Period Days)</span></div>
<div style="display:flex;align-items:center;gap:8px"><div class="box fertile" style="background:var(--mint)"></div> <span>Medium Fertility Window</span></div>
<div style="display:flex;align-items:center;gap:8px"><div class="box high-desire" style="background:var(--purple)"></div> <span>High Fertility Window & Ovulation ✨</span></div>
</div>
<div style="display:flex;gap:8px;justify-content:flex-end;margin-top:12px">
<button class="btn-ghost" onclick="showStep(2)">Update</button>
<button class="btn-primary" onclick="showResetModal()">Start Over</button>
</div>
</div>
<p style="margin-top:8px;font-size:13px;color:var(--muted)">
⚠️ Predictions are estimates based on the standard rhythm method. High Fertility & Desire marks peak days (around ovulation) when many experience higher desire, arousal & easier intimacy due to hormones — individual results vary. Not medical advice.
<a href="https://github.com/alwin-m/ROS-Cycle-Project" class="github-link" target="_blank" rel="noopener">Contribute on GitHub</a>
</p>
</section>
</main>
<footer>
<div style="font-size:12px;color:var(--muted)">
🌸 ROS Cycle — Free Period Tracker & Menstrual Cycle Calendar • Open-source • MIT License • <a href="https://github.com/alwin-m/ROS-Cycle-Project" class="github-link" target="_blank" rel="noopener">GitHub</a> •
<a href="https://alwin-m.github.io/Portfolio/" class="portfolio-link" target="_blank" rel="noopener">Portfolio</a>
</div>
<div style="display:flex;gap:12px">
<div class="theme-toggle" onclick="toggleTheme()">Toggle Dark Mode</div>
<div style="font-size:12px;color:var(--muted)">Made for students • Privacy-first • Period tracker app</div>
</div>
</footer>
</div>
<!-- Modals -->
<div class="modal" id="modal">
<div class="box">
<div id="modalText" role="alert"></div>
<div style="text-align:right;margin-top:16px">
<button class="btn-primary" onclick="closeModal()">Got it ♡</button>
</div>
</div>
</div>
<div class="modal" id="resetModal">
<div class="box">
<div>Start over? This will clear the current session~</div>
<div style="text-align:right;margin-top:16px">
<button class="btn-ghost" onclick="closeModal('resetModal')">Cancel</button>
<button class="btn-primary" onclick="resetAll()">Yes, start fresh</button>
</div>
</div>
</div>
<script>
let state = {
name: '', dob: null, age: null, last: null, cycle: 28, periodLen: 5, sigma: 2,
months: [], visibleIndex: 0, pcodChance: null, pcodSymptoms: [], confidence: 0.85
};
const el = id => document.getElementById(id);
function showStep(n) {
document.querySelectorAll('.step').forEach(s => s.classList.remove('active'));
if (typeof n === 'string') el('step-' + n).classList.add('active');
else el('step-' + n).classList.add('active');
const first = (typeof n === 'string' ? el('step-' + n) : el('step-' + n)).querySelector('input, button');
if (first) first.focus();
}
function showModal(msg) {
el('modalText').innerHTML = msg.replace(/\n\n/g, '<br><br>');
el('modal').classList.add('active');
}
function closeModal(id = 'modal') {
el(id).classList.remove('active');
}
function showResetModal() {
el('resetModal').classList.add('active');
}
function resetAll() {
state = {name:'', dob:null, age:null, last:null, cycle:28, periodLen:5, sigma:2, months:[], visibleIndex:0, pcodChance:null, pcodSymptoms:[], confidence:0.85};
['name','dob','last','cycle','periodLen','variability'].forEach(id => {
if (el(id)) el(id).value = id==='cycle'?28:id==='periodLen'?5:id==='variability'?2:'';
});
el('pcod-form')?.reset();
el('calendarGrid').innerHTML = '';
closeModal('resetModal');
showStep(1);
}
function skipInfo() { state.name = state.dob = state.age = null; showStep(2); }
function nextToStep2() {
const name = el('name').value.trim();
if (!name) return showModal('Please enter your name — a short nickname is fine~');
state.name = name;
const dob = el('dob').value;
if (dob) {
const parsed = new Date(dob);
const age = calculateAge(parsed);
if (age < 9 || age > 55) showModal(`Hmm~ Age ${age} seems a bit unusual (typical range 9–55). Still okay?`);
state.dob = parsed; state.age = age;
}
showStep(2);
}
function nextToPCOD() {
nextToStep2();
showStep('pcod');
}
function checkPCOD() {
const checked = document.querySelectorAll('#pcod-form input:checked');
state.pcodSymptoms = Array.from(checked).map(c => c.nextElementSibling.textContent);
const count = checked.length;
let chance = 'low', msg = '';
if (count <= 2) msg = 'Looks pretty low chance of PCOD~';
else if (count <= 5) { chance = 'medium'; msg = 'Medium chance… maybe worth chatting with a doctor soon ♡'; }
else { chance = 'high'; msg = 'Higher chance — best to see a doctor for a proper check.<br><br>PCOD can make cycles more unpredictable.'; }
if (state.pcodSymptoms.length) {
msg += `<br><br><strong>Symptoms you selected:</strong><ul style="margin:8px 0;padding-left:20px">${state.pcodSymptoms.map(s=>`<li>${s}</li>`).join('')}</ul>`;
}
msg += '<br><br>This is <strong>not</strong> a medical diagnosis, okay?';
state.pcodChance = chance;
showModal(msg);
}
function calculateAge(dob) {
const today = new Date();
let age = today.getFullYear() - dob.getFullYear();
const m = today.getMonth() - dob.getMonth();
if (m < 0 || (m === 0 && today.getDate() < dob.getDate())) age--;
return age;
}
function getDayDetails(targetDate, lastPeriodDate, cycleLength, periodLength, sigma) {
const daysSinceLast = Math.floor((targetDate - lastPeriodDate) / (24*60*60*1000));
if (daysSinceLast < 0) return { type: 'past', phase: 'unknown', pov: 0, fertility: 'low' };
let dayInCycle = daysSinceLast % cycleLength;
if (dayInCycle < 0) dayInCycle += cycleLength;
const ovulationCenter = cycleLength - 14;
const delta = 1.5;
const pov = Math.exp( - Math.pow(dayInCycle - ovulationCenter, 2) / (2 * Math.pow(sigma + delta, 2)) );
let fertility = 'low';
if (pov > 0.6) fertility = 'high';
else if (pov > 0.25) fertility = 'medium';
let phase = 'luteal';
if (dayInCycle < periodLength) phase = 'menstrual';
else if (dayInCycle < ovulationCenter) phase = 'follicular';
else if (Math.abs(dayInCycle - ovulationCenter) < 1) phase = 'ovulation';
else phase = 'luteal';
let type = 'normal';
if (phase === 'menstrual') type = 'period';
else if (fertility === 'high') type = 'high-desire';
else if (fertility === 'medium') type = 'fertile';
return { type, phase, pov, fertility };
}
function generateMonthsAhead(count = 12) {
state.months = [];
const base = new Date(state.last.getFullYear(), state.last.getMonth(), 1);
for (let i = 0; i < count; i++) {
const monthDate = new Date(base.getFullYear(), base.getMonth() + i, 1);
const daysInMonth = new Date(monthDate.getFullYear(), monthDate.getMonth() + 1, 0).getDate();
const monthObj = { month: monthDate.getMonth(), year: monthDate.getFullYear(), days: [] };
for (let d = 1; d <= daysInMonth; d++) {
const date = new Date(monthDate.getFullYear(), monthDate.getMonth(), d);
const details = getDayDetails(date, state.last, state.cycle, state.periodLen, state.sigma);
monthObj.days.push({ date, ...details });
}
state.months.push(monthObj);
}
}
function calculateConfidence() {
// More gentle curve — regular cycles get very high confidence
const baseConfidence = 1 - (state.sigma / (state.cycle * 0.65));
const pcodPenalty = state.pcodChance === 'high' ? 0.22 : state.pcodChance === 'medium' ? 0.12 : 0;
state.confidence = Math.max(0.48, baseConfidence - pcodPenalty);
}
function renderMonth(index) {
if (index < 0 || index >= 12) return;
const month = state.months[index];
el('monthTitle').innerText = `${['January','February','March','April','May','June','July','August','September','October','November','December'][month.month]} ${month.year}`;
el('visible-month').innerText = `${index + 1}/12`;
const nextPeriod = new Date(state.last);
nextPeriod.setDate(nextPeriod.getDate() + state.cycle);
el('greeting').innerHTML = `Hi ${state.name || 'there'}! ♡<br><small>Next period probably around: ${nextPeriod.toLocaleDateString(undefined, {weekday:'long', year:'numeric', month:'long', day:'numeric'})}</small>`;
let note = '';
if (state.age) note += `Age: ${state.age}`;
if (state.pcodChance) note += (note ? ' • ' : '') + `PCOD chance: ${state.pcodChance.charAt(0).toUpperCase() + state.pcodChance.slice(1)}`;
el('age-note').innerText = note;
const confPercent = Math.round(state.confidence * 100);
let confColor = confPercent >= 85 ? '#4CAF50' : confPercent >= 70 ? '#9C27B0' : '#FF7043';
el('confidence-note').innerHTML = `
<div class="confidence-text">
Cycle confidence: <strong style="color:${confColor}">${confPercent}%</strong>
<span class="info-icon" onclick="showConfidenceInfo()" tabindex="0" role="button" aria-label="Learn about cycle confidence">?</span>
<span style="font-size:11px;">(based on your regularity)</span>
</div>
`;
const grid = el('calendarGrid');
grid.innerHTML = '';
const firstDay = new Date(month.year, month.month, 1).getDay();
const totalCells = Math.ceil((firstDay + month.days.length) / 7) * 7;
for (let i = 0; i < totalCells; i++) {
const cell = document.createElement('div');
cell.className = 'cell';
cell.tabIndex = 0;
if (i < firstDay || i >= firstDay + month.days.length) {
cell.className += ' other';
cell.innerHTML = `<div class="daynum">-</div>`;
} else {
const day = month.days[i - firstDay];
const dateStr = day.date.toLocaleDateString();
cell.innerHTML = `<div class="daynum">${day.date.getDate()}</div>`;
let badgeText = '', tooltipText = `Phase: ${day.phase.charAt(0).toUpperCase() + day.phase.slice(1)} • Ovulation likelihood: ${Math.round(day.pov * 100)}% • Fertility: ${day.fertility.charAt(0).toUpperCase() + day.fertility.slice(1)} • ${dateStr}`;
if (day.type === 'period') {
badgeText = 'Period';
cell.innerHTML += `<div class="badge period">${badgeText}</div>`;
} else if (day.type === 'high-desire') {
badgeText = 'High Fertility & Desire ✨';
cell.innerHTML += `<div class="badge high-desire">${badgeText}</div>`;
} else if (day.type === 'fertile') {
badgeText = 'Medium Fertility';
cell.innerHTML += `<div class="badge fertile">${badgeText}</div>`;
}
if (tooltipText) {
const tip = document.createElement('div');
tip.className = 'tooltip';
tip.innerText = tooltipText;
cell.appendChild(tip);
}
}
grid.appendChild(cell);
}
}
function showConfidenceInfo() {
const conf = Math.round(state.confidence * 100);
let msg = `
<strong>Cycle confidence: ${conf}%</strong><br><br>
This little percentage shows how much we can trust the predictions~ ♡<br><br>
<strong>Very high (85–98%)</strong><br>
• Your cycles are super regular<br>
• Very little variation (±1–2 days)<br>
• Usually no PCOD symptoms<br><br>
<strong>Good (70–84%)</strong><br>
• Normal natural variation (±3–4 days)<br>
• Sometimes a bit irregular<br>
• Maybe light PCOD influence<br><br>
<strong>Moderate/Lower (below 70%)</strong><br>
• Bigger variation (±5+ days)<br>
• Often irregular or missed periods<br>
• Medium or high PCOD chance<br><br>
The more consistent your body is… the more accurate our gentle guesses become~ 🌸
`;
showModal(msg);
}
function createCalendar() {
const lastVal = el('last').value;
const cycle = parseInt(el('cycle').value, 10);
const periodLen = parseInt(el('periodLen').value, 10);
const sigma = parseInt(el('variability').value, 10) || 2;
if (!lastVal || isNaN(cycle) || cycle < 15 || cycle > 45 ||
isNaN(periodLen) || periodLen < 3 || periodLen > 10 ||
new Date(lastVal) > new Date()) {
showModal('Please check your inputs~<br>• Valid last period date (not future)<br>• Cycle 15–45 days<br>• Period 3–10 days');
return;
}
state.last = new Date(lastVal);
state.cycle = cycle;
state.periodLen = periodLen;
state.sigma = sigma;
calculateConfidence();
generateMonthsAhead(12);
state.visibleIndex = 0;
renderMonth(0);
showStep(3);
}
el('prevBtn').onclick = () => {
state.visibleIndex = Math.max(0, state.visibleIndex - 1);
renderMonth(state.visibleIndex);
};
el('nextBtn').onclick = () => {
state.visibleIndex = Math.min(11, state.visibleIndex + 1);
renderMonth(state.visibleIndex);
};
function toggleTheme() {
const isDark = document.documentElement.getAttribute('data-theme') === 'dark';
document.documentElement.setAttribute('data-theme', isDark ? 'light' : 'dark');
localStorage.setItem('theme', isDark ? 'light' : 'dark');
}
(function init() {
document.documentElement.setAttribute('data-theme', localStorage.getItem('theme') || 'light');
const today = new Date().toISOString().split('T')[0];
el('dob').max = today;
el('last').max = today;
el('name').focus();
})();
document.addEventListener('keydown', e => {
if (e.key === 'Escape') {
if (el('modal').classList.contains('active')) closeModal();
if (el('resetModal').classList.contains('active')) closeModal('resetModal');
}
});
</script>
</body>
</html>