*, *::before, *::after { box-sizing: border-box; }

/* 藏文字体（兜底国内安卓系统不含藏文字体的情况） */
.tibetan {
  font-family: "Noto Sans Tibetan", "Kailasa", "Microsoft Himalaya",
    "Tibetan Machine Uni", "Jomolhari", sans-serif;
  font-feature-settings: "kern" 1;
}

:root {
  --primary: #16a34a;
  --primary-dark: #15803d;
  --primary-soft: #dcfce7;
  --accent: #ea580c;
  --accent-soft: #ffedd5;
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --danger: #dc2626;
  --warn: #f59e0b;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  /* 阿若博巴品牌色（赞助商辅助色） */
  --sponsor-red: #C8201F;
  --sponsor-red-dark: #8B0000;
  --sponsor-cream: #FAF7F2;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans Tibetan", "Kailasa", "Microsoft Himalaya",
    "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

button { font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ===== Header ===== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: white;
  padding: env(safe-area-inset-top) 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: calc(env(safe-area-inset-top) + 56px);
}
.app-title { display: flex; align-items: center; gap: 10px; }
.app-emoji { font-size: 28px; }
.app-title h1 { font-size: 17px; margin: 0; font-weight: 600; }
.app-sub { font-size: 12px; margin: 0; opacity: 0.85; }
.app-actions { display: flex; gap: 8px; }

.btn-icon {
  background: rgba(255, 255, 255, 0.22);
  color: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:active { background: rgba(255, 255, 255, 0.35); }

/* ===== Tab bar ===== */
.tab-bar {
  position: sticky;
  top: calc(env(safe-area-inset-top) + 56px);
  z-index: 40;
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-btn {
  flex: 0 0 auto;
  padding: 12px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ===== Main ===== */
.app-main {
  padding: 16px 16px 60px;
  padding-bottom: max(60px, env(safe-area-inset-bottom));
  max-width: 720px;
  margin: 0 auto;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 2px 12px;
}
.section-head h2 { font-size: 18px; margin: 0; font-weight: 600; }
.section-sub {
  font-size: 13px;
  color: var(--muted);
  margin: 18px 2px 8px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.group-label {
  display: inline-block;
  padding: 4px 10px;
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
  margin: 14px 0 6px;
  letter-spacing: 0.06em;
}
.leader-board {
  margin-bottom: 18px;
}
.banned-card {
  opacity: 0.75;
  background: repeating-linear-gradient(45deg, #fff 0 12px, #fef2f2 12px 24px);
  border-color: #fecaca !important;
}
.tag.banned {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  margin-left: 6px;
  font-weight: 700;
}
.match-score.forfeit {
  color: #b91c1c;
  text-decoration: line-through;
  text-decoration-color: #fca5a5;
}
.forfeit-note {
  margin-top: 8px;
  padding: 8px 12px;
  background: #fef2f2;
  border-left: 3px solid #b91c1c;
  color: #991b1b;
  font-size: 13px;
  border-radius: 0 6px 6px 0;
}
.match-status.forfeit {
  background: #fef2f2;
  color: #b91c1c;
}

/* ===== Team Logos ===== */
.team-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  flex-shrink: 0;
  letter-spacing: -0.02em;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  overflow: hidden;
  vertical-align: middle;
}
.team-logo.logo-sm {
  width: 22px;
  height: 22px;
  font-size: 9px;
  border-width: 1.5px;
}
.team-logo.logo-lg {
  width: 52px;
  height: 52px;
  font-size: 14px;
  border-width: 2.5px;
}
.team-logo.logo-banned {
  opacity: 0.5;
  filter: grayscale(0.7);
}
/* When the logo is an image: drop the colored circle, show full image */
.team-logo.team-logo-img {
  background: transparent !important;
  border: none;
  box-shadow: none;
  padding: 0;
  overflow: visible;
}
.team-logo.team-logo-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.team-logo.team-logo-img.logo-lg {
  width: 60px;
  height: 60px;
}
.team-logo.team-logo-img.logo-sm {
  width: 26px;
  height: 26px;
}
.team-with-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  vertical-align: middle;
}
.team-with-logo-name {
  line-height: 1.2;
}
.team-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.team-card-head .team-logo {
  margin-right: 2px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 8px;
  border: none;
  background: var(--primary);
  color: white;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.btn:active { background: var(--primary-dark); }
.btn.ghost {
  background: white;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn.ghost:active { background: #f1f5f9; }
.btn.danger { background: var(--danger); }
.btn.accent { background: var(--accent); }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== Cards ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 10px;
}
.card.tappable:active { background: #f1f5f9; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 16px;
  background: white;
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}
.empty p { margin: 0 0 12px; }

/* ===== Today stats ===== */
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.stat {
  background: white;
  border-radius: var(--radius);
  padding: 14px 8px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.stat-num { font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ===== Match card ===== */
.match-card {
  background: white;
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 10px;
}
.match-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 6px;
}
.match-meta .tag {
  background: var(--primary-soft);
  color: var(--primary-dark);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}
.match-meta .tag.basketball {
  background: var(--accent-soft);
  color: var(--accent);
}
.match-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
}
.match-status.scheduled { background: #e0e7ff; color: #3730a3; }
.match-status.live { background: #fee2e2; color: var(--danger); }
.match-status.finished { background: #f1f5f9; color: var(--muted); }
.match-teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}
.match-team {
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.match-team-text {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.match-team-name {
  line-height: 1.25;
}
.match-team .region {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 2px;
}
.match-score {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  min-width: 64px;
  text-align: center;
}
.match-score.vs { color: var(--muted); font-size: 16px; }
.match-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* ===== Forms ===== */
.form-group { margin-bottom: 12px; }
.form-group label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  background: white;
  color: var(--text);
}
.form-group textarea {
  resize: vertical;
  min-height: 72px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  position: sticky;
  bottom: 0;
  background: white;
  padding-top: 12px;
}
.form-actions .btn { flex: 1; }

/* ===== Poster CTA card on Today page ===== */
.poster-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-left: 4px solid var(--accent);
  margin-top: 12px;
}
.poster-cta-title {
  font-weight: 700;
  color: var(--text);
  font-size: 15px;
}
.poster-cta-sub {
  font-size: 12px;
  color: #78350f;
  margin-top: 2px;
}

/* ===== Poster (off-screen render target) ===== */
.poster-offscreen {
  position: fixed;
  top: 0;
  left: -20000px;
  width: 1080px;
  z-index: -1;
  pointer-events: none;
}
.poster-root {
  width: 1080px;
  background: linear-gradient(170deg, #15803d 0%, #14532d 100%);
  color: #fff;
  font-family: -apple-system, "PingFang SC", "Noto Sans Tibetan", "Microsoft YaHei", sans-serif;
  padding: 60px 56px 50px;
  box-sizing: border-box;
}
.poster-header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding-bottom: 28px;
  border-bottom: 2px solid rgba(253, 230, 138, 0.4);
}
.poster-emoji {
  font-size: 88px;
  line-height: 1;
  flex-shrink: 0;
}
.poster-title-wrap { flex: 1; }
.poster-title {
  font-size: 52px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: 1px;
  margin: 0;
}
.poster-subtitle {
  font-size: 24px;
  margin-top: 8px;
  color: #fde68a;
  font-weight: 500;
}
.poster-date-band {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 36px 0 20px;
}
.poster-date-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.poster-month {
  font-size: 40px;
  font-weight: 700;
  color: #fde68a;
}
.poster-day {
  font-size: 124px;
  font-weight: 900;
  line-height: 0.95;
  color: #ffffff;
}
.poster-day-label {
  font-size: 38px;
  font-weight: 700;
  color: #fde68a;
}
.poster-weekday {
  font-size: 26px;
  color: rgba(255, 255, 255, 0.75);
  padding-bottom: 10px;
}
.poster-round-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}
.poster-round-chip {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(253, 230, 138, 0.4);
  padding: 10px 22px;
  border-radius: 100px;
  font-size: 22px;
  color: #fde68a;
  font-weight: 600;
}
.poster-matches {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.poster-match {
  background: #ffffff;
  border-radius: 22px;
  padding: 22px 32px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  color: #0f172a;
}
.poster-team {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}
.poster-team.away {
  flex-direction: row-reverse;
}
.poster-team-logo {
  width: 88px;
  height: 88px;
  object-fit: contain;
  border-radius: 50%;
  background: #f1f5f9;
  flex-shrink: 0;
}
.poster-team-logo.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
}
.poster-team-name {
  font-size: 34px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #0f172a;
  flex: 1;
}
.poster-team.away .poster-team-name { text-align: right; }
.poster-team.win .poster-team-name { color: #15803d; }
.poster-score {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: "Helvetica Neue", "Arial Black", "PingFang SC", sans-serif;
  font-size: 64px;
  font-weight: 900;
  line-height: 1;
}
.poster-score-num { color: #475569; }
.poster-score-num.win { color: #15803d; }
.poster-score-sep { color: #cbd5e1; margin: 0 4px; }
.poster-sponsor-block {
  margin-top: 32px;
  background: #faf7f2;
  border-radius: 20px;
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: #0f172a;
}
.poster-sponsor-text {
  display: flex;
  align-items: baseline;
  gap: 14px;
}
.poster-sponsor-label {
  font-size: 20px;
  color: #64748b;
}
.poster-sponsor-name {
  font-size: 38px;
  font-weight: 900;
  color: #C8201F;
  letter-spacing: 3px;
}
.poster-sponsor-logo {
  height: 72px;
  object-fit: contain;
  flex-shrink: 0;
}
.poster-footer {
  margin-top: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}
.poster-footer-text { flex: 1; }
.poster-url {
  font-size: 30px;
  font-weight: 700;
  color: #fde68a;
  letter-spacing: 1px;
}
.poster-venue {
  font-size: 20px;
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.8);
}
.poster-qr {
  width: 120px;
  height: 120px;
  background: white;
  padding: 8px;
  border-radius: 12px;
  flex-shrink: 0;
}

/* Poster preview modal */
.poster-modal-body { text-align: center; }
.poster-hint {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
  padding: 8px 10px;
  background: #fef3c7;
  border-radius: 8px;
}
.poster-preview-img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

/* ===== Match card discipline badges ===== */
.match-cards {
  display: flex;
  gap: 6px;
  padding: 4px 12px 0;
  flex-wrap: wrap;
}
.card-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.card-badge.yellow { background: #fef3c7; color: #92400e; }
.card-badge.red { background: #fecaca; color: #991b1b; }

/* ===== Discipline tab ===== */
.discipline-banner {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border-left: 4px solid var(--danger);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.discipline-banner-title {
  font-weight: 700;
  color: var(--danger);
  font-size: 14px;
  margin-bottom: 6px;
}
.discipline-banner-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}
.discipline-banner-list li { color: var(--text); }
.discipline-reason {
  color: var(--muted);
  font-size: 12px;
}
.discipline-day {
  padding: 12px;
  margin-bottom: 10px;
}
.discipline-day-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--primary);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border);
}
.discipline-row {
  display: flex;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
  align-items: flex-start;
}
.discipline-row:last-child { border-bottom: none; }
.discipline-team {
  font-size: 13px;
  font-weight: 600;
  min-width: 56px;
  color: var(--text);
}
.discipline-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  flex: 1;
}
.discipline-tag {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}
.discipline-tag.yellow { background: #fef3c7; color: #78350f; }
.discipline-tag.red { background: #fecaca; color: #7f1d1d; font-weight: 600; }
.rule-note {
  font-size: 12px;
  color: var(--muted);
  background: #f8fafc;
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 10px;
  line-height: 1.7;
}

/* ===== Regulations tab ===== */
.reg-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 720px) {
  .reg-grid { grid-template-columns: 1fr 1fr; }
}
.reg-card {
  background: white;
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  border-top: 3px solid var(--primary);
}
.reg-card h3 {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--text);
}
.reg-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.reg-card li {
  font-size: 13px;
  line-height: 1.65;
  color: var(--text);
  padding: 4px 0;
  padding-left: 14px;
  position: relative;
}
.reg-card li::before {
  content: '·';
  position: absolute;
  left: 4px;
  color: var(--primary);
  font-weight: 700;
}

/* ===== Standings table ===== */
.standings-wrap {
  background: white;
  border-radius: var(--radius);
  padding: 4px;
  overflow-x: auto;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}
.standings-table th,
.standings-table td {
  padding: 8px 6px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.standings-table th {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  background: #f8fafc;
}
.standings-table td.team-name {
  text-align: left;
  font-weight: 500;
  min-width: 100px;
}
.standings-table tr:last-child td { border-bottom: none; }
.rank-badge {
  display: inline-flex;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f1f5f9;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  align-items: center;
  justify-content: center;
}
.rank-badge.top1 { background: #fef3c7; color: #b45309; }
.rank-badge.top2 { background: #e5e7eb; color: #374151; }
.rank-badge.top3 { background: #fed7aa; color: #9a3412; }

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal-backdrop[hidden] { display: none; }
.modal-card {
  background: white;
  width: 100%;
  max-width: 600px;
  max-height: 92vh;
  border-radius: 16px 16px 0 0;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.2s ease-out;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: white;
  border-radius: 16px 16px 0 0;
}
.modal-header h2 { font-size: 16px; margin: 0; font-weight: 600; }
.modal-header .btn-icon { background: #f1f5f9; color: var(--text); }
.modal-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.9);
  color: white;
  padding: 10px 18px;
  border-radius: 24px;
  font-size: 14px;
  z-index: 200;
  max-width: 90vw;
}
.toast[hidden] { display: none; }

/* ===== Player tags ===== */
.player-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.player-tag {
  background: #f1f5f9;
  color: var(--text);
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
}
.player-tag .num {
  color: var(--primary);
  font-weight: 600;
  margin-right: 4px;
}

/* ===== Player story card ===== */
.story-card {
  background: white;
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 10px;
}
.story-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.story-name { font-size: 16px; font-weight: 600; }
.story-team { font-size: 12px; color: var(--muted); }
.story-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}
.story-text { font-size: 13px; line-height: 1.6; }

/* ===== Report tabs ===== */
.report-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 8px;
}
.report-tab {
  flex: 1;
  padding: 8px;
  border: none;
  background: none;
  font-size: 13px;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
}
.report-tab.active {
  background: white;
  color: var(--primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.report-output {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-size: 14px;
  white-space: pre-wrap;
  min-height: 200px;
  line-height: 1.7;
}

/* ===== Event log ===== */
.event-log {
  margin-top: 10px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.event-item {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
}
.event-min { color: var(--muted); font-weight: 600; font-size: 12px; }
.event-icon { font-size: 14px; }
.event-del {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  padding: 0 4px;
}

/* ===== Misc ===== */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.danger-text { color: var(--danger); }
.center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.hidden { display: none !important; }

/* ===== Sponsor: Top strip (位置 ①) ===== */
.sponsor-strip {
  background: var(--sponsor-cream);
  border-bottom: 2px solid var(--sponsor-red);
  position: sticky;
  top: calc(env(safe-area-inset-top) + 56px);
  z-index: 41;
}
.sponsor-strip-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  max-width: 720px;
  margin: 0 auto;
}
.sponsor-strip-label {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid rgba(0,0,0,0.12);
  padding-right: 12px;
  line-height: 1.1;
}
.sponsor-strip-cn {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
}
.sponsor-strip-en {
  font-size: 9px;
  color: var(--sponsor-red);
  font-weight: 700;
  letter-spacing: 0.14em;
  margin-top: 2px;
}
.sponsor-strip-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.sponsor-strip-logo {
  height: 28px;
  width: auto;
  flex-shrink: 0;
}
.sponsor-strip-slogan {
  font-size: 12px;
  color: #2a1a18;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 让 tab-bar 在 sponsor-strip 下方继续粘性 */
.sponsor-strip + .tab-bar {
  top: calc(env(safe-area-inset-top) + 56px + 46px);
}

/* ===== Sponsor: "X 呈现 / 标题" 前置行 (位置 ②) ===== */
.sponsor-presents {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 18px 2px 8px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.sponsor-presents-prefix {
  font-size: 11px;
  color: var(--sponsor-red);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.sponsor-presents-bar {
  flex: 0 0 16px;
  height: 1px;
  background: var(--sponsor-red);
  opacity: 0.4;
}
.sponsor-presents-title {
  font-size: 14px;
  color: var(--text);
  letter-spacing: 0.04em;
}

/* ===== Sponsor: Empty-state hero (位置 ③) ===== */
.sponsor-hero {
  background: radial-gradient(ellipse at top, #2d0a0a 0%, #0d0303 70%);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  color: #f4ece5;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.sponsor-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(200,32,31,0.18) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(200,32,31,0.10) 0%, transparent 60%);
  pointer-events: none;
}
.sponsor-hero > * {
  position: relative;
  z-index: 1;
}
.sponsor-hero-logo {
  height: 56px;
  width: auto;
  background: #fff;
  padding: 6px 10px;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
  margin-bottom: 14px;
}
.sponsor-hero-presents {
  font-size: 11px;
  color: rgba(244,236,229,0.7);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.sponsor-hero-tibetan {
  font-size: 14px;
  color: rgba(244,236,229,0.85);
  margin-bottom: 4px;
  line-height: 1.6;
  font-family: "Noto Sans Tibetan", "Microsoft Himalaya", "Kailasa", -apple-system, sans-serif;
}
.sponsor-hero-slogan {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.04em;
  margin-bottom: 18px;
}
.sponsor-hero-divider {
  width: 40px;
  height: 2px;
  background: var(--sponsor-red);
  margin: 0 auto 14px;
  opacity: 0.85;
}
.sponsor-hero-center {
  font-size: 14px;
  color: rgba(244,236,229,0.65);
  letter-spacing: 0.06em;
}

/* ===== Sponsor: Section bottom strip (位置 ⑤) ===== */
.sponsor-section-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 4px 18px;
}
.sponsor-section-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--sponsor-red) 30%, var(--sponsor-red) 70%, transparent);
  opacity: 0.35;
}
.sponsor-section-text {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.12em;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ===== Sponsor: Brand presentation card (位置 ⑥) ===== */
.sponsor-brand-card {
  background: linear-gradient(180deg, #fff 0%, var(--sponsor-cream) 100%);
  border-radius: var(--radius);
  padding: 16px 14px 18px;
  margin-top: 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  border-top: 3px solid var(--sponsor-red);
  overflow: hidden;
}
.sponsor-brand-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px dashed rgba(200,32,31,0.25);
}
.sponsor-brand-head-logo {
  height: 38px;
  width: auto;
  flex-shrink: 0;
}
.sponsor-brand-head-text { flex: 1; min-width: 0; }
.sponsor-brand-head-label {
  font-size: 10px;
  color: var(--sponsor-red);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
}
.sponsor-brand-head-name {
  font-size: 16px;
  color: var(--text);
  font-weight: 700;
  margin-top: 2px;
}
.sponsor-brand-head-tibetan {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  margin-left: 4px;
  font-family: "Noto Sans Tibetan", "Microsoft Himalaya", "Kailasa", -apple-system, sans-serif;
}
.sponsor-brand-hero-img {
  border-radius: 10px;
  overflow: hidden;
  background: #f5f0eb;
  box-shadow: 0 8px 24px rgba(60,30,15,0.18);
}
.sponsor-brand-hero-img img {
  width: 100%;
  height: auto;
  display: block;
}
.sponsor-brand-caption {
  text-align: center;
  margin-top: 14px;
  padding: 0 8px;
}
.sponsor-brand-title {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 4px;
  color: #6b1d1c;
  letter-spacing: 0.05em;
}
.sponsor-brand-subtitle {
  font-size: 13px;
  color: var(--sponsor-red);
  font-weight: 600;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.sponsor-brand-desc {
  font-size: 13px;
  color: #4a3530;
  line-height: 1.6;
  margin: 0;
}

/* ===== Sponsor: Product showcase (位置 ⑦) ===== */
.sponsor-products-wrap {
  margin: 4px 0 14px;
}
.sponsor-products-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 4px 12px;
}
.sponsor-products-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--sponsor-red), transparent);
  opacity: 0.35;
}
.sponsor-products-title {
  font-size: 12px;
  color: var(--sponsor-red);
  font-weight: 700;
  letter-spacing: 0.16em;
  white-space: nowrap;
  flex-shrink: 0;
}
.sponsor-products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.sponsor-product-card {
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(200,32,31,0.12);
  display: flex;
  flex-direction: column;
}
.sponsor-product-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.sponsor-product-img img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}
.sponsor-product-text {
  padding: 10px 12px 12px;
  text-align: center;
}
.sponsor-product-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}
.sponsor-product-spec {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.sponsor-product-tagline {
  font-size: 11px;
  color: var(--sponsor-red);
  margin-top: 4px;
  font-weight: 500;
}

/* ===== Sponsor: Per-page slim footer ===== */
.sponsor-page-footer {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, #fff 0%, var(--sponsor-cream) 100%);
  border: 1px solid rgba(200,32,31,0.18);
  border-left: 3px solid var(--sponsor-red);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 28px 0 12px;
  box-shadow: var(--shadow-sm);
}
.sponsor-page-footer-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.sponsor-page-footer-logo {
  height: 36px;
  width: auto;
  flex-shrink: 0;
}
.sponsor-page-footer-text {
  flex: 1;
  min-width: 0;
}
.sponsor-page-footer-label {
  font-size: 10px;
  color: var(--sponsor-red);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  line-height: 1.4;
}
.sponsor-page-footer-slogan {
  font-size: 13px;
  color: #2a1a18;
  font-weight: 600;
  margin-top: 2px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sponsor-page-footer-product {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  gap: 4px;
}
.sponsor-page-footer-product img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  background: white;
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 2px 6px rgba(60,30,15,0.12);
}
.sponsor-page-footer-product-name {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* ===== Bracket (对战图 · 树状布局) ===== */
.bracket-tree {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  margin: 4px auto 18px;
  max-width: 520px;
}
.bracket-tree-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.14em;
  padding: 6px 10px;
  background: #f1f5f9;
  border-radius: 6px;
  margin: 8px 0 8px;
  text-align: center;
}
.bracket-tree-banner.locked { color: var(--muted); background: #f1f5f9; }
.bracket-tree-banner.live   { color: var(--primary); background: var(--primary-soft); }
.bracket-tree-banner.done   { color: #047857; background: #d1fae5; }
.bracket-tree-banner .bracket-unlock-hint.inline {
  display: inline;
  font-size: 10px;
  font-weight: 500;
  text-align: left;
  letter-spacing: 0.02em;
  margin: 0 0 0 4px;
  opacity: 0.85;
}

.bracket-row {
  display: grid;
  gap: 10px;
}
.bracket-row-2 { grid-template-columns: 1fr 1fr; }
.bracket-row-1 { grid-template-columns: 1fr; padding: 0 18%; }
.bracket-row-final { grid-template-columns: 1fr; padding: 0 8%; }

/* 连接线 */
.bracket-link {
  position: relative;
  margin: 0;
}
.bracket-link-down {
  height: 26px;
}
.bracket-link-down::before {
  /* 左+右+下 边（倒 U） */
  content: '';
  position: absolute;
  top: 0;
  left: 25%;
  right: 25%;
  height: 50%;
  border-left: 2px solid var(--border);
  border-right: 2px solid var(--border);
  border-bottom: 2px solid var(--border);
}
.bracket-link-down::after {
  /* 中心向下延伸的尾巴 */
  content: '';
  position: absolute;
  top: 50%;
  bottom: 0;
  left: 50%;
  border-left: 2px solid var(--border);
  margin-left: -1px;
}
.bracket-link-up {
  height: 26px;
}
.bracket-link-up::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 25%;
  right: 25%;
  height: 50%;
  border-left: 2px solid var(--border);
  border-right: 2px solid var(--border);
  border-top: 2px solid var(--border);
}
.bracket-link-up::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 50%;
  left: 50%;
  border-left: 2px solid var(--border);
  margin-left: -1px;
}
.bracket-link-straight {
  height: 18px;
}
.bracket-link-straight::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  border-left: 2px solid var(--border);
  margin-left: -1px;
}

/* 3-4 名独立放在树外 */
.bracket-extra {
  max-width: 360px;
  margin: 16px auto 0;
}
.bracket-lock { font-size: 13px; }
.bracket-check { font-weight: 800; font-size: 13px; }
.bracket-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
  animation: bracket-dot-pulse 1.6s ease-in-out infinite;
}
@keyframes bracket-dot-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.3); }
}
.bracket-unlock-hint {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  margin-top: 3px;
  letter-spacing: 0.04em;
  opacity: 0.85;
  text-align: center;
}

/* 顶部状态汇总条 */
.bracket-summary {
  background: linear-gradient(135deg, #fef3f2 0%, #fff7ed 100%);
  border: 1px solid rgba(200,32,31,0.18);
  border-left: 3px solid var(--sponsor-red);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 600;
  color: #6b1d1c;
  letter-spacing: 0.04em;
}

/* 锁定阶段的 bracket 卡片视觉弱化 */
.bracket-card.bracket-card-locked {
  opacity: 0.7;
  background: #fafafa;
}

.bracket-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.bracket-card:active { transform: scale(0.98); }
.bracket-card-featured {
  border: 2px solid var(--sponsor-red);
  background: linear-gradient(180deg, #fff 0%, #fef3f2 100%);
  box-shadow: 0 4px 16px rgba(200,32,31,0.18);
}
.bracket-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border);
}
.bracket-card-tag {
  font-size: 10px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.bracket-card-featured .bracket-card-tag { color: var(--sponsor-red); }
.bracket-card-time {
  font-size: 10px;
  color: var(--muted);
}
.bracket-card-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
}
.bracket-card-row.winner {
  color: var(--text);
  font-weight: 700;
}
.bracket-card-row.winner .bracket-card-score { color: var(--primary); }
.bracket-card-row.loser {
  color: var(--muted);
  opacity: 0.7;
}
.bracket-card-tba {
  display: inline-flex;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f1f5f9;
  color: var(--muted);
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  border: 1px dashed var(--border);
  flex-shrink: 0;
}
.bracket-card-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bracket-card-score {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  min-width: 20px;
  text-align: right;
}
.bracket-card-foot {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-align: center;
}
.bracket-card-foot.live { color: var(--primary); font-weight: 700; }
.bracket-card-foot.pending { color: var(--muted); }
.bracket-card-foot.forfeit { color: #b91c1c; font-weight: 600; }

/* ===== Desktop tweaks ===== */
@media (min-width: 720px) {
  .modal-backdrop { align-items: center; }
  .modal-card { border-radius: 16px; max-height: 80vh; }
  .app-header { min-height: 60px; }
  .app-title h1 { font-size: 18px; }
}

/* ===== Narrow phones: tighten sponsor strip ===== */
@media (max-width: 360px) {
  .sponsor-strip-label { padding-right: 8px; }
  .sponsor-strip-cn { font-size: 10px; }
  .sponsor-strip-en { font-size: 8px; }
  .sponsor-strip-logo { height: 24px; }
  .sponsor-strip-slogan { font-size: 11px; }
}
