/* =============================================================
   学习星球 · 全站样式
   ============================================================= */

:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #eef2ff;
  --accent: #0ea5e9;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #111827;
  --text-soft: #374151;
  --muted: #6b7280;
  --border: #e8eaf0;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 2px 6px rgba(16, 24, 40, .04), 0 12px 28px rgba(16, 24, 40, .06);
  --shadow-lg: 0 20px 50px rgba(16, 24, 40, .12);
  --header-h: 66px;
}

* { box-sizing: border-box; }

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

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

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; display: block; }

h1, h2, h3, h4 { margin: 0 0 .6em; line-height: 1.35; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 30px; }
h2 { font-size: 22px; }
h3 { font-size: 17px; }
p { margin: 0 0 1em; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.container-narrow { max-width: 820px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; }
.flex { display: flex; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }

/* ---------------- 顶部导航 ---------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 17px;
  color: var(--text);
  letter-spacing: -.02em;
  flex-shrink: 0;
}
.brand:hover { color: var(--text); }

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 50%, var(--accent) 100%);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(79, 70, 229, .3);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
}

.main-nav a {
  padding: 8px 12px;
  border-radius: 9px;
  color: var(--text-soft);
  font-size: 14.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .16s, color .16s;
}
.main-nav a:hover { background: #f2f3f8; color: var(--text); }
.main-nav a.active { color: var(--primary); background: var(--primary-light); font-weight: 600; }

.nav-search { margin-left: auto; position: relative; }
.nav-search input {
  width: 210px;
  height: 38px;
  padding: 0 14px 0 36px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f7f8fc;
  font-size: 14px;
  color: var(--text);
  transition: all .18s;
  outline: none;
}
.nav-search input:focus { background: #fff; border-color: #c7cdff; box-shadow: 0 0 0 4px rgba(79, 70, 229, .1); width: 250px; }
.nav-search::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 11px;
  width: 14px;
  height: 14px;
  border: 2px solid #9aa1b1;
  border-radius: 50%;
}
.nav-search::after {
  content: "";
  position: absolute;
  left: 25px;
  top: 24px;
  width: 6px;
  height: 2px;
  background: #9aa1b1;
  transform: rotate(45deg);
}

.nav-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.icon-btn {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--text-soft);
  background: transparent;
  border: 0;
  cursor: pointer;
}
.icon-btn:hover { background: #f2f3f8; color: var(--text); }
.icon-btn .dot {
  position: absolute;
  top: 5px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  font-weight: 700;
}

.dropdown { position: relative; }
.dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px 5px 5px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-soft);
}
.dropdown-toggle:hover { border-color: #cfd4ea; }
.avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; background: var(--primary-light); }
.avatar-lg { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; }
.avatar-md { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 210px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  display: none;
  z-index: 60;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border-radius: 8px;
  color: var(--text-soft);
  font-size: 14px;
}
.dropdown-menu a:hover { background: #f5f6fa; color: var(--text); }
.dropdown-menu .divider { height: 1px; background: var(--border); margin: 6px 4px; }

.nav-toggle {
  display: none;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font-size: 18px;
  cursor: pointer;
}

/* ---------------- 按钮 ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: #fff;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .16s;
  white-space: nowrap;
  font-family: inherit;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(79, 70, 229, .24); }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }

.btn-outline { border-color: var(--border); color: var(--text-soft); }
.btn-outline:hover { border-color: #c7cdff; color: var(--primary); background: #fbfbff; }

.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: #f2f3f8; color: var(--text); }

.btn-danger { background: #fef2f2; color: var(--danger); border-color: #fee2e2; }
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; color: #fff; }

.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { height: 46px; padding: 0 26px; font-size: 15px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

/* ---------------- 卡片与栅格 ---------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 24px; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.section { padding: 46px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.section-head h2 { margin: 0; font-size: 22px; }
.section-head .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }

/* ---------------- 首页 ---------------- */

.hero {
  position: relative;
  overflow: hidden;
  background: radial-gradient(1200px 420px at 12% -10%, #e6e9ff 0%, rgba(246, 247, 251, 0) 60%),
              radial-gradient(900px 380px at 92% 0%, #e0f4ff 0%, rgba(246, 247, 251, 0) 55%),
              var(--bg);
  border-bottom: 1px solid var(--border);
}
.hero-inner { padding: 64px 0 56px; display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-soft);
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
}
.hero-badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--success); display: inline-block; }

.hero h1 { font-size: 42px; line-height: 1.2; letter-spacing: -.03em; margin-bottom: 16px; }
.hero h1 em { font-style: normal; background: linear-gradient(120deg, var(--primary), #a855f7 60%, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 16.5px; color: var(--muted); max-width: 520px; margin-bottom: 26px; }

.hero-actions { display: flex; gap: 12px; margin-bottom: 34px; }

.hero-stats { display: flex; gap: 34px; }
.hero-stat strong { display: block; font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.hero-stat span { font-size: 13px; color: var(--muted); }

.hero-art { position: relative; height: 340px; }
.hero-art .blob {
  position: absolute;
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  background: #fff;
  border: 1px solid var(--border);
  overflow: hidden;
}
.hero-art .b1 { width: 62%; height: 210px; left: 0; top: 20px; transform: rotate(-4deg); }
.hero-art .b2 { width: 52%; height: 170px; right: 0; top: 120px; transform: rotate(5deg); }
.hero-art .b3 { width: 40%; height: 110px; left: 24%; bottom: 0; transform: rotate(-2deg); background: linear-gradient(135deg, var(--primary), #7c3aed); border: 0; }
.hero-art .b3 span { color: #fff; font-size: 13px; display: block; padding: 16px; opacity: .9; }
.hero-art .b3 strong { display: block; font-size: 26px; color: #fff; padding: 0 16px; }

.hero-art .cover { width: 100%; height: 100%; object-fit: cover; opacity: .95; }

/* 教程卡片 */

.course-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.course-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: #dfe3f3; }

.course-cover { position: relative; aspect-ratio: 16 / 10; background: #eef1f8; overflow: hidden; }
.course-cover img { width: 100%; height: 100%; object-fit: cover; }
.course-cover .badge { position: absolute; left: 12px; top: 12px; }
.course-cover .duration {
  position: absolute; right: 12px; bottom: 12px;
  background: rgba(17, 24, 39, .72); color: #fff;
  font-size: 12px; padding: 3px 8px; border-radius: 6px;
  backdrop-filter: blur(4px);
}

.course-body { padding: 16px 18px 18px; display: flex; flex-direction: column; flex: 1; }
.course-body h3 { font-size: 16px; margin-bottom: 8px; line-height: 1.45; }
.course-body h3 a { color: var(--text); }
.course-body h3 a:hover { color: var(--primary); }
.course-summary { color: var(--muted); font-size: 13.5px; margin-bottom: 14px; min-height: 42px; }
.course-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; font-size: 12.5px; color: var(--muted); }
.course-teacher { display: flex; align-items: center; gap: 7px; }
.course-teacher img { width: 22px; height: 22px; border-radius: 50%; }

/* 素材卡片 */

.resource-item {
  display: flex;
  gap: 14px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: all .16s;
}
.resource-item:hover { border-color: #dfe3f3; box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.file-icon {
  width: 46px; height: 46px; flex-shrink: 0;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800; color: #fff;
  text-transform: uppercase;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
}
.file-icon.pdf { background: linear-gradient(135deg, #ef4444, #f97316); }
.file-icon.zip, .file-icon.rar { background: linear-gradient(135deg, #f59e0b, #eab308); }
.file-icon.doc, .file-icon.docx { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.file-icon.xls, .file-icon.xlsx { background: linear-gradient(135deg, #059669, #10b981); }
.file-icon.ppt, .file-icon.pptx { background: linear-gradient(135deg, #ea580c, #f97316); }
.resource-item h4 { margin: 0 0 4px; font-size: 14.5px; font-weight: 600; line-height: 1.4; }
.resource-item h4 a { color: var(--text); }
.resource-item h4 a:hover { color: var(--primary); }
.resource-item .meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; }

/* 问答条 */

.qa-item {
  display: flex;
  gap: 16px;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: all .16s;
}
.qa-item:hover { border-color: #dfe3f3; box-shadow: var(--shadow-sm); }
.qa-stats { text-align: center; flex-shrink: 0; width: 62px; }
.qa-stats .num { font-size: 18px; font-weight: 800; line-height: 1.1; display: block; }
.qa-stats .lbl { font-size: 11px; color: var(--muted); }
.qa-stats .solved { color: var(--success); }
.qa-main { min-width: 0; flex: 1; }
.qa-main h4 { margin: 0 0 6px; font-size: 15.5px; font-weight: 600; line-height: 1.45; }
.qa-main h4 a { color: var(--text); }
.qa-main h4 a:hover { color: var(--primary); }
.qa-excerpt { color: var(--muted); font-size: 13.5px; margin-bottom: 10px; }
.qa-meta { display: flex; align-items: center; gap: 12px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }

/* ---------------- 徽章 / 标签 ---------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: #f2f3f8;
  color: var(--text-soft);
  white-space: nowrap;
}
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-success { background: #ecfdf5; color: #047857; }
.badge-warning { background: #fffbeb; color: #b45309; }
.badge-danger { background: #fef2f2; color: #b91c1c; }
.badge-info { background: #eff6ff; color: #1d4ed8; }
.badge-gray { background: #f3f4f6; color: #4b5563; }

.tag {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--muted);
  transition: all .15s;
}
.tag:hover { border-color: #c7cdff; color: var(--primary); background: #fbfbff; }

/* ---------------- 页面头部 ---------------- */

.page-head { background: #fff; border-bottom: 1px solid var(--border); padding: 34px 0; }
.page-head h1 { margin-bottom: 6px; font-size: 26px; }
.page-head .sub { color: var(--muted); font-size: 14.5px; margin: 0; }

.page-body { padding: 34px 0 64px; }

/* ---------------- 筛选栏 ---------------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 22px;
}
.chip-group { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-soft);
  background: #f5f6fa;
  border: 1px solid transparent;
  transition: all .15s;
}
.chip:hover { background: #eef0f7; color: var(--text); }
.chip.active { background: var(--primary); color: #fff; }

.search-inline { display: flex; gap: 8px; margin-left: auto; }
.search-inline input {
  height: 38px;
  width: 220px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
}
.search-inline input:focus { border-color: #c7cdff; box-shadow: 0 0 0 3px rgba(79, 70, 229, .1); }

select.auto, input.auto {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  font-size: 13.5px;
  color: var(--text-soft);
  outline: none;
  font-family: inherit;
}

/* ---------------- 表单 ---------------- */

.form-card { max-width: 720px; margin: 0 auto; }
.field { margin-bottom: 18px; }
.field label { display: block; margin-bottom: 7px; font-size: 13.5px; font-weight: 600; color: var(--text-soft); }
.field .hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.field .err { font-size: 12.5px; color: var(--danger); margin-top: 5px; }

.input, .textarea, .select {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: all .16s;
}
.input { height: 42px; }
.textarea { min-height: 120px; resize: vertical; line-height: 1.7; }
.input:focus, .textarea:focus, .select:focus {
  border-color: #b9c0ff;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, .1);
}
.input.error, .textarea.error { border-color: #fca5a5; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }

.form-actions { display: flex; gap: 10px; padding-top: 6px; }

/* 登录注册 */

.auth-wrap { min-height: calc(100vh - var(--header-h)); display: grid; grid-template-columns: 1fr 1fr; }
.auth-side {
  background: linear-gradient(150deg, #4338ca 0%, #4f46e5 35%, #7c3aed 70%, #0ea5e9 130%);
  color: #fff;
  padding: 64px 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.auth-side::after {
  content: "";
  position: absolute;
  width: 420px; height: 420px;
  right: -120px; bottom: -140px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
}
.auth-side h2 { font-size: 30px; line-height: 1.35; margin-bottom: 14px; }
.auth-side p { color: rgba(255, 255, 255, .82); font-size: 15px; max-width: 380px; }
.auth-side ul { list-style: none; padding: 0; margin: 26px 0 0; }
.auth-side li { display: flex; gap: 10px; align-items: center; font-size: 14px; color: rgba(255, 255, 255, .9); margin-bottom: 12px; }
.auth-side li i { width: 20px; height: 20px; border-radius: 50%; background: rgba(255, 255, 255, .2); display: grid; place-items: center; font-size: 11px; font-style: normal; }

.auth-main { display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.auth-box { width: 100%; max-width: 380px; }
.auth-box h1 { font-size: 26px; margin-bottom: 8px; }
.auth-box .sub { color: var(--muted); font-size: 14px; margin-bottom: 26px; }

.role-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.role-switch label {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px;
  text-align: center;
  font-size: 14px;
  cursor: pointer;
  transition: all .16s;
  color: var(--text-soft);
}
.role-switch input { display: none; }
.role-switch input:checked + label,
.role-switch label.checked { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }

.demo-tip {
  margin-top: 22px;
  padding: 13px 15px;
  border-radius: 10px;
  background: #f8f9ff;
  border: 1px dashed #d7dbff;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.9;
}
.demo-tip b { color: var(--text-soft); }

/* ---------------- 提示条 ---------------- */

.flash-stack { position: fixed; top: 80px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: 340px; }
.flash {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 15px;
  border-radius: 11px;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  animation: flashIn .3s ease;
}
@keyframes flashIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.flash.success { border-left: 3px solid var(--success); }
.flash.error { border-left: 3px solid var(--danger); }
.flash .close { margin-left: auto; background: none; border: 0; color: #9ca3af; cursor: pointer; font-size: 16px; line-height: 1; padding: 0; }

.alert { padding: 12px 16px; border-radius: 10px; font-size: 13.5px; margin-bottom: 18px; }
.alert-info { background: #eff6ff; color: #1e40af; }
.alert-warn { background: #fffbeb; color: #92400e; }
.alert-danger { background: #fef2f2; color: #991b1b; }
.alert-success { background: #ecfdf5; color: #065f46; }

/* ---------------- 表格 ---------------- */

.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: #fff; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 680px; }
.table th {
  text-align: left;
  padding: 12px 16px;
  background: #fafbfe;
  color: var(--muted);
  font-weight: 600;
  font-size: 12.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 13px 16px; border-bottom: 1px solid #f1f3f9; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fcfcff; }
.table .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.table .title-cell { font-weight: 600; color: var(--text); }

/* ---------------- 分页 ---------------- */

.pager { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 34px; flex-wrap: wrap; }
.pager a, .pager span {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13.5px;
  color: var(--text-soft);
  background: #fff;
  border: 1px solid var(--border);
}
.pager a:hover { border-color: #c7cdff; color: var(--primary); }
.pager .current { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.pager .disabled { color: #c3c7d4; background: #fafbfe; }
.pager .info { border: 0; background: transparent; color: var(--muted); font-size: 13px; }

/* ---------------- 空状态 ---------------- */

.empty { padding: 60px 20px; text-align: center; color: var(--muted); }
.empty .icon { font-size: 40px; margin-bottom: 12px; opacity: .5; }
.empty p { margin-bottom: 16px; font-size: 14px; }

/* ---------------- 详情页 ---------------- */

.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 26px; align-items: start; }

.course-hero {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.course-hero-body { padding: 28px; }
.course-hero h1 { font-size: 26px; margin-bottom: 12px; }
.course-hero .meta-row { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 18px; }

.chapter-list { list-style: none; padding: 0; margin: 0; }
.chapter-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid #f2f4fa;
  font-size: 14px;
  transition: background .15s;
}
.chapter-item:last-child { border-bottom: 0; }
.chapter-item:hover { background: #fbfbff; }
.chapter-item .idx {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: #f2f3f8;
  color: var(--muted);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.chapter-item.done .idx { background: #ecfdf5; color: var(--success); }
.chapter-item a { color: var(--text); flex: 1; min-width: 0; }
.chapter-item a:hover { color: var(--primary); }

.side-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; }
.side-card h3 { font-size: 15px; margin-bottom: 14px; }

/* 贡献者 / 成员列表（首页侧栏、成员页通用） */
.contrib-list { display: flex; flex-direction: column; gap: 12px; }
.contrib { display: flex; align-items: center; gap: 10px; min-width: 0; }
.contrib-main { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.contrib-name { font-size: 13.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contrib-meta { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contrib-num {
  font-size: 12px; font-weight: 700; color: var(--primary);
  background: var(--primary-light); border-radius: 999px; padding: 2px 9px; flex-shrink: 0;
}
.side-row { display: flex; justify-content: space-between; font-size: 13.5px; padding: 7px 0; color: var(--muted); }
.side-row b { color: var(--text); font-weight: 600; }

.progress { height: 8px; border-radius: 999px; background: #eef0f7; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), #7c3aed); transition: width .3s; }

.learn-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 26px; align-items: start; }
.learn-side { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; position: sticky; top: 86px; }
.learn-side h3 { font-size: 14px; margin-bottom: 12px; }
.learn-side .chapter-item { padding: 9px 10px; border-radius: 8px; border-bottom: 0; font-size: 13.5px; }
.learn-side .chapter-item.current { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
.learn-side .chapter-item.current a { color: var(--primary-dark); }

.article { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 34px; }
.article h1 { font-size: 24px; margin-bottom: 18px; }
.prose { font-size: 15.5px; line-height: 1.9; color: var(--text-soft); }
.prose h3 { margin-top: 1.6em; font-size: 17px; color: var(--text); }
.prose h4 { margin-top: 1.4em; }
.prose p { margin-bottom: 1.1em; }
.prose ul, .prose ol { padding-left: 1.4em; margin-bottom: 1.1em; }
.prose li { margin-bottom: .4em; }
.prose pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 16px 18px;
  border-radius: 12px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.75;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.prose code { background: #f2f3f8; padding: 2px 6px; border-radius: 5px; font-size: 13px; color: #be185d; font-family: ui-monospace, Menlo, Consolas, monospace; }
.prose pre code { background: none; color: inherit; padding: 0; }
.prose blockquote { margin: 1.2em 0; padding: 12px 18px; border-left: 3px solid var(--primary); background: #f8f9ff; color: var(--text-soft); border-radius: 0 8px 8px 0; }
.prose img { border-radius: 10px; margin: 1em 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: 14px; }
.prose th, .prose td { border: 1px solid var(--border); padding: 9px 12px; text-align: left; }
.prose th { background: #fafbfe; }

/* 评论 */

.comment-list { list-style: none; padding: 0; margin: 0; }
.comment { display: flex; gap: 12px; padding: 16px 0; border-bottom: 1px solid #f2f4fa; }
.comment:last-child { border-bottom: 0; }
.comment .body { flex: 1; min-width: 0; }
.comment .head { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; flex-wrap: wrap; }
.comment .name { font-weight: 600; font-size: 13.5px; color: var(--text); }
.comment .time { font-size: 12px; color: var(--muted); }
.comment .text { font-size: 14px; color: var(--text-soft); line-height: 1.75; word-break: break-word; }

/* 回答 */

.answer {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 16px;
  background: #fff;
}
.answer.best { border-color: #a7f3d0; background: #f6fffb; }
.answer-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.answer-body { font-size: 14.5px; line-height: 1.85; color: var(--text-soft); word-break: break-word; }
.answer-foot { display: flex; align-items: center; gap: 14px; margin-top: 14px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }

.like-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 0; cursor: pointer;
  color: var(--muted); font-size: 13px; font-family: inherit;
  padding: 4px 8px; border-radius: 8px;
}
.like-btn:hover { background: #f5f6fa; color: var(--primary); }
.like-btn.liked { color: var(--primary); font-weight: 600; }

/* ---------------- 个人中心 ---------------- */

.profile-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 24px; align-items: start; }

.side-nav { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; position: sticky; top: 86px; }
.side-user { display: flex; gap: 12px; align-items: center; padding: 12px 12px 16px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.side-user .name { font-weight: 700; font-size: 14.5px; }
.side-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  color: var(--text-soft);
  font-size: 14px;
  margin-bottom: 2px;
}
.side-nav a:hover { background: #f6f7fb; color: var(--text); }
.side-nav a.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
.side-nav a .count { margin-left: auto; font-size: 12px; color: var(--muted); }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat-box { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; }
.stat-box .num { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.stat-box .lbl { font-size: 12.5px; color: var(--muted); }

.panel { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.panel-head h2 { font-size: 17px; margin: 0; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tabs a { padding: 9px 14px; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ---------------- 后台 ---------------- */

.admin-shell { display: grid; grid-template-columns: 226px minmax(0, 1fr); min-height: calc(100vh - var(--header-h)); }
.admin-side {
  background: #fff;
  border-right: 1px solid var(--border);
  padding: 18px 12px;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
}
.admin-side .group-title { font-size: 11.5px; color: #9aa1b1; text-transform: uppercase; letter-spacing: .06em; padding: 14px 12px 6px; }
.admin-side a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 14px;
  color: var(--text-soft);
  margin-bottom: 2px;
}
.admin-side a:hover { background: #f6f7fb; }
.admin-side a.active { background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(79, 70, 229, .22); }
.admin-main { padding: 26px 28px 56px; min-width: 0; }
.admin-title { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.admin-title h1 { font-size: 21px; margin: 0; }
.admin-title .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  position: relative;
  overflow: hidden;
}
.kpi .lbl { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.kpi .num { font-size: 27px; font-weight: 800; letter-spacing: -.02em; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi::after { content: ""; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: var(--primary-light); opacity: .7; }

.chart-box { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 22px; }
.chart-box h3 { font-size: 15px; margin-bottom: 16px; }
.bars { display: flex; align-items: flex-end; gap: 12px; height: 180px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bar {
  width: 100%;
  max-width: 46px;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, #6366f1, #a5b4fc);
  min-height: 6px;
  transition: height .4s ease;
}
.bar-col .val { font-size: 11.5px; color: var(--muted); }
.bar-col .day { font-size: 11.5px; color: var(--muted); }

/* ---------------- 页脚 ---------------- */

.site-footer { background: #fff; border-top: 1px solid var(--border); padding: 36px 0 28px; margin-top: 20px; }
.footer-inner { display: flex; justify-content: space-between; gap: 30px; flex-wrap: wrap; }
.footer-brand { max-width: 340px; }
.footer-brand p { color: var(--muted); font-size: 13.5px; margin: 10px 0 0; }
.footer-links { display: flex; gap: 48px; flex-wrap: wrap; }
.footer-col h5 { font-size: 13px; margin: 0 0 10px; color: var(--text); font-weight: 600; }
.footer-col a { display: block; color: var(--muted); font-size: 13px; padding: 3px 0; }
.footer-col a:hover { color: var(--primary); }
.footer-bottom { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12.5px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------------- 响应式 ---------------- */

@media (max-width: 1080px) {
  .hero-inner { grid-template-columns: 1fr; gap: 30px; }
  .hero-art { display: none; }
  .detail-grid { grid-template-columns: 1fr; }
  .learn-layout { grid-template-columns: 1fr; }
  .learn-side { position: static; }
  .profile-layout { grid-template-columns: 1fr; }
  .side-nav { position: static; display: flex; flex-wrap: wrap; gap: 4px; }
  .side-nav .side-user { width: 100%; border-bottom: 0; padding-bottom: 6px; }
  .side-nav a { flex: 0 0 auto; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { position: static; height: auto; display: flex; flex-wrap: wrap; gap: 4px; padding: 10px; }
  .admin-side .group-title { display: none; }
  .admin-side a { margin: 0; }
  .nav-search { display: none; }
}

@media (max-width: 860px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .main-nav { display: none; position: absolute; top: var(--header-h); left: 0; right: 0; background: #fff; border-bottom: 1px solid var(--border); padding: 10px 16px; flex-direction: column; align-items: stretch; gap: 2px; box-shadow: var(--shadow); }
  .main-nav.open { display: flex; }
  .nav-toggle { display: block; margin-left: auto; }
  .header-inner { gap: 12px; }
  .dropdown-toggle .uname { display: none; }
}

@media (max-width: 640px) {
  h1 { font-size: 25px; }
  .hero h1 { font-size: 30px; }
  .hero-inner { padding: 40px 0 36px; }
  .hero-stats { gap: 22px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .page-body { padding: 22px 0 44px; }
  .card-pad, .panel, .article { padding: 18px; }
  .section { padding: 30px 0; }
  .search-inline { width: 100%; margin-left: 0; }
  .search-inline input { width: 100%; }
  .flash-stack { left: 16px; right: 16px; max-width: none; }
  .footer-links { gap: 28px; }
  .center-mobile { text-align: center; }
}

/* ---------------- 补充组件 ---------------- */

.menu-form { margin: 0; }
.menu-form button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 11px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--danger);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}
.menu-form button:hover { background: #fef2f2; }

.to-top {
  position: fixed;
  right: 24px;
  bottom: 28px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-soft);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .2s;
  z-index: 80;
}
.to-top:hover { color: var(--primary); transform: translateY(-2px); }

details > summary { list-style: none; outline: none; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary { color: var(--primary); }

.file-icon { letter-spacing: -.5px; }

/* 表格内的行内表单不换行 */
.table .actions form { display: inline-flex; margin: 0; }

/* 打印（练习、成绩单场景） */
@media print {
  .site-header, .site-footer, .flash-stack, .to-top, .side-card, .btn { display: none !important; }
  body { background: #fff; }
  .panel, .article { border: 0; box-shadow: none; }
}
