:root {
  color-scheme: light;

  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-2: #f7f9f6;
  --surface-3: #eef2ed;

  --line: rgba(20, 35, 25, 0.1);
  --line-2: rgba(20, 35, 25, 0.18);

  --text: #14201a;
  --text-2: #5b6b62;
  --text-3: #5f6d65;

  --accent: #0f7a49;
  --accent-bright: #0b6b3f;
  --accent-soft: rgba(31, 157, 99, 0.1);
  --accent-line: rgba(31, 157, 99, 0.32);

  --danger: #b03a35;
  --warn: #a8741a;

  --radius-lg: 20px;
  --radius: 14px;
  --radius-sm: 10px;

  --shadow-sm: 0 4px 16px rgba(19, 38, 28, 0.06);
  --shadow-lg: 0 24px 60px rgba(19, 38, 28, 0.16);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-bright);
  text-decoration: none;
}

/* ---------- 顶栏 ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-bright);
  font-weight: 700;
  font-size: 15px;
}

.brand h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 布局 ---------- */

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 18px 90px;
}

/* 现场 / 抽签的结构图需要更宽的画布 */
.page.is-wide {
  max-width: min(1500px, calc(100vw - 36px));
}

.page-head {
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-bright);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.page-title {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1.3;
}

.subtitle {
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
}

/* ---------- 卡片 ---------- */

.card {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card + .card {
  margin-top: 12px;
}

.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 4px;
  font-size: 16px;
}

.card-meta {
  margin: 0;
  color: var(--text-3);
  font-size: 13px;
}

/* ---------- 项目列表 ---------- */

.project-list {
  display: grid;
  gap: 10px;
}

.project-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.project-item > .btn {
  flex: none;
}

.project-item h3 {
  margin: 0 0 3px;
  font-size: 15px;
}

.project-item .sub {
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.project-item .sub strong {
  color: var(--text-2);
}

.project-item.is-full .sub strong {
  color: var(--warn);
}

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-bright);
}

.btn-ghost {
  background: var(--surface);
  border-color: var(--line-2);
  color: var(--text-2);
}

.btn-ghost:hover:not(:disabled) {
  border-color: var(--accent-line);
  color: var(--accent-bright);
}

.btn-danger {
  background: transparent;
  border-color: rgba(201, 74, 68, 0.3);
  color: var(--danger);
}

.btn-small {
  min-height: 38px;
  padding: 8px 14px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
}

/* ---------- 表单 ---------- */

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  color: var(--text-2);
  font-size: 13px;
}

.field input,
.field select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}

.field input:focus,
.field select:focus {
  outline: 2px solid var(--accent-line);
  outline-offset: 1px;
  border-color: transparent;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-hint {
  margin: 0;
  color: var(--text-3);
  font-size: 12px;
}

.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.check-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}

.field .check-item input[type='checkbox'] {
  width: 16px;
  height: 16px;
  padding: 0;
  margin: 0;
  accent-color: var(--accent);
}

/* ---------- 进度 ---------- */

.progress {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--line);
  margin-bottom: 14px;
}

.progress-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--text-2);
}

.progress-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.progress-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.3s ease;
}

/* ---------- 徽标 ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-bright);
  font-size: 12px;
  white-space: nowrap;
}

.pill.is-warn {
  background: rgba(168, 116, 26, 0.12);
  color: var(--warn);
}

.pill.is-muted {
  background: var(--surface-3);
  color: var(--text-3);
}

/* ---------- 成员列表 ---------- */

.member-list {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.member-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.member-row .who {
  flex: 1;
  min-width: 0;
}

.member-row .who strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-row .who span {
  color: var(--text-3);
  font-size: 12px;
}

.member-row .ops {
  display: flex;
  gap: 6px;
  flex: none;
}

.member-row.is-toggle {
  width: 100%;
  border: none;
  border-radius: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.member-row.is-toggle:hover {
  background: var(--surface-2);
}

/* ---------- 提示 ---------- */

.notice {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.55;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--line);
}

.notice.is-error {
  background: rgba(201, 74, 68, 0.08);
  color: var(--danger);
  border-color: rgba(201, 74, 68, 0.2);
}

.notice.is-ok {
  background: var(--accent-soft);
  color: var(--accent-bright);
  border-color: var(--accent-line);
}

.notice.is-warn {
  background: rgba(168, 116, 26, 0.1);
  color: var(--warn);
  border-color: rgba(168, 116, 26, 0.2);
}

/* ---------- 空状态 / 加载 ---------- */

.empty {
  padding: 44px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
}

.loading {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
}

/* ---------- 弹窗 ---------- */

dialog.sheet {
  width: min(520px, calc(100vw - 20px));
  max-height: 90vh;
  padding: 0;
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

dialog.sheet::backdrop {
  background: rgba(20, 32, 26, 0.42);
}

.sheet-body {
  display: grid;
  gap: 4px;
  padding: 22px;
  max-height: calc(90vh - 84px);
  overflow: auto;
}

.sheet-body h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.sheet-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 22px 22px;
}

/* ---------- 链接框 ---------- */

.link-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px dashed var(--accent-line);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  font-size: 13px;
  word-break: break-all;
}

.link-box code {
  flex: 1;
  color: var(--accent-bright);
  font-size: 12px;
}

/* ---------- 小工具 ---------- */

.muted {
  color: var(--text-3);
  font-size: 13px;
}

.stack > * + * {
  margin-top: 12px;
}

@media (max-width: 480px) {
  .page {
    padding: 18px 14px 80px;
  }

  .page-title {
    font-size: 21px;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .project-item {
    padding: 14px;
  }
}

/* ---------- 干事后台：队伍展开 ---------- */

.team-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.team-filters .tab {
  padding: 6px 12px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.team-filters .tab.is-active {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-bright);
}

.team-card {
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}

.team-card .member-row {
  border: none;
  border-radius: 0;
}

.team-detail {
  display: grid;
  gap: 6px;
  padding: 10px 14px 12px;
  border-top: 1px dashed var(--line);
  font-size: 13px;
  color: var(--text-2);
}

.team-detail .line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.team-detail .line strong {
  color: var(--text);
}

/* ---------- 报名页：赛事状态行 ---------- */

.event-window::before {
  content: '●';
  margin-right: 6px;
  font-size: 9px;
  vertical-align: 1px;
  color: var(--text-3);
}

.event-window[data-phase="open"]::before {
  color: var(--accent);
}

/* ---------- 社员标签 ---------- */

.pill.is-member {
  background: transparent;
  border: 1px solid var(--accent-line);
  color: var(--accent-bright);
}

.field textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  resize: vertical;
}

/* ---------- 签表 ---------- */

.bracket-wrap {
  position: relative;
  height: 520px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  touch-action: none;
  cursor: grab;
}

.bracket-wrap:active {
  cursor: grabbing;
}

.bracket-stage {
  transform-origin: 0 0;
  will-change: transform;
}

.bracket-svg {
  display: block;
}

.node-box {
  fill: var(--surface);
  stroke: #d7e0da;
  stroke-width: 1;
}

.node-name {
  font-size: 13px;
  fill: var(--text);
}

.node-name.is-bye {
  fill: var(--text-3);
}

.node-name.is-winner {
  font-weight: 600;
}

.edge {
  fill: none;
  stroke: #d3dcd6;
  stroke-width: 1.5;
}

.round-label {
  font-size: 12px;
  font-weight: 600;
  fill: var(--text-3);
}

.draw-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.draw-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.draw-row .who {
  min-width: 0;
}

.draw-row .who strong {
  display: block;
  font-size: 14px;
}

.draw-row .who span {
  color: var(--text-3);
  font-size: 12px;
}

.draw-row .ops {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

@media (max-width: 640px) {
  .draw-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .draw-row .ops {
    justify-content: flex-start;
  }

  .card-title {
    flex-wrap: wrap;
  }

  .card-title .draw-tools {
    width: 100%;
  }
}

/* ---------- 成绩 ---------- */

.standing-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.standing-row:last-of-type {
  border-bottom: none;
}

.standing-row strong {
  font-size: 14px;
}

.standing-row .card-meta {
  margin-left: auto;
  text-align: right;
}

.standing-rank {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 700;
}

.standing-rank.is-first {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---------- 小组赛分组 ---------- */

.group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.group-card {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.group-card h4 {
  margin: 0 0 8px;
  font-size: 13px;
}

.group-matches {
  display: grid;
  gap: 5px;
  font-size: 12px;
  color: var(--text-2);
}

.group-match {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.group-match .vs {
  color: var(--text-3);
}

/* ---------- 记分弹窗 ---------- */

.game-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.game-row .game-label {
  flex: none;
  width: 52px;
  color: var(--text-2);
  font-size: 13px;
}

.game-row input {
  width: 64px;
  padding: 9px 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  text-align: center;
}

.game-row .game-sep {
  color: var(--text-3);
}

/* ---------- 编辑器节点 ---------- */

.node .side {
  font-size: 13px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.node .side.is-winner {
  font-weight: 600;
  color: var(--accent-bright);
}

.node .side.is-loser {
  color: var(--text-3);
  text-decoration: line-through;
}

.node .score {
  font-size: 11px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.node.is-done {
  border-color: var(--accent-line);
}

.btn.is-pulse {
  animation: btn-pulse 0.9s ease 2;
}

@keyframes btn-pulse {
  50% {
    box-shadow: 0 0 0 6px var(--accent-soft);
  }
}

/* ---------- 赛事列表 ---------- */

.event-list {
  display: grid;
  gap: 8px;
}

.event-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.event-row .event-name {
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-row .event-meta {
  color: var(--text-3);
  font-size: 12px;
  white-space: nowrap;
}

.event-row .event-ops {
  display: flex;
  gap: 6px;
}

@media (max-width: 760px) {
  .event-row {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 8px;
  }

  .event-row .event-meta {
    display: none;
  }

  .event-row .event-ops {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}

.group-match-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.group-match-row:hover {
  border-color: var(--accent-line);
}

.group-match-row.is-playing {
  border-color: var(--warn);
  background: #fffdf7;
}

.group-match-row .score {
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.team-match-info {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-table {
  display: grid;
  gap: 2px;
  margin-bottom: 8px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.group-table-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 52px 44px 56px;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--text-2);
}

.group-table-row > span:first-child {
  color: var(--text-3);
}

.group-table-row > span:not(:nth-child(2)) {
  text-align: right;
}

.group-table-row:nth-child(2n) {
  background: var(--surface-2);
}

.group-table-row.is-head {
  color: var(--text-3);
  font-size: 11px;
  background: none;
}

.group-table-row.is-qualified {
  color: var(--text);
  font-weight: 600;
}

.group-table-row.is-qualified > span:first-child {
  color: var(--accent-bright);
}

/* ---------- 组卡内的比赛列表（现场页 / 公开页共用） ---------- */

.live-node.is-group {
  align-content: start;
  gap: 4px;
}

.live-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.live-group-meta {
  color: var(--text-2);
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
}

.group-match-list {
  display: grid;
  gap: 1px;
  min-width: 0;
  margin-left: 3px;
  padding-left: 8px;
  border-left: 1px solid var(--line-2);
}

.group-match-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  text-align: left;
}

button.group-match-line {
  cursor: pointer;
}

button.group-match-line:hover {
  color: var(--accent-bright);
}

.group-match-names {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-match-score {
  color: var(--text-2);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.group-match-more {
  color: var(--text-2);
  font-size: 11px;
}

.group-match-line.is-playing {
  color: var(--warn);
  font-weight: 600;
}

.group-match-score.is-court {
  color: var(--warn);
}

/* ---------- 现场对阵图 ---------- */

.live-board {
  position: relative;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  max-height: 70vh;
  touch-action: none;
  user-select: none;
  overscroll-behavior: contain;
  cursor: grab;
}

.live-board:active {
  cursor: grabbing;
}

.board-view-tabs {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 4;
  display: flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-sm);
}

.board-view-tab {
  border: 0;
  background: transparent;
  padding: 4px 12px;
  border-radius: 999px;
  color: var(--text-2);
  font-size: 12px;
  cursor: pointer;
}

.board-view-tab.is-active {
  background: var(--accent);
  color: #fff;
}

/* 排位赛：固定大小的紧凑小签表，不再缩放 */
.live-board.is-placement-board {
  touch-action: auto;
  cursor: default;
  overflow-y: auto;
  padding: 12px 14px 18px;
}

.live-board.is-placement-board .board-view-tabs {
  position: sticky;
  top: 0;
  z-index: 6;
  width: fit-content;
  margin-bottom: 14px;
}

.placement-view {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 1000px;
}

.placement-family {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.placement-family-title {
  margin: 0;
  font-size: 14px;
  color: var(--text-2);
}

.placement-columns {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.placement-column {
  display: flex;
  flex: 1;
  min-width: 0;
  max-width: 480px;
  flex-direction: column;
  gap: 10px;
}

.placement-column-label {
  font-size: 11px;
  color: var(--text-3);
}

.placement-card {
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--surface);
}

.placement-card.is-playing {
  border-color: var(--warn);
  box-shadow: 0 0 0 2px rgba(168, 116, 26, 0.15);
}

.placement-card.is-done {
  background: var(--surface-2);
}

.placement-card.is-clickable {
  cursor: pointer;
}

.placement-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.placement-card-title {
  font-size: 13px;
  font-weight: 600;
}

.placement-card-status {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-3);
}

.placement-side {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 0;
  font-size: 13px;
}

.placement-side.is-winner {
  font-weight: 700;
}

.placement-side.is-loser {
  color: var(--text-2);
}

.placement-score {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-2);
}

.placement-dest {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-3);
}

@media (max-width: 640px) {
  .placement-columns {
    flex-direction: column;
    gap: 12px;
  }

  .placement-column {
    width: 100%;
  }

  .placement-column-label {
    font-weight: 700;
    color: var(--text-2);
  }
}

/* ---------- 场地总览 ---------- */

.court-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 2px;
}

.court-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  max-width: 280px;
  padding: 7px 11px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
}

.court-chip:hover {
  border-color: var(--accent-line);
}

.court-chip.is-busy {
  border-color: var(--warn);
  background: #fffdf7;
  color: var(--text);
}

.court-chip-no {
  color: var(--text-3);
  font-weight: 600;
  white-space: nowrap;
}

.court-chip.is-busy .court-chip-no {
  color: var(--warn);
}

.court-chip-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.court-name-list {
  display: grid;
  gap: 8px;
}

.court-name-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.court-name-no {
  color: var(--text-2);
  font-size: 13px;
  white-space: nowrap;
}

.court-name-row input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}

.court-name-row input:focus {
  outline: 2px solid var(--accent-line);
  outline-offset: 1px;
  border-color: transparent;
}

.live-stage {
  position: relative;
  transform-origin: 0 0;
  will-change: transform;
}
  transform-origin: 0 0;
}

.live-edges {
  position: absolute;
  inset: 0;
  overflow: visible;
}

.live-edges path {
  fill: none;
  stroke: #b3c0b7;
  stroke-width: 1.6;
}

.live-edges path.is-loser {
  stroke: #b8863b;
  stroke-dasharray: 6 4;
}

.live-node {
  position: absolute;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid rgba(20, 35, 25, 0.24);
  border-radius: 12px;
  background: var(--surface);
  font-size: 14px;
  line-height: 1.35;
  box-shadow: var(--shadow-sm);
}

.live-node.is-playable {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
  cursor: pointer;
}

.live-node.is-playable:hover {
  border-color: var(--accent);
}

.live-node.is-playing {
  border-color: var(--warn);
  background: #fffdf7;
  box-shadow: 0 0 0 3px rgba(168, 116, 26, 0.16);
  cursor: pointer;
}

.live-node.is-playing:hover {
  border-color: var(--warn);
}

.live-match-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.live-court {
  color: var(--warn);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.live-placement {
  color: #8a5a12;
  background: #fdf3df;
  border: 1px solid #ecd9b0;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.live-result {
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.live-result.is-bye {
  color: var(--text-2);
  background: var(--surface-3);
  border: 1px solid var(--line);
}

.live-result.is-forfeit {
  color: var(--danger);
  background: rgba(176, 58, 53, 0.08);
  border: 1px solid rgba(176, 58, 53, 0.24);
}

.group-match-score.is-void {
  color: var(--text-2);
  font-weight: 600;
}

.live-node.is-placement {
  border-style: dashed;
  border-color: var(--warn);
}

.live-node.is-done {
  background: var(--surface-2);
}

.live-node.is-waiting .live-side {
  color: var(--text-2);
}

.live-node.is-group {
  border-style: dashed;
  border-color: rgba(15, 122, 73, 0.45);
  cursor: pointer;
}

.live-node .live-title {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 600;
}

.live-node .live-side {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--text);
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-node .live-side.is-winner {
  color: var(--accent-bright);
  font-weight: 600;
}

.live-node .live-side.is-loser {
  color: var(--text-3);
  text-decoration: line-through;
}

.live-node .live-score {
  font-size: 13px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

/* ---------- 手机端现场：竖排卡片 ---------- */

.mobile-board {
  display: grid;
  gap: 10px;
  padding: 2px 0 6px;
}

.mobile-section-title {
  margin: 12px 0 0;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}

.mobile-card {
  display: grid;
  gap: 7px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  box-shadow: var(--shadow-sm);
}

button.mobile-card {
  cursor: pointer;
}

.mobile-card.mobile-group {
  border-style: dashed;
  border-color: rgba(15, 122, 73, 0.45);
  cursor: pointer;
}

.mobile-card.mobile-match.is-playable {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.mobile-card.mobile-match.is-playing {
  border-color: var(--warn);
  background: #fffdf7;
  box-shadow: 0 0 0 3px rgba(168, 116, 26, 0.16);
}

.mobile-card.mobile-match.is-done {
  background: var(--surface-2);
}

.mobile-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.mobile-card-title {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.mobile-card-meta {
  color: var(--text-2);
  font-size: 12px;
  white-space: nowrap;
}

.mobile-court {
  color: var(--warn);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.mobile-side {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--text);
  font-size: 15px;
}

.mobile-side.is-winner {
  color: var(--accent-bright);
  font-weight: 700;
}

.mobile-side.is-loser {
  color: var(--text-3);
  text-decoration: line-through;
}

.mobile-score {
  color: var(--text-2);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.mobile-card .group-match-list {
  margin-top: 2px;
}

@media (max-width: 640px) {
  .court-strip {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
  }

  .court-chip {
    flex: 0 0 auto;
  }

  .group-match-line,
  .group-match-score {
    font-size: 13px;
  }

  /* iOS 上输入框小于 16px 会在聚焦时自动放大页面 */
  .field input,
  .field select,
  .field textarea,
  .game-row input,
  .court-name-row input {
    font-size: 16px;
  }
}

/* ---------- 队员名单 ---------- */

.team-name.is-link {
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
}

.team-name.is-link:hover {
  color: var(--accent-bright);
}

.roster-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.roster-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.roster-name {
  font-weight: 600;
}

.roster-gender {
  font-size: 12px;
  padding: 1px 9px;
  border-radius: 999px;
}

.roster-gender.is-female {
  background: rgba(190, 70, 120, 0.12);
  color: #9c3b63;
}

.roster-gender.is-male {
  background: rgba(40, 90, 160, 0.1);
  color: #2d5f9e;
}

.roster-block {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.roster-block-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
}

.roster-block-meta {
  color: var(--text-2);
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
}

.roster-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.roster-chip {
  padding: 3px 9px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface);
  font-size: 12px;
}

.roster-chip.is-female {
  color: #9c3b63;
  border-color: rgba(190, 70, 120, 0.3);
}

.roster-chip.is-male {
  color: #2d5f9e;
  border-color: rgba(40, 90, 160, 0.25);
}

.score-rosters {
  display: grid;
  gap: 8px;
  margin: 10px 0;
}

.score-extra {
  display: grid;
  gap: 8px;
  margin: 12px 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.score-extra-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.score-extra-label {
  min-width: 30px;
  color: var(--text-2);
  font-size: 12px;
}

.btn.is-on {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-bright);
}

.score-history {
  display: grid;
  gap: 6px;
  max-height: 190px;
  margin-top: 12px;
  overflow: auto;
}

.score-history-row {
  display: grid;
  gap: 2px;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 12px;
}

.score-history-row strong {
  font-weight: 600;
  color: var(--text);
}

.score-history-row span {
  color: var(--text-2);
}

.ref-rosters {
  display: grid;
  gap: 8px;
}

.mobile-members {
  margin: -2px 0 2px 8px;
  color: var(--text-2);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 登录页 ---------- */

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--bg);
}

.login-card {
  display: grid;
  gap: 18px;
  width: min(420px, 100%);
  padding: 30px 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.login-card .brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.login-card h1 {
  font-size: 18px;
  margin: 0;
}

.login-hint {
  margin: 0;
}

.login-submit {
  width: 100%;
}

.login-foot {
  margin: 0;
  color: var(--text-2);
  font-size: 12px;
  text-align: center;
}

.login-foot a {
  color: var(--accent);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (max-width: 640px) {
  .topbar-actions .hint {
    display: none;
  }
}
