:root {
  color-scheme: light dark;

  --background: #f5f5f2;
  --surface: #ffffff;
  --text: #17181a;
  --muted: #55575c;
  --border: #deded9;
  --accent: #0b5fff;
  --focus: #0b5fff;
  --shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 8px 24px rgb(0 0 0 / 4%);
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #131519;
    --surface: #1c1f25;
    --text: #f1f2f4;
    --muted: #a4a8b1;
    --border: #2c3037;
    --accent: #7ba7ff;
    --focus: #7ba7ff;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 8px 24px rgb(0 0 0 / 25%);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 1.5rem 1.15rem 2.5rem;
  background: var(--background);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

main,
footer {
  max-width: 62rem;
  margin: 0 auto;
}

.intro h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.9rem, 6vw, 2.6rem);
  letter-spacing: -0.02em;
}

.tagline {
  max-width: 38rem;
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.games {
  display: grid;
  gap: 1rem;
  margin: 1.75rem 0 0;
  padding: 0;
  list-style: none;
}

/* Cards are a single column on narrow screens; the auto-fit grid takes over
   as soon as two readable columns fit, without a separate breakpoint. */
@media (min-width: 40rem) {
  .games {
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  }
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  padding: 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.icon {
  width: 3rem;
  height: 3rem;
  margin-bottom: 0.15rem;
  object-fit: contain;
}

.card-title {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.25;
}

.play {
  color: var(--text);
  text-decoration: none;
}

.play:hover {
  color: var(--accent);
}

/* Stretched-link pattern: the ::after covers the whole card, so the play link
   is reachable anywhere on the card while links cannot be nested. */
.play::after {
  content: "";
  position: absolute;
  inset: 0;
}

/* The Source link has to sit above the stretched ::after to stay clickable. */
.source {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin: auto 0 0 -0.55rem;
  padding: 0 0.55rem;
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
  border-radius: 6px;
}

.source:hover {
  color: var(--accent);
  text-decoration: underline;
}

.play:focus-visible {
  outline: none;
}

/* Outline the stretched area rather than the heading text, since that is what
   the link actually covers. The radius is only set here so the unfocused
   ::after keeps square corners for hit testing. */
.play:focus-visible::after,
.source:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.play:focus-visible::after {
  border-radius: var(--radius);
}

footer {
  margin-top: 2.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

footer p {
  margin: 0;
}

footer a {
  color: var(--muted);
}

footer a:hover {
  color: var(--accent);
}
