:root {
  --bg: #0a0f0c;
  --surface: #131b17;
  --surface-2: #1b2621;
  --line: rgba(255, 255, 255, .08);
  --gold: #e6c070;
  --gold-strong: #f0cf87;
  --gold-soft: rgba(230, 192, 112, .12);
  --green: #4fd1a1;
  --green-soft: rgba(79, 209, 161, .12);
  --red: #ff7a7a;
  --red-soft: rgba(255, 122, 122, .12);
  --text: #f2f5f3;
  --text-2: #9da9a3;
  --text-3: #6a7771;
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
.hidden { display: none !important; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px max(16px, env(safe-area-inset-left)) 12px max(16px, env(safe-area-inset-right));
  background: rgba(10, 15, 12, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

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

.brand__logo {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: linear-gradient(145deg, #2c7a5c, #174b38);
  color: var(--gold);
  font-size: 17px;
  box-shadow: inset 0 0 0 1px rgba(230, 192, 112, .25);
}

.brand__name { font-size: 17px; font-weight: 650; letter-spacing: .5px; }

.topnav { display: none; gap: 4px; flex: 1; }

.topnav a {
  padding: 7px 12px;
  border-radius: 999px;
  color: var(--text-2);
  font-size: 14px;
}

.topnav a.is-on { color: var(--gold); background: var(--gold-soft); }

.userbox { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.userchip {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px 5px 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #10231b;
  background: #b8e6d2;
  flex: none;
}

.avatar--lg { width: 44px; height: 44px; font-size: 18px; border-radius: 14px; color: var(--gold-strong); background: linear-gradient(150deg, #2e6e55, #1a4435); }
.avatar--img { object-fit: cover; }

/* ---------- 主体 ---------- */
.shell { max-width: 920px; margin: 0 auto; padding: 18px 16px 96px; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--text-3); }
.caption { font-size: 12px; color: var(--text-3); line-height: 1.6; }
.gold { color: var(--gold-strong); }
.green { color: var(--green); }
.red { color: #ff9a9a; }
.center { text-align: center; }
.ellipsis { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

h1, h2, h3 { margin: 0; line-height: 1.3; }
h1 { font-size: 26px; letter-spacing: -.4px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }

.section-title { display: flex; align-items: center; justify-content: space-between; margin: 6px 2px 0; }
.section-title h2 { font-size: 16px; }
.section-title a { font-size: 12px; color: var(--text-3); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.card--tight { padding: 14px; }
.card--gold { border-color: rgba(230, 192, 112, .28); background: linear-gradient(120deg, rgba(230, 192, 112, .14), rgba(230, 192, 112, .03)), var(--surface); }
.card--green { border-color: rgba(79, 209, 161, .25); background: linear-gradient(120deg, rgba(79, 209, 161, .12), rgba(79, 209, 161, .02)), var(--surface); }

.card--felt {
  background: radial-gradient(120% 120% at 20% 0%, #246349 0%, #123a2c 55%, #0c2a20 100%);
  border: 1px solid rgba(230, 192, 112, .18);
  position: relative;
  overflow: hidden;
}
.card--felt::before { content: "♠"; position: absolute; right: -18px; top: -48px; font-size: 180px; color: rgba(255,255,255,.04); }
.card--felt > * { position: relative; z-index: 1; }

/* ---------- 排行榜 ---------- */
.hero-points { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.hero-points .n { font-size: 40px; font-weight: 750; letter-spacing: -1.5px; line-height: 1; color: var(--gold-strong); font-variant-numeric: tabular-nums; }
.hero-points .lbl { font-size: 12px; color: rgba(242, 245, 243, .65); margin-bottom: 6px; }

.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }

.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: 0; }
.list-row.is-me { background: linear-gradient(100deg, rgba(230, 192, 112, .15), rgba(230, 192, 112, .03)); }
.list-row.is-me .name { color: var(--gold-strong); }
.rank { width: 26px; text-align: center; font-size: 13px; font-weight: 700; color: var(--text-3); font-variant-numeric: tabular-nums; flex: none; }
.rank.top { color: var(--gold); }
.pts { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.name { font-size: 14px; font-weight: 500; }

/* ---------- 牌局卡 ---------- */
.event-card { display: flex; align-items: center; gap: 14px; cursor: pointer; }
.date-chip {
  width: 52px; height: 58px; border-radius: 14px; flex: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: linear-gradient(160deg, #2a3b33, #19241f);
  border: 1px solid rgba(230, 192, 112, .16);
}
.date-chip .d { font-size: 18px; font-weight: 700; color: var(--gold-strong); line-height: 1; }
.date-chip .w { font-size: 10px; color: var(--text-2); }
.event-main { flex: 1; min-width: 0; }
.event-top { display: flex; align-items: center; gap: 8px; }
.event-top .name { font-weight: 650; font-size: 15px; }
.event-meta { margin-top: 4px; font-size: 12px; color: var(--text-3); }
.event-foot { margin-top: 8px; display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--text-2); }

/* ---------- 标签 / 按钮 ---------- */
.pill { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 999px; font-size: 11px; line-height: 1; white-space: nowrap; }
.pill--gold { color: var(--gold); background: var(--gold-soft); border: 1px solid rgba(230, 192, 112, .22); }
.pill--green { color: var(--green); background: var(--green-soft); border: 1px solid rgba(79, 209, 161, .22); }
.pill--red { color: #ff9a9a; background: var(--red-soft); border: 1px solid rgba(255, 122, 122, .22); }
.pill--muted { color: var(--text-3); background: rgba(255, 255, 255, .04); border: 1px solid var(--line); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 42px; padding: 0 18px;
  border: 0; border-radius: 999px;
  font-size: 14px; font-weight: 650;
  cursor: pointer;
  background: rgba(255, 255, 255, .06);
  color: var(--text);
  border: 1px solid var(--line);
}
.btn--primary { background: linear-gradient(150deg, #f0cf87, #d8ac55); color: #22190a; border: 0; }
.btn--ghost { background: rgba(255, 255, 255, .04); color: var(--text-2); }
.btn--danger { background: var(--red-soft); color: #ff9a9a; border-color: rgba(255, 122, 122, .26); }
.btn--sm { height: 32px; padding: 0 12px; font-size: 12px; }
.btn--block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--text-3); }
.field input, .field select, .field textarea {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  outline: none;
}
.field textarea { height: 92px; padding: 11px 13px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: rgba(230, 192, 112, .5); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row--3 { grid-template-columns: 1fr 1fr 1fr; }

.notice { padding: 12px 14px; border-radius: 14px; background: var(--gold-soft); border: 1px solid rgba(230, 192, 112, .2); color: rgba(240, 207, 135, .92); font-size: 12px; line-height: 1.7; }
.notice--red { background: var(--red-soft); border-color: rgba(255, 122, 122, .22); color: #ff9a9a; }

.empty { padding: 40px 16px; text-align: center; color: var(--text-3); font-size: 13px; }
.loading { padding: 40px 16px; text-align: center; color: var(--text-3); font-size: 13px; }

/* ---------- 登录 ---------- */
.login { max-width: 420px; margin: 8vh auto 0; }
.login h1 { margin-bottom: 6px; }
.login .sub { color: var(--text-3); font-size: 13px; margin-bottom: 18px; }
.login form { display: flex; flex-direction: column; gap: 12px; }
.login .hint { margin-top: 14px; font-size: 11px; color: var(--text-3); line-height: 1.7; }

/* ---------- 弹层 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, .62);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal {
  width: 100%; max-width: 420px;
  background: #1a2520;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, .5);
}
.modal h3 { margin-bottom: 12px; }
.qr { width: 220px; height: 220px; display: block; margin: 12px auto; background: #fff; border-radius: 12px; padding: 8px; }
.code-big { font-size: 34px; font-weight: 750; letter-spacing: 8px; color: var(--gold-strong); text-align: center; font-variant-numeric: tabular-nums; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 86px; z-index: 120;
  transform: translateX(-50%) translateY(10px);
  max-width: 86vw;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(26, 37, 32, .96);
  border: 1px solid rgba(255, 255, 255, .1);
  color: var(--text);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.is-error { border-color: rgba(255, 122, 122, .35); color: #ff9a9a; }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: rgba(10, 15, 12, .96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.tabbar a { flex: 1; text-align: center; padding: 6px 0; color: var(--text-3); font-size: 11px; }
.tabbar a.is-on { color: var(--gold); }
.tabbar .ico { display: block; font-size: 17px; line-height: 1.3; }

/* ---------- 桌面 ---------- */
@media (min-width: 760px) {
  .shell { padding: 26px 24px 60px; }
  .topnav { display: flex; }
  .tabbar { display: none; }
  .grid-2 { display: grid; grid-template-columns: 1.15fr .85fr; gap: 18px; align-items: start; }
  .toast { bottom: 30px; }
}
