@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700;900&display=swap");

:root {
  --ink: #172033;
  --muted: #667085;
  --line: rgba(23, 32, 51, 0.08);
  --card: rgba(255, 255, 255, 0.86);
  --accent: #e11d48;
  --radius: 16px;
  --shadow: 0 10px 26px rgba(23, 32, 51, 0.08);
  --pad: clamp(12px, 2vw, 24px);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(1000px 520px at 0% -10%, rgba(14, 165, 233, 0.14), transparent 55%),
    radial-gradient(900px 480px at 100% 0%, rgba(225, 29, 72, 0.1), transparent 50%),
    linear-gradient(180deg, #eef4fb 0%, #f7f8fc 40%, #eef2f7 100%);
}

a { color: inherit; }

.container {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding-left: var(--pad);
  padding-right: var(--pad);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid rgba(23, 32, 51, 0.06);
  box-shadow: 0 8px 24px rgba(23, 32, 51, 0.04);
}

.header-top {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: none;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  overflow: hidden;
  flex: none;
  background: #fff;
  border: 1px solid var(--line);
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.brand-text strong {
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
}

.brand-text span {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.header-search {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  max-width: 560px;
  min-width: 0;
}

.header-search input {
  flex: 1;
  min-width: 0;
  height: 40px;
  border: 1px solid rgba(23, 32, 51, 0.1);
  border-radius: 12px;
  padding: 0 14px;
  font: inherit;
  background: rgba(248, 250, 252, 0.95);
  outline: none;
}

.header-search input:focus {
  border-color: rgba(225, 29, 72, 0.35);
  box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.1);
  background: #fff;
}

.lobby-result {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  flex: none;
}

.header-nav-wrap {
  padding-bottom: 10px;
}

.cat-nav {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.cat-tab {
  border: 1px solid rgba(23, 32, 51, 0.08);
  background: #fff;
  color: var(--muted);
  padding: 7px 14px;
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  flex: none;
}

.cat-tab:hover {
  color: var(--ink);
}

.cat-tab.active {
  color: #fff;
  background: linear-gradient(135deg, #e11d48, #fb7185);
  border-color: transparent;
}

.site-main {
  padding: 16px 0 24px;
  padding-bottom: calc(24px + var(--footer-h, 92px));
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}

.section-head span {
  color: var(--muted);
  font-size: 13px;
}

/* 桌面：一排 8 个；一页 5 排（共 40 个，由 PAGE_SIZE 控制） */
.game-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 12px;
  min-height: 80px;
}

.game-card {
  display: block;
  text-decoration: none;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.game-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 30px rgba(23, 32, 51, 0.12);
}

.game-cover {
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 30px;
  font-weight: 800;
}

.game-cover[data-tone="0"] { background: linear-gradient(145deg, #e11d48, #fb7185); }
.game-cover[data-tone="1"] { background: linear-gradient(145deg, #ea580c, #fdba74); }
.game-cover[data-tone="2"] { background: linear-gradient(145deg, #0891b2, #67e8f9); }
.game-cover[data-tone="3"] { background: linear-gradient(145deg, #059669, #6ee7b7); }
.game-cover[data-tone="4"] { background: linear-gradient(145deg, #2563eb, #93c5fd); }
.game-cover[data-tone="5"] { background: linear-gradient(145deg, #db2777, #f9a8d4); }

.game-info {
  padding: 10px 12px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.game-meta {
  min-width: 0;
  flex: 1;
}

.game-info h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-pwd {
  display: inline-block;
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.2;
  color: #b45309;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 6px;
  padding: 2px 6px;
  cursor: copy;
  user-select: text;
}

.game-info em {
  flex: none;
  font-style: normal;
  font-size: 12px;
  color: var(--accent);
}

.hidden { display: none !important; }

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 18px;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(23, 32, 51, 0.1);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.page-btn:hover:not(:disabled) { background: #fff; }

.page-btn.active {
  color: #fff;
  background: #e11d48;
  border-color: #e11d48;
}

.page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.page-ellipsis {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  padding: 0 4px;
}

.disclaimer {
  margin: 14px 0 0;
  text-align: center;
  color: #8490a1;
  font-size: 12px;
  line-height: 1.7;
}

.empty-box {
  padding: 48px 16px;
  text-align: center;
  color: var(--muted);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.6);
  border: 1px dashed rgba(23, 32, 51, 0.12);
}

.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  border-top: 1px solid rgba(23, 32, 51, 0.06);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 12px 0;
  box-shadow: 0 -8px 24px rgba(23, 32, 51, 0.06);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
}

.footer-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
  color: #475569;
  font-size: 12px;
  line-height: 1.6;
}

.footer-line a {
  color: #475569;
  text-decoration: none;
}

.footer-line a:hover {
  color: var(--accent);
}

.footer-disc {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  max-width: 920px;
}

@media (max-width: 900px) {
  .header-top {
    flex-wrap: wrap;
  }

  .header-search {
    max-width: none;
    width: 100%;
    order: 3;
  }

  .game-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .brand-text span {
    display: none;
  }

  .game-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .game-cover {
    height: 78px;
    font-size: 24px;
  }
}
