/* 只在杯赛模式内调整布局。 */
#select.cup-mode .sel-body { grid-template-columns: minmax(110px, .65fr) minmax(180px, .8fr) minmax(400px, 2fr); align-items: stretch; }
#select.cup-mode .sel-body > .pane:not(.cup-own) { display: none; }
#select.cup-mode .sel-foot { display: none; }
#select.cup-mode .grid { align-content: center; gap: 6px; padding: 8px; }
#select.cup-mode .pane .art { height: min(45vh, 350px); }
#select.cup-mode .pane .info { padding: 8px; }
#cupPanel { min-height: 0; margin-top: 10px; display: grid; grid-template-columns: minmax(110px, .65fr) minmax(180px, 1.5fr); grid-template-rows: minmax(0, 1fr) auto; gap: 10px; border: 2px solid #57729e; border-radius: 14px; padding: 12px; background: #0b1930; }
#cupPanel .cup-list { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
#cupPanel .cup-list button { text-align: left; padding: 9px; color: #fff; border: 1px solid #526b92; background: #192d4b; border-radius: 8px; flex-shrink: 0; }
#cupPanel .cup-list button.on { border-color: #ffd23f; color: #ffd23f; }
#cupPanel small { display: block; opacity: .7; font-size: 11px; }
.cup-scroll { min-height: 0; overflow-y: auto; }
#cupPanel h3, #cupResult h3 { color: #ffd23f; margin: 4px 0 10px; }
#cupPanel p, #cupHonors p { font-size: 13px; margin: 8px 0; }
.cup-venue { width: 100%; max-height: 110px; object-fit: cover; border-radius: 8px; }
.cup-actions { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
#cupPanel > .cup-actions { grid-column: 1 / -1; }
#cupPanel .cup-actions span { font-size: 12px; }
#over.cup-over .card { width: min(900px, 95vw); max-height: 94dvh; display: flex; flex-direction: column; }
#over.cup-over .rematch, #over.cup-over .rmsg, #over.cup-over .btns { display: none; }
#cupResult { min-height: 0; display: flex; flex-direction: column; gap: 8px; }
#cupResult .cup-bracket { overflow-y: auto; min-height: 0; }
#cupResult p { margin: 0; font-size: 13px; }
#cupTag { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); padding: 4px 12px; border-radius: 10px; background: #0b1930dd; color: #ffd23f; font-size: 14px; z-index: 22; pointer-events: none; }
#cupHonors .card { max-height: 90dvh; width: min(640px, 94vw); display: flex; flex-direction: column; gap: 10px; }
@media (max-height: 550px), (max-width: 1000px) {
  #select.cup-mode .sel-body { grid-template-columns: 100px 180px minmax(320px, 1fr); gap: 4px; }
  #select.cup-mode .pane .art { bottom: 70px; height: 45vh; }
  #select.cup-mode .pane .info .stat, #select.cup-mode .pane .ctitle, #select.cup-mode .pane .supl, #select.cup-mode .pane .ptag, #select.cup-mode .pane .status { display: none; }
  #select.cup-mode .pane .cname { font-size: 20px; }
  #select.cup-mode .grid { gap: 4px; }
  #select.cup-mode .cardc .lab { font-size: 10px; padding: 1px; }
  #select.cup-mode .sel-title { font-size: 20px; }
  #select.cup-mode .sel-head { grid-template-columns: auto auto 1fr; gap: 6px; }
  #select.cup-mode .sel-head .right { display: flex; gap: 3px; flex-wrap: wrap; justify-content: flex-end; }
  #select.cup-mode .sel-head .chip { font-size: 11px; padding: 4px; }
  #cupPanel { padding: 7px; gap: 6px; margin-top: 4px; }
  #cupPanel .big-btn, #cupResult .big-btn { font-size: 15px; padding: 7px 14px; }
}
#select.cup-mode .sel-body.dbl { grid-template-areas: none; grid-template-rows: minmax(0, 1fr); }
#select.cup-mode .sel-body > #pane0, #select.cup-mode .sel-body > .grid { grid-area: auto; grid-column: auto; grid-row: auto; }
#select.cup-mode .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); min-width: 0; }
#select.cup-mode .cardc { width: auto; min-width: 0; }

#select.cup-mode .sel-body > .pane.cup-own { display: flex; grid-area: auto; grid-column: 1; grid-row: 1; }

/* 杯赛模式不用「1P / 选择中」（会压在左上角「在线」按钮上） */
#select.cup-mode .pane .ptag, #select.cup-mode .pane .status { display: none; }
/* 比赛中：比分牌下面的杯名和轮次；规则提示往下让一行 */
#cupTag { top: 78px; }
body.cup-on #ruleTag { top: 110px; }
@media (max-width: 1000px), (max-height: 550px) { #cupTag { top: 44px; font-size: 12px; padding: 2px 10px; } body.cup-on #ruleTag { top: 70px; } }
/* VS 开场上方写「XX杯 · 半决赛」 */
#vs .cupTitle { position: absolute; left: 50%; top: 9vh; transform: translateX(-50%); white-space: nowrap; font-size: clamp(20px, 3.4vw, 40px); font-weight: 900; font-style: italic; color: var(--yellow); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 0 4px 0 var(--ink); animation: cupIn 0.4s 0.2s both; }
@keyframes cupIn { from { transform: translateX(-50%) scale(3); opacity: 0; } }
#vs .cupTitle:empty { display: none; }
/* 判负 / 淘汰后回到大厅时的结算弹窗 */
#cupDone .card { width: min(900px, 95vw); max-height: 94dvh; display: flex; flex-direction: column; gap: 8px; }
#cupDone .cup-bracket { overflow-y: auto; min-height: 0; }
#cupDone p { margin: 0; font-size: 13px; }
#cupDone h3 { color: var(--yellow); margin: 4px 0; }
/* 夺冠：大奖杯 + 彩带 */
.cup-champ { position: relative; text-align: center; line-height: 1; }
.cup-champ i { display: inline-block; font-style: normal; font-size: clamp(48px, 9vh, 84px); animation: cupWin 0.7s cubic-bezier(.2,1.8,.4,1) both, cupGlow 1.2s 0.7s ease-in-out infinite alternate; }
.cup-champ span { display: block; margin-top: 4px; font-weight: 900; color: #6dff9a; }
.cup-champ::before, .cup-champ::after { content: ''; position: absolute; top: 0; width: 40%; height: 100%; overflow: hidden; pointer-events: none;
  background: radial-gradient(circle, #ffd23f 0 3px, transparent 4px) 0 0 / 34px 30px, radial-gradient(circle, #ff3b5c 0 3px, transparent 4px) 12px 9px / 40px 34px, radial-gradient(circle, #4fd1ff 0 3px, transparent 4px) 20px 4px / 30px 38px;
  animation: cupConfetti 2.4s linear infinite; opacity: 0.8; }
.cup-champ::before { left: 0; } .cup-champ::after { right: 0; animation-delay: -1.2s; }
@keyframes cupWin { from { transform: scale(0.2) rotate(-20deg); opacity: 0; } }
@keyframes cupGlow { to { text-shadow: 0 0 24px rgba(255, 210, 63, 0.9); transform: scale(1.06); } }
@keyframes cupConfetti { from { background-position-y: -40px, -30px, -50px; } to { background-position-y: 80px, 90px, 70px; } }
/* 奖杯柜：10 个奖杯位，拿过的亮起来 */
.cup-case { display: flex; gap: 4px; flex-wrap: wrap; padding: 2px 5px 5px 2px; } /* 留出亮框和次数角标的位置，不然在滚动区里被切掉 */
.cup-pip { position: relative; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; background: rgba(255,255,255,0.06); font-size: 15px; filter: grayscale(1) brightness(0.45); }
.cup-pip.won { filter: none; background: rgba(255, 210, 63, 0.16); box-shadow: 0 0 0 1px rgba(255, 210, 63, 0.6); }
.cup-pip b { position: absolute; right: -4px; bottom: -4px; min-width: 13px; height: 13px; line-height: 13px; border-radius: 7px; background: #ff3b5c; font-size: 9px; text-align: center; }
.pf-title { display: block; font-size: 12px; color: var(--yellow); font-weight: 800; }
#cupHonors .cup-case { margin-bottom: 6px; }
.cup-top { width: 100%; border-collapse: collapse; font-size: 13px; }
.cup-top th { text-align: left; color: #9fc4ff; font-size: 12px; padding: 4px; }
.cup-top td { padding: 5px 4px; border-top: 1px solid rgba(255,255,255,0.08); }
.cup-top tr:nth-child(2) td { color: var(--yellow); font-weight: 900; }
#over.cup-over .win { display: none; } /* 杯赛结算自己写「晋级 / 夺冠 / 淘汰」，不再重复「XX 获胜」 */
@media (max-height: 550px) { .cup-champ i { font-size: 40px; } .cup-champ span { font-size: 13px; margin-top: 0; } #over.cup-over .card, #cupDone .card { padding: 12px 16px; gap: 4px; } }

/* 晋级图：一列一轮（16 强 → 冠军），每两场用线接到下一轮 */
.cup-bracket { --bk-line: #57729e; display: flex; gap: 14px; overflow: auto; min-height: 0; font-size: 11px; text-align: left; padding: 2px 2px 4px; }
.bk-col { flex: 1 0 84px; display: flex; flex-direction: column; min-width: 84px; }
.bk-col.champ { flex: 0.8 0 76px; min-width: 76px; }
.bk-h { font-weight: 900; color: var(--yellow); font-size: 12px; line-height: 1.15; min-height: 28px; }
.bk-h small { display: block; font-size: 10px; color: #9fc4ff; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-cells { flex: 1; display: flex; flex-direction: column; }
.bk-c { flex: 1; display: flex; align-items: center; position: relative; padding: 2px 0; }
.bk-m { position: relative; width: 100%; background: #1b3050; border: 1px solid #2c4772; border-radius: 6px; padding: 2px 5px; }
.bk-m.now { border-color: var(--yellow); box-shadow: 0 0 10px rgba(255, 210, 63, 0.45); }
.bk-p { display: flex; justify-content: space-between; gap: 4px; line-height: 15px; white-space: nowrap; }
.bk-p span { overflow: hidden; text-overflow: ellipsis; }
.bk-p b { color: #cfe6ff; font-weight: 800; }
.bk-p.won span, .bk-p.won b { color: #fff; font-weight: 900; }
.bk-p.lost { opacity: 0.45; }
.bk-p.me span { color: #6dff9a; font-weight: 900; }
.bk-p.tbd { color: rgba(255,255,255,0.35); }
.champ .bk-m { border-color: var(--yellow); text-align: center; }
.champ .bk-p { justify-content: center; font-size: 13px; line-height: 20px; }
/* 连线：每场往右伸一截；同一组的上下两场在右边连成竖线；下一轮每场从左边接进来 */
.bk-col:not(.champ) .bk-c::after { content: ''; position: absolute; left: 100%; top: 50%; width: 7px; border-top: 2px solid var(--bk-line); }
.bk-col:not(.champ):not(.r3) .bk-c::before { content: ''; position: absolute; left: calc(100% + 7px); border-left: 2px solid var(--bk-line); }
.bk-col:not(.champ):not(.r3) .bk-c.top::before { top: 50%; bottom: 0; }
.bk-col:not(.champ):not(.r3) .bk-c.bot::before { top: 0; bottom: 50%; }
.bk-col:not(.r0) .bk-m::before { content: ''; position: absolute; right: 100%; top: 50%; width: 8px; border-top: 2px solid var(--bk-line); }
@media (max-height: 550px) { /* 手机横屏：按钮并排，把高度让给晋级图 */
  #cupResult .cup-actions, #cupDone .cup-actions { flex-wrap: nowrap; }
  #cupResult .cup-actions .big-btn, #cupDone .cup-actions .big-btn { margin-top: 0; flex: 1; }
  #over.cup-over .final { font-size: 15px; margin-top: 0; }
  .bk-h { min-height: 24px; font-size: 11px; }
}
#cupResult h3, #cupDone h3 { text-align: center; } /* 左上角「在线」按钮会挡住靠左的标题 */
