/* ==================================================================
   无人机足球 · 记分系统  |  蓝白主题
   ================================================================== */

:root {
  --blue-900: #0b2b5c;
  --blue-800: #103c7c;
  --blue-700: #14509a;
  --blue-600: #1a68c9;
  --blue-500: #2f86ee;
  --blue-300: #9cc7ff;
  --blue-100: #e2efff;
  --blue-50: #f1f7ff;
  --ink: #0c2340;
  --ink-2: #3c5877;
  --muted: #7b91ad;
  --line: #dae6f6;
  --red-600: #d93a3a;
  --red-500: #e94b4b;
  --white: #ffffff;
  --radius: 22px;
  --shadow: 0 18px 40px -28px rgba(12, 44, 92, 0.55);
}

* { box-sizing: border-box; }

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

body {
  min-height: 100vh;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(1200px 520px at 12% -10%, #d8e9ff 0%, rgba(216, 233, 255, 0) 62%),
    radial-gradient(900px 500px at 96% 0%, #e6f1ff 0%, rgba(230, 241, 255, 0) 55%),
    linear-gradient(180deg, #f5f9ff 0%, #eaf3ff 100%);
  background-attachment: fixed;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

.app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px clamp(12px, 2.4vw, 26px) 26px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100vh;
}

/* ---------------- 顶栏 ---------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: linear-gradient(145deg, var(--blue-500), var(--blue-700));
  box-shadow: 0 10px 22px -12px rgba(26, 104, 201, 0.9);
  position: relative;
  flex: none;
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 11px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
}

.brand-mark::before {
  content: "";
  position: absolute;
  inset: 17px;
  background: #fff;
  border-radius: 50%;
}

.brand-text h1 {
  margin: 0;
  font-size: clamp(16px, 1.6vw, 20px);
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--blue-900);
}

.brand-text p {
  margin: 2px 0 0;
  font-size: 11px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mode-switch {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  background: #e8f1ff;
  border: 1px solid #d6e5fa;
  border-radius: 14px;
}

.mode-switch button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s, color 0.16s, box-shadow 0.16s;
}

.mode-switch button.on {
  background: #fff;
  color: var(--blue-700);
  box-shadow: 0 4px 12px -6px rgba(20, 80, 154, 0.55);
}

.icon-btn {
  appearance: none;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--blue-700);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 14px;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.16s, background 0.16s;
}

.icon-btn:hover { border-color: var(--blue-300); }
.icon-btn:active { transform: scale(0.97); }
.icon-btn.on {
  background: var(--blue-600);
  border-color: var(--blue-600);
  color: #fff;
}

/* 二级菜单 */
.more-wrap { position: relative; }

.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 212px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 24px 46px -26px rgba(12, 44, 92, 0.65);
  z-index: 60;
}

.menu[hidden] { display: none; }

.menu-item {
  appearance: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 10px;
  padding: 9px 11px;
  cursor: pointer;
}

.menu-item:hover { background: #f2f7ff; }
.menu-item small { font-size: 11px; font-weight: 400; color: var(--muted); }
a.menu-item { text-decoration: none; }
.menu-item.danger { color: var(--red-600); }
.menu-item.danger:hover { background: #fff2f2; }

/* ---------------- 主看板 ---------------- */
.board {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(300px, 1.1fr) minmax(200px, 1fr);
  grid-template-areas: "red timer blue";
  gap: clamp(10px, 1.4vw, 18px);
  align-items: stretch;
  flex: 1;
}

.board > .team-red { grid-area: red; }
.board > .timer-card { grid-area: timer; }
.board > .team-blue { grid-area: blue; }

/* 互换方位：只换位置，比分和队名跟着各自的队伍走 */
body.swapped .board { grid-template-areas: "blue timer red"; }

.team {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: clamp(14px, 1.8vw, 24px);
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid rgba(20, 70, 140, 0.08);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.team::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 6px;
}

.team-red::before { background: linear-gradient(90deg, #f06a6a, var(--red-600)); }
.team-blue::before { background: linear-gradient(90deg, var(--blue-500), var(--blue-700)); }

.team-red { background: linear-gradient(180deg, #fff 0%, #fff7f7 100%); }
.team-blue { background: linear-gradient(180deg, #fff 0%, #f3f9ff 100%); }

.team-head {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.team-tag {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2.4px;
  padding: 4px 10px;
  border-radius: 999px;
}

.team-red .team-tag { color: var(--red-600); background: #ffeded; }
.team-blue .team-tag { color: var(--blue-700); background: var(--blue-100); }

.team-name {
  width: 100%;
  text-align: center;
  font-family: inherit;
  font-size: clamp(17px, 1.9vw, 24px);
  font-weight: 800;
  color: var(--ink);
  background: transparent;
  border: 1px dashed transparent;
  border-radius: 10px;
  padding: 4px 6px;
  transition: border-color 0.16s, background 0.16s;
}

.team-name:hover { border-color: var(--line); }
.team-name:focus {
  outline: none;
  border-color: var(--blue-300);
  background: #fff;
}

.score {
  font-size: clamp(72px, 11vw, 156px);
  line-height: 0.92;
  font-weight: 800;
  letter-spacing: -3px;
  color: var(--blue-900);
  font-variant-numeric: tabular-nums;
  margin: 2px 0;
  text-shadow: 0 12px 26px rgba(20, 80, 154, 0.12);
}

.team-red .score { color: #b32424; }

.score-actions {
  width: 100%;
  display: flex;
  gap: 8px;
}

.btn-plus {
  flex: 1;
  appearance: none;
  border: 0;
  border-radius: 16px;
  color: #fff;
  font-family: inherit;
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 800;
  height: clamp(64px, 8vh, 88px);
  cursor: pointer;
  box-shadow: 0 14px 28px -18px rgba(12, 44, 92, 0.8);
  transition: transform 0.1s, filter 0.16s;
  user-select: none;
}

.btn-plus.red { background: linear-gradient(160deg, #f26a6a, var(--red-600)); }
.btn-plus.blue { background: linear-gradient(160deg, #3d92f2, var(--blue-700)); }
.btn-plus:active { transform: scale(0.97); filter: brightness(0.95); }

.btn-minus {
  width: 62px;
  flex: none;
  appearance: none;
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink-2);
  background: #eef4fd;
  border: 1px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
  transition: background 0.16s, transform 0.1s;
}

.btn-minus:active { transform: scale(0.96); background: #e3edfb; }

/* ---------------- 计时卡 ---------------- */
.timer-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: clamp(16px, 2vw, 26px) clamp(14px, 1.8vw, 24px);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff 0%, #f4f9ff 100%);
  border: 1px solid #dbe9fb;
  box-shadow: 0 24px 50px -34px rgba(12, 44, 92, 0.7);
  position: relative;
  overflow: hidden;
}

.timer-card::after {
  content: "";
  position: absolute;
  width: 320px;
  height: 320px;
  right: -120px;
  top: -140px;
  background: radial-gradient(circle, rgba(47, 134, 238, 0.14), rgba(47, 134, 238, 0) 68%);
  pointer-events: none;
}

.phase-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 1;
}

.phase-name {
  font-size: clamp(15px, 1.5vw, 19px);
  font-weight: 800;
  color: var(--blue-700);
  letter-spacing: 1px;
}

.phase-tip {
  font-size: 11px;
  color: var(--muted);
}

.clock {
  font-size: clamp(62px, 8.4vw, 126px);
  line-height: 1;
  font-weight: 800;
  letter-spacing: -3px;
  color: var(--blue-900);
  font-variant-numeric: tabular-nums;
  transition: color 0.2s;
  z-index: 1;
  max-width: 100%;
  white-space: nowrap;
  cursor: pointer;
  border-radius: 14px;
  padding: 2px 10px;
  user-select: none;
}

.clock:hover { background: rgba(47, 134, 238, 0.08); }
.clock:active { background: rgba(47, 134, 238, 0.14); }

.clock-hint {
  margin: -4px 0 2px;
  font-size: 11px;
  color: var(--muted);
  z-index: 1;
}

.clock.warn {
  color: var(--red-500);
  animation: pulse 1s ease-in-out infinite;
}

.clock.done { color: var(--red-600); }

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

.phase-dots {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  z-index: 1;
}

.dot {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #eef4fd;
  color: var(--muted);
  font-size: 11px;
  border: 1px solid transparent;
  transition: all 0.18s;
}

.dot b { font-weight: 700; font-size: 12px; }
.dot i { font-style: normal; font-size: 10px; opacity: 0.8; }

.dot.on {
  background: var(--blue-600);
  color: #fff;
  border-color: var(--blue-600);
  box-shadow: 0 8px 16px -12px rgba(26, 104, 201, 0.95);
}

.dot.past {
  background: #e6f0ff;
  color: var(--blue-600);
  border-color: #cfe2fa;
}

.timer-actions {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
  z-index: 1;
}

.btn-primary {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(160deg, var(--blue-500), var(--blue-700));
  border-radius: 14px;
  padding: 13px 22px;
  box-shadow: 0 16px 30px -20px rgba(20, 80, 154, 0.95);
  transition: transform 0.1s, filter 0.16s;
}

.btn-primary:active { transform: scale(0.98); }
.btn-primary.paused { background: linear-gradient(160deg, #55a2f0, var(--blue-600)); }
.btn-primary.small { font-size: 13px; padding: 9px 14px; border-radius: 12px; }
.btn-primary.danger { background: linear-gradient(160deg, #f26a6a, #c92f2f); }

.timer-actions .btn-primary { flex: 1.2; }

.btn-ghost {
  appearance: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--blue-700);
  background: #eef5ff;
  border: 1px solid #d7e7fb;
  border-radius: 14px;
  padding: 12px 16px;
  transition: background 0.16s, transform 0.1s;
}

.btn-ghost:hover { background: #e3eeff; }
.btn-ghost:active { transform: scale(0.98); }

.timer-actions .btn-ghost { flex: 1; }

.link-btn {
  appearance: none;
  background: none;
  border: 0;
  padding: 2px;
  font-family: inherit;
  font-size: 12px;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  z-index: 1;
}

.link-btn:hover { color: var(--blue-600); }

.local-hint {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  z-index: 1;
}

.dot-live {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c3d3e6;
  transition: background 0.2s;
}

.dot-live.on {
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.16);
}

/* ---------------- 对阵（当前场 / 下一场） ---------------- */
.vs-panel {
  background: #fff;
  border: 1px solid rgba(20, 70, 140, 0.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(14px, 1.8vw, 20px);
}

.vs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.vs-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.vs-title h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--blue-900);
  letter-spacing: 0.5px;
}

.vs-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vs-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  background: linear-gradient(160deg, var(--blue-500), var(--blue-700));
  border-radius: 12px;
  padding: 9px 14px;
  box-shadow: 0 14px 26px -20px rgba(20, 80, 154, 0.95);
  transition: filter 0.16s, transform 0.1s;
}

.vs-open:hover { filter: brightness(1.06); }
.vs-open:active { transform: scale(0.98); }

.vs-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: stretch;
}

.vs-cards.single { grid-template-columns: 1fr; }

.vs-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 13px 15px 12px;
  border-radius: 16px;
  background: #f8fbff;
  border: 1px solid var(--line);
  min-width: 0;
}

.vs-card[hidden] { display: none; }

.vs-card.now {
  background: linear-gradient(160deg, #eef6ff, #fbfdff);
  border-color: #bcd8fb;
  box-shadow: inset 0 0 0 1px rgba(47, 134, 238, 0.18);
}

.vs-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vs-role {
  flex: none;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #fff;
  background: var(--blue-600);
  border-radius: 999px;
  padding: 3px 9px;
}

.vs-card.next .vs-role { background: #a8bfd9; }

.vs-round {
  font-size: 12px;
  font-weight: 800;
  color: var(--blue-700);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vs-badge {
  margin-left: auto;
  flex: none;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--blue-700);
}

.vs-badge.live { background: #e8f7ee; color: #16803f; }
.vs-badge.done { background: #eef3fa; color: #6d86a6; }
.vs-badge.tbd { background: #f2f5f9; color: #8b9bb1; }

.vs-pair {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vs-team {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  border-radius: 11px;
  background: #fff;
  border: 1px solid #e7eff9;
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
}

.vs-team .dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.vs-team.a .dot { background: var(--red-500); }
.vs-team.b .dot { background: var(--blue-600); }

.vs-team .nm {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vs-team .sc {
  flex: none;
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.vs-team.win {
  background: linear-gradient(90deg, #e8f3ff, #f9fcff);
  border-color: #cfe2fa;
  color: var(--blue-800);
}

.vs-team.win .sc { color: var(--blue-700); }
.vs-team.tbd .nm { color: #a9b7c9; font-weight: 600; }

.vs-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  flex-wrap: wrap;
}

.vs-note {
  flex: 1;
  min-width: 96px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
}

.vs-load {
  appearance: none;
  flex: none;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  background: var(--blue-600);
  border: 0;
  border-radius: 10px;
  padding: 7px 12px;
  cursor: pointer;
  transition: background 0.16s, transform 0.1s;
}

.vs-load:hover { background: var(--blue-700); }
.vs-load:active { transform: scale(0.97); }
.vs-load.ghost { color: var(--blue-700); background: #fff; border: 1px solid #d7e6fa; }
.vs-load.ghost:hover { background: #f1f7ff; }

.vs-empty {
  margin: 0;
  font-size: 13px;
  line-height: 1.8;
  color: var(--ink-2);
}

/* ---------------- 对战列表 ---------------- */
.matches {
  background: #fff;
  border: 1px solid rgba(20, 70, 140, 0.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(14px, 1.8vw, 20px);
}

.matches-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.matches-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.matches-title h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--blue-900);
  letter-spacing: 0.5px;
}

.muted { color: var(--muted); font-size: 12px; }

.matches-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.match-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.match-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: #f8fbff;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform 0.14s, border-color 0.16s, box-shadow 0.16s, background 0.16s;
  flex-wrap: wrap;
}

.match-card:hover {
  transform: translateY(-2px);
  border-color: var(--blue-300);
  box-shadow: 0 14px 26px -22px rgba(20, 80, 154, 0.9);
}

.match-card:focus-visible {
  outline: 2px solid var(--blue-500);
  outline-offset: 2px;
}

.match-card.active {
  background: linear-gradient(160deg, #eaf3ff, #f7fbff);
  border-color: var(--blue-500);
  box-shadow: inset 0 0 0 1px var(--blue-500);
}

.mc-no {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 9px;
  background: #e7f0fe;
  color: var(--blue-700);
  font-size: 12px;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.match-card.active .mc-no {
  background: var(--blue-600);
  color: #fff;
}

.mc-teams {
  flex: 1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  min-width: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
}

.mc-teams b {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.mc-teams .r { color: #c03232; }
.mc-teams .b { color: var(--blue-700); }

.mc-teams .vs {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--muted);
  flex: none;
}

.mc-state {
  font-size: 11px;
  color: var(--muted);
  flex: none;
  margin-left: auto;
}

.match-card.active .mc-state {
  color: var(--blue-600);
  font-weight: 700;
}

.mc-acts {
  flex-basis: 100%;
  display: flex;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px dashed #e2ecfa;
}

.mc-acts button {
  appearance: none;
  font-family: inherit;
  font-size: 12px;
  color: var(--blue-700);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 5px 10px;
  cursor: pointer;
}

.mc-acts button.danger { color: var(--red-600); border-color: #f6d5d5; }
.mc-acts button:active { transform: scale(0.96); }

.empty {
  grid-column: 1 / -1;
  padding: 26px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.9;
}

.empty.error { color: var(--red-600); }

.list-hint {
  margin: 12px 2px 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.7;
}

/* ---------------- 页脚 ---------------- */
.foot {
  text-align: center;
  font-size: 11px;
  color: #93a8c2;
  padding: 2px 0 6px;
}

.foot a { color: inherit; text-decoration: none; }
.foot a:hover { text-decoration: underline; }
.foot-ver { margin-left: 8px; opacity: .55; letter-spacing: .3px; }

/* ---------------- 赛事管理 ---------------- */
.event-btn { font-weight: 700; }
.ev-modal { width: min(460px, calc(100vw - 28px)); }
.ev-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  margin: 4px 0 10px;
}
.ev-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.ev-item:hover { border-color: #9fc3ec; }
.ev-item.on {
  border-color: var(--blue-600, #2563eb);
  background: linear-gradient(180deg, #f3f8ff, #eaf3ff);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .12);
}
.ev-name { font-weight: 800; color: #13315c; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-meta { font-size: 11px; color: #8fa3bc; flex: none; }
.ev-cur {
  flex: none;
  font-size: 10px;
  font-weight: 700;
  color: #1d7a46;
  background: #e2f7ea;
  border-radius: 999px;
  padding: 2px 8px;
}
.ev-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.ev-export {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f2f7ff;
  border: 1px solid #dbe9fb;
}
.ev-export-title { font-size: 12px; font-weight: 700; color: #4a6491; flex: 1; }
.ev-export-btns { display: flex; gap: 8px; }
.ev-select {
  appearance: none;
  -webkit-appearance: none;
  max-width: 150px;
  padding: 0 24px 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235a7392' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 10px center;
  font: 700 12px/2.2 inherit;
  font-family: inherit;
  color: #13315c;
  cursor: pointer;
}
@media (max-width: 720px) {
  #btnEventName { max-width: 72px; display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
}

/* ---------------- 弹窗 ---------------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 30, 60, 0.42);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 50;
}

.overlay[hidden] { display: none; }

.modal {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 22px;
  padding: 22px;
  box-shadow: 0 30px 70px -30px rgba(6, 26, 55, 0.8);
  animation: pop 0.18s ease-out;
}

@keyframes pop {
  from { transform: translateY(10px) scale(0.98); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.modal h3 {
  margin: 0 0 6px;
  font-size: 18px;
  color: var(--blue-900);
}

.modal-desc {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-2);
}

.modal-desc[hidden] { display: none; }

.modal-body { display: flex; flex-direction: column; gap: 6px; }

.m-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  margin-top: 4px;
}

.modal-body input {
  font: inherit;
  font-size: 15px;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #f9fbff;
  transition: border-color 0.16s, background 0.16s;
}

.modal-body input:focus {
  outline: none;
  border-color: var(--blue-500);
  background: #fff;
}

/* 调时弹窗 */
.te-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.modal-body .te-row input {
  width: 88px;
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  color: var(--blue-900);
  padding: 8px 6px;
}

.te-row input::-webkit-outer-spin-button,
.te-row input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.te-row input[type='number'] { -moz-appearance: textfield; appearance: textfield; }

.te-unit {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
}

.te-quick {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.te-quick button {
  flex: 1;
  min-width: 68px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--blue-700);
  background: #eef5ff;
  border: 1px solid #d7e7fb;
  border-radius: 10px;
  padding: 9px 6px;
  cursor: pointer;
}

.te-quick button:active { transform: scale(0.97); background: #e3eeff; }

.modal-err {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--red-600);
}

.modal-err[hidden] { display: none; }

/* ---------------- 计分按键设置 ---------------- */
.keycap {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.22);
  border-radius: 7px;
  padding: 2px 7px;
  pointer-events: none;
}

.keycap.light {
  top: auto;
  bottom: 6px;
  right: 6px;
  font-size: 10px;
  padding: 1px 5px;
  color: var(--blue-600);
  background: #dbe8f8;
}

.btn-plus, .btn-minus { position: relative; }

.key-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0 2px;
}

.key-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #f7fbff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 12px;
}

.kr-name { font-size: 14px; font-weight: 700; color: var(--ink-2); }
.kr-name.r { color: #c03232; }
.kr-name.b { color: var(--blue-700); }

.keycap-btn {
  min-width: 96px;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  color: var(--blue-700);
  background: #fff;
  border: 1px solid #cfe2fa;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s, color 0.16s;
}

.keycap-btn:hover { border-color: var(--blue-500); }
.keycap-btn.waiting {
  background: var(--blue-600);
  border-color: var(--blue-600);
  color: #fff;
  animation: pulse 1.1s ease-in-out infinite;
}

.m-note {
  margin: 10px 0 8px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.7;
}

.m-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-2);
  margin: 4px 0 10px;
  cursor: pointer;
}

.m-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue-600);
}

.modal-body .link-btn { align-self: flex-start; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

/* ---------------- 提示 ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 16px);
  background: rgba(12, 35, 64, 0.94);
  color: #fff;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 80;
  max-width: 86vw;
  text-align: center;
}

.toast[hidden] { display: none; }

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.warn { background: rgba(178, 38, 38, 0.95); }

/* ---------------- 投屏模式 ---------------- */
body.present .matches,
body.present .vs-panel,
body.present .foot,
body.present .phase-tip,
body.present .local-hint,
body.present .clock-hint,
body.present .list-hint {
  display: none;
}

body.present .clock { font-size: clamp(56px, 7.4vw, 112px); letter-spacing: -2px; }
body.present .score { font-size: clamp(84px, 12vw, 168px); }
body.present .timer-card { padding-left: 10px; padding-right: 10px; }
body.present .app { padding-top: 10px; gap: 12px; }
body.present .brand-text p { display: none; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 980px) {
  .board {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "timer timer"
      "red blue";
  }
  body.swapped .board {
    grid-template-areas:
      "timer timer"
      "blue red";
  }
  .score { font-size: clamp(58px, 13vw, 110px); }
  .btn-plus { height: 62px; font-size: 26px; }
  .btn-minus { width: 52px; }
}

@media (max-width: 620px) {
  .app { padding: 12px 10px 18px; gap: 12px; }
  .brand-mark { width: 34px; height: 34px; border-radius: 11px; }
  .brand-mark::after { inset: 9px; }
  .brand-mark::before { inset: 14px; }
  .topbar { gap: 8px; }
  .topbar-actions { width: 100%; justify-content: space-between; }
  .mode-switch { flex: 1; }
  .mode-switch button { flex: 1; padding: 8px 6px; font-size: 12px; }
  .icon-btn { padding: 8px 10px; font-size: 12px; }
  .team { padding: 12px 12px 14px; border-radius: 18px; }
  .team-name { font-size: 16px; }
  .score { letter-spacing: -2px; }
  .team-tag { font-size: 10px; letter-spacing: 1.6px; }
  .timer-card { padding: 14px 12px 16px; border-radius: 18px; }
  .phase-dots { gap: 4px; }
  .dot { padding: 4px 8px; }
  .dot b { font-size: 11px; }
  .timer-actions { gap: 6px; }
  .btn-primary { font-size: 15px; padding: 12px 14px; }
  .btn-ghost { font-size: 13px; padding: 11px 10px; }
  .match-list { grid-template-columns: 1fr; }
  .vs-cards { grid-template-columns: 1fr; }
  .vs-title { width: 100%; }
  .vs-tools { width: 100%; justify-content: space-between; }
  .vs-team { font-size: 15px; }
  .keycap { display: none; }
  .keycap-btn { min-width: 84px; }
}

@media (max-width: 380px) {
  .score { font-size: 54px; }
  .btn-minus { width: 46px; }
}

/* ==================================================================
   淘汰赛联动（记分板内）
   ================================================================== */
a.icon-btn { text-decoration: none; }

.bc-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 2px;
  padding: 8px 10px;
  border-radius: 14px;
  background: linear-gradient(120deg, #eef6ff, #e2eeff);
  border: 1px solid #d3e5fb;
  font-size: 12px;
  line-height: 1.4;
}

.bc-bar[hidden] { display: none; }

.bc-bar-tag {
  flex: none;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #fff;
  background: linear-gradient(140deg, var(--blue-500), var(--blue-700));
  padding: 3px 8px;
  border-radius: 999px;
}

.bc-bar-text {
  flex: 1;
  min-width: 130px;
  font-weight: 700;
  color: var(--blue-800);
}

.bc-bar-btn {
  flex: none;
  appearance: none;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--blue-600);
  border: 1px solid var(--blue-600);
  border-radius: 10px;
  padding: 7px 12px;
  cursor: pointer;
  transition: background 0.16s, transform 0.12s;
}

.bc-bar-btn:hover { background: var(--blue-700); }
.bc-bar-btn:active { transform: scale(0.97); }
.bc-bar-btn.done {
  background: #fff;
  color: var(--blue-700);
  border-color: #c9ddf8;
}

.bc-bar-link {
  flex: none;
  color: var(--blue-700);
  font-weight: 700;
  text-decoration: none;
}

.bc-bar-link:hover { text-decoration: underline; }

body.present .bc-bar { justify-content: center; font-size: 13px; }
body.present .bc-bar-btn,
body.present .bc-bar-link { display: none; }

/* 选择胜方（淘汰赛结果） */
.pick-row {
  display: flex;
  gap: 8px;
  margin: 4px 0 6px;
}

.pick-btn {
  flex: 1;
  appearance: none;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  background: #f8fbff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 8px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: border-color 0.16s, background 0.16s;
}

.pick-btn:hover { border-color: var(--blue-300); }
.pick-btn.on {
  border-color: var(--blue-600);
  background: var(--blue-100);
  color: var(--blue-800);
  box-shadow: inset 0 0 0 1px var(--blue-600);
}
