/* 深水井记分台 · 样式
   原则：单手可达、按钮够大、比分和出局数一眼看清、夜间模式自动切换。 */

:root {
  --bg: #f4f2ec;
  --card: #ffffff;
  --ink: #16211b;
  --muted: #6c7670;
  --line: #e3dfd4;
  --green: #1b4332;
  --green-2: #2d6a4f;
  --green-3: #52b788;
  --gold: #b98341;
  --danger: #a4342f;
  --shadow: 0 2px 10px rgba(20, 35, 25, .08);
  --r: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101513;
    --card: #19201c;
    --ink: #eef3ef;
    --muted: #98a29b;
    --line: #2a322d;
    --green: #2d6a4f;
    --green-2: #40916c;
    --green-3: #74c69d;
    --shadow: 0 2px 10px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans CJK SC",
    "Microsoft YaHei", sans-serif;
  overflow-wrap: anywhere;
}

body { overscroll-behavior: none; }

#app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
}

/* ---------------------------------------------------------------- 顶栏 */

.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.topbar .title {
  font-size: 17px;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-size: 22px;
  color: var(--muted);
}

.icon-btn:active { background: var(--line); }

/* ---------------------------------------------------------------- 通用页面 */

.page {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px calc(24px + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}

.card {
  background: var(--card);
  border-radius: var(--r);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.card:active { transform: scale(.995); }

.card-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.card-date { font-size: 13px; color: var(--muted); }
.card-teams { font-size: 17px; font-weight: 600; margin: 6px 0 2px; }
.card-score { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.card-meta { font-size: 13px; color: var(--muted); }

.badge {
  display: inline-block;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--line);
  color: var(--muted);
}
.badge.live { background: rgba(82, 183, 136, .18); color: var(--green-2); }
.badge.final { background: rgba(185, 131, 65, .18); color: var(--gold); }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
  line-height: 1.9;
}

/* ---------------------------------------------------------------- 按钮 */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 52px;
  padding: 0 18px;
  border-radius: 12px;
  background: var(--line);
  font-size: 17px;
  font-weight: 600;
}

.btn.primary { background: var(--green); color: #fff; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.danger { background: var(--danger); color: #fff; }
.btn:active { filter: brightness(.94); }
.btn[disabled] { opacity: .45; }

.fab {
  width: 100%;
  margin-top: 16px;
  min-height: 56px;
  border-radius: 14px;
  background: var(--green);
  color: #fff;
  font-size: 18px;
  font-weight: 600;
}

/* ---------------------------------------------------------------- 表单 */

.field { margin-bottom: 14px; }

.field > label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type="text"], input[type="date"], input[type="password"], select, textarea {
  width: 100%;
  padding: 12px;
  font-size: 16px; /* iOS 小于 16px 会放大页面 */
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  appearance: none;
}

textarea {
  min-height: 140px;
  line-height: 1.7;
  font-family: inherit;
  resize: vertical;
}

.hint { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.6; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 14px;
  color: var(--muted);
}

.chip.on {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

details.advanced {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 12px 0;
}

details.advanced summary {
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.switch-row:last-child { border-bottom: 0; }
.switch-row .sub { font-size: 12px; color: var(--muted); }

.switch {
  position: relative;
  width: 50px;
  height: 30px;
  border-radius: 999px;
  background: var(--line);
  flex: 0 0 auto;
  transition: background .15s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  transition: transform .15s;
}
.switch.on { background: var(--green-2); }
.switch.on::after { transform: translateX(20px); }

/* ---------------------------------------------------------------- 记分台 */

.desk {
  flex: 1;
  display: grid;
  grid-template-rows: auto minmax(150px, 1fr) auto;
  min-height: 0;
  background: var(--bg);
}

.controls { display: flex; flex-direction: column; }

.statusbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: var(--green);
  color: #fff;
}

.statusbar .inning { font-size: 15px; font-weight: 600; opacity: .95; }
.statusbar .score {
  margin-left: auto;
  margin-right: auto;
  font-size: 30px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
}

.outs { display: flex; gap: 4px; }
.outs i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .28);
}
.outs i.on { background: #ffd166; }

.countbar {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 13px;
  color: rgba(255, 255, 255, .8);
}
.countbar b { font-size: 15px; color: #fff; }

.diamond-wrap {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 8px;
}

.diamond { width: min(86vw, 48vh); height: min(86vw, 48vh); }

.diamond .base { fill: var(--card); stroke: var(--green-2); stroke-width: 2; }
.diamond .base.occupied { fill: var(--green-3); }
.diamond .grass { fill: var(--green); opacity: .07; }
.diamond .homer { fill: var(--card); stroke: var(--green-2); stroke-width: 2; }

.token text { font-size: 13px; font-weight: 700; fill: #fff; }
.token circle { fill: var(--green-2); stroke: #fff; stroke-width: 2; }
.token.phantom circle { fill: var(--gold); }

.batterbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--card);
  border-top: 1px solid var(--line);
}

.batterbar .num {
  font-size: 13px;
  color: var(--muted);
  min-width: 24px;
}

.batterbar .name { font-size: 19px; font-weight: 700; }
.batterbar .pos { font-size: 13px; color: var(--muted); }
.batterbar .line { margin-left: auto; font-size: 13px; color: var(--muted); text-align: right; }

.pad {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 10px;
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  background: var(--bg);
}

.pad button {
  min-height: 58px;
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
  font-size: 19px;
  font-weight: 600;
}

.pad button.primary { background: var(--green); color: #fff; }
.pad .span6 { grid-column: span 6; }
.pad .span3 { grid-column: span 3; }
.pad button.warn { color: var(--danger); }
.pad button.small { font-size: 16px; min-height: 50px; }

/* ---------------------------------------------------------------- 底部抽屉 */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .35);
  z-index: 20;
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 21;
  max-height: 86dvh;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: 18px 18px 0 0;
  padding-bottom: env(safe-area-inset-bottom);
  animation: rise .18s ease-out;
}

@keyframes rise { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }

.sheet-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px 8px;
  font-size: 15px;
  color: var(--muted);
}

.sheet-head .spacer { flex: 1; }

.sheet-body {
  overflow-y: auto;
  padding: 4px 14px 14px;
}

.group-title {
  font-size: 13px;
  color: var(--muted);
  margin: 12px 0 8px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.grid.three { grid-template-columns: repeat(3, 1fr); }

.grid button {
  min-height: 58px;
  border-radius: 12px;
  background: var(--bg);
  font-size: 17px;
  font-weight: 600;
}

.grid button:active { background: var(--line); }

.movers { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }

.mover {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: 12px;
}

.mover .who { font-size: 15px; font-weight: 600; }
.mover .from { font-size: 12px; color: var(--muted); }

.mover button {
  margin-left: auto;
  min-width: 130px;
  min-height: 46px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 16px;
  font-weight: 600;
}

.mover button.out { color: var(--danger); border-color: var(--danger); }

.zone-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.zone-cell {
  aspect-ratio: 1;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--bg);
  font-size: 15px;
  color: #fff;
}

.zone-cell.zone {
  background: rgba(82, 183, 136, .12);
  border-color: var(--green-3);
}

.zone-cell.on {
  background: var(--green);
  border-color: var(--green);
}

.field-svg {
  width: 100%;
  height: auto;
  display: block;
  touch-action: manipulation;
  color: var(--ink);
}

.sheet-body .confirm {
  display: block;
  width: 100%;
  margin: 14px 0 4px;
}

.sheet .confirm {
  margin: 8px 14px 14px;
  min-height: 58px;
  border-radius: 14px;
  background: var(--green);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
}

/* ---------------------------------------------------------------- 统计页 */

.linescore { width: 100%; border-collapse: collapse; font-size: 13px; }
.linescore th, .linescore td { padding: 6px 4px; text-align: center; border-bottom: 1px solid var(--line); }
.linescore th:first-child, .linescore td:first-child { text-align: left; font-weight: 600; }
.linescore .tot { font-weight: 700; }

.stat-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.stat-table th, .stat-table td { padding: 7px 4px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
.stat-table th { color: var(--muted); font-weight: 500; font-size: 12px; }
.stat-table th:first-child, .stat-table td:first-child { text-align: left; }
.stat-table tbody tr:last-child td { border-bottom: 0; }

.table-scroll { overflow-x: auto; }

/* ---------------------------------------------------------------- 提示 */

.toast {
  position: fixed;
  left: 50%;
  top: calc(64px + env(safe-area-inset-top));
  transform: translate(-50%, -8px);
  background: rgba(20, 30, 24, .92);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 50;
  opacity: 0;
  transition: opacity .18s, transform .18s;
  max-width: 86vw;
  text-align: center;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------------------------------------------------------------- 登录 */

.login {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 28px;
  gap: 14px;
}
.login h1 { font-size: 26px; margin: 0 0 4px; }
.login p { color: var(--muted); margin: 0 0 12px; line-height: 1.7; }

/* ---------------------------------------------------------------- 帮助页 */

.help h3 {
  font-size: 16px;
  margin: 18px 0 8px;
}
.help h3:first-child { margin-top: 0; }

.help ul, .help ol {
  margin: 0 0 6px;
  padding-left: 20px;
  line-height: 1.85;
  font-size: 15px;
}

.help code {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 5px;
  font-size: 13px;
}

.help li { margin-bottom: 4px; }

/* ---------------------------------------------------------------- 换人记录 */

.subs { display: flex; flex-direction: column; gap: 6px; }

.sub-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  padding: 6px 10px;
  background: var(--bg);
  border-radius: 8px;
}

.sub-row .when { color: var(--muted); flex: 0 0 auto; }
.sub-row .who { flex: 1; min-width: 0; }
.sub-row .flag { font-size: 12px; color: var(--muted); }
.sub-row .flag.ok { color: var(--green-2); }

/* 已换下的球员：整行淡一点，名字后带小标签 */
.stat-table tr.departed td { opacity: .62; }
.tag {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--line);
  color: var(--muted);
}

/* ---------------------------------------------------------------- 名单栏（照纸质记分表） */

.lineup { display: flex; flex-direction: column; }

.slot {
  display: flex;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.slot:last-child { border-bottom: 0; }

.slot-no {
  flex: 0 0 22px;
  font-size: 15px;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.slot-body { flex: 1; min-width: 0; }

.slot-player + .slot-player {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.slot-name {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 15px;
}

.slot-name .pnum,
.slot-name .ppos { font-size: 12px; color: var(--muted); }
.slot-name .when { font-size: 11px; color: var(--muted); }
.slot-name .arrow { color: var(--green-2); }

.slot-stats {
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.slot-player.out .slot-name b { color: var(--muted); font-weight: 600; }
.slot-player.out .slot-stats { opacity: .65; }

/* ---------------------------------------------------------------- 确认弹窗 */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, .42);
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal {
  width: 100%;
  max-width: 340px;
  background: var(--card);
  border-radius: 16px;
  padding: 20px 18px 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .25);
}

.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.modal-msg { font-size: 14px; color: var(--muted); line-height: 1.7; margin-bottom: 4px; }

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

/* 退出登录：和普通图标分开，红色、带文字 */
.logout-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--danger);
  border: 1px solid rgba(164, 52, 47, .35);
  font-size: 13px;
  background: transparent;
}

/* 投手胜负标记 */
.pitcher-mark {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  margin-right: 10px;
}
.pitcher-mark .chip { min-height: 34px; padding: 0 10px; font-size: 13px; }

/* 记分员列表 */
.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.user-row:last-child { border-bottom: 0; }
.user-row.off { opacity: .55; }
.user-main { flex: 1; min-width: 120px; }
.user-name { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.user-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.user-actions { display: flex; gap: 6px; }
.user-actions .chip { min-height: 34px; padding: 0 10px; font-size: 13px; }
.user-actions .chip.danger { color: var(--danger); border-color: rgba(164, 52, 47, .35); }

/* ---------------------------------------------------------------- 球数轨迹 */

.trail {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 0;
  min-height: 26px;
}

.trail-count {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.trail-count b { font-size: 18px; color: var(--ink); }
.trail-count span { margin: 0 4px; opacity: .5; }

.trail-dots { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}
.dot.b { background: var(--muted); opacity: .55; }
.dot.s { background: var(--gold); }
.dot.f { border: 2px solid var(--muted); opacity: .7; }
.dot.x { background: var(--green-2); }

.trail-empty { font-size: 12px; color: var(--muted); }

.pad button:active { transform: scale(.97); }

/* ---------------------------------------------------------------- 记录列表 */

.hist-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.hist-row:last-of-type { border-bottom: 0; }
.hist-inning { color: var(--muted); font-size: 12px; flex: 0 0 auto; }
.hist-main { font-weight: 600; flex: 0 0 auto; }
.hist-res { margin-left: auto; color: var(--muted); font-size: 13px; }

/* 「上一棒」快捷入口：不点菜单就能改上一条 */
.last-pa {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.last-pa span { opacity: .7; }

/* 跑者去向：展开后的明确选项 */
.mover-open {
  display: block;
  background: var(--bg);
  padding: 10px 12px;
}

.mover-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}
.mover-head .who { font-size: 15px; font-weight: 600; }
.mover .mover-cancel {
  margin-left: auto;
  min-width: 0;
  min-height: 0;
  padding: 2px 6px;
  background: transparent;
  border: 0;
  font-size: 13px;
  color: var(--muted);
}

.mover-opts {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.mover-opts .chip {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 0;
  font-size: 13px;
  border-radius: 10px;
}
.mover-opts .chip.danger { color: var(--danger); border-color: rgba(164, 52, 47, .35); }

.mover .caret { opacity: .45; font-size: 11px; }

/* ---------------------------------------------------------------- 宽屏（电脑 / 平板）

手机上是一列到底；电脑上再这么拉就会变成「一条巨大的球场」。
原则：内容列居中、抽屉变成对话框、球场有最大尺寸。 */

@media (min-width: 760px) {
  body {
    background: #e8e5dc;
    display: flex;
    justify-content: center;
  }

  #app {
    width: 100%;
    max-width: 760px;
    background: var(--bg);
    box-shadow: 0 0 0 1px var(--line), 0 10px 40px rgba(0, 0, 0, .06);
  }

  /* 抽屉：居中对话框，不再贴着屏幕底边 */
  .sheet {
    left: 50%;
    right: auto;
    bottom: 28px;
    width: min(520px, calc(100vw - 64px));
    max-height: min(78dvh, 720px);
    transform: translateX(-50%);
    border-radius: 18px;
    animation: none;
    box-shadow: 0 18px 60px rgba(0, 0, 0, .22);
  }

  .sheet-backdrop { background: rgba(0, 0, 0, .45); }

  .modal { max-width: 400px; }

  /* 计分台：球场别跟着窗口一起长 */
  .diamond {
    width: min(46vh, 340px);
    height: min(46vh, 340px);
  }

  .field-svg {
    max-width: 360px;
    margin: 0 auto;
  }

  .pad {
    max-width: 620px;
    margin: 0 auto;
    width: 100%;
  }

  .pad button { min-height: 50px; font-size: 17px; }

  .statusbar { padding: 8px 18px; }
  .statusbar .score { font-size: 26px; }

  .trail { max-width: 620px; margin: 0 auto; width: 100%; }
  .batterbar { max-width: 620px; margin: 0 auto; width: 100%; border-radius: 12px 12px 0 0; }

  .card { box-shadow: 0 1px 3px rgba(20, 35, 25, .06); }

  .login { max-width: 380px; margin: 0 auto; width: 100%; }

  /* 对话框里的选项居中，跟居中的球场对齐 */
  .sheet-body .chips { justify-content: center; }
}

/* 宽屏下计分台改成左右两栏：左边球场，右边控制区垂直居中 */
@media (min-width: 760px) {
  .desk {
    grid-template-columns: minmax(300px, 400px) 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "status status"
      "field controls";
    padding: 0 20px 20px;
  }

  .statusbar { grid-area: status; margin: 0 -20px; }

  .diamond-wrap {
    grid-area: field;
    padding: 0;
    align-self: center;
  }

  .controls {
    grid-area: controls;
    justify-content: center;
    padding: 10px 0 0 20px;
    max-width: 460px;
  }

  .batterbar { margin: 0; border-radius: 12px; }
  .trail { margin: 12px 0 0; padding: 0; }
  .pad { margin: 16px 0 0; padding: 0; max-width: none; }
}

@media (min-width: 1000px) {
  #app { max-width: 860px; }

  /* 比赛列表两列，别让卡片拉成一条 */
  .page-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 12px;
    align-content: start;
  }

  .page-list > .fab,
  .page-list > .btn,
  .page-list > .hint,
  .page-list > .empty { grid-column: 1 / -1; }
}

@media (prefers-color-scheme: dark) and (min-width: 760px) {
  body { background: #0b0f0d; }
}

/* ---------------------------------------------------------------- 回放 */

.replay-stage { padding: 14px 14px 12px; }

.replay-line {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
}

.replay-score {
  margin: 0 auto;
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.replay-stage .diamond-wrap { padding: 8px 0 0; min-height: 0; }
.replay-stage .diamond { width: min(58vw, 210px); height: min(58vw, 210px); margin: 0 auto; display: block; }

.replay-play {
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  padding-top: 8px;
  min-height: 24px;
}

.replay-controls { display: flex; gap: 8px; margin-bottom: 12px; }
.replay-controls .btn { flex: 1; min-height: 46px; font-size: 14px; padding: 0 6px; }

.replay-range {
  width: 100%;
  margin: 0 0 14px;
  accent-color: var(--green-2);
}

.hist-row.on {
  background: rgba(82, 183, 136, .14);
  border-radius: 8px;
}

/* 卡片底部的删除入口：明显、但不抢主操作 */
.card-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.link-danger {
  color: var(--danger);
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 8px;
}
.link-danger:active { background: rgba(164, 52, 47, .08); }

/* 回放：球数与落点小图 */
.replay-count {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  padding-top: 6px;
}
.replay-count b { font-size: 16px; color: var(--ink); }

.replay-spray {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.replay-spray .spray-mini { width: 132px; flex: 0 0 auto; }
.replay-spray span { font-size: 12px; color: var(--muted); }

/* 好球区：不允许点的格子 */
.zone-cell.blocked { opacity: .22; }
.hist-by { font-style: normal; font-size: 11px; opacity: .6; margin-left: 6px; }

/* 根页面的全局动作条 */
.list-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.list-actions .btn { min-height: 46px; }
.list-actions b { margin-left: 4px; font-variant-numeric: tabular-nums; }

.card-actions .link {
  font-size: 13px;
  color: var(--green-2);
  padding: 6px 10px;
  border-radius: 8px;
}
.card-actions .link:active { background: rgba(82, 183, 136, .12); }
.card-actions { gap: 4px; }

/* 统计页：可折叠分区 */
.sect { border-top: 1px solid var(--line); margin-top: 10px; }
.sect > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 0 8px;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sect > summary::-webkit-details-marker { display: none; }
.sect > summary::after {
  content: '▾';
  margin-left: auto;
  font-size: 12px;
  opacity: .45;
  transition: transform .15s;
}
.sect[open] > summary::after { transform: rotate(180deg); }
.sect-body { padding-bottom: 8px; }
.stat-table .total-row td { font-weight: 600; border-top: 1px solid var(--line); }

/* 底部常驻的「当前投手」 */
.pitcher-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 14px;
  background: var(--card);
  border-top: 1px solid var(--line);
  font-size: 14px;
  text-align: left;
}
.pitcher-bar .pb-team { font-size: 12px; color: var(--muted); }
.pitcher-bar .pb-label { font-size: 12px; color: var(--muted); }
.pitcher-bar b { font-size: 15px; }
.pitcher-bar .pb-num, .pitcher-bar .pb-pos { font-size: 12px; color: var(--muted); }
.pitcher-bar .pb-empty { color: var(--green-2); font-size: 13px; }
.pitcher-bar .caret { margin-left: auto; font-size: 12px; opacity: .45; }
.pitcher-bar:active { background: var(--bg); }
