/* ========== 星元联赛裁判系统 - 移动端样式（嵌入主系统，作用域 #refereeModule） ========== */

#refereeModule * { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

#refereeModule {
  --primary: #1a56db;
  --primary-dark: #1e40af;
  --primary-light: #dbeafe;
  --green: #16a34a;
  --green-dark: #15803d;
  --green-light: #dcfce7;
  --red: #dc2626;
  --red-light: #fee2e2;
  --orange: #ea580c;
  --orange-light: #fff7ed;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -2px rgba(0,0,0,.05);
  --radius: 12px;
  --radius-lg: 16px;
  /* 模块容器样式 */
  position: fixed; inset: 0; z-index: 9999; overflow-y: auto;
  display: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
#refereeModule.active { display: block; }

#refereeModule #refereeApp { max-width: 900px; margin: 0 auto; min-height: 100vh; background: var(--gray-50); }

/* ========== 通用按钮（紧凑排布） ========== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 20px; border: none; border-radius: var(--radius);
  font-size: 16px; font-weight: 700; cursor: pointer; transition: all .15s;
  min-height: 46px; min-width: 46px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-dark); }
.btn-green { background: var(--green); color: #fff; }
.btn-green:active { background: var(--green-dark); }
.btn-red { background: var(--red); color: #fff; }
.btn-red:active { background: #b91c1c; }
.btn-gray { background: var(--gray-200); color: var(--gray-700); }
.btn-gray:active { background: var(--gray-300); }
.btn-outline { background: #fff; border: 2px solid var(--gray-300); color: var(--gray-700); }
.btn-outline:active { border-color: var(--primary); color: var(--primary); }
.btn-lg { padding: 14px 28px; font-size: 18px; min-height: 52px; }
.btn-sm { padding: 8px 14px; font-size: 14px; min-height: 36px; }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn-block { width: 100%; }

/* ========== 屏幕一：比赛选择 ========== */
.select-screen { padding: 24px 16px; }

.ref-header {
  background: linear-gradient(135deg, #1a56db, #7c3aed);
  color: #fff; padding: 32px 20px; border-radius: var(--radius-lg);
  margin-bottom: 24px; text-align: center;
}
.ref-header .logo { font-size: 60px; margin-bottom: 10px; }
.ref-header h1 { font-size: 28px; margin-bottom: 6px; font-weight: 800; }
.ref-header p { font-size: 17px; opacity: .85; font-weight: 500; }

.section-title {
  font-size: 17px; font-weight: 800; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: .8px;
  padding: 0 4px 12px; display: flex; align-items: center; gap: 8px;
}

.match-card {
  background: #fff; border-radius: var(--radius); padding: 18px 16px;
  margin-bottom: 12px; box-shadow: var(--shadow-sm);
  display: flex; align-items: center; justify-content: space-between;
  border: 2px solid transparent; transition: all .15s; cursor: pointer;
}
.match-card:active { border-color: var(--primary); }
.match-card .teams { display: flex; align-items: center; gap: 14px; flex: 1; }
.match-card .team-mini { text-align: center; flex: 1; }
.match-card .team-mini .logo { font-size: 40px; }
.match-card .team-mini .name { font-size: 17px; font-weight: 700; margin-top: 4px; }
.match-card .vs { font-size: 16px; color: var(--gray-400); font-weight: 800; }
.match-card .meta { text-align: right; }
.match-card .tier-badge { font-size: 12px; padding: 3px 10px; border-radius: 20px; font-weight: 700; }
.match-card .round { font-size: 13px; color: var(--gray-400); margin-top: 4px; font-weight: 600; }

.match-card.completed { opacity: .85; }
.match-card .status-tag { font-size: 12px; padding: 3px 8px; border-radius: 4px; font-weight: 700; }

/* ========== 已结束比赛卡片（进球记录分列LOGO两侧） ========== */
.fin-card { padding: 18px; }
.fin-result-row {
  display: flex; align-items: center; gap: 8px;
}
.fin-goals-col {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px;
}
.fin-home-goals { align-items: flex-end; text-align: right; }
.fin-away-goals { align-items: flex-start; text-align: left; }
.fin-goal-item {
  display: flex; align-items: center; gap: 5px;
  font-size: 14px; line-height: 1.5;
}
.fin-home-goals .fin-goal-item { flex-direction: row; }
.fin-away-goals .fin-goal-item { flex-direction: row; }
.fin-goal-name {
  font-weight: 700; color: var(--gray-700);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 110px;
}
.fin-goal-time {
  font-size: 12px; color: var(--gray-400); font-weight: 800;
  font-family: "SF Mono", "Cascadia Code", monospace;
  flex-shrink: 0;
}
.fin-x2 {
  background: linear-gradient(135deg, #7c3aed, #9333ea);
  color: #fff; font-size: 10px; font-weight: 800;
  padding: 2px 6px; border-radius: 4px; flex-shrink: 0;
}
.fin-og { font-size: 11px; color: var(--orange); font-weight: 600; }
.fin-no-goals { font-size: 14px; color: var(--gray-300); }

.fin-center {
  display: flex; align-items: flex-start; justify-content: center;
  gap: 10px; flex-shrink: 0;
}
.fin-team-block { text-align: center; }
.fin-logo-jersey {
  display: flex; align-items: center; gap: 5px; justify-content: center;
}
.fin-jersey {
  width: 16px; height: 16px; border-radius: 3px; flex-shrink: 0;
}
.fin-logo { font-size: 32px; line-height: 1; }
.fin-team-name {
  font-size: 13px; color: var(--gray-500); margin-top: 4px;
  max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 600;
}
.fin-score {
  font-size: 24px; font-weight: 900; color: var(--gray-800);
  padding: 0 6px; line-height: 32px;
}

@media (max-width: 480px) {
  .fin-goal-name { max-width: 70px; font-size: 13px; }
  .fin-logo { font-size: 26px; }
  .fin-score { font-size: 20px; }
  .fin-team-name { font-size: 12px; max-width: 60px; }
}

/* ========== 手机端防文字竖排（一字一行）与布局挤压 ========== */
@media (max-width: 768px) {
  /* 徽章/标签/按钮一律不换行，避免窄屏一字竖排 */
  .match-card .tier-badge, .match-card .round, .match-card .status-tag,
  .match-card .vs, .goal-tag, .btn, .formation-tag, .active-item-badge,
  .event-log-item .time, .event-log-item .event-team, .jersey-no { white-space: nowrap; }

  /* 比赛选择卡片：右侧信息列不参与压缩，球队区自适应 */
  .match-card .teams { min-width: 0; }
  .match-card .meta { flex-shrink: 0; }

  /* 实时页顶部：赛事名过长省略号截断，不挤压计时器 */
  .live-topbar .event-name {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 42vw; min-width: 0;
  }
  .live-timer { font-size: 26px; }
  /* 窄屏：计时区收窄，按键降为小号，避免挤压赛事名 */
  .live-topbar .live-timer-zone { gap: 6px; margin-left: 4px; }
  .live-topbar .ref-timer-toggle { font-size: 11px; padding: 2px 8px; }

  /* 比分面板：缩小字号，队名不竖排 */
  .score-display { font-size: 46px; padding: 0 10px; }
  .score-team .logo { font-size: 40px; }
  .score-team .name { font-size: 15px; word-break: break-all; }

  /* 事件列表：队伍与文字允许收缩但不竖排（换行优先） */
  .event-log-item { font-size: 14px; gap: 8px; flex-wrap: wrap; }
  .event-log-item .event-text { min-width: 120px; }

  /* 赛前设置：队名/状态缩小防挤压 */
  .tt-name { font-size: 15px; }
  .team-toggle-btn .tt-status { font-size: 12px; }
  .match-info-bar.match-info-center .team-block .name { font-size: 13px; }

  /* 时间线进球标签 */
  .timeline-strip .goal-tag { font-size: 12px; }
}

@media (max-width: 480px) {
  /* 超窄屏：选择卡片改为上下布局，信息列横向排布 */
  .match-card { flex-wrap: wrap; gap: 10px; }
  .match-card .meta {
    width: 100%; text-align: left;
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  }
  .match-card .team-mini .name { font-size: 14px; }
  .match-card .team-mini .logo { font-size: 32px; }
  .score-display { font-size: 38px; }
  .score-team .logo { font-size: 32px; }
  .live-timer { font-size: 22px; }
  .action-btn .label { font-size: 14px; }
  .action-btn-lg .icon { font-size: 34px; }
  .ref-header h1 { font-size: 22px; }
  .ref-header .logo { font-size: 46px; }
}

/* ========== 屏幕二：赛前设置 ========== */
.lineup-screen { padding: 20px 16px; }

.match-info-bar {
  background: var(--gray-900); color: #fff; border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.match-info-bar .event-name { font-size: 16px; opacity: .7; font-weight: 600; }
.match-info-bar .teams-info { display: flex; align-items: center; gap: 12px; }
.match-info-bar .team-block { text-align: center; flex: 1; }
.match-info-bar .team-block .logo { font-size: 30px; }
.match-info-bar .team-block .name { font-size: 18px; font-weight: 700; }
.match-info-bar .vs-text { font-size: 18px; color: var(--gray-400); font-weight: 700; }

/* 居中布局：赛事名在上，球队名在下 */
.match-info-bar.match-info-center {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}
.match-info-bar.match-info-center .event-name {
  font-size: 18px;
  opacity: 1;
  font-weight: 800;
  text-align: center;
}
.match-info-bar.match-info-center .teams-info {
  justify-content: center;
}
.match-info-bar.match-info-center .team-block .name { font-size: 14px; }

.team-panel {
  background: #fff; border-radius: var(--radius); margin-bottom: 20px;
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.team-panel-header {
  padding: 14px 18px; display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--gray-200);
  flex-wrap: wrap;
}
.team-panel-header .logo { font-size: 30px; }
.team-panel-header .name { font-size: 20px; font-weight: 800; flex: 1; min-width: 120px; }
.team-panel-header .formation-tag {
  font-size: clamp(28px, 6vw, 56px); font-weight: 800; color: var(--primary);
  background: var(--primary-light); padding: clamp(8px, 2vw, 18px) clamp(16px, 4vw, 40px); border-radius: 28px;
  line-height: 1.2;
}

.formation-selector {
  padding: 14px 18px; display: flex; gap: 10px; flex-wrap: wrap;
  border-bottom: 1px solid var(--gray-100);
}
.formation-option {
  padding: 24px 40px; border: 3px solid var(--gray-200); border-radius: 18px;
  font-size: clamp(26px, 5vw, 36px); font-weight: 700; cursor: pointer; transition: all .15s;
  background: var(--gray-50); line-height: 1.2;
}
.formation-option.active { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.formation-option:active { transform: scale(.95); }

.formation-pitch {
  background: linear-gradient(180deg, #166534, #15803d);
  border-radius: 10px; margin: 14px 18px; padding: 20px 10px;
  min-height: 380px; position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.formation-row {
  display: flex; justify-content: center; gap: 18px; width: 100%;
}
.position-slot {
  width: 82px; height: 82px; border-radius: 50%;
  border: 2px dashed rgba(255,255,255,.4); display: flex;
  align-items: center; justify-content: center; cursor: pointer;
  transition: all .15s; position: relative;
}
.position-slot.filled { border: 2px solid #fff; background: rgba(255,255,255,.15); }
.position-slot.gk { border-color: rgba(250,204,21,.6); }
.position-slot.gk.filled { background: rgba(250,204,21,.2); border-color: #facc15; }
.position-slot:active { transform: scale(.9); }
.position-slot .slot-label { font-size: 14px; color: rgba(255,255,255,.5); font-weight: 700; }
.position-slot .player-avatar {
  width: 58px; height: 58px; border-radius: 50%; background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 22px; font-weight: 800;
}
.position-slot .player-name {
  position: absolute; bottom: -22px; font-size: 14px; color: #fff;
  white-space: nowrap; text-shadow: 0 1px 2px rgba(0,0,0,.5);
  font-weight: 700;
}
.position-slot .remove-btn {
  position: absolute; top: -4px; right: -4px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--red); color: #fff; font-size: 12px;
  display: flex; align-items: center; justify-content: center; border: 2px solid #fff;
}

.player-pool {
  padding: 14px 18px;
}
.pool-title { font-size: 17px; font-weight: 700; color: var(--gray-500); margin-bottom: 10px; }
.pool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
.pool-player {
  background: var(--gray-50); border: 2px solid var(--gray-200); border-radius: 12px;
  padding: 12px 6px; text-align: center; cursor: pointer; transition: all .15s;
}
.pool-player:active { transform: scale(.95); }
.pool-player.selected { opacity: .3; pointer-events: none; }
.pool-player.in-lineup { opacity: .3; pointer-events: none; }
.pool-player.picked {
  border-color: var(--green);
  background: var(--green-light);
  box-shadow: 0 0 0 2px var(--green);
  transform: scale(1.05);
}
.pool-player .avatar {
  width: 48px; height: 48px; border-radius: 50%; margin: 0 auto 5px;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 800; color: #fff;
}
.pool-player .name { font-size: 16px; font-weight: 700; }
.pool-player .num { font-size: 13px; color: var(--gray-400); font-weight: 600; }
.pool-player .pos-badge { font-size: 12px; padding: 2px 6px; border-radius: 4px; display: inline-block; margin-top: 3px; font-weight: 700; }

.confirm-bar {
  position: sticky; bottom: 0; background: #fff; padding: 12px 18px;
  border-top: 1px solid var(--gray-200); display: flex; gap: 12px; align-items: center;
}
.confirm-bar .status { font-size: 16px; color: var(--gray-500); flex: 1; font-weight: 600; }
.confirm-bar .status.ready { color: var(--green); font-weight: 800; }

/* 主队/客队切换按钮 */
.team-toggle-bar {
  display: flex; gap: 12px; margin-bottom: 20px;
}
.team-toggle-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 14px 10px; border: 2px solid var(--gray-200); border-radius: var(--radius);
  background: #fff; cursor: pointer; transition: all .15s; position: relative;
}
.team-toggle-btn:active { transform: scale(.97); }
.team-toggle-btn.active {
  border-color: var(--primary); background: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(26,86,219,.1);
}
.team-toggle-btn.ready { border-color: var(--green); }
.team-toggle-btn.ready.active { background: var(--green-light); }
.team-toggle-btn .tt-logo { font-size: 36px; }
.team-toggle-btn .tt-name { font-size: 18px; font-weight: 800; color: var(--gray-800); }
.team-toggle-btn.active .tt-name { color: var(--primary); }
.team-toggle-btn.ready.active .tt-name { color: var(--green); }
.team-toggle-btn .tt-status { font-size: 14px; color: var(--gray-400); font-weight: 700; }

/* 已选球员提示条 */
.selected-player-hint {
  display: flex; align-items: center; gap: 12px; margin: 14px 18px 0;
  padding: 12px 16px; background: var(--green-light); border: 2px solid var(--green);
  border-radius: var(--radius); animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(22,163,74,.2); }
  50% { box-shadow: 0 0 0 6px rgba(22,163,74,0); }
}
.selected-player-hint .sp-avatar {
  width: 42px; height: 42px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 17px; font-weight: 800; color: #fff;
}
.selected-player-hint .sp-text { flex: 1; font-size: 17px; color: var(--green-dark); font-weight: 600; }
.selected-player-hint .sp-text b { color: var(--green-dark); font-weight: 800; }
.selected-player-hint .sp-cancel {
  border: none; background: rgba(22,163,74,.15); color: var(--green-dark);
  padding: 8px 14px; border-radius: 8px; font-size: 15px; font-weight: 700; cursor: pointer;
}

/* 可放置位置高亮 */
.position-slot.targetable {
  border: 2px solid rgba(34,197,94,.8);
  background: rgba(34,197,94,.2);
  animation: targetPulse 1.5s ease-in-out infinite;
}
@keyframes targetPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(34,197,94,.4); }
  50% { box-shadow: 0 0 0 6px rgba(34,197,94,0); }
}
.position-slot .slot-label.target {
  color: #fff; font-weight: 700; font-size: 12px;
}

/* 确认栏状态图标 */
.confirm-bar .confirm-status { font-size: 20px; }

/* 开始比赛区域（始终显示，双方就绪才可点击） */
.start-match-zone { padding: 0 16px 20px; }
.start-hint {
  text-align: center; font-size: 14px; color: var(--gray-400);
  margin-top: 12px; font-weight: 600;
  display: flex; flex-direction: column; gap: 6px;
}
.start-hint .start-hint-arrow {
  font-size: 15px; color: var(--primary); font-weight: 700;
  animation: hintBounce 1.2s ease-in-out infinite;
}
@keyframes hintBounce {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* ========== 屏幕三：比赛实时控制台 ========== */
.live-screen { padding: 0; }

.live-topbar {
  background: var(--gray-900); color: #fff; padding: 12px 18px;
  display: flex; align-items: center; justify-content: space-between;
}
.live-topbar .event-name { font-size: 14px; opacity: .75; font-weight: 600; }
.live-timer {
  font-size: 32px; font-weight: 900; font-variant-numeric: tabular-nums;
  font-family: "SF Mono", "Cascadia Code", monospace;
}
.live-timer .half-indicator { font-size: 14px; opacity: .6; font-weight: 700; }
/* 计时区间：比赛时间 + 「开始/暂停」按键（2026-09-18 新增） */
.live-topbar .live-timer-zone {
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0; margin-left: 8px;
}
.live-topbar .ref-timer-toggle { flex-shrink: 0; }

/* ========== 计时「开始/暂停」按键（跨界面复用：裁判台 / 赛程列表 / 比赛详情弹窗） ========== */
.ref-timer-toggle {
  display: inline-flex; align-items: center; gap: 4px;
  white-space: nowrap; cursor: pointer; border-radius: 999px;
  font-weight: 700; font-family: inherit; font-size: 13px;
  padding: 4px 12px; line-height: 1.4; vertical-align: middle;
  transition: filter .15s ease;
}
.ref-timer-toggle:hover { filter: brightness(.94); }
.ref-timer-toggle[disabled] { opacity: .55; cursor: default; }
/* 浅色底（赛程列表 / 比赛详情弹窗）：计时中=橙（可暂停）、已暂停=绿（可开始） */
.ref-timer-toggle.is-running { background: #fff7ed; border: 1px solid #fdba74; color: #c2410c; }
.ref-timer-toggle.is-paused  { background: #f0fdf4; border: 1px solid #86efac; color: #15803d; }
/* 深色底（裁判台顶部信息栏） */
.ref-timer-toggle.is-running.on-dark { background: rgba(234,88,12,.30); border: 1.5px solid rgba(253,186,116,.65); color: #ffedd5; }
.ref-timer-toggle.is-paused.on-dark  { background: rgba(22,163,74,.32); border: 1.5px solid rgba(134,239,172,.65); color: #dcfce7; }
.ref-timer-toggle.size-sm { font-size: 11px; padding: 2px 8px; line-height: 1.5; }

.live-topbar .timer-controls { display: flex; gap: 8px; }
.live-topbar .timer-btn {
  width: 44px; height: 44px; border-radius: 50%; border: none;
  display: flex; align-items: center; justify-content: center; font-size: 20px; cursor: pointer;
}
.timer-btn.start { background: var(--green); color: #fff; }
.timer-btn.pause { background: var(--orange); color: #fff; }

.score-board {
  background: #fff; padding: 22px 18px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--gray-200);
}
.score-team { flex: 1; text-align: center; cursor: pointer; }
.score-team .logo { font-size: 56px; }
.score-team .name { font-size: 19px; font-weight: 800; margin-top: 6px; }
.score-display {
  font-size: 72px; font-weight: 900; padding: 0 18px;
  font-variant-numeric: tabular-nums; font-family: "SF Mono", "Cascadia Code", monospace;
  display: flex; align-items: center; gap: 10px; line-height: 1;
}
.score-display .colon { color: var(--gray-300); }

.timeline-strip {
  background: var(--gray-50); padding: 8px 18px; border-bottom: 1px solid var(--gray-200);
  display: flex; gap: 8px; flex-wrap: wrap; min-height: 32px; align-items: center;
}
.timeline-strip .goal-tag {
  font-size: 13px; padding: 3px 10px; border-radius: 14px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 4px;
}
.goal-tag.home { background: var(--blue-light, #dbeafe); color: var(--primary); }
.goal-tag.away { background: var(--orange-light); color: var(--orange); }

/* 操作按钮区 - 优化布局 */
.action-grid {
  padding: 16px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.action-grid-sub {
  padding: 0 16px 16px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.action-btn {
  background: #fff; border: 2px solid var(--gray-200); border-radius: var(--radius);
  padding: 14px 6px; text-align: center; cursor: pointer; transition: all .15s;
  box-shadow: var(--shadow-sm); position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 80px;
}
.action-btn:active { transform: scale(.97); border-color: var(--primary); }
.action-btn .icon { font-size: 38px; line-height: 1; }
.action-btn .label { font-size: 16px; font-weight: 700; margin-top: 6px; color: var(--gray-700); }
.action-btn.goal { border-color: var(--green); }
.action-btn.goal .icon { color: var(--green); }
.action-btn.owngoal { border-color: var(--orange); }
.action-btn.owngoal .icon { color: var(--orange); }
.action-btn.penalty { border-color: var(--red); }
.action-btn.penalty .icon { color: var(--red); }
.action-btn.sub { border-color: var(--primary); }
.action-btn.sub .icon { color: var(--primary); }
.action-btn.item { border-color: #7c3aed; }
.action-btn.item .icon { color: #7c3aed; }
.action-btn.card { border-color: #facc15; }
.action-btn.card .icon { color: #eab308; }

/* 大按钮变体（核心事件） */
.action-btn-lg {
  min-height: 92px;
}
.action-btn-lg .icon { font-size: 42px; }
.action-btn-lg .label { font-size: 17px; }

/* 队伍标签 */
.action-btn .side-tag {
  position: absolute; top: 6px; right: 6px;
  font-size: 10px; font-weight: 900; padding: 2px 6px; border-radius: 4px;
}
.action-btn .side-tag.home { background: #dbeafe; color: #1a56db; }
.action-btn .side-tag.away { background: #fff7ed; color: #ea580c; }

.bottom-controls {
  padding: 16px; display: flex; gap: 10px;
}
.bottom-controls .btn { flex: 1; }

/* 事件列表 */
.event-log {
  background: #fff; margin: 0 16px 16px; border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.event-log-header { padding: 12px 16px; background: var(--gray-50); font-size: 17px; font-weight: 800; color: var(--gray-600); border-bottom: 1px solid var(--gray-200); }
.event-log-list { max-height: 330px; overflow-y: auto; }
.event-log-item { padding: 10px 16px; border-bottom: 1px solid var(--gray-100); display: flex; align-items: center; gap: 10px; font-size: 16px; }
.event-log-item .time { font-weight: 800; color: var(--gray-400); min-width: 40px; font-size: 15px; }
.event-log-item .event-icon { font-size: 20px; }
.event-log-item .event-text { flex: 1; font-weight: 600; }
.event-log-item .team-color { width: 5px; height: 24px; border-radius: 3px; }

/* ========== 浮窗/弹窗（居中偏上：整体上移约 1/3 屏高） ========== */
#refOverlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: none; z-index: 100; align-items: center; justify-content: center;
  padding: 20px 20px 34vh;
}
#refOverlay.active { display: flex; }

/* 内嵌主系统时，style.css 的 #refereeModule.active > * { position:relative; z-index:1 }
   特异性(1,1,0)会覆盖本文件 #refOverlay(1,0,0) 的 fixed 定位，导致弹窗掉到页面文档流底部。
   用更高特异性规则强制恢复全屏覆盖。 */
#refereeModule #refOverlay,
#refereeModule.active #refOverlay {
  position: fixed; z-index: 100;
}
#refereeModule #refToastContainer,
#refereeModule.active #refToastContainer {
  position: fixed; z-index: 200;
}

.sheet {
  background: #fff; border-radius: 20px; width: 100%; max-width: 900px;
  max-height: 62vh; overflow-y: auto; animation: popIn .25s ease;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
@keyframes popIn {
  from { transform: scale(.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.sheet-header {
  padding: 18px 22px; border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: #fff; z-index: 1;
}
.sheet-header h3 { font-size: 22px; font-weight: 800; }
.sheet-close {
  width: 40px; height: 40px; border-radius: 50%; border: none;
  background: var(--gray-100); font-size: 22px; cursor: pointer; color: var(--gray-500);
}
.sheet-body { padding: 18px 22px 28px; }

/* 球员选择列表 */
.player-select-list { display: flex; flex-direction: column; gap: 10px; }
.player-select-item {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px;
  border: 2px solid var(--gray-200); border-radius: var(--radius); cursor: pointer;
  transition: all .15s;
}
.player-select-item:active { border-color: var(--primary); }
.player-select-item.selected { border-color: var(--green); background: var(--green-light); }
.player-select-item .avatar {
  width: 50px; height: 50px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 20px; font-weight: 800; color: #fff;
}
.player-select-item .info { flex: 1; }
.player-select-item .info .name { font-size: 19px; font-weight: 700; }
.player-select-item .info .meta { font-size: 15px; color: var(--gray-400); font-weight: 600; }
.player-select-item .check { font-size: 26px; color: var(--green); }

/* 换人浮窗 */
.sub-sheet .sub-container { display: flex; gap: 14px; }
.sub-col { flex: 1; }
.sub-col-title { font-size: 17px; font-weight: 800; color: var(--gray-500); margin-bottom: 10px; text-align: center; }
.sub-col-title.on { color: var(--green); }
.sub-col-title.off { color: var(--orange); }
.sub-player-card {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 2px solid var(--gray-200); border-radius: 12px; margin-bottom: 8px; cursor: pointer;
}
.sub-player-card.selected { border-color: var(--primary); background: var(--primary-light); }
.sub-player-card .avatar { width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 800; color: #fff; }
.sub-player-card .name { font-size: 17px; font-weight: 700; }
.sub-player-card .num { font-size: 13px; color: var(--gray-400); font-weight: 600; }

/* 道具浮窗 */
.item-sheet .item-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.item-card {
  background: var(--gray-50); border: 2px solid var(--gray-200); border-radius: var(--radius);
  padding: 16px; text-align: center; cursor: pointer; transition: all .15s;
}
.item-card:active { transform: scale(.97); }
.item-card.used { opacity: .3; pointer-events: none; }
.item-card.disabled { opacity: .5; pointer-events: none; }
.item-card .icon { font-size: 38px; }
.item-card .name { font-size: 17px; font-weight: 800; margin-top: 6px; }
.item-card .desc { font-size: 14px; color: var(--gray-400); margin-top: 3px; font-weight: 500; }
.item-card .count { font-size: 14px; color: var(--primary); font-weight: 700; }
.item-card .used-tag { font-size: 11px; color: var(--red); font-weight: 700; margin-top: 3px; }

/* 红黄牌浮窗 */
.card-options { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; }
.card-sheet .card-options { display: flex; gap: 20px; justify-content: center; }
.card-option {
  flex: 1; max-width: 240px; background: var(--gray-50); border: 2px solid var(--gray-200);
  border-radius: var(--radius); padding: 28px 20px; text-align: center; cursor: pointer;
  min-height: 130px; display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.card-option:active { transform: scale(.97); }
.card-option .card-icon { font-size: 52px; }
.card-option .card-label { font-size: 18px; font-weight: 800; margin-top: 8px; }

/* ========== 屏幕四：赛后评分 ========== */
.scoring-screen { padding: 20px 16px; }

.scoring-header {
  background: var(--gray-900); color: #fff; border-radius: var(--radius);
  padding: 18px 22px; margin-bottom: 20px; text-align: center;
}
.scoring-header .final-score {
  font-size: 56px; font-weight: 900; font-family: "SF Mono", "Cascadia Code", monospace; margin: 10px 0;
}
.scoring-header .teams-row { display: flex; align-items: center; justify-content: center; gap: 20px; }
.scoring-header .team-block { text-align: center; }
.scoring-header .team-block .logo { font-size: 44px; }
.scoring-header .team-block .name { font-size: 15px; opacity: .85; font-weight: 700; }

.score-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.score-column { background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.score-column-header { padding: 12px 14px; font-size: 18px; font-weight: 800; text-align: center; border-bottom: 1px solid var(--gray-200); }
.score-column-header.home { background: var(--primary-light); color: var(--primary); }
.score-column-header.away { background: var(--orange-light); color: var(--orange); }

.player-score-card {
  padding: 10px 12px; border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; gap: 10px;
}
.player-score-card .avatar {
  width: 42px; height: 42px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 17px; font-weight: 800; color: #fff;
}
.player-score-card .info { flex: 1; min-width: 0; }
.player-score-card .info .name { font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-score-card .info .pos { font-size: 13px; color: var(--gray-400); font-weight: 600; }
.player-score-card .score-val {
  font-size: 22px; font-weight: 900; font-family: "SF Mono", monospace;
  min-width: 48px; text-align: right;
}
.score-val.green { color: var(--green); }
.score-val.blue { color: var(--primary); }
.score-val.gray { color: var(--gray-400); }
.score-val.red { color: var(--red); }

.match-summary {
  background: #fff; border-radius: var(--radius); margin-top: 20px;
  padding: 18px; box-shadow: var(--shadow-sm);
}
.match-summary h4 { font-size: 18px; font-weight: 800; margin-bottom: 12px; color: var(--gray-600); }
.summary-row { display: flex; justify-content: space-between; font-size: 16px; padding: 5px 0; }
.summary-row .label { color: var(--gray-500); font-weight: 600; }
.summary-row .value { font-weight: 700; }

/* ========== 屏幕五：数据总览 ========== */
.overview-screen { padding: 20px 16px; }
.overview-hero {
  background: linear-gradient(135deg, var(--green), #059669); color: #fff;
  border-radius: var(--radius-lg); padding: 36px 24px; text-align: center; margin-bottom: 20px;
}
.overview-hero .check { font-size: 56px; }
.overview-hero h2 { font-size: 24px; margin: 10px 0 6px; font-weight: 800; }
.overview-hero p { font-size: 15px; opacity: .85; font-weight: 500; }

.overview-section {
  background: #fff; border-radius: var(--radius); margin-bottom: 14px;
  padding: 18px; box-shadow: var(--shadow-sm);
}
.overview-section h4 { font-size: 18px; font-weight: 800; margin-bottom: 12px; color: var(--gray-600); }

.overview-stat-row { display: flex; gap: 14px; }
.overview-stat { flex: 1; background: var(--gray-50); border-radius: 10px; padding: 14px; text-align: center; }
.overview-stat .num { font-size: 28px; font-weight: 900; font-family: "SF Mono", monospace; }
.overview-stat .lbl { font-size: 14px; color: var(--gray-400); margin-top: 3px; font-weight: 600; }

/* ========== Toast ========== */
#refToastContainer {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
  background: #fff; color: #1a1a1a; padding: 14px 24px; border-radius: 12px;
  font-size: 17px; font-weight: 700; box-shadow: 0 4px 20px rgba(0,0,0,.15);
  animation: toastIn .3s ease, toastOut .3s ease 2s forwards;
  border-left: 4px solid var(--gray-400);
  display: flex; align-items: center; gap: 8px;
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.warning { border-left-color: var(--orange); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-20px); } }

/* ========== 辅助 ========== */
.pos-GK { background: #facc15; color: #78350f; }
.pos-DF { background: #3b82f6; }
.pos-MF { background: #10b981; }
.pos-FW { background: #ef4444; }

.empty-state { text-align: center; padding: 48px 24px; color: var(--gray-400); }
.empty-state .icon { font-size: 56px; margin-bottom: 10px; }
.empty-state .text { font-size: 16px; font-weight: 600; }

.divider { height: 1px; background: var(--gray-200); margin: 14px 0; }

/* 滚动条 */
#refereeModule ::-webkit-scrollbar { width: 4px; }
#refereeModule ::-webkit-scrollbar-track { background: transparent; }
#refereeModule ::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 2px; }

/* ========== 事件记录球队字段 ========== */
.event-log-item .event-team {
  font-size: 13px; font-weight: 700; white-space: nowrap;
  padding: 3px 8px; border-radius: 6px; background: var(--gray-100);
}
.event-log-item .event-text { flex: 1; font-size: 14px; font-weight: 600; }

/* 事件删除按钮 */
.event-del-btn {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
  border: none; background: transparent; color: var(--gray-300);
  font-size: 16px; cursor: pointer; display: flex; align-items: center;
  justify-content: center; transition: all .15s;
}
.event-del-btn:hover { background: var(--red-light); color: var(--red); }
.event-del-btn:active { transform: scale(.9); }

/* ========== 比赛时长设置 ========== */
.duration-setting {
  background: #fff; border-radius: var(--radius); padding: 16px;
  margin: 0 0 14px; box-shadow: var(--shadow-sm);
}
.duration-setting .ds-label {
  font-size: 17px; font-weight: 800; margin-bottom: 10px; color: var(--gray-600);
}
.duration-setting .ds-options {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px;
}
.duration-setting .ds-opt {
  padding: 8px 16px; border-radius: 20px; border: 2px solid var(--gray-200);
  background: #fff; font-size: 16px; font-weight: 700; color: var(--gray-500);
  cursor: pointer; transition: all .2s;
}
.duration-setting .ds-opt.active {
  border-color: var(--green); background: var(--green-light); color: var(--green);
}
.duration-setting .ds-hint {
  font-size: 13px; color: var(--gray-400); margin-top: 6px; font-weight: 500;
}

/* ========== 评分规则面板 ========== */
.score-rules-panel {
  border: 1px solid var(--gray-200); border-radius: 10px; overflow: hidden;
}
.score-rules-panel summary {
  list-style: none; cursor: pointer; user-select: none;
  padding: 12px 16px; font-size: 15px; font-weight: 700; color: var(--gray-600);
}
.score-rules-panel summary::-webkit-details-marker { display: none; }
.score-rules-panel table {
  width: 100%; border-collapse: collapse;
}
.score-rules-panel table th {
  background: var(--gray-50); padding: 8px 10px; font-size: 13px; text-align: left;
  border-bottom: 1px solid var(--gray-200); color: var(--gray-500); font-weight: 700;
}
.score-rules-panel table td {
  padding: 8px 10px; font-size: 13px; border-bottom: 1px solid var(--gray-100); font-weight: 600;
}

/* ========== 生效道具徽章 ========== */
.active-items {
  display: flex; flex-direction: column; gap: 5px; margin-bottom: 5px;
}
.active-item-badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: linear-gradient(135deg, #7c3aed, #9333ea);
  color: #fff; padding: 4px 10px; border-radius: 12px;
  font-size: 12px; font-weight: 700; cursor: pointer;
  box-shadow: 0 2px 6px rgba(124,58,237,.35);
  transition: all .15s; white-space: nowrap;
  animation: itemGlow 2s ease-in-out infinite;
}
.active-item-badge:active { transform: scale(.93); }
.active-item-badge .ai-icon { font-size: 14px; }
.active-item-badge .ai-name { font-size: 11px; }
@keyframes itemGlow {
  0%,100% { box-shadow: 0 2px 6px rgba(124,58,237,.35); }
  50% { box-shadow: 0 2px 12px rgba(124,58,237,.6); }
}

/* 比分面板适配道具显示 */
.score-board .home-side { flex-direction: column; align-items: center; }
.score-board .away-side { flex-direction: column; align-items: center; }

/* ========== 禁用球员样式（红牌/减员卡） ========== */
.player-select-item.player-disabled {
  opacity: .35; pointer-events: none; filter: grayscale(100%);
  position: relative;
}
.sub-player-card.player-disabled {
  opacity: .35; pointer-events: none; filter: grayscale(100%);
}
.player-score-card.red-carded {
  opacity: .6; background: var(--red-light);
}
.player-score-card.red-carded .avatar {
  filter: grayscale(50%);
}

/* ========== 道具确认弹窗 ========== */
.item-finish-sheet .item-preview {
  display: inline-flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 20px; background: var(--gray-50); border-radius: 12px; margin-bottom: 16px;
  min-width: 200px;
}

/* ========== 额外球员位置标识 ========== */
.pos-EX { background: #7c3aed !important; }

/* ========== 道具卡片使用中状态 ========== */
.item-card.used {
  opacity: .5; pointer-events: none;
  border-color: #7c3aed; background: #f3e8ff;
}
.item-card.used .used-tag {
  font-size: 11px; color: #7c3aed; font-weight: 700; margin-top: 3px;
}

/* ========== 道具已消耗/已禁用状态 ========== */
.item-card.consumed {
  opacity: .3; pointer-events: none; filter: grayscale(100%);
  border-color: var(--gray-300); background: var(--gray-100);
}
.item-card.consumed .consumed-tag {
  font-size: 11px; color: var(--gray-500); font-weight: 700; margin-top: 3px;
}
.item-card.disabled {
  opacity: .35; pointer-events: none; filter: grayscale(80%);
}
.item-card.disabled .disabled-tag {
  font-size: 11px; color: var(--gray-400); font-weight: 700; margin-top: 3px;
}

/* ========== 球衣颜色选择按钮 ========== */
.jersey-color-btn {
  margin-left: auto; padding: clamp(10px, 2vw, 22px) clamp(18px, 4vw, 44px); border-radius: 18px;
  border: 3px solid var(--gray-200); background: var(--gray-50);
  cursor: pointer; display: flex; align-items: center; gap: 10px;
  transition: all .15s; flex-shrink: 0;
}
.jersey-color-btn:active { transform: scale(.95); }
.jersey-color-btn > span { font-size: clamp(20px, 4vw, 40px) !important; color: var(--gray-400); font-weight: 700; }
.jersey-color-preview {
  width: clamp(48px, 10vw, 84px); height: clamp(48px, 10vw, 84px); border-radius: 14px;
}

/* ========== 球衣颜色选择面板 ========== */
.jersey-color-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px;
  padding: 10px 0;
}
.jersey-color-option {
  width: 100%; aspect-ratio: 1; border-radius: 10px; cursor: pointer;
  transition: all .15s; border: 3px solid transparent;
}
.jersey-color-option:active { transform: scale(.9); }
.jersey-color-option.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(26,86,219,.2);
  transform: scale(1.1);
}

/* ========== 比赛界面球衣颜色标识 ========== */
.jersey-tag {
  display: inline-block; width: 16px; height: 16px;
  border-radius: 4px; vertical-align: middle;
  margin-right: 5px;
}

/* 比分面板球队内部容器（logo+球衣颜色并排） */
.score-team-inner {
  display: flex; align-items: center; justify-content: center; gap: 10px;
}

/* 比分面板大号球衣颜色标识（与LOGO尺寸匹配） */
.jersey-tag-large {
  width: 52px; height: 52px; border-radius: 10px;
  flex-shrink: 0;
}

/* 结算页面球衣颜色标识 */
.jersey-tag-scoring {
  width: 40px; height: 40px; border-radius: 8px;
  flex-shrink: 0; display: inline-block; vertical-align: middle;
}

/* 结算页面球队块布局 */
.scoring-header .teams-row .home-team-block,
.scoring-header .teams-row .away-team-block {
  text-align: center;
}
.scoring-header .teams-row .team-logo-row {
  display: flex; align-items: center; justify-content: center; gap: 12px;
}
.scoring-header .teams-row .home-team-block .logo,
.scoring-header .teams-row .away-team-block .logo {
  font-size: 44px;
}
.scoring-header .teams-row .home-team-block .name,
.scoring-header .teams-row .away-team-block .name {
  font-size: 15px; opacity: .85; margin-top: 5px; font-weight: 700;
}

/* ========== 结算界面进球记录（分列LOGO两侧） ========== */
.scoring-header .teams-with-goals {
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.scoring-header .goals-col {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px;
}
.scoring-header .home-goals-col { align-items: flex-end; }
.scoring-header .away-goals-col { align-items: flex-start; }
.scoring-header .teams-with-goals .teams-row {
  flex-shrink: 0; gap: 14px;
}
.scoring-header .goals-empty {
  font-size: 15px; color: rgba(255,255,255,.25); padding: 10px 5px; font-weight: 600;
}
.scoring-header .goal-record-item {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 10px; background: rgba(255,255,255,.12);
  border-radius: 8px; font-size: 14px; color: rgba(255,255,255,.9);
  border-bottom: none; font-weight: 600;
}
.scoring-header .goal-record-item .goal-player-name {
  font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 110px;
}
.scoring-header .goal-record-item .goal-time {
  font-weight: 900; font-family: "SF Mono", "Cascadia Code", monospace;
  color: rgba(255,255,255,.55); font-size: 12px; white-space: nowrap;
}
.scoring-header .goal-record-item .goal-og-tag {
  font-size: 11px; color: var(--orange); font-weight: 600; margin-left: 0;
}
.scoring-header .goal-record-item .goal-x2-badge {
  background: linear-gradient(135deg, #7c3aed, #9333ea);
  color: #fff; font-size: 11px; font-weight: 900;
  padding: 2px 6px; border-radius: 5px; letter-spacing: .5px;
  white-space: nowrap; flex-shrink: 0;
  box-shadow: none;
}

/* 评分位置变更标识 */
.player-score-card .info .pos.pos-changed {
  color: var(--orange); font-weight: 800;
}

/* 球队选择按钮（球衣颜色背景） */
.card-option.team-select-btn {
  position: relative; overflow: hidden;
  min-height: 150px; max-width: 260px;
}
.card-option.team-select-btn .card-icon {
  position: relative; z-index: 1;
  font-size: 56px;
}
.card-option.team-select-btn .card-label {
  position: relative; z-index: 1;
  text-shadow: 0 1px 3px rgba(0,0,0,.3);
  font-weight: 800;
  font-size: 19px;
}

/* ========== 事件记录球衣颜色标识 ========== */
.event-jersey-tag {
  display: inline-block; width: 12px; height: 12px;
  border-radius: 3px; vertical-align: middle;
  margin-right: 4px;
}

/* ========== 球衣号码徽章（裁判系统内嵌模块，字号大于主系统） ========== */
/* 号码数字不带任何边框/描边（全站统一：纯数字无黑框） */
#refereeModule .jersey-no, .jersey-no {
  display: inline-block;
  min-width: 40px;
  padding: 2px 10px;
  margin-right: 8px;
  border-radius: 10px;
  background: rgba(255,255,255,.92);
  color: #1e293b;
  font-weight: 800;
  font-size: 17px;
  line-height: 1.6;
  text-align: center;
  vertical-align: middle;
  border: none;
  outline: none;
  box-shadow: none;
}
/* 场上位置圆圈下方的号码徽章缩小适配 */
.position-slot .jersey-no {
  min-width: 30px;
  padding: 0 6px;
  margin-right: 0;
  margin-bottom: 1px;
  font-size: 13px;
  border-radius: 7px;
}
