/* ============ SGram 基础 ============ */
:root {
  --blue: #0088cc;
  --blue-dark: #006ea3;
  --blue-light: #e5f2fa;
  --bg: #f2f5f8;
  --card: #ffffff;
  --border: #e3e8ee;
  --text: #1c2733;
  --text-2: #6b7a8c;
  --text-3: #9aa8b6;
  --danger: #e53935;
  --danger-bg: #c62828;
  --ok: #43a047;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16,42,67,.08), 0 4px 16px rgba(16,42,67,.06);
  --shadow-lg: 0 8px 40px rgba(16,42,67,.16);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}

.hidden { display: none !important; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }

/* ============ 红色警告页 ============ */
.red-alert {
  position: fixed; inset: 0; z-index: 9999;
  background: #b71c1c;
  display: flex; align-items: center; justify-content: center;
  animation: redpulse 1s ease-in-out infinite alternate;
}
@keyframes redpulse { from { background:#b71c1c; } to { background:#d32f2f; } }
.red-alert-inner { text-align: center; color: #fff; padding: 24px; max-width: 520px; }
.red-alert-icon { font-size: 64px; margin-bottom: 16px; }
.red-alert h1 { font-size: 28px; margin-bottom: 12px; letter-spacing: 1px; }
.red-alert p { font-size: 16px; opacity: .95; }
.red-alert p b { font-size: 22px; }
.red-alert-bar {
  margin: 28px auto 0; width: 260px; height: 8px; border-radius: 4px;
  background: rgba(255,255,255,.25); overflow: hidden;
}
#red-bar { height: 100%; width: 0%; background: #fff; border-radius: 4px; transition: width .9s linear; }

/* ============ 导航栏 ============ */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.navbar-inner {
  max-width: 1080px; margin: 0 auto; padding: 0 16px;
  height: 56px; display: flex; align-items: center; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-logo {
  width: 32px; height: 32px; border-radius: 9px; background: var(--blue);
  color: #fff; font-weight: 800; font-size: 19px; display: flex; align-items: center; justify-content: center;
}
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: .3px; }
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-link {
  padding: 7px 14px; border-radius: 20px; color: var(--text-2); font-weight: 500; font-size: 14px;
}
.nav-link:hover { background: var(--bg); text-decoration: none; color: var(--text); }
.nav-link.active { background: var(--blue-light); color: var(--blue); font-weight: 600; }
.nav-right { display: flex; align-items: center; gap: 12px; }
.btn {
  border: none; cursor: pointer; border-radius: 10px; font-weight: 600;
  transition: transform .06s, box-shadow .15s, background .15s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-sm { padding: 7px 14px; font-size: 13.5px; border-radius: 18px; }
.btn-lg { padding: 11px 20px; font-size: 15px; border-radius: 12px; width: 100%; }
.btn-ghost { background: transparent; color: var(--blue); border: 1.5px solid var(--blue); }
.btn-ghost:hover { background: var(--blue-light); }
.btn-plain { background: var(--bg); color: var(--text-2); }
.btn-plain:hover { background: #e8edf2; color: var(--text); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* QQ 官网 favicon 图标（主站按钮/设置标签内联使用） */
.qq-badge { display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;border-radius:6px;background:linear-gradient(135deg,#12b7f5,#0077e6);color:#fff;font-weight:900;font-family:Arial,sans-serif;font-size:12px;vertical-align:-3px;margin-right:7px;flex:0 0 auto;box-shadow:0 2px 6px rgba(0,119,230,.35); }
.setting-row .qq-badge { margin-right: 7px; }

.avatar-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--border); cursor: pointer; padding: 0;
  background-size: cover; background-position: center; background-color: var(--blue-light);
}
.user-menu-wrap { position: relative; }
.user-menu {
  position: absolute; right: 0; top: 46px; width: 210px;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-lg); overflow: hidden; z-index: 200;
}
.user-menu-head { padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--bg); }
.user-menu-head .um-name { font-weight: 700; font-size: 14px; }
.user-menu-head .um-user { color: var(--text-3); font-size: 12.5px; }
.menu-item {
  display: block; padding: 11px 16px; font-size: 14px; color: var(--text);
  cursor: pointer; width: 100%; text-align: left; background: none; border: none;
}
.menu-item:hover { background: var(--bg); text-decoration: none; }
.menu-btn { color: var(--danger); }

/* ============ 视图容器 ============ */
.view { max-width: 1080px; margin: 0 auto; padding: 20px 16px 60px; }

/* ============ 卡片 ============ */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.page-title { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.page-sub { color: var(--text-2); font-size: 14px; margin-bottom: 20px; }

/* ============ 登录/注册 ============ */
.auth-wrap {
  min-height: calc(100vh - 56px);
  display: flex; align-items: center; justify-content: center;
  padding: 32px 16px;
}
.auth-card { width: 100%; max-width: 430px; }
.auth-hero { text-align: center; padding: 28px 28px 20px; }
.auth-logo {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 18px;
  background: var(--blue); color: #fff; font-size: 36px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(0,136,204,.35);
}
.auth-hero h1 { font-size: 26px; font-weight: 800; }
.auth-hero p { color: var(--text-2); font-size: 14px; margin-top: 6px; }
.auth-body { padding: 8px 30px 30px; }

/* 步骤指示器 */
.steps { display: flex; justify-content: center; gap: 8px; margin-bottom: 22px; }
.step-dot { width: 9px; height: 9px; border-radius: 50%; background: #d7dee6; transition: all .25s; }
.step-dot.done { background: var(--blue); }
.step-dot.now { background: var(--blue); transform: scale(1.45); box-shadow: 0 0 0 4px var(--blue-light); }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field label .opt { color: var(--text-3); font-weight: 400; }
.input, .textarea {
  width: 100%; border: 1.5px solid var(--border); border-radius: 10px;
  padding: 10px 13px; font-size: 15px; background: #fbfcfe; color: var(--text);
  outline: none; transition: border .15s, box-shadow .15s; font-family: inherit;
}
.input:focus, .textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-light); background: #fff; }
.input.err { border-color: var(--danger); }
.textarea { resize: vertical; min-height: 92px; }
.field-hint { font-size: 12.5px; color: var(--text-3); margin-top: 5px; }
.field-msg { font-size: 12.5px; margin-top: 5px; }
.field-msg.ok { color: var(--ok); }
.field-msg.err { color: var(--danger); }
.password-row { display: flex; gap: 10px; }
.password-row .field { flex: 1; }
.pw-meter { height: 5px; border-radius: 3px; background: #e6ebf0; margin-top: 7px; overflow: hidden; }
.pw-meter i { display: block; height: 100%; width: 0; border-radius: 3px; transition: width .3s, background .3s; }

.form-actions { display: flex; gap: 10px; margin-top: 6px; }
.form-actions .btn { flex: 1; }
.auth-switch { text-align: center; margin-top: 18px; font-size: 14px; color: var(--text-2); }
.auth-switch a { font-weight: 600; cursor: pointer; }
.auth-divider { text-align: center; margin: 18px 0; position: relative; color: var(--text-3); font-size: 12px; }
.auth-divider::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--border); }
.auth-divider span { background: #fff; padding: 0 12px; position: relative; }

/* 头像上传 */
.avatar-upload { text-align: center; padding: 6px 0 12px; }
.avatar-preview {
  width: 110px; height: 110px; border-radius: 50%; margin: 0 auto 14px;
  background: var(--blue-light) center/cover no-repeat;
  border: 3px dashed var(--blue); display: flex; align-items: center; justify-content: center;
  color: var(--blue); font-size: 13px; font-weight: 600; cursor: pointer; overflow: hidden;
  transition: border-color .15s;
}
.avatar-preview.has-img { border-style: solid; border-color: var(--border); }
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-tip { font-size: 12.5px; color: var(--text-3); margin-top: 8px; }

/* ============ 时间线 ============ */
.feed-col { max-width: 680px; margin: 0 auto; }
.composer {
  padding: 16px; margin-bottom: 18px;
}
.composer-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.mini-avatar { width: 38px; height: 38px; border-radius: 50%; background-size: cover; background-position: center; background-color: var(--blue-light); flex-shrink: 0; }
.composer .composer-name { font-weight: 700; font-size: 14.5px; }
.composer .composer-user { color: var(--text-3); font-size: 12.5px; }
.composer-tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.composer-tab { padding: 5px 13px; border-radius: 16px; font-size: 13px; cursor: pointer; background: var(--bg); color: var(--text-2); border: none; }
.composer-tab.active { background: var(--blue-light); color: var(--blue); font-weight: 600; }
.composer .textarea { min-height: 120px; }
.composer-preview { border: 1.5px solid var(--border); border-radius: 10px; padding: 12px 14px; min-height: 120px; background: #fbfcfe; overflow-wrap: break-word; }
.composer-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.composer-count { font-size: 12.5px; color: var(--text-3); }

/* Markdown 一键插入工具栏 */
.md-toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.md-toolbar .mt-btn {
  padding: 5px 11px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; cursor: pointer; font-size: 13px; color: var(--text-2);
  font-weight: 600; line-height: 1.4; transition: all .12s;
}
.md-toolbar .mt-btn:hover { background: var(--blue-light); color: var(--blue); border-color: var(--blue); }
.md-toolbar .mt-btn:active { transform: scale(.95); }

.post {
  padding: 16px 18px; margin-bottom: 12px;
  display: flex; gap: 12px;
}
.post .mini-avatar { width: 44px; height: 44px; }
.post-body { flex: 1; min-width: 0; }
.post-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.post-name { font-weight: 700; font-size: 14.5px; }
.post-name a { color: var(--text); }
.post-name a:hover { text-decoration: none; color: var(--blue); }
.post-user { color: var(--text-3); font-size: 12.5px; }
.post-time { color: var(--text-3); font-size: 12.5px; margin-left: auto; }
.post-content { margin-top: 6px; overflow-wrap: break-word; position: relative; overflow: hidden; }
/* 长帖子收起：最大高度限制在 10 行 */
.post-content.collapsed { }
/* 收起时底部淡出遮罩：把最后几行溶进卡片背景，展开时淡出消失 */
.post-content::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 5.5em;
  background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, var(--card) 88%);
  opacity: 0; pointer-events: none;
  transition: opacity .4s ease;
  z-index: 2;
}
.post-content.collapsed::after { opacity: 1; }
/* 展开/收起按钮 */
.post-toggle {
  display: none;
  margin-top: 8px;
  background: none; border: none; padding: 2px 0;
  color: var(--blue); font-size: 13.5px; font-weight: 600; cursor: pointer;
  font-family: inherit;
}
.post-toggle:hover { text-decoration: underline; }
.post-toggle .chev { display: inline-block; margin-left: 5px; transition: transform .35s ease; }
.post-content.collapsed + .post-toggle .chev { transform: rotate(0deg); }
.post-content:not(.collapsed) + .post-toggle .chev { transform: rotate(180deg); }

/* 官方账号黄色 V 认证徽章 */
.verified-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: linear-gradient(135deg, #ffd95e, #ffb300);
  color: #fff; font-size: 11px; font-weight: 900; line-height: 1;
  margin-left: 5px; vertical-align: middle; flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(180,130,0,.35);
}

/* ============ Markdown 渲染 ============ */
.md { line-height: 1.7; font-size: 15px; }
.md > *:first-child { margin-top: 0; }
.md > *:last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4 { margin: 14px 0 8px; font-weight: 700; line-height: 1.35; }
.md h1 { font-size: 22px; } .md h2 { font-size: 19px; } .md h3 { font-size: 16.5px; } .md h4 { font-size: 15px; }
.md p { margin: 8px 0; }
.md ul, .md ol { margin: 8px 0; padding-left: 24px; }
.md blockquote {
  margin: 10px 0; padding: 8px 14px; border-left: 4px solid var(--blue);
  background: var(--blue-light); border-radius: 0 8px 8px 0; color: var(--text-2);
}
.md code {
  background: #eef2f6; border-radius: 5px; padding: 2px 6px;
  font-family: "SFMono-Regular", Consolas, "Courier New", monospace; font-size: 13px;
}
.md pre {
  background: #0f1b29; color: #e8eef5; border-radius: 10px; padding: 14px 16px;
  overflow-x: auto; margin: 10px 0;
}
.md pre code { background: none; padding: 0; color: inherit; font-size: 13.5px; }
.md a { color: var(--blue); word-break: break-all; }
.md img { max-width: 100%; border-radius: 8px; }
.md table { border-collapse: collapse; margin: 10px 0; max-width: 100%; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 12px; }
.md th { background: var(--bg); font-weight: 600; }
.md hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
.md del { color: var(--text-2); }

/* ============ 世界聊天 ============ */
.chat-wrap { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; height: calc(100vh - 150px); min-height: 480px; }
.chat-head { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.chat-head .chat-title { font-size: 17px; font-weight: 800; }
.chat-head .chat-desc { font-size: 12.5px; color: var(--text-3); }
.chat-online { margin-left: auto; font-size: 12.5px; color: var(--ok); background: #e8f5e9; padding: 3px 10px; border-radius: 12px; font-weight: 600; }
.chat-messages {
  flex: 1; overflow-y: auto; padding: 18px 20px;
  background: linear-gradient(180deg, #f7fafc, #f0f4f8);
  display: flex; flex-direction: column; gap: 6px;
}
.chat-msg { display: flex; gap: 10px; max-width: 86%; }
.chat-msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg .mini-avatar { width: 34px; height: 34px; }
.chat-bubble { background: #fff; border-radius: 14px 14px 14px 4px; padding: 8px 13px; box-shadow: 0 1px 2px rgba(16,42,67,.08); overflow-wrap: break-word; }
.chat-msg.mine .chat-bubble { background: #dcf3ff; border-radius: 14px 14px 4px 14px; }
.chat-msg-head { display: flex; align-items: baseline; gap: 7px; margin-bottom: 2px; }
.chat-msg-name { font-weight: 700; font-size: 12.5px; }
.chat-msg.mine .chat-msg-name { color: var(--blue); }
.chat-msg-user { color: var(--text-3); font-size: 11px; }
.chat-msg-time { color: var(--text-3); font-size: 11px; }
.chat-bubble .md { font-size: 14.5px; }
.chat-bubble .md p { margin: 2px 0; }
.chat-bubble .md pre { padding: 8px 10px; margin: 4px 0; font-size: 12.5px; }
.chat-bubble .md img { max-height: 220px; }
.chat-input { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 10px; align-items: flex-end; }
.chat-input .textarea { min-height: 42px; max-height: 140px; resize: none; flex: 1; }
.chat-send { padding: 10px 18px; border-radius: 12px; height: 44px; }
.chat-empty { text-align: center; color: var(--text-3); padding: 40px 0; font-size: 14px; }

/* ============ 个人主页 ============ */
.profile-wrap { max-width: 680px; margin: 0 auto; }
.profile-banner { height: 150px; border-radius: var(--radius) var(--radius) 0 0; background: linear-gradient(120deg, #0088cc, #38b6ff, #7fd0ff); position: relative; }
.profile-card { padding: 0 24px 20px; margin-bottom: 18px; }
.profile-head { display: flex; align-items: flex-end; gap: 16px; margin-top: -44px; }
.profile-avatar {
  width: 96px; height: 96px; border-radius: 50%; background-size: cover; background-position: center;
  border: 4px solid #fff; box-shadow: var(--shadow); background-color: var(--blue-light);
}
.profile-info { flex: 1; padding-top: 14px; }
.profile-name { font-size: 22px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.profile-user { color: var(--text-3); font-size: 13.5px; margin-top: 1px; }
.profile-actions { padding-top: 10px; }
.profile-bio { margin-top: 14px; font-size: 15px; white-space: pre-wrap; overflow-wrap: break-word; }
.profile-meta { margin-top: 12px; color: var(--text-3); font-size: 12.5px; display: flex; gap: 16px; flex-wrap: wrap; }
.profile-meta b { color: var(--text-2); }
.profile-empty { text-align: center; color: var(--text-3); padding: 40px 0; }

/* ============ 个人主页 v2 ============ */
.profile-card2 { overflow: hidden; margin-bottom: 18px; }
.p-banner { height: 175px; background: linear-gradient(125deg, #006ea3 0%, #0088cc 40%, #38b6ff 78%, #8fd4ff 100%); position: relative; }
.p-banner::before { content: ""; position: absolute; left: 8%; bottom: -70px; width: 190px; height: 190px; border-radius: 50%; background: rgba(255,255,255,.10); }
.p-banner::after { content: ""; position: absolute; right: -50px; top: -60px; width: 210px; height: 210px; border-radius: 50%; background: rgba(255,255,255,.14); }
.p-body { padding: 0 26px 22px; }
.p-head { display: flex; align-items: flex-end; gap: 18px; margin-top: -54px; position: relative; }
.p-avatar {
  width: 108px; height: 108px; border-radius: 50%; flex-shrink: 0;
  border: 5px solid #fff; box-shadow: 0 6px 20px rgba(16,42,67,.18);
  background-size: cover; background-position: center; background-color: var(--blue-light);
}
.p-meta { flex: 1; min-width: 0; padding: 0 0 4px; }
.p-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.p-name { font-size: 25px; font-weight: 800; letter-spacing: .2px; line-height: 1.3; }
.p-url-row { display: flex; align-items: center; gap: 8px; margin-top: 5px; flex-wrap: wrap; }
.p-url {
  font-size: 13px; color: var(--text-3); background: var(--bg);
  padding: 4px 12px; border-radius: 14px; font-family: "SFMono-Regular", Consolas, monospace;
}
.p-url b { color: var(--blue); font-weight: 600; }
.p-copy {
  border: none; background: var(--blue-light); color: var(--blue);
  font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 12px; cursor: pointer;
  transition: background .15s;
}
.p-copy:hover { background: #cfe7f6; }
.p-actions { padding-bottom: 4px; }
.p-bio {
  margin-top: 14px; font-size: 14.5px; white-space: pre-wrap; overflow-wrap: break-word;
  background: var(--bg); border-radius: 12px; padding: 13px 16px; color: var(--text);
}
.p-bio:empty { display: none; }
.p-stats { display: flex; gap: 34px; margin-top: 16px; border-top: 1px solid var(--border); padding-top: 15px; }
.p-stat { display: flex; flex-direction: column; }
.p-stat b { font-size: 20px; font-weight: 800; color: var(--text); }
.p-stat span { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.p-posts-head { font-size: 17px; font-weight: 800; margin: 4px 4px 12px; }

/* ============ 设置 ============ */
.settings-wrap { max-width: 560px; margin: 0 auto; }
.settings-card { padding: 20px 24px; margin-bottom: 16px; }
.settings-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
.setting-row:last-child { border-bottom: none; }
.setting-row .st-label { font-size: 14.5px; font-weight: 500; }
.setting-row .st-desc { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.badge { font-size: 11.5px; padding: 2px 9px; border-radius: 10px; font-weight: 600; }
.badge.ok { background: #e8f5e9; color: var(--ok); }
.badge.warn { background: #fff3e0; color: #e65100; }
.badge.muted { background: var(--bg); color: var(--text-3); }

/* ============ 弹窗 ============ */
.modal-mask {
  position: fixed; inset: 0; z-index: 500; background: rgba(15,26,38,.45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadein .18s;
}
.modal {
  background: #fff; border-radius: 16px; max-width: 420px; width: 100%;
  padding: 26px 26px 22px; box-shadow: var(--shadow-lg); animation: popin .2s;
}
.modal h3 { font-size: 18px; font-weight: 800; margin-bottom: 8px; }
.modal p { color: var(--text-2); font-size: 14px; margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes popin { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ============ Toast ============ */
.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%);
  background: #1c2733; color: #fff; padding: 10px 22px; border-radius: 22px;
  font-size: 14px; z-index: 800; box-shadow: var(--shadow-lg); max-width: 80vw;
}
.toast.err { background: var(--danger-bg); }

/* ============ 空状态 / 加载 ============ */
.empty { text-align: center; padding: 60px 20px; color: var(--text-3); }
.empty .empty-icon { font-size: 44px; margin-bottom: 10px; }
.loading { text-align: center; color: var(--text-3); padding: 40px; }
.spinner {
  width: 26px; height: 26px; border: 3px solid var(--border); border-top-color: var(--blue);
  border-radius: 50%; margin: 0 auto 12px; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ 响应式 ============ */
@media (max-width: 720px) {
  .navbar-inner { gap: 10px; padding: 0 12px; }
  .brand-name { display: none; }
  .nav-link { padding: 6px 10px; font-size: 13px; }
  .chat-wrap { height: calc(100vh - 130px); }
  .chat-msg { max-width: 94%; }
  .view { padding: 14px 10px 50px; }
  .profile-banner { height: 110px; }
  .profile-avatar { width: 78px; height: 78px; }
  .profile-name { font-size: 18px; }
  .p-banner { height: 120px; }
  .p-head { margin-top: -44px; gap: 12px; }
  .p-avatar { width: 82px; height: 82px; border-width: 4px; }
  .p-name { font-size: 20px; }
  .p-body { padding: 0 16px 16px; }
  .p-stats { gap: 24px; }
}

/* ============ 更多 / 社区共建 ============ */
.more-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.more-card { padding: 18px; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.more-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.more-ic { font-size: 34px; }
.more-t { font-weight: 700; font-size: 16px; margin-top: 8px; }
.more-d { color: var(--text-2); font-size: 13px; margin-top: 4px; }
.more-go { color: var(--blue); font-size: 13px; margin-top: 10px; font-weight: 600; }
.community-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.game-card { cursor: pointer; }
.game-modal { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.6); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; padding: 16px; }
.game-modal-box { width: 100%; max-width: 720px; background: var(--bg); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.game-modal-top { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.game-modal-title { font-weight: 700; font-size: 14px; color: var(--text); }
.game-modal-close { background: none; border: 1px solid var(--border); color: var(--text-2); width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 14px; }
.game-modal-close:hover { color: var(--text); border-color: var(--text-2); }
.game-modal-body { background: #0a0c12; }
.game-modal-frame { width: 100%; height: 78vh; max-height: 620px; border: 0; display: block; }
.community-card { padding: 16px; }
.community-name { font-weight: 700; font-size: 15px; }
.community-intro { color: var(--text-2); font-size: 13px; margin: 6px 0 12px; }

/* ============ Bot 广场 / 我的机器人 ============ */
.bot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.bot-card { padding: 16px; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.bot-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.bot-card-name { font-weight: 700; font-size: 15px; margin-top: 6px; }
.bot-card-un { color: var(--text-2); font-size: 13px; }
.bot-card-desc { color: var(--text-2); font-size: 13px; margin-top: 8px; min-height: 34px; }
.bot-card-foot { color: var(--text-3); font-size: 12px; margin-top: 10px; border-top: 1px solid var(--border); padding-top: 8px; }
.bot-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 12px; }
.bot-row-main { flex: 1; min-width: 0; }
.bot-row-name { font-weight: 700; }
.bot-row-un { color: var(--text-2); font-size: 13px; font-weight: 400; }
.bot-row-desc { color: var(--text-2); font-size: 13px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bot-row-meta { color: var(--text-3); font-size: 12px; margin-top: 4px; }
.bot-row-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ============ Bot 对话 ============ */
.bot-chat-wrap { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; height: calc(100vh - 130px); }
.bot-chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 6px; border-bottom: 1px solid var(--border); }
.bot-chat-meta { flex: 1; min-width: 0; }
.bot-chat-name { font-weight: 700; font-size: 16px; }
.bot-chat-un { color: var(--text-2); font-size: 13px; }
.bot-msgs { flex: 1; overflow-y: auto; padding: 16px 6px; display: flex; flex-direction: column; gap: 10px; }
.bot-msg { display: flex; }
.bot-msg.mine { justify-content: flex-end; }
.bot-bubble { max-width: 78%; padding: 9px 13px; border-radius: 14px; background: var(--card); border: 1px solid var(--border); font-size: 14px; line-height: 1.55; word-break: break-word; }
.bot-msg.mine .bot-bubble { background: var(--blue); color: #fff; border-color: var(--blue); }
.bot-msg.mine .bot-bubble a { color: #fff; }
.bot-input { display: flex; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.bot-err-fix { padding: 4px 6px 8px; }

/* ============ Bot 编辑器 ============ */
.bot-editor { max-width: 1100px; margin: 0 auto; }
.bot-editor-top { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.link-back { color: var(--blue); font-size: 14px; text-decoration: none; }
.bot-editor-grid { display: grid; grid-template-columns: 1fr 360px; gap: 16px; align-items: start; }
.bot-editor-main { display: flex; flex-direction: column; gap: 14px; }
.editor-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-weight: 600; }
.code-editor { width: 100%; min-height: 320px; font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; font-size: 13px; line-height: 1.5; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: #0f1419; color: #e6edf3; resize: vertical; }
.editor-hint { color: var(--text-3); font-size: 12px; margin-top: 8px; }
.editor-hint code { background: var(--bg-2); padding: 1px 5px; border-radius: 4px; font-size: 11px; }
.ai-config { border-top: 1px dashed var(--border); margin-top: 12px; padding-top: 12px; }

.bot-ai-panel { padding: 16px; position: sticky; top: 76px; }
.bot-ai-panel h3 { margin-bottom: 6px; }
.ai-tip { color: var(--text-3); font-size: 12.5px; margin-bottom: 12px; line-height: 1.5; }
.ai-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.ai-out { background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow: auto; color: var(--text); margin: 0; }

@media (max-width: 900px) {
  .bot-editor-grid { grid-template-columns: 1fr; }
  .bot-ai-panel { position: static; }
  .more-cards { grid-template-columns: 1fr; }
}

