:root {
  --bg: #0e0f13;
  --card: #17191f;
  --card-border: #262932;
  --input-bg: #101218;
  --list-border: #20232b;
  --text: #e8eaf0;
  --text-dim: #8b90a0;
  --accent: #946ce6;
  --accent-2: #6a4fd0;
  --gold: #f5c451;
  --hero-from: #ffffff;
  --hero-to: #b9a3f5;
  --radius: 14px;
}

html[data-theme="light"] {
  --bg: #f4f5f9;
  --card: #ffffff;
  --card-border: #e5e7ef;
  --input-bg: #f0f1f6;
  --list-border: #eceef4;
  --text: #1c1e26;
  --text-dim: #6b7180;
  --accent: #8558e0;
  --accent-2: #6a4fd0;
  --gold: #d99a1f;
  --hero-from: #2a2438;
  --hero-to: #8558e0;
}

html[data-theme="light"] .bg-glow {
  background:
    radial-gradient(600px 320px at 20% -5%, rgba(148, 108, 230, .14), transparent 70%),
    radial-gradient(700px 380px at 85% 0%, rgba(80, 120, 255, .08), transparent 70%);
}

body, .stat-card, .pay-card, .board, .field input, .quick-amounts button {
  transition: background-color .3s ease, color .3s ease, border-color .3s ease;
}

/* 主题切换按钮 */
.theme-toggle {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 10;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
  transition: transform .15s, box-shadow .15s, background-color .3s, border-color .3s;
}

.theme-toggle:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(600px 320px at 20% -5%, rgba(148, 108, 230, .16), transparent 70%),
    radial-gradient(700px 380px at 85% 0%, rgba(80, 120, 255, .10), transparent 70%);
}

.container {
  position: relative;
  max-width: 920px;
  margin: 0 auto;
  padding: 56px 20px 64px;
}

/* ---------- Entrance animations ---------- */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes glow-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.bg-glow { animation: glow-in 1.2s ease-out both; }

.hero, .stats, .pay-card, .boards, footer {
  animation: fade-up .6s cubic-bezier(.22, .8, .32, 1) both;
}

.hero     { animation-delay: .05s; }
.stats    { animation-delay: .15s; }
.pay-card { animation-delay: .25s; }
.boards   { animation-delay: .35s; }
footer    { animation-delay: .45s; }

/* 统计卡片与榜单内部错峰出现 */
.stat-card { animation: fade-up .5s cubic-bezier(.22, .8, .32, 1) both; }
.stat-card:nth-child(1) { animation-delay: .2s; }
.stat-card:nth-child(2) { animation-delay: .28s; }
.stat-card:nth-child(3) { animation-delay: .36s; }

.board { animation: fade-up .55s cubic-bezier(.22, .8, .32, 1) both; }
.board:nth-child(1) { animation-delay: .4s; }
.board:nth-child(2) { animation-delay: .48s; }

@media (prefers-reduced-motion: reduce) {
  .hero, .stats, .pay-card, .boards, footer,
  .stat-card, .board, .bg-glow { animation: none; }
}

/* ---------- Hero ---------- */
.hero { text-align: center; margin-bottom: 40px; }

.hero-badge {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--accent);
  background: rgba(148, 108, 230, .12);
  border: 1px solid rgba(148, 108, 230, .35);
  margin-bottom: 18px;
}

.hero h1 {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 1px;
  background: linear-gradient(120deg, var(--hero-from) 30%, var(--hero-to));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub { margin-top: 12px; color: var(--text-dim); font-size: 15px; }

/* ---------- Stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 22px 24px;
  text-align: center;
}

.stat-card.accent {
  background: linear-gradient(150deg, rgba(148, 108, 230, .18), var(--card) 60%);
  border-color: rgba(148, 108, 230, .4);
}

.stat-label { font-size: 13px; color: var(--text-dim); letter-spacing: 1px; }

.stat-value {
  margin-top: 8px;
  font-size: 30px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-foot { margin-top: 6px; font-size: 12px; color: var(--text-dim); }

/* ---------- Pay form ---------- */
.pay-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
}

.pay-card h2, .board h2 { font-size: 18px; font-weight: 600; }

.pay-tip { margin: 8px 0 20px; font-size: 13px; color: var(--text-dim); }

.field { margin-bottom: 18px; }

.field label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.field input {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(148, 108, 230, .15);
}

.quick-amounts { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.quick-amounts button {
  padding: 6px 16px;
  font-size: 13px;
  color: var(--text-dim);
  background: var(--input-bg);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s;
}

.quick-amounts button:hover,
.quick-amounts button.active {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(148, 108, 230, .1);
}

.pay-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
}

.pay-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(148, 108, 230, .35); }
.pay-btn:active { transform: translateY(0); }
.pay-btn .arrow { transition: transform .15s; }
.pay-btn:hover .arrow { transform: translateX(4px); }

.pay-error { margin-top: 12px; font-size: 13px; color: #ff7b7b; text-align: center; }

/* ---------- Boards ---------- */
.boards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.board {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px;
}

.list { list-style: none; margin-top: 16px; }

.list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--list-border);
  font-size: 14px;
}

.list li:last-child { border-bottom: none; }

.rank {
  width: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.list li:nth-child(1) .rank,
.list li:nth-child(2) .rank,
.list li:nth-child(3) .rank { color: var(--gold); font-weight: 700; }

.name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.amount {
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.time { font-size: 12px; color: var(--text-dim); }

.empty { margin-top: 18px; font-size: 13px; color: var(--text-dim); text-align: center; }

/* ---------- Pager ---------- */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--list-border);
  flex-wrap: wrap;
}

.pg-btn {
  padding: 5px 12px;
  font-size: 12px;
  color: var(--text-dim);
  background: var(--input-bg);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s;
}

.pg-btn:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }
.pg-btn:disabled { opacity: .4; cursor: not-allowed; }

.pg-info { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }

.pg-size {
  padding: 4px 8px;
  font-size: 12px;
  color: var(--text-dim);
  background: var(--input-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  outline: none;
  cursor: pointer;
}

.pg-size:focus { border-color: var(--accent); }

/* ---------- Footer ---------- */
footer { margin-top: 48px; text-align: center; font-size: 13px; color: var(--text-dim); }
footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ---------- Admin ---------- */
.container.admin { max-width: 1080px; }

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-toolbar .actions { display: flex; gap: 8px; }

/* 小按钮：工具栏与表格操作 */
.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text-dim);
  background: var(--input-bg);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}

.btn-sm:hover { color: var(--accent); border-color: var(--accent); }
.btn-sm.danger:hover { color: #ff7b7b; border-color: #ff7b7b; }
.btn-sm + .btn-sm { margin-left: 4px; }

/* 主按钮：登记 */
.btn-primary-sm {
  padding: 8px 22px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  border: none;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .12s, box-shadow .12s;
}

.btn-primary-sm:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(148, 108, 230, .35); }
.btn-primary-sm:active { transform: translateY(0); }

/* 手动登记卡片 */
.admin-add {
  margin-top: 14px;
  padding: 16px 18px;
  background: var(--input-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
}

.admin-add-title { font-size: 13px; font-weight: 600; margin-bottom: 12px; }

.admin-add-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-add-row .gid-input { width: 150px; }
.admin-add-row .gid-input.amt { width: 120px; }
.admin-add-row .gid-input.wide { flex: 1; min-width: 160px; }

.admin-anon {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  white-space: nowrap;
}

.admin-anon input { accent-color: var(--accent); cursor: pointer; }

/* 输入框 */
.gid-input {
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.admin-add .gid-input { background: var(--card); }

.gid-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(148, 108, 230, .15);
}

.gid-input:disabled { opacity: .45; cursor: not-allowed; }

/* 订单表格 */
.admin-table-wrap { overflow-x: auto; margin-top: 8px; }

.admin-table {
  width: 100%;
  margin-top: 12px;
  border-collapse: collapse;
  font-size: 14px;
  white-space: nowrap;
}

.admin-table th {
  padding: 10px 8px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 1px;
  color: var(--text-dim);
  text-align: left;
  border-bottom: 1px solid var(--list-border);
}

.admin-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--list-border);
  vertical-align: middle;
}

.admin-table tbody tr { transition: background-color .12s; }
.admin-table tbody tr:hover { background: rgba(148, 108, 230, .06); }
.admin-table tr:last-child td { border-bottom: none; }

.admin-table .gid-input { width: 150px; }

.admin-msg { margin-top: 12px; font-size: 13px; text-align: center; }
.admin-msg.ok { color: #6fdc8c; }
.admin-msg.err { color: #ff7b7b; }

.trade-no { font-size: 12px; color: var(--text-dim); font-family: monospace; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .hero h1 { font-size: 26px; }
  .stats { grid-template-columns: 1fr; }
  .boards { grid-template-columns: 1fr; }
  .stat-value { font-size: 26px; }
}
