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

:root {
  --bg: #e8ddc0;
  --paper: #fbf6e9;
  --ink: #1a1a1a;
  --green: #15512f;
  --tan: #ddd0a3;
  --muted: #8a8472;
  --warn: #c8651c;
  --danger: #c0392b;
  --gold: #e3b33d;
}

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

/* 顶栏 */
.topbar {
  background: var(--green);
  color: #fff;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  padding: env(safe-area-inset-top) 0 0;
  height: calc(48px + env(safe-area-inset-top));
  line-height: 48px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.admin-btn {
  position: absolute;
  right: 14px;
  top: env(safe-area-inset-top);
  font-size: 13px;
  font-weight: 700;
  background: rgba(255, 255, 255, .16);
  padding: 6px 12px;
  border-radius: 16px;
  line-height: 1;
  cursor: pointer;
}

.app {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px 88px;
}

.board-title {
  font-size: 40px;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-align: center;
  margin: 8px 0 18px;
}

.tip, .empty {
  text-align: center;
  color: var(--muted);
  padding: 48px 0;
  font-size: 15px;
}

/* 通用卡片/表格 */
.card {
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 10px;
  overflow: hidden;
}

/* 输入行 */
.add-bar { display: flex; gap: 10px; margin-bottom: 16px; }
input, select {
  font-family: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 9px;
  padding: 11px 13px;
  width: 100%;
}
input:focus, select:focus { outline: none; border-color: var(--green); }

.btn {
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  border: 2px solid var(--ink);
  border-radius: 9px;
  padding: 11px 22px;
  background: var(--green);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}
.btn-block { width: 100%; padding: 15px; font-size: 17px; border-radius: 26px; letter-spacing: 2px; }
.btn-ghost { background: var(--paper); color: var(--ink); }

/* 队员表 */
.thead {
  display: flex; align-items: center;
  background: var(--tan);
  border-bottom: 2px solid var(--ink);
  padding: 11px 14px;
  font-weight: 800; font-size: 13px; letter-spacing: 1px;
}
.trow {
  display: flex; align-items: center;
  padding: 15px 14px;
  border-bottom: 1px solid var(--ink);
}
.trow:last-child { border-bottom: none; }
.col-no { width: 40px; color: var(--muted); font-weight: 800; }
.col-name { flex: 1; font-size: 17px; font-weight: 700; }
.col-op { width: 44px; text-align: right; }
.dots {
  font-size: 24px; font-weight: 800; color: var(--muted);
  cursor: pointer; padding: 4px 0 4px 16px; line-height: 1;
}

/* 录入表单 */
.form { background: var(--paper); border: 2px solid var(--ink); border-radius: 12px; padding: 4px 16px 20px; }
.field { display: flex; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--ink); }
.field:last-of-type { border-bottom: none; }
.field label { width: 84px; font-weight: 700; font-size: 15px; flex-shrink: 0; }
.field .control { flex: 1; }
.field input, .field select { border: none; padding: 0; background: transparent; border-radius: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 0 2px; }
.chip {
  font-size: 13px; font-weight: 600; color: var(--green);
  background: #f0e8d0; border: 1.5px solid var(--ink);
  border-radius: 16px; padding: 5px 13px; cursor: pointer;
}

/* 记录列表 */
.rec { display: flex; align-items: center; padding: 14px; border-bottom: 1px solid var(--ink); }
.rec:last-child { border-bottom: none; }
.rec-main { flex: 1; min-width: 0; }
.rec-name { font-size: 17px; font-weight: 800; }
.rec-meta { font-size: 13px; color: var(--muted); margin-top: 3px; }
.rec-score { font-size: 26px; font-weight: 900; color: var(--green); margin: 0 6px; }

.filter-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.filter-bar label { font-weight: 700; font-size: 14px; }
.filter-bar select { width: auto; flex: 1; }

/* 统计榜单 */
.lead-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 14px; padding: 0 4px; }
.lead-sub { font-size: 16px; font-weight: 800; }
.lead-date { font-size: 13px; color: var(--muted); }
.refresh { color: var(--green); font-weight: 700; font-size: 15px; cursor: pointer; }
.lcard { background: var(--paper); border: 2px solid var(--ink); border-radius: 12px; padding: 15px 14px; margin-bottom: 12px; cursor: pointer; }
.lcard-top { display: flex; align-items: center; }
.rank {
  width: 30px; height: 30px; line-height: 27px; text-align: center;
  background: var(--tan); border: 2px solid var(--ink); border-radius: 50%;
  font-size: 14px; font-weight: 800; margin-right: 12px;
}
.rank.lead { background: var(--gold); }
.lname { flex: 1; font-size: 18px; font-weight: 800; }
.lavg { font-size: 26px; font-weight: 900; color: var(--green); line-height: 1; text-align: right; }
.lavg small { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.warn { margin-top: 10px; font-size: 13px; color: var(--warn); font-weight: 700; }
.detail { margin-top: 12px; border-top: 2px solid var(--ink); padding-top: 6px; }
.drow { display: flex; justify-content: space-between; padding: 7px 4px; font-size: 14px; }
.drow.dhead { color: var(--muted); font-size: 12px; font-weight: 700; }
.drow .ds { font-weight: 800; }
.lhint { text-align: center; margin-top: 10px; font-size: 12px; color: var(--muted); font-weight: 600; }

/* 底部标签栏 */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; background: #ede2c6;
  border-top: 2px solid var(--ink);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 20;
}
.tab {
  flex: 1; text-align: center; padding: 12px 0 12px;
  font-size: 13px; font-weight: 700; color: var(--muted);
  cursor: pointer;
}
.tab.active { color: var(--green); }
.tab .ico { display: block; font-size: 20px; margin-bottom: 2px; }

/* 弹层 */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 24px;
}
.modal {
  background: var(--paper); border: 2px solid var(--ink); border-radius: 14px;
  padding: 20px; width: 100%; max-width: 340px;
}
.modal h3 { margin: 0 0 14px; font-size: 18px; }
.modal .row { display: flex; gap: 10px; margin-top: 18px; }
.modal .row .btn { flex: 1; text-align: center; }

/* 底部动作面板 */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--paper); border-top: 2px solid var(--ink);
  border-radius: 16px 16px 0 0; padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  animation: rise .15s ease;
}
@keyframes rise { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet .act { padding: 16px; text-align: center; font-size: 17px; font-weight: 700; border-bottom: 1px solid #e0d6bb; cursor: pointer; }
.sheet .act:last-child { border-bottom: none; color: var(--muted); }
.sheet .act.danger { color: var(--danger); }

.hidden { display: none !important; }
.toast {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%,-50%);
  background: rgba(0,0,0,.8); color: #fff; padding: 12px 20px;
  border-radius: 10px; font-size: 15px; z-index: 100;
}
