/* ============================================================
   赛事竞猜 / Pick'Em 对阵图预测工具样式
   同时兼容浅色与深色主题（html[data-theme="dark"]）
   ============================================================ */

@media (min-width: 1100px) {
  body[data-page="pickem"] {
    --content-max: clamp(1320px, 94vw, 1960px);
  }
}

.pk-page {
  --pk-canvas-bg: #eef0f4;
  --pk-canvas-line: #d6dbe4;
  --pk-card-bg: #ffffff;
  --pk-card-border: #dde2ec;
  --pk-card-tbd-bg: #f6f7fa;
  --pk-card-hover: #fff9f3;
  --pk-rail-bg: #2d333f;
  --pk-rail-text: #f8fafc;
  --pk-rail-sub: #cbd5e1;
  --pk-wire: #b6bfce;
  --pk-wire-active: #f97316;
  --pk-score-bg: #f1f4f9;
  --pk-score-fg: #334155;
  --pk-win-bg: linear-gradient(90deg, rgba(249, 115, 22, .12), rgba(249, 115, 22, .03));
  --pk-champ-bg: #2e3440;
  --pk-champ-inner: #242934;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

html[data-theme="dark"] .pk-page {
  --pk-canvas-bg: #111423;
  --pk-canvas-line: #232842;
  --pk-card-bg: #1a1f36;
  --pk-card-border: #2c3354;
  --pk-card-tbd-bg: #161a2e;
  --pk-card-hover: #212640;
  --pk-rail-bg: #0c0e1a;
  --pk-rail-text: #f1f5f9;
  --pk-rail-sub: #94a3b8;
  --pk-wire: #3c466b;
  --pk-wire-active: #fb923c;
  --pk-score-bg: #232a47;
  --pk-score-fg: #cbd5e1;
  --pk-win-bg: linear-gradient(90deg, rgba(249, 115, 22, .22), rgba(249, 115, 22, .06));
  --pk-champ-bg: #15192b;
  --pk-champ-inner: #1b2138;
}

/* ── 顶部赛事横幅区（复刻官方金橙标题栏 + 右侧信息控制栏） ── */
.pk-hero {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.pk-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: linear-gradient(108deg, #ffd13b 0%, #ffa800 55%, #f97316 100%);
  color: #1f1708;
  position: relative;
}

html[data-theme="dark"] .pk-banner {
  background: linear-gradient(108deg, #c27803 0%, #d97706 52%, #c2410c 100%);
  color: #fff7ed;
}

.pk-banner-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.pk-banner-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pk-banner-title {
  margin: 0;
  font-size: var(--fs-2xl);
  font-weight: 800;
  letter-spacing: -.01em;
  line-height: 1.2;
}

.pk-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 5px;
  background: #e11d48;
  color: #fff;
  font-size: var(--fs-2xs);
  font-weight: 800;
  letter-spacing: .04em;
  box-shadow: 0 2px 6px rgba(225, 29, 72, .32);
}

.pk-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  opacity: .92;
}

.pk-banner-sub {
  font-size: var(--fs-xs);
  font-weight: 600;
  opacity: .84;
}

.pk-banner-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.pk-banner-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, .14);
  background: rgba(255, 255, 255, .86);
  color: #1c1917;
  font-size: var(--fs-xs);
  font-weight: 700;
  transition: transform .12s ease, background-color .14s ease, box-shadow .14s ease;
}

.pk-banner-btn:hover {
  background: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, .12);
}

html[data-theme="dark"] .pk-banner-btn {
  background: rgba(15, 23, 42, .72);
  border-color: rgba(255, 255, 255, .2);
  color: #f8fafc;
}

html[data-theme="dark"] .pk-banner-btn:hover {
  background: rgba(15, 23, 42, .9);
}

/* ── 控制条（进度 + 得分 + 动作按钮） ── */
.pk-control-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 11px 16px;
  border-top: 1px solid var(--line);
}

.pk-progress-block {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.pk-progress-text {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: var(--fs-sm);
  color: var(--text-2);
}

.pk-progress-num {
  font-size: var(--fs-lg);
  font-weight: 800;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}

.pk-progress-bar {
  width: 120px;
  height: 7px;
  border-radius: 999px;
  background: var(--bg-soft);
  overflow: hidden;
  border: 1px solid var(--line);
}

.pk-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #f97316, #facc15);
  transition: width .22s ease;
}

.pk-accuracy-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(34, 197, 94, .12);
  border: 1px solid rgba(34, 197, 94, .28);
  color: #16a34a;
  font-size: var(--fs-xs);
  font-weight: 700;
}

html[data-theme="dark"] .pk-accuracy-pill {
  color: #4ade80;
}

.pk-shared-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(59, 130, 246, .12);
  border: 1px solid rgba(59, 130, 246, .28);
  color: var(--btn-accent-fg);
  font-size: var(--fs-xs);
  font-weight: 700;
}

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

.pk-btn-sm {
  height: 32px;
  padding: 0 11px;
  font-size: var(--fs-xs);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* ── 主对阵图卡片 ── */
.pk-stage-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
  overflow: hidden;
}

.pk-stage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.pk-stage-hint {
  font-size: var(--fs-xs);
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pk-stage-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pk-seg {
  display: inline-flex;
  padding: 2px;
  border-radius: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  gap: 2px;
}

.pk-seg-btn {
  border: 0;
  background: transparent;
  color: var(--text-2);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: var(--fs-xs);
  font-weight: 600;
  transition: background-color .14s ease, color .14s ease;
}

.pk-seg-btn.active {
  background: var(--bg-card);
  color: var(--brand);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

.pk-zoom-grp {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px;
}

.pk-zoom-btn {
  border: 0;
  background: transparent;
  color: var(--text-2);
  height: 26px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: var(--fs-xs);
  font-weight: 600;
}

.pk-zoom-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.pk-zoom-btn.active {
  background: var(--bg-card);
  color: var(--brand);
}

.pk-zoom-pct {
  min-width: 42px;
  text-align: center;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

/* ── 画布容器与缩放舞台 ── */
.pk-viewport {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 10px;
  background: var(--pk-canvas-bg);
  border: 1px solid var(--pk-canvas-line);
}

.pk-canvas-wrap {
  position: relative;
  margin: 0 auto;
}

.pk-canvas {
  position: relative;
  transform-origin: 0 0;
}

.pk-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.pk-wire {
  fill: none;
  stroke: var(--pk-wire);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke .18s ease, stroke-width .18s ease;
}

.pk-wire.is-active {
  stroke: var(--pk-wire-active);
  stroke-width: 2;
}

/* ── 左侧胜者组 / 败者组纵栏 ── */
.pk-rail {
  position: absolute;
  z-index: 2;
  background: var(--pk-rail-bg);
  color: var(--pk-rail-text);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  user-select: none;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .14);
}

.pk-rail-label {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 3px;
  margin: auto 0;
}

.pk-rail-count {
  font-size: 10px;
  font-weight: 700;
  color: var(--pk-rail-sub);
  border-top: 1px solid rgba(255, 255, 255, .14);
  padding-top: 6px;
  width: 100%;
  text-align: center;
}

/* ── 败者组横幅分隔标识 ── */
.pk-divider-pill {
  position: absolute;
  z-index: 2;
  background: var(--pk-rail-bg);
  color: var(--pk-rail-text);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .14);
  user-select: none;
}

.pk-divider-line {
  position: absolute;
  left: 14px;
  right: 14px;
  height: 1px;
  border-top: 1px dashed var(--pk-canvas-line);
  z-index: 1;
  pointer-events: none;
}

/* ── 比赛节点卡片（固定 180×96 几何对齐） ── */
.pk-match {
  position: absolute;
  z-index: 3;
  display: flex;
  flex-direction: column;
}

.pk-match-meta {
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 0 2px;
  font-size: 11px;
  line-height: 1;
}

.pk-match-id-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.pk-match-id {
  font-weight: 800;
  color: var(--text-2);
  font-size: 11px;
}

.pk-match.is-final .pk-match-id {
  color: var(--brand);
  font-size: 12px;
}

.pk-bo-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(100, 116, 139, .14);
  color: var(--text-2);
}

.pk-match-meta-right {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.pk-eval-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
}

.pk-eval-badge.is-exact {
  background: rgba(34, 197, 94, .18);
  color: #15803d;
}

.pk-eval-badge.is-winner {
  background: rgba(245, 158, 11, .18);
  color: #b45309;
}

.pk-eval-badge.is-miss {
  background: rgba(239, 68, 68, .15);
  color: #b91c1c;
}

html[data-theme="dark"] .pk-eval-badge.is-exact { color: #4ade80; }
html[data-theme="dark"] .pk-eval-badge.is-winner { color: #fbbf24; }
html[data-theme="dark"] .pk-eval-badge.is-miss { color: #f87171; }

.pk-match-edit {
  border: 0;
  background: transparent;
  color: var(--text-3);
  font-size: 11px;
  padding: 1px 4px;
  border-radius: 4px;
  line-height: 1.2;
}

.pk-match-edit:hover {
  background: rgba(249, 115, 22, .14);
  color: var(--brand);
}

.pk-slots {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pk-team-row {
  position: relative;
  height: 36px;
  width: 100%;
  display: flex;
  align-items: stretch;
  background: var(--pk-card-bg);
  border: 1px solid var(--pk-card-border);
  border-radius: 5px;
  overflow: hidden;
  transition: border-color .14s ease, background-color .14s ease, opacity .14s ease, box-shadow .14s ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
}

.pk-team-row.is-pickable {
  cursor: pointer;
}

.pk-team-row.is-pickable:hover {
  border-color: var(--brand);
  background: var(--pk-card-hover);
}

.pk-team-row.is-tbd {
  background: var(--pk-card-tbd-bg);
  border-style: dashed;
  cursor: default;
}

.pk-team-row.is-winner {
  border-color: var(--brand);
  background: var(--pk-win-bg);
  box-shadow: inset 3px 0 0 var(--brand), 0 2px 6px rgba(249, 115, 22, .14);
}

.pk-team-row.is-loser {
  opacity: .56;
}

.pk-team-pick-area {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 6px 0 8px;
  text-align: left;
  cursor: inherit;
}

.pk-team-logo {
  width: 21px;
  height: 21px;
  object-fit: contain;
  flex: 0 0 auto;
  border-radius: 4px;
}

html[data-theme="dark"] .pk-team-logo,
html[data-theme="dark"] .pk-champ-logo {
  background: rgba(248, 250, 252, .88);
  padding: 2px;
  border-radius: 5px;
}

.pk-team-logo.is-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #475569;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
}

.pk-champ-logo.is-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #475569;
  color: #fff;
  font-size: 16px;
  font-weight: 900;
}

.pk-monogram {
  width: 21px;
  height: 21px;
  border-radius: 4px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: -.03em;
  overflow: hidden;
  user-select: none;
}

.pk-tbd-mark {
  width: 21px;
  height: 21px;
  border-radius: 4px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(148, 163, 184, .18);
  color: var(--text-3);
  font-size: 12px;
  font-weight: 800;
}

.pk-team-label-wrap {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.pk-team-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.pk-team-row.is-tbd .pk-team-name {
  color: var(--text-3);
  font-weight: 600;
  font-size: 11.5px;
}

.pk-team-hint {
  font-size: 9.5px;
  color: var(--text-3);
  line-height: 1.1;
}

.pk-score-btn {
  width: 29px;
  flex: 0 0 29px;
  border: 0;
  border-left: 1px solid var(--pk-card-border);
  background: var(--pk-score-bg);
  color: var(--pk-score-fg);
  font-size: 12.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color .14s ease, color .14s ease;
}

.pk-team-row.is-tbd .pk-score-btn,
.pk-score-btn:disabled {
  cursor: default;
  color: var(--text-3);
  opacity: .65;
}

.pk-team-row.is-pickable .pk-score-btn:hover {
  background: rgba(249, 115, 22, .16);
  color: var(--brand);
}

.pk-team-row.is-winner .pk-score-btn {
  background: var(--brand);
  color: #fff;
  border-left-color: var(--brand);
}

.pk-official-line {
  position: absolute;
  top: 98px;
  left: 2px;
  right: 2px;
  height: 14px;
  line-height: 14px;
  font-size: 10px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.pk-mob-card .pk-official-line {
  position: static;
  height: auto;
  line-height: 1.4;
  margin-top: 2px;
  padding: 0 2px;
}

/* ── 右侧冠军预测卡片（复刻截图几何折角） ── */
.pk-champ-card {
  position: absolute;
  z-index: 3;
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .18);
  border: 1px solid var(--pk-card-border);
}

.pk-champ-head {
  height: 30px;
  background: linear-gradient(90deg, #ea580c, #f97316);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: .04em;
}

.pk-champ-body {
  flex: 1;
  background: var(--pk-champ-bg);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 10px;
  text-align: center;
  overflow: hidden;
}

/* 左上角和右下角装饰色条（对应截图赛博棱角） */
.pk-champ-body::before {
  content: "";
  position: absolute;
  top: -10px;
  left: -10px;
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #38bdf8 50%, #ec4899 50%);
  transform: rotate(45deg);
}

.pk-champ-body::after {
  content: "";
  position: absolute;
  bottom: -10px;
  right: -10px;
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #facc15 50%, #ef4444 50%);
  transform: rotate(45deg);
}

.pk-champ-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  border-radius: 8px;
  padding: 12px 8px;
  background: var(--pk-champ-inner);
  border: 1px solid rgba(255, 255, 255, .08);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.pk-champ-logo {
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.pk-champ-mono {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  font-size: 12px;
  line-height: 1.15;
  text-align: center;
  font-weight: 900;
  color: #fff;
  word-break: break-all;
}

.pk-champ-empty-emblem {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, .2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, .36);
  font-size: 22px;
  font-weight: 800;
}

.pk-champ-name {
  font-size: 13.5px;
  font-weight: 800;
  color: #f8fafc;
  line-height: 1.25;
  word-break: break-word;
}

.pk-champ-empty-text {
  font-size: 13px;
  font-weight: 700;
  color: #94a3b8;
}

.pk-champ-sub {
  font-size: 11px;
  color: #fb923c;
  font-weight: 700;
}

/* ── 轮次卡片视图（移动端默认 / 桌面可切换） ── */
.pk-round-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.pk-round-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 700;
}

.pk-round-chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.pk-round-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.pk-mob-card {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pk-mob-card.is-final {
  border-color: rgba(249, 115, 22, .45);
}

.pk-mob-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-xs);
  color: var(--text-2);
}

/* ── 浮动比分编辑弹窗（Score Popover） ── */
.pk-popover {
  position: fixed;
  z-index: 1200;
  width: 300px;
  max-width: calc(100vw - 20px);
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 14px 38px rgba(15, 23, 42, .24);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pk-pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pk-pop-title {
  font-size: var(--fs-sm);
  font-weight: 800;
  color: var(--text);
}

.pk-pop-close {
  border: 0;
  background: transparent;
  color: var(--text-3);
  font-size: 16px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 6px;
}

.pk-pop-close:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.pk-pop-bo-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.pk-pop-bo-pill {
  flex: 1;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text-2);
  font-size: var(--fs-2xs);
  font-weight: 700;
}

.pk-pop-bo-pill.active {
  background: var(--btn-secondary-bg);
  border-color: var(--brand);
  color: var(--brand);
}

.pk-pop-teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 8px;
  background: var(--bg-soft);
}

.pk-pop-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.pk-pop-tname {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pk-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-card);
  overflow: hidden;
}

.pk-step-btn {
  width: 26px;
  height: 30px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-size: 15px;
  font-weight: 700;
}

.pk-step-btn:hover {
  background: var(--bg-hover);
  color: var(--brand);
}

.pk-step-input {
  width: 38px;
  height: 30px;
  padding: 0;
  margin: 0;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: center;
  font-size: var(--fs-base);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}

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

.pk-pop-vs {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-3);
}

.pk-pop-quick-label {
  font-size: var(--fs-2xs);
  color: var(--text-3);
  font-weight: 700;
}

.pk-pop-quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.pk-pop-quick-col {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.pk-quick-chip {
  flex: 1 0 42%;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  font-size: var(--fs-xs);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pk-quick-chip:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.pk-quick-chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.pk-pop-foot {
  display: flex;
  gap: 8px;
}

.pk-pop-foot .btn {
  flex: 1;
  height: 32px;
  font-size: var(--fs-xs);
}

/* ── 导入 / 编辑赛程弹窗内部组件 ── */
.pk-modal-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.pk-modal-tab {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 700;
}

.pk-modal-tab.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.pk-import-list {
  max-height: 340px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.pk-import-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-soft);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pk-import-item-info {
  min-width: 0;
  flex: 1;
}

.pk-import-item-title {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text);
}

.pk-import-item-sub {
  font-size: var(--fs-xs);
  color: var(--text-2);
  margin-top: 2px;
}

.pk-preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
  max-height: 360px;
  overflow-y: auto;
}

.pk-preset-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-soft);
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  cursor: pointer;
  transition: border-color .14s ease, transform .12s ease;
}

.pk-preset-card:hover {
  border-color: var(--brand);
  transform: translateY(-1px);
}

.pk-preset-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--btn-secondary-bg);
  color: var(--btn-secondary-fg);
  font-size: 11px;
  font-weight: 700;
}

.pk-editor-scroll {
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 2px;
}

.pk-slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
}

.pk-slot-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pk-slot-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-2);
}

.pk-input-sm {
  width: 100%;
  height: 30px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text);
  font-size: var(--fs-xs);
}

.pk-textarea {
  width: 100%;
  min-height: 110px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text);
  font-size: var(--fs-xs);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  resize: vertical;
}

.pk-dropzone {
  border: 2px dashed var(--line);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  background: var(--bg-soft);
  cursor: pointer;
  font-size: var(--fs-xs);
  color: var(--text-2);
}

.pk-dropzone.is-dragover {
  border-color: var(--brand);
  background: var(--bg-card);
}

/* ── 自定义编排工具扩展样式 ────────────────────────────────────── */
.pk-mode-switch {
  display: inline-flex;
  padding: 3px;
  border-radius: 10px;
  background: rgba(0, 0, 0, .14);
  border: 1px solid rgba(0, 0, 0, .12);
  gap: 3px;
}

html[data-theme="dark"] .pk-mode-switch {
  background: rgba(15, 23, 42, .45);
  border-color: rgba(255, 255, 255, .14);
}

.pk-mode-btn {
  border: 0;
  background: transparent;
  color: rgba(28, 25, 23, .78);
  height: 30px;
  padding: 0 12px;
  border-radius: 7px;
  font-size: var(--fs-xs);
  font-weight: 800;
  transition: background-color .14s ease, color .14s ease, box-shadow .14s ease;
}

html[data-theme="dark"] .pk-mode-btn {
  color: rgba(255, 247, 237, .76);
}

.pk-mode-btn.active {
  background: #ffffff;
  color: #1c1917;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .16);
}

html[data-theme="dark"] .pk-mode-btn.active {
  background: #0f172a;
  color: #ffffff;
}

.pk-title-edit-btn {
  border: 0;
  background: rgba(0, 0, 0, .10);
  color: inherit;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: background-color .12s ease;
}

.pk-title-edit-btn:hover {
  background: rgba(0, 0, 0, .20);
}

.pk-title-input {
  height: 34px;
  min-width: 240px;
  max-width: 100%;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, .25);
  background: rgba(255, 255, 255, .94);
  color: #1c1917;
  font-size: var(--fs-lg);
  font-weight: 800;
}

/* 模板选择条（按世界赛 / 地区季后赛分组 + 生成器 & 自由构图入口） */
/* ── 即将开赛一键导入条 ── */
.pk-upcoming-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 16px;
  border-top: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(249, 115, 22, .08), rgba(250, 204, 21, .03));
  flex-wrap: wrap;
}

.pk-up-label {
  font-size: var(--fs-xs);
  font-weight: 800;
  color: var(--brand);
  white-space: nowrap;
}

.pk-up-regions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 360px;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 2px;
}

.pk-up-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color .12s ease, background-color .12s ease, color .12s ease;
}

.pk-up-chip:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.pk-up-chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.pk-up-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(249, 115, 22, .14);
  color: var(--brand);
  font-size: 10px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.pk-up-chip.active .pk-up-badge {
  background: rgba(255, 255, 255, .24);
  color: #fff;
}

.pk-up-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.pk-up-cta {
  white-space: nowrap;
}

.pk-template-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 16px;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  flex-wrap: wrap;
}

.pk-tpl-scroll {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 460px;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 2px;
}

.pk-tpl-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.pk-tpl-group + .pk-tpl-group {
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.pk-tpl-group-tag {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-3);
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 7px;
  white-space: nowrap;
}

.pk-tpl-chip {
  flex: 0 0 auto;
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 700;
  white-space: nowrap;
  transition: border-color .12s ease, background-color .12s ease, color .12s ease;
}

.pk-tpl-chip:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.pk-tpl-chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.pk-tpl-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.pk-tpl-cta {
  height: 28px;
  padding: 0 11px;
  border-radius: 8px;
  border: 1px solid rgba(249, 115, 22, .45);
  background: rgba(249, 115, 22, .10);
  color: var(--brand);
  font-size: var(--fs-xs);
  font-weight: 800;
  white-space: nowrap;
  transition: background-color .12s ease, border-color .12s ease, transform .12s ease;
}

.pk-tpl-cta:hover {
  background: rgba(249, 115, 22, .18);
  border-color: var(--brand);
  transform: translateY(-1px);
}

.pk-tpl-cta.is-mindmap {
  border-color: rgba(14, 165, 233, .45);
  background: rgba(14, 165, 233, .10);
  color: #0284c7;
}

.pk-tpl-cta.is-mindmap:hover {
  background: rgba(14, 165, 233, .18);
  border-color: #0ea5e9;
}

html[data-theme="dark"] .pk-tpl-cta.is-mindmap {
  color: #38bdf8;
}

/* 编排模式下的对阵槽位状态 */
.pk-bo-tag.is-clickable {
  cursor: pointer;
  border: 0;
  transition: background-color .12s ease, color .12s ease;
}

.pk-bo-tag.is-clickable:hover {
  background: rgba(249, 115, 22, .22);
  color: var(--brand);
}

.pk-team-row.is-seed-slot {
  cursor: pointer;
}

.pk-team-row.is-seed-empty {
  border: 1.5px dashed rgba(249, 115, 22, .45);
  background: rgba(249, 115, 22, .04);
}

.pk-team-row.is-seed-empty:hover {
  border-color: var(--brand);
  background: rgba(249, 115, 22, .10);
}

.pk-team-row.is-seed-filled {
  cursor: grab;
}

.pk-team-row.is-seed-filled:active {
  cursor: grabbing;
}

.pk-team-row.is-slot-active {
  border-color: var(--brand);
  border-style: solid;
  box-shadow: 0 0 0 2px rgba(249, 115, 22, .45);
}

.pk-team-row.is-drag-over {
  border-color: var(--brand) !important;
  border-style: solid !important;
  background: rgba(249, 115, 22, .18) !important;
  box-shadow: 0 0 0 2px var(--brand);
}

.pk-slot-remove-btn {
  width: 28px;
  flex: 0 0 28px;
  border: 0;
  border-left: 1px solid var(--pk-card-border);
  background: transparent;
  color: var(--text-3);
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color .12s ease, color .12s ease;
}

.pk-slot-remove-btn:hover {
  background: rgba(239, 68, 68, .15);
  color: #ef4444;
}

/* 统一工作台：已填初始席位快捷更换按钮、空席位加号、可折叠战队库 */
.pk-seed-edit-btn {
  position: absolute;
  right: 32px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bg-card);
  color: var(--text-2);
  font-size: 11px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  cursor: pointer;
  z-index: 2;
  transition: opacity .12s ease, border-color .12s ease, color .12s ease, background-color .12s ease;
}

.pk-team-row.is-seed-filled:hover .pk-seed-edit-btn,
.pk-team-row.is-seed-filled:focus-within .pk-seed-edit-btn {
  opacity: 1;
  pointer-events: auto;
}

.pk-seed-edit-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--bg-card);
}

.pk-mob-card .pk-seed-edit-btn {
  opacity: .88;
  pointer-events: auto;
}

@media (hover: none) {
  .pk-seed-edit-btn {
    opacity: .88;
    pointer-events: auto;
  }
}

.pk-score-btn.is-seed-add {
  color: var(--brand);
  font-size: 15px;
  font-weight: 800;
  background: rgba(249, 115, 22, .08);
}

.pk-team-row.is-seed-empty:hover .pk-score-btn.is-seed-add {
  background: var(--brand);
  color: #fff;
  border-left-color: var(--brand);
}

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

.pk-pool-card.is-collapsed {
  padding: 10px 16px;
}

.pk-pool-card.is-collapsed .pk-pool-controls,
.pk-pool-card.is-collapsed .pk-pool-grid {
  display: none;
}

.pk-fmt-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .12s ease, color .12s ease, background-color .12s ease;
}

.pk-fmt-pill:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--bg-card);
}

/* ── 模板选择工作区（预设示意图 + 自定义结构实时生成 + 自由构图） ── */
.pk-tpl-subtabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.pk-tpl-subtab {
  height: 34px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 800;
  cursor: pointer;
  transition: border-color .14s ease, background-color .14s ease, color .14s ease;
}

.pk-tpl-subtab:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.pk-tpl-subtab.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: 0 2px 8px rgba(249, 115, 22, .24);
}

.pk-tpl-gallery-wrap {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.pk-tpl-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.pk-tpl-section-head h3 {
  margin: 0;
  font-size: var(--fs-base);
  font-weight: 800;
  color: var(--text);
}

.pk-tpl-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}

.pk-tpl-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--bg-soft);
  text-align: left;
  cursor: pointer;
  transition: border-color .14s ease, transform .12s ease, box-shadow .14s ease, background-color .14s ease;
}

.pk-tpl-card:hover {
  border-color: var(--brand);
  background: var(--bg-card);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, .08);
}

.pk-tpl-card.active {
  border-color: var(--brand);
  background: var(--bg-card);
  box-shadow: 0 0 0 2px rgba(249, 115, 22, .22);
}

.pk-tpl-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.pk-tpl-card-title {
  font-size: var(--fs-sm);
  font-weight: 800;
  color: var(--text);
  line-height: 1.3;
}

.pk-tpl-ref-tag {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(100, 116, 139, .14);
  color: var(--text-2);
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}

.pk-tpl-cur-tag {
  flex: 0 0 auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  white-space: nowrap;
}

.pk-tpl-preview {
  width: 100%;
  height: 112px;
  padding: 8px;
  border-radius: 8px;
  background: var(--pk-canvas-bg);
  border: 1px solid var(--pk-canvas-line);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.pk-mini-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.pk-mini-rail {
  fill: var(--pk-rail-bg);
  opacity: .72;
}

.pk-mini-divider {
  stroke: var(--pk-canvas-line);
  stroke-dasharray: 12 10;
}

.pk-mini-wire {
  fill: none;
  stroke: var(--pk-wire);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pk-mini-node {
  fill: var(--pk-card-bg);
  stroke: var(--pk-card-border);
}

.pk-mini-node.is-final {
  stroke: var(--brand);
  fill: rgba(249, 115, 22, .14);
}

.pk-mini-node.is-third {
  stroke: #0ea5e9;
  fill: rgba(14, 165, 233, .12);
}

.pk-mini-split {
  stroke: var(--pk-card-border);
  opacity: .75;
}

.pk-mini-champ {
  fill: var(--pk-champ-bg);
  stroke: var(--brand);
}

.pk-tpl-card-meta {
  font-size: var(--fs-xs);
  font-weight: 800;
  color: var(--brand);
}

.pk-tpl-card-desc {
  font-size: 11.5px;
  color: var(--text-2);
  line-height: 1.45;
}

.pk-tpl-footer-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bg-soft);
  border: 1px dashed var(--line);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-2);
}

.pk-tpl-footer-btns {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── 自定义结构双栏工作台（左侧参数生成 + 右侧自由连线画布） ── */
.pk-custom-workbench {
  display: grid;
  grid-template-columns: minmax(290px, 340px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.pk-custom-workbench.is-panel-collapsed {
  grid-template-columns: 1fr;
}

.pk-custom-workbench.is-panel-collapsed .pk-custom-panel {
  display: none;
}

.pk-custom-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
}

.pk-custom-panel-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.pk-custom-panel-head span {
  font-size: var(--fs-sm);
  font-weight: 800;
  color: var(--text);
}

.pk-custom-panel-head small {
  font-size: 11px;
  color: var(--text-3);
}

.pk-custom-canvas-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.pk-custom-canvas-col .pk-inspector {
  margin-bottom: 10px;
}

.pk-custom-canvas-col .pk-stage-toolbar {
  margin-bottom: 8px;
}

.pk-custom-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pk-custom-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pk-custom-label {
  font-size: var(--fs-xs);
  font-weight: 800;
  color: var(--text-2);
}

.pk-custom-count-badge {
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(249, 115, 22, .14);
  color: var(--brand);
  font-size: var(--fs-xs);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.pk-custom-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pk-custom-range {
  flex: 1 1 auto;
  min-width: 0;
  accent-color: var(--brand);
  cursor: pointer;
}

.pk-custom-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-card);
  overflow: hidden;
  flex-shrink: 0;
}

.pk-custom-bo-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.pk-custom-note {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px dashed var(--line);
  font-size: 11.5px;
  color: var(--text-2);
  line-height: 1.45;
}

.pk-custom-reset-link {
  border: 0;
  background: transparent;
  color: var(--brand);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.pk-custom-reset-link:hover {
  text-decoration: underline;
}

.pk-custom-rounds-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 210px;
  overflow-y: auto;
  padding: 8px;
  border-radius: 9px;
  background: var(--bg-card);
  border: 1px solid var(--line);
}

.pk-custom-round-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 7px;
  transition: background-color .15s;
}

.pk-custom-round-row:hover {
  background: var(--bg-soft);
}

.pk-custom-round-row.is-custom {
  background: rgba(249, 115, 22, .08);
}

.pk-custom-round-info {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.pk-custom-round-name {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pk-custom-round-row.is-custom .pk-custom-round-name {
  color: var(--brand);
}

.pk-custom-round-cnt {
  font-size: 10.5px;
  color: var(--text-3);
  flex-shrink: 0;
}

.pk-custom-rbo-grp {
  display: inline-flex;
  gap: 3px;
  flex-shrink: 0;
}

.pk-rbo-btn {
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text-2);
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1.4;
}

.pk-rbo-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.pk-rbo-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

.pk-custom-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}

.pk-custom-actions .btn {
  width: 100%;
  justify-content: center;
}

@media (min-width: 1440px) {
  .pk-custom-workbench:not(.is-panel-collapsed) {
    grid-template-columns: minmax(310px, 360px) minmax(0, 1fr);
    gap: 18px;
  }
  .pk-custom-workbench.is-panel-collapsed {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 1080px) {
  .pk-custom-workbench {
    grid-template-columns: 1fr;
  }
}

/* 编排指导条 */
.pk-arrange-guide {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 10px;
  border-radius: 8px;
  background: rgba(249, 115, 22, .09);
  border: 1px solid rgba(249, 115, 22, .25);
  font-size: var(--fs-xs);
  color: var(--text);
}

.pk-arrange-guide strong {
  color: var(--brand);
}

/* 战队库工作台（Pool Workbench） */
.pk-pool-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pk-pool-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.pk-pool-title-wrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.pk-pool-title {
  margin: 0;
  font-size: var(--fs-lg);
  font-weight: 800;
  color: var(--text);
}

.pk-pool-sub {
  font-size: var(--fs-xs);
  color: var(--text-2);
}

.pk-pool-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.pk-pool-controls .chip-bar {
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: wrap;
  overflow-x: visible;
}

.pk-pool-search-wrap {
  position: relative;
  min-width: 200px;
  max-width: clamp(280px, 26vw, 400px);
  flex: 1 1 200px;
}

.pk-pool-search {
  width: 100%;
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  font-size: var(--fs-xs);
}

.pk-pool-search:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--bg-card);
}

.pk-pool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(146px, 1fr));
  gap: 8px;
  max-height: 340px;
  overflow-y: auto;
  padding: 2px;
}

@media (min-width: 1280px) {
  .pk-pool-grid {
    max-height: 420px;
  }
  .pk-round-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}

.pk-pool-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  cursor: pointer;
  user-select: none;
  transition: border-color .12s ease, background-color .12s ease, transform .12s ease;
}

.pk-pool-item:hover {
  border-color: var(--brand);
  background: var(--bg-card);
  transform: translateY(-1px);
}

.pk-pool-item.is-selected {
  border-color: var(--brand);
  background: var(--pk-win-bg);
  box-shadow: 0 0 0 2px rgba(249, 115, 22, .35);
}

.pk-pool-item.is-placed {
  border-color: rgba(34, 197, 94, .4);
  background: rgba(34, 197, 94, .06);
}

.pk-pool-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex: 0 0 auto;
  border-radius: 6px;
}

html[data-theme="dark"] .pk-pool-logo {
  background: rgba(248, 250, 252, .88);
  padding: 2px;
}

.pk-pool-mono {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}

.pk-pool-logo.is-fallback {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #475569;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}

.pk-pool-meta {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pk-pool-short {
  font-size: var(--fs-xs);
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pk-pool-name {
  font-size: 10.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pk-pool-badge {
  position: absolute;
  top: -5px;
  right: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #16a34a;
  color: #fff;
  font-size: 9.5px;
  font-weight: 800;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .18);
}

.pk-pool-custom-ops {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.pk-pool-mini-btn {
  border: 0;
  background: transparent;
  color: var(--text-3);
  width: 20px;
  height: 18px;
  border-radius: 4px;
  font-size: 11px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pk-pool-mini-btn:hover {
  background: rgba(249, 115, 22, .16);
  color: var(--brand);
}

.pk-pool-mini-btn.is-del:hover {
  background: rgba(239, 68, 68, .16);
  color: #ef4444;
}

/* 自定义战队弹窗头像与色板 */
.pk-custom-form-row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.pk-avatar-upload {
  width: 86px;
  height: 86px;
  flex: 0 0 86px;
  border-radius: 12px;
  border: 2px dashed var(--line);
  background: var(--bg-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  overflow: hidden;
  font-size: 11px;
  color: var(--text-2);
  text-align: center;
  transition: border-color .14s ease;
}

.pk-avatar-upload:hover {
  border-color: var(--brand);
}

.pk-avatar-upload img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}

.pk-color-swatches {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.pk-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease;
}

.pk-swatch.active {
  border-color: var(--text);
  transform: scale(1.12);
}

/* 席位点击选队 / 自定义战队弹窗 */
.pk-sp-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  margin-bottom: 10px;
  font-size: var(--fs-xs);
}

.pk-sp-cur {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  font-weight: 700;
}

.pk-sp-cont-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-2);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.pk-local-note {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(34, 197, 94, .10);
  border: 1px solid rgba(34, 197, 94, .26);
  color: #15803d;
  font-size: var(--fs-xs);
  line-height: 1.5;
}

html[data-theme="dark"] .pk-local-note {
  color: #4ade80;
}

.pk-sp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(144px, 1fr));
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  padding: 2px;
  margin-top: 8px;
}

.pk-sp-saved-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.pk-sp-saved-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  font-size: var(--fs-xs);
  font-weight: 700;
  cursor: pointer;
}

.pk-sp-saved-chip:hover {
  border-color: var(--brand);
  color: var(--brand);
}

/* ── 思维导图式自由构图工作台（build 模式） ────────────────────── */
.pk-viewport.is-builder-canvas {
  background-color: var(--pk-canvas-bg);
  background-image: radial-gradient(circle, rgba(100, 116, 139, .24) 1px, transparent 1px);
  background-size: 18px 18px;
}

html[data-theme="dark"] .pk-viewport.is-builder-canvas {
  background-image: radial-gradient(circle, rgba(148, 163, 184, .18) 1px, transparent 1px);
}

.pk-svg.is-interactive {
  pointer-events: none;
  z-index: 2;
}

.pk-wire.is-loser-wire {
  stroke: #0ea5e9;
  stroke-dasharray: 5 4;
  stroke-width: 1.6;
}

html[data-theme="dark"] .pk-wire.is-loser-wire {
  stroke: #38bdf8;
}

.pk-wire-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 14;
  pointer-events: stroke;
  cursor: pointer;
}

.pk-wire-group:hover .pk-wire {
  stroke: #ef4444;
  stroke-width: 2.8;
}

.pk-wire-preview {
  fill: none;
  stroke: #f97316;
  stroke-width: 2.5;
  stroke-dasharray: 6 4;
  pointer-events: none;
}

.pk-wire-preview.is-loser {
  stroke: #0ea5e9;
}

.pk-wire-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 8px;
  border-radius: 8px;
  background: rgba(249, 115, 22, .14);
  border: 1px solid rgba(249, 115, 22, .45);
  color: var(--text);
  font-size: var(--fs-xs);
}

.pk-wire-banner strong {
  color: var(--brand);
}

.pk-inspector {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 9px 12px;
  margin-bottom: 10px;
  border-radius: 9px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  font-size: var(--fs-xs);
}

.pk-inspector.is-empty {
  color: var(--text-2);
  justify-content: center;
}

.pk-inspector-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.pk-inspector-branches {
  margin-left: auto;
}

.pk-ins-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
}

.pk-inspector-input {
  width: 108px;
  height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text);
  font-size: var(--fs-xs);
  font-weight: 700;
}

.pk-inspector-input:focus {
  outline: none;
  border-color: var(--brand);
}

.pk-ins-btns {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.pk-ins-col-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  padding: 0 4px;
  min-width: 36px;
  text-align: center;
}

.pk-ins-btn,
.pk-ins-pill {
  height: 26px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 700;
  transition: border-color .12s ease, background-color .12s ease, color .12s ease;
}

.pk-ins-btn:hover,
.pk-ins-pill:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.pk-ins-pill.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.pk-btn-danger-ghost {
  color: #ef4444;
  border-color: rgba(239, 68, 68, .35);
}

.pk-btn-danger-ghost:hover {
  background: rgba(239, 68, 68, .10);
  border-color: #ef4444;
}

/* 构建模式节点卡片与脑图手柄 */
.pk-match.is-builder-card {
  z-index: 4;
  cursor: pointer;
}

.pk-match.is-builder-selected {
  z-index: 6;
}

.pk-match.is-builder-selected .pk-slots {
  border-radius: 7px;
  box-shadow: 0 0 0 2px var(--brand), 0 6px 18px rgba(249, 115, 22, .22);
}

.pk-match.is-wire-invalid {
  opacity: .42;
}

.pk-b-role-tag {
  font-size: 9.5px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
}

.pk-b-role-tag.is-final {
  background: rgba(249, 115, 22, .18);
  color: var(--brand);
}

.pk-b-role-tag.is-third {
  background: rgba(14, 165, 233, .16);
  color: #0284c7;
}

.pk-b-slot-wrap {
  position: relative;
}

.pk-team-row.is-wired-slot {
  background: var(--bg-soft);
}

.pk-team-row.is-wire-target,
.pk-team-row.is-wire-drag-target {
  border: 1.5px dashed var(--brand) !important;
  background: rgba(249, 115, 22, .08) !important;
}

.pk-team-row.is-wire-hover {
  border: 2px solid var(--brand) !important;
  background: rgba(249, 115, 22, .22) !important;
  box-shadow: 0 0 0 2px rgba(249, 115, 22, .35);
}

.pk-b-slot-src {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
}

.pk-b-slot-src.is-win {
  background: #f97316;
}

.pk-b-slot-src.is-lose {
  background: #0ea5e9;
}

.pk-b-unlink-btn {
  width: 26px;
  flex: 0 0 26px;
  border: 0;
  border-left: 1px solid var(--pk-card-border);
  background: transparent;
  color: var(--text-3);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.pk-b-unlink-btn:hover {
  background: rgba(239, 68, 68, .15);
  color: #ef4444;
}

.pk-b-feeder-btn {
  position: absolute;
  left: -19px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: .55;
  transition: opacity .12s ease, border-color .12s ease, background-color .12s ease, color .12s ease;
  z-index: 5;
}

.pk-match.is-builder-card:hover .pk-b-feeder-btn,
.pk-match.is-builder-selected .pk-b-feeder-btn,
.pk-b-feeder-btn:hover {
  opacity: 1;
}

.pk-b-feeder-btn:hover {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.pk-b-ports {
  position: absolute;
  left: calc(100% + 5px);
  top: 20px;
  width: 22px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  z-index: 6;
}

.pk-b-port {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  font-size: 10px;
  font-weight: 800;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: crosshair;
  touch-action: none;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .12);
  transition: transform .1s ease, background-color .12s ease, color .12s ease;
}

.pk-b-port.is-win {
  color: #ea580c;
  border-color: rgba(249, 115, 22, .45);
}

.pk-b-port.is-win:hover,
.pk-b-port.is-win.active {
  background: #f97316;
  border-color: #f97316;
  color: #fff;
  transform: scale(1.08);
}

.pk-b-port.is-lose {
  color: #0284c7;
  border-color: rgba(14, 165, 233, .45);
}

.pk-b-port.is-lose:hover,
.pk-b-port.is-lose.active {
  background: #0ea5e9;
  border-color: #0ea5e9;
  color: #fff;
  transform: scale(1.08);
}

.pk-b-port.is-add {
  height: 19px;
  cursor: pointer;
  color: var(--text-2);
  font-size: 12px;
}

.pk-b-port.is-add:hover {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.pk-b-sibling-btn {
  position: absolute;
  left: 50%;
  bottom: -16px;
  transform: translateX(-50%);
  width: 20px;
  height: 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease, background-color .12s ease, color .12s ease;
  z-index: 6;
}

.pk-match.is-builder-card:hover .pk-b-sibling-btn,
.pk-match.is-builder-selected .pk-b-sibling-btn {
  opacity: .9;
  pointer-events: auto;
}

.pk-b-sibling-btn:hover {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

/* 移动端轮次卡片兼容自由构图 */
.pk-round-grid .pk-match.is-builder-card {
  position: relative;
  width: 100%;
  padding: 10px 30px 16px 22px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.pk-round-grid .pk-b-ports {
  right: 4px;
  left: auto;
  top: 32px;
}

.pk-round-grid .pk-b-feeder-btn {
  left: -17px;
}

.pk-round-grid .pk-b-sibling-btn {
  bottom: 2px;
  opacity: .75;
  pointer-events: auto;
}

.pk-empty-builder {
  padding: 46px 16px;
  text-align: center;
  border-radius: 10px;
  border: 2px dashed var(--line);
  background: var(--pk-canvas-bg);
}

/* 任意队数生成器弹窗 */
.pk-gen-presets {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.pk-gen-chip {
  height: 30px;
  padding: 0 11px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 700;
  transition: border-color .12s ease, background-color .12s ease, color .12s ease;
}

.pk-gen-chip:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.pk-gen-chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.pk-gen-num-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  color: var(--text-2);
  margin-left: 4px;
}

.pk-gen-num-wrap .pk-input-sm {
  width: 68px;
  text-align: center;
  font-weight: 800;
}

.pk-gen-summary {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(249, 115, 22, .09);
  border: 1px solid rgba(249, 115, 22, .30);
  color: var(--text);
  font-size: var(--fs-xs);
  font-weight: 700;
}

@media (max-width: 768px) {
  .pk-banner {
    flex-direction: column;
    align-items: flex-start;
  }
  .pk-banner-title {
    font-size: var(--fs-lg);
  }
  .pk-control-strip {
    padding: 10px 12px;
  }
  .pk-upcoming-bar,
  .pk-template-bar {
    padding: 8px 12px;
  }
  .pk-stage-card {
    padding: 10px;
  }
  .pk-pool-card {
    padding: 12px;
  }
  .pk-pool-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }
  .pk-zoom-grp {
    display: none;
  }
  .pk-inspector-branches {
    margin-left: 0;
  }
}
