:root {
  --primary-color: #11A84E;
  --secondary-color: #22C768;
  --text-main-color: #F2FFF6;
  --text-secondary-color: #A7D9B8;
  --background-color: #08160F;
  --card-bg-color: #11271B;
  --border-color: #2E7A4E;
  --glow-color: #57E38D;
  --gold-color: #F2C14E;
  --divider-color: #1E3A2A;
  --deep-green-color: #0A4B2C;

  /* Neon specific colors, dynamically chosen from theme */
  --neon-primary: #57E38D;
  --neon-secondary: #2AD16F;
  --neon-accent: #F2C14E;

  /* Header offsets - with marquee */
  --header-offset: 166px;
}

/* General Body Styling */
body {
  font-family: 'Arial', sans-serif;
  margin: 0;
  padding-top: var(--header-offset); /* CRITICAL: Only place for header offset */
  background-color: var(--background-color);
  color: var(--text-main-color);
  line-height: 1.6;
  overflow-x: hidden; /* Prevent horizontal scroll on desktop */
}

/* Basic Neon Glow Animations (CRITICAL: Must be dynamic colors) */
@keyframes rainbow-border {
  0% { border-color: #ff0000; box-shadow: 0 0 10px #ff0000, 0 0 20px #ff0000; }
  16.6% { border-color: #ff8000; box-shadow: 0 0 10px #ff8000, 0 0 20px #ff8000; }
  33.3% { border-color: #ffff00; box-shadow: 0 0 10px #ffff00, 0 0 20px #ffff00; }
  50% { border-color: #00ff00; box-shadow: 0 0 10px #00ff00, 0 0 20px #00ff00; }
  66.6% { border-color: #0000ff; box-shadow: 0 0 10px #0000ff, 0 0 20px #0000ff; }
  83.3% { border-color: #8000ff; box-shadow: 0 0 10px #8000ff, 0 0 20px #8000ff; }
  100% { border-color: #ff0000; box-shadow: 0 0 10px #ff0000, 0 0 20px #ff0000; }
}

@keyframes hue-spin {
  0% { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}

@keyframes alternate-colors {
  0% { border-color: var(--neon-primary); box-shadow: 0 0 10px var(--neon-primary), 0 0 20px var(--neon-primary); }
  100% { border-color: var(--neon-secondary); box-shadow: 0 0 10px var(--neon-secondary), 0 0 20px var(--neon-secondary); }
}

@keyframes gradient-flow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes random-glow {
  0% { border-color: #ff00ff; box-shadow: 0 0 20px #ff00ff; }
  20% { border-color: #00ffff; box-shadow: 0 0 20px #00ffff; }
  40% { border-color: #ffff00; box-shadow: 0 0 20px #ffff00; }
  60% { border-color: #00ff00; box-shadow: 0 0 20px #00ff00; }
  80% { border-color: #ff0000; box-shadow: 0 0 20px #ff0000; }
  100% { border-color: #ff00ff; box-shadow: 0 0 20px #ff00ff; }
}

@keyframes theme-colors {
  0%, 100% {
    border-color: var(--neon-primary);
    box-shadow:
      0 0 10px var(--neon-primary),
      0 0 20px var(--neon-primary);
  }
  33% {
    border-color: var(--neon-secondary);
    box-shadow:
      0 0 10px var(--neon-secondary),
      0 0 20px var(--neon-secondary);
  }
  66% {
    border-color: var(--neon-accent);
    box-shadow:
      0 0 10px var(--neon-accent),
      0 0 20px var(--neon-accent);
  }
}

@keyframes neon-flicker {
  0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% { opacity: 1; box-shadow: 0 0 10px currentColor, 0 0 20px currentColor, 0 0 30px currentColor, inset 0 0 15px currentColor; }
  20%, 24%, 55% { opacity: 0.8; box-shadow: 0 0 5px currentColor, 0 0 10px currentColor, 0 0 15px currentColor, inset 0 0 10px currentColor; }
}

@keyframes pulse-glow {
  from { box-shadow: 0 0 5px currentColor, 0 0 10px currentColor; }
  to { box-shadow: 0 0 15px currentColor, 0 0 30px currentColor, 0 0 45px currentColor; }
}

@keyframes led-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0.3; }
}

@keyframes text-glow-flow {
  0% {
    text-shadow:
      0 0 5px var(--neon-primary),
      0 0 10px var(--neon-primary),
      0 0 15px var(--neon-primary);
    color: var(--text-main-color);
  }
  50% {
    text-shadow:
      0 0 5px var(--neon-secondary),
      0 0 10px var(--neon-secondary),
      0 0 15px var(--neon-secondary);
    color: var(--text-main-color);
  }
  100% {
    text-shadow:
      0 0 5px var(--neon-accent),
      0 0 10px var(--neon-accent),
      0 0 15px var(--neon-accent);
    color: var(--text-main-color);
  }
}

/* CRITICAL: Marquee Section Styles */
.marquee-section {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 44px; /* Desktop fixed height */
  box-sizing: border-box;
  background: linear-gradient(135deg, #0a0a0a, #1a1a2e, #16213e); /* Dark background */
  color: #ffffff;
  overflow: hidden;
  border-bottom: 2px solid;
  animation: theme-colors 4s ease-in-out infinite; /* Dynamic color border */
  box-shadow:
    0 0 10px var(--neon-primary),
    0 0 20px var(--neon-primary),
    0 0 30px var(--neon-primary),
    inset 0 0 20px rgba(255, 0, 255, 0.1);
  z-index: 1001; /* Ensure above header */
}

.marquee-container {
  width: 100%;
  max-width: 100%;
  height: 100%;
  margin: 0 auto;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 0 20px;
  box-sizing: border-box;
}

.marquee-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  z-index: 2;
  position: relative;
}

.marquee-icon-emoji {
  font-size: 24px;
  display: inline-block;
  animation: marquee-pulse 2s ease-in-out infinite, text-glow-flow 3s ease-in-out infinite alternate; /* Dynamic glow */
  text-shadow:
    0 0 5px var(--neon-primary),
    0 0 10px var(--neon-primary),
    0 0 15px var(--neon-primary);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

@keyframes marquee-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.9; }
}

.marquee-wrapper {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.marquee-content {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  animation: marquee-scroll 30s linear infinite;
  gap: 30px;
}

.marquee-text {
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  text-decoration: none;
  text-shadow:
    0 0 5px var(--neon-primary),
    0 0 10px var(--neon-primary),
    0 0 15px var(--neon-primary);
  line-height: 1.5;
  display: inline-block;
  vertical-align: middle;
  animation: text-glow-flow 3s ease-in-out infinite alternate; /* Dynamic glow */
  cursor: pointer;
  transition: all 0.3s ease;
}

.marquee-text:hover {
  text-shadow:
    0 0 10px var(--neon-primary),
    0 0 20px var(--neon-primary),
    0 0 30px var(--neon-primary),
    0 0 40px var(--neon-primary);
  transform: scale(1.05);
  color: #ffffff;
}

.marquee-separator {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.6);
  margin: 0 15px;
  text-shadow:
    0 0 3px var(--neon-primary),
    0 0 6px var(--neon-primary);
}

@keyframes marquee-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* CRITICAL: Site Header Styles (Desktop First) */
.site-header {
  position: fixed;
  top: 44px; /* Below marquee on desktop */
  left: 0;
  width: 100%;
  background: linear-gradient(135deg, #0a0a0a, #1a1a2e, #16213e); /* Dark background */
  z-index: 1000; /* Below marquee, above content */
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.header-top {
  box-sizing: border-box;
  min-height: 68px;
  height: 68px;
  display: flex;
  align-items: center;
  overflow: hidden;
  border-bottom: 2px solid;
  animation: theme-colors 4s ease-in-out infinite; /* Dynamic color border */
  box-shadow:
    0 0 10px var(--neon-accent), /* Different glow color for top bar */
    0 0 20px var(--neon-accent),
    inset 0 0 15px rgba(242, 193, 78, 0.15);
}

.header-container {
  box-sizing: border-box;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px; /* Padding for logo and buttons */
}

.logo {
  color: #ffffff; /* CRITICAL: Regular style, no neon glow for logo */
  font-size: 24px;
  font-weight: bold;
  text-decoration: none;
  display: flex; /* For potential image logo centering on mobile */
  align-items: center;
  justify-content: flex-start; /* Desktop: align left */
  height: 100%;
}
.logo img {
  display: block;
  max-height: 60px; /* Desktop max height */
  height: auto;
  width: auto;
  max-width: 280px;
  object-fit: contain;
}

.hamburger-menu {
  display: none; /* Hidden on desktop */
}

.desktop-nav-buttons {
  display: flex; /* Visible on desktop */
  gap: 10px;
  align-items: center;
}

.mobile-nav-buttons {
  display: none; /* Hidden on desktop */
}

.main-nav {
  box-sizing: border-box;
  min-height: 52px;
  height: 52px;
  display: flex; /* Desktop: visible and horizontal */
  flex-direction: row;
  align-items: center;
  overflow: hidden;
  background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460); /* Different dark background for contrast */
  border-top: 2px solid;
  animation: theme-colors 4s ease-in-out infinite reverse; /* Dynamic color border, reversed for contrast */
  box-shadow:
    0 0 10px var(--neon-primary), /* Different glow color for main nav */
    0 0 20px var(--neon-primary),
    inset 0 0 15px rgba(87, 227, 141, 0.15);
}

.nav-container {
  box-sizing: border-box;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
}

.nav-link {
  color: var(--text-main-color);
  text-decoration: none;
  padding: 10px 15px;
  font-size: 16px;
  font-weight: 500;
  transition: color 0.3s ease, text-shadow 0.3s ease;
  white-space: nowrap;
}

.nav-link:hover, .nav-link.active {
  color: var(--neon-primary);
  text-shadow:
    0 0 5px var(--neon-primary),
    0 0 10px var(--neon-primary);
}

/* Button Styling (Neon, Dynamic Colors) */
.btn {
  position: relative;
  background: linear-gradient(180deg, #2AD16F 0%, #13994A 100%); /* Custom button gradient */
  padding: 12px 20px;
  color: #ffffff;
  text-decoration: none;
  border-radius: 5px;
  border: 2px solid;
  animation: theme-colors 4s ease-in-out infinite; /* Dynamic color border */
  text-shadow:
    0 0 5px #ffffff,
    0 0 10px var(--neon-primary);
  transition: all 0.3s ease;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover {
  animation-duration: 2s; /* Faster animation on hover */
  transform: translateY(-2px);
  box-shadow:
    0 0 15px var(--neon-primary),
    0 0 30px var(--neon-primary),
    inset 0 0 15px rgba(87, 227, 141, 0.4);
}

/* Hamburger Menu Icon */
.hamburger-menu {
  width: 30px;
  height: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  position: relative;
  z-index: 1002; /* Above logo on mobile */
}

.hamburger-menu span {
  display: block;
  height: 3px;
  width: 100%;
  background: var(--neon-primary);
  border-radius: 3px;
  transition: all 0.3s ease-in-out;
  box-shadow:
    0 0 5px var(--neon-primary),
    0 0 10px var(--neon-primary);
}

.hamburger-menu.active span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.hamburger-menu.active span:nth-child(2) {
  opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 999; /* Below main-nav and hamburger */
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
  display: block;
  opacity: 1;
}

/* CRITICAL: Footer Styles */
.site-footer {
  background-color: var(--deep-green-color); /* Dark background for footer */
  color: var(--text-secondary-color);
  padding: 40px 20px 20px;
  font-size: 14px;
  line-height: 1.8;
}

.footer-top-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 30px;
  max-width: 1200px;
  margin: 0 auto 30px;
  padding-bottom: 30px;
  border-bottom: 1px solid var(--divider-color);
}

.footer-col {
  display: flex;
  flex-direction: column;
}

.footer-logo {
  color: var(--text-main-color);
  font-size: 22px;
  font-weight: bold;
  text-decoration: none;
  margin-bottom: 15px;
}

.footer-description {
  color: var(--text-secondary-color);
  word-wrap: break-word; /* CRITICAL: Ensure full text display */
  overflow-wrap: break-word;
  line-height: 1.6;
}

.footer-heading {
  color: var(--text-main-color);
  font-size: 18px;
  margin-bottom: 15px;
  font-weight: bold;
}

.footer-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-nav li {
  margin-bottom: 8px;
}

.footer-nav a {
  color: var(--text-secondary-color);
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-nav a:hover {
  color: var(--primary-color);
}

.footer-dynamic-row {
  max-width: 1200px;
  margin: 20px auto;
  padding: 15px 0;
  border-top: 1px solid var(--divider-color);
  border-bottom: 1px solid var(--divider-color);
}

.footer-slot-anchor-inner {
  display: flex;
  flex-wrap: wrap;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px; /* For mid slots */
  width: 100%;
}

.footer-col.footer-dynamic-col .footer-slot-anchor-inner {
  gap: 5px; /* For col 4 slot */
}

.footer-slot-anchor-inner img {
  max-height: 50px;
  height: auto;
  width: auto;
  object-fit: contain;
}

.footer-bottom {
  text-align: center;
  padding-top: 20px;
  max-width: 1200px;
  margin: 0 auto;
  border-top: 1px solid var(--divider-color); /* Add border for visual separation */
}
.footer-bottom p {
  margin: 0;
  color: var(--text-secondary-color);
}

/* CRITICAL: Mobile Responsive Styles */
@media (max-width: 768px) {
  :root {
    --header-offset: 146px; /* Mobile header offset */
  }

  body {
    padding-top: var(--header-offset);
    overflow-x: hidden; /* CRITICAL: Prevent horizontal scroll */
  }

  .page-content img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
  }
  .page-content {
    overflow-x: hidden;
    max-width: 100%;
  }

  /* Marquee Mobile */
  .marquee-section {
    height: 36px !important; /* Mobile fixed height */
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }
  .marquee-container {
    gap: 10px !important;
    padding: 0 12px !important;
    height: 100% !important;
  }
  .marquee-icon {
    width: 20px !important;
    height: 20px !important;
  }
  .marquee-icon-emoji {
    font-size: 14px !important;
  }
  .marquee-text {
    font-size: 14px !important;
  }
  .marquee-separator {
    font-size: 14px !important;
    margin: 0 10px !important;
  }
  .marquee-content {
    gap: 20px;
    animation: marquee-scroll 25s linear infinite;
  }

  /* Header Mobile */
  .site-header {
    top: 36px; /* Below marquee on mobile */
  }

  .header-top {
    min-height: 60px;
    height: 60px;
    border-bottom: none; /* Remove border for cleaner mobile look */
    box-shadow: none; /* Remove shadow for cleaner mobile look */
  }

  .header-container {
    width: 100%;
    max-width: none; /* CRITICAL: No max-width on mobile container */
    padding: 0 15px;
    justify-content: space-between;
  }

  .hamburger-menu {
    display: flex; /* Visible on mobile */
    order: 1; /* Left side */
  }

  .logo {
    flex: 1 !important; /* CRITICAL: Mobile Logo Centering (Method 1) */
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    order: 2; /* Center */
    font-size: 20px;
    height: auto;
  }
  .logo img {
    max-height: 40px !important; /* Mobile max height */
  }

  .desktop-nav-buttons {
    display: none; /* Hidden on mobile */
  }

  .mobile-nav-buttons {
    display: flex !important; /* CRITICAL: Visible on mobile */
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 10px 15px; /* Padding for buttons */
    overflow: hidden;
    gap: 10px; /* Spacing between buttons */
    justify-content: center;
    flex-wrap: nowrap; /* CRITICAL: No wrapping, max 2 buttons in one row */
    background: linear-gradient(135deg, #0a0a0a, #1a1a2e); /* Dark background */
    border-bottom: 1px solid var(--divider-color);
  }

  .mobile-nav-buttons .btn {
    flex: 1; /* CRITICAL: Equal width for buttons */
    min-width: 0;
    max-width: calc(50% - 5px); /* CRITICAL: Max width considering gap */
    box-sizing: border-box;
    white-space: normal; /* Allow text to wrap */
    word-wrap: break-word;
    overflow-wrap: break-word;
    padding: 8px 12px; /* CRITICAL: Smaller padding */
    font-size: 13px; /* CRITICAL: Smaller font size */
  }

  .main-nav {
    display: none; /* CRITICAL: Hidden by default on mobile */
    position: fixed; /* CRITICAL: Fixed position for mobile menu */
    top: var(--header-offset); /* Position below header */
    left: 0;
    width: 80%;
    max-width: 300px;
    height: calc(100% - var(--header-offset));
    flex-direction: column; /* Vertical layout */
    background: linear-gradient(135deg, #0a0a0a, #1a1a2e, #16213e); /* Dark background */
    padding: 20px 0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
    transform: translateX(-100%); /* CRITICAL: Off-screen by default */
    transition: transform 0.3s ease-in-out;
    z-index: 1000; /* CRITICAL: Ensure menu is above overlay */
    border-right: 2px solid;
    animation: theme-colors 4s ease-in-out infinite; /* Dynamic color border */
  }

  .main-nav.active {
    display: flex; /* CRITICAL: Show menu when active */
    transform: translateX(0); /* Slide in */
  }

  .nav-container {
    flex-direction: column;
    align-items: flex-start;
    padding: 0 15px;
  }

  .nav-link {
    width: 100%;
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 16px;
  }
  .nav-link:last-child {
    border-bottom: none;
  }

  /* Footer Mobile */
  .footer-top-grid {
    grid-template-columns: 1fr; /* Single column on mobile */
    gap: 20px;
    margin-bottom: 20px;
  }
  .footer-col {
    padding-bottom: 15px;
    border-bottom: 1px solid var(--divider-color);
  }
  .footer-col:last-of-type {
    border-bottom: none;
  }
  .footer-logo {
    font-size: 20px;
  }
  .footer-heading {
    font-size: 16px;
  }
  .footer-nav li {
    margin-bottom: 5px;
  }
  .footer-dynamic-row {
    margin: 15px auto;
    padding: 10px 0;
  }
}

/* Ensure body does not scroll when menu is open */
body.no-scroll {
  overflow: hidden;
}

/* For page content sections, add a small padding-top for visual separation, but NOT header-offset */
.page-xxx {
  padding-top: 10px; /* Small decorative top padding, not header-offset */
}
/* 移动端内容区防溢出（系统追加，请勿删除） */
@media (max-width: 768px) {
  .page-content img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
  }
  .page-content {
    overflow-x: hidden;
    max-width: 100%;
  }
  body {
    overflow-x: hidden;
  }
}
