:root {
  --color-primary: #6d28d9; /* 皇家紫 - 更具品牌感 */
  --color-secondary: #f59e0b; /* 琥珀橙 - 保留作悬停/强调 */
  --color-accent: #22d3ee; /* 赛博青 - 渐变更鲜明 */
  --color-white: #ffffff; /* 全局白色，供 text-[var(--color-white)] 使用 */
  --color-black: #111827; /* 深灰黑，可备用 */

  --color-text: #1e293b; /* 石墨黑 */
  --color-text-light: #64748b; /* 更柔和的文本次色 */

  --sidebar-width: 100%;
}
iframe {
  width: 100%;
  border: none;
  /* height: 100vh;  */
  /* position: absolute; */
  top: 0;
  z-index: 8;
}

/* 左侧导航栏：固定高度 */
.sidebar {
  width: var(--sidebar-width);
  background: var(--color-primary);
  color: #fff;
  padding: 20px;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
  display: flex;
  /* flex-direction: column; */
  justify-content: space-between;
  /* height: 100vh;  */
  position: sticky;
  top: 0;
  z-index: 10;
}

.sidebar .logo {
  font-size: 1.5rem;
  font-weight: bold;
  /* margin-bottom: 20px; */
}

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

.sidebar nav ul li {
  margin-bottom: 15px;
}

.sidebar nav ul li a {
  color: #fff;
  text-decoration: none;
  font-size: 1rem;
  transition: color 0.3s ease;
}

.sidebar nav ul li a:hover {
  color: var(--color-accent);
}

/* 右侧主体内容：固定高度，仅中间部分滚动 */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 1000px;
  height: 100vh; /* 固定高度 */
  overflow: hidden; /* 禁止整体滚动 */
  margin: 0 auto;
}
/* 中间滚动区域 */
.content-scroll {
  flex: 1;
  overflow-y: auto; /* 启用垂直滚动 */
  padding: 20px;
}

.main-content::-webkit-scrollbar {
  width: 8px;
}

.main-content::-webkit-scrollbar-thumb {
  background: var(--color-text-light);
  border-radius: 4px;
}

.main-content::-webkit-scrollbar-track {
  background: transparent;
}
/* 搜索框 */
.search-bar {
  margin-bottom: 20px;
}

.search-bar input {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--color-text-light);
  border-radius: 5px;
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

.search-bar input:focus {
  border-color: var(--color-accent);
  outline: none;
}

/* 游戏卡片列表 */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.game-card {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

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

.game-card .content {
  padding: 15px;
}

.game-card h3 {
  font-size: 1rem;
  margin-bottom: 10px;
  color: var(--color-text);
}

.game-card button {
  width: 100%;
  padding: 10px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.game-card button:hover {
  background: var(--color-secondary);
}

/* 增强按钮渐变效果 */
button.bg-gradient-to-r {
  background-size: 200% auto;
  transition: background-position 0.3s ease;
}

button.bg-gradient-to-r:hover {
  background-position: right center;
}

.container .text-center button {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.container .text-center button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}
/* PC端标题样式：仅展示一行 */
.grid h3 {
  font-size: 1rem;
  margin-bottom: 8px;
  white-space: nowrap; /* 禁止换行 */
  overflow: hidden; /* 隐藏超出部分 */
  text-overflow: ellipsis; /* 添加省略号 */
}
/* 加载进度条样式 */
.relative .flex {
  align-items: center;
}

.relative .h-4 {
  height: 1rem; /* 进度条高度 */
}

.relative .rounded-full {
  border-radius: 9999px; /* 圆角效果 */
}

.relative .ml-2 {
  margin-left: 0.5rem; /* 文字与进度条间距 */
}
.detailback {
  width: 40px;
  height: 30px;
  position: fixed;
  z-index: 9;
  top: 40px;
  left: 0px;
  background-color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  border-top-right-radius: 40px;
  border-bottom-right-radius: 40px;
  box-shadow: 0 2px 10px 1px rgba(0, 0, 0, 0.76);
}
.detailback img {
  width: 20px;
}
/* 修改后的 footer 样式 */
/* 页脚：固定在底部 */
footer {
  flex-shrink: 0; /* 防止被压缩 */
  background: var(--color-primary);
  color: white;
  padding: 1rem;
  text-align: center;
}
footer:hover {
  filter: brightness(1.1) saturate(1.3);
  transition: all 0.3s ease;
}
/* 增强页脚文字和链接的交互效果 */
footer a {
  font-weight: 500;
  text-decoration: none;
  color: white;
}

footer a:hover {
  color: var(--color-accent);
}

/* 版权信息文字样式 */
footer p {
  opacity: 0.8;
}
/* 游戏详情页封面优化 */
main .w-full.h-80 img {
  transition: transform 0.3s ease-in-out; /* 平滑过渡效果 */
}

main .w-full.h-80 img:hover {
  transform: scale(1.1); /* 鼠标悬停时放大图片 */
}

/* 游戏标题样式 */
main h1 {
  font-family: "Arial", sans-serif;
  letter-spacing: -0.5px; /* 减小字母间距 */
  line-height: 1.2; /* 调整行高 */
}

/* 描述文字样式 */
main p {
  font-size: 1rem;
  line-height: 1.6; /* 增加行高以提升可读性 */
  color: #4a5568; /* 灰色文字 */
}

/* 按钮组样式 */
main .flex.space-x-4 {
  display: flex;
  gap: 1rem; /* 使用 gap 替代 margin */
}

/* Play Now 按钮增强渐变效果 */
main button.bg-gradient-to-r {
  background-size: 200% auto;
  transition: background-position 0.3s ease, transform 0.3s ease;
}

main button.bg-gradient-to-r:hover {
  background-position: right center;
  transform: translateY(-2px); /* 悬停时轻微上移 */
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15); /* 增强阴影效果 */
}

/* 添加到收藏按钮样式 */
main button.bg-gray-200 {
  border: 1px solid #e2e8f0; /* 添加边框 */
  transition: background-color 0.3s ease, transform 0.3s ease;
}

main button.bg-gray-200:hover {
  transform: translateY(-1px); /* 悬停时轻微上移 */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* 轻微阴影 */
}
/* 游戏统计信息样式 */
main .flex.flex-wrap.items-center {
  display: flex;
  flex-wrap: wrap; /* 允许换行 */
  align-items: center;
  gap: 1rem; /* 使用 gap 替代 margin */
}

main .flex.flex-wrap.items-center svg {
  width: 1rem;
  height: 1rem;
  fill: currentColor; /* 继承父级颜色 */
}

main .flex.flex-wrap.items-center span {
  font-size: 0.875rem; /* 稍小字体 */
  line-height: 1.5;
  color: #6b7280; /* 灰色文字 */
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* 移动端适配优化 */
@media (max-width: 768px) {
  /* 搜索框高度调整 */
  input[type="text"] {
    padding: 12px 16px;
  }
  .sidebar {
    width: auto;
    flex-direction: row;
    justify-content: space-around;
    padding: 1rem;
    height: auto;
    position: relative;
  }

  .main-content {
    height: auto;
    width: 100%;
  }

  .content-scroll {
    overflow-y: visible;
  }

  /* 占位符图片高度调整 */
  .grid .w-full.h-56 {
    height: 120px; /* 确保图片区域高度一致 */
  }
  /* 游戏卡片布局调整：一行展示两个 */
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .grid p {
    font-size: 0.875rem;
  }
  /* 游戏卡片整体样式优化 */
  .grid > div {
    padding: 12px; /* 减小内边距 */
    text-align: center; /* 内容居中对齐 */
  }

  /* 移动端标题样式：最多展示两行 */
  .grid h3 {
    font-size: 1rem; /* 调整标题字体大小 */
    margin-bottom: 8px; /* 减小标题与按钮之间的间距 */
    white-space: normal; /* 允许换行 */
    display: -webkit-box; /* 使用弹性盒子布局 */
    -webkit-line-clamp: 2; /* 限制为两行 */
    -webkit-box-orient: vertical; /* 垂直排列 */
    overflow: hidden; /* 隐藏超出部分 */
    text-overflow: ellipsis; /* 添加省略号 */
  }

  /* 游戏卡片按钮样式 */
  .grid button {
    padding: 10px; /* 减小按钮内边距 */
    font-size: 0.875rem; /* 调整按钮字体大小 */
  }

  .container .text-center button {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
  }

  .sidebar nav ul {
    display: flex;
    gap: 1rem;
  }

  main .flex.flex-wrap.items-center {
    flex-direction: column;
    align-items: flex-start; /* 左对齐 */
  }

  main .flex.flex-wrap.items-center div {
    width: 100%; /* 每个统计项占满一行 */
  }
  footer ul {
    flex-direction: column;
    align-items: center;
  }

  footer p {
    text-align: center;
  }
  /* 移动端卡片列表：改为单列瀑布流布局 */
  .game-grid {
    display: flex;
    flex-direction: column;
    align-items: center; /* 居中对齐 */
    gap: 16px; /* 卡片间距 */
  }

  /* 卡片宽度调整 */
  .game-card {
    width: 90%; /* 卡片宽度占屏幕的 90% */
    max-width: 350px; /* 最大宽度限制 */
    margin: 0 auto; /* 水平居中 */
  }

  /* 图片高度调整 */
  .game-card img {
    height: 180px; /* 移动端图片高度增大 */
    object-fit: cover;
  }

  /* 标题样式优化 */
  .game-card h3 {
    font-size: 1rem;
    line-height: 1.4;
    text-align: center; /* 标题居中 */
    white-space: normal; /* 允许换行 */
    -webkit-line-clamp: 2; /* 限制为两行 */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* 按钮样式优化 */
  .game-card button {
    padding: 10px;
    font-size: 0.9rem;
    border-radius: 20px; /* 圆角按钮 */
  }
}

/* ===== 首页样式优化：美观与兼容，不影响内容结构 ===== */
/* 基础排版与可读性优化 */
html {
  text-size-adjust: 100%;
}
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--color-text);
  background-color: #f8fafc;
}

/* 布局容器宽度控制（与现有 Tailwind 容器相配合） */
.container {
  max-width: 1200px;
}

/* 顶部导航渐变与链接交互效果 */
.sidebar {
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
}
.sidebar .logo {
  background-image: linear-gradient(90deg, #ffffff, #f1f5f9);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.sidebar nav ul li a {
  position: relative;
}
.sidebar nav ul li a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 2px;
  background: currentColor;
  transition: width 0.3s ease;
}
.sidebar nav ul li a:hover::after {
  width: 100%;
}

/* 搜索框优化：更柔和的边框与占位符 */
.search-bar input {
  background-color: #fff;
  border: 1px solid #e5e7eb;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}
.search-bar input::placeholder {
  color: #9ca3af;
}

/* 网格与卡片优化：提升质感与兼容性 */
.game-grid {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.game-card {
  border: 1px solid rgba(0, 0, 0, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.game-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}
.game-card h3 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 按钮与可访问性：focus-visible 高对比度 */
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* 内容滚动区的滚动条细节优化 */
.content-scroll::-webkit-scrollbar {
  width: 8px;
}
.content-scroll::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
.content-scroll::-webkit-scrollbar-track {
  background: transparent;
}

/* 降低动效（系统偏好） */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
