* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: #111;
  color: #eee;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
}

.app {
  min-height: 100vh;
  padding: 48px 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.app__main {
  flex: 1;
  width: 100%;
}

/* ── Library ─────────────────────────────────────────────── */

.library {
  max-width: 1120px;
  margin: 0 auto;
}

.library .grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
}

.game-card {
  background: #1b1b1f;
  border: 1px solid #2a2a30;
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  color: inherit;
  font: inherit;
  text-align: left;
  transition: background-color 120ms, border-color 120ms;
}

.game-card:hover {
  background: #202026;
  border-color: #555;
}

.game-thumb {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  background: #000;
  image-rendering: pixelated;
}

.game-card__title {
  margin-top: 12px;
  font-size: 18px;
  font-weight: 600;
}

.game-card__meta {
  margin-top: 4px;
  font-size: 13px;
  opacity: 0.55;
}

/* ── Game page ───────────────────────────────────────────── */

.game-page {
  max-width: 800px;
  margin: 0 auto;
}

.back {
  background: transparent;
  border: 1px solid #333;
  color: #ccc;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
}

.back:hover {
  border-color: #666;
  color: #fff;
}

.game-title {
  margin: 16px 0 20px;
  font-size: 24px;
  font-weight: 600;
}

.game-screen-wrap {
  position: relative;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
}

.game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  outline: none;
}

.game-status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aaa;
  font-size: 14px;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.5);
}

.game-status.hidden {
  display: none;
}

/* Site footer */

.site-footer {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  color: #8d8d94;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.powered-by {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px 10px;
}

.powered-by__label,
.powered-by__separator {
  opacity: 0.72;
}

.build-crate {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  white-space: nowrap;
}

.build-crate__name {
  color: #d7d7dc;
  font-weight: 600;
  text-decoration: none;
}

.build-crate__name:hover {
  color: #fff;
  text-decoration: underline;
}

.build-crate__version {
  color: #a9a9b0;
}

.build-crate__sha {
  color: #c6d7ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-decoration: none;
}

.build-crate__sha:hover {
  color: #fff;
  text-decoration: underline;
}

.build-crate__sha--unknown {
  color: #777;
}

.site-footer__disclaimer {
  max-width: 640px;
  margin: 8px auto 0;
  color: #76767d;
}

@media (max-width: 1120px) {
  .library { max-width: 840px; }
  .library .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .library { max-width: 540px; }
  .library .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .app { padding: 24px 16px; }
  .library .grid { grid-template-columns: 1fr; }
  .site-footer { text-align: left; }
  .powered-by { justify-content: flex-start; }
  .site-footer__disclaimer { margin-left: 0; }
}
