/* ============================================================
   J2907 班级社区 · 设计系统（蓝色调）
   ============================================================ */
:root {
  --primary: #2f6bff;
  --primary-600: #2456e6;
  --primary-700: #1a48bd;
  --primary-soft: #e9f1ff;
  --bg: #edf2fb;
  --card: #ffffff;
  --text: #16233d;
  --muted: #7b8aa5;
  --line: #e3eaf6;
  --green: #0bbf7a;
  --green-dark: #0b7d55;
  --red: #f0483e;
  --red-dark: #c6302b;
  --amber: #b25e09;
  --navy-950: #0b1633;
  --navy-900: #10204d;
  --navy-800: #162b66;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(22, 35, 61, .05);
  --shadow: 0 2px 6px rgba(22, 35, 61, .05), 0 10px 28px rgba(37, 78, 183, .08);
  --shadow-lg: 0 18px 50px rgba(37, 78, 183, .16);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #c6d4ee; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #a9bde3; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- 布局 ---------------- */
.side {
  position: fixed; top: 0; bottom: 0; left: 0; width: 234px; z-index: 50;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--navy-900) 0%, var(--navy-950) 100%);
  color: #b9cdf2;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px; }
.brand-logo {
  width: 44px; height: 44px; border-radius: 13px; flex: none;
  background: linear-gradient(135deg, #4d8dff, #2456e6);
  display: grid; place-items: center; font-weight: 800; font-size: 21px; color: #fff;
  box-shadow: 0 8px 20px rgba(47, 107, 255, .45);
}
.brand-name { font-weight: 800; font-size: 17px; color: #fff; letter-spacing: .5px; line-height: 1.15; }
.brand-name span { display: block; font-size: 10px; font-weight: 600; color: #7f9cd9; letter-spacing: 2.2px; }
.nav { padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px;
  color: #b9cdf2; text-decoration: none; font-size: 14.5px; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(77, 141, 255, .30), rgba(77, 141, 255, .10));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(110, 160, 255, .35);
}
.nav-item .ico { font-size: 17px; width: 24px; text-align: center; }
.nav-badge {
  margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 5px;
}
.side-foot { padding: 14px; border-top: 1px solid rgba(255, 255, 255, .08); }
.user-chip { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-chip-text { min-width: 0; flex: 1; }
.user-chip-name { color: #fff; font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip-role { margin-top: 1px; }
.logout-btn {
  border: 0; background: rgba(255, 255, 255, .08); color: #aec6f2; width: 30px; height: 30px;
  border-radius: 9px; font-size: 15px; transition: .15s; flex: none;
}
.logout-btn:hover { background: rgba(240, 72, 62, .25); color: #ffb3ae; }

.main { margin-left: 234px; padding: 30px 38px 70px; min-height: 100vh; }
.wrap { max-width: 1000px; margin: 0 auto; }
.wrap-wide { max-width: 1160px; margin: 0 auto; }

.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; font-weight: 800; letter-spacing: .3px; }
.page-head .sub { color: var(--muted); font-size: 13.5px; margin-bottom: 3px; }
.page-head .spacer { flex: 1; }

/* ---------------- 卡片 / 按钮 / 表单 ---------------- */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, .8);
}
.btn {
  display: inline-flex; align-items: center; gap: 7px; border: 1.5px solid var(--line);
  background: #fff; color: var(--text); padding: 9px 18px; border-radius: 11px;
  font-size: 14px; font-weight: 600; transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: #b9cdf2; background: #f6f9ff; }
.btn-primary {
  background: linear-gradient(135deg, #3d7bff, #2456e6); border: 0; color: #fff;
  box-shadow: 0 6px 16px rgba(47, 107, 255, .35);
}
.btn-primary:hover { background: linear-gradient(135deg, #4d8dff, #2f6bff); filter: none; transform: translateY(-1px); }
.btn-danger { background: #fff; border: 1.5px solid #ffd5d2; color: var(--red); }
.btn-danger:hover { background: #fff5f4; border-color: var(--red); }
.btn-sm { padding: 6px 13px; font-size: 13px; border-radius: 9px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.icon-btn {
  border: 0; background: transparent; width: 32px; height: 32px; border-radius: 9px;
  font-size: 15px; display: inline-grid; place-items: center; transition: .15s;
}
.icon-btn:hover { background: var(--primary-soft); }
.icon-btn.danger:hover { background: #fff0ef; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent;
  color: var(--muted); font-size: 13.5px; font-weight: 600; padding: 6px 10px; border-radius: 9px; transition: .15s;
}
.chip-btn:hover { background: var(--primary-soft); color: var(--primary); }

.input {
  width: 100%; border: 1.5px solid var(--line); border-radius: 11px; padding: 10px 14px;
  font-size: 14.5px; color: var(--text); background: #fbfdff; transition: .15s;
}
.input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px rgba(47, 107, 255, .12); outline: none; }
textarea.input { resize: vertical; min-height: 96px; line-height: 1.6; }
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: #41506e; margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

/* ---------------- 徽章 / 头像 ---------------- */
.badge {
  display: inline-block; font-size: 11px; padding: 1.5px 8px; border-radius: 999px;
  font-weight: 700; vertical-align: 1px;
}
.badge.admin { background: #fff1e0; color: var(--amber); }
.badge.developer { background: linear-gradient(135deg, #eae2ff, #d7c9ff); color: #4c2fc4; }
.badge.student { background: var(--primary-soft); color: var(--primary-700); }
.pin-badge {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 1.5px 9px; border-radius: 999px;
  background: linear-gradient(135deg, #ffe9b8, #ffd98a); color: #8a5a00;
}
.avatar { border-radius: 50%; object-fit: cover; flex: none; background: #dbe7ff; }
.avatar-fallback { display: grid; place-items: center; color: #fff; font-weight: 700; user-select: none; }
.a-xl { width: 96px; height: 96px; font-size: 36px; }
.a-lg { width: 48px; height: 48px; font-size: 19px; }
.a-md { width: 38px; height: 38px; font-size: 15px; }
.a-sm { width: 30px; height: 30px; font-size: 13px; }
.a-xs { width: 23px; height: 23px; font-size: 11px; }
.avatar-link { display: inline-flex; flex: none; }

/* ---------------- 提示条 ---------------- */
#toasts { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 999;
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  background: var(--navy-900); color: #fff; padding: 10px 20px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow-lg); animation: toastIn .22s ease;
}
.toast.err { background: var(--red-dark); }
.toast.ok { background: var(--green-dark); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.toast.bye { transition: opacity .4s; opacity: 0; }

/* ---------------- Markdown 渲染 ---------------- */
.md-body { line-height: 1.8; color: #24324d; word-wrap: break-word; overflow-wrap: break-word; }
.md-body h1, .md-body h2, .md-body h3, .md-body h4 { margin: 1em 0 .45em; line-height: 1.35; }
.md-body h1 { font-size: 1.55em; padding-bottom: .3em; border-bottom: 1px solid var(--line); }
.md-body h2 { font-size: 1.3em; }
.md-body h3 { font-size: 1.12em; }
.md-body p { margin: .55em 0; }
.md-body ul, .md-body ol { margin: .5em 0; padding-left: 1.6em; }
.md-body li { margin: .2em 0; }
.md-body code {
  background: #eef3fd; color: #2456e6; padding: 2px 7px; border-radius: 6px;
  font-family: Consolas, "JetBrains Mono", monospace; font-size: .88em;
}
.md-body pre {
  background: #0f1d3d; color: #dbe7ff; padding: 14px 17px; border-radius: 12px; overflow: auto;
  margin: .7em 0; line-height: 1.55;
}
.md-body pre code { background: none; color: inherit; padding: 0; font-size: .92em; }
.md-body blockquote {
  border-left: 4px solid #7aa8ff; background: #f2f7ff; margin: .7em 0; padding: 8px 15px;
  border-radius: 0 10px 10px 0; color: #4a5b7d;
}
.md-body table { border-collapse: collapse; margin: .7em 0; max-width: 100%; }
.md-body th, .md-body td { border: 1px solid var(--line); padding: 7px 13px; text-align: left; }
.md-body th { background: #f4f8ff; font-weight: 700; }
.md-body img { max-width: 100%; border-radius: 10px; }
.md-body hr { border: 0; border-top: 1px solid var(--line); margin: 1.2em 0; }

/* ---------------- 登录 / 注册 ---------------- */
.auth-body {
  min-height: 100vh; display: grid; place-items: center; padding: 26px;
  background:
    radial-gradient(900px 560px at 12% -5%, #dce8ff 0%, rgba(220, 232, 255, 0) 58%),
    radial-gradient(800px 560px at 105% 108%, #e4efff 0%, rgba(228, 239, 255, 0) 52%),
    #f4f8ff;
}
.auth-card {
  width: min(404px, 100%); background: #fff; border-radius: 22px; padding: 40px 36px 34px;
  box-shadow: 0 34px 80px rgba(30, 64, 175, .18); animation: cardIn .35s ease;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.auth-logo {
  width: 62px; height: 62px; margin: 0 auto 14px; border-radius: 18px;
  background: linear-gradient(135deg, #4d8dff, #2456e6); display: grid; place-items: center;
  color: #fff; font-size: 27px; font-weight: 800; box-shadow: 0 14px 30px rgba(47, 107, 255, .4);
}
.auth-title { text-align: center; font-size: 22px; font-weight: 800; }
.auth-sub { text-align: center; color: var(--muted); font-size: 12.5px; margin: 4px 0 24px; letter-spacing: 1px; }
.auth-card .btn-primary { width: 100%; justify-content: center; padding: 12px; font-size: 15px; margin-top: 6px; }
.auth-switch { text-align: center; margin-top: 18px; font-size: 13.5px; color: var(--muted); }
.auth-error { color: var(--red); font-size: 13px; text-align: center; min-height: 19px; margin-top: 10px; }

/* ---------------- 社区（block） ---------------- */
.composer { padding: 20px; margin-bottom: 22px; }
.composer .input { margin-bottom: 12px; }
.composer-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 13px; }
.feed { display: flex; flex-direction: column; gap: 18px; }
.post { padding: 20px 22px; }
.post-head { display: flex; align-items: center; gap: 12px; }
.post-meta { min-width: 0; flex: 1; }
.post-author { font-weight: 700; font-size: 14.5px; }
.post-time { color: var(--muted); font-size: 12px; margin-top: 1px; }
.post-title { margin: 14px 0 6px; font-size: 17px; }
.post-content { margin: 4px 0 2px; }
.post-foot { display: flex; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.comments { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.comment { display: flex; gap: 10px; padding: 7px 0; align-items: flex-start; }
.comment-main { flex: 1; min-width: 0; }
.comment-top { display: flex; align-items: baseline; gap: 8px; }
.comment-name { font-weight: 700; font-size: 13px; }
.comment-time { color: var(--muted); font-size: 11px; }
.comment-text { font-size: 13.5px; white-space: pre-wrap; word-break: break-word; }
.comment-input { display: flex; gap: 10px; margin-top: 10px; }
.comment-input .input { padding: 8px 13px; }
.empty-tip { text-align: center; color: var(--muted); padding: 46px 0; font-size: 13.5px; }

/* ---------------- 学习（study） ---------------- */
.study-layout { display: grid; grid-template-columns: 226px 1fr; gap: 18px; align-items: start; }
.study-tree { padding: 16px 12px; position: sticky; top: 26px; }
.study-tree h2 { font-size: 15px; padding: 2px 10px 10px; }
.grade-title {
  font-size: 12px; font-weight: 800; color: var(--muted); padding: 12px 10px 4px;
  letter-spacing: 1px;
}
.grade-title .dot { color: var(--primary); }
.subj {
  display: block; padding: 8px 12px; margin: 2px 0; border-radius: 10px; color: #3b4d70;
  font-size: 14px; cursor: pointer; transition: .13s;
}
.subj:hover { background: #f2f7ff; color: var(--primary); }
.subj.active { background: var(--primary-soft); color: var(--primary-700); font-weight: 700; }
.study-page { padding: 26px 30px; min-height: 60vh; }
.study-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.study-head h1 { font-size: 24px; }
.study-meta { color: var(--muted); font-size: 12.5px; }
.study-meta .spacer { flex: 1; }
.editor-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }

/* ---------------- Markdown 编辑器 ---------------- */
.md-editor { border: 1.5px solid var(--line); border-radius: 13px; overflow: hidden; background: #fff; }
.md-editor-tabs { display: flex; align-items: center; gap: 4px; padding: 7px 9px; background: #f6f9ff; border-bottom: 1px solid var(--line); }
.md-tab {
  border: 0; background: transparent; padding: 6px 14px; border-radius: 8px; font-size: 13px;
  font-weight: 600; color: var(--muted); transition: .13s;
}
.md-tab:hover { color: var(--primary); }
.md-tab.active { background: #fff; color: var(--primary); box-shadow: var(--shadow-sm); }
.md-editor-hint { margin-left: auto; font-size: 11.5px; color: #a3b3cf; padding-right: 6px; }
.md-editor-input {
  width: 100%; min-height: 240px; border: 0; resize: vertical; padding: 15px 17px;
  font-family: Consolas, "Microsoft YaHei", monospace; font-size: 13.5px; line-height: 1.7; color: var(--text);
}
.md-editor-input:focus { outline: none; }
.md-editor-preview { padding: 16px 18px; min-height: 240px; background: #fcfdff; }

/* ---------------- 聊天 ---------------- */
.chat-layout { display: grid; grid-template-columns: 322px 1fr; gap: 18px; height: calc(100vh - 100px); min-height: 520px; }
.chat-side { display: flex; flex-direction: column; overflow: hidden; }
.chat-side-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 10px; }
.chat-side-head h1 { font-size: 18px; }
.friend-search { padding: 4px 14px 10px; }
.search-results { margin-top: 8px; max-height: 260px; overflow-y: auto; border-top: 1px solid var(--line); padding-top: 6px; }
.search-hit { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; }
.search-hit:hover { background: #f2f7ff; }
.search-hit-info { flex: 1; min-width: 0; }
.search-hit-name { font-weight: 700; font-size: 13.5px; }
.search-hit-sub { font-size: 11.5px; color: var(--muted); }
.chat-tabs { display: flex; gap: 6px; padding: 0 16px 8px; border-bottom: 1px solid var(--line); }
.chat-tab {
  border: 0; background: transparent; padding: 8px 4px; margin-right: 14px; font-size: 13.5px;
  font-weight: 700; color: var(--muted); position: relative;
}
.chat-tab.active { color: var(--primary); }
.chat-tab.active::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2.5px; background: var(--primary); border-radius: 2px; }
.count-badge { background: var(--red); color: #fff; border-radius: 9px; font-size: 11px; padding: 0 6px; margin-left: 3px; }
.chat-list { flex: 1; overflow-y: auto; padding: 8px 10px; }
.chat-item { display: flex; gap: 11px; align-items: center; padding: 10px 12px; border-radius: 12px; cursor: pointer; }
.chat-item:hover { background: #f2f7ff; }
.chat-item.active { background: var(--primary-soft); }
.chat-item-info { flex: 1; min-width: 0; }
.chat-item-top { display: flex; justify-content: space-between; align-items: baseline; }
.chat-item-name { font-weight: 700; font-size: 14px; }
.chat-item-time { font-size: 11px; color: var(--muted); }
.chat-item-bottom { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.chat-item-last { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 175px; }
.unread-dot { background: var(--red); color: #fff; font-size: 11px; font-weight: 700; min-width: 17px; height: 17px; border-radius: 9px; display: grid; place-items: center; padding: 0 5px; flex: none; }
.req-actions { display: flex; gap: 6px; }
.chat-main { display: flex; flex-direction: column; overflow: hidden; }
.chat-empty { flex: 1; display: grid; place-items: center; color: var(--muted); font-size: 15px; }
.chat-empty .big { font-size: 52px; display: block; margin-bottom: 10px; }
.chat-active { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.chat-title-name { font-weight: 800; font-size: 15.5px; }
.chat-title-sub { font-size: 12px; color: var(--muted); }
.msg-list { flex: 1; overflow-y: auto; padding: 18px 22px; background: #f6f9ff; }
.bubble-row { display: flex; margin: 10px 0; }
.bubble-row.mine { justify-content: flex-end; }
.bubble {
  max-width: 74%; padding: 9px 14px; border-radius: 15px; background: #fff; box-shadow: var(--shadow-sm);
  white-space: pre-wrap; word-break: break-word; font-size: 14.5px; line-height: 1.55;
}
.bubble-row.mine .bubble { background: linear-gradient(135deg, #4d8dff, #2f6bff); color: #fff; border-bottom-right-radius: 5px; }
.bubble-row.theirs .bubble { border-bottom-left-radius: 5px; }
.msg-time { font-size: 11px; color: var(--muted); text-align: center; margin: 12px 0 2px; }
.msg-input { display: flex; gap: 10px; padding: 13px 16px; border-top: 1px solid var(--line); align-items: flex-end; }
.msg-input textarea { flex: 1; resize: none; min-height: 42px; max-height: 130px; }
.msg-input .btn { flex: none; }

/* ---------------- 个人主页 ---------------- */
.profile-head { display: flex; gap: 26px; padding: 30px; align-items: center; flex-wrap: wrap; }
.avatar-wrap { position: relative; }
.avatar-edit { position: absolute; right: -4px; bottom: -4px; width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); color: #fff; border: 3px solid #fff; display: grid; place-items: center; font-size: 15px; cursor: pointer;
  box-shadow: var(--shadow); }
.profile-info { flex: 1; min-width: 230px; }
.profile-name { font-size: 24px; font-weight: 800; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.profile-sub { color: var(--muted); font-size: 13px; margin: 5px 0 8px; }
.profile-sig { font-size: 14.5px; color: #41506e; }
.stat-row { display: flex; gap: 26px; margin-top: 16px; }
.stat { text-align: center; }
.stat b { display: block; font-size: 19px; }
.stat span { font-size: 12px; color: var(--muted); }
.profile-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.profile-body { display: grid; grid-template-columns: 1fr 340px; gap: 18px; align-items: start; margin-top: 18px; }
@media (max-width: 980px) { .profile-body { grid-template-columns: 1fr; } }
.section-title { font-size: 15px; font-weight: 800; padding: 18px 22px 0; }

/* ---------------- 文件 ---------------- */
.drop-zone {
  border: 2px dashed #b9cdf2; border-radius: var(--radius); background: #f8fbff;
  padding: 38px; text-align: center; color: var(--muted); cursor: pointer; transition: .18s; margin-bottom: 18px;
}
.drop-zone:hover, .drop-zone.over { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.drop-zone .big { font-size: 38px; display: block; margin-bottom: 8px; }
.file-table { width: 100%; border-collapse: collapse; }
.file-table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 13px 20px;
  border-bottom: 1px solid var(--line); letter-spacing: .4px; }
.file-table td { padding: 12px 20px; border-bottom: 1px solid #eef3fb; font-size: 14px; }
.file-table tr:hover td { background: #f8fbff; }
.file-icon { width: 34px; height: 34px; border-radius: 9px; background: var(--primary-soft); display: grid; place-items: center; font-size: 16px; }

/* ---------------- 管理页 ---------------- */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card { padding: 20px 22px; }
.stat-card .num { font-size: 28px; font-weight: 800; color: var(--primary-700); }
.stat-card .lbl { color: var(--muted); font-size: 13px; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.admin-table td { padding: 11px 16px; border-bottom: 1px solid #eef3fb; font-size: 13.5px; }
.admin-table tr:hover td { background: #f8fbff; }
.row-actions { display: flex; gap: 7px; flex-wrap: wrap; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 860px) {
  .side { width: 62px; }
  .brand { padding: 18px 12px 12px; justify-content: center; }
  .brand-name, .nav-item { font-size: 0; }
  .nav-item { justify-content: center; padding: 13px 0; gap: 0; }
  .nav-item .ico { font-size: 19px; }
  .nav-badge { position: absolute; margin: -14px 0 0 16px; font-size: 10px; min-width: 15px; height: 15px; }
  .user-chip-text, .logout-btn { display: none; }
  .side-foot { padding: 10px; display: grid; place-items: center; }
  .main { margin-left: 62px; padding: 22px 18px 70px; }
  .study-layout { grid-template-columns: 1fr; }
  .study-tree { position: static; display: flex; flex-wrap: wrap; gap: 4px 8px; }
  .study-tree h2 { width: 100%; }
  .grade-title { width: 100%; padding-top: 8px; }
  .subj { display: inline-block; }
  .chat-layout { grid-template-columns: 1fr; height: auto; }
  .chat-main { height: 62vh; }
}

.page-watermark {
  margin-left: 234px; text-align: center; color: #aab7d1; font-size: 12px;
  padding: 30px 0 16px; letter-spacing: .4px; user-select: none;
}
.auth-body .page-watermark {
  position: fixed; bottom: 12px; left: 0; right: 0; margin: 0; text-align: center;
  color: #aab7d1; padding: 0;
}
.landing-body .page-watermark { margin: 0; color: #6f89bd; padding: 0 0 18px; }
@media (max-width: 860px) {
  .page-watermark { margin-left: 62px; }
}

/* ---------------- 未登录主页（landing） ---------------- */
.landing-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--text);
  background:
    radial-gradient(1000px 560px at 88% -8%, #dce8ff 0%, rgba(220, 232, 255, 0) 60%),
    radial-gradient(800px 520px at -8% 108%, #e4efff 0%, rgba(228, 239, 255, 0) 55%),
    #ffffff;
}
.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(20px, 5vw, 56px);
}
.landing-brand { display: flex; align-items: center; gap: 12px; }
.landing-brand .brand-name { color: #0f2557; }
.landing-brand .brand-name span { color: var(--muted); }
.landing-nav-right { display: flex; gap: 10px; }
.btn-ghost-light {
  background: #fff;
  border: 1.5px solid #b9cdf2;
  color: var(--primary);
}
.btn-ghost-light:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-700); }
.btn-big { padding: 12px 26px; font-size: 15px; border-radius: 13px; }
.landing-main { flex: 1; max-width: 1020px; margin: 0 auto; width: 100%; padding: 46px 24px 70px; }
.landing-hero { text-align: center; margin-bottom: 52px; }
.landing-logo {
  width: 84px; height: 84px; margin: 0 auto 22px; border-radius: 24px;
  background: linear-gradient(135deg, #4d8dff, #2456e6); display: grid; place-items: center;
  color: #fff; font-size: 38px; font-weight: 800;
  box-shadow: 0 22px 46px rgba(47, 107, 255, .35);
  animation: floatY 4s ease-in-out infinite;
}
@keyframes floatY { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
.landing-hero h1 { font-size: clamp(32px, 5vw, 48px); color: #0f2557; letter-spacing: 1px; margin-bottom: 12px; }
.landing-slogan { color: var(--muted); font-size: 16.5px; margin-bottom: 30px; }
.landing-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; }
.feature-card {
  background: #fff;
  border: 1px solid #dbe7ff;
  border-radius: 18px;
  padding: 26px 24px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: #b9cdf2; }
.feature-ico { font-size: 34px; margin-bottom: 12px; }
.feature-card h3 { color: var(--text); font-size: 16.5px; margin-bottom: 7px; }
.feature-card p { color: var(--muted); font-size: 13px; line-height: 1.7; }
.landing-foot { text-align: center; color: #a5b3cc; font-size: 12.5px; padding: 22px; }

/* ---------------- 通用细节 ---------------- */
.md-body table { display: block; max-width: 100%; overflow-x: auto; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.toast { max-width: 86vw; }

/* ---------------- 手机端（≤640px）---------------- */
.mobile-top { display: none; }

@media (max-width: 640px) {
  /* 顶部栏 */
  .mobile-top {
    display: flex; position: fixed; top: 0; left: 0; right: 0; z-index: 55; height: 52px;
    background: #fff; box-shadow: 0 1px 0 var(--line), var(--shadow-sm);
    align-items: center; padding: 0 12px; gap: 10px;
  }
  .mobile-brand { display: flex; align-items: center; gap: 8px; font-size: 15px; color: #0f2557; }
  .mobile-brand .brand-logo { width: 30px; height: 30px; border-radius: 9px; font-size: 15px; }
  .mobile-user { flex: 1; display: flex; align-items: center; gap: 8px; justify-content: flex-end; min-width: 0; }
  .mobile-user span { font-size: 13.5px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
  .mobile-top .logout-btn { background: #f2f6ff; color: #52617e; }

  /* 侧栏 → 底部导航 */
  .side {
    top: auto; bottom: 0; left: 0; right: 0; width: 100%; height: 58px;
    flex-direction: row; align-items: stretch; z-index: 60;
    background: rgba(13, 27, 61, .98);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .side .brand, .side .side-foot { display: none; }
  .nav { flex-direction: row; justify-content: space-around; padding: 2px 4px 0; gap: 0; flex: 1; overflow-x: auto; }
  .nav-item {
    flex: 1 0 44px; min-width: 44px; flex-direction: column; gap: 2px;
    padding: 6px 0 4px; font-size: 9.5px; font-weight: 600;
    border-radius: 10px; color: #a9c2ee;
  }
  .nav-item .ico { font-size: 18px; width: auto; line-height: 1; }
  .nav-item.active { background: rgba(77, 141, 255, .25); box-shadow: none; }
  .nav-badge { position: absolute; margin: -30px 0 0 14px; }

  .main { margin-left: 0; padding: 66px 12px 92px; }
  .page-watermark { margin-left: 0; padding: 24px 0 8px; }

  /* 页面头部 */
  .page-head { gap: 10px; margin-bottom: 14px; }
  .page-head h1 { font-size: 21px; }
  .page-head .sub { font-size: 12px; }
  .page-head .spacer { flex-basis: 100%; height: 0; }
  .page-head .btn { padding: 8px 13px; font-size: 13px; }

  /* 聊天 */
  .chat-layout {
    grid-template-columns: 1fr;
    height: calc(100vh - 116px);
    height: calc(100dvh - 116px);
    min-height: 420px; gap: 10px;
  }
  .chat-side { max-height: 36%; }
  .chat-main { height: auto; min-height: 0; }
  .bubble { max-width: 84%; }

  /* 个人主页 */
  .profile-head { padding: 18px 16px; gap: 14px; }
  .profile-name { font-size: 20px; }
  .stat-row { gap: 18px; }

  /* 学习 */
  .study-tree {
    flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; align-items: center;
    padding: 10px 12px; gap: 4px 8px; -webkit-overflow-scrolling: touch;
  }
  .study-tree h2 { display: none; }
  .grade-title { width: auto; padding: 0; white-space: nowrap; font-size: 11px; }
  .subj { white-space: nowrap; flex: none; padding: 6px 11px; }
  .study-page { padding: 16px 16px; }
  .study-head h1 { font-size: 20px; }

  /* 管理 / 文件表格横向滚动 */
  .admin-table, .file-table { min-width: 720px; }

  /* 提示 */
  #toasts { bottom: 78px; }
  .toast { font-size: 12.5px; padding: 9px 16px; }

  /* 帖子 */
  .post { padding: 15px 16px; }
  .post-actions { flex-wrap: wrap; gap: 2px; }
  .post-title { font-size: 15.5px; }

  /* 编辑器 */
  .md-editor-input { min-height: 180px; }
}

/* ---------------- 落地页 / 登录页手机端 ---------------- */
@media (max-width: 560px) {
  .landing-nav { padding: 12px 14px; }
  .landing-brand .brand-logo { width: 34px; height: 34px; border-radius: 10px; font-size: 16px; }
  .landing-brand .brand-name { font-size: 15px; }
  .landing-brand .brand-name span { display: none; }
  .landing-nav-right { gap: 8px; }
  .landing-nav-right .btn { padding: 7px 14px; font-size: 13px; }
  .landing-main { padding: 30px 16px 48px; }
  .landing-logo { width: 64px; height: 64px; border-radius: 18px; font-size: 28px; margin-bottom: 16px; }
  .landing-hero { margin-bottom: 34px; }
  .landing-hero h1 { font-size: 30px; white-space: nowrap; }
  .landing-slogan { font-size: 14px; margin-bottom: 22px; }
  .landing-cta { flex-direction: column; align-items: stretch; padding: 0 26px; }
  .landing-cta .btn { width: 100%; justify-content: center; }
  .feature-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .feature-card { padding: 18px 12px; border-radius: 14px; }
  .feature-ico { font-size: 26px; margin-bottom: 8px; }
  .feature-card h3 { font-size: 14.5px; }
  .feature-card p { font-size: 11.5px; }
  .landing-foot { font-size: 11.5px; }

  .auth-body { padding: 16px; }
  .auth-card { padding: 30px 22px 26px; border-radius: 18px; }
}
.type-badge.type-bug { background: #fff0ef; color: var(--red); }
.type-badge.type-suggest { background: var(--primary-soft); color: var(--primary-700); }
.type-badge.type-other { background: #eef2f9; color: #56688d; }
.badge.status-open { background: #e4f8ef; color: #0b7d55; }
.badge.status-closed { background: #eef1f6; color: #7b8aa5; }
.replies { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 8px; }
.reply { display: flex; gap: 10px; padding: 7px 0; align-items: flex-start; }
.reply-main { flex: 1; min-width: 0; }
.ticket-foot { display: flex; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }

/* ---------------- 更新日志 ---------------- */
#timeline { position: relative; padding-left: 30px; }
#timeline::before { content: ''; position: absolute; left: 10px; top: 8px; bottom: 8px; width: 2.5px; background: linear-gradient(180deg, #b9cdf2, #dbe7ff); border-radius: 2px; }
.cl-item { position: relative; margin-bottom: 18px; }
.cl-dot {
  position: absolute; left: -30px; top: 20px; width: 23px; height: 23px; border-radius: 50%;
  background: linear-gradient(135deg, #4d8dff, #2456e6); color: #fff; display: grid; place-items: center;
  font-size: 11px; font-weight: 800; box-shadow: 0 0 0 4px #dbe7ff;
}
.cl-card { padding: 18px 22px; }
.cl-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.cl-version {
  display: inline-block; background: linear-gradient(135deg, #4d8dff, #2456e6); color: #fff;
  font-size: 11.5px; font-weight: 800; padding: 2.5px 10px; border-radius: 999px; margin-right: 9px;
}
.cl-title { font-weight: 800; font-size: 15.5px; }
.cl-meta { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.cl-content { margin-top: 6px; }

/* ---------------- 文件中心 ---------------- */
.file-tabs { display: flex; gap: 6px; padding: 6px 4px 12px; }
.file-tabs .chat-tab { margin-right: 10px; }
.vis-radio {
  display: flex; align-items: center; gap: 10px; border: 1.5px solid var(--line); border-radius: 11px;
  padding: 11px 15px; margin-bottom: 9px; cursor: pointer; transition: .15s; background: #fbfdff;
}
.vis-radio:hover { border-color: #b9cdf2; }
.vis-radio:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px rgba(47, 107, 255, .1); }
.vis-label { font-weight: 700; font-size: 14px; flex: none; }
.vis-desc { color: var(--muted); font-size: 12.5px; }
