:root {
  --navy: #102b55;
  --navy-soft: #28528b;
  --blue: #2768d8;
  --bg: #f3f6fb;
  --line: #e6ecf4;
  --text: #17263c;
  --muted: #6b7a90;
  --gold: #b8860b;
  --danger: #b23b3b;
  --radius: 16px;
}

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

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.app { max-width: 760px; margin: 0 auto; padding-bottom: 92px; }

/* ------------------------------- 顶部 ------------------------------- */
.hero {
  background: linear-gradient(140deg, var(--navy) 0%, var(--navy-soft) 100%);
  color: #fff;
  padding: 26px 20px 22px;
  border-radius: 0 0 22px 22px;
}
.hero h1 { margin: 0; font-size: 21px; line-height: 1.45; font-weight: 700; letter-spacing: .5px; }
.hero .sub { margin-top: 8px; color: #c6d7ef; font-size: 13px; }
.hero .pills { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.hero .pill {
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.18);
  padding: 5px 11px;
  border-radius: 99px;
  font-size: 12px;
}

/* ------------------------------- 布局 ------------------------------- */
.wrap { padding: 16px 14px 0; }
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 2px 10px rgba(24,52,85,.04);
}
.section { display: flex; align-items: baseline; justify-content: space-between; margin: 20px 4px 10px; }
.section h2 { margin: 0; font-size: 16px; font-weight: 700; }
.section span { color: var(--muted); font-size: 12px; }
.muted { color: var(--muted); font-size: 12.5px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stack > * + * { margin-top: 10px; }

/* ------------------------------- 组件 ------------------------------- */
.btn {
  appearance: none; border: 0; cursor: pointer;
  background: var(--blue); color: #fff;
  border-radius: 11px; padding: 11px 16px;
  font-size: 15px; font-weight: 600;
  font-family: inherit;
  white-space: nowrap;
  flex: none;
  transition: filter .15s, opacity .15s;
}
.btn:active { filter: brightness(.94); }
.btn[disabled] { opacity: .55; cursor: default; }
.btn.block { display: block; width: 100%; }
.btn.ghost { background: #eaf1fb; color: #27548b; }
.btn.danger { background: #fdecea; color: var(--danger); }
.btn.mini { padding: 6px 12px; font-size: 13px; font-weight: 600; border-radius: 9px; }

input, select {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  background: #fff;
  border: 1px solid #dde5ef;
  border-radius: 11px;
  padding: 11px 12px;
  outline: none;
  appearance: none;
}
input[type="checkbox"], input[type="radio"] {
  width: auto;
  appearance: auto;
  border: 0;
  padding: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  flex: none;
}
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(39,104,216,.12); }
select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' stroke='%236b7a90' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 34px;
}
label.field { display: block; margin-bottom: 11px; }
label.field > span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 5px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; padding-bottom: 0; }
.chip {
  flex: none; border: 1px solid #dde5ef; background: #fff; color: #52647d;
  padding: 7px 14px; border-radius: 99px; font-size: 13px; cursor: pointer; font-family: inherit;
}
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }

/* ------------------------------- 表格 ------------------------------- */
.table { width: 100%; }
.thead, .trow {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1.45fr) minmax(0, .95fr) 34px 40px;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #eef2f8;
  font-size: 13px;
}
.thead > div, .trow > div { min-width: 0; }
.thead { color: var(--muted); font-size: 11.5px; padding-top: 0; }
.thead > div:nth-last-child(-n+2) { text-align: center; }
.thead > div:last-child { text-align: right; }
.trow:last-child { border-bottom: 0; }
.trow .ev { font-weight: 600; }
.trow .ev small, .trow .who small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; line-height: 1.4; }
.trow .who { font-weight: 600; }
.trow .res { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.trow .pt { text-align: right; color: var(--blue); font-weight: 700; font-variant-numeric: tabular-nums; }
.trow .rk { text-align: center; }
.trow .rk i {
  display: inline-block; min-width: 20px; height: 20px; line-height: 20px;
  border-radius: 6px; font-style: normal; font-size: 11.5px; font-weight: 700;
  background: #eef2f8; color: #5c6b80;
}
.trow .rk i.g1 { background: #fff3cc; color: #8a6400; }
.trow .rk i.g2 { background: #eef1f5; color: #5c6b80; }
.trow .rk i.g3 { background: #fbe9df; color: #95522a; }
.trow .rec { color: var(--gold); font-size: 11px; font-weight: 600; }
.trow .who { font-weight: 600; }
.trow .cls { color: #4a5a70; }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); line-height: 1.9; font-size: 13px; }
.empty b { display: block; color: #3c4d65; font-size: 15px; margin-bottom: 4px; }

.rank-row {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) 60px 58px;
  gap: 8px; align-items: center; padding: 11px 0; border-bottom: 1px solid #eef2f8; font-size: 14px;
}
.rank-row > div { min-width: 0; overflow-wrap: anywhere; }
.rank-row:last-child { border-bottom: 0; }
.rank-row .no { font-weight: 800; color: var(--muted); font-size: 15px; text-align: center; }
.rank-row.top1 .no, .rank-row.top2 .no, .rank-row.top3 .no { color: #fff; border-radius: 8px; }
.rank-row.top1 .no { background: #d4a017; }
.rank-row.top2 .no { background: #9aa7b6; }
.rank-row.top3 .no { background: #c07a4a; }
.rank-row .pt { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.rank-row .fs { text-align: right; color: var(--muted); font-size: 12.5px; }

/* 批量选择 */
.pick-row {
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  cursor: pointer;
  border-radius: 10px;
  margin: 0 -6px;
  padding-left: 6px;
  padding-right: 6px;
  transition: background .12s;
}
.pick-row input { pointer-events: none; width: 18px; height: 18px; accent-color: var(--blue); }
.pick-row.on { background: #eef4ff; }
.pick-row.on b { color: #1f4f9c; }
.btn.mini.on { background: #dbe8fb; color: #1f4f9c; }

/* ------------------------------- 提示 ------------------------------- */
.notice {
  background: #fff8e6; border: 1px solid #f6e3b8; color: #8a6400;
  border-radius: 12px; padding: 10px 12px; font-size: 12.5px; line-height: 1.6;
}
.error {
  background: #fff0ee; border: 1px solid #f6d3ce; color: var(--danger);
  border-radius: 11px; padding: 10px 12px; font-size: 13px; margin-top: 10px; word-break: break-all;
}
.toast {
  position: fixed; left: 50%; bottom: 108px; transform: translate(-50%, 14px);
  background: rgba(23,38,60,.94); color: #fff; padding: 10px 18px; border-radius: 99px;
  font-size: 13.5px; opacity: 0; pointer-events: none; transition: opacity .22s, transform .22s; z-index: 90;
  max-width: 88vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------- 纪录表 ------------------------------- */
.rec-row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid #eef2f8;
  font-size: 13px;
}
.rec-row:last-child { border-bottom: 0; }
.rec-row .ev { font-weight: 600; }
.rec-row .ev small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; line-height: 1.4; }
.rec-row .rec-val { font-weight: 700; font-variant-numeric: tabular-nums; }
.rec-row .rec-val small { font-weight: 400; color: var(--muted); margin-left: 3px; font-size: 11px; }
.rec-tag { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: #eef2f8; color: #5c6b80; white-space: nowrap; }
.rec-tag.school { background: #fff3cc; color: #8a6400; }

/* ------------------------------- 底部导航 ------------------------------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
  background: rgba(255,255,255,.97);
  border-top: 1px solid var(--line);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  display: flex; justify-content: space-around;
  backdrop-filter: blur(8px);
}
.nav button {
  appearance: none; border: 0; background: none; font-family: inherit;
  flex: 1; padding: 6px 0; color: #8b97a8; font-size: 11px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.nav button .ic { font-size: 19px; line-height: 1; }
.nav button.on { color: var(--blue); font-weight: 700; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 99px;
  background: #edf4ff; color: #3261a1; font-size: 11px; font-weight: 600;
}
.badge.track { background: #eaf3ff; color: #2b62b5; }
.badge.field { background: #eaf7ee; color: #2f7a4a; }
.footnote { text-align: center; color: #9aa7b6; font-size: 11.5px; padding: 22px 16px 8px; line-height: 1.8; }

/* ------------------------------- 二维码卡片 ------------------------------- */
.qr-card { display: flex; gap: 14px; align-items: center; }
.qr-card .qr { width: 140px; height: 140px; flex: none; border-radius: 10px; background: #fff; cursor: zoom-in; }
.qr-card .qr-body { min-width: 0; }
.qr-url {
  font-size: 12.5px; color: #27548b; background: #f1f5fb; border-radius: 8px;
  padding: 6px 8px; margin: 7px 0 8px; word-break: break-all; line-height: 1.45;
}
.qr-card .toolbar { margin-top: 2px; }

/* 二维码大图 */
.qr-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(6, 18, 34, .9);
  display: grid; place-items: center;
  padding: 24px;
}
.qr-overlay[hidden] { display: none; }
.qr-sheet {
  background: #fff; border-radius: 20px; padding: 22px 22px 18px;
  text-align: center; max-width: 92vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.qr-sheet-title { font-weight: 700; font-size: 17px; color: var(--navy); margin-bottom: 14px; }
.qr-sheet img { display: block; width: min(74vw, 360px); height: auto; margin: 0 auto; background: #fff; }
.qr-sheet-url { margin: 14px 0 16px; font-size: 12.5px; color: #27548b; word-break: break-all; line-height: 1.5; }

@media (min-width: 720px) {
  .hero { border-radius: 0 0 22px 22px; padding: 32px 28px 26px; }
  .hero h1 { font-size: 25px; }
  .wrap { padding: 18px 20px 0; }
  body { font-size: 15.5px; }
}
