/* 页面级样式：登录 / 首页 / 我的 */

/* ---------- 登录注册 ---------- */
.login {
  max-width: 420px;
  margin: 0 auto;
  padding: 9vh 20px calc(24px + var(--safe-bottom));
  display: flex;
  flex-direction: column;                /* 配合 .login > .site-footer 的 margin-top:auto，把备案号吸到屏幕底部 */
}
.login > .site-footer { margin-top: auto; padding-top: 20px; }
.login__brand { text-align: center; margin-bottom: 26px; }
.login__logo { display: flex; justify-content: center; line-height: 1; }
.login__title { margin-top: 8px; font-size: 24px; letter-spacing: 3px; }
.login__sub { margin-top: 4px; color: var(--c-text-2); font-size: 13px; }
.login__form { margin-top: 20px; }
.login__footer {
  margin-top: 24px;
  text-align: center;
  color: var(--c-text-3);
  font-size: 12px;
  line-height: 1.7;
}
.login__error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--r-btn);
  background: var(--c-danger-soft);
  color: #991b1b;
  font-size: 13px;
}

/* ---------- 首页 ---------- */
.home__greet { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.home__greet-text { flex: 1; min-width: 0; }
.home__hello { font-size: 20px; font-weight: 600; }
.home__sub { color: var(--c-text-2); font-size: 13px; }

.home__actions { display: flex; flex-direction: column; gap: 10px; }
.join-box { display: flex; gap: 8px; }
.join-box .input {
  text-transform: uppercase;
  letter-spacing: 3px;
  font-weight: 600;
  text-align: center;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r-card);
  background: var(--c-card);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.activity-item__main { flex: 1; min-width: 0; }
.activity-item__name {
  font-size: 16px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.activity-item__meta { margin-top: 3px; color: var(--c-text-2); font-size: 12px; }
.activity-item__progress { margin-top: 6px; }
.progress-bar {
  height: 5px;
  border-radius: 3px;
  background: var(--c-line-soft);
  overflow: hidden;
}
.progress-bar__fill { height: 100%; background: var(--c-primary); border-radius: 3px; }

/* ---------- 我的 ---------- */
.me__profile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 16px;
}
.me__name { font-size: 19px; font-weight: 600; }
.me__meta { margin-top: 4px; display: flex; gap: 6px; flex-wrap: wrap; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.stat {
  padding: 14px;
  border-radius: var(--r-card);
  background: var(--c-card);
  box-shadow: var(--shadow);
  text-align: center;
}
.stat__value { font-size: 22px; font-weight: 700; color: var(--c-primary); }
.stat__label { margin-top: 2px; font-size: 12px; color: var(--c-text-2); }

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--c-line-soft);
}
.form-row:last-child { border-bottom: none; }
.form-row__label { font-size: 15px; }
.form-row__value { color: var(--c-text-2); font-size: 14px; }

.gender-picker { display: flex; gap: 10px; }
.gender-picker .btn { flex: 1; }
.gender-picker .btn.is-active {
  background: var(--c-primary-soft);
  border-color: var(--c-primary);
  color: var(--c-primary-dark);
  font-weight: 600;
}

/* 通用：次要说明块 */
.muted { color: var(--c-text-2); font-size: 13px; }
.tiny { font-size: 12px; color: var(--c-text-3); }

/* 开发中占位 */
.coming {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18vh 24px;
  text-align: center;
  color: var(--c-text-2);
}
.coming__icon { font-size: 52px; }
.coming__title { font-size: 18px; font-weight: 600; color: var(--c-text); }

/* ---------- 发起活动 ---------- */
.type-cards { display: flex; flex-direction: column; gap: 10px; }
.type-card {
  padding: 14px 16px;
  border: 1.5px solid var(--c-line);
  border-radius: var(--r-card);
  background: var(--c-card);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.type-card.is-active { border-color: var(--c-primary); background: var(--c-primary-soft); }
.type-card__head { display: flex; align-items: center; justify-content: space-between; }
.type-card__name { font-size: 16px; font-weight: 600; }
.type-card__desc { margin-top: 2px; color: var(--c-text-2); font-size: 13px; }

.stepper {
  display: flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--c-line);
  border-radius: 10px;
  overflow: hidden;
}
.stepper button {
  width: 40px; height: 40px;
  border: none; background: #fff;
  font-size: 20px; color: var(--c-text);
  cursor: pointer;
}
.stepper button:active { background: var(--c-line-soft); }
.stepper span { min-width: 44px; text-align: center; font-weight: 600; }

.switch { position: relative; display: inline-block; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch__slider {
  position: absolute; inset: 0;
  background: #d1d5db; border-radius: 999px;
  transition: background .18s ease; cursor: pointer;
}
.switch__slider::before {
  content: ''; position: absolute;
  width: 24px; height: 24px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%;
  transition: transform .18s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + .switch__slider { background: var(--c-primary); }
.switch input:checked + .switch__slider::before { transform: translateX(20px); }

.handicap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.handicap-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--c-text-2); }
.handicap-grid .input { min-height: 42px; padding: 6px 10px; text-align: center; }

.estimate { flex: 1.4; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.estimate__main { font-size: 14px; font-weight: 600; }
.estimate__sub { font-size: 11px; color: var(--c-text-3); }

/* ---------- 分享卡片 ---------- */
.share-box { text-align: center; }
.share-code {
  display: inline-block;
  padding: 10px 22px;
  border-radius: 12px;
  background: var(--c-primary-soft);
  color: var(--c-primary-dark);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 6px;
}

/* ---------- 规则说明表 ---------- */
.rule-table { display: flex; flex-direction: column; gap: 8px; }
.rule-table__row { display: flex; gap: 10px; font-size: 13px; line-height: 1.6; }
.rule-table__key {
  flex: none; width: 56px;
  color: var(--c-accent); font-weight: 600;
}
.rule-table__val { flex: 1; color: var(--c-text); }

/* ---------- 活动详情 ---------- */
.invite-card { text-align: center; padding: 18px 16px; }
.invite-code {
  font-size: 30px; font-weight: 700; letter-spacing: 6px;
  color: var(--c-primary-dark);
}
.member-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--c-line-soft); }
.member-row:last-child { border-bottom: none; }
.member-row__name { font-size: 15px; }
.member-row__meta { display: flex; gap: 6px; align-items: center; margin-top: 2px; }
.member-row--incomplete { opacity: .6; }

.pair-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--c-line-soft); }
.pair-row:last-child { border-bottom: none; }
.pair-row__name { font-size: 15px; }
.pair-row__level { color: var(--c-text-2); font-size: 13px; }

.meta-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 12px; }
.meta-item__label { font-size: 12px; color: var(--c-text-3); }
.meta-item__value { font-size: 15px; font-weight: 500; }

/* 选人配对 */
.pick-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.pick-chip {
  padding: 8px 12px;
  border: 1.5px solid var(--c-line);
  border-radius: 999px;
  background: #fff;
  font-size: 14px; font-family: inherit;
  cursor: pointer;
}
.pick-chip.is-picked { border-color: var(--c-primary); background: var(--c-primary-soft); color: var(--c-primary-dark); font-weight: 600; }
.pick-chip:disabled { opacity: .45; }

/* ---------- 对阵预览 ---------- */
.stat-line { font-size: 14px; line-height: 1.9; }
.match-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--c-line-soft);
  font-size: 14px;
}
.match-line:last-child { border-bottom: none; }
.match-line__court { flex: none; width: 48px; color: var(--c-text-3); font-size: 12px; }
.match-line__team { flex: 1; min-width: 0; text-align: center; }
.match-line__vs { flex: none; color: var(--c-text-3); font-size: 12px; }

/* ---------- 记分滚轮 ---------- */
.wheel { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; }
.wheel__label { font-size: 12px; color: var(--c-text-3); }
.wheel__viewport {
  height: 220px;
  width: 100%;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(to bottom, transparent, #000 22%, #000 78%, transparent);
}
.wheel__viewport::-webkit-scrollbar { display: none; }
.wheel__item {
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: center;
  font-size: 26px;
  font-variant-numeric: tabular-nums;
  color: var(--c-text-3);
  transition: color .12s ease, transform .12s ease;
  cursor: pointer;
}
.wheel__item.is-active { color: var(--c-primary-dark); font-weight: 700; transform: scale(1.28); }
.wheel__btn {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-btn);
  background: #fff;
  font-size: 22px;
  color: var(--c-text);
  cursor: pointer;
}
.wheel__btn:active { background: var(--c-line-soft); }
.wheel-row { display: flex; align-items: center; gap: 8px; }
.wheel-colon { font-size: 26px; font-weight: 700; color: var(--c-text-3); padding-top: 24px; }
.score-team { text-align: center; padding: 6px 0; }
.score-team__name { font-size: 17px; font-weight: 600; }
.score-vs { text-align: center; color: var(--c-text-3); font-size: 12px; margin: 2px 0; }

/* ---------- 比赛列表 ---------- */
.match-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--c-line-soft);
  cursor: pointer;
  font-size: 14px;
}
.match-row:last-child { border-bottom: none; }
.match-row__court { flex: none; width: 46px; color: var(--c-text-3); font-size: 12px; }
.match-row__team { flex: 1; min-width: 0; text-align: center; }
.match-row__score { flex: none; min-width: 58px; text-align: center; font-weight: 600; }
.match-row.is-done .match-row__score { color: var(--c-primary-dark); }

/* ---------- 排行榜 ---------- */
.rank-head, .rank-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 2px;
}
.rank-head { color: var(--c-text-3); font-size: 12px; border-bottom: 1px solid var(--c-line-soft); }
.rank-row { border-bottom: 1px solid var(--c-line-soft); cursor: pointer; }
.rank-row:last-child { border-bottom: none; }
.rank-row.is-me { background: var(--c-primary-soft); border-radius: 8px; }
.rank-head__no, .rank-row__no { flex: none; width: 38px; text-align: center; font-weight: 600; }
/* 名次徽章：用纯 CSS 表示金银铜，避免依赖 emoji 字体（部分设备会显示成方块） */
.rank-medal {
  display: inline-grid;
  place-items: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: var(--c-text-3);
}
.rank-medal--1 { background: linear-gradient(135deg, #fbbf24, #d97706); box-shadow: 0 1px 4px rgba(217,119,6,.4); }
.rank-medal--2 { background: linear-gradient(135deg, #cbd5e1, #94a3b8); box-shadow: 0 1px 4px rgba(148,163,184,.4); }
.rank-medal--3 { background: linear-gradient(135deg, #d8a47f, #b45309); box-shadow: 0 1px 4px rgba(180,83,9,.35); }
.rank-medal--plain { background: transparent; color: var(--c-text-2); }
.rank-head__name, .rank-row__name { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; }
.rank-row__nick { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-head__num, .rank-row__num { flex: none; width: 52px; text-align: right; font-variant-numeric: tabular-nums; }
.rank-row__points { font-weight: 700; color: var(--c-primary-dark); }
.rank-detail {
  padding: 10px 12px;
  margin: 0 0 8px;
  border-radius: var(--r-btn);
  background: var(--c-line-soft);
  font-size: 13px;
  color: var(--c-text-2);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ---------- 战绩海报预览 ---------- */
.poster-preview {
  max-height: 58vh;
  overflow-y: auto;
  border-radius: var(--r-btn);
  background: var(--c-line-soft);
}
.poster-preview img { width: 100%; display: block; border-radius: var(--r-btn); }
