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

:root {
  --ink: #142033;
  --muted: #64748b;
  --line: rgba(20, 32, 51, 0.08);
  --card: #ffffff;
  --accent: #e11d48;
  --accent-2: #fb7185;
  --radius: 18px;
  --shadow: 0 12px 28px rgba(20, 32, 51, 0.08);
  --pad: clamp(14px, 2.2vw, 28px);
  --bg-1: rgba(14, 165, 233, 0.12);
  --bg-2: rgba(225, 29, 72, 0.09);
  --bg-base: linear-gradient(180deg, #eef3f9 0%, #f6f8fb 42%, #eef1f6 100%);
  --header-bg: rgba(255, 255, 255, 0.88);
  --header-border: rgba(20, 32, 51, 0.06);
  --input-bg: rgba(248, 250, 252, 0.96);
  --tab-bg: #fff;
  --tab-border: rgba(20, 32, 51, 0.08);
  --footer-bg: rgba(255, 255, 255, 0.94);
  --footer-text: #475569;
  --tone-0-a: #be123c; --tone-0-b: #fb7185;
  --tone-1-a: #c2410c; --tone-1-b: #fdba74;
  --tone-2-a: #0e7490; --tone-2-b: #67e8f9;
  --tone-3-a: #047857; --tone-3-b: #6ee7b7;
  --tone-4-a: #1d4ed8; --tone-4-b: #93c5fd;
  --tone-5-a: #be185d; --tone-5-b: #f9a8d4;
  --play-btn-shadow: 0 6px 14px rgba(225, 29, 72, 0.22);
}

* { 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(900px 480px at 8% -8%, var(--bg-1), transparent 55%),
    radial-gradient(820px 420px at 96% 0%, var(--bg-2), transparent 52%),
    var(--bg-base);
}

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(18px);
  -webkit-backdrop-filter: blur(18px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  box-shadow: 0 10px 28px rgba(20, 32, 51, 0.04);
}

.header-top {
  min-height: 68px;
  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: 44px;
  height: 44px;
  border-radius: 14px;
  overflow: hidden;
  flex: none;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 6px 14px rgba(20, 32, 51, 0.06);
}

.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: 17px;
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

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

.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: 42px;
  border: 1px solid rgba(20, 32, 51, 0.1);
  border-radius: 14px;
  padding: 0 16px;
  font: inherit;
  background: var(--input-bg);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.header-search input:focus {
  border-color: rgba(225, 29, 72, 0.35);
  box-shadow: 0 0 0 4px 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: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.cat-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  max-height: none;
  overflow: visible;
}

.cat-nav.is-collapsed {
  max-height: 84px;
  overflow: hidden;
}

.cat-nav-more {
  display: none;
  border: 1px dashed rgba(20, 32, 51, 0.18);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  padding: 7px 12px;
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  flex: none;
}

.cat-nav-more.is-visible {
  display: inline-flex;
  align-items: center;
}

.cat-tab {
  border: 1px solid var(--tab-border);
  background: var(--tab-bg);
  color: var(--muted);
  padding: 7px 12px;
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  flex: none;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.cat-tab i {
  font-style: normal;
  margin-left: 4px;
  opacity: 0.55;
  font-size: 12px;
}

.cat-tab:hover {
  color: var(--ink);
  border-color: rgba(20, 32, 51, 0.16);
}

.cat-tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  box-shadow: var(--play-btn-shadow);
}

.cat-tab.active i {
  opacity: 0.85;
}

.site-main {
  padding: 18px 0 28px;
}

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

.section-head-main {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.section-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.01em;
}

.section-head span#lobbyCount,
.section-head-main > span {
  color: var(--muted);
  font-size: 13px;
}

.layout-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(20, 32, 51, 0.06);
  border: 1px solid rgba(20, 32, 51, 0.08);
  flex: none;
}

.layout-switch-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.layout-switch-btn:hover {
  color: var(--ink);
}

.layout-switch-btn.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: var(--play-btn-shadow);
}

.lobby-online {
  flex: none;
  font-size: 12px;
  font-weight: 700;
  color: #059669;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.22);
  border-radius: 999px;
  padding: 6px 10px;
  white-space: nowrap;
}

.lobby-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.sort-tabs,
.mem-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
}

.chip {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.chip i {
  font-style: normal;
  opacity: 0.75;
  margin-left: 2px;
}

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

.chip.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: var(--play-btn-shadow);
}

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

.game-card-wrap {
  position: relative;
  min-width: 0;
}

.fav-btn {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.35);
  color: rgba(255, 255, 255, 0.75);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

.fav-btn.is-on,
.fav-btn:hover {
  color: #fbbf24;
  background: rgba(15, 23, 42, 0.55);
}

.game-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  min-height: 152px;
  container-type: inline-size;
  container-name: game-card;
  height: 100%;
}

.game-card-wrap:hover .game-card {
  transform: translateY(-4px);
  box-shadow: 0 18px 34px rgba(20, 32, 51, 0.13);
}

.game-cover {
  position: relative;
  flex: 1;
  min-height: 118px;
  padding: 14px 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  color: #fff;
  overflow: hidden;
}

.game-cover.has-img {
  background: #0f172a !important;
}

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

.game-cover.has-img .game-cover-top,
.game-cover.has-img h3 {
  position: relative;
  z-index: 1;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}

.game-cover.has-img::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.15) 20%, rgba(15, 23, 42, 0.72) 100%);
  z-index: 0;
  pointer-events: none;
}

.game-cover-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.game-initial {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(6px);
  flex: none;
}

.game-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  max-width: calc(100% - 44px);
  min-width: 0;
}

.badge-heat {
  background: rgba(251, 191, 36, 0.92) !important;
  color: #78350f !important;
  border-color: transparent !important;
}

.game-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.badge-pwd {
  background: rgba(255, 247, 237, 0.95);
  color: #9a3412;
  border-color: rgba(253, 186, 116, 0.85);
  max-width: none;
  height: auto;
  min-height: 22px;
  white-space: normal;
  word-break: break-all;
  line-height: 1.25;
  padding: 3px 8px;
  cursor: copy;
  user-select: text;
  text-align: center;
}

.badge-pwd.copied {
  color: #047857;
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.badge-pc {
  background: rgba(239, 246, 255, 0.92);
  color: #1d4ed8;
  border-color: rgba(147, 197, 253, 0.75);
}

.game-cover h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.12);
  word-break: break-word;
}

.game-cover[data-tone="0"] {
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.14), transparent 42%),
    linear-gradient(145deg, var(--tone-0-a), var(--tone-0-b));
}
.game-cover[data-tone="1"] {
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.14), transparent 42%),
    linear-gradient(145deg, var(--tone-1-a), var(--tone-1-b));
}
.game-cover[data-tone="2"] {
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.14), transparent 42%),
    linear-gradient(145deg, var(--tone-2-a), var(--tone-2-b));
}
.game-cover[data-tone="3"] {
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.14), transparent 42%),
    linear-gradient(145deg, var(--tone-3-a), var(--tone-3-b));
}
.game-cover[data-tone="4"] {
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.14), transparent 42%),
    linear-gradient(145deg, var(--tone-4-a), var(--tone-4-b));
}
.game-cover[data-tone="5"] {
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.14), transparent 42%),
    linear-gradient(145deg, var(--tone-5-a), var(--tone-5-b));
}

.game-info {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #fff;
  border-top: 1px solid rgba(20, 32, 51, 0.04);
}

.game-need-pwd {
  display: inline-flex;
  align-items: center;
  flex: none;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  color: #b45309;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  padding: 4px 8px;
}

.game-pwd-placeholder {
  display: block;
  min-height: 1px;
  flex: 1;
}

.game-info em {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  margin-left: auto;
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  text-align: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 999px;
  padding: 5px 10px;
  box-sizing: border-box;
  box-shadow: var(--play-btn-shadow);
}

.game-card:hover .game-info em {
  filter: brightness(1.05);
}

.hidden { display: none !important; }

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

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

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

.page-btn.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--play-btn-shadow);
}

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

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

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

.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--header-border);
  background: var(--footer-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 16px 0 20px;
  margin-top: 8px;
  box-shadow: none;
}

.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: var(--footer-text);
  font-size: 12px;
  line-height: 1.6;
}

.footer-line a {
  color: var(--footer-text);
  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;
}

.footer-tools {
  margin-top: 10px;
  font-size: 12px;
}

.footer-tools a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px dashed rgba(100, 116, 139, 0.45);
}

.footer-tools a:hover {
  color: var(--ink);
}

@media (max-width: 1200px) {
  .game-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

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

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

  .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .lobby-filters {
    width: 100%;
    justify-content: flex-start;
  }

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

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

  .section-head h2 {
    font-size: 18px;
  }

  .layout-switch-btn {
    padding: 6px 10px;
    font-size: 11px;
  }

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

  .game-card {
    min-height: 150px;
  }

  .game-cover {
    min-height: 104px;
    padding: 12px;
  }

  .game-cover h3 {
    font-size: 14px;
  }
}

/* —— 书库前台（对齐插件 xm-game-catalog） —— */
body.xyx-library {
  --xm-game-accent: var(--accent);
  --theme-color: var(--accent);
  --key-color: var(--ink);
  --muted-color: var(--muted);
  --muted-bg-color: rgba(248, 250, 252, 0.96);
  --main-border-color: var(--line);
  --main-bg-color: #fff;
  --main-radius: 12px;
}

.site-header--slim .header-top {
  min-height: 56px;
}

.site-header--slim .layout-switch {
  flex-shrink: 0;
}

.xyx-library .site-main {
  padding-top: 18px;
  padding-bottom: 28px;
}

.xyx-library .xm-game-catalog {
  width: 100%;
  max-width: none;
  margin: 0;
}

.xyx-library .site-main > .container {
  width: 100%;
  max-width: none;
}

.xyx-library .xm-game-pager {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 28px 0 24px;
  padding: 12px 8px;
  background: transparent;
  border: 0;
  border-radius: 0;
  pointer-events: auto;
}

.xyx-library .xm-game-pager .xm-game-page-btn {
  position: relative;
  z-index: 2;
  pointer-events: auto;
}

.xyx-library .site-footer {
  margin-top: 0;
}

.xyx-vendor-credit.site-vendor-credit {
  margin-top: 12px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.xyx-vendor-credit.site-vendor-credit a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.xyx-vendor-credit.site-vendor-credit a:hover {
  text-decoration: underline;
}

html[data-layout="hall"] .xyx-library .xm-game-pager {
  background: transparent;
  border: 0;
}

.xyx-library .layout-switch-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
