/* ============================================================
 * iPlay 游戏库 · 视觉设计系统
 * 霓虹暗色 / 玻璃拟态 / 响应式
 * ============================================================ */
:root {
  --bg: #0a0e1a;
  --bg-2: #0e1424;
  --surface: rgba(255, 255, 255, 0.05);
  --surface-2: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #eaf0ff;
  --muted: #9aa6c4;
  --faint: #6b769a;
  --primary: #7c5cff;
  --primary-2: #2dd4ff;
  --accent: #ff4d8d;
  --gold: #ffd34d;
  --grad: linear-gradient(135deg, #7c5cff 0%, #2dd4ff 100%);
  --grad-warm: linear-gradient(135deg, #ff4d8d 0%, #ffb14d 100%);
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.7);
  --maxw: 1200px;
  --font-display: "Orbitron", "Rajdhani", system-ui, sans-serif;
  --font-body: "Rajdhani", system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: radial-gradient(1200px 700px at 80% -10%, rgba(124, 92, 255, 0.18), transparent 60%),
              radial-gradient(900px 600px at 0% 10%, rgba(45, 212, 255, 0.12), transparent 55%),
              var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0.2px;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(10, 14, 26, 0.72);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; gap: 18px; height: 66px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); }
.brand-mark {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px;
  color: #fff; background: var(--grad); box-shadow: 0 8px 22px -8px var(--primary);
}
.brand-text { font-weight: 800; font-size: 20px; letter-spacing: 1px; line-height: 1; }
.brand-text small { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 6px; letter-spacing: 2px; }

.mainnav { display: flex; gap: 4px; margin-left: 12px; }
.nav-link {
  padding: 9px 14px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: 15px;
  transition: color .2s, background .2s;
}
.nav-link:hover, .nav-link.active { color: var(--text); background: var(--surface); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.searchbox {
  display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); min-width: 220px;
  transition: border-color .2s, box-shadow .2s;
}
.searchbox:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.18); }
.search-ico { color: var(--faint); flex: none; }
.searchbox input {
  border: 0; background: transparent; color: var(--text); outline: none; width: 100%;
  font-family: var(--font-body); font-size: 15px;
}
.searchbox input::placeholder { color: var(--faint); }

.hamburger { display: none; flex-direction: column; gap: 5px; width: 42px; height: 42px;
  border: 1px solid var(--border); border-radius: 11px; background: var(--surface); cursor: pointer; }
.hamburger span { display: block; width: 18px; height: 2px; margin: 0 auto; background: var(--text); border-radius: 2px; transition: .25s; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 12px; font-weight: 700; font-size: 15px; cursor: pointer;
  border: 1px solid transparent; transition: transform .15s, box-shadow .2s, background .2s; font-family: var(--font-body);
}
.btn-primary { color: #fff; background: var(--grad); box-shadow: 0 14px 30px -12px var(--primary); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 18px 36px -12px var(--primary); }
.btn-ghost { color: var(--text); background: var(--surface); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-block { width: 100%; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: 70px 0 56px; }
.hero-bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.orb { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; }
.orb-1 { width: 360px; height: 360px; background: #7c5cff; top: -80px; left: -60px; }
.orb-2 { width: 320px; height: 320px; background: #2dd4ff; bottom: -120px; right: -40px; }
.orb-3 { width: 240px; height: 240px; background: #ff4d8d; top: 40px; right: 28%; opacity: .35; }
.grid-lines {
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 30%, #000 30%, transparent 75%);
}
.hero-inner { position: relative; z-index: 1; display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 40px; align-items: center; }
.badge-pill {
  display: inline-block; padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 700;
  color: var(--primary-2); background: rgba(45, 212, 255, 0.10); border: 1px solid rgba(45, 212, 255, 0.3);
  letter-spacing: 1px;
}
.hero-title { font-family: var(--font-display); font-size: clamp(38px, 6vw, 64px); line-height: 1.05;
  margin: 18px 0 14px; font-weight: 800; letter-spacing: 1px; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { color: var(--muted); font-size: 17px; line-height: 1.7; margin: 0 0 26px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-stats { list-style: none; display: flex; gap: 34px; padding: 0; margin: 34px 0 0; }
.hero-stats li { display: flex; flex-direction: column; }
.hero-stats b { font-family: var(--font-display); font-size: 30px; color: var(--text); }
.hero-stats span { color: var(--faint); font-size: 13px; letter-spacing: 1px; }

.hero-showcase { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.show-card {
  position: relative; border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 3;
  border: 1px solid var(--border); box-shadow: var(--shadow);
  display: flex; align-items: flex-end; padding: 14px; color: #fff; font-weight: 700;
  animation: floaty 6s ease-in-out infinite;
}
.show-card:nth-child(2) { animation-delay: -2s; transform: translateY(14px); }
.show-card:nth-child(3) { animation-delay: -4s; }
.show-card:nth-child(4) { animation-delay: -1s; transform: translateY(14px); }
.show-card svg { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; }
.show-card .show-title { position: relative; z-index: 2; font-size: 15px; text-shadow: 0 2px 8px rgba(0,0,0,.5); }
.show-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,.55)); }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* ---------- 通用 section ---------- */
.section { padding: 64px 0; }
.section-alt { background: linear-gradient(180deg, rgba(255,255,255,.02), transparent); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 26px; flex-wrap: wrap; }
.section-title { font-family: var(--font-display); font-size: 28px; font-weight: 800; margin: 0; letter-spacing: .5px; }
.section-title::before { content: ""; display: inline-block; width: 6px; height: 22px; border-radius: 3px;
  background: var(--grad); margin-right: 12px; vertical-align: -3px; }
.section-note { color: var(--faint); font-size: 14px; }

/* 排序分段控件 */
.sort-control { display: flex; align-items: center; gap: 10px; }
.sort-label { color: var(--faint); font-size: 14px; }
.seg { display: inline-flex; padding: 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.seg-btn { border: 0; background: transparent; color: var(--muted); font-weight: 700; font-size: 14px;
  padding: 8px 16px; border-radius: 9px; cursor: pointer; font-family: var(--font-body); transition: .2s; }
.seg-btn.active { color: #fff; background: var(--grad); }

/* 分类 chips */
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 28px; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  padding: 9px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; cursor: pointer;
  transition: .2s; display: inline-flex; align-items: center; gap: 7px;
}
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip.active { color: #fff; background: var(--grad); border-color: transparent; box-shadow: 0 10px 24px -12px var(--primary); }
.chip .chip-count { font-size: 12px; opacity: .8; }

/* ---------- 游戏网格 ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 22px; }
.grid-sm { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }

.card {
  position: relative; border-radius: var(--radius); overflow: hidden; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border);
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.card:hover { transform: translateY(-6px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.card-cover { position: relative; aspect-ratio: 3 / 4; overflow: hidden; }
.card-cover svg { width: 100%; height: 100%; display: block; }
.card-rank-badge {
  position: absolute; top: 10px; left: 10px; z-index: 3; font-family: var(--font-display);
  font-size: 13px; font-weight: 800; color: #1a1205; background: var(--gold);
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; box-shadow: 0 6px 14px -6px rgba(0,0,0,.6);
}
.card-hot {
  position: absolute; top: 10px; right: 10px; z-index: 3; font-size: 12px; font-weight: 700;
  color: #fff; background: var(--grad-warm); padding: 4px 10px; border-radius: 999px;
}
.card-body { padding: 14px 14px 16px; }
.card-title { font-weight: 700; font-size: 16px; margin: 0 0 8px; line-height: 1.3; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tag { font-size: 12px; color: var(--primary-2); background: rgba(45, 212, 255, 0.10);
  border: 1px solid rgba(45, 212, 255, 0.22); padding: 3px 9px; border-radius: 999px; }
.card-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rating { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; color: var(--gold); font-size: 14px; }
.rating svg { width: 15px; height: 15px; }
.plays { color: var(--faint); font-size: 13px; }
.card-play {
  position: absolute; left: 14px; right: 14px; bottom: 14px; z-index: 4;
  opacity: 0; transform: translateY(8px); transition: .2s;
}
.card:hover .card-play { opacity: 1; transform: translateY(0); }

.empty-tip { text-align: center; color: var(--faint); padding: 50px 0; font-size: 16px; }

/* ---------- 排行榜 ---------- */
.rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.rank-item {
  display: grid; grid-template-columns: 48px 64px 1fr auto; align-items: center; gap: 16px;
  padding: 12px 16px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border);
  transition: .2s; cursor: pointer;
}
.rank-item:hover { border-color: var(--border-strong); background: var(--surface-2); transform: translateX(4px); }
.rank-no { font-family: var(--font-display); font-size: 22px; font-weight: 800; color: var(--faint); text-align: center; }
.rank-item:nth-child(1) .rank-no { color: #ffd34d; }
.rank-item:nth-child(2) .rank-no { color: #cdd6ea; }
.rank-item:nth-child(3) .rank-no { color: #ff9d5c; }
.rank-cover { width: 64px; height: 64px; border-radius: 10px; overflow: hidden; }
.rank-cover svg { width: 100%; height: 100%; }
.rank-info b { font-size: 16px; font-weight: 700; }
.rank-info .rank-genre { color: var(--muted); font-size: 13px; }
.rank-right { text-align: right; }
.rank-right .rating { font-size: 15px; }
.rank-right .plays { display: block; margin-top: 3px; }

/* ---------- CTA ---------- */
.cta { padding: 70px 0; }
.cta-inner { text-align: center; padding: 54px 24px; border-radius: 24px;
  background: linear-gradient(135deg, rgba(124,92,255,.22), rgba(45,212,255,.16));
  border: 1px solid var(--border); }
.cta-inner h2 { font-family: var(--font-display); font-size: clamp(26px, 4vw, 38px); margin: 0 0 12px; }
.cta-inner p { color: var(--muted); margin: 0 0 24px; font-size: 16px; }

/* ---------- 页脚 ---------- */
.footer { border-top: 1px solid var(--border); padding: 40px 0 30px; background: var(--bg-2); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; justify-content: space-between; }
.footer-brand p { color: var(--faint); margin: 8px 0 0; font-size: 14px; }
.footer-links { display: flex; gap: 22px; }
.footer-links a { color: var(--muted); font-weight: 600; }
.footer-links a:hover { color: var(--text); }
.footer-copy { width: 100%; color: var(--faint); font-size: 13px; margin: 18px 0 0; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%) translateY(20px);
  background: rgba(20, 26, 44, 0.95); color: #fff; padding: 13px 22px; border-radius: 12px;
  border: 1px solid var(--border-strong); box-shadow: var(--shadow); opacity: 0; pointer-events: none;
  transition: .25s; z-index: 200; font-weight: 600;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 模态框 ---------- */
.modal-mask { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center;
  background: rgba(5, 8, 16, 0.72); backdrop-filter: blur(6px); padding: 20px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(720px, 100%); max-height: 88vh; overflow: auto; border-radius: 20px;
  background: var(--bg-2); border: 1px solid var(--border-strong); box-shadow: var(--shadow);
  animation: pop .25s; }
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-hero { position: relative; aspect-ratio: 16 / 7; overflow: hidden; }
.modal-hero svg { width: 100%; height: 100%; }
.modal-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 50%, var(--bg-2)); }
.modal-content { padding: 22px 26px 26px; margin-top: -40px; position: relative; z-index: 2; }
.modal-title { font-family: var(--font-display); font-size: 26px; font-weight: 800; margin: 0 0 10px; }
.modal-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.modal-desc { color: var(--muted); line-height: 1.75; font-size: 15px; margin: 0 0 20px; }
.modal-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 22px; }
.modal-stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px; text-align: center; }
.modal-stat b { display: block; font-family: var(--font-display); font-size: 18px; color: var(--text); }
.modal-stat span { color: var(--faint); font-size: 12px; }
.modal-close { position: absolute; top: 14px; right: 14px; z-index: 5; width: 38px; height: 38px;
  border-radius: 10px; border: 1px solid var(--border-strong); background: rgba(10,14,26,.6); color: #fff;
  cursor: pointer; font-size: 20px; line-height: 1; display: grid; place-items: center; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-showcase { max-width: 460px; }
  .mainnav { position: fixed; top: 66px; left: 0; right: 0; flex-direction: column; gap: 0;
    background: rgba(10,14,26,.97); border-bottom: 1px solid var(--border); padding: 8px 16px 14px;
    transform: translateY(-130%); transition: transform .28s; }
  .mainnav.open { transform: translateY(0); }
  .nav-link { padding: 13px 10px; border-radius: 10px; }
  .hamburger { display: flex; }
  .searchbox { min-width: 0; flex: 1; }
}
@media (max-width: 620px) {
  .wrap { padding: 0 16px; }
  .topbar-inner { gap: 10px; }
  .brand-text small { display: none; }
  .searchbox input { font-size: 14px; }
  .hero { padding: 48px 0 40px; }
  .hero-stats { gap: 22px; }
  .hero-stats b { font-size: 24px; }
  .section { padding: 48px 0; }
  .section-title { font-size: 23px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
  .grid-sm { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .rank-item { grid-template-columns: 38px 50px 1fr; }
  .rank-right { grid-column: 1 / -1; text-align: left; display: flex; gap: 14px; align-items: center; }
  .rank-right .plays { margin-top: 0; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}
