/* =========================================================
   BrowserGames — Tema Dark Gamer
   ========================================================= */

:root {
  --bg: #0b0c10;
  --bg-2: #1f2833;
  --surface: rgba(31, 40, 51, 0.55);
  --border: rgba(255, 255, 255, 0.08);
  --text: #e8edf2;
  --muted: #8b98a8;

  --purple: #8a2be2;
  --cyan: #00f2fe;
  --pink: #ff007f;

  --radius: 14px;
  --radius-sm: 10px;
  --header-h: 72px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --font-display: 'Orbitron', system-ui, sans-serif;
  --font-body: 'Rajdhani', system-ui, sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(138, 43, 226, 0.18), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, rgba(0, 242, 254, 0.10), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
}

img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
a { color: inherit; }

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

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

/* ===================== HEADER (glassmorphism) ===================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 12, 16, 0.6);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: var(--header-h);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-icon {
  width: 38px;
  height: 38px;
  color: var(--cyan);
  filter: drop-shadow(0 0 8px rgba(0, 242, 254, 0.6));
}

.logo-text {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
}

.logo-text span {
  background: linear-gradient(90deg, var(--purple), var(--pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.search {
  position: relative;
  flex: 1;
  max-width: 520px;
  margin-left: auto;
}

.search input {
  width: 100%;
  height: 44px;
  padding: 0 44px 0 42px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.search input::placeholder { color: var(--muted); }

.search input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 242, 254, 0.15), 0 0 20px rgba(0, 242, 254, 0.2);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search-hint {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  padding: 1px 8px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.search input:focus ~ .search-hint { opacity: 0; }

/* Filtros por categoria */
.filters {
  display: flex;
  gap: 8px;
  padding-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  padding: 6px 16px;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s, box-shadow 0.2s, transform 0.15s var(--ease);
}

.chip:hover {
  color: var(--text);
  border-color: var(--chip-color);
}

.chip:active { transform: scale(0.96); }

.chip[aria-pressed="true"] {
  color: var(--bg);
  background: var(--chip-color);
  border-color: var(--chip-color);
  box-shadow: 0 0 16px color-mix(in srgb, var(--chip-color) 55%, transparent);
}

/* ===================== ANÚNCIOS ===================== */

.ad-slot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 24px auto;
  overflow: hidden;
  background: repeating-linear-gradient(45deg, rgba(255,255,255,0.02) 0 10px, transparent 10px 20px);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
}

.ad-placeholder {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.7;
}

/* Quando o script da Adsterra for colado, o placeholder some sozinho */
.ad-slot:has(iframe, script + div, ins) .ad-placeholder { display: none; }

.ad-leaderboard { width: 100%; max-width: 728px; height: 90px; }
.ad-rectangle   { width: 300px; height: 250px; max-width: 100%; margin: 0 auto; }
.ad-native      { width: 100%; min-height: 120px; margin-top: 0; }

/* ===================== HERO ===================== */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  align-items: center;
  gap: 32px;
  min-height: 340px;
  padding: 48px;
  margin-bottom: 40px;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 6px);
  background: var(--bg-2);
}

.hero-bg {
  position: absolute;
  inset: -40px;
  z-index: -2;
  background-size: cover;
  background-position: center;
  filter: blur(40px) saturate(140%);
  opacity: 0.55;
}

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg, rgba(11, 12, 16, 0.92) 0%, rgba(11, 12, 16, 0.5) 60%, transparent 100%);
}

.hero-tag {
  display: inline-block;
  padding: 4px 12px;
  margin-bottom: 14px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cyan);
  background: rgba(0, 242, 254, 0.08);
  border: 1px solid rgba(0, 242, 254, 0.35);
  border-radius: 999px;
}

.hero-title {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: 1.05;
  text-shadow: 0 0 30px color-mix(in srgb, var(--cat-color) 60%, transparent);
}

.hero-desc {
  max-width: 46ch;
  margin: 0 0 16px;
  font-size: 1.15rem;
  color: #c3ccd6;
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  color: var(--muted);
  font-weight: 600;
}

.hero-art {
  justify-self: end;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px color-mix(in srgb, var(--cat-color) 35%, transparent);
  transform: perspective(900px) rotateY(-8deg);
  transition: transform 0.5s var(--ease);
}

.hero:hover .hero-art { transform: perspective(900px) rotateY(0deg) scale(1.02); }

/* ===================== BOTÕES ===================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.06em;
  transition: transform 0.15s var(--ease), box-shadow 0.25s, filter 0.2s;
}

.btn:active { transform: scale(0.97); }

.btn-hero {
  padding: 16px 36px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: #fff;
  background: linear-gradient(90deg, var(--purple), var(--pink));
  border-radius: 999px;
  box-shadow: 0 0 24px rgba(255, 0, 127, 0.45);
}

.btn-hero:hover {
  box-shadow: 0 0 36px rgba(255, 0, 127, 0.7), 0 0 60px rgba(138, 43, 226, 0.4);
  filter: brightness(1.1);
}

.btn-play {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.95rem;
  color: var(--bg);
  background: var(--cyan);
  border-radius: var(--radius-sm);
}

.btn-play:hover {
  box-shadow: 0 0 20px rgba(0, 242, 254, 0.6);
}

.btn-ghost {
  padding: 10px 20px;
  color: var(--cyan);
  background: transparent;
  border: 1px solid var(--cyan);
  border-radius: 999px;
}

/* ===================== LAYOUT ===================== */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 32px;
  align-items: start;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 18px;
}

.section-head h2,
.panel-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
}

.games-count { color: var(--muted); font-weight: 600; }

/* ===================== GRID DE JOGOS ===================== */

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

.card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform 0.3s var(--ease), border-color 0.3s, box-shadow 0.3s;
  animation: card-in 0.4s var(--ease) both;
  animation-delay: calc(var(--i) * 30ms);
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(10px); }
}

.card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--cat-color) 70%, transparent);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 0 24px color-mix(in srgb, var(--cat-color) 40%, transparent);
}

.card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease);
}

.card:hover .card-media img { transform: scale(1.08); }

.badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 2px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cat-color);
  background: rgba(11, 12, 16, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid color-mix(in srgb, var(--cat-color) 60%, transparent);
  border-radius: 999px;
}

.badge-inline { position: static; }

.card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  flex: 1;
}

.card-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.2;
}

.card-meta {
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: var(--muted);
}

.card-body .btn-play { margin-top: auto; }

.empty-state {
  padding: 48px 16px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.empty-title {
  margin: 0 0 4px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

/* ===================== SIDEBAR ===================== */

.sidebar {
  position: sticky;
  top: calc(var(--header-h) + 64px);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.panel {
  padding: 18px;
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.panel-title { margin-bottom: 14px; }

.top-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.top-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.top-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
}

.top-rank {
  width: 24px;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.1rem;
  text-align: center;
  color: var(--muted);
}

.top-list li:nth-child(1) .top-rank { color: var(--pink);   text-shadow: 0 0 10px var(--pink); }
.top-list li:nth-child(2) .top-rank { color: var(--purple); text-shadow: 0 0 10px var(--purple); }
.top-list li:nth-child(3) .top-rank { color: var(--cyan);   text-shadow: 0 0 10px var(--cyan); }

.top-item img {
  width: 56px;
  height: 42px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.top-info { display: flex; flex-direction: column; min-width: 0; }

.top-title {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-plays { font-size: 0.85rem; color: var(--muted); }

/* ===================== FOOTER ===================== */

.site-footer {
  margin-top: 64px;
  padding: 40px 0 24px;
  background: linear-gradient(180deg, transparent, rgba(31, 40, 51, 0.5));
  border-top: 1px solid var(--border);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}

.logo-sm .logo-text { font-size: 1.1rem; }

.footer-about p {
  max-width: 48ch;
  color: var(--muted);
}

.footer-links h3 {
  margin: 0 0 12px;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cyan);
}

.footer-links ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-links a {
  text-decoration: none;
  color: var(--muted);
  transition: color 0.2s;
}

.footer-links a:hover { color: var(--text); }

.copyright {
  margin: 0;
  padding-top: 20px;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid var(--border);
}

/* ===================== RESPONSIVO ===================== */

@media (max-width: 1024px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
  }
}

@media (max-width: 768px) {
  .hero {
    grid-template-columns: 1fr;
    padding: 28px 20px;
    min-height: 0;
  }
  .hero-art { display: none; }
  .hero::after { background: linear-gradient(180deg, rgba(11,12,16,0.6), rgba(11,12,16,0.9)); }

  .sidebar { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-about { grid-column: 1 / -1; }

  /* Leaderboard 728x90 não cabe no celular: troque por um banner 320x50 se quiser */
  .ad-leaderboard { height: auto; aspect-ratio: 728 / 90; }
}

@media (max-width: 560px) {
  .header-inner { gap: 12px; }
  .logo-text { display: none; }
  .search-hint { display: none; }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .card-body { padding: 10px; }
  .card-title { font-size: 1rem; }
  .btn-play { font-size: 0.85rem; padding: 9px 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===================== GAME PAGE ===================== */

.game-page-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

#game-page-title {
  font-family: var(--font-display);
  font-size: 2rem;
  margin: 0;
  text-shadow: 0 0 10px rgba(0, 242, 254, 0.4);
}

.game-layout {
  display: grid;
  grid-template-columns: 300px 1fr 300px;
  gap: 20px;
  align-items: start;
  margin-bottom: 24px;
}

.game-container {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
  aspect-ratio: 16 / 9;
  display: flex;
  flex-direction: column;
}

.game-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(11, 12, 16, 0.85);
  z-index: 10;
  backdrop-filter: blur(8px);
}

.btn-large {
  padding: 20px 40px;
  font-size: 1.25rem;
  box-shadow: 0 0 30px rgba(0, 242, 254, 0.4);
  font-family: var(--font-display);
}

.iframe-wrapper {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

#game-iframe {
  flex: 1;
  width: 100%;
  border: none;
  background: #000;
}

.fullscreen-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  z-index: 20;
}
.fullscreen-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  border-color: var(--cyan);
}

/* Responsividade Game Page */
@media (max-width: 1200px) {
  .game-layout {
    grid-template-columns: 1fr;
  }
  .ad-sidebar-left,
  .ad-sidebar-right {
    display: none; /* Ocultar banners laterais em telas menores */
  }
}
