/* ==========================================================================
   班级学习空间 · 样式表
   改颜色改 :root 变量即可；深色模式在 [data-theme="dark"] 里覆盖。
   字号通过 <html data-font="sm|md|lg"> 整体缩放（所有尺寸用 rem）。
   ========================================================================== */

/* ---------- 1. 设计变量 ---------- */
:root {
  --bg: #f4f5fa;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --text: #15171d;
  --muted: #6b7280;
  --border: #e5e7f0;
  --accent: #5450e0;
  --accent-ink: #ffffff;
  --accent-soft: #eeedff;
  --ok: #0f9d76;
  --ok-soft: #e6f7f0;
  --warn: #b45309;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 2px 4px rgba(16, 24, 40, 0.04), 0 12px 32px -16px rgba(16, 24, 40, 0.18);
  --radius: 16px;
  --radius-sm: 10px;
  --topbar-h: 64px;
}

[data-theme='dark'] {
  --bg: #0d0f15;
  --surface: #161923;
  --surface-2: #1c202c;
  --text: #e8ebf3;
  --muted: #98a0b3;
  --border: #262b39;
  --accent: #8b88ff;
  --accent-ink: #10121a;
  --accent-soft: #1e2038;
  --ok: #34d399;
  --ok-soft: #10271f;
  --warn: #fbbf24;
  --danger: #f87171;
  --danger-soft: #2a1418;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.4), 0 16px 40px -20px rgba(0, 0, 0, 0.9);
}

html[data-font='sm'] { font-size: 14px; }
html[data-font='md'] { font-size: 16px; }
html[data-font='lg'] { font-size: 18.5px; }

/* ---------- 2. 基础 ---------- */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', sans-serif;
  font-size: 0.94rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; line-height: 1.3; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }
button { font-family: inherit; }
::selection { background: color-mix(in srgb, var(--accent) 24%, transparent); }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }
/* 只设上下内边距，左右交给 .wrap，避免把小屏的内容顶到边缘 */
.page { padding-top: 28px; padding-bottom: 72px; }

.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.row { display: flex; align-items: center; gap: 8px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hidden { display: none !important; }

/* ---------- 3. 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  height: var(--topbar-h);
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--text); flex-shrink: 0; min-width: 0; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #22d3ee));
  font-size: 1.05rem;
  box-shadow: var(--shadow-sm);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong { font-size: 0.95rem; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.brand-text small { font-size: 0.72rem; color: var(--muted); white-space: nowrap; }

.nav { display: flex; align-items: center; gap: 2px; margin-left: 6px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav-link {
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.icon-btn {
  height: 36px;
  min-width: 36px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  white-space: nowrap;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.font-label { font-size: 0.72rem; color: var(--muted); }
.icon-btn:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.icon-btn:active { transform: scale(0.96); }

.user-menu { position: relative; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.user-chip:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.user-name { font-size: 0.85rem; font-weight: 600; max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.avatar {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.8rem;
}

.user-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 160px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: none;
}
.user-pop.open { display: block; }
.user-pop-name { font-size: 0.85rem; font-weight: 600; padding: 2px 6px 8px; }

/* ---------- 4. 按钮 / 表单 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: 0.15s;
  white-space: nowrap;
}
.btn:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); border-color: transparent; }

.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn-sm { padding: 5px 11px; font-size: 0.8rem; border-radius: 8px; }
.btn-lg { padding: 11px 20px; font-size: 0.95rem; }

.input, .textarea, .select {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
.textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 0.82rem; font-weight: 600; color: var(--muted); }

/* 开关 */
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-size: 0.85rem; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: var(--border);
  position: relative;
  transition: background 0.18s;
  flex-shrink: 0;
}
.switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.18s;
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }

/* 标签 */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  background: color-mix(in srgb, var(--chip-color, var(--accent)) 12%, transparent);
  color: color-mix(in srgb, var(--chip-color, var(--accent)) 78%, var(--text));
  border: 1px solid color-mix(in srgb, var(--chip-color, var(--accent)) 24%, transparent);
  white-space: nowrap;
}
[data-theme='dark'] .chip { color: color-mix(in srgb, var(--chip-color, var(--accent)) 70%, #fff); }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip-chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.82rem;
  cursor: pointer;
  transition: 0.15s;
}
.chip-chip:hover { border-color: color-mix(in srgb, var(--chip-color, var(--accent)) 50%, var(--border)); color: var(--text); }
.chip-chip.on {
  background: color-mix(in srgb, var(--chip-color, var(--accent)) 14%, transparent);
  border-color: color-mix(in srgb, var(--chip-color, var(--accent)) 55%, transparent);
  color: color-mix(in srgb, var(--chip-color, var(--accent)) 80%, var(--text));
  font-weight: 600;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.6;
}
.badge-admin { background: var(--accent-soft); color: var(--accent); }
.badge-solved { background: var(--ok-soft); color: var(--ok); }
.badge-anon { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

/* ---------- 5. 卡片 / 区块 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.section { margin-top: 30px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-title { font-size: 1.03rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.section-sub { font-size: 0.8rem; color: var(--muted); }

/* ---------- 6. 首页 ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 34px 30px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.hero::before {
  content: '';
  position: absolute;
  inset: -40% -15% auto auto;
  width: 460px;
  height: 460px;
  background: radial-gradient(circle at center, color-mix(in srgb, var(--accent) 26%, transparent), transparent 62%);
  pointer-events: none;
}
.hero > * { position: relative; }
.hero h1 { font-size: 1.75rem; letter-spacing: -0.02em; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero-sub { margin-top: 8px; color: var(--muted); font-size: 0.9rem; max-width: 46ch; }
.hero-actions { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 10px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 18px; }
.stat { padding: 16px 18px; }
.stat-value { font-size: 1.5rem; font-weight: 750; letter-spacing: -0.02em; line-height: 1.2; }
.stat-label { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }

.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 14px; }

.course-card {
  position: relative;
  display: block;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s, box-shadow 0.16s, border-color 0.16s;
  overflow: hidden;
}
.course-card::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 3px;
  background: var(--c, var(--accent));
}
.course-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--c, var(--accent)) 40%, var(--border));
  text-decoration: none;
}
.course-name { font-size: 1rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.course-code { font-size: 0.74rem; color: var(--muted); margin-top: 2px; letter-spacing: 0.03em; }
.course-counts { display: flex; gap: 14px; margin-top: 14px; font-size: 0.78rem; color: var(--muted); }
.course-counts b { color: var(--text); font-weight: 650; }

.course-new {
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 132px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: 0.16s;
}
.course-new:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.course-new span:first-child { font-size: 1.35rem; line-height: 1; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.mini-list { padding: 6px; }
.mini-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--text);
}
.mini-item:hover { background: var(--surface-2); text-decoration: none; }
.mini-main { min-width: 0; flex: 1; }
.mini-title { display: block; font-size: 0.88rem; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-meta { display: block; font-size: 0.74rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-icon { width: 32px; height: 32px; font-size: 0.9rem; border-radius: 9px; }

/* 颜色选择圆点 */
.color-dot {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--dot);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.color-dot:hover { transform: scale(1.08); }
.color-dot.on {
  border-color: var(--surface);
  box-shadow: 0 0 0 2px var(--dot);
}

/* ---------- 7. 课程页 ---------- */
.page-head { margin-bottom: 20px; }
.back-link { font-size: 0.82rem; color: var(--muted); }
.back-link:hover { color: var(--accent); text-decoration: none; }
.page-title { font-size: 1.5rem; margin-top: 8px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.course-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; display: inline-block; }
.page-sub { color: var(--muted); font-size: 0.85rem; margin-top: 6px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.search-input { max-width: 260px; }

.material-list { display: flex; flex-direction: column; gap: 10px; }

.material {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: 0.15s;
}
.material:hover { border-color: color-mix(in srgb, var(--accent) 32%, var(--border)); box-shadow: var(--shadow-sm); }
.material-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--accent-soft);
  font-size: 1.05rem;
}
.material-icon.file { background: var(--surface-2); }
.material-body { flex: 1; min-width: 0; }
.material-title {
  font-size: 0.93rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  display: block;
  border: 0;
  padding: 0;
  background: none;
  text-align: left;
  max-width: 100%;
  font-family: inherit;
}
.material-title:hover { color: var(--accent); }
.material-title.plain { cursor: default; }
.material-title.plain:hover { color: var(--text); }
.material-meta { font-size: 0.75rem; color: var(--muted); margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; }
.material-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ---------- 8. 答疑 ---------- */
.post-card {
  display: block;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  transition: 0.15s;
}
.post-card:hover { text-decoration: none; border-color: color-mix(in srgb, var(--accent) 32%, var(--border)); box-shadow: var(--shadow-sm); }
.post-card-head { display: flex; align-items: flex-start; gap: 10px; }
.post-title { font-size: 0.97rem; font-weight: 650; flex: 1; min-width: 0; }
.post-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-size: 0.75rem; color: var(--muted); }
.post-excerpt { margin-top: 8px; font-size: 0.85rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.answer-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.73rem;
  color: var(--muted);
  flex-shrink: 0;
}
.answer-pill.hot { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.thread { padding: 22px 24px; }
.thread-title { font-size: 1.32rem; letter-spacing: -0.01em; }
.thread-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; font-size: 0.78rem; color: var(--muted); }
.thread-body { margin-top: 18px; }

.answer {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.answer + .answer { margin-top: 10px; }
.answer-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.answer-floor { font-size: 0.72rem; color: var(--muted); margin-left: auto; }

.compose { padding: 18px; }
.compose-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.compose-foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; }

.tabs { display: inline-flex; padding: 3px; background: var(--surface-2); border-radius: 10px; border: 1px solid var(--border); gap: 2px; }
.tab {
  padding: 5px 12px;
  border: 0;
  background: transparent;
  border-radius: 7px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 550;
  cursor: pointer;
}
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- 9. Markdown 正文 ---------- */
.md { font-size: 0.94rem; line-height: 1.78; word-break: break-word; }
.md > *:first-child { margin-top: 0; }
.md > *:last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4 { margin: 1.4em 0 0.6em; line-height: 1.35; }
.md h1 { font-size: 1.45rem; }
.md h2 { font-size: 1.22rem; padding-bottom: 0.3em; border-bottom: 1px solid var(--border); }
.md h3 { font-size: 1.06rem; }
.md h4 { font-size: 0.98rem; }
.md p { margin: 0.7em 0; }
.md ul, .md ol { margin: 0.7em 0; padding-left: 1.4em; }
.md li { margin: 0.25em 0; }
.md li::marker { color: var(--muted); }
.md blockquote {
  margin: 0.9em 0;
  padding: 0.5em 1em;
  border-left: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  background: var(--surface-2);
  border-radius: 0 8px 8px 0;
  color: color-mix(in srgb, var(--text) 82%, var(--muted));
}
.md blockquote p { margin: 0.3em 0; }
.md code {
  padding: 0.15em 0.4em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: ui-monospace, 'SFMono-Regular', 'Cascadia Code', Consolas, monospace;
  font-size: 0.86em;
  color: color-mix(in srgb, var(--accent) 70%, var(--text));
}
.md pre.code-block {
  margin: 1em 0;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-x: auto;
}
.md pre code { padding: 0; background: none; border: 0; color: var(--text); font-size: 0.84em; line-height: 1.6; }
.md img { max-width: 100%; border-radius: 10px; margin: 0.6em 0; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 1.4em 0; }
.md .table-wrap { overflow-x: auto; margin: 1em 0; }
.md table { border-collapse: collapse; width: 100%; font-size: 0.88em; }
.md th, .md td { border: 1px solid var(--border); padding: 7px 11px; text-align: left; }
.md th { background: var(--surface-2); font-weight: 650; }
.md a { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- 10. 弹窗 / 编辑器 ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(9, 11, 17, 0.55);
  backdrop-filter: blur(3px);
}
.modal.open { display: flex; animation: fade 0.14s ease-out; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal-panel {
  width: min(880px, 100%);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  animation: pop 0.16s ease-out;
}
@keyframes pop { from { transform: translateY(8px) scale(0.99); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1rem; font-weight: 700; }
.modal-body { padding: 18px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.modal-close {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }

.editor-input {
  min-height: 300px;
  font-family: ui-monospace, 'SFMono-Regular', 'Cascadia Code', Consolas, monospace;
  font-size: 0.86rem;
  line-height: 1.7;
}
.preview-pane {
  min-height: 300px;
  max-height: 52vh;
  overflow-y: auto;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.editor-hint { font-size: 0.75rem; color: var(--muted); }
.editor-hint code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }

/* ---------- 11. 提示 / 空状态 / 加载 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 200;
  padding: 10px 18px;
  border-radius: 12px;
  background: #1c1f28;
  color: #fff;
  font-size: 0.85rem;
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.4);
  animation: toast-in 0.18s ease-out;
  max-width: 90vw;
}
.toast-error { background: var(--danger); }
.toast-ok { background: var(--ok); color: #04221a; }
.toast-out { opacity: 0; transition: opacity 0.2s; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

.empty {
  padding: 44px 20px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.88rem;
  background: var(--surface);
}
.empty-icon { font-size: 1.7rem; display: block; margin-bottom: 8px; opacity: 0.8; }

.skeleton { height: 64px; border-radius: 14px; background: var(--surface-2); animation: pulse 1.2s ease-in-out infinite; margin-bottom: 10px; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

/* ---------- 12. 登录页 ---------- */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 520px at 12% -10%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 65%),
    radial-gradient(700px 420px at 92% 108%, color-mix(in srgb, #22d3ee 14%, transparent), transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 400px;
  padding: 32px 30px 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 22px; }
.login-brand .brand-mark { width: 42px; height: 42px; border-radius: 13px; font-size: 1.2rem; }
.login-title { font-size: 1.28rem; font-weight: 750; letter-spacing: -0.02em; }
.login-sub { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }
.login-form { display: flex; flex-direction: column; gap: 14px; margin-top: 22px; }
.login-tip { margin-top: 18px; font-size: 0.76rem; color: var(--muted); text-align: center; line-height: 1.7; }
.login-error { color: var(--danger); font-size: 0.8rem; min-height: 1.1em; }
.login-theme { position: fixed; top: 18px; right: 18px; }

/* ---------- 13. 响应式 ---------- */
@media (max-width: 860px) {
  .two-col { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .topbar-inner { gap: 8px; height: auto; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
  .brand-text small { display: none; }
  .nav { order: 3; width: 100%; overflow-x: auto; margin-left: 0; padding-bottom: 2px; }
  .nav-link { padding: 6px 10px; font-size: 0.84rem; }
  .user-name { display: none; }
  .hero { padding: 26px 20px; }
  .hero h1 { font-size: 1.45rem; }
  .thread { padding: 18px; }
  .page { padding-top: 20px; padding-bottom: 56px; }
  .modal { padding: 10px; }
  .modal-body { padding: 14px; }
  .material { gap: 10px; padding: 12px; flex-wrap: wrap; }
  .material-body { flex: 1 1 calc(100% - 52px); }
  .material-actions { width: 100%; justify-content: flex-end; padding-top: 2px; }
}

@media (max-width: 520px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stat { padding: 12px 14px; }
  .stat-value { font-size: 1.25rem; }
  .course-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .course-card { padding: 14px; }
  .course-counts { gap: 10px; font-size: 0.72rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ==========================================================================
   新增：首页统计入口 / 登录注册 / 成员管理
   ========================================================================== */

.stat-link {
  display: block;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.16s, box-shadow 0.16s, border-color 0.16s;
}
.stat-link:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--accent) 38%, var(--border));
}
.stat-hint {
  margin-top: 8px;
  font-size: 0.73rem;
  color: var(--accent);
  opacity: 0.9;
}

/* 登录页的切换标签 */
.login-tabs { margin: 20px 0 2px; width: fit-content; }

.setpass-hint {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.7;
}
.setpass-hint b { color: var(--text); }

/* 成员 */
.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 12px;
}

.member-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.member-card:hover {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
  box-shadow: var(--shadow-sm);
}

.avatar-lg { width: 42px; height: 42px; font-size: 1rem; }

.member-main { flex: 1; min-width: 0; }
.member-name { font-size: 0.95rem; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.member-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 520px) {
  .member-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
    新增：资料审核 / 竞赛板块 / 建言献策 / 课程介绍
   ========================================================================== */

/* 状态徽章 */
.badge-pending {
  background: color-mix(in srgb, var(--warn) 14%, transparent);
  color: var(--warn);
}
.badge-rejected {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}
.badge-submitted {
  background: var(--ok-soft);
  color: var(--ok);
}

/* 首页：管理员待审核提醒 */
.review-banner {
  display: block;
  margin-top: 18px;
  padding: 13px 18px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--border));
  background: color-mix(in srgb, var(--warn) 8%, var(--surface));
  color: var(--text);
  font-size: 0.88rem;
}
.review-banner:hover {
  text-decoration: none;
  border-color: var(--warn);
}
.review-banner b {
  color: var(--warn);
}

/* 建言献策：政策说明条 */
.board-note {
  margin-bottom: 16px;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  border-left: 4px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}
.small-note {
  margin-bottom: 0;
  padding: 10px 14px;
  font-size: 0.8rem;
  font-weight: 500;
}

/* 课程介绍 */
.course-intro {
  padding: 18px 20px;
  margin-bottom: 18px;
}
.intro-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.intro-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.course-intro .md {
  font-size: 0.92rem;
}

/* 竞赛报名方式 */
.signup-box {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.signup-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 6px;
}

/* 页脚：ICP / 公安备案公示 */
.site-footer {
  margin-top: 56px;
  padding: 22px 16px 30px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.8;
}
.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 14px;
}
.site-footer a {
  color: var(--muted);
  text-decoration: none;
}
.site-footer a:hover {
  color: var(--accent);
  text-decoration: underline;
}
.site-footer .sep {
  opacity: 0.45;
}

