:root {
  color-scheme: light;
  --bg: #ffffff;
  --text: #343c3c;
  --muted: #5e6666;
  --faint: #8d9393;
  --line: #e5e8e3;
  --surface: #f6f7f5;
  --moss: #abb495;
  --moss-strong: #7f8d68;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d0d;
  --text: #e4dfdb;
  --muted: #a3a3a3;
  --faint: #777d7d;
  --line: #303333;
  --surface: #171919;
  --moss: #c2caa9;
  --moss-strong: #d1d8bc;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
}

body {
  color: var(--text);
  font-family: var(--interfaceFont);
  font-size: 12px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
select {
  color: inherit;
  font: inherit;
}

button:focus-visible,
select:focus-visible,
.bar:focus-visible {
  outline: 2px solid var(--moss-strong);
  outline-offset: 2px;
}

.tracker {
  width: 100%;
  min-height: 500px;
  padding: 18px;
}

.tracker__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.eyebrow,
.total,
.muted,
.daily-view__topline p,
.source {
  margin: 0;
}

.eyebrow {
  color: var(--muted);
}

.total {
  font-family: var(--monoFont);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.total strong {
  font-size: 22px;
  font-weight: 520;
  letter-spacing: -0.035em;
}

.muted,
.source,
.recents dt {
  color: var(--muted);
}

.controls,
.segmented {
  display: flex;
  gap: 4px;
}

.segmented,
.unit-toggle,
select {
  padding: 2px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 3px;
}

.segmented button,
.unit-toggle {
  min-height: 24px;
  padding: 2px 7px;
  background: transparent;
  border: 0;
  border-radius: 2px;
  cursor: pointer;
}

.segmented button[aria-pressed="true"] {
  color: var(--text);
  background: var(--bg);
  box-shadow: 0 0 0 1px var(--line);
}

.unit-toggle {
  min-width: 30px;
  border: 1px solid var(--line);
}

.recents {
  display: flex;
  gap: 28px;
  margin: 18px 0 0;
}

.recents div {
  display: grid;
  grid-template-columns: auto auto;
  gap: 8px;
}

.recents dt,
.recents dd {
  margin: 0;
}

.recents dd {
  font-family: var(--monoFont);
  font-variant-numeric: tabular-nums;
}

#year-total,
#updated {
  font-family: var(--monoFont);
}

.monthly-chart {
  display: grid;
  grid-template-columns: repeat(12, minmax(22px, 1fr));
  align-items: end;
  gap: 5px;
  height: 228px;
  margin-top: 18px;
  padding-top: 12px;
  border-bottom: 1px solid var(--line);
}

.month {
  display: grid;
  grid-template-rows: 1fr 18px;
  align-items: end;
  height: 100%;
  min-width: 0;
}

.bar-wrap {
  display: flex;
  align-items: flex-end;
  height: 100%;
}

.bar {
  width: 100%;
  min-height: 2px;
  background: var(--moss);
  border-radius: 2px 2px 0 0;
}

.month.is-untracked .bar {
  min-height: 0;
  background: transparent;
  border-top: 1px dashed var(--line);
  border-radius: 0;
}

.month-label {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 18px;
  text-align: center;
  text-overflow: clip;
}

.daily-view {
  margin-top: 18px;
}

.daily-view__topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 27px;
}

select {
  min-height: 24px;
}

.heatmap-scroll {
  margin-top: 14px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.heatmap {
  display: grid;
  grid-template-rows: repeat(7, 10px);
  grid-auto-columns: 10px;
  grid-auto-flow: column;
  gap: 3px;
  width: max-content;
  min-width: 100%;
  padding-bottom: 4px;
}

.day {
  width: 10px;
  height: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 2px;
}

.day.is-untracked,
.day.is-future {
  background: transparent;
  border-color: color-mix(in srgb, var(--line) 55%, transparent);
}

.level-1 {
  background: color-mix(in srgb, var(--moss) 38%, var(--surface));
}

.level-2 {
  background: color-mix(in srgb, var(--moss) 60%, var(--surface));
}

.level-3 {
  background: color-mix(in srgb, var(--moss) 80%, var(--surface));
}

.level-4 {
  background: var(--moss-strong);
}

.legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 10px;
}

.legend i {
  width: 9px;
  height: 9px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 2px;
}

.legend i.level-1,
.legend i.level-2,
.legend i.level-3,
.legend i.level-4 {
  border: 0;
}

.error {
  color: var(--muted);
}

.source {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  margin-top: 22px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
  font-size: 10px;
}

.source__note {
  flex-basis: 100%;
  color: var(--faint);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

@media (max-width: 520px) {
  .tracker {
    min-height: 540px;
    padding: 14px;
  }

  .tracker__header {
    align-items: flex-start;
    gap: 12px;
  }

  .controls {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .monthly-chart {
    grid-template-columns: repeat(12, minmax(16px, 1fr));
    gap: 3px;
    height: 250px;
  }

  .month-label {
    font-size: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}
