:root {
  --primary: #5b7cfa;
  --primary-deep: #4a5fe8;
  --primary-soft: #eef2ff;
  --grad: linear-gradient(135deg, #3d8bff 0%, #5b6cf0 55%, #7a5cf0 100%);
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #20263a;
  --muted: #8a93a6;
  --line: #e7ebf3;
  --danger: #ef4444;
  --ok: #10b981;
  --warn: #f59e0b;
  --shadow: 0 4px 16px rgba(91, 108, 240, .10);
  --shadow-lg: 0 10px 32px rgba(32, 40, 70, .14);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, #eaf0fb, #f5f7fb);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* 居中容器：手机全宽，桌面限宽 */
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; background: var(--bg); }

a { color: var(--primary); text-decoration: none; }
img { display: block; }

/* ===== 顶部栏 ===== */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; height: 50px;
  background: var(--grad); color: #fff; padding: 0 6px;
  box-shadow: 0 2px 14px rgba(91, 108, 240, .35);
}
.topbar-brand { display: flex; align-items: center; gap: 6px; color: #fff; font-weight: 800; font-size: 17px; padding: 0 10px; flex: none; }
.topbar-back { width: 40px; font-size: 30px; line-height: 1; text-align: center; color: #fff; cursor: pointer; flex: none; }
.topbar-title { flex: 1; text-align: center; font-size: 17px; font-weight: 700; letter-spacing: .5px; }

/* 桌面导航 */
.topnav { flex: 1; display: none; align-items: center; justify-content: center; gap: 4px; }
.nav-link { color: rgba(255, 255, 255, .85); padding: 7px 15px; border-radius: 10px; font-weight: 600; font-size: 14px; transition: background .15s, color .15s; }
.nav-link:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.nav-link.active { background: rgba(255, 255, 255, .26); color: #fff; }

/* 桌面用户区 */
.topbar-user { display: none; align-items: center; gap: 10px; flex: none; }
.user-chip { display: flex; align-items: center; gap: 9px; }
.user-chip img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.uc-av { width: 30px; height: 30px; border-radius: 50%; background: rgba(255, 255, 255, .22); display: flex; align-items: center; justify-content: center; font-size: 16px; }
.uc-name { font-size: 13px; font-weight: 600; }
.uc-out { color: rgba(255, 255, 255, .85); font-size: 12px; padding: 3px 11px; border: 1px solid rgba(255, 255, 255, .45); border-radius: 999px; transition: background .15s; }
.uc-out:hover { background: rgba(255, 255, 255, .16); color: #fff; }

.page-body { padding: 14px; padding-bottom: 88px; }

/* 窄内容列（详情/表单页居中） */
.col { max-width: 720px; margin: 0 auto; }

/* ===== 底部 tab（手机） ===== */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  max-width: 560px; margin: 0 auto;
  display: flex; background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  height: 62px; z-index: 20; padding: 4px 0 6px;
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 11px; font-weight: 600; transition: color .18s;
}
.tab .tab-ico { font-size: 20px; line-height: 1; filter: grayscale(1); opacity: .7; transition: all .2s; }
.tab.active { color: var(--primary); }
.tab.active .tab-ico { filter: none; opacity: 1; transform: translateY(-1px) scale(1.05); }

/* ===== 卡片 ===== */
.card {
  background: var(--card); border-radius: 18px; padding: 18px;
  margin-bottom: 14px; box-shadow: var(--shadow);
}

/* ===== 表单 ===== */
.input, textarea.input, select.input {
  width: 100%; border: 1.5px solid #e0e5f0; border-radius: 12px;
  padding: 12px 14px; font-size: 15px; margin-bottom: 12px;
  background: #f8fafc; color: var(--text);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(91, 108, 240, .14); }
textarea.input { min-height: 88px; resize: vertical; line-height: 1.6; }
.form-label { display: block; font-size: 13px; color: var(--muted); margin: 6px 0 8px; font-weight: 600; }

select.input {
  appearance: none; -webkit-appearance: none; padding-right: 38px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238a93a6' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 12px;
}

/* ===== 按钮 ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 12px; padding: 12px 20px;
  font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: transform .06s, box-shadow .18s, background .18s, color .18s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--grad); color: #fff; box-shadow: 0 6px 16px rgba(91, 108, 240, .35); }
.btn.primary:active { box-shadow: 0 3px 8px rgba(91, 108, 240, .30); }
.btn.block { display: flex; width: 100%; }
.btn.ghost { background: #fff; color: var(--primary); border: 1.5px solid var(--primary); }
.btn.danger { background: #fff; color: var(--danger); border: 1.5px solid #f3c3c3; }
.btn.sm { padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: .5; }

/* ===== 分段选择 ===== */
.seg { display: flex; background: #eef1f8; border-radius: 13px; padding: 4px; margin-bottom: 14px; }
.seg-btn {
  flex: 1; border: none; background: transparent; padding: 9px; border-radius: 10px;
  color: var(--muted); cursor: pointer; font-size: 14px; font-weight: 600; transition: all .18s;
}
.seg-btn.active { background: #fff; color: var(--primary); box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }

/* ===== 认证页 ===== */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: var(--grad); position: relative; overflow: hidden;
}
.auth-wrap::before, .auth-wrap::after { content: ''; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.auth-wrap::before { width: 220px; height: 220px; top: -60px; right: -60px; }
.auth-wrap::after { width: 300px; height: 300px; bottom: -110px; left: -90px; }
.auth-card {
  position: relative; width: 100%; max-width: 400px; margin: 0 auto;
  background: #fff; border-radius: 22px; padding: 32px 24px 28px; box-shadow: var(--shadow-lg);
}
.brand-logo {
  width: 66px; height: 66px; margin: 0 auto 14px; border-radius: 20px;
  background: var(--grad); color: #fff; font-size: 30px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 22px rgba(91, 108, 240, .45);
}
.brand { text-align: center; color: var(--primary); margin: 0 0 2px; font-size: 30px; font-weight: 800; letter-spacing: 1px; }
.brand-sub { text-align: center; color: var(--muted); margin: 0 0 22px; font-size: 13px; }

/* ===== 首页 Hero ===== */
.hero {
  text-align: center; padding: 28px 16px 26px; color: #fff;
  background: var(--grad); border-radius: 20px; margin-bottom: 14px;
  box-shadow: var(--shadow-lg);
}
.hero .avatar-lg { border: 3px solid rgba(255, 255, 255, .75); box-shadow: 0 6px 18px rgba(0, 0, 0, .12); }
.hero h2 { color: #fff; }
.avatar-lg { width: 76px; height: 76px; border-radius: 50%; margin: 0 auto 12px; object-fit: cover; background: #fff; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 14px; border-radius: 999px; font-size: 12px; font-weight: 600; }

/* ===== 个人资料页 ===== */
.profile-head { text-align: center; background: var(--card); border-radius: 18px; padding: 26px 18px 20px; margin-bottom: 14px; box-shadow: var(--shadow); }
.profile-head .avatar-lg { width: 84px; height: 84px; border: 3px solid #fff; box-shadow: 0 6px 18px rgba(91, 108, 240, .30); }
.avatar-ph { background: var(--grad); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 34px; }
.ph-name { font-size: 20px; font-weight: 800; margin: 12px 0 6px; }
.ph-chips { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.chip { padding: 4px 12px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-deep); font-size: 12px; font-weight: 600; }

.section-title { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .5px; margin-bottom: 4px; }
.info-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); }
.info-row:last-child { border-bottom: none; }
.info-key { color: var(--muted); font-size: 14px; flex: none; }
.info-val { font-weight: 600; font-size: 14px; color: var(--text); text-align: right; }
.info-val.is-empty { color: #cdd2de; font-weight: 400; }
.about-text { margin: 6px 0 0; line-height: 1.75; color: #4a5166; white-space: pre-wrap; }

/* ===== 成员卡片 ===== */
.member-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.member-card {
  position: relative; border-radius: 16px; overflow: hidden;
  background: #fff; box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .2s;
}
.member-card:active { transform: scale(.98); box-shadow: 0 2px 8px rgba(91, 108, 240, .16); }
.member-card .thumb { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; background: #e3e8f4; }
.member-card .info {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 34px 12px 12px; color: #fff;
  background: linear-gradient(180deg, transparent, rgba(20, 26, 46, .84));
}
.member-card .name { font-weight: 700; font-size: 15px; }
.member-card .meta { font-size: 12px; opacity: .9; margin-top: 2px; }
.ribbon {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: rgba(255, 255, 255, .92); color: var(--primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .16);
}
.ribbon-mutual { background: var(--grad); color: #fff; }
.ribbon-received { background: #fff; color: var(--ok); }

/* ===== 详情照片 ===== */
.photo-row { display: flex; gap: 10px; overflow-x: auto; padding: 4px 0 6px; -webkit-overflow-scrolling: touch; }
.photo-row::-webkit-scrollbar { display: none; }
.photo-row img { width: 108px; height: 108px; object-fit: cover; border-radius: 12px; flex-shrink: 0; box-shadow: 0 2px 8px rgba(0, 0, 0, .1); }
.photo-thumb { position: relative; flex-shrink: 0; }
.photo-thumb img { width: 76px; height: 76px; object-fit: cover; border-radius: 12px; }
.photo-thumb .del {
  position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--danger); color: #fff; font-size: 14px; line-height: 22px; text-align: center;
  cursor: pointer; box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
}

/* ===== 列表项 ===== */
.interest-item { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.interest-item:last-child { border-bottom: none; }
.interest-item .avatar {
  width: 52px; height: 52px; border-radius: 16px; object-fit: cover;
  background: #e3e8f4; flex-shrink: 0; box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}
.interest-item .grow { flex: 1; min-width: 0; }

/* ===== 标签 ===== */
.tag { display: inline-block; padding: 3px 9px; border-radius: 6px; font-size: 12px; font-weight: 600; background: #eef1f8; color: var(--muted); margin-right: 4px; }
.tag.pink { background: var(--primary-soft); color: var(--primary); }

/* ===== 空状态 / 加载 ===== */
.empty { text-align: center; color: var(--muted); padding: 48px 16px; font-size: 14px; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); padding: 32px; }
.loading::before {
  content: ''; width: 18px; height: 18px; border: 2px solid #eef1f8;
  border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== toast ===== */
.toast {
  position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%) translateY(10px);
  background: rgba(30, 38, 60, .94); color: #fff; padding: 12px 22px; border-radius: 12px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s;
  z-index: 999; max-width: 80%; box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
}
.toast.show { opacity: 1; transform: translate(-50%, -50%) translateY(0); }
.toast.ok { background: linear-gradient(135deg, #10b981, #0ea577); }

/* ================================================================
   桌面端（≥768px）：宽屏网页布局 —— 顶部横向导航，无底部 tab
   ================================================================ */
@media (min-width: 768px) {
  #app { max-width: 1160px; box-shadow: 0 0 60px rgba(32, 40, 70, .08); }

  .topbar { height: 60px; padding: 0 20px; }
  .topbar-title, .topbar-back { display: none; }
  .topnav { display: flex; }
  .topbar-user { display: flex; }

  .page-body { padding: 28px 24px 64px; }
  .tabbar { display: none; }

  .member-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 18px; }
  form { max-width: 680px; margin: 0 auto; }

  .photo-row img { width: 132px; height: 132px; }
}
