/* ===== YBA 基础样式：移动端优先，iPad / 手机适配 ===== */
:root {
  --bg: #0f1216;
  --bg-2: #161b22;
  --bg-3: #1e252e;
  --line: #2a323d;
  --text: #e8edf3;
  --text-dim: #94a3b3;
  --accent: #f97316;
  --accent-2: #fb923c;
  --ok: #2fbf71;
  --bad: #ef4444;
  --radius: 14px;
  --tap: 46px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  /* 顶栏实际高度（含安全区内边距）。下面吸顶的分页条和提示条靠它算偏移。
     这里的 57px 只是首屏兜底：10+10 内边距 + 最高的 btn-sm 36px + 1px 边框，
     页面加载后由 JS 量出真值覆盖，刘海屏和字号变化都不用改这里 */
  --topbar-h: 57px;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* 告诉浏览器整站是深色的，原生控件（下拉箭头、展开的选项列表、滚动条）
     跟着画深色。不写的话有些手机会给下拉配白底，浅色文字就看不见了 */
  color-scheme: dark;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  min-height: 100vh;
  min-height: 100dvh;
}

/* 禁掉长按选中和双击缩放延迟，触屏记录数据更顺 */
button, .tap {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.25; }
h1 { font-size: 20px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0; }
a { color: var(--accent-2); text-decoration: none; }
img { display: block; max-width: 100%; }
/* ===== 布局骨架 ===== */
/* 吸顶的是外壳 #top，不是 .topbar 本身，这一点前后错过两次：
   - sticky 加在 .topbar 上：它的父元素 #top 只有顶栏这一行高，sticky 的活动范围
     就等于零，页面一滚 #top 出屏顶栏跟着走，下面按 --topbar-h 留偏移的分页条
     就空出一段，行内容从那儿穿出来。
   - fixed 加在 .topbar 上：不穿模了，但顶栏脱离文档流，占位高度只能靠 JS 量的
     --topbar-h，量少了就压住正文。
   加在外壳上两个毛病都没有：它的父元素是 body，跨整个文档，sticky 一直有效；
   同时它还在流里，高度由浏览器按内容自己算，不存在量错的可能。

   有分页条的页面（数据榜、管理员）把顶栏和分页条一起包进 .stickytop 整块吸顶，
   分页条就不用再按 --topbar-h 对位，量偏了也不会在两者之间留缝。
   没分页条的页面直接吸 #top。 */
.stickytop,
body > #top {
  position: sticky;
  top: 0;
  z-index: 30;
  /* 不透明，滚上来的内容才挡得住 */
  background: var(--bg);
}

/* 背景不透明：半透明加 backdrop-filter 在部分手机上模糊不生效，
   底下的数字会隐约透上来，而这条要求就是「最上面那行挡住下面」。 */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + var(--safe-t)) calc(14px + var(--safe-r)) 10px
    calc(14px + var(--safe-l));
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.topbar .logo {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0.5px;
  color: var(--accent);
  flex-shrink: 0;
}

/* 测试版角标，跟在联盟名后面小一号 */
.topbar .logo .beta {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text-dim);
}

/* 赛季下拉：跟在联盟名后面，切换后整页重载 */
.seasonsel {
  flex-shrink: 0;
  width: auto;
  min-height: 34px;
  /* 箭头是系统画的，右边不用再留手动位置 */
  padding: 0 8px 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  background-color: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.topbar .spacer { flex: 1; }

/* 顶栏里的按钮和包着按钮的链接一律不许压缩。
   440pt 的手机上横向放不下时，flex 默认会把它们压到比文字还窄，
   「控制台」就被挤成竖着一列三个字，顶栏跟着被撑高一倍。
   该让位的是角色标签（.who 自带省略号），不是按钮。 */
.topbar > a,
.topbar > button {
  flex-shrink: 0;
}
.topbar button { white-space: nowrap; }

.who {
  font-size: 13px;
  color: var(--text-dim);
  text-align: right;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 34vw;
  /* flex 项默认不会收到比内容还窄，加这条省略号才真的会触发 */
  min-width: 0;
}

/* 窄屏优先保住功能按钮，角色标签先让位。
   断点用 480：iPhone 16 Pro Max 竖屏是 440pt，写 420 的话这台反而吃不到，
   顶栏最挤的恰恰是这类「大屏但仍是手机」的机型。

   下面这几档是拿 headless Chrome 在 360/375/390/430/440pt 上逐个量出来的，
   不是估的。只留 .who 让位不够：360pt 还会溢出 24px，整页能横向拖动。
   联盟名、赛季下拉一起收紧才够，且「（测试版）」保留不删。 */
@media (max-width: 480px) {
  .topbar {
    gap: 8px;
    /* 左右各收 4px，全给顶栏内容 */
    padding-left: calc(10px + var(--safe-l));
    padding-right: calc(10px + var(--safe-r));
  }
  /* 手机上这个标签本来就被挤成 0 宽、只剩省略号，不如不占那 8px 间距。
     进的是哪个控制台，右边的按钮已经写着了。 */
  .who { display: none; }
  .topbar .logo { font-size: 15px; }
  .topbar .logo .beta { font-size: 10px; }
  .seasonsel { font-size: 12px; padding: 0 6px 0 8px; }
}

/* 360pt 这档（安卓小屏、iPhone SE 横向余量最少）再收一点间距才不溢出 */
@media (max-width: 400px) {
  .topbar {
    gap: 6px;
    padding-left: calc(8px + var(--safe-l));
    padding-right: calc(8px + var(--safe-r));
  }
}

.wrap {
  padding: 14px calc(14px + var(--safe-r)) calc(28px + var(--safe-b))
    calc(14px + var(--safe-l));
  max-width: 1100px;
  margin: 0 auto;
}

/* 横向滚动的标签栏，手机上手指可以划 */
.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 10px calc(14px + var(--safe-r)) 10px calc(14px + var(--safe-l));
  border-bottom: 1px solid var(--line);
  /* 自己不吸顶了，跟顶栏一起被 .stickytop 带着吸，见 .stickytop 处注释 */
  background: var(--bg);
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
}
.tab.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #10131a;
}
/* ===== 卡片 / 分区 ===== */
.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.card-head .spacer { flex: 1; }

.muted { color: var(--text-dim); font-size: 13px; }
.center { text-align: center; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }

/* ===== 按钮 ===== */
button {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 10px;
  min-height: var(--tap);
  padding: 0 16px;
  background: var(--bg-3);
  color: var(--text);
  font-weight: 600;
  transition: transform 0.06s, filter 0.15s;
}
button:active:not(:disabled) { transform: scale(0.96); filter: brightness(1.15); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #10131a; }
.btn-ok { background: var(--ok); color: #06210f; }
.btn-bad { background: var(--bad); color: #fff; }
.btn-ghost { background: transparent; border: 1px solid var(--line); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
/* ===== 表单：字号必须 >=16px，否则 iOS 聚焦会自动放大 ===== */
label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }

input, select, textarea {
  width: 100%;
  font: inherit;
  font-size: 16px;
  min-height: var(--tap);
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-3);
  color: var(--text);
}
/* select 不在这里去 appearance，箭头交给系统画，见下面 */
input, textarea {
  appearance: none;
  -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}
/*
 * 下拉箭头一律用系统原生的，自己不画。
 * 这里前后踩过两次：先是 SVG data URI 里的 < > 没转义，后来换成两层渐变，
 * 两次都在同一台手机上铺满整格 —— 那个解析器会把 background-image 留下、
 * 把紧跟的 background-size / background-position / background-repeat 丢掉,
 * 图案于是按默认值平铺。只要箭头是 background 画的，就还有这个风险。
 * 不设 appearance: none，浏览器自己画箭头并留出位置，没有任何可被丢掉的声明。
 * 代价是各平台箭头样式不统一，但手机上原生下拉本来就是用户最熟的样子。
 */
select {
  /* 原生箭头占的位置由浏览器自己算，这里只保证左边文字不贴边 */
  padding-right: 12px;
}
input[type='file'] { padding: 8px; min-height: auto; }

.field { margin-bottom: 12px; }
.grid-2 { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }

/* ===== 提示条 ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + var(--safe-b));
  transform: translateX(-50%) translateY(120%);
  max-width: min(90vw, 420px);
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  font-size: 14px;
  z-index: 100;
  transition: transform 0.25s ease;
  text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.err { border-color: var(--bad); }
.toast.ok { border-color: var(--ok); }

/*
 * 记录数据的短提示。必须走顶部：技术台的操作面板吸在底部，
 * 提示放下面会盖住正在点的按钮。
 */
.toast.tick {
  top: calc(var(--topbar-h) + 6px);
  bottom: auto;
  transform: translateX(-50%) translateY(-160%);
  border-color: var(--accent);
  background: #1d232c;
  font-size: 15px;
  padding: 13px 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(249, 115, 22, 0.3);
}
.toast.tick.show { transform: translateX(-50%) translateY(0); }
.toast.tick b { color: var(--text); }
/* ===== 球员头像 / 卡片 ===== */
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-3);
  flex-shrink: 0;
  border: 2px solid var(--line);
}
.avatar.lg { width: 76px; height: 76px; }
.avatar.ph {
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--text-dim);
  font-size: 15px;
}

.plist { display: flex; flex-direction: column; gap: 8px; }

.pitem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 10px;
  min-height: 60px;
}
.pitem .nm { font-weight: 600; font-size: 15px; }
.pitem .sub { font-size: 12px; color: var(--text-dim); }
.pitem .no {
  font-weight: 800;
  font-size: 15px;
  min-width: 38px;
  text-align: center;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text-dim);
  vertical-align: middle;
  white-space: nowrap;
}
.chip.on { background: var(--ok); color: #06210f; border-color: var(--ok); }
.chip.off { background: var(--bad); color: #fff; border-color: var(--bad); }

/* 球衣颜色标签 */
.chip.bib-red { background: #e63946; color: #fff; border-color: #e63946; }
.chip.bib-green { background: #2a9d5c; color: #fff; border-color: #2a9d5c; }

/* 队长标识：名单和统计表里的「队长」小标 */
.chip.cap { background: var(--accent); color: #10131a; border-color: var(--accent); }
.cap-mini {
  display: inline-block;
  padding: 0 4px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(249, 115, 22, 0.2);
  color: var(--accent);
  vertical-align: middle;
}

/* 身价档位 5 到 1，越高越亮 */
.chip.val-5 { background: #f97316; color: #10131a; border-color: #f97316; }
.chip.val-4 { background: #c2610c; color: #fff; border-color: #c2610c; }
.chip.val-3 { background: #7c4a1a; color: #f3d5b5; border-color: #7c4a1a; }
.chip.val-2 { background: #3d3630; color: #c9b39c; border-color: #4a4238; }
.chip.val-1 { background: var(--bg-3); color: var(--text-dim); border-color: var(--line); }

/* 只上色不加底的版本，用在「我的数据」那排大数字上 */
.val-text-5 { color: #f97316; }
.val-text-4 { color: #fb923c; }
.val-text-3 { color: #d8a06a; }
.val-text-2 { color: #c9b39c; }
.val-text-1 { color: var(--text-dim); }
/* ===== 折叠面板：球队名单默认收起 ===== */
details.fold {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
}

details.fold > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  min-height: var(--tap);
  cursor: pointer;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::marker { content: ''; }
details.fold > summary:active { background: var(--bg-3); }

details.fold > summary .tname { font-weight: 700; font-size: 16px; }
details.fold > summary .arrow {
  color: var(--text-dim);
  font-size: 12px;
  transition: transform 0.18s;
  flex-shrink: 0;
}
details.fold[open] > summary .arrow { transform: rotate(90deg); }
details.fold > summary .spacer { flex: 1; }

.fold-body { padding: 0 14px 14px; }

/* ===== 球员照片网格：每行 5 个 ===== */
.pgallery {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.pcard { min-width: 0; }

.pcard-ph {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-3);
  border: 1px solid var(--line);
}
.pcard-ph img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pcard-ph.ph {
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 800;
  color: var(--text-dim);
}

.pcard-nm {
  margin-top: 5px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 报名状态固定占一行，格子高度才齐 */
.pcard-sg {
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  line-height: 1.4;
  color: var(--text-dim);
}
.pcard-sg.on { color: var(--ok); }

@media (min-width: 700px) {
  .pgallery { gap: 12px; }
  .pcard-nm { font-size: 13px; margin-top: 7px; }
  .pcard-sg { font-size: 11px; }
  .pcard-ph.ph { font-size: 28px; }
}

/* ===== 表格：手机上只横向滚动，首列固定 =====
   表头不吸顶。之前给 th 加 sticky，手机上会半失效，
   上拉时行内容从表头底下透出来（穿模）。表头跟着表格一起滚就没这问题，
   页面最上面的 YBA联盟 那条顶栏本来就是固定的，够用了。
   容器不限高，纵向交给页面滚，这里只管横向。
   左右不留 padding，首列贴住容器边，不然那 14px 空隙会漏内容。 */
.tscroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -14px;
  padding: 0;
}

table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
th, td {
  padding: 9px 8px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
th {
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  text-align: right;
  background: var(--bg-2);
}
/* 首列横向固定，左右滑动时名字不跑；背景要不透明才挡得住滑过去的数字 */
th:first-child, td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--bg-2);
  z-index: 1;
  min-width: 92px;
  padding-left: 14px;
}
th:last-child, td:last-child { padding-right: 14px; }
tbody tr:active { background: var(--bg-3); }

/* 榜单首列的名次和球衣号：定宽右对齐，名字才能对齐成一列 */
.rslot, .jslot {
  display: inline-block;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.rslot { min-width: 2.4em; color: var(--text-dim); }
.jslot { min-width: 2.2em; color: var(--accent); font-weight: 700; }
td.hi { color: var(--accent); font-weight: 700; }

/* ===== 球员详情的场均数据格 ===== */
.avggrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: 8px;
}

.avgcell {
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 6px;
  text-align: center;
}
.avgcell .muted { font-size: 11px; line-height: 1.3; }
.avgcell strong {
  display: block;
  margin-top: 3px;
  font-size: 17px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* ===== 比分板 ===== */
.score {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 14px;
  background: linear-gradient(180deg, var(--bg-3), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 12px;
}
.score .tn { font-size: 13px; color: var(--text-dim); font-weight: 600; }
.score .pt {
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.score .vs { font-size: 12px; color: var(--text-dim); font-weight: 700; }
.score .side { text-align: center; min-width: 0; }
.score .side .tn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* ===== 技术台：核心是大按钮 + 单手可达 ===== */
.scorer { display: grid; gap: 12px; }

.sideby { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }

.teamcol {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 8px;
  min-width: 0;
}
.teamcol h3 {
  font-size: 13px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 球员选择格：一格一人，点了就高亮 */
.pgrid { display: grid; gap: 6px; grid-template-columns: 1fr; }

.pcell {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 50px;
  padding: 6px;
  border-radius: 10px;
  background: var(--bg-3);
  border: 2px solid transparent;
  text-align: left;
  width: 100%;
  min-width: 0; /* 不给这个，grid 子项会撑开导致名字折行 */
}
.pcell .no {
  font-weight: 800;
  font-size: 13px;
  color: var(--accent);
  min-width: 26px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.pcell .nm {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.pcell .pv {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  min-width: 20px;
  text-align: right;
}
.pcell.sel {
  border-color: var(--accent);
  background: rgba(249, 115, 22, 0.16);
}
.pcell.sel .pv { color: var(--accent); }

/* 没报名但在队里的，淡一点，方便核对到场 */
.pcell.unsigned .nm, .pcell.unsigned .no { opacity: 0.5; }
.pcell.unsigned.sel .nm, .pcell.unsigned.sel .no { opacity: 1; }
/* ===== 双方暂停 ===== */
.tobar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: stretch;
  margin-bottom: 12px;
}

.tobtn {
  min-height: 56px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 2px solid transparent;
}
.tobtn b { font-size: 14px; font-weight: 800; }
.tobtn span { font-size: 12px; font-weight: 600; opacity: 0.85; }

.tobtn.to-red {
  background: rgba(230, 57, 70, 0.18);
  border-color: rgba(230, 57, 70, 0.5);
  color: #ffb3b8;
}
.tobtn.to-green {
  background: rgba(42, 157, 92, 0.18);
  border-color: rgba(42, 157, 92, 0.5);
  color: #9be0b8;
}

.to-reset {
  min-height: 56px;
  padding: 0 14px;
  font-size: 13px;
  border: 1px solid var(--line);
}

/* ===== 挑战：每队一次，用完置灰 ===== */
.chbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.chbtn {
  min-height: 46px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  border: 2px solid transparent;
}
.chbtn.ch-red {
  background: rgba(230, 57, 70, 0.12);
  border-color: rgba(230, 57, 70, 0.4);
  color: #ffb3b8;
}
.chbtn.ch-green {
  background: rgba(42, 157, 92, 0.12);
  border-color: rgba(42, 157, 92, 0.4);
  color: #9be0b8;
}
.chbtn.used {
  background: var(--bg-2);
  border-color: var(--line);
  color: var(--text-dim);
  opacity: 0.6;
}

/* ===== 点球大战与分数调整 ===== */
.exbar { margin-bottom: 10px; }

.penbox, .adjbox {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-2);
  padding: 10px;
  margin-bottom: 10px;
}

.penrow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.penbtn {
  min-height: 60px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 2px solid transparent;
}
.penbtn b { font-size: 20px; font-weight: 800; }
.penbtn span {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.85;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.penbtn.pen-red {
  background: rgba(230, 57, 70, 0.18);
  border-color: rgba(230, 57, 70, 0.5);
  color: #ffb3b8;
}
.penbtn.pen-green {
  background: rgba(42, 157, 92, 0.18);
  border-color: rgba(42, 157, 92, 0.5);
  color: #9be0b8;
}

.adjrow {
  display: flex;
  align-items: center;
  gap: 8px;
}
.adjrow + .adjrow { margin-top: 8px; }

.adjnm {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.adjnm.adj-red { color: #ffb3b8; }
.adjnm.adj-green { color: #9be0b8; }

.adjpt {
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  min-width: 46px;
  text-align: right;
}

.adjbtn {
  min-width: 52px;
  min-height: 46px;
  border-radius: 10px;
  background: var(--bg-3, #1b2230);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
}

/* 操作面板：吸底，拇指可达 */
.pad {
  position: sticky;
  bottom: 0;
  z-index: 25;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 10px 12px calc(12px + var(--safe-b));
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.45);
  margin: 0 -14px -28px;
}

.pad-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  min-height: 32px;
}
.pad-head .cur { font-weight: 700; font-size: 15px; }
.pad-head .cur .no { color: var(--accent); }

.pad-empty {
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
  padding: 10px 0 2px;
}

/* 出手类：一行两半，左命中右不中 */
.shotrow { display: grid; grid-template-columns: 46px 1fr 1fr; gap: 6px; margin-bottom: 6px; }
.shotrow .lb {
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-dim);
  background: var(--bg-3);
  border-radius: 8px;
}
.bhit, .bmiss { min-height: 52px; font-size: 15px; font-weight: 700; }
.bhit { background: rgba(47, 191, 113, 0.2); color: #6ee7a4; border: 1px solid rgba(47,191,113,.4); }
.bmiss { background: rgba(239, 68, 68, 0.16); color: #fca5a5; border: 1px solid rgba(239,68,68,.35); }

/* 计数类 */
.cgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.cgrid button { min-height: 52px; font-size: 14px; flex-direction: column; }
.cgrid button b { display: block; font-size: 15px; }
.cgrid button span { display: block; font-size: 11px; color: var(--text-dim); font-weight: 500; }

/* ===== 点击反馈：按钮闪一下，数字跳一下 ===== */
@keyframes litFlash {
  0%   { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.9); filter: brightness(1.6); }
  100% { box-shadow: 0 0 0 14px rgba(249, 115, 22, 0); filter: brightness(1); }
}
.lit { animation: litFlash 0.45s ease-out; }

/* 命中和不中用各自的颜色扩散，避免都是橙色分不清 */
@keyframes hitFlash {
  0%   { box-shadow: 0 0 0 0 rgba(47, 191, 113, 0.9); filter: brightness(1.7); }
  100% { box-shadow: 0 0 0 14px rgba(47, 191, 113, 0); filter: brightness(1); }
}
@keyframes missFlash {
  0%   { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.9); filter: brightness(1.7); }
  100% { box-shadow: 0 0 0 14px rgba(239, 68, 68, 0); filter: brightness(1); }
}
.bhit.lit { animation: hitFlash 0.45s ease-out; }
.bmiss.lit { animation: missFlash 0.45s ease-out; }

@keyframes numPop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.55); color: var(--accent); }
  100% { transform: scale(1); }
}
.pop { display: inline-block; animation: numPop 0.4s ease-out; }

/* 最近记录里最新那条加个左侧亮条 */
.logitem.newest {
  border-left: 3px solid var(--accent);
  background: rgba(249, 115, 22, 0.1);
}
/* ===== 流水记录 ===== */
/* 服务端只给最近 5 条，这里就不用再套一层滚动了 */
.log { display: flex; flex-direction: column; gap: 4px; }
.logitem {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 7px 8px;
  background: var(--bg-3);
  border-radius: 8px;
}
.logitem .t { color: var(--text-dim); font-size: 11px; }

/* ===== 弹窗 ===== */
.mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
.modal {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 16px 16px calc(16px + var(--safe-b));
  width: 100%;
  max-width: 520px;
  max-height: 88dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal h2 { margin-bottom: 14px; }

/* 宽弹窗：统计表要横着看，尽量占满屏 */
.modal.modal-wide {
  max-width: min(96vw, 1100px);
  max-height: 94dvh;
  padding: 14px 14px calc(14px + var(--safe-b));
}
.modal.modal-wide .box-head {
  position: sticky;
  top: -14px;
  z-index: 5;
  background: var(--bg-2);
  padding: 4px 0 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.box-team {
  margin: 14px 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
}
.box-scroll { margin: 0 -14px; padding: 0; }
.box-scroll th:first-child, .box-scroll td:first-child { min-width: 104px; }
.box-scroll tfoot td {
  font-weight: 700;
  border-top: 2px solid var(--line);
  border-bottom: none;
  background: var(--bg-2);
}

/* ===== 登录页 ===== */
.auth {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px calc(18px + var(--safe-r)) calc(24px + var(--safe-b))
    calc(18px + var(--safe-l));
}
.auth-box { width: 100%; max-width: 400px; }
.auth-logo {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--accent);
  text-align: center;
  margin-bottom: 4px;
}
/* ===== 断点：小屏手机 ===== */
@media (max-width: 380px) {
  .cgrid { grid-template-columns: repeat(3, 1fr); }
  .shotrow { grid-template-columns: 40px 1fr 1fr; }
  .score .pt { font-size: 34px; }
  th, td { padding: 8px 6px; font-size: 12px; }
}

/* ===== 断点：iPad 竖屏及以上，两队并排更宽松 ===== */
@media (min-width: 700px) {
  h1 { font-size: 22px; }
  .wrap { padding-top: 18px; }
  .grid-2 { gap: 14px; }
  .pgrid { grid-template-columns: 1fr 1fr; }
  .cgrid { grid-template-columns: repeat(7, 1fr); }
  .modal { border-radius: var(--radius); }
  .mask { align-items: center; padding: 20px; }
  .score .pt { font-size: 52px; }
}

/* ===== 断点：iPad 横屏，名单靠左收窄，操作面板占大头 ===== */
@media (min-width: 1000px) {
  /* 名单固定 400px（两队各 200），剩下全给按钮区 */
  .scorer { grid-template-columns: 400px 1fr; align-items: start; }
  .scorer .sideby { grid-column: 1; }
  .pad {
    grid-column: 2;
    grid-row: 1 / span 3;
    position: sticky;
    /* 顶栏底下再留 18px 空隙，别写死数值，顶栏高度变了这里跟着走 */
    top: calc(var(--topbar-h) + 18px);
    bottom: auto;
    margin: 0;
    border-radius: var(--radius);
    box-shadow: none;
    padding-bottom: 12px;
  }
  .cgrid { grid-template-columns: repeat(4, 1fr); }
  .pgrid { grid-template-columns: 1fr; }
  /* 按钮区宽敞了，出手键可以做大 */
  .bhit, .bmiss { min-height: 60px; font-size: 16px; }
  .cgrid button { min-height: 58px; }
}

/* 更宽的屏（外接显示器 / iPad Pro 横屏）名单还能再窄一点 */
@media (min-width: 1200px) {
  .scorer { grid-template-columns: 380px 1fr; }
  .cgrid { grid-template-columns: repeat(7, 1fr); }
}

/* 触屏设备去掉 hover 效果，避免点完残留高亮 */
@media (hover: hover) {
  button:hover:not(:disabled) { filter: brightness(1.12); }
  tbody tr:hover { background: var(--bg-3); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

