:root {
  --brand: #7c3aed;
  --brand-deep: #5b21b6;
  --brand-soft: #a78bfa;
  --ink: #2a1b3d;
  --muted: #8b7d9a;
  --line: #ece2f8;
  --card: #ffffff;
  --page: #f7f4fc;
  --shell: 1200px;
  --radius: 16px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

*::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  color: var(--ink);
  background: var(--page);
  background-image:
    radial-gradient(circle at 12% -4%, rgba(168, 85, 247, 0.14), transparent 42%),
    radial-gradient(circle at 92% 6%, rgba(217, 70, 239, 0.08), transparent 38%),
    radial-gradient(circle at 50% 110%, rgba(124, 58, 237, 0.06), transparent 46%);
  background-attachment: fixed;
  font-family: -apple-system, 'SF Pro Text', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  -webkit-font-smoothing: antialiased;
}

img {
  -webkit-user-drag: none;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}


.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 997;
  max-width: var(--shell);
  height: 54px;
  margin: 0 auto;
  background: transparent;
}

.topbar.scrolled {
  background: transparent;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 0 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  text-decoration: none;
}

.brand img {
  display: block;
  height: 48px;
  width: auto;
  transition: transform 0.3s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.topbar.scrolled .brand img {
  transform: scale(0.92);
}


.page {
  max-width: var(--shell);
  margin: 0 auto;
  padding-top: 54px;
}

.hero {
  position: relative;
  max-width: 940px;
  margin: 10px auto 0;
  padding: 0 16px;
  animation: fade-up 0.5s cubic-bezier(0.22, 0.9, 0.28, 1) both;
}

.hero-glow {
  position: absolute;
  top: 12%;
  left: 50%;
  width: 72%;
  height: 70%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.28), rgba(168, 85, 247, 0) 68%);
  filter: blur(26px);
  transform: translateX(-50%);
  pointer-events: none;
}

.hero-banner {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 20px 34px rgba(88, 28, 135, 0.18));
}


.games {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 10px 20px 40px;
  scroll-margin-top: 64px;
  animation: fade-up 0.5s 0.06s cubic-bezier(0.22, 0.9, 0.28, 1) both;
}

.section-title {
  position: relative;
  display: flex;
  height: 72px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  background: url('../images/button/home-1.webp') center / cover no-repeat;
  text-align: center;
}

.eyebrow {
  position: absolute;
  top: 8px;
  color: rgba(124, 58, 237, 0.1);
  font-size: 38px;
  font-weight: 600;
  letter-spacing: 2px;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.section-title h2 {
  position: relative;
  z-index: 1;
  margin: 12px 0 0;
  background: linear-gradient(91deg, #6d28d9 -20%, #c084fc 120%);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  font-size: 23px;
  font-weight: 600;
  letter-spacing: 1px;
}

.count {
  position: absolute;
  top: 10px;
  right: 2px;
  color: #9b8bb0;
  font-size: 12px;
  white-space: nowrap;
}


.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  margin: 0 0 12px;
  padding: 0 8px;
  border: 1px solid #efe3ff;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search:focus-within {
  border-color: #d9c7ff;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.search-icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  color: #a98ed6;
}

.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 16px;
  color: #2a1b3d;
}

.search input::placeholder {
  color: #b3a3c7;
}

.search input::-webkit-search-cancel-button,
.search input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.search-kbd {
  flex: 0 0 auto;
  padding: 4px 9px;
  border-radius: 7px;
  background: #2f3540;
  color: #ffffff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.search-clear {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #f3ebff;
  color: #8b73ab;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}

.search-clear svg {
  width: 12px;
  height: 12px;
}

.search-clear:active {
  transform: scale(0.88);
}


.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px 10px;
  margin-top: 0;
}

.game {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  text-decoration: none;
  opacity: 0;
  animation: card-in 0.42s cubic-bezier(0.22, 0.9, 0.28, 1) forwards;
  -webkit-tap-highlight-color: transparent;
}

.thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: var(--radius);
  background: linear-gradient(145deg, #f3edfb, #e7dcf7);
  box-shadow: 0 6px 18px rgba(74, 36, 140, 0.1);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(124, 58, 237, 0.07);
  pointer-events: none;
}

.thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 0.35s ease, transform 0.5s cubic-bezier(0.22, 0.9, 0.28, 1);
}

.game.is-loaded .thumb img {
  opacity: 1;
  transform: none;
}

.hot {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  padding: 2px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff8a5c, #e11d48);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 16px;
  box-shadow: 0 3px 10px rgba(225, 29, 72, 0.35);
  pointer-events: none;
}

.name {
  display: block;
  width: 100%;
  padding: 0 2px;
  color: #5d4b75;
  font-size: 12.5px;
  line-height: 1.35;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s ease;
}

@media (hover: hover) {
  .game:hover .thumb {
    transform: translateY(-3px);
    box-shadow: 0 14px 26px rgba(88, 28, 135, 0.2);
  }

  .game:hover .thumb img {
    transform: scale(1.06);
  }

  .game:hover .name {
    color: var(--brand);
  }
}

.game:active .thumb {
  transform: scale(0.96);
}


.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 64px 0 76px;
  color: #9b8bb0;
  text-align: center;
}

.empty svg {
  width: 46px;
  height: 46px;
  margin-bottom: 4px;
  color: #cbb8e8;
}

.empty p {
  color: #6d5b82;
  font-size: 15px;
  font-weight: 600;
}

.empty span {
  font-size: 12.5px;
}

.empty[hidden] {
  display: none;
}


.to-top {
  position: fixed;
  right: max(20px, calc((100vw - var(--shell)) / 2 + 20px));
  bottom: 28px;
  z-index: 960;
  width: 64px;
  height: 64px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.24s ease, transform 0.24s ease;
  -webkit-tap-highlight-color: transparent;
}

.to-top.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.to-top:active {
  transform: scale(0.92);
}

.to-top img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(124, 58, 237, 0.28));
}


@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}


@media (min-width: 600px) {
  .grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px 12px;
  }

  .name {
    font-size: 13px;
  }
}

@media (min-width: 900px) {
  .grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 18px 14px;
  }

  .games {
    padding-top: 18px;
  }
}

@media (max-width: 767px) {
  .section-title {
    height: 54px;
    margin-bottom: 10px;
  }

  .eyebrow {
    font-size: 26px;
    letter-spacing: 1px;
  }

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

@media (min-width: 768px) and (max-width: 1023px) {
  .search {
    height: 46px;
  }
}

@media (min-width: 1024px) {
  .search {
    height: 44px;
    margin-bottom: 16px;
  }

  .search input {
    font-size: 14px;
  }
}

@media (min-width: 1200px) {
  .grid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 22px 16px;
  }

  .name {
    font-size: 13.5px;
  }

  .hot {
    top: 9px;
    left: 9px;
  }
}

@media (max-width: 599px) {
  .hero {
    margin-top: 4px;
    padding: 0 10px;
  }

  .games {
    padding: 6px 14px 30px;
    scroll-margin-top: 60px;
  }

  .to-top {
    right: 14px;
    bottom: 20px;
    width: 56px;
    height: 56px;
  }

  .grid {
    gap: 12px 8px;
  }

  .thumb {
    border-radius: 13px;
  }

  .name {
    font-size: 11.5px;
  }

  .hot {
    top: 6px;
    left: 6px;
    padding: 1px 6px;
    font-size: 9px;
    line-height: 15px;
  }
}

@media (max-width: 380px) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .game {
    opacity: 1;
  }
}
