* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #ededed;
  color: #191919;
}
.hidden { display: none !important; }
img { object-fit: cover; }

.phone {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100vh;
  background: #fff;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ---------- 登录/注册 ---------- */
#auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #07c160 0%, #05a350 100%);
}
.auth-box {
  width: 84%;
  background: #fff;
  border-radius: 16px;
  padding: 32px 24px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}
.auth-title {
  text-align: center;
  font-size: 26px;
  margin-bottom: 20px;
  color: #07c160;
  font-weight: 700;
}
.auth-tabs { display: flex; margin-bottom: 20px; border-bottom: 1px solid #eee; }
.auth-tab {
  flex: 1; padding: 10px 0; background: none; border: none; font-size: 15px;
  color: #999; cursor: pointer; border-bottom: 2px solid transparent;
}
.auth-tab.active { color: #07c160; border-bottom-color: #07c160; font-weight: 600; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form input {
  padding: 12px 14px; border: 1px solid #ddd; border-radius: 8px; font-size: 15px; outline: none;
}
.auth-form input:focus { border-color: #07c160; }
.auth-error { color: #fa5151; font-size: 13px; min-height: 16px; }
.btn-primary {
  background: #07c160; color: #fff; border: none; padding: 12px; border-radius: 8px;
  font-size: 16px; cursor: pointer; font-weight: 600;
}
.btn-primary.small { padding: 8px 14px; font-size: 14px; }
.btn-primary:active { opacity: 0.85; }
.btn-secondary {
  background: #f5f5f5; color: #333; border: 1px solid #ddd; padding: 10px 16px;
  border-radius: 8px; font-size: 14px; cursor: pointer;
}
.btn-secondary.small { padding: 6px 12px; font-size: 13px; }

/* ---------- 主界面 ---------- */
.screen { flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.tab-page { flex: 1; display: flex; flex-direction: column; padding-bottom: 56px; }
.tab-page.hidden { display: none; }

.topbar {
  height: 46px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px; background: #fff; border-bottom: 1px solid #eee; position: sticky; top: 0; z-index: 5;
}
.topbar-title { font-size: 17px; font-weight: 600; margin: 0 auto; }
.icon-btn { background: none; border: none; font-size: 20px; cursor: pointer; }

.feed-scroll { flex: 1; overflow-y: auto; background: #ededed; }

.cover-header { position: relative; height: 220px; background: #666; margin-bottom: 46px; }
.cover-photo {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, #4b6cb7 0%, #182848 100%);
  background-size: cover; background-position: center;
}
.cover-user {
  position: absolute; right: 14px; bottom: -38px; display: flex; align-items: flex-end; gap: 10px;
}
.profile-cover-user { right: 14px; }
.cover-nickname { color: #fff; font-size: 16px; font-weight: 600; text-shadow: 0 1px 3px rgba(0,0,0,0.5); }
.profile-name-bio { display: flex; flex-direction: column; align-items: flex-end; margin-bottom: 6px; }
.profile-bio { color: rgba(255,255,255,0.85); font-size: 12px; margin-top: 4px; text-shadow: 0 1px 3px rgba(0,0,0,0.5); }
.cover-avatar {
  width: 68px; height: 68px; border-radius: 10px; border: 2px solid #fff; background: #ccc;
}

.profile-actions { display: flex; gap: 10px; justify-content: center; padding: 10px 14px 16px; background: #ededed; }

/* ---------- 动态列表 ---------- */
.moments-list { background: #fff; }
.moment-card { padding: 14px; border-bottom: 8px solid #ededed; }
.moment-head { display: flex; gap: 10px; }
.moment-avatar { width: 42px; height: 42px; border-radius: 6px; background: #ccc; flex-shrink: 0; }
.moment-body { flex: 1; min-width: 0; }
.moment-nickname { color: #576b95; font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.moment-content { font-size: 15px; line-height: 1.5; word-break: break-word; margin-bottom: 8px; white-space: pre-wrap; }

.moment-images { display: grid; gap: 4px; margin-bottom: 8px; max-width: 260px; }
.moment-images.n1 { grid-template-columns: 1fr; max-width: 180px; }
.moment-images.n1 img { max-height: 220px; width: auto; border-radius: 4px; }
.moment-images.n2, .moment-images.n4 { grid-template-columns: repeat(2, 1fr); }
.moment-images.n3, .moment-images.n5, .moment-images.n6, .moment-images.n7, .moment-images.n8, .moment-images.n9 { grid-template-columns: repeat(3, 1fr); }
.moment-images img { width: 100%; aspect-ratio: 1/1; border-radius: 4px; background: #eee; cursor: pointer; }

.moment-footer-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.moment-time { color: #b2b2b2; font-size: 12px; }
.moment-actions { position: relative; }
.moment-actions-btn {
  background: #f7f7f7; border: none; border-radius: 4px; padding: 3px 10px; cursor: pointer; font-size: 16px; color: #576b95;
}
.moment-actions-menu {
  position: absolute; right: 0; top: 26px; background: #4c4c4c; border-radius: 6px; display: flex; z-index: 10; overflow: hidden;
}
.moment-actions-menu button {
  background: none; border: none; color: #fff; padding: 8px 14px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.moment-actions-menu button.liked { color: #ffd25a; }
.moment-actions-menu.hidden { display: none; }

.moment-likes-comments { background: #f7f7f7; border-radius: 6px; padding: 6px 10px; font-size: 13.5px; }
.moment-likes-row { display: flex; align-items: flex-start; gap: 6px; color: #576b95; padding: 3px 0; border-bottom: 1px solid #e5e5e5; }
.moment-likes-row:last-child { border-bottom: none; }
.moment-comment-line { padding: 3px 0; line-height: 1.5; }
.moment-comment-line b { color: #576b95; font-weight: 600; }
.moment-comment-line .reply-arrow { color: #999; margin: 0 2px; }

.comment-input-row { display: flex; gap: 6px; margin-top: 6px; }
.comment-input-row input {
  flex: 1; border: 1px solid #ddd; border-radius: 6px; padding: 6px 10px; font-size: 13.5px; outline: none;
}
.comment-input-row button {
  background: #07c160; color: #fff; border: none; border-radius: 6px; padding: 6px 12px; font-size: 13px; cursor: pointer;
}

.delete-btn { color: #fa5151; }

/* ---------- 好友 ---------- */
.friends-scroll { background: #fff; padding-bottom: 14px; }
.add-friend-box { display: flex; gap: 8px; padding: 14px; border-bottom: 1px solid #eee; }
.add-friend-box input {
  flex: 1; border: 1px solid #ddd; border-radius: 6px; padding: 8px 10px; font-size: 14px; outline: none;
}
.section-title { padding: 10px 14px 4px; color: #999; font-size: 13px; }
.friend-list { display: flex; flex-direction: column; }
.friend-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid #f3f3f3; }
.friend-avatar { width: 42px; height: 42px; border-radius: 6px; background: #ccc; flex-shrink: 0; }
.friend-name { flex: 1; font-size: 15px; }
.friend-row-actions { display: flex; gap: 6px; }
.friend-row-actions button { border: none; border-radius: 6px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.btn-accept { background: #07c160; color: #fff; }
.btn-reject { background: #f5f5f5; color: #666; }
.empty-hint { padding: 14px; color: #bbb; font-size: 13px; text-align: center; }

/* ---------- 底部 Tab Bar ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 460px; display: flex; background: #f7f7f7; border-top: 1px solid #e2e2e2; z-index: 20;
}
.tabbar-btn {
  flex: 1; background: none; border: none; padding: 6px 0 8px; display: flex; flex-direction: column;
  align-items: center; gap: 2px; font-size: 11px; color: #999; cursor: pointer;
}
.tabbar-btn.active { color: #07c160; }
.tabbar-icon { font-size: 20px; }

/* ---------- 弹层 (发布/编辑资料) ---------- */
.modal {
  position: fixed; inset: 0; background: #fff; z-index: 50; display: flex; flex-direction: column;
  max-width: 460px; margin: 0 auto;
}
.modal-header {
  height: 46px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px; border-bottom: 1px solid #eee; font-size: 16px; font-weight: 600;
}
.modal-cancel, .modal-publish { background: none; border: none; font-size: 15px; cursor: pointer; }
.modal-cancel { color: #333; }
.modal-publish { color: #07c160; font-weight: 600; }
.modal-body { padding: 16px; overflow-y: auto; flex: 1; }
.modal-body textarea {
  width: 100%; min-height: 110px; border: none; outline: none; font-size: 16px; resize: none; font-family: inherit;
}
.compose-images { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.compose-images .thumb { position: relative; width: 76px; height: 76px; }
.compose-images .thumb img { width: 100%; height: 100%; border-radius: 6px; }
.compose-images .thumb .remove {
  position: absolute; top: -6px; right: -6px; background: #666; color: #fff; border-radius: 50%;
  width: 18px; height: 18px; font-size: 12px; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.add-image-btn {
  border: 1px dashed #ccc; background: #fafafa; padding: 10px; width: 76px; height: 76px; border-radius: 6px;
  cursor: pointer; color: #999; font-size: 12px;
}

.field-label { display: block; margin: 14px 0 6px; font-size: 13px; color: #999; }
.modal-body input[type=text] {
  width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 8px; font-size: 15px; outline: none;
}
.avatar-picker, .cover-picker { display: flex; align-items: center; gap: 12px; }
.avatar-picker img { width: 56px; height: 56px; border-radius: 8px; background: #ccc; }
.cover-preview { width: 100px; height: 56px; border-radius: 8px; background: linear-gradient(135deg,#4b6cb7,#182848); background-size: cover; background-position: center; }

.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.75);
  color: #fff; padding: 8px 18px; border-radius: 8px; font-size: 13.5px; z-index: 100;
}
