/* ============================================
   Game Hub - 二次元游戏中心
   Anime-style Game Portal CSS
   ============================================ */

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

:root {
  --pink: #ff6b9d;
  --pink-light: #ffa3c4;
  --purple: #7c5cbf;
  --purple-light: #b490e8;
  --teal: #4ecdc4;
  --teal-light: #7ee8e0;
  --gold: #ffd700;
  --gold-dark: #c8a600;
  --bg-dark: #0a0a1a;
  --bg-panel: rgba(20, 20, 50, 0.92);
  --bg-card: rgba(30, 30, 65, 0.85);
  --text: #e8e8f0;
  --text-dim: #9999bb;
  --red: #ff4757;
  --green: #2ed573;
  --orange: #ffa502;
  --blue: #5352ed;
  --border-glow: rgba(255, 107, 157, 0.3);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  cursor: default;
  user-select: none;
}

/* ========== Animated Background ========== */
.stars-bg {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 0;
  pointer-events: none;
}

.star {
  position: absolute;
  background: white;
  border-radius: 50%;
  animation: twinkle var(--dur) ease-in-out infinite;
  animation-delay: var(--delay);
}

@keyframes twinkle {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.5); }
}

.floating-particle {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: floatUp var(--dur) linear infinite;
  animation-delay: var(--delay);
}

@keyframes floatUp {
  0% { transform: translateY(0) translateX(0) scale(1); opacity: 0.8; }
  50% { transform: translateY(-50vh) translateX(30px) scale(0.5); opacity: 0.3; }
  100% { transform: translateY(-100vh) translateX(-20px) scale(0); opacity: 0; }
}

/* ========== Main Container ========== */
.main-container {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* ========== Header ========== */
.header {
  text-align: center;
  padding: 40px 20px 20px;
}

.header-logo {
  font-size: 3rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--pink), var(--purple), var(--teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  letter-spacing: 2px;
  margin-bottom: 8px;
  animation: logoShine 3s ease-in-out infinite;
}

@keyframes logoShine {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.3); }
}

.header-subtitle {
  font-size: 1.1rem;
  color: var(--text-dim);
  font-weight: 300;
  letter-spacing: 4px;
}

/* Decorative line */
.header::after {
  content: '';
  display: block;
  width: 200px;
  height: 2px;
  margin: 15px auto 0;
  background: linear-gradient(90deg, transparent, var(--pink), var(--purple), var(--teal), transparent);
  border-radius: 1px;
}

/* ========== Game Grid ========== */
.games-section {
  padding: 20px 0;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 24px;
  padding-left: 16px;
  border-left: 4px solid var(--pink);
  color: var(--text);
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-cols, 4), 1fr);
  gap: 24px;
}

/* Section header: title + column selector on same row */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.section-header .section-title {
  margin-bottom: 0;
}
.grid-cols-selector {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-card);
  padding: 4px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
}
.cols-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  padding: 0 6px;
}
.cols-btn {
  width: 32px; height: 28px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.cols-btn:hover {
  color: var(--text);
  border-color: rgba(255,255,255,0.15);
}
.cols-btn.active {
  background: var(--pink);
  color: #fff;
  border-color: var(--pink);
  box-shadow: 0 0 10px rgba(255,107,157,0.3);
}

/* ========== Game Card ========== */
.game-card {
  position: relative;
  background: var(--bg-card);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.06);
  text-decoration: none;
  color: inherit;
  display: block;
}

.game-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 40px rgba(255, 107, 157, 0.25), 0 0 60px rgba(124, 92, 191, 0.15);
  border-color: var(--border-glow);
}

.game-card:active {
  transform: translateY(-2px);
  transition: all 0.1s;
}

.card-banner {
  height: 180px;
  position: relative;
  overflow: hidden;
}

.card-banner-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-banner-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, transparent 50%, var(--bg-card) 100%);
}

.card-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--pink);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.card-badge.new {
  background: var(--teal);
  animation: badgePulse 2s ease-in-out infinite;
}

.card-badge.hot {
  background: var(--red);
  animation: badgePulse 1.5s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 157, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(255, 107, 157, 0); }
}

.card-body {
  padding: 16px 20px 20px;
}

.card-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title-icon {
  font-size: 1.4rem;
}

.card-desc {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.5;
  margin-bottom: 12px;
}

.card-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.tag.star {
  color: var(--gold);
  border-color: rgba(255, 215, 0, 0.3);
}

/* ========== Card Banner CSS Art ========== */
/*
 * Each banner is a miniature "screenshot" of its game,
 * built with pure CSS (gradients, box-shadows, pseudo-elements).
 * All art matches the dark anime/cyberpunk aesthetic.
 */

/* ---- Tower Defense: Castle + towers + path ---- */
.banner-td {
  background:
    /* Sky gradient */
    linear-gradient(180deg, #0d1b2a 0%, #1b2838 25%, #1a3a1a 50%, #0d2a0d 100%);
  position: relative;
  overflow: hidden;
}
/* Castle at right side */
.banner-td::before {
  content: '';
  position: absolute;
  right: 12px; bottom: 18px;
  width: 52px; height: 56px;
  background:
    /* Castle body */
    linear-gradient(180deg, #8B7355 0%, #6B5B45 60%, #5B4B35 100%);
  border-radius: 4px 4px 0 0;
  box-shadow:
    /* Battlements */
    0 -12px 0 #8B7355,
    12px -12px 0 #8B7355, -12px -12px 0 #8B7355,
    /* Gate */
    inset 0 30px 0 #3a2a0a;
}
/* Castle gate arch */
.banner-td::before {
  clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 70% 100%, 70% 65%, 30% 65%, 30% 100%, 0% 100%);
}
/* Towers + path + enemies via box-shadow on ::after */
.banner-td::after {
  content: '';
  position: absolute;
  bottom: 28px; left: 8px;
  width: 6px; height: 6px;
  background: #c8a660;
  border-radius: 3px;
  box-shadow:
    /* Winding path */
    10px 2px 0 #a08040, 20px 4px 0 #a08040, 30px 4px 0 #c8a660,
    40px 2px 0 #a08040, 50px -1px 0 #c8a660, 60px -3px 0 #a08040,
    70px -5px 0 #c8a660, 80px -7px 0 #a08040, 90px -6px 0 #c8a660,
    100px -4px 0 #a08040, 110px -2px 0 #c8a660, 120px 0 0 #a08040,
    130px 2px 0 #c8a660, 140px 2px 0 #a08040,
    /* Tower 1 (archer) - left side */
    -5px -30px 0 2px #ff6b9d,
    /* Tower 2 (mage) - mid-left */
    50px -28px 0 2px #7c5cbf,
    /* Tower 3 (cannon) - near castle */
    100px -29px 0 2px #ffa502,
    /* Small enemy dots on path */
    15px 4px 0 0 #ff4757, 35px 6px 0 0 #ff4757,
    55px 1px 0 0 #ff4757, 75px -3px 0 0 #e74c3c,
    95px -4px 0 0 #e74c3c, 115px 0 0 0 #ff4757,
    /* Clouds / atmosphere */
    -8px -50px 0 20px rgba(255,255,255,0.03),
    60px -55px 0 25px rgba(255,255,255,0.02);
}

/* ---- Memory Match: Card grid with flipped cards ---- */
.banner-memory {
  background:
    linear-gradient(180deg, #1a1030 0%, #1e1440 40%, #1a1035 100%);
  position: relative;
  overflow: hidden;
}
/* Grid of face-down cards */
.banner-memory::before {
  content: '';
  position: absolute;
  top: 20px; left: 50%;
  transform: translateX(-50%);
  width: 36px; height: 48px;
  background: linear-gradient(135deg, #7c5cbf, #5b3f9f);
  border-radius: 5px;
  box-shadow:
    44px 0 0 #6b4fbf,
    88px 0 0 #5b3f9f,
    -44px 0 0 #8b6fcf,
    -88px 0 0 #6b4fbf,
    /* Row 2 */
    0 56px 0 #8b6fcf,
    44px 56px 0 #5b3f9f,
    88px 56px 0 #6b4fbf,
    -44px 56px 0 #7c5cbf,
    -88px 56px 0 #5b3f9f;
}
/* Flipped cards showing emoji-like dots */
.banner-memory::after {
  content: '';
  position: absolute;
  top: 28px; left: 50%;
  transform: translateX(-50%);
  width: 28px; height: 32px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  box-shadow:
    /* Card 1 flipped - 🌸 pink glow */
    -88px 0 0 0 #ff6b9d,
    -82px 6px 0 0 #ff6b9d, -94px 6px 0 0 #ff6b9d,
    /* Card 2 flipped - ⭐ gold glow */
    88px 56px 0 0 #ffd700,
    94px 62px 0 0 #ffd700, 82px 62px 0 0 #ffd700,
    /* sparkle dots */
    -80px 0 0 2px rgba(255,215,0,0.6),
    96px 56px 0 2px rgba(255,215,0,0.6),
    /* glowing matched pair connector */
    -44px 28px 0 1px rgba(78,205,196,0.3),
    44px 28px 0 1px rgba(78,205,196,0.3);
  animation: memoryShimmer 3s ease-in-out infinite;
}
@keyframes memoryShimmer {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* ---- Snake: Pixel snake on dark grid ---- */
.banner-snake {
  background:
    /* Grid pattern */
    linear-gradient(rgba(46,213,115,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(46,213,115,0.04) 1px, transparent 1px),
    linear-gradient(180deg, #0a1a10 0%, #0d2015 50%, #0a150d 100%);
  background-size: 16px 16px, 16px 16px, 100% 100%;
  position: relative;
  overflow: hidden;
}
/* Snake body made of connected dots */
.banner-snake::before {
  content: '';
  position: absolute;
  top: 55px; left: 20px;
  width: 12px; height: 12px;
  background: #2ed573;
  border-radius: 3px;
  box-shadow:
    /* Head (brighter) */
    0 0 0 0 #2ed573,
    /* Body segments winding down */
    14px 2px 0 #27ae60, 28px 4px 0 #2ed573, 42px 4px 0 #27ae60,
    56px 2px 0 #2ed573, 70px -1px 0 #27ae60, 84px -4px 0 #2ed573,
    98px -6px 0 #27ae60, 112px -4px 0 #2ed573, 126px -1px 0 #27ae60,
    140px 2px 0 #2ed573, 154px 4px 0 #27ae60,
    /* Eyes */
    3px -4px 0 2px #fff, 9px -4px 0 2px #fff,
    3px -4px 0 4px #111, 9px -4px 0 4px #111,
    /* Tongue */
    14px 0 0 0 #ff4757;
}
/* Food items */
.banner-snake::after {
  content: '';
  position: absolute;
  top: 30px; right: 50px;
  width: 10px; height: 10px;
  background: #ff4757;
  border-radius: 50%;
  box-shadow:
    /* More food */
    60px 40px 0 #ffa502, 100px 10px 0 #ffd700,
    -30px 50px 0 #ff6b9d, 80px 60px 0 #ff4757,
    /* Bonus food (star shape approximation) */
    150px 30px 0 0 #ffd700,
    150px 26px 0 0 #ffd700, 146px 30px 0 0 #ffd700,
    154px 30px 0 0 #ffd700, 150px 34px 0 0 #ffd700;
  animation: snakeFoodPulse 2s ease-in-out infinite;
}
@keyframes snakeFoodPulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}

/* ---- Slider Puzzle: Colorful tiles with one sliding ---- */
.banner-puzzle {
  background:
    linear-gradient(180deg, #1a1520 0%, #201828 40%, #1a1220 100%);
  position: relative;
  overflow: hidden;
}
/* 3x3 puzzle grid */
.banner-puzzle::before {
  content: '';
  position: absolute;
  top: 22px; left: 50%;
  transform: translateX(-50%);
  width: 38px; height: 38px;
  border-radius: 4px;
  box-shadow:
    /* Row 1 */
    42px 0 0 0 #ff6b9d, 84px 0 0 0 #ffa502,
    /* Row 2 */
    0 43px 0 0 #4ecdc4, 42px 43px 0 0 #7c5cbf, 84px 43px 0 0 #ffd700,
    /* Row 3 */
    0 86px 0 0 #5352ed, 42px 86px 0 0 #2ed573;
  animation: puzzleShift 3s ease-in-out infinite;
}
/* The sliding tile (bottom-right position, animated) */
.banner-puzzle::after {
  content: '';
  position: absolute;
  top: 22px; left: 50%;
  width: 38px; height: 38px;
  background: linear-gradient(135deg, #ff4757, #e74c3c);
  border-radius: 4px;
  transform: translateX(-50%);
  animation: tileSlide 3s ease-in-out infinite;
}
@keyframes tileSlide {
  0%, 70% { transform: translate(85px, 86px); opacity: 1; }
  85%, 100% { transform: translate(85px, 43px); opacity: 0.6; }
}
@keyframes puzzleShift {
  0%, 70% { opacity: 1; }
  85%, 100% { opacity: 1; }
}

/* ---- Tetris: Full board with falling blocks ---- */
.banner-tetris {
  background:
    /* Subtle grid */
    linear-gradient(rgba(78,205,196,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(78,205,196,0.05) 1px, transparent 1px),
    linear-gradient(180deg, #0a0a20 0%, #0d1028 50%, #0a0a1a 100%);
  background-size: 18px 18px, 18px 18px, 100% 100%;
  position: relative;
  overflow: hidden;
}
/* Stacked blocks at bottom */
.banner-tetris::before {
  content: '';
  position: absolute;
  bottom: 0; left: 15px;
  width: 18px; height: 18px;
  border-radius: 2px;
  box-shadow:
    /* Row at bottom (nearly full) */
    0 0 0 #5352ed, 20px 0 0 #ff4757, 40px 0 0 #ffd700, 60px 0 0 #2ed573,
    80px 0 0 #ffa502, 100px 0 0 #7c5cbf, 120px 0 0 #ff4757, 140px 0 0 #4ecdc4,
    /* Row 2 from bottom (missing one) */
    0 -21px 0 #ffa502, 20px -21px 0 #4ecdc4, 40px -21px 0 #5352ed,
    80px -21px 0 #7c5cbf, 100px -21px 0 #ffd700, 120px -21px 0 #ff4757,
    /* Row 3 (partial) */
    0 -42px 0 #ff4757, 20px -42px 0 #ffd700, 40px -42px 0 #2ed573,
    100px -42px 0 #4ecdc4, 120px -42px 0 #5352ed,
    /* Row 4 */
    0 -63px 0 #7c5cbf;
}
/* Falling T-piece + glow */
.banner-tetris::after {
  content: '';
  position: absolute;
  top: 8px; left: 60px;
  width: 18px; height: 18px;
  background: #7c5cbf;
  border-radius: 2px;
  box-shadow:
    -20px 20px 0 #7c5cbf, 0 20px 0 #7c5cbf, 20px 20px 0 #7c5cbf,
    0 0 8px 4px rgba(124,92,191,0.5);
  animation: tetrisPieceFall 2.5s ease-in infinite;
}
@keyframes tetrisPieceFall {
  0% { transform: translateY(0); opacity: 1; }
  80% { transform: translateY(80px); opacity: 0.9; }
  90% { transform: translateY(100px); opacity: 0.4; }
  100% { transform: translateY(110px); opacity: 0; }
}

/* ========== Footer ========== */
.footer {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 300;
}

.footer-heart {
  color: var(--pink);
  animation: heartbeat 1.2s ease-in-out infinite;
  display: inline-block;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.3); }
  30% { transform: scale(1); }
  45% { transform: scale(1.2); }
  60% { transform: scale(1); }
}

/* ========== Back Button ========== */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 8px 16px;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.08);
  transition: all 0.3s;
  margin-bottom: 16px;
}

.back-btn:hover {
  color: var(--text);
  border-color: var(--border-glow);
  box-shadow: 0 0 20px rgba(255,107,157,0.15);
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
  background: var(--purple);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--pink);
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .header-logo { font-size: 2rem; }
  .games-grid { --grid-cols: 3; gap: 16px; }
  .card-banner { height: 140px; }
}

@media (max-width: 480px) {
  .header-logo { font-size: 1.6rem; }
  .games-grid { --grid-cols: 1; }
  .card-banner { height: 160px; }
  .section-header { flex-direction: column; align-items: flex-start; }
}

/* ========== Language Switcher ========== */
.lang-switcher {
  appearance: none;
  -webkit-appearance: none;
  padding: 6px 30px 6px 10px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.12);
  background: var(--bg-card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%239999bb'/%3E%3C/svg%3E") no-repeat right 10px center;
  color: var(--text);
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.3s;
}
.lang-switcher:hover { border-color: var(--border-glow); }
.lang-switcher:focus { outline: none; border-color: var(--pink); box-shadow: 0 0 8px rgba(255,107,157,0.2); }
.lang-switcher option {
  background: var(--bg-panel);
  color: var(--text);
}

/* ========== Footer Navigation ========== */
.footer-nav {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}
.footer-nav a {
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.3s;
}
.footer-nav a:hover {
  color: var(--pink);
}
.footer-nav .sep {
  color: var(--text-dim);
  opacity: 0.4;
}

/* ========== Content Pages (Privacy / About / Contact) ========== */
.content-page {
  max-width: 780px;
  margin: 0 auto;
  padding: 20px 24px 40px;
  line-height: 1.8;
}
.content-page h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.content-page h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-top: 28px;
  margin-bottom: 10px;
  color: var(--teal);
  padding-left: 12px;
  border-left: 3px solid var(--teal);
}
.content-page p {
  margin-bottom: 12px;
  color: var(--text-dim);
  font-size: 0.92rem;
}
.content-page a {
  color: var(--teal);
  text-decoration: underline;
  transition: color 0.3s;
}
.content-page a:hover {
  color: var(--pink);
}
.content-page .last-updated {
  margin-top: 32px;
  font-size: 0.82rem;
  color: var(--dim);
  font-style: italic;
}
