emom 1.1.8

A customizable EMOM (Every Minute On the Minute) timer for workouts, with a drift-correcting countdown timer library for WebAssembly applications
Documentation
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
/* Animated liquid background */
body {
    transition: color 0.3s ease-out;
    margin: 0;
    padding: 2vmin;
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile */
    box-sizing: border-box;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 400% 400%;
    animation: gradient-shift 15s ease infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: auto;
}

/* Mobile: less padding to maximize screen space */
@media (max-width: 768px) {
    body {
        padding: 1.5vmin;
    }
}

@media (max-width: 480px) {
    body {
        padding: 1vmin;
        align-items: flex-start;
        padding-top: max(1vmin, env(safe-area-inset-top));
    }
}

/* Landscape: wider layout, less vertical padding */
@media (orientation: landscape) {
    body {
        padding: 1vh 2vw;
        align-items: center;
        overflow: auto;
    }
}

/* Wavy cloud layers for glass to obscure */
body::before,
body::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 0;
    pointer-events: none;
    mask-image: radial-gradient(ellipse 100% 100% at center, black 40%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 100% 100% at center, black 40%, transparent 100%);
}

/* Mobile: reduce cloud visibility for better content clarity */
@media (max-width: 480px) {
    body::before,
    body::after {
        opacity: 0.6;
    }
}

body::before {
    background: 
        radial-gradient(ellipse 1400px 200px at 20% 30%, rgba(255, 255, 255, 0.58) 0%, rgba(255, 255, 255, 0.27) 40%, transparent 70%),
        radial-gradient(ellipse 1200px 180px at 80% 20%, rgba(255, 255, 255, 0.53) 0%, rgba(255, 255, 255, 0.22) 40%, transparent 70%),
        radial-gradient(ellipse 1600px 220px at 40% 70%, rgba(255, 255, 255, 0.62) 0%, rgba(255, 255, 255, 0.32) 40%, transparent 70%);
    animation: clouds-drift-1 30s ease-in-out infinite;
    filter: blur(22px);
}

body::after {
    background: 
        radial-gradient(ellipse 1500px 190px at 60% 40%, rgba(255, 255, 255, 0.56) 0%, rgba(255, 255, 255, 0.25) 40%, transparent 70%),
        radial-gradient(ellipse 1300px 210px at 30% 80%, rgba(255, 255, 255, 0.6) 0%, rgba(255, 255, 255, 0.3) 40%, transparent 70%),
        radial-gradient(ellipse 1800px 240px at 90% 70%, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0.21) 40%, transparent 70%);
    animation: clouds-drift-2 40s ease-in-out infinite reverse;
    filter: blur(26px);
}

@media (max-width: 768px) {
    body {
        animation: none;
        background-size: 100% 100%;
    }

    body::before,
    body::after {
        animation: none;
        filter: blur(18px);
        mask-image: none;
        -webkit-mask-image: none;
    }
}

@keyframes clouds-drift-1 {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    33% {
        transform: translate(-2%, 1%) rotate(0.5deg);
    }
    66% {
        transform: translate(1%, -2%) rotate(-0.3deg);
    }
}

@keyframes clouds-drift-2 {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    50% {
        transform: translate(1.5%, 1.5%) rotate(-0.8deg);
    }
}

/* Animated gradient background */
@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Floating liquid glass card */
#background {
    max-width: min(1200px, 95vw);
    width: 90%;
    min-height: min(600px, 75vh);
    padding: clamp(16px, 3vmin, 40px);
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border-radius: clamp(12px, 2vmin, 24px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 
        0 8px 32px 0 rgba(31, 38, 135, 0.37),
        inset 0 0 12px rgba(255, 255, 255, 0.08);
    position: relative;
    z-index: 1;
    overflow: hidden;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
}

/* Mottled glass texture overlay */
#background::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 2px,
            rgba(255, 255, 255, 0.03) 2px,
            rgba(255, 255, 255, 0.03) 4px
        ),
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 2px,
            rgba(255, 255, 255, 0.02) 2px,
            rgba(255, 255, 255, 0.02) 4px
        );
    opacity: 0.5;
    pointer-events: none;
    z-index: 1;
}

/* Ensure content appears above texture */
#background > * {
    position: relative;
    z-index: 2;
}

/* Mobile-specific adjustments for iPhone */
@media (max-width: 768px) {
    #background {
        width: 96%;
        min-height: min(550px, 70vh);
        padding: clamp(12px, 2.5vmin, 20px);
        max-width: 100%;
        backdrop-filter: blur(14px) saturate(140%);
        -webkit-backdrop-filter: blur(14px) saturate(140%);
    }
}

@media (max-width: 480px) {
    #background {
        width: 98%;
        min-height: min(500px, 65vh);
        padding: clamp(10px, 2vmin, 16px);
    }
}

/* Landscape: wider, more compact */
@media (orientation: landscape) {
    #background {
        width: 98%;
        max-width: 95vw;
        padding: clamp(6px, 1vh, 12px) clamp(12px, 2vw, 24px);
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
}

/* Main title spans full width */
.mainTitle {
    width: 100%;
    text-align: left;
    font-size: clamp(1.25rem, 2.5vw, 2.5rem); /* Responsive font size */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-weight: 500;
    letter-spacing: -0.02em;
}

.mainTitle h3 {
    font-weight: 600;
    margin: 0;
    padding: 0;
}

/* Mobile portrait: larger title */
@media (max-width: 480px) and (orientation: portrait) {
    .mainTitle {
        font-size: clamp(1.5rem, 6vw, 2rem);
        text-align: center;
    }
}

/* Rounds display spans full width */
.roundsDisplay {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: clamp(1.25rem, 5vw, 2.5rem);
    margin-bottom: clamp(1rem, 2vh, 1.5rem);
    padding-bottom: clamp(0.5rem, 1vh, 1rem);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    gap: clamp(2rem, 10vw, 6rem);
}

/* Mobile portrait: larger rounds display */
@media (max-width: 480px) and (orientation: portrait) {
    .roundsDisplay {
        font-size: clamp(1.5rem, 6vw, 2rem);
        justify-content: space-around;
        margin-bottom: clamp(1.5rem, 3vh, 2rem);
        padding-bottom: clamp(0.75rem, 1.5vh, 1.5rem);
        border-bottom: 1px solid rgba(255, 255, 255, 0.25);
        gap: clamp(3rem, 15vw, 8rem);
    }
}

/* Timer display adjusts with viewport */
.timerDisplay {
    width: 100%;
    font-size: clamp(3rem, 25vw, 12rem); /* Responsive font size */
    text-align: center;
    font-variant-numeric: tabular-nums; /* Fixed-width digits prevent layout shift */
    margin-top: clamp(0.5rem, 1vh, 1rem);
    margin-bottom: clamp(0.5rem, 1vh, 1rem);
    white-space: nowrap; /* Prevent wrapping */
    overflow: visible; /* Allow overflow rather than wrap */
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
}

/* Mobile portrait: larger timer to fill vertical space */
@media (max-width: 480px) and (orientation: portrait) {
    .timerDisplay {
        font-size: clamp(3rem, 22vw, 7rem);
        letter-spacing: -0.03em; /* Tighter spacing on mobile */
        margin-top: clamp(1rem, 2vh, 1.5rem);
        margin-bottom: clamp(1rem, 2vh, 1.5rem);
    }
}

/* Landscape: use more horizontal space */
@media (orientation: landscape) {
    .timerDisplay {
        font-size: clamp(5rem, 24vh, 16rem);
        letter-spacing: -0.02em;
        margin-top: clamp(0.5rem, 1vh, 1rem);
        margin-bottom: clamp(0.5rem, 1vh, 1rem);
    }
    
    .mainTitle {
        font-size: clamp(1.25rem, 3vh, 2rem);
        text-align: center;
    }
    
    .roundsDisplay {
        font-size: clamp(1.25rem, 3vh, 2rem);
        margin-bottom: clamp(0.5rem, 1.5vh, 1rem);
    }
}

/* Individual digit styling */
.digit {
    display: inline-block;
}

/* Separator styling (colon and period) */
.separator {
    display: inline-block;
    opacity: 0.8;
}

/* Continuous subtle pulse animation for tenths digit */
.digit-tenths {
    will-change: transform, opacity;
    animation: tenths-pulse 0.25s ease-in-out infinite;
}

@keyframes tenths-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.02);
        opacity: 0.95;
    }
}

/* Smooth color transitions for blink states */
body {
    transition: color 0.3s ease-out;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    box-sizing: border-box;
}

/* Add a subtle glow effect to the timer display */
.timerDisplay {
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3),
                 0 0 40px rgba(255, 255, 255, 0.2);
}

@media (max-width: 768px) {
    .timerDisplay {
        text-shadow: 0 0 14px rgba(255, 255, 255, 0.25);
    }
}

/* Pulse the entire timer display slightly - only when idle */
@keyframes timer-breathe {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.01);
    }
}

.timerDisplay.timer-idle {
    animation: timer-breathe 4s ease-in-out infinite;
}

/* Button container uses Flexbox */
#buttonDisplay {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

/* Buttons adjust based on container width */
#buttonDisplay button {
    flex: 0 0 auto; /* Don't grow, size to content */
    margin: 0.5%;
    min-width: auto;   /* Let content determine width */
    max-width: none;  /* No max restriction */
    font-size: clamp(0.875rem, 1.5vw, 1.5rem); /* Responsive font size */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-weight: 400;
    letter-spacing: -0.01em;
    color: #283f8a;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.35);
    
    /* Enhanced liquid glass effect for buttons */
    background: linear-gradient(
        135deg,
        rgba(140, 200, 255, 0.28) 0%,
        rgba(90, 125, 235, 0.28) 45%,
        rgba(70, 45, 160, 0.3) 100%
    );
    backdrop-filter: blur(12px) saturate(160%);
    -webkit-backdrop-filter: blur(12px) saturate(160%);
    border: 1px solid rgba(130, 175, 255, 0.35);
    border-radius: 12px;
    padding: 10px 16px;
    box-shadow: 
        0 8px 24px 0 rgba(36, 54, 140, 0.25);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        background 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

/* Mottled glass texture for buttons */
#buttonDisplay button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.08) 0%, transparent 50%),
        repeating-linear-gradient(
            60deg,
            transparent,
            transparent 3px,
            rgba(255, 255, 255, 0.02) 3px,
            rgba(255, 255, 255, 0.02) 6px
        );
    opacity: 0.6;
    pointer-events: none;
}

/* Mobile: smaller buttons that fit better */
@media (max-width: 480px) {
    #buttonDisplay button {
        flex: 0 1 auto;
        min-width: 65px;
        max-width: none;
        font-size: clamp(0.7rem, 3vw, 0.95rem);
        padding: 7px 11px;
        margin: 2px;
        white-space: nowrap;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
}

/* Landscape: compact buttons in a single row */
@media (orientation: landscape) {
    #buttonDisplay {
        gap: 6px;
        margin-top: 0.5rem;
        flex-wrap: nowrap;
    }
    
    #buttonDisplay button {
        flex: 0 1 auto;
        min-width: auto;
        font-size: clamp(0.7rem, 1.8vw, 0.9rem);
        padding: 5px 11px;
        margin: 0;
        white-space: nowrap;
    }
}

#buttonDisplay button:hover {
    background: linear-gradient(
        135deg,
        rgba(150, 210, 255, 0.35) 0%,
        rgba(100, 135, 245, 0.35) 45%,
        rgba(80, 55, 175, 0.38) 100%
    );
    transform: translateY(-2px);
    box-shadow: 
        0 12px 32px 0 rgba(36, 54, 140, 0.3);
    border-color: rgba(160, 200, 255, 0.55);
}

#buttonDisplay button:active {
    transform: translateY(0);
    background: linear-gradient(
        135deg,
        rgba(120, 180, 245, 0.25) 0%,
        rgba(85, 115, 220, 0.25) 45%,
        rgba(65, 40, 150, 0.28) 100%
    );
    box-shadow: 
        0 4px 12px 0 rgba(36, 54, 140, 0.2);
}