:root {
  --bg: #0e1116;
  --card: #161b22;
  --fg: #e6edf3;
  --muted: #8b949e;
  --accent: #4f8cff;
  --border: #252c36;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: start center;
  align-content: start;
  padding: 128px 24px 72px;
  background-color: var(--bg);
  background-image: radial-gradient(60rem 40rem at 50% -10%, #1b2433 0%, transparent 70%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--fg);
  font-family:
    ui-sans-serif, system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ---------------- 品牌标题 ----------------
   基础样式 = 动画结束态（顶部居中、正常字号）。
   动画全程只改 transform / opacity（走合成层，不触发布局），
   每个关键帧自带缓动，收尾段用“回弹落位”避免末尾长时间静止。
   配色沿用页面原本的前景色（--fg），<span> 只用于字母依次入场。
------------------------------------------- */
.brand {
  position: fixed;
  top: 0;
  left: 50%;
  margin: 0;
  white-space: nowrap;
  font-size: clamp(1.6rem, 3.2vw, 2.1rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.1;
  color: var(--fg);
  transform: translate(-50%, 32px) scale(1) rotate(0deg);
  animation: brand-in 2.4s linear both;
}

.brand span {
  display: inline-block;
  animation: letter-in 0.85s cubic-bezier(0.2, 1.5, 0.35, 1) both;
  animation-delay: calc(var(--i) * 70ms);
}

@keyframes brand-in {
  /* 中央出现：淡入 + 放大 */
  0% {
    opacity: 0;
    transform: translate(-50%, calc(50vh - 50%)) scale(0.55) rotate(-20deg);
    animation-timing-function: cubic-bezier(0.22, 0.85, 0.3, 1);
  }

  8% {
    opacity: 1;
    animation-timing-function: cubic-bezier(0.4, 0.05, 0.4, 0.95);
  }

  /* 放大到最大：这是“变大”的终点，随后开始旋转上移 */
  34% {
    opacity: 1;
    transform: translate(-50%, calc(50vh - 50%)) scale(2.45) rotate(-4deg);
    animation-timing-function: cubic-bezier(0.4, 0.05, 0.5, 0.95);
  }

  /* 单段完成“旋转 + 上移 + 缩回标题”：速度单调递减，收尾不会中途顿挫 */
  100% {
    opacity: 1;
    transform: translate(-50%, 32px) scale(1) rotate(360deg);
  }
}

@keyframes letter-in {
  0% {
    opacity: 0;
    transform: translateY(16px) scale(0.55) rotate(-12deg);
  }

  100% {
    opacity: 1;
    transform: none;
  }
}

/* ---------------- 开场后显示的内容 ----------------
   用法：在任意元素上加 class="after-intro"。
   默认隐藏（opacity + visibility，屏幕阅读器也不会读到），
   当 <body> 进入 intro-done 状态后淡入并归位。
--------------------------------------------------- */
.after-intro {
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
  transition:
    opacity 0.7s ease 0.1s,
    transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) 0.1s,
    visibility 0s linear 0.8s;
}

.intro-done .after-intro {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition:
    opacity 0.7s ease,
    transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1),
    visibility 0s;
}


/* ---------------- 右上角登录状态 ---------------- */
.site-auth {
  position: fixed;
  top: 26px;
  right: 32px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
}

.site-auth a {
  color: var(--muted);
  text-decoration: none;
}

.site-auth a:hover {
  color: var(--fg);
}

.site-auth .who {
  color: var(--fg);
}

.site-auth form {
  margin: 0;
}

.site-auth button {
  padding: 0;
  font: inherit;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  background: none;
  border: 0;
}

.site-auth button:hover {
  color: var(--fg);
}

/* ---------------- 卡片列表 ----------------
   数据来自 GET /api/games。有 url 时整张卡片可点，新标签页打开。
------------------------------------------------ */
.games {
  width: min(72rem, 100%);
  margin-top: 2.5rem;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: 1.25rem;
}

.game-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: default;
}

a.game-card {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease;
}

a.game-card:hover {
  transform: translateY(-2px);
  border-color: rgb(79 140 255 / 45%);
}

a.game-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.game-cover {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #0b0f14;
}

.game-body {
  padding: 0.85rem 1rem 1.05rem;
}

.game-name {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.game-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.games-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 2.5rem 1rem;
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
  border: 1px dashed var(--border);
  border-radius: 14px;
}

/* ---------------- 跳过动画 / 无障碍 ---------------- */
.skip-intro .brand,
.skip-intro .brand span {
  animation: none !important;
}

@media (prefers-reduced-motion: reduce) {
  a.game-card {
    transition: none;
  }

  a.game-card:hover {
    transform: none;
  }

  .brand,
  .brand span {
    animation: none !important;
  }

  .after-intro,
  .intro-done .after-intro {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: none;
  }
}

/* developers 入口 CSS */
.developers {
  color: #367fd8;
  /* 隐藏下划线 */
  text-decoration: none;
  font-weight: 600;
}