@font-face {
  font-family: "Fira Code";
  src: url("fonts/FiraCode-VF.woff2") format("woff2") tech("variations"),
       url("fonts/FiraCode-VF.woff2") format("woff2-variations");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #fff;
  --fg: #000;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000;
    --fg: #fff;
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Fira Code", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  min-height: 100dvh;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

.dim {
  opacity: 0.4;
}

/* ---- clock grid ---- */

#grid {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(24rem, 100%), 1fr));
  gap: 1.5rem;
  /* rows stretch to fill the viewport; each cell centres its own content, so
     spare height becomes even framing rather than dead bands top and bottom */
  justify-items: center;
  padding: 1.5rem;
}

#grid[hidden] {
  display: none;
}

.cell {
  width: 100%;
  container-type: inline-size;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.cell .time {
  display: block;
  font-size: min(15cqi, 24vh);
  font-weight: 450;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.cell .date {
  font-size: clamp(0.8rem, 3.2cqi, 1.4rem);
  margin-top: 0.4em;
}

.cell .meta {
  font-size: clamp(0.65rem, 2.4cqi, 1rem);
  margin-top: 0.5em;
}

/* ---- game ---- */

#game {
  min-height: 100dvh;
  display: grid;
  place-content: center;
  gap: 1rem;
  text-align: center;
  padding: 1.5rem;
  cursor: pointer;
}

#game[hidden] {
  display: none;
}

#game .big {
  font-size: clamp(1.4rem, 6vw, 3.5rem);
  font-variant-numeric: tabular-nums;
}

#game .small {
  font-size: clamp(0.75rem, 2.2vw, 1rem);
}

#game .mark {
  font-size: clamp(2rem, 10vw, 5rem);
}

.esc {
  position: fixed;
  top: 1rem;
  left: 1rem;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  font-size: 0.8rem;
  opacity: 0.35;
  cursor: pointer;
}

/* ---- misc ---- */

.noscript {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  background: var(--bg);
  padding: 1.5rem;
  text-align: center;
}
