:root {
  color-scheme: dark;
  font-family: ui-rounded, "SF Pro Rounded", "SF Pro Display", system-ui, sans-serif;
  --busy: #ee3344;
  --free: #16bd6c;
  --offline: #17191f;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100dvh;
  color: white;
  background: var(--offline);
  transition: background-color 320ms ease;
  overflow: hidden;
}

body.busy {
  background: var(--busy);
}

body.free {
  background: var(--free);
}

body.offline {
  background: var(--offline);
}

main {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(28px, env(safe-area-inset-top)) 24px max(88px, env(safe-area-inset-bottom));
  text-align: center;
}

.eyebrow {
  font-size: clamp(0.75rem, 2.8vw, 1rem);
  font-weight: 800;
  letter-spacing: 0.24em;
  opacity: 0.72;
}

.status-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

h1 {
  margin: 0.18em 0 0;
  font-size: clamp(3.4rem, 16vw, 8rem);
  font-weight: 900;
  line-height: 0.92;
  letter-spacing: -0.055em;
  text-wrap: balance;
}

.task-summary {
  min-width: min(78vw, 420px);
  margin-top: clamp(1rem, 3vh, 1.65rem);
  padding: clamp(0.75rem, 2.5vw, 1rem) clamp(1.25rem, 5vw, 2.25rem) 1.1rem;
  border-radius: clamp(24px, 7vw, 38px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition:
    background-color 280ms ease,
    box-shadow 280ms ease,
    transform 280ms ease;
}

.task-summary[hidden] {
  display: none;
}

.active-count {
  font-size: clamp(7rem, 32vw, 15rem);
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  line-height: 0.76;
  letter-spacing: -0.075em;
  transform: translateX(-0.035em);
}

.active-unit {
  margin-top: 0.8rem;
  font-size: clamp(0.82rem, 3.2vw, 1.05rem);
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.82;
}

.task-summary.is-completing {
  background: rgb(0 83 45 / 0.3);
  box-shadow:
    0 0 0 3px rgb(255 255 255 / 0.34),
    0 18px 60px rgb(0 70 38 / 0.34);
  transform: scale(1.025);
}

p {
  margin: 1.4rem 0 0;
  font-size: clamp(1rem, 4vw, 1.4rem);
  font-weight: 650;
}

.updated {
  margin-top: 0.6rem;
  font-size: 0.84rem;
  font-weight: 550;
  opacity: 0.7;
}

.completion-notice {
  min-height: 2.65rem;
  margin-top: 0.85rem;
  padding: 0.62rem 1rem;
  border: 1px solid transparent;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  background: transparent;
  font-size: clamp(0.9rem, 3.6vw, 1.1rem);
  font-weight: 850;
  opacity: 0;
  transform: translateY(8px) scale(0.97);
  transition:
    opacity 240ms ease,
    transform 240ms ease,
    background-color 240ms ease,
    border-color 240ms ease,
    box-shadow 240ms ease;
}

.completion-notice.is-visible {
  border-color: rgb(255 255 255 / 0.42);
  background: rgb(0 70 38 / 0.42);
  box-shadow: 0 12px 32px rgb(0 58 32 / 0.22);
  opacity: 1;
  transform: translateY(0) scale(1);
}

.controls {
  position: fixed;
  z-index: 2;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  left: max(12px, env(safe-area-inset-left));
  display: flex;
  justify-content: center;
  gap: 8px;
}

button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgb(255 255 255 / 0.3);
  border-radius: 999px;
  color: white;
  background: rgb(0 0 0 / 0.16);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

button:active {
  transform: scale(0.97);
}

@media (prefers-reduced-motion: reduce) {
  body,
  .task-summary,
  .completion-notice {
    transition-duration: 0.01ms;
  }
}

@media (orientation: landscape) {
  main {
    padding:
      max(16px, env(safe-area-inset-top))
      max(30px, env(safe-area-inset-right))
      max(68px, env(safe-area-inset-bottom))
      max(30px, env(safe-area-inset-left));
  }

  .eyebrow {
    margin-bottom: clamp(0.35rem, 2vh, 0.75rem);
    font-size: clamp(0.68rem, 2.4vh, 0.9rem);
  }

  .status-row {
    width: 100%;
    flex-direction: row;
    gap: clamp(1.75rem, 6vw, 5rem);
  }

  h1 {
    margin: 0;
    font-size: clamp(3.25rem, 20vh, 6.75rem);
  }

  .task-summary {
    min-width: clamp(10rem, 24vw, 16rem);
    margin-top: 0;
    padding: clamp(0.55rem, 2vh, 0.9rem) clamp(1rem, 3vw, 2rem) 0.9rem;
  }

  .active-count {
    font-size: clamp(5rem, 36vh, 9rem);
  }

  .active-unit {
    margin-top: clamp(0.35rem, 1.5vh, 0.65rem);
    font-size: clamp(0.7rem, 2.5vh, 0.9rem);
  }

  .completion-notice {
    min-height: 2.3rem;
    margin-top: clamp(0.35rem, 1.6vh, 0.7rem);
    padding: 0.48rem 0.9rem;
  }

  .updated {
    margin-top: 0.35rem;
    font-size: clamp(0.68rem, 2.1vh, 0.78rem);
  }
}

@media (display-mode: standalone) {
  #token {
    display: none;
  }
}
