/* ---------- AO Games theme ---------- */
:root {
  --bg: #12111a;
  --bg-2: #1b1a26;
  --bg-3: #252433;
  --line: #2f2e40;
  --text: #ecebf5;
  --muted: #9d9bb3;
  --accent: #f97316;      /* AO Orange (light), from analyticsonline.in brand tokens */
  --ao-primary: #ea580c;  /* AO Orange (signature) */
  --ao-grad: linear-gradient(135deg, #ff7a00 0%, #ea580c 100%);
  --ao-font-heading: 'Outfit', system-ui, sans-serif;
  --accent-2: #8b5cf6;    /* violet */
  --good: #22c55e;
  --radius: 14px;
  --topbar: 60px;
  --sidebar: 220px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-size: 15px; line-height: 1.55; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50; height: var(--topbar);
  display: flex; align-items: center; gap: 14px; padding: 0 16px;
  background: rgba(18, 17, 26, .92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
/* AnalyticsOnline logo (same as analyticsonline.in / AOChat): AO badge + wordmark + product label */
.ao-logo-icon { position: relative; width: 38px; height: 38px; flex: none; border-radius: 11px; background: var(--ao-grad);
  display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 14px rgba(234, 88, 12, .32); }
.ao-logo-icon::after { content: ""; position: absolute; inset: 1px; border-radius: 10px; border: 1px solid rgba(255,255,255,.3); pointer-events: none; }
.ao-logo-icon span { color: #fff; font: 900 15px/1 var(--ao-font-heading); }
.ao-logo-words { display: flex; flex-direction: column; line-height: 1.15; }
.ao-logo-text { font: 900 1.3rem/1.1 var(--ao-font-heading); letter-spacing: -.03em; color: #fff; }
.ao-logo-text .accent { color: var(--accent); }
.ao-logo-sub { font: 800 .62rem/1.2 var(--ao-font-heading); letter-spacing: .32em; color: var(--accent); margin-top: 1px; }
.icon-btn { background: none; border: 0; font-size: 22px; padding: 6px 8px; border-radius: 10px; }
.icon-btn:hover { background: var(--bg-3); }
.menu-toggle { display: none; }
.search { flex: 1; max-width: 520px; margin-left: auto; display: flex; background: var(--bg-3); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.search:focus-within { border-color: var(--accent); }
.search input { flex: 1; min-width: 0; background: none; border: 0; color: var(--text); padding: 10px 16px; font: inherit; outline: none; }
.search button { background: none; border: 0; padding: 0 14px; }

/* ---------- Shell / sidebar ---------- */
.shell { display: flex; }
.sidebar {
  position: sticky; top: var(--topbar); height: calc(100vh - var(--topbar)); width: var(--sidebar);
  flex: none; overflow-y: auto; padding: 12px 10px 40px; border-right: 1px solid var(--line);
  scrollbar-width: thin;
}
.nav-link { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 10px; color: var(--muted); font-weight: 500; }
.nav-link span { width: 22px; text-align: center; }
.nav-link:hover { background: var(--bg-3); color: var(--text); }
.nav-link.is-active { background: var(--bg-3); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.nav-sep { height: 1px; background: var(--line); margin: 10px 6px; }
.backdrop { display: none; }
.main { flex: 1; min-width: 0; padding: 20px 24px 0; }

/* ---------- Cards & grids ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.grid-scroll { grid-auto-flow: column; grid-auto-columns: minmax(170px, 200px); grid-template-columns: none; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; scrollbar-width: thin; }
.grid-scroll > * { scroll-snap-align: start; }
.card { display: block; border-radius: var(--radius); overflow: hidden; background: var(--bg-2); transition: transform .15s ease, box-shadow .15s ease; }
.card:hover { transform: translateY(-3px) scale(1.02); box-shadow: 0 10px 24px rgba(0,0,0,.45), 0 0 0 2px var(--accent); }
.thumb { position: relative; display: block; aspect-ratio: 4 / 3; background: var(--bg-3); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-title { display: block; padding: 8px 10px 10px; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { position: absolute; top: 8px; left: 8px; font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 6px; }
.badge-new { background: var(--good); color: #052e12; }
.badge-hot { left: auto; right: 8px; background: var(--accent); color: #2a1200; }

.row { margin: 26px 0; }
.row-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.row-head h2 { font-size: 20px; margin: 0; }
.see-all { color: var(--accent); font-weight: 600; font-size: 14px; white-space: nowrap; }
.linklike { background: none; border: 0; padding: 0; }

/* ---------- Home hero ---------- */
.hero-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; grid-template-rows: repeat(2, 1fr); gap: 14px; }
.hero-card { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--bg-3); aspect-ratio: 4 / 3; }
.hero-main { grid-row: span 2; aspect-ratio: auto; }
.hero-card img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.hero-card:hover img { transform: scale(1.05); }
.hero-info { position: absolute; inset: auto 0 0 0; padding: 30px 14px 12px; background: linear-gradient(transparent, rgba(0,0,0,.85)); display: flex; flex-direction: column; }
.hero-main .hero-info strong { font-size: 24px; }
.hero-info small { color: #ffcf9e; font-weight: 600; }

/* ---------- Chips / tabs ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.chip { padding: 6px 12px; border-radius: 999px; background: var(--bg-3); border: 1px solid var(--line); font-size: 13.5px; font-weight: 500; }
.chip small { color: var(--muted); margin-left: 4px; }
.chip:hover { border-color: var(--accent); }
.chip-cat { background: var(--accent); color: #2a1200; border-color: var(--accent); font-weight: 700; }
.chips-lg .chip { font-size: 15px; padding: 8px 14px; }
.tabs { display: flex; gap: 8px; margin-top: 12px; }
.tab { padding: 7px 14px; border-radius: 999px; background: var(--bg-3); font-weight: 600; font-size: 14px; color: var(--muted); }
.tab.on { background: var(--text); color: var(--bg); }

/* ---------- Page heads, crumbs, pagination ---------- */
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs a:hover { color: var(--text); }
.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 28px; margin: 0; }
.lead { color: var(--muted); margin: 6px 0 0; }
.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 28px 0; }
.pagination a, .pagination span { min-width: 40px; text-align: center; padding: 8px 12px; border-radius: 10px; background: var(--bg-2); }
.pagination a:hover { background: var(--bg-3); }
.pagination .current { background: var(--accent); color: #2a1200; font-weight: 700; }

/* ---------- Game page ---------- */
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; }
.player { position: relative; width: 100%; aspect-ratio: var(--ratio, 16 / 10); max-height: calc(100vh - var(--topbar) - 120px); background: #000; border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player-cover { position: absolute; inset: 0; background-size: cover; background-position: center; }
.player-cover::before { content: ""; position: absolute; inset: 0; backdrop-filter: blur(24px) brightness(.45); }
.player-cover-inner { position: relative; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 16px; }
.player-cover-inner img { width: 160px; height: auto; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,.6); }
.player-cover-inner h1 { font-size: 26px; margin: 0; text-shadow: 0 2px 10px rgba(0,0,0,.6); }
.play-btn { display: inline-block; border: 0; border-radius: 999px; padding: 13px 34px; font-size: 18px; font-weight: 800; color: #fff; background: var(--ao-grad); box-shadow: 0 6px 20px rgba(234,88,12,.42); transition: transform .12s ease; }
.play-btn:hover { transform: scale(1.06); }
.player:fullscreen { max-height: none; border-radius: 0; }
.game-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 10px 14px; background: var(--bg-2); border-radius: 0 0 var(--radius) var(--radius); }
.game-bar-title { display: flex; flex-direction: column; }
.game-bar-title small { color: var(--muted); }
.game-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.act { background: var(--bg-3); border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px; font-weight: 600; font-size: 14px; }
.act:hover { border-color: var(--accent); }
.act.on { background: var(--accent); color: #2a1200; border-color: var(--accent); }
.act-wa { background: #128c4a; border-color: #128c4a; }
.game-info { background: var(--bg-2); border-radius: var(--radius); padding: 20px 22px; margin-top: 18px; }
.game-info h2 { font-size: 19px; margin-top: 18px; }
.game-info h2:first-child { margin-top: 0; }
.game-info p { color: #cfcde0; }
.side-title { font-size: 17px; }
.grid-side { grid-template-columns: repeat(2, 1fr); gap: 10px; }
.grid-side .card-title { font-size: 12.5px; }
.faq details { background: var(--bg-3); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { margin: 8px 0 0; }

/* ---------- SEO text, empty, footer, toast ---------- */
.seo-text { margin: 36px 0; padding: 22px; background: var(--bg-2); border-radius: var(--radius); color: #cfcde0; }
.seo-text h2 { color: var(--text); font-size: 20px; }
.seo-text a { color: var(--accent); }
.empty { text-align: center; padding: 30px 0; }
.footer { margin-top: 40px; padding: 24px 0 30px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13.5px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 18px; margin-bottom: 10px; }
.footer a:hover { color: var(--text); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 700; z-index: 100; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .game-layout { grid-template-columns: 1fr; }
  .grid-side { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
@media (max-width: 860px) {
  .menu-toggle { display: block; }
  .sidebar { position: fixed; left: 0; top: var(--topbar); z-index: 60; background: var(--bg); transform: translateX(-100%); transition: transform .2s ease; }
  body.menu-open .sidebar { transform: none; }
  body.menu-open .backdrop { display: block; position: fixed; inset: var(--topbar) 0 0 0; background: rgba(0,0,0,.55); z-index: 55; }
  .main { padding: 14px 12px 0; }
  .hero-grid { grid-template-columns: 1fr 1fr; grid-template-rows: auto; }
  .hero-main { grid-column: span 2; grid-row: auto; aspect-ratio: 4 / 3; } /* thumbnails are 4:3: matching ratio = no cropping */
  .hero-card:nth-child(n+4) { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .grid-scroll { grid-auto-columns: 42%; }
  .ao-logo-words { display: none; }   /* small screens: AO badge only */
  .player { max-height: 70vh; }
}

/* ---------- Phase 2: language switch + ad slots ---------- */
.lang-switch { display: flex; gap: 4px; background: var(--bg-3); border: 1px solid var(--line); border-radius: 999px; padding: 3px; flex: none; }
.lang-switch a { padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--muted); }
.lang-switch a.on { background: var(--accent); color: #2a1200; }
.lang-switch a:not(.on):hover { color: var(--text); }
html[lang="hi"] body { font-family: "Noto Sans Devanagari", "Kohinoor Devanagari", "Mangal", system-ui, sans-serif; }

.ad { position: relative; margin: 18px 0; min-height: 100px; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; }
.ad .adsbygoogle { width: 100%; }
.ad-label { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; align-self: center; }
.ad-placeholder { border: 2px dashed var(--line); border-radius: var(--radius); color: var(--muted); font-size: 13px; background: repeating-linear-gradient(45deg, transparent 0 10px, rgba(255,255,255,.02) 10px 20px); }
.ad-game_side { min-height: 250px; margin-top: 0; }
.ad-home_top, .ad-listing_top { min-height: 90px; }
@media (max-width: 860px) {
  .lang-switch a { padding: 4px 8px; }
  .ad-game_side { display: none; } /* sidebar ad hidden on mobile; game_below covers it */
}

/* ---------- Phase 3: user, favorites, profile, leaderboard, PWA ---------- */
/* Install button: AO orange gradient + white icon, so it stands out on the dark top bar */
.install-btn { flex: none; display: inline-flex; gap: 6px; align-items: center; font-weight: 700; white-space: nowrap;
  background: var(--ao-grad); border: 0; color: #fff; box-shadow: 0 4px 14px rgba(234, 88, 12, .35); }
.install-btn:hover { filter: brightness(1.08); }
.install-icon { display: block; flex: none; }
.login-btn { flex: none; background: var(--text); color: var(--bg); border-color: var(--text); }
.user-chip { display: flex; align-items: center; gap: 8px; flex: none; padding: 3px 3px 3px 10px; border-radius: 999px; background: var(--bg-3); border: 1px solid var(--line); font-weight: 700; font-size: 14px; }
.user-chip:hover { border-color: var(--accent); }
.user-chip img, .user-chip .avatar-letter { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.avatar-letter { display: inline-grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 800; }
.act-fav { filter: grayscale(1); opacity: .7; }
.act-fav.on { filter: none; opacity: 1; background: #3a1420; border-color: #e11d48; color: inherit; }

.auth-card { max-width: 440px; margin: 30px auto; padding: 30px 26px; background: var(--bg-2); border-radius: 20px; text-align: center; display: grid; gap: 14px; justify-items: center; }
.auth-card h1 { font-size: 24px; margin: 0; }
.perks { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; text-align: left; }
.perks li { background: var(--bg-3); padding: 10px 14px; border-radius: 12px; }
.google-btn { min-height: 44px; }
.small { font-size: 13px; }
.dev-note { background: #2a2410; border: 1px dashed #eab308; padding: 10px 14px; border-radius: 10px; font-size: 14px; }
.dev-note a { color: #facc15; font-weight: 700; }

.profile-head { display: flex; align-items: center; gap: 18px; margin: 8px 0 18px; }
.avatar-lg { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; font-size: 34px; flex: none; }
.profile-meta h1 { margin: 0 0 6px; font-size: 26px; }
.level { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.level small { color: var(--muted); }
.bar { width: 180px; height: 10px; background: var(--bg-3); border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--ao-grad); border-radius: 999px; }
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat-card { background: var(--bg-2); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.stat-card .big { font-size: 24px; font-weight: 800; }
.stat-card small { color: var(--muted); }
a.stat-card:hover { box-shadow: inset 0 0 0 2px var(--accent); }
.panel-box { background: var(--bg-2); border-radius: var(--radius); padding: 18px 20px; margin: 26px 0; display: grid; gap: 14px; justify-items: start; }
.panel-box h2 { margin: 0; font-size: 19px; }
.panel-box form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0; }
.panel-box input:not([type=checkbox]) { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; font: inherit; }
.check { display: flex; gap: 8px; align-items: center; }
.danger summary { cursor: pointer; color: #f87171; font-weight: 600; }
.danger p { color: var(--muted); }
.act-danger { background: #7f1d1d; border-color: #b91c1c; }
.notice-inline { background: #13361f; border: 1px solid var(--good); padding: 8px 14px; border-radius: 10px; margin-bottom: 12px; display: inline-block; }
.cta-box { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; background: linear-gradient(90deg, rgba(234,88,12,.15), rgba(139,92,246,.15)); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin: 18px 0; }
.cta-box p { margin: 0; }

.my-rank { background: var(--bg-2); border-left: 4px solid var(--accent); padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 600; }
.leaderboard { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 8px; max-width: 720px; }
.leaderboard li { display: grid; grid-template-columns: 52px 36px 1fr auto; align-items: center; gap: 12px; background: var(--bg-2); padding: 10px 16px; border-radius: 12px; }
.leaderboard .rank { font-weight: 800; font-size: 18px; text-align: center; }
.leaderboard .avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.leaderboard .who { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard .score { font-weight: 800; color: var(--accent); }
.leaderboard .top { background: linear-gradient(90deg, rgba(234,88,12,.16), var(--bg-2) 70%); }
.leaderboard .rank:is(.top-1 *, .top-2 *, .top-3 *) { font-size: 24px; }
.leaderboard .is-me { box-shadow: inset 0 0 0 2px var(--accent-2); }

.nav-lang { display: none; }
@media (max-width: 560px) {
  .lang-switch { display: none; }   /* moves into the sidebar menu on small phones */
  .nav-lang { display: flex; }
  div.nav-lang { display: block; }
}
@media (max-width: 860px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .install-btn { padding: 6px 9px; }
  .install-label { display: none; }
  .login-btn { padding: 6px 10px; font-size: 13px; }
  .user-chip { padding-left: 8px; font-size: 13px; }
}

/* footer product credit */
.made-by { color: var(--text); }
.made-by a { color: var(--accent); font-weight: 700; }
