:root {
  color-scheme: light dark;

  --bg-top: #e9edf5;
  --bg-bottom: #dfe4ee;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --faint: #9a9aa0;
  --tile-shadow: 0 10px 24px rgba(20, 24, 40, 0.16);
  --dot-up: #30a46c;
  --dot-down: #d4553e;
  --dot-unknown: #a0a0a8;
  --font-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue',
    'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans CJK SC', sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-top: #16161d;
    --bg-bottom: #0a0a0f;
    --text: #f5f5f7;
    --muted: #98989d;
    --faint: #6e6e73;
    --tile-shadow: 0 10px 26px rgba(0, 0, 0, 0.55);
    --dot-up: #46c17f;
    --dot-down: #ff6f5c;
    --dot-unknown: #6e6e73;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--text);
  font-family: var(--font-sans);
  /* A quiet wallpaper: the icons should be the only thing with colour. */
  background:
    radial-gradient(120% 80% at 50% 0%, var(--bg-top) 0%, var(--bg-bottom) 100%) fixed;
  -webkit-font-smoothing: antialiased;
}

.screen {
  max-width: 720px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 40px) 20px
    calc(env(safe-area-inset-bottom) + 32px);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen__head {
  text-align: center;
  margin-bottom: 36px;
}

.screen__head h1 {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.screen__summary {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  /* 4 across on a phone, like a home screen; widens on larger glass. */
  grid-template-columns: repeat(4, 1fr);
  gap: 26px 12px;
}

@media (min-width: 560px) {
  .grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 32px 16px;
  }
}

.tile__link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  /* Comfortably past the 44px minimum on every platform. */
  min-height: 96px;
  -webkit-tap-highlight-color: transparent;
}

.tile__icon {
  position: relative;
  display: block;
  width: 60px;
  height: 60px;
  border-radius: 15px;
  box-shadow: var(--tile-shadow);
  transition: transform 120ms ease;
}

.tile__icon img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
}

.tile__link:active .tile__icon {
  transform: scale(0.92);
}

.tile__dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2.5px solid var(--bg-bottom);
  background: var(--dot-unknown);
}

.tile__dot[data-state='up'] {
  background: var(--dot-up);
}

.tile__dot[data-state='down'] {
  background: var(--dot-down);
}

.tile__name {
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-align: center;
  line-height: 1.25;
}

/* The tagline is context for a first-time visitor; a home screen stays terse. */
.tile__tagline {
  display: none;
}

@media (min-width: 900px) {
  .tile__tagline {
    display: block;
    max-width: 15ch;
    color: var(--faint);
    font-size: 11px;
    line-height: 1.4;
    text-align: center;
  }
}

.screen__foot {
  margin-top: auto;
  padding-top: 48px;
  color: var(--faint);
  font-size: 11.5px;
  line-height: 1.6;
  text-align: center;
}

.screen__foot p {
  margin: 0;
}

a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
  border-radius: 18px;
}

@media (prefers-reduced-motion: reduce) {
  .tile__icon {
    transition: none;
  }
  .tile__link:active .tile__icon {
    transform: none;
  }
}
