:root {
  --bg: #0b0c10;
  --bg-raised: #14161c;
  --border: #262a35;
  --text: #e8e6e1;
  --muted: #8a8f9e;
  --accent: #ff4d7e;
  --accent-dim: #b23a5c;
  --accent2: #4ee08a;
  --gold: #f4c430;
  --radius: 10px;
  --font-display: "Courier New", ui-monospace, Menlo, monospace;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

html, body {
  min-height: 100%;
  background: radial-gradient(ellipse at top, #161821 0%, #0b0c10 65%);
  color: var(--text);
  font-family: var(--font-body);
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

img { max-width: 100%; display: block; }

/* Site header, shared across pages */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
  flex-wrap: wrap;
}

.site-logo {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 1px;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
}

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

.discord-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #17070c;
  font-weight: 700;
  padding: 9px 16px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.9rem;
  transition: transform 0.1s ease, background 0.15s ease;
}

.discord-cta:hover {
  background: #ff6b93;
  color: #17070c;
  transform: translateY(-1px);
}

/* Homepage hero */
.hero {
  padding: 56px 24px 32px;
  text-align: center;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  letter-spacing: 1px;
  color: var(--text);
  text-shadow: 0 0 24px rgba(255, 77, 126, 0.25);
  max-width: 900px;
  margin: 0 auto 10px;
}

.hero .subline {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 560px;
  margin: 0 auto;
}

main { flex: 1; }

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  padding: 8px 24px 48px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-dim);
}

.card .thumb {
  aspect-ratio: 16 / 9;
  width: 100%;
  object-fit: cover;
  background: #000;
  border-bottom: 1px solid var(--border);
}

.card .card-body { padding: 14px 16px 16px; }

.card h2 {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.3px;
  margin-bottom: 6px;
}

.card p {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.card .credit {
  display: block;
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--muted);
}

/* Game page */
.game-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 24px 56px;
  width: 100%;
}

.back-link {
  display: inline-block;
  margin-bottom: 18px;
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
}

.back-link:hover { color: var(--accent2); }

/* itch.io games: the widget already shows its own title/cover art nicely, so
   our heading stays screen-reader/SEO-only there (see .sr-only below).
   Self-hosted games: their own in-frame title is now stripped (see each
   play/index.html's embed-only CSS), so OUR heading is the one visible title,
   sitting outside the frame rather than duplicating it. */
.game-page h1 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.game-page .tagline {
  color: var(--muted);
  margin-bottom: 18px;
}

/* Kept for screen readers/SEO/page <title> consistency, not visually shown. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.game-page .credit-line {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 14px;
}

.game-page .credit-line a { font-weight: 600; }

/* No border/background here on purpose: a self-hosted game's own HTML now
   provides its complete visual framing (border, background, padding) filling
   its page edge-to-edge, so this wrapper just needs to be the right size and
   otherwise invisible — a second border here would double up as a frame
   around a frame. Sizing comes from game-frame.js, which reads each game's
   native width/height from games.js and applies it as aspect-ratio, so this
   rule is the same for every hosted game rather than a per-page guess. */
.frame-wrap {
  overflow: hidden;
  margin: 0 auto;
  position: relative;
}

.frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* itch.io games use itch's official external-embed widget (cover art + "Play
   on itch.io" link) rather than a full playable frame — itch.io's game builds
   detect non-itch.io parent domains and refuse to run when framed directly,
   so a fixed-height card is the correct shape here, not the 16:10 play area. */
.frame-wrap.widget-frame {
  height: 175px;
  max-height: none;
  overflow: hidden;
  background: #fff;
}

.frame-wrap.widget-frame iframe {
  height: 100%;
}

.fallback {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 24px;
  background: var(--bg-raised);
}

.fallback.visible { display: flex; }

.fallback p { color: var(--muted); max-width: 420px; }

.btn {
  display: inline-block;
  background: var(--accent2);
  color: #06170e;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.9rem;
}

.btn:hover { background: #6cf0a2; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 22px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

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

@media (max-width: 480px) {
  .hero { padding: 40px 16px 24px; }
  .grid { padding: 8px 16px 40px; gap: 14px; }
}
