diff --git a/index.html b/index.html
index ba380db..62d098d 100644
--- a/index.html
+++ b/index.html
@@ -122,6 +122,7 @@
border:1px solid var(--edge); border-radius:14px; padding:16px; box-shadow:0 10px 30px rgba(0,0,0,.25); }
.tval { font-family:"Courier New",monospace; font-size:13px; color:var(--hot); min-width:42px; }
.tval.low { color:#ffb454; }
+ .tval.over { color:#ff7b6b; }
@media (max-width: 820px) {
#app { display:block; }
#routineTray { position:static; max-height:none; width:auto; margin-top:18px; }
@@ -951,25 +952,24 @@ function drawLoop() {
PRACTICE TIMERS — advance only while the metronome is running
========================================================================= */
const timers = { elapsedMs: 0, totalMs: 5 * 60000, remainingMs: 5 * 60000, last: 0 };
-function fmtClock(ms) { const s = Math.max(0, Math.round(ms / 1000)); return Math.floor(s / 60) + ":" + String(s % 60).padStart(2, "0"); }
+function fmtClock(ms) { const neg = ms < 0; const s = Math.round(Math.abs(ms) / 1000); return (neg ? "-" : "") + Math.floor(s / 60) + ":" + String(s % 60).padStart(2, "0"); }
function tickTimers() {
const now = Date.now();
const dt = timers.last ? Math.min(now - timers.last, 1000) : 0; // clamp so backgrounded gaps don't jump
timers.last = now;
if (state.running) {
timers.elapsedMs += dt;
- if (timers.totalMs > 0) {
- timers.remainingMs -= dt;
- if (timers.remainingMs <= 0) { timers.remainingMs = 0; if (state.running) toggleTransport(); } // time's up → stop
- }
+ if (timers.totalMs > 0) timers.remainingMs -= dt; // counts past 0 into negative (overtime); never stops the metronome
}
renderTimers();
}
function renderTimers() {
$("elapsedVal").textContent = fmtClock(timers.elapsedMs);
const cd = $("countVal");
- if (timers.totalMs <= 0) { cd.textContent = "off"; cd.classList.remove("low"); }
- else { cd.textContent = fmtClock(timers.remainingMs); cd.classList.toggle("low", state.running && timers.remainingMs <= 10000); }
+ if (timers.totalMs <= 0) { cd.textContent = "off"; cd.className = "tval"; return; }
+ cd.textContent = fmtClock(timers.remainingMs);
+ cd.classList.toggle("over", timers.remainingMs <= 0); // overtime
+ cd.classList.toggle("low", timers.remainingMs > 0 && timers.remainingMs <= 10000); // almost up
}
// Status shows in the display, under the BPM. Stopped → meter count; running →