/* ============================================================
   H5GameCenter Theme - 霓虹街机视觉
   ============================================================ */
:root {
  --bg: #0b0f1e;
  --bg-2: #111731;
  --bg-3: #1a2140;
  --card: #141a33;
  --line: rgba(120, 130, 200, 0.16);
  --text: #e9ecff;
  --text-dim: #8b93b8;
  --pink: #ff2d78;
  --cyan: #22d3ee;
  --violet: #7c5cff;
  --gold: #ffd166;
  --green: #34d399;
  --danger: #ff4d6d;
  --radius: 14px;
  --font-display: 'Rubik', 'Arial Black', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }

/* 背景网格 + 霓虹光晕 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 60% 40% at 20% -5%, rgba(124, 92, 255, 0.22), transparent 60%),
    radial-gradient(ellipse 50% 35% at 90% 0%, rgba(34, 211, 238, 0.16), transparent 60%),
    radial-gradient(ellipse 70% 50% at 50% 110%, rgba(255, 45, 120, 0.12), transparent 65%),
    var(--bg);
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(120, 130, 200, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 130, 200, 0.05) 1px, transparent 1px);
  background-size: 42px 42px;
  pointer-events: none;
}

.app {
  max-width: 720px;
  margin: 0 auto;
  padding-bottom: 84px;
  min-height: 100vh;
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: rgba(11, 15, 30, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan), 0 0 26px rgba(34, 211, 238, 0.6);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1);} 50% { opacity: 0.55; transform: scale(0.82);} }
.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 1.5px;
  background: linear-gradient(90deg, var(--cyan), var(--violet), var(--pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.points-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 45, 120, 0.18), rgba(124, 92, 255, 0.18));
  border: 1px solid rgba(255, 45, 120, 0.4);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  box-shadow: 0 0 14px rgba(255, 45, 120, 0.18);
}
.bolt { color: var(--gold); }

/* ---------- Tabbar ---------- */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 30;
  display: flex;
  max-width: 720px;
  margin: 0 auto;
  background: rgba(13, 18, 36, 0.94);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 0;
  font-size: 11px;
  color: var(--text-dim);
  border-radius: 12px;
  transition: color 0.2s;
}
.tab-item .tab-icon { font-size: 19px; filter: grayscale(0.6); opacity: 0.75; transition: 0.2s; }
.tab-item.active { color: var(--cyan); }
.tab-item.active .tab-icon { filter: none; opacity: 1; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 30px 20px 26px;
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(100deg, transparent 30%, rgba(34, 211, 238, 0.08) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: shine 5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes shine { 0% { transform: translateX(-100%);} 55%, 100% { transform: translateX(100%);} }
.hero-kicker {
  font-size: 12px;
  letter-spacing: 4px;
  color: var(--cyan);
  text-transform: uppercase;
  margin-bottom: 10px;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: 40px;
  line-height: 1.05;
  font-weight: 900;
  letter-spacing: 1px;
  background: linear-gradient(120deg, #fff 20%, var(--cyan) 55%, var(--pink) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(34, 211, 238, 0.35));
}
.hero-sub {
  margin-top: 12px;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.6;
}
.hero-sub b { color: var(--gold); }

/* ---------- Section ---------- */
.section { padding: 6px 18px 20px; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.section-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::before {
  content: '';
  width: 4px; height: 18px; border-radius: 2px;
  background: linear-gradient(var(--pink), var(--violet));
  box-shadow: 0 0 10px var(--pink);
}
.section-more { font-size: 12px; color: var(--text-dim); }

/* ---------- Category chips ---------- */
.chip-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 10px;
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  transition: 0.2s;
}
.chip.active {
  color: #0b0f1e;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  border-color: transparent;
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.4);
}

/* ---------- Game cards ---------- */
.game-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
  animation: rise 0.6s both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
.game-card:hover {
  transform: translateY(-4px);
  border-color: rgba(34, 211, 238, 0.55);
  box-shadow: 0 10px 30px rgba(34, 211, 238, 0.16);
}
.game-card .cover-wrap { position: relative; aspect-ratio: 16 / 10; overflow: hidden; }
.game-card .cover {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
}
.game-card:hover .cover { transform: scale(1.06); }
.game-card .cat-tag {
  position: absolute;
  top: 8px; left: 8px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text);
  background: rgba(11, 15, 30, 0.7);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
}
.game-card .badge {
  position: absolute;
  top: 8px; right: 8px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  color: #0b0f1e;
}
.badge-hot { background: var(--pink); box-shadow: 0 0 12px var(--pink); }
.badge-new { background: var(--cyan); box-shadow: 0 0 12px var(--cyan); }
.game-card .info { padding: 11px 12px 13px; }
.game-card .name {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.game-card .meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 7px;
}
.game-card .plays { font-size: 11px; color: var(--text-dim); }
.price-tag {
  font-size: 12px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 8px;
}
.price-tag.free { color: var(--green); background: rgba(52, 211, 153, 0.12); border: 1px solid rgba(52, 211, 153, 0.4); }
.price-tag.paid { color: var(--gold); background: rgba(255, 209, 102, 0.12); border: 1px solid rgba(255, 209, 102, 0.4); }

/* 横向滚动区 */
.hscroll {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 4px 2px 12px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.hscroll::-webkit-scrollbar { display: none; }
.hscroll .game-card {
  flex: 0 0 158px;
  scroll-snap-align: start;
}

/* 网格区 */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.grid .game-card { animation-delay: calc(var(--i, 0) * 50ms); }

/* 空状态 */
.empty {
  text-align: center;
  color: var(--text-dim);
  padding: 48px 0;
  font-size: 14px;
}
.empty .empty-emoji { font-size: 44px; display: block; margin-bottom: 12px; filter: grayscale(0.4); }

/* ---------- 详情页 ---------- */
.detail-hero {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}
.detail-hero img { width: 100%; height: 100%; object-fit: cover; }
.detail-hero::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 40%, var(--bg) 100%);
}
.detail-body { padding: 0 18px; }
.detail-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: -34px 0 14px; position: relative; z-index: 2; }
.detail-head h1 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 900;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
}
.detail-cats { display: flex; gap: 8px; margin-top: 8px; }
.detail-stats { display: flex; gap: 14px; font-size: 12px; color: var(--text-dim); margin-top: 10px; flex-wrap: wrap; }
.detail-desc {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.8;
  margin: 12px 0 22px;
  white-space: pre-line;
}
.detail-actions { display: flex; gap: 12px; margin: 4px 0 26px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 12px;
  padding: 13px 22px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.5px;
  transition: transform 0.15s, box-shadow 0.2s, filter 0.2s;
  color: #0b0f1e;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--pink), var(--violet));
  box-shadow: 0 6px 22px rgba(255, 45, 120, 0.35);
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-cyan {
  background: linear-gradient(135deg, var(--cyan), #38bdf8);
  box-shadow: 0 6px 22px rgba(34, 211, 238, 0.35);
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- 充值页 ---------- */
.page-title {
  padding: 22px 18px 6px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 900;
}
.wallet-card {
  margin: 14px 18px 6px;
  padding: 18px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255, 45, 120, 0.14), rgba(124, 92, 255, 0.16));
  border: 1px solid rgba(255, 45, 120, 0.35);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 0 24px rgba(255, 45, 120, 0.12);
}
.wallet-label { font-size: 12px; color: var(--text-dim); }
.wallet-points { font-size: 30px; font-weight: 900; color: var(--gold); margin-top: 2px; text-shadow: 0 0 18px rgba(255, 209, 102, 0.4); }
.recharge-options { padding: 18px; }
.recharge-options .section-title { margin-bottom: 14px; }
.option-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.option-item {
  position: relative;
  padding: 16px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
  text-align: center;
  transition: 0.2s;
  cursor: pointer;
}
.option-item.selected {
  border-color: var(--cyan);
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.35), inset 0 0 0 1px var(--cyan);
  transform: translateY(-2px);
}
.option-item .amt { font-size: 17px; font-weight: 800; }
.option-item .gift { font-size: 12px; color: var(--text-dim); margin-top: 5px; }
.option-item .gift b { color: var(--gold); }
.option-item .check {
  position: absolute; top: 8px; right: 8px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--cyan);
  color: #0b0f1e;
  font-size: 12px;
  display: none;
  align-items: center;
  justify-content: center;
}
.option-item.selected .check { display: flex; }
.custom-amount { padding: 0 18px 18px; }
.custom-amount input {
  width: 100%;
  padding: 13px 15px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  outline: none;
}
.custom-amount input:focus { border-color: var(--cyan); box-shadow: 0 0 12px rgba(34, 211, 238, 0.25); }
.pay-methods { padding: 0 18px 8px; }
.pay-method-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  margin-bottom: 10px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
  cursor: pointer;
  transition: 0.2s;
}
.pay-method-item.selected { border-color: var(--cyan); box-shadow: 0 0 14px rgba(34, 211, 238, 0.25); }
.pay-method-item .pm-icon { font-size: 24px; }
.pay-method-item .pm-name { font-size: 14px; font-weight: 700; }
.pay-method-item .pm-desc { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.pay-submit { padding: 18px; }

/* ---------- 收款商户选择 ---------- */
.merchant-block { padding: 0 18px 10px; }
.merchant-select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  outline: none;
  cursor: pointer;
}
.merchant-select:focus { border-color: var(--cyan); box-shadow: 0 0 12px rgba(34, 211, 238, 0.25); }
.merchant-hint { font-size: 11px; color: var(--text-dim); margin-top: 8px; }

/* ---------- 订单页 ---------- */
.order-list { padding: 10px 18px 20px; }
.order-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.order-top { display: flex; justify-content: space-between; align-items: center; }
.order-no { font-size: 12px; color: var(--text-dim); font-family: monospace; }
.order-status { font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 999px; }
.order-status.pending { color: var(--gold); background: rgba(255, 209, 102, 0.12); border: 1px solid rgba(255, 209, 102, 0.4); }
.order-status.paid { color: var(--green); background: rgba(52, 211, 153, 0.12); border: 1px solid rgba(52, 211, 153, 0.4); }
.order-status.closed { color: var(--text-dim); background: rgba(139, 147, 184, 0.12); border: 1px solid var(--line); }
.order-status.refunded { color: var(--danger); background: rgba(255, 77, 109, 0.12); border: 1px solid rgba(255, 77, 109, 0.4); }
.order-mid { display: flex; justify-content: space-between; align-items: center; margin: 12px 0; }
.order-subject { font-size: 14px; font-weight: 700; }
.order-amount { font-size: 17px; font-weight: 900; color: var(--gold); }
.order-points { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
.order-points b { color: var(--cyan); }
.order-bottom { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--text-dim); }
.order-actions { display: flex; gap: 8px; }
.btn-sm { padding: 7px 14px; font-size: 12px; border-radius: 9px; }

/* ---------- 播放页 ---------- */
.play-frame {
  margin: 14px 14px 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #000;
  aspect-ratio: 16 / 9;
}
.play-frame iframe { width: 100%; height: 100%; border: none; }
.play-placeholder {
  aspect-ratio: 16 / 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: radial-gradient(circle at 50% 40%, rgba(124, 92, 255, 0.18), transparent 60%), var(--bg-2);
}
.play-placeholder .pp-emoji { font-size: 54px; animation: pulse 2s infinite; }
.play-meta { padding: 14px 18px; }
.play-meta h2 { font-size: 18px; }
.play-meta p { font-size: 13px; color: var(--text-dim); margin-top: 6px; line-height: 1.7; }

/* ---------- 支付弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(5, 8, 18, 0.72);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.25s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%;
  max-width: 420px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  animation: modalIn 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(24px) scale(0.96); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.modal-title { font-weight: 800; font-size: 16px; }
.modal-close {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-dim);
  font-size: 15px;
}
.modal-body { padding: 18px; }
.pay-summary { text-align: center; padding: 8px 0 16px; }
.pay-summary .ps-amt { font-size: 32px; font-weight: 900; color: var(--gold); text-shadow: 0 0 20px rgba(255, 209, 102, 0.4); }
.pay-summary .ps-sub { font-size: 13px; color: var(--text-dim); margin-top: 6px; }
.pay-summary .ps-sub b { color: var(--cyan); }
.pay-status-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 0;
  font-size: 14px;
  color: var(--text-dim);
}
.spinner {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(34, 211, 238, 0.25);
  border-top-color: var(--cyan);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.modal-btns { display: flex; gap: 10px; padding: 14px 18px 18px; }
.modal-btns .btn { flex: 1; }

/* 支付 iframe 容器（收银台） */
.cashier-frame { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; }

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed;
  top: 16px; left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.toast {
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: rgba(20, 26, 51, 0.96);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: toastIn 0.3s;
}
.toast.success { border-color: var(--green); color: var(--green); }
.toast.error { border-color: var(--danger); color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* ---------- 动画 ---------- */
.fade-up { animation: rise 0.6s both; }
.d1 { animation-delay: 0.06s; }
.d2 { animation-delay: 0.12s; }
.d3 { animation-delay: 0.18s; }

/* 减少闪烁偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
