/* 公众号 H5 个人中心 — 移动端优先 */
:root {
  --bg: #f3f4f6;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2563eb;
  --danger: #b91c1c;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family:
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    'Helvetica Neue',
    Arial,
    'PingFang SC',
    'Microsoft YaHei',
    sans-serif;
  color: var(--text);
  background: var(--bg);
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  padding-top: calc(12px + env(safe-area-inset-top));
}

#app {
  max-width: 480px;
  margin: 0 auto;
}

.login-wrap {
  max-width: 480px;
  margin: 0 auto;
}

.login-hint {
  margin-top: 12px;
}

.login-footer {
  margin: 16px 0 0;
  text-align: center;
}

.link-muted {
  color: var(--muted);
  font-size: 0.875rem;
  text-decoration: none;
}

.link-muted:active {
  opacity: 0.75;
}

.main {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* .main 上的 display:flex 会覆盖浏览器对 [hidden] 的 display:none，导致未登录时主区域仍可见 */
.main[hidden] {
  display: none !important;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.section-title {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 8px;
}

.points-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.points-card__head .section-title {
  margin-bottom: 0;
}

.btn.points-card__refresh {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  line-height: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  border-radius: 10px;
}

.btn.points-card__refresh:active {
  opacity: 0.65;
}

.points-card__refresh-icon {
  display: block;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.8125rem;
  line-height: 1.5;
}

.user-card__row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-card__guest-title {
  font-weight: 600;
  margin: 0 0 8px;
  font-size: 1.0625rem;
}

.user-card__guest-desc {
  margin: 0 0 14px;
  line-height: 1.5;
}

.user-card__guest-btn {
  margin-top: 2px;
}

.main-logged-blocks {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--border);
  flex-shrink: 0;
}

.nickname {
  font-size: 1.125rem;
  font-weight: 600;
}

.points-value {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--primary);
}

.qrcode-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
  margin: 12px 0;
}

.qrcode-wrap img,
.qrcode-wrap canvas {
  display: block;
  border-radius: 8px;
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--primary);
  font-size: 0.9375rem;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  opacity: 0.85;
}

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

.btn--block {
  width: 100%;
  margin-top: 8px;
}

.btn--primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn--primary:active {
  opacity: 0.92;
}

.gate__btn {
  margin-top: 16px;
}

.card.sub-card {
  padding: 12px 14px;
}

.sub-card .section-title {
  margin-bottom: 6px;
}

.sub-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sub-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

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

.sub-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--border);
}

.sub-avatar--ph {
  background: linear-gradient(135deg, #e5e7eb, #d1d5db);
}

.sub-meta {
  flex: 1;
  min-width: 0;
}

.sub-name-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.sub-name {
  font-weight: 500;
  font-size: 0.875rem;
  line-height: 1.25;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sub-credits {
  flex-shrink: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
}

.sub-time {
  font-size: 0.6875rem;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.3;
}

.empty-tip,
.error-tip {
  margin: 8px 0 0;
}

.sub-card .empty-tip,
.sub-card .error-tip {
  margin: 4px 0 0;
}

.error-tip {
  color: var(--danger);
}

.page-error-box .page-error {
  margin: 0;
  color: var(--danger);
  line-height: 1.5;
}

.page-error-box__btn {
  margin-top: 14px;
}

.gate__title {
  font-weight: 600;
  margin: 0 0 8px;
}

.gate code {
  font-size: 0.8em;
  padding: 0 4px;
  background: var(--bg);
  border-radius: 4px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px);
  max-width: min(90vw, 360px);
  padding: 10px 16px;
  background: rgba(17, 24, 39, 0.92);
  color: #fff;
  font-size: 0.875rem;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  z-index: 1000;
  text-align: center;
}

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