.usage-page {
  max-width: 980px;
}

.usage-page > p:first-child {
  margin-bottom: 28px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin: 28px 0 36px;
  border: 1px solid black;
}

.stats p {
  margin: 0;
  padding: 15px 18px;
}

.stats p + p {
  border-left: 1px solid black;
}

.stats strong,
.stats span {
  display: block;
}

.stats strong {
  font-size: 24px;
  font-weight: normal;
  font-variant-numeric: tabular-nums;
}

.stats span {
  margin-top: 3px;
  color: #555;
  font-size: 14px;
}

.calendar-wrap {
  position: relative;
  overflow-x: auto;
  margin-top: 22px;
  padding: 8px 4px 12px;
  outline: none;
}

.calendar-wrap:focus-visible {
  outline: 1px dotted black;
  outline-offset: 4px;
}

.months {
  min-width: 827px;
  height: 23px;
  display: grid;
  grid-template-columns: 31px repeat(53, 11px);
  column-gap: 4px;
  color: #555;
  font-size: 12px;
}

.months span {
  white-space: nowrap;
}

.calendar-row {
  min-width: 827px;
  display: flex;
  gap: 9px;
}

.weekdays {
  width: 22px;
  height: 101px;
  display: grid;
  grid-template-rows: repeat(7, 11px);
  row-gap: 4px;
  color: #666;
  font-size: 10px;
  line-height: 11px;
}

.weekdays span:nth-child(1) { grid-row: 2; }
.weekdays span:nth-child(2) { grid-row: 4; }
.weekdays span:nth-child(3) { grid-row: 6; }

.heatmap {
  display: grid;
  grid-template-rows: repeat(7, 11px);
  grid-auto-columns: 11px;
  grid-auto-flow: column;
  gap: 4px;
}

.day {
  width: 11px;
  height: 11px;
  padding: 0;
  border: 1px solid #e1e1e1;
  border-radius: 2px;
  background: #f2f2f2;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background-color 180ms ease;
}

.day[data-level="1"], .legend i[data-level="1"] { background: #e1d5f0; border-color: #e1d5f0; }
.day[data-level="2"], .legend i[data-level="2"] { background: #b99bd7; border-color: #b99bd7; }
.day[data-level="3"], .legend i[data-level="3"] { background: #8f5fba; border-color: #8f5fba; }
.day[data-level="4"], .legend i[data-level="4"] { background: #65358f; border-color: #65358f; }

.day:hover,
.day:focus-visible {
  position: relative;
  z-index: 1;
  transform: translateY(-3px) scale(1.28);
  box-shadow: 0 4px 8px rgb(0 0 0 / 18%);
  outline: 1px solid black;
  outline-offset: 1px;
}

.day.blank {
  visibility: hidden;
}

.calendar-caption {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: #555;
  font-size: 13px;
}

.legend {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.legend i {
  width: 11px;
  height: 11px;
  display: inline-block;
  border: 1px solid #e1e1e1;
  border-radius: 2px;
  background: #f2f2f2;
}

.tooltip {
  position: fixed;
  z-index: 10;
  padding: 7px 9px;
  border: 1px solid black;
  background: white;
  box-shadow: 5px 5px 0 rgb(0 0 0 / 14%);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%);
  transition: opacity 100ms ease;
}

.tooltip.visible {
  opacity: 1;
}

.usage-page table {
  width: min(100%, 660px);
  margin: 14px 0 24px;
  border-collapse: collapse;
  font-size: 15px;
}

.usage-page th,
.usage-page td {
  padding: 7px 10px 7px 0;
  border-bottom: 1px solid #bbb;
  text-align: left;
}

.usage-page th:not(:first-child),
.usage-page td:not(:first-child) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: reduce) {
  .day,
  .tooltip {
    transition: none;
  }

  .day:hover,
  .day:focus-visible {
    transform: none;
  }
}

@media (max-width: 660px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats p:nth-child(3) {
    border-top: 1px solid black;
    border-left: 0;
  }

  .stats p:nth-child(4) {
    border-top: 1px solid black;
  }

  .calendar-caption {
    align-items: flex-start;
    flex-direction: column;
  }
}
