/* 驼铃比赛 H5 - 移动端微信适配 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: calc(100vw / 7.5);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  background: #f5f6f8;
  color: #1a1a2e;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: #2d6cdf; text-decoration: none; }

.container {
  max-width: 7.5rem;
  margin: 0 auto;
  padding: 0.32rem;
}

.card {
  background: #fff;
  border-radius: 0.16rem;
  padding: 0.32rem;
  margin-bottom: 0.24rem;
  box-shadow: 0 0.02rem 0.12rem rgba(0,0,0,0.06);
}

.btn {
  display: inline-block;
  padding: 0.2rem 0.48rem;
  border: none;
  border-radius: 0.12rem;
  font-size: 0.28rem;
  cursor: pointer;
  text-align: center;
}
.btn-primary { background: #2d6cdf; color: #fff; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-disabled { background: #ccc; color: #666; pointer-events: none; }

.tag {
  display: inline-block;
  padding: 0.06rem 0.16rem;
  border-radius: 0.08rem;
  font-size: 0.22rem;
}
.tag-registering { background: #e8f4fd; color: #2d6cdf; }
.tag-drawing { background: #fff3e0; color: #f57c00; }
.tag-playing { background: #e8f5e9; color: #388e3c; }
.tag-finished { background: #f3e5f5; color: #7b1fa2; }

.header {
  font-size: 0.36rem;
  font-weight: 600;
  margin-bottom: 0.24rem;
}

.opponent-banner {
  background: linear-gradient(135deg, #2d6cdf, #5b8def);
  color: #fff;
  border-radius: 0.16rem;
  padding: 0.32rem;
  margin-bottom: 0.24rem;
  display: flex;
  align-items: center;
  gap: 0.24rem;
}
.opponent-banner img {
  width: 0.96rem;
  height: 0.96rem;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 0.04rem solid rgba(255,255,255,0.6);
}
.opponent-banner .label { font-size: 0.24rem; opacity: 0.85; }
.opponent-banner .name { font-size: 0.32rem; font-weight: 600; }

/* 对阵图容器：横向滚动，禁止拉伸变形 */
.bracket-viewport {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  background: #fff;
  border-radius: 0.16rem;
  padding: 0.24rem 0;
}

.bracket-canvas {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  width: max-content;
  min-width: 100%;
  padding: 0.16rem 0.24rem;
  transform-origin: left top;
}

.bracket-round {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  flex-shrink: 0;
  width: 2.4rem;
  margin-right: 0.48rem;
  position: relative;
}

.bracket-round-title {
  text-align: center;
  font-size: 0.22rem;
  color: #888;
  margin-bottom: 0.16rem;
  flex-shrink: 0;
}

.bracket-match {
  background: #f8f9fb;
  border: 0.02rem solid #e0e4ea;
  border-radius: 0.1rem;
  margin: 0.12rem 0;
  overflow: hidden;
  flex-shrink: 0;
  min-height: 1.28rem;
}

.bracket-match.highlight {
  border-color: #2d6cdf;
  box-shadow: 0 0 0 0.04rem rgba(45,108,223,0.25);
}

.bracket-player {
  display: flex;
  align-items: center;
  padding: 0.12rem 0.16rem;
  font-size: 0.24rem;
  gap: 0.12rem;
  min-height: 0.64rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bracket-player.winner { background: #e8f4fd; font-weight: 600; }
.bracket-player.me { background: #fff8e1; }

.bracket-player img {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.bracket-player .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.bracket-divider {
  height: 0.02rem;
  background: #e0e4ea;
}

/* SVG 连接线层 */
.bracket-lines {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  overflow: visible;
}

/* 小组赛积分表 */
.group-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.24rem;
}
.group-table th, .group-table td {
  padding: 0.16rem 0.12rem;
  text-align: center;
  border-bottom: 0.02rem solid #eee;
}
.group-table th { color: #888; font-weight: 500; }

/* 领奖台 */
.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0.16rem;
  padding: 0.32rem 0;
}
.podium-item {
  text-align: center;
  flex: 1;
  max-width: 2rem;
}
.podium-item img {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 0.08rem;
}
.podium-bar {
  border-radius: 0.08rem 0.08rem 0 0;
  padding: 0.16rem 0.08rem;
  color: #fff;
  font-size: 0.22rem;
}
.podium-1 .podium-bar { background: #ffd700; height: 1.6rem; }
.podium-2 .podium-bar { background: #c0c0c0; height: 1.2rem; }
.podium-3 .podium-bar { background: #cd7f32; height: 0.9rem; }

.form-group { margin-bottom: 0.24rem; }
.form-group label { display: block; font-size: 0.26rem; color: #666; margin-bottom: 0.08rem; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 0.2rem;
  border: 0.02rem solid #ddd;
  border-radius: 0.1rem;
  font-size: 0.28rem;
}

.nav-bar {
  display: flex;
  gap: 0.16rem;
  margin-bottom: 0.32rem;
}
.nav-bar a {
  flex: 1;
  text-align: center;
  padding: 0.2rem;
  background: #fff;
  border-radius: 0.12rem;
  font-size: 0.26rem;
}

.page-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.16rem;
  margin-bottom: 0.24rem;
}

.page-top .header {
  margin-bottom: 0;
  flex: 1;
  min-width: 0;
}

.user-bar {
  flex-shrink: 0;
}

.user-bar-btn {
  display: flex;
  align-items: center;
  gap: 0.08rem;
  padding: 0.06rem 0.12rem 0.06rem 0.06rem;
  border: 0.02rem solid #e0e4ea;
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  max-width: 2.4rem;
}

.user-bar-logged {
  display: flex;
  align-items: center;
  gap: 0.08rem;
  max-width: 2.4rem;
}

.user-bar-avatar {
  width: 0.64rem;
  height: 0.64rem;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #e8ecf2;
}

.user-bar-name {
  font-size: 0.22rem;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 1.4rem;
}

.user-bar-guest .user-bar-name {
  color: #2d6cdf;
}

.user-bar-loading {
  font-size: 0.24rem;
  color: #aaa;
}

.user-bar-wrap {
  position: relative;
}

.user-bar-logged-btn {
  display: flex;
  align-items: center;
  gap: 0.08rem;
  padding: 0.06rem 0.12rem 0.06rem 0.06rem;
  border: 0.02rem solid #e0e4ea;
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  max-width: 2.4rem;
}

.user-menu {
  position: absolute;
  top: calc(100% + 0.08rem);
  right: 0;
  min-width: 2.4rem;
  background: #fff;
  border-radius: 0.12rem;
  box-shadow: 0 0.08rem 0.24rem rgba(0,0,0,0.12);
  z-index: 200;
  overflow: hidden;
}

.user-menu-item {
  display: block;
  width: 100%;
  padding: 0.24rem 0.32rem;
  font-size: 0.26rem;
  color: #333;
  text-decoration: none;
  text-align: left;
  border: none;
  background: #fff;
  cursor: pointer;
}

.user-menu-item:active,
.user-menu-item:hover {
  background: #f5f7fa;
}

.user-menu-logout {
  color: #e74c3c;
  border-top: 0.02rem solid #f0f0f0;
}

.profile-avatar-preview {
  width: 1.44rem;
  height: 1.44rem;
  border-radius: 50%;
  object-fit: cover;
  background: #e8ecf2;
}

.my-event-item {
  display: block;
  padding: 0.24rem 0;
  border-bottom: 0.02rem solid #f0f0f0;
  text-decoration: none;
  color: inherit;
}

.my-event-item:last-child { border-bottom: none; }

.my-event-title {
  font-size: 0.28rem;
  font-weight: 600;
  margin-bottom: 0.08rem;
}

.my-event-meta {
  font-size: 0.22rem;
  color: #888;
  margin-bottom: 0.08rem;
}

.list-empty {
  text-align: center;
  color: #888;
  padding: 0.48rem 0.24rem;
  font-size: 0.26rem;
  line-height: 1.6;
}

.tournament-list-item {
  display: block;
  padding: 0.24rem 0;
  border-bottom: 0.02rem solid #f0f0f0;
  text-decoration: none;
  color: inherit;
}

.tournament-list-item:last-child { border-bottom: none; }

.tournament-list-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.16rem;
  margin-bottom: 0.08rem;
}

.tournament-list-title {
  font-size: 0.28rem;
  font-weight: 600;
  flex: 1;
  line-height: 1.35;
}

.tournament-list-meta {
  font-size: 0.22rem;
  color: #888;
}

.tournament-list-loc {
  display: block;
  font-size: 0.22rem;
  color: #666;
  margin-top: 0.06rem;
}

.hosted-item {
  display: flex;
  align-items: center;
  gap: 0.16rem;
  border-bottom: 0.02rem solid #f0f0f0;
  padding: 0.12rem 0;
}

.hosted-item:last-child { border-bottom: none; }

.hosted-item-main {
  flex: 1;
  border-bottom: none;
  padding: 0.12rem 0;
}

.hosted-manage-btn {
  flex-shrink: 0;
  padding: 0.12rem 0.24rem;
  font-size: 0.24rem;
  text-decoration: none;
}

.cancelled-banner {
  background: #fff8f0;
  border: 0.02rem solid #f0d8a8;
}

.cancelled-banner-title {
  font-size: 0.28rem;
  font-weight: 600;
  color: #c0392b;
  margin-bottom: 0.12rem;
}

.cancelled-banner-desc {
  font-size: 0.24rem;
  color: #666;
  line-height: 1.5;
  margin-bottom: 0.2rem;
}

/* Markdown 赛事详情 */
.detail-md { font-size: 0.26rem; color: #444; line-height: 1.75; }
.detail-md h1, .detail-md h2, .detail-md h3 {
  color: #1a4fbf;
  font-weight: 700;
  margin: 0.24rem 0 0.12rem;
}
.detail-md h1 { font-size: 0.32rem; }
.detail-md h2 { font-size: 0.3rem; }
.detail-md h3 { font-size: 0.28rem; }
.detail-md p { margin: 0.12rem 0; text-align: justify; }
.detail-md ul { margin: 0.12rem 0 0.12rem 0.32rem; }
.detail-md li { margin: 0.08rem 0; }
.detail-md strong { color: #222; }
.detail-md code {
  background: #f5f7fa;
  padding: 0.04rem 0.08rem;
  border-radius: 0.06rem;
  font-size: 0.24rem;
}
.detail-md a { color: #2d6cdf; word-break: break-all; }

.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.75);
  color: #fff;
  padding: 0.24rem 0.48rem;
  border-radius: 0.12rem;
  font-size: 0.28rem;
  z-index: 9999;
  display: none;
}

/* ===== 比赛详情页 ===== */
.page-event {
  padding-bottom: 1.6rem;
}

.event-hero {
  background: linear-gradient(145deg, #1a4fbf 0%, #2d6cdf 45%, #5b8def 100%);
  border-radius: 0.2rem;
  padding: 0.36rem 0.32rem 0.4rem;
  margin-bottom: 0.24rem;
  color: #fff;
  box-shadow: 0 0.08rem 0.24rem rgba(45, 108, 223, 0.35);
}

.event-hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.16rem;
  margin-bottom: 0.24rem;
}

.event-title {
  font-size: 0.34rem;
  font-weight: 700;
  line-height: 1.45;
  flex: 1;
  min-width: 0;
}

.event-hero .tag {
  flex-shrink: 0;
  margin-top: 0.04rem;
  font-weight: 600;
}

.event-hero .tag-registering { background: rgba(255,255,255,0.95); color: #1a4fbf; }
.event-hero .tag-drawing { background: #fff3e0; color: #e65100; }
.event-hero .tag-playing { background: #e8f5e9; color: #2e7d32; }
.event-hero .tag-finished { background: rgba(255,255,255,0.9); color: #6a1b9a; }

.event-location {
  display: inline-flex;
  align-items: center;
  gap: 0.08rem;
  font-size: 0.24rem;
  background: rgba(255,255,255,0.18);
  padding: 0.1rem 0.2rem;
  border-radius: 999px;
  margin-bottom: 0.2rem;
}

.event-location a {
  color: #fff;
  text-decoration: none;
}

.event-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.16rem;
}

.event-meta-item {
  background: rgba(255,255,255,0.14);
  border-radius: 0.12rem;
  padding: 0.2rem 0.2rem;
  backdrop-filter: blur(4px);
}

.event-meta-item.full {
  grid-column: 1 / -1;
}

.event-meta-label {
  font-size: 0.2rem;
  opacity: 0.85;
  margin-bottom: 0.06rem;
}

.event-meta-value {
  font-size: 0.26rem;
  font-weight: 600;
  line-height: 1.35;
}

.section-card {
  background: #fff;
  border-radius: 0.2rem;
  padding: 0.28rem 0.32rem 0.32rem;
  margin-bottom: 0.24rem;
  box-shadow: 0 0.02rem 0.16rem rgba(0,0,0,0.05);
}

.section-head {
  display: flex;
  align-items: center;
  gap: 0.12rem;
  font-size: 0.3rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 0.24rem;
  padding-bottom: 0.16rem;
  border-bottom: 0.02rem solid #f0f2f5;
}

.section-head-icon {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 0.1rem;
  background: linear-gradient(135deg, #e8f0fe, #d4e4fc);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.22rem;
}

.detail-section {
  margin-bottom: 0.28rem;
}

.detail-section:last-child {
  margin-bottom: 0;
}

.detail-section h4 {
  font-size: 0.28rem;
  font-weight: 700;
  color: #1a4fbf;
  margin-bottom: 0.12rem;
  padding-left: 0.16rem;
  border-left: 0.06rem solid #2d6cdf;
}

.detail-section p,
.detail-body p {
  font-size: 0.26rem;
  color: #444;
  line-height: 1.75;
  text-align: justify;
}

.detail-empty {
  font-size: 0.26rem;
  color: #999;
  text-align: center;
  padding: 0.32rem 0;
}

.event-actions {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(8px);
  border-top: 0.02rem solid #eee;
  padding: 0.2rem 0.32rem calc(0.2rem + env(safe-area-inset-bottom));
  display: flex;
  gap: 0.16rem;
  max-width: 7.5rem;
  margin: 0 auto;
}

.event-actions .btn {
  flex: 1;
  padding: 0.26rem 0.24rem;
  font-size: 0.3rem;
  font-weight: 600;
  border-radius: 0.16rem;
}

.event-actions .btn-secondary {
  flex: 0.6;
  background: #f0f2f5;
  color: #555;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.event-actions .btn-primary {
  box-shadow: 0 0.06rem 0.16rem rgba(45, 108, 223, 0.35);
}

.event-loading {
  text-align: center;
  padding: 1.2rem 0;
  color: #999;
  font-size: 0.28rem;
}

.opponent-banner {
  margin-bottom: 0.24rem;
}

.section-card.hidden-empty:empty {
  display: none;
}

/* 地点选择器 */
.location-picker { margin-top: 0.08rem; }

.location-search-wrap {
  position: relative;
  display: flex;
  gap: 0.12rem;
  align-items: center;
}

.location-name-input {
  flex: 1;
  width: 100%;
  padding: 0.2rem 0.24rem;
  border: 0.02rem solid #ddd;
  border-radius: 0.12rem;
  font-size: 0.28rem;
}

.location-gps-btn {
  flex-shrink: 0;
  width: 0.72rem;
  height: 0.72rem;
  border: 0.02rem solid #ddd;
  border-radius: 0.12rem;
  background: #f8f9fb;
  font-size: 0.32rem;
  cursor: pointer;
  line-height: 1;
}

.location-suggest-list {
  position: absolute;
  left: 0;
  right: 0.84rem;
  top: calc(100% + 0.04rem);
  z-index: 200;
  background: #fff;
  border: 0.02rem solid #e8e8e8;
  border-radius: 0.12rem;
  box-shadow: 0 0.08rem 0.24rem rgba(0,0,0,0.1);
  max-height: 4.8rem;
  overflow-y: auto;
  list-style: none;
}

.location-suggest-list li {
  padding: 0.2rem 0.24rem;
  border-bottom: 0.02rem solid #f0f0f0;
  cursor: pointer;
}

.location-suggest-list li:active { background: #f0f6ff; }

.location-suggest-title {
  font-size: 0.28rem;
  color: #1a1a2e;
  line-height: 1.35;
}

.location-suggest-addr {
  font-size: 0.22rem;
  color: #888;
  margin-top: 0.04rem;
}

.location-map-wrap {
  position: relative;
  margin-top: 0.2rem;
  border-radius: 0.12rem;
  overflow: hidden;
  border: 0.02rem solid #e8e8e8;
}

.location-map {
  width: 100%;
  height: 4.2rem;
}

.location-map-pin {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.36rem;
  height: 0.48rem;
  margin-left: -0.18rem;
  margin-top: -0.48rem;
  pointer-events: none;
  z-index: 10;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 36'%3E%3Cpath fill='%23e74c3c' d='M12 0C5.4 0 0 5.4 0 12c0 9 12 24 12 24s12-15 12-24C24 5.4 18.6 0 12 0z'/%3E%3Ccircle fill='%23fff' cx='12' cy='12' r='5'/%3E%3C/svg%3E") center/contain no-repeat;
}

.location-picker-hint {
  font-size: 0.22rem;
  color: #888;
  margin-top: 0.12rem;
  line-height: 1.45;
}

.event-location a,
.event-location button.event-location-link {
  color: #2d6cdf;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

