:root {
  --header-offset: 122px; /* Desktop: header-top (68) + main-nav (52) + 2px buffer */
  --color-primary: #FF8C1A;
  --color-accent: #FFA53A;
  --color-button-gradient: linear-gradient(180deg, #FFA53A 0%, #D96800 100%);
  --color-card-bg: #17191F;
  --color-background: #0D0E12;
  --color-text-main: #FFF3E6;
  --color-border: #A84F0C;
  --color-glow: #FFB04D;
  --color-deep-orange: #D96800;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding-top: var(--header-offset); /* Important: body padding-top */
  background-color: var(--color-background);
  color: var(--color-text-main);
  line-height: 1.6;
  overflow-x: hidden; /* Prevent horizontal scroll */
}

/* Base container styles */
.header-container, .nav-container, .footer-top-grid {
  max-width: 1200px;
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;
  box-sizing: border-box;
}

/* Site Header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Header Top Bar */
.header-top {
  background-color: var(--color-background); /* Darker background */
  min-height: 68px;
  height: 68px;
  display: flex;
  align-items: center;
  overflow: hidden;
  box-sizing: border-box;
}

.header-top .header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
  padding-left: 20px; /* Ensure padding for logo */
  padding-right: 20px; /* Ensure padding for buttons */
}

.logo {
  font-size: 28px;
  font-weight: bold;
  color: var(--color-primary);
  text-decoration: none;
  display: block; /* Ensure logo is visible */
  white-space: nowrap; /* Prevent logo text from wrapping */
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px; /* Limit logo width */
}

.logo img {
  display: block;
  max-height: 60px; /* Max height for desktop logo */
  height: auto;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.desktop-nav-buttons {
  display: flex;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 8px;
  background: var(--color-button-gradient);
  color: var(--color-text-main);
  text-decoration: none;
  font-weight: bold;
  font-size: 15px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
}

.btn:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}

/* Main Navigation */
.main-nav {
  background-color: var(--color-card-bg); /* Lighter background, different from header-top */
  min-height: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  overflow: hidden;
  box-sizing: border-box;
}

.main-nav .nav-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  gap: 25px; /* Spacing between nav links */
  flex-wrap: nowrap; /* Prevent nav links from wrapping on desktop */
  overflow-x: auto; /* Allow horizontal scroll for many nav items if needed */
  -webkit-overflow-scrolling: touch; /* Smooth scrolling for iOS */
  scrollbar-width: none; /* Hide scrollbar for Firefox */
}
.main-nav .nav-container::-webkit-scrollbar {
  display: none; /* Hide scrollbar for Chrome, Safari, Opera */
}

.nav-link {
  color: var(--color-text-main);
  text-decoration: none;
  font-size: 16px;
  padding: 5px 0;
  white-space: nowrap;
  transition: color 0.3s ease, border-bottom 0.3s ease;
}

.nav-link:hover, .nav-link.active {
  color: var(--color-primary);
  border-bottom: 2px solid var(--color-primary);
}

/* Mobile specific elements (hidden by default on desktop) */
.hamburger-menu {
  display: none; /* Hidden on desktop */
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
  z-index: 1001;
  position: relative;
}

.hamburger-icon {
  display: block;
  width: 25px;
  height: 3px;
  background-color: var(--color-text-main);
  position: relative;
  transition: background-color 0.3s ease;
}

.hamburger-icon::before,
.hamburger-icon::after {
  content: '';
  display: block;
  width: 100%;
  height: 3px;
  background-color: var(--color-text-main);
  position: absolute;
  transition: transform 0.3s ease;
}

.hamburger-icon::before {
  top: -8px;
}

.hamburger-icon::after {
  top: 8px;
}

.hamburger-menu.active .hamburger-icon {
  background-color: transparent;
}

.hamburger-menu.active .hamburger-icon::before {
  transform: translateY(8px) rotate(45deg);
}

.hamburger-menu.active .hamburger-icon::after {
  transform: translateY(-8px) rotate(-45deg);
}

.mobile-nav-buttons {
  display: none; /* Hidden on desktop, shown on mobile */
  background-color: var(--color-background); /* Same as header-top */
  min-height: 48px; /* Fixed height for mobile buttons */
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  padding: 0 15px;
  overflow: hidden; /* Prevent content overflow */
}

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

body.no-scroll {
  overflow: hidden;
}

/* Footer Styles */
.site-footer {
  background-color: var(--color-card-bg); /* Use card background for footer */
  padding: 40px 0 20px 0;
  color: rgba(255, 243, 230, 0.8); /* Slightly muted text for footer */
  font-size: 14px;
}

.site-footer h3 {
  color: var(--color-text-main);
  font-size: 18px;
  margin-bottom: 20px;
}

.footer-top-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 30px;
  margin-bottom: 40px;
}

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

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

.footer-description {
  margin-bottom: 20px;
  line-height: 1.8;
  word-wrap: break-word; /* Ensure description wraps */
  overflow-wrap: break-word;
}

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

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

.footer-nav a {
  color: rgba(255, 243, 230, 0.7);
  text-decoration: none;
  transition: color 0.3s ease;
}

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

.footer-dynamic-row {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 20px;
  box-sizing: border-box;
}

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

.footer-dynamic-col .footer-slot-anchor-inner {
  display: flex;
  flex-wrap: wrap;
  flex-direction: row;
  align-items: flex-start;
  gap: 5px;
  width: 100%;
}

.footer-bottom {
  text-align: center;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
  color: rgba(255, 243, 230, 0.6);
}

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

  /* Shared mobile image 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;
  }

  .site-header {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  }

  .header-top {
    min-height: 60px;
    height: 60px;
  }

  .header-top .header-container {
    padding-left: 15px; /* Smaller padding for mobile */
    padding-right: 15px;
    width: 100%;
    max-width: none; /* Crucial: no max-width on mobile containers */
    position: relative; /* For logo centering */
  }

  .logo {
    position: absolute !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    max-width: calc(100% - 100px); /* Leave space for hamburger */
    z-index: 1; /* Ensure logo is below hamburger menu if it overlaps */
  }
  .logo img {
    max-height: 56px !important; /* Max height for mobile logo */
  }

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

  .mobile-nav-buttons {
    display: flex !important; /* Show mobile buttons */
    min-height: 48px;
    height: auto; /* Allow height to adjust if text wraps */
    padding-left: 15px;
    padding-right: 15px;
    gap: 10px;
    flex-wrap: nowrap; /* Prevent buttons from wrapping to new line */
    background-color: var(--color-background); /* Consistent with header-top */
  }

  .mobile-nav-buttons .btn {
    flex: 1;
    min-width: 0; /* Allow shrinking */
    max-width: calc(50% - 5px); /* Ensure two buttons fit with gap */
    padding: 8px 12px; /* Smaller padding */
    font-size: 13px; /* Smaller font size */
    white-space: normal; /* Allow text to wrap */
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .hamburger-menu {
    display: block; /* Show hamburger menu on mobile */
    order: -1; /* Place hamburger menu at the start */
    margin-right: auto; /* Push logo to center */
  }

  .main-nav {
    display: none; /* Hidden by default on mobile */
    flex-direction: column;
    position: fixed;
    top: var(--header-offset); /* Position below fixed header and mobile buttons */
    left: 0;
    width: 80%; /* Sidebar width */
    max-width: 300px; /* Max sidebar width */
    height: calc(100% - var(--header-offset)); /* Full height below header */
    background-color: var(--color-card-bg); /* Sidebar background */
    transform: translateX(-100%); /* Slide out of view */
    transition: transform 0.3s ease-out;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.4);
    overflow-y: auto; /* Allow scrolling for long menus */
  }

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

  .main-nav .nav-container {
    flex-direction: column;
    align-items: flex-start;
    padding: 20px 15px;
    gap: 15px;
    width: 100%;
    max-width: none; /* Crucial: no max-width on mobile containers */
  }

  .nav-link {
    width: 100%;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 243, 230, 0.1); /* Separator for mobile links */
  }
  .nav-link:last-child {
    border-bottom: none;
  }

  .overlay.active {
    display: block;
  }

  .footer-top-grid {
    grid-template-columns: 1fr; /* Single column layout for footer on mobile */
    gap: 20px;
    padding-left: 15px;
    padding-right: 15px;
  }

  .footer-col h3 {
    margin-top: 20px;
  }

  .footer-dynamic-row {
    padding-left: 15px;
    padding-right: 15px;
  }
}

/* Ensure contrast for text */
a, p, li, h1, h2, h3, h4, h5, h6, span {
  color: var(--color-text-main); /* Default text color */
}

/* Specific contrast for footer links */
.site-footer a {
  color: rgba(255, 243, 230, 0.7);
}
.site-footer a:hover {
  color: var(--color-primary);
}
/* 移动端内容区防溢出（系统追加，请勿删除） */
@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;
  }
}
