:root {
  --background: #111;
  --tile: #1d1d1d;
  --text: #f4f4f4;
  --muted: #999;
  --gap: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--background);
  color: var(--text);
  font-family: system-ui, sans-serif;
}

body {
  display: flex;
  justify-content: center;
}

.app {
  width: min(100vw, 700px);
  padding: 18px;
}

header {
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

h1 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: .18em;
}

#clock {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

#status {
  font-size: clamp(1.6rem, 6vw, 3rem);
}

.grid {
  display: grid;
  gap: var(--gap);
  width: 100%;
  height: calc(100dvh - 90px);
}

.grid[data-count="1"] {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}

.grid[data-count="2"] {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: 1fr;
}

.grid[data-count="3"],
.grid[data-count="4"] {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.grid[data-count="5"],
.grid[data-count="6"] {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.grid[data-count="7"],
.grid[data-count="8"],
.grid[data-count="9"] {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
}


/* Allow important components to occupy more space. */
.tile--wide {
  grid-column: span 2;
}

.tile--tall {
  grid-row: span 2;
}

.tile--large {
  grid-column: span 2;
  grid-row: span 2;
}

.tile {
  min-width: 0;
  min-height: 0;
  
  padding: 16px;

  display: flex;
  flex-direction: column;

  background: var(--tile);
  color: inherit;
  text-decoration: none;

  border-radius: 4px;
}

.tile-title {
  color: var(--muted);
  font-size: .75rem;
  letter-spacing: .12em;
}

.tile-value {
  margin: auto;
  font-size: 3rem;
  font-weight: 300;
}

.tile-detail {
  color: var(--muted);
  font-size: .8rem;
}

.speed {
  margin: auto 0;
}

.speed strong {
  display: block;
  font-size: clamp(2.5rem, 12vw, 4rem);
  line-height: .9;
  font-weight: 300;
}

.speed small {
  color: var(--muted);
}


.back {
  color: var(--muted);
  text-decoration: none;
  font-size: .8rem;
  letter-spacing: .1em;
}

.page-title {
  font-size: .8rem;
  letter-spacing: .12em;
}

.metric {
  margin: auto 0;
}

.metric strong {
  display: block;
  font-size: clamp(2rem, 10vw, 3.5rem);
  line-height: .95;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
}

.metric small {
  color: var(--muted);
}
