:root {
  --color-bg: #f0f9ff;
  --color-surface: #ffffff;
  --color-border: #e0f2fe;
  --color-primary: #0284c7;
  --color-primary-h: #0369a1;
  --color-accent: #0ea5e9;
  --color-success: #22c55e;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --color-text: #0c4a6e;
  --color-muted: #64748b;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --transition: 0.2s ease;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; min-height: 100vh; }
body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.fa { font-family: "Font Awesome 6 Free" !important; font-weight: 900; }
a { color: var(--color-primary); text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; border: 0; background: none; }

.app-shell { width: 100%; max-width: 430px; margin: 0 auto; min-height: 100vh; background: var(--color-bg); padding-bottom: 24px; }

/* 顶栏 */
.topbar {
  height: 56px; padding: 0 16px;
  background: var(--color-primary); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
}
.topbar-title { font-size: 20px; font-weight: 700; letter-spacing: 2px; }
.topbar-avatar img { width: 36px; height: 36px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.7); }
.topbar-back { color: #fff; font-size: 18px; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: background var(--transition); }
.topbar-back:active { background: rgba(255,255,255,0.15); }
.topbar-space { width: 36px; }

/* 发布区 */
.composer {
  margin: 16px; padding: 16px;
  background: var(--color-surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.composer-row { display: flex; gap: 12px; }
.composer-avatar { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }
.composer-input {
  flex: 1; border: 1px solid var(--color-border); border-radius: var(--radius);
  padding: 10px 14px; font-size: 15px; font-family: inherit; resize: none;
  color: var(--color-text); background: #f8fdff;
}
.composer-input:focus { outline: none; border-color: var(--color-primary); background: #fff; }
.composer-input::placeholder { color: #94a3b8; }
.composer-toolbar { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.composer-pic-btn {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--color-primary); font-size: 14px; font-weight: 600;
  padding: 8px 12px; border-radius: var(--radius-sm); background: #e0f2fe;
  cursor: pointer; transition: background var(--transition);
}
.composer-pic-btn:active { background: #bae6fd; }
.btn-send {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--color-primary); color: #fff;
  padding: 9px 22px; border-radius: 20px; font-size: 15px; font-weight: 600;
  transition: background var(--transition), transform var(--transition);
}
.btn-send:hover { background: var(--color-primary-h); transform: translateY(-1px); }
.composer-preview { position: relative; margin-top: 12px; }
.composer-preview img { border-radius: var(--radius); max-height: 180px; object-fit: cover; width: 100%; }
.composer-preview-remove {
  position: absolute; top: 8px; right: 8px;
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(0,0,0,0.55); color: #fff; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}

/* 动态流 */
.feed { display: flex; flex-direction: column; gap: 16px; padding: 0 16px; }
.post {
  display: flex; gap: 12px;
  background: var(--color-surface); border-radius: var(--radius-lg);
  padding: 16px; box-shadow: var(--shadow-sm);
}
.post-avatar { width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; }
.post-body { flex: 1; min-width: 0; }
.post-head { display: flex; align-items: center; justify-content: space-between; }
.post-name { font-weight: 700; font-size: 15px; color: #075985; }
.post-delete { color: #94a3b8; font-size: 14px; padding: 4px; transition: color var(--transition); }
.post-delete:hover { color: var(--color-danger); }
.post-text { font-size: 15px; line-height: 1.7; margin-top: 4px; color: var(--color-text); word-break: break-word; }
.post-image { border-radius: var(--radius); margin-top: 10px; }
.post-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.post-time { font-size: 13px; color: var(--color-muted); }
.post-actions { display: flex; gap: 16px; }
.post-like, .post-comment-btn {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 13px; color: var(--color-muted); padding: 4px;
  transition: color var(--transition), transform var(--transition);
}
.post-like:active, .post-comment-btn:active { transform: scale(1.1); }
.post-like.liked { color: #e11d48; }
.post-like.liked .like-count { color: #e11d48; font-weight: 600; }

/* 评论区 */
.comments {
  margin-top: 10px; padding: 10px 12px;
  background: #f0f9ff; border-radius: var(--radius);
}
.comment { font-size: 14px; line-height: 1.7; color: #334155; }
.comment + .comment { margin-top: 4px; }
.comment-name { font-weight: 600; color: #075985; }
.comment-input-row { display: flex; gap: 8px; margin-top: 8px; }
.comment-input {
  flex: 1; border: 1px solid var(--color-border); border-radius: 18px;
  padding: 7px 14px; font-size: 14px; font-family: inherit; background: #fff;
}
.comment-input:focus { outline: none; border-color: var(--color-primary); }
.comment-send { color: var(--color-primary); font-size: 14px; font-weight: 600; padding: 0 6px; }
.comment-send:hover { color: var(--color-primary-h); }

.empty-tip { text-align: center; color: var(--color-muted); padding: 48px 0; }
.empty-tip i { font-size: 36px; color: #7dd3fc; margin-bottom: 8px; }
.empty-tip p { font-size: 14px; }

/* ===== 登录 / 注册页 ===== */
.auth-shell { padding-bottom: 40px; }
.auth-hero { text-align: center; padding: 40px 16px 24px; }
.auth-logo {
  width: 72px; height: 72px; margin: 0 auto 16px;
  border-radius: 22px; background: var(--color-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; box-shadow: var(--shadow);
}
.auth-title { font-size: 24px; font-weight: 700; line-height: 1.3; }
.auth-sub { font-size: 14px; color: var(--color-muted); margin-top: 6px; }
.auth-card {
  margin: 0 16px; padding: 24px 20px;
  background: var(--color-surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.auth-form-title { font-size: 20px; font-weight: 700; margin-bottom: 16px; }
.field { margin-bottom: 14px; }
.field-label { display: block; font-size: 13px; font-weight: 600; color: #475569; margin-bottom: 6px; }
.field-input {
  width: 100%; border: 1px solid var(--color-border); border-radius: var(--radius);
  padding: 11px 14px; font-size: 15px; font-family: inherit; color: var(--color-text); background: #f8fdff;
  transition: border-color var(--transition), background var(--transition);
}
.field-input:focus { outline: none; border-color: var(--color-primary); background: #fff; }
.field-input::placeholder { color: #94a3b8; }
.btn-primary {
  width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--color-primary); color: #fff;
  padding: 12px 24px; border-radius: var(--radius); font-size: 16px; font-weight: 700;
  margin-top: 6px; transition: background var(--transition), transform var(--transition);
}
.btn-primary:hover { background: var(--color-primary-h); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-block { width: 100%; }
.auth-switch { text-align: center; font-size: 14px; color: var(--color-muted); margin-top: 16px; }
.link-btn { color: var(--color-primary); font-size: 14px; font-weight: 600; }
.link-btn:hover { color: var(--color-primary-h); }
.auth-hint {
  font-size: 13px; color: var(--color-muted); background: #f0f9ff;
  border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 14px; line-height: 1.6;
}
.auth-toast {
  margin-top: 14px; padding: 10px 14px; border-radius: var(--radius-sm);
  background: #dcfce7; color: #166534; font-size: 14px; text-align: center;
}
.auth-toast.error { background: #fee2e2; color: #991b1b; }
.auth-browse {
  display: block; text-align: center; margin-top: 24px;
  font-size: 14px; color: var(--color-muted);
}
.auth-browse i { font-size: 12px; margin-left: 2px; }

/* ===== 个人中心 ===== */
.profile-card {
  margin: 16px; padding: 28px 16px 24px;
  background: var(--color-surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); text-align: center;
}
.profile-avatar-wrap { position: relative; width: 96px; margin: 0 auto; }
.profile-avatar { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; border: 3px solid #e0f2fe; }
.profile-avatar-edit {
  position: absolute; right: 0; bottom: 2px;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--color-primary); color: #fff; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff; cursor: pointer;
  transition: background var(--transition);
}
.profile-avatar-edit:active { background: var(--color-primary-h); }
.profile-name { font-size: 20px; font-weight: 700; margin-top: 12px; }
.profile-id { font-size: 13px; color: var(--color-muted); margin-top: 2px; }

.panel {
  margin: 0 16px 16px; padding: 20px;
  background: var(--color-surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.panel-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.panel-title i { color: var(--color-primary); font-size: 15px; }

.my-post {
  padding: 12px 14px; background: #f8fdff;
  border-radius: var(--radius); border: 1px solid var(--color-border);
}
.my-post + .my-post { margin-top: 10px; }
.my-post-text { font-size: 14px; line-height: 1.7; color: #334155; }
.my-post-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 8px;
}
.my-post-stats { font-size: 13px; color: var(--color-muted); display: inline-flex; align-items: center; gap: 4px; }

.btn-logout {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px; border-radius: var(--radius);
  background: #fef2f2; color: var(--color-danger);
  font-size: 15px; font-weight: 700;
  transition: background var(--transition);
}
.btn-logout:active { background: #fee2e2; }
