/* ============================================================================
 * css/style.css — 浅色简洁风 · 桌面 / 手机双适配
 * ----------------------------------------------------------------------------
 * 交互模型：主页面 = 紧凑赛程总览（尽量一屏不滚动）；
 * 抽签与逐局模拟在浮层（.modal-overlay / .modal）中完成。
 * ==========================================================================*/

:root,
[data-theme="light"] {
  --font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --bg: #f4f6f9;
  --card: #ffffff;
  --ink: #182230;
  --ink-2: #445066;
  --muted: #5e6c82;
  --line: #e3e8f0;
  --line-2: #eef1f6;
  --accent: #2f6fd0;
  --accent-ink: #1d4f9c;
  --win: #148f5f;
  --win-bg: #e8f6ef;
  --bad: #c0403c;
  --bad-bg: #fbeeea;
  --gold: #b8860b;
  --card-2: #fbfcfe;
  --topbar-bg: rgba(255, 255, 255, .9);
  --champ-bg: linear-gradient(180deg, #fffdf4, #ffffff);
  --shadow: 0 1px 2px rgba(24, 34, 48, .05), 0 10px 24px -14px rgba(24, 34, 48, .22);
  --radius: 14px;
  --rc: #2f6fd0;
}

/* ---- 深色主题（html 或任意快照容器） ---- */
[data-theme="dark"] {
  --bg: #0f141b;
  --card: #171e29;
  --card-2: #1c2532;
  --ink: #e7edf6;
  --ink-2: #b9c4d6;
  --muted: #8090a6;
  --line: #2a3547;
  --line-2: #212b3a;
  --accent: #5b8ff0;
  --accent-ink: #7ea6f5;
  --win: #43cf8e;
  --win-bg: #12291f;
  --bad: #ef8b85;
  --bad-bg: #33191a;
  --gold: #d8a63c;
  --topbar-bg: rgba(15, 20, 27, .88);
  --champ-bg: linear-gradient(180deg, #241f0e, #171e29);
  --shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 14px 30px -18px rgba(0, 0, 0, .7);
  color-scheme: dark;
}
[data-theme="dark"] .toast { background: rgba(28, 37, 50, .97); border: 1px solid var(--line); }

/* ---- 主题切换双快照层：旧主题整屏淡出 + 新主题圆形扩张，内容全程可见 ---- */
.theme-ov {
  position: fixed; inset: 0; overflow: hidden;
  pointer-events: none;
  /* 必须盖过 sticky 顶栏(z:40) 与底部导航(z:60)，否则它们不跟随扩散 */
  z-index: 80;
}
.theme-clone {
  /* 复刻 body 的排版基底（内容结构由 JS 克隆填充） */
  position: absolute; top: 0; left: 0; width: 100%;
  background: var(--bg); color: var(--ink);
  font: var(--font);
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* 触屏：禁双击缩放（保留平移/捏合）、禁连点选字；hover 只在真鼠标设备生效 */
button, .smatch, .swtab, .nav-btn, .icon-btn {
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
body.modal-open { overflow: hidden; }

h1, h2, h3 { margin: 0 0 8px; line-height: 1.25; }
h1 { font-size: 22px; letter-spacing: .2px; }
h2 { font-size: 17px; }
p { margin: 6px 0; }
button { font-family: inherit; }

.app { min-height: 100dvh; display: flex; flex-direction: column; }

/* ------------------------------ 顶部 ------------------------------ */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--topbar-bg);
  backdrop-filter: saturate(1.1) blur(8px);
  border-bottom: 1px solid var(--line-2);
  padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
/* 只作用于真实顶栏（body 内），克隆快照里的按钮图标不受影响 */
html[data-theme="dark"] body .theme-btn .icon-moon { display: none; }
html:not([data-theme="dark"]) body .theme-btn .icon-sun { display: none; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #5a8df0);
  color: #fff; font-weight: 800; font-size: 13px;
  box-shadow: var(--shadow);
}
.brand-text { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav { display: flex; gap: 4px; }
.nav-btn {
  appearance: none; border: 0; background: transparent;
  padding: 7px 13px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; color: var(--ink-2);
  cursor: pointer; white-space: nowrap;
  transition: background .16s ease, color .16s ease;
}
.nav-btn.active { background: var(--accent); color: #fff; }
/* 锁定态只靠颜色弱化，不叠 opacity：保证文本对比度仍达 WCAG AA */
.nav-btn.locked { color: var(--muted); }

@media (max-width: 720px) {
  /* 顶栏随页面滚动（非 sticky），毛玻璃无意义；
     且 backdrop-filter 会捕获 fixed 后代的定位，把底导航困在顶栏下方 */
  .topbar { position: static; backdrop-filter: none; background: var(--card); }
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: var(--topbar-bg);
    backdrop-filter: saturate(1.1) blur(10px);
    border-top: 1px solid var(--line-2);
    padding: 6px 8px calc(8px + env(safe-area-inset-bottom, 0));
    justify-content: space-evenly;
  }
  .nav-btn { flex: 1; text-align: center; padding: 10px 4px; min-height: 44px; font-size: 13px; }
  .icon-btn { width: 40px; height: 40px; }
}

/* ------------------------------ 布局 ------------------------------ */
.view, .wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 12px 16px 88px; }
@media (min-width: 721px) { .view, .wrap { padding-bottom: 12px; } }

/* ------------------------------ 卡片 ------------------------------ */
.card, .board-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card { padding: 18px; margin-bottom: 14px; }
.board-card { padding: 8px; margin-bottom: 8px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 16px 2px 10px; }
.card-head h2 { margin: 0; font-size: 15.5px; }
.card-actions { margin-top: 12px; display: flex; justify-content: flex-end; }
.muted { color: var(--muted); font-size: 13px; }

/* ------------------------------ 按钮 ------------------------------ */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); border-radius: 10px;
  padding: 7px 13px; font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: background .14s ease, transform .1s ease, box-shadow .16s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:active { transform: translateY(1px); background: var(--line-2); }
.btn.primary:active { background: var(--accent-ink); }
.smatch:active { background: var(--line-2); }
.btn.primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 10px 22px -12px rgba(47, 111, 208, .6);
}
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.big { width: 100%; padding: 14px 16px; font-size: 16px; border-radius: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 悬停效果只在真鼠标设备生效（触屏避免粘滞 hover） */
@media (hover: hover) {
  .nav-btn:hover { background: var(--line-2); }
  .btn:hover { background: var(--line-2); }
  .btn.primary:hover { background: var(--accent-ink); }
  .smatch:hover { border-color: var(--accent); box-shadow: 0 8px 18px -12px rgba(47, 111, 208, .55); }
  .icon-btn:hover { background: var(--line-2); }
}

/* ------------------------------ 队伍完整卡片（浮层/首页） ------------------------------ */
.chip {
  --rc: var(--accent);
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 6px 10px; min-height: 38px; max-width: 100%;
}
.chip-empty { border-style: dashed; background: var(--line-2); }
.chip-empty .chip-name { color: var(--muted); font-style: italic; }
.chip-logo {
  flex: 0 0 28px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--rc); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; overflow: hidden;
}
/* 有真实队标的队伍：去掉赛区色圆底，仅保留圆形裁切 */
.chip-logo.has-img { background: none; }
.chip-img { width: 100%; height: 100%; object-fit: cover; }
.chip-main { display: flex; flex-direction: column; line-height: 1.12; min-width: 0; overflow: hidden; }
.chip-name { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-code { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  margin-right: 4px; vertical-align: 1px;
}


/* 紧凑队伍（赛程卡/积分条） */
.schip {
  display: inline-flex; align-items: center; gap: 5px;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12.2px; color: var(--ink);
}
.schip-logo {
  flex: none; width: 14px; height: 14px; border-radius: 50%; object-fit: cover;
}
.schip-seed {
  flex: none; width: 14px; height: 14px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 8.5px; font-weight: 800; font-style: normal;
}
.schip-empty { color: var(--muted); font-style: italic; font-size: 11.5px; }

/* ------------------------------ 阶段头部 ------------------------------ */
.stage-head { margin-bottom: 14px; }
.stage-head h1 { margin-bottom: 2px; }

.stage-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px 12px; flex-wrap: wrap; margin-bottom: 8px;
}
.sb-titles h1 { margin: 0; }
.sb-sub { color: var(--muted); font-size: 12.5px; }
.sb-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.advance-bar {
  position: sticky; bottom: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--accent);
  border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow);
}
.adv-txt { font-size: 14px; }

/* ------------------------------ 入围赛流程 ------------------------------ */
.flow { display: flex; align-items: stretch; gap: 8px; }
.flow-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.flow-label { font-size: 11.5px; font-weight: 800; color: var(--ink-2); letter-spacing: .4px; margin-top: 2px; }
.flow-arrow { align-self: center; color: var(--muted); font-weight: 800; }
.pi-out { margin-top: auto; font-size: 12px; color: var(--muted); text-align: center; padding: 8px 0; }
@media (max-width: 720px) {
  .flow { flex-direction: column; }
  .flow-arrow { transform: rotate(90deg); align-self: center; }
}

/* ------------------------------ 瑞士轮墙 ------------------------------ */
.swtabs { display: none; gap: 6px; align-items: center; margin-bottom: 10px; }
.swtabs-hint { font-size: 12px; color: var(--muted); margin-right: 4px; }
.swtab {
  width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink-2);
  font-weight: 800; font-size: 13px; cursor: pointer;
}
.swtab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.swiss-wall { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; align-items: start; }
.swcol { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.swcol-head { font-size: 11px; font-weight: 800; color: var(--ink-2); text-align: center; padding: 3px 0; background: var(--line-2); border-radius: 7px; }
.swcol-head .okdot { color: var(--win); }
@media (max-width: 860px) {
  .swiss-wall { grid-template-columns: 1fr; }
  .swcol { display: none; }
  .swcol.sel { display: flex; }
  .swtabs { display: flex; }
}

/* ------------------------------ 紧凑赛程卡（可点开浮层） ------------------------------ */
.smatch {
  position: relative;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 1px 6px; cursor: pointer;
  transition: border-color .14s ease, box-shadow .16s ease, transform .1s ease;
}
.smatch:active { transform: translateY(1px); }
/* 赛程卡可键盘聚焦（role="button"），焦点态与 hover 同等醒目 */
.smatch:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 111, 208, .13); outline: none; }
.smatch.next { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 111, 208, .13); }
.smatch.done { background: var(--card-2); }
.smatch.pending { opacity: .72; }
.sm-head { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; line-height: 1.2; }
.sm-label { font-size: 10px; font-weight: 700; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.3; }
.sm-fmt { font-size: 10px; font-weight: 800; color: var(--ink-2); flex: none; line-height: 1.3; }
.sm-team { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 0; border-top: 1px dashed var(--line-2); line-height: 1.15; min-height: 13px; }
.sm-team:first-of-type { border-top: 0; }
.sm-score { flex: none; min-width: 12px; text-align: right; font-size: 13.5px; font-weight: 700; color: var(--muted); }
.sm-team.win .sm-score { color: var(--win); font-weight: 800; }
.sm-team.win { font-weight: 600; }

/* ------------------------------ 淘汰赛树状图 ------------------------------ */
.round-cap { display: none; }
.bracket-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.bracket { display: flex; align-items: stretch; min-width: 700px; }
.bracket .round { display: flex; flex-direction: column; justify-content: space-around; flex: 1; padding: 12px 22px; position: relative; }
.bracket .pair { position: relative; display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.bracket .single { position: relative; }
.bracket .smatch { margin-bottom: 0; }
/* 连线 */
.bracket .round:not(:last-child) .smatch::after,
.bracket .round:not(:last-child) .single .smatch::after { content: ''; position: absolute; left: 100%; top: 50%; width: 22px; height: 2px; background: var(--line); }
.bracket .round:not(:last-child) .pair::after { content: ''; position: absolute; left: calc(100% + 22px); top: 25%; bottom: 25%; width: 2px; background: var(--line); }
.bracket .round:not(:first-child) .smatch::before { content: ''; position: absolute; right: 100%; top: 50%; width: 22px; height: 2px; background: var(--line); }
.ko-champ { text-align: center; font-size: 12.5px; color: var(--muted); padding: 10px 0 0; }

/* ------------------------------ 瑞士轮战绩条 ------------------------------ */
.stand-sep { border-top: 1px solid var(--line); margin: 8px 2px 6px; }
.stand-bar { display: flex; flex-direction: column; gap: 4px; }
.sgrp { display: grid; grid-template-columns: 54px 1fr; gap: 10px; align-items: center; padding: 2px 8px; border-radius: 7px; }
.sgrp.ok { background: var(--win-bg); }
.sgrp.bad { background: var(--bad-bg); opacity: .85; }
.srec { font-weight: 800; font-size: 13px; color: var(--ink-2); }
.steams { display: flex; flex-wrap: wrap; gap: 4px 14px; }

/* ------------------------------ 首页 ------------------------------ */
.hero { padding: 24px 22px; }
.hero-kicker { font-size: 12px; font-weight: 800; letter-spacing: 1.2px; color: var(--accent); margin-bottom: 6px; }
.hero h1 { font-size: 27px; margin: 2px 0 8px; }
.hero-actions { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 10px; }
.grid-teams { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
@media (max-width: 520px) { .grid-teams { grid-template-columns: repeat(2, 1fr); } }

/* ------------------------------ 战力调整 ------------------------------ */
.formula { background: var(--line-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; font-size: 14px; }
.f-line { padding: 3px 0; }
.formula code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--card); padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line); }
.sliders { display: grid; gap: 10px; }
.slider-row { display: grid; grid-template-columns: 150px 1fr 52px; gap: 12px; align-items: center; font-size: 14px; color: var(--ink-2); }
.slider-row output { text-align: right; font-weight: 700; }
.slider-row input[type="range"] { width: 100%; }
.rating-list { display: grid; gap: 8px; }
.rating-row {
  display: grid; grid-template-columns: 220px 1fr 60px 50px 50px; gap: 10px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px;
}
.rating-row .num { width: 100%; padding: 6px 6px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; text-align: center; }
.rating-row .form-num { color: var(--ink-2); }
@media (max-width: 620px) { .rating-row { grid-template-columns: 1fr; } }
.prob-table { margin-top: 12px; overflow-x: auto; }
table.prob { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.prob th, table.prob td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
table.prob th { color: var(--muted); font-weight: 700; font-size: 12.5px; }
.actions-bar { display: flex; justify-content: flex-end; gap: 10px; }

/* ------------------------------ 结果页 ------------------------------ */
.champion-card { text-align: center; padding: 24px 20px; background: var(--champ-bg); border-color: rgba(184, 134, 11, .4); }
.champion-badge { font-size: 34px; }
.champion-slot { display: inline-flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 6px; }
.champion-card .card-actions { justify-content: center; margin-top: 14px; }

/* ------------------------------ 浮层（抽签 / 对局） ------------------------------ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 23, 38, .55);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: overlayIn .16s ease;
}
.modal {
  background: var(--card); border-radius: 16px;
  width: 100%; max-width: 620px; max-height: calc(100dvh - 36px);
  overflow-y: auto; padding: 16px 18px 18px;
  box-shadow: 0 30px 80px -24px rgba(0, 0, 0, .5);
  animation: modalIn .22s cubic-bezier(.2, .9, .3, 1.15);
}
@keyframes overlayIn { from { opacity: 0; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.97); } }

.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.modal-head h2 { margin: 0; }
.modal-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
#dm-sub { margin: -6px 0 10px; font-size: 12.5px; color: var(--muted); }
.modal-foot { margin-top: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; position: sticky; bottom: -18px; background: var(--card); padding: 12px 0 4px; }
.modal-foot .btn { flex: 1; min-width: 140px; }
.btn.big { letter-spacing: .3px; }
.bf-sub { font-size: 11.5px; opacity: .75; font-weight: 600; margin-left: 2px; }
.mm-second { margin-top: 8px; display: flex; gap: 8px; }
.mm-second .btn { flex: 1; }
.dm-status { margin-top: 8px; text-align: center; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 5px; }
.dm-status.done { display: inline-flex; gap: 5px; align-items: center; justify-content: center; width: 100%; color: var(--win); }
.champ-inline { display: inline-flex; align-items: center; gap: 5px; }
.icon-btn {
  appearance: none; border: 1px solid var(--line); background: var(--card);
  width: 34px; height: 34px; border-radius: 9px; color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none;
}
.ic { display: inline-block; vertical-align: -2px; flex: none; }
.flow-arrow .ic { color: var(--muted); }
.swcol-head .ic { color: var(--win); margin-left: 2px; vertical-align: -1px; }
.champion-badge { color: var(--gold); display: inline-flex; }
.champion-badge .ic { width: 44px; height: 44px; }

/* 抽签浮层 */
.dm-rows { display: flex; flex-direction: column; gap: 6px; }
.dm-row { display: grid; grid-template-columns: 118px 1fr; gap: 10px; align-items: center; padding: 4px 6px; border-radius: 10px; background: var(--line-2); }
.dm-label { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.dm-vs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; align-items: center; }
/* 固定高度：待抽(1行) 与 已落位(2行) 等高，抽签过程中按钮位置不动 */
.dm-vs .chip { width: 100%; height: 48px; }
.dm-vsmark { font-size: 11px; font-weight: 800; color: var(--muted); }
/* 待抽池在按钮下方：内容多少都不影响主按钮位置 */
#dm-pool { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; padding: 0 2px; }
.dm-pool-label { font-size: 12px; color: var(--muted); margin-right: 2px; }
.pool-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 10px; font-size: 12.5px; font-weight: 600;
}
.pool-chip i { font-style: normal; font-size: 10.5px; color: var(--muted); }
.dm-done { margin-top: 14px; text-align: center; font-weight: 700; color: var(--win); background: var(--win-bg); border-radius: 10px; padding: 12px; }

/* 对局浮层 */
.mm-teams { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; padding: 8px 2px; }
.mm-team { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mm-team .chip { width: 100%; }
.mm-team.win .chip { border-color: var(--win); box-shadow: 0 0 0 3px rgba(20, 143, 95, .12); }
.mm-score { font-size: 34px; font-weight: 800; color: var(--ink); text-align: center; min-width: 84px; }

.mm-games { margin-top: 10px; height: 38px; overflow-y: auto; font-size: 13px; color: var(--ink-2); background: var(--line-2); border-radius: 10px; padding: 8px 12px; box-sizing: border-box; }
.mm-games b { font-weight: 700; }
.mm-note { min-height: 46px; margin-top: 10px; display: flex; align-items: center; justify-content: center; }
.mm-note:empty { display: none; }
.mm-winner { text-align: center; font-size: 14px; color: var(--win); font-weight: 700; background: var(--win-bg); border-radius: 10px; padding: 10px 12px; width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.mm-empty { padding: 26px 10px; text-align: center; color: var(--muted); }

/* ------------------------------ Toast ------------------------------ */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(10px);
  bottom: 24px; z-index: 200;
  background: rgba(23, 32, 43, .94); color: #fff;
  padding: 9px 16px; border-radius: 999px; font-size: 13px;
  box-shadow: var(--shadow);
  opacity: 0; pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (max-width: 720px) { .toast { bottom: calc(64px + env(safe-area-inset-bottom, 0px) + 8px); } }


/* ============================================================================
 * 手机端布局重设计（≤720px）：不是缩放桌面，而是按手机重排
 * ==========================================================================*/
@media (max-width: 720px) {
  /* ---- 阶段头：标题与操作上下排，按钮变成通栏拇指按钮 ---- */
  .stage-bar { display: block; }
  .sb-titles h1 { font-size: 20px; }
  .sb-actions { margin-top: 10px; display: flex; gap: 8px; }
  .sb-actions .btn { flex: 1; min-width: 0; min-height: 44px; }
  .sb-sub { display: block; margin-top: 2px; }

  /* ---- 首页：按钮通栏 ---- */
  .hero { padding: 18px 16px; }
  .hero h1 { font-size: 23px; }
  .hero-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .hero-actions .btn { min-height: 44px; }
  .grid-teams { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* ---- 通用按钮触目标 ---- */
  .btn { min-height: 44px; }
  .btn.small { min-height: 32px; }

  /* ---- 入围赛：纵向赛程流，卡片通栏 ---- */
  .flow { gap: 6px; }
  .flow-col { gap: 8px; }
  .flow-label { font-size: 12px; padding: 4px 2px 0; }
  .flow-arrow { padding: 2px 0; }

  /* ---- 淘汰赛：横向树 → 纵向分区（八强 / 半决赛 / 决赛） ---- */
  .bracket-scroll { overflow: visible; }
  .bracket { flex-direction: column; min-width: 0; }
  .bracket .round { display: block; padding: 0; }
  .round-cap {
    display: block; font-size: 12px; font-weight: 800; color: var(--ink-2);
    padding: 12px 2px 6px;
  }
  .bracket .pair { display: block; gap: 0; }
  .bracket .single { margin-bottom: 8px; }
  .bracket .pair .smatch { margin-bottom: 8px; }
  .bracket .smatch::before, .bracket .smatch::after,
  .bracket .pair::after { content: none; }
  .bracket .single .smatch { margin-bottom: 8px; }
  .bracket .round:last-child .single .smatch { margin-bottom: 0; }
  .ko-champ { padding: 12px 0 2px; }

  /* ---- 对局浮层：队伍上下堆叠，比分居中 ---- */
  .mm-teams { grid-template-columns: 1fr; gap: 6px; }
  .mm-team { flex-direction: row; align-items: center; gap: 10px; }
  .mm-team .chip { flex: 1; }
  .mm-score { font-size: 26px; min-width: 0; }

  /* ---- 抽签浮层：标签在上一行，两支队伍一行两个 ---- */
  .dm-row { grid-template-columns: 1fr; gap: 4px; }
  .dm-label { font-size: 12px; }

  /* ---- 浮层改底部抽屉：贴底弹出、通栏、圆角在顶 ---- */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    max-width: 100%;
    max-height: 92dvh;
    border-radius: 16px 16px 0 0;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    animation-name: sheetIn;
  }
  @keyframes sheetIn {
    from { opacity: 0; transform: translateY(48px); }
    to { opacity: 1; transform: none; }
  }
  .modal-foot { bottom: 0; padding-bottom: 4px; }

  /* ---- 瑞士轮轮次切换：更大的触目标 ---- */
  .swtab { width: 42px; height: 36px; }

  /* ---- toast 避让加高后的底部导航 ---- */
  .toast { bottom: calc(72px + env(safe-area-inset-bottom, 0px) + 8px); }

  /* ---- 晋级条 sticky 到视口底时给 fixed 底导航留出高度（6+44+8px），
          主 CTA 不被底导航盖住（须在基础 .advance-bar 规则之后） ---- */
  .advance-bar { bottom: calc(58px + env(safe-area-inset-bottom, 0px)); }
}
