/* A sprint: a cream egg timer standing on the desk at the bottom right, its red wedge the minutes left. Wound with
   a twist when it starts; when it rings it wobbles three times and settles. */
.sprint {
  --sprint-left: 25;
  position: fixed;
  right: max(1.25rem, env(safe-area-inset-right));
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  z-index: 12;
  color-scheme: light;
}
.sprint[hidden] { display: none; }

.sprint__egg {
  display: grid;
  justify-items: center;
  gap: 0.15rem;
  padding: 0;
  border: 0;
  background: none;
  color: #f4ead2;
  font: 700 0.8rem/1 var(--font-ui);
  cursor: pointer;
  filter: drop-shadow(0 6px 8px rgb(0 0 0 / 0.45));
}
.sprint__egg svg { width: 4.4rem; height: 5.5rem; overflow: visible; }
.sprint__egg:focus-visible { outline: 2px solid var(--brass); outline-offset: 4px; border-radius: 8px; }

.sprint__knob { fill: #c9b994; }
.sprint__shell { fill: #f4ead2; stroke: #d8c9a2; stroke-width: 1; }
.sprint__dial { fill: #fffaf0; stroke: #d8c9a2; stroke-width: 1; }
.sprint__left {
  fill: none;
  stroke: #c8432f;
  stroke-width: 20;
  stroke-dasharray: var(--sprint-left) 60;
  transition: stroke-dasharray 600ms ease-out;
}
.sprint__ticks line { stroke: #6b604c; stroke-width: 1.2; stroke-linecap: round; }
.sprint__pin { fill: #6b604c; }
.sprint__time { padding: 0.15rem 0.45rem; border-radius: 999px; background: rgb(33 19 12 / 0.75); }

/* Wound: the dial turns up to 25 with a twist. */
.sprint--wound .sprint__egg svg { animation: sprint-wound 700ms cubic-bezier(0.3, 0.8, 0.3, 1.2) both; transform-origin: 50% 60%; }
.sprint--wound .sprint__left { animation: sprint-dial 700ms ease-out both; }
@keyframes sprint-wound { from { rotate: -14deg; scale: 0.8; opacity: 0; } 60% { rotate: 6deg; } }
@keyframes sprint-dial { from { stroke-dasharray: 0 60; } }

/* Ringing: three wobbles, then still. */
.sprint--ringing .sprint__egg svg { animation: sprint-ring 180ms ease-in-out 6 alternate; transform-origin: 50% 90%; }
@keyframes sprint-ring { from { rotate: -7deg; } to { rotate: 7deg; } }

.sprint__menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.6rem);
  min-width: 11rem;
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--chrome-rule);
  background: var(--desk);
  color: var(--chrome);
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.45);
  font: 0.95rem/1.35 var(--font-ui);
}
.sprint__menu[hidden] { display: none; }
.sprint__so-far { margin: 0 0 0.6rem; }
.sprint__stop {
  width: 100%;
  min-height: 2.25rem;
  border: 0;
  border-radius: 6px;
  background: #f4ead2;
  color: #2b2a24;
  font: 600 0.95rem var(--font-ui);
  cursor: pointer;
}

/* The slip it rings with: the words it came to, in pencil on a scrap of paper beside the egg. */
.sprint__slip {
  position: absolute;
  right: calc(100% + 0.9rem);
  bottom: 1.4rem;
  width: max-content;
  max-width: min(21rem, calc(100vw - 9rem));
  padding: 0.8rem 1rem 0.6rem;
  background: var(--typed-paper, #fffdf6);
  color: var(--typed-ink, #2b2a24);
  box-shadow: 0 1px 1px rgb(0 0 0 / 0.15), 3px 8px 18px rgb(0 0 0 / 0.35);
  rotate: -2deg;
  animation: sprint-slip 500ms 200ms cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
.sprint__slip[hidden] { display: none; }
.sprint__said { margin: 0; font: 1.5rem/1.2 var(--font-hand); }
.sprint__slip-actions { display: flex; justify-content: flex-end; gap: 0.25rem; margin-top: 0.4rem; }
.sprint__slip-actions button {
  padding: 0.2rem 0.55rem;
  border: 0;
  border-radius: 4px;
  background: none;
  color: #5c5330;
  font: 1rem var(--font-hand);
  cursor: pointer;
}
.sprint__slip-actions button:hover, .sprint__slip-actions button:focus-visible { background: rgb(0 0 0 / 0.07); color: #2b2a24; }
@keyframes sprint-slip { from { opacity: 0; translate: 1.5rem 0.5rem; rotate: 4deg; } }

@media (prefers-reduced-motion: reduce) {
  .sprint--wound .sprint__egg svg, .sprint--wound .sprint__left, .sprint--ringing .sprint__egg svg, .sprint__slip { animation: none; }
  .sprint__left { transition: none; }
}
@media print {
  .sprint { display: none !important; }
}

/* A full sprint that beat this device's best: pencilled under the count. */
.sprint__best:not([hidden]) { margin: 0.1rem 0 0; color: #a3341f; font: 1.05rem/1.2 var(--font-hand); rotate: -2deg; }
