/* ============================================================
   BV168.CN — "Night Circuit" Design System
   Theme: Racing / Speed / Neon Nights
   Fonts: Space Grotesk + IBM Plex Sans
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=IBM+Plex+Sans:wght@300;400;500;600;700&display=swap');

/* ---------- CSS Variables ---------- */
:root {
  --bg-deep: #0a0b1a;
  --bg-surface: #111228;
  --bg-card: #181936;
  --bg-card-hover: #1f2140;
  --accent-gold: #f0b429;
  --accent-gold-dim: #b8860b;
  --accent-cyan: #22d3ee;
  --accent-cyan-dim: #0891b2;
  --accent-red: #ef4444;
  --accent-purple: #a855f7;
  --text-primary: #e8e8f0;
  --text-secondary: #b0b0c8;
  --text-muted: #6b6b8a;
  --border: #2a2b55;
  --border-light: #3a3b65;
  --shadow: rgba(0, 0, 0, 0.4);
  --gold-glow: rgba(240, 180, 41, 0.3);
  --cyan-glow: rgba(34, 211, 238, 0.2);
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --font-heading: 'Space Grotesk', sans-serif;
  --font-body: 'IBM Plex Sans', sans-serif;
  --max-width: 1280px;
  --header-h: 72px;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background:
    radial-gradient(ellipse at 15% 10%, rgba(34,211,238,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 90%, rgba(168,85,247,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(240,180,41,0.03) 0%, transparent 40%),
    linear-gradient(180deg, var(--bg-deep) 0%, var(--bg-surface) 50%, var(--bg-deep) 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--accent-cyan); text-decoration: none; transition: color 0.3s; }
a:hover { color: var(--accent-gold); }
img { max-width: 100%; height: auto; display: block; }
ul { list-style: none; }

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 { font-family: var(--font-heading); font-weight: 700; line-height: 1.2; }

.section-label {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent-gold);
  margin-bottom: 12px;
  position: relative;
  padding-left: 40px;
}
.section-label::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 28px;
  height: 2px;
  background: var(--accent-gold);
}

.section-title {
  font-size: clamp(28px, 4vw, 48px);
  color: var(--text-primary);
  margin-bottom: 16px;
}

.section-desc {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 640px;
  line-height: 1.7;
}

/* ---------- Animations ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideLeft {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes slideRight {
  from { opacity: 0; transform: translateX(-40px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 20px var(--gold-glow); }
  50% { box-shadow: 0 0 40px var(--gold-glow), 0 0 60px var(--gold-glow); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes countUp {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.anim-fade-up { animation: fadeUp 0.7s ease forwards; }
.anim-fade-in { animation: fadeIn 0.6s ease forwards; }
.anim-slide-left { animation: slideLeft 0.7s ease forwards; }
.anim-slide-right { animation: slideRight 0.7s ease forwards; }

/* Stagger children */
.stagger > * { opacity: 0; }
.stagger > *:nth-child(1) { animation: fadeUp 0.5s ease 0.1s forwards; }
.stagger > *:nth-child(2) { animation: fadeUp 0.5s ease 0.2s forwards; }
.stagger > *:nth-child(3) { animation: fadeUp 0.5s ease 0.3s forwards; }
.stagger > *:nth-child(4) { animation: fadeUp 0.5s ease 0.4s forwards; }
.stagger > *:nth-child(5) { animation: fadeUp 0.5s ease 0.5s forwards; }
.stagger > *:nth-child(6) { animation: fadeUp 0.5s ease 0.6s forwards; }
.stagger > *:nth-child(7) { animation: fadeUp 0.5s ease 0.7s forwards; }
.stagger > *:nth-child(8) { animation: fadeUp 0.5s ease 0.8s forwards; }

/* ---------- Noise Texture Overlay ---------- */
.noise-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.015;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* ---------- Header ---------- */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  z-index: 1000;
  background: rgba(10, 11, 26, 0.85);
  backdrop-filter: blur(20px) saturate(1.2);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}
.logo {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo span { color: var(--accent-gold); }
.logo .logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-cyan));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 18px;
  color: var(--bg-deep);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-links a {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: all 0.3s;
  white-space: nowrap;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--accent-gold);
  background: rgba(240, 180, 41, 0.08);
}
.mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 15px;
  padding: 14px 32px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  text-decoration: none;
}
.btn-gold {
  background: linear-gradient(135deg, var(--accent-gold), #d97706);
  color: var(--bg-deep);
  box-shadow: 0 4px 20px var(--gold-glow);
}
.btn-gold:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px var(--gold-glow);
  color: var(--bg-deep);
}
.btn-outline {
  background: transparent;
  color: var(--accent-cyan);
  border: 2px solid var(--accent-cyan);
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.1);
}
.btn-outline:hover {
  background: rgba(34, 211, 238, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 0 30px var(--cyan-glow);
  color: var(--accent-cyan);
}
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  color: var(--accent-gold);
  border-color: var(--accent-gold);
  background: rgba(240, 180, 41, 0.05);
}
.btn-sm {
  padding: 10px 20px;
  font-size: 13px;
}

/* ---------- Sections ---------- */
.section {
  padding: 100px 0;
  position: relative;
}
.section-header {
  text-align: center;
  margin-bottom: 60px;
}
.section-header .section-desc {
  margin: 0 auto;
}

/* ---------- Footer ---------- */
.footer {
  background: var(--bg-deep);
  border-top: 1px solid var(--border);
  padding: 60px 0 30px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.5fr;
  gap: 40px;
  margin-bottom: 40px;
}
.footer-brand p {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 16px;
  line-height: 1.7;
}
.footer-col h4 {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.footer-col a,
.footer-col p {
  display: block;
  color: var(--text-muted);
  font-size: 14px;
  padding: 6px 0;
  transition: color 0.3s;
}
.footer-col a:hover { color: var(--accent-gold); }
.footer-contact .contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 14px;
  padding: 6px 0;
}
.footer-contact .contact-item .icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
}
.footer-links {
  display: flex;
  gap: 16px;
}

/* ---------- Page Hero ---------- */
.page-hero {
  padding: 140px 0 80px;
  position: relative;
  overflow: hidden;
}
.page-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(240, 180, 41, 0.06) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.page-hero-sm {
  padding: 120px 0 60px;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent-cyan); }
.breadcrumb .sep { color: var(--border-light); }

/* ---------- Card Base ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 32px;
  transition: all 0.3s ease;
}
.card:hover {
  border-color: var(--accent-gold);
  transform: translateY(-4px);
  box-shadow: 0 8px 32px var(--shadow);
}

/* ---------- Matomo Notice ---------- */
.matomo-notice { display: none; }

/* ---------- Particles canvas for hero ---------- */
#particle-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* ============================================================
   RESPONSIVE — Comprehensive Mobile Override
   These rules override inline styles where possible.
   ============================================================ */

/* ---------- Tablet (≤1024px) ---------- */
@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .page-hero { padding: 120px 0 60px; }
  .container { padding: 0 20px; }
}

/* ---------- Mobile (≤768px) ---------- */
@media (max-width: 768px) {
  :root { --header-h: 64px; --radius-md: 12px; }

  /* Header & Nav — smoother slide-down */
  .nav-links {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0; right: 0;
    background: rgba(10, 11, 26, 0.98);
    backdrop-filter: blur(16px);
    flex-direction: column;
    padding: 8px 16px 16px;
    border-bottom: 1px solid var(--border);
    gap: 2px;
    box-shadow: 0 16px 40px rgba(0,0,0,0.5);
  }
  .nav-links.open { display: flex; }
  .nav-links a {
    padding: 14px 16px;
    width: 100%;
    white-space: normal;
    font-size: 15px;
    border-radius: 10px;
    text-align: center;
    font-weight: 500;
  }
  .nav-links a:hover,
  .nav-links a.active {
    background: rgba(240,180,41,0.12);
    color: var(--accent-gold);
  }
  .mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
  }
  .mobile-toggle:active {
    background: var(--bg-card-hover);
    transform: scale(0.95);
  }
  .logo { font-size: 20px; }
  .logo .logo-icon { width: 30px; height: 30px; font-size: 15px; }

  /* Spacing */
  .section { padding: 48px 0; }
  .section-header { margin-bottom: 32px; }
  .section-title { font-size: clamp(22px, 6vw, 32px) !important; }
  .section-desc { font-size: 14px; }
  .section-label { font-size: 11px; }

  /* Hero */
  .page-hero { padding: 100px 0 40px; }
  .page-hero-sm { padding: 90px 0 40px; }

  /* ----- Grid: collapse content grids, but keep small-item multi-col ----- */
  /* Hero & content two-column layouts stack */
  .page-hero [style*="grid-template-columns"],
  .section [style*="grid-template-columns:1fr 1fr;gap:60px"],
  .section [style*="grid-template-columns:1fr 1fr;gap:50px"],
  .section [style*="grid-template-columns:1fr 1fr;gap:40px"] {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }

  /* Large content grids (2+ columns with text) collapse to 1 */
  [style*="grid-template-columns:1.2fr 1fr"],
  [style*="grid-template-columns:2fr 1fr"],
  [style*="grid-template-columns:1fr 1.2fr 1fr"],
  [style*="grid-template-columns:2fr 1fr 2fr"],
  [style*="grid-template-columns:1fr 1fr;gap:20px"] {
    grid-template-columns: 1fr !important;
  }
  [style*="min-height:500px"] {
    min-height: auto !important;
  }

  /* ----- Keep 2-column for icon/stat grids on tablets (≥481px) ----- */
  @media (min-width: 481px) {
    [style*="grid-template-columns:repeat(4,1fr)"] { grid-template-columns: repeat(2,1fr) !important; gap: 16px !important; }
    [style*="grid-template-columns:repeat(3,1fr)"] { grid-template-columns: repeat(2,1fr) !important; gap: 16px !important; }
    [style*="grid-template-columns:repeat(5,1fr)"] { grid-template-columns: repeat(3,1fr) !important; gap: 12px !important; }
  }

  /* Schedule rows keep their 3-column layout on tablet */
  [style*="grid-template-columns:120px"],
  [style*="grid-template-columns: 120px"] {
    grid-template-columns: 90px 1fr auto !important;
    gap: 10px !important;
    padding: 12px 16px !important;
  }

  /* Cards */
  .card, [class*="card"] {
    padding: 20px !important;
  }
  .card:hover {
    transform: translateY(-2px);
  }

  /* Buttons */
  .btn {
    padding: 12px 20px;
    font-size: 14px;
    white-space: normal;
  }
  .page-hero .btn,
  [class*="hero"] .btn {
    font-size: 13px;
    padding: 11px 18px;
  }

  /* ---------- Tournament bracket arrows rotate ----- */
  [style*="font-size:24px;color:var(--text-muted);"] {
    transform: rotate(90deg);
    margin: 8px 0;
    font-size: 20px !important;
  }

  /* ---------- Hero countdown / stat cards ---------- */
  [style*="font-size:40px;font-family"] {
    font-size: 28px !important;
  }

  /* ---------- Footer ---------- */
  .footer { padding: 40px 0 24px; }
  .footer-grid { grid-template-columns: 1fr !important; gap: 24px; }
  .footer-bottom {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }
  .footer-links { justify-content: center; flex-wrap: wrap; }

  /* Breadcrumb */
  .breadcrumb { font-size: 12px; }

  /* FAQ — better touch targets */
  .faq-question { font-size: 14px; padding: 16px !important; min-height: 48px; display: flex; align-items: center; }
  .faq-answer { font-size: 13px !important; }

  /* Img */
  img { max-width: 100%; height: auto; }

  /* VIP progress bar */
  [style*="display:flex;justify-content:space-between;margin-top:24px;"] {
    flex-wrap: wrap;
    gap: 12px;
  }
  [style*="display:flex;justify-content:space-between;margin-top:24px;"] > div {
    flex: 0 0 calc(33.33% - 8px);
  }

  /* Media gallery in speed-arena */
  img[src*="arena"] {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: auto;
  }
  /* Phone mockup on bvapp-download */
  [style*="aspect-ratio:3/4"] {
    max-width: 160px !important;
  }

  /* Player spotlight cards */
  [style*="display:flex;align-items:center;gap:16px;"] {
    flex-direction: column !important;
    text-align: center;
  }

  /* Stats counters */
  .stat-number { font-size: 26px !important; }

  /* Hero decoration */
  .page-hero::before {
    width: 300px;
    height: 300px;
  }

  /* Live activity stop stagger */
  .stagger > * {
    opacity: 1 !important;
    animation: none !important;
  }

  /* News grid inner cards keep structure */
  [style*="grid-column:span 2"][style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
}

/* ---------- Small Mobile (≤480px) ---------- */
@media (max-width: 480px) {
  .container { padding: 0 14px; }
  .page-hero { padding: 90px 0 28px; }
  .section { padding: 36px 0; }
  .section-title { font-size: clamp(20px, 7vw, 26px) !important; }
  .card { padding: 16px !important; }
  .breadcrumb { margin-bottom: 10px; font-size: 11px; }
  .header-inner { padding: 0 14px; }

  /* All multi-column becomes 1-col on small phones */
  [style*="grid-template-columns:repeat(4,1fr)"] { grid-template-columns: repeat(2,1fr) !important; gap: 12px !important; }
  [style*="grid-template-columns:repeat(3,1fr)"] { grid-template-columns: repeat(2,1fr) !important; gap: 12px !important; }
  [style*="grid-template-columns:repeat(5,1fr)"] { grid-template-columns: repeat(3,1fr) !important; gap: 10px !important; }

  /* Schedule rows go 1-col */
  [style*="grid-template-columns:120px"],
  [style*="grid-template-columns: 120px"] {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
    text-align: center;
    padding: 12px !important;
  }

  /* Hero heading shrink */
  h1 {
    font-size: clamp(22px, 9vw, 28px) !important;
  }

  /* Calendar */
  [style*="grid-template-columns:repeat(7,1fr)"] {
    gap: 3px !important;
  }
  [style*="grid-template-columns:repeat(7,1fr)"] span {
    font-size: 10px !important;
    padding: 2px;
  }

  /* Footer */
  .footer { padding: 32px 0 20px; }
  .footer-brand p { font-size: 13px; }

  /* Partner logos */
  [style*="min-height:80px"] {
    min-height: 56px !important;
    padding: 16px 10px !important;
  }
  [style*="min-height:80px"] span {
    font-size: 16px !important;
  }

  /* Friend system rows */
  [style*="grid-template-columns:30px"] {
    grid-template-columns: 24px 1fr auto !important;
    gap: 8px !important;
  }

  /* Hero buttons go full width */
  .page-hero .btn {
    flex: 1;
    min-width: 0;
    justify-content: center;
    font-size: 13px;
  }

  /* Community stat columns */
  [style*="grid-template-columns:1fr 1fr 1fr;gap:20px;margin-top:24px"] {
    grid-template-columns: 1fr 1fr 1fr !important;
    gap: 12px !important;
  }

  /* Game mode cards */
  [style*="padding:32px 16px"] {
    padding: 16px 12px !important;
  }
  [style*="padding:40px 24px"] {
    padding: 20px 16px !important;
  }

  /* Hero countdown card */
  [style*="padding:32px;text-align:center;border-color:var(--accent-red)"] {
    padding: 20px 16px !important;
  }

  /* Live activity numbers smaller */
  [style*="font-size:40px;color:var(--accent-gold);font-weight:700"] {
    font-size: 30px !important;
  }
  [style*="font-size:40px;color:var(--accent-cyan);font-weight:700"] {
    font-size: 30px !important;
  }

  /* Sign-up section */
  [style*="padding:48px;border-color:var(--accent-gold)"] {
    padding: 24px 16px !important;
  }

  /* Streamer cards */
  [style*="display:flex;align-items:center;gap:16px"] {
    padding: 16px !important;
  }

  /* Leaderboard rows */
  [style*="margin-bottom:12px;font-size:15px"] {
    font-size: 14px !important;
  }

  /* Hero decoration */
  .page-hero::before {
    width: 200px;
    height: 200px;
  }
}

/* ---------- Small height fix for particles canvas ---------- */
@media (max-height: 500px) {
  .page-hero { padding: 80px 0 24px; }
}

/* ---------- Landscape phones ---------- */
@media (max-height: 480px) and (orientation: landscape) {
  .page-hero { padding: 80px 0 20px; }
  .section { padding: 28px 0; }
  .section-header { margin-bottom: 20px; }
}
