/* ============================================================
   ZZOJ平台 —— 游戏列表页视觉（link/*.html）
   结构由 js/game-list.js 渲染：
     .hero           顶部品牌区（渐变 + 搜索 + 随机一局）
     .gl-chips       分类筛选
     .gl-recent      最近在玩
     .gl-grid        游戏卡片网格
   ============================================================ */

:root {
  --zz-brand: #6b34a8;
  --zz-brand-2: #3a2079;
  --zz-ink: #2f2059;
  --zz-muted: #8b8ba3;
}

.main {
  padding: 0;
  background: #f5f6fb;
  min-height: 100%;
}

/* ---------------- Hero ---------------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 22px 16px 26px;
  color: #fff;
  background: linear-gradient(135deg, #6b34a8 0%, #3f2485 45%, #241552 100%);
  border-radius: 0 0 26px 26px;
  box-shadow: 0 18px 34px -24px rgba(44, 26, 92, .9);
}
/* 流动光斑 */
.hero-glow {
  position: absolute;
  width: 260px;
  height: 260px;
  right: -70px;
  top: -110px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(255, 95, 143, .55), rgba(255, 95, 143, 0) 65%);
  animation: heroFloat 9s ease-in-out infinite;
}
.hero-glow:after {
  content: '';
  position: absolute;
  width: 220px;
  height: 220px;
  left: -180px;
  top: 150px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(74, 217, 255, .45), rgba(74, 217, 255, 0) 65%);
  animation: heroFloat 11s ease-in-out infinite reverse;
}
@keyframes heroFloat {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50%      { transform: translate3d(-14px, 18px, 0) scale(1.08); }
}

.hero-inner {
  position: relative;
  max-width: 1180px;
  margin: 0 auto;
}
.hero-top {
  display: flex;
  align-items: center;
  gap: 12px;
}
.hero-logo {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  padding: 4px;
  background: rgba(255, 255, 255, .16);
  box-shadow: 0 10px 20px -12px rgba(0, 0, 0, .8);
}
.hero-text {
  min-width: 0;
}
.hero-title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: .5px;
  line-height: 1.2;
}
.hero-slogan {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: rgba(255, 255, 255, .72);
}
.hero-stat {
  margin-left: auto;
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 14px;
  text-align: center;
  background: rgba(255, 255, 255, .14);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2);
}
.hero-stat b {
  display: block;
  font-size: 20px;
  line-height: 1.1;
}
.hero-stat span {
  font-size: 11px;
  color: rgba(255, 255, 255, .75);
}
.hero-sub {
  margin: 14px 0 0;
  font-size: 13px;
  color: rgba(255, 255, 255, .82);
}

/* ---------------- 搜索 / 随机 ---------------- */
.hero-search {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.search-field {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}
.search-field input {
  width: 100%;
  height: 46px;
  padding: 0 44px 0 44px;
  border: 0;
  border-radius: 23px;
  outline: 0;
  font-size: 14px;
  color: #fff;
  background: rgba(255, 255, 255, .16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: background .2s, box-shadow .2s;
}
.search-field input::-webkit-search-cancel-button { display: none; }
.search-field input::placeholder { color: rgba(255, 255, 255, .68); }
.search-field input:focus {
  background: rgba(255, 255, 255, .24);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .5), 0 10px 24px -14px rgba(0, 0, 0, .8);
}
.search-ico {
  position: absolute;
  left: 16px;
  top: 14px;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: rgba(255, 255, 255, .85);
  stroke-width: 2;
  stroke-linecap: round;
}
.search-clear {
  display: none;
  position: absolute;
  right: 8px;
  top: 9px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .22);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.search-clear.is-show { display: block; }

.btn-random {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: 23px;
  background: #fff;
  color: var(--zz-brand-2);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 26px -14px rgba(0, 0, 0, .9);
  transition: transform .2s, box-shadow .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn-random svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
.btn-random:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 30px -14px rgba(0, 0, 0, .95);
}
.btn-random:active { transform: translateY(0) scale(.98); }

/* ---------------- 分类 chips ---------------- */
.gl-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 14px 2px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.gl-chips::-webkit-scrollbar { display: none; }
.gl-chip {
  flex: 0 0 auto;
  padding: 9px 16px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #5b5478;
  font-size: 13.5px;
  cursor: pointer;
  box-shadow: 0 8px 18px -14px rgba(44, 26, 92, .8);
  transition: transform .2s, color .2s, background .2s, box-shadow .2s;
  -webkit-tap-highlight-color: transparent;
}
.gl-chip:hover {
  color: var(--zz-brand-2);
  transform: translateY(-2px);
}
.gl-chip.is-active {
  background: linear-gradient(135deg, #7b3fbe, #40267f);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 14px 24px -14px rgba(107, 52, 168, .95);
}

/* ---------------- 最近在玩 ---------------- */
.gl-recent {
  margin: 12px 14px 0;
  padding: 12px 14px 14px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 14px 28px -22px rgba(44, 26, 92, .9);
}
.gl-recent[hidden] { display: none; }
.gl-recent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.gl-recent-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--zz-brand-2);
}
.gl-recent-clear {
  border: 0;
  background: transparent;
  color: #a5a0bb;
  font-size: 12px;
  cursor: pointer;
}
.gl-recent-list {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.gl-recent-list::-webkit-scrollbar { display: none; }
.gl-recent-item {
  flex: 0 0 auto;
  width: 66px;
  text-align: center;
  color: #4a4270;
  text-decoration: none;
}
.gl-recent-item:hover { text-decoration: none; }
.gl-recent-item img {
  display: block;
  width: 54px;
  height: 54px;
  margin: 0 auto;
  padding: 4px;
  border-radius: 15px;
  object-fit: contain;
  background: #f1ecff;
  box-shadow: 0 8px 16px -10px rgba(44, 26, 92, .8);
}
.gl-recent-item span {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gl-count {
  padding: 14px 18px 2px;
  font-size: 12px;
  color: var(--zz-muted);
}

/* ---------------- 卡片网格 ---------------- */
.gl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 14px;
  padding: 10px 14px 24px;
}

.g-card {
  position: relative;
  display: block;
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  text-decoration: none;
  box-shadow: 0 10px 22px -16px rgba(44, 26, 92, .6);
  transition: transform .3s cubic-bezier(.2, .8, .2, 1), box-shadow .3s;
  -webkit-tap-highlight-color: transparent;
}
.g-card:hover,
.g-card:focus {
  text-decoration: none;
  transform: translateY(-6px);
  box-shadow: 0 26px 42px -22px rgba(44, 26, 92, .85);
}
.g-card:active { transform: translateY(-2px) scale(.99); }

.g-cover {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  min-height: 108px;
  overflow: hidden;
  background: linear-gradient(150deg, #efe7ff, #e3d8ff 55%, #d9e3ff);
}
/* 封面：放大模糊的封面图做底，图标居中（原图尺寸普遍很小，这样最耐看） */
.g-cover-bg {
  position: absolute;
  top: -25%;
  left: -25%;
  width: 150%;
  height: 150%;
  background-size: cover;
  background-position: center;
  filter: blur(24px) saturate(1.35);
  opacity: .8;
  transform: scale(1.05);
}
.g-cover:before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, .32), rgba(48, 24, 104, .28));
}
.g-icon {
  position: relative;
  width: auto;
  height: auto;
  max-width: 60%;
  max-height: 60%;
  min-width: 48px;
  min-height: 48px;
  object-fit: contain;
  padding: 5px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 14px 26px -14px rgba(28, 14, 70, .85);
  transition: transform .35s cubic-bezier(.2, .8, .2, 1);
}
.g-card:hover .g-icon { transform: scale(1.06); }
.g-icon.is-broken { display: none; }

.g-badges {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.g-badge {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  color: #fff;
  background: rgba(30, 18, 64, .5);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.g-badge-hot {
  background: linear-gradient(135deg, #ff5f8f, #ff2e63);
  box-shadow: 0 8px 16px -10px rgba(255, 46, 99, .9);
}

.g-play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .95);
  color: var(--zz-brand-2);
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 16px 28px -14px rgba(0, 0, 0, .9);
  opacity: 0;
  transform: translate(-50%, -50%) scale(.85);
  transition: opacity .25s, transform .25s;
}
.g-play-ico {
  width: 0;
  height: 0;
  border-left: 7px solid #6b34a8;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}
.g-card:hover .g-play,
.g-card:focus .g-play {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.g-body {
  padding: 10px 12px 26px;
}
.g-name {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--zz-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.g-desc {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--zz-muted);
  height: 36px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.g-cat {
  position: absolute;
  right: 12px;
  bottom: 9px;
  font-size: 10.5px;
  color: #b0abc4;
}

/* ---------------- 空状态 ---------------- */
.gl-empty {
  grid-column: 1 / -1;
  padding: 46px 16px 30px;
  text-align: center;
  color: var(--zz-muted);
}
.gl-empty-ico {
  font-size: 34px;
  font-weight: 700;
  opacity: .35;
}
.gl-empty-t {
  margin: 12px 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: #4a4270;
}
.gl-empty-d {
  margin: 0;
  font-size: 12.5px;
}

/* ---------------- 入场动画 ---------------- */
/* 用 backwards：延迟期间保持起始状态，动画结束后交还给 hover 的 transform */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.g-card {
  animation: cardIn .45s cubic-bezier(.2, .8, .2, 1) backwards;
}
.gl-grid .g-card:nth-child(1) { animation-delay: .02s; }
.gl-grid .g-card:nth-child(2) { animation-delay: .05s; }
.gl-grid .g-card:nth-child(3) { animation-delay: .08s; }
.gl-grid .g-card:nth-child(4) { animation-delay: .11s; }
.gl-grid .g-card:nth-child(5) { animation-delay: .14s; }
.gl-grid .g-card:nth-child(6) { animation-delay: .17s; }
.gl-grid .g-card:nth-child(7) { animation-delay: .20s; }
.gl-grid .g-card:nth-child(8) { animation-delay: .23s; }
.gl-grid .g-card:nth-child(n+9) { animation-delay: .26s; }

/* 触屏设备没有 hover，隐藏“立即开玩”浮层，点卡片即玩 */
@media (hover: none) {
  .g-play { display: none; }
}

/* 尊重系统“减少动态效果”设置 */
@media (prefers-reduced-motion: reduce) {
  .g-card { animation: none; }
  .hero-glow,
  .hero-glow:after { animation: none; }
}
