/* =========================================================
   PlayZone — AdSense-compliant H5 Gaming Site
   Single stylesheet. Mobile-first. CSS variables for theming.
   ========================================================= */

:root {
  --color-bg: #0f1220;
  --color-bg-alt: #141830;
  --color-bg-accent: #101428;
  --color-surface: #171b30;
  --color-surface-2: #1f2440;
  --color-border: #2a3055;
  --color-text: #e8ecff;
  --color-text-dim: #a6adcf;
  --color-primary: #6c5ce7;
  --color-primary-hover: #8579ef;
  --color-accent: #00d4a6;
  --color-warning: #ffb648;
  --color-danger: #ff6b6b;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);

  --container: 1200px;
  --header-h: 64px;

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

/* -------------------- Reset -------------------- */
*,
*::before,
*::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh;
  font-family: var(--font-sans);
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, picture, svg, video { display: block; max-width: 100%; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-hover); text-decoration: underline; }
button { font: inherit; cursor: pointer; }

/* -------------------- Layout helpers -------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 20px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* -------------------- Header / Nav -------------------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(15, 18, 32, 0.92);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--color-border);
  height: var(--header-h);
  display: flex; align-items: center;
}
.nav {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
}
.nav-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 20px; color: var(--color-text);
}
.nav-brand:hover { text-decoration: none; color: var(--color-text); }
.nav-brand .logo {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  border-radius: 8px;
  color: white; font-weight: 800;
}
.nav-links {
  display: flex; gap: 20px; list-style: none; padding: 0;
  margin-left: auto;
}
.nav-links a {
  color: var(--color-text-dim);
  font-weight: 500;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}
.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--color-text);
  background: var(--color-surface);
  text-decoration: none;
}
.nav-toggle {
  display: none;
  background: transparent; border: 0;
  color: var(--color-text); font-size: 22px;
}
@media (max-width: 760px) {
  .nav-toggle { display: inline-flex; margin-left: auto; }
  .nav-links {
    position: absolute; top: var(--header-h); left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 8px 20px 16px;
    margin: 0;
    display: none;
  }
  .nav-links.is-open { display: flex; }
  .nav-links a { padding: 12px 8px; border-radius: 0; }
}

/* -------------------- Hero -------------------- */
.hero {
  padding: 64px 0 48px;
  text-align: center;
  background:
    radial-gradient(ellipse at top, rgba(108, 92, 231, 0.14) 0%, transparent 60%),
    radial-gradient(ellipse at bottom, rgba(0, 212, 166, 0.08) 0%, transparent 55%),
    var(--color-bg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.hero h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.15;
  margin-bottom: 14px;
  background: linear-gradient(135deg, #fff 0%, #b8c1ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p {
  max-width: 720px;
  margin: 0 auto 24px;
  color: var(--color-text-dim);
  font-size: clamp(15px, 1.8vw, 17px);
}
.hero-actions {
  display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
}

/* -------------------- Buttons -------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  transition: transform .1s ease, background .2s ease, border-color .2s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary {
  background: var(--color-primary); color: #fff;
}
.btn-primary:hover { background: var(--color-primary-hover); color: #fff; }
.btn-ghost {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn-ghost:hover { background: var(--color-surface); color: var(--color-text); }

/* -------------------- Category filter -------------------- */
.filters {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin: 8px 0 24px;
  align-items: center;
}
.filters .search {
  flex: 1 1 220px;
  min-width: 180px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  outline: none;
}
.filters .search:focus { border-color: var(--color-primary); }
.chip {
  background: var(--color-surface);
  color: var(--color-text-dim);
  border: 1px solid var(--color-border);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
}
.chip[aria-pressed="true"] {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* -------------------- Games grid -------------------- */
.games-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  margin-block: 16px 48px;
}
.game-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.game-card:hover {
  transform: translateY(-3px);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.game-card .thumb {
  aspect-ratio: 4 / 3;
  width: 100%;
  object-fit: cover;
  background: var(--color-surface-2);
}
.game-card .body { padding: 14px 16px 16px; }
.game-card h3 {
  font-size: 17px;
  color: var(--color-text);
  margin-bottom: 4px;
}
.game-card p {
  font-size: 14px;
  color: var(--color-text-dim);
  margin: 0;
}
.game-card .meta {
  display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap;
}
.tag {
  background: var(--color-surface-2);
  color: var(--color-text-dim);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

/* -------------------- Content sections -------------------- */
.section {
  padding: 48px 0;
  position: relative;
}
.section h2 {
  font-size: clamp(22px, 3vw, 28px);
  margin-bottom: 14px;
}
.section h3 { font-size: 18px; margin-top: 20px; margin-bottom: 6px; }

/* Alternating section treatments for visual rhythm */
.section--alt {
  background: var(--color-bg-alt);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

/* Card-style prose sections (used inside narrow containers like game/blog pages) */
.prose-card {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 28px clamp(18px, 4vw, 36px);
  margin: 24px 0;
}
.prose-card + .prose-card { margin-top: 16px; }

/* Game page: alternate the prose blocks for visual rhythm */
.game-page section.prose {
  padding: 28px clamp(18px, 4vw, 32px);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  margin: 20px 0;
  background: var(--color-surface);
}
.game-page section.prose:nth-of-type(even) {
  background: var(--color-bg-alt);
  border-color: rgba(255, 255, 255, 0.06);
}
.game-page section.faq.prose {
  background: linear-gradient(180deg,
    var(--color-surface) 0%,
    var(--color-bg-alt) 100%);
}
.section--accent {
  background:
    linear-gradient(180deg,
      var(--color-bg) 0%,
      var(--color-bg-alt) 15%,
      var(--color-bg-alt) 85%,
      var(--color-bg) 100%);
}
.section--tight { padding: 28px 0; }

/* Breadcrumbs — subtle chip styling */
.breadcrumbs,
nav[aria-label="Breadcrumb"] {
  font-size: 13px;
  color: var(--color-text-dim);
  margin-bottom: 8px;
}
.breadcrumbs a,
nav[aria-label="Breadcrumb"] a {
  color: var(--color-text-dim);
}
.breadcrumbs a:hover,
nav[aria-label="Breadcrumb"] a:hover {
  color: var(--color-primary);
}

/* Subtle divider between adjacent same-bg sections */
.section-divider {
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    var(--color-border) 50%,
    transparent);
  opacity: 0.6;
  margin: 0 auto;
  max-width: 480px;
}

/* FAQ accent-border treatment — targets existing <details> markup */
.faq details,
section.faq > details {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-accent);
  padding: 14px 18px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 10px;
  transition: box-shadow .2s ease, border-color .2s ease;
}
.faq details:hover { box-shadow: var(--shadow-sm); }
.faq details[open] {
  border-left-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}
.faq details summary {
  cursor: pointer;
  color: var(--color-text);
  font-weight: 600;
  list-style: none;
  position: relative;
  padding-right: 28px;
}
.faq details summary::-webkit-details-marker { display: none; }
.faq details summary::after {
  content: "+";
  position: absolute;
  right: 0; top: 50%;
  transform: translateY(-50%);
  font-size: 22px;
  line-height: 1;
  color: var(--color-accent);
  font-weight: 400;
  transition: transform .2s ease, color .2s ease;
}
.faq details[open] summary::after {
  content: "\2013";
  color: var(--color-primary);
}
.faq details p {
  margin-top: 10px;
  margin-bottom: 0;
  color: var(--color-text-dim);
}
.prose p { margin-bottom: 14px; color: var(--color-text-dim); }
.prose ul, .prose ol { margin-left: 20px; margin-bottom: 14px; color: var(--color-text-dim); }
.prose li { margin-bottom: 6px; }
.prose strong { color: var(--color-text); }

/* Long-form prose: give H2s a subtle accent-bar to visually separate subsections */
.prose h2 {
  margin-top: 36px;
  padding-top: 20px;
  padding-left: 14px;
  border-top: 1px solid var(--color-border);
  border-left: 3px solid var(--color-accent);
  position: relative;
}
.prose h2:first-child,
.prose > h1 + h2,
.prose > .subtitle + h2,
.prose > .ad-slot + h2 {
  margin-top: 20px;
  padding-top: 0;
  border-top: 0;
}
/* Don't double-style H2s that are already inside a card/boxed section */
.game-page section.prose > h2,
.prose-card > h2,
.faq.prose > h2,
.section--alt .prose h2,
.section--alt > .container.prose > h2,
section.section--alt .prose h2 {
  border-top: 0;
  border-left: 0;
  padding-top: 0;
  padding-left: 0;
  margin-top: 28px;
}
.prose h3 {
  margin-top: 22px;
  color: var(--color-text);
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
}

/* -------------------- Ad placeholders --------------------
   NOTE: These reserve visual space well separated from the
   game canvas / interactive controls (AdSense policy). */
.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    repeating-linear-gradient(
      45deg,
      rgba(255,255,255,.02) 0 10px,
      rgba(255,255,255,.04) 10px 20px
    ),
    var(--color-surface);
  border: 1px dashed var(--color-border);
  color: var(--color-text-dim);
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  margin: 24px 0;
  padding: 10px;
}
.ad-slot[data-size="leaderboard"] { min-height: 90px; }
.ad-slot[data-size="banner"] { min-height: 100px; }
.ad-slot[data-size="in-content"] { min-height: 250px; }
.ad-slot[data-size="sidebar"] { min-height: 300px; }

/* -------------------- Game page -------------------- */
.game-page { padding-top: 24px; }
.game-page h1 {
  font-size: clamp(24px, 3.6vw, 34px);
  margin-bottom: 10px;
}
.game-page .subtitle {
  color: var(--color-text-dim);
  margin-bottom: 20px;
}
.game-frame-wrap {
  background: #000;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  max-width: 100%;
  margin: 16px 0;
}
.game-frame {
  width: 100%;
  max-width: 100vw;
  border: 0;
  display: block;
  aspect-ratio: 4 / 3;
  background: #000;
}
@media (min-width: 900px) {
  .game-frame { aspect-ratio: 16 / 10; }
}
.game-frame--portrait { aspect-ratio: 3 / 4; }
.game-frame--tall { aspect-ratio: 9 / 16; }
.game-frame--square { aspect-ratio: 1 / 1; }
.game-frame--wide { aspect-ratio: 16 / 9; }
.game-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: grid; place-items: center;
  text-align: center;
  color: var(--color-text-dim);
  padding: 24px;
}
.game-placeholder code {
  background: var(--color-surface-2);
  padding: 2px 6px; border-radius: 4px; color: var(--color-text);
  font-size: 13px;
}

.game-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
@media (min-width: 1024px) {
  .game-layout { grid-template-columns: minmax(0, 1fr) 300px; }
}
.game-sidebar .ad-slot { margin-top: 0; }

/* FAQ */
.faq details {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.faq details[open] { border-color: var(--color-primary); }
.faq summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--color-text);
}
.faq details p { margin-top: 10px; color: var(--color-text-dim); }

/* Forms (contact) */
.form-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-field label { font-weight: 600; color: var(--color-text); }
.form-field input,
.form-field textarea {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font: inherit;
}
.form-field input:focus,
.form-field textarea:focus {
  outline: none; border-color: var(--color-primary);
}

/* -------------------- Footer -------------------- */
.site-footer {
  margin-top: 60px;
  border-top: 1px solid var(--color-border);
  background:
    linear-gradient(180deg, var(--color-surface) 0%, var(--color-bg-accent) 100%);
  padding: 44px 0 24px;
  color: var(--color-text-dim);
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}
.footer-grid h4 {
  color: var(--color-text); font-size: 15px;
  margin-bottom: 10px; text-transform: uppercase; letter-spacing: 1px;
}
.footer-grid ul { list-style: none; padding: 0; }
.footer-grid li { margin-bottom: 6px; }
.footer-grid a { color: var(--color-text-dim); }
.footer-grid a:hover { color: var(--color-primary); }
.footer-bottom {
  border-top: 1px solid var(--color-border);
  padding-top: 16px;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  font-size: 13px;
}

/* -------------------- Utility -------------------- */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }

/* -------------------- Cookie consent banner -------------------- */
.cookie-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 9999;
  background: rgba(15, 18, 32, 0.97);
  color: #e6e8ef;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 14px 18px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  backdrop-filter: saturate(1.2) blur(6px);
  animation: cookie-pop 0.35s ease both;
}
.cookie-banner.is-hiding { opacity: 0; transition: opacity 0.3s ease; }
.cookie-banner-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1080px;
  margin: 0 auto;
}
.cookie-banner-text {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.45;
  flex: 1 1 320px;
}
.cookie-banner-text a { color: #7aa7ff; text-decoration: underline; }
.cookie-banner-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cookie-banner-actions .btn { padding: 0.5rem 1rem; }
@keyframes cookie-pop {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
@media (max-width: 480px) {
  .cookie-banner { left: 8px; right: 8px; bottom: 8px; padding: 12px; }
  .cookie-banner-text { font-size: 0.88rem; }
}

/* -------------------- Utility: small list variant -------------------- */
ul.nocheck { list-style: disc; padding-left: 1.25rem; }
ul.nocheck li { margin: 0.25rem 0; }

/* -------------------- Reduced motion -------------------- */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0s !important;
    transition-duration: 0s !important;
    scroll-behavior: auto !important;
  }
}
