/* 邀请注册落地页样式 —— 375 设计宽度，1rem = 16px @375 */
:root {
  --brand: #2f6bff;
  --brand-dark: #1f4fd8;
  --text: #1b2333;
  --sub: #5b6577;
  --muted: #8a93a6;
  --line: #e6ebf3;
  --bg: #f5f7fb;
  --danger: #e84343;
  --success: #12a150;
  --radius: 0.875rem;
}

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

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

/* 375 基准等比缩放，桌面端固定 16px */
@media (max-width: 480px) {
  html {
    font-size: calc(100vw / 375 * 16);
  }
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

/* ------------------------------ 通用组件 ------------------------------ */

.brand-logo {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 1.25rem;
  background: linear-gradient(135deg, #3b82f6, #7c3aed);
  color: #fff;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0.625rem 1.5rem rgba(47, 107, 255, 0.28);
}

.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 2.875rem;
  padding: 0 1rem;
  border: 0;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #3b82f6, #2f6bff);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 0.5rem 1.25rem rgba(47, 107, 255, 0.24);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.btn-primary:active {
  transform: scale(0.985);
}

.btn-primary[disabled],
.btn-primary.is-disabled,
.btn-primary.is-loading {
  background: #c3cddd;
  box-shadow: none;
  color: #fff;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary.is-plain {
  background: #eef2fa;
  color: var(--sub);
  box-shadow: none;
  pointer-events: none;
}

.btn-primary.is-loading::after {
  content: "";
  width: 0.9rem;
  height: 0.9rem;
  margin-left: 0.5rem;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

.toast {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 999;
  max-width: 80vw;
  padding: 0.75rem 1.125rem;
  transform: translate(-50%, -50%);
  border-radius: 0.625rem;
  background: rgba(20, 24, 35, 0.9);
  color: #fff;
  font-size: 0.875rem;
  line-height: 1.5;
  text-align: center;
  animation: toast-in 0.2s ease;
}

.toast.is-out {
  opacity: 0;
  transition: opacity 0.3s ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, -46%);
  }
}

/* ------------------------------ 加载页 ------------------------------ */

.loading-page {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #fff;
}

.loading-text {
  margin: 1.5rem 0 0;
  font-size: 0.9375rem;
  color: var(--sub);
  letter-spacing: 0.02em;
}

.loading-bar {
  width: 4.5rem;
  height: 3px;
  margin-top: 1rem;
  border-radius: 2px;
  background: #eaf0fb;
  overflow: hidden;
}

.loading-bar::after {
  content: "";
  display: block;
  width: 40%;
  height: 100%;
  border-radius: 2px;
  background: var(--brand);
  animation: loading 0.9s ease-in-out infinite;
}

@keyframes loading {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(250%);
  }
}

/* ------------------------------ 微信引导遮罩 ------------------------------ */

.guide-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  padding: 1.5rem 1.25rem calc(2rem + env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.62);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  animation: fade-in 0.2s ease;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.guide-arrow {
  position: absolute;
  top: 0.5rem;
  right: 1rem;
  width: 5.5rem;
  height: 5.5rem;
  color: #fff;
  animation: arrow-bounce 1.2s ease-in-out infinite;
}

.guide-arrow svg {
  width: 100%;
  height: 100%;
  display: block;
}

@keyframes arrow-bounce {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(0.375rem, -0.375rem);
  }
}

.guide-card {
  padding: 1.5rem 1.25rem;
  border-radius: 1rem;
  background: #fff;
  text-align: center;
}

.guide-title {
  margin: 0 0 0.75rem;
  font-size: 1.125rem;
  font-weight: 600;
}

.guide-desc {
  margin: 0 0 1.25rem;
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--sub);
}

.guide-desc .dots {
  display: inline-block;
  padding: 0 0.25rem;
  font-weight: 700;
  color: var(--text);
}

.guide-actions {
  display: flex;
  gap: 0.75rem;
}

.guide-actions .btn-primary {
  flex: 1;
}

.guide-tip {
  margin: 0.875rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

/* ------------------------------ 中性提示卡片 ------------------------------ */

.notice-page {
  padding-top: calc(3rem + env(safe-area-inset-top));
}

.notice-card {
  width: 100%;
  padding: 1.5rem 1.25rem;
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 0.25rem 1rem rgba(27, 35, 51, 0.05);
  text-align: center;
}

.notice-text {
  margin: 0 0 1.25rem;
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--sub);
}

.notice-card .btn-primary {
  width: 100%;
}

/* ------------------------------ 注册页 ------------------------------ */

.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 1.25rem calc(1.5rem + env(safe-area-inset-bottom));
}

.reg-page {
  padding-top: calc(2rem + env(safe-area-inset-top));
}

.reg-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1.5rem;
}

.reg-head .brand-logo {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 1rem;
  font-size: 1.375rem;
}

.reg-title {
  margin: 0.875rem 0 0.25rem;
  font-size: 1.375rem;
  font-weight: 600;
}

.reg-subtitle {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.form-card {
  padding: 1.25rem 1rem;
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 0.25rem 1rem rgba(27, 35, 51, 0.05);
}

.alert-bar {
  display: flex;
  align-items: flex-start;
  gap: 0.375rem;
  margin-bottom: 0.875rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.5rem;
  background: #fdeaea;
  color: var(--danger);
  font-size: 0.8125rem;
  line-height: 1.5;
  word-break: break-all;
}

.field {
  margin-bottom: 1rem;
}

.field-label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.8125rem;
  color: var(--sub);
}

.field-input {
  display: block;
  width: 100%;
  height: 2.875rem;
  padding: 0 0.875rem;
  border: 1px solid var(--line);
  border-radius: 0.625rem;
  background: #fafbfe;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.2;
  outline: none;
  appearance: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.field-input::placeholder {
  color: #b6bece;
  font-size: 0.875rem;
}

.field-input:focus {
  border-color: var(--brand);
  background: #fff;
}

.field.is-error .field-input {
  border-color: var(--danger);
  background: #fffafa;
}

.field-error {
  margin: 0.375rem 0 0;
  font-size: 0.75rem;
  color: var(--danger);
  line-height: 1.4;
}

.form-actions {
  margin-top: 1.25rem;
}

.form-foot {
  margin: 1rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
}

/* ------------------------------ 注册成功页 ------------------------------ */

.success-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: calc(3rem + env(safe-area-inset-top));
  text-align: center;
}

.success-icon {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  background: #e8f8ef;
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
}

.success-icon svg {
  width: 2.25rem;
  height: 2.25rem;
}

.success-title {
  margin: 1rem 0 0.5rem;
  font-size: 1.375rem;
  font-weight: 600;
}

.success-tip {
  margin: 0 0 1.75rem;
  font-size: 0.9375rem;
  color: var(--sub);
}

.download-area {
  width: 100%;
  padding: 1.5rem 1.25rem;
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 0.25rem 1rem rgba(27, 35, 51, 0.05);
}

.download-hint {
  margin: 0.75rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.qr-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--line);
}

.qr-box {
  width: 8.75rem;
  height: 8.75rem;
  padding: 0.375rem;
  border-radius: 0.5rem;
  background: #fff;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.qr-box img,
.qr-box canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.qr-box.is-empty::after {
  content: "二维码加载中";
  font-size: 0.75rem;
  color: var(--muted);
}

.qr-tip {
  margin: 0.625rem 0 0;
  font-size: 0.8125rem;
  color: var(--sub);
}

/* ------------------------------ 下载页 ------------------------------ */

.download-page {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(2.5rem + env(safe-area-inset-top)) 1.25rem calc(2rem + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.download-head {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.download-title {
  margin: 1rem 0 0.5rem;
  font-size: 1.375rem;
  font-weight: 600;
}

.download-desc {
  margin: 0 0 1.5rem;
  font-size: 0.875rem;
  color: var(--sub);
}

.download-buttons {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 2.875rem;
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  background: #fff;
  color: var(--brand);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn-secondary[disabled],
.btn-secondary.is-disabled {
  border-color: var(--line);
  background: #f3f5f9;
  color: var(--muted);
  pointer-events: none;
}

.platform-tag {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  margin-left: 0.375rem;
  border-radius: 0.625rem;
  background: rgba(47, 107, 255, 0.1);
  color: var(--brand);
  font-size: 0.6875rem;
  font-weight: 500;
  vertical-align: 2px;
}

/* ------------------------------ 微信内首屏预隐藏 ------------------------------ */
/* html.in-wechat 由 assets/env.js 在 <head> 中同步写入，样式加载即生效，避免先渲染后隐藏 */

.in-wechat .download-head,
.in-wechat .download-desc,
.in-wechat .download-buttons,
.in-wechat .qr-block,
.in-wechat .form-foot {
  display: none !important;
}

.in-wechat .loading-page {
  display: none !important;
}

