:root {
  --primary-color: #017439;
  --secondary-color: #FFFFFF;
  --btn-register-bg: #C30808;
  --btn-login-bg: #C30808;
  --btn-text-color: #FFFFFF; /* Changed from #FFFF00 for WCAG AA contrast compliance */
  --header-offset: 110px; /* Desktop: header-top (60px) + main-nav (50px) */
}
@media (max-width: 768px) {
  :root {
    --header-offset: 105px; /* Mobile: header-top (60px) + mobile-nav-buttons (45px) */
  }
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding-top: var(--header-offset); /* Ensure content is not hidden by fixed header */
  color: #333;
  line-height: 1.6;
  overflow-x: hidden; /* Prevents horizontal scroll on body */
}

body.no-scroll {
  overflow: hidden;
}

/* Shared container styles */
.header-container, .nav-container, .footer-container {
  max-width: 1200px;
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;
}

/* Site Header - Fixed Navigation */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  background-color: var(--secondary-color); /* Fallback, specific sections will override */
}

/* Header Top Section (Desktop: Logo left, Buttons right) */
.header-top {
  background-color: var(--primary-color); /* Dark green for top bar */
  color: var(--secondary-color);
  padding: 15px 0;
  min-height: 60px; /* Ensure minimum height */
  display: flex;
  align-items: center;
}

.header-top .header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Logo */
.logo {
  font-size: 28px;
  font-weight: bold;
  color: var(--secondary-color);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.5px;
}

/* Desktop Nav Buttons */
.desktop-nav-buttons {
  display: flex;
  gap: 10px;
}

.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: bold;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-register, .btn-login {
  background-color: var(--btn-register-bg);
  color: var(--btn-text-color);
  border: 1px solid var(--btn-register-bg);
}

.btn-register:hover, .btn-login:hover {
  filter: brightness(1.15);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Main Navigation Section (Desktop: Menu centered) */
.main-nav {
  background-color: #2e8b57; /* A lighter shade of green for menu bar, contrasting with primary */
  padding: 10px 0;
  display: flex; /* Desktop default: flex */
  flex-direction: row; /* Desktop default: row */
  position: static; /* Desktop default: static */
  min-height: 50px;
  align-items: center;
}

.main-nav .nav-container {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap; /* Allow wrapping on smaller desktop screens */
  gap: 15px;
}

.nav-link {
  color: var(--secondary-color);
  text-decoration: none;
  padding: 10px 15px;
  font-weight: bold;
  transition: background-color 0.3s ease, color 0.3s ease;
  border-radius: 4px;
  white-space: nowrap;
  font-size: 15px;
}

.nav-link:hover, .nav-link.active {
  background-color: rgba(255, 255, 255, 0.2);
}

/* Hamburger Menu (Mobile Only) */
.hamburger-menu {
  display: none; /* Hidden by default on desktop */
  width: 30px;
  height: 24px;
  position: relative;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  z-index: 1001; /* Above logo and buttons */
  grid-column: 1 / 2; /* For mobile grid layout */
  justify-self: start;
  align-self: center;
}

.hamburger-menu span {
  display: block;
  width: 100%;
  height: 3px;
  background-color: var(--secondary-color);
  position: absolute;
  left: 0;
  transition: all 0.3s ease-in-out;
}

.hamburger-menu span:nth-child(1) { top: 0; }
.hamburger-menu span:nth-child(2) { top: 50%; transform: translateY(-50%); }
.hamburger-menu span:nth-child(3) { bottom: 0; }

.hamburger-menu.active span:nth-child(1) {
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
}
.hamburger-menu.active span:nth-child(2) {
  opacity: 0;
}
.hamburger-menu.active span:nth-child(3) {
  bottom: 50%;
  transform: translateY(50%) rotate(-45deg);
}

/* Mobile Nav Buttons (Mobile Only) */
.mobile-nav-buttons {
  display: none; /* Hidden by default on desktop */
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 999;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

/* Footer */
.site-footer {
  background-color: #222;
  color: #f8f8f8;
  padding: 40px 0 20px;
  font-size: 14px;
  border-top: 5px solid var(--primary-color);
}

.site-footer .footer-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 30px;
}

.footer-column {
  flex: 1;
  min-width: 200px;
}

.footer-logo {
  font-size: 24px;
  font-weight: bold;
  color: var(--secondary-color);
  text-decoration: none;
  margin-bottom: 15px;
  display: block;
  letter-spacing: -0.5px;
}

.footer-column h3 {
  font-size: 18px;
  margin-bottom: 20px;
  color: var(--primary-color);
  text-transform: uppercase;
}

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

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

.footer-nav a {
  color: #ccc;
  text-decoration: none;
  transition: color 0.3s ease;
}

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

.footer-bottom {
  border-top: 1px solid #444;
  padding-top: 20px;
  margin-top: 40px;
  text-align: center;
}

.footer-bottom p {
  margin: 0;
  color: #bbb;
}

/* Responsive Styles */
@media (max-width: 768px) {
  .header-container, .nav-container, .footer-container {
    width: 100%;
    max-width: none;
    padding-left: 15px;
    padding-right: 15px;
  }

  /* Header Top Mobile Layout: Hamburger left, Logo centered */
  .header-top .header-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr; /* Hamburger | Logo | Empty space */
    align-items: center;
    padding-left: 15px;
    padding-right: 15px;
  }

  .hamburger-menu {
    display: block;
    grid-column: 1 / 2;
  }

  .logo {
    grid-column: 2 / 3;
    text-align: center;
    font-size: 24px;
    /* Using the specified flexbox method for image/text logo centering */
    flex: 1 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
  }

  .desktop-nav-buttons {
    display: none;
  }

  /* Mobile Nav Buttons (Always visible below header-top) */
  .mobile-nav-buttons {
    display: flex !important;
    width: 100%; max-width: 100%;
    box-sizing: border-box;
    padding: 10px 15px; /* Adjust padding for better look */
    overflow: hidden;
    gap: 10px;
    flex-wrap: nowrap;
    background-color: var(--primary-color); /* Same as header-top for consistency */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05); /* Subtle shadow */
    min-height: 45px;
  }

  .mobile-nav-buttons .btn {
    flex: 1; min-width: 0;
    max-width: calc(50% - 5px); /* Account for gap */
    box-sizing: border-box;
    padding: 8px 12px;
    font-size: 13px;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.2;
  }

  /* Main Navigation Mobile (Hidden by default, slides in) */
  .main-nav {
    display: none; /* Hidden by default */
    position: fixed;
    top: var(--header-offset); /* Start below the fixed header */
    left: 0;
    width: 280px; /* Width of the mobile menu */
    height: calc(100% - var(--header-offset));
    background-color: #f8f8f8; /* Light background for mobile menu */
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.2);
    transform: translateX(-100%); /* Off-screen to the left */
    transition: transform 0.3s ease-in-out;
    flex-direction: column; /* Vertical layout */
    align-items: flex-start;
    padding-top: 20px;
    overflow-y: auto;
  }

  .main-nav.active {
    display: flex; /* Show the menu */
    transform: translateX(0); /* Slide into view */
  }

  .main-nav .nav-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 0; /* Remove gap for vertical links */
    padding: 0 15px;
    width: 100%;
  }

  .nav-link {
    color: #333;
    width: 100%;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    border-radius: 0;
  }

  .nav-link:hover, .nav-link.active {
    background-color: #eee;
    color: var(--primary-color);
  }

  /* Footer Responsive */
  .site-footer .footer-container {
    flex-direction: column;
    gap: 20px;
  }

  .footer-column {
    min-width: unset;
    width: 100%;
  }

  .footer-brand p {
    text-align: left;
  }

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

/* Payment Methods 图标容器样式 */
.payment-icons {
  display: flex;
  flex-wrap: wrap;
  flex-direction: row;
  align-items: flex-start;
  gap: 5px;
}

.payment-icons img,
.payment-icon {
  max-height: 50px;
  height: auto;
  width: auto;
  display: block;
}

/* Game Providers 图标容器样式 */
.game-providers-icons {
  display: flex;
  flex-wrap: wrap;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
}

.game-providers-icons img,
.game-provider-icon {
  max-height: 50px;
  height: auto;
  width: auto;
  display: block;
}

/* Social Media 图标容器样式 */
.social-media-icons {
  display: flex;
  flex-wrap: wrap;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
}

.social-media-icons img,
.social-media-icon {
  max-height: 50px;
  height: auto;
  width: auto;
  display: block;
}
/* 移动端内容区防溢出（系统追加，请勿删除） */
@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;
  }
}
