* {
  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;
}

/* ── 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;
}

@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; }
}
