:root {
  --bg: #070b18;
  --bg-soft: #0d1428;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-border: rgba(255, 255, 255, 0.09);
  --text: #e8ecf7;
  --muted: #8994b0;
  --gold: #ffcf5c;
  --gold-2: #ff9d3d;
  --cyan: #4fd1ff;
  --purple: #8b7cff;
  --green: #35e0a1;
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  padding: 28px clamp(16px, 4vw, 44px) 40px;
  position: relative;
  overflow-x: hidden;
}

.bg-glow {
  position: fixed;
  inset: -30% -10% auto -10%;
  height: 70vh;
  background:
    radial-gradient(45% 55% at 15% 20%, rgba(139, 124, 255, 0.30), transparent 60%),
    radial-gradient(45% 55% at 85% 10%, rgba(79, 209, 255, 0.24), transparent 60%),
    radial-gradient(40% 50% at 50% 60%, rgba(255, 157, 61, 0.16), transparent 65%);
  filter: blur(20px);
  pointer-events: none;
  z-index: 0;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  max-width: 1240px;
  margin: 0 auto 24px;
}

.brand { display: flex; align-items: center; gap: 14px; }

.logo {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  font-size: 26px;
  border-radius: 16px;
  background: linear-gradient(140deg, rgba(255, 207, 92, 0.22), rgba(139, 124, 255, 0.20));
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.brand-text h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.5px;
  background: linear-gradient(92deg, #fff, #ffd97a 60%, #ff9d3d);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-text p { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); }

.me-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(10px);
}

.me-chip .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(53, 224, 161, 0.15);
}

.me-info { display: flex; flex-direction: column; line-height: 1.35; }
.me-info strong { font-size: 13.5px; }
.me-info span { font-size: 12px; color: var(--muted); }

/* ---------- 布局 ---------- */
.layout {
  position: relative;
  z-index: 1;
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(340px, 1fr) minmax(420px, 1.05fr);
  gap: 20px;
  align-items: start;
}

.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025));
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 22px;
  backdrop-filter: blur(14px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
}

/* 档位较多，充值面板跨整行置于顶部；排行榜与动态分列下方 */
.recharge-panel,
.flow-panel { grid-column: 1 / -1; }

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

.panel-head h2 { margin: 0; font-size: 16.5px; letter-spacing: 0.4px; }
.hint { font-size: 12px; color: var(--muted); }

.top-tag {
  font-size: 11px;
  padding: 3px 8px;
  margin-left: 6px;
  border-radius: 999px;
  background: linear-gradient(95deg, var(--gold), var(--gold-2));
  color: #241a05;
  font-weight: 700;
  vertical-align: middle;
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--panel-border);
  color: var(--text);
  font-size: 12.5px;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.ghost-btn:hover { background: rgba(255, 255, 255, 0.12); transform: translateY(-1px); }
.ghost-btn:disabled { opacity: 0.5; cursor: default; transform: none; }

/* ---------- 充值档位 ---------- */
.plans {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 12px;
}

.plan {
  position: relative;
  text-align: left;
  padding: 16px 16px 14px;
  border-radius: 14px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.plan:hover { transform: translateY(-3px); border-color: rgba(255, 255, 255, 0.22); }

.plan.active {
  border-color: rgba(255, 207, 92, 0.75);
  background: linear-gradient(160deg, rgba(255, 207, 92, 0.16), rgba(255, 157, 61, 0.07));
  box-shadow: 0 12px 30px rgba(255, 157, 61, 0.18);
}

.plan .badge {
  position: absolute;
  top: -9px; right: 10px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.6px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #2a1a02;
  background: linear-gradient(95deg, var(--gold), var(--gold-2));
}

.plan .plan-name { font-size: 13px; color: var(--muted); }
.plan .plan-price {
  font-size: 25px; font-weight: 800; margin: 4px 0 2px;
  letter-spacing: 0.3px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.plan .plan-price small { font-size: 14px; font-weight: 600; margin-right: 2px; opacity: 0.85; }
.plan .plan-coins {
  display: inline-block;
  font-size: 12.5px;
  color: var(--gold);
  background: rgba(255, 207, 92, 0.12);
  border: 1px solid rgba(255, 207, 92, 0.28);
  border-radius: 999px;
  padding: 3px 10px;
  margin-top: 6px;
}
.plan .plan-desc { display: block; margin-top: 8px; font-size: 11.5px; color: var(--muted); }

.pay-btn {
  display: block;
  width: 100%;
  max-width: 460px;
  margin: 20px auto 0;
  padding: 14px 18px;
  font-size: 15.5px;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: #241a05;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  background: linear-gradient(95deg, var(--gold), var(--gold-2));
  box-shadow: 0 14px 34px rgba(255, 157, 61, 0.28);
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.pay-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(255, 157, 61, 0.38); }
.pay-btn:active:not(:disabled) { transform: translateY(0); }
.pay-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  box-shadow: none;
  filter: grayscale(0.25);
}

/* ---------- 我的统计 ---------- */
.my-stats {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.stat {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
}

.stat-label { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }
.stat-value { font-size: 16px; font-weight: 800; }
.stat-value.gold { color: var(--gold); }
.stat-value.rank { color: var(--cyan); }

/* ---------- 排行榜 ---------- */
.board { list-style: none; margin: 0; padding: 0; }

.board-row {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: background 0.18s ease;
}
.board-row + .board-row { margin-top: 4px; }
.board-row:hover { background: rgba(255, 255, 255, 0.05); }

.board-row.me {
  border-color: rgba(79, 209, 255, 0.45);
  background: linear-gradient(95deg, rgba(79, 209, 255, 0.14), rgba(139, 124, 255, 0.08));
}

.rank-badge {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
}
.rank-1 { background: linear-gradient(140deg, #ffd76a, #f5a623); color: #3a2600; box-shadow: 0 6px 18px rgba(245, 166, 35, 0.35); }
.rank-2 { background: linear-gradient(140deg, #dfe7f5, #a8b6cf); color: #232a37; }
.rank-3 { background: linear-gradient(140deg, #f0b183, #cd7f32); color: #33200a; }

.who { min-width: 0; }
.who .nick { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.who .nick .tag-me {
  font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 6px;
  background: rgba(79, 209, 255, 0.18); color: var(--cyan); border: 1px solid rgba(79, 209, 255, 0.35);
}
.who .loc { font-size: 11.5px; color: var(--muted); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }
.who .loc .ip { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; opacity: 0.75; }

.amount-box { text-align: right; }
.amount-box .amt { font-size: 15px; font-weight: 800; color: var(--gold); }
.amount-box .sub { font-size: 11px; color: var(--muted); margin-top: 3px; }

.empty { list-style: none; padding: 28px 0; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- 最近动态 ---------- */
.flow { list-style: none; margin: 0; padding: 0; }

.flow-item {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.03);
}
.flow-item + .flow-item { margin-top: 6px; }
.flow-item .nick { font-weight: 700; }
.flow-item .loc { color: var(--muted); font-size: 12px; }
.flow-item .txt { color: var(--muted); }
.flow-item .amt { color: var(--gold); font-weight: 700; }
.flow-item .coins { color: var(--green); font-weight: 700; }
.flow-item .time { margin-left: auto; color: var(--muted); font-size: 11.5px; }

/* ---------- 页脚 / 提示 ---------- */
.footer {
  position: relative; z-index: 1;
  max-width: 1240px; margin: 26px auto 0;
  text-align: center; font-size: 12px; color: var(--muted);
  line-height: 1.7;
}
.footer code {
  background: rgba(255, 255, 255, 0.07);
  padding: 2px 6px; border-radius: 6px;
  font-size: 11.5px;
}

.toast {
  position: fixed;
  left: 50%; bottom: 42px;
  transform: translate(-50%, 24px);
  padding: 13px 22px;
  border-radius: 14px;
  background: rgba(12, 18, 36, 0.95);
  border: 1px solid rgba(255, 207, 92, 0.4);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 20;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.coin-fly {
  position: fixed;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  font-size: 42px;
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 6px 26px rgba(255, 157, 61, 0.6);
  opacity: 0;
  pointer-events: none;
  z-index: 21;
}
.coin-fly.play { animation: coinPop 1.1s ease-out; }

@keyframes coinPop {
  0% { opacity: 0; transform: translate(-50%, -40%) scale(0.6); }
  25% { opacity: 1; transform: translate(-50%, -55%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -110%) scale(0.95); }
}

@keyframes rowFlash {
  0% { background: rgba(255, 207, 92, 0.28); }
  100% { background: transparent; }
}
.flash { animation: rowFlash 1s ease-out; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .plans { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .my-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .plans { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
