/*
 * 赛事中心统一顶栏 + 页脚串联。各页面只需设置以下颜色变量：
 *   --nav-fg      主文字色
 *   --nav-muted   次要文字色
 *   --nav-line    分隔线 / 按钮描边
 *   --nav-hover   按钮悬停底色
 *   --nav-ok      同步成功的圆点色；也是头像首字底色
 *   --nav-bg      顶栏底色（“飞书登录”按钮反色文字、头像首字颜色用）
 * 台球是独立站点，同一份样式内联在它自己的页面里，改这里时记得同步。
 */
.topbar {
  position: relative;
  z-index: 20;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--nav-line);
  color: var(--nav-fg);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--nav-fg);
  font-size: 1rem;
  font-weight: 900;
  cursor: default;
  user-select: none;
}
.brand-icon { width: 28px; height: 28px; flex: none; }
.top-right { display: flex; align-items: center; gap: 16px; }
.top-note { color: var(--nav-muted); font-size: 0.78rem; font-weight: 700; }
.sync {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--nav-muted);
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}
.sync::before { content: ""; width: 7px; height: 7px; flex: none; border-radius: 50%; background: #e0a43a; }
.sync[data-mode="ok"]::before { background: var(--nav-ok); }
.sync[data-mode="error"]::before { background: #e0674f; }
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--nav-line);
  border-radius: 999px;
  color: var(--nav-fg);
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
  transition: background 160ms ease;
}
.back:hover { background: var(--nav-hover); }

/* 右上角飞书身份（Kit.auth）：未登录“飞书登录”，登录后头像 + 名字，点开只有“退出登录”。接口不通时整块隐藏 */
.me-wrap { position: relative; flex: none; }
.me-wrap[hidden] { display: none; }
.login-btn {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--nav-fg);
  color: var(--nav-bg, #fff);
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
  transition: opacity 160ms ease;
}
.login-btn:hover { opacity: 0.86; }
.me-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 168px;
  min-height: 34px;
  padding: 2px 12px 2px 2px;
  border: 1px solid var(--nav-line);
  border-radius: 999px;
  background: transparent;
  color: var(--nav-fg);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 160ms ease;
}
.me-btn:hover, .me-btn[aria-expanded="true"] { background: var(--nav-hover); }
.me-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-avatar {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  overflow: hidden;
  border-radius: 50%;
  background: var(--nav-ok);
  color: var(--nav-bg, #fff);
  font-style: normal;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
}
.me-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.me-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  min-width: 120px;
  padding: 6px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(20, 16, 24, 0.06), 0 12px 32px rgba(20, 16, 24, 0.18);
}
.me-menu[hidden] { display: none; }
.me-menu a {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  color: #15131a;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}
.me-menu a:hover, .me-menu a:focus-visible { background: rgba(20, 16, 24, 0.06); outline: none; }

/* 页脚：串联其他赛事 */
.event-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 8px;
  margin-top: 10px;
  font-size: 0.76rem;
}
.event-links span { color: var(--nav-muted); font-weight: 700; }
.event-links a {
  padding: 4px 12px;
  border: 1px solid var(--nav-line);
  border-radius: 999px;
  color: inherit;
  font-weight: 800;
}
.event-links a:hover { background: var(--nav-hover); }
.event-links a[aria-current="page"] { display: none; }

@media (max-width: 580px) {
  .sync { font-size: 0; gap: 0; }
  .top-note { display: none; }
  .top-right { gap: 10px; }
  /* 手机：只留头像，名字在读屏标签和悬停提示里 */
  .me-btn { padding: 2px; border-color: transparent; }
  .me-name { display: none; }
  .login-btn { min-height: 30px; padding: 0 12px; font-size: 0.74rem; }
}

/* ---------- 共享交互组件的结构样式（颜色继承各页变量） ---------- */

/* 提示条里的“撤销” */
.toast.has-action { display: inline-flex; align-items: center; gap: 12px; pointer-events: auto; }
.toast-action { padding: 2px 10px; border: 1px solid currentColor; border-radius: 999px; background: transparent; color: inherit; font: inherit; font-size: 0.76rem; font-weight: 900; cursor: pointer; }

/* 报名名单：点名字改名 */
.chip-name { padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: text; }
.chip-name:hover { text-decoration: underline dotted; text-underline-offset: 3px; }
.chip.is-editing { padding: 0; border-color: transparent; }
.chip-input { width: 9em; height: 28px; padding: 0 10px; border: 1px solid var(--nav-line); border-radius: 999px; background: transparent; color: inherit; font: inherit; font-size: 0.76rem; font-weight: 800; }
.chip-input[aria-invalid="true"] { border-color: #e0674f; }
.chip.is-new { animation: chip-in 600ms ease; }
@keyframes chip-in { from { transform: scale(0.8); opacity: 0; } }
.my-actions { display: flex; flex: none; gap: 6px; }

/* 签表放不下时按轮次上下排（不画连线、不横向滚动） */
.ko-board.is-stacked { overflow: visible; }
.ko-board.is-stacked .ko-lines { display: none; }
.ko-board.is-stacked .ko-rounds { flex-direction: column; gap: 22px; width: auto; margin: 0; }
.ko-board.is-stacked .ko-round { width: 100%; }
.ko-board.is-stacked .ko-title { margin-bottom: 10px; text-align: left; }
.ko-board.is-stacked .ko-matches { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ko-board.is-stacked .champion { min-height: 64px; }
@media (prefers-reduced-motion: reduce) { .chip.is-new { animation: none; } }

/* 子页返回赛事中心：左上角，与品牌用细竖线分隔 */
.brand-group { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-group .back { padding: 0; border-color: transparent; }
.brand-group .back:hover { background: transparent; color: var(--nav-ok); }
.brand-group .brand { min-width: 0; white-space: nowrap; }
.brand-divider { width: 1px; height: 22px; flex: none; background: var(--nav-line); }
.back-icon { display: none; }
@media (max-width: 580px) {
  .brand-group { gap: 9px; }
  .brand-group .back span:not(.back-icon) { display: none; }
  .brand-group .back .back-icon { display: inline; font-size: 1.1rem; }
  .brand-divider { height: 18px; }
  .brand-group .brand { font-size: 0.92rem; gap: 7px; }
}
