:root {
  --bg: #0f1220;
  --bg-soft: #171b2e;
  --card: #1d2238;
  --card-hover: #262c47;
  --text: #e8eaf2;
  --muted: #9aa0bd;
  --accent: #6c8cff;
  --accent-2: #23d5ab;
  --danger: #ff5d6c;
  --border: #2a3050;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 600px at 70% -10%, #1a2145 0%, var(--bg) 55%);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(15, 18, 32, 0.8);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 0.3px;
  color: var(--text);
}
.brand .logo {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 9px;
  font-size: 18px;
}
.nav a {
  color: var(--muted);
  margin-left: 20px;
  font-weight: 600;
  font-size: 0.95rem;
}
.nav a:hover { color: var(--text); }

/* Hero */
.hero {
  text-align: center;
  padding: 54px 20px 30px;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  margin: 0 0 12px;
  background: linear-gradient(120deg, #fff, #a9b6ff 60%, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p { color: var(--muted); font-size: 1.1rem; margin: 0 auto; max-width: 620px; }

/* Games grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 20px;
  padding: 20px 0 40px;
}
.game-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
  box-shadow: var(--shadow);
}
.game-card:hover {
  transform: translateY(-4px);
  background: var(--card-hover);
  border-color: var(--accent);
}
.game-card .emoji { font-size: 2.6rem; display: block; margin-bottom: 12px; }
.game-card h3 { margin: 0 0 6px; color: var(--text); font-size: 1.15rem; }
.game-card p { margin: 0; color: var(--muted); font-size: 0.9rem; }

/* Ads */
.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-linear-gradient(45deg, #161a2c, #161a2c 10px, #191d31 10px, #191d31 20px);
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  overflow: hidden;
}
.ad-leaderboard { min-height: 90px; margin: 20px 0; }
.ad-rect { min-height: 250px; width: 300px; margin: 0 auto; }
.ad-sidebar { min-height: 600px; width: 160px; }

/* House / fallback banners (shown while real ads are disabled) */
.ad-slot.has-house-ad {
  border-style: solid;
  border-color: var(--border);
  background: linear-gradient(135deg, rgba(108,140,255,0.10), rgba(35,213,171,0.08));
}
.house-ad {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  height: 100%;
  min-height: inherit;
  padding: 14px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.4;
}
.house-ad:hover { color: var(--accent-2); }
.ad-sidebar .house-ad { writing-mode: initial; }

/* Game page layout */
.game-layout {
  display: grid;
  grid-template-columns: 160px 1fr 160px;
  gap: 24px;
  padding: 24px 0 40px;
  align-items: start;
}
.game-main {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.game-main h1 { margin: 0 0 4px; }
.game-sub { color: var(--muted); margin: 0 0 18px; font-size: 0.95rem; }
.game-stage { display: flex; flex-direction: column; align-items: center; gap: 16px; }

.hud {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 6px;
}
.hud .pill {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 700;
  font-size: 0.95rem;
}
.hud .pill span { color: var(--muted); font-weight: 600; margin-right: 6px; }

.btn {
  cursor: pointer;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-weight: 700;
  font-size: 0.95rem;
  background: linear-gradient(135deg, var(--accent), #7b6cff);
  color: white;
  transition: filter 0.15s ease, transform 0.1s ease;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: scale(0.97); }
.btn.secondary { background: var(--bg-soft); border: 1px solid var(--border); color: var(--text); }

canvas { background: #0b0e1a; border-radius: 10px; touch-action: none; max-width: 100%; }

.back-link { display: inline-block; margin-bottom: 6px; color: var(--muted); font-weight: 600; }

.msg {
  min-height: 24px;
  font-weight: 700;
  text-align: center;
  color: var(--accent-2);
}

/* Written content / articles */
.game-article {
  max-width: 760px;
  margin: 4px auto 0;
  padding: 10px 4px 24px;
}
.game-article h2 {
  font-size: 1.3rem;
  margin: 30px 0 10px;
  color: var(--text);
}
.game-article h2:first-child { margin-top: 8px; }
.game-article p { color: var(--muted); line-height: 1.75; margin: 0 0 14px; }
.game-article ul { color: var(--muted); line-height: 1.75; padding-left: 20px; margin: 0 0 16px; }
.game-article li { margin-bottom: 7px; }
.game-article strong { color: var(--text); }
.game-article .faq-q { color: var(--text); font-weight: 700; margin-bottom: 4px; }

/* Footer nav links */
.site-footer .footer-nav { margin-top: 6px; }
.site-footer .footer-nav a { margin: 0 6px; color: var(--muted); font-weight: 600; }
.site-footer .footer-nav a:hover { color: var(--accent-2); }

/* Share button + toast */
.share-btn { margin-top: 2px; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

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

@media (max-width: 900px) {
  .game-layout { grid-template-columns: 1fr; }
  .ad-sidebar { display: none; }
}
