:root {
  --bg-0: #0a0d14;
  --bg-1: #0f1320;
  --neon-1: #00e0ff;
  --neon-2: #ff00aa;
  --neon-3: #87ff65;
  --text: #e8f0ff;
  --muted: #8aa0c6;
  --nav-h: 66px; /* 底部导航栏高度 */
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text);
  background: url('https://tuchuang.org.cn/imgs/2025/12/02/f2a94eb7c0b2452f.png') no-repeat center center fixed;
  background-size: cover;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  overflow-x: hidden;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); /* 为底部导航栏与安全区预留空间 */
  position: relative;
}



@keyframes rainbowGlow {
  0% { background-position: 0% 50%; }
  100% { background-position: 600% 50%; }
}

@keyframes scanLight {
  0% {
    box-shadow: 0 0 20px rgba(255,255,255,0.3), 
                0 4px 15px rgba(0,0,0,0.2),
                inset 0 0 10px rgba(255,255,255,0.5);
  }
  100% {
    box-shadow: 0 0 35px rgba(255,255,255,0.6), 
                0 6px 25px rgba(0,0,0,0.3),
                inset 0 0 20px rgba(255,255,255,0.8);
  }
}

/* 动态星空背景 */
.stars {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    radial-gradient(2px 2px at 20% 30%, rgba(255,255,255,.25) 0, transparent 50%),
    radial-gradient(1.5px 1.5px at 70% 80%, rgba(255,255,255,.12) 0, transparent 50%),
    radial-gradient(1.8px 1.8px at 40% 60%, rgba(255,255,255,.18) 0, transparent 50%),
    radial-gradient(2px 2px at 85% 25%, rgba(255,255,255,.2) 0, transparent 50);
  animation: twinkle 8s linear infinite;
}
@keyframes twinkle {
  0% { transform: translateY(0); opacity: .9; }
  50% { transform: translateY(-10px); opacity: .7; }
  100% { transform: translateY(0); opacity: .9; }
}

/* 雪花飘落特效 */
.snow-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
  overflow: hidden;
}

.snowflake {
  position: absolute;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  animation: fall linear infinite;
  opacity: 0.8;
  /* 使用GPU加速 */
  will-change: transform;
}

@keyframes fall {
    to {
      transform: translateY(100vh);
    }
  }

header {
  position: relative; z-index: 2;
  padding: 80px 16px 12px; /* 上方预留按钮空间 */
  text-align: center;
}

.search-container {
  max-width: 600px;
  margin: 16px auto 8px;
  position: relative; z-index: 2;
  padding: 0 16px;
}

.search-box {
  width: 100%;
  padding: 12px 16px 12px 48px;
  border-radius: 25px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  font-size: 16px;
  backdrop-filter: blur(8px);
  transition: all 0.3s ease;
  -webkit-appearance: none;
}

.search-box::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.search-box::placeholder {
  color: var(--muted);
}

.search-box:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--neon-1);
  box-shadow: 0 0 20px rgba(0, 224, 255, 0.3);
}

.search-container::before {
  content: "🔍";
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: var(--muted);
  pointer-events: none;
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 8px;
  background: rgba(15, 19, 32, 0.95);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  max-height: 300px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}

.search-results.active {
  display: block;
}

.search-result-item {
  padding: 12px 16px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.search-result-name {
  font-weight: bold;
  color: var(--text);
  margin-bottom: 4px;
}

.search-result-hint {
  font-size: 12px;
  color: var(--muted);
}
.title {
  margin: 0;
  font-size: clamp(24px, 5vw, 48px);
  letter-spacing: .03em;
  text-shadow: 0 0 10px rgba(0,224,255,.25), 0 0 25px rgba(255,0,170,.2);
}
.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: clamp(12px, 2.2vw, 16px);
}

.grid {
  position: relative; z-index: 2;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  gap: 20px; padding: 20px;
  max-width: 1300px;
  margin: 0 auto 40px;
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
}

/* 响应式网格布局优化 */
@media (max-width: 768px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr));
    gap: 16px;
    padding: 16px;
  }
}

@media (max-width: 480px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(min(160px, 100%), 1fr));
    gap: 12px;
    padding: 12px;
  }
}

/* 安卓设备触摸优化 */
* {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.card {
  --glow: rgba(0,224,255,.55);
  --glow-2: rgba(255,0,170,.45);
  position: relative;
  display: flex; flex-direction: column;
  border-radius: 20px;
  color: var(--text);
  background: linear-gradient(135deg, rgba(255,255,255,.08), rgba(255,255,255,.02));
  border: 1px solid rgba(255,255,255,.15);
  /* backdrop-filter: blur(12px); 移除模糊效果以提升移动设备性能 */
  box-shadow: 0 8px 24px rgba(0,0,0,.3), 
              /* 移除发光阴影以提升性能 */
              inset 0 0 0 1px rgba(255,255,255,.1);
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* 只过渡性能友好的属性 */
  transform-origin: center bottom;
  animation: cardFadeIn 0.6s ease forwards;
  opacity: 0;
  transform: translateY(20px);
}

@keyframes cardFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 为不同卡片添加错开的动画延迟 */
.card:nth-child(1n) { animation-delay: 0.05s; }
.card:nth-child(2n) { animation-delay: 0.1s; }
.card:nth-child(3n) { animation-delay: 0.15s; }
.card:nth-child(4n) { animation-delay: 0.2s; }
.card:nth-child(5n) { animation-delay: 0.25s; }
.card:nth-child(6n) { animation-delay: 0.3s; }

.card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.03), transparent 60%);
  pointer-events: none;
}
.card::before {
  content: "";
  position: absolute; inset: -1px; border-radius: 20px;
  padding: 1px; /* neon 边框 */
  background: linear-gradient(135deg, var(--neon-1), transparent 40%),
              linear-gradient(315deg, var(--neon-2), transparent 40%),
              linear-gradient(90deg, transparent, rgba(255,255,255,.1));
  -webkit-mask: linear-gradient(#000, #000) content-box, linear-gradient(#000, #000);
  mask: linear-gradient(#000, #000) content-box, linear-gradient(#000, #000);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none;
  opacity: .4;
  transition: all 0.3s ease;
}

.card:hover::before {
  opacity: .7;
  background: linear-gradient(135deg, var(--neon-1), transparent 30%),
              linear-gradient(315deg, var(--neon-2), transparent 30%),
              linear-gradient(90deg, rgba(255,255,255,.1), rgba(255,255,255,.05));
}
.card:hover {
  transform: translateY(-8px) scale(1.02);
  border-color: rgba(0,224,255,.3);
  box-shadow: 0 20px 48px rgba(0,0,0,.55), 
              0 0 32px rgba(0,224,255,.2),
              0 0 24px rgba(255,0,170,.15);
}

.card:active {
  transform: translateY(-4px) scale(0.98);
  transition: all 0.1s ease;
}
/* .card:hover::before 样式已合并到上方的 .card:hover::before 中 */

/* 上半部分：预览截图区域 */
.card-preview {
  position: relative;
  height: 50%; min-height: 140px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  /* 默认显示渐变占位，具体卡片用 moren01~moren05 覆盖 */
  background-image: linear-gradient(135deg, rgba(0,224,255,.12), rgba(255,0,170,.12));
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: transform 0.3s ease;
  overflow: hidden;
}

.card:hover .card-preview {
  transform: scale(1.08);
}

.hot-tag {
position: absolute;
top: 8px;
left: 8px;
background: linear-gradient(135deg, #ff4d4f, #ff7a45);
color: white;
font-size: 12px;
font-weight: bold;
padding: 4px 8px;
border-radius: 4px;
z-index: 10;
transform: rotate(-5deg);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.new-tag {
position: absolute;
top: 8px;
left: 8px;
background: linear-gradient(135deg, #2ed573, #1e90ff);
color: white;
font-size: 12px;
font-weight: bold;
padding: 4px 8px;
border-radius: 4px;
z-index: 10;
transform: rotate(-5deg);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* 新增new标签样式 */
.new-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  background: linear-gradient(135deg, #2ed573, #1e90ff);
  color: white;
  font-size: 12px;
  font-weight: bold;
  padding: 4px 8px;
  border-radius: 4px;
  z-index: 10;
  transform: rotate(-5deg);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
.card-preview::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.15) 0%, rgba(0,0,0,.3) 60%, rgba(0,0,0,0) 100%);
  pointer-events: none;
}
.badge {
  width: 44px; height: 44px; flex: none;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; letter-spacing: .02em; color: #051018;
  font-size: clamp(14px, 2.6vw, 18px);
  background: linear-gradient(135deg, #6bdcff, #f8a6ff); /* 默认背景，在具体卡片中会被覆盖 */
  filter: saturate(120%) brightness(110%);
  box-shadow: inset 0 0 24px rgba(255,255,255,.25), 0 4px 12px rgba(0,0,0,.35);
}
.badge-01 { background: linear-gradient(135deg, #00e0ff, #7a00ff); }
.badge-02 { background: linear-gradient(135deg, #ff8a00, #ff0040); }
.badge-03 { background: linear-gradient(135deg, #8dff1a, #00c897); }
.badge-04 { background: linear-gradient(135deg, #ffd400, #ff2aa1); }
.badge-05 { background: linear-gradient(135deg, #2a7cff, #ff4fb3); }
.name {
  font-size: 18px; font-weight: 700; letter-spacing: .02em;
  text-shadow: 0 0 8px rgba(0,224,255,.2);
}
.hint { color: var(--muted); font-size: 12px; }

/* 下半部分：信息与按钮区域 */
.card-info {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 14px 18px;
  position: relative;
}

.card-rating {
  font-size: 12px;
  color: #ffd700;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 2px;
}

.favorite-btn {
  position: absolute;
  top: -15px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(5px);
  z-index: 10;
}

.favorite-btn:hover {
  transform: scale(1.2);
  background: rgba(255, 69, 0, 0.6);
  border-color: rgba(255, 69, 0, 0.8);
}

.favorite-btn.active {
  color: #ff1493;
  background: rgba(255, 20, 147, 0.3);
  border-color: #ff1493;
  animation: heartBeat 0.4s ease;
}

@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.6); }
}
.play-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  color: #ffffff;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: 2px solid rgba(255, 255, 255, 0.3);
  text-decoration: none;
  position: relative;
  box-sizing: border-box;
}

/* 主图标样式 */
.play-btn::before {
  content: "▶";
  font-size: 20px;
  font-weight: bold;
  margin-left: 2px;
}

/* 悬停效果 */
.play-btn:hover {
  transform: translateY(-3px) scale(1.1);
  box-shadow: 0 8px 16px rgba(102, 126, 234, 0.4);
}

/* 点击效果 */

/* 下拉刷新样式 */
#home-view { overscroll-behavior-y: contain; }
.pull-refresh { position: fixed; top: 0; left: 0; right: 0; height: 0; display: flex; align-items: center; justify-content: center; gap: 8px; z-index: 20; background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,0)); color: var(--text); overflow: hidden; backdrop-filter: blur(6px); }
.pull-refresh .pr-icon { width: 20px; height: 20px; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); border-top-color: transparent; }
.pull-refresh .pr-icon.spin { animation: prspin .8s linear infinite; }
@keyframes prspin { to { transform: rotate(360deg); } }

/* 历史记录操作 */
.history-actions { display:flex; justify-content:flex-end; padding: 0 16px; }
.text-btn { background: none; border: 0; color: var(--muted); cursor: pointer; text-decoration: underline; font-size: 14px; padding: 10px 0; }
.text-btn:hover { color: var(--text); }

/* 导航项图标 */
.nav-item::before { content: ""; display:inline-block; margin-right:6px; font-size: 16px; }
.nav-item[data-view="home"]::before { content: "🏠"; }
.nav-item[data-view="chat"]::before { content: "💬"; }
.nav-item[data-view="history"]::before { content: "🕘"; }
.nav-item[data-action="more-games"]::before { content: "🎮"; }
#nav-refresh::before { content: "↻"; }

/* 标签样式 */
.tag { display:inline-block; padding:2px 8px; border-radius:12px; background: rgba(255,255,255,0.08); color:#ddd; font-size:12px; border:1px solid rgba(255,255,255,0.12); }

/* 骨架屏动画 */
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
.skeleton .card { pointer-events:none; }
.skeleton .card-preview { background: linear-gradient(90deg, rgba(255,255,255,0.06) 0, rgba(255,255,255,0.12) 50%, rgba(255,255,255,0.06) 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.skeleton .name, .skeleton .hint { background: linear-gradient(90deg, rgba(255,255,255,0.06) 0, rgba(255,255,255,0.12) 50%, rgba(255,255,255,0.06) 100%); color: transparent; border-radius: 6px; min-height: 14px; }

/* 视图容器过渡动画 */
section { transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important; transform: translateX(20px); }
section.active { transform: translateX(0) !important; }

/* 页面加载过渡动画 */
body { animation: pageFadeIn 0.5s ease-out; }
@keyframes pageFadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* 分类筛选条 */
.category-bar { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 12px 16px; scrollbar-width: none; padding-bottom: 8px; }
.category-bar::-webkit-scrollbar { display: none; }
.category-bar .cat-btn { padding: 8px 14px; border-radius: 20px; background: rgba(255, 255, 255, 0.08); color: var(--text); font-size: 14px; cursor: pointer; border: 1px solid rgba(255, 255, 255, 0.12); white-space: nowrap; transition: all 0.2s ease; touch-action: manipulation; }
.category-bar .cat-btn:hover { background: rgba(255, 255, 255, 0.12); }
.category-bar .cat-btn.active { background: #4cd2b5; color: #000; border-color: #4cd2b5; box-shadow: 0 4px 12px rgba(76, 210, 181, 0.3); }
#home-view .grid .card.hidden { display: none !important; }
@media (max-width: 600px) { .category-bar { margin: 8px 12px; gap: 6px; } }
@media (max-width: 440px) { .category-bar .cat-btn { font-size: 13px; padding: 6px 12px; } }
@media (max-width: 360px) { .category-bar { margin: 6px 8px; } .category-bar .cat-btn { font-size: 12px; padding: 5px 10px; } }