:root {
  color-scheme: dark;
  --background: #0d0e12;
  --surface: #15171d;
  --surface-raised: #1c1f27;
  --border: #303440;
  --text: #f1f2f5;
  --muted: #a2a7b3;
  --accent: #ffca4b;
  --accent-dark: #1b1608;
  --danger: #ff7676;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--background);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 75% -20%, rgba(255, 202, 75, 0.08), transparent 38rem),
    var(--background);
}

a {
  color: inherit;
}

.site-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  width: min(72rem, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
}

.site-header.compact {
  padding-block: 1.25rem;
}

.brand {
  color: var(--accent);
  font-family: "Courier New", monospace;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  line-height: 1;
  text-decoration: none;
}

.site-header p {
  margin: 0;
  color: var(--muted);
  font-family: "Courier New", monospace;
  font-size: 0.8rem;
}

.page {
  width: min(72rem, calc(100% - 2rem));
  margin: 0 auto;
}

.home-page {
  padding: 4rem 0 5rem;
}

.intro {
  max-width: 42rem;
  margin-bottom: 4rem;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.7rem;
  font-size: clamp(2rem, 6vw, 4rem);
  letter-spacing: -0.04em;
  line-height: 1.02;
}

.intro p,
.game-card p,
.game-heading p,
.player-help {
  color: var(--muted);
  line-height: 1.6;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.section-heading h2 {
  margin-bottom: 0.75rem;
  font-family: "Courier New", monospace;
  text-transform: uppercase;
}

.section-heading span {
  color: var(--muted);
  font-size: 0.8rem;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  gap: 1.25rem;
}

.game-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
}

.game-cover {
  display: grid;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  place-items: center;
  border-bottom: 1px solid var(--border);
  background: #07080a;
}

.game-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.game-cover.placeholder {
  color: #606572;
  font-family: "Courier New", monospace;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.15em;
}

.game-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  padding: 1.25rem;
}

.game-card h3 {
  margin-bottom: 0.5rem;
  font-size: 1.15rem;
}

.game-card p {
  flex: 1;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.65rem;
  padding: 0.65rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 0;
  color: var(--accent-dark);
  background: var(--accent);
  font: 800 0.78rem/1 "Courier New", monospace;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
}

.button:hover,
.button:focus-visible {
  filter: brightness(1.12);
}

.button.secondary {
  color: var(--text);
  background: transparent;
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.status {
  grid-column: 1 / -1;
  min-height: 12rem;
  padding: 3rem;
  border: 1px dashed var(--border);
  color: var(--muted);
  text-align: center;
}

.status.error,
.player-status.error {
  color: var(--danger);
}

.site-footer {
  width: min(72rem, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 2rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.75rem;
}

.game-page {
  padding: 2rem 0 4rem;
}

.back-link {
  display: inline-block;
  margin-bottom: 2rem;
  color: var(--muted);
  text-underline-offset: 0.2em;
}

.game-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 1.25rem;
}

.game-heading h1 {
  margin-bottom: 0.35rem;
  font-size: clamp(1.7rem, 5vw, 2.8rem);
}

.game-heading p {
  margin-bottom: 0;
}

.game-frame {
  display: grid;
  width: min(100%, var(--game-max-width, 800px));
  aspect-ratio: var(--game-aspect, 4 / 3);
  overflow: hidden;
  place-items: center;
  margin-inline: auto;
  border: 1px solid #3c414e;
  outline: 1px solid #050505;
  background: #000;
  box-shadow: 0 1rem 4rem rgba(0, 0, 0, 0.45);
  overscroll-behavior: contain;
}

.game-frame:fullscreen {
  width: 100vw;
  height: 100vh;
  border: 0;
  outline: 0;
  background: #000;
}

#ruffle-player {
  display: block;
  width: 100%;
  height: 100%;
  outline: 0;
}

.player-status {
  padding: 2rem;
  color: var(--muted);
  text-align: center;
}

.player-help {
  margin: 0.9rem auto 0;
  font-size: 0.8rem;
  text-align: center;
}

.error-page {
  padding: 6rem 0;
}

.eyebrow {
  margin-bottom: 0.5rem;
  color: var(--accent);
  font-family: "Courier New", monospace;
}

@media (max-width: 40rem) {
  .site-header {
    padding-top: 1.5rem;
  }

  .home-page {
    padding-top: 2.75rem;
  }

  .intro {
    margin-bottom: 2.75rem;
  }

  .game-heading {
    align-items: stretch;
    flex-direction: column;
    gap: 1rem;
  }

  .game-heading .button {
    width: 100%;
  }
}
