/* ============================================================
 * 帕克球记分 App 样式
 * 移动优先 · 户外强光下也可读（高对比、大字号、大触控区）
 * ============================================================ */

/* ============================================================
 * 主题 Token
 *   - 默认 = 中国红；切换主题只替换 --brand* / 中性 / rgb 分量
 *   - 成绩语义色（低于/高于标准杆、金、危险）三主题共用，保证读法一致
 *   - --green* 是旧名兼容层，新代码请用 --brand*
 * ============================================================ */
:root {
  /* ---- 品牌色阶 9 阶（随主题切换；默认 = 中国红 China Red） ---- */
  --b-950: #540e0e; --b-900: #7a1515; --b-800: #9c1d1d; --b-700: #bd2626; --b-600: #de3636;
  --b-500: #e85454; --b-300: #f4a5a5; --b-100: #fbe0e0; --b-50: #fdeeee;

  /* ---- 语义映射：新代码统一用 --brand* / --b-* ---- */
  --brand: var(--b-600);      /* 主按钮 / 选中态 / LIVE 徽章（白字） */
  --brand-d: var(--b-700);    /* 正文强调、已完赛文字 */
  --brand-l: var(--b-100);    /* 浅底标签边、已记洞边框 */
  --brand-soft: var(--b-50);  /* 选中行、tag 底 */
  --brand-300: var(--b-300);  /* 深底上的次级强调 */
  --brand-line: var(--b-100);
  --brand-rgb: 222, 54, 54;   /* = --b-600，供 rgba() 使用 */
  --hero-bg: linear-gradient(158deg, var(--b-800) 0%, var(--b-900) 46%, var(--b-950) 100%);
  --hero-shadow: 0 16px 34px -22px rgba(84, 14, 14, 0.9);
  --glow-brand: 0 6px 14px -8px rgba(222, 54, 54, 0.9);
  --glow-soft: 0 6px 16px -8px rgba(222, 54, 54, 0.55);

  /* ---- 中性（随主题微调色相） ---- */
  --ink: #1f1212;
  --ink-2: #4a2f2f;
  --muted: #866565;
  --bg: #faf7f7;
  --card: #ffffff;
  --line: #f0e5e5;
  --ink-rgb: 31, 18, 18;
  --bg-rgb: 250, 247, 247;
  --tint: #fdf5f5;
  --tint-2: #fdf8f8;
  --tint-3: #fefbfb;
  --hair: #f7eaea;
  --edge: #ddcaca;

  /* ---- 成绩与状态语义（不随主题变化） ---- */
  --under: #0f8a44;
  --under-2: #17a34a;
  --under-l: #e7f8ee;
  --under-l2: #eefaf1;
  --over: #b26b00;
  --over-l: #fff5e8;
  --gold: #c9a227;
  --gold-l: #fbf1d8;
  --gold-ink: #8a6a0b;
  --danger: #d93b3b;
  --danger-l: #fdeeee;
  --info: #2f6fd0;
  --info-l: #eef4ff;
  --ok-rgb: 15, 122, 58;
  --err-rgb: 190, 40, 44;

  /* ---- 兼容旧名 ---- */
  --green: var(--brand);
  --green-d: var(--brand-d);
  --green-l: var(--brand-l);
  --green-soft: var(--brand-soft);
  --blue: var(--info);
  --red: var(--danger);
  --red-l: var(--danger-l);

  --radius: 18px;
  --shadow: 0 1px 2px rgba(var(--ink-rgb), 0.04), 0 8px 24px -12px rgba(var(--ink-rgb), 0.16);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --tab-h: 62px;
}

/* ---------------- 主题：常青绿 Evergreen ---------------- */
:root[data-theme='green'] {
  --b-950: #04281a; --b-900: #06331e; --b-800: #0a4a2b; --b-700: #0b6b34; --b-600: #0e7c3e;
  --b-500: #12833f; --b-300: #7fd69d; --b-100: #d8f0e1; --b-50: #ebf7ef;
  --brand-rgb: 14, 124, 62;
  --hero-shadow: 0 16px 34px -22px rgba(4, 40, 26, 0.9);
  --glow-brand: 0 6px 14px -8px rgba(14, 124, 62, 0.9);
  --glow-soft: 0 6px 16px -8px rgba(14, 124, 62, 0.55);
  --ink: #0e1f17;
  --ink-2: #33463c;
  --muted: #6e8578;
  --bg: #f4f6f2;
  --line: #e6ece7;
  --ink-rgb: 14, 31, 23;
  --bg-rgb: 244, 246, 242;
  --tint: #f0f7f2;
  --tint-2: #f7faf7;
  --tint-3: #fbfdfb;
  --hair: #eef3ee;
  --edge: #c3cfc7;
}

/* ---------------- 主题：竞海蓝 Azure ---------------- */
:root[data-theme='blue'] {
  --b-950: #041e33; --b-900: #062844; --b-800: #0a3d63; --b-700: #0b4a7a; --b-600: #0f5c93;
  --b-500: #1471b0; --b-300: #9bcdf0; --b-100: #d6e9f8; --b-50: #e9f2fa;
  --brand-rgb: 15, 92, 147;
  --hero-shadow: 0 16px 34px -22px rgba(4, 30, 51, 0.9);
  --glow-brand: 0 6px 14px -8px rgba(15, 92, 147, 0.9);
  --glow-soft: 0 6px 16px -8px rgba(15, 92, 147, 0.55);
  --ink: #0e1c28;
  --ink-2: #33485c;
  --muted: #6c8296;
  --bg: #f3f6f9;
  --line: #e3eaf1;
  --ink-rgb: 14, 28, 40;
  --bg-rgb: 243, 246, 249;
  --tint: #eff5fb;
  --tint-2: #f7fafd;
  --tint-3: #fbfdff;
  --hair: #e9f1f8;
  --edge: #c2d2e0;
}

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

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei',
    'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body {
  overscroll-behavior-y: contain;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}
button {
  border: 0;
  background: none;
  cursor: pointer;
}
a {
  color: var(--brand-d);
  text-decoration: none;
}

.app {
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(var(--tab-h) + var(--safe-b) + 16px);
}
.app.no-tab {
  padding-bottom: calc(24px + var(--safe-b));
}
.app.has-fixedbar {
  padding-bottom: calc(80px + var(--safe-b));
}

/* ---------------- 顶栏 ---------------- */
.appbar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: calc(var(--safe-t) + 12px) 16px 12px;
  background: rgba(var(--bg-rgb), 0.86);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 10px;
}
.appbar.scrolled {
  border-bottom-color: var(--line);
}
.appbar .back {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(var(--ink-rgb), 0.08);
  font-size: 18px;
  color: var(--ink-2);
}
.appbar h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.2px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.appbar .act {
  display: flex;
  gap: 8px;
  align-items: center;
}
.iconbtn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #fff;
  color: var(--ink-2);
  font-size: 17px;
  box-shadow: 0 1px 2px rgba(var(--ink-rgb), 0.08);
}
.iconbtn:active {
  transform: scale(0.94);
}

.page {
  padding: 4px 16px 8px;
}
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 20px 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.section-title .link {
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
  text-transform: none;
  letter-spacing: 0;
}

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card + .card {
  margin-top: 12px;
}
.card-pad {
  padding: 16px;
}
.hairline {
  height: 1px;
  background: var(--line);
}

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  padding: 0 18px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.1px;
  background: var(--hair);
  color: var(--ink-2);
  transition:
    transform 0.12s ease,
    background 0.15s;
  white-space: nowrap;
}
.btn:active {
  transform: scale(0.97);
}
.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--glow-soft);
}
.btn-ghost {
  background: #fff;
  color: var(--ink-2);
  box-shadow: inset 0 0 0 1px var(--line);
}
.btn-danger {
  background: var(--red-l);
  color: var(--red);
}
.btn-quiet {
  background: var(--tint);
  color: var(--muted);
}
.btn-sm {
  height: 34px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 10px;
}
.btn-lg {
  height: 52px;
  font-size: 16px;
  border-radius: 16px;
}
.btn-block {
  display: flex;
  width: 100%;
}
.btn[disabled] {
  opacity: 0.45;
  pointer-events: none;
}

/* ---------------- 表单 ---------------- */
.field {
  margin-bottom: 14px;
}
.field > label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}
.input,
.select,
.textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  background: var(--tint-2);
  border: 1.5px solid var(--line);
  border-radius: 13px;
  font-size: 15px;
  outline: none;
  transition:
    border-color 0.15s,
    background 0.15s;
}
.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--brand);
  background: #fff;
}
.textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.6;
}
.select {
  appearance: none;
  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='%237b8f84' stroke-width='2' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.5;
}

/* ---------------- 赛事卡 ---------------- */
.tour-card {
  display: block;
  padding: 16px;
  position: relative;
}
.tour-card .top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.tour-card h3 {
  margin: 0;
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -0.2px;
  flex: 1;
}
.tour-card .meta {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}
.tour-card .foot {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tour-card .progress {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: var(--hair);
  overflow: hidden;
}
.tour-card .progress > i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--brand-300), var(--brand));
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.pill-live {
  background: var(--danger-l);
  color: var(--danger);
}
.pill-live::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--danger);
  animation: pulse 1.4s infinite;
}
.pill-upcoming {
  background: var(--info-l);
  color: var(--info);
}
.pill-finished {
  background: var(--hair);
  color: var(--ink-2);
}
.pill-green {
  background: var(--brand-l);
  color: var(--brand-d);
}
.pill-gold {
  background: var(--gold-l);
  color: var(--gold-ink);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.25;
  }
}

/* ---------------- 空状态 ---------------- */
.empty {
  text-align: center;
  padding: 48px 24px;
}
.empty .ico {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.8;
}
.empty h3 {
  margin: 0 0 6px;
  font-size: 16px;
}
.empty p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13.5px;
}

/* ---------------- 赛事详情头 ---------------- */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  padding: 20px;
  background: var(--hero-bg);
  color: #fff;
  box-shadow: var(--hero-shadow);
}
.hero::after {
  content: '';
  position: absolute;
  right: -40px;
  top: -50px;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: radial-gradient(
    circle at 30% 30%,
    rgba(255, 255, 255, 0.28),
    rgba(255, 255, 255, 0) 70%
  );
}
.hero .kicker {
  font-size: 11.5px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  opacity: 0.82;
  font-weight: 700;
}
.hero h2 {
  margin: 6px 0 10px;
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -0.4px;
}
.hero .metas {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 12.5px;
  opacity: 0.92;
}
.hero .stats {
  display: flex;
  gap: 22px;
  margin-top: 18px;
  position: relative;
  z-index: 1;
}
.hero .stats div {
}
.hero .stats b {
  display: block;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.hero .stats span {
  font-size: 11.5px;
  opacity: 0.78;
}

.quickgrid {
  display: grid;
  /* 发布入口下线后只剩「记分 / 名单」两项，两列均分不留空格 */
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 12px;
}
.quick {
  background: #fff;
  border-radius: 16px;
  padding: 13px 6px 11px;
  text-align: center;
  box-shadow: var(--shadow);
}
.quick .ico {
  font-size: 20px;
}
.quick span {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
  margin-top: 4px;
}
.quick:active {
  transform: scale(0.96);
}

/* ---------------- 记分：轮次条 ---------------- */
.roundbar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 16px 0;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.roundbar::-webkit-scrollbar {
  display: none;
}
.roundchip {
  flex: 0 0 auto;
  min-width: 74px;
  height: 40px;
  border-radius: 12px;
  padding: 0 10px;
  background: #fff;
  box-shadow: inset 0 0 0 1.5px var(--line);
  display: grid;
  place-items: center;
  gap: 1px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-2);
  transition: all 0.15s;
}
.roundchip small {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.roundchip.done {
  background: var(--brand-l);
  box-shadow: inset 0 0 0 1.5px var(--brand-line);
  color: var(--brand-d);
}
.roundchip.done small {
  color: var(--brand);
}
/* 本轮还没编排出发组：底色压暗 + 小字写「未分组」，表示这一轮进不去记分。
 * 放在 .on 之前，当前轮即使未分组也保留高亮，让人知道自己在哪一轮。 */
.roundchip.pending {
  background: var(--bg);
  box-shadow: inset 0 0 0 1.5px var(--line);
  color: var(--muted);
}
.roundchip.pending small {
  color: var(--muted);
}
.roundchip.on {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--glow-brand);
}
.roundchip.on small {
  color: rgba(255, 255, 255, 0.82);
}

/* ---------------- 记分：洞号条 ---------------- */
.holebar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 16px 10px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.holebar::-webkit-scrollbar {
  display: none;
}
.holechip {
  flex: 0 0 auto;
  width: 42px;
  height: 48px;
  border-radius: 13px;
  background: #fff;
  box-shadow: inset 0 0 0 1.5px var(--line);
  display: grid;
  place-items: center;
  gap: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
  position: relative;
  transition: all 0.15s;
}
.holechip small {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
}
.holechip.done {
  background: var(--brand-l);
  box-shadow: inset 0 0 0 1.5px var(--brand-line);
  color: var(--brand-d);
}
.holechip.done small {
  color: var(--brand);
}
.holechip.on {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--glow-brand);
  transform: translateY(-1px);
}
.holechip.on small {
  color: rgba(255, 255, 255, 0.82);
}

.holeinfo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 12px;
}
.holeinfo .l {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.holeinfo .l b {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -1.2px;
  line-height: 1;
}
.holeinfo .l span {
  font-size: 12.5px;
  color: var(--muted);
}
.holeinfo .r {
  display: flex;
  gap: 6px;
}
.tagpill {
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  /* 多轮时左侧洞位说明很长，标签被挤扁会把「0/4 已记」折成竖排 */
  white-space: nowrap;
  flex: 0 0 auto;
}
.tagpill.par {
  color: var(--brand-d);
  background: var(--brand-soft);
  box-shadow: none;
}

/* 出发组切换按钮（点开底部弹层，替代手机上看不清的原生下拉） */
.gpick {
  border: 0;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  min-height: 28px;
  height: 28px;
  gap: 3px;
}
.gpick .caret {
  font-style: normal;
  font-size: 9px;
  color: var(--muted);
  margin-left: 2px;
}
.gpick:active {
  transform: scale(0.97);
}

/* 组列表弹层 */
/* 组数上百时靠上滑找组不现实，搜索框吸顶常驻 */
.gsearch {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  /* 负边距抵消 .sbody 的左右留白，吸顶时才能挡住滚上来的列表 */
  margin: 0 -20px 12px;
  padding: 2px 20px 8px;
  background: var(--card);
}
/* 放大镜用内联 SVG：U+2315 之类符号在部分系统字体里缺字形，会渲染成空心方块 */
.gsearch .mag {
  position: absolute;
  left: 33px;
  display: flex;
  align-items: center;
  color: var(--muted);
  pointer-events: none;
}
.gsearch input.gq {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 36px 0 32px;
  border: 1.5px solid var(--line);
  border-radius: 13px;
  background: var(--tint-2);
  font-size: 15px;
  color: var(--ink);
  outline: none;
  transition:
    border-color 0.15s,
    background 0.15s;
}
.gsearch input.gq::-webkit-search-cancel-button {
  -webkit-appearance: none;
  display: none;
}
.gsearch input.gq:focus {
  border-color: var(--brand);
  background: #fff;
}
.gsearch .gclear {
  position: absolute;
  right: 28px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: var(--edge);
  color: var(--ink-2);
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
}
.gsearch .gclear[hidden],
.gcount[hidden],
.gempty[hidden] {
  display: none;
}
.gcount {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.gempty {
  margin: 6px 0 8px;
  padding: 20px 14px;
  text-align: center;
  font-size: 13.5px;
  color: var(--muted);
  background: var(--tint-2);
  border-radius: 14px;
  box-shadow: inset 0 0 0 1px var(--line);
}
.glist {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 6px;
}
.grow {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  padding: 10px 14px;
  text-align: left;
  border: 0;
  border-radius: 14px;
  background: var(--tint-2);
  font-family: inherit;
  cursor: pointer;
  box-shadow: inset 0 0 0 1.5px transparent;
}
.grow b {
  font-size: 15px;
  font-weight: 700;
  min-width: 42px;
  color: var(--ink-2);
}
.grow b small {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  margin-left: 2px;
}
.grow span {
  flex: 1;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}
.grow .hit {
  font-style: normal;
  flex: 0 0 auto;
  max-width: 38%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--brand-d);
}
.grow .tick {
  font-style: normal;
  font-size: 14px;
  font-weight: 800;
  color: var(--brand);
  min-width: 12px;
  text-align: right;
}
/* 搜索没命中的组直接抽掉占位的高度，列表才不用滑过一堆空白 */
.grow.hid {
  display: none;
}
.grow.on {
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1.5px var(--brand-line);
}
.grow.on b {
  color: var(--brand-d);
}
.grow:active {
  transform: scale(0.99);
}

/* ---------------- 记分：选手卡 ---------------- */
.pcard {
  background: #fff;
  border-radius: 18px;
  padding: 12px 14px 13px;
  box-shadow: var(--shadow);
  margin-bottom: 10px;
  transition:
    box-shadow 0.2s,
    transform 0.2s;
}
.pcard.active {
  box-shadow:
    0 0 0 2px var(--brand),
    var(--shadow);
}
.pcard .head {
  display: flex;
  align-items: center;
  gap: 9px;
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  background: var(--brand-l);
  color: var(--brand-d);
}
.avatar.g2 {
  background: #eaf2ff;
  color: var(--info);
}
.avatar.g3 {
  background: #fff2e8;
  color: #c2681b;
}
.avatar.g4 {
  background: #f5ecff;
  color: #7b46c9;
}
.pcard .name {
  flex: 1;
  min-width: 0;
}
.pcard .name b {
  font-size: 15px;
  font-weight: 700;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pcard .name span {
  font-size: 11.5px;
  color: var(--muted);
}
.pcard .diff {
  font-size: 12px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
}
.diff.great {
  background: var(--under-l);
  color: var(--under);
}
.diff.good {
  background: var(--under-l2);
  color: var(--under-2);
}
.diff.even {
  background: var(--hair);
  color: #54705c;
}
.diff.bad {
  background: var(--over-l);
  color: var(--over);
}
.diff.worse {
  background: var(--danger-l);
  color: var(--danger);
}

.stepper {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 11px;
}
.stepper .mv {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  flex: 0 0 52px;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 300;
  background: var(--tint);
  color: var(--ink-2);
  box-shadow: inset 0 0 0 1px var(--line);
}
.stepper .mv:active {
  background: var(--brand-l);
  color: var(--brand-d);
  transform: scale(0.94);
}
.stepper .val {
  flex: 1;
  text-align: center;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stepper .val small {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0;
  margin-top: 4px;
}
.stepper .val.zero {
  color: var(--edge);
}

.substeps {
  display: flex;
  gap: 8px;
  margin-top: 9px;
}
.substep {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--tint-2);
  border-radius: 11px;
  padding: 6px 8px;
  gap: 6px;
}
.substep label {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
}
.substep .mini {
  display: flex;
  align-items: center;
  gap: 2px;
}
.substep .mini button {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 15px;
  line-height: 1;
  color: var(--ink-2);
}
.substep .mini b {
  min-width: 18px;
  text-align: center;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* ---------------- 底部固定操作条 ---------------- */
.actionbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  padding: 10px 16px calc(10px + var(--safe-b));
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  align-items: center;
}
.actionbar .btn {
  flex: 1;
}

/* 表格里的轮次分隔：每一轮首洞左侧加一道竖线 */
.stbl th.rfirst,
.stbl td.rfirst,
.stbl th.rtot,
.stbl td.rtot {
  box-shadow: inset 2px 0 0 var(--line);
}
.stbl th.rtot,
.stbl td.rtot {
  font-weight: 800;
  color: var(--ink);
  background: var(--tint-2);
}

/* ---------------- 成绩表 ---------------- */
.tablewrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table.stbl {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-variant-numeric: tabular-nums;
}
table.stbl th,
table.stbl td {
  padding: 8px 6px;
  text-align: center;
  font-size: 12.5px;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
table.stbl thead th {
  background: var(--tint-2);
  color: var(--muted);
  font-weight: 700;
  font-size: 11.5px;
  position: sticky;
  top: 0;
  z-index: 2;
}
table.stbl td.name,
table.stbl th.name {
  text-align: left;
  padding-left: 14px;
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 1;
  font-weight: 700;
  min-width: 78px;
}
table.stbl thead th.name {
  background: var(--tint-2);
  z-index: 3;
}
table.stbl tbody tr:last-child td {
  border-bottom: 0;
}
table.stbl td.tot {
  font-weight: 800;
  background: var(--tint-3);
}
table.stbl .under {
  color: var(--under);
  font-weight: 800;
}
table.stbl .over {
  color: var(--over);
}
table.stbl .empty-cell {
  color: var(--edge);
}

/* ---------------- 底部 Tab ---------------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  height: calc(var(--tab-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  /* 用 flex 而非固定列数的 grid：Tab 数量变化时（如去掉「统计」只剩 3 个）也能平均占满整条底栏 */
  display: flex;
  align-items: stretch;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}
.tabbar[hidden] {
  display: none;
}
.tab {
  flex: 1 1 0;
  min-width: 0;
  display: grid;
  place-items: center;
  gap: 2px;
  padding-top: 8px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
}
.tab i {
  font-size: 19px;
  font-style: normal;
  line-height: 1;
  filter: grayscale(1) opacity(0.55);
}
.tab.on {
  color: var(--brand-d);
}
.tab.on i {
  filter: none;
}

/* ---------------- 弹层 ---------------- */
.sheet-host {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
}
.sheet-host.on {
  pointer-events: auto;
}
.sheet-mask {
  position: absolute;
  inset: 0;
  background: rgba(var(--ink-rgb), 0.42);
  opacity: 0;
  transition: opacity 0.22s;
  backdrop-filter: blur(2px);
}
.sheet-host.on .sheet-mask {
  opacity: 1;
}
.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  border-radius: 24px 24px 0 0;
  padding: 8px 0 calc(16px + var(--safe-b));
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 -10px 40px -20px rgba(0, 0, 0, 0.4);
}
.sheet-host.on .sheet {
  transform: translateY(0);
}
.sheet .grab {
  width: 38px;
  height: 4px;
  border-radius: 2px;
  background: var(--edge);
  margin: 6px auto 10px;
}
.sheet .stitle {
  padding: 0 20px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sheet .stitle h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}
.sheet .sbody {
  padding: 0 20px;
}
.sheet .sfoot {
  padding: 16px 20px 0;
  display: flex;
  gap: 10px;
}
.sheet .sfoot .btn {
  flex: 1;
}

.toast-host {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tab-h) + var(--safe-b) + 18px);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: rgba(var(--ink-rgb), 0.92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  animation: toastIn 0.25s ease both;
  max-width: 82vw;
  text-align: center;
}
.toast.ok {
  background: rgba(var(--ok-rgb), 0.95);
}
.toast.err {
  background: rgba(var(--err-rgb), 0.95);
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------------- 杂项 ---------------- */
.rowlist {
}
.rowitem {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}
.rowitem + .rowitem {
  border-top: 1px solid var(--line);
}
.rowitem .ico {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  font-size: 16px;
  flex: 0 0 32px;
}
.rowitem .txt {
  flex: 1;
  min-width: 0;
}
.rowitem .txt b {
  display: block;
  font-size: 14.5px;
  font-weight: 600;
}
.rowitem .txt span {
  font-size: 12px;
  color: var(--muted);
  display: block;
  margin-top: 1px;
}
.rowitem .chev {
  color: var(--edge);
  font-size: 16px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  box-shadow: inset 0 0 0 1.5px var(--line);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}
.chip.on {
  background: var(--brand);
  color: #fff;
  box-shadow: none;
}
.chip .x {
  opacity: 0.5;
  font-size: 15px;
}

.divider-note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  padding: 0 4px;
}
.mono {
  font-variant-numeric: tabular-nums;
}
.text-center {
  text-align: center;
}
.mt8 {
  margin-top: 8px;
}
.mt12 {
  margin-top: 12px;
}
.mt16 {
  margin-top: 16px;
}
.mb8 {
  margin-bottom: 8px;
}
.mb12 {
  margin-bottom: 12px;
}

/* ---------------- 主题选择（设置页） ----------------
 * 色点是「色板样品」，必须用固定色，不能跟随当前主题，
 * 否则三块看上去都是同一个颜色，失去选择意义。 */
.themepick {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.tp {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 82px;
  padding: 12px 4px 10px;
  border: 0;
  border-radius: 14px;
  background: var(--tint-2);
  box-shadow: inset 0 0 0 1.5px transparent;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.12s ease;
}
.tp b {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-2);
  line-height: 1.2;
}
.tp small {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0;
}
.tp .dots {
  display: flex;
  gap: 3px;
  margin-bottom: 2px;
}
.tp .dots i {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  display: block;
}
.tp.t-green .dots i:nth-child(1) {
  background: #06331e;
}
.tp.t-green .dots i:nth-child(2) {
  background: #0e7c3e;
}
.tp.t-green .dots i:nth-child(3) {
  background: #d8f0e1;
}
.tp.t-red .dots i:nth-child(1) {
  background: #7a1515;
}
.tp.t-red .dots i:nth-child(2) {
  background: #de3636;
}
.tp.t-red .dots i:nth-child(3) {
  background: #fbe0e0;
}
.tp.t-blue .dots i:nth-child(1) {
  background: #062844;
}
.tp.t-blue .dots i:nth-child(2) {
  background: #0f5c93;
}
.tp.t-blue .dots i:nth-child(3) {
  background: #d6e9f8;
}
.tp.on {
  background: var(--brand-l);
  box-shadow: inset 0 0 0 1.5px var(--brand-line);
}
.tp.on b {
  color: var(--brand-d);
}
.tp:active {
  transform: scale(0.97);
}
