* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary-color: #9d4edd;
  --secondary-color: #1a1a1a;
  --background-color: #0a0a0a;
  --surface-color: #212121;
  --surface-color-hover: #2a2a2a;
  --nav-color: #141414;
  --sidebar-color: #161616;
  --accent-color: #9d4edd;
  --text-color: #ffffff;
  --text-secondary: #b3b3b3;
}

body {
  font-family: 'Roboto', Arial, sans-serif;
  line-height: 1.6;
  background-color: var(--background-color);
  color: var(--text-color);
  padding-top: 60px; /* 为固定导航栏留出空间 */
}

.main-nav {
  background: var(--nav-color);
  padding: 0.8rem 0;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.nav-container {
  max-width: none;
  margin: 0;
  padding: 0;
  display: flex;
  position: relative;
}

.nav-logo {
  width: 260px;
  padding-left: 1rem;
  position: fixed;
  left: 0;
  background: var(--nav-color);
  z-index: 2;
}

.nav-search {
  position: fixed;
  left: 260px;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 2rem;
  background: var(--nav-color);
  z-index: 1;
}

.search-box {
  position: relative;
  width: 100%;
  max-width: 800px; /* 增加搜索框最大宽度 */
  margin: 0 auto;
}

.search-box input {
  width: 100%;
  padding: 0.8rem 1rem 0.8rem 2.8rem;
  border: none;
  border-radius: 6px;
  background: var(--surface-color);
  color: var(--text-color);
  font-size: 1rem;
}

.search-results {
  width: 100%;
  max-width: 800px; /* 与搜索框宽度保持一致 */
  margin-top: 0.5rem;
  padding: 0.5rem;
}

.search-result-item {
  padding: 1rem;
  margin-bottom: 0.5rem;
}

.nav-logo a {
  color: var(--text-color);
  text-decoration: none;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 40%, rgba(255,255,255,0.8) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: all 0.3s ease;
}

.nav-logo a:hover {
  transform: scale(1.02);
}

.logo-text {
  background: linear-gradient(135deg, #fff 0%, var(--primary-color) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-accent {
  background: linear-gradient(135deg, var(--primary-color) 0%, #fff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.search-icon {
  position: absolute;
  left: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
}

.search-results {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  background: var(--surface-color);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  max-height: 400px;
  overflow-y: auto;
}

.search-results.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.search-results-content {
  padding: 1rem;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem;
  border-radius: 6px;
  transition: background-color 0.2s ease;
  cursor: pointer;
}

.search-result-item:hover {
  background: var(--surface-color-hover);
}

.search-result-item img {
  width: 50px;
  height: 50px;
  border-radius: 4px;
  object-fit: cover;
}

.search-result-info {
  flex: 1;
}

.search-result-info h4 {
  color: var(--text-color);
  margin-bottom: 0.2rem;
  font-size: 0.95rem;
}

.search-result-info p {
  color: var(--text-secondary);
  font-size: 0.8rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.nav-links a {
  color: var(--text-color);
  text-decoration: none;
  margin-left: 2rem;
  font-weight: 500;
  transition: color 0.3s ease;
}

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

.main-container {
  display: flex;
  gap: 0;
  position: relative;
  padding: 0;
}

.sidebar {
  width: 260px;
  background: var(--sidebar-color);
  border-right: 1px solid rgba(255,255,255,0.05);
  padding: 1.5rem 1rem;
  position: fixed;
  left: 0;
  top: 60px;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
}

.sidebar h3 {
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
  color: var(--text-color);
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--primary-color);
}

.category-list {
  list-style: none;
}

.category-list li {
  margin-bottom: 0.5rem;
}

.category-list a {
  color: var(--text-secondary);
  text-decoration: none;
  display: flex;
  align-items: center;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  transition: all 0.3s ease;
  gap: 12px;
  font-size: 0.85rem;
}

.category-list a i {
  color: var(--primary-color);
  opacity: 0.9;
  transition: opacity 0.3s ease;
  font-size: 1rem;
  width: 20px;
  min-width: 20px;
  text-align: center;
}

.category-list a:hover i {
  opacity: 1;
}

.category-list a:hover {
  color: var(--text-color);
  background: rgba(255,255,255,0.1);
  transform: translateX(5px);
}

.category-list a.active {
  color: var(--text-color);
  background: rgba(255,255,255,0.15);
  transform: translateX(5px);
}

.category-list a.active i {
  opacity: 1;
}

.content {
  flex: 1;
  margin-left: 260px;
  padding: 2rem 3rem;
  max-width: 1800px;
  min-width: 0; /* 防止弹性布局溢出 */
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 60px); /* 减去顶部导航栏高度 */
}

.game-section {
  background: var(--surface-color);
  margin-bottom: 2rem;
  border-radius: 4px;
  padding: 1.5rem;
}

.game-section h2 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.8rem;
  color: var(--text-color);
  border-bottom: 2px solid var(--accent-color);
}

.game-section h2::after {
  display: none; /* 移除之前的下划线装饰 */
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 1rem;
  padding: 0.5rem;
}

.game-card {
  background: var(--surface-color);
  border-radius: 4px;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.game-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.game-card img {
  width: 100%;
  height: 120px;
  object-fit: cover;
}

.game-card h3 {
  padding: 0.8rem;
  font-size: 0.9rem;
  color: var(--text-color);
  text-align: center;
}

.game-card a {
  text-decoration: none;
  color: inherit;
}

footer {
  margin-left: 260px;
  background: var(--nav-color);
  color: var(--text-secondary);
  padding: 3rem;
  margin-top: auto;
  width: calc(100% - 260px);
  z-index: 101;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.footer-links {
  margin-bottom: 1rem;
}

.footer-links a {
  color: var(--text-color);
  text-decoration: none;
  margin: 0 1.5rem;
  transition: color 0.3s ease;
}

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

/* 回到顶部按钮 */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: var(--accent-color);
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  transition: all 0.3s ease;
  z-index: 999;
}

.back-to-top:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

.back-to-top.visible {
  display: flex;
}

/* 添加箭头图标样式 */
.back-to-top::before {
  content: '↑';
  color: white;
  font-size: 24px;
}

/* 游戏详情页样式 */
.game-detail {
  background: var(--surface-color);
  border-radius: 4px;
  padding: 2rem;
}

.game-header {
  display: flex;
  gap: 2.5rem;
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.game-cover {
  width: 180px;
  height: 180px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.game-info {
  flex: 1;
}

.game-info h1 {
  font-size: 2.2rem;
  margin-bottom: 1rem;
  color: var(--text-color);
  font-weight: 700;
  letter-spacing: -0.5px;
}

.game-description {
  color: var(--text-secondary);
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  max-width: 800px;
}

.game-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.category-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--surface-color-hover);
  border-radius: 20px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.3s ease;
  font-size: 0.9rem;
}

.category-tag:hover {
  color: var(--text-color);
  background: var(--primary-color);
  transform: translateY(-2px);
}

.game-content {
  position: relative;
  width: 100%;
  background: var(--surface-color-hover);
  border-radius: 12px;
  overflow: hidden;
  margin: 0 auto;
  max-width: 1280px; /* 限制最大宽度 */
}

.game-frame-container {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 默认16:9比例 */
  transition: padding-top 0.3s ease;
}

/* 当游戏是竖屏时的样式 */
.game-frame-container.portrait {
  padding-top: 177.78%; /* 9:16比例 */
  max-width: 562px; /* 基于1000px高度计算的宽度 */
  margin: 0 auto;
}

.game-frame-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: #000; /* 加载时的背景色 */
}

/* 添加加载提示 */
.game-frame-container::before {
  content: "Loading game...";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-secondary);
  z-index: 0;
}

@media (max-width: 768px) {
  .game-header {
    flex-direction: column;
    gap: 1.5rem;
  }

  .game-cover {
    width: 120px;
    height: 120px;
  }

  .game-info h1 {
    font-size: 1.8rem;
  }

  .game-frame-container {
    padding-top: 75%; /* 移动端默认4:3比例 */
  }
  
  .game-frame-container.portrait {
    padding-top: 177.78%; /* 保持竖屏比例 */
    width: 100%;
    max-width: none;
  }

  .nav-container {
    flex-direction: column;
    padding: 1rem;
  }

  .nav-logo {
    position: static;
    width: 100%;
    padding: 0;
    margin-bottom: 1rem;
  }

  .nav-search {
    position: static;
    padding: 0;
  }

  .search-box {
    max-width: 100%;
  }

  .search-results {
    max-width: 100%;
  }
}

/* 政策页面样式优化 */
.policy-article {
  max-width: 800px;
  margin: 0 auto;
}

.policy-article section {
  margin-bottom: 2.5rem;
}

.policy-article h2 {
  font-size: 2rem;
  color: var(--text-color);
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--primary-color);
}

.policy-article h3 {
  font-size: 1.5rem;
  color: var(--text-color);
  margin: 2rem 0 1rem;
}

.policy-article p {
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 1.2rem;
}

.policy-article .policy-intro {
  font-size: 1.1rem;
  color: var(--text-color);
  margin-bottom: 2rem;
}

.policy-article ul {
  list-style: none;
  padding-left: 1.5rem;
  margin: 1rem 0;
}

.policy-article ul li {
  color: var(--text-secondary);
  margin-bottom: 0.8rem;
  position: relative;
}

.policy-article ul li::before {
  content: "•";
  color: var(--primary-color);
  position: absolute;
  left: -1.5rem;
}
