/* =========================================================
   云家重启 —— 全局样式
   设计基准宽度：393px（移动端）
   ========================================================= */

:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --app-max-width: 440px;
  --page-padding: 22px;
}

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

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

html, body {
  font-family: "PingFang SC", "Alibaba PuHuiTi", "Microsoft YaHei", "Inter", -apple-system, sans-serif;
  background: #f4f4f6;
  color: #1f2937;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
}

body {
  max-width: var(--app-max-width);
  margin: 0 auto;
  background: #fffbfb;
  min-height: 100vh;
  min-height: 100dvh; /* 动态视口，解决移动端浏览器栏变化 */
  position: relative;
  overflow-x: hidden;
  touch-action: manipulation; /* 禁用 iOS 双击缩放 */
}

/* 小屏 (<=360px) 压缩全局间距 */
@media (max-width: 360px) {
  :root { --page-padding: 16px; }
  html { font-size: 13px; }
}

/* 大屏手机/横屏 (>=430px) 放宽一点 */
@media (min-width: 430px) {
  :root { --page-padding: 24px; }
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; border: none; background: none; cursor: pointer; color: inherit; }
input, textarea { font: inherit; outline: none; border: none; background: transparent; }

.btn-primary {
  width: 100%;
  height: 53px;
  border-radius: 100px;
  background: #d32f2f;
  color: #fff;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 2px;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, background .2s;
  box-shadow: 0 8px 20px rgba(211,47,47,.3);
}
.btn-primary:hover { background: #c42a27; }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { background: #c8c8c8; box-shadow: none; cursor: not-allowed; }

/* =========================================================
   Toast
   ========================================================= */
.toast-stack {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: rgba(0,0,0,.78);
  color: #fff;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  max-width: 320px;
  line-height: 1.45;
  text-align: center;
  animation: toast-in .25s ease-out;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   Dialog（居中弹窗）
   ========================================================= */
.dialog-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fade-in .2s ease-out;
}
@keyframes fade-in { from { opacity: 0 } to { opacity: 1 } }
.dialog {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 340px;
  overflow: hidden;
  animation: pop-in .25s cubic-bezier(.2,.9,.3,1.3);
}
@keyframes pop-in {
  from { opacity: 0; transform: scale(.9); }
  to   { opacity: 1; transform: scale(1); }
}
.dialog-header {
  padding: 20px 20px 6px;
  font-weight: 600;
  font-size: 17px;
  color: #1f2937;
  text-align: center;
}
.dialog-body {
  padding: 8px 24px 20px;
  color: #4b5563;
  text-align: center;
  font-size: 14px;
  line-height: 1.6;
}
.dialog-footer {
  display: flex;
  border-top: 1px solid #f1f5f9;
}
.dialog-footer button {
  flex: 1;
  padding: 14px 0;
  font-size: 15px;
  color: #d32f2f;
  font-weight: 500;
}
.dialog-footer button + button {
  border-left: 1px solid #f1f5f9;
}
.dialog-footer .cancel {
  color: #64748b;
  font-weight: 400;
}

/* 底部抽屉 */
.sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 9000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade-in .2s ease-out;
}
.sheet {
  background: #fff;
  width: 100%;
  max-width: var(--app-max-width);
  border-radius: 16px 16px 0 0;
  padding: 16px 20px calc(28px + var(--safe-bottom));
  animation: slide-up .28s cubic-bezier(.2,.9,.3,1.1);
}
@keyframes slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.sheet-title {
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  padding-bottom: 14px;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 14px;
}
.sheet-item {
  padding: 14px 0;
  text-align: center;
  font-size: 15px;
  border-bottom: 1px solid #f1f5f9;
}
.sheet-item:last-child { border-bottom: none; }
.sheet-item.primary { color: #d32f2f; font-weight: 500; }
.sheet-item.cancel { color: #64748b; margin-top: 8px; border-bottom: none; }

/* =========================================================
   站点底部版权栏（登录/注册/首页共用）
   ========================================================= */
.site-footer {
  position: relative;
  z-index: 2;
  padding: 28px max(18px, var(--safe-left)) max(20px, var(--safe-bottom)) max(18px, var(--safe-right));
  text-align: center;
  font-size: 11.5px;
  line-height: 1.8;
  letter-spacing: .3px;
}

/* 主题 */
.site-footer--dark  { color: rgba(255, 240, 225, .78); }
.site-footer--dark a { color: rgba(255, 240, 225, .92); text-decoration: none; }
.site-footer--light { color: #64748b; background: #fafafb; border-top: 1px solid #eef0f3; }
.site-footer--light a { color: #475569; text-decoration: none; }

.sf-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  text-align: left;
}
.sf-seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 6px;
  background: rgba(211, 47, 47, .9);
  color: #ffe9b7;
  font-family: "STKaiti", "楷体", "KaiTi", serif;
  font-size: 16px;
  font-weight: 700;
  border: 1px solid #f5d27a;
}
.site-footer--light .sf-seal { background: #d32f2f; }
.sf-brand-name {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 2px;
  color: inherit;
}
.sf-brand-sub {
  font-size: 9px;
  opacity: .75;
  letter-spacing: 2px;
}

.sf-links {
  margin-top: 4px;
  font-size: 11.5px;
}
.sf-links a {
  display: inline-block;
  padding: 2px 2px;
  transition: opacity .15s;
}
.sf-links a:hover { opacity: .7; }
.sf-sep {
  margin: 0 6px;
  opacity: .5;
}

.sf-meta {
  margin-top: 10px;
  font-size: 11px;
  opacity: .82;
}
.sf-meta > div + div { margin-top: 2px; }
.sf-meta a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.sf-meta a:hover { text-decoration: underline; }
.sf-gov { display: inline-block; width: 12px; height: 12px; vertical-align: -2px; }

.sf-copy {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(255,255,255,.2);
  opacity: .8;
  font-size: 10.5px;
}
.site-footer--light .sf-copy { border-top-color: #e5e7eb; }

.sf-ver {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255,255,255,.08);
  font-size: 10px;
  font-family: Inter, monospace;
  opacity: .8;
}
.site-footer--light .sf-ver { background: #eef0f3; color: #475569; }

@media (max-width: 360px) {
  .site-footer { font-size: 11px; padding-top: 22px; }
  .sf-links a { padding: 2px 0; }
  .sf-sep { margin: 0 4px; }
}

/* =========================================================
   头像选择/上传 Sheet（全站共用）
   ========================================================= */
.avatar-sheet { padding: 0 20px max(28px, var(--safe-bottom)); }

.as-header { text-align: center; padding: 22px 0 10px; }
.as-title { font-size: 17px; font-weight: 700; color: #1f2937; letter-spacing: 1px; }
.as-subtitle { margin-top: 6px; font-size: 12px; color: #94a3b8; letter-spacing: .5px; }

.as-preview { display: flex; justify-content: center; margin: 6px 0 18px; }
.as-preview-img {
  width: 100px; height: 100px;
  border-radius: 50%;
  padding: 4px;
  background: linear-gradient(135deg, #f5d27a, #c39352);
  box-shadow: 0 8px 22px rgba(196, 42, 39, .25);
  position: relative;
}
.as-preview-img img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  display: block;
}

.as-actions { display: flex; flex-direction: column; gap: 10px; }
.as-btn {
  display: flex; align-items: center; gap: 12px;
  height: 52px; padding: 0 16px;
  border-radius: 12px;
  background: #f6f7f9;
  font-size: 15px; color: #1f2937;
  cursor: pointer;
  transition: background .15s, transform .12s;
  user-select: none;
}
.as-btn:active { transform: scale(.99); background: #eef0f3; }
.as-btn .ico { width: 22px; height: 22px; color: #d32f2f; flex-shrink: 0; }
.as-btn .label { flex: 1; font-weight: 500; }
.as-btn .arrow { color: #cbd5e1; font-size: 18px; line-height: 1; }
.as-btn.primary {
  background: linear-gradient(90deg, #e53935, #c42a27);
  color: #fff;
  box-shadow: 0 10px 20px rgba(196, 42, 39, .3);
}
.as-btn.primary .ico { color: #fff6e0; }
.as-btn.primary .arrow { color: rgba(255, 246, 224, .8); }

.as-tips {
  margin-top: 14px; padding: 10px 12px;
  background: #fff8ec;
  border: 1px solid #f9e2b7;
  border-radius: 10px;
  color: #92400e;
  font-size: 11.5px; line-height: 1.6;
  display: flex; gap: 6px; align-items: flex-start;
}
.as-tips svg { width: 14px; height: 14px; color: #c2410c; flex-shrink: 0; margin-top: 2px; }
.as-tips b { color: #d32f2f; font-weight: 600; }

.as-cancel {
  margin-top: 12px; text-align: center;
  color: #64748b; padding: 12px 0; font-size: 14px;
  border-top: 1px solid #f1f5f9; cursor: pointer;
}

/* 上传中 */
.as-uploading { padding: 36px 20px 20px; text-align: center; }
.as-progress-ring { width: 92px; height: 92px; margin: 0 auto 18px; position: relative; }
.as-progress-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.as-progress-ring .track { fill: none; stroke: #eef0f3; stroke-width: 6; }
.as-progress-ring .bar {
  fill: none; stroke: url(#asGrad); stroke-width: 6;
  stroke-linecap: round; transition: stroke-dasharray .25s ease;
}
.as-progress-ring .val {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700; color: #d32f2f;
  font-family: Inter, sans-serif;
}
.as-uploading-title { font-size: 16px; font-weight: 600; color: #1f2937; margin-bottom: 6px; }
.as-uploading-sub {
  font-size: 12px; color: #94a3b8;
  display: inline-flex; align-items: center; gap: 6px;
}
.as-uploading-sub .dot-anim { display: inline-block; min-width: 16px; text-align: left; }
.as-uploading-warn {
  margin-top: 14px; padding: 8px 14px;
  background: #fff7ed; border-radius: 8px;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: #9a3412;
}
.as-uploading-warn svg { width: 14px; height: 14px; }

/* =========================================================
   邀请码弹窗
   ========================================================= */
.invite-mask {
  position: fixed; inset: 0;
  background: rgba(10, 10, 10, .55);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000;
  animation: fade-in .2s;
  padding: max(20px, var(--safe-top)) 16px max(20px, var(--safe-bottom));
  overflow-y: auto;
}
.invite-card {
  position: relative;
  width: 100%; max-width: 360px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
  overflow: hidden;
  animation: pop-in .25s cubic-bezier(.17,.67,.3,1.3);
}
@keyframes pop-in {
  from { transform: scale(.9); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.iv-close {
  position: absolute; top: 10px; right: 12px;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-size: 22px; line-height: 1;
  color: rgba(255,255,255,.9);
  background: rgba(0,0,0,.15);
  cursor: pointer; z-index: 2;
  transition: background .15s;
}
.iv-close:hover { background: rgba(0,0,0,.3); }

.iv-hero {
  padding: 22px 22px 18px;
  background: linear-gradient(135deg, #e53935 0%, #c42a27 60%, #8f1f1e 100%);
  color: #fff;
  display: flex; align-items: center; gap: 14px;
  position: relative;
}
.iv-hero::after {
  content: ''; position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,.15), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(255,255,255,.08), transparent 50%);
  pointer-events: none;
}
.iv-seal {
  width: 46px; height: 46px;
  border-radius: 10px;
  background: rgba(255,255,255,.15);
  border: 1.5px solid #f5d27a;
  color: #f5d27a;
  font-family: "STKaiti","楷体", "KaiTi", serif;
  font-weight: 700;
  font-size: 24px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.1);
}
.iv-hero-title { font-size: 16px; font-weight: 700; letter-spacing: 2px; }
.iv-hero-sub { margin-top: 4px; font-size: 11px; opacity: .85; letter-spacing: 3px; }

.iv-user {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px dashed #e5e7eb;
}
.iv-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2px solid #f5d27a;
  overflow: hidden;
  flex-shrink: 0;
  background: #f3f4f6;
}
.iv-avatar img { width: 100%; height: 100%; object-fit: cover; }
.iv-user-meta { flex: 1; min-width: 0; }
.iv-user-name {
  font-size: 14px; font-weight: 600; color: #1f2937;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.iv-user-sub { font-size: 11px; color: #94a3b8; margin-top: 2px; }
.iv-code {
  font-family: "Courier New", "DejaVu Sans Mono", monospace;
  font-size: 22px;
  font-weight: 700;
  color: #d32f2f;
  letter-spacing: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  background: #fff7ed;
  cursor: pointer;
  transition: background .15s;
}
.iv-code:active { background: #fed7aa; }

.iv-qr-wrap {
  padding: 16px;
  background: linear-gradient(180deg, #fafafb 0%, #f3f4f6 100%);
  text-align: center;
  border-bottom: 1px dashed #e5e7eb;
}
.iv-qr-wrap canvas {
  width: 180px; height: 180px;
  padding: 8px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,.06);
  display: inline-block;
}
.iv-qr-hint {
  margin-top: 8px;
  font-size: 12px;
  color: #64748b;
  letter-spacing: .5px;
}

.iv-link {
  display: flex; align-items: center; gap: 8px;
  margin: 14px 18px 0;
  padding: 10px 12px;
  background: #f6f7f9;
  border-radius: 10px;
  font-size: 12px;
  color: #475569;
  cursor: pointer;
  transition: background .15s;
}
.iv-link:hover { background: #eef0f3; }
.iv-link svg { width: 14px; height: 14px; color: #d32f2f; flex-shrink: 0; }
.iv-link-text {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.iv-actions {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 8px;
  padding: 14px 18px 0;
}
.iv-btn {
  height: 40px;
  border-radius: 10px;
  background: #f6f7f9;
  color: #1f2937;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, transform .12s;
}
.iv-btn:active { transform: scale(.98); }
.iv-btn:hover { background: #eef0f3; }
.iv-btn.primary {
  background: linear-gradient(90deg, #e53935, #c42a27);
  color: #fff;
  box-shadow: 0 6px 14px rgba(196,42,39,.3);
}
.iv-btn.primary:hover { filter: brightness(1.05); }

.iv-tip {
  margin: 14px 18px 18px;
  padding: 8px 10px;
  background: #fff8ec;
  border-radius: 8px;
  font-size: 11px;
  color: #92400e;
  text-align: center;
  line-height: 1.5;
}

@media (max-width: 360px) {
  .invite-card { max-width: 100%; }
  .iv-hero { padding: 18px 16px 14px; }
  .iv-hero-title { font-size: 15px; }
  .iv-user { padding: 12px 14px; }
  .iv-code { font-size: 20px; letter-spacing: 3px; }
  .iv-qr-wrap canvas { width: 160px; height: 160px; }
  .iv-link, .iv-tip { margin-left: 14px; margin-right: 14px; }
  .iv-actions { padding: 12px 14px 0; }
  .iv-btn { font-size: 12px; height: 36px; }
}
