@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@500;600;700&family=Inter:wght@400;500;600&display=swap');

:root {
  --bg: #0d0f1a;
  --surface: #151727;
  --card: #1c1f35;
  --card-hover: #242842;
  --accent: #7c3aed;
  --accent2: #a855f7;
  --text: #e8eaf6;
  --muted: #8b91b5;
  --border: #2a2d4a;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* ── NAV ── */
nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 200;
}
.logo {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  background: linear-gradient(135deg, #7c3aed, #a855f7, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  cursor: pointer;
  text-decoration: none;
}
.nav-links { display: flex; gap: 24px; list-style: none; }
.nav-links a { color: var(--muted); text-decoration: none; font-size: .875rem; font-weight: 500; transition: color .2s; }
.nav-links a:hover { color: var(--text); }
.search-bar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 14px;
  color: var(--text);
  font-size: .85rem;
  width: 200px;
  outline: none;
  transition: border-color .2s;
}
.search-bar:focus { border-color: var(--accent); }
.search-bar::placeholder { color: var(--muted); }

/* ── HERO ── */
.hero {
  background: linear-gradient(135deg, #0d0f1a 0%, #1a1040 50%, #0d0f1a 100%);
  padding: 60px 24px 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -50%; left: 50%;
  transform: translateX(-50%);
  width: 600px; height: 300px;
  background: radial-gradient(ellipse, #7c3aed22 0%, transparent 70%);
  pointer-events: none;
}
.hero h1 { font-family: 'Rajdhani', sans-serif; font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 700; line-height: 1.1; margin-bottom: 12px; }
.hero h1 span { background: linear-gradient(90deg, #a855f7, #ec4899); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero p { color: var(--muted); font-size: 1rem; margin-bottom: 28px; }
.hero-stats { display: flex; gap: 32px; justify-content: center; flex-wrap: wrap; }
.stat { text-align: center; }
.stat-num { font-family: 'Rajdhani', sans-serif; font-size: 1.8rem; font-weight: 700; color: var(--accent2); }
.stat-label { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

/* ── CATEGORIES ── */
.categories { padding: 24px; display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; }
.categories::-webkit-scrollbar { display: none; }
.cat-btn {
  background: var(--card); border: 1px solid var(--border); color: var(--muted);
  padding: 8px 18px; border-radius: 20px; font-size: .85rem; font-weight: 500;
  cursor: pointer; white-space: nowrap; transition: all .2s; font-family: 'Inter', sans-serif;
}
.cat-btn:hover, .cat-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── AD BANNER ── */
.ad-banner {
  margin: 0 24px 24px;
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: 12px;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: .8rem;
  overflow: hidden;
}
.ad-banner-top { margin: 16px 24px; }
.ad-sidebar {
  min-height: 250px;
  margin-bottom: 16px;
}

/* ── SECTION ── */
.section { padding: 0 24px 40px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-title { font-family: 'Rajdhani', sans-serif; font-size: 1.4rem; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.section-title::before { content: ''; width: 4px; height: 22px; background: linear-gradient(180deg, var(--accent), var(--accent2)); border-radius: 2px; display: inline-block; }

/* ── LAYOUT WITH SIDEBAR ── */
.content-with-sidebar {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
  padding: 0 24px 40px;
  align-items: start;
}
.sidebar { display: flex; flex-direction: column; }

/* ── GAMES GRID ── */
.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.game-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; cursor: pointer; transition: all .25s; text-decoration: none; display: block;
}
.game-card:hover { transform: translateY(-4px); box-shadow: 0 12px 30px #7c3aed25; border-color: var(--accent); }
.game-thumb { width: 100%; aspect-ratio: 4/3; display: flex; align-items: center; justify-content: center; font-size: 3rem; position: relative; overflow: hidden; }
.game-thumb::after {
  content: '▶ PLAY'; position: absolute; inset: 0; background: #0d0f1acc;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; letter-spacing: .1em; color: #fff;
  opacity: 0; transition: opacity .2s;
}
.game-card:hover .game-thumb::after { opacity: 1; }
.game-info { padding: 10px 12px 12px; }
.game-info h3 { font-size: .85rem; font-weight: 600; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-meta { display: flex; align-items: center; justify-content: space-between; }
.game-tag { font-size: .68rem; font-weight: 600; padding: 2px 7px; border-radius: 4px; text-transform: uppercase; letter-spacing: .04em; }
.tag-action { background: #ef444422; color: #ef4444; }
.tag-puzzle { background: #3b82f622; color: #60a5fa; }
.tag-sport  { background: #10b98122; color: #34d399; }
.tag-racing { background: #f59e0b22; color: #fbbf24; }
.tag-casual { background: #8b5cf622; color: #a78bfa; }
.game-stars { font-size: .7rem; color: #fbbf24; }

/* ── GAME PAGE ── */
.game-page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.back-btn {
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  padding: 7px 16px; border-radius: 8px; font-size: .85rem; font-weight: 600;
  cursor: pointer; font-family: 'Inter', sans-serif; text-decoration: none;
  transition: all .2s;
}
.back-btn:hover { border-color: var(--accent); color: var(--accent2); }
.game-page-title { font-family: 'Rajdhani', sans-serif; font-size: 1.4rem; font-weight: 700; }
.game-page-tag { font-size: .7rem; font-weight: 600; padding: 3px 10px; border-radius: 4px; text-transform: uppercase; }

.game-player-wrap {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
  padding: 24px;
  align-items: start;
}
.game-canvas-area {
  background: #111;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.game-score-bar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: var(--card);
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.game-canvas-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  min-height: 420px;
  position: relative;
}
canvas { display: block; max-width: 100%; }

.game-over-screen {
  display: none; position: absolute; inset: 0;
  background: rgba(0,0,0,.82); flex-direction: column;
  align-items: center; justify-content: center; gap: 16px; z-index: 10; border-radius: 12px;
}
.game-over-screen.show { display: flex; }
.game-over-screen h2 { font-family: 'Rajdhani', sans-serif; font-size: 2.5rem; color: #fff; }
.game-over-screen p { color: var(--muted); font-size: 1rem; }
.restart-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; border: none; padding: 12px 32px; border-radius: 10px;
  font-size: 1rem; font-weight: 700; cursor: pointer; font-family: 'Inter', sans-serif;
}

.mobile-controls { display: none; gap: 8px; padding: 12px; justify-content: center; flex-wrap: wrap; background: var(--card); width: 100%; border-top: 1px solid var(--border); }
.dpad { display: grid; grid-template-columns: repeat(3, 50px); grid-template-rows: repeat(3, 50px); gap: 4px; }
.dpad-btn {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 1.2rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  user-select: none; -webkit-user-select: none; transition: background .1s;
}
.dpad-btn:active { background: var(--accent); }

/* game info sidebar */
.game-info-sidebar { display: flex; flex-direction: column; gap: 16px; }
.game-info-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.game-info-card h3 { font-family: 'Rajdhani', sans-serif; font-size: 1.1rem; font-weight: 700; margin-bottom: 12px; color: var(--accent2); }
.game-info-card p { color: var(--muted); font-size: .875rem; line-height: 1.6; }
.controls-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.controls-list li { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .85rem; }
.key-badge { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px; font-size: .75rem; font-weight: 600; color: var(--text); white-space: nowrap; }

/* similar games */
.similar-games { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.similar-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px; display: flex; align-items: center; gap: 10px;
  cursor: pointer; text-decoration: none; transition: all .2s;
}
.similar-card:hover { border-color: var(--accent); }
.similar-card .s-icon { font-size: 1.8rem; }
.similar-card .s-name { font-size: .8rem; font-weight: 600; color: var(--text); }

/* ── FOOTER ── */
footer { background: var(--surface); border-top: 1px solid var(--border); padding: 32px 24px; margin-top: 20px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; max-width: 900px; margin-bottom: 24px; }
.footer-logo { font-family: 'Rajdhani', sans-serif; font-size: 1.4rem; font-weight: 700; background: linear-gradient(135deg, #7c3aed, #ec4899); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; margin-bottom: 10px; }
.footer-desc { color: var(--muted); font-size: .85rem; line-height: 1.6; }
.footer-col h4 { font-size: .85rem; font-weight: 600; margin-bottom: 14px; color: var(--text); text-transform: uppercase; letter-spacing: .05em; }
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer-col a { color: var(--muted); text-decoration: none; font-size: .85rem; transition: color .2s; }
.footer-col a:hover { color: var(--accent2); }
.footer-bottom { border-top: 1px solid var(--border); padding-top: 20px; color: var(--muted); font-size: .8rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .game-player-wrap { grid-template-columns: 1fr; }
  .content-with-sidebar { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .game-info-sidebar .ad-banner { display: none; }
}
@media (max-width: 768px) {
  .nav-links { display: none; }
  .footer-grid { grid-template-columns: 1fr; }
  .games-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .mobile-controls { display: flex; }
  .similar-games { grid-template-columns: 1fr; }
}
