/* 跑胡子计分系统 · 通用样式（移动端优先） */
:root {
  --bg-0: #0b1f1a;
  --bg-1: #10302a;
  --bg-2: #0a1b17;
  --card: rgba(255, 255, 255, 0.055);
  --card-strong: rgba(255, 255, 255, 0.09);
  --line: rgba(255, 255, 255, 0.1);
  --text: #eaf3ee;
  --text-2: #a9c2b6;
  --text-3: #7f9a8f;
  --gold: #e6c37c;
  --gold-2: #c9a052;
  --win: #ff7b8a;
  --lose: #46d6a4;
  --radius: 18px;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
}

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

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg-0);
  background-image:
    radial-gradient(720px 420px at 12% -8%, rgba(94, 176, 138, 0.28), transparent 62%),
    radial-gradient(760px 520px at 92% 8%, rgba(201, 160, 82, 0.16), transparent 60%),
    linear-gradient(168deg, var(--bg-1) 0%, var(--bg-0) 45%, var(--bg-2) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.55;
}

a { color: var(--gold); text-decoration: none; }

/* ---------- 布局 ---------- */
.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px 40px; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px;
  background: rgba(10, 26, 22, 0.72);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo {
  width: 38px; height: 38px; border-radius: 11px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 700; color: #143026;
  background: linear-gradient(140deg, #f2ddaa, #cda15a);
  box-shadow: 0 6px 16px rgba(201, 160, 82, 0.3);
}
.brand h1 { font-size: 17px; margin: 0; font-weight: 600; letter-spacing: .5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand .sub { font-size: 11px; color: var(--text-3); margin: 0; letter-spacing: 1px; }

.ghost-btn {
  padding: 8px 15px; border-radius: 999px; font-size: 13px;
  border: 1px solid rgba(230, 195, 124, 0.5); color: var(--gold);
  background: rgba(230, 195, 124, 0.08); white-space: nowrap;
}
.ghost-btn:active { transform: scale(.97); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h2 { font-size: 16px; margin: 0; font-weight: 600; letter-spacing: .5px; }
.card-head .meta { font-size: 12px; color: var(--text-3); }
.card-head a, .card-head .link { font-size: 12px; color: var(--gold); }

/* ---------- 冠军位 ---------- */
.hero {
  position: relative; margin-top: 18px; padding: 22px 20px 20px;
  border-radius: 22px; overflow: hidden;
  background: linear-gradient(150deg, rgba(230,195,124,.22), rgba(28,74,60,.55) 55%, rgba(12,40,33,.75));
  border: 1px solid rgba(230, 195, 124, 0.28);
  box-shadow: 0 16px 40px rgba(0,0,0,.32);
}
.hero:before {
  content: "胡"; position: absolute; right: -6px; bottom: -26px;
  font-size: 128px; font-weight: 800; color: rgba(255, 255, 255, 0.05); line-height: 1; pointer-events: none;
}
.hero-label { font-size: 12px; color: var(--gold); letter-spacing: 2px; }
.hero-name { font-size: 26px; font-weight: 700; margin: 6px 0 2px; letter-spacing: 1px; }
.hero-score { font-size: 34px; font-weight: 800; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.hero-meta { font-size: 12px; color: var(--text-2); margin-top: 6px; }

/* ---------- 切换标签 ---------- */
.tabs {
  display: flex; gap: 8px; margin-top: 16px;
  overflow-x: auto; padding-bottom: 2px; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1 0 auto; min-width: 72px; text-align: center;
  padding: 9px 14px; border-radius: 999px; font-size: 13px;
  color: var(--text-2); border: 1px solid transparent; background: rgba(255,255,255,.05);
  cursor: pointer; transition: all .18s ease; white-space: nowrap;
}
.tab.active {
  color: #1c2a21; font-weight: 600;
  background: linear-gradient(135deg, #f1d9a2, #d2a95f);
  border-color: rgba(255,255,255,.2);
  box-shadow: 0 8px 18px rgba(201, 160, 82, 0.28);
}

/* ---------- 排名列表 ---------- */
.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 6px; border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.rank-item:last-child { border-bottom: 0; }
.rank-badge {
  width: 28px; height: 28px; flex: 0 0 auto; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, 0.08); color: var(--text-2);
}
.rank-badge.r1 { background: linear-gradient(140deg, #f6dd9f, #c99f4f); color: #2a2113; box-shadow: 0 4px 12px rgba(201,160,82,.35); }
.rank-badge.r2 { background: linear-gradient(140deg, #e2e8ea, #a9b4ba); color: #24292c; }
.rank-badge.r3 { background: linear-gradient(140deg, #e6b98f, #b9805a); color: #2c1d13; }
.rank-name { flex: 1 1 auto; min-width: 0; font-size: 15px; font-weight: 500; }
.rank-name small { display: block; font-size: 11px; color: var(--text-3); font-weight: 400; margin-top: 1px; }
.rank-score { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.win { color: var(--win); }
.lose { color: var(--lose); }
.zero { color: var(--text-3); }

/* ---------- 对局卡 ---------- */
.recent-list { display: flex; flex-direction: column; gap: 12px; }
.session {
  border-radius: 14px; padding: 13px 14px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255,255,255,.07);
}
.session-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.session-date { font-size: 13px; color: var(--text-2); font-weight: 600; }
.session-note { font-size: 11px; color: var(--text-3); }
.session-players { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.pill {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 13px; padding: 7px 10px; border-radius: 9px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.05);
}
.pill .num { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 14px; }
.pill.me { border-color: rgba(230,195,124,.55); background: rgba(230,195,124,.1); }

/* ---------- 数据格子 ---------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  padding: 13px 14px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255,255,255,.07);
}
.stat .k { font-size: 11px; color: var(--text-3); letter-spacing: .5px; }
.stat .v { font-size: 22px; font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ---------- 月度柱状 ---------- */
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.bar-label { width: 34px; flex: 0 0 auto; color: var(--text-3); }
.bar-track { position: relative; flex: 1 1 auto; height: 14px; border-radius: 7px; background: rgba(255,255,255,.06); overflow: hidden; }
.bar-fill { position: absolute; top: 0; bottom: 0; left: 50%; background: var(--win); border-radius: 7px; }
.bar-fill.neg { background: var(--lose); }
.bar-value { width: 62px; flex: 0 0 auto; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 6px; letter-spacing: .5px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 11px 13px; border-radius: 11px; font-size: 15px;
  color: var(--text); background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.12); outline: none;
  font-family: inherit; appearance: none;
}
input[type=date] { min-height: 44px; }
select { background-image: none; }
input:focus, select:focus, textarea:focus { border-color: rgba(230, 195, 124, 0.7); box-shadow: 0 0 0 2px rgba(230,195,124,.14); }
input::placeholder, textarea::placeholder { color: #6d8479; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1 1 0; min-width: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 18px; border-radius: 12px; border: 0; cursor: pointer;
  font-size: 15px; font-weight: 600; font-family: inherit;
  color: #1b2a20; background: linear-gradient(135deg, #f2ddaa, #cfa559);
  box-shadow: 0 10px 22px rgba(201, 160, 82, 0.24);
  transition: transform .12s ease, opacity .12s ease;
}
.btn:active { transform: scale(.98); }
.btn.block { display: flex; width: 100%; }
.btn.ghost { background: rgba(255,255,255,.07); color: var(--text); border: 1px solid var(--line); box-shadow: none; }
.btn.danger { background: rgba(255, 90, 105, .16); color: #ffb3ba; border: 1px solid rgba(255, 90, 105, .35); box-shadow: none; }
.btn.small { padding: 7px 12px; font-size: 12px; border-radius: 9px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ---------- 列表行（后台） ---------- */
.list-row {
  display: flex; align-items: center; gap: 12px; padding: 13px 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.list-row:last-child { border-bottom: 0; }
.list-main { flex: 1 1 auto; min-width: 0; }
.list-title { font-size: 15px; font-weight: 500; }
.list-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.list-actions { display: flex; gap: 6px; flex: 0 0 auto; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px;
  background: rgba(255,255,255,.08); color: var(--text-2); margin-left: 6px; vertical-align: middle;
}
.badge.gold { background: rgba(230,195,124,.16); color: var(--gold); }
.badge.off { background: rgba(255,90,105,.15); color: #ffb3ba; }
.badge.on { background: rgba(70,214,164,.14); color: var(--lose); }

/* ---------- 空状态 / 提示 ---------- */
.empty { padding: 30px 10px; text-align: center; color: var(--text-3); font-size: 13px; }
.empty .em { font-size: 30px; display: block; margin-bottom: 8px; opacity: .6; }

/* ---------- 登录页 ---------- */
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px 20px 40px; max-width: 420px; margin: 0 auto; }
.login-brand { text-align: center; margin-bottom: 26px; }
.login-brand .logo { width: 56px; height: 56px; font-size: 26px; border-radius: 15px; margin: 0 auto 14px; }
.login-brand h1 { font-size: 20px; margin: 0; letter-spacing: 1px; }
.login-brand p { margin: 6px 0 0; font-size: 12px; color: var(--text-3); letter-spacing: 2px; }
.login-foot { text-align: center; margin-top: 18px; font-size: 12px; color: var(--text-3); }

/* ---------- 弹层 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 60; display: none;
  background: rgba(4, 12, 10, 0.66); backdrop-filter: blur(4px);
  align-items: flex-end; justify-content: center;
}
.modal-mask.show { display: flex; }
.modal {
  width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
  background: linear-gradient(170deg, #173a31, #0e2620 70%);
  border: 1px solid rgba(255,255,255,.1); border-radius: 22px 22px 0 0;
  padding: 20px 18px 26px; animation: slideUp .22s ease;
}
@keyframes slideUp { from { transform: translateY(24px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-close { background: none; border: 0; color: var(--text-3); font-size: 24px; line-height: 1; cursor: pointer; padding: 0 4px; }
.modal-foot { display: flex; gap: 10px; margin-top: 20px; }
.modal-foot .btn { flex: 1; }

/* ---------- 录入对局行 ---------- */
.score-rows { display: flex; flex-direction: column; gap: 10px; }
.score-row { display: flex; gap: 8px; align-items: center; }
.score-row select { flex: 1 1 auto; }
.score-row input { width: 92px; flex: 0 0 auto; text-align: center; }
.score-row .del { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 9px; border: 1px solid rgba(255,90,105,.3); background: rgba(255,90,105,.1); color: #ffb3ba; font-size: 16px; cursor: pointer; }
.sum-tip { margin-top: 12px; font-size: 13px; padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,.05); color: var(--text-2); }
.sum-tip.bad { background: rgba(255,90,105,.12); color: #ffb3ba; }
.sum-tip.good { background: rgba(70,214,164,.12); color: #a8f0d5; }

/* ---------- 消息条 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%) translateY(12px);
  z-index: 80; padding: 11px 20px; border-radius: 999px; font-size: 14px;
  background: rgba(24, 52, 44, .96); color: #eaf3ee; border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 12px 28px rgba(0,0,0,.4); opacity: 0; pointer-events: none; transition: all .22s ease; max-width: 88vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: rgba(84, 26, 34, .96); border-color: rgba(255, 90, 105, .35); }

.note { font-size: 12px; color: var(--text-3); line-height: 1.7; }
.center { text-align: center; }
.mt8 { margin-top: 8px; } .mt14 { margin-top: 14px; } .mt20 { margin-top: 20px; }
.hide { display: none !important; }

@media (max-width: 360px) {
  .session-players { grid-template-columns: 1fr; }
  .rank-score { font-size: 17px; }
}
