:root {
  --primary-color: #017439;
  --secondary-color: #FFFFFF;
  --button-bg-color: #C30808;
  --button-text-color: #FFFF00;
  --header-top-bg: var(--primary-color);
  --main-nav-bg: #00502a; /* Slightly darker green for contrast */
  --header-offset: 122px; /* 68px (header-top) + 52px (main-nav) + 2px buffer */
}

body {
  padding-top: var(--header-offset);
  margin: 0;
  font-family: Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  overflow-x: hidden; /* Global overflow-x hidden for safety */
}

/* --- Site Header --- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  background-color: var(--secondary-color); /* Fallback, actual sections have specific colors */
  box-sizing: border-box;
}

/* Header Top Area */
.header-top {
  box-sizing: border-box;
  height: 68px; /* Fixed height for desktop */
  display: flex;
  align-items: center;
  background-color: var(--header-top-bg);
  color: var(--secondary-color);
  width: 100%;
}

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

.site-header .logo {
  font-size: 28px;
  font-weight: bold;
  color: var(--secondary-color);
  text-decoration: none;
  display: flex; /* Use flex for logo to help with potential image centering */
  align-items: center;
  height: 100%; /* Occupy full height of header-top */
}
.site-header .logo img {
  display: block;
  max-height: 60px; /* Max height for desktop logo */
  height: auto;
  width: auto;
  max-width: 280px;
  object-fit: contain;
}

/* Desktop Navigation Buttons */
.desktop-nav-buttons {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Mobile Navigation Buttons (hidden on desktop) */
.mobile-nav-buttons {
  box-sizing: border-box;
  display: none; /* Hidden by default on desktop */
  min-height: 48px; /* Min-height for mobile button bar */
  background-color: var(--primary-color); /* Example background for mobile button bar */
}

/* Hamburger Menu (hidden on desktop) */
.hamburger-menu {
  display: none; /* Hidden by default on desktop */
  width: 30px;
  height: 24px;
  cursor: pointer;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  z-index: 1001; /* Above header */
}

.hamburger-menu .bar {
  display: block;
  width: 100%;
  height: 3px;
  background-color: var(--secondary-color);
  transition: all 0.3s ease;
  border-radius: 2px;
}

.hamburger-menu.active .bar:nth-child(1) {
  transform: translateY(10px) rotate(45deg);
}
.hamburger-menu.active .bar:nth-child(2) {
  opacity: 0;
}
.hamburger-menu.active .bar:nth-child(3) {
  transform: translateY(-10px) rotate(-45deg);
}

/* Main Navigation Area */
.main-nav {
  box-sizing: border-box;
  height: 52px; /* Fixed height for desktop */
  display: flex; /* Display as flex on desktop */
  align-items: center;
  background-color: var(--main-nav-bg);
  color: var(--secondary-color);
  width: 100%;
  overflow: hidden; /* Prevent content overflow */
}

.main-nav .nav-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: center; /* Center nav links on desktop */
  align-items: center;
  height: 100%;
  padding: 0 20px; /* Padding for desktop container */
  box-sizing: border-box;
}

.main-nav .nav-link {
  color: var(--secondary-color);
  text-decoration: none;
  padding: 10px 15px;
  font-weight: bold;
  white-space: nowrap;
  transition: background-color 0.3s ease;
  height: 100%; /* Ensure links take full height for alignment */
  display: flex;
  align-items: center;
  box-sizing: border-box;
}

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

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 5px;
  text-decoration: none;
  font-weight: bold;
  transition: all 0.3s ease;
  white-space: nowrap;
  box-sizing: border-box;
  border: none;
  cursor: pointer;
}

.btn-login, .btn-register {
  background-color: var(--button-bg-color);
  color: var(--button-text-color);
}

.btn-login:hover, .btn-register:hover {
  filter: brightness(1.2);
}

/* Overlay for mobile menu */
.overlay {
  display: none; /* Hidden by default */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.overlay.active {
  display: block;
  opacity: 1;
}

/* --- Site Footer --- */
.site-footer {
  background-color: var(--primary-color);
  color: var(--secondary-color);
  padding: 40px 20px 20px;
  font-size: 14px;
  box-sizing: border-box;
}

.footer-top-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto 30px;
  box-sizing: border-box;
}

.footer-col h3 {
  color: var(--secondary-color);
  font-size: 18px;
  margin-bottom: 15px;
  white-space: nowrap;
}

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

.footer-col .footer-description {
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.8;
  word-wrap: break-word; /* Ensure description wraps */
  overflow-wrap: break-word;
}

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

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

.footer-nav a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: color 0.3s ease;
  white-space: nowrap; /* Prevent link text from wrapping */
}

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

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 20px;
  margin-top: 20px;
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
}

/* Dynamic Slot Anchor Styling (must be visible) */
.footer-slot-anchor-inner {
  display: block; 
  min-height: 1px; 
  width: 100%;
}


/* --- Mobile Styles --- */
@media (max-width: 768px) {
  :root {
    --header-offset: 110px; /* 60px (header-top) + 48px (mobile-nav-buttons) + 2px buffer */
  }

  body {
    overflow-x: hidden; /* Prevent horizontal scrolling on mobile */
  }
  .page-content img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
  }
  .page-content {
    overflow-x: hidden;
    max-width: 100%;
  }

  /* Header Top Area (Mobile) */
  .header-top {
    height: 60px !important; /* Fixed height for mobile */
    padding: 0; /* No padding on header-top itself on mobile */
  }

  .header-container {
    padding: 0 15px; /* Padding for mobile container */
    max-width: none; /* No max-width on mobile container */
    justify-content: space-between; /* To push hamburger left and logo to center */
  }
  
  .hamburger-menu {
    display: flex; /* Show hamburger on mobile */
    order: -1; /* Place on far left */
    margin-right: 15px; /* Space between hamburger and logo */
  }

  .site-header .logo {
    flex: 1 !important; /* Take available space */
    display: flex !important;
    justify-content: center !important; /* Center its content (the text/image) */
    align-items: center !important;
    max-width: calc(100% - 70px); /* Adjust max-width to leave space for hamburger and some right padding */
    height: 100%;
    font-size: 24px;
  }
  .site-header .logo img {
    max-height: 56px !important; /* Max height for mobile logo */
  }

  .desktop-nav-buttons {
    display: none !important; /* Hide desktop buttons on mobile */
  }
  
  /* Mobile Navigation Buttons (shown on mobile) */
  .mobile-nav-buttons {
    display: flex !important; /* Show mobile buttons */
    min-height: 48px;
    align-items: center;
    justify-content: center; /* Center buttons */
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0 15px;
    overflow: hidden;
    gap: 10px;
    flex-wrap: nowrap; /* Prevent buttons from wrapping */
    background-color: var(--primary-color); /* Same as header-top or distinct */
  }
  .mobile-nav-buttons .btn {
    flex: 1; /* Distribute space evenly */
    min-width: 0; /* Allow shrinking */
    max-width: calc(50% - 5px); /* Max width for two buttons with 10px gap */
    padding: 8px 12px; /* Smaller padding for mobile buttons */
    font-size: 13px; /* Smaller font size */
    white-space: normal; /* Allow text wrapping */
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  /* Main Navigation Area (Mobile) */
  .main-nav {
    display: none; /* Hidden by default, shown with JS */
    height: auto; /* Auto height for expanded menu */
    min-height: 48px !important; /* Fixed height for mobile nav bar */
    position: fixed;
    top: var(--header-offset); /* Position below fixed header and mobile buttons */
    left: 0;
    width: 70%; /* Adjust width for mobile menu */
    max-width: 300px;
    flex-direction: column;
    transform: translateX(-100%); /* Off-screen by default */
    transition: transform 0.3s ease;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    background-color: var(--main-nav-bg); /* Same as desktop main nav */
    overflow-y: auto; /* Enable scrolling for long menus */
    padding-bottom: 20px; /* Add some padding at the bottom */
  }

  .main-nav.active {
    display: flex; /* Show menu when active */
    transform: translateX(0); /* Slide into view */
  }
  
  .main-nav .nav-container {
    flex-direction: column;
    padding: 20px 15px; /* Padding inside mobile menu container */
    max-width: none; /* No max-width on mobile */
    justify-content: flex-start;
    align-items: flex-start;
    height: auto; /* Auto height for mobile menu content */
  }

  .main-nav .nav-link {
    width: 100%;
    padding: 12px 20px;
    justify-content: flex-start;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
  .main-nav .nav-link:last-child {
    border-bottom: none;
  }

  /* Footer (Mobile) */
  .site-footer {
    padding: 30px 15px 15px;
  }

  .footer-top-grid {
    grid-template-columns: 1fr; /* Single column layout on mobile */
    gap: 30px;
    margin-bottom: 20px;
  }
}
/* 移动端内容区防溢出（系统追加，请勿删除） */
@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;
  }
}
/* 内容保护（系统追加，请勿删除） */
body {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
input, textarea, select, [contenteditable="true"] {
  -webkit-user-select: text;
  -moz-user-select: text;
  user-select: text;
}
