/* ============ 西瓜富豪排行榜 · 暗黑金绿主题 ============ */
:root {
  --bg: #000000;
  --panel: #0b0f0e;
  --panel-2: #111614;
  --card: #0c1210;
  --border: #1e2a26;
  --text: #ffffff;
  --text-dim: #8b98a0;
  --text-mid: #c7d0d6;
  --green: #00d26a;
  --green-bright: #00ff88;
  --green-dim: #16a06a;
  --green-bg: rgba(0, 210, 106, 0.12);
  --gold: #f5c518;
  --gold-bg: rgba(245, 197, 24, 0.12);
  --red: #ff5252;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, sans-serif;
  font-size: 15px; -webkit-font-smoothing: antialiased;
}
a { color: var(--green); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
.container { max-width: 1800px; margin: 0 auto; padding: 0 14px; }

/* ============ 顶栏 ============ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(0,0,0,0.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; min-height: 56px; max-width: 1800px; margin: 0 auto; padding: 8px 14px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo { width: 28px; height: 28px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.brand .title { font-weight: 800; font-size: clamp(18px, 2vw, 24px); letter-spacing: 0.5px; }
.brand .sub { font-size: 10px; color: var(--text-dim); letter-spacing: 1px; }
.points-pill {
  display: flex; align-items: center; gap: 6px;
  background: var(--green-bg); border: 1px solid rgba(0,210,106,0.35);
  color: var(--green-bright); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; white-space: nowrap;
}
.header-right { display: flex; align-items: center; gap: 14px; }
.header-link { font-size: 15px; color: var(--text-mid); white-space: nowrap; }
.header-link:hover { color: var(--green); }
.header-btn { padding: 8px 18px; border-radius: 8px; font-size: 15px; font-weight: 600; border: none; white-space: nowrap; }
.header-btn.outline { background: transparent; color: var(--green); border: 1px solid var(--green-dim); }
.header-btn.primary { background: var(--green); color: #000; }
.user-name { font-size: 15px; color: var(--green-bright); font-weight: 700; white-space: nowrap; }
#authArea { display: flex; align-items: center; gap: 8px; }

/* ============ 类目 tabs ============ */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 14px; max-width: 1800px; margin: 0 auto; }
.tab {
  flex: 0 0 auto; padding: 8px 22px; border-radius: 999px; font-size: clamp(16px, 1.8vw, 24px);
  background: var(--panel); border: 1px solid var(--border); color: var(--text-mid); transition: all 0.15s;
}
.tab:hover { border-color: var(--gold); color: var(--text); }
.tab.active { background: var(--gold); color: #000; font-weight: 700; border-color: var(--gold); }

/* ============ 榜单卡片 ============ */
.board { padding: 8px 0 80px; }
.board-head { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 4px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.board-head .cat-name { font-size: 15px; font-weight: 700; }
.board-head .cat-count { font-size: 12px; color: var(--text-dim); }

.entry-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px; margin-bottom: 10px; cursor: pointer; transition: all 0.15s;
}
.entry-card:hover { border-color: var(--green-dim); transform: translateY(-1px); }
.entry-card:active { transform: scale(0.99); }

.rank { flex: 0 0 30px; text-align: center; font-size: 16px; font-weight: 800; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.entry-card.top1 .rank { color: var(--gold); font-size: 19px; }
.entry-card.top2 .rank { color: #d8d8d8; }
.entry-card.top3 .rank { color: #c9823a; }

.avatar {
  flex: 0 0 44px; width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: linear-gradient(135deg, #0e3b26, #1a5c3a); color: var(--green-bright);
  font-size: 20px; font-weight: 800;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.entry-main { flex: 1; min-width: 0; }
.entry-title { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.entry-name { font-size: 16px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-amount { flex: 0 0 auto; color: var(--gold); font-weight: 800; font-size: 15px; }
.entry-desc { font-size: 13px; color: var(--text-dim); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 6px; }
.entry-meta { display: flex; gap: 12px; font-size: 12px; color: var(--text-dim); flex-wrap: wrap; }
.entry-meta b { color: var(--text-mid); font-weight: 600; }
.entry-meta .v { color: var(--green-bright); }
.entry-meta .c { color: var(--gold); }

.entry-right { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.vote-btn {
  background: var(--green); color: #000; border: none; border-radius: 8px;
  padding: 7px 14px; font-size: 13px; font-weight: 700; transition: all 0.12s;
}
.vote-btn:hover { opacity: 0.85; }
.vote-btn:active { transform: scale(0.95); }
.vote-btn:disabled { background: var(--border); color: var(--text-dim); cursor: not-allowed; }

.empty { text-align: center; color: var(--text-dim); padding: 60px 0; font-size: 14px; }

/* ============ 分页 ============ */
.pagination { display: flex; align-items: center; justify-content: center; gap: 18px; padding: 22px 0 6px; }
.page-btn { padding: 9px 22px; border-radius: 8px; font-size: 15px; font-weight: 600; background: var(--panel); border: 1px solid var(--border); color: var(--text-mid); transition: all 0.12s; }
.page-btn:hover:not(:disabled) { border-color: var(--green-dim); color: var(--text); }
.page-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.page-info { font-size: 15px; color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* ============ 视图切换 + 时间切换 ============ */
.board-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; max-width: 1800px; margin: 0 auto; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--border); border-radius: 999px; padding: 3px; gap: 2px; }
.seg-btn { padding: 8px 22px; border-radius: 999px; font-size: clamp(16px, 1.8vw, 24px); font-weight: 600; background: transparent; border: none; color: var(--text-mid); transition: all 0.15s; }
.seg-btn.active { background: var(--green); color: #000; }
.seg-btn.gold.active { background: var(--gold); color: #000; }

/* 卡片上的分类小标签 */
.entry-cat { flex: 0 0 auto; font-size: 10px; color: var(--gold); background: var(--gold-bg); border: 1px solid rgba(245,197,24,0.35); padding: 1px 6px; border-radius: 4px; }

/* ============ 分类汇总页 ============ */
.cat-summary { padding: 0 14px 60px; max-width: 1800px; margin: 0 auto; }
.cat-group { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.cat-group-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cat-group-name { font-size: 15px; font-weight: 800; }
.cat-group-more { font-size: 11px; color: var(--text-dim); }
.cat-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid rgba(30,42,38,0.5); cursor: pointer; }
.cat-item .rank { flex: 0 0 24px; font-size: 14px; font-weight: 800; color: var(--text-dim); text-align: center; }
.cat-item.top1 .rank { color: var(--gold); }
.cat-item.top2 .rank { color: #d8d8d8; }
.cat-item.top3 .rank { color: #c9823a; }
.cat-item .name { flex: 1; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-item .amount { font-size: 13px; font-weight: 800; color: var(--gold); }
.back-header { display: flex; align-items: center; gap: 10px; height: 52px; max-width: 1800px; margin: 0 auto; padding: 0 14px; }
.back-header a { color: var(--text-mid); font-size: 14px; }
.back-header .t { font-size: 16px; font-weight: 800; }

/* ============ 底部操作栏 ============ */
.footer-actions { position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: rgba(0,0,0,0.94); backdrop-filter: blur(8px); border-top: 1px solid var(--border); }
.footer-inner { max-width: 1800px; margin: 0 auto; display: flex; gap: 10px; padding: 10px 14px; }
.btn { flex: 1; padding: 12px; border-radius: 10px; font-size: 14px; font-weight: 700; border: none; transition: all 0.15s; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--green); color: #000; }
.btn-primary:hover { opacity: 0.9; }
.btn-gold { background: var(--gold); color: #000; }
.btn-gold:hover { opacity: 0.9; }
.btn-outline { background: transparent; color: var(--green); border: 1px solid var(--green-dim); }
.btn-outline:hover { background: var(--green-bg); }

/* ============ 弹窗 ============ */
.modal-mask { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.72); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn 0.15s; }
.modal { background: var(--panel-2); border: 1px solid var(--border); border-radius: 16px; width: 100%; max-width: 440px; max-height: 88vh; overflow-y: auto; padding: 22px; animation: slideUp 0.2s; }
.modal h3 { font-size: 17px; margin-bottom: 4px; }
.modal .modal-sub { font-size: 12px; color: var(--text-dim); margin-bottom: 16px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 12px; border-radius: 8px; background: var(--panel);
  border: 1px solid var(--border); color: var(--text); font-size: 14px; outline: none;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--green-dim); }
.modal-close { float: right; background: none; border: none; color: var(--text-dim); font-size: 24px; line-height: 1; }

/* ============ 详情弹窗 ============ */
.detail-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.detail-avatar { flex: 0 0 56px; width: 56px; height: 56px; border-radius: 12px; display: flex; align-items: center; justify-content: center; overflow: hidden; background: linear-gradient(135deg, #0e3b26, #1a5c3a); color: var(--green-bright); font-size: 26px; font-weight: 800; }
.detail-avatar img { width: 100%; height: 100%; object-fit: cover; }
.detail-name { font-size: 18px; font-weight: 800; }
.detail-cat { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.detail-amount { font-size: 22px; font-weight: 800; color: var(--gold); margin: 12px 0; }
.detail-desc { font-size: 13px; color: var(--text-mid); line-height: 1.6; margin-bottom: 14px; }
.detail-stats { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.stat-chip { flex: 1; min-width: 80px; text-align: center; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 10px 6px; }
.stat-chip .n { font-size: 16px; font-weight: 800; color: var(--green-bright); }
.stat-chip .l { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.url-row { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; }
.url-box { flex: 1; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 12px; color: var(--text-mid); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-sm { padding: 9px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; border: none; }
.btn-sm.primary { background: var(--green); color: #000; }
.btn-sm.gold { background: var(--gold); color: #000; }
.btn-sm.outline { background: transparent; color: var(--green); border: 1px solid var(--green-dim); }

/* ============ 充值档位 ============ */
.plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.plan-card { padding: 16px 12px; text-align: center; border-radius: 12px; background: var(--panel); border: 1px solid var(--border); cursor: pointer; transition: all 0.15s; }
.plan-card:hover { border-color: var(--green-dim); }
.plan-card.selected { border-color: var(--green); background: var(--green-bg); }
.plan-card .amount { font-size: 22px; font-weight: 800; color: var(--green-bright); }
.plan-card .pts { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

/* ============ Toast ============ */
.toast { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); background: var(--panel-2); border: 1px solid var(--border); color: var(--text); padding: 10px 18px; border-radius: 10px; font-size: 13px; z-index: 200; box-shadow: 0 6px 24px rgba(0,0,0,0.5); animation: slideUp 0.2s; max-width: 90vw; }
.toast.error { border-color: var(--red); color: #ff8a8a; }
.toast.success { border-color: var(--green-dim); }

.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--green); border-radius: 50%; margin: 40px auto; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.admin-entry { position: fixed; bottom: 76px; right: 12px; z-index: 60; font-size: 11px; color: var(--text-dim); background: var(--panel); border: 1px solid var(--border); padding: 5px 10px; border-radius: 6px; opacity: 0.6; }
.admin-entry:hover { opacity: 1; color: var(--green); }

/* ============ 管理后台 ============ */
.admin-wrap { display: flex; min-height: 100vh; }
.admin-side { width: 210px; flex: 0 0 210px; background: var(--panel); border-right: 1px solid var(--border); padding: 20px 12px; display: flex; flex-direction: column; gap: 6px; }
.admin-side .logo-row { margin-bottom: 18px; padding: 0 8px; }
.admin-side .logo-row .title { font-weight: 800; font-size: 15px; }
.admin-side .logo-row .sub { font-size: 11px; color: var(--text-dim); }
.side-item { padding: 10px 12px; border-radius: 8px; cursor: pointer; font-size: 14px; color: var(--text-mid); transition: all 0.12s; text-align: left; background: none; border: none; }
.side-item:hover { background: var(--panel-2); color: var(--text); }
.side-item.active { background: var(--green); color: #000; font-weight: 700; }
.admin-main { flex: 1; padding: 24px 28px; min-width: 0; }
.panel { display: none; }
.panel.active { display: block; }
.panel h2 { font-size: 20px; margin-bottom: 4px; }
.panel .desc { font-size: 13px; color: var(--text-dim); margin-bottom: 20px; }
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select, .toolbar textarea { padding: 9px 12px; border-radius: 8px; background: var(--panel); border: 1px solid var(--border); color: var(--text); font-size: 13px; outline: none; }
.btn-sm { padding: 9px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; border: none; }
.btn-sm.primary { background: var(--green); color: #000; }
.btn-sm.gold { background: var(--gold); color: #000; }
.btn-sm.outline { background: transparent; color: var(--green); border: 1px solid var(--green-dim); }
.btn-sm.danger { background: transparent; color: var(--red); border: 1px solid var(--red); }
.btn-sm:active { transform: scale(0.97); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--text-dim); font-weight: 600; font-size: 12px; }
tr:hover td { background: rgba(0, 210, 106, 0.03); }
.badge { padding: 2px 8px; border-radius: 999px; font-size: 11px; }
.badge.green { background: var(--green-bg); color: var(--green-bright); }
.badge.gray { background: var(--panel); color: var(--text-dim); }
.badge.yellow { background: var(--gold-bg); color: var(--gold); }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.stat-card .v { font-size: 26px; font-weight: 800; color: var(--green-bright); }
.stat-card .k { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

.ana-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ana-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.ana-card h4 { font-size: 13px; color: var(--text-mid); margin-bottom: 12px; }
.ana-card.full { grid-column: 1 / -1; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 12px; }
.bar-label { flex: 0 0 90px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.bar-track { flex: 1; height: 10px; background: #161b1a; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--green-dim), var(--green-bright)); }
.bar-num { flex: 0 0 40px; color: var(--text-mid); font-variant-numeric: tabular-nums; }
.ana-trend { width: 100%; height: 180px; }

.login-box { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 340px; background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 30px; }
.login-card h2 { margin-bottom: 20px; }

/* 宽屏：单列宽卡片（每条记录 1800×200，大字体） */
@media (min-width: 768px) {
  .entry-card { height: 200px; padding: 20px 28px; gap: 22px; border-radius: 16px; }
  .rank { flex: 0 0 72px; font-size: 38px; }
  .entry-card.top1 .rank { font-size: 44px; }
  .entry-card.top2 .rank { font-size: 40px; }
  .entry-card.top3 .rank { font-size: 38px; }
  .avatar { flex: 0 0 112px; width: 112px; height: 112px; font-size: 44px; border-radius: 18px; }
  .entry-title { margin-bottom: 8px; }
  .entry-name { font-size: 24px; }
  .entry-amount { font-size: 28px; }
  .entry-desc { font-size: 15px; margin-bottom: 10px; }
  .entry-meta { font-size: 14px; gap: 20px; }
  .entry-cat { font-size: 12px; padding: 2px 8px; }
  .vote-btn { font-size: 17px; padding: 14px 30px; border-radius: 10px; }
  .cat-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: start; }
  .cat-group { margin-bottom: 0; }
  .cat-group-name { font-size: 20px; }
  .cat-item .name { font-size: 15px; }
  .cat-item .amount { font-size: 15px; }
}
@media (max-width: 720px) {
  .admin-wrap { flex-direction: column; }
  .admin-side { width: 100%; flex-direction: row; overflow-x: auto; padding: 10px; }
  .admin-side .logo-row { display: none; }
  .side-item { white-space: nowrap; }
  .admin-main { padding: 16px; }
  .ana-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .entry-card { padding: 12px; gap: 10px; }
  .avatar { flex: 0 0 40px; width: 40px; height: 40px; font-size: 18px; }
  .brand .sub { display: none; }
  .tab { padding: 6px 14px; }
  .seg-btn { padding: 6px 14px; }
  .header-right { gap: 8px; }
  .header-link { font-size: 12px; }
  .header-btn { padding: 6px 12px; font-size: 13px; }
  .points-pill { padding: 5px 10px; font-size: 12px; }
  .board-toolbar { flex-wrap: wrap; }
}
