/* ===== 基础变量 ===== */
:root {
  --ink: #14122b;
  --ink-2: #3d3b5b;
  --muted: #74728f;
  --bg: #ffffff;
  --soft: #f7f6fc;
  --line: #eae8f5;
  --brand: #6d40f5;
  --brand-2: #ff4f92;
  --brand-soft: #f1ecff;
  --amber: #ff9f1a;
  --radius: 26px;
  --shadow-sm: 0 2px 10px rgba(28, 20, 60, 0.06);
  --shadow-lg: 0 22px 46px -16px rgba(48, 26, 120, 0.3);
  --shell: 1240px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 520px at 88% -8%, #efe7ff 0%, rgba(255, 255, 255, 0) 62%),
    radial-gradient(760px 460px at -6% 2%, #ffe9f2 0%, rgba(255, 255, 255, 0) 58%);
  background-repeat: no-repeat;
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p { margin: 0; }
img { display: block; max-width: 100%; }
button { font: inherit; }

.shell {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 28px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 0.85rem;
  text-decoration: none;
  transition: top 0.2s ease;
}
.skip-link:focus { top: 14px; }

/* ===== 顶栏 ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 26px;
  min-height: 72px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  flex-shrink: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 18px -8px rgba(109, 64, 245, 0.9);
  flex-shrink: 0;
}
.brand-mark svg { width: 20px; height: 20px; }

.brand-text {
  display: flex;
  flex-direction: column;
  font-weight: 900;
  font-size: 1.06rem;
  line-height: 1.05;
  letter-spacing: -0.01em;
}
.brand-text em {
  font-style: normal;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--muted);
  margin-top: 3px;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.main-nav a {
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.18s ease, color 0.18s ease;
}
.main-nav a:hover { background: var(--soft); color: var(--ink); }
.main-nav a.is-active { background: var(--brand-soft); color: var(--brand); }

.search {
  position: relative;
  margin-left: auto;
  width: 100%;
  max-width: 290px;
}
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--muted);
  pointer-events: none;
}
.search input {
  width: 100%;
  padding: 11px 16px 11px 41px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.search input::placeholder { color: var(--muted); }
.search input:focus {
  background: #fff;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(109, 64, 245, 0.14);
}

/* ===== 首屏 ===== */
.hero { padding: 62px 0 30px; }

.hero-inner {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 40px;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--brand);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}
.kicker i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 0 0 4px rgba(109, 64, 245, 0.12);
}

.hero h1 {
  margin: 20px 0 16px;
  font-size: clamp(2.35rem, 5.2vw, 4rem);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -0.035em;
}
.grad {
  background: linear-gradient(100deg, var(--brand) 10%, var(--brand-2) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-copy > p {
  max-width: 46ch;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.75;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.94rem;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.btn-primary {
  background: linear-gradient(100deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 14px 30px -12px rgba(109, 64, 245, 0.85);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 18px 34px -12px rgba(109, 64, 245, 0.95); }
.btn-ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.btn-ghost:hover { transform: translateY(-2px); border-color: #d9d4ef; }

.hero-meta {
  margin-top: 18px !important;
  font-size: 0.85rem !important;
  color: var(--muted);
}
.hero-meta strong { color: var(--ink); }

/* 首屏装饰：数字方块 */
.hero-art {
  display: flex;
  justify-content: flex-end;
}
.art-wrap {
  position: relative;
  width: 100%;
  max-width: 390px;
  aspect-ratio: 1 / 1;
}
.art-grid {
  position: absolute;
  inset: 11%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  transform: rotate(-7deg);
}
.tile {
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  border-radius: 26px;
  font-size: clamp(2rem, 3.4vw, 2.9rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  color: #fff;
  box-shadow: var(--shadow-lg);
  animation: float 6s ease-in-out infinite;
}
.tile-2 { background: linear-gradient(150deg, #b9a6ff, #9a83ff); }
.tile-4 { background: linear-gradient(150deg, #8f6bff, #6d40f5); animation-delay: 0.6s; }
.tile-8 { background: linear-gradient(150deg, #ff8fb8, #ff4f92); animation-delay: 1.2s; }
.tile-16 { background: linear-gradient(150deg, #ffc46b, #ff9f1a); animation-delay: 1.8s; }

.chip {
  position: absolute;
  padding: 8px 15px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--ink-2);
}
.chip-a { top: 4%; left: 0; transform: rotate(-8deg); }
.chip-b { bottom: 8%; right: -2%; transform: rotate(6deg); }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}

/* ===== 游戏区 ===== */
.section { padding: 26px 0 64px; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.section-head h2 {
  font-size: clamp(1.5rem, 3vw, 2.05rem);
  font-weight: 900;
  letter-spacing: -0.025em;
}
.section-sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.88rem;
}
.result-count {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--soft);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 20px 0 26px;
}
.chip-btn {
  padding: 9px 19px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-2);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.chip-btn:hover { background: var(--brand-soft); border-color: var(--brand-soft); color: var(--brand); }
.chip-btn.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

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

.game-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
  cursor: pointer;
  outline: none;
  animation: cardIn 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
  animation-delay: var(--d, 0ms);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.game-card:hover {
  transform: translateY(-6px);
  border-color: transparent;
  box-shadow: var(--shadow-lg);
}
.game-card:focus-visible {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(109, 64, 245, 0.16), var(--shadow-lg);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
}

.card-cover {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: linear-gradient(135deg, #efeaff, #ffe8f1);
}
.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s ease;
}
.game-card:hover .card-cover img { transform: scale(1.06); }

.badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(20, 18, 43, 0.74);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  font-size: 0.71rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.badge.is-live { background: #12b981; }

.card-body {
  padding: 15px 17px 18px;
}
.card-body h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.card-body p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.55;
}
.card-body .card-release {
  margin-top: 7px;
  color: var(--brand);
  font-size: 0.76rem;
  font-weight: 800;
}
.tag-first {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 0.68rem;
  font-weight: 800;
}

/* 空状态 */
.empty {
  padding: 54px 20px 40px;
  text-align: center;
}
.empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--soft);
  border: 1px dashed #d5cfee;
  color: var(--muted);
}
.empty-icon svg { width: 24px; height: 24px; }
.empty h3 { font-size: 1.05rem; font-weight: 800; }
.empty p { margin: 6px 0 18px; color: var(--muted); font-size: 0.88rem; }

/* ===== 特性区 ===== */
.section-alt {
  padding: 56px 0 60px;
  background: linear-gradient(180deg, rgba(247, 246, 252, 0) 0%, var(--soft) 22%, var(--soft) 100%);
  border-top: 1px solid var(--line);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.feature {
  padding: 26px 24px 28px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.feature-icon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand);
  margin-bottom: 16px;
}
.feature-icon svg { width: 21px; height: 21px; }
.feature h3 { font-size: 1rem; font-weight: 800; }
.feature p { margin-top: 7px; color: var(--muted); font-size: 0.86rem; line-height: 1.65; }

/* ===== 页脚 ===== */
.site-footer {
  border-top: 1px solid var(--line);
  background: #fff;
  padding: 34px 0 30px;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.footer-brand strong { font-size: 0.94rem; font-weight: 900; }
.footer-brand p { margin-top: 3px; color: var(--muted); font-size: 0.82rem; }
.footer-note { color: var(--muted); font-size: 0.79rem; }

/* ===== 提示条 ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  z-index: 200;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 0.86rem;
  font-weight: 600;
  box-shadow: 0 18px 34px -14px rgba(20, 18, 43, 0.7);
  opacity: 0;
  transform: translate(-50%, 14px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.is-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.noscript {
  padding: 16px;
  text-align: center;
  background: #fff4e5;
  color: #8a5300;
  font-size: 0.88rem;
}

/* ===== 列表加载提示 ===== */
.grid-tip {
  grid-column: 1 / -1;
  padding: 48px 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}
.badge.is-soon { background: rgba(20, 18, 43, 0.74); }
.badge.is-offline { background: #8d8aa6; }

/* ===== 排行榜页 ===== */
.page { padding: 48px 0 72px; }
.page-head h1 {
  font-size: clamp(1.9rem, 4vw, 2.7rem);
  font-weight: 900;
  letter-spacing: -0.03em;
}
.page-head p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 26px 0 20px;
}
.board {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.board-row {
  display: grid;
  grid-template-columns: 62px 1fr 120px 130px;
  gap: 12px;
  align-items: center;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
}
.board-row:first-child { border-top: 0; }
.board-head {
  background: var(--soft);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.board-row .rank { font-weight: 900; color: var(--muted); }
.board-row .name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.board-row .score {
  text-align: right;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.board-row .time {
  text-align: right;
  color: var(--muted);
  font-size: 0.8rem;
}
.board-empty {
  padding: 56px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}
.footer-note a { color: var(--brand); text-decoration: none; }

@media (max-width: 620px) {
  .board-row {
    grid-template-columns: 44px 1fr 88px;
    padding: 13px 16px;
  }
  .board-row .time { display: none; }
}

/* ===== 响应式 ===== */
@media (max-width: 1000px) {
  .hero-inner { grid-template-columns: 1fr; gap: 34px; }
  .hero-art { justify-content: flex-start; }
  .art-wrap { max-width: 320px; }
}

@media (max-width: 860px) {
  .main-nav { display: none; }
  .search { max-width: none; }
  .feature-grid { grid-template-columns: 1fr; }
  .hero { padding: 44px 0 20px; }
}

@media (max-width: 620px) {
  .shell { padding: 0 18px; }
  .header-inner { gap: 12px; min-height: 64px; }
  .brand-text em { display: none; }
  .hero h1 { font-size: clamp(2rem, 9vw, 2.6rem); }
  .hero-copy > p { font-size: 0.94rem; }
  .hero-art { display: none; }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .card-body { padding: 12px 13px 15px; }
  .card-body h3 { font-size: 0.94rem; }
  .card-body p { font-size: 0.78rem; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
