/* ==========================================================
   NOW PLAYABLE — shared shell styles.
   Home = one trending game + a grid of the rest.
   Game page = slim header, big playable stage, how-to, more games.
   Per-game accent color is injected via --accent on <html>.
   ========================================================== */

:root {
  --bg: #ffffff;
  --ink: #111111;
  --muted: #6b6b6b;
  --line: #e8e8e8;
  --accent: #ff3b30;                 /* overridden per-game */
  --sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --maxw: 960px;
}

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

html, body { height: 100%; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

a { color: inherit; text-decoration: none; }

.wrap { width: min(var(--maxw), 100% - 40px); margin-inline: auto; }

/* ---------- header ---------- */

.site-header { padding: 22px 0 8px; }

.header-inner {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}

.wordmark { font-weight: 800; font-size: 24px; letter-spacing: -0.6px; }
.wordmark em { font-style: normal; color: var(--accent); }
.tagline { color: var(--muted); font-size: 15px; }

/* ---------- trending game (hero) ---------- */

.hero { padding: 24px 0 40px; }

.trending-label {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 800; letter-spacing: 2px;
  text-transform: uppercase; color: var(--accent); margin-bottom: 14px;
}

.trending-label .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }

.hero-card {
  display: block; border: 2px solid var(--ink);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.hero-card:hover, .hero-card:focus-visible {
  transform: translate(-3px, -3px); box-shadow: 6px 6px 0 var(--accent);
}

.hero-art, .card-art {
  position: relative; overflow: hidden;
  background: var(--art, linear-gradient(180deg, #dfe4ec 0%, #c8d0dc 46%, #a7b39c 47%, #93a28a 100%));
  background-size: cover; background-position: center;
}
.hero-art { aspect-ratio: 16 / 8; }

.hero-body { padding: 22px 24px 26px; }
.hero-body h1 {
  font-size: clamp(32px, 5.5vw, 52px); font-weight: 800;
  letter-spacing: -1.2px; line-height: 1.05;
}
.hero-body p { color: var(--muted); font-size: 18px; margin-top: 8px; max-width: 640px; }

.btn-play {
  display: inline-block; margin-top: 18px; background: var(--accent);
  color: #fff; font-weight: 800; font-size: 18px; letter-spacing: 0.5px;
  padding: 15px 36px; transition: filter 0.12s ease;
}
.hero-card:hover .btn-play { filter: brightness(1.08); }

/* ---------- game grid ---------- */

.section { padding: 8px 0 24px; }

.section h2 {
  font-size: 15px; font-weight: 800; letter-spacing: 2px;
  text-transform: uppercase; color: var(--muted);
  padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 22px;
}

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 22px; }

.card {
  display: block; border: 1px solid var(--line);
  transition: transform 0.14s ease, border-color 0.14s ease;
}
.card:hover, .card:focus-visible { transform: translateY(-3px); border-color: var(--ink); }
.card-art { aspect-ratio: 16 / 9; }
.card-body { padding: 14px 16px 18px; }
.card-body h3 { font-size: 19px; font-weight: 800; letter-spacing: -0.4px; line-height: 1.2; }
.card-body p { color: var(--muted); font-size: 14.5px; margin-top: 5px; }
.card .kicker {
  display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--accent); margin-bottom: 6px;
}

.card.empty { border-style: dashed; pointer-events: none; }
.card.empty .card-art {
  aspect-ratio: 16 / 9; background: #fafafa; display: flex; align-items: center;
  justify-content: center; color: #c4c4c4; font-weight: 700; letter-spacing: 1px;
}
.card.empty h3 { color: #c4c4c4; }

/* ---------- game page ---------- */

.game-main { flex: 1; display: flex; flex-direction: column; }

.game-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.game-topbar .back {
  font-weight: 800; font-size: 14px; color: var(--accent);
  display: inline-flex; align-items: center; gap: 6px;
}
.game-topbar .back:hover { text-decoration: underline; }

.game-head { padding: 18px 0 14px; }
.game-head .kicker {
  font-size: 12px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase;
  color: var(--accent);
}
.game-head h1 {
  font-size: clamp(28px, 5.5vw, 44px); font-weight: 800;
  letter-spacing: -1.1px; line-height: 1.05; margin-top: 6px;
}
.game-head p { color: var(--muted); font-size: 17px; margin-top: 8px; max-width: 640px; }

/* the playable stage: big, responsive, capped so it never dwarfs the page */
.game-stage {
  position: relative; width: 100%;
  height: min(78vh, 900px);
  background: #111; overflow: hidden; border: 2px solid var(--ink);
}
.game-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }

.stage-loader {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #9a9a9a; font-size: 14px; z-index: 1;
}
.stage-loader .spin {
  width: 34px; height: 34px; border: 3px solid #333; border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.stage-tools { display: flex; justify-content: flex-end; padding: 10px 0; }
.stage-tools button {
  font-family: var(--sans); font-size: 13px; font-weight: 700; color: var(--muted);
  background: none; border: 1px solid var(--line); padding: 7px 14px; cursor: pointer;
  transition: border-color 0.12s ease, color 0.12s ease;
}
.stage-tools button:hover { border-color: var(--ink); color: var(--ink); }

.howto {
  border-left: 3px solid var(--accent); padding: 4px 0 4px 16px;
  margin: 8px 0 30px; color: var(--muted); font-size: 16px; max-width: 640px;
}
.howto b { color: var(--ink); display: block; font-size: 13px; letter-spacing: 1px;
  text-transform: uppercase; margin-bottom: 4px; }

/* ---------- ad / monetization slot ---------- */
.ad-slot {
  margin: 8px 0 34px; min-height: 90px; display: flex; align-items: center;
  justify-content: center; border: 1px dashed var(--line); color: #c4c4c4;
  font-size: 12px; letter-spacing: 1px; text-transform: uppercase;
}
.ad-slot:empty::before { content: "ad"; }

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--line); padding: 24px 0 34px;
  color: var(--muted); font-size: 13.5px; margin-top: auto;
}

/* ---------- a11y / motion / mobile ---------- */

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .trending-label .dot { animation: none; }
  .hero-card, .card { transition: none; }
}

@media (max-width: 640px) {
  .wrap { width: min(var(--maxw), 100% - 24px); }
  .hero { padding: 16px 0 30px; }
  .hero-body { padding: 18px 18px 22px; }
  .btn-play { display: block; text-align: center; }
  /* game gets nearly the whole screen on mobile */
  .game-stage { height: min(82vh, 720px); }
}
