:root {
  --pitch-900: #062a1c;
  --pitch-800: #0a3b26;
  --pitch-700: #0f5233;
  --grass: #1a7a4a;
  --lime: #7ee081;
  --ink: #f2f7f4;
  --muted: rgba(242, 247, 244, 0.68);
  --card: rgba(255, 255, 255, 0.08);
  --card-strong: rgba(255, 255, 255, 0.14);
  --line: rgba(255, 255, 255, 0.16);
  --red: #e8402f;
  --yellow: #f5c518;
  --blue: #2f7de1;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--pitch-900);
}

body {
  background-image:
    linear-gradient(180deg, rgba(6, 42, 28, 0.72) 0%, rgba(6, 42, 28, 0.86) 45%, rgba(6, 42, 28, 0.96) 100%),
    url("assets/pitch-bg.png");
  background-size: cover;
  background-position: center top;
  background-attachment: fixed;
}

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 22px 16px calc(48px + env(safe-area-inset-bottom));
}

/* ---------- header ---------- */
.hero {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  background:
    linear-gradient(140deg, rgba(26, 122, 74, 0.92), rgba(10, 59, 38, 0.94)),
    url("assets/pitch-bg.png") center/cover;
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.38);
  padding: 20px 18px;
}

.hero .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(126, 224, 129, 0.18);
  border: 1px solid rgba(126, 224, 129, 0.4);
  color: var(--lime);
}

.hero h1 {
  margin: 12px 0 2px;
  font-size: 25px;
  letter-spacing: -0.01em;
}

/* hero 头部：徽章 LOGO + 标题 */
.hero-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hero-logo {
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.5));
}

.hero-head-txt { min-width: 0; }

.hero-head-txt h1 {
  margin: 6px 0 0;
  font-size: 22px;
}

.hero .when {
  font-size: 15px;
  color: var(--lime);
  font-weight: 700;
  margin-bottom: 10px;
}

.info-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 14px;
  color: var(--ink);
  margin-top: 7px;
}

.info-row .k {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
  min-width: 44px;
}

.count-bar {
  margin-top: 16px;
  height: 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.32);
  overflow: hidden;
}

.count-bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--grass), var(--lime));
}

.count-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-top: 7px;
}

.note-box {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  font-size: 13px;
  color: var(--muted);
  white-space: pre-wrap;
}

/* ---------- buttons ---------- */
.btn {
  appearance: none;
  border: none;
  border-radius: 14px;
  padding: 13px 16px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  color: #06210f;
  background: linear-gradient(135deg, var(--lime), #4cc46a);
  cursor: pointer;
  width: 100%;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn.ghost {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 600;
}

.btn.danger {
  background: linear-gradient(135deg, #e8402f, #b02c20);
  color: #fff;
  font-weight: 700;
}

.warn-box {
  margin-top: 14px;
  padding: 11px 13px;
  border-radius: 12px;
  background: rgba(232, 64, 47, 0.12);
  border: 1px solid rgba(232, 64, 47, 0.45);
  color: #ff9c92;
  font-size: 13px;
}

.btn.sm {
  padding: 8px 13px;
  font-size: 13px;
  border-radius: 10px;
  width: auto;
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

/* ---------- sections ---------- */
.card {
  margin-top: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  backdrop-filter: blur(8px);
}

.card h2 {
  margin: 0 0 4px;
  font-size: 16px;
}

.card .sub {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 13px;
}

label.field {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin: 12px 0 0;
}

label.field > span { display: block; margin-bottom: 6px; }

input[type="text"], input[type="tel"], input[type="date"], input[type="time"], input[type="number"], select, textarea {
  width: 100%;
  padding: 12px 13px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
}

input:focus, textarea:focus { border-color: var(--lime); }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.check {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 14px;
  font-size: 14px;
}

.check input { width: 18px; height: 18px; accent-color: var(--grass); }

/* ---------- roster ---------- */
.roster {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 10px;
}

.person {
  background: var(--card-strong);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 6px 8px;
  text-align: center;
  position: relative;
}

.person.leave { opacity: 0.42; }

.person .avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  margin: 0 auto 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.person .nm {
  font-size: 13px;
  font-weight: 600;
  word-break: break-all;
  line-height: 1.25;
}

.person .tag {
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
}

.person .tag.hint {
  color: var(--lime);
  opacity: 0.75;
  font-size: 9.5px;
}

.person.togglable {
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.person.togglable:active { transform: scale(0.94); border-color: var(--lime); }

.person .leave-btn {
  margin-top: 7px;
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.3);
  color: var(--muted);
  font-family: inherit;
  cursor: pointer;
  width: 100%;
}

.person .leave-btn:hover { color: #ff9c92; border-color: rgba(255, 156, 146, 0.5); }

/* 按钮内足球滚动动画 */
.btn-ball {
  display: inline-block;
  animation: ball-roll 0.8s linear infinite;
}

@keyframes ball-roll {
  0%   { transform: rotate(0deg); }
  25%  { transform: rotate(90deg) translateX(2px); }
  50%  { transform: rotate(180deg) translateX(-2px); }
  75%  { transform: rotate(270deg) translateX(2px); }
  100% { transform: rotate(360deg); }
}

/* ---------- 分组全屏动画遮罩 ---------- */
.draw-mask {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(4, 24, 15, 0.78);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.draw-track {
  width: 220px;
  height: 64px;
  position: relative;
  overflow: hidden;
  border-bottom: 3px solid rgba(126, 224, 129, 0.4);
}

.draw-ball {
  position: absolute;
  top: 6px;
  left: 50%;
  width: 52px;
  height: 52px;
  font-size: 52px;
  line-height: 1;
  animation: roll-across 1.1s ease-in-out infinite;
  will-change: transform;
}

@keyframes roll-across {
  0%   { transform: translateX(-90px) rotate(0deg); }
  50%  { transform: translateX(90px) rotate(360deg); }
  100% { transform: translateX(-90px) rotate(720deg); }
}

.draw-text {
  margin-top: 18px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.draw-sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12.5px;
}

.empty {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 22px 0;
}

/* ---------- modal ---------- */
.sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
}

.sheet-mask.on { display: flex; }

.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  background: #0b3a26;
  border-radius: 24px 24px 0 0;
  border-top: 1px solid var(--line);
  padding: 20px 18px calc(26px + env(safe-area-inset-bottom));
  animation: up 0.24s ease;
}

@keyframes up { from { transform: translateY(30px); opacity: 0.4; } }

.sheet h3 { margin: 0 0 4px; font-size: 18px; }

.sheet .sub { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0, 0, 0, 0.86);
  color: #fff;
  font-size: 14px;
  padding: 11px 18px;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  transition: 0.22s;
  z-index: 99;
  max-width: 84vw;
  text-align: center;
}

.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

.loading {
  text-align: center;
  color: var(--muted);
  padding: 60px 0;
  font-size: 14px;
}

.ball-spin {
  width: 34px;
  height: 34px;
  margin: 0 auto 14px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--lime);
  animation: spin 0.85s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- groups ---------- */
.group {
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 13px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.26);
  position: relative;
  overflow: hidden;
}

.group::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--gc);
}

.group-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
}

.group-head .dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--gc);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--gc) 22%, transparent);
}

.group-head .gname {
  font-size: 17px;
  font-weight: 800;
  color: var(--gc);
  letter-spacing: 0.02em;
}

.group-head .gcount {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}

.players {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 9px;
}

.player { text-align: center; }

.jersey {
  width: 44px;
  height: 48px;
  margin: 0 auto 5px;
  position: relative;
  filter: drop-shadow(0 4px 7px rgba(0, 0, 0, 0.35));
}

.jersey svg { width: 100%; height: 100%; display: block; }

.player .nm {
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1.2;
  word-break: break-all;
}

.share-bar {
  position: sticky;
  bottom: 0;
  padding: 12px 0 4px;
  background: linear-gradient(180deg, rgba(6, 42, 28, 0), rgba(6, 42, 28, 0.92) 40%);
}

#posterShot {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 750px;
  pointer-events: none;
}

.poster-preview {
  margin-top: 14px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  display: none;
}

.poster-preview.on { display: block; }

.poster-preview img { display: block; width: 100%; }

.tip {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin-top: 9px;
}

/* ---------- 首页活动列表 ---------- */
.activity-card {
  display: block;
  margin-top: 14px;
  padding: 16px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
  backdrop-filter: blur(8px);
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.activity-card:active { transform: scale(0.985); border-color: var(--lime); }
.activity-card.expired { opacity: 0.55; }

.ac-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.ac-date {
  font-size: 15px;
  font-weight: 800;
  color: var(--lime);
}

.ac-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(126, 224, 129, 0.15);
  border: 1px solid rgba(126, 224, 129, 0.35);
  color: var(--lime);
}

.activity-card.expired .ac-badge {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--line);
  color: var(--muted);
}

.ac-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 9px;
}

.ac-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 12.5px;
  color: var(--muted);
}

.ac-arrow {
  margin-top: 11px;
  font-size: 13px;
  color: var(--lime);
  text-align: right;
}

/* ---------- 创建结果 / 链接 ---------- */
.link-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 13px;
  margin: 12px 0 4px;
}

.link-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13.5px;
  padding: 5px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
}

.link-row:last-child { border-bottom: none; }
.link-row span:first-child { color: var(--muted); flex: 0 0 auto; }
.link-row .link-val {
  word-break: break-all;
  text-align: right;
  color: var(--lime);
  font-weight: 600;
}