/* ============================================
   Qavio.top - Game Portal Stylesheet
   AdSense-compliant, mobile-first design
   ============================================ */

/* --- Design Tokens --- */
:root {
  --color-bg: #0b1120;
  --color-bg-elevated: #151d2e;
  --color-bg-card: #1a2438;
  --color-bg-hover: #243049;
  --color-text: #e8edf5;
  --color-text-muted: #8899aa;
  --color-text-dim: #5a6a7e;
  --color-accent: #6d5dfc;
  --color-accent-hover: #5a4de0;
  --color-accent-glow: rgba(109, 93, 252, 0.25);
  --color-success: #2dd4a8;
  --color-border: #1e2d45;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --shadow-card: 0 2px 12px rgba(0,0,0,0.25);
  --shadow-hover: 0 8px 32px rgba(0,0,0,0.4);
  --header-height: 60px;
  --content-max: 1320px;
  --font-stack: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-stack);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; color: inherit; font: inherit; }
input, select { font: inherit; }
ul { list-style: none; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--color-bg); }
::-webkit-scrollbar-thumb { background: var(--color-bg-hover); border-radius: 3px; }

/* ============================================
   Site Header
   ============================================ */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-height);
  background: rgba(11, 17, 32, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border);
}
.header-inner {
  max-width: var(--content-max); margin: 0 auto;
  height: 100%; padding: 0 20px;
  display: flex; align-items: center; gap: 16px;
}
.site-brand {
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.site-brand-icon {
  width: 34px; height: 34px;
  border-radius: 8px;
  object-fit: cover;
}
.site-brand-name {
  font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em;
  background: linear-gradient(135deg, #6d5dfc, #2dd4a8);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.header-search {
  flex: 1; max-width: 380px; position: relative;
}
.header-search input {
  width: 100%; padding: 8px 14px 8px 36px;
  background: var(--color-bg-elevated); border: 1px solid var(--color-border);
  border-radius: var(--radius-full); color: var(--color-text);
  outline: none; transition: border-color 0.2s;
  font-size: 0.88rem;
}
.header-search input:focus { border-color: var(--color-accent); }
.header-search input::placeholder { color: var(--color-text-dim); }
.header-search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--color-text-dim); font-size: 13px; pointer-events: none;
}
.header-nav {
  display: flex; align-items: center; gap: 4px;
}
.header-nav a {
  padding: 6px 14px; border-radius: var(--radius-sm);
  font-size: 0.88rem; color: var(--color-text-muted);
  transition: all 0.2s; white-space: nowrap;
}
.header-nav a:hover, .header-nav a.is-active {
  color: var(--color-text); background: var(--color-bg-hover);
}
.header-cat-toggle {
  padding: 6px 14px; border-radius: var(--radius-sm);
  font-size: 0.88rem; color: var(--color-text-muted);
  transition: all 0.2s; white-space: nowrap; position: relative;
}
.header-cat-toggle:hover { color: var(--color-text); background: var(--color-bg-hover); }

/* Category Dropdown */
.cat-dropdown {
  display: none; position: absolute;
  top: calc(var(--header-height) - 4px); right: 20px;
  background: var(--color-bg-elevated); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: 14px;
  max-width: 480px; width: 90vw; max-height: 65vh; overflow-y: auto;
  box-shadow: var(--shadow-hover); z-index: 101;
}
.cat-dropdown.is-open { display: block; }
.cat-dropdown-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-chip {
  padding: 5px 14px; border-radius: var(--radius-full);
  font-size: 0.8rem; background: var(--color-bg-hover);
  color: var(--color-text-muted); transition: all 0.2s;
  text-transform: capitalize;
}
.cat-chip:hover { background: var(--color-accent); color: #fff; }

/* Mobile menu toggle */
.mobile-menu-btn {
  display: none; padding: 8px; border-radius: var(--radius-sm);
  color: var(--color-text-muted); font-size: 1.3rem;
}

/* ============================================
   Main Layout
   ============================================ */
.site-main { padding-top: var(--header-height); min-height: 100vh; }
.content-wrap { max-width: var(--content-max); margin: 0 auto; padding: 24px 20px; }
.page-transition { animation: fadeSlideIn 0.3s ease; }
@keyframes fadeSlideIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ============================================
   Hero Carousel
   ============================================ */
.hero-carousel {
  position: relative; border-radius: var(--radius-lg); overflow: hidden;
  margin-bottom: 36px; aspect-ratio: 21/9; background: var(--color-bg-elevated);
}
.hero-track { position: relative; width: 100%; height: 100%; }
.hero-slide {
  position: absolute; inset: 0; opacity: 0;
  transition: opacity 0.5s ease; pointer-events: none;
}
.hero-slide.is-active { opacity: 1; }
.hero-slide img { width: 100%; height: 100%; object-fit: cover; }
.hero-content {
  position: absolute; inset: 0; z-index: 2;
  background: linear-gradient(to top, rgba(11,17,32,0.96) 0%, rgba(11,17,32,0.4) 45%, transparent 100%);
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 28px 32px; pointer-events: none;
}
.hero-content > * { pointer-events: auto; }
.hero-heading { font-size: 1.75rem; font-weight: 800; margin-bottom: 6px; }
.hero-summary {
  font-size: 0.9rem; color: var(--color-text-muted);
  max-width: 560px; margin-bottom: 14px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-cta {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 26px; border-radius: var(--radius-full);
  background: var(--color-accent); color: #fff;
  font-weight: 600; font-size: 0.92rem;
  transition: all 0.2s; width: fit-content;
}
.hero-cta:hover { background: var(--color-accent-hover); box-shadow: 0 4px 20px var(--color-accent-glow); }
.hero-indicators {
  position: absolute; bottom: 14px; right: 28px;
  display: flex; gap: 7px; z-index: 3;
}
.hero-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: rgba(255,255,255,0.25); cursor: pointer; transition: background 0.3s;
}
.hero-dot.is-active { background: var(--color-accent); }

/* ============================================
   Category Strip
   ============================================ */
.category-strip {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px;
  margin-bottom: 28px; scrollbar-width: none;
}
.category-strip::-webkit-scrollbar { display: none; }
.category-pill {
  padding: 7px 18px; border-radius: var(--radius-full);
  font-size: 0.84rem; background: var(--color-bg-elevated);
  color: var(--color-text-muted); white-space: nowrap;
  transition: all 0.2s; border: 1px solid var(--color-border);
  text-transform: capitalize;
}
.category-pill:hover, .category-pill.is-active {
  background: var(--color-accent); color: #fff; border-color: var(--color-accent);
}

/* ============================================
   Section Block
   ============================================ */
.content-section { margin-bottom: 40px; }
.section-heading-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.section-heading {
  font-size: 1.2rem; font-weight: 700;
}
.section-heading a {
  font-size: 0.84rem; color: var(--color-accent); font-weight: 500;
  transition: color 0.2s;
}
.section-heading a:hover { color: var(--color-accent-hover); }

/* ============================================
   Game Card
   ============================================ */
.game-card {
  border-radius: var(--radius-md); overflow: hidden;
  background: var(--color-bg-card);
  transition: transform 0.25s, box-shadow 0.25s;
  position: relative;
}
.game-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}
.game-card-thumb {
  position: relative; aspect-ratio: 16/10; overflow: hidden;
}
.game-card-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.35s;
}
.game-card:hover .game-card-thumb img { transform: scale(1.06); }
.game-card-thumb::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.65) 0%, transparent 50%);
}
.game-card-overlay {
  position: absolute; inset: 0; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  background: rgba(11,17,32,0.45); opacity: 0; transition: opacity 0.25s;
}
.game-card:hover .game-card-overlay { opacity: 1; }
.game-card-play-icon {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--color-accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: #fff;
  box-shadow: 0 4px 16px var(--color-accent-glow);
}
.game-card-meta {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 10px 12px; z-index: 1;
}
.game-card-title {
  font-size: 0.84rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.game-card-genre {
  font-size: 0.72rem; color: var(--color-success);
  text-transform: capitalize; margin-top: 1px;
}

/* ============================================
   Game Grid
   ============================================ */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 14px;
}

/* ============================================
   Game Detail Page
   ============================================ */
.game-detail-wrap { max-width: 1060px; margin: 0 auto; }
.game-player-frame {
  position: relative; width: 100%; padding-bottom: 62.5%;
  background: #000; border-radius: var(--radius-lg); overflow: hidden;
  margin-bottom: 20px;
}
.game-player-frame iframe {
  position: absolute; inset: 0; width: 100%; height: 100%; border: none;
}
.game-player-loading {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #000; color: var(--color-text-muted); gap: 12px; z-index: 1;
}
.game-player-loading .spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--color-bg-hover);
  border-top-color: var(--color-accent);
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.game-toolbar {
  display: flex; gap: 10px; margin-bottom: 24px; flex-wrap: wrap;
}
.game-toolbar-btn {
  padding: 9px 22px; border-radius: var(--radius-full);
  font-weight: 600; font-size: 0.88rem; transition: all 0.2s;
}
.game-toolbar-btn.btn-primary {
  background: var(--color-accent); color: #fff;
}
.game-toolbar-btn.btn-primary:hover { background: var(--color-accent-hover); }
.game-toolbar-btn.btn-ghost {
  background: var(--color-bg-hover); color: var(--color-text);
  border: 1px solid var(--color-border);
}
.game-toolbar-btn.btn-ghost:hover { border-color: var(--color-accent); }

.game-info-block { margin-bottom: 32px; }
.game-info-block h1 {
  font-size: 1.6rem; font-weight: 800; margin-bottom: 10px;
}
.game-meta-row {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px;
}
.meta-tag {
  padding: 4px 12px; border-radius: var(--radius-full);
  font-size: 0.78rem; background: var(--color-bg-hover);
  color: var(--color-text-muted); text-transform: capitalize;
}
.meta-tag.is-primary { background: var(--color-accent); color: #fff; }
.game-update-date {
  font-size: 0.8rem; color: var(--color-text-dim); margin-bottom: 14px;
}
.game-description {
  font-size: 0.94rem; color: var(--color-text-muted); line-height: 1.8;
}

/* Tips / Guide Block */
.game-tips-block {
  background: var(--color-bg-elevated); border-radius: var(--radius-md);
  padding: 20px 24px; margin-bottom: 32px;
  border: 1px solid var(--color-border);
}
.game-tips-block h2 {
  font-size: 1.05rem; font-weight: 700; margin-bottom: 12px;
  color: var(--color-success);
}
.game-tips-block ol {
  padding-left: 20px; list-style: decimal;
}
.game-tips-block li {
  font-size: 0.9rem; color: var(--color-text-muted);
  margin-bottom: 8px; line-height: 1.6;
}

/* ============================================
   Search Page
   ============================================ */
.search-hero { text-align: center; padding: 36px 0 28px; }
.search-hero h1 { font-size: 1.8rem; font-weight: 800; margin-bottom: 16px; }
.search-bar-wrap {
  max-width: 560px; margin: 0 auto; position: relative;
}
.search-bar-wrap input {
  width: 100%; padding: 13px 18px 13px 44px;
  background: var(--color-bg-elevated); border: 2px solid var(--color-border);
  border-radius: var(--radius-full); color: var(--color-text);
  font-size: 1rem; outline: none; transition: border-color 0.2s;
}
.search-bar-wrap input:focus { border-color: var(--color-accent); }
.search-bar-wrap input::placeholder { color: var(--color-text-dim); }
.search-bar-wrap .header-search-icon {
  left: 16px; font-size: 16px;
}
.search-result-info {
  color: var(--color-text-dim); font-size: 0.88rem; margin-bottom: 14px;
}

/* ============================================
   All Games Page
   ============================================ */
.listing-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 22px;
}
.listing-toolbar h1 { font-size: 1.4rem; font-weight: 800; }
.listing-filters { display: flex; gap: 10px; align-items: center; }
.filter-select {
  padding: 7px 14px; border-radius: var(--radius-full);
  background: var(--color-bg-elevated); border: 1px solid var(--color-border);
  color: var(--color-text); font-size: 0.86rem; outline: none; cursor: pointer;
}
.filter-select:focus { border-color: var(--color-accent); }

/* ============================================
   Category Page
   ============================================ */
.category-hero { margin-bottom: 24px; }
.category-hero h1 {
  font-size: 1.6rem; font-weight: 800; text-transform: capitalize; margin-bottom: 6px;
}
.category-hero p { color: var(--color-text-muted); font-size: 0.92rem; }

/* ============================================
   Legal / Static Pages
   ============================================ */
.legal-page { max-width: 800px; margin: 0 auto; }
.legal-page h1 { font-size: 1.8rem; font-weight: 800; margin-bottom: 8px; }
.legal-page .page-updated { color: var(--color-text-dim); font-size: 0.84rem; margin-bottom: 28px; }
.legal-page h2 { font-size: 1.2rem; font-weight: 700; margin: 28px 0 12px; color: var(--color-text); }
.legal-page p, .legal-page li {
  font-size: 0.92rem; color: var(--color-text-muted); line-height: 1.8; margin-bottom: 10px;
}
.legal-page ul, .legal-page ol { padding-left: 22px; margin-bottom: 14px; }
.legal-page ul { list-style: disc; }
.legal-page ol { list-style: decimal; }

/* FAQ */
.faq-item {
  border-bottom: 1px solid var(--color-border); padding: 16px 0;
}
.faq-question {
  font-size: 1rem; font-weight: 600; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  color: var(--color-text); transition: color 0.2s;
}
.faq-question:hover { color: var(--color-accent); }
.faq-question::after { content: '+'; font-size: 1.2rem; transition: transform 0.2s; }
.faq-item.is-open .faq-question::after { content: '−'; }
.faq-answer {
  max-height: 0; overflow: hidden; transition: max-height 0.3s ease, padding 0.3s ease;
  font-size: 0.9rem; color: var(--color-text-muted); line-height: 1.7;
}
.faq-item.is-open .faq-answer { max-height: 300px; padding-top: 10px; }

/* ============================================
   404 Page
   ============================================ */
.page-404 {
  text-align: center; padding: 80px 20px;
}
.page-404 h1 {
  font-size: 5rem; font-weight: 900;
  background: linear-gradient(135deg, var(--color-accent), var(--color-success));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; margin-bottom: 12px;
}
.page-404 p { color: var(--color-text-muted); font-size: 1.1rem; margin-bottom: 24px; }
.page-404 a {
  display: inline-block; padding: 10px 28px; border-radius: var(--radius-full);
  background: var(--color-accent); color: #fff; font-weight: 600;
  transition: background 0.2s;
}
.page-404 a:hover { background: var(--color-accent-hover); }

/* ============================================
   Site Footer
   ============================================ */
.site-footer {
  background: var(--color-bg-elevated); border-top: 1px solid var(--color-border);
  padding: 28px 20px; margin-top: 48px;
}
.footer-inner {
  max-width: var(--content-max); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 14px;
}
.footer-brand {
  display: flex; align-items: center; gap: 8px;
}
.footer-brand img {
  width: 26px; height: 26px; border-radius: 6px; object-fit: cover;
}
.footer-brand span {
  font-size: 1rem; font-weight: 700;
  background: linear-gradient(135deg, #6d5dfc, #2dd4a8);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.footer-copy { color: var(--color-text-dim); font-size: 0.8rem; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a { color: var(--color-text-dim); font-size: 0.8rem; transition: color 0.2s; }
.footer-links a:hover { color: var(--color-text); }

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 900px) {
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .hero-heading { font-size: 1.3rem; }
  .hero-carousel { aspect-ratio: 16/9; }
  .hero-content { padding: 20px 24px; }
}
@media (max-width: 700px) {
  .header-nav { display: none; }
  .header-cat-toggle { display: none; }
  .mobile-menu-btn { display: block; }
  .header-search { max-width: 100%; }
  .content-wrap { padding: 16px 14px; }
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
  .hero-heading { font-size: 1.1rem; }
  .hero-summary { font-size: 0.82rem; }
  .hero-carousel { aspect-ratio: 4/3; }
  .game-info-block h1 { font-size: 1.25rem; }
  .footer-inner { flex-direction: column; text-align: center; }
  .listing-toolbar { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 420px) {
  .game-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .game-card-title { font-size: 0.78rem; }
  .section-heading { font-size: 1.05rem; }
}
