/* The habit day picker: seven days on white; the days chosen weld into ink capsules. */
:root {
  --page: #ffffff;          /* the page */
  --ink: #16161b;           /* the welded capsules and the text */
  --well: #f1f1f4;          /* the days not chosen */
  --well-hover: #e7e7ec;    /* a day not chosen, under the pointer */
  --muted: #8a8a94;         /* labels */
  --letter: #5d5d68;        /* the letter of a day not chosen */
  --accent: #2f7d62;        /* the run bar and today's mark */
  --d: clamp(34px, calc((100vw - 64px) / 7.7), 46px); /* the size of a day */
  --gap: clamp(4px, 1.4vw, 7px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.pick {
  width: max-content;
  max-width: 100%;
  display: grid;
  gap: 16px;
}

.pick__head, .pick__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pick__habit { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pick__icon { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.pick__title { font-size: 15px; font-weight: 620; font-stretch: 104%; letter-spacing: -0.01em; white-space: nowrap; }

.pick__count {
  position: relative;
  display: inline-block;
  height: 18px;
  overflow: hidden;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
  /* room for the rolling label, so it never clips its own descenders */
  padding: 0 1px;
}
.pick__countin { display: inline-block; line-height: 18px; }

/* the row of days: the buttons sit over an svg that draws the wells and the ink */
.days {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, var(--d));
  gap: var(--gap);
  justify-content: start;
}
.days__ink {
  position: absolute;
  left: -16px;
  top: -16px;
  width: calc(100% + 32px);
  height: calc(100% + 32px);
  overflow: visible;
  pointer-events: none;
}
.days__wells circle { fill: var(--well); transition: fill 0.2s ease; }
.days__wells circle.is-hover { fill: var(--well-hover); }
.days__blobs { fill: var(--ink); }

.day {
  position: relative;
  appearance: none;
  border: 0;
  margin: 0;
  padding: 0;
  width: var(--d);
  height: var(--d);
  border-radius: 999px;
  background: transparent;
  color: var(--letter);
  font: inherit;
  font-size: calc(var(--d) * 0.32);
  font-weight: 560;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.day:focus { outline: none; }
.day:focus-visible { box-shadow: 0 0 0 2px var(--page), 0 0 0 4px var(--accent); }
.day__letter { display: inline-block; }

/* today: a short bar under the letter */
.day--today::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 18%;
  width: 8px;
  height: 2px;
  margin-left: -4px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.9;
}

.pick__foot { font-size: 12.5px; color: var(--muted); }
.run { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.run__label { white-space: nowrap; }
.run__track {
  position: relative;
  width: 56px;
  height: 4px;
  border-radius: 4px;
  background: var(--well);
  overflow: hidden;
}
.run__fill {
  position: absolute;
  inset: 0;
  border-radius: 4px;
  background: var(--accent);
  transform-origin: 0 50%;
  transform: scaleX(0.14);
}
.run__value {
  position: relative;
  display: inline-block;
  height: 16px;
  overflow: hidden;
  color: var(--ink);
  font-weight: 560;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.run__valuein { display: inline-block; line-height: 16px; }
.pick__today { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.pick__todaymark { width: 8px; height: 2px; border-radius: 2px; background: var(--accent); }

.ghost {
  position: fixed;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  z-index: 5;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.18));
}
.ghost path { fill: #17171c; stroke: #fff; stroke-width: 1.4; stroke-linejoin: round; }

@media (max-width: 380px) {
  .pick__today { display: none; }
}
