:root {
  --bg: #eef2ee;
  --card: #ffffff;
  --ink: #14241f;
  --muted: #61766f;
  --primary: #0f6b52;
  --primary-dark: #0b5440;
  --accent: #eaa32a;
  --line: #dce5df;
  --danger: #c2413a;
  --ok: #1f8a5b;
  --radius: 14px;
  --shadow: 0 10px 26px rgba(15, 55, 45, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; }
p { margin: 0; }
button, input, select { font-family: inherit; }

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px 14px 60px;
}

/* ---------- 顶栏 ---------- */
.hero {
  background: linear-gradient(135deg, #0f3d33 0%, #14614c 60%, #1b7a5e 100%);
  color: #fff;
  padding: 26px 16px 30px;
}
.hero-inner { max-width: 1080px; margin: 0 auto; }
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hero h1 { font-size: 22px; letter-spacing: 0.5px; }
.hero .sub { color: #bfe0d4; font-size: 13px; margin-top: 6px; }
.hero .pill {
  border: 1px solid rgba(255,255,255,.35); color: #eafff5;
  border-radius: 999px; padding: 4px 10px; font-size: 12px; white-space: nowrap;
}
.hero-stats { display: flex; gap: 22px; margin-top: 18px; flex-wrap: wrap; }
.hero-stats b { display: block; font-size: 22px; }
.hero-stats span { font-size: 12px; color: #a9cfc1; }

.appbar {
  background: #0f3d33; color: #fff; padding: 10px 14px;
  display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30;
}
.appbar a { color: #d9f0e7; font-size: 14px; }
.appbar .grow { flex: 1; }
.appbar .badge-light {
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22);
  color: #fff; padding: 3px 9px; border-radius: 999px; font-size: 12px;
}
.live-dot { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: #cdedde; }
.live-dot i { width: 7px; height: 7px; border-radius: 50%; background: #6ee7a8; box-shadow: 0 0 0 3px rgba(110,231,168,.18); }

/* ---------- 卡片与布局 ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.panel { padding: 16px; margin-top: 16px; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-title h2 { font-size: 16px; }
.panel-title .hint { font-size: 12px; color: var(--muted); }
.section-sub { font-size: 13px; color: var(--muted); margin: 4px 0 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid transparent; background: var(--primary); color: #fff;
  padding: 9px 15px; border-radius: 10px; font-size: 14px; cursor: pointer;
  transition: background .15s, transform .05s; white-space: nowrap;
}
.btn:hover { background: var(--primary-dark); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { background: #f5f8f6; }
.btn.soft { background: #e8f3ee; color: var(--primary); }
.btn.soft:hover { background: #dcefe7; }
.btn.danger { background: var(--danger); }
.btn.danger.ghostish { background: #fdf1f0; color: var(--danger); border-color: #f3d3d0; }
.btn.sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label { font-size: 12.5px; color: var(--muted); }
.input, select.input, input[type="text"], input[type="date"], input[type="number"], input[type="password"] {
  width: 100%; border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 10px; padding: 10px 12px; font-size: 14px; outline: none;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,107,82,.1); }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 12px; }
.grid-form .span2 { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

.searchbox { position: relative; flex: 1; min-width: 180px; }
.searchbox input { padding-left: 34px; }
.searchbox::before {
  content: "⌕"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 17px; pointer-events: none;
}

/* ---------- 标签 ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0; margin-top: 16px; }
.tabs button {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  padding: 8px 14px; border-radius: 999px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.tabs button.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

.badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; background: #eef2ee; color: var(--muted); border: 1px solid var(--line);
}
.badge.green { background: #e7f5ee; color: #16714f; border-color: #c9e8d9; }
.badge.amber { background: #fdf4e2; color: #9a6a10; border-color: #f4e2bd; }
.badge.red { background: #fdeeed; color: #a83932; border-color: #f3d3d0; }
.badge.blue { background: #eaf2fb; color: #2b5f97; border-color: #d3e3f4; }

/* ---------- 赛事卡片 ---------- */
.event-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.event-card { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.event-card h3 { font-size: 15.5px; }
.event-meta { font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.event-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }

/* ---------- 赛事头部 / 进度 ---------- */
.event-head { padding: 16px; margin-top: 14px; }
.event-head h1 { font-size: 19px; }
.event-head .meta { color: var(--muted); font-size: 12.5px; margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.steps { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.steps span {
  font-size: 11.5px; color: var(--muted); background: #f2f6f3;
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px;
}
.steps span.on { background: #e7f5ee; color: #16714f; border-color: #bfe4d3; font-weight: 600; }
.steps span.done { color: #16714f; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 480px; }
table.data th, table.data td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.data th { color: var(--muted); font-weight: 500; font-size: 12px; background: #f7faf8; }
table.data tr.qualified td { background: #f4fbf7; }
table.data td.name { font-weight: 600; }

/* ---------- 比赛卡片 ---------- */
.match {
  border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; background: #fff;
  display: flex; flex-direction: column; gap: 8px;
}
.match.hit { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(234,163,42,.14); }
.match-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.match-body { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.match-team { font-size: 14px; font-weight: 600; }
.match-team.right { text-align: right; }
.match-team.win { color: var(--primary); }
.match-score { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px; color: var(--ink); }
.match-games { font-size: 12px; color: var(--muted); text-align: center; }
.match-foot { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; align-items: center; }
.match-list { display: flex; flex-direction: column; gap: 10px; }

/* ---------- 分组 ---------- */
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.group-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.group-card h4 {
  background: #f2f7f4; padding: 9px 12px; font-size: 13px; color: #17493b;
  border-bottom: 1px solid var(--line); display: flex; justify-content: space-between;
}
.group-card ul { list-style: none; margin: 0; padding: 6px 0; }
.group-card li { padding: 7px 12px; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.group-card li + li { border-top: 1px dashed #eef2ef; }

/* ---------- 签表 ---------- */
.bracket-scroll { overflow-x: auto; padding-bottom: 8px; -webkit-overflow-scrolling: touch; }
.bracket { display: flex; gap: 16px; min-width: max-content; align-items: stretch; }
.round-col { display: flex; flex-direction: column; gap: 12px; min-width: 196px; }
.round-col > h4 {
  font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 0 2px 4px;
  border-bottom: 2px solid #e3ece6;
}
.round-col .matches { display: flex; flex-direction: column; gap: 12px; justify-content: space-around; flex: 1; }
.bracket-match { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; }
.bracket-match .bm-row {
  display: flex; justify-content: space-between; gap: 8px; padding: 6px 9px;
  font-size: 12.5px; align-items: center;
}
.bracket-match .bm-row + .bm-row { border-top: 1px solid #eef3f0; }
.bracket-match .bm-row.win { background: #eaf7f0; font-weight: 700; color: #10624a; }
.bracket-match .bm-row .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bracket-match .bm-row .s { font-variant-numeric: tabular-nums; color: var(--muted); }
.bracket-match .bm-empty { color: #9fb2aa; font-style: italic; }
.bracket-match .bm-meta { font-size: 10.5px; color: #8ba098; margin-left: 4px; }

/* ---------- 二维码 ---------- */
.qr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.qr-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; text-align: center; background: #fff; }
.qr-card img { width: 150px; height: 150px; display: block; margin: 0 auto 8px; }
.qr-card h4 { font-size: 13.5px; margin-bottom: 2px; }
.qr-card p { font-size: 11.5px; color: var(--muted); word-break: break-all; margin-bottom: 8px; }

/* ---------- 提示 / 空态 ---------- */
.empty { text-align: center; color: var(--muted); font-size: 13px; padding: 28px 12px; }
.notice {
  padding: 10px 12px; border-radius: 10px; font-size: 12.5px; line-height: 1.6;
  background: #f2f7f4; border: 1px solid #e0ebe5; color: #33534a;
}
.notice.warn { background: #fdf6e8; border-color: #f1e0bb; color: #7d5a12; }
.notice.err { background: #fdf0ef; border-color: #f3d3d0; color: #9c352e; }
.notice.ok { background: #ecf8f2; border-color: #c9e8d9; color: #146c4d; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(9, 26, 21, .52);
  display: flex; align-items: flex-end; justify-content: center; z-index: 100; padding: 0;
}
.modal {
  background: #fff; width: 100%; max-width: 460px; border-radius: 16px 16px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); max-height: 90vh; overflow-y: auto;
  animation: slideUp .18s ease-out;
}
@keyframes slideUp { from { transform: translateY(18px); opacity: .4; } to { transform: none; opacity: 1; } }
.modal h3 { font-size: 16px; margin-bottom: 4px; }
.modal .modal-sub { font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }
.game-row { display: grid; grid-template-columns: 34px 1fr auto 1fr; gap: 8px; align-items: center; margin-bottom: 8px; }
.game-row .g-label { font-size: 12px; color: var(--muted); }
.game-row input { text-align: center; font-size: 16px; padding: 9px 4px; font-variant-numeric: tabular-nums; }
.game-row .colon { color: var(--muted); }
.score-preview { font-size: 23px; font-weight: 700; text-align: center; margin: 12px 0 4px; letter-spacing: 1px; }
.score-preview small { font-size: 12px; color: var(--muted); font-weight: 400; display: block; letter-spacing: 0; margin-top: 2px; }
.modal-actions { display: flex; gap: 8px; margin-top: 14px; }
.modal-actions .btn { flex: 1; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(10px);
  background: #10332a; color: #fff; padding: 10px 16px; border-radius: 999px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: all .2s; z-index: 200;
  max-width: 86vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #9c352e; }

mark {
  background: #fde9ad; color: #6b4c05; padding: 0 2px; border-radius: 3px;
}

/* ---------- 场地选择 ---------- */
.court-picker {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.court-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 10px; border: 1px solid #d5e0dc; border-radius: 999px;
  background: #f6faf8; font-size: 13px; cursor: pointer; user-select: none;
}
.court-chip input { accent-color: #1f7a5c; }
.court-chip:has(input:checked) { border-color: #1f7a5c; background: #e7f4ee; color: #14614a; }

/* ---------- 移动端 ---------- */
@media (max-width: 640px) {
  .hero { padding: 20px 14px 24px; }
  .hero h1 { font-size: 19px; }
  .wrap { padding: 12px 10px 50px; }
  .panel { padding: 13px; }
  .match-body { grid-template-columns: 1fr auto 1fr; }
  .match-team { font-size: 13.5px; }
  .modal { border-radius: 16px 16px 0 0; }
  .round-col { min-width: 168px; }
  .qr-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .qr-card img { width: 118px; height: 118px; }
}

@media (min-width: 641px) {
  .modal-mask { align-items: center; padding: 20px; }
  .modal { border-radius: 16px; }
}
