emom 1.1.2

A customizable EMOM (Every Minute On the Minute) timer for workouts, with a drift-correcting countdown timer library for WebAssembly applications
Documentation
/* Animated liquid background */
body {
    transition: color 0.3s ease-out;
    margin: 0;
    padding: 40px;
    min-height: 100vh;
    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: hidden;
}

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

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

@media (max-width: 480px) and (orientation: landscape) {
    body {
        padding: 8px;
        align-items: center;
    }
}

/* 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(30px);
}

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(35px);
}

@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: 1200px;
    width: 90%;
    padding: 40px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border-radius: 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 20px rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 1;
}

/* Mobile-specific adjustments for iPhone */
@media (max-width: 768px) {
    #background {
        width: 95%;
        padding: 20px;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    #background {
        width: 98%;
        padding: 16px;
    }
}

/* Main title spans full width */
.mainTitle {
    width: 100%;
    text-align: left;
    font-size: clamp(1rem, 2vw, 2rem); /* Responsive font size */
}

/* Mobile portrait: smaller title */
@media (max-width: 480px) and (orientation: portrait) {
    .mainTitle {
        font-size: clamp(1.25rem, 5vw, 1.75rem);
        text-align: center;
    }
}

/* Rounds display spans full width */
.roundsDisplay {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: clamp(1rem, 4vw, 2rem);
}

/* Mobile portrait: smaller rounds display */
@media (max-width: 480px) and (orientation: portrait) {
    .roundsDisplay {
        font-size: clamp(1.25rem, 6vw, 1.75rem);
        justify-content: center;
    }
}

/* Timer display adjusts with viewport */
.timerDisplay {
    width: 100%;
    font-size: clamp(2rem, 25vw, 12rem); /* Responsive font size */
    text-align: center;
    font-variant-numeric: tabular-nums; /* Fixed-width digits prevent layout shift */
    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: smaller timer that fits on one line */
@media (max-width: 480px) and (orientation: portrait) {
    .timerDisplay {
        font-size: clamp(2.5rem, 16vw, 5rem);
        letter-spacing: -0.03em; /* Tighter spacing on mobile */
    }
}

/* Mobile landscape: use more horizontal space */
@media (max-width: 896px) and (orientation: landscape) {
    .timerDisplay {
        font-size: clamp(2rem, 12vw, 7rem);
    }
}

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

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

/* Continuous subtle pulse animation for tenths digit */
.digit-tenths {
    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);
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

/* 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: 1 1 20%; /* Adjust percentage as needed */
    margin: 0.5%;
    min-width: 90px;   /* Optional: prevent buttons from becoming too small */
    max-width: 110px;  /* Optional: prevent buttons from becoming too large */
    font-size: clamp(0.875rem, 1.5vw, 1.5rem); /* Responsive font size */
    font-family: Verdana, Geneva, Tahoma, sans-serif;
    
    /* Glass effect for buttons */
    background: rgba(196, 255, 198, 0.3);
    backdrop-filter: blur(10px) saturate(150%);
    -webkit-backdrop-filter: blur(10px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    padding: 10px 16px;
    box-shadow: 
        0 4px 16px 0 rgba(31, 38, 135, 0.2),
        inset 0 0 10px rgba(255, 255, 255, 0.2);
    transition: all 0.2s ease;
    cursor: pointer;
}

/* Mobile: smaller buttons that fit better */
@media (max-width: 480px) {
    #buttonDisplay button {
        flex: 1 1 45%;
        min-width: 70px;
        max-width: 140px;
        font-size: clamp(0.75rem, 3.5vw, 1rem);
        padding: 8px 12px;
        margin: 2px;
    }
}

#buttonDisplay button:hover {
    background: rgba(196, 255, 198, 0.4);
    transform: translateY(-1px);
    box-shadow: 
        0 6px 20px 0 rgba(31, 38, 135, 0.3),
        inset 0 0 15px rgba(255, 255, 255, 0.3);
}

#buttonDisplay button:active {
    transform: translateY(0);
    box-shadow: 
        0 2px 8px 0 rgba(31, 38, 135, 0.2),
        inset 0 0 8px rgba(255, 255, 255, 0.15);
}