/* ============================================================
   游戏索引页 — 糖果梦境主题 (Candy Dreamland)
   与 tube-pour 统一的入口风格
   ============================================================ */

:root {
  --bg-top: #FFD4E5;
  --bg-mid: #FFE0EE;
  --bg-bottom: #D4F1FF;
  --card-bg: rgba(255, 255, 255, 0.95);
  --card-border: #D4C0F0;
  --card-inner-shadow: rgba(100, 70, 140, 0.08);
  --text-main: #3D2D5C;
  --text-soft: #5C4A7A;
  --card-shadow: rgba(100, 70, 140, 0.20);
  --card-hover-shadow: rgba(100, 70, 140, 0.35);
  --game-grid-gap: 28px;
  --card-radius: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text-main);
  font-family: "Baloo 2", "Nunito", "Microsoft YaHei", sans-serif;
  background: linear-gradient(
    180deg,
    var(--bg-top) 0%,
    var(--bg-mid) 40%,
    var(--bg-bottom) 100%
  );
  padding: 24px 16px;
}

/* ---------- 背景装饰层 ---------- */
.bg-decor {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.cloud {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(
    circle at 30% 30%,
    rgba(255, 255, 255, 0.97),
    rgba(255, 240, 250, 0.75)
  );
  filter: blur(0.5px);
  animation: floatCloud 14s ease-in-out infinite;
}

.cloud-1 {
  width: 200px;
  height: 90px;
  left: 3%;
  top: 10%;
  box-shadow:
    65px -5px 0 -18px rgba(255, 255, 255, 0.85),
    130px 8px 0 -28px rgba(255, 245, 252, 0.75);
  animation-delay: 0s;
}

.cloud-2 {
  width: 160px;
  height: 70px;
  right: 8%;
  top: 6%;
  box-shadow: 55px 0 0 -14px rgba(255, 255, 255, 0.88);
  animation-delay: 2.5s;
}

.cloud-3 {
  width: 180px;
  height: 78px;
  left: 30%;
  top: 16%;
  opacity: 0.85;
  animation-delay: 5s;
}

@keyframes floatCloud {
  0%, 100% { transform: translateY(0) translateX(0); }
  50% { transform: translateY(-10px) translateX(6px); }
}

.candy-hill {
  position: absolute;
  bottom: 0;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  filter: blur(0.5px);
}

.hill-1 {
  left: -6%;
  width: 46%;
  height: 26%;
  background: linear-gradient(
    180deg,
    #A8E6CF 0%,
    #7DD4A8 60%,
    #6BC99A 100%
  );
  opacity: 0.88;
}

.hill-2 {
  right: -4%;
  width: 42%;
  height: 30%;
  background: linear-gradient(
    180deg,
    #FFD9E8 0%,
    #FFB8D0 60%,
    #FFA0C0 100%
  );
  opacity: 0.85;
}

.hill-3 {
  left: 28%;
  width: 52%;
  height: 22%;
  background: linear-gradient(
    180deg,
    #FFECAA 0%,
    #FFD76E 60%,
    #F5C842 100%
  );
  opacity: 0.78;
}

/* ---------- 索引页内容 ---------- */
.index-main {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
}

.index-title {
  margin: 0 0 28px;
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 800;
  text-align: center;
  color: var(--text-main);
  text-shadow: 0 2px 8px rgba(255, 255, 255, 0.6);
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--game-grid-gap);
}

/* 纯封面卡片 */
.game-card {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 2 / 1;
  background: var(--card-bg);
  border: 2.5px solid var(--card-border);
  border-radius: var(--card-radius);
  text-decoration: none;
  color: var(--text-main);
  box-shadow:
    0 10px 30px var(--card-shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    inset 0 -1px 0 var(--card-inner-shadow);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  animation: cardAppear 0.5s ease backwards;
}

.game-card:hover {
  transform: translateY(-8px);
  box-shadow:
    0 18px 44px var(--card-hover-shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    inset 0 -1px 0 var(--card-inner-shadow);
}

.game-card:active {
  transform: translateY(-4px) scale(0.98);
}

.game-card:focus-visible {
  outline: 3px solid #E91E8C;
  outline-offset: 3px;
}

/* 封面区（铺满整卡） */
.game-card-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--preview-gradient, linear-gradient(160deg, #E8D4FF 0%, #FFE0F0 50%, #D4F1FF 100%));
  overflow: hidden;
}

.game-cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.game-icon {
  position: absolute;
  display: none;
  font-size: 44px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.08));
}

@keyframes cardAppear {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
