:root {
  color-scheme: light;
  --bg: #f7f7f5;
  --ink: #171917;
  --muted: #6f756f;
  --faint: #9aa09a;
  --line: #dedfdb;
  --active: #1e7c56;
  --idle: #a46c1d;
  --private: #6d6a75;
  --offline: #888b87;
  --error: #a6402c;
  --sans: "Segoe UI", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
}

button {
  font: inherit;
}

.page {
  width: min(720px, calc(100% - 40px));
  min-height: 100vh;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
}

.header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: grid;
  gap: 1px;
  color: var(--ink);
  line-height: 1.25;
  text-decoration: none;
}

.brand__name {
  font-size: 14px;
  font-weight: 700;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 15px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
}

.live-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-family: var(--sans);
}

.live-state__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--offline);
}

.live-state[data-state="active"] .live-state__dot {
  background: var(--active);
}

.live-state[data-state="idle"] .live-state__dot {
  background: var(--idle);
}

.live-state[data-state="private"] .live-state__dot {
  background: var(--private);
}

.refresh {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.refresh:hover {
  background: var(--line);
  color: var(--ink);
}

.refresh:focus-visible,
.more:focus-visible,
.brand:focus-visible {
  outline: 2px solid var(--active);
  outline-offset: 3px;
}

.refresh svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.refresh.is-loading svg {
  animation: spin 900ms linear infinite;
}

main {
  flex: 1;
  padding: 42px 0 60px;
}

.notice {
  margin-bottom: 24px;
  padding: 10px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--error) 35%, var(--line));
  color: var(--error);
  font-size: 12px;
}

.timeline {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline::before {
  position: absolute;
  top: 7px;
  bottom: 7px;
  left: 120px;
  width: 1px;
  content: "";
  background: var(--line);
}

.timeline-day {
  position: relative;
  z-index: 1;
  margin: 0 0 20px;
  padding-left: 146px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.timeline-day:not(:first-child) {
  margin-top: 34px;
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 102px minmax(0, 1fr);
  gap: 46px;
  padding: 0 0 27px;
}

.timeline-item::before {
  position: absolute;
  top: 7px;
  left: 116px;
  z-index: 2;
  width: 7px;
  height: 7px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  content: "";
  background: var(--offline);
  box-shadow: 0 0 0 1px var(--line);
}

.timeline-item[data-status="active"]::before {
  background: var(--active);
}

.timeline-item[data-status="idle"]::before {
  background: var(--idle);
}

.timeline-item[data-status="private"]::before {
  background: var(--private);
}

.timeline-time {
  padding-top: 1px;
  text-align: right;
}

.timeline-time time {
  display: block;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.timeline-time span {
  display: block;
  margin-top: 1px;
  color: var(--faint);
  font-size: 10px;
}

.entry {
  min-width: 0;
  padding-bottom: 27px;
  border-bottom: 1px solid var(--line);
}

.timeline-item:last-child .entry {
  padding-bottom: 0;
  border-bottom: 0;
}

.entry-title {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 17px;
  font-weight: 650;
  line-height: 1.45;
}

.entry-apps {
  margin: 7px 0 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.entry-apps span[data-foreground="true"] {
  color: var(--ink);
  font-weight: 650;
}

.entry-meta {
  margin: 7px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 3px 12px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
}

.entry-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.entry-status::before {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  content: "";
  background: currentColor;
}

.entry-status[data-status="active"] {
  color: var(--active);
}

.entry-status[data-status="idle"] {
  color: var(--idle);
}

.entry-status[data-status="private"] {
  color: var(--private);
}

.timeline-empty {
  padding: 70px 0;
  color: var(--muted);
  text-align: center;
}

.skeleton {
  height: 80px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 72%, var(--line));
  animation: fade 900ms ease-in-out infinite alternate;
}

.more {
  display: block;
  min-height: 34px;
  margin: 32px auto 0;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
}

.more:hover {
  border-color: var(--muted);
  color: var(--ink);
}

.more:disabled {
  cursor: wait;
  opacity: 0.55;
}

.footer {
  min-height: 82px;
  display: grid;
  align-content: center;
  gap: 5px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
}

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

.footer__copyright {
  margin: 0;
  color: var(--faint);
  font-family: var(--sans);
  font-size: 10px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fade {
  from {
    opacity: 0.45;
  }
  to {
    opacity: 0.9;
  }
}

@media (max-width: 560px) {
  .page {
    width: min(100% - 28px, 720px);
  }

  .header {
    min-height: 62px;
  }

  .header-tools {
    gap: 10px;
  }

  main {
    padding-top: 30px;
  }

  .timeline::before {
    left: 6px;
  }

  .timeline-day {
    padding-left: 25px;
  }

  .timeline-item {
    grid-template-columns: 1fr;
    gap: 6px;
    padding-left: 25px;
  }

  .timeline-item::before {
    top: 4px;
    left: 2px;
  }

  .timeline-time {
    text-align: left;
  }

  .timeline-time time,
  .timeline-time span {
    display: inline;
  }

  .timeline-time time {
    margin-right: 7px;
  }

  .entry {
    padding-bottom: 24px;
  }

  .entry-title {
    font-size: 16px;
  }

  .entry-apps {
    font-size: 12px;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #151715;
    --ink: #eef0ed;
    --muted: #a1a7a1;
    --faint: #747a75;
    --line: #2c302c;
    --active: #72ca9e;
    --idle: #d7a75d;
    --private: #a6a0b3;
    --offline: #898d89;
    --error: #e18773;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
